diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..ff9286de --- /dev/null +++ b/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "cd12099-Full-Stack-Apps-AWS", + "lockfileVersion": 2, + "requires": true, + "packages": {} +} diff --git a/project starter code/.gitignore b/project starter code/.gitignore new file mode 100644 index 00000000..bca646a7 --- /dev/null +++ b/project starter code/.gitignore @@ -0,0 +1,5 @@ + +# Elastic Beanstalk Files +.elasticbeanstalk/* +!.elasticbeanstalk/*.cfg.yml +!.elasticbeanstalk/*.global.yml diff --git a/project starter code/aws-elastic-beanstalk-cli-setup b/project starter code/aws-elastic-beanstalk-cli-setup new file mode 160000 index 00000000..e30f3630 --- /dev/null +++ b/project starter code/aws-elastic-beanstalk-cli-setup @@ -0,0 +1 @@ +Subproject commit e30f36303e22a868cf512eca246a0d001af9a19e diff --git a/project starter code/node_modules/.bin/mkdirp b/project starter code/node_modules/.bin/mkdirp deleted file mode 100644 index 6ba5765a..00000000 --- a/project starter code/node_modules/.bin/mkdirp +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../mkdirp/bin/cmd.js" "$@" -else - exec node "$basedir/../mkdirp/bin/cmd.js" "$@" -fi diff --git a/project starter code/node_modules/.bin/mkdirp.cmd b/project starter code/node_modules/.bin/mkdirp.cmd deleted file mode 100644 index a865dd9f..00000000 --- a/project starter code/node_modules/.bin/mkdirp.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\mkdirp\bin\cmd.js" %* diff --git a/project starter code/node_modules/.bin/mkdirp.ps1 b/project starter code/node_modules/.bin/mkdirp.ps1 deleted file mode 100644 index 911e8546..00000000 --- a/project starter code/node_modules/.bin/mkdirp.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args - } else { - & "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args - } else { - & "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/project starter code/node_modules/.bin/nodemon b/project starter code/node_modules/.bin/nodemon new file mode 100644 index 00000000..4d75661d --- /dev/null +++ b/project starter code/node_modules/.bin/nodemon @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../nodemon/bin/nodemon.js" "$@" +else + exec node "$basedir/../nodemon/bin/nodemon.js" "$@" +fi diff --git a/project starter code/node_modules/.bin/nodemon.cmd b/project starter code/node_modules/.bin/nodemon.cmd new file mode 100644 index 00000000..55acf8a4 --- /dev/null +++ b/project starter code/node_modules/.bin/nodemon.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\nodemon\bin\nodemon.js" %* diff --git a/project starter code/node_modules/.bin/nodemon.ps1 b/project starter code/node_modules/.bin/nodemon.ps1 new file mode 100644 index 00000000..d4e3f5d4 --- /dev/null +++ b/project starter code/node_modules/.bin/nodemon.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../nodemon/bin/nodemon.js" $args + } else { + & "$basedir/node$exe" "$basedir/../nodemon/bin/nodemon.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../nodemon/bin/nodemon.js" $args + } else { + & "node$exe" "$basedir/../nodemon/bin/nodemon.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/project starter code/node_modules/.bin/nodetouch b/project starter code/node_modules/.bin/nodetouch new file mode 100644 index 00000000..03f8b4d4 --- /dev/null +++ b/project starter code/node_modules/.bin/nodetouch @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../touch/bin/nodetouch.js" "$@" +else + exec node "$basedir/../touch/bin/nodetouch.js" "$@" +fi diff --git a/project starter code/node_modules/.bin/nodetouch.cmd b/project starter code/node_modules/.bin/nodetouch.cmd new file mode 100644 index 00000000..8298b918 --- /dev/null +++ b/project starter code/node_modules/.bin/nodetouch.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\touch\bin\nodetouch.js" %* diff --git a/project starter code/node_modules/.bin/nodetouch.ps1 b/project starter code/node_modules/.bin/nodetouch.ps1 new file mode 100644 index 00000000..5f68b4cb --- /dev/null +++ b/project starter code/node_modules/.bin/nodetouch.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../touch/bin/nodetouch.js" $args + } else { + & "$basedir/node$exe" "$basedir/../touch/bin/nodetouch.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../touch/bin/nodetouch.js" $args + } else { + & "node$exe" "$basedir/../touch/bin/nodetouch.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/project starter code/node_modules/.bin/semver b/project starter code/node_modules/.bin/semver new file mode 100644 index 00000000..77443e78 --- /dev/null +++ b/project starter code/node_modules/.bin/semver @@ -0,0 +1,12 @@ +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") + +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; +esac + +if [ -x "$basedir/node" ]; then + exec "$basedir/node" "$basedir/../semver/bin/semver.js" "$@" +else + exec node "$basedir/../semver/bin/semver.js" "$@" +fi diff --git a/project starter code/node_modules/.bin/semver.cmd b/project starter code/node_modules/.bin/semver.cmd new file mode 100644 index 00000000..9913fa9d --- /dev/null +++ b/project starter code/node_modules/.bin/semver.cmd @@ -0,0 +1,17 @@ +@ECHO off +GOTO start +:find_dp0 +SET dp0=%~dp0 +EXIT /b +:start +SETLOCAL +CALL :find_dp0 + +IF EXIST "%dp0%\node.exe" ( + SET "_prog=%dp0%\node.exe" +) ELSE ( + SET "_prog=node" + SET PATHEXT=%PATHEXT:;.JS;=;% +) + +endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\semver\bin\semver.js" %* diff --git a/project starter code/node_modules/.bin/semver.ps1 b/project starter code/node_modules/.bin/semver.ps1 new file mode 100644 index 00000000..314717ad --- /dev/null +++ b/project starter code/node_modules/.bin/semver.ps1 @@ -0,0 +1,28 @@ +#!/usr/bin/env pwsh +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent + +$exe="" +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { + # Fix case when both the Windows and Linux builds of Node + # are installed in the same directory + $exe=".exe" +} +$ret=0 +if (Test-Path "$basedir/node$exe") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args + } else { + & "$basedir/node$exe" "$basedir/../semver/bin/semver.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/../semver/bin/semver.js" $args + } else { + & "node$exe" "$basedir/../semver/bin/semver.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret diff --git a/project starter code/node_modules/.package-lock.json b/project starter code/node_modules/.package-lock.json index b5fcbf14..962e22f3 100644 --- a/project starter code/node_modules/.package-lock.json +++ b/project starter code/node_modules/.package-lock.json @@ -4,24 +4,12 @@ "lockfileVersion": 2, "requires": true, "packages": { - "node_modules/@babel/runtime": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz", - "integrity": "sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==", - "dependencies": { - "regenerator-runtime": "^0.13.11" - }, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@jimp/bmp": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.16.2.tgz", - "integrity": "sha512-4g9vW45QfMoGhLVvaFj26h4e7cC+McHUQwyFQmNTLW4FfC1OonN9oUr2m/FEDGkTYKR7aqdXR5XUqqIkHWLaFw==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.22.12.tgz", + "integrity": "sha512-aeI64HD0npropd+AR76MCcvvRaa+Qck6loCOS03CkkxGHN5/r336qTM5HPUdHKMDOGzqknuVPA8+kK1t03z12g==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", + "@jimp/utils": "^0.22.12", "bmp-js": "^0.1.0" }, "peerDependencies": { @@ -29,40 +17,35 @@ } }, "node_modules/@jimp/core": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/core/-/core-0.16.2.tgz", - "integrity": "sha512-dp7HcyUMzjXphXYodI6PaXue+I9PXAavbb+AN+1XqFbotN22Z12DosNPEyy+UhLY/hZiQQqUkEaJHkvV31rs+w==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/core/-/core-0.22.12.tgz", + "integrity": "sha512-l0RR0dOPyzMKfjUW1uebzueFEDtCOj9fN6pyTYWWOM/VS4BciXQ1VVrJs8pO3kycGYZxncRKhCoygbNr8eEZQA==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", + "@jimp/utils": "^0.22.12", "any-base": "^1.1.0", "buffer": "^5.2.0", "exif-parser": "^0.1.12", - "file-type": "^9.0.0", - "load-bmfont": "^1.3.1", - "mkdirp": "^0.5.1", - "phin": "^2.9.1", + "file-type": "^16.5.4", + "isomorphic-fetch": "^3.0.0", "pixelmatch": "^4.0.2", - "tinycolor2": "^1.4.1" + "tinycolor2": "^1.6.0" } }, "node_modules/@jimp/custom": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.16.2.tgz", - "integrity": "sha512-GtNwOs4hcVS2GIbqRUf42rUuX07oLB92cj7cqxZb0ZGWwcwhnmSW0TFLAkNafXmqn9ug4VTpNvcJSUdiuECVKg==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.22.12.tgz", + "integrity": "sha512-xcmww1O/JFP2MrlGUMd3Q78S3Qu6W3mYTXYuIqFq33EorgYHV/HqymHfXy9GjiCJ7OI+7lWx6nYFOzU7M4rd1Q==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/core": "^0.16.2" + "@jimp/core": "^0.22.12" } }, "node_modules/@jimp/gif": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/gif/-/gif-0.16.2.tgz", - "integrity": "sha512-TMdyT9Q0paIKNtT7c5KzQD29CNCsI/t8ka28jMrBjEK7j5RRTvBfuoOnHv7pDJRCjCIqeUoaUSJ7QcciKic6CA==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/gif/-/gif-0.22.12.tgz", + "integrity": "sha512-y6BFTJgch9mbor2H234VSjd9iwAhaNf/t3US5qpYIs0TSbAvM02Fbc28IaDETj9+4YB4676sz4RcN/zwhfu1pg==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "gifwrap": "^0.9.2", + "@jimp/utils": "^0.22.12", + "gifwrap": "^0.10.1", "omggif": "^1.0.9" }, "peerDependencies": { @@ -70,74 +53,68 @@ } }, "node_modules/@jimp/jpeg": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.16.2.tgz", - "integrity": "sha512-BW5gZydgq6wdIwHd+3iUNgrTklvoQc/FUKSj9meM6A0FU21lUaansRX5BDdJqHkyXJLnnlDGwDt27J+hQuBAVw==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.22.12.tgz", + "integrity": "sha512-Rq26XC/uQWaQKyb/5lksCTCxXhtY01NJeBN+dQv5yNYedN0i7iYu+fXEoRsfaJ8xZzjoANH8sns7rVP4GE7d/Q==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "jpeg-js": "^0.4.2" + "@jimp/utils": "^0.22.12", + "jpeg-js": "^0.4.4" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-blit": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.16.2.tgz", - "integrity": "sha512-Z31rRfV80gC/r+B/bOPSVVpJEWXUV248j7MdnMOFLu4vr8DMqXVo9jYqvwU/s4LSTMAMXqm4Jg6E/jQfadPKAg==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.22.12.tgz", + "integrity": "sha512-xslz2ZoFZOPLY8EZ4dC29m168BtDx95D6K80TzgUi8gqT7LY6CsajWO0FAxDwHz6h0eomHMfyGX0stspBrTKnQ==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-blur": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.16.2.tgz", - "integrity": "sha512-ShkJCAzRI+1fAKPuLLgEkixpSpVmKTYaKEFROUcgmrv9AansDXGNCupchqVMTdxf8zPyW8rR1ilvG3OJobufLQ==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.22.12.tgz", + "integrity": "sha512-S0vJADTuh1Q9F+cXAwFPlrKWzDj2F9t/9JAbUvaaDuivpyWuImEKXVz5PUZw2NbpuSHjwssbTpOZ8F13iJX4uw==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-circle": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-circle/-/plugin-circle-0.16.2.tgz", - "integrity": "sha512-6T4z/48F4Z5+YwAVCLOvXQcyGmo0E3WztxCz6XGQf66r4JJK78+zcCDYZFLMx0BGM0091FogNK4QniP8JaOkrA==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-circle/-/plugin-circle-0.22.12.tgz", + "integrity": "sha512-SWVXx1yiuj5jZtMijqUfvVOJBwOifFn0918ou4ftoHgegc5aHWW5dZbYPjvC9fLpvz7oSlptNl2Sxr1zwofjTg==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-color": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.16.2.tgz", - "integrity": "sha512-6oBV0g0J17/7E+aTquvUsgSc85nUbUi+64tIK5eFIDzvjhlqhjGNJYlc46KJMCWIs61qRJayQoZdL/iT/iQuGQ==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.22.12.tgz", + "integrity": "sha512-xImhTE5BpS8xa+mAN6j4sMRWaUgUDLoaGHhJhpC+r7SKKErYDR0WQV4yCE4gP+N0gozD0F3Ka1LUSaMXrn7ZIA==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "tinycolor2": "^1.4.1" + "@jimp/utils": "^0.22.12", + "tinycolor2": "^1.6.0" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-contain": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.16.2.tgz", - "integrity": "sha512-pLcxO3hVN3LCEhMNvpZ9B7xILHVlS433Vv16zFFJxLRqZdYvPLsc+ZzJhjAiHHuEjVblQrktHE3LGeQwGJPo0w==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.22.12.tgz", + "integrity": "sha512-Eo3DmfixJw3N79lWk8q/0SDYbqmKt1xSTJ69yy8XLYQj9svoBbyRpSnHR+n9hOw5pKXytHwUW6nU4u1wegHNoQ==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", @@ -147,12 +124,11 @@ } }, "node_modules/@jimp/plugin-cover": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.16.2.tgz", - "integrity": "sha512-gzWM7VvYeI8msyiwbUZxH+sGQEgO6Vd6adGxZ0CeKX00uQOe5lDzxb1Wjx7sHcJGz8a/5fmAuwz7rdDtpDUbkw==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.22.12.tgz", + "integrity": "sha512-z0w/1xH/v/knZkpTNx+E8a7fnasQ2wHG5ze6y5oL2dhH1UufNua8gLQXlv8/W56+4nJ1brhSd233HBJCo01BXA==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", @@ -162,60 +138,55 @@ } }, "node_modules/@jimp/plugin-crop": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.16.2.tgz", - "integrity": "sha512-qCd3hfMEE+Z2EuuyXewgXRTtKJGIerWzc1zLEJztsUkPz5i73IGgkOL+mrNutZwGaXZbm+8SwUaGb46sxAO6Tw==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.22.12.tgz", + "integrity": "sha512-FNuUN0OVzRCozx8XSgP9MyLGMxNHHJMFt+LJuFjn1mu3k0VQxrzqbN06yIl46TVejhyAhcq5gLzqmSCHvlcBVw==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-displace": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.16.2.tgz", - "integrity": "sha512-6nXdvNNjCdD95v2o3/jPeur903dz08lG4Y8gmr5oL2yVv9LSSbMonoXYrR/ASesdyXqGdXJLU4NL+yZs4zUqbQ==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.22.12.tgz", + "integrity": "sha512-qpRM8JRicxfK6aPPqKZA6+GzBwUIitiHaZw0QrJ64Ygd3+AsTc7BXr+37k2x7QcyCvmKXY4haUrSIsBug4S3CA==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-dither": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.16.2.tgz", - "integrity": "sha512-DERpIzy21ZanMkVsD0Tdy8HQLbD1E41OuvIzaMRoW4183PA6AgGNlrQoFTyXmzjy6FTy1SxaQgTEdouInAWZ9Q==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.22.12.tgz", + "integrity": "sha512-jYgGdSdSKl1UUEanX8A85v4+QUm+PE8vHFwlamaKk89s+PXQe7eVE3eNeSZX4inCq63EHL7cX580dMqkoC3ZLw==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-fisheye": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-fisheye/-/plugin-fisheye-0.16.2.tgz", - "integrity": "sha512-Df7PsGIwiIpQu3EygYCnaJyTfOwvwtYV3cmYJS7yFLtdiFUuod+hlSo5GkwEPLAy+QBxhUbDuUqnsWo4NQtbiQ==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-fisheye/-/plugin-fisheye-0.22.12.tgz", + "integrity": "sha512-LGuUTsFg+fOp6KBKrmLkX4LfyCy8IIsROwoUvsUPKzutSqMJnsm3JGDW2eOmWIS/jJpPaeaishjlxvczjgII+Q==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-flip": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.16.2.tgz", - "integrity": "sha512-+2uC8ioVQUr06mnjSWraskz2L33nJHze35LkQ8ZNsIpoZLkgvfiWatqAs5bj+1jGI/9kxoCFAaT1Is0f+a4/rw==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.22.12.tgz", + "integrity": "sha512-m251Rop7GN8W0Yo/rF9LWk6kNclngyjIJs/VXHToGQ6EGveOSTSQaX2Isi9f9lCDLxt+inBIb7nlaLLxnvHX8Q==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", @@ -223,61 +194,56 @@ } }, "node_modules/@jimp/plugin-gaussian": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.16.2.tgz", - "integrity": "sha512-2mnuDSg4ZEH8zcJig7DZZf4st/cYmQ5UYJKP76iGhZ+6JDACk6uejwAgT5xHecNhkVAaXMdCybA2eknH/9OE1w==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.22.12.tgz", + "integrity": "sha512-sBfbzoOmJ6FczfG2PquiK84NtVGeScw97JsCC3rpQv1PHVWyW+uqWFF53+n3c8Y0P2HWlUjflEla2h/vWShvhg==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-invert": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.16.2.tgz", - "integrity": "sha512-xFvHbVepTY/nus+6yXiYN1iq+UBRkT0MdnObbiQPstUrAsz0Imn6MWISsnAyMvcNxHGrxaxjuU777JT/esM0gg==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.22.12.tgz", + "integrity": "sha512-N+6rwxdB+7OCR6PYijaA/iizXXodpxOGvT/smd/lxeXsZ/empHmFFFJ/FaXcYh19Tm04dGDaXcNF/dN5nm6+xQ==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-mask": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.16.2.tgz", - "integrity": "sha512-AbdO85xxhfgEDdxYKpUotEI9ixiCMaIpfYHD5a5O/VWeimz2kuwhcrzlHGiyq1kKAgRcl0WEneTCZAHVSyvPKA==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.22.12.tgz", + "integrity": "sha512-4AWZg+DomtpUA099jRV8IEZUfn1wLv6+nem4NRJC7L/82vxzLCgXKTxvNvBcNmJjT9yS1LAAmiJGdWKXG63/NA==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-normalize": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.16.2.tgz", - "integrity": "sha512-+ItBWFwmB0Od7OfOtTYT1gm543PpHUgU8/DN55z83l1JqS0OomDJAe7BmCppo2405TN6YtVm/csXo7p4iWd/SQ==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.22.12.tgz", + "integrity": "sha512-0So0rexQivnWgnhacX4cfkM2223YdExnJTTy6d06WbkfZk5alHUx8MM3yEzwoCN0ErO7oyqEWRnEkGC+As1FtA==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-print": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.16.2.tgz", - "integrity": "sha512-ifTGEeJ5UZTCiqC70HMeU3iXk/vsOmhWiwVGOXSFXhFeE8ZpDWvlmBsrMYnRrJGuaaogHOIrrQPI+kCdDBSBIQ==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.22.12.tgz", + "integrity": "sha512-c7TnhHlxm87DJeSnwr/XOLjJU/whoiKYY7r21SbuJ5nuH+7a78EW1teOaj5gEr2wYEd7QtkFqGlmyGXY/YclyQ==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "load-bmfont": "^1.4.0" + "@jimp/utils": "^0.22.12", + "load-bmfont": "^1.4.1" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", @@ -285,24 +251,22 @@ } }, "node_modules/@jimp/plugin-resize": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.16.2.tgz", - "integrity": "sha512-gE4N9l6xuwzacFZ2EPCGZCJ/xR+aX2V7GdMndIl/6kYIw5/eib1SFuF9AZLvIPSFuE1FnGo8+vT0pr++SSbhYg==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.22.12.tgz", + "integrity": "sha512-3NyTPlPbTnGKDIbaBgQ3HbE6wXbAlFfxHVERmrbqAi8R3r6fQPxpCauA8UVDnieg5eo04D0T8nnnNIX//i/sXg==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-rotate": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.16.2.tgz", - "integrity": "sha512-/CTEYkR1HrgmnE0VqPhhbBARbDAfFX590LWGIpxcYIYsUUGQCadl+8Qo4UX13FH0Nt8UHEtPA+O2x08uPYg9UA==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.22.12.tgz", + "integrity": "sha512-9YNEt7BPAFfTls2FGfKBVgwwLUuKqy+E8bDGGEsOqHtbuhbshVGxN2WMZaD4gh5IDWvR+emmmPPWGgaYNYt1gA==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", @@ -312,12 +276,11 @@ } }, "node_modules/@jimp/plugin-scale": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.16.2.tgz", - "integrity": "sha512-3inuxfrlquyLaqFdiiiQNJUurR0WbvN5wAf1qcYX2LubG1AG8grayYD6H7XVoxfUGTZXh1kpmeirEYlqA2zxcw==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.22.12.tgz", + "integrity": "sha512-dghs92qM6MhHj0HrV2qAwKPMklQtjNpoYgAB94ysYpsXslhRTiPisueSIELRwZGEr0J0VUxpUY7HgJwlSIgGZw==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", @@ -325,12 +288,11 @@ } }, "node_modules/@jimp/plugin-shadow": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-shadow/-/plugin-shadow-0.16.2.tgz", - "integrity": "sha512-Q0aIs2/L6fWMcEh9Ms73u34bT1hyUMw/oxaVoIzOLo6/E8YzCs2Bi63H0/qaPS0MQpEppI++kvosPbblABY79w==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-shadow/-/plugin-shadow-0.22.12.tgz", + "integrity": "sha512-FX8mTJuCt7/3zXVoeD/qHlm4YH2bVqBuWQHXSuBK054e7wFRnRnbSLPUqAwSeYP3lWqpuQzJtgiiBxV3+WWwTg==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", @@ -339,12 +301,11 @@ } }, "node_modules/@jimp/plugin-threshold": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-threshold/-/plugin-threshold-0.16.2.tgz", - "integrity": "sha512-gyOwmBgjtMPvcuyOhkP6dOGWbQdaTfhcBRN22mYeI/k/Wh/Zh1OI21F6eKLApsVRmg15MoFnkrCz64RROC34sw==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-threshold/-/plugin-threshold-0.22.12.tgz", + "integrity": "sha512-4x5GrQr1a/9L0paBC/MZZJjjgjxLYrqSmWd+e+QfAEPvmRxdRoQ5uKEuNgXnm9/weHQBTnQBQsOY2iFja+XGAw==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", @@ -353,32 +314,31 @@ } }, "node_modules/@jimp/plugins": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.16.2.tgz", - "integrity": "sha512-zCvYtCgctmC0tkYEu+y+kSwSIZBsNznqJ3/3vkpzxdyjd6wCfNY5Qc/68MPrLc1lmdeGo4cOOTYHG7Vc6myzRw==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/plugin-blit": "^0.16.2", - "@jimp/plugin-blur": "^0.16.2", - "@jimp/plugin-circle": "^0.16.2", - "@jimp/plugin-color": "^0.16.2", - "@jimp/plugin-contain": "^0.16.2", - "@jimp/plugin-cover": "^0.16.2", - "@jimp/plugin-crop": "^0.16.2", - "@jimp/plugin-displace": "^0.16.2", - "@jimp/plugin-dither": "^0.16.2", - "@jimp/plugin-fisheye": "^0.16.2", - "@jimp/plugin-flip": "^0.16.2", - "@jimp/plugin-gaussian": "^0.16.2", - "@jimp/plugin-invert": "^0.16.2", - "@jimp/plugin-mask": "^0.16.2", - "@jimp/plugin-normalize": "^0.16.2", - "@jimp/plugin-print": "^0.16.2", - "@jimp/plugin-resize": "^0.16.2", - "@jimp/plugin-rotate": "^0.16.2", - "@jimp/plugin-scale": "^0.16.2", - "@jimp/plugin-shadow": "^0.16.2", - "@jimp/plugin-threshold": "^0.16.2", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.22.12.tgz", + "integrity": "sha512-yBJ8vQrDkBbTgQZLty9k4+KtUQdRjsIDJSPjuI21YdVeqZxYywifHl4/XWILoTZsjTUASQcGoH0TuC0N7xm3ww==", + "dependencies": { + "@jimp/plugin-blit": "^0.22.12", + "@jimp/plugin-blur": "^0.22.12", + "@jimp/plugin-circle": "^0.22.12", + "@jimp/plugin-color": "^0.22.12", + "@jimp/plugin-contain": "^0.22.12", + "@jimp/plugin-cover": "^0.22.12", + "@jimp/plugin-crop": "^0.22.12", + "@jimp/plugin-displace": "^0.22.12", + "@jimp/plugin-dither": "^0.22.12", + "@jimp/plugin-fisheye": "^0.22.12", + "@jimp/plugin-flip": "^0.22.12", + "@jimp/plugin-gaussian": "^0.22.12", + "@jimp/plugin-invert": "^0.22.12", + "@jimp/plugin-mask": "^0.22.12", + "@jimp/plugin-normalize": "^0.22.12", + "@jimp/plugin-print": "^0.22.12", + "@jimp/plugin-resize": "^0.22.12", + "@jimp/plugin-rotate": "^0.22.12", + "@jimp/plugin-scale": "^0.22.12", + "@jimp/plugin-shadow": "^0.22.12", + "@jimp/plugin-threshold": "^0.22.12", "timm": "^1.6.1" }, "peerDependencies": { @@ -386,41 +346,38 @@ } }, "node_modules/@jimp/png": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/png/-/png-0.16.2.tgz", - "integrity": "sha512-sFOtOSz/tzDwXEChFQ/Nxe+0+vG3Tj0eUxnZVDUG/StXE9dI8Bqmwj3MIa0EgK5s+QG3YlnDOmlPUa4JqmeYeQ==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/png/-/png-0.22.12.tgz", + "integrity": "sha512-Mrp6dr3UTn+aLK8ty/dSKELz+Otdz1v4aAXzV5q53UDD2rbB5joKVJ/ChY310B+eRzNxIovbUF1KVrUsYdE8Hg==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "pngjs": "^3.3.3" + "@jimp/utils": "^0.22.12", + "pngjs": "^6.0.0" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/tiff": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.16.2.tgz", - "integrity": "sha512-ADcdqmtZF+U2YoaaHTzFX8D6NFpmN4WZUT0BPMerEuY7Cq8QoLYU22z2h034FrVW+Rbi1b3y04sB9iDiQAlf2w==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.22.12.tgz", + "integrity": "sha512-E1LtMh4RyJsoCAfAkBRVSYyZDTtLq9p9LUiiYP0vPtXyxX4BiYBUYihTLSBlCQg5nF2e4OpQg7SPrLdJ66u7jg==", "dependencies": { - "@babel/runtime": "^7.7.2", - "utif": "^2.0.1" + "utif2": "^4.0.1" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/types": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/types/-/types-0.16.2.tgz", - "integrity": "sha512-0Ue5Sq0XnDF6TirisWv5E+8uOnRcd8vRLuwocJOhF76NIlcQrz+5r2k2XWKcr3d+11n28dHLXW5TKSqrUopxhA==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/bmp": "^0.16.2", - "@jimp/gif": "^0.16.2", - "@jimp/jpeg": "^0.16.2", - "@jimp/png": "^0.16.2", - "@jimp/tiff": "^0.16.2", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/types/-/types-0.22.12.tgz", + "integrity": "sha512-wwKYzRdElE1MBXFREvCto5s699izFHNVvALUv79GXNbsOVqlwlOxlWJ8DuyOGIXoLP4JW/m30YyuTtfUJgMRMA==", + "dependencies": { + "@jimp/bmp": "^0.22.12", + "@jimp/gif": "^0.22.12", + "@jimp/jpeg": "^0.22.12", + "@jimp/png": "^0.22.12", + "@jimp/tiff": "^0.22.12", "timm": "^1.6.1" }, "peerDependencies": { @@ -428,14 +385,23 @@ } }, "node_modules/@jimp/utils": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-0.16.2.tgz", - "integrity": "sha512-XENrPvmigiXZQ8E2nxJqO6UVvWBLzbNwyYi3Y8Q1IECoYhYI3kgOQ0fmy4G269Vz1V0omh1bNmC42r4OfXg1Jg==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-0.22.12.tgz", + "integrity": "sha512-yJ5cWUknGnilBq97ZXOyOS0HhsHOyAyjHwYfHxGbSyMTohgQI6sVyE8KPgDwH8HHW/nMKXk8TrSwAE71zt716Q==", "dependencies": { - "@babel/runtime": "^7.7.2", "regenerator-runtime": "^0.13.3" } }, + "node_modules/@tokenizer/token": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", + "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==" + }, + "node_modules/@types/bluebird": { + "version": "3.5.42", + "resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.42.tgz", + "integrity": "sha512-Jhy+MWRlro6UjVi578V/4ZGNfeCOcNCp0YaFNIUGFKlImowqwb1O/22wDVk3FDGMLqxdpOV3qQHD5fPEH4hK6A==" + }, "node_modules/@types/node": { "version": "16.9.1", "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.1.tgz", @@ -458,11 +424,45 @@ "resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz", "integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg==" }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/axios": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz", + "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -482,18 +482,30 @@ } ] }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/bmp-js": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.1.0.tgz", "integrity": "sha512-vHdS19CnY3hwiNdkaqk93DvjVLfbEcI8mys4UjuWrlX1haDmroo8o4xCzh4wD6DGV6HxRCyauwhHRqMTfERtjw==" }, "node_modules/body-parser": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", - "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", "dependencies": { "bytes": "3.1.2", - "content-type": "~1.0.4", + "content-type": "~1.0.5", "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", @@ -501,7 +513,7 @@ "iconv-lite": "0.4.24", "on-finished": "2.4.1", "qs": "6.11.0", - "raw-body": "2.5.1", + "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" }, @@ -510,6 +522,28 @@ "npm": "1.2.8000 || >= 1.4.16" } }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/buffer": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", @@ -550,17 +584,64 @@ } }, "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, "node_modules/content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", @@ -573,17 +654,17 @@ } }, "node_modules/content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", "engines": { "node": ">= 0.6" } }, "node_modules/cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", "engines": { "node": ">= 0.6" } @@ -601,6 +682,30 @@ "ms": "2.0.0" } }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -636,6 +741,25 @@ "node": ">= 0.8" } }, + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -655,16 +779,16 @@ "integrity": "sha512-c2bQfLNbMzLPmzQuOr8fy0csy84WmwnER81W88DzTp9CYNPJ6yzOj2EZAh9pywYpqHnshVLHQJ8WzldAyfY+Iw==" }, "node_modules/express": { - "version": "4.18.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", - "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", + "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.1", + "body-parser": "1.20.2", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.5.0", + "cookie": "0.6.0", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", @@ -696,11 +820,31 @@ } }, "node_modules/file-type": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-9.0.0.tgz", - "integrity": "sha512-Qe/5NJrgIOlwijpq3B7BEpzPFcgzggOTagZmkXQY4LA6bsXKTUstK7Wp12lEJ/mLKTpvIZxmIuRcLYWT6ov9lw==", + "version": "16.5.4", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.4.tgz", + "integrity": "sha512-/yFHK0aGjFEgDJjEKP0pWCplsPFPhwyfwevf/pVxiN0tmE4L9LmwWxWukdJSHdoCli4VgQLehjJtwQBnqmsKcw==", + "dependencies": { + "readable-web-to-node-stream": "^3.0.0", + "strtok3": "^6.2.4", + "token-types": "^4.1.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/file-type?sponsor=1" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, "engines": { - "node": ">=6" + "node": ">=8" } }, "node_modules/finalhandler": { @@ -720,6 +864,38 @@ "node": ">= 0.8" } }, + "node_modules/follow-redirects": { + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -737,32 +913,52 @@ } }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/get-intrinsic": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", - "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", - "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.3" + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/gifwrap": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/gifwrap/-/gifwrap-0.9.4.tgz", - "integrity": "sha512-MDMwbhASQuVeD4JKd1fKgNgCRL3fGqMM4WaqpNhWO0JiMOAjbQdumbs4BbBZEy9/M00EHEjKN3HieVhCUlwjeQ==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/gifwrap/-/gifwrap-0.10.1.tgz", + "integrity": "sha512-2760b1vpJHNmLzZ/ubTtNnEx5WApN/PYWJvXvgS+tL1egTTthayFYIQQNi136FLEDcN/IyEY2EcGpIITD6eYUw==", "dependencies": { "image-q": "^4.0.0", "omggif": "^1.0.10" } }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/global": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", @@ -772,15 +968,46 @@ "process": "^0.11.10" } }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", "dependencies": { - "function-bind": "^1.1.1" + "get-intrinsic": "^1.1.3" }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, "engines": { - "node": ">= 0.4.0" + "node": ">=4" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-symbols": { @@ -794,6 +1021,17 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", @@ -839,6 +1077,12 @@ } ] }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true + }, "node_modules/image-q": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/image-q/-/image-q-4.0.0.tgz", @@ -860,20 +1104,70 @@ "node": ">= 0.10" } }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-function": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz", "integrity": "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==" }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/isomorphic-fetch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz", + "integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==", + "dependencies": { + "node-fetch": "^2.6.1", + "whatwg-fetch": "^3.4.1" + } + }, "node_modules/jimp": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/jimp/-/jimp-0.16.2.tgz", - "integrity": "sha512-UpItBk81a92f8oEyoGYbO3YK4QcM0hoIyuGHmShoF9Ov63P5Qo7Q/X2xsAgnODmSuDJFOtrPtJd5GSWW4LKdOQ==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/custom": "^0.16.2", - "@jimp/plugins": "^0.16.2", - "@jimp/types": "^0.16.2", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/jimp/-/jimp-0.22.12.tgz", + "integrity": "sha512-R5jZaYDnfkxKJy1dwLpj/7cvyjxiclxU3F4TrI/J4j2rS0niq6YDUMoPn5hs8GDpO+OZGo7Ky057CRtWesyhfg==", + "dependencies": { + "@jimp/custom": "^0.22.12", + "@jimp/plugins": "^0.22.12", + "@jimp/types": "^0.22.12", "regenerator-runtime": "^0.13.3" } }, @@ -956,23 +1250,16 @@ "dom-walk": "^0.1.0" } }, - "node_modules/minimist": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", - "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/mkdirp": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", - "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, "dependencies": { - "minimist": "^1.2.6" + "brace-expansion": "^1.1.7" }, - "bin": { - "mkdirp": "bin/cmd.js" + "engines": { + "node": "*" } }, "node_modules/ms": { @@ -988,10 +1275,89 @@ "node": ">= 0.6" } }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/nodemon": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.1.tgz", + "integrity": "sha512-k43xGaDtaDIcufn0Fc6fTtsdKSkV/hQzoQFigNH//GaKta28yoKVYXCnV+KXRqfT/YzsFaQU9VdeEG+HEyxr6A==", + "dev": true, + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.1.2", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/nodemon/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/nodemon/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/object-inspect": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", - "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -1028,12 +1394,12 @@ "integrity": "sha512-GxmsRea0wdGdYthjuUeWTMWPqm2+FAd4GI8vCvhgJsFnoGhTrLhXDDupwTo7rXVAgaLIGoVHDZS9p/5XbSqeWA==" }, "node_modules/parse-bmfont-xml": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.4.tgz", - "integrity": "sha512-bjnliEOmGv3y1aMEfREMBJ9tfL3WR0i0CKPj61DnSLaoxWR3nLrsQrEbCId/8rF4NyRF0cCqisSVXyQYWM+mCQ==", + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.6.tgz", + "integrity": "sha512-0cEliVMZEhrFDwMh4SxIyVJpqYoOWDJ9P895tFuS+XuNzI5UBmBk5U5O4KuJdTnZpSBI4LFA2+ZiJaiwfSwlMA==", "dependencies": { "xml-parse-from-string": "^1.0.0", - "xml2js": "^0.4.5" + "xml2js": "^0.5.0" } }, "node_modules/parse-headers": { @@ -1054,10 +1420,35 @@ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" }, + "node_modules/peek-readable": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-4.1.0.tgz", + "integrity": "sha512-ZI3LnwUv5nOGbQzD9c2iDG6toheuXSZP5esSHBjopsXH4dg19soufvpUGA3uohi5anFtGb2lhAVdHzH6R/Evvg==", + "engines": { + "node": ">=8" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, "node_modules/phin": { "version": "2.9.3", "resolved": "https://registry.npmjs.org/phin/-/phin-2.9.3.tgz", - "integrity": "sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==" + "integrity": "sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info." + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } }, "node_modules/pixelmatch": { "version": "4.0.2", @@ -1070,7 +1461,7 @@ "pixelmatch": "bin/pixelmatch" } }, - "node_modules/pngjs": { + "node_modules/pixelmatch/node_modules/pngjs": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==", @@ -1078,6 +1469,14 @@ "node": ">=4.0.0" } }, + "node_modules/pngjs": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-6.0.0.tgz", + "integrity": "sha512-TRzzuFRRmEoSW/p1KVAmiOgPco2Irlah+bGFCeNfJXxxYGwSw7YwAOAcd7X28K/m5bjBWKsC29KyoMfHbypayg==", + "engines": { + "node": ">=12.13.0" + } + }, "node_modules/process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", @@ -1098,6 +1497,17 @@ "node": ">= 0.10" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true + }, "node_modules/qs": { "version": "6.11.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", @@ -1121,9 +1531,9 @@ } }, "node_modules/raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", "dependencies": { "bytes": "3.1.2", "http-errors": "2.0.0", @@ -1134,6 +1544,46 @@ "node": ">= 0.8" } }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readable-web-to-node-stream": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz", + "integrity": "sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw==", + "dependencies": { + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, "node_modules/regenerator-runtime": { "version": "0.13.11", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", @@ -1164,9 +1614,21 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "node_modules/sax": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.3.0.tgz", + "integrity": "sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA==" + }, + "node_modules/semver": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } }, "node_modules/send": { "version": "0.18.0", @@ -1210,24 +1672,56 @@ "node": ">= 0.8.0" } }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/setprototypeof": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" }, "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/statuses": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", @@ -1236,17 +1730,62 @@ "node": ">= 0.8" } }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/strtok3": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-6.3.0.tgz", + "integrity": "sha512-fZtbhtvI9I48xDSywd/somNqgUHl2L2cstmXCCif0itOf96jeW18MBSyrLuNicYQVkvpOxkZtkzujiTJ9LW5Jw==", + "dependencies": { + "@tokenizer/token": "^0.3.0", + "peek-readable": "^4.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/timm": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/timm/-/timm-1.7.1.tgz", "integrity": "sha512-IjZc9KIotudix8bMaBW6QvMuq64BrJWFs1+4V0lXwWGQZwH+LnX87doAYhem4caOEusRP9/g6jVDQmZ8XOk1nw==" }, "node_modules/tinycolor2": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.5.1.tgz", - "integrity": "sha512-BHlrsGeYN2OpkRpfAgkEwCMu6w8Quq8JkK/mp4c55NZP7OwceJObR1CPZt62TqiA0Y3J5pwuDX+fXDqc35REtg==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.6.0.tgz", + "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==" + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, "engines": { - "node": "*" + "node": ">=8.0" } }, "node_modules/toidentifier": { @@ -1257,6 +1796,36 @@ "node": ">=0.6" } }, + "node_modules/token-types": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/token-types/-/token-types-4.2.1.tgz", + "integrity": "sha512-6udB24Q737UD/SDsKAHI9FCRP7Bqc9D/MQUV02ORQg5iskjtLJlZJNdN4kKtcdtwCeWIwIHDGaUsTsCCAa8sFQ==", + "dependencies": { + "@tokenizer/token": "^0.3.0", + "ieee754": "^1.2.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "node_modules/type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", @@ -1269,6 +1838,12 @@ "node": ">= 0.6" } }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true + }, "node_modules/unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", @@ -1277,14 +1852,19 @@ "node": ">= 0.8" } }, - "node_modules/utif": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/utif/-/utif-2.0.1.tgz", - "integrity": "sha512-Z/S1fNKCicQTf375lIP9G8Sa1H/phcysstNrrSdZKj1f9g58J4NMgb5IgiEZN9/nLMPDwF0W7hdOe9Qq2IYoLg==", + "node_modules/utif2": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/utif2/-/utif2-4.1.0.tgz", + "integrity": "sha512-+oknB9FHrJ7oW7A2WZYajOcv4FcDR4CfoGB0dPNfxbi4GO05RRnFmt5oa23+9w32EanrYcSJWspUiJkLMs+37w==", "dependencies": { - "pako": "^1.0.5" + "pako": "^1.0.11" } }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, "node_modules/utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", @@ -1301,6 +1881,25 @@ "node": ">= 0.8" } }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/whatwg-fetch": { + "version": "3.6.20", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz", + "integrity": "sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/xhr": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.6.0.tgz", @@ -1318,9 +1917,9 @@ "integrity": "sha512-ErcKwJTF54uRzzNMXq2X5sMIy88zJvfN2DmdoQvy7PAFJ+tPRU6ydWuOKNMyfmOjdyBQTFREi60s0Y0SyI0G0g==" }, "node_modules/xml2js": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", - "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz", + "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==", "dependencies": { "sax": ">=0.6.0", "xmlbuilder": "~11.0.0" diff --git a/project starter code/node_modules/@babel/runtime/LICENSE b/project starter code/node_modules/@babel/runtime/LICENSE deleted file mode 100644 index f31575ec..00000000 --- a/project starter code/node_modules/@babel/runtime/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -MIT License - -Copyright (c) 2014-present Sebastian McKenzie and other contributors - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/project starter code/node_modules/@babel/runtime/README.md b/project starter code/node_modules/@babel/runtime/README.md deleted file mode 100644 index be27e834..00000000 --- a/project starter code/node_modules/@babel/runtime/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @babel/runtime - -> babel's modular runtime helpers - -See our website [@babel/runtime](https://babeljs.io/docs/en/babel-runtime) for more information. - -## Install - -Using npm: - -```sh -npm install --save @babel/runtime -``` - -or using yarn: - -```sh -yarn add @babel/runtime -``` diff --git a/project starter code/node_modules/@babel/runtime/helpers/AsyncGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/AsyncGenerator.js deleted file mode 100644 index c3379a9c..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/AsyncGenerator.js +++ /dev/null @@ -1,64 +0,0 @@ -var OverloadYield = require("./OverloadYield.js"); -function AsyncGenerator(gen) { - var front, back; - function resume(key, arg) { - try { - var result = gen[key](arg), - value = result.value, - overloaded = value instanceof OverloadYield; - Promise.resolve(overloaded ? value.v : value).then(function (arg) { - if (overloaded) { - var nextKey = "return" === key ? "return" : "next"; - if (!value.k || arg.done) return resume(nextKey, arg); - arg = gen[nextKey](arg).value; - } - settle(result.done ? "return" : "normal", arg); - }, function (err) { - resume("throw", err); - }); - } catch (err) { - settle("throw", err); - } - } - function settle(type, value) { - switch (type) { - case "return": - front.resolve({ - value: value, - done: !0 - }); - break; - case "throw": - front.reject(value); - break; - default: - front.resolve({ - value: value, - done: !1 - }); - } - (front = front.next) ? resume(front.key, front.arg) : back = null; - } - this._invoke = function (key, arg) { - return new Promise(function (resolve, reject) { - var request = { - key: key, - arg: arg, - resolve: resolve, - reject: reject, - next: null - }; - back ? back = back.next = request : (front = back = request, resume(key, arg)); - }); - }, "function" != typeof gen["return"] && (this["return"] = void 0); -} -AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () { - return this; -}, AsyncGenerator.prototype.next = function (arg) { - return this._invoke("next", arg); -}, AsyncGenerator.prototype["throw"] = function (arg) { - return this._invoke("throw", arg); -}, AsyncGenerator.prototype["return"] = function (arg) { - return this._invoke("return", arg); -}; -module.exports = AsyncGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/AwaitValue.js b/project starter code/node_modules/@babel/runtime/helpers/AwaitValue.js deleted file mode 100644 index 7681c2df..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/AwaitValue.js +++ /dev/null @@ -1,4 +0,0 @@ -function _AwaitValue(value) { - this.wrapped = value; -} -module.exports = _AwaitValue, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/OverloadYield.js b/project starter code/node_modules/@babel/runtime/helpers/OverloadYield.js deleted file mode 100644 index b1331134..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/OverloadYield.js +++ /dev/null @@ -1,4 +0,0 @@ -function _OverloadYield(value, kind) { - this.v = value, this.k = kind; -} -module.exports = _OverloadYield, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js b/project starter code/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js deleted file mode 100644 index 98810d61..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/applyDecoratedDescriptor.js +++ /dev/null @@ -1,24 +0,0 @@ -function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { - var desc = {}; - Object.keys(descriptor).forEach(function (key) { - desc[key] = descriptor[key]; - }); - desc.enumerable = !!desc.enumerable; - desc.configurable = !!desc.configurable; - if ('value' in desc || desc.initializer) { - desc.writable = true; - } - desc = decorators.slice().reverse().reduce(function (desc, decorator) { - return decorator(target, property, desc) || desc; - }, desc); - if (context && desc.initializer !== void 0) { - desc.value = desc.initializer ? desc.initializer.call(context) : void 0; - desc.initializer = undefined; - } - if (desc.initializer === void 0) { - Object.defineProperty(target, property, desc); - desc = null; - } - return desc; -} -module.exports = _applyDecoratedDescriptor, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/applyDecs.js b/project starter code/node_modules/@babel/runtime/helpers/applyDecs.js deleted file mode 100644 index 68a08c26..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/applyDecs.js +++ /dev/null @@ -1,236 +0,0 @@ -var _typeof = require("./typeof.js")["default"]; -function old_createMetadataMethodsForProperty(metadataMap, kind, property, decoratorFinishedRef) { - return { - getMetadata: function getMetadata(key) { - old_assertNotFinished(decoratorFinishedRef, "getMetadata"), old_assertMetadataKey(key); - var metadataForKey = metadataMap[key]; - if (void 0 !== metadataForKey) if (1 === kind) { - var pub = metadataForKey["public"]; - if (void 0 !== pub) return pub[property]; - } else if (2 === kind) { - var priv = metadataForKey["private"]; - if (void 0 !== priv) return priv.get(property); - } else if (Object.hasOwnProperty.call(metadataForKey, "constructor")) return metadataForKey.constructor; - }, - setMetadata: function setMetadata(key, value) { - old_assertNotFinished(decoratorFinishedRef, "setMetadata"), old_assertMetadataKey(key); - var metadataForKey = metadataMap[key]; - if (void 0 === metadataForKey && (metadataForKey = metadataMap[key] = {}), 1 === kind) { - var pub = metadataForKey["public"]; - void 0 === pub && (pub = metadataForKey["public"] = {}), pub[property] = value; - } else if (2 === kind) { - var priv = metadataForKey.priv; - void 0 === priv && (priv = metadataForKey["private"] = new Map()), priv.set(property, value); - } else metadataForKey.constructor = value; - } - }; -} -function old_convertMetadataMapToFinal(obj, metadataMap) { - var parentMetadataMap = obj[Symbol.metadata || Symbol["for"]("Symbol.metadata")], - metadataKeys = Object.getOwnPropertySymbols(metadataMap); - if (0 !== metadataKeys.length) { - for (var i = 0; i < metadataKeys.length; i++) { - var key = metadataKeys[i], - metaForKey = metadataMap[key], - parentMetaForKey = parentMetadataMap ? parentMetadataMap[key] : null, - pub = metaForKey["public"], - parentPub = parentMetaForKey ? parentMetaForKey["public"] : null; - pub && parentPub && Object.setPrototypeOf(pub, parentPub); - var priv = metaForKey["private"]; - if (priv) { - var privArr = Array.from(priv.values()), - parentPriv = parentMetaForKey ? parentMetaForKey["private"] : null; - parentPriv && (privArr = privArr.concat(parentPriv)), metaForKey["private"] = privArr; - } - parentMetaForKey && Object.setPrototypeOf(metaForKey, parentMetaForKey); - } - parentMetadataMap && Object.setPrototypeOf(metadataMap, parentMetadataMap), obj[Symbol.metadata || Symbol["for"]("Symbol.metadata")] = metadataMap; - } -} -function old_createAddInitializerMethod(initializers, decoratorFinishedRef) { - return function (initializer) { - old_assertNotFinished(decoratorFinishedRef, "addInitializer"), old_assertCallable(initializer, "An initializer"), initializers.push(initializer); - }; -} -function old_memberDec(dec, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value) { - var kindStr; - switch (kind) { - case 1: - kindStr = "accessor"; - break; - case 2: - kindStr = "method"; - break; - case 3: - kindStr = "getter"; - break; - case 4: - kindStr = "setter"; - break; - default: - kindStr = "field"; - } - var metadataKind, - metadataName, - ctx = { - kind: kindStr, - name: isPrivate ? "#" + name : name, - isStatic: isStatic, - isPrivate: isPrivate - }, - decoratorFinishedRef = { - v: !1 - }; - if (0 !== kind && (ctx.addInitializer = old_createAddInitializerMethod(initializers, decoratorFinishedRef)), isPrivate) { - metadataKind = 2, metadataName = Symbol(name); - var access = {}; - 0 === kind ? (access.get = desc.get, access.set = desc.set) : 2 === kind ? access.get = function () { - return desc.value; - } : (1 !== kind && 3 !== kind || (access.get = function () { - return desc.get.call(this); - }), 1 !== kind && 4 !== kind || (access.set = function (v) { - desc.set.call(this, v); - })), ctx.access = access; - } else metadataKind = 1, metadataName = name; - try { - return dec(value, Object.assign(ctx, old_createMetadataMethodsForProperty(metadataMap, metadataKind, metadataName, decoratorFinishedRef))); - } finally { - decoratorFinishedRef.v = !0; - } -} -function old_assertNotFinished(decoratorFinishedRef, fnName) { - if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished"); -} -function old_assertMetadataKey(key) { - if ("symbol" != _typeof(key)) throw new TypeError("Metadata keys must be symbols, received: " + key); -} -function old_assertCallable(fn, hint) { - if ("function" != typeof fn) throw new TypeError(hint + " must be a function"); -} -function old_assertValidReturnValue(kind, value) { - var type = _typeof(value); - if (1 === kind) { - if ("object" !== type || null === value) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); - void 0 !== value.get && old_assertCallable(value.get, "accessor.get"), void 0 !== value.set && old_assertCallable(value.set, "accessor.set"), void 0 !== value.init && old_assertCallable(value.init, "accessor.init"), void 0 !== value.initializer && old_assertCallable(value.initializer, "accessor.initializer"); - } else if ("function" !== type) { - var hint; - throw hint = 0 === kind ? "field" : 10 === kind ? "class" : "method", new TypeError(hint + " decorators must return a function or void 0"); - } -} -function old_getInit(desc) { - var initializer; - return null == (initializer = desc.init) && (initializer = desc.initializer) && "undefined" != typeof console && console.warn(".initializer has been renamed to .init as of March 2022"), initializer; -} -function old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers) { - var desc, - initializer, - value, - newValue, - get, - set, - decs = decInfo[0]; - if (isPrivate ? desc = 0 === kind || 1 === kind ? { - get: decInfo[3], - set: decInfo[4] - } : 3 === kind ? { - get: decInfo[3] - } : 4 === kind ? { - set: decInfo[3] - } : { - value: decInfo[3] - } : 0 !== kind && (desc = Object.getOwnPropertyDescriptor(base, name)), 1 === kind ? value = { - get: desc.get, - set: desc.set - } : 2 === kind ? value = desc.value : 3 === kind ? value = desc.get : 4 === kind && (value = desc.set), "function" == typeof decs) void 0 !== (newValue = old_memberDec(decs, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value)) && (old_assertValidReturnValue(kind, newValue), 0 === kind ? initializer = newValue : 1 === kind ? (initializer = old_getInit(newValue), get = newValue.get || value.get, set = newValue.set || value.set, value = { - get: get, - set: set - }) : value = newValue);else for (var i = decs.length - 1; i >= 0; i--) { - var newInit; - if (void 0 !== (newValue = old_memberDec(decs[i], name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value))) old_assertValidReturnValue(kind, newValue), 0 === kind ? newInit = newValue : 1 === kind ? (newInit = old_getInit(newValue), get = newValue.get || value.get, set = newValue.set || value.set, value = { - get: get, - set: set - }) : value = newValue, void 0 !== newInit && (void 0 === initializer ? initializer = newInit : "function" == typeof initializer ? initializer = [initializer, newInit] : initializer.push(newInit)); - } - if (0 === kind || 1 === kind) { - if (void 0 === initializer) initializer = function initializer(instance, init) { - return init; - };else if ("function" != typeof initializer) { - var ownInitializers = initializer; - initializer = function initializer(instance, init) { - for (var value = init, i = 0; i < ownInitializers.length; i++) value = ownInitializers[i].call(instance, value); - return value; - }; - } else { - var originalInitializer = initializer; - initializer = function initializer(instance, init) { - return originalInitializer.call(instance, init); - }; - } - ret.push(initializer); - } - 0 !== kind && (1 === kind ? (desc.get = value.get, desc.set = value.set) : 2 === kind ? desc.value = value : 3 === kind ? desc.get = value : 4 === kind && (desc.set = value), isPrivate ? 1 === kind ? (ret.push(function (instance, args) { - return value.get.call(instance, args); - }), ret.push(function (instance, args) { - return value.set.call(instance, args); - })) : 2 === kind ? ret.push(value) : ret.push(function (instance, args) { - return value.call(instance, args); - }) : Object.defineProperty(base, name, desc)); -} -function old_applyMemberDecs(ret, Class, protoMetadataMap, staticMetadataMap, decInfos) { - for (var protoInitializers, staticInitializers, existingProtoNonFields = new Map(), existingStaticNonFields = new Map(), i = 0; i < decInfos.length; i++) { - var decInfo = decInfos[i]; - if (Array.isArray(decInfo)) { - var base, - metadataMap, - initializers, - kind = decInfo[1], - name = decInfo[2], - isPrivate = decInfo.length > 3, - isStatic = kind >= 5; - if (isStatic ? (base = Class, metadataMap = staticMetadataMap, 0 !== (kind -= 5) && (initializers = staticInitializers = staticInitializers || [])) : (base = Class.prototype, metadataMap = protoMetadataMap, 0 !== kind && (initializers = protoInitializers = protoInitializers || [])), 0 !== kind && !isPrivate) { - var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields, - existingKind = existingNonFields.get(name) || 0; - if (!0 === existingKind || 3 === existingKind && 4 !== kind || 4 === existingKind && 3 !== kind) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name); - !existingKind && kind > 2 ? existingNonFields.set(name, kind) : existingNonFields.set(name, !0); - } - old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers); - } - } - old_pushInitializers(ret, protoInitializers), old_pushInitializers(ret, staticInitializers); -} -function old_pushInitializers(ret, initializers) { - initializers && ret.push(function (instance) { - for (var i = 0; i < initializers.length; i++) initializers[i].call(instance); - return instance; - }); -} -function old_applyClassDecs(ret, targetClass, metadataMap, classDecs) { - if (classDecs.length > 0) { - for (var initializers = [], newClass = targetClass, name = targetClass.name, i = classDecs.length - 1; i >= 0; i--) { - var decoratorFinishedRef = { - v: !1 - }; - try { - var ctx = Object.assign({ - kind: "class", - name: name, - addInitializer: old_createAddInitializerMethod(initializers, decoratorFinishedRef) - }, old_createMetadataMethodsForProperty(metadataMap, 0, name, decoratorFinishedRef)), - nextNewClass = classDecs[i](newClass, ctx); - } finally { - decoratorFinishedRef.v = !0; - } - void 0 !== nextNewClass && (old_assertValidReturnValue(10, nextNewClass), newClass = nextNewClass); - } - ret.push(newClass, function () { - for (var i = 0; i < initializers.length; i++) initializers[i].call(newClass); - }); - } -} -function applyDecs(targetClass, memberDecs, classDecs) { - var ret = [], - staticMetadataMap = {}, - protoMetadataMap = {}; - return old_applyMemberDecs(ret, targetClass, protoMetadataMap, staticMetadataMap, memberDecs), old_convertMetadataMapToFinal(targetClass.prototype, protoMetadataMap), old_applyClassDecs(ret, targetClass, staticMetadataMap, classDecs), old_convertMetadataMapToFinal(targetClass, staticMetadataMap), ret; -} -module.exports = applyDecs, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/applyDecs2203.js b/project starter code/node_modules/@babel/runtime/helpers/applyDecs2203.js deleted file mode 100644 index 34419d52..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/applyDecs2203.js +++ /dev/null @@ -1,184 +0,0 @@ -var _typeof = require("./typeof.js")["default"]; -function createAddInitializerMethod(initializers, decoratorFinishedRef) { - return function (initializer) { - assertNotFinished(decoratorFinishedRef, "addInitializer"), assertCallable(initializer, "An initializer"), initializers.push(initializer); - }; -} -function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, value) { - var kindStr; - switch (kind) { - case 1: - kindStr = "accessor"; - break; - case 2: - kindStr = "method"; - break; - case 3: - kindStr = "getter"; - break; - case 4: - kindStr = "setter"; - break; - default: - kindStr = "field"; - } - var get, - set, - ctx = { - kind: kindStr, - name: isPrivate ? "#" + name : name, - "static": isStatic, - "private": isPrivate - }, - decoratorFinishedRef = { - v: !1 - }; - 0 !== kind && (ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef)), 0 === kind ? isPrivate ? (get = desc.get, set = desc.set) : (get = function get() { - return this[name]; - }, set = function set(v) { - this[name] = v; - }) : 2 === kind ? get = function get() { - return desc.value; - } : (1 !== kind && 3 !== kind || (get = function get() { - return desc.get.call(this); - }), 1 !== kind && 4 !== kind || (set = function set(v) { - desc.set.call(this, v); - })), ctx.access = get && set ? { - get: get, - set: set - } : get ? { - get: get - } : { - set: set - }; - try { - return dec(value, ctx); - } finally { - decoratorFinishedRef.v = !0; - } -} -function assertNotFinished(decoratorFinishedRef, fnName) { - if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished"); -} -function assertCallable(fn, hint) { - if ("function" != typeof fn) throw new TypeError(hint + " must be a function"); -} -function assertValidReturnValue(kind, value) { - var type = _typeof(value); - if (1 === kind) { - if ("object" !== type || null === value) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); - void 0 !== value.get && assertCallable(value.get, "accessor.get"), void 0 !== value.set && assertCallable(value.set, "accessor.set"), void 0 !== value.init && assertCallable(value.init, "accessor.init"); - } else if ("function" !== type) { - var hint; - throw hint = 0 === kind ? "field" : 10 === kind ? "class" : "method", new TypeError(hint + " decorators must return a function or void 0"); - } -} -function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers) { - var desc, - init, - value, - newValue, - get, - set, - decs = decInfo[0]; - if (isPrivate ? desc = 0 === kind || 1 === kind ? { - get: decInfo[3], - set: decInfo[4] - } : 3 === kind ? { - get: decInfo[3] - } : 4 === kind ? { - set: decInfo[3] - } : { - value: decInfo[3] - } : 0 !== kind && (desc = Object.getOwnPropertyDescriptor(base, name)), 1 === kind ? value = { - get: desc.get, - set: desc.set - } : 2 === kind ? value = desc.value : 3 === kind ? value = desc.get : 4 === kind && (value = desc.set), "function" == typeof decs) void 0 !== (newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, value)) && (assertValidReturnValue(kind, newValue), 0 === kind ? init = newValue : 1 === kind ? (init = newValue.init, get = newValue.get || value.get, set = newValue.set || value.set, value = { - get: get, - set: set - }) : value = newValue);else for (var i = decs.length - 1; i >= 0; i--) { - var newInit; - if (void 0 !== (newValue = memberDec(decs[i], name, desc, initializers, kind, isStatic, isPrivate, value))) assertValidReturnValue(kind, newValue), 0 === kind ? newInit = newValue : 1 === kind ? (newInit = newValue.init, get = newValue.get || value.get, set = newValue.set || value.set, value = { - get: get, - set: set - }) : value = newValue, void 0 !== newInit && (void 0 === init ? init = newInit : "function" == typeof init ? init = [init, newInit] : init.push(newInit)); - } - if (0 === kind || 1 === kind) { - if (void 0 === init) init = function init(instance, _init) { - return _init; - };else if ("function" != typeof init) { - var ownInitializers = init; - init = function init(instance, _init2) { - for (var value = _init2, i = 0; i < ownInitializers.length; i++) value = ownInitializers[i].call(instance, value); - return value; - }; - } else { - var originalInitializer = init; - init = function init(instance, _init3) { - return originalInitializer.call(instance, _init3); - }; - } - ret.push(init); - } - 0 !== kind && (1 === kind ? (desc.get = value.get, desc.set = value.set) : 2 === kind ? desc.value = value : 3 === kind ? desc.get = value : 4 === kind && (desc.set = value), isPrivate ? 1 === kind ? (ret.push(function (instance, args) { - return value.get.call(instance, args); - }), ret.push(function (instance, args) { - return value.set.call(instance, args); - })) : 2 === kind ? ret.push(value) : ret.push(function (instance, args) { - return value.call(instance, args); - }) : Object.defineProperty(base, name, desc)); -} -function applyMemberDecs(ret, Class, decInfos) { - for (var protoInitializers, staticInitializers, existingProtoNonFields = new Map(), existingStaticNonFields = new Map(), i = 0; i < decInfos.length; i++) { - var decInfo = decInfos[i]; - if (Array.isArray(decInfo)) { - var base, - initializers, - kind = decInfo[1], - name = decInfo[2], - isPrivate = decInfo.length > 3, - isStatic = kind >= 5; - if (isStatic ? (base = Class, 0 !== (kind -= 5) && (initializers = staticInitializers = staticInitializers || [])) : (base = Class.prototype, 0 !== kind && (initializers = protoInitializers = protoInitializers || [])), 0 !== kind && !isPrivate) { - var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields, - existingKind = existingNonFields.get(name) || 0; - if (!0 === existingKind || 3 === existingKind && 4 !== kind || 4 === existingKind && 3 !== kind) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name); - !existingKind && kind > 2 ? existingNonFields.set(name, kind) : existingNonFields.set(name, !0); - } - applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers); - } - } - pushInitializers(ret, protoInitializers), pushInitializers(ret, staticInitializers); -} -function pushInitializers(ret, initializers) { - initializers && ret.push(function (instance) { - for (var i = 0; i < initializers.length; i++) initializers[i].call(instance); - return instance; - }); -} -function applyClassDecs(ret, targetClass, classDecs) { - if (classDecs.length > 0) { - for (var initializers = [], newClass = targetClass, name = targetClass.name, i = classDecs.length - 1; i >= 0; i--) { - var decoratorFinishedRef = { - v: !1 - }; - try { - var nextNewClass = classDecs[i](newClass, { - kind: "class", - name: name, - addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef) - }); - } finally { - decoratorFinishedRef.v = !0; - } - void 0 !== nextNewClass && (assertValidReturnValue(10, nextNewClass), newClass = nextNewClass); - } - ret.push(newClass, function () { - for (var i = 0; i < initializers.length; i++) initializers[i].call(newClass); - }); - } -} -function applyDecs2203(targetClass, memberDecs, classDecs) { - var ret = []; - return applyMemberDecs(ret, targetClass, memberDecs), applyClassDecs(ret, targetClass, classDecs), ret; -} -module.exports = applyDecs2203, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/arrayLikeToArray.js b/project starter code/node_modules/@babel/runtime/helpers/arrayLikeToArray.js deleted file mode 100644 index 36865401..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/arrayLikeToArray.js +++ /dev/null @@ -1,6 +0,0 @@ -function _arrayLikeToArray(arr, len) { - if (len == null || len > arr.length) len = arr.length; - for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; - return arr2; -} -module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/arrayWithHoles.js b/project starter code/node_modules/@babel/runtime/helpers/arrayWithHoles.js deleted file mode 100644 index ad0cc6b9..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/arrayWithHoles.js +++ /dev/null @@ -1,4 +0,0 @@ -function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; -} -module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js b/project starter code/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js deleted file mode 100644 index 6d4b76de..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/arrayWithoutHoles.js +++ /dev/null @@ -1,5 +0,0 @@ -var arrayLikeToArray = require("./arrayLikeToArray.js"); -function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) return arrayLikeToArray(arr); -} -module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/assertThisInitialized.js b/project starter code/node_modules/@babel/runtime/helpers/assertThisInitialized.js deleted file mode 100644 index 71487e57..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/assertThisInitialized.js +++ /dev/null @@ -1,7 +0,0 @@ -function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - return self; -} -module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js b/project starter code/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js deleted file mode 100644 index c272bcde..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/asyncGeneratorDelegate.js +++ /dev/null @@ -1,24 +0,0 @@ -var OverloadYield = require("./OverloadYield.js"); -function _asyncGeneratorDelegate(inner) { - var iter = {}, - waiting = !1; - function pump(key, value) { - return waiting = !0, value = new Promise(function (resolve) { - resolve(inner[key](value)); - }), { - done: !1, - value: new OverloadYield(value, 1) - }; - } - return iter["undefined" != typeof Symbol && Symbol.iterator || "@@iterator"] = function () { - return this; - }, iter.next = function (value) { - return waiting ? (waiting = !1, value) : pump("next", value); - }, "function" == typeof inner["throw"] && (iter["throw"] = function (value) { - if (waiting) throw waiting = !1, value; - return pump("throw", value); - }), "function" == typeof inner["return"] && (iter["return"] = function (value) { - return waiting ? (waiting = !1, value) : pump("return", value); - }), iter; -} -module.exports = _asyncGeneratorDelegate, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/asyncIterator.js b/project starter code/node_modules/@babel/runtime/helpers/asyncIterator.js deleted file mode 100644 index 420ef080..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/asyncIterator.js +++ /dev/null @@ -1,45 +0,0 @@ -function _asyncIterator(iterable) { - var method, - async, - sync, - retry = 2; - for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { - if (async && null != (method = iterable[async])) return method.call(iterable); - if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable)); - async = "@@asyncIterator", sync = "@@iterator"; - } - throw new TypeError("Object is not async iterable"); -} -function AsyncFromSyncIterator(s) { - function AsyncFromSyncIteratorContinuation(r) { - if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); - var done = r.done; - return Promise.resolve(r.value).then(function (value) { - return { - value: value, - done: done - }; - }); - } - return AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { - this.s = s, this.n = s.next; - }, AsyncFromSyncIterator.prototype = { - s: null, - n: null, - next: function next() { - return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); - }, - "return": function _return(value) { - var ret = this.s["return"]; - return void 0 === ret ? Promise.resolve({ - value: value, - done: !0 - }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); - }, - "throw": function _throw(value) { - var thr = this.s["return"]; - return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); - } - }, new AsyncFromSyncIterator(s); -} -module.exports = _asyncIterator, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/asyncToGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/asyncToGenerator.js deleted file mode 100644 index 6b9697af..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/asyncToGenerator.js +++ /dev/null @@ -1,31 +0,0 @@ -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { - try { - var info = gen[key](arg); - var value = info.value; - } catch (error) { - reject(error); - return; - } - if (info.done) { - resolve(value); - } else { - Promise.resolve(value).then(_next, _throw); - } -} -function _asyncToGenerator(fn) { - return function () { - var self = this, - args = arguments; - return new Promise(function (resolve, reject) { - var gen = fn.apply(self, args); - function _next(value) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); - } - function _throw(err) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); - } - _next(undefined); - }); - }; -} -module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js deleted file mode 100644 index 7d4e9511..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/awaitAsyncGenerator.js +++ /dev/null @@ -1,5 +0,0 @@ -var OverloadYield = require("./OverloadYield.js"); -function _awaitAsyncGenerator(value) { - return new OverloadYield(value, 0); -} -module.exports = _awaitAsyncGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/checkInRHS.js b/project starter code/node_modules/@babel/runtime/helpers/checkInRHS.js deleted file mode 100644 index e6ba6389..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/checkInRHS.js +++ /dev/null @@ -1,6 +0,0 @@ -var _typeof = require("./typeof.js")["default"]; -function _checkInRHS(value) { - if (Object(value) !== value) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== value ? _typeof(value) : "null")); - return value; -} -module.exports = _checkInRHS, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/checkPrivateRedeclaration.js b/project starter code/node_modules/@babel/runtime/helpers/checkPrivateRedeclaration.js deleted file mode 100644 index 1bbfd346..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/checkPrivateRedeclaration.js +++ /dev/null @@ -1,6 +0,0 @@ -function _checkPrivateRedeclaration(obj, privateCollection) { - if (privateCollection.has(obj)) { - throw new TypeError("Cannot initialize the same private elements twice on an object"); - } -} -module.exports = _checkPrivateRedeclaration, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js b/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js deleted file mode 100644 index 3ebfed87..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorDestructureSet.js +++ /dev/null @@ -1,18 +0,0 @@ -function _classApplyDescriptorDestructureSet(receiver, descriptor) { - if (descriptor.set) { - if (!("__destrObj" in descriptor)) { - descriptor.__destrObj = { - set value(v) { - descriptor.set.call(receiver, v); - } - }; - } - return descriptor.__destrObj; - } else { - if (!descriptor.writable) { - throw new TypeError("attempted to set read only private field"); - } - return descriptor; - } -} -module.exports = _classApplyDescriptorDestructureSet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js b/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js deleted file mode 100644 index af3555da..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorGet.js +++ /dev/null @@ -1,7 +0,0 @@ -function _classApplyDescriptorGet(receiver, descriptor) { - if (descriptor.get) { - return descriptor.get.call(receiver); - } - return descriptor.value; -} -module.exports = _classApplyDescriptorGet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js b/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js deleted file mode 100644 index 71bbf1df..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classApplyDescriptorSet.js +++ /dev/null @@ -1,11 +0,0 @@ -function _classApplyDescriptorSet(receiver, descriptor, value) { - if (descriptor.set) { - descriptor.set.call(receiver, value); - } else { - if (!descriptor.writable) { - throw new TypeError("attempted to set read only private field"); - } - descriptor.value = value; - } -} -module.exports = _classApplyDescriptorSet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classCallCheck.js b/project starter code/node_modules/@babel/runtime/helpers/classCallCheck.js deleted file mode 100644 index eab7e520..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classCallCheck.js +++ /dev/null @@ -1,6 +0,0 @@ -function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } -} -module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js b/project starter code/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js deleted file mode 100644 index 34876843..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classCheckPrivateStaticAccess.js +++ /dev/null @@ -1,6 +0,0 @@ -function _classCheckPrivateStaticAccess(receiver, classConstructor) { - if (receiver !== classConstructor) { - throw new TypeError("Private static access of wrong provenance"); - } -} -module.exports = _classCheckPrivateStaticAccess, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js b/project starter code/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js deleted file mode 100644 index b937d15e..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classCheckPrivateStaticFieldDescriptor.js +++ /dev/null @@ -1,6 +0,0 @@ -function _classCheckPrivateStaticFieldDescriptor(descriptor, action) { - if (descriptor === undefined) { - throw new TypeError("attempted to " + action + " private static field before its declaration"); - } -} -module.exports = _classCheckPrivateStaticFieldDescriptor, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js b/project starter code/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js deleted file mode 100644 index e6f4725a..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classExtractFieldDescriptor.js +++ /dev/null @@ -1,7 +0,0 @@ -function _classExtractFieldDescriptor(receiver, privateMap, action) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to " + action + " private field on non-instance"); - } - return privateMap.get(receiver); -} -module.exports = _classExtractFieldDescriptor, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classNameTDZError.js b/project starter code/node_modules/@babel/runtime/helpers/classNameTDZError.js deleted file mode 100644 index 9f84697a..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classNameTDZError.js +++ /dev/null @@ -1,4 +0,0 @@ -function _classNameTDZError(name) { - throw new ReferenceError("Class \"" + name + "\" cannot be referenced in computed property keys."); -} -module.exports = _classNameTDZError, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js deleted file mode 100644 index 07f777df..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldDestructureSet.js +++ /dev/null @@ -1,7 +0,0 @@ -var classApplyDescriptorDestructureSet = require("./classApplyDescriptorDestructureSet.js"); -var classExtractFieldDescriptor = require("./classExtractFieldDescriptor.js"); -function _classPrivateFieldDestructureSet(receiver, privateMap) { - var descriptor = classExtractFieldDescriptor(receiver, privateMap, "set"); - return classApplyDescriptorDestructureSet(receiver, descriptor); -} -module.exports = _classPrivateFieldDestructureSet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js deleted file mode 100644 index a67951e1..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldGet.js +++ /dev/null @@ -1,7 +0,0 @@ -var classApplyDescriptorGet = require("./classApplyDescriptorGet.js"); -var classExtractFieldDescriptor = require("./classExtractFieldDescriptor.js"); -function _classPrivateFieldGet(receiver, privateMap) { - var descriptor = classExtractFieldDescriptor(receiver, privateMap, "get"); - return classApplyDescriptorGet(receiver, descriptor); -} -module.exports = _classPrivateFieldGet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldInitSpec.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldInitSpec.js deleted file mode 100644 index e55873a1..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldInitSpec.js +++ /dev/null @@ -1,6 +0,0 @@ -var checkPrivateRedeclaration = require("./checkPrivateRedeclaration.js"); -function _classPrivateFieldInitSpec(obj, privateMap, value) { - checkPrivateRedeclaration(obj, privateMap); - privateMap.set(obj, value); -} -module.exports = _classPrivateFieldInitSpec, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js deleted file mode 100644 index bb16c0bc..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldLooseBase.js +++ /dev/null @@ -1,7 +0,0 @@ -function _classPrivateFieldBase(receiver, privateKey) { - if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { - throw new TypeError("attempted to use private field on non-instance"); - } - return receiver; -} -module.exports = _classPrivateFieldBase, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js deleted file mode 100644 index b3d546f1..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldLooseKey.js +++ /dev/null @@ -1,5 +0,0 @@ -var id = 0; -function _classPrivateFieldKey(name) { - return "__private_" + id++ + "_" + name; -} -module.exports = _classPrivateFieldKey, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js deleted file mode 100644 index ffb73a10..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateFieldSet.js +++ /dev/null @@ -1,8 +0,0 @@ -var classApplyDescriptorSet = require("./classApplyDescriptorSet.js"); -var classExtractFieldDescriptor = require("./classExtractFieldDescriptor.js"); -function _classPrivateFieldSet(receiver, privateMap, value) { - var descriptor = classExtractFieldDescriptor(receiver, privateMap, "set"); - classApplyDescriptorSet(receiver, descriptor, value); - return value; -} -module.exports = _classPrivateFieldSet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js deleted file mode 100644 index 6a8436da..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodGet.js +++ /dev/null @@ -1,7 +0,0 @@ -function _classPrivateMethodGet(receiver, privateSet, fn) { - if (!privateSet.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - return fn; -} -module.exports = _classPrivateMethodGet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodInitSpec.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodInitSpec.js deleted file mode 100644 index 31064767..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodInitSpec.js +++ /dev/null @@ -1,6 +0,0 @@ -var checkPrivateRedeclaration = require("./checkPrivateRedeclaration.js"); -function _classPrivateMethodInitSpec(obj, privateSet) { - checkPrivateRedeclaration(obj, privateSet); - privateSet.add(obj); -} -module.exports = _classPrivateMethodInitSpec, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js b/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js deleted file mode 100644 index a44fd785..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classPrivateMethodSet.js +++ /dev/null @@ -1,4 +0,0 @@ -function _classPrivateMethodSet() { - throw new TypeError("attempted to reassign private method"); -} -module.exports = _classPrivateMethodSet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js b/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js deleted file mode 100644 index 734aaafa..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldDestructureSet.js +++ /dev/null @@ -1,9 +0,0 @@ -var classApplyDescriptorDestructureSet = require("./classApplyDescriptorDestructureSet.js"); -var classCheckPrivateStaticAccess = require("./classCheckPrivateStaticAccess.js"); -var classCheckPrivateStaticFieldDescriptor = require("./classCheckPrivateStaticFieldDescriptor.js"); -function _classStaticPrivateFieldDestructureSet(receiver, classConstructor, descriptor) { - classCheckPrivateStaticAccess(receiver, classConstructor); - classCheckPrivateStaticFieldDescriptor(descriptor, "set"); - return classApplyDescriptorDestructureSet(receiver, descriptor); -} -module.exports = _classStaticPrivateFieldDestructureSet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js b/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js deleted file mode 100644 index e8e295f4..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecGet.js +++ /dev/null @@ -1,9 +0,0 @@ -var classApplyDescriptorGet = require("./classApplyDescriptorGet.js"); -var classCheckPrivateStaticAccess = require("./classCheckPrivateStaticAccess.js"); -var classCheckPrivateStaticFieldDescriptor = require("./classCheckPrivateStaticFieldDescriptor.js"); -function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) { - classCheckPrivateStaticAccess(receiver, classConstructor); - classCheckPrivateStaticFieldDescriptor(descriptor, "get"); - return classApplyDescriptorGet(receiver, descriptor); -} -module.exports = _classStaticPrivateFieldSpecGet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js b/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js deleted file mode 100644 index b02e4c01..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateFieldSpecSet.js +++ /dev/null @@ -1,10 +0,0 @@ -var classApplyDescriptorSet = require("./classApplyDescriptorSet.js"); -var classCheckPrivateStaticAccess = require("./classCheckPrivateStaticAccess.js"); -var classCheckPrivateStaticFieldDescriptor = require("./classCheckPrivateStaticFieldDescriptor.js"); -function _classStaticPrivateFieldSpecSet(receiver, classConstructor, descriptor, value) { - classCheckPrivateStaticAccess(receiver, classConstructor); - classCheckPrivateStaticFieldDescriptor(descriptor, "set"); - classApplyDescriptorSet(receiver, descriptor, value); - return value; -} -module.exports = _classStaticPrivateFieldSpecSet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js b/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js deleted file mode 100644 index d3bb9968..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateMethodGet.js +++ /dev/null @@ -1,6 +0,0 @@ -var classCheckPrivateStaticAccess = require("./classCheckPrivateStaticAccess.js"); -function _classStaticPrivateMethodGet(receiver, classConstructor, method) { - classCheckPrivateStaticAccess(receiver, classConstructor); - return method; -} -module.exports = _classStaticPrivateMethodGet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js b/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js deleted file mode 100644 index 72560e66..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/classStaticPrivateMethodSet.js +++ /dev/null @@ -1,4 +0,0 @@ -function _classStaticPrivateMethodSet() { - throw new TypeError("attempted to set read only static private field"); -} -module.exports = _classStaticPrivateMethodSet, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/construct.js b/project starter code/node_modules/@babel/runtime/helpers/construct.js deleted file mode 100644 index 3d3c232d..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/construct.js +++ /dev/null @@ -1,18 +0,0 @@ -var setPrototypeOf = require("./setPrototypeOf.js"); -var isNativeReflectConstruct = require("./isNativeReflectConstruct.js"); -function _construct(Parent, args, Class) { - if (isNativeReflectConstruct()) { - module.exports = _construct = Reflect.construct.bind(), module.exports.__esModule = true, module.exports["default"] = module.exports; - } else { - module.exports = _construct = function _construct(Parent, args, Class) { - var a = [null]; - a.push.apply(a, args); - var Constructor = Function.bind.apply(Parent, a); - var instance = new Constructor(); - if (Class) setPrototypeOf(instance, Class.prototype); - return instance; - }, module.exports.__esModule = true, module.exports["default"] = module.exports; - } - return _construct.apply(null, arguments); -} -module.exports = _construct, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/createClass.js b/project starter code/node_modules/@babel/runtime/helpers/createClass.js deleted file mode 100644 index 201dcdf4..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/createClass.js +++ /dev/null @@ -1,19 +0,0 @@ -var toPropertyKey = require("./toPropertyKey.js"); -function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor); - } -} -function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - Object.defineProperty(Constructor, "prototype", { - writable: false - }); - return Constructor; -} -module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js b/project starter code/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js deleted file mode 100644 index 19b6f141..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js +++ /dev/null @@ -1,53 +0,0 @@ -var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); -function _createForOfIteratorHelper(o, allowArrayLike) { - var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; - if (!it) { - if (Array.isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { - if (it) o = it; - var i = 0; - var F = function F() {}; - return { - s: F, - n: function n() { - if (i >= o.length) return { - done: true - }; - return { - done: false, - value: o[i++] - }; - }, - e: function e(_e) { - throw _e; - }, - f: F - }; - } - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); - } - var normalCompletion = true, - didErr = false, - err; - return { - s: function s() { - it = it.call(o); - }, - n: function n() { - var step = it.next(); - normalCompletion = step.done; - return step; - }, - e: function e(_e2) { - didErr = true; - err = _e2; - }, - f: function f() { - try { - if (!normalCompletion && it["return"] != null) it["return"](); - } finally { - if (didErr) throw err; - } - } - }; -} -module.exports = _createForOfIteratorHelper, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js b/project starter code/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js deleted file mode 100644 index b8eb5507..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/createForOfIteratorHelperLoose.js +++ /dev/null @@ -1,20 +0,0 @@ -var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); -function _createForOfIteratorHelperLoose(o, allowArrayLike) { - var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; - if (it) return (it = it.call(o)).next.bind(it); - if (Array.isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { - if (it) o = it; - var i = 0; - return function () { - if (i >= o.length) return { - done: true - }; - return { - done: false, - value: o[i++] - }; - }; - } - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -module.exports = _createForOfIteratorHelperLoose, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/createSuper.js b/project starter code/node_modules/@babel/runtime/helpers/createSuper.js deleted file mode 100644 index bd72679c..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/createSuper.js +++ /dev/null @@ -1,18 +0,0 @@ -var getPrototypeOf = require("./getPrototypeOf.js"); -var isNativeReflectConstruct = require("./isNativeReflectConstruct.js"); -var possibleConstructorReturn = require("./possibleConstructorReturn.js"); -function _createSuper(Derived) { - var hasNativeReflectConstruct = isNativeReflectConstruct(); - return function _createSuperInternal() { - var Super = getPrototypeOf(Derived), - result; - if (hasNativeReflectConstruct) { - var NewTarget = getPrototypeOf(this).constructor; - result = Reflect.construct(Super, arguments, NewTarget); - } else { - result = Super.apply(this, arguments); - } - return possibleConstructorReturn(this, result); - }; -} -module.exports = _createSuper, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/decorate.js b/project starter code/node_modules/@babel/runtime/helpers/decorate.js deleted file mode 100644 index 457741fb..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/decorate.js +++ /dev/null @@ -1,343 +0,0 @@ -var toArray = require("./toArray.js"); -var toPropertyKey = require("./toPropertyKey.js"); -function _decorate(decorators, factory, superClass, mixins) { - var api = _getDecoratorsApi(); - if (mixins) { - for (var i = 0; i < mixins.length; i++) { - api = mixins[i](api); - } - } - var r = factory(function initialize(O) { - api.initializeInstanceElements(O, decorated.elements); - }, superClass); - var decorated = api.decorateClass(_coalesceClassElements(r.d.map(_createElementDescriptor)), decorators); - api.initializeClassElements(r.F, decorated.elements); - return api.runClassFinishers(r.F, decorated.finishers); -} -function _getDecoratorsApi() { - _getDecoratorsApi = function _getDecoratorsApi() { - return api; - }; - var api = { - elementsDefinitionOrder: [["method"], ["field"]], - initializeInstanceElements: function initializeInstanceElements(O, elements) { - ["method", "field"].forEach(function (kind) { - elements.forEach(function (element) { - if (element.kind === kind && element.placement === "own") { - this.defineClassElement(O, element); - } - }, this); - }, this); - }, - initializeClassElements: function initializeClassElements(F, elements) { - var proto = F.prototype; - ["method", "field"].forEach(function (kind) { - elements.forEach(function (element) { - var placement = element.placement; - if (element.kind === kind && (placement === "static" || placement === "prototype")) { - var receiver = placement === "static" ? F : proto; - this.defineClassElement(receiver, element); - } - }, this); - }, this); - }, - defineClassElement: function defineClassElement(receiver, element) { - var descriptor = element.descriptor; - if (element.kind === "field") { - var initializer = element.initializer; - descriptor = { - enumerable: descriptor.enumerable, - writable: descriptor.writable, - configurable: descriptor.configurable, - value: initializer === void 0 ? void 0 : initializer.call(receiver) - }; - } - Object.defineProperty(receiver, element.key, descriptor); - }, - decorateClass: function decorateClass(elements, decorators) { - var newElements = []; - var finishers = []; - var placements = { - "static": [], - prototype: [], - own: [] - }; - elements.forEach(function (element) { - this.addElementPlacement(element, placements); - }, this); - elements.forEach(function (element) { - if (!_hasDecorators(element)) return newElements.push(element); - var elementFinishersExtras = this.decorateElement(element, placements); - newElements.push(elementFinishersExtras.element); - newElements.push.apply(newElements, elementFinishersExtras.extras); - finishers.push.apply(finishers, elementFinishersExtras.finishers); - }, this); - if (!decorators) { - return { - elements: newElements, - finishers: finishers - }; - } - var result = this.decorateConstructor(newElements, decorators); - finishers.push.apply(finishers, result.finishers); - result.finishers = finishers; - return result; - }, - addElementPlacement: function addElementPlacement(element, placements, silent) { - var keys = placements[element.placement]; - if (!silent && keys.indexOf(element.key) !== -1) { - throw new TypeError("Duplicated element (" + element.key + ")"); - } - keys.push(element.key); - }, - decorateElement: function decorateElement(element, placements) { - var extras = []; - var finishers = []; - for (var decorators = element.decorators, i = decorators.length - 1; i >= 0; i--) { - var keys = placements[element.placement]; - keys.splice(keys.indexOf(element.key), 1); - var elementObject = this.fromElementDescriptor(element); - var elementFinisherExtras = this.toElementFinisherExtras((0, decorators[i])(elementObject) || elementObject); - element = elementFinisherExtras.element; - this.addElementPlacement(element, placements); - if (elementFinisherExtras.finisher) { - finishers.push(elementFinisherExtras.finisher); - } - var newExtras = elementFinisherExtras.extras; - if (newExtras) { - for (var j = 0; j < newExtras.length; j++) { - this.addElementPlacement(newExtras[j], placements); - } - extras.push.apply(extras, newExtras); - } - } - return { - element: element, - finishers: finishers, - extras: extras - }; - }, - decorateConstructor: function decorateConstructor(elements, decorators) { - var finishers = []; - for (var i = decorators.length - 1; i >= 0; i--) { - var obj = this.fromClassDescriptor(elements); - var elementsAndFinisher = this.toClassDescriptor((0, decorators[i])(obj) || obj); - if (elementsAndFinisher.finisher !== undefined) { - finishers.push(elementsAndFinisher.finisher); - } - if (elementsAndFinisher.elements !== undefined) { - elements = elementsAndFinisher.elements; - for (var j = 0; j < elements.length - 1; j++) { - for (var k = j + 1; k < elements.length; k++) { - if (elements[j].key === elements[k].key && elements[j].placement === elements[k].placement) { - throw new TypeError("Duplicated element (" + elements[j].key + ")"); - } - } - } - } - } - return { - elements: elements, - finishers: finishers - }; - }, - fromElementDescriptor: function fromElementDescriptor(element) { - var obj = { - kind: element.kind, - key: element.key, - placement: element.placement, - descriptor: element.descriptor - }; - var desc = { - value: "Descriptor", - configurable: true - }; - Object.defineProperty(obj, Symbol.toStringTag, desc); - if (element.kind === "field") obj.initializer = element.initializer; - return obj; - }, - toElementDescriptors: function toElementDescriptors(elementObjects) { - if (elementObjects === undefined) return; - return toArray(elementObjects).map(function (elementObject) { - var element = this.toElementDescriptor(elementObject); - this.disallowProperty(elementObject, "finisher", "An element descriptor"); - this.disallowProperty(elementObject, "extras", "An element descriptor"); - return element; - }, this); - }, - toElementDescriptor: function toElementDescriptor(elementObject) { - var kind = String(elementObject.kind); - if (kind !== "method" && kind !== "field") { - throw new TypeError('An element descriptor\'s .kind property must be either "method" or' + ' "field", but a decorator created an element descriptor with' + ' .kind "' + kind + '"'); - } - var key = toPropertyKey(elementObject.key); - var placement = String(elementObject.placement); - if (placement !== "static" && placement !== "prototype" && placement !== "own") { - throw new TypeError('An element descriptor\'s .placement property must be one of "static",' + ' "prototype" or "own", but a decorator created an element descriptor' + ' with .placement "' + placement + '"'); - } - var descriptor = elementObject.descriptor; - this.disallowProperty(elementObject, "elements", "An element descriptor"); - var element = { - kind: kind, - key: key, - placement: placement, - descriptor: Object.assign({}, descriptor) - }; - if (kind !== "field") { - this.disallowProperty(elementObject, "initializer", "A method descriptor"); - } else { - this.disallowProperty(descriptor, "get", "The property descriptor of a field descriptor"); - this.disallowProperty(descriptor, "set", "The property descriptor of a field descriptor"); - this.disallowProperty(descriptor, "value", "The property descriptor of a field descriptor"); - element.initializer = elementObject.initializer; - } - return element; - }, - toElementFinisherExtras: function toElementFinisherExtras(elementObject) { - var element = this.toElementDescriptor(elementObject); - var finisher = _optionalCallableProperty(elementObject, "finisher"); - var extras = this.toElementDescriptors(elementObject.extras); - return { - element: element, - finisher: finisher, - extras: extras - }; - }, - fromClassDescriptor: function fromClassDescriptor(elements) { - var obj = { - kind: "class", - elements: elements.map(this.fromElementDescriptor, this) - }; - var desc = { - value: "Descriptor", - configurable: true - }; - Object.defineProperty(obj, Symbol.toStringTag, desc); - return obj; - }, - toClassDescriptor: function toClassDescriptor(obj) { - var kind = String(obj.kind); - if (kind !== "class") { - throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator' + ' created a class descriptor with .kind "' + kind + '"'); - } - this.disallowProperty(obj, "key", "A class descriptor"); - this.disallowProperty(obj, "placement", "A class descriptor"); - this.disallowProperty(obj, "descriptor", "A class descriptor"); - this.disallowProperty(obj, "initializer", "A class descriptor"); - this.disallowProperty(obj, "extras", "A class descriptor"); - var finisher = _optionalCallableProperty(obj, "finisher"); - var elements = this.toElementDescriptors(obj.elements); - return { - elements: elements, - finisher: finisher - }; - }, - runClassFinishers: function runClassFinishers(constructor, finishers) { - for (var i = 0; i < finishers.length; i++) { - var newConstructor = (0, finishers[i])(constructor); - if (newConstructor !== undefined) { - if (typeof newConstructor !== "function") { - throw new TypeError("Finishers must return a constructor."); - } - constructor = newConstructor; - } - } - return constructor; - }, - disallowProperty: function disallowProperty(obj, name, objectType) { - if (obj[name] !== undefined) { - throw new TypeError(objectType + " can't have a ." + name + " property."); - } - } - }; - return api; -} -function _createElementDescriptor(def) { - var key = toPropertyKey(def.key); - var descriptor; - if (def.kind === "method") { - descriptor = { - value: def.value, - writable: true, - configurable: true, - enumerable: false - }; - } else if (def.kind === "get") { - descriptor = { - get: def.value, - configurable: true, - enumerable: false - }; - } else if (def.kind === "set") { - descriptor = { - set: def.value, - configurable: true, - enumerable: false - }; - } else if (def.kind === "field") { - descriptor = { - configurable: true, - writable: true, - enumerable: true - }; - } - var element = { - kind: def.kind === "field" ? "field" : "method", - key: key, - placement: def["static"] ? "static" : def.kind === "field" ? "own" : "prototype", - descriptor: descriptor - }; - if (def.decorators) element.decorators = def.decorators; - if (def.kind === "field") element.initializer = def.value; - return element; -} -function _coalesceGetterSetter(element, other) { - if (element.descriptor.get !== undefined) { - other.descriptor.get = element.descriptor.get; - } else { - other.descriptor.set = element.descriptor.set; - } -} -function _coalesceClassElements(elements) { - var newElements = []; - var isSameElement = function isSameElement(other) { - return other.kind === "method" && other.key === element.key && other.placement === element.placement; - }; - for (var i = 0; i < elements.length; i++) { - var element = elements[i]; - var other; - if (element.kind === "method" && (other = newElements.find(isSameElement))) { - if (_isDataDescriptor(element.descriptor) || _isDataDescriptor(other.descriptor)) { - if (_hasDecorators(element) || _hasDecorators(other)) { - throw new ReferenceError("Duplicated methods (" + element.key + ") can't be decorated."); - } - other.descriptor = element.descriptor; - } else { - if (_hasDecorators(element)) { - if (_hasDecorators(other)) { - throw new ReferenceError("Decorators can't be placed on different accessors with for " + "the same property (" + element.key + ")."); - } - other.decorators = element.decorators; - } - _coalesceGetterSetter(element, other); - } - } else { - newElements.push(element); - } - } - return newElements; -} -function _hasDecorators(element) { - return element.decorators && element.decorators.length; -} -function _isDataDescriptor(desc) { - return desc !== undefined && !(desc.value === undefined && desc.writable === undefined); -} -function _optionalCallableProperty(obj, name) { - var value = obj[name]; - if (value !== undefined && typeof value !== "function") { - throw new TypeError("Expected '" + name + "' to be a function"); - } - return value; -} -module.exports = _decorate, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/defaults.js b/project starter code/node_modules/@babel/runtime/helpers/defaults.js deleted file mode 100644 index 86641e9c..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/defaults.js +++ /dev/null @@ -1,12 +0,0 @@ -function _defaults(obj, defaults) { - var keys = Object.getOwnPropertyNames(defaults); - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var value = Object.getOwnPropertyDescriptor(defaults, key); - if (value && value.configurable && obj[key] === undefined) { - Object.defineProperty(obj, key, value); - } - } - return obj; -} -module.exports = _defaults, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/defineAccessor.js b/project starter code/node_modules/@babel/runtime/helpers/defineAccessor.js deleted file mode 100644 index c7224271..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/defineAccessor.js +++ /dev/null @@ -1,8 +0,0 @@ -function _defineAccessor(type, obj, key, fn) { - var desc = { - configurable: !0, - enumerable: !0 - }; - return desc[type] = fn, Object.defineProperty(obj, key, desc); -} -module.exports = _defineAccessor, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js b/project starter code/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js deleted file mode 100644 index a04e6028..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/defineEnumerableProperties.js +++ /dev/null @@ -1,20 +0,0 @@ -function _defineEnumerableProperties(obj, descs) { - for (var key in descs) { - var desc = descs[key]; - desc.configurable = desc.enumerable = true; - if ("value" in desc) desc.writable = true; - Object.defineProperty(obj, key, desc); - } - if (Object.getOwnPropertySymbols) { - var objectSymbols = Object.getOwnPropertySymbols(descs); - for (var i = 0; i < objectSymbols.length; i++) { - var sym = objectSymbols[i]; - var desc = descs[sym]; - desc.configurable = desc.enumerable = true; - if ("value" in desc) desc.writable = true; - Object.defineProperty(obj, sym, desc); - } - } - return obj; -} -module.exports = _defineEnumerableProperties, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/defineProperty.js b/project starter code/node_modules/@babel/runtime/helpers/defineProperty.js deleted file mode 100644 index 8762046d..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/defineProperty.js +++ /dev/null @@ -1,16 +0,0 @@ -var toPropertyKey = require("./toPropertyKey.js"); -function _defineProperty(obj, key, value) { - key = toPropertyKey(key); - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - return obj; -} -module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/AsyncGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/esm/AsyncGenerator.js deleted file mode 100644 index 5df93d44..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/AsyncGenerator.js +++ /dev/null @@ -1,63 +0,0 @@ -import OverloadYield from "./OverloadYield.js"; -export default function AsyncGenerator(gen) { - var front, back; - function resume(key, arg) { - try { - var result = gen[key](arg), - value = result.value, - overloaded = value instanceof OverloadYield; - Promise.resolve(overloaded ? value.v : value).then(function (arg) { - if (overloaded) { - var nextKey = "return" === key ? "return" : "next"; - if (!value.k || arg.done) return resume(nextKey, arg); - arg = gen[nextKey](arg).value; - } - settle(result.done ? "return" : "normal", arg); - }, function (err) { - resume("throw", err); - }); - } catch (err) { - settle("throw", err); - } - } - function settle(type, value) { - switch (type) { - case "return": - front.resolve({ - value: value, - done: !0 - }); - break; - case "throw": - front.reject(value); - break; - default: - front.resolve({ - value: value, - done: !1 - }); - } - (front = front.next) ? resume(front.key, front.arg) : back = null; - } - this._invoke = function (key, arg) { - return new Promise(function (resolve, reject) { - var request = { - key: key, - arg: arg, - resolve: resolve, - reject: reject, - next: null - }; - back ? back = back.next = request : (front = back = request, resume(key, arg)); - }); - }, "function" != typeof gen["return"] && (this["return"] = void 0); -} -AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () { - return this; -}, AsyncGenerator.prototype.next = function (arg) { - return this._invoke("next", arg); -}, AsyncGenerator.prototype["throw"] = function (arg) { - return this._invoke("throw", arg); -}, AsyncGenerator.prototype["return"] = function (arg) { - return this._invoke("return", arg); -}; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/AwaitValue.js b/project starter code/node_modules/@babel/runtime/helpers/esm/AwaitValue.js deleted file mode 100644 index 5237e18f..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/AwaitValue.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _AwaitValue(value) { - this.wrapped = value; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/OverloadYield.js b/project starter code/node_modules/@babel/runtime/helpers/esm/OverloadYield.js deleted file mode 100644 index 0dd12e01..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/OverloadYield.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _OverloadYield(value, kind) { - this.v = value, this.k = kind; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js b/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js deleted file mode 100644 index 5137e85f..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecoratedDescriptor.js +++ /dev/null @@ -1,23 +0,0 @@ -export default function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { - var desc = {}; - Object.keys(descriptor).forEach(function (key) { - desc[key] = descriptor[key]; - }); - desc.enumerable = !!desc.enumerable; - desc.configurable = !!desc.configurable; - if ('value' in desc || desc.initializer) { - desc.writable = true; - } - desc = decorators.slice().reverse().reduce(function (desc, decorator) { - return decorator(target, property, desc) || desc; - }, desc); - if (context && desc.initializer !== void 0) { - desc.value = desc.initializer ? desc.initializer.call(context) : void 0; - desc.initializer = undefined; - } - if (desc.initializer === void 0) { - Object.defineProperty(target, property, desc); - desc = null; - } - return desc; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecs.js b/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecs.js deleted file mode 100644 index 84988df3..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecs.js +++ /dev/null @@ -1,235 +0,0 @@ -import _typeof from "./typeof.js"; -function old_createMetadataMethodsForProperty(metadataMap, kind, property, decoratorFinishedRef) { - return { - getMetadata: function getMetadata(key) { - old_assertNotFinished(decoratorFinishedRef, "getMetadata"), old_assertMetadataKey(key); - var metadataForKey = metadataMap[key]; - if (void 0 !== metadataForKey) if (1 === kind) { - var pub = metadataForKey["public"]; - if (void 0 !== pub) return pub[property]; - } else if (2 === kind) { - var priv = metadataForKey["private"]; - if (void 0 !== priv) return priv.get(property); - } else if (Object.hasOwnProperty.call(metadataForKey, "constructor")) return metadataForKey.constructor; - }, - setMetadata: function setMetadata(key, value) { - old_assertNotFinished(decoratorFinishedRef, "setMetadata"), old_assertMetadataKey(key); - var metadataForKey = metadataMap[key]; - if (void 0 === metadataForKey && (metadataForKey = metadataMap[key] = {}), 1 === kind) { - var pub = metadataForKey["public"]; - void 0 === pub && (pub = metadataForKey["public"] = {}), pub[property] = value; - } else if (2 === kind) { - var priv = metadataForKey.priv; - void 0 === priv && (priv = metadataForKey["private"] = new Map()), priv.set(property, value); - } else metadataForKey.constructor = value; - } - }; -} -function old_convertMetadataMapToFinal(obj, metadataMap) { - var parentMetadataMap = obj[Symbol.metadata || Symbol["for"]("Symbol.metadata")], - metadataKeys = Object.getOwnPropertySymbols(metadataMap); - if (0 !== metadataKeys.length) { - for (var i = 0; i < metadataKeys.length; i++) { - var key = metadataKeys[i], - metaForKey = metadataMap[key], - parentMetaForKey = parentMetadataMap ? parentMetadataMap[key] : null, - pub = metaForKey["public"], - parentPub = parentMetaForKey ? parentMetaForKey["public"] : null; - pub && parentPub && Object.setPrototypeOf(pub, parentPub); - var priv = metaForKey["private"]; - if (priv) { - var privArr = Array.from(priv.values()), - parentPriv = parentMetaForKey ? parentMetaForKey["private"] : null; - parentPriv && (privArr = privArr.concat(parentPriv)), metaForKey["private"] = privArr; - } - parentMetaForKey && Object.setPrototypeOf(metaForKey, parentMetaForKey); - } - parentMetadataMap && Object.setPrototypeOf(metadataMap, parentMetadataMap), obj[Symbol.metadata || Symbol["for"]("Symbol.metadata")] = metadataMap; - } -} -function old_createAddInitializerMethod(initializers, decoratorFinishedRef) { - return function (initializer) { - old_assertNotFinished(decoratorFinishedRef, "addInitializer"), old_assertCallable(initializer, "An initializer"), initializers.push(initializer); - }; -} -function old_memberDec(dec, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value) { - var kindStr; - switch (kind) { - case 1: - kindStr = "accessor"; - break; - case 2: - kindStr = "method"; - break; - case 3: - kindStr = "getter"; - break; - case 4: - kindStr = "setter"; - break; - default: - kindStr = "field"; - } - var metadataKind, - metadataName, - ctx = { - kind: kindStr, - name: isPrivate ? "#" + name : name, - isStatic: isStatic, - isPrivate: isPrivate - }, - decoratorFinishedRef = { - v: !1 - }; - if (0 !== kind && (ctx.addInitializer = old_createAddInitializerMethod(initializers, decoratorFinishedRef)), isPrivate) { - metadataKind = 2, metadataName = Symbol(name); - var access = {}; - 0 === kind ? (access.get = desc.get, access.set = desc.set) : 2 === kind ? access.get = function () { - return desc.value; - } : (1 !== kind && 3 !== kind || (access.get = function () { - return desc.get.call(this); - }), 1 !== kind && 4 !== kind || (access.set = function (v) { - desc.set.call(this, v); - })), ctx.access = access; - } else metadataKind = 1, metadataName = name; - try { - return dec(value, Object.assign(ctx, old_createMetadataMethodsForProperty(metadataMap, metadataKind, metadataName, decoratorFinishedRef))); - } finally { - decoratorFinishedRef.v = !0; - } -} -function old_assertNotFinished(decoratorFinishedRef, fnName) { - if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished"); -} -function old_assertMetadataKey(key) { - if ("symbol" != _typeof(key)) throw new TypeError("Metadata keys must be symbols, received: " + key); -} -function old_assertCallable(fn, hint) { - if ("function" != typeof fn) throw new TypeError(hint + " must be a function"); -} -function old_assertValidReturnValue(kind, value) { - var type = _typeof(value); - if (1 === kind) { - if ("object" !== type || null === value) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); - void 0 !== value.get && old_assertCallable(value.get, "accessor.get"), void 0 !== value.set && old_assertCallable(value.set, "accessor.set"), void 0 !== value.init && old_assertCallable(value.init, "accessor.init"), void 0 !== value.initializer && old_assertCallable(value.initializer, "accessor.initializer"); - } else if ("function" !== type) { - var hint; - throw hint = 0 === kind ? "field" : 10 === kind ? "class" : "method", new TypeError(hint + " decorators must return a function or void 0"); - } -} -function old_getInit(desc) { - var initializer; - return null == (initializer = desc.init) && (initializer = desc.initializer) && "undefined" != typeof console && console.warn(".initializer has been renamed to .init as of March 2022"), initializer; -} -function old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers) { - var desc, - initializer, - value, - newValue, - get, - set, - decs = decInfo[0]; - if (isPrivate ? desc = 0 === kind || 1 === kind ? { - get: decInfo[3], - set: decInfo[4] - } : 3 === kind ? { - get: decInfo[3] - } : 4 === kind ? { - set: decInfo[3] - } : { - value: decInfo[3] - } : 0 !== kind && (desc = Object.getOwnPropertyDescriptor(base, name)), 1 === kind ? value = { - get: desc.get, - set: desc.set - } : 2 === kind ? value = desc.value : 3 === kind ? value = desc.get : 4 === kind && (value = desc.set), "function" == typeof decs) void 0 !== (newValue = old_memberDec(decs, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value)) && (old_assertValidReturnValue(kind, newValue), 0 === kind ? initializer = newValue : 1 === kind ? (initializer = old_getInit(newValue), get = newValue.get || value.get, set = newValue.set || value.set, value = { - get: get, - set: set - }) : value = newValue);else for (var i = decs.length - 1; i >= 0; i--) { - var newInit; - if (void 0 !== (newValue = old_memberDec(decs[i], name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value))) old_assertValidReturnValue(kind, newValue), 0 === kind ? newInit = newValue : 1 === kind ? (newInit = old_getInit(newValue), get = newValue.get || value.get, set = newValue.set || value.set, value = { - get: get, - set: set - }) : value = newValue, void 0 !== newInit && (void 0 === initializer ? initializer = newInit : "function" == typeof initializer ? initializer = [initializer, newInit] : initializer.push(newInit)); - } - if (0 === kind || 1 === kind) { - if (void 0 === initializer) initializer = function initializer(instance, init) { - return init; - };else if ("function" != typeof initializer) { - var ownInitializers = initializer; - initializer = function initializer(instance, init) { - for (var value = init, i = 0; i < ownInitializers.length; i++) value = ownInitializers[i].call(instance, value); - return value; - }; - } else { - var originalInitializer = initializer; - initializer = function initializer(instance, init) { - return originalInitializer.call(instance, init); - }; - } - ret.push(initializer); - } - 0 !== kind && (1 === kind ? (desc.get = value.get, desc.set = value.set) : 2 === kind ? desc.value = value : 3 === kind ? desc.get = value : 4 === kind && (desc.set = value), isPrivate ? 1 === kind ? (ret.push(function (instance, args) { - return value.get.call(instance, args); - }), ret.push(function (instance, args) { - return value.set.call(instance, args); - })) : 2 === kind ? ret.push(value) : ret.push(function (instance, args) { - return value.call(instance, args); - }) : Object.defineProperty(base, name, desc)); -} -function old_applyMemberDecs(ret, Class, protoMetadataMap, staticMetadataMap, decInfos) { - for (var protoInitializers, staticInitializers, existingProtoNonFields = new Map(), existingStaticNonFields = new Map(), i = 0; i < decInfos.length; i++) { - var decInfo = decInfos[i]; - if (Array.isArray(decInfo)) { - var base, - metadataMap, - initializers, - kind = decInfo[1], - name = decInfo[2], - isPrivate = decInfo.length > 3, - isStatic = kind >= 5; - if (isStatic ? (base = Class, metadataMap = staticMetadataMap, 0 !== (kind -= 5) && (initializers = staticInitializers = staticInitializers || [])) : (base = Class.prototype, metadataMap = protoMetadataMap, 0 !== kind && (initializers = protoInitializers = protoInitializers || [])), 0 !== kind && !isPrivate) { - var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields, - existingKind = existingNonFields.get(name) || 0; - if (!0 === existingKind || 3 === existingKind && 4 !== kind || 4 === existingKind && 3 !== kind) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name); - !existingKind && kind > 2 ? existingNonFields.set(name, kind) : existingNonFields.set(name, !0); - } - old_applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers); - } - } - old_pushInitializers(ret, protoInitializers), old_pushInitializers(ret, staticInitializers); -} -function old_pushInitializers(ret, initializers) { - initializers && ret.push(function (instance) { - for (var i = 0; i < initializers.length; i++) initializers[i].call(instance); - return instance; - }); -} -function old_applyClassDecs(ret, targetClass, metadataMap, classDecs) { - if (classDecs.length > 0) { - for (var initializers = [], newClass = targetClass, name = targetClass.name, i = classDecs.length - 1; i >= 0; i--) { - var decoratorFinishedRef = { - v: !1 - }; - try { - var ctx = Object.assign({ - kind: "class", - name: name, - addInitializer: old_createAddInitializerMethod(initializers, decoratorFinishedRef) - }, old_createMetadataMethodsForProperty(metadataMap, 0, name, decoratorFinishedRef)), - nextNewClass = classDecs[i](newClass, ctx); - } finally { - decoratorFinishedRef.v = !0; - } - void 0 !== nextNewClass && (old_assertValidReturnValue(10, nextNewClass), newClass = nextNewClass); - } - ret.push(newClass, function () { - for (var i = 0; i < initializers.length; i++) initializers[i].call(newClass); - }); - } -} -export default function applyDecs(targetClass, memberDecs, classDecs) { - var ret = [], - staticMetadataMap = {}, - protoMetadataMap = {}; - return old_applyMemberDecs(ret, targetClass, protoMetadataMap, staticMetadataMap, memberDecs), old_convertMetadataMapToFinal(targetClass.prototype, protoMetadataMap), old_applyClassDecs(ret, targetClass, staticMetadataMap, classDecs), old_convertMetadataMapToFinal(targetClass, staticMetadataMap), ret; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecs2203.js b/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecs2203.js deleted file mode 100644 index a9f9e80a..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/applyDecs2203.js +++ /dev/null @@ -1,183 +0,0 @@ -import _typeof from "./typeof.js"; -function createAddInitializerMethod(initializers, decoratorFinishedRef) { - return function (initializer) { - assertNotFinished(decoratorFinishedRef, "addInitializer"), assertCallable(initializer, "An initializer"), initializers.push(initializer); - }; -} -function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, value) { - var kindStr; - switch (kind) { - case 1: - kindStr = "accessor"; - break; - case 2: - kindStr = "method"; - break; - case 3: - kindStr = "getter"; - break; - case 4: - kindStr = "setter"; - break; - default: - kindStr = "field"; - } - var get, - set, - ctx = { - kind: kindStr, - name: isPrivate ? "#" + name : name, - "static": isStatic, - "private": isPrivate - }, - decoratorFinishedRef = { - v: !1 - }; - 0 !== kind && (ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef)), 0 === kind ? isPrivate ? (get = desc.get, set = desc.set) : (get = function get() { - return this[name]; - }, set = function set(v) { - this[name] = v; - }) : 2 === kind ? get = function get() { - return desc.value; - } : (1 !== kind && 3 !== kind || (get = function get() { - return desc.get.call(this); - }), 1 !== kind && 4 !== kind || (set = function set(v) { - desc.set.call(this, v); - })), ctx.access = get && set ? { - get: get, - set: set - } : get ? { - get: get - } : { - set: set - }; - try { - return dec(value, ctx); - } finally { - decoratorFinishedRef.v = !0; - } -} -function assertNotFinished(decoratorFinishedRef, fnName) { - if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished"); -} -function assertCallable(fn, hint) { - if ("function" != typeof fn) throw new TypeError(hint + " must be a function"); -} -function assertValidReturnValue(kind, value) { - var type = _typeof(value); - if (1 === kind) { - if ("object" !== type || null === value) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); - void 0 !== value.get && assertCallable(value.get, "accessor.get"), void 0 !== value.set && assertCallable(value.set, "accessor.set"), void 0 !== value.init && assertCallable(value.init, "accessor.init"); - } else if ("function" !== type) { - var hint; - throw hint = 0 === kind ? "field" : 10 === kind ? "class" : "method", new TypeError(hint + " decorators must return a function or void 0"); - } -} -function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers) { - var desc, - init, - value, - newValue, - get, - set, - decs = decInfo[0]; - if (isPrivate ? desc = 0 === kind || 1 === kind ? { - get: decInfo[3], - set: decInfo[4] - } : 3 === kind ? { - get: decInfo[3] - } : 4 === kind ? { - set: decInfo[3] - } : { - value: decInfo[3] - } : 0 !== kind && (desc = Object.getOwnPropertyDescriptor(base, name)), 1 === kind ? value = { - get: desc.get, - set: desc.set - } : 2 === kind ? value = desc.value : 3 === kind ? value = desc.get : 4 === kind && (value = desc.set), "function" == typeof decs) void 0 !== (newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, value)) && (assertValidReturnValue(kind, newValue), 0 === kind ? init = newValue : 1 === kind ? (init = newValue.init, get = newValue.get || value.get, set = newValue.set || value.set, value = { - get: get, - set: set - }) : value = newValue);else for (var i = decs.length - 1; i >= 0; i--) { - var newInit; - if (void 0 !== (newValue = memberDec(decs[i], name, desc, initializers, kind, isStatic, isPrivate, value))) assertValidReturnValue(kind, newValue), 0 === kind ? newInit = newValue : 1 === kind ? (newInit = newValue.init, get = newValue.get || value.get, set = newValue.set || value.set, value = { - get: get, - set: set - }) : value = newValue, void 0 !== newInit && (void 0 === init ? init = newInit : "function" == typeof init ? init = [init, newInit] : init.push(newInit)); - } - if (0 === kind || 1 === kind) { - if (void 0 === init) init = function init(instance, _init) { - return _init; - };else if ("function" != typeof init) { - var ownInitializers = init; - init = function init(instance, _init2) { - for (var value = _init2, i = 0; i < ownInitializers.length; i++) value = ownInitializers[i].call(instance, value); - return value; - }; - } else { - var originalInitializer = init; - init = function init(instance, _init3) { - return originalInitializer.call(instance, _init3); - }; - } - ret.push(init); - } - 0 !== kind && (1 === kind ? (desc.get = value.get, desc.set = value.set) : 2 === kind ? desc.value = value : 3 === kind ? desc.get = value : 4 === kind && (desc.set = value), isPrivate ? 1 === kind ? (ret.push(function (instance, args) { - return value.get.call(instance, args); - }), ret.push(function (instance, args) { - return value.set.call(instance, args); - })) : 2 === kind ? ret.push(value) : ret.push(function (instance, args) { - return value.call(instance, args); - }) : Object.defineProperty(base, name, desc)); -} -function applyMemberDecs(ret, Class, decInfos) { - for (var protoInitializers, staticInitializers, existingProtoNonFields = new Map(), existingStaticNonFields = new Map(), i = 0; i < decInfos.length; i++) { - var decInfo = decInfos[i]; - if (Array.isArray(decInfo)) { - var base, - initializers, - kind = decInfo[1], - name = decInfo[2], - isPrivate = decInfo.length > 3, - isStatic = kind >= 5; - if (isStatic ? (base = Class, 0 !== (kind -= 5) && (initializers = staticInitializers = staticInitializers || [])) : (base = Class.prototype, 0 !== kind && (initializers = protoInitializers = protoInitializers || [])), 0 !== kind && !isPrivate) { - var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields, - existingKind = existingNonFields.get(name) || 0; - if (!0 === existingKind || 3 === existingKind && 4 !== kind || 4 === existingKind && 3 !== kind) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name); - !existingKind && kind > 2 ? existingNonFields.set(name, kind) : existingNonFields.set(name, !0); - } - applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers); - } - } - pushInitializers(ret, protoInitializers), pushInitializers(ret, staticInitializers); -} -function pushInitializers(ret, initializers) { - initializers && ret.push(function (instance) { - for (var i = 0; i < initializers.length; i++) initializers[i].call(instance); - return instance; - }); -} -function applyClassDecs(ret, targetClass, classDecs) { - if (classDecs.length > 0) { - for (var initializers = [], newClass = targetClass, name = targetClass.name, i = classDecs.length - 1; i >= 0; i--) { - var decoratorFinishedRef = { - v: !1 - }; - try { - var nextNewClass = classDecs[i](newClass, { - kind: "class", - name: name, - addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef) - }); - } finally { - decoratorFinishedRef.v = !0; - } - void 0 !== nextNewClass && (assertValidReturnValue(10, nextNewClass), newClass = nextNewClass); - } - ret.push(newClass, function () { - for (var i = 0; i < initializers.length; i++) initializers[i].call(newClass); - }); - } -} -export default function applyDecs2203(targetClass, memberDecs, classDecs) { - var ret = []; - return applyMemberDecs(ret, targetClass, memberDecs), applyClassDecs(ret, targetClass, classDecs), ret; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js b/project starter code/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js deleted file mode 100644 index 8a9fad8a..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function _arrayLikeToArray(arr, len) { - if (len == null || len > arr.length) len = arr.length; - for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; - return arr2; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js b/project starter code/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js deleted file mode 100644 index be734fc3..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js b/project starter code/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js deleted file mode 100644 index f7d8dc78..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js +++ /dev/null @@ -1,4 +0,0 @@ -import arrayLikeToArray from "./arrayLikeToArray.js"; -export default function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) return arrayLikeToArray(arr); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js b/project starter code/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js deleted file mode 100644 index 1f8fcf4b..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +++ /dev/null @@ -1,6 +0,0 @@ -export default function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - return self; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js b/project starter code/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js deleted file mode 100644 index d393d55b..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/asyncGeneratorDelegate.js +++ /dev/null @@ -1,23 +0,0 @@ -import OverloadYield from "./OverloadYield.js"; -export default function _asyncGeneratorDelegate(inner) { - var iter = {}, - waiting = !1; - function pump(key, value) { - return waiting = !0, value = new Promise(function (resolve) { - resolve(inner[key](value)); - }), { - done: !1, - value: new OverloadYield(value, 1) - }; - } - return iter["undefined" != typeof Symbol && Symbol.iterator || "@@iterator"] = function () { - return this; - }, iter.next = function (value) { - return waiting ? (waiting = !1, value) : pump("next", value); - }, "function" == typeof inner["throw"] && (iter["throw"] = function (value) { - if (waiting) throw waiting = !1, value; - return pump("throw", value); - }), "function" == typeof inner["return"] && (iter["return"] = function (value) { - return waiting ? (waiting = !1, value) : pump("return", value); - }), iter; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/asyncIterator.js b/project starter code/node_modules/@babel/runtime/helpers/esm/asyncIterator.js deleted file mode 100644 index ae8aa397..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/asyncIterator.js +++ /dev/null @@ -1,44 +0,0 @@ -export default function _asyncIterator(iterable) { - var method, - async, - sync, - retry = 2; - for ("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;) { - if (async && null != (method = iterable[async])) return method.call(iterable); - if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable)); - async = "@@asyncIterator", sync = "@@iterator"; - } - throw new TypeError("Object is not async iterable"); -} -function AsyncFromSyncIterator(s) { - function AsyncFromSyncIteratorContinuation(r) { - if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); - var done = r.done; - return Promise.resolve(r.value).then(function (value) { - return { - value: value, - done: done - }; - }); - } - return AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { - this.s = s, this.n = s.next; - }, AsyncFromSyncIterator.prototype = { - s: null, - n: null, - next: function next() { - return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); - }, - "return": function _return(value) { - var ret = this.s["return"]; - return void 0 === ret ? Promise.resolve({ - value: value, - done: !0 - }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments)); - }, - "throw": function _throw(value) { - var thr = this.s["return"]; - return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments)); - } - }, new AsyncFromSyncIterator(s); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js deleted file mode 100644 index c37aa2c7..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js +++ /dev/null @@ -1,30 +0,0 @@ -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { - try { - var info = gen[key](arg); - var value = info.value; - } catch (error) { - reject(error); - return; - } - if (info.done) { - resolve(value); - } else { - Promise.resolve(value).then(_next, _throw); - } -} -export default function _asyncToGenerator(fn) { - return function () { - var self = this, - args = arguments; - return new Promise(function (resolve, reject) { - var gen = fn.apply(self, args); - function _next(value) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); - } - function _throw(err) { - asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); - } - _next(undefined); - }); - }; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js deleted file mode 100644 index cfa05220..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/awaitAsyncGenerator.js +++ /dev/null @@ -1,4 +0,0 @@ -import OverloadYield from "./OverloadYield.js"; -export default function _awaitAsyncGenerator(value) { - return new OverloadYield(value, 0); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/checkInRHS.js b/project starter code/node_modules/@babel/runtime/helpers/esm/checkInRHS.js deleted file mode 100644 index 928d53d2..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/checkInRHS.js +++ /dev/null @@ -1,5 +0,0 @@ -import _typeof from "./typeof.js"; -export default function _checkInRHS(value) { - if (Object(value) !== value) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== value ? _typeof(value) : "null")); - return value; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/checkPrivateRedeclaration.js b/project starter code/node_modules/@babel/runtime/helpers/esm/checkPrivateRedeclaration.js deleted file mode 100644 index 99014036..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/checkPrivateRedeclaration.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function _checkPrivateRedeclaration(obj, privateCollection) { - if (privateCollection.has(obj)) { - throw new TypeError("Cannot initialize the same private elements twice on an object"); - } -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js deleted file mode 100644 index 68684f23..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorDestructureSet.js +++ /dev/null @@ -1,17 +0,0 @@ -export default function _classApplyDescriptorDestructureSet(receiver, descriptor) { - if (descriptor.set) { - if (!("__destrObj" in descriptor)) { - descriptor.__destrObj = { - set value(v) { - descriptor.set.call(receiver, v); - } - }; - } - return descriptor.__destrObj; - } else { - if (!descriptor.writable) { - throw new TypeError("attempted to set read only private field"); - } - return descriptor; - } -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js deleted file mode 100644 index 727e9e9b..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorGet.js +++ /dev/null @@ -1,6 +0,0 @@ -export default function _classApplyDescriptorGet(receiver, descriptor) { - if (descriptor.get) { - return descriptor.get.call(receiver); - } - return descriptor.value; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js deleted file mode 100644 index b4df6d30..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classApplyDescriptorSet.js +++ /dev/null @@ -1,10 +0,0 @@ -export default function _classApplyDescriptorSet(receiver, descriptor, value) { - if (descriptor.set) { - descriptor.set.call(receiver, value); - } else { - if (!descriptor.writable) { - throw new TypeError("attempted to set read only private field"); - } - descriptor.value = value; - } -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classCallCheck.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classCallCheck.js deleted file mode 100644 index 2f1738a3..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classCallCheck.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js deleted file mode 100644 index 098ed309..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticAccess.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function _classCheckPrivateStaticAccess(receiver, classConstructor) { - if (receiver !== classConstructor) { - throw new TypeError("Private static access of wrong provenance"); - } -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js deleted file mode 100644 index 0ef34b8d..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classCheckPrivateStaticFieldDescriptor.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function _classCheckPrivateStaticFieldDescriptor(descriptor, action) { - if (descriptor === undefined) { - throw new TypeError("attempted to " + action + " private static field before its declaration"); - } -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js deleted file mode 100644 index 1a8d71ba..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classExtractFieldDescriptor.js +++ /dev/null @@ -1,6 +0,0 @@ -export default function _classExtractFieldDescriptor(receiver, privateMap, action) { - if (!privateMap.has(receiver)) { - throw new TypeError("attempted to " + action + " private field on non-instance"); - } - return privateMap.get(receiver); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js deleted file mode 100644 index 46eea93a..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classNameTDZError.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _classNameTDZError(name) { - throw new ReferenceError("Class \"" + name + "\" cannot be referenced in computed property keys."); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js deleted file mode 100644 index fb588336..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldDestructureSet.js +++ /dev/null @@ -1,6 +0,0 @@ -import classApplyDescriptorDestructureSet from "./classApplyDescriptorDestructureSet.js"; -import classExtractFieldDescriptor from "./classExtractFieldDescriptor.js"; -export default function _classPrivateFieldDestructureSet(receiver, privateMap) { - var descriptor = classExtractFieldDescriptor(receiver, privateMap, "set"); - return classApplyDescriptorDestructureSet(receiver, descriptor); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js deleted file mode 100644 index 53cd1379..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldGet.js +++ /dev/null @@ -1,6 +0,0 @@ -import classApplyDescriptorGet from "./classApplyDescriptorGet.js"; -import classExtractFieldDescriptor from "./classExtractFieldDescriptor.js"; -export default function _classPrivateFieldGet(receiver, privateMap) { - var descriptor = classExtractFieldDescriptor(receiver, privateMap, "get"); - return classApplyDescriptorGet(receiver, descriptor); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldInitSpec.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldInitSpec.js deleted file mode 100644 index 2253dd84..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldInitSpec.js +++ /dev/null @@ -1,5 +0,0 @@ -import checkPrivateRedeclaration from "./checkPrivateRedeclaration.js"; -export default function _classPrivateFieldInitSpec(obj, privateMap, value) { - checkPrivateRedeclaration(obj, privateMap); - privateMap.set(obj, value); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js deleted file mode 100644 index 09e93304..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseBase.js +++ /dev/null @@ -1,6 +0,0 @@ -export default function _classPrivateFieldBase(receiver, privateKey) { - if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { - throw new TypeError("attempted to use private field on non-instance"); - } - return receiver; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js deleted file mode 100644 index 5b7e5ac0..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldLooseKey.js +++ /dev/null @@ -1,4 +0,0 @@ -var id = 0; -export default function _classPrivateFieldKey(name) { - return "__private_" + id++ + "_" + name; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js deleted file mode 100644 index ad91be44..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateFieldSet.js +++ /dev/null @@ -1,7 +0,0 @@ -import classApplyDescriptorSet from "./classApplyDescriptorSet.js"; -import classExtractFieldDescriptor from "./classExtractFieldDescriptor.js"; -export default function _classPrivateFieldSet(receiver, privateMap, value) { - var descriptor = classExtractFieldDescriptor(receiver, privateMap, "set"); - classApplyDescriptorSet(receiver, descriptor, value); - return value; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js deleted file mode 100644 index f32a3da8..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodGet.js +++ /dev/null @@ -1,6 +0,0 @@ -export default function _classPrivateMethodGet(receiver, privateSet, fn) { - if (!privateSet.has(receiver)) { - throw new TypeError("attempted to get private field on non-instance"); - } - return fn; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js deleted file mode 100644 index 18d12915..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodInitSpec.js +++ /dev/null @@ -1,5 +0,0 @@ -import checkPrivateRedeclaration from "./checkPrivateRedeclaration.js"; -export default function _classPrivateMethodInitSpec(obj, privateSet) { - checkPrivateRedeclaration(obj, privateSet); - privateSet.add(obj); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js deleted file mode 100644 index 2bbaf3a7..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classPrivateMethodSet.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _classPrivateMethodSet() { - throw new TypeError("attempted to reassign private method"); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js deleted file mode 100644 index 77afcfb1..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldDestructureSet.js +++ /dev/null @@ -1,8 +0,0 @@ -import classApplyDescriptorDestructureSet from "./classApplyDescriptorDestructureSet.js"; -import classCheckPrivateStaticAccess from "./classCheckPrivateStaticAccess.js"; -import classCheckPrivateStaticFieldDescriptor from "./classCheckPrivateStaticFieldDescriptor.js"; -export default function _classStaticPrivateFieldDestructureSet(receiver, classConstructor, descriptor) { - classCheckPrivateStaticAccess(receiver, classConstructor); - classCheckPrivateStaticFieldDescriptor(descriptor, "set"); - return classApplyDescriptorDestructureSet(receiver, descriptor); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js deleted file mode 100644 index d253d311..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecGet.js +++ /dev/null @@ -1,8 +0,0 @@ -import classApplyDescriptorGet from "./classApplyDescriptorGet.js"; -import classCheckPrivateStaticAccess from "./classCheckPrivateStaticAccess.js"; -import classCheckPrivateStaticFieldDescriptor from "./classCheckPrivateStaticFieldDescriptor.js"; -export default function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) { - classCheckPrivateStaticAccess(receiver, classConstructor); - classCheckPrivateStaticFieldDescriptor(descriptor, "get"); - return classApplyDescriptorGet(receiver, descriptor); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js deleted file mode 100644 index b0b0cc64..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateFieldSpecSet.js +++ /dev/null @@ -1,9 +0,0 @@ -import classApplyDescriptorSet from "./classApplyDescriptorSet.js"; -import classCheckPrivateStaticAccess from "./classCheckPrivateStaticAccess.js"; -import classCheckPrivateStaticFieldDescriptor from "./classCheckPrivateStaticFieldDescriptor.js"; -export default function _classStaticPrivateFieldSpecSet(receiver, classConstructor, descriptor, value) { - classCheckPrivateStaticAccess(receiver, classConstructor); - classCheckPrivateStaticFieldDescriptor(descriptor, "set"); - classApplyDescriptorSet(receiver, descriptor, value); - return value; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js deleted file mode 100644 index fddc7b2d..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodGet.js +++ /dev/null @@ -1,5 +0,0 @@ -import classCheckPrivateStaticAccess from "./classCheckPrivateStaticAccess.js"; -export default function _classStaticPrivateMethodGet(receiver, classConstructor, method) { - classCheckPrivateStaticAccess(receiver, classConstructor); - return method; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js b/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js deleted file mode 100644 index d5ab60a9..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/classStaticPrivateMethodSet.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _classStaticPrivateMethodSet() { - throw new TypeError("attempted to set read only static private field"); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/construct.js b/project starter code/node_modules/@babel/runtime/helpers/esm/construct.js deleted file mode 100644 index 3860bdd0..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/construct.js +++ /dev/null @@ -1,17 +0,0 @@ -import setPrototypeOf from "./setPrototypeOf.js"; -import isNativeReflectConstruct from "./isNativeReflectConstruct.js"; -export default function _construct(Parent, args, Class) { - if (isNativeReflectConstruct()) { - _construct = Reflect.construct.bind(); - } else { - _construct = function _construct(Parent, args, Class) { - var a = [null]; - a.push.apply(a, args); - var Constructor = Function.bind.apply(Parent, a); - var instance = new Constructor(); - if (Class) setPrototypeOf(instance, Class.prototype); - return instance; - }; - } - return _construct.apply(null, arguments); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/createClass.js b/project starter code/node_modules/@babel/runtime/helpers/esm/createClass.js deleted file mode 100644 index bbacdfec..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/createClass.js +++ /dev/null @@ -1,18 +0,0 @@ -import toPropertyKey from "./toPropertyKey.js"; -function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor); - } -} -export default function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - Object.defineProperty(Constructor, "prototype", { - writable: false - }); - return Constructor; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js b/project starter code/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js deleted file mode 100644 index 5e0e0f19..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js +++ /dev/null @@ -1,52 +0,0 @@ -import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; -export default function _createForOfIteratorHelper(o, allowArrayLike) { - var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; - if (!it) { - if (Array.isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { - if (it) o = it; - var i = 0; - var F = function F() {}; - return { - s: F, - n: function n() { - if (i >= o.length) return { - done: true - }; - return { - done: false, - value: o[i++] - }; - }, - e: function e(_e) { - throw _e; - }, - f: F - }; - } - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); - } - var normalCompletion = true, - didErr = false, - err; - return { - s: function s() { - it = it.call(o); - }, - n: function n() { - var step = it.next(); - normalCompletion = step.done; - return step; - }, - e: function e(_e2) { - didErr = true; - err = _e2; - }, - f: function f() { - try { - if (!normalCompletion && it["return"] != null) it["return"](); - } finally { - if (didErr) throw err; - } - } - }; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js b/project starter code/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js deleted file mode 100644 index 043857dc..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelperLoose.js +++ /dev/null @@ -1,19 +0,0 @@ -import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; -export default function _createForOfIteratorHelperLoose(o, allowArrayLike) { - var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; - if (it) return (it = it.call(o)).next.bind(it); - if (Array.isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { - if (it) o = it; - var i = 0; - return function () { - if (i >= o.length) return { - done: true - }; - return { - done: false, - value: o[i++] - }; - }; - } - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/createSuper.js b/project starter code/node_modules/@babel/runtime/helpers/esm/createSuper.js deleted file mode 100644 index 7c962976..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/createSuper.js +++ /dev/null @@ -1,17 +0,0 @@ -import getPrototypeOf from "./getPrototypeOf.js"; -import isNativeReflectConstruct from "./isNativeReflectConstruct.js"; -import possibleConstructorReturn from "./possibleConstructorReturn.js"; -export default function _createSuper(Derived) { - var hasNativeReflectConstruct = isNativeReflectConstruct(); - return function _createSuperInternal() { - var Super = getPrototypeOf(Derived), - result; - if (hasNativeReflectConstruct) { - var NewTarget = getPrototypeOf(this).constructor; - result = Reflect.construct(Super, arguments, NewTarget); - } else { - result = Super.apply(this, arguments); - } - return possibleConstructorReturn(this, result); - }; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/decorate.js b/project starter code/node_modules/@babel/runtime/helpers/esm/decorate.js deleted file mode 100644 index e511dfe6..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/decorate.js +++ /dev/null @@ -1,342 +0,0 @@ -import toArray from "./toArray.js"; -import toPropertyKey from "./toPropertyKey.js"; -export default function _decorate(decorators, factory, superClass, mixins) { - var api = _getDecoratorsApi(); - if (mixins) { - for (var i = 0; i < mixins.length; i++) { - api = mixins[i](api); - } - } - var r = factory(function initialize(O) { - api.initializeInstanceElements(O, decorated.elements); - }, superClass); - var decorated = api.decorateClass(_coalesceClassElements(r.d.map(_createElementDescriptor)), decorators); - api.initializeClassElements(r.F, decorated.elements); - return api.runClassFinishers(r.F, decorated.finishers); -} -function _getDecoratorsApi() { - _getDecoratorsApi = function _getDecoratorsApi() { - return api; - }; - var api = { - elementsDefinitionOrder: [["method"], ["field"]], - initializeInstanceElements: function initializeInstanceElements(O, elements) { - ["method", "field"].forEach(function (kind) { - elements.forEach(function (element) { - if (element.kind === kind && element.placement === "own") { - this.defineClassElement(O, element); - } - }, this); - }, this); - }, - initializeClassElements: function initializeClassElements(F, elements) { - var proto = F.prototype; - ["method", "field"].forEach(function (kind) { - elements.forEach(function (element) { - var placement = element.placement; - if (element.kind === kind && (placement === "static" || placement === "prototype")) { - var receiver = placement === "static" ? F : proto; - this.defineClassElement(receiver, element); - } - }, this); - }, this); - }, - defineClassElement: function defineClassElement(receiver, element) { - var descriptor = element.descriptor; - if (element.kind === "field") { - var initializer = element.initializer; - descriptor = { - enumerable: descriptor.enumerable, - writable: descriptor.writable, - configurable: descriptor.configurable, - value: initializer === void 0 ? void 0 : initializer.call(receiver) - }; - } - Object.defineProperty(receiver, element.key, descriptor); - }, - decorateClass: function decorateClass(elements, decorators) { - var newElements = []; - var finishers = []; - var placements = { - "static": [], - prototype: [], - own: [] - }; - elements.forEach(function (element) { - this.addElementPlacement(element, placements); - }, this); - elements.forEach(function (element) { - if (!_hasDecorators(element)) return newElements.push(element); - var elementFinishersExtras = this.decorateElement(element, placements); - newElements.push(elementFinishersExtras.element); - newElements.push.apply(newElements, elementFinishersExtras.extras); - finishers.push.apply(finishers, elementFinishersExtras.finishers); - }, this); - if (!decorators) { - return { - elements: newElements, - finishers: finishers - }; - } - var result = this.decorateConstructor(newElements, decorators); - finishers.push.apply(finishers, result.finishers); - result.finishers = finishers; - return result; - }, - addElementPlacement: function addElementPlacement(element, placements, silent) { - var keys = placements[element.placement]; - if (!silent && keys.indexOf(element.key) !== -1) { - throw new TypeError("Duplicated element (" + element.key + ")"); - } - keys.push(element.key); - }, - decorateElement: function decorateElement(element, placements) { - var extras = []; - var finishers = []; - for (var decorators = element.decorators, i = decorators.length - 1; i >= 0; i--) { - var keys = placements[element.placement]; - keys.splice(keys.indexOf(element.key), 1); - var elementObject = this.fromElementDescriptor(element); - var elementFinisherExtras = this.toElementFinisherExtras((0, decorators[i])(elementObject) || elementObject); - element = elementFinisherExtras.element; - this.addElementPlacement(element, placements); - if (elementFinisherExtras.finisher) { - finishers.push(elementFinisherExtras.finisher); - } - var newExtras = elementFinisherExtras.extras; - if (newExtras) { - for (var j = 0; j < newExtras.length; j++) { - this.addElementPlacement(newExtras[j], placements); - } - extras.push.apply(extras, newExtras); - } - } - return { - element: element, - finishers: finishers, - extras: extras - }; - }, - decorateConstructor: function decorateConstructor(elements, decorators) { - var finishers = []; - for (var i = decorators.length - 1; i >= 0; i--) { - var obj = this.fromClassDescriptor(elements); - var elementsAndFinisher = this.toClassDescriptor((0, decorators[i])(obj) || obj); - if (elementsAndFinisher.finisher !== undefined) { - finishers.push(elementsAndFinisher.finisher); - } - if (elementsAndFinisher.elements !== undefined) { - elements = elementsAndFinisher.elements; - for (var j = 0; j < elements.length - 1; j++) { - for (var k = j + 1; k < elements.length; k++) { - if (elements[j].key === elements[k].key && elements[j].placement === elements[k].placement) { - throw new TypeError("Duplicated element (" + elements[j].key + ")"); - } - } - } - } - } - return { - elements: elements, - finishers: finishers - }; - }, - fromElementDescriptor: function fromElementDescriptor(element) { - var obj = { - kind: element.kind, - key: element.key, - placement: element.placement, - descriptor: element.descriptor - }; - var desc = { - value: "Descriptor", - configurable: true - }; - Object.defineProperty(obj, Symbol.toStringTag, desc); - if (element.kind === "field") obj.initializer = element.initializer; - return obj; - }, - toElementDescriptors: function toElementDescriptors(elementObjects) { - if (elementObjects === undefined) return; - return toArray(elementObjects).map(function (elementObject) { - var element = this.toElementDescriptor(elementObject); - this.disallowProperty(elementObject, "finisher", "An element descriptor"); - this.disallowProperty(elementObject, "extras", "An element descriptor"); - return element; - }, this); - }, - toElementDescriptor: function toElementDescriptor(elementObject) { - var kind = String(elementObject.kind); - if (kind !== "method" && kind !== "field") { - throw new TypeError('An element descriptor\'s .kind property must be either "method" or' + ' "field", but a decorator created an element descriptor with' + ' .kind "' + kind + '"'); - } - var key = toPropertyKey(elementObject.key); - var placement = String(elementObject.placement); - if (placement !== "static" && placement !== "prototype" && placement !== "own") { - throw new TypeError('An element descriptor\'s .placement property must be one of "static",' + ' "prototype" or "own", but a decorator created an element descriptor' + ' with .placement "' + placement + '"'); - } - var descriptor = elementObject.descriptor; - this.disallowProperty(elementObject, "elements", "An element descriptor"); - var element = { - kind: kind, - key: key, - placement: placement, - descriptor: Object.assign({}, descriptor) - }; - if (kind !== "field") { - this.disallowProperty(elementObject, "initializer", "A method descriptor"); - } else { - this.disallowProperty(descriptor, "get", "The property descriptor of a field descriptor"); - this.disallowProperty(descriptor, "set", "The property descriptor of a field descriptor"); - this.disallowProperty(descriptor, "value", "The property descriptor of a field descriptor"); - element.initializer = elementObject.initializer; - } - return element; - }, - toElementFinisherExtras: function toElementFinisherExtras(elementObject) { - var element = this.toElementDescriptor(elementObject); - var finisher = _optionalCallableProperty(elementObject, "finisher"); - var extras = this.toElementDescriptors(elementObject.extras); - return { - element: element, - finisher: finisher, - extras: extras - }; - }, - fromClassDescriptor: function fromClassDescriptor(elements) { - var obj = { - kind: "class", - elements: elements.map(this.fromElementDescriptor, this) - }; - var desc = { - value: "Descriptor", - configurable: true - }; - Object.defineProperty(obj, Symbol.toStringTag, desc); - return obj; - }, - toClassDescriptor: function toClassDescriptor(obj) { - var kind = String(obj.kind); - if (kind !== "class") { - throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator' + ' created a class descriptor with .kind "' + kind + '"'); - } - this.disallowProperty(obj, "key", "A class descriptor"); - this.disallowProperty(obj, "placement", "A class descriptor"); - this.disallowProperty(obj, "descriptor", "A class descriptor"); - this.disallowProperty(obj, "initializer", "A class descriptor"); - this.disallowProperty(obj, "extras", "A class descriptor"); - var finisher = _optionalCallableProperty(obj, "finisher"); - var elements = this.toElementDescriptors(obj.elements); - return { - elements: elements, - finisher: finisher - }; - }, - runClassFinishers: function runClassFinishers(constructor, finishers) { - for (var i = 0; i < finishers.length; i++) { - var newConstructor = (0, finishers[i])(constructor); - if (newConstructor !== undefined) { - if (typeof newConstructor !== "function") { - throw new TypeError("Finishers must return a constructor."); - } - constructor = newConstructor; - } - } - return constructor; - }, - disallowProperty: function disallowProperty(obj, name, objectType) { - if (obj[name] !== undefined) { - throw new TypeError(objectType + " can't have a ." + name + " property."); - } - } - }; - return api; -} -function _createElementDescriptor(def) { - var key = toPropertyKey(def.key); - var descriptor; - if (def.kind === "method") { - descriptor = { - value: def.value, - writable: true, - configurable: true, - enumerable: false - }; - } else if (def.kind === "get") { - descriptor = { - get: def.value, - configurable: true, - enumerable: false - }; - } else if (def.kind === "set") { - descriptor = { - set: def.value, - configurable: true, - enumerable: false - }; - } else if (def.kind === "field") { - descriptor = { - configurable: true, - writable: true, - enumerable: true - }; - } - var element = { - kind: def.kind === "field" ? "field" : "method", - key: key, - placement: def["static"] ? "static" : def.kind === "field" ? "own" : "prototype", - descriptor: descriptor - }; - if (def.decorators) element.decorators = def.decorators; - if (def.kind === "field") element.initializer = def.value; - return element; -} -function _coalesceGetterSetter(element, other) { - if (element.descriptor.get !== undefined) { - other.descriptor.get = element.descriptor.get; - } else { - other.descriptor.set = element.descriptor.set; - } -} -function _coalesceClassElements(elements) { - var newElements = []; - var isSameElement = function isSameElement(other) { - return other.kind === "method" && other.key === element.key && other.placement === element.placement; - }; - for (var i = 0; i < elements.length; i++) { - var element = elements[i]; - var other; - if (element.kind === "method" && (other = newElements.find(isSameElement))) { - if (_isDataDescriptor(element.descriptor) || _isDataDescriptor(other.descriptor)) { - if (_hasDecorators(element) || _hasDecorators(other)) { - throw new ReferenceError("Duplicated methods (" + element.key + ") can't be decorated."); - } - other.descriptor = element.descriptor; - } else { - if (_hasDecorators(element)) { - if (_hasDecorators(other)) { - throw new ReferenceError("Decorators can't be placed on different accessors with for " + "the same property (" + element.key + ")."); - } - other.decorators = element.decorators; - } - _coalesceGetterSetter(element, other); - } - } else { - newElements.push(element); - } - } - return newElements; -} -function _hasDecorators(element) { - return element.decorators && element.decorators.length; -} -function _isDataDescriptor(desc) { - return desc !== undefined && !(desc.value === undefined && desc.writable === undefined); -} -function _optionalCallableProperty(obj, name) { - var value = obj[name]; - if (value !== undefined && typeof value !== "function") { - throw new TypeError("Expected '" + name + "' to be a function"); - } - return value; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/defaults.js b/project starter code/node_modules/@babel/runtime/helpers/esm/defaults.js deleted file mode 100644 index 9e59e9a8..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/defaults.js +++ /dev/null @@ -1,11 +0,0 @@ -export default function _defaults(obj, defaults) { - var keys = Object.getOwnPropertyNames(defaults); - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var value = Object.getOwnPropertyDescriptor(defaults, key); - if (value && value.configurable && obj[key] === undefined) { - Object.defineProperty(obj, key, value); - } - } - return obj; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/defineAccessor.js b/project starter code/node_modules/@babel/runtime/helpers/esm/defineAccessor.js deleted file mode 100644 index 154271d1..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/defineAccessor.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function _defineAccessor(type, obj, key, fn) { - var desc = { - configurable: !0, - enumerable: !0 - }; - return desc[type] = fn, Object.defineProperty(obj, key, desc); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js b/project starter code/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js deleted file mode 100644 index 0c04128a..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/defineEnumerableProperties.js +++ /dev/null @@ -1,19 +0,0 @@ -export default function _defineEnumerableProperties(obj, descs) { - for (var key in descs) { - var desc = descs[key]; - desc.configurable = desc.enumerable = true; - if ("value" in desc) desc.writable = true; - Object.defineProperty(obj, key, desc); - } - if (Object.getOwnPropertySymbols) { - var objectSymbols = Object.getOwnPropertySymbols(descs); - for (var i = 0; i < objectSymbols.length; i++) { - var sym = objectSymbols[i]; - var desc = descs[sym]; - desc.configurable = desc.enumerable = true; - if ("value" in desc) desc.writable = true; - Object.defineProperty(obj, sym, desc); - } - } - return obj; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/defineProperty.js b/project starter code/node_modules/@babel/runtime/helpers/esm/defineProperty.js deleted file mode 100644 index 56c06a25..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/defineProperty.js +++ /dev/null @@ -1,15 +0,0 @@ -import toPropertyKey from "./toPropertyKey.js"; -export default function _defineProperty(obj, key, value) { - key = toPropertyKey(key); - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - return obj; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/extends.js b/project starter code/node_modules/@babel/runtime/helpers/esm/extends.js deleted file mode 100644 index ab17131f..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/extends.js +++ /dev/null @@ -1,14 +0,0 @@ -export default function _extends() { - _extends = Object.assign ? Object.assign.bind() : function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } - return target; - }; - return _extends.apply(this, arguments); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/get.js b/project starter code/node_modules/@babel/runtime/helpers/esm/get.js deleted file mode 100644 index 0705d5fc..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/get.js +++ /dev/null @@ -1,17 +0,0 @@ -import superPropBase from "./superPropBase.js"; -export default function _get() { - if (typeof Reflect !== "undefined" && Reflect.get) { - _get = Reflect.get.bind(); - } else { - _get = function _get(target, property, receiver) { - var base = superPropBase(target, property); - if (!base) return; - var desc = Object.getOwnPropertyDescriptor(base, property); - if (desc.get) { - return desc.get.call(arguments.length < 3 ? target : receiver); - } - return desc.value; - }; - } - return _get.apply(this, arguments); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js b/project starter code/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js deleted file mode 100644 index e9bb1d54..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js +++ /dev/null @@ -1,6 +0,0 @@ -export default function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }; - return _getPrototypeOf(o); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/identity.js b/project starter code/node_modules/@babel/runtime/helpers/esm/identity.js deleted file mode 100644 index a1e7e4cd..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/identity.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _identity(x) { - return x; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/inherits.js b/project starter code/node_modules/@babel/runtime/helpers/esm/inherits.js deleted file mode 100644 index 0b0a0eac..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/inherits.js +++ /dev/null @@ -1,17 +0,0 @@ -import setPrototypeOf from "./setPrototypeOf.js"; -export default function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); - } - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } - }); - Object.defineProperty(subClass, "prototype", { - writable: false - }); - if (superClass) setPrototypeOf(subClass, superClass); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js b/project starter code/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js deleted file mode 100644 index 90bb7965..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +++ /dev/null @@ -1,6 +0,0 @@ -import setPrototypeOf from "./setPrototypeOf.js"; -export default function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - setPrototypeOf(subClass, superClass); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js b/project starter code/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js deleted file mode 100644 index 26fdea08..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/initializerDefineProperty.js +++ /dev/null @@ -1,9 +0,0 @@ -export default function _initializerDefineProperty(target, property, descriptor, context) { - if (!descriptor) return; - Object.defineProperty(target, property, { - enumerable: descriptor.enumerable, - configurable: descriptor.configurable, - writable: descriptor.writable, - value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 - }); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js b/project starter code/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js deleted file mode 100644 index 30d518cf..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/initializerWarningHelper.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _initializerWarningHelper(descriptor, context) { - throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/instanceof.js b/project starter code/node_modules/@babel/runtime/helpers/esm/instanceof.js deleted file mode 100644 index 8c43b717..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/instanceof.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function _instanceof(left, right) { - if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { - return !!right[Symbol.hasInstance](left); - } else { - return left instanceof right; - } -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js b/project starter code/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js deleted file mode 100644 index c2df7b64..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/interopRequireDefault.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { - "default": obj - }; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js b/project starter code/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js deleted file mode 100644 index 6ec63091..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/interopRequireWildcard.js +++ /dev/null @@ -1,40 +0,0 @@ -import _typeof from "./typeof.js"; -function _getRequireWildcardCache(nodeInterop) { - if (typeof WeakMap !== "function") return null; - var cacheBabelInterop = new WeakMap(); - var cacheNodeInterop = new WeakMap(); - return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { - return nodeInterop ? cacheNodeInterop : cacheBabelInterop; - })(nodeInterop); -} -export default function _interopRequireWildcard(obj, nodeInterop) { - if (!nodeInterop && obj && obj.__esModule) { - return obj; - } - if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { - return { - "default": obj - }; - } - var cache = _getRequireWildcardCache(nodeInterop); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; - if (desc && (desc.get || desc.set)) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - newObj["default"] = obj; - if (cache) { - cache.set(obj, newObj); - } - return newObj; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js b/project starter code/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js deleted file mode 100644 index 7b1bc821..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/isNativeFunction.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _isNativeFunction(fn) { - return Function.toString.call(fn).indexOf("[native code]") !== -1; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js b/project starter code/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js deleted file mode 100644 index 61840807..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js +++ /dev/null @@ -1,11 +0,0 @@ -export default function _isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) return false; - if (Reflect.construct.sham) return false; - if (typeof Proxy === "function") return true; - try { - Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); - return true; - } catch (e) { - return false; - } -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArray.js b/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArray.js deleted file mode 100644 index cfe9fbd3..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArray.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _iterableToArray(iter) { - if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js b/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js deleted file mode 100644 index 5c31a593..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js +++ /dev/null @@ -1,27 +0,0 @@ -export default function _iterableToArrayLimit(arr, i) { - var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; - if (null != _i) { - var _s, - _e, - _x, - _r, - _arr = [], - _n = !0, - _d = !1; - try { - if (_x = (_i = _i.call(arr)).next, 0 === i) { - if (Object(_i) !== _i) return; - _n = !1; - } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); - } catch (err) { - _d = !0, _e = err; - } finally { - try { - if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; - } finally { - if (_d) throw _e; - } - } - return _arr; - } -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimitLoose.js b/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimitLoose.js deleted file mode 100644 index 9237c307..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimitLoose.js +++ /dev/null @@ -1,9 +0,0 @@ -export default function _iterableToArrayLimitLoose(arr, i) { - var _i = arr && ("undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]); - if (null != _i) { - var _s, - _arr = []; - for (_i = _i.call(arr); arr.length < i && !(_s = _i.next()).done;) _arr.push(_s.value); - return _arr; - } -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/jsx.js b/project starter code/node_modules/@babel/runtime/helpers/esm/jsx.js deleted file mode 100644 index 742afd5c..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/jsx.js +++ /dev/null @@ -1,21 +0,0 @@ -var REACT_ELEMENT_TYPE; -export default function _createRawReactElement(type, props, key, children) { - REACT_ELEMENT_TYPE || (REACT_ELEMENT_TYPE = "function" == typeof Symbol && Symbol["for"] && Symbol["for"]("react.element") || 60103); - var defaultProps = type && type.defaultProps, - childrenLength = arguments.length - 3; - if (props || 0 === childrenLength || (props = { - children: void 0 - }), 1 === childrenLength) props.children = children;else if (childrenLength > 1) { - for (var childArray = new Array(childrenLength), i = 0; i < childrenLength; i++) childArray[i] = arguments[i + 3]; - props.children = childArray; - } - if (props && defaultProps) for (var propName in defaultProps) void 0 === props[propName] && (props[propName] = defaultProps[propName]);else props || (props = defaultProps || {}); - return { - $$typeof: REACT_ELEMENT_TYPE, - type: type, - key: void 0 === key ? null : "" + key, - ref: null, - props: props, - _owner: null - }; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js b/project starter code/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js deleted file mode 100644 index 38fd78fb..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/maybeArrayLike.js +++ /dev/null @@ -1,8 +0,0 @@ -import arrayLikeToArray from "./arrayLikeToArray.js"; -export default function _maybeArrayLike(next, arr, i) { - if (arr && !Array.isArray(arr) && typeof arr.length === "number") { - var len = arr.length; - return arrayLikeToArray(arr, i !== void 0 && i < len ? i : len); - } - return next(arr, i); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js b/project starter code/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js deleted file mode 100644 index d6cd8643..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/newArrowCheck.js +++ /dev/null @@ -1,5 +0,0 @@ -export default function _newArrowCheck(innerThis, boundThis) { - if (innerThis !== boundThis) { - throw new TypeError("Cannot instantiate an arrow function"); - } -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js b/project starter code/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js deleted file mode 100644 index b349d006..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js b/project starter code/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js deleted file mode 100644 index 82d82961..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js b/project starter code/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js deleted file mode 100644 index 251b8595..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/objectDestructuringEmpty.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _objectDestructuringEmpty(obj) { - if (obj == null) throw new TypeError("Cannot destructure " + obj); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/objectSpread.js b/project starter code/node_modules/@babel/runtime/helpers/esm/objectSpread.js deleted file mode 100644 index a4e05e56..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/objectSpread.js +++ /dev/null @@ -1,16 +0,0 @@ -import defineProperty from "./defineProperty.js"; -export default function _objectSpread(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? Object(arguments[i]) : {}; - var ownKeys = Object.keys(source); - if (typeof Object.getOwnPropertySymbols === 'function') { - ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function (sym) { - return Object.getOwnPropertyDescriptor(source, sym).enumerable; - })); - } - ownKeys.forEach(function (key) { - defineProperty(target, key, source[key]); - }); - } - return target; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/objectSpread2.js b/project starter code/node_modules/@babel/runtime/helpers/esm/objectSpread2.js deleted file mode 100644 index 7d69accd..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/objectSpread2.js +++ /dev/null @@ -1,22 +0,0 @@ -import defineProperty from "./defineProperty.js"; -function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - enumerableOnly && (symbols = symbols.filter(function (sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - })), keys.push.apply(keys, symbols); - } - return keys; -} -export default function _objectSpread2(target) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] ? arguments[i] : {}; - i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { - defineProperty(target, key, source[key]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { - Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); - }); - } - return target; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js b/project starter code/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js deleted file mode 100644 index 36804a39..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js +++ /dev/null @@ -1,16 +0,0 @@ -import objectWithoutPropertiesLoose from "./objectWithoutPropertiesLoose.js"; -export default function _objectWithoutProperties(source, excluded) { - if (source == null) return {}; - var target = objectWithoutPropertiesLoose(source, excluded); - var key, i; - if (Object.getOwnPropertySymbols) { - var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for (i = 0; i < sourceSymbolKeys.length; i++) { - key = sourceSymbolKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; - target[key] = source[key]; - } - } - return target; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js b/project starter code/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js deleted file mode 100644 index 4b308bde..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +++ /dev/null @@ -1,12 +0,0 @@ -export default function _objectWithoutPropertiesLoose(source, excluded) { - if (source == null) return {}; - var target = {}; - var sourceKeys = Object.keys(source); - var key, i; - for (i = 0; i < sourceKeys.length; i++) { - key = sourceKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - target[key] = source[key]; - } - return target; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/package.json b/project starter code/node_modules/@babel/runtime/helpers/esm/package.json deleted file mode 100644 index aead43de..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/package.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "module" -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js b/project starter code/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js deleted file mode 100644 index 87788244..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js +++ /dev/null @@ -1,10 +0,0 @@ -import _typeof from "./typeof.js"; -import assertThisInitialized from "./assertThisInitialized.js"; -export default function _possibleConstructorReturn(self, call) { - if (call && (_typeof(call) === "object" || typeof call === "function")) { - return call; - } else if (call !== void 0) { - throw new TypeError("Derived constructors may only return object or undefined"); - } - return assertThisInitialized(self); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/readOnlyError.js b/project starter code/node_modules/@babel/runtime/helpers/esm/readOnlyError.js deleted file mode 100644 index 166e40e5..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/readOnlyError.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _readOnlyError(name) { - throw new TypeError("\"" + name + "\" is read-only"); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js b/project starter code/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js deleted file mode 100644 index 562d8119..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js +++ /dev/null @@ -1,303 +0,0 @@ -import _typeof from "./typeof.js"; -export default function _regeneratorRuntime() { - "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ - _regeneratorRuntime = function _regeneratorRuntime() { - return exports; - }; - var exports = {}, - Op = Object.prototype, - hasOwn = Op.hasOwnProperty, - defineProperty = Object.defineProperty || function (obj, key, desc) { - obj[key] = desc.value; - }, - $Symbol = "function" == typeof Symbol ? Symbol : {}, - iteratorSymbol = $Symbol.iterator || "@@iterator", - asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", - toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; - function define(obj, key, value) { - return Object.defineProperty(obj, key, { - value: value, - enumerable: !0, - configurable: !0, - writable: !0 - }), obj[key]; - } - try { - define({}, ""); - } catch (err) { - define = function define(obj, key, value) { - return obj[key] = value; - }; - } - function wrap(innerFn, outerFn, self, tryLocsList) { - var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, - generator = Object.create(protoGenerator.prototype), - context = new Context(tryLocsList || []); - return defineProperty(generator, "_invoke", { - value: makeInvokeMethod(innerFn, self, context) - }), generator; - } - function tryCatch(fn, obj, arg) { - try { - return { - type: "normal", - arg: fn.call(obj, arg) - }; - } catch (err) { - return { - type: "throw", - arg: err - }; - } - } - exports.wrap = wrap; - var ContinueSentinel = {}; - function Generator() {} - function GeneratorFunction() {} - function GeneratorFunctionPrototype() {} - var IteratorPrototype = {}; - define(IteratorPrototype, iteratorSymbol, function () { - return this; - }); - var getProto = Object.getPrototypeOf, - NativeIteratorPrototype = getProto && getProto(getProto(values([]))); - NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); - var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); - function defineIteratorMethods(prototype) { - ["next", "throw", "return"].forEach(function (method) { - define(prototype, method, function (arg) { - return this._invoke(method, arg); - }); - }); - } - function AsyncIterator(generator, PromiseImpl) { - function invoke(method, arg, resolve, reject) { - var record = tryCatch(generator[method], generator, arg); - if ("throw" !== record.type) { - var result = record.arg, - value = result.value; - return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { - invoke("next", value, resolve, reject); - }, function (err) { - invoke("throw", err, resolve, reject); - }) : PromiseImpl.resolve(value).then(function (unwrapped) { - result.value = unwrapped, resolve(result); - }, function (error) { - return invoke("throw", error, resolve, reject); - }); - } - reject(record.arg); - } - var previousPromise; - defineProperty(this, "_invoke", { - value: function value(method, arg) { - function callInvokeWithMethodAndArg() { - return new PromiseImpl(function (resolve, reject) { - invoke(method, arg, resolve, reject); - }); - } - return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); - } - }); - } - function makeInvokeMethod(innerFn, self, context) { - var state = "suspendedStart"; - return function (method, arg) { - if ("executing" === state) throw new Error("Generator is already running"); - if ("completed" === state) { - if ("throw" === method) throw arg; - return doneResult(); - } - for (context.method = method, context.arg = arg;;) { - var delegate = context.delegate; - if (delegate) { - var delegateResult = maybeInvokeDelegate(delegate, context); - if (delegateResult) { - if (delegateResult === ContinueSentinel) continue; - return delegateResult; - } - } - if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { - if ("suspendedStart" === state) throw state = "completed", context.arg; - context.dispatchException(context.arg); - } else "return" === context.method && context.abrupt("return", context.arg); - state = "executing"; - var record = tryCatch(innerFn, self, context); - if ("normal" === record.type) { - if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; - return { - value: record.arg, - done: context.done - }; - } - "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); - } - }; - } - function maybeInvokeDelegate(delegate, context) { - var methodName = context.method, - method = delegate.iterator[methodName]; - if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; - var record = tryCatch(method, delegate.iterator, context.arg); - if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; - var info = record.arg; - return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); - } - function pushTryEntry(locs) { - var entry = { - tryLoc: locs[0] - }; - 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); - } - function resetTryEntry(entry) { - var record = entry.completion || {}; - record.type = "normal", delete record.arg, entry.completion = record; - } - function Context(tryLocsList) { - this.tryEntries = [{ - tryLoc: "root" - }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); - } - function values(iterable) { - if (iterable) { - var iteratorMethod = iterable[iteratorSymbol]; - if (iteratorMethod) return iteratorMethod.call(iterable); - if ("function" == typeof iterable.next) return iterable; - if (!isNaN(iterable.length)) { - var i = -1, - next = function next() { - for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; - return next.value = undefined, next.done = !0, next; - }; - return next.next = next; - } - } - return { - next: doneResult - }; - } - function doneResult() { - return { - value: undefined, - done: !0 - }; - } - return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { - value: GeneratorFunctionPrototype, - configurable: !0 - }), defineProperty(GeneratorFunctionPrototype, "constructor", { - value: GeneratorFunction, - configurable: !0 - }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { - var ctor = "function" == typeof genFun && genFun.constructor; - return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); - }, exports.mark = function (genFun) { - return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; - }, exports.awrap = function (arg) { - return { - __await: arg - }; - }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { - return this; - }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { - void 0 === PromiseImpl && (PromiseImpl = Promise); - var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); - return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { - return result.done ? result.value : iter.next(); - }); - }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { - return this; - }), define(Gp, "toString", function () { - return "[object Generator]"; - }), exports.keys = function (val) { - var object = Object(val), - keys = []; - for (var key in object) keys.push(key); - return keys.reverse(), function next() { - for (; keys.length;) { - var key = keys.pop(); - if (key in object) return next.value = key, next.done = !1, next; - } - return next.done = !0, next; - }; - }, exports.values = values, Context.prototype = { - constructor: Context, - reset: function reset(skipTempReset) { - if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); - }, - stop: function stop() { - this.done = !0; - var rootRecord = this.tryEntries[0].completion; - if ("throw" === rootRecord.type) throw rootRecord.arg; - return this.rval; - }, - dispatchException: function dispatchException(exception) { - if (this.done) throw exception; - var context = this; - function handle(loc, caught) { - return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; - } - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i], - record = entry.completion; - if ("root" === entry.tryLoc) return handle("end"); - if (entry.tryLoc <= this.prev) { - var hasCatch = hasOwn.call(entry, "catchLoc"), - hasFinally = hasOwn.call(entry, "finallyLoc"); - if (hasCatch && hasFinally) { - if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); - if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); - } else if (hasCatch) { - if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); - } else { - if (!hasFinally) throw new Error("try statement without catch or finally"); - if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); - } - } - } - }, - abrupt: function abrupt(type, arg) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { - var finallyEntry = entry; - break; - } - } - finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); - var record = finallyEntry ? finallyEntry.completion : {}; - return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); - }, - complete: function complete(record, afterLoc) { - if ("throw" === record.type) throw record.arg; - return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; - }, - finish: function finish(finallyLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; - } - }, - "catch": function _catch(tryLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc === tryLoc) { - var record = entry.completion; - if ("throw" === record.type) { - var thrown = record.arg; - resetTryEntry(entry); - } - return thrown; - } - } - throw new Error("illegal catch attempt"); - }, - delegateYield: function delegateYield(iterable, resultName, nextLoc) { - return this.delegate = { - iterator: values(iterable), - resultName: resultName, - nextLoc: nextLoc - }, "next" === this.method && (this.arg = undefined), ContinueSentinel; - } - }, exports; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/set.js b/project starter code/node_modules/@babel/runtime/helpers/esm/set.js deleted file mode 100644 index c9ee6c72..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/set.js +++ /dev/null @@ -1,40 +0,0 @@ -import superPropBase from "./superPropBase.js"; -import defineProperty from "./defineProperty.js"; -function set(target, property, value, receiver) { - if (typeof Reflect !== "undefined" && Reflect.set) { - set = Reflect.set; - } else { - set = function set(target, property, value, receiver) { - var base = superPropBase(target, property); - var desc; - if (base) { - desc = Object.getOwnPropertyDescriptor(base, property); - if (desc.set) { - desc.set.call(receiver, value); - return true; - } else if (!desc.writable) { - return false; - } - } - desc = Object.getOwnPropertyDescriptor(receiver, property); - if (desc) { - if (!desc.writable) { - return false; - } - desc.value = value; - Object.defineProperty(receiver, property, desc); - } else { - defineProperty(receiver, property, value); - } - return true; - }; - } - return set(target, property, value, receiver); -} -export default function _set(target, property, value, receiver, isStrict) { - var s = set(target, property, value, receiver || target); - if (!s && isStrict) { - throw new TypeError('failed to set property'); - } - return value; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js b/project starter code/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js deleted file mode 100644 index 905e13c0..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - return _setPrototypeOf(o, p); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js b/project starter code/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js deleted file mode 100644 index cadd9bb5..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/skipFirstGeneratorNext.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function _skipFirstGeneratorNext(fn) { - return function () { - var it = fn.apply(this, arguments); - it.next(); - return it; - }; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/slicedToArray.js b/project starter code/node_modules/@babel/runtime/helpers/esm/slicedToArray.js deleted file mode 100644 index 618200b9..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/slicedToArray.js +++ /dev/null @@ -1,7 +0,0 @@ -import arrayWithHoles from "./arrayWithHoles.js"; -import iterableToArrayLimit from "./iterableToArrayLimit.js"; -import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; -import nonIterableRest from "./nonIterableRest.js"; -export default function _slicedToArray(arr, i) { - return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/slicedToArrayLoose.js b/project starter code/node_modules/@babel/runtime/helpers/esm/slicedToArrayLoose.js deleted file mode 100644 index efc7429e..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/slicedToArrayLoose.js +++ /dev/null @@ -1,7 +0,0 @@ -import arrayWithHoles from "./arrayWithHoles.js"; -import iterableToArrayLimitLoose from "./iterableToArrayLimitLoose.js"; -import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; -import nonIterableRest from "./nonIterableRest.js"; -export default function _slicedToArrayLoose(arr, i) { - return arrayWithHoles(arr) || iterableToArrayLimitLoose(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/superPropBase.js b/project starter code/node_modules/@babel/runtime/helpers/esm/superPropBase.js deleted file mode 100644 index 605724d7..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/superPropBase.js +++ /dev/null @@ -1,8 +0,0 @@ -import getPrototypeOf from "./getPrototypeOf.js"; -export default function _superPropBase(object, property) { - while (!Object.prototype.hasOwnProperty.call(object, property)) { - object = getPrototypeOf(object); - if (object === null) break; - } - return object; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js b/project starter code/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js deleted file mode 100644 index 990d5e43..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js +++ /dev/null @@ -1,10 +0,0 @@ -export default function _taggedTemplateLiteral(strings, raw) { - if (!raw) { - raw = strings.slice(0); - } - return Object.freeze(Object.defineProperties(strings, { - raw: { - value: Object.freeze(raw) - } - })); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js b/project starter code/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js deleted file mode 100644 index 9fcba323..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteralLoose.js +++ /dev/null @@ -1,7 +0,0 @@ -export default function _taggedTemplateLiteralLoose(strings, raw) { - if (!raw) { - raw = strings.slice(0); - } - strings.raw = raw; - return strings; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/tdz.js b/project starter code/node_modules/@babel/runtime/helpers/esm/tdz.js deleted file mode 100644 index d5d0adc8..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/tdz.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _tdzError(name) { - throw new ReferenceError(name + " is not defined - temporal dead zone"); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/temporalRef.js b/project starter code/node_modules/@babel/runtime/helpers/esm/temporalRef.js deleted file mode 100644 index b25f7c44..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/temporalRef.js +++ /dev/null @@ -1,5 +0,0 @@ -import undef from "./temporalUndefined.js"; -import err from "./tdz.js"; -export default function _temporalRef(val, name) { - return val === undef ? err(name) : val; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js b/project starter code/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js deleted file mode 100644 index 1a357173..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/temporalUndefined.js +++ /dev/null @@ -1 +0,0 @@ -export default function _temporalUndefined() {} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/toArray.js b/project starter code/node_modules/@babel/runtime/helpers/esm/toArray.js deleted file mode 100644 index ad7c871a..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/toArray.js +++ /dev/null @@ -1,7 +0,0 @@ -import arrayWithHoles from "./arrayWithHoles.js"; -import iterableToArray from "./iterableToArray.js"; -import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; -import nonIterableRest from "./nonIterableRest.js"; -export default function _toArray(arr) { - return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest(); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js b/project starter code/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js deleted file mode 100644 index bd912855..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js +++ /dev/null @@ -1,7 +0,0 @@ -import arrayWithoutHoles from "./arrayWithoutHoles.js"; -import iterableToArray from "./iterableToArray.js"; -import unsupportedIterableToArray from "./unsupportedIterableToArray.js"; -import nonIterableSpread from "./nonIterableSpread.js"; -export default function _toConsumableArray(arr) { - return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread(); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/toPrimitive.js b/project starter code/node_modules/@babel/runtime/helpers/esm/toPrimitive.js deleted file mode 100644 index cbfabb7f..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +++ /dev/null @@ -1,11 +0,0 @@ -import _typeof from "./typeof.js"; -export default function _toPrimitive(input, hint) { - if (_typeof(input) !== "object" || input === null) return input; - var prim = input[Symbol.toPrimitive]; - if (prim !== undefined) { - var res = prim.call(input, hint || "default"); - if (_typeof(res) !== "object") return res; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return (hint === "string" ? String : Number)(input); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js b/project starter code/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js deleted file mode 100644 index 0fcc93b3..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +++ /dev/null @@ -1,6 +0,0 @@ -import _typeof from "./typeof.js"; -import toPrimitive from "./toPrimitive.js"; -export default function _toPropertyKey(arg) { - var key = toPrimitive(arg, "string"); - return _typeof(key) === "symbol" ? key : String(key); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/typeof.js b/project starter code/node_modules/@babel/runtime/helpers/esm/typeof.js deleted file mode 100644 index 92100c66..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/typeof.js +++ /dev/null @@ -1,9 +0,0 @@ -export default function _typeof(obj) { - "@babel/helpers - typeof"; - - return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { - return typeof obj; - } : function (obj) { - return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }, _typeof(obj); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js b/project starter code/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js deleted file mode 100644 index c0f63bd5..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +++ /dev/null @@ -1,9 +0,0 @@ -import arrayLikeToArray from "./arrayLikeToArray.js"; -export default function _unsupportedIterableToArray(o, minLen) { - if (!o) return; - if (typeof o === "string") return arrayLikeToArray(o, minLen); - var n = Object.prototype.toString.call(o).slice(8, -1); - if (n === "Object" && o.constructor) n = o.constructor.name; - if (n === "Map" || n === "Set") return Array.from(o); - if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js deleted file mode 100644 index 723b2dda..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/wrapAsyncGenerator.js +++ /dev/null @@ -1,6 +0,0 @@ -import AsyncGenerator from "./AsyncGenerator.js"; -export default function _wrapAsyncGenerator(fn) { - return function () { - return new AsyncGenerator(fn.apply(this, arguments)); - }; -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js b/project starter code/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js deleted file mode 100644 index 43d0ded7..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js +++ /dev/null @@ -1,30 +0,0 @@ -import getPrototypeOf from "./getPrototypeOf.js"; -import setPrototypeOf from "./setPrototypeOf.js"; -import isNativeFunction from "./isNativeFunction.js"; -import construct from "./construct.js"; -export default function _wrapNativeSuper(Class) { - var _cache = typeof Map === "function" ? new Map() : undefined; - _wrapNativeSuper = function _wrapNativeSuper(Class) { - if (Class === null || !isNativeFunction(Class)) return Class; - if (typeof Class !== "function") { - throw new TypeError("Super expression must either be null or a function"); - } - if (typeof _cache !== "undefined") { - if (_cache.has(Class)) return _cache.get(Class); - _cache.set(Class, Wrapper); - } - function Wrapper() { - return construct(Class, arguments, getPrototypeOf(this).constructor); - } - Wrapper.prototype = Object.create(Class.prototype, { - constructor: { - value: Wrapper, - enumerable: false, - writable: true, - configurable: true - } - }); - return setPrototypeOf(Wrapper, Class); - }; - return _wrapNativeSuper(Class); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js b/project starter code/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js deleted file mode 100644 index 620d84c7..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/wrapRegExp.js +++ /dev/null @@ -1,50 +0,0 @@ -import _typeof from "./typeof.js"; -import setPrototypeOf from "./setPrototypeOf.js"; -import inherits from "./inherits.js"; -export default function _wrapRegExp() { - _wrapRegExp = function _wrapRegExp(re, groups) { - return new BabelRegExp(re, void 0, groups); - }; - var _super = RegExp.prototype, - _groups = new WeakMap(); - function BabelRegExp(re, flags, groups) { - var _this = new RegExp(re, flags); - return _groups.set(_this, groups || _groups.get(re)), setPrototypeOf(_this, BabelRegExp.prototype); - } - function buildGroups(result, re) { - var g = _groups.get(re); - return Object.keys(g).reduce(function (groups, name) { - var i = g[name]; - if ("number" == typeof i) groups[name] = result[i];else { - for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) k++; - groups[name] = result[i[k]]; - } - return groups; - }, Object.create(null)); - } - return inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) { - var result = _super.exec.call(this, str); - if (result) { - result.groups = buildGroups(result, this); - var indices = result.indices; - indices && (indices.groups = buildGroups(indices, this)); - } - return result; - }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { - if ("string" == typeof substitution) { - var groups = _groups.get(this); - return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { - var group = groups[name]; - return "$" + (Array.isArray(group) ? group.join("$") : group); - })); - } - if ("function" == typeof substitution) { - var _this = this; - return _super[Symbol.replace].call(this, str, function () { - var args = arguments; - return "object" != _typeof(args[args.length - 1]) && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args); - }); - } - return _super[Symbol.replace].call(this, str, substitution); - }, _wrapRegExp.apply(this, arguments); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js b/project starter code/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js deleted file mode 100644 index 9170bd45..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/esm/writeOnlyError.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function _writeOnlyError(name) { - throw new TypeError("\"" + name + "\" is write-only"); -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/extends.js b/project starter code/node_modules/@babel/runtime/helpers/extends.js deleted file mode 100644 index bb111607..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/extends.js +++ /dev/null @@ -1,15 +0,0 @@ -function _extends() { - module.exports = _extends = Object.assign ? Object.assign.bind() : function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } - return target; - }, module.exports.__esModule = true, module.exports["default"] = module.exports; - return _extends.apply(this, arguments); -} -module.exports = _extends, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/get.js b/project starter code/node_modules/@babel/runtime/helpers/get.js deleted file mode 100644 index 9b44d2fb..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/get.js +++ /dev/null @@ -1,18 +0,0 @@ -var superPropBase = require("./superPropBase.js"); -function _get() { - if (typeof Reflect !== "undefined" && Reflect.get) { - module.exports = _get = Reflect.get.bind(), module.exports.__esModule = true, module.exports["default"] = module.exports; - } else { - module.exports = _get = function _get(target, property, receiver) { - var base = superPropBase(target, property); - if (!base) return; - var desc = Object.getOwnPropertyDescriptor(base, property); - if (desc.get) { - return desc.get.call(arguments.length < 3 ? target : receiver); - } - return desc.value; - }, module.exports.__esModule = true, module.exports["default"] = module.exports; - } - return _get.apply(this, arguments); -} -module.exports = _get, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/getPrototypeOf.js b/project starter code/node_modules/@babel/runtime/helpers/getPrototypeOf.js deleted file mode 100644 index 0639a655..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/getPrototypeOf.js +++ /dev/null @@ -1,7 +0,0 @@ -function _getPrototypeOf(o) { - module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }, module.exports.__esModule = true, module.exports["default"] = module.exports; - return _getPrototypeOf(o); -} -module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/identity.js b/project starter code/node_modules/@babel/runtime/helpers/identity.js deleted file mode 100644 index 7dd82dc7..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/identity.js +++ /dev/null @@ -1,4 +0,0 @@ -function _identity(x) { - return x; -} -module.exports = _identity, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/inherits.js b/project starter code/node_modules/@babel/runtime/helpers/inherits.js deleted file mode 100644 index 6521cce3..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/inherits.js +++ /dev/null @@ -1,18 +0,0 @@ -var setPrototypeOf = require("./setPrototypeOf.js"); -function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); - } - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } - }); - Object.defineProperty(subClass, "prototype", { - writable: false - }); - if (superClass) setPrototypeOf(subClass, superClass); -} -module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/inheritsLoose.js b/project starter code/node_modules/@babel/runtime/helpers/inheritsLoose.js deleted file mode 100644 index 19a60c93..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/inheritsLoose.js +++ /dev/null @@ -1,7 +0,0 @@ -var setPrototypeOf = require("./setPrototypeOf.js"); -function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - setPrototypeOf(subClass, superClass); -} -module.exports = _inheritsLoose, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/initializerDefineProperty.js b/project starter code/node_modules/@babel/runtime/helpers/initializerDefineProperty.js deleted file mode 100644 index 7f35d503..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/initializerDefineProperty.js +++ /dev/null @@ -1,10 +0,0 @@ -function _initializerDefineProperty(target, property, descriptor, context) { - if (!descriptor) return; - Object.defineProperty(target, property, { - enumerable: descriptor.enumerable, - configurable: descriptor.configurable, - writable: descriptor.writable, - value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 - }); -} -module.exports = _initializerDefineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/initializerWarningHelper.js b/project starter code/node_modules/@babel/runtime/helpers/initializerWarningHelper.js deleted file mode 100644 index c58b04ee..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/initializerWarningHelper.js +++ /dev/null @@ -1,4 +0,0 @@ -function _initializerWarningHelper(descriptor, context) { - throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.'); -} -module.exports = _initializerWarningHelper, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/instanceof.js b/project starter code/node_modules/@babel/runtime/helpers/instanceof.js deleted file mode 100644 index bc3d9e7f..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/instanceof.js +++ /dev/null @@ -1,8 +0,0 @@ -function _instanceof(left, right) { - if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { - return !!right[Symbol.hasInstance](left); - } else { - return left instanceof right; - } -} -module.exports = _instanceof, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/interopRequireDefault.js b/project starter code/node_modules/@babel/runtime/helpers/interopRequireDefault.js deleted file mode 100644 index 429b270d..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/interopRequireDefault.js +++ /dev/null @@ -1,6 +0,0 @@ -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { - "default": obj - }; -} -module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/interopRequireWildcard.js b/project starter code/node_modules/@babel/runtime/helpers/interopRequireWildcard.js deleted file mode 100644 index 3765dcc7..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/interopRequireWildcard.js +++ /dev/null @@ -1,41 +0,0 @@ -var _typeof = require("./typeof.js")["default"]; -function _getRequireWildcardCache(nodeInterop) { - if (typeof WeakMap !== "function") return null; - var cacheBabelInterop = new WeakMap(); - var cacheNodeInterop = new WeakMap(); - return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { - return nodeInterop ? cacheNodeInterop : cacheBabelInterop; - })(nodeInterop); -} -function _interopRequireWildcard(obj, nodeInterop) { - if (!nodeInterop && obj && obj.__esModule) { - return obj; - } - if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { - return { - "default": obj - }; - } - var cache = _getRequireWildcardCache(nodeInterop); - if (cache && cache.has(obj)) { - return cache.get(obj); - } - var newObj = {}; - var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; - for (var key in obj) { - if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { - var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; - if (desc && (desc.get || desc.set)) { - Object.defineProperty(newObj, key, desc); - } else { - newObj[key] = obj[key]; - } - } - } - newObj["default"] = obj; - if (cache) { - cache.set(obj, newObj); - } - return newObj; -} -module.exports = _interopRequireWildcard, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/isNativeFunction.js b/project starter code/node_modules/@babel/runtime/helpers/isNativeFunction.js deleted file mode 100644 index ea595353..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/isNativeFunction.js +++ /dev/null @@ -1,4 +0,0 @@ -function _isNativeFunction(fn) { - return Function.toString.call(fn).indexOf("[native code]") !== -1; -} -module.exports = _isNativeFunction, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js b/project starter code/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js deleted file mode 100644 index 6b4e73f0..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/isNativeReflectConstruct.js +++ /dev/null @@ -1,12 +0,0 @@ -function _isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) return false; - if (Reflect.construct.sham) return false; - if (typeof Proxy === "function") return true; - try { - Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); - return true; - } catch (e) { - return false; - } -} -module.exports = _isNativeReflectConstruct, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/iterableToArray.js b/project starter code/node_modules/@babel/runtime/helpers/iterableToArray.js deleted file mode 100644 index 89607526..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/iterableToArray.js +++ /dev/null @@ -1,4 +0,0 @@ -function _iterableToArray(iter) { - if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); -} -module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js b/project starter code/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js deleted file mode 100644 index 20a18351..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/iterableToArrayLimit.js +++ /dev/null @@ -1,28 +0,0 @@ -function _iterableToArrayLimit(arr, i) { - var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; - if (null != _i) { - var _s, - _e, - _x, - _r, - _arr = [], - _n = !0, - _d = !1; - try { - if (_x = (_i = _i.call(arr)).next, 0 === i) { - if (Object(_i) !== _i) return; - _n = !1; - } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); - } catch (err) { - _d = !0, _e = err; - } finally { - try { - if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; - } finally { - if (_d) throw _e; - } - } - return _arr; - } -} -module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/iterableToArrayLimitLoose.js b/project starter code/node_modules/@babel/runtime/helpers/iterableToArrayLimitLoose.js deleted file mode 100644 index c56bebdb..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/iterableToArrayLimitLoose.js +++ /dev/null @@ -1,10 +0,0 @@ -function _iterableToArrayLimitLoose(arr, i) { - var _i = arr && ("undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]); - if (null != _i) { - var _s, - _arr = []; - for (_i = _i.call(arr); arr.length < i && !(_s = _i.next()).done;) _arr.push(_s.value); - return _arr; - } -} -module.exports = _iterableToArrayLimitLoose, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/jsx.js b/project starter code/node_modules/@babel/runtime/helpers/jsx.js deleted file mode 100644 index 8c6de765..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/jsx.js +++ /dev/null @@ -1,22 +0,0 @@ -var REACT_ELEMENT_TYPE; -function _createRawReactElement(type, props, key, children) { - REACT_ELEMENT_TYPE || (REACT_ELEMENT_TYPE = "function" == typeof Symbol && Symbol["for"] && Symbol["for"]("react.element") || 60103); - var defaultProps = type && type.defaultProps, - childrenLength = arguments.length - 3; - if (props || 0 === childrenLength || (props = { - children: void 0 - }), 1 === childrenLength) props.children = children;else if (childrenLength > 1) { - for (var childArray = new Array(childrenLength), i = 0; i < childrenLength; i++) childArray[i] = arguments[i + 3]; - props.children = childArray; - } - if (props && defaultProps) for (var propName in defaultProps) void 0 === props[propName] && (props[propName] = defaultProps[propName]);else props || (props = defaultProps || {}); - return { - $$typeof: REACT_ELEMENT_TYPE, - type: type, - key: void 0 === key ? null : "" + key, - ref: null, - props: props, - _owner: null - }; -} -module.exports = _createRawReactElement, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/maybeArrayLike.js b/project starter code/node_modules/@babel/runtime/helpers/maybeArrayLike.js deleted file mode 100644 index 5d000975..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/maybeArrayLike.js +++ /dev/null @@ -1,9 +0,0 @@ -var arrayLikeToArray = require("./arrayLikeToArray.js"); -function _maybeArrayLike(next, arr, i) { - if (arr && !Array.isArray(arr) && typeof arr.length === "number") { - var len = arr.length; - return arrayLikeToArray(arr, i !== void 0 && i < len ? i : len); - } - return next(arr, i); -} -module.exports = _maybeArrayLike, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/newArrowCheck.js b/project starter code/node_modules/@babel/runtime/helpers/newArrowCheck.js deleted file mode 100644 index 9c680c8d..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/newArrowCheck.js +++ /dev/null @@ -1,6 +0,0 @@ -function _newArrowCheck(innerThis, boundThis) { - if (innerThis !== boundThis) { - throw new TypeError("Cannot instantiate an arrow function"); - } -} -module.exports = _newArrowCheck, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/nonIterableRest.js b/project starter code/node_modules/@babel/runtime/helpers/nonIterableRest.js deleted file mode 100644 index 95265ba3..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/nonIterableRest.js +++ /dev/null @@ -1,4 +0,0 @@ -function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/nonIterableSpread.js b/project starter code/node_modules/@babel/runtime/helpers/nonIterableSpread.js deleted file mode 100644 index 3fcf23f0..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/nonIterableSpread.js +++ /dev/null @@ -1,4 +0,0 @@ -function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js b/project starter code/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js deleted file mode 100644 index 5b405e00..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/objectDestructuringEmpty.js +++ /dev/null @@ -1,4 +0,0 @@ -function _objectDestructuringEmpty(obj) { - if (obj == null) throw new TypeError("Cannot destructure " + obj); -} -module.exports = _objectDestructuringEmpty, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/objectSpread.js b/project starter code/node_modules/@babel/runtime/helpers/objectSpread.js deleted file mode 100644 index f3934031..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/objectSpread.js +++ /dev/null @@ -1,17 +0,0 @@ -var defineProperty = require("./defineProperty.js"); -function _objectSpread(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? Object(arguments[i]) : {}; - var ownKeys = Object.keys(source); - if (typeof Object.getOwnPropertySymbols === 'function') { - ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function (sym) { - return Object.getOwnPropertyDescriptor(source, sym).enumerable; - })); - } - ownKeys.forEach(function (key) { - defineProperty(target, key, source[key]); - }); - } - return target; -} -module.exports = _objectSpread, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/objectSpread2.js b/project starter code/node_modules/@babel/runtime/helpers/objectSpread2.js deleted file mode 100644 index 214f9e04..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/objectSpread2.js +++ /dev/null @@ -1,23 +0,0 @@ -var defineProperty = require("./defineProperty.js"); -function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - enumerableOnly && (symbols = symbols.filter(function (sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - })), keys.push.apply(keys, symbols); - } - return keys; -} -function _objectSpread2(target) { - for (var i = 1; i < arguments.length; i++) { - var source = null != arguments[i] ? arguments[i] : {}; - i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { - defineProperty(target, key, source[key]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { - Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); - }); - } - return target; -} -module.exports = _objectSpread2, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/objectWithoutProperties.js b/project starter code/node_modules/@babel/runtime/helpers/objectWithoutProperties.js deleted file mode 100644 index cf526bc8..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/objectWithoutProperties.js +++ /dev/null @@ -1,17 +0,0 @@ -var objectWithoutPropertiesLoose = require("./objectWithoutPropertiesLoose.js"); -function _objectWithoutProperties(source, excluded) { - if (source == null) return {}; - var target = objectWithoutPropertiesLoose(source, excluded); - var key, i; - if (Object.getOwnPropertySymbols) { - var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for (i = 0; i < sourceSymbolKeys.length; i++) { - key = sourceSymbolKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; - target[key] = source[key]; - } - } - return target; -} -module.exports = _objectWithoutProperties, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js b/project starter code/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js deleted file mode 100644 index 3c65a9db..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js +++ /dev/null @@ -1,13 +0,0 @@ -function _objectWithoutPropertiesLoose(source, excluded) { - if (source == null) return {}; - var target = {}; - var sourceKeys = Object.keys(source); - var key, i; - for (i = 0; i < sourceKeys.length; i++) { - key = sourceKeys[i]; - if (excluded.indexOf(key) >= 0) continue; - target[key] = source[key]; - } - return target; -} -module.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js b/project starter code/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js deleted file mode 100644 index b2424b00..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js +++ /dev/null @@ -1,11 +0,0 @@ -var _typeof = require("./typeof.js")["default"]; -var assertThisInitialized = require("./assertThisInitialized.js"); -function _possibleConstructorReturn(self, call) { - if (call && (_typeof(call) === "object" || typeof call === "function")) { - return call; - } else if (call !== void 0) { - throw new TypeError("Derived constructors may only return object or undefined"); - } - return assertThisInitialized(self); -} -module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/readOnlyError.js b/project starter code/node_modules/@babel/runtime/helpers/readOnlyError.js deleted file mode 100644 index 6637a0e0..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/readOnlyError.js +++ /dev/null @@ -1,4 +0,0 @@ -function _readOnlyError(name) { - throw new TypeError("\"" + name + "\" is read-only"); -} -module.exports = _readOnlyError, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/regeneratorRuntime.js b/project starter code/node_modules/@babel/runtime/helpers/regeneratorRuntime.js deleted file mode 100644 index 98db5918..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/regeneratorRuntime.js +++ /dev/null @@ -1,304 +0,0 @@ -var _typeof = require("./typeof.js")["default"]; -function _regeneratorRuntime() { - "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ - module.exports = _regeneratorRuntime = function _regeneratorRuntime() { - return exports; - }, module.exports.__esModule = true, module.exports["default"] = module.exports; - var exports = {}, - Op = Object.prototype, - hasOwn = Op.hasOwnProperty, - defineProperty = Object.defineProperty || function (obj, key, desc) { - obj[key] = desc.value; - }, - $Symbol = "function" == typeof Symbol ? Symbol : {}, - iteratorSymbol = $Symbol.iterator || "@@iterator", - asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", - toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; - function define(obj, key, value) { - return Object.defineProperty(obj, key, { - value: value, - enumerable: !0, - configurable: !0, - writable: !0 - }), obj[key]; - } - try { - define({}, ""); - } catch (err) { - define = function define(obj, key, value) { - return obj[key] = value; - }; - } - function wrap(innerFn, outerFn, self, tryLocsList) { - var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, - generator = Object.create(protoGenerator.prototype), - context = new Context(tryLocsList || []); - return defineProperty(generator, "_invoke", { - value: makeInvokeMethod(innerFn, self, context) - }), generator; - } - function tryCatch(fn, obj, arg) { - try { - return { - type: "normal", - arg: fn.call(obj, arg) - }; - } catch (err) { - return { - type: "throw", - arg: err - }; - } - } - exports.wrap = wrap; - var ContinueSentinel = {}; - function Generator() {} - function GeneratorFunction() {} - function GeneratorFunctionPrototype() {} - var IteratorPrototype = {}; - define(IteratorPrototype, iteratorSymbol, function () { - return this; - }); - var getProto = Object.getPrototypeOf, - NativeIteratorPrototype = getProto && getProto(getProto(values([]))); - NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); - var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); - function defineIteratorMethods(prototype) { - ["next", "throw", "return"].forEach(function (method) { - define(prototype, method, function (arg) { - return this._invoke(method, arg); - }); - }); - } - function AsyncIterator(generator, PromiseImpl) { - function invoke(method, arg, resolve, reject) { - var record = tryCatch(generator[method], generator, arg); - if ("throw" !== record.type) { - var result = record.arg, - value = result.value; - return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { - invoke("next", value, resolve, reject); - }, function (err) { - invoke("throw", err, resolve, reject); - }) : PromiseImpl.resolve(value).then(function (unwrapped) { - result.value = unwrapped, resolve(result); - }, function (error) { - return invoke("throw", error, resolve, reject); - }); - } - reject(record.arg); - } - var previousPromise; - defineProperty(this, "_invoke", { - value: function value(method, arg) { - function callInvokeWithMethodAndArg() { - return new PromiseImpl(function (resolve, reject) { - invoke(method, arg, resolve, reject); - }); - } - return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); - } - }); - } - function makeInvokeMethod(innerFn, self, context) { - var state = "suspendedStart"; - return function (method, arg) { - if ("executing" === state) throw new Error("Generator is already running"); - if ("completed" === state) { - if ("throw" === method) throw arg; - return doneResult(); - } - for (context.method = method, context.arg = arg;;) { - var delegate = context.delegate; - if (delegate) { - var delegateResult = maybeInvokeDelegate(delegate, context); - if (delegateResult) { - if (delegateResult === ContinueSentinel) continue; - return delegateResult; - } - } - if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { - if ("suspendedStart" === state) throw state = "completed", context.arg; - context.dispatchException(context.arg); - } else "return" === context.method && context.abrupt("return", context.arg); - state = "executing"; - var record = tryCatch(innerFn, self, context); - if ("normal" === record.type) { - if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; - return { - value: record.arg, - done: context.done - }; - } - "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); - } - }; - } - function maybeInvokeDelegate(delegate, context) { - var methodName = context.method, - method = delegate.iterator[methodName]; - if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; - var record = tryCatch(method, delegate.iterator, context.arg); - if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; - var info = record.arg; - return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); - } - function pushTryEntry(locs) { - var entry = { - tryLoc: locs[0] - }; - 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); - } - function resetTryEntry(entry) { - var record = entry.completion || {}; - record.type = "normal", delete record.arg, entry.completion = record; - } - function Context(tryLocsList) { - this.tryEntries = [{ - tryLoc: "root" - }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); - } - function values(iterable) { - if (iterable) { - var iteratorMethod = iterable[iteratorSymbol]; - if (iteratorMethod) return iteratorMethod.call(iterable); - if ("function" == typeof iterable.next) return iterable; - if (!isNaN(iterable.length)) { - var i = -1, - next = function next() { - for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; - return next.value = undefined, next.done = !0, next; - }; - return next.next = next; - } - } - return { - next: doneResult - }; - } - function doneResult() { - return { - value: undefined, - done: !0 - }; - } - return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { - value: GeneratorFunctionPrototype, - configurable: !0 - }), defineProperty(GeneratorFunctionPrototype, "constructor", { - value: GeneratorFunction, - configurable: !0 - }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { - var ctor = "function" == typeof genFun && genFun.constructor; - return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); - }, exports.mark = function (genFun) { - return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; - }, exports.awrap = function (arg) { - return { - __await: arg - }; - }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { - return this; - }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { - void 0 === PromiseImpl && (PromiseImpl = Promise); - var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); - return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { - return result.done ? result.value : iter.next(); - }); - }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { - return this; - }), define(Gp, "toString", function () { - return "[object Generator]"; - }), exports.keys = function (val) { - var object = Object(val), - keys = []; - for (var key in object) keys.push(key); - return keys.reverse(), function next() { - for (; keys.length;) { - var key = keys.pop(); - if (key in object) return next.value = key, next.done = !1, next; - } - return next.done = !0, next; - }; - }, exports.values = values, Context.prototype = { - constructor: Context, - reset: function reset(skipTempReset) { - if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); - }, - stop: function stop() { - this.done = !0; - var rootRecord = this.tryEntries[0].completion; - if ("throw" === rootRecord.type) throw rootRecord.arg; - return this.rval; - }, - dispatchException: function dispatchException(exception) { - if (this.done) throw exception; - var context = this; - function handle(loc, caught) { - return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; - } - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i], - record = entry.completion; - if ("root" === entry.tryLoc) return handle("end"); - if (entry.tryLoc <= this.prev) { - var hasCatch = hasOwn.call(entry, "catchLoc"), - hasFinally = hasOwn.call(entry, "finallyLoc"); - if (hasCatch && hasFinally) { - if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); - if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); - } else if (hasCatch) { - if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); - } else { - if (!hasFinally) throw new Error("try statement without catch or finally"); - if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); - } - } - } - }, - abrupt: function abrupt(type, arg) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { - var finallyEntry = entry; - break; - } - } - finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); - var record = finallyEntry ? finallyEntry.completion : {}; - return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); - }, - complete: function complete(record, afterLoc) { - if ("throw" === record.type) throw record.arg; - return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; - }, - finish: function finish(finallyLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; - } - }, - "catch": function _catch(tryLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc === tryLoc) { - var record = entry.completion; - if ("throw" === record.type) { - var thrown = record.arg; - resetTryEntry(entry); - } - return thrown; - } - } - throw new Error("illegal catch attempt"); - }, - delegateYield: function delegateYield(iterable, resultName, nextLoc) { - return this.delegate = { - iterator: values(iterable), - resultName: resultName, - nextLoc: nextLoc - }, "next" === this.method && (this.arg = undefined), ContinueSentinel; - } - }, exports; -} -module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/set.js b/project starter code/node_modules/@babel/runtime/helpers/set.js deleted file mode 100644 index e1356241..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/set.js +++ /dev/null @@ -1,41 +0,0 @@ -var superPropBase = require("./superPropBase.js"); -var defineProperty = require("./defineProperty.js"); -function set(target, property, value, receiver) { - if (typeof Reflect !== "undefined" && Reflect.set) { - set = Reflect.set; - } else { - set = function set(target, property, value, receiver) { - var base = superPropBase(target, property); - var desc; - if (base) { - desc = Object.getOwnPropertyDescriptor(base, property); - if (desc.set) { - desc.set.call(receiver, value); - return true; - } else if (!desc.writable) { - return false; - } - } - desc = Object.getOwnPropertyDescriptor(receiver, property); - if (desc) { - if (!desc.writable) { - return false; - } - desc.value = value; - Object.defineProperty(receiver, property, desc); - } else { - defineProperty(receiver, property, value); - } - return true; - }; - } - return set(target, property, value, receiver); -} -function _set(target, property, value, receiver, isStrict) { - var s = set(target, property, value, receiver || target); - if (!s && isStrict) { - throw new TypeError('failed to set property'); - } - return value; -} -module.exports = _set, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/setPrototypeOf.js b/project starter code/node_modules/@babel/runtime/helpers/setPrototypeOf.js deleted file mode 100644 index e0d8b518..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/setPrototypeOf.js +++ /dev/null @@ -1,8 +0,0 @@ -function _setPrototypeOf(o, p) { - module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }, module.exports.__esModule = true, module.exports["default"] = module.exports; - return _setPrototypeOf(o, p); -} -module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js b/project starter code/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js deleted file mode 100644 index ca269aad..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/skipFirstGeneratorNext.js +++ /dev/null @@ -1,8 +0,0 @@ -function _skipFirstGeneratorNext(fn) { - return function () { - var it = fn.apply(this, arguments); - it.next(); - return it; - }; -} -module.exports = _skipFirstGeneratorNext, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/slicedToArray.js b/project starter code/node_modules/@babel/runtime/helpers/slicedToArray.js deleted file mode 100644 index 534b61aa..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/slicedToArray.js +++ /dev/null @@ -1,8 +0,0 @@ -var arrayWithHoles = require("./arrayWithHoles.js"); -var iterableToArrayLimit = require("./iterableToArrayLimit.js"); -var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); -var nonIterableRest = require("./nonIterableRest.js"); -function _slicedToArray(arr, i) { - return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); -} -module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/slicedToArrayLoose.js b/project starter code/node_modules/@babel/runtime/helpers/slicedToArrayLoose.js deleted file mode 100644 index b1989b48..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/slicedToArrayLoose.js +++ /dev/null @@ -1,8 +0,0 @@ -var arrayWithHoles = require("./arrayWithHoles.js"); -var iterableToArrayLimitLoose = require("./iterableToArrayLimitLoose.js"); -var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); -var nonIterableRest = require("./nonIterableRest.js"); -function _slicedToArrayLoose(arr, i) { - return arrayWithHoles(arr) || iterableToArrayLimitLoose(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); -} -module.exports = _slicedToArrayLoose, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/superPropBase.js b/project starter code/node_modules/@babel/runtime/helpers/superPropBase.js deleted file mode 100644 index e43a0293..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/superPropBase.js +++ /dev/null @@ -1,9 +0,0 @@ -var getPrototypeOf = require("./getPrototypeOf.js"); -function _superPropBase(object, property) { - while (!Object.prototype.hasOwnProperty.call(object, property)) { - object = getPrototypeOf(object); - if (object === null) break; - } - return object; -} -module.exports = _superPropBase, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js b/project starter code/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js deleted file mode 100644 index 1ab0e7a2..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/taggedTemplateLiteral.js +++ /dev/null @@ -1,11 +0,0 @@ -function _taggedTemplateLiteral(strings, raw) { - if (!raw) { - raw = strings.slice(0); - } - return Object.freeze(Object.defineProperties(strings, { - raw: { - value: Object.freeze(raw) - } - })); -} -module.exports = _taggedTemplateLiteral, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js b/project starter code/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js deleted file mode 100644 index 904e1a7d..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js +++ /dev/null @@ -1,8 +0,0 @@ -function _taggedTemplateLiteralLoose(strings, raw) { - if (!raw) { - raw = strings.slice(0); - } - strings.raw = raw; - return strings; -} -module.exports = _taggedTemplateLiteralLoose, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/tdz.js b/project starter code/node_modules/@babel/runtime/helpers/tdz.js deleted file mode 100644 index 0641c76d..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/tdz.js +++ /dev/null @@ -1,4 +0,0 @@ -function _tdzError(name) { - throw new ReferenceError(name + " is not defined - temporal dead zone"); -} -module.exports = _tdzError, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/temporalRef.js b/project starter code/node_modules/@babel/runtime/helpers/temporalRef.js deleted file mode 100644 index a9be53d2..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/temporalRef.js +++ /dev/null @@ -1,6 +0,0 @@ -var temporalUndefined = require("./temporalUndefined.js"); -var tdz = require("./tdz.js"); -function _temporalRef(val, name) { - return val === temporalUndefined ? tdz(name) : val; -} -module.exports = _temporalRef, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/temporalUndefined.js b/project starter code/node_modules/@babel/runtime/helpers/temporalUndefined.js deleted file mode 100644 index f8def800..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/temporalUndefined.js +++ /dev/null @@ -1,2 +0,0 @@ -function _temporalUndefined() {} -module.exports = _temporalUndefined, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/toArray.js b/project starter code/node_modules/@babel/runtime/helpers/toArray.js deleted file mode 100644 index 5c808c2e..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/toArray.js +++ /dev/null @@ -1,8 +0,0 @@ -var arrayWithHoles = require("./arrayWithHoles.js"); -var iterableToArray = require("./iterableToArray.js"); -var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); -var nonIterableRest = require("./nonIterableRest.js"); -function _toArray(arr) { - return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest(); -} -module.exports = _toArray, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/toConsumableArray.js b/project starter code/node_modules/@babel/runtime/helpers/toConsumableArray.js deleted file mode 100644 index 547c6c44..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/toConsumableArray.js +++ /dev/null @@ -1,8 +0,0 @@ -var arrayWithoutHoles = require("./arrayWithoutHoles.js"); -var iterableToArray = require("./iterableToArray.js"); -var unsupportedIterableToArray = require("./unsupportedIterableToArray.js"); -var nonIterableSpread = require("./nonIterableSpread.js"); -function _toConsumableArray(arr) { - return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread(); -} -module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/toPrimitive.js b/project starter code/node_modules/@babel/runtime/helpers/toPrimitive.js deleted file mode 100644 index adf63bb5..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/toPrimitive.js +++ /dev/null @@ -1,12 +0,0 @@ -var _typeof = require("./typeof.js")["default"]; -function _toPrimitive(input, hint) { - if (_typeof(input) !== "object" || input === null) return input; - var prim = input[Symbol.toPrimitive]; - if (prim !== undefined) { - var res = prim.call(input, hint || "default"); - if (_typeof(res) !== "object") return res; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return (hint === "string" ? String : Number)(input); -} -module.exports = _toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/toPropertyKey.js b/project starter code/node_modules/@babel/runtime/helpers/toPropertyKey.js deleted file mode 100644 index 320bb2b9..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/toPropertyKey.js +++ /dev/null @@ -1,7 +0,0 @@ -var _typeof = require("./typeof.js")["default"]; -var toPrimitive = require("./toPrimitive.js"); -function _toPropertyKey(arg) { - var key = toPrimitive(arg, "string"); - return _typeof(key) === "symbol" ? key : String(key); -} -module.exports = _toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/typeof.js b/project starter code/node_modules/@babel/runtime/helpers/typeof.js deleted file mode 100644 index aa88477c..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/typeof.js +++ /dev/null @@ -1,10 +0,0 @@ -function _typeof(obj) { - "@babel/helpers - typeof"; - - return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { - return typeof obj; - } : function (obj) { - return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj); -} -module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js b/project starter code/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js deleted file mode 100644 index b7d18c6a..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js +++ /dev/null @@ -1,10 +0,0 @@ -var arrayLikeToArray = require("./arrayLikeToArray.js"); -function _unsupportedIterableToArray(o, minLen) { - if (!o) return; - if (typeof o === "string") return arrayLikeToArray(o, minLen); - var n = Object.prototype.toString.call(o).slice(8, -1); - if (n === "Object" && o.constructor) n = o.constructor.name; - if (n === "Map" || n === "Set") return Array.from(o); - if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen); -} -module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js b/project starter code/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js deleted file mode 100644 index a62dcf02..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/wrapAsyncGenerator.js +++ /dev/null @@ -1,7 +0,0 @@ -var AsyncGenerator = require("./AsyncGenerator.js"); -function _wrapAsyncGenerator(fn) { - return function () { - return new AsyncGenerator(fn.apply(this, arguments)); - }; -} -module.exports = _wrapAsyncGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/wrapNativeSuper.js b/project starter code/node_modules/@babel/runtime/helpers/wrapNativeSuper.js deleted file mode 100644 index b6ea60c6..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/wrapNativeSuper.js +++ /dev/null @@ -1,31 +0,0 @@ -var getPrototypeOf = require("./getPrototypeOf.js"); -var setPrototypeOf = require("./setPrototypeOf.js"); -var isNativeFunction = require("./isNativeFunction.js"); -var construct = require("./construct.js"); -function _wrapNativeSuper(Class) { - var _cache = typeof Map === "function" ? new Map() : undefined; - module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) { - if (Class === null || !isNativeFunction(Class)) return Class; - if (typeof Class !== "function") { - throw new TypeError("Super expression must either be null or a function"); - } - if (typeof _cache !== "undefined") { - if (_cache.has(Class)) return _cache.get(Class); - _cache.set(Class, Wrapper); - } - function Wrapper() { - return construct(Class, arguments, getPrototypeOf(this).constructor); - } - Wrapper.prototype = Object.create(Class.prototype, { - constructor: { - value: Wrapper, - enumerable: false, - writable: true, - configurable: true - } - }); - return setPrototypeOf(Wrapper, Class); - }, module.exports.__esModule = true, module.exports["default"] = module.exports; - return _wrapNativeSuper(Class); -} -module.exports = _wrapNativeSuper, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/wrapRegExp.js b/project starter code/node_modules/@babel/runtime/helpers/wrapRegExp.js deleted file mode 100644 index da710f83..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/wrapRegExp.js +++ /dev/null @@ -1,51 +0,0 @@ -var _typeof = require("./typeof.js")["default"]; -var setPrototypeOf = require("./setPrototypeOf.js"); -var inherits = require("./inherits.js"); -function _wrapRegExp() { - module.exports = _wrapRegExp = function _wrapRegExp(re, groups) { - return new BabelRegExp(re, void 0, groups); - }, module.exports.__esModule = true, module.exports["default"] = module.exports; - var _super = RegExp.prototype, - _groups = new WeakMap(); - function BabelRegExp(re, flags, groups) { - var _this = new RegExp(re, flags); - return _groups.set(_this, groups || _groups.get(re)), setPrototypeOf(_this, BabelRegExp.prototype); - } - function buildGroups(result, re) { - var g = _groups.get(re); - return Object.keys(g).reduce(function (groups, name) { - var i = g[name]; - if ("number" == typeof i) groups[name] = result[i];else { - for (var k = 0; void 0 === result[i[k]] && k + 1 < i.length;) k++; - groups[name] = result[i[k]]; - } - return groups; - }, Object.create(null)); - } - return inherits(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (str) { - var result = _super.exec.call(this, str); - if (result) { - result.groups = buildGroups(result, this); - var indices = result.indices; - indices && (indices.groups = buildGroups(indices, this)); - } - return result; - }, BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { - if ("string" == typeof substitution) { - var groups = _groups.get(this); - return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { - var group = groups[name]; - return "$" + (Array.isArray(group) ? group.join("$") : group); - })); - } - if ("function" == typeof substitution) { - var _this = this; - return _super[Symbol.replace].call(this, str, function () { - var args = arguments; - return "object" != _typeof(args[args.length - 1]) && (args = [].slice.call(args)).push(buildGroups(args, _this)), substitution.apply(this, args); - }); - } - return _super[Symbol.replace].call(this, str, substitution); - }, _wrapRegExp.apply(this, arguments); -} -module.exports = _wrapRegExp, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/helpers/writeOnlyError.js b/project starter code/node_modules/@babel/runtime/helpers/writeOnlyError.js deleted file mode 100644 index c66c6f29..00000000 --- a/project starter code/node_modules/@babel/runtime/helpers/writeOnlyError.js +++ /dev/null @@ -1,4 +0,0 @@ -function _writeOnlyError(name) { - throw new TypeError("\"" + name + "\" is write-only"); -} -module.exports = _writeOnlyError, module.exports.__esModule = true, module.exports["default"] = module.exports; \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/package.json b/project starter code/node_modules/@babel/runtime/package.json deleted file mode 100644 index 85b2cced..00000000 --- a/project starter code/node_modules/@babel/runtime/package.json +++ /dev/null @@ -1,912 +0,0 @@ -{ - "name": "@babel/runtime", - "version": "7.20.7", - "description": "babel's modular runtime helpers", - "license": "MIT", - "publishConfig": { - "access": "public" - }, - "repository": { - "type": "git", - "url": "https://github.com/babel/babel.git", - "directory": "packages/babel-runtime" - }, - "homepage": "https://babel.dev/docs/en/next/babel-runtime", - "author": "The Babel Team (https://babel.dev/team)", - "dependencies": { - "regenerator-runtime": "^0.13.11" - }, - "exports": { - "./helpers/AsyncGenerator": [ - { - "node": "./helpers/AsyncGenerator.js", - "import": "./helpers/esm/AsyncGenerator.js", - "default": "./helpers/AsyncGenerator.js" - }, - "./helpers/AsyncGenerator.js" - ], - "./helpers/esm/AsyncGenerator": "./helpers/esm/AsyncGenerator.js", - "./helpers/OverloadYield": [ - { - "node": "./helpers/OverloadYield.js", - "import": "./helpers/esm/OverloadYield.js", - "default": "./helpers/OverloadYield.js" - }, - "./helpers/OverloadYield.js" - ], - "./helpers/esm/OverloadYield": "./helpers/esm/OverloadYield.js", - "./helpers/applyDecs": [ - { - "node": "./helpers/applyDecs.js", - "import": "./helpers/esm/applyDecs.js", - "default": "./helpers/applyDecs.js" - }, - "./helpers/applyDecs.js" - ], - "./helpers/esm/applyDecs": "./helpers/esm/applyDecs.js", - "./helpers/applyDecs2203": [ - { - "node": "./helpers/applyDecs2203.js", - "import": "./helpers/esm/applyDecs2203.js", - "default": "./helpers/applyDecs2203.js" - }, - "./helpers/applyDecs2203.js" - ], - "./helpers/esm/applyDecs2203": "./helpers/esm/applyDecs2203.js", - "./helpers/asyncGeneratorDelegate": [ - { - "node": "./helpers/asyncGeneratorDelegate.js", - "import": "./helpers/esm/asyncGeneratorDelegate.js", - "default": "./helpers/asyncGeneratorDelegate.js" - }, - "./helpers/asyncGeneratorDelegate.js" - ], - "./helpers/esm/asyncGeneratorDelegate": "./helpers/esm/asyncGeneratorDelegate.js", - "./helpers/asyncIterator": [ - { - "node": "./helpers/asyncIterator.js", - "import": "./helpers/esm/asyncIterator.js", - "default": "./helpers/asyncIterator.js" - }, - "./helpers/asyncIterator.js" - ], - "./helpers/esm/asyncIterator": "./helpers/esm/asyncIterator.js", - "./helpers/awaitAsyncGenerator": [ - { - "node": "./helpers/awaitAsyncGenerator.js", - "import": "./helpers/esm/awaitAsyncGenerator.js", - "default": "./helpers/awaitAsyncGenerator.js" - }, - "./helpers/awaitAsyncGenerator.js" - ], - "./helpers/esm/awaitAsyncGenerator": "./helpers/esm/awaitAsyncGenerator.js", - "./helpers/checkInRHS": [ - { - "node": "./helpers/checkInRHS.js", - "import": "./helpers/esm/checkInRHS.js", - "default": "./helpers/checkInRHS.js" - }, - "./helpers/checkInRHS.js" - ], - "./helpers/esm/checkInRHS": "./helpers/esm/checkInRHS.js", - "./helpers/defineAccessor": [ - { - "node": "./helpers/defineAccessor.js", - "import": "./helpers/esm/defineAccessor.js", - "default": "./helpers/defineAccessor.js" - }, - "./helpers/defineAccessor.js" - ], - "./helpers/esm/defineAccessor": "./helpers/esm/defineAccessor.js", - "./helpers/iterableToArrayLimit": [ - { - "node": "./helpers/iterableToArrayLimit.js", - "import": "./helpers/esm/iterableToArrayLimit.js", - "default": "./helpers/iterableToArrayLimit.js" - }, - "./helpers/iterableToArrayLimit.js" - ], - "./helpers/esm/iterableToArrayLimit": "./helpers/esm/iterableToArrayLimit.js", - "./helpers/iterableToArrayLimitLoose": [ - { - "node": "./helpers/iterableToArrayLimitLoose.js", - "import": "./helpers/esm/iterableToArrayLimitLoose.js", - "default": "./helpers/iterableToArrayLimitLoose.js" - }, - "./helpers/iterableToArrayLimitLoose.js" - ], - "./helpers/esm/iterableToArrayLimitLoose": "./helpers/esm/iterableToArrayLimitLoose.js", - "./helpers/jsx": [ - { - "node": "./helpers/jsx.js", - "import": "./helpers/esm/jsx.js", - "default": "./helpers/jsx.js" - }, - "./helpers/jsx.js" - ], - "./helpers/esm/jsx": "./helpers/esm/jsx.js", - "./helpers/objectSpread2": [ - { - "node": "./helpers/objectSpread2.js", - "import": "./helpers/esm/objectSpread2.js", - "default": "./helpers/objectSpread2.js" - }, - "./helpers/objectSpread2.js" - ], - "./helpers/esm/objectSpread2": "./helpers/esm/objectSpread2.js", - "./helpers/regeneratorRuntime": [ - { - "node": "./helpers/regeneratorRuntime.js", - "import": "./helpers/esm/regeneratorRuntime.js", - "default": "./helpers/regeneratorRuntime.js" - }, - "./helpers/regeneratorRuntime.js" - ], - "./helpers/esm/regeneratorRuntime": "./helpers/esm/regeneratorRuntime.js", - "./helpers/typeof": [ - { - "node": "./helpers/typeof.js", - "import": "./helpers/esm/typeof.js", - "default": "./helpers/typeof.js" - }, - "./helpers/typeof.js" - ], - "./helpers/esm/typeof": "./helpers/esm/typeof.js", - "./helpers/wrapRegExp": [ - { - "node": "./helpers/wrapRegExp.js", - "import": "./helpers/esm/wrapRegExp.js", - "default": "./helpers/wrapRegExp.js" - }, - "./helpers/wrapRegExp.js" - ], - "./helpers/esm/wrapRegExp": "./helpers/esm/wrapRegExp.js", - "./helpers/AwaitValue": [ - { - "node": "./helpers/AwaitValue.js", - "import": "./helpers/esm/AwaitValue.js", - "default": "./helpers/AwaitValue.js" - }, - "./helpers/AwaitValue.js" - ], - "./helpers/esm/AwaitValue": "./helpers/esm/AwaitValue.js", - "./helpers/wrapAsyncGenerator": [ - { - "node": "./helpers/wrapAsyncGenerator.js", - "import": "./helpers/esm/wrapAsyncGenerator.js", - "default": "./helpers/wrapAsyncGenerator.js" - }, - "./helpers/wrapAsyncGenerator.js" - ], - "./helpers/esm/wrapAsyncGenerator": "./helpers/esm/wrapAsyncGenerator.js", - "./helpers/asyncToGenerator": [ - { - "node": "./helpers/asyncToGenerator.js", - "import": "./helpers/esm/asyncToGenerator.js", - "default": "./helpers/asyncToGenerator.js" - }, - "./helpers/asyncToGenerator.js" - ], - "./helpers/esm/asyncToGenerator": "./helpers/esm/asyncToGenerator.js", - "./helpers/classCallCheck": [ - { - "node": "./helpers/classCallCheck.js", - "import": "./helpers/esm/classCallCheck.js", - "default": "./helpers/classCallCheck.js" - }, - "./helpers/classCallCheck.js" - ], - "./helpers/esm/classCallCheck": "./helpers/esm/classCallCheck.js", - "./helpers/createClass": [ - { - "node": "./helpers/createClass.js", - "import": "./helpers/esm/createClass.js", - "default": "./helpers/createClass.js" - }, - "./helpers/createClass.js" - ], - "./helpers/esm/createClass": "./helpers/esm/createClass.js", - "./helpers/defineEnumerableProperties": [ - { - "node": "./helpers/defineEnumerableProperties.js", - "import": "./helpers/esm/defineEnumerableProperties.js", - "default": "./helpers/defineEnumerableProperties.js" - }, - "./helpers/defineEnumerableProperties.js" - ], - "./helpers/esm/defineEnumerableProperties": "./helpers/esm/defineEnumerableProperties.js", - "./helpers/defaults": [ - { - "node": "./helpers/defaults.js", - "import": "./helpers/esm/defaults.js", - "default": "./helpers/defaults.js" - }, - "./helpers/defaults.js" - ], - "./helpers/esm/defaults": "./helpers/esm/defaults.js", - "./helpers/defineProperty": [ - { - "node": "./helpers/defineProperty.js", - "import": "./helpers/esm/defineProperty.js", - "default": "./helpers/defineProperty.js" - }, - "./helpers/defineProperty.js" - ], - "./helpers/esm/defineProperty": "./helpers/esm/defineProperty.js", - "./helpers/extends": [ - { - "node": "./helpers/extends.js", - "import": "./helpers/esm/extends.js", - "default": "./helpers/extends.js" - }, - "./helpers/extends.js" - ], - "./helpers/esm/extends": "./helpers/esm/extends.js", - "./helpers/objectSpread": [ - { - "node": "./helpers/objectSpread.js", - "import": "./helpers/esm/objectSpread.js", - "default": "./helpers/objectSpread.js" - }, - "./helpers/objectSpread.js" - ], - "./helpers/esm/objectSpread": "./helpers/esm/objectSpread.js", - "./helpers/inherits": [ - { - "node": "./helpers/inherits.js", - "import": "./helpers/esm/inherits.js", - "default": "./helpers/inherits.js" - }, - "./helpers/inherits.js" - ], - "./helpers/esm/inherits": "./helpers/esm/inherits.js", - "./helpers/inheritsLoose": [ - { - "node": "./helpers/inheritsLoose.js", - "import": "./helpers/esm/inheritsLoose.js", - "default": "./helpers/inheritsLoose.js" - }, - "./helpers/inheritsLoose.js" - ], - "./helpers/esm/inheritsLoose": "./helpers/esm/inheritsLoose.js", - "./helpers/getPrototypeOf": [ - { - "node": "./helpers/getPrototypeOf.js", - "import": "./helpers/esm/getPrototypeOf.js", - "default": "./helpers/getPrototypeOf.js" - }, - "./helpers/getPrototypeOf.js" - ], - "./helpers/esm/getPrototypeOf": "./helpers/esm/getPrototypeOf.js", - "./helpers/setPrototypeOf": [ - { - "node": "./helpers/setPrototypeOf.js", - "import": "./helpers/esm/setPrototypeOf.js", - "default": "./helpers/setPrototypeOf.js" - }, - "./helpers/setPrototypeOf.js" - ], - "./helpers/esm/setPrototypeOf": "./helpers/esm/setPrototypeOf.js", - "./helpers/isNativeReflectConstruct": [ - { - "node": "./helpers/isNativeReflectConstruct.js", - "import": "./helpers/esm/isNativeReflectConstruct.js", - "default": "./helpers/isNativeReflectConstruct.js" - }, - "./helpers/isNativeReflectConstruct.js" - ], - "./helpers/esm/isNativeReflectConstruct": "./helpers/esm/isNativeReflectConstruct.js", - "./helpers/construct": [ - { - "node": "./helpers/construct.js", - "import": "./helpers/esm/construct.js", - "default": "./helpers/construct.js" - }, - "./helpers/construct.js" - ], - "./helpers/esm/construct": "./helpers/esm/construct.js", - "./helpers/isNativeFunction": [ - { - "node": "./helpers/isNativeFunction.js", - "import": "./helpers/esm/isNativeFunction.js", - "default": "./helpers/isNativeFunction.js" - }, - "./helpers/isNativeFunction.js" - ], - "./helpers/esm/isNativeFunction": "./helpers/esm/isNativeFunction.js", - "./helpers/wrapNativeSuper": [ - { - "node": "./helpers/wrapNativeSuper.js", - "import": "./helpers/esm/wrapNativeSuper.js", - "default": "./helpers/wrapNativeSuper.js" - }, - "./helpers/wrapNativeSuper.js" - ], - "./helpers/esm/wrapNativeSuper": "./helpers/esm/wrapNativeSuper.js", - "./helpers/instanceof": [ - { - "node": "./helpers/instanceof.js", - "import": "./helpers/esm/instanceof.js", - "default": "./helpers/instanceof.js" - }, - "./helpers/instanceof.js" - ], - "./helpers/esm/instanceof": "./helpers/esm/instanceof.js", - "./helpers/interopRequireDefault": [ - { - "node": "./helpers/interopRequireDefault.js", - "import": "./helpers/esm/interopRequireDefault.js", - "default": "./helpers/interopRequireDefault.js" - }, - "./helpers/interopRequireDefault.js" - ], - "./helpers/esm/interopRequireDefault": "./helpers/esm/interopRequireDefault.js", - "./helpers/interopRequireWildcard": [ - { - "node": "./helpers/interopRequireWildcard.js", - "import": "./helpers/esm/interopRequireWildcard.js", - "default": "./helpers/interopRequireWildcard.js" - }, - "./helpers/interopRequireWildcard.js" - ], - "./helpers/esm/interopRequireWildcard": "./helpers/esm/interopRequireWildcard.js", - "./helpers/newArrowCheck": [ - { - "node": "./helpers/newArrowCheck.js", - "import": "./helpers/esm/newArrowCheck.js", - "default": "./helpers/newArrowCheck.js" - }, - "./helpers/newArrowCheck.js" - ], - "./helpers/esm/newArrowCheck": "./helpers/esm/newArrowCheck.js", - "./helpers/objectDestructuringEmpty": [ - { - "node": "./helpers/objectDestructuringEmpty.js", - "import": "./helpers/esm/objectDestructuringEmpty.js", - "default": "./helpers/objectDestructuringEmpty.js" - }, - "./helpers/objectDestructuringEmpty.js" - ], - "./helpers/esm/objectDestructuringEmpty": "./helpers/esm/objectDestructuringEmpty.js", - "./helpers/objectWithoutPropertiesLoose": [ - { - "node": "./helpers/objectWithoutPropertiesLoose.js", - "import": "./helpers/esm/objectWithoutPropertiesLoose.js", - "default": "./helpers/objectWithoutPropertiesLoose.js" - }, - "./helpers/objectWithoutPropertiesLoose.js" - ], - "./helpers/esm/objectWithoutPropertiesLoose": "./helpers/esm/objectWithoutPropertiesLoose.js", - "./helpers/objectWithoutProperties": [ - { - "node": "./helpers/objectWithoutProperties.js", - "import": "./helpers/esm/objectWithoutProperties.js", - "default": "./helpers/objectWithoutProperties.js" - }, - "./helpers/objectWithoutProperties.js" - ], - "./helpers/esm/objectWithoutProperties": "./helpers/esm/objectWithoutProperties.js", - "./helpers/assertThisInitialized": [ - { - "node": "./helpers/assertThisInitialized.js", - "import": "./helpers/esm/assertThisInitialized.js", - "default": "./helpers/assertThisInitialized.js" - }, - "./helpers/assertThisInitialized.js" - ], - "./helpers/esm/assertThisInitialized": "./helpers/esm/assertThisInitialized.js", - "./helpers/possibleConstructorReturn": [ - { - "node": "./helpers/possibleConstructorReturn.js", - "import": "./helpers/esm/possibleConstructorReturn.js", - "default": "./helpers/possibleConstructorReturn.js" - }, - "./helpers/possibleConstructorReturn.js" - ], - "./helpers/esm/possibleConstructorReturn": "./helpers/esm/possibleConstructorReturn.js", - "./helpers/createSuper": [ - { - "node": "./helpers/createSuper.js", - "import": "./helpers/esm/createSuper.js", - "default": "./helpers/createSuper.js" - }, - "./helpers/createSuper.js" - ], - "./helpers/esm/createSuper": "./helpers/esm/createSuper.js", - "./helpers/superPropBase": [ - { - "node": "./helpers/superPropBase.js", - "import": "./helpers/esm/superPropBase.js", - "default": "./helpers/superPropBase.js" - }, - "./helpers/superPropBase.js" - ], - "./helpers/esm/superPropBase": "./helpers/esm/superPropBase.js", - "./helpers/get": [ - { - "node": "./helpers/get.js", - "import": "./helpers/esm/get.js", - "default": "./helpers/get.js" - }, - "./helpers/get.js" - ], - "./helpers/esm/get": "./helpers/esm/get.js", - "./helpers/set": [ - { - "node": "./helpers/set.js", - "import": "./helpers/esm/set.js", - "default": "./helpers/set.js" - }, - "./helpers/set.js" - ], - "./helpers/esm/set": "./helpers/esm/set.js", - "./helpers/taggedTemplateLiteral": [ - { - "node": "./helpers/taggedTemplateLiteral.js", - "import": "./helpers/esm/taggedTemplateLiteral.js", - "default": "./helpers/taggedTemplateLiteral.js" - }, - "./helpers/taggedTemplateLiteral.js" - ], - "./helpers/esm/taggedTemplateLiteral": "./helpers/esm/taggedTemplateLiteral.js", - "./helpers/taggedTemplateLiteralLoose": [ - { - "node": "./helpers/taggedTemplateLiteralLoose.js", - "import": "./helpers/esm/taggedTemplateLiteralLoose.js", - "default": "./helpers/taggedTemplateLiteralLoose.js" - }, - "./helpers/taggedTemplateLiteralLoose.js" - ], - "./helpers/esm/taggedTemplateLiteralLoose": "./helpers/esm/taggedTemplateLiteralLoose.js", - "./helpers/readOnlyError": [ - { - "node": "./helpers/readOnlyError.js", - "import": "./helpers/esm/readOnlyError.js", - "default": "./helpers/readOnlyError.js" - }, - "./helpers/readOnlyError.js" - ], - "./helpers/esm/readOnlyError": "./helpers/esm/readOnlyError.js", - "./helpers/writeOnlyError": [ - { - "node": "./helpers/writeOnlyError.js", - "import": "./helpers/esm/writeOnlyError.js", - "default": "./helpers/writeOnlyError.js" - }, - "./helpers/writeOnlyError.js" - ], - "./helpers/esm/writeOnlyError": "./helpers/esm/writeOnlyError.js", - "./helpers/classNameTDZError": [ - { - "node": "./helpers/classNameTDZError.js", - "import": "./helpers/esm/classNameTDZError.js", - "default": "./helpers/classNameTDZError.js" - }, - "./helpers/classNameTDZError.js" - ], - "./helpers/esm/classNameTDZError": "./helpers/esm/classNameTDZError.js", - "./helpers/temporalUndefined": [ - { - "node": "./helpers/temporalUndefined.js", - "import": "./helpers/esm/temporalUndefined.js", - "default": "./helpers/temporalUndefined.js" - }, - "./helpers/temporalUndefined.js" - ], - "./helpers/esm/temporalUndefined": "./helpers/esm/temporalUndefined.js", - "./helpers/tdz": [ - { - "node": "./helpers/tdz.js", - "import": "./helpers/esm/tdz.js", - "default": "./helpers/tdz.js" - }, - "./helpers/tdz.js" - ], - "./helpers/esm/tdz": "./helpers/esm/tdz.js", - "./helpers/temporalRef": [ - { - "node": "./helpers/temporalRef.js", - "import": "./helpers/esm/temporalRef.js", - "default": "./helpers/temporalRef.js" - }, - "./helpers/temporalRef.js" - ], - "./helpers/esm/temporalRef": "./helpers/esm/temporalRef.js", - "./helpers/slicedToArray": [ - { - "node": "./helpers/slicedToArray.js", - "import": "./helpers/esm/slicedToArray.js", - "default": "./helpers/slicedToArray.js" - }, - "./helpers/slicedToArray.js" - ], - "./helpers/esm/slicedToArray": "./helpers/esm/slicedToArray.js", - "./helpers/slicedToArrayLoose": [ - { - "node": "./helpers/slicedToArrayLoose.js", - "import": "./helpers/esm/slicedToArrayLoose.js", - "default": "./helpers/slicedToArrayLoose.js" - }, - "./helpers/slicedToArrayLoose.js" - ], - "./helpers/esm/slicedToArrayLoose": "./helpers/esm/slicedToArrayLoose.js", - "./helpers/toArray": [ - { - "node": "./helpers/toArray.js", - "import": "./helpers/esm/toArray.js", - "default": "./helpers/toArray.js" - }, - "./helpers/toArray.js" - ], - "./helpers/esm/toArray": "./helpers/esm/toArray.js", - "./helpers/toConsumableArray": [ - { - "node": "./helpers/toConsumableArray.js", - "import": "./helpers/esm/toConsumableArray.js", - "default": "./helpers/toConsumableArray.js" - }, - "./helpers/toConsumableArray.js" - ], - "./helpers/esm/toConsumableArray": "./helpers/esm/toConsumableArray.js", - "./helpers/arrayWithoutHoles": [ - { - "node": "./helpers/arrayWithoutHoles.js", - "import": "./helpers/esm/arrayWithoutHoles.js", - "default": "./helpers/arrayWithoutHoles.js" - }, - "./helpers/arrayWithoutHoles.js" - ], - "./helpers/esm/arrayWithoutHoles": "./helpers/esm/arrayWithoutHoles.js", - "./helpers/arrayWithHoles": [ - { - "node": "./helpers/arrayWithHoles.js", - "import": "./helpers/esm/arrayWithHoles.js", - "default": "./helpers/arrayWithHoles.js" - }, - "./helpers/arrayWithHoles.js" - ], - "./helpers/esm/arrayWithHoles": "./helpers/esm/arrayWithHoles.js", - "./helpers/maybeArrayLike": [ - { - "node": "./helpers/maybeArrayLike.js", - "import": "./helpers/esm/maybeArrayLike.js", - "default": "./helpers/maybeArrayLike.js" - }, - "./helpers/maybeArrayLike.js" - ], - "./helpers/esm/maybeArrayLike": "./helpers/esm/maybeArrayLike.js", - "./helpers/iterableToArray": [ - { - "node": "./helpers/iterableToArray.js", - "import": "./helpers/esm/iterableToArray.js", - "default": "./helpers/iterableToArray.js" - }, - "./helpers/iterableToArray.js" - ], - "./helpers/esm/iterableToArray": "./helpers/esm/iterableToArray.js", - "./helpers/unsupportedIterableToArray": [ - { - "node": "./helpers/unsupportedIterableToArray.js", - "import": "./helpers/esm/unsupportedIterableToArray.js", - "default": "./helpers/unsupportedIterableToArray.js" - }, - "./helpers/unsupportedIterableToArray.js" - ], - "./helpers/esm/unsupportedIterableToArray": "./helpers/esm/unsupportedIterableToArray.js", - "./helpers/arrayLikeToArray": [ - { - "node": "./helpers/arrayLikeToArray.js", - "import": "./helpers/esm/arrayLikeToArray.js", - "default": "./helpers/arrayLikeToArray.js" - }, - "./helpers/arrayLikeToArray.js" - ], - "./helpers/esm/arrayLikeToArray": "./helpers/esm/arrayLikeToArray.js", - "./helpers/nonIterableSpread": [ - { - "node": "./helpers/nonIterableSpread.js", - "import": "./helpers/esm/nonIterableSpread.js", - "default": "./helpers/nonIterableSpread.js" - }, - "./helpers/nonIterableSpread.js" - ], - "./helpers/esm/nonIterableSpread": "./helpers/esm/nonIterableSpread.js", - "./helpers/nonIterableRest": [ - { - "node": "./helpers/nonIterableRest.js", - "import": "./helpers/esm/nonIterableRest.js", - "default": "./helpers/nonIterableRest.js" - }, - "./helpers/nonIterableRest.js" - ], - "./helpers/esm/nonIterableRest": "./helpers/esm/nonIterableRest.js", - "./helpers/createForOfIteratorHelper": [ - { - "node": "./helpers/createForOfIteratorHelper.js", - "import": "./helpers/esm/createForOfIteratorHelper.js", - "default": "./helpers/createForOfIteratorHelper.js" - }, - "./helpers/createForOfIteratorHelper.js" - ], - "./helpers/esm/createForOfIteratorHelper": "./helpers/esm/createForOfIteratorHelper.js", - "./helpers/createForOfIteratorHelperLoose": [ - { - "node": "./helpers/createForOfIteratorHelperLoose.js", - "import": "./helpers/esm/createForOfIteratorHelperLoose.js", - "default": "./helpers/createForOfIteratorHelperLoose.js" - }, - "./helpers/createForOfIteratorHelperLoose.js" - ], - "./helpers/esm/createForOfIteratorHelperLoose": "./helpers/esm/createForOfIteratorHelperLoose.js", - "./helpers/skipFirstGeneratorNext": [ - { - "node": "./helpers/skipFirstGeneratorNext.js", - "import": "./helpers/esm/skipFirstGeneratorNext.js", - "default": "./helpers/skipFirstGeneratorNext.js" - }, - "./helpers/skipFirstGeneratorNext.js" - ], - "./helpers/esm/skipFirstGeneratorNext": "./helpers/esm/skipFirstGeneratorNext.js", - "./helpers/toPrimitive": [ - { - "node": "./helpers/toPrimitive.js", - "import": "./helpers/esm/toPrimitive.js", - "default": "./helpers/toPrimitive.js" - }, - "./helpers/toPrimitive.js" - ], - "./helpers/esm/toPrimitive": "./helpers/esm/toPrimitive.js", - "./helpers/toPropertyKey": [ - { - "node": "./helpers/toPropertyKey.js", - "import": "./helpers/esm/toPropertyKey.js", - "default": "./helpers/toPropertyKey.js" - }, - "./helpers/toPropertyKey.js" - ], - "./helpers/esm/toPropertyKey": "./helpers/esm/toPropertyKey.js", - "./helpers/initializerWarningHelper": [ - { - "node": "./helpers/initializerWarningHelper.js", - "import": "./helpers/esm/initializerWarningHelper.js", - "default": "./helpers/initializerWarningHelper.js" - }, - "./helpers/initializerWarningHelper.js" - ], - "./helpers/esm/initializerWarningHelper": "./helpers/esm/initializerWarningHelper.js", - "./helpers/initializerDefineProperty": [ - { - "node": "./helpers/initializerDefineProperty.js", - "import": "./helpers/esm/initializerDefineProperty.js", - "default": "./helpers/initializerDefineProperty.js" - }, - "./helpers/initializerDefineProperty.js" - ], - "./helpers/esm/initializerDefineProperty": "./helpers/esm/initializerDefineProperty.js", - "./helpers/applyDecoratedDescriptor": [ - { - "node": "./helpers/applyDecoratedDescriptor.js", - "import": "./helpers/esm/applyDecoratedDescriptor.js", - "default": "./helpers/applyDecoratedDescriptor.js" - }, - "./helpers/applyDecoratedDescriptor.js" - ], - "./helpers/esm/applyDecoratedDescriptor": "./helpers/esm/applyDecoratedDescriptor.js", - "./helpers/classPrivateFieldLooseKey": [ - { - "node": "./helpers/classPrivateFieldLooseKey.js", - "import": "./helpers/esm/classPrivateFieldLooseKey.js", - "default": "./helpers/classPrivateFieldLooseKey.js" - }, - "./helpers/classPrivateFieldLooseKey.js" - ], - "./helpers/esm/classPrivateFieldLooseKey": "./helpers/esm/classPrivateFieldLooseKey.js", - "./helpers/classPrivateFieldLooseBase": [ - { - "node": "./helpers/classPrivateFieldLooseBase.js", - "import": "./helpers/esm/classPrivateFieldLooseBase.js", - "default": "./helpers/classPrivateFieldLooseBase.js" - }, - "./helpers/classPrivateFieldLooseBase.js" - ], - "./helpers/esm/classPrivateFieldLooseBase": "./helpers/esm/classPrivateFieldLooseBase.js", - "./helpers/classPrivateFieldGet": [ - { - "node": "./helpers/classPrivateFieldGet.js", - "import": "./helpers/esm/classPrivateFieldGet.js", - "default": "./helpers/classPrivateFieldGet.js" - }, - "./helpers/classPrivateFieldGet.js" - ], - "./helpers/esm/classPrivateFieldGet": "./helpers/esm/classPrivateFieldGet.js", - "./helpers/classPrivateFieldSet": [ - { - "node": "./helpers/classPrivateFieldSet.js", - "import": "./helpers/esm/classPrivateFieldSet.js", - "default": "./helpers/classPrivateFieldSet.js" - }, - "./helpers/classPrivateFieldSet.js" - ], - "./helpers/esm/classPrivateFieldSet": "./helpers/esm/classPrivateFieldSet.js", - "./helpers/classPrivateFieldDestructureSet": [ - { - "node": "./helpers/classPrivateFieldDestructureSet.js", - "import": "./helpers/esm/classPrivateFieldDestructureSet.js", - "default": "./helpers/classPrivateFieldDestructureSet.js" - }, - "./helpers/classPrivateFieldDestructureSet.js" - ], - "./helpers/esm/classPrivateFieldDestructureSet": "./helpers/esm/classPrivateFieldDestructureSet.js", - "./helpers/classExtractFieldDescriptor": [ - { - "node": "./helpers/classExtractFieldDescriptor.js", - "import": "./helpers/esm/classExtractFieldDescriptor.js", - "default": "./helpers/classExtractFieldDescriptor.js" - }, - "./helpers/classExtractFieldDescriptor.js" - ], - "./helpers/esm/classExtractFieldDescriptor": "./helpers/esm/classExtractFieldDescriptor.js", - "./helpers/classStaticPrivateFieldSpecGet": [ - { - "node": "./helpers/classStaticPrivateFieldSpecGet.js", - "import": "./helpers/esm/classStaticPrivateFieldSpecGet.js", - "default": "./helpers/classStaticPrivateFieldSpecGet.js" - }, - "./helpers/classStaticPrivateFieldSpecGet.js" - ], - "./helpers/esm/classStaticPrivateFieldSpecGet": "./helpers/esm/classStaticPrivateFieldSpecGet.js", - "./helpers/classStaticPrivateFieldSpecSet": [ - { - "node": "./helpers/classStaticPrivateFieldSpecSet.js", - "import": "./helpers/esm/classStaticPrivateFieldSpecSet.js", - "default": "./helpers/classStaticPrivateFieldSpecSet.js" - }, - "./helpers/classStaticPrivateFieldSpecSet.js" - ], - "./helpers/esm/classStaticPrivateFieldSpecSet": "./helpers/esm/classStaticPrivateFieldSpecSet.js", - "./helpers/classStaticPrivateMethodGet": [ - { - "node": "./helpers/classStaticPrivateMethodGet.js", - "import": "./helpers/esm/classStaticPrivateMethodGet.js", - "default": "./helpers/classStaticPrivateMethodGet.js" - }, - "./helpers/classStaticPrivateMethodGet.js" - ], - "./helpers/esm/classStaticPrivateMethodGet": "./helpers/esm/classStaticPrivateMethodGet.js", - "./helpers/classStaticPrivateMethodSet": [ - { - "node": "./helpers/classStaticPrivateMethodSet.js", - "import": "./helpers/esm/classStaticPrivateMethodSet.js", - "default": "./helpers/classStaticPrivateMethodSet.js" - }, - "./helpers/classStaticPrivateMethodSet.js" - ], - "./helpers/esm/classStaticPrivateMethodSet": "./helpers/esm/classStaticPrivateMethodSet.js", - "./helpers/classApplyDescriptorGet": [ - { - "node": "./helpers/classApplyDescriptorGet.js", - "import": "./helpers/esm/classApplyDescriptorGet.js", - "default": "./helpers/classApplyDescriptorGet.js" - }, - "./helpers/classApplyDescriptorGet.js" - ], - "./helpers/esm/classApplyDescriptorGet": "./helpers/esm/classApplyDescriptorGet.js", - "./helpers/classApplyDescriptorSet": [ - { - "node": "./helpers/classApplyDescriptorSet.js", - "import": "./helpers/esm/classApplyDescriptorSet.js", - "default": "./helpers/classApplyDescriptorSet.js" - }, - "./helpers/classApplyDescriptorSet.js" - ], - "./helpers/esm/classApplyDescriptorSet": "./helpers/esm/classApplyDescriptorSet.js", - "./helpers/classApplyDescriptorDestructureSet": [ - { - "node": "./helpers/classApplyDescriptorDestructureSet.js", - "import": "./helpers/esm/classApplyDescriptorDestructureSet.js", - "default": "./helpers/classApplyDescriptorDestructureSet.js" - }, - "./helpers/classApplyDescriptorDestructureSet.js" - ], - "./helpers/esm/classApplyDescriptorDestructureSet": "./helpers/esm/classApplyDescriptorDestructureSet.js", - "./helpers/classStaticPrivateFieldDestructureSet": [ - { - "node": "./helpers/classStaticPrivateFieldDestructureSet.js", - "import": "./helpers/esm/classStaticPrivateFieldDestructureSet.js", - "default": "./helpers/classStaticPrivateFieldDestructureSet.js" - }, - "./helpers/classStaticPrivateFieldDestructureSet.js" - ], - "./helpers/esm/classStaticPrivateFieldDestructureSet": "./helpers/esm/classStaticPrivateFieldDestructureSet.js", - "./helpers/classCheckPrivateStaticAccess": [ - { - "node": "./helpers/classCheckPrivateStaticAccess.js", - "import": "./helpers/esm/classCheckPrivateStaticAccess.js", - "default": "./helpers/classCheckPrivateStaticAccess.js" - }, - "./helpers/classCheckPrivateStaticAccess.js" - ], - "./helpers/esm/classCheckPrivateStaticAccess": "./helpers/esm/classCheckPrivateStaticAccess.js", - "./helpers/classCheckPrivateStaticFieldDescriptor": [ - { - "node": "./helpers/classCheckPrivateStaticFieldDescriptor.js", - "import": "./helpers/esm/classCheckPrivateStaticFieldDescriptor.js", - "default": "./helpers/classCheckPrivateStaticFieldDescriptor.js" - }, - "./helpers/classCheckPrivateStaticFieldDescriptor.js" - ], - "./helpers/esm/classCheckPrivateStaticFieldDescriptor": "./helpers/esm/classCheckPrivateStaticFieldDescriptor.js", - "./helpers/decorate": [ - { - "node": "./helpers/decorate.js", - "import": "./helpers/esm/decorate.js", - "default": "./helpers/decorate.js" - }, - "./helpers/decorate.js" - ], - "./helpers/esm/decorate": "./helpers/esm/decorate.js", - "./helpers/classPrivateMethodGet": [ - { - "node": "./helpers/classPrivateMethodGet.js", - "import": "./helpers/esm/classPrivateMethodGet.js", - "default": "./helpers/classPrivateMethodGet.js" - }, - "./helpers/classPrivateMethodGet.js" - ], - "./helpers/esm/classPrivateMethodGet": "./helpers/esm/classPrivateMethodGet.js", - "./helpers/checkPrivateRedeclaration": [ - { - "node": "./helpers/checkPrivateRedeclaration.js", - "import": "./helpers/esm/checkPrivateRedeclaration.js", - "default": "./helpers/checkPrivateRedeclaration.js" - }, - "./helpers/checkPrivateRedeclaration.js" - ], - "./helpers/esm/checkPrivateRedeclaration": "./helpers/esm/checkPrivateRedeclaration.js", - "./helpers/classPrivateFieldInitSpec": [ - { - "node": "./helpers/classPrivateFieldInitSpec.js", - "import": "./helpers/esm/classPrivateFieldInitSpec.js", - "default": "./helpers/classPrivateFieldInitSpec.js" - }, - "./helpers/classPrivateFieldInitSpec.js" - ], - "./helpers/esm/classPrivateFieldInitSpec": "./helpers/esm/classPrivateFieldInitSpec.js", - "./helpers/classPrivateMethodInitSpec": [ - { - "node": "./helpers/classPrivateMethodInitSpec.js", - "import": "./helpers/esm/classPrivateMethodInitSpec.js", - "default": "./helpers/classPrivateMethodInitSpec.js" - }, - "./helpers/classPrivateMethodInitSpec.js" - ], - "./helpers/esm/classPrivateMethodInitSpec": "./helpers/esm/classPrivateMethodInitSpec.js", - "./helpers/classPrivateMethodSet": [ - { - "node": "./helpers/classPrivateMethodSet.js", - "import": "./helpers/esm/classPrivateMethodSet.js", - "default": "./helpers/classPrivateMethodSet.js" - }, - "./helpers/classPrivateMethodSet.js" - ], - "./helpers/esm/classPrivateMethodSet": "./helpers/esm/classPrivateMethodSet.js", - "./helpers/identity": [ - { - "node": "./helpers/identity.js", - "import": "./helpers/esm/identity.js", - "default": "./helpers/identity.js" - }, - "./helpers/identity.js" - ], - "./helpers/esm/identity": "./helpers/esm/identity.js", - "./package": "./package.json", - "./package.json": "./package.json", - "./regenerator": "./regenerator/index.js", - "./regenerator/*.js": "./regenerator/*.js", - "./regenerator/": "./regenerator/" - }, - "engines": { - "node": ">=6.9.0" - }, - "type": "commonjs" -} \ No newline at end of file diff --git a/project starter code/node_modules/@babel/runtime/regenerator/index.js b/project starter code/node_modules/@babel/runtime/regenerator/index.js deleted file mode 100644 index 58813573..00000000 --- a/project starter code/node_modules/@babel/runtime/regenerator/index.js +++ /dev/null @@ -1,15 +0,0 @@ -// TODO(Babel 8): Remove this file. - -var runtime = require("../helpers/regeneratorRuntime")(); -module.exports = runtime; - -// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736= -try { - regeneratorRuntime = runtime; -} catch (accidentalStrictMode) { - if (typeof globalThis === "object") { - globalThis.regeneratorRuntime = runtime; - } else { - Function("r", "regeneratorRuntime = r")(runtime); - } -} diff --git a/project starter code/node_modules/@jimp/bmp/CHANGELOG.md b/project starter code/node_modules/@jimp/bmp/CHANGELOG.md index 26394e0f..3d839517 100644 --- a/project starter code/node_modules/@jimp/bmp/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/bmp/CHANGELOG.md @@ -1,3 +1,65 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.22.0 (Mon Feb 06 2023) + +#### 🏠 Internal + +- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Daniel Holmes ([@danielholmes](https://github.com/danielholmes)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -12,7 +74,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -20,4 +82,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/bmp/dist/index.js b/project starter code/node_modules/@jimp/bmp/dist/index.js index 977f85d0..e0ff7281 100644 --- a/project starter code/node_modules/@jimp/bmp/dist/index.js +++ b/project starter code/node_modules/@jimp/bmp/dist/index.js @@ -1,71 +1,60 @@ "use strict"; -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - +exports.default = void 0; var _bmpJs = _interopRequireDefault(require("bmp-js")); - var _utils = require("@jimp/utils"); - -var MIME_TYPE = 'image/bmp'; -var MIME_TYPE_SECOND = 'image/x-ms-bmp'; - +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +const MIME_TYPE = "image/bmp"; +const MIME_TYPE_SECOND = "image/x-ms-bmp"; function toAGBR(image) { return (0, _utils.scan)(image, 0, 0, image.bitmap.width, image.bitmap.height, function (x, y, index) { - var red = this.bitmap.data[index + 0]; - var green = this.bitmap.data[index + 1]; - var blue = this.bitmap.data[index + 2]; - var alpha = this.bitmap.data[index + 3]; + const red = this.bitmap.data[index + 0]; + const green = this.bitmap.data[index + 1]; + const blue = this.bitmap.data[index + 2]; + const alpha = this.bitmap.data[index + 3]; this.bitmap.data[index + 0] = alpha; this.bitmap.data[index + 1] = blue; this.bitmap.data[index + 2] = green; this.bitmap.data[index + 3] = red; }).bitmap; } - function fromAGBR(bitmap) { return (0, _utils.scan)({ - bitmap: bitmap + bitmap }, 0, 0, bitmap.width, bitmap.height, function (x, y, index) { - var alpha = this.bitmap.data[index + 0]; - var blue = this.bitmap.data[index + 1]; - var green = this.bitmap.data[index + 2]; - var red = this.bitmap.data[index + 3]; + const alpha = this.bitmap.data[index + 0]; + const blue = this.bitmap.data[index + 1]; + const green = this.bitmap.data[index + 2]; + const red = this.bitmap.data[index + 3]; this.bitmap.data[index + 0] = red; this.bitmap.data[index + 1] = green; this.bitmap.data[index + 2] = blue; this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff; }).bitmap; } - -var decode = function decode(data) { - return fromAGBR(_bmpJs["default"].decode(data)); -}; - -var encode = function encode(image) { - return _bmpJs["default"].encode(toAGBR(image)).data; -}; - -var _default = function _default() { - var _decoders, _encoders; - - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['bmp']), - constants: { - MIME_BMP: MIME_TYPE, - MIME_X_MS_BMP: MIME_TYPE_SECOND - }, - decoders: (_decoders = {}, (0, _defineProperty2["default"])(_decoders, MIME_TYPE, decode), (0, _defineProperty2["default"])(_decoders, MIME_TYPE_SECOND, decode), _decoders), - encoders: (_encoders = {}, (0, _defineProperty2["default"])(_encoders, MIME_TYPE, encode), (0, _defineProperty2["default"])(_encoders, MIME_TYPE_SECOND, encode), _encoders) - }; -}; - -exports["default"] = _default; +const decode = data => fromAGBR(_bmpJs.default.decode(data)); +const encode = image => _bmpJs.default.encode(toAGBR(image)).data; +var _default = () => ({ + mime: { + [MIME_TYPE]: ["bmp"] + }, + constants: { + MIME_BMP: MIME_TYPE, + MIME_X_MS_BMP: MIME_TYPE_SECOND + }, + decoders: { + [MIME_TYPE]: decode, + [MIME_TYPE_SECOND]: decode + }, + encoders: { + [MIME_TYPE]: encode, + [MIME_TYPE_SECOND]: encode + } +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/bmp/dist/index.js.map b/project starter code/node_modules/@jimp/bmp/dist/index.js.map index ea487cba..b810a98b 100644 --- a/project starter code/node_modules/@jimp/bmp/dist/index.js.map +++ b/project starter code/node_modules/@jimp/bmp/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","MIME_TYPE_SECOND","toAGBR","image","bitmap","width","height","x","y","index","red","data","green","blue","alpha","fromAGBR","is_with_alpha","decode","BMP","encode","mime","constants","MIME_BMP","MIME_X_MS_BMP","decoders","encoders"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,WAAlB;AACA,IAAMC,gBAAgB,GAAG,gBAAzB;;AAEA,SAASC,MAAT,CAAgBC,KAAhB,EAAuB;AACrB,SAAO,iBAAKA,KAAL,EAAY,CAAZ,EAAe,CAAf,EAAkBA,KAAK,CAACC,MAAN,CAAaC,KAA/B,EAAsCF,KAAK,CAACC,MAAN,CAAaE,MAAnD,EAA2D,UAChEC,CADgE,EAEhEC,CAFgE,EAGhEC,KAHgE,EAIhE;AACA,QAAMC,GAAG,GAAG,KAAKN,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,CAAZ;AACA,QAAMG,KAAK,GAAG,KAAK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N,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,IAA8BG,KAA9B;AACA,SAAKR,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,IAA8BI,IAA9B;AACA,SAAKT,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,IAA8BL,MAAM,CAACY,aAAP,GAAuBF,KAAvB,GAA+B,IAA7D;AACD,GAdM,EAcJV,MAdH;AAeD;;AAED,IAAMa,MAAM,GAAG,SAATA,MAAS,CAAAN,IAAI;AAAA,SAAII,QAAQ,CAACG,kBAAID,MAAJ,CAAWN,IAAX,CAAD,CAAZ;AAAA,CAAnB;;AACA,IAAMQ,MAAM,GAAG,SAATA,MAAS,CAAAhB,KAAK;AAAA,SAAIe,kBAAIC,MAAJ,CAAWjB,MAAM,CAACC,KAAD,CAAjB,EAA0BQ,IAA9B;AAAA,CAApB;;eAEe;AAAA;;AAAA,SAAO;AACpBS,IAAAA,IAAI,uCAAKpB,SAAL,EAAiB,CAAC,KAAD,CAAjB,CADgB;AAGpBqB,IAAAA,SAAS,EAAE;AACTC,MAAAA,QAAQ,EAAEtB,SADD;AAETuB,MAAAA,aAAa,EAAEtB;AAFN,KAHS;AAQpBuB,IAAAA,QAAQ,+DACLxB,SADK,EACOiB,MADP,+CAELhB,gBAFK,EAEcgB,MAFd,aARY;AAapBQ,IAAAA,QAAQ,+DACLzB,SADK,EACOmB,MADP,+CAELlB,gBAFK,EAEckB,MAFd;AAbY,GAAP;AAAA,C","sourcesContent":["import BMP from 'bmp-js';\nimport { scan } from '@jimp/utils';\n\nconst MIME_TYPE = 'image/bmp';\nconst MIME_TYPE_SECOND = 'image/x-ms-bmp';\n\nfunction toAGBR(image) {\n return scan(image, 0, 0, image.bitmap.width, image.bitmap.height, function(\n x,\n y,\n index\n ) {\n const red = this.bitmap.data[index + 0];\n const green = this.bitmap.data[index + 1];\n const blue = this.bitmap.data[index + 2];\n const alpha = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = alpha;\n this.bitmap.data[index + 1] = blue;\n this.bitmap.data[index + 2] = green;\n this.bitmap.data[index + 3] = red;\n }).bitmap;\n}\n\nfunction fromAGBR(bitmap) {\n return scan({ bitmap }, 0, 0, bitmap.width, bitmap.height, function(\n x,\n y,\n index\n ) {\n const alpha = this.bitmap.data[index + 0];\n const blue = this.bitmap.data[index + 1];\n const green = this.bitmap.data[index + 2];\n const red = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = red;\n this.bitmap.data[index + 1] = green;\n this.bitmap.data[index + 2] = blue;\n this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff;\n }).bitmap;\n}\n\nconst decode = data => fromAGBR(BMP.decode(data));\nconst encode = image => BMP.encode(toAGBR(image)).data;\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['bmp'] },\n\n constants: {\n MIME_BMP: MIME_TYPE,\n MIME_X_MS_BMP: MIME_TYPE_SECOND\n },\n\n decoders: {\n [MIME_TYPE]: decode,\n [MIME_TYPE_SECOND]: decode\n },\n\n encoders: {\n [MIME_TYPE]: encode,\n [MIME_TYPE_SECOND]: encode\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["MIME_TYPE","MIME_TYPE_SECOND","toAGBR","image","scan","bitmap","width","height","x","y","index","red","data","green","blue","alpha","fromAGBR","is_with_alpha","decode","BMP","encode","mime","constants","MIME_BMP","MIME_X_MS_BMP","decoders","encoders"],"sources":["../src/index.js"],"sourcesContent":["import BMP from \"bmp-js\";\nimport { scan } from \"@jimp/utils\";\n\nconst MIME_TYPE = \"image/bmp\";\nconst MIME_TYPE_SECOND = \"image/x-ms-bmp\";\n\nfunction toAGBR(image) {\n return scan(\n image,\n 0,\n 0,\n image.bitmap.width,\n image.bitmap.height,\n function (x, y, index) {\n const red = this.bitmap.data[index + 0];\n const green = this.bitmap.data[index + 1];\n const blue = this.bitmap.data[index + 2];\n const alpha = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = alpha;\n this.bitmap.data[index + 1] = blue;\n this.bitmap.data[index + 2] = green;\n this.bitmap.data[index + 3] = red;\n }\n ).bitmap;\n}\n\nfunction fromAGBR(bitmap) {\n return scan(\n { bitmap },\n 0,\n 0,\n bitmap.width,\n bitmap.height,\n function (x, y, index) {\n const alpha = this.bitmap.data[index + 0];\n const blue = this.bitmap.data[index + 1];\n const green = this.bitmap.data[index + 2];\n const red = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = red;\n this.bitmap.data[index + 1] = green;\n this.bitmap.data[index + 2] = blue;\n this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff;\n }\n ).bitmap;\n}\n\nconst decode = (data) => fromAGBR(BMP.decode(data));\nconst encode = (image) => BMP.encode(toAGBR(image)).data;\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"bmp\"] },\n\n constants: {\n MIME_BMP: MIME_TYPE,\n MIME_X_MS_BMP: MIME_TYPE_SECOND,\n },\n\n decoders: {\n [MIME_TYPE]: decode,\n [MIME_TYPE_SECOND]: decode,\n },\n\n encoders: {\n [MIME_TYPE]: encode,\n [MIME_TYPE_SECOND]: encode,\n },\n});\n"],"mappings":";;;;;;AAAA;AACA;AAAmC;AAEnC,MAAMA,SAAS,GAAG,WAAW;AAC7B,MAAMC,gBAAgB,GAAG,gBAAgB;AAEzC,SAASC,MAAM,CAACC,KAAK,EAAE;EACrB,OAAO,IAAAC,WAAI,EACTD,KAAK,EACL,CAAC,EACD,CAAC,EACDA,KAAK,CAACE,MAAM,CAACC,KAAK,EAClBH,KAAK,CAACE,MAAM,CAACE,MAAM,EACnB,UAAUC,CAAC,EAAEC,CAAC,EAAEC,KAAK,EAAE;IACrB,MAAMC,GAAG,GAAG,IAAI,CAACN,MAAM,CAACO,IAAI,CAACF,KAAK,GAAG,CAAC,CAAC;IACvC,MAAMG,KAAK,GAAG,IAAI,CAACR,MAAM,CAACO,IAAI,CAACF,KAAK,GAAG,CA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GG,KAAK;IACnC,IAAI,CAACR,MAAM,CAACO,IAAI,CAACF,KAAK,GAAG,CAAC,CAAC,GAAGI,IAAI;IAClC,IAAI,CAACT,MAAM,CAACO,IAAI,CAACF,KAAK,GAAG,CAAC,CAAC,GAAGL,MAAM,CAACY,aAAa,GAAGF,KAAK,GAAG,IAAI;EACnE,CAAC,CACF,CAACV,MAAM;AACV;AAEA,MAAMa,MAAM,GAAIN,IAAI,IAAKI,QAAQ,CAACG,cAAG,CAACD,MAAM,CAACN,IAAI,CAAC,CAAC;AACnD,MAAMQ,MAAM,GAAIjB,KAAK,IAAKgB,cAAG,CAACC,MAAM,CAAClB,MAAM,CAACC,KAAK,CAAC,CAAC,CAACS,IAAI;AAAC,eAE1C,OAAO;EACpBS,IAAI,EAAE;IAAE,CAACrB,SAAS,GAAG,CAAC,KAAK;EAAE,CAAC;EAE9BsB,SAAS,EAAE;IACTC,QAAQ,EAAEvB,SAAS;IACnBwB,aAAa,EAAEvB;EACjB,CAAC;EAEDwB,QAAQ,EAAE;IACR,CAACzB,SAAS,GAAGkB,MAAM;IACnB,CAACjB,gBAAgB,GAAGiB;EACtB,CAAC;EAEDQ,QAAQ,EAAE;IACR,CAAC1B,SAAS,GAAGoB,MAAM;IACnB,CAACnB,gBAAgB,GAAGmB;EACtB;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/bmp/es/index.js b/project starter code/node_modules/@jimp/bmp/es/index.js index ca54f0f3..f4dd9861 100644 --- a/project starter code/node_modules/@jimp/bmp/es/index.js +++ b/project starter code/node_modules/@jimp/bmp/es/index.js @@ -1,70 +1,50 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _bmpJs = _interopRequireDefault(require("bmp-js")); - -var _utils = require("@jimp/utils"); - -var MIME_TYPE = 'image/bmp'; -var MIME_TYPE_SECOND = 'image/x-ms-bmp'; - +import BMP from "bmp-js"; +import { scan } from "@jimp/utils"; +const MIME_TYPE = "image/bmp"; +const MIME_TYPE_SECOND = "image/x-ms-bmp"; function toAGBR(image) { - return (0, _utils.scan)(image, 0, 0, image.bitmap.width, image.bitmap.height, function (x, y, index) { - var red = this.bitmap.data[index + 0]; - var green = this.bitmap.data[index + 1]; - var blue = this.bitmap.data[index + 2]; - var alpha = this.bitmap.data[index + 3]; + return scan(image, 0, 0, image.bitmap.width, image.bitmap.height, function (x, y, index) { + const red = this.bitmap.data[index + 0]; + const green = this.bitmap.data[index + 1]; + const blue = this.bitmap.data[index + 2]; + const alpha = this.bitmap.data[index + 3]; this.bitmap.data[index + 0] = alpha; this.bitmap.data[index + 1] = blue; this.bitmap.data[index + 2] = green; this.bitmap.data[index + 3] = red; }).bitmap; } - function fromAGBR(bitmap) { - return (0, _utils.scan)({ - bitmap: bitmap + return scan({ + bitmap }, 0, 0, bitmap.width, bitmap.height, function (x, y, index) { - var alpha = this.bitmap.data[index + 0]; - var blue = this.bitmap.data[index + 1]; - var green = this.bitmap.data[index + 2]; - var red = this.bitmap.data[index + 3]; + const alpha = this.bitmap.data[index + 0]; + const blue = this.bitmap.data[index + 1]; + const green = this.bitmap.data[index + 2]; + const red = this.bitmap.data[index + 3]; this.bitmap.data[index + 0] = red; this.bitmap.data[index + 1] = green; this.bitmap.data[index + 2] = blue; this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff; }).bitmap; } - -var decode = function decode(data) { - return fromAGBR(_bmpJs["default"].decode(data)); -}; - -var encode = function encode(image) { - return _bmpJs["default"].encode(toAGBR(image)).data; -}; - -var _default = function _default() { - var _decoders, _encoders; - - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['bmp']), - constants: { - MIME_BMP: MIME_TYPE, - MIME_X_MS_BMP: MIME_TYPE_SECOND - }, - decoders: (_decoders = {}, (0, _defineProperty2["default"])(_decoders, MIME_TYPE, decode), (0, _defineProperty2["default"])(_decoders, MIME_TYPE_SECOND, decode), _decoders), - encoders: (_encoders = {}, (0, _defineProperty2["default"])(_encoders, MIME_TYPE, encode), (0, _defineProperty2["default"])(_encoders, MIME_TYPE_SECOND, encode), _encoders) - }; -}; - -exports["default"] = _default; +const decode = data => fromAGBR(BMP.decode(data)); +const encode = image => BMP.encode(toAGBR(image)).data; +export default (() => ({ + mime: { + [MIME_TYPE]: ["bmp"] + }, + constants: { + MIME_BMP: MIME_TYPE, + MIME_X_MS_BMP: MIME_TYPE_SECOND + }, + decoders: { + [MIME_TYPE]: decode, + [MIME_TYPE_SECOND]: decode + }, + encoders: { + [MIME_TYPE]: encode, + [MIME_TYPE_SECOND]: encode + } +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/bmp/es/index.js.map b/project starter code/node_modules/@jimp/bmp/es/index.js.map index ea487cba..56d4859c 100644 --- a/project starter code/node_modules/@jimp/bmp/es/index.js.map +++ b/project starter code/node_modules/@jimp/bmp/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","MIME_TYPE_SECOND","toAGBR","image","bitmap","width","height","x","y","index","red","data","green","blue","alpha","fromAGBR","is_with_alpha","decode","BMP","encode","mime","constants","MIME_BMP","MIME_X_MS_BMP","decoders","encoders"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,WAAlB;AACA,IAAMC,gBAAgB,GAAG,gBAAzB;;AAEA,SAASC,MAAT,CAAgBC,KAAhB,EAAuB;AACrB,SAAO,iBAAKA,KAAL,EAAY,CAAZ,EAAe,CAAf,EAAkBA,KAAK,CAACC,MAAN,CAAaC,KAA/B,EAAsCF,KAAK,CAACC,MAAN,CAAaE,MAAnD,EAA2D,UAChEC,CADgE,EAEhEC,CAFgE,EAGhEC,KAHgE,EAIhE;AACA,QAAMC,GAAG,GAAG,KAA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;AAEA,SAAKL,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,IAA8BC,GAA9B;AACA,SAAKN,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,IAA8BG,KAA9B;AACA,SAAKR,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,IAA8BI,IAA9B;AACA,SAAKT,MAAL,CAAYO,IAAZ,CAAiBF,KAAK,GAAG,CAAzB,IAA8BL,MAAM,CAACY,aAAP,GAAuBF,KAAvB,GAA+B,IAA7D;AACD,GAdM,EAcJV,MAdH;AAeD;;AAED,IAAMa,MAAM,GAAG,SAATA,MAAS,CAAAN,IAAI;AAAA,SAAII,QAAQ,CAACG,kBAAID,MAAJ,CAAWN,IAAX,CAAD,CAAZ;AAAA,CAAnB;;AACA,IAAMQ,MAAM,GAAG,SAATA,MAAS,CAAAhB,KAAK;AAAA,SAAIe,kBAAIC,MAAJ,CAAWjB,MAAM,CAACC,KAAD,CAAjB,EAA0BQ,IAA9B;AAAA,CAApB;;eAEe;AAAA;;AAAA,SAAO;AACpBS,IAAAA,IAAI,uCAAKpB,SAAL,EAAiB,CAAC,KAAD,CAAjB,CADgB;AAGpBqB,IAAAA,SAAS,EAAE;AACTC,MAAAA,QAAQ,EAAEtB,SADD;AAETuB,MAAAA,aAAa,EAAEtB;AAFN,KAHS;AAQpBuB,IAAAA,QAAQ,+DACLxB,SADK,EACOiB,MADP,+CAELhB,gBAFK,EAEcgB,MAFd,aARY;AAapBQ,IAAAA,QAAQ,+DACLzB,SADK,EACOmB,MADP,+CAELlB,gBAFK,EAEckB,MAFd;AAbY,GAAP;AAAA,C","sourcesContent":["import BMP from 'bmp-js';\nimport { scan } from '@jimp/utils';\n\nconst MIME_TYPE = 'image/bmp';\nconst MIME_TYPE_SECOND = 'image/x-ms-bmp';\n\nfunction toAGBR(image) {\n return scan(image, 0, 0, image.bitmap.width, image.bitmap.height, function(\n x,\n y,\n index\n ) {\n const red = this.bitmap.data[index + 0];\n const green = this.bitmap.data[index + 1];\n const blue = this.bitmap.data[index + 2];\n const alpha = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = alpha;\n this.bitmap.data[index + 1] = blue;\n this.bitmap.data[index + 2] = green;\n this.bitmap.data[index + 3] = red;\n }).bitmap;\n}\n\nfunction fromAGBR(bitmap) {\n return scan({ bitmap }, 0, 0, bitmap.width, bitmap.height, function(\n x,\n y,\n index\n ) {\n const alpha = this.bitmap.data[index + 0];\n const blue = this.bitmap.data[index + 1];\n const green = this.bitmap.data[index + 2];\n const red = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = red;\n this.bitmap.data[index + 1] = green;\n this.bitmap.data[index + 2] = blue;\n this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff;\n }).bitmap;\n}\n\nconst decode = data => fromAGBR(BMP.decode(data));\nconst encode = image => BMP.encode(toAGBR(image)).data;\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['bmp'] },\n\n constants: {\n MIME_BMP: MIME_TYPE,\n MIME_X_MS_BMP: MIME_TYPE_SECOND\n },\n\n decoders: {\n [MIME_TYPE]: decode,\n [MIME_TYPE_SECOND]: decode\n },\n\n encoders: {\n [MIME_TYPE]: encode,\n [MIME_TYPE_SECOND]: encode\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["BMP","scan","MIME_TYPE","MIME_TYPE_SECOND","toAGBR","image","bitmap","width","height","x","y","index","red","data","green","blue","alpha","fromAGBR","is_with_alpha","decode","encode","mime","constants","MIME_BMP","MIME_X_MS_BMP","decoders","encoders"],"sources":["../src/index.js"],"sourcesContent":["import BMP from \"bmp-js\";\nimport { scan } from \"@jimp/utils\";\n\nconst MIME_TYPE = \"image/bmp\";\nconst MIME_TYPE_SECOND = \"image/x-ms-bmp\";\n\nfunction toAGBR(image) {\n return scan(\n image,\n 0,\n 0,\n image.bitmap.width,\n image.bitmap.height,\n function (x, y, index) {\n const red = this.bitmap.data[index + 0];\n const green = this.bitmap.data[index + 1];\n const blue = this.bitmap.data[index + 2];\n const alpha = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = alpha;\n this.bitmap.data[index + 1] = blue;\n this.bitmap.data[index + 2] = green;\n this.bitmap.data[index + 3] = red;\n }\n ).bitmap;\n}\n\nfunction fromAGBR(bitmap) {\n return scan(\n { bitmap },\n 0,\n 0,\n bitmap.width,\n bitmap.height,\n function (x, y, index) {\n const alpha = this.bitmap.data[index + 0];\n const blue = this.bitmap.data[index + 1];\n const green = this.bitmap.data[index + 2];\n const red = this.bitmap.data[index + 3];\n\n this.bitmap.data[index + 0] = red;\n this.bitmap.data[index + 1] = green;\n this.bitmap.data[index + 2] = blue;\n this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff;\n }\n ).bitmap;\n}\n\nconst decode = (data) => fromAGBR(BMP.decode(data));\nconst encode = (image) => BMP.encode(toAGBR(image)).data;\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"bmp\"] },\n\n constants: {\n MIME_BMP: MIME_TYPE,\n MIME_X_MS_BMP: MIME_TYPE_SECOND,\n },\n\n decoders: {\n [MIME_TYPE]: decode,\n [MIME_TYPE_SECOND]: decode,\n },\n\n encoders: {\n [MIME_TYPE]: encode,\n [MIME_TYPE_SECOND]: encode,\n },\n});\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,QAAQ;AACxB,SAASC,IAAI,QAAQ,aAAa;AAElC,MAAMC,SAAS,GAAG,WAAW;AAC7B,MAAMC,gBAAgB,GAAG,gBAAgB;AAEzC,SAASC,MAAM,CAACC,KAAK,EAAE;EACrB,OAAOJ,IAAI,CACTI,KAAK,EACL,CAAC,EACD,CAAC,EACDA,KAAK,CAACC,MAAM,CAACC,KAAK,EAClBF,KAAK,CAACC,MAAM,CAACE,MAAM,EACnB,UAAUC,CAAC,EAAEC,CAAC,EAAEC,KAAK,EAAE;IACrB,MAAMC,GAAG,GAAG,IAAI,CAACN,MA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I,CAACF,KAAK,GAAG,CAAC,CAAC,GAAGC,GAAG;IACjC,IAAI,CAACN,MAAM,CAACO,IAAI,CAACF,KAAK,GAAG,CAAC,CAAC,GAAGG,KAAK;IACnC,IAAI,CAACR,MAAM,CAACO,IAAI,CAACF,KAAK,GAAG,CAAC,CAAC,GAAGI,IAAI;IAClC,IAAI,CAACT,MAAM,CAACO,IAAI,CAACF,KAAK,GAAG,CAAC,CAAC,GAAGL,MAAM,CAACY,aAAa,GAAGF,KAAK,GAAG,IAAI;EACnE,CAAC,CACF,CAACV,MAAM;AACV;AAEA,MAAMa,MAAM,GAAIN,IAAI,IAAKI,QAAQ,CAACjB,GAAG,CAACmB,MAAM,CAACN,IAAI,CAAC,CAAC;AACnD,MAAMO,MAAM,GAAIf,KAAK,IAAKL,GAAG,CAACoB,MAAM,CAAChB,MAAM,CAACC,KAAK,CAAC,CAAC,CAACQ,IAAI;AAExD,gBAAe,OAAO;EACpBQ,IAAI,EAAE;IAAE,CAACnB,SAAS,GAAG,CAAC,KAAK;EAAE,CAAC;EAE9BoB,SAAS,EAAE;IACTC,QAAQ,EAAErB,SAAS;IACnBsB,aAAa,EAAErB;EACjB,CAAC;EAEDsB,QAAQ,EAAE;IACR,CAACvB,SAAS,GAAGiB,MAAM;IACnB,CAAChB,gBAAgB,GAAGgB;EACtB,CAAC;EAEDO,QAAQ,EAAE;IACR,CAACxB,SAAS,GAAGkB,MAAM;IACnB,CAACjB,gBAAgB,GAAGiB;EACtB;AACF,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/bmp/index.d.ts b/project starter code/node_modules/@jimp/bmp/index.d.ts index bbb9baec..0a9b9a51 100644 --- a/project starter code/node_modules/@jimp/bmp/index.d.ts +++ b/project starter code/node_modules/@jimp/bmp/index.d.ts @@ -1,24 +1,24 @@ -import { DecoderFn, EncoderFn } from '@jimp/core'; +import { DecoderFn, EncoderFn } from "@jimp/core"; interface Bmp { constants: { - MIME_BMP: 'image/bmp'; - MIME_X_MS_BMP: 'image/x-ms-bmp'; - } + MIME_BMP: "image/bmp"; + MIME_X_MS_BMP: "image/x-ms-bmp"; + }; mime: { - 'image/bmp': string[] - } + "image/bmp": string[]; + }; decoders: { - 'image/bmp': DecoderFn - 'image/x-ms-bmp': DecoderFn - } + "image/bmp": DecoderFn; + "image/x-ms-bmp": DecoderFn; + }; encoders: { - 'image/bmp': EncoderFn - 'image/x-ms-bmp': EncoderFn - } + "image/bmp": EncoderFn; + "image/x-ms-bmp": EncoderFn; + }; } -export default function(): Bmp; +export default function (): Bmp; diff --git a/project starter code/node_modules/@jimp/bmp/package.json b/project starter code/node_modules/@jimp/bmp/package.json index 4d3bc24c..c3b6f766 100644 --- a/project starter code/node_modules/@jimp/bmp/package.json +++ b/project starter code/node_modules/@jimp/bmp/package.json @@ -1,12 +1,13 @@ { "name": "@jimp/bmp", - "version": "0.16.2", + "version": "0.22.12", "description": "Default Jimp bmp encoder/decoder.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js", "test:watch": "npm run test -- --reporter min --watch", "test:coverage": "nyc npm run test", "build": "npm run build:node:production && npm run build:module", @@ -20,19 +21,18 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", + "@jimp/utils": "^0.22.12", "bmp-js": "^0.1.0" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" }, "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/test-utils": "^0.16.2" + "@jimp/custom": "^0.22.12", + "@jimp/test-utils": "^0.22.12" }, "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/bmp/src/index.js b/project starter code/node_modules/@jimp/bmp/src/index.js index 897da77a..12fe2c79 100644 --- a/project starter code/node_modules/@jimp/bmp/src/index.js +++ b/project starter code/node_modules/@jimp/bmp/src/index.js @@ -1,63 +1,69 @@ -import BMP from 'bmp-js'; -import { scan } from '@jimp/utils'; +import BMP from "bmp-js"; +import { scan } from "@jimp/utils"; -const MIME_TYPE = 'image/bmp'; -const MIME_TYPE_SECOND = 'image/x-ms-bmp'; +const MIME_TYPE = "image/bmp"; +const MIME_TYPE_SECOND = "image/x-ms-bmp"; function toAGBR(image) { - return scan(image, 0, 0, image.bitmap.width, image.bitmap.height, function( - x, - y, - index - ) { - const red = this.bitmap.data[index + 0]; - const green = this.bitmap.data[index + 1]; - const blue = this.bitmap.data[index + 2]; - const alpha = this.bitmap.data[index + 3]; - - this.bitmap.data[index + 0] = alpha; - this.bitmap.data[index + 1] = blue; - this.bitmap.data[index + 2] = green; - this.bitmap.data[index + 3] = red; - }).bitmap; + return scan( + image, + 0, + 0, + image.bitmap.width, + image.bitmap.height, + function (x, y, index) { + const red = this.bitmap.data[index + 0]; + const green = this.bitmap.data[index + 1]; + const blue = this.bitmap.data[index + 2]; + const alpha = this.bitmap.data[index + 3]; + + this.bitmap.data[index + 0] = alpha; + this.bitmap.data[index + 1] = blue; + this.bitmap.data[index + 2] = green; + this.bitmap.data[index + 3] = red; + } + ).bitmap; } function fromAGBR(bitmap) { - return scan({ bitmap }, 0, 0, bitmap.width, bitmap.height, function( - x, - y, - index - ) { - const alpha = this.bitmap.data[index + 0]; - const blue = this.bitmap.data[index + 1]; - const green = this.bitmap.data[index + 2]; - const red = this.bitmap.data[index + 3]; - - this.bitmap.data[index + 0] = red; - this.bitmap.data[index + 1] = green; - this.bitmap.data[index + 2] = blue; - this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff; - }).bitmap; + return scan( + { bitmap }, + 0, + 0, + bitmap.width, + bitmap.height, + function (x, y, index) { + const alpha = this.bitmap.data[index + 0]; + const blue = this.bitmap.data[index + 1]; + const green = this.bitmap.data[index + 2]; + const red = this.bitmap.data[index + 3]; + + this.bitmap.data[index + 0] = red; + this.bitmap.data[index + 1] = green; + this.bitmap.data[index + 2] = blue; + this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff; + } + ).bitmap; } -const decode = data => fromAGBR(BMP.decode(data)); -const encode = image => BMP.encode(toAGBR(image)).data; +const decode = (data) => fromAGBR(BMP.decode(data)); +const encode = (image) => BMP.encode(toAGBR(image)).data; export default () => ({ - mime: { [MIME_TYPE]: ['bmp'] }, + mime: { [MIME_TYPE]: ["bmp"] }, constants: { MIME_BMP: MIME_TYPE, - MIME_X_MS_BMP: MIME_TYPE_SECOND + MIME_X_MS_BMP: MIME_TYPE_SECOND, }, decoders: { [MIME_TYPE]: decode, - [MIME_TYPE_SECOND]: decode + [MIME_TYPE_SECOND]: decode, }, encoders: { [MIME_TYPE]: encode, - [MIME_TYPE_SECOND]: encode - } + [MIME_TYPE_SECOND]: encode, + }, }); diff --git a/project starter code/node_modules/@jimp/bmp/test/bmp.test.js b/project starter code/node_modules/@jimp/bmp/test/bmp.test.js index 82b3bded..09587cec 100644 --- a/project starter code/node_modules/@jimp/bmp/test/bmp.test.js +++ b/project starter code/node_modules/@jimp/bmp/test/bmp.test.js @@ -1,54 +1,46 @@ -/* eslint-disable no-control-regex */ +import { Jimp, getTestDir } from "@jimp/test-utils"; +import configure from "@jimp/custom"; +import expect from "@storybook/expect"; -import { Jimp, getTestDir } from '@jimp/test-utils'; -import configure from '@jimp/custom'; - -import bmp from '../src'; +import bmp from "../src"; const jimp = configure({ types: [bmp] }, Jimp); -describe('BMP', () => { - const imagesDir = getTestDir(__dirname) + '/images'; +describe("BMP", () => { + const imagesDir = getTestDir(__dirname) + "/images"; - it('load BMP', async () => { - const image = await jimp.read(imagesDir + '/windows95.bmp'); + it("load BMP", async () => { + const image = await jimp.read(imagesDir + "/windows95.bmp"); - image.getPixelColor(10, 10).should.be.equal(0xeff7f7ff); - image.getPixelColor(150, 80).should.be.equal(0x73add6ff); - image.getPixelColor(190, 200).should.be.equal(0xf7c300ff); + expect(image.getPixelColor(10, 10)).toBe(0xeff7f7ff); + expect(image.getPixelColor(150, 80)).toBe(0x73add6ff); + expect(image.getPixelColor(190, 200)).toBe(0xf7c300ff); }); - it('export BMP', async () => { + it("export BMP", async () => { const image = await jimp.read({ width: 3, height: 3, data: [ - 0xff0000ff, - 0xff0080ff, - 0xff00ffff, - 0xff0080ff, - 0xff00ffff, - 0x8000ffff, - 0xff00ffff, - 0x8000ffff, - 0x0000ffff - ] + 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff, + 0xff00ffff, 0x8000ffff, 0x0000ffff, + ], }); - const buffer = await image.getBufferAsync('image/bmp'); + const buffer = await image.getBufferAsync("image/bmp"); - buffer.toString().should.match(/^BMZ\u0000/); + expect(buffer.toString()).toMatch(/^BMZ\u0000/); }); - it('uses correct colors for BMP', async function() { + it("uses correct colors for BMP", async function () { this.timeout(4000); const expectedImg = await jimp.read( - getTestDir(__dirname) + '/images/windows95.png' + getTestDir(__dirname) + "/images/windows95.png" ); const image = await jimp.read( - getTestDir(__dirname) + '/images/windows95.bmp' + getTestDir(__dirname) + "/images/windows95.bmp" ); - image.bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + expect(image.bitmap.data).toEqual(expectedImg.bitmap.data); }); }); diff --git a/project starter code/node_modules/@jimp/core/CHANGELOG.md b/project starter code/node_modules/@jimp/core/CHANGELOG.md deleted file mode 100644 index aee584b5..00000000 --- a/project starter code/node_modules/@jimp/core/CHANGELOG.md +++ /dev/null @@ -1,83 +0,0 @@ -# v0.14.0 (Mon Jun 29 2020) - -#### 🚀 Enhancement - -- include Addition (Add) blending mode + Officially drop support for Node 8 [#904](https://github.com/oliver-moran/jimp/pull/904) ([@GlitchyPSIX](https://github.com/GlitchyPSIX)) - -#### Authors: 1 - -- GlitchyPSI ([@GlitchyPSIX](https://github.com/GlitchyPSIX)) - ---- - -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### 🐛 Bug Fix - -- Make callback optional for Jimp.rgbaToInt [#889](https://github.com/oliver-moran/jimp/pull/889) ([@HanKruiger](https://github.com/HanKruiger)) - -#### Authors: 2 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) -- Han Kruiger ([@HanKruiger](https://github.com/HanKruiger)) - ---- - -# v0.10.2 (Tue Apr 14 2020) - -#### 🐛 Bug Fix - -- Rewrite handling EXIF orientation — add tests, make it plugin-independent [#875](https://github.com/oliver-moran/jimp/pull/875) ([@skalee](https://github.com/skalee)) - -#### Authors: 1 - -- Sebastian Skałacki ([@skalee](https://github.com/skalee)) - ---- - -# v0.10.0 (Mon Mar 30 2020) - -#### 🚀 Enhancement - -- Properly split constructor and instance types [#867](https://github.com/oliver-moran/jimp/pull/867) ([@forivall](https://github.com/forivall)) - -#### Authors: 1 - -- Emily Marigold Klassen ([@forivall](https://github.com/forivall)) - ---- - -# v0.9.6 (Wed Mar 18 2020) - -#### 🐛 Bug Fix - -- Relax mkdirp dependency to allow newer minimist [#857](https://github.com/oliver-moran/jimp/pull/857) ([@Den-dp](https://github.com/Den-dp)) - -#### 🏠 Internal - -- Fix TypeScript error on 'next' [#858](https://github.com/oliver-moran/jimp/pull/858) ([@crutchcorn](https://github.com/crutchcorn)) - -#### Authors: 2 - -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) -- Denis Bendrikov ([@Den-dp](https://github.com/Den-dp)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) -- `@jimp/core` - - Follow redirects [#789](https://github.com/oliver-moran/jimp/pull/789) ([@SaWey](https://github.com/SaWey) sander@solora.be) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/README.md b/project starter code/node_modules/@jimp/core/README.md index a85714fc..4ca355ff 100644 --- a/project starter code/node_modules/@jimp/core/README.md +++ b/project starter code/node_modules/@jimp/core/README.md @@ -18,7 +18,7 @@ Add constant or static methods to the Jimp constructor. ```js addConstants({ - MIME_SPECIAL: 'image/special' + MIME_SPECIAL: "image/special", }); ``` @@ -48,5 +48,5 @@ await image.writeAsync('test.png'); Add a image mime type to Jimp constructor. First argument is a mime type and the second is an array of file extension for that type. ```js -addType('image/special', ['spec', 'special']); +addType("image/special", ["spec", "special"]); ``` diff --git a/project starter code/node_modules/@jimp/core/dist/composite/composite-modes.js b/project starter code/node_modules/@jimp/core/dist/composite/composite-modes.js index eee30efd..d7efc3ee 100644 --- a/project starter code/node_modules/@jimp/core/dist/composite/composite-modes.js +++ b/project starter code/node_modules/@jimp/core/dist/composite/composite-modes.js @@ -3,234 +3,223 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.srcOver = srcOver; -exports.dstOver = dstOver; -exports.multiply = multiply; exports.add = add; -exports.screen = screen; -exports.overlay = overlay; exports.darken = darken; -exports.lighten = lighten; -exports.hardLight = hardLight; exports.difference = difference; +exports.dstOver = dstOver; exports.exclusion = exclusion; - +exports.hardLight = hardLight; +exports.lighten = lighten; +exports.multiply = multiply; +exports.overlay = overlay; +exports.screen = screen; +exports.srcOver = srcOver; function srcOver(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; + let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a; - var g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a; - var b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a; + const a = dst.a + src.a - dst.a * src.a; + const r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a; + const g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a; + const b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a; return { - r: r, - g: g, - b: b, - a: a + r, + g, + b, + a }; } - function dstOver(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; + let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a; - var g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a; - var b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a; + const a = dst.a + src.a - dst.a * src.a; + const r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a; + const g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a; + const b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a; return { - r: r, - g: g, - b: b, - a: a + r, + g, + b, + a }; } - function multiply(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; + let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; + const g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; + const b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; return { - r: r, - g: g, - b: b, - a: a + r, + g, + b, + a }; } - function add(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; + let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra + dra) / a; - var g = (sga + dga) / a; - var b = (sba + dba) / a; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (sra + dra) / a; + const g = (sga + dga) / a; + const b = (sba + dba) / a; return { - r: r, - g: g, - b: b, - a: a + r, + g, + b, + a }; } - function screen(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; + let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra * dst.a + dra * src.a - sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (sga * dst.a + dga * src.a - sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (sba * dst.a + dba * src.a - sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (sra * dst.a + dra * src.a - sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; + const g = (sga * dst.a + dga * src.a - sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; + const b = (sba * dst.a + dba * src.a - sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; return { - r: r, - g: g, - b: b, - a: a + r, + g, + b, + a }; } - function overlay(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; + let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (2 * dra <= dst.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a; - var g = (2 * dga <= dst.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a; - var b = (2 * dba <= dst.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (2 * dra <= dst.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a; + const g = (2 * dga <= dst.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a; + const b = (2 * dba <= dst.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a; return { - r: r, - g: g, - b: b, - a: a + r, + g, + b, + a }; } - function darken(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; + let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (Math.min(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (Math.min(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (Math.min(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (Math.min(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a; + const g = (Math.min(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a; + const b = (Math.min(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a; return { - r: r, - g: g, - b: b, - a: a + r, + g, + b, + a }; } - function lighten(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; + let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (Math.max(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (Math.max(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (Math.max(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (Math.max(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a; + const g = (Math.max(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a; + const b = (Math.max(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a; return { - r: r, - g: g, - b: b, - a: a + r, + g, + b, + a }; } - function hardLight(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; + let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (2 * sra <= src.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a; - var g = (2 * sga <= src.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a; - var b = (2 * sba <= src.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (2 * sra <= src.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a; + const g = (2 * sga <= src.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a; + const b = (2 * sba <= src.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a; return { - r: r, - g: g, - b: b, - a: a + r, + g, + b, + a }; } - function difference(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; + let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a; - var g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a; - var b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a; + const g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a; + const b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a; return { - r: r, - g: g, - b: b, - a: a + r, + g, + b, + a }; } - function exclusion(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; + let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra * dst.a + dra * src.a - 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (sga * dst.a + dga * src.a - 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (sba * dst.a + dba * src.a - 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (sra * dst.a + dra * src.a - 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; + const g = (sga * dst.a + dga * src.a - 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; + const b = (sba * dst.a + dba * src.a - 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; return { - r: r, - g: g, - b: b, - a: a + r, + g, + b, + a }; } //# sourceMappingURL=composite-modes.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/composite/composite-modes.js.map b/project starter code/node_modules/@jimp/core/dist/composite/composite-modes.js.map index 2d24ac88..ed813c3a 100644 --- a/project starter code/node_modules/@jimp/core/dist/composite/composite-modes.js.map +++ b/project starter code/node_modules/@jimp/core/dist/composite/composite-modes.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../src/composite/composite-modes.js"],"names":["srcOver","src","dst","ops","a","r","g","b","dstOver","multiply","sra","sga","sba","dra","dga","dba","add","screen","overlay","darken","Math","min","lighten","max","hardLight","difference","exclusion"],"mappings":";;;;;;;;;;;;;;;;;AAAO,SAASA,OAAT,CAAiBC,GAAjB,EAAsBC,GAAtB,EAAoC;AAAA,MAATC,GAAS,uEAAH,CAAG;AACzCF,EAAAA,GAAG,CAACG,CAAJ,IAASD,GAAT;AAEA,MAAMC,CAAC,GAAGF,GAAG,CAACE,CAAJ,GAAQH,GAAG,CAACG,CAAZ,GAAgBF,GAAG,CAACE,CAAJ,GAAQH,GAAG,CAACG,CAAtC;AAEA,MAAMC,CAAC,GAAG,CAACJ,GAAG,CAACI,CAAJ,GAAQJ,GAAG,CAACG,CAAZ,GAAgBF,GAAG,CAACG,CAAJ,GAAQH,GAAG,CAACE,CAAZ,IAAiB,IAAIH,GAAG,CAACG,CAAzB,CAAjB,IAAgDA,CAA1D;AACA,MAAME,CAAC,GAAG,CAACL,GAAG,CAACK,CAAJ,GAAQL,GAAG,CAACG,CAAZ,GAAgBF,GAAG,CAACI,CAAJ,GAAQJ,GAAG,CAACE,CAAZ,IAAiB,IAAIH,GAAG,CAACG,CAAzB,CAAjB,IAAgDA,CAA1D;AACA,MAAMG,CAAC,GAAG,CAACN,GAAG,CAACM,CAAJ,GAAQN,GAAG,CAACG,CAAZ,GAAgBF,GAAG,CAACK,CAAJ,GAAQL,GAAG,CAACE,CAAZ,IAAiB,IAAIH,GAAG,CAACG,CAAzB,CAAjB,IAAgD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G,CAACG,CAAZ,CAJL,IAKAA,CANF;AAOA,MAAME,CAAC,GACL,CAACK,GAAG,GAAGT,GAAG,CAACE,CAAV,GACCU,GAAG,GAAGb,GAAG,CAACG,CADX,GAEC,IAAIO,GAAJ,GAAUG,GAFX,GAGCH,GAAG,IAAI,IAAIT,GAAG,CAACE,CAAZ,CAHJ,GAICU,GAAG,IAAI,IAAIb,GAAG,CAACG,CAAZ,CAJL,IAKAA,CANF;AAOA,MAAMG,CAAC,GACL,CAACK,GAAG,GAAGV,GAAG,CAACE,CAAV,GACCW,GAAG,GAAGd,GAAG,CAACG,CADX,GAEC,IAAIQ,GAAJ,GAAUG,GAFX,GAGCH,GAAG,IAAI,IAAIV,GAAG,CAACE,CAAZ,CAHJ,GAICW,GAAG,IAAI,IAAId,GAAG,CAACG,CAAZ,CAJL,IAKAA,CANF;AAQA,SAAO;AAAEC,IAAAA,CAAC,EAADA,CAAF;AAAKC,IAAAA,CAAC,EAADA,CAAL;AAAQC,IAAAA,CAAC,EAADA,CAAR;AAAWH,IAAAA,CAAC,EAADA;AAAX,GAAP;AACD","sourcesContent":["export function srcOver(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a;\n const g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a;\n const b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function dstOver(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a;\n const g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a;\n const b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function multiply(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;\n const g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;\n const b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function add(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra + dra) / a;\n const g = (sga + dga) / a;\n const b = (sba + dba) / a;\n\n return { r, g, b, a };\n}\n\nexport function screen(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (sra * dst.a +\n dra * src.a -\n sra * dra +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (sga * dst.a +\n dga * src.a -\n sga * dga +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (sba * dst.a +\n dba * src.a -\n sba * dba +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function overlay(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (2 * dra <= dst.a\n ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)\n : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) /\n a;\n\n const g =\n (2 * dga <= dst.a\n ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)\n : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) /\n a;\n\n const b =\n (2 * dba <= dst.a\n ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)\n : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function darken(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (Math.min(sra * dst.a, dra * src.a) +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (Math.min(sga * dst.a, dga * src.a) +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (Math.min(sba * dst.a, dba * src.a) +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function lighten(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (Math.max(sra * dst.a, dra * src.a) +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (Math.max(sga * dst.a, dga * src.a) +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (Math.max(sba * dst.a, dba * src.a) +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function hardLight(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (2 * sra <= src.a\n ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)\n : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) /\n a;\n\n const g =\n (2 * sga <= src.a\n ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)\n : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) /\n a;\n\n const b =\n (2 * sba <= src.a\n ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)\n : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function difference(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a;\n const g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a;\n const b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function exclusion(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (sra * dst.a +\n dra * src.a -\n 2 * sra * dra +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (sga * dst.a +\n dga * src.a -\n 2 * sga * dga +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (sba * dst.a +\n dba * src.a -\n 2 * sba * dba +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n"],"file":"composite-modes.js"} \ No newline at end of file +{"version":3,"file":"composite-modes.js","names":["srcOver","src","dst","ops","a","r","g","b","dstOver","multiply","sra","sga","sba","dra","dga","dba","add","screen","overlay","darken","Math","min","lighten","max","hardLight","difference","exclusion"],"sources":["../../src/composite/composite-modes.js"],"sourcesContent":["export function srcOver(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a;\n const g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a;\n const b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function dstOver(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a;\n const g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a;\n const b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function multiply(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;\n const g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;\n const b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function add(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra + dra) / a;\n const g = (sga + dga) / a;\n const b = (sba + dba) / a;\n\n return { r, g, b, a };\n}\n\nexport function screen(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (sra * dst.a +\n dra * src.a -\n sra * dra +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (sga * dst.a +\n dga * src.a -\n sga * dga +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (sba * dst.a +\n dba * src.a -\n sba * dba +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function overlay(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (2 * dra <= dst.a\n ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)\n : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) /\n a;\n\n const g =\n (2 * dga <= dst.a\n ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)\n : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) /\n a;\n\n const b =\n (2 * dba <= dst.a\n ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)\n : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function darken(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (Math.min(sra * dst.a, dra * src.a) +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (Math.min(sga * dst.a, dga * src.a) +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (Math.min(sba * dst.a, dba * src.a) +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function lighten(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (Math.max(sra * dst.a, dra * src.a) +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (Math.max(sga * dst.a, dga * src.a) +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (Math.max(sba * dst.a, dba * src.a) +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function hardLight(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (2 * sra <= src.a\n ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)\n : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) /\n a;\n\n const g =\n (2 * sga <= src.a\n ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)\n : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) /\n a;\n\n const b =\n (2 * sba <= src.a\n ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)\n : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function difference(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a;\n const g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a;\n const b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function exclusion(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (sra * dst.a +\n dra * src.a -\n 2 * sra * dra +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (sga * dst.a +\n dga * src.a -\n 2 * sga * dga +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (sba * dst.a +\n dba * src.a -\n 2 * sba * dba +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAO,SAASA,OAAO,CAACC,GAAG,EAAEC,GAAG,EAAW;EAAA,IAATC,GAAG,uEAAG,CAAC;EACvCF,GAAG,CAACG,CAAC,IAAID,GAAG;EAEZ,MAAMC,CAAC,GAAGF,GAAG,CAACE,CAAC,GAAGH,GAAG,C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AGG,GAAG,GACbH,GAAG,IAAI,CAAC,GAAGT,GAAG,CAACE,CAAC,CAAC,GACjBU,GAAG,IAAI,CAAC,GAAGb,GAAG,CAACG,CAAC,CAAC,IACnBA,CAAC;EACH,MAAMG,CAAC,GACL,CAACK,GAAG,GAAGV,GAAG,CAACE,CAAC,GACVW,GAAG,GAAGd,GAAG,CAACG,CAAC,GACX,CAAC,GAAGQ,GAAG,GAAGG,GAAG,GACbH,GAAG,IAAI,CAAC,GAAGV,GAAG,CAACE,CAAC,CAAC,GACjBW,GAAG,IAAI,CAAC,GAAGd,GAAG,CAACG,CAAC,CAAC,IACnBA,CAAC;EAEH,OAAO;IAAEC,CAAC;IAAEC,CAAC;IAAEC,CAAC;IAAEH;EAAE,CAAC;AACvB"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/composite/index.js b/project starter code/node_modules/@jimp/core/dist/composite/index.js index ec9595d9..c68cb72a 100644 --- a/project starter code/node_modules/@jimp/core/dist/composite/index.js +++ b/project starter code/node_modules/@jimp/core/dist/composite/index.js @@ -1,18 +1,14 @@ "use strict"; -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = composite; - +exports.default = composite; var _utils = require("@jimp/utils"); - var constants = _interopRequireWildcard(require("../constants")); - var compositeModes = _interopRequireWildcard(require("./composite-modes")); - +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } /** * Composites a source image over to this image respecting alpha channels * @param {Jimp} src the source Jimp instance @@ -23,52 +19,50 @@ var compositeModes = _interopRequireWildcard(require("./composite-modes")); * @returns {Jimp} this for chaining of methods */ function composite(src, x, y) { - var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; - var cb = arguments.length > 4 ? arguments[4] : undefined; - - if (typeof options === 'function') { + let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + let cb = arguments.length > 4 ? arguments[4] : undefined; + if (typeof options === "function") { cb = options; options = {}; } - if (!(src instanceof this.constructor)) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); + return _utils.throwError.call(this, "The source must be a Jimp image", cb); } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); + if (typeof x !== "number" || typeof y !== "number") { + return _utils.throwError.call(this, "x and y must be numbers", cb); } - - var _options = options, - mode = _options.mode, - opacitySource = _options.opacitySource, - opacityDest = _options.opacityDest; - + let { + mode, + opacitySource, + opacityDest + } = options; if (!mode) { mode = constants.BLEND_SOURCE_OVER; } - - if (typeof opacitySource !== 'number' || opacitySource < 0 || opacitySource > 1) { + if (typeof opacitySource !== "number" || opacitySource < 0 || opacitySource > 1) { opacitySource = 1.0; } - - if (typeof opacityDest !== 'number' || opacityDest < 0 || opacityDest > 1) { + if (typeof opacityDest !== "number" || opacityDest < 0 || opacityDest > 1) { opacityDest = 1.0; } - var blendmode = compositeModes[mode]; // round input + // eslint-disable-next-line import/namespace + const blendmode = compositeModes[mode]; + // round input x = Math.round(x); y = Math.round(y); - var baseImage = this; - + const baseImage = this; if (opacityDest !== 1.0) { baseImage.opacity(opacityDest); } - src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) { - var dstIdx = baseImage.getPixelIndex(x + sx, y + sy, constants.EDGE_CROP); - var blended = blendmode({ + const dstIdx = baseImage.getPixelIndex(x + sx, y + sy, constants.EDGE_CROP); + if (dstIdx === -1) { + // Skip target pixels outside of dst + return; + } + const blended = blendmode({ r: this.bitmap.data[idx + 0] / 255, g: this.bitmap.data[idx + 1] / 255, b: this.bitmap.data[idx + 2] / 255, @@ -84,13 +78,11 @@ function composite(src, x, y) { baseImage.bitmap.data[dstIdx + 2] = this.constructor.limit255(blended.b * 255); baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(blended.a * 255); }); - if ((0, _utils.isNodePattern)(cb)) { cb.call(this, null, this); } - return this; } - module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/composite/index.js.map b/project starter code/node_modules/@jimp/core/dist/composite/index.js.map index 290d15ef..592eb24e 100644 --- a/project starter code/node_modules/@jimp/core/dist/composite/index.js.map +++ b/project starter code/node_modules/@jimp/core/dist/composite/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../src/composite/index.js"],"names":["composite","src","x","y","options","cb","constructor","throwError","call","mode","opacitySource","opacityDest","constants","BLEND_SOURCE_OVER","blendmode","compositeModes","Math","round","baseImage","opacity","scanQuiet","bitmap","width","height","sx","sy","idx","dstIdx","getPixelIndex","EDGE_CROP","blended","r","data","g","b","a","limit255"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AAEA;;;;;;;;;AASe,SAASA,SAAT,CAAmBC,GAAnB,EAAwBC,CAAxB,EAA2BC,CAA3B,EAAgD;AAAA,MAAlBC,OAAkB,uEAAR,EAAQ;AAAA,MAAJC,EAAI;;AAC7D,MAAI,OAAOD,OAAP,KAAmB,UAAvB,EAAmC;AACjCC,IAAAA,EAAE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AAM,GAAG,CAA/B,IAAoC,KAAKrB,WAAL,CAAiB8B,QAAjB,CAClCN,OAAO,CAACC,CAAR,GAAY,GADsB,CAApC;AAGAb,IAAAA,SAAS,CAACG,MAAV,CAAiBW,IAAjB,CAAsBL,MAAM,GAAG,CAA/B,IAAoC,KAAKrB,WAAL,CAAiB8B,QAAjB,CAClCN,OAAO,CAACG,CAAR,GAAY,GADsB,CAApC;AAGAf,IAAAA,SAAS,CAACG,MAAV,CAAiBW,IAAjB,CAAsBL,MAAM,GAAG,CAA/B,IAAoC,KAAKrB,WAAL,CAAiB8B,QAAjB,CAClCN,OAAO,CAACI,CAAR,GAAY,GADsB,CAApC;AAGAhB,IAAAA,SAAS,CAACG,MAAV,CAAiBW,IAAjB,CAAsBL,MAAM,GAAG,CAA/B,IAAoC,KAAKrB,WAAL,CAAiB8B,QAAjB,CAClCN,OAAO,CAACK,CAAR,GAAY,GADsB,CAApC;AAGD,GAlCD;;AAoCA,MAAI,0BAAc9B,EAAd,CAAJ,EAAuB;AACrBA,IAAAA,EAAE,CAACG,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,SAAO,IAAP;AACD","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\nimport * as constants from '../constants';\n\nimport * as compositeModes from './composite-modes';\n\n/**\n * Composites a source image over to this image respecting alpha channels\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {object} options determine what mode to use\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default function composite(src, x, y, options = {}, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n let { mode, opacitySource, opacityDest } = options;\n\n if (!mode) {\n mode = constants.BLEND_SOURCE_OVER;\n }\n\n if (\n typeof opacitySource !== 'number' ||\n opacitySource < 0 ||\n opacitySource > 1\n ) {\n opacitySource = 1.0;\n }\n\n if (typeof opacityDest !== 'number' || opacityDest < 0 || opacityDest > 1) {\n opacityDest = 1.0;\n }\n\n const blendmode = compositeModes[mode];\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const baseImage = this;\n\n if (opacityDest !== 1.0) {\n baseImage.opacity(opacityDest);\n }\n\n src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function(\n sx,\n sy,\n idx\n ) {\n const dstIdx = baseImage.getPixelIndex(x + sx, y + sy, constants.EDGE_CROP);\n const blended = blendmode(\n {\n r: this.bitmap.data[idx + 0] / 255,\n g: this.bitmap.data[idx + 1] / 255,\n b: this.bitmap.data[idx + 2] / 255,\n a: this.bitmap.data[idx + 3] / 255\n },\n {\n r: baseImage.bitmap.data[dstIdx + 0] / 255,\n g: baseImage.bitmap.data[dstIdx + 1] / 255,\n b: baseImage.bitmap.data[dstIdx + 2] / 255,\n a: baseImage.bitmap.data[dstIdx + 3] / 255\n },\n opacitySource\n );\n\n baseImage.bitmap.data[dstIdx + 0] = this.constructor.limit255(\n blended.r * 255\n );\n baseImage.bitmap.data[dstIdx + 1] = this.constructor.limit255(\n blended.g * 255\n );\n baseImage.bitmap.data[dstIdx + 2] = this.constructor.limit255(\n blended.b * 255\n );\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(\n blended.a * 255\n );\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["composite","src","x","y","options","cb","constructor","throwError","call","mode","opacitySource","opacityDest","constants","BLEND_SOURCE_OVER","blendmode","compositeModes","Math","round","baseImage","opacity","scanQuiet","bitmap","width","height","sx","sy","idx","dstIdx","getPixelIndex","EDGE_CROP","blended","r","data","g","b","a","limit255","isNodePattern"],"sources":["../../src/composite/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\nimport * as constants from \"../constants\";\n\nimport * as compositeModes from \"./composite-modes\";\n\n/**\n * Composites a source image over to this image respecting alpha channels\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {object} options determine what mode to use\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default function composite(src, x, y, options = {}, cb) {\n if (typeof options === \"function\") {\n cb = options;\n options = {};\n }\n\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n let { mode, opacitySource, opacityDest } = options;\n\n if (!mode) {\n mode = constants.BLEND_SOURCE_OVER;\n }\n\n if (\n typeof opacitySource !== \"number\" ||\n opacitySource < 0 ||\n opacitySource > 1\n ) {\n opacitySource = 1.0;\n }\n\n if (typeof opacityDest !== \"number\" || opacityDest < 0 || opacityDest > 1) {\n opacityDest = 1.0;\n }\n\n // eslint-disable-next-line import/namespace\n const blendmode = compositeModes[mode];\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const baseImage = this;\n\n if (opacityDest !== 1.0) {\n baseImage.opacity(opacityDest);\n }\n\n src.scanQuiet(\n 0,\n 0,\n src.bitmap.width,\n src.bitmap.height,\n function (sx, sy, idx) {\n const dstIdx = baseImage.getPixelIndex(\n x + sx,\n y + sy,\n constants.EDGE_CROP\n );\n\n if (dstIdx === -1) {\n // Skip target pixels outside of dst\n return;\n }\n\n const blended = blendmode(\n {\n r: this.bitmap.data[idx + 0] / 255,\n g: this.bitmap.data[idx + 1] / 255,\n b: this.bitmap.data[idx + 2] / 255,\n a: this.bitmap.data[idx + 3] / 255,\n },\n {\n r: baseImage.bitmap.data[dstIdx + 0] / 255,\n g: baseImage.bitmap.data[dstIdx + 1] / 255,\n b: baseImage.bitmap.data[dstIdx + 2] / 255,\n a: baseImage.bitmap.data[dstIdx + 3] / 255,\n },\n opacitySource\n );\n\n baseImage.bitmap.data[dstIdx + 0] = this.constructor.limit255(\n blended.r * 255\n );\n baseImage.bitmap.data[dstIdx + 1] = this.constructor.limit255(\n blended.g * 255\n );\n baseImage.bitmap.data[dstIdx + 2] = this.constructor.limit255(\n blended.b * 255\n );\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(\n blended.a * 255\n );\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n"],"mappings":";;;;;;AAAA;AACA;AAEA;AAAoD;AAAA;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,SAAS,CAACC,GAAG,EAAEC,CAAC,EAAEC,CAAC,EAAoB;EAAA,IAAlBC,OAAO,uEAAG,CAAC,CAAC;EAAA,IAAEC,EAAE;EAC3D,IAAI,OAAOD,OAAO,KAAK,UAAU,EAAE;IACjCC,EAAE,GAAGD,OAAO;IACZA,OAAO,GAAG,CAAC,CAAC;EACd;EAEA,IAAI,EAAEH,GAAG,YAAY,IAAI,CAACK,WAAW,CAAC,EAAE;IACtC,OAAOC,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,iCAAiC,EAAEH,EAAE,CAAC;EACrE;EAEA,IAAI,OAAOH,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAAE;IAClD,OAAOI,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAEH,EAAE,CAAC;EAC7D;EAEA,IAAI;IAAEI,IAAI;IAAEC,aAAa;IAAEC;EAAY,CAAC,GAAGP,OAAO;EAElD,IAAI,CAACK,IAAI,EAAE;IACTA,IAAI,GAAGG,SAAS,CAACC,iBAAiB;EACpC;EAEA,IACE,OAAOH,aAAa,KAAK,QAAQ,IACjCA,aAAa,GAAG,CAAC,IACjBA,aAAa,GAAG,CAAC,E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jimp/core/dist/constants.js b/project starter code/node_modules/@jimp/core/dist/constants.js index cc86acb3..1a5a65f1 100644 --- a/project starter code/node_modules/@jimp/core/dist/constants.js +++ b/project starter code/node_modules/@jimp/core/dist/constants.js @@ -3,51 +3,54 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.EDGE_CROP = exports.EDGE_WRAP = exports.EDGE_EXTEND = exports.BLEND_EXCLUSION = exports.BLEND_DIFFERENCE = exports.BLEND_HARDLIGHT = exports.BLEND_LIGHTEN = exports.BLEND_DARKEN = exports.BLEND_OVERLAY = exports.BLEND_SCREEN = exports.BLEND_ADD = exports.BLEND_MULTIPLY = exports.BLEND_DESTINATION_OVER = exports.BLEND_SOURCE_OVER = exports.VERTICAL_ALIGN_BOTTOM = exports.VERTICAL_ALIGN_MIDDLE = exports.VERTICAL_ALIGN_TOP = exports.HORIZONTAL_ALIGN_RIGHT = exports.HORIZONTAL_ALIGN_CENTER = exports.HORIZONTAL_ALIGN_LEFT = exports.AUTO = void 0; +exports.VERTICAL_ALIGN_TOP = exports.VERTICAL_ALIGN_MIDDLE = exports.VERTICAL_ALIGN_BOTTOM = exports.HORIZONTAL_ALIGN_RIGHT = exports.HORIZONTAL_ALIGN_LEFT = exports.HORIZONTAL_ALIGN_CENTER = exports.EDGE_WRAP = exports.EDGE_EXTEND = exports.EDGE_CROP = exports.BLEND_SOURCE_OVER = exports.BLEND_SCREEN = exports.BLEND_OVERLAY = exports.BLEND_MULTIPLY = exports.BLEND_LIGHTEN = exports.BLEND_HARDLIGHT = exports.BLEND_EXCLUSION = exports.BLEND_DIFFERENCE = exports.BLEND_DESTINATION_OVER = exports.BLEND_DARKEN = exports.BLEND_ADD = exports.AUTO = void 0; // used to auto resizing etc. -var AUTO = -1; // Align modes for cover, contain, bit masks +const AUTO = -1; +// Align modes for cover, contain, bit masks exports.AUTO = AUTO; -var HORIZONTAL_ALIGN_LEFT = 1; +const HORIZONTAL_ALIGN_LEFT = 1; exports.HORIZONTAL_ALIGN_LEFT = HORIZONTAL_ALIGN_LEFT; -var HORIZONTAL_ALIGN_CENTER = 2; +const HORIZONTAL_ALIGN_CENTER = 2; exports.HORIZONTAL_ALIGN_CENTER = HORIZONTAL_ALIGN_CENTER; -var HORIZONTAL_ALIGN_RIGHT = 4; +const HORIZONTAL_ALIGN_RIGHT = 4; exports.HORIZONTAL_ALIGN_RIGHT = HORIZONTAL_ALIGN_RIGHT; -var VERTICAL_ALIGN_TOP = 8; +const VERTICAL_ALIGN_TOP = 8; exports.VERTICAL_ALIGN_TOP = VERTICAL_ALIGN_TOP; -var VERTICAL_ALIGN_MIDDLE = 16; +const VERTICAL_ALIGN_MIDDLE = 16; exports.VERTICAL_ALIGN_MIDDLE = VERTICAL_ALIGN_MIDDLE; -var VERTICAL_ALIGN_BOTTOM = 32; // blend modes +const VERTICAL_ALIGN_BOTTOM = 32; +// blend modes exports.VERTICAL_ALIGN_BOTTOM = VERTICAL_ALIGN_BOTTOM; -var BLEND_SOURCE_OVER = 'srcOver'; +const BLEND_SOURCE_OVER = "srcOver"; exports.BLEND_SOURCE_OVER = BLEND_SOURCE_OVER; -var BLEND_DESTINATION_OVER = 'dstOver'; +const BLEND_DESTINATION_OVER = "dstOver"; exports.BLEND_DESTINATION_OVER = BLEND_DESTINATION_OVER; -var BLEND_MULTIPLY = 'multiply'; +const BLEND_MULTIPLY = "multiply"; exports.BLEND_MULTIPLY = BLEND_MULTIPLY; -var BLEND_ADD = 'add'; +const BLEND_ADD = "add"; exports.BLEND_ADD = BLEND_ADD; -var BLEND_SCREEN = 'screen'; +const BLEND_SCREEN = "screen"; exports.BLEND_SCREEN = BLEND_SCREEN; -var BLEND_OVERLAY = 'overlay'; +const BLEND_OVERLAY = "overlay"; exports.BLEND_OVERLAY = BLEND_OVERLAY; -var BLEND_DARKEN = 'darken'; +const BLEND_DARKEN = "darken"; exports.BLEND_DARKEN = BLEND_DARKEN; -var BLEND_LIGHTEN = 'lighten'; +const BLEND_LIGHTEN = "lighten"; exports.BLEND_LIGHTEN = BLEND_LIGHTEN; -var BLEND_HARDLIGHT = 'hardLight'; +const BLEND_HARDLIGHT = "hardLight"; exports.BLEND_HARDLIGHT = BLEND_HARDLIGHT; -var BLEND_DIFFERENCE = 'difference'; +const BLEND_DIFFERENCE = "difference"; exports.BLEND_DIFFERENCE = BLEND_DIFFERENCE; -var BLEND_EXCLUSION = 'exclusion'; // Edge Handling +const BLEND_EXCLUSION = "exclusion"; +// Edge Handling exports.BLEND_EXCLUSION = BLEND_EXCLUSION; -var EDGE_EXTEND = 1; +const EDGE_EXTEND = 1; exports.EDGE_EXTEND = EDGE_EXTEND; -var EDGE_WRAP = 2; +const EDGE_WRAP = 2; exports.EDGE_WRAP = EDGE_WRAP; -var EDGE_CROP = 3; +const EDGE_CROP = 3; exports.EDGE_CROP = EDGE_CROP; //# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/constants.js.map b/project starter code/node_modules/@jimp/core/dist/constants.js.map index 31fc25ea..2bf0d75d 100644 --- a/project starter code/node_modules/@jimp/core/dist/constants.js.map +++ b/project starter code/node_modules/@jimp/core/dist/constants.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/constants.js"],"names":["AUTO","HORIZONTAL_ALIGN_LEFT","HORIZONTAL_ALIGN_CENTER","HORIZONTAL_ALIGN_RIGHT","VERTICAL_ALIGN_TOP","VERTICAL_ALIGN_MIDDLE","VERTICAL_ALIGN_BOTTOM","BLEND_SOURCE_OVER","BLEND_DESTINATION_OVER","BLEND_MULTIPLY","BLEND_ADD","BLEND_SCREEN","BLEND_OVERLAY","BLEND_DARKEN","BLEND_LIGHTEN","BLEND_HARDLIGHT","BLEND_DIFFERENCE","BLEND_EXCLUSION","EDGE_EXTEND","EDGE_WRAP","EDGE_CROP"],"mappings":";;;;;;AAAA;AACO,IAAMA,IAAI,GAAG,CAAC,CAAd,C,CAEP;;;AACO,IAAMC,qBAAqB,GAAG,CAA9B;;AACA,IAAMC,uBAAuB,GAAG,CAAhC;;AACA,IAAMC,sBAAsB,GAAG,CAA/B;;AAEA,IAAMC,kBAAkB,GAAG,CAA3B;;AACA,IAAMC,qBAAqB,GAAG,EAA9B;;AACA,IAAMC,qBAAqB,GAAG,EAA9B,C,CAEP;;;AACO,IAAMC,iBAAiB,GAAG,SAA1B;;AACA,IAAMC,sBAAsB,GAAG,SAA/B;;AACA,IAAMC,cAAc,GAAG,UAAvB;;AACA,IAAMC,SAAS,GAAG,KAAlB;;AACA,IAAMC,YAAY,GAAG,QAArB;;AACA,IAAMC,aAAa,GAAG,SAAtB;;AACA,IAAMC,YAAY,GAAG,QAArB;;AACA,IAAMC,aAAa,GAAG,SAAtB;;AACA,IAAMC,eAAe,GAAG,WAAxB;;AACA,IAAMC,gBAAgB,GAAG,YAAzB;;AACA,IAAMC,eAAe,GAAG,WAAxB,C,CAEP;;;AACO,IAAMC,WAAW,GAAG,CAApB;;AACA,IAAMC,SAAS,GAAG,CAAlB;;AACA,IAAMC,SAAS,GAAG,CAAlB","sourcesContent":["// used to auto resizing etc.\nexport const AUTO = -1;\n\n// Align modes for cover, contain, bit masks\nexport const HORIZONTAL_ALIGN_LEFT = 1;\nexport const HORIZONTAL_ALIGN_CENTER = 2;\nexport const HORIZONTAL_ALIGN_RIGHT = 4;\n\nexport const VERTICAL_ALIGN_TOP = 8;\nexport const VERTICAL_ALIGN_MIDDLE = 16;\nexport const VERTICAL_ALIGN_BOTTOM = 32;\n\n// blend modes\nexport const BLEND_SOURCE_OVER = 'srcOver';\nexport const BLEND_DESTINATION_OVER = 'dstOver';\nexport const BLEND_MULTIPLY = 'multiply';\nexport const BLEND_ADD = 'add';\nexport const BLEND_SCREEN = 'screen';\nexport const BLEND_OVERLAY = 'overlay';\nexport const BLEND_DARKEN = 'darken';\nexport const BLEND_LIGHTEN = 'lighten';\nexport const BLEND_HARDLIGHT = 'hardLight';\nexport const BLEND_DIFFERENCE = 'difference';\nexport const BLEND_EXCLUSION = 'exclusion';\n\n// Edge Handling\nexport const EDGE_EXTEND = 1;\nexport const EDGE_WRAP = 2;\nexport const EDGE_CROP = 3;\n"],"file":"constants.js"} \ No newline at end of file +{"version":3,"file":"constants.js","names":["AUTO","HORIZONTAL_ALIGN_LEFT","HORIZONTAL_ALIGN_CENTER","HORIZONTAL_ALIGN_RIGHT","VERTICAL_ALIGN_TOP","VERTICAL_ALIGN_MIDDLE","VERTICAL_ALIGN_BOTTOM","BLEND_SOURCE_OVER","BLEND_DESTINATION_OVER","BLEND_MULTIPLY","BLEND_ADD","BLEND_SCREEN","BLEND_OVERLAY","BLEND_DARKEN","BLEND_LIGHTEN","BLEND_HARDLIGHT","BLEND_DIFFERENCE","BLEND_EXCLUSION","EDGE_EXTEND","EDGE_WRAP","EDGE_CROP"],"sources":["../src/constants.js"],"sourcesContent":["// used to auto resizing etc.\nexport const AUTO = -1;\n\n// Align modes for cover, contain, bit masks\nexport const HORIZONTAL_ALIGN_LEFT = 1;\nexport const HORIZONTAL_ALIGN_CENTER = 2;\nexport const HORIZONTAL_ALIGN_RIGHT = 4;\n\nexport const VERTICAL_ALIGN_TOP = 8;\nexport const VERTICAL_ALIGN_MIDDLE = 16;\nexport const VERTICAL_ALIGN_BOTTOM = 32;\n\n// blend modes\nexport const BLEND_SOURCE_OVER = \"srcOver\";\nexport const BLEND_DESTINATION_OVER = \"dstOver\";\nexport const BLEND_MULTIPLY = \"multiply\";\nexport const BLEND_ADD = \"add\";\nexport const BLEND_SCREEN = \"screen\";\nexport const BLEND_OVERLAY = \"overlay\";\nexport const BLEND_DARKEN = \"darken\";\nexport const BLEND_LIGHTEN = \"lighten\";\nexport const BLEND_HARDLIGHT = \"hardLight\";\nexport const BLEND_DIFFERENCE = \"difference\";\nexport const BLEND_EXCLUSION = \"exclusion\";\n\n// Edge Handling\nexport const EDGE_EXTEND = 1;\nexport const EDGE_WRAP = 2;\nexport const EDGE_CROP = 3;\n"],"mappings":";;;;;;AAAA;AACO,MAAMA,IAAI,GAAG,CAAC,CAAC;;AAEtB;AAAA;AACO,MAAMC,qBAAqB,GAAG,CAAC;AAAC;AAChC,MAAMC,uBAAuB,GAAG,CAAC;AAAC;AAClC,MAAMC,sBAAsB,GAAG,CAAC;AAAC;AAEjC,MAAMC,kBAAkB,GAAG,CAAC;AAAC;AAC7B,MAAMC,qBAAqB,GAAG,EAAE;AAAC;AACjC,MAAMC,qBAAqB,GAAG,EAAE;;AAEvC;AAAA;AACO,MAAMC,iBAAiB,GAAG,SAAS;AAAC;AACpC,MAAMC,sBAAsB,GAAG,SAAS;AAAC;AACzC,MAAMC,cAAc,GAAG,UAAU;AAAC;AAClC,MAAMC,SAAS,GAAG,KAAK;AAAC;AACxB,MAAMC,YAAY,GAAG,QAAQ;AAAC;AAC9B,MAAMC,aAAa,GAAG,SAAS;AAAC;AAChC,MAAMC,YAAY,GAAG,QAAQ;AAAC;AAC9B,MAAMC,aAAa,GAAG,SAAS;AAAC;AAChC,MAAMC,eAAe,GAAG,WAAW;AAAC;AACpC,MAAMC,gBAAgB,GAAG,YAAY;AAAC;AACtC,MAAMC,eAAe,GAAG,WAAW;;AAE1C;AAAA;AACO,MAAMC,WAAW,GAAG,CAAC;AAAC;AACtB,MAAMC,SAAS,GAAG,CAAC;AAAC;AACpB,MAAMC,SAAS,GAAG,CAAC;AAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/index.js b/project starter code/node_modules/@jimp/core/dist/index.js index a656d756..0d466bf6 100644 --- a/project starter code/node_modules/@jimp/core/dist/index.js +++ b/project starter code/node_modules/@jimp/core/dist/index.js @@ -1,165 +1,115 @@ "use strict"; -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - Object.defineProperty(exports, "__esModule", { value: true }); exports.addConstants = addConstants; exports.addJimpMethods = addJimpMethods; -exports.jimpEvMethod = jimpEvMethod; -exports.jimpEvChange = jimpEvChange; Object.defineProperty(exports, "addType", { enumerable: true, - get: function get() { + get: function () { return MIME.addType; } }); -exports["default"] = void 0; - -var _construct2 = _interopRequireDefault(require("@babel/runtime/helpers/construct")); - -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); - -var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); - -var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); - -var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); - -var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); - -var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")); - -var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - +exports.default = void 0; +exports.jimpEvChange = jimpEvChange; +exports.jimpEvMethod = jimpEvMethod; var _fs = _interopRequireDefault(require("fs")); - var _path = _interopRequireDefault(require("path")); - var _events = _interopRequireDefault(require("events")); - var _utils = require("@jimp/utils"); - var _anyBase = _interopRequireDefault(require("any-base")); - -var _mkdirp = _interopRequireDefault(require("mkdirp")); - var _pixelmatch = _interopRequireDefault(require("pixelmatch")); - var _tinycolor = _interopRequireDefault(require("tinycolor2")); - var _phash = _interopRequireDefault(require("./modules/phash")); - var _request = _interopRequireDefault(require("./request")); - var _composite = _interopRequireDefault(require("./composite")); - var _promisify = _interopRequireDefault(require("./utils/promisify")); - var MIME = _interopRequireWildcard(require("./utils/mime")); - var _imageBitmap = require("./utils/image-bitmap"); - var constants = _interopRequireWildcard(require("./constants")); - -var alphabet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'; // an array storing the maximum string length of hashes at various bases +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +const alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_"; + +// an array storing the maximum string length of hashes at various bases // 0 and 1 do not exist as possible hash lengths - -var maxHashLength = [NaN, NaN]; - -for (var i = 2; i < 65; i++) { - var maxHash = (0, _anyBase["default"])(_anyBase["default"].BIN, alphabet.slice(0, i))(new Array(64 + 1).join('1')); +const maxHashLength = [NaN, NaN]; +for (let i = 2; i < 65; i++) { + const maxHash = (0, _anyBase.default)(_anyBase.default.BIN, alphabet.slice(0, i))(new Array(64 + 1).join("1")); maxHashLength.push(maxHash.length); -} // no operation - +} -function noop() {} // error checking methods +// no operation +function noop() {} +// error checking methods function isArrayBuffer(test) { - return Object.prototype.toString.call(test).toLowerCase().indexOf('arraybuffer') > -1; -} // Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion, -// But this function is not useful when running in node directly - + return Object.prototype.toString.call(test).toLowerCase().indexOf("arraybuffer") > -1; +} +// Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion, +// But this function is not useful when running in node directly function bufferFromArrayBuffer(arrayBuffer) { - var buffer = Buffer.alloc(arrayBuffer.byteLength); - var view = new Uint8Array(arrayBuffer); - - for (var _i = 0; _i < buffer.length; ++_i) { - buffer[_i] = view[_i]; + const buffer = Buffer.alloc(arrayBuffer.byteLength); + const view = new Uint8Array(arrayBuffer); + for (let i = 0; i < buffer.length; ++i) { + buffer[i] = view[i]; } - return buffer; } - function loadFromURL(options, cb) { - (0, _request["default"])(options, function (err, response, data) { + (0, _request.default)(options, (err, data) => { if (err) { return cb(err); } - - if ('headers' in response && 'location' in response.headers) { - options.url = response.headers.location; - return loadFromURL(options, cb); - } - - if ((0, _typeof2["default"])(data) === 'object' && Buffer.isBuffer(data)) { + if (typeof data === "object" && Buffer.isBuffer(data)) { return cb(null, data); } - - var msg = 'Could not load Buffer from <' + options.url + '> ' + '(HTTP: ' + response.statusCode + ')'; - return new Error(msg); + if (typeof data === "object" && isArrayBuffer(data)) { + return cb(null, bufferFromArrayBuffer(data)); + } + return new Error(`Could not load Buffer from <${options.url}>`); }); } - function loadBufferFromPath(src, cb) { - if (_fs["default"] && typeof _fs["default"].readFile === 'function' && !src.match(/^(http|ftp)s?:\/\/./)) { - _fs["default"].readFile(src, cb); + if (_fs.default && typeof _fs.default.readFile === "function" && !src.match(/^(http|ftp)s?:\/\/./)) { + _fs.default.readFile(src, cb); } else { loadFromURL({ url: src }, cb); } } - function isRawRGBAData(obj) { - return obj && (0, _typeof2["default"])(obj) === 'object' && typeof obj.width === 'number' && typeof obj.height === 'number' && (Buffer.isBuffer(obj.data) || obj.data instanceof Uint8Array || typeof Uint8ClampedArray === 'function' && obj.data instanceof Uint8ClampedArray) && (obj.data.length === obj.width * obj.height * 4 || obj.data.length === obj.width * obj.height * 3); + return obj && typeof obj === "object" && typeof obj.width === "number" && typeof obj.height === "number" && (Buffer.isBuffer(obj.data) || obj.data instanceof Uint8Array || typeof Uint8ClampedArray === "function" && obj.data instanceof Uint8ClampedArray) && (obj.data.length === obj.width * obj.height * 4 || obj.data.length === obj.width * obj.height * 3); } - function makeRGBABufferFromRGB(buffer) { if (buffer.length % 3 !== 0) { - throw new Error('Buffer length is incorrect'); + throw new Error("Buffer length is incorrect"); } - - var rgbaBuffer = Buffer.allocUnsafe(buffer.length / 3 * 4); - var j = 0; - - for (var _i2 = 0; _i2 < buffer.length; _i2++) { - rgbaBuffer[j] = buffer[_i2]; - - if ((_i2 + 1) % 3 === 0) { + const rgbaBuffer = Buffer.allocUnsafe(buffer.length / 3 * 4); + let j = 0; + for (let i = 0; i < buffer.length; i++) { + rgbaBuffer[j] = buffer[i]; + if ((i + 1) % 3 === 0) { rgbaBuffer[++j] = 255; } - j++; } - return rgbaBuffer; } - -var emptyBitmap = { +const emptyBitmap = { data: null, width: null, height: null }; + /** * Jimp constructor (from a file) * @param path a path to the image @@ -199,222 +149,181 @@ var emptyBitmap = { * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap */ -var Jimp = -/*#__PURE__*/ -function (_EventEmitter) { - (0, _inherits2["default"])(Jimp, _EventEmitter); - +class Jimp extends _events.default { // An object representing a bitmap in memory, comprising: // - data: a buffer of the bitmap data // - width: the width of the image in pixels // - height: the height of the image in pixels + // Default colour to use for new pixels + // Default MIME is PNG + // Exif data for the image + // Whether Transparency supporting formats will be exported as RGB or RGBA - function Jimp() { - var _this; + constructor() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } - - (0, _classCallCheck2["default"])(this, Jimp); - _this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(Jimp).call(this)); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "bitmap", emptyBitmap); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_background", 0x00000000); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_originalMime", Jimp.MIME_PNG); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_exif", null); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_rgba", true); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "writeAsync", function (path) { - return (0, _promisify["default"])(_this.write, (0, _assertThisInitialized2["default"])(_this), path); - }); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBase64Async", function (mime) { - return (0, _promisify["default"])(_this.getBase64, (0, _assertThisInitialized2["default"])(_this), mime); - }); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBuffer", _imageBitmap.getBuffer); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBufferAsync", _imageBitmap.getBufferAsync); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getPixelColour", _this.getPixelColor); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setPixelColour", _this.setPixelColor); - var jimpInstance = (0, _assertThisInitialized2["default"])(_this); - var cb = noop; - + super(); + _defineProperty(this, "bitmap", emptyBitmap); + _defineProperty(this, "_background", 0x00000000); + _defineProperty(this, "_originalMime", Jimp.MIME_PNG); + _defineProperty(this, "_exif", null); + _defineProperty(this, "_rgba", true); + _defineProperty(this, "writeAsync", path => (0, _promisify.default)(this.write, this, path)); + _defineProperty(this, "getBase64Async", mime => (0, _promisify.default)(this.getBase64, this, mime)); + _defineProperty(this, "getBuffer", _imageBitmap.getBuffer); + _defineProperty(this, "getBufferAsync", _imageBitmap.getBufferAsync); + _defineProperty(this, "getPixelColour", this.getPixelColor); + _defineProperty(this, "setPixelColour", this.setPixelColor); + const jimpInstance = this; + let cb = noop; if (isArrayBuffer(args[0])) { args[0] = bufferFromArrayBuffer(args[0]); } - function finish() { for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } - - var err = args[0]; - var evData = err || {}; - evData.methodName = 'constructor'; - setTimeout(function () { - var _cb; - + const [err] = args; + const evData = err || {}; + evData.methodName = "constructor"; + setTimeout(() => { // run on next tick. if (err && cb === noop) { - jimpInstance.emitError('constructor', err); + jimpInstance.emitError("constructor", err); } else if (!err) { - jimpInstance.emitMulti('constructor', 'initialized'); + jimpInstance.emitMulti("constructor", "initialized"); } - - (_cb = cb).call.apply(_cb, [jimpInstance].concat(args)); + cb.call(jimpInstance, ...args); }, 1); } - - if (typeof args[0] === 'number' && typeof args[1] === 'number' || parseInt(args[0], 10) && parseInt(args[1], 10)) { + if (typeof args[0] === "number" && typeof args[1] === "number" || parseInt(args[0], 10) && parseInt(args[1], 10)) { // create a new image - var w = parseInt(args[0], 10); - var h = parseInt(args[1], 10); - cb = args[2]; // with a hex color + const w = parseInt(args[0], 10); + const h = parseInt(args[1], 10); + cb = args[2]; - if (typeof args[2] === 'number') { - _this._background = args[2]; + // with a hex color + if (typeof args[2] === "number") { + this._background = args[2]; cb = args[3]; - } // with a css color - + } - if (typeof args[2] === 'string') { - _this._background = Jimp.cssColorToHex(args[2]); + // with a css color + if (typeof args[2] === "string") { + this._background = Jimp.cssColorToHex(args[2]); cb = args[3]; } - - if (typeof cb === 'undefined') { + if (typeof cb === "undefined") { cb = noop; } - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); + if (typeof cb !== "function") { + return _utils.throwError.call(this, "cb must be a function", finish); } - - _this.bitmap = { + this.bitmap = { data: Buffer.alloc(w * h * 4), width: w, height: h }; - - for (var _i3 = 0; _i3 < _this.bitmap.data.length; _i3 += 4) { - _this.bitmap.data.writeUInt32BE(_this._background, _i3); + for (let i = 0; i < this.bitmap.data.length; i += 4) { + this.bitmap.data.writeUInt32BE(this._background, i); } - - finish(null, (0, _assertThisInitialized2["default"])(_this)); - } else if ((0, _typeof2["default"])(args[0]) === 'object' && args[0].url) { + finish(null, this); + } else if (typeof args[0] === "object" && args[0].url) { cb = args[1] || noop; - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); + if (typeof cb !== "function") { + return _utils.throwError.call(this, "cb must be a function", finish); } - - loadFromURL(args[0], function (err, data) { + loadFromURL(args[0], (err, data) => { if (err) { - return _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), err, finish); + return _utils.throwError.call(this, err, finish); } - - _this.parseBitmap(data, args[0].url, finish); + this.parseBitmap(data, args[0].url, finish); }); } else if (args[0] instanceof Jimp) { // clone an existing Jimp - var original = args[0]; + const [original] = args; cb = args[1]; - - if (typeof cb === 'undefined') { + if (typeof cb === "undefined") { cb = noop; } - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); + if (typeof cb !== "function") { + return _utils.throwError.call(this, "cb must be a function", finish); } - - _this.bitmap = { + this.bitmap = { data: Buffer.from(original.bitmap.data), width: original.bitmap.width, height: original.bitmap.height }; - _this._quality = original._quality; - _this._deflateLevel = original._deflateLevel; - _this._deflateStrategy = original._deflateStrategy; - _this._filterType = original._filterType; - _this._rgba = original._rgba; - _this._background = original._background; - _this._originalMime = original._originalMime; - finish(null, (0, _assertThisInitialized2["default"])(_this)); + this._quality = original._quality; + this._deflateLevel = original._deflateLevel; + this._deflateStrategy = original._deflateStrategy; + this._filterType = original._filterType; + this._rgba = original._rgba; + this._background = original._background; + this._originalMime = original._originalMime; + finish(null, this); } else if (isRawRGBAData(args[0])) { - var imageData = args[0]; + const [imageData] = args; cb = args[1] || noop; - var isRGBA = imageData.width * imageData.height * 4 === imageData.data.length; - var buffer = isRGBA ? Buffer.from(imageData.data) : makeRGBABufferFromRGB(imageData.data); - _this.bitmap = { + const isRGBA = imageData.width * imageData.height * 4 === imageData.data.length; + const buffer = isRGBA ? Buffer.from(imageData.data) : makeRGBABufferFromRGB(imageData.data); + this.bitmap = { data: buffer, width: imageData.width, height: imageData.height }; - finish(null, (0, _assertThisInitialized2["default"])(_this)); - } else if (typeof args[0] === 'string') { + finish(null, this); + } else if (typeof args[0] === "string") { // read from a path - var path = args[0]; + const path = args[0]; cb = args[1]; - - if (typeof cb === 'undefined') { + if (typeof cb === "undefined") { cb = noop; } - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); + if (typeof cb !== "function") { + return _utils.throwError.call(this, "cb must be a function", finish); } - - loadBufferFromPath(path, function (err, data) { + loadBufferFromPath(path, (err, data) => { if (err) { - return _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), err, finish); + return _utils.throwError.call(this, err, finish); } - - _this.parseBitmap(data, path, finish); + this.parseBitmap(data, path, finish); }); - } else if ((0, _typeof2["default"])(args[0]) === 'object' && Buffer.isBuffer(args[0])) { + } else if (typeof args[0] === "object" && Buffer.isBuffer(args[0])) { // read from a buffer - var data = args[0]; + const data = args[0]; cb = args[1]; - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); + if (typeof cb !== "function") { + return _utils.throwError.call(this, "cb must be a function", finish); } - - _this.parseBitmap(data, null, finish); + this.parseBitmap(data, null, finish); } else { // Allow client libs to add new ways to build a Jimp object. // Extra constructors must be added by `Jimp.appendConstructorOption()` cb = args[args.length - 1]; - - if (typeof cb !== 'function') { + if (typeof cb !== "function") { // TODO: try to solve the args after cb problem. cb = args[args.length - 2]; - - if (typeof cb !== 'function') { + if (typeof cb !== "function") { cb = noop; } } - - var extraConstructor = Jimp.__extraConstructors.find(function (c) { - return c.test.apply(c, args); - }); - + const extraConstructor = Jimp.__extraConstructors.find(c => c.test(...args)); if (extraConstructor) { - new Promise(function (resolve, reject) { - var _extraConstructor$run; - - return (_extraConstructor$run = extraConstructor.run).call.apply(_extraConstructor$run, [(0, _assertThisInitialized2["default"])(_this), resolve, reject].concat(args)); - }).then(function () { - return finish(null, (0, _assertThisInitialized2["default"])(_this)); - })["catch"](finish); + new Promise((resolve, reject) => { + extraConstructor.run.call(this, resolve, reject, ...args); + }).then(() => finish(null, this)).catch(finish); } else { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'No matching constructor overloading was found. ' + 'Please see the docs for how to call the Jimp constructor.', finish)); + return _utils.throwError.call(this, "No matching constructor overloading was found. " + "Please see the docs for how to call the Jimp constructor.", finish); } } - - return _this; } + /** * Parse a bitmap with the loaded image types. * @@ -423,513 +332,408 @@ function (_EventEmitter) { * @param {function(Error, Jimp)} finish (optional) a callback for when complete * @memberof Jimp */ + parseBitmap(data, path, finish) { + _imageBitmap.parseBitmap.call(this, data, null, finish); + } + /** + * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA) + * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + rgba(bool, cb) { + if (typeof bool !== "boolean") { + return _utils.throwError.call(this, "bool must be a boolean, true for RGBA or false for RGB", cb); + } + this._rgba = bool; + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + } - (0, _createClass2["default"])(Jimp, [{ - key: "parseBitmap", - value: function parseBitmap(data, path, finish) { - _imageBitmap.parseBitmap.call(this, data, null, finish); + /** + * Emit for multiple listeners + * @param {string} methodName name of the method to emit an error for + * @param {string} eventName name of the eventName to emit an error for + * @param {object} data to emit + */ + emitMulti(methodName, eventName) { + let data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + data = Object.assign(data, { + methodName, + eventName + }); + this.emit("any", data); + if (methodName) { + this.emit(methodName, data); } - /** - * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA) - * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ + this.emit(eventName, data); + } + emitError(methodName, err) { + this.emitMulti(methodName, "error", err); + } - }, { - key: "rgba", - value: function rgba(bool, cb) { - if (typeof bool !== 'boolean') { - return _utils.throwError.call(this, 'bool must be a boolean, true for RGBA or false for RGB', cb); - } + /** + * Get the current height of the image + * @return {number} height of the image + */ + getHeight() { + return this.bitmap.height; + } - this._rgba = bool; + /** + * Get the current width of the image + * @return {number} width of the image + */ + getWidth() { + return this.bitmap.width; + } - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } + /** + * Nicely format Jimp object when sent to the console e.g. console.log(image) + * @returns {string} pretty printed + */ + inspect() { + return ""; + } - return this; - } - /** - * Emit for multiple listeners - * @param {string} methodName name of the method to emit an error for - * @param {string} eventName name of the eventName to emit an error for - * @param {object} data to emit - */ + /** + * Nicely format Jimp object when converted to a string + * @returns {string} pretty printed + */ + toString() { + return "[object Jimp]"; + } - }, { - key: "emitMulti", - value: function emitMulti(methodName, eventName) { - var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - data = Object.assign(data, { - methodName: methodName, - eventName: eventName - }); - this.emit('any', data); + /** + * Returns the original MIME of the image (default: "image/png") + * @returns {string} the MIME + */ + getMIME() { + const mime = this._originalMime || Jimp.MIME_PNG; + return mime; + } - if (methodName) { - this.emit(methodName, data); - } + /** + * Returns the appropriate file extension for the original MIME of the image (default: "png") + * @returns {string} the file extension + */ + getExtension() { + const mime = this.getMIME(); + return MIME.getExtension(mime); + } - this.emit(eventName, data); + /** + * Writes the image to a file + * @param {string} path a path to the destination file + * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk + * @returns {Jimp} this for chaining of methods + */ + write(path, cb) { + if (!_fs.default || !_fs.default.createWriteStream) { + throw new Error("Cant access the filesystem. You can use the getBase64 method."); } - }, { - key: "emitError", - value: function emitError(methodName, err) { - this.emitMulti(methodName, 'error', err); + if (typeof path !== "string") { + return _utils.throwError.call(this, "path must be a string", cb); } - /** - * Get the current height of the image - * @return {number} height of the image - */ - - }, { - key: "getHeight", - value: function getHeight() { - return this.bitmap.height; + if (typeof cb === "undefined") { + cb = noop; } - /** - * Get the current width of the image - * @return {number} width of the image - */ - - }, { - key: "getWidth", - value: function getWidth() { - return this.bitmap.width; + if (typeof cb !== "function") { + return _utils.throwError.call(this, "cb must be a function", cb); } - /** - * Nicely format Jimp object when sent to the console e.g. console.log(image) - * @returns {string} pretty printed - */ - - }, { - key: "inspect", - value: function inspect() { - return ''; + const mime = MIME.getType(path) || this.getMIME(); + const pathObj = _path.default.parse(path); + if (pathObj.dir) { + _fs.default.mkdirSync(pathObj.dir, { + recursive: true + }); } - /** - * Nicely format Jimp object when converted to a string - * @returns {string} pretty printed - */ - - }, { - key: "toString", - value: function toString() { - return '[object Jimp]'; + this.getBuffer(mime, (err, buffer) => { + if (err) { + return _utils.throwError.call(this, err, cb); + } + const stream = _fs.default.createWriteStream(path); + stream.on("open", () => { + stream.write(buffer); + stream.end(); + }).on("error", err => { + return _utils.throwError.call(this, err, cb); + }); + stream.on("finish", () => { + cb.call(this, null, this); + }); + }); + return this; + } + /** + * Converts the image to a base 64 string + * @param {string} mime the mime type of the image data to be created + * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument + * @returns {Jimp} this for chaining of methods + */ + getBase64(mime, cb) { + if (mime === Jimp.AUTO) { + // allow auto MIME detection + mime = this.getMIME(); } - /** - * Returns the original MIME of the image (default: "image/png") - * @returns {string} the MIME - */ - - }, { - key: "getMIME", - value: function getMIME() { - var mime = this._originalMime || Jimp.MIME_PNG; - return mime; + if (typeof mime !== "string") { + return _utils.throwError.call(this, "mime must be a string", cb); } - /** - * Returns the appropriate file extension for the original MIME of the image (default: "png") - * @returns {string} the file extension - */ - - }, { - key: "getExtension", - value: function getExtension() { - var mime = this.getMIME(); - return MIME.getExtension(mime); + if (typeof cb !== "function") { + return _utils.throwError.call(this, "cb must be a function", cb); } - /** - * Writes the image to a file - * @param {string} path a path to the destination file - * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk - * @returns {Jimp} this for chaining of methods - */ - - }, { - key: "write", - value: function write(path, cb) { - var _this2 = this; - - if (!_fs["default"] || !_fs["default"].createWriteStream) { - throw new Error('Cant access the filesystem. You can use the getBase64 method.'); - } - - if (typeof path !== 'string') { - return _utils.throwError.call(this, 'path must be a string', cb); - } - - if (typeof cb === 'undefined') { - cb = noop; - } - - if (typeof cb !== 'function') { - return _utils.throwError.call(this, 'cb must be a function', cb); - } - - var mime = MIME.getType(path) || this.getMIME(); - - var pathObj = _path["default"].parse(path); - - if (pathObj.dir) { - _mkdirp["default"].sync(pathObj.dir); + this.getBuffer(mime, function (err, data) { + if (err) { + return _utils.throwError.call(this, err, cb); } - - this.getBuffer(mime, function (err, buffer) { - if (err) { - return _utils.throwError.call(_this2, err, cb); - } - - var stream = _fs["default"].createWriteStream(path); - - stream.on('open', function () { - stream.write(buffer); - stream.end(); - }).on('error', function (err) { - return _utils.throwError.call(_this2, err, cb); - }); - stream.on('finish', function () { - cb.call(_this2, null, _this2); - }); - }); - return this; + const src = "data:" + mime + ";base64," + data.toString("base64"); + cb.call(this, null, src); + }); + return this; + } + /** + * Generates a perceptual hash of the image . And pads the string. Can configure base. + * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64. + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {string} a string representing the hash + */ + hash(base, cb) { + base = base || 64; + if (typeof base === "function") { + cb = base; + base = 64; } - }, { - key: "getBase64", - - /** - * Converts the image to a base 64 string - * @param {string} mime the mime type of the image data to be created - * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument - * @returns {Jimp} this for chaining of methods - */ - value: function getBase64(mime, cb) { - if (mime === Jimp.AUTO) { - // allow auto MIME detection - mime = this.getMIME(); - } - - if (typeof mime !== 'string') { - return _utils.throwError.call(this, 'mime must be a string', cb); - } - - if (typeof cb !== 'function') { - return _utils.throwError.call(this, 'cb must be a function', cb); - } - - this.getBuffer(mime, function (err, data) { - if (err) { - return _utils.throwError.call(this, err, cb); - } - - var src = 'data:' + mime + ';base64,' + data.toString('base64'); - cb.call(this, null, src); - }); - return this; + if (typeof base !== "number") { + return _utils.throwError.call(this, "base must be a number", cb); } - }, { - key: "hash", - - /** - * Generates a perceptual hash of the image . And pads the string. Can configure base. - * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {string} a string representing the hash - */ - value: function hash(base, cb) { - base = base || 64; - - if (typeof base === 'function') { - cb = base; - base = 64; - } - - if (typeof base !== 'number') { - return _utils.throwError.call(this, 'base must be a number', cb); - } - - if (base < 2 || base > 64) { - return _utils.throwError.call(this, 'base must be a number between 2 and 64', cb); - } - - var hash = this.pHash(); - hash = (0, _anyBase["default"])(_anyBase["default"].BIN, alphabet.slice(0, base))(hash); - - while (hash.length < maxHashLength[base]) { - hash = '0' + hash; // pad out with leading zeros - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, hash); - } - - return hash; + if (base < 2 || base > 64) { + return _utils.throwError.call(this, "base must be a number between 2 and 64", cb); } - /** - * Calculates the perceptual hash - * @returns {number} the perceptual hash - */ - - }, { - key: "pHash", - value: function pHash() { - var pHash = new _phash["default"](); - return pHash.getHash(this); + let hash = this.pHash(); + hash = (0, _anyBase.default)(_anyBase.default.BIN, alphabet.slice(0, base))(hash); + while (hash.length < maxHashLength[base]) { + hash = "0" + hash; // pad out with leading zeros } - /** - * Calculates the hamming distance of the current image and a hash based on their perceptual hash - * @param {hash} compareHash hash to compare to - * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical - */ - }, { - key: "distanceFromHash", - value: function distanceFromHash(compareHash) { - var pHash = new _phash["default"](); - var currentHash = pHash.getHash(this); - return pHash.distance(currentHash, compareHash); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, hash); } - /** - * Converts the image to a buffer - * @param {string} mime the mime type of the image buffer to be created - * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument - * @returns {Jimp} this for chaining of methods - */ - - }, { - key: "getPixelIndex", - - /** - * Returns the offset of a pixel in the bitmap buffer - * @param {number} x the x coordinate - * @param {number} y the y coordinate - * @param {string} edgeHandling (optional) define how to sum pixels from outside the border - * @param {number} cb (optional) a callback for when complete - * @returns {number} the index of the pixel or -1 if not found - */ - value: function getPixelIndex(x, y, edgeHandling, cb) { - var xi; - var yi; - - if (typeof edgeHandling === 'function' && typeof cb === 'undefined') { - cb = edgeHandling; - edgeHandling = null; - } - - if (!edgeHandling) { - edgeHandling = Jimp.EDGE_EXTEND; - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } // round input - - - x = Math.round(x); - y = Math.round(y); - xi = x; - yi = y; + return hash; + } - if (edgeHandling === Jimp.EDGE_EXTEND) { - if (x < 0) xi = 0; - if (x >= this.bitmap.width) xi = this.bitmap.width - 1; - if (y < 0) yi = 0; - if (y >= this.bitmap.height) yi = this.bitmap.height - 1; - } + /** + * Calculates the perceptual hash + * @returns {number} the perceptual hash + */ + pHash() { + const pHash = new _phash.default(); + return pHash.getHash(this); + } - if (edgeHandling === Jimp.EDGE_WRAP) { - if (x < 0) { - xi = this.bitmap.width + x; - } + /** + * Calculates the hamming distance of the current image and a hash based on their perceptual hash + * @param {hash} compareHash hash to compare to + * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical + */ + distanceFromHash(compareHash) { + const pHash = new _phash.default(); + const currentHash = pHash.getHash(this); + return pHash.distance(currentHash, compareHash); + } - if (x >= this.bitmap.width) { - xi = x % this.bitmap.width; - } + /** + * Converts the image to a buffer + * @param {string} mime the mime type of the image buffer to be created + * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument + * @returns {Jimp} this for chaining of methods + */ - if (y < 0) { - xi = this.bitmap.height + y; - } + /** + * Returns the offset of a pixel in the bitmap buffer + * @param {number} x the x coordinate + * @param {number} y the y coordinate + * @param {number} edgeHandling (optional) define how to sum pixels from outside the border + * @param {number} cb (optional) a callback for when complete + * @returns {number} the index of the pixel or -1 if not found + */ + getPixelIndex(x, y, edgeHandling, cb) { + let xi; + let yi; + if (typeof edgeHandling === "function" && typeof cb === "undefined") { + cb = edgeHandling; + edgeHandling = null; + } + if (!edgeHandling) { + edgeHandling = Jimp.EDGE_EXTEND; + } + if (typeof x !== "number" || typeof y !== "number") { + return _utils.throwError.call(this, "x and y must be numbers", cb); + } - if (y >= this.bitmap.height) { - yi = y % this.bitmap.height; - } + // round input + x = Math.round(x); + y = Math.round(y); + xi = x; + yi = y; + if (edgeHandling === Jimp.EDGE_EXTEND) { + if (x < 0) xi = 0; + if (x >= this.bitmap.width) xi = this.bitmap.width - 1; + if (y < 0) yi = 0; + if (y >= this.bitmap.height) yi = this.bitmap.height - 1; + } + if (edgeHandling === Jimp.EDGE_WRAP) { + if (x < 0) { + xi = this.bitmap.width + x; } - - var i = this.bitmap.width * yi + xi << 2; // if out of bounds index is -1 - - if (xi < 0 || xi >= this.bitmap.width) { - i = -1; + if (x >= this.bitmap.width) { + xi = x % this.bitmap.width; } - - if (yi < 0 || yi >= this.bitmap.height) { - i = -1; + if (y < 0) { + yi = this.bitmap.height + y; } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, i); + if (y >= this.bitmap.height) { + yi = y % this.bitmap.height; } - - return i; } - /** - * Returns the hex colour value of a pixel - * @param {number} x the x coordinate - * @param {number} y the y coordinate - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {number} the color of the pixel - */ - - }, { - key: "getPixelColor", - value: function getPixelColor(x, y, cb) { - if (typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'x and y must be numbers', cb); // round input + let i = this.bitmap.width * yi + xi << 2; - x = Math.round(x); - y = Math.round(y); - var idx = this.getPixelIndex(x, y); - var hex = this.bitmap.data.readUInt32BE(idx); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, hex); - } - - return hex; + // if out of bounds index is -1 + if (xi < 0 || xi >= this.bitmap.width) { + i = -1; } - }, { - key: "setPixelColor", - - /** - * Returns the hex colour value of a pixel - * @param {number} hex color to set - * @param {number} x the x coordinate - * @param {number} y the y coordinate - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {number} the index of the pixel or -1 if not found - */ - value: function setPixelColor(hex, x, y, cb) { - if (typeof hex !== 'number' || typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'hex, x and y must be numbers', cb); // round input - - x = Math.round(x); - y = Math.round(y); - var idx = this.getPixelIndex(x, y); - this.bitmap.data.writeUInt32BE(hex, idx); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; + if (yi < 0 || yi >= this.bitmap.height) { + i = -1; } - }, { - key: "hasAlpha", - - /** - * Determine if the image contains opaque pixels. - * @return {boolean} hasAlpha whether the image contains opaque pixels - */ - value: function hasAlpha() { - for (var yIndex = 0; yIndex < this.bitmap.height; yIndex++) { - for (var xIndex = 0; xIndex < this.bitmap.width; xIndex++) { - var idx = this.bitmap.width * yIndex + xIndex << 2; - var alpha = this.bitmap.data[idx + 3]; - - if (alpha !== 0xff) { - return true; - } - } - } - - return false; + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, i); } - /** - * Iterate scan through a region of the bitmap - * @param {number} x the x coordinate to begin the scan at - * @param {number} y the y coordinate to begin the scan at - * @param w the width of the scan region - * @param h the height of the scan region - * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>} - */ - - }, { - key: "scanIterator", - value: function scanIterator(x, y, w, h) { - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers'); - } + return i; + } - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers'); + /** + * Returns the hex colour value of a pixel + * @param {number} x the x coordinate + * @param {number} y the y coordinate + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {number} the color of the pixel + */ + getPixelColor(x, y, cb) { + if (typeof x !== "number" || typeof y !== "number") return _utils.throwError.call(this, "x and y must be numbers", cb); + const idx = this.getPixelIndex(x, y); + const hex = this.bitmap.data.readUInt32BE(idx); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, hex); + } + return hex; + } + /** + * Returns the hex colour value of a pixel + * @param {number} hex color to set + * @param {number} x the x coordinate + * @param {number} y the y coordinate + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {number} the index of the pixel or -1 if not found + */ + setPixelColor(hex, x, y, cb) { + if (typeof hex !== "number" || typeof x !== "number" || typeof y !== "number") return _utils.throwError.call(this, "hex, x and y must be numbers", cb); + const idx = this.getPixelIndex(x, y); + this.bitmap.data.writeUInt32BE(hex, idx); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + } + /** + * Determine if the image contains opaque pixels. + * @return {boolean} hasAlpha whether the image contains opaque pixels + */ + hasAlpha() { + const { + width, + height, + data + } = this.bitmap; + const byteLen = width * height << 2; + for (let idx = 3; idx < byteLen; idx += 4) { + if (data[idx] !== 0xff) { + return true; } - - return (0, _utils.scanIterator)(this, x, y, w, h); } - }]); - return Jimp; -}(_events["default"]); + return false; + } + /** + * Iterate scan through a region of the bitmap + * @param {number} x the x coordinate to begin the scan at + * @param {number} y the y coordinate to begin the scan at + * @param w the width of the scan region + * @param h the height of the scan region + * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>} + */ + scanIterator(x, y, w, h) { + if (typeof x !== "number" || typeof y !== "number") { + return _utils.throwError.call(this, "x and y must be numbers"); + } + if (typeof w !== "number" || typeof h !== "number") { + return _utils.throwError.call(this, "w and h must be numbers"); + } + return (0, _utils.scanIterator)(this, x, y, w, h); + } +} function addConstants(constants) { - var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp; - Object.entries(constants).forEach(function (_ref) { - var _ref2 = (0, _slicedToArray2["default"])(_ref, 2), - name = _ref2[0], - value = _ref2[1]; - + let jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp; + Object.entries(constants).forEach(_ref => { + let [name, value] = _ref; jimpInstance[name] = value; }); } - function addJimpMethods(methods) { - var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp; - Object.entries(methods).forEach(function (_ref3) { - var _ref4 = (0, _slicedToArray2["default"])(_ref3, 2), - name = _ref4[0], - value = _ref4[1]; - + let jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp; + Object.entries(methods).forEach(_ref2 => { + let [name, value] = _ref2; jimpInstance.prototype[name] = value; }); } - addConstants(constants); addJimpMethods({ - composite: _composite["default"] + composite: _composite.default }); Jimp.__extraConstructors = []; + /** * Allow client libs to add new ways to build a Jimp object. * @param {string} name identify the extra constructor. * @param {function} test a function that returns true when it accepts the arguments passed to the main constructor. * @param {function} run where the magic happens. */ - Jimp.appendConstructorOption = function (name, test, run) { Jimp.__extraConstructors.push({ - name: name, - test: test, - run: run + name, + test, + run }); }; + /** * Read an image from a file or a Buffer. Takes the same args as the constructor * @returns {Promise} a promise */ - - Jimp.read = function () { for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { args[_key3] = arguments[_key3]; } - - return new Promise(function (resolve, reject) { - (0, _construct2["default"])(Jimp, args.concat([function (err, image) { + return new Promise((resolve, reject) => { + // eslint-disable-next-line no-new + new Jimp(...args, (err, image) => { if (err) reject(err);else resolve(image); - }])); + }); }); }; - Jimp.create = Jimp.read; + /** * A static helper method that converts RGBA values to a single integer value * @param {number} r the red value (0-255) @@ -939,90 +743,82 @@ Jimp.create = Jimp.read; * @param {function(Error, Jimp)} cb (optional) A callback for when complete * @returns {number} an single integer colour value */ - Jimp.rgbaToInt = function (r, g, b, a, cb) { - if (typeof r !== 'number' || typeof g !== 'number' || typeof b !== 'number' || typeof a !== 'number') { - return _utils.throwError.call(this, 'r, g, b and a must be numbers', cb); + if (typeof r !== "number" || typeof g !== "number" || typeof b !== "number" || typeof a !== "number") { + return _utils.throwError.call(this, "r, g, b and a must be numbers", cb); } - if (r < 0 || r > 255) { - return _utils.throwError.call(this, 'r must be between 0 and 255', cb); + return _utils.throwError.call(this, "r must be between 0 and 255", cb); } - if (g < 0 || g > 255) { - _utils.throwError.call(this, 'g must be between 0 and 255', cb); + _utils.throwError.call(this, "g must be between 0 and 255", cb); } - if (b < 0 || b > 255) { - return _utils.throwError.call(this, 'b must be between 0 and 255', cb); + return _utils.throwError.call(this, "b must be between 0 and 255", cb); } - if (a < 0 || a > 255) { - return _utils.throwError.call(this, 'a must be between 0 and 255', cb); + return _utils.throwError.call(this, "a must be between 0 and 255", cb); } - - r = Math.round(r); - b = Math.round(b); - g = Math.round(g); - a = Math.round(a); - var i = r * Math.pow(256, 3) + g * Math.pow(256, 2) + b * Math.pow(256, 1) + a * Math.pow(256, 0); - + let i = r & 0xff; + i <<= 8; + i |= g & 0xff; + i <<= 8; + i |= b & 0xff; + i <<= 8; + i |= a & 0xff; + + // Ensure sign is correct + i >>>= 0; if ((0, _utils.isNodePattern)(cb)) { cb.call(this, null, i); } - return i; }; + /** * A static helper method that converts RGBA values to a single integer value * @param {number} i a single integer value representing an RGBA colour (e.g. 0xFF0000FF for red) * @param {function(Error, Jimp)} cb (optional) A callback for when complete * @returns {object} an object with the properties r, g, b and a representing RGBA values */ - - Jimp.intToRGBA = function (i, cb) { - if (typeof i !== 'number') { - return _utils.throwError.call(this, 'i must be a number', cb); + if (typeof i !== "number") { + return _utils.throwError.call(this, "i must be a number", cb); } - - var rgba = {}; + const rgba = {}; rgba.r = Math.floor(i / Math.pow(256, 3)); rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2)); rgba.b = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) / Math.pow(256, 1)); rgba.a = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2) - rgba.b * Math.pow(256, 1)) / Math.pow(256, 0)); - if ((0, _utils.isNodePattern)(cb)) { cb.call(this, null, rgba); } - return rgba; }; + /** * Converts a css color (Hex, 8-digit (RGBA) Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, Named) to a hex number * @param {string} cssColor a number * @returns {number} a hex number representing a color */ - - Jimp.cssColorToHex = function (cssColor) { cssColor = cssColor || 0; // 0, null, undefined, NaN - if (typeof cssColor === 'number') return Number(cssColor); - return parseInt((0, _tinycolor["default"])(cssColor).toHex8(), 16); + if (typeof cssColor === "number") return Number(cssColor); + return parseInt((0, _tinycolor.default)(cssColor).toHex8(), 16); }; + /** * Limits a number to between 0 or 255 * @param {number} n a number * @returns {number} the number limited to between 0 or 255 */ - - Jimp.limit255 = function (n) { n = Math.max(n, 0); n = Math.min(n, 255); return n; }; + /** * Diffs two images and returns * @param {Jimp} img1 a Jimp image to compare @@ -1030,14 +826,11 @@ Jimp.limit255 = function (n) { * @param {number} threshold (optional) a number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1) * @returns {object} an object { percent: percent similar, diff: a Jimp image highlighting differences } */ - - Jimp.diff = function (img1, img2) { - var threshold = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.1; - if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp)) return _utils.throwError.call(this, 'img1 and img2 must be an Jimp images'); - var bmp1 = img1.bitmap; - var bmp2 = img2.bitmap; - + let threshold = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.1; + if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp)) return _utils.throwError.call(this, "img1 and img2 must be an Jimp images"); + const bmp1 = img1.bitmap; + const bmp2 = img2.bitmap; if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) { if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) { // img1 is bigger @@ -1047,46 +840,43 @@ Jimp.diff = function (img1, img2) { img2 = img2.cloneQuiet().resize(bmp1.width, bmp1.height); } } - - if (typeof threshold !== 'number' || threshold < 0 || threshold > 1) { - return _utils.throwError.call(this, 'threshold must be a number between 0 and 1'); + if (typeof threshold !== "number" || threshold < 0 || threshold > 1) { + return _utils.throwError.call(this, "threshold must be a number between 0 and 1"); } - - var diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff); - var numDiffPixels = (0, _pixelmatch["default"])(bmp1.data, bmp2.data, diff.bitmap.data, diff.bitmap.width, diff.bitmap.height, { - threshold: threshold + const diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff); + const numDiffPixels = (0, _pixelmatch.default)(bmp1.data, bmp2.data, diff.bitmap.data, diff.bitmap.width, diff.bitmap.height, { + threshold }); return { percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height), image: diff }; }; + /** * Calculates the hamming distance of two images based on their perceptual hash * @param {Jimp} img1 a Jimp image to compare * @param {Jimp} img2 a Jimp image to compare * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical */ - - Jimp.distance = function (img1, img2) { - var phash = new _phash["default"](); - var hash1 = phash.getHash(img1); - var hash2 = phash.getHash(img2); + const phash = new _phash.default(); + const hash1 = phash.getHash(img1); + const hash2 = phash.getHash(img2); return phash.distance(hash1, hash2); }; + /** * Calculates the hamming distance of two images based on their perceptual hash * @param {hash} hash1 a pHash * @param {hash} hash2 a pHash * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical */ - - Jimp.compareHashes = function (hash1, hash2) { - var phash = new _phash["default"](); + const phash = new _phash.default(); return phash.distance(hash1, hash2); }; + /** * Compute color difference * 0 means no difference, 1 means maximum difference. @@ -1096,26 +886,21 @@ Jimp.compareHashes = function (hash1, hash2) { * Where `a` is optional and `val` is an integer between 0 and 255. * @returns {number} float between 0 and 1. */ - - Jimp.colorDiff = function (rgba1, rgba2) { - var pow = function pow(n) { - return Math.pow(n, 2); - }; - - var max = Math.max; - var maxVal = 255 * 255 * 3; - + const pow = n => Math.pow(n, 2); + const { + max + } = Math; + const maxVal = 255 * 255 * 3; if (rgba1.a !== 0 && !rgba1.a) { rgba1.a = 255; } - if (rgba2.a !== 0 && !rgba2.a) { rgba2.a = 255; } - return (max(pow(rgba1.r - rgba2.r), pow(rgba1.r - rgba2.r - rgba1.a + rgba2.a)) + max(pow(rgba1.g - rgba2.g), pow(rgba1.g - rgba2.g - rgba1.a + rgba2.a)) + max(pow(rgba1.b - rgba2.b), pow(rgba1.b - rgba2.b - rgba1.a + rgba2.a))) / maxVal; }; + /** * Helper to create Jimp methods that emit events before and after its execution. * @param {string} methodName The name to be appended to Jimp prototype. @@ -1130,110 +915,92 @@ Jimp.colorDiff = function (rgba1, rgba2) { * The emitted event comes with a object parameter to the listener with the * `methodName` as one attribute. */ - - function jimpEvMethod(methodName, evName, method) { - var evNameBefore = 'before-' + evName; - var evNameAfter = evName.replace(/e$/, '') + 'ed'; - + const evNameBefore = "before-" + evName; + const evNameAfter = evName.replace(/e$/, "") + "ed"; Jimp.prototype[methodName] = function () { - var wrappedCb; - + let wrappedCb; for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { args[_key4] = arguments[_key4]; } - - var cb = args[method.length - 1]; - var jimpInstance = this; - - if (typeof cb === 'function') { - wrappedCb = function wrappedCb() { + const cb = args[method.length - 1]; + const jimpInstance = this; + if (typeof cb === "function") { + wrappedCb = function () { for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { args[_key5] = arguments[_key5]; } - - var err = args[0], - data = args[1]; - + const [err, data] = args; if (err) { jimpInstance.emitError(methodName, err); } else { - jimpInstance.emitMulti(methodName, evNameAfter, (0, _defineProperty2["default"])({}, methodName, data)); + jimpInstance.emitMulti(methodName, evNameAfter, { + [methodName]: data + }); } - cb.apply(this, args); }; - args[args.length - 1] = wrappedCb; } else { wrappedCb = false; } - this.emitMulti(methodName, evNameBefore); - var result; - + let result; try { result = method.apply(this, args); - if (!wrappedCb) { - this.emitMulti(methodName, evNameAfter, (0, _defineProperty2["default"])({}, methodName, result)); + this.emitMulti(methodName, evNameAfter, { + [methodName]: result + }); } } catch (error) { error.methodName = methodName; this.emitError(methodName, error); } - return result; }; - - Jimp.prototype[methodName + 'Quiet'] = method; + Jimp.prototype[methodName + "Quiet"] = method; } + /** * Creates a new image that is a clone of this one. * @param {function(Error, Jimp)} cb (optional) A callback for when complete * @returns the new image */ - - -jimpEvMethod('clone', 'clone', function (cb) { - var clone = new Jimp(this); - +jimpEvMethod("clone", "clone", function (cb) { + const clone = new Jimp(this); if ((0, _utils.isNodePattern)(cb)) { cb.call(clone, null, clone); } - return clone; }); + /** * Simplify jimpEvMethod call for the common `change` evName. * @param {string} methodName name of the method * @param {function} method to watch changes for */ - function jimpEvChange(methodName, method) { - jimpEvMethod(methodName, 'change', method); + jimpEvMethod(methodName, "change", method); } + /** * Sets the type of the image (RGB or RGBA) when saving as PNG format (default is RGBA) * @param b A Boolean, true to use RGBA or false to use RGB * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ - - -jimpEvChange('background', function (hex, cb) { - if (typeof hex !== 'number') { - return _utils.throwError.call(this, 'hex must be a hexadecimal rgba value', cb); +jimpEvChange("background", function (hex, cb) { + if (typeof hex !== "number") { + return _utils.throwError.call(this, "hex must be a hexadecimal rgba value", cb); } - this._background = hex; - if ((0, _utils.isNodePattern)(cb)) { cb.call(this, null, this); } - return this; }); + /** * Scans through a region of the bitmap, calling a function for each pixel. * @param {number} x the x coordinate to begin the scan at @@ -1245,47 +1012,35 @@ jimpEvChange('background', function (hex, cb) { * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ - -jimpEvChange('scan', function (x, y, w, h, f, cb) { - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); +jimpEvChange("scan", function (x, y, w, h, f, cb) { + if (typeof x !== "number" || typeof y !== "number") { + return _utils.throwError.call(this, "x and y must be numbers", cb); } - - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); + if (typeof w !== "number" || typeof h !== "number") { + return _utils.throwError.call(this, "w and h must be numbers", cb); } - - if (typeof f !== 'function') { - return _utils.throwError.call(this, 'f must be a function', cb); + if (typeof f !== "function") { + return _utils.throwError.call(this, "f must be a function", cb); } - - var result = (0, _utils.scan)(this, x, y, w, h, f); - + const result = (0, _utils.scan)(this, x, y, w, h, f); if ((0, _utils.isNodePattern)(cb)) { cb.call(this, null, result); } - return result; }); - -if (process.env.ENVIRONMENT === 'BROWSER') { +if (process.env.ENVIRONMENT === "BROWSER") { // For use in a web browser or web worker - /* global self */ - var gl; - - if (typeof window !== 'undefined' && (typeof window === "undefined" ? "undefined" : (0, _typeof2["default"])(window)) === 'object') { + let gl; + if (typeof window !== "undefined" && typeof window === "object") { gl = window; } - - if (typeof self !== 'undefined' && (typeof self === "undefined" ? "undefined" : (0, _typeof2["default"])(self)) === 'object') { + if (typeof self !== "undefined" && typeof self === "object") { gl = self; } - gl.Jimp = Jimp; gl.Buffer = Buffer; } - var _default = Jimp; -exports["default"] = _default; +exports.default = _default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/index.js.map b/project starter code/node_modules/@jimp/core/dist/index.js.map index 8e69060a..428d1080 100644 --- a/project starter code/node_modules/@jimp/core/dist/index.js.map +++ b/project starter code/node_modules/@jimp/core/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["alphabet","maxHashLength","NaN","i","maxHash","anyBase","BIN","slice","Array","join","push","length","noop","isArrayBuffer","test","Object","prototype","toString","call","toLowerCase","indexOf","bufferFromArrayBuffer","arrayBuffer","buffer","Buffer","alloc","byteLength","view","Uint8Array","loadFromURL","options","cb","err","response","data","headers","url","location","isBuffer","msg","statusCode","Error","loadBufferFromPath","src","fs","readFile","match","isRawRGBAData","obj","width","height","Uint8ClampedArray","makeRGBABufferFromRGB","rgbaBuffer","allocUnsafe","j","emptyBitmap","Jimp","args","MIME_PNG","path","write","mime","getBase64","getBuffer","getBufferAsync","getPixelColor","setPixelColor","jimpInstance","finish","evData","methodName","setTimeout","emitError","emitMulti","parseInt","w","h","_background","cssColorToHex","throwError","bitmap","writeUInt32BE","parseBitmap","original","from","_quality","_deflateLevel","_deflateStrategy","_filterType","_rgba","_originalMime","imageData","isRGBA","extraConstructor","__extraConstructors","find","c","Promise","resolve","reject","run","then","bool","eventName","assign","emit","getMIME","MIME","getExtension","createWriteStream","getType","pathObj","Path","parse","dir","mkdirp","sync","stream","on","end","AUTO","base","hash","pHash","ImagePHash","getHash","compareHash","currentHash","distance","x","y","edgeHandling","xi","yi","EDGE_EXTEND","Math","round","EDGE_WRAP","idx","getPixelIndex","hex","readUInt32BE","yIndex","xIndex","alpha","EventEmitter","addConstants","constants","entries","forEach","name","value","addJimpMethods","methods","composite","appendConstructorOption","read","image","create","rgbaToInt","r","g","b","a","pow","intToRGBA","rgba","floor","cssColor","Number","toHex8","limit255","n","max","min","diff","img1","img2","threshold","bmp1","bmp2","cloneQuiet","resize","numDiffPixels","percent","phash","hash1","hash2","compareHashes","colorDiff","rgba1","rgba2","maxVal","jimpEvMethod","evName","method","evNameBefore","evNameAfter","replace","wrappedCb","apply","result","error","clone","jimpEvChange","f","process","env","ENVIRONMENT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AAI,OAAOC,IAAP,KAAgB,WAAhB,IAA+B,QAAOA,IAAP,0DAAOA,IAAP,OAAgB,QAAnD,EAA6D;AAC3DF,IAAAA,EAAE,GAAGE,IAAL;AACD;;AAEDF,EAAAA,EAAE,CAACzJ,IAAH,GAAUA,IAAV;AACAyJ,EAAAA,EAAE,CAAC1L,MAAH,GAAYA,MAAZ;AACD;;eAIciC,I","sourcesContent":["import fs from 'fs';\nimport Path from 'path';\nimport EventEmitter from 'events';\n\nimport { isNodePattern, throwError, scan, scanIterator } from '@jimp/utils';\nimport anyBase from 'any-base';\nimport mkdirp from 'mkdirp';\nimport pixelMatch from 'pixelmatch';\nimport tinyColor from 'tinycolor2';\n\nimport ImagePHash from './modules/phash';\nimport request from './request';\n\nimport composite from './composite';\nimport promisify from './utils/promisify';\nimport * as MIME from './utils/mime';\nimport { parseBitmap, getBuffer, getBufferAsync } from './utils/image-bitmap';\nimport * as constants from './constants';\n\nconst alphabet =\n '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_';\n\n// an array storing the maximum string length of hashes at various bases\n// 0 and 1 do not exist as possible hash lengths\nconst maxHashLength = [NaN, NaN];\n\nfor (let i = 2; i < 65; i++) {\n const maxHash = anyBase(anyBase.BIN, alphabet.slice(0, i))(\n new Array(64 + 1).join('1')\n );\n maxHashLength.push(maxHash.length);\n}\n\n// no operation\nfunction noop() {}\n\n// error checking methods\n\nfunction isArrayBuffer(test) {\n return (\n Object.prototype.toString\n .call(test)\n .toLowerCase()\n .indexOf('arraybuffer') > -1\n );\n}\n\n// Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion,\n// But this function is not useful when running in node directly\nfunction bufferFromArrayBuffer(arrayBuffer) {\n const buffer = Buffer.alloc(arrayBuffer.byteLength);\n const view = new Uint8Array(arrayBuffer);\n\n for (let i = 0; i < buffer.length; ++i) {\n buffer[i] = view[i];\n }\n\n return buffer;\n}\n\nfunction loadFromURL(options, cb) {\n request(options, (err, response, data) => {\n if (err) {\n return cb(err);\n }\n\n if ('headers' in response && 'location' in response.headers) {\n options.url = response.headers.location;\n return loadFromURL(options, cb);\n }\n\n if (typeof data === 'object' && Buffer.isBuffer(data)) {\n return cb(null, data);\n }\n\n const msg =\n 'Could not load Buffer from <' +\n options.url +\n '> ' +\n '(HTTP: ' +\n response.statusCode +\n ')';\n\n return new Error(msg);\n });\n}\n\nfunction loadBufferFromPath(src, cb) {\n if (\n fs &&\n typeof fs.readFile === 'function' &&\n !src.match(/^(http|ftp)s?:\\/\\/./)\n ) {\n fs.readFile(src, cb);\n } else {\n loadFromURL({ url: src }, cb);\n }\n}\n\nfunction isRawRGBAData(obj) {\n return (\n obj &&\n typeof obj === 'object' &&\n typeof obj.width === 'number' &&\n typeof obj.height === 'number' &&\n (Buffer.isBuffer(obj.data) ||\n obj.data instanceof Uint8Array ||\n (typeof Uint8ClampedArray === 'function' &&\n obj.data instanceof Uint8ClampedArray)) &&\n (obj.data.length === obj.width * obj.height * 4 ||\n obj.data.length === obj.width * obj.height * 3)\n );\n}\n\nfunction makeRGBABufferFromRGB(buffer) {\n if (buffer.length % 3 !== 0) {\n throw new Error('Buffer length is incorrect');\n }\n\n const rgbaBuffer = Buffer.allocUnsafe((buffer.length / 3) * 4);\n let j = 0;\n\n for (let i = 0; i < buffer.length; i++) {\n rgbaBuffer[j] = buffer[i];\n\n if ((i + 1) % 3 === 0) {\n rgbaBuffer[++j] = 255;\n }\n\n j++;\n }\n\n return rgbaBuffer;\n}\n\nconst emptyBitmap = {\n data: null,\n width: null,\n height: null\n};\n\n/**\n * Jimp constructor (from a file)\n * @param path a path to the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a url with options)\n * @param options { url, otherOptions}\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from another Jimp image or raw image data)\n * @param image a Jimp image to clone\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a Buffer)\n * @param data a Buffer containing the image data\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param background color to fill the image with\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\nclass Jimp extends EventEmitter {\n // An object representing a bitmap in memory, comprising:\n // - data: a buffer of the bitmap data\n // - width: the width of the image in pixels\n // - height: the height of the image in pixels\n bitmap = emptyBitmap;\n\n // Default colour to use for new pixels\n _background = 0x00000000;\n\n // Default MIME is PNG\n _originalMime = Jimp.MIME_PNG;\n\n // Exif data for the image\n _exif = null;\n\n // Whether Transparency supporting formats will be exported as RGB or RGBA\n _rgba = true;\n\n constructor(...args) {\n super();\n\n const jimpInstance = this;\n let cb = noop;\n\n if (isArrayBuffer(args[0])) {\n args[0] = bufferFromArrayBuffer(args[0]);\n }\n\n function finish(...args) {\n const [err] = args;\n const evData = err || {};\n evData.methodName = 'constructor';\n\n setTimeout(() => {\n // run on next tick.\n if (err && cb === noop) {\n jimpInstance.emitError('constructor', err);\n } else if (!err) {\n jimpInstance.emitMulti('constructor', 'initialized');\n }\n\n cb.call(jimpInstance, ...args);\n }, 1);\n }\n\n if (\n (typeof args[0] === 'number' && typeof args[1] === 'number') ||\n (parseInt(args[0], 10) && parseInt(args[1], 10))\n ) {\n // create a new image\n const w = parseInt(args[0], 10);\n const h = parseInt(args[1], 10);\n cb = args[2];\n\n // with a hex color\n if (typeof args[2] === 'number') {\n this._background = args[2];\n cb = args[3];\n }\n\n // with a css color\n if (typeof args[2] === 'string') {\n this._background = Jimp.cssColorToHex(args[2]);\n cb = args[3];\n }\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n this.bitmap = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h\n };\n\n for (let i = 0; i < this.bitmap.data.length; i += 4) {\n this.bitmap.data.writeUInt32BE(this._background, i);\n }\n\n finish(null, this);\n } else if (typeof args[0] === 'object' && args[0].url) {\n cb = args[1] || noop;\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n loadFromURL(args[0], (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n\n this.parseBitmap(data, args[0].url, finish);\n });\n } else if (args[0] instanceof Jimp) {\n // clone an existing Jimp\n const [original] = args;\n cb = args[1];\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n this.bitmap = {\n data: Buffer.from(original.bitmap.data),\n width: original.bitmap.width,\n height: original.bitmap.height\n };\n\n this._quality = original._quality;\n this._deflateLevel = original._deflateLevel;\n this._deflateStrategy = original._deflateStrategy;\n this._filterType = original._filterType;\n this._rgba = original._rgba;\n this._background = original._background;\n this._originalMime = original._originalMime;\n\n finish(null, this);\n } else if (isRawRGBAData(args[0])) {\n const [imageData] = args;\n cb = args[1] || noop;\n\n const isRGBA =\n imageData.width * imageData.height * 4 === imageData.data.length;\n const buffer = isRGBA\n ? Buffer.from(imageData.data)\n : makeRGBABufferFromRGB(imageData.data);\n\n this.bitmap = {\n data: buffer,\n width: imageData.width,\n height: imageData.height\n };\n\n finish(null, this);\n } else if (typeof args[0] === 'string') {\n // read from a path\n const path = args[0];\n cb = args[1];\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n loadBufferFromPath(path, (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n\n this.parseBitmap(data, path, finish);\n });\n } else if (typeof args[0] === 'object' && Buffer.isBuffer(args[0])) {\n // read from a buffer\n const data = args[0];\n cb = args[1];\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n this.parseBitmap(data, null, finish);\n } else {\n // Allow client libs to add new ways to build a Jimp object.\n // Extra constructors must be added by `Jimp.appendConstructorOption()`\n cb = args[args.length - 1];\n\n if (typeof cb !== 'function') {\n // TODO: try to solve the args after cb problem.\n cb = args[args.length - 2];\n\n if (typeof cb !== 'function') {\n cb = noop;\n }\n }\n\n const extraConstructor = Jimp.__extraConstructors.find(c =>\n c.test(...args)\n );\n\n if (extraConstructor) {\n new Promise((resolve, reject) =>\n extraConstructor.run.call(this, resolve, reject, ...args)\n )\n .then(() => finish(null, this))\n .catch(finish);\n } else {\n return throwError.call(\n this,\n 'No matching constructor overloading was found. ' +\n 'Please see the docs for how to call the Jimp constructor.',\n finish\n );\n }\n }\n }\n\n /**\n * Parse a bitmap with the loaded image types.\n *\n * @param {Buffer} data raw image data\n * @param {string} path optional path to file\n * @param {function(Error, Jimp)} finish (optional) a callback for when complete\n * @memberof Jimp\n */\n parseBitmap(data, path, finish) {\n parseBitmap.call(this, data, null, finish);\n }\n\n /**\n * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA)\n * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rgba(bool, cb) {\n if (typeof bool !== 'boolean') {\n return throwError.call(\n this,\n 'bool must be a boolean, true for RGBA or false for RGB',\n cb\n );\n }\n\n this._rgba = bool;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n\n /**\n * Emit for multiple listeners\n * @param {string} methodName name of the method to emit an error for\n * @param {string} eventName name of the eventName to emit an error for\n * @param {object} data to emit\n */\n emitMulti(methodName, eventName, data = {}) {\n data = Object.assign(data, { methodName, eventName });\n this.emit('any', data);\n\n if (methodName) {\n this.emit(methodName, data);\n }\n\n this.emit(eventName, data);\n }\n\n emitError(methodName, err) {\n this.emitMulti(methodName, 'error', err);\n }\n\n /**\n * Get the current height of the image\n * @return {number} height of the image\n */\n getHeight() {\n return this.bitmap.height;\n }\n\n /**\n * Get the current width of the image\n * @return {number} width of the image\n */\n getWidth() {\n return this.bitmap.width;\n }\n\n /**\n * Nicely format Jimp object when sent to the console e.g. console.log(image)\n * @returns {string} pretty printed\n */\n inspect() {\n return (\n ''\n );\n }\n\n /**\n * Nicely format Jimp object when converted to a string\n * @returns {string} pretty printed\n */\n toString() {\n return '[object Jimp]';\n }\n\n /**\n * Returns the original MIME of the image (default: \"image/png\")\n * @returns {string} the MIME\n */\n getMIME() {\n const mime = this._originalMime || Jimp.MIME_PNG;\n\n return mime;\n }\n\n /**\n * Returns the appropriate file extension for the original MIME of the image (default: \"png\")\n * @returns {string} the file extension\n */\n getExtension() {\n const mime = this.getMIME();\n\n return MIME.getExtension(mime);\n }\n\n /**\n * Writes the image to a file\n * @param {string} path a path to the destination file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk\n * @returns {Jimp} this for chaining of methods\n */\n write(path, cb) {\n if (!fs || !fs.createWriteStream) {\n throw new Error(\n 'Cant access the filesystem. You can use the getBase64 method.'\n );\n }\n\n if (typeof path !== 'string') {\n return throwError.call(this, 'path must be a string', cb);\n }\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', cb);\n }\n\n const mime = MIME.getType(path) || this.getMIME();\n const pathObj = Path.parse(path);\n\n if (pathObj.dir) {\n mkdirp.sync(pathObj.dir);\n }\n\n this.getBuffer(mime, (err, buffer) => {\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n const stream = fs.createWriteStream(path);\n\n stream\n .on('open', () => {\n stream.write(buffer);\n stream.end();\n })\n .on('error', err => {\n return throwError.call(this, err, cb);\n });\n stream.on('finish', () => {\n cb.call(this, null, this);\n });\n });\n\n return this;\n }\n\n writeAsync = path => promisify(this.write, this, path);\n\n /**\n * Converts the image to a base 64 string\n * @param {string} mime the mime type of the image data to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n getBase64(mime, cb) {\n if (mime === Jimp.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n\n if (typeof mime !== 'string') {\n return throwError.call(this, 'mime must be a string', cb);\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', cb);\n }\n\n this.getBuffer(mime, function(err, data) {\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n const src = 'data:' + mime + ';base64,' + data.toString('base64');\n cb.call(this, null, src);\n });\n\n return this;\n }\n\n getBase64Async = mime => promisify(this.getBase64, this, mime);\n\n /**\n * Generates a perceptual hash of the image . And pads the string. Can configure base.\n * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {string} a string representing the hash\n */\n hash(base, cb) {\n base = base || 64;\n\n if (typeof base === 'function') {\n cb = base;\n base = 64;\n }\n\n if (typeof base !== 'number') {\n return throwError.call(this, 'base must be a number', cb);\n }\n\n if (base < 2 || base > 64) {\n return throwError.call(\n this,\n 'base must be a number between 2 and 64',\n cb\n );\n }\n\n let hash = this.pHash();\n hash = anyBase(anyBase.BIN, alphabet.slice(0, base))(hash);\n\n while (hash.length < maxHashLength[base]) {\n hash = '0' + hash; // pad out with leading zeros\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, hash);\n }\n\n return hash;\n }\n\n /**\n * Calculates the perceptual hash\n * @returns {number} the perceptual hash\n */\n pHash() {\n const pHash = new ImagePHash();\n return pHash.getHash(this);\n }\n\n /**\n * Calculates the hamming distance of the current image and a hash based on their perceptual hash\n * @param {hash} compareHash hash to compare to\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\n distanceFromHash(compareHash) {\n const pHash = new ImagePHash();\n const currentHash = pHash.getHash(this);\n\n return pHash.distance(currentHash, compareHash);\n }\n\n /**\n * Converts the image to a buffer\n * @param {string} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n getBuffer = getBuffer;\n\n getBufferAsync = getBufferAsync;\n\n /**\n * Returns the offset of a pixel in the bitmap buffer\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {string} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {number} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n getPixelIndex(x, y, edgeHandling, cb) {\n let xi;\n let yi;\n\n if (typeof edgeHandling === 'function' && typeof cb === 'undefined') {\n cb = edgeHandling;\n edgeHandling = null;\n }\n\n if (!edgeHandling) {\n edgeHandling = Jimp.EDGE_EXTEND;\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n xi = x;\n yi = y;\n\n if (edgeHandling === Jimp.EDGE_EXTEND) {\n if (x < 0) xi = 0;\n if (x >= this.bitmap.width) xi = this.bitmap.width - 1;\n if (y < 0) yi = 0;\n if (y >= this.bitmap.height) yi = this.bitmap.height - 1;\n }\n\n if (edgeHandling === Jimp.EDGE_WRAP) {\n if (x < 0) {\n xi = this.bitmap.width + x;\n }\n\n if (x >= this.bitmap.width) {\n xi = x % this.bitmap.width;\n }\n\n if (y < 0) {\n xi = this.bitmap.height + y;\n }\n\n if (y >= this.bitmap.height) {\n yi = y % this.bitmap.height;\n }\n }\n\n let i = (this.bitmap.width * yi + xi) << 2;\n\n // if out of bounds index is -1\n if (xi < 0 || xi >= this.bitmap.width) {\n i = -1;\n }\n\n if (yi < 0 || yi >= this.bitmap.height) {\n i = -1;\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n\n return i;\n }\n\n /**\n * Returns the hex colour value of a pixel\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the color of the pixel\n */\n getPixelColor(x, y, cb) {\n if (typeof x !== 'number' || typeof y !== 'number')\n return throwError.call(this, 'x and y must be numbers', cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const idx = this.getPixelIndex(x, y);\n const hex = this.bitmap.data.readUInt32BE(idx);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, hex);\n }\n\n return hex;\n }\n\n getPixelColour = this.getPixelColor;\n\n /**\n * Returns the hex colour value of a pixel\n * @param {number} hex color to set\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n setPixelColor(hex, x, y, cb) {\n if (\n typeof hex !== 'number' ||\n typeof x !== 'number' ||\n typeof y !== 'number'\n )\n return throwError.call(this, 'hex, x and y must be numbers', cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const idx = this.getPixelIndex(x, y);\n this.bitmap.data.writeUInt32BE(hex, idx);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n\n setPixelColour = this.setPixelColor;\n\n /**\n * Determine if the image contains opaque pixels.\n * @return {boolean} hasAlpha whether the image contains opaque pixels\n */\n hasAlpha() {\n for (let yIndex = 0; yIndex < this.bitmap.height; yIndex++) {\n for (let xIndex = 0; xIndex < this.bitmap.width; xIndex++) {\n const idx = (this.bitmap.width * yIndex + xIndex) << 2;\n const alpha = this.bitmap.data[idx + 3];\n\n if (alpha !== 0xff) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n /**\n * Iterate scan through a region of the bitmap\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>}\n */\n scanIterator(x, y, w, h) {\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers');\n }\n\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers');\n }\n\n return scanIterator(this, x, y, w, h);\n }\n}\n\nexport function addConstants(constants, jimpInstance = Jimp) {\n Object.entries(constants).forEach(([name, value]) => {\n jimpInstance[name] = value;\n });\n}\n\nexport function addJimpMethods(methods, jimpInstance = Jimp) {\n Object.entries(methods).forEach(([name, value]) => {\n jimpInstance.prototype[name] = value;\n });\n}\n\naddConstants(constants);\naddJimpMethods({ composite });\n\nJimp.__extraConstructors = [];\n\n/**\n * Allow client libs to add new ways to build a Jimp object.\n * @param {string} name identify the extra constructor.\n * @param {function} test a function that returns true when it accepts the arguments passed to the main constructor.\n * @param {function} run where the magic happens.\n */\nJimp.appendConstructorOption = function(name, test, run) {\n Jimp.__extraConstructors.push({ name, test, run });\n};\n\n/**\n * Read an image from a file or a Buffer. Takes the same args as the constructor\n * @returns {Promise} a promise\n */\nJimp.read = function(...args) {\n return new Promise((resolve, reject) => {\n new Jimp(...args, (err, image) => {\n if (err) reject(err);\n else resolve(image);\n });\n });\n};\n\nJimp.create = Jimp.read;\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} r the red value (0-255)\n * @param {number} g the green value (0-255)\n * @param {number} b the blue value (0-255)\n * @param {number} a the alpha value (0-255)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {number} an single integer colour value\n */\nJimp.rgbaToInt = function(r, g, b, a, cb) {\n if (\n typeof r !== 'number' ||\n typeof g !== 'number' ||\n typeof b !== 'number' ||\n typeof a !== 'number'\n ) {\n return throwError.call(this, 'r, g, b and a must be numbers', cb);\n }\n\n if (r < 0 || r > 255) {\n return throwError.call(this, 'r must be between 0 and 255', cb);\n }\n\n if (g < 0 || g > 255) {\n throwError.call(this, 'g must be between 0 and 255', cb);\n }\n\n if (b < 0 || b > 255) {\n return throwError.call(this, 'b must be between 0 and 255', cb);\n }\n\n if (a < 0 || a > 255) {\n return throwError.call(this, 'a must be between 0 and 255', cb);\n }\n\n r = Math.round(r);\n b = Math.round(b);\n g = Math.round(g);\n a = Math.round(a);\n\n const i =\n r * Math.pow(256, 3) +\n g * Math.pow(256, 2) +\n b * Math.pow(256, 1) +\n a * Math.pow(256, 0);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n\n return i;\n};\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} i a single integer value representing an RGBA colour (e.g. 0xFF0000FF for red)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {object} an object with the properties r, g, b and a representing RGBA values\n */\nJimp.intToRGBA = function(i, cb) {\n if (typeof i !== 'number') {\n return throwError.call(this, 'i must be a number', cb);\n }\n\n const rgba = {};\n\n rgba.r = Math.floor(i / Math.pow(256, 3));\n rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));\n rgba.b = Math.floor(\n (i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) /\n Math.pow(256, 1)\n );\n rgba.a = Math.floor(\n (i -\n rgba.r * Math.pow(256, 3) -\n rgba.g * Math.pow(256, 2) -\n rgba.b * Math.pow(256, 1)) /\n Math.pow(256, 0)\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, rgba);\n }\n\n return rgba;\n};\n\n/**\n * Converts a css color (Hex, 8-digit (RGBA) Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, Named) to a hex number\n * @param {string} cssColor a number\n * @returns {number} a hex number representing a color\n */\nJimp.cssColorToHex = function(cssColor) {\n cssColor = cssColor || 0; // 0, null, undefined, NaN\n\n if (typeof cssColor === 'number') return Number(cssColor);\n\n return parseInt(tinyColor(cssColor).toHex8(), 16);\n};\n\n/**\n * Limits a number to between 0 or 255\n * @param {number} n a number\n * @returns {number} the number limited to between 0 or 255\n */\nJimp.limit255 = function(n) {\n n = Math.max(n, 0);\n n = Math.min(n, 255);\n\n return n;\n};\n\n/**\n * Diffs two images and returns\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @param {number} threshold (optional) a number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1)\n * @returns {object} an object { percent: percent similar, diff: a Jimp image highlighting differences }\n */\nJimp.diff = function(img1, img2, threshold = 0.1) {\n if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp))\n return throwError.call(this, 'img1 and img2 must be an Jimp images');\n\n const bmp1 = img1.bitmap;\n const bmp2 = img2.bitmap;\n\n if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) {\n if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) {\n // img1 is bigger\n img1 = img1.cloneQuiet().resize(bmp2.width, bmp2.height);\n } else {\n // img2 is bigger (or they are the same in area)\n img2 = img2.cloneQuiet().resize(bmp1.width, bmp1.height);\n }\n }\n\n if (typeof threshold !== 'number' || threshold < 0 || threshold > 1) {\n return throwError.call(this, 'threshold must be a number between 0 and 1');\n }\n\n const diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff);\n\n const numDiffPixels = pixelMatch(\n bmp1.data,\n bmp2.data,\n diff.bitmap.data,\n diff.bitmap.width,\n diff.bitmap.height,\n { threshold }\n );\n\n return {\n percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height),\n image: diff\n };\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.distance = function(img1, img2) {\n const phash = new ImagePHash();\n const hash1 = phash.getHash(img1);\n const hash2 = phash.getHash(img2);\n\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {hash} hash1 a pHash\n * @param {hash} hash2 a pHash\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.compareHashes = function(hash1, hash2) {\n const phash = new ImagePHash();\n\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Compute color difference\n * 0 means no difference, 1 means maximum difference.\n * @param {number} rgba1: first color to compare.\n * @param {number} rgba2: second color to compare.\n * Both parameters must be an color object {r:val, g:val, b:val, a:val}\n * Where `a` is optional and `val` is an integer between 0 and 255.\n * @returns {number} float between 0 and 1.\n */\nJimp.colorDiff = function(rgba1, rgba2) {\n const pow = n => Math.pow(n, 2);\n const { max } = Math;\n const maxVal = 255 * 255 * 3;\n\n if (rgba1.a !== 0 && !rgba1.a) {\n rgba1.a = 255;\n }\n\n if (rgba2.a !== 0 && !rgba2.a) {\n rgba2.a = 255;\n }\n\n return (\n (max(pow(rgba1.r - rgba2.r), pow(rgba1.r - rgba2.r - rgba1.a + rgba2.a)) +\n max(pow(rgba1.g - rgba2.g), pow(rgba1.g - rgba2.g - rgba1.a + rgba2.a)) +\n max(pow(rgba1.b - rgba2.b), pow(rgba1.b - rgba2.b - rgba1.a + rgba2.a))) /\n maxVal\n );\n};\n\n/**\n * Helper to create Jimp methods that emit events before and after its execution.\n * @param {string} methodName The name to be appended to Jimp prototype.\n * @param {string} evName The event name to be called.\n * It will be prefixed by `before-` and emitted when on method call.\n * It will be appended by `ed` and emitted after the method run.\n * @param {function} method A function implementing the method itself.\n * It will also create a quiet version that will not emit events, to not\n * mess the user code with many `changed` event calls. You can call with\n * `methodName + \"Quiet\"`.\n *\n * The emitted event comes with a object parameter to the listener with the\n * `methodName` as one attribute.\n */\nexport function jimpEvMethod(methodName, evName, method) {\n const evNameBefore = 'before-' + evName;\n const evNameAfter = evName.replace(/e$/, '') + 'ed';\n\n Jimp.prototype[methodName] = function(...args) {\n let wrappedCb;\n const cb = args[method.length - 1];\n const jimpInstance = this;\n\n if (typeof cb === 'function') {\n wrappedCb = function(...args) {\n const [err, data] = args;\n\n if (err) {\n jimpInstance.emitError(methodName, err);\n } else {\n jimpInstance.emitMulti(methodName, evNameAfter, {\n [methodName]: data\n });\n }\n\n cb.apply(this, args);\n };\n\n args[args.length - 1] = wrappedCb;\n } else {\n wrappedCb = false;\n }\n\n this.emitMulti(methodName, evNameBefore);\n\n let result;\n\n try {\n result = method.apply(this, args);\n\n if (!wrappedCb) {\n this.emitMulti(methodName, evNameAfter, {\n [methodName]: result\n });\n }\n } catch (error) {\n error.methodName = methodName;\n this.emitError(methodName, error);\n }\n\n return result;\n };\n\n Jimp.prototype[methodName + 'Quiet'] = method;\n}\n\n/**\n * Creates a new image that is a clone of this one.\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns the new image\n */\njimpEvMethod('clone', 'clone', function(cb) {\n const clone = new Jimp(this);\n\n if (isNodePattern(cb)) {\n cb.call(clone, null, clone);\n }\n\n return clone;\n});\n\n/**\n * Simplify jimpEvMethod call for the common `change` evName.\n * @param {string} methodName name of the method\n * @param {function} method to watch changes for\n */\nexport function jimpEvChange(methodName, method) {\n jimpEvMethod(methodName, 'change', method);\n}\n\n/**\n * Sets the type of the image (RGB or RGBA) when saving as PNG format (default is RGBA)\n * @param b A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange('background', function(hex, cb) {\n if (typeof hex !== 'number') {\n return throwError.call(this, 'hex must be a hexadecimal rgba value', cb);\n }\n\n this._background = hex;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n});\n\n/**\n * Scans through a region of the bitmap, calling a function for each pixel.\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @param f a function to call on even pixel; the (x, y) position of the pixel\n * and the index of the pixel in the bitmap buffer are passed to the function\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange('scan', function(x, y, w, h, f, cb) {\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (typeof f !== 'function') {\n return throwError.call(this, 'f must be a function', cb);\n }\n\n const result = scan(this, x, y, w, h, f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, result);\n }\n\n return result;\n});\n\nif (process.env.ENVIRONMENT === 'BROWSER') {\n // For use in a web browser or web worker\n /* global self */\n let gl;\n\n if (typeof window !== 'undefined' && typeof window === 'object') {\n gl = window;\n }\n\n if (typeof self !== 'undefined' && typeof self === 'object') {\n gl = self;\n }\n\n gl.Jimp = Jimp;\n gl.Buffer = Buffer;\n}\n\nexport { addType } from './utils/mime';\n\nexport default Jimp;\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["alphabet","maxHashLength","NaN","i","maxHash","anyBase","BIN","slice","Array","join","push","length","noop","isArrayBuffer","test","Object","prototype","toString","call","toLowerCase","indexOf","bufferFromArrayBuffer","arrayBuffer","buffer","Buffer","alloc","byteLength","view","Uint8Array","loadFromURL","options","cb","request","err","data","isBuffer","Error","url","loadBufferFromPath","src","fs","readFile","match","isRawRGBAData","obj","width","height","Uint8ClampedArray","makeRGBABufferFromRGB","rgbaBuffer","allocUnsafe","j","emptyBitmap","Jimp","EventEmitter","constructor","args","MIME_PNG","path","promisify","write","mime","getBase64","getBuffer","getBufferAsync","getPixelColor","setPixelColor","jimpInstance","finish","evData","methodName","setTimeout","emitError","emitMulti","parseInt","w","h","_background","cssColorToHex","throwError","bitmap","writeUInt32BE","parseBitmap","original","from","_quality","_deflateLevel","_deflateStrategy","_filterType","_rgba","_originalMime","imageData","isRGBA","extraConstructor","__extraConstructors","find","c","Promise","resolve","reject","run","then","catch","rgba","bool","isNodePattern","eventName","assign","emit","getHeight","getWidth","inspect","getMIME","getExtension","MIME","createWriteStream","getType","pathObj","Path","parse","dir","mkdirSync","recursive","stream","on","end","AUTO","hash","base","pHash","ImagePHash","getHash","distanceFromHash","compareHash","currentHash","distance","getPixelIndex","x","y","edgeHandling","xi","yi","EDGE_EXTEND","Math","round","EDGE_WRAP","idx","hex","readUInt32BE","hasAlpha","byteLen","scanIterator","addConstants","constants","entries","forEach","name","value","addJimpMethods","methods","composite","appendConstructorOption","read","image","create","rgbaToInt","r","g","b","a","intToRGBA","floor","pow","cssColor","Number","tinyColor","toHex8","limit255","n","max","min","diff","img1","img2","threshold","bmp1","bmp2","cloneQuiet","resize","numDiffPixels","pixelMatch","percent","phash","hash1","hash2","compareHashes","colorDiff","rgba1","rgba2","maxVal","jimpEvMethod","evName","method","evNameBefore","evNameAfter","replace","wrappedCb","apply","result","error","clone","jimpEvChange","f","scan","process","env","ENVIRONMENT","gl","window","self"],"sources":["../src/index.js"],"sourcesContent":["import fs from \"fs\";\nimport Path from \"path\";\nimport EventEmitter from \"events\";\n\nimport { isNodePattern, throwError, scan, scanIterator } from \"@jimp/utils\";\nimport anyBase from \"any-base\";\nimport pixelMatch from \"pixelmatch\";\nimport tinyColor from \"tinycolor2\";\n\nimport ImagePHash from \"./modules/phash\";\nimport request from \"./request\";\n\nimport composite from \"./composite\";\nimport promisify from \"./utils/promisify\";\nimport * as MIME from \"./utils/mime\";\nimport { parseBitmap, getBuffer, getBufferAsync } from \"./utils/image-bitmap\";\nimport * as constants from \"./constants\";\n\nconst alphabet =\n \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_\";\n\n// an array storing the maximum string length of hashes at various bases\n// 0 and 1 do not exist as possible hash lengths\nconst maxHashLength = [NaN, NaN];\n\nfor (let i = 2; i < 65; i++) {\n const maxHash = anyBase(\n anyBase.BIN,\n alphabet.slice(0, i)\n )(new Array(64 + 1).join(\"1\"));\n maxHashLength.push(maxHash.length);\n}\n\n// no operation\nfunction noop() {}\n\n// error checking methods\n\nfunction isArrayBuffer(test) {\n return (\n Object.prototype.toString.call(test).toLowerCase().indexOf(\"arraybuffer\") >\n -1\n );\n}\n\n// Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion,\n// But this function is not useful when running in node directly\nfunction bufferFromArrayBuffer(arrayBuffer) {\n const buffer = Buffer.alloc(arrayBuffer.byteLength);\n const view = new Uint8Array(arrayBuffer);\n\n for (let i = 0; i < buffer.length; ++i) {\n buffer[i] = view[i];\n }\n\n return buffer;\n}\n\nfunction loadFromURL(options, cb) {\n request(options, (err, data) => {\n if (err) {\n return cb(err);\n }\n\n if (typeof data === \"object\" && Buffer.isBuffer(data)) {\n return cb(null, data);\n }\n\n if (typeof data === \"object\" && isArrayBuffer(data)) {\n return cb(null, bufferFromArrayBuffer(data));\n }\n\n return new Error(`Could not load Buffer from <${options.url}>`);\n });\n}\n\nfunction loadBufferFromPath(src, cb) {\n if (\n fs &&\n typeof fs.readFile === \"function\" &&\n !src.match(/^(http|ftp)s?:\\/\\/./)\n ) {\n fs.readFile(src, cb);\n } else {\n loadFromURL({ url: src }, cb);\n }\n}\n\nfunction isRawRGBAData(obj) {\n return (\n obj &&\n typeof obj === \"object\" &&\n typeof obj.width === \"number\" &&\n typeof obj.height === \"number\" &&\n (Buffer.isBuffer(obj.data) ||\n obj.data instanceof Uint8Array ||\n (typeof Uint8ClampedArray === \"function\" &&\n obj.data instanceof Uint8ClampedArray)) &&\n (obj.data.length === obj.width * obj.height * 4 ||\n obj.data.length === obj.width * obj.height * 3)\n );\n}\n\nfunction makeRGBABufferFromRGB(buffer) {\n if (buffer.length % 3 !== 0) {\n throw new Error(\"Buffer length is incorrect\");\n }\n\n const rgbaBuffer = Buffer.allocUnsafe((buffer.length / 3) * 4);\n let j = 0;\n\n for (let i = 0; i < buffer.length; i++) {\n rgbaBuffer[j] = buffer[i];\n\n if ((i + 1) % 3 === 0) {\n rgbaBuffer[++j] = 255;\n }\n\n j++;\n }\n\n return rgbaBuffer;\n}\n\nconst emptyBitmap = {\n data: null,\n width: null,\n height: null,\n};\n\n/**\n * Jimp constructor (from a file)\n * @param path a path to the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a url with options)\n * @param options { url, otherOptions}\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from another Jimp image or raw image data)\n * @param image a Jimp image to clone\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a Buffer)\n * @param data a Buffer containing the image data\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param background color to fill the image with\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\nclass Jimp extends EventEmitter {\n // An object representing a bitmap in memory, comprising:\n // - data: a buffer of the bitmap data\n // - width: the width of the image in pixels\n // - height: the height of the image in pixels\n bitmap = emptyBitmap;\n\n // Default colour to use for new pixels\n _background = 0x00000000;\n\n // Default MIME is PNG\n _originalMime = Jimp.MIME_PNG;\n\n // Exif data for the image\n _exif = null;\n\n // Whether Transparency supporting formats will be exported as RGB or RGBA\n _rgba = true;\n\n constructor(...args) {\n super();\n\n const jimpInstance = this;\n let cb = noop;\n\n if (isArrayBuffer(args[0])) {\n args[0] = bufferFromArrayBuffer(args[0]);\n }\n\n function finish(...args) {\n const [err] = args;\n const evData = err || {};\n evData.methodName = \"constructor\";\n\n setTimeout(() => {\n // run on next tick.\n if (err && cb === noop) {\n jimpInstance.emitError(\"constructor\", err);\n } else if (!err) {\n jimpInstance.emitMulti(\"constructor\", \"initialized\");\n }\n\n cb.call(jimpInstance, ...args);\n }, 1);\n }\n\n if (\n (typeof args[0] === \"number\" && typeof args[1] === \"number\") ||\n (parseInt(args[0], 10) && parseInt(args[1], 10))\n ) {\n // create a new image\n const w = parseInt(args[0], 10);\n const h = parseInt(args[1], 10);\n cb = args[2];\n\n // with a hex color\n if (typeof args[2] === \"number\") {\n this._background = args[2];\n cb = args[3];\n }\n\n // with a css color\n if (typeof args[2] === \"string\") {\n this._background = Jimp.cssColorToHex(args[2]);\n cb = args[3];\n }\n\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n this.bitmap = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h,\n };\n\n for (let i = 0; i < this.bitmap.data.length; i += 4) {\n this.bitmap.data.writeUInt32BE(this._background, i);\n }\n\n finish(null, this);\n } else if (typeof args[0] === \"object\" && args[0].url) {\n cb = args[1] || noop;\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n loadFromURL(args[0], (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n\n this.parseBitmap(data, args[0].url, finish);\n });\n } else if (args[0] instanceof Jimp) {\n // clone an existing Jimp\n const [original] = args;\n cb = args[1];\n\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n this.bitmap = {\n data: Buffer.from(original.bitmap.data),\n width: original.bitmap.width,\n height: original.bitmap.height,\n };\n\n this._quality = original._quality;\n this._deflateLevel = original._deflateLevel;\n this._deflateStrategy = original._deflateStrategy;\n this._filterType = original._filterType;\n this._rgba = original._rgba;\n this._background = original._background;\n this._originalMime = original._originalMime;\n\n finish(null, this);\n } else if (isRawRGBAData(args[0])) {\n const [imageData] = args;\n cb = args[1] || noop;\n\n const isRGBA =\n imageData.width * imageData.height * 4 === imageData.data.length;\n const buffer = isRGBA\n ? Buffer.from(imageData.data)\n : makeRGBABufferFromRGB(imageData.data);\n\n this.bitmap = {\n data: buffer,\n width: imageData.width,\n height: imageData.height,\n };\n\n finish(null, this);\n } else if (typeof args[0] === \"string\") {\n // read from a path\n const path = args[0];\n cb = args[1];\n\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n loadBufferFromPath(path, (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n\n this.parseBitmap(data, path, finish);\n });\n } else if (typeof args[0] === \"object\" && Buffer.isBuffer(args[0])) {\n // read from a buffer\n const data = args[0];\n cb = args[1];\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n this.parseBitmap(data, null, finish);\n } else {\n // Allow client libs to add new ways to build a Jimp object.\n // Extra constructors must be added by `Jimp.appendConstructorOption()`\n cb = args[args.length - 1];\n\n if (typeof cb !== \"function\") {\n // TODO: try to solve the args after cb problem.\n cb = args[args.length - 2];\n\n if (typeof cb !== \"function\") {\n cb = noop;\n }\n }\n\n const extraConstructor = Jimp.__extraConstructors.find((c) =>\n c.test(...args)\n );\n\n if (extraConstructor) {\n new Promise((resolve, reject) => {\n extraConstructor.run.call(this, resolve, reject, ...args);\n })\n .then(() => finish(null, this))\n .catch(finish);\n } else {\n return throwError.call(\n this,\n \"No matching constructor overloading was found. \" +\n \"Please see the docs for how to call the Jimp constructor.\",\n finish\n );\n }\n }\n }\n\n /**\n * Parse a bitmap with the loaded image types.\n *\n * @param {Buffer} data raw image data\n * @param {string} path optional path to file\n * @param {function(Error, Jimp)} finish (optional) a callback for when complete\n * @memberof Jimp\n */\n parseBitmap(data, path, finish) {\n parseBitmap.call(this, data, null, finish);\n }\n\n /**\n * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA)\n * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rgba(bool, cb) {\n if (typeof bool !== \"boolean\") {\n return throwError.call(\n this,\n \"bool must be a boolean, true for RGBA or false for RGB\",\n cb\n );\n }\n\n this._rgba = bool;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n\n /**\n * Emit for multiple listeners\n * @param {string} methodName name of the method to emit an error for\n * @param {string} eventName name of the eventName to emit an error for\n * @param {object} data to emit\n */\n emitMulti(methodName, eventName, data = {}) {\n data = Object.assign(data, { methodName, eventName });\n this.emit(\"any\", data);\n\n if (methodName) {\n this.emit(methodName, data);\n }\n\n this.emit(eventName, data);\n }\n\n emitError(methodName, err) {\n this.emitMulti(methodName, \"error\", err);\n }\n\n /**\n * Get the current height of the image\n * @return {number} height of the image\n */\n getHeight() {\n return this.bitmap.height;\n }\n\n /**\n * Get the current width of the image\n * @return {number} width of the image\n */\n getWidth() {\n return this.bitmap.width;\n }\n\n /**\n * Nicely format Jimp object when sent to the console e.g. console.log(image)\n * @returns {string} pretty printed\n */\n inspect() {\n return (\n \"\"\n );\n }\n\n /**\n * Nicely format Jimp object when converted to a string\n * @returns {string} pretty printed\n */\n toString() {\n return \"[object Jimp]\";\n }\n\n /**\n * Returns the original MIME of the image (default: \"image/png\")\n * @returns {string} the MIME\n */\n getMIME() {\n const mime = this._originalMime || Jimp.MIME_PNG;\n\n return mime;\n }\n\n /**\n * Returns the appropriate file extension for the original MIME of the image (default: \"png\")\n * @returns {string} the file extension\n */\n getExtension() {\n const mime = this.getMIME();\n\n return MIME.getExtension(mime);\n }\n\n /**\n * Writes the image to a file\n * @param {string} path a path to the destination file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk\n * @returns {Jimp} this for chaining of methods\n */\n write(path, cb) {\n if (!fs || !fs.createWriteStream) {\n throw new Error(\n \"Cant access the filesystem. You can use the getBase64 method.\"\n );\n }\n\n if (typeof path !== \"string\") {\n return throwError.call(this, \"path must be a string\", cb);\n }\n\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", cb);\n }\n\n const mime = MIME.getType(path) || this.getMIME();\n const pathObj = Path.parse(path);\n\n if (pathObj.dir) {\n fs.mkdirSync(pathObj.dir, { recursive: true });\n }\n\n this.getBuffer(mime, (err, buffer) => {\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n const stream = fs.createWriteStream(path);\n\n stream\n .on(\"open\", () => {\n stream.write(buffer);\n stream.end();\n })\n .on(\"error\", (err) => {\n return throwError.call(this, err, cb);\n });\n stream.on(\"finish\", () => {\n cb.call(this, null, this);\n });\n });\n\n return this;\n }\n\n writeAsync = (path) => promisify(this.write, this, path);\n\n /**\n * Converts the image to a base 64 string\n * @param {string} mime the mime type of the image data to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n getBase64(mime, cb) {\n if (mime === Jimp.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n\n if (typeof mime !== \"string\") {\n return throwError.call(this, \"mime must be a string\", cb);\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", cb);\n }\n\n this.getBuffer(mime, function (err, data) {\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n const src = \"data:\" + mime + \";base64,\" + data.toString(\"base64\");\n cb.call(this, null, src);\n });\n\n return this;\n }\n\n getBase64Async = (mime) => promisify(this.getBase64, this, mime);\n\n /**\n * Generates a perceptual hash of the image . And pads the string. Can configure base.\n * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {string} a string representing the hash\n */\n hash(base, cb) {\n base = base || 64;\n\n if (typeof base === \"function\") {\n cb = base;\n base = 64;\n }\n\n if (typeof base !== \"number\") {\n return throwError.call(this, \"base must be a number\", cb);\n }\n\n if (base < 2 || base > 64) {\n return throwError.call(\n this,\n \"base must be a number between 2 and 64\",\n cb\n );\n }\n\n let hash = this.pHash();\n hash = anyBase(anyBase.BIN, alphabet.slice(0, base))(hash);\n\n while (hash.length < maxHashLength[base]) {\n hash = \"0\" + hash; // pad out with leading zeros\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, hash);\n }\n\n return hash;\n }\n\n /**\n * Calculates the perceptual hash\n * @returns {number} the perceptual hash\n */\n pHash() {\n const pHash = new ImagePHash();\n return pHash.getHash(this);\n }\n\n /**\n * Calculates the hamming distance of the current image and a hash based on their perceptual hash\n * @param {hash} compareHash hash to compare to\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\n distanceFromHash(compareHash) {\n const pHash = new ImagePHash();\n const currentHash = pHash.getHash(this);\n\n return pHash.distance(currentHash, compareHash);\n }\n\n /**\n * Converts the image to a buffer\n * @param {string} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n getBuffer = getBuffer;\n\n getBufferAsync = getBufferAsync;\n\n /**\n * Returns the offset of a pixel in the bitmap buffer\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {number} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {number} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n getPixelIndex(x, y, edgeHandling, cb) {\n let xi;\n let yi;\n\n if (typeof edgeHandling === \"function\" && typeof cb === \"undefined\") {\n cb = edgeHandling;\n edgeHandling = null;\n }\n\n if (!edgeHandling) {\n edgeHandling = Jimp.EDGE_EXTEND;\n }\n\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n xi = x;\n yi = y;\n\n if (edgeHandling === Jimp.EDGE_EXTEND) {\n if (x < 0) xi = 0;\n if (x >= this.bitmap.width) xi = this.bitmap.width - 1;\n if (y < 0) yi = 0;\n if (y >= this.bitmap.height) yi = this.bitmap.height - 1;\n }\n\n if (edgeHandling === Jimp.EDGE_WRAP) {\n if (x < 0) {\n xi = this.bitmap.width + x;\n }\n\n if (x >= this.bitmap.width) {\n xi = x % this.bitmap.width;\n }\n\n if (y < 0) {\n yi = this.bitmap.height + y;\n }\n\n if (y >= this.bitmap.height) {\n yi = y % this.bitmap.height;\n }\n }\n\n let i = (this.bitmap.width * yi + xi) << 2;\n\n // if out of bounds index is -1\n if (xi < 0 || xi >= this.bitmap.width) {\n i = -1;\n }\n\n if (yi < 0 || yi >= this.bitmap.height) {\n i = -1;\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n\n return i;\n }\n\n /**\n * Returns the hex colour value of a pixel\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the color of the pixel\n */\n getPixelColor(x, y, cb) {\n if (typeof x !== \"number\" || typeof y !== \"number\")\n return throwError.call(this, \"x and y must be numbers\", cb);\n\n const idx = this.getPixelIndex(x, y);\n const hex = this.bitmap.data.readUInt32BE(idx);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, hex);\n }\n\n return hex;\n }\n\n getPixelColour = this.getPixelColor;\n\n /**\n * Returns the hex colour value of a pixel\n * @param {number} hex color to set\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n setPixelColor(hex, x, y, cb) {\n if (\n typeof hex !== \"number\" ||\n typeof x !== \"number\" ||\n typeof y !== \"number\"\n )\n return throwError.call(this, \"hex, x and y must be numbers\", cb);\n\n const idx = this.getPixelIndex(x, y);\n this.bitmap.data.writeUInt32BE(hex, idx);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n\n setPixelColour = this.setPixelColor;\n\n /**\n * Determine if the image contains opaque pixels.\n * @return {boolean} hasAlpha whether the image contains opaque pixels\n */\n hasAlpha() {\n const {width, height, data} = this.bitmap;\n const byteLen = (width * height) << 2;\n\n for (let idx = 3; idx < byteLen; idx += 4) {\n if (data[idx] !== 0xff) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Iterate scan through a region of the bitmap\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>}\n */\n scanIterator(x, y, w, h) {\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\");\n }\n\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\");\n }\n\n return scanIterator(this, x, y, w, h);\n }\n}\n\nexport function addConstants(constants, jimpInstance = Jimp) {\n Object.entries(constants).forEach(([name, value]) => {\n jimpInstance[name] = value;\n });\n}\n\nexport function addJimpMethods(methods, jimpInstance = Jimp) {\n Object.entries(methods).forEach(([name, value]) => {\n jimpInstance.prototype[name] = value;\n });\n}\n\naddConstants(constants);\naddJimpMethods({ composite });\n\nJimp.__extraConstructors = [];\n\n/**\n * Allow client libs to add new ways to build a Jimp object.\n * @param {string} name identify the extra constructor.\n * @param {function} test a function that returns true when it accepts the arguments passed to the main constructor.\n * @param {function} run where the magic happens.\n */\nJimp.appendConstructorOption = function (name, test, run) {\n Jimp.__extraConstructors.push({ name, test, run });\n};\n\n/**\n * Read an image from a file or a Buffer. Takes the same args as the constructor\n * @returns {Promise} a promise\n */\nJimp.read = function (...args) {\n return new Promise((resolve, reject) => {\n // eslint-disable-next-line no-new\n new Jimp(...args, (err, image) => {\n if (err) reject(err);\n else resolve(image);\n });\n });\n};\n\nJimp.create = Jimp.read;\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} r the red value (0-255)\n * @param {number} g the green value (0-255)\n * @param {number} b the blue value (0-255)\n * @param {number} a the alpha value (0-255)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {number} an single integer colour value\n */\nJimp.rgbaToInt = function (r, g, b, a, cb) {\n if (\n typeof r !== \"number\" ||\n typeof g !== \"number\" ||\n typeof b !== \"number\" ||\n typeof a !== \"number\"\n ) {\n return throwError.call(this, \"r, g, b and a must be numbers\", cb);\n }\n\n if (r < 0 || r > 255) {\n return throwError.call(this, \"r must be between 0 and 255\", cb);\n }\n\n if (g < 0 || g > 255) {\n throwError.call(this, \"g must be between 0 and 255\", cb);\n }\n\n if (b < 0 || b > 255) {\n return throwError.call(this, \"b must be between 0 and 255\", cb);\n }\n\n if (a < 0 || a > 255) {\n return throwError.call(this, \"a must be between 0 and 255\", cb);\n }\n\n let i = (r & 0xff);\n i <<= 8;\n i |= (g & 0xff)\n i <<= 8;\n i |= (b & 0xff)\n i <<= 8;\n i |= (a & 0xff);\n\n // Ensure sign is correct\n i >>>= 0;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n\n return i;\n};\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} i a single integer value representing an RGBA colour (e.g. 0xFF0000FF for red)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {object} an object with the properties r, g, b and a representing RGBA values\n */\nJimp.intToRGBA = function (i, cb) {\n if (typeof i !== \"number\") {\n return throwError.call(this, \"i must be a number\", cb);\n }\n\n const rgba = {};\n\n rgba.r = Math.floor(i / Math.pow(256, 3));\n rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));\n rgba.b = Math.floor(\n (i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) /\n Math.pow(256, 1)\n );\n rgba.a = Math.floor(\n (i -\n rgba.r * Math.pow(256, 3) -\n rgba.g * Math.pow(256, 2) -\n rgba.b * Math.pow(256, 1)) /\n Math.pow(256, 0)\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, rgba);\n }\n\n return rgba;\n};\n\n/**\n * Converts a css color (Hex, 8-digit (RGBA) Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, Named) to a hex number\n * @param {string} cssColor a number\n * @returns {number} a hex number representing a color\n */\nJimp.cssColorToHex = function (cssColor) {\n cssColor = cssColor || 0; // 0, null, undefined, NaN\n\n if (typeof cssColor === \"number\") return Number(cssColor);\n\n return parseInt(tinyColor(cssColor).toHex8(), 16);\n};\n\n/**\n * Limits a number to between 0 or 255\n * @param {number} n a number\n * @returns {number} the number limited to between 0 or 255\n */\nJimp.limit255 = function (n) {\n n = Math.max(n, 0);\n n = Math.min(n, 255);\n\n return n;\n};\n\n/**\n * Diffs two images and returns\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @param {number} threshold (optional) a number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1)\n * @returns {object} an object { percent: percent similar, diff: a Jimp image highlighting differences }\n */\nJimp.diff = function (img1, img2, threshold = 0.1) {\n if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp))\n return throwError.call(this, \"img1 and img2 must be an Jimp images\");\n\n const bmp1 = img1.bitmap;\n const bmp2 = img2.bitmap;\n\n if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) {\n if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) {\n // img1 is bigger\n img1 = img1.cloneQuiet().resize(bmp2.width, bmp2.height);\n } else {\n // img2 is bigger (or they are the same in area)\n img2 = img2.cloneQuiet().resize(bmp1.width, bmp1.height);\n }\n }\n\n if (typeof threshold !== \"number\" || threshold < 0 || threshold > 1) {\n return throwError.call(this, \"threshold must be a number between 0 and 1\");\n }\n\n const diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff);\n\n const numDiffPixels = pixelMatch(\n bmp1.data,\n bmp2.data,\n diff.bitmap.data,\n diff.bitmap.width,\n diff.bitmap.height,\n { threshold }\n );\n\n return {\n percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height),\n image: diff,\n };\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.distance = function (img1, img2) {\n const phash = new ImagePHash();\n const hash1 = phash.getHash(img1);\n const hash2 = phash.getHash(img2);\n\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {hash} hash1 a pHash\n * @param {hash} hash2 a pHash\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.compareHashes = function (hash1, hash2) {\n const phash = new ImagePHash();\n\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Compute color difference\n * 0 means no difference, 1 means maximum difference.\n * @param {number} rgba1: first color to compare.\n * @param {number} rgba2: second color to compare.\n * Both parameters must be an color object {r:val, g:val, b:val, a:val}\n * Where `a` is optional and `val` is an integer between 0 and 255.\n * @returns {number} float between 0 and 1.\n */\nJimp.colorDiff = function (rgba1, rgba2) {\n const pow = (n) => Math.pow(n, 2);\n const { max } = Math;\n const maxVal = 255 * 255 * 3;\n\n if (rgba1.a !== 0 && !rgba1.a) {\n rgba1.a = 255;\n }\n\n if (rgba2.a !== 0 && !rgba2.a) {\n rgba2.a = 255;\n }\n\n return (\n (max(pow(rgba1.r - rgba2.r), pow(rgba1.r - rgba2.r - rgba1.a + rgba2.a)) +\n max(pow(rgba1.g - rgba2.g), pow(rgba1.g - rgba2.g - rgba1.a + rgba2.a)) +\n max(pow(rgba1.b - rgba2.b), pow(rgba1.b - rgba2.b - rgba1.a + rgba2.a))) /\n maxVal\n );\n};\n\n/**\n * Helper to create Jimp methods that emit events before and after its execution.\n * @param {string} methodName The name to be appended to Jimp prototype.\n * @param {string} evName The event name to be called.\n * It will be prefixed by `before-` and emitted when on method call.\n * It will be appended by `ed` and emitted after the method run.\n * @param {function} method A function implementing the method itself.\n * It will also create a quiet version that will not emit events, to not\n * mess the user code with many `changed` event calls. You can call with\n * `methodName + \"Quiet\"`.\n *\n * The emitted event comes with a object parameter to the listener with the\n * `methodName` as one attribute.\n */\nexport function jimpEvMethod(methodName, evName, method) {\n const evNameBefore = \"before-\" + evName;\n const evNameAfter = evName.replace(/e$/, \"\") + \"ed\";\n\n Jimp.prototype[methodName] = function (...args) {\n let wrappedCb;\n const cb = args[method.length - 1];\n const jimpInstance = this;\n\n if (typeof cb === \"function\") {\n wrappedCb = function (...args) {\n const [err, data] = args;\n\n if (err) {\n jimpInstance.emitError(methodName, err);\n } else {\n jimpInstance.emitMulti(methodName, evNameAfter, {\n [methodName]: data,\n });\n }\n\n cb.apply(this, args);\n };\n\n args[args.length - 1] = wrappedCb;\n } else {\n wrappedCb = false;\n }\n\n this.emitMulti(methodName, evNameBefore);\n\n let result;\n\n try {\n result = method.apply(this, args);\n\n if (!wrappedCb) {\n this.emitMulti(methodName, evNameAfter, {\n [methodName]: result,\n });\n }\n } catch (error) {\n error.methodName = methodName;\n this.emitError(methodName, error);\n }\n\n return result;\n };\n\n Jimp.prototype[methodName + \"Quiet\"] = method;\n}\n\n/**\n * Creates a new image that is a clone of this one.\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns the new image\n */\njimpEvMethod(\"clone\", \"clone\", function (cb) {\n const clone = new Jimp(this);\n\n if (isNodePattern(cb)) {\n cb.call(clone, null, clone);\n }\n\n return clone;\n});\n\n/**\n * Simplify jimpEvMethod call for the common `change` evName.\n * @param {string} methodName name of the method\n * @param {function} method to watch changes for\n */\nexport function jimpEvChange(methodName, method) {\n jimpEvMethod(methodName, \"change\", method);\n}\n\n/**\n * Sets the type of the image (RGB or RGBA) when saving as PNG format (default is RGBA)\n * @param b A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange(\"background\", function (hex, cb) {\n if (typeof hex !== \"number\") {\n return throwError.call(this, \"hex must be a hexadecimal rgba value\", cb);\n }\n\n this._background = hex;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n});\n\n/**\n * Scans through a region of the bitmap, calling a function for each pixel.\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @param f a function to call on even pixel; the (x, y) position of the pixel\n * and the index of the pixel in the bitmap buffer are passed to the function\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange(\"scan\", function (x, y, w, h, f, cb) {\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n if (typeof f !== \"function\") {\n return throwError.call(this, \"f must be a function\", cb);\n }\n\n const result = scan(this, x, y, w, h, f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, result);\n }\n\n return result;\n});\n\nif (process.env.ENVIRONMENT === \"BROWSER\") {\n // For use in a web browser or web worker\n /* global self */\n let gl;\n\n if (typeof window !== \"undefined\" && typeof window === \"object\") {\n gl = window;\n }\n\n if (typeof self !== \"undefined\" && typeof self === \"object\") {\n gl = self;\n }\n\n gl.Jimp = Jimp;\n gl.Buffer = Buffer;\n}\n\nexport { addType } from \"./utils/mime\";\n\nexport default Jimp;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AACA;AACA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AAAyC;AAAA;AAAA;AAAA;AAAA;AAAA;AAEzC,MAAMA,QAAQ,GACZ,kEAAkE;;AAEpE;AACA;AACA,MAAMC,aAAa,GAAG,CAACC,GAAG,EAAEA,GAAG,CAAC;AAEhC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,EAAE,EAAEA,CAAC,EAAE,EAAE;EAC3B,MAAMC,OAAO,GAAG,IAAAC,gBAAO,EACr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,EAAEa,EAAE,CAAC;EAC1D;EAEA,MAAMiL,MAAM,GAAG,IAAAK,WAAI,EAAC,IAAI,EAAE5E,CAAC,EAAEC,CAAC,EAAE/D,CAAC,EAAEC,CAAC,EAAEwI,CAAC,CAAC;EAExC,IAAI,IAAA3G,oBAAa,EAAC1E,EAAE,CAAC,EAAE;IACrBA,EAAE,CAACb,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE8L,MAAM,CAAC;EAC7B;EAEA,OAAOA,MAAM;AACf,CAAC,CAAC;AAEF,IAAIM,OAAO,CAACC,GAAG,CAACC,WAAW,KAAK,SAAS,EAAE;EACzC;EACA;EACA,IAAIC,EAAE;EAEN,IAAI,OAAOC,MAAM,KAAK,WAAW,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;IAC/DD,EAAE,GAAGC,MAAM;EACb;EAEA,IAAI,OAAOC,IAAI,KAAK,WAAW,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IAC3DF,EAAE,GAAGE,IAAI;EACX;EAEAF,EAAE,CAACpK,IAAI,GAAGA,IAAI;EACdoK,EAAE,CAACjM,MAAM,GAAGA,MAAM;AACpB;AAAC,eAIc6B,IAAI;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/modules/phash.js b/project starter code/node_modules/@jimp/core/dist/modules/phash.js index dac128a5..0ec68644 100644 --- a/project starter code/node_modules/@jimp/core/dist/modules/phash.js +++ b/project starter code/node_modules/@jimp/core/dist/modules/phash.js @@ -1,5 +1,9 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; /* Copyright (c) 2011 Elliot Shepherd @@ -21,6 +25,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + // https://code.google.com/p/ironchef-team21/source/browse/ironchef_team21/src/ImagePHash.java /* @@ -28,28 +33,25 @@ THE SOFTWARE. * Author: Elliot Shepherd (elliot@jarofworms.com * Based On: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html */ + function ImagePHash(size, smallerSize) { this.size = this.size || size; this.smallerSize = this.smallerSize || smallerSize; initCoefficients(this.size); } - ImagePHash.prototype.size = 32; ImagePHash.prototype.smallerSize = 8; - ImagePHash.prototype.distance = function (s1, s2) { - var counter = 0; - - for (var k = 0; k < s1.length; k++) { + let counter = 0; + for (let k = 0; k < s1.length; k++) { if (s1[k] !== s2[k]) { counter++; } } - return counter / s1.length; -}; // Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on. - +}; +// Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on. ImagePHash.prototype.getHash = function (img) { /* 1. Reduce size. * Like Average Hash, pHash starts with a small image. @@ -58,51 +60,46 @@ ImagePHash.prototype.getHash = function (img) { * because it is needed to reduce the high frequencies. */ img = img.clone().resize(this.size, this.size); + /* 2. Reduce color. * The image is reduced to a grayscale just to further simplify * the number of computations. */ - img.grayscale(); - var vals = []; - - for (var x = 0; x < img.bitmap.width; x++) { + const vals = []; + for (let x = 0; x < img.bitmap.width; x++) { vals[x] = []; - - for (var y = 0; y < img.bitmap.height; y++) { + for (let y = 0; y < img.bitmap.height; y++) { vals[x][y] = intToRGBA(img.getPixelColor(x, y)).b; } } + /* 3. Compute the DCT. * The DCT separates the image into a collection of frequencies * and scalars. While JPEG uses an 8x8 DCT, this algorithm uses * a 32x32 DCT. */ + const dctVals = applyDCT(vals, this.size); - - var dctVals = applyDCT(vals, this.size); /* 4. Reduce the DCT. * This is the magic step. While the DCT is 32x32, just keep the * top-left 8x8. Those represent the lowest frequencies in the * picture. */ - /* 5. Compute the average value. * Like the Average Hash, compute the mean DCT value (using only * the 8x8 DCT low-frequency values and excluding the first term * since the DC coefficient can be significantly different from * the other values and will throw off the average). */ - - var total = 0; - - for (var _x = 0; _x < this.smallerSize; _x++) { - for (var _y = 0; _y < this.smallerSize; _y++) { - total += dctVals[_x][_y]; + let total = 0; + for (let x = 0; x < this.smallerSize; x++) { + for (let y = 0; y < this.smallerSize; y++) { + total += dctVals[x][y]; } } + const avg = total / (this.smallerSize * this.smallerSize); - var avg = total / (this.smallerSize * this.smallerSize); /* 6. Further reduce the DCT. * This is the magic step. Set the 64 hash bits to 0 or 1 * depending on whether each of the 64 DCT values is above or @@ -113,61 +110,62 @@ ImagePHash.prototype.getHash = function (img) { * remains the same; this can survive gamma and color histogram * adjustments without a problem. */ - - var hash = ''; - - for (var _x2 = 0; _x2 < this.smallerSize; _x2++) { - for (var _y2 = 0; _y2 < this.smallerSize; _y2++) { - hash += dctVals[_x2][_y2] > avg ? '1' : '0'; + let hash = ""; + for (let x = 0; x < this.smallerSize; x++) { + for (let y = 0; y < this.smallerSize; y++) { + hash += dctVals[x][y] > avg ? "1" : "0"; } } - return hash; -}; // DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java +}; +// DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java +/** + Convert a 32-bit integer color value to an RGBA object. + */ function intToRGBA(i) { - var rgba = {}; - rgba.r = Math.floor(i / Math.pow(256, 3)); - rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2)); - rgba.b = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) / Math.pow(256, 1)); - rgba.a = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2) - rgba.b * Math.pow(256, 1)) / Math.pow(256, 0)); - return rgba; + const a = i & 0xff; + i >>>= 8; + const b = i & 0xff; + i >>>= 8; + const g = i & 0xff; + i >>>= 8; + const r = i & 0xff; + return { + r, + g, + b, + a + }; } - -var c = []; - +const c = []; function initCoefficients(size) { - for (var i = 1; i < size; i++) { + for (let i = 1; i < size; i++) { c[i] = 1; } - c[0] = 1 / Math.sqrt(2.0); } - function applyDCT(f, size) { - var N = size; - var F = []; - - for (var u = 0; u < N; u++) { + const N = size; + const F = []; + for (let u = 0; u < N; u++) { F[u] = []; - - for (var v = 0; v < N; v++) { - var sum = 0; - - for (var i = 0; i < N; i++) { - for (var j = 0; j < N; j++) { + for (let v = 0; v < N; v++) { + let sum = 0; + for (let i = 0; i < N; i++) { + for (let j = 0; j < N; j++) { sum += Math.cos((2 * i + 1) / (2.0 * N) * u * Math.PI) * Math.cos((2 * j + 1) / (2.0 * N) * v * Math.PI) * f[i][j]; } } - sum *= c[u] * c[v] / 4; F[u][v] = sum; } } - return F; } - -module.exports = ImagePHash; +var _default = ImagePHash; +exports.default = _default; +module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=phash.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/modules/phash.js.map b/project starter code/node_modules/@jimp/core/dist/modules/phash.js.map index 5556e315..d32e5443 100644 --- a/project starter code/node_modules/@jimp/core/dist/modules/phash.js.map +++ b/project starter code/node_modules/@jimp/core/dist/modules/phash.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../src/modules/phash.js"],"names":["ImagePHash","size","smallerSize","initCoefficients","prototype","distance","s1","s2","counter","k","length","getHash","img","clone","resize","grayscale","vals","x","bitmap","width","y","height","intToRGBA","getPixelColor","b","dctVals","applyDCT","total","avg","hash","i","rgba","r","Math","floor","pow","g","a","c","sqrt","f","N","F","u","v","sum","j","cos","PI","module","exports"],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;AAsBA;;AAEA;;;;;AAMA,SAASA,UAAT,CAAoBC,IAApB,EAA0BC,WAA1B,EAAuC;AACrC,OAAKD,IAAL,GAAY,KAAKA,IAAL,IAAaA,IAAzB;AACA,OAAKC,WAAL,GAAmB,KAAKA,WAAL,IAAoBA,WAAvC;AACAC,EAAAA,gBAAgB,CAAC,KAAKF,IAAN,CAAhB;AACD;;AAEDD,UAAU,CAACI,SAAX,CAAqBH,IAArB,GAA4B,EAA5B;AACAD,UAAU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Ab,EAAgBA,CAAC,GAAGF,CAApB,EAAuBE,CAAC,EAAxB,EAA4B;AAC1BD,IAAAA,CAAC,CAACC,CAAD,CAAD,GAAO,EAAP;;AACA,SAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGH,CAApB,EAAuBG,CAAC,EAAxB,EAA4B;AAC1B,UAAIC,GAAG,GAAG,CAAV;;AACA,WAAK,IAAIf,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGW,CAApB,EAAuBX,CAAC,EAAxB,EAA4B;AAC1B,aAAK,IAAIgB,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGL,CAApB,EAAuBK,CAAC,EAAxB,EAA4B;AAC1BD,UAAAA,GAAG,IACDZ,IAAI,CAACc,GAAL,CAAU,CAAC,IAAIjB,CAAJ,GAAQ,CAAT,KAAe,MAAMW,CAArB,CAAD,GAA4BE,CAA5B,GAAgCV,IAAI,CAACe,EAA9C,IACAf,IAAI,CAACc,GAAL,CAAU,CAAC,IAAID,CAAJ,GAAQ,CAAT,KAAe,MAAML,CAArB,CAAD,GAA4BG,CAA5B,GAAgCX,IAAI,CAACe,EAA9C,CADA,GAEAR,CAAC,CAACV,CAAD,CAAD,CAAKgB,CAAL,CAHF;AAID;AACF;;AAEDD,MAAAA,GAAG,IAAKP,CAAC,CAACK,CAAD,CAAD,GAAOL,CAAC,CAACM,CAAD,CAAT,GAAgB,CAAvB;AACAF,MAAAA,CAAC,CAACC,CAAD,CAAD,CAAKC,CAAL,IAAUC,GAAV;AACD;AACF;;AAED,SAAOH,CAAP;AACD;;AAEDO,MAAM,CAACC,OAAP,GAAiBlD,UAAjB","sourcesContent":["/*\nCopyright (c) 2011 Elliot Shepherd\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\nall copies 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\nTHE SOFTWARE.\n*/\n\n// https://code.google.com/p/ironchef-team21/source/browse/ironchef_team21/src/ImagePHash.java\n\n/*\n * pHash-like image hash.\n * Author: Elliot Shepherd (elliot@jarofworms.com\n * Based On: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html\n */\n\nfunction ImagePHash(size, smallerSize) {\n this.size = this.size || size;\n this.smallerSize = this.smallerSize || smallerSize;\n initCoefficients(this.size);\n}\n\nImagePHash.prototype.size = 32;\nImagePHash.prototype.smallerSize = 8;\n\nImagePHash.prototype.distance = function(s1, s2) {\n let counter = 0;\n\n for (let k = 0; k < s1.length; k++) {\n if (s1[k] !== s2[k]) {\n counter++;\n }\n }\n\n return counter / s1.length;\n};\n\n// Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on.\nImagePHash.prototype.getHash = function(img) {\n /* 1. Reduce size.\n * Like Average Hash, pHash starts with a small image.\n * However, the image is larger than 8x8; 32x32 is a good size.\n * This is really done to simplify the DCT computation and not\n * because it is needed to reduce the high frequencies.\n */\n img = img.clone().resize(this.size, this.size);\n\n /* 2. Reduce color.\n * The image is reduced to a grayscale just to further simplify\n * the number of computations.\n */\n img.grayscale();\n\n const vals = [];\n\n for (let x = 0; x < img.bitmap.width; x++) {\n vals[x] = [];\n for (let y = 0; y < img.bitmap.height; y++) {\n vals[x][y] = intToRGBA(img.getPixelColor(x, y)).b;\n }\n }\n\n /* 3. Compute the DCT.\n * The DCT separates the image into a collection of frequencies\n * and scalars. While JPEG uses an 8x8 DCT, this algorithm uses\n * a 32x32 DCT.\n */\n const dctVals = applyDCT(vals, this.size);\n\n /* 4. Reduce the DCT.\n * This is the magic step. While the DCT is 32x32, just keep the\n * top-left 8x8. Those represent the lowest frequencies in the\n * picture.\n */\n /* 5. Compute the average value.\n * Like the Average Hash, compute the mean DCT value (using only\n * the 8x8 DCT low-frequency values and excluding the first term\n * since the DC coefficient can be significantly different from\n * the other values and will throw off the average).\n */\n let total = 0;\n\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n total += dctVals[x][y];\n }\n }\n\n const avg = total / (this.smallerSize * this.smallerSize);\n\n /* 6. Further reduce the DCT.\n * This is the magic step. Set the 64 hash bits to 0 or 1\n * depending on whether each of the 64 DCT values is above or\n * below the average value. The result doesn't tell us the\n * actual low frequencies; it just tells us the very-rough\n * relative scale of the frequencies to the mean. The result\n * will not vary as long as the overall structure of the image\n * remains the same; this can survive gamma and color histogram\n * adjustments without a problem.\n */\n let hash = '';\n\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n hash += dctVals[x][y] > avg ? '1' : '0';\n }\n }\n\n return hash;\n};\n\n// DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java\n\nfunction intToRGBA(i) {\n const rgba = {};\n\n rgba.r = Math.floor(i / Math.pow(256, 3));\n rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));\n rgba.b = Math.floor(\n (i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) /\n Math.pow(256, 1)\n );\n rgba.a = Math.floor(\n (i -\n rgba.r * Math.pow(256, 3) -\n rgba.g * Math.pow(256, 2) -\n rgba.b * Math.pow(256, 1)) /\n Math.pow(256, 0)\n );\n\n return rgba;\n}\n\nconst c = [];\nfunction initCoefficients(size) {\n for (let i = 1; i < size; i++) {\n c[i] = 1;\n }\n\n c[0] = 1 / Math.sqrt(2.0);\n}\n\nfunction applyDCT(f, size) {\n const N = size;\n const F = [];\n\n for (let u = 0; u < N; u++) {\n F[u] = [];\n for (let v = 0; v < N; v++) {\n let sum = 0;\n for (let i = 0; i < N; i++) {\n for (let j = 0; j < N; j++) {\n sum +=\n Math.cos(((2 * i + 1) / (2.0 * N)) * u * Math.PI) *\n Math.cos(((2 * j + 1) / (2.0 * N)) * v * Math.PI) *\n f[i][j];\n }\n }\n\n sum *= (c[u] * c[v]) / 4;\n F[u][v] = sum;\n }\n }\n\n return F;\n}\n\nmodule.exports = ImagePHash;\n"],"file":"phash.js"} \ No newline at end of file +{"version":3,"file":"phash.js","names":["ImagePHash","size","smallerSize","initCoefficients","prototype","distance","s1","s2","counter","k","length","getHash","img","clone","resize","grayscale","vals","x","bitmap","width","y","height","intToRGBA","getPixelColor","b","dctVals","applyDCT","total","avg","hash","i","a","g","r","c","Math","sqrt","f","N","F","u","v","sum","j","cos","PI"],"sources":["../../src/modules/phash.js"],"sourcesContent":["/*\nCopyright (c) 2011 Elliot Shepherd\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\nall copies 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\nTHE SOFTWARE.\n*/\n\n// https://code.google.com/p/ironchef-team21/source/browse/ironchef_team21/src/ImagePHash.java\n\n/*\n * pHash-like image hash.\n * Author: Elliot Shepherd (elliot@jarofworms.com\n * Based On: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html\n */\n\nfunction ImagePHash(size, smallerSize) {\n this.size = this.size || size;\n this.smallerSize = this.smallerSize || smallerSize;\n initCoefficients(this.size);\n}\n\nImagePHash.prototype.size = 32;\nImagePHash.prototype.smallerSize = 8;\n\nImagePHash.prototype.distance = function (s1, s2) {\n let counter = 0;\n\n for (let k = 0; k < s1.length; k++) {\n if (s1[k] !== s2[k]) {\n counter++;\n }\n }\n\n return counter / s1.length;\n};\n\n// Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on.\nImagePHash.prototype.getHash = function (img) {\n /* 1. Reduce size.\n * Like Average Hash, pHash starts with a small image.\n * However, the image is larger than 8x8; 32x32 is a good size.\n * This is really done to simplify the DCT computation and not\n * because it is needed to reduce the high frequencies.\n */\n img = img.clone().resize(this.size, this.size);\n\n /* 2. Reduce color.\n * The image is reduced to a grayscale just to further simplify\n * the number of computations.\n */\n img.grayscale();\n\n const vals = [];\n\n for (let x = 0; x < img.bitmap.width; x++) {\n vals[x] = [];\n for (let y = 0; y < img.bitmap.height; y++) {\n vals[x][y] = intToRGBA(img.getPixelColor(x, y)).b;\n }\n }\n\n /* 3. Compute the DCT.\n * The DCT separates the image into a collection of frequencies\n * and scalars. While JPEG uses an 8x8 DCT, this algorithm uses\n * a 32x32 DCT.\n */\n const dctVals = applyDCT(vals, this.size);\n\n /* 4. Reduce the DCT.\n * This is the magic step. While the DCT is 32x32, just keep the\n * top-left 8x8. Those represent the lowest frequencies in the\n * picture.\n */\n /* 5. Compute the average value.\n * Like the Average Hash, compute the mean DCT value (using only\n * the 8x8 DCT low-frequency values and excluding the first term\n * since the DC coefficient can be significantly different from\n * the other values and will throw off the average).\n */\n let total = 0;\n\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n total += dctVals[x][y];\n }\n }\n\n const avg = total / (this.smallerSize * this.smallerSize);\n\n /* 6. Further reduce the DCT.\n * This is the magic step. Set the 64 hash bits to 0 or 1\n * depending on whether each of the 64 DCT values is above or\n * below the average value. The result doesn't tell us the\n * actual low frequencies; it just tells us the very-rough\n * relative scale of the frequencies to the mean. The result\n * will not vary as long as the overall structure of the image\n * remains the same; this can survive gamma and color histogram\n * adjustments without a problem.\n */\n let hash = \"\";\n\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n hash += dctVals[x][y] > avg ? \"1\" : \"0\";\n }\n }\n\n return hash;\n};\n\n// DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java\n\n/**\n Convert a 32-bit integer color value to an RGBA object.\n */\nfunction intToRGBA(i) {\n const a = i & 0xff;\n i >>>= 8;\n const b = i & 0xff;\n i >>>= 8;\n const g = i & 0xff;\n i >>>= 8;\n const r = i & 0xff;\n\n return {r, g, b, a};\n}\n\nconst c = [];\nfunction initCoefficients(size) {\n for (let i = 1; i < size; i++) {\n c[i] = 1;\n }\n\n c[0] = 1 / Math.sqrt(2.0);\n}\n\nfunction applyDCT(f, size) {\n const N = size;\n const F = [];\n\n for (let u = 0; u < N; u++) {\n F[u] = [];\n for (let v = 0; v < N; v++) {\n let sum = 0;\n for (let i = 0; i < N; i++) {\n for (let j = 0; j < N; j++) {\n sum +=\n Math.cos(((2 * i + 1) / (2.0 * N)) * u * Math.PI) *\n Math.cos(((2 * j + 1) / (2.0 * N)) * v * Math.PI) *\n f[i][j];\n }\n }\n\n sum *= (c[u] * c[v]) / 4;\n F[u][v] = sum;\n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AGQ,CAAC,EAAER,CAAC,EAAE,EAAE;QAC1B,KAAK,IAAIa,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,CAAC,EAAEK,CAAC,EAAE,EAAE;UAC1BD,GAAG,IACDP,IAAI,CAACS,GAAG,CAAE,CAAC,CAAC,GAAGd,CAAC,GAAG,CAAC,KAAK,GAAG,GAAGQ,CAAC,CAAC,GAAIE,CAAC,GAAGL,IAAI,CAACU,EAAE,CAAC,GACjDV,IAAI,CAACS,GAAG,CAAE,CAAC,CAAC,GAAGD,CAAC,GAAG,CAAC,KAAK,GAAG,GAAGL,CAAC,CAAC,GAAIG,CAAC,GAAGN,IAAI,CAACU,EAAE,CAAC,GACjDR,CAAC,CAACP,CAAC,CAAC,CAACa,CAAC,CAAC;QACX;MACF;MAEAD,GAAG,IAAKR,CAAC,CAACM,CAAC,CAAC,GAAGN,CAAC,CAACO,CAAC,CAAC,GAAI,CAAC;MACxBF,CAAC,CAACC,CAAC,CAAC,CAACC,CAAC,CAAC,GAAGC,GAAG;IACf;EACF;EAEA,OAAOH,CAAC;AACV;AAAC,eAEcvC,UAAU;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/request.js b/project starter code/node_modules/@jimp/core/dist/request.js index 4b211f73..ac1430eb 100644 --- a/project starter code/node_modules/@jimp/core/dist/request.js +++ b/project starter code/node_modules/@jimp/core/dist/request.js @@ -1,55 +1,25 @@ "use strict"; -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/* global XMLHttpRequest */ -if (process.browser || process.env.ENVIRONMENT === 'BROWSER' || typeof process.versions.electron !== 'undefined' && process.type === 'renderer' && typeof XMLHttpRequest === 'function') { - // If we run into a browser or the electron renderer process, - // use XHR method instead of Request node module. - module.exports = function (options, cb) { - var xhr = new XMLHttpRequest(); - xhr.open('GET', options.url, true); - xhr.responseType = 'arraybuffer'; - xhr.addEventListener('load', function () { - if (xhr.status < 400) { - try { - var data = Buffer.from(this.response); - cb(null, xhr, data); - } catch (error) { - return cb(new Error('Response is not a buffer for url ' + options.url + '. Error: ' + error.message)); - } - } else { - cb(new Error('HTTP Status ' + xhr.status + ' for url ' + options.url)); - } - }); - xhr.addEventListener('error', function (e) { - cb(e); - }); - xhr.send(); - }; -} else { - module.exports = function (_ref, cb) { - var options = (0, _extends2["default"])({}, _ref); - - var p = require('phin'); - - p(_objectSpread({ - compression: true - }, options), function (err, res) { - if (err === null) { - cb(null, res, res.body); - } else { - cb(err); - } - }); - }; -} +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; +require("isomorphic-fetch"); +var _default = (_ref, cb) => { + let { + url, + ...options + } = _ref; + fetch(url, options).then(response => { + if (response.ok) { + return response.arrayBuffer().catch(error => { + throw new Error(`Response is not a buffer for url ${url}. Error: ${error.message}`); + }); + } + throw new Error(`HTTP Status ${response.status} for url ${url}`); + }).then(data => cb(null, data)).catch(error => cb(error)); +}; +exports.default = _default; +module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=request.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/request.js.map b/project starter code/node_modules/@jimp/core/dist/request.js.map index 04a1d461..9f6a16f9 100644 --- a/project starter code/node_modules/@jimp/core/dist/request.js.map +++ b/project starter code/node_modules/@jimp/core/dist/request.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/request.js"],"names":["process","browser","env","ENVIRONMENT","versions","electron","type","XMLHttpRequest","module","exports","options","cb","xhr","open","url","responseType","addEventListener","status","data","Buffer","from","response","error","Error","message","e","send","p","require","compression","err","res","body"],"mappings":";;;;;;;;;;;;AAAA;AAEA,IACEA,OAAO,CAACC,OAAR,IACAD,OAAO,CAACE,GAAR,CAAYC,WAAZ,KAA4B,SAD5B,IAEC,OAAOH,OAAO,CAACI,QAAR,CAAiBC,QAAxB,KAAqC,WAArC,IACCL,OAAO,CAACM,IAAR,KAAiB,UADlB,IAEC,OAAOC,cAAP,KAA0B,UAL9B,EAME;AACA;AACA;AAEAC,EAAAA,MAAM,CAACC,OAAP,GAAiB,UAASC,OAAT,EAAkBC,EAAlB,EAAsB;AACrC,QAAMC,GAAG,GAAG,IAAIL,cAAJ,EAAZ;AACAK,IAAAA,GAAG,CAACC,IAAJ,CAAS,KAAT,EAAgBH,OAAO,CAACI,GAAxB,EAA6B,IAA7B;AACAF,IAAAA,GAAG,CAACG,YAAJ,GAAmB,aAAnB;AACAH,IAAAA,GAAG,CAACI,gBAAJ,CAAqB,MAArB,EAA6B,YAAW;AACtC,UAAIJ,GAAG,CAACK,MAAJ,GAAa,GAAjB,EAAsB;AACpB,YAAI;AACF,cAAMC,IAAI,GAAGC,MAAM,CAACC,IAAP,CAAY,KAAKC,QAAjB,CAAb;AACAV,UAAAA,EAAE,CAAC,IAAD,EAAOC,GAAP,EAAYM,IAAZ,CAAF;AACD,SAHD,CAGE,OAAOI,KAAP,EAAc;AACd,iBAAOX,EAAE,CACP,IAAIY,KAAJ,CACE,sCACEb,OAAO,CAACI,GADV,GAEE,WAFF,GAGEQ,KAAK,CAACE,OAJV,CADO,CAAT;AAQD;AACF,OAdD,MAcO;AACLb,QAAAA,EAAE,CAAC,IAAIY,KAAJ,CAAU,iBAAiBX,GAAG,CAACK,MAArB,GAA8B,WAA9B,GAA4CP,OAAO,CAACI,GAA9D,CAAD,CAAF;AACD;AACF,KAlBD;AAmBAF,IAAAA,GAAG,CAACI,gBAAJ,CAAqB,OAArB,EAA8B,UAAAS,CAAC,EAAI;AACjCd,MAAAA,EAAE,CAACc,CAAD,CAAF;AACD,KAFD;AAGAb,IAAAA,GAAG,CAACc,IAAJ;AACD,GA3BD;AA4BD,CAtCD,MAsCO;AACLlB,EAAAA,MAAM,CAACC,OAAP,GAAiB,gBAAyBE,EAAzB,EAA6B;AAAA,QAAfD,OAAe;;AAC5C,QAAMiB,CAAC,GAAGC,OAAO,CAAC,MAAD,CAAjB;;AAEAD,IAAAA,CAAC;AAAGE,MAAAA,WAAW,EAAE;AAAhB,OAAyBnB,OAAzB,GAAoC,UAACoB,GAAD,EAAMC,GAAN,EAAc;AACjD,UAAID,GAAG,KAAK,IAAZ,EAAkB;AAChBnB,QAAAA,EAAE,CAAC,IAAD,EAAOoB,GAAP,EAAYA,GAAG,CAACC,IAAhB,CAAF;AACD,OAFD,MAEO;AACLrB,QAAAA,EAAE,CAACmB,GAAD,CAAF;AACD;AACF,KANA,CAAD;AAOD,GAVD;AAWD","sourcesContent":["/* global XMLHttpRequest */\n\nif (\n process.browser ||\n process.env.ENVIRONMENT === 'BROWSER' ||\n (typeof process.versions.electron !== 'undefined' &&\n process.type === 'renderer' &&\n typeof XMLHttpRequest === 'function')\n) {\n // If we run into a browser or the electron renderer process,\n // use XHR method instead of Request node module.\n\n module.exports = function(options, cb) {\n const xhr = new XMLHttpRequest();\n xhr.open('GET', options.url, true);\n xhr.responseType = 'arraybuffer';\n xhr.addEventListener('load', function() {\n if (xhr.status < 400) {\n try {\n const data = Buffer.from(this.response);\n cb(null, xhr, data);\n } catch (error) {\n return cb(\n new Error(\n 'Response is not a buffer for url ' +\n options.url +\n '. Error: ' +\n error.message\n )\n );\n }\n } else {\n cb(new Error('HTTP Status ' + xhr.status + ' for url ' + options.url));\n }\n });\n xhr.addEventListener('error', e => {\n cb(e);\n });\n xhr.send();\n };\n} else {\n module.exports = function({ ...options }, cb) {\n const p = require('phin');\n\n p({ compression: true, ...options }, (err, res) => {\n if (err === null) {\n cb(null, res, res.body);\n } else {\n cb(err);\n }\n });\n };\n}\n"],"file":"request.js"} \ No newline at end of file +{"version":3,"file":"request.js","names":["cb","url","options","fetch","then","response","ok","arrayBuffer","catch","error","Error","message","status","data"],"sources":["../src/request.js"],"sourcesContent":["import \"isomorphic-fetch\";\n\nexport default ({ url, ...options }, cb) => {\n fetch(url, options)\n .then((response) => {\n if (response.ok) {\n return response.arrayBuffer().catch((error) => {\n throw new Error(\n `Response is not a buffer for url ${url}. Error: ${error.message}`\n );\n });\n }\n\n throw new Error(`HTTP Status ${response.status} for url ${url}`);\n })\n .then((data) => cb(null, data))\n .catch((error) => cb(error));\n};\n"],"mappings":";;;;;;AAAA;AAA0B,eAEX,OAAsBA,EAAE,KAAK;EAAA,IAA5B;IAAEC,GAAG;IAAE,GAAGC;EAAQ,CAAC;EACjCC,KAAK,CAACF,GAAG,EAAEC,OAAO,CAAC,CAChBE,IAAI,CAAEC,QAAQ,IAAK;IAClB,IAAIA,QAAQ,CAACC,EAAE,EAAE;MACf,OAAOD,QAAQ,CAACE,WAAW,EAAE,CAACC,KAAK,CAAEC,KAAK,IAAK;QAC7C,MAAM,IAAIC,KAAK,CACZ,oCAAmCT,GAAI,YAAWQ,KAAK,CAACE,OAAQ,EAAC,CACnE;MACH,CAAC,CAAC;IACJ;IAEA,MAAM,IAAID,KAAK,CAAE,eAAcL,QAAQ,CAACO,MAAO,YAAWX,GAAI,EAAC,CAAC;EAClE,CAAC,CAAC,CACDG,IAAI,CAAES,IAAI,IAAKb,EAAE,CAAC,IAAI,EAAEa,IAAI,CAAC,CAAC,CAC9BL,KAAK,CAAEC,KAAK,IAAKT,EAAE,CAACS,KAAK,CAAC,CAAC;AAChC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/utils/image-bitmap.js b/project starter code/node_modules/@jimp/core/dist/utils/image-bitmap.js index 4beabbe0..98ddf8c6 100644 --- a/project starter code/node_modules/@jimp/core/dist/utils/image-bitmap.js +++ b/project starter code/node_modules/@jimp/core/dist/utils/image-bitmap.js @@ -1,46 +1,34 @@ "use strict"; -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - Object.defineProperty(exports, "__esModule", { value: true }); -exports.parseBitmap = parseBitmap; exports.getBuffer = getBuffer; exports.getBufferAsync = getBufferAsync; - -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); - +exports.parseBitmap = parseBitmap; var _fileType = _interopRequireDefault(require("file-type")); - var _exifParser = _interopRequireDefault(require("exif-parser")); - var _utils = require("@jimp/utils"); - var constants = _interopRequireWildcard(require("../constants")); - var MIME = _interopRequireWildcard(require("./mime")); - var _promisify = _interopRequireDefault(require("./promisify")); - -function getMIMEFromBuffer(buffer, path) { - var fileTypeFromBuffer = (0, _fileType["default"])(buffer); - +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +async function getMIMEFromBuffer(buffer, path) { + const fileTypeFromBuffer = await _fileType.default.fromBuffer(buffer); if (fileTypeFromBuffer) { // If fileType returns something for buffer, then return the mime given return fileTypeFromBuffer.mime; } - if (path) { // If a path is supplied, and fileType yields no results, then retry with MIME // Path can be either a file path or a url return MIME.getType(path); } - return null; } + /* * Obtains image orientation from EXIF metadata. * @@ -48,11 +36,10 @@ function getMIMEFromBuffer(buffer, path) { * @returns {number} a number 1-8 representing EXIF orientation, * in particular 1 if orientation tag is missing */ - - function getExifOrientation(img) { return img._exif && img._exif.tags && img._exif.tags.Orientation || 1; } + /** * Returns a function which translates EXIF-rotated coordinates into * non-rotated ones. @@ -62,64 +49,54 @@ function getExifOrientation(img) { * @param img {Jimp} a Jimp image object * @returns {function} transformation function for transformBitmap(). */ - - function getExifOrientationTransformation(img) { - var w = img.getWidth(); - var h = img.getHeight(); - + const w = img.getWidth(); + const h = img.getHeight(); switch (getExifOrientation(img)) { case 1: // Horizontal (normal) // does not need to be supported here return null; - case 2: // Mirror horizontal return function (x, y) { return [w - x - 1, y]; }; - case 3: // Rotate 180 return function (x, y) { return [w - x - 1, h - y - 1]; }; - case 4: // Mirror vertical return function (x, y) { return [x, h - y - 1]; }; - case 5: // Mirror horizontal and rotate 270 CW return function (x, y) { return [y, x]; }; - case 6: // Rotate 90 CW return function (x, y) { return [y, h - x - 1]; }; - case 7: // Mirror horizontal and rotate 90 CW return function (x, y) { return [w - y - 1, h - x - 1]; }; - case 8: // Rotate 270 CW return function (x, y) { return [w - y - 1, x]; }; - default: return null; } } + /* * Transforms bitmap in place (moves pixels around) according to given * transformation function. @@ -134,111 +111,87 @@ function getExifOrientationTransformation(img) { * the source bitmap, i.e. has following form: * `function(new_x, new_y) { return [src_x, src_y] }`. */ - - function transformBitmap(img, width, height, transformation) { // Underscore-prefixed values are related to the source bitmap // Their counterparts with no prefix are related to the target bitmap - var _data = img.bitmap.data; - var _width = img.bitmap.width; - var data = Buffer.alloc(_data.length); - - for (var x = 0; x < width; x++) { - for (var y = 0; y < height; y++) { - var _transformation = transformation(x, y), - _transformation2 = (0, _slicedToArray2["default"])(_transformation, 2), - _x = _transformation2[0], - _y = _transformation2[1]; - - var idx = width * y + x << 2; - - var _idx = _width * _y + _x << 2; - - var pixel = _data.readUInt32BE(_idx); - + const _data = img.bitmap.data; + const _width = img.bitmap.width; + const data = Buffer.alloc(_data.length); + for (let x = 0; x < width; x++) { + for (let y = 0; y < height; y++) { + const [_x, _y] = transformation(x, y); + const idx = width * y + x << 2; + const _idx = _width * _y + _x << 2; + const pixel = _data.readUInt32BE(_idx); data.writeUInt32BE(pixel, idx); } } - img.bitmap.data = data; img.bitmap.width = width; img.bitmap.height = height; } + /* * Automagically rotates an image based on its EXIF data (if present). * @param img {Jimp} a Jimp image object */ - - function exifRotate(img) { if (getExifOrientation(img) < 2) return; - var transformation = getExifOrientationTransformation(img); - var swapDimensions = getExifOrientation(img) > 4; - var newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width; - var newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height; + const transformation = getExifOrientationTransformation(img); + const swapDimensions = getExifOrientation(img) > 4; + const newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width; + const newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height; transformBitmap(img, newWidth, newHeight, transformation); -} // parses a bitmap from the constructor to the JIMP bitmap property - - -function parseBitmap(data, path, cb) { - var mime = getMIMEFromBuffer(data, path); +} - if (typeof mime !== 'string') { - return cb(new Error('Could not find MIME for Buffer <' + path + '>')); +// parses a bitmap from the constructor to the JIMP bitmap property +async function parseBitmap(data, path, cb) { + const mime = await getMIMEFromBuffer(data, path); + if (typeof mime !== "string") { + return cb(new Error("Could not find MIME for Buffer <" + path + ">")); } - this._originalMime = mime.toLowerCase(); - try { - var _mime = this.getMIME(); - - if (this.constructor.decoders[_mime]) { - this.bitmap = this.constructor.decoders[_mime](data); + const mime = this.getMIME(); + if (this.constructor.decoders[mime]) { + this.bitmap = this.constructor.decoders[mime](data); } else { - return _utils.throwError.call(this, 'Unsupported MIME type: ' + _mime, cb); + return _utils.throwError.call(this, "Unsupported MIME type: " + mime, cb); } } catch (error) { return cb.call(this, error, this); } - try { - this._exif = _exifParser["default"].create(data).parse(); + this._exif = _exifParser.default.create(data).parse(); exifRotate(this); // EXIF data } catch (error) { /* meh */ } - cb.call(this, null, this); return this; } - function compositeBitmapOverBackground(Jimp, image) { return new Jimp(image.bitmap.width, image.bitmap.height, image._background).composite(image, 0, 0).bitmap; } + /** * Converts the image to a buffer - * @param {string} mime the mime type of the image buffer to be created + * @param {(string|number)} mime the mime type of the image buffer to be created * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument * @returns {Jimp} this for chaining of methods */ - - function getBuffer(mime, cb) { if (mime === constants.AUTO) { // allow auto MIME detection mime = this.getMIME(); } - - if (typeof mime !== 'string') { - return _utils.throwError.call(this, 'mime must be a string', cb); + if (typeof mime !== "string") { + return _utils.throwError.call(this, "mime must be a string", cb); } - - if (typeof cb !== 'function') { - return _utils.throwError.call(this, 'cb must be a function', cb); + if (typeof cb !== "function") { + return _utils.throwError.call(this, "cb must be a function", cb); } - mime = mime.toLowerCase(); - if (this._rgba && this.constructor.hasAlpha[mime]) { this.bitmap.data = Buffer.from(this.bitmap.data); } else { @@ -246,18 +199,23 @@ function getBuffer(mime, cb) { // composite onto a new image so that the background shows through alpha channels this.bitmap.data = compositeBitmapOverBackground(this.constructor, this).data; } - if (this.constructor.encoders[mime]) { - var buffer = this.constructor.encoders[mime](this); - cb.call(this, null, buffer); + const buffer = this.constructor.encoders[mime](this); + // Typically, buffers return a string or map. However, the gif library "gifwrap" seemingly returns promises. + if (buffer instanceof Promise) { + // trigger the callback when the promise has been resolved + buffer.then(buff => { + cb.call(this, null, buff); + }); + } else { + cb.call(this, null, buffer); + } } else { - cb.call(this, 'Unsupported MIME type: ' + mime); + return _utils.throwError.call(this, "Unsupported MIME type: " + mime, cb); } - return this; } - function getBufferAsync(mime) { - return (0, _promisify["default"])(getBuffer, this, mime); + return (0, _promisify.default)(getBuffer, this, mime); } //# sourceMappingURL=image-bitmap.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/utils/image-bitmap.js.map b/project starter code/node_modules/@jimp/core/dist/utils/image-bitmap.js.map index dc78d9d8..bc894229 100644 --- a/project starter code/node_modules/@jimp/core/dist/utils/image-bitmap.js.map +++ b/project starter code/node_modules/@jimp/core/dist/utils/image-bitmap.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../src/utils/image-bitmap.js"],"names":["getMIMEFromBuffer","buffer","path","fileTypeFromBuffer","mime","MIME","getType","getExifOrientation","img","_exif","tags","Orientation","getExifOrientationTransformation","w","getWidth","h","getHeight","x","y","transformBitmap","width","height","transformation","_data","bitmap","data","_width","Buffer","alloc","length","_x","_y","idx","_idx","pixel","readUInt32BE","writeUInt32BE","exifRotate","swapDimensions","newWidth","newHeight","parseBitmap","cb","Error","_originalMime","toLowerCase","getMIME","constructor","decoders","throwError","call","error","EXIFParser","create","parse","compositeBitmapOverBackground","Jimp","image","_background","composite","getBuffer","constants","AUTO","_rgba","hasAlpha","from","encoders","getBufferAsync"],"mappings":";;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AAEA,SAASA,iBAAT,CAA2BC,MAA3B,EAAmCC,IAAnC,EAAyC;AACvC,MAAMC,kBAAkB,GAAG,0BAASF,MAAT,CAA3B;;AAEA,MAAIE,kBAAJ,EAAwB;AACtB;AACA,WAAOA,kBAAkB,CAACC,IAA1B;AACD;;AAED,MAAIF,IAAJ,EAAU;AACR;AACA;AACA,WAAOG,IAAI,CAACC,OAAL,CAAaJ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,CAAgB,IAAhB,EAAsB,uBAAtB,EAA+CR,EAA/C,CAAP;AACD;;AAED,MAAI,OAAOA,EAAP,KAAc,UAAlB,EAA8B;AAC5B,WAAOO,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,uBAAtB,EAA+CR,EAA/C,CAAP;AACD;;AAEDtC,EAAAA,IAAI,GAAGA,IAAI,CAACyC,WAAL,EAAP;;AAEA,MAAI,KAAKkB,KAAL,IAAc,KAAKhB,WAAL,CAAiBiB,QAAjB,CAA0B5D,IAA1B,CAAlB,EAAmD;AACjD,SAAKoB,MAAL,CAAYC,IAAZ,GAAmBE,MAAM,CAACsC,IAAP,CAAY,KAAKzC,MAAL,CAAYC,IAAxB,CAAnB;AACD,GAFD,MAEO;AACL;AACA;AACA,SAAKD,MAAL,CAAYC,IAAZ,GAAmB8B,6BAA6B,CAC9C,KAAKR,WADyC,EAE9C,IAF8C,CAA7B,CAGjBtB,IAHF;AAID;;AAED,MAAI,KAAKsB,WAAL,CAAiBmB,QAAjB,CAA0B9D,IAA1B,CAAJ,EAAqC;AACnC,QAAMH,MAAM,GAAG,KAAK8C,WAAL,CAAiBmB,QAAjB,CAA0B9D,IAA1B,EAAgC,IAAhC,CAAf;AACAsC,IAAAA,EAAE,CAACQ,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoBjD,MAApB;AACD,GAHD,MAGO;AACLyC,IAAAA,EAAE,CAACQ,IAAH,CAAQ,IAAR,EAAc,4BAA4B9C,IAA1C;AACD;;AAED,SAAO,IAAP;AACD;;AAEM,SAAS+D,cAAT,CAAwB/D,IAAxB,EAA8B;AACnC,SAAO,2BAAUwD,SAAV,EAAqB,IAArB,EAA2BxD,IAA3B,CAAP;AACD","sourcesContent":["import fileType from 'file-type';\n\nimport EXIFParser from 'exif-parser';\nimport { throwError } from '@jimp/utils';\n\nimport * as constants from '../constants';\nimport * as MIME from './mime';\nimport promisify from './promisify';\n\nfunction getMIMEFromBuffer(buffer, path) {\n const fileTypeFromBuffer = fileType(buffer);\n\n if (fileTypeFromBuffer) {\n // If fileType returns something for buffer, then return the mime given\n return fileTypeFromBuffer.mime;\n }\n\n if (path) {\n // If a path is supplied, and fileType yields no results, then retry with MIME\n // Path can be either a file path or a url\n return MIME.getType(path);\n }\n\n return null;\n}\n\n/*\n * Obtains image orientation from EXIF metadata.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {number} a number 1-8 representing EXIF orientation,\n * in particular 1 if orientation tag is missing\n */\nfunction getExifOrientation(img) {\n return (img._exif && img._exif.tags && img._exif.tags.Orientation) || 1;\n}\n\n/**\n * Returns a function which translates EXIF-rotated coordinates into\n * non-rotated ones.\n *\n * Transformation reference: http://sylvana.net/jpegcrop/exif_orientation.html.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {function} transformation function for transformBitmap().\n */\nfunction getExifOrientationTransformation(img) {\n const w = img.getWidth();\n const h = img.getHeight();\n\n switch (getExifOrientation(img)) {\n case 1: // Horizontal (normal)\n // does not need to be supported here\n return null;\n\n case 2: // Mirror horizontal\n return function(x, y) {\n return [w - x - 1, y];\n };\n\n case 3: // Rotate 180\n return function(x, y) {\n return [w - x - 1, h - y - 1];\n };\n\n case 4: // Mirror vertical\n return function(x, y) {\n return [x, h - y - 1];\n };\n\n case 5: // Mirror horizontal and rotate 270 CW\n return function(x, y) {\n return [y, x];\n };\n\n case 6: // Rotate 90 CW\n return function(x, y) {\n return [y, h - x - 1];\n };\n\n case 7: // Mirror horizontal and rotate 90 CW\n return function(x, y) {\n return [w - y - 1, h - x - 1];\n };\n\n case 8: // Rotate 270 CW\n return function(x, y) {\n return [w - y - 1, x];\n };\n\n default:\n return null;\n }\n}\n\n/*\n * Transforms bitmap in place (moves pixels around) according to given\n * transformation function.\n *\n * @param img {Jimp} a Jimp image object, which bitmap is supposed to\n * be transformed\n * @param width {number} bitmap width after the transformation\n * @param height {number} bitmap height after the transformation\n * @param transformation {function} transformation function which defines pixel\n * mapping between new and source bitmap. It takes a pair of coordinates\n * in the target, and returns a respective pair of coordinates in\n * the source bitmap, i.e. has following form:\n * `function(new_x, new_y) { return [src_x, src_y] }`.\n */\nfunction transformBitmap(img, width, height, transformation) {\n // Underscore-prefixed values are related to the source bitmap\n // Their counterparts with no prefix are related to the target bitmap\n const _data = img.bitmap.data;\n const _width = img.bitmap.width;\n\n const data = Buffer.alloc(_data.length);\n\n for (let x = 0; x < width; x++) {\n for (let y = 0; y < height; y++) {\n const [_x, _y] = transformation(x, y);\n\n const idx = (width * y + x) << 2;\n const _idx = (_width * _y + _x) << 2;\n\n const pixel = _data.readUInt32BE(_idx);\n data.writeUInt32BE(pixel, idx);\n }\n }\n\n img.bitmap.data = data;\n img.bitmap.width = width;\n img.bitmap.height = height;\n}\n\n/*\n * Automagically rotates an image based on its EXIF data (if present).\n * @param img {Jimp} a Jimp image object\n */\nfunction exifRotate(img) {\n if (getExifOrientation(img) < 2) return;\n\n const transformation = getExifOrientationTransformation(img);\n const swapDimensions = getExifOrientation(img) > 4;\n\n const newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width;\n const newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height;\n\n transformBitmap(img, newWidth, newHeight, transformation);\n}\n\n// parses a bitmap from the constructor to the JIMP bitmap property\nexport function parseBitmap(data, path, cb) {\n const mime = getMIMEFromBuffer(data, path);\n\n if (typeof mime !== 'string') {\n return cb(new Error('Could not find MIME for Buffer <' + path + '>'));\n }\n\n this._originalMime = mime.toLowerCase();\n\n try {\n const mime = this.getMIME();\n\n if (this.constructor.decoders[mime]) {\n this.bitmap = this.constructor.decoders[mime](data);\n } else {\n return throwError.call(this, 'Unsupported MIME type: ' + mime, cb);\n }\n } catch (error) {\n return cb.call(this, error, this);\n }\n\n try {\n this._exif = EXIFParser.create(data).parse();\n exifRotate(this); // EXIF data\n } catch (error) {\n /* meh */\n }\n\n cb.call(this, null, this);\n\n return this;\n}\n\nfunction compositeBitmapOverBackground(Jimp, image) {\n return new Jimp(\n image.bitmap.width,\n image.bitmap.height,\n image._background\n ).composite(image, 0, 0).bitmap;\n}\n\n/**\n * Converts the image to a buffer\n * @param {string} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\nexport function getBuffer(mime, cb) {\n if (mime === constants.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n\n if (typeof mime !== 'string') {\n return throwError.call(this, 'mime must be a string', cb);\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', cb);\n }\n\n mime = mime.toLowerCase();\n\n if (this._rgba && this.constructor.hasAlpha[mime]) {\n this.bitmap.data = Buffer.from(this.bitmap.data);\n } else {\n // when format doesn't support alpha\n // composite onto a new image so that the background shows through alpha channels\n this.bitmap.data = compositeBitmapOverBackground(\n this.constructor,\n this\n ).data;\n }\n\n if (this.constructor.encoders[mime]) {\n const buffer = this.constructor.encoders[mime](this);\n cb.call(this, null, buffer);\n } else {\n cb.call(this, 'Unsupported MIME type: ' + mime);\n }\n\n return this;\n}\n\nexport function getBufferAsync(mime) {\n return promisify(getBuffer, this, mime);\n}\n"],"file":"image-bitmap.js"} \ No newline at end of file +{"version":3,"file":"image-bitmap.js","names":["getMIMEFromBuffer","buffer","path","fileTypeFromBuffer","FileType","fromBuffer","mime","MIME","getType","getExifOrientation","img","_exif","tags","Orientation","getExifOrientationTransformation","w","getWidth","h","getHeight","x","y","transformBitmap","width","height","transformation","_data","bitmap","data","_width","Buffer","alloc","length","_x","_y","idx","_idx","pixel","readUInt32BE","writeUInt32BE","exifRotate","swapDimensions","newWidth","newHeight","parseBitmap","cb","Error","_originalMime","toLowerCase","getMIME","constructor","decoders","throwError","call","error","EXIFParser","create","parse","compositeBitmapOverBackground","Jimp","image","_background","composite","getBuffer","constants","AUTO","_rgba","hasAlpha","from","encoders","Promise","then","buff","getBufferAsync","promisify"],"sources":["../../src/utils/image-bitmap.js"],"sourcesContent":["import FileType from \"file-type\";\n\nimport EXIFParser from \"exif-parser\";\nimport { throwError } from \"@jimp/utils\";\n\nimport * as constants from \"../constants\";\nimport * as MIME from \"./mime\";\nimport promisify from \"./promisify\";\n\nasync function getMIMEFromBuffer(buffer, path) {\n const fileTypeFromBuffer = await FileType.fromBuffer(buffer);\n\n if (fileTypeFromBuffer) {\n // If fileType returns something for buffer, then return the mime given\n return fileTypeFromBuffer.mime;\n }\n\n if (path) {\n // If a path is supplied, and fileType yields no results, then retry with MIME\n // Path can be either a file path or a url\n return MIME.getType(path);\n }\n\n return null;\n}\n\n/*\n * Obtains image orientation from EXIF metadata.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {number} a number 1-8 representing EXIF orientation,\n * in particular 1 if orientation tag is missing\n */\nfunction getExifOrientation(img) {\n return (img._exif && img._exif.tags && img._exif.tags.Orientation) || 1;\n}\n\n/**\n * Returns a function which translates EXIF-rotated coordinates into\n * non-rotated ones.\n *\n * Transformation reference: http://sylvana.net/jpegcrop/exif_orientation.html.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {function} transformation function for transformBitmap().\n */\nfunction getExifOrientationTransformation(img) {\n const w = img.getWidth();\n const h = img.getHeight();\n\n switch (getExifOrientation(img)) {\n case 1: // Horizontal (normal)\n // does not need to be supported here\n return null;\n\n case 2: // Mirror horizontal\n return function (x, y) {\n return [w - x - 1, y];\n };\n\n case 3: // Rotate 180\n return function (x, y) {\n return [w - x - 1, h - y - 1];\n };\n\n case 4: // Mirror vertical\n return function (x, y) {\n return [x, h - y - 1];\n };\n\n case 5: // Mirror horizontal and rotate 270 CW\n return function (x, y) {\n return [y, x];\n };\n\n case 6: // Rotate 90 CW\n return function (x, y) {\n return [y, h - x - 1];\n };\n\n case 7: // Mirror horizontal and rotate 90 CW\n return function (x, y) {\n return [w - y - 1, h - x - 1];\n };\n\n case 8: // Rotate 270 CW\n return function (x, y) {\n return [w - y - 1, x];\n };\n\n default:\n return null;\n }\n}\n\n/*\n * Transforms bitmap in place (moves pixels around) according to given\n * transformation function.\n *\n * @param img {Jimp} a Jimp image object, which bitmap is supposed to\n * be transformed\n * @param width {number} bitmap width after the transformation\n * @param height {number} bitmap height after the transformation\n * @param transformation {function} transformation function which defines pixel\n * mapping between new and source bitmap. It takes a pair of coordinates\n * in the target, and returns a respective pair of coordinates in\n * the source bitmap, i.e. has following form:\n * `function(new_x, new_y) { return [src_x, src_y] }`.\n */\nfunction transformBitmap(img, width, height, transformation) {\n // Underscore-prefixed values are related to the source bitmap\n // Their counterparts with no prefix are related to the target bitmap\n const _data = img.bitmap.data;\n const _width = img.bitmap.width;\n\n const data = Buffer.alloc(_data.length);\n\n for (let x = 0; x < width; x++) {\n for (let y = 0; y < height; y++) {\n const [_x, _y] = transformation(x, y);\n\n const idx = (width * y + x) << 2;\n const _idx = (_width * _y + _x) << 2;\n\n const pixel = _data.readUInt32BE(_idx);\n data.writeUInt32BE(pixel, idx);\n }\n }\n\n img.bitmap.data = data;\n img.bitmap.width = width;\n img.bitmap.height = height;\n}\n\n/*\n * Automagically rotates an image based on its EXIF data (if present).\n * @param img {Jimp} a Jimp image object\n */\nfunction exifRotate(img) {\n if (getExifOrientation(img) < 2) return;\n\n const transformation = getExifOrientationTransformation(img);\n const swapDimensions = getExifOrientation(img) > 4;\n\n const newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width;\n const newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height;\n\n transformBitmap(img, newWidth, newHeight, transformation);\n}\n\n// parses a bitmap from the constructor to the JIMP bitmap property\nexport async function parseBitmap(data, path, cb) {\n const mime = await getMIMEFromBuffer(data, path);\n\n if (typeof mime !== \"string\") {\n return cb(new Error(\"Could not find MIME for Buffer <\" + path + \">\"));\n }\n\n this._originalMime = mime.toLowerCase();\n\n try {\n const mime = this.getMIME();\n\n if (this.constructor.decoders[mime]) {\n this.bitmap = this.constructor.decoders[mime](data);\n } else {\n return throwError.call(this, \"Unsupported MIME type: \" + mime, cb);\n }\n } catch (error) {\n return cb.call(this, error, this);\n }\n\n try {\n this._exif = EXIFParser.create(data).parse();\n exifRotate(this); // EXIF data\n } catch (error) {\n /* meh */\n }\n\n cb.call(this, null, this);\n\n return this;\n}\n\nfunction compositeBitmapOverBackground(Jimp, image) {\n return new Jimp(\n image.bitmap.width,\n image.bitmap.height,\n image._background\n ).composite(image, 0, 0).bitmap;\n}\n\n/**\n * Converts the image to a buffer\n * @param {(string|number)} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\nexport function getBuffer(mime, cb) {\n if (mime === constants.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n\n if (typeof mime !== \"string\") {\n return throwError.call(this, \"mime must be a string\", cb);\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", cb);\n }\n\n mime = mime.toLowerCase();\n\n if (this._rgba && this.constructor.hasAlpha[mime]) {\n this.bitmap.data = Buffer.from(this.bitmap.data);\n } else {\n // when format doesn't support alpha\n // composite onto a new image so that the background shows through alpha channels\n this.bitmap.data = compositeBitmapOverBackground(\n this.constructor,\n this\n ).data;\n }\n\n if (this.constructor.encoders[mime]) {\n const buffer = this.constructor.encoders[mime](this);\n // Typically, buffers return a string or map. However, the gif library \"gifwrap\" seemingly returns promises.\n if (buffer instanceof Promise) {\n // trigger the callback when the promise has been resolved\n buffer.then((buff) => {\n cb.call(this, null, buff);\n });\n } else {\n cb.call(this, null, buffer);\n }\n } else {\n return throwError.call(this, \"Unsupported MIME type: \" + mime, cb);\n }\n\n return this;\n}\n\nexport function getBufferAsync(mime) {\n return promisify(getBuffer, this, mime);\n}\n"],"mappings":";;;;;;;;AAAA;AAEA;AACA;AAEA;AACA;AACA;AAAoC;AAAA;AAAA;AAEpC,eAAeA,iBAAiB,CAACC,MAAM,EAAEC,IAAI,EAAE;EAC7C,MAAMC,kBAAkB,GAAG,MAAMC,iBAAQ,CAACC,UAAU,CAACJ,MAAM,CAAC;EAE5D,IAAIE,kBAAkB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EAEA,OAAO,IAAI;AACb;AAEO,SAAS4B,cAAc,CAAClE,IAAI,EAAE;EACnC,OAAO,IAAAmE,kBAAS,EAACX,SAAS,EAAE,IAAI,EAAExD,IAAI,CAAC;AACzC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/utils/mime.js b/project starter code/node_modules/@jimp/core/dist/utils/mime.js index 9e48085a..9df2f14f 100644 --- a/project starter code/node_modules/@jimp/core/dist/utils/mime.js +++ b/project starter code/node_modules/@jimp/core/dist/utils/mime.js @@ -3,45 +3,32 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.getExtension = exports.getType = exports.addType = void 0; -var mimeTypes = {}; - -var findType = function findType(extension) { - return Object.entries(mimeTypes).find(function (type) { - return type[1].includes(extension); - }) || []; -}; - -var addType = function addType(mime, extensions) { +exports.getType = exports.getExtension = exports.addType = void 0; +const mimeTypes = {}; +const findType = extension => Object.entries(mimeTypes).find(type => type[1].includes(extension)) || []; +const addType = (mime, extensions) => { mimeTypes[mime] = extensions; }; + /** * Lookup a mime type based on extension * @param {string} path path to find extension for * @returns {string} mime found mime type */ - - exports.addType = addType; - -var getType = function getType(path) { - var pathParts = path.split('/').slice(-1); - var extension = pathParts[pathParts.length - 1].split('.').pop(); - var type = findType(extension); +const getType = path => { + const pathParts = path.split("/").slice(-1); + const extension = pathParts[pathParts.length - 1].split(".").pop(); + const type = findType(extension); return type[0]; }; + /** * Return file extension associated with a mime type * @param {string} type mime type to look up * @returns {string} extension file extension */ - - exports.getType = getType; - -var getExtension = function getExtension(type) { - return (mimeTypes[type.toLowerCase()] || [])[0]; -}; - +const getExtension = type => (mimeTypes[type.toLowerCase()] || [])[0]; exports.getExtension = getExtension; //# sourceMappingURL=mime.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/utils/mime.js.map b/project starter code/node_modules/@jimp/core/dist/utils/mime.js.map index 5a3501b1..3fcbc136 100644 --- a/project starter code/node_modules/@jimp/core/dist/utils/mime.js.map +++ b/project starter code/node_modules/@jimp/core/dist/utils/mime.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../src/utils/mime.js"],"names":["mimeTypes","findType","extension","Object","entries","find","type","includes","addType","mime","extensions","getType","path","pathParts","split","slice","length","pop","getExtension","toLowerCase"],"mappings":";;;;;;AAAA,IAAMA,SAAS,GAAG,EAAlB;;AAEA,IAAMC,QAAQ,GAAG,SAAXA,QAAW,CAAAC,SAAS;AAAA,SACxBC,MAAM,CAACC,OAAP,CAAeJ,SAAf,EAA0BK,IAA1B,CAA+B,UAAAC,IAAI;AAAA,WAAIA,IAAI,CAAC,CAAD,CAAJ,CAAQC,QAAR,CAAiBL,SAAjB,CAAJ;AAAA,GAAnC,KAAuE,EAD/C;AAAA,CAA1B;;AAGO,IAAMM,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAAOC,UAAP,EAAsB;AAC3CV,EAAAA,SAAS,CAACS,IAAD,CAAT,GAAkBC,UAAlB;AACD,CAFM;AAIP;;;;;;;;;AAKO,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAAAC,IAAI,EAAI;AAC7B,MAAMC,SAAS,GAAGD,IAAI,CAACE,KAAL,CAAW,GAAX,EAAgBC,KAAhB,CAAsB,CAAC,CAAvB,CAAlB;AACA,MAAMb,SAAS,GAAGW,SAAS,CAACA,SAAS,CAACG,MAAV,GAAmB,CAApB,CAAT,CAAgCF,KAAhC,CAAsC,GAAtC,EAA2CG,GAA3C,EAAlB;AACA,MAAMX,IAAI,GAAGL,QAAQ,CAACC,SAAD,CAArB;AAEA,SAAOI,IAAI,CAAC,CAAD,CAAX;AACD,CANM;AAQP;;;;;;;;;AAKO,IAAMY,YAAY,GAAG,SAAfA,YAAe,CAAAZ,IAAI;AAAA,SAAI,CAACN,SAAS,CAACM,IAAI,CAACa,WAAL,EAAD,CAAT,IAAiC,EAAlC,EAAsC,CAAtC,CAAJ;AAAA,CAAzB","sourcesContent":["const mimeTypes = {};\n\nconst findType = extension =>\n Object.entries(mimeTypes).find(type => type[1].includes(extension)) || [];\n\nexport const addType = (mime, extensions) => {\n mimeTypes[mime] = extensions;\n};\n\n/**\n * Lookup a mime type based on extension\n * @param {string} path path to find extension for\n * @returns {string} mime found mime type\n */\nexport const getType = path => {\n const pathParts = path.split('/').slice(-1);\n const extension = pathParts[pathParts.length - 1].split('.').pop();\n const type = findType(extension);\n\n return type[0];\n};\n\n/**\n * Return file extension associated with a mime type\n * @param {string} type mime type to look up\n * @returns {string} extension file extension\n */\nexport const getExtension = type => (mimeTypes[type.toLowerCase()] || [])[0];\n"],"file":"mime.js"} \ No newline at end of file +{"version":3,"file":"mime.js","names":["mimeTypes","findType","extension","Object","entries","find","type","includes","addType","mime","extensions","getType","path","pathParts","split","slice","length","pop","getExtension","toLowerCase"],"sources":["../../src/utils/mime.js"],"sourcesContent":["const mimeTypes = {};\n\nconst findType = (extension) =>\n Object.entries(mimeTypes).find((type) => type[1].includes(extension)) || [];\n\nexport const addType = (mime, extensions) => {\n mimeTypes[mime] = extensions;\n};\n\n/**\n * Lookup a mime type based on extension\n * @param {string} path path to find extension for\n * @returns {string} mime found mime type\n */\nexport const getType = (path) => {\n const pathParts = path.split(\"/\").slice(-1);\n const extension = pathParts[pathParts.length - 1].split(\".\").pop();\n const type = findType(extension);\n\n return type[0];\n};\n\n/**\n * Return file extension associated with a mime type\n * @param {string} type mime type to look up\n * @returns {string} extension file extension\n */\nexport const getExtension = (type) => (mimeTypes[type.toLowerCase()] || [])[0];\n"],"mappings":";;;;;;AAAA,MAAMA,SAAS,GAAG,CAAC,CAAC;AAEpB,MAAMC,QAAQ,GAAIC,SAAS,IACzBC,MAAM,CAACC,OAAO,CAACJ,SAAS,CAAC,CAACK,IAAI,CAAEC,IAAI,IAAKA,IAAI,CAAC,CAAC,CAAC,CAACC,QAAQ,CAACL,SAAS,CAAC,CAAC,IAAI,EAAE;AAEtE,MAAMM,OAAO,GAAG,CAACC,IAAI,EAAEC,UAAU,KAAK;EAC3CV,SAAS,CAACS,IAAI,CAAC,GAAGC,UAAU;AAC9B,CAAC;;AAED;AACA;AACA;AACA;AACA;AAJA;AAKO,MAAMC,OAAO,GAAIC,IAAI,IAAK;EAC/B,MAAMC,SAAS,GAAGD,IAAI,CAACE,KAAK,CAAC,GAAG,CAAC,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC;EAC3C,MAAMb,SAAS,GAAGW,SAAS,CAACA,SAAS,CAACG,MAAM,GAAG,CAAC,CAAC,CAACF,KAAK,CAAC,GAAG,CAAC,CAACG,GAAG,EAAE;EAClE,MAAMX,IAAI,GAAGL,QAAQ,CAACC,SAAS,CAAC;EAEhC,OAAOI,IAAI,CAAC,CAAC,CAAC;AAChB,CAAC;;AAED;AACA;AACA;AACA;AACA;AAJA;AAKO,MAAMY,YAAY,GAAIZ,IAAI,IAAK,CAACN,SAAS,CAACM,IAAI,CAACa,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/utils/promisify.js b/project starter code/node_modules/@jimp/core/dist/utils/promisify.js index 35223d34..580845d5 100644 --- a/project starter code/node_modules/@jimp/core/dist/utils/promisify.js +++ b/project starter code/node_modules/@jimp/core/dist/utils/promisify.js @@ -3,26 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - -var promisify = function promisify(fun, ctx) { +exports.default = void 0; +const promisify = function (fun, ctx) { for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { args[_key - 2] = arguments[_key]; } - - return new Promise(function (resolve, reject) { - args.push(function (err, data) { + return new Promise((resolve, reject) => { + args.push((err, data) => { if (err) { reject(err); } - resolve(data); }); - fun.bind(ctx).apply(void 0, args); + fun.bind(ctx)(...args); }); }; - var _default = promisify; -exports["default"] = _default; +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=promisify.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/dist/utils/promisify.js.map b/project starter code/node_modules/@jimp/core/dist/utils/promisify.js.map index c72c0c48..ebd7f849 100644 --- a/project starter code/node_modules/@jimp/core/dist/utils/promisify.js.map +++ b/project starter code/node_modules/@jimp/core/dist/utils/promisify.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../src/utils/promisify.js"],"names":["promisify","fun","ctx","args","Promise","resolve","reject","push","err","data","bind"],"mappings":";;;;;;;AAAA,IAAMA,SAAS,GAAG,SAAZA,SAAY,CAACC,GAAD,EAAMC,GAAN;AAAA,oCAAcC,IAAd;AAAcA,IAAAA,IAAd;AAAA;;AAAA,SAChB,IAAIC,OAAJ,CAAY,UAACC,OAAD,EAAUC,MAAV,EAAqB;AAC/BH,IAAAA,IAAI,CAACI,IAAL,CAAU,UAACC,GAAD,EAAMC,IAAN,EAAe;AACvB,UAAID,GAAJ,EAAS;AACPF,QAAAA,MAAM,CAACE,GAAD,CAAN;AACD;;AAEDH,MAAAA,OAAO,CAACI,IAAD,CAAP;AACD,KAND;AAOAR,IAAAA,GAAG,CAACS,IAAJ,CAASR,GAAT,gBAAiBC,IAAjB;AACD,GATD,CADgB;AAAA,CAAlB;;eAYeH,S","sourcesContent":["const promisify = (fun, ctx, ...args) =>\n new Promise((resolve, reject) => {\n args.push((err, data) => {\n if (err) {\n reject(err);\n }\n\n resolve(data);\n });\n fun.bind(ctx)(...args);\n });\n\nexport default promisify;\n"],"file":"promisify.js"} \ No newline at end of file +{"version":3,"file":"promisify.js","names":["promisify","fun","ctx","args","Promise","resolve","reject","push","err","data","bind"],"sources":["../../src/utils/promisify.js"],"sourcesContent":["const promisify = (fun, ctx, ...args) =>\n new Promise((resolve, reject) => {\n args.push((err, data) => {\n if (err) {\n reject(err);\n }\n\n resolve(data);\n });\n fun.bind(ctx)(...args);\n });\n\nexport default promisify;\n"],"mappings":";;;;;;AAAA,MAAMA,SAAS,GAAG,UAACC,GAAG,EAAEC,GAAG;EAAA,kCAAKC,IAAI;IAAJA,IAAI;EAAA;EAAA,OAClC,IAAIC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;IAC/BH,IAAI,CAACI,IAAI,CAAC,CAACC,GAAG,EAAEC,IAAI,KAAK;MACvB,IAAID,GAAG,EAAE;QACPF,MAAM,CAACE,GAAG,CAAC;MACb;MAEAH,OAAO,CAACI,IAAI,CAAC;IACf,CAAC,CAAC;IACFR,GAAG,CAACS,IAAI,CAACR,GAAG,CAAC,CAAC,GAAGC,IAAI,CAAC;EACxB,CAAC,CAAC;AAAA;AAAC,eAEUH,SAAS;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/composite/composite-modes.js b/project starter code/node_modules/@jimp/core/es/composite/composite-modes.js index eee30efd..8ab468eb 100644 --- a/project starter code/node_modules/@jimp/core/es/composite/composite-modes.js +++ b/project starter code/node_modules/@jimp/core/es/composite/composite-modes.js @@ -1,236 +1,209 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.srcOver = srcOver; -exports.dstOver = dstOver; -exports.multiply = multiply; -exports.add = add; -exports.screen = screen; -exports.overlay = overlay; -exports.darken = darken; -exports.lighten = lighten; -exports.hardLight = hardLight; -exports.difference = difference; -exports.exclusion = exclusion; - -function srcOver(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; +export function srcOver(src, dst) { + let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a; - var g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a; - var b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a; + const a = dst.a + src.a - dst.a * src.a; + const r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a; + const g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a; + const b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a; return { - r: r, - g: g, - b: b, - a: a + r, + g, + b, + a }; } - -function dstOver(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; +export function dstOver(src, dst) { + let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a; - var g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a; - var b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a; + const a = dst.a + src.a - dst.a * src.a; + const r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a; + const g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a; + const b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a; return { - r: r, - g: g, - b: b, - a: a + r, + g, + b, + a }; } - -function multiply(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; +export function multiply(src, dst) { + let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; + const g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; + const b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; return { - r: r, - g: g, - b: b, - a: a + r, + g, + b, + a }; } - -function add(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; +export function add(src, dst) { + let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra + dra) / a; - var g = (sga + dga) / a; - var b = (sba + dba) / a; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (sra + dra) / a; + const g = (sga + dga) / a; + const b = (sba + dba) / a; return { - r: r, - g: g, - b: b, - a: a + r, + g, + b, + a }; } - -function screen(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; +export function screen(src, dst) { + let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra * dst.a + dra * src.a - sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (sga * dst.a + dga * src.a - sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (sba * dst.a + dba * src.a - sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (sra * dst.a + dra * src.a - sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; + const g = (sga * dst.a + dga * src.a - sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; + const b = (sba * dst.a + dba * src.a - sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; return { - r: r, - g: g, - b: b, - a: a + r, + g, + b, + a }; } - -function overlay(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; +export function overlay(src, dst) { + let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (2 * dra <= dst.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a; - var g = (2 * dga <= dst.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a; - var b = (2 * dba <= dst.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (2 * dra <= dst.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a; + const g = (2 * dga <= dst.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a; + const b = (2 * dba <= dst.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a; return { - r: r, - g: g, - b: b, - a: a + r, + g, + b, + a }; } - -function darken(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; +export function darken(src, dst) { + let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (Math.min(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (Math.min(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (Math.min(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (Math.min(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a; + const g = (Math.min(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a; + const b = (Math.min(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a; return { - r: r, - g: g, - b: b, - a: a + r, + g, + b, + a }; } - -function lighten(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; +export function lighten(src, dst) { + let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (Math.max(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (Math.max(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (Math.max(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (Math.max(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a; + const g = (Math.max(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a; + const b = (Math.max(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a; return { - r: r, - g: g, - b: b, - a: a + r, + g, + b, + a }; } - -function hardLight(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; +export function hardLight(src, dst) { + let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (2 * sra <= src.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a; - var g = (2 * sga <= src.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a; - var b = (2 * sba <= src.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (2 * sra <= src.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a; + const g = (2 * sga <= src.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a; + const b = (2 * sba <= src.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a; return { - r: r, - g: g, - b: b, - a: a + r, + g, + b, + a }; } - -function difference(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; +export function difference(src, dst) { + let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a; - var g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a; - var b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a; + const g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a; + const b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a; return { - r: r, - g: g, - b: b, - a: a + r, + g, + b, + a }; } - -function exclusion(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; +export function exclusion(src, dst) { + let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra * dst.a + dra * src.a - 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (sga * dst.a + dga * src.a - 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (sba * dst.a + dba * src.a - 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; + const a = dst.a + src.a - dst.a * src.a; + const sra = src.r * src.a; + const sga = src.g * src.a; + const sba = src.b * src.a; + const dra = dst.r * dst.a; + const dga = dst.g * dst.a; + const dba = dst.b * dst.a; + const r = (sra * dst.a + dra * src.a - 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; + const g = (sga * dst.a + dga * src.a - 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; + const b = (sba * dst.a + dba * src.a - 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; return { - r: r, - g: g, - b: b, - a: a + r, + g, + b, + a }; } //# sourceMappingURL=composite-modes.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/composite/composite-modes.js.map b/project starter code/node_modules/@jimp/core/es/composite/composite-modes.js.map index 2d24ac88..89d703c6 100644 --- a/project starter code/node_modules/@jimp/core/es/composite/composite-modes.js.map +++ b/project starter code/node_modules/@jimp/core/es/composite/composite-modes.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../src/composite/composite-modes.js"],"names":["srcOver","src","dst","ops","a","r","g","b","dstOver","multiply","sra","sga","sba","dra","dga","dba","add","screen","overlay","darken","Math","min","lighten","max","hardLight","difference","exclusion"],"mappings":";;;;;;;;;;;;;;;;;AAAO,SAASA,OAAT,CAAiBC,GAAjB,EAAsBC,GAAtB,EAAoC;AAAA,MAATC,GAAS,uEAAH,CAAG;AACzCF,EAAAA,GAAG,CAACG,CAAJ,IAASD,GAAT;AAEA,MAAMC,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AAF;AAAKC,IAAAA,CAAC,EAADA,CAAL;AAAQC,IAAAA,CAAC,EAADA,CAAR;AAAWH,IAAAA,CAAC,EAADA;AAAX,GAAP;AACD","sourcesContent":["export function srcOver(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a;\n const g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a;\n const b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function dstOver(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a;\n const g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a;\n const b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function multiply(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;\n const g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;\n const b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function add(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra + dra) / a;\n const g = (sga + dga) / a;\n const b = (sba + dba) / a;\n\n return { r, g, b, a };\n}\n\nexport function screen(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (sra * dst.a +\n dra * src.a -\n sra * dra +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (sga * dst.a +\n dga * src.a -\n sga * dga +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (sba * dst.a +\n dba * src.a -\n sba * dba +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function overlay(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (2 * dra <= dst.a\n ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)\n : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) /\n a;\n\n const g =\n (2 * dga <= dst.a\n ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)\n : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) /\n a;\n\n const b =\n (2 * dba <= dst.a\n ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)\n : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function darken(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (Math.min(sra * dst.a, dra * src.a) +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (Math.min(sga * dst.a, dga * src.a) +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (Math.min(sba * dst.a, dba * src.a) +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function lighten(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (Math.max(sra * dst.a, dra * src.a) +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (Math.max(sga * dst.a, dga * src.a) +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (Math.max(sba * dst.a, dba * src.a) +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function hardLight(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (2 * sra <= src.a\n ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)\n : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) /\n a;\n\n const g =\n (2 * sga <= src.a\n ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)\n : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) /\n a;\n\n const b =\n (2 * sba <= src.a\n ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)\n : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function difference(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a;\n const g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a;\n const b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function exclusion(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (sra * dst.a +\n dra * src.a -\n 2 * sra * dra +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (sga * dst.a +\n dga * src.a -\n 2 * sga * dga +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (sba * dst.a +\n dba * src.a -\n 2 * sba * dba +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n"],"file":"composite-modes.js"} \ No newline at end of file +{"version":3,"file":"composite-modes.js","names":["srcOver","src","dst","ops","a","r","g","b","dstOver","multiply","sra","sga","sba","dra","dga","dba","add","screen","overlay","darken","Math","min","lighten","max","hardLight","difference","exclusion"],"sources":["../../src/composite/composite-modes.js"],"sourcesContent":["export function srcOver(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a;\n const g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a;\n const b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function dstOver(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a;\n const g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a;\n const b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function multiply(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;\n const g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;\n const b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function add(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra + dra) / a;\n const g = (sga + dga) / a;\n const b = (sba + dba) / a;\n\n return { r, g, b, a };\n}\n\nexport function screen(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (sra * dst.a +\n dra * src.a -\n sra * dra +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (sga * dst.a +\n dga * src.a -\n sga * dga +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (sba * dst.a +\n dba * src.a -\n sba * dba +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function overlay(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (2 * dra <= dst.a\n ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)\n : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) /\n a;\n\n const g =\n (2 * dga <= dst.a\n ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)\n : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) /\n a;\n\n const b =\n (2 * dba <= dst.a\n ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)\n : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function darken(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (Math.min(sra * dst.a, dra * src.a) +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (Math.min(sga * dst.a, dga * src.a) +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (Math.min(sba * dst.a, dba * src.a) +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function lighten(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (Math.max(sra * dst.a, dra * src.a) +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (Math.max(sga * dst.a, dga * src.a) +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (Math.max(sba * dst.a, dba * src.a) +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function hardLight(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (2 * sra <= src.a\n ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)\n : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) /\n a;\n\n const g =\n (2 * sga <= src.a\n ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)\n : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) /\n a;\n\n const b =\n (2 * sba <= src.a\n ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)\n : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) /\n a;\n\n return { r, g, b, a };\n}\n\nexport function difference(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a;\n const g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a;\n const b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a;\n\n return { r, g, b, a };\n}\n\nexport function exclusion(src, dst, ops = 1) {\n src.a *= ops;\n\n const a = dst.a + src.a - dst.a * src.a;\n\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n\n const r =\n (sra * dst.a +\n dra * src.a -\n 2 * sra * dra +\n sra * (1 - dst.a) +\n dra * (1 - src.a)) /\n a;\n const g =\n (sga * dst.a +\n dga * src.a -\n 2 * sga * dga +\n sga * (1 - dst.a) +\n dga * (1 - src.a)) /\n a;\n const b =\n (sba * dst.a +\n dba * src.a -\n 2 * sba * dba +\n sba * (1 - dst.a) +\n dba * (1 - src.a)) /\n a;\n\n return { r, g, b, a };\n}\n"],"mappings":"AAAA,OAAO,SAASA,OAAO,CAACC,GAAG,EAAEC,GAAG,EAAW;EAAA,IAATC,GAAG,uEAAG,CAAC;EACvCF,GAAG,CAACG,CAAC,IAAID,GAAG;EAEZ,MAAMC,CAAC,GAAGF,GAAG,CAACE,CAAC,GAAGH,GAAG,CAACG,CAAC,GAAGF,GAAG,CAACE,CAAC,GAAGH,GAAG,CAACG,CAAC;EAEvC,MAAMC,CAAC,GAAG,CAACJ,GAAG,CAACI,CAAC,GAAGJ,GAAG,CAACG,CAAC,GAAGF,GAAG,CAACG,CAAC,GAAGH,GAAG,CAACE,CAAC,IAAI,CAAC,GAAGH,GAAG,CAACG,CAAC,CAAC,IAAIA,CAAC;EAC3D,MAAME,CAAC,GAAG,CAACL,GAAG,CAACK,CAAC,GAAGL,GAAG,CAACG,CAAC,GAAGF,GAAG,CAACI,CAAC,GAAGJ,GAAG,CAACE,CAAC,IAAI,CAAC,GAAGH,GAAG,CAACG,CAAC,CAAC,IAAIA,CAAC;EAC3D,MAAMG,CAAC,GAAG,CAACN,GAAG,CAACM,CAAC,GAAGN,GAAG,CAACG,CAAC,GAAGF,GAAG,CAACK,CAAC,GAAGL,GAAG,CAACE,CAAC,IAAI,CAAC,GAAGH,GA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GAAG,CAACK,CAAC,GAAGL,GAAG,CAACG,CAAC;EACzB,MAAMQ,GAAG,GAAGX,GAAG,CAACM,CAAC,GAAGN,GAAG,CAACG,CAAC;EAEzB,MAAMS,GAAG,GAAGX,GAAG,CAACG,CAAC,GAAGH,GAAG,CAACE,CAAC;EACzB,MAAMU,GAAG,GAAGZ,GAAG,CAACI,CAAC,GAAGJ,GAAG,CAACE,CAAC;EACzB,MAAMW,GAAG,GAAGb,GAAG,CAACK,CAAC,GAAGL,GAAG,CAACE,CAAC;EAEzB,MAAMC,CAAC,GACL,CAACK,GAAG,GAAGR,GAAG,CAACE,CAAC,GACVS,GAAG,GAAGZ,GAAG,CAACG,CAAC,GACX,CAAC,GAAGM,GAAG,GAAGG,GAAG,GACbH,GAAG,IAAI,CAAC,GAAGR,GAAG,CAACE,CAAC,CAAC,GACjBS,GAAG,IAAI,CAAC,GAAGZ,GAAG,CAACG,CAAC,CAAC,IACnBA,CAAC;EACH,MAAME,CAAC,GACL,CAACK,GAAG,GAAGT,GAAG,CAACE,CAAC,GACVU,GAAG,GAAGb,GAAG,CAACG,CAAC,GACX,CAAC,GAAGO,GAAG,GAAGG,GAAG,GACbH,GAAG,IAAI,CAAC,GAAGT,GAAG,CAACE,CAAC,CAAC,GACjBU,GAAG,IAAI,CAAC,GAAGb,GAAG,CAACG,CAAC,CAAC,IACnBA,CAAC;EACH,MAAMG,CAAC,GACL,CAACK,GAAG,GAAGV,GAAG,CAACE,CAAC,GACVW,GAAG,GAAGd,GAAG,CAACG,CAAC,GACX,CAAC,GAAGQ,GAAG,GAAGG,GAAG,GACbH,GAAG,IAAI,CAAC,GAAGV,GAAG,CAACE,CAAC,CAAC,GACjBW,GAAG,IAAI,CAAC,GAAGd,GAAG,CAACG,CAAC,CAAC,IACnBA,CAAC;EAEH,OAAO;IAAEC,CAAC;IAAEC,CAAC;IAAEC,CAAC;IAAEH;EAAE,CAAC;AACvB"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/composite/index.js b/project starter code/node_modules/@jimp/core/es/composite/index.js index cd3165d7..2b4748e0 100644 --- a/project starter code/node_modules/@jimp/core/es/composite/index.js +++ b/project starter code/node_modules/@jimp/core/es/composite/index.js @@ -1,17 +1,6 @@ -"use strict"; - -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = composite; - -var _utils = require("@jimp/utils"); - -var constants = _interopRequireWildcard(require("../constants")); - -var compositeModes = _interopRequireWildcard(require("./composite-modes")); +import { isNodePattern, throwError } from "@jimp/utils"; +import * as constants from "../constants"; +import * as compositeModes from "./composite-modes"; /** * Composites a source image over to this image respecting alpha channels @@ -22,53 +11,51 @@ var compositeModes = _interopRequireWildcard(require("./composite-modes")); * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ -function composite(src, x, y) { - var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; - var cb = arguments.length > 4 ? arguments[4] : undefined; - - if (typeof options === 'function') { +export default function composite(src, x, y) { + let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + let cb = arguments.length > 4 ? arguments[4] : undefined; + if (typeof options === "function") { cb = options; options = {}; } - if (!(src instanceof this.constructor)) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); + return throwError.call(this, "The source must be a Jimp image", cb); } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); + if (typeof x !== "number" || typeof y !== "number") { + return throwError.call(this, "x and y must be numbers", cb); } - - var _options = options, - mode = _options.mode, - opacitySource = _options.opacitySource, - opacityDest = _options.opacityDest; - + let { + mode, + opacitySource, + opacityDest + } = options; if (!mode) { mode = constants.BLEND_SOURCE_OVER; } - - if (typeof opacitySource !== 'number' || opacitySource < 0 || opacitySource > 1) { + if (typeof opacitySource !== "number" || opacitySource < 0 || opacitySource > 1) { opacitySource = 1.0; } - - if (typeof opacityDest !== 'number' || opacityDest < 0 || opacityDest > 1) { + if (typeof opacityDest !== "number" || opacityDest < 0 || opacityDest > 1) { opacityDest = 1.0; } - var blendmode = compositeModes[mode]; // round input + // eslint-disable-next-line import/namespace + const blendmode = compositeModes[mode]; + // round input x = Math.round(x); y = Math.round(y); - var baseImage = this; - + const baseImage = this; if (opacityDest !== 1.0) { baseImage.opacity(opacityDest); } - src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) { - var dstIdx = baseImage.getPixelIndex(x + sx, y + sy, constants.EDGE_CROP); - var blended = blendmode({ + const dstIdx = baseImage.getPixelIndex(x + sx, y + sy, constants.EDGE_CROP); + if (dstIdx === -1) { + // Skip target pixels outside of dst + return; + } + const blended = blendmode({ r: this.bitmap.data[idx + 0] / 255, g: this.bitmap.data[idx + 1] / 255, b: this.bitmap.data[idx + 2] / 255, @@ -84,11 +71,9 @@ function composite(src, x, y) { baseImage.bitmap.data[dstIdx + 2] = this.constructor.limit255(blended.b * 255); baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(blended.a * 255); }); - - if ((0, _utils.isNodePattern)(cb)) { + if (isNodePattern(cb)) { cb.call(this, null, this); } - return this; } //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/composite/index.js.map b/project starter code/node_modules/@jimp/core/es/composite/index.js.map index 290d15ef..3629f6f1 100644 --- a/project starter code/node_modules/@jimp/core/es/composite/index.js.map +++ b/project starter code/node_modules/@jimp/core/es/composite/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../src/composite/index.js"],"names":["composite","src","x","y","options","cb","constructor","throwError","call","mode","opacitySource","opacityDest","constants","BLEND_SOURCE_OVER","blendmode","compositeModes","Math","round","baseImage","opacity","scanQuiet","bitmap","width","height","sx","sy","idx","dstIdx","getPixelIndex","EDGE_CROP","blended","r","data","g","b","a","limit255"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEA;;AAEA;;;;;;;;;AASe,SAASA,S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A,CAAC,EAAEjB,SAAS,CAACG,MAAV,CAAiBW,IAAjB,CAAsBL,MAAM,GAAG,CAA/B,IAAoC;AAJzC,KAPuB,EAavBjB,aAbuB,CAAzB;AAgBAQ,IAAAA,SAAS,CAACG,MAAV,CAAiBW,IAAjB,CAAsBL,MAAM,GAAG,CAA/B,IAAoC,KAAKrB,WAAL,CAAiB8B,QAAjB,CAClCN,OAAO,CAACC,CAAR,GAAY,GADsB,CAApC;AAGAb,IAAAA,SAAS,CAACG,MAAV,CAAiBW,IAAjB,CAAsBL,MAAM,GAAG,CAA/B,IAAoC,KAAKrB,WAAL,CAAiB8B,QAAjB,CAClCN,OAAO,CAACG,CAAR,GAAY,GADsB,CAApC;AAGAf,IAAAA,SAAS,CAACG,MAAV,CAAiBW,IAAjB,CAAsBL,MAAM,GAAG,CAA/B,IAAoC,KAAKrB,WAAL,CAAiB8B,QAAjB,CAClCN,OAAO,CAACI,CAAR,GAAY,GADsB,CAApC;AAGAhB,IAAAA,SAAS,CAACG,MAAV,CAAiBW,IAAjB,CAAsBL,MAAM,GAAG,CAA/B,IAAoC,KAAKrB,WAAL,CAAiB8B,QAAjB,CAClCN,OAAO,CAACK,CAAR,GAAY,GADsB,CAApC;AAGD,GAlCD;;AAoCA,MAAI,0BAAc9B,EAAd,CAAJ,EAAuB;AACrBA,IAAAA,EAAE,CAACG,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,SAAO,IAAP;AACD","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\nimport * as constants from '../constants';\n\nimport * as compositeModes from './composite-modes';\n\n/**\n * Composites a source image over to this image respecting alpha channels\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {object} options determine what mode to use\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default function composite(src, x, y, options = {}, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n let { mode, opacitySource, opacityDest } = options;\n\n if (!mode) {\n mode = constants.BLEND_SOURCE_OVER;\n }\n\n if (\n typeof opacitySource !== 'number' ||\n opacitySource < 0 ||\n opacitySource > 1\n ) {\n opacitySource = 1.0;\n }\n\n if (typeof opacityDest !== 'number' || opacityDest < 0 || opacityDest > 1) {\n opacityDest = 1.0;\n }\n\n const blendmode = compositeModes[mode];\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const baseImage = this;\n\n if (opacityDest !== 1.0) {\n baseImage.opacity(opacityDest);\n }\n\n src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function(\n sx,\n sy,\n idx\n ) {\n const dstIdx = baseImage.getPixelIndex(x + sx, y + sy, constants.EDGE_CROP);\n const blended = blendmode(\n {\n r: this.bitmap.data[idx + 0] / 255,\n g: this.bitmap.data[idx + 1] / 255,\n b: this.bitmap.data[idx + 2] / 255,\n a: this.bitmap.data[idx + 3] / 255\n },\n {\n r: baseImage.bitmap.data[dstIdx + 0] / 255,\n g: baseImage.bitmap.data[dstIdx + 1] / 255,\n b: baseImage.bitmap.data[dstIdx + 2] / 255,\n a: baseImage.bitmap.data[dstIdx + 3] / 255\n },\n opacitySource\n );\n\n baseImage.bitmap.data[dstIdx + 0] = this.constructor.limit255(\n blended.r * 255\n );\n baseImage.bitmap.data[dstIdx + 1] = this.constructor.limit255(\n blended.g * 255\n );\n baseImage.bitmap.data[dstIdx + 2] = this.constructor.limit255(\n blended.b * 255\n );\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(\n blended.a * 255\n );\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["isNodePattern","throwError","constants","compositeModes","composite","src","x","y","options","cb","constructor","call","mode","opacitySource","opacityDest","BLEND_SOURCE_OVER","blendmode","Math","round","baseImage","opacity","scanQuiet","bitmap","width","height","sx","sy","idx","dstIdx","getPixelIndex","EDGE_CROP","blended","r","data","g","b","a","limit255"],"sources":["../../src/composite/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\nimport * as constants from \"../constants\";\n\nimport * as compositeModes from \"./composite-modes\";\n\n/**\n * Composites a source image over to this image respecting alpha channels\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {object} options determine what mode to use\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default function composite(src, x, y, options = {}, cb) {\n if (typeof options === \"function\") {\n cb = options;\n options = {};\n }\n\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n let { mode, opacitySource, opacityDest } = options;\n\n if (!mode) {\n mode = constants.BLEND_SOURCE_OVER;\n }\n\n if (\n typeof opacitySource !== \"number\" ||\n opacitySource < 0 ||\n opacitySource > 1\n ) {\n opacitySource = 1.0;\n }\n\n if (typeof opacityDest !== \"number\" || opacityDest < 0 || opacityDest > 1) {\n opacityDest = 1.0;\n }\n\n // eslint-disable-next-line import/namespace\n const blendmode = compositeModes[mode];\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const baseImage = this;\n\n if (opacityDest !== 1.0) {\n baseImage.opacity(opacityDest);\n }\n\n src.scanQuiet(\n 0,\n 0,\n src.bitmap.width,\n src.bitmap.height,\n function (sx, sy, idx) {\n const dstIdx = baseImage.getPixelIndex(\n x + sx,\n y + sy,\n constants.EDGE_CROP\n );\n\n if (dstIdx === -1) {\n // Skip target pixels outside of dst\n return;\n }\n\n const blended = blendmode(\n {\n r: this.bitmap.data[idx + 0] / 255,\n g: this.bitmap.data[idx + 1] / 255,\n b: this.bitmap.data[idx + 2] / 255,\n a: this.bitmap.data[idx + 3] / 255,\n },\n {\n r: baseImage.bitmap.data[dstIdx + 0] / 255,\n g: baseImage.bitmap.data[dstIdx + 1] / 255,\n b: baseImage.bitmap.data[dstIdx + 2] / 255,\n a: baseImage.bitmap.data[dstIdx + 3] / 255,\n },\n opacitySource\n );\n\n baseImage.bitmap.data[dstIdx + 0] = this.constructor.limit255(\n blended.r * 255\n );\n baseImage.bitmap.data[dstIdx + 1] = this.constructor.limit255(\n blended.g * 255\n );\n baseImage.bitmap.data[dstIdx + 2] = this.constructor.limit255(\n blended.b * 255\n );\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(\n blended.a * 255\n );\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,aAAa;AACvD,OAAO,KAAKC,SAAS,MAAM,cAAc;AAEzC,OAAO,KAAKC,cAAc,MAAM,mBAAmB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,SAAS,CAACC,GAAG,EAAEC,CAAC,EAAEC,CAAC,EAAoB;EAAA,IAAlBC,OAAO,uEAAG,CAAC,CAAC;EAAA,IAAEC,EAAE;EAC3D,IAAI,OAAOD,OAAO,KAAK,UAAU,EAAE;IACjCC,EAAE,GAAGD,OAAO;IACZA,OAAO,GAAG,CAAC,CAAC;EACd;EAEA,IAAI,EAAEH,GAAG,YAAY,IAAI,CAACK,WAAW,CAAC,EAAE;IACtC,OAAOT,UAAU,CAACU,IAAI,CAAC,IAAI,EAAE,iCAAiC,EAAEF,EAAE,CAAC;EACrE;EAEA,IAAI,OAAOH,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAAE;IAClD,OAAON,UAAU,CAACU,IAAI,CAAC,IAAI,EAA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AW,CAAC2B,QAAQ,CAC3DN,OAAO,CAACK,CAAC,GAAG,GAAG,CAChB;EACH,CAAC,CACF;EAED,IAAIpC,aAAa,CAACS,EAAE,CAAC,EAAE;IACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;EAC3B;EAEA,OAAO,IAAI;AACb"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/constants.js b/project starter code/node_modules/@jimp/core/es/constants.js index cc86acb3..0fd9babf 100644 --- a/project starter code/node_modules/@jimp/core/es/constants.js +++ b/project starter code/node_modules/@jimp/core/es/constants.js @@ -1,53 +1,29 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.EDGE_CROP = exports.EDGE_WRAP = exports.EDGE_EXTEND = exports.BLEND_EXCLUSION = exports.BLEND_DIFFERENCE = exports.BLEND_HARDLIGHT = exports.BLEND_LIGHTEN = exports.BLEND_DARKEN = exports.BLEND_OVERLAY = exports.BLEND_SCREEN = exports.BLEND_ADD = exports.BLEND_MULTIPLY = exports.BLEND_DESTINATION_OVER = exports.BLEND_SOURCE_OVER = exports.VERTICAL_ALIGN_BOTTOM = exports.VERTICAL_ALIGN_MIDDLE = exports.VERTICAL_ALIGN_TOP = exports.HORIZONTAL_ALIGN_RIGHT = exports.HORIZONTAL_ALIGN_CENTER = exports.HORIZONTAL_ALIGN_LEFT = exports.AUTO = void 0; // used to auto resizing etc. -var AUTO = -1; // Align modes for cover, contain, bit masks +export const AUTO = -1; -exports.AUTO = AUTO; -var HORIZONTAL_ALIGN_LEFT = 1; -exports.HORIZONTAL_ALIGN_LEFT = HORIZONTAL_ALIGN_LEFT; -var HORIZONTAL_ALIGN_CENTER = 2; -exports.HORIZONTAL_ALIGN_CENTER = HORIZONTAL_ALIGN_CENTER; -var HORIZONTAL_ALIGN_RIGHT = 4; -exports.HORIZONTAL_ALIGN_RIGHT = HORIZONTAL_ALIGN_RIGHT; -var VERTICAL_ALIGN_TOP = 8; -exports.VERTICAL_ALIGN_TOP = VERTICAL_ALIGN_TOP; -var VERTICAL_ALIGN_MIDDLE = 16; -exports.VERTICAL_ALIGN_MIDDLE = VERTICAL_ALIGN_MIDDLE; -var VERTICAL_ALIGN_BOTTOM = 32; // blend modes +// Align modes for cover, contain, bit masks +export const HORIZONTAL_ALIGN_LEFT = 1; +export const HORIZONTAL_ALIGN_CENTER = 2; +export const HORIZONTAL_ALIGN_RIGHT = 4; +export const VERTICAL_ALIGN_TOP = 8; +export const VERTICAL_ALIGN_MIDDLE = 16; +export const VERTICAL_ALIGN_BOTTOM = 32; -exports.VERTICAL_ALIGN_BOTTOM = VERTICAL_ALIGN_BOTTOM; -var BLEND_SOURCE_OVER = 'srcOver'; -exports.BLEND_SOURCE_OVER = BLEND_SOURCE_OVER; -var BLEND_DESTINATION_OVER = 'dstOver'; -exports.BLEND_DESTINATION_OVER = BLEND_DESTINATION_OVER; -var BLEND_MULTIPLY = 'multiply'; -exports.BLEND_MULTIPLY = BLEND_MULTIPLY; -var BLEND_ADD = 'add'; -exports.BLEND_ADD = BLEND_ADD; -var BLEND_SCREEN = 'screen'; -exports.BLEND_SCREEN = BLEND_SCREEN; -var BLEND_OVERLAY = 'overlay'; -exports.BLEND_OVERLAY = BLEND_OVERLAY; -var BLEND_DARKEN = 'darken'; -exports.BLEND_DARKEN = BLEND_DARKEN; -var BLEND_LIGHTEN = 'lighten'; -exports.BLEND_LIGHTEN = BLEND_LIGHTEN; -var BLEND_HARDLIGHT = 'hardLight'; -exports.BLEND_HARDLIGHT = BLEND_HARDLIGHT; -var BLEND_DIFFERENCE = 'difference'; -exports.BLEND_DIFFERENCE = BLEND_DIFFERENCE; -var BLEND_EXCLUSION = 'exclusion'; // Edge Handling +// blend modes +export const BLEND_SOURCE_OVER = "srcOver"; +export const BLEND_DESTINATION_OVER = "dstOver"; +export const BLEND_MULTIPLY = "multiply"; +export const BLEND_ADD = "add"; +export const BLEND_SCREEN = "screen"; +export const BLEND_OVERLAY = "overlay"; +export const BLEND_DARKEN = "darken"; +export const BLEND_LIGHTEN = "lighten"; +export const BLEND_HARDLIGHT = "hardLight"; +export const BLEND_DIFFERENCE = "difference"; +export const BLEND_EXCLUSION = "exclusion"; -exports.BLEND_EXCLUSION = BLEND_EXCLUSION; -var EDGE_EXTEND = 1; -exports.EDGE_EXTEND = EDGE_EXTEND; -var EDGE_WRAP = 2; -exports.EDGE_WRAP = EDGE_WRAP; -var EDGE_CROP = 3; -exports.EDGE_CROP = EDGE_CROP; +// Edge Handling +export const EDGE_EXTEND = 1; +export const EDGE_WRAP = 2; +export const EDGE_CROP = 3; //# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/constants.js.map b/project starter code/node_modules/@jimp/core/es/constants.js.map index 31fc25ea..c3f0c2f7 100644 --- a/project starter code/node_modules/@jimp/core/es/constants.js.map +++ b/project starter code/node_modules/@jimp/core/es/constants.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/constants.js"],"names":["AUTO","HORIZONTAL_ALIGN_LEFT","HORIZONTAL_ALIGN_CENTER","HORIZONTAL_ALIGN_RIGHT","VERTICAL_ALIGN_TOP","VERTICAL_ALIGN_MIDDLE","VERTICAL_ALIGN_BOTTOM","BLEND_SOURCE_OVER","BLEND_DESTINATION_OVER","BLEND_MULTIPLY","BLEND_ADD","BLEND_SCREEN","BLEND_OVERLAY","BLEND_DARKEN","BLEND_LIGHTEN","BLEND_HARDLIGHT","BLEND_DIFFERENCE","BLEND_EXCLUSION","EDGE_EXTEND","EDGE_WRAP","EDGE_CROP"],"mappings":";;;;;;AAAA;AACO,IAAMA,IAAI,GAAG,CAAC,CAAd,C,CAEP;;;AACO,IAAMC,qBAAqB,GAAG,CAA9B;;AACA,IAAMC,uBAAuB,GAAG,CAAhC;;AACA,IAAMC,sBAAsB,GAAG,CAA/B;;AAEA,IAAMC,kBAAkB,GAAG,CAA3B;;AACA,IAAMC,qBAAqB,GAAG,EAA9B;;AACA,IAAMC,qBAAqB,GAAG,EAA9B,C,CAEP;;;AACO,IAAMC,iBAAiB,GAAG,SAA1B;;AACA,IAAMC,sBAAsB,GAAG,SAA/B;;AACA,IAAMC,cAAc,GAAG,UAAvB;;AACA,IAAMC,SAAS,GAAG,KAAlB;;AACA,IAAMC,YAAY,GAAG,QAArB;;AACA,IAAMC,aAAa,GAAG,SAAtB;;AACA,IAAMC,YAAY,GAAG,QAArB;;AACA,IAAMC,aAAa,GAAG,SAAtB;;AACA,IAAMC,eAAe,GAAG,WAAxB;;AACA,IAAMC,gBAAgB,GAAG,YAAzB;;AACA,IAAMC,eAAe,GAAG,WAAxB,C,CAEP;;;AACO,IAAMC,WAAW,GAAG,CAApB;;AACA,IAAMC,SAAS,GAAG,CAAlB;;AACA,IAAMC,SAAS,GAAG,CAAlB","sourcesContent":["// used to auto resizing etc.\nexport const AUTO = -1;\n\n// Align modes for cover, contain, bit masks\nexport const HORIZONTAL_ALIGN_LEFT = 1;\nexport const HORIZONTAL_ALIGN_CENTER = 2;\nexport const HORIZONTAL_ALIGN_RIGHT = 4;\n\nexport const VERTICAL_ALIGN_TOP = 8;\nexport const VERTICAL_ALIGN_MIDDLE = 16;\nexport const VERTICAL_ALIGN_BOTTOM = 32;\n\n// blend modes\nexport const BLEND_SOURCE_OVER = 'srcOver';\nexport const BLEND_DESTINATION_OVER = 'dstOver';\nexport const BLEND_MULTIPLY = 'multiply';\nexport const BLEND_ADD = 'add';\nexport const BLEND_SCREEN = 'screen';\nexport const BLEND_OVERLAY = 'overlay';\nexport const BLEND_DARKEN = 'darken';\nexport const BLEND_LIGHTEN = 'lighten';\nexport const BLEND_HARDLIGHT = 'hardLight';\nexport const BLEND_DIFFERENCE = 'difference';\nexport const BLEND_EXCLUSION = 'exclusion';\n\n// Edge Handling\nexport const EDGE_EXTEND = 1;\nexport const EDGE_WRAP = 2;\nexport const EDGE_CROP = 3;\n"],"file":"constants.js"} \ No newline at end of file +{"version":3,"file":"constants.js","names":["AUTO","HORIZONTAL_ALIGN_LEFT","HORIZONTAL_ALIGN_CENTER","HORIZONTAL_ALIGN_RIGHT","VERTICAL_ALIGN_TOP","VERTICAL_ALIGN_MIDDLE","VERTICAL_ALIGN_BOTTOM","BLEND_SOURCE_OVER","BLEND_DESTINATION_OVER","BLEND_MULTIPLY","BLEND_ADD","BLEND_SCREEN","BLEND_OVERLAY","BLEND_DARKEN","BLEND_LIGHTEN","BLEND_HARDLIGHT","BLEND_DIFFERENCE","BLEND_EXCLUSION","EDGE_EXTEND","EDGE_WRAP","EDGE_CROP"],"sources":["../src/constants.js"],"sourcesContent":["// used to auto resizing etc.\nexport const AUTO = -1;\n\n// Align modes for cover, contain, bit masks\nexport const HORIZONTAL_ALIGN_LEFT = 1;\nexport const HORIZONTAL_ALIGN_CENTER = 2;\nexport const HORIZONTAL_ALIGN_RIGHT = 4;\n\nexport const VERTICAL_ALIGN_TOP = 8;\nexport const VERTICAL_ALIGN_MIDDLE = 16;\nexport const VERTICAL_ALIGN_BOTTOM = 32;\n\n// blend modes\nexport const BLEND_SOURCE_OVER = \"srcOver\";\nexport const BLEND_DESTINATION_OVER = \"dstOver\";\nexport const BLEND_MULTIPLY = \"multiply\";\nexport const BLEND_ADD = \"add\";\nexport const BLEND_SCREEN = \"screen\";\nexport const BLEND_OVERLAY = \"overlay\";\nexport const BLEND_DARKEN = \"darken\";\nexport const BLEND_LIGHTEN = \"lighten\";\nexport const BLEND_HARDLIGHT = \"hardLight\";\nexport const BLEND_DIFFERENCE = \"difference\";\nexport const BLEND_EXCLUSION = \"exclusion\";\n\n// Edge Handling\nexport const EDGE_EXTEND = 1;\nexport const EDGE_WRAP = 2;\nexport const EDGE_CROP = 3;\n"],"mappings":"AAAA;AACA,OAAO,MAAMA,IAAI,GAAG,CAAC,CAAC;;AAEtB;AACA,OAAO,MAAMC,qBAAqB,GAAG,CAAC;AACtC,OAAO,MAAMC,uBAAuB,GAAG,CAAC;AACxC,OAAO,MAAMC,sBAAsB,GAAG,CAAC;AAEvC,OAAO,MAAMC,kBAAkB,GAAG,CAAC;AACnC,OAAO,MAAMC,qBAAqB,GAAG,EAAE;AACvC,OAAO,MAAMC,qBAAqB,GAAG,EAAE;;AAEvC;AACA,OAAO,MAAMC,iBAAiB,GAAG,SAAS;AAC1C,OAAO,MAAMC,sBAAsB,GAAG,SAAS;AAC/C,OAAO,MAAMC,cAAc,GAAG,UAAU;AACxC,OAAO,MAAMC,SAAS,GAAG,KAAK;AAC9B,OAAO,MAAMC,YAAY,GAAG,QAAQ;AACpC,OAAO,MAAMC,aAAa,GAAG,SAAS;AACtC,OAAO,MAAMC,YAAY,GAAG,QAAQ;AACpC,OAAO,MAAMC,aAAa,GAAG,SAAS;AACtC,OAAO,MAAMC,eAAe,GAAG,WAAW;AAC1C,OAAO,MAAMC,gBAAgB,GAAG,YAAY;AAC5C,OAAO,MAAMC,eAAe,GAAG,WAAW;;AAE1C;AACA,OAAO,MAAMC,WAAW,GAAG,CAAC;AAC5B,OAAO,MAAMC,SAAS,GAAG,CAAC;AAC1B,OAAO,MAAMC,SAAS,GAAG,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/index.js b/project starter code/node_modules/@jimp/core/es/index.js index a656d756..cb4569db 100644 --- a/project starter code/node_modules/@jimp/core/es/index.js +++ b/project starter code/node_modules/@jimp/core/es/index.js @@ -1,165 +1,96 @@ -"use strict"; - -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.addConstants = addConstants; -exports.addJimpMethods = addJimpMethods; -exports.jimpEvMethod = jimpEvMethod; -exports.jimpEvChange = jimpEvChange; -Object.defineProperty(exports, "addType", { - enumerable: true, - get: function get() { - return MIME.addType; - } -}); -exports["default"] = void 0; - -var _construct2 = _interopRequireDefault(require("@babel/runtime/helpers/construct")); - -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); - -var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); - -var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); - -var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); - -var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); - -var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")); - -var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _fs = _interopRequireDefault(require("fs")); - -var _path = _interopRequireDefault(require("path")); - -var _events = _interopRequireDefault(require("events")); - -var _utils = require("@jimp/utils"); - -var _anyBase = _interopRequireDefault(require("any-base")); - -var _mkdirp = _interopRequireDefault(require("mkdirp")); - -var _pixelmatch = _interopRequireDefault(require("pixelmatch")); - -var _tinycolor = _interopRequireDefault(require("tinycolor2")); - -var _phash = _interopRequireDefault(require("./modules/phash")); - -var _request = _interopRequireDefault(require("./request")); - -var _composite = _interopRequireDefault(require("./composite")); - -var _promisify = _interopRequireDefault(require("./utils/promisify")); - -var MIME = _interopRequireWildcard(require("./utils/mime")); - -var _imageBitmap = require("./utils/image-bitmap"); - -var constants = _interopRequireWildcard(require("./constants")); - -var alphabet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'; // an array storing the maximum string length of hashes at various bases +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +import fs from "fs"; +import Path from "path"; +import EventEmitter from "events"; +import { isNodePattern, throwError, scan, scanIterator } from "@jimp/utils"; +import anyBase from "any-base"; +import pixelMatch from "pixelmatch"; +import tinyColor from "tinycolor2"; +import ImagePHash from "./modules/phash"; +import request from "./request"; +import composite from "./composite"; +import promisify from "./utils/promisify"; +import * as MIME from "./utils/mime"; +import { parseBitmap, getBuffer, getBufferAsync } from "./utils/image-bitmap"; +import * as constants from "./constants"; +const alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_"; + +// an array storing the maximum string length of hashes at various bases // 0 and 1 do not exist as possible hash lengths - -var maxHashLength = [NaN, NaN]; - -for (var i = 2; i < 65; i++) { - var maxHash = (0, _anyBase["default"])(_anyBase["default"].BIN, alphabet.slice(0, i))(new Array(64 + 1).join('1')); +const maxHashLength = [NaN, NaN]; +for (let i = 2; i < 65; i++) { + const maxHash = anyBase(anyBase.BIN, alphabet.slice(0, i))(new Array(64 + 1).join("1")); maxHashLength.push(maxHash.length); -} // no operation - +} -function noop() {} // error checking methods +// no operation +function noop() {} +// error checking methods function isArrayBuffer(test) { - return Object.prototype.toString.call(test).toLowerCase().indexOf('arraybuffer') > -1; -} // Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion, -// But this function is not useful when running in node directly - + return Object.prototype.toString.call(test).toLowerCase().indexOf("arraybuffer") > -1; +} +// Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion, +// But this function is not useful when running in node directly function bufferFromArrayBuffer(arrayBuffer) { - var buffer = Buffer.alloc(arrayBuffer.byteLength); - var view = new Uint8Array(arrayBuffer); - - for (var _i = 0; _i < buffer.length; ++_i) { - buffer[_i] = view[_i]; + const buffer = Buffer.alloc(arrayBuffer.byteLength); + const view = new Uint8Array(arrayBuffer); + for (let i = 0; i < buffer.length; ++i) { + buffer[i] = view[i]; } - return buffer; } - function loadFromURL(options, cb) { - (0, _request["default"])(options, function (err, response, data) { + request(options, (err, data) => { if (err) { return cb(err); } - - if ('headers' in response && 'location' in response.headers) { - options.url = response.headers.location; - return loadFromURL(options, cb); - } - - if ((0, _typeof2["default"])(data) === 'object' && Buffer.isBuffer(data)) { + if (typeof data === "object" && Buffer.isBuffer(data)) { return cb(null, data); } - - var msg = 'Could not load Buffer from <' + options.url + '> ' + '(HTTP: ' + response.statusCode + ')'; - return new Error(msg); + if (typeof data === "object" && isArrayBuffer(data)) { + return cb(null, bufferFromArrayBuffer(data)); + } + return new Error(`Could not load Buffer from <${options.url}>`); }); } - function loadBufferFromPath(src, cb) { - if (_fs["default"] && typeof _fs["default"].readFile === 'function' && !src.match(/^(http|ftp)s?:\/\/./)) { - _fs["default"].readFile(src, cb); + if (fs && typeof fs.readFile === "function" && !src.match(/^(http|ftp)s?:\/\/./)) { + fs.readFile(src, cb); } else { loadFromURL({ url: src }, cb); } } - function isRawRGBAData(obj) { - return obj && (0, _typeof2["default"])(obj) === 'object' && typeof obj.width === 'number' && typeof obj.height === 'number' && (Buffer.isBuffer(obj.data) || obj.data instanceof Uint8Array || typeof Uint8ClampedArray === 'function' && obj.data instanceof Uint8ClampedArray) && (obj.data.length === obj.width * obj.height * 4 || obj.data.length === obj.width * obj.height * 3); + return obj && typeof obj === "object" && typeof obj.width === "number" && typeof obj.height === "number" && (Buffer.isBuffer(obj.data) || obj.data instanceof Uint8Array || typeof Uint8ClampedArray === "function" && obj.data instanceof Uint8ClampedArray) && (obj.data.length === obj.width * obj.height * 4 || obj.data.length === obj.width * obj.height * 3); } - function makeRGBABufferFromRGB(buffer) { if (buffer.length % 3 !== 0) { - throw new Error('Buffer length is incorrect'); + throw new Error("Buffer length is incorrect"); } - - var rgbaBuffer = Buffer.allocUnsafe(buffer.length / 3 * 4); - var j = 0; - - for (var _i2 = 0; _i2 < buffer.length; _i2++) { - rgbaBuffer[j] = buffer[_i2]; - - if ((_i2 + 1) % 3 === 0) { + const rgbaBuffer = Buffer.allocUnsafe(buffer.length / 3 * 4); + let j = 0; + for (let i = 0; i < buffer.length; i++) { + rgbaBuffer[j] = buffer[i]; + if ((i + 1) % 3 === 0) { rgbaBuffer[++j] = 255; } - j++; } - return rgbaBuffer; } - -var emptyBitmap = { +const emptyBitmap = { data: null, width: null, height: null }; + /** * Jimp constructor (from a file) * @param path a path to the image @@ -199,222 +130,181 @@ var emptyBitmap = { * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap */ -var Jimp = -/*#__PURE__*/ -function (_EventEmitter) { - (0, _inherits2["default"])(Jimp, _EventEmitter); - +class Jimp extends EventEmitter { // An object representing a bitmap in memory, comprising: // - data: a buffer of the bitmap data // - width: the width of the image in pixels // - height: the height of the image in pixels + // Default colour to use for new pixels + // Default MIME is PNG + // Exif data for the image + // Whether Transparency supporting formats will be exported as RGB or RGBA - function Jimp() { - var _this; + constructor() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } - - (0, _classCallCheck2["default"])(this, Jimp); - _this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(Jimp).call(this)); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "bitmap", emptyBitmap); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_background", 0x00000000); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_originalMime", Jimp.MIME_PNG); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_exif", null); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_rgba", true); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "writeAsync", function (path) { - return (0, _promisify["default"])(_this.write, (0, _assertThisInitialized2["default"])(_this), path); - }); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBase64Async", function (mime) { - return (0, _promisify["default"])(_this.getBase64, (0, _assertThisInitialized2["default"])(_this), mime); - }); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBuffer", _imageBitmap.getBuffer); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBufferAsync", _imageBitmap.getBufferAsync); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getPixelColour", _this.getPixelColor); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setPixelColour", _this.setPixelColor); - var jimpInstance = (0, _assertThisInitialized2["default"])(_this); - var cb = noop; - + super(); + _defineProperty(this, "bitmap", emptyBitmap); + _defineProperty(this, "_background", 0x00000000); + _defineProperty(this, "_originalMime", Jimp.MIME_PNG); + _defineProperty(this, "_exif", null); + _defineProperty(this, "_rgba", true); + _defineProperty(this, "writeAsync", path => promisify(this.write, this, path)); + _defineProperty(this, "getBase64Async", mime => promisify(this.getBase64, this, mime)); + _defineProperty(this, "getBuffer", getBuffer); + _defineProperty(this, "getBufferAsync", getBufferAsync); + _defineProperty(this, "getPixelColour", this.getPixelColor); + _defineProperty(this, "setPixelColour", this.setPixelColor); + const jimpInstance = this; + let cb = noop; if (isArrayBuffer(args[0])) { args[0] = bufferFromArrayBuffer(args[0]); } - function finish() { for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } - - var err = args[0]; - var evData = err || {}; - evData.methodName = 'constructor'; - setTimeout(function () { - var _cb; - + const [err] = args; + const evData = err || {}; + evData.methodName = "constructor"; + setTimeout(() => { // run on next tick. if (err && cb === noop) { - jimpInstance.emitError('constructor', err); + jimpInstance.emitError("constructor", err); } else if (!err) { - jimpInstance.emitMulti('constructor', 'initialized'); + jimpInstance.emitMulti("constructor", "initialized"); } - - (_cb = cb).call.apply(_cb, [jimpInstance].concat(args)); + cb.call(jimpInstance, ...args); }, 1); } - - if (typeof args[0] === 'number' && typeof args[1] === 'number' || parseInt(args[0], 10) && parseInt(args[1], 10)) { + if (typeof args[0] === "number" && typeof args[1] === "number" || parseInt(args[0], 10) && parseInt(args[1], 10)) { // create a new image - var w = parseInt(args[0], 10); - var h = parseInt(args[1], 10); - cb = args[2]; // with a hex color + const w = parseInt(args[0], 10); + const h = parseInt(args[1], 10); + cb = args[2]; - if (typeof args[2] === 'number') { - _this._background = args[2]; + // with a hex color + if (typeof args[2] === "number") { + this._background = args[2]; cb = args[3]; - } // with a css color - + } - if (typeof args[2] === 'string') { - _this._background = Jimp.cssColorToHex(args[2]); + // with a css color + if (typeof args[2] === "string") { + this._background = Jimp.cssColorToHex(args[2]); cb = args[3]; } - - if (typeof cb === 'undefined') { + if (typeof cb === "undefined") { cb = noop; } - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); + if (typeof cb !== "function") { + return throwError.call(this, "cb must be a function", finish); } - - _this.bitmap = { + this.bitmap = { data: Buffer.alloc(w * h * 4), width: w, height: h }; - - for (var _i3 = 0; _i3 < _this.bitmap.data.length; _i3 += 4) { - _this.bitmap.data.writeUInt32BE(_this._background, _i3); + for (let i = 0; i < this.bitmap.data.length; i += 4) { + this.bitmap.data.writeUInt32BE(this._background, i); } - - finish(null, (0, _assertThisInitialized2["default"])(_this)); - } else if ((0, _typeof2["default"])(args[0]) === 'object' && args[0].url) { + finish(null, this); + } else if (typeof args[0] === "object" && args[0].url) { cb = args[1] || noop; - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); + if (typeof cb !== "function") { + return throwError.call(this, "cb must be a function", finish); } - - loadFromURL(args[0], function (err, data) { + loadFromURL(args[0], (err, data) => { if (err) { - return _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), err, finish); + return throwError.call(this, err, finish); } - - _this.parseBitmap(data, args[0].url, finish); + this.parseBitmap(data, args[0].url, finish); }); } else if (args[0] instanceof Jimp) { // clone an existing Jimp - var original = args[0]; + const [original] = args; cb = args[1]; - - if (typeof cb === 'undefined') { + if (typeof cb === "undefined") { cb = noop; } - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); + if (typeof cb !== "function") { + return throwError.call(this, "cb must be a function", finish); } - - _this.bitmap = { + this.bitmap = { data: Buffer.from(original.bitmap.data), width: original.bitmap.width, height: original.bitmap.height }; - _this._quality = original._quality; - _this._deflateLevel = original._deflateLevel; - _this._deflateStrategy = original._deflateStrategy; - _this._filterType = original._filterType; - _this._rgba = original._rgba; - _this._background = original._background; - _this._originalMime = original._originalMime; - finish(null, (0, _assertThisInitialized2["default"])(_this)); + this._quality = original._quality; + this._deflateLevel = original._deflateLevel; + this._deflateStrategy = original._deflateStrategy; + this._filterType = original._filterType; + this._rgba = original._rgba; + this._background = original._background; + this._originalMime = original._originalMime; + finish(null, this); } else if (isRawRGBAData(args[0])) { - var imageData = args[0]; + const [imageData] = args; cb = args[1] || noop; - var isRGBA = imageData.width * imageData.height * 4 === imageData.data.length; - var buffer = isRGBA ? Buffer.from(imageData.data) : makeRGBABufferFromRGB(imageData.data); - _this.bitmap = { + const isRGBA = imageData.width * imageData.height * 4 === imageData.data.length; + const buffer = isRGBA ? Buffer.from(imageData.data) : makeRGBABufferFromRGB(imageData.data); + this.bitmap = { data: buffer, width: imageData.width, height: imageData.height }; - finish(null, (0, _assertThisInitialized2["default"])(_this)); - } else if (typeof args[0] === 'string') { + finish(null, this); + } else if (typeof args[0] === "string") { // read from a path - var path = args[0]; + const path = args[0]; cb = args[1]; - - if (typeof cb === 'undefined') { + if (typeof cb === "undefined") { cb = noop; } - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); + if (typeof cb !== "function") { + return throwError.call(this, "cb must be a function", finish); } - - loadBufferFromPath(path, function (err, data) { + loadBufferFromPath(path, (err, data) => { if (err) { - return _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), err, finish); + return throwError.call(this, err, finish); } - - _this.parseBitmap(data, path, finish); + this.parseBitmap(data, path, finish); }); - } else if ((0, _typeof2["default"])(args[0]) === 'object' && Buffer.isBuffer(args[0])) { + } else if (typeof args[0] === "object" && Buffer.isBuffer(args[0])) { // read from a buffer - var data = args[0]; + const data = args[0]; cb = args[1]; - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); + if (typeof cb !== "function") { + return throwError.call(this, "cb must be a function", finish); } - - _this.parseBitmap(data, null, finish); + this.parseBitmap(data, null, finish); } else { // Allow client libs to add new ways to build a Jimp object. // Extra constructors must be added by `Jimp.appendConstructorOption()` cb = args[args.length - 1]; - - if (typeof cb !== 'function') { + if (typeof cb !== "function") { // TODO: try to solve the args after cb problem. cb = args[args.length - 2]; - - if (typeof cb !== 'function') { + if (typeof cb !== "function") { cb = noop; } } - - var extraConstructor = Jimp.__extraConstructors.find(function (c) { - return c.test.apply(c, args); - }); - + const extraConstructor = Jimp.__extraConstructors.find(c => c.test(...args)); if (extraConstructor) { - new Promise(function (resolve, reject) { - var _extraConstructor$run; - - return (_extraConstructor$run = extraConstructor.run).call.apply(_extraConstructor$run, [(0, _assertThisInitialized2["default"])(_this), resolve, reject].concat(args)); - }).then(function () { - return finish(null, (0, _assertThisInitialized2["default"])(_this)); - })["catch"](finish); + new Promise((resolve, reject) => { + extraConstructor.run.call(this, resolve, reject, ...args); + }).then(() => finish(null, this)).catch(finish); } else { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'No matching constructor overloading was found. ' + 'Please see the docs for how to call the Jimp constructor.', finish)); + return throwError.call(this, "No matching constructor overloading was found. " + "Please see the docs for how to call the Jimp constructor.", finish); } } - - return _this; } + /** * Parse a bitmap with the loaded image types. * @@ -423,513 +313,408 @@ function (_EventEmitter) { * @param {function(Error, Jimp)} finish (optional) a callback for when complete * @memberof Jimp */ + parseBitmap(data, path, finish) { + parseBitmap.call(this, data, null, finish); + } + /** + * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA) + * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + rgba(bool, cb) { + if (typeof bool !== "boolean") { + return throwError.call(this, "bool must be a boolean, true for RGBA or false for RGB", cb); + } + this._rgba = bool; + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + } - (0, _createClass2["default"])(Jimp, [{ - key: "parseBitmap", - value: function parseBitmap(data, path, finish) { - _imageBitmap.parseBitmap.call(this, data, null, finish); + /** + * Emit for multiple listeners + * @param {string} methodName name of the method to emit an error for + * @param {string} eventName name of the eventName to emit an error for + * @param {object} data to emit + */ + emitMulti(methodName, eventName) { + let data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + data = Object.assign(data, { + methodName, + eventName + }); + this.emit("any", data); + if (methodName) { + this.emit(methodName, data); } - /** - * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA) - * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ + this.emit(eventName, data); + } + emitError(methodName, err) { + this.emitMulti(methodName, "error", err); + } - }, { - key: "rgba", - value: function rgba(bool, cb) { - if (typeof bool !== 'boolean') { - return _utils.throwError.call(this, 'bool must be a boolean, true for RGBA or false for RGB', cb); - } + /** + * Get the current height of the image + * @return {number} height of the image + */ + getHeight() { + return this.bitmap.height; + } - this._rgba = bool; + /** + * Get the current width of the image + * @return {number} width of the image + */ + getWidth() { + return this.bitmap.width; + } - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } + /** + * Nicely format Jimp object when sent to the console e.g. console.log(image) + * @returns {string} pretty printed + */ + inspect() { + return ""; + } - return this; - } - /** - * Emit for multiple listeners - * @param {string} methodName name of the method to emit an error for - * @param {string} eventName name of the eventName to emit an error for - * @param {object} data to emit - */ + /** + * Nicely format Jimp object when converted to a string + * @returns {string} pretty printed + */ + toString() { + return "[object Jimp]"; + } - }, { - key: "emitMulti", - value: function emitMulti(methodName, eventName) { - var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - data = Object.assign(data, { - methodName: methodName, - eventName: eventName - }); - this.emit('any', data); + /** + * Returns the original MIME of the image (default: "image/png") + * @returns {string} the MIME + */ + getMIME() { + const mime = this._originalMime || Jimp.MIME_PNG; + return mime; + } - if (methodName) { - this.emit(methodName, data); - } + /** + * Returns the appropriate file extension for the original MIME of the image (default: "png") + * @returns {string} the file extension + */ + getExtension() { + const mime = this.getMIME(); + return MIME.getExtension(mime); + } - this.emit(eventName, data); + /** + * Writes the image to a file + * @param {string} path a path to the destination file + * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk + * @returns {Jimp} this for chaining of methods + */ + write(path, cb) { + if (!fs || !fs.createWriteStream) { + throw new Error("Cant access the filesystem. You can use the getBase64 method."); } - }, { - key: "emitError", - value: function emitError(methodName, err) { - this.emitMulti(methodName, 'error', err); + if (typeof path !== "string") { + return throwError.call(this, "path must be a string", cb); } - /** - * Get the current height of the image - * @return {number} height of the image - */ - - }, { - key: "getHeight", - value: function getHeight() { - return this.bitmap.height; + if (typeof cb === "undefined") { + cb = noop; } - /** - * Get the current width of the image - * @return {number} width of the image - */ - - }, { - key: "getWidth", - value: function getWidth() { - return this.bitmap.width; + if (typeof cb !== "function") { + return throwError.call(this, "cb must be a function", cb); } - /** - * Nicely format Jimp object when sent to the console e.g. console.log(image) - * @returns {string} pretty printed - */ - - }, { - key: "inspect", - value: function inspect() { - return ''; + const mime = MIME.getType(path) || this.getMIME(); + const pathObj = Path.parse(path); + if (pathObj.dir) { + fs.mkdirSync(pathObj.dir, { + recursive: true + }); } - /** - * Nicely format Jimp object when converted to a string - * @returns {string} pretty printed - */ - - }, { - key: "toString", - value: function toString() { - return '[object Jimp]'; + this.getBuffer(mime, (err, buffer) => { + if (err) { + return throwError.call(this, err, cb); + } + const stream = fs.createWriteStream(path); + stream.on("open", () => { + stream.write(buffer); + stream.end(); + }).on("error", err => { + return throwError.call(this, err, cb); + }); + stream.on("finish", () => { + cb.call(this, null, this); + }); + }); + return this; + } + /** + * Converts the image to a base 64 string + * @param {string} mime the mime type of the image data to be created + * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument + * @returns {Jimp} this for chaining of methods + */ + getBase64(mime, cb) { + if (mime === Jimp.AUTO) { + // allow auto MIME detection + mime = this.getMIME(); } - /** - * Returns the original MIME of the image (default: "image/png") - * @returns {string} the MIME - */ - - }, { - key: "getMIME", - value: function getMIME() { - var mime = this._originalMime || Jimp.MIME_PNG; - return mime; + if (typeof mime !== "string") { + return throwError.call(this, "mime must be a string", cb); } - /** - * Returns the appropriate file extension for the original MIME of the image (default: "png") - * @returns {string} the file extension - */ - - }, { - key: "getExtension", - value: function getExtension() { - var mime = this.getMIME(); - return MIME.getExtension(mime); + if (typeof cb !== "function") { + return throwError.call(this, "cb must be a function", cb); } - /** - * Writes the image to a file - * @param {string} path a path to the destination file - * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk - * @returns {Jimp} this for chaining of methods - */ - - }, { - key: "write", - value: function write(path, cb) { - var _this2 = this; - - if (!_fs["default"] || !_fs["default"].createWriteStream) { - throw new Error('Cant access the filesystem. You can use the getBase64 method.'); - } - - if (typeof path !== 'string') { - return _utils.throwError.call(this, 'path must be a string', cb); - } - - if (typeof cb === 'undefined') { - cb = noop; - } - - if (typeof cb !== 'function') { - return _utils.throwError.call(this, 'cb must be a function', cb); - } - - var mime = MIME.getType(path) || this.getMIME(); - - var pathObj = _path["default"].parse(path); - - if (pathObj.dir) { - _mkdirp["default"].sync(pathObj.dir); + this.getBuffer(mime, function (err, data) { + if (err) { + return throwError.call(this, err, cb); } - - this.getBuffer(mime, function (err, buffer) { - if (err) { - return _utils.throwError.call(_this2, err, cb); - } - - var stream = _fs["default"].createWriteStream(path); - - stream.on('open', function () { - stream.write(buffer); - stream.end(); - }).on('error', function (err) { - return _utils.throwError.call(_this2, err, cb); - }); - stream.on('finish', function () { - cb.call(_this2, null, _this2); - }); - }); - return this; + const src = "data:" + mime + ";base64," + data.toString("base64"); + cb.call(this, null, src); + }); + return this; + } + /** + * Generates a perceptual hash of the image . And pads the string. Can configure base. + * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64. + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {string} a string representing the hash + */ + hash(base, cb) { + base = base || 64; + if (typeof base === "function") { + cb = base; + base = 64; } - }, { - key: "getBase64", - - /** - * Converts the image to a base 64 string - * @param {string} mime the mime type of the image data to be created - * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument - * @returns {Jimp} this for chaining of methods - */ - value: function getBase64(mime, cb) { - if (mime === Jimp.AUTO) { - // allow auto MIME detection - mime = this.getMIME(); - } - - if (typeof mime !== 'string') { - return _utils.throwError.call(this, 'mime must be a string', cb); - } - - if (typeof cb !== 'function') { - return _utils.throwError.call(this, 'cb must be a function', cb); - } - - this.getBuffer(mime, function (err, data) { - if (err) { - return _utils.throwError.call(this, err, cb); - } - - var src = 'data:' + mime + ';base64,' + data.toString('base64'); - cb.call(this, null, src); - }); - return this; + if (typeof base !== "number") { + return throwError.call(this, "base must be a number", cb); } - }, { - key: "hash", - - /** - * Generates a perceptual hash of the image . And pads the string. Can configure base. - * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {string} a string representing the hash - */ - value: function hash(base, cb) { - base = base || 64; - - if (typeof base === 'function') { - cb = base; - base = 64; - } - - if (typeof base !== 'number') { - return _utils.throwError.call(this, 'base must be a number', cb); - } - - if (base < 2 || base > 64) { - return _utils.throwError.call(this, 'base must be a number between 2 and 64', cb); - } - - var hash = this.pHash(); - hash = (0, _anyBase["default"])(_anyBase["default"].BIN, alphabet.slice(0, base))(hash); - - while (hash.length < maxHashLength[base]) { - hash = '0' + hash; // pad out with leading zeros - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, hash); - } - - return hash; + if (base < 2 || base > 64) { + return throwError.call(this, "base must be a number between 2 and 64", cb); } - /** - * Calculates the perceptual hash - * @returns {number} the perceptual hash - */ - - }, { - key: "pHash", - value: function pHash() { - var pHash = new _phash["default"](); - return pHash.getHash(this); + let hash = this.pHash(); + hash = anyBase(anyBase.BIN, alphabet.slice(0, base))(hash); + while (hash.length < maxHashLength[base]) { + hash = "0" + hash; // pad out with leading zeros } - /** - * Calculates the hamming distance of the current image and a hash based on their perceptual hash - * @param {hash} compareHash hash to compare to - * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical - */ - }, { - key: "distanceFromHash", - value: function distanceFromHash(compareHash) { - var pHash = new _phash["default"](); - var currentHash = pHash.getHash(this); - return pHash.distance(currentHash, compareHash); + if (isNodePattern(cb)) { + cb.call(this, null, hash); } - /** - * Converts the image to a buffer - * @param {string} mime the mime type of the image buffer to be created - * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument - * @returns {Jimp} this for chaining of methods - */ - - }, { - key: "getPixelIndex", - - /** - * Returns the offset of a pixel in the bitmap buffer - * @param {number} x the x coordinate - * @param {number} y the y coordinate - * @param {string} edgeHandling (optional) define how to sum pixels from outside the border - * @param {number} cb (optional) a callback for when complete - * @returns {number} the index of the pixel or -1 if not found - */ - value: function getPixelIndex(x, y, edgeHandling, cb) { - var xi; - var yi; - - if (typeof edgeHandling === 'function' && typeof cb === 'undefined') { - cb = edgeHandling; - edgeHandling = null; - } - - if (!edgeHandling) { - edgeHandling = Jimp.EDGE_EXTEND; - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } // round input - - - x = Math.round(x); - y = Math.round(y); - xi = x; - yi = y; + return hash; + } - if (edgeHandling === Jimp.EDGE_EXTEND) { - if (x < 0) xi = 0; - if (x >= this.bitmap.width) xi = this.bitmap.width - 1; - if (y < 0) yi = 0; - if (y >= this.bitmap.height) yi = this.bitmap.height - 1; - } + /** + * Calculates the perceptual hash + * @returns {number} the perceptual hash + */ + pHash() { + const pHash = new ImagePHash(); + return pHash.getHash(this); + } - if (edgeHandling === Jimp.EDGE_WRAP) { - if (x < 0) { - xi = this.bitmap.width + x; - } + /** + * Calculates the hamming distance of the current image and a hash based on their perceptual hash + * @param {hash} compareHash hash to compare to + * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical + */ + distanceFromHash(compareHash) { + const pHash = new ImagePHash(); + const currentHash = pHash.getHash(this); + return pHash.distance(currentHash, compareHash); + } - if (x >= this.bitmap.width) { - xi = x % this.bitmap.width; - } + /** + * Converts the image to a buffer + * @param {string} mime the mime type of the image buffer to be created + * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument + * @returns {Jimp} this for chaining of methods + */ - if (y < 0) { - xi = this.bitmap.height + y; - } + /** + * Returns the offset of a pixel in the bitmap buffer + * @param {number} x the x coordinate + * @param {number} y the y coordinate + * @param {number} edgeHandling (optional) define how to sum pixels from outside the border + * @param {number} cb (optional) a callback for when complete + * @returns {number} the index of the pixel or -1 if not found + */ + getPixelIndex(x, y, edgeHandling, cb) { + let xi; + let yi; + if (typeof edgeHandling === "function" && typeof cb === "undefined") { + cb = edgeHandling; + edgeHandling = null; + } + if (!edgeHandling) { + edgeHandling = Jimp.EDGE_EXTEND; + } + if (typeof x !== "number" || typeof y !== "number") { + return throwError.call(this, "x and y must be numbers", cb); + } - if (y >= this.bitmap.height) { - yi = y % this.bitmap.height; - } + // round input + x = Math.round(x); + y = Math.round(y); + xi = x; + yi = y; + if (edgeHandling === Jimp.EDGE_EXTEND) { + if (x < 0) xi = 0; + if (x >= this.bitmap.width) xi = this.bitmap.width - 1; + if (y < 0) yi = 0; + if (y >= this.bitmap.height) yi = this.bitmap.height - 1; + } + if (edgeHandling === Jimp.EDGE_WRAP) { + if (x < 0) { + xi = this.bitmap.width + x; } - - var i = this.bitmap.width * yi + xi << 2; // if out of bounds index is -1 - - if (xi < 0 || xi >= this.bitmap.width) { - i = -1; + if (x >= this.bitmap.width) { + xi = x % this.bitmap.width; } - - if (yi < 0 || yi >= this.bitmap.height) { - i = -1; + if (y < 0) { + yi = this.bitmap.height + y; } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, i); + if (y >= this.bitmap.height) { + yi = y % this.bitmap.height; } - - return i; } - /** - * Returns the hex colour value of a pixel - * @param {number} x the x coordinate - * @param {number} y the y coordinate - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {number} the color of the pixel - */ - - }, { - key: "getPixelColor", - value: function getPixelColor(x, y, cb) { - if (typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'x and y must be numbers', cb); // round input + let i = this.bitmap.width * yi + xi << 2; - x = Math.round(x); - y = Math.round(y); - var idx = this.getPixelIndex(x, y); - var hex = this.bitmap.data.readUInt32BE(idx); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, hex); - } - - return hex; + // if out of bounds index is -1 + if (xi < 0 || xi >= this.bitmap.width) { + i = -1; } - }, { - key: "setPixelColor", - - /** - * Returns the hex colour value of a pixel - * @param {number} hex color to set - * @param {number} x the x coordinate - * @param {number} y the y coordinate - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {number} the index of the pixel or -1 if not found - */ - value: function setPixelColor(hex, x, y, cb) { - if (typeof hex !== 'number' || typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'hex, x and y must be numbers', cb); // round input - - x = Math.round(x); - y = Math.round(y); - var idx = this.getPixelIndex(x, y); - this.bitmap.data.writeUInt32BE(hex, idx); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; + if (yi < 0 || yi >= this.bitmap.height) { + i = -1; } - }, { - key: "hasAlpha", - - /** - * Determine if the image contains opaque pixels. - * @return {boolean} hasAlpha whether the image contains opaque pixels - */ - value: function hasAlpha() { - for (var yIndex = 0; yIndex < this.bitmap.height; yIndex++) { - for (var xIndex = 0; xIndex < this.bitmap.width; xIndex++) { - var idx = this.bitmap.width * yIndex + xIndex << 2; - var alpha = this.bitmap.data[idx + 3]; - - if (alpha !== 0xff) { - return true; - } - } - } - - return false; + if (isNodePattern(cb)) { + cb.call(this, null, i); } - /** - * Iterate scan through a region of the bitmap - * @param {number} x the x coordinate to begin the scan at - * @param {number} y the y coordinate to begin the scan at - * @param w the width of the scan region - * @param h the height of the scan region - * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>} - */ - - }, { - key: "scanIterator", - value: function scanIterator(x, y, w, h) { - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers'); - } + return i; + } - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers'); + /** + * Returns the hex colour value of a pixel + * @param {number} x the x coordinate + * @param {number} y the y coordinate + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {number} the color of the pixel + */ + getPixelColor(x, y, cb) { + if (typeof x !== "number" || typeof y !== "number") return throwError.call(this, "x and y must be numbers", cb); + const idx = this.getPixelIndex(x, y); + const hex = this.bitmap.data.readUInt32BE(idx); + if (isNodePattern(cb)) { + cb.call(this, null, hex); + } + return hex; + } + /** + * Returns the hex colour value of a pixel + * @param {number} hex color to set + * @param {number} x the x coordinate + * @param {number} y the y coordinate + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {number} the index of the pixel or -1 if not found + */ + setPixelColor(hex, x, y, cb) { + if (typeof hex !== "number" || typeof x !== "number" || typeof y !== "number") return throwError.call(this, "hex, x and y must be numbers", cb); + const idx = this.getPixelIndex(x, y); + this.bitmap.data.writeUInt32BE(hex, idx); + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + } + /** + * Determine if the image contains opaque pixels. + * @return {boolean} hasAlpha whether the image contains opaque pixels + */ + hasAlpha() { + const { + width, + height, + data + } = this.bitmap; + const byteLen = width * height << 2; + for (let idx = 3; idx < byteLen; idx += 4) { + if (data[idx] !== 0xff) { + return true; } - - return (0, _utils.scanIterator)(this, x, y, w, h); } - }]); - return Jimp; -}(_events["default"]); - -function addConstants(constants) { - var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp; - Object.entries(constants).forEach(function (_ref) { - var _ref2 = (0, _slicedToArray2["default"])(_ref, 2), - name = _ref2[0], - value = _ref2[1]; + return false; + } + /** + * Iterate scan through a region of the bitmap + * @param {number} x the x coordinate to begin the scan at + * @param {number} y the y coordinate to begin the scan at + * @param w the width of the scan region + * @param h the height of the scan region + * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>} + */ + scanIterator(x, y, w, h) { + if (typeof x !== "number" || typeof y !== "number") { + return throwError.call(this, "x and y must be numbers"); + } + if (typeof w !== "number" || typeof h !== "number") { + return throwError.call(this, "w and h must be numbers"); + } + return scanIterator(this, x, y, w, h); + } +} +export function addConstants(constants) { + let jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp; + Object.entries(constants).forEach(_ref => { + let [name, value] = _ref; jimpInstance[name] = value; }); } - -function addJimpMethods(methods) { - var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp; - Object.entries(methods).forEach(function (_ref3) { - var _ref4 = (0, _slicedToArray2["default"])(_ref3, 2), - name = _ref4[0], - value = _ref4[1]; - +export function addJimpMethods(methods) { + let jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp; + Object.entries(methods).forEach(_ref2 => { + let [name, value] = _ref2; jimpInstance.prototype[name] = value; }); } - addConstants(constants); addJimpMethods({ - composite: _composite["default"] + composite }); Jimp.__extraConstructors = []; + /** * Allow client libs to add new ways to build a Jimp object. * @param {string} name identify the extra constructor. * @param {function} test a function that returns true when it accepts the arguments passed to the main constructor. * @param {function} run where the magic happens. */ - Jimp.appendConstructorOption = function (name, test, run) { Jimp.__extraConstructors.push({ - name: name, - test: test, - run: run + name, + test, + run }); }; + /** * Read an image from a file or a Buffer. Takes the same args as the constructor * @returns {Promise} a promise */ - - Jimp.read = function () { for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { args[_key3] = arguments[_key3]; } - - return new Promise(function (resolve, reject) { - (0, _construct2["default"])(Jimp, args.concat([function (err, image) { + return new Promise((resolve, reject) => { + // eslint-disable-next-line no-new + new Jimp(...args, (err, image) => { if (err) reject(err);else resolve(image); - }])); + }); }); }; - Jimp.create = Jimp.read; + /** * A static helper method that converts RGBA values to a single integer value * @param {number} r the red value (0-255) @@ -939,90 +724,82 @@ Jimp.create = Jimp.read; * @param {function(Error, Jimp)} cb (optional) A callback for when complete * @returns {number} an single integer colour value */ - Jimp.rgbaToInt = function (r, g, b, a, cb) { - if (typeof r !== 'number' || typeof g !== 'number' || typeof b !== 'number' || typeof a !== 'number') { - return _utils.throwError.call(this, 'r, g, b and a must be numbers', cb); + if (typeof r !== "number" || typeof g !== "number" || typeof b !== "number" || typeof a !== "number") { + return throwError.call(this, "r, g, b and a must be numbers", cb); } - if (r < 0 || r > 255) { - return _utils.throwError.call(this, 'r must be between 0 and 255', cb); + return throwError.call(this, "r must be between 0 and 255", cb); } - if (g < 0 || g > 255) { - _utils.throwError.call(this, 'g must be between 0 and 255', cb); + throwError.call(this, "g must be between 0 and 255", cb); } - if (b < 0 || b > 255) { - return _utils.throwError.call(this, 'b must be between 0 and 255', cb); + return throwError.call(this, "b must be between 0 and 255", cb); } - if (a < 0 || a > 255) { - return _utils.throwError.call(this, 'a must be between 0 and 255', cb); + return throwError.call(this, "a must be between 0 and 255", cb); } - - r = Math.round(r); - b = Math.round(b); - g = Math.round(g); - a = Math.round(a); - var i = r * Math.pow(256, 3) + g * Math.pow(256, 2) + b * Math.pow(256, 1) + a * Math.pow(256, 0); - - if ((0, _utils.isNodePattern)(cb)) { + let i = r & 0xff; + i <<= 8; + i |= g & 0xff; + i <<= 8; + i |= b & 0xff; + i <<= 8; + i |= a & 0xff; + + // Ensure sign is correct + i >>>= 0; + if (isNodePattern(cb)) { cb.call(this, null, i); } - return i; }; + /** * A static helper method that converts RGBA values to a single integer value * @param {number} i a single integer value representing an RGBA colour (e.g. 0xFF0000FF for red) * @param {function(Error, Jimp)} cb (optional) A callback for when complete * @returns {object} an object with the properties r, g, b and a representing RGBA values */ - - Jimp.intToRGBA = function (i, cb) { - if (typeof i !== 'number') { - return _utils.throwError.call(this, 'i must be a number', cb); + if (typeof i !== "number") { + return throwError.call(this, "i must be a number", cb); } - - var rgba = {}; + const rgba = {}; rgba.r = Math.floor(i / Math.pow(256, 3)); rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2)); rgba.b = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) / Math.pow(256, 1)); rgba.a = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2) - rgba.b * Math.pow(256, 1)) / Math.pow(256, 0)); - - if ((0, _utils.isNodePattern)(cb)) { + if (isNodePattern(cb)) { cb.call(this, null, rgba); } - return rgba; }; + /** * Converts a css color (Hex, 8-digit (RGBA) Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, Named) to a hex number * @param {string} cssColor a number * @returns {number} a hex number representing a color */ - - Jimp.cssColorToHex = function (cssColor) { cssColor = cssColor || 0; // 0, null, undefined, NaN - if (typeof cssColor === 'number') return Number(cssColor); - return parseInt((0, _tinycolor["default"])(cssColor).toHex8(), 16); + if (typeof cssColor === "number") return Number(cssColor); + return parseInt(tinyColor(cssColor).toHex8(), 16); }; + /** * Limits a number to between 0 or 255 * @param {number} n a number * @returns {number} the number limited to between 0 or 255 */ - - Jimp.limit255 = function (n) { n = Math.max(n, 0); n = Math.min(n, 255); return n; }; + /** * Diffs two images and returns * @param {Jimp} img1 a Jimp image to compare @@ -1030,14 +807,11 @@ Jimp.limit255 = function (n) { * @param {number} threshold (optional) a number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1) * @returns {object} an object { percent: percent similar, diff: a Jimp image highlighting differences } */ - - Jimp.diff = function (img1, img2) { - var threshold = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.1; - if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp)) return _utils.throwError.call(this, 'img1 and img2 must be an Jimp images'); - var bmp1 = img1.bitmap; - var bmp2 = img2.bitmap; - + let threshold = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.1; + if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp)) return throwError.call(this, "img1 and img2 must be an Jimp images"); + const bmp1 = img1.bitmap; + const bmp2 = img2.bitmap; if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) { if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) { // img1 is bigger @@ -1047,46 +821,43 @@ Jimp.diff = function (img1, img2) { img2 = img2.cloneQuiet().resize(bmp1.width, bmp1.height); } } - - if (typeof threshold !== 'number' || threshold < 0 || threshold > 1) { - return _utils.throwError.call(this, 'threshold must be a number between 0 and 1'); + if (typeof threshold !== "number" || threshold < 0 || threshold > 1) { + return throwError.call(this, "threshold must be a number between 0 and 1"); } - - var diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff); - var numDiffPixels = (0, _pixelmatch["default"])(bmp1.data, bmp2.data, diff.bitmap.data, diff.bitmap.width, diff.bitmap.height, { - threshold: threshold + const diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff); + const numDiffPixels = pixelMatch(bmp1.data, bmp2.data, diff.bitmap.data, diff.bitmap.width, diff.bitmap.height, { + threshold }); return { percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height), image: diff }; }; + /** * Calculates the hamming distance of two images based on their perceptual hash * @param {Jimp} img1 a Jimp image to compare * @param {Jimp} img2 a Jimp image to compare * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical */ - - Jimp.distance = function (img1, img2) { - var phash = new _phash["default"](); - var hash1 = phash.getHash(img1); - var hash2 = phash.getHash(img2); + const phash = new ImagePHash(); + const hash1 = phash.getHash(img1); + const hash2 = phash.getHash(img2); return phash.distance(hash1, hash2); }; + /** * Calculates the hamming distance of two images based on their perceptual hash * @param {hash} hash1 a pHash * @param {hash} hash2 a pHash * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical */ - - Jimp.compareHashes = function (hash1, hash2) { - var phash = new _phash["default"](); + const phash = new ImagePHash(); return phash.distance(hash1, hash2); }; + /** * Compute color difference * 0 means no difference, 1 means maximum difference. @@ -1096,26 +867,21 @@ Jimp.compareHashes = function (hash1, hash2) { * Where `a` is optional and `val` is an integer between 0 and 255. * @returns {number} float between 0 and 1. */ - - Jimp.colorDiff = function (rgba1, rgba2) { - var pow = function pow(n) { - return Math.pow(n, 2); - }; - - var max = Math.max; - var maxVal = 255 * 255 * 3; - + const pow = n => Math.pow(n, 2); + const { + max + } = Math; + const maxVal = 255 * 255 * 3; if (rgba1.a !== 0 && !rgba1.a) { rgba1.a = 255; } - if (rgba2.a !== 0 && !rgba2.a) { rgba2.a = 255; } - return (max(pow(rgba1.r - rgba2.r), pow(rgba1.r - rgba2.r - rgba1.a + rgba2.a)) + max(pow(rgba1.g - rgba2.g), pow(rgba1.g - rgba2.g - rgba1.a + rgba2.a)) + max(pow(rgba1.b - rgba2.b), pow(rgba1.b - rgba2.b - rgba1.a + rgba2.a))) / maxVal; }; + /** * Helper to create Jimp methods that emit events before and after its execution. * @param {string} methodName The name to be appended to Jimp prototype. @@ -1130,110 +896,92 @@ Jimp.colorDiff = function (rgba1, rgba2) { * The emitted event comes with a object parameter to the listener with the * `methodName` as one attribute. */ - - -function jimpEvMethod(methodName, evName, method) { - var evNameBefore = 'before-' + evName; - var evNameAfter = evName.replace(/e$/, '') + 'ed'; - +export function jimpEvMethod(methodName, evName, method) { + const evNameBefore = "before-" + evName; + const evNameAfter = evName.replace(/e$/, "") + "ed"; Jimp.prototype[methodName] = function () { - var wrappedCb; - + let wrappedCb; for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { args[_key4] = arguments[_key4]; } - - var cb = args[method.length - 1]; - var jimpInstance = this; - - if (typeof cb === 'function') { - wrappedCb = function wrappedCb() { + const cb = args[method.length - 1]; + const jimpInstance = this; + if (typeof cb === "function") { + wrappedCb = function () { for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { args[_key5] = arguments[_key5]; } - - var err = args[0], - data = args[1]; - + const [err, data] = args; if (err) { jimpInstance.emitError(methodName, err); } else { - jimpInstance.emitMulti(methodName, evNameAfter, (0, _defineProperty2["default"])({}, methodName, data)); + jimpInstance.emitMulti(methodName, evNameAfter, { + [methodName]: data + }); } - cb.apply(this, args); }; - args[args.length - 1] = wrappedCb; } else { wrappedCb = false; } - this.emitMulti(methodName, evNameBefore); - var result; - + let result; try { result = method.apply(this, args); - if (!wrappedCb) { - this.emitMulti(methodName, evNameAfter, (0, _defineProperty2["default"])({}, methodName, result)); + this.emitMulti(methodName, evNameAfter, { + [methodName]: result + }); } } catch (error) { error.methodName = methodName; this.emitError(methodName, error); } - return result; }; - - Jimp.prototype[methodName + 'Quiet'] = method; + Jimp.prototype[methodName + "Quiet"] = method; } + /** * Creates a new image that is a clone of this one. * @param {function(Error, Jimp)} cb (optional) A callback for when complete * @returns the new image */ - - -jimpEvMethod('clone', 'clone', function (cb) { - var clone = new Jimp(this); - - if ((0, _utils.isNodePattern)(cb)) { +jimpEvMethod("clone", "clone", function (cb) { + const clone = new Jimp(this); + if (isNodePattern(cb)) { cb.call(clone, null, clone); } - return clone; }); + /** * Simplify jimpEvMethod call for the common `change` evName. * @param {string} methodName name of the method * @param {function} method to watch changes for */ - -function jimpEvChange(methodName, method) { - jimpEvMethod(methodName, 'change', method); +export function jimpEvChange(methodName, method) { + jimpEvMethod(methodName, "change", method); } + /** * Sets the type of the image (RGB or RGBA) when saving as PNG format (default is RGBA) * @param b A Boolean, true to use RGBA or false to use RGB * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ - - -jimpEvChange('background', function (hex, cb) { - if (typeof hex !== 'number') { - return _utils.throwError.call(this, 'hex must be a hexadecimal rgba value', cb); +jimpEvChange("background", function (hex, cb) { + if (typeof hex !== "number") { + return throwError.call(this, "hex must be a hexadecimal rgba value", cb); } - this._background = hex; - - if ((0, _utils.isNodePattern)(cb)) { + if (isNodePattern(cb)) { cb.call(this, null, this); } - return this; }); + /** * Scans through a region of the bitmap, calling a function for each pixel. * @param {number} x the x coordinate to begin the scan at @@ -1245,47 +993,35 @@ jimpEvChange('background', function (hex, cb) { * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ - -jimpEvChange('scan', function (x, y, w, h, f, cb) { - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); +jimpEvChange("scan", function (x, y, w, h, f, cb) { + if (typeof x !== "number" || typeof y !== "number") { + return throwError.call(this, "x and y must be numbers", cb); } - - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); + if (typeof w !== "number" || typeof h !== "number") { + return throwError.call(this, "w and h must be numbers", cb); } - - if (typeof f !== 'function') { - return _utils.throwError.call(this, 'f must be a function', cb); + if (typeof f !== "function") { + return throwError.call(this, "f must be a function", cb); } - - var result = (0, _utils.scan)(this, x, y, w, h, f); - - if ((0, _utils.isNodePattern)(cb)) { + const result = scan(this, x, y, w, h, f); + if (isNodePattern(cb)) { cb.call(this, null, result); } - return result; }); - -if (process.env.ENVIRONMENT === 'BROWSER') { +if (process.env.ENVIRONMENT === "BROWSER") { // For use in a web browser or web worker - /* global self */ - var gl; - - if (typeof window !== 'undefined' && (typeof window === "undefined" ? "undefined" : (0, _typeof2["default"])(window)) === 'object') { + let gl; + if (typeof window !== "undefined" && typeof window === "object") { gl = window; } - - if (typeof self !== 'undefined' && (typeof self === "undefined" ? "undefined" : (0, _typeof2["default"])(self)) === 'object') { + if (typeof self !== "undefined" && typeof self === "object") { gl = self; } - gl.Jimp = Jimp; gl.Buffer = Buffer; } - -var _default = Jimp; -exports["default"] = _default; +export { addType } from "./utils/mime"; +export default Jimp; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/index.js.map b/project starter code/node_modules/@jimp/core/es/index.js.map index 8e69060a..cd3c35f6 100644 --- a/project starter code/node_modules/@jimp/core/es/index.js.map +++ b/project starter code/node_modules/@jimp/core/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["alphabet","maxHashLength","NaN","i","maxHash","anyBase","BIN","slice","Array","join","push","length","noop","isArrayBuffer","test","Object","prototype","toString","call","toLowerCase","indexOf","bufferFromArrayBuffer","arrayBuffer","buffer","Buffer","alloc","byteLength","view","Uint8Array","loadFromURL","options","cb","err","response","data","headers","url","location","isBuffer","msg","statusCode","Error","loadBufferFromPath","src","fs","readFile","match","isRawRGBAData","obj","width","height","Uint8ClampedArray","makeRGBABufferFromRGB","rgbaBuffer","allocUnsafe","j","emptyBitmap","Jimp","args","MIME_PNG","path","write","mime","getBase64","getBuffer","getBufferAsync","getPixelColor","setPixelColor","jimpInstance","finish","evData","methodName","setTimeout","emitError","emitMulti","parseInt","w","h","_background","cssColorToHex","throwError","bitmap","writeUInt32BE","parseBitmap","original","from","_quality","_deflateLevel","_deflateStrategy","_filterType","_rgba","_originalMime","imageData","isRGBA","extraConstructor","__extraConstructors","find","c","Promise","resolve","reject","run","then","bool","eventName","assign","emit","getMIME","MIME","getExtension","createWriteStream","getType","pathObj","Path","parse","dir","mkdirp","sync","stream","on","end","AUTO","base","hash","pHash","ImagePHash","getHash","compareHash","currentHash","distance","x","y","edgeHandling","xi","yi","EDGE_EXTEND","Math","round","EDGE_WRAP","idx","getPixelIndex","hex","readUInt32BE","yIndex","xIndex","alpha","EventEmitter","addConstants","constants","entries","forEach","name","value","addJimpMethods","methods","composite","appendConstructorOption","read","image","create","rgbaToInt","r","g","b","a","pow","intToRGBA","rgba","floor","cssColor","Number","toHex8","limit255","n","max","min","diff","img1","img2","threshold","bmp1","bmp2","cloneQuiet","resize","numDiffPixels","percent","phash","hash1","hash2","compareHashes","colorDiff","rgba1","rgba2","maxVal","jimpEvMethod","evName","method","evNameBefore","evNameAfter","replace","wrappedCb","apply","result","error","clone","jimpEvChange","f","process","env","ENVIRONMENT","gl","window","self"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA,IAAMA,QAAQ,GACZ,kEADF,C,CAGA;AACA;;AACA,IAAMC,aAAa,GAAG,CAACC,GAAD,EAAMA,GAAN,CAAtB;;AAEA,KAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAG,EAApB,EAAwBA,CAAC,EAAzB,EAA6B;AAC3B,MAAMC,OAAO,GAAG,yBAAQC,oBAAQC,GAAhB,EAAqBN,QAAQ,CAACO,KAAT,CAAe,CAAf,EAAkBJ,CAAlB,CAArB,EACd,IAAIK,KAAJ,CAAU,KAAK,CAAf,EAAkBC,IAAlB,CAAuB,GAAvB,CADc,CAAhB;AAGAR,EAAAA,aAAa,CAACS,IAAd,CAAmBN,OAAO,CAACO,MAA3B;AACD,C,CAED;;;AACA,SAASC,IAAT,GAAgB,CAAE,C,CAElB;;;AAEA,SAASC,aAAT,CAAuBC,IAAv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AP;AACD;;AAED,MAAM2K,MAAM,GAAG,iBAAK,IAAL,EAAWxE,CAAX,EAAcC,CAAd,EAAiBvD,CAAjB,EAAoBC,CAApB,EAAuBiI,CAAvB,CAAf;;AAEA,MAAI,0BAAc/K,EAAd,CAAJ,EAAuB;AACrBA,IAAAA,EAAE,CAACb,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoBwL,MAApB;AACD;;AAED,SAAOA,MAAP;AACD,CApBW,CAAZ;;AAsBA,IAAIK,OAAO,CAACC,GAAR,CAAYC,WAAZ,KAA4B,SAAhC,EAA2C;AACzC;;AACA;AACA,MAAIC,EAAJ;;AAEA,MAAI,OAAOC,MAAP,KAAkB,WAAlB,IAAiC,QAAOA,MAAP,0DAAOA,MAAP,OAAkB,QAAvD,EAAiE;AAC/DD,IAAAA,EAAE,GAAGC,MAAL;AACD;;AAED,MAAI,OAAOC,IAAP,KAAgB,WAAhB,IAA+B,QAAOA,IAAP,0DAAOA,IAAP,OAAgB,QAAnD,EAA6D;AAC3DF,IAAAA,EAAE,GAAGE,IAAL;AACD;;AAEDF,EAAAA,EAAE,CAACzJ,IAAH,GAAUA,IAAV;AACAyJ,EAAAA,EAAE,CAAC1L,MAAH,GAAYA,MAAZ;AACD;;eAIciC,I","sourcesContent":["import fs from 'fs';\nimport Path from 'path';\nimport EventEmitter from 'events';\n\nimport { isNodePattern, throwError, scan, scanIterator } from '@jimp/utils';\nimport anyBase from 'any-base';\nimport mkdirp from 'mkdirp';\nimport pixelMatch from 'pixelmatch';\nimport tinyColor from 'tinycolor2';\n\nimport ImagePHash from './modules/phash';\nimport request from './request';\n\nimport composite from './composite';\nimport promisify from './utils/promisify';\nimport * as MIME from './utils/mime';\nimport { parseBitmap, getBuffer, getBufferAsync } from './utils/image-bitmap';\nimport * as constants from './constants';\n\nconst alphabet =\n '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_';\n\n// an array storing the maximum string length of hashes at various bases\n// 0 and 1 do not exist as possible hash lengths\nconst maxHashLength = [NaN, NaN];\n\nfor (let i = 2; i < 65; i++) {\n const maxHash = anyBase(anyBase.BIN, alphabet.slice(0, i))(\n new Array(64 + 1).join('1')\n );\n maxHashLength.push(maxHash.length);\n}\n\n// no operation\nfunction noop() {}\n\n// error checking methods\n\nfunction isArrayBuffer(test) {\n return (\n Object.prototype.toString\n .call(test)\n .toLowerCase()\n .indexOf('arraybuffer') > -1\n );\n}\n\n// Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion,\n// But this function is not useful when running in node directly\nfunction bufferFromArrayBuffer(arrayBuffer) {\n const buffer = Buffer.alloc(arrayBuffer.byteLength);\n const view = new Uint8Array(arrayBuffer);\n\n for (let i = 0; i < buffer.length; ++i) {\n buffer[i] = view[i];\n }\n\n return buffer;\n}\n\nfunction loadFromURL(options, cb) {\n request(options, (err, response, data) => {\n if (err) {\n return cb(err);\n }\n\n if ('headers' in response && 'location' in response.headers) {\n options.url = response.headers.location;\n return loadFromURL(options, cb);\n }\n\n if (typeof data === 'object' && Buffer.isBuffer(data)) {\n return cb(null, data);\n }\n\n const msg =\n 'Could not load Buffer from <' +\n options.url +\n '> ' +\n '(HTTP: ' +\n response.statusCode +\n ')';\n\n return new Error(msg);\n });\n}\n\nfunction loadBufferFromPath(src, cb) {\n if (\n fs &&\n typeof fs.readFile === 'function' &&\n !src.match(/^(http|ftp)s?:\\/\\/./)\n ) {\n fs.readFile(src, cb);\n } else {\n loadFromURL({ url: src }, cb);\n }\n}\n\nfunction isRawRGBAData(obj) {\n return (\n obj &&\n typeof obj === 'object' &&\n typeof obj.width === 'number' &&\n typeof obj.height === 'number' &&\n (Buffer.isBuffer(obj.data) ||\n obj.data instanceof Uint8Array ||\n (typeof Uint8ClampedArray === 'function' &&\n obj.data instanceof Uint8ClampedArray)) &&\n (obj.data.length === obj.width * obj.height * 4 ||\n obj.data.length === obj.width * obj.height * 3)\n );\n}\n\nfunction makeRGBABufferFromRGB(buffer) {\n if (buffer.length % 3 !== 0) {\n throw new Error('Buffer length is incorrect');\n }\n\n const rgbaBuffer = Buffer.allocUnsafe((buffer.length / 3) * 4);\n let j = 0;\n\n for (let i = 0; i < buffer.length; i++) {\n rgbaBuffer[j] = buffer[i];\n\n if ((i + 1) % 3 === 0) {\n rgbaBuffer[++j] = 255;\n }\n\n j++;\n }\n\n return rgbaBuffer;\n}\n\nconst emptyBitmap = {\n data: null,\n width: null,\n height: null\n};\n\n/**\n * Jimp constructor (from a file)\n * @param path a path to the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a url with options)\n * @param options { url, otherOptions}\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from another Jimp image or raw image data)\n * @param image a Jimp image to clone\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a Buffer)\n * @param data a Buffer containing the image data\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param background color to fill the image with\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\nclass Jimp extends EventEmitter {\n // An object representing a bitmap in memory, comprising:\n // - data: a buffer of the bitmap data\n // - width: the width of the image in pixels\n // - height: the height of the image in pixels\n bitmap = emptyBitmap;\n\n // Default colour to use for new pixels\n _background = 0x00000000;\n\n // Default MIME is PNG\n _originalMime = Jimp.MIME_PNG;\n\n // Exif data for the image\n _exif = null;\n\n // Whether Transparency supporting formats will be exported as RGB or RGBA\n _rgba = true;\n\n constructor(...args) {\n super();\n\n const jimpInstance = this;\n let cb = noop;\n\n if (isArrayBuffer(args[0])) {\n args[0] = bufferFromArrayBuffer(args[0]);\n }\n\n function finish(...args) {\n const [err] = args;\n const evData = err || {};\n evData.methodName = 'constructor';\n\n setTimeout(() => {\n // run on next tick.\n if (err && cb === noop) {\n jimpInstance.emitError('constructor', err);\n } else if (!err) {\n jimpInstance.emitMulti('constructor', 'initialized');\n }\n\n cb.call(jimpInstance, ...args);\n }, 1);\n }\n\n if (\n (typeof args[0] === 'number' && typeof args[1] === 'number') ||\n (parseInt(args[0], 10) && parseInt(args[1], 10))\n ) {\n // create a new image\n const w = parseInt(args[0], 10);\n const h = parseInt(args[1], 10);\n cb = args[2];\n\n // with a hex color\n if (typeof args[2] === 'number') {\n this._background = args[2];\n cb = args[3];\n }\n\n // with a css color\n if (typeof args[2] === 'string') {\n this._background = Jimp.cssColorToHex(args[2]);\n cb = args[3];\n }\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n this.bitmap = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h\n };\n\n for (let i = 0; i < this.bitmap.data.length; i += 4) {\n this.bitmap.data.writeUInt32BE(this._background, i);\n }\n\n finish(null, this);\n } else if (typeof args[0] === 'object' && args[0].url) {\n cb = args[1] || noop;\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n loadFromURL(args[0], (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n\n this.parseBitmap(data, args[0].url, finish);\n });\n } else if (args[0] instanceof Jimp) {\n // clone an existing Jimp\n const [original] = args;\n cb = args[1];\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n this.bitmap = {\n data: Buffer.from(original.bitmap.data),\n width: original.bitmap.width,\n height: original.bitmap.height\n };\n\n this._quality = original._quality;\n this._deflateLevel = original._deflateLevel;\n this._deflateStrategy = original._deflateStrategy;\n this._filterType = original._filterType;\n this._rgba = original._rgba;\n this._background = original._background;\n this._originalMime = original._originalMime;\n\n finish(null, this);\n } else if (isRawRGBAData(args[0])) {\n const [imageData] = args;\n cb = args[1] || noop;\n\n const isRGBA =\n imageData.width * imageData.height * 4 === imageData.data.length;\n const buffer = isRGBA\n ? Buffer.from(imageData.data)\n : makeRGBABufferFromRGB(imageData.data);\n\n this.bitmap = {\n data: buffer,\n width: imageData.width,\n height: imageData.height\n };\n\n finish(null, this);\n } else if (typeof args[0] === 'string') {\n // read from a path\n const path = args[0];\n cb = args[1];\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n loadBufferFromPath(path, (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n\n this.parseBitmap(data, path, finish);\n });\n } else if (typeof args[0] === 'object' && Buffer.isBuffer(args[0])) {\n // read from a buffer\n const data = args[0];\n cb = args[1];\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', finish);\n }\n\n this.parseBitmap(data, null, finish);\n } else {\n // Allow client libs to add new ways to build a Jimp object.\n // Extra constructors must be added by `Jimp.appendConstructorOption()`\n cb = args[args.length - 1];\n\n if (typeof cb !== 'function') {\n // TODO: try to solve the args after cb problem.\n cb = args[args.length - 2];\n\n if (typeof cb !== 'function') {\n cb = noop;\n }\n }\n\n const extraConstructor = Jimp.__extraConstructors.find(c =>\n c.test(...args)\n );\n\n if (extraConstructor) {\n new Promise((resolve, reject) =>\n extraConstructor.run.call(this, resolve, reject, ...args)\n )\n .then(() => finish(null, this))\n .catch(finish);\n } else {\n return throwError.call(\n this,\n 'No matching constructor overloading was found. ' +\n 'Please see the docs for how to call the Jimp constructor.',\n finish\n );\n }\n }\n }\n\n /**\n * Parse a bitmap with the loaded image types.\n *\n * @param {Buffer} data raw image data\n * @param {string} path optional path to file\n * @param {function(Error, Jimp)} finish (optional) a callback for when complete\n * @memberof Jimp\n */\n parseBitmap(data, path, finish) {\n parseBitmap.call(this, data, null, finish);\n }\n\n /**\n * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA)\n * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rgba(bool, cb) {\n if (typeof bool !== 'boolean') {\n return throwError.call(\n this,\n 'bool must be a boolean, true for RGBA or false for RGB',\n cb\n );\n }\n\n this._rgba = bool;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n\n /**\n * Emit for multiple listeners\n * @param {string} methodName name of the method to emit an error for\n * @param {string} eventName name of the eventName to emit an error for\n * @param {object} data to emit\n */\n emitMulti(methodName, eventName, data = {}) {\n data = Object.assign(data, { methodName, eventName });\n this.emit('any', data);\n\n if (methodName) {\n this.emit(methodName, data);\n }\n\n this.emit(eventName, data);\n }\n\n emitError(methodName, err) {\n this.emitMulti(methodName, 'error', err);\n }\n\n /**\n * Get the current height of the image\n * @return {number} height of the image\n */\n getHeight() {\n return this.bitmap.height;\n }\n\n /**\n * Get the current width of the image\n * @return {number} width of the image\n */\n getWidth() {\n return this.bitmap.width;\n }\n\n /**\n * Nicely format Jimp object when sent to the console e.g. console.log(image)\n * @returns {string} pretty printed\n */\n inspect() {\n return (\n ''\n );\n }\n\n /**\n * Nicely format Jimp object when converted to a string\n * @returns {string} pretty printed\n */\n toString() {\n return '[object Jimp]';\n }\n\n /**\n * Returns the original MIME of the image (default: \"image/png\")\n * @returns {string} the MIME\n */\n getMIME() {\n const mime = this._originalMime || Jimp.MIME_PNG;\n\n return mime;\n }\n\n /**\n * Returns the appropriate file extension for the original MIME of the image (default: \"png\")\n * @returns {string} the file extension\n */\n getExtension() {\n const mime = this.getMIME();\n\n return MIME.getExtension(mime);\n }\n\n /**\n * Writes the image to a file\n * @param {string} path a path to the destination file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk\n * @returns {Jimp} this for chaining of methods\n */\n write(path, cb) {\n if (!fs || !fs.createWriteStream) {\n throw new Error(\n 'Cant access the filesystem. You can use the getBase64 method.'\n );\n }\n\n if (typeof path !== 'string') {\n return throwError.call(this, 'path must be a string', cb);\n }\n\n if (typeof cb === 'undefined') {\n cb = noop;\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', cb);\n }\n\n const mime = MIME.getType(path) || this.getMIME();\n const pathObj = Path.parse(path);\n\n if (pathObj.dir) {\n mkdirp.sync(pathObj.dir);\n }\n\n this.getBuffer(mime, (err, buffer) => {\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n const stream = fs.createWriteStream(path);\n\n stream\n .on('open', () => {\n stream.write(buffer);\n stream.end();\n })\n .on('error', err => {\n return throwError.call(this, err, cb);\n });\n stream.on('finish', () => {\n cb.call(this, null, this);\n });\n });\n\n return this;\n }\n\n writeAsync = path => promisify(this.write, this, path);\n\n /**\n * Converts the image to a base 64 string\n * @param {string} mime the mime type of the image data to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n getBase64(mime, cb) {\n if (mime === Jimp.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n\n if (typeof mime !== 'string') {\n return throwError.call(this, 'mime must be a string', cb);\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', cb);\n }\n\n this.getBuffer(mime, function(err, data) {\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n const src = 'data:' + mime + ';base64,' + data.toString('base64');\n cb.call(this, null, src);\n });\n\n return this;\n }\n\n getBase64Async = mime => promisify(this.getBase64, this, mime);\n\n /**\n * Generates a perceptual hash of the image . And pads the string. Can configure base.\n * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {string} a string representing the hash\n */\n hash(base, cb) {\n base = base || 64;\n\n if (typeof base === 'function') {\n cb = base;\n base = 64;\n }\n\n if (typeof base !== 'number') {\n return throwError.call(this, 'base must be a number', cb);\n }\n\n if (base < 2 || base > 64) {\n return throwError.call(\n this,\n 'base must be a number between 2 and 64',\n cb\n );\n }\n\n let hash = this.pHash();\n hash = anyBase(anyBase.BIN, alphabet.slice(0, base))(hash);\n\n while (hash.length < maxHashLength[base]) {\n hash = '0' + hash; // pad out with leading zeros\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, hash);\n }\n\n return hash;\n }\n\n /**\n * Calculates the perceptual hash\n * @returns {number} the perceptual hash\n */\n pHash() {\n const pHash = new ImagePHash();\n return pHash.getHash(this);\n }\n\n /**\n * Calculates the hamming distance of the current image and a hash based on their perceptual hash\n * @param {hash} compareHash hash to compare to\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\n distanceFromHash(compareHash) {\n const pHash = new ImagePHash();\n const currentHash = pHash.getHash(this);\n\n return pHash.distance(currentHash, compareHash);\n }\n\n /**\n * Converts the image to a buffer\n * @param {string} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n getBuffer = getBuffer;\n\n getBufferAsync = getBufferAsync;\n\n /**\n * Returns the offset of a pixel in the bitmap buffer\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {string} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {number} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n getPixelIndex(x, y, edgeHandling, cb) {\n let xi;\n let yi;\n\n if (typeof edgeHandling === 'function' && typeof cb === 'undefined') {\n cb = edgeHandling;\n edgeHandling = null;\n }\n\n if (!edgeHandling) {\n edgeHandling = Jimp.EDGE_EXTEND;\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n xi = x;\n yi = y;\n\n if (edgeHandling === Jimp.EDGE_EXTEND) {\n if (x < 0) xi = 0;\n if (x >= this.bitmap.width) xi = this.bitmap.width - 1;\n if (y < 0) yi = 0;\n if (y >= this.bitmap.height) yi = this.bitmap.height - 1;\n }\n\n if (edgeHandling === Jimp.EDGE_WRAP) {\n if (x < 0) {\n xi = this.bitmap.width + x;\n }\n\n if (x >= this.bitmap.width) {\n xi = x % this.bitmap.width;\n }\n\n if (y < 0) {\n xi = this.bitmap.height + y;\n }\n\n if (y >= this.bitmap.height) {\n yi = y % this.bitmap.height;\n }\n }\n\n let i = (this.bitmap.width * yi + xi) << 2;\n\n // if out of bounds index is -1\n if (xi < 0 || xi >= this.bitmap.width) {\n i = -1;\n }\n\n if (yi < 0 || yi >= this.bitmap.height) {\n i = -1;\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n\n return i;\n }\n\n /**\n * Returns the hex colour value of a pixel\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the color of the pixel\n */\n getPixelColor(x, y, cb) {\n if (typeof x !== 'number' || typeof y !== 'number')\n return throwError.call(this, 'x and y must be numbers', cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const idx = this.getPixelIndex(x, y);\n const hex = this.bitmap.data.readUInt32BE(idx);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, hex);\n }\n\n return hex;\n }\n\n getPixelColour = this.getPixelColor;\n\n /**\n * Returns the hex colour value of a pixel\n * @param {number} hex color to set\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n setPixelColor(hex, x, y, cb) {\n if (\n typeof hex !== 'number' ||\n typeof x !== 'number' ||\n typeof y !== 'number'\n )\n return throwError.call(this, 'hex, x and y must be numbers', cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const idx = this.getPixelIndex(x, y);\n this.bitmap.data.writeUInt32BE(hex, idx);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n\n setPixelColour = this.setPixelColor;\n\n /**\n * Determine if the image contains opaque pixels.\n * @return {boolean} hasAlpha whether the image contains opaque pixels\n */\n hasAlpha() {\n for (let yIndex = 0; yIndex < this.bitmap.height; yIndex++) {\n for (let xIndex = 0; xIndex < this.bitmap.width; xIndex++) {\n const idx = (this.bitmap.width * yIndex + xIndex) << 2;\n const alpha = this.bitmap.data[idx + 3];\n\n if (alpha !== 0xff) {\n return true;\n }\n }\n }\n\n return false;\n }\n\n /**\n * Iterate scan through a region of the bitmap\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>}\n */\n scanIterator(x, y, w, h) {\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers');\n }\n\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers');\n }\n\n return scanIterator(this, x, y, w, h);\n }\n}\n\nexport function addConstants(constants, jimpInstance = Jimp) {\n Object.entries(constants).forEach(([name, value]) => {\n jimpInstance[name] = value;\n });\n}\n\nexport function addJimpMethods(methods, jimpInstance = Jimp) {\n Object.entries(methods).forEach(([name, value]) => {\n jimpInstance.prototype[name] = value;\n });\n}\n\naddConstants(constants);\naddJimpMethods({ composite });\n\nJimp.__extraConstructors = [];\n\n/**\n * Allow client libs to add new ways to build a Jimp object.\n * @param {string} name identify the extra constructor.\n * @param {function} test a function that returns true when it accepts the arguments passed to the main constructor.\n * @param {function} run where the magic happens.\n */\nJimp.appendConstructorOption = function(name, test, run) {\n Jimp.__extraConstructors.push({ name, test, run });\n};\n\n/**\n * Read an image from a file or a Buffer. Takes the same args as the constructor\n * @returns {Promise} a promise\n */\nJimp.read = function(...args) {\n return new Promise((resolve, reject) => {\n new Jimp(...args, (err, image) => {\n if (err) reject(err);\n else resolve(image);\n });\n });\n};\n\nJimp.create = Jimp.read;\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} r the red value (0-255)\n * @param {number} g the green value (0-255)\n * @param {number} b the blue value (0-255)\n * @param {number} a the alpha value (0-255)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {number} an single integer colour value\n */\nJimp.rgbaToInt = function(r, g, b, a, cb) {\n if (\n typeof r !== 'number' ||\n typeof g !== 'number' ||\n typeof b !== 'number' ||\n typeof a !== 'number'\n ) {\n return throwError.call(this, 'r, g, b and a must be numbers', cb);\n }\n\n if (r < 0 || r > 255) {\n return throwError.call(this, 'r must be between 0 and 255', cb);\n }\n\n if (g < 0 || g > 255) {\n throwError.call(this, 'g must be between 0 and 255', cb);\n }\n\n if (b < 0 || b > 255) {\n return throwError.call(this, 'b must be between 0 and 255', cb);\n }\n\n if (a < 0 || a > 255) {\n return throwError.call(this, 'a must be between 0 and 255', cb);\n }\n\n r = Math.round(r);\n b = Math.round(b);\n g = Math.round(g);\n a = Math.round(a);\n\n const i =\n r * Math.pow(256, 3) +\n g * Math.pow(256, 2) +\n b * Math.pow(256, 1) +\n a * Math.pow(256, 0);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n\n return i;\n};\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} i a single integer value representing an RGBA colour (e.g. 0xFF0000FF for red)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {object} an object with the properties r, g, b and a representing RGBA values\n */\nJimp.intToRGBA = function(i, cb) {\n if (typeof i !== 'number') {\n return throwError.call(this, 'i must be a number', cb);\n }\n\n const rgba = {};\n\n rgba.r = Math.floor(i / Math.pow(256, 3));\n rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));\n rgba.b = Math.floor(\n (i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) /\n Math.pow(256, 1)\n );\n rgba.a = Math.floor(\n (i -\n rgba.r * Math.pow(256, 3) -\n rgba.g * Math.pow(256, 2) -\n rgba.b * Math.pow(256, 1)) /\n Math.pow(256, 0)\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, rgba);\n }\n\n return rgba;\n};\n\n/**\n * Converts a css color (Hex, 8-digit (RGBA) Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, Named) to a hex number\n * @param {string} cssColor a number\n * @returns {number} a hex number representing a color\n */\nJimp.cssColorToHex = function(cssColor) {\n cssColor = cssColor || 0; // 0, null, undefined, NaN\n\n if (typeof cssColor === 'number') return Number(cssColor);\n\n return parseInt(tinyColor(cssColor).toHex8(), 16);\n};\n\n/**\n * Limits a number to between 0 or 255\n * @param {number} n a number\n * @returns {number} the number limited to between 0 or 255\n */\nJimp.limit255 = function(n) {\n n = Math.max(n, 0);\n n = Math.min(n, 255);\n\n return n;\n};\n\n/**\n * Diffs two images and returns\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @param {number} threshold (optional) a number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1)\n * @returns {object} an object { percent: percent similar, diff: a Jimp image highlighting differences }\n */\nJimp.diff = function(img1, img2, threshold = 0.1) {\n if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp))\n return throwError.call(this, 'img1 and img2 must be an Jimp images');\n\n const bmp1 = img1.bitmap;\n const bmp2 = img2.bitmap;\n\n if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) {\n if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) {\n // img1 is bigger\n img1 = img1.cloneQuiet().resize(bmp2.width, bmp2.height);\n } else {\n // img2 is bigger (or they are the same in area)\n img2 = img2.cloneQuiet().resize(bmp1.width, bmp1.height);\n }\n }\n\n if (typeof threshold !== 'number' || threshold < 0 || threshold > 1) {\n return throwError.call(this, 'threshold must be a number between 0 and 1');\n }\n\n const diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff);\n\n const numDiffPixels = pixelMatch(\n bmp1.data,\n bmp2.data,\n diff.bitmap.data,\n diff.bitmap.width,\n diff.bitmap.height,\n { threshold }\n );\n\n return {\n percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height),\n image: diff\n };\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.distance = function(img1, img2) {\n const phash = new ImagePHash();\n const hash1 = phash.getHash(img1);\n const hash2 = phash.getHash(img2);\n\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {hash} hash1 a pHash\n * @param {hash} hash2 a pHash\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.compareHashes = function(hash1, hash2) {\n const phash = new ImagePHash();\n\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Compute color difference\n * 0 means no difference, 1 means maximum difference.\n * @param {number} rgba1: first color to compare.\n * @param {number} rgba2: second color to compare.\n * Both parameters must be an color object {r:val, g:val, b:val, a:val}\n * Where `a` is optional and `val` is an integer between 0 and 255.\n * @returns {number} float between 0 and 1.\n */\nJimp.colorDiff = function(rgba1, rgba2) {\n const pow = n => Math.pow(n, 2);\n const { max } = Math;\n const maxVal = 255 * 255 * 3;\n\n if (rgba1.a !== 0 && !rgba1.a) {\n rgba1.a = 255;\n }\n\n if (rgba2.a !== 0 && !rgba2.a) {\n rgba2.a = 255;\n }\n\n return (\n (max(pow(rgba1.r - rgba2.r), pow(rgba1.r - rgba2.r - rgba1.a + rgba2.a)) +\n max(pow(rgba1.g - rgba2.g), pow(rgba1.g - rgba2.g - rgba1.a + rgba2.a)) +\n max(pow(rgba1.b - rgba2.b), pow(rgba1.b - rgba2.b - rgba1.a + rgba2.a))) /\n maxVal\n );\n};\n\n/**\n * Helper to create Jimp methods that emit events before and after its execution.\n * @param {string} methodName The name to be appended to Jimp prototype.\n * @param {string} evName The event name to be called.\n * It will be prefixed by `before-` and emitted when on method call.\n * It will be appended by `ed` and emitted after the method run.\n * @param {function} method A function implementing the method itself.\n * It will also create a quiet version that will not emit events, to not\n * mess the user code with many `changed` event calls. You can call with\n * `methodName + \"Quiet\"`.\n *\n * The emitted event comes with a object parameter to the listener with the\n * `methodName` as one attribute.\n */\nexport function jimpEvMethod(methodName, evName, method) {\n const evNameBefore = 'before-' + evName;\n const evNameAfter = evName.replace(/e$/, '') + 'ed';\n\n Jimp.prototype[methodName] = function(...args) {\n let wrappedCb;\n const cb = args[method.length - 1];\n const jimpInstance = this;\n\n if (typeof cb === 'function') {\n wrappedCb = function(...args) {\n const [err, data] = args;\n\n if (err) {\n jimpInstance.emitError(methodName, err);\n } else {\n jimpInstance.emitMulti(methodName, evNameAfter, {\n [methodName]: data\n });\n }\n\n cb.apply(this, args);\n };\n\n args[args.length - 1] = wrappedCb;\n } else {\n wrappedCb = false;\n }\n\n this.emitMulti(methodName, evNameBefore);\n\n let result;\n\n try {\n result = method.apply(this, args);\n\n if (!wrappedCb) {\n this.emitMulti(methodName, evNameAfter, {\n [methodName]: result\n });\n }\n } catch (error) {\n error.methodName = methodName;\n this.emitError(methodName, error);\n }\n\n return result;\n };\n\n Jimp.prototype[methodName + 'Quiet'] = method;\n}\n\n/**\n * Creates a new image that is a clone of this one.\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns the new image\n */\njimpEvMethod('clone', 'clone', function(cb) {\n const clone = new Jimp(this);\n\n if (isNodePattern(cb)) {\n cb.call(clone, null, clone);\n }\n\n return clone;\n});\n\n/**\n * Simplify jimpEvMethod call for the common `change` evName.\n * @param {string} methodName name of the method\n * @param {function} method to watch changes for\n */\nexport function jimpEvChange(methodName, method) {\n jimpEvMethod(methodName, 'change', method);\n}\n\n/**\n * Sets the type of the image (RGB or RGBA) when saving as PNG format (default is RGBA)\n * @param b A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange('background', function(hex, cb) {\n if (typeof hex !== 'number') {\n return throwError.call(this, 'hex must be a hexadecimal rgba value', cb);\n }\n\n this._background = hex;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n});\n\n/**\n * Scans through a region of the bitmap, calling a function for each pixel.\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @param f a function to call on even pixel; the (x, y) position of the pixel\n * and the index of the pixel in the bitmap buffer are passed to the function\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange('scan', function(x, y, w, h, f, cb) {\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (typeof f !== 'function') {\n return throwError.call(this, 'f must be a function', cb);\n }\n\n const result = scan(this, x, y, w, h, f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, result);\n }\n\n return result;\n});\n\nif (process.env.ENVIRONMENT === 'BROWSER') {\n // For use in a web browser or web worker\n /* global self */\n let gl;\n\n if (typeof window !== 'undefined' && typeof window === 'object') {\n gl = window;\n }\n\n if (typeof self !== 'undefined' && typeof self === 'object') {\n gl = self;\n }\n\n gl.Jimp = Jimp;\n gl.Buffer = Buffer;\n}\n\nexport { addType } from './utils/mime';\n\nexport default Jimp;\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["fs","Path","EventEmitter","isNodePattern","throwError","scan","scanIterator","anyBase","pixelMatch","tinyColor","ImagePHash","request","composite","promisify","MIME","parseBitmap","getBuffer","getBufferAsync","constants","alphabet","maxHashLength","NaN","i","maxHash","BIN","slice","Array","join","push","length","noop","isArrayBuffer","test","Object","prototype","toString","call","toLowerCase","indexOf","bufferFromArrayBuffer","arrayBuffer","buffer","Buffer","alloc","byteLength","view","Uint8Array","loadFromURL","options","cb","err","data","isBuffer","Error","url","loadBufferFromPath","src","readFile","match","isRawRGBAData","obj","width","height","Uint8ClampedArray","makeRGBABufferFromRGB","rgbaBuffer","allocUnsafe","j","emptyBitmap","Jimp","constructor","args","MIME_PNG","path","write","mime","getBase64","getPixelColor","setPixelColor","jimpInstance","finish","evData","methodName","setTimeout","emitError","emitMulti","parseInt","w","h","_background","cssColorToHex","bitmap","writeUInt32BE","original","from","_quality","_deflateLevel","_deflateStrategy","_filterType","_rgba","_originalMime","imageData","isRGBA","extraConstructor","__extraConstructors","find","c","Promise","resolve","reject","run","then","catch","rgba","bool","eventName","assign","emit","getHeight","getWidth","inspect","getMIME","getExtension","createWriteStream","getType","pathObj","parse","dir","mkdirSync","recursive","stream","on","end","AUTO","hash","base","pHash","getHash","distanceFromHash","compareHash","currentHash","distance","getPixelIndex","x","y","edgeHandling","xi","yi","EDGE_EXTEND","Math","round","EDGE_WRAP","idx","hex","readUInt32BE","hasAlpha","byteLen","addConstants","entries","forEach","name","value","addJimpMethods","methods","appendConstructorOption","read","image","create","rgbaToInt","r","g","b","a","intToRGBA","floor","pow","cssColor","Number","toHex8","limit255","n","max","min","diff","img1","img2","threshold","bmp1","bmp2","cloneQuiet","resize","numDiffPixels","percent","phash","hash1","hash2","compareHashes","colorDiff","rgba1","rgba2","maxVal","jimpEvMethod","evName","method","evNameBefore","evNameAfter","replace","wrappedCb","apply","result","error","clone","jimpEvChange","f","process","env","ENVIRONMENT","gl","window","self","addType"],"sources":["../src/index.js"],"sourcesContent":["import fs from \"fs\";\nimport Path from \"path\";\nimport EventEmitter from \"events\";\n\nimport { isNodePattern, throwError, scan, scanIterator } from \"@jimp/utils\";\nimport anyBase from \"any-base\";\nimport pixelMatch from \"pixelmatch\";\nimport tinyColor from \"tinycolor2\";\n\nimport ImagePHash from \"./modules/phash\";\nimport request from \"./request\";\n\nimport composite from \"./composite\";\nimport promisify from \"./utils/promisify\";\nimport * as MIME from \"./utils/mime\";\nimport { parseBitmap, getBuffer, getBufferAsync } from \"./utils/image-bitmap\";\nimport * as constants from \"./constants\";\n\nconst alphabet =\n \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_\";\n\n// an array storing the maximum string length of hashes at various bases\n// 0 and 1 do not exist as possible hash lengths\nconst maxHashLength = [NaN, NaN];\n\nfor (let i = 2; i < 65; i++) {\n const maxHash = anyBase(\n anyBase.BIN,\n alphabet.slice(0, i)\n )(new Array(64 + 1).join(\"1\"));\n maxHashLength.push(maxHash.length);\n}\n\n// no operation\nfunction noop() {}\n\n// error checking methods\n\nfunction isArrayBuffer(test) {\n return (\n Object.prototype.toString.call(test).toLowerCase().indexOf(\"arraybuffer\") >\n -1\n );\n}\n\n// Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion,\n// But this function is not useful when running in node directly\nfunction bufferFromArrayBuffer(arrayBuffer) {\n const buffer = Buffer.alloc(arrayBuffer.byteLength);\n const view = new Uint8Array(arrayBuffer);\n\n for (let i = 0; i < buffer.length; ++i) {\n buffer[i] = view[i];\n }\n\n return buffer;\n}\n\nfunction loadFromURL(options, cb) {\n request(options, (err, data) => {\n if (err) {\n return cb(err);\n }\n\n if (typeof data === \"object\" && Buffer.isBuffer(data)) {\n return cb(null, data);\n }\n\n if (typeof data === \"object\" && isArrayBuffer(data)) {\n return cb(null, bufferFromArrayBuffer(data));\n }\n\n return new Error(`Could not load Buffer from <${options.url}>`);\n });\n}\n\nfunction loadBufferFromPath(src, cb) {\n if (\n fs &&\n typeof fs.readFile === \"function\" &&\n !src.match(/^(http|ftp)s?:\\/\\/./)\n ) {\n fs.readFile(src, cb);\n } else {\n loadFromURL({ url: src }, cb);\n }\n}\n\nfunction isRawRGBAData(obj) {\n return (\n obj &&\n typeof obj === \"object\" &&\n typeof obj.width === \"number\" &&\n typeof obj.height === \"number\" &&\n (Buffer.isBuffer(obj.data) ||\n obj.data instanceof Uint8Array ||\n (typeof Uint8ClampedArray === \"function\" &&\n obj.data instanceof Uint8ClampedArray)) &&\n (obj.data.length === obj.width * obj.height * 4 ||\n obj.data.length === obj.width * obj.height * 3)\n );\n}\n\nfunction makeRGBABufferFromRGB(buffer) {\n if (buffer.length % 3 !== 0) {\n throw new Error(\"Buffer length is incorrect\");\n }\n\n const rgbaBuffer = Buffer.allocUnsafe((buffer.length / 3) * 4);\n let j = 0;\n\n for (let i = 0; i < buffer.length; i++) {\n rgbaBuffer[j] = buffer[i];\n\n if ((i + 1) % 3 === 0) {\n rgbaBuffer[++j] = 255;\n }\n\n j++;\n }\n\n return rgbaBuffer;\n}\n\nconst emptyBitmap = {\n data: null,\n width: null,\n height: null,\n};\n\n/**\n * Jimp constructor (from a file)\n * @param path a path to the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a url with options)\n * @param options { url, otherOptions}\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from another Jimp image or raw image data)\n * @param image a Jimp image to clone\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a Buffer)\n * @param data a Buffer containing the image data\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param background color to fill the image with\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\nclass Jimp extends EventEmitter {\n // An object representing a bitmap in memory, comprising:\n // - data: a buffer of the bitmap data\n // - width: the width of the image in pixels\n // - height: the height of the image in pixels\n bitmap = emptyBitmap;\n\n // Default colour to use for new pixels\n _background = 0x00000000;\n\n // Default MIME is PNG\n _originalMime = Jimp.MIME_PNG;\n\n // Exif data for the image\n _exif = null;\n\n // Whether Transparency supporting formats will be exported as RGB or RGBA\n _rgba = true;\n\n constructor(...args) {\n super();\n\n const jimpInstance = this;\n let cb = noop;\n\n if (isArrayBuffer(args[0])) {\n args[0] = bufferFromArrayBuffer(args[0]);\n }\n\n function finish(...args) {\n const [err] = args;\n const evData = err || {};\n evData.methodName = \"constructor\";\n\n setTimeout(() => {\n // run on next tick.\n if (err && cb === noop) {\n jimpInstance.emitError(\"constructor\", err);\n } else if (!err) {\n jimpInstance.emitMulti(\"constructor\", \"initialized\");\n }\n\n cb.call(jimpInstance, ...args);\n }, 1);\n }\n\n if (\n (typeof args[0] === \"number\" && typeof args[1] === \"number\") ||\n (parseInt(args[0], 10) && parseInt(args[1], 10))\n ) {\n // create a new image\n const w = parseInt(args[0], 10);\n const h = parseInt(args[1], 10);\n cb = args[2];\n\n // with a hex color\n if (typeof args[2] === \"number\") {\n this._background = args[2];\n cb = args[3];\n }\n\n // with a css color\n if (typeof args[2] === \"string\") {\n this._background = Jimp.cssColorToHex(args[2]);\n cb = args[3];\n }\n\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n this.bitmap = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h,\n };\n\n for (let i = 0; i < this.bitmap.data.length; i += 4) {\n this.bitmap.data.writeUInt32BE(this._background, i);\n }\n\n finish(null, this);\n } else if (typeof args[0] === \"object\" && args[0].url) {\n cb = args[1] || noop;\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n loadFromURL(args[0], (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n\n this.parseBitmap(data, args[0].url, finish);\n });\n } else if (args[0] instanceof Jimp) {\n // clone an existing Jimp\n const [original] = args;\n cb = args[1];\n\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n this.bitmap = {\n data: Buffer.from(original.bitmap.data),\n width: original.bitmap.width,\n height: original.bitmap.height,\n };\n\n this._quality = original._quality;\n this._deflateLevel = original._deflateLevel;\n this._deflateStrategy = original._deflateStrategy;\n this._filterType = original._filterType;\n this._rgba = original._rgba;\n this._background = original._background;\n this._originalMime = original._originalMime;\n\n finish(null, this);\n } else if (isRawRGBAData(args[0])) {\n const [imageData] = args;\n cb = args[1] || noop;\n\n const isRGBA =\n imageData.width * imageData.height * 4 === imageData.data.length;\n const buffer = isRGBA\n ? Buffer.from(imageData.data)\n : makeRGBABufferFromRGB(imageData.data);\n\n this.bitmap = {\n data: buffer,\n width: imageData.width,\n height: imageData.height,\n };\n\n finish(null, this);\n } else if (typeof args[0] === \"string\") {\n // read from a path\n const path = args[0];\n cb = args[1];\n\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n loadBufferFromPath(path, (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n\n this.parseBitmap(data, path, finish);\n });\n } else if (typeof args[0] === \"object\" && Buffer.isBuffer(args[0])) {\n // read from a buffer\n const data = args[0];\n cb = args[1];\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n\n this.parseBitmap(data, null, finish);\n } else {\n // Allow client libs to add new ways to build a Jimp object.\n // Extra constructors must be added by `Jimp.appendConstructorOption()`\n cb = args[args.length - 1];\n\n if (typeof cb !== \"function\") {\n // TODO: try to solve the args after cb problem.\n cb = args[args.length - 2];\n\n if (typeof cb !== \"function\") {\n cb = noop;\n }\n }\n\n const extraConstructor = Jimp.__extraConstructors.find((c) =>\n c.test(...args)\n );\n\n if (extraConstructor) {\n new Promise((resolve, reject) => {\n extraConstructor.run.call(this, resolve, reject, ...args);\n })\n .then(() => finish(null, this))\n .catch(finish);\n } else {\n return throwError.call(\n this,\n \"No matching constructor overloading was found. \" +\n \"Please see the docs for how to call the Jimp constructor.\",\n finish\n );\n }\n }\n }\n\n /**\n * Parse a bitmap with the loaded image types.\n *\n * @param {Buffer} data raw image data\n * @param {string} path optional path to file\n * @param {function(Error, Jimp)} finish (optional) a callback for when complete\n * @memberof Jimp\n */\n parseBitmap(data, path, finish) {\n parseBitmap.call(this, data, null, finish);\n }\n\n /**\n * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA)\n * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rgba(bool, cb) {\n if (typeof bool !== \"boolean\") {\n return throwError.call(\n this,\n \"bool must be a boolean, true for RGBA or false for RGB\",\n cb\n );\n }\n\n this._rgba = bool;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n\n /**\n * Emit for multiple listeners\n * @param {string} methodName name of the method to emit an error for\n * @param {string} eventName name of the eventName to emit an error for\n * @param {object} data to emit\n */\n emitMulti(methodName, eventName, data = {}) {\n data = Object.assign(data, { methodName, eventName });\n this.emit(\"any\", data);\n\n if (methodName) {\n this.emit(methodName, data);\n }\n\n this.emit(eventName, data);\n }\n\n emitError(methodName, err) {\n this.emitMulti(methodName, \"error\", err);\n }\n\n /**\n * Get the current height of the image\n * @return {number} height of the image\n */\n getHeight() {\n return this.bitmap.height;\n }\n\n /**\n * Get the current width of the image\n * @return {number} width of the image\n */\n getWidth() {\n return this.bitmap.width;\n }\n\n /**\n * Nicely format Jimp object when sent to the console e.g. console.log(image)\n * @returns {string} pretty printed\n */\n inspect() {\n return (\n \"\"\n );\n }\n\n /**\n * Nicely format Jimp object when converted to a string\n * @returns {string} pretty printed\n */\n toString() {\n return \"[object Jimp]\";\n }\n\n /**\n * Returns the original MIME of the image (default: \"image/png\")\n * @returns {string} the MIME\n */\n getMIME() {\n const mime = this._originalMime || Jimp.MIME_PNG;\n\n return mime;\n }\n\n /**\n * Returns the appropriate file extension for the original MIME of the image (default: \"png\")\n * @returns {string} the file extension\n */\n getExtension() {\n const mime = this.getMIME();\n\n return MIME.getExtension(mime);\n }\n\n /**\n * Writes the image to a file\n * @param {string} path a path to the destination file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk\n * @returns {Jimp} this for chaining of methods\n */\n write(path, cb) {\n if (!fs || !fs.createWriteStream) {\n throw new Error(\n \"Cant access the filesystem. You can use the getBase64 method.\"\n );\n }\n\n if (typeof path !== \"string\") {\n return throwError.call(this, \"path must be a string\", cb);\n }\n\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", cb);\n }\n\n const mime = MIME.getType(path) || this.getMIME();\n const pathObj = Path.parse(path);\n\n if (pathObj.dir) {\n fs.mkdirSync(pathObj.dir, { recursive: true });\n }\n\n this.getBuffer(mime, (err, buffer) => {\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n const stream = fs.createWriteStream(path);\n\n stream\n .on(\"open\", () => {\n stream.write(buffer);\n stream.end();\n })\n .on(\"error\", (err) => {\n return throwError.call(this, err, cb);\n });\n stream.on(\"finish\", () => {\n cb.call(this, null, this);\n });\n });\n\n return this;\n }\n\n writeAsync = (path) => promisify(this.write, this, path);\n\n /**\n * Converts the image to a base 64 string\n * @param {string} mime the mime type of the image data to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n getBase64(mime, cb) {\n if (mime === Jimp.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n\n if (typeof mime !== \"string\") {\n return throwError.call(this, \"mime must be a string\", cb);\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", cb);\n }\n\n this.getBuffer(mime, function (err, data) {\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n const src = \"data:\" + mime + \";base64,\" + data.toString(\"base64\");\n cb.call(this, null, src);\n });\n\n return this;\n }\n\n getBase64Async = (mime) => promisify(this.getBase64, this, mime);\n\n /**\n * Generates a perceptual hash of the image . And pads the string. Can configure base.\n * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {string} a string representing the hash\n */\n hash(base, cb) {\n base = base || 64;\n\n if (typeof base === \"function\") {\n cb = base;\n base = 64;\n }\n\n if (typeof base !== \"number\") {\n return throwError.call(this, \"base must be a number\", cb);\n }\n\n if (base < 2 || base > 64) {\n return throwError.call(\n this,\n \"base must be a number between 2 and 64\",\n cb\n );\n }\n\n let hash = this.pHash();\n hash = anyBase(anyBase.BIN, alphabet.slice(0, base))(hash);\n\n while (hash.length < maxHashLength[base]) {\n hash = \"0\" + hash; // pad out with leading zeros\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, hash);\n }\n\n return hash;\n }\n\n /**\n * Calculates the perceptual hash\n * @returns {number} the perceptual hash\n */\n pHash() {\n const pHash = new ImagePHash();\n return pHash.getHash(this);\n }\n\n /**\n * Calculates the hamming distance of the current image and a hash based on their perceptual hash\n * @param {hash} compareHash hash to compare to\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\n distanceFromHash(compareHash) {\n const pHash = new ImagePHash();\n const currentHash = pHash.getHash(this);\n\n return pHash.distance(currentHash, compareHash);\n }\n\n /**\n * Converts the image to a buffer\n * @param {string} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n getBuffer = getBuffer;\n\n getBufferAsync = getBufferAsync;\n\n /**\n * Returns the offset of a pixel in the bitmap buffer\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {number} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {number} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n getPixelIndex(x, y, edgeHandling, cb) {\n let xi;\n let yi;\n\n if (typeof edgeHandling === \"function\" && typeof cb === \"undefined\") {\n cb = edgeHandling;\n edgeHandling = null;\n }\n\n if (!edgeHandling) {\n edgeHandling = Jimp.EDGE_EXTEND;\n }\n\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n xi = x;\n yi = y;\n\n if (edgeHandling === Jimp.EDGE_EXTEND) {\n if (x < 0) xi = 0;\n if (x >= this.bitmap.width) xi = this.bitmap.width - 1;\n if (y < 0) yi = 0;\n if (y >= this.bitmap.height) yi = this.bitmap.height - 1;\n }\n\n if (edgeHandling === Jimp.EDGE_WRAP) {\n if (x < 0) {\n xi = this.bitmap.width + x;\n }\n\n if (x >= this.bitmap.width) {\n xi = x % this.bitmap.width;\n }\n\n if (y < 0) {\n yi = this.bitmap.height + y;\n }\n\n if (y >= this.bitmap.height) {\n yi = y % this.bitmap.height;\n }\n }\n\n let i = (this.bitmap.width * yi + xi) << 2;\n\n // if out of bounds index is -1\n if (xi < 0 || xi >= this.bitmap.width) {\n i = -1;\n }\n\n if (yi < 0 || yi >= this.bitmap.height) {\n i = -1;\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n\n return i;\n }\n\n /**\n * Returns the hex colour value of a pixel\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the color of the pixel\n */\n getPixelColor(x, y, cb) {\n if (typeof x !== \"number\" || typeof y !== \"number\")\n return throwError.call(this, \"x and y must be numbers\", cb);\n\n const idx = this.getPixelIndex(x, y);\n const hex = this.bitmap.data.readUInt32BE(idx);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, hex);\n }\n\n return hex;\n }\n\n getPixelColour = this.getPixelColor;\n\n /**\n * Returns the hex colour value of a pixel\n * @param {number} hex color to set\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n setPixelColor(hex, x, y, cb) {\n if (\n typeof hex !== \"number\" ||\n typeof x !== \"number\" ||\n typeof y !== \"number\"\n )\n return throwError.call(this, \"hex, x and y must be numbers\", cb);\n\n const idx = this.getPixelIndex(x, y);\n this.bitmap.data.writeUInt32BE(hex, idx);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n\n setPixelColour = this.setPixelColor;\n\n /**\n * Determine if the image contains opaque pixels.\n * @return {boolean} hasAlpha whether the image contains opaque pixels\n */\n hasAlpha() {\n const {width, height, data} = this.bitmap;\n const byteLen = (width * height) << 2;\n\n for (let idx = 3; idx < byteLen; idx += 4) {\n if (data[idx] !== 0xff) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Iterate scan through a region of the bitmap\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>}\n */\n scanIterator(x, y, w, h) {\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\");\n }\n\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\");\n }\n\n return scanIterator(this, x, y, w, h);\n }\n}\n\nexport function addConstants(constants, jimpInstance = Jimp) {\n Object.entries(constants).forEach(([name, value]) => {\n jimpInstance[name] = value;\n });\n}\n\nexport function addJimpMethods(methods, jimpInstance = Jimp) {\n Object.entries(methods).forEach(([name, value]) => {\n jimpInstance.prototype[name] = value;\n });\n}\n\naddConstants(constants);\naddJimpMethods({ composite });\n\nJimp.__extraConstructors = [];\n\n/**\n * Allow client libs to add new ways to build a Jimp object.\n * @param {string} name identify the extra constructor.\n * @param {function} test a function that returns true when it accepts the arguments passed to the main constructor.\n * @param {function} run where the magic happens.\n */\nJimp.appendConstructorOption = function (name, test, run) {\n Jimp.__extraConstructors.push({ name, test, run });\n};\n\n/**\n * Read an image from a file or a Buffer. Takes the same args as the constructor\n * @returns {Promise} a promise\n */\nJimp.read = function (...args) {\n return new Promise((resolve, reject) => {\n // eslint-disable-next-line no-new\n new Jimp(...args, (err, image) => {\n if (err) reject(err);\n else resolve(image);\n });\n });\n};\n\nJimp.create = Jimp.read;\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} r the red value (0-255)\n * @param {number} g the green value (0-255)\n * @param {number} b the blue value (0-255)\n * @param {number} a the alpha value (0-255)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {number} an single integer colour value\n */\nJimp.rgbaToInt = function (r, g, b, a, cb) {\n if (\n typeof r !== \"number\" ||\n typeof g !== \"number\" ||\n typeof b !== \"number\" ||\n typeof a !== \"number\"\n ) {\n return throwError.call(this, \"r, g, b and a must be numbers\", cb);\n }\n\n if (r < 0 || r > 255) {\n return throwError.call(this, \"r must be between 0 and 255\", cb);\n }\n\n if (g < 0 || g > 255) {\n throwError.call(this, \"g must be between 0 and 255\", cb);\n }\n\n if (b < 0 || b > 255) {\n return throwError.call(this, \"b must be between 0 and 255\", cb);\n }\n\n if (a < 0 || a > 255) {\n return throwError.call(this, \"a must be between 0 and 255\", cb);\n }\n\n let i = (r & 0xff);\n i <<= 8;\n i |= (g & 0xff)\n i <<= 8;\n i |= (b & 0xff)\n i <<= 8;\n i |= (a & 0xff);\n\n // Ensure sign is correct\n i >>>= 0;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n\n return i;\n};\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} i a single integer value representing an RGBA colour (e.g. 0xFF0000FF for red)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {object} an object with the properties r, g, b and a representing RGBA values\n */\nJimp.intToRGBA = function (i, cb) {\n if (typeof i !== \"number\") {\n return throwError.call(this, \"i must be a number\", cb);\n }\n\n const rgba = {};\n\n rgba.r = Math.floor(i / Math.pow(256, 3));\n rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));\n rgba.b = Math.floor(\n (i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) /\n Math.pow(256, 1)\n );\n rgba.a = Math.floor(\n (i -\n rgba.r * Math.pow(256, 3) -\n rgba.g * Math.pow(256, 2) -\n rgba.b * Math.pow(256, 1)) /\n Math.pow(256, 0)\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, rgba);\n }\n\n return rgba;\n};\n\n/**\n * Converts a css color (Hex, 8-digit (RGBA) Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, Named) to a hex number\n * @param {string} cssColor a number\n * @returns {number} a hex number representing a color\n */\nJimp.cssColorToHex = function (cssColor) {\n cssColor = cssColor || 0; // 0, null, undefined, NaN\n\n if (typeof cssColor === \"number\") return Number(cssColor);\n\n return parseInt(tinyColor(cssColor).toHex8(), 16);\n};\n\n/**\n * Limits a number to between 0 or 255\n * @param {number} n a number\n * @returns {number} the number limited to between 0 or 255\n */\nJimp.limit255 = function (n) {\n n = Math.max(n, 0);\n n = Math.min(n, 255);\n\n return n;\n};\n\n/**\n * Diffs two images and returns\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @param {number} threshold (optional) a number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1)\n * @returns {object} an object { percent: percent similar, diff: a Jimp image highlighting differences }\n */\nJimp.diff = function (img1, img2, threshold = 0.1) {\n if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp))\n return throwError.call(this, \"img1 and img2 must be an Jimp images\");\n\n const bmp1 = img1.bitmap;\n const bmp2 = img2.bitmap;\n\n if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) {\n if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) {\n // img1 is bigger\n img1 = img1.cloneQuiet().resize(bmp2.width, bmp2.height);\n } else {\n // img2 is bigger (or they are the same in area)\n img2 = img2.cloneQuiet().resize(bmp1.width, bmp1.height);\n }\n }\n\n if (typeof threshold !== \"number\" || threshold < 0 || threshold > 1) {\n return throwError.call(this, \"threshold must be a number between 0 and 1\");\n }\n\n const diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff);\n\n const numDiffPixels = pixelMatch(\n bmp1.data,\n bmp2.data,\n diff.bitmap.data,\n diff.bitmap.width,\n diff.bitmap.height,\n { threshold }\n );\n\n return {\n percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height),\n image: diff,\n };\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.distance = function (img1, img2) {\n const phash = new ImagePHash();\n const hash1 = phash.getHash(img1);\n const hash2 = phash.getHash(img2);\n\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {hash} hash1 a pHash\n * @param {hash} hash2 a pHash\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.compareHashes = function (hash1, hash2) {\n const phash = new ImagePHash();\n\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Compute color difference\n * 0 means no difference, 1 means maximum difference.\n * @param {number} rgba1: first color to compare.\n * @param {number} rgba2: second color to compare.\n * Both parameters must be an color object {r:val, g:val, b:val, a:val}\n * Where `a` is optional and `val` is an integer between 0 and 255.\n * @returns {number} float between 0 and 1.\n */\nJimp.colorDiff = function (rgba1, rgba2) {\n const pow = (n) => Math.pow(n, 2);\n const { max } = Math;\n const maxVal = 255 * 255 * 3;\n\n if (rgba1.a !== 0 && !rgba1.a) {\n rgba1.a = 255;\n }\n\n if (rgba2.a !== 0 && !rgba2.a) {\n rgba2.a = 255;\n }\n\n return (\n (max(pow(rgba1.r - rgba2.r), pow(rgba1.r - rgba2.r - rgba1.a + rgba2.a)) +\n max(pow(rgba1.g - rgba2.g), pow(rgba1.g - rgba2.g - rgba1.a + rgba2.a)) +\n max(pow(rgba1.b - rgba2.b), pow(rgba1.b - rgba2.b - rgba1.a + rgba2.a))) /\n maxVal\n );\n};\n\n/**\n * Helper to create Jimp methods that emit events before and after its execution.\n * @param {string} methodName The name to be appended to Jimp prototype.\n * @param {string} evName The event name to be called.\n * It will be prefixed by `before-` and emitted when on method call.\n * It will be appended by `ed` and emitted after the method run.\n * @param {function} method A function implementing the method itself.\n * It will also create a quiet version that will not emit events, to not\n * mess the user code with many `changed` event calls. You can call with\n * `methodName + \"Quiet\"`.\n *\n * The emitted event comes with a object parameter to the listener with the\n * `methodName` as one attribute.\n */\nexport function jimpEvMethod(methodName, evName, method) {\n const evNameBefore = \"before-\" + evName;\n const evNameAfter = evName.replace(/e$/, \"\") + \"ed\";\n\n Jimp.prototype[methodName] = function (...args) {\n let wrappedCb;\n const cb = args[method.length - 1];\n const jimpInstance = this;\n\n if (typeof cb === \"function\") {\n wrappedCb = function (...args) {\n const [err, data] = args;\n\n if (err) {\n jimpInstance.emitError(methodName, err);\n } else {\n jimpInstance.emitMulti(methodName, evNameAfter, {\n [methodName]: data,\n });\n }\n\n cb.apply(this, args);\n };\n\n args[args.length - 1] = wrappedCb;\n } else {\n wrappedCb = false;\n }\n\n this.emitMulti(methodName, evNameBefore);\n\n let result;\n\n try {\n result = method.apply(this, args);\n\n if (!wrappedCb) {\n this.emitMulti(methodName, evNameAfter, {\n [methodName]: result,\n });\n }\n } catch (error) {\n error.methodName = methodName;\n this.emitError(methodName, error);\n }\n\n return result;\n };\n\n Jimp.prototype[methodName + \"Quiet\"] = method;\n}\n\n/**\n * Creates a new image that is a clone of this one.\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns the new image\n */\njimpEvMethod(\"clone\", \"clone\", function (cb) {\n const clone = new Jimp(this);\n\n if (isNodePattern(cb)) {\n cb.call(clone, null, clone);\n }\n\n return clone;\n});\n\n/**\n * Simplify jimpEvMethod call for the common `change` evName.\n * @param {string} methodName name of the method\n * @param {function} method to watch changes for\n */\nexport function jimpEvChange(methodName, method) {\n jimpEvMethod(methodName, \"change\", method);\n}\n\n/**\n * Sets the type of the image (RGB or RGBA) when saving as PNG format (default is RGBA)\n * @param b A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange(\"background\", function (hex, cb) {\n if (typeof hex !== \"number\") {\n return throwError.call(this, \"hex must be a hexadecimal rgba value\", cb);\n }\n\n this._background = hex;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n});\n\n/**\n * Scans through a region of the bitmap, calling a function for each pixel.\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @param f a function to call on even pixel; the (x, y) position of the pixel\n * and the index of the pixel in the bitmap buffer are passed to the function\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange(\"scan\", function (x, y, w, h, f, cb) {\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n if (typeof f !== \"function\") {\n return throwError.call(this, \"f must be a function\", cb);\n }\n\n const result = scan(this, x, y, w, h, f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, result);\n }\n\n return result;\n});\n\nif (process.env.ENVIRONMENT === \"BROWSER\") {\n // For use in a web browser or web worker\n /* global self */\n let gl;\n\n if (typeof window !== \"undefined\" && typeof window === \"object\") {\n gl = window;\n }\n\n if (typeof self !== \"undefined\" && typeof self === \"object\") {\n gl = self;\n }\n\n gl.Jimp = Jimp;\n gl.Buffer = Buffer;\n}\n\nexport { addType } from \"./utils/mime\";\n\nexport default Jimp;\n"],"mappings":";;;AAAA,OAAOA,EAAE,MAAM,IAAI;AACnB,OAAOC,IAAI,MAAM,MAAM;AACvB,OAAOC,YAAY,MAAM,QAAQ;AAEjC,SAASC,aAAa,EAAEC,UAAU,EAAEC,IAAI,EAAEC,YAAY,QAAQ,aAAa;AAC3E,OAAOC,OAAO,MAAM,UAAU;AAC9B,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAElC,OAAOC,UAAU,MAAM,iBAAiB;AACxC,OAAOC,OAAO,MAAM,WAAW;AAE/B,OAAOC,SAAS,MAAM,aAAa;AACnC,OAAOC,SAAS,MAAM,mBAAmB;AACzC,OAAO,KAAKC,IAAI,MAAM,cAAc;AACpC,SAASC,WAAW,EAAEC,SAAS,EAAEC,cAAc,QAAQ,sBAAsB;AAC7E,OAAO,KAAKC,SAAS,MAAM,aAAa;AAExC,MAAMC,QAAQ,GACZ,kEAAkE;;AAEpE;AACA;AACA,MAAMC,aAAa,GAAG,CAACC,GAAG,EAAEA,GAAG,CAAC;AAEhC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,EAAE,EAAEA,CAAC,EAAE,EAAE;EAC3B,MAAMC,OAAO,GAAGhB,OAAO,CACrBA,OAAO,CAACiB,GAAG,EACXL,QAAQ,CAACM,KAAK,CAAC,CAAC,EAAEH,CAAC,CAAC,CACrB,CAAC,IAAII,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,CAAC;EAC9BP,aAAa,CAACQ,IAAI,CAACL,OAAO,CAACM,MAAM,CAAC;AACpC;;AAEA;AACA,SAASC,IAAI,GAAG,CAAC;;AAEjB;;AAEA,SAASC,aAAa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AOA,MAAM,KAAK,QAAQ,EAAE;IAC/DD,EAAE,GAAGC,MAAM;EACb;EAEA,IAAI,OAAOC,IAAI,KAAK,WAAW,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IAC3DF,EAAE,GAAGE,IAAI;EACX;EAEAF,EAAE,CAACpJ,IAAI,GAAGA,IAAI;EACdoJ,EAAE,CAAC/K,MAAM,GAAGA,MAAM;AACpB;AAEA,SAASkL,OAAO,QAAQ,cAAc;AAEtC,eAAevJ,IAAI"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/modules/phash.js b/project starter code/node_modules/@jimp/core/es/modules/phash.js index dac128a5..b404606e 100644 --- a/project starter code/node_modules/@jimp/core/es/modules/phash.js +++ b/project starter code/node_modules/@jimp/core/es/modules/phash.js @@ -1,5 +1,3 @@ -"use strict"; - /* Copyright (c) 2011 Elliot Shepherd @@ -21,6 +19,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + // https://code.google.com/p/ironchef-team21/source/browse/ironchef_team21/src/ImagePHash.java /* @@ -28,28 +27,25 @@ THE SOFTWARE. * Author: Elliot Shepherd (elliot@jarofworms.com * Based On: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html */ + function ImagePHash(size, smallerSize) { this.size = this.size || size; this.smallerSize = this.smallerSize || smallerSize; initCoefficients(this.size); } - ImagePHash.prototype.size = 32; ImagePHash.prototype.smallerSize = 8; - ImagePHash.prototype.distance = function (s1, s2) { - var counter = 0; - - for (var k = 0; k < s1.length; k++) { + let counter = 0; + for (let k = 0; k < s1.length; k++) { if (s1[k] !== s2[k]) { counter++; } } - return counter / s1.length; -}; // Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on. - +}; +// Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on. ImagePHash.prototype.getHash = function (img) { /* 1. Reduce size. * Like Average Hash, pHash starts with a small image. @@ -58,51 +54,46 @@ ImagePHash.prototype.getHash = function (img) { * because it is needed to reduce the high frequencies. */ img = img.clone().resize(this.size, this.size); + /* 2. Reduce color. * The image is reduced to a grayscale just to further simplify * the number of computations. */ - img.grayscale(); - var vals = []; - - for (var x = 0; x < img.bitmap.width; x++) { + const vals = []; + for (let x = 0; x < img.bitmap.width; x++) { vals[x] = []; - - for (var y = 0; y < img.bitmap.height; y++) { + for (let y = 0; y < img.bitmap.height; y++) { vals[x][y] = intToRGBA(img.getPixelColor(x, y)).b; } } + /* 3. Compute the DCT. * The DCT separates the image into a collection of frequencies * and scalars. While JPEG uses an 8x8 DCT, this algorithm uses * a 32x32 DCT. */ + const dctVals = applyDCT(vals, this.size); - - var dctVals = applyDCT(vals, this.size); /* 4. Reduce the DCT. * This is the magic step. While the DCT is 32x32, just keep the * top-left 8x8. Those represent the lowest frequencies in the * picture. */ - /* 5. Compute the average value. * Like the Average Hash, compute the mean DCT value (using only * the 8x8 DCT low-frequency values and excluding the first term * since the DC coefficient can be significantly different from * the other values and will throw off the average). */ - - var total = 0; - - for (var _x = 0; _x < this.smallerSize; _x++) { - for (var _y = 0; _y < this.smallerSize; _y++) { - total += dctVals[_x][_y]; + let total = 0; + for (let x = 0; x < this.smallerSize; x++) { + for (let y = 0; y < this.smallerSize; y++) { + total += dctVals[x][y]; } } + const avg = total / (this.smallerSize * this.smallerSize); - var avg = total / (this.smallerSize * this.smallerSize); /* 6. Further reduce the DCT. * This is the magic step. Set the 64 hash bits to 0 or 1 * depending on whether each of the 64 DCT values is above or @@ -113,61 +104,59 @@ ImagePHash.prototype.getHash = function (img) { * remains the same; this can survive gamma and color histogram * adjustments without a problem. */ - - var hash = ''; - - for (var _x2 = 0; _x2 < this.smallerSize; _x2++) { - for (var _y2 = 0; _y2 < this.smallerSize; _y2++) { - hash += dctVals[_x2][_y2] > avg ? '1' : '0'; + let hash = ""; + for (let x = 0; x < this.smallerSize; x++) { + for (let y = 0; y < this.smallerSize; y++) { + hash += dctVals[x][y] > avg ? "1" : "0"; } } - return hash; -}; // DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java +}; +// DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java +/** + Convert a 32-bit integer color value to an RGBA object. + */ function intToRGBA(i) { - var rgba = {}; - rgba.r = Math.floor(i / Math.pow(256, 3)); - rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2)); - rgba.b = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) / Math.pow(256, 1)); - rgba.a = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2) - rgba.b * Math.pow(256, 1)) / Math.pow(256, 0)); - return rgba; + const a = i & 0xff; + i >>>= 8; + const b = i & 0xff; + i >>>= 8; + const g = i & 0xff; + i >>>= 8; + const r = i & 0xff; + return { + r, + g, + b, + a + }; } - -var c = []; - +const c = []; function initCoefficients(size) { - for (var i = 1; i < size; i++) { + for (let i = 1; i < size; i++) { c[i] = 1; } - c[0] = 1 / Math.sqrt(2.0); } - function applyDCT(f, size) { - var N = size; - var F = []; - - for (var u = 0; u < N; u++) { + const N = size; + const F = []; + for (let u = 0; u < N; u++) { F[u] = []; - - for (var v = 0; v < N; v++) { - var sum = 0; - - for (var i = 0; i < N; i++) { - for (var j = 0; j < N; j++) { + for (let v = 0; v < N; v++) { + let sum = 0; + for (let i = 0; i < N; i++) { + for (let j = 0; j < N; j++) { sum += Math.cos((2 * i + 1) / (2.0 * N) * u * Math.PI) * Math.cos((2 * j + 1) / (2.0 * N) * v * Math.PI) * f[i][j]; } } - sum *= c[u] * c[v] / 4; F[u][v] = sum; } } - return F; } - -module.exports = ImagePHash; +export default ImagePHash; //# sourceMappingURL=phash.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/modules/phash.js.map b/project starter code/node_modules/@jimp/core/es/modules/phash.js.map index 5556e315..d3476d5f 100644 --- a/project starter code/node_modules/@jimp/core/es/modules/phash.js.map +++ b/project starter code/node_modules/@jimp/core/es/modules/phash.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../src/modules/phash.js"],"names":["ImagePHash","size","smallerSize","initCoefficients","prototype","distance","s1","s2","counter","k","length","getHash","img","clone","resize","grayscale","vals","x","bitmap","width","y","height","intToRGBA","getPixelColor","b","dctVals","applyDCT","total","avg","hash","i","rgba","r","Math","floor","pow","g","a","c","sqrt","f","N","F","u","v","sum","j","cos","PI","module","exports"],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;AAsBA;;AAEA;;;;;AAMA,SAASA,UAAT,CAAoBC,IAApB,EAA0BC,WAA1B,EAAuC;AACrC,OAAKD,IAAL,GAAY,KAAKA,IAAL,IAAaA,IAAzB;AACA,OAAKC,WAAL,GAAmB,KAAKA,WAAL,IAAoBA,WAAvC;AACAC,EAAAA,gBAAgB,CAAC,KAAKF,IAAN,CAAhB;AACD;;AAEDD,UAAU,CAACI,SAAX,CAAqBH,IAArB,GAA4B,EAA5B;AACAD,UAAU,CAACI,SAAX,CAAqBF,WAArB,GAAmC,CAAnC;;AAEAF,UAAU,CAACI,SAAX,CAAqBC,QAArB,GAAgC,UAASC,EAAT,EAAaC,EAAb,EAAiB;AAC/C,MAAIC,OAAO,GAAG,CAAd;;AAEA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGH,EAAE,CAACI,MAAvB,EAA+BD,CAAC,EAAhC,EAAoC;AAClC,QAAIH,EAAE,CAACG,CAAD,CAAF,KAAUF,EAAE,CAACE,CAAD,CAAhB,EAAqB;AACnBD,MAAAA,OAAO;AACR;AACF;;AAED,SAAOA,OAAO,GAAGF,EAAE,CAACI,MAApB;AACD,CAVD,C,CAYA;;;AACAV,UAAU,CAACI,SAAX,CAAqBO,OAArB,GAA+B,UAASC,GAAT,EAAc;AAC3C;;;;;;AAMAA,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,MAAMW,CAArB,CAAD,GAA4BE,CAA5B,GAAgCV,IAAI,CAACe,EAA9C,IACAf,IAAI,CAACc,GAAL,CAAU,CAAC,IAAID,CAAJ,GAAQ,CAAT,KAAe,MAAML,CAArB,CAAD,GAA4BG,CAA5B,GAAgCX,IAAI,CAACe,EAA9C,CADA,GAEAR,CAAC,CAACV,CAAD,CAAD,CAAKgB,CAAL,CAHF;AAID;AACF;;AAEDD,MAAAA,GAAG,IAAKP,CAAC,CAACK,CAAD,CAAD,GAAOL,CAAC,CAACM,CAAD,CAAT,GAAgB,CAAvB;AACAF,MAAAA,CAAC,CAACC,CAAD,CAAD,CAAKC,CAAL,IAAUC,GAAV;AACD;AACF;;AAED,SAAOH,CAAP;AACD;;AAEDO,MAAM,CAACC,OAAP,GAAiBlD,UAAjB","sourcesContent":["/*\nCopyright (c) 2011 Elliot Shepherd\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\nall copies 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\nTHE SOFTWARE.\n*/\n\n// https://code.google.com/p/ironchef-team21/source/browse/ironchef_team21/src/ImagePHash.java\n\n/*\n * pHash-like image hash.\n * Author: Elliot Shepherd (elliot@jarofworms.com\n * Based On: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html\n */\n\nfunction ImagePHash(size, smallerSize) {\n this.size = this.size || size;\n this.smallerSize = this.smallerSize || smallerSize;\n initCoefficients(this.size);\n}\n\nImagePHash.prototype.size = 32;\nImagePHash.prototype.smallerSize = 8;\n\nImagePHash.prototype.distance = function(s1, s2) {\n let counter = 0;\n\n for (let k = 0; k < s1.length; k++) {\n if (s1[k] !== s2[k]) {\n counter++;\n }\n }\n\n return counter / s1.length;\n};\n\n// Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on.\nImagePHash.prototype.getHash = function(img) {\n /* 1. Reduce size.\n * Like Average Hash, pHash starts with a small image.\n * However, the image is larger than 8x8; 32x32 is a good size.\n * This is really done to simplify the DCT computation and not\n * because it is needed to reduce the high frequencies.\n */\n img = img.clone().resize(this.size, this.size);\n\n /* 2. Reduce color.\n * The image is reduced to a grayscale just to further simplify\n * the number of computations.\n */\n img.grayscale();\n\n const vals = [];\n\n for (let x = 0; x < img.bitmap.width; x++) {\n vals[x] = [];\n for (let y = 0; y < img.bitmap.height; y++) {\n vals[x][y] = intToRGBA(img.getPixelColor(x, y)).b;\n }\n }\n\n /* 3. Compute the DCT.\n * The DCT separates the image into a collection of frequencies\n * and scalars. While JPEG uses an 8x8 DCT, this algorithm uses\n * a 32x32 DCT.\n */\n const dctVals = applyDCT(vals, this.size);\n\n /* 4. Reduce the DCT.\n * This is the magic step. While the DCT is 32x32, just keep the\n * top-left 8x8. Those represent the lowest frequencies in the\n * picture.\n */\n /* 5. Compute the average value.\n * Like the Average Hash, compute the mean DCT value (using only\n * the 8x8 DCT low-frequency values and excluding the first term\n * since the DC coefficient can be significantly different from\n * the other values and will throw off the average).\n */\n let total = 0;\n\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n total += dctVals[x][y];\n }\n }\n\n const avg = total / (this.smallerSize * this.smallerSize);\n\n /* 6. Further reduce the DCT.\n * This is the magic step. Set the 64 hash bits to 0 or 1\n * depending on whether each of the 64 DCT values is above or\n * below the average value. The result doesn't tell us the\n * actual low frequencies; it just tells us the very-rough\n * relative scale of the frequencies to the mean. The result\n * will not vary as long as the overall structure of the image\n * remains the same; this can survive gamma and color histogram\n * adjustments without a problem.\n */\n let hash = '';\n\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n hash += dctVals[x][y] > avg ? '1' : '0';\n }\n }\n\n return hash;\n};\n\n// DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java\n\nfunction intToRGBA(i) {\n const rgba = {};\n\n rgba.r = Math.floor(i / Math.pow(256, 3));\n rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));\n rgba.b = Math.floor(\n (i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) /\n Math.pow(256, 1)\n );\n rgba.a = Math.floor(\n (i -\n rgba.r * Math.pow(256, 3) -\n rgba.g * Math.pow(256, 2) -\n rgba.b * Math.pow(256, 1)) /\n Math.pow(256, 0)\n );\n\n return rgba;\n}\n\nconst c = [];\nfunction initCoefficients(size) {\n for (let i = 1; i < size; i++) {\n c[i] = 1;\n }\n\n c[0] = 1 / Math.sqrt(2.0);\n}\n\nfunction applyDCT(f, size) {\n const N = size;\n const F = [];\n\n for (let u = 0; u < N; u++) {\n F[u] = [];\n for (let v = 0; v < N; v++) {\n let sum = 0;\n for (let i = 0; i < N; i++) {\n for (let j = 0; j < N; j++) {\n sum +=\n Math.cos(((2 * i + 1) / (2.0 * N)) * u * Math.PI) *\n Math.cos(((2 * j + 1) / (2.0 * N)) * v * Math.PI) *\n f[i][j];\n }\n }\n\n sum *= (c[u] * c[v]) / 4;\n F[u][v] = sum;\n }\n }\n\n return F;\n}\n\nmodule.exports = ImagePHash;\n"],"file":"phash.js"} \ No newline at end of file +{"version":3,"file":"phash.js","names":["ImagePHash","size","smallerSize","initCoefficients","prototype","distance","s1","s2","counter","k","length","getHash","img","clone","resize","grayscale","vals","x","bitmap","width","y","height","intToRGBA","getPixelColor","b","dctVals","applyDCT","total","avg","hash","i","a","g","r","c","Math","sqrt","f","N","F","u","v","sum","j","cos","PI"],"sources":["../../src/modules/phash.js"],"sourcesContent":["/*\nCopyright (c) 2011 Elliot Shepherd\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\nall copies 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\nTHE SOFTWARE.\n*/\n\n// https://code.google.com/p/ironchef-team21/source/browse/ironchef_team21/src/ImagePHash.java\n\n/*\n * pHash-like image hash.\n * Author: Elliot Shepherd (elliot@jarofworms.com\n * Based On: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html\n */\n\nfunction ImagePHash(size, smallerSize) {\n this.size = this.size || size;\n this.smallerSize = this.smallerSize || smallerSize;\n initCoefficients(this.size);\n}\n\nImagePHash.prototype.size = 32;\nImagePHash.prototype.smallerSize = 8;\n\nImagePHash.prototype.distance = function (s1, s2) {\n let counter = 0;\n\n for (let k = 0; k < s1.length; k++) {\n if (s1[k] !== s2[k]) {\n counter++;\n }\n }\n\n return counter / s1.length;\n};\n\n// Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on.\nImagePHash.prototype.getHash = function (img) {\n /* 1. Reduce size.\n * Like Average Hash, pHash starts with a small image.\n * However, the image is larger than 8x8; 32x32 is a good size.\n * This is really done to simplify the DCT computation and not\n * because it is needed to reduce the high frequencies.\n */\n img = img.clone().resize(this.size, this.size);\n\n /* 2. Reduce color.\n * The image is reduced to a grayscale just to further simplify\n * the number of computations.\n */\n img.grayscale();\n\n const vals = [];\n\n for (let x = 0; x < img.bitmap.width; x++) {\n vals[x] = [];\n for (let y = 0; y < img.bitmap.height; y++) {\n vals[x][y] = intToRGBA(img.getPixelColor(x, y)).b;\n }\n }\n\n /* 3. Compute the DCT.\n * The DCT separates the image into a collection of frequencies\n * and scalars. While JPEG uses an 8x8 DCT, this algorithm uses\n * a 32x32 DCT.\n */\n const dctVals = applyDCT(vals, this.size);\n\n /* 4. Reduce the DCT.\n * This is the magic step. While the DCT is 32x32, just keep the\n * top-left 8x8. Those represent the lowest frequencies in the\n * picture.\n */\n /* 5. Compute the average value.\n * Like the Average Hash, compute the mean DCT value (using only\n * the 8x8 DCT low-frequency values and excluding the first term\n * since the DC coefficient can be significantly different from\n * the other values and will throw off the average).\n */\n let total = 0;\n\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n total += dctVals[x][y];\n }\n }\n\n const avg = total / (this.smallerSize * this.smallerSize);\n\n /* 6. Further reduce the DCT.\n * This is the magic step. Set the 64 hash bits to 0 or 1\n * depending on whether each of the 64 DCT values is above or\n * below the average value. The result doesn't tell us the\n * actual low frequencies; it just tells us the very-rough\n * relative scale of the frequencies to the mean. The result\n * will not vary as long as the overall structure of the image\n * remains the same; this can survive gamma and color histogram\n * adjustments without a problem.\n */\n let hash = \"\";\n\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n hash += dctVals[x][y] > avg ? \"1\" : \"0\";\n }\n }\n\n return hash;\n};\n\n// DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java\n\n/**\n Convert a 32-bit integer color value to an RGBA object.\n */\nfunction intToRGBA(i) {\n const a = i & 0xff;\n i >>>= 8;\n const b = i & 0xff;\n i >>>= 8;\n const g = i & 0xff;\n i >>>= 8;\n const r = i & 0xff;\n\n return {r, g, b, a};\n}\n\nconst c = [];\nfunction initCoefficients(size) {\n for (let i = 1; i < size; i++) {\n c[i] = 1;\n }\n\n c[0] = 1 / Math.sqrt(2.0);\n}\n\nfunction applyDCT(f, size) {\n const N = size;\n const F = [];\n\n for (let u = 0; u < N; u++) {\n F[u] = [];\n for (let v = 0; v < N; v++) {\n let sum = 0;\n for (let i = 0; i < N; i++) {\n for (let j = 0; j < N; j++) {\n sum +=\n Math.cos(((2 * i + 1) / (2.0 * N)) * u * Math.PI) *\n Math.cos(((2 * j + 1) / (2.0 * N)) * v * Math.PI) *\n f[i][j];\n }\n }\n\n sum *= (c[u] * c[v]) / 4;\n F[u][v] = sum;\n }\n }\n\n return F;\n}\n\nexport default ImagePHash;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,SAASA,UAAU,CAACC,IAAI,EAAEC,WAAW,EAAE;EACrC,IAAI,CAACD,IAAI,GAAG,IAAI,CAACA,IAAI,IAAIA,IAAI;EAC7B,IAAI,CAACC,WAAW,GAAG,IAAI,CAACA,WAAW,IAAIA,WAAW;EAClDC,gBAAgB,CAAC,IAAI,CAACF,IAAI,CAAC;AAC7B;AAEAD,UAAU,CAACI,SAAS,CAACH,IAAI,GAAG,EAAE;AAC9BD,UAAU,CAACI,SAAS,CAACF,WAAW,GAAG,CAAC;AAEpCF,UAA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CAAC,GAAGN,CAAC,CAACO,CAAC,CAAC,GAAI,CAAC;MACxBF,CAAC,CAACC,CAAC,CAAC,CAACC,CAAC,CAAC,GAAGC,GAAG;IACf;EACF;EAEA,OAAOH,CAAC;AACV;AAEA,eAAevC,UAAU"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/request.js b/project starter code/node_modules/@jimp/core/es/request.js index 4b211f73..566d0a7c 100644 --- a/project starter code/node_modules/@jimp/core/es/request.js +++ b/project starter code/node_modules/@jimp/core/es/request.js @@ -1,55 +1,16 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/* global XMLHttpRequest */ -if (process.browser || process.env.ENVIRONMENT === 'BROWSER' || typeof process.versions.electron !== 'undefined' && process.type === 'renderer' && typeof XMLHttpRequest === 'function') { - // If we run into a browser or the electron renderer process, - // use XHR method instead of Request node module. - module.exports = function (options, cb) { - var xhr = new XMLHttpRequest(); - xhr.open('GET', options.url, true); - xhr.responseType = 'arraybuffer'; - xhr.addEventListener('load', function () { - if (xhr.status < 400) { - try { - var data = Buffer.from(this.response); - cb(null, xhr, data); - } catch (error) { - return cb(new Error('Response is not a buffer for url ' + options.url + '. Error: ' + error.message)); - } - } else { - cb(new Error('HTTP Status ' + xhr.status + ' for url ' + options.url)); - } - }); - xhr.addEventListener('error', function (e) { - cb(e); - }); - xhr.send(); - }; -} else { - module.exports = function (_ref, cb) { - var options = (0, _extends2["default"])({}, _ref); - - var p = require('phin'); - - p(_objectSpread({ - compression: true - }, options), function (err, res) { - if (err === null) { - cb(null, res, res.body); - } else { - cb(err); - } - }); - }; -} +import "isomorphic-fetch"; +export default ((_ref, cb) => { + let { + url, + ...options + } = _ref; + fetch(url, options).then(response => { + if (response.ok) { + return response.arrayBuffer().catch(error => { + throw new Error(`Response is not a buffer for url ${url}. Error: ${error.message}`); + }); + } + throw new Error(`HTTP Status ${response.status} for url ${url}`); + }).then(data => cb(null, data)).catch(error => cb(error)); +}); //# sourceMappingURL=request.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/request.js.map b/project starter code/node_modules/@jimp/core/es/request.js.map index 04a1d461..5e709941 100644 --- a/project starter code/node_modules/@jimp/core/es/request.js.map +++ b/project starter code/node_modules/@jimp/core/es/request.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/request.js"],"names":["process","browser","env","ENVIRONMENT","versions","electron","type","XMLHttpRequest","module","exports","options","cb","xhr","open","url","responseType","addEventListener","status","data","Buffer","from","response","error","Error","message","e","send","p","require","compression","err","res","body"],"mappings":";;;;;;;;;;;;AAAA;AAEA,IACEA,OAAO,CAACC,OAAR,IACAD,OAAO,CAACE,GAAR,CAAYC,WAAZ,KAA4B,SAD5B,IAEC,OAAOH,OAAO,CAACI,QAAR,CAAiBC,QAAxB,KAAqC,WAArC,IACCL,OAAO,CAACM,IAAR,KAAiB,UADlB,IAEC,OAAOC,cAAP,KAA0B,UAL9B,EAME;AACA;AACA;AAEAC,EAAAA,MAAM,CAACC,OAAP,GAAiB,UAASC,OAAT,EAAkBC,EAAlB,EAAsB;AACrC,QAAM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AAChBnB,QAAAA,EAAE,CAAC,IAAD,EAAOoB,GAAP,EAAYA,GAAG,CAACC,IAAhB,CAAF;AACD,OAFD,MAEO;AACLrB,QAAAA,EAAE,CAACmB,GAAD,CAAF;AACD;AACF,KANA,CAAD;AAOD,GAVD;AAWD","sourcesContent":["/* global XMLHttpRequest */\n\nif (\n process.browser ||\n process.env.ENVIRONMENT === 'BROWSER' ||\n (typeof process.versions.electron !== 'undefined' &&\n process.type === 'renderer' &&\n typeof XMLHttpRequest === 'function')\n) {\n // If we run into a browser or the electron renderer process,\n // use XHR method instead of Request node module.\n\n module.exports = function(options, cb) {\n const xhr = new XMLHttpRequest();\n xhr.open('GET', options.url, true);\n xhr.responseType = 'arraybuffer';\n xhr.addEventListener('load', function() {\n if (xhr.status < 400) {\n try {\n const data = Buffer.from(this.response);\n cb(null, xhr, data);\n } catch (error) {\n return cb(\n new Error(\n 'Response is not a buffer for url ' +\n options.url +\n '. Error: ' +\n error.message\n )\n );\n }\n } else {\n cb(new Error('HTTP Status ' + xhr.status + ' for url ' + options.url));\n }\n });\n xhr.addEventListener('error', e => {\n cb(e);\n });\n xhr.send();\n };\n} else {\n module.exports = function({ ...options }, cb) {\n const p = require('phin');\n\n p({ compression: true, ...options }, (err, res) => {\n if (err === null) {\n cb(null, res, res.body);\n } else {\n cb(err);\n }\n });\n };\n}\n"],"file":"request.js"} \ No newline at end of file +{"version":3,"file":"request.js","names":["cb","url","options","fetch","then","response","ok","arrayBuffer","catch","error","Error","message","status","data"],"sources":["../src/request.js"],"sourcesContent":["import \"isomorphic-fetch\";\n\nexport default ({ url, ...options }, cb) => {\n fetch(url, options)\n .then((response) => {\n if (response.ok) {\n return response.arrayBuffer().catch((error) => {\n throw new Error(\n `Response is not a buffer for url ${url}. Error: ${error.message}`\n );\n });\n }\n\n throw new Error(`HTTP Status ${response.status} for url ${url}`);\n })\n .then((data) => cb(null, data))\n .catch((error) => cb(error));\n};\n"],"mappings":"AAAA,OAAO,kBAAkB;AAEzB,gBAAe,OAAsBA,EAAE,KAAK;EAAA,IAA5B;IAAEC,GAAG;IAAE,GAAGC;EAAQ,CAAC;EACjCC,KAAK,CAACF,GAAG,EAAEC,OAAO,CAAC,CAChBE,IAAI,CAAEC,QAAQ,IAAK;IAClB,IAAIA,QAAQ,CAACC,EAAE,EAAE;MACf,OAAOD,QAAQ,CAACE,WAAW,EAAE,CAACC,KAAK,CAAEC,KAAK,IAAK;QAC7C,MAAM,IAAIC,KAAK,CACZ,oCAAmCT,GAAI,YAAWQ,KAAK,CAACE,OAAQ,EAAC,CACnE;MACH,CAAC,CAAC;IACJ;IAEA,MAAM,IAAID,KAAK,CAAE,eAAcL,QAAQ,CAACO,MAAO,YAAWX,GAAI,EAAC,CAAC;EAClE,CAAC,CAAC,CACDG,IAAI,CAAES,IAAI,IAAKb,EAAE,CAAC,IAAI,EAAEa,IAAI,CAAC,CAAC,CAC9BL,KAAK,CAAEC,KAAK,IAAKT,EAAE,CAACS,KAAK,CAAC,CAAC;AAChC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/utils/image-bitmap.js b/project starter code/node_modules/@jimp/core/es/utils/image-bitmap.js index 4beabbe0..1ae43bec 100644 --- a/project starter code/node_modules/@jimp/core/es/utils/image-bitmap.js +++ b/project starter code/node_modules/@jimp/core/es/utils/image-bitmap.js @@ -1,46 +1,23 @@ -"use strict"; - -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.parseBitmap = parseBitmap; -exports.getBuffer = getBuffer; -exports.getBufferAsync = getBufferAsync; - -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); - -var _fileType = _interopRequireDefault(require("file-type")); - -var _exifParser = _interopRequireDefault(require("exif-parser")); - -var _utils = require("@jimp/utils"); - -var constants = _interopRequireWildcard(require("../constants")); - -var MIME = _interopRequireWildcard(require("./mime")); - -var _promisify = _interopRequireDefault(require("./promisify")); - -function getMIMEFromBuffer(buffer, path) { - var fileTypeFromBuffer = (0, _fileType["default"])(buffer); - +import FileType from "file-type"; +import EXIFParser from "exif-parser"; +import { throwError } from "@jimp/utils"; +import * as constants from "../constants"; +import * as MIME from "./mime"; +import promisify from "./promisify"; +async function getMIMEFromBuffer(buffer, path) { + const fileTypeFromBuffer = await FileType.fromBuffer(buffer); if (fileTypeFromBuffer) { // If fileType returns something for buffer, then return the mime given return fileTypeFromBuffer.mime; } - if (path) { // If a path is supplied, and fileType yields no results, then retry with MIME // Path can be either a file path or a url return MIME.getType(path); } - return null; } + /* * Obtains image orientation from EXIF metadata. * @@ -48,11 +25,10 @@ function getMIMEFromBuffer(buffer, path) { * @returns {number} a number 1-8 representing EXIF orientation, * in particular 1 if orientation tag is missing */ - - function getExifOrientation(img) { return img._exif && img._exif.tags && img._exif.tags.Orientation || 1; } + /** * Returns a function which translates EXIF-rotated coordinates into * non-rotated ones. @@ -62,64 +38,54 @@ function getExifOrientation(img) { * @param img {Jimp} a Jimp image object * @returns {function} transformation function for transformBitmap(). */ - - function getExifOrientationTransformation(img) { - var w = img.getWidth(); - var h = img.getHeight(); - + const w = img.getWidth(); + const h = img.getHeight(); switch (getExifOrientation(img)) { case 1: // Horizontal (normal) // does not need to be supported here return null; - case 2: // Mirror horizontal return function (x, y) { return [w - x - 1, y]; }; - case 3: // Rotate 180 return function (x, y) { return [w - x - 1, h - y - 1]; }; - case 4: // Mirror vertical return function (x, y) { return [x, h - y - 1]; }; - case 5: // Mirror horizontal and rotate 270 CW return function (x, y) { return [y, x]; }; - case 6: // Rotate 90 CW return function (x, y) { return [y, h - x - 1]; }; - case 7: // Mirror horizontal and rotate 90 CW return function (x, y) { return [w - y - 1, h - x - 1]; }; - case 8: // Rotate 270 CW return function (x, y) { return [w - y - 1, x]; }; - default: return null; } } + /* * Transforms bitmap in place (moves pixels around) according to given * transformation function. @@ -134,111 +100,87 @@ function getExifOrientationTransformation(img) { * the source bitmap, i.e. has following form: * `function(new_x, new_y) { return [src_x, src_y] }`. */ - - function transformBitmap(img, width, height, transformation) { // Underscore-prefixed values are related to the source bitmap // Their counterparts with no prefix are related to the target bitmap - var _data = img.bitmap.data; - var _width = img.bitmap.width; - var data = Buffer.alloc(_data.length); - - for (var x = 0; x < width; x++) { - for (var y = 0; y < height; y++) { - var _transformation = transformation(x, y), - _transformation2 = (0, _slicedToArray2["default"])(_transformation, 2), - _x = _transformation2[0], - _y = _transformation2[1]; - - var idx = width * y + x << 2; - - var _idx = _width * _y + _x << 2; - - var pixel = _data.readUInt32BE(_idx); - + const _data = img.bitmap.data; + const _width = img.bitmap.width; + const data = Buffer.alloc(_data.length); + for (let x = 0; x < width; x++) { + for (let y = 0; y < height; y++) { + const [_x, _y] = transformation(x, y); + const idx = width * y + x << 2; + const _idx = _width * _y + _x << 2; + const pixel = _data.readUInt32BE(_idx); data.writeUInt32BE(pixel, idx); } } - img.bitmap.data = data; img.bitmap.width = width; img.bitmap.height = height; } + /* * Automagically rotates an image based on its EXIF data (if present). * @param img {Jimp} a Jimp image object */ - - function exifRotate(img) { if (getExifOrientation(img) < 2) return; - var transformation = getExifOrientationTransformation(img); - var swapDimensions = getExifOrientation(img) > 4; - var newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width; - var newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height; + const transformation = getExifOrientationTransformation(img); + const swapDimensions = getExifOrientation(img) > 4; + const newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width; + const newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height; transformBitmap(img, newWidth, newHeight, transformation); -} // parses a bitmap from the constructor to the JIMP bitmap property - - -function parseBitmap(data, path, cb) { - var mime = getMIMEFromBuffer(data, path); +} - if (typeof mime !== 'string') { - return cb(new Error('Could not find MIME for Buffer <' + path + '>')); +// parses a bitmap from the constructor to the JIMP bitmap property +export async function parseBitmap(data, path, cb) { + const mime = await getMIMEFromBuffer(data, path); + if (typeof mime !== "string") { + return cb(new Error("Could not find MIME for Buffer <" + path + ">")); } - this._originalMime = mime.toLowerCase(); - try { - var _mime = this.getMIME(); - - if (this.constructor.decoders[_mime]) { - this.bitmap = this.constructor.decoders[_mime](data); + const mime = this.getMIME(); + if (this.constructor.decoders[mime]) { + this.bitmap = this.constructor.decoders[mime](data); } else { - return _utils.throwError.call(this, 'Unsupported MIME type: ' + _mime, cb); + return throwError.call(this, "Unsupported MIME type: " + mime, cb); } } catch (error) { return cb.call(this, error, this); } - try { - this._exif = _exifParser["default"].create(data).parse(); + this._exif = EXIFParser.create(data).parse(); exifRotate(this); // EXIF data } catch (error) { /* meh */ } - cb.call(this, null, this); return this; } - function compositeBitmapOverBackground(Jimp, image) { return new Jimp(image.bitmap.width, image.bitmap.height, image._background).composite(image, 0, 0).bitmap; } + /** * Converts the image to a buffer - * @param {string} mime the mime type of the image buffer to be created + * @param {(string|number)} mime the mime type of the image buffer to be created * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument * @returns {Jimp} this for chaining of methods */ - - -function getBuffer(mime, cb) { +export function getBuffer(mime, cb) { if (mime === constants.AUTO) { // allow auto MIME detection mime = this.getMIME(); } - - if (typeof mime !== 'string') { - return _utils.throwError.call(this, 'mime must be a string', cb); + if (typeof mime !== "string") { + return throwError.call(this, "mime must be a string", cb); } - - if (typeof cb !== 'function') { - return _utils.throwError.call(this, 'cb must be a function', cb); + if (typeof cb !== "function") { + return throwError.call(this, "cb must be a function", cb); } - mime = mime.toLowerCase(); - if (this._rgba && this.constructor.hasAlpha[mime]) { this.bitmap.data = Buffer.from(this.bitmap.data); } else { @@ -246,18 +188,23 @@ function getBuffer(mime, cb) { // composite onto a new image so that the background shows through alpha channels this.bitmap.data = compositeBitmapOverBackground(this.constructor, this).data; } - if (this.constructor.encoders[mime]) { - var buffer = this.constructor.encoders[mime](this); - cb.call(this, null, buffer); + const buffer = this.constructor.encoders[mime](this); + // Typically, buffers return a string or map. However, the gif library "gifwrap" seemingly returns promises. + if (buffer instanceof Promise) { + // trigger the callback when the promise has been resolved + buffer.then(buff => { + cb.call(this, null, buff); + }); + } else { + cb.call(this, null, buffer); + } } else { - cb.call(this, 'Unsupported MIME type: ' + mime); + return throwError.call(this, "Unsupported MIME type: " + mime, cb); } - return this; } - -function getBufferAsync(mime) { - return (0, _promisify["default"])(getBuffer, this, mime); +export function getBufferAsync(mime) { + return promisify(getBuffer, this, mime); } //# sourceMappingURL=image-bitmap.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/utils/image-bitmap.js.map b/project starter code/node_modules/@jimp/core/es/utils/image-bitmap.js.map index dc78d9d8..10277e5d 100644 --- a/project starter code/node_modules/@jimp/core/es/utils/image-bitmap.js.map +++ b/project starter code/node_modules/@jimp/core/es/utils/image-bitmap.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../src/utils/image-bitmap.js"],"names":["getMIMEFromBuffer","buffer","path","fileTypeFromBuffer","mime","MIME","getType","getExifOrientation","img","_exif","tags","Orientation","getExifOrientationTransformation","w","getWidth","h","getHeight","x","y","transformBitmap","width","height","transformation","_data","bitmap","data","_width","Buffer","alloc","length","_x","_y","idx","_idx","pixel","readUInt32BE","writeUInt32BE","exifRotate","swapDimensions","newWidth","newHeight","parseBitmap","cb","Error","_originalMime","toLowerCase","getMIME","constructor","decoders","throwError","call","error","EXIFParser","create","parse","compositeBitmapOverBackground","Jimp","image","_background","composite","getBuffer","constants","AUTO","_rgba","hasAlpha","from","encoders","getBufferAsync"],"mappings":";;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;AAEA,SAASA,iBAAT,CAA2BC,MAA3B,EAAmCC,IAAnC,EAAyC;AACvC,MAAMC,kBAAkB,GAAG,0BAASF,MAAT,CAA3B;;AAEA,MAAIE,kBAAJ,EAAwB;AACtB;AACA,WAAOA,kBAAkB,CAACC,IAA1B;AACD;;AAED,MAAIF,IAAJ,EAAU;AACR;AACA;AACA,WA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;AAC5B,WAAO6C,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,uBAAtB,EAA+CR,EAA/C,CAAP;AACD;;AAED,MAAI,OAAOA,EAAP,KAAc,UAAlB,EAA8B;AAC5B,WAAOO,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,uBAAtB,EAA+CR,EAA/C,CAAP;AACD;;AAEDtC,EAAAA,IAAI,GAAGA,IAAI,CAACyC,WAAL,EAAP;;AAEA,MAAI,KAAKkB,KAAL,IAAc,KAAKhB,WAAL,CAAiBiB,QAAjB,CAA0B5D,IAA1B,CAAlB,EAAmD;AACjD,SAAKoB,MAAL,CAAYC,IAAZ,GAAmBE,MAAM,CAACsC,IAAP,CAAY,KAAKzC,MAAL,CAAYC,IAAxB,CAAnB;AACD,GAFD,MAEO;AACL;AACA;AACA,SAAKD,MAAL,CAAYC,IAAZ,GAAmB8B,6BAA6B,CAC9C,KAAKR,WADyC,EAE9C,IAF8C,CAA7B,CAGjBtB,IAHF;AAID;;AAED,MAAI,KAAKsB,WAAL,CAAiBmB,QAAjB,CAA0B9D,IAA1B,CAAJ,EAAqC;AACnC,QAAMH,MAAM,GAAG,KAAK8C,WAAL,CAAiBmB,QAAjB,CAA0B9D,IAA1B,EAAgC,IAAhC,CAAf;AACAsC,IAAAA,EAAE,CAACQ,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoBjD,MAApB;AACD,GAHD,MAGO;AACLyC,IAAAA,EAAE,CAACQ,IAAH,CAAQ,IAAR,EAAc,4BAA4B9C,IAA1C;AACD;;AAED,SAAO,IAAP;AACD;;AAEM,SAAS+D,cAAT,CAAwB/D,IAAxB,EAA8B;AACnC,SAAO,2BAAUwD,SAAV,EAAqB,IAArB,EAA2BxD,IAA3B,CAAP;AACD","sourcesContent":["import fileType from 'file-type';\n\nimport EXIFParser from 'exif-parser';\nimport { throwError } from '@jimp/utils';\n\nimport * as constants from '../constants';\nimport * as MIME from './mime';\nimport promisify from './promisify';\n\nfunction getMIMEFromBuffer(buffer, path) {\n const fileTypeFromBuffer = fileType(buffer);\n\n if (fileTypeFromBuffer) {\n // If fileType returns something for buffer, then return the mime given\n return fileTypeFromBuffer.mime;\n }\n\n if (path) {\n // If a path is supplied, and fileType yields no results, then retry with MIME\n // Path can be either a file path or a url\n return MIME.getType(path);\n }\n\n return null;\n}\n\n/*\n * Obtains image orientation from EXIF metadata.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {number} a number 1-8 representing EXIF orientation,\n * in particular 1 if orientation tag is missing\n */\nfunction getExifOrientation(img) {\n return (img._exif && img._exif.tags && img._exif.tags.Orientation) || 1;\n}\n\n/**\n * Returns a function which translates EXIF-rotated coordinates into\n * non-rotated ones.\n *\n * Transformation reference: http://sylvana.net/jpegcrop/exif_orientation.html.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {function} transformation function for transformBitmap().\n */\nfunction getExifOrientationTransformation(img) {\n const w = img.getWidth();\n const h = img.getHeight();\n\n switch (getExifOrientation(img)) {\n case 1: // Horizontal (normal)\n // does not need to be supported here\n return null;\n\n case 2: // Mirror horizontal\n return function(x, y) {\n return [w - x - 1, y];\n };\n\n case 3: // Rotate 180\n return function(x, y) {\n return [w - x - 1, h - y - 1];\n };\n\n case 4: // Mirror vertical\n return function(x, y) {\n return [x, h - y - 1];\n };\n\n case 5: // Mirror horizontal and rotate 270 CW\n return function(x, y) {\n return [y, x];\n };\n\n case 6: // Rotate 90 CW\n return function(x, y) {\n return [y, h - x - 1];\n };\n\n case 7: // Mirror horizontal and rotate 90 CW\n return function(x, y) {\n return [w - y - 1, h - x - 1];\n };\n\n case 8: // Rotate 270 CW\n return function(x, y) {\n return [w - y - 1, x];\n };\n\n default:\n return null;\n }\n}\n\n/*\n * Transforms bitmap in place (moves pixels around) according to given\n * transformation function.\n *\n * @param img {Jimp} a Jimp image object, which bitmap is supposed to\n * be transformed\n * @param width {number} bitmap width after the transformation\n * @param height {number} bitmap height after the transformation\n * @param transformation {function} transformation function which defines pixel\n * mapping between new and source bitmap. It takes a pair of coordinates\n * in the target, and returns a respective pair of coordinates in\n * the source bitmap, i.e. has following form:\n * `function(new_x, new_y) { return [src_x, src_y] }`.\n */\nfunction transformBitmap(img, width, height, transformation) {\n // Underscore-prefixed values are related to the source bitmap\n // Their counterparts with no prefix are related to the target bitmap\n const _data = img.bitmap.data;\n const _width = img.bitmap.width;\n\n const data = Buffer.alloc(_data.length);\n\n for (let x = 0; x < width; x++) {\n for (let y = 0; y < height; y++) {\n const [_x, _y] = transformation(x, y);\n\n const idx = (width * y + x) << 2;\n const _idx = (_width * _y + _x) << 2;\n\n const pixel = _data.readUInt32BE(_idx);\n data.writeUInt32BE(pixel, idx);\n }\n }\n\n img.bitmap.data = data;\n img.bitmap.width = width;\n img.bitmap.height = height;\n}\n\n/*\n * Automagically rotates an image based on its EXIF data (if present).\n * @param img {Jimp} a Jimp image object\n */\nfunction exifRotate(img) {\n if (getExifOrientation(img) < 2) return;\n\n const transformation = getExifOrientationTransformation(img);\n const swapDimensions = getExifOrientation(img) > 4;\n\n const newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width;\n const newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height;\n\n transformBitmap(img, newWidth, newHeight, transformation);\n}\n\n// parses a bitmap from the constructor to the JIMP bitmap property\nexport function parseBitmap(data, path, cb) {\n const mime = getMIMEFromBuffer(data, path);\n\n if (typeof mime !== 'string') {\n return cb(new Error('Could not find MIME for Buffer <' + path + '>'));\n }\n\n this._originalMime = mime.toLowerCase();\n\n try {\n const mime = this.getMIME();\n\n if (this.constructor.decoders[mime]) {\n this.bitmap = this.constructor.decoders[mime](data);\n } else {\n return throwError.call(this, 'Unsupported MIME type: ' + mime, cb);\n }\n } catch (error) {\n return cb.call(this, error, this);\n }\n\n try {\n this._exif = EXIFParser.create(data).parse();\n exifRotate(this); // EXIF data\n } catch (error) {\n /* meh */\n }\n\n cb.call(this, null, this);\n\n return this;\n}\n\nfunction compositeBitmapOverBackground(Jimp, image) {\n return new Jimp(\n image.bitmap.width,\n image.bitmap.height,\n image._background\n ).composite(image, 0, 0).bitmap;\n}\n\n/**\n * Converts the image to a buffer\n * @param {string} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\nexport function getBuffer(mime, cb) {\n if (mime === constants.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n\n if (typeof mime !== 'string') {\n return throwError.call(this, 'mime must be a string', cb);\n }\n\n if (typeof cb !== 'function') {\n return throwError.call(this, 'cb must be a function', cb);\n }\n\n mime = mime.toLowerCase();\n\n if (this._rgba && this.constructor.hasAlpha[mime]) {\n this.bitmap.data = Buffer.from(this.bitmap.data);\n } else {\n // when format doesn't support alpha\n // composite onto a new image so that the background shows through alpha channels\n this.bitmap.data = compositeBitmapOverBackground(\n this.constructor,\n this\n ).data;\n }\n\n if (this.constructor.encoders[mime]) {\n const buffer = this.constructor.encoders[mime](this);\n cb.call(this, null, buffer);\n } else {\n cb.call(this, 'Unsupported MIME type: ' + mime);\n }\n\n return this;\n}\n\nexport function getBufferAsync(mime) {\n return promisify(getBuffer, this, mime);\n}\n"],"file":"image-bitmap.js"} \ No newline at end of file +{"version":3,"file":"image-bitmap.js","names":["FileType","EXIFParser","throwError","constants","MIME","promisify","getMIMEFromBuffer","buffer","path","fileTypeFromBuffer","fromBuffer","mime","getType","getExifOrientation","img","_exif","tags","Orientation","getExifOrientationTransformation","w","getWidth","h","getHeight","x","y","transformBitmap","width","height","transformation","_data","bitmap","data","_width","Buffer","alloc","length","_x","_y","idx","_idx","pixel","readUInt32BE","writeUInt32BE","exifRotate","swapDimensions","newWidth","newHeight","parseBitmap","cb","Error","_originalMime","toLowerCase","getMIME","constructor","decoders","call","error","create","parse","compositeBitmapOverBackground","Jimp","image","_background","composite","getBuffer","AUTO","_rgba","hasAlpha","from","encoders","Promise","then","buff","getBufferAsync"],"sources":["../../src/utils/image-bitmap.js"],"sourcesContent":["import FileType from \"file-type\";\n\nimport EXIFParser from \"exif-parser\";\nimport { throwError } from \"@jimp/utils\";\n\nimport * as constants from \"../constants\";\nimport * as MIME from \"./mime\";\nimport promisify from \"./promisify\";\n\nasync function getMIMEFromBuffer(buffer, path) {\n const fileTypeFromBuffer = await FileType.fromBuffer(buffer);\n\n if (fileTypeFromBuffer) {\n // If fileType returns something for buffer, then return the mime given\n return fileTypeFromBuffer.mime;\n }\n\n if (path) {\n // If a path is supplied, and fileType yields no results, then retry with MIME\n // Path can be either a file path or a url\n return MIME.getType(path);\n }\n\n return null;\n}\n\n/*\n * Obtains image orientation from EXIF metadata.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {number} a number 1-8 representing EXIF orientation,\n * in particular 1 if orientation tag is missing\n */\nfunction getExifOrientation(img) {\n return (img._exif && img._exif.tags && img._exif.tags.Orientation) || 1;\n}\n\n/**\n * Returns a function which translates EXIF-rotated coordinates into\n * non-rotated ones.\n *\n * Transformation reference: http://sylvana.net/jpegcrop/exif_orientation.html.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {function} transformation function for transformBitmap().\n */\nfunction getExifOrientationTransformation(img) {\n const w = img.getWidth();\n const h = img.getHeight();\n\n switch (getExifOrientation(img)) {\n case 1: // Horizontal (normal)\n // does not need to be supported here\n return null;\n\n case 2: // Mirror horizontal\n return function (x, y) {\n return [w - x - 1, y];\n };\n\n case 3: // Rotate 180\n return function (x, y) {\n return [w - x - 1, h - y - 1];\n };\n\n case 4: // Mirror vertical\n return function (x, y) {\n return [x, h - y - 1];\n };\n\n case 5: // Mirror horizontal and rotate 270 CW\n return function (x, y) {\n return [y, x];\n };\n\n case 6: // Rotate 90 CW\n return function (x, y) {\n return [y, h - x - 1];\n };\n\n case 7: // Mirror horizontal and rotate 90 CW\n return function (x, y) {\n return [w - y - 1, h - x - 1];\n };\n\n case 8: // Rotate 270 CW\n return function (x, y) {\n return [w - y - 1, x];\n };\n\n default:\n return null;\n }\n}\n\n/*\n * Transforms bitmap in place (moves pixels around) according to given\n * transformation function.\n *\n * @param img {Jimp} a Jimp image object, which bitmap is supposed to\n * be transformed\n * @param width {number} bitmap width after the transformation\n * @param height {number} bitmap height after the transformation\n * @param transformation {function} transformation function which defines pixel\n * mapping between new and source bitmap. It takes a pair of coordinates\n * in the target, and returns a respective pair of coordinates in\n * the source bitmap, i.e. has following form:\n * `function(new_x, new_y) { return [src_x, src_y] }`.\n */\nfunction transformBitmap(img, width, height, transformation) {\n // Underscore-prefixed values are related to the source bitmap\n // Their counterparts with no prefix are related to the target bitmap\n const _data = img.bitmap.data;\n const _width = img.bitmap.width;\n\n const data = Buffer.alloc(_data.length);\n\n for (let x = 0; x < width; x++) {\n for (let y = 0; y < height; y++) {\n const [_x, _y] = transformation(x, y);\n\n const idx = (width * y + x) << 2;\n const _idx = (_width * _y + _x) << 2;\n\n const pixel = _data.readUInt32BE(_idx);\n data.writeUInt32BE(pixel, idx);\n }\n }\n\n img.bitmap.data = data;\n img.bitmap.width = width;\n img.bitmap.height = height;\n}\n\n/*\n * Automagically rotates an image based on its EXIF data (if present).\n * @param img {Jimp} a Jimp image object\n */\nfunction exifRotate(img) {\n if (getExifOrientation(img) < 2) return;\n\n const transformation = getExifOrientationTransformation(img);\n const swapDimensions = getExifOrientation(img) > 4;\n\n const newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width;\n const newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height;\n\n transformBitmap(img, newWidth, newHeight, transformation);\n}\n\n// parses a bitmap from the constructor to the JIMP bitmap property\nexport async function parseBitmap(data, path, cb) {\n const mime = await getMIMEFromBuffer(data, path);\n\n if (typeof mime !== \"string\") {\n return cb(new Error(\"Could not find MIME for Buffer <\" + path + \">\"));\n }\n\n this._originalMime = mime.toLowerCase();\n\n try {\n const mime = this.getMIME();\n\n if (this.constructor.decoders[mime]) {\n this.bitmap = this.constructor.decoders[mime](data);\n } else {\n return throwError.call(this, \"Unsupported MIME type: \" + mime, cb);\n }\n } catch (error) {\n return cb.call(this, error, this);\n }\n\n try {\n this._exif = EXIFParser.create(data).parse();\n exifRotate(this); // EXIF data\n } catch (error) {\n /* meh */\n }\n\n cb.call(this, null, this);\n\n return this;\n}\n\nfunction compositeBitmapOverBackground(Jimp, image) {\n return new Jimp(\n image.bitmap.width,\n image.bitmap.height,\n image._background\n ).composite(image, 0, 0).bitmap;\n}\n\n/**\n * Converts the image to a buffer\n * @param {(string|number)} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\nexport function getBuffer(mime, cb) {\n if (mime === constants.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n\n if (typeof mime !== \"string\") {\n return throwError.call(this, \"mime must be a string\", cb);\n }\n\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", cb);\n }\n\n mime = mime.toLowerCase();\n\n if (this._rgba && this.constructor.hasAlpha[mime]) {\n this.bitmap.data = Buffer.from(this.bitmap.data);\n } else {\n // when format doesn't support alpha\n // composite onto a new image so that the background shows through alpha channels\n this.bitmap.data = compositeBitmapOverBackground(\n this.constructor,\n this\n ).data;\n }\n\n if (this.constructor.encoders[mime]) {\n const buffer = this.constructor.encoders[mime](this);\n // Typically, buffers return a string or map. However, the gif library \"gifwrap\" seemingly returns promises.\n if (buffer instanceof Promise) {\n // trigger the callback when the promise has been resolved\n buffer.then((buff) => {\n cb.call(this, null, buff);\n });\n } else {\n cb.call(this, null, buffer);\n }\n } else {\n return throwError.call(this, \"Unsupported MIME type: \" + mime, cb);\n }\n\n return this;\n}\n\nexport function getBufferAsync(mime) {\n return promisify(getBuffer, this, mime);\n}\n"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,WAAW;AAEhC,OAAOC,UAAU,MAAM,aAAa;AACpC,SAASC,UAAU,QAAQ,aAAa;AAExC,OAAO,KAAKC,SAAS,MAAM,cAAc;AACzC,OAAO,KAAKC,IAAI,MAAM,QAAQ;AAC9B,OA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AE,CAACO,IAAI,CAAC,IAAI,EAAE,IAAI,EAAEhD,MAAM,CAAC;IAC7B;EACF,CAAC,MAAM;IACL,OAAOL,UAAU,CAACqD,IAAI,CAAC,IAAI,EAAE,yBAAyB,GAAG5C,IAAI,EAAEqC,EAAE,CAAC;EACpE;EAEA,OAAO,IAAI;AACb;AAEA,OAAO,SAASyB,cAAc,CAAC9D,IAAI,EAAE;EACnC,OAAON,SAAS,CAAC2D,SAAS,EAAE,IAAI,EAAErD,IAAI,CAAC;AACzC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/utils/mime.js b/project starter code/node_modules/@jimp/core/es/utils/mime.js index 9e48085a..55e0c51e 100644 --- a/project starter code/node_modules/@jimp/core/es/utils/mime.js +++ b/project starter code/node_modules/@jimp/core/es/utils/mime.js @@ -1,47 +1,25 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getExtension = exports.getType = exports.addType = void 0; -var mimeTypes = {}; - -var findType = function findType(extension) { - return Object.entries(mimeTypes).find(function (type) { - return type[1].includes(extension); - }) || []; -}; - -var addType = function addType(mime, extensions) { +const mimeTypes = {}; +const findType = extension => Object.entries(mimeTypes).find(type => type[1].includes(extension)) || []; +export const addType = (mime, extensions) => { mimeTypes[mime] = extensions; }; + /** * Lookup a mime type based on extension * @param {string} path path to find extension for * @returns {string} mime found mime type */ - - -exports.addType = addType; - -var getType = function getType(path) { - var pathParts = path.split('/').slice(-1); - var extension = pathParts[pathParts.length - 1].split('.').pop(); - var type = findType(extension); +export const getType = path => { + const pathParts = path.split("/").slice(-1); + const extension = pathParts[pathParts.length - 1].split(".").pop(); + const type = findType(extension); return type[0]; }; + /** * Return file extension associated with a mime type * @param {string} type mime type to look up * @returns {string} extension file extension */ - - -exports.getType = getType; - -var getExtension = function getExtension(type) { - return (mimeTypes[type.toLowerCase()] || [])[0]; -}; - -exports.getExtension = getExtension; +export const getExtension = type => (mimeTypes[type.toLowerCase()] || [])[0]; //# sourceMappingURL=mime.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/utils/mime.js.map b/project starter code/node_modules/@jimp/core/es/utils/mime.js.map index 5a3501b1..896500f2 100644 --- a/project starter code/node_modules/@jimp/core/es/utils/mime.js.map +++ b/project starter code/node_modules/@jimp/core/es/utils/mime.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../src/utils/mime.js"],"names":["mimeTypes","findType","extension","Object","entries","find","type","includes","addType","mime","extensions","getType","path","pathParts","split","slice","length","pop","getExtension","toLowerCase"],"mappings":";;;;;;AAAA,IAAMA,SAAS,GAAG,EAAlB;;AAEA,IAAMC,QAAQ,GAAG,SAAXA,QAAW,CAAAC,SAAS;AAAA,SACxBC,MAAM,CAACC,OAAP,CAAeJ,SAAf,EAA0BK,IAA1B,CAA+B,UAAAC,IAAI;AAAA,WAAIA,IAAI,CAAC,CAAD,CAAJ,CAAQC,QAAR,CAAiBL,SAAjB,CAAJ;AAAA,GAAnC,KAAuE,EAD/C;AAAA,CAA1B;;AAGO,IAAMM,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAAOC,UAAP,EAAsB;AAC3CV,EAAAA,SAAS,CAACS,IAAD,CAAT,GAAkBC,UAAlB;AACD,CAFM;AAIP;;;;;;;;;AAKO,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAAAC,IAAI,EAAI;AAC7B,MAAMC,SAAS,GAAGD,IAAI,CAACE,KAAL,CAAW,GAAX,EAAgBC,KAAhB,CAAsB,CAAC,CAAvB,CAAlB;AACA,MAAMb,SAAS,GAAGW,SAAS,CAACA,SAAS,CAACG,MAAV,GAAmB,CAApB,CAAT,CAAgCF,KAAhC,CAAsC,GAAtC,EAA2CG,GAA3C,EAAlB;AACA,MAAMX,IAAI,GAAGL,QAAQ,CAACC,SAAD,CAArB;AAEA,SAAOI,IAAI,CAAC,CAAD,CAAX;AACD,CANM;AAQP;;;;;;;;;AAKO,IAAMY,YAAY,GAAG,SAAfA,YAAe,CAAAZ,IAAI;AAAA,SAAI,CAACN,SAAS,CAACM,IAAI,CAACa,WAAL,EAAD,CAAT,IAAiC,EAAlC,EAAsC,CAAtC,CAAJ;AAAA,CAAzB","sourcesContent":["const mimeTypes = {};\n\nconst findType = extension =>\n Object.entries(mimeTypes).find(type => type[1].includes(extension)) || [];\n\nexport const addType = (mime, extensions) => {\n mimeTypes[mime] = extensions;\n};\n\n/**\n * Lookup a mime type based on extension\n * @param {string} path path to find extension for\n * @returns {string} mime found mime type\n */\nexport const getType = path => {\n const pathParts = path.split('/').slice(-1);\n const extension = pathParts[pathParts.length - 1].split('.').pop();\n const type = findType(extension);\n\n return type[0];\n};\n\n/**\n * Return file extension associated with a mime type\n * @param {string} type mime type to look up\n * @returns {string} extension file extension\n */\nexport const getExtension = type => (mimeTypes[type.toLowerCase()] || [])[0];\n"],"file":"mime.js"} \ No newline at end of file +{"version":3,"file":"mime.js","names":["mimeTypes","findType","extension","Object","entries","find","type","includes","addType","mime","extensions","getType","path","pathParts","split","slice","length","pop","getExtension","toLowerCase"],"sources":["../../src/utils/mime.js"],"sourcesContent":["const mimeTypes = {};\n\nconst findType = (extension) =>\n Object.entries(mimeTypes).find((type) => type[1].includes(extension)) || [];\n\nexport const addType = (mime, extensions) => {\n mimeTypes[mime] = extensions;\n};\n\n/**\n * Lookup a mime type based on extension\n * @param {string} path path to find extension for\n * @returns {string} mime found mime type\n */\nexport const getType = (path) => {\n const pathParts = path.split(\"/\").slice(-1);\n const extension = pathParts[pathParts.length - 1].split(\".\").pop();\n const type = findType(extension);\n\n return type[0];\n};\n\n/**\n * Return file extension associated with a mime type\n * @param {string} type mime type to look up\n * @returns {string} extension file extension\n */\nexport const getExtension = (type) => (mimeTypes[type.toLowerCase()] || [])[0];\n"],"mappings":"AAAA,MAAMA,SAAS,GAAG,CAAC,CAAC;AAEpB,MAAMC,QAAQ,GAAIC,SAAS,IACzBC,MAAM,CAACC,OAAO,CAACJ,SAAS,CAAC,CAACK,IAAI,CAAEC,IAAI,IAAKA,IAAI,CAAC,CAAC,CAAC,CAACC,QAAQ,CAACL,SAAS,CAAC,CAAC,IAAI,EAAE;AAE7E,OAAO,MAAMM,OAAO,GAAG,CAACC,IAAI,EAAEC,UAAU,KAAK;EAC3CV,SAAS,CAACS,IAAI,CAAC,GAAGC,UAAU;AAC9B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,OAAO,GAAIC,IAAI,IAAK;EAC/B,MAAMC,SAAS,GAAGD,IAAI,CAACE,KAAK,CAAC,GAAG,CAAC,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC;EAC3C,MAAMb,SAAS,GAAGW,SAAS,CAACA,SAAS,CAACG,MAAM,GAAG,CAAC,CAAC,CAACF,KAAK,CAAC,GAAG,CAAC,CAACG,GAAG,EAAE;EAClE,MAAMX,IAAI,GAAGL,QAAQ,CAACC,SAAS,CAAC;EAEhC,OAAOI,IAAI,CAAC,CAAC,CAAC;AAChB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMY,YAAY,GAAIZ,IAAI,IAAK,CAACN,SAAS,CAACM,IAAI,CAACa,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/utils/promisify.js b/project starter code/node_modules/@jimp/core/es/utils/promisify.js index a307532d..c40350de 100644 --- a/project starter code/node_modules/@jimp/core/es/utils/promisify.js +++ b/project starter code/node_modules/@jimp/core/es/utils/promisify.js @@ -1,27 +1,16 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var promisify = function promisify(fun, ctx) { +const promisify = function (fun, ctx) { for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { args[_key - 2] = arguments[_key]; } - - return new Promise(function (resolve, reject) { - args.push(function (err, data) { + return new Promise((resolve, reject) => { + args.push((err, data) => { if (err) { reject(err); } - resolve(data); }); - fun.bind(ctx).apply(void 0, args); + fun.bind(ctx)(...args); }); }; - -var _default = promisify; -exports["default"] = _default; +export default promisify; //# sourceMappingURL=promisify.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/es/utils/promisify.js.map b/project starter code/node_modules/@jimp/core/es/utils/promisify.js.map index c72c0c48..9b619756 100644 --- a/project starter code/node_modules/@jimp/core/es/utils/promisify.js.map +++ b/project starter code/node_modules/@jimp/core/es/utils/promisify.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../src/utils/promisify.js"],"names":["promisify","fun","ctx","args","Promise","resolve","reject","push","err","data","bind"],"mappings":";;;;;;;AAAA,IAAMA,SAAS,GAAG,SAAZA,SAAY,CAACC,GAAD,EAAMC,GAAN;AAAA,oCAAcC,IAAd;AAAcA,IAAAA,IAAd;AAAA;;AAAA,SAChB,IAAIC,OAAJ,CAAY,UAACC,OAAD,EAAUC,MAAV,EAAqB;AAC/BH,IAAAA,IAAI,CAACI,IAAL,CAAU,UAACC,GAAD,EAAMC,IAAN,EAAe;AACvB,UAAID,GAAJ,EAAS;AACPF,QAAAA,MAAM,CAACE,GAAD,CAAN;AACD;;AAEDH,MAAAA,OAAO,CAACI,IAAD,CAAP;AACD,KAND;AAOAR,IAAAA,GAAG,CAACS,IAAJ,CAASR,GAAT,gBAAiBC,IAAjB;AACD,GATD,CADgB;AAAA,CAAlB;;eAYeH,S","sourcesContent":["const promisify = (fun, ctx, ...args) =>\n new Promise((resolve, reject) => {\n args.push((err, data) => {\n if (err) {\n reject(err);\n }\n\n resolve(data);\n });\n fun.bind(ctx)(...args);\n });\n\nexport default promisify;\n"],"file":"promisify.js"} \ No newline at end of file +{"version":3,"file":"promisify.js","names":["promisify","fun","ctx","args","Promise","resolve","reject","push","err","data","bind"],"sources":["../../src/utils/promisify.js"],"sourcesContent":["const promisify = (fun, ctx, ...args) =>\n new Promise((resolve, reject) => {\n args.push((err, data) => {\n if (err) {\n reject(err);\n }\n\n resolve(data);\n });\n fun.bind(ctx)(...args);\n });\n\nexport default promisify;\n"],"mappings":"AAAA,MAAMA,SAAS,GAAG,UAACC,GAAG,EAAEC,GAAG;EAAA,kCAAKC,IAAI;IAAJA,IAAI;EAAA;EAAA,OAClC,IAAIC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;IAC/BH,IAAI,CAACI,IAAI,CAAC,CAACC,GAAG,EAAEC,IAAI,KAAK;MACvB,IAAID,GAAG,EAAE;QACPF,MAAM,CAACE,GAAG,CAAC;MACb;MAEAH,OAAO,CAACI,IAAI,CAAC;IACf,CAAC,CAAC;IACFR,GAAG,CAACS,IAAI,CAACR,GAAG,CAAC,CAAC,GAAGC,IAAI,CAAC;EACxB,CAAC,CAAC;AAAA;AAEJ,eAAeH,SAAS"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/core/package.json b/project starter code/node_modules/@jimp/core/package.json index ab28529b..7558b3eb 100644 --- a/project starter code/node_modules/@jimp/core/package.json +++ b/project starter code/node_modules/@jimp/core/package.json @@ -1,10 +1,11 @@ { "name": "@jimp/core", - "version": "0.16.2", + "version": "0.22.12", "description": "Jimp core", "main": "dist/index.js", "module": "es/index.js", "types": "types/index.d.ts", + "sideEffects": false, "files": [ "dist", "es", @@ -12,15 +13,9 @@ "fonts", "types" ], - "repository": { - "type": "git", - "url": "https://github.com/oliver-moran/jimp.git" - }, - "bugs": { - "url": "https://github.com/oliver-moran/jimp/issues" - }, + "repository": "jimp-dev/jimp", "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register test/**/*.js", + "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js", "test:watch": "npm run test -- --reporter min --watch", "test:coverage": "nyc npm run test", "build": "npm run build:node:production && npm run build:module", @@ -34,24 +29,17 @@ "author": "Oliver Moran ", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", + "@jimp/utils": "^0.22.12", "any-base": "^1.1.0", "buffer": "^5.2.0", "exif-parser": "^0.1.12", - "file-type": "^9.0.0", - "load-bmfont": "^1.3.1", - "mkdirp": "^0.5.1", - "phin": "^2.9.1", + "file-type": "^16.5.4", + "isomorphic-fetch": "^3.0.0", "pixelmatch": "^4.0.2", - "tinycolor2": "^1.4.1" - }, - "devDependencies": { - "should": "^13.2.3" + "tinycolor2": "^1.6.0" }, - "xo": false, "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/core/types/etc.d.ts b/project starter code/node_modules/@jimp/core/types/etc.d.ts index e5f16b56..e13192e6 100644 --- a/project starter code/node_modules/@jimp/core/types/etc.d.ts +++ b/project starter code/node_modules/@jimp/core/types/etc.d.ts @@ -1,4 +1,4 @@ -import {Jimp} from '@jimp/core/types/jimp'; +import { Jimp } from "./jimp"; export interface Image { bitmap: Bitmap; @@ -35,33 +35,35 @@ type BlendMode = { opacityDest: number; }; -type ChangeName = 'background' | 'scan' | 'crop'; +type ChangeName = "background" | "scan" | "crop"; type ListenableName = - | 'any' - | 'initialized' - | 'before-change' - | 'changed' - | 'before-clone' - | 'cloned' + | "any" + | "initialized" + | "before-change" + | "changed" + | "before-clone" + | "cloned" | ChangeName; -type ListenerData = T extends 'any' +type ListenerData = T extends "any" ? any : T extends ChangeName - ? { - eventName: 'before-change' | 'changed'; - methodName: T; - [key: string]: any; - } - : { - eventName: T; - methodName: T extends 'initialized' - ? 'constructor' - : T extends 'before-change' | 'changed' - ? ChangeName - : T extends 'before-clone' | 'cloned' ? 'clone' : any; - }; + ? { + eventName: "before-change" | "changed"; + methodName: T; + [key: string]: any; + } + : { + eventName: T; + methodName: T extends "initialized" + ? "constructor" + : T extends "before-change" | "changed" + ? ChangeName + : T extends "before-clone" | "cloned" + ? "clone" + : any; + }; type URLOptions = { url: string; diff --git a/project starter code/node_modules/@jimp/core/types/functions.d.ts b/project starter code/node_modules/@jimp/core/types/functions.d.ts index d7366054..de74902e 100644 --- a/project starter code/node_modules/@jimp/core/types/functions.d.ts +++ b/project starter code/node_modules/@jimp/core/types/functions.d.ts @@ -1,4 +1,4 @@ -import {Jimp} from '@jimp/core/types/jimp'; +import { Jimp } from "./jimp"; export function addConstants( constants: [string, string | number], diff --git a/project starter code/node_modules/@jimp/core/types/index.d.ts b/project starter code/node_modules/@jimp/core/types/index.d.ts index 83042628..88bd53a7 100644 --- a/project starter code/node_modules/@jimp/core/types/index.d.ts +++ b/project starter code/node_modules/@jimp/core/types/index.d.ts @@ -1,8 +1,8 @@ -export * from '@jimp/core/types/etc'; -export * from '@jimp/core/types/functions'; -export * from '@jimp/core/types/plugins'; -export * from '@jimp/core/types/utils'; -import {Jimp, JimpConstructors} from '@jimp/core/types/jimp'; +export * from "./etc"; +export * from "./functions"; +export * from "./plugins"; +export * from "./utils"; +import { Jimp, JimpConstructors } from "./jimp"; export { Jimp, JimpConstructors }; declare const defaultExp: Jimp; diff --git a/project starter code/node_modules/@jimp/core/types/jimp.d.ts b/project starter code/node_modules/@jimp/core/types/jimp.d.ts index a01331c9..3c3509ea 100644 --- a/project starter code/node_modules/@jimp/core/types/jimp.d.ts +++ b/project starter code/node_modules/@jimp/core/types/jimp.d.ts @@ -7,8 +7,8 @@ import { GenericCallback, BlendMode, RGBA, - RGB -} from '@jimp/core/types/etc'; + RGB, +} from "./etc"; interface DiffReturn { percent: number; @@ -51,20 +51,27 @@ export interface JimpConstructors { EDGE_CROP: 3; // Constructors - new(path: string, cb?: ImageCallback): this['prototype']; - new(urlOptions: URLOptions, cb?: ImageCallback): this['prototype']; - new(image: Jimp, cb?: ImageCallback): this['prototype']; - new(data: Buffer, cb?: ImageCallback): this['prototype']; - new(data: Bitmap, cb?: ImageCallback): this['prototype']; - new(w: number, h: number, cb?: ImageCallback): this['prototype']; - new( + new (path: string, cb?: ImageCallback): this["prototype"]; + new ( + urlOptions: URLOptions, + cb?: ImageCallback + ): this["prototype"]; + new (image: Jimp, cb?: ImageCallback): this["prototype"]; + new (data: Buffer, cb?: ImageCallback): this["prototype"]; + new (data: Bitmap, cb?: ImageCallback): this["prototype"]; + new ( + w: number, + h: number, + cb?: ImageCallback + ): this["prototype"]; + new ( w: number, h: number, background?: number | string, - cb?: ImageCallback - ): this['prototype']; + cb?: ImageCallback + ): this["prototype"]; // For custom constructors when using Jimp.appendConstructorOption - new(...args: any[]): this['prototype']; + new (...args: any[]): this["prototype"]; // Functions /** @@ -72,7 +79,10 @@ export interface JimpConstructors { * it's not possible RN: * https://github.com/microsoft/TypeScript/issues/26113 */ - appendConstructorOption( + appendConstructorOption< + Args extends any[], + J extends Jimp = this["prototype"] + >( name: string, test: (...args: any[]) => boolean, run: ( @@ -82,30 +92,47 @@ export interface JimpConstructors { ...args: any[] ) => any ): void; - read(path: string, cb?: ImageCallback): Promise; - read(image: Jimp, cb?: ImageCallback): Promise; - read(data: Buffer, cb?: ImageCallback): Promise; + read( + path: string, + cb?: ImageCallback + ): Promise; + read( + image: Jimp, + cb?: ImageCallback + ): Promise; + read( + data: Buffer, + cb?: ImageCallback + ): Promise; read( w: number, h: number, background?: number | string, - cb?: ImageCallback - ): Promise; - create(path: string): Promise; - create(image: Jimp): Promise; - create(data: Buffer): Promise; - create(w: number, h: number, background?: number | string): Promise; + cb?: ImageCallback + ): Promise; + create(path: string): Promise; + create(image: Jimp): Promise; + create(data: Buffer): Promise; + create( + w: number, + h: number, + background?: number | string + ): Promise; rgbaToInt( r: number, g: number, b: number, a: number, - cb?: GenericCallback + cb?: GenericCallback ): number; intToRGBA(i: number, cb?: GenericCallback): RGBA; cssColorToHex(cssColor: string): number; limit255(n: number): number; - diff(img1: Jimp, img2: Jimp, threshold?: number): DiffReturn; + diff( + img1: Jimp, + img2: Jimp, + threshold?: number + ): DiffReturn; distance(img1: Jimp, img2: Jimp): number; compareHashes(hash1: string, hash2: string): number; colorDiff(rgba1: RGB, rgba2: RGB): number; @@ -139,8 +166,9 @@ export interface Jimp { write(path: string, cb?: ImageCallback): this; writeAsync(path: string): Promise; rgba(bool: boolean, cb?: ImageCallback): this; - getBase64(mime: string, cb: GenericCallback): this; - getBase64Async(mime: string): Promise; + getBase64(mime: string | JimpConstructors["AUTO"], cb: GenericCallback): this; + pHash: () => string; + getBase64Async(mime: string | JimpConstructors["AUTO"]): Promise; hash(cb?: GenericCallback): string; hash( base: number | null | undefined, @@ -156,7 +184,7 @@ export interface Jimp { getPixelIndex( x: number, y: number, - edgeHandling: string, + edgeHandling: number, cb?: GenericCallback ): number; getPixelColor( diff --git a/project starter code/node_modules/@jimp/core/types/plugins.d.ts b/project starter code/node_modules/@jimp/core/types/plugins.d.ts index 26fe4dcd..62bf2ea9 100644 --- a/project starter code/node_modules/@jimp/core/types/plugins.d.ts +++ b/project starter code/node_modules/@jimp/core/types/plugins.d.ts @@ -1,23 +1,17 @@ /** * These files pertain to the typings of plugins or types - * + * * They're not meant as utils to decode types, but rather * the type definitons themsleves for plugins and types of various kinds */ -import { - Image, - EncoderFn, - DecoderFn -} from '@jimp/core/types/etc'; +import { Image, EncoderFn, DecoderFn } from "./etc"; -import { - Omit -} from '@jimp/core/types/utils'; +import { Omit } from "./utils"; -export type IllformedPlugin = Omit & { +export type IllformedPlugin = Omit & { class?: never; constants?: never; -} +}; export interface WellFormedPlugin { mime?: { @@ -43,13 +37,13 @@ export interface WellFormedPlugin { type ClassOrConstantPlugin = WellFormedPlugin & ( - | Required, 'class'>> - | Required, 'constants'>> + | Required, "class">> + | Required, "constants">> ); // A Jimp type requires mime, but not class export type JimpType = WellFormedPlugin & - Required, 'mime'>>; + Required, "mime">>; // Jimp plugin either MUST have class OR constant or be illformed export type JimpPlugin = diff --git a/project starter code/node_modules/@jimp/core/types/utils.d.ts b/project starter code/node_modules/@jimp/core/types/utils.d.ts index afde123a..463321b9 100644 --- a/project starter code/node_modules/@jimp/core/types/utils.d.ts +++ b/project starter code/node_modules/@jimp/core/types/utils.d.ts @@ -1,26 +1,30 @@ -import { - JimpType, - JimpPlugin, -} from '@jimp/core/types/plugins'; +import { JimpType, JimpPlugin } from "./plugins"; // This is required as providing type arrays gives a union of all the generic // types in the array rather than an intersection -export type UnionToIntersection = - (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never; +export type UnionToIntersection = ( + U extends any ? (k: U) => void : never +) extends (k: infer I) => void + ? I + : never; /** * The values to be extracted from a WellFormedPlugin to put onto the Jimp instance * Left loose as "any" in order to enable the GetPluginVal to work properly */ -export type WellFormedValues = - (T extends {class: infer Class} ? Class : {}); +export type WellFormedValues = T extends { class: infer Class } + ? Class + : {}; /** * The constants to be extracted from a WellFormedPlugin to put onto the Jimp instance * Left loose as "any" in order to enable the GetPluginConstants to work properly */ -export type WellFormedConstants = - (T extends {constants: infer Constants} ? Constants : {}); +export type WellFormedConstants = T extends { + constants: infer Constants; +} + ? Constants + : {}; // Util type for the functions that deal with `@jimp/custom` // Must accept any or no props thanks to typing of the `plugins` intersected function @@ -32,27 +36,43 @@ export type FunctionRet = Array<(...props: any[] | never) => T>; * up `undefined`. Because we're always extending `IllformedPlugin` on the * plugins, this should work fine */ -export type GetPluginVal = Q extends Required<{class: any}> | Required<{constants: any}> +export type GetPluginVal = Q extends + | Required<{ class: any }> + | Required<{ constants: any }> ? WellFormedValues : Q; -export type GetPluginConst = Q extends Required<{class: any}> | Required<{constants: any}> +export type GetPluginConst = Q extends + | Required<{ class: any }> + | Required<{ constants: any }> ? WellFormedConstants : {}; -export type GetPluginDecoders = Q extends Required<{class: any}> | Required<{constants: any}> - ? Q extends {decoders: infer Decoders} ? Decoders : {} : {}; +export type GetPluginDecoders = Q extends + | Required<{ class: any }> + | Required<{ constants: any }> + ? Q extends { decoders: infer Decoders } + ? Decoders + : {} + : {}; -export type GetPluginEncoders = Q extends Required<{class: any}> | Required<{constants: any}> - ? Q extends {encoders: infer Encoders} ? Encoders : {} : {}; +export type GetPluginEncoders = Q extends + | Required<{ class: any }> + | Required<{ constants: any }> + ? Q extends { encoders: infer Encoders } + ? Encoders + : {} + : {}; type GetPluginFuncArrValues = // Given an array of types infer `Q` (Q should be the type value) - PluginFuncArr extends ReadonlyArray ? F extends () => infer Q - ? // Get the plugin value, may be ill-formed or well-formed - GetPluginVal - : // This should never be reached - undefined : undefined; + PluginFuncArr extends ReadonlyArray + ? F extends () => infer Q + ? // Get the plugin value, may be ill-formed or well-formed + GetPluginVal + : // This should never be reached + undefined + : undefined; /** * A helper type to get the values to be intersected with `Jimp` to give @@ -60,31 +80,39 @@ type GetPluginFuncArrValues = */ export type GetIntersectionFromPlugins< PluginFuncArr extends FunctionRet -> = UnionToIntersection, undefined>>; +> = UnionToIntersection< + Exclude, undefined> +>; type GetPluginFuncArrConsts = // Given an array of types infer `Q` (Q should be the type value) - PluginFuncArr extends ReadonlyArray ? F extends () => infer Q - ? // Get the plugin constants, may be ill-formed or well-formed - GetPluginConst - : // This should never be reached - undefined : undefined; + PluginFuncArr extends ReadonlyArray + ? F extends () => infer Q + ? // Get the plugin constants, may be ill-formed or well-formed + GetPluginConst + : // This should never be reached + undefined + : undefined; type GetPluginFuncArrEncoders = // Given an array of types infer `Q` (Q should be the type value) - PluginFuncArr extends ReadonlyArray ? F extends () => infer Q - ? // Get the plugin encoders, may be ill-formed or well-formed - GetPluginEncoders - : // This should never be reached - undefined : undefined; + PluginFuncArr extends ReadonlyArray + ? F extends () => infer Q + ? // Get the plugin encoders, may be ill-formed or well-formed + GetPluginEncoders + : // This should never be reached + undefined + : undefined; type GetPluginFuncArrDecoders = // Given an array of types infer `Q` (Q should be the type value) - PluginFuncArr extends ReadonlyArray ? F extends () => infer Q - ? // Get the plugin decoders, may be ill-formed or well-formed - GetPluginDecoders - : // This should never be reached - undefined : undefined; + PluginFuncArr extends ReadonlyArray + ? F extends () => infer Q + ? // Get the plugin decoders, may be ill-formed or well-formed + GetPluginDecoders + : // This should never be reached + undefined + : undefined; /** * A helper type to get the statics to be intersected with `Jimp` to give diff --git a/project starter code/node_modules/@jimp/custom/CHANGELOG.md b/project starter code/node_modules/@jimp/custom/CHANGELOG.md index 9997674c..5f415137 100644 --- a/project starter code/node_modules/@jimp/custom/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/custom/CHANGELOG.md @@ -1,3 +1,87 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.22.0 (Mon Feb 06 2023) + +#### 🏠 Internal + +- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.18.0 (Sun Feb 05 2023) + +### Release Notes + +#### switch from browserify to webpack ([#1140](https://github.com/jimp-dev/jimp/pull/1140)) + +This PR can be considered a breaking change as it remove the `jimp.min.js` file. + +Instead there is now only the `jimp.js` file and we ship source maps for it. + +We also configured the `browser` field so jimp will be automatically bundled better + +--- + +#### 💥 Breaking Change + +- switch from browserify to webpack [#1140](https://github.com/jimp-dev/jimp/pull/1140) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -36,7 +120,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -44,4 +128,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/custom/README.md b/project starter code/node_modules/@jimp/custom/README.md index e7892bb6..961d7333 100644 --- a/project starter code/node_modules/@jimp/custom/README.md +++ b/project starter code/node_modules/@jimp/custom/README.md @@ -10,15 +10,15 @@ The following wil configure a `jimp` instance with the same functionality as the main `jimp` package. ```js -import configure from '@jimp/custom'; +import configure from "@jimp/custom"; // all of jimp's default types -import types from '@jimp/types'; +import types from "@jimp/types"; // all of jimp's default types -import plugins from '@jimp/plugins'; +import plugins from "@jimp/plugins"; configure({ types: [types], - plugins: [plugins] + plugins: [plugins], }); ``` @@ -54,12 +54,12 @@ You can use configure to add more types and plugins to a jimp multiple times. ```js let jimp = configure({ - types: [bmp] + types: [bmp], }); jimp = configure( { - types: [jpeg] + types: [jpeg], }, jimp ); @@ -167,7 +167,7 @@ Defining a plugin has access to all the same things in the type definition. Main Below is the `invert` plugin. If a plugin doesn return an object with `constants` and `class`, all keys are treated as class functions. ```js -import { isNodePattern } from '@jimp/utils'; +import { isNodePattern } from "@jimp/utils"; /** * Inverts the image @@ -176,21 +176,23 @@ import { isNodePattern } from '@jimp/utils'; */ export default () => ({ invert(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - this.bitmap.data[idx] = 255 - this.bitmap.data[idx]; - this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1]; - this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2]; - }); + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + this.bitmap.data[idx] = 255 - this.bitmap.data[idx]; + this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1]; + this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2]; + } + ); if (isNodePattern(cb)) { cb.call(this, null, this); } return this; - } + }, }); ``` diff --git a/project starter code/node_modules/@jimp/custom/dist/index.js b/project starter code/node_modules/@jimp/custom/dist/index.js index 5379fa58..c0de6b06 100644 --- a/project starter code/node_modules/@jimp/custom/dist/index.js +++ b/project starter code/node_modules/@jimp/custom/dist/index.js @@ -1,89 +1,73 @@ "use strict"; -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = configure; - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); - +exports.default = configure; var _core = _interopRequireWildcard(require("@jimp/core")); - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - +function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } +function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } function configure(configuration) { - var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _core["default"]; - var jimpConfig = { + let jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _core.default; + const jimpConfig = { hasAlpha: {}, encoders: {}, decoders: {}, - "class": {}, + class: {}, constants: {} }; - function addToConfig(newConfig) { - Object.entries(newConfig).forEach(function (_ref) { - var _ref2 = (0, _slicedToArray2["default"])(_ref, 2), - key = _ref2[0], - value = _ref2[1]; - - jimpConfig[key] = _objectSpread({}, jimpConfig[key], {}, value); + Object.entries(newConfig).forEach(_ref => { + let [key, value] = _ref; + jimpConfig[key] = { + ...jimpConfig[key], + ...value + }; }); } - function addImageType(typeModule) { - var type = typeModule(); - + const type = typeModule(); if (Array.isArray(type.mime)) { - _core.addType.apply(void 0, (0, _toConsumableArray2["default"])(type.mime)); + (0, _core.addType)(...type.mime); } else { - Object.entries(type.mime).forEach(function (mimeType) { - return _core.addType.apply(void 0, (0, _toConsumableArray2["default"])(mimeType)); - }); + Object.entries(type.mime).forEach(mimeType => (0, _core.addType)(...mimeType)); } - delete type.mime; addToConfig(type); } - function addPlugin(pluginModule) { - var plugin = pluginModule(_core.jimpEvChange) || {}; - - if (!plugin["class"] && !plugin.constants) { + const plugin = pluginModule(_core.jimpEvChange) || {}; + if (!plugin.class && !plugin.constants) { // Default to class function addToConfig({ - "class": plugin + class: plugin }); } else { addToConfig(plugin); } } - if (configuration.types) { configuration.types.forEach(addImageType); - jimpInstance.decoders = _objectSpread({}, jimpInstance.decoders, {}, jimpConfig.decoders); - jimpInstance.encoders = _objectSpread({}, jimpInstance.encoders, {}, jimpConfig.encoders); - jimpInstance.hasAlpha = _objectSpread({}, jimpInstance.hasAlpha, {}, jimpConfig.hasAlpha); + jimpInstance.decoders = { + ...jimpInstance.decoders, + ...jimpConfig.decoders + }; + jimpInstance.encoders = { + ...jimpInstance.encoders, + ...jimpConfig.encoders + }; + jimpInstance.hasAlpha = { + ...jimpInstance.hasAlpha, + ...jimpConfig.hasAlpha + }; } - if (configuration.plugins) { configuration.plugins.forEach(addPlugin); } - - (0, _core.addJimpMethods)(jimpConfig["class"], jimpInstance); + (0, _core.addJimpMethods)(jimpConfig.class, jimpInstance); (0, _core.addConstants)(jimpConfig.constants, jimpInstance); - return _core["default"]; + return _core.default; } - module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/custom/dist/index.js.map b/project starter code/node_modules/@jimp/custom/dist/index.js.map index afe7b2a4..d6677071 100644 --- a/project starter code/node_modules/@jimp/custom/dist/index.js.map +++ b/project starter code/node_modules/@jimp/custom/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["configure","configuration","jimpInstance","Jimp","jimpConfig","hasAlpha","encoders","decoders","constants","addToConfig","newConfig","Object","entries","forEach","key","value","addImageType","typeModule","type","Array","isArray","mime","addType","mimeType","addPlugin","pluginModule","plugin","jimpEvChange","types","plugins"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;AAOe,SAASA,SAAT,CAAmBC,aAAnB,EAAuD;AAAA,MAArBC,YAAqB,uEAANC,gBAAM;AACpE,MAAMC,UAAU,GAAG;AACjBC,IAAAA,QAAQ,EAAE,EADO;AAEjBC,IAAAA,QAAQ,EAAE,EAFO;AAGjBC,IAAAA,QAAQ,EAAE,EAHO;AAIjB,aAAO,EAJU;AAKjBC,IAAAA,SAAS,EAAE;AALM,GAAnB;;AAQA,WAASC,WAAT,CAAqBC,SAArB,EAAgC;AAC9BC,IAAAA,MAAM,CAACC,OAAP,CAAeF,SAAf,EAA0BG,OAA1B,CAAkC,gBAAkB;AAAA;AAAA,UAAhBC,GAAgB;AAAA,UAAXC,KAAW;;AAClDX,M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lB,EAA2B;AACzB5B,IAAAA,aAAa,CAAC4B,OAAd,CAAsBhB,OAAtB,CAA8BW,SAA9B;AACD;;AAED,4BAAepB,UAAU,SAAzB,EAAiCF,YAAjC;AACA,0BAAaE,UAAU,CAACI,SAAxB,EAAmCN,YAAnC;AAEA,SAAOC,gBAAP;AACD","sourcesContent":["import Jimp, {\n addType,\n addJimpMethods,\n addConstants,\n jimpEvChange\n} from '@jimp/core';\n\nexport default function configure(configuration, jimpInstance = Jimp) {\n const jimpConfig = {\n hasAlpha: {},\n encoders: {},\n decoders: {},\n class: {},\n constants: {}\n };\n\n function addToConfig(newConfig) {\n Object.entries(newConfig).forEach(([key, value]) => {\n jimpConfig[key] = {\n ...jimpConfig[key],\n ...value\n };\n });\n }\n\n function addImageType(typeModule) {\n const type = typeModule();\n\n if (Array.isArray(type.mime)) {\n addType(...type.mime);\n } else {\n Object.entries(type.mime).forEach(mimeType => addType(...mimeType));\n }\n\n delete type.mime;\n addToConfig(type);\n }\n\n function addPlugin(pluginModule) {\n const plugin = pluginModule(jimpEvChange) || {};\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n addToConfig({ class: plugin });\n } else {\n addToConfig(plugin);\n }\n }\n\n if (configuration.types) {\n configuration.types.forEach(addImageType);\n\n jimpInstance.decoders = {\n ...jimpInstance.decoders,\n ...jimpConfig.decoders\n };\n jimpInstance.encoders = {\n ...jimpInstance.encoders,\n ...jimpConfig.encoders\n };\n jimpInstance.hasAlpha = {\n ...jimpInstance.hasAlpha,\n ...jimpConfig.hasAlpha\n };\n }\n\n if (configuration.plugins) {\n configuration.plugins.forEach(addPlugin);\n }\n\n addJimpMethods(jimpConfig.class, jimpInstance);\n addConstants(jimpConfig.constants, jimpInstance);\n\n return Jimp;\n}\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["configure","configuration","jimpInstance","Jimp","jimpConfig","hasAlpha","encoders","decoders","class","constants","addToConfig","newConfig","Object","entries","forEach","key","value","addImageType","typeModule","type","Array","isArray","mime","addType","mimeType","addPlugin","pluginModule","plugin","jimpEvChange","types","plugins","addJimpMethods","addConstants"],"sources":["../src/index.js"],"sourcesContent":["import Jimp, {\n addType,\n addJimpMethods,\n addConstants,\n jimpEvChange,\n} from \"@jimp/core\";\n\nexport default function configure(configuration, jimpInstance = Jimp) {\n const jimpConfig = {\n hasAlpha: {},\n encoders: {},\n decoders: {},\n class: {},\n constants: {},\n };\n\n function addToConfig(newConfig) {\n Object.entries(newConfig).forEach(([key, value]) => {\n jimpConfig[key] = {\n ...jimpConfig[key],\n ...value,\n };\n });\n }\n\n function addImageType(typeModule) {\n const type = typeModule();\n\n if (Array.isArray(type.mime)) {\n addType(...type.mime);\n } else {\n Object.entries(type.mime).forEach((mimeType) => addType(...mimeType));\n }\n\n delete type.mime;\n addToConfig(type);\n }\n\n function addPlugin(pluginModule) {\n const plugin = pluginModule(jimpEvChange) || {};\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n addToConfig({ class: plugin });\n } else {\n addToConfig(plugin);\n }\n }\n\n if (configuration.types) {\n configuration.types.forEach(addImageType);\n\n jimpInstance.decoders = {\n ...jimpInstance.decoders,\n ...jimpConfig.decoders,\n };\n jimpInstance.encoders = {\n ...jimpInstance.encoders,\n ...jimpConfig.encoders,\n };\n jimpInstance.hasAlpha = {\n ...jimpInstance.hasAlpha,\n ...jimpConfig.hasAlpha,\n };\n }\n\n if (configuration.plugins) {\n configuration.plugins.forEach(addPlugin);\n }\n\n addJimpMethods(jimpConfig.class, jimpInstance);\n addConstants(jimpConfig.constants, jimpInstance);\n\n return Jimp;\n}\n"],"mappings":";;;;;;AAAA;AAKoB;AAAA;AAEL,SAASA,SAAS,CAACC,aAAa,EAAuB;EAAA,IAArBC,YAAY,uEAAGC,aAAI;EAClE,MAAMC,UAAU,GAAG;IACjBC,QAAQ,EAAE,CAAC,CAAC;IACZC,QAAQ,EAAE,CAAC,CAAC;IACZC,QAAQ,EAAE,CAAC,CAAC;IACZC,KAAK,EAAE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AAGH,UAAU,CAACG;IAChB,CAAC;IACDL,YAAY,CAACI,QAAQ,GAAG;MACtB,GAAGJ,YAAY,CAACI,QAAQ;MACxB,GAAGF,UAAU,CAACE;IAChB,CAAC;IACDJ,YAAY,CAACG,QAAQ,GAAG;MACtB,GAAGH,YAAY,CAACG,QAAQ;MACxB,GAAGD,UAAU,CAACC;IAChB,CAAC;EACH;EAEA,IAAIJ,aAAa,CAAC6B,OAAO,EAAE;IACzB7B,aAAa,CAAC6B,OAAO,CAAChB,OAAO,CAACW,SAAS,CAAC;EAC1C;EAEA,IAAAM,oBAAc,EAAC3B,UAAU,CAACI,KAAK,EAAEN,YAAY,CAAC;EAC9C,IAAA8B,kBAAY,EAAC5B,UAAU,CAACK,SAAS,EAAEP,YAAY,CAAC;EAEhD,OAAOC,aAAI;AACb;AAAC;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/custom/es/index.js b/project starter code/node_modules/@jimp/custom/es/index.js index ddc334e1..efc8a97a 100644 --- a/project starter code/node_modules/@jimp/custom/es/index.js +++ b/project starter code/node_modules/@jimp/custom/es/index.js @@ -1,87 +1,63 @@ -"use strict"; - -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = configure; - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); - -var _core = _interopRequireWildcard(require("@jimp/core")); - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function configure(configuration) { - var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _core["default"]; - var jimpConfig = { +import Jimp, { addType, addJimpMethods, addConstants, jimpEvChange } from "@jimp/core"; +export default function configure(configuration) { + let jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp; + const jimpConfig = { hasAlpha: {}, encoders: {}, decoders: {}, - "class": {}, + class: {}, constants: {} }; - function addToConfig(newConfig) { - Object.entries(newConfig).forEach(function (_ref) { - var _ref2 = (0, _slicedToArray2["default"])(_ref, 2), - key = _ref2[0], - value = _ref2[1]; - - jimpConfig[key] = _objectSpread({}, jimpConfig[key], {}, value); + Object.entries(newConfig).forEach(_ref => { + let [key, value] = _ref; + jimpConfig[key] = { + ...jimpConfig[key], + ...value + }; }); } - function addImageType(typeModule) { - var type = typeModule(); - + const type = typeModule(); if (Array.isArray(type.mime)) { - _core.addType.apply(void 0, (0, _toConsumableArray2["default"])(type.mime)); + addType(...type.mime); } else { - Object.entries(type.mime).forEach(function (mimeType) { - return _core.addType.apply(void 0, (0, _toConsumableArray2["default"])(mimeType)); - }); + Object.entries(type.mime).forEach(mimeType => addType(...mimeType)); } - delete type.mime; addToConfig(type); } - function addPlugin(pluginModule) { - var plugin = pluginModule(_core.jimpEvChange) || {}; - - if (!plugin["class"] && !plugin.constants) { + const plugin = pluginModule(jimpEvChange) || {}; + if (!plugin.class && !plugin.constants) { // Default to class function addToConfig({ - "class": plugin + class: plugin }); } else { addToConfig(plugin); } } - if (configuration.types) { configuration.types.forEach(addImageType); - jimpInstance.decoders = _objectSpread({}, jimpInstance.decoders, {}, jimpConfig.decoders); - jimpInstance.encoders = _objectSpread({}, jimpInstance.encoders, {}, jimpConfig.encoders); - jimpInstance.hasAlpha = _objectSpread({}, jimpInstance.hasAlpha, {}, jimpConfig.hasAlpha); + jimpInstance.decoders = { + ...jimpInstance.decoders, + ...jimpConfig.decoders + }; + jimpInstance.encoders = { + ...jimpInstance.encoders, + ...jimpConfig.encoders + }; + jimpInstance.hasAlpha = { + ...jimpInstance.hasAlpha, + ...jimpConfig.hasAlpha + }; } - if (configuration.plugins) { configuration.plugins.forEach(addPlugin); } - - (0, _core.addJimpMethods)(jimpConfig["class"], jimpInstance); - (0, _core.addConstants)(jimpConfig.constants, jimpInstance); - return _core["default"]; + addJimpMethods(jimpConfig.class, jimpInstance); + addConstants(jimpConfig.constants, jimpInstance); + return Jimp; } //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/custom/es/index.js.map b/project starter code/node_modules/@jimp/custom/es/index.js.map index afe7b2a4..066194f4 100644 --- a/project starter code/node_modules/@jimp/custom/es/index.js.map +++ b/project starter code/node_modules/@jimp/custom/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["configure","configuration","jimpInstance","Jimp","jimpConfig","hasAlpha","encoders","decoders","constants","addToConfig","newConfig","Object","entries","forEach","key","value","addImageType","typeModule","type","Array","isArray","mime","addType","mimeType","addPlugin","pluginModule","plugin","jimpEvChange","types","plugins"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;AAOe,SAASA,SAAT,CAAmBC,aAAnB,EAAuD;AAAA,MAArBC,YAAqB,uEAANC,gBAAM;AACpE,MAAMC,UAAU,GAAG;AACjBC,IAAAA,QAAQ,EAAE,EADO;AAEjBC,IAAAA,QAAQ,EAAE,EAFO;AAGjBC,IAAAA,QAAQ,EAAE,EAHO;AAIjB,aAAO,EAJU;AAKjBC,IAAAA,SAAS,EAAE;AALM,GAAnB;;AAQA,WA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AAY,CAACI,QADlB,MAEKF,UAAU,CAACE,QAFhB;AAIAJ,IAAAA,YAAY,CAACG,QAAb,qBACKH,YAAY,CAACG,QADlB,MAEKD,UAAU,CAACC,QAFhB;AAID;;AAED,MAAIJ,aAAa,CAAC4B,OAAlB,EAA2B;AACzB5B,IAAAA,aAAa,CAAC4B,OAAd,CAAsBhB,OAAtB,CAA8BW,SAA9B;AACD;;AAED,4BAAepB,UAAU,SAAzB,EAAiCF,YAAjC;AACA,0BAAaE,UAAU,CAACI,SAAxB,EAAmCN,YAAnC;AAEA,SAAOC,gBAAP;AACD","sourcesContent":["import Jimp, {\n addType,\n addJimpMethods,\n addConstants,\n jimpEvChange\n} from '@jimp/core';\n\nexport default function configure(configuration, jimpInstance = Jimp) {\n const jimpConfig = {\n hasAlpha: {},\n encoders: {},\n decoders: {},\n class: {},\n constants: {}\n };\n\n function addToConfig(newConfig) {\n Object.entries(newConfig).forEach(([key, value]) => {\n jimpConfig[key] = {\n ...jimpConfig[key],\n ...value\n };\n });\n }\n\n function addImageType(typeModule) {\n const type = typeModule();\n\n if (Array.isArray(type.mime)) {\n addType(...type.mime);\n } else {\n Object.entries(type.mime).forEach(mimeType => addType(...mimeType));\n }\n\n delete type.mime;\n addToConfig(type);\n }\n\n function addPlugin(pluginModule) {\n const plugin = pluginModule(jimpEvChange) || {};\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n addToConfig({ class: plugin });\n } else {\n addToConfig(plugin);\n }\n }\n\n if (configuration.types) {\n configuration.types.forEach(addImageType);\n\n jimpInstance.decoders = {\n ...jimpInstance.decoders,\n ...jimpConfig.decoders\n };\n jimpInstance.encoders = {\n ...jimpInstance.encoders,\n ...jimpConfig.encoders\n };\n jimpInstance.hasAlpha = {\n ...jimpInstance.hasAlpha,\n ...jimpConfig.hasAlpha\n };\n }\n\n if (configuration.plugins) {\n configuration.plugins.forEach(addPlugin);\n }\n\n addJimpMethods(jimpConfig.class, jimpInstance);\n addConstants(jimpConfig.constants, jimpInstance);\n\n return Jimp;\n}\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["Jimp","addType","addJimpMethods","addConstants","jimpEvChange","configure","configuration","jimpInstance","jimpConfig","hasAlpha","encoders","decoders","class","constants","addToConfig","newConfig","Object","entries","forEach","key","value","addImageType","typeModule","type","Array","isArray","mime","mimeType","addPlugin","pluginModule","plugin","types","plugins"],"sources":["../src/index.js"],"sourcesContent":["import Jimp, {\n addType,\n addJimpMethods,\n addConstants,\n jimpEvChange,\n} from \"@jimp/core\";\n\nexport default function configure(configuration, jimpInstance = Jimp) {\n const jimpConfig = {\n hasAlpha: {},\n encoders: {},\n decoders: {},\n class: {},\n constants: {},\n };\n\n function addToConfig(newConfig) {\n Object.entries(newConfig).forEach(([key, value]) => {\n jimpConfig[key] = {\n ...jimpConfig[key],\n ...value,\n };\n });\n }\n\n function addImageType(typeModule) {\n const type = typeModule();\n\n if (Array.isArray(type.mime)) {\n addType(...type.mime);\n } else {\n Object.entries(type.mime).forEach((mimeType) => addType(...mimeType));\n }\n\n delete type.mime;\n addToConfig(type);\n }\n\n function addPlugin(pluginModule) {\n const plugin = pluginModule(jimpEvChange) || {};\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n addToConfig({ class: plugin });\n } else {\n addToConfig(plugin);\n }\n }\n\n if (configuration.types) {\n configuration.types.forEach(addImageType);\n\n jimpInstance.decoders = {\n ...jimpInstance.decoders,\n ...jimpConfig.decoders,\n };\n jimpInstance.encoders = {\n ...jimpInstance.encoders,\n ...jimpConfig.encoders,\n };\n jimpInstance.hasAlpha = {\n ...jimpInstance.hasAlpha,\n ...jimpConfig.hasAlpha,\n };\n }\n\n if (configuration.plugins) {\n configuration.plugins.forEach(addPlugin);\n }\n\n addJimpMethods(jimpConfig.class, jimpInstance);\n addConstants(jimpConfig.constants, jimpInstance);\n\n return Jimp;\n}\n"],"mappings":"AAAA,OAAOA,IAAI,IACTC,OAAO,EACPC,cAAc,EACdC,YAAY,EACZC,YAAY,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AAM;MACLhB,WAAW,CAACgB,MAAM,CAAC;IACrB;EACF;EAEA,IAAIxB,aAAa,CAACyB,KAAK,EAAE;IACvBzB,aAAa,CAACyB,KAAK,CAACb,OAAO,CAACG,YAAY,CAAC;IAEzCd,YAAY,CAACI,QAAQ,GAAG;MACtB,GAAGJ,YAAY,CAACI,QAAQ;MACxB,GAAGH,UAAU,CAACG;IAChB,CAAC;IACDJ,YAAY,CAACG,QAAQ,GAAG;MACtB,GAAGH,YAAY,CAACG,QAAQ;MACxB,GAAGF,UAAU,CAACE;IAChB,CAAC;IACDH,YAAY,CAACE,QAAQ,GAAG;MACtB,GAAGF,YAAY,CAACE,QAAQ;MACxB,GAAGD,UAAU,CAACC;IAChB,CAAC;EACH;EAEA,IAAIH,aAAa,CAAC0B,OAAO,EAAE;IACzB1B,aAAa,CAAC0B,OAAO,CAACd,OAAO,CAACU,SAAS,CAAC;EAC1C;EAEA1B,cAAc,CAACM,UAAU,CAACI,KAAK,EAAEL,YAAY,CAAC;EAC9CJ,YAAY,CAACK,UAAU,CAACK,SAAS,EAAEN,YAAY,CAAC;EAEhD,OAAOP,IAAI;AACb"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/custom/package.json b/project starter code/node_modules/@jimp/custom/package.json index e0aa83b5..d64fb4be 100644 --- a/project starter code/node_modules/@jimp/custom/package.json +++ b/project starter code/node_modules/@jimp/custom/package.json @@ -1,9 +1,10 @@ { "name": "@jimp/custom", - "version": "0.16.2", + "version": "0.22.12", "description": "Interface to customize jimp configuration", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "types/index.d.ts", "scripts": { "build": "npm run build:node:production && npm run build:module", @@ -17,11 +18,10 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/core": "^0.16.2" + "@jimp/core": "^0.22.12" }, "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/custom/src/index.js b/project starter code/node_modules/@jimp/custom/src/index.js index ce571f80..dddc7d90 100644 --- a/project starter code/node_modules/@jimp/custom/src/index.js +++ b/project starter code/node_modules/@jimp/custom/src/index.js @@ -2,8 +2,8 @@ import Jimp, { addType, addJimpMethods, addConstants, - jimpEvChange -} from '@jimp/core'; + jimpEvChange, +} from "@jimp/core"; export default function configure(configuration, jimpInstance = Jimp) { const jimpConfig = { @@ -11,14 +11,14 @@ export default function configure(configuration, jimpInstance = Jimp) { encoders: {}, decoders: {}, class: {}, - constants: {} + constants: {}, }; function addToConfig(newConfig) { Object.entries(newConfig).forEach(([key, value]) => { jimpConfig[key] = { ...jimpConfig[key], - ...value + ...value, }; }); } @@ -29,7 +29,7 @@ export default function configure(configuration, jimpInstance = Jimp) { if (Array.isArray(type.mime)) { addType(...type.mime); } else { - Object.entries(type.mime).forEach(mimeType => addType(...mimeType)); + Object.entries(type.mime).forEach((mimeType) => addType(...mimeType)); } delete type.mime; @@ -51,15 +51,15 @@ export default function configure(configuration, jimpInstance = Jimp) { jimpInstance.decoders = { ...jimpInstance.decoders, - ...jimpConfig.decoders + ...jimpConfig.decoders, }; jimpInstance.encoders = { ...jimpInstance.encoders, - ...jimpConfig.encoders + ...jimpConfig.encoders, }; jimpInstance.hasAlpha = { ...jimpInstance.hasAlpha, - ...jimpConfig.hasAlpha + ...jimpConfig.hasAlpha, }; } diff --git a/project starter code/node_modules/@jimp/custom/types/index.d.ts b/project starter code/node_modules/@jimp/custom/types/index.d.ts index bdd65342..dc528878 100644 --- a/project starter code/node_modules/@jimp/custom/types/index.d.ts +++ b/project starter code/node_modules/@jimp/custom/types/index.d.ts @@ -1,4 +1,4 @@ -// TypeScript Version: 3.1 +// Minimum TypeScript Version: 3.2 // See the `jimp` package index.d.ts for why the version is not 2.8 import { FunctionRet, @@ -7,16 +7,22 @@ import { JimpType, GetIntersectionFromPlugins, GetIntersectionFromPluginsStatics, - JimpConstructors -} from '@jimp/core'; + JimpConstructors, +} from "@jimp/core"; type JimpInstance< TypesFuncArr extends FunctionRet | undefined, PluginFuncArr extends FunctionRet | undefined, J extends JimpConstructors -> = J & GetIntersectionFromPluginsStatics> & { - prototype: JimpType & GetIntersectionFromPlugins> -}; +> = J & + GetIntersectionFromPluginsStatics< + Exclude + > & { + prototype: JimpType & + GetIntersectionFromPlugins< + Exclude + >; + }; declare function configure< TypesFuncArr extends FunctionRet | undefined = undefined, diff --git a/project starter code/node_modules/@jimp/custom/types/test.ts b/project starter code/node_modules/@jimp/custom/types/test.ts index 9b7f20a3..e0f77bb2 100644 --- a/project starter code/node_modules/@jimp/custom/types/test.ts +++ b/project starter code/node_modules/@jimp/custom/types/test.ts @@ -1,36 +1,36 @@ -import configure from '@jimp/custom'; -import gif from '@jimp/gif'; -import png from '@jimp/png'; -import displace from '@jimp/plugin-displace'; -import resize from '@jimp/plugin-resize'; -import scale from '@jimp/plugin-scale'; -import types from '@jimp/types'; -import plugins from '@jimp/plugins'; -import * as Jimp from 'jimp'; +import configure from "@jimp/custom"; +import gif from "@jimp/gif"; +import png from "@jimp/png"; +import displace from "@jimp/plugin-displace"; +import resize from "@jimp/plugin-resize"; +import scale from "@jimp/plugin-scale"; +import types from "@jimp/types"; +import plugins from "@jimp/plugins"; +import * as Jimp from "jimp"; // configure should return a valid Jimp type with addons const CustomJimp = configure({ types: [gif, png], - plugins: [displace, resize] + plugins: [displace, resize], }); -test('should function the same as the `jimp` types', () => { +test("should function the same as the `jimp` types", () => { const FullCustomJimp = configure({ types: [types], - plugins: [plugins] + plugins: [plugins], }); - const jimpInst = new FullCustomJimp('test'); + const jimpInst = new FullCustomJimp("test"); // Main Jimp export should already have all of these already applied // $ExpectError - jimpInst.read('Test'); + jimpInst.read("Test"); jimpInst.displace(jimpInst, 2); jimpInst.resize(40, 40); jimpInst.displace(jimpInst, 2); jimpInst.shadow((err, val, coords) => {}); - jimpInst.fishEye({r: 12}); - jimpInst.circle({radius: 12, x: 12, y: 12}); + jimpInst.fishEye({ r: 12 }); + jimpInst.circle({ radius: 12, x: 12, y: 12 }); // $ExpectError jimpInst.PNG_FILTER_NONE; @@ -41,7 +41,7 @@ test('should function the same as the `jimp` types', () => { jimpInst.func(); // Main Jimp export should already have all of these already applied - FullCustomJimp.read('Test'); + FullCustomJimp.read("Test"); // $ExpectType 0 FullCustomJimp.PNG_FILTER_NONE; @@ -52,34 +52,33 @@ test('should function the same as the `jimp` types', () => { // $ExpectError FullCustomJimp.func(); - test('can clone properly', async () => { - const baseImage = await FullCustomJimp.read('filename'); + test("can clone properly", async () => { + const baseImage = await FullCustomJimp.read("filename"); const cloneBaseImage = baseImage.clone(); // $ExpectType number cloneBaseImage._deflateLevel; - test('can handle `this` returns on the core type properly', () => { + test("can handle `this` returns on the core type properly", () => { // $ExpectType number - cloneBaseImage.posterize(3)._quality + cloneBaseImage.posterize(3)._quality; }); - test('can handle `this` returns properly', () => { + test("can handle `this` returns properly", () => { cloneBaseImage .resize(1, 1) .crop(0, 0, 0, 0) .mask(cloneBaseImage, 2, 2) - .print('a' as any, 2, 2, 'a' as any) + .print("a" as any, 2, 2, "a" as any) .resize(1, 1) .quality(1) - .deflateLevel(2) - ._filterType; + .deflateLevel(2)._filterType; }); - test('can handle imageCallbacks `this` properly', () => { + test("can handle imageCallbacks `this` properly", () => { cloneBaseImage.rgba(false, (_, jimpCBIn) => { // $ExpectError - jimpCBIn.read('Test'); + jimpCBIn.read("Test"); jimpCBIn.displace(jimpInst, 2); jimpCBIn.resize(40, 40); // $ExpectType number @@ -90,16 +89,16 @@ test('should function the same as the `jimp` types', () => { // $ExpectError jimpCBIn.func(); - }) - }) + }); + }); }); - test('Can handle callback with constructor', () => { + test("Can handle callback with constructor", () => { const myBmpBuffer: Buffer = {} as any; Jimp.read(myBmpBuffer, (err, cbJimpInst) => { // $ExpectError - cbJimpInst.read('Test'); + cbJimpInst.read("Test"); cbJimpInst.displace(jimpInst, 2); cbJimpInst.resize(40, 40); // $ExpectType number @@ -112,16 +111,15 @@ test('should function the same as the `jimp` types', () => { cbJimpInst.func(); }); }); - }); -test('can handle custom jimp', () => { +test("can handle custom jimp", () => { // Constants from types should be applied // $ExpectType 0 CustomJimp.PNG_FILTER_NONE; - + // Core functions should still work from Jimp - CustomJimp.read('Test'); + CustomJimp.read("Test"); // Constants should not(?) be applied from ill-formed plugins // $ExpectError @@ -129,18 +127,18 @@ test('can handle custom jimp', () => { // Methods should be applied from well-formed plugins only to the instance // $ExpectError - CustomJimp.resize(40, 40) - + CustomJimp.resize(40, 40); + // Constants should be applied from well-formed plugins - CustomJimp.RESIZE_NEAREST_NEIGHBOR - + CustomJimp.RESIZE_NEAREST_NEIGHBOR; + // $ExpectError CustomJimp.test; - + // $ExpectError CustomJimp.func(); - const Jiimp = new CustomJimp('test'); + const Jiimp = new CustomJimp("test"); // Methods from types should be applied Jiimp.deflateLevel(4); // Constants from types should be applied to the static only @@ -154,11 +152,11 @@ test('can handle custom jimp', () => { Jiimp.displace(Jiimp, 2); // Methods should be applied from well-formed plugins - Jiimp.resize(40, 40) + Jiimp.resize(40, 40); // Constants should not be applied to the object // $ExpectError - Jiimp.RESIZE_NEAREST_NEIGHBOR + Jiimp.RESIZE_NEAREST_NEIGHBOR; // $ExpectError Jiimp.test; @@ -167,16 +165,19 @@ test('can handle custom jimp', () => { Jiimp.func(); }); -test('can compose', () => { - const OtherCustomJimp = configure({ - plugins: [scale] - }, CustomJimp); +test("can compose", () => { + const OtherCustomJimp = configure( + { + plugins: [scale], + }, + CustomJimp + ); // Constants from types should be applied // $ExpectType 0 OtherCustomJimp.PNG_FILTER_NONE; // Core functions should still work from Jimp - OtherCustomJimp.read('Test'); + OtherCustomJimp.read("Test"); // Constants should not be applied to the static instance from ill-formed plugins // $ExpectError @@ -194,8 +195,8 @@ test('can compose', () => { // $ExpectError OtherCustomJimp.func(); - - const Jiimp = new OtherCustomJimp('test'); + + const Jiimp = new OtherCustomJimp("test"); // Methods from types should be applied Jiimp.deflateLevel(4); // Constants from types should not be applied to objects @@ -215,11 +216,11 @@ test('can compose', () => { Jiimp.displace(Jiimp, 2); // Methods should be applied from well-formed plugins - Jiimp.resize(40, 40) + Jiimp.resize(40, 40); // Constants should not be applied from well-formed plugins to objects // $ExpectError - Jiimp.RESIZE_NEAREST_NEIGHBOR + Jiimp.RESIZE_NEAREST_NEIGHBOR; // $ExpectError Jiimp.test; @@ -228,13 +229,13 @@ test('can compose', () => { Jiimp.func(); }); -test('can handle only plugins', () => { +test("can handle only plugins", () => { const PluginsJimp = configure({ - plugins: [plugins] + plugins: [plugins], }); // Core functions should still work from Jimp - PluginsJimp.read('Test'); + PluginsJimp.read("Test"); // Constants should not be applied from ill-formed plugins // $ExpectError @@ -254,8 +255,8 @@ test('can handle only plugins', () => { // $ExpectError PluginsJimp.func(); - const Jiimp = new PluginsJimp('test'); - + const Jiimp = new PluginsJimp("test"); + // Core functions should still work from Jimp Jiimp.getPixelColor(1, 1); @@ -263,22 +264,22 @@ test('can handle only plugins', () => { Jiimp.displace(Jiimp, 2); // Methods should be applied from well-formed plugins - Jiimp.resize(40, 40) + Jiimp.resize(40, 40); // Constants should be not applied to objects from well-formed plugins // $ExpectError - Jiimp.RESIZE_NEAREST_NEIGHBOR + Jiimp.RESIZE_NEAREST_NEIGHBOR; // $ExpectError Jiimp.test; // $ExpectError Jiimp.func(); -}) +}); -test('can handle only all types', () => { +test("can handle only all types", () => { const TypesJimp = configure({ - types: [types] + types: [types], }); // Methods from types should not be applied @@ -294,7 +295,7 @@ test('can handle only all types', () => { // $ExpectError TypesJimp.func(); - const Jiimp = new TypesJimp('test'); + const Jiimp = new TypesJimp("test"); // Methods from types should be applied Jiimp.filterType(4); // Constants from types should be not applied to objects @@ -308,9 +309,9 @@ test('can handle only all types', () => { Jiimp.func(); }); -test('can handle only one type', () => { +test("can handle only one type", () => { const PngJimp = configure({ - types: [png] + types: [png], }); // Constants from other types should be not applied @@ -320,15 +321,14 @@ test('can handle only one type', () => { // Constants from types should be applied // $ExpectType 0 PngJimp.PNG_FILTER_NONE; - + // $ExpectError PngJimp.test; // $ExpectError PngJimp.func(); - - const Jiimp = new PngJimp('test'); + const Jiimp = new PngJimp("test"); // Constants from other types should be not applied // $ExpectError Jiimp.MIME_TIFF; @@ -344,10 +344,9 @@ test('can handle only one type', () => { Jiimp.func(); }); - -test('can handle only one plugin', () => { +test("can handle only one plugin", () => { const ResizeJimp = configure({ - plugins: [resize] + plugins: [resize], }); // Constants from other plugins should be not applied @@ -367,8 +366,7 @@ test('can handle only one plugin', () => { // $ExpectError ResizeJimp.func(); - - const Jiimp: InstanceType = new ResizeJimp('test'); + const Jiimp: InstanceType = new ResizeJimp("test"); // Constants from other plugins should be not applied // $ExpectError Jiimp.FONT_SANS_8_BLACK; @@ -386,14 +384,13 @@ test('can handle only one plugin', () => { Jiimp.func(); }); - -test('Can handle appendConstructorOption', () => { +test("Can handle appendConstructorOption", () => { const AppendJimp = configure({}); AppendJimp.appendConstructorOption( - 'Name of Option', - args => args.hasSomeCustomThing, - function(resolve, reject, args) { + "Name of Option", + (args) => args.hasSomeCustomThing, + function (resolve, reject, args) { // $ExpectError this.bitmap = 3; // $ExpectError diff --git a/project starter code/node_modules/@jimp/custom/types/tsconfig.json b/project starter code/node_modules/@jimp/custom/types/tsconfig.json index dcfe450f..a2773dce 100644 --- a/project starter code/node_modules/@jimp/custom/types/tsconfig.json +++ b/project starter code/node_modules/@jimp/custom/types/tsconfig.json @@ -6,6 +6,7 @@ "noImplicitThis": true, "strictNullChecks": true, "strictFunctionTypes": true, + "skipLibCheck": true, "noEmit": true, // If the library is an external module (uses `export`), this allows your test file to import "mylib" instead of "./index". diff --git a/project starter code/node_modules/@jimp/gif/CHANGELOG.md b/project starter code/node_modules/@jimp/gif/CHANGELOG.md index 392a46ce..e12d31e0 100644 --- a/project starter code/node_modules/@jimp/gif/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/gif/CHANGELOG.md @@ -1,3 +1,81 @@ +# v0.22.9 (Wed Jul 26 2023) + +:tada: This release contains work from a new contributor! :tada: + +Thank you, Nicolas Morel ([@Marsup](https://github.com/Marsup)), for all your work! + +#### 🚀 Enhancement + +- chore: upgrade gifwrap [#1222](https://github.com/jimp-dev/jimp/pull/1222) ([@Marsup](https://github.com/Marsup)) + +#### Authors: 1 + +- Nicolas Morel ([@Marsup](https://github.com/Marsup)) + +--- + +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.22.0 (Mon Feb 06 2023) + +#### 🏠 Internal + +- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Daniel Holmes ([@danielholmes](https://github.com/danielholmes)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.13.0 (Fri Jun 05 2020) #### 🚀 Enhancement @@ -25,7 +103,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -33,4 +111,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/gif/dist/index.js b/project starter code/node_modules/@jimp/gif/dist/index.js index ee1f31c2..b25bc145 100644 --- a/project starter code/node_modules/@jimp/gif/dist/index.js +++ b/project starter code/node_modules/@jimp/gif/dist/index.js @@ -1,50 +1,45 @@ "use strict"; -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - +exports.default = void 0; var _omggif = _interopRequireDefault(require("omggif")); - var _gifwrap = require("gifwrap"); - -var MIME_TYPE = 'image/gif'; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['gif']), - constants: { - MIME_GIF: MIME_TYPE - }, - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var gifObj = new _omggif["default"].GifReader(data); - var gifData = Buffer.alloc(gifObj.width * gifObj.height * 4); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +const MIME_TYPE = "image/gif"; +var _default = () => ({ + mime: { + [MIME_TYPE]: ["gif"] + }, + constants: { + MIME_GIF: MIME_TYPE + }, + decoders: { + [MIME_TYPE]: data => { + const gifObj = new _omggif.default.GifReader(data); + const gifData = Buffer.alloc(gifObj.width * gifObj.height * 4); gifObj.decodeAndBlitFrameRGBA(0, gifData); return { data: gifData, width: gifObj.width, height: gifObj.height }; - }), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var bitmap = new _gifwrap.BitmapImage(data.bitmap); - + } + }, + encoders: { + [MIME_TYPE]: data => { + const bitmap = new _gifwrap.BitmapImage(data.bitmap); _gifwrap.GifUtil.quantizeDekker(bitmap, 256); - - var newFrame = new _gifwrap.GifFrame(bitmap); - var gifCodec = new _gifwrap.GifCodec(); - return gifCodec.encodeGif([newFrame], {}).then(function (newGif) { + const newFrame = new _gifwrap.GifFrame(bitmap); + const gifCodec = new _gifwrap.GifCodec(); + return gifCodec.encodeGif([newFrame], {}).then(newGif => { return newGif.buffer; }); - }) - }; -}; - -exports["default"] = _default; + } + } +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/gif/dist/index.js.map b/project starter code/node_modules/@jimp/gif/dist/index.js.map index fcc6e6d8..2a9c98f7 100644 --- a/project starter code/node_modules/@jimp/gif/dist/index.js.map +++ b/project starter code/node_modules/@jimp/gif/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","mime","constants","MIME_GIF","decoders","data","gifObj","GIF","GifReader","gifData","Buffer","alloc","width","height","decodeAndBlitFrameRGBA","encoders","bitmap","BitmapImage","GifUtil","quantizeDekker","newFrame","GifFrame","gifCodec","GifCodec","encodeGif","then","newGif","buffer"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,WAAlB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKD,SAAL,EAAiB,CAAC,KAAD,CAAjB,CADgB;AAGpBE,IAAAA,SAAS,EAAE;AACTC,MAAAA,QAAQ,EAAEH;AADD,KAHS;AAOpBI,IAAAA,QAAQ,uCACLJ,SADK,EACO,UAAAK,IAAI,EAAI;AACnB,UAAMC,MAAM,GAAG,IAAIC,mBAAIC,SAAR,CAAkBH,IAAlB,CAAf;AACA,UAAMI,OAAO,GAAGC,MAAM,CAACC,KAAP,CAAaL,MAAM,CAACM,KAAP,GAAeN,MAAM,CAACO,MAAtB,GAA+B,CAA5C,CAAhB;AAEAP,MAAAA,MAAM,CAACQ,sBAAP,CAA8B,CAA9B,EAAiCL,OAAjC;AAEA,aAAO;AACLJ,QAAAA,IAAI,EAAEI,OADD;AAELG,QAAAA,KAAK,EAAEN,MAAM,CAACM,KAFT;AAGLC,QAAAA,MAAM,EAAEP,MAAM,CAACO;AAHV,OAAP;AAKD,KAZK,CAPY;AAsBpBE,IAAAA,QAAQ,uCACLf,SADK,EACO,UAAAK,IAAI,EAAI;AACnB,UAAMW,MAAM,GAAG,IAAIC,oBAAJ,CAAgBZ,IAAI,CAACW,MAArB,CAAf;;AACAE,uBAAQC,cAAR,CAAuBH,MAAvB,EAA+B,GAA/B;;AACA,UAAMI,QAAQ,GAAG,IAAIC,iBAAJ,CAAaL,MAAb,CAAjB;AACA,UAAMM,QAAQ,GAAG,IAAIC,iBAAJ,EAAjB;AACA,aAAOD,QAAQ,CAACE,SAAT,CAAmB,CAACJ,QAAD,CAAnB,EAA+B,EAA/B,EAAmCK,IAAnC,CAAwC,UAAAC,MAAM,EAAI;AACvD,eAAOA,MAAM,CAACC,MAAd;AACD,OAFM,CAAP;AAGD,KATK;AAtBY,GAAP;AAAA,C","sourcesContent":["import GIF from 'omggif';\nimport { GifUtil, GifFrame, BitmapImage, GifCodec } from 'gifwrap';\n\nconst MIME_TYPE = 'image/gif';\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['gif'] },\n\n constants: {\n MIME_GIF: MIME_TYPE\n },\n\n decoders: {\n [MIME_TYPE]: data => {\n const gifObj = new GIF.GifReader(data);\n const gifData = Buffer.alloc(gifObj.width * gifObj.height * 4);\n\n gifObj.decodeAndBlitFrameRGBA(0, gifData);\n\n return {\n data: gifData,\n width: gifObj.width,\n height: gifObj.height\n };\n }\n },\n\n encoders: {\n [MIME_TYPE]: data => {\n const bitmap = new BitmapImage(data.bitmap);\n GifUtil.quantizeDekker(bitmap, 256);\n const newFrame = new GifFrame(bitmap);\n const gifCodec = new GifCodec();\n return gifCodec.encodeGif([newFrame], {}).then(newGif => {\n return newGif.buffer;\n });\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["MIME_TYPE","mime","constants","MIME_GIF","decoders","data","gifObj","GIF","GifReader","gifData","Buffer","alloc","width","height","decodeAndBlitFrameRGBA","encoders","bitmap","BitmapImage","GifUtil","quantizeDekker","newFrame","GifFrame","gifCodec","GifCodec","encodeGif","then","newGif","buffer"],"sources":["../src/index.js"],"sourcesContent":["import GIF from \"omggif\";\nimport { GifUtil, GifFrame, BitmapImage, GifCodec } from \"gifwrap\";\n\nconst MIME_TYPE = \"image/gif\";\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"gif\"] },\n\n constants: {\n MIME_GIF: MIME_TYPE,\n },\n\n decoders: {\n [MIME_TYPE]: (data) => {\n const gifObj = new GIF.GifReader(data);\n const gifData = Buffer.alloc(gifObj.width * gifObj.height * 4);\n\n gifObj.decodeAndBlitFrameRGBA(0, gifData);\n\n return {\n data: gifData,\n width: gifObj.width,\n height: gifObj.height,\n };\n },\n },\n\n encoders: {\n [MIME_TYPE]: (data) => {\n const bitmap = new BitmapImage(data.bitmap);\n GifUtil.quantizeDekker(bitmap, 256);\n const newFrame = new GifFrame(bitmap);\n const gifCodec = new GifCodec();\n return gifCodec.encodeGif([newFrame], {}).then((newGif) => {\n return newGif.buffer;\n });\n },\n },\n});\n"],"mappings":";;;;;;AAAA;AACA;AAAmE;AAEnE,MAAMA,SAAS,GAAG,WAAW;AAAC,eAEf,OAAO;EACpBC,IAAI,EAAE;IAAE,CAACD,SAAS,GAAG,CAAC,KAAK;EAAE,CAAC;EAE9BE,SAAS,EAAE;IACTC,QAAQ,EAAEH;EACZ,CAAC;EAEDI,QAAQ,EAAE;IACR,CAACJ,SAAS,GAAIK,IAAI,IAAK;MACrB,MAAMC,MAAM,GAAG,IAAIC,eAAG,CAACC,SAAS,CAACH,IAAI,CAAC;MACtC,MAAMI,OAAO,GAAGC,MAAM,CAACC,KAAK,CAACL,MAAM,CAACM,KAAK,GAAGN,MAAM,CAACO,MAAM,GAAG,CAAC,CAAC;MAE9DP,MAAM,CAACQ,sBAAsB,CAAC,CAAC,EAAEL,OAAO,CAAC;MAEzC,OAAO;QACLJ,IAAI,EAAEI,OAAO;QACbG,KAAK,EAAEN,MAAM,CAACM,KAAK;QACnBC,MAAM,EAAEP,MAAM,CAACO;MACjB,CAAC;IACH;EACF,CAAC;EAEDE,QAAQ,EAAE;IACR,CAACf,SAAS,GAAIK,IAAI,IAAK;MACrB,MAAMW,MAAM,GAAG,IAAIC,oBAAW,CAACZ,IAAI,CAACW,MAAM,CAAC;MAC3CE,gBAAO,CAACC,cAAc,CAACH,MAAM,EAAE,GAAG,CAAC;MACnC,MAAMI,QAAQ,GAAG,IAAIC,iBAAQ,CAACL,MAAM,CAAC;MACrC,MAAMM,QAAQ,GAAG,IAAIC,iBAAQ,EAAE;MAC/B,OAAOD,QAAQ,CAACE,SAAS,CAAC,CAACJ,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAACK,IAAI,CAAEC,MAAM,IAAK;QACzD,OAAOA,MAAM,CAACC,MAAM;MACtB,CAAC,CAAC;IACJ;EACF;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/gif/es/index.js b/project starter code/node_modules/@jimp/gif/es/index.js index 37015c1e..5a527cd0 100644 --- a/project starter code/node_modules/@jimp/gif/es/index.js +++ b/project starter code/node_modules/@jimp/gif/es/index.js @@ -1,49 +1,35 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _omggif = _interopRequireDefault(require("omggif")); - -var _gifwrap = require("gifwrap"); - -var MIME_TYPE = 'image/gif'; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['gif']), - constants: { - MIME_GIF: MIME_TYPE - }, - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var gifObj = new _omggif["default"].GifReader(data); - var gifData = Buffer.alloc(gifObj.width * gifObj.height * 4); +import GIF from "omggif"; +import { GifUtil, GifFrame, BitmapImage, GifCodec } from "gifwrap"; +const MIME_TYPE = "image/gif"; +export default (() => ({ + mime: { + [MIME_TYPE]: ["gif"] + }, + constants: { + MIME_GIF: MIME_TYPE + }, + decoders: { + [MIME_TYPE]: data => { + const gifObj = new GIF.GifReader(data); + const gifData = Buffer.alloc(gifObj.width * gifObj.height * 4); gifObj.decodeAndBlitFrameRGBA(0, gifData); return { data: gifData, width: gifObj.width, height: gifObj.height }; - }), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var bitmap = new _gifwrap.BitmapImage(data.bitmap); - - _gifwrap.GifUtil.quantizeDekker(bitmap, 256); - - var newFrame = new _gifwrap.GifFrame(bitmap); - var gifCodec = new _gifwrap.GifCodec(); - return gifCodec.encodeGif([newFrame], {}).then(function (newGif) { + } + }, + encoders: { + [MIME_TYPE]: data => { + const bitmap = new BitmapImage(data.bitmap); + GifUtil.quantizeDekker(bitmap, 256); + const newFrame = new GifFrame(bitmap); + const gifCodec = new GifCodec(); + return gifCodec.encodeGif([newFrame], {}).then(newGif => { return newGif.buffer; }); - }) - }; -}; - -exports["default"] = _default; + } + } +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/gif/es/index.js.map b/project starter code/node_modules/@jimp/gif/es/index.js.map index fcc6e6d8..7ec6fc5c 100644 --- a/project starter code/node_modules/@jimp/gif/es/index.js.map +++ b/project starter code/node_modules/@jimp/gif/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","mime","constants","MIME_GIF","decoders","data","gifObj","GIF","GifReader","gifData","Buffer","alloc","width","height","decodeAndBlitFrameRGBA","encoders","bitmap","BitmapImage","GifUtil","quantizeDekker","newFrame","GifFrame","gifCodec","GifCodec","encodeGif","then","newGif","buffer"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,WAAlB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKD,SAAL,EAAiB,CAAC,KAAD,CAAjB,CADgB;AAGpBE,IAAAA,SAAS,EAAE;AACTC,MAAAA,QAAQ,EAAEH;AADD,KAHS;AAOpBI,IAAAA,QAAQ,uCACLJ,SADK,EACO,UAAAK,IAAI,EAAI;AACnB,UAAMC,MAAM,GAAG,IAAIC,mBAAIC,SAAR,CAAkBH,IAAlB,CAAf;AACA,UAAMI,OAAO,GAAGC,MAAM,CAACC,KAAP,CAAaL,MAAM,CAACM,KAAP,GAAeN,MAAM,CAACO,MAAtB,GAA+B,CAA5C,CAAhB;AAEAP,MAAAA,MAAM,CAACQ,sBAAP,CAA8B,CAA9B,EAAiCL,OAAjC;AAEA,aAAO;AACLJ,QAAAA,IAAI,EAAEI,OADD;AAELG,QAAAA,KAAK,EAAEN,MAAM,CAACM,KAFT;AAGLC,QAAAA,MAAM,EAAEP,MAAM,CAACO;AAHV,OAAP;AAKD,KAZK,CAPY;AAsBpBE,IAAAA,QAAQ,uCACLf,SADK,EACO,UAAAK,IAAI,EAAI;AACnB,UAAMW,MAAM,GAAG,IAAIC,oBAAJ,CAAgBZ,IAAI,CAACW,MAArB,CAAf;;AACAE,uBAAQC,cAAR,CAAuBH,MAAvB,EAA+B,GAA/B;;AACA,UAAMI,QAAQ,GAAG,IAAIC,iBAAJ,CAAaL,MAAb,CAAjB;AACA,UAAMM,QAAQ,GAAG,IAAIC,iBAAJ,EAAjB;AACA,aAAOD,QAAQ,CAACE,SAAT,CAAmB,CAACJ,QAAD,CAAnB,EAA+B,EAA/B,EAAmCK,IAAnC,CAAwC,UAAAC,MAAM,EAAI;AACvD,eAAOA,MAAM,CAACC,MAAd;AACD,OAFM,CAAP;AAGD,KATK;AAtBY,GAAP;AAAA,C","sourcesContent":["import GIF from 'omggif';\nimport { GifUtil, GifFrame, BitmapImage, GifCodec } from 'gifwrap';\n\nconst MIME_TYPE = 'image/gif';\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['gif'] },\n\n constants: {\n MIME_GIF: MIME_TYPE\n },\n\n decoders: {\n [MIME_TYPE]: data => {\n const gifObj = new GIF.GifReader(data);\n const gifData = Buffer.alloc(gifObj.width * gifObj.height * 4);\n\n gifObj.decodeAndBlitFrameRGBA(0, gifData);\n\n return {\n data: gifData,\n width: gifObj.width,\n height: gifObj.height\n };\n }\n },\n\n encoders: {\n [MIME_TYPE]: data => {\n const bitmap = new BitmapImage(data.bitmap);\n GifUtil.quantizeDekker(bitmap, 256);\n const newFrame = new GifFrame(bitmap);\n const gifCodec = new GifCodec();\n return gifCodec.encodeGif([newFrame], {}).then(newGif => {\n return newGif.buffer;\n });\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["GIF","GifUtil","GifFrame","BitmapImage","GifCodec","MIME_TYPE","mime","constants","MIME_GIF","decoders","data","gifObj","GifReader","gifData","Buffer","alloc","width","height","decodeAndBlitFrameRGBA","encoders","bitmap","quantizeDekker","newFrame","gifCodec","encodeGif","then","newGif","buffer"],"sources":["../src/index.js"],"sourcesContent":["import GIF from \"omggif\";\nimport { GifUtil, GifFrame, BitmapImage, GifCodec } from \"gifwrap\";\n\nconst MIME_TYPE = \"image/gif\";\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"gif\"] },\n\n constants: {\n MIME_GIF: MIME_TYPE,\n },\n\n decoders: {\n [MIME_TYPE]: (data) => {\n const gifObj = new GIF.GifReader(data);\n const gifData = Buffer.alloc(gifObj.width * gifObj.height * 4);\n\n gifObj.decodeAndBlitFrameRGBA(0, gifData);\n\n return {\n data: gifData,\n width: gifObj.width,\n height: gifObj.height,\n };\n },\n },\n\n encoders: {\n [MIME_TYPE]: (data) => {\n const bitmap = new BitmapImage(data.bitmap);\n GifUtil.quantizeDekker(bitmap, 256);\n const newFrame = new GifFrame(bitmap);\n const gifCodec = new GifCodec();\n return gifCodec.encodeGif([newFrame], {}).then((newGif) => {\n return newGif.buffer;\n });\n },\n },\n});\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,QAAQ;AACxB,SAASC,OAAO,EAAEC,QAAQ,EAAEC,WAAW,EAAEC,QAAQ,QAAQ,SAAS;AAElE,MAAMC,SAAS,GAAG,WAAW;AAE7B,gBAAe,OAAO;EACpBC,IAAI,EAAE;IAAE,CAACD,SAAS,GAAG,CAAC,KAAK;EAAE,CAAC;EAE9BE,SAAS,EAAE;IACTC,QAAQ,EAAEH;EACZ,CAAC;EAEDI,QAAQ,EAAE;IACR,CAACJ,SAAS,GAAIK,IAAI,IAAK;MACrB,MAAMC,MAAM,GAAG,IAAIX,GAAG,CAACY,SAAS,CAACF,IAAI,CAAC;MACtC,MAAMG,OAAO,GAAGC,MAAM,CAACC,KAAK,CAACJ,MAAM,CAACK,KAAK,GAAGL,MAAM,CAACM,MAAM,GAAG,CAAC,CAAC;MAE9DN,MAAM,CAACO,sBAAsB,CAAC,CAAC,EAAEL,OAAO,CAAC;MAEzC,OAAO;QACLH,IAAI,EAAEG,OAAO;QACbG,KAAK,EAAEL,MAAM,CAACK,KAAK;QACnBC,MAAM,EAAEN,MAAM,CAACM;MACjB,CAAC;IACH;EACF,CAAC;EAEDE,QAAQ,EAAE;IACR,CAACd,SAAS,GAAIK,IAAI,IAAK;MACrB,MAAMU,MAAM,GAAG,IAAIjB,WAAW,CAACO,IAAI,CAACU,MAAM,CAAC;MAC3CnB,OAAO,CAACoB,cAAc,CAACD,MAAM,EAAE,GAAG,CAAC;MACnC,MAAME,QAAQ,GAAG,IAAIpB,QAAQ,CAACkB,MAAM,CAAC;MACrC,MAAMG,QAAQ,GAAG,IAAInB,QAAQ,EAAE;MAC/B,OAAOmB,QAAQ,CAACC,SAAS,CAAC,CAACF,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAACG,IAAI,CAAEC,MAAM,IAAK;QACzD,OAAOA,MAAM,CAACC,MAAM;MACtB,CAAC,CAAC;IACJ;EACF;AACF,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/gif/index.d.ts b/project starter code/node_modules/@jimp/gif/index.d.ts index 59ac0778..d1b1c679 100644 --- a/project starter code/node_modules/@jimp/gif/index.d.ts +++ b/project starter code/node_modules/@jimp/gif/index.d.ts @@ -1,17 +1,17 @@ -import { DecoderFn } from '@jimp/core'; +import { DecoderFn } from "@jimp/core"; interface Gif { mime: { - 'image/gif': string[] - } + "image/gif": string[]; + }; constants: { - MIME_GIF: 'image/gif'; - } + MIME_GIF: "image/gif"; + }; decoders: { - 'image/gif': DecoderFn - } + "image/gif": DecoderFn; + }; } -export default function(): Gif; +export default function (): Gif; diff --git a/project starter code/node_modules/@jimp/gif/package.json b/project starter code/node_modules/@jimp/gif/package.json index 624b6ac9..4fe0219f 100644 --- a/project starter code/node_modules/@jimp/gif/package.json +++ b/project starter code/node_modules/@jimp/gif/package.json @@ -1,11 +1,15 @@ { "name": "@jimp/gif", - "version": "0.16.2", + "version": "0.22.12", "description": "Default Jimp gif encoder/decoder.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { + "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js", + "test:watch": "npm run test -- --reporter min --watch", + "test:coverage": "nyc npm run test", "build": "npm run build:node:production && npm run build:module", "build:watch": "npm run build:node:debug -- -- --watch --verbose", "build:debug": "npm run build:node:debug", @@ -17,16 +21,19 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "gifwrap": "^0.9.2", + "@jimp/utils": "^0.22.12", + "gifwrap": "^0.10.1", "omggif": "^1.0.9" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" }, + "devDependencies": { + "@jimp/custom": "^0.22.12", + "@jimp/test-utils": "^0.22.12" + }, "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/gif/src/index.js b/project starter code/node_modules/@jimp/gif/src/index.js index 5ef76943..7acf2ff9 100644 --- a/project starter code/node_modules/@jimp/gif/src/index.js +++ b/project starter code/node_modules/@jimp/gif/src/index.js @@ -1,17 +1,17 @@ -import GIF from 'omggif'; -import { GifUtil, GifFrame, BitmapImage, GifCodec } from 'gifwrap'; +import GIF from "omggif"; +import { GifUtil, GifFrame, BitmapImage, GifCodec } from "gifwrap"; -const MIME_TYPE = 'image/gif'; +const MIME_TYPE = "image/gif"; export default () => ({ - mime: { [MIME_TYPE]: ['gif'] }, + mime: { [MIME_TYPE]: ["gif"] }, constants: { - MIME_GIF: MIME_TYPE + MIME_GIF: MIME_TYPE, }, decoders: { - [MIME_TYPE]: data => { + [MIME_TYPE]: (data) => { const gifObj = new GIF.GifReader(data); const gifData = Buffer.alloc(gifObj.width * gifObj.height * 4); @@ -20,20 +20,20 @@ export default () => ({ return { data: gifData, width: gifObj.width, - height: gifObj.height + height: gifObj.height, }; - } + }, }, encoders: { - [MIME_TYPE]: data => { + [MIME_TYPE]: (data) => { const bitmap = new BitmapImage(data.bitmap); GifUtil.quantizeDekker(bitmap, 256); const newFrame = new GifFrame(bitmap); const gifCodec = new GifCodec(); - return gifCodec.encodeGif([newFrame], {}).then(newGif => { + return gifCodec.encodeGif([newFrame], {}).then((newGif) => { return newGif.buffer; }); - } - } + }, + }, }); diff --git a/project starter code/node_modules/@jimp/gif/test/gif.test.js b/project starter code/node_modules/@jimp/gif/test/gif.test.js index 100d7a5d..664fa676 100644 --- a/project starter code/node_modules/@jimp/gif/test/gif.test.js +++ b/project starter code/node_modules/@jimp/gif/test/gif.test.js @@ -1,29 +1,27 @@ -import { Jimp, getTestDir } from '@jimp/test-utils'; -import configure from '@jimp/custom'; +import { Jimp, getTestDir } from "@jimp/test-utils"; +import configure from "@jimp/custom"; +import expect from "@storybook/expect"; -import gif from '../src'; +import gif from "../src"; const jimp = configure({ types: [gif] }, Jimp); -describe('GIF', () => { - const imagesDir = getTestDir(__dirname) + '/images'; +describe("GIF", () => { + const imagesDir = getTestDir(__dirname) + "/images"; - it('load GIF', async () => { - const image = await jimp.read(imagesDir + '/flower.gif'); - image.getPixelColor(10, 10).should.be.equal(0xe5e6d9ff); + it("load GIF", async () => { + const image = await jimp.read(imagesDir + "/flower.gif"); + expect(image.getPixelColor(10, 10)).toBe(0xe5e6d9ff); }); - it('load animated GIF', async () => { - const image = await jimp.read(imagesDir + '/animated.gif'); - image.getPixelColor(10, 10).should.be.equal(0xa1d2f1ff); + it("load animated GIF", async () => { + const image = await jimp.read(imagesDir + "/animated.gif"); + expect(image.getPixelColor(10, 10)).toBe(0xa1d2f1ff); }); - it('export GIF', async () => { - const jgd = await jimp.read(imagesDir + '/flower.gif'); - const buffer = await jgd.getBufferAsync('image/gif'); - buffer - .toString() - .startsWith('GIF') - .should.be.equal(true); + it("export GIF", async () => { + const jgd = await jimp.read(imagesDir + "/flower.gif"); + const buffer = await jgd.getBufferAsync("image/gif"); + expect(buffer.toString()).toMatch(/^GIF/); }); }); diff --git a/project starter code/node_modules/@jimp/jpeg/CHANGELOG.md b/project starter code/node_modules/@jimp/jpeg/CHANGELOG.md index 14710629..e4262f45 100644 --- a/project starter code/node_modules/@jimp/jpeg/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/jpeg/CHANGELOG.md @@ -1,3 +1,85 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.22.0 (Mon Feb 06 2023) + +#### 🏠 Internal + +- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Daniel Holmes ([@danielholmes](https://github.com/danielholmes)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.17.0 (Sat Feb 04 2023) + +### Release Notes + +#### update jpeg-js ([#1131](https://github.com/jimp-dev/jimp/pull/1131)) + +This release changes the minimum node version from 8 to 16 + +--- + +#### 🚀 Enhancement + +- update jpeg-js [#1131](https://github.com/jimp-dev/jimp/pull/1131) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.16.2 (Thu Sep 15 2022) #### 🐛 Bug Fix @@ -61,7 +143,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -69,4 +151,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/jpeg/dist/index.js b/project starter code/node_modules/@jimp/jpeg/dist/index.js index 72f904ca..a4b980c0 100644 --- a/project starter code/node_modules/@jimp/jpeg/dist/index.js +++ b/project starter code/node_modules/@jimp/jpeg/dist/index.js @@ -1,61 +1,51 @@ "use strict"; -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - +exports.default = void 0; var _jpegJs = _interopRequireDefault(require("jpeg-js")); - var _utils = require("@jimp/utils"); - -var MIME_TYPE = 'image/jpeg'; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['jpeg', 'jpg', 'jpe']), - constants: { - MIME_JPEG: MIME_TYPE - }, - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, _jpegJs["default"].decode), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (image) { - return _jpegJs["default"].encode(image.bitmap, image._quality).data; - }), - "class": { - // The quality to be used when saving JPEG images - _quality: 100, - - /** - * Sets the quality of the image when saving as JPEG format (default is 100) - * @param {number} n The quality to use 0-100 - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - quality: function quality(n, cb) { - if (typeof n !== 'number') { - return _utils.throwError.call(this, 'n must be a number', cb); - } - - if (n < 0 || n > 100) { - return _utils.throwError.call(this, 'n must be a number 0 - 100', cb); - } - - this._quality = Math.round(n); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +const MIME_TYPE = "image/jpeg"; +var _default = () => ({ + mime: { + [MIME_TYPE]: ["jpeg", "jpg", "jpe"] + }, + constants: { + MIME_JPEG: MIME_TYPE + }, + decoders: { + [MIME_TYPE]: _jpegJs.default.decode + }, + encoders: { + [MIME_TYPE]: image => _jpegJs.default.encode(image.bitmap, image._quality).data + }, + class: { + // The quality to be used when saving JPEG images + _quality: 100, + /** + * Sets the quality of the image when saving as JPEG format (default is 100) + * @param {number} n The quality to use 0-100 + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + quality(n, cb) { + if (typeof n !== "number") { + return _utils.throwError.call(this, "n must be a number", cb); + } + if (n < 0 || n > 100) { + return _utils.throwError.call(this, "n must be a number 0 - 100", cb); } + this._quality = Math.round(n); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; } - }; -}; - -exports["default"] = _default; + } +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/jpeg/dist/index.js.map b/project starter code/node_modules/@jimp/jpeg/dist/index.js.map index e8af597e..ca1f7d8d 100644 --- a/project starter code/node_modules/@jimp/jpeg/dist/index.js.map +++ b/project starter code/node_modules/@jimp/jpeg/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","mime","constants","MIME_JPEG","decoders","JPEG","decode","encoders","image","encode","bitmap","_quality","data","quality","n","cb","throwError","call","Math","round"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,YAAlB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKD,SAAL,EAAiB,CAAC,MAAD,EAAS,KAAT,EAAgB,KAAhB,CAAjB,CADgB;AAGpBE,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAEH;AADF,KAHS;AAOpBI,IAAAA,QAAQ,uCACLJ,SADK,EACOK,mBAAKC,MADZ,CAPY;AAWpBC,IAAAA,QAAQ,uCACLP,SADK,EACO,UAAAQ,KAAK;AAAA,aAAIH,mBAAKI,MAAL,CAAYD,KAAK,CAACE,MAAlB,EAA0BF,KAAK,CAACG,QAAhC,EAA0CC,IAA9C;AAAA,KADZ,CAXY;AAepB,aAAO;AACL;AACAD,MAAAA,QAAQ,EAAE,GAFL;;AAGL;;;;;;AAMAE,MAAAA,OATK,mBASGC,CATH,EASMC,EATN,EASU;AACb,YAAI,OAAOD,CAAP,KAAa,QAAjB,EAA2B;AACzB,iBAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACD;;AAED,YAAID,CAAC,GAAG,CAAJ,IAASA,CAAC,GAAG,GAAjB,EAAsB;AACpB,iBAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,4BAAtB,EAAoDF,EAApD,CAAP;AACD;;AAED,aAAKJ,QAAL,GAAgBO,IAAI,CAACC,KAAL,CAAWL,CAAX,CAAhB;;AAEA,YAAI,0BAAcC,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAzBI;AAfa,GAAP;AAAA,C","sourcesContent":["import JPEG from 'jpeg-js';\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nconst MIME_TYPE = 'image/jpeg';\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['jpeg', 'jpg', 'jpe'] },\n\n constants: {\n MIME_JPEG: MIME_TYPE\n },\n\n decoders: {\n [MIME_TYPE]: JPEG.decode\n },\n\n encoders: {\n [MIME_TYPE]: image => JPEG.encode(image.bitmap, image._quality).data\n },\n\n class: {\n // The quality to be used when saving JPEG images\n _quality: 100,\n /**\n * Sets the quality of the image when saving as JPEG format (default is 100)\n * @param {number} n The quality to use 0-100\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n quality(n, cb) {\n if (typeof n !== 'number') {\n return throwError.call(this, 'n must be a number', cb);\n }\n\n if (n < 0 || n > 100) {\n return throwError.call(this, 'n must be a number 0 - 100', cb);\n }\n\n this._quality = Math.round(n);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["MIME_TYPE","mime","constants","MIME_JPEG","decoders","JPEG","decode","encoders","image","encode","bitmap","_quality","data","class","quality","n","cb","throwError","call","Math","round","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import JPEG from \"jpeg-js\";\nimport { throwError, isNodePattern } from \"@jimp/utils\";\n\nconst MIME_TYPE = \"image/jpeg\";\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"jpeg\", \"jpg\", \"jpe\"] },\n\n constants: {\n MIME_JPEG: MIME_TYPE,\n },\n\n decoders: {\n [MIME_TYPE]: JPEG.decode,\n },\n\n encoders: {\n [MIME_TYPE]: (image) => JPEG.encode(image.bitmap, image._quality).data,\n },\n\n class: {\n // The quality to be used when saving JPEG images\n _quality: 100,\n /**\n * Sets the quality of the image when saving as JPEG format (default is 100)\n * @param {number} n The quality to use 0-100\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n quality(n, cb) {\n if (typeof n !== \"number\") {\n return throwError.call(this, \"n must be a number\", cb);\n }\n\n if (n < 0 || n > 100) {\n return throwError.call(this, \"n must be a number 0 - 100\", cb);\n }\n\n this._quality = Math.round(n);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n },\n});\n"],"mappings":";;;;;;AAAA;AACA;AAAwD;AAExD,MAAMA,SAAS,GAAG,YAAY;AAAC,eAEhB,OAAO;EACpBC,IAAI,EAAE;IAAE,CAACD,SAAS,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK;EAAE,CAAC;EAE7CE,SAAS,EAAE;IACTC,SAAS,EAAEH;EACb,CAAC;EAEDI,QAAQ,EAAE;IACR,CAACJ,SAAS,GAAGK,eAAI,CAACC;EACpB,CAAC;EAEDC,QAAQ,EAAE;IACR,CAACP,SAAS,GAAIQ,KAAK,IAAKH,eAAI,CAACI,MAAM,CAACD,KAAK,CAACE,MAAM,EAAEF,KAAK,CAACG,QAAQ,CAAC,CAACC;EACpE,CAAC;EAEDC,KAAK,EAAE;IACL;IACAF,QAAQ,EAAE,GAAG;IACb;AACJ;AACA;AACA;AACA;AACA;IACIG,OAAO,CAACC,CAAC,EAAEC,EAAE,EAAE;MACb,IAAI,OAAOD,CAAC,KAAK,QAAQ,EAAE;QACzB,OAAOE,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,oBAAoB,EAAEF,EAAE,CAAC;MACxD;MAEA,IAAID,CAAC,GAAG,CAAC,IAAIA,CAAC,GAAG,GAAG,EAAE;QACpB,OAAOE,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,4BAA4B,EAAEF,EAAE,CAAC;MAChE;MAEA,IAAI,CAACL,QAAQ,GAAGQ,IAAI,CAACC,KAAK,CAACL,CAAC,CAAC;MAE7B,IAAI,IAAAM,oBAAa,EAACL,EAAE,CAAC,EAAE;QACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;MAC3B;MAEA,OAAO,IAAI;IACb;EACF;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/jpeg/es/index.js b/project starter code/node_modules/@jimp/jpeg/es/index.js index cb33e15c..f081884b 100644 --- a/project starter code/node_modules/@jimp/jpeg/es/index.js +++ b/project starter code/node_modules/@jimp/jpeg/es/index.js @@ -1,60 +1,41 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _jpegJs = _interopRequireDefault(require("jpeg-js")); - -var _utils = require("@jimp/utils"); - -var MIME_TYPE = 'image/jpeg'; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['jpeg', 'jpg', 'jpe']), - constants: { - MIME_JPEG: MIME_TYPE - }, - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, _jpegJs["default"].decode), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (image) { - return _jpegJs["default"].encode(image.bitmap, image._quality).data; - }), - "class": { - // The quality to be used when saving JPEG images - _quality: 100, - - /** - * Sets the quality of the image when saving as JPEG format (default is 100) - * @param {number} n The quality to use 0-100 - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - quality: function quality(n, cb) { - if (typeof n !== 'number') { - return _utils.throwError.call(this, 'n must be a number', cb); - } - - if (n < 0 || n > 100) { - return _utils.throwError.call(this, 'n must be a number 0 - 100', cb); - } - - this._quality = Math.round(n); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; +import JPEG from "jpeg-js"; +import { throwError, isNodePattern } from "@jimp/utils"; +const MIME_TYPE = "image/jpeg"; +export default (() => ({ + mime: { + [MIME_TYPE]: ["jpeg", "jpg", "jpe"] + }, + constants: { + MIME_JPEG: MIME_TYPE + }, + decoders: { + [MIME_TYPE]: JPEG.decode + }, + encoders: { + [MIME_TYPE]: image => JPEG.encode(image.bitmap, image._quality).data + }, + class: { + // The quality to be used when saving JPEG images + _quality: 100, + /** + * Sets the quality of the image when saving as JPEG format (default is 100) + * @param {number} n The quality to use 0-100 + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + quality(n, cb) { + if (typeof n !== "number") { + return throwError.call(this, "n must be a number", cb); } + if (n < 0 || n > 100) { + return throwError.call(this, "n must be a number 0 - 100", cb); + } + this._quality = Math.round(n); + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; } - }; -}; - -exports["default"] = _default; + } +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/jpeg/es/index.js.map b/project starter code/node_modules/@jimp/jpeg/es/index.js.map index e8af597e..f621d691 100644 --- a/project starter code/node_modules/@jimp/jpeg/es/index.js.map +++ b/project starter code/node_modules/@jimp/jpeg/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","mime","constants","MIME_JPEG","decoders","JPEG","decode","encoders","image","encode","bitmap","_quality","data","quality","n","cb","throwError","call","Math","round"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,YAAlB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKD,SAAL,EAAiB,CAAC,MAAD,EAAS,KAAT,EAAgB,KAAhB,CAAjB,CADgB;AAGpBE,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAEH;AADF,KAHS;AAOpBI,IAAAA,QAAQ,uCACLJ,SADK,EACOK,mBAAKC,MADZ,CAPY;AAWpBC,IAAAA,QAAQ,uCACLP,SADK,EACO,UAAAQ,KAAK;AAAA,aAAIH,mBAAKI,MAAL,CAAYD,KAAK,CAACE,MAAlB,EAA0BF,KAAK,CAACG,QAAhC,EAA0CC,IAA9C;AAAA,KADZ,CAXY;AAepB,aAAO;AACL;AACAD,MAAAA,QAAQ,EAAE,GAFL;;AAGL;;;;;;AAMAE,MAAAA,OATK,mBASGC,CATH,EASMC,EATN,EASU;AACb,YAAI,OAAOD,CAAP,KAAa,QAAjB,EAA2B;AACzB,iBAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACD;;AAED,YAAID,CAAC,GAAG,CAAJ,IAASA,CAAC,GAAG,GAAjB,EAAsB;AACpB,iBAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,4BAAtB,EAAoDF,EAApD,CAAP;AACD;;AAED,aAAKJ,QAAL,GAAgBO,IAAI,CAACC,KAAL,CAAWL,CAAX,CAAhB;;AAEA,YAAI,0BAAcC,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAzBI;AAfa,GAAP;AAAA,C","sourcesContent":["import JPEG from 'jpeg-js';\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nconst MIME_TYPE = 'image/jpeg';\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['jpeg', 'jpg', 'jpe'] },\n\n constants: {\n MIME_JPEG: MIME_TYPE\n },\n\n decoders: {\n [MIME_TYPE]: JPEG.decode\n },\n\n encoders: {\n [MIME_TYPE]: image => JPEG.encode(image.bitmap, image._quality).data\n },\n\n class: {\n // The quality to be used when saving JPEG images\n _quality: 100,\n /**\n * Sets the quality of the image when saving as JPEG format (default is 100)\n * @param {number} n The quality to use 0-100\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n quality(n, cb) {\n if (typeof n !== 'number') {\n return throwError.call(this, 'n must be a number', cb);\n }\n\n if (n < 0 || n > 100) {\n return throwError.call(this, 'n must be a number 0 - 100', cb);\n }\n\n this._quality = Math.round(n);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["JPEG","throwError","isNodePattern","MIME_TYPE","mime","constants","MIME_JPEG","decoders","decode","encoders","image","encode","bitmap","_quality","data","class","quality","n","cb","call","Math","round"],"sources":["../src/index.js"],"sourcesContent":["import JPEG from \"jpeg-js\";\nimport { throwError, isNodePattern } from \"@jimp/utils\";\n\nconst MIME_TYPE = \"image/jpeg\";\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"jpeg\", \"jpg\", \"jpe\"] },\n\n constants: {\n MIME_JPEG: MIME_TYPE,\n },\n\n decoders: {\n [MIME_TYPE]: JPEG.decode,\n },\n\n encoders: {\n [MIME_TYPE]: (image) => JPEG.encode(image.bitmap, image._quality).data,\n },\n\n class: {\n // The quality to be used when saving JPEG images\n _quality: 100,\n /**\n * Sets the quality of the image when saving as JPEG format (default is 100)\n * @param {number} n The quality to use 0-100\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n quality(n, cb) {\n if (typeof n !== \"number\") {\n return throwError.call(this, \"n must be a number\", cb);\n }\n\n if (n < 0 || n > 100) {\n return throwError.call(this, \"n must be a number 0 - 100\", cb);\n }\n\n this._quality = Math.round(n);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n },\n});\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,SAAS;AAC1B,SAASC,UAAU,EAAEC,aAAa,QAAQ,aAAa;AAEvD,MAAMC,SAAS,GAAG,YAAY;AAE9B,gBAAe,OAAO;EACpBC,IAAI,EAAE;IAAE,CAACD,SAAS,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK;EAAE,CAAC;EAE7CE,SAAS,EAAE;IACTC,SAAS,EAAEH;EACb,CAAC;EAEDI,QAAQ,EAAE;IACR,CAACJ,SAAS,GAAGH,IAAI,CAACQ;EACpB,CAAC;EAEDC,QAAQ,EAAE;IACR,CAACN,SAAS,GAAIO,KAAK,IAAKV,IAAI,CAACW,MAAM,CAACD,KAAK,CAACE,MAAM,EAAEF,KAAK,CAACG,QAAQ,CAAC,CAACC;EACpE,CAAC;EAEDC,KAAK,EAAE;IACL;IACAF,QAAQ,EAAE,GAAG;IACb;AACJ;AACA;AACA;AACA;AACA;IACIG,OAAO,CAACC,CAAC,EAAEC,EAAE,EAAE;MACb,IAAI,OAAOD,CAAC,KAAK,QAAQ,EAAE;QACzB,OAAOhB,UAAU,CAACkB,IAAI,CAAC,IAAI,EAAE,oBAAoB,EAAED,EAAE,CAAC;MACxD;MAEA,IAAID,CAAC,GAAG,CAAC,IAAIA,CAAC,GAAG,GAAG,EAAE;QACpB,OAAOhB,UAAU,CAACkB,IAAI,CAAC,IAAI,EAAE,4BAA4B,EAAED,EAAE,CAAC;MAChE;MAEA,IAAI,CAACL,QAAQ,GAAGO,IAAI,CAACC,KAAK,CAACJ,CAAC,CAAC;MAE7B,IAAIf,aAAa,CAACgB,EAAE,CAAC,EAAE;QACrBA,EAAE,CAACC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;MAC3B;MAEA,OAAO,IAAI;IACb;EACF;AACF,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/jpeg/index.d.ts b/project starter code/node_modules/@jimp/jpeg/index.d.ts index 3423874d..94b86ba2 100644 --- a/project starter code/node_modules/@jimp/jpeg/index.d.ts +++ b/project starter code/node_modules/@jimp/jpeg/index.d.ts @@ -1,4 +1,4 @@ -import { DecoderFn, EncoderFn, ImageCallback } from '@jimp/core'; +import { DecoderFn, EncoderFn, ImageCallback } from "@jimp/core"; interface JpegClass { _quality: number; @@ -6,21 +6,21 @@ interface JpegClass { } interface Jpeg { - mime: { 'image/jpeg': string[] }, + mime: { "image/jpeg": string[] }; constants: { - MIME_JPEG: 'image/jpeg'; - } + MIME_JPEG: "image/jpeg"; + }; encoders: { - 'image/jpeg': EncoderFn - } + "image/jpeg": EncoderFn; + }; decoders: { - 'image/jpeg': DecoderFn - } + "image/jpeg": DecoderFn; + }; - class: JpegClass + class: JpegClass; } -export default function(): Jpeg; +export default function (): Jpeg; diff --git a/project starter code/node_modules/@jimp/jpeg/package.json b/project starter code/node_modules/@jimp/jpeg/package.json index 199b613a..f02b8b56 100644 --- a/project starter code/node_modules/@jimp/jpeg/package.json +++ b/project starter code/node_modules/@jimp/jpeg/package.json @@ -1,12 +1,13 @@ { "name": "@jimp/jpeg", - "version": "0.16.2", + "version": "0.22.12", "description": "Default Jimp jpeg encoder/decoder.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js", "test:watch": "npm run test -- --reporter min --watch", "test:coverage": "nyc npm run test", "build": "npm run build:node:production && npm run build:module", @@ -20,19 +21,18 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "jpeg-js": "^0.4.2" + "@jimp/utils": "^0.22.12", + "jpeg-js": "^0.4.4" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" }, "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/test-utils": "^0.16.2" + "@jimp/custom": "^0.22.12", + "@jimp/test-utils": "^0.22.12" }, "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/jpeg/src/index.js b/project starter code/node_modules/@jimp/jpeg/src/index.js index a746a78b..489c8220 100644 --- a/project starter code/node_modules/@jimp/jpeg/src/index.js +++ b/project starter code/node_modules/@jimp/jpeg/src/index.js @@ -1,21 +1,21 @@ -import JPEG from 'jpeg-js'; -import { throwError, isNodePattern } from '@jimp/utils'; +import JPEG from "jpeg-js"; +import { throwError, isNodePattern } from "@jimp/utils"; -const MIME_TYPE = 'image/jpeg'; +const MIME_TYPE = "image/jpeg"; export default () => ({ - mime: { [MIME_TYPE]: ['jpeg', 'jpg', 'jpe'] }, + mime: { [MIME_TYPE]: ["jpeg", "jpg", "jpe"] }, constants: { - MIME_JPEG: MIME_TYPE + MIME_JPEG: MIME_TYPE, }, decoders: { - [MIME_TYPE]: JPEG.decode + [MIME_TYPE]: JPEG.decode, }, encoders: { - [MIME_TYPE]: image => JPEG.encode(image.bitmap, image._quality).data + [MIME_TYPE]: (image) => JPEG.encode(image.bitmap, image._quality).data, }, class: { @@ -28,12 +28,12 @@ export default () => ({ * @returns {Jimp} this for chaining of methods */ quality(n, cb) { - if (typeof n !== 'number') { - return throwError.call(this, 'n must be a number', cb); + if (typeof n !== "number") { + return throwError.call(this, "n must be a number", cb); } if (n < 0 || n > 100) { - return throwError.call(this, 'n must be a number 0 - 100', cb); + return throwError.call(this, "n must be a number 0 - 100", cb); } this._quality = Math.round(n); @@ -43,6 +43,6 @@ export default () => ({ } return this; - } - } + }, + }, }); diff --git a/project starter code/node_modules/@jimp/jpeg/test/jpeg.test.js b/project starter code/node_modules/@jimp/jpeg/test/jpeg.test.js index 480e8a1d..5abf22d8 100644 --- a/project starter code/node_modules/@jimp/jpeg/test/jpeg.test.js +++ b/project starter code/node_modules/@jimp/jpeg/test/jpeg.test.js @@ -1,48 +1,42 @@ -import { Jimp, getTestDir } from '@jimp/test-utils'; -import configure from '@jimp/custom'; +import { Jimp, getTestDir } from "@jimp/test-utils"; +import configure from "@jimp/custom"; +import expect from "@storybook/expect"; -import jpeg from '../src'; +import jpeg from "../src"; const jimp = configure({ types: [jpeg] }, Jimp); -describe('JPEG', () => { - const imagesDir = getTestDir(__dirname) + '/images'; +describe("JPEG", () => { + const imagesDir = getTestDir(__dirname) + "/images"; - it('load JPG', async () => { - const image = await jimp.read(imagesDir + '/cops.jpg'); + it("load JPG", async () => { + const image = await jimp.read(imagesDir + "/cops.jpg"); - image.getPixelColor(10, 10).should.be.equal(0x3f4a02ff); - image.getPixelColor(220, 190).should.be.equal(0x5d94b6ff); - image.getPixelColor(350, 130).should.be.equal(0xdf7944ff); + expect(image.getPixelColor(10, 10)).toBe(0x3f4a02ff); + expect(image.getPixelColor(220, 190)).toBe(0x5d94b6ff); + expect(image.getPixelColor(350, 130)).toBe(0xdf7944ff); }); - it('load JPG with fill bytes', async () => { - const image = await jimp.read(imagesDir + '/fillbytes.jpg'); + it("load JPG with fill bytes", async () => { + const image = await jimp.read(imagesDir + "/fillbytes.jpg"); - image.getPixelColor(10, 10).should.be.equal(0xaeb8c3ff); - image.getPixelColor(220, 190).should.be.equal(0x262b21ff); - image.getPixelColor(350, 130).should.be.equal(0x4e5d30ff); + expect(image.getPixelColor(10, 10)).toBe(0xaeb8c3ff); + expect(image.getPixelColor(220, 190)).toBe(0x262b21ff); + expect(image.getPixelColor(350, 130)).toBe(0x4e5d30ff); }); - it('export JPG', async () => { + it("export JPG", async () => { const image = await jimp.read({ width: 3, height: 3, data: [ - 0xff0000ff, - 0xff0080ff, - 0xff00ffff, - 0xff0080ff, - 0xff00ffff, - 0x8000ffff, - 0xff00ffff, - 0x8000ffff, - 0x0000ffff - ] + 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff, + 0xff00ffff, 0x8000ffff, 0x0000ffff, + ], }); image.quality(50); - const buffer = await image.getBufferAsync('image/jpeg'); + const buffer = await image.getBufferAsync("image/jpeg"); - buffer.toString().should.match(/^.{3,9}JFIF\u0000/); + expect(buffer.toString()).toMatch(/^.{3,9}JFIF\u0000/); }); }); diff --git a/project starter code/node_modules/@jimp/plugin-blit/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-blit/CHANGELOG.md index 26394e0f..e2a54ff2 100644 --- a/project starter code/node_modules/@jimp/plugin-blit/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/plugin-blit/CHANGELOG.md @@ -1,3 +1,66 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.22.0 (Mon Feb 06 2023) + +#### 🏠 Internal + +- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Daniel Holmes ([@danielholmes](https://github.com/danielholmes)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- update linting ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -12,7 +75,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -20,4 +83,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-blit/README.md b/project starter code/node_modules/@jimp/plugin-blit/README.md index e7e7ee49..7ceb4815 100644 --- a/project starter code/node_modules/@jimp/plugin-blit/README.md +++ b/project starter code/node_modules/@jimp/plugin-blit/README.md @@ -21,11 +21,11 @@ Blits a source image on to this image - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); - const parrot = await jimp.read('test/party-parrot.png'); + const image = await jimp.read("test/image.png"); + const parrot = await jimp.read("test/party-parrot.png"); image.blit(parrot, x, y); } diff --git a/project starter code/node_modules/@jimp/plugin-blit/dist/index.js b/project starter code/node_modules/@jimp/plugin-blit/dist/index.js index 55717769..4eb1b67d 100644 --- a/project starter code/node_modules/@jimp/plugin-blit/dist/index.js +++ b/project starter code/node_modules/@jimp/plugin-blit/dist/index.js @@ -1,99 +1,87 @@ "use strict"; -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - +exports.default = void 0; var _utils = require("@jimp/utils"); +var _default = () => ({ + /** + * Blits a source image on to this image + * @param {Jimp} src the source Jimp instance + * @param {number} x the x position to blit the image + * @param {number} y the y position to blit the image + * @param {number} srcx (optional) the x position from which to crop the source image + * @param {number} srcy (optional) the y position from which to crop the source image + * @param {number} srcw (optional) the width to which to crop the source image + * @param {number} srch (optional) the height to which to crop the source image + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + blit(src, x, y, srcx, srcy, srcw, srch, cb) { + if (!(src instanceof this.constructor)) { + return _utils.throwError.call(this, "The source must be a Jimp image", cb); + } + if (typeof x !== "number" || typeof y !== "number") { + return _utils.throwError.call(this, "x and y must be numbers", cb); + } + if (typeof srcx === "function") { + cb = srcx; + srcx = 0; + srcy = 0; + srcw = src.bitmap.width; + srch = src.bitmap.height; + } else if (typeof srcx === typeof srcy && typeof srcy === typeof srcw && typeof srcw === typeof srch) { + srcx = srcx || 0; + srcy = srcy || 0; + srcw = srcw || src.bitmap.width; + srch = srch || src.bitmap.height; + } else { + return _utils.throwError.call(this, "srcx, srcy, srcw, srch must be numbers", cb); + } -var _default = function _default() { - return { - /** - * Blits a source image on to this image - * @param {Jimp} src the source Jimp instance - * @param {number} x the x position to blit the image - * @param {number} y the y position to blit the image - * @param {number} srcx (optional) the x position from which to crop the source image - * @param {number} srcy (optional) the y position from which to crop the source image - * @param {number} srcw (optional) the width to which to crop the source image - * @param {number} srch (optional) the height to which to crop the source image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - blit: function blit(src, x, y, srcx, srcy, srcw, srch, cb) { - if (!(src instanceof this.constructor)) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } - - if (typeof srcx === 'function') { - cb = srcx; - srcx = 0; - srcy = 0; - srcw = src.bitmap.width; - srch = src.bitmap.height; - } else if ((0, _typeof2["default"])(srcx) === (0, _typeof2["default"])(srcy) && (0, _typeof2["default"])(srcy) === (0, _typeof2["default"])(srcw) && (0, _typeof2["default"])(srcw) === (0, _typeof2["default"])(srch)) { - srcx = srcx || 0; - srcy = srcy || 0; - srcw = srcw || src.bitmap.width; - srch = srch || src.bitmap.height; - } else { - return _utils.throwError.call(this, 'srcx, srcy, srcw, srch must be numbers', cb); - } // round input - - - x = Math.round(x); - y = Math.round(y); // round input - - srcx = Math.round(srcx); - srcy = Math.round(srcy); - srcw = Math.round(srcw); - srch = Math.round(srch); - var maxWidth = this.bitmap.width; - var maxHeight = this.bitmap.height; - var baseImage = this; - src.scanQuiet(srcx, srcy, srcw, srch, function (sx, sy, idx) { - var xOffset = x + sx - srcx; - var yOffset = y + sy - srcy; - - if (xOffset >= 0 && yOffset >= 0 && maxWidth - xOffset > 0 && maxHeight - yOffset > 0) { - var dstIdx = baseImage.getPixelIndex(xOffset, yOffset); - var _src = { - r: this.bitmap.data[idx], - g: this.bitmap.data[idx + 1], - b: this.bitmap.data[idx + 2], - a: this.bitmap.data[idx + 3] - }; - var dst = { - r: baseImage.bitmap.data[dstIdx], - g: baseImage.bitmap.data[dstIdx + 1], - b: baseImage.bitmap.data[dstIdx + 2], - a: baseImage.bitmap.data[dstIdx + 3] - }; - baseImage.bitmap.data[dstIdx] = (_src.a * (_src.r - dst.r) - dst.r + 255 >> 8) + dst.r; - baseImage.bitmap.data[dstIdx + 1] = (_src.a * (_src.g - dst.g) - dst.g + 255 >> 8) + dst.g; - baseImage.bitmap.data[dstIdx + 2] = (_src.a * (_src.b - dst.b) - dst.b + 255 >> 8) + dst.b; - baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(dst.a + _src.a); - } - }); + // round input + x = Math.round(x); + y = Math.round(y); - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); + // round input + srcx = Math.round(srcx); + srcy = Math.round(srcy); + srcw = Math.round(srcw); + srch = Math.round(srch); + const maxWidth = this.bitmap.width; + const maxHeight = this.bitmap.height; + const baseImage = this; + src.scanQuiet(srcx, srcy, srcw, srch, function (sx, sy, idx) { + const xOffset = x + sx - srcx; + const yOffset = y + sy - srcy; + if (xOffset >= 0 && yOffset >= 0 && maxWidth - xOffset > 0 && maxHeight - yOffset > 0) { + const dstIdx = baseImage.getPixelIndex(xOffset, yOffset); + const src = { + r: this.bitmap.data[idx], + g: this.bitmap.data[idx + 1], + b: this.bitmap.data[idx + 2], + a: this.bitmap.data[idx + 3] + }; + const dst = { + r: baseImage.bitmap.data[dstIdx], + g: baseImage.bitmap.data[dstIdx + 1], + b: baseImage.bitmap.data[dstIdx + 2], + a: baseImage.bitmap.data[dstIdx + 3] + }; + baseImage.bitmap.data[dstIdx] = (src.a * (src.r - dst.r) - dst.r + 255 >> 8) + dst.r; + baseImage.bitmap.data[dstIdx + 1] = (src.a * (src.g - dst.g) - dst.g + 255 >> 8) + dst.g; + baseImage.bitmap.data[dstIdx + 2] = (src.a * (src.b - dst.b) - dst.b + 255 >> 8) + dst.b; + baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(dst.a + src.a); } - - return this; + }); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); } - }; -}; - -exports["default"] = _default; + return this; + } +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blit/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-blit/dist/index.js.map index 0c3d69b7..ebfe5554 100644 --- a/project starter code/node_modules/@jimp/plugin-blit/dist/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-blit/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["blit","src","x","y","srcx","srcy","srcw","srch","cb","constructor","throwError","call","bitmap","width","height","Math","round","maxWidth","maxHeight","baseImage","scanQuiet","sx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,MAAM,GAAG,CAA/B,IACE,CAAEzB,IAAG,CAAC+B,CAAJ,IAAS/B,IAAG,CAAC8B,CAAJ,GAAQE,GAAG,CAACF,CAArB,IAA0BE,GAAG,CAACF,CAA9B,GAAkC,GAAnC,IAA2C,CAA5C,IAAiDE,GAAG,CAACF,CADvD;AAEAZ,UAAAA,SAAS,CAACP,MAAV,CAAiBiB,IAAjB,CAAsBH,MAAM,GAAG,CAA/B,IAAoC,KAAKjB,WAAL,CAAiByB,QAAjB,CAClCD,GAAG,CAACD,CAAJ,GAAQ/B,IAAG,CAAC+B,CADsB,CAApC;AAGD;AACF,OAnCD;;AAqCA,UAAI,0BAAcxB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACG,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AArGmB,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from '@jimp/utils';\n\nexport default () => ({\n /**\n * Blits a source image on to this image\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {number} srcx (optional) the x position from which to crop the source image\n * @param {number} srcy (optional) the y position from which to crop the source image\n * @param {number} srcw (optional) the width to which to crop the source image\n * @param {number} srch (optional) the height to which to crop the source image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blit(src, x, y, srcx, srcy, srcw, srch, cb) {\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n if (typeof srcx === 'function') {\n cb = srcx;\n srcx = 0;\n srcy = 0;\n srcw = src.bitmap.width;\n srch = src.bitmap.height;\n } else if (\n typeof srcx === typeof srcy &&\n typeof srcy === typeof srcw &&\n typeof srcw === typeof srch\n ) {\n srcx = srcx || 0;\n srcy = srcy || 0;\n srcw = srcw || src.bitmap.width;\n srch = srch || src.bitmap.height;\n } else {\n return throwError.call(\n this,\n 'srcx, srcy, srcw, srch must be numbers',\n cb\n );\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n // round input\n srcx = Math.round(srcx);\n srcy = Math.round(srcy);\n srcw = Math.round(srcw);\n srch = Math.round(srch);\n\n const maxWidth = this.bitmap.width;\n const maxHeight = this.bitmap.height;\n const baseImage = this;\n\n src.scanQuiet(srcx, srcy, srcw, srch, function(sx, sy, idx) {\n const xOffset = x + sx - srcx;\n const yOffset = y + sy - srcy;\n\n if (\n xOffset >= 0 &&\n yOffset >= 0 &&\n maxWidth - xOffset > 0 &&\n maxHeight - yOffset > 0\n ) {\n const dstIdx = baseImage.getPixelIndex(xOffset, yOffset);\n const src = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2],\n a: this.bitmap.data[idx + 3]\n };\n\n const dst = {\n r: baseImage.bitmap.data[dstIdx],\n g: baseImage.bitmap.data[dstIdx + 1],\n b: baseImage.bitmap.data[dstIdx + 2],\n a: baseImage.bitmap.data[dstIdx + 3]\n };\n\n baseImage.bitmap.data[dstIdx] =\n ((src.a * (src.r - dst.r) - dst.r + 255) >> 8) + dst.r;\n baseImage.bitmap.data[dstIdx + 1] =\n ((src.a * (src.g - dst.g) - dst.g + 255) >> 8) + dst.g;\n baseImage.bitmap.data[dstIdx + 2] =\n ((src.a * (src.b - dst.b) - dst.b + 255) >> 8) + dst.b;\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(\n dst.a + src.a\n );\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["blit","src","x","y","srcx","srcy","srcw","srch","cb","constructor","throwError","call","bitmap","width","height","Math","round","maxWidth","maxHeight","baseImage","scanQuiet","sx","sy","idx","xOffset","yOffset","dstIdx","getPixelIndex","r","data","g","b","a","dst","limit255","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import { throwError, isNodePattern } from \"@jimp/utils\";\n\nexport default () => ({\n /**\n * Blits a source image on to this image\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {number} srcx (optional) the x position from which to crop the source image\n * @param {number} srcy (optional) the y position from which to crop the source image\n * @param {number} srcw (optional) the width to which to crop the source image\n * @param {number} srch (optional) the height to which to crop the source image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blit(src, x, y, srcx, srcy, srcw, srch, cb) {\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n if (typeof srcx === \"function\") {\n cb = srcx;\n srcx = 0;\n srcy = 0;\n srcw = src.bitmap.width;\n srch = src.bitmap.height;\n } else if (\n typeof srcx === typeof srcy &&\n typeof srcy === typeof srcw &&\n typeof srcw === typeof srch\n ) {\n srcx = srcx || 0;\n srcy = srcy || 0;\n srcw = srcw || src.bitmap.width;\n srch = srch || src.bitmap.height;\n } else {\n return throwError.call(\n this,\n \"srcx, srcy, srcw, srch must be numbers\",\n cb\n );\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n // round input\n srcx = Math.round(srcx);\n srcy = Math.round(srcy);\n srcw = Math.round(srcw);\n srch = Math.round(srch);\n\n const maxWidth = this.bitmap.width;\n const maxHeight = this.bitmap.height;\n const baseImage = this;\n\n src.scanQuiet(srcx, srcy, srcw, srch, function (sx, sy, idx) {\n const xOffset = x + sx - srcx;\n const yOffset = y + sy - srcy;\n\n if (\n xOffset >= 0 &&\n yOffset >= 0 &&\n maxWidth - xOffset > 0 &&\n maxHeight - yOffset > 0\n ) {\n const dstIdx = baseImage.getPixelIndex(xOffset, yOffset);\n const src = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2],\n a: this.bitmap.data[idx + 3],\n };\n\n const dst = {\n r: baseImage.bitmap.data[dstIdx],\n g: baseImage.bitmap.data[dstIdx + 1],\n b: baseImage.bitmap.data[dstIdx + 2],\n a: baseImage.bitmap.data[dstIdx + 3],\n };\n\n baseImage.bitmap.data[dstIdx] =\n ((src.a * (src.r - dst.r) - dst.r + 255) >> 8) + dst.r;\n baseImage.bitmap.data[dstIdx + 1] =\n ((src.a * (src.g - dst.g) - dst.g + 255) >> 8) + dst.g;\n baseImage.bitmap.data[dstIdx + 2] =\n ((src.a * (src.b - dst.b) - dst.b + 255) >> 8) + dst.b;\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(\n dst.a + src.a\n );\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAAwD,eAEzC,OAAO;EACpB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEA,IAAI,CAACC,GAAG,EAAEC,CAAC,EAAEC,CAAC,EAAEC,IAAI,EAAEC,IAAI,EAAEC,IAAI,EAAEC,IAAI,EAAEC,EAAE,EAAE;IAC1C,IAAI,EAAEP,GAAG,YAAY,IAAI,CAACQ,WAAW,CAAC,EAAE;MACtC,OAAOC,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,iCAAiC,EAAEH,EAAE,CAAC;IACrE;IAEA,IAAI,OAAON,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAAE;MAClD,OAAOO,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAEH,EAAE,CAAC;IAC7D;IAEA,IAAI,OAAOJ,IAAI,KAAK,UAAU,EAAE;MAC9BI,EAAE,GAAGJ,IAAI;MACTA,IAAI,GAAG,CAAC;MACRC,IAAI,GAAG,CAAC;MACRC,IAA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CAACiB,IAAI,CAACH,MAAM,GAAG,CAAC,CAAC,GAC/B,CAAEzB,GAAG,CAAC+B,CAAC,IAAI/B,GAAG,CAAC6B,CAAC,GAAGG,GAAG,CAACH,CAAC,CAAC,GAAGG,GAAG,CAACH,CAAC,GAAG,GAAG,IAAK,CAAC,IAAIG,GAAG,CAACH,CAAC;QACxDX,SAAS,CAACP,MAAM,CAACiB,IAAI,CAACH,MAAM,GAAG,CAAC,CAAC,GAC/B,CAAEzB,GAAG,CAAC+B,CAAC,IAAI/B,GAAG,CAAC8B,CAAC,GAAGE,GAAG,CAACF,CAAC,CAAC,GAAGE,GAAG,CAACF,CAAC,GAAG,GAAG,IAAK,CAAC,IAAIE,GAAG,CAACF,CAAC;QACxDZ,SAAS,CAACP,MAAM,CAACiB,IAAI,CAACH,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAACjB,WAAW,CAACyB,QAAQ,CAC3DD,GAAG,CAACD,CAAC,GAAG/B,GAAG,CAAC+B,CAAC,CACd;MACH;IACF,CAAC,CAAC;IAEF,IAAI,IAAAG,oBAAa,EAAC3B,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACG,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blit/es/index.js b/project starter code/node_modules/@jimp/plugin-blit/es/index.js index 0a6f8acf..a6b8134b 100644 --- a/project starter code/node_modules/@jimp/plugin-blit/es/index.js +++ b/project starter code/node_modules/@jimp/plugin-blit/es/index.js @@ -1,98 +1,78 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _utils = require("@jimp/utils"); - -var _default = function _default() { - return { - /** - * Blits a source image on to this image - * @param {Jimp} src the source Jimp instance - * @param {number} x the x position to blit the image - * @param {number} y the y position to blit the image - * @param {number} srcx (optional) the x position from which to crop the source image - * @param {number} srcy (optional) the y position from which to crop the source image - * @param {number} srcw (optional) the width to which to crop the source image - * @param {number} srch (optional) the height to which to crop the source image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - blit: function blit(src, x, y, srcx, srcy, srcw, srch, cb) { - if (!(src instanceof this.constructor)) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } - - if (typeof srcx === 'function') { - cb = srcx; - srcx = 0; - srcy = 0; - srcw = src.bitmap.width; - srch = src.bitmap.height; - } else if ((0, _typeof2["default"])(srcx) === (0, _typeof2["default"])(srcy) && (0, _typeof2["default"])(srcy) === (0, _typeof2["default"])(srcw) && (0, _typeof2["default"])(srcw) === (0, _typeof2["default"])(srch)) { - srcx = srcx || 0; - srcy = srcy || 0; - srcw = srcw || src.bitmap.width; - srch = srch || src.bitmap.height; - } else { - return _utils.throwError.call(this, 'srcx, srcy, srcw, srch must be numbers', cb); - } // round input - - - x = Math.round(x); - y = Math.round(y); // round input - - srcx = Math.round(srcx); - srcy = Math.round(srcy); - srcw = Math.round(srcw); - srch = Math.round(srch); - var maxWidth = this.bitmap.width; - var maxHeight = this.bitmap.height; - var baseImage = this; - src.scanQuiet(srcx, srcy, srcw, srch, function (sx, sy, idx) { - var xOffset = x + sx - srcx; - var yOffset = y + sy - srcy; +import { throwError, isNodePattern } from "@jimp/utils"; +export default (() => ({ + /** + * Blits a source image on to this image + * @param {Jimp} src the source Jimp instance + * @param {number} x the x position to blit the image + * @param {number} y the y position to blit the image + * @param {number} srcx (optional) the x position from which to crop the source image + * @param {number} srcy (optional) the y position from which to crop the source image + * @param {number} srcw (optional) the width to which to crop the source image + * @param {number} srch (optional) the height to which to crop the source image + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + blit(src, x, y, srcx, srcy, srcw, srch, cb) { + if (!(src instanceof this.constructor)) { + return throwError.call(this, "The source must be a Jimp image", cb); + } + if (typeof x !== "number" || typeof y !== "number") { + return throwError.call(this, "x and y must be numbers", cb); + } + if (typeof srcx === "function") { + cb = srcx; + srcx = 0; + srcy = 0; + srcw = src.bitmap.width; + srch = src.bitmap.height; + } else if (typeof srcx === typeof srcy && typeof srcy === typeof srcw && typeof srcw === typeof srch) { + srcx = srcx || 0; + srcy = srcy || 0; + srcw = srcw || src.bitmap.width; + srch = srch || src.bitmap.height; + } else { + return throwError.call(this, "srcx, srcy, srcw, srch must be numbers", cb); + } - if (xOffset >= 0 && yOffset >= 0 && maxWidth - xOffset > 0 && maxHeight - yOffset > 0) { - var dstIdx = baseImage.getPixelIndex(xOffset, yOffset); - var _src = { - r: this.bitmap.data[idx], - g: this.bitmap.data[idx + 1], - b: this.bitmap.data[idx + 2], - a: this.bitmap.data[idx + 3] - }; - var dst = { - r: baseImage.bitmap.data[dstIdx], - g: baseImage.bitmap.data[dstIdx + 1], - b: baseImage.bitmap.data[dstIdx + 2], - a: baseImage.bitmap.data[dstIdx + 3] - }; - baseImage.bitmap.data[dstIdx] = (_src.a * (_src.r - dst.r) - dst.r + 255 >> 8) + dst.r; - baseImage.bitmap.data[dstIdx + 1] = (_src.a * (_src.g - dst.g) - dst.g + 255 >> 8) + dst.g; - baseImage.bitmap.data[dstIdx + 2] = (_src.a * (_src.b - dst.b) - dst.b + 255 >> 8) + dst.b; - baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(dst.a + _src.a); - } - }); + // round input + x = Math.round(x); + y = Math.round(y); - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); + // round input + srcx = Math.round(srcx); + srcy = Math.round(srcy); + srcw = Math.round(srcw); + srch = Math.round(srch); + const maxWidth = this.bitmap.width; + const maxHeight = this.bitmap.height; + const baseImage = this; + src.scanQuiet(srcx, srcy, srcw, srch, function (sx, sy, idx) { + const xOffset = x + sx - srcx; + const yOffset = y + sy - srcy; + if (xOffset >= 0 && yOffset >= 0 && maxWidth - xOffset > 0 && maxHeight - yOffset > 0) { + const dstIdx = baseImage.getPixelIndex(xOffset, yOffset); + const src = { + r: this.bitmap.data[idx], + g: this.bitmap.data[idx + 1], + b: this.bitmap.data[idx + 2], + a: this.bitmap.data[idx + 3] + }; + const dst = { + r: baseImage.bitmap.data[dstIdx], + g: baseImage.bitmap.data[dstIdx + 1], + b: baseImage.bitmap.data[dstIdx + 2], + a: baseImage.bitmap.data[dstIdx + 3] + }; + baseImage.bitmap.data[dstIdx] = (src.a * (src.r - dst.r) - dst.r + 255 >> 8) + dst.r; + baseImage.bitmap.data[dstIdx + 1] = (src.a * (src.g - dst.g) - dst.g + 255 >> 8) + dst.g; + baseImage.bitmap.data[dstIdx + 2] = (src.a * (src.b - dst.b) - dst.b + 255 >> 8) + dst.b; + baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(dst.a + src.a); } - - return this; + }); + if (isNodePattern(cb)) { + cb.call(this, null, this); } - }; -}; - -exports["default"] = _default; + return this; + } +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blit/es/index.js.map b/project starter code/node_modules/@jimp/plugin-blit/es/index.js.map index 0c3d69b7..43f3277c 100644 --- a/project starter code/node_modules/@jimp/plugin-blit/es/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-blit/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["blit","src","x","y","srcx","srcy","srcw","srch","cb","constructor","throwError","call","bitmap","width","height","Math","round","maxWidth","maxHeight","baseImage","scanQuiet","sx","sy","idx","xOffset","yOffset","dstIdx","getPixelIndex","r","data","g","b","a","dst","limit255"],"mappings":";;;;;;;;;;;AAAA;;eAEe;AAAA,SAAO;AACpB;;;;;;;;;;;;AAYAA,IAAAA,IAboB,gB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GAAnC,IAA2C,CAA5C,IAAiDE,GAAG,CAACF,CADvD;AAEAZ,UAAAA,SAAS,CAACP,MAAV,CAAiBiB,IAAjB,CAAsBH,MAAM,GAAG,CAA/B,IAAoC,KAAKjB,WAAL,CAAiByB,QAAjB,CAClCD,GAAG,CAACD,CAAJ,GAAQ/B,IAAG,CAAC+B,CADsB,CAApC;AAGD;AACF,OAnCD;;AAqCA,UAAI,0BAAcxB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACG,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AArGmB,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from '@jimp/utils';\n\nexport default () => ({\n /**\n * Blits a source image on to this image\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {number} srcx (optional) the x position from which to crop the source image\n * @param {number} srcy (optional) the y position from which to crop the source image\n * @param {number} srcw (optional) the width to which to crop the source image\n * @param {number} srch (optional) the height to which to crop the source image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blit(src, x, y, srcx, srcy, srcw, srch, cb) {\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n if (typeof srcx === 'function') {\n cb = srcx;\n srcx = 0;\n srcy = 0;\n srcw = src.bitmap.width;\n srch = src.bitmap.height;\n } else if (\n typeof srcx === typeof srcy &&\n typeof srcy === typeof srcw &&\n typeof srcw === typeof srch\n ) {\n srcx = srcx || 0;\n srcy = srcy || 0;\n srcw = srcw || src.bitmap.width;\n srch = srch || src.bitmap.height;\n } else {\n return throwError.call(\n this,\n 'srcx, srcy, srcw, srch must be numbers',\n cb\n );\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n // round input\n srcx = Math.round(srcx);\n srcy = Math.round(srcy);\n srcw = Math.round(srcw);\n srch = Math.round(srch);\n\n const maxWidth = this.bitmap.width;\n const maxHeight = this.bitmap.height;\n const baseImage = this;\n\n src.scanQuiet(srcx, srcy, srcw, srch, function(sx, sy, idx) {\n const xOffset = x + sx - srcx;\n const yOffset = y + sy - srcy;\n\n if (\n xOffset >= 0 &&\n yOffset >= 0 &&\n maxWidth - xOffset > 0 &&\n maxHeight - yOffset > 0\n ) {\n const dstIdx = baseImage.getPixelIndex(xOffset, yOffset);\n const src = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2],\n a: this.bitmap.data[idx + 3]\n };\n\n const dst = {\n r: baseImage.bitmap.data[dstIdx],\n g: baseImage.bitmap.data[dstIdx + 1],\n b: baseImage.bitmap.data[dstIdx + 2],\n a: baseImage.bitmap.data[dstIdx + 3]\n };\n\n baseImage.bitmap.data[dstIdx] =\n ((src.a * (src.r - dst.r) - dst.r + 255) >> 8) + dst.r;\n baseImage.bitmap.data[dstIdx + 1] =\n ((src.a * (src.g - dst.g) - dst.g + 255) >> 8) + dst.g;\n baseImage.bitmap.data[dstIdx + 2] =\n ((src.a * (src.b - dst.b) - dst.b + 255) >> 8) + dst.b;\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(\n dst.a + src.a\n );\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["throwError","isNodePattern","blit","src","x","y","srcx","srcy","srcw","srch","cb","constructor","call","bitmap","width","height","Math","round","maxWidth","maxHeight","baseImage","scanQuiet","sx","sy","idx","xOffset","yOffset","dstIdx","getPixelIndex","r","data","g","b","a","dst","limit255"],"sources":["../src/index.js"],"sourcesContent":["import { throwError, isNodePattern } from \"@jimp/utils\";\n\nexport default () => ({\n /**\n * Blits a source image on to this image\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {number} srcx (optional) the x position from which to crop the source image\n * @param {number} srcy (optional) the y position from which to crop the source image\n * @param {number} srcw (optional) the width to which to crop the source image\n * @param {number} srch (optional) the height to which to crop the source image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blit(src, x, y, srcx, srcy, srcw, srch, cb) {\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n if (typeof srcx === \"function\") {\n cb = srcx;\n srcx = 0;\n srcy = 0;\n srcw = src.bitmap.width;\n srch = src.bitmap.height;\n } else if (\n typeof srcx === typeof srcy &&\n typeof srcy === typeof srcw &&\n typeof srcw === typeof srch\n ) {\n srcx = srcx || 0;\n srcy = srcy || 0;\n srcw = srcw || src.bitmap.width;\n srch = srch || src.bitmap.height;\n } else {\n return throwError.call(\n this,\n \"srcx, srcy, srcw, srch must be numbers\",\n cb\n );\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n // round input\n srcx = Math.round(srcx);\n srcy = Math.round(srcy);\n srcw = Math.round(srcw);\n srch = Math.round(srch);\n\n const maxWidth = this.bitmap.width;\n const maxHeight = this.bitmap.height;\n const baseImage = this;\n\n src.scanQuiet(srcx, srcy, srcw, srch, function (sx, sy, idx) {\n const xOffset = x + sx - srcx;\n const yOffset = y + sy - srcy;\n\n if (\n xOffset >= 0 &&\n yOffset >= 0 &&\n maxWidth - xOffset > 0 &&\n maxHeight - yOffset > 0\n ) {\n const dstIdx = baseImage.getPixelIndex(xOffset, yOffset);\n const src = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2],\n a: this.bitmap.data[idx + 3],\n };\n\n const dst = {\n r: baseImage.bitmap.data[dstIdx],\n g: baseImage.bitmap.data[dstIdx + 1],\n b: baseImage.bitmap.data[dstIdx + 2],\n a: baseImage.bitmap.data[dstIdx + 3],\n };\n\n baseImage.bitmap.data[dstIdx] =\n ((src.a * (src.r - dst.r) - dst.r + 255) >> 8) + dst.r;\n baseImage.bitmap.data[dstIdx + 1] =\n ((src.a * (src.g - dst.g) - dst.g + 255) >> 8) + dst.g;\n baseImage.bitmap.data[dstIdx + 2] =\n ((src.a * (src.b - dst.b) - dst.b + 255) >> 8) + dst.b;\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(\n dst.a + src.a\n );\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,UAAU,EAAEC,aAAa,QAAQ,aAAa;AAEvD,gBAAe,OAAO;EACpB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,IAAI,CAACC,GAAG,EAAEC,CAAC,EAAEC,CAAC,EAAEC,IAAI,EAAEC,IAAI,EAAEC,IAAI,EAAEC,IAAI,EAAEC,EAAE,EAAE;IAC1C,IAAI,EAAEP,GAAG,YAAY,IAAI,CAACQ,WAAW,CAAC,EAAE;MACtC,OAAOX,UAAU,CAACY,IAAI,CAAC,IAAI,EAAE,iCAAiC,EAAEF,EAAE,CAAC;IACrE;IAEA,IAAI,OAAON,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAAE;MAClD,OAAOL,UAAU,CAACY,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAEF,EAAE,CAAC;IAC7D;IAEA,IAAI,OAAOJ,IAAI,KAAK,UAAU,EAAE;MAC9BI,EAAE,GAAGJ,IAAI;MACTA,IAAI,GAAG,CAAC;MACRC,IAAI,GAAG,CAAC;MACRC,IAAI,GAAGL,GAAG,CAACU,MAAM,CAACC,KAAK;MACvBL,IAAI,GAAGN,GAAG,CAACU,MAAM,CAACE,MAAM;IAC1B,CAAC,MAAM,IACL,O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CAACH,CAAC,CAAC,GAAGG,GAAG,CAACH,CAAC,GAAG,GAAG,IAAK,CAAC,IAAIG,GAAG,CAACH,CAAC;QACxDX,SAAS,CAACP,MAAM,CAACiB,IAAI,CAACH,MAAM,GAAG,CAAC,CAAC,GAC/B,CAAExB,GAAG,CAAC8B,CAAC,IAAI9B,GAAG,CAAC6B,CAAC,GAAGE,GAAG,CAACF,CAAC,CAAC,GAAGE,GAAG,CAACF,CAAC,GAAG,GAAG,IAAK,CAAC,IAAIE,GAAG,CAACF,CAAC;QACxDZ,SAAS,CAACP,MAAM,CAACiB,IAAI,CAACH,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAChB,WAAW,CAACwB,QAAQ,CAC3DD,GAAG,CAACD,CAAC,GAAG9B,GAAG,CAAC8B,CAAC,CACd;MACH;IACF,CAAC,CAAC;IAEF,IAAIhC,aAAa,CAACS,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blit/index.d.ts b/project starter code/node_modules/@jimp/plugin-blit/index.d.ts index abe5ee2c..0caad70e 100644 --- a/project starter code/node_modules/@jimp/plugin-blit/index.d.ts +++ b/project starter code/node_modules/@jimp/plugin-blit/index.d.ts @@ -1,4 +1,4 @@ -import { Jimp, ImageCallback } from '@jimp/core'; +import { Jimp, ImageCallback } from "@jimp/core"; interface Blit { blit(src: Jimp, x: number, y: number, cb?: ImageCallback): this; @@ -14,4 +14,4 @@ interface Blit { ): this; } -export default function(): Blit; +export default function (): Blit; diff --git a/project starter code/node_modules/@jimp/plugin-blit/package.json b/project starter code/node_modules/@jimp/plugin-blit/package.json index 74cefc97..d349e12c 100644 --- a/project starter code/node_modules/@jimp/plugin-blit/package.json +++ b/project starter code/node_modules/@jimp/plugin-blit/package.json @@ -1,12 +1,13 @@ { "name": "@jimp/plugin-blit", - "version": "0.16.2", + "version": "0.22.12", "description": "Blit an image.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js", "test:watch": "npm run test -- --reporter min --watch", "test:coverage": "nyc npm run test", "build": "npm run build:node:production && npm run build:module", @@ -20,13 +21,12 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/jpeg": "^0.16.2", - "@jimp/test-utils": "^0.16.2" + "@jimp/custom": "^0.22.12", + "@jimp/jpeg": "^0.22.12", + "@jimp/test-utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" @@ -34,5 +34,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/plugin-blit/src/index.js b/project starter code/node_modules/@jimp/plugin-blit/src/index.js index 467bd314..133a5374 100644 --- a/project starter code/node_modules/@jimp/plugin-blit/src/index.js +++ b/project starter code/node_modules/@jimp/plugin-blit/src/index.js @@ -1,4 +1,4 @@ -import { throwError, isNodePattern } from '@jimp/utils'; +import { throwError, isNodePattern } from "@jimp/utils"; export default () => ({ /** @@ -15,14 +15,14 @@ export default () => ({ */ blit(src, x, y, srcx, srcy, srcw, srch, cb) { if (!(src instanceof this.constructor)) { - return throwError.call(this, 'The source must be a Jimp image', cb); + return throwError.call(this, "The source must be a Jimp image", cb); } - if (typeof x !== 'number' || typeof y !== 'number') { - return throwError.call(this, 'x and y must be numbers', cb); + if (typeof x !== "number" || typeof y !== "number") { + return throwError.call(this, "x and y must be numbers", cb); } - if (typeof srcx === 'function') { + if (typeof srcx === "function") { cb = srcx; srcx = 0; srcy = 0; @@ -40,7 +40,7 @@ export default () => ({ } else { return throwError.call( this, - 'srcx, srcy, srcw, srch must be numbers', + "srcx, srcy, srcw, srch must be numbers", cb ); } @@ -59,7 +59,7 @@ export default () => ({ const maxHeight = this.bitmap.height; const baseImage = this; - src.scanQuiet(srcx, srcy, srcw, srch, function(sx, sy, idx) { + src.scanQuiet(srcx, srcy, srcw, srch, function (sx, sy, idx) { const xOffset = x + sx - srcx; const yOffset = y + sy - srcy; @@ -74,14 +74,14 @@ export default () => ({ r: this.bitmap.data[idx], g: this.bitmap.data[idx + 1], b: this.bitmap.data[idx + 2], - a: this.bitmap.data[idx + 3] + a: this.bitmap.data[idx + 3], }; const dst = { r: baseImage.bitmap.data[dstIdx], g: baseImage.bitmap.data[dstIdx + 1], b: baseImage.bitmap.data[dstIdx + 2], - a: baseImage.bitmap.data[dstIdx + 3] + a: baseImage.bitmap.data[dstIdx + 3], }; baseImage.bitmap.data[dstIdx] = @@ -101,5 +101,5 @@ export default () => ({ } return this; - } + }, }); diff --git a/project starter code/node_modules/@jimp/plugin-blit/test/blit.test.js b/project starter code/node_modules/@jimp/plugin-blit/test/blit.test.js index 94a372f7..a9b71cb0 100644 --- a/project starter code/node_modules/@jimp/plugin-blit/test/blit.test.js +++ b/project starter code/node_modules/@jimp/plugin-blit/test/blit.test.js @@ -1,41 +1,43 @@ -import { Jimp, mkJGD, getTestDir } from '@jimp/test-utils'; -import jpeg from '@jimp/jpeg'; -import configure from '@jimp/custom'; +import { Jimp, mkJGD, getTestDir } from "@jimp/test-utils"; +import jpeg from "@jimp/jpeg"; +import configure from "@jimp/custom"; +import expect from "@storybook/expect"; -import blit from '../src'; +import blit from "../src"; +import { expectToBeJGD } from "@jimp/test-utils/src"; const jimp = configure({ types: [jpeg], plugins: [blit] }, Jimp); const testDir = getTestDir(__dirname); -describe('Blit over image', function() { +describe("Blit over image", function () { this.timeout(15000); const targetJGD = mkJGD( - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆' + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆" ); const srcJGD = mkJGD( - '□□□□□□', - '□▥▥▥▥□', - '□▥■■▥□', - '□▥■■▥□', - '□▥▥▥▥□', - '□□□□□□' + "□□□□□□", + "□▥▥▥▥□", + "□▥■■▥□", + "□▥■■▥□", + "□▥▥▥▥□", + "□□□□□□" ); let targetImg; let srcImg; // stores the Jimp instances of the JGD images above. - before(done => { + before((done) => { const img1 = jimp.read(targetJGD); const img2 = jimp.read(srcJGD); Promise.all([img1, img2]) - .then(images => { + .then((images) => { targetImg = images[0]; srcImg = images[1]; done(); @@ -43,136 +45,116 @@ describe('Blit over image', function() { .catch(done); }); - it('blit on top, with no crop', () => { - targetImg - .clone() - .blit(srcImg, 0, 0) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '□□□□□□▸▸', - '□▥▥▥▥□▸▸', - '□▥■■▥□▸▸', - '□▥■■▥□▸▸', - '□▥▥▥▥□◆◆', - '□□□□□□◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆' - ) - ); + it("blit on top, with no crop", () => { + expectToBeJGD( + targetImg.clone().blit(srcImg, 0, 0).getJGDSync(), + mkJGD( + "□□□□□□▸▸", + "□▥▥▥▥□▸▸", + "□▥■■▥□▸▸", + "□▥■■▥□▸▸", + "□▥▥▥▥□◆◆", + "□□□□□□◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆" + ) + ); }); - it('blit on middle, with no crop', () => { - targetImg - .clone() - .blit(srcImg, 1, 1) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '▴▴▴▴▸▸▸▸', - '▴□□□□□□▸', - '▴□▥▥▥▥□▸', - '▴□▥■■▥□▸', - '▾□▥■■▥□◆', - '▾□▥▥▥▥□◆', - '▾□□□□□□◆', - '▾▾▾▾◆◆◆◆' - ) - ); + it("blit on middle, with no crop", () => { + expectToBeJGD( + targetImg.clone().blit(srcImg, 1, 1).getJGDSync(), + mkJGD( + "▴▴▴▴▸▸▸▸", + "▴□□□□□□▸", + "▴□▥▥▥▥□▸", + "▴□▥■■▥□▸", + "▾□▥■■▥□◆", + "▾□▥▥▥▥□◆", + "▾□□□□□□◆", + "▾▾▾▾◆◆◆◆" + ) + ); }); - it('blit on middle, with x,y crop', () => { - targetImg - .clone() - .blit(srcImg, 2, 2, 1, 1, 5, 5) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▥▥▥▥□▸', - '▴▴▥■■▥□▸', - '▾▾▥■■▥□◆', - '▾▾▥▥▥▥□◆', - '▾▾□□□□□◆', - '▾▾▾▾◆◆◆◆' - ) - ); + it("blit on middle, with x,y crop", () => { + expectToBeJGD( + targetImg.clone().blit(srcImg, 2, 2, 1, 1, 5, 5).getJGDSync(), + mkJGD( + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▥▥▥▥□▸", + "▴▴▥■■▥□▸", + "▾▾▥■■▥□◆", + "▾▾▥▥▥▥□◆", + "▾▾□□□□□◆", + "▾▾▾▾◆◆◆◆" + ) + ); }); - it('blit on middle, with x,y,w,h crop', () => { - targetImg - .clone() - .blit(srcImg, 2, 2, 1, 1, 4, 4) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▥▥▥▥▸▸', - '▴▴▥■■▥▸▸', - '▾▾▥■■▥◆◆', - '▾▾▥▥▥▥◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆' - ) - ); + it("blit on middle, with x,y,w,h crop", () => { + expectToBeJGD( + targetImg.clone().blit(srcImg, 2, 2, 1, 1, 4, 4).getJGDSync(), + mkJGD( + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▥▥▥▥▸▸", + "▴▴▥■■▥▸▸", + "▾▾▥■■▥◆◆", + "▾▾▥▥▥▥◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆" + ) + ); }); - it('blit partially out, on top-left', () => { - targetImg - .clone() - .blit(srcImg, -1, -1) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '▥▥▥▥□▸▸▸', - '▥■■▥□▸▸▸', - '▥■■▥□▸▸▸', - '▥▥▥▥□▸▸▸', - '□□□□□◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆' - ) - ); + it("blit partially out, on top-left", () => { + expectToBeJGD( + targetImg.clone().blit(srcImg, -1, -1).getJGDSync(), + mkJGD( + "▥▥▥▥□▸▸▸", + "▥■■▥□▸▸▸", + "▥■■▥□▸▸▸", + "▥▥▥▥□▸▸▸", + "□□□□□◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆" + ) + ); }); - it('blit partially out, on bottom-right', () => { - targetImg - .clone() - .blit(srcImg, 3, 3) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴□□□□□', - '▾▾▾□▥▥▥▥', - '▾▾▾□▥■■▥', - '▾▾▾□▥■■▥', - '▾▾▾□▥▥▥▥' - ) - ); + it("blit partially out, on bottom-right", () => { + expectToBeJGD( + targetImg.clone().blit(srcImg, 3, 3).getJGDSync(), + mkJGD( + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴□□□□□", + "▾▾▾□▥▥▥▥", + "▾▾▾□▥■■▥", + "▾▾▾□▥■■▥", + "▾▾▾□▥▥▥▥" + ) + ); }); - it('blit alpha', async () => { - const expectedImg = await Jimp.read(testDir + '/images/blit-alpha.png'); - const dice = await Jimp.read(testDir + '/images/dice.png'); - const image = await Jimp.read(testDir + '/images/cops.jpg'); + it("blit alpha", async () => { + const expectedImg = await Jimp.read(testDir + "/images/blit-alpha.png"); + const dice = await Jimp.read(testDir + "/images/dice.png"); + const image = await Jimp.read(testDir + "/images/cops.jpg"); - image - .blit(dice, 0, 0) - .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + expect(image.blit(dice, 0, 0).bitmap.data).toEqual(expectedImg.bitmap.data); }); async function createCat(catNum, len) { - let imgHeight = 60; + const imgHeight = 60; - const butt = await Jimp.read(testDir + '/images/cat_butt.png'); - const head = await Jimp.read(testDir + '/images/cat_head.png'); - const fuzz = await Jimp.read(testDir + '/images/cat_fuzz.png'); + const butt = await Jimp.read(testDir + "/images/cat_butt.png"); + const head = await Jimp.read(testDir + "/images/cat_head.png"); + const fuzz = await Jimp.read(testDir + "/images/cat_fuzz.png"); let longCat = len; longCat = longCat > 20 ? 20 : longCat; @@ -213,23 +195,24 @@ describe('Blit over image', function() { return newImage; } - it('uses src params correctly', async () => { + it("uses src params correctly", async () => { const expectedSmall = await Jimp.read( - testDir + '/images/cat-results/small-cat.png' + testDir + "/images/cat-results/small-cat.png" ); const small = await createCat(0.3, 1); - small.bitmap.data.should.be.deepEqual(expectedSmall.bitmap.data); + + expect(small.bitmap.data).toEqual(expectedSmall.bitmap.data); const expectedMedium = await Jimp.read( - testDir + '/images/cat-results/medium-cat.png' + testDir + "/images/cat-results/medium-cat.png" ); const medium = await createCat(0.6, 7); - medium.bitmap.data.should.be.deepEqual(expectedMedium.bitmap.data); + expect(medium.bitmap.data).toEqual(expectedMedium.bitmap.data); const expectedLarge = await Jimp.read( - testDir + '/images/cat-results/large-cat.png' + testDir + "/images/cat-results/large-cat.png" ); const large = await createCat(0.9, 20); - large.bitmap.data.should.be.deepEqual(expectedLarge.bitmap.data); + expect(large.bitmap.data).toEqual(expectedLarge.bitmap.data); }); }); diff --git a/project starter code/node_modules/@jimp/plugin-blur/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-blur/CHANGELOG.md index 26394e0f..8d029143 100644 --- a/project starter code/node_modules/@jimp/plugin-blur/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/plugin-blur/CHANGELOG.md @@ -1,3 +1,51 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -12,7 +60,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -20,4 +68,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-blur/README.md b/project starter code/node_modules/@jimp/plugin-blur/README.md index e0d47697..caa71583 100644 --- a/project starter code/node_modules/@jimp/plugin-blur/README.md +++ b/project starter code/node_modules/@jimp/plugin-blur/README.md @@ -13,10 +13,10 @@ A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.blur(5); } diff --git a/project starter code/node_modules/@jimp/plugin-blur/dist/blur-tables.js b/project starter code/node_modules/@jimp/plugin-blur/dist/blur-tables.js index 6d31ea19..28393a6e 100644 --- a/project starter code/node_modules/@jimp/plugin-blur/dist/blur-tables.js +++ b/project starter code/node_modules/@jimp/plugin-blur/dist/blur-tables.js @@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.shgTable = exports.mulTable = void 0; -var mulTable = [1, 57, 41, 21, 203, 34, 97, 73, 227, 91, 149, 62, 105, 45, 39, 137, 241, 107, 3, 173, 39, 71, 65, 238, 219, 101, 187, 87, 81, 151, 141, 133, 249, 117, 221, 209, 197, 187, 177, 169, 5, 153, 73, 139, 133, 127, 243, 233, 223, 107, 103, 99, 191, 23, 177, 171, 165, 159, 77, 149, 9, 139, 135, 131, 253, 245, 119, 231, 224, 109, 211, 103, 25, 195, 189, 23, 45, 175, 171, 83, 81, 79, 155, 151, 147, 9, 141, 137, 67, 131, 129, 251, 123, 30, 235, 115, 113, 221, 217, 53, 13, 51, 50, 49, 193, 189, 185, 91, 179, 175, 43, 169, 83, 163, 5, 79, 155, 19, 75, 147, 145, 143, 35, 69, 17, 67, 33, 65, 255, 251, 247, 243, 239, 59, 29, 229, 113, 111, 219, 27, 213, 105, 207, 51, 201, 199, 49, 193, 191, 47, 93, 183, 181, 179, 11, 87, 43, 85, 167, 165, 163, 161, 159, 157, 155, 77, 19, 75, 37, 73, 145, 143, 141, 35, 138, 137, 135, 67, 33, 131, 129, 255, 63, 250, 247, 61, 121, 239, 237, 117, 29, 229, 227, 225, 111, 55, 109, 216, 213, 211, 209, 207, 205, 203, 201, 199, 197, 195, 193, 48, 190, 47, 93, 185, 183, 181, 179, 178, 176, 175, 173, 171, 85, 21, 167, 165, 41, 163, 161, 5, 79, 157, 78, 154, 153, 19, 75, 149, 74, 147, 73, 144, 143, 71, 141, 140, 139, 137, 17, 135, 134, 133, 66, 131, 65, 129, 1]; +const mulTable = [1, 57, 41, 21, 203, 34, 97, 73, 227, 91, 149, 62, 105, 45, 39, 137, 241, 107, 3, 173, 39, 71, 65, 238, 219, 101, 187, 87, 81, 151, 141, 133, 249, 117, 221, 209, 197, 187, 177, 169, 5, 153, 73, 139, 133, 127, 243, 233, 223, 107, 103, 99, 191, 23, 177, 171, 165, 159, 77, 149, 9, 139, 135, 131, 253, 245, 119, 231, 224, 109, 211, 103, 25, 195, 189, 23, 45, 175, 171, 83, 81, 79, 155, 151, 147, 9, 141, 137, 67, 131, 129, 251, 123, 30, 235, 115, 113, 221, 217, 53, 13, 51, 50, 49, 193, 189, 185, 91, 179, 175, 43, 169, 83, 163, 5, 79, 155, 19, 75, 147, 145, 143, 35, 69, 17, 67, 33, 65, 255, 251, 247, 243, 239, 59, 29, 229, 113, 111, 219, 27, 213, 105, 207, 51, 201, 199, 49, 193, 191, 47, 93, 183, 181, 179, 11, 87, 43, 85, 167, 165, 163, 161, 159, 157, 155, 77, 19, 75, 37, 73, 145, 143, 141, 35, 138, 137, 135, 67, 33, 131, 129, 255, 63, 250, 247, 61, 121, 239, 237, 117, 29, 229, 227, 225, 111, 55, 109, 216, 213, 211, 209, 207, 205, 203, 201, 199, 197, 195, 193, 48, 190, 47, 93, 185, 183, 181, 179, 178, 176, 175, 173, 171, 85, 21, 167, 165, 41, 163, 161, 5, 79, 157, 78, 154, 153, 19, 75, 149, 74, 147, 73, 144, 143, 71, 141, 140, 139, 137, 17, 135, 134, 133, 66, 131, 65, 129, 1]; exports.mulTable = mulTable; -var shgTable = [0, 9, 10, 10, 14, 12, 14, 14, 16, 15, 16, 15, 16, 15, 15, 17, 18, 17, 12, 18, 16, 17, 17, 19, 19, 18, 19, 18, 18, 19, 19, 19, 20, 19, 20, 20, 20, 20, 20, 20, 15, 20, 19, 20, 20, 20, 21, 21, 21, 20, 20, 20, 21, 18, 21, 21, 21, 21, 20, 21, 17, 21, 21, 21, 22, 22, 21, 22, 22, 21, 22, 21, 19, 22, 22, 19, 20, 22, 22, 21, 21, 21, 22, 22, 22, 18, 22, 22, 21, 22, 22, 23, 22, 20, 23, 22, 22, 23, 23, 21, 19, 21, 21, 21, 23, 23, 23, 22, 23, 23, 21, 23, 22, 23, 18, 22, 23, 20, 22, 23, 23, 23, 21, 22, 20, 22, 21, 22, 24, 24, 24, 24, 24, 22, 21, 24, 23, 23, 24, 21, 24, 23, 24, 22, 24, 24, 22, 24, 24, 22, 23, 24, 24, 24, 20, 23, 22, 23, 24, 24, 24, 24, 24, 24, 24, 23, 21, 23, 22, 23, 24, 24, 24, 22, 24, 24, 24, 23, 22, 24, 24, 25, 23, 25, 25, 23, 24, 25, 25, 24, 22, 25, 25, 25, 24, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 23, 25, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 22, 25, 25, 23, 25, 25, 20, 24, 25, 24, 25, 25, 22, 24, 25, 24, 25, 24, 25, 25, 24, 25, 25, 25, 25, 22, 25, 25, 25, 24, 25, 24, 25, 18]; +const shgTable = [0, 9, 10, 10, 14, 12, 14, 14, 16, 15, 16, 15, 16, 15, 15, 17, 18, 17, 12, 18, 16, 17, 17, 19, 19, 18, 19, 18, 18, 19, 19, 19, 20, 19, 20, 20, 20, 20, 20, 20, 15, 20, 19, 20, 20, 20, 21, 21, 21, 20, 20, 20, 21, 18, 21, 21, 21, 21, 20, 21, 17, 21, 21, 21, 22, 22, 21, 22, 22, 21, 22, 21, 19, 22, 22, 19, 20, 22, 22, 21, 21, 21, 22, 22, 22, 18, 22, 22, 21, 22, 22, 23, 22, 20, 23, 22, 22, 23, 23, 21, 19, 21, 21, 21, 23, 23, 23, 22, 23, 23, 21, 23, 22, 23, 18, 22, 23, 20, 22, 23, 23, 23, 21, 22, 20, 22, 21, 22, 24, 24, 24, 24, 24, 22, 21, 24, 23, 23, 24, 21, 24, 23, 24, 22, 24, 24, 22, 24, 24, 22, 23, 24, 24, 24, 20, 23, 22, 23, 24, 24, 24, 24, 24, 24, 24, 23, 21, 23, 22, 23, 24, 24, 24, 22, 24, 24, 24, 23, 22, 24, 24, 25, 23, 25, 25, 23, 24, 25, 25, 24, 22, 25, 25, 25, 24, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 23, 25, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 22, 25, 25, 23, 25, 25, 20, 24, 25, 24, 25, 25, 22, 24, 25, 24, 25, 24, 25, 25, 24, 25, 25, 25, 25, 22, 25, 25, 25, 24, 25, 24, 25, 18]; exports.shgTable = shgTable; //# sourceMappingURL=blur-tables.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blur/dist/blur-tables.js.map b/project starter code/node_modules/@jimp/plugin-blur/dist/blur-tables.js.map index 629f0a0f..484c6e19 100644 --- a/project starter code/node_modules/@jimp/plugin-blur/dist/blur-tables.js.map +++ b/project starter code/node_modules/@jimp/plugin-blur/dist/blur-tables.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/blur-tables.js"],"names":["mulTable","shgTable"],"mappings":";;;;;;AAAO,IAAMA,QAAQ,GAAG,CACtB,CADsB,EAEtB,EAFsB,EAGtB,EAHsB,EAItB,EAJsB,EAKtB,GALsB,EAMtB,EANsB,EAOtB,EAPsB,EAQtB,EARsB,EAStB,GATsB,EAUtB,EAVsB,EAWtB,GAXsB,EAYtB,EAZsB,EAatB,GAbsB,EActB,EAdsB,EAetB,EAfsB,EAgBtB,GAhBsB,EAiBtB,GAjBsB,EAkBtB,GAlBsB,EAmBtB,CAnBsB,EAoBtB,GApBsB,EAqBtB,EArBsB,EAsBtB,EAtBsB,EAuBtB,EAvBsB,EAwBtB,GAxBsB,EAyBtB,GAzBsB,EA0BtB,GA1BsB,EA2BtB,GA3BsB,EA4BtB,EA5BsB,EA6BtB,EA7BsB,EA8BtB,GA9BsB,EA+BtB,GA/BsB,EAgCtB,GAhCsB,EAiCtB,GAjCsB,EAkCtB,GAlCsB,EAmCtB,GAnCsB,EAoCtB,GApCsB,EAqCtB,GArCsB,EAsCtB,GAtCsB,E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,EAmOtB,EAnOsB,EAoOtB,EApOsB,EAqOtB,EArOsB,EAsOtB,EAtOsB,EAuOtB,EAvOsB,EAwOtB,EAxOsB,EAyOtB,EAzOsB,EA0OtB,EA1OsB,EA2OtB,EA3OsB,EA4OtB,EA5OsB,EA6OtB,EA7OsB,EA8OtB,EA9OsB,EA+OtB,EA/OsB,EAgPtB,EAhPsB,EAiPtB,EAjPsB,EAkPtB,EAlPsB,EAmPtB,EAnPsB,EAoPtB,EApPsB,EAqPtB,EArPsB,EAsPtB,EAtPsB,EAuPtB,EAvPsB,EAwPtB,EAxPsB,EAyPtB,EAzPsB,EA0PtB,EA1PsB,EA2PtB,EA3PsB,EA4PtB,EA5PsB,EA6PtB,EA7PsB,EA8PtB,EA9PsB,EA+PtB,EA/PsB,EAgQtB,EAhQsB,EAiQtB,EAjQsB,CAAjB","sourcesContent":["export const mulTable = [\n 1,\n 57,\n 41,\n 21,\n 203,\n 34,\n 97,\n 73,\n 227,\n 91,\n 149,\n 62,\n 105,\n 45,\n 39,\n 137,\n 241,\n 107,\n 3,\n 173,\n 39,\n 71,\n 65,\n 238,\n 219,\n 101,\n 187,\n 87,\n 81,\n 151,\n 141,\n 133,\n 249,\n 117,\n 221,\n 209,\n 197,\n 187,\n 177,\n 169,\n 5,\n 153,\n 73,\n 139,\n 133,\n 127,\n 243,\n 233,\n 223,\n 107,\n 103,\n 99,\n 191,\n 23,\n 177,\n 171,\n 165,\n 159,\n 77,\n 149,\n 9,\n 139,\n 135,\n 131,\n 253,\n 245,\n 119,\n 231,\n 224,\n 109,\n 211,\n 103,\n 25,\n 195,\n 189,\n 23,\n 45,\n 175,\n 171,\n 83,\n 81,\n 79,\n 155,\n 151,\n 147,\n 9,\n 141,\n 137,\n 67,\n 131,\n 129,\n 251,\n 123,\n 30,\n 235,\n 115,\n 113,\n 221,\n 217,\n 53,\n 13,\n 51,\n 50,\n 49,\n 193,\n 189,\n 185,\n 91,\n 179,\n 175,\n 43,\n 169,\n 83,\n 163,\n 5,\n 79,\n 155,\n 19,\n 75,\n 147,\n 145,\n 143,\n 35,\n 69,\n 17,\n 67,\n 33,\n 65,\n 255,\n 251,\n 247,\n 243,\n 239,\n 59,\n 29,\n 229,\n 113,\n 111,\n 219,\n 27,\n 213,\n 105,\n 207,\n 51,\n 201,\n 199,\n 49,\n 193,\n 191,\n 47,\n 93,\n 183,\n 181,\n 179,\n 11,\n 87,\n 43,\n 85,\n 167,\n 165,\n 163,\n 161,\n 159,\n 157,\n 155,\n 77,\n 19,\n 75,\n 37,\n 73,\n 145,\n 143,\n 141,\n 35,\n 138,\n 137,\n 135,\n 67,\n 33,\n 131,\n 129,\n 255,\n 63,\n 250,\n 247,\n 61,\n 121,\n 239,\n 237,\n 117,\n 29,\n 229,\n 227,\n 225,\n 111,\n 55,\n 109,\n 216,\n 213,\n 211,\n 209,\n 207,\n 205,\n 203,\n 201,\n 199,\n 197,\n 195,\n 193,\n 48,\n 190,\n 47,\n 93,\n 185,\n 183,\n 181,\n 179,\n 178,\n 176,\n 175,\n 173,\n 171,\n 85,\n 21,\n 167,\n 165,\n 41,\n 163,\n 161,\n 5,\n 79,\n 157,\n 78,\n 154,\n 153,\n 19,\n 75,\n 149,\n 74,\n 147,\n 73,\n 144,\n 143,\n 71,\n 141,\n 140,\n 139,\n 137,\n 17,\n 135,\n 134,\n 133,\n 66,\n 131,\n 65,\n 129,\n 1\n];\n\nexport const shgTable = [\n 0,\n 9,\n 10,\n 10,\n 14,\n 12,\n 14,\n 14,\n 16,\n 15,\n 16,\n 15,\n 16,\n 15,\n 15,\n 17,\n 18,\n 17,\n 12,\n 18,\n 16,\n 17,\n 17,\n 19,\n 19,\n 18,\n 19,\n 18,\n 18,\n 19,\n 19,\n 19,\n 20,\n 19,\n 20,\n 20,\n 20,\n 20,\n 20,\n 20,\n 15,\n 20,\n 19,\n 20,\n 20,\n 20,\n 21,\n 21,\n 21,\n 20,\n 20,\n 20,\n 21,\n 18,\n 21,\n 21,\n 21,\n 21,\n 20,\n 21,\n 17,\n 21,\n 21,\n 21,\n 22,\n 22,\n 21,\n 22,\n 22,\n 21,\n 22,\n 21,\n 19,\n 22,\n 22,\n 19,\n 20,\n 22,\n 22,\n 21,\n 21,\n 21,\n 22,\n 22,\n 22,\n 18,\n 22,\n 22,\n 21,\n 22,\n 22,\n 23,\n 22,\n 20,\n 23,\n 22,\n 22,\n 23,\n 23,\n 21,\n 19,\n 21,\n 21,\n 21,\n 23,\n 23,\n 23,\n 22,\n 23,\n 23,\n 21,\n 23,\n 22,\n 23,\n 18,\n 22,\n 23,\n 20,\n 22,\n 23,\n 23,\n 23,\n 21,\n 22,\n 20,\n 22,\n 21,\n 22,\n 24,\n 24,\n 24,\n 24,\n 24,\n 22,\n 21,\n 24,\n 23,\n 23,\n 24,\n 21,\n 24,\n 23,\n 24,\n 22,\n 24,\n 24,\n 22,\n 24,\n 24,\n 22,\n 23,\n 24,\n 24,\n 24,\n 20,\n 23,\n 22,\n 23,\n 24,\n 24,\n 24,\n 24,\n 24,\n 24,\n 24,\n 23,\n 21,\n 23,\n 22,\n 23,\n 24,\n 24,\n 24,\n 22,\n 24,\n 24,\n 24,\n 23,\n 22,\n 24,\n 24,\n 25,\n 23,\n 25,\n 25,\n 23,\n 24,\n 25,\n 25,\n 24,\n 22,\n 25,\n 25,\n 25,\n 24,\n 23,\n 24,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 23,\n 25,\n 23,\n 24,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 24,\n 22,\n 25,\n 25,\n 23,\n 25,\n 25,\n 20,\n 24,\n 25,\n 24,\n 25,\n 25,\n 22,\n 24,\n 25,\n 24,\n 25,\n 24,\n 25,\n 25,\n 24,\n 25,\n 25,\n 25,\n 25,\n 22,\n 25,\n 25,\n 25,\n 24,\n 25,\n 24,\n 25,\n 18\n];\n"],"file":"blur-tables.js"} \ No newline at end of file +{"version":3,"file":"blur-tables.js","names":["mulTable","shgTable"],"sources":["../src/blur-tables.js"],"sourcesContent":["export const mulTable = [\n 1, 57, 41, 21, 203, 34, 97, 73, 227, 91, 149, 62, 105, 45, 39, 137, 241, 107,\n 3, 173, 39, 71, 65, 238, 219, 101, 187, 87, 81, 151, 141, 133, 249, 117, 221,\n 209, 197, 187, 177, 169, 5, 153, 73, 139, 133, 127, 243, 233, 223, 107, 103,\n 99, 191, 23, 177, 171, 165, 159, 77, 149, 9, 139, 135, 131, 253, 245, 119,\n 231, 224, 109, 211, 103, 25, 195, 189, 23, 45, 175, 171, 83, 81, 79, 155, 151,\n 147, 9, 141, 137, 67, 131, 129, 251, 123, 30, 235, 115, 113, 221, 217, 53, 13,\n 51, 50, 49, 193, 189, 185, 91, 179, 175, 43, 169, 83, 163, 5, 79, 155, 19, 75,\n 147, 145, 143, 35, 69, 17, 67, 33, 65, 255, 251, 247, 243, 239, 59, 29, 229,\n 113, 111, 219, 27, 213, 105, 207, 51, 201, 199, 49, 193, 191, 47, 93, 183,\n 181, 179, 11, 87, 43, 85, 167, 165, 163, 161, 159, 157, 155, 77, 19, 75, 37,\n 73, 145, 143, 141, 35, 138, 137, 135, 67, 33, 131, 129, 255, 63, 250, 247, 61,\n 121, 239, 237, 117, 29, 229, 227, 225, 111, 55, 109, 216, 213, 211, 209, 207,\n 205, 203, 201, 199, 197, 195, 193, 48, 190, 47, 93, 185, 183, 181, 179, 178,\n 176, 175, 173, 171, 85, 21, 167, 165, 41, 163, 161, 5, 79, 157, 78, 154, 153,\n 19, 75, 149, 74, 147, 73, 144, 143, 71, 141, 140, 139, 137, 17, 135, 134, 133,\n 66, 131, 65, 129, 1,\n];\n\nexport const shgTable = [\n 0, 9, 10, 10, 14, 12, 14, 14, 16, 15, 16, 15, 16, 15, 15, 17, 18, 17, 12, 18,\n 16, 17, 17, 19, 19, 18, 19, 18, 18, 19, 19, 19, 20, 19, 20, 20, 20, 20, 20,\n 20, 15, 20, 19, 20, 20, 20, 21, 21, 21, 20, 20, 20, 21, 18, 21, 21, 21, 21,\n 20, 21, 17, 21, 21, 21, 22, 22, 21, 22, 22, 21, 22, 21, 19, 22, 22, 19, 20,\n 22, 22, 21, 21, 21, 22, 22, 22, 18, 22, 22, 21, 22, 22, 23, 22, 20, 23, 22,\n 22, 23, 23, 21, 19, 21, 21, 21, 23, 23, 23, 22, 23, 23, 21, 23, 22, 23, 18,\n 22, 23, 20, 22, 23, 23, 23, 21, 22, 20, 22, 21, 22, 24, 24, 24, 24, 24, 22,\n 21, 24, 23, 23, 24, 21, 24, 23, 24, 22, 24, 24, 22, 24, 24, 22, 23, 24, 24,\n 24, 20, 23, 22, 23, 24, 24, 24, 24, 24, 24, 24, 23, 21, 23, 22, 23, 24, 24,\n 24, 22, 24, 24, 24, 23, 22, 24, 24, 25, 23, 25, 25, 23, 24, 25, 25, 24, 22,\n 25, 25, 25, 24, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 23,\n 25, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 22, 25, 25, 23, 25, 25,\n 20, 24, 25, 24, 25, 25, 22, 24, 25, 24, 25, 24, 25, 25, 24, 25, 25, 25, 25,\n 22, 25, 25, 25, 24, 25, 24, 25, 18,\n];\n"],"mappings":";;;;;;AAAO,MAAMA,QAAQ,GAAG,CACtB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAC5E,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAA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AAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAC1E,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAC1E,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAC1E,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAC1E,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CACnC;AAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blur/dist/index.js b/project starter code/node_modules/@jimp/plugin-blur/dist/index.js index e522832f..e61d5ac7 100644 --- a/project starter code/node_modules/@jimp/plugin-blur/dist/index.js +++ b/project starter code/node_modules/@jimp/plugin-blur/dist/index.js @@ -3,12 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - +exports.default = void 0; var _utils = require("@jimp/utils"); - var _blurTables = require("./blur-tables"); - /* Superfast Blur (0.5) http://www.quasimondo.com/BoxBlurForCanvas/FastBlur.js @@ -36,147 +33,130 @@ var _blurTables = require("./blur-tables"); FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -var _default = function _default() { - return { - /** - * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker - * @param {number} r the pixel radius of the blur - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - blur: function blur(r, cb) { - if (typeof r !== 'number') return _utils.throwError.call(this, 'r must be a number', cb); - if (r < 1) return _utils.throwError.call(this, 'r must be greater than 0', cb); - var rsum; - var gsum; - var bsum; - var asum; - var x; - var y; - var i; - var p; - var p1; - var p2; - var yp; - var yi; - var yw; - var pa; - var wm = this.bitmap.width - 1; - var hm = this.bitmap.height - 1; // const wh = this.bitmap.width * this.bitmap.height; - - var rad1 = r + 1; - var mulSum = _blurTables.mulTable[r]; - var shgSum = _blurTables.shgTable[r]; - var red = []; - var green = []; - var blue = []; - var alpha = []; - var vmin = []; - var vmax = []; - var iterations = 2; - - while (iterations-- > 0) { - yi = 0; - yw = 0; - - for (y = 0; y < this.bitmap.height; y++) { - rsum = this.bitmap.data[yw] * rad1; - gsum = this.bitmap.data[yw + 1] * rad1; - bsum = this.bitmap.data[yw + 2] * rad1; - asum = this.bitmap.data[yw + 3] * rad1; - - for (i = 1; i <= r; i++) { - p = yw + ((i > wm ? wm : i) << 2); - rsum += this.bitmap.data[p++]; - gsum += this.bitmap.data[p++]; - bsum += this.bitmap.data[p++]; - asum += this.bitmap.data[p]; - } - - for (x = 0; x < this.bitmap.width; x++) { - red[yi] = rsum; - green[yi] = gsum; - blue[yi] = bsum; - alpha[yi] = asum; - - if (y === 0) { - vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2; - vmax[x] = (p = x - r) > 0 ? p << 2 : 0; - } - - p1 = yw + vmin[x]; - p2 = yw + vmax[x]; - rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; - gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; - bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; - asum += this.bitmap.data[p1] - this.bitmap.data[p2]; - yi++; - } - - yw += this.bitmap.width << 2; +var _default = () => ({ + /** + * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker + * @param {number} r the pixel radius of the blur + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + blur(r, cb) { + if (typeof r !== "number") return _utils.throwError.call(this, "r must be a number", cb); + if (r < 1) return _utils.throwError.call(this, "r must be greater than 0", cb); + let rsum; + let gsum; + let bsum; + let asum; + let x; + let y; + let i; + let p; + let p1; + let p2; + let yp; + let yi; + let yw; + let pa; + const wm = this.bitmap.width - 1; + const hm = this.bitmap.height - 1; + // const wh = this.bitmap.width * this.bitmap.height; + const rad1 = r + 1; + const mulSum = _blurTables.mulTable[r]; + const shgSum = _blurTables.shgTable[r]; + const red = []; + const green = []; + const blue = []; + const alpha = []; + const vmin = []; + const vmax = []; + let iterations = 2; + while (iterations-- > 0) { + yi = 0; + yw = 0; + for (y = 0; y < this.bitmap.height; y++) { + rsum = this.bitmap.data[yw] * rad1; + gsum = this.bitmap.data[yw + 1] * rad1; + bsum = this.bitmap.data[yw + 2] * rad1; + asum = this.bitmap.data[yw + 3] * rad1; + for (i = 1; i <= r; i++) { + p = yw + ((i > wm ? wm : i) << 2); + rsum += this.bitmap.data[p++]; + gsum += this.bitmap.data[p++]; + bsum += this.bitmap.data[p++]; + asum += this.bitmap.data[p]; } - for (x = 0; x < this.bitmap.width; x++) { - yp = x; - rsum = red[yp] * rad1; - gsum = green[yp] * rad1; - bsum = blue[yp] * rad1; - asum = alpha[yp] * rad1; - - for (i = 1; i <= r; i++) { - yp += i > hm ? 0 : this.bitmap.width; - rsum += red[yp]; - gsum += green[yp]; - bsum += blue[yp]; - asum += alpha[yp]; - } - - yi = x << 2; - - for (y = 0; y < this.bitmap.height; y++) { - pa = asum * mulSum >>> shgSum; - this.bitmap.data[yi + 3] = pa; // normalize alpha - - if (pa > 255) { - this.bitmap.data[yi + 3] = 255; - } - - if (pa > 0) { - pa = 255 / pa; - this.bitmap.data[yi] = (rsum * mulSum >>> shgSum) * pa; - this.bitmap.data[yi + 1] = (gsum * mulSum >>> shgSum) * pa; - this.bitmap.data[yi + 2] = (bsum * mulSum >>> shgSum) * pa; - } else { - this.bitmap.data[yi + 2] = 0; - this.bitmap.data[yi + 1] = 0; - this.bitmap.data[yi] = 0; - } - - if (x === 0) { - vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width; - vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0; - } - - p1 = x + vmin[y]; - p2 = x + vmax[y]; - rsum += red[p1] - red[p2]; - gsum += green[p1] - green[p2]; - bsum += blue[p1] - blue[p2]; - asum += alpha[p1] - alpha[p2]; - yi += this.bitmap.width << 2; + red[yi] = rsum; + green[yi] = gsum; + blue[yi] = bsum; + alpha[yi] = asum; + if (y === 0) { + vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2; + vmax[x] = (p = x - r) > 0 ? p << 2 : 0; } + p1 = yw + vmin[x]; + p2 = yw + vmax[x]; + rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; + gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; + bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; + asum += this.bitmap.data[p1] - this.bitmap.data[p2]; + yi++; } + yw += this.bitmap.width << 2; } + for (x = 0; x < this.bitmap.width; x++) { + yp = x; + rsum = red[yp] * rad1; + gsum = green[yp] * rad1; + bsum = blue[yp] * rad1; + asum = alpha[yp] * rad1; + for (i = 1; i <= r; i++) { + yp += i > hm ? 0 : this.bitmap.width; + rsum += red[yp]; + gsum += green[yp]; + bsum += blue[yp]; + asum += alpha[yp]; + } + yi = x << 2; + for (y = 0; y < this.bitmap.height; y++) { + pa = asum * mulSum >>> shgSum; + this.bitmap.data[yi + 3] = pa; - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); + // normalize alpha + if (pa > 255) { + this.bitmap.data[yi + 3] = 255; + } + if (pa > 0) { + pa = 255 / pa; + this.bitmap.data[yi] = (rsum * mulSum >>> shgSum) * pa; + this.bitmap.data[yi + 1] = (gsum * mulSum >>> shgSum) * pa; + this.bitmap.data[yi + 2] = (bsum * mulSum >>> shgSum) * pa; + } else { + this.bitmap.data[yi + 2] = 0; + this.bitmap.data[yi + 1] = 0; + this.bitmap.data[yi] = 0; + } + if (x === 0) { + vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width; + vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0; + } + p1 = x + vmin[y]; + p2 = x + vmax[y]; + rsum += red[p1] - red[p2]; + gsum += green[p1] - green[p2]; + bsum += blue[p1] - blue[p2]; + asum += alpha[p1] - alpha[p2]; + yi += this.bitmap.width << 2; + } } - - return this; } - }; -}; - -exports["default"] = _default; + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + } +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blur/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-blur/dist/index.js.map index d1de6f15..7148f645 100644 --- a/project starter code/node_modules/@jimp/plugin-blur/dist/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-blur/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["blur","r","cb","throwError","call","rsum","gsum","bsum","asum","x","y","i","p","p1","p2","yp","yi","yw","pa","wm","bitmap","width","hm","height","rad1","mulSum","mulTable","shgSum","shgTable","red","green","blue","alpha","vmin","vmax","iterations","data"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;eA4Be;AAAA,SAAO;AACpB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AAUgB,GAAG,CAACf,EAAD,CAArB;AACAR,YAAAA,IAAI,IAAIwB,KAAK,CAACjB,EAAD,CAAL,GAAYiB,KAAK,CAAChB,EAAD,CAAzB;AACAP,YAAAA,IAAI,IAAIwB,IAAI,CAAClB,EAAD,CAAJ,GAAWkB,IAAI,CAACjB,EAAD,CAAvB;AACAN,YAAAA,IAAI,IAAIwB,KAAK,CAACnB,EAAD,CAAL,GAAYmB,KAAK,CAAClB,EAAD,CAAzB;AAEAE,YAAAA,EAAE,IAAI,KAAKI,MAAL,CAAYC,KAAZ,IAAqB,CAA3B;AACD;AACF;AACF;;AAED,UAAI,0BAAcnB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AApJmB,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from '@jimp/utils';\nimport { mulTable, shgTable } from './blur-tables';\n\n/*\n Superfast Blur (0.5)\n http://www.quasimondo.com/BoxBlurForCanvas/FastBlur.js\n\n Copyright (c) 2011 Mario Klingemann\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation\n files (the \"Software\"), to deal in the Software without\n restriction, including without limitation the rights to use,\n copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the\n Software is furnished to do so, subject to the following\n conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nexport default () => ({\n /**\n * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blur(r, cb) {\n if (typeof r !== 'number')\n return throwError.call(this, 'r must be a number', cb);\n if (r < 1) return throwError.call(this, 'r must be greater than 0', cb);\n\n let rsum;\n let gsum;\n let bsum;\n let asum;\n let x;\n let y;\n let i;\n let p;\n let p1;\n let p2;\n let yp;\n let yi;\n let yw;\n let pa;\n\n const wm = this.bitmap.width - 1;\n const hm = this.bitmap.height - 1;\n // const wh = this.bitmap.width * this.bitmap.height;\n const rad1 = r + 1;\n\n const mulSum = mulTable[r];\n const shgSum = shgTable[r];\n\n const red = [];\n const green = [];\n const blue = [];\n const alpha = [];\n\n const vmin = [];\n const vmax = [];\n\n let iterations = 2;\n\n while (iterations-- > 0) {\n yi = 0;\n yw = 0;\n\n for (y = 0; y < this.bitmap.height; y++) {\n rsum = this.bitmap.data[yw] * rad1;\n gsum = this.bitmap.data[yw + 1] * rad1;\n bsum = this.bitmap.data[yw + 2] * rad1;\n asum = this.bitmap.data[yw + 3] * rad1;\n\n for (i = 1; i <= r; i++) {\n p = yw + ((i > wm ? wm : i) << 2);\n rsum += this.bitmap.data[p++];\n gsum += this.bitmap.data[p++];\n bsum += this.bitmap.data[p++];\n asum += this.bitmap.data[p];\n }\n\n for (x = 0; x < this.bitmap.width; x++) {\n red[yi] = rsum;\n green[yi] = gsum;\n blue[yi] = bsum;\n alpha[yi] = asum;\n\n if (y === 0) {\n vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2;\n vmax[x] = (p = x - r) > 0 ? p << 2 : 0;\n }\n\n p1 = yw + vmin[x];\n p2 = yw + vmax[x];\n\n rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n asum += this.bitmap.data[p1] - this.bitmap.data[p2];\n\n yi++;\n }\n\n yw += this.bitmap.width << 2;\n }\n\n for (x = 0; x < this.bitmap.width; x++) {\n yp = x;\n rsum = red[yp] * rad1;\n gsum = green[yp] * rad1;\n bsum = blue[yp] * rad1;\n asum = alpha[yp] * rad1;\n\n for (i = 1; i <= r; i++) {\n yp += i > hm ? 0 : this.bitmap.width;\n rsum += red[yp];\n gsum += green[yp];\n bsum += blue[yp];\n asum += alpha[yp];\n }\n\n yi = x << 2;\n\n for (y = 0; y < this.bitmap.height; y++) {\n pa = (asum * mulSum) >>> shgSum;\n this.bitmap.data[yi + 3] = pa;\n\n // normalize alpha\n if (pa > 255) {\n this.bitmap.data[yi + 3] = 255;\n }\n\n if (pa > 0) {\n pa = 255 / pa;\n this.bitmap.data[yi] = ((rsum * mulSum) >>> shgSum) * pa;\n this.bitmap.data[yi + 1] = ((gsum * mulSum) >>> shgSum) * pa;\n this.bitmap.data[yi + 2] = ((bsum * mulSum) >>> shgSum) * pa;\n } else {\n this.bitmap.data[yi + 2] = 0;\n this.bitmap.data[yi + 1] = 0;\n this.bitmap.data[yi] = 0;\n }\n\n if (x === 0) {\n vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width;\n vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0;\n }\n\n p1 = x + vmin[y];\n p2 = x + vmax[y];\n\n rsum += red[p1] - red[p2];\n gsum += green[p1] - green[p2];\n bsum += blue[p1] - blue[p2];\n asum += alpha[p1] - alpha[p2];\n\n yi += this.bitmap.width << 2;\n }\n }\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["blur","r","cb","throwError","call","rsum","gsum","bsum","asum","x","y","i","p","p1","p2","yp","yi","yw","pa","wm","bitmap","width","hm","height","rad1","mulSum","mulTable","shgSum","shgTable","red","green","blue","alpha","vmin","vmax","iterations","data","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import { throwError, isNodePattern } from \"@jimp/utils\";\nimport { mulTable, shgTable } from \"./blur-tables\";\n\n/*\n Superfast Blur (0.5)\n http://www.quasimondo.com/BoxBlurForCanvas/FastBlur.js\n\n Copyright (c) 2011 Mario Klingemann\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation\n files (the \"Software\"), to deal in the Software without\n restriction, including without limitation the rights to use,\n copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the\n Software is furnished to do so, subject to the following\n conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nexport default () => ({\n /**\n * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blur(r, cb) {\n if (typeof r !== \"number\")\n return throwError.call(this, \"r must be a number\", cb);\n if (r < 1) return throwError.call(this, \"r must be greater than 0\", cb);\n\n let rsum;\n let gsum;\n let bsum;\n let asum;\n let x;\n let y;\n let i;\n let p;\n let p1;\n let p2;\n let yp;\n let yi;\n let yw;\n let pa;\n\n const wm = this.bitmap.width - 1;\n const hm = this.bitmap.height - 1;\n // const wh = this.bitmap.width * this.bitmap.height;\n const rad1 = r + 1;\n\n const mulSum = mulTable[r];\n const shgSum = shgTable[r];\n\n const red = [];\n const green = [];\n const blue = [];\n const alpha = [];\n\n const vmin = [];\n const vmax = [];\n\n let iterations = 2;\n\n while (iterations-- > 0) {\n yi = 0;\n yw = 0;\n\n for (y = 0; y < this.bitmap.height; y++) {\n rsum = this.bitmap.data[yw] * rad1;\n gsum = this.bitmap.data[yw + 1] * rad1;\n bsum = this.bitmap.data[yw + 2] * rad1;\n asum = this.bitmap.data[yw + 3] * rad1;\n\n for (i = 1; i <= r; i++) {\n p = yw + ((i > wm ? wm : i) << 2);\n rsum += this.bitmap.data[p++];\n gsum += this.bitmap.data[p++];\n bsum += this.bitmap.data[p++];\n asum += this.bitmap.data[p];\n }\n\n for (x = 0; x < this.bitmap.width; x++) {\n red[yi] = rsum;\n green[yi] = gsum;\n blue[yi] = bsum;\n alpha[yi] = asum;\n\n if (y === 0) {\n vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2;\n vmax[x] = (p = x - r) > 0 ? p << 2 : 0;\n }\n\n p1 = yw + vmin[x];\n p2 = yw + vmax[x];\n\n rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n asum += this.bitmap.data[p1] - this.bitmap.data[p2];\n\n yi++;\n }\n\n yw += this.bitmap.width << 2;\n }\n\n for (x = 0; x < this.bitmap.width; x++) {\n yp = x;\n rsum = red[yp] * rad1;\n gsum = green[yp] * rad1;\n bsum = blue[yp] * rad1;\n asum = alpha[yp] * rad1;\n\n for (i = 1; i <= r; i++) {\n yp += i > hm ? 0 : this.bitmap.width;\n rsum += red[yp];\n gsum += green[yp];\n bsum += blue[yp];\n asum += alpha[yp];\n }\n\n yi = x << 2;\n\n for (y = 0; y < this.bitmap.height; y++) {\n pa = (asum * mulSum) >>> shgSum;\n this.bitmap.data[yi + 3] = pa;\n\n // normalize alpha\n if (pa > 255) {\n this.bitmap.data[yi + 3] = 255;\n }\n\n if (pa > 0) {\n pa = 255 / pa;\n this.bitmap.data[yi] = ((rsum * mulSum) >>> shgSum) * pa;\n this.bitmap.data[yi + 1] = ((gsum * mulSum) >>> shgSum) * pa;\n this.bitmap.data[yi + 2] = ((bsum * mulSum) >>> shgSum) * pa;\n } else {\n this.bitmap.data[yi + 2] = 0;\n this.bitmap.data[yi + 1] = 0;\n this.bitmap.data[yi] = 0;\n }\n\n if (x === 0) {\n vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width;\n vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0;\n }\n\n p1 = x + vmin[y];\n p2 = x + vmax[y];\n\n rsum += red[p1] - red[p2];\n gsum += green[p1] - green[p2];\n bsum += blue[p1] - blue[p2];\n asum += alpha[p1] - alpha[p2];\n\n yi += this.bitmap.width << 2;\n }\n }\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1BA,eA4Be,OAAO;EACpB;AACF;AACA;AACA;AACA;AACA;EACEA,IAAI,CAACC,CAAC,EAAEC,EAAE,EAAE;IACV,IAAI,OAAOD,CAAC,KAAK,QAAQ,EACvB,OAAOE,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,oBAAoB,EAAEF,EAAE,CAAC;IACxD,IAAID,CAAC,GAAG,CAAC,EAAE,OAAOE,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,0BAA0B,EAAEF,EAAE,CAAC;IAEvE,IAAIG,IAAI;IACR,IAAIC,IAAI;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C;YAC5B,IAAI,CAACI,MAAM,CAACgB,IAAI,CAACpB,EAAE,CAAC,GAAG,CAAC;UAC1B;UAEA,IAAIP,CAAC,KAAK,CAAC,EAAE;YACXwB,IAAI,CAACvB,CAAC,CAAC,GAAG,CAAC,CAACE,CAAC,GAAGF,CAAC,GAAGc,IAAI,IAAIF,EAAE,GAAGV,CAAC,GAAGU,EAAE,IAAI,IAAI,CAACF,MAAM,CAACC,KAAK;YAC5Da,IAAI,CAACxB,CAAC,CAAC,GAAG,CAACE,CAAC,GAAGF,CAAC,GAAGT,CAAC,IAAI,CAAC,GAAGW,CAAC,GAAG,IAAI,CAACQ,MAAM,CAACC,KAAK,GAAG,CAAC;UACvD;UAEAR,EAAE,GAAGJ,CAAC,GAAGwB,IAAI,CAACvB,CAAC,CAAC;UAChBI,EAAE,GAAGL,CAAC,GAAGyB,IAAI,CAACxB,CAAC,CAAC;UAEhBL,IAAI,IAAIwB,GAAG,CAAChB,EAAE,CAAC,GAAGgB,GAAG,CAACf,EAAE,CAAC;UACzBR,IAAI,IAAIwB,KAAK,CAACjB,EAAE,CAAC,GAAGiB,KAAK,CAAChB,EAAE,CAAC;UAC7BP,IAAI,IAAIwB,IAAI,CAAClB,EAAE,CAAC,GAAGkB,IAAI,CAACjB,EAAE,CAAC;UAC3BN,IAAI,IAAIwB,KAAK,CAACnB,EAAE,CAAC,GAAGmB,KAAK,CAAClB,EAAE,CAAC;UAE7BE,EAAE,IAAI,IAAI,CAACI,MAAM,CAACC,KAAK,IAAI,CAAC;QAC9B;MACF;IACF;IAEA,IAAI,IAAAgB,oBAAa,EAACnC,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blur/es/blur-tables.js b/project starter code/node_modules/@jimp/plugin-blur/es/blur-tables.js index 6d31ea19..9b9b9f21 100644 --- a/project starter code/node_modules/@jimp/plugin-blur/es/blur-tables.js +++ b/project starter code/node_modules/@jimp/plugin-blur/es/blur-tables.js @@ -1,11 +1,3 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.shgTable = exports.mulTable = void 0; -var mulTable = [1, 57, 41, 21, 203, 34, 97, 73, 227, 91, 149, 62, 105, 45, 39, 137, 241, 107, 3, 173, 39, 71, 65, 238, 219, 101, 187, 87, 81, 151, 141, 133, 249, 117, 221, 209, 197, 187, 177, 169, 5, 153, 73, 139, 133, 127, 243, 233, 223, 107, 103, 99, 191, 23, 177, 171, 165, 159, 77, 149, 9, 139, 135, 131, 253, 245, 119, 231, 224, 109, 211, 103, 25, 195, 189, 23, 45, 175, 171, 83, 81, 79, 155, 151, 147, 9, 141, 137, 67, 131, 129, 251, 123, 30, 235, 115, 113, 221, 217, 53, 13, 51, 50, 49, 193, 189, 185, 91, 179, 175, 43, 169, 83, 163, 5, 79, 155, 19, 75, 147, 145, 143, 35, 69, 17, 67, 33, 65, 255, 251, 247, 243, 239, 59, 29, 229, 113, 111, 219, 27, 213, 105, 207, 51, 201, 199, 49, 193, 191, 47, 93, 183, 181, 179, 11, 87, 43, 85, 167, 165, 163, 161, 159, 157, 155, 77, 19, 75, 37, 73, 145, 143, 141, 35, 138, 137, 135, 67, 33, 131, 129, 255, 63, 250, 247, 61, 121, 239, 237, 117, 29, 229, 227, 225, 111, 55, 109, 216, 213, 211, 209, 207, 205, 203, 201, 199, 197, 195, 193, 48, 190, 47, 93, 185, 183, 181, 179, 178, 176, 175, 173, 171, 85, 21, 167, 165, 41, 163, 161, 5, 79, 157, 78, 154, 153, 19, 75, 149, 74, 147, 73, 144, 143, 71, 141, 140, 139, 137, 17, 135, 134, 133, 66, 131, 65, 129, 1]; -exports.mulTable = mulTable; -var shgTable = [0, 9, 10, 10, 14, 12, 14, 14, 16, 15, 16, 15, 16, 15, 15, 17, 18, 17, 12, 18, 16, 17, 17, 19, 19, 18, 19, 18, 18, 19, 19, 19, 20, 19, 20, 20, 20, 20, 20, 20, 15, 20, 19, 20, 20, 20, 21, 21, 21, 20, 20, 20, 21, 18, 21, 21, 21, 21, 20, 21, 17, 21, 21, 21, 22, 22, 21, 22, 22, 21, 22, 21, 19, 22, 22, 19, 20, 22, 22, 21, 21, 21, 22, 22, 22, 18, 22, 22, 21, 22, 22, 23, 22, 20, 23, 22, 22, 23, 23, 21, 19, 21, 21, 21, 23, 23, 23, 22, 23, 23, 21, 23, 22, 23, 18, 22, 23, 20, 22, 23, 23, 23, 21, 22, 20, 22, 21, 22, 24, 24, 24, 24, 24, 22, 21, 24, 23, 23, 24, 21, 24, 23, 24, 22, 24, 24, 22, 24, 24, 22, 23, 24, 24, 24, 20, 23, 22, 23, 24, 24, 24, 24, 24, 24, 24, 23, 21, 23, 22, 23, 24, 24, 24, 22, 24, 24, 24, 23, 22, 24, 24, 25, 23, 25, 25, 23, 24, 25, 25, 24, 22, 25, 25, 25, 24, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 23, 25, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 22, 25, 25, 23, 25, 25, 20, 24, 25, 24, 25, 25, 22, 24, 25, 24, 25, 24, 25, 25, 24, 25, 25, 25, 25, 22, 25, 25, 25, 24, 25, 24, 25, 18]; -exports.shgTable = shgTable; +export const mulTable = [1, 57, 41, 21, 203, 34, 97, 73, 227, 91, 149, 62, 105, 45, 39, 137, 241, 107, 3, 173, 39, 71, 65, 238, 219, 101, 187, 87, 81, 151, 141, 133, 249, 117, 221, 209, 197, 187, 177, 169, 5, 153, 73, 139, 133, 127, 243, 233, 223, 107, 103, 99, 191, 23, 177, 171, 165, 159, 77, 149, 9, 139, 135, 131, 253, 245, 119, 231, 224, 109, 211, 103, 25, 195, 189, 23, 45, 175, 171, 83, 81, 79, 155, 151, 147, 9, 141, 137, 67, 131, 129, 251, 123, 30, 235, 115, 113, 221, 217, 53, 13, 51, 50, 49, 193, 189, 185, 91, 179, 175, 43, 169, 83, 163, 5, 79, 155, 19, 75, 147, 145, 143, 35, 69, 17, 67, 33, 65, 255, 251, 247, 243, 239, 59, 29, 229, 113, 111, 219, 27, 213, 105, 207, 51, 201, 199, 49, 193, 191, 47, 93, 183, 181, 179, 11, 87, 43, 85, 167, 165, 163, 161, 159, 157, 155, 77, 19, 75, 37, 73, 145, 143, 141, 35, 138, 137, 135, 67, 33, 131, 129, 255, 63, 250, 247, 61, 121, 239, 237, 117, 29, 229, 227, 225, 111, 55, 109, 216, 213, 211, 209, 207, 205, 203, 201, 199, 197, 195, 193, 48, 190, 47, 93, 185, 183, 181, 179, 178, 176, 175, 173, 171, 85, 21, 167, 165, 41, 163, 161, 5, 79, 157, 78, 154, 153, 19, 75, 149, 74, 147, 73, 144, 143, 71, 141, 140, 139, 137, 17, 135, 134, 133, 66, 131, 65, 129, 1]; +export const shgTable = [0, 9, 10, 10, 14, 12, 14, 14, 16, 15, 16, 15, 16, 15, 15, 17, 18, 17, 12, 18, 16, 17, 17, 19, 19, 18, 19, 18, 18, 19, 19, 19, 20, 19, 20, 20, 20, 20, 20, 20, 15, 20, 19, 20, 20, 20, 21, 21, 21, 20, 20, 20, 21, 18, 21, 21, 21, 21, 20, 21, 17, 21, 21, 21, 22, 22, 21, 22, 22, 21, 22, 21, 19, 22, 22, 19, 20, 22, 22, 21, 21, 21, 22, 22, 22, 18, 22, 22, 21, 22, 22, 23, 22, 20, 23, 22, 22, 23, 23, 21, 19, 21, 21, 21, 23, 23, 23, 22, 23, 23, 21, 23, 22, 23, 18, 22, 23, 20, 22, 23, 23, 23, 21, 22, 20, 22, 21, 22, 24, 24, 24, 24, 24, 22, 21, 24, 23, 23, 24, 21, 24, 23, 24, 22, 24, 24, 22, 24, 24, 22, 23, 24, 24, 24, 20, 23, 22, 23, 24, 24, 24, 24, 24, 24, 24, 23, 21, 23, 22, 23, 24, 24, 24, 22, 24, 24, 24, 23, 22, 24, 24, 25, 23, 25, 25, 23, 24, 25, 25, 24, 22, 25, 25, 25, 24, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 23, 25, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 22, 25, 25, 23, 25, 25, 20, 24, 25, 24, 25, 25, 22, 24, 25, 24, 25, 24, 25, 25, 24, 25, 25, 25, 25, 22, 25, 25, 25, 24, 25, 24, 25, 18]; //# sourceMappingURL=blur-tables.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blur/es/blur-tables.js.map b/project starter code/node_modules/@jimp/plugin-blur/es/blur-tables.js.map index 629f0a0f..38dcb085 100644 --- a/project starter code/node_modules/@jimp/plugin-blur/es/blur-tables.js.map +++ b/project starter code/node_modules/@jimp/plugin-blur/es/blur-tables.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/blur-tables.js"],"names":["mulTable","shgTable"],"mappings":";;;;;;AAAO,IAAMA,QAAQ,GAAG,CACtB,CADsB,EAEtB,EAFsB,EAGtB,EAHsB,EAItB,EAJsB,EAKtB,GALsB,EAMtB,EANsB,EAOtB,EAPsB,EAQtB,EARsB,EAStB,GATsB,EAUtB,EAVsB,EAWtB,GAXsB,EAYtB,EAZsB,EAatB,GAbsB,EActB,EAdsB,EAetB,EAfsB,EAgBtB,GAhBsB,EAiBtB,GAjBsB,EAkBtB,GAlBsB,EAmBtB,CAnBsB,EAoBtB,GApBsB,EAqBtB,EArBsB,EAsBtB,EAtBsB,EAuBtB,EAvBsB,EAwBtB,GAxBsB,EAyBtB,GAzBsB,EA0BtB,GA1BsB,EA2BtB,GA3BsB,EA4BtB,EA5BsB,EA6BtB,EA7BsB,EA8BtB,GA9BsB,EA+BtB,GA/BsB,EAgCtB,GAhCsB,EAiCtB,GAjCsB,EAkCtB,GAlCsB,EAmCtB,GAnCsB,EAoCtB,GApCsB,EAqCtB,GArCsB,EAsCtB,GAtCsB,EAuCtB,GAvCsB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sB,EAoOtB,EApOsB,EAqOtB,EArOsB,EAsOtB,EAtOsB,EAuOtB,EAvOsB,EAwOtB,EAxOsB,EAyOtB,EAzOsB,EA0OtB,EA1OsB,EA2OtB,EA3OsB,EA4OtB,EA5OsB,EA6OtB,EA7OsB,EA8OtB,EA9OsB,EA+OtB,EA/OsB,EAgPtB,EAhPsB,EAiPtB,EAjPsB,EAkPtB,EAlPsB,EAmPtB,EAnPsB,EAoPtB,EApPsB,EAqPtB,EArPsB,EAsPtB,EAtPsB,EAuPtB,EAvPsB,EAwPtB,EAxPsB,EAyPtB,EAzPsB,EA0PtB,EA1PsB,EA2PtB,EA3PsB,EA4PtB,EA5PsB,EA6PtB,EA7PsB,EA8PtB,EA9PsB,EA+PtB,EA/PsB,EAgQtB,EAhQsB,EAiQtB,EAjQsB,CAAjB","sourcesContent":["export const mulTable = [\n 1,\n 57,\n 41,\n 21,\n 203,\n 34,\n 97,\n 73,\n 227,\n 91,\n 149,\n 62,\n 105,\n 45,\n 39,\n 137,\n 241,\n 107,\n 3,\n 173,\n 39,\n 71,\n 65,\n 238,\n 219,\n 101,\n 187,\n 87,\n 81,\n 151,\n 141,\n 133,\n 249,\n 117,\n 221,\n 209,\n 197,\n 187,\n 177,\n 169,\n 5,\n 153,\n 73,\n 139,\n 133,\n 127,\n 243,\n 233,\n 223,\n 107,\n 103,\n 99,\n 191,\n 23,\n 177,\n 171,\n 165,\n 159,\n 77,\n 149,\n 9,\n 139,\n 135,\n 131,\n 253,\n 245,\n 119,\n 231,\n 224,\n 109,\n 211,\n 103,\n 25,\n 195,\n 189,\n 23,\n 45,\n 175,\n 171,\n 83,\n 81,\n 79,\n 155,\n 151,\n 147,\n 9,\n 141,\n 137,\n 67,\n 131,\n 129,\n 251,\n 123,\n 30,\n 235,\n 115,\n 113,\n 221,\n 217,\n 53,\n 13,\n 51,\n 50,\n 49,\n 193,\n 189,\n 185,\n 91,\n 179,\n 175,\n 43,\n 169,\n 83,\n 163,\n 5,\n 79,\n 155,\n 19,\n 75,\n 147,\n 145,\n 143,\n 35,\n 69,\n 17,\n 67,\n 33,\n 65,\n 255,\n 251,\n 247,\n 243,\n 239,\n 59,\n 29,\n 229,\n 113,\n 111,\n 219,\n 27,\n 213,\n 105,\n 207,\n 51,\n 201,\n 199,\n 49,\n 193,\n 191,\n 47,\n 93,\n 183,\n 181,\n 179,\n 11,\n 87,\n 43,\n 85,\n 167,\n 165,\n 163,\n 161,\n 159,\n 157,\n 155,\n 77,\n 19,\n 75,\n 37,\n 73,\n 145,\n 143,\n 141,\n 35,\n 138,\n 137,\n 135,\n 67,\n 33,\n 131,\n 129,\n 255,\n 63,\n 250,\n 247,\n 61,\n 121,\n 239,\n 237,\n 117,\n 29,\n 229,\n 227,\n 225,\n 111,\n 55,\n 109,\n 216,\n 213,\n 211,\n 209,\n 207,\n 205,\n 203,\n 201,\n 199,\n 197,\n 195,\n 193,\n 48,\n 190,\n 47,\n 93,\n 185,\n 183,\n 181,\n 179,\n 178,\n 176,\n 175,\n 173,\n 171,\n 85,\n 21,\n 167,\n 165,\n 41,\n 163,\n 161,\n 5,\n 79,\n 157,\n 78,\n 154,\n 153,\n 19,\n 75,\n 149,\n 74,\n 147,\n 73,\n 144,\n 143,\n 71,\n 141,\n 140,\n 139,\n 137,\n 17,\n 135,\n 134,\n 133,\n 66,\n 131,\n 65,\n 129,\n 1\n];\n\nexport const shgTable = [\n 0,\n 9,\n 10,\n 10,\n 14,\n 12,\n 14,\n 14,\n 16,\n 15,\n 16,\n 15,\n 16,\n 15,\n 15,\n 17,\n 18,\n 17,\n 12,\n 18,\n 16,\n 17,\n 17,\n 19,\n 19,\n 18,\n 19,\n 18,\n 18,\n 19,\n 19,\n 19,\n 20,\n 19,\n 20,\n 20,\n 20,\n 20,\n 20,\n 20,\n 15,\n 20,\n 19,\n 20,\n 20,\n 20,\n 21,\n 21,\n 21,\n 20,\n 20,\n 20,\n 21,\n 18,\n 21,\n 21,\n 21,\n 21,\n 20,\n 21,\n 17,\n 21,\n 21,\n 21,\n 22,\n 22,\n 21,\n 22,\n 22,\n 21,\n 22,\n 21,\n 19,\n 22,\n 22,\n 19,\n 20,\n 22,\n 22,\n 21,\n 21,\n 21,\n 22,\n 22,\n 22,\n 18,\n 22,\n 22,\n 21,\n 22,\n 22,\n 23,\n 22,\n 20,\n 23,\n 22,\n 22,\n 23,\n 23,\n 21,\n 19,\n 21,\n 21,\n 21,\n 23,\n 23,\n 23,\n 22,\n 23,\n 23,\n 21,\n 23,\n 22,\n 23,\n 18,\n 22,\n 23,\n 20,\n 22,\n 23,\n 23,\n 23,\n 21,\n 22,\n 20,\n 22,\n 21,\n 22,\n 24,\n 24,\n 24,\n 24,\n 24,\n 22,\n 21,\n 24,\n 23,\n 23,\n 24,\n 21,\n 24,\n 23,\n 24,\n 22,\n 24,\n 24,\n 22,\n 24,\n 24,\n 22,\n 23,\n 24,\n 24,\n 24,\n 20,\n 23,\n 22,\n 23,\n 24,\n 24,\n 24,\n 24,\n 24,\n 24,\n 24,\n 23,\n 21,\n 23,\n 22,\n 23,\n 24,\n 24,\n 24,\n 22,\n 24,\n 24,\n 24,\n 23,\n 22,\n 24,\n 24,\n 25,\n 23,\n 25,\n 25,\n 23,\n 24,\n 25,\n 25,\n 24,\n 22,\n 25,\n 25,\n 25,\n 24,\n 23,\n 24,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 23,\n 25,\n 23,\n 24,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 25,\n 24,\n 22,\n 25,\n 25,\n 23,\n 25,\n 25,\n 20,\n 24,\n 25,\n 24,\n 25,\n 25,\n 22,\n 24,\n 25,\n 24,\n 25,\n 24,\n 25,\n 25,\n 24,\n 25,\n 25,\n 25,\n 25,\n 22,\n 25,\n 25,\n 25,\n 24,\n 25,\n 24,\n 25,\n 18\n];\n"],"file":"blur-tables.js"} \ No newline at end of file +{"version":3,"file":"blur-tables.js","names":["mulTable","shgTable"],"sources":["../src/blur-tables.js"],"sourcesContent":["export const mulTable = [\n 1, 57, 41, 21, 203, 34, 97, 73, 227, 91, 149, 62, 105, 45, 39, 137, 241, 107,\n 3, 173, 39, 71, 65, 238, 219, 101, 187, 87, 81, 151, 141, 133, 249, 117, 221,\n 209, 197, 187, 177, 169, 5, 153, 73, 139, 133, 127, 243, 233, 223, 107, 103,\n 99, 191, 23, 177, 171, 165, 159, 77, 149, 9, 139, 135, 131, 253, 245, 119,\n 231, 224, 109, 211, 103, 25, 195, 189, 23, 45, 175, 171, 83, 81, 79, 155, 151,\n 147, 9, 141, 137, 67, 131, 129, 251, 123, 30, 235, 115, 113, 221, 217, 53, 13,\n 51, 50, 49, 193, 189, 185, 91, 179, 175, 43, 169, 83, 163, 5, 79, 155, 19, 75,\n 147, 145, 143, 35, 69, 17, 67, 33, 65, 255, 251, 247, 243, 239, 59, 29, 229,\n 113, 111, 219, 27, 213, 105, 207, 51, 201, 199, 49, 193, 191, 47, 93, 183,\n 181, 179, 11, 87, 43, 85, 167, 165, 163, 161, 159, 157, 155, 77, 19, 75, 37,\n 73, 145, 143, 141, 35, 138, 137, 135, 67, 33, 131, 129, 255, 63, 250, 247, 61,\n 121, 239, 237, 117, 29, 229, 227, 225, 111, 55, 109, 216, 213, 211, 209, 207,\n 205, 203, 201, 199, 197, 195, 193, 48, 190, 47, 93, 185, 183, 181, 179, 178,\n 176, 175, 173, 171, 85, 21, 167, 165, 41, 163, 161, 5, 79, 157, 78, 154, 153,\n 19, 75, 149, 74, 147, 73, 144, 143, 71, 141, 140, 139, 137, 17, 135, 134, 133,\n 66, 131, 65, 129, 1,\n];\n\nexport const shgTable = [\n 0, 9, 10, 10, 14, 12, 14, 14, 16, 15, 16, 15, 16, 15, 15, 17, 18, 17, 12, 18,\n 16, 17, 17, 19, 19, 18, 19, 18, 18, 19, 19, 19, 20, 19, 20, 20, 20, 20, 20,\n 20, 15, 20, 19, 20, 20, 20, 21, 21, 21, 20, 20, 20, 21, 18, 21, 21, 21, 21,\n 20, 21, 17, 21, 21, 21, 22, 22, 21, 22, 22, 21, 22, 21, 19, 22, 22, 19, 20,\n 22, 22, 21, 21, 21, 22, 22, 22, 18, 22, 22, 21, 22, 22, 23, 22, 20, 23, 22,\n 22, 23, 23, 21, 19, 21, 21, 21, 23, 23, 23, 22, 23, 23, 21, 23, 22, 23, 18,\n 22, 23, 20, 22, 23, 23, 23, 21, 22, 20, 22, 21, 22, 24, 24, 24, 24, 24, 22,\n 21, 24, 23, 23, 24, 21, 24, 23, 24, 22, 24, 24, 22, 24, 24, 22, 23, 24, 24,\n 24, 20, 23, 22, 23, 24, 24, 24, 24, 24, 24, 24, 23, 21, 23, 22, 23, 24, 24,\n 24, 22, 24, 24, 24, 23, 22, 24, 24, 25, 23, 25, 25, 23, 24, 25, 25, 24, 22,\n 25, 25, 25, 24, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 23,\n 25, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 22, 25, 25, 23, 25, 25,\n 20, 24, 25, 24, 25, 25, 22, 24, 25, 24, 25, 24, 25, 25, 24, 25, 25, 25, 25,\n 22, 25, 25, 25, 24, 25, 24, 25, 18,\n];\n"],"mappings":"AAAA,OAAO,MAAMA,QAAQ,GAAG,CACtB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAC5E,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,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,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAC1E,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAC1E,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAC1E,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAC1E,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CACnC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blur/es/index.js b/project starter code/node_modules/@jimp/plugin-blur/es/index.js index 253aec80..2e198ecd 100644 --- a/project starter code/node_modules/@jimp/plugin-blur/es/index.js +++ b/project starter code/node_modules/@jimp/plugin-blur/es/index.js @@ -1,13 +1,5 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -var _blurTables = require("./blur-tables"); +import { throwError, isNodePattern } from "@jimp/utils"; +import { mulTable, shgTable } from "./blur-tables"; /* Superfast Blur (0.5) @@ -36,146 +28,128 @@ var _blurTables = require("./blur-tables"); FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -var _default = function _default() { - return { - /** - * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker - * @param {number} r the pixel radius of the blur - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - blur: function blur(r, cb) { - if (typeof r !== 'number') return _utils.throwError.call(this, 'r must be a number', cb); - if (r < 1) return _utils.throwError.call(this, 'r must be greater than 0', cb); - var rsum; - var gsum; - var bsum; - var asum; - var x; - var y; - var i; - var p; - var p1; - var p2; - var yp; - var yi; - var yw; - var pa; - var wm = this.bitmap.width - 1; - var hm = this.bitmap.height - 1; // const wh = this.bitmap.width * this.bitmap.height; - - var rad1 = r + 1; - var mulSum = _blurTables.mulTable[r]; - var shgSum = _blurTables.shgTable[r]; - var red = []; - var green = []; - var blue = []; - var alpha = []; - var vmin = []; - var vmax = []; - var iterations = 2; - - while (iterations-- > 0) { - yi = 0; - yw = 0; - - for (y = 0; y < this.bitmap.height; y++) { - rsum = this.bitmap.data[yw] * rad1; - gsum = this.bitmap.data[yw + 1] * rad1; - bsum = this.bitmap.data[yw + 2] * rad1; - asum = this.bitmap.data[yw + 3] * rad1; - - for (i = 1; i <= r; i++) { - p = yw + ((i > wm ? wm : i) << 2); - rsum += this.bitmap.data[p++]; - gsum += this.bitmap.data[p++]; - bsum += this.bitmap.data[p++]; - asum += this.bitmap.data[p]; - } - - for (x = 0; x < this.bitmap.width; x++) { - red[yi] = rsum; - green[yi] = gsum; - blue[yi] = bsum; - alpha[yi] = asum; - - if (y === 0) { - vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2; - vmax[x] = (p = x - r) > 0 ? p << 2 : 0; - } - - p1 = yw + vmin[x]; - p2 = yw + vmax[x]; - rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; - gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; - bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; - asum += this.bitmap.data[p1] - this.bitmap.data[p2]; - yi++; - } - yw += this.bitmap.width << 2; +export default (() => ({ + /** + * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker + * @param {number} r the pixel radius of the blur + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + blur(r, cb) { + if (typeof r !== "number") return throwError.call(this, "r must be a number", cb); + if (r < 1) return throwError.call(this, "r must be greater than 0", cb); + let rsum; + let gsum; + let bsum; + let asum; + let x; + let y; + let i; + let p; + let p1; + let p2; + let yp; + let yi; + let yw; + let pa; + const wm = this.bitmap.width - 1; + const hm = this.bitmap.height - 1; + // const wh = this.bitmap.width * this.bitmap.height; + const rad1 = r + 1; + const mulSum = mulTable[r]; + const shgSum = shgTable[r]; + const red = []; + const green = []; + const blue = []; + const alpha = []; + const vmin = []; + const vmax = []; + let iterations = 2; + while (iterations-- > 0) { + yi = 0; + yw = 0; + for (y = 0; y < this.bitmap.height; y++) { + rsum = this.bitmap.data[yw] * rad1; + gsum = this.bitmap.data[yw + 1] * rad1; + bsum = this.bitmap.data[yw + 2] * rad1; + asum = this.bitmap.data[yw + 3] * rad1; + for (i = 1; i <= r; i++) { + p = yw + ((i > wm ? wm : i) << 2); + rsum += this.bitmap.data[p++]; + gsum += this.bitmap.data[p++]; + bsum += this.bitmap.data[p++]; + asum += this.bitmap.data[p]; } - for (x = 0; x < this.bitmap.width; x++) { - yp = x; - rsum = red[yp] * rad1; - gsum = green[yp] * rad1; - bsum = blue[yp] * rad1; - asum = alpha[yp] * rad1; - - for (i = 1; i <= r; i++) { - yp += i > hm ? 0 : this.bitmap.width; - rsum += red[yp]; - gsum += green[yp]; - bsum += blue[yp]; - asum += alpha[yp]; - } - - yi = x << 2; - - for (y = 0; y < this.bitmap.height; y++) { - pa = asum * mulSum >>> shgSum; - this.bitmap.data[yi + 3] = pa; // normalize alpha - - if (pa > 255) { - this.bitmap.data[yi + 3] = 255; - } - - if (pa > 0) { - pa = 255 / pa; - this.bitmap.data[yi] = (rsum * mulSum >>> shgSum) * pa; - this.bitmap.data[yi + 1] = (gsum * mulSum >>> shgSum) * pa; - this.bitmap.data[yi + 2] = (bsum * mulSum >>> shgSum) * pa; - } else { - this.bitmap.data[yi + 2] = 0; - this.bitmap.data[yi + 1] = 0; - this.bitmap.data[yi] = 0; - } - - if (x === 0) { - vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width; - vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0; - } - - p1 = x + vmin[y]; - p2 = x + vmax[y]; - rsum += red[p1] - red[p2]; - gsum += green[p1] - green[p2]; - bsum += blue[p1] - blue[p2]; - asum += alpha[p1] - alpha[p2]; - yi += this.bitmap.width << 2; + red[yi] = rsum; + green[yi] = gsum; + blue[yi] = bsum; + alpha[yi] = asum; + if (y === 0) { + vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2; + vmax[x] = (p = x - r) > 0 ? p << 2 : 0; } + p1 = yw + vmin[x]; + p2 = yw + vmax[x]; + rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; + gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; + bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; + asum += this.bitmap.data[p1] - this.bitmap.data[p2]; + yi++; } + yw += this.bitmap.width << 2; } + for (x = 0; x < this.bitmap.width; x++) { + yp = x; + rsum = red[yp] * rad1; + gsum = green[yp] * rad1; + bsum = blue[yp] * rad1; + asum = alpha[yp] * rad1; + for (i = 1; i <= r; i++) { + yp += i > hm ? 0 : this.bitmap.width; + rsum += red[yp]; + gsum += green[yp]; + bsum += blue[yp]; + asum += alpha[yp]; + } + yi = x << 2; + for (y = 0; y < this.bitmap.height; y++) { + pa = asum * mulSum >>> shgSum; + this.bitmap.data[yi + 3] = pa; - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); + // normalize alpha + if (pa > 255) { + this.bitmap.data[yi + 3] = 255; + } + if (pa > 0) { + pa = 255 / pa; + this.bitmap.data[yi] = (rsum * mulSum >>> shgSum) * pa; + this.bitmap.data[yi + 1] = (gsum * mulSum >>> shgSum) * pa; + this.bitmap.data[yi + 2] = (bsum * mulSum >>> shgSum) * pa; + } else { + this.bitmap.data[yi + 2] = 0; + this.bitmap.data[yi + 1] = 0; + this.bitmap.data[yi] = 0; + } + if (x === 0) { + vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width; + vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0; + } + p1 = x + vmin[y]; + p2 = x + vmax[y]; + rsum += red[p1] - red[p2]; + gsum += green[p1] - green[p2]; + bsum += blue[p1] - blue[p2]; + asum += alpha[p1] - alpha[p2]; + yi += this.bitmap.width << 2; + } } - - return this; } - }; -}; - -exports["default"] = _default; + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + } +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blur/es/index.js.map b/project starter code/node_modules/@jimp/plugin-blur/es/index.js.map index d1de6f15..33a9a6aa 100644 --- a/project starter code/node_modules/@jimp/plugin-blur/es/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-blur/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["blur","r","cb","throwError","call","rsum","gsum","bsum","asum","x","y","i","p","p1","p2","yp","yi","yw","pa","wm","bitmap","width","hm","height","rad1","mulSum","mulTable","shgSum","shgTable","red","green","blue","alpha","vmin","vmax","iterations","data"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;eA4Be;AAAA,SAAO;AACpB;;;;;;AAMAA,IAAAA,IAPoB,gBAOfC,CAPe,EAOZC,EAPY,EAOR;AACV,UAAI,OAAOD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AAL,GAAYiB,KAAK,CAAChB,EAAD,CAAzB;AACAP,YAAAA,IAAI,IAAIwB,IAAI,CAAClB,EAAD,CAAJ,GAAWkB,IAAI,CAACjB,EAAD,CAAvB;AACAN,YAAAA,IAAI,IAAIwB,KAAK,CAACnB,EAAD,CAAL,GAAYmB,KAAK,CAAClB,EAAD,CAAzB;AAEAE,YAAAA,EAAE,IAAI,KAAKI,MAAL,CAAYC,KAAZ,IAAqB,CAA3B;AACD;AACF;AACF;;AAED,UAAI,0BAAcnB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AApJmB,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from '@jimp/utils';\nimport { mulTable, shgTable } from './blur-tables';\n\n/*\n Superfast Blur (0.5)\n http://www.quasimondo.com/BoxBlurForCanvas/FastBlur.js\n\n Copyright (c) 2011 Mario Klingemann\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation\n files (the \"Software\"), to deal in the Software without\n restriction, including without limitation the rights to use,\n copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the\n Software is furnished to do so, subject to the following\n conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nexport default () => ({\n /**\n * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blur(r, cb) {\n if (typeof r !== 'number')\n return throwError.call(this, 'r must be a number', cb);\n if (r < 1) return throwError.call(this, 'r must be greater than 0', cb);\n\n let rsum;\n let gsum;\n let bsum;\n let asum;\n let x;\n let y;\n let i;\n let p;\n let p1;\n let p2;\n let yp;\n let yi;\n let yw;\n let pa;\n\n const wm = this.bitmap.width - 1;\n const hm = this.bitmap.height - 1;\n // const wh = this.bitmap.width * this.bitmap.height;\n const rad1 = r + 1;\n\n const mulSum = mulTable[r];\n const shgSum = shgTable[r];\n\n const red = [];\n const green = [];\n const blue = [];\n const alpha = [];\n\n const vmin = [];\n const vmax = [];\n\n let iterations = 2;\n\n while (iterations-- > 0) {\n yi = 0;\n yw = 0;\n\n for (y = 0; y < this.bitmap.height; y++) {\n rsum = this.bitmap.data[yw] * rad1;\n gsum = this.bitmap.data[yw + 1] * rad1;\n bsum = this.bitmap.data[yw + 2] * rad1;\n asum = this.bitmap.data[yw + 3] * rad1;\n\n for (i = 1; i <= r; i++) {\n p = yw + ((i > wm ? wm : i) << 2);\n rsum += this.bitmap.data[p++];\n gsum += this.bitmap.data[p++];\n bsum += this.bitmap.data[p++];\n asum += this.bitmap.data[p];\n }\n\n for (x = 0; x < this.bitmap.width; x++) {\n red[yi] = rsum;\n green[yi] = gsum;\n blue[yi] = bsum;\n alpha[yi] = asum;\n\n if (y === 0) {\n vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2;\n vmax[x] = (p = x - r) > 0 ? p << 2 : 0;\n }\n\n p1 = yw + vmin[x];\n p2 = yw + vmax[x];\n\n rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n asum += this.bitmap.data[p1] - this.bitmap.data[p2];\n\n yi++;\n }\n\n yw += this.bitmap.width << 2;\n }\n\n for (x = 0; x < this.bitmap.width; x++) {\n yp = x;\n rsum = red[yp] * rad1;\n gsum = green[yp] * rad1;\n bsum = blue[yp] * rad1;\n asum = alpha[yp] * rad1;\n\n for (i = 1; i <= r; i++) {\n yp += i > hm ? 0 : this.bitmap.width;\n rsum += red[yp];\n gsum += green[yp];\n bsum += blue[yp];\n asum += alpha[yp];\n }\n\n yi = x << 2;\n\n for (y = 0; y < this.bitmap.height; y++) {\n pa = (asum * mulSum) >>> shgSum;\n this.bitmap.data[yi + 3] = pa;\n\n // normalize alpha\n if (pa > 255) {\n this.bitmap.data[yi + 3] = 255;\n }\n\n if (pa > 0) {\n pa = 255 / pa;\n this.bitmap.data[yi] = ((rsum * mulSum) >>> shgSum) * pa;\n this.bitmap.data[yi + 1] = ((gsum * mulSum) >>> shgSum) * pa;\n this.bitmap.data[yi + 2] = ((bsum * mulSum) >>> shgSum) * pa;\n } else {\n this.bitmap.data[yi + 2] = 0;\n this.bitmap.data[yi + 1] = 0;\n this.bitmap.data[yi] = 0;\n }\n\n if (x === 0) {\n vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width;\n vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0;\n }\n\n p1 = x + vmin[y];\n p2 = x + vmax[y];\n\n rsum += red[p1] - red[p2];\n gsum += green[p1] - green[p2];\n bsum += blue[p1] - blue[p2];\n asum += alpha[p1] - alpha[p2];\n\n yi += this.bitmap.width << 2;\n }\n }\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["throwError","isNodePattern","mulTable","shgTable","blur","r","cb","call","rsum","gsum","bsum","asum","x","y","i","p","p1","p2","yp","yi","yw","pa","wm","bitmap","width","hm","height","rad1","mulSum","shgSum","red","green","blue","alpha","vmin","vmax","iterations","data"],"sources":["../src/index.js"],"sourcesContent":["import { throwError, isNodePattern } from \"@jimp/utils\";\nimport { mulTable, shgTable } from \"./blur-tables\";\n\n/*\n Superfast Blur (0.5)\n http://www.quasimondo.com/BoxBlurForCanvas/FastBlur.js\n\n Copyright (c) 2011 Mario Klingemann\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation\n files (the \"Software\"), to deal in the Software without\n restriction, including without limitation the rights to use,\n copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the\n Software is furnished to do so, subject to the following\n conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nexport default () => ({\n /**\n * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blur(r, cb) {\n if (typeof r !== \"number\")\n return throwError.call(this, \"r must be a number\", cb);\n if (r < 1) return throwError.call(this, \"r must be greater than 0\", cb);\n\n let rsum;\n let gsum;\n let bsum;\n let asum;\n let x;\n let y;\n let i;\n let p;\n let p1;\n let p2;\n let yp;\n let yi;\n let yw;\n let pa;\n\n const wm = this.bitmap.width - 1;\n const hm = this.bitmap.height - 1;\n // const wh = this.bitmap.width * this.bitmap.height;\n const rad1 = r + 1;\n\n const mulSum = mulTable[r];\n const shgSum = shgTable[r];\n\n const red = [];\n const green = [];\n const blue = [];\n const alpha = [];\n\n const vmin = [];\n const vmax = [];\n\n let iterations = 2;\n\n while (iterations-- > 0) {\n yi = 0;\n yw = 0;\n\n for (y = 0; y < this.bitmap.height; y++) {\n rsum = this.bitmap.data[yw] * rad1;\n gsum = this.bitmap.data[yw + 1] * rad1;\n bsum = this.bitmap.data[yw + 2] * rad1;\n asum = this.bitmap.data[yw + 3] * rad1;\n\n for (i = 1; i <= r; i++) {\n p = yw + ((i > wm ? wm : i) << 2);\n rsum += this.bitmap.data[p++];\n gsum += this.bitmap.data[p++];\n bsum += this.bitmap.data[p++];\n asum += this.bitmap.data[p];\n }\n\n for (x = 0; x < this.bitmap.width; x++) {\n red[yi] = rsum;\n green[yi] = gsum;\n blue[yi] = bsum;\n alpha[yi] = asum;\n\n if (y === 0) {\n vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2;\n vmax[x] = (p = x - r) > 0 ? p << 2 : 0;\n }\n\n p1 = yw + vmin[x];\n p2 = yw + vmax[x];\n\n rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n asum += this.bitmap.data[p1] - this.bitmap.data[p2];\n\n yi++;\n }\n\n yw += this.bitmap.width << 2;\n }\n\n for (x = 0; x < this.bitmap.width; x++) {\n yp = x;\n rsum = red[yp] * rad1;\n gsum = green[yp] * rad1;\n bsum = blue[yp] * rad1;\n asum = alpha[yp] * rad1;\n\n for (i = 1; i <= r; i++) {\n yp += i > hm ? 0 : this.bitmap.width;\n rsum += red[yp];\n gsum += green[yp];\n bsum += blue[yp];\n asum += alpha[yp];\n }\n\n yi = x << 2;\n\n for (y = 0; y < this.bitmap.height; y++) {\n pa = (asum * mulSum) >>> shgSum;\n this.bitmap.data[yi + 3] = pa;\n\n // normalize alpha\n if (pa > 255) {\n this.bitmap.data[yi + 3] = 255;\n }\n\n if (pa > 0) {\n pa = 255 / pa;\n this.bitmap.data[yi] = ((rsum * mulSum) >>> shgSum) * pa;\n this.bitmap.data[yi + 1] = ((gsum * mulSum) >>> shgSum) * pa;\n this.bitmap.data[yi + 2] = ((bsum * mulSum) >>> shgSum) * pa;\n } else {\n this.bitmap.data[yi + 2] = 0;\n this.bitmap.data[yi + 1] = 0;\n this.bitmap.data[yi] = 0;\n }\n\n if (x === 0) {\n vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width;\n vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0;\n }\n\n p1 = x + vmin[y];\n p2 = x + vmax[y];\n\n rsum += red[p1] - red[p2];\n gsum += green[p1] - green[p2];\n bsum += blue[p1] - blue[p2];\n asum += alpha[p1] - alpha[p2];\n\n yi += this.bitmap.width << 2;\n }\n }\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,UAAU,EAAEC,aAAa,QAAQ,aAAa;AACvD,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,eAAe;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAe,OAAO;EACpB;AACF;AACA;AACA;AACA;AACA;EACEC,IAAI,CAACC,CAAC,EAAEC,EAAE,EAAE;IACV,IAAI,OAAOD,CAAC,KAAK,QAAQ,EACvB,OAAOL,UAAU,CAACO,IAAI,CAAC,IAAI,EAAE,oBAAoB,EAAED,EAAE,CAAC;IACxD,IAAID,CAAC,GAAG,CAAC,EAAE,OAAOL,UAAU,CAACO,IAAI,CAAC,IAAI,EAAE,0BAA0B,EAAED,EAAE,CAAC;IAEvE,IAAIE,IAAI;IACR,IAAIC,IAAI;IACR,IAA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AClB,EAAE,CAAC,GAAG,CAAC;UAC1B;UAEA,IAAIP,CAAC,KAAK,CAAC,EAAE;YACXsB,IAAI,CAACrB,CAAC,CAAC,GAAG,CAAC,CAACE,CAAC,GAAGF,CAAC,GAAGc,IAAI,IAAIF,EAAE,GAAGV,CAAC,GAAGU,EAAE,IAAI,IAAI,CAACF,MAAM,CAACC,KAAK;YAC5DW,IAAI,CAACtB,CAAC,CAAC,GAAG,CAACE,CAAC,GAAGF,CAAC,GAAGR,CAAC,IAAI,CAAC,GAAGU,CAAC,GAAG,IAAI,CAACQ,MAAM,CAACC,KAAK,GAAG,CAAC;UACvD;UAEAR,EAAE,GAAGJ,CAAC,GAAGsB,IAAI,CAACrB,CAAC,CAAC;UAChBI,EAAE,GAAGL,CAAC,GAAGuB,IAAI,CAACtB,CAAC,CAAC;UAEhBL,IAAI,IAAIsB,GAAG,CAACd,EAAE,CAAC,GAAGc,GAAG,CAACb,EAAE,CAAC;UACzBR,IAAI,IAAIsB,KAAK,CAACf,EAAE,CAAC,GAAGe,KAAK,CAACd,EAAE,CAAC;UAC7BP,IAAI,IAAIsB,IAAI,CAAChB,EAAE,CAAC,GAAGgB,IAAI,CAACf,EAAE,CAAC;UAC3BN,IAAI,IAAIsB,KAAK,CAACjB,EAAE,CAAC,GAAGiB,KAAK,CAAChB,EAAE,CAAC;UAE7BE,EAAE,IAAI,IAAI,CAACI,MAAM,CAACC,KAAK,IAAI,CAAC;QAC9B;MACF;IACF;IAEA,IAAIvB,aAAa,CAACK,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-blur/index.d.ts b/project starter code/node_modules/@jimp/plugin-blur/index.d.ts index f2c1a84e..8e325774 100644 --- a/project starter code/node_modules/@jimp/plugin-blur/index.d.ts +++ b/project starter code/node_modules/@jimp/plugin-blur/index.d.ts @@ -1,7 +1,7 @@ -import { ImageCallback } from '@jimp/core'; +import { ImageCallback } from "@jimp/core"; interface Blur { blur(r: number, cb?: ImageCallback): this; } -export default function(): Blur; +export default function (): Blur; diff --git a/project starter code/node_modules/@jimp/plugin-blur/package.json b/project starter code/node_modules/@jimp/plugin-blur/package.json index c0b9190b..d8d9ce22 100644 --- a/project starter code/node_modules/@jimp/plugin-blur/package.json +++ b/project starter code/node_modules/@jimp/plugin-blur/package.json @@ -1,9 +1,10 @@ { "name": "@jimp/plugin-blur", - "version": "0.16.2", + "version": "0.22.12", "description": "blur an image.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { "build": "npm run build:node:production && npm run build:module", @@ -17,8 +18,7 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" @@ -26,5 +26,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/plugin-blur/src/blur-tables.js b/project starter code/node_modules/@jimp/plugin-blur/src/blur-tables.js index 39b3d9a3..b6300145 100644 --- a/project starter code/node_modules/@jimp/plugin-blur/src/blur-tables.js +++ b/project starter code/node_modules/@jimp/plugin-blur/src/blur-tables.js @@ -1,519 +1,35 @@ export const mulTable = [ - 1, - 57, - 41, - 21, - 203, - 34, - 97, - 73, - 227, - 91, - 149, - 62, - 105, - 45, - 39, - 137, - 241, - 107, - 3, - 173, - 39, - 71, - 65, - 238, - 219, - 101, - 187, - 87, - 81, - 151, - 141, - 133, - 249, - 117, - 221, - 209, - 197, - 187, - 177, - 169, - 5, - 153, - 73, - 139, - 133, - 127, - 243, - 233, - 223, - 107, - 103, - 99, - 191, - 23, - 177, - 171, - 165, - 159, - 77, - 149, - 9, - 139, - 135, - 131, - 253, - 245, - 119, - 231, - 224, - 109, - 211, - 103, - 25, - 195, - 189, - 23, - 45, - 175, - 171, - 83, - 81, - 79, - 155, - 151, - 147, - 9, - 141, - 137, - 67, - 131, - 129, - 251, - 123, - 30, - 235, - 115, - 113, - 221, - 217, - 53, - 13, - 51, - 50, - 49, - 193, - 189, - 185, - 91, - 179, - 175, - 43, - 169, - 83, - 163, - 5, - 79, - 155, - 19, - 75, - 147, - 145, - 143, - 35, - 69, - 17, - 67, - 33, - 65, - 255, - 251, - 247, - 243, - 239, - 59, - 29, - 229, - 113, - 111, - 219, - 27, - 213, - 105, - 207, - 51, - 201, - 199, - 49, - 193, - 191, - 47, - 93, - 183, - 181, - 179, - 11, - 87, - 43, - 85, - 167, - 165, - 163, - 161, - 159, - 157, - 155, - 77, - 19, - 75, - 37, - 73, - 145, - 143, - 141, - 35, - 138, - 137, - 135, - 67, - 33, - 131, - 129, - 255, - 63, - 250, - 247, - 61, - 121, - 239, - 237, - 117, - 29, - 229, - 227, - 225, - 111, - 55, - 109, - 216, - 213, - 211, - 209, - 207, - 205, - 203, - 201, - 199, - 197, - 195, - 193, - 48, - 190, - 47, - 93, - 185, - 183, - 181, - 179, - 178, - 176, - 175, - 173, - 171, - 85, - 21, - 167, - 165, - 41, - 163, - 161, - 5, - 79, - 157, - 78, - 154, - 153, - 19, - 75, - 149, - 74, - 147, - 73, - 144, - 143, - 71, - 141, - 140, - 139, - 137, - 17, - 135, - 134, - 133, - 66, - 131, - 65, - 129, - 1 + 1, 57, 41, 21, 203, 34, 97, 73, 227, 91, 149, 62, 105, 45, 39, 137, 241, 107, + 3, 173, 39, 71, 65, 238, 219, 101, 187, 87, 81, 151, 141, 133, 249, 117, 221, + 209, 197, 187, 177, 169, 5, 153, 73, 139, 133, 127, 243, 233, 223, 107, 103, + 99, 191, 23, 177, 171, 165, 159, 77, 149, 9, 139, 135, 131, 253, 245, 119, + 231, 224, 109, 211, 103, 25, 195, 189, 23, 45, 175, 171, 83, 81, 79, 155, 151, + 147, 9, 141, 137, 67, 131, 129, 251, 123, 30, 235, 115, 113, 221, 217, 53, 13, + 51, 50, 49, 193, 189, 185, 91, 179, 175, 43, 169, 83, 163, 5, 79, 155, 19, 75, + 147, 145, 143, 35, 69, 17, 67, 33, 65, 255, 251, 247, 243, 239, 59, 29, 229, + 113, 111, 219, 27, 213, 105, 207, 51, 201, 199, 49, 193, 191, 47, 93, 183, + 181, 179, 11, 87, 43, 85, 167, 165, 163, 161, 159, 157, 155, 77, 19, 75, 37, + 73, 145, 143, 141, 35, 138, 137, 135, 67, 33, 131, 129, 255, 63, 250, 247, 61, + 121, 239, 237, 117, 29, 229, 227, 225, 111, 55, 109, 216, 213, 211, 209, 207, + 205, 203, 201, 199, 197, 195, 193, 48, 190, 47, 93, 185, 183, 181, 179, 178, + 176, 175, 173, 171, 85, 21, 167, 165, 41, 163, 161, 5, 79, 157, 78, 154, 153, + 19, 75, 149, 74, 147, 73, 144, 143, 71, 141, 140, 139, 137, 17, 135, 134, 133, + 66, 131, 65, 129, 1, ]; export const shgTable = [ - 0, - 9, - 10, - 10, - 14, - 12, - 14, - 14, - 16, - 15, - 16, - 15, - 16, - 15, - 15, - 17, - 18, - 17, - 12, - 18, - 16, - 17, - 17, - 19, - 19, - 18, - 19, - 18, - 18, - 19, - 19, - 19, - 20, - 19, - 20, - 20, - 20, - 20, - 20, - 20, - 15, - 20, - 19, - 20, - 20, - 20, - 21, - 21, - 21, - 20, - 20, - 20, - 21, - 18, - 21, - 21, - 21, - 21, - 20, - 21, - 17, - 21, - 21, - 21, - 22, - 22, - 21, - 22, - 22, - 21, - 22, - 21, - 19, - 22, - 22, - 19, - 20, - 22, - 22, - 21, - 21, - 21, - 22, - 22, - 22, - 18, - 22, - 22, - 21, - 22, - 22, - 23, - 22, - 20, - 23, - 22, - 22, - 23, - 23, - 21, - 19, - 21, - 21, - 21, - 23, - 23, - 23, - 22, - 23, - 23, - 21, - 23, - 22, - 23, - 18, - 22, - 23, - 20, - 22, - 23, - 23, - 23, - 21, - 22, - 20, - 22, - 21, - 22, - 24, - 24, - 24, - 24, - 24, - 22, - 21, - 24, - 23, - 23, - 24, - 21, - 24, - 23, - 24, - 22, - 24, - 24, - 22, - 24, - 24, - 22, - 23, - 24, - 24, - 24, - 20, - 23, - 22, - 23, - 24, - 24, - 24, - 24, - 24, - 24, - 24, - 23, - 21, - 23, - 22, - 23, - 24, - 24, - 24, - 22, - 24, - 24, - 24, - 23, - 22, - 24, - 24, - 25, - 23, - 25, - 25, - 23, - 24, - 25, - 25, - 24, - 22, - 25, - 25, - 25, - 24, - 23, - 24, - 25, - 25, - 25, - 25, - 25, - 25, - 25, - 25, - 25, - 25, - 25, - 25, - 23, - 25, - 23, - 24, - 25, - 25, - 25, - 25, - 25, - 25, - 25, - 25, - 25, - 24, - 22, - 25, - 25, - 23, - 25, - 25, - 20, - 24, - 25, - 24, - 25, - 25, - 22, - 24, - 25, - 24, - 25, - 24, - 25, - 25, - 24, - 25, - 25, - 25, - 25, - 22, - 25, - 25, - 25, - 24, - 25, - 24, - 25, - 18 + 0, 9, 10, 10, 14, 12, 14, 14, 16, 15, 16, 15, 16, 15, 15, 17, 18, 17, 12, 18, + 16, 17, 17, 19, 19, 18, 19, 18, 18, 19, 19, 19, 20, 19, 20, 20, 20, 20, 20, + 20, 15, 20, 19, 20, 20, 20, 21, 21, 21, 20, 20, 20, 21, 18, 21, 21, 21, 21, + 20, 21, 17, 21, 21, 21, 22, 22, 21, 22, 22, 21, 22, 21, 19, 22, 22, 19, 20, + 22, 22, 21, 21, 21, 22, 22, 22, 18, 22, 22, 21, 22, 22, 23, 22, 20, 23, 22, + 22, 23, 23, 21, 19, 21, 21, 21, 23, 23, 23, 22, 23, 23, 21, 23, 22, 23, 18, + 22, 23, 20, 22, 23, 23, 23, 21, 22, 20, 22, 21, 22, 24, 24, 24, 24, 24, 22, + 21, 24, 23, 23, 24, 21, 24, 23, 24, 22, 24, 24, 22, 24, 24, 22, 23, 24, 24, + 24, 20, 23, 22, 23, 24, 24, 24, 24, 24, 24, 24, 23, 21, 23, 22, 23, 24, 24, + 24, 22, 24, 24, 24, 23, 22, 24, 24, 25, 23, 25, 25, 23, 24, 25, 25, 24, 22, + 25, 25, 25, 24, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 23, + 25, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 22, 25, 25, 23, 25, 25, + 20, 24, 25, 24, 25, 25, 22, 24, 25, 24, 25, 24, 25, 25, 24, 25, 25, 25, 25, + 22, 25, 25, 25, 24, 25, 24, 25, 18, ]; diff --git a/project starter code/node_modules/@jimp/plugin-blur/src/index.js b/project starter code/node_modules/@jimp/plugin-blur/src/index.js index e5ab8ea9..d97ae3d6 100644 --- a/project starter code/node_modules/@jimp/plugin-blur/src/index.js +++ b/project starter code/node_modules/@jimp/plugin-blur/src/index.js @@ -1,5 +1,5 @@ -import { throwError, isNodePattern } from '@jimp/utils'; -import { mulTable, shgTable } from './blur-tables'; +import { throwError, isNodePattern } from "@jimp/utils"; +import { mulTable, shgTable } from "./blur-tables"; /* Superfast Blur (0.5) @@ -37,9 +37,9 @@ export default () => ({ * @returns {Jimp} this for chaining of methods */ blur(r, cb) { - if (typeof r !== 'number') - return throwError.call(this, 'r must be a number', cb); - if (r < 1) return throwError.call(this, 'r must be greater than 0', cb); + if (typeof r !== "number") + return throwError.call(this, "r must be a number", cb); + if (r < 1) return throwError.call(this, "r must be greater than 0", cb); let rsum; let gsum; @@ -177,5 +177,5 @@ export default () => ({ } return this; - } + }, }); diff --git a/project starter code/node_modules/@jimp/plugin-circle/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-circle/CHANGELOG.md index 26394e0f..3d839517 100644 --- a/project starter code/node_modules/@jimp/plugin-circle/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/plugin-circle/CHANGELOG.md @@ -1,3 +1,65 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.22.0 (Mon Feb 06 2023) + +#### 🏠 Internal + +- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Daniel Holmes ([@danielholmes](https://github.com/danielholmes)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -12,7 +74,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -20,4 +82,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-circle/README.md b/project starter code/node_modules/@jimp/plugin-circle/README.md index 5181828e..689b3ab8 100644 --- a/project starter code/node_modules/@jimp/plugin-circle/README.md +++ b/project starter code/node_modules/@jimp/plugin-circle/README.md @@ -11,10 +11,10 @@ - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.circle(); // or diff --git a/project starter code/node_modules/@jimp/plugin-circle/dist/index.js b/project starter code/node_modules/@jimp/plugin-circle/dist/index.js index 91489e42..554b26b4 100644 --- a/project starter code/node_modules/@jimp/plugin-circle/dist/index.js +++ b/project starter code/node_modules/@jimp/plugin-circle/dist/index.js @@ -3,51 +3,42 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - +exports.default = void 0; var _utils = require("@jimp/utils"); - /** * Creates a circle out of an image. * @param {function(Error, Jimp)} options (optional) radius, x, y * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ -var _default = function _default() { - return { - circle: function circle() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var cb = arguments.length > 1 ? arguments[1] : undefined; - - if (typeof options === 'function') { - cb = options; - options = {}; - } - - var radius = options.radius || (this.bitmap.width > this.bitmap.height ? this.bitmap.height : this.bitmap.width) / 2; - var center = { - x: typeof options.x === 'number' ? options.x : this.bitmap.width / 2, - y: typeof options.y === 'number' ? options.y : this.bitmap.height / 2 - }; - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var curR = Math.sqrt(Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)); - - if (radius - curR <= 0.0) { - this.bitmap.data[idx + 3] = 0; - } else if (radius - curR < 1.0) { - this.bitmap.data[idx + 3] = 255 * (radius - curR); - } - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); +var _default = () => ({ + circle() { + let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + let cb = arguments.length > 1 ? arguments[1] : undefined; + if (typeof options === "function") { + cb = options; + options = {}; + } + const radius = options.radius || (this.bitmap.width > this.bitmap.height ? this.bitmap.height : this.bitmap.width) / 2; + const center = { + x: typeof options.x === "number" ? options.x : this.bitmap.width / 2, + y: typeof options.y === "number" ? options.y : this.bitmap.height / 2 + }; + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + const curR = Math.sqrt(Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)); + if (radius - curR <= 0.0) { + this.bitmap.data[idx + 3] = 0; + } else if (radius - curR < 1.0) { + this.bitmap.data[idx + 3] = 255 * (radius - curR); } - - return this; + }); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); } - }; -}; - -exports["default"] = _default; + return this; + } +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-circle/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-circle/dist/index.js.map index 195824df..db694a53 100644 --- a/project starter code/node_modules/@jimp/plugin-circle/dist/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-circle/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["circle","options","cb","radius","bitmap","width","height","center","x","y","scanQuiet","idx","curR","Math","sqrt","pow","data","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;eAMe;AAAA,SAAO;AACpBA,IAAAA,MADoB,oBACK;AAAA,UAAlBC,OAAkB,uEAAR,EAAQ;AAAA,UAAJC,EAAI;;AACvB,UAAI,OAAOD,OAAP,KAAmB,UAAvB,EAAmC;AACjCC,QAAAA,EAAE,GAAGD,OAAL;AACAA,QAAAA,OAAO,GAAG,EAAV;AACD;;AAED,UAAME,MAAM,GACVF,OAAO,CAACE,MAAR,IACA,CAAC,KAAKC,MAAL,CAAYC,KAAZ,GAAoB,KAAKD,MAAL,CAAYE,MAAhC,GACG,KAAKF,MAAL,CAAYE,MADf,GAEG,KAAKF,MAAL,CAAYC,KAFhB,IAEyB,CAJ3B;AAMA,UAAME,MAAM,GAAG;AACbC,QAAAA,CAAC,EAAE,OAAOP,OAAO,CAACO,CAAf,KAAqB,QAArB,GAAgCP,OAAO,CAACO,CAAxC,GAA4C,KAAKJ,MAAL,CAAYC,KAAZ,GAAoB,CADtD;AAEbI,QAAAA,CAAC,EAAE,OAAOR,OAAO,CAACQ,CAAf,KAAqB,QAArB,GAAgCR,OAAO,CAACQ,CAAxC,GAA4C,KAAKL,MAAL,CAAYE,MAAZ,GAAqB;AAFvD,OAAf;AAKA,WAAKI,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKN,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DE,CAD0D,EAE1DC,CAF0D,EAG1DE,GAH0D,EAI1D;AACA,YAAMC,IAAI,GAAGC,IAAI,CAACC,IAAL,CACXD,IAAI,CAACE,GAAL,CAASP,CAAC,GAAGD,MAAM,CAACC,CAApB,EAAuB,CAAvB,IAA4BK,IAAI,CAACE,GAAL,CAASN,CAAC,GAAGF,MAAM,CAACE,CAApB,EAAuB,CAAvB,CADjB,CAAb;;AAIA,YAAIN,MAAM,GAAGS,IAAT,IAAiB,GAArB,EAA0B;AACxB,eAAKR,MAAL,CAAYY,IAAZ,CAAiBL,GAAG,GAAG,CAAvB,IAA4B,CAA5B;AACD,SAFD,MAEO,IAAIR,MAAM,GAAGS,IAAT,GAAgB,GAApB,EAAyB;AAC9B,eAAKR,MAAL,CAAYY,IAAZ,CAAiBL,GAAG,GAAG,CAAvB,IAA4B,OAAOR,MAAM,GAAGS,IAAhB,CAA5B;AACD;AACF,OAdD;;AAgBA,UAAI,0BAAcV,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACe,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAvCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional) radius, x, y\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n circle(options = {}, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n const radius =\n options.radius ||\n (this.bitmap.width > this.bitmap.height\n ? this.bitmap.height\n : this.bitmap.width) / 2;\n\n const center = {\n x: typeof options.x === 'number' ? options.x : this.bitmap.width / 2,\n y: typeof options.y === 'number' ? options.y : this.bitmap.height / 2\n };\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const curR = Math.sqrt(\n Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)\n );\n\n if (radius - curR <= 0.0) {\n this.bitmap.data[idx + 3] = 0;\n } else if (radius - curR < 1.0) {\n this.bitmap.data[idx + 3] = 255 * (radius - curR);\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["circle","options","cb","radius","bitmap","width","height","center","x","y","scanQuiet","idx","curR","Math","sqrt","pow","data","isNodePattern","call"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional) radius, x, y\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n circle(options = {}, cb) {\n if (typeof options === \"function\") {\n cb = options;\n options = {};\n }\n\n const radius =\n options.radius ||\n (this.bitmap.width > this.bitmap.height\n ? this.bitmap.height\n : this.bitmap.width) / 2;\n\n const center = {\n x: typeof options.x === \"number\" ? options.x : this.bitmap.width / 2,\n y: typeof options.y === \"number\" ? options.y : this.bitmap.height / 2,\n };\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const curR = Math.sqrt(\n Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)\n );\n\n if (radius - curR <= 0.0) {\n this.bitmap.data[idx + 3] = 0;\n } else if (radius - curR < 1.0) {\n this.bitmap.data[idx + 3] = 255 * (radius - curR);\n }\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AALA,eAMe,OAAO;EACpBA,MAAM,GAAmB;IAAA,IAAlBC,OAAO,uEAAG,CAAC,CAAC;IAAA,IAA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G,GAAG,CAAC,CAAC,GAAG,GAAG,IAAIR,MAAM,GAAGS,IAAI,CAAC;MACnD;IACF,CAAC,CACF;IAED,IAAI,IAAAK,oBAAa,EAACf,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACgB,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-circle/es/index.js b/project starter code/node_modules/@jimp/plugin-circle/es/index.js index d710b6d5..94c8aa11 100644 --- a/project starter code/node_modules/@jimp/plugin-circle/es/index.js +++ b/project starter code/node_modules/@jimp/plugin-circle/es/index.js @@ -1,11 +1,4 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); +import { isNodePattern } from "@jimp/utils"; /** * Creates a circle out of an image. @@ -13,40 +6,31 @@ var _utils = require("@jimp/utils"); * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ -var _default = function _default() { - return { - circle: function circle() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var cb = arguments.length > 1 ? arguments[1] : undefined; - - if (typeof options === 'function') { - cb = options; - options = {}; - } - - var radius = options.radius || (this.bitmap.width > this.bitmap.height ? this.bitmap.height : this.bitmap.width) / 2; - var center = { - x: typeof options.x === 'number' ? options.x : this.bitmap.width / 2, - y: typeof options.y === 'number' ? options.y : this.bitmap.height / 2 - }; - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var curR = Math.sqrt(Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)); - - if (radius - curR <= 0.0) { - this.bitmap.data[idx + 3] = 0; - } else if (radius - curR < 1.0) { - this.bitmap.data[idx + 3] = 255 * (radius - curR); - } - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); +export default (() => ({ + circle() { + let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + let cb = arguments.length > 1 ? arguments[1] : undefined; + if (typeof options === "function") { + cb = options; + options = {}; + } + const radius = options.radius || (this.bitmap.width > this.bitmap.height ? this.bitmap.height : this.bitmap.width) / 2; + const center = { + x: typeof options.x === "number" ? options.x : this.bitmap.width / 2, + y: typeof options.y === "number" ? options.y : this.bitmap.height / 2 + }; + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + const curR = Math.sqrt(Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)); + if (radius - curR <= 0.0) { + this.bitmap.data[idx + 3] = 0; + } else if (radius - curR < 1.0) { + this.bitmap.data[idx + 3] = 255 * (radius - curR); } - - return this; + }); + if (isNodePattern(cb)) { + cb.call(this, null, this); } - }; -}; - -exports["default"] = _default; + return this; + } +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-circle/es/index.js.map b/project starter code/node_modules/@jimp/plugin-circle/es/index.js.map index 195824df..89b8675e 100644 --- a/project starter code/node_modules/@jimp/plugin-circle/es/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-circle/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["circle","options","cb","radius","bitmap","width","height","center","x","y","scanQuiet","idx","curR","Math","sqrt","pow","data","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;eAMe;AAAA,SAAO;AACpBA,IAAAA,MADoB,oBACK;AAAA,UAAlBC,OAAkB,uEAAR,EAAQ;AAAA,UAAJC,EAAI;;AACvB,UAAI,OAAOD,OAAP,KAAmB,UAAvB,EAAmC;AACjCC,QAAAA,EAAE,GAAGD,OAAL;AACAA,QAAAA,OAAO,GAAG,EAAV;AACD;;AAED,UAAME,MAAM,GACVF,OAAO,CAACE,MAAR,IACA,CAAC,KAAKC,MAAL,CAAYC,KAAZ,GAAoB,KAAKD,MAAL,CAAYE,MAA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P;AACD;AAvCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional) radius, x, y\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n circle(options = {}, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n const radius =\n options.radius ||\n (this.bitmap.width > this.bitmap.height\n ? this.bitmap.height\n : this.bitmap.width) / 2;\n\n const center = {\n x: typeof options.x === 'number' ? options.x : this.bitmap.width / 2,\n y: typeof options.y === 'number' ? options.y : this.bitmap.height / 2\n };\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const curR = Math.sqrt(\n Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)\n );\n\n if (radius - curR <= 0.0) {\n this.bitmap.data[idx + 3] = 0;\n } else if (radius - curR < 1.0) {\n this.bitmap.data[idx + 3] = 255 * (radius - curR);\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["isNodePattern","circle","options","cb","radius","bitmap","width","height","center","x","y","scanQuiet","idx","curR","Math","sqrt","pow","data","call"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional) radius, x, y\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n circle(options = {}, cb) {\n if (typeof options === \"function\") {\n cb = options;\n options = {};\n }\n\n const radius =\n options.radius ||\n (this.bitmap.width > this.bitmap.height\n ? this.bitmap.height\n : this.bitmap.width) / 2;\n\n const center = {\n x: typeof options.x === \"number\" ? options.x : this.bitmap.width / 2,\n y: typeof options.y === \"number\" ? options.y : this.bitmap.height / 2,\n };\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const curR = Math.sqrt(\n Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)\n );\n\n if (radius - curR <= 0.0) {\n this.bitmap.data[idx + 3] = 0;\n } else if (radius - curR < 1.0) {\n this.bitmap.data[idx + 3] = 255 * (radius - curR);\n }\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,aAAa;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;EACpBC,MAAM,GAAmB;IAAA,IAAlBC,OAAO,uEAAG,CAAC,CAAC;IAAA,IAAEC,EAAE;IACrB,IAAI,OAAOD,OAAO,KAAK,UAAU,EAAE;MACjCC,EAAE,GAAGD,OAAO;MACZA,OAAO,GAAG,CAAC,CAAC;IACd;IAEA,MAAME,MAAM,GACVF,OAAO,CAACE,MAAM,IACd,CAAC,IAAI,CAACC,MAAM,CAACC,KAAK,GAAG,IAAI,CAACD,MAAM,CAACE,MAAM,GACnC,IAAI,CAACF,MAAM,CAACE,MAAM,GAClB,IAAI,CAACF,MAAM,CAACC,KAAK,IAAI,CAAC;IAE5B,MAAME,MAAM,GAAG;MACbC,CAAC,EAAE,OAAOP,OAAO,CAACO,CAAC,KAAK,QAAQ,GAAGP,OAAO,CAACO,CAAC,GAAG,IAAI,CAACJ,MAAM,CAACC,KAAK,GAAG,CAAC;MACpEI,CAAC,EAAE,OAAOR,OAAO,CAACQ,CAAC,KAAK,QAAQ,GAAGR,OAAO,CAACQ,CAAC,GAAG,IAAI,CAACL,MAAM,CAACE,MAAM,GAAG;IACtE,CAAC;IAED,IAAI,CAACI,SAAS,CACZ,CAAC,EACD,CAAC,EACD,IAAI,CAACN,MAAM,CAACC,KAAK,EACjB,IAAI,CAACD,MAAM,CAACE,MAAM,EAClB,UAAUE,CAAC,EAAEC,CAAC,EAAEE,GAAG,EAAE;MACnB,MAAMC,IAAI,GAAGC,IAAI,CAACC,IAAI,CACpBD,IAAI,CAACE,GAAG,CAACP,CAAC,GAAGD,MAAM,CAACC,CAAC,EAAE,CAAC,CAAC,GAAGK,IAAI,CAACE,GAAG,CAACN,CAAC,GAAGF,MAAM,CAACE,CAAC,EAAE,CAAC,CAAC,CACtD;MAED,IAAIN,MAAM,GAAGS,IAAI,IAAI,GAAG,EAAE;QACxB,IAAI,CAACR,MAAM,CAACY,IAAI,CAACL,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC;MAC/B,CAAC,MAAM,IAAIR,MAAM,GAAGS,IAAI,GAAG,GAAG,EAAE;QAC9B,IAAI,CAACR,MAAM,CAACY,IAAI,CAACL,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,IAAIR,MAAM,GAAGS,IAAI,CAAC;MACnD;IACF,CAAC,CACF;IAED,IAAIb,aAAa,CAACG,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACe,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-circle/index.d.ts b/project starter code/node_modules/@jimp/plugin-circle/index.d.ts index 40f24935..302dda00 100644 --- a/project starter code/node_modules/@jimp/plugin-circle/index.d.ts +++ b/project starter code/node_modules/@jimp/plugin-circle/index.d.ts @@ -1,12 +1,15 @@ -import { ImageCallback } from '@jimp/core'; +import { ImageCallback } from "@jimp/core"; interface Circle { - circle(options?: { - radius: number, - x: number, - y: number - }, cb?: ImageCallback): this; + circle( + options?: { + radius: number; + x: number; + y: number; + }, + cb?: ImageCallback + ): this; circle(cb?: ImageCallback): this; } -export default function(): Circle; +export default function (): Circle; diff --git a/project starter code/node_modules/@jimp/plugin-circle/package.json b/project starter code/node_modules/@jimp/plugin-circle/package.json index 56825de4..8e256cce 100644 --- a/project starter code/node_modules/@jimp/plugin-circle/package.json +++ b/project starter code/node_modules/@jimp/plugin-circle/package.json @@ -1,12 +1,13 @@ { "name": "@jimp/plugin-circle", - "version": "0.16.2", + "version": "0.22.12", "description": "Creates a circle out of an image.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js", "test:watch": "npm run test -- --reporter min --watch", "test:coverage": "nyc npm run test", "build": "npm run build:node:production && npm run build:module", @@ -20,18 +21,17 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" }, "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/test-utils": "^0.16.2" + "@jimp/custom": "^0.22.12", + "@jimp/test-utils": "^0.22.12" }, "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/plugin-circle/src/index.js b/project starter code/node_modules/@jimp/plugin-circle/src/index.js index d917ad1e..5d1a5c9c 100644 --- a/project starter code/node_modules/@jimp/plugin-circle/src/index.js +++ b/project starter code/node_modules/@jimp/plugin-circle/src/index.js @@ -1,4 +1,4 @@ -import { isNodePattern } from '@jimp/utils'; +import { isNodePattern } from "@jimp/utils"; /** * Creates a circle out of an image. @@ -8,7 +8,7 @@ import { isNodePattern } from '@jimp/utils'; */ export default () => ({ circle(options = {}, cb) { - if (typeof options === 'function') { + if (typeof options === "function") { cb = options; options = {}; } @@ -20,30 +20,32 @@ export default () => ({ : this.bitmap.width) / 2; const center = { - x: typeof options.x === 'number' ? options.x : this.bitmap.width / 2, - y: typeof options.y === 'number' ? options.y : this.bitmap.height / 2 + x: typeof options.x === "number" ? options.x : this.bitmap.width / 2, + y: typeof options.y === "number" ? options.y : this.bitmap.height / 2, }; - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - const curR = Math.sqrt( - Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2) - ); + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + const curR = Math.sqrt( + Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2) + ); - if (radius - curR <= 0.0) { - this.bitmap.data[idx + 3] = 0; - } else if (radius - curR < 1.0) { - this.bitmap.data[idx + 3] = 255 * (radius - curR); + if (radius - curR <= 0.0) { + this.bitmap.data[idx + 3] = 0; + } else if (radius - curR < 1.0) { + this.bitmap.data[idx + 3] = 255 * (radius - curR); + } } - }); + ); if (isNodePattern(cb)) { cb.call(this, null, this); } return this; - } + }, }); diff --git a/project starter code/node_modules/@jimp/plugin-circle/test/circle.test.js b/project starter code/node_modules/@jimp/plugin-circle/test/circle.test.js index 6b42c73e..afeb6c6b 100644 --- a/project starter code/node_modules/@jimp/plugin-circle/test/circle.test.js +++ b/project starter code/node_modules/@jimp/plugin-circle/test/circle.test.js @@ -1,78 +1,79 @@ -import { Jimp, mkJGD, getTestDir } from '@jimp/test-utils'; -import configure from '@jimp/custom'; +import { Jimp, mkJGD, getTestDir } from "@jimp/test-utils"; +import configure from "@jimp/custom"; +import expect from "@storybook/expect"; -import circle from '../src'; +import circle from "../src"; const jimp = configure({ plugins: [circle] }, Jimp); -describe('Circle', () => { - it('makes a circle based on image height and width', async () => { +describe("Circle", () => { + it("makes a circle based on image height and width", async () => { const expectedImg = await Jimp.read( - getTestDir(__dirname) + '/images/circled.png' + getTestDir(__dirname) + "/images/circled.png" ); const imgSrc = await jimp.read( mkJGD( - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦' + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦" ) ); - imgSrc.circle().bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + expect(imgSrc.circle().bitmap.data).toEqual(expectedImg.bitmap.data); }); - it('makes a circle using provided radius', async () => { + it("makes a circle using provided radius", async () => { const expectedImg = await Jimp.read( - getTestDir(__dirname) + '/images/radius-3-circle.png' + getTestDir(__dirname) + "/images/radius-3-circle.png" ); const imgSrc = await jimp.read( mkJGD( - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦' + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦" ) ); - imgSrc - .circle({ radius: 3 }) - .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + expect(imgSrc.circle({ radius: 3 }).bitmap.data).toEqual( + expectedImg.bitmap.data + ); }); - it('should ', async () => { + it("should ", async () => { const expectedImg = await Jimp.read( - getTestDir(__dirname) + '/images/x-y-circle.png' + getTestDir(__dirname) + "/images/x-y-circle.png" ); const imgSrc = await jimp.read( mkJGD( - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦', - '▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦' + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦", + "▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦▦" ) ); - imgSrc - .circle({ radius: 5, x: 5, y: 5 }) - .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + expect(imgSrc.circle({ radius: 5, x: 5, y: 5 }).bitmap.data).toEqual( + expectedImg.bitmap.data + ); }); }); diff --git a/project starter code/node_modules/@jimp/plugin-color/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-color/CHANGELOG.md index 26394e0f..14f0ae49 100644 --- a/project starter code/node_modules/@jimp/plugin-color/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/plugin-color/CHANGELOG.md @@ -1,3 +1,137 @@ +# v0.22.8 (Thu May 11 2023) + +#### 🚀 Enhancement + +- Fix: convolute not defaulting to 0, 0 as starting point [#1228](https://github.com/jimp-dev/jimp/pull/1228) ([@sjoerd108](https://github.com/sjoerd108)) + +#### Authors: 1 + +- Sjoerd ([@sjoerd108](https://github.com/sjoerd108)) + +--- + +# v0.22.6 (Fri Feb 24 2023) + +:tada: This release contains work from a new contributor! :tada: + +Thank you, Daniell ([@daniellwdb](https://github.com/daniellwdb)), for all your work! + +#### 🐛 Bug Fix + +- Export ColorActionName enum [#1205](https://github.com/jimp-dev/jimp/pull/1205) ([@daniellwdb](https://github.com/daniellwdb)) + +#### Authors: 1 + +- Daniell ([@daniellwdb](https://github.com/daniellwdb)) + +--- + +# v0.22.4 (Tue Feb 07 2023) + +#### 🚀 Enhancement + +- update tinycolor2 [#1187](https://github.com/jimp-dev/jimp/pull/1187) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.22.0 (Mon Feb 06 2023) + +#### 🏠 Internal + +- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Daniel Holmes ([@danielholmes](https://github.com/danielholmes)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.17.6 (Sat Feb 04 2023) + +#### 🐛 Bug Fix + +- Fix types not assignable to 'ColorActionName'. [#1086](https://github.com/jimp-dev/jimp/pull/1086) ([@lucyyyyyyy](https://github.com/lucyyyyyyy) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Lucy ([@lucyyyyyyy](https://github.com/lucyyyyyyy)) + +--- + +# v0.17.3 (Sat Feb 04 2023) + +#### 🐛 Bug Fix + +- Fix EDGE_WRAP overwriting X with Y when Y < 0 [#1135](https://github.com/jimp-dev/jimp/pull/1135) ([@sjoerd108](https://github.com/sjoerd108) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Sjoerd ([@sjoerd108](https://github.com/sjoerd108)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### 🐛 Bug Fix + +- Fix edgeHandling types [#1080](https://github.com/jimp-dev/jimp/pull/1080) ([@domdomegg](https://github.com/domdomegg)) + +#### ⚠️ Pushed to `main` + +- update linting ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Adam Jones ([@domdomegg](https://github.com/domdomegg)) +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -12,7 +146,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -20,4 +154,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-color/README.md b/project starter code/node_modules/@jimp/plugin-color/README.md index cad9c7e5..1b4c800f 100644 --- a/project starter code/node_modules/@jimp/plugin-color/README.md +++ b/project starter code/node_modules/@jimp/plugin-color/README.md @@ -15,12 +15,12 @@ Apply multiple color modification rules - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); - image.color([{ apply: 'red', params: [100] }]); + image.color([{ apply: "red", params: [100] }]); } main(); @@ -30,9 +30,9 @@ Jimp supports advanced colour manipulation using a single method as follows: ```js image.color([ - { apply: 'hue', params: [-90] }, - { apply: 'lighten', params: [50] }, - { apply: 'xor', params: ['#06D'] } + { apply: "hue", params: [-90] }, + { apply: "lighten", params: [50] }, + { apply: "xor", params: ["#06D"] }, ]); ``` @@ -64,10 +64,10 @@ Adjusts the brightness of the image - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.brightness(20); } @@ -83,10 +83,10 @@ Adjusts the contrast of the image - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.contrast(70); } @@ -102,10 +102,10 @@ Apply a posterize effect - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.posterize(5); } @@ -121,10 +121,10 @@ Multiplies the opacity of each pixel by a factor between 0 and 1 - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.opacity(80); } @@ -139,10 +139,10 @@ Applies a sepia tone to the image - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.sepia(); } @@ -158,10 +158,10 @@ Fades each pixel by a factor between 0 and 1 - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.fade(0.7); } @@ -174,17 +174,23 @@ main(); Sum neighbor pixels weighted by the kernel matrix. You can find a nice explanation with examples at [GIMP's Convolution Matrix plugin](https://docs.gimp.org/2.6/en/plug-in-convmatrix.html) - @param {array} kernel a matrix to weight the neighbors sum -- @param {string} edgeHandling (optional) define how to sum pixels from outside the border +- @param {number} edgeHandling (optional) define how to sum pixels from outside the border - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); - - // make me better - image.convolution(weights); + const image = await jimp.read("test/image.png"); + + image.convolution( + [ + [-1, -1, -1], + [-1, 8, -1], + [-1, -1, -1], + ], + jimp.EDGE_EXTEND + ); } main(); @@ -197,10 +203,10 @@ Set the alpha channel on every pixel to fully opaque - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.opaque(); } @@ -220,10 +226,10 @@ Pixelates the image or a region - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.pixelate(10); } @@ -243,10 +249,10 @@ Applies a convolution kernel to the image or a region - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); // make me better image.pixelate(kernal); diff --git a/project starter code/node_modules/@jimp/plugin-color/dist/index.js b/project starter code/node_modules/@jimp/plugin-color/dist/index.js index a4db2139..6be0fc4a 100644 --- a/project starter code/node_modules/@jimp/plugin-color/dist/index.js +++ b/project starter code/node_modules/@jimp/plugin-color/dist/index.js @@ -1,567 +1,486 @@ "use strict"; -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - +exports.default = exports.ColorActionName = void 0; var _tinycolor = _interopRequireDefault(require("tinycolor2")); - var _utils = require("@jimp/utils"); - +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function applyKernel(im, kernel, x, y) { - var value = [0, 0, 0]; - var size = (kernel.length - 1) / 2; - - for (var kx = 0; kx < kernel.length; kx += 1) { - for (var ky = 0; ky < kernel[kx].length; ky += 1) { - var idx = im.getPixelIndex(x + kx - size, y + ky - size); + const value = [0, 0, 0]; + const size = (kernel.length - 1) / 2; + for (let kx = 0; kx < kernel.length; kx += 1) { + for (let ky = 0; ky < kernel[kx].length; ky += 1) { + const idx = im.getPixelIndex(x + kx - size, y + ky - size); value[0] += im.bitmap.data[idx] * kernel[kx][ky]; value[1] += im.bitmap.data[idx + 1] * kernel[kx][ky]; value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky]; } } - return value; } - -var isDef = function isDef(v) { - return typeof v !== 'undefined' && v !== null; -}; - +const isDef = v => typeof v !== "undefined" && v !== null; function greyscale(cb) { this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var grey = parseInt(0.2126 * this.bitmap.data[idx] + 0.7152 * this.bitmap.data[idx + 1] + 0.0722 * this.bitmap.data[idx + 2], 10); + const grey = parseInt(0.2126 * this.bitmap.data[idx] + 0.7152 * this.bitmap.data[idx + 1] + 0.0722 * this.bitmap.data[idx + 2], 10); this.bitmap.data[idx] = grey; this.bitmap.data[idx + 1] = grey; this.bitmap.data[idx + 2] = grey; }); - if ((0, _utils.isNodePattern)(cb)) { cb.call(this, null, this); } - return this; } - function mix(clr, clr2) { - var p = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50; + let p = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50; return { r: (clr2.r - clr.r) * (p / 100) + clr.r, g: (clr2.g - clr.g) * (p / 100) + clr.g, b: (clr2.b - clr.b) * (p / 100) + clr.b }; } - function colorFn(actions, cb) { - var _this = this; - if (!actions || !Array.isArray(actions)) { - return _utils.throwError.call(this, 'actions must be an array', cb); + return _utils.throwError.call(this, "actions must be an array", cb); } - - actions = actions.map(function (action) { - if (action.apply === 'xor' || action.apply === 'mix') { - action.params[0] = (0, _tinycolor["default"])(action.params[0]).toRgb(); + actions = actions.map(action => { + if (action.apply === "xor" || action.apply === "mix") { + action.params[0] = (0, _tinycolor.default)(action.params[0]).toRgb(); } - return action; }); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var clr = { - r: _this.bitmap.data[idx], - g: _this.bitmap.data[idx + 1], - b: _this.bitmap.data[idx + 2] + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => { + let clr = { + r: this.bitmap.data[idx], + g: this.bitmap.data[idx + 1], + b: this.bitmap.data[idx + 2] }; - - var colorModifier = function colorModifier(i, amount) { - return _this.constructor.limit255(clr[i] + amount); - }; - - actions.forEach(function (action) { - if (action.apply === 'mix') { + const colorModifier = (i, amount) => this.constructor.limit255(clr[i] + amount); + actions.forEach(action => { + if (action.apply === "mix") { clr = mix(clr, action.params[0], action.params[1]); - } else if (action.apply === 'tint') { + } else if (action.apply === "tint") { clr = mix(clr, { r: 255, g: 255, b: 255 }, action.params[0]); - } else if (action.apply === 'shade') { + } else if (action.apply === "shade") { clr = mix(clr, { r: 0, g: 0, b: 0 }, action.params[0]); - } else if (action.apply === 'xor') { + } else if (action.apply === "xor") { clr = { r: clr.r ^ action.params[0].r, g: clr.g ^ action.params[0].g, b: clr.b ^ action.params[0].b }; - } else if (action.apply === 'red') { - clr.r = colorModifier('r', action.params[0]); - } else if (action.apply === 'green') { - clr.g = colorModifier('g', action.params[0]); - } else if (action.apply === 'blue') { - clr.b = colorModifier('b', action.params[0]); + } else if (action.apply === "red") { + clr.r = colorModifier("r", action.params[0]); + } else if (action.apply === "green") { + clr.g = colorModifier("g", action.params[0]); + } else if (action.apply === "blue") { + clr.b = colorModifier("b", action.params[0]); } else { - var _clr; - - if (action.apply === 'hue') { - action.apply = 'spin'; + if (action.apply === "hue") { + action.apply = "spin"; } - - clr = (0, _tinycolor["default"])(clr); - + clr = (0, _tinycolor.default)(clr); if (!clr[action.apply]) { - return _utils.throwError.call(_this, 'action ' + action.apply + ' not supported', cb); + return _utils.throwError.call(this, "action " + action.apply + " not supported", cb); } - - clr = (_clr = clr)[action.apply].apply(_clr, (0, _toConsumableArray2["default"])(action.params)).toRgb(); + clr = clr[action.apply](...action.params).toRgb(); } }); - _this.bitmap.data[idx] = clr.r; - _this.bitmap.data[idx + 1] = clr.g; - _this.bitmap.data[idx + 2] = clr.b; + this.bitmap.data[idx] = clr.r; + this.bitmap.data[idx + 1] = clr.g; + this.bitmap.data[idx + 2] = clr.b; }); - if ((0, _utils.isNodePattern)(cb)) { cb.call(this, null, this); } - return this; } - -var _default = function _default() { - return { - /** - * Adjusts the brightness of the image - * @param {number} val the amount to adjust the brightness, a number between -1 and +1 - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - brightness: function brightness(val, cb) { - if (typeof val !== 'number') { - return _utils.throwError.call(this, 'val must be numbers', cb); - } - - if (val < -1 || val > +1) { - return _utils.throwError.call(this, 'val must be a number between -1 and +1', cb); +const ColorActionName = Object.freeze({ + LIGHTEN: "lighten", + BRIGHTEN: "brighten", + DARKEN: "darken", + DESATURATE: "desaturate", + SATURATE: "saturate", + GREYSCALE: "greyscale", + SPIN: "spin", + HUE: "hue", + MIX: "mix", + TINT: "tint", + SHADE: "shade", + XOR: "xor", + RED: "red", + GREEN: "green", + BLUE: "blue" +}); +exports.ColorActionName = ColorActionName; +var _default = () => ({ + /** + * Adjusts the brightness of the image + * @param {number} val the amount to adjust the brightness, a number between -1 and +1 + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + brightness(val, cb) { + if (typeof val !== "number") { + return _utils.throwError.call(this, "val must be numbers", cb); + } + if (val < -1 || val > +1) { + return _utils.throwError.call(this, "val must be a number between -1 and +1", cb); + } + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + if (val < 0.0) { + this.bitmap.data[idx] *= 1 + val; + this.bitmap.data[idx + 1] *= 1 + val; + this.bitmap.data[idx + 2] *= 1 + val; + } else { + this.bitmap.data[idx] += (255 - this.bitmap.data[idx]) * val; + this.bitmap.data[idx + 1] += (255 - this.bitmap.data[idx + 1]) * val; + this.bitmap.data[idx + 2] += (255 - this.bitmap.data[idx + 2]) * val; } + }); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Adjusts the contrast of the image + * @param {number} val the amount to adjust the contrast, a number between -1 and +1 + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + contrast(val, cb) { + if (typeof val !== "number") { + return _utils.throwError.call(this, "val must be numbers", cb); + } + if (val < -1 || val > +1) { + return _utils.throwError.call(this, "val must be a number between -1 and +1", cb); + } + const factor = (val + 1) / (1 - val); + function adjust(value) { + value = Math.floor(factor * (value - 127) + 127); + return value < 0 ? 0 : value > 255 ? 255 : value; + } + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + this.bitmap.data[idx] = adjust(this.bitmap.data[idx]); + this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]); + this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]); + }); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Apply a posterize effect + * @param {number} n the amount to adjust the contrast, minimum threshold is two + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + posterize(n, cb) { + if (typeof n !== "number") { + return _utils.throwError.call(this, "n must be numbers", cb); + } + if (n < 2) { + n = 2; + } // minimum of 2 levels + + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + this.bitmap.data[idx] = Math.floor(this.bitmap.data[idx] / 255 * (n - 1)) / (n - 1) * 255; + this.bitmap.data[idx + 1] = Math.floor(this.bitmap.data[idx + 1] / 255 * (n - 1)) / (n - 1) * 255; + this.bitmap.data[idx + 2] = Math.floor(this.bitmap.data[idx + 2] / 255 * (n - 1)) / (n - 1) * 255; + }); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Removes colour from the image using ITU Rec 709 luminance values + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + greyscale, + // Alias of greyscale for our American friends + grayscale: greyscale, + /** + * Multiplies the opacity of each pixel by a factor between 0 and 1 + * @param {number} f A number, the factor by which to multiply the opacity of each pixel + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + opacity(f, cb) { + if (typeof f !== "number") return _utils.throwError.call(this, "f must be a number", cb); + if (f < 0 || f > 1) return _utils.throwError.call(this, "f must be a number from 0 to 1", cb); + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + const v = this.bitmap.data[idx + 3] * f; + this.bitmap.data[idx + 3] = v; + }); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Applies a sepia tone to the image + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + sepia(cb) { + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + let red = this.bitmap.data[idx]; + let green = this.bitmap.data[idx + 1]; + let blue = this.bitmap.data[idx + 2]; + red = red * 0.393 + green * 0.769 + blue * 0.189; + green = red * 0.349 + green * 0.686 + blue * 0.168; + blue = red * 0.272 + green * 0.534 + blue * 0.131; + this.bitmap.data[idx] = red < 255 ? red : 255; + this.bitmap.data[idx + 1] = green < 255 ? green : 255; + this.bitmap.data[idx + 2] = blue < 255 ? blue : 255; + }); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Fades each pixel by a factor between 0 and 1 + * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent. + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + fade(f, cb) { + if (typeof f !== "number") { + return _utils.throwError.call(this, "f must be a number", cb); + } + if (f < 0 || f > 1) { + return _utils.throwError.call(this, "f must be a number from 0 to 1", cb); + } - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - if (val < 0.0) { - this.bitmap.data[idx] = this.bitmap.data[idx] * (1 + val); - this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] * (1 + val); - this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] * (1 + val); - } else { - this.bitmap.data[idx] = this.bitmap.data[idx] + (255 - this.bitmap.data[idx]) * val; - this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] + (255 - this.bitmap.data[idx + 1]) * val; - this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] + (255 - this.bitmap.data[idx + 2]) * val; + // this method is an alternative to opacity (which may be deprecated) + this.opacity(1 - f); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Adds each element of the image to its local neighbors, weighted by the kernel + * @param {array} kernel a matrix to weight the neighbors sum + * @param {number} edgeHandling (optional) define how to sum pixels from outside the border + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + convolution(kernel, edgeHandling, cb) { + if (typeof edgeHandling === "function" && typeof cb === "undefined") { + cb = edgeHandling; + edgeHandling = null; + } + if (!edgeHandling) { + edgeHandling = this.constructor.EDGE_EXTEND; + } + const newData = Buffer.from(this.bitmap.data); + const kRows = kernel.length; + const kCols = kernel[0].length; + const rowEnd = Math.floor(kRows / 2); + const colEnd = Math.floor(kCols / 2); + const rowIni = -rowEnd; + const colIni = -colEnd; + let weight; + let rSum; + let gSum; + let bSum; + let ri; + let gi; + let bi; + let xi; + let yi; + let idxi; + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + bSum = 0; + gSum = 0; + rSum = 0; + for (let row = rowIni; row <= rowEnd; row++) { + for (let col = colIni; col <= colEnd; col++) { + xi = x + col; + yi = y + row; + weight = kernel[row + rowEnd][col + colEnd]; + idxi = this.getPixelIndex(xi, yi, edgeHandling); + if (idxi === -1) { + bi = 0; + gi = 0; + ri = 0; + } else { + ri = this.bitmap.data[idxi + 0]; + gi = this.bitmap.data[idxi + 1]; + bi = this.bitmap.data[idxi + 2]; + } + rSum += weight * ri; + gSum += weight * gi; + bSum += weight * bi; } - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Adjusts the contrast of the image - * @param {number} val the amount to adjust the contrast, a number between -1 and +1 - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - contrast: function contrast(val, cb) { - if (typeof val !== 'number') { - return _utils.throwError.call(this, 'val must be numbers', cb); - } - - if (val < -1 || val > +1) { - return _utils.throwError.call(this, 'val must be a number between -1 and +1', cb); } - - var factor = (val + 1) / (1 - val); - - function adjust(value) { - value = Math.floor(factor * (value - 127) + 127); - return value < 0 ? 0 : value > 255 ? 255 : value; - } - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data[idx] = adjust(this.bitmap.data[idx]); - this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]); - this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); + if (rSum < 0) { + rSum = 0; } - - return this; - }, - - /** - * Apply a posterize effect - * @param {number} n the amount to adjust the contrast, minimum threshold is two - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - posterize: function posterize(n, cb) { - if (typeof n !== 'number') { - return _utils.throwError.call(this, 'n must be numbers', cb); + if (gSum < 0) { + gSum = 0; } - - if (n < 2) { - n = 2; - } // minimum of 2 levels - - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data[idx] = Math.floor(this.bitmap.data[idx] / 255 * (n - 1)) / (n - 1) * 255; - this.bitmap.data[idx + 1] = Math.floor(this.bitmap.data[idx + 1] / 255 * (n - 1)) / (n - 1) * 255; - this.bitmap.data[idx + 2] = Math.floor(this.bitmap.data[idx + 2] / 255 * (n - 1)) / (n - 1) * 255; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); + if (bSum < 0) { + bSum = 0; } - - return this; - }, - - /** - * Removes colour from the image using ITU Rec 709 luminance values - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - greyscale: greyscale, - // Alias of greyscale for our American friends - grayscale: greyscale, - - /** - * Multiplies the opacity of each pixel by a factor between 0 and 1 - * @param {number} f A number, the factor by which to multiply the opacity of each pixel - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - opacity: function opacity(f, cb) { - if (typeof f !== 'number') return _utils.throwError.call(this, 'f must be a number', cb); - if (f < 0 || f > 1) return _utils.throwError.call(this, 'f must be a number from 0 to 1', cb); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var v = this.bitmap.data[idx + 3] * f; - this.bitmap.data[idx + 3] = v; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); + if (rSum > 255) { + rSum = 255; } - - return this; - }, - - /** - * Applies a sepia tone to the image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - sepia: function sepia(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var red = this.bitmap.data[idx]; - var green = this.bitmap.data[idx + 1]; - var blue = this.bitmap.data[idx + 2]; - red = red * 0.393 + green * 0.769 + blue * 0.189; - green = red * 0.349 + green * 0.686 + blue * 0.168; - blue = red * 0.272 + green * 0.534 + blue * 0.131; - this.bitmap.data[idx] = red < 255 ? red : 255; - this.bitmap.data[idx + 1] = green < 255 ? green : 255; - this.bitmap.data[idx + 2] = blue < 255 ? blue : 255; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); + if (gSum > 255) { + gSum = 255; } - - return this; - }, - - /** - * Fades each pixel by a factor between 0 and 1 - * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - fade: function fade(f, cb) { - if (typeof f !== 'number') { - return _utils.throwError.call(this, 'f must be a number', cb); + if (bSum > 255) { + bSum = 255; } - - if (f < 0 || f > 1) { - return _utils.throwError.call(this, 'f must be a number from 0 to 1', cb); - } // this method is an alternative to opacity (which may be deprecated) - - - this.opacity(1 - f); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); + newData[idx + 0] = rSum; + newData[idx + 1] = gSum; + newData[idx + 2] = bSum; + }); + this.bitmap.data = newData; + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Set the alpha channel on every pixel to fully opaque + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + opaque(cb) { + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + this.bitmap.data[idx + 3] = 255; + }); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Pixelates the image or a region + * @param {number} size the size of the pixels + * @param {number} x (optional) the x position of the region to pixelate + * @param {number} y (optional) the y position of the region to pixelate + * @param {number} w (optional) the width of the region to pixelate + * @param {number} h (optional) the height of the region to pixelate + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + pixelate(size, x, y, w, h, cb) { + if (typeof x === "function") { + cb = x; + h = null; + w = null; + y = null; + x = null; + } else { + if (typeof size !== "number") { + return _utils.throwError.call(this, "size must be a number", cb); } - - return this; - }, - - /** - * Adds each element of the image to its local neighbors, weighted by the kernel - * @param {array} kernel a matrix to weight the neighbors sum - * @param {string} edgeHandling (optional) define how to sum pixels from outside the border - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - convolution: function convolution(kernel, edgeHandling, cb) { - if (typeof edgeHandling === 'function' && typeof cb === 'undefined') { - cb = edgeHandling; - edgeHandling = null; + if (isDef(x) && typeof x !== "number") { + return _utils.throwError.call(this, "x must be a number", cb); } - - if (!edgeHandling) { - edgeHandling = this.constructor.EDGE_EXTEND; + if (isDef(y) && typeof y !== "number") { + return _utils.throwError.call(this, "y must be a number", cb); } - - var newData = Buffer.from(this.bitmap.data); - var kRows = kernel.length; - var kCols = kernel[0].length; - var rowEnd = Math.floor(kRows / 2); - var colEnd = Math.floor(kCols / 2); - var rowIni = -rowEnd; - var colIni = -colEnd; - var weight; - var rSum; - var gSum; - var bSum; - var ri; - var gi; - var bi; - var xi; - var yi; - var idxi; - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - bSum = 0; - gSum = 0; - rSum = 0; - - for (var row = rowIni; row <= rowEnd; row++) { - for (var col = colIni; col <= colEnd; col++) { - xi = x + col; - yi = y + row; - weight = kernel[row + rowEnd][col + colEnd]; - idxi = this.getPixelIndex(xi, yi, edgeHandling); - - if (idxi === -1) { - bi = 0; - gi = 0; - ri = 0; - } else { - ri = this.bitmap.data[idxi + 0]; - gi = this.bitmap.data[idxi + 1]; - bi = this.bitmap.data[idxi + 2]; - } - - rSum += weight * ri; - gSum += weight * gi; - bSum += weight * bi; - } - } - - if (rSum < 0) { - rSum = 0; - } - - if (gSum < 0) { - gSum = 0; - } - - if (bSum < 0) { - bSum = 0; - } - - if (rSum > 255) { - rSum = 255; - } - - if (gSum > 255) { - gSum = 255; - } - - if (bSum > 255) { - bSum = 255; - } - - newData[idx + 0] = rSum; - newData[idx + 1] = gSum; - newData[idx + 2] = bSum; - }); - this.bitmap.data = newData; - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); + if (isDef(w) && typeof w !== "number") { + return _utils.throwError.call(this, "w must be a number", cb); } - - return this; - }, - - /** - * Set the alpha channel on every pixel to fully opaque - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - opaque: function opaque(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data[idx + 3] = 255; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); + if (isDef(h) && typeof h !== "number") { + return _utils.throwError.call(this, "h must be a number", cb); } - - return this; - }, - - /** - * Pixelates the image or a region - * @param {number} size the size of the pixels - * @param {number} x (optional) the x position of the region to pixelate - * @param {number} y (optional) the y position of the region to pixelate - * @param {number} w (optional) the width of the region to pixelate - * @param {number} h (optional) the height of the region to pixelate - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - pixelate: function pixelate(size, x, y, w, h, cb) { - if (typeof x === 'function') { - cb = x; - h = null; - w = null; - y = null; - x = null; - } else { - if (typeof size !== 'number') { - return _utils.throwError.call(this, 'size must be a number', cb); - } - - if (isDef(x) && typeof x !== 'number') { - return _utils.throwError.call(this, 'x must be a number', cb); - } - - if (isDef(y) && typeof y !== 'number') { - return _utils.throwError.call(this, 'y must be a number', cb); - } - - if (isDef(w) && typeof w !== 'number') { - return _utils.throwError.call(this, 'w must be a number', cb); - } - - if (isDef(h) && typeof h !== 'number') { - return _utils.throwError.call(this, 'h must be a number', cb); - } + } + const kernel = [[1 / 16, 2 / 16, 1 / 16], [2 / 16, 4 / 16, 2 / 16], [1 / 16, 2 / 16, 1 / 16]]; + x = x || 0; + y = y || 0; + w = isDef(w) ? w : this.bitmap.width - x; + h = isDef(h) ? h : this.bitmap.height - y; + const source = this.cloneQuiet(); + this.scanQuiet(x, y, w, h, function (xx, yx, idx) { + xx = size * Math.floor(xx / size); + yx = size * Math.floor(yx / size); + const value = applyKernel(source, kernel, xx, yx); + this.bitmap.data[idx] = value[0]; + this.bitmap.data[idx + 1] = value[1]; + this.bitmap.data[idx + 2] = value[2]; + }); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Applies a convolution kernel to the image or a region + * @param {array} kernel the convolution kernel + * @param {number} x (optional) the x position of the region to apply convolution to + * @param {number} y (optional) the y position of the region to apply convolution to + * @param {number} w (optional) the width of the region to apply convolution to + * @param {number} h (optional) the height of the region to apply convolution to + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + convolute(kernel, x, y, w, h, cb) { + if (!Array.isArray(kernel)) return _utils.throwError.call(this, "the kernel must be an array", cb); + if (typeof x === "function") { + cb = x; + x = null; + y = null; + w = null; + h = null; + } else { + if (isDef(x) && typeof x !== "number") { + return _utils.throwError.call(this, "x must be a number", cb); } - - var kernel = [[1 / 16, 2 / 16, 1 / 16], [2 / 16, 4 / 16, 2 / 16], [1 / 16, 2 / 16, 1 / 16]]; - x = x || 0; - y = y || 0; - w = isDef(w) ? w : this.bitmap.width - x; - h = isDef(h) ? h : this.bitmap.height - y; - var source = this.cloneQuiet(); - this.scanQuiet(x, y, w, h, function (xx, yx, idx) { - xx = size * Math.floor(xx / size); - yx = size * Math.floor(yx / size); - var value = applyKernel(source, kernel, xx, yx); - this.bitmap.data[idx] = value[0]; - this.bitmap.data[idx + 1] = value[1]; - this.bitmap.data[idx + 2] = value[2]; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); + if (isDef(y) && typeof y !== "number") { + return _utils.throwError.call(this, "y must be a number", cb); } - - return this; - }, - - /** - * Applies a convolution kernel to the image or a region - * @param {array} kernel the convolution kernel - * @param {number} x (optional) the x position of the region to apply convolution to - * @param {number} y (optional) the y position of the region to apply convolution to - * @param {number} w (optional) the width of the region to apply convolution to - * @param {number} h (optional) the height of the region to apply convolution to - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - convolute: function convolute(kernel, x, y, w, h, cb) { - if (!Array.isArray(kernel)) return _utils.throwError.call(this, 'the kernel must be an array', cb); - - if (typeof x === 'function') { - cb = x; - x = null; - y = null; - w = null; - h = null; - } else { - if (isDef(x) && typeof x !== 'number') { - return _utils.throwError.call(this, 'x must be a number', cb); - } - - if (isDef(y) && typeof y !== 'number') { - return _utils.throwError.call(this, 'y must be a number', cb); - } - - if (isDef(w) && typeof w !== 'number') { - return _utils.throwError.call(this, 'w must be a number', cb); - } - - if (isDef(h) && typeof h !== 'number') { - return _utils.throwError.call(this, 'h must be a number', cb); - } + if (isDef(w) && typeof w !== "number") { + return _utils.throwError.call(this, "w must be a number", cb); } - - var ksize = (kernel.length - 1) / 2; - x = isDef(x) ? x : ksize; - y = isDef(y) ? y : ksize; - w = isDef(w) ? w : this.bitmap.width - x; - h = isDef(h) ? h : this.bitmap.height - y; - var source = this.cloneQuiet(); - this.scanQuiet(x, y, w, h, function (xx, yx, idx) { - var value = applyKernel(source, kernel, xx, yx); - this.bitmap.data[idx] = this.constructor.limit255(value[0]); - this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]); - this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); + if (isDef(h) && typeof h !== "number") { + return _utils.throwError.call(this, "h must be a number", cb); } - - return this; - }, - - /** - * Apply multiple color modification rules - * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] } - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - color: colorFn, - colour: colorFn - }; -}; - -exports["default"] = _default; -module.exports = exports.default; + } + x = isDef(x) ? x : 0; + y = isDef(y) ? y : 0; + w = isDef(w) ? w : this.bitmap.width - x; + h = isDef(h) ? h : this.bitmap.height - y; + const source = this.cloneQuiet(); + this.scanQuiet(x, y, w, h, function (xx, yx, idx) { + const value = applyKernel(source, kernel, xx, yx); + this.bitmap.data[idx] = this.constructor.limit255(value[0]); + this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]); + this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]); + }); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Apply multiple color modification rules + * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] } + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + color: colorFn, + colour: colorFn +}); +exports.default = _default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-color/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-color/dist/index.js.map index 00325b53..7eab365f 100644 --- a/project starter code/node_modules/@jimp/plugin-color/dist/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-color/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["applyKernel","im","kernel","x","y","value","size","length","kx","ky","idx","getPixelIndex","bitmap","data","isDef","v","greyscale","cb","scanQuiet","width","height","grey","parseInt","call","mix","clr","clr2","p","r","g","b","colorFn","actions","Array","isArray","throwError","map","action","apply","params","toRgb","colorModifier","i","amount","constructor","limit255","forEach","brightness","val","contrast","factor","adjust","Math","floor","posterize","n","grayscale","opacity","f","sepia","red","green","blue","fade","convolution","edgeHandling","EDGE_EXTEND","newData","Buffer","from","kRows","kCols","rowEnd","colEnd","rowIni","colIni","weight","rSum","gSum","bSum","ri","gi","bi","xi","yi","idxi","row","col","opaque","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W,CAAC4F,MAAD,EAAS1F,MAAT,EAAiB4F,EAAjB,EAAqBC,EAArB,CAAzB;AAEA,aAAKnF,MAAL,CAAYC,IAAZ,CAAiBH,GAAjB,IAAwB,KAAKkC,WAAL,CAAiBC,QAAjB,CAA0BxC,KAAK,CAAC,CAAD,CAA/B,CAAxB;AACA,aAAKO,MAAL,CAAYC,IAAZ,CAAiBH,GAAG,GAAG,CAAvB,IAA4B,KAAKkC,WAAL,CAAiBC,QAAjB,CAA0BxC,KAAK,CAAC,CAAD,CAA/B,CAA5B;AACA,aAAKO,MAAL,CAAYC,IAAZ,CAAiBH,GAAG,GAAG,CAAvB,IAA4B,KAAKkC,WAAL,CAAiBC,QAAjB,CAA0BxC,KAAK,CAAC,CAAD,CAA/B,CAA5B;AACD,OAND;;AAQA,UAAI,0BAAcY,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACM,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD,KA9dmB;;AAgepB;;;;;;AAMA2E,IAAAA,KAAK,EAAEnE,OAtea;AAuepBoE,IAAAA,MAAM,EAAEpE;AAveY,GAAP;AAAA,C","sourcesContent":["import tinyColor from 'tinycolor2';\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nfunction applyKernel(im, kernel, x, y) {\n const value = [0, 0, 0];\n const size = (kernel.length - 1) / 2;\n\n for (let kx = 0; kx < kernel.length; kx += 1) {\n for (let ky = 0; ky < kernel[kx].length; ky += 1) {\n const idx = im.getPixelIndex(x + kx - size, y + ky - size);\n\n value[0] += im.bitmap.data[idx] * kernel[kx][ky];\n value[1] += im.bitmap.data[idx + 1] * kernel[kx][ky];\n value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky];\n }\n }\n\n return value;\n}\n\nconst isDef = v => typeof v !== 'undefined' && v !== null;\n\nfunction greyscale(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const grey = parseInt(\n 0.2126 * this.bitmap.data[idx] +\n 0.7152 * this.bitmap.data[idx + 1] +\n 0.0722 * this.bitmap.data[idx + 2],\n 10\n );\n\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nfunction mix(clr, clr2, p = 50) {\n return {\n r: (clr2.r - clr.r) * (p / 100) + clr.r,\n g: (clr2.g - clr.g) * (p / 100) + clr.g,\n b: (clr2.b - clr.b) * (p / 100) + clr.b\n };\n}\n\nfunction colorFn(actions, cb) {\n if (!actions || !Array.isArray(actions)) {\n return throwError.call(this, 'actions must be an array', cb);\n }\n\n actions = actions.map(action => {\n if (action.apply === 'xor' || action.apply === 'mix') {\n action.params[0] = tinyColor(action.params[0]).toRgb();\n }\n\n return action;\n });\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n let clr = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2]\n };\n\n const colorModifier = (i, amount) =>\n this.constructor.limit255(clr[i] + amount);\n\n actions.forEach(action => {\n if (action.apply === 'mix') {\n clr = mix(clr, action.params[0], action.params[1]);\n } else if (action.apply === 'tint') {\n clr = mix(clr, { r: 255, g: 255, b: 255 }, action.params[0]);\n } else if (action.apply === 'shade') {\n clr = mix(clr, { r: 0, g: 0, b: 0 }, action.params[0]);\n } else if (action.apply === 'xor') {\n clr = {\n r: clr.r ^ action.params[0].r,\n g: clr.g ^ action.params[0].g,\n b: clr.b ^ action.params[0].b\n };\n } else if (action.apply === 'red') {\n clr.r = colorModifier('r', action.params[0]);\n } else if (action.apply === 'green') {\n clr.g = colorModifier('g', action.params[0]);\n } else if (action.apply === 'blue') {\n clr.b = colorModifier('b', action.params[0]);\n } else {\n if (action.apply === 'hue') {\n action.apply = 'spin';\n }\n\n clr = tinyColor(clr);\n\n if (!clr[action.apply]) {\n return throwError.call(\n this,\n 'action ' + action.apply + ' not supported',\n cb\n );\n }\n\n clr = clr[action.apply](...action.params).toRgb();\n }\n });\n\n this.bitmap.data[idx] = clr.r;\n this.bitmap.data[idx + 1] = clr.g;\n this.bitmap.data[idx + 2] = clr.b;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n /**\n * Adjusts the brightness of the image\n * @param {number} val the amount to adjust the brightness, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n brightness(val, cb) {\n if (typeof val !== 'number') {\n return throwError.call(this, 'val must be numbers', cb);\n }\n\n if (val < -1 || val > +1) {\n return throwError.call(\n this,\n 'val must be a number between -1 and +1',\n cb\n );\n }\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n if (val < 0.0) {\n this.bitmap.data[idx] = this.bitmap.data[idx] * (1 + val);\n this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] * (1 + val);\n this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] * (1 + val);\n } else {\n this.bitmap.data[idx] =\n this.bitmap.data[idx] + (255 - this.bitmap.data[idx]) * val;\n this.bitmap.data[idx + 1] =\n this.bitmap.data[idx + 1] + (255 - this.bitmap.data[idx + 1]) * val;\n this.bitmap.data[idx + 2] =\n this.bitmap.data[idx + 2] + (255 - this.bitmap.data[idx + 2]) * val;\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Adjusts the contrast of the image\n * @param {number} val the amount to adjust the contrast, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n contrast(val, cb) {\n if (typeof val !== 'number') {\n return throwError.call(this, 'val must be numbers', cb);\n }\n\n if (val < -1 || val > +1) {\n return throwError.call(\n this,\n 'val must be a number between -1 and +1',\n cb\n );\n }\n\n const factor = (val + 1) / (1 - val);\n\n function adjust(value) {\n value = Math.floor(factor * (value - 127) + 127);\n\n return value < 0 ? 0 : value > 255 ? 255 : value;\n }\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx] = adjust(this.bitmap.data[idx]);\n this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]);\n this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]);\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Apply a posterize effect\n * @param {number} n the amount to adjust the contrast, minimum threshold is two\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n posterize(n, cb) {\n if (typeof n !== 'number') {\n return throwError.call(this, 'n must be numbers', cb);\n }\n\n if (n < 2) {\n n = 2;\n } // minimum of 2 levels\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx] =\n (Math.floor((this.bitmap.data[idx] / 255) * (n - 1)) / (n - 1)) * 255;\n this.bitmap.data[idx + 1] =\n (Math.floor((this.bitmap.data[idx + 1] / 255) * (n - 1)) / (n - 1)) *\n 255;\n this.bitmap.data[idx + 2] =\n (Math.floor((this.bitmap.data[idx + 2] / 255) * (n - 1)) / (n - 1)) *\n 255;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Removes colour from the image using ITU Rec 709 luminance values\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n greyscale,\n\n // Alias of greyscale for our American friends\n grayscale: greyscale,\n\n /**\n * Multiplies the opacity of each pixel by a factor between 0 and 1\n * @param {number} f A number, the factor by which to multiply the opacity of each pixel\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opacity(f, cb) {\n if (typeof f !== 'number')\n return throwError.call(this, 'f must be a number', cb);\n if (f < 0 || f > 1)\n return throwError.call(this, 'f must be a number from 0 to 1', cb);\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const v = this.bitmap.data[idx + 3] * f;\n this.bitmap.data[idx + 3] = v;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Applies a sepia tone to the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n sepia(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n let red = this.bitmap.data[idx];\n let green = this.bitmap.data[idx + 1];\n let blue = this.bitmap.data[idx + 2];\n\n red = red * 0.393 + green * 0.769 + blue * 0.189;\n green = red * 0.349 + green * 0.686 + blue * 0.168;\n blue = red * 0.272 + green * 0.534 + blue * 0.131;\n\n this.bitmap.data[idx] = red < 255 ? red : 255;\n this.bitmap.data[idx + 1] = green < 255 ? green : 255;\n this.bitmap.data[idx + 2] = blue < 255 ? blue : 255;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Fades each pixel by a factor between 0 and 1\n * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n fade(f, cb) {\n if (typeof f !== 'number') {\n return throwError.call(this, 'f must be a number', cb);\n }\n\n if (f < 0 || f > 1) {\n return throwError.call(this, 'f must be a number from 0 to 1', cb);\n }\n\n // this method is an alternative to opacity (which may be deprecated)\n this.opacity(1 - f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Adds each element of the image to its local neighbors, weighted by the kernel\n * @param {array} kernel a matrix to weight the neighbors sum\n * @param {string} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n convolution(kernel, edgeHandling, cb) {\n if (typeof edgeHandling === 'function' && typeof cb === 'undefined') {\n cb = edgeHandling;\n edgeHandling = null;\n }\n\n if (!edgeHandling) {\n edgeHandling = this.constructor.EDGE_EXTEND;\n }\n\n const newData = Buffer.from(this.bitmap.data);\n const kRows = kernel.length;\n const kCols = kernel[0].length;\n const rowEnd = Math.floor(kRows / 2);\n const colEnd = Math.floor(kCols / 2);\n const rowIni = -rowEnd;\n const colIni = -colEnd;\n\n let weight;\n let rSum;\n let gSum;\n let bSum;\n let ri;\n let gi;\n let bi;\n let xi;\n let yi;\n let idxi;\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n bSum = 0;\n gSum = 0;\n rSum = 0;\n\n for (let row = rowIni; row <= rowEnd; row++) {\n for (let col = colIni; col <= colEnd; col++) {\n xi = x + col;\n yi = y + row;\n weight = kernel[row + rowEnd][col + colEnd];\n idxi = this.getPixelIndex(xi, yi, edgeHandling);\n\n if (idxi === -1) {\n bi = 0;\n gi = 0;\n ri = 0;\n } else {\n ri = this.bitmap.data[idxi + 0];\n gi = this.bitmap.data[idxi + 1];\n bi = this.bitmap.data[idxi + 2];\n }\n\n rSum += weight * ri;\n gSum += weight * gi;\n bSum += weight * bi;\n }\n }\n\n if (rSum < 0) {\n rSum = 0;\n }\n\n if (gSum < 0) {\n gSum = 0;\n }\n\n if (bSum < 0) {\n bSum = 0;\n }\n\n if (rSum > 255) {\n rSum = 255;\n }\n\n if (gSum > 255) {\n gSum = 255;\n }\n\n if (bSum > 255) {\n bSum = 255;\n }\n\n newData[idx + 0] = rSum;\n newData[idx + 1] = gSum;\n newData[idx + 2] = bSum;\n });\n\n this.bitmap.data = newData;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Set the alpha channel on every pixel to fully opaque\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opaque(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx + 3] = 255;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Pixelates the image or a region\n * @param {number} size the size of the pixels\n * @param {number} x (optional) the x position of the region to pixelate\n * @param {number} y (optional) the y position of the region to pixelate\n * @param {number} w (optional) the width of the region to pixelate\n * @param {number} h (optional) the height of the region to pixelate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n pixelate(size, x, y, w, h, cb) {\n if (typeof x === 'function') {\n cb = x;\n h = null;\n w = null;\n y = null;\n x = null;\n } else {\n if (typeof size !== 'number') {\n return throwError.call(this, 'size must be a number', cb);\n }\n\n if (isDef(x) && typeof x !== 'number') {\n return throwError.call(this, 'x must be a number', cb);\n }\n\n if (isDef(y) && typeof y !== 'number') {\n return throwError.call(this, 'y must be a number', cb);\n }\n\n if (isDef(w) && typeof w !== 'number') {\n return throwError.call(this, 'w must be a number', cb);\n }\n\n if (isDef(h) && typeof h !== 'number') {\n return throwError.call(this, 'h must be a number', cb);\n }\n }\n\n const kernel = [\n [1 / 16, 2 / 16, 1 / 16],\n [2 / 16, 4 / 16, 2 / 16],\n [1 / 16, 2 / 16, 1 / 16]\n ];\n\n x = x || 0;\n y = y || 0;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n\n const source = this.cloneQuiet();\n\n this.scanQuiet(x, y, w, h, function(xx, yx, idx) {\n xx = size * Math.floor(xx / size);\n yx = size * Math.floor(yx / size);\n\n const value = applyKernel(source, kernel, xx, yx);\n\n this.bitmap.data[idx] = value[0];\n this.bitmap.data[idx + 1] = value[1];\n this.bitmap.data[idx + 2] = value[2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Applies a convolution kernel to the image or a region\n * @param {array} kernel the convolution kernel\n * @param {number} x (optional) the x position of the region to apply convolution to\n * @param {number} y (optional) the y position of the region to apply convolution to\n * @param {number} w (optional) the width of the region to apply convolution to\n * @param {number} h (optional) the height of the region to apply convolution to\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n convolute(kernel, x, y, w, h, cb) {\n if (!Array.isArray(kernel))\n return throwError.call(this, 'the kernel must be an array', cb);\n\n if (typeof x === 'function') {\n cb = x;\n x = null;\n y = null;\n w = null;\n h = null;\n } else {\n if (isDef(x) && typeof x !== 'number') {\n return throwError.call(this, 'x must be a number', cb);\n }\n\n if (isDef(y) && typeof y !== 'number') {\n return throwError.call(this, 'y must be a number', cb);\n }\n\n if (isDef(w) && typeof w !== 'number') {\n return throwError.call(this, 'w must be a number', cb);\n }\n\n if (isDef(h) && typeof h !== 'number') {\n return throwError.call(this, 'h must be a number', cb);\n }\n }\n\n const ksize = (kernel.length - 1) / 2;\n\n x = isDef(x) ? x : ksize;\n y = isDef(y) ? y : ksize;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n\n const source = this.cloneQuiet();\n\n this.scanQuiet(x, y, w, h, function(xx, yx, idx) {\n const value = applyKernel(source, kernel, xx, yx);\n\n this.bitmap.data[idx] = this.constructor.limit255(value[0]);\n this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]);\n this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]);\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Apply multiple color modification rules\n * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] }\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n color: colorFn,\n colour: colorFn\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["applyKernel","im","kernel","x","y","value","size","length","kx","ky","idx","getPixelIndex","bitmap","data","isDef","v","greyscale","cb","scanQuiet","width","height","grey","parseInt","isNodePattern","call","mix","clr","clr2","p","r","g","b","colorFn","actions","Array","isArray","throwError","map","action","apply","params","tinyColor","toRgb","colorModifier","i","amount","constructor","limit255","forEach","ColorActionName","Object","freeze","LIGHTEN","BRIGHTEN","DARKEN","DESATURATE","SATURATE","GREYSCALE","SPIN","HUE","MIX","TINT","SHADE","XOR","RED","GREEN","BLUE","brightness","val","contrast","factor","adjust","Math","floor","posterize","n","grayscale","opacity","f","sepia","red","green","blue","fade","convolution","edgeHandling","EDGE_EXTEND","newData","Buffer","from","kRows","kCols","rowEnd","colEnd","rowIni","colIni","weight","rSum","gSum","bSum","ri","gi","bi","xi","yi","idxi","row","col","opaque","pixelate","w","h","source","cloneQuiet","xx","yx","convolute","color","colour"],"sources":["../src/index.js"],"sourcesContent":["import tinyColor from \"tinycolor2\";\nimport { throwError, isNodePattern } from \"@jimp/utils\";\n\nfunction applyKernel(im, kernel, x, y) {\n const value = [0, 0, 0];\n const size = (kernel.length - 1) / 2;\n\n for (let kx = 0; kx < kernel.length; kx += 1) {\n for (let ky = 0; ky < kernel[kx].length; ky += 1) {\n const idx = im.getPixelIndex(x + kx - size, y + ky - size);\n\n value[0] += im.bitmap.data[idx] * kernel[kx][ky];\n value[1] += im.bitmap.data[idx + 1] * kernel[kx][ky];\n value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky];\n }\n }\n\n return value;\n}\n\nconst isDef = (v) => typeof v !== \"undefined\" && v !== null;\n\nfunction greyscale(cb) {\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const grey = parseInt(\n 0.2126 * this.bitmap.data[idx] +\n 0.7152 * this.bitmap.data[idx + 1] +\n 0.0722 * this.bitmap.data[idx + 2],\n 10\n );\n\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nfunction mix(clr, clr2, p = 50) {\n return {\n r: (clr2.r - clr.r) * (p / 100) + clr.r,\n g: (clr2.g - clr.g) * (p / 100) + clr.g,\n b: (clr2.b - clr.b) * (p / 100) + clr.b,\n };\n}\n\nfunction colorFn(actions, cb) {\n if (!actions || !Array.isArray(actions)) {\n return throwError.call(this, \"actions must be an array\", cb);\n }\n\n actions = actions.map((action) => {\n if (action.apply === \"xor\" || action.apply === \"mix\") {\n action.params[0] = tinyColor(action.params[0]).toRgb();\n }\n\n return action;\n });\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n let clr = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2],\n };\n\n const colorModifier = (i, amount) =>\n this.constructor.limit255(clr[i] + amount);\n\n actions.forEach((action) => {\n if (action.apply === \"mix\") {\n clr = mix(clr, action.params[0], action.params[1]);\n } else if (action.apply === \"tint\") {\n clr = mix(clr, { r: 255, g: 255, b: 255 }, action.params[0]);\n } else if (action.apply === \"shade\") {\n clr = mix(clr, { r: 0, g: 0, b: 0 }, action.params[0]);\n } else if (action.apply === \"xor\") {\n clr = {\n r: clr.r ^ action.params[0].r,\n g: clr.g ^ action.params[0].g,\n b: clr.b ^ action.params[0].b,\n };\n } else if (action.apply === \"red\") {\n clr.r = colorModifier(\"r\", action.params[0]);\n } else if (action.apply === \"green\") {\n clr.g = colorModifier(\"g\", action.params[0]);\n } else if (action.apply === \"blue\") {\n clr.b = colorModifier(\"b\", action.params[0]);\n } else {\n if (action.apply === \"hue\") {\n action.apply = \"spin\";\n }\n\n clr = tinyColor(clr);\n\n if (!clr[action.apply]) {\n return throwError.call(\n this,\n \"action \" + action.apply + \" not supported\",\n cb\n );\n }\n\n clr = clr[action.apply](...action.params).toRgb();\n }\n });\n\n this.bitmap.data[idx] = clr.r;\n this.bitmap.data[idx + 1] = clr.g;\n this.bitmap.data[idx + 2] = clr.b;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport const ColorActionName = Object.freeze({\n LIGHTEN: \"lighten\",\n BRIGHTEN: \"brighten\",\n DARKEN: \"darken\",\n DESATURATE: \"desaturate\",\n SATURATE: \"saturate\",\n GREYSCALE: \"greyscale\",\n SPIN: \"spin\",\n HUE: \"hue\",\n MIX: \"mix\",\n TINT: \"tint\",\n SHADE: \"shade\",\n XOR: \"xor\",\n RED: \"red\",\n GREEN: \"green\",\n BLUE: \"blue\",\n});\n\nexport default () => ({\n /**\n * Adjusts the brightness of the image\n * @param {number} val the amount to adjust the brightness, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n brightness(val, cb) {\n if (typeof val !== \"number\") {\n return throwError.call(this, \"val must be numbers\", cb);\n }\n\n if (val < -1 || val > +1) {\n return throwError.call(\n this,\n \"val must be a number between -1 and +1\",\n cb\n );\n }\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n if (val < 0.0) {\n this.bitmap.data[idx] *= 1 + val;\n this.bitmap.data[idx + 1] *= 1 + val;\n this.bitmap.data[idx + 2] *= 1 + val;\n } else {\n this.bitmap.data[idx] += (255 - this.bitmap.data[idx]) * val;\n this.bitmap.data[idx + 1] += (255 - this.bitmap.data[idx + 1]) * val;\n this.bitmap.data[idx + 2] += (255 - this.bitmap.data[idx + 2]) * val;\n }\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Adjusts the contrast of the image\n * @param {number} val the amount to adjust the contrast, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n contrast(val, cb) {\n if (typeof val !== \"number\") {\n return throwError.call(this, \"val must be numbers\", cb);\n }\n\n if (val < -1 || val > +1) {\n return throwError.call(\n this,\n \"val must be a number between -1 and +1\",\n cb\n );\n }\n\n const factor = (val + 1) / (1 - val);\n\n function adjust(value) {\n value = Math.floor(factor * (value - 127) + 127);\n\n return value < 0 ? 0 : value > 255 ? 255 : value;\n }\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data[idx] = adjust(this.bitmap.data[idx]);\n this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]);\n this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]);\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Apply a posterize effect\n * @param {number} n the amount to adjust the contrast, minimum threshold is two\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n posterize(n, cb) {\n if (typeof n !== \"number\") {\n return throwError.call(this, \"n must be numbers\", cb);\n }\n\n if (n < 2) {\n n = 2;\n } // minimum of 2 levels\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data[idx] =\n (Math.floor((this.bitmap.data[idx] / 255) * (n - 1)) / (n - 1)) * 255;\n this.bitmap.data[idx + 1] =\n (Math.floor((this.bitmap.data[idx + 1] / 255) * (n - 1)) / (n - 1)) *\n 255;\n this.bitmap.data[idx + 2] =\n (Math.floor((this.bitmap.data[idx + 2] / 255) * (n - 1)) / (n - 1)) *\n 255;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Removes colour from the image using ITU Rec 709 luminance values\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n greyscale,\n\n // Alias of greyscale for our American friends\n grayscale: greyscale,\n\n /**\n * Multiplies the opacity of each pixel by a factor between 0 and 1\n * @param {number} f A number, the factor by which to multiply the opacity of each pixel\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opacity(f, cb) {\n if (typeof f !== \"number\")\n return throwError.call(this, \"f must be a number\", cb);\n if (f < 0 || f > 1)\n return throwError.call(this, \"f must be a number from 0 to 1\", cb);\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const v = this.bitmap.data[idx + 3] * f;\n this.bitmap.data[idx + 3] = v;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Applies a sepia tone to the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n sepia(cb) {\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n let red = this.bitmap.data[idx];\n let green = this.bitmap.data[idx + 1];\n let blue = this.bitmap.data[idx + 2];\n\n red = red * 0.393 + green * 0.769 + blue * 0.189;\n green = red * 0.349 + green * 0.686 + blue * 0.168;\n blue = red * 0.272 + green * 0.534 + blue * 0.131;\n\n this.bitmap.data[idx] = red < 255 ? red : 255;\n this.bitmap.data[idx + 1] = green < 255 ? green : 255;\n this.bitmap.data[idx + 2] = blue < 255 ? blue : 255;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Fades each pixel by a factor between 0 and 1\n * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n fade(f, cb) {\n if (typeof f !== \"number\") {\n return throwError.call(this, \"f must be a number\", cb);\n }\n\n if (f < 0 || f > 1) {\n return throwError.call(this, \"f must be a number from 0 to 1\", cb);\n }\n\n // this method is an alternative to opacity (which may be deprecated)\n this.opacity(1 - f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Adds each element of the image to its local neighbors, weighted by the kernel\n * @param {array} kernel a matrix to weight the neighbors sum\n * @param {number} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n convolution(kernel, edgeHandling, cb) {\n if (typeof edgeHandling === \"function\" && typeof cb === \"undefined\") {\n cb = edgeHandling;\n edgeHandling = null;\n }\n\n if (!edgeHandling) {\n edgeHandling = this.constructor.EDGE_EXTEND;\n }\n\n const newData = Buffer.from(this.bitmap.data);\n const kRows = kernel.length;\n const kCols = kernel[0].length;\n const rowEnd = Math.floor(kRows / 2);\n const colEnd = Math.floor(kCols / 2);\n const rowIni = -rowEnd;\n const colIni = -colEnd;\n\n let weight;\n let rSum;\n let gSum;\n let bSum;\n let ri;\n let gi;\n let bi;\n let xi;\n let yi;\n let idxi;\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n bSum = 0;\n gSum = 0;\n rSum = 0;\n\n for (let row = rowIni; row <= rowEnd; row++) {\n for (let col = colIni; col <= colEnd; col++) {\n xi = x + col;\n yi = y + row;\n weight = kernel[row + rowEnd][col + colEnd];\n idxi = this.getPixelIndex(xi, yi, edgeHandling);\n\n if (idxi === -1) {\n bi = 0;\n gi = 0;\n ri = 0;\n } else {\n ri = this.bitmap.data[idxi + 0];\n gi = this.bitmap.data[idxi + 1];\n bi = this.bitmap.data[idxi + 2];\n }\n\n rSum += weight * ri;\n gSum += weight * gi;\n bSum += weight * bi;\n }\n }\n\n if (rSum < 0) {\n rSum = 0;\n }\n\n if (gSum < 0) {\n gSum = 0;\n }\n\n if (bSum < 0) {\n bSum = 0;\n }\n\n if (rSum > 255) {\n rSum = 255;\n }\n\n if (gSum > 255) {\n gSum = 255;\n }\n\n if (bSum > 255) {\n bSum = 255;\n }\n\n newData[idx + 0] = rSum;\n newData[idx + 1] = gSum;\n newData[idx + 2] = bSum;\n }\n );\n\n this.bitmap.data = newData;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Set the alpha channel on every pixel to fully opaque\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opaque(cb) {\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data[idx + 3] = 255;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Pixelates the image or a region\n * @param {number} size the size of the pixels\n * @param {number} x (optional) the x position of the region to pixelate\n * @param {number} y (optional) the y position of the region to pixelate\n * @param {number} w (optional) the width of the region to pixelate\n * @param {number} h (optional) the height of the region to pixelate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n pixelate(size, x, y, w, h, cb) {\n if (typeof x === \"function\") {\n cb = x;\n h = null;\n w = null;\n y = null;\n x = null;\n } else {\n if (typeof size !== \"number\") {\n return throwError.call(this, \"size must be a number\", cb);\n }\n\n if (isDef(x) && typeof x !== \"number\") {\n return throwError.call(this, \"x must be a number\", cb);\n }\n\n if (isDef(y) && typeof y !== \"number\") {\n return throwError.call(this, \"y must be a number\", cb);\n }\n\n if (isDef(w) && typeof w !== \"number\") {\n return throwError.call(this, \"w must be a number\", cb);\n }\n\n if (isDef(h) && typeof h !== \"number\") {\n return throwError.call(this, \"h must be a number\", cb);\n }\n }\n\n const kernel = [\n [1 / 16, 2 / 16, 1 / 16],\n [2 / 16, 4 / 16, 2 / 16],\n [1 / 16, 2 / 16, 1 / 16],\n ];\n\n x = x || 0;\n y = y || 0;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n\n const source = this.cloneQuiet();\n\n this.scanQuiet(x, y, w, h, function (xx, yx, idx) {\n xx = size * Math.floor(xx / size);\n yx = size * Math.floor(yx / size);\n\n const value = applyKernel(source, kernel, xx, yx);\n\n this.bitmap.data[idx] = value[0];\n this.bitmap.data[idx + 1] = value[1];\n this.bitmap.data[idx + 2] = value[2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Applies a convolution kernel to the image or a region\n * @param {array} kernel the convolution kernel\n * @param {number} x (optional) the x position of the region to apply convolution to\n * @param {number} y (optional) the y position of the region to apply convolution to\n * @param {number} w (optional) the width of the region to apply convolution to\n * @param {number} h (optional) the height of the region to apply convolution to\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n convolute(kernel, x, y, w, h, cb) {\n if (!Array.isArray(kernel))\n return throwError.call(this, \"the kernel must be an array\", cb);\n\n if (typeof x === \"function\") {\n cb = x;\n x = null;\n y = null;\n w = null;\n h = null;\n } else {\n if (isDef(x) && typeof x !== \"number\") {\n return throwError.call(this, \"x must be a number\", cb);\n }\n\n if (isDef(y) && typeof y !== \"number\") {\n return throwError.call(this, \"y must be a number\", cb);\n }\n\n if (isDef(w) && typeof w !== \"number\") {\n return throwError.call(this, \"w must be a number\", cb);\n }\n\n if (isDef(h) && typeof h !== \"number\") {\n return throwError.call(this, \"h must be a number\", cb);\n }\n }\n\n x = isDef(x) ? x : 0;\n y = isDef(y) ? y : 0;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n\n const source = this.cloneQuiet();\n\n this.scanQuiet(x, y, w, h, function (xx, yx, idx) {\n const value = applyKernel(source, kernel, xx, yx);\n\n this.bitmap.data[idx] = this.constructor.limit255(value[0]);\n this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]);\n this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]);\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Apply multiple color modification rules\n * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] }\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n color: colorFn,\n colour: colorFn,\n});\n"],"mappings":";;;;;;AAAA;AACA;AAAwD;AAExD,SAASA,WAAW,CAACC,EAAE,EAAEC,MAAM,EAAEC,CAAC,EAAEC,CAAC,EAAE;EACrC,MAAMC,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;EACvB,MAAMC,IAAI,GAAG,CAACJ,MAAM,CAACK,MAAM,GAAG,CAAC,IAAI,CAAC;EAEpC,KAAK,IAAIC,EAAE,GAAG,CAAC,EAAEA,EAAE,GAAGN,MAAM,CAACK,MAAM,EAAEC,EAAE,IAAI,CAAC,EAAE;IAC5C,KAAK,IAAIC,EAAE,GAAG,CAAC,EAAEA,EAAE,GAAGP,MAAM,CAACM,EAAE,CAAC,CAACD,MAAM,EAAEE,EAAE,IAAI,CAAC,EAAE;MAChD,MAAMC,GAAG,GAAGT,EAAE,CAACU,aAAa,CAACR,CAAC,GAAGK,EAAE,GAAGF,IAAI,EAAEF,CAAC,GAAGK,EAAE,GAAGH,IAAI,CAAC;MAE1DD,KAAK,CAAC,CAAC,CAAC,IAAIJ,EAAE,CAACW,MAAM,CAACC,IAAI,CAACH,GAAG,CAAC,GAAGR,MAAM,CAACM,EAAE,CAAC,CAACC,EAAE,CAAC;MAChDJ,KAAK,CAAC,CAAC,CAAC,IAAIJ,EAAE,CAACW,MAAM,CAACC,IAAI,CAACH,GAAG,GAAG,CAAC,CAAC,GAAGR,MAAM,CAACM,EAAE,CAAC,CAACC,EAAE,CAAC;MACpDJ,KAAK,CAAC,CAAC,CAAC,IAAIJ,EAAE,CAACW,MAAM,CAACC,IAAI,CAACH,GAAG,GAAG,CAAC,CAAC,GAAGR,MAAM,CAACM,EAAE,CAAC,CAACC,EAAE,CAAC;IACtD;EAC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;IAEF,IAAI,IAAAkB,oBAAa,EAACN,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACO,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACE6F,KAAK,EAAErF,OAAO;EACdsF,MAAM,EAAEtF;AACV,CAAC,CAAC;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-color/es/index.js b/project starter code/node_modules/@jimp/plugin-color/es/index.js index 2992500a..a10ba164 100644 --- a/project starter code/node_modules/@jimp/plugin-color/es/index.js +++ b/project starter code/node_modules/@jimp/plugin-color/es/index.js @@ -1,566 +1,477 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - -var _tinycolor = _interopRequireDefault(require("tinycolor2")); - -var _utils = require("@jimp/utils"); - +import tinyColor from "tinycolor2"; +import { throwError, isNodePattern } from "@jimp/utils"; function applyKernel(im, kernel, x, y) { - var value = [0, 0, 0]; - var size = (kernel.length - 1) / 2; - - for (var kx = 0; kx < kernel.length; kx += 1) { - for (var ky = 0; ky < kernel[kx].length; ky += 1) { - var idx = im.getPixelIndex(x + kx - size, y + ky - size); + const value = [0, 0, 0]; + const size = (kernel.length - 1) / 2; + for (let kx = 0; kx < kernel.length; kx += 1) { + for (let ky = 0; ky < kernel[kx].length; ky += 1) { + const idx = im.getPixelIndex(x + kx - size, y + ky - size); value[0] += im.bitmap.data[idx] * kernel[kx][ky]; value[1] += im.bitmap.data[idx + 1] * kernel[kx][ky]; value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky]; } } - return value; } - -var isDef = function isDef(v) { - return typeof v !== 'undefined' && v !== null; -}; - +const isDef = v => typeof v !== "undefined" && v !== null; function greyscale(cb) { this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var grey = parseInt(0.2126 * this.bitmap.data[idx] + 0.7152 * this.bitmap.data[idx + 1] + 0.0722 * this.bitmap.data[idx + 2], 10); + const grey = parseInt(0.2126 * this.bitmap.data[idx] + 0.7152 * this.bitmap.data[idx + 1] + 0.0722 * this.bitmap.data[idx + 2], 10); this.bitmap.data[idx] = grey; this.bitmap.data[idx + 1] = grey; this.bitmap.data[idx + 2] = grey; }); - - if ((0, _utils.isNodePattern)(cb)) { + if (isNodePattern(cb)) { cb.call(this, null, this); } - return this; } - function mix(clr, clr2) { - var p = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50; + let p = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50; return { r: (clr2.r - clr.r) * (p / 100) + clr.r, g: (clr2.g - clr.g) * (p / 100) + clr.g, b: (clr2.b - clr.b) * (p / 100) + clr.b }; } - function colorFn(actions, cb) { - var _this = this; - if (!actions || !Array.isArray(actions)) { - return _utils.throwError.call(this, 'actions must be an array', cb); + return throwError.call(this, "actions must be an array", cb); } - - actions = actions.map(function (action) { - if (action.apply === 'xor' || action.apply === 'mix') { - action.params[0] = (0, _tinycolor["default"])(action.params[0]).toRgb(); + actions = actions.map(action => { + if (action.apply === "xor" || action.apply === "mix") { + action.params[0] = tinyColor(action.params[0]).toRgb(); } - return action; }); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var clr = { - r: _this.bitmap.data[idx], - g: _this.bitmap.data[idx + 1], - b: _this.bitmap.data[idx + 2] - }; - - var colorModifier = function colorModifier(i, amount) { - return _this.constructor.limit255(clr[i] + amount); + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => { + let clr = { + r: this.bitmap.data[idx], + g: this.bitmap.data[idx + 1], + b: this.bitmap.data[idx + 2] }; - - actions.forEach(function (action) { - if (action.apply === 'mix') { + const colorModifier = (i, amount) => this.constructor.limit255(clr[i] + amount); + actions.forEach(action => { + if (action.apply === "mix") { clr = mix(clr, action.params[0], action.params[1]); - } else if (action.apply === 'tint') { + } else if (action.apply === "tint") { clr = mix(clr, { r: 255, g: 255, b: 255 }, action.params[0]); - } else if (action.apply === 'shade') { + } else if (action.apply === "shade") { clr = mix(clr, { r: 0, g: 0, b: 0 }, action.params[0]); - } else if (action.apply === 'xor') { + } else if (action.apply === "xor") { clr = { r: clr.r ^ action.params[0].r, g: clr.g ^ action.params[0].g, b: clr.b ^ action.params[0].b }; - } else if (action.apply === 'red') { - clr.r = colorModifier('r', action.params[0]); - } else if (action.apply === 'green') { - clr.g = colorModifier('g', action.params[0]); - } else if (action.apply === 'blue') { - clr.b = colorModifier('b', action.params[0]); + } else if (action.apply === "red") { + clr.r = colorModifier("r", action.params[0]); + } else if (action.apply === "green") { + clr.g = colorModifier("g", action.params[0]); + } else if (action.apply === "blue") { + clr.b = colorModifier("b", action.params[0]); } else { - var _clr; - - if (action.apply === 'hue') { - action.apply = 'spin'; + if (action.apply === "hue") { + action.apply = "spin"; } - - clr = (0, _tinycolor["default"])(clr); - + clr = tinyColor(clr); if (!clr[action.apply]) { - return _utils.throwError.call(_this, 'action ' + action.apply + ' not supported', cb); + return throwError.call(this, "action " + action.apply + " not supported", cb); } - - clr = (_clr = clr)[action.apply].apply(_clr, (0, _toConsumableArray2["default"])(action.params)).toRgb(); + clr = clr[action.apply](...action.params).toRgb(); } }); - _this.bitmap.data[idx] = clr.r; - _this.bitmap.data[idx + 1] = clr.g; - _this.bitmap.data[idx + 2] = clr.b; + this.bitmap.data[idx] = clr.r; + this.bitmap.data[idx + 1] = clr.g; + this.bitmap.data[idx + 2] = clr.b; }); - - if ((0, _utils.isNodePattern)(cb)) { + if (isNodePattern(cb)) { cb.call(this, null, this); } - return this; } - -var _default = function _default() { - return { - /** - * Adjusts the brightness of the image - * @param {number} val the amount to adjust the brightness, a number between -1 and +1 - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - brightness: function brightness(val, cb) { - if (typeof val !== 'number') { - return _utils.throwError.call(this, 'val must be numbers', cb); - } - - if (val < -1 || val > +1) { - return _utils.throwError.call(this, 'val must be a number between -1 and +1', cb); +export const ColorActionName = Object.freeze({ + LIGHTEN: "lighten", + BRIGHTEN: "brighten", + DARKEN: "darken", + DESATURATE: "desaturate", + SATURATE: "saturate", + GREYSCALE: "greyscale", + SPIN: "spin", + HUE: "hue", + MIX: "mix", + TINT: "tint", + SHADE: "shade", + XOR: "xor", + RED: "red", + GREEN: "green", + BLUE: "blue" +}); +export default (() => ({ + /** + * Adjusts the brightness of the image + * @param {number} val the amount to adjust the brightness, a number between -1 and +1 + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + brightness(val, cb) { + if (typeof val !== "number") { + return throwError.call(this, "val must be numbers", cb); + } + if (val < -1 || val > +1) { + return throwError.call(this, "val must be a number between -1 and +1", cb); + } + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + if (val < 0.0) { + this.bitmap.data[idx] *= 1 + val; + this.bitmap.data[idx + 1] *= 1 + val; + this.bitmap.data[idx + 2] *= 1 + val; + } else { + this.bitmap.data[idx] += (255 - this.bitmap.data[idx]) * val; + this.bitmap.data[idx + 1] += (255 - this.bitmap.data[idx + 1]) * val; + this.bitmap.data[idx + 2] += (255 - this.bitmap.data[idx + 2]) * val; } + }); + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Adjusts the contrast of the image + * @param {number} val the amount to adjust the contrast, a number between -1 and +1 + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + contrast(val, cb) { + if (typeof val !== "number") { + return throwError.call(this, "val must be numbers", cb); + } + if (val < -1 || val > +1) { + return throwError.call(this, "val must be a number between -1 and +1", cb); + } + const factor = (val + 1) / (1 - val); + function adjust(value) { + value = Math.floor(factor * (value - 127) + 127); + return value < 0 ? 0 : value > 255 ? 255 : value; + } + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + this.bitmap.data[idx] = adjust(this.bitmap.data[idx]); + this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]); + this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]); + }); + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Apply a posterize effect + * @param {number} n the amount to adjust the contrast, minimum threshold is two + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + posterize(n, cb) { + if (typeof n !== "number") { + return throwError.call(this, "n must be numbers", cb); + } + if (n < 2) { + n = 2; + } // minimum of 2 levels + + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + this.bitmap.data[idx] = Math.floor(this.bitmap.data[idx] / 255 * (n - 1)) / (n - 1) * 255; + this.bitmap.data[idx + 1] = Math.floor(this.bitmap.data[idx + 1] / 255 * (n - 1)) / (n - 1) * 255; + this.bitmap.data[idx + 2] = Math.floor(this.bitmap.data[idx + 2] / 255 * (n - 1)) / (n - 1) * 255; + }); + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Removes colour from the image using ITU Rec 709 luminance values + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + greyscale, + // Alias of greyscale for our American friends + grayscale: greyscale, + /** + * Multiplies the opacity of each pixel by a factor between 0 and 1 + * @param {number} f A number, the factor by which to multiply the opacity of each pixel + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + opacity(f, cb) { + if (typeof f !== "number") return throwError.call(this, "f must be a number", cb); + if (f < 0 || f > 1) return throwError.call(this, "f must be a number from 0 to 1", cb); + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + const v = this.bitmap.data[idx + 3] * f; + this.bitmap.data[idx + 3] = v; + }); + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Applies a sepia tone to the image + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + sepia(cb) { + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + let red = this.bitmap.data[idx]; + let green = this.bitmap.data[idx + 1]; + let blue = this.bitmap.data[idx + 2]; + red = red * 0.393 + green * 0.769 + blue * 0.189; + green = red * 0.349 + green * 0.686 + blue * 0.168; + blue = red * 0.272 + green * 0.534 + blue * 0.131; + this.bitmap.data[idx] = red < 255 ? red : 255; + this.bitmap.data[idx + 1] = green < 255 ? green : 255; + this.bitmap.data[idx + 2] = blue < 255 ? blue : 255; + }); + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Fades each pixel by a factor between 0 and 1 + * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent. + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + fade(f, cb) { + if (typeof f !== "number") { + return throwError.call(this, "f must be a number", cb); + } + if (f < 0 || f > 1) { + return throwError.call(this, "f must be a number from 0 to 1", cb); + } - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - if (val < 0.0) { - this.bitmap.data[idx] = this.bitmap.data[idx] * (1 + val); - this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] * (1 + val); - this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] * (1 + val); - } else { - this.bitmap.data[idx] = this.bitmap.data[idx] + (255 - this.bitmap.data[idx]) * val; - this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] + (255 - this.bitmap.data[idx + 1]) * val; - this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] + (255 - this.bitmap.data[idx + 2]) * val; + // this method is an alternative to opacity (which may be deprecated) + this.opacity(1 - f); + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Adds each element of the image to its local neighbors, weighted by the kernel + * @param {array} kernel a matrix to weight the neighbors sum + * @param {number} edgeHandling (optional) define how to sum pixels from outside the border + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + convolution(kernel, edgeHandling, cb) { + if (typeof edgeHandling === "function" && typeof cb === "undefined") { + cb = edgeHandling; + edgeHandling = null; + } + if (!edgeHandling) { + edgeHandling = this.constructor.EDGE_EXTEND; + } + const newData = Buffer.from(this.bitmap.data); + const kRows = kernel.length; + const kCols = kernel[0].length; + const rowEnd = Math.floor(kRows / 2); + const colEnd = Math.floor(kCols / 2); + const rowIni = -rowEnd; + const colIni = -colEnd; + let weight; + let rSum; + let gSum; + let bSum; + let ri; + let gi; + let bi; + let xi; + let yi; + let idxi; + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + bSum = 0; + gSum = 0; + rSum = 0; + for (let row = rowIni; row <= rowEnd; row++) { + for (let col = colIni; col <= colEnd; col++) { + xi = x + col; + yi = y + row; + weight = kernel[row + rowEnd][col + colEnd]; + idxi = this.getPixelIndex(xi, yi, edgeHandling); + if (idxi === -1) { + bi = 0; + gi = 0; + ri = 0; + } else { + ri = this.bitmap.data[idxi + 0]; + gi = this.bitmap.data[idxi + 1]; + bi = this.bitmap.data[idxi + 2]; + } + rSum += weight * ri; + gSum += weight * gi; + bSum += weight * bi; } - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Adjusts the contrast of the image - * @param {number} val the amount to adjust the contrast, a number between -1 and +1 - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - contrast: function contrast(val, cb) { - if (typeof val !== 'number') { - return _utils.throwError.call(this, 'val must be numbers', cb); } - - if (val < -1 || val > +1) { - return _utils.throwError.call(this, 'val must be a number between -1 and +1', cb); + if (rSum < 0) { + rSum = 0; } - - var factor = (val + 1) / (1 - val); - - function adjust(value) { - value = Math.floor(factor * (value - 127) + 127); - return value < 0 ? 0 : value > 255 ? 255 : value; + if (gSum < 0) { + gSum = 0; } - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data[idx] = adjust(this.bitmap.data[idx]); - this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]); - this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); + if (bSum < 0) { + bSum = 0; } - - return this; - }, - - /** - * Apply a posterize effect - * @param {number} n the amount to adjust the contrast, minimum threshold is two - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - posterize: function posterize(n, cb) { - if (typeof n !== 'number') { - return _utils.throwError.call(this, 'n must be numbers', cb); + if (rSum > 255) { + rSum = 255; } - - if (n < 2) { - n = 2; - } // minimum of 2 levels - - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data[idx] = Math.floor(this.bitmap.data[idx] / 255 * (n - 1)) / (n - 1) * 255; - this.bitmap.data[idx + 1] = Math.floor(this.bitmap.data[idx + 1] / 255 * (n - 1)) / (n - 1) * 255; - this.bitmap.data[idx + 2] = Math.floor(this.bitmap.data[idx + 2] / 255 * (n - 1)) / (n - 1) * 255; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); + if (gSum > 255) { + gSum = 255; } - - return this; - }, - - /** - * Removes colour from the image using ITU Rec 709 luminance values - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - greyscale: greyscale, - // Alias of greyscale for our American friends - grayscale: greyscale, - - /** - * Multiplies the opacity of each pixel by a factor between 0 and 1 - * @param {number} f A number, the factor by which to multiply the opacity of each pixel - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - opacity: function opacity(f, cb) { - if (typeof f !== 'number') return _utils.throwError.call(this, 'f must be a number', cb); - if (f < 0 || f > 1) return _utils.throwError.call(this, 'f must be a number from 0 to 1', cb); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var v = this.bitmap.data[idx + 3] * f; - this.bitmap.data[idx + 3] = v; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); + if (bSum > 255) { + bSum = 255; } - - return this; - }, - - /** - * Applies a sepia tone to the image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - sepia: function sepia(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var red = this.bitmap.data[idx]; - var green = this.bitmap.data[idx + 1]; - var blue = this.bitmap.data[idx + 2]; - red = red * 0.393 + green * 0.769 + blue * 0.189; - green = red * 0.349 + green * 0.686 + blue * 0.168; - blue = red * 0.272 + green * 0.534 + blue * 0.131; - this.bitmap.data[idx] = red < 255 ? red : 255; - this.bitmap.data[idx + 1] = green < 255 ? green : 255; - this.bitmap.data[idx + 2] = blue < 255 ? blue : 255; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Fades each pixel by a factor between 0 and 1 - * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - fade: function fade(f, cb) { - if (typeof f !== 'number') { - return _utils.throwError.call(this, 'f must be a number', cb); + newData[idx + 0] = rSum; + newData[idx + 1] = gSum; + newData[idx + 2] = bSum; + }); + this.bitmap.data = newData; + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Set the alpha channel on every pixel to fully opaque + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + opaque(cb) { + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + this.bitmap.data[idx + 3] = 255; + }); + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Pixelates the image or a region + * @param {number} size the size of the pixels + * @param {number} x (optional) the x position of the region to pixelate + * @param {number} y (optional) the y position of the region to pixelate + * @param {number} w (optional) the width of the region to pixelate + * @param {number} h (optional) the height of the region to pixelate + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + pixelate(size, x, y, w, h, cb) { + if (typeof x === "function") { + cb = x; + h = null; + w = null; + y = null; + x = null; + } else { + if (typeof size !== "number") { + return throwError.call(this, "size must be a number", cb); } - - if (f < 0 || f > 1) { - return _utils.throwError.call(this, 'f must be a number from 0 to 1', cb); - } // this method is an alternative to opacity (which may be deprecated) - - - this.opacity(1 - f); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); + if (isDef(x) && typeof x !== "number") { + return throwError.call(this, "x must be a number", cb); } - - return this; - }, - - /** - * Adds each element of the image to its local neighbors, weighted by the kernel - * @param {array} kernel a matrix to weight the neighbors sum - * @param {string} edgeHandling (optional) define how to sum pixels from outside the border - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - convolution: function convolution(kernel, edgeHandling, cb) { - if (typeof edgeHandling === 'function' && typeof cb === 'undefined') { - cb = edgeHandling; - edgeHandling = null; + if (isDef(y) && typeof y !== "number") { + return throwError.call(this, "y must be a number", cb); } - - if (!edgeHandling) { - edgeHandling = this.constructor.EDGE_EXTEND; + if (isDef(w) && typeof w !== "number") { + return throwError.call(this, "w must be a number", cb); } - - var newData = Buffer.from(this.bitmap.data); - var kRows = kernel.length; - var kCols = kernel[0].length; - var rowEnd = Math.floor(kRows / 2); - var colEnd = Math.floor(kCols / 2); - var rowIni = -rowEnd; - var colIni = -colEnd; - var weight; - var rSum; - var gSum; - var bSum; - var ri; - var gi; - var bi; - var xi; - var yi; - var idxi; - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - bSum = 0; - gSum = 0; - rSum = 0; - - for (var row = rowIni; row <= rowEnd; row++) { - for (var col = colIni; col <= colEnd; col++) { - xi = x + col; - yi = y + row; - weight = kernel[row + rowEnd][col + colEnd]; - idxi = this.getPixelIndex(xi, yi, edgeHandling); - - if (idxi === -1) { - bi = 0; - gi = 0; - ri = 0; - } else { - ri = this.bitmap.data[idxi + 0]; - gi = this.bitmap.data[idxi + 1]; - bi = this.bitmap.data[idxi + 2]; - } - - rSum += weight * ri; - gSum += weight * gi; - bSum += weight * bi; - } - } - - if (rSum < 0) { - rSum = 0; - } - - if (gSum < 0) { - gSum = 0; - } - - if (bSum < 0) { - bSum = 0; - } - - if (rSum > 255) { - rSum = 255; - } - - if (gSum > 255) { - gSum = 255; - } - - if (bSum > 255) { - bSum = 255; - } - - newData[idx + 0] = rSum; - newData[idx + 1] = gSum; - newData[idx + 2] = bSum; - }); - this.bitmap.data = newData; - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); + if (isDef(h) && typeof h !== "number") { + return throwError.call(this, "h must be a number", cb); } - - return this; - }, - - /** - * Set the alpha channel on every pixel to fully opaque - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - opaque: function opaque(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data[idx + 3] = 255; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); + } + const kernel = [[1 / 16, 2 / 16, 1 / 16], [2 / 16, 4 / 16, 2 / 16], [1 / 16, 2 / 16, 1 / 16]]; + x = x || 0; + y = y || 0; + w = isDef(w) ? w : this.bitmap.width - x; + h = isDef(h) ? h : this.bitmap.height - y; + const source = this.cloneQuiet(); + this.scanQuiet(x, y, w, h, function (xx, yx, idx) { + xx = size * Math.floor(xx / size); + yx = size * Math.floor(yx / size); + const value = applyKernel(source, kernel, xx, yx); + this.bitmap.data[idx] = value[0]; + this.bitmap.data[idx + 1] = value[1]; + this.bitmap.data[idx + 2] = value[2]; + }); + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Applies a convolution kernel to the image or a region + * @param {array} kernel the convolution kernel + * @param {number} x (optional) the x position of the region to apply convolution to + * @param {number} y (optional) the y position of the region to apply convolution to + * @param {number} w (optional) the width of the region to apply convolution to + * @param {number} h (optional) the height of the region to apply convolution to + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + convolute(kernel, x, y, w, h, cb) { + if (!Array.isArray(kernel)) return throwError.call(this, "the kernel must be an array", cb); + if (typeof x === "function") { + cb = x; + x = null; + y = null; + w = null; + h = null; + } else { + if (isDef(x) && typeof x !== "number") { + return throwError.call(this, "x must be a number", cb); } - - return this; - }, - - /** - * Pixelates the image or a region - * @param {number} size the size of the pixels - * @param {number} x (optional) the x position of the region to pixelate - * @param {number} y (optional) the y position of the region to pixelate - * @param {number} w (optional) the width of the region to pixelate - * @param {number} h (optional) the height of the region to pixelate - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - pixelate: function pixelate(size, x, y, w, h, cb) { - if (typeof x === 'function') { - cb = x; - h = null; - w = null; - y = null; - x = null; - } else { - if (typeof size !== 'number') { - return _utils.throwError.call(this, 'size must be a number', cb); - } - - if (isDef(x) && typeof x !== 'number') { - return _utils.throwError.call(this, 'x must be a number', cb); - } - - if (isDef(y) && typeof y !== 'number') { - return _utils.throwError.call(this, 'y must be a number', cb); - } - - if (isDef(w) && typeof w !== 'number') { - return _utils.throwError.call(this, 'w must be a number', cb); - } - - if (isDef(h) && typeof h !== 'number') { - return _utils.throwError.call(this, 'h must be a number', cb); - } + if (isDef(y) && typeof y !== "number") { + return throwError.call(this, "y must be a number", cb); } - - var kernel = [[1 / 16, 2 / 16, 1 / 16], [2 / 16, 4 / 16, 2 / 16], [1 / 16, 2 / 16, 1 / 16]]; - x = x || 0; - y = y || 0; - w = isDef(w) ? w : this.bitmap.width - x; - h = isDef(h) ? h : this.bitmap.height - y; - var source = this.cloneQuiet(); - this.scanQuiet(x, y, w, h, function (xx, yx, idx) { - xx = size * Math.floor(xx / size); - yx = size * Math.floor(yx / size); - var value = applyKernel(source, kernel, xx, yx); - this.bitmap.data[idx] = value[0]; - this.bitmap.data[idx + 1] = value[1]; - this.bitmap.data[idx + 2] = value[2]; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); + if (isDef(w) && typeof w !== "number") { + return throwError.call(this, "w must be a number", cb); } - - return this; - }, - - /** - * Applies a convolution kernel to the image or a region - * @param {array} kernel the convolution kernel - * @param {number} x (optional) the x position of the region to apply convolution to - * @param {number} y (optional) the y position of the region to apply convolution to - * @param {number} w (optional) the width of the region to apply convolution to - * @param {number} h (optional) the height of the region to apply convolution to - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - convolute: function convolute(kernel, x, y, w, h, cb) { - if (!Array.isArray(kernel)) return _utils.throwError.call(this, 'the kernel must be an array', cb); - - if (typeof x === 'function') { - cb = x; - x = null; - y = null; - w = null; - h = null; - } else { - if (isDef(x) && typeof x !== 'number') { - return _utils.throwError.call(this, 'x must be a number', cb); - } - - if (isDef(y) && typeof y !== 'number') { - return _utils.throwError.call(this, 'y must be a number', cb); - } - - if (isDef(w) && typeof w !== 'number') { - return _utils.throwError.call(this, 'w must be a number', cb); - } - - if (isDef(h) && typeof h !== 'number') { - return _utils.throwError.call(this, 'h must be a number', cb); - } + if (isDef(h) && typeof h !== "number") { + return throwError.call(this, "h must be a number", cb); } - - var ksize = (kernel.length - 1) / 2; - x = isDef(x) ? x : ksize; - y = isDef(y) ? y : ksize; - w = isDef(w) ? w : this.bitmap.width - x; - h = isDef(h) ? h : this.bitmap.height - y; - var source = this.cloneQuiet(); - this.scanQuiet(x, y, w, h, function (xx, yx, idx) { - var value = applyKernel(source, kernel, xx, yx); - this.bitmap.data[idx] = this.constructor.limit255(value[0]); - this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]); - this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Apply multiple color modification rules - * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] } - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - color: colorFn, - colour: colorFn - }; -}; - -exports["default"] = _default; + } + x = isDef(x) ? x : 0; + y = isDef(y) ? y : 0; + w = isDef(w) ? w : this.bitmap.width - x; + h = isDef(h) ? h : this.bitmap.height - y; + const source = this.cloneQuiet(); + this.scanQuiet(x, y, w, h, function (xx, yx, idx) { + const value = applyKernel(source, kernel, xx, yx); + this.bitmap.data[idx] = this.constructor.limit255(value[0]); + this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]); + this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]); + }); + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Apply multiple color modification rules + * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] } + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp }this for chaining of methods + */ + color: colorFn, + colour: colorFn +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-color/es/index.js.map b/project starter code/node_modules/@jimp/plugin-color/es/index.js.map index 00325b53..6af0367a 100644 --- a/project starter code/node_modules/@jimp/plugin-color/es/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-color/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["applyKernel","im","kernel","x","y","value","size","length","kx","ky","idx","getPixelIndex","bitmap","data","isDef","v","greyscale","cb","scanQuiet","width","height","grey","parseInt","call","mix","clr","clr2","p","r","g","b","colorFn","actions","Array","isArray","throwError","map","action","apply","params","toRgb","colorModifier","i","amount","constructor","limit255","forEach","brightness","val","contrast","factor","adjust","Math","floor","posterize","n","grayscale","opacity","f","sepia","red","green","blue","fade","convolution","edgeHandling","EDGE_EXTEND","newData","Buffer","from","kRows","kCols","rowEnd","colEnd","rowIni","colIni","weight","rSum","gSum","bSum","ri","gi","bi","xi","yi","idxi","row","col","opaque","pixelate","w","h","source","cloneQuiet","xx","yx","convolute","ksize","color","colour"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,SAASA,WAAT,CAAqBC,EAArB,EAAyBC,MAAzB,EAAiCC,CAAjC,EAAoCC,CAApC,EAAuC;AACrC,MAAMC,KAAK,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAAd;AACA,MAAMC,IAAI,GAAG,CAACJ,MAAM,CAACK,MAAP,GAAgB,CAAjB,IAAsB,CAAnC;;AAEA,OAAK,IAAIC,EAAE,GAAG,CAAd,EAAiBA,EAAE,GAAGN,MAAM,CAACK,MAA7B,EAAqCC,EAAE,IAAI,CAA3C,EAA8C;AAC5C,SAAK,IAAIC,EAAE,GAAG,CAAd,EAAiBA,EAAE,GAAGP,MAAM,CAACM,EAAD,CAAN,CAAWD,MAAjC,EAAyCE,EAAE,IAAI,CAA/C,EAAkD;AAChD,UAAMC,GAAG,GAAGT,EAAE,CAACU,aAAH,CAAiBR,CAAC,GAAGK,EAAJ,GAASF,IAA1B,EAAgCF,CAAC,GAAGK,EAAJ,GAASH,IAAzC,CAAZ;AAEAD,MAAAA,KAAK,CAAC,CAAD,CAAL,IAAYJ,EAAE,CAACW,MAAH,CAAUC,IAAV,CAAeH,GAAf,IAAsBR,MAAM,CAACM,EAAD,CAAN,CAAWC,EAAX,CAAlC;AACAJ,MAAAA,KAAK,CAAC,CAAD,CAAL,IAAYJ,EAAE,CAACW,MAAH,CAAUC,IAAV,CAAeH,GAAG,GAAG,CAArB,IAA0BR,MAAM,CAACM,EAAD,CAAN,CAAWC,EAAX,CAAtC;AACAJ,MAAAA,KAAK,CAAC,CAAD,CAAL,IA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AM,GAAG,KAAKC,UAAL,EAAf;AAEA,WAAK3E,SAAL,CAAef,CAAf,EAAkBC,CAAlB,EAAqBsF,CAArB,EAAwBC,CAAxB,EAA2B,UAASG,EAAT,EAAaC,EAAb,EAAiBrF,GAAjB,EAAsB;AAC/C,YAAML,KAAK,GAAGL,WAAW,CAAC4F,MAAD,EAAS1F,MAAT,EAAiB4F,EAAjB,EAAqBC,EAArB,CAAzB;AAEA,aAAKnF,MAAL,CAAYC,IAAZ,CAAiBH,GAAjB,IAAwB,KAAKkC,WAAL,CAAiBC,QAAjB,CAA0BxC,KAAK,CAAC,CAAD,CAA/B,CAAxB;AACA,aAAKO,MAAL,CAAYC,IAAZ,CAAiBH,GAAG,GAAG,CAAvB,IAA4B,KAAKkC,WAAL,CAAiBC,QAAjB,CAA0BxC,KAAK,CAAC,CAAD,CAA/B,CAA5B;AACA,aAAKO,MAAL,CAAYC,IAAZ,CAAiBH,GAAG,GAAG,CAAvB,IAA4B,KAAKkC,WAAL,CAAiBC,QAAjB,CAA0BxC,KAAK,CAAC,CAAD,CAA/B,CAA5B;AACD,OAND;;AAQA,UAAI,0BAAcY,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACM,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD,KA9dmB;;AAgepB;;;;;;AAMA2E,IAAAA,KAAK,EAAEnE,OAtea;AAuepBoE,IAAAA,MAAM,EAAEpE;AAveY,GAAP;AAAA,C","sourcesContent":["import tinyColor from 'tinycolor2';\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nfunction applyKernel(im, kernel, x, y) {\n const value = [0, 0, 0];\n const size = (kernel.length - 1) / 2;\n\n for (let kx = 0; kx < kernel.length; kx += 1) {\n for (let ky = 0; ky < kernel[kx].length; ky += 1) {\n const idx = im.getPixelIndex(x + kx - size, y + ky - size);\n\n value[0] += im.bitmap.data[idx] * kernel[kx][ky];\n value[1] += im.bitmap.data[idx + 1] * kernel[kx][ky];\n value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky];\n }\n }\n\n return value;\n}\n\nconst isDef = v => typeof v !== 'undefined' && v !== null;\n\nfunction greyscale(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const grey = parseInt(\n 0.2126 * this.bitmap.data[idx] +\n 0.7152 * this.bitmap.data[idx + 1] +\n 0.0722 * this.bitmap.data[idx + 2],\n 10\n );\n\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nfunction mix(clr, clr2, p = 50) {\n return {\n r: (clr2.r - clr.r) * (p / 100) + clr.r,\n g: (clr2.g - clr.g) * (p / 100) + clr.g,\n b: (clr2.b - clr.b) * (p / 100) + clr.b\n };\n}\n\nfunction colorFn(actions, cb) {\n if (!actions || !Array.isArray(actions)) {\n return throwError.call(this, 'actions must be an array', cb);\n }\n\n actions = actions.map(action => {\n if (action.apply === 'xor' || action.apply === 'mix') {\n action.params[0] = tinyColor(action.params[0]).toRgb();\n }\n\n return action;\n });\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n let clr = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2]\n };\n\n const colorModifier = (i, amount) =>\n this.constructor.limit255(clr[i] + amount);\n\n actions.forEach(action => {\n if (action.apply === 'mix') {\n clr = mix(clr, action.params[0], action.params[1]);\n } else if (action.apply === 'tint') {\n clr = mix(clr, { r: 255, g: 255, b: 255 }, action.params[0]);\n } else if (action.apply === 'shade') {\n clr = mix(clr, { r: 0, g: 0, b: 0 }, action.params[0]);\n } else if (action.apply === 'xor') {\n clr = {\n r: clr.r ^ action.params[0].r,\n g: clr.g ^ action.params[0].g,\n b: clr.b ^ action.params[0].b\n };\n } else if (action.apply === 'red') {\n clr.r = colorModifier('r', action.params[0]);\n } else if (action.apply === 'green') {\n clr.g = colorModifier('g', action.params[0]);\n } else if (action.apply === 'blue') {\n clr.b = colorModifier('b', action.params[0]);\n } else {\n if (action.apply === 'hue') {\n action.apply = 'spin';\n }\n\n clr = tinyColor(clr);\n\n if (!clr[action.apply]) {\n return throwError.call(\n this,\n 'action ' + action.apply + ' not supported',\n cb\n );\n }\n\n clr = clr[action.apply](...action.params).toRgb();\n }\n });\n\n this.bitmap.data[idx] = clr.r;\n this.bitmap.data[idx + 1] = clr.g;\n this.bitmap.data[idx + 2] = clr.b;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n /**\n * Adjusts the brightness of the image\n * @param {number} val the amount to adjust the brightness, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n brightness(val, cb) {\n if (typeof val !== 'number') {\n return throwError.call(this, 'val must be numbers', cb);\n }\n\n if (val < -1 || val > +1) {\n return throwError.call(\n this,\n 'val must be a number between -1 and +1',\n cb\n );\n }\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n if (val < 0.0) {\n this.bitmap.data[idx] = this.bitmap.data[idx] * (1 + val);\n this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] * (1 + val);\n this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] * (1 + val);\n } else {\n this.bitmap.data[idx] =\n this.bitmap.data[idx] + (255 - this.bitmap.data[idx]) * val;\n this.bitmap.data[idx + 1] =\n this.bitmap.data[idx + 1] + (255 - this.bitmap.data[idx + 1]) * val;\n this.bitmap.data[idx + 2] =\n this.bitmap.data[idx + 2] + (255 - this.bitmap.data[idx + 2]) * val;\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Adjusts the contrast of the image\n * @param {number} val the amount to adjust the contrast, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n contrast(val, cb) {\n if (typeof val !== 'number') {\n return throwError.call(this, 'val must be numbers', cb);\n }\n\n if (val < -1 || val > +1) {\n return throwError.call(\n this,\n 'val must be a number between -1 and +1',\n cb\n );\n }\n\n const factor = (val + 1) / (1 - val);\n\n function adjust(value) {\n value = Math.floor(factor * (value - 127) + 127);\n\n return value < 0 ? 0 : value > 255 ? 255 : value;\n }\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx] = adjust(this.bitmap.data[idx]);\n this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]);\n this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]);\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Apply a posterize effect\n * @param {number} n the amount to adjust the contrast, minimum threshold is two\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n posterize(n, cb) {\n if (typeof n !== 'number') {\n return throwError.call(this, 'n must be numbers', cb);\n }\n\n if (n < 2) {\n n = 2;\n } // minimum of 2 levels\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx] =\n (Math.floor((this.bitmap.data[idx] / 255) * (n - 1)) / (n - 1)) * 255;\n this.bitmap.data[idx + 1] =\n (Math.floor((this.bitmap.data[idx + 1] / 255) * (n - 1)) / (n - 1)) *\n 255;\n this.bitmap.data[idx + 2] =\n (Math.floor((this.bitmap.data[idx + 2] / 255) * (n - 1)) / (n - 1)) *\n 255;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Removes colour from the image using ITU Rec 709 luminance values\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n greyscale,\n\n // Alias of greyscale for our American friends\n grayscale: greyscale,\n\n /**\n * Multiplies the opacity of each pixel by a factor between 0 and 1\n * @param {number} f A number, the factor by which to multiply the opacity of each pixel\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opacity(f, cb) {\n if (typeof f !== 'number')\n return throwError.call(this, 'f must be a number', cb);\n if (f < 0 || f > 1)\n return throwError.call(this, 'f must be a number from 0 to 1', cb);\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const v = this.bitmap.data[idx + 3] * f;\n this.bitmap.data[idx + 3] = v;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Applies a sepia tone to the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n sepia(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n let red = this.bitmap.data[idx];\n let green = this.bitmap.data[idx + 1];\n let blue = this.bitmap.data[idx + 2];\n\n red = red * 0.393 + green * 0.769 + blue * 0.189;\n green = red * 0.349 + green * 0.686 + blue * 0.168;\n blue = red * 0.272 + green * 0.534 + blue * 0.131;\n\n this.bitmap.data[idx] = red < 255 ? red : 255;\n this.bitmap.data[idx + 1] = green < 255 ? green : 255;\n this.bitmap.data[idx + 2] = blue < 255 ? blue : 255;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Fades each pixel by a factor between 0 and 1\n * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n fade(f, cb) {\n if (typeof f !== 'number') {\n return throwError.call(this, 'f must be a number', cb);\n }\n\n if (f < 0 || f > 1) {\n return throwError.call(this, 'f must be a number from 0 to 1', cb);\n }\n\n // this method is an alternative to opacity (which may be deprecated)\n this.opacity(1 - f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Adds each element of the image to its local neighbors, weighted by the kernel\n * @param {array} kernel a matrix to weight the neighbors sum\n * @param {string} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n convolution(kernel, edgeHandling, cb) {\n if (typeof edgeHandling === 'function' && typeof cb === 'undefined') {\n cb = edgeHandling;\n edgeHandling = null;\n }\n\n if (!edgeHandling) {\n edgeHandling = this.constructor.EDGE_EXTEND;\n }\n\n const newData = Buffer.from(this.bitmap.data);\n const kRows = kernel.length;\n const kCols = kernel[0].length;\n const rowEnd = Math.floor(kRows / 2);\n const colEnd = Math.floor(kCols / 2);\n const rowIni = -rowEnd;\n const colIni = -colEnd;\n\n let weight;\n let rSum;\n let gSum;\n let bSum;\n let ri;\n let gi;\n let bi;\n let xi;\n let yi;\n let idxi;\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n bSum = 0;\n gSum = 0;\n rSum = 0;\n\n for (let row = rowIni; row <= rowEnd; row++) {\n for (let col = colIni; col <= colEnd; col++) {\n xi = x + col;\n yi = y + row;\n weight = kernel[row + rowEnd][col + colEnd];\n idxi = this.getPixelIndex(xi, yi, edgeHandling);\n\n if (idxi === -1) {\n bi = 0;\n gi = 0;\n ri = 0;\n } else {\n ri = this.bitmap.data[idxi + 0];\n gi = this.bitmap.data[idxi + 1];\n bi = this.bitmap.data[idxi + 2];\n }\n\n rSum += weight * ri;\n gSum += weight * gi;\n bSum += weight * bi;\n }\n }\n\n if (rSum < 0) {\n rSum = 0;\n }\n\n if (gSum < 0) {\n gSum = 0;\n }\n\n if (bSum < 0) {\n bSum = 0;\n }\n\n if (rSum > 255) {\n rSum = 255;\n }\n\n if (gSum > 255) {\n gSum = 255;\n }\n\n if (bSum > 255) {\n bSum = 255;\n }\n\n newData[idx + 0] = rSum;\n newData[idx + 1] = gSum;\n newData[idx + 2] = bSum;\n });\n\n this.bitmap.data = newData;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Set the alpha channel on every pixel to fully opaque\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opaque(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx + 3] = 255;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Pixelates the image or a region\n * @param {number} size the size of the pixels\n * @param {number} x (optional) the x position of the region to pixelate\n * @param {number} y (optional) the y position of the region to pixelate\n * @param {number} w (optional) the width of the region to pixelate\n * @param {number} h (optional) the height of the region to pixelate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n pixelate(size, x, y, w, h, cb) {\n if (typeof x === 'function') {\n cb = x;\n h = null;\n w = null;\n y = null;\n x = null;\n } else {\n if (typeof size !== 'number') {\n return throwError.call(this, 'size must be a number', cb);\n }\n\n if (isDef(x) && typeof x !== 'number') {\n return throwError.call(this, 'x must be a number', cb);\n }\n\n if (isDef(y) && typeof y !== 'number') {\n return throwError.call(this, 'y must be a number', cb);\n }\n\n if (isDef(w) && typeof w !== 'number') {\n return throwError.call(this, 'w must be a number', cb);\n }\n\n if (isDef(h) && typeof h !== 'number') {\n return throwError.call(this, 'h must be a number', cb);\n }\n }\n\n const kernel = [\n [1 / 16, 2 / 16, 1 / 16],\n [2 / 16, 4 / 16, 2 / 16],\n [1 / 16, 2 / 16, 1 / 16]\n ];\n\n x = x || 0;\n y = y || 0;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n\n const source = this.cloneQuiet();\n\n this.scanQuiet(x, y, w, h, function(xx, yx, idx) {\n xx = size * Math.floor(xx / size);\n yx = size * Math.floor(yx / size);\n\n const value = applyKernel(source, kernel, xx, yx);\n\n this.bitmap.data[idx] = value[0];\n this.bitmap.data[idx + 1] = value[1];\n this.bitmap.data[idx + 2] = value[2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Applies a convolution kernel to the image or a region\n * @param {array} kernel the convolution kernel\n * @param {number} x (optional) the x position of the region to apply convolution to\n * @param {number} y (optional) the y position of the region to apply convolution to\n * @param {number} w (optional) the width of the region to apply convolution to\n * @param {number} h (optional) the height of the region to apply convolution to\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n convolute(kernel, x, y, w, h, cb) {\n if (!Array.isArray(kernel))\n return throwError.call(this, 'the kernel must be an array', cb);\n\n if (typeof x === 'function') {\n cb = x;\n x = null;\n y = null;\n w = null;\n h = null;\n } else {\n if (isDef(x) && typeof x !== 'number') {\n return throwError.call(this, 'x must be a number', cb);\n }\n\n if (isDef(y) && typeof y !== 'number') {\n return throwError.call(this, 'y must be a number', cb);\n }\n\n if (isDef(w) && typeof w !== 'number') {\n return throwError.call(this, 'w must be a number', cb);\n }\n\n if (isDef(h) && typeof h !== 'number') {\n return throwError.call(this, 'h must be a number', cb);\n }\n }\n\n const ksize = (kernel.length - 1) / 2;\n\n x = isDef(x) ? x : ksize;\n y = isDef(y) ? y : ksize;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n\n const source = this.cloneQuiet();\n\n this.scanQuiet(x, y, w, h, function(xx, yx, idx) {\n const value = applyKernel(source, kernel, xx, yx);\n\n this.bitmap.data[idx] = this.constructor.limit255(value[0]);\n this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]);\n this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]);\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Apply multiple color modification rules\n * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] }\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n color: colorFn,\n colour: colorFn\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["tinyColor","throwError","isNodePattern","applyKernel","im","kernel","x","y","value","size","length","kx","ky","idx","getPixelIndex","bitmap","data","isDef","v","greyscale","cb","scanQuiet","width","height","grey","parseInt","call","mix","clr","clr2","p","r","g","b","colorFn","actions","Array","isArray","map","action","apply","params","toRgb","colorModifier","i","amount","constructor","limit255","forEach","ColorActionName","Object","freeze","LIGHTEN","BRIGHTEN","DARKEN","DESATURATE","SATURATE","GREYSCALE","SPIN","HUE","MIX","TINT","SHADE","XOR","RED","GREEN","BLUE","brightness","val","contrast","factor","adjust","Math","floor","posterize","n","grayscale","opacity","f","sepia","red","green","blue","fade","convolution","edgeHandling","EDGE_EXTEND","newData","Buffer","from","kRows","kCols","rowEnd","colEnd","rowIni","colIni","weight","rSum","gSum","bSum","ri","gi","bi","xi","yi","idxi","row","col","opaque","pixelate","w","h","source","cloneQuiet","xx","yx","convolute","color","colour"],"sources":["../src/index.js"],"sourcesContent":["import tinyColor from \"tinycolor2\";\nimport { throwError, isNodePattern } from \"@jimp/utils\";\n\nfunction applyKernel(im, kernel, x, y) {\n const value = [0, 0, 0];\n const size = (kernel.length - 1) / 2;\n\n for (let kx = 0; kx < kernel.length; kx += 1) {\n for (let ky = 0; ky < kernel[kx].length; ky += 1) {\n const idx = im.getPixelIndex(x + kx - size, y + ky - size);\n\n value[0] += im.bitmap.data[idx] * kernel[kx][ky];\n value[1] += im.bitmap.data[idx + 1] * kernel[kx][ky];\n value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky];\n }\n }\n\n return value;\n}\n\nconst isDef = (v) => typeof v !== \"undefined\" && v !== null;\n\nfunction greyscale(cb) {\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const grey = parseInt(\n 0.2126 * this.bitmap.data[idx] +\n 0.7152 * this.bitmap.data[idx + 1] +\n 0.0722 * this.bitmap.data[idx + 2],\n 10\n );\n\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nfunction mix(clr, clr2, p = 50) {\n return {\n r: (clr2.r - clr.r) * (p / 100) + clr.r,\n g: (clr2.g - clr.g) * (p / 100) + clr.g,\n b: (clr2.b - clr.b) * (p / 100) + clr.b,\n };\n}\n\nfunction colorFn(actions, cb) {\n if (!actions || !Array.isArray(actions)) {\n return throwError.call(this, \"actions must be an array\", cb);\n }\n\n actions = actions.map((action) => {\n if (action.apply === \"xor\" || action.apply === \"mix\") {\n action.params[0] = tinyColor(action.params[0]).toRgb();\n }\n\n return action;\n });\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n let clr = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2],\n };\n\n const colorModifier = (i, amount) =>\n this.constructor.limit255(clr[i] + amount);\n\n actions.forEach((action) => {\n if (action.apply === \"mix\") {\n clr = mix(clr, action.params[0], action.params[1]);\n } else if (action.apply === \"tint\") {\n clr = mix(clr, { r: 255, g: 255, b: 255 }, action.params[0]);\n } else if (action.apply === \"shade\") {\n clr = mix(clr, { r: 0, g: 0, b: 0 }, action.params[0]);\n } else if (action.apply === \"xor\") {\n clr = {\n r: clr.r ^ action.params[0].r,\n g: clr.g ^ action.params[0].g,\n b: clr.b ^ action.params[0].b,\n };\n } else if (action.apply === \"red\") {\n clr.r = colorModifier(\"r\", action.params[0]);\n } else if (action.apply === \"green\") {\n clr.g = colorModifier(\"g\", action.params[0]);\n } else if (action.apply === \"blue\") {\n clr.b = colorModifier(\"b\", action.params[0]);\n } else {\n if (action.apply === \"hue\") {\n action.apply = \"spin\";\n }\n\n clr = tinyColor(clr);\n\n if (!clr[action.apply]) {\n return throwError.call(\n this,\n \"action \" + action.apply + \" not supported\",\n cb\n );\n }\n\n clr = clr[action.apply](...action.params).toRgb();\n }\n });\n\n this.bitmap.data[idx] = clr.r;\n this.bitmap.data[idx + 1] = clr.g;\n this.bitmap.data[idx + 2] = clr.b;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport const ColorActionName = Object.freeze({\n LIGHTEN: \"lighten\",\n BRIGHTEN: \"brighten\",\n DARKEN: \"darken\",\n DESATURATE: \"desaturate\",\n SATURATE: \"saturate\",\n GREYSCALE: \"greyscale\",\n SPIN: \"spin\",\n HUE: \"hue\",\n MIX: \"mix\",\n TINT: \"tint\",\n SHADE: \"shade\",\n XOR: \"xor\",\n RED: \"red\",\n GREEN: \"green\",\n BLUE: \"blue\",\n});\n\nexport default () => ({\n /**\n * Adjusts the brightness of the image\n * @param {number} val the amount to adjust the brightness, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n brightness(val, cb) {\n if (typeof val !== \"number\") {\n return throwError.call(this, \"val must be numbers\", cb);\n }\n\n if (val < -1 || val > +1) {\n return throwError.call(\n this,\n \"val must be a number between -1 and +1\",\n cb\n );\n }\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n if (val < 0.0) {\n this.bitmap.data[idx] *= 1 + val;\n this.bitmap.data[idx + 1] *= 1 + val;\n this.bitmap.data[idx + 2] *= 1 + val;\n } else {\n this.bitmap.data[idx] += (255 - this.bitmap.data[idx]) * val;\n this.bitmap.data[idx + 1] += (255 - this.bitmap.data[idx + 1]) * val;\n this.bitmap.data[idx + 2] += (255 - this.bitmap.data[idx + 2]) * val;\n }\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Adjusts the contrast of the image\n * @param {number} val the amount to adjust the contrast, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n contrast(val, cb) {\n if (typeof val !== \"number\") {\n return throwError.call(this, \"val must be numbers\", cb);\n }\n\n if (val < -1 || val > +1) {\n return throwError.call(\n this,\n \"val must be a number between -1 and +1\",\n cb\n );\n }\n\n const factor = (val + 1) / (1 - val);\n\n function adjust(value) {\n value = Math.floor(factor * (value - 127) + 127);\n\n return value < 0 ? 0 : value > 255 ? 255 : value;\n }\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data[idx] = adjust(this.bitmap.data[idx]);\n this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]);\n this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]);\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Apply a posterize effect\n * @param {number} n the amount to adjust the contrast, minimum threshold is two\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n posterize(n, cb) {\n if (typeof n !== \"number\") {\n return throwError.call(this, \"n must be numbers\", cb);\n }\n\n if (n < 2) {\n n = 2;\n } // minimum of 2 levels\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data[idx] =\n (Math.floor((this.bitmap.data[idx] / 255) * (n - 1)) / (n - 1)) * 255;\n this.bitmap.data[idx + 1] =\n (Math.floor((this.bitmap.data[idx + 1] / 255) * (n - 1)) / (n - 1)) *\n 255;\n this.bitmap.data[idx + 2] =\n (Math.floor((this.bitmap.data[idx + 2] / 255) * (n - 1)) / (n - 1)) *\n 255;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Removes colour from the image using ITU Rec 709 luminance values\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n greyscale,\n\n // Alias of greyscale for our American friends\n grayscale: greyscale,\n\n /**\n * Multiplies the opacity of each pixel by a factor between 0 and 1\n * @param {number} f A number, the factor by which to multiply the opacity of each pixel\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opacity(f, cb) {\n if (typeof f !== \"number\")\n return throwError.call(this, \"f must be a number\", cb);\n if (f < 0 || f > 1)\n return throwError.call(this, \"f must be a number from 0 to 1\", cb);\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const v = this.bitmap.data[idx + 3] * f;\n this.bitmap.data[idx + 3] = v;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Applies a sepia tone to the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n sepia(cb) {\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n let red = this.bitmap.data[idx];\n let green = this.bitmap.data[idx + 1];\n let blue = this.bitmap.data[idx + 2];\n\n red = red * 0.393 + green * 0.769 + blue * 0.189;\n green = red * 0.349 + green * 0.686 + blue * 0.168;\n blue = red * 0.272 + green * 0.534 + blue * 0.131;\n\n this.bitmap.data[idx] = red < 255 ? red : 255;\n this.bitmap.data[idx + 1] = green < 255 ? green : 255;\n this.bitmap.data[idx + 2] = blue < 255 ? blue : 255;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Fades each pixel by a factor between 0 and 1\n * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n fade(f, cb) {\n if (typeof f !== \"number\") {\n return throwError.call(this, \"f must be a number\", cb);\n }\n\n if (f < 0 || f > 1) {\n return throwError.call(this, \"f must be a number from 0 to 1\", cb);\n }\n\n // this method is an alternative to opacity (which may be deprecated)\n this.opacity(1 - f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Adds each element of the image to its local neighbors, weighted by the kernel\n * @param {array} kernel a matrix to weight the neighbors sum\n * @param {number} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n convolution(kernel, edgeHandling, cb) {\n if (typeof edgeHandling === \"function\" && typeof cb === \"undefined\") {\n cb = edgeHandling;\n edgeHandling = null;\n }\n\n if (!edgeHandling) {\n edgeHandling = this.constructor.EDGE_EXTEND;\n }\n\n const newData = Buffer.from(this.bitmap.data);\n const kRows = kernel.length;\n const kCols = kernel[0].length;\n const rowEnd = Math.floor(kRows / 2);\n const colEnd = Math.floor(kCols / 2);\n const rowIni = -rowEnd;\n const colIni = -colEnd;\n\n let weight;\n let rSum;\n let gSum;\n let bSum;\n let ri;\n let gi;\n let bi;\n let xi;\n let yi;\n let idxi;\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n bSum = 0;\n gSum = 0;\n rSum = 0;\n\n for (let row = rowIni; row <= rowEnd; row++) {\n for (let col = colIni; col <= colEnd; col++) {\n xi = x + col;\n yi = y + row;\n weight = kernel[row + rowEnd][col + colEnd];\n idxi = this.getPixelIndex(xi, yi, edgeHandling);\n\n if (idxi === -1) {\n bi = 0;\n gi = 0;\n ri = 0;\n } else {\n ri = this.bitmap.data[idxi + 0];\n gi = this.bitmap.data[idxi + 1];\n bi = this.bitmap.data[idxi + 2];\n }\n\n rSum += weight * ri;\n gSum += weight * gi;\n bSum += weight * bi;\n }\n }\n\n if (rSum < 0) {\n rSum = 0;\n }\n\n if (gSum < 0) {\n gSum = 0;\n }\n\n if (bSum < 0) {\n bSum = 0;\n }\n\n if (rSum > 255) {\n rSum = 255;\n }\n\n if (gSum > 255) {\n gSum = 255;\n }\n\n if (bSum > 255) {\n bSum = 255;\n }\n\n newData[idx + 0] = rSum;\n newData[idx + 1] = gSum;\n newData[idx + 2] = bSum;\n }\n );\n\n this.bitmap.data = newData;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Set the alpha channel on every pixel to fully opaque\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opaque(cb) {\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data[idx + 3] = 255;\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Pixelates the image or a region\n * @param {number} size the size of the pixels\n * @param {number} x (optional) the x position of the region to pixelate\n * @param {number} y (optional) the y position of the region to pixelate\n * @param {number} w (optional) the width of the region to pixelate\n * @param {number} h (optional) the height of the region to pixelate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n pixelate(size, x, y, w, h, cb) {\n if (typeof x === \"function\") {\n cb = x;\n h = null;\n w = null;\n y = null;\n x = null;\n } else {\n if (typeof size !== \"number\") {\n return throwError.call(this, \"size must be a number\", cb);\n }\n\n if (isDef(x) && typeof x !== \"number\") {\n return throwError.call(this, \"x must be a number\", cb);\n }\n\n if (isDef(y) && typeof y !== \"number\") {\n return throwError.call(this, \"y must be a number\", cb);\n }\n\n if (isDef(w) && typeof w !== \"number\") {\n return throwError.call(this, \"w must be a number\", cb);\n }\n\n if (isDef(h) && typeof h !== \"number\") {\n return throwError.call(this, \"h must be a number\", cb);\n }\n }\n\n const kernel = [\n [1 / 16, 2 / 16, 1 / 16],\n [2 / 16, 4 / 16, 2 / 16],\n [1 / 16, 2 / 16, 1 / 16],\n ];\n\n x = x || 0;\n y = y || 0;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n\n const source = this.cloneQuiet();\n\n this.scanQuiet(x, y, w, h, function (xx, yx, idx) {\n xx = size * Math.floor(xx / size);\n yx = size * Math.floor(yx / size);\n\n const value = applyKernel(source, kernel, xx, yx);\n\n this.bitmap.data[idx] = value[0];\n this.bitmap.data[idx + 1] = value[1];\n this.bitmap.data[idx + 2] = value[2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Applies a convolution kernel to the image or a region\n * @param {array} kernel the convolution kernel\n * @param {number} x (optional) the x position of the region to apply convolution to\n * @param {number} y (optional) the y position of the region to apply convolution to\n * @param {number} w (optional) the width of the region to apply convolution to\n * @param {number} h (optional) the height of the region to apply convolution to\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n convolute(kernel, x, y, w, h, cb) {\n if (!Array.isArray(kernel))\n return throwError.call(this, \"the kernel must be an array\", cb);\n\n if (typeof x === \"function\") {\n cb = x;\n x = null;\n y = null;\n w = null;\n h = null;\n } else {\n if (isDef(x) && typeof x !== \"number\") {\n return throwError.call(this, \"x must be a number\", cb);\n }\n\n if (isDef(y) && typeof y !== \"number\") {\n return throwError.call(this, \"y must be a number\", cb);\n }\n\n if (isDef(w) && typeof w !== \"number\") {\n return throwError.call(this, \"w must be a number\", cb);\n }\n\n if (isDef(h) && typeof h !== \"number\") {\n return throwError.call(this, \"h must be a number\", cb);\n }\n }\n\n x = isDef(x) ? x : 0;\n y = isDef(y) ? y : 0;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n\n const source = this.cloneQuiet();\n\n this.scanQuiet(x, y, w, h, function (xx, yx, idx) {\n const value = applyKernel(source, kernel, xx, yx);\n\n this.bitmap.data[idx] = this.constructor.limit255(value[0]);\n this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]);\n this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]);\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Apply multiple color modification rules\n * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] }\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n color: colorFn,\n colour: colorFn,\n});\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,YAAY;AAClC,SAASC,UAAU,EAAEC,aAAa,QAAQ,aAAa;AAEvD,SAASC,WAAW,CAACC,EAAE,EAAEC,MAAM,EAAEC,CAAC,EAAEC,CAAC,EAAE;EACrC,MAAMC,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;EACvB,MAAMC,IAAI,GAAG,CAACJ,MAAM,CAACK,MAAM,GAAG,CAAC,IAAI,CAAC;EAEpC,KAAK,IAAIC,EAAE,GAAG,CAAC,EAAEA,EAAE,GAAGN,MAAM,CAACK,MAAM,EAAEC,EAAE,IAAI,CAAC,EAAE;IAC5C,KAAK,IAAIC,EAAE,GAAG,CAAC,EAAEA,EAAE,GAAGP,MAAM,CAACM,EAAE,CAAC,CAACD,MAAM,EAAEE,EAAE,IAAI,CAAC,EAAE;MAChD,MAAMC,GAAG,GAAGT,EAAE,CAACU,aAAa,CAACR,CAAC,GAAGK,EAAE,GAAGF,IAAI,EAAEF,CAAC,GAAGK,EAAE,GAAGH,IAAI,CAAC;MAE1DD,KAAK,CAAC,CAAC,CAAC,IAAIJ,EAAE,CAACW,MAAM,CAACC,IAAI,CAACH,GAAG,CAAC,GAAGR,MAAM,CAACM,EAAE,CAAC,CAACC,EAAE,CAAC;MAChDJ,KAAK,CAAC,CAAC,CAAC,IAAIJ,EAAE,CAACW,MAAM,CA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IAAI,CAACO,MAAM,CAACC,IAAI,CAACH,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAACiC,WAAW,CAACC,QAAQ,CAACvC,KAAK,CAAC,CAAC,CAAC,CAAC;IACjE,CAAC,CAAC;IAEF,IAAIN,aAAa,CAACkB,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACM,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACE2F,KAAK,EAAEnF,OAAO;EACdoF,MAAM,EAAEpF;AACV,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-color/index.d.ts b/project starter code/node_modules/@jimp/plugin-color/index.d.ts index c2f897a3..bdf6b3f7 100644 --- a/project starter code/node_modules/@jimp/plugin-color/index.d.ts +++ b/project starter code/node_modules/@jimp/plugin-color/index.d.ts @@ -1,14 +1,22 @@ -import { ImageCallback } from '@jimp/core'; +import { ImageCallback } from "@jimp/core"; -type ColorActionName = - | 'mix' - | 'tint' - | 'shade' - | 'xor' - | 'red' - | 'green' - | 'blue' - | 'hue'; +export enum ColorActionName { + LIGHTEN = "lighten", + BRIGHTEN = "brighten", + DARKEN = "darken", + DESATURATE = "desaturate", + SATURATE = "saturate", + GREYSCALE = "greyscale", + SPIN = "spin", + HUE = "hue", + MIX = "mix", + TINT = "tint", + SHADE = "shade", + XOR = "xor", + RED = "red", + GREEN = "green", + BLUE = "blue", +} type ColorAction = { apply: ColorActionName; @@ -27,7 +35,7 @@ interface Color { convolution(kernel: number[][], cb?: ImageCallback): this; convolution( kernel: number[][], - edgeHandling: string, + edgeHandling: number, cb?: ImageCallback ): this; opaque(cb?: ImageCallback): this; @@ -53,4 +61,4 @@ interface Color { colour(actions: ColorAction[], cb?: ImageCallback): this; } -export default function(): Color; +export default function (): Color; diff --git a/project starter code/node_modules/@jimp/plugin-color/package.json b/project starter code/node_modules/@jimp/plugin-color/package.json index 100c3b31..e31bb123 100644 --- a/project starter code/node_modules/@jimp/plugin-color/package.json +++ b/project starter code/node_modules/@jimp/plugin-color/package.json @@ -1,12 +1,13 @@ { "name": "@jimp/plugin-color", - "version": "0.16.2", + "version": "0.22.12", "description": "Bitmap manipulation to adjust the color in an image.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js", "test:watch": "npm run test -- --reporter min --watch", "test:coverage": "nyc npm run test", "build": "npm run build:node:production && npm run build:module", @@ -20,14 +21,13 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "tinycolor2": "^1.4.1" + "@jimp/utils": "^0.22.12", + "tinycolor2": "^1.6.0" }, "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/test-utils": "^0.16.2", - "@jimp/types": "^0.16.2" + "@jimp/custom": "^0.22.12", + "@jimp/test-utils": "^0.22.12", + "@jimp/types": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" @@ -35,5 +35,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/plugin-color/src/index.js b/project starter code/node_modules/@jimp/plugin-color/src/index.js index faec203b..451bf2ce 100644 --- a/project starter code/node_modules/@jimp/plugin-color/src/index.js +++ b/project starter code/node_modules/@jimp/plugin-color/src/index.js @@ -1,5 +1,5 @@ -import tinyColor from 'tinycolor2'; -import { throwError, isNodePattern } from '@jimp/utils'; +import tinyColor from "tinycolor2"; +import { throwError, isNodePattern } from "@jimp/utils"; function applyKernel(im, kernel, x, y) { const value = [0, 0, 0]; @@ -18,25 +18,27 @@ function applyKernel(im, kernel, x, y) { return value; } -const isDef = v => typeof v !== 'undefined' && v !== null; +const isDef = (v) => typeof v !== "undefined" && v !== null; function greyscale(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - const grey = parseInt( - 0.2126 * this.bitmap.data[idx] + - 0.7152 * this.bitmap.data[idx + 1] + - 0.0722 * this.bitmap.data[idx + 2], - 10 - ); + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + const grey = parseInt( + 0.2126 * this.bitmap.data[idx] + + 0.7152 * this.bitmap.data[idx + 1] + + 0.0722 * this.bitmap.data[idx + 2], + 10 + ); - this.bitmap.data[idx] = grey; - this.bitmap.data[idx + 1] = grey; - this.bitmap.data[idx + 2] = grey; - }); + this.bitmap.data[idx] = grey; + this.bitmap.data[idx + 1] = grey; + this.bitmap.data[idx + 2] = grey; + } + ); if (isNodePattern(cb)) { cb.call(this, null, this); @@ -49,17 +51,17 @@ function mix(clr, clr2, p = 50) { return { r: (clr2.r - clr.r) * (p / 100) + clr.r, g: (clr2.g - clr.g) * (p / 100) + clr.g, - b: (clr2.b - clr.b) * (p / 100) + clr.b + b: (clr2.b - clr.b) * (p / 100) + clr.b, }; } function colorFn(actions, cb) { if (!actions || !Array.isArray(actions)) { - return throwError.call(this, 'actions must be an array', cb); + return throwError.call(this, "actions must be an array", cb); } - actions = actions.map(action => { - if (action.apply === 'xor' || action.apply === 'mix') { + actions = actions.map((action) => { + if (action.apply === "xor" || action.apply === "mix") { action.params[0] = tinyColor(action.params[0]).toRgb(); } @@ -70,34 +72,34 @@ function colorFn(actions, cb) { let clr = { r: this.bitmap.data[idx], g: this.bitmap.data[idx + 1], - b: this.bitmap.data[idx + 2] + b: this.bitmap.data[idx + 2], }; const colorModifier = (i, amount) => this.constructor.limit255(clr[i] + amount); - actions.forEach(action => { - if (action.apply === 'mix') { + actions.forEach((action) => { + if (action.apply === "mix") { clr = mix(clr, action.params[0], action.params[1]); - } else if (action.apply === 'tint') { + } else if (action.apply === "tint") { clr = mix(clr, { r: 255, g: 255, b: 255 }, action.params[0]); - } else if (action.apply === 'shade') { + } else if (action.apply === "shade") { clr = mix(clr, { r: 0, g: 0, b: 0 }, action.params[0]); - } else if (action.apply === 'xor') { + } else if (action.apply === "xor") { clr = { r: clr.r ^ action.params[0].r, g: clr.g ^ action.params[0].g, - b: clr.b ^ action.params[0].b + b: clr.b ^ action.params[0].b, }; - } else if (action.apply === 'red') { - clr.r = colorModifier('r', action.params[0]); - } else if (action.apply === 'green') { - clr.g = colorModifier('g', action.params[0]); - } else if (action.apply === 'blue') { - clr.b = colorModifier('b', action.params[0]); + } else if (action.apply === "red") { + clr.r = colorModifier("r", action.params[0]); + } else if (action.apply === "green") { + clr.g = colorModifier("g", action.params[0]); + } else if (action.apply === "blue") { + clr.b = colorModifier("b", action.params[0]); } else { - if (action.apply === 'hue') { - action.apply = 'spin'; + if (action.apply === "hue") { + action.apply = "spin"; } clr = tinyColor(clr); @@ -105,7 +107,7 @@ function colorFn(actions, cb) { if (!clr[action.apply]) { return throwError.call( this, - 'action ' + action.apply + ' not supported', + "action " + action.apply + " not supported", cb ); } @@ -126,6 +128,24 @@ function colorFn(actions, cb) { return this; } +export const ColorActionName = Object.freeze({ + LIGHTEN: "lighten", + BRIGHTEN: "brighten", + DARKEN: "darken", + DESATURATE: "desaturate", + SATURATE: "saturate", + GREYSCALE: "greyscale", + SPIN: "spin", + HUE: "hue", + MIX: "mix", + TINT: "tint", + SHADE: "shade", + XOR: "xor", + RED: "red", + GREEN: "green", + BLUE: "blue", +}); + export default () => ({ /** * Adjusts the brightness of the image @@ -134,36 +154,35 @@ export default () => ({ * @returns {Jimp }this for chaining of methods */ brightness(val, cb) { - if (typeof val !== 'number') { - return throwError.call(this, 'val must be numbers', cb); + if (typeof val !== "number") { + return throwError.call(this, "val must be numbers", cb); } if (val < -1 || val > +1) { return throwError.call( this, - 'val must be a number between -1 and +1', + "val must be a number between -1 and +1", cb ); } - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - if (val < 0.0) { - this.bitmap.data[idx] = this.bitmap.data[idx] * (1 + val); - this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] * (1 + val); - this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] * (1 + val); - } else { - this.bitmap.data[idx] = - this.bitmap.data[idx] + (255 - this.bitmap.data[idx]) * val; - this.bitmap.data[idx + 1] = - this.bitmap.data[idx + 1] + (255 - this.bitmap.data[idx + 1]) * val; - this.bitmap.data[idx + 2] = - this.bitmap.data[idx + 2] + (255 - this.bitmap.data[idx + 2]) * val; + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + if (val < 0.0) { + this.bitmap.data[idx] *= 1 + val; + this.bitmap.data[idx + 1] *= 1 + val; + this.bitmap.data[idx + 2] *= 1 + val; + } else { + this.bitmap.data[idx] += (255 - this.bitmap.data[idx]) * val; + this.bitmap.data[idx + 1] += (255 - this.bitmap.data[idx + 1]) * val; + this.bitmap.data[idx + 2] += (255 - this.bitmap.data[idx + 2]) * val; + } } - }); + ); if (isNodePattern(cb)) { cb.call(this, null, this); @@ -179,14 +198,14 @@ export default () => ({ * @returns {Jimp }this for chaining of methods */ contrast(val, cb) { - if (typeof val !== 'number') { - return throwError.call(this, 'val must be numbers', cb); + if (typeof val !== "number") { + return throwError.call(this, "val must be numbers", cb); } if (val < -1 || val > +1) { return throwError.call( this, - 'val must be a number between -1 and +1', + "val must be a number between -1 and +1", cb ); } @@ -199,15 +218,17 @@ export default () => ({ return value < 0 ? 0 : value > 255 ? 255 : value; } - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - this.bitmap.data[idx] = adjust(this.bitmap.data[idx]); - this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]); - this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]); - }); + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + this.bitmap.data[idx] = adjust(this.bitmap.data[idx]); + this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]); + this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]); + } + ); if (isNodePattern(cb)) { cb.call(this, null, this); @@ -223,28 +244,30 @@ export default () => ({ * @returns {Jimp }this for chaining of methods */ posterize(n, cb) { - if (typeof n !== 'number') { - return throwError.call(this, 'n must be numbers', cb); + if (typeof n !== "number") { + return throwError.call(this, "n must be numbers", cb); } if (n < 2) { n = 2; } // minimum of 2 levels - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - this.bitmap.data[idx] = - (Math.floor((this.bitmap.data[idx] / 255) * (n - 1)) / (n - 1)) * 255; - this.bitmap.data[idx + 1] = - (Math.floor((this.bitmap.data[idx + 1] / 255) * (n - 1)) / (n - 1)) * - 255; - this.bitmap.data[idx + 2] = - (Math.floor((this.bitmap.data[idx + 2] / 255) * (n - 1)) / (n - 1)) * - 255; - }); + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + this.bitmap.data[idx] = + (Math.floor((this.bitmap.data[idx] / 255) * (n - 1)) / (n - 1)) * 255; + this.bitmap.data[idx + 1] = + (Math.floor((this.bitmap.data[idx + 1] / 255) * (n - 1)) / (n - 1)) * + 255; + this.bitmap.data[idx + 2] = + (Math.floor((this.bitmap.data[idx + 2] / 255) * (n - 1)) / (n - 1)) * + 255; + } + ); if (isNodePattern(cb)) { cb.call(this, null, this); @@ -270,19 +293,21 @@ export default () => ({ * @returns {Jimp }this for chaining of methods */ opacity(f, cb) { - if (typeof f !== 'number') - return throwError.call(this, 'f must be a number', cb); + if (typeof f !== "number") + return throwError.call(this, "f must be a number", cb); if (f < 0 || f > 1) - return throwError.call(this, 'f must be a number from 0 to 1', cb); - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - const v = this.bitmap.data[idx + 3] * f; - this.bitmap.data[idx + 3] = v; - }); + return throwError.call(this, "f must be a number from 0 to 1", cb); + + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + const v = this.bitmap.data[idx + 3] * f; + this.bitmap.data[idx + 3] = v; + } + ); if (isNodePattern(cb)) { cb.call(this, null, this); @@ -297,23 +322,25 @@ export default () => ({ * @returns {Jimp }this for chaining of methods */ sepia(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - let red = this.bitmap.data[idx]; - let green = this.bitmap.data[idx + 1]; - let blue = this.bitmap.data[idx + 2]; - - red = red * 0.393 + green * 0.769 + blue * 0.189; - green = red * 0.349 + green * 0.686 + blue * 0.168; - blue = red * 0.272 + green * 0.534 + blue * 0.131; - - this.bitmap.data[idx] = red < 255 ? red : 255; - this.bitmap.data[idx + 1] = green < 255 ? green : 255; - this.bitmap.data[idx + 2] = blue < 255 ? blue : 255; - }); + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + let red = this.bitmap.data[idx]; + let green = this.bitmap.data[idx + 1]; + let blue = this.bitmap.data[idx + 2]; + + red = red * 0.393 + green * 0.769 + blue * 0.189; + green = red * 0.349 + green * 0.686 + blue * 0.168; + blue = red * 0.272 + green * 0.534 + blue * 0.131; + + this.bitmap.data[idx] = red < 255 ? red : 255; + this.bitmap.data[idx + 1] = green < 255 ? green : 255; + this.bitmap.data[idx + 2] = blue < 255 ? blue : 255; + } + ); if (isNodePattern(cb)) { cb.call(this, null, this); @@ -329,12 +356,12 @@ export default () => ({ * @returns {Jimp }this for chaining of methods */ fade(f, cb) { - if (typeof f !== 'number') { - return throwError.call(this, 'f must be a number', cb); + if (typeof f !== "number") { + return throwError.call(this, "f must be a number", cb); } if (f < 0 || f > 1) { - return throwError.call(this, 'f must be a number from 0 to 1', cb); + return throwError.call(this, "f must be a number from 0 to 1", cb); } // this method is an alternative to opacity (which may be deprecated) @@ -350,12 +377,12 @@ export default () => ({ /** * Adds each element of the image to its local neighbors, weighted by the kernel * @param {array} kernel a matrix to weight the neighbors sum - * @param {string} edgeHandling (optional) define how to sum pixels from outside the border + * @param {number} edgeHandling (optional) define how to sum pixels from outside the border * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp }this for chaining of methods */ convolution(kernel, edgeHandling, cb) { - if (typeof edgeHandling === 'function' && typeof cb === 'undefined') { + if (typeof edgeHandling === "function" && typeof cb === "undefined") { cb = edgeHandling; edgeHandling = null; } @@ -383,66 +410,68 @@ export default () => ({ let yi; let idxi; - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - bSum = 0; - gSum = 0; - rSum = 0; - - for (let row = rowIni; row <= rowEnd; row++) { - for (let col = colIni; col <= colEnd; col++) { - xi = x + col; - yi = y + row; - weight = kernel[row + rowEnd][col + colEnd]; - idxi = this.getPixelIndex(xi, yi, edgeHandling); - - if (idxi === -1) { - bi = 0; - gi = 0; - ri = 0; - } else { - ri = this.bitmap.data[idxi + 0]; - gi = this.bitmap.data[idxi + 1]; - bi = this.bitmap.data[idxi + 2]; + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + bSum = 0; + gSum = 0; + rSum = 0; + + for (let row = rowIni; row <= rowEnd; row++) { + for (let col = colIni; col <= colEnd; col++) { + xi = x + col; + yi = y + row; + weight = kernel[row + rowEnd][col + colEnd]; + idxi = this.getPixelIndex(xi, yi, edgeHandling); + + if (idxi === -1) { + bi = 0; + gi = 0; + ri = 0; + } else { + ri = this.bitmap.data[idxi + 0]; + gi = this.bitmap.data[idxi + 1]; + bi = this.bitmap.data[idxi + 2]; + } + + rSum += weight * ri; + gSum += weight * gi; + bSum += weight * bi; } + } - rSum += weight * ri; - gSum += weight * gi; - bSum += weight * bi; + if (rSum < 0) { + rSum = 0; } - } - if (rSum < 0) { - rSum = 0; - } + if (gSum < 0) { + gSum = 0; + } - if (gSum < 0) { - gSum = 0; - } + if (bSum < 0) { + bSum = 0; + } - if (bSum < 0) { - bSum = 0; - } + if (rSum > 255) { + rSum = 255; + } - if (rSum > 255) { - rSum = 255; - } + if (gSum > 255) { + gSum = 255; + } - if (gSum > 255) { - gSum = 255; - } + if (bSum > 255) { + bSum = 255; + } - if (bSum > 255) { - bSum = 255; + newData[idx + 0] = rSum; + newData[idx + 1] = gSum; + newData[idx + 2] = bSum; } - - newData[idx + 0] = rSum; - newData[idx + 1] = gSum; - newData[idx + 2] = bSum; - }); + ); this.bitmap.data = newData; @@ -459,13 +488,15 @@ export default () => ({ * @returns {Jimp }this for chaining of methods */ opaque(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - this.bitmap.data[idx + 3] = 255; - }); + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + this.bitmap.data[idx + 3] = 255; + } + ); if (isNodePattern(cb)) { cb.call(this, null, this); @@ -485,38 +516,38 @@ export default () => ({ * @returns {Jimp }this for chaining of methods */ pixelate(size, x, y, w, h, cb) { - if (typeof x === 'function') { + if (typeof x === "function") { cb = x; h = null; w = null; y = null; x = null; } else { - if (typeof size !== 'number') { - return throwError.call(this, 'size must be a number', cb); + if (typeof size !== "number") { + return throwError.call(this, "size must be a number", cb); } - if (isDef(x) && typeof x !== 'number') { - return throwError.call(this, 'x must be a number', cb); + if (isDef(x) && typeof x !== "number") { + return throwError.call(this, "x must be a number", cb); } - if (isDef(y) && typeof y !== 'number') { - return throwError.call(this, 'y must be a number', cb); + if (isDef(y) && typeof y !== "number") { + return throwError.call(this, "y must be a number", cb); } - if (isDef(w) && typeof w !== 'number') { - return throwError.call(this, 'w must be a number', cb); + if (isDef(w) && typeof w !== "number") { + return throwError.call(this, "w must be a number", cb); } - if (isDef(h) && typeof h !== 'number') { - return throwError.call(this, 'h must be a number', cb); + if (isDef(h) && typeof h !== "number") { + return throwError.call(this, "h must be a number", cb); } } const kernel = [ [1 / 16, 2 / 16, 1 / 16], [2 / 16, 4 / 16, 2 / 16], - [1 / 16, 2 / 16, 1 / 16] + [1 / 16, 2 / 16, 1 / 16], ]; x = x || 0; @@ -526,7 +557,7 @@ export default () => ({ const source = this.cloneQuiet(); - this.scanQuiet(x, y, w, h, function(xx, yx, idx) { + this.scanQuiet(x, y, w, h, function (xx, yx, idx) { xx = size * Math.floor(xx / size); yx = size * Math.floor(yx / size); @@ -552,46 +583,44 @@ export default () => ({ * @param {number} w (optional) the width of the region to apply convolution to * @param {number} h (optional) the height of the region to apply convolution to * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods + * @returns {Jimp} this for chaining of methods */ convolute(kernel, x, y, w, h, cb) { if (!Array.isArray(kernel)) - return throwError.call(this, 'the kernel must be an array', cb); + return throwError.call(this, "the kernel must be an array", cb); - if (typeof x === 'function') { + if (typeof x === "function") { cb = x; x = null; y = null; w = null; h = null; } else { - if (isDef(x) && typeof x !== 'number') { - return throwError.call(this, 'x must be a number', cb); + if (isDef(x) && typeof x !== "number") { + return throwError.call(this, "x must be a number", cb); } - if (isDef(y) && typeof y !== 'number') { - return throwError.call(this, 'y must be a number', cb); + if (isDef(y) && typeof y !== "number") { + return throwError.call(this, "y must be a number", cb); } - if (isDef(w) && typeof w !== 'number') { - return throwError.call(this, 'w must be a number', cb); + if (isDef(w) && typeof w !== "number") { + return throwError.call(this, "w must be a number", cb); } - if (isDef(h) && typeof h !== 'number') { - return throwError.call(this, 'h must be a number', cb); + if (isDef(h) && typeof h !== "number") { + return throwError.call(this, "h must be a number", cb); } } - const ksize = (kernel.length - 1) / 2; - - x = isDef(x) ? x : ksize; - y = isDef(y) ? y : ksize; + x = isDef(x) ? x : 0; + y = isDef(y) ? y : 0; w = isDef(w) ? w : this.bitmap.width - x; h = isDef(h) ? h : this.bitmap.height - y; const source = this.cloneQuiet(); - this.scanQuiet(x, y, w, h, function(xx, yx, idx) { + this.scanQuiet(x, y, w, h, function (xx, yx, idx) { const value = applyKernel(source, kernel, xx, yx); this.bitmap.data[idx] = this.constructor.limit255(value[0]); @@ -613,5 +642,5 @@ export default () => ({ * @returns {Jimp }this for chaining of methods */ color: colorFn, - colour: colorFn + colour: colorFn, }); diff --git a/project starter code/node_modules/@jimp/plugin-color/test/color.test.js b/project starter code/node_modules/@jimp/plugin-color/test/color.test.js index 8a396f0d..f7d91e52 100644 --- a/project starter code/node_modules/@jimp/plugin-color/test/color.test.js +++ b/project starter code/node_modules/@jimp/plugin-color/test/color.test.js @@ -1,49 +1,50 @@ -import { Jimp, donutJGD } from '@jimp/test-utils'; -import configure from '@jimp/custom'; +import { Jimp, donutJGD } from "@jimp/test-utils"; +import configure from "@jimp/custom"; -import color from '../src'; +import color from "../src"; +import { expectToBeJGD } from "@jimp/test-utils/src"; const jimp = configure({ plugins: [color] }, Jimp); -describe('canvas color transformation', () => { +describe("canvas color transformation", () => { const redDonutJGD = donutJGD(0x00000000, 0xff000088, 0xff0000ff); - it('can apply more than one color transformation', async () => { + it("can apply more than one color transformation", async () => { const image = await jimp.read(redDonutJGD); const newJGD = image .color([ - { apply: 'hue', params: [-180] }, - { apply: 'lighten', params: [25] } + { apply: "hue", params: [-180] }, + { apply: "lighten", params: [25] }, ]) .getJGDSync(); - newJGD.should.be.sameJGD(donutJGD(0x40404000, 0x80ffff88, 0x80ffffff)); + expectToBeJGD(newJGD, donutJGD(0x40404000, 0x80ffff88, 0x80ffffff)); }); - it('lighten', async () => { + it("lighten", async () => { const image = await jimp.read(redDonutJGD); - image - .color([{ apply: 'lighten', params: [25] }]) - .getJGDSync() - .should.be.sameJGD(donutJGD(0x40404000, 0xff808088, 0xff8080ff)); + expectToBeJGD( + image.color([{ apply: "lighten", params: [25] }]).getJGDSync(), + donutJGD(0x40404000, 0xff808088, 0xff8080ff) + ); }); - it('brighten', async () => { + it("brighten", async () => { const image = await jimp.read(redDonutJGD); - image - .color([{ apply: 'brighten', params: [25] }]) - .getJGDSync() - .should.be.sameJGD(donutJGD(0x40404000, 0xff404088, 0xff4040ff)); + expectToBeJGD( + image.color([{ apply: "brighten", params: [25] }]).getJGDSync(), + donutJGD(0x40404000, 0xff404088, 0xff4040ff) + ); }); - it('spin hue', async () => { + it("spin hue", async () => { const image = await jimp.read(redDonutJGD); - image - .color([{ apply: 'hue', params: [150] }]) - .getJGDSync() - .should.be.sameJGD(donutJGD(0x00000000, 0x00ff8088, 0x00ff80ff)); + expectToBeJGD( + image.color([{ apply: "hue", params: [150] }]).getJGDSync(), + donutJGD(0x00000000, 0x00ff8088, 0x00ff80ff) + ); }); }); diff --git a/project starter code/node_modules/@jimp/plugin-color/test/convolution.test.js b/project starter code/node_modules/@jimp/plugin-color/test/convolution.test.js index e9e8dd63..e7abca10 100644 --- a/project starter code/node_modules/@jimp/plugin-color/test/convolution.test.js +++ b/project starter code/node_modules/@jimp/plugin-color/test/convolution.test.js @@ -1,47 +1,49 @@ -import { Jimp, mkJGD, getTestDir } from '@jimp/test-utils'; -import configure from '@jimp/custom'; -import types from '@jimp/types'; +import { Jimp, mkJGD, getTestDir } from "@jimp/test-utils"; +import configure from "@jimp/custom"; +import types from "@jimp/types"; +import expect from "@storybook/expect"; -import color from '../src'; +import color from "../src"; +import { expectToBeJGD } from "@jimp/test-utils/src"; const jimp = configure({ types: [types], plugins: [color] }, Jimp); -describe('Convolution', function() { +describe("Convolution", function () { this.timeout(15000); const imgs = [ jimp.read( mkJGD( - '22222222', - '22222222', - '22888822', - '22888822', - '22888822', - '22888822', - '22222222', - '22222222' + "22222222", + "22222222", + "22888822", + "22888822", + "22888822", + "22888822", + "22222222", + "22222222" ) ), jimp.read( mkJGD( - '88222222', - '88222222', - '22222222', - '22222222', - '22222222', - '22222222', - '22222222', - '22222222' + "88222222", + "88222222", + "22222222", + "22222222", + "22222222", + "22222222", + "22222222", + "22222222" ) - ) + ), ]; let imgMid; let imgTopLeft; // stores the Jimp instances of the JGD images above. - before(done => { + before((done) => { Promise.all(imgs) - .then(imgs => { + .then((imgs) => { imgMid = imgs[0]; imgTopLeft = imgs[1]; done(); @@ -49,136 +51,135 @@ describe('Convolution', function() { .catch(done); }); - const sharpM = [[-1, -1, 0], [-1, 1, 1], [0, 1, 1]]; - - it('3x3 sharp matrix on EDGE_EXTEND', done => { - imgMid - .clone() - .convolution(sharpM) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '22222222', - '28EEE822', - '2EFFF802', - '2EF88002', - '2EF88002', - '28800002', - '22000002', - '22222222' - ), - 'Mid light block' - ); - imgTopLeft - .clone() - .convolution(sharpM) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '80022222', - '00022222', - '00022222', - '22222222', - '22222222', - '22222222', - '22222222', - '22222222' - ), - 'Top left light block' - ); + const sharpM = [ + [-1, -1, 0], + [-1, 1, 1], + [0, 1, 1], + ]; + + const blurM = [ + [1 / 9, 1 / 9, 1 / 9], + [1 / 9, 1 / 9, 1 / 9], + [1 / 9, 1 / 9, 1 / 9], + ]; + + it("3x3 sharp matrix on EDGE_EXTEND", (done) => { + expectToBeJGD( + imgMid.clone().convolution(sharpM).getJGDSync(), + mkJGD( + "22222222", + "28EEE822", + "2EFFF802", + "2EF88002", + "2EF88002", + "28800002", + "22000002", + "22222222" + ) + ); + + expectToBeJGD( + imgTopLeft.clone().convolution(sharpM).getJGDSync(), + mkJGD( + "80022222", + "00022222", + "00022222", + "22222222", + "22222222", + "22222222", + "22222222", + "22222222" + ) + ); done(); }); - it('3x3 sharp matrix on EDGE_WRAP', done => { - imgMid - .clone() - .convolution(sharpM, jimp.EDGE_WRAP) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '66666666', - '28EEE822', - '2EFFF802', - '2EF88002', - '2EF88002', - '28800002', - '22000002', - '22222222' - ), - 'Mid light block' - ); - imgTopLeft - .clone() - .convolution(sharpM, jimp.EDGE_WRAP) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - 'FC06666F', - '80022228', - '00022222', - '22222222', - '22222222', - '22222222', - '22222222', - 'E8222228' - ), - 'Top left light block' - ); + it("3x3 sharp matrix on EDGE_WRAP", (done) => { + expectToBeJGD( + imgMid.clone().convolution(sharpM, jimp.EDGE_WRAP).getJGDSync(), + mkJGD( + "22222222", + "28EEE822", + "2EFFF802", + "2EF88002", + "2EF88002", + "28800002", + "22000002", + "22222222" + ) + ); + + expectToBeJGD( + imgTopLeft.clone().convolution(sharpM, jimp.EDGE_WRAP).getJGDSync(), + mkJGD( + "F802222E", + "80022228", + "00022222", + "22222222", + "22222222", + "22222222", + "22222222", + "E8222228" + ) + ); done(); }); - it('3x3 sharp matrix on EDGE_CROP', done => { - imgMid - .clone() - .convolution(sharpM, jimp.EDGE_CROP) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '86666662', - '68EEE820', - '6EFFF800', - '6EF88000', - '6EF88000', - '68800000', - '62000000', - '20000000' - ), - 'Mid light block' - ); - imgTopLeft - .clone() - .convolution(sharpM, jimp.EDGE_CROP) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - 'FC066662', - 'C0022220', - '00022220', - '62222220', - '62222220', - '62222220', - '62222220', - '20000000' - ), - 'Top left light block' - ); + it("3x3 sharp matrix on EDGE_CROP", (done) => { + expectToBeJGD( + imgMid.clone().convolution(sharpM, jimp.EDGE_CROP).getJGDSync(), + mkJGD( + "86666662", + "68EEE820", + "6EFFF800", + "6EF88000", + "6EF88000", + "68800000", + "62000000", + "20000000" + ) + ); + + expectToBeJGD( + imgTopLeft.clone().convolution(sharpM, jimp.EDGE_CROP).getJGDSync(), + mkJGD( + "FC066662", + "C0022220", + "00022220", + "62222220", + "62222220", + "62222220", + "62222220", + "20000000" + ) + ); done(); }); - it('new pixel value is greater than 255', async () => { + it("3x3 box blur matrix using convolute", async () => { + const expectedImg = await jimp.read( + getTestDir(__dirname) + "/images/tiles-blurred.png" + ); + + const image = await jimp.read(getTestDir(__dirname) + "/images/tiles.jpg"); + + expect(image.convolute(blurM).bitmap.data).toEqual(expectedImg.bitmap.data); + }); + + it("new pixel value is greater than 255", async () => { const expectedImg = await jimp.read( - getTestDir(__dirname) + '/images/qr-convoluted.png' + getTestDir(__dirname) + "/images/qr-convoluted.png" ); - const image = await jimp.read(getTestDir(__dirname) + '/images/qr.jpg'); + const image = await jimp.read(getTestDir(__dirname) + "/images/qr.jpg"); - image - .convolution([ + expect( + image.convolution([ [0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 1, 0, 1, 0], [0, 1, 1, 1, 0], - [0, 0, 0, 0, 0] - ]) - .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + [0, 0, 0, 0, 0], + ]).bitmap.data + ).toEqual(expectedImg.bitmap.data); }); }); diff --git a/project starter code/node_modules/@jimp/plugin-color/test/images/tiles-blurred.png b/project starter code/node_modules/@jimp/plugin-color/test/images/tiles-blurred.png new file mode 100644 index 00000000..5b3da9b6 Binary files /dev/null and b/project starter code/node_modules/@jimp/plugin-color/test/images/tiles-blurred.png differ diff --git a/project starter code/node_modules/@jimp/plugin-color/test/images/tiles.jpg b/project starter code/node_modules/@jimp/plugin-color/test/images/tiles.jpg new file mode 100644 index 00000000..538c77e4 Binary files /dev/null and b/project starter code/node_modules/@jimp/plugin-color/test/images/tiles.jpg differ diff --git a/project starter code/node_modules/@jimp/plugin-contain/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-contain/CHANGELOG.md index 26394e0f..3d839517 100644 --- a/project starter code/node_modules/@jimp/plugin-contain/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/plugin-contain/CHANGELOG.md @@ -1,3 +1,65 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.22.0 (Mon Feb 06 2023) + +#### 🏠 Internal + +- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Daniel Holmes ([@danielholmes](https://github.com/danielholmes)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -12,7 +74,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -20,4 +82,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-contain/README.md b/project starter code/node_modules/@jimp/plugin-contain/README.md index 6613e4dd..187cdc75 100644 --- a/project starter code/node_modules/@jimp/plugin-contain/README.md +++ b/project starter code/node_modules/@jimp/plugin-contain/README.md @@ -16,10 +16,10 @@ Scale the image to the given width and height keeping the aspect ratio. Some par - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.contain(150, 100); } diff --git a/project starter code/node_modules/@jimp/plugin-contain/dist/index.js b/project starter code/node_modules/@jimp/plugin-contain/dist/index.js index ff05a1a7..33da2966 100644 --- a/project starter code/node_modules/@jimp/plugin-contain/dist/index.js +++ b/project starter code/node_modules/@jimp/plugin-contain/dist/index.js @@ -3,10 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - +exports.default = void 0; var _utils = require("@jimp/utils"); - /** * Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed. * @param {number} w the width to resize the image to @@ -16,60 +14,52 @@ var _utils = require("@jimp/utils"); * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ -var _default = function _default() { - return { - contain: function contain(w, h, alignBits, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } // permit any sort of optional parameters combination - - - if (typeof alignBits === 'string') { - if (typeof mode === 'function' && typeof cb === 'undefined') cb = mode; - mode = alignBits; - alignBits = null; - } - - if (typeof alignBits === 'function') { - if (typeof cb === 'undefined') cb = alignBits; - mode = null; - alignBits = null; - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE; - var hbits = alignBits & (1 << 3) - 1; - var vbits = alignBits >> 3; // check if more flags than one is in the bit sets - - if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) { - return _utils.throwError.call(this, 'only use one flag per alignment direction', cb); - } - - var alignH = hbits >> 1; // 0, 1, 2 - - var alignV = vbits >> 1; // 0, 1, 2 - - var f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width; - var c = this.cloneQuiet().scale(f, mode); - this.resize(w, h, mode); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data.writeUInt32BE(this._background, idx); - }); - this.blit(c, (this.bitmap.width - c.bitmap.width) / 2 * alignH, (this.bitmap.height - c.bitmap.height) / 2 * alignV); +var _default = () => ({ + contain(w, h, alignBits, mode, cb) { + if (typeof w !== "number" || typeof h !== "number") { + return _utils.throwError.call(this, "w and h must be numbers", cb); + } - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } + // permit any sort of optional parameters combination + if (typeof alignBits === "string") { + if (typeof mode === "function" && typeof cb === "undefined") cb = mode; + mode = alignBits; + alignBits = null; + } + if (typeof alignBits === "function") { + if (typeof cb === "undefined") cb = alignBits; + mode = null; + alignBits = null; + } + if (typeof mode === "function" && typeof cb === "undefined") { + cb = mode; + mode = null; + } + alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE; + const hbits = alignBits & (1 << 3) - 1; + const vbits = alignBits >> 3; - return this; + // check if more flags than one is in the bit sets + if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) { + return _utils.throwError.call(this, "only use one flag per alignment direction", cb); } - }; -}; + const alignH = hbits >> 1; // 0, 1, 2 + const alignV = vbits >> 1; // 0, 1, 2 -exports["default"] = _default; + const f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width; + const c = this.cloneQuiet().scale(f, mode); + this.resize(w, h, mode); + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + this.bitmap.data.writeUInt32BE(this._background, idx); + }); + this.blit(c, (this.bitmap.width - c.bitmap.width) / 2 * alignH, (this.bitmap.height - c.bitmap.height) / 2 * alignV); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + } +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-contain/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-contain/dist/index.js.map index 62c5b292..2975ecb4 100644 --- a/project starter code/node_modules/@jimp/plugin-contain/dist/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-contain/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["contain","w","h","alignBits","mode","cb","throwError","call","constructor","HORIZONTAL_ALIGN_CENTER","VERTICAL_ALIGN_MIDDLE","hbits","vbits","alignH","alignV","f","bitmap","width","height","c","cloneQuiet","scale","resize","scanQuiet","x","y","idx","data","writeUInt32BE","_background","blit"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;eASe;AAAA,SAAO;AACpBA,IAAAA,OADoB,m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":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n contain(w, h, alignBits, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n // permit any sort of optional parameters combination\n if (typeof alignBits === 'string') {\n if (typeof mode === 'function' && typeof cb === 'undefined') cb = mode;\n mode = alignBits;\n alignBits = null;\n }\n\n if (typeof alignBits === 'function') {\n if (typeof cb === 'undefined') cb = alignBits;\n mode = null;\n alignBits = null;\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n alignBits =\n alignBits ||\n this.constructor.HORIZONTAL_ALIGN_CENTER |\n this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & ((1 << 3) - 1);\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (\n !(\n (hbits !== 0 && !(hbits & (hbits - 1))) ||\n (vbits !== 0 && !(vbits & (vbits - 1)))\n )\n ) {\n return throwError.call(\n this,\n 'only use one flag per alignment direction',\n cb\n );\n }\n\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? h / this.bitmap.height\n : w / this.bitmap.width;\n const c = this.cloneQuiet().scale(f, mode);\n\n this.resize(w, h, mode);\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n });\n this.blit(\n c,\n ((this.bitmap.width - c.bitmap.width) / 2) * alignH,\n ((this.bitmap.height - c.bitmap.height) / 2) * alignV\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["contain","w","h","alignBits","mode","cb","throwError","call","constructor","HORIZONTAL_ALIGN_CENTER","VERTICAL_ALIGN_MIDDLE","hbits","vbits","alignH","alignV","f","bitmap","width","height","c","cloneQuiet","scale","resize","scanQuiet","x","y","idx","data","writeUInt32BE","_background","blit","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n contain(w, h, alignBits, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n // permit any sort of optional parameters combination\n if (typeof alignBits === \"string\") {\n if (typeof mode === \"function\" && typeof cb === \"undefined\") cb = mode;\n mode = alignBits;\n alignBits = null;\n }\n\n if (typeof alignBits === \"function\") {\n if (typeof cb === \"undefined\") cb = alignBits;\n mode = null;\n alignBits = null;\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n alignBits =\n alignBits ||\n this.constructor.HORIZONTAL_ALIGN_CENTER |\n this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & ((1 << 3) - 1);\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (\n !(\n (hbits !== 0 && !(hbits & (hbits - 1))) ||\n (vbits !== 0 && !(vbits & (vbits - 1)))\n )\n ) {\n return throwError.call(\n this,\n \"only use one flag per alignment direction\",\n cb\n );\n }\n\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? h / this.bitmap.height\n : w / this.bitmap.width;\n const c = this.cloneQuiet().scale(f, mode);\n\n this.resize(w, h, mode);\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n }\n );\n this.blit(\n c,\n ((this.bitmap.width - c.bitmap.width) / 2) * alignH,\n ((this.bitmap.height - c.bitmap.height) / 2) * alignV\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA,eASe,OAAO;EACpBA,OAAO,CAACC,CAAC,EAAEC,CAAC,EAAEC,SAAS,EAAEC,IAAI,EAAEC,EAAE,EAAE;IACjC,IAAI,OAAOJ,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAAE;MAClD,OAAOI,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAEF,EAAE,CAAC;IAC7D;;IAEA;IACA,IAAI,OAAOF,SAAS,KAAK,QAAQ,EAAE;MACjC,IAAI,OAAOC,IAAI,KAAK,UAAU,IAAI,OAAOC,EAAE,KAAK,WAAW,EAAEA,EAAE,GAAGD,IAAI;MACtEA,IAAI,GAAGD,SAAS;MAChBA,SAAS,GAAG,IAAI;IAClB;IAEA,IAAI,OAAOA,SAAS,KAAK,UAAU,EAAE;MACnC,IAAI,OAAOE,EAAE,KAAK,WAAW,EAAEA,EAAE,GAAGF,SAAS;MAC7CC,IAAI,GAAG,IAAI;MACXD,SAAS,GAAG,IAAI;IAClB;IAEA,IAAI,OAAOC,IAAI,KAAK,UAAU,IAAI,OAAOC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AAE;MACnB,IAAI,CAACV,MAAM,CAACW,IAAI,CAACC,aAAa,CAAC,IAAI,CAACC,WAAW,EAAEH,GAAG,CAAC;IACvD,CAAC,CACF;IACD,IAAI,CAACI,IAAI,CACPX,CAAC,EACA,CAAC,IAAI,CAACH,MAAM,CAACC,KAAK,GAAGE,CAAC,CAACH,MAAM,CAACC,KAAK,IAAI,CAAC,GAAIJ,MAAM,EAClD,CAAC,IAAI,CAACG,MAAM,CAACE,MAAM,GAAGC,CAAC,CAACH,MAAM,CAACE,MAAM,IAAI,CAAC,GAAIJ,MAAM,CACtD;IAED,IAAI,IAAAiB,oBAAa,EAAC1B,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-contain/es/index.js b/project starter code/node_modules/@jimp/plugin-contain/es/index.js index 998bf540..837d35d4 100644 --- a/project starter code/node_modules/@jimp/plugin-contain/es/index.js +++ b/project starter code/node_modules/@jimp/plugin-contain/es/index.js @@ -1,11 +1,4 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); +import { isNodePattern, throwError } from "@jimp/utils"; /** * Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed. @@ -16,59 +9,49 @@ var _utils = require("@jimp/utils"); * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ -var _default = function _default() { - return { - contain: function contain(w, h, alignBits, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } // permit any sort of optional parameters combination - - - if (typeof alignBits === 'string') { - if (typeof mode === 'function' && typeof cb === 'undefined') cb = mode; - mode = alignBits; - alignBits = null; - } - - if (typeof alignBits === 'function') { - if (typeof cb === 'undefined') cb = alignBits; - mode = null; - alignBits = null; - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE; - var hbits = alignBits & (1 << 3) - 1; - var vbits = alignBits >> 3; // check if more flags than one is in the bit sets - - if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) { - return _utils.throwError.call(this, 'only use one flag per alignment direction', cb); - } - - var alignH = hbits >> 1; // 0, 1, 2 - - var alignV = vbits >> 1; // 0, 1, 2 - - var f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width; - var c = this.cloneQuiet().scale(f, mode); - this.resize(w, h, mode); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data.writeUInt32BE(this._background, idx); - }); - this.blit(c, (this.bitmap.width - c.bitmap.width) / 2 * alignH, (this.bitmap.height - c.bitmap.height) / 2 * alignV); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } +export default (() => ({ + contain(w, h, alignBits, mode, cb) { + if (typeof w !== "number" || typeof h !== "number") { + return throwError.call(this, "w and h must be numbers", cb); + } - return this; + // permit any sort of optional parameters combination + if (typeof alignBits === "string") { + if (typeof mode === "function" && typeof cb === "undefined") cb = mode; + mode = alignBits; + alignBits = null; } - }; -}; + if (typeof alignBits === "function") { + if (typeof cb === "undefined") cb = alignBits; + mode = null; + alignBits = null; + } + if (typeof mode === "function" && typeof cb === "undefined") { + cb = mode; + mode = null; + } + alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE; + const hbits = alignBits & (1 << 3) - 1; + const vbits = alignBits >> 3; -exports["default"] = _default; + // check if more flags than one is in the bit sets + if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) { + return throwError.call(this, "only use one flag per alignment direction", cb); + } + const alignH = hbits >> 1; // 0, 1, 2 + const alignV = vbits >> 1; // 0, 1, 2 + + const f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width; + const c = this.cloneQuiet().scale(f, mode); + this.resize(w, h, mode); + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + this.bitmap.data.writeUInt32BE(this._background, idx); + }); + this.blit(c, (this.bitmap.width - c.bitmap.width) / 2 * alignH, (this.bitmap.height - c.bitmap.height) / 2 * alignV); + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + } +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-contain/es/index.js.map b/project starter code/node_modules/@jimp/plugin-contain/es/index.js.map index 62c5b292..9107a9a5 100644 --- a/project starter code/node_modules/@jimp/plugin-contain/es/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-contain/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["contain","w","h","alignBits","mode","cb","throwError","call","constructor","HORIZONTAL_ALIGN_CENTER","VERTICAL_ALIGN_MIDDLE","hbits","vbits","alignH","alignV","f","bitmap","width","height","c","cloneQuiet","scale","resize","scanQuiet","x","y","idx","data","writeUInt32BE","_background","blit"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;eASe;AAAA,SAAO;AACpBA,IAAAA,OADoB,mBACZC,CADY,EACTC,CADS,EACNC,SADM,EACKC,IADL,EACWC,EADX,EACe;AACjC,UAAI,OAAOJ,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,eAAOI,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP;AACD,OAHgC,CAKjC;;;AACA,UAAI,OAAOF,SAAP,KAAqB,QAAzB,EAAmC;AACjC,YAAI,OAAOC,IAAP,KAAgB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,MAAL,CAAYE,MADpB,GAEIjB,CAAC,GAAG,KAAKe,MAAL,CAAYC,KAHtB;AAIA,UAAME,CAAC,GAAG,KAAKC,UAAL,GAAkBC,KAAlB,CAAwBN,CAAxB,EAA2BX,IAA3B,CAAV;AAEA,WAAKkB,MAAL,CAAYrB,CAAZ,EAAeC,CAAf,EAAkBE,IAAlB;AACA,WAAKmB,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKP,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DM,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,aAAKV,MAAL,CAAYW,IAAZ,CAAiBC,aAAjB,CAA+B,KAAKC,WAApC,EAAiDH,GAAjD;AACD,OAND;AAOA,WAAKI,IAAL,CACEX,CADF,EAEG,CAAC,KAAKH,MAAL,CAAYC,KAAZ,GAAoBE,CAAC,CAACH,MAAF,CAASC,KAA9B,IAAuC,CAAxC,GAA6CJ,MAF/C,EAGG,CAAC,KAAKG,MAAL,CAAYE,MAAZ,GAAqBC,CAAC,CAACH,MAAF,CAASE,MAA/B,IAAyC,CAA1C,GAA+CJ,MAHjD;;AAMA,UAAI,0BAAcT,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAzEmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n contain(w, h, alignBits, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n // permit any sort of optional parameters combination\n if (typeof alignBits === 'string') {\n if (typeof mode === 'function' && typeof cb === 'undefined') cb = mode;\n mode = alignBits;\n alignBits = null;\n }\n\n if (typeof alignBits === 'function') {\n if (typeof cb === 'undefined') cb = alignBits;\n mode = null;\n alignBits = null;\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n alignBits =\n alignBits ||\n this.constructor.HORIZONTAL_ALIGN_CENTER |\n this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & ((1 << 3) - 1);\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (\n !(\n (hbits !== 0 && !(hbits & (hbits - 1))) ||\n (vbits !== 0 && !(vbits & (vbits - 1)))\n )\n ) {\n return throwError.call(\n this,\n 'only use one flag per alignment direction',\n cb\n );\n }\n\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? h / this.bitmap.height\n : w / this.bitmap.width;\n const c = this.cloneQuiet().scale(f, mode);\n\n this.resize(w, h, mode);\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n });\n this.blit(\n c,\n ((this.bitmap.width - c.bitmap.width) / 2) * alignH,\n ((this.bitmap.height - c.bitmap.height) / 2) * alignV\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["isNodePattern","throwError","contain","w","h","alignBits","mode","cb","call","constructor","HORIZONTAL_ALIGN_CENTER","VERTICAL_ALIGN_MIDDLE","hbits","vbits","alignH","alignV","f","bitmap","width","height","c","cloneQuiet","scale","resize","scanQuiet","x","y","idx","data","writeUInt32BE","_background","blit"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n contain(w, h, alignBits, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n // permit any sort of optional parameters combination\n if (typeof alignBits === \"string\") {\n if (typeof mode === \"function\" && typeof cb === \"undefined\") cb = mode;\n mode = alignBits;\n alignBits = null;\n }\n\n if (typeof alignBits === \"function\") {\n if (typeof cb === \"undefined\") cb = alignBits;\n mode = null;\n alignBits = null;\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n alignBits =\n alignBits ||\n this.constructor.HORIZONTAL_ALIGN_CENTER |\n this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & ((1 << 3) - 1);\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (\n !(\n (hbits !== 0 && !(hbits & (hbits - 1))) ||\n (vbits !== 0 && !(vbits & (vbits - 1)))\n )\n ) {\n return throwError.call(\n this,\n \"only use one flag per alignment direction\",\n cb\n );\n }\n\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? h / this.bitmap.height\n : w / this.bitmap.width;\n const c = this.cloneQuiet().scale(f, mode);\n\n this.resize(w, h, mode);\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n }\n );\n this.blit(\n c,\n ((this.bitmap.width - c.bitmap.width) / 2) * alignH,\n ((this.bitmap.height - c.bitmap.height) / 2) * alignV\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;EACpBC,OAAO,CAACC,CAAC,EAAEC,CAAC,EAAEC,SAAS,EAAEC,IAAI,EAAEC,EAAE,EAAE;IACjC,IAAI,OAAOJ,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAAE;MAClD,OAAOH,UAAU,CAACO,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAED,EAAE,CAAC;IAC7D;;IAEA;IACA,IAAI,OAAOF,SAAS,KAAK,QAAQ,EAAE;MACjC,IAAI,OAAOC,IAAI,KAAK,UAAU,IAAI,OAAOC,EAAE,KAAK,WAAW,EAAEA,EAAE,GAAGD,IAAI;MACtEA,IAAI,GAAGD,SAAS;MAChBA,SAAS,GAAG,IAAI;IAClB;IAEA,IAAI,OAAOA,SAAS,KAAK,UAAU,EAAE;MACnC,IAAI,OAAOE,EAAE,KAAK,WAAW,EAAEA,EAAE,GAAGF,SAAS;MAC7CC,IAAI,GAAG,IAAI;MACXD,SAAS,GAAG,IAAI;IAClB;IAEA,IAAI,OAAOC,IAAI,KAAK,UAAU,IAAI,OAAOC,EAAE,KAAK,WAAW,EAAE;MAC3DA,EAAE,GAAGD,IAAI;MACTA,IAAI,GAAG,IAAI;IACb;IAEAD,SAAS,GACPA,SAAS,IACT,IAAI,CAACI,WAAW,CAACC,uBAAuB,GACtC,IAAI,CAACD,WAAW,CAACE,qBAAqB;IAC1C,MAAMC,KAAK,GAAGP,SAAS,GAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAE;IACxC,MAAMQ,KAAK,GA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,CAACE,MAAM,GAAGC,CAAC,CAACH,MAAM,CAACE,MAAM,IAAI,CAAC,GAAIJ,MAAM,CACtD;IAED,IAAIf,aAAa,CAACO,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-contain/index.d.ts b/project starter code/node_modules/@jimp/plugin-contain/index.d.ts index 7c5e34b0..8c3306d3 100644 --- a/project starter code/node_modules/@jimp/plugin-contain/index.d.ts +++ b/project starter code/node_modules/@jimp/plugin-contain/index.d.ts @@ -1,9 +1,14 @@ -import { ImageCallback } from '@jimp/core'; +import { ImageCallback } from "@jimp/core"; interface Contain { contain(w: number, h: number, cb?: ImageCallback): this; contain(w: number, h: number, mode?: string, cb?: ImageCallback): this; - contain(w: number, h: number, alignBits?: number, cb?: ImageCallback): this; + contain( + w: number, + h: number, + alignBits?: number, + cb?: ImageCallback + ): this; contain( w: number, h: number, @@ -13,4 +18,4 @@ interface Contain { ): this; } -export default function(): Contain; +export default function (): Contain; diff --git a/project starter code/node_modules/@jimp/plugin-contain/package.json b/project starter code/node_modules/@jimp/plugin-contain/package.json index 6ccbc365..7f4048fc 100644 --- a/project starter code/node_modules/@jimp/plugin-contain/package.json +++ b/project starter code/node_modules/@jimp/plugin-contain/package.json @@ -1,12 +1,13 @@ { "name": "@jimp/plugin-contain", - "version": "0.16.2", + "version": "0.22.12", "description": "contain an image.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js", "test:watch": "npm run test -- --reporter min --watch", "test:coverage": "nyc npm run test", "build": "npm run build:node:production && npm run build:module", @@ -20,8 +21,7 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", @@ -30,14 +30,14 @@ "@jimp/plugin-scale": ">=0.3.5" }, "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/plugin-blit": "^0.16.2", - "@jimp/plugin-resize": "^0.16.2", - "@jimp/plugin-scale": "^0.16.2", - "@jimp/test-utils": "^0.16.2" + "@jimp/custom": "^0.22.12", + "@jimp/plugin-blit": "^0.22.12", + "@jimp/plugin-resize": "^0.22.12", + "@jimp/plugin-scale": "^0.22.12", + "@jimp/test-utils": "^0.22.12" }, "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/plugin-contain/src/index.js b/project starter code/node_modules/@jimp/plugin-contain/src/index.js index 68ea54b3..1736343c 100644 --- a/project starter code/node_modules/@jimp/plugin-contain/src/index.js +++ b/project starter code/node_modules/@jimp/plugin-contain/src/index.js @@ -1,4 +1,4 @@ -import { isNodePattern, throwError } from '@jimp/utils'; +import { isNodePattern, throwError } from "@jimp/utils"; /** * Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed. @@ -11,24 +11,24 @@ import { isNodePattern, throwError } from '@jimp/utils'; */ export default () => ({ contain(w, h, alignBits, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return throwError.call(this, 'w and h must be numbers', cb); + if (typeof w !== "number" || typeof h !== "number") { + return throwError.call(this, "w and h must be numbers", cb); } // permit any sort of optional parameters combination - if (typeof alignBits === 'string') { - if (typeof mode === 'function' && typeof cb === 'undefined') cb = mode; + if (typeof alignBits === "string") { + if (typeof mode === "function" && typeof cb === "undefined") cb = mode; mode = alignBits; alignBits = null; } - if (typeof alignBits === 'function') { - if (typeof cb === 'undefined') cb = alignBits; + if (typeof alignBits === "function") { + if (typeof cb === "undefined") cb = alignBits; mode = null; alignBits = null; } - if (typeof mode === 'function' && typeof cb === 'undefined') { + if (typeof mode === "function" && typeof cb === "undefined") { cb = mode; mode = null; } @@ -49,7 +49,7 @@ export default () => ({ ) { return throwError.call( this, - 'only use one flag per alignment direction', + "only use one flag per alignment direction", cb ); } @@ -64,13 +64,15 @@ export default () => ({ const c = this.cloneQuiet().scale(f, mode); this.resize(w, h, mode); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - this.bitmap.data.writeUInt32BE(this._background, idx); - }); + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + this.bitmap.data.writeUInt32BE(this._background, idx); + } + ); this.blit( c, ((this.bitmap.width - c.bitmap.width) / 2) * alignH, @@ -82,5 +84,5 @@ export default () => ({ } return this; - } + }, }); diff --git a/project starter code/node_modules/@jimp/plugin-contain/test/contain.test.js b/project starter code/node_modules/@jimp/plugin-contain/test/contain.test.js index 154ee358..43e0fb42 100644 --- a/project starter code/node_modules/@jimp/plugin-contain/test/contain.test.js +++ b/project starter code/node_modules/@jimp/plugin-contain/test/contain.test.js @@ -1,48 +1,49 @@ -import { Jimp, mkJGD, hasOwnProp } from '@jimp/test-utils'; -import configure from '@jimp/custom'; -import blit from '@jimp/plugin-blit'; -import resize from '@jimp/plugin-resize'; -import scale from '@jimp/plugin-scale'; +import { Jimp, mkJGD, hasOwnProp } from "@jimp/test-utils"; +import configure from "@jimp/custom"; +import blit from "@jimp/plugin-blit"; +import resize from "@jimp/plugin-resize"; +import scale from "@jimp/plugin-scale"; -import contain from '../src'; +import contain from "../src"; +import { expectToBeJGD } from "@jimp/test-utils/src"; const jimp = configure({ plugins: [scale, resize, blit, contain] }, Jimp); -describe('All align combinations for contain', () => { +describe("All align combinations for contain", () => { const verticalJGD = mkJGD( - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆' + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆" ); const horizontalJGD = mkJGD( - '▴▴▴▴▴▴▸▸▸▸▸▸', - '▴▴▴▴▴▴▸▸▸▸▸▸', - '▴▴▴▴▴▴▸▸▸▸▸▸', - '▴▴▴▴▴▴▸▸▸▸▸▸', - '▾▾▾▾▾▾◆◆◆◆◆◆', - '▾▾▾▾▾▾◆◆◆◆◆◆', - '▾▾▾▾▾▾◆◆◆◆◆◆', - '▾▾▾▾▾▾◆◆◆◆◆◆' + "▴▴▴▴▴▴▸▸▸▸▸▸", + "▴▴▴▴▴▴▸▸▸▸▸▸", + "▴▴▴▴▴▴▸▸▸▸▸▸", + "▴▴▴▴▴▴▸▸▸▸▸▸", + "▾▾▾▾▾▾◆◆◆◆◆◆", + "▾▾▾▾▾▾◆◆◆◆◆◆", + "▾▾▾▾▾▾◆◆◆◆◆◆", + "▾▾▾▾▾▾◆◆◆◆◆◆" ); let vertical; let horizontal; // stores the Jimp instances of the JGD images above. - before(done => { + before((done) => { const img1 = jimp.read(verticalJGD); const img2 = jimp.read(horizontalJGD); Promise.all([img1, img2]) - .then(images => { + .then((images) => { vertical = images[0]; horizontal = images[1]; done(); @@ -51,79 +52,77 @@ describe('All align combinations for contain', () => { }); const tests = {}; // Stores the expected result for each alignment combination. - tests['LEFT TOP'] = { + tests["LEFT TOP"] = { contain: { - verti: mkJGD('▴▴▸▸ ', '▴▴▸▸ ', '▴▴▸▸ ', '▾▾◆◆ ', '▾▾◆◆ ', '▾▾◆◆ '), - horiz: mkJGD('▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆', ' ', ' ') - } + verti: mkJGD("▴▴▸▸ ", "▴▴▸▸ ", "▴▴▸▸ ", "▾▾◆◆ ", "▾▾◆◆ ", "▾▾◆◆ "), + horiz: mkJGD("▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆", " ", " "), + }, }; - tests['CENTER TOP'] = { + tests["CENTER TOP"] = { contain: { - verti: mkJGD(' ▴▴▸▸ ', ' ▴▴▸▸ ', ' ▴▴▸▸ ', ' ▾▾◆◆ ', ' ▾▾◆◆ ', ' ▾▾◆◆ '), - horiz: mkJGD('▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆', ' ', ' ') - } + verti: mkJGD(" ▴▴▸▸ ", " ▴▴▸▸ ", " ▴▴▸▸ ", " ▾▾◆◆ ", " ▾▾◆◆ ", " ▾▾◆◆ "), + horiz: mkJGD("▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆", " ", " "), + }, }; - tests['RIGHT TOP'] = { + tests["RIGHT TOP"] = { contain: { - verti: mkJGD(' ▴▴▸▸', ' ▴▴▸▸', ' ▴▴▸▸', ' ▾▾◆◆', ' ▾▾◆◆', ' ▾▾◆◆'), - horiz: mkJGD('▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆', ' ', ' ') - } + verti: mkJGD(" ▴▴▸▸", " ▴▴▸▸", " ▴▴▸▸", " ▾▾◆◆", " ▾▾◆◆", " ▾▾◆◆"), + horiz: mkJGD("▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆", " ", " "), + }, }; - tests['LEFT MIDDLE'] = { + tests["LEFT MIDDLE"] = { contain: { - verti: mkJGD('▴▴▸▸ ', '▴▴▸▸ ', '▴▴▸▸ ', '▾▾◆◆ ', '▾▾◆◆ ', '▾▾◆◆ '), - horiz: mkJGD(' ', '▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆', ' ') - } + verti: mkJGD("▴▴▸▸ ", "▴▴▸▸ ", "▴▴▸▸ ", "▾▾◆◆ ", "▾▾◆◆ ", "▾▾◆◆ "), + horiz: mkJGD(" ", "▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆", " "), + }, }; - tests['CENTER MIDDLE'] = { + tests["CENTER MIDDLE"] = { contain: { - verti: mkJGD(' ▴▴▸▸ ', ' ▴▴▸▸ ', ' ▴▴▸▸ ', ' ▾▾◆◆ ', ' ▾▾◆◆ ', ' ▾▾◆◆ '), - horiz: mkJGD(' ', '▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆', ' ') - } + verti: mkJGD(" ▴▴▸▸ ", " ▴▴▸▸ ", " ▴▴▸▸ ", " ▾▾◆◆ ", " ▾▾◆◆ ", " ▾▾◆◆ "), + horiz: mkJGD(" ", "▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆", " "), + }, }; - tests['RIGHT MIDDLE'] = { + tests["RIGHT MIDDLE"] = { contain: { - verti: mkJGD(' ▴▴▸▸', ' ▴▴▸▸', ' ▴▴▸▸', ' ▾▾◆◆', ' ▾▾◆◆', ' ▾▾◆◆'), - horiz: mkJGD(' ', '▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆', ' ') - } + verti: mkJGD(" ▴▴▸▸", " ▴▴▸▸", " ▴▴▸▸", " ▾▾◆◆", " ▾▾◆◆", " ▾▾◆◆"), + horiz: mkJGD(" ", "▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆", " "), + }, }; - tests['LEFT BOTTOM'] = { + tests["LEFT BOTTOM"] = { contain: { - verti: mkJGD('▴▴▸▸ ', '▴▴▸▸ ', '▴▴▸▸ ', '▾▾◆◆ ', '▾▾◆◆ ', '▾▾◆◆ '), - horiz: mkJGD(' ', ' ', '▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆') - } + verti: mkJGD("▴▴▸▸ ", "▴▴▸▸ ", "▴▴▸▸ ", "▾▾◆◆ ", "▾▾◆◆ ", "▾▾◆◆ "), + horiz: mkJGD(" ", " ", "▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆"), + }, }; - tests['CENTER BOTTOM'] = { + tests["CENTER BOTTOM"] = { contain: { - verti: mkJGD(' ▴▴▸▸ ', ' ▴▴▸▸ ', ' ▴▴▸▸ ', ' ▾▾◆◆ ', ' ▾▾◆◆ ', ' ▾▾◆◆ '), - horiz: mkJGD(' ', ' ', '▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆') - } + verti: mkJGD(" ▴▴▸▸ ", " ▴▴▸▸ ", " ▴▴▸▸ ", " ▾▾◆◆ ", " ▾▾◆◆ ", " ▾▾◆◆ "), + horiz: mkJGD(" ", " ", "▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆"), + }, }; - tests['RIGHT BOTTOM'] = { + tests["RIGHT BOTTOM"] = { contain: { - verti: mkJGD(' ▴▴▸▸', ' ▴▴▸▸', ' ▴▴▸▸', ' ▾▾◆◆', ' ▾▾◆◆', ' ▾▾◆◆'), - horiz: mkJGD(' ', ' ', '▴▴▴▸▸▸', '▴▴▴▸▸▸', '▾▾▾◆◆◆', '▾▾▾◆◆◆') - } + verti: mkJGD(" ▴▴▸▸", " ▴▴▸▸", " ▴▴▸▸", " ▾▾◆◆", " ▾▾◆◆", " ▾▾◆◆"), + horiz: mkJGD(" ", " ", "▴▴▴▸▸▸", "▴▴▴▸▸▸", "▾▾▾◆◆◆", "▾▾▾◆◆◆"), + }, }; function runAlignTest(align) { const jgdContainV = tests[align].contain.verti; const jgdContainH = tests[align].contain.horiz; - let a = align.split(' '); - a = Jimp['HORIZONTAL_ALIGN_' + a[0]] | Jimp['VERTICAL_ALIGN_' + a[1]]; - it('contain aligned to ' + align, () => { - vertical - .clone() - .contain(6, 6, a) - .getJGDSync() - .should.be.sameJGD(jgdContainV, 'Vertical image'); - horizontal - .clone() - .contain(6, 6, a) - .getJGDSync() - .should.be.sameJGD(jgdContainH, 'Horizontal image'); + let a = align.split(" "); + a = Jimp["HORIZONTAL_ALIGN_" + a[0]] | Jimp["VERTICAL_ALIGN_" + a[1]]; + it("contain aligned to " + align, () => { + expectToBeJGD( + vertical.clone().contain(6, 6, a).getJGDSync(), + jgdContainV + ); + expectToBeJGD( + horizontal.clone().contain(6, 6, a).getJGDSync(), + jgdContainH + ); }); } diff --git a/project starter code/node_modules/@jimp/plugin-cover/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-cover/CHANGELOG.md index 26394e0f..3d839517 100644 --- a/project starter code/node_modules/@jimp/plugin-cover/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/plugin-cover/CHANGELOG.md @@ -1,3 +1,65 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.22.0 (Mon Feb 06 2023) + +#### 🏠 Internal + +- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Daniel Holmes ([@danielholmes](https://github.com/danielholmes)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -12,7 +74,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -20,4 +82,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-cover/README.md b/project starter code/node_modules/@jimp/plugin-cover/README.md index 22d2ae07..8313aa2c 100644 --- a/project starter code/node_modules/@jimp/plugin-cover/README.md +++ b/project starter code/node_modules/@jimp/plugin-cover/README.md @@ -15,10 +15,10 @@ Scale the image so the given width and height keeping the aspect ratio. Some par - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.cover(150, 100); } diff --git a/project starter code/node_modules/@jimp/plugin-cover/dist/index.js b/project starter code/node_modules/@jimp/plugin-cover/dist/index.js index b64d9e5e..18461721 100644 --- a/project starter code/node_modules/@jimp/plugin-cover/dist/index.js +++ b/project starter code/node_modules/@jimp/plugin-cover/dist/index.js @@ -3,10 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - +exports.default = void 0; var _utils = require("@jimp/utils"); - /** * Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped. * @param {number} w the width to resize the image to @@ -16,44 +14,38 @@ var _utils = require("@jimp/utils"); * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ -var _default = function _default() { - return { - cover: function cover(w, h, alignBits, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } - - if (alignBits && typeof alignBits === 'function' && typeof cb === 'undefined') { - cb = alignBits; - alignBits = null; - mode = null; - } else if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE; - var hbits = alignBits & (1 << 3) - 1; - var vbits = alignBits >> 3; // check if more flags than one is in the bit sets - - if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) return _utils.throwError.call(this, 'only use one flag per alignment direction', cb); - var alignH = hbits >> 1; // 0, 1, 2 - - var alignV = vbits >> 1; // 0, 1, 2 - - var f = w / h > this.bitmap.width / this.bitmap.height ? w / this.bitmap.width : h / this.bitmap.height; - this.scale(f, mode); - this.crop((this.bitmap.width - w) / 2 * alignH, (this.bitmap.height - h) / 2 * alignV, w, h); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; +var _default = () => ({ + cover(w, h, alignBits, mode, cb) { + if (typeof w !== "number" || typeof h !== "number") { + return _utils.throwError.call(this, "w and h must be numbers", cb); } - }; -}; - -exports["default"] = _default; + if (alignBits && typeof alignBits === "function" && typeof cb === "undefined") { + cb = alignBits; + alignBits = null; + mode = null; + } else if (typeof mode === "function" && typeof cb === "undefined") { + cb = mode; + mode = null; + } + alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE; + const hbits = alignBits & (1 << 3) - 1; + const vbits = alignBits >> 3; + + // check if more flags than one is in the bit sets + if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) return _utils.throwError.call(this, "only use one flag per alignment direction", cb); + const alignH = hbits >> 1; // 0, 1, 2 + const alignV = vbits >> 1; // 0, 1, 2 + + const f = w / h > this.bitmap.width / this.bitmap.height ? w / this.bitmap.width : h / this.bitmap.height; + this.scale(f, mode); + this.crop((this.bitmap.width - w) / 2 * alignH, (this.bitmap.height - h) / 2 * alignV, w, h); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + } +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-cover/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-cover/dist/index.js.map index 3e6c688f..8d2bc8d8 100644 --- a/project starter code/node_modules/@jimp/plugin-cover/dist/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-cover/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["cover","w","h","alignBits","mode","cb","throwError","call","constructor","HORIZONTAL_ALIGN_CENTER","VERTICAL_ALIGN_MIDDLE","hbits","vbits","alignH","alignV","f","bitmap","width","height","scale","crop"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;eASe;AAAA,SAAO;AACpBA,IAAAA,KADoB,iBACdC,CADc,EACXC,CADW,EACRC,SADQ,EACGC,IADH,EACSC,EADT,EACa;AAC/B,UAAI,OAAOJ,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,eAAOI,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP;AACD;;AAED,UACEF,SAAS,IACT,OAAOA,SAAP,KAAqB,UADrB,IAEA,OAAOE,EAAP,KAAc,WAHhB,EAIE;AACAA,QAAAA,EAAE,GAAGF,SAAL;AACAA,QAAAA,SAAS,GAAG,IAAZ;AACAC,QAAAA,IAAI,GAAG,IAAP;AACD,OARD,MAQO,IAAI,OAAOA,IAAP,KAAgB,UAAhB,IAA8B,OAAOC,EAAP,KAAc,WAAhD,EAA6D;AAClEA,QAAAA,EAAE,GAAGD,IAAL;AACAA,QAAAA,IAAI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D;AA3DmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n cover(w, h, alignBits, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (\n alignBits &&\n typeof alignBits === 'function' &&\n typeof cb === 'undefined'\n ) {\n cb = alignBits;\n alignBits = null;\n mode = null;\n } else if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n alignBits =\n alignBits ||\n this.constructor.HORIZONTAL_ALIGN_CENTER |\n this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & ((1 << 3) - 1);\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (\n !(\n (hbits !== 0 && !(hbits & (hbits - 1))) ||\n (vbits !== 0 && !(vbits & (vbits - 1)))\n )\n )\n return throwError.call(\n this,\n 'only use one flag per alignment direction',\n cb\n );\n\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? w / this.bitmap.width\n : h / this.bitmap.height;\n this.scale(f, mode);\n this.crop(\n ((this.bitmap.width - w) / 2) * alignH,\n ((this.bitmap.height - h) / 2) * alignV,\n w,\n h\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["cover","w","h","alignBits","mode","cb","throwError","call","constructor","HORIZONTAL_ALIGN_CENTER","VERTICAL_ALIGN_MIDDLE","hbits","vbits","alignH","alignV","f","bitmap","width","height","scale","crop","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n cover(w, h, alignBits, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n if (\n alignBits &&\n typeof alignBits === \"function\" &&\n typeof cb === \"undefined\"\n ) {\n cb = alignBits;\n alignBits = null;\n mode = null;\n } else if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n alignBits =\n alignBits ||\n this.constructor.HORIZONTAL_ALIGN_CENTER |\n this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & ((1 << 3) - 1);\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (\n !(\n (hbits !== 0 && !(hbits & (hbits - 1))) ||\n (vbits !== 0 && !(vbits & (vbits - 1)))\n )\n )\n return throwError.call(\n this,\n \"only use one flag per alignment direction\",\n cb\n );\n\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? w / this.bitmap.width\n : h / this.bitmap.height;\n this.scale(f, mode);\n this.crop(\n ((this.bitmap.width - w) / 2) * alignH,\n ((this.bitmap.height - h) / 2) * alignV,\n w,\n h\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA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AAC,GAAG,IAAI,CAACc,MAAM,CAACC,KAAK,GAAG,IAAI,CAACD,MAAM,CAACE,MAAM,GAC1CjB,CAAC,GAAG,IAAI,CAACe,MAAM,CAACC,KAAK,GACrBf,CAAC,GAAG,IAAI,CAACc,MAAM,CAACE,MAAM;IAC5B,IAAI,CAACC,KAAK,CAACJ,CAAC,EAAEX,IAAI,CAAC;IACnB,IAAI,CAACgB,IAAI,CACN,CAAC,IAAI,CAACJ,MAAM,CAACC,KAAK,GAAGhB,CAAC,IAAI,CAAC,GAAIY,MAAM,EACrC,CAAC,IAAI,CAACG,MAAM,CAACE,MAAM,GAAGhB,CAAC,IAAI,CAAC,GAAIY,MAAM,EACvCb,CAAC,EACDC,CAAC,CACF;IAED,IAAI,IAAAmB,oBAAa,EAAChB,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-cover/es/index.js b/project starter code/node_modules/@jimp/plugin-cover/es/index.js index ffae0743..165d9178 100644 --- a/project starter code/node_modules/@jimp/plugin-cover/es/index.js +++ b/project starter code/node_modules/@jimp/plugin-cover/es/index.js @@ -1,11 +1,4 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); +import { isNodePattern, throwError } from "@jimp/utils"; /** * Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped. @@ -16,43 +9,35 @@ var _utils = require("@jimp/utils"); * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ -var _default = function _default() { - return { - cover: function cover(w, h, alignBits, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } - - if (alignBits && typeof alignBits === 'function' && typeof cb === 'undefined') { - cb = alignBits; - alignBits = null; - mode = null; - } else if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE; - var hbits = alignBits & (1 << 3) - 1; - var vbits = alignBits >> 3; // check if more flags than one is in the bit sets - - if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) return _utils.throwError.call(this, 'only use one flag per alignment direction', cb); - var alignH = hbits >> 1; // 0, 1, 2 - - var alignV = vbits >> 1; // 0, 1, 2 - - var f = w / h > this.bitmap.width / this.bitmap.height ? w / this.bitmap.width : h / this.bitmap.height; - this.scale(f, mode); - this.crop((this.bitmap.width - w) / 2 * alignH, (this.bitmap.height - h) / 2 * alignV, w, h); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; +export default (() => ({ + cover(w, h, alignBits, mode, cb) { + if (typeof w !== "number" || typeof h !== "number") { + return throwError.call(this, "w and h must be numbers", cb); } - }; -}; - -exports["default"] = _default; + if (alignBits && typeof alignBits === "function" && typeof cb === "undefined") { + cb = alignBits; + alignBits = null; + mode = null; + } else if (typeof mode === "function" && typeof cb === "undefined") { + cb = mode; + mode = null; + } + alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE; + const hbits = alignBits & (1 << 3) - 1; + const vbits = alignBits >> 3; + + // check if more flags than one is in the bit sets + if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) return throwError.call(this, "only use one flag per alignment direction", cb); + const alignH = hbits >> 1; // 0, 1, 2 + const alignV = vbits >> 1; // 0, 1, 2 + + const f = w / h > this.bitmap.width / this.bitmap.height ? w / this.bitmap.width : h / this.bitmap.height; + this.scale(f, mode); + this.crop((this.bitmap.width - w) / 2 * alignH, (this.bitmap.height - h) / 2 * alignV, w, h); + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + } +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-cover/es/index.js.map b/project starter code/node_modules/@jimp/plugin-cover/es/index.js.map index 3e6c688f..edc1c548 100644 --- a/project starter code/node_modules/@jimp/plugin-cover/es/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-cover/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["cover","w","h","alignBits","mode","cb","throwError","call","constructor","HORIZONTAL_ALIGN_CENTER","VERTICAL_ALIGN_MIDDLE","hbits","vbits","alignH","alignV","f","bitmap","width","height","scale","crop"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;eASe;AAAA,SAAO;AACpBA,IAAAA,KADoB,iBACdC,CADc,EACXC,CADW,EACRC,SADQ,EACGC,IADH,EACSC,EADT,EACa;AAC/B,UAAI,OAAOJ,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,eAAOI,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP;AACD;;AAED,UACEF,SAAS,IACT,OAAOA,SAAP,KAAqB,UADrB,IAEA,OAAOE,EAAP,KAAc,WAHhB,EAIE;AACAA,QAAAA,EAAE,GAAGF,SAAL;AACAA,QAAAA,SAAS,GAAG,IAAZ;AACAC,QAAAA,IAAI,GAAG,IAAP;AACD,OARD,MAQO,IAAI,OAAOA,IAAP,KAAgB,UAAhB,IAA8B,OAAOC,EAAP,KAAc,WAAhD,EAA6D;AAClEA,QAAAA,EAAE,GAAGD,IAAL;AACAA,QAAAA,IAAI,GAAG,IAAP;AACD;;AAEDD,MAAAA,SAAS,GACPA,SAAS,IACT,KAAKK,WAAL,CAAiBC,uBAAjB,GACE,KAAKD,WAAL,CAAiBE,qBAHrB;AAIA,UAAMC,KAAK,GAAGR,SAAS,GAAI,CAAC,KAAK,CAAN,IAAW,CAAtC;AACA,UAAMS,KAAK,GAAGT,SAAS,IAAI,CAA3B,CAvB+B,CAyB/B;;AACA,UACE,EACGQ,KAAK,KAAK,CAAV,IAAe,EAAEA,KAAK,GAAIA,KAAK,GAAG,CAAnB,CAAhB,IACCC,KAAK,KAAK,CAAV,IAAe,EAAEA,KAAK,GAAIA,KAAK,GAAG,CAAnB,CAFlB,CADF,EAME,OAAON,kBAAWC,IAAX,CACL,IADK,EAEL,2CAFK,EAGLF,EAHK,CAAP;AAMF,UAAMQ,MAAM,GAAGF,KAAK,IAAI,CAAxB,CAtC+B,CAsCJ;;AAC3B,UAAMG,MAAM,GAAGF,KAAK,IAAI,CAAxB,CAvC+B,CAuCJ;;AAE3B,UAAMG,CAAC,GACLd,CAAC,GAAGC,CAAJ,GAAQ,KAAKc,MAAL,CAAYC,KAAZ,GAAoB,KAAKD,MAAL,CAAYE,MAAxC,GACIjB,CAAC,GAAG,KAAKe,MAAL,CAAYC,KADpB,GAEIf,CAAC,GAAG,KAAKc,MAAL,CAAYE,MAHtB;AAIA,WAAKC,KAAL,CAAWJ,CAAX,EAAcX,IAAd;AACA,WAAKgB,IAAL,CACG,CAAC,KAAKJ,MAAL,CAAYC,KAAZ,GAAoBhB,CAArB,IAA0B,CAA3B,GAAgCY,MADlC,EAEG,CAAC,KAAKG,MAAL,CAAYE,MAAZ,GAAqBhB,CAAtB,IAA2B,CAA5B,GAAiCY,MAFnC,EAGEb,CAHF,EAIEC,CAJF;;AAOA,UAAI,0BAAcG,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA3DmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n cover(w, h, alignBits, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (\n alignBits &&\n typeof alignBits === 'function' &&\n typeof cb === 'undefined'\n ) {\n cb = alignBits;\n alignBits = null;\n mode = null;\n } else if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n alignBits =\n alignBits ||\n this.constructor.HORIZONTAL_ALIGN_CENTER |\n this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & ((1 << 3) - 1);\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (\n !(\n (hbits !== 0 && !(hbits & (hbits - 1))) ||\n (vbits !== 0 && !(vbits & (vbits - 1)))\n )\n )\n return throwError.call(\n this,\n 'only use one flag per alignment direction',\n cb\n );\n\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? w / this.bitmap.width\n : h / this.bitmap.height;\n this.scale(f, mode);\n this.crop(\n ((this.bitmap.width - w) / 2) * alignH,\n ((this.bitmap.height - h) / 2) * alignV,\n w,\n h\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["isNodePattern","throwError","cover","w","h","alignBits","mode","cb","call","constructor","HORIZONTAL_ALIGN_CENTER","VERTICAL_ALIGN_MIDDLE","hbits","vbits","alignH","alignV","f","bitmap","width","height","scale","crop"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n cover(w, h, alignBits, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n if (\n alignBits &&\n typeof alignBits === \"function\" &&\n typeof cb === \"undefined\"\n ) {\n cb = alignBits;\n alignBits = null;\n mode = null;\n } else if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n alignBits =\n alignBits ||\n this.constructor.HORIZONTAL_ALIGN_CENTER |\n this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & ((1 << 3) - 1);\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (\n !(\n (hbits !== 0 && !(hbits & (hbits - 1))) ||\n (vbits !== 0 && !(vbits & (vbits - 1)))\n )\n )\n return throwError.call(\n this,\n \"only use one flag per alignment direction\",\n cb\n );\n\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? w / this.bitmap.width\n : h / this.bitmap.height;\n this.scale(f, mode);\n this.crop(\n ((this.bitmap.width - w) / 2) * alignH,\n ((this.bitmap.height - h) / 2) * alignV,\n w,\n h\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;EACpBC,KAAK,CAACC,CAAC,EAAEC,CAAC,EAAEC,SAAS,EAAEC,IAAI,EAAEC,EAAE,EAAE;IAC/B,IAAI,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AI,CAACa,MAAM,CAACE,MAAM;IAC5B,IAAI,CAACC,KAAK,CAACJ,CAAC,EAAEV,IAAI,CAAC;IACnB,IAAI,CAACe,IAAI,CACN,CAAC,IAAI,CAACJ,MAAM,CAACC,KAAK,GAAGf,CAAC,IAAI,CAAC,GAAIW,MAAM,EACrC,CAAC,IAAI,CAACG,MAAM,CAACE,MAAM,GAAGf,CAAC,IAAI,CAAC,GAAIW,MAAM,EACvCZ,CAAC,EACDC,CAAC,CACF;IAED,IAAIJ,aAAa,CAACO,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-cover/index.d.ts b/project starter code/node_modules/@jimp/plugin-cover/index.d.ts index 19209341..6a9e5d1c 100644 --- a/project starter code/node_modules/@jimp/plugin-cover/index.d.ts +++ b/project starter code/node_modules/@jimp/plugin-cover/index.d.ts @@ -1,8 +1,13 @@ -import { ImageCallback } from '@jimp/core'; +import { ImageCallback } from "@jimp/core"; interface Cover { cover(w: number, h: number, cb?: ImageCallback): this; - cover(w: number, h: number, alignBits?: number, cb?: ImageCallback): this; + cover( + w: number, + h: number, + alignBits?: number, + cb?: ImageCallback + ): this; cover( w: number, h: number, @@ -12,4 +17,4 @@ interface Cover { ): this; } -export default function(): Cover; +export default function (): Cover; diff --git a/project starter code/node_modules/@jimp/plugin-cover/package.json b/project starter code/node_modules/@jimp/plugin-cover/package.json index 81b0bcdd..708db221 100644 --- a/project starter code/node_modules/@jimp/plugin-cover/package.json +++ b/project starter code/node_modules/@jimp/plugin-cover/package.json @@ -1,12 +1,13 @@ { "name": "@jimp/plugin-cover", - "version": "0.16.2", + "version": "0.22.12", "description": "cover an image.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js", "test:watch": "npm run test -- --reporter min --watch", "test:coverage": "nyc npm run test", "build": "npm run build:node:production && npm run build:module", @@ -20,8 +21,7 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", @@ -30,14 +30,14 @@ "@jimp/plugin-scale": ">=0.3.5" }, "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/plugin-crop": "^0.16.2", - "@jimp/plugin-resize": "^0.16.2", - "@jimp/plugin-scale": "^0.16.2", - "@jimp/test-utils": "^0.16.2" + "@jimp/custom": "^0.22.12", + "@jimp/plugin-crop": "^0.22.12", + "@jimp/plugin-resize": "^0.22.12", + "@jimp/plugin-scale": "^0.22.12", + "@jimp/test-utils": "^0.22.12" }, "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/plugin-cover/src/index.js b/project starter code/node_modules/@jimp/plugin-cover/src/index.js index c290481e..37a0f1b7 100644 --- a/project starter code/node_modules/@jimp/plugin-cover/src/index.js +++ b/project starter code/node_modules/@jimp/plugin-cover/src/index.js @@ -1,4 +1,4 @@ -import { isNodePattern, throwError } from '@jimp/utils'; +import { isNodePattern, throwError } from "@jimp/utils"; /** * Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped. @@ -11,19 +11,19 @@ import { isNodePattern, throwError } from '@jimp/utils'; */ export default () => ({ cover(w, h, alignBits, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return throwError.call(this, 'w and h must be numbers', cb); + if (typeof w !== "number" || typeof h !== "number") { + return throwError.call(this, "w and h must be numbers", cb); } if ( alignBits && - typeof alignBits === 'function' && - typeof cb === 'undefined' + typeof alignBits === "function" && + typeof cb === "undefined" ) { cb = alignBits; alignBits = null; mode = null; - } else if (typeof mode === 'function' && typeof cb === 'undefined') { + } else if (typeof mode === "function" && typeof cb === "undefined") { cb = mode; mode = null; } @@ -44,7 +44,7 @@ export default () => ({ ) return throwError.call( this, - 'only use one flag per alignment direction', + "only use one flag per alignment direction", cb ); @@ -68,5 +68,5 @@ export default () => ({ } return this; - } + }, }); diff --git a/project starter code/node_modules/@jimp/plugin-cover/test/cover.test.js b/project starter code/node_modules/@jimp/plugin-cover/test/cover.test.js index fc08ac63..ba61d3bb 100644 --- a/project starter code/node_modules/@jimp/plugin-cover/test/cover.test.js +++ b/project starter code/node_modules/@jimp/plugin-cover/test/cover.test.js @@ -1,48 +1,49 @@ -import { Jimp, mkJGD, hasOwnProp } from '@jimp/test-utils'; -import configure from '@jimp/custom'; -import crop from '@jimp/plugin-crop'; -import scale from '@jimp/plugin-scale'; -import resize from '@jimp/plugin-resize'; +import { Jimp, mkJGD, hasOwnProp } from "@jimp/test-utils"; +import configure from "@jimp/custom"; +import crop from "@jimp/plugin-crop"; +import scale from "@jimp/plugin-scale"; +import resize from "@jimp/plugin-resize"; -import cover from '../src'; +import cover from "../src"; +import { expectToBeJGD } from "@jimp/test-utils/src"; const jimp = configure({ plugins: [resize, scale, crop, cover] }, Jimp); -describe('All align combinations for cover', () => { +describe("All align combinations for cover", () => { const verticalJGD = mkJGD( - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▴▴▴▴▸▸▸▸', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆', - '▾▾▾▾◆◆◆◆' + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▴▴▴▴▸▸▸▸", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆", + "▾▾▾▾◆◆◆◆" ); const horizontalJGD = mkJGD( - '▴▴▴▴▴▴▸▸▸▸▸▸', - '▴▴▴▴▴▴▸▸▸▸▸▸', - '▴▴▴▴▴▴▸▸▸▸▸▸', - '▴▴▴▴▴▴▸▸▸▸▸▸', - '▾▾▾▾▾▾◆◆◆◆◆◆', - '▾▾▾▾▾▾◆◆◆◆◆◆', - '▾▾▾▾▾▾◆◆◆◆◆◆', - '▾▾▾▾▾▾◆◆◆◆◆◆' + "▴▴▴▴▴▴▸▸▸▸▸▸", + "▴▴▴▴▴▴▸▸▸▸▸▸", + "▴▴▴▴▴▴▸▸▸▸▸▸", + "▴▴▴▴▴▴▸▸▸▸▸▸", + "▾▾▾▾▾▾◆◆◆◆◆◆", + "▾▾▾▾▾▾◆◆◆◆◆◆", + "▾▾▾▾▾▾◆◆◆◆◆◆", + "▾▾▾▾▾▾◆◆◆◆◆◆" ); let vertical; let horizontal; // stores the Jimp instances of the JGD images above. - before(done => { + before((done) => { const img1 = jimp.read(verticalJGD); const img2 = jimp.read(horizontalJGD); Promise.all([img1, img2]) - .then(images => { + .then((images) => { vertical = images[0]; horizontal = images[1]; done(); @@ -51,79 +52,71 @@ describe('All align combinations for cover', () => { }); const tests = {}; // Stores the expected result for each alignment combination. - tests['LEFT TOP'] = { + tests["LEFT TOP"] = { cover: { - verti: mkJGD('▴▴▸▸', '▴▴▸▸', '▴▴▸▸', '▾▾◆◆'), - horiz: mkJGD('▴▴▴▸', '▴▴▴▸', '▾▾▾◆', '▾▾▾◆') - } + verti: mkJGD("▴▴▸▸", "▴▴▸▸", "▴▴▸▸", "▾▾◆◆"), + horiz: mkJGD("▴▴▴▸", "▴▴▴▸", "▾▾▾◆", "▾▾▾◆"), + }, }; - tests['CENTER TOP'] = { + tests["CENTER TOP"] = { cover: { - verti: mkJGD('▴▴▸▸', '▴▴▸▸', '▴▴▸▸', '▾▾◆◆'), - horiz: mkJGD('▴▴▸▸', '▴▴▸▸', '▾▾◆◆', '▾▾◆◆') - } + verti: mkJGD("▴▴▸▸", "▴▴▸▸", "▴▴▸▸", "▾▾◆◆"), + horiz: mkJGD("▴▴▸▸", "▴▴▸▸", "▾▾◆◆", "▾▾◆◆"), + }, }; - tests['RIGHT TOP'] = { + tests["RIGHT TOP"] = { cover: { - verti: mkJGD('▴▴▸▸', '▴▴▸▸', '▴▴▸▸', '▾▾◆◆'), - horiz: mkJGD('▴▸▸▸', '▴▸▸▸', '▾◆◆◆', '▾◆◆◆') - } + verti: mkJGD("▴▴▸▸", "▴▴▸▸", "▴▴▸▸", "▾▾◆◆"), + horiz: mkJGD("▴▸▸▸", "▴▸▸▸", "▾◆◆◆", "▾◆◆◆"), + }, }; - tests['LEFT MIDDLE'] = { + tests["LEFT MIDDLE"] = { cover: { - verti: mkJGD('▴▴▸▸', '▴▴▸▸', '▾▾◆◆', '▾▾◆◆'), - horiz: mkJGD('▴▴▴▸', '▴▴▴▸', '▾▾▾◆', '▾▾▾◆') - } + verti: mkJGD("▴▴▸▸", "▴▴▸▸", "▾▾◆◆", "▾▾◆◆"), + horiz: mkJGD("▴▴▴▸", "▴▴▴▸", "▾▾▾◆", "▾▾▾◆"), + }, }; - tests['CENTER MIDDLE'] = { + tests["CENTER MIDDLE"] = { cover: { - verti: mkJGD('▴▴▸▸', '▴▴▸▸', '▾▾◆◆', '▾▾◆◆'), - horiz: mkJGD('▴▴▸▸', '▴▴▸▸', '▾▾◆◆', '▾▾◆◆') - } + verti: mkJGD("▴▴▸▸", "▴▴▸▸", "▾▾◆◆", "▾▾◆◆"), + horiz: mkJGD("▴▴▸▸", "▴▴▸▸", "▾▾◆◆", "▾▾◆◆"), + }, }; - tests['RIGHT MIDDLE'] = { + tests["RIGHT MIDDLE"] = { cover: { - verti: mkJGD('▴▴▸▸', '▴▴▸▸', '▾▾◆◆', '▾▾◆◆'), - horiz: mkJGD('▴▸▸▸', '▴▸▸▸', '▾◆◆◆', '▾◆◆◆') - } + verti: mkJGD("▴▴▸▸", "▴▴▸▸", "▾▾◆◆", "▾▾◆◆"), + horiz: mkJGD("▴▸▸▸", "▴▸▸▸", "▾◆◆◆", "▾◆◆◆"), + }, }; - tests['LEFT BOTTOM'] = { + tests["LEFT BOTTOM"] = { cover: { - verti: mkJGD('▴▴▸▸', '▾▾◆◆', '▾▾◆◆', '▾▾◆◆'), - horiz: mkJGD('▴▴▴▸', '▴▴▴▸', '▾▾▾◆', '▾▾▾◆') - } + verti: mkJGD("▴▴▸▸", "▾▾◆◆", "▾▾◆◆", "▾▾◆◆"), + horiz: mkJGD("▴▴▴▸", "▴▴▴▸", "▾▾▾◆", "▾▾▾◆"), + }, }; - tests['CENTER BOTTOM'] = { + tests["CENTER BOTTOM"] = { cover: { - verti: mkJGD('▴▴▸▸', '▾▾◆◆', '▾▾◆◆', '▾▾◆◆'), - horiz: mkJGD('▴▴▸▸', '▴▴▸▸', '▾▾◆◆', '▾▾◆◆') - } + verti: mkJGD("▴▴▸▸", "▾▾◆◆", "▾▾◆◆", "▾▾◆◆"), + horiz: mkJGD("▴▴▸▸", "▴▴▸▸", "▾▾◆◆", "▾▾◆◆"), + }, }; - tests['RIGHT BOTTOM'] = { + tests["RIGHT BOTTOM"] = { cover: { - verti: mkJGD('▴▴▸▸', '▾▾◆◆', '▾▾◆◆', '▾▾◆◆'), - horiz: mkJGD('▴▸▸▸', '▴▸▸▸', '▾◆◆◆', '▾◆◆◆') - } + verti: mkJGD("▴▴▸▸", "▾▾◆◆", "▾▾◆◆", "▾▾◆◆"), + horiz: mkJGD("▴▸▸▸", "▴▸▸▸", "▾◆◆◆", "▾◆◆◆"), + }, }; function runAlignTest(align) { const jgdCoverV = tests[align].cover.verti; const jgdCoverH = tests[align].cover.horiz; - let a = align.split(' '); - a = Jimp['HORIZONTAL_ALIGN_' + a[0]] | Jimp['VERTICAL_ALIGN_' + a[1]]; - it('cover aligned to ' + align, () => { - vertical - .clone() - .cover(4, 4, a) - .getJGDSync() - .should.be.sameJGD(jgdCoverV, 'Vertical image'); - horizontal - .clone() - .cover(4, 4, a) - .getJGDSync() - .should.be.sameJGD(jgdCoverH, 'Horizontal image'); + let a = align.split(" "); + a = Jimp["HORIZONTAL_ALIGN_" + a[0]] | Jimp["VERTICAL_ALIGN_" + a[1]]; + it("cover aligned to " + align, () => { + expectToBeJGD(vertical.clone().cover(4, 4, a).getJGDSync(), jgdCoverV); + expectToBeJGD(horizontal.clone().cover(4, 4, a).getJGDSync(), jgdCoverH); }); } diff --git a/project starter code/node_modules/@jimp/plugin-crop/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-crop/CHANGELOG.md index d74238e7..ffe751ec 100644 --- a/project starter code/node_modules/@jimp/plugin-crop/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/plugin-crop/CHANGELOG.md @@ -1,3 +1,86 @@ +# v0.22.8 (Thu May 11 2023) + +:tada: This release contains work from a new contributor! :tada: + +Thank you, Sjoerd ([@sjoerd108](https://github.com/sjoerd108)), for all your work! + +#### 🐛 Bug Fix + +- Fix autocrop mixing up east and west [#1227](https://github.com/jimp-dev/jimp/pull/1227) ([@sjoerd108](https://github.com/sjoerd108)) + +#### Authors: 1 + +- Sjoerd ([@sjoerd108](https://github.com/sjoerd108)) + +--- + +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.22.0 (Mon Feb 06 2023) + +#### 🏠 Internal + +- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Daniel Holmes ([@danielholmes](https://github.com/danielholmes)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### 🐛 Bug Fix + +- fixed plugin-crop full width slices math [#1073](https://github.com/jimp-dev/jimp/pull/1073) ([@endreszabo](https://github.com/endreszabo)) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Endre Szabo ([@endreszabo](https://github.com/endreszabo)) + +--- + # v0.16.0 (Sat Aug 08 2020) #### 🚀 Enhancement @@ -24,7 +107,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -32,4 +115,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-crop/README.md b/project starter code/node_modules/@jimp/plugin-crop/README.md index 86ea04dd..64689368 100644 --- a/project starter code/node_modules/@jimp/plugin-crop/README.md +++ b/project starter code/node_modules/@jimp/plugin-crop/README.md @@ -16,10 +16,10 @@ Crops the image at a given point to a give size - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.crop(150, 150); } @@ -43,10 +43,10 @@ or - leaveBorder (optional): integer of how many pixels of the background color to leave around the image ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.autocrop(); image.autocrop({ cropOnlyFrames: false, cropSymmetric: true }); diff --git a/project starter code/node_modules/@jimp/plugin-crop/dist/index.js b/project starter code/node_modules/@jimp/plugin-crop/dist/index.js index ea6d0b7d..2c690c49 100644 --- a/project starter code/node_modules/@jimp/plugin-crop/dist/index.js +++ b/project starter code/node_modules/@jimp/plugin-crop/dist/index.js @@ -1,17 +1,12 @@ "use strict"; -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = pluginCrop; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - +exports.default = pluginCrop; var _utils = require("@jimp/utils"); - /* eslint-disable no-labels */ + function pluginCrop(event) { /** * Crops the image at a given point to a give size @@ -22,42 +17,39 @@ function pluginCrop(event) { * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ - event('crop', function (x, y, w, h, cb) { - if (typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'x and y must be numbers', cb); - if (typeof w !== 'number' || typeof h !== 'number') return _utils.throwError.call(this, 'w and h must be numbers', cb); // round input + event("crop", function (x, y, w, h, cb) { + if (typeof x !== "number" || typeof y !== "number") return _utils.throwError.call(this, "x and y must be numbers", cb); + if (typeof w !== "number" || typeof h !== "number") return _utils.throwError.call(this, "w and h must be numbers", cb); + // round input x = Math.round(x); y = Math.round(y); w = Math.round(w); h = Math.round(h); - if (x === 0 && w === this.bitmap.width) { // shortcut - var start = w * y + x << 2; - var end = start + h * w << 2; + const start = w * y + x << 2; + const end = start + (h * w << 2); this.bitmap.data = this.bitmap.data.slice(start, end); } else { - var bitmap = Buffer.allocUnsafe(w * h * 4); - var offset = 0; + const bitmap = Buffer.allocUnsafe(w * h * 4); + let offset = 0; this.scanQuiet(x, y, w, h, function (x, y, idx) { - var data = this.bitmap.data.readUInt32BE(idx, true); + const data = this.bitmap.data.readUInt32BE(idx, true); bitmap.writeUInt32BE(data, offset, true); offset += 4; }); this.bitmap.data = bitmap; } - this.bitmap.width = w; this.bitmap.height = h; - if ((0, _utils.isNodePattern)(cb)) { cb.call(this, null, this); } - return this; }); return { - "class": { + class: { /** * Autocrop same color borders from this image * @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%) @@ -65,201 +57,188 @@ function pluginCrop(event) { * @param {function(Error, Jimp)} cb (optional): a callback for when complete (default: no callback) * @returns {Jimp} this for chaining of methods */ - autocrop: function autocrop() { - var w = this.bitmap.width; - var h = this.bitmap.height; - var minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image - - var cb; // callback - - var leaveBorder = 0; // Amount of pixels in border to leave - - var tolerance = 0.0002; // percent of color difference tolerance (default value) - - var cropOnlyFrames = true; // flag to force cropping only if the image has a real "frame" + autocrop() { + const w = this.bitmap.width; + const h = this.bitmap.height; + const minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image + + let cb; // callback + let leaveBorder = 0; // Amount of pixels in border to leave + let tolerance = 0.0002; // percent of color difference tolerance (default value) + let cropOnlyFrames = true; // flag to force cropping only if the image has a real "frame" // i.e. all 4 sides have some border (default value) - - var cropSymmetric = false; // flag to force cropping top be symmetric. + let cropSymmetric = false; // flag to force cropping top be symmetric. // i.e. north and south / east and west are cropped by the same value - - var ignoreSides = { + let ignoreSides = { north: false, south: false, east: false, west: false - }; // parse arguments + }; + // parse arguments for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } - - for (var a = 0, len = args.length; a < len; a++) { - if (typeof args[a] === 'number') { + for (let a = 0, len = args.length; a < len; a++) { + if (typeof args[a] === "number") { // tolerance value passed tolerance = args[a]; } - - if (typeof args[a] === 'boolean') { + if (typeof args[a] === "boolean") { // cropOnlyFrames value passed cropOnlyFrames = args[a]; } - - if (typeof args[a] === 'function') { + if (typeof args[a] === "function") { // callback value passed cb = args[a]; } - - if ((0, _typeof2["default"])(args[a]) === 'object') { + if (typeof args[a] === "object") { // config object passed - var config = args[a]; - - if (typeof config.tolerance !== 'undefined') { - tolerance = config.tolerance; + const config = args[a]; + if (typeof config.tolerance !== "undefined") { + ({ + tolerance + } = config); } - - if (typeof config.cropOnlyFrames !== 'undefined') { - cropOnlyFrames = config.cropOnlyFrames; + if (typeof config.cropOnlyFrames !== "undefined") { + ({ + cropOnlyFrames + } = config); } - - if (typeof config.cropSymmetric !== 'undefined') { - cropSymmetric = config.cropSymmetric; + if (typeof config.cropSymmetric !== "undefined") { + ({ + cropSymmetric + } = config); } - - if (typeof config.leaveBorder !== 'undefined') { - leaveBorder = config.leaveBorder; + if (typeof config.leaveBorder !== "undefined") { + ({ + leaveBorder + } = config); } - - if (typeof config.ignoreSides !== 'undefined') { - ignoreSides = config.ignoreSides; + if (typeof config.ignoreSides !== "undefined") { + ({ + ignoreSides + } = config); } } } + /** * All borders must be of the same color as the top left pixel, to be cropped. * It should be possible to crop borders each with a different color, * but since there are many ways for corners to intersect, it would * introduce unnecessary complexity to the algorithm. */ - // scan each side for same color borders - - - var colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color - var rgba1 = this.constructor.intToRGBA(colorTarget); // for north and east sides + // scan each side for same color borders + let colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color + const rgba1 = this.constructor.intToRGBA(colorTarget); - var northPixelsToCrop = 0; - var eastPixelsToCrop = 0; - var southPixelsToCrop = 0; - var westPixelsToCrop = 0; // north side (scan rows from north to south) + // for north and east sides + let northPixelsToCrop = 0; + let eastPixelsToCrop = 0; + let southPixelsToCrop = 0; + let westPixelsToCrop = 0; + // north side (scan rows from north to south) colorTarget = this.getPixelColor(0, 0); - if (!ignoreSides.north) { - north: for (var y = 0; y < h - minPixelsPerSide; y++) { - for (var x = 0; x < w; x++) { - var colorXY = this.getPixelColor(x, y); - var rgba2 = this.constructor.intToRGBA(colorXY); - + north: for (let y = 0; y < h - minPixelsPerSide; y++) { + for (let x = 0; x < w; x++) { + const colorXY = this.getPixelColor(x, y); + const rgba2 = this.constructor.intToRGBA(colorXY); if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) { // this pixel is too distant from the first one: abort this side scan break north; } - } // this row contains all pixels with the same color: increment this side pixels to crop - + } + // this row contains all pixels with the same color: increment this side pixels to crop northPixelsToCrop++; } - } // east side (scan columns from east to west) - + } + // west side (scan columns from west to east) colorTarget = this.getPixelColor(w, 0); - - if (!ignoreSides.east) { - east: for (var _x = 0; _x < w - minPixelsPerSide; _x++) { - for (var _y = 0 + northPixelsToCrop; _y < h; _y++) { - var _colorXY = this.getPixelColor(_x, _y); - - var _rgba = this.constructor.intToRGBA(_colorXY); - - if (this.constructor.colorDiff(rgba1, _rgba) > tolerance) { + if (!ignoreSides.west) { + west: for (let x = 0; x < w - minPixelsPerSide; x++) { + for (let y = 0 + northPixelsToCrop; y < h; y++) { + const colorXY = this.getPixelColor(x, y); + const rgba2 = this.constructor.intToRGBA(colorXY); + if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) { // this pixel is too distant from the first one: abort this side scan - break east; + break west; } - } // this column contains all pixels with the same color: increment this side pixels to crop - + } - eastPixelsToCrop++; + // this column contains all pixels with the same color: increment this side pixels to crop + westPixelsToCrop++; } - } // south side (scan rows from south to north) - + } + // south side (scan rows from south to north) colorTarget = this.getPixelColor(0, h); - if (!ignoreSides.south) { - south: for (var _y2 = h - 1; _y2 >= northPixelsToCrop + minPixelsPerSide; _y2--) { - for (var _x2 = w - eastPixelsToCrop - 1; _x2 >= 0; _x2--) { - var _colorXY2 = this.getPixelColor(_x2, _y2); - - var _rgba2 = this.constructor.intToRGBA(_colorXY2); - - if (this.constructor.colorDiff(rgba1, _rgba2) > tolerance) { + south: for (let y = h - 1; y >= northPixelsToCrop + minPixelsPerSide; y--) { + for (let x = w - eastPixelsToCrop - 1; x >= 0; x--) { + const colorXY = this.getPixelColor(x, y); + const rgba2 = this.constructor.intToRGBA(colorXY); + if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) { // this pixel is too distant from the first one: abort this side scan break south; } - } // this row contains all pixels with the same color: increment this side pixels to crop - + } + // this row contains all pixels with the same color: increment this side pixels to crop southPixelsToCrop++; } - } // west side (scan columns from west to east) - + } + // east side (scan columns from east to west) colorTarget = this.getPixelColor(w, h); - - if (!ignoreSides.west) { - west: for (var _x3 = w - 1; _x3 >= 0 + eastPixelsToCrop + minPixelsPerSide; _x3--) { - for (var _y3 = h - 1; _y3 >= 0 + northPixelsToCrop; _y3--) { - var _colorXY3 = this.getPixelColor(_x3, _y3); - - var _rgba3 = this.constructor.intToRGBA(_colorXY3); - - if (this.constructor.colorDiff(rgba1, _rgba3) > tolerance) { + if (!ignoreSides.east) { + east: for (let x = w - 1; x >= 0 + westPixelsToCrop + minPixelsPerSide; x--) { + for (let y = h - 1; y >= 0 + northPixelsToCrop; y--) { + const colorXY = this.getPixelColor(x, y); + const rgba2 = this.constructor.intToRGBA(colorXY); + if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) { // this pixel is too distant from the first one: abort this side scan - break west; + break east; } - } // this column contains all pixels with the same color: increment this side pixels to crop - + } - westPixelsToCrop++; + // this column contains all pixels with the same color: increment this side pixels to crop + eastPixelsToCrop++; } - } // decide if a crop is needed - + } - var doCrop = false; // apply leaveBorder + // decide if a crop is needed + let doCrop = false; + // apply leaveBorder westPixelsToCrop -= leaveBorder; eastPixelsToCrop -= leaveBorder; northPixelsToCrop -= leaveBorder; southPixelsToCrop -= leaveBorder; - if (cropSymmetric) { - var horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop); - var vertical = Math.min(northPixelsToCrop, southPixelsToCrop); + const horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop); + const vertical = Math.min(northPixelsToCrop, southPixelsToCrop); westPixelsToCrop = horizontal; eastPixelsToCrop = horizontal; northPixelsToCrop = vertical; southPixelsToCrop = vertical; - } // make sure that crops are >= 0 - + } + // make sure that crops are >= 0 westPixelsToCrop = westPixelsToCrop >= 0 ? westPixelsToCrop : 0; eastPixelsToCrop = eastPixelsToCrop >= 0 ? eastPixelsToCrop : 0; northPixelsToCrop = northPixelsToCrop >= 0 ? northPixelsToCrop : 0; - southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0; // safety checks - - var widthOfRemainingPixels = w - (westPixelsToCrop + eastPixelsToCrop); - var heightOfRemainingPixels = h - (southPixelsToCrop + northPixelsToCrop); + southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0; + // safety checks + const widthOfRemainingPixels = w - (westPixelsToCrop + eastPixelsToCrop); + const heightOfRemainingPixels = h - (southPixelsToCrop + northPixelsToCrop); if (cropOnlyFrames) { // crop image if all sides should be cropped doCrop = eastPixelsToCrop !== 0 && northPixelsToCrop !== 0 && westPixelsToCrop !== 0 && southPixelsToCrop !== 0; @@ -267,21 +246,18 @@ function pluginCrop(event) { // crop image if at least one side should be cropped doCrop = eastPixelsToCrop !== 0 || northPixelsToCrop !== 0 || westPixelsToCrop !== 0 || southPixelsToCrop !== 0; } - if (doCrop) { // do the real crop - this.crop(eastPixelsToCrop, northPixelsToCrop, widthOfRemainingPixels, heightOfRemainingPixels); + this.crop(westPixelsToCrop, northPixelsToCrop, widthOfRemainingPixels, heightOfRemainingPixels); } - if ((0, _utils.isNodePattern)(cb)) { cb.call(this, null, this); } - return this; } } }; } - module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-crop/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-crop/dist/index.js.map index 0a3441ca..2c319a35 100644 --- a/project starter code/node_modules/@jimp/plugin-crop/dist/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-crop/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["pluginCrop","event","x","y","w","h","cb","throwError","call","Math","round","bitmap","width","start","end","data","slice","Buffer","allocUnsafe","offset","scanQuiet","idx","readUInt32BE","writeUInt32BE","height","autocrop","minPixelsPerSide","leaveBorder","tolerance","cropOnlyFrames","cropSymmetric","ignoreSides","north","south","east","west","args","a","len","length","config","colorTarget","getPixelColor","rgba1","constructor","intToRGBA","northPixelsToCrop","eastPixelsToCrop","southPixelsToCrop","westPixelsToCrop","colorXY","rgba2","colorDiff","doCrop","horizontal","min","vertical","widthOfRemaining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L,CACEZ,gBADF,EAEED,iBAFF,EAGEW,sBAHF,EAIEC,uBAJF;AAMD;;AAED,YAAI,0BAAcpD,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAzOI;AADF,GAAP;AA6OD","sourcesContent":["/* eslint-disable no-labels */\n\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nexport default function pluginCrop(event) {\n /**\n * Crops the image at a given point to a give size\n * @param {number} x the x coordinate to crop form\n * @param {number} y the y coordinate to crop form\n * @param w the width of the crop region\n * @param h the height of the crop region\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n event('crop', function(x, y, w, h, cb) {\n if (typeof x !== 'number' || typeof y !== 'number')\n return throwError.call(this, 'x and y must be numbers', cb);\n if (typeof w !== 'number' || typeof h !== 'number')\n return throwError.call(this, 'w and h must be numbers', cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n if (x === 0 && w === this.bitmap.width) {\n // shortcut\n const start = (w * y + x) << 2;\n const end = (start + h * w) << 2;\n\n this.bitmap.data = this.bitmap.data.slice(start, end);\n } else {\n const bitmap = Buffer.allocUnsafe(w * h * 4);\n let offset = 0;\n\n this.scanQuiet(x, y, w, h, function(x, y, idx) {\n const data = this.bitmap.data.readUInt32BE(idx, true);\n bitmap.writeUInt32BE(data, offset, true);\n offset += 4;\n });\n\n this.bitmap.data = bitmap;\n }\n\n this.bitmap.width = w;\n this.bitmap.height = h;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n });\n\n return {\n class: {\n /**\n * Autocrop same color borders from this image\n * @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%)\n * @param {boolean} cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true)\n * @param {function(Error, Jimp)} cb (optional): a callback for when complete (default: no callback)\n * @returns {Jimp} this for chaining of methods\n */\n autocrop(...args) {\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image\n\n let cb; // callback\n let leaveBorder = 0; // Amount of pixels in border to leave\n let tolerance = 0.0002; // percent of color difference tolerance (default value)\n let cropOnlyFrames = true; // flag to force cropping only if the image has a real \"frame\"\n // i.e. all 4 sides have some border (default value)\n let cropSymmetric = false; // flag to force cropping top be symmetric.\n // i.e. north and south / east and west are cropped by the same value\n let ignoreSides = {\n north: false,\n south: false,\n east: false,\n west: false\n };\n\n // parse arguments\n for (let a = 0, len = args.length; a < len; a++) {\n if (typeof args[a] === 'number') {\n // tolerance value passed\n tolerance = args[a];\n }\n\n if (typeof args[a] === 'boolean') {\n // cropOnlyFrames value passed\n cropOnlyFrames = args[a];\n }\n\n if (typeof args[a] === 'function') {\n // callback value passed\n cb = args[a];\n }\n\n if (typeof args[a] === 'object') {\n // config object passed\n const config = args[a];\n\n if (typeof config.tolerance !== 'undefined') {\n ({ tolerance } = config);\n }\n\n if (typeof config.cropOnlyFrames !== 'undefined') {\n ({ cropOnlyFrames } = config);\n }\n\n if (typeof config.cropSymmetric !== 'undefined') {\n ({ cropSymmetric } = config);\n }\n\n if (typeof config.leaveBorder !== 'undefined') {\n ({ leaveBorder } = config);\n }\n\n if (typeof config.ignoreSides !== 'undefined') {\n ({ ignoreSides } = config);\n }\n }\n }\n\n /**\n * All borders must be of the same color as the top left pixel, to be cropped.\n * It should be possible to crop borders each with a different color,\n * but since there are many ways for corners to intersect, it would\n * introduce unnecessary complexity to the algorithm.\n */\n\n // scan each side for same color borders\n let colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color\n const rgba1 = this.constructor.intToRGBA(colorTarget);\n\n // for north and east sides\n let northPixelsToCrop = 0;\n let eastPixelsToCrop = 0;\n let southPixelsToCrop = 0;\n let westPixelsToCrop = 0;\n\n // north side (scan rows from north to south)\n colorTarget = this.getPixelColor(0, 0);\n if (!ignoreSides.north) {\n north: for (let y = 0; y < h - minPixelsPerSide; y++) {\n for (let x = 0; x < w; x++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break north;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n northPixelsToCrop++;\n }\n }\n\n // east side (scan columns from east to west)\n colorTarget = this.getPixelColor(w, 0);\n if (!ignoreSides.east) {\n east: for (let x = 0; x < w - minPixelsPerSide; x++) {\n for (let y = 0 + northPixelsToCrop; y < h; y++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break east;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n eastPixelsToCrop++;\n }\n }\n\n // south side (scan rows from south to north)\n colorTarget = this.getPixelColor(0, h);\n\n if (!ignoreSides.south) {\n south: for (\n let y = h - 1;\n y >= northPixelsToCrop + minPixelsPerSide;\n y--\n ) {\n for (let x = w - eastPixelsToCrop - 1; x >= 0; x--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break south;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n southPixelsToCrop++;\n }\n }\n\n // west side (scan columns from west to east)\n colorTarget = this.getPixelColor(w, h);\n if (!ignoreSides.west) {\n west: for (\n let x = w - 1;\n x >= 0 + eastPixelsToCrop + minPixelsPerSide;\n x--\n ) {\n for (let y = h - 1; y >= 0 + northPixelsToCrop; y--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break west;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n westPixelsToCrop++;\n }\n }\n\n // decide if a crop is needed\n let doCrop = false;\n\n // apply leaveBorder\n westPixelsToCrop -= leaveBorder;\n eastPixelsToCrop -= leaveBorder;\n northPixelsToCrop -= leaveBorder;\n southPixelsToCrop -= leaveBorder;\n\n if (cropSymmetric) {\n const horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop);\n const vertical = Math.min(northPixelsToCrop, southPixelsToCrop);\n westPixelsToCrop = horizontal;\n eastPixelsToCrop = horizontal;\n northPixelsToCrop = vertical;\n southPixelsToCrop = vertical;\n }\n\n // make sure that crops are >= 0\n westPixelsToCrop = westPixelsToCrop >= 0 ? westPixelsToCrop : 0;\n eastPixelsToCrop = eastPixelsToCrop >= 0 ? eastPixelsToCrop : 0;\n northPixelsToCrop = northPixelsToCrop >= 0 ? northPixelsToCrop : 0;\n southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0;\n\n // safety checks\n const widthOfRemainingPixels =\n w - (westPixelsToCrop + eastPixelsToCrop);\n const heightOfRemainingPixels =\n h - (southPixelsToCrop + northPixelsToCrop);\n\n if (cropOnlyFrames) {\n // crop image if all sides should be cropped\n doCrop =\n eastPixelsToCrop !== 0 &&\n northPixelsToCrop !== 0 &&\n westPixelsToCrop !== 0 &&\n southPixelsToCrop !== 0;\n } else {\n // crop image if at least one side should be cropped\n doCrop =\n eastPixelsToCrop !== 0 ||\n northPixelsToCrop !== 0 ||\n westPixelsToCrop !== 0 ||\n southPixelsToCrop !== 0;\n }\n\n if (doCrop) {\n // do the real crop\n this.crop(\n eastPixelsToCrop,\n northPixelsToCrop,\n widthOfRemainingPixels,\n heightOfRemainingPixels\n );\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n };\n}\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["pluginCrop","event","x","y","w","h","cb","throwError","call","Math","round","bitmap","width","start","end","data","slice","Buffer","allocUnsafe","offset","scanQuiet","idx","readUInt32BE","writeUInt32BE","height","isNodePattern","class","autocrop","minPixelsPerSide","leaveBorder","tolerance","cropOnlyFrames","cropSymmetric","ignoreSides","north","south","east","west","args","a","len","length","config","colorTarget","getPixelColor","rgba1","constructor","intToRGBA","northPixelsToCrop","eastPixelsToCrop","southPixelsToCrop","westPixelsToCrop","colorXY","rgba2","colorDiff","doCrop","horizontal","min","vertical","widthOfRemainingPixels","heightOfRemainingPixels","crop"],"sources":["../src/index.js"],"sourcesContent":["/* eslint-disable no-labels */\n\nimport { throwError, isNodePattern } from \"@jimp/utils\";\n\nexport default function pluginCrop(event) {\n /**\n * Crops the image at a given point to a give size\n * @param {number} x the x coordinate to crop form\n * @param {number} y the y coordinate to crop form\n * @param w the width of the crop region\n * @param h the height of the crop region\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n event(\"crop\", function (x, y, w, h, cb) {\n if (typeof x !== \"number\" || typeof y !== \"number\")\n return throwError.call(this, \"x and y must be numbers\", cb);\n if (typeof w !== \"number\" || typeof h !== \"number\")\n return throwError.call(this, \"w and h must be numbers\", cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n if (x === 0 && w === this.bitmap.width) {\n // shortcut\n const start = (w * y + x) << 2;\n const end = start + ((h * w) << 2);\n\n this.bitmap.data = this.bitmap.data.slice(start, end);\n } else {\n const bitmap = Buffer.allocUnsafe(w * h * 4);\n let offset = 0;\n\n this.scanQuiet(x, y, w, h, function (x, y, idx) {\n const data = this.bitmap.data.readUInt32BE(idx, true);\n bitmap.writeUInt32BE(data, offset, true);\n offset += 4;\n });\n\n this.bitmap.data = bitmap;\n }\n\n this.bitmap.width = w;\n this.bitmap.height = h;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n });\n\n return {\n class: {\n /**\n * Autocrop same color borders from this image\n * @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%)\n * @param {boolean} cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true)\n * @param {function(Error, Jimp)} cb (optional): a callback for when complete (default: no callback)\n * @returns {Jimp} this for chaining of methods\n */\n autocrop(...args) {\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image\n\n let cb; // callback\n let leaveBorder = 0; // Amount of pixels in border to leave\n let tolerance = 0.0002; // percent of color difference tolerance (default value)\n let cropOnlyFrames = true; // flag to force cropping only if the image has a real \"frame\"\n // i.e. all 4 sides have some border (default value)\n let cropSymmetric = false; // flag to force cropping top be symmetric.\n // i.e. north and south / east and west are cropped by the same value\n let ignoreSides = {\n north: false,\n south: false,\n east: false,\n west: false,\n };\n\n // parse arguments\n for (let a = 0, len = args.length; a < len; a++) {\n if (typeof args[a] === \"number\") {\n // tolerance value passed\n tolerance = args[a];\n }\n\n if (typeof args[a] === \"boolean\") {\n // cropOnlyFrames value passed\n cropOnlyFrames = args[a];\n }\n\n if (typeof args[a] === \"function\") {\n // callback value passed\n cb = args[a];\n }\n\n if (typeof args[a] === \"object\") {\n // config object passed\n const config = args[a];\n\n if (typeof config.tolerance !== \"undefined\") {\n ({ tolerance } = config);\n }\n\n if (typeof config.cropOnlyFrames !== \"undefined\") {\n ({ cropOnlyFrames } = config);\n }\n\n if (typeof config.cropSymmetric !== \"undefined\") {\n ({ cropSymmetric } = config);\n }\n\n if (typeof config.leaveBorder !== \"undefined\") {\n ({ leaveBorder } = config);\n }\n\n if (typeof config.ignoreSides !== \"undefined\") {\n ({ ignoreSides } = config);\n }\n }\n }\n\n /**\n * All borders must be of the same color as the top left pixel, to be cropped.\n * It should be possible to crop borders each with a different color,\n * but since there are many ways for corners to intersect, it would\n * introduce unnecessary complexity to the algorithm.\n */\n\n // scan each side for same color borders\n let colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color\n const rgba1 = this.constructor.intToRGBA(colorTarget);\n\n // for north and east sides\n let northPixelsToCrop = 0;\n let eastPixelsToCrop = 0;\n let southPixelsToCrop = 0;\n let westPixelsToCrop = 0;\n\n // north side (scan rows from north to south)\n colorTarget = this.getPixelColor(0, 0);\n if (!ignoreSides.north) {\n north: for (let y = 0; y < h - minPixelsPerSide; y++) {\n for (let x = 0; x < w; x++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break north;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n northPixelsToCrop++;\n }\n }\n\n // west side (scan columns from west to east)\n colorTarget = this.getPixelColor(w, 0);\n if (!ignoreSides.west) {\n west: for (let x = 0; x < w - minPixelsPerSide; x++) {\n for (let y = 0 + northPixelsToCrop; y < h; y++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break west;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n westPixelsToCrop++;\n }\n }\n\n // south side (scan rows from south to north)\n colorTarget = this.getPixelColor(0, h);\n\n if (!ignoreSides.south) {\n south: for (\n let y = h - 1;\n y >= northPixelsToCrop + minPixelsPerSide;\n y--\n ) {\n for (let x = w - eastPixelsToCrop - 1; x >= 0; x--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break south;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n southPixelsToCrop++;\n }\n }\n\n // east side (scan columns from east to west)\n colorTarget = this.getPixelColor(w, h);\n if (!ignoreSides.east) {\n east: for (\n let x = w - 1;\n x >= 0 + westPixelsToCrop + minPixelsPerSide;\n x--\n ) {\n for (let y = h - 1; y >= 0 + northPixelsToCrop; y--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break east;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n eastPixelsToCrop++;\n }\n }\n\n // decide if a crop is needed\n let doCrop = false;\n\n // apply leaveBorder\n westPixelsToCrop -= leaveBorder;\n eastPixelsToCrop -= leaveBorder;\n northPixelsToCrop -= leaveBorder;\n southPixelsToCrop -= leaveBorder;\n\n if (cropSymmetric) {\n const horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop);\n const vertical = Math.min(northPixelsToCrop, southPixelsToCrop);\n westPixelsToCrop = horizontal;\n eastPixelsToCrop = horizontal;\n northPixelsToCrop = vertical;\n southPixelsToCrop = vertical;\n }\n\n // make sure that crops are >= 0\n westPixelsToCrop = westPixelsToCrop >= 0 ? westPixelsToCrop : 0;\n eastPixelsToCrop = eastPixelsToCrop >= 0 ? eastPixelsToCrop : 0;\n northPixelsToCrop = northPixelsToCrop >= 0 ? northPixelsToCrop : 0;\n southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0;\n\n // safety checks\n const widthOfRemainingPixels =\n w - (westPixelsToCrop + eastPixelsToCrop);\n const heightOfRemainingPixels =\n h - (southPixelsToCrop + northPixelsToCrop);\n\n if (cropOnlyFrames) {\n // crop image if all sides should be cropped\n doCrop =\n eastPixelsToCrop !== 0 &&\n northPixelsToCrop !== 0 &&\n westPixelsToCrop !== 0 &&\n southPixelsToCrop !== 0;\n } else {\n // crop image if at least one side should be cropped\n doCrop =\n eastPixelsToCrop !== 0 ||\n northPixelsToCrop !== 0 ||\n westPixelsToCrop !== 0 ||\n southPixelsToCrop !== 0;\n }\n\n if (doCrop) {\n // do the real crop\n this.crop(\n westPixelsToCrop,\n northPixelsToCrop,\n widthOfRemainingPixels,\n heightOfRemainingPixels\n );\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n },\n };\n}\n"],"mappings":";;;;;;AAEA;AAFA;;AAIe,SAASA,UAAU,CAACC,KAAK,EAAE;EACxC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEA,KAAK,CAAC,MAAM,EAAE,UAAUC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,EAAE,EAAE;IACtC,IAAI,OAAOJ,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAChD,OAAOI,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAEF,EAAE,CAAC;IAC7D,IAAI,OAAOF,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAChD,OAAOE,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAEF,EAAE,CAAC;;IAE7D;IACAJ,CAAC,GAAGO,IAAI,CAACC,KAAK,CAACR,CAAC,CAAC;IACjBC,CAAC,GAAGM,IAAI,CAACC,KAAK,CAACP,CAAC,CAAC;IACjBC,CAAC,GAAGK,IAAI,CAACC,KAAK,CAACN,CAAC,CAAC;IACjBC,CAAC,GAAGI,IAAI,CAACC,KAAK,CAACL,CAAC,CAAC;IAEjB,IAAIH,CAAC,KAAK,CAAC,IAAIE,CAAC,KAAK,IAAI,CAACO,MAAM,CAACC,KAAK,EAAE;MACtC;MACA,MAAMC,KAAK,GAAIT,CAAC,GAAGD,CAAC,GAAGD,CAAC,IAAK,CAAC;MAC9B,MAAMY,GAAG,GAAGD,KAAK,IAAKR,CAAC,GAAGD,CAAC,IAAK,CAAC,CAAC;MAElC,IAAI,CAACO,MAAM,CAACI,IAAI,GAAG,IAAI,CAACJ,MA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AC7BR,iBAAiB,GAAGU,QAAQ;UAC5BR,iBAAiB,GAAGQ,QAAQ;QAC9B;;QAEA;QACAP,gBAAgB,GAAGA,gBAAgB,IAAI,CAAC,GAAGA,gBAAgB,GAAG,CAAC;QAC/DF,gBAAgB,GAAGA,gBAAgB,IAAI,CAAC,GAAGA,gBAAgB,GAAG,CAAC;QAC/DD,iBAAiB,GAAGA,iBAAiB,IAAI,CAAC,GAAGA,iBAAiB,GAAG,CAAC;QAClEE,iBAAiB,GAAGA,iBAAiB,IAAI,CAAC,GAAGA,iBAAiB,GAAG,CAAC;;QAElE;QACA,MAAMS,sBAAsB,GAC1BvD,CAAC,IAAI+C,gBAAgB,GAAGF,gBAAgB,CAAC;QAC3C,MAAMW,uBAAuB,GAC3BvD,CAAC,IAAI6C,iBAAiB,GAAGF,iBAAiB,CAAC;QAE7C,IAAIjB,cAAc,EAAE;UAClB;UACAwB,MAAM,GACJN,gBAAgB,KAAK,CAAC,IACtBD,iBAAiB,KAAK,CAAC,IACvBG,gBAAgB,KAAK,CAAC,IACtBD,iBAAiB,KAAK,CAAC;QAC3B,CAAC,MAAM;UACL;UACAK,MAAM,GACJN,gBAAgB,KAAK,CAAC,IACtBD,iBAAiB,KAAK,CAAC,IACvBG,gBAAgB,KAAK,CAAC,IACtBD,iBAAiB,KAAK,CAAC;QAC3B;QAEA,IAAIK,MAAM,EAAE;UACV;UACA,IAAI,CAACM,IAAI,CACPV,gBAAgB,EAChBH,iBAAiB,EACjBW,sBAAsB,EACtBC,uBAAuB,CACxB;QACH;QAEA,IAAI,IAAAnC,oBAAa,EAACnB,EAAE,CAAC,EAAE;UACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;QAC3B;QAEA,OAAO,IAAI;MACb;IACF;EACF,CAAC;AACH;AAAC;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-crop/es/index.js b/project starter code/node_modules/@jimp/plugin-crop/es/index.js index f8e38329..d4d040fd 100644 --- a/project starter code/node_modules/@jimp/plugin-crop/es/index.js +++ b/project starter code/node_modules/@jimp/plugin-crop/es/index.js @@ -1,18 +1,7 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = pluginCrop; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _utils = require("@jimp/utils"); - /* eslint-disable no-labels */ -function pluginCrop(event) { + +import { throwError, isNodePattern } from "@jimp/utils"; +export default function pluginCrop(event) { /** * Crops the image at a given point to a give size * @param {number} x the x coordinate to crop form @@ -22,42 +11,39 @@ function pluginCrop(event) { * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ - event('crop', function (x, y, w, h, cb) { - if (typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'x and y must be numbers', cb); - if (typeof w !== 'number' || typeof h !== 'number') return _utils.throwError.call(this, 'w and h must be numbers', cb); // round input + event("crop", function (x, y, w, h, cb) { + if (typeof x !== "number" || typeof y !== "number") return throwError.call(this, "x and y must be numbers", cb); + if (typeof w !== "number" || typeof h !== "number") return throwError.call(this, "w and h must be numbers", cb); + // round input x = Math.round(x); y = Math.round(y); w = Math.round(w); h = Math.round(h); - if (x === 0 && w === this.bitmap.width) { // shortcut - var start = w * y + x << 2; - var end = start + h * w << 2; + const start = w * y + x << 2; + const end = start + (h * w << 2); this.bitmap.data = this.bitmap.data.slice(start, end); } else { - var bitmap = Buffer.allocUnsafe(w * h * 4); - var offset = 0; + const bitmap = Buffer.allocUnsafe(w * h * 4); + let offset = 0; this.scanQuiet(x, y, w, h, function (x, y, idx) { - var data = this.bitmap.data.readUInt32BE(idx, true); + const data = this.bitmap.data.readUInt32BE(idx, true); bitmap.writeUInt32BE(data, offset, true); offset += 4; }); this.bitmap.data = bitmap; } - this.bitmap.width = w; this.bitmap.height = h; - - if ((0, _utils.isNodePattern)(cb)) { + if (isNodePattern(cb)) { cb.call(this, null, this); } - return this; }); return { - "class": { + class: { /** * Autocrop same color borders from this image * @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%) @@ -65,201 +51,188 @@ function pluginCrop(event) { * @param {function(Error, Jimp)} cb (optional): a callback for when complete (default: no callback) * @returns {Jimp} this for chaining of methods */ - autocrop: function autocrop() { - var w = this.bitmap.width; - var h = this.bitmap.height; - var minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image - - var cb; // callback - - var leaveBorder = 0; // Amount of pixels in border to leave - - var tolerance = 0.0002; // percent of color difference tolerance (default value) - - var cropOnlyFrames = true; // flag to force cropping only if the image has a real "frame" + autocrop() { + const w = this.bitmap.width; + const h = this.bitmap.height; + const minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image + + let cb; // callback + let leaveBorder = 0; // Amount of pixels in border to leave + let tolerance = 0.0002; // percent of color difference tolerance (default value) + let cropOnlyFrames = true; // flag to force cropping only if the image has a real "frame" // i.e. all 4 sides have some border (default value) - - var cropSymmetric = false; // flag to force cropping top be symmetric. + let cropSymmetric = false; // flag to force cropping top be symmetric. // i.e. north and south / east and west are cropped by the same value - - var ignoreSides = { + let ignoreSides = { north: false, south: false, east: false, west: false - }; // parse arguments + }; + // parse arguments for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } - - for (var a = 0, len = args.length; a < len; a++) { - if (typeof args[a] === 'number') { + for (let a = 0, len = args.length; a < len; a++) { + if (typeof args[a] === "number") { // tolerance value passed tolerance = args[a]; } - - if (typeof args[a] === 'boolean') { + if (typeof args[a] === "boolean") { // cropOnlyFrames value passed cropOnlyFrames = args[a]; } - - if (typeof args[a] === 'function') { + if (typeof args[a] === "function") { // callback value passed cb = args[a]; } - - if ((0, _typeof2["default"])(args[a]) === 'object') { + if (typeof args[a] === "object") { // config object passed - var config = args[a]; - - if (typeof config.tolerance !== 'undefined') { - tolerance = config.tolerance; + const config = args[a]; + if (typeof config.tolerance !== "undefined") { + ({ + tolerance + } = config); } - - if (typeof config.cropOnlyFrames !== 'undefined') { - cropOnlyFrames = config.cropOnlyFrames; + if (typeof config.cropOnlyFrames !== "undefined") { + ({ + cropOnlyFrames + } = config); } - - if (typeof config.cropSymmetric !== 'undefined') { - cropSymmetric = config.cropSymmetric; + if (typeof config.cropSymmetric !== "undefined") { + ({ + cropSymmetric + } = config); } - - if (typeof config.leaveBorder !== 'undefined') { - leaveBorder = config.leaveBorder; + if (typeof config.leaveBorder !== "undefined") { + ({ + leaveBorder + } = config); } - - if (typeof config.ignoreSides !== 'undefined') { - ignoreSides = config.ignoreSides; + if (typeof config.ignoreSides !== "undefined") { + ({ + ignoreSides + } = config); } } } + /** * All borders must be of the same color as the top left pixel, to be cropped. * It should be possible to crop borders each with a different color, * but since there are many ways for corners to intersect, it would * introduce unnecessary complexity to the algorithm. */ - // scan each side for same color borders - - var colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color - - var rgba1 = this.constructor.intToRGBA(colorTarget); // for north and east sides + // scan each side for same color borders + let colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color + const rgba1 = this.constructor.intToRGBA(colorTarget); - var northPixelsToCrop = 0; - var eastPixelsToCrop = 0; - var southPixelsToCrop = 0; - var westPixelsToCrop = 0; // north side (scan rows from north to south) + // for north and east sides + let northPixelsToCrop = 0; + let eastPixelsToCrop = 0; + let southPixelsToCrop = 0; + let westPixelsToCrop = 0; + // north side (scan rows from north to south) colorTarget = this.getPixelColor(0, 0); - if (!ignoreSides.north) { - north: for (var y = 0; y < h - minPixelsPerSide; y++) { - for (var x = 0; x < w; x++) { - var colorXY = this.getPixelColor(x, y); - var rgba2 = this.constructor.intToRGBA(colorXY); - + north: for (let y = 0; y < h - minPixelsPerSide; y++) { + for (let x = 0; x < w; x++) { + const colorXY = this.getPixelColor(x, y); + const rgba2 = this.constructor.intToRGBA(colorXY); if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) { // this pixel is too distant from the first one: abort this side scan break north; } - } // this row contains all pixels with the same color: increment this side pixels to crop - + } + // this row contains all pixels with the same color: increment this side pixels to crop northPixelsToCrop++; } - } // east side (scan columns from east to west) - + } + // west side (scan columns from west to east) colorTarget = this.getPixelColor(w, 0); - - if (!ignoreSides.east) { - east: for (var _x = 0; _x < w - minPixelsPerSide; _x++) { - for (var _y = 0 + northPixelsToCrop; _y < h; _y++) { - var _colorXY = this.getPixelColor(_x, _y); - - var _rgba = this.constructor.intToRGBA(_colorXY); - - if (this.constructor.colorDiff(rgba1, _rgba) > tolerance) { + if (!ignoreSides.west) { + west: for (let x = 0; x < w - minPixelsPerSide; x++) { + for (let y = 0 + northPixelsToCrop; y < h; y++) { + const colorXY = this.getPixelColor(x, y); + const rgba2 = this.constructor.intToRGBA(colorXY); + if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) { // this pixel is too distant from the first one: abort this side scan - break east; + break west; } - } // this column contains all pixels with the same color: increment this side pixels to crop - + } - eastPixelsToCrop++; + // this column contains all pixels with the same color: increment this side pixels to crop + westPixelsToCrop++; } - } // south side (scan rows from south to north) - + } + // south side (scan rows from south to north) colorTarget = this.getPixelColor(0, h); - if (!ignoreSides.south) { - south: for (var _y2 = h - 1; _y2 >= northPixelsToCrop + minPixelsPerSide; _y2--) { - for (var _x2 = w - eastPixelsToCrop - 1; _x2 >= 0; _x2--) { - var _colorXY2 = this.getPixelColor(_x2, _y2); - - var _rgba2 = this.constructor.intToRGBA(_colorXY2); - - if (this.constructor.colorDiff(rgba1, _rgba2) > tolerance) { + south: for (let y = h - 1; y >= northPixelsToCrop + minPixelsPerSide; y--) { + for (let x = w - eastPixelsToCrop - 1; x >= 0; x--) { + const colorXY = this.getPixelColor(x, y); + const rgba2 = this.constructor.intToRGBA(colorXY); + if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) { // this pixel is too distant from the first one: abort this side scan break south; } - } // this row contains all pixels with the same color: increment this side pixels to crop - + } + // this row contains all pixels with the same color: increment this side pixels to crop southPixelsToCrop++; } - } // west side (scan columns from west to east) - + } + // east side (scan columns from east to west) colorTarget = this.getPixelColor(w, h); - - if (!ignoreSides.west) { - west: for (var _x3 = w - 1; _x3 >= 0 + eastPixelsToCrop + minPixelsPerSide; _x3--) { - for (var _y3 = h - 1; _y3 >= 0 + northPixelsToCrop; _y3--) { - var _colorXY3 = this.getPixelColor(_x3, _y3); - - var _rgba3 = this.constructor.intToRGBA(_colorXY3); - - if (this.constructor.colorDiff(rgba1, _rgba3) > tolerance) { + if (!ignoreSides.east) { + east: for (let x = w - 1; x >= 0 + westPixelsToCrop + minPixelsPerSide; x--) { + for (let y = h - 1; y >= 0 + northPixelsToCrop; y--) { + const colorXY = this.getPixelColor(x, y); + const rgba2 = this.constructor.intToRGBA(colorXY); + if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) { // this pixel is too distant from the first one: abort this side scan - break west; + break east; } - } // this column contains all pixels with the same color: increment this side pixels to crop - + } - westPixelsToCrop++; + // this column contains all pixels with the same color: increment this side pixels to crop + eastPixelsToCrop++; } - } // decide if a crop is needed - + } - var doCrop = false; // apply leaveBorder + // decide if a crop is needed + let doCrop = false; + // apply leaveBorder westPixelsToCrop -= leaveBorder; eastPixelsToCrop -= leaveBorder; northPixelsToCrop -= leaveBorder; southPixelsToCrop -= leaveBorder; - if (cropSymmetric) { - var horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop); - var vertical = Math.min(northPixelsToCrop, southPixelsToCrop); + const horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop); + const vertical = Math.min(northPixelsToCrop, southPixelsToCrop); westPixelsToCrop = horizontal; eastPixelsToCrop = horizontal; northPixelsToCrop = vertical; southPixelsToCrop = vertical; - } // make sure that crops are >= 0 - + } + // make sure that crops are >= 0 westPixelsToCrop = westPixelsToCrop >= 0 ? westPixelsToCrop : 0; eastPixelsToCrop = eastPixelsToCrop >= 0 ? eastPixelsToCrop : 0; northPixelsToCrop = northPixelsToCrop >= 0 ? northPixelsToCrop : 0; - southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0; // safety checks - - var widthOfRemainingPixels = w - (westPixelsToCrop + eastPixelsToCrop); - var heightOfRemainingPixels = h - (southPixelsToCrop + northPixelsToCrop); + southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0; + // safety checks + const widthOfRemainingPixels = w - (westPixelsToCrop + eastPixelsToCrop); + const heightOfRemainingPixels = h - (southPixelsToCrop + northPixelsToCrop); if (cropOnlyFrames) { // crop image if all sides should be cropped doCrop = eastPixelsToCrop !== 0 && northPixelsToCrop !== 0 && westPixelsToCrop !== 0 && southPixelsToCrop !== 0; @@ -267,16 +240,13 @@ function pluginCrop(event) { // crop image if at least one side should be cropped doCrop = eastPixelsToCrop !== 0 || northPixelsToCrop !== 0 || westPixelsToCrop !== 0 || southPixelsToCrop !== 0; } - if (doCrop) { // do the real crop - this.crop(eastPixelsToCrop, northPixelsToCrop, widthOfRemainingPixels, heightOfRemainingPixels); + this.crop(westPixelsToCrop, northPixelsToCrop, widthOfRemainingPixels, heightOfRemainingPixels); } - - if ((0, _utils.isNodePattern)(cb)) { + if (isNodePattern(cb)) { cb.call(this, null, this); } - return this; } } diff --git a/project starter code/node_modules/@jimp/plugin-crop/es/index.js.map b/project starter code/node_modules/@jimp/plugin-crop/es/index.js.map index 0a3441ca..6f8e4e20 100644 --- a/project starter code/node_modules/@jimp/plugin-crop/es/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-crop/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["pluginCrop","event","x","y","w","h","cb","throwError","call","Math","round","bitmap","width","start","end","data","slice","Buffer","allocUnsafe","offset","scanQuiet","idx","readUInt32BE","writeUInt32BE","height","autocrop","minPixelsPerSide","leaveBorder","tolerance","cropOnlyFrames","cropSymmetric","ignoreSides","north","south","east","west","args","a","len","length","config","colorTarget","getPixelColor","rgba1","constructor","intToRGBA","northPixelsToCrop","eastPixelsToCrop","southPixelsToCrop","westPixelsToCrop","colorXY","rgba2","colorDiff","doCrop","horizontal","min","vertical","widthOfRemainingPixels","heightOfRemainingPixels","crop"],"mappings":";;;;;;;;;;;AAEA;;AAFA;AAIe,SAASA,UAAT,CAAoBC,KAApB,EAA2B;AACxC;;;;;;;;;AASAA,EAAAA,KAAK,CAAC,MAAD,EAAS,UAASC,CAAT,EAAYC,CAAZ,EAAeC,CAAf,EAAkBC,CAAlB,EAAqBC,EAArB,EAAyB;AACrC,QAAI,OAAOJ,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EACE,OAAOI,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP;AACF,QAAI,OAAOF,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EACE,OAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP,CAJmC,CAMrC;;AACAJ,IAAAA,CAAC,GAAGO,IAAI,CAACC,KAAL,CAAWR,CAAX,CAAJ;AACAC,IAAAA,CAAC,GAAGM,IAAI,CAACC,KAAL,CAAWP,CAAX,CAAJ;AACAC,IAAAA,CAAC,GAAGK,IAAI,CAACC,KAAL,CAAWN,CAAX,CAAJ;AACAC,IAAAA,CAAC,GAAGI,IAAI,CAACC,KAAL,CAAWL,CAAX,CAAJ;;AAEA,QAAIH,CAAC,KAAK,CAAN,IAAWE,CAAC,KAAK,KAAKO,MAAL,CAAYC,KAAjC,EAAwC;AACtC;AACA,UAAMC,KAAK,GAAIT,CAAC,GAAGD,CAAJ,GAAQD,CAAT,IAAe,CAA7B;AACA,UAAMY,GAAG,GAAID,KAAK,GAAGR,CAAC,GAAGD,CAAb,IAAmB,CAA/B;AAEA,WAAKO,MAAL,CAAYI,IAAZ,GAAmB,KAAKJ,MAAL,CAAYI,IAAZ,CAAiBC,KAAjB,CAAuBH,KAAvB,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AAK,CAFrB,IAGAD,iBAAiB,KAAK,CAJxB;AAKD;;AAED,YAAIK,MAAJ,EAAY;AACV;AACA,eAAKM,IAAL,CACEZ,gBADF,EAEED,iBAFF,EAGEW,sBAHF,EAIEC,uBAJF;AAMD;;AAED,YAAI,0BAAcpD,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAzOI;AADF,GAAP;AA6OD","sourcesContent":["/* eslint-disable no-labels */\n\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nexport default function pluginCrop(event) {\n /**\n * Crops the image at a given point to a give size\n * @param {number} x the x coordinate to crop form\n * @param {number} y the y coordinate to crop form\n * @param w the width of the crop region\n * @param h the height of the crop region\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n event('crop', function(x, y, w, h, cb) {\n if (typeof x !== 'number' || typeof y !== 'number')\n return throwError.call(this, 'x and y must be numbers', cb);\n if (typeof w !== 'number' || typeof h !== 'number')\n return throwError.call(this, 'w and h must be numbers', cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n if (x === 0 && w === this.bitmap.width) {\n // shortcut\n const start = (w * y + x) << 2;\n const end = (start + h * w) << 2;\n\n this.bitmap.data = this.bitmap.data.slice(start, end);\n } else {\n const bitmap = Buffer.allocUnsafe(w * h * 4);\n let offset = 0;\n\n this.scanQuiet(x, y, w, h, function(x, y, idx) {\n const data = this.bitmap.data.readUInt32BE(idx, true);\n bitmap.writeUInt32BE(data, offset, true);\n offset += 4;\n });\n\n this.bitmap.data = bitmap;\n }\n\n this.bitmap.width = w;\n this.bitmap.height = h;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n });\n\n return {\n class: {\n /**\n * Autocrop same color borders from this image\n * @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%)\n * @param {boolean} cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true)\n * @param {function(Error, Jimp)} cb (optional): a callback for when complete (default: no callback)\n * @returns {Jimp} this for chaining of methods\n */\n autocrop(...args) {\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image\n\n let cb; // callback\n let leaveBorder = 0; // Amount of pixels in border to leave\n let tolerance = 0.0002; // percent of color difference tolerance (default value)\n let cropOnlyFrames = true; // flag to force cropping only if the image has a real \"frame\"\n // i.e. all 4 sides have some border (default value)\n let cropSymmetric = false; // flag to force cropping top be symmetric.\n // i.e. north and south / east and west are cropped by the same value\n let ignoreSides = {\n north: false,\n south: false,\n east: false,\n west: false\n };\n\n // parse arguments\n for (let a = 0, len = args.length; a < len; a++) {\n if (typeof args[a] === 'number') {\n // tolerance value passed\n tolerance = args[a];\n }\n\n if (typeof args[a] === 'boolean') {\n // cropOnlyFrames value passed\n cropOnlyFrames = args[a];\n }\n\n if (typeof args[a] === 'function') {\n // callback value passed\n cb = args[a];\n }\n\n if (typeof args[a] === 'object') {\n // config object passed\n const config = args[a];\n\n if (typeof config.tolerance !== 'undefined') {\n ({ tolerance } = config);\n }\n\n if (typeof config.cropOnlyFrames !== 'undefined') {\n ({ cropOnlyFrames } = config);\n }\n\n if (typeof config.cropSymmetric !== 'undefined') {\n ({ cropSymmetric } = config);\n }\n\n if (typeof config.leaveBorder !== 'undefined') {\n ({ leaveBorder } = config);\n }\n\n if (typeof config.ignoreSides !== 'undefined') {\n ({ ignoreSides } = config);\n }\n }\n }\n\n /**\n * All borders must be of the same color as the top left pixel, to be cropped.\n * It should be possible to crop borders each with a different color,\n * but since there are many ways for corners to intersect, it would\n * introduce unnecessary complexity to the algorithm.\n */\n\n // scan each side for same color borders\n let colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color\n const rgba1 = this.constructor.intToRGBA(colorTarget);\n\n // for north and east sides\n let northPixelsToCrop = 0;\n let eastPixelsToCrop = 0;\n let southPixelsToCrop = 0;\n let westPixelsToCrop = 0;\n\n // north side (scan rows from north to south)\n colorTarget = this.getPixelColor(0, 0);\n if (!ignoreSides.north) {\n north: for (let y = 0; y < h - minPixelsPerSide; y++) {\n for (let x = 0; x < w; x++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break north;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n northPixelsToCrop++;\n }\n }\n\n // east side (scan columns from east to west)\n colorTarget = this.getPixelColor(w, 0);\n if (!ignoreSides.east) {\n east: for (let x = 0; x < w - minPixelsPerSide; x++) {\n for (let y = 0 + northPixelsToCrop; y < h; y++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break east;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n eastPixelsToCrop++;\n }\n }\n\n // south side (scan rows from south to north)\n colorTarget = this.getPixelColor(0, h);\n\n if (!ignoreSides.south) {\n south: for (\n let y = h - 1;\n y >= northPixelsToCrop + minPixelsPerSide;\n y--\n ) {\n for (let x = w - eastPixelsToCrop - 1; x >= 0; x--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break south;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n southPixelsToCrop++;\n }\n }\n\n // west side (scan columns from west to east)\n colorTarget = this.getPixelColor(w, h);\n if (!ignoreSides.west) {\n west: for (\n let x = w - 1;\n x >= 0 + eastPixelsToCrop + minPixelsPerSide;\n x--\n ) {\n for (let y = h - 1; y >= 0 + northPixelsToCrop; y--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break west;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n westPixelsToCrop++;\n }\n }\n\n // decide if a crop is needed\n let doCrop = false;\n\n // apply leaveBorder\n westPixelsToCrop -= leaveBorder;\n eastPixelsToCrop -= leaveBorder;\n northPixelsToCrop -= leaveBorder;\n southPixelsToCrop -= leaveBorder;\n\n if (cropSymmetric) {\n const horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop);\n const vertical = Math.min(northPixelsToCrop, southPixelsToCrop);\n westPixelsToCrop = horizontal;\n eastPixelsToCrop = horizontal;\n northPixelsToCrop = vertical;\n southPixelsToCrop = vertical;\n }\n\n // make sure that crops are >= 0\n westPixelsToCrop = westPixelsToCrop >= 0 ? westPixelsToCrop : 0;\n eastPixelsToCrop = eastPixelsToCrop >= 0 ? eastPixelsToCrop : 0;\n northPixelsToCrop = northPixelsToCrop >= 0 ? northPixelsToCrop : 0;\n southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0;\n\n // safety checks\n const widthOfRemainingPixels =\n w - (westPixelsToCrop + eastPixelsToCrop);\n const heightOfRemainingPixels =\n h - (southPixelsToCrop + northPixelsToCrop);\n\n if (cropOnlyFrames) {\n // crop image if all sides should be cropped\n doCrop =\n eastPixelsToCrop !== 0 &&\n northPixelsToCrop !== 0 &&\n westPixelsToCrop !== 0 &&\n southPixelsToCrop !== 0;\n } else {\n // crop image if at least one side should be cropped\n doCrop =\n eastPixelsToCrop !== 0 ||\n northPixelsToCrop !== 0 ||\n westPixelsToCrop !== 0 ||\n southPixelsToCrop !== 0;\n }\n\n if (doCrop) {\n // do the real crop\n this.crop(\n eastPixelsToCrop,\n northPixelsToCrop,\n widthOfRemainingPixels,\n heightOfRemainingPixels\n );\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n };\n}\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["throwError","isNodePattern","pluginCrop","event","x","y","w","h","cb","call","Math","round","bitmap","width","start","end","data","slice","Buffer","allocUnsafe","offset","scanQuiet","idx","readUInt32BE","writeUInt32BE","height","class","autocrop","minPixelsPerSide","leaveBorder","tolerance","cropOnlyFrames","cropSymmetric","ignoreSides","north","south","east","west","args","a","len","length","config","colorTarget","getPixelColor","rgba1","constructor","intToRGBA","northPixelsToCrop","eastPixelsToCrop","southPixelsToCrop","westPixelsToCrop","colorXY","rgba2","colorDiff","doCrop","horizontal","min","vertical","widthOfRemainingPixels","heightOfRemainingPixels","crop"],"sources":["../src/index.js"],"sourcesContent":["/* eslint-disable no-labels */\n\nimport { throwError, isNodePattern } from \"@jimp/utils\";\n\nexport default function pluginCrop(event) {\n /**\n * Crops the image at a given point to a give size\n * @param {number} x the x coordinate to crop form\n * @param {number} y the y coordinate to crop form\n * @param w the width of the crop region\n * @param h the height of the crop region\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n event(\"crop\", function (x, y, w, h, cb) {\n if (typeof x !== \"number\" || typeof y !== \"number\")\n return throwError.call(this, \"x and y must be numbers\", cb);\n if (typeof w !== \"number\" || typeof h !== \"number\")\n return throwError.call(this, \"w and h must be numbers\", cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n if (x === 0 && w === this.bitmap.width) {\n // shortcut\n const start = (w * y + x) << 2;\n const end = start + ((h * w) << 2);\n\n this.bitmap.data = this.bitmap.data.slice(start, end);\n } else {\n const bitmap = Buffer.allocUnsafe(w * h * 4);\n let offset = 0;\n\n this.scanQuiet(x, y, w, h, function (x, y, idx) {\n const data = this.bitmap.data.readUInt32BE(idx, true);\n bitmap.writeUInt32BE(data, offset, true);\n offset += 4;\n });\n\n this.bitmap.data = bitmap;\n }\n\n this.bitmap.width = w;\n this.bitmap.height = h;\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n });\n\n return {\n class: {\n /**\n * Autocrop same color borders from this image\n * @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%)\n * @param {boolean} cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true)\n * @param {function(Error, Jimp)} cb (optional): a callback for when complete (default: no callback)\n * @returns {Jimp} this for chaining of methods\n */\n autocrop(...args) {\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image\n\n let cb; // callback\n let leaveBorder = 0; // Amount of pixels in border to leave\n let tolerance = 0.0002; // percent of color difference tolerance (default value)\n let cropOnlyFrames = true; // flag to force cropping only if the image has a real \"frame\"\n // i.e. all 4 sides have some border (default value)\n let cropSymmetric = false; // flag to force cropping top be symmetric.\n // i.e. north and south / east and west are cropped by the same value\n let ignoreSides = {\n north: false,\n south: false,\n east: false,\n west: false,\n };\n\n // parse arguments\n for (let a = 0, len = args.length; a < len; a++) {\n if (typeof args[a] === \"number\") {\n // tolerance value passed\n tolerance = args[a];\n }\n\n if (typeof args[a] === \"boolean\") {\n // cropOnlyFrames value passed\n cropOnlyFrames = args[a];\n }\n\n if (typeof args[a] === \"function\") {\n // callback value passed\n cb = args[a];\n }\n\n if (typeof args[a] === \"object\") {\n // config object passed\n const config = args[a];\n\n if (typeof config.tolerance !== \"undefined\") {\n ({ tolerance } = config);\n }\n\n if (typeof config.cropOnlyFrames !== \"undefined\") {\n ({ cropOnlyFrames } = config);\n }\n\n if (typeof config.cropSymmetric !== \"undefined\") {\n ({ cropSymmetric } = config);\n }\n\n if (typeof config.leaveBorder !== \"undefined\") {\n ({ leaveBorder } = config);\n }\n\n if (typeof config.ignoreSides !== \"undefined\") {\n ({ ignoreSides } = config);\n }\n }\n }\n\n /**\n * All borders must be of the same color as the top left pixel, to be cropped.\n * It should be possible to crop borders each with a different color,\n * but since there are many ways for corners to intersect, it would\n * introduce unnecessary complexity to the algorithm.\n */\n\n // scan each side for same color borders\n let colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color\n const rgba1 = this.constructor.intToRGBA(colorTarget);\n\n // for north and east sides\n let northPixelsToCrop = 0;\n let eastPixelsToCrop = 0;\n let southPixelsToCrop = 0;\n let westPixelsToCrop = 0;\n\n // north side (scan rows from north to south)\n colorTarget = this.getPixelColor(0, 0);\n if (!ignoreSides.north) {\n north: for (let y = 0; y < h - minPixelsPerSide; y++) {\n for (let x = 0; x < w; x++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break north;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n northPixelsToCrop++;\n }\n }\n\n // west side (scan columns from west to east)\n colorTarget = this.getPixelColor(w, 0);\n if (!ignoreSides.west) {\n west: for (let x = 0; x < w - minPixelsPerSide; x++) {\n for (let y = 0 + northPixelsToCrop; y < h; y++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break west;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n westPixelsToCrop++;\n }\n }\n\n // south side (scan rows from south to north)\n colorTarget = this.getPixelColor(0, h);\n\n if (!ignoreSides.south) {\n south: for (\n let y = h - 1;\n y >= northPixelsToCrop + minPixelsPerSide;\n y--\n ) {\n for (let x = w - eastPixelsToCrop - 1; x >= 0; x--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break south;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n southPixelsToCrop++;\n }\n }\n\n // east side (scan columns from east to west)\n colorTarget = this.getPixelColor(w, h);\n if (!ignoreSides.east) {\n east: for (\n let x = w - 1;\n x >= 0 + westPixelsToCrop + minPixelsPerSide;\n x--\n ) {\n for (let y = h - 1; y >= 0 + northPixelsToCrop; y--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break east;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n eastPixelsToCrop++;\n }\n }\n\n // decide if a crop is needed\n let doCrop = false;\n\n // apply leaveBorder\n westPixelsToCrop -= leaveBorder;\n eastPixelsToCrop -= leaveBorder;\n northPixelsToCrop -= leaveBorder;\n southPixelsToCrop -= leaveBorder;\n\n if (cropSymmetric) {\n const horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop);\n const vertical = Math.min(northPixelsToCrop, southPixelsToCrop);\n westPixelsToCrop = horizontal;\n eastPixelsToCrop = horizontal;\n northPixelsToCrop = vertical;\n southPixelsToCrop = vertical;\n }\n\n // make sure that crops are >= 0\n westPixelsToCrop = westPixelsToCrop >= 0 ? westPixelsToCrop : 0;\n eastPixelsToCrop = eastPixelsToCrop >= 0 ? eastPixelsToCrop : 0;\n northPixelsToCrop = northPixelsToCrop >= 0 ? northPixelsToCrop : 0;\n southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0;\n\n // safety checks\n const widthOfRemainingPixels =\n w - (westPixelsToCrop + eastPixelsToCrop);\n const heightOfRemainingPixels =\n h - (southPixelsToCrop + northPixelsToCrop);\n\n if (cropOnlyFrames) {\n // crop image if all sides should be cropped\n doCrop =\n eastPixelsToCrop !== 0 &&\n northPixelsToCrop !== 0 &&\n westPixelsToCrop !== 0 &&\n southPixelsToCrop !== 0;\n } else {\n // crop image if at least one side should be cropped\n doCrop =\n eastPixelsToCrop !== 0 ||\n northPixelsToCrop !== 0 ||\n westPixelsToCrop !== 0 ||\n southPixelsToCrop !== 0;\n }\n\n if (doCrop) {\n // do the real crop\n this.crop(\n westPixelsToCrop,\n northPixelsToCrop,\n widthOfRemainingPixels,\n heightOfRemainingPixels\n );\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n },\n };\n}\n"],"mappings":"AAAA;;AAEA,SAASA,UAAU,EAAEC,aAAa,QAAQ,aAAa;AAEvD,eAAe,SAASC,UAAU,CAACC,KAAK,EAAE;EACxC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEA,KAAK,CAAC,MAAM,EAAE,UAAUC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,EAAE,EAAE;IACtC,IAAI,OAAOJ,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAChD,OAAOL,UAAU,CAACS,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAED,EAAE,CAAC;IAC7D,IAAI,OAAOF,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAChD,OAAOP,UAAU,CAACS,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAED,EAAE,CAAC;;IAE7D;IACAJ,CAAC,GAAGM,IAAI,CAACC,KAAK,CAACP,CAAC,CAAC;IACjBC,CAAC,GAAGK,IAAI,CAACC,KAAK,CAACN,CAAC,CAAC;IACjBC,CAAC,GAAGI,IAAI,CAACC,KAAK,CAACL,CAAC,CAAC;IACjBC,CAAC,GAAGG,IAAI,CAACC,KAAK,CAACJ,CAAC,CAAC;IAEjB,IAAIH,CAAC,KAAK,CAAC,IAAIE,CAAC,KAAK,IAAI,CAACM,MAAM,CAACC,KAAK,EAAE;MACtC;MACA,MAAMC,KAAK,GAAIR,CAAC,GAAGD,CAAC,GAAGD,CAAC,IAAK,CAAC;MAC9B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ACH"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-crop/index.d.ts b/project starter code/node_modules/@jimp/plugin-crop/index.d.ts index 5dc5c83e..48550b4f 100644 --- a/project starter code/node_modules/@jimp/plugin-crop/index.d.ts +++ b/project starter code/node_modules/@jimp/plugin-crop/index.d.ts @@ -1,7 +1,13 @@ -import { Jimp, ImageCallback } from '@jimp/core'; +import { Jimp, ImageCallback } from "@jimp/core"; interface CropClass { - crop(x: number, y: number, w: number, h: number, cb?: ImageCallback): this; + crop( + x: number, + y: number, + w: number, + h: number, + cb?: ImageCallback + ): this; cropQuiet( x: number, y: number, @@ -27,14 +33,14 @@ interface CropClass { south: boolean; east: boolean; west: boolean; - } + }; }, cb?: ImageCallback ): this; } interface Crop { - class: CropClass + class: CropClass; } -export default function(): Crop; +export default function (): Crop; diff --git a/project starter code/node_modules/@jimp/plugin-crop/package.json b/project starter code/node_modules/@jimp/plugin-crop/package.json index fd888526..15d98501 100644 --- a/project starter code/node_modules/@jimp/plugin-crop/package.json +++ b/project starter code/node_modules/@jimp/plugin-crop/package.json @@ -1,12 +1,13 @@ { "name": "@jimp/plugin-crop", - "version": "0.16.2", + "version": "0.22.12", "description": "crop an image.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js", "test:watch": "npm run test -- --reporter min --watch", "test:coverage": "nyc npm run test", "build": "npm run build:node:production && npm run build:module", @@ -20,12 +21,11 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/test-utils": "^0.16.2" + "@jimp/custom": "^0.22.12", + "@jimp/test-utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" @@ -33,5 +33,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/plugin-crop/src/index.js b/project starter code/node_modules/@jimp/plugin-crop/src/index.js index 4d1f78ad..7528d2b8 100644 --- a/project starter code/node_modules/@jimp/plugin-crop/src/index.js +++ b/project starter code/node_modules/@jimp/plugin-crop/src/index.js @@ -1,6 +1,6 @@ /* eslint-disable no-labels */ -import { throwError, isNodePattern } from '@jimp/utils'; +import { throwError, isNodePattern } from "@jimp/utils"; export default function pluginCrop(event) { /** @@ -12,11 +12,11 @@ export default function pluginCrop(event) { * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ - event('crop', function(x, y, w, h, cb) { - if (typeof x !== 'number' || typeof y !== 'number') - return throwError.call(this, 'x and y must be numbers', cb); - if (typeof w !== 'number' || typeof h !== 'number') - return throwError.call(this, 'w and h must be numbers', cb); + event("crop", function (x, y, w, h, cb) { + if (typeof x !== "number" || typeof y !== "number") + return throwError.call(this, "x and y must be numbers", cb); + if (typeof w !== "number" || typeof h !== "number") + return throwError.call(this, "w and h must be numbers", cb); // round input x = Math.round(x); @@ -27,14 +27,14 @@ export default function pluginCrop(event) { if (x === 0 && w === this.bitmap.width) { // shortcut const start = (w * y + x) << 2; - const end = (start + h * w) << 2; + const end = start + ((h * w) << 2); this.bitmap.data = this.bitmap.data.slice(start, end); } else { const bitmap = Buffer.allocUnsafe(w * h * 4); let offset = 0; - this.scanQuiet(x, y, w, h, function(x, y, idx) { + this.scanQuiet(x, y, w, h, function (x, y, idx) { const data = this.bitmap.data.readUInt32BE(idx, true); bitmap.writeUInt32BE(data, offset, true); offset += 4; @@ -78,47 +78,47 @@ export default function pluginCrop(event) { north: false, south: false, east: false, - west: false + west: false, }; // parse arguments for (let a = 0, len = args.length; a < len; a++) { - if (typeof args[a] === 'number') { + if (typeof args[a] === "number") { // tolerance value passed tolerance = args[a]; } - if (typeof args[a] === 'boolean') { + if (typeof args[a] === "boolean") { // cropOnlyFrames value passed cropOnlyFrames = args[a]; } - if (typeof args[a] === 'function') { + if (typeof args[a] === "function") { // callback value passed cb = args[a]; } - if (typeof args[a] === 'object') { + if (typeof args[a] === "object") { // config object passed const config = args[a]; - if (typeof config.tolerance !== 'undefined') { + if (typeof config.tolerance !== "undefined") { ({ tolerance } = config); } - if (typeof config.cropOnlyFrames !== 'undefined') { + if (typeof config.cropOnlyFrames !== "undefined") { ({ cropOnlyFrames } = config); } - if (typeof config.cropSymmetric !== 'undefined') { + if (typeof config.cropSymmetric !== "undefined") { ({ cropSymmetric } = config); } - if (typeof config.leaveBorder !== 'undefined') { + if (typeof config.leaveBorder !== "undefined") { ({ leaveBorder } = config); } - if (typeof config.ignoreSides !== 'undefined') { + if (typeof config.ignoreSides !== "undefined") { ({ ignoreSides } = config); } } @@ -160,22 +160,22 @@ export default function pluginCrop(event) { } } - // east side (scan columns from east to west) + // west side (scan columns from west to east) colorTarget = this.getPixelColor(w, 0); - if (!ignoreSides.east) { - east: for (let x = 0; x < w - minPixelsPerSide; x++) { + if (!ignoreSides.west) { + west: for (let x = 0; x < w - minPixelsPerSide; x++) { for (let y = 0 + northPixelsToCrop; y < h; y++) { const colorXY = this.getPixelColor(x, y); const rgba2 = this.constructor.intToRGBA(colorXY); if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) { // this pixel is too distant from the first one: abort this side scan - break east; + break west; } } // this column contains all pixels with the same color: increment this side pixels to crop - eastPixelsToCrop++; + westPixelsToCrop++; } } @@ -203,12 +203,12 @@ export default function pluginCrop(event) { } } - // west side (scan columns from west to east) + // east side (scan columns from east to west) colorTarget = this.getPixelColor(w, h); - if (!ignoreSides.west) { - west: for ( + if (!ignoreSides.east) { + east: for ( let x = w - 1; - x >= 0 + eastPixelsToCrop + minPixelsPerSide; + x >= 0 + westPixelsToCrop + minPixelsPerSide; x-- ) { for (let y = h - 1; y >= 0 + northPixelsToCrop; y--) { @@ -217,12 +217,12 @@ export default function pluginCrop(event) { if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) { // this pixel is too distant from the first one: abort this side scan - break west; + break east; } } // this column contains all pixels with the same color: increment this side pixels to crop - westPixelsToCrop++; + eastPixelsToCrop++; } } @@ -275,7 +275,7 @@ export default function pluginCrop(event) { if (doCrop) { // do the real crop this.crop( - eastPixelsToCrop, + westPixelsToCrop, northPixelsToCrop, widthOfRemainingPixels, heightOfRemainingPixels @@ -287,7 +287,7 @@ export default function pluginCrop(event) { } return this; - } - } + }, + }, }; } diff --git a/project starter code/node_modules/@jimp/plugin-crop/test/autocrop.test.js b/project starter code/node_modules/@jimp/plugin-crop/test/autocrop.test.js index 395af91e..9fe2b3a7 100644 --- a/project starter code/node_modules/@jimp/plugin-crop/test/autocrop.test.js +++ b/project starter code/node_modules/@jimp/plugin-crop/test/autocrop.test.js @@ -1,429 +1,408 @@ -import { Jimp, mkJGD } from '@jimp/test-utils'; -import configure from '@jimp/custom'; +import { Jimp, mkJGD } from "@jimp/test-utils"; +import configure from "@jimp/custom"; -import crop from '../src'; +import crop from "../src"; +import { expectToBeJGD } from "@jimp/test-utils/src"; const jimp = configure({ plugins: [crop] }, Jimp); -describe('Autocrop', () => { - it('image with transparent surround color', async () => { +describe("Autocrop", () => { + it("image with transparent surround color", async () => { const imgSrc = await jimp.read( mkJGD( - ' ', - ' ◆◆ ', - ' ◆▦▦◆ ', - ' ◆▦▦▦▦◆ ', - ' ◆▦▦◆ ', - ' ◆◆ ', - ' ' + " ", + " ◆◆ ", + " ◆▦▦◆ ", + " ◆▦▦▦▦◆ ", + " ◆▦▦◆ ", + " ◆◆ ", + " " ) ); - imgSrc - .autocrop() - .getJGDSync() - .should.be.sameJGD( - mkJGD(' ◆◆ ', ' ◆▦▦◆ ', '◆▦▦▦▦◆', ' ◆▦▦◆ ', ' ◆◆ ') - ); + expectToBeJGD( + imgSrc.autocrop().getJGDSync(), + mkJGD(" ◆◆ ", " ◆▦▦◆ ", "◆▦▦▦▦◆", " ◆▦▦◆ ", " ◆◆ ") + ); }); - it('image with opaque surround color', async () => { + it("image with opaque surround color", async () => { const imgSrc = await jimp.read( mkJGD( - '▥▥▥▥▥▥▥▥▥▥', - '▥▥▥▥◆◆▥▥▥▥', - '▥▥▥◆▦▦◆▥▥▥', - '▥▥◆▦▦▦▦◆▥▥', - '▥▥▥◆▦▦◆▥▥▥', - '▥▥▥▥◆◆▥▥▥▥', - '▥▥▥▥▥▥▥▥▥▥' + "▥▥▥▥▥▥▥▥▥▥", + "▥▥▥▥◆◆▥▥▥▥", + "▥▥▥◆▦▦◆▥▥▥", + "▥▥◆▦▦▦▦◆▥▥", + "▥▥▥◆▦▦◆▥▥▥", + "▥▥▥▥◆◆▥▥▥▥", + "▥▥▥▥▥▥▥▥▥▥" ) ); - imgSrc - .autocrop() - .getJGDSync() - .should.be.sameJGD( - mkJGD('▥▥◆◆▥▥', '▥◆▦▦◆▥', '◆▦▦▦▦◆', '▥◆▦▦◆▥', '▥▥◆◆▥▥') - ); + expectToBeJGD( + imgSrc.autocrop().getJGDSync(), + mkJGD("▥▥◆◆▥▥", "▥◆▦▦◆▥", "◆▦▦▦▦◆", "▥◆▦▦◆▥", "▥▥◆◆▥▥") + ); }); - it('image with one color border', async () => { + it("image with one color border", async () => { const imgSrc = await jimp.read( mkJGD( - '▥▥▥▥▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥▥▥▥▥', - '▥▥ ◆◆ ▥▥', - '▥▥ ◆▦▦◆ ▥▥', - '▥▥ ◆▦▦▦▦◆ ▥▥', - '▥▥ ◆▦▦◆ ▥▥', - '▥▥ ◆◆ ▥▥', - '▥▥▥▥▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥▥▥▥▥' + "▥▥▥▥▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥▥▥▥▥", + "▥▥ ◆◆ ▥▥", + "▥▥ ◆▦▦◆ ▥▥", + "▥▥ ◆▦▦▦▦◆ ▥▥", + "▥▥ ◆▦▦◆ ▥▥", + "▥▥ ◆◆ ▥▥", + "▥▥▥▥▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥▥▥▥▥" ) ); - imgSrc - .autocrop() - .getJGDSync() - .should.be.sameJGD( - mkJGD(' ◆◆ ', ' ◆▦▦◆ ', ' ◆▦▦▦▦◆ ', ' ◆▦▦◆ ', ' ◆◆ ') - ); + expectToBeJGD( + imgSrc.autocrop().getJGDSync(), + mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ") + ); }); - it('image border with small variation', async () => { + it("image border with small variation", async () => { const imgSrc = await jimp.read( mkJGD( - '323232323232', - '232323232323', - '32 ◆◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆▦▦▦▦◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆◆ 32', - '232323232323', - '323232323232' + "323232323232", + "232323232323", + "32 ◆◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆▦▦▦▦◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆◆ 32", + "232323232323", + "323232323232" ) ); - imgSrc - .clone() - .autocrop() - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '323232323232', - '232323232323', - '32 ◆◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆▦▦▦▦◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆◆ 32', - '232323232323', - '323232323232' - ) - ); - imgSrc - .clone() - .autocrop(0.005) - .getJGDSync() - .should.be.sameJGD( - mkJGD(' ◆◆ ', ' ◆▦▦◆ ', ' ◆▦▦▦▦◆ ', ' ◆▦▦◆ ', ' ◆◆ ') - ); + expectToBeJGD( + imgSrc.clone().autocrop().getJGDSync(), + mkJGD( + "323232323232", + "232323232323", + "32 ◆◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆▦▦▦▦◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆◆ 32", + "232323232323", + "323232323232" + ) + ); + expectToBeJGD( + imgSrc.clone().autocrop(0.005).getJGDSync(), + mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ") + ); }); - it('image border with small variation configured by options', async () => { + it("image border with small variation configured by options", async () => { const imgSrc = await Jimp.read( mkJGD( - '323232323232', - '232323232323', - '32 ◆◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆▦▦▦▦◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆◆ 32', - '232323232323', - '323232323232' + "323232323232", + "232323232323", + "32 ◆◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆▦▦▦▦◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆◆ 32", + "232323232323", + "323232323232" + ) + ); + expectToBeJGD( + imgSrc.clone().autocrop().getJGDSync(), + mkJGD( + "323232323232", + "232323232323", + "32 ◆◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆▦▦▦▦◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆◆ 32", + "232323232323", + "323232323232" ) ); - imgSrc - .clone() - .autocrop() - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '323232323232', - '232323232323', - '32 ◆◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆▦▦▦▦◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆◆ 32', - '232323232323', - '323232323232' - ) - ); - imgSrc - .clone() - .autocrop({ tolerance: 0.005 }) - .getJGDSync() - .should.be.sameJGD( - mkJGD(' ◆◆ ', ' ◆▦▦◆ ', ' ◆▦▦▦▦◆ ', ' ◆▦▦◆ ', ' ◆◆ ') - ); + expectToBeJGD( + imgSrc.clone().autocrop({ tolerance: 0.005 }).getJGDSync(), + mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ") + ); }); - it('image without frame', async () => { + it("image without frame", async () => { const imgSrc = await Jimp.read( mkJGD( - '▥▥ ◆◆ ', - '▥▥ ◆▦▦◆ ', - '▥▥ ◆▦▦▦▦◆ ', - '▥▥ ◆▦▦◆ ', - '▥▥ ◆◆ ', - '▥▥▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥▥▥' + "▥▥ ◆◆ ", + "▥▥ ◆▦▦◆ ", + "▥▥ ◆▦▦▦▦◆ ", + "▥▥ ◆▦▦◆ ", + "▥▥ ◆◆ ", + "▥▥▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥▥▥" ) ); - imgSrc - .autocrop(false) - .getJGDSync() - .should.be.sameJGD( - mkJGD(' ◆◆ ', ' ◆▦▦◆ ', ' ◆▦▦▦▦◆ ', ' ◆▦▦◆ ', ' ◆◆ ') - ); + expectToBeJGD( + imgSrc.autocrop(false).getJGDSync(), + mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ") + ); }); - it('image without frame configured by options', async () => { + it("image without frame configured by options", async () => { const imgSrc = await Jimp.read( mkJGD( - '▥▥ ◆◆ ', - '▥▥ ◆▦▦◆ ', - '▥▥ ◆▦▦▦▦◆ ', - '▥▥ ◆▦▦◆ ', - '▥▥ ◆◆ ', - '▥▥▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥▥▥' + "▥▥ ◆◆ ", + "▥▥ ◆▦▦◆ ", + "▥▥ ◆▦▦▦▦◆ ", + "▥▥ ◆▦▦◆ ", + "▥▥ ◆◆ ", + "▥▥▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥▥▥" ) ); - imgSrc - .autocrop({ cropOnlyFrames: false }) - .getJGDSync() - .should.be.sameJGD( - mkJGD(' ◆◆ ', ' ◆▦▦◆ ', ' ◆▦▦▦▦◆ ', ' ◆▦▦◆ ', ' ◆◆ ') - ); + expectToBeJGD( + imgSrc.autocrop({ cropOnlyFrames: false }).getJGDSync(), + mkJGD(" ◆◆ ", " ◆▦▦◆ ", " ◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ") + ); }); - it('image with symmetric border configured by options', async () => { + it("image with symmetric border configured by options", async () => { const imgSrc = await Jimp.read( mkJGD( - '▥▥▥▥▥▥▥▥▥▥▥▥▥▥', - '▥▥ ◆◆ ▥▥▥▥', - '▥▥ ◆▦▦◆ ▥▥▥▥', - '▥▥ ◆▦▦▦▦◆ ▥▥▥▥', - '▥▥ ◆▦▦◆ ▥▥▥▥', - '▥▥ ◆◆ ▥▥▥▥', - '▥▥▥▥▥▥▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥▥▥▥▥▥▥' + "▥▥▥▥▥▥▥▥▥▥▥▥▥▥", + "▥▥ ◆◆ ▥▥▥▥", + "▥▥ ◆▦▦◆ ▥▥▥▥", + "▥▥ ◆▦▦▦▦◆ ▥▥▥▥", + "▥▥ ◆▦▦◆ ▥▥▥▥", + "▥▥ ◆◆ ▥▥▥▥", + "▥▥▥▥▥▥▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥▥▥▥▥▥▥" ) ); - imgSrc - .autocrop({ cropSymmetric: true }) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ◆◆ ▥▥', - ' ◆▦▦◆ ▥▥', - ' ◆▦▦▦▦◆ ▥▥', - ' ◆▦▦◆ ▥▥', - ' ◆◆ ▥▥', - '▥▥▥▥▥▥▥▥▥▥' - ) - ); + expectToBeJGD( + imgSrc.autocrop({ cropSymmetric: true }).getJGDSync(), + mkJGD( + " ◆◆ ▥▥", + " ◆▦▦◆ ▥▥", + " ◆▦▦▦▦◆ ▥▥", + " ◆▦▦◆ ▥▥", + " ◆◆ ▥▥", + "▥▥▥▥▥▥▥▥▥▥" + ) + ); }); - it('image without frame and with symmetric border configured by options', async () => { + it("image without frame and with symmetric border configured by options", async () => { const imgSrc = await Jimp.read( mkJGD( - '▥▥ ◆◆ ▥▥▥▥', - '▥▥ ◆▦▦◆ ▥▥▥▥', - '▥▥ ◆▦▦▦▦◆ ▥▥▥▥', - '▥▥ ◆▦▦◆ ▥▥▥▥', - '▥▥ ◆◆ ▥▥▥▥', - '▥▥▥▥▥▥▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥▥▥▥▥▥▥' + "▥▥ ◆◆ ▥▥▥▥", + "▥▥ ◆▦▦◆ ▥▥▥▥", + "▥▥ ◆▦▦▦▦◆ ▥▥▥▥", + "▥▥ ◆▦▦◆ ▥▥▥▥", + "▥▥ ◆◆ ▥▥▥▥", + "▥▥▥▥▥▥▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥▥▥▥▥▥▥" + ) + ); + expectToBeJGD( + imgSrc + .autocrop({ cropSymmetric: true, cropOnlyFrames: false }) + .getJGDSync(), + mkJGD( + " ◆◆ ▥▥", + " ◆▦▦◆ ▥▥", + " ◆▦▦▦▦◆ ▥▥", + " ◆▦▦◆ ▥▥", + " ◆◆ ▥▥", + "▥▥▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥▥▥" ) ); - imgSrc - .autocrop({ cropSymmetric: true, cropOnlyFrames: false }) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ◆◆ ▥▥', - ' ◆▦▦◆ ▥▥', - ' ◆▦▦▦▦◆ ▥▥', - ' ◆▦▦◆ ▥▥', - ' ◆◆ ▥▥', - '▥▥▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥▥▥' - ) - ); }); - it('image without frame and with some border left', async () => { + it("image without frame and with some border left", async () => { const imgSrc = await Jimp.read( mkJGD( - '323232323232', - '232323232323', - '32 ◆◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆▦▦▦▦◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆◆ 32', - '232323232323', - '323232323232' + "323232323232", + "232323232323", + "32 ◆◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆▦▦▦▦◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆◆ 32", + "232323232323", + "323232323232" ) ); - imgSrc - .autocrop({ - tolerance: 0.005, - leaveBorder: 1 - }) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '3232323232', - '2 ◆◆ 3', - '3 ◆▦▦◆ 2', - '2 ◆▦▦▦▦◆ 3', - '3 ◆▦▦◆ 2', - '2 ◆◆ 3', - '3232323232' - ) - ); + expectToBeJGD( + imgSrc + .autocrop({ + tolerance: 0.005, + leaveBorder: 1, + }) + .getJGDSync(), + mkJGD( + "3232323232", + "2 ◆◆ 3", + "3 ◆▦▦◆ 2", + "2 ◆▦▦▦▦◆ 3", + "3 ◆▦▦◆ 2", + "2 ◆◆ 3", + "3232323232" + ) + ); }); it('image not cropped given an out of bounds "leaveBorder" value ', async () => { const imgSrc = await Jimp.read( mkJGD( - '323232323232', - '232323232323', - '32 ◆◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆▦▦▦▦◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆◆ 32', - '232323232323', - '323232323232' + "323232323232", + "232323232323", + "32 ◆◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆▦▦▦▦◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆◆ 32", + "232323232323", + "323232323232" + ) + ); + expectToBeJGD( + imgSrc + .autocrop({ + tolerance: 0.005, + leaveBorder: 100, + }) + .getJGDSync(), + mkJGD( + "323232323232", + "232323232323", + "32 ◆◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆▦▦▦▦◆ 32", + "23 ◆▦▦◆ 23", + "32 ◆◆ 32", + "232323232323", + "323232323232" ) ); - - imgSrc - .autocrop({ - tolerance: 0.005, - leaveBorder: 100 - }) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '323232323232', - '232323232323', - '32 ◆◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆▦▦▦▦◆ 32', - '23 ◆▦▦◆ 23', - '32 ◆◆ 32', - '232323232323', - '323232323232' - ) - ); }); - it('image with top and bottom frame and leaveBorder', async () => { + it("image with top and bottom frame and leaveBorder", async () => { const imgSrc = await Jimp.read( mkJGD( - '▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥', - ' ◆◆ ', - ' ◆▦▦◆ ', - ' ◆▦▦▦▦◆ ', - ' ◆▦▦◆ ', - ' ◆◆ ', - '▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥' + "▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥", + " ◆◆ ", + " ◆▦▦◆ ", + " ◆▦▦▦▦◆ ", + " ◆▦▦◆ ", + " ◆◆ ", + "▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥" + ) + ); + expectToBeJGD( + imgSrc + .autocrop({ + cropSymmetric: true, + cropOnlyFrames: false, + leaveBorder: 2, + }) + .getJGDSync(), + mkJGD( + "▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥", + " ◆◆ ", + " ◆▦▦◆ ", + " ◆▦▦▦▦◆ ", + " ◆▦▦◆ ", + " ◆◆ ", + "▥▥▥▥▥▥▥▥", + "▥▥▥▥▥▥▥▥" ) ); - imgSrc - .autocrop({ cropSymmetric: true, cropOnlyFrames: false, leaveBorder: 2 }) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥', - ' ◆◆ ', - ' ◆▦▦◆ ', - ' ◆▦▦▦▦◆ ', - ' ◆▦▦◆ ', - ' ◆◆ ', - '▥▥▥▥▥▥▥▥', - '▥▥▥▥▥▥▥▥' - ) - ); }); - it('ignore sides north', async () => { + it("ignore sides north", async () => { const imgSrc = await jimp.read( mkJGD( - ' ', - ' ◆◆ ', - ' ◆▦▦◆ ', - ' ◆▦▦▦▦◆ ', - ' ◆▦▦◆ ', - ' ◆◆ ', - ' ' + " ", + " ◆◆ ", + " ◆▦▦◆ ", + " ◆▦▦▦▦◆ ", + " ◆▦▦◆ ", + " ◆◆ ", + " " ) ); - - imgSrc - .autocrop({ cropOnlyFrames: false, ignoreSides: { north: true } }) - .getJGDSync() - .should.be.sameJGD( - mkJGD(' ', ' ◆◆ ', ' ◆▦▦◆ ', '◆▦▦▦▦◆', ' ◆▦▦◆ ', ' ◆◆ ') - ); + expectToBeJGD( + imgSrc + .autocrop({ cropOnlyFrames: false, ignoreSides: { north: true } }) + .getJGDSync(), + mkJGD(" ", " ◆◆ ", " ◆▦▦◆ ", "◆▦▦▦▦◆", " ◆▦▦◆ ", " ◆◆ ") + ); }); - it('ignore sides south and west', async () => { + it("ignore sides south and west", async () => { const imgSrc = await jimp.read( mkJGD( - ' ', - ' ◆◆ ', - ' ◆▦▦◆ ', - ' ◆▦▦▦▦◆ ', - ' ◆▦▦◆ ', - ' ◆◆ ', - ' ' + " ", + " ◆◆ ", + " ◆▦▦◆ ", + " ◆▦▦▦▦◆ ", + " ◆▦▦◆ ", + " ◆◆ ", + " " ) ); - imgSrc - .autocrop({ - cropOnlyFrames: false, - ignoreSides: { west: true, south: true } - }) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ◆◆ ', - ' ◆▦▦◆ ', - '◆▦▦▦▦◆ ', - ' ◆▦▦◆ ', - ' ◆◆ ', - ' ' - ) - ); + expectToBeJGD( + imgSrc + .autocrop({ + cropOnlyFrames: false, + ignoreSides: { west: true, south: true }, + }) + .getJGDSync(), + mkJGD( + " ◆◆ ", + " ◆▦▦◆ ", + " ◆▦▦▦▦◆", + " ◆▦▦◆ ", + " ◆◆ ", + " " + ) + ); }); - it('ignore sides east', async () => { + it("ignore sides east", async () => { const imgSrc = await jimp.read( mkJGD( - ' ', - ' ◆◆ ', - ' ◆▦▦◆ ', - ' ◆▦▦▦▦◆ ', - ' ◆▦▦◆ ', - ' ◆◆ ', - ' ' + " ", + " ◆◆ ", + " ◆▦▦◆ ", + " ◆▦▦▦▦◆ ", + " ◆▦▦◆ ", + " ◆◆ ", + " " ) ); - imgSrc - .autocrop({ cropOnlyFrames: false, ignoreSides: { east: true } }) - .getJGDSync() - .should.be.sameJGD( - mkJGD(' ◆◆ ', ' ◆▦▦◆ ', ' ◆▦▦▦▦◆', ' ◆▦▦◆ ', ' ◆◆ ') - ); + expectToBeJGD( + imgSrc + .autocrop({ cropOnlyFrames: false, ignoreSides: { east: true } }) + .getJGDSync(), + mkJGD(" ◆◆ ", " ◆▦▦◆ ", "◆▦▦▦▦◆ ", " ◆▦▦◆ ", " ◆◆ ") + ); }); }); diff --git a/project starter code/node_modules/@jimp/plugin-crop/test/crop.test.js b/project starter code/node_modules/@jimp/plugin-crop/test/crop.test.js index 88f64973..a6bb5002 100644 --- a/project starter code/node_modules/@jimp/plugin-crop/test/crop.test.js +++ b/project starter code/node_modules/@jimp/plugin-crop/test/crop.test.js @@ -1,65 +1,66 @@ -import { Jimp, mkJGD } from '@jimp/test-utils'; -import configure from '@jimp/custom'; +import { Jimp, mkJGD } from "@jimp/test-utils"; +import configure from "@jimp/custom"; -import crop from '../src'; +import crop from "../src"; +import { expectToBeJGD } from "@jimp/test-utils/src"; const jimp = configure({ plugins: [crop] }, Jimp); -describe('crop', () => { +describe("crop", () => { // 6x5 size - const testImage = mkJGD(' ◆◆ ', ' ◆▦▦◆ ', '◆▦▦▦▦◆', ' ◆▦▦◆ ', ' ◆◆ '); + const testImage = mkJGD(" ◆◆ ", " ◆▦▦◆ ", "◆▦▦▦▦◆", " ◆▦▦◆ ", " ◆◆ "); - it('full width from top', async () => { + it("full width from top", async () => { const imgSrc = await jimp.read(testImage); - imgSrc - .crop(0, 0, 6, 2) - .getJGDSync() - .should.be.sameJGD(mkJGD(' ◆◆ ', ' ◆▦▦◆ ')); + expectToBeJGD( + imgSrc.crop(0, 0, 6, 2).getJGDSync(), + mkJGD(" ◆◆ ", " ◆▦▦◆ ") + ); }); - it('full width from bottom', async () => { + it("full width from bottom", async () => { const imgSrc = await jimp.read(testImage); - imgSrc - .crop(0, 3, 6, 2) - .getJGDSync() - .should.be.sameJGD(mkJGD(' ◆▦▦◆ ', ' ◆◆ ')); + expectToBeJGD( + imgSrc.crop(0, 3, 6, 2).getJGDSync(), + mkJGD(" ◆▦▦◆ ", " ◆◆ ") + ); }); - it('full width from middle', async () => { + it("full width from middle", async () => { const imgSrc = await jimp.read(testImage); - imgSrc - .crop(0, 2, 6, 2) - .getJGDSync() - .should.be.sameJGD(mkJGD('◆▦▦▦▦◆', ' ◆▦▦◆ ')); + expectToBeJGD( + imgSrc.crop(0, 2, 6, 2).getJGDSync(), + mkJGD("◆▦▦▦▦◆", " ◆▦▦◆ ") + ); }); - it('full height from left', async () => { + it("full height from left", async () => { const imgSrc = await jimp.read(testImage); - imgSrc - .crop(0, 0, 2, 5) - .getJGDSync() - .should.be.sameJGD(mkJGD(' ', ' ◆', '◆▦', ' ◆', ' ')); + expectToBeJGD( + imgSrc.crop(0, 0, 2, 5).getJGDSync(), + mkJGD(" ", " ◆", "◆▦", " ◆", " ") + ); }); - it('full height from right', async () => { + it("full height from right", async () => { const imgSrc = await jimp.read(testImage); - imgSrc - .crop(4, 0, 2, 5) - .getJGDSync() - .should.be.sameJGD(mkJGD(' ', '◆ ', '▦◆', '◆ ', ' ')); + expectToBeJGD( + imgSrc.crop(4, 0, 2, 5).getJGDSync(), + mkJGD(" ", "◆ ", "▦◆", "◆ ", " ") + ); }); - it('full height from middle', async () => { + it("full height from middle", async () => { const imgSrc = await jimp.read(testImage); - imgSrc - .crop(2, 0, 2, 5) - .getJGDSync() - .should.be.sameJGD(mkJGD('◆◆', '▦▦', '▦▦', '▦▦', '◆◆')); + expectToBeJGD( + imgSrc.crop(2, 0, 2, 5).getJGDSync(), + mkJGD("◆◆", "▦▦", "▦▦", "▦▦", "◆◆") + ); }); }); diff --git a/project starter code/node_modules/@jimp/plugin-displace/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-displace/CHANGELOG.md index 26394e0f..8d029143 100644 --- a/project starter code/node_modules/@jimp/plugin-displace/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/plugin-displace/CHANGELOG.md @@ -1,3 +1,51 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -12,7 +60,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -20,4 +68,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-displace/README.md b/project starter code/node_modules/@jimp/plugin-displace/README.md index fe3a7bc3..d74a2447 100644 --- a/project starter code/node_modules/@jimp/plugin-displace/README.md +++ b/project starter code/node_modules/@jimp/plugin-displace/README.md @@ -14,10 +14,10 @@ Displaces the image based on the provided displacement map - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); // Make me better! image.displace(map, 10); diff --git a/project starter code/node_modules/@jimp/plugin-displace/dist/index.js b/project starter code/node_modules/@jimp/plugin-displace/dist/index.js index c5d30800..f698154b 100644 --- a/project starter code/node_modules/@jimp/plugin-displace/dist/index.js +++ b/project starter code/node_modules/@jimp/plugin-displace/dist/index.js @@ -1,16 +1,10 @@ "use strict"; -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - +exports.default = void 0; var _utils = require("@jimp/utils"); - /** * Displaces the image based on the provided displacement map * @param {object} map the source Jimp instance @@ -18,36 +12,30 @@ var _utils = require("@jimp/utils"); * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ -var _default = function _default() { - return { - displace: function displace(map, offset, cb) { - if ((0, _typeof2["default"])(map) !== 'object' || map.constructor !== this.constructor) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof offset !== 'number') { - return _utils.throwError.call(this, 'factor must be a number', cb); - } - - var source = this.cloneQuiet(); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var displacement = map.bitmap.data[idx] / 256 * offset; - displacement = Math.round(displacement); - var ids = this.getPixelIndex(x + displacement, y); - this.bitmap.data[ids] = source.bitmap.data[idx]; - this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1]; - this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2]; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; +var _default = () => ({ + displace(map, offset, cb) { + if (typeof map !== "object" || map.constructor !== this.constructor) { + return _utils.throwError.call(this, "The source must be a Jimp image", cb); } - }; -}; - -exports["default"] = _default; + if (typeof offset !== "number") { + return _utils.throwError.call(this, "factor must be a number", cb); + } + const source = this.cloneQuiet(); + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + let displacement = map.bitmap.data[idx] / 256 * offset; + displacement = Math.round(displacement); + const ids = this.getPixelIndex(x + displacement, y); + this.bitmap.data[ids] = source.bitmap.data[idx]; + this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1]; + this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2]; + }); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + } +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-displace/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-displace/dist/index.js.map index 4bf4208a..b34bbd4e 100644 --- a/project starter code/node_modules/@jimp/plugin-displace/dist/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-displace/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["displace","map","offset","cb","constructor","throwError","call","source","cloneQuiet","scanQuiet","bitmap","width","height","x","y","idx","displacement","data","Math","round","ids","getPixelIndex"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;;;;;;eAOe;AAAA,SAAO;AACpBA,IAAAA,QADoB,oBACXC,GADW,EACNC,MADM,EACEC,EADF,EACM;AACxB,UAAI,yBAAOF,GAAP,MAAe,QAAf,IAA2BA,GAAG,CAACG,WAAJ,KAAoB,KAAKA,WAAxD,EAAqE;AACnE,eAAOC,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,iCAAtB,EAAyDH,EAAzD,CAAP;AACD;;AAED,UAAI,OAAOD,MAAP,KAAkB,QAAtB,EAAgC;AAC9B,eAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDH,EAAjD,CAAP;AACD;;AAED,UAAMI,MAAM,GAAG,KAAKC,UAAL,EAAf;AACA,WAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKC,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,YAAIC,YAAY,GAAIf,GAAG,CAACS,MAAJ,CAAWO,IAAX,CAAgBF,GAAhB,IAAuB,GAAxB,GAA+Bb,MAAlD;AACAc,QAAAA,YAAY,GAAGE,IAAI,CAACC,KAAL,CAAWH,YAAX,CAAf;AAEA,YAAMI,GAAG,GAAG,KAAKC,aAAL,CAAmBR,CAAC,GAAGG,YAAvB,EAAqCF,CAArC,CAAZ;AACA,aAAKJ,MAAL,CAAYO,IAAZ,CAAiBG,GAAjB,IAAwBb,MAAM,CAACG,MAAP,CAAcO,IAAd,CAAmBF,GAAnB,CAAxB;AACA,aAAKL,MAAL,CAAYO,IAAZ,CAAiBG,GAAG,GAAG,CAAvB,IAA4Bb,MAAM,CAACG,MAAP,CAAcO,IAAd,CAAmBF,GAAG,GAAG,CAAzB,CAA5B;AACA,aAAKL,MAAL,CAAYO,IAAZ,CAAiBG,GAAG,GAAG,CAAvB,IAA4Bb,MAAM,CAACG,MAAP,CAAcO,IAAd,CAAmBF,GAAG,GAAG,CAAzB,CAA5B;AACD,OAZD;;AAcA,UAAI,0BAAcZ,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACG,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA9BmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Displaces the image based on the provided displacement map\n * @param {object} map the source Jimp instance\n * @param {number} offset the maximum displacement value\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n displace(map, offset, cb) {\n if (typeof map !== 'object' || map.constructor !== this.constructor) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof offset !== 'number') {\n return throwError.call(this, 'factor must be a number', cb);\n }\n\n const source = this.cloneQuiet();\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n let displacement = (map.bitmap.data[idx] / 256) * offset;\n displacement = Math.round(displacement);\n\n const ids = this.getPixelIndex(x + displacement, y);\n this.bitmap.data[ids] = source.bitmap.data[idx];\n this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1];\n this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["displace","map","offset","cb","constructor","throwError","call","source","cloneQuiet","scanQuiet","bitmap","width","height","x","y","idx","displacement","data","Math","round","ids","getPixelIndex","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Displaces the image based on the provided displacement map\n * @param {object} map the source Jimp instance\n * @param {number} offset the maximum displacement value\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n displace(map, offset, cb) {\n if (typeof map !== \"object\" || map.constructor !== this.constructor) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n\n if (typeof offset !== \"number\") {\n return throwError.call(this, \"factor must be a number\", cb);\n }\n\n const source = this.cloneQuiet();\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n let displacement = (map.bitmap.data[idx] / 256) * offset;\n displacement = Math.round(displacement);\n\n const ids = this.getPixelIndex(x + displacement, y);\n this.bitmap.data[ids] = source.bitmap.data[idx];\n this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1];\n this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2];\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AANA,eAOe,OAAO;EACpBA,QAAQ,CAACC,GAAG,EAAEC,MAAM,EAAEC,EAAE,EAAE;IACxB,IAAI,OAAOF,GAAG,KAAK,QAAQ,IAAIA,GAAG,CAACG,WAAW,KAAK,IAAI,CAACA,WAAW,EAAE;MACnE,OAAOC,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,iCAAiC,EAAEH,EAAE,CAAC;IACrE;IAEA,IAAI,OAAOD,MAAM,KAAK,QAAQ,EAAE;MAC9B,OAAOG,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAEH,EAAE,CAAC;IAC7D;IAEA,MAAMI,MAAM,GAAG,IAAI,CAACC,UAAU,EAAE;IAChC,IAAI,CAACC,SAAS,CACZ,CAAC,EACD,CAAC,EACD,IAAI,CAACC,MAAM,CAACC,KAAK,EACjB,IAAI,CAACD,MAAM,CAACE,MAAM,EAClB,UAAUC,CAAC,EAAEC,CAAC,EAAEC,GAAG,EAAE;MACnB,IAAIC,YAAY,GAAIf,GAAG,CAACS,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC,GAAG,GAAG,GAAIb,MAAM;MACxDc,YAAY,GAAGE,IAAI,CAACC,KAAK,CAACH,YAAY,CAAC;MAEvC,MAAMI,GAAG,GAAG,IAAI,CAACC,aAAa,CAACR,CAAC,GAAGG,YAAY,EAAEF,CAAC,CAAC;MACnD,IAAI,CAACJ,MAAM,CAACO,IAAI,CAACG,GAAG,CAAC,GAAGb,MAAM,CAACG,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC;MAC/C,IAAI,CAACL,MAAM,CAACO,IAAI,CAACG,GAAG,GAAG,CAAC,CAAC,GAAGb,MAAM,CAACG,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC;MACvD,IAAI,CAACL,MAAM,CAACO,IAAI,CAACG,GAAG,GAAG,CAAC,CAAC,GAAGb,MAAM,CAACG,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC;IACzD,CAAC,CACF;IAED,IAAI,IAAAO,oBAAa,EAACnB,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACG,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-displace/es/index.js b/project starter code/node_modules/@jimp/plugin-displace/es/index.js index b5e9d289..acdc290c 100644 --- a/project starter code/node_modules/@jimp/plugin-displace/es/index.js +++ b/project starter code/node_modules/@jimp/plugin-displace/es/index.js @@ -1,15 +1,4 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _utils = require("@jimp/utils"); +import { isNodePattern, throwError } from "@jimp/utils"; /** * Displaces the image based on the provided displacement map @@ -18,35 +7,27 @@ var _utils = require("@jimp/utils"); * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ -var _default = function _default() { - return { - displace: function displace(map, offset, cb) { - if ((0, _typeof2["default"])(map) !== 'object' || map.constructor !== this.constructor) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof offset !== 'number') { - return _utils.throwError.call(this, 'factor must be a number', cb); - } - - var source = this.cloneQuiet(); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var displacement = map.bitmap.data[idx] / 256 * offset; - displacement = Math.round(displacement); - var ids = this.getPixelIndex(x + displacement, y); - this.bitmap.data[ids] = source.bitmap.data[idx]; - this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1]; - this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2]; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; +export default (() => ({ + displace(map, offset, cb) { + if (typeof map !== "object" || map.constructor !== this.constructor) { + return throwError.call(this, "The source must be a Jimp image", cb); } - }; -}; - -exports["default"] = _default; + if (typeof offset !== "number") { + return throwError.call(this, "factor must be a number", cb); + } + const source = this.cloneQuiet(); + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + let displacement = map.bitmap.data[idx] / 256 * offset; + displacement = Math.round(displacement); + const ids = this.getPixelIndex(x + displacement, y); + this.bitmap.data[ids] = source.bitmap.data[idx]; + this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1]; + this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2]; + }); + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + } +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-displace/es/index.js.map b/project starter code/node_modules/@jimp/plugin-displace/es/index.js.map index 4bf4208a..3c4a069d 100644 --- a/project starter code/node_modules/@jimp/plugin-displace/es/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-displace/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["displace","map","offset","cb","constructor","throwError","call","source","cloneQuiet","scanQuiet","bitmap","width","height","x","y","idx","displacement","data","Math","round","ids","getPixelIndex"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;;;;;;eAOe;AAAA,SAAO;AACpBA,IAAAA,QADoB,oBACXC,GADW,EACNC,MADM,EACEC,EADF,EACM;AACxB,UAAI,yBAAOF,GAAP,MAAe,QAAf,IAA2BA,GAAG,CAACG,WAAJ,KAAoB,KAAKA,WAAxD,EAAqE;AACnE,eAAOC,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,iCAAtB,EAAyDH,EAAzD,CAAP;AACD;;AAED,UAAI,OAAOD,MAAP,KAAkB,QAAtB,EAAgC;AAC9B,eAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDH,EAAjD,CAAP;AACD;;AAED,UAAMI,MAAM,GAAG,KAAKC,UAAL,EAAf;AACA,WAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKC,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,YAAIC,YAAY,GAAIf,GAAG,CAACS,MAAJ,CAAWO,IAAX,CAAgBF,GAAhB,IAAuB,GAAxB,GAA+Bb,MAAlD;AACAc,QAAAA,YAAY,GAAGE,IAAI,CAACC,KAAL,CAAWH,YAAX,CAAf;AAEA,YAAMI,GAAG,GAAG,KAAKC,aAAL,CAAmBR,CAAC,GAAGG,YAAvB,EAAqCF,CAArC,CAAZ;AACA,aAAKJ,MAAL,CAAYO,IAAZ,CAAiBG,GAAjB,IAAwBb,MAAM,CAACG,MAAP,CAAcO,IAAd,CAAmBF,GAAnB,CAAxB;AACA,aAAKL,MAAL,CAAYO,IAAZ,CAAiBG,GAAG,GAAG,CAAvB,IAA4Bb,MAAM,CAACG,MAAP,CAAcO,IAAd,CAAmBF,GAAG,GAAG,CAAzB,CAA5B;AACA,aAAKL,MAAL,CAAYO,IAAZ,CAAiBG,GAAG,GAAG,CAAvB,IAA4Bb,MAAM,CAACG,MAAP,CAAcO,IAAd,CAAmBF,GAAG,GAAG,CAAzB,CAA5B;AACD,OAZD;;AAcA,UAAI,0BAAcZ,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACG,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA9BmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Displaces the image based on the provided displacement map\n * @param {object} map the source Jimp instance\n * @param {number} offset the maximum displacement value\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n displace(map, offset, cb) {\n if (typeof map !== 'object' || map.constructor !== this.constructor) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof offset !== 'number') {\n return throwError.call(this, 'factor must be a number', cb);\n }\n\n const source = this.cloneQuiet();\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n let displacement = (map.bitmap.data[idx] / 256) * offset;\n displacement = Math.round(displacement);\n\n const ids = this.getPixelIndex(x + displacement, y);\n this.bitmap.data[ids] = source.bitmap.data[idx];\n this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1];\n this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["isNodePattern","throwError","displace","map","offset","cb","constructor","call","source","cloneQuiet","scanQuiet","bitmap","width","height","x","y","idx","displacement","data","Math","round","ids","getPixelIndex"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Displaces the image based on the provided displacement map\n * @param {object} map the source Jimp instance\n * @param {number} offset the maximum displacement value\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n displace(map, offset, cb) {\n if (typeof map !== \"object\" || map.constructor !== this.constructor) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n\n if (typeof offset !== \"number\") {\n return throwError.call(this, \"factor must be a number\", cb);\n }\n\n const source = this.cloneQuiet();\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n let displacement = (map.bitmap.data[idx] / 256) * offset;\n displacement = Math.round(displacement);\n\n const ids = this.getPixelIndex(x + displacement, y);\n this.bitmap.data[ids] = source.bitmap.data[idx];\n this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1];\n this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2];\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;EACpBC,QAAQ,CAACC,GAAG,EAAEC,MAAM,EAAEC,EAAE,EAAE;IACxB,IAAI,OAAOF,GAAG,KAAK,QAAQ,IAAIA,GAAG,CAACG,WAAW,KAAK,IAAI,CAACA,WAAW,EAAE;MACnE,OAAOL,UAAU,CAACM,IAAI,CAAC,IAAI,EAAE,iCAAiC,EAAEF,EAAE,CAAC;IACrE;IAEA,IAAI,OAAOD,MAAM,KAAK,QAAQ,EAAE;MAC9B,OAAOH,UAAU,CAACM,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAEF,EAAE,CAAC;IAC7D;IAEA,MAAMG,MAAM,GAAG,IAAI,CAACC,UAAU,EAAE;IAChC,IAAI,CAACC,SAAS,CACZ,CAAC,EACD,CAAC,EACD,IAAI,CAACC,MAAM,CAACC,KAAK,EACjB,IAAI,CAACD,MAAM,CAACE,MAAM,EAClB,UAAUC,CAAC,EAAEC,CAAC,EAAEC,GAAG,EAAE;MACnB,IAAIC,YAAY,GAAId,GAAG,CAACQ,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC,GAAG,GAAG,GAAIZ,MAAM;MACxDa,YAAY,GAAGE,IAAI,CAACC,KAAK,CAACH,YAAY,CAAC;MAEvC,MAAMI,GAAG,GAAG,IAAI,CAACC,aAAa,CAACR,CAAC,GAAGG,YAAY,EAAEF,CAAC,CAAC;MACnD,IAAI,CAACJ,MAAM,CAACO,IAAI,CAACG,GAAG,CAAC,GAAGb,MAAM,CAACG,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC;MAC/C,IAAI,CAACL,MAAM,CAACO,IAAI,CAACG,GAAG,GAAG,CAAC,CAAC,GAAGb,MAAM,CAACG,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC;MACvD,IAAI,CAACL,MAAM,CAACO,IAAI,CAACG,GAAG,GAAG,CAAC,CAAC,GAAGb,MAAM,CAACG,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC;IACzD,CAAC,CACF;IAED,IAAIhB,aAAa,CAACK,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-displace/index.d.ts b/project starter code/node_modules/@jimp/plugin-displace/index.d.ts index d9f8652f..d2ea79bf 100644 --- a/project starter code/node_modules/@jimp/plugin-displace/index.d.ts +++ b/project starter code/node_modules/@jimp/plugin-displace/index.d.ts @@ -1,7 +1,7 @@ -import { Jimp, ImageCallback } from '@jimp/core'; +import { Jimp, ImageCallback } from "@jimp/core"; interface Displace { displace(map: Jimp, offset: number, cb?: ImageCallback): this; } -export default function(): Displace; +export default function (): Displace; diff --git a/project starter code/node_modules/@jimp/plugin-displace/package.json b/project starter code/node_modules/@jimp/plugin-displace/package.json index 2f273c69..3f4eaa1a 100644 --- a/project starter code/node_modules/@jimp/plugin-displace/package.json +++ b/project starter code/node_modules/@jimp/plugin-displace/package.json @@ -1,9 +1,10 @@ { "name": "@jimp/plugin-displace", - "version": "0.16.2", + "version": "0.22.12", "description": "displace an image.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { "build": "npm run build:node:production && npm run build:module", @@ -17,8 +18,7 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" @@ -26,5 +26,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/plugin-displace/src/index.js b/project starter code/node_modules/@jimp/plugin-displace/src/index.js index 0e5c5b5c..4dcd4403 100644 --- a/project starter code/node_modules/@jimp/plugin-displace/src/index.js +++ b/project starter code/node_modules/@jimp/plugin-displace/src/index.js @@ -1,4 +1,4 @@ -import { isNodePattern, throwError } from '@jimp/utils'; +import { isNodePattern, throwError } from "@jimp/utils"; /** * Displaces the image based on the provided displacement map @@ -9,33 +9,35 @@ import { isNodePattern, throwError } from '@jimp/utils'; */ export default () => ({ displace(map, offset, cb) { - if (typeof map !== 'object' || map.constructor !== this.constructor) { - return throwError.call(this, 'The source must be a Jimp image', cb); + if (typeof map !== "object" || map.constructor !== this.constructor) { + return throwError.call(this, "The source must be a Jimp image", cb); } - if (typeof offset !== 'number') { - return throwError.call(this, 'factor must be a number', cb); + if (typeof offset !== "number") { + return throwError.call(this, "factor must be a number", cb); } const source = this.cloneQuiet(); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - let displacement = (map.bitmap.data[idx] / 256) * offset; - displacement = Math.round(displacement); + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + let displacement = (map.bitmap.data[idx] / 256) * offset; + displacement = Math.round(displacement); - const ids = this.getPixelIndex(x + displacement, y); - this.bitmap.data[ids] = source.bitmap.data[idx]; - this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1]; - this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2]; - }); + const ids = this.getPixelIndex(x + displacement, y); + this.bitmap.data[ids] = source.bitmap.data[idx]; + this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1]; + this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2]; + } + ); if (isNodePattern(cb)) { cb.call(this, null, this); } return this; - } + }, }); diff --git a/project starter code/node_modules/@jimp/plugin-dither/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-dither/CHANGELOG.md index 26394e0f..8d029143 100644 --- a/project starter code/node_modules/@jimp/plugin-dither/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/plugin-dither/CHANGELOG.md @@ -1,3 +1,51 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -12,7 +60,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -20,4 +68,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-dither/README.md b/project starter code/node_modules/@jimp/plugin-dither/README.md index f578dc8f..b384599d 100644 --- a/project starter code/node_modules/@jimp/plugin-dither/README.md +++ b/project starter code/node_modules/@jimp/plugin-dither/README.md @@ -14,10 +14,10 @@ Apply a ordered dithering effect - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.dither565(); } diff --git a/project starter code/node_modules/@jimp/plugin-dither/dist/index.js b/project starter code/node_modules/@jimp/plugin-dither/dist/index.js index a4fc3cd8..ea11d97e 100644 --- a/project starter code/node_modules/@jimp/plugin-dither/dist/index.js +++ b/project starter code/node_modules/@jimp/plugin-dither/dist/index.js @@ -3,39 +3,32 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - +exports.default = void 0; var _utils = require("@jimp/utils"); - /** * Apply a ordered dithering effect * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ function dither(cb) { - var rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6]; + const rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6]; this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var thresholdId = ((y & 3) << 2) + x % 4; - var dither = rgb565Matrix[thresholdId]; + const thresholdId = ((y & 3) << 2) + x % 4; + const dither = rgb565Matrix[thresholdId]; this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff); this.bitmap.data[idx + 1] = Math.min(this.bitmap.data[idx + 1] + dither, 0xff); this.bitmap.data[idx + 2] = Math.min(this.bitmap.data[idx + 2] + dither, 0xff); }); - if ((0, _utils.isNodePattern)(cb)) { cb.call(this, null, this); } - return this; } - -var _default = function _default() { - return { - dither565: dither, - dither16: dither - }; -}; - -exports["default"] = _default; +var _default = () => ({ + dither565: dither, + dither16: dither +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-dither/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-dither/dist/index.js.map index 8e9cf9e3..50627c72 100644 --- a/project starter code/node_modules/@jimp/plugin-dither/dist/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-dither/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["dither","cb","rgb565Matrix","scanQuiet","bitmap","width","height","x","y","idx","thresholdId","data","Math","min","call","dither565","dither16"],"mappings":";;;;;;;AAAA;;AAEA;;;;;AAKA,SAASA,MAAT,CAAgBC,EAAhB,EAAoB;AAClB,MAAMC,YAAY,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,EAAV,EAAc,EAAd,EAAkB,CAAlB,EAAqB,EAArB,EAAyB,CAAzB,EAA4B,CAA5B,EAA+B,EAA/B,EAAmC,CAAnC,EAAsC,EAAtC,EAA0C,EAA1C,EAA8C,CAA9C,EAAiD,EAAjD,EAAqD,CAArD,CAArB;AACA,OAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKC,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,QAAMC,WAAW,GAAG,CAAC,CAACF,CAAC,GAAG,CAAL,KAAW,CAAZ,IAAkBD,CAAC,GAAG,CAA1C;AACA,QAAMP,MAAM,GAAGE,YAAY,CAACQ,WAAD,CAA3B;AACA,SAAKN,MAAL,CAAYO,IAAZ,CAAiBF,GAAjB,IAAwBG,IAAI,CAACC,GAAL,CAAS,KAAKT,MAAL,CAAYO,IAAZ,CAAiBF,GAAjB,IAAwBT,MAAjC,EAAyC,IAAzC,CAAxB;AACA,SAAKI,MAAL,CAAYO,IAAZ,CAAiBF,GAAG,GAAG,CAAvB,IAA4BG,IAAI,CAACC,GAAL,CAC1B,KAAKT,MAAL,CAAYO,IAAZ,CAAiBF,GAAG,GAAG,CAAvB,IAA4BT,MADF,EAE1B,IAF0B,CAA5B;AAIA,SAAKI,MAAL,CAAYO,IAAZ,CAAiBF,GAAG,GAAG,CAAvB,IAA4BG,IAAI,CAACC,GAAL,CAC1B,KAAKT,MAAL,CAAYO,IAAZ,CAAiBF,GAAG,GAAG,CAAvB,IAA4BT,MADF,EAE1B,IAF0B,CAA5B;AAID,GAhBD;;AAkBA,MAAI,0BAAcC,EAAd,CAAJ,EAAuB;AACrBA,IAAAA,EAAE,CAACa,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,SAAO,IAAP;AACD;;eAEc;AAAA,SAAO;AACpBC,IAAAA,SAAS,EAAEf,MADS;AAEpBgB,IAAAA,QAAQ,EAAEhB;AAFU,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Apply a ordered dithering effect\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction dither(cb) {\n const rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6];\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const thresholdId = ((y & 3) << 2) + (x % 4);\n const dither = rgb565Matrix[thresholdId];\n this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff);\n this.bitmap.data[idx + 1] = Math.min(\n this.bitmap.data[idx + 1] + dither,\n 0xff\n );\n this.bitmap.data[idx + 2] = Math.min(\n this.bitmap.data[idx + 2] + dither,\n 0xff\n );\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n dither565: dither,\n dither16: dither\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["dither","cb","rgb565Matrix","scanQuiet","bitmap","width","height","x","y","idx","thresholdId","data","Math","min","isNodePattern","call","dither565","dither16"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Apply a ordered dithering effect\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction dither(cb) {\n const rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6];\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const thresholdId = ((y & 3) << 2) + (x % 4);\n const dither = rgb565Matrix[thresholdId];\n this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff);\n this.bitmap.data[idx + 1] = Math.min(\n this.bitmap.data[idx + 1] + dither,\n 0xff\n );\n this.bitmap.data[idx + 2] = Math.min(\n this.bitmap.data[idx + 2] + dither,\n 0xff\n );\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n dither565: dither,\n dither16: dither,\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA,SAASA,MAAM,CAACC,EAAE,EAAE;EAClB,MAAMC,YAAY,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;EAC5E,IAAI,CAACC,SAAS,CACZ,CAAC,EACD,CAAC,EACD,IAAI,CAACC,MAAM,CAACC,KAAK,EACjB,IAAI,CAACD,MAAM,CAACE,MAAM,EAClB,UAAUC,CAAC,EAAEC,CAAC,EAAEC,GAAG,EAAE;IACnB,MAAMC,WAAW,GAAG,CAAC,CAACF,CAAC,GAAG,CAAC,KAAK,CAAC,IAAKD,CAAC,GAAG,CAAE;IAC5C,MAAMP,MAAM,GAAGE,YAAY,CAACQ,WAAW,CAAC;IACxC,IAAI,CAACN,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC,GAAGG,IAAI,CAACC,GAAG,CAAC,IAAI,CAACT,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC,GAAGT,MAAM,EAAE,IAAI,CAAC;IACtE,IAAI,CAACI,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC,GAAGG,IAAI,CAACC,GAAG,CAClC,IAAI,CAACT,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC,GAAGT,MAAM,EAClC,IAAI,CACL;IACD,IAAI,CAACI,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC,GAAGG,IAAI,CAACC,GAAG,CAClC,IAAI,CAACT,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC,GAAGT,MAAM,EAClC,IAAI,CACL;EACH,CAAC,CACF;EAED,IAAI,IAAAc,oBAAa,EAACb,EAAE,CAAC,EAAE;IACrBA,EAAE,CAACc,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;EAC3B;EAEA,OAAO,IAAI;AACb;AAAC,eAEc,OAAO;EACpBC,SAAS,EAAEhB,MAAM;EACjBiB,QAAQ,EAAEjB;AACZ,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-dither/es/index.js b/project starter code/node_modules/@jimp/plugin-dither/es/index.js index 17b6b6a7..0dcc1360 100644 --- a/project starter code/node_modules/@jimp/plugin-dither/es/index.js +++ b/project starter code/node_modules/@jimp/plugin-dither/es/index.js @@ -1,11 +1,4 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); +import { isNodePattern } from "@jimp/utils"; /** * Apply a ordered dithering effect @@ -13,28 +6,21 @@ var _utils = require("@jimp/utils"); * @returns {Jimp} this for chaining of methods */ function dither(cb) { - var rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6]; + const rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6]; this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var thresholdId = ((y & 3) << 2) + x % 4; - var dither = rgb565Matrix[thresholdId]; + const thresholdId = ((y & 3) << 2) + x % 4; + const dither = rgb565Matrix[thresholdId]; this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff); this.bitmap.data[idx + 1] = Math.min(this.bitmap.data[idx + 1] + dither, 0xff); this.bitmap.data[idx + 2] = Math.min(this.bitmap.data[idx + 2] + dither, 0xff); }); - - if ((0, _utils.isNodePattern)(cb)) { + if (isNodePattern(cb)) { cb.call(this, null, this); } - return this; } - -var _default = function _default() { - return { - dither565: dither, - dither16: dither - }; -}; - -exports["default"] = _default; +export default (() => ({ + dither565: dither, + dither16: dither +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-dither/es/index.js.map b/project starter code/node_modules/@jimp/plugin-dither/es/index.js.map index 8e9cf9e3..f3ec9697 100644 --- a/project starter code/node_modules/@jimp/plugin-dither/es/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-dither/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["dither","cb","rgb565Matrix","scanQuiet","bitmap","width","height","x","y","idx","thresholdId","data","Math","min","call","dither565","dither16"],"mappings":";;;;;;;AAAA;;AAEA;;;;;AAKA,SAASA,MAAT,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AAd,EAAoB,IAApB;AACD;;AAED,SAAO,IAAP;AACD;;eAEc;AAAA,SAAO;AACpBC,IAAAA,SAAS,EAAEf,MADS;AAEpBgB,IAAAA,QAAQ,EAAEhB;AAFU,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Apply a ordered dithering effect\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction dither(cb) {\n const rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6];\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const thresholdId = ((y & 3) << 2) + (x % 4);\n const dither = rgb565Matrix[thresholdId];\n this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff);\n this.bitmap.data[idx + 1] = Math.min(\n this.bitmap.data[idx + 1] + dither,\n 0xff\n );\n this.bitmap.data[idx + 2] = Math.min(\n this.bitmap.data[idx + 2] + dither,\n 0xff\n );\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n dither565: dither,\n dither16: dither\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["isNodePattern","dither","cb","rgb565Matrix","scanQuiet","bitmap","width","height","x","y","idx","thresholdId","data","Math","min","call","dither565","dither16"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Apply a ordered dithering effect\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction dither(cb) {\n const rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6];\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const thresholdId = ((y & 3) << 2) + (x % 4);\n const dither = rgb565Matrix[thresholdId];\n this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff);\n this.bitmap.data[idx + 1] = Math.min(\n this.bitmap.data[idx + 1] + dither,\n 0xff\n );\n this.bitmap.data[idx + 2] = Math.min(\n this.bitmap.data[idx + 2] + dither,\n 0xff\n );\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n dither565: dither,\n dither16: dither,\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,aAAa;;AAE3C;AACA;AACA;AACA;AACA;AACA,SAASC,MAAM,CAACC,EAAE,EAAE;EAClB,MAAMC,YAAY,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;EAC5E,IAAI,CAACC,SAAS,CACZ,CAAC,EACD,CAAC,EACD,IAAI,CAACC,MAAM,CAACC,KAAK,EACjB,IAAI,CAACD,MAAM,CAACE,MAAM,EAClB,UAAUC,CAAC,EAAEC,CAAC,EAAEC,GAAG,EAAE;IACnB,MAAMC,WAAW,GAAG,CAAC,CAACF,CAAC,GAAG,CAAC,KAAK,CAAC,IAAKD,CAAC,GAAG,CAAE;IAC5C,MAAMP,MAAM,GAAGE,YAAY,CAACQ,WAAW,CAAC;IACxC,IAAI,CAACN,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC,GAAGG,IAAI,CAACC,GAAG,CAAC,IAAI,CAACT,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC,GAAGT,MAAM,EAAE,IAAI,CAAC;IACtE,IAAI,CAACI,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC,GAAGG,IAAI,CAACC,GAAG,CAClC,IAAI,CAACT,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC,GAAGT,MAAM,EAClC,IAAI,CACL;IACD,IAAI,CAACI,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC,GAAGG,IAAI,CAACC,GAAG,CAClC,IAAI,CAACT,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC,GAAGT,MAAM,EAClC,IAAI,CACL;EACH,CAAC,CACF;EAED,IAAID,aAAa,CAACE,EAAE,CAAC,EAAE;IACrBA,EAAE,CAACa,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;EAC3B;EAEA,OAAO,IAAI;AACb;AAEA,gBAAe,OAAO;EACpBC,SAAS,EAAEf,MAAM;EACjBgB,QAAQ,EAAEhB;AACZ,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-dither/index.d.ts b/project starter code/node_modules/@jimp/plugin-dither/index.d.ts index 5b00858c..9f2415df 100644 --- a/project starter code/node_modules/@jimp/plugin-dither/index.d.ts +++ b/project starter code/node_modules/@jimp/plugin-dither/index.d.ts @@ -1,8 +1,8 @@ -import { ImageCallback } from '@jimp/core'; +import { ImageCallback } from "@jimp/core"; interface Dither { dither565(cb?: ImageCallback): this; dither16(cb?: ImageCallback): this; } -export default function(): Dither; +export default function (): Dither; diff --git a/project starter code/node_modules/@jimp/plugin-dither/package.json b/project starter code/node_modules/@jimp/plugin-dither/package.json index 20abf485..0f65daff 100644 --- a/project starter code/node_modules/@jimp/plugin-dither/package.json +++ b/project starter code/node_modules/@jimp/plugin-dither/package.json @@ -1,9 +1,10 @@ { "name": "@jimp/plugin-dither", - "version": "0.16.2", + "version": "0.22.12", "description": "Dither an image.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { "build": "npm run build:node:production && npm run build:module", @@ -17,8 +18,7 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" @@ -26,5 +26,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/plugin-dither/src/index.js b/project starter code/node_modules/@jimp/plugin-dither/src/index.js index 59019faa..c5ce9ece 100644 --- a/project starter code/node_modules/@jimp/plugin-dither/src/index.js +++ b/project starter code/node_modules/@jimp/plugin-dither/src/index.js @@ -1,4 +1,4 @@ -import { isNodePattern } from '@jimp/utils'; +import { isNodePattern } from "@jimp/utils"; /** * Apply a ordered dithering effect @@ -7,23 +7,25 @@ import { isNodePattern } from '@jimp/utils'; */ function dither(cb) { const rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6]; - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - const thresholdId = ((y & 3) << 2) + (x % 4); - const dither = rgb565Matrix[thresholdId]; - this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff); - this.bitmap.data[idx + 1] = Math.min( - this.bitmap.data[idx + 1] + dither, - 0xff - ); - this.bitmap.data[idx + 2] = Math.min( - this.bitmap.data[idx + 2] + dither, - 0xff - ); - }); + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + const thresholdId = ((y & 3) << 2) + (x % 4); + const dither = rgb565Matrix[thresholdId]; + this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff); + this.bitmap.data[idx + 1] = Math.min( + this.bitmap.data[idx + 1] + dither, + 0xff + ); + this.bitmap.data[idx + 2] = Math.min( + this.bitmap.data[idx + 2] + dither, + 0xff + ); + } + ); if (isNodePattern(cb)) { cb.call(this, null, this); @@ -34,5 +36,5 @@ function dither(cb) { export default () => ({ dither565: dither, - dither16: dither + dither16: dither, }); diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-fisheye/CHANGELOG.md index 25346d5c..a3763830 100644 --- a/project starter code/node_modules/@jimp/plugin-fisheye/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/plugin-fisheye/CHANGELOG.md @@ -1,3 +1,65 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.22.0 (Mon Feb 06 2023) + +#### 🏠 Internal + +- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Daniel Holmes ([@danielholmes](https://github.com/danielholmes)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.16.2 (Thu Sep 15 2022) #### 📝 Documentation @@ -24,7 +86,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -32,4 +94,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/README.md b/project starter code/node_modules/@jimp/plugin-fisheye/README.md index 97a86b6a..3a1ae13c 100644 --- a/project starter code/node_modules/@jimp/plugin-fisheye/README.md +++ b/project starter code/node_modules/@jimp/plugin-fisheye/README.md @@ -11,10 +11,10 @@ - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.fisheye(); // or diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/babel.config.js b/project starter code/node_modules/@jimp/plugin-fisheye/babel.config.js index 60a6d805..13e2603a 100644 --- a/project starter code/node_modules/@jimp/plugin-fisheye/babel.config.js +++ b/project starter code/node_modules/@jimp/plugin-fisheye/babel.config.js @@ -1,38 +1,38 @@ -module.exports = api => { +module.exports = (api) => { api.cache(true); return { presets: [ [ - '@babel/env', + "@babel/env", { - useBuiltIns: 'usage' - } - ] + useBuiltIns: "usage", + }, + ], ], plugins: [ - '@babel/proposal-class-properties', - '@babel/syntax-object-rest-spread', - process.env.BABEL_ENV !== 'module' && 'add-module-exports', + "@babel/proposal-class-properties", + "@babel/syntax-object-rest-spread", + process.env.BABEL_ENV !== "module" && "add-module-exports", [ - 'transform-inline-environment-variables', - { include: ['BABEL_ENV', 'ENV'] } - ] + "transform-inline-environment-variables", + { include: ["BABEL_ENV", "ENV"] }, + ], ].filter(Boolean), env: { test: { - plugins: ['istanbul'] + plugins: ["istanbul"], }, development: { - plugins: [process.env.ENV !== 'browser' && 'source-map-support'].filter( + plugins: [process.env.ENV !== "browser" && "source-map-support"].filter( Boolean - ) + ), }, module: { - presets: [['@babel/env', { modules: false }]] - } - } + presets: [["@babel/env", { modules: false }]], + }, + }, }; }; diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/dist/index.js b/project starter code/node_modules/@jimp/plugin-fisheye/dist/index.js index 82e4d8c2..ef9cecd5 100644 --- a/project starter code/node_modules/@jimp/plugin-fisheye/dist/index.js +++ b/project starter code/node_modules/@jimp/plugin-fisheye/dist/index.js @@ -3,63 +3,53 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - +exports.default = void 0; var _utils = require("@jimp/utils"); - /** * Creates a circle out of an image. * @param {object} options (optional) r: radius of effect * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ -var _default = function _default() { - return { - fisheye: function fisheye() { - var _this = this; - - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { +var _default = () => ({ + fisheye() { + let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { + r: 2.5 + }; + let cb = arguments.length > 1 ? arguments[1] : undefined; + if (typeof options === "function") { + cb = options; + options = { r: 2.5 }; - var cb = arguments.length > 1 ? arguments[1] : undefined; - - if (typeof options === 'function') { - cb = options; - options = { - r: 2.5 - }; - } - - var source = this.cloneQuiet(); - var _source$bitmap = source.bitmap, - width = _source$bitmap.width, - height = _source$bitmap.height; - source.scanQuiet(0, 0, width, height, function (x, y) { - var hx = x / width; - var hy = y / height; - var r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2)); - var rn = 2 * Math.pow(r, options.r); - var cosA = (hx - 0.5) / r; - var sinA = (hy - 0.5) / r; - var newX = Math.round((rn * cosA + 0.5) * width); - var newY = Math.round((rn * sinA + 0.5) * height); - var color = source.getPixelColor(newX, newY); - - _this.setPixelColor(color, x, y); - }); - /* Set center pixel color, otherwise it will be transparent */ - - this.setPixelColor(source.getPixelColor(width / 2, height / 2), width / 2, height / 2); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; } - }; -}; - -exports["default"] = _default; + const source = this.cloneQuiet(); + const { + width, + height + } = source.bitmap; + source.scanQuiet(0, 0, width, height, (x, y) => { + const hx = x / width; + const hy = y / height; + const r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2)); + const rn = 2 * Math.pow(r, options.r); + const cosA = (hx - 0.5) / r; + const sinA = (hy - 0.5) / r; + const newX = Math.round((rn * cosA + 0.5) * width); + const newY = Math.round((rn * sinA + 0.5) * height); + const color = source.getPixelColor(newX, newY); + this.setPixelColor(color, x, y); + }); + + /* Set center pixel color, otherwise it will be transparent */ + this.setPixelColor(source.getPixelColor(width / 2, height / 2), width / 2, height / 2); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + } +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-fisheye/dist/index.js.map index e31c3f43..5b934ad4 100644 --- a/project starter code/node_modules/@jimp/plugin-fisheye/dist/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-fisheye/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["fisheye","options","r","cb","source","cloneQuiet","bitmap","width","height","scanQuiet","x","y","hx","hy","Math","sqrt","pow","rn","cosA","sinA","newX","round","newY","color","getPixelColor","setPixelColor","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;eAMe;AAAA,SAAO;AACpBA,IAAAA,OADoB,qBACc;AAAA;;AAAA,UAA1BC,OAA0B,uEAAhB;AAAEC,QAAAA,CAAC,EAAE;AAAL,OAAgB;AAAA,UAAJC,EAAI;;AAChC,UAAI,OAAOF,OAAP,KAAmB,UAAvB,EAAmC;AACjCE,QAAAA,EAAE,GAAGF,OAAL;AACAA,QAAAA,OAAO,GAAG;AAAEC,UAAAA,CAAC,EAAE;AAAL,SAAV;AACD;;AAED,UAAME,MAAM,GAAG,KAAKC,UAAL,EAAf;AANgC,2BAOND,MAAM,CAACE,MAPD;AAAA,UAOxBC,KAPwB,kBAOxBA,KAPwB;AAAA,UAOjBC,MAPiB,kBAOjBA,MAPiB;AAShCJ,MAAAA,MAAM,CAACK,SAAP,CAAiB,CAAjB,EAAoB,CAApB,EAAuBF,KAAvB,EAA8BC,MAA9B,EAAsC,UAACE,CAAD,EAAIC,CAAJ,EAAU;AAC9C,YAAMC,EAAE,GAAGF,CAAC,GAAGH,KAAf;AACA,YAAMM,EAAE,GAAGF,CAAC,GAAGH,MAAf;AACA,YAAMN,CAAC,GAAGY,IAAI,CAACC,IAAL,CAAUD,IAAI,CAACE,GAAL,CAASJ,EAAE,GAAG,GAAd,EAAmB,CAAnB,IAAwBE,IAAI,CAACE,GAAL,CAASH,EAAE,GAAG,GAAd,EAAmB,CAAnB,CAAlC,CAAV;AACA,YAAMI,EAAE,GAAG,IAAIH,IAAI,CAACE,GAAL,CAASd,CAAT,EAAYD,OAAO,CAACC,CAApB,CAAf;AACA,YAAMgB,IAAI,GAAG,CAACN,EAAE,GAAG,GAAN,IAAaV,CAA1B;AACA,YAAMiB,IAAI,GAAG,CAACN,EAAE,GAAG,GAAN,IAAaX,CAA1B;AACA,YAAMkB,IAAI,GAAGN,IAAI,CAACO,KAAL,CAAW,CAACJ,EAAE,GAAGC,IAAL,GAAY,GAAb,IAAoBX,KAA/B,CAAb;AACA,YAAMe,IAAI,GAAGR,IAAI,CAACO,KAAL,CAAW,CAACJ,EAAE,GAAGE,IAAL,GAAY,GAAb,IAAoBX,MAA/B,CAAb;AACA,YAAMe,KAAK,GAAGnB,MAAM,CAACoB,aAAP,CAAqBJ,IAArB,EAA2BE,IAA3B,CAAd;;AAEA,QAAA,KAAI,CAACG,aAAL,CAAmBF,KAAnB,EAA0Bb,CAA1B,EAA6BC,CAA7B;AACD,OAZD;AAcA;;AACA,WAAKc,aAAL,CACErB,MAAM,CAACoB,aAAP,CAAqBjB,KAAK,GAAG,CAA7B,EAAgCC,MAAM,GAAG,CAAzC,CADF,EAEED,KAAK,GAAG,CAFV,EAGEC,MAAM,GAAG,CAHX;;AAMA,UAAI,0BAAcL,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACuB,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AApCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Creates a circle out of an image.\n * @param {object} options (optional) r: radius of effect\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n fisheye(options = { r: 2.5 }, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = { r: 2.5 };\n }\n\n const source = this.cloneQuiet();\n const { width, height } = source.bitmap;\n\n source.scanQuiet(0, 0, width, height, (x, y) => {\n const hx = x / width;\n const hy = y / height;\n const r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2));\n const rn = 2 * Math.pow(r, options.r);\n const cosA = (hx - 0.5) / r;\n const sinA = (hy - 0.5) / r;\n const newX = Math.round((rn * cosA + 0.5) * width);\n const newY = Math.round((rn * sinA + 0.5) * height);\n const color = source.getPixelColor(newX, newY);\n\n this.setPixelColor(color, x, y);\n });\n\n /* Set center pixel color, otherwise it will be transparent */\n this.setPixelColor(\n source.getPixelColor(width / 2, height / 2),\n width / 2,\n height / 2\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["fisheye","options","r","cb","source","cloneQuiet","width","height","bitmap","scanQuiet","x","y","hx","hy","Math","sqrt","pow","rn","cosA","sinA","newX","round","newY","color","getPixelColor","setPixelColor","isNodePattern","call"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Creates a circle out of an image.\n * @param {object} options (optional) r: radius of effect\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n fisheye(options = { r: 2.5 }, cb) {\n if (typeof options === \"function\") {\n cb = options;\n options = { r: 2.5 };\n }\n\n const source = this.cloneQuiet();\n const { width, height } = source.bitmap;\n\n source.scanQuiet(0, 0, width, height, (x, y) => {\n const hx = x / width;\n const hy = y / height;\n const r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2));\n const rn = 2 * Math.pow(r, options.r);\n const cosA = (hx - 0.5) / r;\n const sinA = (hy - 0.5) / r;\n const newX = Math.round((rn * cosA + 0.5) * width);\n const newY = Math.round((rn * sinA + 0.5) * height);\n const color = source.getPixelColor(newX, newY);\n\n this.setPixelColor(color, x, y);\n });\n\n /* Set center pixel color, otherwise it will be transparent */\n this.setPixelColor(\n source.getPixelColor(width / 2, height / 2),\n width / 2,\n height / 2\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AALA,eAMe,OAAO;EACpBA,OAAO,GAA2B;IAAA,IAA1BC,OAAO,uEAAG;MAAEC,CAAC,EAAE;IAAI,CAAC;IAAA,IAAEC,EAAE;IAC9B,IAAI,OAAOF,OAAO,KAAK,UAAU,EAAE;MACjCE,EAAE,GAAGF,OAAO;MACZA,OAAO,GAAG;QAAEC,CAAC,EAAE;MAAI,CAAC;IACtB;IAEA,MAAME,MAAM,GAAG,IAAI,CAACC,UAAU,EAAE;IAChC,MAAM;MAAEC,KAAK;MAAEC;IAAO,CAAC,GAAGH,MAAM,CAACI,MAAM;IAEvCJ,MAAM,CAACK,SAAS,CAAC,CAAC,EAAE,CAAC,EAAEH,KAAK,EAAEC,MAAM,EAAE,CAACG,CAAC,EAAEC,CAAC,KAAK;MAC9C,MAAMC,EAAE,GAAGF,CAAC,GAAGJ,KAAK;MACpB,MAAMO,EAAE,GAAGF,CAAC,GAAGJ,MAAM;MACrB,MAAML,CAAC,GAAGY,IAAI,CAACC,IAAI,CAACD,IAAI,CAACE,GAAG,CAACJ,EAAE,GAAG,GAAG,EAAE,CAAC,CAAC,GAAGE,IAAI,CAACE,GAAG,CAACH,EAAE,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;MAClE,MAAMI,EAAE,GAAG,CAAC,GAAGH,IAAI,CAACE,GAAG,CAACd,CAAC,EAAED,OAAO,CAACC,CAAC,CAAC;MACrC,MAAMgB,IAAI,GAAG,CAACN,EAAE,GAAG,GAAG,IAAIV,CAAC;MAC3B,MAAMiB,IAAI,GAAG,CAACN,EAAE,GAAG,GAAG,IAAIX,CAAC;MAC3B,MAAMkB,IAAI,GAAGN,IAAI,CAACO,KAAK,CAAC,CAACJ,EAAE,GAAGC,IAAI,GAAG,GAAG,IAAIZ,KAAK,CAAC;MAClD,MAAMgB,IAAI,GAAGR,IAAI,CAACO,KAAK,CAAC,CAACJ,EAAE,GAAGE,IAAI,GAAG,GAAG,IAAIZ,MAAM,CAAC;MACnD,MAAMgB,KAAK,GAAGnB,MAAM,CAACoB,aAAa,CAACJ,IAAI,EAAEE,IAAI,CAAC;MAE9C,IAAI,CAACG,aAAa,CAACF,KAAK,EAAEb,CAAC,EAAEC,CAAC,CAAC;IACjC,CAAC,CAAC;;IAEF;IACA,IAAI,CAACc,aAAa,CAChBrB,MAAM,CAACoB,aAAa,CAAClB,KAAK,GAAG,CAAC,EAAEC,MAAM,GAAG,CAAC,CAAC,EAC3CD,KAAK,GAAG,CAAC,EACTC,MAAM,GAAG,CAAC,CACX;IAED,IAAI,IAAAmB,oBAAa,EAACvB,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACwB,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/es/index.js b/project starter code/node_modules/@jimp/plugin-fisheye/es/index.js index 71ff0b9d..f50b9458 100644 --- a/project starter code/node_modules/@jimp/plugin-fisheye/es/index.js +++ b/project starter code/node_modules/@jimp/plugin-fisheye/es/index.js @@ -1,11 +1,4 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); +import { isNodePattern } from "@jimp/utils"; /** * Creates a circle out of an image. @@ -13,52 +6,42 @@ var _utils = require("@jimp/utils"); * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ -var _default = function _default() { - return { - fisheye: function fisheye() { - var _this = this; - - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { +export default (() => ({ + fisheye() { + let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { + r: 2.5 + }; + let cb = arguments.length > 1 ? arguments[1] : undefined; + if (typeof options === "function") { + cb = options; + options = { r: 2.5 }; - var cb = arguments.length > 1 ? arguments[1] : undefined; - - if (typeof options === 'function') { - cb = options; - options = { - r: 2.5 - }; - } - - var source = this.cloneQuiet(); - var _source$bitmap = source.bitmap, - width = _source$bitmap.width, - height = _source$bitmap.height; - source.scanQuiet(0, 0, width, height, function (x, y) { - var hx = x / width; - var hy = y / height; - var r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2)); - var rn = 2 * Math.pow(r, options.r); - var cosA = (hx - 0.5) / r; - var sinA = (hy - 0.5) / r; - var newX = Math.round((rn * cosA + 0.5) * width); - var newY = Math.round((rn * sinA + 0.5) * height); - var color = source.getPixelColor(newX, newY); - - _this.setPixelColor(color, x, y); - }); - /* Set center pixel color, otherwise it will be transparent */ - - this.setPixelColor(source.getPixelColor(width / 2, height / 2), width / 2, height / 2); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; } - }; -}; - -exports["default"] = _default; + const source = this.cloneQuiet(); + const { + width, + height + } = source.bitmap; + source.scanQuiet(0, 0, width, height, (x, y) => { + const hx = x / width; + const hy = y / height; + const r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2)); + const rn = 2 * Math.pow(r, options.r); + const cosA = (hx - 0.5) / r; + const sinA = (hy - 0.5) / r; + const newX = Math.round((rn * cosA + 0.5) * width); + const newY = Math.round((rn * sinA + 0.5) * height); + const color = source.getPixelColor(newX, newY); + this.setPixelColor(color, x, y); + }); + + /* Set center pixel color, otherwise it will be transparent */ + this.setPixelColor(source.getPixelColor(width / 2, height / 2), width / 2, height / 2); + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + } +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/es/index.js.map b/project starter code/node_modules/@jimp/plugin-fisheye/es/index.js.map index e31c3f43..19b713df 100644 --- a/project starter code/node_modules/@jimp/plugin-fisheye/es/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-fisheye/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["fisheye","options","r","cb","source","cloneQuiet","bitmap","width","height","scanQuiet","x","y","hx","hy","Math","sqrt","pow","rn","cosA","sinA","newX","round","newY","color","getPixelColor","setPixelColor","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;eAMe;AAAA,SAAO;AACpBA,IAAAA,OADoB,qBACc;AAAA;;AAAA,UAA1BC,OAA0B,uEAAhB;AAAEC,QAAAA,CAAC,EAAE;AAAL,OAAgB;AAAA,UAAJC,EAAI;;AAChC,UAAI,OAAOF,OAAP,KAAmB,UAAvB,EAAmC;AACjCE,QAAAA,EAAE,GAAGF,OAAL;AACAA,QAAAA,OAAO,GAAG;AAAEC,UAAAA,CAAC,EAAE;AAAL,SAAV;AACD;;AAED,UAAME,MAAM,GAAG,KAAKC,UAAL,EAAf;AANgC,2BAOND,MAAM,CAACE,MAPD;AAAA,UAOxBC,KAPwB,kBAOxBA,KAPwB;AAAA,UAOjBC,MAPiB,kBAOjBA,MAPiB;AAShCJ,MAAAA,MAAM,CAACK,SAAP,CAAiB,CAAjB,EAAoB,CAApB,EAAuBF,KAAvB,EAA8BC,MAA9B,EAAsC,UAACE,CAAD,EAAIC,CAAJ,EAAU;AAC9C,YAAMC,EAAE,GAAGF,CAAC,GAAGH,KAAf;AACA,YAAMM,EAAE,GAAGF,CAAC,GAAGH,MAAf;AACA,YAAMN,CAAC,GAAGY,IAAI,CAACC,IAAL,CAAUD,IAAI,CAACE,GAAL,CAASJ,EAAE,GAAG,GAAd,EAAmB,CAAnB,IAAwBE,IAAI,CAACE,GAAL,CAASH,EAAE,GAAG,GAAd,EAAmB,CAAnB,CAAlC,CAAV;AACA,YAAMI,EAAE,GAAG,IAAIH,IAAI,CAACE,GAAL,CAASd,CAAT,EAAYD,OAAO,CAACC,CAApB,CAAf;AACA,YAAMgB,IAAI,GAAG,CAACN,EAAE,GAAG,GAAN,IAAaV,CAA1B;AACA,YAAMiB,IAAI,GAAG,CAACN,EAAE,GAAG,GAAN,IAAaX,CAA1B;AACA,YAAMkB,IAAI,GAAGN,IAAI,CAACO,KAAL,CAAW,CAACJ,EAAE,GAAGC,IAAL,GAAY,GAAb,IAAoBX,KAA/B,CAAb;AACA,YAAMe,IAAI,GAAGR,IAAI,CAACO,KAAL,CAAW,CAACJ,EAAE,GAAGE,IAAL,GAAY,GAAb,IAAoBX,MAA/B,CAAb;AACA,YAAMe,KAAK,GAAGnB,MAAM,CAACoB,aAAP,CAAqBJ,IAArB,EAA2BE,IAA3B,CAAd;;AAEA,QAAA,KAAI,CAACG,aAAL,CAAmBF,KAAnB,EAA0Bb,CAA1B,EAA6BC,CAA7B;AACD,OAZD;AAcA;;AACA,WAAKc,aAAL,CACErB,MAAM,CAACoB,aAAP,CAAqBjB,KAAK,GAAG,CAA7B,EAAgCC,MAAM,GAAG,CAAzC,CADF,EAEED,KAAK,GAAG,CAFV,EAGEC,MAAM,GAAG,CAHX;;AAMA,UAAI,0BAAcL,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACuB,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AApCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Creates a circle out of an image.\n * @param {object} options (optional) r: radius of effect\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n fisheye(options = { r: 2.5 }, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = { r: 2.5 };\n }\n\n const source = this.cloneQuiet();\n const { width, height } = source.bitmap;\n\n source.scanQuiet(0, 0, width, height, (x, y) => {\n const hx = x / width;\n const hy = y / height;\n const r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2));\n const rn = 2 * Math.pow(r, options.r);\n const cosA = (hx - 0.5) / r;\n const sinA = (hy - 0.5) / r;\n const newX = Math.round((rn * cosA + 0.5) * width);\n const newY = Math.round((rn * sinA + 0.5) * height);\n const color = source.getPixelColor(newX, newY);\n\n this.setPixelColor(color, x, y);\n });\n\n /* Set center pixel color, otherwise it will be transparent */\n this.setPixelColor(\n source.getPixelColor(width / 2, height / 2),\n width / 2,\n height / 2\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["isNodePattern","fisheye","options","r","cb","source","cloneQuiet","width","height","bitmap","scanQuiet","x","y","hx","hy","Math","sqrt","pow","rn","cosA","sinA","newX","round","newY","color","getPixelColor","setPixelColor","call"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Creates a circle out of an image.\n * @param {object} options (optional) r: radius of effect\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n fisheye(options = { r: 2.5 }, cb) {\n if (typeof options === \"function\") {\n cb = options;\n options = { r: 2.5 };\n }\n\n const source = this.cloneQuiet();\n const { width, height } = source.bitmap;\n\n source.scanQuiet(0, 0, width, height, (x, y) => {\n const hx = x / width;\n const hy = y / height;\n const r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2));\n const rn = 2 * Math.pow(r, options.r);\n const cosA = (hx - 0.5) / r;\n const sinA = (hy - 0.5) / r;\n const newX = Math.round((rn * cosA + 0.5) * width);\n const newY = Math.round((rn * sinA + 0.5) * height);\n const color = source.getPixelColor(newX, newY);\n\n this.setPixelColor(color, x, y);\n });\n\n /* Set center pixel color, otherwise it will be transparent */\n this.setPixelColor(\n source.getPixelColor(width / 2, height / 2),\n width / 2,\n height / 2\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,aAAa;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;EACpBC,OAAO,GAA2B;IAAA,IAA1BC,OAAO,uEAAG;MAAEC,CAAC,EAAE;IAAI,CAAC;IAAA,IAAEC,EAAE;IAC9B,IAAI,OAAOF,OAAO,KAAK,UAAU,EAAE;MACjCE,EAAE,GAAGF,OAAO;MACZA,OAAO,GAAG;QAAEC,CAAC,EAAE;MAAI,CAAC;IACtB;IAEA,MAAME,MAAM,GAAG,IAAI,CAACC,UAAU,EAAE;IAChC,MAAM;MAAEC,KAAK;MAAEC;IAAO,CAAC,GAAGH,MAAM,CAACI,MAAM;IAEvCJ,MAAM,CAACK,SAAS,CAAC,CAAC,EAAE,CAAC,EAAEH,KAAK,EAAEC,MAAM,EAAE,CAACG,CAAC,EAAEC,CAAC,KAAK;MAC9C,MAAMC,EAAE,GAAGF,CAAC,GAAGJ,KAAK;MACpB,MAAMO,EAAE,GAAGF,CAAC,GAAGJ,MAAM;MACrB,MAAML,CAAC,GAAGY,IAAI,CAACC,IAAI,CAACD,IAAI,CAACE,GAAG,CAACJ,EAAE,GAAG,GAAG,EAAE,CAAC,CAAC,GAAGE,IAAI,CAACE,GAAG,CAACH,EAAE,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;MAClE,MAAMI,EAAE,GAAG,CAAC,GAAGH,IAAI,CAACE,GAAG,CAACd,CAAC,EAAED,OAAO,CAACC,CAAC,CAAC;MACrC,MAAMgB,IAAI,GAAG,CAACN,EAAE,GAAG,GAAG,IAAIV,CAAC;MAC3B,MAAMiB,IAAI,GAAG,CAACN,EAAE,GAAG,GAAG,IAAIX,CAAC;MAC3B,MAAMkB,IAAI,GAAGN,IAAI,CAACO,KAAK,CAAC,CAACJ,EAAE,GAAGC,IAAI,GAAG,GAAG,IAAIZ,KAAK,CAAC;MAClD,MAAMgB,IAAI,GAAGR,IAAI,CAACO,KAAK,CAAC,CAACJ,EAAE,GAAGE,IAAI,GAAG,GAAG,IAAIZ,MAAM,CAAC;MACnD,MAAMgB,KAAK,GAAGnB,MAAM,CAACoB,aAAa,CAACJ,IAAI,EAAEE,IAAI,CAAC;MAE9C,IAAI,CAACG,aAAa,CAACF,KAAK,EAAEb,CAAC,EAAEC,CAAC,CAAC;IACjC,CAAC,CAAC;;IAEF;IACA,IAAI,CAACc,aAAa,CAChBrB,MAAM,CAACoB,aAAa,CAAClB,KAAK,GAAG,CAAC,EAAEC,MAAM,GAAG,CAAC,CAAC,EAC3CD,KAAK,GAAG,CAAC,EACTC,MAAM,GAAG,CAAC,CACX;IAED,IAAIR,aAAa,CAACI,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACuB,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/index.d.ts b/project starter code/node_modules/@jimp/plugin-fisheye/index.d.ts index d8140192..693b6f33 100644 --- a/project starter code/node_modules/@jimp/plugin-fisheye/index.d.ts +++ b/project starter code/node_modules/@jimp/plugin-fisheye/index.d.ts @@ -1,8 +1,8 @@ -import { ImageCallback } from '@jimp/core'; +import { ImageCallback } from "@jimp/core"; interface Fisheye { fishEye(opts?: { r: number }, cb?: ImageCallback): this; fishEye(cb?: ImageCallback): this; } -export default function(): Fisheye; +export default function (): Fisheye; diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/package.json b/project starter code/node_modules/@jimp/plugin-fisheye/package.json index b461826e..53e8d7c8 100644 --- a/project starter code/node_modules/@jimp/plugin-fisheye/package.json +++ b/project starter code/node_modules/@jimp/plugin-fisheye/package.json @@ -1,12 +1,13 @@ { "name": "@jimp/plugin-fisheye", - "version": "0.16.2", + "version": "0.22.12", "description": "Apply a fisheye effect to an image.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js", "test:watch": "npm run test -- --reporter min --watch", "test:coverage": "nyc npm run test", "build": "npm run build:node:production && npm run build:module", @@ -20,18 +21,17 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" }, "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/test-utils": "^0.16.2" + "@jimp/custom": "^0.22.12", + "@jimp/test-utils": "^0.22.12" }, "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/src/index.js b/project starter code/node_modules/@jimp/plugin-fisheye/src/index.js index 33aeb10d..15c5b51d 100644 --- a/project starter code/node_modules/@jimp/plugin-fisheye/src/index.js +++ b/project starter code/node_modules/@jimp/plugin-fisheye/src/index.js @@ -1,4 +1,4 @@ -import { isNodePattern } from '@jimp/utils'; +import { isNodePattern } from "@jimp/utils"; /** * Creates a circle out of an image. @@ -8,7 +8,7 @@ import { isNodePattern } from '@jimp/utils'; */ export default () => ({ fisheye(options = { r: 2.5 }, cb) { - if (typeof options === 'function') { + if (typeof options === "function") { cb = options; options = { r: 2.5 }; } @@ -42,5 +42,5 @@ export default () => ({ } return this; - } + }, }); diff --git a/project starter code/node_modules/@jimp/plugin-fisheye/test/fisheye.test.js b/project starter code/node_modules/@jimp/plugin-fisheye/test/fisheye.test.js index 8c37b771..537b4f45 100644 --- a/project starter code/node_modules/@jimp/plugin-fisheye/test/fisheye.test.js +++ b/project starter code/node_modules/@jimp/plugin-fisheye/test/fisheye.test.js @@ -1,80 +1,78 @@ -import { Jimp, mkJGD } from '@jimp/test-utils'; -import configure from '@jimp/custom'; +import { Jimp, mkJGD } from "@jimp/test-utils"; +import configure from "@jimp/custom"; -import fisheye from '../src'; +import fisheye from "../src"; +import { expectToBeJGD } from "@jimp/test-utils/src"; const jimp = configure({ plugins: [fisheye] }, Jimp); -describe('Fisheye', () => { - it('should create fisheye lens to image', async () => { +describe("Fisheye", () => { + it("should create fisheye lens to image", async () => { const imgNormal = await jimp.read( mkJGD( - '0000000000', - '0001221000', - '0022222200', - '0122112210', - '0221001220', - '0221001220', - '0122112210', - '0022222200', - '0001221000', - '0000000000' + "0000000000", + "0001221000", + "0022222200", + "0122112210", + "0221001220", + "0221001220", + "0122112210", + "0022222200", + "0001221000", + "0000000000" ) ); const imgBulged = await jimp.read( mkJGD( - '0001221000', - '0221112220', - '0220000121', - '1100000112', - '2100000012', - '2100000012', - '1200000012', - '0211000222', - '0221111220', - '0012222200' + "0001221000", + "0221112220", + "0220000121", + "1100000112", + "2100000012", + "2100000012", + "1200000012", + "0211000222", + "0221111220", + "0012222200" ) ); - imgNormal - .fisheye() - .getJGDSync() - .should.be.sameJGD(imgBulged.getJGDSync()); + expectToBeJGD(imgNormal.fisheye().getJGDSync(), imgBulged.getJGDSync()); }); - it('should create fisheye lens to image with radius', async () => { + it("should create fisheye lens to image with radius", async () => { const imgNormal = await jimp.read( mkJGD( - '0000000000', - '0000000000', - '0000000000', - '0000000000', - '0001111000', - '0001111000', - '0000000000', - '0000000000', - '0000000000', - '0000000000' + "0000000000", + "0000000000", + "0000000000", + "0000000000", + "0001111000", + "0001111000", + "0000000000", + "0000000000", + "0000000000", + "0000000000" ) ); const imgBulged = await jimp.read( mkJGD( - '■■■■■■■■■■', - '■■■■■■■■■■', - '■■■■■■■■■■', - '■■■11111■■', - '■■111111■■', - '■■111111■■', - '■■■■111■■■', - '■■■■■■■■■■', - '■■■■■■■■■■', - '■■■■■■■■■■' + "■■■■■■■■■■", + "■■■■■■■■■■", + "■■■■■■■■■■", + "■■■11111■■", + "■■111111■■", + "■■111111■■", + "■■■■111■■■", + "■■■■■■■■■■", + "■■■■■■■■■■", + "■■■■■■■■■■" ) ); - imgNormal - .fisheye({ r: 1.8 }) - .getJGDSync() - .should.be.sameJGD(imgBulged.getJGDSync()); + expectToBeJGD( + imgNormal.fisheye({ r: 1.8 }).getJGDSync(), + imgBulged.getJGDSync() + ); }); }); diff --git a/project starter code/node_modules/@jimp/plugin-flip/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-flip/CHANGELOG.md index 8e115c85..16844d0a 100644 --- a/project starter code/node_modules/@jimp/plugin-flip/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/plugin-flip/CHANGELOG.md @@ -1,3 +1,65 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.22.0 (Mon Feb 06 2023) + +#### 🏠 Internal + +- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Daniel Holmes ([@danielholmes](https://github.com/danielholmes)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -24,7 +86,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -32,4 +94,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-flip/README.md b/project starter code/node_modules/@jimp/plugin-flip/README.md index 4dfe3206..dd7ecaf5 100644 --- a/project starter code/node_modules/@jimp/plugin-flip/README.md +++ b/project starter code/node_modules/@jimp/plugin-flip/README.md @@ -16,10 +16,10 @@ Also aliased as `mirror` - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.flip(); image.mirror(); diff --git a/project starter code/node_modules/@jimp/plugin-flip/dist/index.js b/project starter code/node_modules/@jimp/plugin-flip/dist/index.js index 5a85279a..a300850b 100644 --- a/project starter code/node_modules/@jimp/plugin-flip/dist/index.js +++ b/project starter code/node_modules/@jimp/plugin-flip/dist/index.js @@ -3,10 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - +exports.default = void 0; var _utils = require("@jimp/utils"); - /** * Flip the image horizontally * @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally @@ -15,34 +13,26 @@ var _utils = require("@jimp/utils"); * @returns {Jimp} this for chaining of methods */ function flipFn(horizontal, vertical, cb) { - if (typeof horizontal !== 'boolean' || typeof vertical !== 'boolean') return _utils.throwError.call(this, 'horizontal and vertical must be Booleans', cb); - var bitmap = Buffer.alloc(this.bitmap.data.length); + if (typeof horizontal !== "boolean" || typeof vertical !== "boolean") return _utils.throwError.call(this, "horizontal and vertical must be Booleans", cb); + const bitmap = Buffer.alloc(this.bitmap.data.length); this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var _x = horizontal ? this.bitmap.width - 1 - x : x; - - var _y = vertical ? this.bitmap.height - 1 - y : y; - - var _idx = this.bitmap.width * _y + _x << 2; - - var data = this.bitmap.data.readUInt32BE(idx); + const _x = horizontal ? this.bitmap.width - 1 - x : x; + const _y = vertical ? this.bitmap.height - 1 - y : y; + const _idx = this.bitmap.width * _y + _x << 2; + const data = this.bitmap.data.readUInt32BE(idx); bitmap.writeUInt32BE(data, _idx); }); this.bitmap.data = Buffer.from(bitmap); - if ((0, _utils.isNodePattern)(cb)) { cb.call(this, null, this); } - return this; } - -var _default = function _default() { - return { - flip: flipFn, - mirror: flipFn - }; -}; - -exports["default"] = _default; +var _default = () => ({ + flip: flipFn, + mirror: flipFn +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-flip/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-flip/dist/index.js.map index bf47a102..515011d6 100644 --- a/project starter code/node_modules/@jimp/plugin-flip/dist/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-flip/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["flipFn","horizontal","vertical","cb","throwError","call","bitmap","Buffer","alloc","data","length","scanQuiet","width","height","x","y","idx","_x","_y","_idx","readUInt32BE","writeUInt32BE","from","flip","mirror"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;AAOA,SAASA,MAAT,CAAgBC,UAAhB,EAA4BC,QAA5B,EAAsCC,EAAtC,EAA0C;AACxC,MAAI,OAAOF,UAAP,KAAsB,SAAtB,IAAmC,OAAOC,QAAP,KAAoB,SAA3D,EACE,OAAOE,kBAAWC,IAAX,CACL,IADK,EAEL,0CAFK,EAGLF,EAHK,CAAP;AAMF,MAAMG,MAAM,GAAGC,MAAM,CAACC,KAAP,CAAa,KAAKF,MAAL,CAAYG,IAAZ,CAAiBC,MAA9B,CAAf;AACA,OAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKL,MAAL,CAAYM,KAAjC,EAAwC,KAAKN,MAAL,CAAYO,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,QAAMC,EAAE,GAAGhB,UAAU,GAAG,KAAKK,MAAL,CAAYM,KAAZ,GAAoB,CAApB,GAAwBE,CAA3B,GAA+BA,CAApD;;AACA,QAAMI,EAAE,GAAGhB,QAAQ,GAAG,KAAKI,MAAL,CAAYO,MAAZ,GAAqB,CAArB,GAAyBE,CAA5B,GAAgCA,CAAnD;;AACA,QAAMI,IAAI,GAAI,KAAKb,MAAL,CAAYM,KAAZ,GAAoBM,EAApB,GAAyBD,EAA1B,IAAiC,CAA9C;;AACA,QAAMR,IAAI,GAAG,KAAKH,MAAL,CAAYG,IAAZ,CAAiBW,YAAjB,CAA8BJ,GAA9B,CAAb;AAEAV,IAAAA,MAAM,CAACe,aAAP,CAAqBZ,IAArB,EAA2BU,IAA3B;AACD,GAXD;AAaA,OAAKb,MAAL,CAAYG,IAAZ,GAAmBF,MAAM,CAACe,IAAP,CAAYhB,MAAZ,CAAnB;;AAEA,MAAI,0BAAcH,EAAd,CAAJ,EAAuB;AACrBA,IAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,SAAO,IAAP;AACD;;eAEc;AAAA,SAAO;AACpBkB,IAAAA,IAAI,EAAEvB,MADc;AAEpBwB,IAAAA,MAAM,EAAExB;AAFY,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Flip the image horizontally\n * @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally\n * @param {boolean} vertical a Boolean, if true the image will be flipped vertically\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction flipFn(horizontal, vertical, cb) {\n if (typeof horizontal !== 'boolean' || typeof vertical !== 'boolean')\n return throwError.call(\n this,\n 'horizontal and vertical must be Booleans',\n cb\n );\n\n const bitmap = Buffer.alloc(this.bitmap.data.length);\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const _x = horizontal ? this.bitmap.width - 1 - x : x;\n const _y = vertical ? this.bitmap.height - 1 - y : y;\n const _idx = (this.bitmap.width * _y + _x) << 2;\n const data = this.bitmap.data.readUInt32BE(idx);\n\n bitmap.writeUInt32BE(data, _idx);\n });\n\n this.bitmap.data = Buffer.from(bitmap);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n flip: flipFn,\n mirror: flipFn\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["flipFn","horizontal","vertical","cb","throwError","call","bitmap","Buffer","alloc","data","length","scanQuiet","width","height","x","y","idx","_x","_y","_idx","readUInt32BE","writeUInt32BE","from","isNodePattern","flip","mirror"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Flip the image horizontally\n * @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally\n * @param {boolean} vertical a Boolean, if true the image will be flipped vertically\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction flipFn(horizontal, vertical, cb) {\n if (typeof horizontal !== \"boolean\" || typeof vertical !== \"boolean\")\n return throwError.call(\n this,\n \"horizontal and vertical must be Booleans\",\n cb\n );\n\n const bitmap = Buffer.alloc(this.bitmap.data.length);\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const _x = horizontal ? this.bitmap.width - 1 - x : x;\n const _y = vertical ? this.bitmap.height - 1 - y : y;\n const _idx = (this.bitmap.width * _y + _x) << 2;\n const data = this.bitmap.data.readUInt32BE(idx);\n\n bitmap.writeUInt32BE(data, _idx);\n }\n );\n\n this.bitmap.data = Buffer.from(bitmap);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n flip: flipFn,\n mirror: flipFn,\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,MAAM,CAACC,UAAU,EAAEC,QAAQ,EAAEC,EAAE,EAAE;E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end of file diff --git a/project starter code/node_modules/@jimp/plugin-flip/es/flipping.test.js b/project starter code/node_modules/@jimp/plugin-flip/es/flipping.test.js new file mode 100644 index 00000000..685a13f9 --- /dev/null +++ b/project starter code/node_modules/@jimp/plugin-flip/es/flipping.test.js @@ -0,0 +1,25 @@ +import { Jimp, mkJGD } from "@jimp/test-utils"; +import configure from "@jimp/custom"; +import flip from "../src"; +import { expectToBeJGD } from "@jimp/test-utils/src"; +const jimp = configure({ + plugins: [flip] +}, Jimp); +describe("Flipping plugin", () => { + it("can flip horizontally", async () => { + const src = await jimp.read(mkJGD("AAAABBBB", "AAABAAAB", "ABABABAB", "CCCCCCCC", "CCCCCCCC", "CCCCCCCC", "AACCCCAA")); + const result = src.flip(true, false); + expectToBeJGD(result.getJGDSync(), mkJGD("BBBBAAAA", "BAAABAAA", "BABABABA", "CCCCCCCC", "CCCCCCCC", "CCCCCCCC", "AACCCCAA")); + }); + it("can flip vertically", async () => { + const src = await jimp.read(mkJGD("AAAABBBB", "AAABAAAB", "ABABABAB", "CCCCCCCC", "CCCCCCCC", "CCCCCCCC", "AACCCCAA")); + const result = src.flip(false, true); + expectToBeJGD(result.getJGDSync(), mkJGD("AACCCCAA", "CCCCCCCC", "CCCCCCCC", "CCCCCCCC", "ABABABAB", "AAABAAAB", "AAAABBBB")); + }); + it("can flip both horizontally and vertically at once", async () => { + const src = await jimp.read(mkJGD("AAAABBBB", "AAABAAAB", "ABABABAB", "CCCCCCCC", "CCCCCCCC", "CCCCCCCC", "AACCCCAA")); + const result = src.flip(true, true); + expectToBeJGD(result.getJGDSync(), mkJGD("AACCCCAA", "CCCCCCCC", "CCCCCCCC", "CCCCCCCC", "BABABABA", "BAAABAAA", "BBBBAAAA")); + }); +}); +//# sourceMappingURL=flipping.test.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-flip/es/flipping.test.js.map b/project starter code/node_modules/@jimp/plugin-flip/es/flipping.test.js.map new file mode 100644 index 00000000..e38c9f54 --- /dev/null +++ b/project starter code/node_modules/@jimp/plugin-flip/es/flipping.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"flipping.test.js","names":["Jimp","mkJGD","configure","flip","expectToBeJGD","jimp","plugins","describe","it","src","read","result","getJGDSync"],"sources":["../test/flipping.test.js"],"sourcesContent":["import { Jimp, mkJGD } from \"@jimp/test-utils\";\n\nimport configure from \"@jimp/custom\";\n\nimport flip from \"../src\";\nimport { expectToBeJGD } from \"@jimp/test-utils/src\";\n\nconst jimp = configure({ plugins: [flip] }, Jimp);\n\ndescribe(\"Flipping plugin\", () => {\n it(\"can flip horizontally\", async () => {\n const src = await jimp.read(\n mkJGD(\n \"AAAABBBB\",\n \"AAABAAAB\",\n \"ABABABAB\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"AACCCCAA\"\n )\n );\n\n const result = src.flip(true, false);\n\n expectToBeJGD(\n result.getJGDSync(),\n mkJGD(\n \"BBBBAAAA\",\n \"BAAABAAA\",\n \"BABABABA\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"AACCCCAA\"\n )\n );\n });\n\n it(\"can flip vertically\", async () => {\n const src = await jimp.read(\n mkJGD(\n \"AAAABBBB\",\n \"AAABAAAB\",\n \"ABABABAB\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"AACCCCAA\"\n )\n );\n\n const result = src.flip(false, true);\n\n expectToBeJGD(\n result.getJGDSync(),\n mkJGD(\n \"AACCCCAA\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"ABABABAB\",\n \"AAABAAAB\",\n \"AAAABBBB\"\n )\n );\n });\n\n it(\"can flip both horizontally and vertically at once\", async () => {\n const src = await jimp.read(\n mkJGD(\n \"AAAABBBB\",\n \"AAABAAAB\",\n \"ABABABAB\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"AACCCCAA\"\n )\n );\n\n const result = src.flip(true, true);\n\n expectToBeJGD(\n result.getJGDSync(),\n mkJGD(\n \"AACCCCAA\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"CCCCCCCC\",\n \"BABABABA\",\n \"BAAABAAA\",\n \"BBBBAAAA\"\n )\n );\n });\n});\n"],"mappings":"AAAA,SAASA,IAAI,EAAEC,KAAK,QAAQ,kBAAkB;AAE9C,OAAOC,SAAS,MAAM,cAAc;AAEpC,OAAOC,IAAI,MAAM,QAAQ;AACzB,SAASC,aAAa,QAAQ,sBAAsB;AAEpD,MAAMC,IAAI,GAAGH,SAAS,CAAC;EAAEI,OAAO,EAAE,CAACH,IAAI;AAAE,CAAC,EAAEH,IAAI,CAAC;AAEjDO,QAAQ,CAAC,iBAAiB,EAAE,MAAM;EAChCC,EAAE,CAAC,uBAAuB,EAAE,YAAY;IACtC,MAAMC,GAAG,GAAG,MAAMJ,IAAI,CAACK,IAAI,CACzBT,KAAK,CACH,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,CACX,CACF;IAED,MAAMU,MAAM,GAAGF,GAAG,CAACN,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC;IAEpCC,aAAa,CACXO,MAAM,CAACC,UAAU,EAAE,EACnBX,KAAK,CACH,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,CACX,CACF;EACH,CAAC,CAAC;EAEFO,EAAE,CAAC,qBAAqB,EAAE,YAAY;IACpC,MAAMC,GAAG,GAAG,MAAMJ,IAAI,CAACK,IAAI,CACzBT,KAAK,CACH,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,CACX,CACF;IAED,MAAMU,MAAM,GAAGF,GAAG,CAACN,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC;IAEpCC,aAAa,CACXO,MAAM,CAACC,UAAU,EAAE,EACnBX,KAAK,CACH,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,CACX,CACF;EACH,CAAC,CAAC;EAEFO,EAAE,CAAC,mDAAmD,EAAE,YAAY;IAClE,MAAMC,GAAG,GAAG,MAAMJ,IAAI,CAACK,IAAI,CACzBT,KAAK,CACH,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,CACX,CACF;IAED,MAAMU,MAAM,GAAGF,GAAG,CAACN,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC;IAEnCC,aAAa,CACXO,MAAM,CAACC,UAAU,EAAE,EACnBX,KAAK,CACH,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,CACX,CACF;EACH,CAAC,CAAC;AACJ,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-flip/es/index.js b/project starter code/node_modules/@jimp/plugin-flip/es/index.js index 241787ff..64931680 100644 --- a/project starter code/node_modules/@jimp/plugin-flip/es/index.js +++ b/project starter code/node_modules/@jimp/plugin-flip/es/index.js @@ -1,11 +1,4 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); +import { isNodePattern, throwError } from "@jimp/utils"; /** * Flip the image horizontally @@ -15,33 +8,23 @@ var _utils = require("@jimp/utils"); * @returns {Jimp} this for chaining of methods */ function flipFn(horizontal, vertical, cb) { - if (typeof horizontal !== 'boolean' || typeof vertical !== 'boolean') return _utils.throwError.call(this, 'horizontal and vertical must be Booleans', cb); - var bitmap = Buffer.alloc(this.bitmap.data.length); + if (typeof horizontal !== "boolean" || typeof vertical !== "boolean") return throwError.call(this, "horizontal and vertical must be Booleans", cb); + const bitmap = Buffer.alloc(this.bitmap.data.length); this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var _x = horizontal ? this.bitmap.width - 1 - x : x; - - var _y = vertical ? this.bitmap.height - 1 - y : y; - - var _idx = this.bitmap.width * _y + _x << 2; - - var data = this.bitmap.data.readUInt32BE(idx); + const _x = horizontal ? this.bitmap.width - 1 - x : x; + const _y = vertical ? this.bitmap.height - 1 - y : y; + const _idx = this.bitmap.width * _y + _x << 2; + const data = this.bitmap.data.readUInt32BE(idx); bitmap.writeUInt32BE(data, _idx); }); this.bitmap.data = Buffer.from(bitmap); - - if ((0, _utils.isNodePattern)(cb)) { + if (isNodePattern(cb)) { cb.call(this, null, this); } - return this; } - -var _default = function _default() { - return { - flip: flipFn, - mirror: flipFn - }; -}; - -exports["default"] = _default; +export default (() => ({ + flip: flipFn, + mirror: flipFn +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-flip/es/index.js.map b/project starter code/node_modules/@jimp/plugin-flip/es/index.js.map index bf47a102..c8499213 100644 --- a/project starter code/node_modules/@jimp/plugin-flip/es/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-flip/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["flipFn","horizontal","vertical","cb","throwError","call","bitmap","Buffer","alloc","data","length","scanQuiet","width","height","x","y","idx","_x","_y","_idx","readUInt32BE","writeUInt32BE","from","flip","mirror"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;AAOA,SAASA,MAAT,CAAgBC,UAAhB,EAA4BC,QAA5B,EAAsCC,EAAtC,EAA0C;AACxC,MAAI,OAAOF,UAAP,KAAsB,SAAtB,IAAmC,OAAOC,QAAP,KAAoB,SAA3D,EACE,OAAOE,kBAAWC,IAAX,CACL,IADK,EAEL,0CAFK,EAGLF,EAHK,CAAP;AAMF,MAAMG,MAAM,GAAGC,MAAM,CAACC,KAAP,CAAa,KAAKF,MAAL,CAAYG,IAAZ,CAAiBC,MAA9B,CAAf;AACA,OAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKL,MAAL,CAAYM,KAAjC,EAAwC,KAAKN,MAAL,CAAYO,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,QAAMC,EAAE,GAAGhB,UAAU,GAAG,KAAKK,MAAL,CAAYM,KAAZ,GAAoB,CAApB,GAAwBE,CAA3B,GAA+BA,CAApD;;AACA,QAAMI,EAAE,GAAGhB,QAAQ,GAAG,KAAKI,MAAL,CAAYO,MAAZ,GAAqB,CAArB,GAAyBE,CAA5B,GAAgCA,CAAnD;;AACA,QAAMI,IAAI,GAAI,KAAKb,MAAL,CAAYM,KAAZ,GAAoBM,EAApB,GAAyBD,EAA1B,IAAiC,CAA9C;;AACA,QAAMR,IAAI,GAAG,KAAKH,MAAL,CAAYG,IAAZ,CAAiBW,YAAjB,CAA8BJ,GAA9B,CAAb;AAEAV,IAAAA,MAAM,CAACe,aAAP,CAAqBZ,IAArB,EAA2BU,IAA3B;AACD,GAXD;AAaA,OAAKb,MAAL,CAAYG,IAAZ,GAAmBF,MAAM,CAACe,IAAP,CAAYhB,MAAZ,CAAnB;;AAEA,MAAI,0BAAcH,EAAd,CAAJ,EAAuB;AACrBA,IAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,SAAO,IAAP;AACD;;eAEc;AAAA,SAAO;AACpBkB,IAAAA,IAAI,EAAEvB,MADc;AAEpBwB,IAAAA,MAAM,EAAExB;AAFY,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Flip the image horizontally\n * @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally\n * @param {boolean} vertical a Boolean, if true the image will be flipped vertically\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction flipFn(horizontal, vertical, cb) {\n if (typeof horizontal !== 'boolean' || typeof vertical !== 'boolean')\n return throwError.call(\n this,\n 'horizontal and vertical must be Booleans',\n cb\n );\n\n const bitmap = Buffer.alloc(this.bitmap.data.length);\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const _x = horizontal ? this.bitmap.width - 1 - x : x;\n const _y = vertical ? this.bitmap.height - 1 - y : y;\n const _idx = (this.bitmap.width * _y + _x) << 2;\n const data = this.bitmap.data.readUInt32BE(idx);\n\n bitmap.writeUInt32BE(data, _idx);\n });\n\n this.bitmap.data = Buffer.from(bitmap);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n flip: flipFn,\n mirror: flipFn\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["isNodePattern","throwError","flipFn","horizontal","vertical","cb","call","bitmap","Buffer","alloc","data","length","scanQuiet","width","height","x","y","idx","_x","_y","_idx","readUInt32BE","writeUInt32BE","from","flip","mirror"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Flip the image horizontally\n * @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally\n * @param {boolean} vertical a Boolean, if true the image will be flipped vertically\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction flipFn(horizontal, vertical, cb) {\n if (typeof horizontal !== \"boolean\" || typeof vertical !== \"boolean\")\n return throwError.call(\n this,\n \"horizontal and vertical must be Booleans\",\n cb\n );\n\n const bitmap = Buffer.alloc(this.bitmap.data.length);\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const _x = horizontal ? this.bitmap.width - 1 - x : x;\n const _y = vertical ? this.bitmap.height - 1 - y : y;\n const _idx = (this.bitmap.width * _y + _x) << 2;\n const data = this.bitmap.data.readUInt32BE(idx);\n\n bitmap.writeUInt32BE(data, _idx);\n }\n );\n\n this.bitmap.data = Buffer.from(bitmap);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n}\n\nexport default () => ({\n flip: flipFn,\n mirror: flipFn,\n});\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,MAAM,CAACC,UAAU,EAAEC,QAAQ,EAAEC,EAAE,EAAE;EACxC,IAAI,OAAOF,UAAU,KAAK,SAAS,IAAI,OAAOC,QAAQ,KAAK,SAAS,EAClE,OAAOH,UAAU,CAACK,IAAI,CACpB,IAAI,EACJ,0CAA0C,EAC1CD,EAAE,CACH;EAEH,MAAME,MAAM,GAAGC,MAAM,CAACC,KAAK,CAAC,IAAI,CAACF,MAAM,CAACG,IAAI,CAACC,MAAM,CAAC;EACpD,IAAI,CAACC,SAAS,CACZ,CAAC,EACD,CAAC,EACD,IAAI,CAACL,MAAM,CAACM,KAAK,EACjB,IAAI,CAACN,MAAM,CAACO,MAAM,EAClB,UAAUC,CAAC,EAAEC,CAAC,EAAEC,GAAG,EAAE;IACnB,MAAMC,EAAE,GAAGf,UAAU,GAAG,IAAI,CAACI,MAAM,CAACM,KAAK,GAAG,CAAC,GAAGE,CAAC,GAAGA,CAAC;IACrD,MAAMI,EAAE,GAAGf,QAAQ,GAAG,IAAI,CAACG,MAAM,CAACO,MAAM,GAAG,CAAC,GAAGE,CAAC,GAAGA,CAAC;IACpD,MAAMI,IAAI,GAAI,IAAI,CAACb,MAAM,CAACM,KAAK,GAAGM,EAAE,GAAGD,EAAE,IAAK,CAAC;IAC/C,MAAMR,IAAI,GAAG,IAAI,CAACH,MAAM,CAACG,IAAI,CAACW,YAAY,CAACJ,GAAG,CAAC;IAE/CV,MAAM,CAACe,aAAa,CAACZ,IAAI,EAAEU,IAAI,CAAC;EAClC,CAAC,CACF;EAED,IAAI,CAACb,MAAM,CAACG,IAAI,GAAGF,MAAM,CAACe,IAAI,CAAChB,MAAM,CAAC;EAEtC,IAAIP,aAAa,CAACK,EAAE,CAAC,EAAE;IACrBA,EAAE,CAACC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;EAC3B;EAEA,OAAO,IAAI;AACb;AAEA,gBAAe,OAAO;EACpBkB,IAAI,EAAEtB,MAAM;EACZuB,MAAM,EAAEvB;AACV,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-flip/index.d.ts b/project starter code/node_modules/@jimp/plugin-flip/index.d.ts index 17b107d4..3f1efd66 100644 --- a/project starter code/node_modules/@jimp/plugin-flip/index.d.ts +++ b/project starter code/node_modules/@jimp/plugin-flip/index.d.ts @@ -1,8 +1,12 @@ -import { ImageCallback } from '@jimp/core'; +import { ImageCallback } from "@jimp/core"; interface Flip { flip(horizontal: boolean, vertical: boolean, cb?: ImageCallback): this; - mirror(horizontal: boolean, vertical: boolean, cb?: ImageCallback): this; + mirror( + horizontal: boolean, + vertical: boolean, + cb?: ImageCallback + ): this; } -export default function(): Flip; +export default function (): Flip; diff --git a/project starter code/node_modules/@jimp/plugin-flip/package.json b/project starter code/node_modules/@jimp/plugin-flip/package.json index 9285c679..21e4c468 100644 --- a/project starter code/node_modules/@jimp/plugin-flip/package.json +++ b/project starter code/node_modules/@jimp/plugin-flip/package.json @@ -1,12 +1,13 @@ { "name": "@jimp/plugin-flip", - "version": "0.16.2", + "version": "0.22.12", "description": "flip an image.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { - "build": "npm run build:node:production && npm run build:module", + "build": "npm run build:node:production && npm run build:module --recursive test", "build:watch": "npm run build:node:debug -- -- --watch --verbose", "build:debug": "npm run build:node:debug", "build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js", @@ -17,8 +18,7 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", @@ -27,5 +27,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/plugin-flip/src/index.js b/project starter code/node_modules/@jimp/plugin-flip/src/index.js index 212fb848..01064ac1 100644 --- a/project starter code/node_modules/@jimp/plugin-flip/src/index.js +++ b/project starter code/node_modules/@jimp/plugin-flip/src/index.js @@ -1,4 +1,4 @@ -import { isNodePattern, throwError } from '@jimp/utils'; +import { isNodePattern, throwError } from "@jimp/utils"; /** * Flip the image horizontally @@ -8,26 +8,28 @@ import { isNodePattern, throwError } from '@jimp/utils'; * @returns {Jimp} this for chaining of methods */ function flipFn(horizontal, vertical, cb) { - if (typeof horizontal !== 'boolean' || typeof vertical !== 'boolean') + if (typeof horizontal !== "boolean" || typeof vertical !== "boolean") return throwError.call( this, - 'horizontal and vertical must be Booleans', + "horizontal and vertical must be Booleans", cb ); const bitmap = Buffer.alloc(this.bitmap.data.length); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - const _x = horizontal ? this.bitmap.width - 1 - x : x; - const _y = vertical ? this.bitmap.height - 1 - y : y; - const _idx = (this.bitmap.width * _y + _x) << 2; - const data = this.bitmap.data.readUInt32BE(idx); + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + const _x = horizontal ? this.bitmap.width - 1 - x : x; + const _y = vertical ? this.bitmap.height - 1 - y : y; + const _idx = (this.bitmap.width * _y + _x) << 2; + const data = this.bitmap.data.readUInt32BE(idx); - bitmap.writeUInt32BE(data, _idx); - }); + bitmap.writeUInt32BE(data, _idx); + } + ); this.bitmap.data = Buffer.from(bitmap); @@ -40,5 +42,5 @@ function flipFn(horizontal, vertical, cb) { export default () => ({ flip: flipFn, - mirror: flipFn + mirror: flipFn, }); diff --git a/project starter code/node_modules/@jimp/plugin-flip/test/flipping.test.js b/project starter code/node_modules/@jimp/plugin-flip/test/flipping.test.js index de9a1e49..6866acf6 100644 --- a/project starter code/node_modules/@jimp/plugin-flip/test/flipping.test.js +++ b/project starter code/node_modules/@jimp/plugin-flip/test/flipping.test.js @@ -1,99 +1,97 @@ -import { Jimp, mkJGD } from '@jimp/test-utils'; +import { Jimp, mkJGD } from "@jimp/test-utils"; -import configure from '@jimp/custom'; +import configure from "@jimp/custom"; -import flip from '../src'; +import flip from "../src"; +import { expectToBeJGD } from "@jimp/test-utils/src"; const jimp = configure({ plugins: [flip] }, Jimp); -describe('Flipping plugin', () => { - it('can flip horizontally', async () => { +describe("Flipping plugin", () => { + it("can flip horizontally", async () => { const src = await jimp.read( mkJGD( - 'AAAABBBB', - 'AAABAAAB', - 'ABABABAB', - 'CCCCCCCC', - 'CCCCCCCC', - 'CCCCCCCC', - 'AACCCCAA' + "AAAABBBB", + "AAABAAAB", + "ABABABAB", + "CCCCCCCC", + "CCCCCCCC", + "CCCCCCCC", + "AACCCCAA" ) ); const result = src.flip(true, false); - result - .getJGDSync() - .should.be.sameJGD( - mkJGD( - 'BBBBAAAA', - 'BAAABAAA', - 'BABABABA', - 'CCCCCCCC', - 'CCCCCCCC', - 'CCCCCCCC', - 'AACCCCAA' - ) - ); + expectToBeJGD( + result.getJGDSync(), + mkJGD( + "BBBBAAAA", + "BAAABAAA", + "BABABABA", + "CCCCCCCC", + "CCCCCCCC", + "CCCCCCCC", + "AACCCCAA" + ) + ); }); - it('can flip vertically', async () => { + it("can flip vertically", async () => { const src = await jimp.read( mkJGD( - 'AAAABBBB', - 'AAABAAAB', - 'ABABABAB', - 'CCCCCCCC', - 'CCCCCCCC', - 'CCCCCCCC', - 'AACCCCAA' + "AAAABBBB", + "AAABAAAB", + "ABABABAB", + "CCCCCCCC", + "CCCCCCCC", + "CCCCCCCC", + "AACCCCAA" ) ); const result = src.flip(false, true); - result - .getJGDSync() - .should.be.sameJGD( - mkJGD( - 'AACCCCAA', - 'CCCCCCCC', - 'CCCCCCCC', - 'CCCCCCCC', - 'ABABABAB', - 'AAABAAAB', - 'AAAABBBB' - ) - ); + expectToBeJGD( + result.getJGDSync(), + mkJGD( + "AACCCCAA", + "CCCCCCCC", + "CCCCCCCC", + "CCCCCCCC", + "ABABABAB", + "AAABAAAB", + "AAAABBBB" + ) + ); }); - it('can flip both horizontally and vertically at once', async () => { + it("can flip both horizontally and vertically at once", async () => { const src = await jimp.read( mkJGD( - 'AAAABBBB', - 'AAABAAAB', - 'ABABABAB', - 'CCCCCCCC', - 'CCCCCCCC', - 'CCCCCCCC', - 'AACCCCAA' + "AAAABBBB", + "AAABAAAB", + "ABABABAB", + "CCCCCCCC", + "CCCCCCCC", + "CCCCCCCC", + "AACCCCAA" ) ); const result = src.flip(true, true); - result - .getJGDSync() - .should.be.sameJGD( - mkJGD( - 'AACCCCAA', - 'CCCCCCCC', - 'CCCCCCCC', - 'CCCCCCCC', - 'BABABABA', - 'BAAABAAA', - 'BBBBAAAA' - ) - ); + expectToBeJGD( + result.getJGDSync(), + mkJGD( + "AACCCCAA", + "CCCCCCCC", + "CCCCCCCC", + "CCCCCCCC", + "BABABABA", + "BAAABAAA", + "BBBBAAAA" + ) + ); }); }); diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-gaussian/CHANGELOG.md index 26394e0f..8d029143 100644 --- a/project starter code/node_modules/@jimp/plugin-gaussian/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/plugin-gaussian/CHANGELOG.md @@ -1,3 +1,51 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -12,7 +60,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -20,4 +68,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/README.md b/project starter code/node_modules/@jimp/plugin-gaussian/README.md index 116ea741..0f15ca98 100644 --- a/project starter code/node_modules/@jimp/plugin-gaussian/README.md +++ b/project starter code/node_modules/@jimp/plugin-gaussian/README.md @@ -13,10 +13,10 @@ Applies a true Gaussian blur to the image (warning: this is VERY slow) - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.gaussian(15); } diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/dist/index.js b/project starter code/node_modules/@jimp/plugin-gaussian/dist/index.js index 9502e1f9..3b70a82f 100644 --- a/project starter code/node_modules/@jimp/plugin-gaussian/dist/index.js +++ b/project starter code/node_modules/@jimp/plugin-gaussian/dist/index.js @@ -3,85 +3,69 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - +exports.default = void 0; var _utils = require("@jimp/utils"); - /** * Applies a true Gaussian blur to the image (warning: this is VERY slow) * @param {number} r the pixel radius of the blur * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ -var _default = function _default() { - return { - gaussian: function gaussian(r, cb) { - // http://blog.ivank.net/fastest-gaussian-blur.html - if (typeof r !== 'number') { - return _utils.throwError.call(this, 'r must be a number', cb); - } - - if (r < 1) { - return _utils.throwError.call(this, 'r must be greater than 0', cb); - } - - var rs = Math.ceil(r * 2.57); // significant radius - - var range = rs * 2 + 1; - var rr2 = r * r * 2; - var rr2pi = rr2 * Math.PI; - var weights = []; - - for (var y = 0; y < range; y++) { - weights[y] = []; - - for (var x = 0; x < range; x++) { - var dsq = Math.pow(x - rs, 2) + Math.pow(y - rs, 2); - weights[y][x] = Math.exp(-dsq / rr2) / rr2pi; - } +var _default = () => ({ + gaussian(r, cb) { + // http://blog.ivank.net/fastest-gaussian-blur.html + if (typeof r !== "number") { + return _utils.throwError.call(this, "r must be a number", cb); + } + if (r < 1) { + return _utils.throwError.call(this, "r must be greater than 0", cb); + } + const rs = Math.ceil(r * 2.57); // significant radius + const range = rs * 2 + 1; + const rr2 = r * r * 2; + const rr2pi = rr2 * Math.PI; + const weights = []; + for (let y = 0; y < range; y++) { + weights[y] = []; + for (let x = 0; x < range; x++) { + const dsq = (x - rs) ** 2 + (y - rs) ** 2; + weights[y][x] = Math.exp(-dsq / rr2) / rr2pi; } - - for (var _y = 0; _y < this.bitmap.height; _y++) { - for (var _x = 0; _x < this.bitmap.width; _x++) { - var red = 0; - var green = 0; - var blue = 0; - var alpha = 0; - var wsum = 0; - - for (var iy = 0; iy < range; iy++) { - for (var ix = 0; ix < range; ix++) { - var x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + _x - rs)); - var y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + _y - rs)); - var weight = weights[iy][ix]; - - var _idx = y1 * this.bitmap.width + x1 << 2; - - red += this.bitmap.data[_idx] * weight; - green += this.bitmap.data[_idx + 1] * weight; - blue += this.bitmap.data[_idx + 2] * weight; - alpha += this.bitmap.data[_idx + 3] * weight; - wsum += weight; - } - - var idx = _y * this.bitmap.width + _x << 2; - this.bitmap.data[idx] = Math.round(red / wsum); - this.bitmap.data[idx + 1] = Math.round(green / wsum); - this.bitmap.data[idx + 2] = Math.round(blue / wsum); - this.bitmap.data[idx + 3] = Math.round(alpha / wsum); + } + for (let y = 0; y < this.bitmap.height; y++) { + for (let x = 0; x < this.bitmap.width; x++) { + let red = 0; + let green = 0; + let blue = 0; + let alpha = 0; + let wsum = 0; + for (let iy = 0; iy < range; iy++) { + for (let ix = 0; ix < range; ix++) { + const x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + x - rs)); + const y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + y - rs)); + const weight = weights[iy][ix]; + const idx = y1 * this.bitmap.width + x1 << 2; + red += this.bitmap.data[idx] * weight; + green += this.bitmap.data[idx + 1] * weight; + blue += this.bitmap.data[idx + 2] * weight; + alpha += this.bitmap.data[idx + 3] * weight; + wsum += weight; } + const idx = y * this.bitmap.width + x << 2; + this.bitmap.data[idx] = Math.round(red / wsum); + this.bitmap.data[idx + 1] = Math.round(green / wsum); + this.bitmap.data[idx + 2] = Math.round(blue / wsum); + this.bitmap.data[idx + 3] = Math.round(alpha / wsum); } } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; } - }; -}; - -exports["default"] = _default; + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + } +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-gaussian/dist/index.js.map index 95add697..2121d1ad 100644 --- a/project starter code/node_modules/@jimp/plugin-gaussian/dist/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-gaussian/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["gaussian","r","cb","throwError","call","rs","Math","ceil","range","rr2","rr2pi","PI","weights","y","x","dsq","exp","bitmap","height","width","red","green","blue","alpha","wsum","iy","ix","x1","min","max","y1","weight","idx","data","round"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;eAMe;AAAA,SAAO;AACpBA,IAAAA,QADoB,oBACXC,CADW,EACRC,EADQ,EACJ;AACd;AACA,UAAI,OAAOD,CAAP,KAAa,QAAjB,EAA2B;AACzB,eAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACD;;AAED,UAAID,CAAC,GAAG,CAAR,EAAW;AACT,eAAOE,k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E,KAAhB,GAAwBL,EAAzB,IAA+B,CAA3C;AAEA,iBAAKG,MAAL,CAAYgB,IAAZ,CAAiBD,GAAjB,IAAwB1B,IAAI,CAAC4B,KAAL,CAAWd,GAAG,GAAGI,IAAjB,CAAxB;AACA,iBAAKP,MAAL,CAAYgB,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B1B,IAAI,CAAC4B,KAAL,CAAWb,KAAK,GAAGG,IAAnB,CAA5B;AACA,iBAAKP,MAAL,CAAYgB,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B1B,IAAI,CAAC4B,KAAL,CAAWZ,IAAI,GAAGE,IAAlB,CAA5B;AACA,iBAAKP,MAAL,CAAYgB,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B1B,IAAI,CAAC4B,KAAL,CAAWX,KAAK,GAAGC,IAAnB,CAA5B;AACD;AACF;AACF;;AAED,UAAI,0BAActB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA/DmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Applies a true Gaussian blur to the image (warning: this is VERY slow)\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n gaussian(r, cb) {\n // http://blog.ivank.net/fastest-gaussian-blur.html\n if (typeof r !== 'number') {\n return throwError.call(this, 'r must be a number', cb);\n }\n\n if (r < 1) {\n return throwError.call(this, 'r must be greater than 0', cb);\n }\n\n const rs = Math.ceil(r * 2.57); // significant radius\n const range = rs * 2 + 1;\n const rr2 = r * r * 2;\n const rr2pi = rr2 * Math.PI;\n\n const weights = [];\n\n for (let y = 0; y < range; y++) {\n weights[y] = [];\n for (let x = 0; x < range; x++) {\n const dsq = (x - rs) ** 2 + (y - rs) ** 2 ;\n weights[y][x] = Math.exp(-dsq / rr2) / rr2pi;\n }\n }\n\n for (let y = 0; y < this.bitmap.height; y++) {\n for (let x = 0; x < this.bitmap.width; x++) {\n let red = 0;\n let green = 0;\n let blue = 0;\n let alpha = 0;\n let wsum = 0;\n\n for (let iy = 0; iy < range; iy++) {\n for (let ix = 0; ix < range; ix++) {\n const x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + x - rs ));\n const y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + y - rs));\n const weight = weights[iy][ix];\n const idx = (y1 * this.bitmap.width + x1) << 2;\n\n red += this.bitmap.data[idx] * weight;\n green += this.bitmap.data[idx + 1] * weight;\n blue += this.bitmap.data[idx + 2] * weight;\n alpha += this.bitmap.data[idx + 3] * weight;\n wsum += weight;\n }\n\n const idx = (y * this.bitmap.width + x) << 2;\n\n this.bitmap.data[idx] = Math.round(red / wsum);\n this.bitmap.data[idx + 1] = Math.round(green / wsum);\n this.bitmap.data[idx + 2] = Math.round(blue / wsum);\n this.bitmap.data[idx + 3] = Math.round(alpha / wsum);\n }\n }\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["gaussian","r","cb","throwError","call","rs","Math","ceil","range","rr2","rr2pi","PI","weights","y","x","dsq","exp","bitmap","height","width","red","green","blue","alpha","wsum","iy","ix","x1","min","max","y1","weight","idx","data","round","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Applies a true Gaussian blur to the image (warning: this is VERY slow)\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n gaussian(r, cb) {\n // http://blog.ivank.net/fastest-gaussian-blur.html\n if (typeof r !== \"number\") {\n return throwError.call(this, \"r must be a number\", cb);\n }\n\n if (r < 1) {\n return throwError.call(this, \"r must be greater than 0\", cb);\n }\n\n const rs = Math.ceil(r * 2.57); // significant radius\n const range = rs * 2 + 1;\n const rr2 = r * r * 2;\n const rr2pi = rr2 * Math.PI;\n\n const weights = [];\n\n for (let y = 0; y < range; y++) {\n weights[y] = [];\n for (let x = 0; x < range; x++) {\n const dsq = (x - rs) ** 2 + (y - rs) ** 2;\n weights[y][x] = Math.exp(-dsq / rr2) / rr2pi;\n }\n }\n\n for (let y = 0; y < this.bitmap.height; y++) {\n for (let x = 0; x < this.bitmap.width; x++) {\n let red = 0;\n let green = 0;\n let blue = 0;\n let alpha = 0;\n let wsum = 0;\n\n for (let iy = 0; iy < range; iy++) {\n for (let ix = 0; ix < range; ix++) {\n const x1 = Math.min(\n this.bitmap.width - 1,\n Math.max(0, ix + x - rs)\n );\n const y1 = Math.min(\n this.bitmap.height - 1,\n Math.max(0, iy + y - rs)\n );\n const weight = weights[iy][ix];\n const idx = (y1 * this.bitmap.width + x1) << 2;\n\n red += this.bitmap.data[idx] * weight;\n green += this.bitmap.data[idx + 1] * weight;\n blue += this.bitmap.data[idx + 2] * weight;\n alpha += this.bitmap.data[idx + 3] * weight;\n wsum += weight;\n }\n\n const idx = (y * this.bitmap.width + x) << 2;\n\n this.bitmap.data[idx] = Math.round(red / wsum);\n this.bitmap.data[idx + 1] = Math.round(green / wsum);\n this.bitmap.data[idx + 2] = Math.round(blue / wsum);\n this.bitmap.data[idx + 3] = Math.round(alpha / wsum);\n }\n }\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AALA,eAMe,OAAO;EACpBA,QAAQ,CAACC,CAAC,EAAEC,EAAE,EAAE;IACd;IACA,IAAI,OAAOD,CAAC,KAAK,QAAQ,EAAE;MACzB,OAAOE,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,oBAAoB,EAAEF,EAAE,CAAC;IACxD;IAEA,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K,CAAC;UAE5C,IAAI,CAACG,MAAM,CAACgB,IAAI,CAACD,GAAG,CAAC,GAAG1B,IAAI,CAAC4B,KAAK,CAACd,GAAG,GAAGI,IAAI,CAAC;UAC9C,IAAI,CAACP,MAAM,CAACgB,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAG1B,IAAI,CAAC4B,KAAK,CAACb,KAAK,GAAGG,IAAI,CAAC;UACpD,IAAI,CAACP,MAAM,CAACgB,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAG1B,IAAI,CAAC4B,KAAK,CAACZ,IAAI,GAAGE,IAAI,CAAC;UACnD,IAAI,CAACP,MAAM,CAACgB,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAG1B,IAAI,CAAC4B,KAAK,CAACX,KAAK,GAAGC,IAAI,CAAC;QACtD;MACF;IACF;IAEA,IAAI,IAAAW,oBAAa,EAACjC,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/es/index.js b/project starter code/node_modules/@jimp/plugin-gaussian/es/index.js index f18ae1e1..06ea20c5 100644 --- a/project starter code/node_modules/@jimp/plugin-gaussian/es/index.js +++ b/project starter code/node_modules/@jimp/plugin-gaussian/es/index.js @@ -1,11 +1,4 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); +import { isNodePattern, throwError } from "@jimp/utils"; /** * Applies a true Gaussian blur to the image (warning: this is VERY slow) @@ -13,74 +6,58 @@ var _utils = require("@jimp/utils"); * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ -var _default = function _default() { - return { - gaussian: function gaussian(r, cb) { - // http://blog.ivank.net/fastest-gaussian-blur.html - if (typeof r !== 'number') { - return _utils.throwError.call(this, 'r must be a number', cb); - } - - if (r < 1) { - return _utils.throwError.call(this, 'r must be greater than 0', cb); - } - - var rs = Math.ceil(r * 2.57); // significant radius - - var range = rs * 2 + 1; - var rr2 = r * r * 2; - var rr2pi = rr2 * Math.PI; - var weights = []; - - for (var y = 0; y < range; y++) { - weights[y] = []; - - for (var x = 0; x < range; x++) { - var dsq = Math.pow(x - rs, 2) + Math.pow(y - rs, 2); - weights[y][x] = Math.exp(-dsq / rr2) / rr2pi; - } +export default (() => ({ + gaussian(r, cb) { + // http://blog.ivank.net/fastest-gaussian-blur.html + if (typeof r !== "number") { + return throwError.call(this, "r must be a number", cb); + } + if (r < 1) { + return throwError.call(this, "r must be greater than 0", cb); + } + const rs = Math.ceil(r * 2.57); // significant radius + const range = rs * 2 + 1; + const rr2 = r * r * 2; + const rr2pi = rr2 * Math.PI; + const weights = []; + for (let y = 0; y < range; y++) { + weights[y] = []; + for (let x = 0; x < range; x++) { + const dsq = (x - rs) ** 2 + (y - rs) ** 2; + weights[y][x] = Math.exp(-dsq / rr2) / rr2pi; } - - for (var _y = 0; _y < this.bitmap.height; _y++) { - for (var _x = 0; _x < this.bitmap.width; _x++) { - var red = 0; - var green = 0; - var blue = 0; - var alpha = 0; - var wsum = 0; - - for (var iy = 0; iy < range; iy++) { - for (var ix = 0; ix < range; ix++) { - var x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + _x - rs)); - var y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + _y - rs)); - var weight = weights[iy][ix]; - - var _idx = y1 * this.bitmap.width + x1 << 2; - - red += this.bitmap.data[_idx] * weight; - green += this.bitmap.data[_idx + 1] * weight; - blue += this.bitmap.data[_idx + 2] * weight; - alpha += this.bitmap.data[_idx + 3] * weight; - wsum += weight; - } - - var idx = _y * this.bitmap.width + _x << 2; - this.bitmap.data[idx] = Math.round(red / wsum); - this.bitmap.data[idx + 1] = Math.round(green / wsum); - this.bitmap.data[idx + 2] = Math.round(blue / wsum); - this.bitmap.data[idx + 3] = Math.round(alpha / wsum); + } + for (let y = 0; y < this.bitmap.height; y++) { + for (let x = 0; x < this.bitmap.width; x++) { + let red = 0; + let green = 0; + let blue = 0; + let alpha = 0; + let wsum = 0; + for (let iy = 0; iy < range; iy++) { + for (let ix = 0; ix < range; ix++) { + const x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + x - rs)); + const y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + y - rs)); + const weight = weights[iy][ix]; + const idx = y1 * this.bitmap.width + x1 << 2; + red += this.bitmap.data[idx] * weight; + green += this.bitmap.data[idx + 1] * weight; + blue += this.bitmap.data[idx + 2] * weight; + alpha += this.bitmap.data[idx + 3] * weight; + wsum += weight; } + const idx = y * this.bitmap.width + x << 2; + this.bitmap.data[idx] = Math.round(red / wsum); + this.bitmap.data[idx + 1] = Math.round(green / wsum); + this.bitmap.data[idx + 2] = Math.round(blue / wsum); + this.bitmap.data[idx + 3] = Math.round(alpha / wsum); } } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; } - }; -}; - -exports["default"] = _default; + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + } +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/es/index.js.map b/project starter code/node_modules/@jimp/plugin-gaussian/es/index.js.map index 95add697..00b7b0f8 100644 --- a/project starter code/node_modules/@jimp/plugin-gaussian/es/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-gaussian/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["gaussian","r","cb","throwError","call","rs","Math","ceil","range","rr2","rr2pi","PI","weights","y","x","dsq","exp","bitmap","height","width","red","green","blue","alpha","wsum","iy","ix","x1","min","max","y1","weight","idx","data","round"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;eAMe;AAAA,SAAO;AACpBA,IAAAA,QADoB,oBACXC,CADW,EACR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MAApC;AACAR,cAAAA,KAAK,IAAI,KAAKN,MAAL,CAAYgB,IAAZ,CAAiBD,IAAG,GAAG,CAAvB,IAA4BD,MAArC;AACAP,cAAAA,IAAI,IAAIO,MAAR;AACD;;AAED,gBAAMC,GAAG,GAAInB,EAAC,GAAG,KAAKI,MAAL,CAAYE,KAAhB,GAAwBL,EAAzB,IAA+B,CAA3C;AAEA,iBAAKG,MAAL,CAAYgB,IAAZ,CAAiBD,GAAjB,IAAwB1B,IAAI,CAAC4B,KAAL,CAAWd,GAAG,GAAGI,IAAjB,CAAxB;AACA,iBAAKP,MAAL,CAAYgB,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B1B,IAAI,CAAC4B,KAAL,CAAWb,KAAK,GAAGG,IAAnB,CAA5B;AACA,iBAAKP,MAAL,CAAYgB,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B1B,IAAI,CAAC4B,KAAL,CAAWZ,IAAI,GAAGE,IAAlB,CAA5B;AACA,iBAAKP,MAAL,CAAYgB,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B1B,IAAI,CAAC4B,KAAL,CAAWX,KAAK,GAAGC,IAAnB,CAA5B;AACD;AACF;AACF;;AAED,UAAI,0BAActB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA/DmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Applies a true Gaussian blur to the image (warning: this is VERY slow)\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n gaussian(r, cb) {\n // http://blog.ivank.net/fastest-gaussian-blur.html\n if (typeof r !== 'number') {\n return throwError.call(this, 'r must be a number', cb);\n }\n\n if (r < 1) {\n return throwError.call(this, 'r must be greater than 0', cb);\n }\n\n const rs = Math.ceil(r * 2.57); // significant radius\n const range = rs * 2 + 1;\n const rr2 = r * r * 2;\n const rr2pi = rr2 * Math.PI;\n\n const weights = [];\n\n for (let y = 0; y < range; y++) {\n weights[y] = [];\n for (let x = 0; x < range; x++) {\n const dsq = (x - rs) ** 2 + (y - rs) ** 2 ;\n weights[y][x] = Math.exp(-dsq / rr2) / rr2pi;\n }\n }\n\n for (let y = 0; y < this.bitmap.height; y++) {\n for (let x = 0; x < this.bitmap.width; x++) {\n let red = 0;\n let green = 0;\n let blue = 0;\n let alpha = 0;\n let wsum = 0;\n\n for (let iy = 0; iy < range; iy++) {\n for (let ix = 0; ix < range; ix++) {\n const x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + x - rs ));\n const y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + y - rs));\n const weight = weights[iy][ix];\n const idx = (y1 * this.bitmap.width + x1) << 2;\n\n red += this.bitmap.data[idx] * weight;\n green += this.bitmap.data[idx + 1] * weight;\n blue += this.bitmap.data[idx + 2] * weight;\n alpha += this.bitmap.data[idx + 3] * weight;\n wsum += weight;\n }\n\n const idx = (y * this.bitmap.width + x) << 2;\n\n this.bitmap.data[idx] = Math.round(red / wsum);\n this.bitmap.data[idx + 1] = Math.round(green / wsum);\n this.bitmap.data[idx + 2] = Math.round(blue / wsum);\n this.bitmap.data[idx + 3] = Math.round(alpha / wsum);\n }\n }\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["isNodePattern","throwError","gaussian","r","cb","call","rs","Math","ceil","range","rr2","rr2pi","PI","weights","y","x","dsq","exp","bitmap","height","width","red","green","blue","alpha","wsum","iy","ix","x1","min","max","y1","weight","idx","data","round"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Applies a true Gaussian blur to the image (warning: this is VERY slow)\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n gaussian(r, cb) {\n // http://blog.ivank.net/fastest-gaussian-blur.html\n if (typeof r !== \"number\") {\n return throwError.call(this, \"r must be a number\", cb);\n }\n\n if (r < 1) {\n return throwError.call(this, \"r must be greater than 0\", cb);\n }\n\n const rs = Math.ceil(r * 2.57); // significant radius\n const range = rs * 2 + 1;\n const rr2 = r * r * 2;\n const rr2pi = rr2 * Math.PI;\n\n const weights = [];\n\n for (let y = 0; y < range; y++) {\n weights[y] = [];\n for (let x = 0; x < range; x++) {\n const dsq = (x - rs) ** 2 + (y - rs) ** 2;\n weights[y][x] = Math.exp(-dsq / rr2) / rr2pi;\n }\n }\n\n for (let y = 0; y < this.bitmap.height; y++) {\n for (let x = 0; x < this.bitmap.width; x++) {\n let red = 0;\n let green = 0;\n let blue = 0;\n let alpha = 0;\n let wsum = 0;\n\n for (let iy = 0; iy < range; iy++) {\n for (let ix = 0; ix < range; ix++) {\n const x1 = Math.min(\n this.bitmap.width - 1,\n Math.max(0, ix + x - rs)\n );\n const y1 = Math.min(\n this.bitmap.height - 1,\n Math.max(0, iy + y - rs)\n );\n const weight = weights[iy][ix];\n const idx = (y1 * this.bitmap.width + x1) << 2;\n\n red += this.bitmap.data[idx] * weight;\n green += this.bitmap.data[idx + 1] * weight;\n blue += this.bitmap.data[idx + 2] * weight;\n alpha += this.bitmap.data[idx + 3] * weight;\n wsum += weight;\n }\n\n const idx = (y * this.bitmap.width + x) << 2;\n\n this.bitmap.data[idx] = Math.round(red / wsum);\n this.bitmap.data[idx + 1] = Math.round(green / wsum);\n this.bitmap.data[idx + 2] = Math.round(blue / wsum);\n this.bitmap.data[idx + 3] = Math.round(alpha / wsum);\n }\n }\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,aAAa;;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,GAAGD,MAAM;YAC1CR,KAAK,IAAI,IAAI,CAACN,MAAM,CAACgB,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAGD,MAAM;YAC3CP,IAAI,IAAIO,MAAM;UAChB;UAEA,MAAMC,GAAG,GAAInB,CAAC,GAAG,IAAI,CAACI,MAAM,CAACE,KAAK,GAAGL,CAAC,IAAK,CAAC;UAE5C,IAAI,CAACG,MAAM,CAACgB,IAAI,CAACD,GAAG,CAAC,GAAG1B,IAAI,CAAC4B,KAAK,CAACd,GAAG,GAAGI,IAAI,CAAC;UAC9C,IAAI,CAACP,MAAM,CAACgB,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAG1B,IAAI,CAAC4B,KAAK,CAACb,KAAK,GAAGG,IAAI,CAAC;UACpD,IAAI,CAACP,MAAM,CAACgB,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAG1B,IAAI,CAAC4B,KAAK,CAACZ,IAAI,GAAGE,IAAI,CAAC;UACnD,IAAI,CAACP,MAAM,CAACgB,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAG1B,IAAI,CAAC4B,KAAK,CAACX,KAAK,GAAGC,IAAI,CAAC;QACtD;MACF;IACF;IAEA,IAAIzB,aAAa,CAACI,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/index.d.ts b/project starter code/node_modules/@jimp/plugin-gaussian/index.d.ts index 7f415775..4f9114c9 100644 --- a/project starter code/node_modules/@jimp/plugin-gaussian/index.d.ts +++ b/project starter code/node_modules/@jimp/plugin-gaussian/index.d.ts @@ -1,7 +1,7 @@ -import { ImageCallback } from '@jimp/core'; +import { ImageCallback } from "@jimp/core"; interface Gaussian { gaussian(r: number, cb?: ImageCallback): this; } -export default function(): Gaussian; +export default function (): Gaussian; diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/package.json b/project starter code/node_modules/@jimp/plugin-gaussian/package.json index f73fdcf8..507fb389 100644 --- a/project starter code/node_modules/@jimp/plugin-gaussian/package.json +++ b/project starter code/node_modules/@jimp/plugin-gaussian/package.json @@ -1,9 +1,10 @@ { "name": "@jimp/plugin-gaussian", - "version": "0.16.2", + "version": "0.22.12", "description": "gaussian blur an image.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { "build": "npm run build:node:production && npm run build:module", @@ -17,8 +18,7 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" @@ -26,5 +26,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/plugin-gaussian/src/index.js b/project starter code/node_modules/@jimp/plugin-gaussian/src/index.js index 2a7c25df..21528cb6 100644 --- a/project starter code/node_modules/@jimp/plugin-gaussian/src/index.js +++ b/project starter code/node_modules/@jimp/plugin-gaussian/src/index.js @@ -1,4 +1,4 @@ -import { isNodePattern, throwError } from '@jimp/utils'; +import { isNodePattern, throwError } from "@jimp/utils"; /** * Applies a true Gaussian blur to the image (warning: this is VERY slow) @@ -9,12 +9,12 @@ import { isNodePattern, throwError } from '@jimp/utils'; export default () => ({ gaussian(r, cb) { // http://blog.ivank.net/fastest-gaussian-blur.html - if (typeof r !== 'number') { - return throwError.call(this, 'r must be a number', cb); + if (typeof r !== "number") { + return throwError.call(this, "r must be a number", cb); } if (r < 1) { - return throwError.call(this, 'r must be greater than 0', cb); + return throwError.call(this, "r must be greater than 0", cb); } const rs = Math.ceil(r * 2.57); // significant radius @@ -27,7 +27,7 @@ export default () => ({ for (let y = 0; y < range; y++) { weights[y] = []; for (let x = 0; x < range; x++) { - const dsq = (x - rs) ** 2 + (y - rs) ** 2 ; + const dsq = (x - rs) ** 2 + (y - rs) ** 2; weights[y][x] = Math.exp(-dsq / rr2) / rr2pi; } } @@ -42,8 +42,14 @@ export default () => ({ for (let iy = 0; iy < range; iy++) { for (let ix = 0; ix < range; ix++) { - const x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + x - rs )); - const y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + y - rs)); + const x1 = Math.min( + this.bitmap.width - 1, + Math.max(0, ix + x - rs) + ); + const y1 = Math.min( + this.bitmap.height - 1, + Math.max(0, iy + y - rs) + ); const weight = weights[iy][ix]; const idx = (y1 * this.bitmap.width + x1) << 2; @@ -69,5 +75,5 @@ export default () => ({ } return this; - } + }, }); diff --git a/project starter code/node_modules/@jimp/plugin-invert/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-invert/CHANGELOG.md index 26394e0f..8d029143 100644 --- a/project starter code/node_modules/@jimp/plugin-invert/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/plugin-invert/CHANGELOG.md @@ -1,3 +1,51 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -12,7 +60,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -20,4 +68,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-invert/README.md b/project starter code/node_modules/@jimp/plugin-invert/README.md index 51585dec..e201f584 100644 --- a/project starter code/node_modules/@jimp/plugin-invert/README.md +++ b/project starter code/node_modules/@jimp/plugin-invert/README.md @@ -12,10 +12,10 @@ Invert an image's colors. - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.invert(); } diff --git a/project starter code/node_modules/@jimp/plugin-invert/dist/index.js b/project starter code/node_modules/@jimp/plugin-invert/dist/index.js index e65becc6..a127d9e5 100644 --- a/project starter code/node_modules/@jimp/plugin-invert/dist/index.js +++ b/project starter code/node_modules/@jimp/plugin-invert/dist/index.js @@ -3,33 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - +exports.default = void 0; var _utils = require("@jimp/utils"); - /** * Inverts the image * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ -var _default = function _default() { - return { - invert: function invert(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data[idx] = 255 - this.bitmap.data[idx]; - this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1]; - this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2]; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; +var _default = () => ({ + invert(cb) { + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + this.bitmap.data[idx] = 255 - this.bitmap.data[idx]; + this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1]; + this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2]; + }); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); } - }; -}; - -exports["default"] = _default; + return this; + } +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-invert/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-invert/dist/index.js.map index df886979..672127d1 100644 --- a/project starter code/node_modules/@jimp/plugin-invert/dist/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-invert/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["invert","cb","scanQuiet","bitmap","width","height","x","y","idx","data","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;eAKe;AAAA,SAAO;AACpBA,IAAAA,MADoB,kBACbC,EADa,EACT;AACT,WAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKC,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,aAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAjB,IAAwB,MAAM,KAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAjB,CAA9B;AACA,aAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,MAAM,KAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,CAAlC;AACA,aAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,MAAM,KAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,CAAlC;AACD,OARD;;AAUA,UAAI,0BAAcP,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACS,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAjBmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Inverts the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n invert(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx] = 255 - this.bitmap.data[idx];\n this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1];\n this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["invert","cb","scanQuiet","bitmap","width","height","x","y","idx","data","isNodePattern","call"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Inverts the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n invert(cb) {\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data[idx] = 255 - this.bitmap.data[idx];\n this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1];\n this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2];\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AAJA,eAKe,OAAO;EACpBA,MAAM,CAACC,EAAE,EAAE;IACT,IAAI,CAACC,SAAS,CACZ,CAAC,EACD,CAAC,EACD,IAAI,CAACC,MAAM,CAACC,KAAK,EACjB,IAAI,CAACD,MAAM,CAACE,MAAM,EAClB,UAAUC,CAAC,EAAEC,CAAC,EAAEC,GAAG,EAAE;MACnB,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,CAAC,GAAG,GAAG,GAAG,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,CAAC;MACnD,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC;MAC3D,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC;IAC7D,CAAC,CACF;IAED,IAAI,IAAAE,oBAAa,EAACT,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACU,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-invert/es/index.js b/project starter code/node_modules/@jimp/plugin-invert/es/index.js index 4d4ce18d..61bc06c8 100644 --- a/project starter code/node_modules/@jimp/plugin-invert/es/index.js +++ b/project starter code/node_modules/@jimp/plugin-invert/es/index.js @@ -1,34 +1,21 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); +import { isNodePattern } from "@jimp/utils"; /** * Inverts the image * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ -var _default = function _default() { - return { - invert: function invert(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data[idx] = 255 - this.bitmap.data[idx]; - this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1]; - this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2]; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; +export default (() => ({ + invert(cb) { + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + this.bitmap.data[idx] = 255 - this.bitmap.data[idx]; + this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1]; + this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2]; + }); + if (isNodePattern(cb)) { + cb.call(this, null, this); } - }; -}; - -exports["default"] = _default; + return this; + } +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-invert/es/index.js.map b/project starter code/node_modules/@jimp/plugin-invert/es/index.js.map index df886979..a2fba38f 100644 --- a/project starter code/node_modules/@jimp/plugin-invert/es/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-invert/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["invert","cb","scanQuiet","bitmap","width","height","x","y","idx","data","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;eAKe;AAAA,SAAO;AACpBA,IAAAA,MADoB,kBACbC,EADa,EACT;AACT,WAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKC,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,GAH0D,EAI1D;AACA,aAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAjB,IAAwB,MAAM,KAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAjB,CAA9B;AACA,aAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,MAAM,KAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,CAAlC;AACA,aAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,MAAM,KAAKL,MAAL,CAAYM,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,CAAlC;AACD,OARD;;AAUA,UAAI,0BAAcP,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACS,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAjBmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Inverts the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n invert(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data[idx] = 255 - this.bitmap.data[idx];\n this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1];\n this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2];\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["isNodePattern","invert","cb","scanQuiet","bitmap","width","height","x","y","idx","data","call"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Inverts the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n invert(cb) {\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data[idx] = 255 - this.bitmap.data[idx];\n this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1];\n this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2];\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,aAAa;;AAE3C;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;EACpBC,MAAM,CAACC,EAAE,EAAE;IACT,IAAI,CAACC,SAAS,CACZ,CAAC,EACD,CAAC,EACD,IAAI,CAACC,MAAM,CAACC,KAAK,EACjB,IAAI,CAACD,MAAM,CAACE,MAAM,EAClB,UAAUC,CAAC,EAAEC,CAAC,EAAEC,GAAG,EAAE;MACnB,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,CAAC,GAAG,GAAG,GAAG,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,CAAC;MACnD,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC;MAC3D,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,IAAI,CAACL,MAAM,CAACM,IAAI,CAACD,GAAG,GAAG,CAAC,CAAC;IAC7D,CAAC,CACF;IAED,IAAIT,aAAa,CAACE,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACS,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-invert/index.d.ts b/project starter code/node_modules/@jimp/plugin-invert/index.d.ts index 654051c3..483b5430 100644 --- a/project starter code/node_modules/@jimp/plugin-invert/index.d.ts +++ b/project starter code/node_modules/@jimp/plugin-invert/index.d.ts @@ -1,7 +1,7 @@ -import { ImageCallback } from '@jimp/core'; +import { ImageCallback } from "@jimp/core"; interface Invert { invert(cb?: ImageCallback): this; } -export default function(): Invert; +export default function (): Invert; diff --git a/project starter code/node_modules/@jimp/plugin-invert/package.json b/project starter code/node_modules/@jimp/plugin-invert/package.json index 863a4c18..09b9fee7 100644 --- a/project starter code/node_modules/@jimp/plugin-invert/package.json +++ b/project starter code/node_modules/@jimp/plugin-invert/package.json @@ -1,9 +1,10 @@ { "name": "@jimp/plugin-invert", - "version": "0.16.2", + "version": "0.22.12", "description": "invert an image.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { "build": "npm run build:node:production && npm run build:module", @@ -17,8 +18,7 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" @@ -26,5 +26,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/plugin-invert/src/index.js b/project starter code/node_modules/@jimp/plugin-invert/src/index.js index 24565842..44ad9302 100644 --- a/project starter code/node_modules/@jimp/plugin-invert/src/index.js +++ b/project starter code/node_modules/@jimp/plugin-invert/src/index.js @@ -1,4 +1,4 @@ -import { isNodePattern } from '@jimp/utils'; +import { isNodePattern } from "@jimp/utils"; /** * Inverts the image @@ -7,20 +7,22 @@ import { isNodePattern } from '@jimp/utils'; */ export default () => ({ invert(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - this.bitmap.data[idx] = 255 - this.bitmap.data[idx]; - this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1]; - this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2]; - }); + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + this.bitmap.data[idx] = 255 - this.bitmap.data[idx]; + this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1]; + this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2]; + } + ); if (isNodePattern(cb)) { cb.call(this, null, this); } return this; - } + }, }); diff --git a/project starter code/node_modules/@jimp/plugin-mask/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-mask/CHANGELOG.md index 26394e0f..3d839517 100644 --- a/project starter code/node_modules/@jimp/plugin-mask/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/plugin-mask/CHANGELOG.md @@ -1,3 +1,65 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.22.0 (Mon Feb 06 2023) + +#### 🏠 Internal + +- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Daniel Holmes ([@danielholmes](https://github.com/danielholmes)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -12,7 +74,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -20,4 +82,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-mask/README.md b/project starter code/node_modules/@jimp/plugin-mask/README.md index 97720717..840ce372 100644 --- a/project starter code/node_modules/@jimp/plugin-mask/README.md +++ b/project starter code/node_modules/@jimp/plugin-mask/README.md @@ -15,11 +15,11 @@ Masks a source image on to this image using average pixel colour. A completely b - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); - const mask = await jimp.read('test/mask.png'); + const image = await jimp.read("test/image.png"); + const mask = await jimp.read("test/mask.png"); image.mask(mask); } diff --git a/project starter code/node_modules/@jimp/plugin-mask/dist/index.js b/project starter code/node_modules/@jimp/plugin-mask/dist/index.js index 7c1c03a7..d8434809 100644 --- a/project starter code/node_modules/@jimp/plugin-mask/dist/index.js +++ b/project starter code/node_modules/@jimp/plugin-mask/dist/index.js @@ -3,10 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - +exports.default = void 0; var _utils = require("@jimp/utils"); - /** * Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent. * @param {Jimp} src the source Jimp instance @@ -15,48 +13,43 @@ var _utils = require("@jimp/utils"); * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ -var _default = function _default() { - return { - mask: function mask(src) { - var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; - var y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; - var cb = arguments.length > 3 ? arguments[3] : undefined; - - if (!(src instanceof this.constructor)) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } // round input - - - x = Math.round(x); - y = Math.round(y); - var w = this.bitmap.width; - var h = this.bitmap.height; - var baseImage = this; - src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) { - var destX = x + sx; - var destY = y + sy; - - if (destX >= 0 && destY >= 0 && destX < w && destY < h) { - var dstIdx = baseImage.getPixelIndex(destX, destY); - var data = this.bitmap.data; - var avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3; - baseImage.bitmap.data[dstIdx + 3] *= avg / 255; - } - }); +var _default = () => ({ + mask(src) { + let x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + let y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + let cb = arguments.length > 3 ? arguments[3] : undefined; + if (!(src instanceof this.constructor)) { + return _utils.throwError.call(this, "The source must be a Jimp image", cb); + } + if (typeof x !== "number" || typeof y !== "number") { + return _utils.throwError.call(this, "x and y must be numbers", cb); + } - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); + // round input + x = Math.round(x); + y = Math.round(y); + const w = this.bitmap.width; + const h = this.bitmap.height; + const baseImage = this; + src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) { + const destX = x + sx; + const destY = y + sy; + if (destX >= 0 && destY >= 0 && destX < w && destY < h) { + const dstIdx = baseImage.getPixelIndex(destX, destY); + const { + data + } = this.bitmap; + const avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3; + baseImage.bitmap.data[dstIdx + 3] *= avg / 255; } - - return this; + }); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); } - }; -}; - -exports["default"] = _default; + return this; + } +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-mask/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-mask/dist/index.js.map index 4a01d592..b28fd47c 100644 --- a/project starter code/node_modules/@jimp/plugin-mask/dist/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-mask/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["mask","src","x","y","cb","constructor","throwError","call","Math","round","w","bitmap","width","h","height","baseImage","scanQuiet","sx","sy","idx","destX","destY","dstIdx","getPixelIndex","data","avg"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;eAQe;AAAA,SAAO;AACpBA,IAAAA,IADoB,gBACfC,GADe,EACQ;AAAA,UAAlBC,CAAkB,uEAAd,CAAc;AAAA,UAAXC,CAAW,uEAAP,CAAO;AAAA,UAAJC,EAAI;;AAC1B,UAAI,EAAEH,GAAG,YAAY,KAAKI,WAAtB,CAAJ,EAAwC;AACtC,eAAOC,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,iCAAtB,EAAyDH,EAAzD,CAAP;AACD;;AAED,UAAI,OAAOF,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,eAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDH,EAAjD,CAAP;AACD,OAPyB,CAS1B;;;AACAF,MAAAA,CAAC,GAAGM,IAAI,CAACC,KAAL,CAAWP,CAAX,CAAJ;AACAC,MAAAA,CAAC,GAAG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utils';\n\n/**\n * Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent.\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the horizontal position to blit the image\n * @param {number} y the vertical position to blit the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n mask(src, x = 0, y = 0, cb) {\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const baseImage = this;\n\n src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function(\n sx,\n sy,\n idx\n ) {\n const destX = x + sx;\n const destY = y + sy;\n\n if (destX >= 0 && destY >= 0 && destX < w && destY < h) {\n const dstIdx = baseImage.getPixelIndex(destX, destY);\n const { data } = this.bitmap;\n const avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3;\n\n baseImage.bitmap.data[dstIdx + 3] *= avg / 255;\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["mask","src","x","y","cb","constructor","throwError","call","Math","round","w","bitmap","width","h","height","baseImage","scanQuiet","sx","sy","idx","destX","destY","dstIdx","getPixelIndex","data","avg","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent.\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the horizontal position to blit the image\n * @param {number} y the vertical position to blit the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n mask(src, x = 0, y = 0, cb) {\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const baseImage = this;\n\n src.scanQuiet(\n 0,\n 0,\n src.bitmap.width,\n src.bitmap.height,\n function (sx, sy, idx) {\n const destX = x + sx;\n const destY = y + sy;\n\n if (destX >= 0 && destY >= 0 && destX < w && destY < h) {\n const dstIdx = baseImage.getPixelIndex(destX, destY);\n const { data } = this.bitmap;\n const avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3;\n\n baseImage.bitmap.data[dstIdx + 3] *= avg / 255;\n }\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,eAQe,OAAO;EACpBA,IAAI,CAACC,GAAG,EAAoB;IAAA,IAAlBC,CAAC,uEAAG,CAAC;IAAA,IAAEC,CAAC,uEAAG,CAAC;IAAA,IAAEC,EAAE;IACxB,IAAI,EAAEH,GAAG,YAAY,IAAI,CAACI,WAAW,CAAC,EAAE;MACtC,OAAOC,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,iCAAiC,EAAEH,EAAE,CAAC;IACrE;IAEA,IAAI,OAAOF,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAAE;MAClD,OAAOG,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAEH,EAAE,CAAC;IAC7D;;IAEA;IACAF,CAAC,GAAGM,IAAI,CAACC,KAAK,CAACP,CAAC,CAAC;IACjBC,CAAC,GAAGK,IAAI,CAACC,KAAK,CAACN,CAAC,CAAC;IAEjB,MAAMO,CAAC,GAAG,IAAI,CAACC,MAAM,CAACC,KAAK;IAC3B,MAAMC,CAAC,GAAG,IAAI,CAACF,MAAM,CAACG,MAAM;IAC5B,MAAMC,SAAS,GAAG,IAAI;IAEtBd,GAAG,CAACe,SAAS,CACX,CAAC,EACD,CAAC,EACDf,GAAG,CAACU,MAAM,CAACC,KAAK,EAChBX,GAAG,CAACU,MAAM,CAACG,MAAM,EACjB,UAAUG,EAAE,EAAEC,EAAE,EAAEC,GAAG,EAAE;MACrB,MAAMC,KAAK,GAAGlB,CAAC,GAAGe,EAAE;MACpB,MAAMI,KAAK,GAAGlB,CAAC,GAAGe,EAAE;MAEpB,IAAIE,KAAK,IAAI,CAAC,IAAIC,KAAK,IAAI,CAAC,IAAID,KAAK,GAAGV,CAAC,IAAIW,KAAK,GAAGR,CAAC,EAAE;QACtD,MAAMS,MAAM,GAAGP,SAAS,CAACQ,aAAa,CAACH,KAAK,EAAEC,KAAK,CAAC;QACpD,MAAM;UAAEG;QAAK,CAAC,GAAG,IAAI,CAACb,MAAM;QAC5B,MAAMc,GAAG,GAAG,CAACD,IAAI,CAACL,GAAG,GAAG,CAAC,CAAC,GAAGK,IAAI,CAACL,GAAG,GAAG,CAAC,CAAC,GAAGK,IAAI,CAACL,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC;QAE/DJ,SAAS,CAACJ,MAAM,CAACa,IAAI,CAACF,MAAM,GAAG,CAAC,CAAC,IAAIG,GAAG,GAAG,GAAG;MAChD;IACF,CAAC,CACF;IAED,IAAI,IAAAC,oBAAa,EAACtB,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACG,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-mask/es/index.js b/project starter code/node_modules/@jimp/plugin-mask/es/index.js index 2bb7a119..ba52d216 100644 --- a/project starter code/node_modules/@jimp/plugin-mask/es/index.js +++ b/project starter code/node_modules/@jimp/plugin-mask/es/index.js @@ -1,11 +1,4 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); +import { isNodePattern, throwError } from "@jimp/utils"; /** * Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent. @@ -15,47 +8,40 @@ var _utils = require("@jimp/utils"); * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ -var _default = function _default() { - return { - mask: function mask(src) { - var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; - var y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; - var cb = arguments.length > 3 ? arguments[3] : undefined; - - if (!(src instanceof this.constructor)) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } // round input - - - x = Math.round(x); - y = Math.round(y); - var w = this.bitmap.width; - var h = this.bitmap.height; - var baseImage = this; - src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) { - var destX = x + sx; - var destY = y + sy; - - if (destX >= 0 && destY >= 0 && destX < w && destY < h) { - var dstIdx = baseImage.getPixelIndex(destX, destY); - var data = this.bitmap.data; - var avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3; - baseImage.bitmap.data[dstIdx + 3] *= avg / 255; - } - }); +export default (() => ({ + mask(src) { + let x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + let y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; + let cb = arguments.length > 3 ? arguments[3] : undefined; + if (!(src instanceof this.constructor)) { + return throwError.call(this, "The source must be a Jimp image", cb); + } + if (typeof x !== "number" || typeof y !== "number") { + return throwError.call(this, "x and y must be numbers", cb); + } - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); + // round input + x = Math.round(x); + y = Math.round(y); + const w = this.bitmap.width; + const h = this.bitmap.height; + const baseImage = this; + src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) { + const destX = x + sx; + const destY = y + sy; + if (destX >= 0 && destY >= 0 && destX < w && destY < h) { + const dstIdx = baseImage.getPixelIndex(destX, destY); + const { + data + } = this.bitmap; + const avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3; + baseImage.bitmap.data[dstIdx + 3] *= avg / 255; } - - return this; + }); + if (isNodePattern(cb)) { + cb.call(this, null, this); } - }; -}; - -exports["default"] = _default; + return this; + } +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-mask/es/index.js.map b/project starter code/node_modules/@jimp/plugin-mask/es/index.js.map index 4a01d592..fed87ab8 100644 --- a/project starter code/node_modules/@jimp/plugin-mask/es/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-mask/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["mask","src","x","y","cb","constructor","throwError","call","Math","round","w","bitmap","width","h","height","baseImage","scanQuiet","sx","sy","idx","destX","destY","dstIdx","getPixelIndex","data","avg"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;eAQe;AAAA,SAAO;AACpBA,IAAAA,IADoB,gBACfC,GADe,EACQ;AAAA,UAAlBC,CAAkB,uEAAd,CAAc;AAAA,UAAXC,CAAW,uEAAP,CAAO;AAAA,UAAJC,EAAI;;AAC1B,UAAI,EAAEH,GAAG,YAAY,KAAKI,WAAtB,CAAJ,EAAwC;AACtC,eAAOC,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,iCAAtB,EAAyDH,EAAzD,CAAP;AACD;;AAED,UAAI,OAAOF,CAAP,KAAa,QAAb,IAAyB,OAAOC,CAAP,KAAa,QAA1C,EAAoD;AAClD,eAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDH,EAAjD,CAAP;AACD,OAPyB,CA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AAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAxCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent.\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the horizontal position to blit the image\n * @param {number} y the vertical position to blit the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n mask(src, x = 0, y = 0, cb) {\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, 'The source must be a Jimp image', cb);\n }\n\n if (typeof x !== 'number' || typeof y !== 'number') {\n return throwError.call(this, 'x and y must be numbers', cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const baseImage = this;\n\n src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function(\n sx,\n sy,\n idx\n ) {\n const destX = x + sx;\n const destY = y + sy;\n\n if (destX >= 0 && destY >= 0 && destX < w && destY < h) {\n const dstIdx = baseImage.getPixelIndex(destX, destY);\n const { data } = this.bitmap;\n const avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3;\n\n baseImage.bitmap.data[dstIdx + 3] *= avg / 255;\n }\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["isNodePattern","throwError","mask","src","x","y","cb","constructor","call","Math","round","w","bitmap","width","h","height","baseImage","scanQuiet","sx","sy","idx","destX","destY","dstIdx","getPixelIndex","data","avg"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent.\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the horizontal position to blit the image\n * @param {number} y the vertical position to blit the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n mask(src, x = 0, y = 0, cb) {\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const baseImage = this;\n\n src.scanQuiet(\n 0,\n 0,\n src.bitmap.width,\n src.bitmap.height,\n function (sx, sy, idx) {\n const destX = x + sx;\n const destY = y + sy;\n\n if (destX >= 0 && destY >= 0 && destX < w && destY < h) {\n const dstIdx = baseImage.getPixelIndex(destX, destY);\n const { data } = this.bitmap;\n const avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3;\n\n baseImage.bitmap.data[dstIdx + 3] *= avg / 255;\n }\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;EACpBC,IAAI,CAACC,GAAG,EAAoB;IAAA,IAAlBC,CAAC,uEAAG,CAAC;IAAA,IAAEC,CAAC,uEAAG,CAAC;IAAA,IAAEC,EAAE;IACxB,IAAI,EAAEH,GAAG,YAAY,IAAI,CAACI,WAAW,CAAC,EAAE;MACtC,OAAON,UAAU,CAACO,IAAI,CAAC,IAAI,EAAE,iCAAiC,EAAEF,EAAE,CAAC;IACrE;IAEA,IAAI,OAAOF,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAAE;MAClD,OAAOJ,UAAU,CAACO,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAEF,EAAE,CAAC;IAC7D;;IAEA;IACAF,CAAC,GAAGK,IAAI,CAAC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index.d.ts b/project starter code/node_modules/@jimp/plugin-mask/index.d.ts index 01092b81..8effa592 100644 --- a/project starter code/node_modules/@jimp/plugin-mask/index.d.ts +++ b/project starter code/node_modules/@jimp/plugin-mask/index.d.ts @@ -1,7 +1,7 @@ -import { ImageCallback, Jimp } from '@jimp/core'; +import { ImageCallback, Jimp } from "@jimp/core"; interface Mask { mask(src: Jimp, x: number, y: number, cb?: ImageCallback): this; } -export default function(): Mask; +export default function (): Mask; diff --git a/project starter code/node_modules/@jimp/plugin-mask/package.json b/project starter code/node_modules/@jimp/plugin-mask/package.json index 6b10d9eb..3faf2647 100644 --- a/project starter code/node_modules/@jimp/plugin-mask/package.json +++ b/project starter code/node_modules/@jimp/plugin-mask/package.json @@ -1,12 +1,13 @@ { "name": "@jimp/plugin-mask", - "version": "0.16.2", + "version": "0.22.12", "description": "mask an image.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js", "test:watch": "npm run test -- --reporter min --watch", "test:coverage": "nyc npm run test", "build": "npm run build:node:production && npm run build:module", @@ -20,18 +21,17 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" }, "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/test-utils": "^0.16.2" + "@jimp/custom": "^0.22.12", + "@jimp/test-utils": "^0.22.12" }, "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/plugin-mask/src/index.js b/project starter code/node_modules/@jimp/plugin-mask/src/index.js index 92a5f5f1..2a6b32d4 100644 --- a/project starter code/node_modules/@jimp/plugin-mask/src/index.js +++ b/project starter code/node_modules/@jimp/plugin-mask/src/index.js @@ -1,4 +1,4 @@ -import { isNodePattern, throwError } from '@jimp/utils'; +import { isNodePattern, throwError } from "@jimp/utils"; /** * Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent. @@ -11,11 +11,11 @@ import { isNodePattern, throwError } from '@jimp/utils'; export default () => ({ mask(src, x = 0, y = 0, cb) { if (!(src instanceof this.constructor)) { - return throwError.call(this, 'The source must be a Jimp image', cb); + return throwError.call(this, "The source must be a Jimp image", cb); } - if (typeof x !== 'number' || typeof y !== 'number') { - return throwError.call(this, 'x and y must be numbers', cb); + if (typeof x !== "number" || typeof y !== "number") { + return throwError.call(this, "x and y must be numbers", cb); } // round input @@ -26,27 +26,29 @@ export default () => ({ const h = this.bitmap.height; const baseImage = this; - src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function( - sx, - sy, - idx - ) { - const destX = x + sx; - const destY = y + sy; - - if (destX >= 0 && destY >= 0 && destX < w && destY < h) { - const dstIdx = baseImage.getPixelIndex(destX, destY); - const { data } = this.bitmap; - const avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3; - - baseImage.bitmap.data[dstIdx + 3] *= avg / 255; + src.scanQuiet( + 0, + 0, + src.bitmap.width, + src.bitmap.height, + function (sx, sy, idx) { + const destX = x + sx; + const destY = y + sy; + + if (destX >= 0 && destY >= 0 && destX < w && destY < h) { + const dstIdx = baseImage.getPixelIndex(destX, destY); + const { data } = this.bitmap; + const avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3; + + baseImage.bitmap.data[dstIdx + 3] *= avg / 255; + } } - }); + ); if (isNodePattern(cb)) { cb.call(this, null, this); } return this; - } + }, }); diff --git a/project starter code/node_modules/@jimp/plugin-mask/test/mask.test.js b/project starter code/node_modules/@jimp/plugin-mask/test/mask.test.js index eebcf15e..e63713f6 100644 --- a/project starter code/node_modules/@jimp/plugin-mask/test/mask.test.js +++ b/project starter code/node_modules/@jimp/plugin-mask/test/mask.test.js @@ -1,26 +1,27 @@ -import { Jimp, mkJGD } from '@jimp/test-utils'; -import configure from '@jimp/custom'; +import { Jimp, mkJGD } from "@jimp/test-utils"; +import configure from "@jimp/custom"; -import mask from '../src'; +import mask from "../src"; +import { expectToBeJGD } from "@jimp/test-utils/src"; const jimp = configure({ plugins: [mask] }, Jimp); -describe('Mask', () => { +describe("Mask", () => { let imgSrcOpaq; let imgSrcAlpa; let maskGrayBig; let maskGraySmall; let maskColor; - before(done => { + before((done) => { Promise.all([ - jimp.read(mkJGD('▴□▾□■□', '■▴■▾■□', '■□▴□▾□', '■□■▴■▾')), - jimp.read(mkJGD('▴▵▾▿', '▴▵▾▿', '▴▵▾▿')), - jimp.read(mkJGD('048840', '8CFFC8', '8CFFC8', '048840')), - jimp.read(mkJGD('0369', '369C', '69CF')), - jimp.read(mkJGD('▴▴▾▾', '▪▪▰▰', '□□□□')) + jimp.read(mkJGD("▴□▾□■□", "■▴■▾■□", "■□▴□▾□", "■□■▴■▾")), + jimp.read(mkJGD("▴▵▾▿", "▴▵▾▿", "▴▵▾▿")), + jimp.read(mkJGD("048840", "8CFFC8", "8CFFC8", "048840")), + jimp.read(mkJGD("0369", "369C", "69CF")), + jimp.read(mkJGD("▴▴▾▾", "▪▪▰▰", "□□□□")), ]) - .then(imgs => { + .then((imgs) => { imgSrcOpaq = imgs[0]; imgSrcAlpa = imgs[1]; maskGrayBig = imgs[2]; @@ -31,275 +32,103 @@ describe('Mask', () => { .catch(done); }); - it('Affect opaque image with a gray mask with the same size', () => { - imgSrcOpaq - .clone() - .mask(maskGrayBig) - .getJGDSync() - .should.be.sameJGD({ - width: 6, - height: 4, - data: [ - 0xff000000, - 0xffffff44, - 0x0000ff88, - 0xffffff88, - 0x00000044, - 0xffffff00, - 0x00000088, - 0xff0000cc, - 0x000000ff, - 0x0000ffff, - 0x000000cc, - 0xffffff88, - 0x00000088, - 0xffffffcc, - 0xff0000ff, - 0xffffffff, - 0x0000ffcc, - 0xffffff88, - 0x00000000, - 0xffffff44, - 0x00000088, - 0xff000088, - 0x00000044, - 0x0000ff00 - ] - }); + it("Affect opaque image with a gray mask with the same size", () => { + expectToBeJGD(imgSrcOpaq.clone().mask(maskGrayBig).getJGDSync(), { + width: 6, + height: 4, + data: [ + 0xff000000, 0xffffff44, 0x0000ff88, 0xffffff88, 0x00000044, 0xffffff00, + 0x00000088, 0xff0000cc, 0x000000ff, 0x0000ffff, 0x000000cc, 0xffffff88, + 0x00000088, 0xffffffcc, 0xff0000ff, 0xffffffff, 0x0000ffcc, 0xffffff88, + 0x00000000, 0xffffff44, 0x00000088, 0xff000088, 0x00000044, 0x0000ff00, + ], + }); }); - it('Affect opaque image with a gray mask with the same size, blited', () => { - imgSrcOpaq - .clone() - .mask(maskGrayBig, 1, 1) - .getJGDSync() - .should.be.sameJGD({ - width: 6, - height: 4, - data: [ - 0xff0000ff, - 0xffffffff, - 0x0000ffff, - 0xffffffff, - 0x000000ff, - 0xffffffff, - 0x000000ff, - 0xff000000, - 0x00000044, - 0x0000ff88, - 0x00000088, - 0xffffff44, - 0x000000ff, - 0xffffff88, - 0xff0000cc, - 0xffffffff, - 0x0000ffff, - 0xffffffcc, - 0x000000ff, - 0xffffff88, - 0x000000cc, - 0xff0000ff, - 0x000000ff, - 0x0000ffcc - ] - }); + it("Affect opaque image with a gray mask with the same size, blited", () => { + expectToBeJGD(imgSrcOpaq.clone().mask(maskGrayBig, 1, 1).getJGDSync(), { + width: 6, + height: 4, + data: [ + 0xff0000ff, 0xffffffff, 0x0000ffff, 0xffffffff, 0x000000ff, 0xffffffff, + 0x000000ff, 0xff000000, 0x00000044, 0x0000ff88, 0x00000088, 0xffffff44, + 0x000000ff, 0xffffff88, 0xff0000cc, 0xffffffff, 0x0000ffff, 0xffffffcc, + 0x000000ff, 0xffffff88, 0x000000cc, 0xff0000ff, 0x000000ff, 0x0000ffcc, + ], + }); }); - it('Affect opaque image with a gray mask with the same size, blited negative', () => { - imgSrcOpaq - .clone() - .mask(maskGrayBig, -1, -1) - .getJGDSync() - .should.be.sameJGD({ - width: 6, - height: 4, - data: [ - 0xff0000cc, - 0xffffffff, - 0x0000ffff, - 0xffffffcc, - 0x00000088, - 0xffffffff, - 0x000000cc, - 0xff0000ff, - 0x000000ff, - 0x0000ffcc, - 0x00000088, - 0xffffffff, - 0x00000044, - 0xffffff88, - 0xff000088, - 0xffffff44, - 0x0000ff00, - 0xffffffff, - 0x000000ff, - 0xffffffff, - 0x000000ff, - 0xff0000ff, - 0x000000ff, - 0x0000ffff - ] - }); + it("Affect opaque image with a gray mask with the same size, blited negative", () => { + expectToBeJGD(imgSrcOpaq.clone().mask(maskGrayBig, -1, -1).getJGDSync(), { + width: 6, + height: 4, + data: [ + 0xff0000cc, 0xffffffff, 0x0000ffff, 0xffffffcc, 0x00000088, 0xffffffff, + 0x000000cc, 0xff0000ff, 0x000000ff, 0x0000ffcc, 0x00000088, 0xffffffff, + 0x00000044, 0xffffff88, 0xff000088, 0xffffff44, 0x0000ff00, 0xffffffff, + 0x000000ff, 0xffffffff, 0x000000ff, 0xff0000ff, 0x000000ff, 0x0000ffff, + ], + }); }); - it('Affect opaque image with a smaller gray mask', () => { - imgSrcOpaq - .clone() - .mask(maskGraySmall) - .getJGDSync() - .should.be.sameJGD({ - width: 6, - height: 4, - data: [ - 0xff000000, - 0xffffff33, - 0x0000ff66, - 0xffffff99, - 0x000000ff, - 0xffffffff, - 0x00000033, - 0xff000066, - 0x00000099, - 0x0000ffcc, - 0x000000ff, - 0xffffffff, - 0x00000066, - 0xffffff99, - 0xff0000cc, - 0xffffffff, - 0x0000ffff, - 0xffffffff, - 0x000000ff, - 0xffffffff, - 0x000000ff, - 0xff0000ff, - 0x000000ff, - 0x0000ffff - ] - }); + it("Affect opaque image with a smaller gray mask", () => { + expectToBeJGD(imgSrcOpaq.clone().mask(maskGraySmall).getJGDSync(), { + width: 6, + height: 4, + data: [ + 0xff000000, 0xffffff33, 0x0000ff66, 0xffffff99, 0x000000ff, 0xffffffff, + 0x00000033, 0xff000066, 0x00000099, 0x0000ffcc, 0x000000ff, 0xffffffff, + 0x00000066, 0xffffff99, 0xff0000cc, 0xffffffff, 0x0000ffff, 0xffffffff, + 0x000000ff, 0xffffffff, 0x000000ff, 0xff0000ff, 0x000000ff, 0x0000ffff, + ], + }); }); - it('Affect opaque image with a smaller gray mask, blited', () => { - imgSrcOpaq - .clone() - .mask(maskGraySmall, 1, 1) - .getJGDSync() - .should.be.sameJGD({ - width: 6, - height: 4, - data: [ - 0xff0000ff, - 0xffffffff, - 0x0000ffff, - 0xffffffff, - 0x000000ff, - 0xffffffff, - 0x000000ff, - 0xff000000, - 0x00000033, - 0x0000ff66, - 0x00000099, - 0xffffffff, - 0x000000ff, - 0xffffff33, - 0xff000066, - 0xffffff99, - 0x0000ffcc, - 0xffffffff, - 0x000000ff, - 0xffffff66, - 0x00000099, - 0xff0000cc, - 0x000000ff, - 0x0000ffff - ] - }); + it("Affect opaque image with a smaller gray mask, blited", () => { + expectToBeJGD(imgSrcOpaq.clone().mask(maskGraySmall, 1, 1).getJGDSync(), { + width: 6, + height: 4, + data: [ + 0xff0000ff, 0xffffffff, 0x0000ffff, 0xffffffff, 0x000000ff, 0xffffffff, + 0x000000ff, 0xff000000, 0x00000033, 0x0000ff66, 0x00000099, 0xffffffff, + 0x000000ff, 0xffffff33, 0xff000066, 0xffffff99, 0x0000ffcc, 0xffffffff, + 0x000000ff, 0xffffff66, 0x00000099, 0xff0000cc, 0x000000ff, 0x0000ffff, + ], + }); }); - it('Affect alpha image with a bigger gray mask', () => { - imgSrcAlpa - .clone() - .mask(maskGrayBig) - .getJGDSync() - .should.be.sameJGD({ - width: 4, - height: 3, - data: [ - 0xff000000, - 0xff000021, - 0x0000ff88, - 0x0000ff43, - 0xff000088, - 0xff000065, - 0x0000ffff, - 0x0000ff7f, - 0xff000088, - 0xff000065, - 0x0000ffff, - 0x0000ff7f - ] - }); + it("Affect alpha image with a bigger gray mask", () => { + expectToBeJGD(imgSrcAlpa.clone().mask(maskGrayBig).getJGDSync(), { + width: 4, + height: 3, + data: [ + 0xff000000, 0xff000021, 0x0000ff88, 0x0000ff43, 0xff000088, 0xff000065, + 0x0000ffff, 0x0000ff7f, 0xff000088, 0xff000065, 0x0000ffff, 0x0000ff7f, + ], + }); }); - it('Affect alpha image with a bigger gray mask, blited', () => { - imgSrcAlpa - .clone() - .mask(maskGrayBig, -1, -1) - .getJGDSync() - .should.be.sameJGD({ - width: 4, - height: 3, - data: [ - 0xff0000cc, - 0xff00007f, - 0x0000ffff, - 0x0000ff65, - 0xff0000cc, - 0xff00007f, - 0x0000ffff, - 0x0000ff65, - 0xff000044, - 0xff000043, - 0x0000ff88, - 0x0000ff21 - ] - }); + it("Affect alpha image with a bigger gray mask, blited", () => { + expectToBeJGD(imgSrcAlpa.clone().mask(maskGrayBig, -1, -1).getJGDSync(), { + width: 4, + height: 3, + data: [ + 0xff0000cc, 0xff00007f, 0x0000ffff, 0x0000ff65, 0xff0000cc, 0xff00007f, + 0x0000ffff, 0x0000ff65, 0xff000044, 0xff000043, 0x0000ff88, 0x0000ff21, + ], + }); }); - it('Affect opaque image with a colored mask', () => { - imgSrcOpaq - .clone() - .mask(maskColor, 1, 1) - .getJGDSync() - .should.be.sameJGD({ - width: 6, - height: 4, - data: [ - 0xff0000ff, - 0xffffffff, - 0x0000ffff, - 0xffffffff, - 0x000000ff, - 0xffffffff, - 0x000000ff, - 0xff000055, - 0x00000055, - 0x0000ff55, - 0x00000055, - 0xffffffff, - 0x000000ff, - 0xffffffaa, - 0xff0000aa, - 0xffffffaa, - 0x0000ffaa, - 0xffffffff, - 0x000000ff, - 0xffffffff, - 0x000000ff, - 0xff0000ff, - 0x000000ff, - 0x0000ffff - ] - }); + it("Affect opaque image with a colored mask", () => { + expectToBeJGD(imgSrcOpaq.clone().mask(maskColor, 1, 1).getJGDSync(), { + width: 6, + height: 4, + data: [ + 0xff0000ff, 0xffffffff, 0x0000ffff, 0xffffffff, 0x000000ff, 0xffffffff, + 0x000000ff, 0xff000055, 0x00000055, 0x0000ff55, 0x00000055, 0xffffffff, + 0x000000ff, 0xffffffaa, 0xff0000aa, 0xffffffaa, 0x0000ffaa, 0xffffffff, + 0x000000ff, 0xffffffff, 0x000000ff, 0xff0000ff, 0x000000ff, 0x0000ffff, + ], + }); }); }); diff --git a/project starter code/node_modules/@jimp/plugin-normalize/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-normalize/CHANGELOG.md index 26394e0f..3d839517 100644 --- a/project starter code/node_modules/@jimp/plugin-normalize/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/plugin-normalize/CHANGELOG.md @@ -1,3 +1,65 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.22.0 (Mon Feb 06 2023) + +#### 🏠 Internal + +- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Daniel Holmes ([@danielholmes](https://github.com/danielholmes)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -12,7 +74,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -20,4 +82,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-normalize/README.md b/project starter code/node_modules/@jimp/plugin-normalize/README.md index bca72509..19ba914d 100644 --- a/project starter code/node_modules/@jimp/plugin-normalize/README.md +++ b/project starter code/node_modules/@jimp/plugin-normalize/README.md @@ -12,10 +12,10 @@ Normalizes an images color by computing a histogram. - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.normalize(); } diff --git a/project starter code/node_modules/@jimp/plugin-normalize/dist/index.js b/project starter code/node_modules/@jimp/plugin-normalize/dist/index.js index d5a04e60..be2453a6 100644 --- a/project starter code/node_modules/@jimp/plugin-normalize/dist/index.js +++ b/project starter code/node_modules/@jimp/plugin-normalize/dist/index.js @@ -3,16 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - +exports.default = void 0; var _utils = require("@jimp/utils"); - /** * Get an image's histogram * @return {object} An object with an array of color occurrence counts for each channel (r,g,b) */ function histogram() { - var histogram = { + const histogram = { r: new Array(256).fill(0), g: new Array(256).fill(0), b: new Array(256).fill(0) @@ -24,6 +22,7 @@ function histogram() { }); return histogram; } + /** * Normalize values * @param {integer} value Pixel channel value. @@ -31,55 +30,45 @@ function histogram() { * @param {integer} max Maximum value for channel * @return {integer} normalized values */ - - -var _normalize = function normalize(value, min, max) { +const normalize = function (value, min, max) { return (value - min) * 255 / (max - min); }; - -var getBounds = function getBounds(histogramChannel) { - return [histogramChannel.findIndex(function (value) { - return value > 0; - }), 255 - histogramChannel.slice().reverse().findIndex(function (value) { - return value > 0; - })]; +const getBounds = function (histogramChannel) { + return [histogramChannel.findIndex(value => value > 0), 255 - histogramChannel.slice().reverse().findIndex(value => value > 0)]; }; + /** * Normalizes the image * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ +var _default = () => ({ + normalize(cb) { + const h = histogram.call(this); + // store bounds (minimum and maximum values) + const bounds = { + r: getBounds(h.r), + g: getBounds(h.g), + b: getBounds(h.b) + }; -var _default = function _default() { - return { - normalize: function normalize(cb) { - var h = histogram.call(this); // store bounds (minimum and maximum values) - - var bounds = { - r: getBounds(h.r), - g: getBounds(h.g), - b: getBounds(h.b) - }; // apply value transformations - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var r = this.bitmap.data[idx + 0]; - var g = this.bitmap.data[idx + 1]; - var b = this.bitmap.data[idx + 2]; - this.bitmap.data[idx + 0] = _normalize(r, bounds.r[0], bounds.r[1]); - this.bitmap.data[idx + 1] = _normalize(g, bounds.g[0], bounds.g[1]); - this.bitmap.data[idx + 2] = _normalize(b, bounds.b[0], bounds.b[1]); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; + // apply value transformations + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + const r = this.bitmap.data[idx + 0]; + const g = this.bitmap.data[idx + 1]; + const b = this.bitmap.data[idx + 2]; + this.bitmap.data[idx + 0] = normalize(r, bounds.r[0], bounds.r[1]); + this.bitmap.data[idx + 1] = normalize(g, bounds.g[0], bounds.g[1]); + this.bitmap.data[idx + 2] = normalize(b, bounds.b[0], bounds.b[1]); + }); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); } - }; -}; - -exports["default"] = _default; + return this; + } +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-normalize/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-normalize/dist/index.js.map index 4d6f08af..acaa5ff3 100644 --- a/project starter code/node_modules/@jimp/plugin-normalize/dist/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-normalize/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["histogram","r","Array","fill","g","b","scanQuiet","bitmap","width","height","x","y","index","data","normalize","value","min","max","getBounds","histogramChannel","findIndex","slice","reverse","cb","h","call","bounds","idx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AAS,CAACV,CAAD,EAAIsB,MAAM,CAACtB,CAAP,CAAS,CAAT,CAAJ,EAAiBsB,MAAM,CAACtB,CAAP,CAAS,CAAT,CAAjB,CAArC;AACA,aAAKG,MAAL,CAAYM,IAAZ,CAAiBc,GAAG,GAAG,CAAvB,IAA4Bb,UAAS,CAACT,CAAD,EAAIqB,MAAM,CAACrB,CAAP,CAAS,CAAT,CAAJ,EAAiBqB,MAAM,CAACrB,CAAP,CAAS,CAAT,CAAjB,CAArC;AACD,OAZD;;AAcA,UAAI,0BAAckB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA/BmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Get an image's histogram\n * @return {object} An object with an array of color occurrence counts for each channel (r,g,b)\n */\nfunction histogram() {\n const histogram = {\n r: new Array(256).fill(0),\n g: new Array(256).fill(0),\n b: new Array(256).fill(0)\n };\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n index\n ) {\n histogram.r[this.bitmap.data[index + 0]]++;\n histogram.g[this.bitmap.data[index + 1]]++;\n histogram.b[this.bitmap.data[index + 2]]++;\n });\n\n return histogram;\n}\n\n/**\n * Normalize values\n * @param {integer} value Pixel channel value.\n * @param {integer} min Minimum value for channel\n * @param {integer} max Maximum value for channel\n * @return {integer} normalized values\n */\nconst normalize = function(value, min, max) {\n return ((value - min) * 255) / (max - min);\n};\n\nconst getBounds = function(histogramChannel) {\n return [\n histogramChannel.findIndex(value => value > 0),\n 255 -\n histogramChannel\n .slice()\n .reverse()\n .findIndex(value => value > 0)\n ];\n};\n\n/**\n * Normalizes the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n normalize(cb) {\n const h = histogram.call(this);\n\n // store bounds (minimum and maximum values)\n const bounds = {\n r: getBounds(h.r),\n g: getBounds(h.g),\n b: getBounds(h.b)\n };\n\n // apply value transformations\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const r = this.bitmap.data[idx + 0];\n const g = this.bitmap.data[idx + 1];\n const b = this.bitmap.data[idx + 2];\n\n this.bitmap.data[idx + 0] = normalize(r, bounds.r[0], bounds.r[1]);\n this.bitmap.data[idx + 1] = normalize(g, bounds.g[0], bounds.g[1]);\n this.bitmap.data[idx + 2] = normalize(b, bounds.b[0], bounds.b[1]);\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["histogram","r","Array","fill","g","b","scanQuiet","bitmap","width","height","x","y","index","data","normalize","value","min","max","getBounds","histogramChannel","findIndex","slice","reverse","cb","h","call","bounds","idx","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Get an image's histogram\n * @return {object} An object with an array of color occurrence counts for each channel (r,g,b)\n */\nfunction histogram() {\n const histogram = {\n r: new Array(256).fill(0),\n g: new Array(256).fill(0),\n b: new Array(256).fill(0),\n };\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, index) {\n histogram.r[this.bitmap.data[index + 0]]++;\n histogram.g[this.bitmap.data[index + 1]]++;\n histogram.b[this.bitmap.data[index + 2]]++;\n }\n );\n\n return histogram;\n}\n\n/**\n * Normalize values\n * @param {integer} value Pixel channel value.\n * @param {integer} min Minimum value for channel\n * @param {integer} max Maximum value for channel\n * @return {integer} normalized values\n */\nconst normalize = function (value, min, max) {\n return ((value - min) * 255) / (max - min);\n};\n\nconst getBounds = function (histogramChannel) {\n return [\n histogramChannel.findIndex((value) => value > 0),\n 255 -\n histogramChannel\n .slice()\n .reverse()\n .findIndex((value) => value > 0),\n ];\n};\n\n/**\n * Normalizes the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n normalize(cb) {\n const h = histogram.call(this);\n\n // store bounds (minimum and maximum values)\n const bounds = {\n r: getBounds(h.r),\n g: getBounds(h.g),\n b: getBounds(h.b),\n };\n\n // apply value transformations\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const r = this.bitmap.data[idx + 0];\n const g = this.bitmap.data[idx + 1];\n const b = this.bitmap.data[idx + 2];\n\n this.bitmap.data[idx + 0] = normalize(r, bounds.r[0], bounds.r[1]);\n this.bitmap.data[idx + 1] = normalize(g, bounds.g[0], bounds.g[1]);\n this.bitmap.data[idx + 2] = normalize(b, bounds.b[0], bounds.b[1]);\n }\n );\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA,SAASA,SAAS,GAAG;EACnB,MAAMA,SAAS,GAAG;IAChBC,CAAC,EAAE,IAAIC,KAAK,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,CAAC,CAAC;IACzBC,CAAC,EAAE,IAAIF,KAAK,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,CAAC,CAAC;IACzBE,CAAC,EAAE,IAAIH,KAAK,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,CAAC;EAC1B,CAAC;EAED,IAAI,CAACG,SAAS,CACZ,CAAC,EACD,CAAC,EACD,IAAI,CAACC,MAAM,CAACC,KAAK,EACjB,IAAI,CAACD,MAAM,CAACE,MAAM,EAClB,UAAUC,CAAC,EAAEC,CAAC,EAAEC,KAAK,EAAE;IACrBZ,SAAS,CAACC,CAAC,CAAC,IAAI,CAACM,MAAM,CAACM,IAAI,CAACD,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE;IAC1CZ,SAAS,CAACI,CAAC,CAAC,IAAI,CAACG,MAAM,CA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ACM,MAAM,CAACM,IAAI,CAACc,GAAG,GAAG,CAAC,CAAC;MACnC,MAAMvB,CAAC,GAAG,IAAI,CAACG,MAAM,CAACM,IAAI,CAACc,GAAG,GAAG,CAAC,CAAC;MACnC,MAAMtB,CAAC,GAAG,IAAI,CAACE,MAAM,CAACM,IAAI,CAACc,GAAG,GAAG,CAAC,CAAC;MAEnC,IAAI,CAACpB,MAAM,CAACM,IAAI,CAACc,GAAG,GAAG,CAAC,CAAC,GAAGb,SAAS,CAACb,CAAC,EAAEyB,MAAM,CAACzB,CAAC,CAAC,CAAC,CAAC,EAAEyB,MAAM,CAACzB,CAAC,CAAC,CAAC,CAAC,CAAC;MAClE,IAAI,CAACM,MAAM,CAACM,IAAI,CAACc,GAAG,GAAG,CAAC,CAAC,GAAGb,SAAS,CAACV,CAAC,EAAEsB,MAAM,CAACtB,CAAC,CAAC,CAAC,CAAC,EAAEsB,MAAM,CAACtB,CAAC,CAAC,CAAC,CAAC,CAAC;MAClE,IAAI,CAACG,MAAM,CAACM,IAAI,CAACc,GAAG,GAAG,CAAC,CAAC,GAAGb,SAAS,CAACT,CAAC,EAAEqB,MAAM,CAACrB,CAAC,CAAC,CAAC,CAAC,EAAEqB,MAAM,CAACrB,CAAC,CAAC,CAAC,CAAC,CAAC;IACpE,CAAC,CACF;IAED,IAAI,IAAAuB,oBAAa,EAACL,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-normalize/es/index.js b/project starter code/node_modules/@jimp/plugin-normalize/es/index.js index 7333fa33..49a86e31 100644 --- a/project starter code/node_modules/@jimp/plugin-normalize/es/index.js +++ b/project starter code/node_modules/@jimp/plugin-normalize/es/index.js @@ -1,18 +1,11 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); +import { isNodePattern } from "@jimp/utils"; /** * Get an image's histogram * @return {object} An object with an array of color occurrence counts for each channel (r,g,b) */ function histogram() { - var histogram = { + const histogram = { r: new Array(256).fill(0), g: new Array(256).fill(0), b: new Array(256).fill(0) @@ -24,6 +17,7 @@ function histogram() { }); return histogram; } + /** * Normalize values * @param {integer} value Pixel channel value. @@ -31,54 +25,42 @@ function histogram() { * @param {integer} max Maximum value for channel * @return {integer} normalized values */ - - -var _normalize = function normalize(value, min, max) { +const normalize = function (value, min, max) { return (value - min) * 255 / (max - min); }; - -var getBounds = function getBounds(histogramChannel) { - return [histogramChannel.findIndex(function (value) { - return value > 0; - }), 255 - histogramChannel.slice().reverse().findIndex(function (value) { - return value > 0; - })]; +const getBounds = function (histogramChannel) { + return [histogramChannel.findIndex(value => value > 0), 255 - histogramChannel.slice().reverse().findIndex(value => value > 0)]; }; + /** * Normalizes the image * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ +export default (() => ({ + normalize(cb) { + const h = histogram.call(this); + // store bounds (minimum and maximum values) + const bounds = { + r: getBounds(h.r), + g: getBounds(h.g), + b: getBounds(h.b) + }; -var _default = function _default() { - return { - normalize: function normalize(cb) { - var h = histogram.call(this); // store bounds (minimum and maximum values) - - var bounds = { - r: getBounds(h.r), - g: getBounds(h.g), - b: getBounds(h.b) - }; // apply value transformations - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var r = this.bitmap.data[idx + 0]; - var g = this.bitmap.data[idx + 1]; - var b = this.bitmap.data[idx + 2]; - this.bitmap.data[idx + 0] = _normalize(r, bounds.r[0], bounds.r[1]); - this.bitmap.data[idx + 1] = _normalize(g, bounds.g[0], bounds.g[1]); - this.bitmap.data[idx + 2] = _normalize(b, bounds.b[0], bounds.b[1]); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; + // apply value transformations + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { + const r = this.bitmap.data[idx + 0]; + const g = this.bitmap.data[idx + 1]; + const b = this.bitmap.data[idx + 2]; + this.bitmap.data[idx + 0] = normalize(r, bounds.r[0], bounds.r[1]); + this.bitmap.data[idx + 1] = normalize(g, bounds.g[0], bounds.g[1]); + this.bitmap.data[idx + 2] = normalize(b, bounds.b[0], bounds.b[1]); + }); + if (isNodePattern(cb)) { + cb.call(this, null, this); } - }; -}; - -exports["default"] = _default; + return this; + } +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-normalize/es/index.js.map b/project starter code/node_modules/@jimp/plugin-normalize/es/index.js.map index 4d6f08af..b937f6f4 100644 --- a/project starter code/node_modules/@jimp/plugin-normalize/es/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-normalize/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["histogram","r","Array","fill","g","b","scanQuiet","bitmap","width","height","x","y","index","data","normalize","value","min","max","getBounds","histogramChannel","findIndex","slice","reverse","cb","h","call","bounds","idx"],"mappings":";;;;;;;AAAA;;AAEA;;;;AAIA,SAASA,SAAT,GAAqB;AACnB,MAAMA,SAAS,GAAG;AAChBC,IAAAA,CAAC,EAAE,IAAIC,KAAJ,CAAU,GAAV,EAAeC,IAAf,CAAoB,CAApB,CADa;AAEhBC,IAAAA,CAAC,EAAE,IAAIF,KAAJ,CAAU,GAAV,EAAeC,IAAf,CAAoB,CAApB,CAFa;AAGhBE,IAAAA,CAAC,EAAE,IAAIH,KAAJ,CAAU,GAAV,EAAeC,IAAf,CAAoB,CAApB;AAHa,GAAlB;AAMA,OAAKG,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKC,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAC1DC,CAD0D,EAE1DC,CAF0D,EAG1DC,KAH0D,EAI1D;A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get an image's histogram\n * @return {object} An object with an array of color occurrence counts for each channel (r,g,b)\n */\nfunction histogram() {\n const histogram = {\n r: new Array(256).fill(0),\n g: new Array(256).fill(0),\n b: new Array(256).fill(0)\n };\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n index\n ) {\n histogram.r[this.bitmap.data[index + 0]]++;\n histogram.g[this.bitmap.data[index + 1]]++;\n histogram.b[this.bitmap.data[index + 2]]++;\n });\n\n return histogram;\n}\n\n/**\n * Normalize values\n * @param {integer} value Pixel channel value.\n * @param {integer} min Minimum value for channel\n * @param {integer} max Maximum value for channel\n * @return {integer} normalized values\n */\nconst normalize = function(value, min, max) {\n return ((value - min) * 255) / (max - min);\n};\n\nconst getBounds = function(histogramChannel) {\n return [\n histogramChannel.findIndex(value => value > 0),\n 255 -\n histogramChannel\n .slice()\n .reverse()\n .findIndex(value => value > 0)\n ];\n};\n\n/**\n * Normalizes the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n normalize(cb) {\n const h = histogram.call(this);\n\n // store bounds (minimum and maximum values)\n const bounds = {\n r: getBounds(h.r),\n g: getBounds(h.g),\n b: getBounds(h.b)\n };\n\n // apply value transformations\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n const r = this.bitmap.data[idx + 0];\n const g = this.bitmap.data[idx + 1];\n const b = this.bitmap.data[idx + 2];\n\n this.bitmap.data[idx + 0] = normalize(r, bounds.r[0], bounds.r[1]);\n this.bitmap.data[idx + 1] = normalize(g, bounds.g[0], bounds.g[1]);\n this.bitmap.data[idx + 2] = normalize(b, bounds.b[0], bounds.b[1]);\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["isNodePattern","histogram","r","Array","fill","g","b","scanQuiet","bitmap","width","height","x","y","index","data","normalize","value","min","max","getBounds","histogramChannel","findIndex","slice","reverse","cb","h","call","bounds","idx"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Get an image's histogram\n * @return {object} An object with an array of color occurrence counts for each channel (r,g,b)\n */\nfunction histogram() {\n const histogram = {\n r: new Array(256).fill(0),\n g: new Array(256).fill(0),\n b: new Array(256).fill(0),\n };\n\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, index) {\n histogram.r[this.bitmap.data[index + 0]]++;\n histogram.g[this.bitmap.data[index + 1]]++;\n histogram.b[this.bitmap.data[index + 2]]++;\n }\n );\n\n return histogram;\n}\n\n/**\n * Normalize values\n * @param {integer} value Pixel channel value.\n * @param {integer} min Minimum value for channel\n * @param {integer} max Maximum value for channel\n * @return {integer} normalized values\n */\nconst normalize = function (value, min, max) {\n return ((value - min) * 255) / (max - min);\n};\n\nconst getBounds = function (histogramChannel) {\n return [\n histogramChannel.findIndex((value) => value > 0),\n 255 -\n histogramChannel\n .slice()\n .reverse()\n .findIndex((value) => value > 0),\n ];\n};\n\n/**\n * Normalizes the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n normalize(cb) {\n const h = histogram.call(this);\n\n // store bounds (minimum and maximum values)\n const bounds = {\n r: getBounds(h.r),\n g: getBounds(h.g),\n b: getBounds(h.b),\n };\n\n // apply value transformations\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n const r = this.bitmap.data[idx + 0];\n const g = this.bitmap.data[idx + 1];\n const b = this.bitmap.data[idx + 2];\n\n this.bitmap.data[idx + 0] = normalize(r, bounds.r[0], bounds.r[1]);\n this.bitmap.data[idx + 1] = normalize(g, bounds.g[0], bounds.g[1]);\n this.bitmap.data[idx + 2] = normalize(b, bounds.b[0], bounds.b[1]);\n }\n );\n\n if (isNodePattern(cb)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AC,EAAEsB,MAAM,CAACtB,CAAC,CAAC,CAAC,CAAC,EAAEsB,MAAM,CAACtB,CAAC,CAAC,CAAC,CAAC,CAAC;MAClE,IAAI,CAACG,MAAM,CAACM,IAAI,CAACc,GAAG,GAAG,CAAC,CAAC,GAAGb,SAAS,CAACT,CAAC,EAAEqB,MAAM,CAACrB,CAAC,CAAC,CAAC,CAAC,EAAEqB,MAAM,CAACrB,CAAC,CAAC,CAAC,CAAC,CAAC;IACpE,CAAC,CACF;IAED,IAAIN,aAAa,CAACwB,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-normalize/index.d.ts b/project starter code/node_modules/@jimp/plugin-normalize/index.d.ts index abdf1839..1ae996dc 100644 --- a/project starter code/node_modules/@jimp/plugin-normalize/index.d.ts +++ b/project starter code/node_modules/@jimp/plugin-normalize/index.d.ts @@ -1,7 +1,7 @@ -import { ImageCallback } from '@jimp/core'; +import { ImageCallback } from "@jimp/core"; interface Normalize { - normalize(cb ?: ImageCallback): this; + normalize(cb?: ImageCallback): this; } -export default function(): Normalize; +export default function (): Normalize; diff --git a/project starter code/node_modules/@jimp/plugin-normalize/package.json b/project starter code/node_modules/@jimp/plugin-normalize/package.json index 4f66a0f0..3ada8c8d 100644 --- a/project starter code/node_modules/@jimp/plugin-normalize/package.json +++ b/project starter code/node_modules/@jimp/plugin-normalize/package.json @@ -1,12 +1,13 @@ { "name": "@jimp/plugin-normalize", - "version": "0.16.2", + "version": "0.22.12", "description": "normalize an image.", "main": "dist/index.js", "module": "es/index.js", "types": "index.d.ts", + "repository": "jimp-dev/jimp", "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js", "test:watch": "npm run test -- --reporter min --watch", "test:coverage": "nyc npm run test", "build": "npm run build:node:production && npm run build:module", @@ -20,18 +21,17 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" }, "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/test-utils": "^0.16.2" + "@jimp/custom": "^0.22.12", + "@jimp/test-utils": "^0.22.12" }, "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/plugin-normalize/src/index.js b/project starter code/node_modules/@jimp/plugin-normalize/src/index.js index ba73ff42..57a696ca 100644 --- a/project starter code/node_modules/@jimp/plugin-normalize/src/index.js +++ b/project starter code/node_modules/@jimp/plugin-normalize/src/index.js @@ -1,4 +1,4 @@ -import { isNodePattern } from '@jimp/utils'; +import { isNodePattern } from "@jimp/utils"; /** * Get an image's histogram @@ -8,18 +8,20 @@ function histogram() { const histogram = { r: new Array(256).fill(0), g: new Array(256).fill(0), - b: new Array(256).fill(0) + b: new Array(256).fill(0), }; - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - index - ) { - histogram.r[this.bitmap.data[index + 0]]++; - histogram.g[this.bitmap.data[index + 1]]++; - histogram.b[this.bitmap.data[index + 2]]++; - }); + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, index) { + histogram.r[this.bitmap.data[index + 0]]++; + histogram.g[this.bitmap.data[index + 1]]++; + histogram.b[this.bitmap.data[index + 2]]++; + } + ); return histogram; } @@ -31,18 +33,18 @@ function histogram() { * @param {integer} max Maximum value for channel * @return {integer} normalized values */ -const normalize = function(value, min, max) { +const normalize = function (value, min, max) { return ((value - min) * 255) / (max - min); }; -const getBounds = function(histogramChannel) { +const getBounds = function (histogramChannel) { return [ - histogramChannel.findIndex(value => value > 0), + histogramChannel.findIndex((value) => value > 0), 255 - histogramChannel .slice() .reverse() - .findIndex(value => value > 0) + .findIndex((value) => value > 0), ]; }; @@ -59,28 +61,30 @@ export default () => ({ const bounds = { r: getBounds(h.r), g: getBounds(h.g), - b: getBounds(h.b) + b: getBounds(h.b), }; // apply value transformations - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - const r = this.bitmap.data[idx + 0]; - const g = this.bitmap.data[idx + 1]; - const b = this.bitmap.data[idx + 2]; + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + const r = this.bitmap.data[idx + 0]; + const g = this.bitmap.data[idx + 1]; + const b = this.bitmap.data[idx + 2]; - this.bitmap.data[idx + 0] = normalize(r, bounds.r[0], bounds.r[1]); - this.bitmap.data[idx + 1] = normalize(g, bounds.g[0], bounds.g[1]); - this.bitmap.data[idx + 2] = normalize(b, bounds.b[0], bounds.b[1]); - }); + this.bitmap.data[idx + 0] = normalize(r, bounds.r[0], bounds.r[1]); + this.bitmap.data[idx + 1] = normalize(g, bounds.g[0], bounds.g[1]); + this.bitmap.data[idx + 2] = normalize(b, bounds.b[0], bounds.b[1]); + } + ); if (isNodePattern(cb)) { cb.call(this, null, this); } return this; - } + }, }); diff --git a/project starter code/node_modules/@jimp/plugin-normalize/test/normalize.test.js b/project starter code/node_modules/@jimp/plugin-normalize/test/normalize.test.js index 858f4189..2d8a885a 100644 --- a/project starter code/node_modules/@jimp/plugin-normalize/test/normalize.test.js +++ b/project starter code/node_modules/@jimp/plugin-normalize/test/normalize.test.js @@ -1,48 +1,33 @@ -import { Jimp, mkJGD } from '@jimp/test-utils'; -import configure from '@jimp/custom'; +import { Jimp, mkJGD } from "@jimp/test-utils"; +import configure from "@jimp/custom"; -import normalize from '../src'; +import normalize from "../src"; +import { expectToBeJGD } from "@jimp/test-utils/src"; const jimp = configure({ plugins: [normalize] }, Jimp); -describe('Normalize', () => { - it('change grayscale image', async () => { - const image = await jimp.read(mkJGD('36▦', '6▦9', '▦9C')); +describe("Normalize", () => { + it("change grayscale image", async () => { + const image = await jimp.read(mkJGD("36▦", "6▦9", "▦9C")); - image - .normalize() - .getJGDSync() - .should.be.sameJGD(mkJGD('■5▦', '5▦A', '▦A□')); + expectToBeJGD(image.normalize().getJGDSync(), mkJGD("■5▦", "5▦A", "▦A□")); }); - it('change red/blue image', async () => { + it("change red/blue image", async () => { const image = await jimp.read({ width: 3, height: 2, data: [ - 0x000000ff, - 0x400022ff, - 0x40002200, - 0x400000ff, - 0x000022ff, - 0x800055ff - ] + 0x000000ff, 0x400022ff, 0x40002200, 0x400000ff, 0x000022ff, 0x800055ff, + ], }); - image - .normalize() - .getJGDSync() - .should.be.sameJGD({ - width: 3, - height: 2, - data: [ - 0x000000ff, - 0x7f0066ff, - 0x7f006600, - 0x7f0000ff, - 0x000066ff, - 0xff00ffff - ] - }); + expectToBeJGD(image.normalize().getJGDSync(), { + width: 3, + height: 2, + data: [ + 0x000000ff, 0x7f0066ff, 0x7f006600, 0x7f0000ff, 0x000066ff, 0xff00ffff, + ], + }); }); }); diff --git a/project starter code/node_modules/@jimp/plugin-print/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-print/CHANGELOG.md index 8db97314..cb1f398a 100644 --- a/project starter code/node_modules/@jimp/plugin-print/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/plugin-print/CHANGELOG.md @@ -1,3 +1,143 @@ +# v0.22.11 (Fri Feb 23 2024) + +:tada: This release contains work from a new contributor! :tada: + +Thank you, Rob Juurlink ([@kozmoz](https://github.com/kozmoz)), for all your work! + +#### 🚀 Enhancement + +- Add \n support for image.print #865 [#1265](https://github.com/jimp-dev/jimp/pull/1265) (juurr00@juurlink.org [@kozmoz](https://github.com/kozmoz) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 3 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- juurr00 (juurr00@juurlink.org) +- Rob Juurlink ([@kozmoz](https://github.com/kozmoz)) + +--- + +# v0.22.9 (Wed Jul 26 2023) + +:tada: This release contains work from a new contributor! :tada: + +Thank you, Tim O. (macer) ([@gitmacer](https://github.com/gitmacer)), for all your work! + +#### 🚀 Enhancement + +- Add € to extended Fonts [#1249](https://github.com/jimp-dev/jimp/pull/1249) ([@gitmacer](https://github.com/gitmacer)) + +#### Authors: 1 + +- Tim O. (macer) ([@gitmacer](https://github.com/gitmacer)) + +--- + +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.22.0 (Mon Feb 06 2023) + +#### 🏠 Internal + +- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Daniel Holmes ([@danielholmes](https://github.com/danielholmes)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.17.6 (Sat Feb 04 2023) + +#### 🐛 Bug Fix + +- Update ordering of overrides so ReturnType pulls correct typing. [#1077](https://github.com/jimp-dev/jimp/pull/1077) ([@dcbartlett](https://github.com/dcbartlett) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Dennis Bartlett ([@dcbartlett](https://github.com/dcbartlett)) + +--- + +# v0.17.2 (Sat Feb 04 2023) + +#### 🐛 Bug Fix + +- remove extra bm-font dep [#1134](https://github.com/jimp-dev/jimp/pull/1134) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.17.1 (Sat Feb 04 2023) + +#### 🐛 Bug Fix + +- use a consistent text layouting algorithm [#1133](https://github.com/jimp-dev/jimp/pull/1133) ([@iliazeus](https://github.com/iliazeus) [@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Ilia Pozdnyakov ([@iliazeus](https://github.com/iliazeus)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### 🐛 Bug Fix + +- Update README.md [#1120](https://github.com/jimp-dev/jimp/pull/1120) ([@mfuatnuroglu](https://github.com/mfuatnuroglu)) + +#### ⚠️ Pushed to `main` + +- try this ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 2 + +- [@mfuatnuroglu](https://github.com/mfuatnuroglu) +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -24,12 +164,12 @@ # v0.9.5 (Tue Mar 03 2020) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/plugin-print` - Export font type [#838](https://github.com/oliver-moran/jimp/pull/838) ([@DomiR](https://github.com/DomiR)) -#### 📝 Documentation +#### 📝 Documentation - `@jimp/plugin-print` - Added ttf2fnt.com to the list [#845](https://github.com/oliver-moran/jimp/pull/845) ([@mbejda](https://github.com/mbejda)) @@ -42,7 +182,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -50,4 +190,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-print/README.md b/project starter code/node_modules/@jimp/plugin-print/README.md index ebbb1d31..4d395c87 100644 --- a/project starter code/node_modules/@jimp/plugin-print/README.md +++ b/project starter code/node_modules/@jimp/plugin-print/README.md @@ -9,7 +9,6 @@ Jimp supports basic typography using BMFont format (.fnt) even ones in different Online tools are also available to convert TTF fonts to BMFont format. They can be used to create color font or sprite packs. - :star: [ttf2fnt](https://ttf2fnt.com/) :star: [Littera](http://kvazars.com/littera/) @@ -41,7 +40,7 @@ Loads a bitmap font from a file - @returns {Promise} a promise ```js -import Jimp from 'jimp'; +import Jimp from "jimp"; async function main() { const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK); @@ -59,16 +58,17 @@ Draws a text on a image on a given boundary - @param {number} y the y position to start drawing the text - @param {string} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`) - @param {number} maxWidth (optional) the boundary width to draw in -- @param {number} maxHeight (optional) the boundary height to draw in - @param {function(Error, Jimp)} cb (optional) a function to call when the text is written +- @param {number} maxHeight (optional) the boundary height to draw in +- @param {function(Error, Jimp)} cb (optional) a function to call when the text is written ```js -import Jimp from 'jimp'; +import Jimp from "jimp"; async function main() { const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK); const image = await Jimp.read(1000, 1000, 0x0000ffff); - image.print(font, 10, 10, 'Hello World!'); + image.print(font, 10, 10, "Hello World!"); } main(); @@ -108,16 +108,16 @@ image.print( x, y, { - text: 'Hello world!', + text: "Hello world!", alignmentX: Jimp.HORIZONTAL_ALIGN_CENTER, - alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE + alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE, }, maxWidth, maxHeight ); ``` -__Note__: although `maxWidth` and `maxHeight` parameters are optional to `print()`, they are needed to correctly align the text using the requested alignment mode. +**Note**: although `maxWidth` and `maxHeight` parameters are optional to `print()`, they are needed to correctly align the text using the requested alignment mode. #### Staggering Text @@ -130,10 +130,10 @@ image.print( font, 10, 10, - 'Hello world that wraps!', + "Hello world that wraps!", 50, (err, image, { x, y }) => { - image.print(font, x, y + 20, 'More text on another line', 50); + image.print(font, x, y + 20, "More text on another line", 50); } ); ``` @@ -143,13 +143,13 @@ image.print( Measure how wide a piece of text will be. ```js -import Jimp from 'jimp'; +import Jimp from "jimp"; async function main() { const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK); const image = await Jimp.read(1000, 1000, 0x0000ffff); - Jimp.measureText(font, 'Hello World!'); + Jimp.measureText(font, "Hello World!"); } main(); @@ -160,13 +160,13 @@ main(); Measure how tall a piece of text will be. ```js -import Jimp from 'jimp'; +import Jimp from "jimp"; async function main() { const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK); const image = await Jimp.read(1000, 1000, 0x0000ffff); - Jimp.measureTextHeight(font, 'Hello World!', 100); + Jimp.measureTextHeight(font, "Hello World!", 100); } main(); diff --git a/project starter code/node_modules/@jimp/plugin-print/dist/index.js b/project starter code/node_modules/@jimp/plugin-print/dist/index.js index 8392c072..0615d1e2 100644 --- a/project starter code/node_modules/@jimp/plugin-print/dist/index.js +++ b/project starter code/node_modules/@jimp/plugin-print/dist/index.js @@ -1,261 +1,189 @@ "use strict"; -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - +exports.default = void 0; var _path = _interopRequireDefault(require("path")); - var _loadBmfont = _interopRequireDefault(require("load-bmfont")); - var _utils = require("@jimp/utils"); - var _measureText = require("./measure-text"); - +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) { if (alignment === constants.HORIZONTAL_ALIGN_LEFT) { return 0; } - if (alignment === constants.HORIZONTAL_ALIGN_CENTER) { return (maxWidth - (0, _measureText.measureText)(font, line)) / 2; } - return maxWidth - (0, _measureText.measureText)(font, line); } - -function drawCharacter(image, font, x, y, _char) { - if (_char.width > 0 && _char.height > 0) { - var characterPage = font.pages[_char.page]; - image.blit(characterPage, x + _char.xoffset, y + _char.yoffset, _char.x, _char.y, _char.width, _char.height); +function drawCharacter(image, font, x, y, char) { + if (char.width > 0 && char.height > 0) { + const characterPage = font.pages[char.page]; + image.blit(characterPage, x + char.xoffset, y + char.yoffset, char.x, char.y, char.width, char.height); } - return image; } - function printText(font, x, y, text, defaultCharWidth) { - for (var i = 0; i < text.length; i++) { - var _char2 = void 0; - + for (let i = 0; i < text.length; i++) { + let char; if (font.chars[text[i]]) { - _char2 = text[i]; + char = text[i]; } else if (/\s/.test(text[i])) { - _char2 = ''; + char = ""; } else { - _char2 = '?'; + char = "?"; } - - var fontChar = font.chars[_char2] || {}; - var fontKerning = font.kernings[_char2]; + const fontChar = font.chars[char] || {}; + const fontKerning = font.kernings[char]; drawCharacter(this, font, x, y, fontChar || {}); - var kerning = fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0; + const kerning = fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0; x += kerning + (fontChar.xadvance || defaultCharWidth); } } - -function splitLines(font, text, maxWidth) { - var words = text.split(' '); - var lines = []; - var currentLine = []; - var longestLine = 0; - words.forEach(function (word) { - var line = [].concat((0, _toConsumableArray2["default"])(currentLine), [word]).join(' '); - var length = (0, _measureText.measureText)(font, line); - - if (length <= maxWidth) { - if (length > longestLine) { - longestLine = length; - } - - currentLine.push(word); - } else { - lines.push(currentLine); - currentLine = [word]; - } - }); - lines.push(currentLine); - return { - lines: lines, - longestLine: longestLine - }; -} - function loadPages(Jimp, dir, pages) { - var newPages = pages.map(function (page) { - return Jimp.read(dir + '/' + page); + const newPages = pages.map(page => { + return Jimp.read(dir + "/" + page); }); return Promise.all(newPages); } - -var dir = process.env.DIRNAME || "".concat(__dirname, "/../"); - -var _default = function _default() { - return { - constants: { - measureText: _measureText.measureText, - measureTextHeight: _measureText.measureTextHeight, - FONT_SANS_8_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt'), - FONT_SANS_10_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt'), - FONT_SANS_12_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt'), - FONT_SANS_14_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt'), - FONT_SANS_16_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt'), - FONT_SANS_32_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt'), - FONT_SANS_64_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt'), - FONT_SANS_128_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt'), - FONT_SANS_8_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt'), - FONT_SANS_16_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt'), - FONT_SANS_32_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt'), - FONT_SANS_64_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt'), - FONT_SANS_128_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt'), - - /** - * Loads a bitmap font from a file - * @param {string} file the file path of a .fnt file - * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded - * @returns {Promise} a promise - */ - loadFont: function loadFont(file, cb) { - var _this = this; - - if (typeof file !== 'string') return _utils.throwError.call(this, 'file must be a string', cb); - return new Promise(function (resolve, reject) { - cb = cb || function (err, font) { - if (err) reject(err);else resolve(font); - }; - - (0, _loadBmfont["default"])(file, function (err, font) { - var chars = {}; - var kernings = {}; - - if (err) { - return _utils.throwError.call(_this, err, cb); - } - - for (var i = 0; i < font.chars.length; i++) { - chars[String.fromCharCode(font.chars[i].id)] = font.chars[i]; - } - - for (var _i = 0; _i < font.kernings.length; _i++) { - var firstString = String.fromCharCode(font.kernings[_i].first); - kernings[firstString] = kernings[firstString] || {}; - kernings[firstString][String.fromCharCode(font.kernings[_i].second)] = font.kernings[_i].amount; - } - - loadPages(_this, _path["default"].dirname(file), font.pages).then(function (pages) { - cb(null, { - chars: chars, - kernings: kernings, - pages: pages, - common: font.common, - info: font.info - }); +const dir = process.env.DIRNAME || `${__dirname}/../`; +var _default = () => ({ + constants: { + measureText: _measureText.measureText, + measureTextHeight: _measureText.measureTextHeight, + FONT_SANS_8_BLACK: _path.default.join(dir, "fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt"), + FONT_SANS_10_BLACK: _path.default.join(dir, "fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt"), + FONT_SANS_12_BLACK: _path.default.join(dir, "fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt"), + FONT_SANS_14_BLACK: _path.default.join(dir, "fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt"), + FONT_SANS_16_BLACK: _path.default.join(dir, "fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt"), + FONT_SANS_32_BLACK: _path.default.join(dir, "fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt"), + FONT_SANS_64_BLACK: _path.default.join(dir, "fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt"), + FONT_SANS_128_BLACK: _path.default.join(dir, "fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt"), + FONT_SANS_8_WHITE: _path.default.join(dir, "fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt"), + FONT_SANS_16_WHITE: _path.default.join(dir, "fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt"), + FONT_SANS_32_WHITE: _path.default.join(dir, "fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt"), + FONT_SANS_64_WHITE: _path.default.join(dir, "fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt"), + FONT_SANS_128_WHITE: _path.default.join(dir, "fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt"), + /** + * Loads a bitmap font from a file + * @param {string} file the file path of a .fnt file + * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded + * @returns {Promise} a promise + */ + loadFont(file, cb) { + if (typeof file !== "string") return _utils.throwError.call(this, "file must be a string", cb); + return new Promise((resolve, reject) => { + cb = cb || function (err, font) { + if (err) reject(err);else resolve(font); + }; + (0, _loadBmfont.default)(file, (err, font) => { + const chars = {}; + const kernings = {}; + if (err) { + return _utils.throwError.call(this, err, cb); + } + for (let i = 0; i < font.chars.length; i++) { + chars[String.fromCharCode(font.chars[i].id)] = font.chars[i]; + } + for (let i = 0; i < font.kernings.length; i++) { + const firstString = String.fromCharCode(font.kernings[i].first); + kernings[firstString] = kernings[firstString] || {}; + kernings[firstString][String.fromCharCode(font.kernings[i].second)] = font.kernings[i].amount; + } + loadPages(this, _path.default.dirname(file), font.pages).then(pages => { + cb(null, { + chars, + kernings, + pages, + common: font.common, + info: font.info }); }); }); + }); + } + }, + class: { + /** + * Draws a text on a image on a given boundary + * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command + * @param {number} x the x position to start drawing the text + * @param {number} y the y position to start drawing the text + * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`) + * @param {number} maxWidth (optional) the boundary width to draw in + * @param {number} maxHeight (optional) the boundary height to draw in + * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written + * @returns {Jimp} this for chaining of methods + */ + print(font, x, y, text, maxWidth, maxHeight, cb) { + if (typeof maxWidth === "function" && typeof cb === "undefined") { + cb = maxWidth; + maxWidth = Infinity; } - }, - "class": { - /** - * Draws a text on a image on a given boundary - * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command - * @param {number} x the x position to start drawing the text - * @param {number} y the y position to start drawing the text - * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`) - * @param {number} maxWidth (optional) the boundary width to draw in - * @param {number} maxHeight (optional) the boundary height to draw in - * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written - * @returns {Jimp} this for chaining of methods - */ - print: function print(font, x, y, text, maxWidth, maxHeight, cb) { - var _this2 = this; - - if (typeof maxWidth === 'function' && typeof cb === 'undefined') { - cb = maxWidth; - maxWidth = Infinity; - } - - if (typeof maxWidth === 'undefined') { - maxWidth = Infinity; - } - - if (typeof maxHeight === 'function' && typeof cb === 'undefined') { - cb = maxHeight; - maxHeight = Infinity; - } - - if (typeof maxHeight === 'undefined') { - maxHeight = Infinity; - } - - if ((0, _typeof2["default"])(font) !== 'object') { - return _utils.throwError.call(this, 'font must be a Jimp loadFont', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number' || typeof maxWidth !== 'number') { - return _utils.throwError.call(this, 'x, y and maxWidth must be numbers', cb); - } - - if (typeof maxWidth !== 'number') { - return _utils.throwError.call(this, 'maxWidth must be a number', cb); - } - - if (typeof maxHeight !== 'number') { - return _utils.throwError.call(this, 'maxHeight must be a number', cb); - } - - var alignmentX; - var alignmentY; - - if ((0, _typeof2["default"])(text) === 'object' && text.text !== null && text.text !== undefined) { - alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT; - alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP; - var _text = text; - text = _text.text; - } else { - alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT; - alignmentY = this.constructor.VERTICAL_ALIGN_TOP; - text = text.toString(); - } - - if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM) { - y += maxHeight - (0, _measureText.measureTextHeight)(font, text, maxWidth); - } else if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE) { - y += maxHeight / 2 - (0, _measureText.measureTextHeight)(font, text, maxWidth) / 2; - } - - var defaultCharWidth = Object.entries(font.chars)[0][1].xadvance; - - var _splitLines = splitLines(font, text, maxWidth), - lines = _splitLines.lines, - longestLine = _splitLines.longestLine; - - lines.forEach(function (line) { - var lineString = line.join(' '); - var alignmentWidth = xOffsetBasedOnAlignment(_this2.constructor, font, lineString, maxWidth, alignmentX); - printText.call(_this2, font, x + alignmentWidth, y, lineString, defaultCharWidth); - y += font.common.lineHeight; + if (typeof maxWidth === "undefined") { + maxWidth = Infinity; + } + if (typeof maxHeight === "function" && typeof cb === "undefined") { + cb = maxHeight; + maxHeight = Infinity; + } + if (typeof maxHeight === "undefined") { + maxHeight = Infinity; + } + if (typeof font !== "object") { + return _utils.throwError.call(this, "font must be a Jimp loadFont", cb); + } + if (typeof x !== "number" || typeof y !== "number" || typeof maxWidth !== "number") { + return _utils.throwError.call(this, "x, y and maxWidth must be numbers", cb); + } + if (typeof maxWidth !== "number") { + return _utils.throwError.call(this, "maxWidth must be a number", cb); + } + if (typeof maxHeight !== "number") { + return _utils.throwError.call(this, "maxHeight must be a number", cb); + } + let alignmentX; + let alignmentY; + if (typeof text === "object" && text.text !== null && text.text !== undefined) { + alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT; + alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP; + ({ + text + } = text); + } else { + alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT; + alignmentY = this.constructor.VERTICAL_ALIGN_TOP; + text = text.toString(); + } + if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM) { + y += maxHeight - (0, _measureText.measureTextHeight)(font, text, maxWidth); + } else if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE) { + y += maxHeight / 2 - (0, _measureText.measureTextHeight)(font, text, maxWidth) / 2; + } + const defaultCharWidth = Object.entries(font.chars)[0][1].xadvance; + const { + lines, + longestLine + } = (0, _measureText.splitLines)(font, text, maxWidth); + lines.forEach(line => { + const lineString = line.join(" "); + const alignmentWidth = xOffsetBasedOnAlignment(this.constructor, font, lineString, maxWidth, alignmentX); + printText.call(this, font, x + alignmentWidth, y, lineString, defaultCharWidth); + y += font.common.lineHeight; + }); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this, { + x: x + longestLine, + y }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this, { - x: x + longestLine, - y: y - }); - } - - return this; } + return this; } - }; -}; - -exports["default"] = _default; + } +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-print/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-print/dist/index.js.map index e5583103..d9b5bbd4 100644 --- a/project starter code/node_modules/@jimp/plugin-print/dist/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-print/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["xOffsetBasedOnAlignment","constants","font","line","maxWidth","alignment","HORIZONTAL_ALIGN_LEFT","HORIZONTAL_ALIGN_CENTER","drawCharacter","image","x","y","char","width","height","characterPage","pages","page","blit","xoffset","yoffset","printText","text","defaultCharWidth","i","length","chars","test","fontChar","fontKerning","kernings","kerning","xadvance","splitLines","words","split","lines","currentLine","longestLine","forEach","word","join","push","loadPages","Jimp","dir","newPages","map","read","Promise","all","process","env","DIRNAME","__dirname","measureText","measureTextHeight","FONT_SANS_8_BLACK","Path","FONT_SANS_10_BLACK","FONT_SANS_12_BLACK","FONT_SANS_14_BLACK","FONT_SANS_16_BLACK","FONT_SANS_32_BLACK","FONT_SANS_64_BLACK","FONT_SANS_128_BLACK","FONT_SANS_8_WHITE","FONT_SANS_16_WHITE","FONT_SANS_32_WHITE","FONT_SANS_64_WHITE","FONT_SANS_128_WHITE","loadFont","file","cb","throwError","call","resolve","reject","err","String","fromCharCode","id","firstString","first","second","amount","dirname","then","common","info","print","maxHeight","Infinity","alignmentX","alignmentY","undefined","constructor","VERTICAL_ALIGN_TOP","toString","VERTICAL_ALIGN_BOTTOM","VERTICAL_ALIGN_MIDDLE","Object","entries","lineString","alignmentWidth","lineHeight"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA,SAASA,uBAAT,CAAi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D;;AAED,YAAMmB,gBAAgB,GAAG8E,MAAM,CAACC,OAAP,CAAepG,IAAI,CAACwB,KAApB,EAA2B,CAA3B,EAA8B,CAA9B,EAAiCM,QAA1D;;AApE+C,0BAqEhBC,UAAU,CAAC/B,IAAD,EAAOoB,IAAP,EAAalB,QAAb,CArEM;AAAA,YAqEvCgC,KArEuC,eAqEvCA,KArEuC;AAAA,YAqEhCE,WArEgC,eAqEhCA,WArEgC;;AAuE/CF,QAAAA,KAAK,CAACG,OAAN,CAAc,UAAApC,IAAI,EAAI;AACpB,cAAMoG,UAAU,GAAGpG,IAAI,CAACsC,IAAL,CAAU,GAAV,CAAnB;AACA,cAAM+D,cAAc,GAAGxG,uBAAuB,CAC5C,MAAI,CAACgG,WADuC,EAE5C9F,IAF4C,EAG5CqG,UAH4C,EAI5CnG,QAJ4C,EAK5CyF,UAL4C,CAA9C;AAQAxE,UAAAA,SAAS,CAACsD,IAAV,CACE,MADF,EAEEzE,IAFF,EAGEQ,CAAC,GAAG8F,cAHN,EAIE7F,CAJF,EAKE4F,UALF,EAMEhF,gBANF;AASAZ,UAAAA,CAAC,IAAIT,IAAI,CAACsF,MAAL,CAAYiB,UAAjB;AACD,SApBD;;AAsBA,YAAI,0BAAchC,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB,EAA0B;AAAEjE,YAAAA,CAAC,EAAEA,CAAC,GAAG4B,WAAT;AAAsB3B,YAAAA,CAAC,EAADA;AAAtB,WAA1B;AACD;;AAED,eAAO,IAAP;AACD;AA9GI;AA9Ga,GAAP;AAAA,C","sourcesContent":["import Path from 'path';\nimport bMFont from 'load-bmfont';\nimport { isNodePattern, throwError } from '@jimp/utils';\nimport { measureText, measureTextHeight } from './measure-text';\n\nfunction xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) {\n if (alignment === constants.HORIZONTAL_ALIGN_LEFT) {\n return 0;\n }\n\n if (alignment === constants.HORIZONTAL_ALIGN_CENTER) {\n return (maxWidth - measureText(font, line)) / 2;\n }\n\n return maxWidth - measureText(font, line);\n}\n\nfunction drawCharacter(image, font, x, y, char) {\n if (char.width > 0 && char.height > 0) {\n const characterPage = font.pages[char.page];\n\n image.blit(\n characterPage,\n x + char.xoffset,\n y + char.yoffset,\n char.x,\n char.y,\n char.width,\n char.height\n );\n }\n\n return image;\n}\n\nfunction printText(font, x, y, text, defaultCharWidth) {\n for (let i = 0; i < text.length; i++) {\n let char;\n\n if (font.chars[text[i]]) {\n char = text[i];\n } else if (/\\s/.test(text[i])) {\n char = '';\n } else {\n char = '?';\n }\n\n const fontChar = font.chars[char] || {};\n const fontKerning = font.kernings[char];\n\n drawCharacter(this, font, x, y, fontChar || {});\n\n const kerning =\n fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0;\n\n x += kerning + (fontChar.xadvance || defaultCharWidth);\n }\n}\n\nfunction splitLines(font, text, maxWidth) {\n const words = text.split(' ');\n const lines = [];\n let currentLine = [];\n let longestLine = 0;\n\n words.forEach(word => {\n const line = [...currentLine, word].join(' ');\n const length = measureText(font, line);\n\n if (length <= maxWidth) {\n if (length > longestLine) {\n longestLine = length;\n }\n\n currentLine.push(word);\n } else {\n lines.push(currentLine);\n currentLine = [word];\n }\n });\n\n lines.push(currentLine);\n\n return {\n lines,\n longestLine\n };\n}\n\nfunction loadPages(Jimp, dir, pages) {\n const newPages = pages.map(page => {\n return Jimp.read(dir + '/' + page);\n });\n\n return Promise.all(newPages);\n}\n\nconst dir = process.env.DIRNAME || `${__dirname}/../`;\n\nexport default () => ({\n constants: {\n measureText,\n measureTextHeight,\n FONT_SANS_8_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt'\n ),\n FONT_SANS_10_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt'\n ),\n FONT_SANS_12_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt'\n ),\n FONT_SANS_14_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt'\n ),\n FONT_SANS_16_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt'\n ),\n FONT_SANS_32_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt'\n ),\n FONT_SANS_64_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt'\n ),\n FONT_SANS_128_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt'\n ),\n\n FONT_SANS_8_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt'\n ),\n FONT_SANS_16_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt'\n ),\n FONT_SANS_32_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt'\n ),\n FONT_SANS_64_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt'\n ),\n FONT_SANS_128_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt'\n ),\n\n /**\n * Loads a bitmap font from a file\n * @param {string} file the file path of a .fnt file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded\n * @returns {Promise} a promise\n */\n loadFont(file, cb) {\n if (typeof file !== 'string')\n return throwError.call(this, 'file must be a string', cb);\n\n return new Promise((resolve, reject) => {\n cb =\n cb ||\n function(err, font) {\n if (err) reject(err);\n else resolve(font);\n };\n\n bMFont(file, (err, font) => {\n const chars = {};\n const kernings = {};\n\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n for (let i = 0; i < font.chars.length; i++) {\n chars[String.fromCharCode(font.chars[i].id)] = font.chars[i];\n }\n\n for (let i = 0; i < font.kernings.length; i++) {\n const firstString = String.fromCharCode(font.kernings[i].first);\n kernings[firstString] = kernings[firstString] || {};\n kernings[firstString][\n String.fromCharCode(font.kernings[i].second)\n ] = font.kernings[i].amount;\n }\n\n loadPages(this, Path.dirname(file), font.pages).then(pages => {\n cb(null, {\n chars,\n kernings,\n pages,\n common: font.common,\n info: font.info\n });\n });\n });\n });\n }\n },\n\n class: {\n /**\n * Draws a text on a image on a given boundary\n * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command\n * @param {number} x the x position to start drawing the text\n * @param {number} y the y position to start drawing the text\n * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`)\n * @param {number} maxWidth (optional) the boundary width to draw in\n * @param {number} maxHeight (optional) the boundary height to draw in\n * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written\n * @returns {Jimp} this for chaining of methods\n */\n print(font, x, y, text, maxWidth, maxHeight, cb) {\n if (typeof maxWidth === 'function' && typeof cb === 'undefined') {\n cb = maxWidth;\n maxWidth = Infinity;\n }\n\n if (typeof maxWidth === 'undefined') {\n maxWidth = Infinity;\n }\n\n if (typeof maxHeight === 'function' && typeof cb === 'undefined') {\n cb = maxHeight;\n maxHeight = Infinity;\n }\n\n if (typeof maxHeight === 'undefined') {\n maxHeight = Infinity;\n }\n\n if (typeof font !== 'object') {\n return throwError.call(this, 'font must be a Jimp loadFont', cb);\n }\n\n if (\n typeof x !== 'number' ||\n typeof y !== 'number' ||\n typeof maxWidth !== 'number'\n ) {\n return throwError.call(this, 'x, y and maxWidth must be numbers', cb);\n }\n\n if (typeof maxWidth !== 'number') {\n return throwError.call(this, 'maxWidth must be a number', cb);\n }\n\n if (typeof maxHeight !== 'number') {\n return throwError.call(this, 'maxHeight must be a number', cb);\n }\n\n let alignmentX;\n let alignmentY;\n\n if (\n typeof text === 'object' &&\n text.text !== null &&\n text.text !== undefined\n ) {\n alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP;\n ({ text } = text);\n } else {\n alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = this.constructor.VERTICAL_ALIGN_TOP;\n text = text.toString();\n }\n\n if (\n maxHeight !== Infinity &&\n alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM\n ) {\n y += maxHeight - measureTextHeight(font, text, maxWidth);\n } else if (\n maxHeight !== Infinity &&\n alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE\n ) {\n y += maxHeight / 2 - measureTextHeight(font, text, maxWidth) / 2;\n }\n\n const defaultCharWidth = Object.entries(font.chars)[0][1].xadvance;\n const { lines, longestLine } = splitLines(font, text, maxWidth);\n\n lines.forEach(line => {\n const lineString = line.join(' ');\n const alignmentWidth = xOffsetBasedOnAlignment(\n this.constructor,\n font,\n lineString,\n maxWidth,\n alignmentX\n );\n\n printText.call(\n this,\n font,\n x + alignmentWidth,\n y,\n lineString,\n defaultCharWidth\n );\n\n y += font.common.lineHeight;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this, { x: x + longestLine, y });\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["xOffsetBasedOnAlignment","constants","font","line","maxWidth","alignment","HORIZONTAL_ALIGN_LEFT","HORIZONTAL_ALIGN_CENTER","measureText","drawCharacter","image","x","y","char","width","height","characterPage","pages","page","blit","xoffset","yoffset","printText","text","defaultCharWidth","i","length","chars","test","fontChar","fontKerning","kernings","kerning","xadvance","loadPages","Jimp","dir","newPages","map","read","Promise","all","process","env","DIRNAME","__dirname","measureTextHeight","FONT_SANS_8_BLACK","Path","join","FONT_SANS_10_BLACK","FONT_SANS_12_BLACK","FONT_SANS_14_BLACK","FONT_SANS_16_BLACK","FONT_SANS_32_BLACK","FONT_SANS_64_BLACK","FONT_SANS_128_BLACK","FONT_SANS_8_WHITE","FONT_SANS_16_WHITE","FONT_SANS_32_WHITE","FONT_SANS_64_WHITE","FONT_SANS_128_WHITE","loadFont","file","cb","throwError","call","resolve","reject","err","bMFont","String","fromCharCode","id","firstString","first","second","amount","dirname","then","common","info","class","print","maxHeight","Infinity","alignmentX","alignmentY","undefined","constructor","VERTICAL_ALIGN_TOP","toString","VERTICAL_ALIGN_BOTTOM","VERTICAL_ALIGN_MIDDLE","Object","entries","lines","longestLine","splitLines","forEach","lineString","alignmentWidth","lineHeight","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import Path from \"path\";\nimport bMFont from \"load-bmfont\";\nimport { isNodePattern, throwError } from \"@jimp/utils\";\nimport { measureText, measureTextHeight, splitLines } from \"./measure-text\";\n\nfunction xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) {\n if (alignment === constants.HORIZONTAL_ALIGN_LEFT) {\n return 0;\n }\n\n if (alignment === constants.HORIZONTAL_ALIGN_CENTER) {\n return (maxWidth - measureText(font, line)) / 2;\n }\n\n return maxWidth - measureText(font, line);\n}\n\nfunction drawCharacter(image, font, x, y, char) {\n if (char.width > 0 && char.height > 0) {\n const characterPage = font.pages[char.page];\n\n image.blit(\n characterPage,\n x + char.xoffset,\n y + char.yoffset,\n char.x,\n char.y,\n char.width,\n char.height\n );\n }\n\n return image;\n}\n\nfunction printText(font, x, y, text, defaultCharWidth) {\n for (let i = 0; i < text.length; i++) {\n let char;\n\n if (font.chars[text[i]]) {\n char = text[i];\n } else if (/\\s/.test(text[i])) {\n char = \"\";\n } else {\n char = \"?\";\n }\n\n const fontChar = font.chars[char] || {};\n const fontKerning = font.kernings[char];\n\n drawCharacter(this, font, x, y, fontChar || {});\n\n const kerning =\n fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0;\n\n x += kerning + (fontChar.xadvance || defaultCharWidth);\n }\n}\n\nfunction loadPages(Jimp, dir, pages) {\n const newPages = pages.map((page) => {\n return Jimp.read(dir + \"/\" + page);\n });\n\n return Promise.all(newPages);\n}\n\nconst dir = process.env.DIRNAME || `${__dirname}/../`;\n\nexport default () => ({\n constants: {\n measureText,\n measureTextHeight,\n FONT_SANS_8_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt\"\n ),\n FONT_SANS_10_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt\"\n ),\n FONT_SANS_12_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt\"\n ),\n FONT_SANS_14_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt\"\n ),\n FONT_SANS_16_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt\"\n ),\n FONT_SANS_32_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt\"\n ),\n FONT_SANS_64_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt\"\n ),\n FONT_SANS_128_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt\"\n ),\n\n FONT_SANS_8_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt\"\n ),\n FONT_SANS_16_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt\"\n ),\n FONT_SANS_32_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt\"\n ),\n FONT_SANS_64_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt\"\n ),\n FONT_SANS_128_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt\"\n ),\n\n /**\n * Loads a bitmap font from a file\n * @param {string} file the file path of a .fnt file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded\n * @returns {Promise} a promise\n */\n loadFont(file, cb) {\n if (typeof file !== \"string\")\n return throwError.call(this, \"file must be a string\", cb);\n\n return new Promise((resolve, reject) => {\n cb =\n cb ||\n function (err, font) {\n if (err) reject(err);\n else resolve(font);\n };\n\n bMFont(file, (err, font) => {\n const chars = {};\n const kernings = {};\n\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n for (let i = 0; i < font.chars.length; i++) {\n chars[String.fromCharCode(font.chars[i].id)] = font.chars[i];\n }\n\n for (let i = 0; i < font.kernings.length; i++) {\n const firstString = String.fromCharCode(font.kernings[i].first);\n kernings[firstString] = kernings[firstString] || {};\n kernings[firstString][\n String.fromCharCode(font.kernings[i].second)\n ] = font.kernings[i].amount;\n }\n\n loadPages(this, Path.dirname(file), font.pages).then((pages) => {\n cb(null, {\n chars,\n kernings,\n pages,\n common: font.common,\n info: font.info,\n });\n });\n });\n });\n },\n },\n\n class: {\n /**\n * Draws a text on a image on a given boundary\n * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command\n * @param {number} x the x position to start drawing the text\n * @param {number} y the y position to start drawing the text\n * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`)\n * @param {number} maxWidth (optional) the boundary width to draw in\n * @param {number} maxHeight (optional) the boundary height to draw in\n * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written\n * @returns {Jimp} this for chaining of methods\n */\n print(font, x, y, text, maxWidth, maxHeight, cb) {\n if (typeof maxWidth === \"function\" && typeof cb === \"undefined\") {\n cb = maxWidth;\n maxWidth = Infinity;\n }\n\n if (typeof maxWidth === \"undefined\") {\n maxWidth = Infinity;\n }\n\n if (typeof maxHeight === \"function\" && typeof cb === \"undefined\") {\n cb = maxHeight;\n maxHeight = Infinity;\n }\n\n if (typeof maxHeight === \"undefined\") {\n maxHeight = Infinity;\n }\n\n if (typeof font !== \"object\") {\n return throwError.call(this, \"font must be a Jimp loadFont\", cb);\n }\n\n if (\n typeof x !== \"number\" ||\n typeof y !== \"number\" ||\n typeof maxWidth !== \"number\"\n ) {\n return throwError.call(this, \"x, y and maxWidth must be numbers\", cb);\n }\n\n if (typeof maxWidth !== \"number\") {\n return throwError.call(this, \"maxWidth must be a number\", cb);\n }\n\n if (typeof maxHeight !== \"number\") {\n return throwError.call(this, \"maxHeight must be a number\", cb);\n }\n\n let alignmentX;\n let alignmentY;\n\n if (\n typeof text === \"object\" &&\n text.text !== null &&\n text.text !== undefined\n ) {\n alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP;\n ({ text } = text);\n } else {\n alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = this.constructor.VERTICAL_ALIGN_TOP;\n text = text.toString();\n }\n\n if (\n maxHeight !== Infinity &&\n alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM\n ) {\n y += maxHeight - measureTextHeight(font, text, maxWidth);\n } else if (\n maxHeight !== Infinity &&\n alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE\n ) {\n y += maxHeight / 2 - measureTextHeight(font, text, maxWidth) / 2;\n }\n\n const defaultCharWidth = Object.entries(font.chars)[0][1].xadvance;\n const { lines, longestLine } = splitLines(font, text, maxWidth);\n\n lines.forEach((line) => {\n const lineString = line.join(\" \");\n const alignmentWidth = xOffsetBasedOnAlignment(\n this.constructor,\n font,\n lineString,\n maxWidth,\n alignmentX\n );\n\n printText.call(\n this,\n font,\n x + alignmentWidth,\n y,\n lineString,\n defaultCharWidth\n );\n\n y += font.common.lineHeight;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this, { x: x + longestLine, y });\n }\n\n return this;\n },\n },\n});\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAA4E;AAE5E,SAASA,uBAAuB,CAACC,SAAS,EAAEC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,SAAS,EAAE;EAC3E,IAAIA,SAAS,KAAKJ,SAAS,CAACK,qBAAqB,EAAE;IACjD,OAAO,CAAC;EACV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;MAClE,MAAM;QAAE+D,KAAK;QAAEC;MAAY,CAAC,GAAG,IAAAC,uBAAU,EAAChG,IAAI,EAAEqB,IAAI,EAAEnB,QAAQ,CAAC;MAE/D4F,KAAK,CAACG,OAAO,CAAEhG,IAAI,IAAK;QACtB,MAAMiG,UAAU,GAAGjG,IAAI,CAAC8C,IAAI,CAAC,GAAG,CAAC;QACjC,MAAMoD,cAAc,GAAGrG,uBAAuB,CAC5C,IAAI,CAACyF,WAAW,EAChBvF,IAAI,EACJkG,UAAU,EACVhG,QAAQ,EACRkF,UAAU,CACX;QAEDhE,SAAS,CAAC4C,IAAI,CACZ,IAAI,EACJhE,IAAI,EACJS,CAAC,GAAG0F,cAAc,EAClBzF,CAAC,EACDwF,UAAU,EACV5E,gBAAgB,CACjB;QAEDZ,CAAC,IAAIV,IAAI,CAAC8E,MAAM,CAACsB,UAAU;MAC7B,CAAC,CAAC;MAEF,IAAI,IAAAC,oBAAa,EAACvC,EAAE,CAAC,EAAE;QACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE;UAAEvD,CAAC,EAAEA,CAAC,GAAGsF,WAAW;UAAErF;QAAE,CAAC,CAAC;MACtD;MAEA,OAAO,IAAI;IACb;EACF;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-print/dist/measure-text.js b/project starter code/node_modules/@jimp/plugin-print/dist/measure-text.js index b75ac795..85ec9380 100644 --- a/project starter code/node_modules/@jimp/plugin-print/dist/measure-text.js +++ b/project starter code/node_modules/@jimp/plugin-print/dist/measure-text.js @@ -5,37 +5,45 @@ Object.defineProperty(exports, "__esModule", { }); exports.measureText = measureText; exports.measureTextHeight = measureTextHeight; - +exports.splitLines = splitLines; function measureText(font, text) { - var x = 0; - - for (var i = 0; i < text.length; i++) { + let x = 0; + for (let i = 0; i < text.length; i++) { if (font.chars[text[i]]) { - var kerning = font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]] ? font.kernings[text[i]][text[i + 1]] : 0; + const kerning = font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]] ? font.kernings[text[i]][text[i + 1]] : 0; x += (font.chars[text[i]].xadvance || 0) + kerning; } } - return x; } - -function measureTextHeight(font, text, maxWidth) { - var words = text.split(' '); - var line = ''; - var textTotalHeight = font.common.lineHeight; - - for (var n = 0; n < words.length; n++) { - var testLine = line + words[n] + ' '; - var testWidth = measureText(font, testLine); - - if (testWidth > maxWidth && n > 0) { - textTotalHeight += font.common.lineHeight; - line = words[n] + ' '; +function splitLines(font, text, maxWidth) { + const words = text.replace(/[\r\n]+/g, " \n").split(" "); + const lines = []; + let currentLine = []; + let longestLine = 0; + words.forEach(word => { + const line = [...currentLine, word].join(" "); + const length = measureText(font, line); + if (length <= maxWidth && !word.includes("\n")) { + if (length > longestLine) { + longestLine = length; + } + currentLine.push(word); } else { - line = testLine; + lines.push(currentLine); + currentLine = [word.replace("\n", "")]; } - } - - return textTotalHeight; + }); + lines.push(currentLine); + return { + lines, + longestLine + }; +} +function measureTextHeight(font, text, maxWidth) { + const { + lines + } = splitLines(font, text, maxWidth); + return lines.length * font.common.lineHeight; } //# sourceMappingURL=measure-text.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-print/dist/measure-text.js.map b/project starter code/node_modules/@jimp/plugin-print/dist/measure-text.js.map index 56209773..d8a9f5a4 100644 --- a/project starter code/node_modules/@jimp/plugin-print/dist/measure-text.js.map +++ b/project starter code/node_modules/@jimp/plugin-print/dist/measure-text.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/measure-text.js"],"names":["measureText","font","text","x","i","length","chars","kerning","kernings","xadvance","measureTextHeight","maxWidth","words","split","line","textTotalHeight","common","lineHeight","n","testLine","testWidth"],"mappings":";;;;;;;;AAAO,SAASA,WAAT,CAAqBC,IAArB,EAA2BC,IAA3B,EAAiC;AACtC,MAAIC,CAAC,GAAG,CAAR;;AAEA,OAAK,IAAIC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AAYC,UAA/B;AACAH,MAAAA,IAAI,GAAGF,KAAK,CAACM,CAAD,CAAL,GAAW,GAAlB;AACD,KAHD,MAGO;AACLJ,MAAAA,IAAI,GAAGK,QAAP;AACD;AACF;;AAED,SAAOJ,eAAP;AACD","sourcesContent":["export function measureText(font, text) {\n let x = 0;\n\n for (let i = 0; i < text.length; i++) {\n if (font.chars[text[i]]) {\n const kerning =\n font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]]\n ? font.kernings[text[i]][text[i + 1]]\n : 0;\n\n x += (font.chars[text[i]].xadvance || 0) + kerning;\n }\n }\n\n return x;\n}\n\nexport function measureTextHeight(font, text, maxWidth) {\n const words = text.split(' ');\n let line = '';\n let textTotalHeight = font.common.lineHeight;\n\n for (let n = 0; n < words.length; n++) {\n const testLine = line + words[n] + ' ';\n const testWidth = measureText(font, testLine);\n\n if (testWidth > maxWidth && n > 0) {\n textTotalHeight += font.common.lineHeight;\n line = words[n] + ' ';\n } else {\n line = testLine;\n }\n }\n\n return textTotalHeight;\n}\n"],"file":"measure-text.js"} \ No newline at end of file +{"version":3,"file":"measure-text.js","names":["measureText","font","text","x","i","length","chars","kerning","kernings","xadvance","splitLines","maxWidth","words","replace","split","lines","currentLine","longestLine","forEach","word","line","join","includes","push","measureTextHeight","common","lineHeight"],"sources":["../src/measure-text.js"],"sourcesContent":["export function measureText(font, text) {\n let x = 0;\n\n for (let i = 0; i < text.length; i++) {\n if (font.chars[text[i]]) {\n const kerning =\n font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]]\n ? font.kernings[text[i]][text[i + 1]]\n : 0;\n\n x += (font.chars[text[i]].xadvance || 0) + kerning;\n }\n }\n\n return x;\n}\n\nexport function splitLines(font, text, maxWidth) {\n const words = text.replace(/[\\r\\n]+/g, \" \\n\").split(\" \");\n\n const lines = [];\n let currentLine = [];\n let longestLine = 0;\n\n words.forEach((word) => {\n const line = [...currentLine, word].join(\" \");\n const length = measureText(font, line);\n\n if (length <= maxWidth && !word.includes(\"\\n\")) {\n if (length > longestLine) {\n longestLine = length;\n }\n\n currentLine.push(word);\n } else {\n lines.push(currentLine);\n currentLine = [word.replace(\"\\n\", \"\")];\n }\n });\n lines.push(currentLine);\n return {\n lines,\n longestLine,\n };\n}\n\nexport function measureTextHeight(font, text, maxWidth) {\n const { lines } = splitLines(font, text, maxWidth);\n\n return lines.length * font.common.lineHeight;\n}\n"],"mappings":";;;;;;;;AAAO,SAASA,WAAW,CAACC,IAAI,EAAEC,IAAI,EAAE;EACtC,IAAIC,CAAC,GAAG,CAAC;EAET,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,IAAI,CAACG,MAAM,EAAED,CAAC,EAAE,EAAE;IACpC,IAAIH,IAAI,CAACK,KAAK,CAACJ,IAAI,CAACE,CAAC,CAAC,CAAC,EAAE;MACvB,MAAMG,OAAO,GACXN,IAAI,CAACO,QAAQ,CAACN,IAAI,CAACE,CAAC,CAAC,CAAC,IAAIH,IAAI,CAACO,QAAQ,CAACN,IAAI,CAACE,CAAC,CAAC,CAAC,CAACF,IAAI,CAACE,CAAC,GAAG,CAAC,CAAC,CAAC,GACzDH,IAAI,CAACO,QAAQ,CAACN,IAAI,CAACE,CAAC,CAAC,CAAC,CAACF,IAAI,CAACE,CAAC,GAAG,CAAC,CAAC,CAAC,GACnC,CAAC;MAEPD,CAAC,IAAI,CAACF,IAAI,CAACK,KAAK,CAACJ,IAAI,CAACE,CAAC,CAAC,CAAC,CAACK,QAAQ,IAAI,CAAC,IAAIF,OAAO;IACpD;EACF;EAEA,OAAOJ,CAAC;AACV;AAEO,SAASO,UAAU,CAACT,IAAI,EAAEC,IAAI,EAAES,QAAQ,EAAE;EAC/C,MAAMC,KAAK,GAAGV,IAAI,CAACW,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAACC,KAAK,CAAC,GAAG,CAAC;EAExD,MAAMC,KAAK,GAAG,EAAE;EAChB,IAAIC,WAAW,GAAG,EAAE;EACpB,IAAIC,WAAW,GAAG,CAAC;EAEnBL,KAAK,CAACM,OAAO,CAAEC,IAAI,IAAK;IACtB,MAAMC,IAAI,GAAG,CAAC,GAAGJ,WAAW,EAAEG,IAAI,CAAC,CAACE,IAAI,CAAC,GAAG,CAAC;IAC7C,MAAMhB,MAAM,GAAGL,WAAW,CAACC,IAAI,EAAEmB,IAAI,CAAC;IAEtC,IAAIf,MAAM,IAAIM,QAAQ,IAAI,CAACQ,IAAI,CAACG,QAAQ,CAAC,IAAI,CAAC,EAAE;MAC9C,IAAIjB,MAAM,GAAGY,WAAW,EAAE;QACxBA,WAAW,GAAGZ,MAAM;MACtB;MAEAW,WAAW,CAACO,IAAI,CAACJ,IAAI,CAAC;IACxB,CAAC,MAAM;MACLJ,KAAK,CAACQ,IAAI,CAACP,WAAW,CAAC;MACvBA,WAAW,GAAG,CAACG,IAAI,CAACN,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACxC;EACF,CAAC,CAAC;EACFE,KAAK,CAACQ,IAAI,CAACP,WAAW,CAAC;EACvB,OAAO;IACLD,KAAK;IACLE;EACF,CAAC;AACH;AAEO,SAASO,iBAAiB,CAACvB,IAAI,EAAEC,IAAI,EAAES,QAAQ,EAAE;EACtD,MAAM;IAAEI;EAAM,CAAC,GAAGL,UAAU,CAACT,IAAI,EAAEC,IAAI,EAAES,QAAQ,CAAC;EAElD,OAAOI,KAAK,CAACV,MAAM,GAAGJ,IAAI,CAACwB,MAAM,CAACC,UAAU;AAC9C"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-print/es/index.js b/project starter code/node_modules/@jimp/plugin-print/es/index.js index 28011073..fe798370 100644 --- a/project starter code/node_modules/@jimp/plugin-print/es/index.js +++ b/project starter code/node_modules/@jimp/plugin-print/es/index.js @@ -1,260 +1,179 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - -var _path = _interopRequireDefault(require("path")); - -var _loadBmfont = _interopRequireDefault(require("load-bmfont")); - -var _utils = require("@jimp/utils"); - -var _measureText = require("./measure-text"); - +import Path from "path"; +import bMFont from "load-bmfont"; +import { isNodePattern, throwError } from "@jimp/utils"; +import { measureText, measureTextHeight, splitLines } from "./measure-text"; function xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) { if (alignment === constants.HORIZONTAL_ALIGN_LEFT) { return 0; } - if (alignment === constants.HORIZONTAL_ALIGN_CENTER) { - return (maxWidth - (0, _measureText.measureText)(font, line)) / 2; + return (maxWidth - measureText(font, line)) / 2; } - - return maxWidth - (0, _measureText.measureText)(font, line); + return maxWidth - measureText(font, line); } - -function drawCharacter(image, font, x, y, _char) { - if (_char.width > 0 && _char.height > 0) { - var characterPage = font.pages[_char.page]; - image.blit(characterPage, x + _char.xoffset, y + _char.yoffset, _char.x, _char.y, _char.width, _char.height); +function drawCharacter(image, font, x, y, char) { + if (char.width > 0 && char.height > 0) { + const characterPage = font.pages[char.page]; + image.blit(characterPage, x + char.xoffset, y + char.yoffset, char.x, char.y, char.width, char.height); } - return image; } - function printText(font, x, y, text, defaultCharWidth) { - for (var i = 0; i < text.length; i++) { - var _char2 = void 0; - + for (let i = 0; i < text.length; i++) { + let char; if (font.chars[text[i]]) { - _char2 = text[i]; + char = text[i]; } else if (/\s/.test(text[i])) { - _char2 = ''; + char = ""; } else { - _char2 = '?'; + char = "?"; } - - var fontChar = font.chars[_char2] || {}; - var fontKerning = font.kernings[_char2]; + const fontChar = font.chars[char] || {}; + const fontKerning = font.kernings[char]; drawCharacter(this, font, x, y, fontChar || {}); - var kerning = fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0; + const kerning = fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0; x += kerning + (fontChar.xadvance || defaultCharWidth); } } - -function splitLines(font, text, maxWidth) { - var words = text.split(' '); - var lines = []; - var currentLine = []; - var longestLine = 0; - words.forEach(function (word) { - var line = [].concat((0, _toConsumableArray2["default"])(currentLine), [word]).join(' '); - var length = (0, _measureText.measureText)(font, line); - - if (length <= maxWidth) { - if (length > longestLine) { - longestLine = length; - } - - currentLine.push(word); - } else { - lines.push(currentLine); - currentLine = [word]; - } - }); - lines.push(currentLine); - return { - lines: lines, - longestLine: longestLine - }; -} - function loadPages(Jimp, dir, pages) { - var newPages = pages.map(function (page) { - return Jimp.read(dir + '/' + page); + const newPages = pages.map(page => { + return Jimp.read(dir + "/" + page); }); return Promise.all(newPages); } - -var dir = process.env.DIRNAME || "".concat(__dirname, "/../"); - -var _default = function _default() { - return { - constants: { - measureText: _measureText.measureText, - measureTextHeight: _measureText.measureTextHeight, - FONT_SANS_8_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt'), - FONT_SANS_10_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt'), - FONT_SANS_12_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt'), - FONT_SANS_14_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt'), - FONT_SANS_16_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt'), - FONT_SANS_32_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt'), - FONT_SANS_64_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt'), - FONT_SANS_128_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt'), - FONT_SANS_8_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt'), - FONT_SANS_16_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt'), - FONT_SANS_32_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt'), - FONT_SANS_64_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt'), - FONT_SANS_128_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt'), - - /** - * Loads a bitmap font from a file - * @param {string} file the file path of a .fnt file - * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded - * @returns {Promise} a promise - */ - loadFont: function loadFont(file, cb) { - var _this = this; - - if (typeof file !== 'string') return _utils.throwError.call(this, 'file must be a string', cb); - return new Promise(function (resolve, reject) { - cb = cb || function (err, font) { - if (err) reject(err);else resolve(font); - }; - - (0, _loadBmfont["default"])(file, function (err, font) { - var chars = {}; - var kernings = {}; - - if (err) { - return _utils.throwError.call(_this, err, cb); - } - - for (var i = 0; i < font.chars.length; i++) { - chars[String.fromCharCode(font.chars[i].id)] = font.chars[i]; - } - - for (var _i = 0; _i < font.kernings.length; _i++) { - var firstString = String.fromCharCode(font.kernings[_i].first); - kernings[firstString] = kernings[firstString] || {}; - kernings[firstString][String.fromCharCode(font.kernings[_i].second)] = font.kernings[_i].amount; - } - - loadPages(_this, _path["default"].dirname(file), font.pages).then(function (pages) { - cb(null, { - chars: chars, - kernings: kernings, - pages: pages, - common: font.common, - info: font.info - }); +const dir = process.env.DIRNAME || `${__dirname}/../`; +export default (() => ({ + constants: { + measureText, + measureTextHeight, + FONT_SANS_8_BLACK: Path.join(dir, "fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt"), + FONT_SANS_10_BLACK: Path.join(dir, "fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt"), + FONT_SANS_12_BLACK: Path.join(dir, "fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt"), + FONT_SANS_14_BLACK: Path.join(dir, "fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt"), + FONT_SANS_16_BLACK: Path.join(dir, "fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt"), + FONT_SANS_32_BLACK: Path.join(dir, "fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt"), + FONT_SANS_64_BLACK: Path.join(dir, "fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt"), + FONT_SANS_128_BLACK: Path.join(dir, "fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt"), + FONT_SANS_8_WHITE: Path.join(dir, "fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt"), + FONT_SANS_16_WHITE: Path.join(dir, "fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt"), + FONT_SANS_32_WHITE: Path.join(dir, "fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt"), + FONT_SANS_64_WHITE: Path.join(dir, "fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt"), + FONT_SANS_128_WHITE: Path.join(dir, "fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt"), + /** + * Loads a bitmap font from a file + * @param {string} file the file path of a .fnt file + * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded + * @returns {Promise} a promise + */ + loadFont(file, cb) { + if (typeof file !== "string") return throwError.call(this, "file must be a string", cb); + return new Promise((resolve, reject) => { + cb = cb || function (err, font) { + if (err) reject(err);else resolve(font); + }; + bMFont(file, (err, font) => { + const chars = {}; + const kernings = {}; + if (err) { + return throwError.call(this, err, cb); + } + for (let i = 0; i < font.chars.length; i++) { + chars[String.fromCharCode(font.chars[i].id)] = font.chars[i]; + } + for (let i = 0; i < font.kernings.length; i++) { + const firstString = String.fromCharCode(font.kernings[i].first); + kernings[firstString] = kernings[firstString] || {}; + kernings[firstString][String.fromCharCode(font.kernings[i].second)] = font.kernings[i].amount; + } + loadPages(this, Path.dirname(file), font.pages).then(pages => { + cb(null, { + chars, + kernings, + pages, + common: font.common, + info: font.info }); }); }); + }); + } + }, + class: { + /** + * Draws a text on a image on a given boundary + * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command + * @param {number} x the x position to start drawing the text + * @param {number} y the y position to start drawing the text + * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`) + * @param {number} maxWidth (optional) the boundary width to draw in + * @param {number} maxHeight (optional) the boundary height to draw in + * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written + * @returns {Jimp} this for chaining of methods + */ + print(font, x, y, text, maxWidth, maxHeight, cb) { + if (typeof maxWidth === "function" && typeof cb === "undefined") { + cb = maxWidth; + maxWidth = Infinity; + } + if (typeof maxWidth === "undefined") { + maxWidth = Infinity; + } + if (typeof maxHeight === "function" && typeof cb === "undefined") { + cb = maxHeight; + maxHeight = Infinity; + } + if (typeof maxHeight === "undefined") { + maxHeight = Infinity; } - }, - "class": { - /** - * Draws a text on a image on a given boundary - * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command - * @param {number} x the x position to start drawing the text - * @param {number} y the y position to start drawing the text - * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`) - * @param {number} maxWidth (optional) the boundary width to draw in - * @param {number} maxHeight (optional) the boundary height to draw in - * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written - * @returns {Jimp} this for chaining of methods - */ - print: function print(font, x, y, text, maxWidth, maxHeight, cb) { - var _this2 = this; - - if (typeof maxWidth === 'function' && typeof cb === 'undefined') { - cb = maxWidth; - maxWidth = Infinity; - } - - if (typeof maxWidth === 'undefined') { - maxWidth = Infinity; - } - - if (typeof maxHeight === 'function' && typeof cb === 'undefined') { - cb = maxHeight; - maxHeight = Infinity; - } - - if (typeof maxHeight === 'undefined') { - maxHeight = Infinity; - } - - if ((0, _typeof2["default"])(font) !== 'object') { - return _utils.throwError.call(this, 'font must be a Jimp loadFont', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number' || typeof maxWidth !== 'number') { - return _utils.throwError.call(this, 'x, y and maxWidth must be numbers', cb); - } - - if (typeof maxWidth !== 'number') { - return _utils.throwError.call(this, 'maxWidth must be a number', cb); - } - - if (typeof maxHeight !== 'number') { - return _utils.throwError.call(this, 'maxHeight must be a number', cb); - } - - var alignmentX; - var alignmentY; - - if ((0, _typeof2["default"])(text) === 'object' && text.text !== null && text.text !== undefined) { - alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT; - alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP; - var _text = text; - text = _text.text; - } else { - alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT; - alignmentY = this.constructor.VERTICAL_ALIGN_TOP; - text = text.toString(); - } - - if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM) { - y += maxHeight - (0, _measureText.measureTextHeight)(font, text, maxWidth); - } else if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE) { - y += maxHeight / 2 - (0, _measureText.measureTextHeight)(font, text, maxWidth) / 2; - } - - var defaultCharWidth = Object.entries(font.chars)[0][1].xadvance; - - var _splitLines = splitLines(font, text, maxWidth), - lines = _splitLines.lines, - longestLine = _splitLines.longestLine; - - lines.forEach(function (line) { - var lineString = line.join(' '); - var alignmentWidth = xOffsetBasedOnAlignment(_this2.constructor, font, lineString, maxWidth, alignmentX); - printText.call(_this2, font, x + alignmentWidth, y, lineString, defaultCharWidth); - y += font.common.lineHeight; + if (typeof font !== "object") { + return throwError.call(this, "font must be a Jimp loadFont", cb); + } + if (typeof x !== "number" || typeof y !== "number" || typeof maxWidth !== "number") { + return throwError.call(this, "x, y and maxWidth must be numbers", cb); + } + if (typeof maxWidth !== "number") { + return throwError.call(this, "maxWidth must be a number", cb); + } + if (typeof maxHeight !== "number") { + return throwError.call(this, "maxHeight must be a number", cb); + } + let alignmentX; + let alignmentY; + if (typeof text === "object" && text.text !== null && text.text !== undefined) { + alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT; + alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP; + ({ + text + } = text); + } else { + alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT; + alignmentY = this.constructor.VERTICAL_ALIGN_TOP; + text = text.toString(); + } + if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM) { + y += maxHeight - measureTextHeight(font, text, maxWidth); + } else if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE) { + y += maxHeight / 2 - measureTextHeight(font, text, maxWidth) / 2; + } + const defaultCharWidth = Object.entries(font.chars)[0][1].xadvance; + const { + lines, + longestLine + } = splitLines(font, text, maxWidth); + lines.forEach(line => { + const lineString = line.join(" "); + const alignmentWidth = xOffsetBasedOnAlignment(this.constructor, font, lineString, maxWidth, alignmentX); + printText.call(this, font, x + alignmentWidth, y, lineString, defaultCharWidth); + y += font.common.lineHeight; + }); + if (isNodePattern(cb)) { + cb.call(this, null, this, { + x: x + longestLine, + y }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this, { - x: x + longestLine, - y: y - }); - } - - return this; } + return this; } - }; -}; - -exports["default"] = _default; + } +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-print/es/index.js.map b/project starter code/node_modules/@jimp/plugin-print/es/index.js.map index e5583103..c76733f4 100644 --- a/project starter code/node_modules/@jimp/plugin-print/es/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-print/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["xOffsetBasedOnAlignment","constants","font","line","maxWidth","alignment","HORIZONTAL_ALIGN_LEFT","HORIZONTAL_ALIGN_CENTER","drawCharacter","image","x","y","char","width","height","characterPage","pages","page","blit","xoffset","yoffset","printText","text","defaultCharWidth","i","length","chars","test","fontChar","fontKerning","kernings","kerning","xadvance","splitLines","words","split","lines","currentLine","longestLine","forEach","word","join","push","loadPages","Jimp","dir","newPages","map","read","Promise","all","process","env","DIRNAME","__dirname","measureText","measureTextHeight","FONT_SANS_8_BLACK","Path","FONT_SANS_10_BLACK","FONT_SANS_12_BLACK","FONT_SANS_14_BLACK","FONT_SANS_16_BLACK","FONT_SANS_32_BLACK","FONT_SANS_64_BLACK","FONT_SANS_128_BLACK","FONT_SANS_8_WHITE","FONT_SANS_16_WHITE","FONT_SANS_32_WHITE","FONT_SANS_64_WHITE","FONT_SANS_128_WHITE","loadFont","file","cb","throwError","call","resolve","reject","err","String","fromCharCode","id","firstString","first","second","amount","dirname","then","common","info","print","maxHeight","Infinity","alignmentX","alignmentY","undefined","constructor","VERTICAL_ALIGN_TOP","toString","VERTICAL_ALIGN_BOTTOM","VERTICAL_ALIGN_MIDDLE","Object","entries","lineString","alignmentWidth","lineHeight"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA,SAASA,uBAAT,CAAiCC,SAAjC,EAA4CC,IAA5C,EAAkDC,IAAlD,EAAwDC,QAAxD,EAAkEC,SAAlE,EAA6E;AAC3E,MAAIA,SAAS,KAAKJ,SAAS,CAACK,qBAA5B,EAAmD;AACjD,WAAO,CAAP;AACD;;AAED,MAAID,SAAS,KAAKJ,SAAS,CAACM,uBAA5B,EAAqD;AACnD,WAAO,CAACH,QAAQ,GAAG,8BAAYF,IAAZ,EAAkBC,IAAlB,CAAZ,IAAuC,CAA9C;AACD;;AAED,SAAOC,QAAQ,GAAG,8BAAYF,IAAZ,EAAkBC,IAAlB,CAAlB;AACD;;AAED,SAASK,aAAT,CAAuBC,KAAvB,EAA8BP,IAA9B,EAAoCQ,CAApC,EAAuCC,CAAvC,EAA0CC,KAA1C,EAAgD;AAC9C,MAAIA,KAAI,CAACC,KAAL,GAAa,CAAb,IAAkBD,KAAI,CAACE,MAAL,GAAc,CAApC,EAAuC;AACrC,QAAMC,aAAa,GAAGb,IAAI,CAACc,KAAL,CAAWJ,KAAI,CAACK,IAAhB,CAAtB;AAEAR,IAAAA,KAAK,CAACS,IAAN,CACEH,aADF,EAEEL,CAAC,GAAGE,KAAI,CAACO,OAFX,EAGER,C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;AACD,SApBD;;AAsBA,YAAI,0BAAchC,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB,EAA0B;AAAEjE,YAAAA,CAAC,EAAEA,CAAC,GAAG4B,WAAT;AAAsB3B,YAAAA,CAAC,EAADA;AAAtB,WAA1B;AACD;;AAED,eAAO,IAAP;AACD;AA9GI;AA9Ga,GAAP;AAAA,C","sourcesContent":["import Path from 'path';\nimport bMFont from 'load-bmfont';\nimport { isNodePattern, throwError } from '@jimp/utils';\nimport { measureText, measureTextHeight } from './measure-text';\n\nfunction xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) {\n if (alignment === constants.HORIZONTAL_ALIGN_LEFT) {\n return 0;\n }\n\n if (alignment === constants.HORIZONTAL_ALIGN_CENTER) {\n return (maxWidth - measureText(font, line)) / 2;\n }\n\n return maxWidth - measureText(font, line);\n}\n\nfunction drawCharacter(image, font, x, y, char) {\n if (char.width > 0 && char.height > 0) {\n const characterPage = font.pages[char.page];\n\n image.blit(\n characterPage,\n x + char.xoffset,\n y + char.yoffset,\n char.x,\n char.y,\n char.width,\n char.height\n );\n }\n\n return image;\n}\n\nfunction printText(font, x, y, text, defaultCharWidth) {\n for (let i = 0; i < text.length; i++) {\n let char;\n\n if (font.chars[text[i]]) {\n char = text[i];\n } else if (/\\s/.test(text[i])) {\n char = '';\n } else {\n char = '?';\n }\n\n const fontChar = font.chars[char] || {};\n const fontKerning = font.kernings[char];\n\n drawCharacter(this, font, x, y, fontChar || {});\n\n const kerning =\n fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0;\n\n x += kerning + (fontChar.xadvance || defaultCharWidth);\n }\n}\n\nfunction splitLines(font, text, maxWidth) {\n const words = text.split(' ');\n const lines = [];\n let currentLine = [];\n let longestLine = 0;\n\n words.forEach(word => {\n const line = [...currentLine, word].join(' ');\n const length = measureText(font, line);\n\n if (length <= maxWidth) {\n if (length > longestLine) {\n longestLine = length;\n }\n\n currentLine.push(word);\n } else {\n lines.push(currentLine);\n currentLine = [word];\n }\n });\n\n lines.push(currentLine);\n\n return {\n lines,\n longestLine\n };\n}\n\nfunction loadPages(Jimp, dir, pages) {\n const newPages = pages.map(page => {\n return Jimp.read(dir + '/' + page);\n });\n\n return Promise.all(newPages);\n}\n\nconst dir = process.env.DIRNAME || `${__dirname}/../`;\n\nexport default () => ({\n constants: {\n measureText,\n measureTextHeight,\n FONT_SANS_8_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt'\n ),\n FONT_SANS_10_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt'\n ),\n FONT_SANS_12_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt'\n ),\n FONT_SANS_14_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt'\n ),\n FONT_SANS_16_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt'\n ),\n FONT_SANS_32_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt'\n ),\n FONT_SANS_64_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt'\n ),\n FONT_SANS_128_BLACK: Path.join(\n dir,\n 'fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt'\n ),\n\n FONT_SANS_8_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt'\n ),\n FONT_SANS_16_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt'\n ),\n FONT_SANS_32_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt'\n ),\n FONT_SANS_64_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt'\n ),\n FONT_SANS_128_WHITE: Path.join(\n dir,\n 'fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt'\n ),\n\n /**\n * Loads a bitmap font from a file\n * @param {string} file the file path of a .fnt file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded\n * @returns {Promise} a promise\n */\n loadFont(file, cb) {\n if (typeof file !== 'string')\n return throwError.call(this, 'file must be a string', cb);\n\n return new Promise((resolve, reject) => {\n cb =\n cb ||\n function(err, font) {\n if (err) reject(err);\n else resolve(font);\n };\n\n bMFont(file, (err, font) => {\n const chars = {};\n const kernings = {};\n\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n for (let i = 0; i < font.chars.length; i++) {\n chars[String.fromCharCode(font.chars[i].id)] = font.chars[i];\n }\n\n for (let i = 0; i < font.kernings.length; i++) {\n const firstString = String.fromCharCode(font.kernings[i].first);\n kernings[firstString] = kernings[firstString] || {};\n kernings[firstString][\n String.fromCharCode(font.kernings[i].second)\n ] = font.kernings[i].amount;\n }\n\n loadPages(this, Path.dirname(file), font.pages).then(pages => {\n cb(null, {\n chars,\n kernings,\n pages,\n common: font.common,\n info: font.info\n });\n });\n });\n });\n }\n },\n\n class: {\n /**\n * Draws a text on a image on a given boundary\n * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command\n * @param {number} x the x position to start drawing the text\n * @param {number} y the y position to start drawing the text\n * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`)\n * @param {number} maxWidth (optional) the boundary width to draw in\n * @param {number} maxHeight (optional) the boundary height to draw in\n * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written\n * @returns {Jimp} this for chaining of methods\n */\n print(font, x, y, text, maxWidth, maxHeight, cb) {\n if (typeof maxWidth === 'function' && typeof cb === 'undefined') {\n cb = maxWidth;\n maxWidth = Infinity;\n }\n\n if (typeof maxWidth === 'undefined') {\n maxWidth = Infinity;\n }\n\n if (typeof maxHeight === 'function' && typeof cb === 'undefined') {\n cb = maxHeight;\n maxHeight = Infinity;\n }\n\n if (typeof maxHeight === 'undefined') {\n maxHeight = Infinity;\n }\n\n if (typeof font !== 'object') {\n return throwError.call(this, 'font must be a Jimp loadFont', cb);\n }\n\n if (\n typeof x !== 'number' ||\n typeof y !== 'number' ||\n typeof maxWidth !== 'number'\n ) {\n return throwError.call(this, 'x, y and maxWidth must be numbers', cb);\n }\n\n if (typeof maxWidth !== 'number') {\n return throwError.call(this, 'maxWidth must be a number', cb);\n }\n\n if (typeof maxHeight !== 'number') {\n return throwError.call(this, 'maxHeight must be a number', cb);\n }\n\n let alignmentX;\n let alignmentY;\n\n if (\n typeof text === 'object' &&\n text.text !== null &&\n text.text !== undefined\n ) {\n alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP;\n ({ text } = text);\n } else {\n alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = this.constructor.VERTICAL_ALIGN_TOP;\n text = text.toString();\n }\n\n if (\n maxHeight !== Infinity &&\n alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM\n ) {\n y += maxHeight - measureTextHeight(font, text, maxWidth);\n } else if (\n maxHeight !== Infinity &&\n alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE\n ) {\n y += maxHeight / 2 - measureTextHeight(font, text, maxWidth) / 2;\n }\n\n const defaultCharWidth = Object.entries(font.chars)[0][1].xadvance;\n const { lines, longestLine } = splitLines(font, text, maxWidth);\n\n lines.forEach(line => {\n const lineString = line.join(' ');\n const alignmentWidth = xOffsetBasedOnAlignment(\n this.constructor,\n font,\n lineString,\n maxWidth,\n alignmentX\n );\n\n printText.call(\n this,\n font,\n x + alignmentWidth,\n y,\n lineString,\n defaultCharWidth\n );\n\n y += font.common.lineHeight;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this, { x: x + longestLine, y });\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["Path","bMFont","isNodePattern","throwError","measureText","measureTextHeight","splitLines","xOffsetBasedOnAlignment","constants","font","line","maxWidth","alignment","HORIZONTAL_ALIGN_LEFT","HORIZONTAL_ALIGN_CENTER","drawCharacter","image","x","y","char","width","height","characterPage","pages","page","blit","xoffset","yoffset","printText","text","defaultCharWidth","i","length","chars","test","fontChar","fontKerning","kernings","kerning","xadvance","loadPages","Jimp","dir","newPages","map","read","Promise","all","process","env","DIRNAME","__dirname","FONT_SANS_8_BLACK","join","FONT_SANS_10_BLACK","FONT_SANS_12_BLACK","FONT_SANS_14_BLACK","FONT_SANS_16_BLACK","FONT_SANS_32_BLACK","FONT_SANS_64_BLACK","FONT_SANS_128_BLACK","FONT_SANS_8_WHITE","FONT_SANS_16_WHITE","FONT_SANS_32_WHITE","FONT_SANS_64_WHITE","FONT_SANS_128_WHITE","loadFont","file","cb","call","resolve","reject","err","String","fromCharCode","id","firstString","first","second","amount","dirname","then","common","info","class","print","maxHeight","Infinity","alignmentX","alignmentY","undefined","constructor","VERTICAL_ALIGN_TOP","toString","VERTICAL_ALIGN_BOTTOM","VERTICAL_ALIGN_MIDDLE","Object","entries","lines","longestLine","forEach","lineString","alignmentWidth","lineHeight"],"sources":["../src/index.js"],"sourcesContent":["import Path from \"path\";\nimport bMFont from \"load-bmfont\";\nimport { isNodePattern, throwError } from \"@jimp/utils\";\nimport { measureText, measureTextHeight, splitLines } from \"./measure-text\";\n\nfunction xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) {\n if (alignment === constants.HORIZONTAL_ALIGN_LEFT) {\n return 0;\n }\n\n if (alignment === constants.HORIZONTAL_ALIGN_CENTER) {\n return (maxWidth - measureText(font, line)) / 2;\n }\n\n return maxWidth - measureText(font, line);\n}\n\nfunction drawCharacter(image, font, x, y, char) {\n if (char.width > 0 && char.height > 0) {\n const characterPage = font.pages[char.page];\n\n image.blit(\n characterPage,\n x + char.xoffset,\n y + char.yoffset,\n char.x,\n char.y,\n char.width,\n char.height\n );\n }\n\n return image;\n}\n\nfunction printText(font, x, y, text, defaultCharWidth) {\n for (let i = 0; i < text.length; i++) {\n let char;\n\n if (font.chars[text[i]]) {\n char = text[i];\n } else if (/\\s/.test(text[i])) {\n char = \"\";\n } else {\n char = \"?\";\n }\n\n const fontChar = font.chars[char] || {};\n const fontKerning = font.kernings[char];\n\n drawCharacter(this, font, x, y, fontChar || {});\n\n const kerning =\n fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0;\n\n x += kerning + (fontChar.xadvance || defaultCharWidth);\n }\n}\n\nfunction loadPages(Jimp, dir, pages) {\n const newPages = pages.map((page) => {\n return Jimp.read(dir + \"/\" + page);\n });\n\n return Promise.all(newPages);\n}\n\nconst dir = process.env.DIRNAME || `${__dirname}/../`;\n\nexport default () => ({\n constants: {\n measureText,\n measureTextHeight,\n FONT_SANS_8_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt\"\n ),\n FONT_SANS_10_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt\"\n ),\n FONT_SANS_12_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt\"\n ),\n FONT_SANS_14_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt\"\n ),\n FONT_SANS_16_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt\"\n ),\n FONT_SANS_32_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt\"\n ),\n FONT_SANS_64_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt\"\n ),\n FONT_SANS_128_BLACK: Path.join(\n dir,\n \"fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt\"\n ),\n\n FONT_SANS_8_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt\"\n ),\n FONT_SANS_16_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt\"\n ),\n FONT_SANS_32_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt\"\n ),\n FONT_SANS_64_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt\"\n ),\n FONT_SANS_128_WHITE: Path.join(\n dir,\n \"fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt\"\n ),\n\n /**\n * Loads a bitmap font from a file\n * @param {string} file the file path of a .fnt file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded\n * @returns {Promise} a promise\n */\n loadFont(file, cb) {\n if (typeof file !== \"string\")\n return throwError.call(this, \"file must be a string\", cb);\n\n return new Promise((resolve, reject) => {\n cb =\n cb ||\n function (err, font) {\n if (err) reject(err);\n else resolve(font);\n };\n\n bMFont(file, (err, font) => {\n const chars = {};\n const kernings = {};\n\n if (err) {\n return throwError.call(this, err, cb);\n }\n\n for (let i = 0; i < font.chars.length; i++) {\n chars[String.fromCharCode(font.chars[i].id)] = font.chars[i];\n }\n\n for (let i = 0; i < font.kernings.length; i++) {\n const firstString = String.fromCharCode(font.kernings[i].first);\n kernings[firstString] = kernings[firstString] || {};\n kernings[firstString][\n String.fromCharCode(font.kernings[i].second)\n ] = font.kernings[i].amount;\n }\n\n loadPages(this, Path.dirname(file), font.pages).then((pages) => {\n cb(null, {\n chars,\n kernings,\n pages,\n common: font.common,\n info: font.info,\n });\n });\n });\n });\n },\n },\n\n class: {\n /**\n * Draws a text on a image on a given boundary\n * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command\n * @param {number} x the x position to start drawing the text\n * @param {number} y the y position to start drawing the text\n * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`)\n * @param {number} maxWidth (optional) the boundary width to draw in\n * @param {number} maxHeight (optional) the boundary height to draw in\n * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written\n * @returns {Jimp} this for chaining of methods\n */\n print(font, x, y, text, maxWidth, maxHeight, cb) {\n if (typeof maxWidth === \"function\" && typeof cb === \"undefined\") {\n cb = maxWidth;\n maxWidth = Infinity;\n }\n\n if (typeof maxWidth === \"undefined\") {\n maxWidth = Infinity;\n }\n\n if (typeof maxHeight === \"function\" && typeof cb === \"undefined\") {\n cb = maxHeight;\n maxHeight = Infinity;\n }\n\n if (typeof maxHeight === \"undefined\") {\n maxHeight = Infinity;\n }\n\n if (typeof font !== \"object\") {\n return throwError.call(this, \"font must be a Jimp loadFont\", cb);\n }\n\n if (\n typeof x !== \"number\" ||\n typeof y !== \"number\" ||\n typeof maxWidth !== \"number\"\n ) {\n return throwError.call(this, \"x, y and maxWidth must be numbers\", cb);\n }\n\n if (typeof maxWidth !== \"number\") {\n return throwError.call(this, \"maxWidth must be a number\", cb);\n }\n\n if (typeof maxHeight !== \"number\") {\n return throwError.call(this, \"maxHeight must be a number\", cb);\n }\n\n let alignmentX;\n let alignmentY;\n\n if (\n typeof text === \"object\" &&\n text.text !== null &&\n text.text !== undefined\n ) {\n alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP;\n ({ text } = text);\n } else {\n alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = this.constructor.VERTICAL_ALIGN_TOP;\n text = text.toString();\n }\n\n if (\n maxHeight !== Infinity &&\n alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM\n ) {\n y += maxHeight - measureTextHeight(font, text, maxWidth);\n } else if (\n maxHeight !== Infinity &&\n alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE\n ) {\n y += maxHeight / 2 - measureTextHeight(font, text, maxWidth) / 2;\n }\n\n const defaultCharWidth = Object.entries(font.chars)[0][1].xadvance;\n const { lines, longestLine } = splitLines(font, text, maxWidth);\n\n lines.forEach((line) => {\n const lineString = line.join(\" \");\n const alignmentWidth = xOffsetBasedOnAlignment(\n this.constructor,\n font,\n lineString,\n maxWidth,\n alignmentX\n );\n\n printText.call(\n this,\n font,\n x + alignmentWidth,\n y,\n lineString,\n defaultCharWidth\n );\n\n y += font.common.lineHeight;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this, { x: x + longestLine, y });\n }\n\n return this;\n },\n },\n});\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;AACvB,OAAOC,MAAM,MAAM,aAAa;AAChC,SAASC,aAAa,EAAEC,UAAU,QAAQ,aAAa;AACvD,SAASC,WAAW,EAAEC,iBAAiB,EAAEC,UAAU,QAAQ,gBAAgB;AAE3E,SAASC,uBAAuB,CAACC,SAAS,EAAEC,IAAI,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,SAAS,EAAE;EAC3E,IAAIA,SAAS,KAAKJ,SAAS,CAACK,qBAAqB,EAAE;IACjD,OAAO,CAAC;EACV;EAEA,IAAID,SAAS,KAAKJ,SAAS,CAACM,uBAAuB,EAAE;IACnD,OAAO,CAACH,QAAQ,GAAGP,WAAW,CAACK,IAAI,EAAEC,IAAI,CAAC,IAAI,CAAC;EACjD;EAEA,OAAOC,QAAQ,GAAGP,WAAW,CAACK,IAAI,EAAEC,IAAI,CAAC;AAC3C;AAEA,SAASK,aAAa,CAACC,KAAK,EAAEP,IAAI,EAAEQ,CAAC,EAAEC,CAAC,EAAEC,IAAI,EAAE;EAC9C,IAAIA,IAAI,CAACC,KAAK,GAAG,CAAC,IAAID,IAAI,CAACE,MAAM,GAAG,CAAC,EAAE;IACrC,MAAMC,aAAa,GAAGb,IAAI,CAACc,KAAK,CAACJ,IAAI,CAACK,IAAI,CAAC;IAE3CR,KAAK,CAACS,IAAI,CACRH,aAAa,EACbL,CAAC,GAAGE,IAAI,CAACO,OAAO,EAChBR,CAAC,GAAGC,IAAI,CAACQ,OAAO,EAChBR,IAAI,CAAC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EAAE;UAAEpD,CAAC,EAAEA,CAAC,GAAGkF,WAAW;UAAEjF;QAAE,CAAC,CAAC;MACtD;MAEA,OAAO,IAAI;IACb;EACF;AACF,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-print/es/measure-text.js b/project starter code/node_modules/@jimp/plugin-print/es/measure-text.js index b75ac795..7d493bd4 100644 --- a/project starter code/node_modules/@jimp/plugin-print/es/measure-text.js +++ b/project starter code/node_modules/@jimp/plugin-print/es/measure-text.js @@ -1,41 +1,41 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.measureText = measureText; -exports.measureTextHeight = measureTextHeight; - -function measureText(font, text) { - var x = 0; - - for (var i = 0; i < text.length; i++) { +export function measureText(font, text) { + let x = 0; + for (let i = 0; i < text.length; i++) { if (font.chars[text[i]]) { - var kerning = font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]] ? font.kernings[text[i]][text[i + 1]] : 0; + const kerning = font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]] ? font.kernings[text[i]][text[i + 1]] : 0; x += (font.chars[text[i]].xadvance || 0) + kerning; } } - return x; } - -function measureTextHeight(font, text, maxWidth) { - var words = text.split(' '); - var line = ''; - var textTotalHeight = font.common.lineHeight; - - for (var n = 0; n < words.length; n++) { - var testLine = line + words[n] + ' '; - var testWidth = measureText(font, testLine); - - if (testWidth > maxWidth && n > 0) { - textTotalHeight += font.common.lineHeight; - line = words[n] + ' '; +export function splitLines(font, text, maxWidth) { + const words = text.replace(/[\r\n]+/g, " \n").split(" "); + const lines = []; + let currentLine = []; + let longestLine = 0; + words.forEach(word => { + const line = [...currentLine, word].join(" "); + const length = measureText(font, line); + if (length <= maxWidth && !word.includes("\n")) { + if (length > longestLine) { + longestLine = length; + } + currentLine.push(word); } else { - line = testLine; + lines.push(currentLine); + currentLine = [word.replace("\n", "")]; } - } - - return textTotalHeight; + }); + lines.push(currentLine); + return { + lines, + longestLine + }; +} +export function measureTextHeight(font, text, maxWidth) { + const { + lines + } = splitLines(font, text, maxWidth); + return lines.length * font.common.lineHeight; } //# sourceMappingURL=measure-text.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-print/es/measure-text.js.map b/project starter code/node_modules/@jimp/plugin-print/es/measure-text.js.map index 56209773..24304226 100644 --- a/project starter code/node_modules/@jimp/plugin-print/es/measure-text.js.map +++ b/project starter code/node_modules/@jimp/plugin-print/es/measure-text.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/measure-text.js"],"names":["measureText","font","text","x","i","length","chars","kerning","kernings","xadvance","measureTextHeight","maxWidth","words","split","line","textTotalHeight","common","lineHeight","n","testLine","testWidth"],"mappings":";;;;;;;;AAAO,SAASA,WAAT,CAAqBC,IAArB,EAA2BC,IAA3B,EAAiC;AACtC,MAAIC,CAAC,GAAG,CAAR;;AAEA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,IAAI,CAACG,MAAzB,EAAiCD,CAAC,EAAlC,EAAsC;AACpC,QAAIH,IAAI,CAACK,KAAL,CAAWJ,IAAI,CAACE,CAAD,CAAf,CAAJ,EAAyB;AACvB,UAAMG,OAAO,GACXN,IAAI,CAACO,QAAL,CAAcN,IAAI,CAACE,CAAD,CAAlB,KAA0BH,IAAI,CAACO,QAAL,CAAcN,IAAI,CAACE,CAAD,CAAlB,EAAuBF,IAAI,CAACE,CAAC,GAAG,CAAL,CAA3B,CAA1B,GACIH,IAAI,CAACO,QAAL,CAAcN,IAAI,CAACE,CAAD,CAAlB,EAAuBF,IAAI,CAACE,CAAC,GAAG,CAAL,CAA3B,CADJ,GAEI,CAHN;AAKAD,MAAAA,CAAC,IAAI,CAACF,IAAI,CAACK,KAAL,CAAWJ,IAAI,CAACE,CAAD,CAAf,EAAoBK,QAApB,IAAgC,CAAjC,IAAsCF,OAA3C;AACD;AACF;;AAED,SAAOJ,CAAP;AACD;;AAEM,SAASO,iBAAT,CAA2BT,IAA3B,EAAiCC,IAAjC,EAAuCS,QAAvC,EAAiD;AACtD,MAAMC,KAAK,GAAGV,IAAI,CAACW,KAAL,CAAW,GAAX,CAAd;AACA,MAAIC,IAAI,GAAG,EAAX;AACA,MAAIC,eAAe,GAAGd,IAAI,CAACe,MAAL,CAAYC,UAAlC;;AAEA,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGN,KAAK,CAACP,MAA1B,EAAkCa,CAAC,EAAnC,EAAuC;AACrC,QAAMC,QAAQ,GAAGL,IAAI,GAAGF,KAAK,CAACM,CAAD,CAAZ,GAAkB,GAAnC;AACA,QAAME,SAAS,GAAGpB,WAAW,CAACC,IAAD,EAAOkB,QAAP,CAA7B;;AAEA,QAAIC,SAAS,GAAGT,QAAZ,IAAwBO,CAAC,GAAG,CAAhC,EAAmC;AACjCH,MAAAA,eAAe,IAAId,IAAI,CAACe,MAAL,CAAYC,UAA/B;AACAH,MAAAA,IAAI,GAAGF,KAAK,CAACM,CAAD,CAAL,GAAW,GAAlB;AACD,KAHD,MAGO;AACLJ,MAAAA,IAAI,GAAGK,QAAP;AACD;AACF;;AAED,SAAOJ,eAAP;AACD","sourcesContent":["export function measureText(font, text) {\n let x = 0;\n\n for (let i = 0; i < text.length; i++) {\n if (font.chars[text[i]]) {\n const kerning =\n font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]]\n ? font.kernings[text[i]][text[i + 1]]\n : 0;\n\n x += (font.chars[text[i]].xadvance || 0) + kerning;\n }\n }\n\n return x;\n}\n\nexport function measureTextHeight(font, text, maxWidth) {\n const words = text.split(' ');\n let line = '';\n let textTotalHeight = font.common.lineHeight;\n\n for (let n = 0; n < words.length; n++) {\n const testLine = line + words[n] + ' ';\n const testWidth = measureText(font, testLine);\n\n if (testWidth > maxWidth && n > 0) {\n textTotalHeight += font.common.lineHeight;\n line = words[n] + ' ';\n } else {\n line = testLine;\n }\n }\n\n return textTotalHeight;\n}\n"],"file":"measure-text.js"} \ No newline at end of file +{"version":3,"file":"measure-text.js","names":["measureText","font","text","x","i","length","chars","kerning","kernings","xadvance","splitLines","maxWidth","words","replace","split","lines","currentLine","longestLine","forEach","word","line","join","includes","push","measureTextHeight","common","lineHeight"],"sources":["../src/measure-text.js"],"sourcesContent":["export function measureText(font, text) {\n let x = 0;\n\n for (let i = 0; i < text.length; i++) {\n if (font.chars[text[i]]) {\n const kerning =\n font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]]\n ? font.kernings[text[i]][text[i + 1]]\n : 0;\n\n x += (font.chars[text[i]].xadvance || 0) + kerning;\n }\n }\n\n return x;\n}\n\nexport function splitLines(font, text, maxWidth) {\n const words = text.replace(/[\\r\\n]+/g, \" \\n\").split(\" \");\n\n const lines = [];\n let currentLine = [];\n let longestLine = 0;\n\n words.forEach((word) => {\n const line = [...currentLine, word].join(\" \");\n const length = measureText(font, line);\n\n if (length <= maxWidth && !word.includes(\"\\n\")) {\n if (length > longestLine) {\n longestLine = length;\n }\n\n currentLine.push(word);\n } else {\n lines.push(currentLine);\n currentLine = [word.replace(\"\\n\", \"\")];\n }\n });\n lines.push(currentLine);\n return {\n lines,\n longestLine,\n };\n}\n\nexport function measureTextHeight(font, text, maxWidth) {\n const { lines } = splitLines(font, text, maxWidth);\n\n return lines.length * font.common.lineHeight;\n}\n"],"mappings":"AAAA,OAAO,SAASA,WAAW,CAACC,IAAI,EAAEC,IAAI,EAAE;EACtC,IAAIC,CAAC,GAAG,CAAC;EAET,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,IAAI,CAACG,MAAM,EAAED,CAAC,EAAE,EAAE;IACpC,IAAIH,IAAI,CAACK,KAAK,CAACJ,IAAI,CAACE,CAAC,CAAC,CAAC,EAAE;MACvB,MAAMG,OAAO,GACXN,IAAI,CAACO,QAAQ,CAACN,IAAI,CAACE,CAAC,CAAC,CAAC,IAAIH,IAAI,CAACO,QAAQ,CAACN,IAAI,CAACE,CAAC,CAAC,CAAC,CAACF,IAAI,CAACE,CAAC,GAAG,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AACH;AAEA,OAAO,SAASO,iBAAiB,CAACvB,IAAI,EAAEC,IAAI,EAAES,QAAQ,EAAE;EACtD,MAAM;IAAEI;EAAM,CAAC,GAAGL,UAAU,CAACT,IAAI,EAAEC,IAAI,EAAES,QAAQ,CAAC;EAElD,OAAOI,KAAK,CAACV,MAAM,GAAGJ,IAAI,CAACwB,MAAM,CAACC,UAAU;AAC9C"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt index 6175b9cb..2bb22b19 100644 --- a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt +++ b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt @@ -4,7 +4,8 @@ - + + @@ -193,7 +194,7 @@ - + diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.png b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.png index 77cd5ed6..7e9986e2 100644 Binary files a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.png and b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.png differ diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt index 9c89b440..5e8811e6 100644 --- a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt +++ b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt @@ -4,7 +4,8 @@ - + + @@ -193,7 +194,7 @@ - + diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.png b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.png index 461af9a0..64b949b1 100644 Binary files a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.png and b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.png differ diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt index 602a3a4e..afb29970 100644 --- a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt +++ b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt @@ -1,10 +1,11 @@ - + - + + @@ -193,7 +194,7 @@ - + diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.png b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.png index 4f7e287b..99171bea 100644 Binary files a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.png and b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.png differ diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt index c78ccdce..2b6cbe79 100644 --- a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt +++ b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt @@ -1,10 +1,11 @@ - + - + + @@ -193,7 +194,7 @@ - + diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.png b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.png index 039206cf..ccb1e3c9 100644 Binary files a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.png and b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-16-white/open-sans-16-white.png differ diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt index 3733597b..f2d9bf4a 100644 --- a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt +++ b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt @@ -1,10 +1,11 @@ - + - + + @@ -193,7 +194,7 @@ - + diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.png b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.png index a064a112..50ff1b41 100644 Binary files a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.png and b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-black/open-sans-32-black.png differ diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt index 6b51c7c0..35c3584d 100644 --- a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt +++ b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt @@ -1,10 +1,11 @@ - + - + + @@ -193,7 +194,7 @@ - + diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.png b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.png index 4ecce3e5..5900c354 100644 Binary files a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.png and b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-32-white/open-sans-32-white.png differ diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt index 500c923e..f4580f3c 100644 --- a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt +++ b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt @@ -4,7 +4,8 @@ - + + @@ -193,7 +194,7 @@ - + diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.png b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.png index 25fe95fe..47af5238 100644 Binary files a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.png and b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-black/open-sans-64-black.png differ diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt index 19a72453..dca72ad3 100644 --- a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt +++ b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt @@ -4,7 +4,8 @@ - + + @@ -193,7 +194,7 @@ - + diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.png b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.png index 1baf1f50..de9a88aa 100644 Binary files a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.png and b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-64-white/open-sans-64-white.png differ diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt index 15b6be3a..34f0e621 100644 --- a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt +++ b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt @@ -1,10 +1,11 @@ - + - + + @@ -193,7 +194,7 @@ - + diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.png b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.png index 71a55514..b0579858 100644 Binary files a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.png and b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-black/open-sans-8-black.png differ diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt index 3264cc42..6d437678 100644 --- a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt +++ b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt @@ -4,7 +4,8 @@ - + + @@ -193,7 +194,7 @@ - + diff --git a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.png b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.png index ed1eb48b..435f6d5e 100644 Binary files a/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.png and b/project starter code/node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-8-white/open-sans-8-white.png differ diff --git a/project starter code/node_modules/@jimp/plugin-print/index.d.ts b/project starter code/node_modules/@jimp/plugin-print/index.d.ts index 5d0273bb..d906616d 100644 --- a/project starter code/node_modules/@jimp/plugin-print/index.d.ts +++ b/project starter code/node_modules/@jimp/plugin-print/index.d.ts @@ -1,4 +1,4 @@ -import { GenericCallback, ImageCallback } from '@jimp/core'; +import { GenericCallback, ImageCallback } from "@jimp/core"; export interface FontChar { id: number; @@ -57,10 +57,10 @@ export interface Font { type PrintableText = | any | { - text: string; - alignmentX: number; - alignmentY: number; -}; + text: string; + alignmentX: number; + alignmentY: number; + }; interface PrintClass { // Text methods @@ -93,7 +93,11 @@ interface PrintClass { interface Print { constants: { measureText(font: Font, text: PrintableText): number; - measureTextHeight(font: Font, text: PrintableText, maxWidth: number): number; + measureTextHeight( + font: Font, + text: PrintableText, + maxWidth: number + ): number; // Font locations FONT_SANS_8_BLACK: string; @@ -111,11 +115,11 @@ interface Print { FONT_SANS_64_WHITE: string; FONT_SANS_128_WHITE: string; - loadFont(file: string): Promise; loadFont(file: string, cb: GenericCallback): Promise; + loadFont(file: string): Promise; } - class: PrintClass + class: PrintClass; } -export default function(): Print; +export default function (): Print; diff --git a/project starter code/node_modules/@jimp/plugin-print/package.json b/project starter code/node_modules/@jimp/plugin-print/package.json index e48e4e63..240ff6cb 100644 --- a/project starter code/node_modules/@jimp/plugin-print/package.json +++ b/project starter code/node_modules/@jimp/plugin-print/package.json @@ -1,12 +1,13 @@ { "name": "@jimp/plugin-print", - "version": "0.16.2", + "version": "0.22.12", "description": "print an image.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js", "test:watch": "npm run test -- --reporter min --watch", "test:coverage": "nyc npm run test", "build": "npm run build:node:production && npm run build:module", @@ -20,21 +21,20 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "load-bmfont": "^1.4.0" + "@jimp/utils": "^0.22.12", + "load-bmfont": "^1.4.1" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", "@jimp/plugin-blit": ">=0.3.5" }, "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/plugin-blit": "^0.16.2", - "@jimp/test-utils": "^0.16.2" + "@jimp/custom": "^0.22.12", + "@jimp/plugin-blit": "^0.22.12", + "@jimp/test-utils": "^0.22.12" }, "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/plugin-print/src/index.js b/project starter code/node_modules/@jimp/plugin-print/src/index.js index c8e97936..baf8a5c4 100644 --- a/project starter code/node_modules/@jimp/plugin-print/src/index.js +++ b/project starter code/node_modules/@jimp/plugin-print/src/index.js @@ -1,7 +1,7 @@ -import Path from 'path'; -import bMFont from 'load-bmfont'; -import { isNodePattern, throwError } from '@jimp/utils'; -import { measureText, measureTextHeight } from './measure-text'; +import Path from "path"; +import bMFont from "load-bmfont"; +import { isNodePattern, throwError } from "@jimp/utils"; +import { measureText, measureTextHeight, splitLines } from "./measure-text"; function xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) { if (alignment === constants.HORIZONTAL_ALIGN_LEFT) { @@ -40,9 +40,9 @@ function printText(font, x, y, text, defaultCharWidth) { if (font.chars[text[i]]) { char = text[i]; } else if (/\s/.test(text[i])) { - char = ''; + char = ""; } else { - char = '?'; + char = "?"; } const fontChar = font.chars[char] || {}; @@ -57,39 +57,9 @@ function printText(font, x, y, text, defaultCharWidth) { } } -function splitLines(font, text, maxWidth) { - const words = text.split(' '); - const lines = []; - let currentLine = []; - let longestLine = 0; - - words.forEach(word => { - const line = [...currentLine, word].join(' '); - const length = measureText(font, line); - - if (length <= maxWidth) { - if (length > longestLine) { - longestLine = length; - } - - currentLine.push(word); - } else { - lines.push(currentLine); - currentLine = [word]; - } - }); - - lines.push(currentLine); - - return { - lines, - longestLine - }; -} - function loadPages(Jimp, dir, pages) { - const newPages = pages.map(page => { - return Jimp.read(dir + '/' + page); + const newPages = pages.map((page) => { + return Jimp.read(dir + "/" + page); }); return Promise.all(newPages); @@ -103,56 +73,56 @@ export default () => ({ measureTextHeight, FONT_SANS_8_BLACK: Path.join( dir, - 'fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt' + "fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt" ), FONT_SANS_10_BLACK: Path.join( dir, - 'fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt' + "fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt" ), FONT_SANS_12_BLACK: Path.join( dir, - 'fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt' + "fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt" ), FONT_SANS_14_BLACK: Path.join( dir, - 'fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt' + "fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt" ), FONT_SANS_16_BLACK: Path.join( dir, - 'fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt' + "fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt" ), FONT_SANS_32_BLACK: Path.join( dir, - 'fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt' + "fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt" ), FONT_SANS_64_BLACK: Path.join( dir, - 'fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt' + "fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt" ), FONT_SANS_128_BLACK: Path.join( dir, - 'fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt' + "fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt" ), FONT_SANS_8_WHITE: Path.join( dir, - 'fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt' + "fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt" ), FONT_SANS_16_WHITE: Path.join( dir, - 'fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt' + "fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt" ), FONT_SANS_32_WHITE: Path.join( dir, - 'fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt' + "fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt" ), FONT_SANS_64_WHITE: Path.join( dir, - 'fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt' + "fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt" ), FONT_SANS_128_WHITE: Path.join( dir, - 'fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt' + "fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt" ), /** @@ -162,13 +132,13 @@ export default () => ({ * @returns {Promise} a promise */ loadFont(file, cb) { - if (typeof file !== 'string') - return throwError.call(this, 'file must be a string', cb); + if (typeof file !== "string") + return throwError.call(this, "file must be a string", cb); return new Promise((resolve, reject) => { cb = cb || - function(err, font) { + function (err, font) { if (err) reject(err); else resolve(font); }; @@ -193,18 +163,18 @@ export default () => ({ ] = font.kernings[i].amount; } - loadPages(this, Path.dirname(file), font.pages).then(pages => { + loadPages(this, Path.dirname(file), font.pages).then((pages) => { cb(null, { chars, kernings, pages, common: font.common, - info: font.info + info: font.info, }); }); }); }); - } + }, }, class: { @@ -220,49 +190,49 @@ export default () => ({ * @returns {Jimp} this for chaining of methods */ print(font, x, y, text, maxWidth, maxHeight, cb) { - if (typeof maxWidth === 'function' && typeof cb === 'undefined') { + if (typeof maxWidth === "function" && typeof cb === "undefined") { cb = maxWidth; maxWidth = Infinity; } - if (typeof maxWidth === 'undefined') { + if (typeof maxWidth === "undefined") { maxWidth = Infinity; } - if (typeof maxHeight === 'function' && typeof cb === 'undefined') { + if (typeof maxHeight === "function" && typeof cb === "undefined") { cb = maxHeight; maxHeight = Infinity; } - if (typeof maxHeight === 'undefined') { + if (typeof maxHeight === "undefined") { maxHeight = Infinity; } - if (typeof font !== 'object') { - return throwError.call(this, 'font must be a Jimp loadFont', cb); + if (typeof font !== "object") { + return throwError.call(this, "font must be a Jimp loadFont", cb); } if ( - typeof x !== 'number' || - typeof y !== 'number' || - typeof maxWidth !== 'number' + typeof x !== "number" || + typeof y !== "number" || + typeof maxWidth !== "number" ) { - return throwError.call(this, 'x, y and maxWidth must be numbers', cb); + return throwError.call(this, "x, y and maxWidth must be numbers", cb); } - if (typeof maxWidth !== 'number') { - return throwError.call(this, 'maxWidth must be a number', cb); + if (typeof maxWidth !== "number") { + return throwError.call(this, "maxWidth must be a number", cb); } - if (typeof maxHeight !== 'number') { - return throwError.call(this, 'maxHeight must be a number', cb); + if (typeof maxHeight !== "number") { + return throwError.call(this, "maxHeight must be a number", cb); } let alignmentX; let alignmentY; if ( - typeof text === 'object' && + typeof text === "object" && text.text !== null && text.text !== undefined ) { @@ -290,8 +260,8 @@ export default () => ({ const defaultCharWidth = Object.entries(font.chars)[0][1].xadvance; const { lines, longestLine } = splitLines(font, text, maxWidth); - lines.forEach(line => { - const lineString = line.join(' '); + lines.forEach((line) => { + const lineString = line.join(" "); const alignmentWidth = xOffsetBasedOnAlignment( this.constructor, font, @@ -317,6 +287,6 @@ export default () => ({ } return this; - } - } + }, + }, }); diff --git a/project starter code/node_modules/@jimp/plugin-print/src/measure-text.js b/project starter code/node_modules/@jimp/plugin-print/src/measure-text.js index bf14bed8..c1790881 100644 --- a/project starter code/node_modules/@jimp/plugin-print/src/measure-text.js +++ b/project starter code/node_modules/@jimp/plugin-print/src/measure-text.js @@ -15,22 +15,37 @@ export function measureText(font, text) { return x; } -export function measureTextHeight(font, text, maxWidth) { - const words = text.split(' '); - let line = ''; - let textTotalHeight = font.common.lineHeight; +export function splitLines(font, text, maxWidth) { + const words = text.replace(/[\r\n]+/g, " \n").split(" "); + + const lines = []; + let currentLine = []; + let longestLine = 0; - for (let n = 0; n < words.length; n++) { - const testLine = line + words[n] + ' '; - const testWidth = measureText(font, testLine); + words.forEach((word) => { + const line = [...currentLine, word].join(" "); + const length = measureText(font, line); - if (testWidth > maxWidth && n > 0) { - textTotalHeight += font.common.lineHeight; - line = words[n] + ' '; + if (length <= maxWidth && !word.includes("\n")) { + if (length > longestLine) { + longestLine = length; + } + + currentLine.push(word); } else { - line = testLine; + lines.push(currentLine); + currentLine = [word.replace("\n", "")]; } - } + }); + lines.push(currentLine); + return { + lines, + longestLine, + }; +} + +export function measureTextHeight(font, text, maxWidth) { + const { lines } = splitLines(font, text, maxWidth); - return textTotalHeight; + return lines.length * font.common.lineHeight; } diff --git a/project starter code/node_modules/@jimp/plugin-print/test/images/with-newlines.png b/project starter code/node_modules/@jimp/plugin-print/test/images/with-newlines.png new file mode 100644 index 00000000..8da2d115 Binary files /dev/null and b/project starter code/node_modules/@jimp/plugin-print/test/images/with-newlines.png differ diff --git a/project starter code/node_modules/@jimp/plugin-print/test/print.test.js b/project starter code/node_modules/@jimp/plugin-print/test/print.test.js index 36a16669..dee02fea 100644 --- a/project starter code/node_modules/@jimp/plugin-print/test/print.test.js +++ b/project starter code/node_modules/@jimp/plugin-print/test/print.test.js @@ -1,10 +1,11 @@ /* eslint key-spacing: ["error", { "align": "value" }] */ -import { Jimp, getTestDir, hasOwnProp } from '@jimp/test-utils'; -import configure from '@jimp/custom'; -import blit from '@jimp/plugin-blit'; +import { Jimp, getTestDir, hasOwnProp } from "@jimp/test-utils"; +import configure from "@jimp/custom"; +import blit from "@jimp/plugin-blit"; +import expect from "@storybook/expect"; -import print from '../src'; +import print from "../src"; const jimp = configure({ plugins: [print, blit] }, Jimp); @@ -20,7 +21,7 @@ async function createTextImage( return image.print(loadedFont, x, y, text, maxWidth, maxHeight); } -describe('Write text over image', function() { +describe("Write text over image", function () { this.timeout(30000); const fontDefs = { @@ -34,229 +35,230 @@ describe('Write text over image', function() { SANS_16_WHITE: { w: 54, h: 54, bg: 0x000000ff }, SANS_32_WHITE: { w: 114, h: 114, bg: 0x000000ff }, - SANS_64_WHITE: { w: 220, h: 220, bg: 0x000000ff } + SANS_64_WHITE: { w: 220, h: 220, bg: 0x000000ff }, }; for (const fontName in fontDefs) if (hasOwnProp(fontDefs, fontName)) ((fontName, conf) => { - it('Jimp preset ' + fontName + ' bitmap font', async () => { - const font = await jimp.loadFont(Jimp['FONT_' + fontName]); + it("Jimp preset " + fontName + " bitmap font", async () => { + const font = await jimp.loadFont(Jimp["FONT_" + fontName]); const expected = - getTestDir(__dirname) + '/images/' + fontName + '.png'; + getTestDir(__dirname) + "/images/" + fontName + ".png"; const expectedImg = await Jimp.read(expected); const image = await Jimp.create(conf.w, conf.h, conf.bg); - image - .print(font, 0, 0, 'This is only a test.', image.bitmap.width) - .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + expect( + image.print(font, 0, 0, "This is only a test.", image.bitmap.width) + .bitmap.data + ).toEqual(expectedImg.bitmap.data); }); })(fontName, fontDefs[fontName]); - it('Jimp preset SANS_16_BLACK bitmap font positioned', async () => { + it("Jimp preset SANS_16_BLACK bitmap font positioned", async () => { const font = await jimp.loadFont(Jimp.FONT_SANS_16_BLACK); const expected = - getTestDir(__dirname) + '/images/SANS_16_BLACK-positioned.png'; + getTestDir(__dirname) + "/images/SANS_16_BLACK-positioned.png"; const expectedImg = await Jimp.read(expected); - const image = await Jimp.create('300', '100', 0xff8800ff); + const image = await Jimp.create("300", "100", 0xff8800ff); - image - .print(font, 150, 50, 'This is only a test.', 100) - .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + expect( + image.print(font, 150, 50, "This is only a test.", 100).bitmap.data + ).toEqual(expectedImg.bitmap.data); }); - it('Jimp loads font from URL', async () => { + it("Jimp loads font from URL", async () => { const font = await Jimp.loadFont( - 'https://raw.githubusercontent.com/oliver-moran/jimp/master/packages/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt' + "https://raw.githubusercontent.com/jimp-dev/jimp/main/packages/plugin-print/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt" ); const expected = - getTestDir(__dirname) + '/images/SANS_16_BLACK-positioned.png'; + getTestDir(__dirname) + "/images/SANS_16_BLACK-positioned.png"; const expectedImg = await Jimp.read(expected); - const image = await Jimp.create('300', '100', 0xff8800ff); + const image = await Jimp.create("300", "100", 0xff8800ff); - image - .print(font, 150, 50, 'This is only a test.', 100) - .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + expect( + image.print(font, 150, 50, "This is only a test.", 100).bitmap.data + ).toEqual(expectedImg.bitmap.data); }); - it('Jimp renders ? for unknown characters', async () => { + it("Jimp renders ? for unknown characters", async () => { const font = await jimp.loadFont(Jimp.FONT_SANS_16_BLACK); - const expected = getTestDir(__dirname) + '/images/unknown-char-test.png'; + const expected = getTestDir(__dirname) + "/images/unknown-char-test.png"; const expectedImg = await Jimp.read(expected); - const image = await Jimp.read('300', '100', 0xff8800ff); + const image = await Jimp.read("300", "100", 0xff8800ff); - image - .print(font, 0, 0, 'ツ ツ ツ', 100) - .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + expect(image.print(font, 0, 0, "ツ ツ ツ", 100).bitmap.data).toEqual( + expectedImg.bitmap.data + ); }); - it('Jimp can print numbers too', async () => { + it("Jimp can print numbers too", async () => { const font = await Jimp.loadFont(Jimp.FONT_SANS_16_BLACK); - const expected = getTestDir(__dirname) + '/images/print-number.png'; + const expected = getTestDir(__dirname) + "/images/print-number.png"; const expectedImg = await Jimp.read(expected); - const image = await Jimp.read('300', '100', 0xff8800ff); + const image = await Jimp.read("300", "100", 0xff8800ff); - image - .print(font, 0, 0, 12345678, 100) - .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + expect(image.print(font, 0, 0, 12345678, 100).bitmap.data).toEqual( + expectedImg.bitmap.data + ); }); - it('left-align text by default', async () => { + it("left-align text by default", async () => { const expectedImage = await Jimp.read( - getTestDir(__dirname) + '/images/left-aligned.png' + getTestDir(__dirname) + "/images/left-aligned.png" ); const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { - text: 'This is only a test.', + text: "This is only a test.", - maxWidth: 100 + maxWidth: 100, }); - expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); + expect(textImage.bitmap.data).toEqual(expectedImage.bitmap.data); }); - it('left-align text by default when passing object', async () => { + it("left-align text by default when passing object", async () => { const expectedImage = await Jimp.read( - getTestDir(__dirname) + '/images/left-aligned.png' + getTestDir(__dirname) + "/images/left-aligned.png" ); const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { - text: { text: 'This is only a test.' }, + text: { text: "This is only a test." }, - maxWidth: 100 + maxWidth: 100, }); - expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); + expect(textImage.bitmap.data).toEqual(expectedImage.bitmap.data); }); - it('left-align text when passing object with alignmentX', async () => { + it("left-align text when passing object with alignmentX", async () => { const expectedImage = await Jimp.read( - getTestDir(__dirname) + '/images/left-aligned.png' + getTestDir(__dirname) + "/images/left-aligned.png" ); const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { text: { - text: 'This is only a test.', + text: "This is only a test.", - alignmentX: Jimp.HORIZONTAL_ALIGN_LEFT + alignmentX: Jimp.HORIZONTAL_ALIGN_LEFT, }, - maxWidth: 100 + maxWidth: 100, }); - expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); + expect(textImage.bitmap.data).toEqual(expectedImage.bitmap.data); }); - it('center-align text when passing object with alignmentX', async () => { + it("center-align text when passing object with alignmentX", async () => { const expectedImage = await Jimp.read( - getTestDir(__dirname) + '/images/center-aligned.png' + getTestDir(__dirname) + "/images/center-aligned.png" ); const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { text: { - text: 'This is only a test.', + text: "This is only a test.", - alignmentX: Jimp.HORIZONTAL_ALIGN_CENTER + alignmentX: Jimp.HORIZONTAL_ALIGN_CENTER, }, - maxWidth: 100 + maxWidth: 100, }); - expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); + expect(textImage.bitmap.data).toEqual(expectedImage.bitmap.data); }); - it('right-align text when passing object with alignmentX', async () => { + it("right-align text when passing object with alignmentX", async () => { const expectedImage = await Jimp.read( - getTestDir(__dirname) + '/images/right-aligned.png' + getTestDir(__dirname) + "/images/right-aligned.png" ); const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { text: { - text: 'This is only a test.', + text: "This is only a test.", - alignmentX: Jimp.HORIZONTAL_ALIGN_RIGHT + alignmentX: Jimp.HORIZONTAL_ALIGN_RIGHT, }, - maxWidth: 100 + maxWidth: 100, }); - expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); + expect(textImage.bitmap.data).toEqual(expectedImage.bitmap.data); }); - it('middle-align text when passing object with alignmentY', async () => { + it("middle-align text when passing object with alignmentY", async () => { const expectedImage = await Jimp.read( - getTestDir(__dirname) + '/images/middle-aligned.png' + getTestDir(__dirname) + "/images/middle-aligned.png" ); const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { text: { - text: 'This is only a test.', + text: "This is only a test.", - alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE + alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE, }, maxWidth: 100, - maxHeight: 240 + maxHeight: 240, }); - expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); + expect(textImage.bitmap.data).toEqual(expectedImage.bitmap.data); }); - it('middle-align text when passing object with alignmentY can offset y', async () => { + it("middle-align text when passing object with alignmentY can offset y", async () => { const expectedImage = await Jimp.read( - getTestDir(__dirname) + '/images/middle-aligned-y.png' + getTestDir(__dirname) + "/images/middle-aligned-y.png" ); const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { y: 50, text: { - text: 'This is only a test.', + text: "This is only a test.", - alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE + alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE, }, maxWidth: 100, - maxHeight: 240 + maxHeight: 240, }); - expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); + expect(textImage.bitmap.data).toEqual(expectedImage.bitmap.data); }); - it('bottom-align text when passing object with alignmentY', async () => { + it("bottom-align text when passing object with alignmentY", async () => { const expectedImage = await Jimp.read( - getTestDir(__dirname) + '/images/bottom-aligned.png' + getTestDir(__dirname) + "/images/bottom-aligned.png" ); const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { text: { - text: 'This is only a test.', + text: "This is only a test.", - alignmentY: Jimp.VERTICAL_ALIGN_BOTTOM + alignmentY: Jimp.VERTICAL_ALIGN_BOTTOM, }, maxWidth: 100, - maxHeight: 240 + maxHeight: 240, }); - expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); + expect(textImage.bitmap.data).toEqual(expectedImage.bitmap.data); }); - it('bottom-align text when passing object with alignmentY offset y', async () => { + it("bottom-align text when passing object with alignmentY offset y", async () => { const expectedImage = await Jimp.read( - getTestDir(__dirname) + '/images/bottom-aligned-y.png' + getTestDir(__dirname) + "/images/bottom-aligned-y.png" ); const textImage = await createTextImage(320, 240, Jimp.FONT_SANS_16_BLACK, { y: 100, text: { - text: 'This is only a test.', + text: "This is only a test.", - alignmentY: Jimp.VERTICAL_ALIGN_BOTTOM + alignmentY: Jimp.VERTICAL_ALIGN_BOTTOM, }, maxWidth: 100, - maxHeight: 100 + maxHeight: 100, }); - expectedImage.bitmap.data.should.be.deepEqual(textImage.bitmap.data); + expect(textImage.bitmap.data).toEqual(expectedImage.bitmap.data); }); - it('exposes print y position in cb', async () => { + it("exposes print y position in cb", async () => { const expectedImage = await Jimp.read( - getTestDir(__dirname) + '/images/spacing.png' + getTestDir(__dirname) + "/images/spacing.png" ); const loadedFont = await jimp.loadFont(Jimp.FONT_SANS_16_BLACK); @@ -266,19 +268,44 @@ describe('Write text over image', function() { loadedFont, 0, 0, - 'One two three four fix six seven eight nine ten eleven twelve', + "One two three four fix six seven eight nine ten eleven twelve", 250, (err, image, { x, y }) => { image.print( loadedFont, x, y + 50, - 'thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty', + "thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty", 250 ); } ); - expectedImage.bitmap.data.should.be.deepEqual(image.bitmap.data); + expect(image.bitmap.data).toEqual(expectedImage.bitmap.data); + }); + + it("measureText is consistent with measureTextWidth", async () => { + const font = await jimp.loadFont(Jimp.FONT_SANS_16_BLACK); + + const text = "n n n"; + const width = jimp.measureText(font, text); + const height = jimp.measureTextHeight(font, text, width); + const lineHeight = jimp.measureTextHeight(font, text, Infinity); + + expect(height).toEqual(lineHeight); + }); + + it("text with newlines, default alignment", async () => { + const expectedImage = await Jimp.read( + getTestDir(__dirname) + "/images/with-newlines.png" + ); + + const textImage = await createTextImage(100, 240, Jimp.FONT_SANS_16_BLACK, { + text: "This \nis only \na \ntest.", + + maxWidth: 300, + }); + + expect(textImage.bitmap.data).toEqual(expectedImage.bitmap.data); }); }); diff --git a/project starter code/node_modules/@jimp/plugin-resize/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-resize/CHANGELOG.md index 26394e0f..d50c15d9 100644 --- a/project starter code/node_modules/@jimp/plugin-resize/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/plugin-resize/CHANGELOG.md @@ -1,3 +1,94 @@ +# v0.22.5 (Tue Feb 21 2023) + +:tada: This release contains work from a new contributor! :tada: + +Thank you, Charly Poirier ([@charlypoirier](https://github.com/charlypoirier)), for all your work! + +#### 🐛 Bug Fix + +- Fix resizing issue with Jimp.AUTO [#1202](https://github.com/jimp-dev/jimp/pull/1202) ([@charlypoirier](https://github.com/charlypoirier)) + +#### Authors: 1 + +- Charly Poirier ([@charlypoirier](https://github.com/charlypoirier)) + +--- + +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.22.0 (Mon Feb 06 2023) + +#### 🏠 Internal + +- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- delete CLI package [#1162](https://github.com/jimp-dev/jimp/pull/1162) ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Daniel Holmes ([@danielholmes](https://github.com/danielholmes)) + +--- + +# v0.21.2 (Sun Feb 05 2023) + +#### 🐛 Bug Fix + +- Change some exports to move towards more ESM compatibility [#1154](https://github.com/jimp-dev/jimp/pull/1154) ([@danielholmes](https://github.com/danielholmes)) + +#### Authors: 1 + +- Daniel Holmes ([@danielholmes](https://github.com/danielholmes)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -12,7 +103,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -20,4 +111,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-resize/README.md b/project starter code/node_modules/@jimp/plugin-resize/README.md index 9185cc83..a74dbdff 100644 --- a/project starter code/node_modules/@jimp/plugin-resize/README.md +++ b/project starter code/node_modules/@jimp/plugin-resize/README.md @@ -15,17 +15,17 @@ Resizes the image to a set width and height using a 2-pass bilinear algorithm/ - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - // Read the image. - const image = await jimp.read('test/image.png'); + // Read the image. + const image = await jimp.read("test/image.png"); - // Resize the image to width 150 and auto height. - await image.resize(150, jimp.AUTO); + // Resize the image to width 150 and auto height. + await image.resize(150, jimp.AUTO); - // Save and overwrite the image - await image.writeAsync('test/image.png'); + // Save and overwrite the image + await image.writeAsync("test/image.png"); } main(); diff --git a/project starter code/node_modules/@jimp/plugin-resize/dist/index.js b/project starter code/node_modules/@jimp/plugin-resize/dist/index.js index 8d645992..cfbd3bde 100644 --- a/project starter code/node_modules/@jimp/plugin-resize/dist/index.js +++ b/project starter code/node_modules/@jimp/plugin-resize/dist/index.js @@ -1,96 +1,79 @@ "use strict"; -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - +exports.default = void 0; var _utils = require("@jimp/utils"); - var _resize = _interopRequireDefault(require("./modules/resize")); - var _resize2 = _interopRequireDefault(require("./modules/resize2")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _default = () => ({ + constants: { + RESIZE_NEAREST_NEIGHBOR: "nearestNeighbor", + RESIZE_BILINEAR: "bilinearInterpolation", + RESIZE_BICUBIC: "bicubicInterpolation", + RESIZE_HERMITE: "hermiteInterpolation", + RESIZE_BEZIER: "bezierInterpolation" + }, + class: { + /** + * Resizes the image to a set width and height using a 2-pass bilinear algorithm + * @param {number} w the width to resize the image to (or Jimp.AUTO) + * @param {number} h the height to resize the image to (or Jimp.AUTO) + * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + resize(w, h, mode, cb) { + if (typeof w !== "number" || typeof h !== "number") { + return _utils.throwError.call(this, "w and h must be numbers", cb); + } + if (typeof mode === "function" && typeof cb === "undefined") { + cb = mode; + mode = null; + } + if (w === this.constructor.AUTO && h === this.constructor.AUTO) { + return _utils.throwError.call(this, "w and h cannot both be set to auto", cb); + } + if (w === this.constructor.AUTO) { + w = this.bitmap.width * (h / this.bitmap.height); + } + if (h === this.constructor.AUTO) { + h = this.bitmap.height * (w / this.bitmap.width); + } + if (w < 0 || h < 0) { + return _utils.throwError.call(this, "w and h must be positive numbers", cb); + } -var _default = function _default() { - return { - constants: { - RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor', - RESIZE_BILINEAR: 'bilinearInterpolation', - RESIZE_BICUBIC: 'bicubicInterpolation', - RESIZE_HERMITE: 'hermiteInterpolation', - RESIZE_BEZIER: 'bezierInterpolation' - }, - "class": { - /** - * Resizes the image to a set width and height using a 2-pass bilinear algorithm - * @param {number} w the width to resize the image to (or Jimp.AUTO) - * @param {number} h the height to resize the image to (or Jimp.AUTO) - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - resize: function resize(w, h, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - if (w === this.constructor.AUTO && h === this.constructor.AUTO) { - return _utils.throwError.call(this, 'w and h cannot both be set to auto', cb); - } - - if (w === this.constructor.AUTO) { - w = this.bitmap.width * (h / this.bitmap.height); - } - - if (h === this.constructor.AUTO) { - h = this.bitmap.height * (w / this.bitmap.width); - } - - if (w < 0 || h < 0) { - return _utils.throwError.call(this, 'w and h must be positive numbers', cb); - } // round inputs - - - w = Math.round(w); - h = Math.round(h); - - if (typeof _resize2["default"][mode] === 'function') { - var dst = { - data: Buffer.alloc(w * h * 4), - width: w, - height: h - }; - - _resize2["default"][mode](this.bitmap, dst); - - this.bitmap = dst; - } else { - var image = this; - var resize = new _resize["default"](this.bitmap.width, this.bitmap.height, w, h, true, true, function (buffer) { - image.bitmap.data = Buffer.from(buffer); - image.bitmap.width = w; - image.bitmap.height = h; - }); - resize.resize(this.bitmap.data); - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; + // round inputs + w = Math.round(w) || 1; + h = Math.round(h) || 1; + if (typeof _resize2.default[mode] === "function") { + const dst = { + data: Buffer.alloc(w * h * 4), + width: w, + height: h + }; + _resize2.default[mode](this.bitmap, dst); + this.bitmap = dst; + } else { + const image = this; + const resize = new _resize.default(this.bitmap.width, this.bitmap.height, w, h, true, true, buffer => { + image.bitmap.data = Buffer.from(buffer); + image.bitmap.width = w; + image.bitmap.height = h; + }); + resize.resize(this.bitmap.data); } + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; } - }; -}; - -exports["default"] = _default; + } +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-resize/dist/index.js.map index 36caf764..a2a30459 100644 --- a/project starter code/node_modules/@jimp/plugin-resize/dist/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-resize/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["constants","RESIZE_NEAREST_NEIGHBOR","RESIZE_BILINEAR","RESIZE_BICUBIC","RESIZE_HERMITE","RESIZE_BEZIER","resize","w","h","mode","cb","throwError","call","constructor","AUTO","bitmap","width","height","Math","round","Resize2","dst","data","Buffer","alloc","image","Resize","buffer","from"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;eAEe;AAAA,SAAO;AACpBA,IAAAA,SAAS,EAAE;AACTC,MAAAA,uBAAuB,EAAE,iBADhB;AAETC,MAAAA,eAAe,EAAE,uBAFR;AAGTC,MAAAA,cAAc,EAAE,sBAHP;AAITC,MAAAA,cAAc,EAAE,sBAJP;AAKTC,MAAAA,aAAa,EAAE;AALN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AAI,CAACC,KAAL,CAAWX,CAAX,CAAJ;;AAEA,YAAI,OAAOY,oBAAQX,IAAR,CAAP,KAAyB,UAA7B,EAAyC;AACvC,cAAMY,GAAG,GAAG;AACVC,YAAAA,IAAI,EAAEC,MAAM,CAACC,KAAP,CAAajB,CAAC,GAAGC,CAAJ,GAAQ,CAArB,CADI;AAEVQ,YAAAA,KAAK,EAAET,CAFG;AAGVU,YAAAA,MAAM,EAAET;AAHE,WAAZ;;AAKAY,8BAAQX,IAAR,EAAc,KAAKM,MAAnB,EAA2BM,GAA3B;;AACA,eAAKN,MAAL,GAAcM,GAAd;AACD,SARD,MAQO;AACL,cAAMI,KAAK,GAAG,IAAd;AACA,cAAMnB,MAAM,GAAG,IAAIoB,kBAAJ,CACb,KAAKX,MAAL,CAAYC,KADC,EAEb,KAAKD,MAAL,CAAYE,MAFC,EAGbV,CAHa,EAIbC,CAJa,EAKb,IALa,EAMb,IANa,EAOb,UAAAmB,MAAM,EAAI;AACRF,YAAAA,KAAK,CAACV,MAAN,CAAaO,IAAb,GAAoBC,MAAM,CAACK,IAAP,CAAYD,MAAZ,CAApB;AACAF,YAAAA,KAAK,CAACV,MAAN,CAAaC,KAAb,GAAqBT,CAArB;AACAkB,YAAAA,KAAK,CAACV,MAAN,CAAaE,MAAb,GAAsBT,CAAtB;AACD,WAXY,CAAf;AAaAF,UAAAA,MAAM,CAACA,MAAP,CAAc,KAAKS,MAAL,CAAYO,IAA1B;AACD;;AAED,YAAI,0BAAcZ,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAtEI;AATa,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from '@jimp/utils';\n\nimport Resize from './modules/resize';\nimport Resize2 from './modules/resize2';\n\nexport default () => ({\n constants: {\n RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor',\n RESIZE_BILINEAR: 'bilinearInterpolation',\n RESIZE_BICUBIC: 'bicubicInterpolation',\n RESIZE_HERMITE: 'hermiteInterpolation',\n RESIZE_BEZIER: 'bezierInterpolation'\n },\n\n class: {\n /**\n * Resizes the image to a set width and height using a 2-pass bilinear algorithm\n * @param {number} w the width to resize the image to (or Jimp.AUTO)\n * @param {number} h the height to resize the image to (or Jimp.AUTO)\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n resize(w, h, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n if (w === this.constructor.AUTO && h === this.constructor.AUTO) {\n return throwError.call(this, 'w and h cannot both be set to auto', cb);\n }\n\n if (w === this.constructor.AUTO) {\n w = this.bitmap.width * (h / this.bitmap.height);\n }\n\n if (h === this.constructor.AUTO) {\n h = this.bitmap.height * (w / this.bitmap.width);\n }\n\n if (w < 0 || h < 0) {\n return throwError.call(this, 'w and h must be positive numbers', cb);\n }\n\n // round inputs\n w = Math.round(w);\n h = Math.round(h);\n\n if (typeof Resize2[mode] === 'function') {\n const dst = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h\n };\n Resize2[mode](this.bitmap, dst);\n this.bitmap = dst;\n } else {\n const image = this;\n const resize = new Resize(\n this.bitmap.width,\n this.bitmap.height,\n w,\n h,\n true,\n true,\n buffer => {\n image.bitmap.data = Buffer.from(buffer);\n image.bitmap.width = w;\n image.bitmap.height = h;\n }\n );\n resize.resize(this.bitmap.data);\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["constants","RESIZE_NEAREST_NEIGHBOR","RESIZE_BILINEAR","RESIZE_BICUBIC","RESIZE_HERMITE","RESIZE_BEZIER","class","resize","w","h","mode","cb","throwError","call","constructor","AUTO","bitmap","width","height","Math","round","Resize2","dst","data","Buffer","alloc","image","Resize","buffer","from","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import { throwError, isNodePattern } from \"@jimp/utils\";\n\nimport Resize from \"./modules/resize\";\nimport Resize2 from \"./modules/resize2\";\n\nexport default () => ({\n constants: {\n RESIZE_NEAREST_NEIGHBOR: \"nearestNeighbor\",\n RESIZE_BILINEAR: \"bilinearInterpolation\",\n RESIZE_BICUBIC: \"bicubicInterpolation\",\n RESIZE_HERMITE: \"hermiteInterpolation\",\n RESIZE_BEZIER: \"bezierInterpolation\",\n },\n\n class: {\n /**\n * Resizes the image to a set width and height using a 2-pass bilinear algorithm\n * @param {number} w the width to resize the image to (or Jimp.AUTO)\n * @param {number} h the height to resize the image to (or Jimp.AUTO)\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n resize(w, h, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n if (w === this.constructor.AUTO && h === this.constructor.AUTO) {\n return throwError.call(this, \"w and h cannot both be set to auto\", cb);\n }\n\n if (w === this.constructor.AUTO) {\n w = this.bitmap.width * (h / this.bitmap.height);\n }\n\n if (h === this.constructor.AUTO) {\n h = this.bitmap.height * (w / this.bitmap.width);\n }\n\n if (w < 0 || h < 0) {\n return throwError.call(this, \"w and h must be positive numbers\", cb);\n }\n\n // round inputs\n w = Math.round(w) || 1;\n h = Math.round(h) || 1;\n\n if (typeof Resize2[mode] === \"function\") {\n const dst = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h,\n };\n Resize2[mode](this.bitmap, dst);\n this.bitmap = dst;\n } else {\n const image = this;\n const resize = new Resize(\n this.bitmap.width,\n this.bitmap.height,\n w,\n h,\n true,\n true,\n (buffer) => {\n image.bitmap.data = Buffer.from(buffer);\n image.bitmap.width = w;\n image.bitmap.height = h;\n }\n );\n resize.resize(this.bitmap.data);\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AAAwC;AAAA,eAEzB,OAAO;EACpBA,SAAS,EAAE;IACTC,uBAAuB,EAAE,iBAAiB;IAC1CC,eAAe,EAAE,uBAAuB;IACxCC,cAAc,EAAE,sBAAsB;IACtCC,cAAc,EAAE,sBAAsB;IACtCC,aAAa,EAAE;EACjB,CAAC;EAEDC,KAAK,EAAE;IACL;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;IACIC,MAAM,CAACC,CAAC,EAAEC,CAAC,EAAEC,IAAI,EAAEC,EAAE,EAAE;MACrB,IAAI,OAAOH,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAAE;QAClD,OAAOG,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAEF,EAAE,CAAC;MAC7D;MAEA,IAAI,OAAOD,IAAI,KAAK,UAAU,IAAI,OAAOC,EAAE,KAAK,WAAW,EAAE;QAC3DA,EAAE,GAAGD,IAAI;QACTA,IAAI,GAAG,IAAI;MACb;MAEA,IAAIF,CAAC,KAAK,IAAI,CAACM,WAAW,CAACC,IAAI,IAAIN,CAAC,KAAK,IAAI,CAACK,WAAW,CAACC,IAAI,EAAE;QAC9D,OAAOH,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,oCAAoC,EAAEF,EAAE,CAAC;MACxE;MAEA,IAAIH,CAAC,KAAK,IAAI,CAACM,WAAW,CAACC,IAAI,EAAE;QAC/BP,CAAC,GAAG,IAAI,CAACQ,MAAM,CAACC,KAAK,IAAIR,CAAC,GAAG,IAAI,CAACO,MAAM,CAACE,MAA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ACzB,CAAC,CACF;QACDF,MAAM,CAACA,MAAM,CAAC,IAAI,CAACS,MAAM,CAACO,IAAI,CAAC;MACjC;MAEA,IAAI,IAAAO,oBAAa,EAACnB,EAAE,CAAC,EAAE;QACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;MAC3B;MAEA,OAAO,IAAI;IACb;EACF;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize.js b/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize.js index 8dbb005b..a0e0c47a 100644 --- a/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize.js +++ b/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize.js @@ -1,7 +1,12 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; // JavaScript Image Resizer (c) 2012 - Grant Galitz // Released to public domain 29 July 2013: https://github.com/grantgalitz/JS-Image-Resizer/issues/4 + function Resize(widthOriginal, heightOriginal, targetWidth, targetHeight, blendAlpha, interpolationPass, resizeCallback) { this.widthOriginal = Math.abs(Math.floor(widthOriginal) || 0); this.heightOriginal = Math.abs(Math.floor(heightOriginal) || 0); @@ -9,7 +14,7 @@ function Resize(widthOriginal, heightOriginal, targetWidth, targetHeight, blendA this.targetHeight = Math.abs(Math.floor(targetHeight) || 0); this.colorChannels = blendAlpha ? 4 : 3; this.interpolationPass = Boolean(interpolationPass); - this.resizeCallback = typeof resizeCallback === 'function' ? resizeCallback : function () {}; + this.resizeCallback = typeof resizeCallback === "function" ? resizeCallback : function () {}; this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels; this.originalWidthMultipliedByChannels = this.widthOriginal * this.colorChannels; this.originalHeightMultipliedByChannels = this.heightOriginal * this.colorChannels; @@ -17,16 +22,14 @@ function Resize(widthOriginal, heightOriginal, targetWidth, targetHeight, blendA this.finalResultSize = this.targetWidthMultipliedByChannels * this.targetHeight; this.initialize(); } - Resize.prototype.initialize = function () { // Perform some checks: if (this.widthOriginal > 0 && this.heightOriginal > 0 && this.targetWidth > 0 && this.targetHeight > 0) { this.configurePasses(); } else { - throw new Error('Invalid settings specified for the resizer.'); + throw new Error("Invalid settings specified for the resizer."); } }; - Resize.prototype.configurePasses = function () { if (this.widthOriginal === this.targetWidth) { // Bypass the width resizer pass: @@ -34,7 +37,6 @@ Resize.prototype.configurePasses = function () { } else { // Setup the width resizer pass: this.ratioWeightWidthPass = this.widthOriginal / this.targetWidth; - if (this.ratioWeightWidthPass < 1 && this.interpolationPass) { this.initializeFirstPassBuffers(true); this.resizeWidth = this.colorChannels === 4 ? this.resizeWidthInterpolatedRGBA : this.resizeWidthInterpolatedRGB; @@ -43,14 +45,12 @@ Resize.prototype.configurePasses = function () { this.resizeWidth = this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB; } } - if (this.heightOriginal === this.targetHeight) { // Bypass the height resizer pass: this.resizeHeight = this.bypassResizer; } else { // Setup the height resizer pass: this.ratioWeightHeightPass = this.heightOriginal / this.targetHeight; - if (this.ratioWeightHeightPass < 1 && this.interpolationPass) { this.initializeSecondPassBuffers(true); this.resizeHeight = this.resizeHeightInterpolated; @@ -60,18 +60,18 @@ Resize.prototype.configurePasses = function () { } } }; - Resize.prototype._resizeWidthInterpolatedRGBChannels = function (buffer, fourthChannel) { - var channelsNum = fourthChannel ? 4 : 3; - var ratioWeight = this.ratioWeightWidthPass; - var outputBuffer = this.widthBuffer; - var weight = 0; - var finalOffset = 0; - var pixelOffset = 0; - var firstWeight = 0; - var secondWeight = 0; - var targetPosition; // Handle for only one interpolation input being valid for start calculation: - + const channelsNum = fourthChannel ? 4 : 3; + const ratioWeight = this.ratioWeightWidthPass; + const outputBuffer = this.widthBuffer; + let weight = 0; + let finalOffset = 0; + let pixelOffset = 0; + let firstWeight = 0; + let secondWeight = 0; + let targetPosition; + + // Handle for only one interpolation input being valid for start calculation: for (targetPosition = 0; weight < 1 / 3; targetPosition += channelsNum, weight += ratioWeight) { for (finalOffset = targetPosition, pixelOffset = 0; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) { outputBuffer[finalOffset] = buffer[pixelOffset]; @@ -79,26 +79,25 @@ Resize.prototype._resizeWidthInterpolatedRGBChannels = function (buffer, fourthC outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2]; if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3]; } - } // Adjust for overshoot of the last pass's counter: - + } + // Adjust for overshoot of the last pass's counter: weight -= 1 / 3; - var interpolationWidthSourceReadStop; - + let interpolationWidthSourceReadStop; for (interpolationWidthSourceReadStop = this.widthOriginal - 1; weight < interpolationWidthSourceReadStop; targetPosition += channelsNum, weight += ratioWeight) { // Calculate weightings: secondWeight = weight % 1; - firstWeight = 1 - secondWeight; // Interpolate: - + firstWeight = 1 - secondWeight; + // Interpolate: for (finalOffset = targetPosition, pixelOffset = Math.floor(weight) * channelsNum; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) { outputBuffer[finalOffset + 0] = buffer[pixelOffset + 0] * firstWeight + buffer[pixelOffset + channelsNum + 0] * secondWeight; outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1] * firstWeight + buffer[pixelOffset + channelsNum + 1] * secondWeight; outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2] * firstWeight + buffer[pixelOffset + channelsNum + 2] * secondWeight; if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3] * firstWeight + buffer[pixelOffset + channelsNum + 3] * secondWeight; } - } // Handle for only one interpolation input being valid for end calculation: - + } + // Handle for only one interpolation input being valid for end calculation: for (interpolationWidthSourceReadStop = this.originalWidthMultipliedByChannels - channelsNum; targetPosition < this.targetWidthMultipliedByChannels; targetPosition += channelsNum) { for (finalOffset = targetPosition, pixelOffset = interpolationWidthSourceReadStop; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) { outputBuffer[finalOffset] = buffer[pixelOffset]; @@ -107,66 +106,57 @@ Resize.prototype._resizeWidthInterpolatedRGBChannels = function (buffer, fourthC if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3]; } } - return outputBuffer; }; - Resize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) { - var channelsNum = fourthChannel ? 4 : 3; - var ratioWeight = this.ratioWeightWidthPass; - var ratioWeightDivisor = 1 / ratioWeight; - var nextLineOffsetOriginalWidth = this.originalWidthMultipliedByChannels - channelsNum + 1; - var nextLineOffsetTargetWidth = this.targetWidthMultipliedByChannels - channelsNum + 1; - var output = this.outputWidthWorkBench; - var outputBuffer = this.widthBuffer; - var trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount; - var weight = 0; - var amountToNext = 0; - var actualPosition = 0; - var currentPosition = 0; - var line = 0; - var pixelOffset = 0; - var outputOffset = 0; - var multiplier = 1; - var r = 0; - var g = 0; - var b = 0; - var a = 0; - + const channelsNum = fourthChannel ? 4 : 3; + const ratioWeight = this.ratioWeightWidthPass; + const ratioWeightDivisor = 1 / ratioWeight; + const nextLineOffsetOriginalWidth = this.originalWidthMultipliedByChannels - channelsNum + 1; + const nextLineOffsetTargetWidth = this.targetWidthMultipliedByChannels - channelsNum + 1; + const output = this.outputWidthWorkBench; + const outputBuffer = this.widthBuffer; + const trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount; + let weight = 0; + let amountToNext = 0; + let actualPosition = 0; + let currentPosition = 0; + let line = 0; + let pixelOffset = 0; + let outputOffset = 0; + let multiplier = 1; + let r = 0; + let g = 0; + let b = 0; + let a = 0; do { for (line = 0; line < this.originalHeightMultipliedByChannels;) { output[line++] = 0; output[line++] = 0; output[line++] = 0; - if (fourthChannel) { output[line++] = 0; trustworthyColorsCount[line / channelsNum - 1] = 0; } } - weight = ratioWeight; - do { amountToNext = 1 + actualPosition - currentPosition; multiplier = Math.min(weight, amountToNext); - for (line = 0, pixelOffset = actualPosition; line < this.originalHeightMultipliedByChannels; pixelOffset += nextLineOffsetOriginalWidth) { r = buffer[pixelOffset]; g = buffer[++pixelOffset]; b = buffer[++pixelOffset]; - a = fourthChannel ? buffer[++pixelOffset] : 255; // Ignore RGB values if pixel is completely transparent - + a = fourthChannel ? buffer[++pixelOffset] : 255; + // Ignore RGB values if pixel is completely transparent output[line++] += (a ? r : 0) * multiplier; output[line++] += (a ? g : 0) * multiplier; output[line++] += (a ? b : 0) * multiplier; - if (fourthChannel) { output[line++] += a * multiplier; trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0; } } - if (weight >= amountToNext) { actualPosition += channelsNum; currentPosition = actualPosition; @@ -176,7 +166,6 @@ Resize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) { break; } } while (weight > 0 && actualPosition < this.originalWidthMultipliedByChannels); - for (line = 0, pixelOffset = outputOffset; line < this.originalHeightMultipliedByChannels; pixelOffset += nextLineOffsetTargetWidth) { weight = fourthChannel ? trustworthyColorsCount[line / channelsNum] : 1; multiplier = fourthChannel ? weight ? 1 / weight : 0 : ratioWeightDivisor; @@ -185,67 +174,57 @@ Resize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) { outputBuffer[++pixelOffset] = output[line++] * multiplier; if (fourthChannel) outputBuffer[++pixelOffset] = output[line++] * ratioWeightDivisor; } - outputOffset += channelsNum; } while (outputOffset < this.targetWidthMultipliedByChannels); - return outputBuffer; }; - Resize.prototype._resizeHeightRGBChannels = function (buffer, fourthChannel) { - var ratioWeight = this.ratioWeightHeightPass; - var ratioWeightDivisor = 1 / ratioWeight; - var output = this.outputHeightWorkBench; - var outputBuffer = this.heightBuffer; - var trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount; - var weight = 0; - var amountToNext = 0; - var actualPosition = 0; - var currentPosition = 0; - var pixelOffset = 0; - var outputOffset = 0; - var caret = 0; - var multiplier = 1; - var r = 0; - var g = 0; - var b = 0; - var a = 0; - + const ratioWeight = this.ratioWeightHeightPass; + const ratioWeightDivisor = 1 / ratioWeight; + const output = this.outputHeightWorkBench; + const outputBuffer = this.heightBuffer; + const trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount; + let weight = 0; + let amountToNext = 0; + let actualPosition = 0; + let currentPosition = 0; + let pixelOffset = 0; + let outputOffset = 0; + let caret = 0; + let multiplier = 1; + let r = 0; + let g = 0; + let b = 0; + let a = 0; do { for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { output[pixelOffset++] = 0; output[pixelOffset++] = 0; output[pixelOffset++] = 0; - if (fourthChannel) { output[pixelOffset++] = 0; trustworthyColorsCount[pixelOffset / 4 - 1] = 0; } } - weight = ratioWeight; - do { amountToNext = 1 + actualPosition - currentPosition; multiplier = Math.min(weight, amountToNext); caret = actualPosition; - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { r = buffer[caret++]; g = buffer[caret++]; b = buffer[caret++]; - a = fourthChannel ? buffer[caret++] : 255; // Ignore RGB values if pixel is completely transparent - + a = fourthChannel ? buffer[caret++] : 255; + // Ignore RGB values if pixel is completely transparent output[pixelOffset++] += (a ? r : 0) * multiplier; output[pixelOffset++] += (a ? g : 0) * multiplier; output[pixelOffset++] += (a ? b : 0) * multiplier; - if (fourthChannel) { output[pixelOffset++] += a * multiplier; trustworthyColorsCount[pixelOffset / 4 - 1] += a ? multiplier : 0; } } - if (weight >= amountToNext) { actualPosition = caret; currentPosition = actualPosition; @@ -255,126 +234,105 @@ Resize.prototype._resizeHeightRGBChannels = function (buffer, fourthChannel) { break; } } while (weight > 0 && actualPosition < this.widthPassResultSize); - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { weight = fourthChannel ? trustworthyColorsCount[pixelOffset / 4] : 1; multiplier = fourthChannel ? weight ? 1 / weight : 0 : ratioWeightDivisor; outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier); outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier); outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier); - if (fourthChannel) { outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * ratioWeightDivisor); } } } while (outputOffset < this.finalResultSize); - return outputBuffer; }; - Resize.prototype.resizeWidthInterpolatedRGB = function (buffer) { return this._resizeWidthInterpolatedRGBChannels(buffer, false); }; - Resize.prototype.resizeWidthInterpolatedRGBA = function (buffer) { return this._resizeWidthInterpolatedRGBChannels(buffer, true); }; - Resize.prototype.resizeWidthRGB = function (buffer) { return this._resizeWidthRGBChannels(buffer, false); }; - Resize.prototype.resizeWidthRGBA = function (buffer) { return this._resizeWidthRGBChannels(buffer, true); }; - Resize.prototype.resizeHeightInterpolated = function (buffer) { - var ratioWeight = this.ratioWeightHeightPass; - var outputBuffer = this.heightBuffer; - var weight = 0; - var finalOffset = 0; - var pixelOffset = 0; - var pixelOffsetAccumulated = 0; - var pixelOffsetAccumulated2 = 0; - var firstWeight = 0; - var secondWeight = 0; - var interpolationHeightSourceReadStop; // Handle for only one interpolation input being valid for start calculation: - + const ratioWeight = this.ratioWeightHeightPass; + const outputBuffer = this.heightBuffer; + let weight = 0; + let finalOffset = 0; + let pixelOffset = 0; + let pixelOffsetAccumulated = 0; + let pixelOffsetAccumulated2 = 0; + let firstWeight = 0; + let secondWeight = 0; + let interpolationHeightSourceReadStop; + + // Handle for only one interpolation input being valid for start calculation: for (; weight < 1 / 3; weight += ratioWeight) { for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { outputBuffer[finalOffset++] = Math.round(buffer[pixelOffset++]); } - } // Adjust for overshoot of the last pass's counter: - + } + // Adjust for overshoot of the last pass's counter: weight -= 1 / 3; - for (interpolationHeightSourceReadStop = this.heightOriginal - 1; weight < interpolationHeightSourceReadStop; weight += ratioWeight) { // Calculate weightings: secondWeight = weight % 1; - firstWeight = 1 - secondWeight; // Interpolate: - + firstWeight = 1 - secondWeight; + // Interpolate: pixelOffsetAccumulated = Math.floor(weight) * this.targetWidthMultipliedByChannels; pixelOffsetAccumulated2 = pixelOffsetAccumulated + this.targetWidthMultipliedByChannels; - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels; ++pixelOffset) { outputBuffer[finalOffset++] = Math.round(buffer[pixelOffsetAccumulated++] * firstWeight + buffer[pixelOffsetAccumulated2++] * secondWeight); } - } // Handle for only one interpolation input being valid for end calculation: - + } + // Handle for only one interpolation input being valid for end calculation: while (finalOffset < this.finalResultSize) { for (pixelOffset = 0, pixelOffsetAccumulated = interpolationHeightSourceReadStop * this.targetWidthMultipliedByChannels; pixelOffset < this.targetWidthMultipliedByChannels; ++pixelOffset) { outputBuffer[finalOffset++] = Math.round(buffer[pixelOffsetAccumulated++]); } } - return outputBuffer; }; - Resize.prototype.resizeHeightRGB = function (buffer) { return this._resizeHeightRGBChannels(buffer, false); }; - Resize.prototype.resizeHeightRGBA = function (buffer) { return this._resizeHeightRGBChannels(buffer, true); }; - Resize.prototype.resize = function (buffer) { this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer))); }; - Resize.prototype.bypassResizer = function (buffer) { // Just return the buffer passed: return buffer; }; - Resize.prototype.initializeFirstPassBuffers = function (BILINEARAlgo) { // Initialize the internal width pass buffers: this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize); - if (!BILINEARAlgo) { this.outputWidthWorkBench = this.generateFloatBuffer(this.originalHeightMultipliedByChannels); - if (this.colorChannels > 3) { this.outputWidthWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(this.heightOriginal); } } }; - Resize.prototype.initializeSecondPassBuffers = function (BILINEARAlgo) { // Initialize the internal height pass buffers: this.heightBuffer = this.generateUint8Buffer(this.finalResultSize); - if (!BILINEARAlgo) { this.outputHeightWorkBench = this.generateFloatBuffer(this.targetWidthMultipliedByChannels); - if (this.colorChannels > 3) { this.outputHeightWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(this.targetWidth); } } }; - Resize.prototype.generateFloatBuffer = function (bufferLength) { // Generate a float32 typed array buffer: try { @@ -383,7 +341,6 @@ Resize.prototype.generateFloatBuffer = function (bufferLength) { return []; } }; - Resize.prototype.generateFloat64Buffer = function (bufferLength) { // Generate a float64 typed array buffer: try { @@ -392,7 +349,6 @@ Resize.prototype.generateFloat64Buffer = function (bufferLength) { return []; } }; - Resize.prototype.generateUint8Buffer = function (bufferLength) { // Generate a uint8 typed array buffer: try { @@ -401,6 +357,8 @@ Resize.prototype.generateUint8Buffer = function (bufferLength) { return []; } }; - -module.exports = Resize; +var _default = Resize; +exports.default = _default; +module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=resize.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize.js.map b/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize.js.map index 39e5ae34..1e35b5d3 100644 --- a/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize.js.map +++ b/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../src/modules/resize.js"],"names":["Resize","widthOriginal","heightOriginal","targetWidth","targetHeight","blendAlpha","interpolationPass","resizeCallback","Math","abs","floor","colorChannels","Boolean","targetWidthMultipliedByChannels","originalWidthMultipliedByChannels","originalHeightMultipliedByChannels","widthPassResultSize","finalResultSize","initialize","prototype","configurePasses","Error","resizeWidth","bypassResizer","ratioWeightWidthPass","initializeFirstPassBuffers","resizeWidthInterpolatedRGBA","resizeWidthInterpolatedRGB","resizeWidthRGBA","resizeWidthRGB","resizeHeight","ratioWeightHeightPass","initializeSecondPassBuffers","resizeHeightInterpolated","resizeHeightRGBA","resizeHeightRGB","_resizeWidthInterpolatedRGBChannels","buffer","fourthChannel","channelsNum","ratioWeight","outputBuffer","widthBuffer","weight","finalOffset","pixelOffset","firstWeight","secondWeight","targetPosition","interpolationWidthSourceReadStop","_resizeWidthRGBChannels","ratioWeightDivisor","nextLineOffsetOriginalWidth","nextLineOffsetTargetWidth","output","outputWidthWorkBench","trustworthyColorsCount","outputWidthWorkBenchOpaquePixelsCount","amountToNext","actualPosition","currentPosition","line","outputOffset","multiplier","r","g","b","a","min","_resizeHeightRGBChannels","outputHeightWorkBench","heightBuffer","outputHeightWorkBenchOpaquePixelsCount","caret","round","pixelOffsetAccumulated","pixelOffsetAccumulated2","interpolationHeightSourceReadStop","resize","BILINEARAlgo","generateFloatBuffer","generateFloat64Buffer","generateUint8Buffer","bufferLength","Float32Array","error","Float64Array","Uint8Array","module","exports"],"mappings":";;AAAA;AACA;AAEA,SAASA,MAAT,CACEC,aADF,EAEEC,cAFF,EAGEC,WAHF,EAIEC,YAJF,EAKEC,UALF,EAMEC,iBANF,EAOEC,cAPF,EAQE;AACA,OAAKN,aAAL,GAAqBO,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWT,aAAX,KAA6B,CAAtC,CAArB;AACA,OAAKC,cAAL,GAAsBM,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWR,cAAX,KAA8B,CAAvC,CAAtB;AACA,OAAKC,WAAL,GAAmBK,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWP,WAAX,KAA2B,CAApC,CAAnB;AACA,OAAKC,YAAL,GAAoBI,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWN,YAAX,KAA4B,CAArC,CAApB;AACA,OAAKO,aAAL,GAAqBN,UAAU,GAAG,CAAH,GAAO,CAAtC;AACA,OAAKC,iBAAL,GAAyBM,OAAO,CAACN,iBAAD,CAAhC;AACA,OAAKC,cAAL,GACE,OAAOA,cAAP,KAA0B,UAA1B,GAAuCA,cAAvC,GAAwD,YAAW,CAAE,CADvE;AAGA,OAAKM,+BAAL,GAAuC,KAAKV,WAAL,GAAmB,KAAKQ,aAA/D;AACA,OAAKG,iCAAL,GACE,K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AAO,EAAP;AACD;AACF,CAPD;;AASArF,MAAM,CAACmB,SAAP,CAAiB+D,mBAAjB,GAAuC,UAASC,YAAT,EAAuB;AAC5D;AACA,MAAI;AACF,WAAO,IAAII,UAAJ,CAAeJ,YAAf,CAAP;AACD,GAFD,CAEE,OAAOE,KAAP,EAAc;AACd,WAAO,EAAP;AACD;AACF,CAPD;;AASAG,MAAM,CAACC,OAAP,GAAiBzF,MAAjB","sourcesContent":["// JavaScript Image Resizer (c) 2012 - Grant Galitz\n// Released to public domain 29 July 2013: https://github.com/grantgalitz/JS-Image-Resizer/issues/4\n\nfunction Resize(\n widthOriginal,\n heightOriginal,\n targetWidth,\n targetHeight,\n blendAlpha,\n interpolationPass,\n resizeCallback\n) {\n this.widthOriginal = Math.abs(Math.floor(widthOriginal) || 0);\n this.heightOriginal = Math.abs(Math.floor(heightOriginal) || 0);\n this.targetWidth = Math.abs(Math.floor(targetWidth) || 0);\n this.targetHeight = Math.abs(Math.floor(targetHeight) || 0);\n this.colorChannels = blendAlpha ? 4 : 3;\n this.interpolationPass = Boolean(interpolationPass);\n this.resizeCallback =\n typeof resizeCallback === 'function' ? resizeCallback : function() {};\n\n this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels;\n this.originalWidthMultipliedByChannels =\n this.widthOriginal * this.colorChannels;\n this.originalHeightMultipliedByChannels =\n this.heightOriginal * this.colorChannels;\n this.widthPassResultSize =\n this.targetWidthMultipliedByChannels * this.heightOriginal;\n this.finalResultSize =\n this.targetWidthMultipliedByChannels * this.targetHeight;\n this.initialize();\n}\n\nResize.prototype.initialize = function() {\n // Perform some checks:\n if (\n this.widthOriginal > 0 &&\n this.heightOriginal > 0 &&\n this.targetWidth > 0 &&\n this.targetHeight > 0\n ) {\n this.configurePasses();\n } else {\n throw new Error('Invalid settings specified for the resizer.');\n }\n};\n\nResize.prototype.configurePasses = function() {\n if (this.widthOriginal === this.targetWidth) {\n // Bypass the width resizer pass:\n this.resizeWidth = this.bypassResizer;\n } else {\n // Setup the width resizer pass:\n this.ratioWeightWidthPass = this.widthOriginal / this.targetWidth;\n if (this.ratioWeightWidthPass < 1 && this.interpolationPass) {\n this.initializeFirstPassBuffers(true);\n this.resizeWidth =\n this.colorChannels === 4\n ? this.resizeWidthInterpolatedRGBA\n : this.resizeWidthInterpolatedRGB;\n } else {\n this.initializeFirstPassBuffers(false);\n this.resizeWidth =\n this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB;\n }\n }\n\n if (this.heightOriginal === this.targetHeight) {\n // Bypass the height resizer pass:\n this.resizeHeight = this.bypassResizer;\n } else {\n // Setup the height resizer pass:\n this.ratioWeightHeightPass = this.heightOriginal / this.targetHeight;\n if (this.ratioWeightHeightPass < 1 && this.interpolationPass) {\n this.initializeSecondPassBuffers(true);\n this.resizeHeight = this.resizeHeightInterpolated;\n } else {\n this.initializeSecondPassBuffers(false);\n this.resizeHeight =\n this.colorChannels === 4 ? this.resizeHeightRGBA : this.resizeHeightRGB;\n }\n }\n};\n\nResize.prototype._resizeWidthInterpolatedRGBChannels = function(\n buffer,\n fourthChannel\n) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const outputBuffer = this.widthBuffer;\n\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let targetPosition;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (\n targetPosition = 0;\n weight < 1 / 3;\n targetPosition += channelsNum, weight += ratioWeight\n ) {\n for (\n finalOffset = targetPosition, pixelOffset = 0;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel)\n outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n let interpolationWidthSourceReadStop;\n\n for (\n interpolationWidthSourceReadStop = this.widthOriginal - 1;\n weight < interpolationWidthSourceReadStop;\n targetPosition += channelsNum, weight += ratioWeight\n ) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n for (\n finalOffset = targetPosition,\n pixelOffset = Math.floor(weight) * channelsNum;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset + 0] =\n buffer[pixelOffset + 0] * firstWeight +\n buffer[pixelOffset + channelsNum + 0] * secondWeight;\n outputBuffer[finalOffset + 1] =\n buffer[pixelOffset + 1] * firstWeight +\n buffer[pixelOffset + channelsNum + 1] * secondWeight;\n outputBuffer[finalOffset + 2] =\n buffer[pixelOffset + 2] * firstWeight +\n buffer[pixelOffset + channelsNum + 2] * secondWeight;\n if (fourthChannel)\n outputBuffer[finalOffset + 3] =\n buffer[pixelOffset + 3] * firstWeight +\n buffer[pixelOffset + channelsNum + 3] * secondWeight;\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n for (\n interpolationWidthSourceReadStop =\n this.originalWidthMultipliedByChannels - channelsNum;\n targetPosition < this.targetWidthMultipliedByChannels;\n targetPosition += channelsNum\n ) {\n for (\n finalOffset = targetPosition,\n pixelOffset = interpolationWidthSourceReadStop;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel)\n outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n\n return outputBuffer;\n};\n\nResize.prototype._resizeWidthRGBChannels = function(buffer, fourthChannel) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const nextLineOffsetOriginalWidth =\n this.originalWidthMultipliedByChannels - channelsNum + 1;\n const nextLineOffsetTargetWidth =\n this.targetWidthMultipliedByChannels - channelsNum + 1;\n const output = this.outputWidthWorkBench;\n const outputBuffer = this.widthBuffer;\n const trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount;\n\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let line = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n\n do {\n for (line = 0; line < this.originalHeightMultipliedByChannels; ) {\n output[line++] = 0;\n output[line++] = 0;\n output[line++] = 0;\n if (fourthChannel) {\n output[line++] = 0;\n trustworthyColorsCount[line / channelsNum - 1] = 0;\n }\n }\n\n weight = ratioWeight;\n\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n for (\n line = 0, pixelOffset = actualPosition;\n line < this.originalHeightMultipliedByChannels;\n pixelOffset += nextLineOffsetOriginalWidth\n ) {\n r = buffer[pixelOffset];\n g = buffer[++pixelOffset];\n b = buffer[++pixelOffset];\n a = fourthChannel ? buffer[++pixelOffset] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[line++] += (a ? r : 0) * multiplier;\n output[line++] += (a ? g : 0) * multiplier;\n output[line++] += (a ? b : 0) * multiplier;\n if (fourthChannel) {\n output[line++] += a * multiplier;\n trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0;\n }\n }\n\n if (weight >= amountToNext) {\n actualPosition += channelsNum;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (\n weight > 0 &&\n actualPosition < this.originalWidthMultipliedByChannels\n );\n\n for (\n line = 0, pixelOffset = outputOffset;\n line < this.originalHeightMultipliedByChannels;\n pixelOffset += nextLineOffsetTargetWidth\n ) {\n weight = fourthChannel ? trustworthyColorsCount[line / channelsNum] : 1;\n multiplier = fourthChannel\n ? weight\n ? 1 / weight\n : 0\n : ratioWeightDivisor;\n outputBuffer[pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n if (fourthChannel)\n outputBuffer[++pixelOffset] = output[line++] * ratioWeightDivisor;\n }\n\n outputOffset += channelsNum;\n } while (outputOffset < this.targetWidthMultipliedByChannels);\n\n return outputBuffer;\n};\n\nResize.prototype._resizeHeightRGBChannels = function(buffer, fourthChannel) {\n const ratioWeight = this.ratioWeightHeightPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const output = this.outputHeightWorkBench;\n const outputBuffer = this.heightBuffer;\n const trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount;\n\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let caret = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n\n do {\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n\n if (fourthChannel) {\n output[pixelOffset++] = 0;\n trustworthyColorsCount[pixelOffset / 4 - 1] = 0;\n }\n }\n\n weight = ratioWeight;\n\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n caret = actualPosition;\n\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n r = buffer[caret++];\n g = buffer[caret++];\n b = buffer[caret++];\n a = fourthChannel ? buffer[caret++] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[pixelOffset++] += (a ? r : 0) * multiplier;\n output[pixelOffset++] += (a ? g : 0) * multiplier;\n output[pixelOffset++] += (a ? b : 0) * multiplier;\n\n if (fourthChannel) {\n output[pixelOffset++] += a * multiplier;\n trustworthyColorsCount[pixelOffset / 4 - 1] += a ? multiplier : 0;\n }\n }\n\n if (weight >= amountToNext) {\n actualPosition = caret;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (weight > 0 && actualPosition < this.widthPassResultSize);\n\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n weight = fourthChannel ? trustworthyColorsCount[pixelOffset / 4] : 1;\n multiplier = fourthChannel\n ? weight\n ? 1 / weight\n : 0\n : ratioWeightDivisor;\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n\n if (fourthChannel) {\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * ratioWeightDivisor\n );\n }\n }\n } while (outputOffset < this.finalResultSize);\n\n return outputBuffer;\n};\n\nResize.prototype.resizeWidthInterpolatedRGB = function(buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeWidthInterpolatedRGBA = function(buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, true);\n};\n\nResize.prototype.resizeWidthRGB = function(buffer) {\n return this._resizeWidthRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeWidthRGBA = function(buffer) {\n return this._resizeWidthRGBChannels(buffer, true);\n};\n\nResize.prototype.resizeHeightInterpolated = function(buffer) {\n const ratioWeight = this.ratioWeightHeightPass;\n const outputBuffer = this.heightBuffer;\n\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let pixelOffsetAccumulated = 0;\n let pixelOffsetAccumulated2 = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let interpolationHeightSourceReadStop;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (; weight < 1 / 3; weight += ratioWeight) {\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n outputBuffer[finalOffset++] = Math.round(buffer[pixelOffset++]);\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n\n for (\n interpolationHeightSourceReadStop = this.heightOriginal - 1;\n weight < interpolationHeightSourceReadStop;\n weight += ratioWeight\n ) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n pixelOffsetAccumulated =\n Math.floor(weight) * this.targetWidthMultipliedByChannels;\n pixelOffsetAccumulated2 =\n pixelOffsetAccumulated + this.targetWidthMultipliedByChannels;\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n ++pixelOffset\n ) {\n outputBuffer[finalOffset++] = Math.round(\n buffer[pixelOffsetAccumulated++] * firstWeight +\n buffer[pixelOffsetAccumulated2++] * secondWeight\n );\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n while (finalOffset < this.finalResultSize) {\n for (\n pixelOffset = 0,\n pixelOffsetAccumulated =\n interpolationHeightSourceReadStop *\n this.targetWidthMultipliedByChannels;\n pixelOffset < this.targetWidthMultipliedByChannels;\n ++pixelOffset\n ) {\n outputBuffer[finalOffset++] = Math.round(\n buffer[pixelOffsetAccumulated++]\n );\n }\n }\n\n return outputBuffer;\n};\n\nResize.prototype.resizeHeightRGB = function(buffer) {\n return this._resizeHeightRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeHeightRGBA = function(buffer) {\n return this._resizeHeightRGBChannels(buffer, true);\n};\n\nResize.prototype.resize = function(buffer) {\n this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer)));\n};\n\nResize.prototype.bypassResizer = function(buffer) {\n // Just return the buffer passed:\n return buffer;\n};\n\nResize.prototype.initializeFirstPassBuffers = function(BILINEARAlgo) {\n // Initialize the internal width pass buffers:\n this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize);\n\n if (!BILINEARAlgo) {\n this.outputWidthWorkBench = this.generateFloatBuffer(\n this.originalHeightMultipliedByChannels\n );\n\n if (this.colorChannels > 3) {\n this.outputWidthWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(\n this.heightOriginal\n );\n }\n }\n};\n\nResize.prototype.initializeSecondPassBuffers = function(BILINEARAlgo) {\n // Initialize the internal height pass buffers:\n this.heightBuffer = this.generateUint8Buffer(this.finalResultSize);\n\n if (!BILINEARAlgo) {\n this.outputHeightWorkBench = this.generateFloatBuffer(\n this.targetWidthMultipliedByChannels\n );\n\n if (this.colorChannels > 3) {\n this.outputHeightWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(\n this.targetWidth\n );\n }\n }\n};\n\nResize.prototype.generateFloatBuffer = function(bufferLength) {\n // Generate a float32 typed array buffer:\n try {\n return new Float32Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nResize.prototype.generateFloat64Buffer = function(bufferLength) {\n // Generate a float64 typed array buffer:\n try {\n return new Float64Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nResize.prototype.generateUint8Buffer = function(bufferLength) {\n // Generate a uint8 typed array buffer:\n try {\n return new Uint8Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nmodule.exports = Resize;\n"],"file":"resize.js"} \ No newline at end of file +{"version":3,"file":"resize.js","names":["Resize","widthOriginal","heightOriginal","targetWidth","targetHeight","blendAlpha","interpolationPass","resizeCallback","Math","abs","floor","colorChannels","Boolean","targetWidthMultipliedByChannels","originalWidthMultipliedByChannels","originalHeightMultipliedByChannels","widthPassResultSize","finalResultSize","initialize","prototype","configurePasses","Error","resizeWidth","bypassResizer","ratioWeightWidthPass","initializeFirstPassBuffers","resizeWidthInterpolatedRGBA","resizeWidthInterpolatedRGB","resizeWidthRGBA","resizeWidthRGB","resizeHeight","ratioWeightHeightPass","initializeSecondPassBuffers","resizeHeightInterpolated","resizeHeightRGBA","resizeHeightRGB","_resizeWidthInterpolatedRGBChannels","buffer","fourthChannel","channelsNum","ratioWeight","outputBuffer","widthBuffer","weight","finalOffset","pixelOffset","firstWeight","secondWeight","targetPosition","interpolationWidthSourceReadStop","_resizeWidthRGBChannels","ratioWeightDivisor","nextLineOffsetOriginalWidth","nextLineOffsetTargetWidth","output","outputWidthWorkBench","trustworthyColorsCount","outputWidthWorkBenchOpaquePixelsCount","amountToNext","actualPosition","currentPosition","line","outputOffset","multiplier","r","g","b","a","min","_resizeHeightRGBChannels","outputHeightWorkBench","heightBuffer","outputHeightWorkBenchOpaquePixelsCount","caret","round","pixelOffsetAccumulated","pixelOffsetAccumulated2","interpolationHeightSourceReadStop","resize","BILINEARAlgo","generateFloatBuffer","generateFloat64Buffer","generateUint8Buffer","bufferLength","Float32Array","error","Float64Array","Uint8Array"],"sources":["../../src/modules/resize.js"],"sourcesContent":["// JavaScript Image Resizer (c) 2012 - Grant Galitz\n// Released to public domain 29 July 2013: https://github.com/grantgalitz/JS-Image-Resizer/issues/4\n\nfunction Resize(\n widthOriginal,\n heightOriginal,\n targetWidth,\n targetHeight,\n blendAlpha,\n interpolationPass,\n resizeCallback\n) {\n this.widthOriginal = Math.abs(Math.floor(widthOriginal) || 0);\n this.heightOriginal = Math.abs(Math.floor(heightOriginal) || 0);\n this.targetWidth = Math.abs(Math.floor(targetWidth) || 0);\n this.targetHeight = Math.abs(Math.floor(targetHeight) || 0);\n this.colorChannels = blendAlpha ? 4 : 3;\n this.interpolationPass = Boolean(interpolationPass);\n this.resizeCallback =\n typeof resizeCallback === \"function\" ? resizeCallback : function () {};\n\n this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels;\n this.originalWidthMultipliedByChannels =\n this.widthOriginal * this.colorChannels;\n this.originalHeightMultipliedByChannels =\n this.heightOriginal * this.colorChannels;\n this.widthPassResultSize =\n this.targetWidthMultipliedByChannels * this.heightOriginal;\n this.finalResultSize =\n this.targetWidthMultipliedByChannels * this.targetHeight;\n this.initialize();\n}\n\nResize.prototype.initialize = function () {\n // Perform some checks:\n if (\n this.widthOriginal > 0 &&\n this.heightOriginal > 0 &&\n this.targetWidth > 0 &&\n this.targetHeight > 0\n ) {\n this.configurePasses();\n } else {\n throw new Error(\"Invalid settings specified for the resizer.\");\n }\n};\n\nResize.prototype.configurePasses = function () {\n if (this.widthOriginal === this.targetWidth) {\n // Bypass the width resizer pass:\n this.resizeWidth = this.bypassResizer;\n } else {\n // Setup the width resizer pass:\n this.ratioWeightWidthPass = this.widthOriginal / this.targetWidth;\n if (this.ratioWeightWidthPass < 1 && this.interpolationPass) {\n this.initializeFirstPassBuffers(true);\n this.resizeWidth =\n this.colorChannels === 4\n ? this.resizeWidthInterpolatedRGBA\n : this.resizeWidthInterpolatedRGB;\n } else {\n this.initializeFirstPassBuffers(false);\n this.resizeWidth =\n this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB;\n }\n }\n\n if (this.heightOriginal === this.targetHeight) {\n // Bypass the height resizer pass:\n this.resizeHeight = this.bypassResizer;\n } else {\n // Setup the height resizer pass:\n this.ratioWeightHeightPass = this.heightOriginal / this.targetHeight;\n if (this.ratioWeightHeightPass < 1 && this.interpolationPass) {\n this.initializeSecondPassBuffers(true);\n this.resizeHeight = this.resizeHeightInterpolated;\n } else {\n this.initializeSecondPassBuffers(false);\n this.resizeHeight =\n this.colorChannels === 4 ? this.resizeHeightRGBA : this.resizeHeightRGB;\n }\n }\n};\n\nResize.prototype._resizeWidthInterpolatedRGBChannels = function (\n buffer,\n fourthChannel\n) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const outputBuffer = this.widthBuffer;\n\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let targetPosition;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (\n targetPosition = 0;\n weight < 1 / 3;\n targetPosition += channelsNum, weight += ratioWeight\n ) {\n for (\n finalOffset = targetPosition, pixelOffset = 0;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel)\n outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n let interpolationWidthSourceReadStop;\n\n for (\n interpolationWidthSourceReadStop = this.widthOriginal - 1;\n weight < interpolationWidthSourceReadStop;\n targetPosition += channelsNum, weight += ratioWeight\n ) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n for (\n finalOffset = targetPosition,\n pixelOffset = Math.floor(weight) * channelsNum;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset + 0] =\n buffer[pixelOffset + 0] * firstWeight +\n buffer[pixelOffset + channelsNum + 0] * secondWeight;\n outputBuffer[finalOffset + 1] =\n buffer[pixelOffset + 1] * firstWeight +\n buffer[pixelOffset + channelsNum + 1] * secondWeight;\n outputBuffer[finalOffset + 2] =\n buffer[pixelOffset + 2] * firstWeight +\n buffer[pixelOffset + channelsNum + 2] * secondWeight;\n if (fourthChannel)\n outputBuffer[finalOffset + 3] =\n buffer[pixelOffset + 3] * firstWeight +\n buffer[pixelOffset + channelsNum + 3] * secondWeight;\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n for (\n interpolationWidthSourceReadStop =\n this.originalWidthMultipliedByChannels - channelsNum;\n targetPosition < this.targetWidthMultipliedByChannels;\n targetPosition += channelsNum\n ) {\n for (\n finalOffset = targetPosition,\n pixelOffset = interpolationWidthSourceReadStop;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel)\n outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n\n return outputBuffer;\n};\n\nResize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const nextLineOffsetOriginalWidth =\n this.originalWidthMultipliedByChannels - channelsNum + 1;\n const nextLineOffsetTargetWidth =\n this.targetWidthMultipliedByChannels - channelsNum + 1;\n const output = this.outputWidthWorkBench;\n const outputBuffer = this.widthBuffer;\n const trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount;\n\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let line = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n\n do {\n for (line = 0; line < this.originalHeightMultipliedByChannels; ) {\n output[line++] = 0;\n output[line++] = 0;\n output[line++] = 0;\n if (fourthChannel) {\n output[line++] = 0;\n trustworthyColorsCount[line / channelsNum - 1] = 0;\n }\n }\n\n weight = ratioWeight;\n\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n for (\n line = 0, pixelOffset = actualPosition;\n line < this.originalHeightMultipliedByChannels;\n pixelOffset += nextLineOffsetOriginalWidth\n ) {\n r = buffer[pixelOffset];\n g = buffer[++pixelOffset];\n b = buffer[++pixelOffset];\n a = fourthChannel ? buffer[++pixelOffset] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[line++] += (a ? r : 0) * multiplier;\n output[line++] += (a ? g : 0) * multiplier;\n output[line++] += (a ? b : 0) * multiplier;\n if (fourthChannel) {\n output[line++] += a * multiplier;\n trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0;\n }\n }\n\n if (weight >= amountToNext) {\n actualPosition += channelsNum;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (\n weight > 0 &&\n actualPosition < this.originalWidthMultipliedByChannels\n );\n\n for (\n line = 0, pixelOffset = outputOffset;\n line < this.originalHeightMultipliedByChannels;\n pixelOffset += nextLineOffsetTargetWidth\n ) {\n weight = fourthChannel ? trustworthyColorsCount[line / channelsNum] : 1;\n multiplier = fourthChannel\n ? weight\n ? 1 / weight\n : 0\n : ratioWeightDivisor;\n outputBuffer[pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n if (fourthChannel)\n outputBuffer[++pixelOffset] = output[line++] * ratioWeightDivisor;\n }\n\n outputOffset += channelsNum;\n } while (outputOffset < this.targetWidthMultipliedByChannels);\n\n return outputBuffer;\n};\n\nResize.prototype._resizeHeightRGBChannels = function (buffer, fourthChannel) {\n const ratioWeight = this.ratioWeightHeightPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const output = this.outputHeightWorkBench;\n const outputBuffer = this.heightBuffer;\n const trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount;\n\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let caret = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n\n do {\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n\n if (fourthChannel) {\n output[pixelOffset++] = 0;\n trustworthyColorsCount[pixelOffset / 4 - 1] = 0;\n }\n }\n\n weight = ratioWeight;\n\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n caret = actualPosition;\n\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n r = buffer[caret++];\n g = buffer[caret++];\n b = buffer[caret++];\n a = fourthChannel ? buffer[caret++] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[pixelOffset++] += (a ? r : 0) * multiplier;\n output[pixelOffset++] += (a ? g : 0) * multiplier;\n output[pixelOffset++] += (a ? b : 0) * multiplier;\n\n if (fourthChannel) {\n output[pixelOffset++] += a * multiplier;\n trustworthyColorsCount[pixelOffset / 4 - 1] += a ? multiplier : 0;\n }\n }\n\n if (weight >= amountToNext) {\n actualPosition = caret;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (weight > 0 && actualPosition < this.widthPassResultSize);\n\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n weight = fourthChannel ? trustworthyColorsCount[pixelOffset / 4] : 1;\n multiplier = fourthChannel\n ? weight\n ? 1 / weight\n : 0\n : ratioWeightDivisor;\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n\n if (fourthChannel) {\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * ratioWeightDivisor\n );\n }\n }\n } while (outputOffset < this.finalResultSize);\n\n return outputBuffer;\n};\n\nResize.prototype.resizeWidthInterpolatedRGB = function (buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeWidthInterpolatedRGBA = function (buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, true);\n};\n\nResize.prototype.resizeWidthRGB = function (buffer) {\n return this._resizeWidthRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeWidthRGBA = function (buffer) {\n return this._resizeWidthRGBChannels(buffer, true);\n};\n\nResize.prototype.resizeHeightInterpolated = function (buffer) {\n const ratioWeight = this.ratioWeightHeightPass;\n const outputBuffer = this.heightBuffer;\n\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let pixelOffsetAccumulated = 0;\n let pixelOffsetAccumulated2 = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let interpolationHeightSourceReadStop;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (; weight < 1 / 3; weight += ratioWeight) {\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n outputBuffer[finalOffset++] = Math.round(buffer[pixelOffset++]);\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n\n for (\n interpolationHeightSourceReadStop = this.heightOriginal - 1;\n weight < interpolationHeightSourceReadStop;\n weight += ratioWeight\n ) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n pixelOffsetAccumulated =\n Math.floor(weight) * this.targetWidthMultipliedByChannels;\n pixelOffsetAccumulated2 =\n pixelOffsetAccumulated + this.targetWidthMultipliedByChannels;\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n ++pixelOffset\n ) {\n outputBuffer[finalOffset++] = Math.round(\n buffer[pixelOffsetAccumulated++] * firstWeight +\n buffer[pixelOffsetAccumulated2++] * secondWeight\n );\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n while (finalOffset < this.finalResultSize) {\n for (\n pixelOffset = 0,\n pixelOffsetAccumulated =\n interpolationHeightSourceReadStop *\n this.targetWidthMultipliedByChannels;\n pixelOffset < this.targetWidthMultipliedByChannels;\n ++pixelOffset\n ) {\n outputBuffer[finalOffset++] = Math.round(\n buffer[pixelOffsetAccumulated++]\n );\n }\n }\n\n return outputBuffer;\n};\n\nResize.prototype.resizeHeightRGB = function (buffer) {\n return this._resizeHeightRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeHeightRGBA = function (buffer) {\n return this._resizeHeightRGBChannels(buffer, true);\n};\n\nResize.prototype.resize = function (buffer) {\n this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer)));\n};\n\nResize.prototype.bypassResizer = function (buffer) {\n // Just return the buffer passed:\n return buffer;\n};\n\nResize.prototype.initializeFirstPassBuffers = function (BILINEARAlgo) {\n // Initialize the internal width pass buffers:\n this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize);\n\n if (!BILINEARAlgo) {\n this.outputWidthWorkBench = this.generateFloatBuffer(\n this.originalHeightMultipliedByChannels\n );\n\n if (this.colorChannels > 3) {\n this.outputWidthWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(\n this.heightOriginal\n );\n }\n }\n};\n\nResize.prototype.initializeSecondPassBuffers = function (BILINEARAlgo) {\n // Initialize the internal height pass buffers:\n this.heightBuffer = this.generateUint8Buffer(this.finalResultSize);\n\n if (!BILINEARAlgo) {\n this.outputHeightWorkBench = this.generateFloatBuffer(\n this.targetWidthMultipliedByChannels\n );\n\n if (this.colorChannels > 3) {\n this.outputHeightWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(\n this.targetWidth\n );\n }\n }\n};\n\nResize.prototype.generateFloatBuffer = function (bufferLength) {\n // Generate a float32 typed array buffer:\n try {\n return new Float32Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nResize.prototype.generateFloat64Buffer = function (bufferLength) {\n // Generate a float64 typed array buffer:\n try {\n return new Float64Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nResize.prototype.generateUint8Buffer = function (bufferLength) {\n // Generate a uint8 typed array buffer:\n try {\n return new Uint8Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nexport default Resize;\n"],"mappings":";;;;;;AAAA;AACA;;AAEA,SAASA,MAAM,CACbC,aAAa,EACbC,cAAc,EACdC,WAAW,EAC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AqB,GAAG,IAAI,CAACU,mBAAmB,CACnD,IAAI,CAACnE,+BAA+B,CACrC;IAED,IAAI,IAAI,CAACF,aAAa,GAAG,CAAC,EAAE;MAC1B,IAAI,CAAC6D,sCAAsC,GAAG,IAAI,CAACS,qBAAqB,CACtE,IAAI,CAAC9E,WAAW,CACjB;IACH;EACF;AACF,CAAC;AAEDH,MAAM,CAACmB,SAAS,CAAC6D,mBAAmB,GAAG,UAAUG,YAAY,EAAE;EAC7D;EACA,IAAI;IACF,OAAO,IAAIC,YAAY,CAACD,YAAY,CAAC;EACvC,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,OAAO,EAAE;EACX;AACF,CAAC;AAEDrF,MAAM,CAACmB,SAAS,CAAC8D,qBAAqB,GAAG,UAAUE,YAAY,EAAE;EAC/D;EACA,IAAI;IACF,OAAO,IAAIG,YAAY,CAACH,YAAY,CAAC;EACvC,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,OAAO,EAAE;EACX;AACF,CAAC;AAEDrF,MAAM,CAACmB,SAAS,CAAC+D,mBAAmB,GAAG,UAAUC,YAAY,EAAE;EAC7D;EACA,IAAI;IACF,OAAO,IAAII,UAAU,CAACJ,YAAY,CAAC;EACrC,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,OAAO,EAAE;EACX;AACF,CAAC;AAAC,eAEarF,MAAM;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize2.js b/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize2.js index a1b6abdc..dfafce83 100644 --- a/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize2.js +++ b/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize2.js @@ -1,5 +1,9 @@ "use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; /** * Copyright (c) 2015 Guyon Roche * @@ -21,21 +25,21 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -module.exports = { - nearestNeighbor: function nearestNeighbor(src, dst) { - var wSrc = src.width; - var hSrc = src.height; - var wDst = dst.width; - var hDst = dst.height; - var bufSrc = src.data; - var bufDst = dst.data; - for (var i = 0; i < hDst; i++) { - for (var j = 0; j < wDst; j++) { - var posDst = (i * wDst + j) * 4; - var iSrc = Math.floor(i * hSrc / hDst); - var jSrc = Math.floor(j * wSrc / wDst); - var posSrc = (iSrc * wSrc + jSrc) * 4; +const operations = { + nearestNeighbor(src, dst) { + const wSrc = src.width; + const hSrc = src.height; + const wDst = dst.width; + const hDst = dst.height; + const bufSrc = src.data; + const bufDst = dst.data; + for (let i = 0; i < hDst; i++) { + for (let j = 0; j < wDst; j++) { + let posDst = (i * wDst + j) * 4; + const iSrc = Math.floor(i * hSrc / hDst); + const jSrc = Math.floor(j * wSrc / wDst); + let posSrc = (iSrc * wSrc + jSrc) * 4; bufDst[posDst++] = bufSrc[posSrc++]; bufDst[posDst++] = bufSrc[posSrc++]; bufDst[posDst++] = bufSrc[posSrc++]; @@ -43,48 +47,45 @@ module.exports = { } } }, - bilinearInterpolation: function bilinearInterpolation(src, dst) { - var wSrc = src.width; - var hSrc = src.height; - var wDst = dst.width; - var hDst = dst.height; - var bufSrc = src.data; - var bufDst = dst.data; - - var interpolate = function interpolate(k, kMin, vMin, kMax, vMax) { + bilinearInterpolation(src, dst) { + const wSrc = src.width; + const hSrc = src.height; + const wDst = dst.width; + const hDst = dst.height; + const bufSrc = src.data; + const bufDst = dst.data; + const interpolate = function (k, kMin, vMin, kMax, vMax) { // special case - k is integer if (kMin === kMax) { return vMin; } - return Math.round((k - kMin) * vMax + (kMax - k) * vMin); }; + const assign = function (pos, offset, x, xMin, xMax, y, yMin, yMax) { + let posMin = (yMin * wSrc + xMin) * 4 + offset; + let posMax = (yMin * wSrc + xMax) * 4 + offset; + const vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]); - var assign = function assign(pos, offset, x, xMin, xMax, y, yMin, yMax) { - var posMin = (yMin * wSrc + xMin) * 4 + offset; - var posMax = (yMin * wSrc + xMax) * 4 + offset; - var vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]); // special case, y is integer - + // special case, y is integer if (yMax === yMin) { bufDst[pos + offset] = vMin; } else { posMin = (yMax * wSrc + xMin) * 4 + offset; posMax = (yMax * wSrc + xMax) * 4 + offset; - var vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]); + const vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]); bufDst[pos + offset] = interpolate(y, yMin, vMin, yMax, vMax); } }; - - for (var i = 0; i < hDst; i++) { - for (var j = 0; j < wDst; j++) { - var posDst = (i * wDst + j) * 4; // x & y in src coordinates - - var x = j * wSrc / wDst; - var xMin = Math.floor(x); - var xMax = Math.min(Math.ceil(x), wSrc - 1); - var y = i * hSrc / hDst; - var yMin = Math.floor(y); - var yMax = Math.min(Math.ceil(y), hSrc - 1); + for (let i = 0; i < hDst; i++) { + for (let j = 0; j < wDst; j++) { + const posDst = (i * wDst + j) * 4; + // x & y in src coordinates + const x = j * wSrc / wDst; + const xMin = Math.floor(x); + const xMax = Math.min(Math.ceil(x), wSrc - 1); + const y = i * hSrc / hDst; + const yMin = Math.floor(y); + const yMax = Math.min(Math.ceil(y), hSrc - 1); assign(posDst, 0, x, xMin, xMax, y, yMin, yMax); assign(posDst, 1, x, xMin, xMax, y, yMin, yMax); assign(posDst, 2, x, xMin, xMax, y, yMin, yMax); @@ -92,117 +93,106 @@ module.exports = { } } }, - _interpolate2D: function _interpolate2D(src, dst, options, interpolate) { - var bufSrc = src.data; - var bufDst = dst.data; - var wSrc = src.width; - var hSrc = src.height; - var wDst = dst.width; - var hDst = dst.height; // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares + _interpolate2D(src, dst, options, interpolate) { + const bufSrc = src.data; + const bufDst = dst.data; + const wSrc = src.width; + const hSrc = src.height; + const wDst = dst.width; + const hDst = dst.height; + + // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares + const wM = Math.max(1, Math.floor(wSrc / wDst)); + const wDst2 = wDst * wM; + const hM = Math.max(1, Math.floor(hSrc / hDst)); + const hDst2 = hDst * hM; - var wM = Math.max(1, Math.floor(wSrc / wDst)); - var wDst2 = wDst * wM; - var hM = Math.max(1, Math.floor(hSrc / hDst)); - var hDst2 = hDst * hM; // =========================================================== + // =========================================================== // Pass 1 - interpolate rows // buf1 has width of dst2 and height of src - - var buf1 = Buffer.alloc(wDst2 * hSrc * 4); - - for (var i = 0; i < hSrc; i++) { - for (var j = 0; j < wDst2; j++) { + const buf1 = Buffer.alloc(wDst2 * hSrc * 4); + for (let i = 0; i < hSrc; i++) { + for (let j = 0; j < wDst2; j++) { // i in src coords, j in dst coords + // calculate x in src coords // this interpolation requires 4 sample points and the two inner ones must be real // the outer points can be fudged for the edges. // therefore (wSrc-1)/wDst2 - var x = j * (wSrc - 1) / wDst2; - var xPos = Math.floor(x); - var t = x - xPos; - var srcPos = (i * wSrc + xPos) * 4; - var buf1Pos = (i * wDst2 + j) * 4; - - for (var k = 0; k < 4; k++) { - var kPos = srcPos + k; - var x0 = xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4]; - var x1 = bufSrc[kPos]; - var x2 = bufSrc[kPos + 4]; - var x3 = xPos < wSrc - 2 ? bufSrc[kPos + 8] : 2 * bufSrc[kPos + 4] - bufSrc[kPos]; + const x = j * (wSrc - 1) / wDst2; + const xPos = Math.floor(x); + const t = x - xPos; + const srcPos = (i * wSrc + xPos) * 4; + const buf1Pos = (i * wDst2 + j) * 4; + for (let k = 0; k < 4; k++) { + const kPos = srcPos + k; + const x0 = xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4]; + const x1 = bufSrc[kPos]; + const x2 = bufSrc[kPos + 4]; + const x3 = xPos < wSrc - 2 ? bufSrc[kPos + 8] : 2 * bufSrc[kPos + 4] - bufSrc[kPos]; buf1[buf1Pos + k] = interpolate(x0, x1, x2, x3, t); } } - } // this._writeFile(wDst2, hSrc, buf1, "out/buf1.jpg"); + } + // this._writeFile(wDst2, hSrc, buf1, "out/buf1.jpg"); + // =========================================================== // Pass 2 - interpolate columns // buf2 has width and height of dst2 - - - var buf2 = Buffer.alloc(wDst2 * hDst2 * 4); - - for (var _i = 0; _i < hDst2; _i++) { - for (var _j = 0; _j < wDst2; _j++) { + const buf2 = Buffer.alloc(wDst2 * hDst2 * 4); + for (let i = 0; i < hDst2; i++) { + for (let j = 0; j < wDst2; j++) { // i&j in dst2 coords + // calculate y in buf1 coords // this interpolation requires 4 sample points and the two inner ones must be real // the outer points can be fudged for the edges. // therefore (hSrc-1)/hDst2 - var y = _i * (hSrc - 1) / hDst2; - var yPos = Math.floor(y); - - var _t = y - yPos; - - var _buf1Pos = (yPos * wDst2 + _j) * 4; - - var buf2Pos = (_i * wDst2 + _j) * 4; - - for (var _k = 0; _k < 4; _k++) { - var _kPos = _buf1Pos + _k; - - var y0 = yPos > 0 ? buf1[_kPos - wDst2 * 4] : 2 * buf1[_kPos] - buf1[_kPos + wDst2 * 4]; - var y1 = buf1[_kPos]; - var y2 = buf1[_kPos + wDst2 * 4]; - var y3 = yPos < hSrc - 2 ? buf1[_kPos + wDst2 * 8] : 2 * buf1[_kPos + wDst2 * 4] - buf1[_kPos]; - buf2[buf2Pos + _k] = interpolate(y0, y1, y2, y3, _t); + const y = i * (hSrc - 1) / hDst2; + const yPos = Math.floor(y); + const t = y - yPos; + const buf1Pos = (yPos * wDst2 + j) * 4; + const buf2Pos = (i * wDst2 + j) * 4; + for (let k = 0; k < 4; k++) { + const kPos = buf1Pos + k; + const y0 = yPos > 0 ? buf1[kPos - wDst2 * 4] : 2 * buf1[kPos] - buf1[kPos + wDst2 * 4]; + const y1 = buf1[kPos]; + const y2 = buf1[kPos + wDst2 * 4]; + const y3 = yPos < hSrc - 2 ? buf1[kPos + wDst2 * 8] : 2 * buf1[kPos + wDst2 * 4] - buf1[kPos]; + buf2[buf2Pos + k] = interpolate(y0, y1, y2, y3, t); } } - } // this._writeFile(wDst2, hDst2, buf2, "out/buf2.jpg"); + } + // this._writeFile(wDst2, hDst2, buf2, "out/buf2.jpg"); + // =========================================================== // Pass 3 - scale to dst - - - var m = wM * hM; - + const m = wM * hM; if (m > 1) { - for (var _i2 = 0; _i2 < hDst; _i2++) { - for (var _j2 = 0; _j2 < wDst; _j2++) { + for (let i = 0; i < hDst; i++) { + for (let j = 0; j < wDst; j++) { // i&j in dst bounded coords - var r = 0; - var g = 0; - var b = 0; - var a = 0; - var realColors = 0; - - for (var _y = 0; _y < hM; _y++) { - var _yPos = _i2 * hM + _y; - - for (var _x = 0; _x < wM; _x++) { - var _xPos = _j2 * wM + _x; - - var xyPos = (_yPos * wDst2 + _xPos) * 4; - var pixelAlpha = buf2[xyPos + 3]; - + let r = 0; + let g = 0; + let b = 0; + let a = 0; + let realColors = 0; + for (let y = 0; y < hM; y++) { + const yPos = i * hM + y; + for (let x = 0; x < wM; x++) { + const xPos = j * wM + x; + const xyPos = (yPos * wDst2 + xPos) * 4; + const pixelAlpha = buf2[xyPos + 3]; if (pixelAlpha) { r += buf2[xyPos]; g += buf2[xyPos + 1]; b += buf2[xyPos + 2]; realColors++; } - a += pixelAlpha; } } - - var pos = (_i2 * wDst + _j2) * 4; + const pos = (i * wDst + j) * 4; bufDst[pos] = realColors ? Math.round(r / realColors) : 0; bufDst[pos + 1] = realColors ? Math.round(g / realColors) : 0; bufDst[pos + 2] = realColors ? Math.round(b / realColors) : 0; @@ -214,29 +204,27 @@ module.exports = { dst.data = buf2; } }, - bicubicInterpolation: function bicubicInterpolation(src, dst, options) { - var interpolateCubic = function interpolateCubic(x0, x1, x2, x3, t) { - var a0 = x3 - x2 - x0 + x1; - var a1 = x0 - x1 - a0; - var a2 = x2 - x0; - var a3 = x1; + bicubicInterpolation(src, dst, options) { + const interpolateCubic = function (x0, x1, x2, x3, t) { + const a0 = x3 - x2 - x0 + x1; + const a1 = x0 - x1 - a0; + const a2 = x2 - x0; + const a3 = x1; return Math.max(0, Math.min(255, a0 * (t * t * t) + a1 * (t * t) + a2 * t + a3)); }; - return this._interpolate2D(src, dst, options, interpolateCubic); }, - hermiteInterpolation: function hermiteInterpolation(src, dst, options) { - var interpolateHermite = function interpolateHermite(x0, x1, x2, x3, t) { - var c0 = x1; - var c1 = 0.5 * (x2 - x0); - var c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3; - var c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2); + hermiteInterpolation(src, dst, options) { + const interpolateHermite = function (x0, x1, x2, x3, t) { + const c0 = x1; + const c1 = 0.5 * (x2 - x0); + const c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3; + const c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2); return Math.max(0, Math.min(255, Math.round(((c3 * t + c2) * t + c1) * t + c0))); }; - return this._interpolate2D(src, dst, options, interpolateHermite); }, - bezierInterpolation: function bezierInterpolation(src, dst, options) { + bezierInterpolation(src, dst, options) { // between 2 points y(n), y(n+1), use next points out, y(n-1), y(n+2) // to predict control points (a & b) to be placed at n+0.5 // ya(n) = y(n) + (y(n+1)-y(n-1))/4 @@ -248,19 +236,22 @@ module.exports = { // y(-1) = y(0) - 2*(y(1)-y(0)) // y(w) = y(w-1) + 2*(y(w-1)-y(w-2)) // but can go with y(-1) = y(0) and y(w) = y(w-1) - var interpolateBezier = function interpolateBezier(x0, x1, x2, x3, t) { + const interpolateBezier = function (x0, x1, x2, x3, t) { // x1, x2 are the knots, use x0 and x3 to calculate control points - var cp1 = x1 + (x2 - x0) / 4; - var cp2 = x2 - (x3 - x1) / 4; - var nt = 1 - t; - var c0 = x1 * nt * nt * nt; - var c1 = 3 * cp1 * nt * nt * t; - var c2 = 3 * cp2 * nt * t * t; - var c3 = x2 * t * t * t; + const cp1 = x1 + (x2 - x0) / 4; + const cp2 = x2 - (x3 - x1) / 4; + const nt = 1 - t; + const c0 = x1 * nt * nt * nt; + const c1 = 3 * cp1 * nt * nt * t; + const c2 = 3 * cp2 * nt * t * t; + const c3 = x2 * t * t * t; return Math.max(0, Math.min(255, Math.round(c0 + c1 + c2 + c3))); }; - return this._interpolate2D(src, dst, options, interpolateBezier); } }; +var _default = operations; +exports.default = _default; +module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=resize2.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize2.js.map b/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize2.js.map index 4f96dcce..ed590e46 100644 --- a/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize2.js.map +++ b/project starter code/node_modules/@jimp/plugin-resize/dist/modules/resize2.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../src/modules/resize2.js"],"names":["module","exports","nearestNeighbor","src","dst","wSrc","width","hSrc","height","wDst","hDst","bufSrc","data","bufDst","i","j","posDst","iSrc","Math","floor","jSrc","posSrc","bilinearInterpolation","interpolate","k","kMin","vMin","kMax","vMax","round","assign","pos","offset","x","xMin","xMax","y","yMin","yMax","posMin","posMax","min","ceil","_interpolate2D","options","wM","max","wDst2","hM","hDst2","buf1","Buffer","alloc","xPos","t","srcPos","buf1Pos","kPos","x0","x1","x2","x3","buf2","yPos","buf2Pos","y0","y1","y2","y3","m","r","g","b","a","realColors","xyPos","pixelAlpha","bicubicInterpolation","interpolateCubic","a0","a1","a2","a3","hermiteInterpolation","interpolateHermite","c0","c1","c2","c3","bezierInterpolation","interpolateBezier","cp1","cp2","nt"],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;AAsBAA,MAAM,CAACC,OAAP,GAAiB;AACfC,EAAAA,eADe,2BACCC,GADD,EACMC,GADN,EACW;AACxB,QAAMC,IAAI,GAAGF,GAAG,CAACG,KAAjB;AACA,QAAMC,IAAI,GAAGJ,GAAG,CAACK,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,CAAf,GAAmBA,CAA9B;AACA,UAAMkC,EAAE,GAAG5B,EAAE,GAAGN,CAAL,GAASA,CAAT,GAAaA,CAAxB;AACA,aAAOpC,IAAI,CAAC4B,GAAL,CAAS,CAAT,EAAY5B,IAAI,CAACuB,GAAL,CAAS,GAAT,EAAcvB,IAAI,CAACW,KAAL,CAAWwD,EAAE,GAAGC,EAAL,GAAUC,EAAV,GAAeC,EAA1B,CAAd,CAAZ,CAAP;AACD,KAVD;;AAYA,WAAO,KAAK7C,cAAL,CAAoBxC,GAApB,EAAyBC,GAAzB,EAA8BwC,OAA9B,EAAuC8C,iBAAvC,CAAP;AACD;AA7Qc,CAAjB","sourcesContent":["/**\n * Copyright (c) 2015 Guyon Roche\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:

\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nmodule.exports = {\n nearestNeighbor(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n let posDst = (i * wDst + j) * 4;\n\n const iSrc = Math.floor((i * hSrc) / hDst);\n const jSrc = Math.floor((j * wSrc) / wDst);\n let posSrc = (iSrc * wSrc + jSrc) * 4;\n\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n }\n }\n },\n\n bilinearInterpolation(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n const interpolate = function(k, kMin, vMin, kMax, vMax) {\n // special case - k is integer\n if (kMin === kMax) {\n return vMin;\n }\n\n return Math.round((k - kMin) * vMax + (kMax - k) * vMin);\n };\n\n const assign = function(pos, offset, x, xMin, xMax, y, yMin, yMax) {\n let posMin = (yMin * wSrc + xMin) * 4 + offset;\n let posMax = (yMin * wSrc + xMax) * 4 + offset;\n const vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n\n // special case, y is integer\n if (yMax === yMin) {\n bufDst[pos + offset] = vMin;\n } else {\n posMin = (yMax * wSrc + xMin) * 4 + offset;\n posMax = (yMax * wSrc + xMax) * 4 + offset;\n const vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n\n bufDst[pos + offset] = interpolate(y, yMin, vMin, yMax, vMax);\n }\n };\n\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n const posDst = (i * wDst + j) * 4;\n // x & y in src coordinates\n const x = (j * wSrc) / wDst;\n const xMin = Math.floor(x);\n const xMax = Math.min(Math.ceil(x), wSrc - 1);\n\n const y = (i * hSrc) / hDst;\n const yMin = Math.floor(y);\n const yMax = Math.min(Math.ceil(y), hSrc - 1);\n\n assign(posDst, 0, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 1, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 2, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 3, x, xMin, xMax, y, yMin, yMax);\n }\n }\n },\n\n _interpolate2D(src, dst, options, interpolate) {\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares\n const wM = Math.max(1, Math.floor(wSrc / wDst));\n const wDst2 = wDst * wM;\n const hM = Math.max(1, Math.floor(hSrc / hDst));\n const hDst2 = hDst * hM;\n\n // ===========================================================\n // Pass 1 - interpolate rows\n // buf1 has width of dst2 and height of src\n const buf1 = Buffer.alloc(wDst2 * hSrc * 4);\n for (let i = 0; i < hSrc; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i in src coords, j in dst coords\n\n // calculate x in src coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (wSrc-1)/wDst2\n const x = (j * (wSrc - 1)) / wDst2;\n const xPos = Math.floor(x);\n const t = x - xPos;\n const srcPos = (i * wSrc + xPos) * 4;\n const buf1Pos = (i * wDst2 + j) * 4;\n\n for (let k = 0; k < 4; k++) {\n const kPos = srcPos + k;\n const x0 =\n xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4];\n const x1 = bufSrc[kPos];\n const x2 = bufSrc[kPos + 4];\n const x3 =\n xPos < wSrc - 2\n ? bufSrc[kPos + 8]\n : 2 * bufSrc[kPos + 4] - bufSrc[kPos];\n buf1[buf1Pos + k] = interpolate(x0, x1, x2, x3, t);\n }\n }\n }\n // this._writeFile(wDst2, hSrc, buf1, \"out/buf1.jpg\");\n\n // ===========================================================\n // Pass 2 - interpolate columns\n // buf2 has width and height of dst2\n const buf2 = Buffer.alloc(wDst2 * hDst2 * 4);\n for (let i = 0; i < hDst2; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i&j in dst2 coords\n\n // calculate y in buf1 coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (hSrc-1)/hDst2\n const y = (i * (hSrc - 1)) / hDst2;\n const yPos = Math.floor(y);\n const t = y - yPos;\n const buf1Pos = (yPos * wDst2 + j) * 4;\n const buf2Pos = (i * wDst2 + j) * 4;\n for (let k = 0; k < 4; k++) {\n const kPos = buf1Pos + k;\n const y0 =\n yPos > 0\n ? buf1[kPos - wDst2 * 4]\n : 2 * buf1[kPos] - buf1[kPos + wDst2 * 4];\n const y1 = buf1[kPos];\n const y2 = buf1[kPos + wDst2 * 4];\n const y3 =\n yPos < hSrc - 2\n ? buf1[kPos + wDst2 * 8]\n : 2 * buf1[kPos + wDst2 * 4] - buf1[kPos];\n\n buf2[buf2Pos + k] = interpolate(y0, y1, y2, y3, t);\n }\n }\n }\n // this._writeFile(wDst2, hDst2, buf2, \"out/buf2.jpg\");\n\n // ===========================================================\n // Pass 3 - scale to dst\n const m = wM * hM;\n if (m > 1) {\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n // i&j in dst bounded coords\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n let realColors = 0;\n\n for (let y = 0; y < hM; y++) {\n const yPos = i * hM + y;\n\n for (let x = 0; x < wM; x++) {\n const xPos = j * wM + x;\n const xyPos = (yPos * wDst2 + xPos) * 4;\n const pixelAlpha = buf2[xyPos + 3];\n\n if (pixelAlpha) {\n r += buf2[xyPos];\n g += buf2[xyPos + 1];\n b += buf2[xyPos + 2];\n realColors++;\n }\n\n a += pixelAlpha;\n }\n }\n\n const pos = (i * wDst + j) * 4;\n bufDst[pos] = realColors ? Math.round(r / realColors) : 0;\n bufDst[pos + 1] = realColors ? Math.round(g / realColors) : 0;\n bufDst[pos + 2] = realColors ? Math.round(b / realColors) : 0;\n bufDst[pos + 3] = Math.round(a / m);\n }\n }\n } else {\n // replace dst buffer with buf2\n dst.data = buf2;\n }\n },\n\n bicubicInterpolation(src, dst, options) {\n const interpolateCubic = function(x0, x1, x2, x3, t) {\n const a0 = x3 - x2 - x0 + x1;\n const a1 = x0 - x1 - a0;\n const a2 = x2 - x0;\n const a3 = x1;\n return Math.max(\n 0,\n Math.min(255, a0 * (t * t * t) + a1 * (t * t) + a2 * t + a3)\n );\n };\n\n return this._interpolate2D(src, dst, options, interpolateCubic);\n },\n\n hermiteInterpolation(src, dst, options) {\n const interpolateHermite = function(x0, x1, x2, x3, t) {\n const c0 = x1;\n const c1 = 0.5 * (x2 - x0);\n const c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3;\n const c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2);\n return Math.max(\n 0,\n Math.min(255, Math.round(((c3 * t + c2) * t + c1) * t + c0))\n );\n };\n\n return this._interpolate2D(src, dst, options, interpolateHermite);\n },\n\n bezierInterpolation(src, dst, options) {\n // between 2 points y(n), y(n+1), use next points out, y(n-1), y(n+2)\n // to predict control points (a & b) to be placed at n+0.5\n // ya(n) = y(n) + (y(n+1)-y(n-1))/4\n // yb(n) = y(n+1) - (y(n+2)-y(n))/4\n // then use std bezier to interpolate [n,n+1)\n // y(n+t) = y(n)*(1-t)^3 + 3 * ya(n)*(1-t)^2*t + 3 * yb(n)*(1-t)*t^2 + y(n+1)*t^3\n // note the 3* factor for the two control points\n // for edge cases, can choose:\n // y(-1) = y(0) - 2*(y(1)-y(0))\n // y(w) = y(w-1) + 2*(y(w-1)-y(w-2))\n // but can go with y(-1) = y(0) and y(w) = y(w-1)\n const interpolateBezier = function(x0, x1, x2, x3, t) {\n // x1, x2 are the knots, use x0 and x3 to calculate control points\n const cp1 = x1 + (x2 - x0) / 4;\n const cp2 = x2 - (x3 - x1) / 4;\n const nt = 1 - t;\n const c0 = x1 * nt * nt * nt;\n const c1 = 3 * cp1 * nt * nt * t;\n const c2 = 3 * cp2 * nt * t * t;\n const c3 = x2 * t * t * t;\n return Math.max(0, Math.min(255, Math.round(c0 + c1 + c2 + c3)));\n };\n\n return this._interpolate2D(src, dst, options, interpolateBezier);\n }\n};\n"],"file":"resize2.js"} \ No newline at end of file +{"version":3,"file":"resize2.js","names":["operations","nearestNeighbor","src","dst","wSrc","width","hSrc","height","wDst","hDst","bufSrc","data","bufDst","i","j","posDst","iSrc","Math","floor","jSrc","posSrc","bilinearInterpolation","interpolate","k","kMin","vMin","kMax","vMax","round","assign","pos","offset","x","xMin","xMax","y","yMin","yMax","posMin","posMax","min","ceil","_interpolate2D","options","wM","max","wDst2","hM","hDst2","buf1","Buffer","alloc","xPos","t","srcPos","buf1Pos","kPos","x0","x1","x2","x3","buf2","yPos","buf2Pos","y0","y1","y2","y3","m","r","g","b","a","realColors","xyPos","pixelAlpha","bicubicInterpolation","interpolateCubic","a0","a1","a2","a3","hermiteInterpolation","interpolateHermite","c0","c1","c2","c3","bezierInterpolation","interpolateBezier","cp1","cp2","nt"],"sources":["../../src/modules/resize2.js"],"sourcesContent":["/**\n * Copyright (c) 2015 Guyon Roche\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:

\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nconst operations = {\n nearestNeighbor(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n let posDst = (i * wDst + j) * 4;\n\n const iSrc = Math.floor((i * hSrc) / hDst);\n const jSrc = Math.floor((j * wSrc) / wDst);\n let posSrc = (iSrc * wSrc + jSrc) * 4;\n\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n }\n }\n },\n\n bilinearInterpolation(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n const interpolate = function (k, kMin, vMin, kMax, vMax) {\n // special case - k is integer\n if (kMin === kMax) {\n return vMin;\n }\n\n return Math.round((k - kMin) * vMax + (kMax - k) * vMin);\n };\n\n const assign = function (pos, offset, x, xMin, xMax, y, yMin, yMax) {\n let posMin = (yMin * wSrc + xMin) * 4 + offset;\n let posMax = (yMin * wSrc + xMax) * 4 + offset;\n const vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n\n // special case, y is integer\n if (yMax === yMin) {\n bufDst[pos + offset] = vMin;\n } else {\n posMin = (yMax * wSrc + xMin) * 4 + offset;\n posMax = (yMax * wSrc + xMax) * 4 + offset;\n const vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n\n bufDst[pos + offset] = interpolate(y, yMin, vMin, yMax, vMax);\n }\n };\n\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n const posDst = (i * wDst + j) * 4;\n // x & y in src coordinates\n const x = (j * wSrc) / wDst;\n const xMin = Math.floor(x);\n const xMax = Math.min(Math.ceil(x), wSrc - 1);\n\n const y = (i * hSrc) / hDst;\n const yMin = Math.floor(y);\n const yMax = Math.min(Math.ceil(y), hSrc - 1);\n\n assign(posDst, 0, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 1, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 2, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 3, x, xMin, xMax, y, yMin, yMax);\n }\n }\n },\n\n _interpolate2D(src, dst, options, interpolate) {\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares\n const wM = Math.max(1, Math.floor(wSrc / wDst));\n const wDst2 = wDst * wM;\n const hM = Math.max(1, Math.floor(hSrc / hDst));\n const hDst2 = hDst * hM;\n\n // ===========================================================\n // Pass 1 - interpolate rows\n // buf1 has width of dst2 and height of src\n const buf1 = Buffer.alloc(wDst2 * hSrc * 4);\n for (let i = 0; i < hSrc; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i in src coords, j in dst coords\n\n // calculate x in src coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (wSrc-1)/wDst2\n const x = (j * (wSrc - 1)) / wDst2;\n const xPos = Math.floor(x);\n const t = x - xPos;\n const srcPos = (i * wSrc + xPos) * 4;\n const buf1Pos = (i * wDst2 + j) * 4;\n\n for (let k = 0; k < 4; k++) {\n const kPos = srcPos + k;\n const x0 =\n xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4];\n const x1 = bufSrc[kPos];\n const x2 = bufSrc[kPos + 4];\n const x3 =\n xPos < wSrc - 2\n ? bufSrc[kPos + 8]\n : 2 * bufSrc[kPos + 4] - bufSrc[kPos];\n buf1[buf1Pos + k] = interpolate(x0, x1, x2, x3, t);\n }\n }\n }\n // this._writeFile(wDst2, hSrc, buf1, \"out/buf1.jpg\");\n\n // ===========================================================\n // Pass 2 - interpolate columns\n // buf2 has width and height of dst2\n const buf2 = Buffer.alloc(wDst2 * hDst2 * 4);\n for (let i = 0; i < hDst2; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i&j in dst2 coords\n\n // calculate y in buf1 coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (hSrc-1)/hDst2\n const y = (i * (hSrc - 1)) / hDst2;\n const yPos = Math.floor(y);\n const t = y - yPos;\n const buf1Pos = (yPos * wDst2 + j) * 4;\n const buf2Pos = (i * wDst2 + j) * 4;\n for (let k = 0; k < 4; k++) {\n const kPos = buf1Pos + k;\n const y0 =\n yPos > 0\n ? buf1[kPos - wDst2 * 4]\n : 2 * buf1[kPos] - buf1[kPos + wDst2 * 4];\n const y1 = buf1[kPos];\n const y2 = buf1[kPos + wDst2 * 4];\n const y3 =\n yPos < hSrc - 2\n ? buf1[kPos + wDst2 * 8]\n : 2 * buf1[kPos + wDst2 * 4] - buf1[kPos];\n\n buf2[buf2Pos + k] = interpolate(y0, y1, y2, y3, t);\n }\n }\n }\n // this._writeFile(wDst2, hDst2, buf2, \"out/buf2.jpg\");\n\n // ===========================================================\n // Pass 3 - scale to dst\n const m = wM * hM;\n if (m > 1) {\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n // i&j in dst bounded coords\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n let realColors = 0;\n\n for (let y = 0; y < hM; y++) {\n const yPos = i * hM + y;\n\n for (let x = 0; x < wM; x++) {\n const xPos = j * wM + x;\n const xyPos = (yPos * wDst2 + xPos) * 4;\n const pixelAlpha = buf2[xyPos + 3];\n\n if (pixelAlpha) {\n r += buf2[xyPos];\n g += buf2[xyPos + 1];\n b += buf2[xyPos + 2];\n realColors++;\n }\n\n a += pixelAlpha;\n }\n }\n\n const pos = (i * wDst + j) * 4;\n bufDst[pos] = realColors ? Math.round(r / realColors) : 0;\n bufDst[pos + 1] = realColors ? Math.round(g / realColors) : 0;\n bufDst[pos + 2] = realColors ? Math.round(b / realColors) : 0;\n bufDst[pos + 3] = Math.round(a / m);\n }\n }\n } else {\n // replace dst buffer with buf2\n dst.data = buf2;\n }\n },\n\n bicubicInterpolation(src, dst, options) {\n const interpolateCubic = function (x0, x1, x2, x3, t) {\n const a0 = x3 - x2 - x0 + x1;\n const a1 = x0 - x1 - a0;\n const a2 = x2 - x0;\n const a3 = x1;\n return Math.max(\n 0,\n Math.min(255, a0 * (t * t * t) + a1 * (t * t) + a2 * t + a3)\n );\n };\n\n return this._interpolate2D(src, dst, options, interpolateCubic);\n },\n\n hermiteInterpolation(src, dst, options) {\n const interpolateHermite = function (x0, x1, x2, x3, t) {\n const c0 = x1;\n const c1 = 0.5 * (x2 - x0);\n const c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3;\n const c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2);\n return Math.max(\n 0,\n Math.min(255, Math.round(((c3 * t + c2) * t + c1) * t + c0))\n );\n };\n\n return this._interpolate2D(src, dst, options, interpolateHermite);\n },\n\n bezierInterpolation(src, dst, options) {\n // between 2 points y(n), y(n+1), use next points out, y(n-1), y(n+2)\n // to predict control points (a & b) to be placed at n+0.5\n // ya(n) = y(n) + (y(n+1)-y(n-1))/4\n // yb(n) = y(n+1) - (y(n+2)-y(n))/4\n // then use std bezier to interpolate [n,n+1)\n // y(n+t) = y(n)*(1-t)^3 + 3 * ya(n)*(1-t)^2*t + 3 * yb(n)*(1-t)*t^2 + y(n+1)*t^3\n // note the 3* factor for the two control points\n // for edge cases, can choose:\n // y(-1) = y(0) - 2*(y(1)-y(0))\n // y(w) = y(w-1) + 2*(y(w-1)-y(w-2))\n // but can go with y(-1) = y(0) and y(w) = y(w-1)\n const interpolateBezier = function (x0, x1, x2, x3, t) {\n // x1, x2 are the knots, use x0 and x3 to calculate control points\n const cp1 = x1 + (x2 - x0) / 4;\n const cp2 = x2 - (x3 - x1) / 4;\n const nt = 1 - t;\n const c0 = x1 * nt * nt * nt;\n const c1 = 3 * cp1 * nt * nt * t;\n const c2 = 3 * cp2 * nt * t * t;\n const c3 = x2 * t * t * t;\n return Math.max(0, Math.min(255, Math.round(c0 + c1 + c2 + c3)));\n };\n\n return this._interpolate2D(src, dst, options, interpolateBezier);\n },\n};\n\nexport default operations;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,UAAU,GAAG;EACjBC,eAAe,CAACC,GAAG,EAAEC,GAAG,EAAE;IACxB,MAAMC,IAAI,GAAGF,GAAG,CAACG,KAAK;IACtB,MAAMC,IAAI,GAAGJ,GAAG,CAACK,MAAM;IAEvB,MAAMC,IAAI,GAAGL,GAAG,CAACE,KAAK;IACtB,MAAMI,IAAI,GAAGN,GAAG,CAACI,MAAM;IAEvB,MAAMG,MAAM,GAAGR,GAAG,CAACS,IAAI;IACvB,MAAMC,MAAM,GAAGT,GAAG,CAACQ,IAAI;IAEvB,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGJ,IAAI,EAAEI,CAAC,EAAE,EAAE;MAC7B,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGN,IAAI,EAAEM,CAAC,EAAE,EAAE;QAC7B,IAAIC,MAAM,GAAG,CAACF,CAAC,GAAGL,IAAI,GAAGM,CAAC,IAAI,CAAC;QAE/B,MAAME,IAAI,GAAGC,IAAI,CAACC,KAAK,CAAEL,CAAC,GAAGP,IAAI,GAAIG,IAAI,CAAC;QAC1C,MAAMU,IAAI,GAAGF,IAAI,CAACC,KAAK,CAAEJ,CAAC,GAAGV,IAAI,GAAII,IAAI,CAAC;QAC1C,IAAIY,MAAM,GAAG,CAACJ,IAAI,GAAGZ,IAAI,GAA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,EAAE,GAAG5B,EAAE,GAAGN,CAAC,GAAGA,CAAC,GAAGA,CAAC;MACzB,OAAOpC,IAAI,CAAC4B,GAAG,CAAC,CAAC,EAAE5B,IAAI,CAACuB,GAAG,CAAC,GAAG,EAAEvB,IAAI,CAACW,KAAK,CAACwD,EAAE,GAAGC,EAAE,GAAGC,EAAE,GAAGC,EAAE,CAAC,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,IAAI,CAAC7C,cAAc,CAACxC,GAAG,EAAEC,GAAG,EAAEwC,OAAO,EAAE8C,iBAAiB,CAAC;EAClE;AACF,CAAC;AAAC,eAEazF,UAAU;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/es/index.js b/project starter code/node_modules/@jimp/plugin-resize/es/index.js index eb848757..dd4ecb4c 100644 --- a/project starter code/node_modules/@jimp/plugin-resize/es/index.js +++ b/project starter code/node_modules/@jimp/plugin-resize/es/index.js @@ -1,95 +1,69 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -var _resize = _interopRequireDefault(require("./modules/resize")); - -var _resize2 = _interopRequireDefault(require("./modules/resize2")); - -var _default = function _default() { - return { - constants: { - RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor', - RESIZE_BILINEAR: 'bilinearInterpolation', - RESIZE_BICUBIC: 'bicubicInterpolation', - RESIZE_HERMITE: 'hermiteInterpolation', - RESIZE_BEZIER: 'bezierInterpolation' - }, - "class": { - /** - * Resizes the image to a set width and height using a 2-pass bilinear algorithm - * @param {number} w the width to resize the image to (or Jimp.AUTO) - * @param {number} h the height to resize the image to (or Jimp.AUTO) - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - resize: function resize(w, h, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - if (w === this.constructor.AUTO && h === this.constructor.AUTO) { - return _utils.throwError.call(this, 'w and h cannot both be set to auto', cb); - } - - if (w === this.constructor.AUTO) { - w = this.bitmap.width * (h / this.bitmap.height); - } - - if (h === this.constructor.AUTO) { - h = this.bitmap.height * (w / this.bitmap.width); - } - - if (w < 0 || h < 0) { - return _utils.throwError.call(this, 'w and h must be positive numbers', cb); - } // round inputs - - - w = Math.round(w); - h = Math.round(h); - - if (typeof _resize2["default"][mode] === 'function') { - var dst = { - data: Buffer.alloc(w * h * 4), - width: w, - height: h - }; - - _resize2["default"][mode](this.bitmap, dst); - - this.bitmap = dst; - } else { - var image = this; - var resize = new _resize["default"](this.bitmap.width, this.bitmap.height, w, h, true, true, function (buffer) { - image.bitmap.data = Buffer.from(buffer); - image.bitmap.width = w; - image.bitmap.height = h; - }); - resize.resize(this.bitmap.data); - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } +import { throwError, isNodePattern } from "@jimp/utils"; +import Resize from "./modules/resize"; +import Resize2 from "./modules/resize2"; +export default (() => ({ + constants: { + RESIZE_NEAREST_NEIGHBOR: "nearestNeighbor", + RESIZE_BILINEAR: "bilinearInterpolation", + RESIZE_BICUBIC: "bicubicInterpolation", + RESIZE_HERMITE: "hermiteInterpolation", + RESIZE_BEZIER: "bezierInterpolation" + }, + class: { + /** + * Resizes the image to a set width and height using a 2-pass bilinear algorithm + * @param {number} w the width to resize the image to (or Jimp.AUTO) + * @param {number} h the height to resize the image to (or Jimp.AUTO) + * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + resize(w, h, mode, cb) { + if (typeof w !== "number" || typeof h !== "number") { + return throwError.call(this, "w and h must be numbers", cb); + } + if (typeof mode === "function" && typeof cb === "undefined") { + cb = mode; + mode = null; + } + if (w === this.constructor.AUTO && h === this.constructor.AUTO) { + return throwError.call(this, "w and h cannot both be set to auto", cb); + } + if (w === this.constructor.AUTO) { + w = this.bitmap.width * (h / this.bitmap.height); + } + if (h === this.constructor.AUTO) { + h = this.bitmap.height * (w / this.bitmap.width); + } + if (w < 0 || h < 0) { + return throwError.call(this, "w and h must be positive numbers", cb); + } - return this; + // round inputs + w = Math.round(w) || 1; + h = Math.round(h) || 1; + if (typeof Resize2[mode] === "function") { + const dst = { + data: Buffer.alloc(w * h * 4), + width: w, + height: h + }; + Resize2[mode](this.bitmap, dst); + this.bitmap = dst; + } else { + const image = this; + const resize = new Resize(this.bitmap.width, this.bitmap.height, w, h, true, true, buffer => { + image.bitmap.data = Buffer.from(buffer); + image.bitmap.width = w; + image.bitmap.height = h; + }); + resize.resize(this.bitmap.data); + } + if (isNodePattern(cb)) { + cb.call(this, null, this); } + return this; } - }; -}; - -exports["default"] = _default; + } +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/es/index.js.map b/project starter code/node_modules/@jimp/plugin-resize/es/index.js.map index 36caf764..af90280c 100644 --- a/project starter code/node_modules/@jimp/plugin-resize/es/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-resize/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["constants","RESIZE_NEAREST_NEIGHBOR","RESIZE_BILINEAR","RESIZE_BICUBIC","RESIZE_HERMITE","RESIZE_BEZIER","resize","w","h","mode","cb","throwError","call","constructor","AUTO","bitmap","width","height","Math","round","Resize2","dst","data","Buffer","alloc","image","Resize","buffer","from"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;eAEe;AAAA,SAAO;AACpBA,IAAAA,SAAS,EAAE;AACTC,MAAAA,uBAAuB,EAAE,iBADhB;AAETC,MAAAA,eAAe,EAAE,uBAFR;AAGTC,MAAA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AA,CAAC,GAAGW,IAAI,CAACC,KAAL,CAAWZ,CAAX,CAAJ;AACAC,QAAAA,CAAC,GAAGU,IAAI,CAACC,KAAL,CAAWX,CAAX,CAAJ;;AAEA,YAAI,OAAOY,oBAAQX,IAAR,CAAP,KAAyB,UAA7B,EAAyC;AACvC,cAAMY,GAAG,GAAG;AACVC,YAAAA,IAAI,EAAEC,MAAM,CAACC,KAAP,CAAajB,CAAC,GAAGC,CAAJ,GAAQ,CAArB,CADI;AAEVQ,YAAAA,KAAK,EAAET,CAFG;AAGVU,YAAAA,MAAM,EAAET;AAHE,WAAZ;;AAKAY,8BAAQX,IAAR,EAAc,KAAKM,MAAnB,EAA2BM,GAA3B;;AACA,eAAKN,MAAL,GAAcM,GAAd;AACD,SARD,MAQO;AACL,cAAMI,KAAK,GAAG,IAAd;AACA,cAAMnB,MAAM,GAAG,IAAIoB,kBAAJ,CACb,KAAKX,MAAL,CAAYC,KADC,EAEb,KAAKD,MAAL,CAAYE,MAFC,EAGbV,CAHa,EAIbC,CAJa,EAKb,IALa,EAMb,IANa,EAOb,UAAAmB,MAAM,EAAI;AACRF,YAAAA,KAAK,CAACV,MAAN,CAAaO,IAAb,GAAoBC,MAAM,CAACK,IAAP,CAAYD,MAAZ,CAApB;AACAF,YAAAA,KAAK,CAACV,MAAN,CAAaC,KAAb,GAAqBT,CAArB;AACAkB,YAAAA,KAAK,CAACV,MAAN,CAAaE,MAAb,GAAsBT,CAAtB;AACD,WAXY,CAAf;AAaAF,UAAAA,MAAM,CAACA,MAAP,CAAc,KAAKS,MAAL,CAAYO,IAA1B;AACD;;AAED,YAAI,0BAAcZ,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAtEI;AATa,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from '@jimp/utils';\n\nimport Resize from './modules/resize';\nimport Resize2 from './modules/resize2';\n\nexport default () => ({\n constants: {\n RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor',\n RESIZE_BILINEAR: 'bilinearInterpolation',\n RESIZE_BICUBIC: 'bicubicInterpolation',\n RESIZE_HERMITE: 'hermiteInterpolation',\n RESIZE_BEZIER: 'bezierInterpolation'\n },\n\n class: {\n /**\n * Resizes the image to a set width and height using a 2-pass bilinear algorithm\n * @param {number} w the width to resize the image to (or Jimp.AUTO)\n * @param {number} h the height to resize the image to (or Jimp.AUTO)\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n resize(w, h, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n if (w === this.constructor.AUTO && h === this.constructor.AUTO) {\n return throwError.call(this, 'w and h cannot both be set to auto', cb);\n }\n\n if (w === this.constructor.AUTO) {\n w = this.bitmap.width * (h / this.bitmap.height);\n }\n\n if (h === this.constructor.AUTO) {\n h = this.bitmap.height * (w / this.bitmap.width);\n }\n\n if (w < 0 || h < 0) {\n return throwError.call(this, 'w and h must be positive numbers', cb);\n }\n\n // round inputs\n w = Math.round(w);\n h = Math.round(h);\n\n if (typeof Resize2[mode] === 'function') {\n const dst = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h\n };\n Resize2[mode](this.bitmap, dst);\n this.bitmap = dst;\n } else {\n const image = this;\n const resize = new Resize(\n this.bitmap.width,\n this.bitmap.height,\n w,\n h,\n true,\n true,\n buffer => {\n image.bitmap.data = Buffer.from(buffer);\n image.bitmap.width = w;\n image.bitmap.height = h;\n }\n );\n resize.resize(this.bitmap.data);\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["throwError","isNodePattern","Resize","Resize2","constants","RESIZE_NEAREST_NEIGHBOR","RESIZE_BILINEAR","RESIZE_BICUBIC","RESIZE_HERMITE","RESIZE_BEZIER","class","resize","w","h","mode","cb","call","constructor","AUTO","bitmap","width","height","Math","round","dst","data","Buffer","alloc","image","buffer","from"],"sources":["../src/index.js"],"sourcesContent":["import { throwError, isNodePattern } from \"@jimp/utils\";\n\nimport Resize from \"./modules/resize\";\nimport Resize2 from \"./modules/resize2\";\n\nexport default () => ({\n constants: {\n RESIZE_NEAREST_NEIGHBOR: \"nearestNeighbor\",\n RESIZE_BILINEAR: \"bilinearInterpolation\",\n RESIZE_BICUBIC: \"bicubicInterpolation\",\n RESIZE_HERMITE: \"hermiteInterpolation\",\n RESIZE_BEZIER: \"bezierInterpolation\",\n },\n\n class: {\n /**\n * Resizes the image to a set width and height using a 2-pass bilinear algorithm\n * @param {number} w the width to resize the image to (or Jimp.AUTO)\n * @param {number} h the height to resize the image to (or Jimp.AUTO)\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n resize(w, h, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n if (w === this.constructor.AUTO && h === this.constructor.AUTO) {\n return throwError.call(this, \"w and h cannot both be set to auto\", cb);\n }\n\n if (w === this.constructor.AUTO) {\n w = this.bitmap.width * (h / this.bitmap.height);\n }\n\n if (h === this.constructor.AUTO) {\n h = this.bitmap.height * (w / this.bitmap.width);\n }\n\n if (w < 0 || h < 0) {\n return throwError.call(this, \"w and h must be positive numbers\", cb);\n }\n\n // round inputs\n w = Math.round(w) || 1;\n h = Math.round(h) || 1;\n\n if (typeof Resize2[mode] === \"function\") {\n const dst = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h,\n };\n Resize2[mode](this.bitmap, dst);\n this.bitmap = dst;\n } else {\n const image = this;\n const resize = new Resize(\n this.bitmap.width,\n this.bitmap.height,\n w,\n h,\n true,\n true,\n (buffer) => {\n image.bitmap.data = Buffer.from(buffer);\n image.bitmap.width = w;\n image.bitmap.height = h;\n }\n );\n resize.resize(this.bitmap.data);\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n },\n});\n"],"mappings":"AAAA,SAASA,UAAU,EAAEC,aAAa,QAAQ,aAAa;AAEvD,OAAOC,MAAM,MAAM,kBAAkB;AACrC,OAAOC,OAAO,MAAM,mBAAmB;AAEvC,gBAAe,OAAO;EACpBC,SAAS,EAAE;IACTC,uBAAuB,EAAE,iBAAiB;IAC1CC,eAAe,EAAE,uBAAuB;IACxCC,cAAc,EAAE,sBAAsB;IACtCC,cAAc,EAAE,sBAAsB;IACtCC,aAAa,EAAE;EACjB,CAAC;EAEDC,KAAK,EAAE;IACL;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;IACIC,MAAM,CAACC,CAAC,EAAEC,CAAC,EAAEC,IAAI,EAAEC,EAAE,EAAE;MACrB,IAAI,OAAOH,CAAC,KAAK,QAAQ,IAAI,OAAOC,CAAC,KAAK,QAAQ,EAAE;QAClD,OAAOb,UAAU,CAACgB,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAED,EAAE,CAAC;MAC7D;MAEA,IAAI,OAAOD,IAAI,KAAK,UAAU,IAAI,OAAOC,EAAE,KAAK,WAAW,EAAE;QAC3DA,EAAE,GAAGD,IAAI;QACTA,IAAI,GAAG,IAAI;MACb;MAEA,IAAIF,CAAC,KAAK,IAAI,CAACK,WAAW,CAACC,IAAI,IAAIL,CAAC,KAAK,IAAI,CAACI,WAAW,CAACC,IAAI,EAAE;QAC9D,OAAOlB,UAAU,CAACgB,IAAI,CAAC,IAAI,EAAE,oCAAoC,EAAED,EAAE,CAAC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AACM,IAAI,GAAGC,MAAM,CAACI,IAAI,CAACD,MAAM,CAAC;UACvCD,KAAK,CAACT,MAAM,CAACC,KAAK,GAAGR,CAAC;UACtBgB,KAAK,CAACT,MAAM,CAACE,MAAM,GAAGR,CAAC;QACzB,CAAC,CACF;QACDF,MAAM,CAACA,MAAM,CAAC,IAAI,CAACQ,MAAM,CAACM,IAAI,CAAC;MACjC;MAEA,IAAIxB,aAAa,CAACc,EAAE,CAAC,EAAE;QACrBA,EAAE,CAACC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;MAC3B;MAEA,OAAO,IAAI;IACb;EACF;AACF,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize.js b/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize.js index 8dbb005b..619c6b8c 100644 --- a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize.js +++ b/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize.js @@ -1,7 +1,6 @@ -"use strict"; - // JavaScript Image Resizer (c) 2012 - Grant Galitz // Released to public domain 29 July 2013: https://github.com/grantgalitz/JS-Image-Resizer/issues/4 + function Resize(widthOriginal, heightOriginal, targetWidth, targetHeight, blendAlpha, interpolationPass, resizeCallback) { this.widthOriginal = Math.abs(Math.floor(widthOriginal) || 0); this.heightOriginal = Math.abs(Math.floor(heightOriginal) || 0); @@ -9,7 +8,7 @@ function Resize(widthOriginal, heightOriginal, targetWidth, targetHeight, blendA this.targetHeight = Math.abs(Math.floor(targetHeight) || 0); this.colorChannels = blendAlpha ? 4 : 3; this.interpolationPass = Boolean(interpolationPass); - this.resizeCallback = typeof resizeCallback === 'function' ? resizeCallback : function () {}; + this.resizeCallback = typeof resizeCallback === "function" ? resizeCallback : function () {}; this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels; this.originalWidthMultipliedByChannels = this.widthOriginal * this.colorChannels; this.originalHeightMultipliedByChannels = this.heightOriginal * this.colorChannels; @@ -17,16 +16,14 @@ function Resize(widthOriginal, heightOriginal, targetWidth, targetHeight, blendA this.finalResultSize = this.targetWidthMultipliedByChannels * this.targetHeight; this.initialize(); } - Resize.prototype.initialize = function () { // Perform some checks: if (this.widthOriginal > 0 && this.heightOriginal > 0 && this.targetWidth > 0 && this.targetHeight > 0) { this.configurePasses(); } else { - throw new Error('Invalid settings specified for the resizer.'); + throw new Error("Invalid settings specified for the resizer."); } }; - Resize.prototype.configurePasses = function () { if (this.widthOriginal === this.targetWidth) { // Bypass the width resizer pass: @@ -34,7 +31,6 @@ Resize.prototype.configurePasses = function () { } else { // Setup the width resizer pass: this.ratioWeightWidthPass = this.widthOriginal / this.targetWidth; - if (this.ratioWeightWidthPass < 1 && this.interpolationPass) { this.initializeFirstPassBuffers(true); this.resizeWidth = this.colorChannels === 4 ? this.resizeWidthInterpolatedRGBA : this.resizeWidthInterpolatedRGB; @@ -43,14 +39,12 @@ Resize.prototype.configurePasses = function () { this.resizeWidth = this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB; } } - if (this.heightOriginal === this.targetHeight) { // Bypass the height resizer pass: this.resizeHeight = this.bypassResizer; } else { // Setup the height resizer pass: this.ratioWeightHeightPass = this.heightOriginal / this.targetHeight; - if (this.ratioWeightHeightPass < 1 && this.interpolationPass) { this.initializeSecondPassBuffers(true); this.resizeHeight = this.resizeHeightInterpolated; @@ -60,18 +54,18 @@ Resize.prototype.configurePasses = function () { } } }; - Resize.prototype._resizeWidthInterpolatedRGBChannels = function (buffer, fourthChannel) { - var channelsNum = fourthChannel ? 4 : 3; - var ratioWeight = this.ratioWeightWidthPass; - var outputBuffer = this.widthBuffer; - var weight = 0; - var finalOffset = 0; - var pixelOffset = 0; - var firstWeight = 0; - var secondWeight = 0; - var targetPosition; // Handle for only one interpolation input being valid for start calculation: - + const channelsNum = fourthChannel ? 4 : 3; + const ratioWeight = this.ratioWeightWidthPass; + const outputBuffer = this.widthBuffer; + let weight = 0; + let finalOffset = 0; + let pixelOffset = 0; + let firstWeight = 0; + let secondWeight = 0; + let targetPosition; + + // Handle for only one interpolation input being valid for start calculation: for (targetPosition = 0; weight < 1 / 3; targetPosition += channelsNum, weight += ratioWeight) { for (finalOffset = targetPosition, pixelOffset = 0; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) { outputBuffer[finalOffset] = buffer[pixelOffset]; @@ -79,26 +73,25 @@ Resize.prototype._resizeWidthInterpolatedRGBChannels = function (buffer, fourthC outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2]; if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3]; } - } // Adjust for overshoot of the last pass's counter: - + } + // Adjust for overshoot of the last pass's counter: weight -= 1 / 3; - var interpolationWidthSourceReadStop; - + let interpolationWidthSourceReadStop; for (interpolationWidthSourceReadStop = this.widthOriginal - 1; weight < interpolationWidthSourceReadStop; targetPosition += channelsNum, weight += ratioWeight) { // Calculate weightings: secondWeight = weight % 1; - firstWeight = 1 - secondWeight; // Interpolate: - + firstWeight = 1 - secondWeight; + // Interpolate: for (finalOffset = targetPosition, pixelOffset = Math.floor(weight) * channelsNum; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) { outputBuffer[finalOffset + 0] = buffer[pixelOffset + 0] * firstWeight + buffer[pixelOffset + channelsNum + 0] * secondWeight; outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1] * firstWeight + buffer[pixelOffset + channelsNum + 1] * secondWeight; outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2] * firstWeight + buffer[pixelOffset + channelsNum + 2] * secondWeight; if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3] * firstWeight + buffer[pixelOffset + channelsNum + 3] * secondWeight; } - } // Handle for only one interpolation input being valid for end calculation: - + } + // Handle for only one interpolation input being valid for end calculation: for (interpolationWidthSourceReadStop = this.originalWidthMultipliedByChannels - channelsNum; targetPosition < this.targetWidthMultipliedByChannels; targetPosition += channelsNum) { for (finalOffset = targetPosition, pixelOffset = interpolationWidthSourceReadStop; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) { outputBuffer[finalOffset] = buffer[pixelOffset]; @@ -107,66 +100,57 @@ Resize.prototype._resizeWidthInterpolatedRGBChannels = function (buffer, fourthC if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3]; } } - return outputBuffer; }; - Resize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) { - var channelsNum = fourthChannel ? 4 : 3; - var ratioWeight = this.ratioWeightWidthPass; - var ratioWeightDivisor = 1 / ratioWeight; - var nextLineOffsetOriginalWidth = this.originalWidthMultipliedByChannels - channelsNum + 1; - var nextLineOffsetTargetWidth = this.targetWidthMultipliedByChannels - channelsNum + 1; - var output = this.outputWidthWorkBench; - var outputBuffer = this.widthBuffer; - var trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount; - var weight = 0; - var amountToNext = 0; - var actualPosition = 0; - var currentPosition = 0; - var line = 0; - var pixelOffset = 0; - var outputOffset = 0; - var multiplier = 1; - var r = 0; - var g = 0; - var b = 0; - var a = 0; - + const channelsNum = fourthChannel ? 4 : 3; + const ratioWeight = this.ratioWeightWidthPass; + const ratioWeightDivisor = 1 / ratioWeight; + const nextLineOffsetOriginalWidth = this.originalWidthMultipliedByChannels - channelsNum + 1; + const nextLineOffsetTargetWidth = this.targetWidthMultipliedByChannels - channelsNum + 1; + const output = this.outputWidthWorkBench; + const outputBuffer = this.widthBuffer; + const trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount; + let weight = 0; + let amountToNext = 0; + let actualPosition = 0; + let currentPosition = 0; + let line = 0; + let pixelOffset = 0; + let outputOffset = 0; + let multiplier = 1; + let r = 0; + let g = 0; + let b = 0; + let a = 0; do { for (line = 0; line < this.originalHeightMultipliedByChannels;) { output[line++] = 0; output[line++] = 0; output[line++] = 0; - if (fourthChannel) { output[line++] = 0; trustworthyColorsCount[line / channelsNum - 1] = 0; } } - weight = ratioWeight; - do { amountToNext = 1 + actualPosition - currentPosition; multiplier = Math.min(weight, amountToNext); - for (line = 0, pixelOffset = actualPosition; line < this.originalHeightMultipliedByChannels; pixelOffset += nextLineOffsetOriginalWidth) { r = buffer[pixelOffset]; g = buffer[++pixelOffset]; b = buffer[++pixelOffset]; - a = fourthChannel ? buffer[++pixelOffset] : 255; // Ignore RGB values if pixel is completely transparent - + a = fourthChannel ? buffer[++pixelOffset] : 255; + // Ignore RGB values if pixel is completely transparent output[line++] += (a ? r : 0) * multiplier; output[line++] += (a ? g : 0) * multiplier; output[line++] += (a ? b : 0) * multiplier; - if (fourthChannel) { output[line++] += a * multiplier; trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0; } } - if (weight >= amountToNext) { actualPosition += channelsNum; currentPosition = actualPosition; @@ -176,7 +160,6 @@ Resize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) { break; } } while (weight > 0 && actualPosition < this.originalWidthMultipliedByChannels); - for (line = 0, pixelOffset = outputOffset; line < this.originalHeightMultipliedByChannels; pixelOffset += nextLineOffsetTargetWidth) { weight = fourthChannel ? trustworthyColorsCount[line / channelsNum] : 1; multiplier = fourthChannel ? weight ? 1 / weight : 0 : ratioWeightDivisor; @@ -185,67 +168,57 @@ Resize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) { outputBuffer[++pixelOffset] = output[line++] * multiplier; if (fourthChannel) outputBuffer[++pixelOffset] = output[line++] * ratioWeightDivisor; } - outputOffset += channelsNum; } while (outputOffset < this.targetWidthMultipliedByChannels); - return outputBuffer; }; - Resize.prototype._resizeHeightRGBChannels = function (buffer, fourthChannel) { - var ratioWeight = this.ratioWeightHeightPass; - var ratioWeightDivisor = 1 / ratioWeight; - var output = this.outputHeightWorkBench; - var outputBuffer = this.heightBuffer; - var trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount; - var weight = 0; - var amountToNext = 0; - var actualPosition = 0; - var currentPosition = 0; - var pixelOffset = 0; - var outputOffset = 0; - var caret = 0; - var multiplier = 1; - var r = 0; - var g = 0; - var b = 0; - var a = 0; - + const ratioWeight = this.ratioWeightHeightPass; + const ratioWeightDivisor = 1 / ratioWeight; + const output = this.outputHeightWorkBench; + const outputBuffer = this.heightBuffer; + const trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount; + let weight = 0; + let amountToNext = 0; + let actualPosition = 0; + let currentPosition = 0; + let pixelOffset = 0; + let outputOffset = 0; + let caret = 0; + let multiplier = 1; + let r = 0; + let g = 0; + let b = 0; + let a = 0; do { for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { output[pixelOffset++] = 0; output[pixelOffset++] = 0; output[pixelOffset++] = 0; - if (fourthChannel) { output[pixelOffset++] = 0; trustworthyColorsCount[pixelOffset / 4 - 1] = 0; } } - weight = ratioWeight; - do { amountToNext = 1 + actualPosition - currentPosition; multiplier = Math.min(weight, amountToNext); caret = actualPosition; - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { r = buffer[caret++]; g = buffer[caret++]; b = buffer[caret++]; - a = fourthChannel ? buffer[caret++] : 255; // Ignore RGB values if pixel is completely transparent - + a = fourthChannel ? buffer[caret++] : 255; + // Ignore RGB values if pixel is completely transparent output[pixelOffset++] += (a ? r : 0) * multiplier; output[pixelOffset++] += (a ? g : 0) * multiplier; output[pixelOffset++] += (a ? b : 0) * multiplier; - if (fourthChannel) { output[pixelOffset++] += a * multiplier; trustworthyColorsCount[pixelOffset / 4 - 1] += a ? multiplier : 0; } } - if (weight >= amountToNext) { actualPosition = caret; currentPosition = actualPosition; @@ -255,126 +228,105 @@ Resize.prototype._resizeHeightRGBChannels = function (buffer, fourthChannel) { break; } } while (weight > 0 && actualPosition < this.widthPassResultSize); - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { weight = fourthChannel ? trustworthyColorsCount[pixelOffset / 4] : 1; multiplier = fourthChannel ? weight ? 1 / weight : 0 : ratioWeightDivisor; outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier); outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier); outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier); - if (fourthChannel) { outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * ratioWeightDivisor); } } } while (outputOffset < this.finalResultSize); - return outputBuffer; }; - Resize.prototype.resizeWidthInterpolatedRGB = function (buffer) { return this._resizeWidthInterpolatedRGBChannels(buffer, false); }; - Resize.prototype.resizeWidthInterpolatedRGBA = function (buffer) { return this._resizeWidthInterpolatedRGBChannels(buffer, true); }; - Resize.prototype.resizeWidthRGB = function (buffer) { return this._resizeWidthRGBChannels(buffer, false); }; - Resize.prototype.resizeWidthRGBA = function (buffer) { return this._resizeWidthRGBChannels(buffer, true); }; - Resize.prototype.resizeHeightInterpolated = function (buffer) { - var ratioWeight = this.ratioWeightHeightPass; - var outputBuffer = this.heightBuffer; - var weight = 0; - var finalOffset = 0; - var pixelOffset = 0; - var pixelOffsetAccumulated = 0; - var pixelOffsetAccumulated2 = 0; - var firstWeight = 0; - var secondWeight = 0; - var interpolationHeightSourceReadStop; // Handle for only one interpolation input being valid for start calculation: - + const ratioWeight = this.ratioWeightHeightPass; + const outputBuffer = this.heightBuffer; + let weight = 0; + let finalOffset = 0; + let pixelOffset = 0; + let pixelOffsetAccumulated = 0; + let pixelOffsetAccumulated2 = 0; + let firstWeight = 0; + let secondWeight = 0; + let interpolationHeightSourceReadStop; + + // Handle for only one interpolation input being valid for start calculation: for (; weight < 1 / 3; weight += ratioWeight) { for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { outputBuffer[finalOffset++] = Math.round(buffer[pixelOffset++]); } - } // Adjust for overshoot of the last pass's counter: - + } + // Adjust for overshoot of the last pass's counter: weight -= 1 / 3; - for (interpolationHeightSourceReadStop = this.heightOriginal - 1; weight < interpolationHeightSourceReadStop; weight += ratioWeight) { // Calculate weightings: secondWeight = weight % 1; - firstWeight = 1 - secondWeight; // Interpolate: - + firstWeight = 1 - secondWeight; + // Interpolate: pixelOffsetAccumulated = Math.floor(weight) * this.targetWidthMultipliedByChannels; pixelOffsetAccumulated2 = pixelOffsetAccumulated + this.targetWidthMultipliedByChannels; - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels; ++pixelOffset) { outputBuffer[finalOffset++] = Math.round(buffer[pixelOffsetAccumulated++] * firstWeight + buffer[pixelOffsetAccumulated2++] * secondWeight); } - } // Handle for only one interpolation input being valid for end calculation: - + } + // Handle for only one interpolation input being valid for end calculation: while (finalOffset < this.finalResultSize) { for (pixelOffset = 0, pixelOffsetAccumulated = interpolationHeightSourceReadStop * this.targetWidthMultipliedByChannels; pixelOffset < this.targetWidthMultipliedByChannels; ++pixelOffset) { outputBuffer[finalOffset++] = Math.round(buffer[pixelOffsetAccumulated++]); } } - return outputBuffer; }; - Resize.prototype.resizeHeightRGB = function (buffer) { return this._resizeHeightRGBChannels(buffer, false); }; - Resize.prototype.resizeHeightRGBA = function (buffer) { return this._resizeHeightRGBChannels(buffer, true); }; - Resize.prototype.resize = function (buffer) { this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer))); }; - Resize.prototype.bypassResizer = function (buffer) { // Just return the buffer passed: return buffer; }; - Resize.prototype.initializeFirstPassBuffers = function (BILINEARAlgo) { // Initialize the internal width pass buffers: this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize); - if (!BILINEARAlgo) { this.outputWidthWorkBench = this.generateFloatBuffer(this.originalHeightMultipliedByChannels); - if (this.colorChannels > 3) { this.outputWidthWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(this.heightOriginal); } } }; - Resize.prototype.initializeSecondPassBuffers = function (BILINEARAlgo) { // Initialize the internal height pass buffers: this.heightBuffer = this.generateUint8Buffer(this.finalResultSize); - if (!BILINEARAlgo) { this.outputHeightWorkBench = this.generateFloatBuffer(this.targetWidthMultipliedByChannels); - if (this.colorChannels > 3) { this.outputHeightWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(this.targetWidth); } } }; - Resize.prototype.generateFloatBuffer = function (bufferLength) { // Generate a float32 typed array buffer: try { @@ -383,7 +335,6 @@ Resize.prototype.generateFloatBuffer = function (bufferLength) { return []; } }; - Resize.prototype.generateFloat64Buffer = function (bufferLength) { // Generate a float64 typed array buffer: try { @@ -392,7 +343,6 @@ Resize.prototype.generateFloat64Buffer = function (bufferLength) { return []; } }; - Resize.prototype.generateUint8Buffer = function (bufferLength) { // Generate a uint8 typed array buffer: try { @@ -401,6 +351,5 @@ Resize.prototype.generateUint8Buffer = function (bufferLength) { return []; } }; - -module.exports = Resize; +export default Resize; //# sourceMappingURL=resize.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize.js.map b/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize.js.map index 39e5ae34..5dd2ddec 100644 --- a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize.js.map +++ b/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../src/modules/resize.js"],"names":["Resize","widthOriginal","heightOriginal","targetWidth","targetHeight","blendAlpha","interpolationPass","resizeCallback","Math","abs","floor","colorChannels","Boolean","targetWidthMultipliedByChannels","originalWidthMultipliedByChannels","originalHeightMultipliedByChannels","widthPassResultSize","finalResultSize","initialize","prototype","configurePasses","Error","resizeWidth","bypassResizer","ratioWeightWidthPass","initializeFirstPassBuffers","resizeWidthInterpolatedRGBA","resizeWidthInterpolatedRGB","resizeWidthRGBA","resizeWidthRGB","resizeHeight","ratioWeightHeightPass","initializeSecondPassBuffers","resizeHeightInterpolated","resizeHeightRGBA","resizeHeightRGB","_resizeWidthInterpolatedRGBChannels","buffer","fourthChannel","channelsNum","ratioWeight","outputBuffer","widthBuffer","weight","finalOffset","pixelOffset","firstWeight","secondWeight","targetPosition","interpolationWidthSourceReadStop","_resizeWidthRGBChannels","ratioWeightDivisor","nextLineOffsetOriginalWidth","nextLineOffsetTargetWidth","output","outputWidthWorkBench","trustworthyColorsCount","outputWidthWorkBenchOpaquePixelsCount","amountToNext","actualPosition","currentPosition","line","outputOffset","multiplier","r","g","b","a","min","_resizeHeightRGBChannels","outputHeightWorkBench","heightBuffer","outputHeightWorkBenchOpaquePixelsCount","caret","round","pixelOffsetAccumulated","pixelOffsetAccumulated2","interpolationHeightSourceReadStop","resize","BILINEARAlgo","generateFloatBuffer","generateFloat64Buffer","generateUint8Buffer","bufferLength","Float32Array","error","Float64Array","Uint8Array","module","exports"],"mappings":";;AAAA;AACA;AAEA,SAASA,MAAT,CACEC,aADF,EAEEC,cAFF,EAGEC,WAHF,EAIEC,YAJF,EAKEC,UALF,EAMEC,iBANF,EAOEC,cAPF,EAQE;AACA,OAAKN,aAAL,GAAqBO,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWT,aAAX,KAA6B,CAAtC,CAArB;AACA,OAAKC,cAAL,GAAsBM,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWR,cAAX,KAA8B,CAAvC,CAAtB;AACA,OAAKC,WAAL,GAAmBK,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWP,WAAX,KAA2B,CAApC,CAAnB;AACA,OAAKC,YAAL,GAAoBI,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWN,YAAX,KAA4B,CAArC,CAApB;AACA,OAAKO,aAAL,GAAqBN,UAAU,GAAG,CAAH,GAAO,CAAtC;AACA,OAAKC,iBAAL,GAAyBM,OAAO,CAACN,iBAAD,CAAhC;AACA,OAAKC,cAAL,GACE,OAAOA,cAAP,KAA0B,UAA1B,GAAuCA,cAAvC,GAAwD,YAAW,CAAE,CADvE;AAGA,OAAKM,+BAAL,GAAuC,KAAKV,WAAL,GAAmB,KA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,GAFD,CAEE,OAAOE,KAAP,EAAc;AACd,WAAO,EAAP;AACD;AACF,CAPD;;AASArF,MAAM,CAACmB,SAAP,CAAiB+D,mBAAjB,GAAuC,UAASC,YAAT,EAAuB;AAC5D;AACA,MAAI;AACF,WAAO,IAAII,UAAJ,CAAeJ,YAAf,CAAP;AACD,GAFD,CAEE,OAAOE,KAAP,EAAc;AACd,WAAO,EAAP;AACD;AACF,CAPD;;AASAG,MAAM,CAACC,OAAP,GAAiBzF,MAAjB","sourcesContent":["// JavaScript Image Resizer (c) 2012 - Grant Galitz\n// Released to public domain 29 July 2013: https://github.com/grantgalitz/JS-Image-Resizer/issues/4\n\nfunction Resize(\n widthOriginal,\n heightOriginal,\n targetWidth,\n targetHeight,\n blendAlpha,\n interpolationPass,\n resizeCallback\n) {\n this.widthOriginal = Math.abs(Math.floor(widthOriginal) || 0);\n this.heightOriginal = Math.abs(Math.floor(heightOriginal) || 0);\n this.targetWidth = Math.abs(Math.floor(targetWidth) || 0);\n this.targetHeight = Math.abs(Math.floor(targetHeight) || 0);\n this.colorChannels = blendAlpha ? 4 : 3;\n this.interpolationPass = Boolean(interpolationPass);\n this.resizeCallback =\n typeof resizeCallback === 'function' ? resizeCallback : function() {};\n\n this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels;\n this.originalWidthMultipliedByChannels =\n this.widthOriginal * this.colorChannels;\n this.originalHeightMultipliedByChannels =\n this.heightOriginal * this.colorChannels;\n this.widthPassResultSize =\n this.targetWidthMultipliedByChannels * this.heightOriginal;\n this.finalResultSize =\n this.targetWidthMultipliedByChannels * this.targetHeight;\n this.initialize();\n}\n\nResize.prototype.initialize = function() {\n // Perform some checks:\n if (\n this.widthOriginal > 0 &&\n this.heightOriginal > 0 &&\n this.targetWidth > 0 &&\n this.targetHeight > 0\n ) {\n this.configurePasses();\n } else {\n throw new Error('Invalid settings specified for the resizer.');\n }\n};\n\nResize.prototype.configurePasses = function() {\n if (this.widthOriginal === this.targetWidth) {\n // Bypass the width resizer pass:\n this.resizeWidth = this.bypassResizer;\n } else {\n // Setup the width resizer pass:\n this.ratioWeightWidthPass = this.widthOriginal / this.targetWidth;\n if (this.ratioWeightWidthPass < 1 && this.interpolationPass) {\n this.initializeFirstPassBuffers(true);\n this.resizeWidth =\n this.colorChannels === 4\n ? this.resizeWidthInterpolatedRGBA\n : this.resizeWidthInterpolatedRGB;\n } else {\n this.initializeFirstPassBuffers(false);\n this.resizeWidth =\n this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB;\n }\n }\n\n if (this.heightOriginal === this.targetHeight) {\n // Bypass the height resizer pass:\n this.resizeHeight = this.bypassResizer;\n } else {\n // Setup the height resizer pass:\n this.ratioWeightHeightPass = this.heightOriginal / this.targetHeight;\n if (this.ratioWeightHeightPass < 1 && this.interpolationPass) {\n this.initializeSecondPassBuffers(true);\n this.resizeHeight = this.resizeHeightInterpolated;\n } else {\n this.initializeSecondPassBuffers(false);\n this.resizeHeight =\n this.colorChannels === 4 ? this.resizeHeightRGBA : this.resizeHeightRGB;\n }\n }\n};\n\nResize.prototype._resizeWidthInterpolatedRGBChannels = function(\n buffer,\n fourthChannel\n) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const outputBuffer = this.widthBuffer;\n\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let targetPosition;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (\n targetPosition = 0;\n weight < 1 / 3;\n targetPosition += channelsNum, weight += ratioWeight\n ) {\n for (\n finalOffset = targetPosition, pixelOffset = 0;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel)\n outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n let interpolationWidthSourceReadStop;\n\n for (\n interpolationWidthSourceReadStop = this.widthOriginal - 1;\n weight < interpolationWidthSourceReadStop;\n targetPosition += channelsNum, weight += ratioWeight\n ) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n for (\n finalOffset = targetPosition,\n pixelOffset = Math.floor(weight) * channelsNum;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset + 0] =\n buffer[pixelOffset + 0] * firstWeight +\n buffer[pixelOffset + channelsNum + 0] * secondWeight;\n outputBuffer[finalOffset + 1] =\n buffer[pixelOffset + 1] * firstWeight +\n buffer[pixelOffset + channelsNum + 1] * secondWeight;\n outputBuffer[finalOffset + 2] =\n buffer[pixelOffset + 2] * firstWeight +\n buffer[pixelOffset + channelsNum + 2] * secondWeight;\n if (fourthChannel)\n outputBuffer[finalOffset + 3] =\n buffer[pixelOffset + 3] * firstWeight +\n buffer[pixelOffset + channelsNum + 3] * secondWeight;\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n for (\n interpolationWidthSourceReadStop =\n this.originalWidthMultipliedByChannels - channelsNum;\n targetPosition < this.targetWidthMultipliedByChannels;\n targetPosition += channelsNum\n ) {\n for (\n finalOffset = targetPosition,\n pixelOffset = interpolationWidthSourceReadStop;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel)\n outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n\n return outputBuffer;\n};\n\nResize.prototype._resizeWidthRGBChannels = function(buffer, fourthChannel) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const nextLineOffsetOriginalWidth =\n this.originalWidthMultipliedByChannels - channelsNum + 1;\n const nextLineOffsetTargetWidth =\n this.targetWidthMultipliedByChannels - channelsNum + 1;\n const output = this.outputWidthWorkBench;\n const outputBuffer = this.widthBuffer;\n const trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount;\n\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let line = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n\n do {\n for (line = 0; line < this.originalHeightMultipliedByChannels; ) {\n output[line++] = 0;\n output[line++] = 0;\n output[line++] = 0;\n if (fourthChannel) {\n output[line++] = 0;\n trustworthyColorsCount[line / channelsNum - 1] = 0;\n }\n }\n\n weight = ratioWeight;\n\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n for (\n line = 0, pixelOffset = actualPosition;\n line < this.originalHeightMultipliedByChannels;\n pixelOffset += nextLineOffsetOriginalWidth\n ) {\n r = buffer[pixelOffset];\n g = buffer[++pixelOffset];\n b = buffer[++pixelOffset];\n a = fourthChannel ? buffer[++pixelOffset] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[line++] += (a ? r : 0) * multiplier;\n output[line++] += (a ? g : 0) * multiplier;\n output[line++] += (a ? b : 0) * multiplier;\n if (fourthChannel) {\n output[line++] += a * multiplier;\n trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0;\n }\n }\n\n if (weight >= amountToNext) {\n actualPosition += channelsNum;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (\n weight > 0 &&\n actualPosition < this.originalWidthMultipliedByChannels\n );\n\n for (\n line = 0, pixelOffset = outputOffset;\n line < this.originalHeightMultipliedByChannels;\n pixelOffset += nextLineOffsetTargetWidth\n ) {\n weight = fourthChannel ? trustworthyColorsCount[line / channelsNum] : 1;\n multiplier = fourthChannel\n ? weight\n ? 1 / weight\n : 0\n : ratioWeightDivisor;\n outputBuffer[pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n if (fourthChannel)\n outputBuffer[++pixelOffset] = output[line++] * ratioWeightDivisor;\n }\n\n outputOffset += channelsNum;\n } while (outputOffset < this.targetWidthMultipliedByChannels);\n\n return outputBuffer;\n};\n\nResize.prototype._resizeHeightRGBChannels = function(buffer, fourthChannel) {\n const ratioWeight = this.ratioWeightHeightPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const output = this.outputHeightWorkBench;\n const outputBuffer = this.heightBuffer;\n const trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount;\n\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let caret = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n\n do {\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n\n if (fourthChannel) {\n output[pixelOffset++] = 0;\n trustworthyColorsCount[pixelOffset / 4 - 1] = 0;\n }\n }\n\n weight = ratioWeight;\n\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n caret = actualPosition;\n\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n r = buffer[caret++];\n g = buffer[caret++];\n b = buffer[caret++];\n a = fourthChannel ? buffer[caret++] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[pixelOffset++] += (a ? r : 0) * multiplier;\n output[pixelOffset++] += (a ? g : 0) * multiplier;\n output[pixelOffset++] += (a ? b : 0) * multiplier;\n\n if (fourthChannel) {\n output[pixelOffset++] += a * multiplier;\n trustworthyColorsCount[pixelOffset / 4 - 1] += a ? multiplier : 0;\n }\n }\n\n if (weight >= amountToNext) {\n actualPosition = caret;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (weight > 0 && actualPosition < this.widthPassResultSize);\n\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n weight = fourthChannel ? trustworthyColorsCount[pixelOffset / 4] : 1;\n multiplier = fourthChannel\n ? weight\n ? 1 / weight\n : 0\n : ratioWeightDivisor;\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n\n if (fourthChannel) {\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * ratioWeightDivisor\n );\n }\n }\n } while (outputOffset < this.finalResultSize);\n\n return outputBuffer;\n};\n\nResize.prototype.resizeWidthInterpolatedRGB = function(buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeWidthInterpolatedRGBA = function(buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, true);\n};\n\nResize.prototype.resizeWidthRGB = function(buffer) {\n return this._resizeWidthRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeWidthRGBA = function(buffer) {\n return this._resizeWidthRGBChannels(buffer, true);\n};\n\nResize.prototype.resizeHeightInterpolated = function(buffer) {\n const ratioWeight = this.ratioWeightHeightPass;\n const outputBuffer = this.heightBuffer;\n\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let pixelOffsetAccumulated = 0;\n let pixelOffsetAccumulated2 = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let interpolationHeightSourceReadStop;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (; weight < 1 / 3; weight += ratioWeight) {\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n outputBuffer[finalOffset++] = Math.round(buffer[pixelOffset++]);\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n\n for (\n interpolationHeightSourceReadStop = this.heightOriginal - 1;\n weight < interpolationHeightSourceReadStop;\n weight += ratioWeight\n ) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n pixelOffsetAccumulated =\n Math.floor(weight) * this.targetWidthMultipliedByChannels;\n pixelOffsetAccumulated2 =\n pixelOffsetAccumulated + this.targetWidthMultipliedByChannels;\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n ++pixelOffset\n ) {\n outputBuffer[finalOffset++] = Math.round(\n buffer[pixelOffsetAccumulated++] * firstWeight +\n buffer[pixelOffsetAccumulated2++] * secondWeight\n );\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n while (finalOffset < this.finalResultSize) {\n for (\n pixelOffset = 0,\n pixelOffsetAccumulated =\n interpolationHeightSourceReadStop *\n this.targetWidthMultipliedByChannels;\n pixelOffset < this.targetWidthMultipliedByChannels;\n ++pixelOffset\n ) {\n outputBuffer[finalOffset++] = Math.round(\n buffer[pixelOffsetAccumulated++]\n );\n }\n }\n\n return outputBuffer;\n};\n\nResize.prototype.resizeHeightRGB = function(buffer) {\n return this._resizeHeightRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeHeightRGBA = function(buffer) {\n return this._resizeHeightRGBChannels(buffer, true);\n};\n\nResize.prototype.resize = function(buffer) {\n this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer)));\n};\n\nResize.prototype.bypassResizer = function(buffer) {\n // Just return the buffer passed:\n return buffer;\n};\n\nResize.prototype.initializeFirstPassBuffers = function(BILINEARAlgo) {\n // Initialize the internal width pass buffers:\n this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize);\n\n if (!BILINEARAlgo) {\n this.outputWidthWorkBench = this.generateFloatBuffer(\n this.originalHeightMultipliedByChannels\n );\n\n if (this.colorChannels > 3) {\n this.outputWidthWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(\n this.heightOriginal\n );\n }\n }\n};\n\nResize.prototype.initializeSecondPassBuffers = function(BILINEARAlgo) {\n // Initialize the internal height pass buffers:\n this.heightBuffer = this.generateUint8Buffer(this.finalResultSize);\n\n if (!BILINEARAlgo) {\n this.outputHeightWorkBench = this.generateFloatBuffer(\n this.targetWidthMultipliedByChannels\n );\n\n if (this.colorChannels > 3) {\n this.outputHeightWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(\n this.targetWidth\n );\n }\n }\n};\n\nResize.prototype.generateFloatBuffer = function(bufferLength) {\n // Generate a float32 typed array buffer:\n try {\n return new Float32Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nResize.prototype.generateFloat64Buffer = function(bufferLength) {\n // Generate a float64 typed array buffer:\n try {\n return new Float64Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nResize.prototype.generateUint8Buffer = function(bufferLength) {\n // Generate a uint8 typed array buffer:\n try {\n return new Uint8Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nmodule.exports = Resize;\n"],"file":"resize.js"} \ No newline at end of file +{"version":3,"file":"resize.js","names":["Resize","widthOriginal","heightOriginal","targetWidth","targetHeight","blendAlpha","interpolationPass","resizeCallback","Math","abs","floor","colorChannels","Boolean","targetWidthMultipliedByChannels","originalWidthMultipliedByChannels","originalHeightMultipliedByChannels","widthPassResultSize","finalResultSize","initialize","prototype","configurePasses","Error","resizeWidth","bypassResizer","ratioWeightWidthPass","initializeFirstPassBuffers","resizeWidthInterpolatedRGBA","resizeWidthInterpolatedRGB","resizeWidthRGBA","resizeWidthRGB","resizeHeight","ratioWeightHeightPass","initializeSecondPassBuffers","resizeHeightInterpolated","resizeHeightRGBA","resizeHeightRGB","_resizeWidthInterpolatedRGBChannels","buffer","fourthChannel","channelsNum","ratioWeight","outputBuffer","widthBuffer","weight","finalOffset","pixelOffset","firstWeight","secondWeight","targetPosition","interpolationWidthSourceReadStop","_resizeWidthRGBChannels","ratioWeightDivisor","nextLineOffsetOriginalWidth","nextLineOffsetTargetWidth","output","outputWidthWorkBench","trustworthyColorsCount","outputWidthWorkBenchOpaquePixelsCount","amountToNext","actualPosition","currentPosition","line","outputOffset","multiplier","r","g","b","a","min","_resizeHeightRGBChannels","outputHeightWorkBench","heightBuffer","outputHeightWorkBenchOpaquePixelsCount","caret","round","pixelOffsetAccumulated","pixelOffsetAccumulated2","interpolationHeightSourceReadStop","resize","BILINEARAlgo","generateFloatBuffer","generateFloat64Buffer","generateUint8Buffer","bufferLength","Float32Array","error","Float64Array","Uint8Array"],"sources":["../../src/modules/resize.js"],"sourcesContent":["// JavaScript Image Resizer (c) 2012 - Grant Galitz\n// Released to public domain 29 July 2013: https://github.com/grantgalitz/JS-Image-Resizer/issues/4\n\nfunction Resize(\n widthOriginal,\n heightOriginal,\n targetWidth,\n targetHeight,\n blendAlpha,\n interpolationPass,\n resizeCallback\n) {\n this.widthOriginal = Math.abs(Math.floor(widthOriginal) || 0);\n this.heightOriginal = Math.abs(Math.floor(heightOriginal) || 0);\n this.targetWidth = Math.abs(Math.floor(targetWidth) || 0);\n this.targetHeight = Math.abs(Math.floor(targetHeight) || 0);\n this.colorChannels = blendAlpha ? 4 : 3;\n this.interpolationPass = Boolean(interpolationPass);\n this.resizeCallback =\n typeof resizeCallback === \"function\" ? resizeCallback : function () {};\n\n this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels;\n this.originalWidthMultipliedByChannels =\n this.widthOriginal * this.colorChannels;\n this.originalHeightMultipliedByChannels =\n this.heightOriginal * this.colorChannels;\n this.widthPassResultSize =\n this.targetWidthMultipliedByChannels * this.heightOriginal;\n this.finalResultSize =\n this.targetWidthMultipliedByChannels * this.targetHeight;\n this.initialize();\n}\n\nResize.prototype.initialize = function () {\n // Perform some checks:\n if (\n this.widthOriginal > 0 &&\n this.heightOriginal > 0 &&\n this.targetWidth > 0 &&\n this.targetHeight > 0\n ) {\n this.configurePasses();\n } else {\n throw new Error(\"Invalid settings specified for the resizer.\");\n }\n};\n\nResize.prototype.configurePasses = function () {\n if (this.widthOriginal === this.targetWidth) {\n // Bypass the width resizer pass:\n this.resizeWidth = this.bypassResizer;\n } else {\n // Setup the width resizer pass:\n this.ratioWeightWidthPass = this.widthOriginal / this.targetWidth;\n if (this.ratioWeightWidthPass < 1 && this.interpolationPass) {\n this.initializeFirstPassBuffers(true);\n this.resizeWidth =\n this.colorChannels === 4\n ? this.resizeWidthInterpolatedRGBA\n : this.resizeWidthInterpolatedRGB;\n } else {\n this.initializeFirstPassBuffers(false);\n this.resizeWidth =\n this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB;\n }\n }\n\n if (this.heightOriginal === this.targetHeight) {\n // Bypass the height resizer pass:\n this.resizeHeight = this.bypassResizer;\n } else {\n // Setup the height resizer pass:\n this.ratioWeightHeightPass = this.heightOriginal / this.targetHeight;\n if (this.ratioWeightHeightPass < 1 && this.interpolationPass) {\n this.initializeSecondPassBuffers(true);\n this.resizeHeight = this.resizeHeightInterpolated;\n } else {\n this.initializeSecondPassBuffers(false);\n this.resizeHeight =\n this.colorChannels === 4 ? this.resizeHeightRGBA : this.resizeHeightRGB;\n }\n }\n};\n\nResize.prototype._resizeWidthInterpolatedRGBChannels = function (\n buffer,\n fourthChannel\n) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const outputBuffer = this.widthBuffer;\n\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let targetPosition;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (\n targetPosition = 0;\n weight < 1 / 3;\n targetPosition += channelsNum, weight += ratioWeight\n ) {\n for (\n finalOffset = targetPosition, pixelOffset = 0;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel)\n outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n let interpolationWidthSourceReadStop;\n\n for (\n interpolationWidthSourceReadStop = this.widthOriginal - 1;\n weight < interpolationWidthSourceReadStop;\n targetPosition += channelsNum, weight += ratioWeight\n ) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n for (\n finalOffset = targetPosition,\n pixelOffset = Math.floor(weight) * channelsNum;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset + 0] =\n buffer[pixelOffset + 0] * firstWeight +\n buffer[pixelOffset + channelsNum + 0] * secondWeight;\n outputBuffer[finalOffset + 1] =\n buffer[pixelOffset + 1] * firstWeight +\n buffer[pixelOffset + channelsNum + 1] * secondWeight;\n outputBuffer[finalOffset + 2] =\n buffer[pixelOffset + 2] * firstWeight +\n buffer[pixelOffset + channelsNum + 2] * secondWeight;\n if (fourthChannel)\n outputBuffer[finalOffset + 3] =\n buffer[pixelOffset + 3] * firstWeight +\n buffer[pixelOffset + channelsNum + 3] * secondWeight;\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n for (\n interpolationWidthSourceReadStop =\n this.originalWidthMultipliedByChannels - channelsNum;\n targetPosition < this.targetWidthMultipliedByChannels;\n targetPosition += channelsNum\n ) {\n for (\n finalOffset = targetPosition,\n pixelOffset = interpolationWidthSourceReadStop;\n finalOffset < this.widthPassResultSize;\n pixelOffset += this.originalWidthMultipliedByChannels,\n finalOffset += this.targetWidthMultipliedByChannels\n ) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel)\n outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n\n return outputBuffer;\n};\n\nResize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const nextLineOffsetOriginalWidth =\n this.originalWidthMultipliedByChannels - channelsNum + 1;\n const nextLineOffsetTargetWidth =\n this.targetWidthMultipliedByChannels - channelsNum + 1;\n const output = this.outputWidthWorkBench;\n const outputBuffer = this.widthBuffer;\n const trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount;\n\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let line = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n\n do {\n for (line = 0; line < this.originalHeightMultipliedByChannels; ) {\n output[line++] = 0;\n output[line++] = 0;\n output[line++] = 0;\n if (fourthChannel) {\n output[line++] = 0;\n trustworthyColorsCount[line / channelsNum - 1] = 0;\n }\n }\n\n weight = ratioWeight;\n\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n for (\n line = 0, pixelOffset = actualPosition;\n line < this.originalHeightMultipliedByChannels;\n pixelOffset += nextLineOffsetOriginalWidth\n ) {\n r = buffer[pixelOffset];\n g = buffer[++pixelOffset];\n b = buffer[++pixelOffset];\n a = fourthChannel ? buffer[++pixelOffset] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[line++] += (a ? r : 0) * multiplier;\n output[line++] += (a ? g : 0) * multiplier;\n output[line++] += (a ? b : 0) * multiplier;\n if (fourthChannel) {\n output[line++] += a * multiplier;\n trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0;\n }\n }\n\n if (weight >= amountToNext) {\n actualPosition += channelsNum;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (\n weight > 0 &&\n actualPosition < this.originalWidthMultipliedByChannels\n );\n\n for (\n line = 0, pixelOffset = outputOffset;\n line < this.originalHeightMultipliedByChannels;\n pixelOffset += nextLineOffsetTargetWidth\n ) {\n weight = fourthChannel ? trustworthyColorsCount[line / channelsNum] : 1;\n multiplier = fourthChannel\n ? weight\n ? 1 / weight\n : 0\n : ratioWeightDivisor;\n outputBuffer[pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n if (fourthChannel)\n outputBuffer[++pixelOffset] = output[line++] * ratioWeightDivisor;\n }\n\n outputOffset += channelsNum;\n } while (outputOffset < this.targetWidthMultipliedByChannels);\n\n return outputBuffer;\n};\n\nResize.prototype._resizeHeightRGBChannels = function (buffer, fourthChannel) {\n const ratioWeight = this.ratioWeightHeightPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const output = this.outputHeightWorkBench;\n const outputBuffer = this.heightBuffer;\n const trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount;\n\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let caret = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n\n do {\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n\n if (fourthChannel) {\n output[pixelOffset++] = 0;\n trustworthyColorsCount[pixelOffset / 4 - 1] = 0;\n }\n }\n\n weight = ratioWeight;\n\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n caret = actualPosition;\n\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n r = buffer[caret++];\n g = buffer[caret++];\n b = buffer[caret++];\n a = fourthChannel ? buffer[caret++] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[pixelOffset++] += (a ? r : 0) * multiplier;\n output[pixelOffset++] += (a ? g : 0) * multiplier;\n output[pixelOffset++] += (a ? b : 0) * multiplier;\n\n if (fourthChannel) {\n output[pixelOffset++] += a * multiplier;\n trustworthyColorsCount[pixelOffset / 4 - 1] += a ? multiplier : 0;\n }\n }\n\n if (weight >= amountToNext) {\n actualPosition = caret;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (weight > 0 && actualPosition < this.widthPassResultSize);\n\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n weight = fourthChannel ? trustworthyColorsCount[pixelOffset / 4] : 1;\n multiplier = fourthChannel\n ? weight\n ? 1 / weight\n : 0\n : ratioWeightDivisor;\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * multiplier\n );\n\n if (fourthChannel) {\n outputBuffer[outputOffset++] = Math.round(\n output[pixelOffset++] * ratioWeightDivisor\n );\n }\n }\n } while (outputOffset < this.finalResultSize);\n\n return outputBuffer;\n};\n\nResize.prototype.resizeWidthInterpolatedRGB = function (buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeWidthInterpolatedRGBA = function (buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, true);\n};\n\nResize.prototype.resizeWidthRGB = function (buffer) {\n return this._resizeWidthRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeWidthRGBA = function (buffer) {\n return this._resizeWidthRGBChannels(buffer, true);\n};\n\nResize.prototype.resizeHeightInterpolated = function (buffer) {\n const ratioWeight = this.ratioWeightHeightPass;\n const outputBuffer = this.heightBuffer;\n\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let pixelOffsetAccumulated = 0;\n let pixelOffsetAccumulated2 = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let interpolationHeightSourceReadStop;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (; weight < 1 / 3; weight += ratioWeight) {\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n\n ) {\n outputBuffer[finalOffset++] = Math.round(buffer[pixelOffset++]);\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n\n for (\n interpolationHeightSourceReadStop = this.heightOriginal - 1;\n weight < interpolationHeightSourceReadStop;\n weight += ratioWeight\n ) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n pixelOffsetAccumulated =\n Math.floor(weight) * this.targetWidthMultipliedByChannels;\n pixelOffsetAccumulated2 =\n pixelOffsetAccumulated + this.targetWidthMultipliedByChannels;\n for (\n pixelOffset = 0;\n pixelOffset < this.targetWidthMultipliedByChannels;\n ++pixelOffset\n ) {\n outputBuffer[finalOffset++] = Math.round(\n buffer[pixelOffsetAccumulated++] * firstWeight +\n buffer[pixelOffsetAccumulated2++] * secondWeight\n );\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n while (finalOffset < this.finalResultSize) {\n for (\n pixelOffset = 0,\n pixelOffsetAccumulated =\n interpolationHeightSourceReadStop *\n this.targetWidthMultipliedByChannels;\n pixelOffset < this.targetWidthMultipliedByChannels;\n ++pixelOffset\n ) {\n outputBuffer[finalOffset++] = Math.round(\n buffer[pixelOffsetAccumulated++]\n );\n }\n }\n\n return outputBuffer;\n};\n\nResize.prototype.resizeHeightRGB = function (buffer) {\n return this._resizeHeightRGBChannels(buffer, false);\n};\n\nResize.prototype.resizeHeightRGBA = function (buffer) {\n return this._resizeHeightRGBChannels(buffer, true);\n};\n\nResize.prototype.resize = function (buffer) {\n this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer)));\n};\n\nResize.prototype.bypassResizer = function (buffer) {\n // Just return the buffer passed:\n return buffer;\n};\n\nResize.prototype.initializeFirstPassBuffers = function (BILINEARAlgo) {\n // Initialize the internal width pass buffers:\n this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize);\n\n if (!BILINEARAlgo) {\n this.outputWidthWorkBench = this.generateFloatBuffer(\n this.originalHeightMultipliedByChannels\n );\n\n if (this.colorChannels > 3) {\n this.outputWidthWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(\n this.heightOriginal\n );\n }\n }\n};\n\nResize.prototype.initializeSecondPassBuffers = function (BILINEARAlgo) {\n // Initialize the internal height pass buffers:\n this.heightBuffer = this.generateUint8Buffer(this.finalResultSize);\n\n if (!BILINEARAlgo) {\n this.outputHeightWorkBench = this.generateFloatBuffer(\n this.targetWidthMultipliedByChannels\n );\n\n if (this.colorChannels > 3) {\n this.outputHeightWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(\n this.targetWidth\n );\n }\n }\n};\n\nResize.prototype.generateFloatBuffer = function (bufferLength) {\n // Generate a float32 typed array buffer:\n try {\n return new Float32Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nResize.prototype.generateFloat64Buffer = function (bufferLength) {\n // Generate a float64 typed array buffer:\n try {\n return new Float64Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nResize.prototype.generateUint8Buffer = function (bufferLength) {\n // Generate a uint8 typed array buffer:\n try {\n return new Uint8Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\n\nexport default Resize;\n"],"mappings":"AAAA;AACA;;AAEA,SAASA,MAAM,CACbC,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AAY,EAAE;IACjB,IAAI,CAACT,qBAAqB,GAAG,IAAI,CAACU,mBAAmB,CACnD,IAAI,CAACnE,+BAA+B,CACrC;IAED,IAAI,IAAI,CAACF,aAAa,GAAG,CAAC,EAAE;MAC1B,IAAI,CAAC6D,sCAAsC,GAAG,IAAI,CAACS,qBAAqB,CACtE,IAAI,CAAC9E,WAAW,CACjB;IACH;EACF;AACF,CAAC;AAEDH,MAAM,CAACmB,SAAS,CAAC6D,mBAAmB,GAAG,UAAUG,YAAY,EAAE;EAC7D;EACA,IAAI;IACF,OAAO,IAAIC,YAAY,CAACD,YAAY,CAAC;EACvC,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,OAAO,EAAE;EACX;AACF,CAAC;AAEDrF,MAAM,CAACmB,SAAS,CAAC8D,qBAAqB,GAAG,UAAUE,YAAY,EAAE;EAC/D;EACA,IAAI;IACF,OAAO,IAAIG,YAAY,CAACH,YAAY,CAAC;EACvC,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,OAAO,EAAE;EACX;AACF,CAAC;AAEDrF,MAAM,CAACmB,SAAS,CAAC+D,mBAAmB,GAAG,UAAUC,YAAY,EAAE;EAC7D;EACA,IAAI;IACF,OAAO,IAAII,UAAU,CAACJ,YAAY,CAAC;EACrC,CAAC,CAAC,OAAOE,KAAK,EAAE;IACd,OAAO,EAAE;EACX;AACF,CAAC;AAED,eAAerF,MAAM"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize2.js b/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize2.js index a1b6abdc..d1fad17c 100644 --- a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize2.js +++ b/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize2.js @@ -1,5 +1,3 @@ -"use strict"; - /** * Copyright (c) 2015 Guyon Roche * @@ -21,21 +19,21 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -module.exports = { - nearestNeighbor: function nearestNeighbor(src, dst) { - var wSrc = src.width; - var hSrc = src.height; - var wDst = dst.width; - var hDst = dst.height; - var bufSrc = src.data; - var bufDst = dst.data; - for (var i = 0; i < hDst; i++) { - for (var j = 0; j < wDst; j++) { - var posDst = (i * wDst + j) * 4; - var iSrc = Math.floor(i * hSrc / hDst); - var jSrc = Math.floor(j * wSrc / wDst); - var posSrc = (iSrc * wSrc + jSrc) * 4; +const operations = { + nearestNeighbor(src, dst) { + const wSrc = src.width; + const hSrc = src.height; + const wDst = dst.width; + const hDst = dst.height; + const bufSrc = src.data; + const bufDst = dst.data; + for (let i = 0; i < hDst; i++) { + for (let j = 0; j < wDst; j++) { + let posDst = (i * wDst + j) * 4; + const iSrc = Math.floor(i * hSrc / hDst); + const jSrc = Math.floor(j * wSrc / wDst); + let posSrc = (iSrc * wSrc + jSrc) * 4; bufDst[posDst++] = bufSrc[posSrc++]; bufDst[posDst++] = bufSrc[posSrc++]; bufDst[posDst++] = bufSrc[posSrc++]; @@ -43,48 +41,45 @@ module.exports = { } } }, - bilinearInterpolation: function bilinearInterpolation(src, dst) { - var wSrc = src.width; - var hSrc = src.height; - var wDst = dst.width; - var hDst = dst.height; - var bufSrc = src.data; - var bufDst = dst.data; - - var interpolate = function interpolate(k, kMin, vMin, kMax, vMax) { + bilinearInterpolation(src, dst) { + const wSrc = src.width; + const hSrc = src.height; + const wDst = dst.width; + const hDst = dst.height; + const bufSrc = src.data; + const bufDst = dst.data; + const interpolate = function (k, kMin, vMin, kMax, vMax) { // special case - k is integer if (kMin === kMax) { return vMin; } - return Math.round((k - kMin) * vMax + (kMax - k) * vMin); }; + const assign = function (pos, offset, x, xMin, xMax, y, yMin, yMax) { + let posMin = (yMin * wSrc + xMin) * 4 + offset; + let posMax = (yMin * wSrc + xMax) * 4 + offset; + const vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]); - var assign = function assign(pos, offset, x, xMin, xMax, y, yMin, yMax) { - var posMin = (yMin * wSrc + xMin) * 4 + offset; - var posMax = (yMin * wSrc + xMax) * 4 + offset; - var vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]); // special case, y is integer - + // special case, y is integer if (yMax === yMin) { bufDst[pos + offset] = vMin; } else { posMin = (yMax * wSrc + xMin) * 4 + offset; posMax = (yMax * wSrc + xMax) * 4 + offset; - var vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]); + const vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]); bufDst[pos + offset] = interpolate(y, yMin, vMin, yMax, vMax); } }; - - for (var i = 0; i < hDst; i++) { - for (var j = 0; j < wDst; j++) { - var posDst = (i * wDst + j) * 4; // x & y in src coordinates - - var x = j * wSrc / wDst; - var xMin = Math.floor(x); - var xMax = Math.min(Math.ceil(x), wSrc - 1); - var y = i * hSrc / hDst; - var yMin = Math.floor(y); - var yMax = Math.min(Math.ceil(y), hSrc - 1); + for (let i = 0; i < hDst; i++) { + for (let j = 0; j < wDst; j++) { + const posDst = (i * wDst + j) * 4; + // x & y in src coordinates + const x = j * wSrc / wDst; + const xMin = Math.floor(x); + const xMax = Math.min(Math.ceil(x), wSrc - 1); + const y = i * hSrc / hDst; + const yMin = Math.floor(y); + const yMax = Math.min(Math.ceil(y), hSrc - 1); assign(posDst, 0, x, xMin, xMax, y, yMin, yMax); assign(posDst, 1, x, xMin, xMax, y, yMin, yMax); assign(posDst, 2, x, xMin, xMax, y, yMin, yMax); @@ -92,117 +87,106 @@ module.exports = { } } }, - _interpolate2D: function _interpolate2D(src, dst, options, interpolate) { - var bufSrc = src.data; - var bufDst = dst.data; - var wSrc = src.width; - var hSrc = src.height; - var wDst = dst.width; - var hDst = dst.height; // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares + _interpolate2D(src, dst, options, interpolate) { + const bufSrc = src.data; + const bufDst = dst.data; + const wSrc = src.width; + const hSrc = src.height; + const wDst = dst.width; + const hDst = dst.height; + + // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares + const wM = Math.max(1, Math.floor(wSrc / wDst)); + const wDst2 = wDst * wM; + const hM = Math.max(1, Math.floor(hSrc / hDst)); + const hDst2 = hDst * hM; - var wM = Math.max(1, Math.floor(wSrc / wDst)); - var wDst2 = wDst * wM; - var hM = Math.max(1, Math.floor(hSrc / hDst)); - var hDst2 = hDst * hM; // =========================================================== + // =========================================================== // Pass 1 - interpolate rows // buf1 has width of dst2 and height of src - - var buf1 = Buffer.alloc(wDst2 * hSrc * 4); - - for (var i = 0; i < hSrc; i++) { - for (var j = 0; j < wDst2; j++) { + const buf1 = Buffer.alloc(wDst2 * hSrc * 4); + for (let i = 0; i < hSrc; i++) { + for (let j = 0; j < wDst2; j++) { // i in src coords, j in dst coords + // calculate x in src coords // this interpolation requires 4 sample points and the two inner ones must be real // the outer points can be fudged for the edges. // therefore (wSrc-1)/wDst2 - var x = j * (wSrc - 1) / wDst2; - var xPos = Math.floor(x); - var t = x - xPos; - var srcPos = (i * wSrc + xPos) * 4; - var buf1Pos = (i * wDst2 + j) * 4; - - for (var k = 0; k < 4; k++) { - var kPos = srcPos + k; - var x0 = xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4]; - var x1 = bufSrc[kPos]; - var x2 = bufSrc[kPos + 4]; - var x3 = xPos < wSrc - 2 ? bufSrc[kPos + 8] : 2 * bufSrc[kPos + 4] - bufSrc[kPos]; + const x = j * (wSrc - 1) / wDst2; + const xPos = Math.floor(x); + const t = x - xPos; + const srcPos = (i * wSrc + xPos) * 4; + const buf1Pos = (i * wDst2 + j) * 4; + for (let k = 0; k < 4; k++) { + const kPos = srcPos + k; + const x0 = xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4]; + const x1 = bufSrc[kPos]; + const x2 = bufSrc[kPos + 4]; + const x3 = xPos < wSrc - 2 ? bufSrc[kPos + 8] : 2 * bufSrc[kPos + 4] - bufSrc[kPos]; buf1[buf1Pos + k] = interpolate(x0, x1, x2, x3, t); } } - } // this._writeFile(wDst2, hSrc, buf1, "out/buf1.jpg"); + } + // this._writeFile(wDst2, hSrc, buf1, "out/buf1.jpg"); + // =========================================================== // Pass 2 - interpolate columns // buf2 has width and height of dst2 - - - var buf2 = Buffer.alloc(wDst2 * hDst2 * 4); - - for (var _i = 0; _i < hDst2; _i++) { - for (var _j = 0; _j < wDst2; _j++) { + const buf2 = Buffer.alloc(wDst2 * hDst2 * 4); + for (let i = 0; i < hDst2; i++) { + for (let j = 0; j < wDst2; j++) { // i&j in dst2 coords + // calculate y in buf1 coords // this interpolation requires 4 sample points and the two inner ones must be real // the outer points can be fudged for the edges. // therefore (hSrc-1)/hDst2 - var y = _i * (hSrc - 1) / hDst2; - var yPos = Math.floor(y); - - var _t = y - yPos; - - var _buf1Pos = (yPos * wDst2 + _j) * 4; - - var buf2Pos = (_i * wDst2 + _j) * 4; - - for (var _k = 0; _k < 4; _k++) { - var _kPos = _buf1Pos + _k; - - var y0 = yPos > 0 ? buf1[_kPos - wDst2 * 4] : 2 * buf1[_kPos] - buf1[_kPos + wDst2 * 4]; - var y1 = buf1[_kPos]; - var y2 = buf1[_kPos + wDst2 * 4]; - var y3 = yPos < hSrc - 2 ? buf1[_kPos + wDst2 * 8] : 2 * buf1[_kPos + wDst2 * 4] - buf1[_kPos]; - buf2[buf2Pos + _k] = interpolate(y0, y1, y2, y3, _t); + const y = i * (hSrc - 1) / hDst2; + const yPos = Math.floor(y); + const t = y - yPos; + const buf1Pos = (yPos * wDst2 + j) * 4; + const buf2Pos = (i * wDst2 + j) * 4; + for (let k = 0; k < 4; k++) { + const kPos = buf1Pos + k; + const y0 = yPos > 0 ? buf1[kPos - wDst2 * 4] : 2 * buf1[kPos] - buf1[kPos + wDst2 * 4]; + const y1 = buf1[kPos]; + const y2 = buf1[kPos + wDst2 * 4]; + const y3 = yPos < hSrc - 2 ? buf1[kPos + wDst2 * 8] : 2 * buf1[kPos + wDst2 * 4] - buf1[kPos]; + buf2[buf2Pos + k] = interpolate(y0, y1, y2, y3, t); } } - } // this._writeFile(wDst2, hDst2, buf2, "out/buf2.jpg"); + } + // this._writeFile(wDst2, hDst2, buf2, "out/buf2.jpg"); + // =========================================================== // Pass 3 - scale to dst - - - var m = wM * hM; - + const m = wM * hM; if (m > 1) { - for (var _i2 = 0; _i2 < hDst; _i2++) { - for (var _j2 = 0; _j2 < wDst; _j2++) { + for (let i = 0; i < hDst; i++) { + for (let j = 0; j < wDst; j++) { // i&j in dst bounded coords - var r = 0; - var g = 0; - var b = 0; - var a = 0; - var realColors = 0; - - for (var _y = 0; _y < hM; _y++) { - var _yPos = _i2 * hM + _y; - - for (var _x = 0; _x < wM; _x++) { - var _xPos = _j2 * wM + _x; - - var xyPos = (_yPos * wDst2 + _xPos) * 4; - var pixelAlpha = buf2[xyPos + 3]; - + let r = 0; + let g = 0; + let b = 0; + let a = 0; + let realColors = 0; + for (let y = 0; y < hM; y++) { + const yPos = i * hM + y; + for (let x = 0; x < wM; x++) { + const xPos = j * wM + x; + const xyPos = (yPos * wDst2 + xPos) * 4; + const pixelAlpha = buf2[xyPos + 3]; if (pixelAlpha) { r += buf2[xyPos]; g += buf2[xyPos + 1]; b += buf2[xyPos + 2]; realColors++; } - a += pixelAlpha; } } - - var pos = (_i2 * wDst + _j2) * 4; + const pos = (i * wDst + j) * 4; bufDst[pos] = realColors ? Math.round(r / realColors) : 0; bufDst[pos + 1] = realColors ? Math.round(g / realColors) : 0; bufDst[pos + 2] = realColors ? Math.round(b / realColors) : 0; @@ -214,29 +198,27 @@ module.exports = { dst.data = buf2; } }, - bicubicInterpolation: function bicubicInterpolation(src, dst, options) { - var interpolateCubic = function interpolateCubic(x0, x1, x2, x3, t) { - var a0 = x3 - x2 - x0 + x1; - var a1 = x0 - x1 - a0; - var a2 = x2 - x0; - var a3 = x1; + bicubicInterpolation(src, dst, options) { + const interpolateCubic = function (x0, x1, x2, x3, t) { + const a0 = x3 - x2 - x0 + x1; + const a1 = x0 - x1 - a0; + const a2 = x2 - x0; + const a3 = x1; return Math.max(0, Math.min(255, a0 * (t * t * t) + a1 * (t * t) + a2 * t + a3)); }; - return this._interpolate2D(src, dst, options, interpolateCubic); }, - hermiteInterpolation: function hermiteInterpolation(src, dst, options) { - var interpolateHermite = function interpolateHermite(x0, x1, x2, x3, t) { - var c0 = x1; - var c1 = 0.5 * (x2 - x0); - var c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3; - var c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2); + hermiteInterpolation(src, dst, options) { + const interpolateHermite = function (x0, x1, x2, x3, t) { + const c0 = x1; + const c1 = 0.5 * (x2 - x0); + const c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3; + const c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2); return Math.max(0, Math.min(255, Math.round(((c3 * t + c2) * t + c1) * t + c0))); }; - return this._interpolate2D(src, dst, options, interpolateHermite); }, - bezierInterpolation: function bezierInterpolation(src, dst, options) { + bezierInterpolation(src, dst, options) { // between 2 points y(n), y(n+1), use next points out, y(n-1), y(n+2) // to predict control points (a & b) to be placed at n+0.5 // ya(n) = y(n) + (y(n+1)-y(n-1))/4 @@ -248,19 +230,19 @@ module.exports = { // y(-1) = y(0) - 2*(y(1)-y(0)) // y(w) = y(w-1) + 2*(y(w-1)-y(w-2)) // but can go with y(-1) = y(0) and y(w) = y(w-1) - var interpolateBezier = function interpolateBezier(x0, x1, x2, x3, t) { + const interpolateBezier = function (x0, x1, x2, x3, t) { // x1, x2 are the knots, use x0 and x3 to calculate control points - var cp1 = x1 + (x2 - x0) / 4; - var cp2 = x2 - (x3 - x1) / 4; - var nt = 1 - t; - var c0 = x1 * nt * nt * nt; - var c1 = 3 * cp1 * nt * nt * t; - var c2 = 3 * cp2 * nt * t * t; - var c3 = x2 * t * t * t; + const cp1 = x1 + (x2 - x0) / 4; + const cp2 = x2 - (x3 - x1) / 4; + const nt = 1 - t; + const c0 = x1 * nt * nt * nt; + const c1 = 3 * cp1 * nt * nt * t; + const c2 = 3 * cp2 * nt * t * t; + const c3 = x2 * t * t * t; return Math.max(0, Math.min(255, Math.round(c0 + c1 + c2 + c3))); }; - return this._interpolate2D(src, dst, options, interpolateBezier); } }; +export default operations; //# sourceMappingURL=resize2.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize2.js.map b/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize2.js.map index 4f96dcce..21edaf92 100644 --- a/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize2.js.map +++ b/project starter code/node_modules/@jimp/plugin-resize/es/modules/resize2.js.map @@ -1 +1 @@ -{"version":3,"sources":["../../src/modules/resize2.js"],"names":["module","exports","nearestNeighbor","src","dst","wSrc","width","hSrc","height","wDst","hDst","bufSrc","data","bufDst","i","j","posDst","iSrc","Math","floor","jSrc","posSrc","bilinearInterpolation","interpolate","k","kMin","vMin","kMax","vMax","round","assign","pos","offset","x","xMin","xMax","y","yMin","yMax","posMin","posMax","min","ceil","_interpolate2D","options","wM","max","wDst2","hM","hDst2","buf1","Buffer","alloc","xPos","t","srcPos","buf1Pos","kPos","x0","x1","x2","x3","buf2","yPos","buf2Pos","y0","y1","y2","y3","m","r","g","b","a","realColors","xyPos","pixelAlpha","bicubicInterpolation","interpolateCubic","a0","a1","a2","a3","hermiteInterpolation","interpolateHermite","c0","c1","c2","c3","bezierInterpolation","interpolateBezier","cp1","cp2","nt"],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;AAsBAA,MAAM,CAACC,OAAP,GAAiB;AACfC,EAAAA,eADe,2BACCC,GADD,EACMC,GADN,EACW;AACxB,QAAMC,IAAI,GAAGF,GAAG,CAACG,KAAjB;AACA,QAAMC,IAAI,GAAGJ,GAAG,CAACK,MAAjB;AAEA,QAAMC,IAAI,GAAGL,GAAG,CAACE,KAAjB;AACA,QAAMI,IAAI,GAAGN,G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T,GAAaA,CAAxB;AACA,aAAOpC,IAAI,CAAC4B,GAAL,CAAS,CAAT,EAAY5B,IAAI,CAACuB,GAAL,CAAS,GAAT,EAAcvB,IAAI,CAACW,KAAL,CAAWwD,EAAE,GAAGC,EAAL,GAAUC,EAAV,GAAeC,EAA1B,CAAd,CAAZ,CAAP;AACD,KAVD;;AAYA,WAAO,KAAK7C,cAAL,CAAoBxC,GAApB,EAAyBC,GAAzB,EAA8BwC,OAA9B,EAAuC8C,iBAAvC,CAAP;AACD;AA7Qc,CAAjB","sourcesContent":["/**\n * Copyright (c) 2015 Guyon Roche\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:

\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nmodule.exports = {\n nearestNeighbor(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n let posDst = (i * wDst + j) * 4;\n\n const iSrc = Math.floor((i * hSrc) / hDst);\n const jSrc = Math.floor((j * wSrc) / wDst);\n let posSrc = (iSrc * wSrc + jSrc) * 4;\n\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n }\n }\n },\n\n bilinearInterpolation(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n const interpolate = function(k, kMin, vMin, kMax, vMax) {\n // special case - k is integer\n if (kMin === kMax) {\n return vMin;\n }\n\n return Math.round((k - kMin) * vMax + (kMax - k) * vMin);\n };\n\n const assign = function(pos, offset, x, xMin, xMax, y, yMin, yMax) {\n let posMin = (yMin * wSrc + xMin) * 4 + offset;\n let posMax = (yMin * wSrc + xMax) * 4 + offset;\n const vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n\n // special case, y is integer\n if (yMax === yMin) {\n bufDst[pos + offset] = vMin;\n } else {\n posMin = (yMax * wSrc + xMin) * 4 + offset;\n posMax = (yMax * wSrc + xMax) * 4 + offset;\n const vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n\n bufDst[pos + offset] = interpolate(y, yMin, vMin, yMax, vMax);\n }\n };\n\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n const posDst = (i * wDst + j) * 4;\n // x & y in src coordinates\n const x = (j * wSrc) / wDst;\n const xMin = Math.floor(x);\n const xMax = Math.min(Math.ceil(x), wSrc - 1);\n\n const y = (i * hSrc) / hDst;\n const yMin = Math.floor(y);\n const yMax = Math.min(Math.ceil(y), hSrc - 1);\n\n assign(posDst, 0, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 1, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 2, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 3, x, xMin, xMax, y, yMin, yMax);\n }\n }\n },\n\n _interpolate2D(src, dst, options, interpolate) {\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares\n const wM = Math.max(1, Math.floor(wSrc / wDst));\n const wDst2 = wDst * wM;\n const hM = Math.max(1, Math.floor(hSrc / hDst));\n const hDst2 = hDst * hM;\n\n // ===========================================================\n // Pass 1 - interpolate rows\n // buf1 has width of dst2 and height of src\n const buf1 = Buffer.alloc(wDst2 * hSrc * 4);\n for (let i = 0; i < hSrc; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i in src coords, j in dst coords\n\n // calculate x in src coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (wSrc-1)/wDst2\n const x = (j * (wSrc - 1)) / wDst2;\n const xPos = Math.floor(x);\n const t = x - xPos;\n const srcPos = (i * wSrc + xPos) * 4;\n const buf1Pos = (i * wDst2 + j) * 4;\n\n for (let k = 0; k < 4; k++) {\n const kPos = srcPos + k;\n const x0 =\n xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4];\n const x1 = bufSrc[kPos];\n const x2 = bufSrc[kPos + 4];\n const x3 =\n xPos < wSrc - 2\n ? bufSrc[kPos + 8]\n : 2 * bufSrc[kPos + 4] - bufSrc[kPos];\n buf1[buf1Pos + k] = interpolate(x0, x1, x2, x3, t);\n }\n }\n }\n // this._writeFile(wDst2, hSrc, buf1, \"out/buf1.jpg\");\n\n // ===========================================================\n // Pass 2 - interpolate columns\n // buf2 has width and height of dst2\n const buf2 = Buffer.alloc(wDst2 * hDst2 * 4);\n for (let i = 0; i < hDst2; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i&j in dst2 coords\n\n // calculate y in buf1 coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (hSrc-1)/hDst2\n const y = (i * (hSrc - 1)) / hDst2;\n const yPos = Math.floor(y);\n const t = y - yPos;\n const buf1Pos = (yPos * wDst2 + j) * 4;\n const buf2Pos = (i * wDst2 + j) * 4;\n for (let k = 0; k < 4; k++) {\n const kPos = buf1Pos + k;\n const y0 =\n yPos > 0\n ? buf1[kPos - wDst2 * 4]\n : 2 * buf1[kPos] - buf1[kPos + wDst2 * 4];\n const y1 = buf1[kPos];\n const y2 = buf1[kPos + wDst2 * 4];\n const y3 =\n yPos < hSrc - 2\n ? buf1[kPos + wDst2 * 8]\n : 2 * buf1[kPos + wDst2 * 4] - buf1[kPos];\n\n buf2[buf2Pos + k] = interpolate(y0, y1, y2, y3, t);\n }\n }\n }\n // this._writeFile(wDst2, hDst2, buf2, \"out/buf2.jpg\");\n\n // ===========================================================\n // Pass 3 - scale to dst\n const m = wM * hM;\n if (m > 1) {\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n // i&j in dst bounded coords\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n let realColors = 0;\n\n for (let y = 0; y < hM; y++) {\n const yPos = i * hM + y;\n\n for (let x = 0; x < wM; x++) {\n const xPos = j * wM + x;\n const xyPos = (yPos * wDst2 + xPos) * 4;\n const pixelAlpha = buf2[xyPos + 3];\n\n if (pixelAlpha) {\n r += buf2[xyPos];\n g += buf2[xyPos + 1];\n b += buf2[xyPos + 2];\n realColors++;\n }\n\n a += pixelAlpha;\n }\n }\n\n const pos = (i * wDst + j) * 4;\n bufDst[pos] = realColors ? Math.round(r / realColors) : 0;\n bufDst[pos + 1] = realColors ? Math.round(g / realColors) : 0;\n bufDst[pos + 2] = realColors ? Math.round(b / realColors) : 0;\n bufDst[pos + 3] = Math.round(a / m);\n }\n }\n } else {\n // replace dst buffer with buf2\n dst.data = buf2;\n }\n },\n\n bicubicInterpolation(src, dst, options) {\n const interpolateCubic = function(x0, x1, x2, x3, t) {\n const a0 = x3 - x2 - x0 + x1;\n const a1 = x0 - x1 - a0;\n const a2 = x2 - x0;\n const a3 = x1;\n return Math.max(\n 0,\n Math.min(255, a0 * (t * t * t) + a1 * (t * t) + a2 * t + a3)\n );\n };\n\n return this._interpolate2D(src, dst, options, interpolateCubic);\n },\n\n hermiteInterpolation(src, dst, options) {\n const interpolateHermite = function(x0, x1, x2, x3, t) {\n const c0 = x1;\n const c1 = 0.5 * (x2 - x0);\n const c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3;\n const c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2);\n return Math.max(\n 0,\n Math.min(255, Math.round(((c3 * t + c2) * t + c1) * t + c0))\n );\n };\n\n return this._interpolate2D(src, dst, options, interpolateHermite);\n },\n\n bezierInterpolation(src, dst, options) {\n // between 2 points y(n), y(n+1), use next points out, y(n-1), y(n+2)\n // to predict control points (a & b) to be placed at n+0.5\n // ya(n) = y(n) + (y(n+1)-y(n-1))/4\n // yb(n) = y(n+1) - (y(n+2)-y(n))/4\n // then use std bezier to interpolate [n,n+1)\n // y(n+t) = y(n)*(1-t)^3 + 3 * ya(n)*(1-t)^2*t + 3 * yb(n)*(1-t)*t^2 + y(n+1)*t^3\n // note the 3* factor for the two control points\n // for edge cases, can choose:\n // y(-1) = y(0) - 2*(y(1)-y(0))\n // y(w) = y(w-1) + 2*(y(w-1)-y(w-2))\n // but can go with y(-1) = y(0) and y(w) = y(w-1)\n const interpolateBezier = function(x0, x1, x2, x3, t) {\n // x1, x2 are the knots, use x0 and x3 to calculate control points\n const cp1 = x1 + (x2 - x0) / 4;\n const cp2 = x2 - (x3 - x1) / 4;\n const nt = 1 - t;\n const c0 = x1 * nt * nt * nt;\n const c1 = 3 * cp1 * nt * nt * t;\n const c2 = 3 * cp2 * nt * t * t;\n const c3 = x2 * t * t * t;\n return Math.max(0, Math.min(255, Math.round(c0 + c1 + c2 + c3)));\n };\n\n return this._interpolate2D(src, dst, options, interpolateBezier);\n }\n};\n"],"file":"resize2.js"} \ No newline at end of file +{"version":3,"file":"resize2.js","names":["operations","nearestNeighbor","src","dst","wSrc","width","hSrc","height","wDst","hDst","bufSrc","data","bufDst","i","j","posDst","iSrc","Math","floor","jSrc","posSrc","bilinearInterpolation","interpolate","k","kMin","vMin","kMax","vMax","round","assign","pos","offset","x","xMin","xMax","y","yMin","yMax","posMin","posMax","min","ceil","_interpolate2D","options","wM","max","wDst2","hM","hDst2","buf1","Buffer","alloc","xPos","t","srcPos","buf1Pos","kPos","x0","x1","x2","x3","buf2","yPos","buf2Pos","y0","y1","y2","y3","m","r","g","b","a","realColors","xyPos","pixelAlpha","bicubicInterpolation","interpolateCubic","a0","a1","a2","a3","hermiteInterpolation","interpolateHermite","c0","c1","c2","c3","bezierInterpolation","interpolateBezier","cp1","cp2","nt"],"sources":["../../src/modules/resize2.js"],"sourcesContent":["/**\n * Copyright (c) 2015 Guyon Roche\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:

\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nconst operations = {\n nearestNeighbor(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n let posDst = (i * wDst + j) * 4;\n\n const iSrc = Math.floor((i * hSrc) / hDst);\n const jSrc = Math.floor((j * wSrc) / wDst);\n let posSrc = (iSrc * wSrc + jSrc) * 4;\n\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n }\n }\n },\n\n bilinearInterpolation(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n const interpolate = function (k, kMin, vMin, kMax, vMax) {\n // special case - k is integer\n if (kMin === kMax) {\n return vMin;\n }\n\n return Math.round((k - kMin) * vMax + (kMax - k) * vMin);\n };\n\n const assign = function (pos, offset, x, xMin, xMax, y, yMin, yMax) {\n let posMin = (yMin * wSrc + xMin) * 4 + offset;\n let posMax = (yMin * wSrc + xMax) * 4 + offset;\n const vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n\n // special case, y is integer\n if (yMax === yMin) {\n bufDst[pos + offset] = vMin;\n } else {\n posMin = (yMax * wSrc + xMin) * 4 + offset;\n posMax = (yMax * wSrc + xMax) * 4 + offset;\n const vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n\n bufDst[pos + offset] = interpolate(y, yMin, vMin, yMax, vMax);\n }\n };\n\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n const posDst = (i * wDst + j) * 4;\n // x & y in src coordinates\n const x = (j * wSrc) / wDst;\n const xMin = Math.floor(x);\n const xMax = Math.min(Math.ceil(x), wSrc - 1);\n\n const y = (i * hSrc) / hDst;\n const yMin = Math.floor(y);\n const yMax = Math.min(Math.ceil(y), hSrc - 1);\n\n assign(posDst, 0, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 1, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 2, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 3, x, xMin, xMax, y, yMin, yMax);\n }\n }\n },\n\n _interpolate2D(src, dst, options, interpolate) {\n const bufSrc = src.data;\n const bufDst = dst.data;\n\n const wSrc = src.width;\n const hSrc = src.height;\n\n const wDst = dst.width;\n const hDst = dst.height;\n\n // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares\n const wM = Math.max(1, Math.floor(wSrc / wDst));\n const wDst2 = wDst * wM;\n const hM = Math.max(1, Math.floor(hSrc / hDst));\n const hDst2 = hDst * hM;\n\n // ===========================================================\n // Pass 1 - interpolate rows\n // buf1 has width of dst2 and height of src\n const buf1 = Buffer.alloc(wDst2 * hSrc * 4);\n for (let i = 0; i < hSrc; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i in src coords, j in dst coords\n\n // calculate x in src coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (wSrc-1)/wDst2\n const x = (j * (wSrc - 1)) / wDst2;\n const xPos = Math.floor(x);\n const t = x - xPos;\n const srcPos = (i * wSrc + xPos) * 4;\n const buf1Pos = (i * wDst2 + j) * 4;\n\n for (let k = 0; k < 4; k++) {\n const kPos = srcPos + k;\n const x0 =\n xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4];\n const x1 = bufSrc[kPos];\n const x2 = bufSrc[kPos + 4];\n const x3 =\n xPos < wSrc - 2\n ? bufSrc[kPos + 8]\n : 2 * bufSrc[kPos + 4] - bufSrc[kPos];\n buf1[buf1Pos + k] = interpolate(x0, x1, x2, x3, t);\n }\n }\n }\n // this._writeFile(wDst2, hSrc, buf1, \"out/buf1.jpg\");\n\n // ===========================================================\n // Pass 2 - interpolate columns\n // buf2 has width and height of dst2\n const buf2 = Buffer.alloc(wDst2 * hDst2 * 4);\n for (let i = 0; i < hDst2; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i&j in dst2 coords\n\n // calculate y in buf1 coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (hSrc-1)/hDst2\n const y = (i * (hSrc - 1)) / hDst2;\n const yPos = Math.floor(y);\n const t = y - yPos;\n const buf1Pos = (yPos * wDst2 + j) * 4;\n const buf2Pos = (i * wDst2 + j) * 4;\n for (let k = 0; k < 4; k++) {\n const kPos = buf1Pos + k;\n const y0 =\n yPos > 0\n ? buf1[kPos - wDst2 * 4]\n : 2 * buf1[kPos] - buf1[kPos + wDst2 * 4];\n const y1 = buf1[kPos];\n const y2 = buf1[kPos + wDst2 * 4];\n const y3 =\n yPos < hSrc - 2\n ? buf1[kPos + wDst2 * 8]\n : 2 * buf1[kPos + wDst2 * 4] - buf1[kPos];\n\n buf2[buf2Pos + k] = interpolate(y0, y1, y2, y3, t);\n }\n }\n }\n // this._writeFile(wDst2, hDst2, buf2, \"out/buf2.jpg\");\n\n // ===========================================================\n // Pass 3 - scale to dst\n const m = wM * hM;\n if (m > 1) {\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n // i&j in dst bounded coords\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n let realColors = 0;\n\n for (let y = 0; y < hM; y++) {\n const yPos = i * hM + y;\n\n for (let x = 0; x < wM; x++) {\n const xPos = j * wM + x;\n const xyPos = (yPos * wDst2 + xPos) * 4;\n const pixelAlpha = buf2[xyPos + 3];\n\n if (pixelAlpha) {\n r += buf2[xyPos];\n g += buf2[xyPos + 1];\n b += buf2[xyPos + 2];\n realColors++;\n }\n\n a += pixelAlpha;\n }\n }\n\n const pos = (i * wDst + j) * 4;\n bufDst[pos] = realColors ? Math.round(r / realColors) : 0;\n bufDst[pos + 1] = realColors ? Math.round(g / realColors) : 0;\n bufDst[pos + 2] = realColors ? Math.round(b / realColors) : 0;\n bufDst[pos + 3] = Math.round(a / m);\n }\n }\n } else {\n // replace dst buffer with buf2\n dst.data = buf2;\n }\n },\n\n bicubicInterpolation(src, dst, options) {\n const interpolateCubic = function (x0, x1, x2, x3, t) {\n const a0 = x3 - x2 - x0 + x1;\n const a1 = x0 - x1 - a0;\n const a2 = x2 - x0;\n const a3 = x1;\n return Math.max(\n 0,\n Math.min(255, a0 * (t * t * t) + a1 * (t * t) + a2 * t + a3)\n );\n };\n\n return this._interpolate2D(src, dst, options, interpolateCubic);\n },\n\n hermiteInterpolation(src, dst, options) {\n const interpolateHermite = function (x0, x1, x2, x3, t) {\n const c0 = x1;\n const c1 = 0.5 * (x2 - x0);\n const c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3;\n const c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2);\n return Math.max(\n 0,\n Math.min(255, Math.round(((c3 * t + c2) * t + c1) * t + c0))\n );\n };\n\n return this._interpolate2D(src, dst, options, interpolateHermite);\n },\n\n bezierInterpolation(src, dst, options) {\n // between 2 points y(n), y(n+1), use next points out, y(n-1), y(n+2)\n // to predict control points (a & b) to be placed at n+0.5\n // ya(n) = y(n) + (y(n+1)-y(n-1))/4\n // yb(n) = y(n+1) - (y(n+2)-y(n))/4\n // then use std bezier to interpolate [n,n+1)\n // y(n+t) = y(n)*(1-t)^3 + 3 * ya(n)*(1-t)^2*t + 3 * yb(n)*(1-t)*t^2 + y(n+1)*t^3\n // note the 3* factor for the two control points\n // for edge cases, can choose:\n // y(-1) = y(0) - 2*(y(1)-y(0))\n // y(w) = y(w-1) + 2*(y(w-1)-y(w-2))\n // but can go with y(-1) = y(0) and y(w) = y(w-1)\n const interpolateBezier = function (x0, x1, x2, x3, t) {\n // x1, x2 are the knots, use x0 and x3 to calculate control points\n const cp1 = x1 + (x2 - x0) / 4;\n const cp2 = x2 - (x3 - x1) / 4;\n const nt = 1 - t;\n const c0 = x1 * nt * nt * nt;\n const c1 = 3 * cp1 * nt * nt * t;\n const c2 = 3 * cp2 * nt * t * t;\n const c3 = x2 * t * t * t;\n return Math.max(0, Math.min(255, Math.round(c0 + c1 + c2 + c3)));\n };\n\n return this._interpolate2D(src, dst, options, interpolateBezier);\n },\n};\n\nexport default operations;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,UAAU,GAAG;EACjBC,eAAe,CAACC,GAAG,EAAEC,GAAG,EAAE;IACxB,MAAMC,IAAI,GAAGF,GAAG,CAACG,KAAK;IACtB,MAAMC,IAAI,GAAGJ,GAAG,CAACK,MAAM;IAEvB,MAAMC,IAAI,GAAGL,GAAG,CAACE,KAAK;IACtB,MAAMI,IAAI,GAAGN,GAAG,CAACI,MAAM;IAEvB,MAAMG,MAAM,GAAGR,GAAG,CAACS,IAAI;IACvB,MAAMC,MAAM,GAAGT,GAAG,CAACQ,IAAI;IAEvB,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGJ,IAAI,EAAEI,CAAC,EAAE,EAAE;MAC7B,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGN,IAAI,EAAEM,CAAC,EAAE,EAAE;QAC7B,IAAIC,MAAM,GAAG,CAACF,CAAC,GAAGL,IAAI,GAAGM,CAAC,IAAI,CAAC;QAE/B,MAAME,IAAI,GAAGC,IAAI,CAACC,KAAK,CAAEL,CAAC,GAAGP,IAAI,GAAIG,IAAI,CAAC;QAC1C,MAAMU,IAAI,GAAGF,IAAI,CAACC,KAAK,CAAEJ,CAAC,GAAGV,IAAI,GAAII,IAAI,CAAC;QAC1C,IAAIY,MAAM,GAAG,CAACJ,IAAI,GAAGZ,IAAI,GAAGe,IAAI,IAAI,CAAC;QAErCP,MAAM,CAACG,MAAM,EAAE,CAAC,GAAGL,MAAM,CAACU,MAAM,E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C4B,GAAG,CAAC,CAAC,EAAE5B,IAAI,CAACuB,GAAG,CAAC,GAAG,EAAEvB,IAAI,CAACW,KAAK,CAACwD,EAAE,GAAGC,EAAE,GAAGC,EAAE,GAAGC,EAAE,CAAC,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,IAAI,CAAC7C,cAAc,CAACxC,GAAG,EAAEC,GAAG,EAAEwC,OAAO,EAAE8C,iBAAiB,CAAC;EAClE;AACF,CAAC;AAED,eAAezF,UAAU"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-resize/index.d.ts b/project starter code/node_modules/@jimp/plugin-resize/index.d.ts index 24349ad2..58b3cdcb 100644 --- a/project starter code/node_modules/@jimp/plugin-resize/index.d.ts +++ b/project starter code/node_modules/@jimp/plugin-resize/index.d.ts @@ -1,4 +1,4 @@ -import { ImageCallback } from '@jimp/core'; +import { ImageCallback } from "@jimp/core"; interface ResizeClass { resize(w: number, h: number, cb?: ImageCallback): this; @@ -8,14 +8,14 @@ interface ResizeClass { interface Resize { constants: { // resize methods - RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor'; - RESIZE_BILINEAR: 'bilinearInterpolation'; - RESIZE_BICUBIC: 'bicubicInterpolation'; - RESIZE_HERMITE: 'hermiteInterpolation'; - RESIZE_BEZIER: 'bezierInterpolation'; - } + RESIZE_NEAREST_NEIGHBOR: "nearestNeighbor"; + RESIZE_BILINEAR: "bilinearInterpolation"; + RESIZE_BICUBIC: "bicubicInterpolation"; + RESIZE_HERMITE: "hermiteInterpolation"; + RESIZE_BEZIER: "bezierInterpolation"; + }; - class: ResizeClass + class: ResizeClass; } -export default function(): Resize; +export default function (): Resize; diff --git a/project starter code/node_modules/@jimp/plugin-resize/package.json b/project starter code/node_modules/@jimp/plugin-resize/package.json index c34c3cad..1e955a96 100644 --- a/project starter code/node_modules/@jimp/plugin-resize/package.json +++ b/project starter code/node_modules/@jimp/plugin-resize/package.json @@ -1,12 +1,13 @@ { "name": "@jimp/plugin-resize", - "version": "0.16.2", + "version": "0.22.12", "description": "Resize an image.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js", "test:watch": "npm run test -- --reporter min --watch", "test:coverage": "nyc npm run test", "build": "npm run build:node:production && npm run build:module", @@ -20,18 +21,17 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" }, "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/test-utils": "^0.16.2" + "@jimp/custom": "^0.22.12", + "@jimp/test-utils": "^0.22.12" }, "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/plugin-resize/src/index.js b/project starter code/node_modules/@jimp/plugin-resize/src/index.js index fb6e05ab..5b269d54 100644 --- a/project starter code/node_modules/@jimp/plugin-resize/src/index.js +++ b/project starter code/node_modules/@jimp/plugin-resize/src/index.js @@ -1,15 +1,15 @@ -import { throwError, isNodePattern } from '@jimp/utils'; +import { throwError, isNodePattern } from "@jimp/utils"; -import Resize from './modules/resize'; -import Resize2 from './modules/resize2'; +import Resize from "./modules/resize"; +import Resize2 from "./modules/resize2"; export default () => ({ constants: { - RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor', - RESIZE_BILINEAR: 'bilinearInterpolation', - RESIZE_BICUBIC: 'bicubicInterpolation', - RESIZE_HERMITE: 'hermiteInterpolation', - RESIZE_BEZIER: 'bezierInterpolation' + RESIZE_NEAREST_NEIGHBOR: "nearestNeighbor", + RESIZE_BILINEAR: "bilinearInterpolation", + RESIZE_BICUBIC: "bicubicInterpolation", + RESIZE_HERMITE: "hermiteInterpolation", + RESIZE_BEZIER: "bezierInterpolation", }, class: { @@ -22,17 +22,17 @@ export default () => ({ * @returns {Jimp} this for chaining of methods */ resize(w, h, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return throwError.call(this, 'w and h must be numbers', cb); + if (typeof w !== "number" || typeof h !== "number") { + return throwError.call(this, "w and h must be numbers", cb); } - if (typeof mode === 'function' && typeof cb === 'undefined') { + if (typeof mode === "function" && typeof cb === "undefined") { cb = mode; mode = null; } if (w === this.constructor.AUTO && h === this.constructor.AUTO) { - return throwError.call(this, 'w and h cannot both be set to auto', cb); + return throwError.call(this, "w and h cannot both be set to auto", cb); } if (w === this.constructor.AUTO) { @@ -44,18 +44,18 @@ export default () => ({ } if (w < 0 || h < 0) { - return throwError.call(this, 'w and h must be positive numbers', cb); + return throwError.call(this, "w and h must be positive numbers", cb); } // round inputs - w = Math.round(w); - h = Math.round(h); + w = Math.round(w) || 1; + h = Math.round(h) || 1; - if (typeof Resize2[mode] === 'function') { + if (typeof Resize2[mode] === "function") { const dst = { data: Buffer.alloc(w * h * 4), width: w, - height: h + height: h, }; Resize2[mode](this.bitmap, dst); this.bitmap = dst; @@ -68,7 +68,7 @@ export default () => ({ h, true, true, - buffer => { + (buffer) => { image.bitmap.data = Buffer.from(buffer); image.bitmap.width = w; image.bitmap.height = h; @@ -82,6 +82,6 @@ export default () => ({ } return this; - } - } + }, + }, }); diff --git a/project starter code/node_modules/@jimp/plugin-resize/src/modules/resize.js b/project starter code/node_modules/@jimp/plugin-resize/src/modules/resize.js index 3e6de412..9fea5ed2 100644 --- a/project starter code/node_modules/@jimp/plugin-resize/src/modules/resize.js +++ b/project starter code/node_modules/@jimp/plugin-resize/src/modules/resize.js @@ -17,7 +17,7 @@ function Resize( this.colorChannels = blendAlpha ? 4 : 3; this.interpolationPass = Boolean(interpolationPass); this.resizeCallback = - typeof resizeCallback === 'function' ? resizeCallback : function() {}; + typeof resizeCallback === "function" ? resizeCallback : function () {}; this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels; this.originalWidthMultipliedByChannels = @@ -31,7 +31,7 @@ function Resize( this.initialize(); } -Resize.prototype.initialize = function() { +Resize.prototype.initialize = function () { // Perform some checks: if ( this.widthOriginal > 0 && @@ -41,11 +41,11 @@ Resize.prototype.initialize = function() { ) { this.configurePasses(); } else { - throw new Error('Invalid settings specified for the resizer.'); + throw new Error("Invalid settings specified for the resizer."); } }; -Resize.prototype.configurePasses = function() { +Resize.prototype.configurePasses = function () { if (this.widthOriginal === this.targetWidth) { // Bypass the width resizer pass: this.resizeWidth = this.bypassResizer; @@ -82,7 +82,7 @@ Resize.prototype.configurePasses = function() { } }; -Resize.prototype._resizeWidthInterpolatedRGBChannels = function( +Resize.prototype._resizeWidthInterpolatedRGBChannels = function ( buffer, fourthChannel ) { @@ -178,7 +178,7 @@ Resize.prototype._resizeWidthInterpolatedRGBChannels = function( return outputBuffer; }; -Resize.prototype._resizeWidthRGBChannels = function(buffer, fourthChannel) { +Resize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) { const channelsNum = fourthChannel ? 4 : 3; const ratioWeight = this.ratioWeightWidthPass; const ratioWeightDivisor = 1 / ratioWeight; @@ -275,7 +275,7 @@ Resize.prototype._resizeWidthRGBChannels = function(buffer, fourthChannel) { return outputBuffer; }; -Resize.prototype._resizeHeightRGBChannels = function(buffer, fourthChannel) { +Resize.prototype._resizeHeightRGBChannels = function (buffer, fourthChannel) { const ratioWeight = this.ratioWeightHeightPass; const ratioWeightDivisor = 1 / ratioWeight; const output = this.outputHeightWorkBench; @@ -380,23 +380,23 @@ Resize.prototype._resizeHeightRGBChannels = function(buffer, fourthChannel) { return outputBuffer; }; -Resize.prototype.resizeWidthInterpolatedRGB = function(buffer) { +Resize.prototype.resizeWidthInterpolatedRGB = function (buffer) { return this._resizeWidthInterpolatedRGBChannels(buffer, false); }; -Resize.prototype.resizeWidthInterpolatedRGBA = function(buffer) { +Resize.prototype.resizeWidthInterpolatedRGBA = function (buffer) { return this._resizeWidthInterpolatedRGBChannels(buffer, true); }; -Resize.prototype.resizeWidthRGB = function(buffer) { +Resize.prototype.resizeWidthRGB = function (buffer) { return this._resizeWidthRGBChannels(buffer, false); }; -Resize.prototype.resizeWidthRGBA = function(buffer) { +Resize.prototype.resizeWidthRGBA = function (buffer) { return this._resizeWidthRGBChannels(buffer, true); }; -Resize.prototype.resizeHeightInterpolated = function(buffer) { +Resize.prototype.resizeHeightInterpolated = function (buffer) { const ratioWeight = this.ratioWeightHeightPass; const outputBuffer = this.heightBuffer; @@ -467,24 +467,24 @@ Resize.prototype.resizeHeightInterpolated = function(buffer) { return outputBuffer; }; -Resize.prototype.resizeHeightRGB = function(buffer) { +Resize.prototype.resizeHeightRGB = function (buffer) { return this._resizeHeightRGBChannels(buffer, false); }; -Resize.prototype.resizeHeightRGBA = function(buffer) { +Resize.prototype.resizeHeightRGBA = function (buffer) { return this._resizeHeightRGBChannels(buffer, true); }; -Resize.prototype.resize = function(buffer) { +Resize.prototype.resize = function (buffer) { this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer))); }; -Resize.prototype.bypassResizer = function(buffer) { +Resize.prototype.bypassResizer = function (buffer) { // Just return the buffer passed: return buffer; }; -Resize.prototype.initializeFirstPassBuffers = function(BILINEARAlgo) { +Resize.prototype.initializeFirstPassBuffers = function (BILINEARAlgo) { // Initialize the internal width pass buffers: this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize); @@ -501,7 +501,7 @@ Resize.prototype.initializeFirstPassBuffers = function(BILINEARAlgo) { } }; -Resize.prototype.initializeSecondPassBuffers = function(BILINEARAlgo) { +Resize.prototype.initializeSecondPassBuffers = function (BILINEARAlgo) { // Initialize the internal height pass buffers: this.heightBuffer = this.generateUint8Buffer(this.finalResultSize); @@ -518,7 +518,7 @@ Resize.prototype.initializeSecondPassBuffers = function(BILINEARAlgo) { } }; -Resize.prototype.generateFloatBuffer = function(bufferLength) { +Resize.prototype.generateFloatBuffer = function (bufferLength) { // Generate a float32 typed array buffer: try { return new Float32Array(bufferLength); @@ -527,7 +527,7 @@ Resize.prototype.generateFloatBuffer = function(bufferLength) { } }; -Resize.prototype.generateFloat64Buffer = function(bufferLength) { +Resize.prototype.generateFloat64Buffer = function (bufferLength) { // Generate a float64 typed array buffer: try { return new Float64Array(bufferLength); @@ -536,7 +536,7 @@ Resize.prototype.generateFloat64Buffer = function(bufferLength) { } }; -Resize.prototype.generateUint8Buffer = function(bufferLength) { +Resize.prototype.generateUint8Buffer = function (bufferLength) { // Generate a uint8 typed array buffer: try { return new Uint8Array(bufferLength); @@ -545,4 +545,4 @@ Resize.prototype.generateUint8Buffer = function(bufferLength) { } }; -module.exports = Resize; +export default Resize; diff --git a/project starter code/node_modules/@jimp/plugin-resize/src/modules/resize2.js b/project starter code/node_modules/@jimp/plugin-resize/src/modules/resize2.js index 1e54df8c..3774144d 100644 --- a/project starter code/node_modules/@jimp/plugin-resize/src/modules/resize2.js +++ b/project starter code/node_modules/@jimp/plugin-resize/src/modules/resize2.js @@ -20,7 +20,7 @@ * THE SOFTWARE. */ -module.exports = { +const operations = { nearestNeighbor(src, dst) { const wSrc = src.width; const hSrc = src.height; @@ -57,7 +57,7 @@ module.exports = { const bufSrc = src.data; const bufDst = dst.data; - const interpolate = function(k, kMin, vMin, kMax, vMax) { + const interpolate = function (k, kMin, vMin, kMax, vMax) { // special case - k is integer if (kMin === kMax) { return vMin; @@ -66,7 +66,7 @@ module.exports = { return Math.round((k - kMin) * vMax + (kMax - k) * vMin); }; - const assign = function(pos, offset, x, xMin, xMax, y, yMin, yMax) { + const assign = function (pos, offset, x, xMin, xMax, y, yMin, yMax) { let posMin = (yMin * wSrc + xMin) * 4 + offset; let posMax = (yMin * wSrc + xMax) * 4 + offset; const vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]); @@ -235,7 +235,7 @@ module.exports = { }, bicubicInterpolation(src, dst, options) { - const interpolateCubic = function(x0, x1, x2, x3, t) { + const interpolateCubic = function (x0, x1, x2, x3, t) { const a0 = x3 - x2 - x0 + x1; const a1 = x0 - x1 - a0; const a2 = x2 - x0; @@ -250,7 +250,7 @@ module.exports = { }, hermiteInterpolation(src, dst, options) { - const interpolateHermite = function(x0, x1, x2, x3, t) { + const interpolateHermite = function (x0, x1, x2, x3, t) { const c0 = x1; const c1 = 0.5 * (x2 - x0); const c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3; @@ -276,7 +276,7 @@ module.exports = { // y(-1) = y(0) - 2*(y(1)-y(0)) // y(w) = y(w-1) + 2*(y(w-1)-y(w-2)) // but can go with y(-1) = y(0) and y(w) = y(w-1) - const interpolateBezier = function(x0, x1, x2, x3, t) { + const interpolateBezier = function (x0, x1, x2, x3, t) { // x1, x2 are the knots, use x0 and x3 to calculate control points const cp1 = x1 + (x2 - x0) / 4; const cp2 = x2 - (x3 - x1) / 4; @@ -289,5 +289,7 @@ module.exports = { }; return this._interpolate2D(src, dst, options, interpolateBezier); - } + }, }; + +export default operations; diff --git a/project starter code/node_modules/@jimp/plugin-resize/test/resize.test.js b/project starter code/node_modules/@jimp/plugin-resize/test/resize.test.js index 93f58706..5a6d1c40 100644 --- a/project starter code/node_modules/@jimp/plugin-resize/test/resize.test.js +++ b/project starter code/node_modules/@jimp/plugin-resize/test/resize.test.js @@ -1,586 +1,275 @@ -import { Jimp, mkJGD, hashForEach } from '@jimp/test-utils'; -import configure from '@jimp/custom'; +import { Jimp, mkJGD, hashForEach } from "@jimp/test-utils"; +import configure from "@jimp/custom"; -import resize from '../src'; +import resize from "../src"; +import { expectToBeJGD } from "@jimp/test-utils/src"; const jimp = configure({ plugins: [resize] }, Jimp); -describe('Resize images', () => { +describe("Resize images", () => { const testImages = [ { - title: 'max contrast 8x8', + title: "max contrast 8x8", src: jimp.read( mkJGD( - '■■■■□□□□', - '■■■■□□□□', - '■■■■□□□□', - '■■■■□□□□', - '□□□□■■■■', - '□□□□■■■■', - '□□□□■■■■', - '□□□□■■■■' + "■■■■□□□□", + "■■■■□□□□", + "■■■■□□□□", + "■■■■□□□□", + "□□□□■■■■", + "□□□□■■■■", + "□□□□■■■■", + "□□□□■■■■" ) ), results: { - 'default 4x4': mkJGD('■■□□', '■■□□', '□□■■', '□□■■'), - 'NEAREST_NEIGHBOR 4x4': mkJGD('■■□□', '■■□□', '□□■■', '□□■■'), - 'BILINEAR 4x4': mkJGD('■■□□', '■■□□', '□□■■', '□□■■'), - 'BICUBIC 4x4': { + "default 4x4": mkJGD("■■□□", "■■□□", "□□■■", "□□■■"), + "NEAREST_NEIGHBOR 4x4": mkJGD("■■□□", "■■□□", "□□■■", "□□■■"), + "BILINEAR 4x4": mkJGD("■■□□", "■■□□", "□□■■", "□□■■"), + "BICUBIC 4x4": { width: 4, height: 4, data: [ + 0x000000ff, 0x000000ff, 0xbfbfbfff, 0xffffffff, 0x000000ff, + 0x000000ff, 0xbfbfbfff, 0xffffffff, 0xbfbfbfff, 0xbfbfbfff, + 0x5f5f5fff, 0x404040ff, 0xffffffff, 0xffffffff, 0x404040ff, 0x000000ff, - 0x000000ff, - 0xbfbfbfff, - 0xffffffff, - 0x000000ff, - 0x000000ff, - 0xbfbfbfff, - 0xffffffff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x5f5f5fff, - 0x404040ff, - 0xffffffff, - 0xffffffff, - 0x404040ff, - 0x000000ff - ] + ], }, - 'HERMITE 4x4': { + "HERMITE 4x4": { width: 4, height: 4, data: [ + 0x000000ff, 0x000000ff, 0xc0c0c0ff, 0xffffffff, 0x000000ff, + 0x000000ff, 0xc0c0c0ff, 0xffffffff, 0xc0c0c0ff, 0xc0c0c0ff, + 0x606060ff, 0x404040ff, 0xffffffff, 0xffffffff, 0x404040ff, 0x000000ff, - 0x000000ff, - 0xc0c0c0ff, - 0xffffffff, - 0x000000ff, - 0x000000ff, - 0xc0c0c0ff, - 0xffffffff, - 0xc0c0c0ff, - 0xc0c0c0ff, - 0x606060ff, - 0x404040ff, - 0xffffffff, - 0xffffffff, - 0x404040ff, - 0x000000ff - ] + ], }, - 'BEZIER 4x4': { + "BEZIER 4x4": { width: 4, height: 4, data: [ + 0x000000ff, 0x000000ff, 0xc0c0c0ff, 0xffffffff, 0x000000ff, + 0x000000ff, 0xc0c0c0ff, 0xffffffff, 0xc0c0c0ff, 0xc0c0c0ff, + 0x606060ff, 0x404040ff, 0xffffffff, 0xffffffff, 0x404040ff, 0x000000ff, - 0x000000ff, - 0xc0c0c0ff, - 0xffffffff, - 0x000000ff, - 0x000000ff, - 0xc0c0c0ff, - 0xffffffff, - 0xc0c0c0ff, - 0xc0c0c0ff, - 0x606060ff, - 0x404040ff, - 0xffffffff, - 0xffffffff, - 0x404040ff, - 0x000000ff - ] + ], }, - 'default 5x2': mkJGD('■■▦□□', '□□▦■■'), - 'NEAREST_NEIGHBOR 5x2': mkJGD('■■■□□', '□□□■■'), - 'BILINEAR 5x2': mkJGD('■■3□□', '□□C■■'), - 'BICUBIC 5x2': { + "default 5x2": mkJGD("■■▦□□", "□□▦■■"), + "NEAREST_NEIGHBOR 5x2": mkJGD("■■■□□", "□□□■■"), + "BILINEAR 5x2": mkJGD("■■3□□", "□□C■■"), + "BICUBIC 5x2": { width: 5, height: 2, data: [ - 0x000000ff, - 0x000000ff, - 0x000000ff, - 0xffffffff, - 0xffffffff, - 0xdfdfdfff, - 0xdfdfdfff, - 0xdfdfdfff, - 0x202020ff, - 0x202020ff - ] + 0x000000ff, 0x000000ff, 0x000000ff, 0xffffffff, 0xffffffff, + 0xdfdfdfff, 0xdfdfdfff, 0xdfdfdfff, 0x202020ff, 0x202020ff, + ], }, - 'HERMITE 5x2': { + "HERMITE 5x2": { width: 5, height: 2, data: [ - 0x000000ff, - 0x000000ff, - 0x000000ff, - 0xffffffff, - 0xffffffff, - 0xdfdfdfff, - 0xdfdfdfff, - 0xdfdfdfff, - 0x202020ff, - 0x202020ff - ] + 0x000000ff, 0x000000ff, 0x000000ff, 0xffffffff, 0xffffffff, + 0xdfdfdfff, 0xdfdfdfff, 0xdfdfdfff, 0x202020ff, 0x202020ff, + ], }, - 'BEZIER 5x2': { + "BEZIER 5x2": { width: 5, height: 2, data: [ - 0x000000ff, - 0x000000ff, - 0x000000ff, - 0xffffffff, - 0xffffffff, - 0xdfdfdfff, - 0xdfdfdfff, - 0xdfdfdfff, - 0x202020ff, - 0x202020ff - ] - } - } + 0x000000ff, 0x000000ff, 0x000000ff, 0xffffffff, 0xffffffff, + 0xdfdfdfff, 0xdfdfdfff, 0xdfdfdfff, 0x202020ff, 0x202020ff, + ], + }, + }, }, /**********************************************************************/ { - title: 'max contrast 12x12 with dots', + title: "max contrast 12x12 with dots", src: jimp.read( mkJGD( - '■■■■■■□□□□□□', - '■■■■■■□□□□□□', - '■■■□■■□□■□□□', - '■■■■■■□□□□□□', - '■■■■■■□□□□□□', - '■■■■■■□□□□□□', - '□□□□□□■■■■■■', - '□□□□□□■■■■■■', - '□□□□□□■■■■■■', - '□□□■□□■■□■■■', - '□□□□□□■■■■■■', - '□□□□□□■■■■■■' + "■■■■■■□□□□□□", + "■■■■■■□□□□□□", + "■■■□■■□□■□□□", + "■■■■■■□□□□□□", + "■■■■■■□□□□□□", + "■■■■■■□□□□□□", + "□□□□□□■■■■■■", + "□□□□□□■■■■■■", + "□□□□□□■■■■■■", + "□□□■□□■■□■■■", + "□□□□□□■■■■■■", + "□□□□□□■■■■■■" ) ), results: { - 'default 6x6': mkJGD( - '■■■□□□', - '■▩■□▥□', - '■■■□□□', - '□□□■■■', - '□▥□■▩■', - '□□□■■■' + "default 6x6": mkJGD( + "■■■□□□", + "■▩■□▥□", + "■■■□□□", + "□□□■■■", + "□▥□■▩■", + "□□□■■■" ), - 'NEAREST_NEIGHBOR 6x6': mkJGD( - '■■■□□□', - '■■■□■□', - '■■■□□□', - '□□□■■■', - '□□□■■■', - '□□□■■■' + "NEAREST_NEIGHBOR 6x6": mkJGD( + "■■■□□□", + "■■■□■□", + "■■■□□□", + "□□□■■■", + "□□□■■■", + "□□□■■■" ), - 'BILINEAR 6x6': mkJGD( - '■■■□□□', - '■■■□■□', - '■■■□□□', - '□□□■■■', - '□□□■■■', - '□□□■■■' + "BILINEAR 6x6": mkJGD( + "■■■□□□", + "■■■□■□", + "■■■□□□", + "□□□■■■", + "□□□■■■", + "□□□■■■" ), - 'BICUBIC 6x6': { + "BICUBIC 6x6": { width: 6, height: 6, data: [ - 0x000000ff, - 0x000000ff, - 0x000000ff, - 0xbfbfbfff, - 0xffffffff, - 0xffffffff, - 0x000000ff, - 0x474747ff, - 0x202020ff, - 0xbfbfbfff, - 0x979797ff, - 0xffffffff, - 0x000000ff, - 0x000000ff, - 0x000000ff, - 0xbfbfbfff, - 0xffffffff, - 0xffffffff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x5f5f5fff, - 0x404040ff, - 0x404040ff, - 0xffffffff, - 0xeeeeeeff, - 0xf7f7f7ff, - 0x404040ff, - 0x181818ff, - 0x000000ff, - 0xffffffff, - 0xc9c9c9ff, - 0xe6e6e6ff, - 0x404040ff, - 0x4e4e4eff, - 0x000000ff - ] + 0x000000ff, 0x000000ff, 0x000000ff, 0xbfbfbfff, 0xffffffff, + 0xffffffff, 0x000000ff, 0x474747ff, 0x202020ff, 0xbfbfbfff, + 0x979797ff, 0xffffffff, 0x000000ff, 0x000000ff, 0x000000ff, + 0xbfbfbfff, 0xffffffff, 0xffffffff, 0xbfbfbfff, 0xbfbfbfff, + 0xbfbfbfff, 0x5f5f5fff, 0x404040ff, 0x404040ff, 0xffffffff, + 0xeeeeeeff, 0xf7f7f7ff, 0x404040ff, 0x181818ff, 0x000000ff, + 0xffffffff, 0xc9c9c9ff, 0xe6e6e6ff, 0x404040ff, 0x4e4e4eff, + 0x000000ff, + ], }, - 'HERMITE 6x6': { + "HERMITE 6x6": { width: 6, height: 6, data: [ - 0x000000ff, - 0x000000ff, - 0x000000ff, - 0xc0c0c0ff, - 0xffffffff, - 0xffffffff, - 0x000000ff, - 0x404040ff, - 0x191919ff, - 0xc0c0c0ff, - 0xa6a6a6ff, - 0xffffffff, - 0x000000ff, - 0x000000ff, - 0x000000ff, - 0xc0c0c0ff, - 0xffffffff, - 0xffffffff, - 0xc0c0c0ff, - 0xc0c0c0ff, - 0xc0c0c0ff, - 0x606060ff, - 0x404040ff, - 0x404040ff, - 0xffffffff, - 0xf3f3f3ff, - 0xfafafaff, - 0x404040ff, - 0x111111ff, - 0x000000ff, - 0xffffffff, - 0xcbcbcbff, - 0xebebebff, - 0x404040ff, - 0x484848ff, - 0x000000ff - ] + 0x000000ff, 0x000000ff, 0x000000ff, 0xc0c0c0ff, 0xffffffff, + 0xffffffff, 0x000000ff, 0x404040ff, 0x191919ff, 0xc0c0c0ff, + 0xa6a6a6ff, 0xffffffff, 0x000000ff, 0x000000ff, 0x000000ff, + 0xc0c0c0ff, 0xffffffff, 0xffffffff, 0xc0c0c0ff, 0xc0c0c0ff, + 0xc0c0c0ff, 0x606060ff, 0x404040ff, 0x404040ff, 0xffffffff, + 0xf3f3f3ff, 0xfafafaff, 0x404040ff, 0x111111ff, 0x000000ff, + 0xffffffff, 0xcbcbcbff, 0xebebebff, 0x404040ff, 0x484848ff, + 0x000000ff, + ], }, - 'BEZIER 6x6': { + "BEZIER 6x6": { width: 6, height: 6, data: [ - 0x000000ff, - 0x000000ff, - 0x000000ff, - 0xc0c0c0ff, - 0xffffffff, - 0xffffffff, - 0x000000ff, - 0x444444ff, - 0x1d1d1dff, - 0xc0c0c0ff, - 0x9f9f9fff, - 0xffffffff, - 0x000000ff, - 0x000000ff, - 0x000000ff, - 0xc0c0c0ff, - 0xffffffff, - 0xffffffff, - 0xc0c0c0ff, - 0xc0c0c0ff, - 0xc0c0c0ff, - 0x606060ff, - 0x404040ff, - 0x404040ff, - 0xffffffff, - 0xf0f0f0ff, - 0xf9f9f9ff, - 0x404040ff, - 0x151515ff, - 0x000000ff, - 0xffffffff, - 0xcacacaff, - 0xe9e9e9ff, - 0x404040ff, - 0x4b4b4bff, - 0x000000ff - ] - } - } + 0x000000ff, 0x000000ff, 0x000000ff, 0xc0c0c0ff, 0xffffffff, + 0xffffffff, 0x000000ff, 0x444444ff, 0x1d1d1dff, 0xc0c0c0ff, + 0x9f9f9fff, 0xffffffff, 0x000000ff, 0x000000ff, 0x000000ff, + 0xc0c0c0ff, 0xffffffff, 0xffffffff, 0xc0c0c0ff, 0xc0c0c0ff, + 0xc0c0c0ff, 0x606060ff, 0x404040ff, 0x404040ff, 0xffffffff, + 0xf0f0f0ff, 0xf9f9f9ff, 0x404040ff, 0x151515ff, 0x000000ff, + 0xffffffff, 0xcacacaff, 0xe9e9e9ff, 0x404040ff, 0x4b4b4bff, + 0x000000ff, + ], + }, + }, }, /**********************************************************************/ { - title: 'mutch contrast 4x4', - src: jimp.read(mkJGD('▩▩▥▥', '▩▩▥▥', '▥▥▩▩', '▥▥▩▩')), + title: "mutch contrast 4x4", + src: jimp.read(mkJGD("▩▩▥▥", "▩▩▥▥", "▥▥▩▩", "▥▥▩▩")), results: { - 'default 6x6': { + "default 6x6": { width: 6, height: 6, data: [ - 0x404040ff, - 0x404040ff, - 0x404040ff, - 0x959595ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x404040ff, - 0x404040ff, - 0x404040ff, - 0x959595ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x404040ff, - 0x404040ff, - 0x404040ff, - 0x959595ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x959595ff, - 0x959595ff, - 0x959595ff, - 0x787878ff, - 0x6a6a6aff, - 0x6a6a6aff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x6a6a6aff, - 0x404040ff, - 0x404040ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x6a6a6aff, - 0x404040ff, - 0x404040ff - ] + 0x404040ff, 0x404040ff, 0x404040ff, 0x959595ff, 0xbfbfbfff, + 0xbfbfbfff, 0x404040ff, 0x404040ff, 0x404040ff, 0x959595ff, + 0xbfbfbfff, 0xbfbfbfff, 0x404040ff, 0x404040ff, 0x404040ff, + 0x959595ff, 0xbfbfbfff, 0xbfbfbfff, 0x959595ff, 0x959595ff, + 0x959595ff, 0x787878ff, 0x6a6a6aff, 0x6a6a6aff, 0xbfbfbfff, + 0xbfbfbfff, 0xbfbfbfff, 0x6a6a6aff, 0x404040ff, 0x404040ff, + 0xbfbfbfff, 0xbfbfbfff, 0xbfbfbfff, 0x6a6a6aff, 0x404040ff, + 0x404040ff, + ], }, - 'NEAREST_NEIGHBOR 6x6': { + "NEAREST_NEIGHBOR 6x6": { width: 6, height: 6, data: [ - 0x404040ff, - 0x404040ff, - 0x404040ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x404040ff, - 0x404040ff, - 0x404040ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x404040ff, - 0x404040ff, - 0x404040ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x404040ff, - 0x404040ff, - 0x404040ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x404040ff, - 0x404040ff, - 0x404040ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x404040ff, - 0x404040ff, - 0x404040ff - ] + 0x404040ff, 0x404040ff, 0x404040ff, 0xbfbfbfff, 0xbfbfbfff, + 0xbfbfbfff, 0x404040ff, 0x404040ff, 0x404040ff, 0xbfbfbfff, + 0xbfbfbfff, 0xbfbfbfff, 0x404040ff, 0x404040ff, 0x404040ff, + 0xbfbfbfff, 0xbfbfbfff, 0xbfbfbfff, 0xbfbfbfff, 0xbfbfbfff, + 0xbfbfbfff, 0x404040ff, 0x404040ff, 0x404040ff, 0xbfbfbfff, + 0xbfbfbfff, 0xbfbfbfff, 0x404040ff, 0x404040ff, 0x404040ff, + 0xbfbfbfff, 0xbfbfbfff, 0xbfbfbfff, 0x404040ff, 0x404040ff, + 0x404040ff, + ], }, - 'BILINEAR 6x6': { + "BILINEAR 6x6": { width: 6, height: 6, data: [ - 0x404040ff, - 0x404040ff, - 0x6a6a6aff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x404040ff, - 0x404040ff, - 0x6a6a6aff, - 0xbfbfbfff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x6a6a6aff, - 0x6a6a6aff, - 0x787878ff, - 0x959595ff, - 0x959595ff, - 0x959595ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x959595ff, - 0x404040ff, - 0x404040ff, - 0x404040ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x959595ff, - 0x404040ff, - 0x404040ff, - 0x404040ff, - 0xbfbfbfff, - 0xbfbfbfff, - 0x959595ff, - 0x404040ff, - 0x404040ff, - 0x404040ff - ] + 0x404040ff, 0x404040ff, 0x6a6a6aff, 0xbfbfbfff, 0xbfbfbfff, + 0xbfbfbfff, 0x404040ff, 0x404040ff, 0x6a6a6aff, 0xbfbfbfff, + 0xbfbfbfff, 0xbfbfbfff, 0x6a6a6aff, 0x6a6a6aff, 0x787878ff, + 0x959595ff, 0x959595ff, 0x959595ff, 0xbfbfbfff, 0xbfbfbfff, + 0x959595ff, 0x404040ff, 0x404040ff, 0x404040ff, 0xbfbfbfff, + 0xbfbfbfff, 0x959595ff, 0x404040ff, 0x404040ff, 0x404040ff, + 0xbfbfbfff, 0xbfbfbfff, 0x959595ff, 0x404040ff, 0x404040ff, + 0x404040ff, + ], }, - 'BICUBIC 6x6': { + "BICUBIC 6x6": { width: 6, height: 6, data: [ - 0x404040ff, - 0x303030ff, - 0x404040ff, - 0x7f7f7fff, - 0xbfbfbfff, - 0xcececeff, - 0x303030ff, + 0x404040ff, 0x303030ff, 0x404040ff, 0x7f7f7fff, 0xbfbfbfff, + 0xcececeff, 0x303030ff, 0x1c1c1cff, 0x303030ff, 0x7f7f7fff, + 0xcececeff, 0xe1e1e1ff, 0x404040ff, 0x303030ff, 0x404040ff, + 0x7f7f7fff, 0xbfbfbfff, 0xcececeff, 0x7f7f7fff, 0x7f7f7fff, + 0x7f7f7fff, 0x7f7f7fff, 0x7f7f7fff, 0x7f7f7fff, 0xbfbfbfff, + 0xcececeff, 0xbfbfbfff, 0x7f7f7fff, 0x404040ff, 0x303030ff, + 0xcececeff, 0xe1e1e1ff, 0xcececeff, 0x7f7f7fff, 0x303030ff, 0x1c1c1cff, - 0x303030ff, - 0x7f7f7fff, - 0xcececeff, - 0xe1e1e1ff, - 0x404040ff, - 0x303030ff, - 0x404040ff, - 0x7f7f7fff, - 0xbfbfbfff, - 0xcececeff, - 0x7f7f7fff, - 0x7f7f7fff, - 0x7f7f7fff, - 0x7f7f7fff, - 0x7f7f7fff, - 0x7f7f7fff, - 0xbfbfbfff, - 0xcececeff, - 0xbfbfbfff, - 0x7f7f7fff, - 0x404040ff, - 0x303030ff, - 0xcececeff, - 0xe1e1e1ff, - 0xcececeff, - 0x7f7f7fff, - 0x303030ff, - 0x1c1c1cff - ] + ], }, - 'HERMITE 6x6': { + "HERMITE 6x6": { width: 6, height: 6, data: [ - 0x404040ff, - 0x383838ff, - 0x404040ff, - 0x808080ff, - 0xbfbfbfff, - 0xc7c7c7ff, - 0x383838ff, + 0x404040ff, 0x383838ff, 0x404040ff, 0x808080ff, 0xbfbfbfff, + 0xc7c7c7ff, 0x383838ff, 0x2f2f2fff, 0x383838ff, 0x808080ff, + 0xc7c7c7ff, 0xd0d0d0ff, 0x404040ff, 0x383838ff, 0x404040ff, + 0x808080ff, 0xbfbfbfff, 0xc7c7c7ff, 0x808080ff, 0x808080ff, + 0x808080ff, 0x808080ff, 0x808080ff, 0x808080ff, 0xbfbfbfff, + 0xc7c7c7ff, 0xbfbfbfff, 0x808080ff, 0x404040ff, 0x383838ff, + 0xc7c7c7ff, 0xd0d0d0ff, 0xc7c7c7ff, 0x808080ff, 0x383838ff, 0x2f2f2fff, - 0x383838ff, - 0x808080ff, - 0xc7c7c7ff, - 0xd0d0d0ff, - 0x404040ff, - 0x383838ff, - 0x404040ff, - 0x808080ff, - 0xbfbfbfff, - 0xc7c7c7ff, - 0x808080ff, - 0x808080ff, - 0x808080ff, - 0x808080ff, - 0x808080ff, - 0x808080ff, - 0xbfbfbfff, - 0xc7c7c7ff, - 0xbfbfbfff, - 0x808080ff, - 0x404040ff, - 0x383838ff, - 0xc7c7c7ff, - 0xd0d0d0ff, - 0xc7c7c7ff, - 0x808080ff, - 0x383838ff, - 0x2f2f2fff - ] + ], }, - 'BEZIER 6x6': { + "BEZIER 6x6": { width: 6, height: 6, data: [ - 0x404040ff, - 0x343434ff, - 0x404040ff, - 0x808080ff, - 0xbfbfbfff, - 0xcbcbcbff, - 0x343434ff, + 0x404040ff, 0x343434ff, 0x404040ff, 0x808080ff, 0xbfbfbfff, + 0xcbcbcbff, 0x343434ff, 0x262626ff, 0x343434ff, 0x808080ff, + 0xcbcbcbff, 0xd9d9d9ff, 0x404040ff, 0x343434ff, 0x404040ff, + 0x808080ff, 0xbfbfbfff, 0xcbcbcbff, 0x808080ff, 0x808080ff, + 0x808080ff, 0x808080ff, 0x808080ff, 0x808080ff, 0xbfbfbfff, + 0xcbcbcbff, 0xbfbfbfff, 0x808080ff, 0x404040ff, 0x343434ff, + 0xcbcbcbff, 0xd9d9d9ff, 0xcbcbcbff, 0x808080ff, 0x343434ff, 0x262626ff, - 0x343434ff, - 0x808080ff, - 0xcbcbcbff, - 0xd9d9d9ff, - 0x404040ff, - 0x343434ff, - 0x404040ff, - 0x808080ff, - 0xbfbfbfff, - 0xcbcbcbff, - 0x808080ff, - 0x808080ff, - 0x808080ff, - 0x808080ff, - 0x808080ff, - 0x808080ff, - 0xbfbfbfff, - 0xcbcbcbff, - 0xbfbfbfff, - 0x808080ff, - 0x404040ff, - 0x343434ff, - 0xcbcbcbff, - 0xd9d9d9ff, - 0xcbcbcbff, - 0x808080ff, - 0x343434ff, - 0x262626ff - ] - } - } - } + ], + }, + }, + }, ]; - before(done => { - const srcImgs = testImages.map(test => test.src); + before((done) => { + const srcImgs = testImages.map((test) => test.src); Promise.all(srcImgs) - .then(imgsJimp => { + .then((imgsJimp) => { for (let i = 0; i < imgsJimp.length; i++) { testImages[i].src = imgsJimp[i]; } @@ -593,17 +282,16 @@ describe('Resize images', () => { function testEach(test) { describe(test.title, () => { hashForEach(test.results, (expectedTitle, expectedJgd) => { - const mode = Jimp['RESIZE_' + expectedTitle.split(' ')[0]]; + const mode = Jimp["RESIZE_" + expectedTitle.split(" ")[0]]; const size = expectedTitle - .split(' ')[1] - .split('x') - .map(n => parseInt(n, 10)); - it('to ' + expectedTitle, () => { - test.src - .clone() - .resize(size[0], size[1], mode) - .getJGDSync() - .should.be.sameJGD(expectedJgd); + .split(" ")[1] + .split("x") + .map((n) => parseInt(n, 10)); + it("to " + expectedTitle, () => { + expectToBeJGD( + test.src.clone().resize(size[0], size[1], mode).getJGDSync(), + expectedJgd + ); }); }); }); diff --git a/project starter code/node_modules/@jimp/plugin-rotate/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-rotate/CHANGELOG.md index 26394e0f..fff0ee5b 100644 --- a/project starter code/node_modules/@jimp/plugin-rotate/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/plugin-rotate/CHANGELOG.md @@ -1,3 +1,113 @@ +# v0.22.8 (Thu May 11 2023) + +#### 🚀 Enhancement + +- Fix: rotate resize param on multiples of 90 [#1229](https://github.com/jimp-dev/jimp/pull/1229) ([@sjoerd108](https://github.com/sjoerd108)) + +#### Authors: 1 + +- Sjoerd ([@sjoerd108](https://github.com/sjoerd108)) + +--- + +# v0.22.7 (Sat Feb 25 2023) + +:tada: This release contains work from a new contributor! :tada: + +Thank you, MD KHAIRUL ISLAM ([@black-turtle](https://github.com/black-turtle)), for all your work! + +### Release Notes + +#### use matrix rotate, if rotate angle is multiple of 90 degrees ([#1209](https://github.com/jimp-dev/jimp/pull/1209)) + +Fixes a bug where rotating by 90 degrees introduced extra pixels + +--- + +#### 🐛 Bug Fix + +- use matrix rotate, if rotate angle is multiple of 90 degrees [#1209](https://github.com/jimp-dev/jimp/pull/1209) ([@black-turtle](https://github.com/black-turtle)) + +#### Authors: 1 + +- MD KHAIRUL ISLAM ([@black-turtle](https://github.com/black-turtle)) + +--- + +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.22.0 (Mon Feb 06 2023) + +#### 🏠 Internal + +- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Daniel Holmes ([@danielholmes](https://github.com/danielholmes)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.17.6 (Sat Feb 04 2023) + +#### 🐛 Bug Fix + +- fix documentation about rotation direction. [#1062](https://github.com/jimp-dev/jimp/pull/1062) ([@fabb](https://github.com/fabb)) + +#### Authors: 1 + +- [@fabb](https://github.com/fabb) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -12,7 +122,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -20,4 +130,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-rotate/README.md b/project starter code/node_modules/@jimp/plugin-rotate/README.md index 648613df..510fea5c 100644 --- a/project starter code/node_modules/@jimp/plugin-rotate/README.md +++ b/project starter code/node_modules/@jimp/plugin-rotate/README.md @@ -5,19 +5,19 @@

Rotate an image.

-Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately. +Rotates the image counter-clockwise by a number of degrees. By default the width and height of the image will be resized appropriately. ## Usage -- @param {number} deg the number of degrees to rotate the image by +- @param {number} deg the number of degrees to rotate the image by, counter-clockwise - @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.rotate(90); } diff --git a/project starter code/node_modules/@jimp/plugin-rotate/dist/index.js b/project starter code/node_modules/@jimp/plugin-rotate/dist/index.js index c2d2afff..90813a97 100644 --- a/project starter code/node_modules/@jimp/plugin-rotate/dist/index.js +++ b/project starter code/node_modules/@jimp/plugin-rotate/dist/index.js @@ -3,53 +3,127 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - +exports.default = void 0; var _utils = require("@jimp/utils"); +/** + * Rotates an image counter-clockwise by multiple of 90 degrees. NB: 'this' must be a Jimp object. + * + * This function is based on matrix rotation. Check this to get an initial idea how it works: https://stackoverflow.com/a/8664879/10561909 + * + * @param {number} deg the number of degrees to rotate the image by, it should be a multiple of 90 + */ +function matrixRotate(deg) { + if (Math.abs(deg) % 90 !== 0) { + throw new Error("Unsupported matrix rotation degree"); + } + deg %= 360; + if (Math.abs(deg) === 0) { + // no rotation for 0, 360, -360, 720, -720, ... + return; + } + const w = this.bitmap.width; + const h = this.bitmap.height; + + // decide which rotation angle to use + let angle; + switch (deg) { + // 90 degree & -270 degree are same + case 90: + case -270: + angle = 90; + break; + case 180: + case -180: + angle = 180; + break; + case 270: + case -90: + angle = -90; + break; + default: + throw new Error("Unsupported matrix rotation degree"); + } + // After this switch block, angle will be 90, 180 or -90 + + // calculate the new width and height + const nW = angle === 180 ? w : h; + const nH = angle === 180 ? h : w; + const dstBuffer = Buffer.alloc(this.bitmap.data.length); + + // function to translate the x, y coordinate to the index of the pixel in the buffer + function createIdxTranslationFunction(w, h) { + return function (x, y) { + return y * w + x << 2; + }; + } + const srcIdxFunction = createIdxTranslationFunction(w, h); + const dstIdxFunction = createIdxTranslationFunction(nW, nH); + for (let x = 0; x < w; x++) { + for (let y = 0; y < h; y++) { + const srcIdx = srcIdxFunction(x, y); + const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx); + let dstIdx; + switch (angle) { + case 90: + dstIdx = dstIdxFunction(y, w - x - 1); + break; + case -90: + dstIdx = dstIdxFunction(h - y - 1, x); + break; + case 180: + dstIdx = dstIdxFunction(w - x - 1, h - y - 1); + break; + default: + throw new Error("Unsupported matrix rotation angle"); + } + dstBuffer.writeUInt32BE(pixelRGBA, dstIdx); + } + } + this.bitmap.data = dstBuffer; + this.bitmap.width = nW; + this.bitmap.height = nH; +} /** - * Rotates an image clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object. + * Rotates an image counter-clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object. * @param {number} deg the number of degrees to rotate the image by * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed */ function advancedRotate(deg, mode) { deg %= 360; - var rad = deg * Math.PI / 180; - var cosine = Math.cos(rad); - var sine = Math.sin(rad); // the final width and height will change if resize == true - - var w = this.bitmap.width; - var h = this.bitmap.height; - - if (mode === true || typeof mode === 'string') { + const rad = deg * Math.PI / 180; + const cosine = Math.cos(rad); + const sine = Math.sin(rad); + + // the final width and height will change if resize == true + let w = this.bitmap.width; + let h = this.bitmap.height; + if (mode === true || typeof mode === "string") { // resize the image to it maximum dimension and blit the existing image // onto the center so that when it is rotated the image is kept in bounds + // http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle // Plus 1 border pixel to ensure to show all rotated result for some cases. w = Math.ceil(Math.abs(this.bitmap.width * cosine) + Math.abs(this.bitmap.height * sine)) + 1; - h = Math.ceil(Math.abs(this.bitmap.width * sine) + Math.abs(this.bitmap.height * cosine)) + 1; // Ensure destination to have even size to a better result. - + h = Math.ceil(Math.abs(this.bitmap.width * sine) + Math.abs(this.bitmap.height * cosine)) + 1; + // Ensure destination to have even size to a better result. if (w % 2 !== 0) { w++; } - if (h % 2 !== 0) { h++; } - - var c = this.cloneQuiet(); + const c = this.cloneQuiet(); this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { this.bitmap.data.writeUInt32BE(this._background, idx); }); - var max = Math.max(w, h, this.bitmap.width, this.bitmap.height); + const max = Math.max(w, h, this.bitmap.width, this.bitmap.height); this.resize(max, max, mode); this.blit(c, this.bitmap.width / 2 - c.bitmap.width / 2, this.bitmap.height / 2 - c.bitmap.height / 2); } - - var bW = this.bitmap.width; - var bH = this.bitmap.height; - var dstBuffer = Buffer.alloc(this.bitmap.data.length); - + const bW = this.bitmap.width; + const bH = this.bitmap.height; + const dstBuffer = Buffer.alloc(this.bitmap.data.length); function createTranslationFunction(deltaX, deltaY) { return function (x, y) { return { @@ -58,19 +132,16 @@ function advancedRotate(deg, mode) { }; }; } - - var translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2)); - var translate2Screen = createTranslationFunction(bW / 2 + 0.5, bH / 2 + 0.5); - - for (var y = 1; y <= bH; y++) { - for (var x = 1; x <= bW; x++) { - var cartesian = translate2Cartesian(x, y); - var source = translate2Screen(cosine * cartesian.x - sine * cartesian.y, cosine * cartesian.y + sine * cartesian.x); - var dstIdx = bW * (y - 1) + x - 1 << 2; - + const translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2)); + const translate2Screen = createTranslationFunction(bW / 2 + 0.5, bH / 2 + 0.5); + for (let y = 1; y <= bH; y++) { + for (let x = 1; x <= bW; x++) { + const cartesian = translate2Cartesian(x, y); + const source = translate2Screen(cosine * cartesian.x - sine * cartesian.y, cosine * cartesian.y + sine * cartesian.x); + const dstIdx = bW * (y - 1) + x - 1 << 2; if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) { - var srcIdx = (bW * (source.y | 0) + source.x | 0) << 2; - var pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx); + const srcIdx = (bW * (source.y | 0) + source.x | 0) << 2; + const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx); dstBuffer.writeUInt32BE(pixelRGBA, dstIdx); } else { // reset off-image pixels @@ -78,62 +149,56 @@ function advancedRotate(deg, mode) { } } } - this.bitmap.data = dstBuffer; - - if (mode === true || typeof mode === 'string') { + if (mode === true || typeof mode === "string") { // now crop the image to the final size - var _x = bW / 2 - w / 2; - - var _y = bH / 2 - h / 2; - - this.crop(_x, _y, w, h); + const x = bW / 2 - w / 2; + const y = bH / 2 - h / 2; + this.crop(x, y, w, h); } } +var _default = () => ({ + /** + * Rotates the image counter-clockwise by a number of degrees. By default the width and height of the image will be resized appropriately. + * @param {number} deg the number of degrees to rotate the image by + * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + rotate(deg, mode, cb) { + // enable overloading + if (typeof mode === "undefined" || mode === null) { + // e.g. image.resize(120); + // e.g. image.resize(120, null, cb); + // e.g. image.resize(120, undefined, cb); + mode = true; + } + if (typeof mode === "function" && typeof cb === "undefined") { + // e.g. image.resize(120, cb); + cb = mode; + mode = true; + } + if (typeof deg !== "number") { + return _utils.throwError.call(this, "deg must be a number", cb); + } + if (typeof mode !== "boolean" && typeof mode !== "string") { + return _utils.throwError.call(this, "mode must be a boolean or a string", cb); + } -var _default = function _default() { - return { - /** - * Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately. - * @param {number} deg the number of degrees to rotate the image by - * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - rotate: function rotate(deg, mode, cb) { - // enable overloading - if (typeof mode === 'undefined' || mode === null) { - // e.g. image.resize(120); - // e.g. image.resize(120, null, cb); - // e.g. image.resize(120, undefined, cb); - mode = true; - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - // e.g. image.resize(120, cb); - cb = mode; - mode = true; - } - - if (typeof deg !== 'number') { - return _utils.throwError.call(this, 'deg must be a number', cb); - } - - if (typeof mode !== 'boolean' && typeof mode !== 'string') { - return _utils.throwError.call(this, 'mode must be a boolean or a string', cb); - } - + // use matrixRotate if the angle is a multiple of 90 degrees (eg: 180 or -90) and resize is allowed or not needed. + const matrixRotateAllowed = deg % 90 === 0 && (mode || this.bitmap.width === this.bitmap.height || deg % 180 === 0); + if (matrixRotateAllowed) { + matrixRotate.call(this, deg); + } else { advancedRotate.call(this, deg, mode, cb); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; } - }; -}; - -exports["default"] = _default; + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + } +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-rotate/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-rotate/dist/index.js.map index 57e7d894..90c89bc0 100644 --- a/project starter code/node_modules/@jimp/plugin-rotate/dist/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-rotate/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["advancedRotate","deg","mode","rad","Math","PI","cosine","cos","sine","sin","w","bitmap","width","h","height","ceil","abs","c","cloneQuiet","scanQuiet","x","y","idx","data","writeUInt32BE","_background","max","resize","blit","bW","bH","dstBuffer","Buffer","alloc","length","createTranslationFunction","deltaX","deltaY","translate2Cartesian","translate2Screen","cartesian","source","dstIdx","srcIdx","pixelRGBA","readUInt32BE","crop","rotate","cb","throwError","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;AAKA,SAASA,cAAT,CAAwBC,GAAxB,EAA6BC,IAA7B,EAAmC;AACjCD,EAA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;AACD;AAtCmB,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from '@jimp/utils';\n\n/**\n * Rotates an image clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n */\nfunction advancedRotate(deg, mode) {\n deg %= 360;\n const rad = (deg * Math.PI) / 180;\n const cosine = Math.cos(rad);\n const sine = Math.sin(rad);\n\n // the final width and height will change if resize == true\n let w = this.bitmap.width;\n let h = this.bitmap.height;\n\n if (mode === true || typeof mode === 'string') {\n // resize the image to it maximum dimension and blit the existing image\n // onto the center so that when it is rotated the image is kept in bounds\n\n // http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle\n // Plus 1 border pixel to ensure to show all rotated result for some cases.\n w =\n Math.ceil(\n Math.abs(this.bitmap.width * cosine) +\n Math.abs(this.bitmap.height * sine)\n ) + 1;\n h =\n Math.ceil(\n Math.abs(this.bitmap.width * sine) +\n Math.abs(this.bitmap.height * cosine)\n ) + 1;\n // Ensure destination to have even size to a better result.\n if (w % 2 !== 0) {\n w++;\n }\n\n if (h % 2 !== 0) {\n h++;\n }\n\n const c = this.cloneQuiet();\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n });\n\n const max = Math.max(w, h, this.bitmap.width, this.bitmap.height);\n this.resize(max, max, mode);\n\n this.blit(\n c,\n this.bitmap.width / 2 - c.bitmap.width / 2,\n this.bitmap.height / 2 - c.bitmap.height / 2\n );\n }\n\n const bW = this.bitmap.width;\n const bH = this.bitmap.height;\n const dstBuffer = Buffer.alloc(this.bitmap.data.length);\n\n function createTranslationFunction(deltaX, deltaY) {\n return function(x, y) {\n return {\n x: x + deltaX,\n y: y + deltaY\n };\n };\n }\n\n const translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2));\n const translate2Screen = createTranslationFunction(\n bW / 2 + 0.5,\n bH / 2 + 0.5\n );\n\n for (let y = 1; y <= bH; y++) {\n for (let x = 1; x <= bW; x++) {\n const cartesian = translate2Cartesian(x, y);\n const source = translate2Screen(\n cosine * cartesian.x - sine * cartesian.y,\n cosine * cartesian.y + sine * cartesian.x\n );\n const dstIdx = (bW * (y - 1) + x - 1) << 2;\n\n if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) {\n const srcIdx = ((bW * (source.y | 0) + source.x) | 0) << 2;\n const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);\n dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);\n } else {\n // reset off-image pixels\n dstBuffer.writeUInt32BE(this._background, dstIdx);\n }\n }\n }\n\n this.bitmap.data = dstBuffer;\n\n if (mode === true || typeof mode === 'string') {\n // now crop the image to the final size\n const x = bW / 2 - w / 2;\n const y = bH / 2 - h / 2;\n this.crop(x, y, w, h);\n }\n}\n\nexport default () => ({\n /**\n * Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rotate(deg, mode, cb) {\n // enable overloading\n if (typeof mode === 'undefined' || mode === null) {\n // e.g. image.resize(120);\n // e.g. image.resize(120, null, cb);\n // e.g. image.resize(120, undefined, cb);\n mode = true;\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n // e.g. image.resize(120, cb);\n cb = mode;\n mode = true;\n }\n\n if (typeof deg !== 'number') {\n return throwError.call(this, 'deg must be a number', cb);\n }\n\n if (typeof mode !== 'boolean' && typeof mode !== 'string') {\n return throwError.call(this, 'mode must be a boolean or a string', cb);\n }\n\n advancedRotate.call(this, deg, mode, cb);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["matrixRotate","deg","Math","abs","Error","w","bitmap","width","h","height","angle","nW","nH","dstBuffer","Buffer","alloc","data","length","createIdxTranslationFunction","x","y","srcIdxFunction","dstIdxFunction","srcIdx","pixelRGBA","readUInt32BE","dstIdx","writeUInt32BE","advancedRotate","mode","rad","PI","cosine","cos","sine","sin","ceil","c","cloneQuiet","scanQuiet","idx","_background","max","resize","blit","bW","bH","createTranslationFunction","deltaX","deltaY","translate2Cartesian","translate2Screen","cartesian","source","crop","rotate","cb","throwError","call","matrixRotateAllowed","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Rotates an image counter-clockwise by multiple of 90 degrees. NB: 'this' must be a Jimp object.\n *\n * This function is based on matrix rotation. Check this to get an initial idea how it works: https://stackoverflow.com/a/8664879/10561909\n *\n * @param {number} deg the number of degrees to rotate the image by, it should be a multiple of 90\n */\nfunction matrixRotate(deg) {\n if (Math.abs(deg) % 90 !== 0) {\n throw new Error(\"Unsupported matrix rotation degree\");\n }\n\n deg %= 360;\n if (Math.abs(deg) === 0) {\n // no rotation for 0, 360, -360, 720, -720, ...\n return;\n }\n\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n\n // decide which rotation angle to use\n let angle;\n switch (deg) {\n // 90 degree & -270 degree are same\n case 90:\n case -270:\n angle = 90;\n break;\n\n case 180:\n case -180:\n angle = 180;\n break;\n\n case 270:\n case -90:\n angle = -90;\n break;\n\n default:\n throw new Error(\"Unsupported matrix rotation degree\");\n }\n // After this switch block, angle will be 90, 180 or -90\n\n // calculate the new width and height\n const nW = angle === 180 ? w : h;\n const nH = angle === 180 ? h : w;\n\n const dstBuffer = Buffer.alloc(this.bitmap.data.length);\n\n // function to translate the x, y coordinate to the index of the pixel in the buffer\n function createIdxTranslationFunction(w, h) {\n return function (x, y) {\n return (y * w + x) << 2;\n };\n }\n\n const srcIdxFunction = createIdxTranslationFunction(w, h);\n const dstIdxFunction = createIdxTranslationFunction(nW, nH);\n\n for (let x = 0; x < w; x++) {\n for (let y = 0; y < h; y++) {\n const srcIdx = srcIdxFunction(x, y);\n const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);\n\n let dstIdx;\n switch (angle) {\n case 90:\n dstIdx = dstIdxFunction(y, w - x - 1);\n break;\n case -90:\n dstIdx = dstIdxFunction(h - y - 1, x);\n break;\n case 180:\n dstIdx = dstIdxFunction(w - x - 1, h - y - 1);\n break;\n default:\n throw new Error(\"Unsupported matrix rotation angle\");\n }\n\n dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);\n }\n }\n\n this.bitmap.data = dstBuffer;\n this.bitmap.width = nW;\n this.bitmap.height = nH;\n}\n\n/**\n * Rotates an image counter-clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n */\nfunction advancedRotate(deg, mode) {\n deg %= 360;\n const rad = (deg * Math.PI) / 180;\n const cosine = Math.cos(rad);\n const sine = Math.sin(rad);\n\n // the final width and height will change if resize == true\n let w = this.bitmap.width;\n let h = this.bitmap.height;\n\n if (mode === true || typeof mode === \"string\") {\n // resize the image to it maximum dimension and blit the existing image\n // onto the center so that when it is rotated the image is kept in bounds\n\n // http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle\n // Plus 1 border pixel to ensure to show all rotated result for some cases.\n w =\n Math.ceil(\n Math.abs(this.bitmap.width * cosine) +\n Math.abs(this.bitmap.height * sine)\n ) + 1;\n h =\n Math.ceil(\n Math.abs(this.bitmap.width * sine) +\n Math.abs(this.bitmap.height * cosine)\n ) + 1;\n // Ensure destination to have even size to a better result.\n if (w % 2 !== 0) {\n w++;\n }\n\n if (h % 2 !== 0) {\n h++;\n }\n\n const c = this.cloneQuiet();\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n }\n );\n\n const max = Math.max(w, h, this.bitmap.width, this.bitmap.height);\n this.resize(max, max, mode);\n\n this.blit(\n c,\n this.bitmap.width / 2 - c.bitmap.width / 2,\n this.bitmap.height / 2 - c.bitmap.height / 2\n );\n }\n\n const bW = this.bitmap.width;\n const bH = this.bitmap.height;\n const dstBuffer = Buffer.alloc(this.bitmap.data.length);\n\n function createTranslationFunction(deltaX, deltaY) {\n return function (x, y) {\n return {\n x: x + deltaX,\n y: y + deltaY,\n };\n };\n }\n\n const translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2));\n const translate2Screen = createTranslationFunction(\n bW / 2 + 0.5,\n bH / 2 + 0.5\n );\n\n for (let y = 1; y <= bH; y++) {\n for (let x = 1; x <= bW; x++) {\n const cartesian = translate2Cartesian(x, y);\n const source = translate2Screen(\n cosine * cartesian.x - sine * cartesian.y,\n cosine * cartesian.y + sine * cartesian.x\n );\n const dstIdx = (bW * (y - 1) + x - 1) << 2;\n\n if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) {\n const srcIdx = ((bW * (source.y | 0) + source.x) | 0) << 2;\n const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);\n dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);\n } else {\n // reset off-image pixels\n dstBuffer.writeUInt32BE(this._background, dstIdx);\n }\n }\n }\n\n this.bitmap.data = dstBuffer;\n\n if (mode === true || typeof mode === \"string\") {\n // now crop the image to the final size\n const x = bW / 2 - w / 2;\n const y = bH / 2 - h / 2;\n this.crop(x, y, w, h);\n }\n}\n\nexport default () => ({\n /**\n * Rotates the image counter-clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rotate(deg, mode, cb) {\n // enable overloading\n if (typeof mode === \"undefined\" || mode === null) {\n // e.g. image.resize(120);\n // e.g. image.resize(120, null, cb);\n // e.g. image.resize(120, undefined, cb);\n mode = true;\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n // e.g. image.resize(120, cb);\n cb = mode;\n mode = true;\n }\n\n if (typeof deg !== \"number\") {\n return throwError.call(this, \"deg must be a number\", cb);\n }\n\n if (typeof mode !== \"boolean\" && typeof mode !== \"string\") {\n return throwError.call(this, \"mode must be a boolean or a string\", cb);\n }\n\n // use matrixRotate if the angle is a multiple of 90 degrees (eg: 180 or -90) and resize is allowed or not needed.\n const matrixRotateAllowed =\n deg % 90 === 0 &&\n (mode || this.bitmap.width === this.bitmap.height || deg % 180 === 0);\n\n if (matrixRotateAllowed) {\n matrixRotate.call(this, deg);\n } else {\n advancedRotate.call(this, deg, mode, cb);\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,YAAY,CAACC,GAAG,EAAE;EACzB,IAAIC,IAAI,CAACC,GAAG,CAACF,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE;IAC5B,MAAM,IAAIG,KAAK,CAAC,oCAAoC,CAAC;EACvD;EAEAH,GAAG,IAAI,GAAG;EACV,IAAIC,IAAI,CAACC,GAAG,CAACF,GAAG,CAAC,KAAK,CAAC,EAAE;IACvB;IACA;EACF;EAEA,MAAMI,CAAC,GAAG,IAAI,CAACC,MAAM,CAACC,KAAK;EAC3B,MAAMC,CAAC,GAAG,IAAI,CAACF,MAAM,CAACG,MAAM;;EAE5B;EACA,IAAIC,KAAK;EACT,QAAQT,GAAG;IACT;IACA,KAAK,EAAE;IACP,KAAK,CAAC,GAAG;MACPS,KAAK,GAAG,EAAE;MACV;IAEF,KAAK,GAAG;IACR,KAAK,CAAC,GAAG;MACPA,KAAK,G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A,IAAI,GAAG,IAAI;IACb;IAEA,IAAI,OAAO5B,GAAG,KAAK,QAAQ,EAAE;MAC3B,OAAOwD,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,sBAAsB,EAAEF,EAAE,CAAC;IAC1D;IAEA,IAAI,OAAO3B,IAAI,KAAK,SAAS,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;MACzD,OAAO4B,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,oCAAoC,EAAEF,EAAE,CAAC;IACxE;;IAEA;IACA,MAAMG,mBAAmB,GACvB1D,GAAG,GAAG,EAAE,KAAK,CAAC,KACb4B,IAAI,IAAI,IAAI,CAACvB,MAAM,CAACC,KAAK,KAAK,IAAI,CAACD,MAAM,CAACG,MAAM,IAAIR,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC;IAEvE,IAAI0D,mBAAmB,EAAE;MACvB3D,YAAY,CAAC0D,IAAI,CAAC,IAAI,EAAEzD,GAAG,CAAC;IAC9B,CAAC,MAAM;MACL2B,cAAc,CAAC8B,IAAI,CAAC,IAAI,EAAEzD,GAAG,EAAE4B,IAAI,EAAE2B,EAAE,CAAC;IAC1C;IAEA,IAAI,IAAAI,oBAAa,EAACJ,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-rotate/es/index.js b/project starter code/node_modules/@jimp/plugin-rotate/es/index.js index ebb25b9f..396a9a67 100644 --- a/project starter code/node_modules/@jimp/plugin-rotate/es/index.js +++ b/project starter code/node_modules/@jimp/plugin-rotate/es/index.js @@ -1,55 +1,124 @@ -"use strict"; +import { isNodePattern, throwError } from "@jimp/utils"; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; +/** + * Rotates an image counter-clockwise by multiple of 90 degrees. NB: 'this' must be a Jimp object. + * + * This function is based on matrix rotation. Check this to get an initial idea how it works: https://stackoverflow.com/a/8664879/10561909 + * + * @param {number} deg the number of degrees to rotate the image by, it should be a multiple of 90 + */ +function matrixRotate(deg) { + if (Math.abs(deg) % 90 !== 0) { + throw new Error("Unsupported matrix rotation degree"); + } + deg %= 360; + if (Math.abs(deg) === 0) { + // no rotation for 0, 360, -360, 720, -720, ... + return; + } + const w = this.bitmap.width; + const h = this.bitmap.height; + + // decide which rotation angle to use + let angle; + switch (deg) { + // 90 degree & -270 degree are same + case 90: + case -270: + angle = 90; + break; + case 180: + case -180: + angle = 180; + break; + case 270: + case -90: + angle = -90; + break; + default: + throw new Error("Unsupported matrix rotation degree"); + } + // After this switch block, angle will be 90, 180 or -90 -var _utils = require("@jimp/utils"); + // calculate the new width and height + const nW = angle === 180 ? w : h; + const nH = angle === 180 ? h : w; + const dstBuffer = Buffer.alloc(this.bitmap.data.length); + + // function to translate the x, y coordinate to the index of the pixel in the buffer + function createIdxTranslationFunction(w, h) { + return function (x, y) { + return y * w + x << 2; + }; + } + const srcIdxFunction = createIdxTranslationFunction(w, h); + const dstIdxFunction = createIdxTranslationFunction(nW, nH); + for (let x = 0; x < w; x++) { + for (let y = 0; y < h; y++) { + const srcIdx = srcIdxFunction(x, y); + const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx); + let dstIdx; + switch (angle) { + case 90: + dstIdx = dstIdxFunction(y, w - x - 1); + break; + case -90: + dstIdx = dstIdxFunction(h - y - 1, x); + break; + case 180: + dstIdx = dstIdxFunction(w - x - 1, h - y - 1); + break; + default: + throw new Error("Unsupported matrix rotation angle"); + } + dstBuffer.writeUInt32BE(pixelRGBA, dstIdx); + } + } + this.bitmap.data = dstBuffer; + this.bitmap.width = nW; + this.bitmap.height = nH; +} /** - * Rotates an image clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object. + * Rotates an image counter-clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object. * @param {number} deg the number of degrees to rotate the image by * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed */ function advancedRotate(deg, mode) { deg %= 360; - var rad = deg * Math.PI / 180; - var cosine = Math.cos(rad); - var sine = Math.sin(rad); // the final width and height will change if resize == true - - var w = this.bitmap.width; - var h = this.bitmap.height; - - if (mode === true || typeof mode === 'string') { + const rad = deg * Math.PI / 180; + const cosine = Math.cos(rad); + const sine = Math.sin(rad); + + // the final width and height will change if resize == true + let w = this.bitmap.width; + let h = this.bitmap.height; + if (mode === true || typeof mode === "string") { // resize the image to it maximum dimension and blit the existing image // onto the center so that when it is rotated the image is kept in bounds + // http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle // Plus 1 border pixel to ensure to show all rotated result for some cases. w = Math.ceil(Math.abs(this.bitmap.width * cosine) + Math.abs(this.bitmap.height * sine)) + 1; - h = Math.ceil(Math.abs(this.bitmap.width * sine) + Math.abs(this.bitmap.height * cosine)) + 1; // Ensure destination to have even size to a better result. - + h = Math.ceil(Math.abs(this.bitmap.width * sine) + Math.abs(this.bitmap.height * cosine)) + 1; + // Ensure destination to have even size to a better result. if (w % 2 !== 0) { w++; } - if (h % 2 !== 0) { h++; } - - var c = this.cloneQuiet(); + const c = this.cloneQuiet(); this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { this.bitmap.data.writeUInt32BE(this._background, idx); }); - var max = Math.max(w, h, this.bitmap.width, this.bitmap.height); + const max = Math.max(w, h, this.bitmap.width, this.bitmap.height); this.resize(max, max, mode); this.blit(c, this.bitmap.width / 2 - c.bitmap.width / 2, this.bitmap.height / 2 - c.bitmap.height / 2); } - - var bW = this.bitmap.width; - var bH = this.bitmap.height; - var dstBuffer = Buffer.alloc(this.bitmap.data.length); - + const bW = this.bitmap.width; + const bH = this.bitmap.height; + const dstBuffer = Buffer.alloc(this.bitmap.data.length); function createTranslationFunction(deltaX, deltaY) { return function (x, y) { return { @@ -58,19 +127,16 @@ function advancedRotate(deg, mode) { }; }; } - - var translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2)); - var translate2Screen = createTranslationFunction(bW / 2 + 0.5, bH / 2 + 0.5); - - for (var y = 1; y <= bH; y++) { - for (var x = 1; x <= bW; x++) { - var cartesian = translate2Cartesian(x, y); - var source = translate2Screen(cosine * cartesian.x - sine * cartesian.y, cosine * cartesian.y + sine * cartesian.x); - var dstIdx = bW * (y - 1) + x - 1 << 2; - + const translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2)); + const translate2Screen = createTranslationFunction(bW / 2 + 0.5, bH / 2 + 0.5); + for (let y = 1; y <= bH; y++) { + for (let x = 1; x <= bW; x++) { + const cartesian = translate2Cartesian(x, y); + const source = translate2Screen(cosine * cartesian.x - sine * cartesian.y, cosine * cartesian.y + sine * cartesian.x); + const dstIdx = bW * (y - 1) + x - 1 << 2; if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) { - var srcIdx = (bW * (source.y | 0) + source.x | 0) << 2; - var pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx); + const srcIdx = (bW * (source.y | 0) + source.x | 0) << 2; + const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx); dstBuffer.writeUInt32BE(pixelRGBA, dstIdx); } else { // reset off-image pixels @@ -78,61 +144,53 @@ function advancedRotate(deg, mode) { } } } - this.bitmap.data = dstBuffer; - - if (mode === true || typeof mode === 'string') { + if (mode === true || typeof mode === "string") { // now crop the image to the final size - var _x = bW / 2 - w / 2; - - var _y = bH / 2 - h / 2; - - this.crop(_x, _y, w, h); + const x = bW / 2 - w / 2; + const y = bH / 2 - h / 2; + this.crop(x, y, w, h); } } +export default (() => ({ + /** + * Rotates the image counter-clockwise by a number of degrees. By default the width and height of the image will be resized appropriately. + * @param {number} deg the number of degrees to rotate the image by + * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + rotate(deg, mode, cb) { + // enable overloading + if (typeof mode === "undefined" || mode === null) { + // e.g. image.resize(120); + // e.g. image.resize(120, null, cb); + // e.g. image.resize(120, undefined, cb); + mode = true; + } + if (typeof mode === "function" && typeof cb === "undefined") { + // e.g. image.resize(120, cb); + cb = mode; + mode = true; + } + if (typeof deg !== "number") { + return throwError.call(this, "deg must be a number", cb); + } + if (typeof mode !== "boolean" && typeof mode !== "string") { + return throwError.call(this, "mode must be a boolean or a string", cb); + } -var _default = function _default() { - return { - /** - * Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately. - * @param {number} deg the number of degrees to rotate the image by - * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - rotate: function rotate(deg, mode, cb) { - // enable overloading - if (typeof mode === 'undefined' || mode === null) { - // e.g. image.resize(120); - // e.g. image.resize(120, null, cb); - // e.g. image.resize(120, undefined, cb); - mode = true; - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - // e.g. image.resize(120, cb); - cb = mode; - mode = true; - } - - if (typeof deg !== 'number') { - return _utils.throwError.call(this, 'deg must be a number', cb); - } - - if (typeof mode !== 'boolean' && typeof mode !== 'string') { - return _utils.throwError.call(this, 'mode must be a boolean or a string', cb); - } - + // use matrixRotate if the angle is a multiple of 90 degrees (eg: 180 or -90) and resize is allowed or not needed. + const matrixRotateAllowed = deg % 90 === 0 && (mode || this.bitmap.width === this.bitmap.height || deg % 180 === 0); + if (matrixRotateAllowed) { + matrixRotate.call(this, deg); + } else { advancedRotate.call(this, deg, mode, cb); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; } - }; -}; - -exports["default"] = _default; + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + } +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-rotate/es/index.js.map b/project starter code/node_modules/@jimp/plugin-rotate/es/index.js.map index 57e7d894..79faf103 100644 --- a/project starter code/node_modules/@jimp/plugin-rotate/es/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-rotate/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["advancedRotate","deg","mode","rad","Math","PI","cosine","cos","sine","sin","w","bitmap","width","h","height","ceil","abs","c","cloneQuiet","scanQuiet","x","y","idx","data","writeUInt32BE","_background","max","resize","blit","bW","bH","dstBuffer","Buffer","alloc","length","createTranslationFunction","deltaX","deltaY","translate2Cartesian","translate2Screen","cartesian","source","dstIdx","srcIdx","pixelRGBA","readUInt32BE","crop","rotate","cb","throwError","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;AAKA,SAASA,cAAT,CAAwBC,GAAxB,EAA6BC,IAA7B,EAAmC;AACjCD,EAAAA,GAAG,IAAI,GAAP;AACA,MAAME,GAAG,GAAIF,GAAG,GAAGG,IAAI,CAACC,EAAZ,GAAkB,GAA9B;AACA,MAAMC,MAAM,GAAGF,IAAI,CAACG,GAAL,CAASJ,GAAT,CAAf;AACA,MAAMK,IAAI,GAAGJ,IAAI,CAACK,GAAL,CAASN,GAAT,CAAb,CAJiC,CAMjC;;AACA,MAAIO,CAAC,GAAG,KAAKC,MAAL,CAAYC,KAApB;AACA,MAAIC,CAAC,GAAG,KAAKF,MAAL,CAAYG,MAApB;;AAEA,MAAIZ,IAAI,KAAK,IAAT,IAAiB,OAAOA,IAAP,KAAgB,QAArC,EAA+C;AAC7C;AACA;AAEA;AACA;AACAQ,IAAAA,CAAC,GACCN,IAAI,CAACW,IAAL,CACEX,IAAI,CAACY,GAAL,CAAS,KAAKL,MAAL,CAAYC,KAAZ,GAAoBN,MAA7B,IACEF,IAAI,CAACY,GAAL,CAAS,KAAKL,MAAL,CAAYG,MAAZ,GAAqBN,IAA9B,CAFJ,IAGI,CAJN;AAKAK,IAAAA,CAAC,GACCT,IAAI,CAACW,IAAL,CACEX,IAAI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;;AAED,UAAI,OAAOD,GAAP,KAAe,QAAnB,EAA6B;AAC3B,eAAOgD,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,sBAAtB,EAA8CF,EAA9C,CAAP;AACD;;AAED,UAAI,OAAO9C,IAAP,KAAgB,SAAhB,IAA6B,OAAOA,IAAP,KAAgB,QAAjD,EAA2D;AACzD,eAAO+C,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oCAAtB,EAA4DF,EAA5D,CAAP;AACD;;AAEDhD,MAAAA,cAAc,CAACkD,IAAf,CAAoB,IAApB,EAA0BjD,GAA1B,EAA+BC,IAA/B,EAAqC8C,EAArC;;AAEA,UAAI,0BAAcA,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAtCmB,GAAP;AAAA,C","sourcesContent":["import { throwError, isNodePattern } from '@jimp/utils';\n\n/**\n * Rotates an image clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n */\nfunction advancedRotate(deg, mode) {\n deg %= 360;\n const rad = (deg * Math.PI) / 180;\n const cosine = Math.cos(rad);\n const sine = Math.sin(rad);\n\n // the final width and height will change if resize == true\n let w = this.bitmap.width;\n let h = this.bitmap.height;\n\n if (mode === true || typeof mode === 'string') {\n // resize the image to it maximum dimension and blit the existing image\n // onto the center so that when it is rotated the image is kept in bounds\n\n // http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle\n // Plus 1 border pixel to ensure to show all rotated result for some cases.\n w =\n Math.ceil(\n Math.abs(this.bitmap.width * cosine) +\n Math.abs(this.bitmap.height * sine)\n ) + 1;\n h =\n Math.ceil(\n Math.abs(this.bitmap.width * sine) +\n Math.abs(this.bitmap.height * cosine)\n ) + 1;\n // Ensure destination to have even size to a better result.\n if (w % 2 !== 0) {\n w++;\n }\n\n if (h % 2 !== 0) {\n h++;\n }\n\n const c = this.cloneQuiet();\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function(\n x,\n y,\n idx\n ) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n });\n\n const max = Math.max(w, h, this.bitmap.width, this.bitmap.height);\n this.resize(max, max, mode);\n\n this.blit(\n c,\n this.bitmap.width / 2 - c.bitmap.width / 2,\n this.bitmap.height / 2 - c.bitmap.height / 2\n );\n }\n\n const bW = this.bitmap.width;\n const bH = this.bitmap.height;\n const dstBuffer = Buffer.alloc(this.bitmap.data.length);\n\n function createTranslationFunction(deltaX, deltaY) {\n return function(x, y) {\n return {\n x: x + deltaX,\n y: y + deltaY\n };\n };\n }\n\n const translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2));\n const translate2Screen = createTranslationFunction(\n bW / 2 + 0.5,\n bH / 2 + 0.5\n );\n\n for (let y = 1; y <= bH; y++) {\n for (let x = 1; x <= bW; x++) {\n const cartesian = translate2Cartesian(x, y);\n const source = translate2Screen(\n cosine * cartesian.x - sine * cartesian.y,\n cosine * cartesian.y + sine * cartesian.x\n );\n const dstIdx = (bW * (y - 1) + x - 1) << 2;\n\n if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) {\n const srcIdx = ((bW * (source.y | 0) + source.x) | 0) << 2;\n const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);\n dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);\n } else {\n // reset off-image pixels\n dstBuffer.writeUInt32BE(this._background, dstIdx);\n }\n }\n }\n\n this.bitmap.data = dstBuffer;\n\n if (mode === true || typeof mode === 'string') {\n // now crop the image to the final size\n const x = bW / 2 - w / 2;\n const y = bH / 2 - h / 2;\n this.crop(x, y, w, h);\n }\n}\n\nexport default () => ({\n /**\n * Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rotate(deg, mode, cb) {\n // enable overloading\n if (typeof mode === 'undefined' || mode === null) {\n // e.g. image.resize(120);\n // e.g. image.resize(120, null, cb);\n // e.g. image.resize(120, undefined, cb);\n mode = true;\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n // e.g. image.resize(120, cb);\n cb = mode;\n mode = true;\n }\n\n if (typeof deg !== 'number') {\n return throwError.call(this, 'deg must be a number', cb);\n }\n\n if (typeof mode !== 'boolean' && typeof mode !== 'string') {\n return throwError.call(this, 'mode must be a boolean or a string', cb);\n }\n\n advancedRotate.call(this, deg, mode, cb);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["isNodePattern","throwError","matrixRotate","deg","Math","abs","Error","w","bitmap","width","h","height","angle","nW","nH","dstBuffer","Buffer","alloc","data","length","createIdxTranslationFunction","x","y","srcIdxFunction","dstIdxFunction","srcIdx","pixelRGBA","readUInt32BE","dstIdx","writeUInt32BE","advancedRotate","mode","rad","PI","cosine","cos","sine","sin","ceil","c","cloneQuiet","scanQuiet","idx","_background","max","resize","blit","bW","bH","createTranslationFunction","deltaX","deltaY","translate2Cartesian","translate2Screen","cartesian","source","crop","rotate","cb","call","matrixRotateAllowed"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Rotates an image counter-clockwise by multiple of 90 degrees. NB: 'this' must be a Jimp object.\n *\n * This function is based on matrix rotation. Check this to get an initial idea how it works: https://stackoverflow.com/a/8664879/10561909\n *\n * @param {number} deg the number of degrees to rotate the image by, it should be a multiple of 90\n */\nfunction matrixRotate(deg) {\n if (Math.abs(deg) % 90 !== 0) {\n throw new Error(\"Unsupported matrix rotation degree\");\n }\n\n deg %= 360;\n if (Math.abs(deg) === 0) {\n // no rotation for 0, 360, -360, 720, -720, ...\n return;\n }\n\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n\n // decide which rotation angle to use\n let angle;\n switch (deg) {\n // 90 degree & -270 degree are same\n case 90:\n case -270:\n angle = 90;\n break;\n\n case 180:\n case -180:\n angle = 180;\n break;\n\n case 270:\n case -90:\n angle = -90;\n break;\n\n default:\n throw new Error(\"Unsupported matrix rotation degree\");\n }\n // After this switch block, angle will be 90, 180 or -90\n\n // calculate the new width and height\n const nW = angle === 180 ? w : h;\n const nH = angle === 180 ? h : w;\n\n const dstBuffer = Buffer.alloc(this.bitmap.data.length);\n\n // function to translate the x, y coordinate to the index of the pixel in the buffer\n function createIdxTranslationFunction(w, h) {\n return function (x, y) {\n return (y * w + x) << 2;\n };\n }\n\n const srcIdxFunction = createIdxTranslationFunction(w, h);\n const dstIdxFunction = createIdxTranslationFunction(nW, nH);\n\n for (let x = 0; x < w; x++) {\n for (let y = 0; y < h; y++) {\n const srcIdx = srcIdxFunction(x, y);\n const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);\n\n let dstIdx;\n switch (angle) {\n case 90:\n dstIdx = dstIdxFunction(y, w - x - 1);\n break;\n case -90:\n dstIdx = dstIdxFunction(h - y - 1, x);\n break;\n case 180:\n dstIdx = dstIdxFunction(w - x - 1, h - y - 1);\n break;\n default:\n throw new Error(\"Unsupported matrix rotation angle\");\n }\n\n dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);\n }\n }\n\n this.bitmap.data = dstBuffer;\n this.bitmap.width = nW;\n this.bitmap.height = nH;\n}\n\n/**\n * Rotates an image counter-clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n */\nfunction advancedRotate(deg, mode) {\n deg %= 360;\n const rad = (deg * Math.PI) / 180;\n const cosine = Math.cos(rad);\n const sine = Math.sin(rad);\n\n // the final width and height will change if resize == true\n let w = this.bitmap.width;\n let h = this.bitmap.height;\n\n if (mode === true || typeof mode === \"string\") {\n // resize the image to it maximum dimension and blit the existing image\n // onto the center so that when it is rotated the image is kept in bounds\n\n // http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle\n // Plus 1 border pixel to ensure to show all rotated result for some cases.\n w =\n Math.ceil(\n Math.abs(this.bitmap.width * cosine) +\n Math.abs(this.bitmap.height * sine)\n ) + 1;\n h =\n Math.ceil(\n Math.abs(this.bitmap.width * sine) +\n Math.abs(this.bitmap.height * cosine)\n ) + 1;\n // Ensure destination to have even size to a better result.\n if (w % 2 !== 0) {\n w++;\n }\n\n if (h % 2 !== 0) {\n h++;\n }\n\n const c = this.cloneQuiet();\n this.scanQuiet(\n 0,\n 0,\n this.bitmap.width,\n this.bitmap.height,\n function (x, y, idx) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n }\n );\n\n const max = Math.max(w, h, this.bitmap.width, this.bitmap.height);\n this.resize(max, max, mode);\n\n this.blit(\n c,\n this.bitmap.width / 2 - c.bitmap.width / 2,\n this.bitmap.height / 2 - c.bitmap.height / 2\n );\n }\n\n const bW = this.bitmap.width;\n const bH = this.bitmap.height;\n const dstBuffer = Buffer.alloc(this.bitmap.data.length);\n\n function createTranslationFunction(deltaX, deltaY) {\n return function (x, y) {\n return {\n x: x + deltaX,\n y: y + deltaY,\n };\n };\n }\n\n const translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2));\n const translate2Screen = createTranslationFunction(\n bW / 2 + 0.5,\n bH / 2 + 0.5\n );\n\n for (let y = 1; y <= bH; y++) {\n for (let x = 1; x <= bW; x++) {\n const cartesian = translate2Cartesian(x, y);\n const source = translate2Screen(\n cosine * cartesian.x - sine * cartesian.y,\n cosine * cartesian.y + sine * cartesian.x\n );\n const dstIdx = (bW * (y - 1) + x - 1) << 2;\n\n if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) {\n const srcIdx = ((bW * (source.y | 0) + source.x) | 0) << 2;\n const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);\n dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);\n } else {\n // reset off-image pixels\n dstBuffer.writeUInt32BE(this._background, dstIdx);\n }\n }\n }\n\n this.bitmap.data = dstBuffer;\n\n if (mode === true || typeof mode === \"string\") {\n // now crop the image to the final size\n const x = bW / 2 - w / 2;\n const y = bH / 2 - h / 2;\n this.crop(x, y, w, h);\n }\n}\n\nexport default () => ({\n /**\n * Rotates the image counter-clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rotate(deg, mode, cb) {\n // enable overloading\n if (typeof mode === \"undefined\" || mode === null) {\n // e.g. image.resize(120);\n // e.g. image.resize(120, null, cb);\n // e.g. image.resize(120, undefined, cb);\n mode = true;\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n // e.g. image.resize(120, cb);\n cb = mode;\n mode = true;\n }\n\n if (typeof deg !== \"number\") {\n return throwError.call(this, \"deg must be a number\", cb);\n }\n\n if (typeof mode !== \"boolean\" && typeof mode !== \"string\") {\n return throwError.call(this, \"mode must be a boolean or a string\", cb);\n }\n\n // use matrixRotate if the angle is a multiple of 90 degrees (eg: 180 or -90) and resize is allowed or not needed.\n const matrixRotateAllowed =\n deg % 90 === 0 &&\n (mode || this.bitmap.width === this.bitmap.height || deg % 180 === 0);\n\n if (matrixRotateAllowed) {\n matrixRotate.call(this, deg);\n } else {\n advancedRotate.call(this, deg, mode, cb);\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA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,EAAExD,GAAG,EAAE4B,IAAI,EAAE2B,EAAE,CAAC;IAC1C;IAEA,IAAI1D,aAAa,CAAC0D,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-rotate/index.d.ts b/project starter code/node_modules/@jimp/plugin-rotate/index.d.ts index 8cc783de..23d2aa2f 100644 --- a/project starter code/node_modules/@jimp/plugin-rotate/index.d.ts +++ b/project starter code/node_modules/@jimp/plugin-rotate/index.d.ts @@ -1,8 +1,8 @@ -import { ImageCallback } from '@jimp/core'; +import { ImageCallback } from "@jimp/core"; interface Rotate { rotate(deg: number, cb?: ImageCallback): this; rotate(deg: number, mode: string | boolean, cb?: ImageCallback): this; } -export default function(): Rotate; +export default function (): Rotate; diff --git a/project starter code/node_modules/@jimp/plugin-rotate/package.json b/project starter code/node_modules/@jimp/plugin-rotate/package.json index a6c4676f..651f0264 100644 --- a/project starter code/node_modules/@jimp/plugin-rotate/package.json +++ b/project starter code/node_modules/@jimp/plugin-rotate/package.json @@ -1,12 +1,13 @@ { "name": "@jimp/plugin-rotate", - "version": "0.16.2", + "version": "0.22.12", "description": "Rotate an image.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js", "test:watch": "npm run test -- --reporter min --watch", "test:coverage": "nyc npm run test", "build": "npm run build:node:production && npm run build:module", @@ -20,8 +21,7 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", @@ -30,14 +30,14 @@ "@jimp/plugin-resize": ">=0.3.5" }, "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/plugin-blit": "^0.16.2", - "@jimp/plugin-crop": "^0.16.2", - "@jimp/plugin-resize": "^0.16.2", - "@jimp/test-utils": "^0.16.2" + "@jimp/custom": "^0.22.12", + "@jimp/plugin-blit": "^0.22.12", + "@jimp/plugin-crop": "^0.22.12", + "@jimp/plugin-resize": "^0.22.12", + "@jimp/test-utils": "^0.22.12" }, "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/plugin-rotate/src/index.js b/project starter code/node_modules/@jimp/plugin-rotate/src/index.js index 80570fda..7f430bae 100644 --- a/project starter code/node_modules/@jimp/plugin-rotate/src/index.js +++ b/project starter code/node_modules/@jimp/plugin-rotate/src/index.js @@ -1,7 +1,97 @@ -import { throwError, isNodePattern } from '@jimp/utils'; +import { isNodePattern, throwError } from "@jimp/utils"; /** - * Rotates an image clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object. + * Rotates an image counter-clockwise by multiple of 90 degrees. NB: 'this' must be a Jimp object. + * + * This function is based on matrix rotation. Check this to get an initial idea how it works: https://stackoverflow.com/a/8664879/10561909 + * + * @param {number} deg the number of degrees to rotate the image by, it should be a multiple of 90 + */ +function matrixRotate(deg) { + if (Math.abs(deg) % 90 !== 0) { + throw new Error("Unsupported matrix rotation degree"); + } + + deg %= 360; + if (Math.abs(deg) === 0) { + // no rotation for 0, 360, -360, 720, -720, ... + return; + } + + const w = this.bitmap.width; + const h = this.bitmap.height; + + // decide which rotation angle to use + let angle; + switch (deg) { + // 90 degree & -270 degree are same + case 90: + case -270: + angle = 90; + break; + + case 180: + case -180: + angle = 180; + break; + + case 270: + case -90: + angle = -90; + break; + + default: + throw new Error("Unsupported matrix rotation degree"); + } + // After this switch block, angle will be 90, 180 or -90 + + // calculate the new width and height + const nW = angle === 180 ? w : h; + const nH = angle === 180 ? h : w; + + const dstBuffer = Buffer.alloc(this.bitmap.data.length); + + // function to translate the x, y coordinate to the index of the pixel in the buffer + function createIdxTranslationFunction(w, h) { + return function (x, y) { + return (y * w + x) << 2; + }; + } + + const srcIdxFunction = createIdxTranslationFunction(w, h); + const dstIdxFunction = createIdxTranslationFunction(nW, nH); + + for (let x = 0; x < w; x++) { + for (let y = 0; y < h; y++) { + const srcIdx = srcIdxFunction(x, y); + const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx); + + let dstIdx; + switch (angle) { + case 90: + dstIdx = dstIdxFunction(y, w - x - 1); + break; + case -90: + dstIdx = dstIdxFunction(h - y - 1, x); + break; + case 180: + dstIdx = dstIdxFunction(w - x - 1, h - y - 1); + break; + default: + throw new Error("Unsupported matrix rotation angle"); + } + + dstBuffer.writeUInt32BE(pixelRGBA, dstIdx); + } + } + + this.bitmap.data = dstBuffer; + this.bitmap.width = nW; + this.bitmap.height = nH; +} + +/** + * Rotates an image counter-clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object. * @param {number} deg the number of degrees to rotate the image by * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed */ @@ -15,7 +105,7 @@ function advancedRotate(deg, mode) { let w = this.bitmap.width; let h = this.bitmap.height; - if (mode === true || typeof mode === 'string') { + if (mode === true || typeof mode === "string") { // resize the image to it maximum dimension and blit the existing image // onto the center so that when it is rotated the image is kept in bounds @@ -41,13 +131,15 @@ function advancedRotate(deg, mode) { } const c = this.cloneQuiet(); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( - x, - y, - idx - ) { - this.bitmap.data.writeUInt32BE(this._background, idx); - }); + this.scanQuiet( + 0, + 0, + this.bitmap.width, + this.bitmap.height, + function (x, y, idx) { + this.bitmap.data.writeUInt32BE(this._background, idx); + } + ); const max = Math.max(w, h, this.bitmap.width, this.bitmap.height); this.resize(max, max, mode); @@ -64,10 +156,10 @@ function advancedRotate(deg, mode) { const dstBuffer = Buffer.alloc(this.bitmap.data.length); function createTranslationFunction(deltaX, deltaY) { - return function(x, y) { + return function (x, y) { return { x: x + deltaX, - y: y + deltaY + y: y + deltaY, }; }; } @@ -100,7 +192,7 @@ function advancedRotate(deg, mode) { this.bitmap.data = dstBuffer; - if (mode === true || typeof mode === 'string') { + if (mode === true || typeof mode === "string") { // now crop the image to the final size const x = bW / 2 - w / 2; const y = bH / 2 - h / 2; @@ -110,7 +202,7 @@ function advancedRotate(deg, mode) { export default () => ({ /** - * Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately. + * Rotates the image counter-clockwise by a number of degrees. By default the width and height of the image will be resized appropriately. * @param {number} deg the number of degrees to rotate the image by * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed * @param {function(Error, Jimp)} cb (optional) a callback for when complete @@ -118,33 +210,42 @@ export default () => ({ */ rotate(deg, mode, cb) { // enable overloading - if (typeof mode === 'undefined' || mode === null) { + if (typeof mode === "undefined" || mode === null) { // e.g. image.resize(120); // e.g. image.resize(120, null, cb); // e.g. image.resize(120, undefined, cb); mode = true; } - if (typeof mode === 'function' && typeof cb === 'undefined') { + if (typeof mode === "function" && typeof cb === "undefined") { // e.g. image.resize(120, cb); cb = mode; mode = true; } - if (typeof deg !== 'number') { - return throwError.call(this, 'deg must be a number', cb); + if (typeof deg !== "number") { + return throwError.call(this, "deg must be a number", cb); } - if (typeof mode !== 'boolean' && typeof mode !== 'string') { - return throwError.call(this, 'mode must be a boolean or a string', cb); + if (typeof mode !== "boolean" && typeof mode !== "string") { + return throwError.call(this, "mode must be a boolean or a string", cb); } - advancedRotate.call(this, deg, mode, cb); + // use matrixRotate if the angle is a multiple of 90 degrees (eg: 180 or -90) and resize is allowed or not needed. + const matrixRotateAllowed = + deg % 90 === 0 && + (mode || this.bitmap.width === this.bitmap.height || deg % 180 === 0); + + if (matrixRotateAllowed) { + matrixRotate.call(this, deg); + } else { + advancedRotate.call(this, deg, mode, cb); + } if (isNodePattern(cb)) { cb.call(this, null, this); } return this; - } + }, }); diff --git a/project starter code/node_modules/@jimp/plugin-rotate/test/rotation.test.js b/project starter code/node_modules/@jimp/plugin-rotate/test/rotation.test.js index 380b6a18..45ee8d2b 100644 --- a/project starter code/node_modules/@jimp/plugin-rotate/test/rotation.test.js +++ b/project starter code/node_modules/@jimp/plugin-rotate/test/rotation.test.js @@ -1,636 +1,610 @@ -import { Jimp, mkJGD } from '@jimp/test-utils'; -import configure from '@jimp/custom'; -import blit from '@jimp/plugin-blit'; -import crop from '@jimp/plugin-crop'; -import resize from '@jimp/plugin-resize'; +import { Jimp, mkJGD } from "@jimp/test-utils"; +import configure from "@jimp/custom"; +import blit from "@jimp/plugin-blit"; +import crop from "@jimp/plugin-crop"; +import resize from "@jimp/plugin-resize"; -import rotate from '../src'; +import rotate from "../src"; +import { expectToBeJGD } from "@jimp/test-utils/src"; const jimp = configure({ plugins: [rotate, blit, crop, resize] }, Jimp); -describe('Rotate a image with even size', () => { +describe("Rotate a image with even size", () => { let imgSrc = null; - before(done => { + before((done) => { jimp .read( mkJGD( - '▰▴▴▴▪▪▪▰', - '▴▴▴▴▪▪▪▪', - '▴▴▴▴▪▪▪▪', - '▴▴▴▴▪▪▪▪', - '▪▪▪▪▴▴▴▴', - '▪▪▪▪▴▴▴▴', - '▪▪▪▪▴▴▴▴', - '▦▪▪▪▴▴▴▦' + "▰▴▴▴▪▪▪▰", + "▴▴▴▴▪▪▪▪", + "▴▴▴▴▪▪▪▪", + "▴▴▴▴▪▪▪▪", + "▪▪▪▪▴▴▴▴", + "▪▪▪▪▴▴▴▴", + "▪▪▪▪▴▴▴▴", + "▦▪▪▪▴▴▴▦" ) ) - .then(imgJimp => { + .then((imgJimp) => { imgSrc = imgJimp; done(); }) .catch(done); }); - it('1 degrees', () => { - imgSrc - .clone() - .rotate(1, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '▰▴▴▴▪▪▪▰ ', - '▴▴▴▴▪▪▪▪ ', - '▴▴▴▴▪▪▪▪ ', - '▴▴▴▴▪▪▪▪ ', - '▪▪▪▪▴▴▴▴ ', - '▪▪▪▪▴▴▴▴ ', - '▪▪▪▪▴▴▴▴ ', - '▦▪▪▪▴▴▴▦ ', - ' ', - ' ' - ) - ); + it("1 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(1, true).getJGDSync(), + mkJGD( + "▰▴▴▴▪▪▪▰ ", + "▴▴▴▴▪▪▪▪ ", + "▴▴▴▴▪▪▪▪ ", + "▴▴▴▴▪▪▪▪ ", + "▪▪▪▪▴▴▴▴ ", + "▪▪▪▪▴▴▴▴ ", + "▪▪▪▪▴▴▴▴ ", + "▦▪▪▪▴▴▴▦ ", + " ", + " " + ) + ); }); - it('91 degrees', () => { - imgSrc - .clone() - .rotate(91, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - '▰▪▪▪▴▴▴▦ ', - '▪▪▪▪▴▴▴▴ ', - '▪▪▪▪▴▴▴▴ ', - '▪▪▪▪▴▴▴▴ ', - '▴▴▴▴▪▪▪▪ ', - '▴▴▴▴▪▪▪▪ ', - '▴▴▴▴▪▪▪▪ ', - '▰▴▴▴▪▪▪▦ ', - ' ' - ) - ); + it("91 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(91, true).getJGDSync(), + mkJGD( + " ", + "▰▪▪▪▴▴▴▦ ", + "▪▪▪▪▴▴▴▴ ", + "▪▪▪▪▴▴▴▴ ", + "▪▪▪▪▴▴▴▴ ", + "▴▴▴▴▪▪▪▪ ", + "▴▴▴▴▪▪▪▪ ", + "▴▴▴▴▪▪▪▪ ", + "▰▴▴▴▪▪▪▦ ", + " " + ) + ); }); - it('30 degrees', () => { - imgSrc - .clone() - .rotate(30, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ▰▰ ', - ' ▪▪▪▪ ', - ' ▴▪▪▪▪▪ ', - '▴▴▴▴▪▪▪▪ ', - '▴▴▴▴▪▪▴▴▴ ', - '▴▴▴▴▪▴▴▴▴▴ ', - ' ▴▴▪▪▴▴▴▴▦ ', - ' ▪▪▪▪▪▴▴▴ ', - ' ▪▪▪▪▪ ', - ' ▪▪▪ ', - ' ▦ ', - ' ' - ) - ); + it("30 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(30, true).getJGDSync(), + mkJGD( + " ▰▰ ", + " ▪▪▪▪ ", + " ▴▪▪▪▪▪ ", + "▴▴▴▴▪▪▪▪ ", + "▴▴▴▴▪▪▴▴▴ ", + "▴▴▴▴▪▴▴▴▴▴ ", + " ▴▴▪▪▴▴▴▴▦ ", + " ▪▪▪▪▪▴▴▴ ", + " ▪▪▪▪▪ ", + " ▪▪▪ ", + " ▦ ", + " " + ) + ); }); - it('45 degrees', () => { - imgSrc - .clone() - .rotate(45, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▰ ', - ' ▪▪▪ ', - ' ▪▪▪▪▪ ', - ' ▴▴▪▪▪▪▴ ', - ' ▴▴▴▴▪▪▴▴▴ ', - '▰▰▴▴▴▴▴▴▴▴▦ ', - ' ▴▴▴▴▪▪▴▴▴ ', - ' ▴▴▪▪▪▪▴ ', - ' ▪▪▪▪▪ ', - ' ▪▪▪ ', - ' ▦ ', - ' ', - ' ' - ) - ); + it("45 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(45, true).getJGDSync(), + mkJGD( + " ", + " ▰ ", + " ▪▪▪ ", + " ▪▪▪▪▪ ", + " ▴▴▪▪▪▪▴ ", + " ▴▴▴▴▪▪▴▴▴ ", + "▰▰▴▴▴▴▴▴▴▴▦ ", + " ▴▴▴▴▪▪▴▴▴ ", + " ▴▴▪▪▪▪▴ ", + " ▪▪▪▪▪ ", + " ▪▪▪ ", + " ▦ ", + " ", + " " + ) + ); }); - it('60 degrees', () => { - imgSrc - .clone() - .rotate(60, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ▰ ', - ' ▪▪▪ ', - ' ▪▪▪▪▪ ', - ' ▪▪▪▪▪▴▴▴ ', - ' ▴▴▪▪▴▴▴▴▦ ', - '▴▴▴▴▪▴▴▴▴▴ ', - '▴▴▴▴▪▪▴▴▴ ', - '▴▴▴▴▪▪▪▪ ', - ' ▴▪▪▪▪▪ ', - ' ▪▪▪▪ ', - ' ▦▦ ', - ' ' - ) - ); + it("60 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(60, true).getJGDSync(), + mkJGD( + " ▰ ", + " ▪▪▪ ", + " ▪▪▪▪▪ ", + " ▪▪▪▪▪▴▴▴ ", + " ▴▴▪▪▴▴▴▴▦ ", + "▴▴▴▴▪▴▴▴▴▴ ", + "▴▴▴▴▪▪▴▴▴ ", + "▴▴▴▴▪▪▪▪ ", + " ▴▪▪▪▪▪ ", + " ▪▪▪▪ ", + " ▦▦ ", + " " + ) + ); }); - it('90 degrees', () => { - imgSrc - .clone() - .rotate(90, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - '▰▪▪▪▴▴▴▦ ', - '▪▪▪▪▴▴▴▴ ', - '▪▪▪▪▴▴▴▴ ', - '▪▪▪▪▴▴▴▴ ', - '▴▴▴▴▪▪▪▪ ', - '▴▴▴▴▪▪▪▪ ', - '▴▴▴▴▪▪▪▪ ', - '▰▴▴▴▪▪▪▦ ', - ' ' - ) - ); + it("90 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(90, true).getJGDSync(), + mkJGD( + "▰▪▪▪▴▴▴▦", + "▪▪▪▪▴▴▴▴", + "▪▪▪▪▴▴▴▴", + "▪▪▪▪▴▴▴▴", + "▴▴▴▴▪▪▪▪", + "▴▴▴▴▪▪▪▪", + "▴▴▴▴▪▪▪▪", + "▰▴▴▴▪▪▪▦" + ) + ); }); - it('120 degrees', () => { - imgSrc - .clone() - .rotate(120, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▴▦ ', - ' ▴▴▴▴ ', - ' ▪▪▴▴▴▴ ', - '▰▪▪▪▴▴▴▴▪ ', - '▰▪▪▪▪▴▴▪▪▪ ', - ' ▪▪▪▪▪▪▪▪▪ ', - ' ▪▪▴▴▴▪▪▪▪▦ ', - ' ▴▴▴▴▴▪▪ ', - ' ▴▴▴▴▪ ', - ' ▴▴▴ ', - ' ' - ) - ); + it("-90 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(-90, true).getJGDSync(), + mkJGD( + "▦▪▪▪▴▴▴▰", + "▪▪▪▪▴▴▴▴", + "▪▪▪▪▴▴▴▴", + "▪▪▪▪▴▴▴▴", + "▴▴▴▴▪▪▪▪", + "▴▴▴▴▪▪▪▪", + "▴▴▴▴▪▪▪▪", + "▦▴▴▴▪▪▪▰" + ) + ); }); - it('135 degrees', () => { - imgSrc - .clone() - .rotate(135, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ', - ' ▦ ', - ' ▴▴▴ ', - ' ▴▴▴▴▴ ', - ' ▪▪▴▴▴▪▪ ', - ' ▪▪▪▪▴▪▪▪▪ ', - ' ▰▪▪▪▪▴▪▪▪▪▦ ', - ' ▪▪▪▴▴▴▪▪▪ ', - ' ▪▴▴▴▴▴▪ ', - ' ▴▴▴▴▴ ', - ' ▴▰▴ ', - ' ▰ ', - ' ' - ) - ); + it("120 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(120, true).getJGDSync(), + mkJGD( + " ", + " ▴▦ ", + " ▴▴▴▴ ", + " ▪▪▴▴▴▴ ", + "▰▪▪▪▴▴▴▴▪ ", + "▰▪▪▪▪▴▴▪▪▪ ", + " ▪▪▪▪▪▪▪▪▪ ", + " ▪▪▴▴▴▪▪▪▪▦ ", + " ▴▴▴▴▴▪▪ ", + " ▴▴▴▴▪ ", + " ▴▴▴ ", + " " + ) + ); }); - it('180 degrees', () => { - imgSrc - .clone() - .rotate(180, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▦▴▴▴▪▪▪▦ ', - ' ▴▴▴▴▪▪▪▪ ', - ' ▴▴▴▴▪▪▪▪ ', - ' ▴▴▴▴▪▪▪▪ ', - ' ▪▪▪▪▴▴▴▴ ', - ' ▪▪▪▪▴▴▴▴ ', - ' ▪▪▪▪▴▴▴▴ ', - ' ▰▪▪▪▴▴▴▰ ', - ' ' - ) - ); + it("135 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(135, true).getJGDSync(), + mkJGD( + " ", + " ", + " ▦ ", + " ▴▴▴ ", + " ▴▴▴▴▴ ", + " ▪▪▴▴▴▪▪ ", + " ▪▪▪▪▴▪▪▪▪ ", + " ▰▪▪▪▪▴▪▪▪▪▦ ", + " ▪▪▪▴▴▴▪▪▪ ", + " ▪▴▴▴▴▴▪ ", + " ▴▴▴▴▴ ", + " ▴▰▴ ", + " ▰ ", + " " + ) + ); }); - it('225 degrees', () => { - imgSrc - .clone() - .rotate(225, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▦ ', - ' ▪▪▪ ', - ' ▪▪▪▪▪ ', - ' ▴▪▪▪▪▴▴ ', - ' ▴▴▴▪▪▴▴▴▴ ', - ' ▦▴▴▴▴▴▴▴▴▰▰ ', - ' ▴▴▴▪▪▴▴▴▴ ', - ' ▴▪▪▪▪▴▴ ', - ' ▪▪▪▪▪ ', - ' ▪▪▪ ', - ' ▰ ', - ' ', - ' ' - ) - ); + it("180 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(180, true).getJGDSync(), + mkJGD( + "▦▴▴▴▪▪▪▦", + "▴▴▴▴▪▪▪▪", + "▴▴▴▴▪▪▪▪", + "▴▴▴▴▪▪▪▪", + "▪▪▪▪▴▴▴▴", + "▪▪▪▪▴▴▴▴", + "▪▪▪▪▴▴▴▴", + "▰▪▪▪▴▴▴▰" + ) + ); }); - it('270 degrees', () => { - imgSrc - .clone() - .rotate(270, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ▦▪▪▪▴▴▴▰ ', - ' ▪▪▪▪▴▴▴▴ ', - ' ▪▪▪▪▴▴▴▴ ', - ' ▪▪▪▪▴▴▴▴ ', - ' ▴▴▴▴▪▪▪▪ ', - ' ▴▴▴▴▪▪▪▪ ', - ' ▴▴▴▴▪▪▪▪ ', - ' ▦▴▴▴▪▪▪▰ ', - ' ', - ' ' - ) - ); + it("225 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(225, true).getJGDSync(), + mkJGD( + " ", + " ▦ ", + " ▪▪▪ ", + " ▪▪▪▪▪ ", + " ▴▪▪▪▪▴▴ ", + " ▴▴▴▪▪▴▴▴▴ ", + " ▦▴▴▴▴▴▴▴▴▰▰ ", + " ▴▴▴▪▪▴▴▴▴ ", + " ▴▪▪▪▪▴▴ ", + " ▪▪▪▪▪ ", + " ▪▪▪ ", + " ▰ ", + " ", + " " + ) + ); }); - it('315 degrees', () => { - imgSrc - .clone() - .rotate(315, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ▰ ', - ' ▴▰▴ ', - ' ▴▴▴▴▴ ', - ' ▪▴▴▴▴▴▪ ', - ' ▪▪▪▴▴▴▪▪▪ ', - ' ▦▪▪▪▪▴▪▪▪▪▰ ', - ' ▪▪▪▪▴▪▪▪▪ ', - ' ▪▪▴▴▴▪▪ ', - ' ▴▴▴▴▴ ', - ' ▴▴▴ ', - ' ▦ ', - ' ', - ' ', - ' ' - ) - ); + it("270 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(270, true).getJGDSync(), + mkJGD( + "▦▪▪▪▴▴▴▰", + "▪▪▪▪▴▴▴▴", + "▪▪▪▪▴▴▴▴", + "▪▪▪▪▴▴▴▴", + "▴▴▴▴▪▪▪▪", + "▴▴▴▴▪▪▪▪", + "▴▴▴▴▪▪▪▪", + "▦▴▴▴▪▪▪▰" + ) + ); }); - it('360 degrees', () => { - imgSrc - .clone() - .rotate(360, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '▰▴▴▴▪▪▪▰ ', - '▴▴▴▴▪▪▪▪ ', - '▴▴▴▴▪▪▪▪ ', - '▴▴▴▴▪▪▪▪ ', - '▪▪▪▪▴▴▴▴ ', - '▪▪▪▪▴▴▴▴ ', - '▪▪▪▪▴▴▴▴ ', - '▦▪▪▪▴▴▴▦ ', - ' ', - ' ' - ) - ); + it("315 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(315, true).getJGDSync(), + mkJGD( + " ▰ ", + " ▴▰▴ ", + " ▴▴▴▴▴ ", + " ▪▴▴▴▴▴▪ ", + " ▪▪▪▴▴▴▪▪▪ ", + " ▦▪▪▪▪▴▪▪▪▪▰ ", + " ▪▪▪▪▴▪▪▪▪ ", + " ▪▪▴▴▴▪▪ ", + " ▴▴▴▴▴ ", + " ▴▴▴ ", + " ▦ ", + " ", + " ", + " " + ) + ); + }); + + it("360 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(360, true).getJGDSync(), + mkJGD( + "▰▴▴▴▪▪▪▰", + "▴▴▴▴▪▪▪▪", + "▴▴▴▴▪▪▪▪", + "▴▴▴▴▪▪▪▪", + "▪▪▪▪▴▴▴▴", + "▪▪▪▪▴▴▴▴", + "▪▪▪▪▴▴▴▴", + "▦▪▪▪▴▴▴▦" + ) + ); }); }); -describe('Rotate a image with odd size', () => { +describe("Rotate a image with odd size", () => { let imgSrc = null; - before(done => { + before((done) => { jimp .read( mkJGD( - '▴▴▴▦▪▪▪', - '▴▴▴▦▪▪▪', - '▴▴▴▦▪▪▪', - '▦▦▦▦▦▦▦', - '▴▴▴▦▴▴▴', - '▴▴▴▦▴▴▴', - '▴▴▴▦▴▴▴' + "▴▴▴▦▪▪▪", + "▴▴▴▦▪▪▪", + "▴▴▴▦▪▪▪", + "▦▦▦▦▦▦▦", + "▴▴▴▦▴▴▴", + "▴▴▴▦▴▴▴", + "▴▴▴▦▴▴▴" ) ) - .then(imgJimp => { + .then((imgJimp) => { imgSrc = imgJimp; done(); }) .catch(done); }); - it('45 degrees', () => { - imgSrc - .clone() - .rotate(45, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▪ ', - ' ▪▪▪ ', - ' ▦▪▪▪▦ ', - ' ▴▴▦▪▦▴▴ ', - ' ▴▴▴▴▦▴▴▴▴ ', - ' ▴▴▦▴▦▴▴ ', - ' ▦▴▴▴▦ ', - ' ▴▴▴ ', - ' ▴ ', - ' ', - ' ' - ) - ); + it("45 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(45, true).getJGDSync(), + mkJGD( + " ", + " ▪ ", + " ▪▪▪ ", + " ▦▪▪▪▦ ", + " ▴▴▦▪▦▴▴ ", + " ▴▴▴▴▦▴▴▴▴ ", + " ▴▴▦▴▦▴▴ ", + " ▦▴▴▴▦ ", + " ▴▴▴ ", + " ▴ ", + " ", + " " + ) + ); }); - it('135 degrees', () => { - imgSrc - .clone() - .rotate(135, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▴ ', - ' ▴▴▴ ', - ' ▦▴▴▴▦ ', - ' ▪▪▦▴▦▴▴ ', - ' ▪▪▪▪▦▴▴▴▴ ', - ' ▪▪▦▴▦▴▴ ', - ' ▦▴▴▴▦ ', - ' ▴▴▴ ', - ' ▴ ', - ' ', - ' ' - ) - ); + it("135 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(135, true).getJGDSync(), + mkJGD( + " ", + " ▴ ", + " ▴▴▴ ", + " ▦▴▴▴▦ ", + " ▪▪▦▴▦▴▴ ", + " ▪▪▪▪▦▴▴▴▴ ", + " ▪▪▦▴▦▴▴ ", + " ▦▴▴▴▦ ", + " ▴▴▴ ", + " ▴ ", + " ", + " " + ) + ); }); - it('225 degrees', () => { - imgSrc - .clone() - .rotate(225, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▴ ', - ' ▴▴▴ ', - ' ▦▴▴▴▦ ', - ' ▴▴▦▴▦▴▴ ', - ' ▴▴▴▴▦▴▴▴▴ ', - ' ▴▴▦▪▦▴▴ ', - ' ▦▪▪▪▦ ', - ' ▪▪▪ ', - ' ▪ ', - ' ', - ' ' - ) - ); + it("225 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(225, true).getJGDSync(), + mkJGD( + " ", + " ▴ ", + " ▴▴▴ ", + " ▦▴▴▴▦ ", + " ▴▴▦▴▦▴▴ ", + " ▴▴▴▴▦▴▴▴▴ ", + " ▴▴▦▪▦▴▴ ", + " ▦▪▪▪▦ ", + " ▪▪▪ ", + " ▪ ", + " ", + " " + ) + ); }); - it('315 degrees', () => { - imgSrc - .clone() - .rotate(315, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▴ ', - ' ▴▴▴ ', - ' ▦▴▴▴▦ ', - ' ▴▴▦▴▦▪▪ ', - ' ▴▴▴▴▦▪▪▪▪ ', - ' ▴▴▦▴▦▪▪ ', - ' ▦▴▴▴▦ ', - ' ▴▴▴ ', - ' ▴ ', - ' ', - ' ' - ) - ); + it("315 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(315, true).getJGDSync(), + mkJGD( + " ", + " ▴ ", + " ▴▴▴ ", + " ▦▴▴▴▦ ", + " ▴▴▦▴▦▪▪ ", + " ▴▴▴▴▦▪▪▪▪ ", + " ▴▴▦▴▦▪▪ ", + " ▦▴▴▴▦ ", + " ▴▴▴ ", + " ▴ ", + " ", + " " + ) + ); }); }); -describe('Rotate a non-square image', () => { +describe("Rotate a non-square image", () => { let imgSrc = null; - before(done => { + before((done) => { jimp - .read(mkJGD('▴▴▴▴▪▪▪▪', '▴▴▴▴▪▪▪▪', '▦▦▦▦▴▴▴▴', '▦▦▦▦▴▴▴▴')) - .then(imgJimp => { + .read(mkJGD("▴▴▴▴▪▪▪▪", "▴▴▴▴▪▪▪▪", "▦▦▦▦▴▴▴▴", "▦▦▦▦▴▴▴▴")) + .then((imgJimp) => { imgSrc = imgJimp; done(); }) .catch(done); }); - it('1 degrees', () => { - imgSrc - .clone() - .rotate(1, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - '▴▴▴▴▪▪▪▪ ', - '▴▴▴▴▪▪▪▪ ', - '▦▦▦▦▴▴▴▴ ', - '▦▦▦▦▴▴▴▴ ', - ' ', - ' ' - ) - ); + it("1 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(1, true).getJGDSync(), + mkJGD( + "▴▴▴▴▪▪▪▪ ", + "▴▴▴▴▪▪▪▪ ", + "▦▦▦▦▴▴▴▴ ", + "▦▦▦▦▴▴▴▴ ", + " ", + " " + ) + ); }); - it('10 degrees', () => { - imgSrc - .clone() - .rotate(10, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ▪ ', - ' ▴▴▴▪▪▪▪ ', - '▴▴▴▴▪▪▪▴ ', - '▴▴▦▦▴▴▴▴ ', - '▦▦▦▦▴▴▴ ', - '▦▦ ', - ' ', - ' ' - ) - ); + it("10 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(10, true).getJGDSync(), + mkJGD( + " ▪ ", + " ▴▴▴▪▪▪▪ ", + "▴▴▴▴▪▪▪▴ ", + "▴▴▦▦▴▴▴▴ ", + "▦▦▦▦▴▴▴ ", + "▦▦ ", + " ", + " " + ) + ); }); - it('30 degrees', () => { - imgSrc - .clone() - .rotate(30, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▪▪ ', - ' ▪▪▪▪ ', - ' ▴▴▪▪▴▴▴ ', - '▴▴▴▦▴▴▴ ', - '▴▴▦▦▴▴ ', - '▦▦▦▦ ', - ' ▦ ', - ' ', - ' ' - ) - ); + it("30 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(30, true).getJGDSync(), + mkJGD( + " ", + " ▪▪ ", + " ▪▪▪▪ ", + " ▴▴▪▪▴▴▴ ", + "▴▴▴▦▴▴▴ ", + "▴▴▦▦▴▴ ", + "▦▦▦▦ ", + " ▦ ", + " ", + " " + ) + ); }); - it('45 degrees', () => { - imgSrc - .clone() - .rotate(45, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▪▪ ', - ' ▪▪▪▴ ', - ' ▴▪▪▴▴▴ ', - ' ▴▴▴▴▴▴ ', - '▴▴▴▦▦▴ ', - '▴▴▦▦▦ ', - ' ▦▦▦ ', - ' ▦ ', - ' ' - ) - ); + it("45 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(45, true).getJGDSync(), + mkJGD( + " ", + " ▪▪ ", + " ▪▪▪▴ ", + " ▴▪▪▴▴▴ ", + " ▴▴▴▴▴▴ ", + "▴▴▴▦▦▴ ", + "▴▴▦▦▦ ", + " ▦▦▦ ", + " ▦ ", + " " + ) + ); }); - it('90 degrees', () => { - imgSrc - .clone() - .rotate(90, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - '▪▪▴▴ ', - '▪▪▴▴ ', - '▪▪▴▴ ', - '▪▪▴▴ ', - '▴▴▦▦ ', - '▴▴▦▦ ', - '▴▴▦▦ ', - '▴▴▦▦ ', - ' ' - ) - ); + it("90 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(90, true).getJGDSync(), + mkJGD("▪▪▴▴", "▪▪▴▴", "▪▪▴▴", "▪▪▴▴", "▴▴▦▦", "▴▴▦▦", "▴▴▦▦", "▴▴▦▦") + ); }); - it('135 degrees', () => { - imgSrc - .clone() - .rotate(135, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▴ ', - ' ▴▴▴ ', - ' ▪▪▴▴▴ ', - ' ▪▪▪▴▦▦ ', - ' ▪▪▴▦▦▦ ', - ' ▴▴▴▦▦▦ ', - ' ▴▴▴▦ ', - ' ▴▴ ', - ' ' - ) - ); + it("-90 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(-90, true).getJGDSync(), + mkJGD("▦▦▴▴", "▦▦▴▴", "▦▦▴▴", "▦▦▴▴", "▴▴▪▪", "▴▴▪▪", "▴▴▪▪", "▴▴▪▪") + ); }); - it('180 degrees', () => { - imgSrc - .clone() - .rotate(180, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ', - ' ▴▴▴▴▦▦▦▦ ', - ' ▴▴▴▴▦▦▦▦ ', - ' ▪▪▪▪▴▴▴▴ ', - ' ▪▪▪▪▴▴▴▴ ', - ' ' - ) - ); + it("135 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(135, true).getJGDSync(), + mkJGD( + " ", + " ▴ ", + " ▴▴▴ ", + " ▪▪▴▴▴ ", + " ▪▪▪▴▦▦ ", + " ▪▪▴▦▦▦ ", + " ▴▴▴▦▦▦ ", + " ▴▴▴▦ ", + " ▴▴ ", + " " + ) + ); }); - it('225 degrees', () => { - imgSrc - .clone() - .rotate(225, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ▦ ', - ' ▦▦▦ ', - ' ▦▦▦▴▴ ', - ' ▴▦▦▴▴▴ ', - ' ▴▴▴▴▴▴ ', - ' ▴▴▴▪▪▴ ', - ' ▴▪▪▪ ', - ' ▪▪ ', - ' ', - ' ' - ) - ); + it("180 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(180, true).getJGDSync(), + mkJGD("▴▴▴▴▦▦▦▦", "▴▴▴▴▦▦▦▦", "▪▪▪▪▴▴▴▴", "▪▪▪▪▴▴▴▴") + ); }); - it('315 degrees', () => { - imgSrc - .clone() - .rotate(315, true) - .getJGDSync() - .should.be.sameJGD( - mkJGD( - ' ▴▴ ', - ' ▦▴▴▴ ', - '▦▦▦▴▴▴ ', - ' ▦▦▦▴▪▪ ', - ' ▦▦▴▪▪▪ ', - ' ▴▴▴▪▪ ', - ' ▴▴▴ ', - ' ▴ ', - ' ', - ' ' - ) - ); + it("225 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(225, true).getJGDSync(), + mkJGD( + " ▦ ", + " ▦▦▦ ", + " ▦▦▦▴▴ ", + " ▴▦▦▴▴▴ ", + " ▴▴▴▴▴▴ ", + " ▴▴▴▪▪▴ ", + " ▴▪▪▪ ", + " ▪▪ ", + " ", + " " + ) + ); + }); + + it("315 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(315, true).getJGDSync(), + mkJGD( + " ▴▴ ", + " ▦▴▴▴ ", + "▦▦▦▴▴▴ ", + " ▦▦▦▴▪▪ ", + " ▦▦▴▪▪▪ ", + " ▴▴▴▪▪ ", + " ▴▴▴ ", + " ▴ ", + " ", + " " + ) + ); + }); + it("-180 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(-180, true).getJGDSync(), + mkJGD("▴▴▴▴▦▦▦▦", "▴▴▴▴▦▦▦▦", "▪▪▪▪▴▴▴▴", "▪▪▪▪▴▴▴▴") + ); + }); + + it("-270 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(-270, true).getJGDSync(), + mkJGD("▪▪▴▴", "▪▪▴▴", "▪▪▴▴", "▪▪▴▴", "▴▴▦▦", "▴▴▦▦", "▴▴▦▦", "▴▴▦▦") + ); + }); +}); + +describe("Rotate a non-square image without resizing", () => { + let imgSrc = null; + before((done) => { + jimp + .read(mkJGD("□□□□□□□□", "▹▹▹▹▹▹▹▹", "▿▿▿▿▿▿▿▿", "□□□□□□□□")) + .then((imgJimp) => { + imgSrc = imgJimp; + done(); + }) + .catch(done); + }); + + it("90 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(90, false).getJGDSync(), + mkJGD(" □▹▿□ ", " □▹▿□ ", " □▹▿□ ", " □▹▿□ ") + ); + }); + + it("180 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(180, false).getJGDSync(), + mkJGD("□□□□□□□□", "▿▿▿▿▿▿▿▿", "▹▹▹▹▹▹▹▹", "□□□□□□□□") + ); + }); + + it("270 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(270, false).getJGDSync(), + mkJGD(" □▿▹□ ", " □▿▹□ ", " □▿▹□ ", " □▿▹□ ") + ); + }); + + it("45 degrees", () => { + expectToBeJGD( + imgSrc.clone().rotate(45, false).getJGDSync(), + mkJGD(" □▹▹▿□□ ", "□▹▹▿□□ ", "▹▹▿□□ ", "▹▿□□ ") + ); }); }); diff --git a/project starter code/node_modules/@jimp/plugin-scale/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-scale/CHANGELOG.md index 26394e0f..8d029143 100644 --- a/project starter code/node_modules/@jimp/plugin-scale/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/plugin-scale/CHANGELOG.md @@ -1,3 +1,51 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -12,7 +60,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -20,4 +68,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-scale/README.md b/project starter code/node_modules/@jimp/plugin-scale/README.md index d887b4d2..708a7771 100644 --- a/project starter code/node_modules/@jimp/plugin-scale/README.md +++ b/project starter code/node_modules/@jimp/plugin-scale/README.md @@ -14,10 +14,10 @@ Uniformly scales the image by a factor. - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.scale(2); image.scale(2, jimp.RESIZE_BEZIER); @@ -36,10 +36,10 @@ Scale the image to the largest size that fits inside the rectangle that has the - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.scaleToFit(100, 100); } diff --git a/project starter code/node_modules/@jimp/plugin-scale/dist/index.js b/project starter code/node_modules/@jimp/plugin-scale/dist/index.js index 635255a5..54e8b44a 100644 --- a/project starter code/node_modules/@jimp/plugin-scale/dist/index.js +++ b/project starter code/node_modules/@jimp/plugin-scale/dist/index.js @@ -3,74 +3,60 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - +exports.default = void 0; var _utils = require("@jimp/utils"); - -var _default = function _default() { - return { - /** - * Uniformly scales the image by a factor. - * @param {number} f the factor to scale the image by - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - scale: function scale(f, mode, cb) { - if (typeof f !== 'number') { - return _utils.throwError.call(this, 'f must be a number', cb); - } - - if (f < 0) { - return _utils.throwError.call(this, 'f must be a positive number', cb); - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - var w = this.bitmap.width * f; - var h = this.bitmap.height * f; - this.resize(w, h, mode); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Scale the image to the largest size that fits inside the rectangle that has the given width and height. - * @param {number} w the width to resize the image to - * @param {number} h the height to resize the image to - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - scaleToFit: function scaleToFit(w, h, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - var f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width; - this.scale(f, mode); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; +var _default = () => ({ + /** + * Uniformly scales the image by a factor. + * @param {number} f the factor to scale the image by + * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + scale(f, mode, cb) { + if (typeof f !== "number") { + return _utils.throwError.call(this, "f must be a number", cb); } - }; -}; - -exports["default"] = _default; + if (f < 0) { + return _utils.throwError.call(this, "f must be a positive number", cb); + } + if (typeof mode === "function" && typeof cb === "undefined") { + cb = mode; + mode = null; + } + const w = this.bitmap.width * f; + const h = this.bitmap.height * f; + this.resize(w, h, mode); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Scale the image to the largest size that fits inside the rectangle that has the given width and height. + * @param {number} w the width to resize the image to + * @param {number} h the height to resize the image to + * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + scaleToFit(w, h, mode, cb) { + if (typeof w !== "number" || typeof h !== "number") { + return _utils.throwError.call(this, "w and h must be numbers", cb); + } + if (typeof mode === "function" && typeof cb === "undefined") { + cb = mode; + mode = null; + } + const f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width; + this.scale(f, mode); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + } +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-scale/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-scale/dist/index.js.map index 28aeaa90..021c5555 100644 --- a/project starter code/node_modules/@jimp/plugin-scale/dist/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-scale/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["scale","f","mode","cb","throwError","call","w","bitmap","width","h","height","resize","scaleToFit"],"mappings":";;;;;;;AAAA;;eAEe;AAAA,SAAO;AACpB;;;;;;;AAOAA,IAAAA,KARoB,iBAQdC,CARc,EAQXC,IARW,EAQLC,EARK,EAQD;AACjB,UAAI,OAAOF,CAAP,KAAa,QAAjB,EAA2B;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AYG,MAAxC,GACID,CAAC,GAAG,KAAKF,MAAL,CAAYG,MADpB,GAEIJ,CAAC,GAAG,KAAKC,MAAL,CAAYC,KAHtB;AAIA,WAAKR,KAAL,CAAWC,CAAX,EAAcC,IAAd;;AAEA,UAAI,0BAAcC,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA9DmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\nexport default () => ({\n /**\n * Uniformly scales the image by a factor.\n * @param {number} f the factor to scale the image by\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scale(f, mode, cb) {\n if (typeof f !== 'number') {\n return throwError.call(this, 'f must be a number', cb);\n }\n\n if (f < 0) {\n return throwError.call(this, 'f must be a positive number', cb);\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n const w = this.bitmap.width * f;\n const h = this.bitmap.height * f;\n this.resize(w, h, mode);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Scale the image to the largest size that fits inside the rectangle that has the given width and height.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scaleToFit(w, h, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? h / this.bitmap.height\n : w / this.bitmap.width;\n this.scale(f, mode);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["scale","f","mode","cb","throwError","call","w","bitmap","width","h","height","resize","isNodePattern","scaleToFit"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\nexport default () => ({\n /**\n * Uniformly scales the image by a factor.\n * @param {number} f the factor to scale the image by\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scale(f, mode, cb) {\n if (typeof f !== \"number\") {\n return throwError.call(this, \"f must be a number\", cb);\n }\n\n if (f < 0) {\n return throwError.call(this, \"f must be a positive number\", cb);\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n const w = this.bitmap.width * f;\n const h = this.bitmap.height * f;\n this.resize(w, h, mode);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Scale the image to the largest size that fits inside the rectangle that has the given width and height.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scaleToFit(w, h, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? h / this.bitmap.height\n : w / this.bitmap.width;\n this.scale(f, mode);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAAwD,eAEzC,OAAO;EACpB;AACF;AACA;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MD,CAAC,GACLK,CAAC,GAAGG,CAAC,GAAG,IAAI,CAACF,MAAM,CAACC,KAAK,GAAG,IAAI,CAACD,MAAM,CAACG,MAAM,GAC1CD,CAAC,GAAG,IAAI,CAACF,MAAM,CAACG,MAAM,GACtBJ,CAAC,GAAG,IAAI,CAACC,MAAM,CAACC,KAAK;IAC3B,IAAI,CAACR,KAAK,CAACC,CAAC,EAAEC,IAAI,CAAC;IAEnB,IAAI,IAAAU,oBAAa,EAACT,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-scale/es/index.js b/project starter code/node_modules/@jimp/plugin-scale/es/index.js index 80050107..5f85aa5f 100644 --- a/project starter code/node_modules/@jimp/plugin-scale/es/index.js +++ b/project starter code/node_modules/@jimp/plugin-scale/es/index.js @@ -1,75 +1,53 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -var _default = function _default() { - return { - /** - * Uniformly scales the image by a factor. - * @param {number} f the factor to scale the image by - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - scale: function scale(f, mode, cb) { - if (typeof f !== 'number') { - return _utils.throwError.call(this, 'f must be a number', cb); - } - - if (f < 0) { - return _utils.throwError.call(this, 'f must be a positive number', cb); - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - var w = this.bitmap.width * f; - var h = this.bitmap.height * f; - this.resize(w, h, mode); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Scale the image to the largest size that fits inside the rectangle that has the given width and height. - * @param {number} w the width to resize the image to - * @param {number} h the height to resize the image to - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - scaleToFit: function scaleToFit(w, h, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - var f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width; - this.scale(f, mode); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; +import { isNodePattern, throwError } from "@jimp/utils"; +export default (() => ({ + /** + * Uniformly scales the image by a factor. + * @param {number} f the factor to scale the image by + * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + scale(f, mode, cb) { + if (typeof f !== "number") { + return throwError.call(this, "f must be a number", cb); } - }; -}; - -exports["default"] = _default; + if (f < 0) { + return throwError.call(this, "f must be a positive number", cb); + } + if (typeof mode === "function" && typeof cb === "undefined") { + cb = mode; + mode = null; + } + const w = this.bitmap.width * f; + const h = this.bitmap.height * f; + this.resize(w, h, mode); + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Scale the image to the largest size that fits inside the rectangle that has the given width and height. + * @param {number} w the width to resize the image to + * @param {number} h the height to resize the image to + * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + scaleToFit(w, h, mode, cb) { + if (typeof w !== "number" || typeof h !== "number") { + return throwError.call(this, "w and h must be numbers", cb); + } + if (typeof mode === "function" && typeof cb === "undefined") { + cb = mode; + mode = null; + } + const f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width; + this.scale(f, mode); + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + } +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-scale/es/index.js.map b/project starter code/node_modules/@jimp/plugin-scale/es/index.js.map index 28aeaa90..0cbef4fa 100644 --- a/project starter code/node_modules/@jimp/plugin-scale/es/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-scale/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["scale","f","mode","cb","throwError","call","w","bitmap","width","h","height","resize","scaleToFit"],"mappings":";;;;;;;AAAA;;eAEe;AAAA,SAAO;AACpB;;;;;;;AAOAA,IAAAA,KARoB,iBAQdC,CARc,EAQXC,IARW,EAQLC,EARK,EAQD;AACjB,UAAI,OAAOF,CAAP,KAAa,QAAjB,EAA2B;AACzB,eAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACD;;AAED,UAAIF,CAAC,GAAG,CAAR,EAAW;AACT,eAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,6BAAtB,EAAqDF,EAArD,CAAP;AACD;;AAED,UAAI,OAAOD,IAAP,KAAgB,UAAhB,IAA8B,OAAOC,EAAP,KAAc,WAAhD,EAA6D;AAC3DA,QAAAA,EAAE,GAAGD,IAAL;AACAA,QAAAA,IAAI,GAAG,IAAP;AACD;;AAED,UAAMI,CAAC,GAAG,KAAKC,MAAL,CAAYC,KAAZ,GAAoBP,CAA9B;AACA,UAAMQ,CAAC,GAAG,KAAKF,MAAL,CAAYG,MAAZ,GAAqBT,CAA/B;AACA,WAAKU,MAAL,CAAYL,CAAZ,EAAeG,CAAf,EAAkBP,IAAlB;;AAEA,UAAI,0BAAcC,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD,KA/BmB;;AAiCpB;;;;;;;;AAQAO,IAAAA,UAzCoB,sBAyCTN,CAzCS,EAyCNG,CAzCM,EAyCHP,IAzCG,EAyCGC,EAzCH,EAyCO;AACzB,UAAI,OAAOG,CAAP,KAAa,QAAb,IAAyB,OAAOG,CAAP,KAAa,QAA1C,EAAoD;AAClD,eAAOL,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,yBAAtB,EAAiDF,EAAjD,CAAP;AACD;;AAED,UAAI,OAAOD,IAAP,KAAgB,UAAhB,IAA8B,OAAOC,EAAP,KAAc,WAAhD,EAA6D;AAC3DA,QAAAA,EAAE,GAAGD,IAAL;AACAA,QAAAA,IAAI,GAAG,IAAP;AACD;;AAED,UAAMD,CAAC,GACLK,CAAC,GAAGG,CAAJ,GAAQ,KAAKF,MAAL,CAAYC,KAAZ,GAAoB,KAAKD,MAAL,CAAYG,MAAxC,GACID,CAAC,GAAG,KAAKF,MAAL,CAAYG,MADpB,GAEIJ,CAAC,GAAG,KAAKC,MAAL,CAAYC,KAHtB;AAIA,WAAKR,KAAL,CAAWC,CAAX,EAAcC,IAAd;;AAEA,UAAI,0BAAcC,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AA9DmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\nexport default () => ({\n /**\n * Uniformly scales the image by a factor.\n * @param {number} f the factor to scale the image by\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scale(f, mode, cb) {\n if (typeof f !== 'number') {\n return throwError.call(this, 'f must be a number', cb);\n }\n\n if (f < 0) {\n return throwError.call(this, 'f must be a positive number', cb);\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n const w = this.bitmap.width * f;\n const h = this.bitmap.height * f;\n this.resize(w, h, mode);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Scale the image to the largest size that fits inside the rectangle that has the given width and height.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scaleToFit(w, h, mode, cb) {\n if (typeof w !== 'number' || typeof h !== 'number') {\n return throwError.call(this, 'w and h must be numbers', cb);\n }\n\n if (typeof mode === 'function' && typeof cb === 'undefined') {\n cb = mode;\n mode = null;\n }\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? h / this.bitmap.height\n : w / this.bitmap.width;\n this.scale(f, mode);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["isNodePattern","throwError","scale","f","mode","cb","call","w","bitmap","width","h","height","resize","scaleToFit"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\nexport default () => ({\n /**\n * Uniformly scales the image by a factor.\n * @param {number} f the factor to scale the image by\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scale(f, mode, cb) {\n if (typeof f !== \"number\") {\n return throwError.call(this, \"f must be a number\", cb);\n }\n\n if (f < 0) {\n return throwError.call(this, \"f must be a positive number\", cb);\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n const w = this.bitmap.width * f;\n const h = this.bitmap.height * f;\n this.resize(w, h, mode);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Scale the image to the largest size that fits inside the rectangle that has the given width and height.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scaleToFit(w, h, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n\n const f =\n w / h > this.bitmap.width / this.bitmap.height\n ? h / this.bitmap.height\n : w / this.bitmap.width;\n this.scale(f, mode);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,aAAa;AAEvD,gBAAe,OAAO;EACpB;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,KAAK,CAACC,CAAC,EAAEC,IAAI,EAAEC,EAAE,EAAE;IACjB,IAAI,OAAOF,CAAC,KAAK,QAAQ,EAAE;MACzB,OAAOF,UAAU,CAACK,IAAI,CAAC,IAAI,EAAE,oBAAoB,EAAED,EAAE,CAAC;IACxD;IAEA,IAAIF,CAAC,GAAG,CAAC,EAAE;MACT,OAAOF,UAAU,CAACK,IAAI,CAAC,IAAI,EAAE,6BAA6B,EAAED,EAAE,CAAC;IACjE;IAEA,IAAI,OAAOD,IAAI,KAAK,UAAU,IAAI,OAAOC,EAAE,KAAK,WAAW,EAAE;MAC3DA,EAAE,GAAGD,IAAI;MACTA,IAAI,GAAG,IAAI;IACb;IAEA,MAAMG,CAAC,GAAG,IAAI,CAACC,MAAM,CAACC,KAAK,GAAGN,CAAC;IAC/B,MAAMO,CAAC,GAAG,IAAI,CAACF,MAAM,CAACG,MAAM,GAAGR,CAAC;IAChC,IAAI,CAACS,MAAM,CAACL,CAAC,EAAEG,CAAC,EAAEN,IAAI,CAAC;IAEvB,IAAIJ,aAAa,CAACK,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEO,UAAU,CAACN,CAAC,EAAEG,CAAC,EAAEN,IAAI,EAAEC,EAAE,EAAE;IACzB,IAAI,OAAOE,CAAC,KAAK,QAAQ,IAAI,OAAOG,CAAC,KAAK,QAAQ,EAAE;MAClD,OAAOT,UAAU,CAACK,IAAI,CAAC,IAAI,EAAE,yBAAyB,EAAED,EAAE,CAAC;IAC7D;IAEA,IAAI,OAAOD,IAAI,KAAK,UAAU,IAAI,OAAOC,EAAE,KAAK,WAAW,EAAE;MAC3DA,EAAE,GAAGD,IAAI;MACTA,IAAI,GAAG,IAAI;IACb;IAEA,MAAMD,CAAC,GACLI,CAAC,GAAGG,CAAC,GAAG,IAAI,CAACF,MAAM,CAACC,KAAK,GAAG,IAAI,CAACD,MAAM,CAACG,MAAM,GAC1CD,CAAC,GAAG,IAAI,CAACF,MAAM,CAACG,MAAM,GACtBJ,CAAC,GAAG,IAAI,CAACC,MAAM,CAACC,KAAK;IAC3B,IAAI,CAACP,KAAK,CAACC,CAAC,EAAEC,IAAI,CAAC;IAEnB,IAAIJ,aAAa,CAACK,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-scale/index.d.ts b/project starter code/node_modules/@jimp/plugin-scale/index.d.ts index dcf58180..28c26ba2 100644 --- a/project starter code/node_modules/@jimp/plugin-scale/index.d.ts +++ b/project starter code/node_modules/@jimp/plugin-scale/index.d.ts @@ -1,10 +1,15 @@ -import { ImageCallback } from '@jimp/core'; +import { ImageCallback } from "@jimp/core"; interface Scale { scale(f: number, cb?: ImageCallback): this; scale(f: number, mode?: string, cb?: ImageCallback): this; scaleToFit(w: number, h: number, cb?: ImageCallback): this; - scaleToFit(w: number, h: number, mode?: string, cb?: ImageCallback): this; + scaleToFit( + w: number, + h: number, + mode?: string, + cb?: ImageCallback + ): this; } -export default function(): Scale; +export default function (): Scale; diff --git a/project starter code/node_modules/@jimp/plugin-scale/package.json b/project starter code/node_modules/@jimp/plugin-scale/package.json index edc84ff5..a4295426 100644 --- a/project starter code/node_modules/@jimp/plugin-scale/package.json +++ b/project starter code/node_modules/@jimp/plugin-scale/package.json @@ -1,9 +1,10 @@ { "name": "@jimp/plugin-scale", - "version": "0.16.2", + "version": "0.22.12", "description": "scale an image.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { "build": "npm run build:node:production && npm run build:module", @@ -17,8 +18,7 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", @@ -27,5 +27,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/plugin-scale/src/index.js b/project starter code/node_modules/@jimp/plugin-scale/src/index.js index 4670f228..f67ce2b3 100644 --- a/project starter code/node_modules/@jimp/plugin-scale/src/index.js +++ b/project starter code/node_modules/@jimp/plugin-scale/src/index.js @@ -1,4 +1,4 @@ -import { isNodePattern, throwError } from '@jimp/utils'; +import { isNodePattern, throwError } from "@jimp/utils"; export default () => ({ /** @@ -9,15 +9,15 @@ export default () => ({ * @returns {Jimp} this for chaining of methods */ scale(f, mode, cb) { - if (typeof f !== 'number') { - return throwError.call(this, 'f must be a number', cb); + if (typeof f !== "number") { + return throwError.call(this, "f must be a number", cb); } if (f < 0) { - return throwError.call(this, 'f must be a positive number', cb); + return throwError.call(this, "f must be a positive number", cb); } - if (typeof mode === 'function' && typeof cb === 'undefined') { + if (typeof mode === "function" && typeof cb === "undefined") { cb = mode; mode = null; } @@ -42,11 +42,11 @@ export default () => ({ * @returns {Jimp} this for chaining of methods */ scaleToFit(w, h, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return throwError.call(this, 'w and h must be numbers', cb); + if (typeof w !== "number" || typeof h !== "number") { + return throwError.call(this, "w and h must be numbers", cb); } - if (typeof mode === 'function' && typeof cb === 'undefined') { + if (typeof mode === "function" && typeof cb === "undefined") { cb = mode; mode = null; } @@ -62,5 +62,5 @@ export default () => ({ } return this; - } + }, }); diff --git a/project starter code/node_modules/@jimp/plugin-shadow/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-shadow/CHANGELOG.md index 4642075d..51272b3f 100644 --- a/project starter code/node_modules/@jimp/plugin-shadow/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/plugin-shadow/CHANGELOG.md @@ -1,3 +1,65 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.22.0 (Mon Feb 06 2023) + +#### 🏠 Internal + +- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Daniel Holmes ([@danielholmes](https://github.com/danielholmes)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -12,7 +74,7 @@ # v0.9.4 (Tue Mar 03 2020) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/plugin-shadow` - Update plugin-shadow type definition. [#841](https://github.com/oliver-moran/jimp/pull/841) ([@lekoaf](https://github.com/lekoaf)) @@ -25,7 +87,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -33,4 +95,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-shadow/README.md b/project starter code/node_modules/@jimp/plugin-shadow/README.md index 5258bc38..b068cd22 100644 --- a/project starter code/node_modules/@jimp/plugin-shadow/README.md +++ b/project starter code/node_modules/@jimp/plugin-shadow/README.md @@ -16,10 +16,10 @@ - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.shadow(); // or diff --git a/project starter code/node_modules/@jimp/plugin-shadow/babel.config.js b/project starter code/node_modules/@jimp/plugin-shadow/babel.config.js index 60a6d805..13e2603a 100644 --- a/project starter code/node_modules/@jimp/plugin-shadow/babel.config.js +++ b/project starter code/node_modules/@jimp/plugin-shadow/babel.config.js @@ -1,38 +1,38 @@ -module.exports = api => { +module.exports = (api) => { api.cache(true); return { presets: [ [ - '@babel/env', + "@babel/env", { - useBuiltIns: 'usage' - } - ] + useBuiltIns: "usage", + }, + ], ], plugins: [ - '@babel/proposal-class-properties', - '@babel/syntax-object-rest-spread', - process.env.BABEL_ENV !== 'module' && 'add-module-exports', + "@babel/proposal-class-properties", + "@babel/syntax-object-rest-spread", + process.env.BABEL_ENV !== "module" && "add-module-exports", [ - 'transform-inline-environment-variables', - { include: ['BABEL_ENV', 'ENV'] } - ] + "transform-inline-environment-variables", + { include: ["BABEL_ENV", "ENV"] }, + ], ].filter(Boolean), env: { test: { - plugins: ['istanbul'] + plugins: ["istanbul"], }, development: { - plugins: [process.env.ENV !== 'browser' && 'source-map-support'].filter( + plugins: [process.env.ENV !== "browser" && "source-map-support"].filter( Boolean - ) + ), }, module: { - presets: [['@babel/env', { modules: false }]] - } - } + presets: [["@babel/env", { modules: false }]], + }, + }, }; }; diff --git a/project starter code/node_modules/@jimp/plugin-shadow/dist/index.js b/project starter code/node_modules/@jimp/plugin-shadow/dist/index.js index 2979db55..532dce71 100644 --- a/project starter code/node_modules/@jimp/plugin-shadow/dist/index.js +++ b/project starter code/node_modules/@jimp/plugin-shadow/dist/index.js @@ -3,10 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - +exports.default = void 0; var _utils = require("@jimp/utils"); - /** * Creates a circle out of an image. * @param {function(Error, Jimp)} options (optional) @@ -18,60 +16,52 @@ var _utils = require("@jimp/utils"); * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ -var _default = function _default() { - return { - shadow: function shadow() { - var _this = this; - - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var cb = arguments.length > 1 ? arguments[1] : undefined; - - if (typeof options === 'function') { - cb = options; - options = {}; - } - - var _options = options, - _options$opacity = _options.opacity, - opacity = _options$opacity === void 0 ? 0.7 : _options$opacity, - _options$size = _options.size, - size = _options$size === void 0 ? 1.1 : _options$size, - _options$x = _options.x, - x = _options$x === void 0 ? -25 : _options$x, - _options$y = _options.y, - y = _options$y === void 0 ? 25 : _options$y, - _options$blur = _options.blur, - blur = _options$blur === void 0 ? 5 : _options$blur; // clone the image - - var orig = this.clone(); - var shadow = this.clone(); // turn all it's pixels black - - shadow.scan(0, 0, shadow.bitmap.width, shadow.bitmap.height, function (x, y, idx) { - shadow.bitmap.data[idx] = 0x00; - shadow.bitmap.data[idx + 1] = 0x00; - shadow.bitmap.data[idx + 2] = 0x00; // up the opacity a little, - - shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(shadow.bitmap.data[idx + 3] * opacity); - _this.bitmap.data[idx] = 0x00; - _this.bitmap.data[idx + 1] = 0x00; - _this.bitmap.data[idx + 2] = 0x00; - _this.bitmap.data[idx + 3] = 0x00; - }); // enlarge it. This creates a "shadow". +var _default = () => ({ + shadow() { + let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + let cb = arguments.length > 1 ? arguments[1] : undefined; + if (typeof options === "function") { + cb = options; + options = {}; + } + const { + opacity = 0.7, + size = 1.1, + x = -25, + y = 25, + blur = 5 + } = options; - shadow.resize(shadow.bitmap.width * size, shadow.bitmap.height * size).blur(blur); // Then blit the "shadow" onto the background and the image on top of that. + // clone the image + const orig = this.clone(); + const shadow = this.clone(); - this.composite(shadow, x, y); - this.composite(orig, 0, 0); + // turn all it's pixels black + shadow.scan(0, 0, shadow.bitmap.width, shadow.bitmap.height, (x, y, idx) => { + shadow.bitmap.data[idx] = 0x00; + shadow.bitmap.data[idx + 1] = 0x00; + shadow.bitmap.data[idx + 2] = 0x00; + // up the opacity a little, + shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(shadow.bitmap.data[idx + 3] * opacity); + this.bitmap.data[idx] = 0x00; + this.bitmap.data[idx + 1] = 0x00; + this.bitmap.data[idx + 2] = 0x00; + this.bitmap.data[idx + 3] = 0x00; + }); - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } + // enlarge it. This creates a "shadow". + shadow.resize(shadow.bitmap.width * size, shadow.bitmap.height * size).blur(blur); - return this; + // Then blit the "shadow" onto the background and the image on top of that. + this.composite(shadow, x, y); + this.composite(orig, 0, 0); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); } - }; -}; - -exports["default"] = _default; + return this; + } +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-shadow/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-shadow/dist/index.js.map index 7f483603..8201f6fe 100644 --- a/project starter code/node_modules/@jimp/plugin-shadow/dist/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-shadow/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["shadow","options","cb","opacity","size","x","y","blur","orig","clone","scan","bitmap","width","height","idx","data","constructor","limit255","resize","composite","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;;;eAWe;AAAA,SAAO;AACpBA,IAAAA,MADoB,oBACK;AAAA;;AAAA,UAAlBC,OAAkB,uEAAR,EAAQ;AAAA,UAAJC,EAAI;;AACvB,UAAI,OAAOD,OAAP,KAAmB,UAAvB,EAAmC;AACjCC,QAAAA,EAAE,GAAGD,OAAL;AACAA,QAAAA,OAAO,GAAG,EAAV;AACD;;AAJsB,qBAM0CA,OAN1C;AAAA,sCAMfE,OANe;AAAA,UAMfA,OANe,iCAML,GANK;AAAA,mCAMAC,IANA;AAAA,UAMAA,IANA,8BAMO,GANP;AAAA,gCAMYC,CANZ;AAAA,UAMYA,CANZ,2BAMgB,CAAC,EANjB;AAAA,gCAMqBC,CANrB;AAAA,UAMqBA,CANrB,2BAMyB,EANzB;AAAA,mCAM6BC,IAN7B;AAAA,UAM6BA,IAN7B,8BAMoC,CANpC,kBAQvB;;AACA,UAAMC,IAAI,GAAG,KAAKC,KAAL,EAAb;AACA,UAAMT,MAAM,GAAG,KAAKS,KAAL,EAAf,CAVuB,CAYvB;;AACAT,MAAAA,MAAM,CAACU,IAAP,CACE,CADF,EAEE,CAFF,EAGEV,MAAM,CAACW,MAAP,CAAcC,KAHhB,EAIEZ,MAAM,CAACW,MAAP,CAAcE,MAJhB,EAKE,UAACR,CAAD,EAAIC,CAAJ,EAAOQ,GAAP,EAAe;AACbd,QAAAA,MAAM,CAACW,MAAP,CAAcI,IAAd,CAAmBD,GAAnB,IAA0B,IAA1B;AACAd,QAAAA,MAAM,CAACW,MAAP,CAAcI,IAAd,CAAmBD,GAAG,GAAG,CAAzB,IAA8B,IAA9B;AACAd,QAAAA,MAAM,CAACW,MAAP,CAAcI,IAAd,CAAmBD,GAAG,GAAG,CAAzB,IAA8B,IAA9B,CAHa,CAIb;;AACAd,QAAAA,MAAM,CAACW,MAAP,CAAcI,IAAd,CAAmBD,GAAG,GAAG,CAAzB,IAA8Bd,MAAM,CAACgB,WAAP,CAAmBC,QAAnB,CAC5BjB,MAAM,CAACW,MAAP,CAAcI,IAAd,CAAmBD,GAAG,GAAG,CAAzB,IAA8BX,OADF,CAA9B;AAIA,QAAA,KAAI,CAACQ,MAAL,CAAYI,IAAZ,CAAiBD,GAAjB,IAAwB,IAAxB;AACA,QAAA,KAAI,CAACH,MAAL,CAAYI,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,IAA5B;AACA,QAAA,KAAI,CAACH,MAAL,CAAYI,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,IAA5B;AACA,QAAA,KAAI,CAACH,MAAL,CAAYI,IAAZ,CAAiBD,GAAG,GAAG,CAAvB,IAA4B,IAA5B;AACD,OAlBH,EAbuB,CAkCvB;;AACAd,MAAAA,MAAM,CACHkB,MADH,CACUlB,MAAM,CAACW,MAAP,CAAcC,KAAd,GAAsBR,IADhC,EACsCJ,MAAM,CAACW,MAAP,CAAcE,MAAd,GAAuBT,IAD7D,EAEGG,IAFH,CAEQA,IAFR,EAnCuB,CAuCvB;;AACA,WAAKY,SAAL,CAAenB,MAAf,EAAuBK,CAAvB,EAA0BC,CAA1B;AACA,WAAKa,SAAL,CAAeX,IAAf,EAAqB,CAArB,EAAwB,CAAxB;;AAEA,UAAI,0BAAcN,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACkB,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAjDmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern } from '@jimp/utils';\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional)\n * opacity - opacity of the shadow between 0 and 1\n * size,- of the shadow\n * blur - how blurry the shadow is\n * x- x position of shadow\n * y - y position of shadow\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n shadow(options = {}, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n const { opacity = 0.7, size = 1.1, x = -25, y = 25, blur = 5 } = options;\n\n // clone the image\n const orig = this.clone();\n const shadow = this.clone();\n\n // turn all it's pixels black\n shadow.scan(\n 0,\n 0,\n shadow.bitmap.width,\n shadow.bitmap.height,\n (x, y, idx) => {\n shadow.bitmap.data[idx] = 0x00;\n shadow.bitmap.data[idx + 1] = 0x00;\n shadow.bitmap.data[idx + 2] = 0x00;\n // up the opacity a little,\n shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(\n shadow.bitmap.data[idx + 3] * opacity\n );\n\n this.bitmap.data[idx] = 0x00;\n this.bitmap.data[idx + 1] = 0x00;\n this.bitmap.data[idx + 2] = 0x00;\n this.bitmap.data[idx + 3] = 0x00;\n }\n );\n\n // enlarge it. This creates a \"shadow\".\n shadow\n .resize(shadow.bitmap.width * size, shadow.bitmap.height * size)\n .blur(blur);\n\n // Then blit the \"shadow\" onto the background and the image on top of that.\n this.composite(shadow, x, y);\n this.composite(orig, 0, 0);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["shadow","options","cb","opacity","size","x","y","blur","orig","clone","scan","bitmap","width","height","idx","data","constructor","limit255","resize","composite","isNodePattern","call"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional)\n * opacity - opacity of the shadow between 0 and 1\n * size,- of the shadow\n * blur - how blurry the shadow is\n * x- x position of shadow\n * y - y position of shadow\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n shadow(options = {}, cb) {\n if (typeof options === \"function\") {\n cb = options;\n options = {};\n }\n\n const { opacity = 0.7, size = 1.1, x = -25, y = 25, blur = 5 } = options;\n\n // clone the image\n const orig = this.clone();\n const shadow = this.clone();\n\n // turn all it's pixels black\n shadow.scan(\n 0,\n 0,\n shadow.bitmap.width,\n shadow.bitmap.height,\n (x, y, idx) => {\n shadow.bitmap.data[idx] = 0x00;\n shadow.bitmap.data[idx + 1] = 0x00;\n shadow.bitmap.data[idx + 2] = 0x00;\n // up the opacity a little,\n shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(\n shadow.bitmap.data[idx + 3] * opacity\n );\n\n this.bitmap.data[idx] = 0x00;\n this.bitmap.data[idx + 1] = 0x00;\n this.bitmap.data[idx + 2] = 0x00;\n this.bitmap.data[idx + 3] = 0x00;\n }\n );\n\n // enlarge it. This creates a \"shadow\".\n shadow\n .resize(shadow.bitmap.width * size, shadow.bitmap.height * size)\n .blur(blur);\n\n // Then blit the \"shadow\" onto the background and the image on top of that.\n this.composite(shadow, x, y);\n this.composite(orig, 0, 0);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA,eAWe,OAAO;EACpBA,MAAM,GAAmB;IAAA,IAAlBC,OAAO,uEAAG,CAAC,CAAC;IAAA,IAAEC,EAAE;IACrB,IAAI,OAAOD,OAAO,KAAK,UAAU,EAAE;MACjCC,EAAE,GAAGD,OAAO;MACZA,OAAO,GAAG,CAAC,CAAC;IACd;IAEA,MAAM;MAAEE,OAAO,GAAG,GAAG;MAAEC,IAAI,GAAG,GAAG;MAAEC,CAAC,GAAG,CAAC,EAAE;MAAEC,CAAC,GAAG,EAAE;MAAEC,IAAI,GAAG;IAAE,CAAC,GAAGN,OAAO;;IAExE;IACA,MAAMO,IAAI,GAAG,I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C,CAAC,CAAC;IAC5B,IAAI,CAACa,SAAS,CAACX,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;IAE1B,IAAI,IAAAY,oBAAa,EAAClB,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACmB,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-shadow/es/index.js b/project starter code/node_modules/@jimp/plugin-shadow/es/index.js index 038b3ee1..3fc0485f 100644 --- a/project starter code/node_modules/@jimp/plugin-shadow/es/index.js +++ b/project starter code/node_modules/@jimp/plugin-shadow/es/index.js @@ -1,11 +1,4 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); +import { isNodePattern } from "@jimp/utils"; /** * Creates a circle out of an image. @@ -18,59 +11,49 @@ var _utils = require("@jimp/utils"); * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ -var _default = function _default() { - return { - shadow: function shadow() { - var _this = this; - - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var cb = arguments.length > 1 ? arguments[1] : undefined; - - if (typeof options === 'function') { - cb = options; - options = {}; - } - - var _options = options, - _options$opacity = _options.opacity, - opacity = _options$opacity === void 0 ? 0.7 : _options$opacity, - _options$size = _options.size, - size = _options$size === void 0 ? 1.1 : _options$size, - _options$x = _options.x, - x = _options$x === void 0 ? -25 : _options$x, - _options$y = _options.y, - y = _options$y === void 0 ? 25 : _options$y, - _options$blur = _options.blur, - blur = _options$blur === void 0 ? 5 : _options$blur; // clone the image - - var orig = this.clone(); - var shadow = this.clone(); // turn all it's pixels black - - shadow.scan(0, 0, shadow.bitmap.width, shadow.bitmap.height, function (x, y, idx) { - shadow.bitmap.data[idx] = 0x00; - shadow.bitmap.data[idx + 1] = 0x00; - shadow.bitmap.data[idx + 2] = 0x00; // up the opacity a little, - - shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(shadow.bitmap.data[idx + 3] * opacity); - _this.bitmap.data[idx] = 0x00; - _this.bitmap.data[idx + 1] = 0x00; - _this.bitmap.data[idx + 2] = 0x00; - _this.bitmap.data[idx + 3] = 0x00; - }); // enlarge it. This creates a "shadow". - - shadow.resize(shadow.bitmap.width * size, shadow.bitmap.height * size).blur(blur); // Then blit the "shadow" onto the background and the image on top of that. - - this.composite(shadow, x, y); - this.composite(orig, 0, 0); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; +export default (() => ({ + shadow() { + let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + let cb = arguments.length > 1 ? arguments[1] : undefined; + if (typeof options === "function") { + cb = options; + options = {}; } - }; -}; - -exports["default"] = _default; + const { + opacity = 0.7, + size = 1.1, + x = -25, + y = 25, + blur = 5 + } = options; + + // clone the image + const orig = this.clone(); + const shadow = this.clone(); + + // turn all it's pixels black + shadow.scan(0, 0, shadow.bitmap.width, shadow.bitmap.height, (x, y, idx) => { + shadow.bitmap.data[idx] = 0x00; + shadow.bitmap.data[idx + 1] = 0x00; + shadow.bitmap.data[idx + 2] = 0x00; + // up the opacity a little, + shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(shadow.bitmap.data[idx + 3] * opacity); + this.bitmap.data[idx] = 0x00; + this.bitmap.data[idx + 1] = 0x00; + this.bitmap.data[idx + 2] = 0x00; + this.bitmap.data[idx + 3] = 0x00; + }); + + // enlarge it. This creates a "shadow". + shadow.resize(shadow.bitmap.width * size, shadow.bitmap.height * size).blur(blur); + + // Then blit the "shadow" onto the background and the image on top of that. + this.composite(shadow, x, y); + this.composite(orig, 0, 0); + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + } +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-shadow/es/index.js.map b/project starter code/node_modules/@jimp/plugin-shadow/es/index.js.map index 7f483603..eefaa01c 100644 --- a/project starter code/node_modules/@jimp/plugin-shadow/es/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-shadow/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["shadow","options","cb","opacity","size","x","y","blur","orig","clone","scan","bitmap","width","height","idx","data","constructor","limit255","resize","composite","call"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;;;eAWe;AAAA,SAAO;AACpBA,IAAAA,MADoB,oBACK;AAAA;;AAAA,UAAlBC,OAAkB,uEAAR,EAAQ;AAAA,UAAJC,EAAI;;AACvB,UAAI,OAAOD,OAAP,KAAmB,UAAvB,EAAmC;AACjCC,QAAAA,EAAE,GAAGD,OAAL;AACAA,QAAAA,OAAO,GAAG,EAAV;AACD;;AAJsB,qBAM0CA,OAN1C;AAAA,sCAMfE,OANe;AAAA,UAMfA,OANe,iCAML,GANK;AAAA,mCAMAC,IANA;AAAA,UAMAA,IANA,8BAMO,GANP;AAAA,gCAMYC,CANZ;AAAA,UAMYA,CANZ,2BAMgB,CAAC,EANjB;AAAA,gCAMqBC,CANrB;AAAA,UAMqBA,CANrB,2BAMyB,EANzB;AAAA,mCAM6BC,IAN7B;AAAA,UAM6BA,IAN7B,8BAMoC,CANpC,kBAQvB;;AACA,UAAMC,IAAI,GAAG,KAAKC,KAAL,EAAb;AACA,UAAMT,MAAM,GAAG,KAAKS,KAAL,EAAf,CAVuB,CAYvB;;AACAT,MAAAA,MAAM,CAACU,IAAP,CACE,CADF,EAEE,CAFF,EAGEV,MAAM,CAACW,MAAP,CAAcC,KAHhB,EAIEZ,MAAM,CAACW,MAAP,CAAcE,MAJhB,EAKE,UAACR,CAAD,EAAIC,CAAJ,EAAOQ,GAAP,EAAe;AACbd,QAAAA,MAAM,CAACW,MAAP,CAAcI,IAAd,CAAmBD,GAAnB,IAA0B,IAA1B;AACAd,QAAAA,MAAM,CAACW,MAAP,CAAcI,I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circle out of an image.\n * @param {function(Error, Jimp)} options (optional)\n * opacity - opacity of the shadow between 0 and 1\n * size,- of the shadow\n * blur - how blurry the shadow is\n * x- x position of shadow\n * y - y position of shadow\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n shadow(options = {}, cb) {\n if (typeof options === 'function') {\n cb = options;\n options = {};\n }\n\n const { opacity = 0.7, size = 1.1, x = -25, y = 25, blur = 5 } = options;\n\n // clone the image\n const orig = this.clone();\n const shadow = this.clone();\n\n // turn all it's pixels black\n shadow.scan(\n 0,\n 0,\n shadow.bitmap.width,\n shadow.bitmap.height,\n (x, y, idx) => {\n shadow.bitmap.data[idx] = 0x00;\n shadow.bitmap.data[idx + 1] = 0x00;\n shadow.bitmap.data[idx + 2] = 0x00;\n // up the opacity a little,\n shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(\n shadow.bitmap.data[idx + 3] * opacity\n );\n\n this.bitmap.data[idx] = 0x00;\n this.bitmap.data[idx + 1] = 0x00;\n this.bitmap.data[idx + 2] = 0x00;\n this.bitmap.data[idx + 3] = 0x00;\n }\n );\n\n // enlarge it. This creates a \"shadow\".\n shadow\n .resize(shadow.bitmap.width * size, shadow.bitmap.height * size)\n .blur(blur);\n\n // Then blit the \"shadow\" onto the background and the image on top of that.\n this.composite(shadow, x, y);\n this.composite(orig, 0, 0);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["isNodePattern","shadow","options","cb","opacity","size","x","y","blur","orig","clone","scan","bitmap","width","height","idx","data","constructor","limit255","resize","composite","call"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional)\n * opacity - opacity of the shadow between 0 and 1\n * size,- of the shadow\n * blur - how blurry the shadow is\n * x- x position of shadow\n * y - y position of shadow\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default () => ({\n shadow(options = {}, cb) {\n if (typeof options === \"function\") {\n cb = options;\n options = {};\n }\n\n const { opacity = 0.7, size = 1.1, x = -25, y = 25, blur = 5 } = options;\n\n // clone the image\n const orig = this.clone();\n const shadow = this.clone();\n\n // turn all it's pixels black\n shadow.scan(\n 0,\n 0,\n shadow.bitmap.width,\n shadow.bitmap.height,\n (x, y, idx) => {\n shadow.bitmap.data[idx] = 0x00;\n shadow.bitmap.data[idx + 1] = 0x00;\n shadow.bitmap.data[idx + 2] = 0x00;\n // up the opacity a little,\n shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(\n shadow.bitmap.data[idx + 3] * opacity\n );\n\n this.bitmap.data[idx] = 0x00;\n this.bitmap.data[idx + 1] = 0x00;\n this.bitmap.data[idx + 2] = 0x00;\n this.bitmap.data[idx + 3] = 0x00;\n }\n );\n\n // enlarge it. This creates a \"shadow\".\n shadow\n .resize(shadow.bitmap.width * size, shadow.bitmap.height * size)\n .blur(blur);\n\n // Then blit the \"shadow\" onto the background and the image on top of that.\n this.composite(shadow, x, y);\n this.composite(orig, 0, 0);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,QAAQ,aAAa;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;EACpBC,MAAM,GAAmB;IAAA,IAAlBC,OAAO,uEAAG,CAAC,CAAC;IAAA,IAAEC,EAAE;IACrB,IAAI,OAAOD,OAAO,KAAK,UAAU,EAAE;MACjCC,EAAE,GAAGD,OAAO;MACZA,OAAO,GAAG,CAAC,CAAC;IACd;IAEA,MAAM;MAAEE,OAAO,GAAG,GAAG;MAAEC,IAAI,GAAG,GAAG;MAAEC,CAAC,GAAG,CAAC,EAAE;MAAEC,CAAC,GAAG,EAAE;MAAE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AAI,CAAC;;IAEb;IACA,IAAI,CAACY,SAAS,CAACnB,MAAM,EAAEK,CAAC,EAAEC,CAAC,CAAC;IAC5B,IAAI,CAACa,SAAS,CAACX,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;IAE1B,IAAIT,aAAa,CAACG,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACkB,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-shadow/index.d.ts b/project starter code/node_modules/@jimp/plugin-shadow/index.d.ts index 75f6bae0..4e3c4841 100644 --- a/project starter code/node_modules/@jimp/plugin-shadow/index.d.ts +++ b/project starter code/node_modules/@jimp/plugin-shadow/index.d.ts @@ -1,15 +1,17 @@ -import { ImageCallback } from '@jimp/core'; +import { ImageCallback } from "@jimp/core"; interface Shadow { - shadow(options?: { - size?: number, - opacity?: number, - blur: number, - x?: number, - y?: number - }, - cb?: ImageCallback): this; + shadow( + options?: { + size?: number; + opacity?: number; + blur: number; + x?: number; + y?: number; + }, + cb?: ImageCallback + ): this; shadow(cb?: ImageCallback): this; } -export default function(): Shadow; +export default function (): Shadow; diff --git a/project starter code/node_modules/@jimp/plugin-shadow/package.json b/project starter code/node_modules/@jimp/plugin-shadow/package.json index d384ab69..f1c0c592 100644 --- a/project starter code/node_modules/@jimp/plugin-shadow/package.json +++ b/project starter code/node_modules/@jimp/plugin-shadow/package.json @@ -1,12 +1,13 @@ { "name": "@jimp/plugin-shadow", - "version": "0.16.2", + "version": "0.22.12", "description": "Creates a shadow on an image.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js", "test:watch": "npm run test -- --reporter min --watch", "test:coverage": "nyc npm run test", "build": "npm run build:node:production && npm run build:module", @@ -20,8 +21,7 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", @@ -29,13 +29,13 @@ "@jimp/plugin-resize": ">=0.3.5" }, "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/plugin-blur": "^0.16.2", - "@jimp/plugin-resize": "^0.16.2", - "@jimp/test-utils": "^0.16.2" + "@jimp/custom": "^0.22.12", + "@jimp/plugin-blur": "^0.22.12", + "@jimp/plugin-resize": "^0.22.12", + "@jimp/test-utils": "^0.22.12" }, "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/plugin-shadow/src/index.js b/project starter code/node_modules/@jimp/plugin-shadow/src/index.js index be696b8c..81c23c41 100644 --- a/project starter code/node_modules/@jimp/plugin-shadow/src/index.js +++ b/project starter code/node_modules/@jimp/plugin-shadow/src/index.js @@ -1,4 +1,4 @@ -import { isNodePattern } from '@jimp/utils'; +import { isNodePattern } from "@jimp/utils"; /** * Creates a circle out of an image. @@ -13,7 +13,7 @@ import { isNodePattern } from '@jimp/utils'; */ export default () => ({ shadow(options = {}, cb) { - if (typeof options === 'function') { + if (typeof options === "function") { cb = options; options = {}; } @@ -60,5 +60,5 @@ export default () => ({ } return this; - } + }, }); diff --git a/project starter code/node_modules/@jimp/plugin-shadow/test/shadow.test.js b/project starter code/node_modules/@jimp/plugin-shadow/test/shadow.test.js index 6ef36184..2ee56166 100644 --- a/project starter code/node_modules/@jimp/plugin-shadow/test/shadow.test.js +++ b/project starter code/node_modules/@jimp/plugin-shadow/test/shadow.test.js @@ -1,31 +1,32 @@ -import { Jimp, mkJGD, getTestDir } from '@jimp/test-utils'; -import configure from '@jimp/custom'; -import resize from '@jimp/plugin-resize'; -import blur from '@jimp/plugin-blur'; +import { Jimp, mkJGD, getTestDir } from "@jimp/test-utils"; +import configure from "@jimp/custom"; +import resize from "@jimp/plugin-resize"; +import blur from "@jimp/plugin-blur"; +import expect from "@storybook/expect"; -import shadow from '../src'; +import shadow from "../src"; const jimp = configure({ plugins: [shadow, resize, blur] }, Jimp); -describe('Shadow', () => { - it('creates a shadow', async () => { +describe("Shadow", () => { + it("creates a shadow", async () => { const expectedImg = await jimp.read( - getTestDir(__dirname) + '/images/shadow.png' + getTestDir(__dirname) + "/images/shadow.png" ); const testImage = await jimp.read( mkJGD( - ' ', - ' ◆◆ ', - ' ◆▦▦◆ ', - ' ◆▦▦▦▦◆ ', - ' ◆▦▦◆ ', - ' ◆◆ ', - ' ' + " ", + " ◆◆ ", + " ◆▦▦◆ ", + " ◆▦▦▦▦◆ ", + " ◆▦▦◆ ", + " ◆◆ ", + " " ) ); - testImage - .shadow({ x: -1, y: 1, blur: 1 }) - .bitmap.data.should.be.deepEqual(expectedImg.bitmap.data); + expect(testImage.shadow({ x: -1, y: 1, blur: 1 }).bitmap.data).toEqual( + expectedImg.bitmap.data + ); }); }); diff --git a/project starter code/node_modules/@jimp/plugin-threshold/CHANGELOG.md b/project starter code/node_modules/@jimp/plugin-threshold/CHANGELOG.md index 7cd6c3ac..7e842d38 100644 --- a/project starter code/node_modules/@jimp/plugin-threshold/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/plugin-threshold/CHANGELOG.md @@ -1,3 +1,65 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.22.0 (Mon Feb 06 2023) + +#### 🏠 Internal + +- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Daniel Holmes ([@danielholmes](https://github.com/danielholmes)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -24,7 +86,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -32,4 +94,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugin-threshold/README.md b/project starter code/node_modules/@jimp/plugin-threshold/README.md index 04cc3eb2..57271c3b 100644 --- a/project starter code/node_modules/@jimp/plugin-threshold/README.md +++ b/project starter code/node_modules/@jimp/plugin-threshold/README.md @@ -16,10 +16,10 @@ This is useful as a simplified method for processing scanned drawings, signature - @param {function(Error, Jimp)} cb (optional) a callback for when complete ```js -import jimp from 'jimp'; +import jimp from "jimp"; async function main() { - const image = await jimp.read('test/image.png'); + const image = await jimp.read("test/image.png"); image.threshold({ max: 150 }); // or diff --git a/project starter code/node_modules/@jimp/plugin-threshold/babel.config.js b/project starter code/node_modules/@jimp/plugin-threshold/babel.config.js index 60a6d805..13e2603a 100644 --- a/project starter code/node_modules/@jimp/plugin-threshold/babel.config.js +++ b/project starter code/node_modules/@jimp/plugin-threshold/babel.config.js @@ -1,38 +1,38 @@ -module.exports = api => { +module.exports = (api) => { api.cache(true); return { presets: [ [ - '@babel/env', + "@babel/env", { - useBuiltIns: 'usage' - } - ] + useBuiltIns: "usage", + }, + ], ], plugins: [ - '@babel/proposal-class-properties', - '@babel/syntax-object-rest-spread', - process.env.BABEL_ENV !== 'module' && 'add-module-exports', + "@babel/proposal-class-properties", + "@babel/syntax-object-rest-spread", + process.env.BABEL_ENV !== "module" && "add-module-exports", [ - 'transform-inline-environment-variables', - { include: ['BABEL_ENV', 'ENV'] } - ] + "transform-inline-environment-variables", + { include: ["BABEL_ENV", "ENV"] }, + ], ].filter(Boolean), env: { test: { - plugins: ['istanbul'] + plugins: ["istanbul"], }, development: { - plugins: [process.env.ENV !== 'browser' && 'source-map-support'].filter( + plugins: [process.env.ENV !== "browser" && "source-map-support"].filter( Boolean - ) + ), }, module: { - presets: [['@babel/env', { modules: false }]] - } - } + presets: [["@babel/env", { modules: false }]], + }, + }, }; }; diff --git a/project starter code/node_modules/@jimp/plugin-threshold/dist/index.js b/project starter code/node_modules/@jimp/plugin-threshold/dist/index.js index bf1d7ef0..91e7ff80 100644 --- a/project starter code/node_modules/@jimp/plugin-threshold/dist/index.js +++ b/project starter code/node_modules/@jimp/plugin-threshold/dist/index.js @@ -3,10 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - +exports.default = void 0; var _utils = require("@jimp/utils"); - /** * Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default * @param {number} options object @@ -16,52 +14,40 @@ var _utils = require("@jimp/utils"); * @param {number} cb (optional) a callback for when complete * @return {this} this for chaining of methods */ -var _default = function _default() { - return { - threshold: function threshold(_ref, cb) { - var _this = this; - - var max = _ref.max, - _ref$replace = _ref.replace, - replace = _ref$replace === void 0 ? 255 : _ref$replace, - _ref$autoGreyscale = _ref.autoGreyscale, - autoGreyscale = _ref$autoGreyscale === void 0 ? true : _ref$autoGreyscale; - - if (typeof max !== 'number') { - return _utils.throwError.call(this, 'max must be a number', cb); - } - - if (typeof replace !== 'number') { - return _utils.throwError.call(this, 'replace must be a number', cb); - } - - if (typeof autoGreyscale !== 'boolean') { - return _utils.throwError.call(this, 'autoGreyscale must be a boolean', cb); - } - - max = this.constructor.limit255(max); - replace = this.constructor.limit255(replace); - - if (autoGreyscale) { - this.greyscale(); - } - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var grey = _this.bitmap.data[idx] < max ? _this.bitmap.data[idx] : replace; - _this.bitmap.data[idx] = grey; - _this.bitmap.data[idx + 1] = grey; - _this.bitmap.data[idx + 2] = grey; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; +var _default = () => ({ + threshold(_ref, cb) { + let { + max, + replace = 255, + autoGreyscale = true + } = _ref; + if (typeof max !== "number") { + return _utils.throwError.call(this, "max must be a number", cb); } - }; -}; - -exports["default"] = _default; + if (typeof replace !== "number") { + return _utils.throwError.call(this, "replace must be a number", cb); + } + if (typeof autoGreyscale !== "boolean") { + return _utils.throwError.call(this, "autoGreyscale must be a boolean", cb); + } + max = this.constructor.limit255(max); + replace = this.constructor.limit255(replace); + if (autoGreyscale) { + this.greyscale(); + } + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => { + const grey = this.bitmap.data[idx] < max ? this.bitmap.data[idx] : replace; + this.bitmap.data[idx] = grey; + this.bitmap.data[idx + 1] = grey; + this.bitmap.data[idx + 2] = grey; + }); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + } +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-threshold/dist/index.js.map b/project starter code/node_modules/@jimp/plugin-threshold/dist/index.js.map index 7b0f4ece..45c0a7c7 100644 --- a/project starter code/node_modules/@jimp/plugin-threshold/dist/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-threshold/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["threshold","cb","max","replace","autoGreyscale","throwError","call","constructor","limit255","greyscale","scanQuiet","bitmap","width","height","x","y","idx","grey","data"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;eASe;AAAA,SAAO;AACpBA,IAAAA,SADoB,2BACoCC,EADpC,EACwC;AAAA;;AAAA,UAAhDC,GAAgD,QAAhDA,GAAgD;AA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,CAACN,MAAL,CAAYO,IAAZ,CAAiBF,GAAG,GAAG,CAAvB,IAA4BC,IAA5B;AACD,OAPD;;AASA,UAAI,0BAAchB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACK,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAnCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default\n * @param {number} options object\n * max: A number auto limited between 0 - 255\n * replace: (optional) A number auto limited between 0 - 255 (default 255)\n * autoGreyscale: (optional) A boolean whether to apply greyscale beforehand (default true)\n * @param {number} cb (optional) a callback for when complete\n * @return {this} this for chaining of methods\n */\nexport default () => ({\n threshold({ max, replace = 255, autoGreyscale = true }, cb) {\n if (typeof max !== 'number') {\n return throwError.call(this, 'max must be a number', cb);\n }\n\n if (typeof replace !== 'number') {\n return throwError.call(this, 'replace must be a number', cb);\n }\n\n if (typeof autoGreyscale !== 'boolean') {\n return throwError.call(this, 'autoGreyscale must be a boolean', cb);\n }\n\n max = this.constructor.limit255(max);\n replace = this.constructor.limit255(replace);\n\n if (autoGreyscale) {\n this.greyscale();\n }\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n const grey =\n this.bitmap.data[idx] < max ? this.bitmap.data[idx] : replace;\n\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["threshold","cb","max","replace","autoGreyscale","throwError","call","constructor","limit255","greyscale","scanQuiet","bitmap","width","height","x","y","idx","grey","data","isNodePattern"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default\n * @param {number} options object\n * max: A number auto limited between 0 - 255\n * replace: (optional) A number auto limited between 0 - 255 (default 255)\n * autoGreyscale: (optional) A boolean whether to apply greyscale beforehand (default true)\n * @param {number} cb (optional) a callback for when complete\n * @return {this} this for chaining of methods\n */\nexport default () => ({\n threshold({ max, replace = 255, autoGreyscale = true }, cb) {\n if (typeof max !== \"number\") {\n return throwError.call(this, \"max must be a number\", cb);\n }\n\n if (typeof replace !== \"number\") {\n return throwError.call(this, \"replace must be a number\", cb);\n }\n\n if (typeof autoGreyscale !== \"boolean\") {\n return throwError.call(this, \"autoGreyscale must be a boolean\", cb);\n }\n\n max = this.constructor.limit255(max);\n replace = this.constructor.limit255(replace);\n\n if (autoGreyscale) {\n this.greyscale();\n }\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n const grey =\n this.bitmap.data[idx] < max ? this.bitmap.data[idx] : replace;\n\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA,eASe,OAAO;EACpBA,SAAS,OAA+CC,EAAE,EAAE;IAAA,IAAlD;MAAEC,GAAG;MAAEC,OAAO,GAAG,GAAG;MAAEC,aAAa,GAAG;IAAK,CAAC;IACpD,IAAI,OAAOF,GAAG,KAAK,QAAQ,EAAE;MAC3B,OAAOG,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,sBAAsB,EAAEL,EAAE,CAAC;IAC1D;IAEA,IAAI,OAAOE,OAAO,KAAK,QAAQ,EAAE;MAC/B,OAAOE,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,0BAA0B,EAAEL,EAAE,CAAC;IAC9D;IAEA,IAAI,OAAOG,aAAa,KAAK,SAAS,EAAE;MACtC,OAAOC,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,iCAAiC,EAAEL,EAAE,CAAC;IACrE;IAEAC,GAAG,GAAG,IAAI,CAACK,WAAW,CAACC,QAAQ,CAACN,GAAG,CAAC;IACpCC,OAAO,GAAG,IAAI,CAACI,WAAW,CAACC,QAAQ,CAACL,OAAO,CAAC;IAE5C,IAAIC,aAAa,EAAE;MACjB,IAAI,CAACK,SAAS,EAAE;IAClB;IAEA,IAAI,CAACC,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAACC,MAAM,CAACC,KAAK,EAAE,IAAI,CAACD,MAAM,CAACE,MAAM,EAAE,CAACC,CAAC,EAAEC,CAAC,EAAEC,GAAG,KAAK;MACzE,MAAMC,IAAI,GACR,IAAI,CAACN,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC,GAAGd,GAAG,GAAG,IAAI,CAACS,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC,GAAGb,OAAO;MAE/D,IAAI,CAACQ,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC,GAAGC,IAAI;MAC5B,IAAI,CAACN,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC,GAAGC,IAAI;MAChC,IAAI,CAACN,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC,GAAGC,IAAI;IAClC,CAAC,CAAC;IAEF,IAAI,IAAAE,oBAAa,EAAClB,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACK,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-threshold/es/index.js b/project starter code/node_modules/@jimp/plugin-threshold/es/index.js index dea3677f..ee264b5f 100644 --- a/project starter code/node_modules/@jimp/plugin-threshold/es/index.js +++ b/project starter code/node_modules/@jimp/plugin-threshold/es/index.js @@ -1,11 +1,4 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); +import { isNodePattern, throwError } from "@jimp/utils"; /** * Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default @@ -16,51 +9,37 @@ var _utils = require("@jimp/utils"); * @param {number} cb (optional) a callback for when complete * @return {this} this for chaining of methods */ -var _default = function _default() { - return { - threshold: function threshold(_ref, cb) { - var _this = this; - - var max = _ref.max, - _ref$replace = _ref.replace, - replace = _ref$replace === void 0 ? 255 : _ref$replace, - _ref$autoGreyscale = _ref.autoGreyscale, - autoGreyscale = _ref$autoGreyscale === void 0 ? true : _ref$autoGreyscale; - - if (typeof max !== 'number') { - return _utils.throwError.call(this, 'max must be a number', cb); - } - - if (typeof replace !== 'number') { - return _utils.throwError.call(this, 'replace must be a number', cb); - } - - if (typeof autoGreyscale !== 'boolean') { - return _utils.throwError.call(this, 'autoGreyscale must be a boolean', cb); - } - - max = this.constructor.limit255(max); - replace = this.constructor.limit255(replace); - - if (autoGreyscale) { - this.greyscale(); - } - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var grey = _this.bitmap.data[idx] < max ? _this.bitmap.data[idx] : replace; - _this.bitmap.data[idx] = grey; - _this.bitmap.data[idx + 1] = grey; - _this.bitmap.data[idx + 2] = grey; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; +export default (() => ({ + threshold(_ref, cb) { + let { + max, + replace = 255, + autoGreyscale = true + } = _ref; + if (typeof max !== "number") { + return throwError.call(this, "max must be a number", cb); } - }; -}; - -exports["default"] = _default; + if (typeof replace !== "number") { + return throwError.call(this, "replace must be a number", cb); + } + if (typeof autoGreyscale !== "boolean") { + return throwError.call(this, "autoGreyscale must be a boolean", cb); + } + max = this.constructor.limit255(max); + replace = this.constructor.limit255(replace); + if (autoGreyscale) { + this.greyscale(); + } + this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => { + const grey = this.bitmap.data[idx] < max ? this.bitmap.data[idx] : replace; + this.bitmap.data[idx] = grey; + this.bitmap.data[idx + 1] = grey; + this.bitmap.data[idx + 2] = grey; + }); + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + } +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-threshold/es/index.js.map b/project starter code/node_modules/@jimp/plugin-threshold/es/index.js.map index 7b0f4ece..a63e69bc 100644 --- a/project starter code/node_modules/@jimp/plugin-threshold/es/index.js.map +++ b/project starter code/node_modules/@jimp/plugin-threshold/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["threshold","cb","max","replace","autoGreyscale","throwError","call","constructor","limit255","greyscale","scanQuiet","bitmap","width","height","x","y","idx","grey","data"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;eASe;AAAA,SAAO;AACpBA,IAAAA,SADoB,2BACoCC,EADpC,EACwC;AAAA;;AAAA,UAAhDC,GAAgD,QAAhDA,GAAgD;AAAA,8BAA3CC,OAA2C;AAAA,UAA3CA,OAA2C,6BAAjC,GAAiC;AAAA,oCAA5BC,aAA4B;AAAA,UAA5BA,aAA4B,mCAAZ,IAAY;;AAC1D,UAAI,OAAOF,GAAP,KAAe,QAAnB,EAA6B;AAC3B,eAAOG,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,sBAAtB,EAA8CL,EAA9C,CAAP;AACD;;AAED,UAAI,OAAOE,OAAP,KAAmB,QAAvB,EAAiC;AAC/B,eAAOE,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,0BAAtB,EAAkDL,EAAlD,CAAP;AACD;;AAED,UAAI,OAAOG,aAAP,KAAyB,SAA7B,EAAwC;AACtC,eAAOC,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,iCAAtB,EAAyDL,EAAzD,CAAP;AACD;;AAEDC,MAAAA,GAAG,GAAG,KAAKK,WAAL,CAAiBC,QAAjB,CAA0BN,GAA1B,CAAN;AACAC,MAAAA,OAAO,GAAG,KAAKI,WAAL,CAAiBC,QAAjB,CAA0BL,OAA1B,CAAV;;AAEA,UAAIC,aAAJ,EAAmB;AACjB,aAAKK,SAAL;AACD;;AAED,WAAKC,SAAL,CAAe,CAAf,EAAkB,CAAlB,EAAqB,KAAKC,MAAL,CAAYC,KAAjC,EAAwC,KAAKD,MAAL,CAAYE,MAApD,EAA4D,UAACC,CAAD,EAAIC,CAAJ,EAAOC,GAAP,EAAe;AACzE,YAAMC,IAAI,GACR,KAAI,CAACN,MAAL,CAAYO,IAAZ,CAAiBF,GAAjB,IAAwBd,GAAxB,GAA8B,KAAI,CAACS,MAAL,CAAYO,IAAZ,CAAiBF,GAAjB,CAA9B,GAAsDb,OADxD;AAGA,QAAA,KAAI,CAACQ,MAAL,CAAYO,IAAZ,CAAiBF,GAAjB,IAAwBC,IAAxB;AACA,QAAA,KAAI,CAACN,MAAL,CAAYO,IAAZ,CAAiBF,GAAG,GAAG,CAAvB,IAA4BC,IAA5B;AACA,QAAA,KAAI,CAACN,MAAL,CAAYO,IAAZ,CAAiBF,GAAG,GAAG,CAAvB,IAA4BC,IAA5B;AACD,OAPD;;AASA,UAAI,0BAAchB,EAAd,CAAJ,EAAuB;AACrBA,QAAAA,EAAE,CAACK,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,aAAO,IAAP;AACD;AAnCmB,GAAP;AAAA,C","sourcesContent":["import { isNodePattern, throwError } from '@jimp/utils';\n\n/**\n * Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default\n * @param {number} options object\n * max: A number auto limited between 0 - 255\n * replace: (optional) A number auto limited between 0 - 255 (default 255)\n * autoGreyscale: (optional) A boolean whether to apply greyscale beforehand (default true)\n * @param {number} cb (optional) a callback for when complete\n * @return {this} this for chaining of methods\n */\nexport default () => ({\n threshold({ max, replace = 255, autoGreyscale = true }, cb) {\n if (typeof max !== 'number') {\n return throwError.call(this, 'max must be a number', cb);\n }\n\n if (typeof replace !== 'number') {\n return throwError.call(this, 'replace must be a number', cb);\n }\n\n if (typeof autoGreyscale !== 'boolean') {\n return throwError.call(this, 'autoGreyscale must be a boolean', cb);\n }\n\n max = this.constructor.limit255(max);\n replace = this.constructor.limit255(replace);\n\n if (autoGreyscale) {\n this.greyscale();\n }\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n const grey =\n this.bitmap.data[idx] < max ? this.bitmap.data[idx] : replace;\n\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["isNodePattern","throwError","threshold","cb","max","replace","autoGreyscale","call","constructor","limit255","greyscale","scanQuiet","bitmap","width","height","x","y","idx","grey","data"],"sources":["../src/index.js"],"sourcesContent":["import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default\n * @param {number} options object\n * max: A number auto limited between 0 - 255\n * replace: (optional) A number auto limited between 0 - 255 (default 255)\n * autoGreyscale: (optional) A boolean whether to apply greyscale beforehand (default true)\n * @param {number} cb (optional) a callback for when complete\n * @return {this} this for chaining of methods\n */\nexport default () => ({\n threshold({ max, replace = 255, autoGreyscale = true }, cb) {\n if (typeof max !== \"number\") {\n return throwError.call(this, \"max must be a number\", cb);\n }\n\n if (typeof replace !== \"number\") {\n return throwError.call(this, \"replace must be a number\", cb);\n }\n\n if (typeof autoGreyscale !== \"boolean\") {\n return throwError.call(this, \"autoGreyscale must be a boolean\", cb);\n }\n\n max = this.constructor.limit255(max);\n replace = this.constructor.limit255(replace);\n\n if (autoGreyscale) {\n this.greyscale();\n }\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n const grey =\n this.bitmap.data[idx] < max ? this.bitmap.data[idx] : replace;\n\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n });\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n});\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;EACpBC,SAAS,OAA+CC,EAAE,EAAE;IAAA,IAAlD;MAAEC,GAAG;MAAEC,OAAO,GAAG,GAAG;MAAEC,aAAa,GAAG;IAAK,CAAC;IACpD,IAAI,OAAOF,GAAG,KAAK,QAAQ,EAAE;MAC3B,OAAOH,UAAU,CAACM,IAAI,CAAC,IAAI,EAAE,sBAAsB,EAAEJ,EAAE,CAAC;IAC1D;IAEA,IAAI,OAAOE,OAAO,KAAK,QAAQ,EAAE;MAC/B,OAAOJ,UAAU,CAACM,IAAI,CAAC,IAAI,EAAE,0BAA0B,EAAEJ,EAAE,CAAC;IAC9D;IAEA,IAAI,OAAOG,aAAa,KAAK,SAAS,EAAE;MACtC,OAAOL,UAAU,CAACM,IAAI,CAAC,IAAI,EAAE,iCAAiC,EAAEJ,EAAE,CAAC;IACrE;IAEAC,GAAG,GAAG,IAAI,CAACI,WAAW,CAACC,QAAQ,CAACL,GAAG,CAAC;IACpCC,OAAO,GAAG,IAAI,CAACG,WAAW,CAACC,QAAQ,CAACJ,OAAO,CAAC;IAE5C,IAAIC,aAAa,EAAE;MACjB,IAAI,CAACI,SAAS,EAAE;IAClB;IAEA,IAAI,CAACC,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAACC,MAAM,CAACC,KAAK,EAAE,IAAI,CAACD,MAAM,CAACE,MAAM,EAAE,CAACC,CAAC,EAAEC,CAAC,EAAEC,GAAG,KAAK;MACzE,MAAMC,IAAI,GACR,IAAI,CAACN,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC,GAAGb,GAAG,GAAG,IAAI,CAACQ,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC,GAAGZ,OAAO;MAE/D,IAAI,CAACO,MAAM,CAACO,IAAI,CAACF,GAAG,CAAC,GAAGC,IAAI;MAC5B,IAAI,CAACN,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC,GAAGC,IAAI;MAChC,IAAI,CAACN,MAAM,CAACO,IAAI,CAACF,GAAG,GAAG,CAAC,CAAC,GAAGC,IAAI;IAClC,CAAC,CAAC;IAEF,IAAIlB,aAAa,CAACG,EAAE,CAAC,EAAE;MACrBA,EAAE,CAACI,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb;AACF,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugin-threshold/index.d.ts b/project starter code/node_modules/@jimp/plugin-threshold/index.d.ts index 4b2a6cbe..96ad193f 100644 --- a/project starter code/node_modules/@jimp/plugin-threshold/index.d.ts +++ b/project starter code/node_modules/@jimp/plugin-threshold/index.d.ts @@ -1,11 +1,14 @@ -import { ImageCallback } from '@jimp/core'; +import { ImageCallback } from "@jimp/core"; interface Threshold { - threshold(opts: { - max: number, - replace?: number, - autoGreyscale?: boolean - }, cb?: ImageCallback): this; + threshold( + opts: { + max: number; + replace?: number; + autoGreyscale?: boolean; + }, + cb?: ImageCallback + ): this; } -export default function(): Threshold; +export default function (): Threshold; diff --git a/project starter code/node_modules/@jimp/plugin-threshold/package.json b/project starter code/node_modules/@jimp/plugin-threshold/package.json index 3578426d..e49ad877 100644 --- a/project starter code/node_modules/@jimp/plugin-threshold/package.json +++ b/project starter code/node_modules/@jimp/plugin-threshold/package.json @@ -1,12 +1,13 @@ { "name": "@jimp/plugin-threshold", - "version": "0.16.2", + "version": "0.22.12", "description": "Lightens an image.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js", "test:watch": "npm run test -- --reporter min --watch", "test:coverage": "nyc npm run test", "build": "npm run build:node:production && npm run build:module", @@ -20,8 +21,7 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", @@ -29,14 +29,14 @@ "@jimp/plugin-resize": ">=0.8.0" }, "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/jpeg": "^0.16.2", - "@jimp/plugin-color": "^0.16.2", - "@jimp/plugin-resize": "^0.16.2", - "@jimp/test-utils": "^0.16.2" + "@jimp/custom": "^0.22.12", + "@jimp/jpeg": "^0.22.12", + "@jimp/plugin-color": "^0.22.12", + "@jimp/plugin-resize": "^0.22.12", + "@jimp/test-utils": "^0.22.12" }, "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/plugin-threshold/src/index.js b/project starter code/node_modules/@jimp/plugin-threshold/src/index.js index 583c8410..fad06bac 100644 --- a/project starter code/node_modules/@jimp/plugin-threshold/src/index.js +++ b/project starter code/node_modules/@jimp/plugin-threshold/src/index.js @@ -1,4 +1,4 @@ -import { isNodePattern, throwError } from '@jimp/utils'; +import { isNodePattern, throwError } from "@jimp/utils"; /** * Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default @@ -11,16 +11,16 @@ import { isNodePattern, throwError } from '@jimp/utils'; */ export default () => ({ threshold({ max, replace = 255, autoGreyscale = true }, cb) { - if (typeof max !== 'number') { - return throwError.call(this, 'max must be a number', cb); + if (typeof max !== "number") { + return throwError.call(this, "max must be a number", cb); } - if (typeof replace !== 'number') { - return throwError.call(this, 'replace must be a number', cb); + if (typeof replace !== "number") { + return throwError.call(this, "replace must be a number", cb); } - if (typeof autoGreyscale !== 'boolean') { - return throwError.call(this, 'autoGreyscale must be a boolean', cb); + if (typeof autoGreyscale !== "boolean") { + return throwError.call(this, "autoGreyscale must be a boolean", cb); } max = this.constructor.limit255(max); @@ -44,5 +44,5 @@ export default () => ({ } return this; - } + }, }); diff --git a/project starter code/node_modules/@jimp/plugin-threshold/test/threshold.test.js b/project starter code/node_modules/@jimp/plugin-threshold/test/threshold.test.js index f1dbf809..709da3e1 100644 --- a/project starter code/node_modules/@jimp/plugin-threshold/test/threshold.test.js +++ b/project starter code/node_modules/@jimp/plugin-threshold/test/threshold.test.js @@ -1,30 +1,30 @@ -import { Jimp, getTestDir } from '@jimp/test-utils'; -import configure from '@jimp/custom'; -import jpeg from '@jimp/jpeg'; -import color from '@jimp/plugin-color'; -import resize from '@jimp/plugin-resize'; +import { Jimp, getTestDir } from "@jimp/test-utils"; +import configure from "@jimp/custom"; +import jpeg from "@jimp/jpeg"; +import color from "@jimp/plugin-color"; +import resize from "@jimp/plugin-resize"; +import expect from "@storybook/expect"; -import threshold from '../src'; +import threshold from "../src"; const jimp = configure( { types: [jpeg], plugins: [threshold, color, resize] }, Jimp ); -describe('Threshold', function() { +describe("Threshold", function () { this.timeout(15000); - it('defines default threshold for lighter backgrounds', async () => { + it("defines default threshold for lighter backgrounds", async () => { const expectedImage = await jimp.read( - getTestDir(__dirname) + '/images/hands_mx200_rp255.jpg' + getTestDir(__dirname) + "/images/hands_mx200_rp255.jpg" ); const testImage = await jimp.read( - getTestDir(__dirname) + '/images/hands.jpg' + getTestDir(__dirname) + "/images/hands.jpg" ); - testImage - .threshold({ max: 200, replace: 255 }) - .hash() - .should.be.equal(expectedImage.hash()); + expect(testImage.threshold({ max: 200, replace: 255 }).hash()).toBe( + expectedImage.hash() + ); }); }); diff --git a/project starter code/node_modules/@jimp/plugins/CHANGELOG.md b/project starter code/node_modules/@jimp/plugins/CHANGELOG.md index 09abcd9e..2bc31ab4 100644 --- a/project starter code/node_modules/@jimp/plugins/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/plugins/CHANGELOG.md @@ -1,3 +1,51 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -36,7 +84,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -44,4 +92,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/plugins/dist/index.js b/project starter code/node_modules/@jimp/plugins/dist/index.js index 9c98b5a4..322f9cd2 100644 --- a/project starter code/node_modules/@jimp/plugins/dist/index.js +++ b/project starter code/node_modules/@jimp/plugins/dist/index.js @@ -1,76 +1,47 @@ "use strict"; -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - +exports.default = void 0; var _timm = require("timm"); - var _pluginBlit = _interopRequireDefault(require("@jimp/plugin-blit")); - var _pluginBlur = _interopRequireDefault(require("@jimp/plugin-blur")); - var _pluginCircle = _interopRequireDefault(require("@jimp/plugin-circle")); - var _pluginColor = _interopRequireDefault(require("@jimp/plugin-color")); - var _pluginContain = _interopRequireDefault(require("@jimp/plugin-contain")); - var _pluginCover = _interopRequireDefault(require("@jimp/plugin-cover")); - var _pluginCrop = _interopRequireDefault(require("@jimp/plugin-crop")); - var _pluginDisplace = _interopRequireDefault(require("@jimp/plugin-displace")); - var _pluginDither = _interopRequireDefault(require("@jimp/plugin-dither")); - var _pluginFisheye = _interopRequireDefault(require("@jimp/plugin-fisheye")); - var _pluginFlip = _interopRequireDefault(require("@jimp/plugin-flip")); - var _pluginGaussian = _interopRequireDefault(require("@jimp/plugin-gaussian")); - var _pluginInvert = _interopRequireDefault(require("@jimp/plugin-invert")); - var _pluginMask = _interopRequireDefault(require("@jimp/plugin-mask")); - var _pluginNormalize = _interopRequireDefault(require("@jimp/plugin-normalize")); - var _pluginPrint = _interopRequireDefault(require("@jimp/plugin-print")); - var _pluginResize = _interopRequireDefault(require("@jimp/plugin-resize")); - var _pluginRotate = _interopRequireDefault(require("@jimp/plugin-rotate")); - var _pluginScale = _interopRequireDefault(require("@jimp/plugin-scale")); - var _pluginShadow = _interopRequireDefault(require("@jimp/plugin-shadow")); - var _pluginThreshold = _interopRequireDefault(require("@jimp/plugin-threshold")); - -var plugins = [_pluginBlit["default"], _pluginBlur["default"], _pluginCircle["default"], _pluginColor["default"], _pluginContain["default"], _pluginCover["default"], _pluginCrop["default"], _pluginDisplace["default"], _pluginDither["default"], _pluginFisheye["default"], _pluginFlip["default"], _pluginGaussian["default"], _pluginInvert["default"], _pluginMask["default"], _pluginNormalize["default"], _pluginPrint["default"], _pluginResize["default"], _pluginRotate["default"], _pluginScale["default"], _pluginShadow["default"], _pluginThreshold["default"]]; - -var _default = function _default(jimpEvChange) { - var initializedPlugins = plugins.map(function (pluginModule) { - var plugin = pluginModule(jimpEvChange) || {}; - - if (!plugin["class"] && !plugin.constants) { +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +const plugins = [_pluginBlit.default, _pluginBlur.default, _pluginCircle.default, _pluginColor.default, _pluginContain.default, _pluginCover.default, _pluginCrop.default, _pluginDisplace.default, _pluginDither.default, _pluginFisheye.default, _pluginFlip.default, _pluginGaussian.default, _pluginInvert.default, _pluginMask.default, _pluginNormalize.default, _pluginPrint.default, _pluginResize.default, _pluginRotate.default, _pluginScale.default, _pluginShadow.default, _pluginThreshold.default]; +var _default = jimpEvChange => { + const initializedPlugins = plugins.map(pluginModule => { + let plugin = pluginModule(jimpEvChange) || {}; + if (!plugin.class && !plugin.constants) { // Default to class function plugin = { - "class": plugin + class: plugin }; } - return plugin; }); - return _timm.mergeDeep.apply(void 0, (0, _toConsumableArray2["default"])(initializedPlugins)); + return (0, _timm.mergeDeep)(...initializedPlugins); }; - -exports["default"] = _default; +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugins/dist/index.js.map b/project starter code/node_modules/@jimp/plugins/dist/index.js.map index 29e45149..c884c062 100644 --- a/project starter code/node_modules/@jimp/plugins/dist/index.js.map +++ b/project starter code/node_modules/@jimp/plugins/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["plugins","blit","blur","circle","color","contain","cover","crop","displace","dither","fisheye","flip","gaussian","invert","mask","normalize","print","resize","rotate","scale","shadow","threshold","jimpEvChange","initializedPlugins","map","pluginModule","plugin","constants","mergeDeep"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA,IAAMA,OAAO,GAAG,CACdC,sBADc,EAEdC,sBAFc,EAGdC,wBAHc,EAIdC,uBAJc,EAKdC,yBALc,EAMdC,uBANc,EAOdC,sBAPc,EAQdC,0BARc,EASdC,wBATc,EAUdC,yBAVc,EAWdC,sBAXc,EAYdC,0BAZc,EAadC,wBAbc,EAcdC,sBAdc,EAedC,2BAfc,EAgBdC,uBAhBc,EAiBdC,wBAjBc,EAkBdC,wBAlBc,EAmBdC,uBAnBc,EAoBdC,wBApBc,EAqBdC,2BArBc,CAAhB;;eAwBe,kBAAAC,YAAY,EAAI;AAC7B,MAAMC,kBAAkB,GAAGvB,OAAO,CAACwB,GAAR,CAAY,UAAAC,YAAY,EAAI;AACrD,QAAIC,MAAM,GAAGD,YAAY,CAACH,YAAD,CAAZ,IAA8B,EAA3C;;AAEA,QAAI,CAACI,MAAM,SAAP,IAAiB,CAACA,MAAM,CAACC,SAA7B,EAAwC;AACtC;AACAD,MAAAA,MAAM,GAAG;AAAE,iBAAOA;AAAT,OAAT;AACD;;AAED,WAAOA,MAAP;AACD,GAT0B,CAA3B;AAWA,SAAOE,kEAAaL,kBAAb,EAAP;AACD,C","sourcesContent":["import { mergeDeep } from 'timm';\n\nimport blit from '@jimp/plugin-blit';\nimport blur from '@jimp/plugin-blur';\nimport circle from '@jimp/plugin-circle';\nimport color from '@jimp/plugin-color';\nimport contain from '@jimp/plugin-contain';\nimport cover from '@jimp/plugin-cover';\nimport crop from '@jimp/plugin-crop';\nimport displace from '@jimp/plugin-displace';\nimport dither from '@jimp/plugin-dither';\nimport fisheye from '@jimp/plugin-fisheye';\nimport flip from '@jimp/plugin-flip';\nimport gaussian from '@jimp/plugin-gaussian';\nimport invert from '@jimp/plugin-invert';\nimport mask from '@jimp/plugin-mask';\nimport normalize from '@jimp/plugin-normalize';\nimport print from '@jimp/plugin-print';\nimport resize from '@jimp/plugin-resize';\nimport rotate from '@jimp/plugin-rotate';\nimport scale from '@jimp/plugin-scale';\nimport shadow from '@jimp/plugin-shadow';\nimport threshold from '@jimp/plugin-threshold';\n\nconst plugins = [\n blit,\n blur,\n circle,\n color,\n contain,\n cover,\n crop,\n displace,\n dither,\n fisheye,\n flip,\n gaussian,\n invert,\n mask,\n normalize,\n print,\n resize,\n rotate,\n scale,\n shadow,\n threshold\n];\n\nexport default jimpEvChange => {\n const initializedPlugins = plugins.map(pluginModule => {\n let plugin = pluginModule(jimpEvChange) || {};\n\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n plugin = { class: plugin };\n }\n\n return plugin;\n });\n\n return mergeDeep(...initializedPlugins);\n};\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["plugins","blit","blur","circle","color","contain","cover","crop","displace","dither","fisheye","flip","gaussian","invert","mask","normalize","print","resize","rotate","scale","shadow","threshold","jimpEvChange","initializedPlugins","map","pluginModule","plugin","class","constants","mergeDeep"],"sources":["../src/index.js"],"sourcesContent":["import { mergeDeep } from \"timm\";\n\nimport blit from \"@jimp/plugin-blit\";\nimport blur from \"@jimp/plugin-blur\";\nimport circle from \"@jimp/plugin-circle\";\nimport color from \"@jimp/plugin-color\";\nimport contain from \"@jimp/plugin-contain\";\nimport cover from \"@jimp/plugin-cover\";\nimport crop from \"@jimp/plugin-crop\";\nimport displace from \"@jimp/plugin-displace\";\nimport dither from \"@jimp/plugin-dither\";\nimport fisheye from \"@jimp/plugin-fisheye\";\nimport flip from \"@jimp/plugin-flip\";\nimport gaussian from \"@jimp/plugin-gaussian\";\nimport invert from \"@jimp/plugin-invert\";\nimport mask from \"@jimp/plugin-mask\";\nimport normalize from \"@jimp/plugin-normalize\";\nimport print from \"@jimp/plugin-print\";\nimport resize from \"@jimp/plugin-resize\";\nimport rotate from \"@jimp/plugin-rotate\";\nimport scale from \"@jimp/plugin-scale\";\nimport shadow from \"@jimp/plugin-shadow\";\nimport threshold from \"@jimp/plugin-threshold\";\n\nconst plugins = [\n blit,\n blur,\n circle,\n color,\n contain,\n cover,\n crop,\n displace,\n dither,\n fisheye,\n flip,\n gaussian,\n invert,\n mask,\n normalize,\n print,\n resize,\n rotate,\n scale,\n shadow,\n threshold,\n];\n\nexport default (jimpEvChange) => {\n const initializedPlugins = plugins.map((pluginModule) => {\n let plugin = pluginModule(jimpEvChange) || {};\n\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n plugin = { class: plugin };\n }\n\n return plugin;\n });\n\n return mergeDeep(...initializedPlugins);\n};\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAA+C;AAE/C,MAAMA,OAAO,GAAG,CACdC,mBAAI,EACJC,mBAAI,EACJC,qBAAM,EACNC,oBAAK,EACLC,sBAAO,EACPC,oBAAK,EACLC,mBAAI,EACJC,uBAAQ,EACRC,qBAAM,EACNC,sBAAO,EACPC,mBAAI,EACJC,uBAAQ,EACRC,qBAAM,EACNC,mBAAI,EACJC,wBAAS,EACTC,oBAAK,EACLC,qBAAM,EACNC,qBAAM,EACNC,oBAAK,EACLC,qBAAM,EACNC,wBAAS,CACV;AAAC,eAEcC,YAAY,IAAK;EAC/B,MAAMC,kBAAkB,GAAGvB,OAAO,CAACwB,GAAG,CAAEC,YAAY,IAAK;IACvD,IAAIC,MAAM,GAAGD,YAAY,CAACH,YAAY,CAAC,IAAI,CAAC,CAAC;IAE7C,IAAI,CAACI,MAAM,CAACC,KAAK,IAAI,CAACD,MAAM,CAACE,SAAS,EAAE;MACtC;MACAF,MAAM,GAAG;QAAEC,KAAK,EAAED;MAAO,CAAC;IAC5B;IAEA,OAAOA,MAAM;EACf,CAAC,CAAC;EAEF,OAAO,IAAAG,eAAS,EAAC,GAAGN,kBAAkB,CAAC;AACzC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugins/es/index.js b/project starter code/node_modules/@jimp/plugins/es/index.js index fa3c22c9..22a58977 100644 --- a/project starter code/node_modules/@jimp/plugins/es/index.js +++ b/project starter code/node_modules/@jimp/plugins/es/index.js @@ -1,75 +1,37 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - -var _timm = require("timm"); - -var _pluginBlit = _interopRequireDefault(require("@jimp/plugin-blit")); - -var _pluginBlur = _interopRequireDefault(require("@jimp/plugin-blur")); - -var _pluginCircle = _interopRequireDefault(require("@jimp/plugin-circle")); - -var _pluginColor = _interopRequireDefault(require("@jimp/plugin-color")); - -var _pluginContain = _interopRequireDefault(require("@jimp/plugin-contain")); - -var _pluginCover = _interopRequireDefault(require("@jimp/plugin-cover")); - -var _pluginCrop = _interopRequireDefault(require("@jimp/plugin-crop")); - -var _pluginDisplace = _interopRequireDefault(require("@jimp/plugin-displace")); - -var _pluginDither = _interopRequireDefault(require("@jimp/plugin-dither")); - -var _pluginFisheye = _interopRequireDefault(require("@jimp/plugin-fisheye")); - -var _pluginFlip = _interopRequireDefault(require("@jimp/plugin-flip")); - -var _pluginGaussian = _interopRequireDefault(require("@jimp/plugin-gaussian")); - -var _pluginInvert = _interopRequireDefault(require("@jimp/plugin-invert")); - -var _pluginMask = _interopRequireDefault(require("@jimp/plugin-mask")); - -var _pluginNormalize = _interopRequireDefault(require("@jimp/plugin-normalize")); - -var _pluginPrint = _interopRequireDefault(require("@jimp/plugin-print")); - -var _pluginResize = _interopRequireDefault(require("@jimp/plugin-resize")); - -var _pluginRotate = _interopRequireDefault(require("@jimp/plugin-rotate")); - -var _pluginScale = _interopRequireDefault(require("@jimp/plugin-scale")); - -var _pluginShadow = _interopRequireDefault(require("@jimp/plugin-shadow")); - -var _pluginThreshold = _interopRequireDefault(require("@jimp/plugin-threshold")); - -var plugins = [_pluginBlit["default"], _pluginBlur["default"], _pluginCircle["default"], _pluginColor["default"], _pluginContain["default"], _pluginCover["default"], _pluginCrop["default"], _pluginDisplace["default"], _pluginDither["default"], _pluginFisheye["default"], _pluginFlip["default"], _pluginGaussian["default"], _pluginInvert["default"], _pluginMask["default"], _pluginNormalize["default"], _pluginPrint["default"], _pluginResize["default"], _pluginRotate["default"], _pluginScale["default"], _pluginShadow["default"], _pluginThreshold["default"]]; - -var _default = function _default(jimpEvChange) { - var initializedPlugins = plugins.map(function (pluginModule) { - var plugin = pluginModule(jimpEvChange) || {}; - - if (!plugin["class"] && !plugin.constants) { +import { mergeDeep } from "timm"; +import blit from "@jimp/plugin-blit"; +import blur from "@jimp/plugin-blur"; +import circle from "@jimp/plugin-circle"; +import color from "@jimp/plugin-color"; +import contain from "@jimp/plugin-contain"; +import cover from "@jimp/plugin-cover"; +import crop from "@jimp/plugin-crop"; +import displace from "@jimp/plugin-displace"; +import dither from "@jimp/plugin-dither"; +import fisheye from "@jimp/plugin-fisheye"; +import flip from "@jimp/plugin-flip"; +import gaussian from "@jimp/plugin-gaussian"; +import invert from "@jimp/plugin-invert"; +import mask from "@jimp/plugin-mask"; +import normalize from "@jimp/plugin-normalize"; +import print from "@jimp/plugin-print"; +import resize from "@jimp/plugin-resize"; +import rotate from "@jimp/plugin-rotate"; +import scale from "@jimp/plugin-scale"; +import shadow from "@jimp/plugin-shadow"; +import threshold from "@jimp/plugin-threshold"; +const plugins = [blit, blur, circle, color, contain, cover, crop, displace, dither, fisheye, flip, gaussian, invert, mask, normalize, print, resize, rotate, scale, shadow, threshold]; +export default (jimpEvChange => { + const initializedPlugins = plugins.map(pluginModule => { + let plugin = pluginModule(jimpEvChange) || {}; + if (!plugin.class && !plugin.constants) { // Default to class function plugin = { - "class": plugin + class: plugin }; } - return plugin; }); - return _timm.mergeDeep.apply(void 0, (0, _toConsumableArray2["default"])(initializedPlugins)); -}; - -exports["default"] = _default; + return mergeDeep(...initializedPlugins); +}); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugins/es/index.js.map b/project starter code/node_modules/@jimp/plugins/es/index.js.map index 29e45149..fb2069cf 100644 --- a/project starter code/node_modules/@jimp/plugins/es/index.js.map +++ b/project starter code/node_modules/@jimp/plugins/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["plugins","blit","blur","circle","color","contain","cover","crop","displace","dither","fisheye","flip","gaussian","invert","mask","normalize","print","resize","rotate","scale","shadow","threshold","jimpEvChange","initializedPlugins","map","pluginModule","plugin","constants","mergeDeep"],"mappings":";;;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA,IAAMA,OAAO,GAAG,CACdC,sBADc,EAEdC,sBAFc,EAGdC,wBAHc,EAIdC,uBAJc,EAKdC,yBALc,EAMdC,uBANc,EAOdC,sBAPc,EAQdC,0BARc,EASdC,wBATc,EAUdC,yBAVc,EAWdC,sBAXc,EAYdC,0BAZc,EAadC,wBAbc,EAcdC,sBAdc,EAedC,2BAfc,EAgBdC,uBAhBc,EAiBdC,wBAjBc,EAkBdC,wBAlBc,EAmBdC,uBAnBc,EAoBdC,wBApBc,EAqBdC,2BArBc,CAAhB;;eAwBe,kBAAAC,YAAY,EAAI;AAC7B,MAAMC,kBAAkB,GAAGvB,OAAO,CAACwB,GAAR,CAAY,UAAAC,YAAY,EAAI;AACrD,QAAIC,MAAM,GAAGD,YAAY,CAACH,YAAD,CAAZ,IAA8B,EAA3C;;AAEA,QAAI,CAACI,MAAM,SAAP,IAAiB,CAACA,MAAM,CAACC,SAA7B,EAAwC;AACtC;AACAD,MAAAA,MAAM,GAAG;AAAE,iBAAOA;AAAT,OAAT;AACD;;AAED,WAAOA,MAAP;AACD,GAT0B,CAA3B;AAWA,SAAOE,kEAAaL,kBAAb,EAAP;AACD,C","sourcesContent":["import { mergeDeep } from 'timm';\n\nimport blit from '@jimp/plugin-blit';\nimport blur from '@jimp/plugin-blur';\nimport circle from '@jimp/plugin-circle';\nimport color from '@jimp/plugin-color';\nimport contain from '@jimp/plugin-contain';\nimport cover from '@jimp/plugin-cover';\nimport crop from '@jimp/plugin-crop';\nimport displace from '@jimp/plugin-displace';\nimport dither from '@jimp/plugin-dither';\nimport fisheye from '@jimp/plugin-fisheye';\nimport flip from '@jimp/plugin-flip';\nimport gaussian from '@jimp/plugin-gaussian';\nimport invert from '@jimp/plugin-invert';\nimport mask from '@jimp/plugin-mask';\nimport normalize from '@jimp/plugin-normalize';\nimport print from '@jimp/plugin-print';\nimport resize from '@jimp/plugin-resize';\nimport rotate from '@jimp/plugin-rotate';\nimport scale from '@jimp/plugin-scale';\nimport shadow from '@jimp/plugin-shadow';\nimport threshold from '@jimp/plugin-threshold';\n\nconst plugins = [\n blit,\n blur,\n circle,\n color,\n contain,\n cover,\n crop,\n displace,\n dither,\n fisheye,\n flip,\n gaussian,\n invert,\n mask,\n normalize,\n print,\n resize,\n rotate,\n scale,\n shadow,\n threshold\n];\n\nexport default jimpEvChange => {\n const initializedPlugins = plugins.map(pluginModule => {\n let plugin = pluginModule(jimpEvChange) || {};\n\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n plugin = { class: plugin };\n }\n\n return plugin;\n });\n\n return mergeDeep(...initializedPlugins);\n};\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["mergeDeep","blit","blur","circle","color","contain","cover","crop","displace","dither","fisheye","flip","gaussian","invert","mask","normalize","print","resize","rotate","scale","shadow","threshold","plugins","jimpEvChange","initializedPlugins","map","pluginModule","plugin","class","constants"],"sources":["../src/index.js"],"sourcesContent":["import { mergeDeep } from \"timm\";\n\nimport blit from \"@jimp/plugin-blit\";\nimport blur from \"@jimp/plugin-blur\";\nimport circle from \"@jimp/plugin-circle\";\nimport color from \"@jimp/plugin-color\";\nimport contain from \"@jimp/plugin-contain\";\nimport cover from \"@jimp/plugin-cover\";\nimport crop from \"@jimp/plugin-crop\";\nimport displace from \"@jimp/plugin-displace\";\nimport dither from \"@jimp/plugin-dither\";\nimport fisheye from \"@jimp/plugin-fisheye\";\nimport flip from \"@jimp/plugin-flip\";\nimport gaussian from \"@jimp/plugin-gaussian\";\nimport invert from \"@jimp/plugin-invert\";\nimport mask from \"@jimp/plugin-mask\";\nimport normalize from \"@jimp/plugin-normalize\";\nimport print from \"@jimp/plugin-print\";\nimport resize from \"@jimp/plugin-resize\";\nimport rotate from \"@jimp/plugin-rotate\";\nimport scale from \"@jimp/plugin-scale\";\nimport shadow from \"@jimp/plugin-shadow\";\nimport threshold from \"@jimp/plugin-threshold\";\n\nconst plugins = [\n blit,\n blur,\n circle,\n color,\n contain,\n cover,\n crop,\n displace,\n dither,\n fisheye,\n flip,\n gaussian,\n invert,\n mask,\n normalize,\n print,\n resize,\n rotate,\n scale,\n shadow,\n threshold,\n];\n\nexport default (jimpEvChange) => {\n const initializedPlugins = plugins.map((pluginModule) => {\n let plugin = pluginModule(jimpEvChange) || {};\n\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n plugin = { class: plugin };\n }\n\n return plugin;\n });\n\n return mergeDeep(...initializedPlugins);\n};\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,MAAM;AAEhC,OAAOC,IAAI,MAAM,mBAAmB;AACpC,OAAOC,IAAI,MAAM,mBAAmB;AACpC,OAAOC,MAAM,MAAM,qBAAqB;AACxC,OAAOC,KAAK,MAAM,oBAAoB;AACtC,OAAOC,OAAO,MAAM,sBAAsB;AAC1C,OAAOC,KAAK,MAAM,oBAAoB;AACtC,OAAOC,IAAI,MAAM,mBAAmB;AACpC,OAAOC,QAAQ,MAAM,uBAAuB;AAC5C,OAAOC,MAAM,MAAM,qBAAqB;AACxC,OAAOC,OAAO,MAAM,sBAAsB;AAC1C,OAAOC,IAAI,MAAM,mBAAmB;AACpC,OAAOC,QAAQ,MAAM,uBAAuB;AAC5C,OAAOC,MAAM,MAAM,qBAAqB;AACxC,OAAOC,IAAI,MAAM,mBAAmB;AACpC,OAAOC,SAAS,MAAM,wBAAwB;AAC9C,OAAOC,KAAK,MAAM,oBAAoB;AACtC,OAAOC,MAAM,MAAM,qBAAqB;AACxC,OAAOC,MAAM,MAAM,qBAAqB;AACxC,OAAOC,KAAK,MAAM,oBAAoB;AACtC,OAAOC,MAAM,MAAM,qBAAqB;AACxC,OAAOC,SAAS,MAAM,wBAAwB;AAE9C,MAAMC,OAAO,GAAG,CACdrB,IAAI,EACJC,IAAI,EACJC,MAAM,EACNC,KAAK,EACLC,OAAO,EACPC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,MAAM,EACNC,OAAO,EACPC,IAAI,EACJC,QAAQ,EACRC,MAAM,EACNC,IAAI,EACJC,SAAS,EACTC,KAAK,EACLC,MAAM,EACNC,MAAM,EACNC,KAAK,EACLC,MAAM,EACNC,SAAS,CACV;AAED,gBAAgBE,YAAY,IAAK;EAC/B,MAAMC,kBAAkB,GAAGF,OAAO,CAACG,GAAG,CAAEC,YAAY,IAAK;IACvD,IAAIC,MAAM,GAAGD,YAAY,CAACH,YAAY,CAAC,IAAI,CAAC,CAAC;IAE7C,IAAI,CAACI,MAAM,CAACC,KAAK,IAAI,CAACD,MAAM,CAACE,SAAS,EAAE;MACtC;MACAF,MAAM,GAAG;QAAEC,KAAK,EAAED;MAAO,CAAC;IAC5B;IAEA,OAAOA,MAAM;EACf,CAAC,CAAC;EAEF,OAAO3B,SAAS,CAAC,GAAGwB,kBAAkB,CAAC;AACzC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/plugins/index.d.ts b/project starter code/node_modules/@jimp/plugins/index.d.ts index 07e46e0d..0184bbcc 100644 --- a/project starter code/node_modules/@jimp/plugins/index.d.ts +++ b/project starter code/node_modules/@jimp/plugins/index.d.ts @@ -1,24 +1,24 @@ -import blit from '@jimp/plugin-blit'; -import blur from '@jimp/plugin-blur'; -import circle from '@jimp/plugin-circle'; -import color from '@jimp/plugin-color'; -import contain from '@jimp/plugin-contain'; -import cover from '@jimp/plugin-cover'; -import crop from '@jimp/plugin-crop'; -import displace from '@jimp/plugin-displace'; -import dither from '@jimp/plugin-dither'; -import fisheye from '@jimp/plugin-fisheye'; -import flip from '@jimp/plugin-flip'; -import gaussian from '@jimp/plugin-gaussian'; -import invert from '@jimp/plugin-invert'; -import mask from '@jimp/plugin-mask'; -import normalize from '@jimp/plugin-normalize'; -import print from '@jimp/plugin-print'; -import resize from '@jimp/plugin-resize'; -import rotate from '@jimp/plugin-rotate'; -import scale from '@jimp/plugin-scale'; -import shadow from '@jimp/plugin-shadow'; -import threshold from '@jimp/plugin-threshold'; +import blit from "@jimp/plugin-blit"; +import blur from "@jimp/plugin-blur"; +import circle from "@jimp/plugin-circle"; +import color from "@jimp/plugin-color"; +import contain from "@jimp/plugin-contain"; +import cover from "@jimp/plugin-cover"; +import crop from "@jimp/plugin-crop"; +import displace from "@jimp/plugin-displace"; +import dither from "@jimp/plugin-dither"; +import fisheye from "@jimp/plugin-fisheye"; +import flip from "@jimp/plugin-flip"; +import gaussian from "@jimp/plugin-gaussian"; +import invert from "@jimp/plugin-invert"; +import mask from "@jimp/plugin-mask"; +import normalize from "@jimp/plugin-normalize"; +import print from "@jimp/plugin-print"; +import resize from "@jimp/plugin-resize"; +import rotate from "@jimp/plugin-rotate"; +import scale from "@jimp/plugin-scale"; +import shadow from "@jimp/plugin-shadow"; +import threshold from "@jimp/plugin-threshold"; type BlitRet = ReturnType; type BlurRet = ReturnType; @@ -73,4 +73,4 @@ type Plugins = | ShadowRet | ThresholdRet; -export default function(): Plugins; +export default function (): Plugins; diff --git a/project starter code/node_modules/@jimp/plugins/package.json b/project starter code/node_modules/@jimp/plugins/package.json index 3f4fd145..35c37031 100644 --- a/project starter code/node_modules/@jimp/plugins/package.json +++ b/project starter code/node_modules/@jimp/plugins/package.json @@ -1,9 +1,10 @@ { "name": "@jimp/plugins", - "version": "0.16.2", + "version": "0.22.12", "description": "Default Jimp plugin.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { "build": "npm run build:node:production && npm run build:module", @@ -17,28 +18,27 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/plugin-blit": "^0.16.2", - "@jimp/plugin-blur": "^0.16.2", - "@jimp/plugin-circle": "^0.16.2", - "@jimp/plugin-color": "^0.16.2", - "@jimp/plugin-contain": "^0.16.2", - "@jimp/plugin-cover": "^0.16.2", - "@jimp/plugin-crop": "^0.16.2", - "@jimp/plugin-displace": "^0.16.2", - "@jimp/plugin-dither": "^0.16.2", - "@jimp/plugin-fisheye": "^0.16.2", - "@jimp/plugin-flip": "^0.16.2", - "@jimp/plugin-gaussian": "^0.16.2", - "@jimp/plugin-invert": "^0.16.2", - "@jimp/plugin-mask": "^0.16.2", - "@jimp/plugin-normalize": "^0.16.2", - "@jimp/plugin-print": "^0.16.2", - "@jimp/plugin-resize": "^0.16.2", - "@jimp/plugin-rotate": "^0.16.2", - "@jimp/plugin-scale": "^0.16.2", - "@jimp/plugin-shadow": "^0.16.2", - "@jimp/plugin-threshold": "^0.16.2", + "@jimp/plugin-blit": "^0.22.12", + "@jimp/plugin-blur": "^0.22.12", + "@jimp/plugin-circle": "^0.22.12", + "@jimp/plugin-color": "^0.22.12", + "@jimp/plugin-contain": "^0.22.12", + "@jimp/plugin-cover": "^0.22.12", + "@jimp/plugin-crop": "^0.22.12", + "@jimp/plugin-displace": "^0.22.12", + "@jimp/plugin-dither": "^0.22.12", + "@jimp/plugin-fisheye": "^0.22.12", + "@jimp/plugin-flip": "^0.22.12", + "@jimp/plugin-gaussian": "^0.22.12", + "@jimp/plugin-invert": "^0.22.12", + "@jimp/plugin-mask": "^0.22.12", + "@jimp/plugin-normalize": "^0.22.12", + "@jimp/plugin-print": "^0.22.12", + "@jimp/plugin-resize": "^0.22.12", + "@jimp/plugin-rotate": "^0.22.12", + "@jimp/plugin-scale": "^0.22.12", + "@jimp/plugin-shadow": "^0.22.12", + "@jimp/plugin-threshold": "^0.22.12", "timm": "^1.6.1" }, "peerDependencies": { @@ -47,5 +47,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/plugins/src/index.js b/project starter code/node_modules/@jimp/plugins/src/index.js index 56cc2243..a31740cf 100644 --- a/project starter code/node_modules/@jimp/plugins/src/index.js +++ b/project starter code/node_modules/@jimp/plugins/src/index.js @@ -1,26 +1,26 @@ -import { mergeDeep } from 'timm'; +import { mergeDeep } from "timm"; -import blit from '@jimp/plugin-blit'; -import blur from '@jimp/plugin-blur'; -import circle from '@jimp/plugin-circle'; -import color from '@jimp/plugin-color'; -import contain from '@jimp/plugin-contain'; -import cover from '@jimp/plugin-cover'; -import crop from '@jimp/plugin-crop'; -import displace from '@jimp/plugin-displace'; -import dither from '@jimp/plugin-dither'; -import fisheye from '@jimp/plugin-fisheye'; -import flip from '@jimp/plugin-flip'; -import gaussian from '@jimp/plugin-gaussian'; -import invert from '@jimp/plugin-invert'; -import mask from '@jimp/plugin-mask'; -import normalize from '@jimp/plugin-normalize'; -import print from '@jimp/plugin-print'; -import resize from '@jimp/plugin-resize'; -import rotate from '@jimp/plugin-rotate'; -import scale from '@jimp/plugin-scale'; -import shadow from '@jimp/plugin-shadow'; -import threshold from '@jimp/plugin-threshold'; +import blit from "@jimp/plugin-blit"; +import blur from "@jimp/plugin-blur"; +import circle from "@jimp/plugin-circle"; +import color from "@jimp/plugin-color"; +import contain from "@jimp/plugin-contain"; +import cover from "@jimp/plugin-cover"; +import crop from "@jimp/plugin-crop"; +import displace from "@jimp/plugin-displace"; +import dither from "@jimp/plugin-dither"; +import fisheye from "@jimp/plugin-fisheye"; +import flip from "@jimp/plugin-flip"; +import gaussian from "@jimp/plugin-gaussian"; +import invert from "@jimp/plugin-invert"; +import mask from "@jimp/plugin-mask"; +import normalize from "@jimp/plugin-normalize"; +import print from "@jimp/plugin-print"; +import resize from "@jimp/plugin-resize"; +import rotate from "@jimp/plugin-rotate"; +import scale from "@jimp/plugin-scale"; +import shadow from "@jimp/plugin-shadow"; +import threshold from "@jimp/plugin-threshold"; const plugins = [ blit, @@ -43,11 +43,11 @@ const plugins = [ rotate, scale, shadow, - threshold + threshold, ]; -export default jimpEvChange => { - const initializedPlugins = plugins.map(pluginModule => { +export default (jimpEvChange) => { + const initializedPlugins = plugins.map((pluginModule) => { let plugin = pluginModule(jimpEvChange) || {}; if (!plugin.class && !plugin.constants) { diff --git a/project starter code/node_modules/@jimp/png/CHANGELOG.md b/project starter code/node_modules/@jimp/png/CHANGELOG.md index 26394e0f..01459825 100644 --- a/project starter code/node_modules/@jimp/png/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/png/CHANGELOG.md @@ -1,3 +1,90 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.22.0 (Mon Feb 06 2023) + +#### 🏠 Internal + +- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Daniel Holmes ([@danielholmes](https://github.com/danielholmes)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.18.0 (Sun Feb 05 2023) + +### Release Notes + +#### switch from browserify to webpack ([#1140](https://github.com/jimp-dev/jimp/pull/1140)) + +This PR can be considered a breaking change as it remove the `jimp.min.js` file. + +Instead there is now only the `jimp.js` file and we ship source maps for it. + +We also configured the `browser` field so jimp will be automatically bundled better + +--- + +#### 💥 Breaking Change + +- switch from browserify to webpack [#1140](https://github.com/jimp-dev/jimp/pull/1140) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- update linting ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -12,7 +99,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -20,4 +107,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/png/dist/index.js b/project starter code/node_modules/@jimp/png/dist/index.js index 3d5ffc60..db11eb1b 100644 --- a/project starter code/node_modules/@jimp/png/dist/index.js +++ b/project starter code/node_modules/@jimp/png/dist/index.js @@ -1,162 +1,139 @@ "use strict"; -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - +exports.default = void 0; var _pngjs = require("pngjs"); - var _utils = require("@jimp/utils"); - -var MIME_TYPE = 'image/png'; // PNG filter types - -var PNG_FILTER_AUTO = -1; -var PNG_FILTER_NONE = 0; -var PNG_FILTER_SUB = 1; -var PNG_FILTER_UP = 2; -var PNG_FILTER_AVERAGE = 3; -var PNG_FILTER_PATH = 4; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['png']), - constants: { - MIME_PNG: MIME_TYPE, - PNG_FILTER_AUTO: PNG_FILTER_AUTO, - PNG_FILTER_NONE: PNG_FILTER_NONE, - PNG_FILTER_SUB: PNG_FILTER_SUB, - PNG_FILTER_UP: PNG_FILTER_UP, - PNG_FILTER_AVERAGE: PNG_FILTER_AVERAGE, - PNG_FILTER_PATH: PNG_FILTER_PATH - }, - hasAlpha: (0, _defineProperty2["default"])({}, MIME_TYPE, true), - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, _pngjs.PNG.sync.read), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var png = new _pngjs.PNG({ +const MIME_TYPE = "image/png"; + +// PNG filter types +const PNG_FILTER_AUTO = -1; +const PNG_FILTER_NONE = 0; +const PNG_FILTER_SUB = 1; +const PNG_FILTER_UP = 2; +const PNG_FILTER_AVERAGE = 3; +const PNG_FILTER_PATH = 4; +var _default = () => ({ + mime: { + [MIME_TYPE]: ["png"] + }, + constants: { + MIME_PNG: MIME_TYPE, + PNG_FILTER_AUTO, + PNG_FILTER_NONE, + PNG_FILTER_SUB, + PNG_FILTER_UP, + PNG_FILTER_AVERAGE, + PNG_FILTER_PATH + }, + hasAlpha: { + [MIME_TYPE]: true + }, + decoders: { + [MIME_TYPE]: _pngjs.PNG.sync.read + }, + encoders: { + [MIME_TYPE](data) { + const png = new _pngjs.PNG({ width: data.bitmap.width, height: data.bitmap.height }); png.data = data.bitmap.data; return _pngjs.PNG.sync.write(png, { - width: data.bitmap.width, - height: data.bitmap.height, deflateLevel: data._deflateLevel, deflateStrategy: data._deflateStrategy, filterType: data._filterType, - colorType: typeof data._colorType === 'number' ? data._colorType : data._rgba ? 6 : 2, + colorType: typeof data._colorType === "number" ? data._colorType : data._rgba ? 6 : 2, inputHasAlpha: data._rgba }); - }), - "class": { - _deflateLevel: 9, - _deflateStrategy: 3, - _filterType: PNG_FILTER_AUTO, - _colorType: null, - - /** - * Sets the deflate level used when saving as PNG format (default is 9) - * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - deflateLevel: function deflateLevel(l, cb) { - if (typeof l !== 'number') { - return _utils.throwError.call(this, 'l must be a number', cb); - } - - if (l < 0 || l > 9) { - return _utils.throwError.call(this, 'l must be a number 0 - 9', cb); - } - - this._deflateLevel = Math.round(l); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Sets the deflate strategy used when saving as PNG format (default is 3) - * @param {number} s Deflate strategy to use 0-3. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - deflateStrategy: function deflateStrategy(s, cb) { - if (typeof s !== 'number') { - return _utils.throwError.call(this, 's must be a number', cb); - } - - if (s < 0 || s > 3) { - return _utils.throwError.call(this, 's must be a number 0 - 3', cb); - } - - this._deflateStrategy = Math.round(s); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Sets the filter type used when saving as PNG format (default is automatic filters) - * @param {number} f The quality to use -1-4. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - filterType: function filterType(f, cb) { - if (typeof f !== 'number') { - return _utils.throwError.call(this, 'n must be a number', cb); - } - - if (f < -1 || f > 4) { - return _utils.throwError.call(this, 'n must be -1 (auto) or a number 0 - 4', cb); - } - - this._filterType = Math.round(f); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Sets the color type used when saving as PNG format - * @param {number} s color type to use 0, 2, 4, 6. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - colorType: function colorType(s, cb) { - if (typeof s !== 'number') { - return _utils.throwError.call(this, 's must be a number', cb); - } - - if (s !== 0 && s !== 2 && s !== 4 && s !== 6) { - return _utils.throwError.call(this, 's must be a number 0, 2, 4, 6.', cb); - } - - this._colorType = Math.round(s); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; + } + }, + class: { + _deflateLevel: 9, + _deflateStrategy: 3, + _filterType: PNG_FILTER_AUTO, + _colorType: null, + /** + * Sets the deflate level used when saving as PNG format (default is 9) + * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression. + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + deflateLevel(l, cb) { + if (typeof l !== "number") { + return _utils.throwError.call(this, "l must be a number", cb); + } + if (l < 0 || l > 9) { + return _utils.throwError.call(this, "l must be a number 0 - 9", cb); + } + this._deflateLevel = Math.round(l); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Sets the deflate strategy used when saving as PNG format (default is 3) + * @param {number} s Deflate strategy to use 0-3. + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + deflateStrategy(s, cb) { + if (typeof s !== "number") { + return _utils.throwError.call(this, "s must be a number", cb); + } + if (s < 0 || s > 3) { + return _utils.throwError.call(this, "s must be a number 0 - 3", cb); } + this._deflateStrategy = Math.round(s); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Sets the filter type used when saving as PNG format (default is automatic filters) + * @param {number} f The quality to use -1-4. + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + filterType(f, cb) { + if (typeof f !== "number") { + return _utils.throwError.call(this, "n must be a number", cb); + } + if (f < -1 || f > 4) { + return _utils.throwError.call(this, "n must be -1 (auto) or a number 0 - 4", cb); + } + this._filterType = Math.round(f); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Sets the color type used when saving as PNG format + * @param {number} s color type to use 0, 2, 4, 6. + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + colorType(s, cb) { + if (typeof s !== "number") { + return _utils.throwError.call(this, "s must be a number", cb); + } + if (s !== 0 && s !== 2 && s !== 4 && s !== 6) { + return _utils.throwError.call(this, "s must be a number 0, 2, 4, 6.", cb); + } + this._colorType = Math.round(s); + if ((0, _utils.isNodePattern)(cb)) { + cb.call(this, null, this); + } + return this; } - }; -}; - -exports["default"] = _default; + } +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/png/dist/index.js.map b/project starter code/node_modules/@jimp/png/dist/index.js.map index e5a9771f..52b0f7a3 100644 --- a/project starter code/node_modules/@jimp/png/dist/index.js.map +++ b/project starter code/node_modules/@jimp/png/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","PNG_FILTER_AUTO","PNG_FILTER_NONE","PNG_FILTER_SUB","PNG_FILTER_UP","PNG_FILTER_AVERAGE","PNG_FILTER_PATH","mime","constants","MIME_PNG","hasAlpha","decoders","PNG","sync","read","encoders","data","png","width","bitmap","height","write","deflateLevel","_deflateLevel","deflateStrategy","_deflateStrategy","filterType","_filterType","colorType","_colorType","_rgba","inputHasAlpha","l","cb","throwError","call","Math","round","s","f"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,WAAlB,C,CAEA;;AACA,IAAMC,eAAe,GAAG,CAAC,CAAzB;AACA,IAAMC,eAAe,GAAG,CAAxB;AACA,IAAMC,cAAc,GAAG,CAAvB;AACA,IAAMC,aAAa,GAAG,CAAtB;AACA,IAAMC,kBAAkB,GAAG,CAA3B;AACA,IAAMC,eAAe,GAAG,CAAxB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKP,SAAL,EAAiB,CAAC,KAAD,CAAjB,CADgB;AAGpBQ,IAAAA,SAAS,EAAE;AACTC,MAAAA,QAAQ,EAAET,SADD;AAETC,MAAAA,eAAe,EAAfA,eAFS;AAGTC,MAAAA,eAAe,EAAfA,eAHS;AAITC,MAAAA,cAAc,EAAdA,cAJS;AAKTC,MAAAA,aAAa,EAAbA,aALS;AAMTC,MAAAA,kBAAkB,EAAlBA,kBANS;AAOTC,MAAAA,eAAe,EAAfA;AAPS,KAHS;AAapBI,IAAAA,QAAQ,uCAAKV,SAAL,EAAiB,IAAjB,CAbY;AAcpBW,IAAAA,QAAQ,uCAAKX,SAAL,EAAiBY,WAAIC,IAAJ,CAASC,IAA1B,CAdY;AAepBC,IAAAA,QAAQ,uCACLf,SADK,EACO,UAAAgB,IAAI,EAAI;AACnB,UAAMC,GAAG,GAAG,IAAIL,UAAJ,CAAQ;AAClBM,QAAAA,KAAK,EAAEF,IAAI,CAACG,MAAL,CAAYD,KADD;AAElBE,QAAAA,MAAM,EAAEJ,IAAI,CAACG,MAAL,CAAYC;AAFF,O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D,OAhFI;;AAiFL;;;;;;AAKIP,MAAAA,SAtFC,qBAsFSU,CAtFT,EAsFYL,EAtFZ,EAsFgB;AACnB,YAAI,OAAOK,CAAP,KAAa,QAAjB,EAA2B;AACzB,iBAAOJ,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,oBAAtB,EAA4CF,EAA5C,CAAP;AACD;;AAED,YAAIK,CAAC,KAAK,CAAN,IAAWA,CAAC,KAAK,CAAjB,IAAsBA,CAAC,KAAK,CAA5B,IAAiCA,CAAC,KAAK,CAA3C,EAA8C;AAC5C,iBAAOJ,kBAAWC,IAAX,CAAgB,IAAhB,EAAsB,gCAAtB,EAAwDF,EAAxD,CAAP;AACD;;AAED,aAAKJ,UAAL,GAAkBO,IAAI,CAACC,KAAL,CAAWC,CAAX,CAAlB;;AAEA,YAAI,0BAAcL,EAAd,CAAJ,EAAuB;AACrBA,UAAAA,EAAE,CAACE,IAAH,CAAQ,IAAR,EAAc,IAAd,EAAoB,IAApB;AACD;;AAED,eAAO,IAAP;AACD;AAtGI;AAzCa,GAAP;AAAA,C","sourcesContent":["import { PNG } from 'pngjs';\nimport { throwError, isNodePattern } from '@jimp/utils';\n\nconst MIME_TYPE = 'image/png';\n\n// PNG filter types\nconst PNG_FILTER_AUTO = -1;\nconst PNG_FILTER_NONE = 0;\nconst PNG_FILTER_SUB = 1;\nconst PNG_FILTER_UP = 2;\nconst PNG_FILTER_AVERAGE = 3;\nconst PNG_FILTER_PATH = 4;\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['png'] },\n\n constants: {\n MIME_PNG: MIME_TYPE,\n PNG_FILTER_AUTO,\n PNG_FILTER_NONE,\n PNG_FILTER_SUB,\n PNG_FILTER_UP,\n PNG_FILTER_AVERAGE,\n PNG_FILTER_PATH\n },\n\n hasAlpha: { [MIME_TYPE]: true },\n decoders: { [MIME_TYPE]: PNG.sync.read },\n encoders: {\n [MIME_TYPE]: data => {\n const png = new PNG({\n width: data.bitmap.width,\n height: data.bitmap.height\n });\n\n png.data = data.bitmap.data;\n\n return PNG.sync.write(png, {\n width: data.bitmap.width,\n height: data.bitmap.height,\n deflateLevel: data._deflateLevel,\n deflateStrategy: data._deflateStrategy,\n filterType: data._filterType,\n colorType:\n typeof data._colorType === 'number'\n ? data._colorType\n : data._rgba\n ? 6\n : 2,\n inputHasAlpha: data._rgba\n });\n }\n },\n\n class: {\n _deflateLevel: 9,\n _deflateStrategy: 3,\n _filterType: PNG_FILTER_AUTO,\n _colorType: null,\n\n /**\n * Sets the deflate level used when saving as PNG format (default is 9)\n * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateLevel(l, cb) {\n if (typeof l !== 'number') {\n return throwError.call(this, 'l must be a number', cb);\n }\n\n if (l < 0 || l > 9) {\n return throwError.call(this, 'l must be a number 0 - 9', cb);\n }\n\n this._deflateLevel = Math.round(l);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Sets the deflate strategy used when saving as PNG format (default is 3)\n * @param {number} s Deflate strategy to use 0-3.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateStrategy(s, cb) {\n if (typeof s !== 'number') {\n return throwError.call(this, 's must be a number', cb);\n }\n\n if (s < 0 || s > 3) {\n return throwError.call(this, 's must be a number 0 - 3', cb);\n }\n\n this._deflateStrategy = Math.round(s);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Sets the filter type used when saving as PNG format (default is automatic filters)\n * @param {number} f The quality to use -1-4.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n filterType(f, cb) {\n if (typeof f !== 'number') {\n return throwError.call(this, 'n must be a number', cb);\n }\n\n if (f < -1 || f > 4) {\n return throwError.call(\n this,\n 'n must be -1 (auto) or a number 0 - 4',\n cb\n );\n }\n\n this._filterType = Math.round(f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n /**\n * Sets the color type used when saving as PNG format\n * @param {number} s color type to use 0, 2, 4, 6.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */ colorType(s, cb) {\n if (typeof s !== 'number') {\n return throwError.call(this, 's must be a number', cb);\n }\n\n if (s !== 0 && s !== 2 && s !== 4 && s !== 6) {\n return throwError.call(this, 's must be a number 0, 2, 4, 6.', cb);\n }\n\n this._colorType = Math.round(s);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["MIME_TYPE","PNG_FILTER_AUTO","PNG_FILTER_NONE","PNG_FILTER_SUB","PNG_FILTER_UP","PNG_FILTER_AVERAGE","PNG_FILTER_PATH","mime","constants","MIME_PNG","hasAlpha","decoders","PNG","sync","read","encoders","data","png","width","bitmap","height","write","deflateLevel","_deflateLevel","deflateStrategy","_deflateStrategy","filterType","_filterType","colorType","_colorType","_rgba","inputHasAlpha","class","l","cb","throwError","call","Math","round","isNodePattern","s","f"],"sources":["../src/index.js"],"sourcesContent":["import { PNG } from \"pngjs\";\nimport { throwError, isNodePattern } from \"@jimp/utils\";\n\nconst MIME_TYPE = \"image/png\";\n\n// PNG filter types\nconst PNG_FILTER_AUTO = -1;\nconst PNG_FILTER_NONE = 0;\nconst PNG_FILTER_SUB = 1;\nconst PNG_FILTER_UP = 2;\nconst PNG_FILTER_AVERAGE = 3;\nconst PNG_FILTER_PATH = 4;\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"png\"] },\n\n constants: {\n MIME_PNG: MIME_TYPE,\n PNG_FILTER_AUTO,\n PNG_FILTER_NONE,\n PNG_FILTER_SUB,\n PNG_FILTER_UP,\n PNG_FILTER_AVERAGE,\n PNG_FILTER_PATH,\n },\n\n hasAlpha: { [MIME_TYPE]: true },\n decoders: { [MIME_TYPE]: PNG.sync.read },\n encoders: {\n [MIME_TYPE](data) {\n const png = new PNG({\n width: data.bitmap.width,\n height: data.bitmap.height,\n });\n\n png.data = data.bitmap.data;\n\n return PNG.sync.write(png, {\n deflateLevel: data._deflateLevel,\n deflateStrategy: data._deflateStrategy,\n filterType: data._filterType,\n colorType:\n typeof data._colorType === \"number\"\n ? data._colorType\n : data._rgba\n ? 6\n : 2,\n inputHasAlpha: data._rgba,\n });\n },\n },\n\n class: {\n _deflateLevel: 9,\n _deflateStrategy: 3,\n _filterType: PNG_FILTER_AUTO,\n _colorType: null,\n\n /**\n * Sets the deflate level used when saving as PNG format (default is 9)\n * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateLevel(l, cb) {\n if (typeof l !== \"number\") {\n return throwError.call(this, \"l must be a number\", cb);\n }\n\n if (l < 0 || l > 9) {\n return throwError.call(this, \"l must be a number 0 - 9\", cb);\n }\n\n this._deflateLevel = Math.round(l);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Sets the deflate strategy used when saving as PNG format (default is 3)\n * @param {number} s Deflate strategy to use 0-3.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateStrategy(s, cb) {\n if (typeof s !== \"number\") {\n return throwError.call(this, \"s must be a number\", cb);\n }\n\n if (s < 0 || s > 3) {\n return throwError.call(this, \"s must be a number 0 - 3\", cb);\n }\n\n this._deflateStrategy = Math.round(s);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Sets the filter type used when saving as PNG format (default is automatic filters)\n * @param {number} f The quality to use -1-4.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n filterType(f, cb) {\n if (typeof f !== \"number\") {\n return throwError.call(this, \"n must be a number\", cb);\n }\n\n if (f < -1 || f > 4) {\n return throwError.call(\n this,\n \"n must be -1 (auto) or a number 0 - 4\",\n cb\n );\n }\n\n this._filterType = Math.round(f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n /**\n * Sets the color type used when saving as PNG format\n * @param {number} s color type to use 0, 2, 4, 6.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */ colorType(s, cb) {\n if (typeof s !== \"number\") {\n return throwError.call(this, \"s must be a number\", cb);\n }\n\n if (s !== 0 && s !== 2 && s !== 4 && s !== 6) {\n return throwError.call(this, \"s must be a number 0, 2, 4, 6.\", cb);\n }\n\n this._colorType = Math.round(s);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n },\n});\n"],"mappings":";;;;;;AAAA;AACA;AAEA,MAAMA,SAAS,GAAG,WAAW;;AAE7B;AACA,MAAMC,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAMC,eAAe,GAAG,CAAC;AACzB,MAAMC,cAAc,GAAG,CAAC;AACxB,MAAMC,aAAa,GAAG,CAAC;AACvB,MAAMC,kBAAkB,GAAG,CAAC;AAC5B,MAAMC,eAAe,GAAG,CAAC;AAAC,eAEX,OAAO;EACpBC,IAAI,EAAE;IAAE,CAACP,SAAS,GAAG,CAAC,KAAK;EAAE,CAAC;EAE9BQ,SAAS,EAAE;IACTC,QAAQ,EAAET,SAAS;IACnBC,eAAe;IACfC,eAAe;IACfC,cAAc;IACdC,aAAa;IACbC,kBAAkB;IAClBC;EACF,CAAC;EAEDI,QAAQ,EAAE;IAAE,CAACV,SAAS,GAAG;EAAK,CAAC;EAC/BW,QAAQ,EAAE;IAAE,CAACX,SAAS,GAAGY,UAAG,CAACC,IAAI,CAACC;EAAK,CAAC;EACxCC,QAAQ,EAAE;IACR,CAACf,SAAS,E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CAAC;IACD;AACJ;AACA;AACA;AACA;AACA;IAAQR,SAAS,CAACY,CAAC,EAAEN,EAAE,EAAE;MACnB,IAAI,OAAOM,CAAC,KAAK,QAAQ,EAAE;QACzB,OAAOL,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,oBAAoB,EAAEF,EAAE,CAAC;MACxD;MAEA,IAAIM,CAAC,KAAK,CAAC,IAAIA,CAAC,KAAK,CAAC,IAAIA,CAAC,KAAK,CAAC,IAAIA,CAAC,KAAK,CAAC,EAAE;QAC5C,OAAOL,iBAAU,CAACC,IAAI,CAAC,IAAI,EAAE,gCAAgC,EAAEF,EAAE,CAAC;MACpE;MAEA,IAAI,CAACL,UAAU,GAAGQ,IAAI,CAACC,KAAK,CAACE,CAAC,CAAC;MAE/B,IAAI,IAAAD,oBAAa,EAACL,EAAE,CAAC,EAAE;QACrBA,EAAE,CAACE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;MAC3B;MAEA,OAAO,IAAI;IACb;EACF;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/png/es/index.js b/project starter code/node_modules/@jimp/png/es/index.js index 95f2855e..16e1397a 100644 --- a/project starter code/node_modules/@jimp/png/es/index.js +++ b/project starter code/node_modules/@jimp/png/es/index.js @@ -1,161 +1,130 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _pngjs = require("pngjs"); - -var _utils = require("@jimp/utils"); - -var MIME_TYPE = 'image/png'; // PNG filter types - -var PNG_FILTER_AUTO = -1; -var PNG_FILTER_NONE = 0; -var PNG_FILTER_SUB = 1; -var PNG_FILTER_UP = 2; -var PNG_FILTER_AVERAGE = 3; -var PNG_FILTER_PATH = 4; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['png']), - constants: { - MIME_PNG: MIME_TYPE, - PNG_FILTER_AUTO: PNG_FILTER_AUTO, - PNG_FILTER_NONE: PNG_FILTER_NONE, - PNG_FILTER_SUB: PNG_FILTER_SUB, - PNG_FILTER_UP: PNG_FILTER_UP, - PNG_FILTER_AVERAGE: PNG_FILTER_AVERAGE, - PNG_FILTER_PATH: PNG_FILTER_PATH - }, - hasAlpha: (0, _defineProperty2["default"])({}, MIME_TYPE, true), - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, _pngjs.PNG.sync.read), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var png = new _pngjs.PNG({ +import { PNG } from "pngjs"; +import { throwError, isNodePattern } from "@jimp/utils"; +const MIME_TYPE = "image/png"; + +// PNG filter types +const PNG_FILTER_AUTO = -1; +const PNG_FILTER_NONE = 0; +const PNG_FILTER_SUB = 1; +const PNG_FILTER_UP = 2; +const PNG_FILTER_AVERAGE = 3; +const PNG_FILTER_PATH = 4; +export default (() => ({ + mime: { + [MIME_TYPE]: ["png"] + }, + constants: { + MIME_PNG: MIME_TYPE, + PNG_FILTER_AUTO, + PNG_FILTER_NONE, + PNG_FILTER_SUB, + PNG_FILTER_UP, + PNG_FILTER_AVERAGE, + PNG_FILTER_PATH + }, + hasAlpha: { + [MIME_TYPE]: true + }, + decoders: { + [MIME_TYPE]: PNG.sync.read + }, + encoders: { + [MIME_TYPE](data) { + const png = new PNG({ width: data.bitmap.width, height: data.bitmap.height }); png.data = data.bitmap.data; - return _pngjs.PNG.sync.write(png, { - width: data.bitmap.width, - height: data.bitmap.height, + return PNG.sync.write(png, { deflateLevel: data._deflateLevel, deflateStrategy: data._deflateStrategy, filterType: data._filterType, - colorType: typeof data._colorType === 'number' ? data._colorType : data._rgba ? 6 : 2, + colorType: typeof data._colorType === "number" ? data._colorType : data._rgba ? 6 : 2, inputHasAlpha: data._rgba }); - }), - "class": { - _deflateLevel: 9, - _deflateStrategy: 3, - _filterType: PNG_FILTER_AUTO, - _colorType: null, - - /** - * Sets the deflate level used when saving as PNG format (default is 9) - * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - deflateLevel: function deflateLevel(l, cb) { - if (typeof l !== 'number') { - return _utils.throwError.call(this, 'l must be a number', cb); - } - - if (l < 0 || l > 9) { - return _utils.throwError.call(this, 'l must be a number 0 - 9', cb); - } - - this._deflateLevel = Math.round(l); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Sets the deflate strategy used when saving as PNG format (default is 3) - * @param {number} s Deflate strategy to use 0-3. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - deflateStrategy: function deflateStrategy(s, cb) { - if (typeof s !== 'number') { - return _utils.throwError.call(this, 's must be a number', cb); - } - - if (s < 0 || s > 3) { - return _utils.throwError.call(this, 's must be a number 0 - 3', cb); - } - - this._deflateStrategy = Math.round(s); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Sets the filter type used when saving as PNG format (default is automatic filters) - * @param {number} f The quality to use -1-4. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - filterType: function filterType(f, cb) { - if (typeof f !== 'number') { - return _utils.throwError.call(this, 'n must be a number', cb); - } - - if (f < -1 || f > 4) { - return _utils.throwError.call(this, 'n must be -1 (auto) or a number 0 - 4', cb); - } - - this._filterType = Math.round(f); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Sets the color type used when saving as PNG format - * @param {number} s color type to use 0, 2, 4, 6. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - colorType: function colorType(s, cb) { - if (typeof s !== 'number') { - return _utils.throwError.call(this, 's must be a number', cb); - } - - if (s !== 0 && s !== 2 && s !== 4 && s !== 6) { - return _utils.throwError.call(this, 's must be a number 0, 2, 4, 6.', cb); - } - - this._colorType = Math.round(s); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; + } + }, + class: { + _deflateLevel: 9, + _deflateStrategy: 3, + _filterType: PNG_FILTER_AUTO, + _colorType: null, + /** + * Sets the deflate level used when saving as PNG format (default is 9) + * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression. + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + deflateLevel(l, cb) { + if (typeof l !== "number") { + return throwError.call(this, "l must be a number", cb); + } + if (l < 0 || l > 9) { + return throwError.call(this, "l must be a number 0 - 9", cb); + } + this._deflateLevel = Math.round(l); + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Sets the deflate strategy used when saving as PNG format (default is 3) + * @param {number} s Deflate strategy to use 0-3. + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + deflateStrategy(s, cb) { + if (typeof s !== "number") { + return throwError.call(this, "s must be a number", cb); } + if (s < 0 || s > 3) { + return throwError.call(this, "s must be a number 0 - 3", cb); + } + this._deflateStrategy = Math.round(s); + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Sets the filter type used when saving as PNG format (default is automatic filters) + * @param {number} f The quality to use -1-4. + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + filterType(f, cb) { + if (typeof f !== "number") { + return throwError.call(this, "n must be a number", cb); + } + if (f < -1 || f > 4) { + return throwError.call(this, "n must be -1 (auto) or a number 0 - 4", cb); + } + this._filterType = Math.round(f); + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; + }, + /** + * Sets the color type used when saving as PNG format + * @param {number} s color type to use 0, 2, 4, 6. + * @param {function(Error, Jimp)} cb (optional) a callback for when complete + * @returns {Jimp} this for chaining of methods + */ + colorType(s, cb) { + if (typeof s !== "number") { + return throwError.call(this, "s must be a number", cb); + } + if (s !== 0 && s !== 2 && s !== 4 && s !== 6) { + return throwError.call(this, "s must be a number 0, 2, 4, 6.", cb); + } + this._colorType = Math.round(s); + if (isNodePattern(cb)) { + cb.call(this, null, this); + } + return this; } - }; -}; - -exports["default"] = _default; + } +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/png/es/index.js.map b/project starter code/node_modules/@jimp/png/es/index.js.map index e5a9771f..e1070dae 100644 --- a/project starter code/node_modules/@jimp/png/es/index.js.map +++ b/project starter code/node_modules/@jimp/png/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","PNG_FILTER_AUTO","PNG_FILTER_NONE","PNG_FILTER_SUB","PNG_FILTER_UP","PNG_FILTER_AVERAGE","PNG_FILTER_PATH","mime","constants","MIME_PNG","hasAlpha","decoders","PNG","sync","read","encoders","data","png","width","bitmap","height","write","deflateLevel","_deflateLevel","deflateStrategy","_deflateStrategy","filterType","_filterType","colorType","_colorType","_rgba","inputHasAlpha","l","cb","throwError","call","Math","round","s","f"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AAEA,IAAMA,SAAS,GAAG,WAAlB,C,CAEA;;AACA,IAAMC,eAAe,GAAG,CAAC,CAAzB;AACA,IAAMC,eAAe,GAAG,CAAxB;AACA,IAAMC,cAAc,GAAG,CAAvB;AACA,IAAMC,aAAa,GAAG,CAAtB;AACA,IAAMC,kBAAkB,GAAG,CAA3B;AACA,IAAMC,eAAe,GAAG,CAAxB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKP,SAAL,EAAiB,CAAC,KAAD,CAAjB,CADgB;AAGpBQ,IAAAA,SAAS,EAAE;AACTC,MAAAA,QAAQ,EAAET,SADD;AAETC,MAAAA,eAAe,EAAfA,eAFS;AAGTC,MAAAA,eAAe,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imp/utils';\n\nconst MIME_TYPE = 'image/png';\n\n// PNG filter types\nconst PNG_FILTER_AUTO = -1;\nconst PNG_FILTER_NONE = 0;\nconst PNG_FILTER_SUB = 1;\nconst PNG_FILTER_UP = 2;\nconst PNG_FILTER_AVERAGE = 3;\nconst PNG_FILTER_PATH = 4;\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['png'] },\n\n constants: {\n MIME_PNG: MIME_TYPE,\n PNG_FILTER_AUTO,\n PNG_FILTER_NONE,\n PNG_FILTER_SUB,\n PNG_FILTER_UP,\n PNG_FILTER_AVERAGE,\n PNG_FILTER_PATH\n },\n\n hasAlpha: { [MIME_TYPE]: true },\n decoders: { [MIME_TYPE]: PNG.sync.read },\n encoders: {\n [MIME_TYPE]: data => {\n const png = new PNG({\n width: data.bitmap.width,\n height: data.bitmap.height\n });\n\n png.data = data.bitmap.data;\n\n return PNG.sync.write(png, {\n width: data.bitmap.width,\n height: data.bitmap.height,\n deflateLevel: data._deflateLevel,\n deflateStrategy: data._deflateStrategy,\n filterType: data._filterType,\n colorType:\n typeof data._colorType === 'number'\n ? data._colorType\n : data._rgba\n ? 6\n : 2,\n inputHasAlpha: data._rgba\n });\n }\n },\n\n class: {\n _deflateLevel: 9,\n _deflateStrategy: 3,\n _filterType: PNG_FILTER_AUTO,\n _colorType: null,\n\n /**\n * Sets the deflate level used when saving as PNG format (default is 9)\n * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateLevel(l, cb) {\n if (typeof l !== 'number') {\n return throwError.call(this, 'l must be a number', cb);\n }\n\n if (l < 0 || l > 9) {\n return throwError.call(this, 'l must be a number 0 - 9', cb);\n }\n\n this._deflateLevel = Math.round(l);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Sets the deflate strategy used when saving as PNG format (default is 3)\n * @param {number} s Deflate strategy to use 0-3.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateStrategy(s, cb) {\n if (typeof s !== 'number') {\n return throwError.call(this, 's must be a number', cb);\n }\n\n if (s < 0 || s > 3) {\n return throwError.call(this, 's must be a number 0 - 3', cb);\n }\n\n this._deflateStrategy = Math.round(s);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Sets the filter type used when saving as PNG format (default is automatic filters)\n * @param {number} f The quality to use -1-4.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n filterType(f, cb) {\n if (typeof f !== 'number') {\n return throwError.call(this, 'n must be a number', cb);\n }\n\n if (f < -1 || f > 4) {\n return throwError.call(\n this,\n 'n must be -1 (auto) or a number 0 - 4',\n cb\n );\n }\n\n this._filterType = Math.round(f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n /**\n * Sets the color type used when saving as PNG format\n * @param {number} s color type to use 0, 2, 4, 6.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */ colorType(s, cb) {\n if (typeof s !== 'number') {\n return throwError.call(this, 's must be a number', cb);\n }\n\n if (s !== 0 && s !== 2 && s !== 4 && s !== 6) {\n return throwError.call(this, 's must be a number 0, 2, 4, 6.', cb);\n }\n\n this._colorType = Math.round(s);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["PNG","throwError","isNodePattern","MIME_TYPE","PNG_FILTER_AUTO","PNG_FILTER_NONE","PNG_FILTER_SUB","PNG_FILTER_UP","PNG_FILTER_AVERAGE","PNG_FILTER_PATH","mime","constants","MIME_PNG","hasAlpha","decoders","sync","read","encoders","data","png","width","bitmap","height","write","deflateLevel","_deflateLevel","deflateStrategy","_deflateStrategy","filterType","_filterType","colorType","_colorType","_rgba","inputHasAlpha","class","l","cb","call","Math","round","s","f"],"sources":["../src/index.js"],"sourcesContent":["import { PNG } from \"pngjs\";\nimport { throwError, isNodePattern } from \"@jimp/utils\";\n\nconst MIME_TYPE = \"image/png\";\n\n// PNG filter types\nconst PNG_FILTER_AUTO = -1;\nconst PNG_FILTER_NONE = 0;\nconst PNG_FILTER_SUB = 1;\nconst PNG_FILTER_UP = 2;\nconst PNG_FILTER_AVERAGE = 3;\nconst PNG_FILTER_PATH = 4;\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"png\"] },\n\n constants: {\n MIME_PNG: MIME_TYPE,\n PNG_FILTER_AUTO,\n PNG_FILTER_NONE,\n PNG_FILTER_SUB,\n PNG_FILTER_UP,\n PNG_FILTER_AVERAGE,\n PNG_FILTER_PATH,\n },\n\n hasAlpha: { [MIME_TYPE]: true },\n decoders: { [MIME_TYPE]: PNG.sync.read },\n encoders: {\n [MIME_TYPE](data) {\n const png = new PNG({\n width: data.bitmap.width,\n height: data.bitmap.height,\n });\n\n png.data = data.bitmap.data;\n\n return PNG.sync.write(png, {\n deflateLevel: data._deflateLevel,\n deflateStrategy: data._deflateStrategy,\n filterType: data._filterType,\n colorType:\n typeof data._colorType === \"number\"\n ? data._colorType\n : data._rgba\n ? 6\n : 2,\n inputHasAlpha: data._rgba,\n });\n },\n },\n\n class: {\n _deflateLevel: 9,\n _deflateStrategy: 3,\n _filterType: PNG_FILTER_AUTO,\n _colorType: null,\n\n /**\n * Sets the deflate level used when saving as PNG format (default is 9)\n * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateLevel(l, cb) {\n if (typeof l !== \"number\") {\n return throwError.call(this, \"l must be a number\", cb);\n }\n\n if (l < 0 || l > 9) {\n return throwError.call(this, \"l must be a number 0 - 9\", cb);\n }\n\n this._deflateLevel = Math.round(l);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Sets the deflate strategy used when saving as PNG format (default is 3)\n * @param {number} s Deflate strategy to use 0-3.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateStrategy(s, cb) {\n if (typeof s !== \"number\") {\n return throwError.call(this, \"s must be a number\", cb);\n }\n\n if (s < 0 || s > 3) {\n return throwError.call(this, \"s must be a number 0 - 3\", cb);\n }\n\n this._deflateStrategy = Math.round(s);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n\n /**\n * Sets the filter type used when saving as PNG format (default is automatic filters)\n * @param {number} f The quality to use -1-4.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n filterType(f, cb) {\n if (typeof f !== \"number\") {\n return throwError.call(this, \"n must be a number\", cb);\n }\n\n if (f < -1 || f > 4) {\n return throwError.call(\n this,\n \"n must be -1 (auto) or a number 0 - 4\",\n cb\n );\n }\n\n this._filterType = Math.round(f);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n /**\n * Sets the color type used when saving as PNG format\n * @param {number} s color type to use 0, 2, 4, 6.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */ colorType(s, cb) {\n if (typeof s !== \"number\") {\n return throwError.call(this, \"s must be a number\", cb);\n }\n\n if (s !== 0 && s !== 2 && s !== 4 && s !== 6) {\n return throwError.call(this, \"s must be a number 0, 2, 4, 6.\", cb);\n }\n\n this._colorType = Math.round(s);\n\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n\n return this;\n },\n },\n});\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,OAAO;AAC3B,SAASC,UAAU,EAAEC,aAAa,QAAQ,aAAa;AAEvD,MAAMC,SAAS,GAAG,WAAW;;AAE7B;AACA,MAAMC,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node_modules/@jimp/png/index.d.ts b/project starter code/node_modules/@jimp/png/index.d.ts index 945db8ec..52bcda0c 100644 --- a/project starter code/node_modules/@jimp/png/index.d.ts +++ b/project starter code/node_modules/@jimp/png/index.d.ts @@ -1,10 +1,10 @@ -import { DecoderFn, EncoderFn, ImageCallback } from '@jimp/core'; +import { DecoderFn, EncoderFn, ImageCallback } from "@jimp/core"; interface PNGClass { - _deflateLevel: number, - _deflateStrategy: number, - _filterType: number, - _colorType: number, + _deflateLevel: number; + _deflateStrategy: number; + _filterType: number; + _colorType: number; deflateLevel(l: number, cb?: ImageCallback): this; deflateStrategy(s: number, cb?: ImageCallback): this; filterType(f: number, cb?: ImageCallback): this; @@ -12,22 +12,21 @@ interface PNGClass { } interface PNG { + mime: { "image/png": string[] }; - mime: { 'image/png': string[] }, - - hasAlpha: { 'image/png': true }, + hasAlpha: { "image/png": true }; decoders: { - 'image/png': DecoderFn - } + "image/png": DecoderFn; + }; encoders: { - 'image/png': EncoderFn - } + "image/png": EncoderFn; + }; + + class: PNGClass; - class: PNGClass - constants: { - MIME_PNG: 'image/png'; + MIME_PNG: "image/png"; // PNG filter types PNG_FILTER_AUTO: -1; PNG_FILTER_NONE: 0; @@ -35,7 +34,7 @@ interface PNG { PNG_FILTER_UP: 2; PNG_FILTER_AVERAGE: 3; PNG_FILTER_PATH: 4; - } + }; } -export default function(): PNG; +export default function (): PNG; diff --git a/project starter code/node_modules/@jimp/png/package.json b/project starter code/node_modules/@jimp/png/package.json index 8d64d22d..a5b0e2db 100644 --- a/project starter code/node_modules/@jimp/png/package.json +++ b/project starter code/node_modules/@jimp/png/package.json @@ -1,12 +1,13 @@ { "name": "@jimp/png", - "version": "0.16.2", + "version": "0.22.12", "description": "Default Jimp png encoder/decoder.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js", "test:watch": "npm run test -- --reporter min --watch", "test:coverage": "nyc npm run test", "build": "npm run build:node:production && npm run build:module", @@ -20,19 +21,19 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "pngjs": "^3.3.3" + "@jimp/utils": "^0.22.12", + "pngjs": "^6.0.0" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" }, "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/test-utils": "^0.16.2" + "@jimp/custom": "^0.22.12", + "@jimp/test-utils": "^0.22.12", + "@types/pngjs": "^6.0.1" }, "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/png/src/index.js b/project starter code/node_modules/@jimp/png/src/index.js index 0e9c7477..2c81c063 100644 --- a/project starter code/node_modules/@jimp/png/src/index.js +++ b/project starter code/node_modules/@jimp/png/src/index.js @@ -1,7 +1,7 @@ -import { PNG } from 'pngjs'; -import { throwError, isNodePattern } from '@jimp/utils'; +import { PNG } from "pngjs"; +import { throwError, isNodePattern } from "@jimp/utils"; -const MIME_TYPE = 'image/png'; +const MIME_TYPE = "image/png"; // PNG filter types const PNG_FILTER_AUTO = -1; @@ -12,7 +12,7 @@ const PNG_FILTER_AVERAGE = 3; const PNG_FILTER_PATH = 4; export default () => ({ - mime: { [MIME_TYPE]: ['png'] }, + mime: { [MIME_TYPE]: ["png"] }, constants: { MIME_PNG: MIME_TYPE, @@ -21,35 +21,33 @@ export default () => ({ PNG_FILTER_SUB, PNG_FILTER_UP, PNG_FILTER_AVERAGE, - PNG_FILTER_PATH + PNG_FILTER_PATH, }, hasAlpha: { [MIME_TYPE]: true }, decoders: { [MIME_TYPE]: PNG.sync.read }, encoders: { - [MIME_TYPE]: data => { + [MIME_TYPE](data) { const png = new PNG({ width: data.bitmap.width, - height: data.bitmap.height + height: data.bitmap.height, }); png.data = data.bitmap.data; return PNG.sync.write(png, { - width: data.bitmap.width, - height: data.bitmap.height, deflateLevel: data._deflateLevel, deflateStrategy: data._deflateStrategy, filterType: data._filterType, colorType: - typeof data._colorType === 'number' + typeof data._colorType === "number" ? data._colorType : data._rgba - ? 6 - : 2, - inputHasAlpha: data._rgba + ? 6 + : 2, + inputHasAlpha: data._rgba, }); - } + }, }, class: { @@ -65,12 +63,12 @@ export default () => ({ * @returns {Jimp} this for chaining of methods */ deflateLevel(l, cb) { - if (typeof l !== 'number') { - return throwError.call(this, 'l must be a number', cb); + if (typeof l !== "number") { + return throwError.call(this, "l must be a number", cb); } if (l < 0 || l > 9) { - return throwError.call(this, 'l must be a number 0 - 9', cb); + return throwError.call(this, "l must be a number 0 - 9", cb); } this._deflateLevel = Math.round(l); @@ -89,12 +87,12 @@ export default () => ({ * @returns {Jimp} this for chaining of methods */ deflateStrategy(s, cb) { - if (typeof s !== 'number') { - return throwError.call(this, 's must be a number', cb); + if (typeof s !== "number") { + return throwError.call(this, "s must be a number", cb); } if (s < 0 || s > 3) { - return throwError.call(this, 's must be a number 0 - 3', cb); + return throwError.call(this, "s must be a number 0 - 3", cb); } this._deflateStrategy = Math.round(s); @@ -113,14 +111,14 @@ export default () => ({ * @returns {Jimp} this for chaining of methods */ filterType(f, cb) { - if (typeof f !== 'number') { - return throwError.call(this, 'n must be a number', cb); + if (typeof f !== "number") { + return throwError.call(this, "n must be a number", cb); } if (f < -1 || f > 4) { return throwError.call( this, - 'n must be -1 (auto) or a number 0 - 4', + "n must be -1 (auto) or a number 0 - 4", cb ); } @@ -139,12 +137,12 @@ export default () => ({ * @param {function(Error, Jimp)} cb (optional) a callback for when complete * @returns {Jimp} this for chaining of methods */ colorType(s, cb) { - if (typeof s !== 'number') { - return throwError.call(this, 's must be a number', cb); + if (typeof s !== "number") { + return throwError.call(this, "s must be a number", cb); } if (s !== 0 && s !== 2 && s !== 4 && s !== 6) { - return throwError.call(this, 's must be a number 0, 2, 4, 6.', cb); + return throwError.call(this, "s must be a number 0, 2, 4, 6.", cb); } this._colorType = Math.round(s); @@ -154,6 +152,6 @@ export default () => ({ } return this; - } - } + }, + }, }); diff --git a/project starter code/node_modules/@jimp/png/test/png.test.js b/project starter code/node_modules/@jimp/png/test/png.test.js index 30a297d6..ff10457c 100644 --- a/project starter code/node_modules/@jimp/png/test/png.test.js +++ b/project starter code/node_modules/@jimp/png/test/png.test.js @@ -1,84 +1,48 @@ -import { Jimp, getTestDir } from '@jimp/test-utils'; -import configure from '@jimp/custom'; +import { Jimp, getTestDir } from "@jimp/test-utils"; +import configure from "@jimp/custom"; +import expect from "@storybook/expect"; -import png from '../src'; +import png from "../src"; const jimp = configure({ types: [png] }, Jimp); -describe('PNG', () => { - const imagesDir = getTestDir(__dirname) + '/images'; +describe("PNG", () => { + const imagesDir = getTestDir(__dirname) + "/images"; - it('load PNG', async () => { - const image = await jimp.read(imagesDir + '/dice.png'); + it("load PNG", async () => { + const image = await jimp.read(imagesDir + "/dice.png"); - image.getPixelColor(10, 10).should.be.equal(0x00000000); - image.getPixelColor(160, 80).should.be.equal(0x1c1cd4ff); - image.getPixelColor(400, 250).should.be.equal(0x7e0c0cda); + expect(image.getPixelColor(10, 10)).toBe(0x00000000); + expect(image.getPixelColor(160, 80)).toBe(0x1c1cd4ff); + expect(image.getPixelColor(400, 250)).toBe(0x7e0c0cda); }); - it('export PNG', async () => { + it("export PNG", async () => { const jgd = await jimp.read({ width: 3, height: 3, data: [ - 0xff0000ff, - 0xff0080ff, - 0xff00ffff, - 0xff0080ff, - 0xff00ffff, - 0x8000ffff, - 0xff00ffff, - 0x8000ffff, - 0x0000ffff - ] + 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff, + 0xff00ffff, 0x8000ffff, 0x0000ffff, + ], }); - const buffer = await jgd.getBufferAsync('image/png'); + const buffer = await jgd.getBufferAsync("image/png"); - buffer.toString().should.match(/^.PNG\r\n/); + expect(buffer.toString()).toMatch(/^.PNG\r\n/); }); - it('should use png options', async () => { + it("should use png options", async () => { const jgd = await jimp.read({ width: 20, height: 20, data: [ - 0xff0000ff, - 0xff0080ff, - 0xff00ffff, - 0xff0080ff, - 0xff00ffff, - 0x8000ffff, - 0xff00ffff, - 0x8000ffff, - 0x0000ffff, - 0xff0000ff, - 0xff0080ff, - 0xff00ffff, - 0xff0080ff, - 0xff00ffff, - 0x8000ffff, - 0xff00ffff, - 0x8000ffff, - 0x0000ffff, - 0xff0000ff, - 0xff0080ff, - 0xff00ffff, - 0xff0080ff, - 0xff00ffff, - 0x8000ffff, - 0xff00ffff, - 0x8000ffff, - 0x0000ffff, - 0xff0000ff, - 0xff0080ff, - 0xff00ffff, - 0xff0080ff, - 0xff00ffff, - 0x8000ffff, - 0xff00ffff, - 0x8000ffff, - 0x0000ffff - ] + 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff, + 0xff00ffff, 0x8000ffff, 0x0000ffff, 0xff0000ff, 0xff0080ff, 0xff00ffff, + 0xff0080ff, 0xff00ffff, 0x8000ffff, 0xff00ffff, 0x8000ffff, 0x0000ffff, + 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff, + 0xff00ffff, 0x8000ffff, 0x0000ffff, 0xff0000ff, 0xff0080ff, 0xff00ffff, + 0xff0080ff, 0xff00ffff, 0x8000ffff, 0xff00ffff, 0x8000ffff, 0x0000ffff, + ], }); const image = await jgd @@ -86,12 +50,12 @@ describe('PNG', () => { .colorType(0) .getBufferAsync(Jimp.MIME_PNG); - const expected = await jimp.read(imagesDir + '/options.png'); + const expected = await jimp.read(imagesDir + "/options.png"); const expectedBuffer = await expected .deflateStrategy(0) .colorType(0) .getBufferAsync(Jimp.MIME_PNG); - image.should.be.deepEqual(expectedBuffer); + expect(image).toEqual(expectedBuffer); }); }); diff --git a/project starter code/node_modules/@jimp/tiff/CHANGELOG.md b/project starter code/node_modules/@jimp/tiff/CHANGELOG.md index 26394e0f..dce8da69 100644 --- a/project starter code/node_modules/@jimp/tiff/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/tiff/CHANGELOG.md @@ -1,3 +1,77 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.22.0 (Mon Feb 06 2023) + +#### 🏠 Internal + +- switch from should to expect [#1163](https://github.com/jimp-dev/jimp/pull/1163) ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Change test matching strategy to include all test files [#1161](https://github.com/jimp-dev/jimp/pull/1161) ([@danielholmes](https://github.com/danielholmes)) + +#### Authors: 2 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) +- Daniel Holmes ([@danielholmes](https://github.com/danielholmes)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.18.0 (Sun Feb 05 2023) + +#### 🚀 Enhancement + +- Update utif [#1143](https://github.com/jimp-dev/jimp/pull/1143) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -12,7 +86,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -20,4 +94,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/tiff/dist/index.js b/project starter code/node_modules/@jimp/tiff/dist/index.js index cf242ccb..adea7438 100644 --- a/project starter code/node_modules/@jimp/tiff/dist/index.js +++ b/project starter code/node_modules/@jimp/tiff/dist/index.js @@ -1,47 +1,42 @@ "use strict"; -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _utif = _interopRequireDefault(require("utif")); - -var MIME_TYPE = 'image/tiff'; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['tiff', 'tif']), - constants: { - MIME_TIFF: MIME_TYPE - }, - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var ifds = _utif["default"].decode(data); - - var page = ifds[0]; - - _utif["default"].decodeImages(data, ifds); - - var rgba = _utif["default"].toRGBA8(page); - +exports.default = void 0; +var _utif = _interopRequireDefault(require("utif2")); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +const MIME_TYPE = "image/tiff"; +var _default = () => ({ + mime: { + [MIME_TYPE]: ["tiff", "tif"] + }, + constants: { + MIME_TIFF: MIME_TYPE + }, + decoders: { + [MIME_TYPE]: data => { + const ifds = _utif.default.decode(data); + const page = ifds[0]; + ifds.forEach(ifd => { + _utif.default.decodeImage(data, ifd); + }); + const rgba = _utif.default.toRGBA8(page); return { data: Buffer.from(rgba), width: page.t256[0], height: page.t257[0] }; - }), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (image) { - var tiff = _utif["default"].encodeImage(image.bitmap.data, image.bitmap.width, image.bitmap.height); - + } + }, + encoders: { + [MIME_TYPE]: image => { + const tiff = _utif.default.encodeImage(image.bitmap.data, image.bitmap.width, image.bitmap.height); return Buffer.from(tiff); - }) - }; -}; - -exports["default"] = _default; + } + } +}); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/tiff/dist/index.js.map b/project starter code/node_modules/@jimp/tiff/dist/index.js.map index 639a6f4f..862d34d4 100644 --- a/project starter code/node_modules/@jimp/tiff/dist/index.js.map +++ b/project starter code/node_modules/@jimp/tiff/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","mime","constants","MIME_TIFF","decoders","data","ifds","UTIF","decode","page","decodeImages","rgba","toRGBA8","Buffer","from","width","t256","height","t257","encoders","image","tiff","encodeImage","bitmap"],"mappings":";;;;;;;;;;;AAAA;;AAEA,IAAMA,SAAS,GAAG,YAAlB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKD,SAAL,EAAiB,CAAC,MAAD,EAAS,KAAT,CAAjB,CADgB;AAGpBE,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAEH;AADF,KAHS;AAOpBI,IAAAA,QAAQ,uCACLJ,SADK,EACO,UAAAK,IAAI,EAAI;AACnB,UAAMC,IAAI,GAAGC,iBAAKC,MAAL,CAAYH,IAAZ,CAAb;;AACA,UAAMI,IAAI,GAAGH,IAAI,CAAC,CAAD,CAAjB;;AACAC,uBAAKG,YAAL,CAAkBL,IAAlB,EAAwBC,IAAxB;;AACA,UAAMK,IAAI,GAAGJ,iBAAKK,OAAL,CAAaH,IAAb,CAAb;;AAEA,aAAO;AACLJ,QAAAA,IAAI,EAAEQ,MAAM,CAACC,IAAP,CAAYH,IAAZ,CADD;AAELI,QAAAA,KAAK,EAAEN,IAAI,CAACO,IAAL,CAAU,CAAV,CAFF;AAGLC,QAAAA,MAAM,EAAER,IAAI,CAACS,IAAL,CAAU,CAAV;AAHH,OAAP;AAKD,KAZK,CAPY;AAsBpBC,IAAAA,QAAQ,uCACLnB,SADK,EACO,UAAAoB,KAAK,EAAI;AACpB,UAAMC,IAAI,GAAGd,iBAAKe,WAAL,CACXF,KAAK,CAACG,MAAN,CAAalB,IADF,EAEXe,KAAK,CAACG,MAAN,CAAaR,KAFF,EAGXK,KAAK,CAACG,MAAN,CAAaN,MAHF,CAAb;;AAMA,aAAOJ,MAAM,CAACC,IAAP,CAAYO,IAAZ,CAAP;AACD,KATK;AAtBY,GAAP;AAAA,C","sourcesContent":["import UTIF from 'utif';\n\nconst MIME_TYPE = 'image/tiff';\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['tiff', 'tif'] },\n\n constants: {\n MIME_TIFF: MIME_TYPE\n },\n\n decoders: {\n [MIME_TYPE]: data => {\n const ifds = UTIF.decode(data);\n const page = ifds[0];\n UTIF.decodeImages(data, ifds);\n const rgba = UTIF.toRGBA8(page);\n\n return {\n data: Buffer.from(rgba),\n width: page.t256[0],\n height: page.t257[0]\n };\n }\n },\n\n encoders: {\n [MIME_TYPE]: image => {\n const tiff = UTIF.encodeImage(\n image.bitmap.data,\n image.bitmap.width,\n image.bitmap.height\n );\n\n return Buffer.from(tiff);\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["MIME_TYPE","mime","constants","MIME_TIFF","decoders","data","ifds","utif","decode","page","forEach","ifd","decodeImage","rgba","toRGBA8","Buffer","from","width","t256","height","t257","encoders","image","tiff","encodeImage","bitmap"],"sources":["../src/index.js"],"sourcesContent":["import utif from \"utif2\";\n\nconst MIME_TYPE = \"image/tiff\";\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"tiff\", \"tif\"] },\n\n constants: {\n MIME_TIFF: MIME_TYPE,\n },\n\n decoders: {\n [MIME_TYPE]: (data) => {\n const ifds = utif.decode(data);\n const page = ifds[0];\n\n ifds.forEach((ifd) => {\n utif.decodeImage(data, ifd);\n });\n\n const rgba = utif.toRGBA8(page);\n\n return {\n data: Buffer.from(rgba),\n width: page.t256[0],\n height: page.t257[0],\n };\n },\n },\n\n encoders: {\n [MIME_TYPE]: (image) => {\n const tiff = utif.encodeImage(\n image.bitmap.data,\n image.bitmap.width,\n image.bitmap.height\n );\n\n return Buffer.from(tiff);\n },\n },\n});\n"],"mappings":";;;;;;AAAA;AAAyB;AAEzB,MAAMA,SAAS,GAAG,YAAY;AAAC,eAEhB,OAAO;EACpBC,IAAI,EAAE;IAAE,CAACD,SAAS,GAAG,CAAC,MAAM,EAAE,KAAK;EAAE,CAAC;EAEtCE,SAAS,EAAE;IACTC,SAAS,EAAEH;EACb,CAAC;EAEDI,QAAQ,EAAE;IACR,CAACJ,SAAS,GAAIK,IAAI,IAAK;MACrB,MAAMC,IAAI,GAAGC,aAAI,CAACC,MAAM,CAACH,IAAI,CAAC;MAC9B,MAAMI,IAAI,GAAGH,IAAI,CAAC,CAAC,CAAC;MAEpBA,IAAI,CAACI,OAAO,CAAEC,GAAG,IAAK;QACpBJ,aAAI,CAACK,WAAW,CAACP,IAAI,EAAEM,GAAG,CAAC;MAC7B,CAAC,CAAC;MAEF,MAAME,IAAI,GAAGN,aAAI,CAACO,OAAO,CAACL,IAAI,CAAC;MAE/B,OAAO;QACLJ,IAAI,EAAEU,MAAM,CAACC,IAAI,CAACH,IAAI,CAAC;QACvBI,KAAK,EAAER,IAAI,CAACS,IAAI,CAAC,CAAC,CAAC;QACnBC,MAAM,EAAEV,IAAI,CAACW,IAAI,CAAC,CAAC;MACrB,CAAC;IACH;EACF,CAAC;EAEDC,QAAQ,EAAE;IACR,CAACrB,SAAS,GAAIsB,KAAK,IAAK;MACtB,MAAMC,IAAI,GAAGhB,aAAI,CAACiB,WAAW,CAC3BF,KAAK,CAACG,MAAM,CAACpB,IAAI,EACjBiB,KAAK,CAACG,MAAM,CAACR,KAAK,EAClBK,KAAK,CAACG,MAAM,CAACN,MAAM,CACpB;MAED,OAAOJ,MAAM,CAACC,IAAI,CAACO,IAAI,CAAC;IAC1B;EACF;AACF,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/tiff/es/index.js b/project starter code/node_modules/@jimp/tiff/es/index.js index 3233d0e7..03159084 100644 --- a/project starter code/node_modules/@jimp/tiff/es/index.js +++ b/project starter code/node_modules/@jimp/tiff/es/index.js @@ -1,46 +1,32 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _utif = _interopRequireDefault(require("utif")); - -var MIME_TYPE = 'image/tiff'; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['tiff', 'tif']), - constants: { - MIME_TIFF: MIME_TYPE - }, - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var ifds = _utif["default"].decode(data); - - var page = ifds[0]; - - _utif["default"].decodeImages(data, ifds); - - var rgba = _utif["default"].toRGBA8(page); - +import utif from "utif2"; +const MIME_TYPE = "image/tiff"; +export default (() => ({ + mime: { + [MIME_TYPE]: ["tiff", "tif"] + }, + constants: { + MIME_TIFF: MIME_TYPE + }, + decoders: { + [MIME_TYPE]: data => { + const ifds = utif.decode(data); + const page = ifds[0]; + ifds.forEach(ifd => { + utif.decodeImage(data, ifd); + }); + const rgba = utif.toRGBA8(page); return { data: Buffer.from(rgba), width: page.t256[0], height: page.t257[0] }; - }), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (image) { - var tiff = _utif["default"].encodeImage(image.bitmap.data, image.bitmap.width, image.bitmap.height); - + } + }, + encoders: { + [MIME_TYPE]: image => { + const tiff = utif.encodeImage(image.bitmap.data, image.bitmap.width, image.bitmap.height); return Buffer.from(tiff); - }) - }; -}; - -exports["default"] = _default; + } + } +})); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/tiff/es/index.js.map b/project starter code/node_modules/@jimp/tiff/es/index.js.map index 639a6f4f..21755188 100644 --- a/project starter code/node_modules/@jimp/tiff/es/index.js.map +++ b/project starter code/node_modules/@jimp/tiff/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["MIME_TYPE","mime","constants","MIME_TIFF","decoders","data","ifds","UTIF","decode","page","decodeImages","rgba","toRGBA8","Buffer","from","width","t256","height","t257","encoders","image","tiff","encodeImage","bitmap"],"mappings":";;;;;;;;;;;AAAA;;AAEA,IAAMA,SAAS,GAAG,YAAlB;;eAEe;AAAA,SAAO;AACpBC,IAAAA,IAAI,uCAAKD,SAAL,EAAiB,CAAC,MAAD,EAAS,KAAT,CAAjB,CADgB;AAGpBE,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAEH;AADF,KAHS;AAOpBI,IAAAA,QAAQ,uCACLJ,SADK,EACO,UAAAK,IAAI,EAAI;AACnB,UAAMC,IAAI,GAAGC,iBAAKC,MAAL,CAAYH,IAAZ,CAAb;;AACA,UAAMI,IAAI,GAAGH,IAAI,CAAC,CAAD,CAAjB;;AACAC,uBAAKG,YAAL,CAAkBL,IAAlB,EAAwBC,IAAxB;;AACA,UAAMK,IAAI,GAAGJ,iBAAKK,OAAL,CAAaH,IAAb,CAAb;;AAEA,aAAO;AACLJ,QAAAA,IAAI,EAAEQ,MAAM,CAACC,IAAP,CAAYH,IAAZ,CADD;AAELI,QAAAA,KAAK,EAAEN,IAAI,CAACO,IAAL,CAAU,CAAV,CAFF;AAGLC,QAAAA,MAAM,EAAER,IAAI,CAACS,IAAL,CAAU,CAAV;AAHH,OAAP;AAKD,KAZK,CAPY;AAsBpBC,IAAAA,QAAQ,uCACLnB,SADK,EACO,UAAAoB,KAAK,EAAI;AACpB,UAAMC,IAAI,GAAGd,iBAAKe,WAAL,CACXF,KAAK,CAACG,MAAN,CAAalB,IADF,EAEXe,KAAK,CAACG,MAAN,CAAaR,KAFF,EAGXK,KAAK,CAACG,MAAN,CAAaN,MAHF,CAAb;;AAMA,aAAOJ,MAAM,CAACC,IAAP,CAAYO,IAAZ,CAAP;AACD,KATK;AAtBY,GAAP;AAAA,C","sourcesContent":["import UTIF from 'utif';\n\nconst MIME_TYPE = 'image/tiff';\n\nexport default () => ({\n mime: { [MIME_TYPE]: ['tiff', 'tif'] },\n\n constants: {\n MIME_TIFF: MIME_TYPE\n },\n\n decoders: {\n [MIME_TYPE]: data => {\n const ifds = UTIF.decode(data);\n const page = ifds[0];\n UTIF.decodeImages(data, ifds);\n const rgba = UTIF.toRGBA8(page);\n\n return {\n data: Buffer.from(rgba),\n width: page.t256[0],\n height: page.t257[0]\n };\n }\n },\n\n encoders: {\n [MIME_TYPE]: image => {\n const tiff = UTIF.encodeImage(\n image.bitmap.data,\n image.bitmap.width,\n image.bitmap.height\n );\n\n return Buffer.from(tiff);\n }\n }\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["utif","MIME_TYPE","mime","constants","MIME_TIFF","decoders","data","ifds","decode","page","forEach","ifd","decodeImage","rgba","toRGBA8","Buffer","from","width","t256","height","t257","encoders","image","tiff","encodeImage","bitmap"],"sources":["../src/index.js"],"sourcesContent":["import utif from \"utif2\";\n\nconst MIME_TYPE = \"image/tiff\";\n\nexport default () => ({\n mime: { [MIME_TYPE]: [\"tiff\", \"tif\"] },\n\n constants: {\n MIME_TIFF: MIME_TYPE,\n },\n\n decoders: {\n [MIME_TYPE]: (data) => {\n const ifds = utif.decode(data);\n const page = ifds[0];\n\n ifds.forEach((ifd) => {\n utif.decodeImage(data, ifd);\n });\n\n const rgba = utif.toRGBA8(page);\n\n return {\n data: Buffer.from(rgba),\n width: page.t256[0],\n height: page.t257[0],\n };\n },\n },\n\n encoders: {\n [MIME_TYPE]: (image) => {\n const tiff = utif.encodeImage(\n image.bitmap.data,\n image.bitmap.width,\n image.bitmap.height\n );\n\n return Buffer.from(tiff);\n },\n },\n});\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,OAAO;AAExB,MAAMC,SAAS,GAAG,YAAY;AAE9B,gBAAe,OAAO;EACpBC,IAAI,EAAE;IAAE,CAACD,SAAS,GAAG,CAAC,MAAM,EAAE,KAAK;EAAE,CAAC;EAEtCE,SAAS,EAAE;IACTC,SAAS,EAAEH;EACb,CAAC;EAEDI,QAAQ,EAAE;IACR,CAACJ,SAAS,GAAIK,IAAI,IAAK;MACrB,MAAMC,IAAI,GAAGP,IAAI,CAACQ,MAAM,CAACF,IAAI,CAAC;MAC9B,MAAMG,IAAI,GAAGF,IAAI,CAAC,CAAC,CAAC;MAEpBA,IAAI,CAACG,OAAO,CAAEC,GAAG,IAAK;QACpBX,IAAI,CAACY,WAAW,CAACN,IAAI,EAAEK,GAAG,CAAC;MAC7B,CAAC,CAAC;MAEF,MAAME,IAAI,GAAGb,IAAI,CAACc,OAAO,CAACL,IAAI,CAAC;MAE/B,OAAO;QACLH,IAAI,EAAES,MAAM,CAACC,IAAI,CAACH,IAAI,CAAC;QACvBI,KAAK,EAAER,IAAI,CAACS,IAAI,CAAC,CAAC,CAAC;QACnBC,MAAM,EAAEV,IAAI,CAACW,IAAI,CAAC,CAAC;MACrB,CAAC;IACH;EACF,CAAC;EAEDC,QAAQ,EAAE;IACR,CAACpB,SAAS,GAAIqB,KAAK,IAAK;MACtB,MAAMC,IAAI,GAAGvB,IAAI,CAACwB,WAAW,CAC3BF,KAAK,CAACG,MAAM,CAACnB,IAAI,EACjBgB,KAAK,CAACG,MAAM,CAACR,KAAK,EAClBK,KAAK,CAACG,MAAM,CAACN,MAAM,CACpB;MAED,OAAOJ,MAAM,CAACC,IAAI,CAACO,IAAI,CAAC;IAC1B;EACF;AACF,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/tiff/index.d.ts b/project starter code/node_modules/@jimp/tiff/index.d.ts index fdd0c5fe..851d7383 100644 --- a/project starter code/node_modules/@jimp/tiff/index.d.ts +++ b/project starter code/node_modules/@jimp/tiff/index.d.ts @@ -1,16 +1,16 @@ -import { DecoderFn, EncoderFn } from '@jimp/core'; +import { DecoderFn, EncoderFn } from "@jimp/core"; interface Tiff { - mime: { 'image/tiff': string[] } + mime: { "image/tiff": string[] }; decoders: { - 'image/tiff': DecoderFn - } + "image/tiff": DecoderFn; + }; encoders: { - 'image/tiff': EncoderFn - } + "image/tiff": EncoderFn; + }; constants: { - MIME_TIFF: 'image/tiff'; - } + MIME_TIFF: "image/tiff"; + }; } -export default function(): Tiff; +export default function (): Tiff; diff --git a/project starter code/node_modules/@jimp/tiff/package.json b/project starter code/node_modules/@jimp/tiff/package.json index 157805ef..ef219133 100644 --- a/project starter code/node_modules/@jimp/tiff/package.json +++ b/project starter code/node_modules/@jimp/tiff/package.json @@ -1,12 +1,13 @@ { "name": "@jimp/tiff", - "version": "0.16.2", + "version": "0.22.12", "description": "Default Jimp tiff encoder/decoder.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js", "test:watch": "npm run test -- --reporter min --watch", "test:coverage": "nyc npm run test", "build": "npm run build:node:production && npm run build:module", @@ -20,18 +21,17 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "utif": "^2.0.1" + "utif2": "^4.0.1" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" }, "devDependencies": { - "@jimp/custom": "^0.16.2", - "@jimp/test-utils": "^0.16.2" + "@jimp/custom": "^0.22.12", + "@jimp/test-utils": "^0.22.12" }, "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/tiff/src/index.js b/project starter code/node_modules/@jimp/tiff/src/index.js index c8dc3ee4..7942ae72 100644 --- a/project starter code/node_modules/@jimp/tiff/src/index.js +++ b/project starter code/node_modules/@jimp/tiff/src/index.js @@ -1,38 +1,42 @@ -import UTIF from 'utif'; +import utif from "utif2"; -const MIME_TYPE = 'image/tiff'; +const MIME_TYPE = "image/tiff"; export default () => ({ - mime: { [MIME_TYPE]: ['tiff', 'tif'] }, + mime: { [MIME_TYPE]: ["tiff", "tif"] }, constants: { - MIME_TIFF: MIME_TYPE + MIME_TIFF: MIME_TYPE, }, decoders: { - [MIME_TYPE]: data => { - const ifds = UTIF.decode(data); + [MIME_TYPE]: (data) => { + const ifds = utif.decode(data); const page = ifds[0]; - UTIF.decodeImages(data, ifds); - const rgba = UTIF.toRGBA8(page); + + ifds.forEach((ifd) => { + utif.decodeImage(data, ifd); + }); + + const rgba = utif.toRGBA8(page); return { data: Buffer.from(rgba), width: page.t256[0], - height: page.t257[0] + height: page.t257[0], }; - } + }, }, encoders: { - [MIME_TYPE]: image => { - const tiff = UTIF.encodeImage( + [MIME_TYPE]: (image) => { + const tiff = utif.encodeImage( image.bitmap.data, image.bitmap.width, image.bitmap.height ); return Buffer.from(tiff); - } - } + }, + }, }); diff --git a/project starter code/node_modules/@jimp/tiff/test/tiff.test.js b/project starter code/node_modules/@jimp/tiff/test/tiff.test.js index 84cb9720..be1e98f0 100644 --- a/project starter code/node_modules/@jimp/tiff/test/tiff.test.js +++ b/project starter code/node_modules/@jimp/tiff/test/tiff.test.js @@ -1,41 +1,35 @@ -import { Jimp, getTestDir } from '@jimp/test-utils'; -import configure from '@jimp/custom'; +import { Jimp, getTestDir } from "@jimp/test-utils"; +import configure from "@jimp/custom"; +import expect from "@storybook/expect"; -import tiff from '../src'; +import tiff from "../src"; const jimp = configure({ types: [tiff] }, Jimp); -describe('TIFF', () => { - const imagesDir = getTestDir(__dirname) + '/images'; +describe("TIFF", () => { + const imagesDir = getTestDir(__dirname) + "/images"; - it('load TIFF', async () => { - const image = await jimp.read(imagesDir + '/rgb.tiff'); + it("load TIFF", async () => { + const image = await jimp.read(imagesDir + "/rgb.tiff"); - image.getPixelColor(10, 10).should.be.equal(0xa4988bff); - image.getPixelColor(220, 190).should.be.equal(0xe0d7ddff); - image.getPixelColor(350, 130).should.be.equal(0x565433ff); + expect(image.getPixelColor(10, 10)).toBe(0xa4988bff); + expect(image.getPixelColor(220, 190)).toBe(0xe0d7ddff); + expect(image.getPixelColor(350, 130)).toBe(0x565433ff); }); const simpleJGD = { width: 3, height: 3, data: [ - 0xff0000ff, - 0xff0080ff, - 0xff00ffff, - 0xff0080ff, - 0xff00ffff, - 0x8000ffff, - 0xff00ffff, - 0x8000ffff, - 0x0000ffff - ] + 0xff0000ff, 0xff0080ff, 0xff00ffff, 0xff0080ff, 0xff00ffff, 0x8000ffff, + 0xff00ffff, 0x8000ffff, 0x0000ffff, + ], }; - it('export TIFF', async () => { + it("export TIFF", async () => { const image = await jimp.read(simpleJGD); - const buffer = await image.getBufferAsync('image/tiff'); + const buffer = await image.getBufferAsync("image/tiff"); - buffer.toString().should.match(/^MM\u0000*\u0000/); + expect(buffer.toString()).toMatch(/^MM\u0000*\u0000/); }); }); diff --git a/project starter code/node_modules/@jimp/types/CHANGELOG.md b/project starter code/node_modules/@jimp/types/CHANGELOG.md index 26394e0f..8d029143 100644 --- a/project starter code/node_modules/@jimp/types/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/types/CHANGELOG.md @@ -1,3 +1,51 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -12,7 +60,7 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) @@ -20,4 +68,4 @@ #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/types/dist/index.js b/project starter code/node_modules/@jimp/types/dist/index.js index 6010c060..5fba82b6 100644 --- a/project starter code/node_modules/@jimp/types/dist/index.js +++ b/project starter code/node_modules/@jimp/types/dist/index.js @@ -1,28 +1,18 @@ "use strict"; -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - +exports.default = void 0; var _timm = require("timm"); - var _jpeg = _interopRequireDefault(require("@jimp/jpeg")); - var _png = _interopRequireDefault(require("@jimp/png")); - var _bmp = _interopRequireDefault(require("@jimp/bmp")); - var _tiff = _interopRequireDefault(require("@jimp/tiff")); - var _gif = _interopRequireDefault(require("@jimp/gif")); - -var _default = function _default() { - return (0, _timm.mergeDeep)((0, _jpeg["default"])(), (0, _png["default"])(), (0, _bmp["default"])(), (0, _tiff["default"])(), (0, _gif["default"])()); -}; - -exports["default"] = _default; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _default = () => (0, _timm.mergeDeep)((0, _jpeg.default)(), (0, _png.default)(), (0, _bmp.default)(), (0, _tiff.default)(), (0, _gif.default)()); +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/types/dist/index.js.map b/project starter code/node_modules/@jimp/types/dist/index.js.map index 197bdb02..fcaf8e11 100644 --- a/project starter code/node_modules/@jimp/types/dist/index.js.map +++ b/project starter code/node_modules/@jimp/types/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;eAEe;AAAA,SAAM,qBAAU,uBAAV,EAAkB,sBAAlB,EAAyB,sBAAzB,EAAgC,uBAAhC,EAAwC,sBAAxC,CAAN;AAAA,C","sourcesContent":["import { mergeDeep } from 'timm';\n\nimport jpeg from '@jimp/jpeg';\nimport png from '@jimp/png';\nimport bmp from '@jimp/bmp';\nimport tiff from '@jimp/tiff';\nimport gif from '@jimp/gif';\n\nexport default () => mergeDeep(jpeg(), png(), bmp(), tiff(), gif());\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["mergeDeep","jpeg","png","bmp","tiff","gif"],"sources":["../src/index.js"],"sourcesContent":["import { mergeDeep } from \"timm\";\n\nimport jpeg from \"@jimp/jpeg\";\nimport png from \"@jimp/png\";\nimport bmp from \"@jimp/bmp\";\nimport tiff from \"@jimp/tiff\";\nimport gif from \"@jimp/gif\";\n\nexport default () => mergeDeep(jpeg(), png(), bmp(), tiff(), gif());\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AAA4B;AAAA,eAEb,MAAM,IAAAA,eAAS,EAAC,IAAAC,aAAI,GAAE,EAAE,IAAAC,YAAG,GAAE,EAAE,IAAAC,YAAG,GAAE,EAAE,IAAAC,aAAI,GAAE,EAAE,IAAAC,YAAG,GAAE,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/types/es/index.js b/project starter code/node_modules/@jimp/types/es/index.js index 01ce8be9..0c66bcbf 100644 --- a/project starter code/node_modules/@jimp/types/es/index.js +++ b/project starter code/node_modules/@jimp/types/es/index.js @@ -1,27 +1,8 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _timm = require("timm"); - -var _jpeg = _interopRequireDefault(require("@jimp/jpeg")); - -var _png = _interopRequireDefault(require("@jimp/png")); - -var _bmp = _interopRequireDefault(require("@jimp/bmp")); - -var _tiff = _interopRequireDefault(require("@jimp/tiff")); - -var _gif = _interopRequireDefault(require("@jimp/gif")); - -var _default = function _default() { - return (0, _timm.mergeDeep)((0, _jpeg["default"])(), (0, _png["default"])(), (0, _bmp["default"])(), (0, _tiff["default"])(), (0, _gif["default"])()); -}; - -exports["default"] = _default; +import { mergeDeep } from "timm"; +import jpeg from "@jimp/jpeg"; +import png from "@jimp/png"; +import bmp from "@jimp/bmp"; +import tiff from "@jimp/tiff"; +import gif from "@jimp/gif"; +export default (() => mergeDeep(jpeg(), png(), bmp(), tiff(), gif())); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/types/es/index.js.map b/project starter code/node_modules/@jimp/types/es/index.js.map index 197bdb02..c6cbaed2 100644 --- a/project starter code/node_modules/@jimp/types/es/index.js.map +++ b/project starter code/node_modules/@jimp/types/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;eAEe;AAAA,SAAM,qBAAU,uBAAV,EAAkB,sBAAlB,EAAyB,sBAAzB,EAAgC,uBAAhC,EAAwC,sBAAxC,CAAN;AAAA,C","sourcesContent":["import { mergeDeep } from 'timm';\n\nimport jpeg from '@jimp/jpeg';\nimport png from '@jimp/png';\nimport bmp from '@jimp/bmp';\nimport tiff from '@jimp/tiff';\nimport gif from '@jimp/gif';\n\nexport default () => mergeDeep(jpeg(), png(), bmp(), tiff(), gif());\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["mergeDeep","jpeg","png","bmp","tiff","gif"],"sources":["../src/index.js"],"sourcesContent":["import { mergeDeep } from \"timm\";\n\nimport jpeg from \"@jimp/jpeg\";\nimport png from \"@jimp/png\";\nimport bmp from \"@jimp/bmp\";\nimport tiff from \"@jimp/tiff\";\nimport gif from \"@jimp/gif\";\n\nexport default () => mergeDeep(jpeg(), png(), bmp(), tiff(), gif());\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,MAAM;AAEhC,OAAOC,IAAI,MAAM,YAAY;AAC7B,OAAOC,GAAG,MAAM,WAAW;AAC3B,OAAOC,GAAG,MAAM,WAAW;AAC3B,OAAOC,IAAI,MAAM,YAAY;AAC7B,OAAOC,GAAG,MAAM,WAAW;AAE3B,gBAAe,MAAML,SAAS,CAACC,IAAI,EAAE,EAAEC,GAAG,EAAE,EAAEC,GAAG,EAAE,EAAEC,IAAI,EAAE,EAAEC,GAAG,EAAE,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/types/index.d.ts b/project starter code/node_modules/@jimp/types/index.d.ts index ec2df4ec..98f0cceb 100644 --- a/project starter code/node_modules/@jimp/types/index.d.ts +++ b/project starter code/node_modules/@jimp/types/index.d.ts @@ -1,14 +1,14 @@ -import jpeg from '@jimp/jpeg'; -import png from '@jimp/png'; -import bmp from '@jimp/bmp'; -import tiff from '@jimp/tiff'; -import gif from '@jimp/gif'; +import jpeg from "@jimp/jpeg"; +import png from "@jimp/png"; +import bmp from "@jimp/bmp"; +import tiff from "@jimp/tiff"; +import gif from "@jimp/gif"; -type JpegRet = ReturnType -type PngRet = ReturnType -type BmpRet = ReturnType -type TiffRet = ReturnType -type GifRet = ReturnType +type JpegRet = ReturnType; +type PngRet = ReturnType; +type BmpRet = ReturnType; +type TiffRet = ReturnType; +type GifRet = ReturnType; /** * This is made union and not intersection to avoid issues with @@ -18,10 +18,6 @@ type GifRet = ReturnType * In reality, this should be an intersection but our type data isn't * clever enough to figure out what's a class and what's not/etc */ -type Types = JpegRet | - PngRet | - BmpRet | - TiffRet | - GifRet +type Types = JpegRet | PngRet | BmpRet | TiffRet | GifRet; -export default function(): Types; +export default function (): Types; diff --git a/project starter code/node_modules/@jimp/types/package.json b/project starter code/node_modules/@jimp/types/package.json index 7d7f6817..7042428f 100644 --- a/project starter code/node_modules/@jimp/types/package.json +++ b/project starter code/node_modules/@jimp/types/package.json @@ -1,9 +1,10 @@ { "name": "@jimp/types", - "version": "0.16.2", + "version": "0.22.12", "description": "Default Jimp encoder/decoders.", "main": "dist/index.js", "module": "es/index.js", + "repository": "jimp-dev/jimp", "types": "index.d.ts", "scripts": { "build": "npm run build:node:production && npm run build:module", @@ -17,12 +18,11 @@ "author": "", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/bmp": "^0.16.2", - "@jimp/gif": "^0.16.2", - "@jimp/jpeg": "^0.16.2", - "@jimp/png": "^0.16.2", - "@jimp/tiff": "^0.16.2", + "@jimp/bmp": "^0.22.12", + "@jimp/gif": "^0.22.12", + "@jimp/jpeg": "^0.22.12", + "@jimp/png": "^0.22.12", + "@jimp/tiff": "^0.22.12", "timm": "^1.6.1" }, "peerDependencies": { @@ -34,5 +34,5 @@ "publishConfig": { "access": "public" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/types/src/index.js b/project starter code/node_modules/@jimp/types/src/index.js index 313982c6..1f6eb528 100644 --- a/project starter code/node_modules/@jimp/types/src/index.js +++ b/project starter code/node_modules/@jimp/types/src/index.js @@ -1,9 +1,9 @@ -import { mergeDeep } from 'timm'; +import { mergeDeep } from "timm"; -import jpeg from '@jimp/jpeg'; -import png from '@jimp/png'; -import bmp from '@jimp/bmp'; -import tiff from '@jimp/tiff'; -import gif from '@jimp/gif'; +import jpeg from "@jimp/jpeg"; +import png from "@jimp/png"; +import bmp from "@jimp/bmp"; +import tiff from "@jimp/tiff"; +import gif from "@jimp/gif"; export default () => mergeDeep(jpeg(), png(), bmp(), tiff(), gif()); diff --git a/project starter code/node_modules/@jimp/utils/CHANGELOG.md b/project starter code/node_modules/@jimp/utils/CHANGELOG.md index 5ba04890..8aae0bbe 100644 --- a/project starter code/node_modules/@jimp/utils/CHANGELOG.md +++ b/project starter code/node_modules/@jimp/utils/CHANGELOG.md @@ -1,3 +1,51 @@ +# v0.22.1 (Mon Feb 06 2023) + +#### 🏠 Internal + +- rename master to main [#1169](https://github.com/jimp-dev/jimp/pull/1169) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.21.0 (Sun Feb 05 2023) + +### Release Notes + +#### Babel Refactor ([#1149](https://github.com/jimp-dev/jimp/pull/1149)) + +Marking this as a "breaking release" because it might change what deps need to be installed. + +All modules should be exported as valid cjs and esm + +![CleanShot 2023-02-04 at 18 19 27](https://user-images.githubusercontent.com/1192452/216798157-664cc430-7846-432d-84cf-26e8d8ba9e10.png) + +--- + +#### 💥 Breaking Change + +- Babel Refactor [#1149](https://github.com/jimp-dev/jimp/pull/1149) ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + +# v0.16.3 (Sat Feb 04 2023) + +#### ⚠️ Pushed to `main` + +- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +#### Authors: 1 + +- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) + +--- + # v0.11.0 (Fri May 15 2020) #### 🚀 Enhancement @@ -24,11 +72,11 @@ # v0.9.3 (Tue Nov 26 2019) -#### 🐛 Bug Fix +#### 🐛 Bug Fix - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) #### Authors: 2 - Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file +- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) diff --git a/project starter code/node_modules/@jimp/utils/README.md b/project starter code/node_modules/@jimp/utils/README.md index 98cbfb74..51a52c4d 100644 --- a/project starter code/node_modules/@jimp/utils/README.md +++ b/project starter code/node_modules/@jimp/utils/README.md @@ -33,21 +33,24 @@ Scans through a region of the bitmap, calling a function for each pixel. ```js function removeRed(image) { - return scan(image, 0, 0, image.bitmap.width, image.bitmap.height, function( - x, - y, - index - ) { - const red = this.bitmap.data[index + 0]; - const green = this.bitmap.data[index + 1]; - const blue = this.bitmap.data[index + 2]; - const alpha = this.bitmap.data[index + 3]; + return scan( + image, + 0, + 0, + image.bitmap.width, + image.bitmap.height, + function (x, y, index) { + const red = this.bitmap.data[index + 0]; + const green = this.bitmap.data[index + 1]; + const blue = this.bitmap.data[index + 2]; + const alpha = this.bitmap.data[index + 3]; - this.bitmap.data[index + 0] = 0; - this.bitmap.data[index + 1] = green; - this.bitmap.data[index + 2] = blue; - this.bitmap.data[index + 3] = alpha; - }); + this.bitmap.data[index + 0] = 0; + this.bitmap.data[index + 1] = green; + this.bitmap.data[index + 2] = blue; + this.bitmap.data[index + 3] = alpha; + } + ); } ``` diff --git a/project starter code/node_modules/@jimp/utils/dist/index.js b/project starter code/node_modules/@jimp/utils/dist/index.js index a3b9af90..f9a13154 100644 --- a/project starter code/node_modules/@jimp/utils/dist/index.js +++ b/project starter code/node_modules/@jimp/utils/dist/index.js @@ -1,114 +1,60 @@ "use strict"; -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - Object.defineProperty(exports, "__esModule", { value: true }); exports.isNodePattern = isNodePattern; -exports.throwError = throwError; exports.scan = scan; exports.scanIterator = scanIterator; - -var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); - -var _marked = -/*#__PURE__*/ -_regenerator["default"].mark(scanIterator); - +exports.throwError = throwError; function isNodePattern(cb) { - if (typeof cb === 'undefined') { + if (typeof cb === "undefined") { return false; } - - if (typeof cb !== 'function') { - throw new TypeError('Callback must be a function'); + if (typeof cb !== "function") { + throw new TypeError("Callback must be a function"); } - return true; } - function throwError(error, cb) { - if (typeof error === 'string') { + if (typeof error === "string") { error = new Error(error); } - - if (typeof cb === 'function') { + if (typeof cb === "function") { return cb.call(this, error); } - throw error; } - function scan(image, x, y, w, h, f) { // round input x = Math.round(x); y = Math.round(y); w = Math.round(w); h = Math.round(h); - - for (var _y = y; _y < y + h; _y++) { - for (var _x = x; _x < x + w; _x++) { - var idx = image.bitmap.width * _y + _x << 2; + for (let _y = y; _y < y + h; _y++) { + for (let _x = x; _x < x + w; _x++) { + const idx = image.bitmap.width * _y + _x << 2; f.call(image, _x, _y, idx); } } - return image; } - -function scanIterator(image, x, y, w, h) { - var _y, _x, idx; - - return _regenerator["default"].wrap(function scanIterator$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - // round input - x = Math.round(x); - y = Math.round(y); - w = Math.round(w); - h = Math.round(h); - _y = y; - - case 5: - if (!(_y < y + h)) { - _context.next = 17; - break; - } - - _x = x; - - case 7: - if (!(_x < x + w)) { - _context.next = 14; - break; - } - - idx = image.bitmap.width * _y + _x << 2; - _context.next = 11; - return { - x: _x, - y: _y, - idx: idx, - image: image - }; - - case 11: - _x++; - _context.next = 7; - break; - - case 14: - _y++; - _context.next = 5; - break; - - case 17: - case "end": - return _context.stop(); - } +function* scanIterator(image, x, y, w, h) { + // round input + x = Math.round(x); + y = Math.round(y); + w = Math.round(w); + h = Math.round(h); + for (let _y = y; _y < y + h; _y++) { + for (let _x = x; _x < x + w; _x++) { + const idx = image.bitmap.width * _y + _x << 2; + yield { + x: _x, + y: _y, + idx, + image + }; } - }, _marked); + } } //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/utils/dist/index.js.map b/project starter code/node_modules/@jimp/utils/dist/index.js.map index 14f767df..153b5a73 100644 --- a/project starter code/node_modules/@jimp/utils/dist/index.js.map +++ b/project starter code/node_modules/@jimp/utils/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["scanIterator","isNodePattern","cb","TypeError","throwError","error","Error","call","scan","image","x","y","w","h","f","Math","round","_y","_x","idx","bitmap","width"],"mappings":";;;;;;;;;;;;;;;;6BAyCiBA,Y;;AAzCV,SAASC,aAAT,CAAuBC,EAAvB,EAA2B;AAChC,MAAI,OAAOA,EAAP,KAAc,WAAlB,EAA+B;AAC7B,WAAO,KAAP;AACD;;AAED,MAAI,OAAOA,EAAP,KAAc,UAAlB,EAA8B;AAC5B,UAAM,IAAIC,SAAJ,CAAc,6BAAd,CAAN;AACD;;AAED,SAAO,IAAP;AACD;;AAEM,SAASC,UAAT,CAAoBC,KAApB,EAA2BH,EAA3B,EAA+B;AACpC,MAAI,OAAOG,KAAP,KAAiB,QAArB,EAA+B;AAC7BA,IAAAA,KAAK,GAAG,IAAIC,KAAJ,CAAUD,KAAV,CAAR;AACD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AJ;AACAC,UAAAA,CAAC,GAAGG,IAAI,CAACC,KAAL,CAAWJ,CAAX,CAAJ;AACAC,UAAAA,CAAC,GAAGE,IAAI,CAACC,KAAL,CAAWH,CAAX,CAAJ;AAESI,UAAAA,EAPJ,GAOSN,CAPT;;AAAA;AAAA,gBAOYM,EAAE,GAAGN,CAAC,GAAGE,CAPrB;AAAA;AAAA;AAAA;;AAQMK,UAAAA,EARN,GAQWR,CARX;;AAAA;AAAA,gBAQcQ,EAAE,GAAGR,CAAC,GAAGE,CARvB;AAAA;AAAA;AAAA;;AASKO,UAAAA,GATL,GASYV,KAAK,CAACW,MAAN,CAAaC,KAAb,GAAqBJ,EAArB,GAA0BC,EAA3B,IAAkC,CAT7C;AAAA;AAUD,iBAAM;AAAER,YAAAA,CAAC,EAAEQ,EAAL;AAASP,YAAAA,CAAC,EAAEM,EAAZ;AAAgBE,YAAAA,GAAG,EAAHA,GAAhB;AAAqBV,YAAAA,KAAK,EAALA;AAArB,WAAN;;AAVC;AAQ0BS,UAAAA,EAAE,EAR5B;AAAA;AAAA;;AAAA;AAOwBD,UAAAA,EAAE,EAP1B;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export function isNodePattern(cb) {\n if (typeof cb === 'undefined') {\n return false;\n }\n\n if (typeof cb !== 'function') {\n throw new TypeError('Callback must be a function');\n }\n\n return true;\n}\n\nexport function throwError(error, cb) {\n if (typeof error === 'string') {\n error = new Error(error);\n }\n\n if (typeof cb === 'function') {\n return cb.call(this, error);\n }\n\n throw error;\n}\n\nexport function scan(image, x, y, w, h, f) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = (image.bitmap.width * _y + _x) << 2;\n f.call(image, _x, _y, idx);\n }\n }\n\n return image;\n}\n\nexport function* scanIterator(image, x, y, w, h) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = (image.bitmap.width * _y + _x) << 2;\n yield { x: _x, y: _y, idx, image };\n }\n }\n}\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["isNodePattern","cb","TypeError","throwError","error","Error","call","scan","image","x","y","w","h","f","Math","round","_y","_x","idx","bitmap","width","scanIterator"],"sources":["../src/index.js"],"sourcesContent":["export function isNodePattern(cb) {\n if (typeof cb === \"undefined\") {\n return false;\n }\n\n if (typeof cb !== \"function\") {\n throw new TypeError(\"Callback must be a function\");\n }\n\n return true;\n}\n\nexport function throwError(error, cb) {\n if (typeof error === \"string\") {\n error = new Error(error);\n }\n\n if (typeof cb === \"function\") {\n return cb.call(this, error);\n }\n\n throw error;\n}\n\nexport function scan(image, x, y, w, h, f) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = (image.bitmap.width * _y + _x) << 2;\n f.call(image, _x, _y, idx);\n }\n }\n\n return image;\n}\n\nexport function* scanIterator(image, x, y, w, h) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = (image.bitmap.width * _y + _x) << 2;\n yield { x: _x, y: _y, idx, image };\n }\n }\n}\n"],"mappings":";;;;;;;;;AAAO,SAASA,aAAa,CAACC,EAAE,EAAE;EAChC,IAAI,OAAOA,EAAE,KAAK,WAAW,EAAE;IAC7B,OAAO,KAAK;EACd;EAEA,IAAI,OAAOA,EAAE,KAAK,UAAU,EAAE;IAC5B,MAAM,IAAIC,SAAS,CAAC,6BAA6B,CAAC;EACpD;EAEA,OAAO,IAAI;AACb;AAEO,SAASC,UAAU,CAACC,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AC;EACjBC,CAAC,GAAGG,IAAI,CAACC,KAAK,CAACJ,CAAC,CAAC;EACjBC,CAAC,GAAGE,IAAI,CAACC,KAAK,CAACH,CAAC,CAAC;EAEjB,KAAK,IAAII,EAAE,GAAGN,CAAC,EAAEM,EAAE,GAAGN,CAAC,GAAGE,CAAC,EAAEI,EAAE,EAAE,EAAE;IACjC,KAAK,IAAIC,EAAE,GAAGR,CAAC,EAAEQ,EAAE,GAAGR,CAAC,GAAGE,CAAC,EAAEM,EAAE,EAAE,EAAE;MACjC,MAAMC,GAAG,GAAIV,KAAK,CAACW,MAAM,CAACC,KAAK,GAAGJ,EAAE,GAAGC,EAAE,IAAK,CAAC;MAC/C,MAAM;QAAER,CAAC,EAAEQ,EAAE;QAAEP,CAAC,EAAEM,EAAE;QAAEE,GAAG;QAAEV;MAAM,CAAC;IACpC;EACF;AACF"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/utils/es/index.js b/project starter code/node_modules/@jimp/utils/es/index.js index a3b9af90..00a127b1 100644 --- a/project starter code/node_modules/@jimp/utils/es/index.js +++ b/project starter code/node_modules/@jimp/utils/es/index.js @@ -1,114 +1,51 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isNodePattern = isNodePattern; -exports.throwError = throwError; -exports.scan = scan; -exports.scanIterator = scanIterator; - -var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); - -var _marked = -/*#__PURE__*/ -_regenerator["default"].mark(scanIterator); - -function isNodePattern(cb) { - if (typeof cb === 'undefined') { +export function isNodePattern(cb) { + if (typeof cb === "undefined") { return false; } - - if (typeof cb !== 'function') { - throw new TypeError('Callback must be a function'); + if (typeof cb !== "function") { + throw new TypeError("Callback must be a function"); } - return true; } - -function throwError(error, cb) { - if (typeof error === 'string') { +export function throwError(error, cb) { + if (typeof error === "string") { error = new Error(error); } - - if (typeof cb === 'function') { + if (typeof cb === "function") { return cb.call(this, error); } - throw error; } - -function scan(image, x, y, w, h, f) { +export function scan(image, x, y, w, h, f) { // round input x = Math.round(x); y = Math.round(y); w = Math.round(w); h = Math.round(h); - - for (var _y = y; _y < y + h; _y++) { - for (var _x = x; _x < x + w; _x++) { - var idx = image.bitmap.width * _y + _x << 2; + for (let _y = y; _y < y + h; _y++) { + for (let _x = x; _x < x + w; _x++) { + const idx = image.bitmap.width * _y + _x << 2; f.call(image, _x, _y, idx); } } - return image; } - -function scanIterator(image, x, y, w, h) { - var _y, _x, idx; - - return _regenerator["default"].wrap(function scanIterator$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - // round input - x = Math.round(x); - y = Math.round(y); - w = Math.round(w); - h = Math.round(h); - _y = y; - - case 5: - if (!(_y < y + h)) { - _context.next = 17; - break; - } - - _x = x; - - case 7: - if (!(_x < x + w)) { - _context.next = 14; - break; - } - - idx = image.bitmap.width * _y + _x << 2; - _context.next = 11; - return { - x: _x, - y: _y, - idx: idx, - image: image - }; - - case 11: - _x++; - _context.next = 7; - break; - - case 14: - _y++; - _context.next = 5; - break; - - case 17: - case "end": - return _context.stop(); - } +export function* scanIterator(image, x, y, w, h) { + // round input + x = Math.round(x); + y = Math.round(y); + w = Math.round(w); + h = Math.round(h); + for (let _y = y; _y < y + h; _y++) { + for (let _x = x; _x < x + w; _x++) { + const idx = image.bitmap.width * _y + _x << 2; + yield { + x: _x, + y: _y, + idx, + image + }; } - }, _marked); + } } //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/utils/es/index.js.map b/project starter code/node_modules/@jimp/utils/es/index.js.map index 14f767df..dc3d73c3 100644 --- a/project starter code/node_modules/@jimp/utils/es/index.js.map +++ b/project starter code/node_modules/@jimp/utils/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["scanIterator","isNodePattern","cb","TypeError","throwError","error","Error","call","scan","image","x","y","w","h","f","Math","round","_y","_x","idx","bitmap","width"],"mappings":";;;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n return false;\n }\n\n if (typeof cb !== 'function') {\n throw new TypeError('Callback must be a function');\n }\n\n return true;\n}\n\nexport function throwError(error, cb) {\n if (typeof error === 'string') {\n error = new Error(error);\n }\n\n if (typeof cb === 'function') {\n return cb.call(this, error);\n }\n\n throw error;\n}\n\nexport function scan(image, x, y, w, h, f) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = (image.bitmap.width * _y + _x) << 2;\n f.call(image, _x, _y, idx);\n }\n }\n\n return image;\n}\n\nexport function* scanIterator(image, x, y, w, h) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = (image.bitmap.width * _y + _x) << 2;\n yield { x: _x, y: _y, idx, image };\n }\n }\n}\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["isNodePattern","cb","TypeError","throwError","error","Error","call","scan","image","x","y","w","h","f","Math","round","_y","_x","idx","bitmap","width","scanIterator"],"sources":["../src/index.js"],"sourcesContent":["export function isNodePattern(cb) {\n if (typeof cb === \"undefined\") {\n return false;\n }\n\n if (typeof cb !== \"function\") {\n throw new TypeError(\"Callback must be a function\");\n }\n\n return true;\n}\n\nexport function throwError(error, cb) {\n if (typeof error === \"string\") {\n error = new Error(error);\n }\n\n if (typeof cb === \"function\") {\n return cb.call(this, error);\n }\n\n throw error;\n}\n\nexport function scan(image, x, y, w, h, f) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = (image.bitmap.width * _y + _x) << 2;\n f.call(image, _x, _y, idx);\n }\n }\n\n return image;\n}\n\nexport function* scanIterator(image, x, y, w, h) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = (image.bitmap.width * _y + _x) << 2;\n yield { x: _x, y: _y, idx, image };\n }\n }\n}\n"],"mappings":"AAAA,OAAO,SAASA,aAAa,CAACC,EAAE,EAAE;EAChC,IAAI,OAAOA,EAAE,KAAK,WAAW,EAAE;IAC7B,OAAO,KAAK;EACd;EAEA,IAAI,OAAOA,EAAE,KAAK,UAAU,EAAE;IAC5B,MAAM,IAAIC,SAAS,CAAC,6BAA6B,CAAC;EACpD;EAEA,OAAO,IAAI;AACb;AAEA,OAAO,SAASC,UAAU,CAACC,KAAK,EAAEH,EAAE,EAAE;EACpC,IAAI,OAAOG,KAAK,KAAK,QAAQ,EAAE;IAC7BA,KAAK,GAAG,IAAIC,KAAK,CAACD,KAAK,CAAC;EAC1B;EAEA,IAAI,OAAOH,EAAE,KAAK,UAAU,EAAE;IAC5B,OAAOA,EAAE,CAACK,IAAI,CAAC,IAAI,EAAEF,KAAK,CAAC;EAC7B;EAEA,MAAMA,KAAK;AACb;AAEA,OAAO,SAASG,IAAI,CAACC,KAAK,EAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAE;EACzC;EACAJ,CAAC,GAAGK,IAAI,CAACC,KAAK,CAACN,CAAC,CAAC;EACjBC,CAAC,GAAGI,IAAI,CAACC,KAAK,CAACL,CAAC,CAAC;EACjBC,CAAC,GAAGG,IAAI,CAACC,KAAK,CAACJ,CAAC,CAAC;EACjBC,CAAC,GAAGE,IAAI,CAACC,KAAK,CAACH,CAAC,CAAC;EAEjB,KAAK,IAAII,EAAE,GAAGN,CAAC,EAAEM,EAAE,GAAGN,CAAC,GAAGE,CAAC,EAAEI,EAAE,EAAE,EAAE;IACjC,KAAK,IAAIC,EAAE,GAAGR,CAAC,EAAEQ,EAAE,GAAGR,CAAC,GAAGE,CAAC,EAAEM,EAAE,EAAE,EAAE;MACjC,MAAMC,GAAG,GAAIV,KAAK,CAACW,MAAM,CAACC,KAAK,GAAGJ,EAAE,GAAGC,EAAE,IAAK,CAAC;MAC/CJ,CAAC,CAACP,IAAI,CAACE,KAAK,EAAES,EAAE,EAAED,EAAE,EAAEE,GAAG,CAAC;IAC5B;EACF;EAEA,OAAOV,KAAK;AACd;AAEA,OAAO,UAAUa,YAAY,CAACb,KAAK,EAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAEC,CAAC,EAAE;EAC/C;EACAH,CAAC,GAAGK,IAAI,CAACC,KAAK,CAACN,CAAC,CAAC;EACjBC,CAAC,GAAGI,IAAI,CAACC,KAAK,CAACL,CAAC,CAAC;EACjBC,CAAC,GAAGG,IAAI,CAACC,KAAK,CAACJ,CAAC,CAAC;EACjBC,CAAC,GAAGE,IAAI,CAACC,KAAK,CAACH,CAAC,CAAC;EAEjB,KAAK,IAAII,EAAE,GAAGN,CAAC,EAAEM,EAAE,GAAGN,CAAC,GAAGE,CAAC,EAAEI,EAAE,EAAE,EAAE;IACjC,KAAK,IAAIC,EAAE,GAAGR,CAAC,EAAEQ,EAAE,GAAGR,CAAC,GAAGE,CAAC,EAAEM,EAAE,EAAE,EAAE;MACjC,MAAMC,GAAG,GAAIV,KAAK,CAACW,MAAM,CAACC,KAAK,GAAGJ,EAAE,GAAGC,EAAE,IAAK,CAAC;MAC/C,MAAM;QAAER,CAAC,EAAEQ,EAAE;QAAEP,CAAC,EAAEM,EAAE;QAAEE,GAAG;QAAEV;MAAM,CAAC;IACpC;EACF;AACF"} \ No newline at end of file diff --git a/project starter code/node_modules/@jimp/utils/index.d.ts b/project starter code/node_modules/@jimp/utils/index.d.ts index 79fbeaa4..612e9fce 100644 --- a/project starter code/node_modules/@jimp/utils/index.d.ts +++ b/project starter code/node_modules/@jimp/utils/index.d.ts @@ -1,9 +1,19 @@ -import { Image, Omit } from '@jimp/core'; -import { ThrowStatement } from 'typescript'; +import { Image, Omit } from "@jimp/core"; +import { ThrowStatement } from "typescript"; export function isNodePattern(cb: Function): true; export function isNodePattern(cb: Omit): false; -export function throwError(error: string | Error, cb?: (err: Error) => void): ThrowStatement; +export function throwError( + error: string | Error, + cb?: (err: Error) => void +): ThrowStatement; -export function scan(image: Image, x: number, y: number, w: number, h: number, f: (image: Image, _x: number, _y: number, idx: number) => void): Image; +export function scan( + image: Image, + x: number, + y: number, + w: number, + h: number, + f: (image: Image, _x: number, _y: number, idx: number) => void +): Image; diff --git a/project starter code/node_modules/@jimp/utils/package.json b/project starter code/node_modules/@jimp/utils/package.json index f54b6b99..018d2d7c 100644 --- a/project starter code/node_modules/@jimp/utils/package.json +++ b/project starter code/node_modules/@jimp/utils/package.json @@ -1,10 +1,11 @@ { "name": "@jimp/utils", - "version": "0.16.2", + "version": "0.22.12", "description": "Utils for jimp extensions.", "main": "dist/index.js", "module": "es/index.js", "types": "index.d.ts", + "repository": "jimp-dev/jimp", "scripts": { "build": "npm run build:node:production && npm run build:module", "build:watch": "npm run build:node:debug -- -- --watch --verbose", @@ -20,8 +21,7 @@ "access": "public" }, "dependencies": { - "@babel/runtime": "^7.7.2", "regenerator-runtime": "^0.13.3" }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/@jimp/utils/src/index.js b/project starter code/node_modules/@jimp/utils/src/index.js index 8f51fd35..723f2114 100644 --- a/project starter code/node_modules/@jimp/utils/src/index.js +++ b/project starter code/node_modules/@jimp/utils/src/index.js @@ -1,21 +1,21 @@ export function isNodePattern(cb) { - if (typeof cb === 'undefined') { + if (typeof cb === "undefined") { return false; } - if (typeof cb !== 'function') { - throw new TypeError('Callback must be a function'); + if (typeof cb !== "function") { + throw new TypeError("Callback must be a function"); } return true; } export function throwError(error, cb) { - if (typeof error === 'string') { + if (typeof error === "string") { error = new Error(error); } - if (typeof cb === 'function') { + if (typeof cb === "function") { return cb.call(this, error); } diff --git a/project starter code/node_modules/@tokenizer/token/README.md b/project starter code/node_modules/@tokenizer/token/README.md new file mode 100644 index 00000000..1c1ba324 --- /dev/null +++ b/project starter code/node_modules/@tokenizer/token/README.md @@ -0,0 +1,19 @@ +[![npm version](https://badge.fury.io/js/%40tokenizer%2Ftoken.svg)](https://www.npmjs.com/package/@tokenizer/token) +[![npm downloads](http://img.shields.io/npm/dm/@tokenizer/token.svg)](https://npmcharts.com/compare/@tokenizer/token?interval=30) + +# @tokenizer/token + +TypeScript definition of an [strtok3](https://github.com/Borewit/strtok3) token. + +## Licence + +(The MIT License) + +Copyright (c) 2020 Borewit + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/project starter code/node_modules/@tokenizer/token/index.d.ts b/project starter code/node_modules/@tokenizer/token/index.d.ts new file mode 100644 index 00000000..d6c8122e --- /dev/null +++ b/project starter code/node_modules/@tokenizer/token/index.d.ts @@ -0,0 +1,30 @@ +/** + * Read-only token + * See https://github.com/Borewit/strtok3 for more information + */ +export interface IGetToken { + + /** + * Length of encoded token in bytes + */ + len: number; + + /** + * Decode value from buffer at offset + * @param array - Uint8Array to read the decoded value from + * @param offset - Decode offset + * @return decoded value + */ + get(array: Array, offset: number): Value; +} + +export interface IToken extends IGetToken { + /** + * Encode value to buffer + * @param array - Uint8Array to write the encoded value to + * @param offset - Buffer write offset + * @param value - Value to decode of type T + * @return offset plus number of bytes written + */ + put(array: Array, offset: number, value: Value): number +} diff --git a/project starter code/node_modules/@tokenizer/token/package.json b/project starter code/node_modules/@tokenizer/token/package.json new file mode 100644 index 00000000..ad87e5bb --- /dev/null +++ b/project starter code/node_modules/@tokenizer/token/package.json @@ -0,0 +1,33 @@ +{ + "name": "@tokenizer/token", + "version": "0.3.0", + "description": "TypeScript definition for strtok3 token", + "main": "", + "types": "index.d.ts", + "files": [ + "index.d.ts" + ], + "keywords": [ + "token", + "interface", + "tokenizer", + "TypeScript" + ], + "author": { + "name": "Borewit", + "url": "https://github.com/Borewit" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/Borewit/tokenizer-token.git" + }, + "bugs": { + "url": "https://github.com/Borewit/tokenizer-token/issues" + }, + "typeScriptVersion": "3.0", + "dependencies": {}, + "devDependencies": { + "@types/node": "^13.1.0" + } +} diff --git a/project starter code/node_modules/@types/bluebird/LICENSE b/project starter code/node_modules/@types/bluebird/LICENSE new file mode 100644 index 00000000..9e841e7a --- /dev/null +++ b/project starter code/node_modules/@types/bluebird/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/project starter code/node_modules/@types/bluebird/README.md b/project starter code/node_modules/@types/bluebird/README.md new file mode 100644 index 00000000..4d164a60 --- /dev/null +++ b/project starter code/node_modules/@types/bluebird/README.md @@ -0,0 +1,15 @@ +# Installation +> `npm install --save @types/bluebird` + +# Summary +This package contains type definitions for bluebird (https://github.com/petkaantonov/bluebird). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bluebird. + +### Additional Details + * Last updated: Tue, 07 Nov 2023 15:11:36 GMT + * Dependencies: none + +# Credits +These definitions were written by [Leonard Hecker](https://github.com/lhecker). diff --git a/project starter code/node_modules/@types/bluebird/index.d.ts b/project starter code/node_modules/@types/bluebird/index.d.ts new file mode 100644 index 00000000..e52da821 --- /dev/null +++ b/project starter code/node_modules/@types/bluebird/index.d.ts @@ -0,0 +1,1365 @@ +/*! + * The code following this comment originates from: + * https://github.com/types/npm-bluebird + * + * Note for browser users: use bluebird-global typings instead of this one + * if you want to use Bluebird via the global Promise symbol. + * + * Licensed under: + * The MIT License (MIT) + * + * Copyright (c) 2016 unional + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +type Constructor = new(...args: any[]) => E; +type CatchFilter = ((error: E) => boolean) | (object & E); +type Resolvable = R | PromiseLike; +type IterateFunction = (item: T, index: number, arrayLength: number) => Resolvable; + +type PromisifyAllKeys = T extends string ? `${T}Async` : never; +type WithoutLast = T extends [...infer A, any] ? A : []; +type Last = T extends [...any[], infer L] ? L : never; +type ExtractCallbackValueType = T extends (error: any, ...data: infer D) => any ? D : never; + +type PromiseMethod = TReturn extends never ? never : (...args: WithoutLast) => Promise; + +type ExtractAsyncMethod = T extends (...args: infer A) => any + ? PromiseMethod>>[0]> + : never; + +type PromisifyAllItems = { + [K in keyof T as PromisifyAllKeys]: ExtractAsyncMethod; +}; + +type NonNeverValues = { + [K in keyof T as T[K] extends never ? never : K]: T[K]; +}; + +// Drop `never` values +type PromisifyAll = NonNeverValues> & T; + +declare class Bluebird implements PromiseLike, Bluebird.Inspection { + readonly [Symbol.toStringTag]: "Object"; + + /** + * Create a new promise. The passed in function will receive functions + * `resolve` and `reject` as its arguments which can be called to seal the fate of the created promise. + * + * If promise cancellation is enabled, passed in function will receive + * one more function argument `onCancel` that allows to register an optional cancellation callback. + */ + constructor( + callback: ( + resolve: (thenableOrResult?: Resolvable) => void, + reject: (error?: any) => void, + onCancel?: (callback: () => void) => void, + ) => void, + ); + + /** + * Promises/A+ `.then()`. Returns a new promise chained from this promise. + * + * The new promise will be rejected or resolved depending on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise. + */ + // Based on PromiseLike.then, but returns a Bluebird instance. + then(onFulfill?: (value: R) => Resolvable, onReject?: (error: any) => Resolvable): Bluebird; // For simpler signature help. + then( + onfulfilled?: ((value: R) => Resolvable) | null, + onrejected?: ((reason: any) => Resolvable) | null, + ): Bluebird; + + /** + * This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. + * + * Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler. + * + * Alias `.caught();` for compatibility with earlier ECMAScript version. + */ + catch(onReject: ((error: any) => Resolvable) | undefined | null): Bluebird; + + /** + * This extends `.catch` to work more like catch-clauses in languages like Java or C#. + * + * Instead of manually checking `instanceof` or `.name === "SomeError"`, + * you may specify a number of error constructors which are eligible for this catch handler. + * The catch handler that is first met that has eligible constructors specified, is the one that will be called. + * + * This method also supports predicate-based filters. + * If you pass a predicate function instead of an error constructor, the predicate will receive the error as an argument. + * The return result of the predicate will be used determine whether the error handler should be called. + * + * Alias `.caught();` for compatibility with earlier ECMAScript version. + */ + catch( + filter1: Constructor, + filter2: Constructor, + filter3: Constructor, + filter4: Constructor, + filter5: Constructor, + onReject: (error: E1 | E2 | E3 | E4 | E5) => Resolvable, + ): Bluebird; + + catch( + filter1: Constructor | CatchFilter, + filter2: Constructor | CatchFilter, + filter3: Constructor | CatchFilter, + filter4: Constructor | CatchFilter, + filter5: Constructor | CatchFilter, + onReject: (error: E1 | E2 | E3 | E4 | E5) => Resolvable, + ): Bluebird; + + catch( + filter1: Constructor, + filter2: Constructor, + filter3: Constructor, + filter4: Constructor, + onReject: (error: E1 | E2 | E3 | E4) => Resolvable, + ): Bluebird; + + catch( + filter1: Constructor | CatchFilter, + filter2: Constructor | CatchFilter, + filter3: Constructor | CatchFilter, + filter4: Constructor | CatchFilter, + onReject: (error: E1 | E2 | E3 | E4) => Resolvable, + ): Bluebird; + + catch( + filter1: Constructor, + filter2: Constructor, + filter3: Constructor, + onReject: (error: E1 | E2 | E3) => Resolvable, + ): Bluebird; + + catch( + filter1: Constructor | CatchFilter, + filter2: Constructor | CatchFilter, + filter3: Constructor | CatchFilter, + onReject: (error: E1 | E2 | E3) => Resolvable, + ): Bluebird; + + catch( + filter1: Constructor, + filter2: Constructor, + onReject: (error: E1 | E2) => Resolvable, + ): Bluebird; + + catch( + filter1: Constructor | CatchFilter, + filter2: Constructor | CatchFilter, + onReject: (error: E1 | E2) => Resolvable, + ): Bluebird; + + catch( + filter1: Constructor, + onReject: (error: E1) => Resolvable, + ): Bluebird; + + catch( + // tslint:disable-next-line:unified-signatures + filter1: Constructor | CatchFilter, + onReject: (error: E1) => Resolvable, + ): Bluebird; + + /** + * This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. + * + * Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler. + * + * Alias `.caught();` for compatibility with earlier ECMAScript version. + */ + caught: Bluebird["catch"]; + + /** + * Like `.catch` but instead of catching all types of exceptions, + * it only catches those that don't originate from thrown errors but rather from explicit rejections. + */ + error(onReject: (reason: any) => Resolvable): Bluebird; + + /** + * Pass a handler that will be called regardless of this promise's fate. Returns a new promise chained from this promise. + * + * There are special semantics for `.finally()` in that the final value cannot be modified from the handler. + * + * Alias `.lastly();` for compatibility with earlier ECMAScript version. + */ + finally(handler: () => Resolvable): Bluebird; + + lastly: Bluebird["finally"]; + + /** + * Create a promise that follows this promise, but is bound to the given `thisArg` value. + * A bound promise will call its handlers with the bound value set to `this`. + * + * Additionally promises derived from a bound promise will also be bound promises with the same `thisArg` binding as the original promise. + */ + bind(thisArg: any): Bluebird; + + /** + * Like `.then()`, but any unhandled rejection that ends up here will be thrown as an error. + */ + done(onFulfilled?: (value: R) => Resolvable, onRejected?: (error: any) => Resolvable): void; + + /** + * Like `.finally()`, but not called for rejections. + */ + tap(onFulFill: (value: R) => Resolvable): Bluebird; + + /** + * Like `.catch()` but rethrows the error + */ + tapCatch(onReject: (error?: any) => Resolvable): Bluebird; + + tapCatch( + filter1: Constructor, + filter2: Constructor, + filter3: Constructor, + filter4: Constructor, + filter5: Constructor, + onReject: (error: E1 | E2 | E3 | E4 | E5) => Resolvable, + ): Bluebird; + tapCatch( + filter1: Constructor | CatchFilter, + filter2: Constructor | CatchFilter, + filter3: Constructor | CatchFilter, + filter4: Constructor | CatchFilter, + filter5: Constructor | CatchFilter, + onReject: (error: E1 | E2 | E3 | E4 | E5) => Resolvable, + ): Bluebird; + tapCatch( + filter1: Constructor, + filter2: Constructor, + filter3: Constructor, + filter4: Constructor, + onReject: (error: E1 | E2 | E3 | E4) => Resolvable, + ): Bluebird; + tapCatch( + filter1: Constructor | CatchFilter, + filter2: Constructor | CatchFilter, + filter3: Constructor | CatchFilter, + filter4: Constructor | CatchFilter, + onReject: (error: E1 | E2 | E3 | E4) => Resolvable, + ): Bluebird; + tapCatch( + filter1: Constructor, + filter2: Constructor, + filter3: Constructor, + onReject: (error: E1 | E2 | E3) => Resolvable, + ): Bluebird; + tapCatch( + filter1: Constructor | CatchFilter, + filter2: Constructor | CatchFilter, + filter3: Constructor | CatchFilter, + onReject: (error: E1 | E2 | E3) => Resolvable, + ): Bluebird; + tapCatch( + filter1: Constructor, + filter2: Constructor, + onReject: (error: E1 | E2) => Resolvable, + ): Bluebird; + tapCatch( + filter1: Constructor | CatchFilter, + filter2: Constructor | CatchFilter, + onReject: (error: E1 | E2) => Resolvable, + ): Bluebird; + tapCatch( + filter1: Constructor, + onReject: (error: E1) => Resolvable, + ): Bluebird; + tapCatch( + // tslint:disable-next-line:unified-signatures + filter1: Constructor | CatchFilter, + onReject: (error: E1) => Resolvable, + ): Bluebird; + + /** + * Same as calling `Promise.delay(ms, this)`. + */ + delay(ms: number): Bluebird; + + /** + * Returns a promise that will be fulfilled with this promise's fulfillment value or rejection reason. + * However, if this promise is not fulfilled or rejected within ms milliseconds, the returned promise + * is rejected with a TimeoutError or the error as the reason. + * + * You may specify a custom error message with the `message` parameter. + */ + timeout(ms: number, message?: string | Error): Bluebird; + + /** + * Register a node-style callback on this promise. + * + * When this promise is is either fulfilled or rejected, + * the node callback will be called back with the node.js convention + * where error reason is the first argument and success value is the second argument. + * + * The error argument will be `null` in case of success. + * If the `callback` argument is not a function, this method does not do anything. + */ + nodeify(callback: (err: any, value?: R) => void, options?: Bluebird.SpreadOption): this; + nodeify(...sink: any[]): this; + asCallback(callback: (err: any, value?: R) => void, options?: Bluebird.SpreadOption): this; + asCallback(...sink: any[]): this; + + /** + * See if this `promise` has been fulfilled. + */ + isFulfilled(): boolean; + + /** + * See if this `promise` has been rejected. + */ + isRejected(): boolean; + + /** + * See if this `promise` is still defer. + */ + isPending(): boolean; + + /** + * See if this `promise` has been cancelled. + */ + isCancelled(): boolean; + + /** + * See if this `promise` is resolved -> either fulfilled or rejected. + */ + isResolved(): boolean; + + /** + * Get the fulfillment value of the underlying promise. Throws if the promise isn't fulfilled yet. + * + * throws `TypeError` + */ + value(): R; + + /** + * Get the rejection reason for the underlying promise. Throws if the promise isn't rejected yet. + * + * throws `TypeError` + */ + reason(): any; + + /** + * Synchronously inspect the state of this `promise`. The `PromiseInspection` will represent the state of + * the promise as snapshotted at the time of calling `.reflect()`. + */ + reflect(): Bluebird>; + + /** + * This is a convenience method for doing: + * + * + * promise.then(function(obj){ + * return obj[propertyName].call(obj, arg...); + * }); + * + */ + call( + this: Bluebird, + propertyName: U, + ...args: any[] + ): Bluebird any ? ReturnType : never>; + + /** + * This is a convenience method for doing: + * + * + * promise.then(function(obj){ + * return obj[propertyName]; + * }); + * + */ + get(key: U): Bluebird; + + /** + * Convenience method for: + * + * + * .then(function() { + * return value; + * }); + * + * + * in the case where `value` doesn't change its value. That means `value` is bound at the time of calling `.return()` + * + * Alias `.thenReturn();` for compatibility with earlier ECMAScript version. + */ + return(): Bluebird; + return(value: U): Bluebird; + thenReturn(): Bluebird; + thenReturn(value: U): Bluebird; + + /** + * Convenience method for: + * + * + * .then(function() { + * throw reason; + * }); + * + * Same limitations apply as with `.return()`. + * + * Alias `.thenThrow();` for compatibility with earlier ECMAScript version. + */ + throw(reason: Error): Bluebird; + thenThrow(reason: Error): Bluebird; + + /** + * Convenience method for: + * + * + * .catch(function() { + * return value; + * }); + * + * + * in the case where `value` doesn't change its value. That means `value` is bound at the time of calling `.catchReturn()` + */ + catchReturn(value: U): Bluebird; + + // No need to be specific about Error types in these overrides, since there's no handler function + catchReturn( + filter1: Constructor, + filter2: Constructor, + filter3: Constructor, + filter4: Constructor, + filter5: Constructor, + value: U, + ): Bluebird; + catchReturn( + filter1: Constructor | CatchFilter, + filter2: Constructor | CatchFilter, + filter3: Constructor | CatchFilter, + filter4: Constructor | CatchFilter, + filter5: Constructor | CatchFilter, + value: U, + ): Bluebird; + catchReturn( + filter1: Constructor, + filter2: Constructor, + filter3: Constructor, + filter4: Constructor, + value: U, + ): Bluebird; + catchReturn( + filter1: Constructor | CatchFilter, + filter2: Constructor | CatchFilter, + filter3: Constructor | CatchFilter, + filter4: Constructor | CatchFilter, + value: U, + ): Bluebird; + catchReturn( + filter1: Constructor, + filter2: Constructor, + filter3: Constructor, + value: U, + ): Bluebird; + catchReturn( + filter1: Constructor | CatchFilter, + filter2: Constructor | CatchFilter, + filter3: Constructor | CatchFilter, + value: U, + ): Bluebird; + catchReturn( + filter1: Constructor, + filter2: Constructor, + value: U, + ): Bluebird; + catchReturn( + filter1: Constructor | CatchFilter, + filter2: Constructor | CatchFilter, + value: U, + ): Bluebird; + catchReturn( + filter1: Constructor, + value: U, + ): Bluebird; + catchReturn( + // tslint:disable-next-line:unified-signatures + filter1: Constructor | CatchFilter, + value: U, + ): Bluebird; + + /** + * Convenience method for: + * + * + * .catch(function() { + * throw reason; + * }); + * + * Same limitations apply as with `.catchReturn()`. + */ + catchThrow(reason: Error): Bluebird; + + // No need to be specific about Error types in these overrides, since there's no handler function + catchThrow( + filter1: Constructor, + filter2: Constructor, + filter3: Constructor, + filter4: Constructor, + filter5: Constructor, + reason: Error, + ): Bluebird; + catchThrow( + filter1: Constructor | CatchFilter, + filter2: Constructor | CatchFilter, + filter3: Constructor | CatchFilter, + filter4: Constructor | CatchFilter, + filter5: Constructor | CatchFilter, + reason: Error, + ): Bluebird; + catchThrow( + filter1: Constructor, + filter2: Constructor, + filter3: Constructor, + filter4: Constructor, + reason: Error, + ): Bluebird; + catchThrow( + filter1: Constructor | CatchFilter, + filter2: Constructor | CatchFilter, + filter3: Constructor | CatchFilter, + filter4: Constructor | CatchFilter, + reason: Error, + ): Bluebird; + catchThrow( + filter1: Constructor, + filter2: Constructor, + filter3: Constructor, + reason: Error, + ): Bluebird; + catchThrow( + filter1: Constructor | CatchFilter, + filter2: Constructor | CatchFilter, + filter3: Constructor | CatchFilter, + reason: Error, + ): Bluebird; + catchThrow( + filter1: Constructor, + filter2: Constructor, + reason: Error, + ): Bluebird; + catchThrow( + filter1: Constructor | CatchFilter, + filter2: Constructor | CatchFilter, + reason: Error, + ): Bluebird; + catchThrow( + filter1: Constructor, + reason: Error, + ): Bluebird; + catchThrow( + // tslint:disable-next-line:unified-signatures + filter1: Constructor | CatchFilter, + reason: Error, + ): Bluebird; + + /** + * Convert to String. + */ + toString(): string; + + /** + * This is implicitly called by `JSON.stringify` when serializing the object. Returns a serialized representation of the `Promise`. + */ + toJSON(): object; + + /** + * Like calling `.then`, but the fulfillment value or rejection reason is assumed to be an array, which is flattened to the formal parameters of the handlers. + */ + spread(this: Bluebird>, fulfilledHandler: (...values: Q[]) => Resolvable): Bluebird; + + /** + * Same as calling `Promise.all(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + all( + this: Bluebird<[Resolvable, Resolvable, Resolvable, Resolvable, Resolvable]>, + ): Bluebird<[T1, T2, T3, T4, T5]>; + all( + this: Bluebird<[Resolvable, Resolvable, Resolvable, Resolvable]>, + ): Bluebird<[T1, T2, T3, T4]>; + all(this: Bluebird<[Resolvable, Resolvable, Resolvable]>): Bluebird<[T1, T2, T3]>; + all(this: Bluebird<[Resolvable, Resolvable]>): Bluebird<[T1, T2]>; + all(this: Bluebird<[Resolvable]>): Bluebird<[T1]>; + all(this: Bluebird>>): Bluebird; + + /** + * Same as calling `Promise.all(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + all(): Bluebird; + + /** + * Same as calling `Promise.props(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + props(this: PromiseLike>>): Bluebird>; + props(this: PromiseLike>): Bluebird; + + /** + * Same as calling `Promise.any(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + any(this: Bluebird>): Bluebird; + + /** + * Same as calling `Promise.any(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + any(): Bluebird; + + /** + * Same as calling `Promise.some(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + * Same as calling `Promise.some(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + some(this: Bluebird>, count: number): Bluebird; + + /** + * Same as calling `Promise.some(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + * Same as calling `Promise.some(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + some(count: number): Bluebird; + + /** + * Same as calling `Promise.race(thisPromise, count)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + race(this: Bluebird>): Bluebird; + + /** + * Same as calling `Promise.race(thisPromise, count)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + race(): Bluebird; + + /** + * Same as calling `Bluebird.map(thisPromise, mapper)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + map( + this: Bluebird>, + mapper: IterateFunction, + options?: Bluebird.ConcurrencyOption, + ): Bluebird; + + /** + * Same as calling `Promise.reduce(thisPromise, Function reducer, initialValue)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + reduce( + this: Bluebird>, + reducer: (memo: U, item: Q, index: number, arrayLength: number) => Resolvable, + initialValue?: Resolvable, + ): Bluebird; + + /** + * Same as calling ``Promise.filter(thisPromise, filterer)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + filter( + this: Bluebird>, + filterer: IterateFunction, + options?: Bluebird.ConcurrencyOption, + ): Bluebird; + + /** + * Same as calling ``Bluebird.each(thisPromise, iterator)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + each(this: Bluebird>, iterator: IterateFunction): Bluebird; + + /** + * Same as calling ``Bluebird.mapSeries(thisPromise, iterator)``. With the exception that if this promise is bound to a value, the returned promise is bound to that value too. + */ + mapSeries(this: Bluebird>, iterator: IterateFunction): Bluebird; + + /** + * Cancel this `promise`. Will not do anything if this promise is already settled or if the cancellation feature has not been enabled + */ + cancel(): void; + + /** + * Basically sugar for doing: somePromise.catch(function(){}); + * + * Which is needed in case error handlers are attached asynchronously to the promise later, which would otherwise result in premature unhandled rejection reporting. + */ + suppressUnhandledRejections(): void; + + /** + * Start the chain of promises with `Promise.try`. Any synchronous exceptions will be turned into rejections on the returned promise. + * + * Note about second argument: if it's specifically a true array, its values become respective arguments for the function call. + * Otherwise it is passed as is as the first argument for the function call. + * + * Alias for `attempt();` for compatibility with earlier ECMAScript version. + */ + static try(fn: () => Resolvable): Bluebird; + static attempt(fn: () => Resolvable): Bluebird; + + /** + * Returns a new function that wraps the given function `fn`. + * The new function will always return a promise that is fulfilled with the original functions return values or rejected with thrown exceptions from the original function. + * This method is convenient when a function can sometimes return synchronously or throw synchronously. + */ + static method(fn: () => Resolvable): () => Bluebird; + static method(fn: (arg1: A1) => Resolvable): (arg1: A1) => Bluebird; + static method(fn: (arg1: A1, arg2: A2) => Resolvable): (arg1: A1, arg2: A2) => Bluebird; + static method( + fn: (arg1: A1, arg2: A2, arg3: A3) => Resolvable, + ): (arg1: A1, arg2: A2, arg3: A3) => Bluebird; + static method( + fn: (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Resolvable, + ): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Bluebird; + static method( + fn: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Resolvable, + ): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Bluebird; + static method(fn: (...args: any[]) => Resolvable): (...args: any[]) => Bluebird; + + /** + * Create a promise that is resolved with the given `value`. If `value` is a thenable or promise, the returned promise will assume its state. + */ + static resolve(): Bluebird; + static resolve(value: Resolvable): Bluebird; + + /** + * Create a promise that is rejected with the given `reason`. + */ + static reject(reason: any): Bluebird; + + /** + * @deprecated + * Create a promise with undecided fate and return a `PromiseResolver` to control it. See resolution?: Promise(#promise-resolution). + * @see http://bluebirdjs.com/docs/deprecated-apis.html#promise-resolution + */ + static defer(): Bluebird.Resolver; + + /** + * Cast the given `value` to a trusted promise. + * + * If `value` is already a trusted `Promise`, it is returned as is. If `value` is not a thenable, a fulfilled is: Promise returned with `value` as its fulfillment value. + * If `value` is a thenable (Promise-like object, like those returned by jQuery's `$.ajax`), returns a trusted that: Promise assimilates the state of the thenable. + */ + static cast(value: Resolvable): Bluebird; + + /** + * Sugar for `Promise.resolve(undefined).bind(thisArg);`. See `.bind()`. + */ + static bind(thisArg: any): Bluebird; + + /** + * See if `value` is a trusted Promise. + */ + static is(value: any): boolean; + + /** + * Call this right after the library is loaded to enabled long stack traces. + * + * Long stack traces cannot be disabled after being enabled, and cannot be enabled after promises have already been created. + * Long stack traces imply a substantial performance penalty, around 4-5x for throughput and 0.5x for latency. + */ + static longStackTraces(): void; + + /** + * Returns a promise that will be resolved with value (or undefined) after given ms milliseconds. + * If value is a promise, the delay will start counting down when it is fulfilled and the returned + * promise will be fulfilled with the fulfillment value of the value promise. + */ + static delay(ms: number, value: Resolvable): Bluebird; + static delay(ms: number): Bluebird; + + /** + * Returns a function that will wrap the given `nodeFunction`. + * + * Instead of taking a callback, the returned function will return a promise whose fate is decided by the callback behavior of the given node function. + * The node function should conform to node.js convention of accepting a callback as last argument and + * calling that callback with error as the first argument and success value on the second argument. + * + * If the `nodeFunction` calls its callback with multiple success values, the fulfillment value will be an array of them. + * + * If you pass a `receiver`, the `nodeFunction` will be called as a method on the `receiver`. + */ + static promisify( + func: (callback: (err: any, result?: T) => void) => void, + options?: Bluebird.PromisifyOptions, + ): () => Bluebird; + static promisify( + func: (arg1: A1, callback: (err: any, result?: T) => void) => void, + options?: Bluebird.PromisifyOptions, + ): (arg1: A1) => Bluebird; + static promisify( + func: (arg1: A1, arg2: A2, callback: (err: any, result?: T) => void) => void, + options?: Bluebird.PromisifyOptions, + ): (arg1: A1, arg2: A2) => Bluebird; + static promisify( + func: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, result?: T) => void) => void, + options?: Bluebird.PromisifyOptions, + ): (arg1: A1, arg2: A2, arg3: A3) => Bluebird; + static promisify( + func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, result?: T) => void) => void, + options?: Bluebird.PromisifyOptions, + ): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Bluebird; + static promisify( + func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, result?: T) => void) => void, + options?: Bluebird.PromisifyOptions, + ): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Bluebird; + static promisify( + nodeFunction: (...args: any[]) => void, + options?: Bluebird.PromisifyOptions, + ): (...args: any[]) => Bluebird; + + /** + * Promisifies the entire object by going through the object's properties and creating an async equivalent of each function on the object and its prototype chain. + * + * The promisified method name will be the original method name postfixed with `Async`. Returns the input object. + * + * Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example, + * if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method. + */ + // TODO how to model promisifyAll? + static promisifyAll(target: T, options?: Bluebird.PromisifyAllOptions): PromisifyAll; + + /** + * Returns a promise that is resolved by a node style callback function. + */ + static fromNode( + resolver: (callback: (err: any, result?: T) => void) => void, + options?: Bluebird.FromNodeOptions, + ): Bluebird; + static fromCallback( + resolver: (callback: (err: any, result?: T) => void) => void, + options?: Bluebird.FromNodeOptions, + ): Bluebird; + + /** + * Returns a function that can use `yield` to run asynchronous code synchronously. + * + * This feature requires the support of generators which are drafted in the next version of the language. + * Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch. + */ + // TODO: After https://github.com/Microsoft/TypeScript/issues/2983 is implemented, we can use + // the return type propagation of generators to automatically infer the return type T. + static coroutine( + generatorFunction: () => IterableIterator, + options?: Bluebird.CoroutineOptions, + ): () => Bluebird; + static coroutine( + generatorFunction: (a1: A1) => IterableIterator, + options?: Bluebird.CoroutineOptions, + ): (a1: A1) => Bluebird; + static coroutine( + generatorFunction: (a1: A1, a2: A2) => IterableIterator, + options?: Bluebird.CoroutineOptions, + ): (a1: A1, a2: A2) => Bluebird; + static coroutine( + generatorFunction: (a1: A1, a2: A2, a3: A3) => IterableIterator, + options?: Bluebird.CoroutineOptions, + ): (a1: A1, a2: A2, a3: A3) => Bluebird; + static coroutine( + generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4) => IterableIterator, + options?: Bluebird.CoroutineOptions, + ): (a1: A1, a2: A2, a3: A3, a4: A4) => Bluebird; + static coroutine( + generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5) => IterableIterator, + options?: Bluebird.CoroutineOptions, + ): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5) => Bluebird; + static coroutine( + generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6) => IterableIterator, + options?: Bluebird.CoroutineOptions, + ): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6) => Bluebird; + static coroutine( + generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7) => IterableIterator, + options?: Bluebird.CoroutineOptions, + ): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7) => Bluebird; + static coroutine( + generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8) => IterableIterator, + options?: Bluebird.CoroutineOptions, + ): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8) => Bluebird; + + /** + * Add `handler` as the handler to call when there is a possibly unhandled rejection. The default handler logs the error stack to stderr or `console.error` in browsers. + * + * Passing no value or a non-function will have the effect of removing any kind of handling for possibly unhandled rejections. + */ + static onPossiblyUnhandledRejection(handler: (reason: any) => any): void; + + /** + * Add handler as the handler to call when there is a possibly unhandled rejection. + * The default handler logs the error stack to stderr or console.error in browsers. + * + * Passing no value or a non-function will have the effect of removing any kind of handling for possibly unhandled rejections. + * + * Note: this hook is specific to the bluebird instance its called on, application developers should use global rejection events. + */ + static onPossiblyUnhandledRejection(handler?: (error: Error, promise: Bluebird) => void): void; + + /** + * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are fulfilled. + * The promise's fulfillment value is an array with fulfillment values at respective positions to the original array. + * If any promise in the array rejects, the returned promise is rejected with the rejection reason. + */ + // TODO enable more overloads + // array with promises of different types + static all( + values: [Resolvable, Resolvable, Resolvable, Resolvable, Resolvable], + ): Bluebird<[T1, T2, T3, T4, T5]>; + static all( + values: [Resolvable, Resolvable, Resolvable, Resolvable], + ): Bluebird<[T1, T2, T3, T4]>; + static all(values: [Resolvable, Resolvable, Resolvable]): Bluebird<[T1, T2, T3]>; + static all(values: [Resolvable, Resolvable]): Bluebird<[T1, T2]>; + static all(values: [Resolvable]): Bluebird<[T1]>; + // array with values + static all(values: Resolvable>>): Bluebird; + + static allSettled( + values: [Resolvable, Resolvable, Resolvable, Resolvable, Resolvable], + ): Bluebird< + [ + Bluebird.Inspection, + Bluebird.Inspection, + Bluebird.Inspection, + Bluebird.Inspection, + Bluebird.Inspection, + ] + >; + static allSettled( + values: [Resolvable, Resolvable, Resolvable, Resolvable], + ): Bluebird<[Bluebird.Inspection, Bluebird.Inspection, Bluebird.Inspection, Bluebird.Inspection]>; + static allSettled( + values: [Resolvable, Resolvable, Resolvable], + ): Bluebird<[Bluebird.Inspection, Bluebird.Inspection, Bluebird.Inspection]>; + static allSettled( + values: [Resolvable, Resolvable], + ): Bluebird<[Bluebird.Inspection, Bluebird.Inspection]>; + static allSettled(values: [Resolvable]): Bluebird<[Bluebird.Inspection]>; + static allSettled(values: Resolvable>>): Bluebird>>; + + /** + * Like ``Promise.all`` but for object properties instead of array items. Returns a promise that is fulfilled when all the properties of the object are fulfilled. + * + * The promise's fulfillment value is an object with fulfillment values at respective keys to the original object. + * If any promise in the object rejects, the returned promise is rejected with the rejection reason. + * + * If `object` is a trusted `Promise`, then it will be treated as a promise for object rather than for its properties. + * All other objects are treated for their properties as is returned by `Object.keys` - the object's own enumerable properties. + * + * *The original object is not modified.* + */ + // map + static props(map: Resolvable>>): Bluebird>; + // trusted promise for object + static props(object: PromiseLike>): Bluebird; + // object + static props(object: Bluebird.ResolvableProps): Bluebird; // tslint:disable-line:unified-signatures + + /** + * Like `Promise.some()`, with 1 as `count`. However, if the promise fulfills, the fulfillment value is not an array of 1 but the value directly. + */ + static any(values: Resolvable>>): Bluebird; + + /** + * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is + * fulfilled or rejected as soon as a promise in the array is fulfilled or rejected with the respective rejection reason or fulfillment value. + * + * **Note** If you pass empty array or a sparse array with no values, or a promise/thenable for such, it will be forever pending. + */ + static race(values: Resolvable>>): Bluebird; + + /** + * Initiate a competitive race between multiple promises or values (values will become immediately fulfilled promises). + * When `count` amount of promises have been fulfilled, the returned promise is fulfilled with an array that contains the fulfillment values of + * the winners in order of resolution. + * + * If too many promises are rejected so that the promise can never become fulfilled, + * it will be immediately rejected with an array of rejection reasons in the order they were thrown in. + * + * *The original array is not modified.* + */ + static some(values: Resolvable>>, count: number): Bluebird; + + /** + * Promise.join( + * Promise|any values..., + * function handler + * ) -> Promise + * For coordinating multiple concurrent discrete promises. + * + * Note: In 1.x and 0.x Promise.join used to be a Promise.all that took the values in as arguments instead in an array. + * This behavior has been deprecated but is still supported partially - when the last argument is an immediate function value the new semantics will apply + */ + static join( + arg1: Resolvable, + handler: (arg1: A1) => Resolvable, + ): Bluebird; + static join( + arg1: Resolvable, + arg2: Resolvable, + handler: (arg1: A1, arg2: A2) => Resolvable, + ): Bluebird; + static join( + arg1: Resolvable, + arg2: Resolvable, + arg3: Resolvable, + handler: (arg1: A1, arg2: A2, arg3: A3) => Resolvable, + ): Bluebird; + static join( + arg1: Resolvable, + arg2: Resolvable, + arg3: Resolvable, + arg4: Resolvable, + handler: (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Resolvable, + ): Bluebird; + static join( + arg1: Resolvable, + arg2: Resolvable, + arg3: Resolvable, + arg4: Resolvable, + arg5: Resolvable, + handler: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Resolvable, + ): Bluebird; + + // variadic array + /** @deprecated use .all instead */ + static join(...values: Array>): Bluebird; + + /** + * Map an array, or a promise of an array, + * which contains a promises (or a mix of promises and values) with the given `mapper` function with the signature `(item, index, arrayLength)` + * where `item` is the resolved value of a respective promise in the input array. + * If any promise in the input array is rejected the returned promise is rejected as well. + * + * If the `mapper` function returns promises or thenables, the returned promise will wait for all the mapped results to be resolved as well. + * + * *The original array is not modified.* + */ + static map( + values: Resolvable>>, + mapper: IterateFunction, + options?: Bluebird.ConcurrencyOption, + ): Bluebird; + + /** + * Reduce an array, or a promise of an array, + * which contains a promises (or a mix of promises and values) with the given `reducer` function with the signature `(total, current, index, arrayLength)` + * where `item` is the resolved value of a respective promise in the input array. + * If any promise in the input array is rejected the returned promise is rejected as well. + * + * If the reducer function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration. + * + * *The original array is not modified. If no `initialValue` is given and the array doesn't contain at least 2 items, + * the callback will not be called and `undefined` is returned. + * + * If `initialValue` is given and the array doesn't have at least 1 item, `initialValue` is returned.* + */ + static reduce( + values: Resolvable>>, + reducer: (total: U, current: R, index: number, arrayLength: number) => Resolvable, + initialValue?: Resolvable, + ): Bluebird; + + /** + * Filter an array, or a promise of an array, + * which contains a promises (or a mix of promises and values) with the given `filterer` function with the signature `(item, index, arrayLength)` + * where `item` is the resolved value of a respective promise in the input array. + * If any promise in the input array is rejected the returned promise is rejected as well. + * + * The return values from the filtered functions are coerced to booleans, with the exception of promises and thenables which are awaited for their eventual result. + * + * *The original array is not modified. + */ + static filter( + values: Resolvable>>, + filterer: IterateFunction, + option?: Bluebird.ConcurrencyOption, + ): Bluebird; + + /** + * Iterate over an array, or a promise of an array, + * which contains promises (or a mix of promises and values) with the given iterator function with the signature `(item, index, value)` + * where item is the resolved value of a respective promise in the input array. + * Iteration happens serially. If any promise in the input array is rejected the returned promise is rejected as well. + * + * Resolves to the original array unmodified, this method is meant to be used for side effects. + * If the iterator function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration. + */ + static each( + values: Resolvable>>, + iterator: IterateFunction, + ): Bluebird; + + /** + * Given an Iterable(arrays are Iterable), or a promise of an Iterable, which produces promises (or a mix of promises and values), + * iterate over all the values in the Iterable into an array and iterate over the array serially, in-order. + * + * Returns a promise for an array that contains the values returned by the iterator function in their respective positions. + * The iterator won't be called for an item until its previous item, and the promise returned by the iterator for that item are fulfilled. + * This results in a mapSeries kind of utility but it can also be used simply as a side effect iterator similar to Array#forEach. + * + * If any promise in the input array is rejected or any promise returned by the iterator function is rejected, the result will be rejected as well. + */ + static mapSeries( + values: Resolvable>>, + iterator: IterateFunction, + ): Bluebird; + + /** + * A meta method used to specify the disposer method that cleans up a resource when using `Promise.using`. + * + * Returns a Disposer object which encapsulates both the resource as well as the method to clean it up. + * The user can pass this object to `Promise.using` to get access to the resource when it becomes available, + * as well as to ensure its automatically cleaned up. + * + * The second argument passed to a disposer is the result promise of the using block, which you can + * inspect synchronously. + */ + disposer(disposeFn: (arg: R, promise: Bluebird) => Resolvable): Bluebird.Disposer; + + /** + * In conjunction with `.disposer`, using will make sure that no matter what, the specified disposer + * will be called when the promise returned by the callback passed to using has settled. The disposer is + * necessary because there is no standard interface in node for disposing resources. + */ + static using( + disposer: Bluebird.Disposer, + executor: (transaction: R) => PromiseLike, + ): Bluebird; + static using( + disposer: Bluebird.Disposer, + disposer2: Bluebird.Disposer, + executor: (transaction1: R1, transaction2: R2) => PromiseLike, + ): Bluebird; + static using( + disposer: Bluebird.Disposer, + disposer2: Bluebird.Disposer, + disposer3: Bluebird.Disposer, + executor: (transaction1: R1, transaction2: R2, transaction3: R3) => PromiseLike, + ): Bluebird; + + /** + * Configure long stack traces, warnings, monitoring and cancellation. + * Note that even though false is the default here, a development environment might be detected which automatically + * enables long stack traces and warnings. + */ + static config(options: { + /** Enable warnings */ + warnings?: boolean | { + /** Enables all warnings except forgotten return statements. */ + wForgottenReturn: boolean; + } | undefined; + /** Enable long stack traces */ + longStackTraces?: boolean | undefined; + /** Enable cancellation */ + cancellation?: boolean | undefined; + /** Enable monitoring */ + monitoring?: boolean | undefined; + /** Enable async hooks */ + asyncHooks?: boolean | undefined; + }): void; + + /** + * Create a new promise. The passed in function will receive functions `resolve` and `reject` as its arguments which can be called to seal the fate of the created promise. + * If promise cancellation is enabled, passed in function will receive one more function argument `onCancel` that allows to register an optional cancellation callback. + */ + static Promise: typeof Bluebird; + + /** + * The version number of the library + */ + static version: string; +} + +declare namespace Bluebird { + interface ConcurrencyOption { + concurrency: number; + } + interface SpreadOption { + spread: boolean; + } + interface FromNodeOptions { + multiArgs?: boolean | undefined; + } + interface PromisifyOptions { + context?: any; + multiArgs?: boolean | undefined; + } + interface PromisifyAllOptions extends PromisifyOptions { + suffix?: string | undefined; + filter?(name: string, func: (...args: any[]) => any, target?: any, passesDefaultFilter?: boolean): boolean; + // The promisifier gets a reference to the original method and should return a function which returns a promise + promisifier?( + this: T, + originalMethod: (...args: any[]) => any, + defaultPromisifer: (...args: any[]) => (...args: any[]) => Bluebird, + ): () => PromiseLike; + } + interface CoroutineOptions { + yieldHandler(value: any): any; + } + + /** + * Represents an error is an explicit promise rejection as opposed to a thrown error. + * For example, if an error is errbacked by a callback API promisified through undefined or undefined + * and is not a typed error, it will be converted to a `OperationalError` which has the original error in + * the `.cause` property. + * + * `OperationalError`s are caught in `.error` handlers. + */ + class OperationalError extends Error {} + + /** + * Signals that an operation has timed out. Used as a custom cancellation reason in `.timeout`. + */ + class TimeoutError extends Error {} + + /** + * Signals that an operation has been aborted or cancelled. The default reason used by `.cancel`. + */ + class CancellationError extends Error {} + + /** + * A collection of errors. `AggregateError` is an array-like object, with numeric indices and a `.length` property. + * It supports all generic array methods such as `.forEach` directly. + * + * `AggregateError`s are caught in `.error` handlers, even if the contained errors are not operational. + * + * `Promise.some` and `Promise.any` use `AggregateError` as rejection reason when they fail. + */ + class AggregateError extends Error implements ArrayLike { + length: number; + [index: number]: Error; + join(separator?: string): string; + pop(): Error; + push(...errors: Error[]): number; + shift(): Error; + unshift(...errors: Error[]): number; + slice(begin?: number, end?: number): AggregateError; + filter( + callback: (element: Error, index: number, array: AggregateError) => boolean, + thisArg?: any, + ): AggregateError; + forEach(callback: (element: Error, index: number, array: AggregateError) => void, thisArg?: any): undefined; + some(callback: (element: Error, index: number, array: AggregateError) => boolean, thisArg?: any): boolean; + every(callback: (element: Error, index: number, array: AggregateError) => boolean, thisArg?: any): boolean; + map(callback: (element: Error, index: number, array: AggregateError) => boolean, thisArg?: any): AggregateError; + indexOf(searchElement: Error, fromIndex?: number): number; + lastIndexOf(searchElement: Error, fromIndex?: number): number; + reduce( + callback: (accumulator: any, element: Error, index: number, array: AggregateError) => any, + initialValue?: any, + ): any; + reduceRight( + callback: (previousValue: any, element: Error, index: number, array: AggregateError) => any, + initialValue?: any, + ): any; + sort(compareFunction?: (errLeft: Error, errRight: Error) => number): AggregateError; + reverse(): AggregateError; + } + + /** + * returned by `Bluebird.disposer()`. + */ + class Disposer {} + + /** @deprecated Use PromiseLike directly. */ + type Thenable = PromiseLike; + + type ResolvableProps = object & { [K in keyof T]: Resolvable }; + + interface Resolver { + /** + * Returns a reference to the controlled promise that can be passed to clients. + */ + promise: Bluebird; + + /** + * Resolve the underlying promise with `value` as the resolution value. If `value` is a thenable or a promise, the underlying promise will assume its state. + */ + resolve(value: R): void; + resolve(): void; + + /** + * Reject the underlying promise with `reason` as the rejection reason. + */ + reject(reason: any): void; + + /** + * Gives you a callback representation of the `PromiseResolver`. Note that this is not a method but a property. + * The callback accepts error object in first argument and success values on the 2nd parameter and the rest, I.E. node js conventions. + * + * If the the callback is called with multiple success values, the resolver fulfills its promise with an array of the values. + */ + // TODO specify resolver callback + callback(err: any, value: R, ...values: R[]): void; + } + + interface Inspection { + /** + * See if the underlying promise was fulfilled at the creation time of this inspection object. + */ + isFulfilled(): boolean; + + /** + * See if the underlying promise was rejected at the creation time of this inspection object. + */ + isRejected(): boolean; + + /** + * See if the underlying promise was cancelled at the creation time of this inspection object. + */ + isCancelled(): boolean; + + /** + * See if the underlying promise was defer at the creation time of this inspection object. + */ + isPending(): boolean; + + /** + * Get the fulfillment value of the underlying promise. Throws if the promise wasn't fulfilled at the creation time of this inspection object. + * + * throws `TypeError` + */ + value(): R; + + /** + * Get the rejection reason for the underlying promise. Throws if the promise wasn't rejected at the creation time of this inspection object. + * + * throws `TypeError` + */ + reason(): any; + } + + /** + * Returns a new independent copy of the Bluebird library. + * + * This method should be used before you use any of the methods which would otherwise alter the global Bluebird object - to avoid polluting global state. + */ + function getNewLibraryCopy(): typeof Bluebird; + + /** + * This is relevant to browser environments with no module loader. + * + * Release control of the Promise namespace to whatever it was before this library was loaded. + * Returns a reference to the library namespace so you can attach it to something else. + */ + function noConflict(): typeof Bluebird; + + /** + * Changes how bluebird schedules calls a-synchronously. + * + * @param scheduler Should be a function that asynchronously schedules + * the calling of the passed in function + */ + function setScheduler(scheduler: (callback: (...args: any[]) => void) => void): void; +} + +export = Bluebird; diff --git a/project starter code/node_modules/@types/bluebird/package.json b/project starter code/node_modules/@types/bluebird/package.json new file mode 100644 index 00000000..511a9490 --- /dev/null +++ b/project starter code/node_modules/@types/bluebird/package.json @@ -0,0 +1,25 @@ +{ + "name": "@types/bluebird", + "version": "3.5.42", + "description": "TypeScript definitions for bluebird", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bluebird", + "license": "MIT", + "contributors": [ + { + "name": "Leonard Hecker", + "githubUsername": "lhecker", + "url": "https://github.com/lhecker" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/bluebird" + }, + "scripts": {}, + "dependencies": {}, + "typesPublisherContentHash": "00aa07922f070eaa03e5e9566412433716ee34f248972d8d2e8a6f55410c2f3f", + "typeScriptVersion": "4.5" +} \ No newline at end of file diff --git a/project starter code/node_modules/anymatch/LICENSE b/project starter code/node_modules/anymatch/LICENSE new file mode 100644 index 00000000..491766ca --- /dev/null +++ b/project starter code/node_modules/anymatch/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) 2019 Elan Shanker, Paul Miller (https://paulmillr.com) + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/project starter code/node_modules/anymatch/README.md b/project starter code/node_modules/anymatch/README.md new file mode 100644 index 00000000..1dd67f53 --- /dev/null +++ b/project starter code/node_modules/anymatch/README.md @@ -0,0 +1,87 @@ +anymatch [![Build Status](https://travis-ci.org/micromatch/anymatch.svg?branch=master)](https://travis-ci.org/micromatch/anymatch) [![Coverage Status](https://img.shields.io/coveralls/micromatch/anymatch.svg?branch=master)](https://coveralls.io/r/micromatch/anymatch?branch=master) +====== +Javascript module to match a string against a regular expression, glob, string, +or function that takes the string as an argument and returns a truthy or falsy +value. The matcher can also be an array of any or all of these. Useful for +allowing a very flexible user-defined config to define things like file paths. + +__Note: This module has Bash-parity, please be aware that Windows-style backslashes are not supported as separators. See https://github.com/micromatch/micromatch#backslashes for more information.__ + + +Usage +----- +```sh +npm install anymatch +``` + +#### anymatch(matchers, testString, [returnIndex], [options]) +* __matchers__: (_Array|String|RegExp|Function_) +String to be directly matched, string with glob patterns, regular expression +test, function that takes the testString as an argument and returns a truthy +value if it should be matched, or an array of any number and mix of these types. +* __testString__: (_String|Array_) The string to test against the matchers. If +passed as an array, the first element of the array will be used as the +`testString` for non-function matchers, while the entire array will be applied +as the arguments for function matchers. +* __options__: (_Object_ [optional]_) Any of the [picomatch](https://github.com/micromatch/picomatch#options) options. + * __returnIndex__: (_Boolean [optional]_) If true, return the array index of +the first matcher that that testString matched, or -1 if no match, instead of a +boolean result. + +```js +const anymatch = require('anymatch'); + +const matchers = [ 'path/to/file.js', 'path/anyjs/**/*.js', /foo.js$/, string => string.includes('bar') && string.length > 10 ] ; + +anymatch(matchers, 'path/to/file.js'); // true +anymatch(matchers, 'path/anyjs/baz.js'); // true +anymatch(matchers, 'path/to/foo.js'); // true +anymatch(matchers, 'path/to/bar.js'); // true +anymatch(matchers, 'bar.js'); // false + +// returnIndex = true +anymatch(matchers, 'foo.js', {returnIndex: true}); // 2 +anymatch(matchers, 'path/anyjs/foo.js', {returnIndex: true}); // 1 + +// any picomatc + +// using globs to match directories and their children +anymatch('node_modules', 'node_modules'); // true +anymatch('node_modules', 'node_modules/somelib/index.js'); // false +anymatch('node_modules/**', 'node_modules/somelib/index.js'); // true +anymatch('node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // false +anymatch('**/node_modules/**', '/absolute/path/to/node_modules/somelib/index.js'); // true + +const matcher = anymatch(matchers); +['foo.js', 'bar.js'].filter(matcher); // [ 'foo.js' ] +anymatch master* ❯ + +``` + +#### anymatch(matchers) +You can also pass in only your matcher(s) to get a curried function that has +already been bound to the provided matching criteria. This can be used as an +`Array#filter` callback. + +```js +var matcher = anymatch(matchers); + +matcher('path/to/file.js'); // true +matcher('path/anyjs/baz.js', true); // 1 + +['foo.js', 'bar.js'].filter(matcher); // ['foo.js'] +``` + +Changelog +---------- +[See release notes page on GitHub](https://github.com/micromatch/anymatch/releases) + +- **v3.0:** Removed `startIndex` and `endIndex` arguments. Node 8.x-only. +- **v2.0:** [micromatch](https://github.com/jonschlinkert/micromatch) moves away from minimatch-parity and inline with Bash. This includes handling backslashes differently (see https://github.com/micromatch/micromatch#backslashes for more information). +- **v1.2:** anymatch uses [micromatch](https://github.com/jonschlinkert/micromatch) +for glob pattern matching. Issues with glob pattern matching should be +reported directly to the [micromatch issue tracker](https://github.com/jonschlinkert/micromatch/issues). + +License +------- +[ISC](https://raw.github.com/micromatch/anymatch/master/LICENSE) diff --git a/project starter code/node_modules/anymatch/index.d.ts b/project starter code/node_modules/anymatch/index.d.ts new file mode 100644 index 00000000..3ef7eaad --- /dev/null +++ b/project starter code/node_modules/anymatch/index.d.ts @@ -0,0 +1,20 @@ +type AnymatchFn = (testString: string) => boolean; +type AnymatchPattern = string|RegExp|AnymatchFn; +type AnymatchMatcher = AnymatchPattern|AnymatchPattern[] +type AnymatchTester = { + (testString: string|any[], returnIndex: true): number; + (testString: string|any[]): boolean; +} + +type PicomatchOptions = {dot: boolean}; + +declare const anymatch: { + (matchers: AnymatchMatcher): AnymatchTester; + (matchers: AnymatchMatcher, testString: null, returnIndex: true | PicomatchOptions): AnymatchTester; + (matchers: AnymatchMatcher, testString: string|any[], returnIndex: true | PicomatchOptions): number; + (matchers: AnymatchMatcher, testString: string|any[]): boolean; +} + +export {AnymatchMatcher as Matcher} +export {AnymatchTester as Tester} +export default anymatch diff --git a/project starter code/node_modules/anymatch/index.js b/project starter code/node_modules/anymatch/index.js new file mode 100644 index 00000000..8eb73e9c --- /dev/null +++ b/project starter code/node_modules/anymatch/index.js @@ -0,0 +1,104 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { value: true }); + +const picomatch = require('picomatch'); +const normalizePath = require('normalize-path'); + +/** + * @typedef {(testString: string) => boolean} AnymatchFn + * @typedef {string|RegExp|AnymatchFn} AnymatchPattern + * @typedef {AnymatchPattern|AnymatchPattern[]} AnymatchMatcher + */ +const BANG = '!'; +const DEFAULT_OPTIONS = {returnIndex: false}; +const arrify = (item) => Array.isArray(item) ? item : [item]; + +/** + * @param {AnymatchPattern} matcher + * @param {object} options + * @returns {AnymatchFn} + */ +const createPattern = (matcher, options) => { + if (typeof matcher === 'function') { + return matcher; + } + if (typeof matcher === 'string') { + const glob = picomatch(matcher, options); + return (string) => matcher === string || glob(string); + } + if (matcher instanceof RegExp) { + return (string) => matcher.test(string); + } + return (string) => false; +}; + +/** + * @param {Array} patterns + * @param {Array} negPatterns + * @param {String|Array} args + * @param {Boolean} returnIndex + * @returns {boolean|number} + */ +const matchPatterns = (patterns, negPatterns, args, returnIndex) => { + const isList = Array.isArray(args); + const _path = isList ? args[0] : args; + if (!isList && typeof _path !== 'string') { + throw new TypeError('anymatch: second argument must be a string: got ' + + Object.prototype.toString.call(_path)) + } + const path = normalizePath(_path, false); + + for (let index = 0; index < negPatterns.length; index++) { + const nglob = negPatterns[index]; + if (nglob(path)) { + return returnIndex ? -1 : false; + } + } + + const applied = isList && [path].concat(args.slice(1)); + for (let index = 0; index < patterns.length; index++) { + const pattern = patterns[index]; + if (isList ? pattern(...applied) : pattern(path)) { + return returnIndex ? index : true; + } + } + + return returnIndex ? -1 : false; +}; + +/** + * @param {AnymatchMatcher} matchers + * @param {Array|string} testString + * @param {object} options + * @returns {boolean|number|Function} + */ +const anymatch = (matchers, testString, options = DEFAULT_OPTIONS) => { + if (matchers == null) { + throw new TypeError('anymatch: specify first argument'); + } + const opts = typeof options === 'boolean' ? {returnIndex: options} : options; + const returnIndex = opts.returnIndex || false; + + // Early cache for matchers. + const mtchers = arrify(matchers); + const negatedGlobs = mtchers + .filter(item => typeof item === 'string' && item.charAt(0) === BANG) + .map(item => item.slice(1)) + .map(item => picomatch(item, opts)); + const patterns = mtchers + .filter(item => typeof item !== 'string' || (typeof item === 'string' && item.charAt(0) !== BANG)) + .map(matcher => createPattern(matcher, opts)); + + if (testString == null) { + return (testString, ri = false) => { + const returnIndex = typeof ri === 'boolean' ? ri : false; + return matchPatterns(patterns, negatedGlobs, testString, returnIndex); + } + } + + return matchPatterns(patterns, negatedGlobs, testString, returnIndex); +}; + +anymatch.default = anymatch; +module.exports = anymatch; diff --git a/project starter code/node_modules/anymatch/package.json b/project starter code/node_modules/anymatch/package.json new file mode 100644 index 00000000..2cb2307e --- /dev/null +++ b/project starter code/node_modules/anymatch/package.json @@ -0,0 +1,48 @@ +{ + "name": "anymatch", + "version": "3.1.3", + "description": "Matches strings against configurable strings, globs, regular expressions, and/or functions", + "files": [ + "index.js", + "index.d.ts" + ], + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "author": { + "name": "Elan Shanker", + "url": "https://github.com/es128" + }, + "license": "ISC", + "homepage": "https://github.com/micromatch/anymatch", + "repository": { + "type": "git", + "url": "https://github.com/micromatch/anymatch" + }, + "keywords": [ + "match", + "any", + "string", + "file", + "fs", + "list", + "glob", + "regex", + "regexp", + "regular", + "expression", + "function" + ], + "scripts": { + "test": "nyc mocha", + "mocha": "mocha" + }, + "devDependencies": { + "mocha": "^6.1.3", + "nyc": "^14.0.0" + }, + "engines": { + "node": ">= 8" + } +} diff --git a/project starter code/node_modules/asynckit/LICENSE b/project starter code/node_modules/asynckit/LICENSE new file mode 100644 index 00000000..c9eca5dd --- /dev/null +++ b/project starter code/node_modules/asynckit/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Alex Indigo + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/project starter code/node_modules/asynckit/README.md b/project starter code/node_modules/asynckit/README.md new file mode 100644 index 00000000..ddcc7e6b --- /dev/null +++ b/project starter code/node_modules/asynckit/README.md @@ -0,0 +1,233 @@ +# asynckit [![NPM Module](https://img.shields.io/npm/v/asynckit.svg?style=flat)](https://www.npmjs.com/package/asynckit) + +Minimal async jobs utility library, with streams support. + +[![PhantomJS Build](https://img.shields.io/travis/alexindigo/asynckit/v0.4.0.svg?label=browser&style=flat)](https://travis-ci.org/alexindigo/asynckit) +[![Linux Build](https://img.shields.io/travis/alexindigo/asynckit/v0.4.0.svg?label=linux:0.12-6.x&style=flat)](https://travis-ci.org/alexindigo/asynckit) +[![Windows Build](https://img.shields.io/appveyor/ci/alexindigo/asynckit/v0.4.0.svg?label=windows:0.12-6.x&style=flat)](https://ci.appveyor.com/project/alexindigo/asynckit) + +[![Coverage Status](https://img.shields.io/coveralls/alexindigo/asynckit/v0.4.0.svg?label=code+coverage&style=flat)](https://coveralls.io/github/alexindigo/asynckit?branch=master) +[![Dependency Status](https://img.shields.io/david/alexindigo/asynckit/v0.4.0.svg?style=flat)](https://david-dm.org/alexindigo/asynckit) +[![bitHound Overall Score](https://www.bithound.io/github/alexindigo/asynckit/badges/score.svg)](https://www.bithound.io/github/alexindigo/asynckit) + + + +AsyncKit provides harness for `parallel` and `serial` iterators over list of items represented by arrays or objects. +Optionally it accepts abort function (should be synchronously return by iterator for each item), and terminates left over jobs upon an error event. For specific iteration order built-in (`ascending` and `descending`) and custom sort helpers also supported, via `asynckit.serialOrdered` method. + +It ensures async operations to keep behavior more stable and prevent `Maximum call stack size exceeded` errors, from sync iterators. + +| compression | size | +| :----------------- | -------: | +| asynckit.js | 12.34 kB | +| asynckit.min.js | 4.11 kB | +| asynckit.min.js.gz | 1.47 kB | + + +## Install + +```sh +$ npm install --save asynckit +``` + +## Examples + +### Parallel Jobs + +Runs iterator over provided array in parallel. Stores output in the `result` array, +on the matching positions. In unlikely event of an error from one of the jobs, +will terminate rest of the active jobs (if abort function is provided) +and return error along with salvaged data to the main callback function. + +#### Input Array + +```javascript +var parallel = require('asynckit').parallel + , assert = require('assert') + ; + +var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ] + , expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ] + , expectedTarget = [ 1, 1, 2, 4, 8, 16, 32, 64 ] + , target = [] + ; + +parallel(source, asyncJob, function(err, result) +{ + assert.deepEqual(result, expectedResult); + assert.deepEqual(target, expectedTarget); +}); + +// async job accepts one element from the array +// and a callback function +function asyncJob(item, cb) +{ + // different delays (in ms) per item + var delay = item * 25; + + // pretend different jobs take different time to finish + // and not in consequential order + var timeoutId = setTimeout(function() { + target.push(item); + cb(null, item * 2); + }, delay); + + // allow to cancel "leftover" jobs upon error + // return function, invoking of which will abort this job + return clearTimeout.bind(null, timeoutId); +} +``` + +More examples could be found in [test/test-parallel-array.js](test/test-parallel-array.js). + +#### Input Object + +Also it supports named jobs, listed via object. + +```javascript +var parallel = require('asynckit/parallel') + , assert = require('assert') + ; + +var source = { first: 1, one: 1, four: 4, sixteen: 16, sixtyFour: 64, thirtyTwo: 32, eight: 8, two: 2 } + , expectedResult = { first: 2, one: 2, four: 8, sixteen: 32, sixtyFour: 128, thirtyTwo: 64, eight: 16, two: 4 } + , expectedTarget = [ 1, 1, 2, 4, 8, 16, 32, 64 ] + , expectedKeys = [ 'first', 'one', 'two', 'four', 'eight', 'sixteen', 'thirtyTwo', 'sixtyFour' ] + , target = [] + , keys = [] + ; + +parallel(source, asyncJob, function(err, result) +{ + assert.deepEqual(result, expectedResult); + assert.deepEqual(target, expectedTarget); + assert.deepEqual(keys, expectedKeys); +}); + +// supports full value, key, callback (shortcut) interface +function asyncJob(item, key, cb) +{ + // different delays (in ms) per item + var delay = item * 25; + + // pretend different jobs take different time to finish + // and not in consequential order + var timeoutId = setTimeout(function() { + keys.push(key); + target.push(item); + cb(null, item * 2); + }, delay); + + // allow to cancel "leftover" jobs upon error + // return function, invoking of which will abort this job + return clearTimeout.bind(null, timeoutId); +} +``` + +More examples could be found in [test/test-parallel-object.js](test/test-parallel-object.js). + +### Serial Jobs + +Runs iterator over provided array sequentially. Stores output in the `result` array, +on the matching positions. In unlikely event of an error from one of the jobs, +will not proceed to the rest of the items in the list +and return error along with salvaged data to the main callback function. + +#### Input Array + +```javascript +var serial = require('asynckit/serial') + , assert = require('assert') + ; + +var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ] + , expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ] + , expectedTarget = [ 0, 1, 2, 3, 4, 5, 6, 7 ] + , target = [] + ; + +serial(source, asyncJob, function(err, result) +{ + assert.deepEqual(result, expectedResult); + assert.deepEqual(target, expectedTarget); +}); + +// extended interface (item, key, callback) +// also supported for arrays +function asyncJob(item, key, cb) +{ + target.push(key); + + // it will be automatically made async + // even it iterator "returns" in the same event loop + cb(null, item * 2); +} +``` + +More examples could be found in [test/test-serial-array.js](test/test-serial-array.js). + +#### Input Object + +Also it supports named jobs, listed via object. + +```javascript +var serial = require('asynckit').serial + , assert = require('assert') + ; + +var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ] + , expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ] + , expectedTarget = [ 0, 1, 2, 3, 4, 5, 6, 7 ] + , target = [] + ; + +var source = { first: 1, one: 1, four: 4, sixteen: 16, sixtyFour: 64, thirtyTwo: 32, eight: 8, two: 2 } + , expectedResult = { first: 2, one: 2, four: 8, sixteen: 32, sixtyFour: 128, thirtyTwo: 64, eight: 16, two: 4 } + , expectedTarget = [ 1, 1, 4, 16, 64, 32, 8, 2 ] + , target = [] + ; + + +serial(source, asyncJob, function(err, result) +{ + assert.deepEqual(result, expectedResult); + assert.deepEqual(target, expectedTarget); +}); + +// shortcut interface (item, callback) +// works for object as well as for the arrays +function asyncJob(item, cb) +{ + target.push(item); + + // it will be automatically made async + // even it iterator "returns" in the same event loop + cb(null, item * 2); +} +``` + +More examples could be found in [test/test-serial-object.js](test/test-serial-object.js). + +_Note: Since _object_ is an _unordered_ collection of properties, +it may produce unexpected results with sequential iterations. +Whenever order of the jobs' execution is important please use `serialOrdered` method._ + +### Ordered Serial Iterations + +TBD + +For example [compare-property](compare-property) package. + +### Streaming interface + +TBD + +## Want to Know More? + +More examples can be found in [test folder](test/). + +Or open an [issue](https://github.com/alexindigo/asynckit/issues) with questions and/or suggestions. + +## License + +AsyncKit is licensed under the MIT license. diff --git a/project starter code/node_modules/asynckit/bench.js b/project starter code/node_modules/asynckit/bench.js new file mode 100644 index 00000000..c612f1a5 --- /dev/null +++ b/project starter code/node_modules/asynckit/bench.js @@ -0,0 +1,76 @@ +/* eslint no-console: "off" */ + +var asynckit = require('./') + , async = require('async') + , assert = require('assert') + , expected = 0 + ; + +var Benchmark = require('benchmark'); +var suite = new Benchmark.Suite; + +var source = []; +for (var z = 1; z < 100; z++) +{ + source.push(z); + expected += z; +} + +suite +// add tests + +.add('async.map', function(deferred) +{ + var total = 0; + + async.map(source, + function(i, cb) + { + setImmediate(function() + { + total += i; + cb(null, total); + }); + }, + function(err, result) + { + assert.ifError(err); + assert.equal(result[result.length - 1], expected); + deferred.resolve(); + }); +}, {'defer': true}) + + +.add('asynckit.parallel', function(deferred) +{ + var total = 0; + + asynckit.parallel(source, + function(i, cb) + { + setImmediate(function() + { + total += i; + cb(null, total); + }); + }, + function(err, result) + { + assert.ifError(err); + assert.equal(result[result.length - 1], expected); + deferred.resolve(); + }); +}, {'defer': true}) + + +// add listeners +.on('cycle', function(ev) +{ + console.log(String(ev.target)); +}) +.on('complete', function() +{ + console.log('Fastest is ' + this.filter('fastest').map('name')); +}) +// run async +.run({ 'async': true }); diff --git a/project starter code/node_modules/asynckit/index.js b/project starter code/node_modules/asynckit/index.js new file mode 100644 index 00000000..455f9454 --- /dev/null +++ b/project starter code/node_modules/asynckit/index.js @@ -0,0 +1,6 @@ +module.exports = +{ + parallel : require('./parallel.js'), + serial : require('./serial.js'), + serialOrdered : require('./serialOrdered.js') +}; diff --git a/project starter code/node_modules/asynckit/lib/abort.js b/project starter code/node_modules/asynckit/lib/abort.js new file mode 100644 index 00000000..114367e5 --- /dev/null +++ b/project starter code/node_modules/asynckit/lib/abort.js @@ -0,0 +1,29 @@ +// API +module.exports = abort; + +/** + * Aborts leftover active jobs + * + * @param {object} state - current state object + */ +function abort(state) +{ + Object.keys(state.jobs).forEach(clean.bind(state)); + + // reset leftover jobs + state.jobs = {}; +} + +/** + * Cleans up leftover job by invoking abort function for the provided job id + * + * @this state + * @param {string|number} key - job id to abort + */ +function clean(key) +{ + if (typeof this.jobs[key] == 'function') + { + this.jobs[key](); + } +} diff --git a/project starter code/node_modules/asynckit/lib/async.js b/project starter code/node_modules/asynckit/lib/async.js new file mode 100644 index 00000000..7f1288a4 --- /dev/null +++ b/project starter code/node_modules/asynckit/lib/async.js @@ -0,0 +1,34 @@ +var defer = require('./defer.js'); + +// API +module.exports = async; + +/** + * Runs provided callback asynchronously + * even if callback itself is not + * + * @param {function} callback - callback to invoke + * @returns {function} - augmented callback + */ +function async(callback) +{ + var isAsync = false; + + // check if async happened + defer(function() { isAsync = true; }); + + return function async_callback(err, result) + { + if (isAsync) + { + callback(err, result); + } + else + { + defer(function nextTick_callback() + { + callback(err, result); + }); + } + }; +} diff --git a/project starter code/node_modules/asynckit/lib/defer.js b/project starter code/node_modules/asynckit/lib/defer.js new file mode 100644 index 00000000..b67110c7 --- /dev/null +++ b/project starter code/node_modules/asynckit/lib/defer.js @@ -0,0 +1,26 @@ +module.exports = defer; + +/** + * Runs provided function on next iteration of the event loop + * + * @param {function} fn - function to run + */ +function defer(fn) +{ + var nextTick = typeof setImmediate == 'function' + ? setImmediate + : ( + typeof process == 'object' && typeof process.nextTick == 'function' + ? process.nextTick + : null + ); + + if (nextTick) + { + nextTick(fn); + } + else + { + setTimeout(fn, 0); + } +} diff --git a/project starter code/node_modules/asynckit/lib/iterate.js b/project starter code/node_modules/asynckit/lib/iterate.js new file mode 100644 index 00000000..5d2839a5 --- /dev/null +++ b/project starter code/node_modules/asynckit/lib/iterate.js @@ -0,0 +1,75 @@ +var async = require('./async.js') + , abort = require('./abort.js') + ; + +// API +module.exports = iterate; + +/** + * Iterates over each job object + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {object} state - current job status + * @param {function} callback - invoked when all elements processed + */ +function iterate(list, iterator, state, callback) +{ + // store current index + var key = state['keyedList'] ? state['keyedList'][state.index] : state.index; + + state.jobs[key] = runJob(iterator, key, list[key], function(error, output) + { + // don't repeat yourself + // skip secondary callbacks + if (!(key in state.jobs)) + { + return; + } + + // clean up jobs + delete state.jobs[key]; + + if (error) + { + // don't process rest of the results + // stop still active jobs + // and reset the list + abort(state); + } + else + { + state.results[key] = output; + } + + // return salvaged results + callback(error, state.results); + }); +} + +/** + * Runs iterator over provided job element + * + * @param {function} iterator - iterator to invoke + * @param {string|number} key - key/index of the element in the list of jobs + * @param {mixed} item - job description + * @param {function} callback - invoked after iterator is done with the job + * @returns {function|mixed} - job abort function or something else + */ +function runJob(iterator, key, item, callback) +{ + var aborter; + + // allow shortcut if iterator expects only two arguments + if (iterator.length == 2) + { + aborter = iterator(item, async(callback)); + } + // otherwise go with full three arguments + else + { + aborter = iterator(item, key, async(callback)); + } + + return aborter; +} diff --git a/project starter code/node_modules/asynckit/lib/readable_asynckit.js b/project starter code/node_modules/asynckit/lib/readable_asynckit.js new file mode 100644 index 00000000..78ad240f --- /dev/null +++ b/project starter code/node_modules/asynckit/lib/readable_asynckit.js @@ -0,0 +1,91 @@ +var streamify = require('./streamify.js') + , defer = require('./defer.js') + ; + +// API +module.exports = ReadableAsyncKit; + +/** + * Base constructor for all streams + * used to hold properties/methods + */ +function ReadableAsyncKit() +{ + ReadableAsyncKit.super_.apply(this, arguments); + + // list of active jobs + this.jobs = {}; + + // add stream methods + this.destroy = destroy; + this._start = _start; + this._read = _read; +} + +/** + * Destroys readable stream, + * by aborting outstanding jobs + * + * @returns {void} + */ +function destroy() +{ + if (this.destroyed) + { + return; + } + + this.destroyed = true; + + if (typeof this.terminator == 'function') + { + this.terminator(); + } +} + +/** + * Starts provided jobs in async manner + * + * @private + */ +function _start() +{ + // first argument – runner function + var runner = arguments[0] + // take away first argument + , args = Array.prototype.slice.call(arguments, 1) + // second argument - input data + , input = args[0] + // last argument - result callback + , endCb = streamify.callback.call(this, args[args.length - 1]) + ; + + args[args.length - 1] = endCb; + // third argument - iterator + args[1] = streamify.iterator.call(this, args[1]); + + // allow time for proper setup + defer(function() + { + if (!this.destroyed) + { + this.terminator = runner.apply(null, args); + } + else + { + endCb(null, Array.isArray(input) ? [] : {}); + } + }.bind(this)); +} + + +/** + * Implement _read to comply with Readable streams + * Doesn't really make sense for flowing object mode + * + * @private + */ +function _read() +{ + +} diff --git a/project starter code/node_modules/asynckit/lib/readable_parallel.js b/project starter code/node_modules/asynckit/lib/readable_parallel.js new file mode 100644 index 00000000..5d2929f7 --- /dev/null +++ b/project starter code/node_modules/asynckit/lib/readable_parallel.js @@ -0,0 +1,25 @@ +var parallel = require('../parallel.js'); + +// API +module.exports = ReadableParallel; + +/** + * Streaming wrapper to `asynckit.parallel` + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} callback - invoked when all elements processed + * @returns {stream.Readable#} + */ +function ReadableParallel(list, iterator, callback) +{ + if (!(this instanceof ReadableParallel)) + { + return new ReadableParallel(list, iterator, callback); + } + + // turn on object mode + ReadableParallel.super_.call(this, {objectMode: true}); + + this._start(parallel, list, iterator, callback); +} diff --git a/project starter code/node_modules/asynckit/lib/readable_serial.js b/project starter code/node_modules/asynckit/lib/readable_serial.js new file mode 100644 index 00000000..78226982 --- /dev/null +++ b/project starter code/node_modules/asynckit/lib/readable_serial.js @@ -0,0 +1,25 @@ +var serial = require('../serial.js'); + +// API +module.exports = ReadableSerial; + +/** + * Streaming wrapper to `asynckit.serial` + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} callback - invoked when all elements processed + * @returns {stream.Readable#} + */ +function ReadableSerial(list, iterator, callback) +{ + if (!(this instanceof ReadableSerial)) + { + return new ReadableSerial(list, iterator, callback); + } + + // turn on object mode + ReadableSerial.super_.call(this, {objectMode: true}); + + this._start(serial, list, iterator, callback); +} diff --git a/project starter code/node_modules/asynckit/lib/readable_serial_ordered.js b/project starter code/node_modules/asynckit/lib/readable_serial_ordered.js new file mode 100644 index 00000000..3de89c47 --- /dev/null +++ b/project starter code/node_modules/asynckit/lib/readable_serial_ordered.js @@ -0,0 +1,29 @@ +var serialOrdered = require('../serialOrdered.js'); + +// API +module.exports = ReadableSerialOrdered; +// expose sort helpers +module.exports.ascending = serialOrdered.ascending; +module.exports.descending = serialOrdered.descending; + +/** + * Streaming wrapper to `asynckit.serialOrdered` + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} sortMethod - custom sort function + * @param {function} callback - invoked when all elements processed + * @returns {stream.Readable#} + */ +function ReadableSerialOrdered(list, iterator, sortMethod, callback) +{ + if (!(this instanceof ReadableSerialOrdered)) + { + return new ReadableSerialOrdered(list, iterator, sortMethod, callback); + } + + // turn on object mode + ReadableSerialOrdered.super_.call(this, {objectMode: true}); + + this._start(serialOrdered, list, iterator, sortMethod, callback); +} diff --git a/project starter code/node_modules/asynckit/lib/state.js b/project starter code/node_modules/asynckit/lib/state.js new file mode 100644 index 00000000..cbea7ad8 --- /dev/null +++ b/project starter code/node_modules/asynckit/lib/state.js @@ -0,0 +1,37 @@ +// API +module.exports = state; + +/** + * Creates initial state object + * for iteration over list + * + * @param {array|object} list - list to iterate over + * @param {function|null} sortMethod - function to use for keys sort, + * or `null` to keep them as is + * @returns {object} - initial state object + */ +function state(list, sortMethod) +{ + var isNamedList = !Array.isArray(list) + , initState = + { + index : 0, + keyedList: isNamedList || sortMethod ? Object.keys(list) : null, + jobs : {}, + results : isNamedList ? {} : [], + size : isNamedList ? Object.keys(list).length : list.length + } + ; + + if (sortMethod) + { + // sort array keys based on it's values + // sort object's keys just on own merit + initState.keyedList.sort(isNamedList ? sortMethod : function(a, b) + { + return sortMethod(list[a], list[b]); + }); + } + + return initState; +} diff --git a/project starter code/node_modules/asynckit/lib/streamify.js b/project starter code/node_modules/asynckit/lib/streamify.js new file mode 100644 index 00000000..f56a1c92 --- /dev/null +++ b/project starter code/node_modules/asynckit/lib/streamify.js @@ -0,0 +1,141 @@ +var async = require('./async.js'); + +// API +module.exports = { + iterator: wrapIterator, + callback: wrapCallback +}; + +/** + * Wraps iterators with long signature + * + * @this ReadableAsyncKit# + * @param {function} iterator - function to wrap + * @returns {function} - wrapped function + */ +function wrapIterator(iterator) +{ + var stream = this; + + return function(item, key, cb) + { + var aborter + , wrappedCb = async(wrapIteratorCallback.call(stream, cb, key)) + ; + + stream.jobs[key] = wrappedCb; + + // it's either shortcut (item, cb) + if (iterator.length == 2) + { + aborter = iterator(item, wrappedCb); + } + // or long format (item, key, cb) + else + { + aborter = iterator(item, key, wrappedCb); + } + + return aborter; + }; +} + +/** + * Wraps provided callback function + * allowing to execute snitch function before + * real callback + * + * @this ReadableAsyncKit# + * @param {function} callback - function to wrap + * @returns {function} - wrapped function + */ +function wrapCallback(callback) +{ + var stream = this; + + var wrapped = function(error, result) + { + return finisher.call(stream, error, result, callback); + }; + + return wrapped; +} + +/** + * Wraps provided iterator callback function + * makes sure snitch only called once, + * but passes secondary calls to the original callback + * + * @this ReadableAsyncKit# + * @param {function} callback - callback to wrap + * @param {number|string} key - iteration key + * @returns {function} wrapped callback + */ +function wrapIteratorCallback(callback, key) +{ + var stream = this; + + return function(error, output) + { + // don't repeat yourself + if (!(key in stream.jobs)) + { + callback(error, output); + return; + } + + // clean up jobs + delete stream.jobs[key]; + + return streamer.call(stream, error, {key: key, value: output}, callback); + }; +} + +/** + * Stream wrapper for iterator callback + * + * @this ReadableAsyncKit# + * @param {mixed} error - error response + * @param {mixed} output - iterator output + * @param {function} callback - callback that expects iterator results + */ +function streamer(error, output, callback) +{ + if (error && !this.error) + { + this.error = error; + this.pause(); + this.emit('error', error); + // send back value only, as expected + callback(error, output && output.value); + return; + } + + // stream stuff + this.push(output); + + // back to original track + // send back value only, as expected + callback(error, output && output.value); +} + +/** + * Stream wrapper for finishing callback + * + * @this ReadableAsyncKit# + * @param {mixed} error - error response + * @param {mixed} output - iterator output + * @param {function} callback - callback that expects final results + */ +function finisher(error, output, callback) +{ + // signal end of the stream + // only for successfully finished streams + if (!error) + { + this.push(null); + } + + // back to original track + callback(error, output); +} diff --git a/project starter code/node_modules/asynckit/lib/terminator.js b/project starter code/node_modules/asynckit/lib/terminator.js new file mode 100644 index 00000000..d6eb9921 --- /dev/null +++ b/project starter code/node_modules/asynckit/lib/terminator.js @@ -0,0 +1,29 @@ +var abort = require('./abort.js') + , async = require('./async.js') + ; + +// API +module.exports = terminator; + +/** + * Terminates jobs in the attached state context + * + * @this AsyncKitState# + * @param {function} callback - final callback to invoke after termination + */ +function terminator(callback) +{ + if (!Object.keys(this.jobs).length) + { + return; + } + + // fast forward iteration index + this.index = this.size; + + // abort jobs + abort(this); + + // send back results we have so far + async(callback)(null, this.results); +} diff --git a/project starter code/node_modules/asynckit/package.json b/project starter code/node_modules/asynckit/package.json new file mode 100644 index 00000000..51147d65 --- /dev/null +++ b/project starter code/node_modules/asynckit/package.json @@ -0,0 +1,63 @@ +{ + "name": "asynckit", + "version": "0.4.0", + "description": "Minimal async jobs utility library, with streams support", + "main": "index.js", + "scripts": { + "clean": "rimraf coverage", + "lint": "eslint *.js lib/*.js test/*.js", + "test": "istanbul cover --reporter=json tape -- 'test/test-*.js' | tap-spec", + "win-test": "tape test/test-*.js", + "browser": "browserify -t browserify-istanbul test/lib/browserify_adjustment.js test/test-*.js | obake --coverage | tap-spec", + "report": "istanbul report", + "size": "browserify index.js | size-table asynckit", + "debug": "tape test/test-*.js" + }, + "pre-commit": [ + "clean", + "lint", + "test", + "browser", + "report", + "size" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/alexindigo/asynckit.git" + }, + "keywords": [ + "async", + "jobs", + "parallel", + "serial", + "iterator", + "array", + "object", + "stream", + "destroy", + "terminate", + "abort" + ], + "author": "Alex Indigo ", + "license": "MIT", + "bugs": { + "url": "https://github.com/alexindigo/asynckit/issues" + }, + "homepage": "https://github.com/alexindigo/asynckit#readme", + "devDependencies": { + "browserify": "^13.0.0", + "browserify-istanbul": "^2.0.0", + "coveralls": "^2.11.9", + "eslint": "^2.9.0", + "istanbul": "^0.4.3", + "obake": "^0.1.2", + "phantomjs-prebuilt": "^2.1.7", + "pre-commit": "^1.1.3", + "reamde": "^1.1.0", + "rimraf": "^2.5.2", + "size-table": "^0.2.0", + "tap-spec": "^4.1.1", + "tape": "^4.5.1" + }, + "dependencies": {} +} diff --git a/project starter code/node_modules/asynckit/parallel.js b/project starter code/node_modules/asynckit/parallel.js new file mode 100644 index 00000000..3c50344d --- /dev/null +++ b/project starter code/node_modules/asynckit/parallel.js @@ -0,0 +1,43 @@ +var iterate = require('./lib/iterate.js') + , initState = require('./lib/state.js') + , terminator = require('./lib/terminator.js') + ; + +// Public API +module.exports = parallel; + +/** + * Runs iterator over provided array elements in parallel + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator + */ +function parallel(list, iterator, callback) +{ + var state = initState(list); + + while (state.index < (state['keyedList'] || list).length) + { + iterate(list, iterator, state, function(error, result) + { + if (error) + { + callback(error, result); + return; + } + + // looks like it's the last one + if (Object.keys(state.jobs).length === 0) + { + callback(null, state.results); + return; + } + }); + + state.index++; + } + + return terminator.bind(state, callback); +} diff --git a/project starter code/node_modules/asynckit/serial.js b/project starter code/node_modules/asynckit/serial.js new file mode 100644 index 00000000..6cd949a6 --- /dev/null +++ b/project starter code/node_modules/asynckit/serial.js @@ -0,0 +1,17 @@ +var serialOrdered = require('./serialOrdered.js'); + +// Public API +module.exports = serial; + +/** + * Runs iterator over provided array elements in series + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator + */ +function serial(list, iterator, callback) +{ + return serialOrdered(list, iterator, null, callback); +} diff --git a/project starter code/node_modules/asynckit/serialOrdered.js b/project starter code/node_modules/asynckit/serialOrdered.js new file mode 100644 index 00000000..607eafea --- /dev/null +++ b/project starter code/node_modules/asynckit/serialOrdered.js @@ -0,0 +1,75 @@ +var iterate = require('./lib/iterate.js') + , initState = require('./lib/state.js') + , terminator = require('./lib/terminator.js') + ; + +// Public API +module.exports = serialOrdered; +// sorting helpers +module.exports.ascending = ascending; +module.exports.descending = descending; + +/** + * Runs iterator over provided sorted array elements in series + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} sortMethod - custom sort function + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator + */ +function serialOrdered(list, iterator, sortMethod, callback) +{ + var state = initState(list, sortMethod); + + iterate(list, iterator, state, function iteratorHandler(error, result) + { + if (error) + { + callback(error, result); + return; + } + + state.index++; + + // are we there yet? + if (state.index < (state['keyedList'] || list).length) + { + iterate(list, iterator, state, iteratorHandler); + return; + } + + // done here + callback(null, state.results); + }); + + return terminator.bind(state, callback); +} + +/* + * -- Sort methods + */ + +/** + * sort helper to sort array elements in ascending order + * + * @param {mixed} a - an item to compare + * @param {mixed} b - an item to compare + * @returns {number} - comparison result + */ +function ascending(a, b) +{ + return a < b ? -1 : a > b ? 1 : 0; +} + +/** + * sort helper to sort array elements in descending order + * + * @param {mixed} a - an item to compare + * @param {mixed} b - an item to compare + * @returns {number} - comparison result + */ +function descending(a, b) +{ + return -1 * ascending(a, b); +} diff --git a/project starter code/node_modules/asynckit/stream.js b/project starter code/node_modules/asynckit/stream.js new file mode 100644 index 00000000..d43465f9 --- /dev/null +++ b/project starter code/node_modules/asynckit/stream.js @@ -0,0 +1,21 @@ +var inherits = require('util').inherits + , Readable = require('stream').Readable + , ReadableAsyncKit = require('./lib/readable_asynckit.js') + , ReadableParallel = require('./lib/readable_parallel.js') + , ReadableSerial = require('./lib/readable_serial.js') + , ReadableSerialOrdered = require('./lib/readable_serial_ordered.js') + ; + +// API +module.exports = +{ + parallel : ReadableParallel, + serial : ReadableSerial, + serialOrdered : ReadableSerialOrdered, +}; + +inherits(ReadableAsyncKit, Readable); + +inherits(ReadableParallel, ReadableAsyncKit); +inherits(ReadableSerial, ReadableAsyncKit); +inherits(ReadableSerialOrdered, ReadableAsyncKit); diff --git a/project starter code/node_modules/axios/CHANGELOG.md b/project starter code/node_modules/axios/CHANGELOG.md new file mode 100644 index 00000000..c9db85b5 --- /dev/null +++ b/project starter code/node_modules/axios/CHANGELOG.md @@ -0,0 +1,952 @@ +# Changelog + +## [1.7.2](https://github.com/axios/axios/compare/v1.7.1...v1.7.2) (2024-05-21) + + +### Bug Fixes + +* **fetch:** enhance fetch API detection; ([#6413](https://github.com/axios/axios/issues/6413)) ([4f79aef](https://github.com/axios/axios/commit/4f79aef81b7c4644328365bfc33acf0a9ef595bc)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+3/-3 (#6413 )") + +## [1.7.1](https://github.com/axios/axios/compare/v1.7.0...v1.7.1) (2024-05-20) + + +### Bug Fixes + +* **fetch:** fixed ReferenceError issue when TextEncoder is not available in the environment; ([#6410](https://github.com/axios/axios/issues/6410)) ([733f15f](https://github.com/axios/axios/commit/733f15fe5bd2d67e1fadaee82e7913b70d45dc5e)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+14/-9 (#6410 )") + +# [1.7.0](https://github.com/axios/axios/compare/v1.7.0-beta.2...v1.7.0) (2024-05-19) + + +### Features + +* **adapter:** add fetch adapter; ([#6371](https://github.com/axios/axios/issues/6371)) ([a3ff99b](https://github.com/axios/axios/commit/a3ff99b59d8ec2ab5dd049e68c043617a4072e42)) + +### Bug Fixes + +* **core/axios:** handle un-writable error stack ([#6362](https://github.com/axios/axios/issues/6362)) ([81e0455](https://github.com/axios/axios/commit/81e0455b7b57fbaf2be16a73ebe0e6591cc6d8f9)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+1015/-127 (#6371 )") +- avatar [Jay](https://github.com/jasonsaayman "+30/-14 ()") +- avatar [Alexandre ABRIOUX](https://github.com/alexandre-abrioux "+56/-6 (#6362 )") + +# [1.7.0-beta.2](https://github.com/axios/axios/compare/v1.7.0-beta.1...v1.7.0-beta.2) (2024-05-19) + + +### Bug Fixes + +* **fetch:** capitalize HTTP method names; ([#6395](https://github.com/axios/axios/issues/6395)) ([ad3174a](https://github.com/axios/axios/commit/ad3174a3515c3c2573f4bcb94818d582826f3914)) +* **fetch:** fix & optimize progress capturing for cases when the request data has a nullish value or zero data length ([#6400](https://github.com/axios/axios/issues/6400)) ([95a3e8e](https://github.com/axios/axios/commit/95a3e8e346cfd6a5548e171f2341df3235d0e26b)) +* **fetch:** fix headers getting from a stream response; ([#6401](https://github.com/axios/axios/issues/6401)) ([870e0a7](https://github.com/axios/axios/commit/870e0a76f60d0094774a6a63fa606eec52a381af)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+99/-46 (#6405 #6404 #6401 #6400 #6395 )") + +# [1.7.0-beta.1](https://github.com/axios/axios/compare/v1.7.0-beta.0...v1.7.0-beta.1) (2024-05-07) + + +### Bug Fixes + +* **core/axios:** handle un-writable error stack ([#6362](https://github.com/axios/axios/issues/6362)) ([81e0455](https://github.com/axios/axios/commit/81e0455b7b57fbaf2be16a73ebe0e6591cc6d8f9)) +* **fetch:** fix cases when ReadableStream or Response.body are not available; ([#6377](https://github.com/axios/axios/issues/6377)) ([d1d359d](https://github.com/axios/axios/commit/d1d359da347704e8b28d768e61515a3e96c5b072)) +* **fetch:** treat fetch-related TypeError as an AxiosError.ERR_NETWORK error; ([#6380](https://github.com/axios/axios/issues/6380)) ([bb5f9a5](https://github.com/axios/axios/commit/bb5f9a5ab768452de9e166dc28d0ffc234245ef1)) + +### Contributors to this release + +- avatar [Alexandre ABRIOUX](https://github.com/alexandre-abrioux "+56/-6 (#6362 )") +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+42/-17 (#6380 #6377 )") + +# [1.7.0-beta.0](https://github.com/axios/axios/compare/v1.6.8...v1.7.0-beta.0) (2024-04-28) + + +### Features + +* **adapter:** add fetch adapter; ([#6371](https://github.com/axios/axios/issues/6371)) ([a3ff99b](https://github.com/axios/axios/commit/a3ff99b59d8ec2ab5dd049e68c043617a4072e42)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+1015/-127 (#6371 )") +- avatar [Jay](https://github.com/jasonsaayman "+30/-14 ()") + +## [1.6.8](https://github.com/axios/axios/compare/v1.6.7...v1.6.8) (2024-03-15) + + +### Bug Fixes + +* **AxiosHeaders:** fix AxiosHeaders conversion to an object during config merging ([#6243](https://github.com/axios/axios/issues/6243)) ([2656612](https://github.com/axios/axios/commit/2656612bc10fe2757e9832b708ed773ab340b5cb)) +* **import:** use named export for EventEmitter; ([7320430](https://github.com/axios/axios/commit/7320430aef2e1ba2b89488a0eaf42681165498b1)) +* **vulnerability:** update follow-redirects to 1.15.6 ([#6300](https://github.com/axios/axios/issues/6300)) ([8786e0f](https://github.com/axios/axios/commit/8786e0ff55a8c68d4ca989801ad26df924042e27)) + +### Contributors to this release + +- avatar [Jay](https://github.com/jasonsaayman "+4572/-3446 (#6238 )") +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+30/-0 (#6231 )") +- avatar [Mitchell](https://github.com/Creaous "+9/-9 (#6300 )") +- avatar [Emmanuel](https://github.com/mannoeu "+2/-2 (#6196 )") +- avatar [Lucas Keller](https://github.com/ljkeller "+3/-0 (#6194 )") +- avatar [Aditya Mogili](https://github.com/ADITYA-176 "+1/-1 ()") +- avatar [Miroslav Petrov](https://github.com/petrovmiroslav "+1/-1 (#6243 )") + +## [1.6.7](https://github.com/axios/axios/compare/v1.6.6...v1.6.7) (2024-01-25) + + +### Bug Fixes + +* capture async stack only for rejections with native error objects; ([#6203](https://github.com/axios/axios/issues/6203)) ([1a08f90](https://github.com/axios/axios/commit/1a08f90f402336e4d00e9ee82f211c6adb1640b0)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+30/-26 (#6203 )") +- avatar [zhoulixiang](https://github.com/zh-lx "+0/-3 (#6186 )") + +## [1.6.6](https://github.com/axios/axios/compare/v1.6.5...v1.6.6) (2024-01-24) + + +### Bug Fixes + +* fixed missed dispatchBeforeRedirect argument ([#5778](https://github.com/axios/axios/issues/5778)) ([a1938ff](https://github.com/axios/axios/commit/a1938ff073fcb0f89011f001dfbc1fa1dc995e39)) +* wrap errors to improve async stack trace ([#5987](https://github.com/axios/axios/issues/5987)) ([123f354](https://github.com/axios/axios/commit/123f354b920f154a209ea99f76b7b2ef3d9ebbab)) + +### Contributors to this release + +- avatar [Ilya Priven](https://github.com/ikonst "+91/-8 (#5987 )") +- avatar [Zao Soula](https://github.com/zaosoula "+6/-6 (#5778 )") + +## [1.6.5](https://github.com/axios/axios/compare/v1.6.4...v1.6.5) (2024-01-05) + + +### Bug Fixes + +* **ci:** refactor notify action as a job of publish action; ([#6176](https://github.com/axios/axios/issues/6176)) ([0736f95](https://github.com/axios/axios/commit/0736f95ce8776366dc9ca569f49ba505feb6373c)) +* **dns:** fixed lookup error handling; ([#6175](https://github.com/axios/axios/issues/6175)) ([f4f2b03](https://github.com/axios/axios/commit/f4f2b039dd38eb4829e8583caede4ed6d2dd59be)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+41/-6 (#6176 #6175 )") +- avatar [Jay](https://github.com/jasonsaayman "+6/-1 ()") + +## [1.6.4](https://github.com/axios/axios/compare/v1.6.3...v1.6.4) (2024-01-03) + + +### Bug Fixes + +* **security:** fixed formToJSON prototype pollution vulnerability; ([#6167](https://github.com/axios/axios/issues/6167)) ([3c0c11c](https://github.com/axios/axios/commit/3c0c11cade045c4412c242b5727308cff9897a0e)) +* **security:** fixed security vulnerability in follow-redirects ([#6163](https://github.com/axios/axios/issues/6163)) ([75af1cd](https://github.com/axios/axios/commit/75af1cdff5b3a6ca3766d3d3afbc3115bb0811b8)) + +### Contributors to this release + +- avatar [Jay](https://github.com/jasonsaayman "+34/-6 ()") +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+34/-3 (#6172 #6167 )") +- avatar [Guy Nesher](https://github.com/gnesher "+10/-10 (#6163 )") + +## [1.6.3](https://github.com/axios/axios/compare/v1.6.2...v1.6.3) (2023-12-26) + + +### Bug Fixes + +* Regular Expression Denial of Service (ReDoS) ([#6132](https://github.com/axios/axios/issues/6132)) ([5e7ad38](https://github.com/axios/axios/commit/5e7ad38fb0f819fceb19fb2ee5d5d38f56aa837d)) + +### Contributors to this release + +- avatar [Jay](https://github.com/jasonsaayman "+15/-6 (#6145 )") +- avatar [Willian Agostini](https://github.com/WillianAgostini "+17/-2 (#6132 )") +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+3/-0 (#6084 )") + +## [1.6.2](https://github.com/axios/axios/compare/v1.6.1...v1.6.2) (2023-11-14) + + +### Features + +* **withXSRFToken:** added withXSRFToken option as a workaround to achieve the old `withCredentials` behavior; ([#6046](https://github.com/axios/axios/issues/6046)) ([cff9967](https://github.com/axios/axios/commit/cff996779b272a5e94c2b52f5503ccf668bc42dc)) + +### PRs +- feat(withXSRFToken): added withXSRFToken option as a workaround to achieve the old `withCredentials` behavior; ( [#6046](https://api.github.com/repos/axios/axios/pulls/6046) ) +``` + +📢 This PR added 'withXSRFToken' option as a replacement for old withCredentials behaviour. +You should now use withXSRFToken along with withCredential to get the old behavior. +This functionality is considered as a fix. +``` + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+271/-146 (#6081 #6080 #6079 #6078 #6046 #6064 #6063 )") +- avatar [Ng Choon Khon (CK)](https://github.com/ckng0221 "+4/-4 (#6073 )") +- avatar [Muhammad Noman](https://github.com/mnomanmemon "+2/-2 (#6048 )") + +## [1.6.1](https://github.com/axios/axios/compare/v1.6.0...v1.6.1) (2023-11-08) + + +### Bug Fixes + +* **formdata:** fixed content-type header normalization for non-standard browser environments; ([#6056](https://github.com/axios/axios/issues/6056)) ([dd465ab](https://github.com/axios/axios/commit/dd465ab22bbfa262c6567be6574bf46a057d5288)) +* **platform:** fixed emulated browser detection in node.js environment; ([#6055](https://github.com/axios/axios/issues/6055)) ([3dc8369](https://github.com/axios/axios/commit/3dc8369e505e32a4e12c22f154c55fd63ac67fbb)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+432/-65 (#6059 #6056 #6055 )") +- avatar [Fabian Meyer](https://github.com/meyfa "+5/-2 (#5835 )") + +### PRs +- feat(withXSRFToken): added withXSRFToken option as a workaround to achieve the old `withCredentials` behavior; ( [#6046](https://api.github.com/repos/axios/axios/pulls/6046) ) +``` + +📢 This PR added 'withXSRFToken' option as a replacement for old withCredentials behaviour. +You should now use withXSRFToken along with withCredential to get the old behavior. +This functionality is considered as a fix. +``` + +# [1.6.0](https://github.com/axios/axios/compare/v1.5.1...v1.6.0) (2023-10-26) + + +### Bug Fixes + +* **CSRF:** fixed CSRF vulnerability CVE-2023-45857 ([#6028](https://github.com/axios/axios/issues/6028)) ([96ee232](https://github.com/axios/axios/commit/96ee232bd3ee4de2e657333d4d2191cd389e14d0)) +* **dns:** fixed lookup function decorator to work properly in node v20; ([#6011](https://github.com/axios/axios/issues/6011)) ([5aaff53](https://github.com/axios/axios/commit/5aaff532a6b820bb9ab6a8cd0f77131b47e2adb8)) +* **types:** fix AxiosHeaders types; ([#5931](https://github.com/axios/axios/issues/5931)) ([a1c8ad0](https://github.com/axios/axios/commit/a1c8ad008b3c13d53e135bbd0862587fb9d3fc09)) + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+449/-114 (#6032 #6021 #6011 #5932 #5931 )") +- avatar [Valentin Panov](https://github.com/valentin-panov "+4/-4 (#6028 )") +- avatar [Rinku Chaudhari](https://github.com/therealrinku "+1/-1 (#5889 )") + +## [1.5.1](https://github.com/axios/axios/compare/v1.5.0...v1.5.1) (2023-09-26) + + +### Bug Fixes + +* **adapters:** improved adapters loading logic to have clear error messages; ([#5919](https://github.com/axios/axios/issues/5919)) ([e410779](https://github.com/axios/axios/commit/e4107797a7a1376f6209fbecfbbce73d3faa7859)) +* **formdata:** fixed automatic addition of the `Content-Type` header for FormData in non-browser environments; ([#5917](https://github.com/axios/axios/issues/5917)) ([bc9af51](https://github.com/axios/axios/commit/bc9af51b1886d1b3529617702f2a21a6c0ed5d92)) +* **headers:** allow `content-encoding` header to handle case-insensitive values ([#5890](https://github.com/axios/axios/issues/5890)) ([#5892](https://github.com/axios/axios/issues/5892)) ([4c89f25](https://github.com/axios/axios/commit/4c89f25196525e90a6e75eda9cb31ae0a2e18acd)) +* **types:** removed duplicated code ([9e62056](https://github.com/axios/axios/commit/9e6205630e1c9cf863adf141c0edb9e6d8d4b149)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+89/-18 (#5919 #5917 )") +- avatar [David Dallas](https://github.com/DavidJDallas "+11/-5 ()") +- avatar [Sean Sattler](https://github.com/fb-sean "+2/-8 ()") +- avatar [Mustafa Ateş Uzun](https://github.com/0o001 "+4/-4 ()") +- avatar [Przemyslaw Motacki](https://github.com/sfc-gh-pmotacki "+2/-1 (#5892 )") +- avatar [Michael Di Prisco](https://github.com/Cadienvan "+1/-1 ()") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +# [1.5.0](https://github.com/axios/axios/compare/v1.4.0...v1.5.0) (2023-08-26) + + +### Bug Fixes + +* **adapter:** make adapter loading error more clear by using platform-specific adapters explicitly ([#5837](https://github.com/axios/axios/issues/5837)) ([9a414bb](https://github.com/axios/axios/commit/9a414bb6c81796a95c6c7fe668637825458e8b6d)) +* **dns:** fixed `cacheable-lookup` integration; ([#5836](https://github.com/axios/axios/issues/5836)) ([b3e327d](https://github.com/axios/axios/commit/b3e327dcc9277bdce34c7ef57beedf644b00d628)) +* **headers:** added support for setting header names that overlap with class methods; ([#5831](https://github.com/axios/axios/issues/5831)) ([d8b4ca0](https://github.com/axios/axios/commit/d8b4ca0ea5f2f05efa4edfe1e7684593f9f68273)) +* **headers:** fixed common Content-Type header merging; ([#5832](https://github.com/axios/axios/issues/5832)) ([8fda276](https://github.com/axios/axios/commit/8fda2766b1e6bcb72c3fabc146223083ef13ce17)) + + +### Features + +* export getAdapter function ([#5324](https://github.com/axios/axios/issues/5324)) ([ca73eb8](https://github.com/axios/axios/commit/ca73eb878df0ae2dace81fe3a7f1fb5986231bf1)) +* **export:** export adapters without `unsafe` prefix ([#5839](https://github.com/axios/axios/issues/5839)) ([1601f4a](https://github.com/axios/axios/commit/1601f4a27a81ab47fea228f1e244b2c4e3ce28bf)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+66/-29 (#5839 #5837 #5836 #5832 #5831 )") +- avatar [夜葬](https://github.com/geekact "+42/-0 (#5324 )") +- avatar [Jonathan Budiman](https://github.com/JBudiman00 "+30/-0 (#5788 )") +- avatar [Michael Di Prisco](https://github.com/Cadienvan "+3/-5 (#5791 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +# [1.4.0](https://github.com/axios/axios/compare/v1.3.6...v1.4.0) (2023-04-27) + + +### Bug Fixes + +* **formdata:** add `multipart/form-data` content type for FormData payload on custom client environments; ([#5678](https://github.com/axios/axios/issues/5678)) ([bbb61e7](https://github.com/axios/axios/commit/bbb61e70cb1185adfb1cbbb86eaf6652c48d89d1)) +* **package:** export package internals with unsafe path prefix; ([#5677](https://github.com/axios/axios/issues/5677)) ([df38c94](https://github.com/axios/axios/commit/df38c949f26414d88ba29ec1e353c4d4f97eaf09)) + + +### Features + +* **dns:** added support for a custom lookup function; ([#5339](https://github.com/axios/axios/issues/5339)) ([2701911](https://github.com/axios/axios/commit/2701911260a1faa5cc5e1afe437121b330a3b7bb)) +* **types:** export `AxiosHeaderValue` type. ([#5525](https://github.com/axios/axios/issues/5525)) ([726f1c8](https://github.com/axios/axios/commit/726f1c8e00cffa0461a8813a9bdcb8f8b9d762cf)) + + +### Performance Improvements + +* **merge-config:** optimize mergeConfig performance by avoiding duplicate key visits; ([#5679](https://github.com/axios/axios/issues/5679)) ([e6f7053](https://github.com/axios/axios/commit/e6f7053bf1a3e87cf1f9da8677e12e3fe829d68e)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+151/-16 (#5684 #5339 #5679 #5678 #5677 )") +- avatar [Arthur Fiorette](https://github.com/arthurfiorette "+19/-19 (#5525 )") +- avatar [PIYUSH NEGI](https://github.com/npiyush97 "+2/-18 (#5670 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.3.6](https://github.com/axios/axios/compare/v1.3.5...v1.3.6) (2023-04-19) + + +### Bug Fixes + +* **types:** added transport to RawAxiosRequestConfig ([#5445](https://github.com/axios/axios/issues/5445)) ([6f360a2](https://github.com/axios/axios/commit/6f360a2531d8d70363fd9becef6a45a323f170e2)) +* **utils:** make isFormData detection logic stricter to avoid unnecessary calling of the `toString` method on the target; ([#5661](https://github.com/axios/axios/issues/5661)) ([aa372f7](https://github.com/axios/axios/commit/aa372f7306295dfd1100c1c2c77ce95c95808e76)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+48/-10 (#5665 #5661 #5663 )") +- avatar [Michael Di Prisco](https://github.com/Cadienvan "+2/-0 (#5445 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.3.5](https://github.com/axios/axios/compare/v1.3.4...v1.3.5) (2023-04-05) + + +### Bug Fixes + +* **headers:** fixed isValidHeaderName to support full list of allowed characters; ([#5584](https://github.com/axios/axios/issues/5584)) ([e7decef](https://github.com/axios/axios/commit/e7decef6a99f4627e27ed9ea5b00ce8e201c3841)) +* **params:** re-added the ability to set the function as `paramsSerializer` config; ([#5633](https://github.com/axios/axios/issues/5633)) ([a56c866](https://github.com/axios/axios/commit/a56c8661209d5ce5a645a05f294a0e08a6c1f6b3)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+28/-10 (#5633 #5584 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.3.4](https://github.com/axios/axios/compare/v1.3.3...v1.3.4) (2023-02-22) + + +### Bug Fixes + +* **blob:** added a check to make sure the Blob class is available in the browser's global scope; ([#5548](https://github.com/axios/axios/issues/5548)) ([3772c8f](https://github.com/axios/axios/commit/3772c8fe74112a56e3e9551f894d899bc3a9443a)) +* **http:** fixed regression bug when handling synchronous errors inside the adapter; ([#5564](https://github.com/axios/axios/issues/5564)) ([a3b246c](https://github.com/axios/axios/commit/a3b246c9de5c3bc4b5a742e15add55b375479451)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+38/-26 (#5564 )") +- avatar [lcysgsg](https://github.com/lcysgsg "+4/-0 (#5548 )") +- avatar [Michael Di Prisco](https://github.com/Cadienvan "+3/-0 (#5444 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.3.3](https://github.com/axios/axios/compare/v1.3.2...v1.3.3) (2023-02-13) + + +### Bug Fixes + +* **formdata:** added a check to make sure the FormData class is available in the browser's global scope; ([#5545](https://github.com/axios/axios/issues/5545)) ([a6dfa72](https://github.com/axios/axios/commit/a6dfa72010db5ad52db8bd13c0f98e537e8fd05d)) +* **formdata:** fixed setting NaN as Content-Length for form payload in some cases; ([#5535](https://github.com/axios/axios/issues/5535)) ([c19f7bf](https://github.com/axios/axios/commit/c19f7bf770f90ae8307f4ea3104f227056912da1)) +* **headers:** fixed the filtering logic of the clear method; ([#5542](https://github.com/axios/axios/issues/5542)) ([ea87ebf](https://github.com/axios/axios/commit/ea87ebfe6d1699af072b9e7cd40faf8f14b0ab93)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+11/-7 (#5545 #5535 #5542 )") +- avatar [陈若枫](https://github.com/ruofee "+2/-2 (#5467 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.3.2](https://github.com/axios/axios/compare/v1.3.1...v1.3.2) (2023-02-03) + + +### Bug Fixes + +* **http:** treat http://localhost as base URL for relative paths to avoid `ERR_INVALID_URL` error; ([#5528](https://github.com/axios/axios/issues/5528)) ([128d56f](https://github.com/axios/axios/commit/128d56f4a0fb8f5f2ed6e0dd80bc9225fee9538c)) +* **http:** use explicit import instead of TextEncoder global; ([#5530](https://github.com/axios/axios/issues/5530)) ([6b3c305](https://github.com/axios/axios/commit/6b3c305fc40c56428e0afabedc6f4d29c2830f6f)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+2/-1 (#5530 #5528 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.3.1](https://github.com/axios/axios/compare/v1.3.0...v1.3.1) (2023-02-01) + + +### Bug Fixes + +* **formdata:** add hotfix to use the asynchronous API to compute the content-length header value; ([#5521](https://github.com/axios/axios/issues/5521)) ([96d336f](https://github.com/axios/axios/commit/96d336f527619f21da012fe1f117eeb53e5a2120)) +* **serializer:** fixed serialization of array-like objects; ([#5518](https://github.com/axios/axios/issues/5518)) ([08104c0](https://github.com/axios/axios/commit/08104c028c0f9353897b1b6691d74c440fd0c32d)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+27/-8 (#5521 #5518 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +# [1.3.0](https://github.com/axios/axios/compare/v1.2.6...v1.3.0) (2023-01-31) + + +### Bug Fixes + +* **headers:** fixed & optimized clear method; ([#5507](https://github.com/axios/axios/issues/5507)) ([9915635](https://github.com/axios/axios/commit/9915635c69d0ab70daca5738488421f67ca60959)) +* **http:** add zlib headers if missing ([#5497](https://github.com/axios/axios/issues/5497)) ([65e8d1e](https://github.com/axios/axios/commit/65e8d1e28ce829f47a837e45129730e541950d3c)) + + +### Features + +* **fomdata:** added support for spec-compliant FormData & Blob types; ([#5316](https://github.com/axios/axios/issues/5316)) ([6ac574e](https://github.com/axios/axios/commit/6ac574e00a06731288347acea1e8246091196953)) + +### Contributors to this release + +- avatar [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+352/-67 (#5514 #5512 #5510 #5509 #5508 #5316 #5507 )") +- avatar [ItsNotGoodName](https://github.com/ItsNotGoodName "+43/-2 (#5497 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.2.6](https://github.com/axios/axios/compare/v1.2.5...v1.2.6) (2023-01-28) + + +### Bug Fixes + +* **headers:** added missed Authorization accessor; ([#5502](https://github.com/axios/axios/issues/5502)) ([342c0ba](https://github.com/axios/axios/commit/342c0ba9a16ea50f5ed7d2366c5c1a2c877e3f26)) +* **types:** fixed `CommonRequestHeadersList` & `CommonResponseHeadersList` types to be private in commonJS; ([#5503](https://github.com/axios/axios/issues/5503)) ([5a3d0a3](https://github.com/axios/axios/commit/5a3d0a3234d77361a1bc7cedee2da1e11df08e2c)) + +### Contributors to this release + +- ![avatar](https://avatars.githubusercontent.com/u/12586868?v=4&s=16) [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+24/-9 (#5503 #5502 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.2.5](https://github.com/axios/axios/compare/v1.2.4...v1.2.5) (2023-01-26) + + +### Bug Fixes + +* **types:** fixed AxiosHeaders to handle spread syntax by making all methods non-enumerable; ([#5499](https://github.com/axios/axios/issues/5499)) ([580f1e8](https://github.com/axios/axios/commit/580f1e8033a61baa38149d59fd16019de3932c22)) + +### Contributors to this release + +- ![avatar](https://avatars.githubusercontent.com/u/12586868?v=4&s=16) [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+82/-54 (#5499 )") +- ![avatar](https://avatars.githubusercontent.com/u/20516159?v=4&s=16) [Elliot Ford](https://github.com/EFord36 "+1/-1 (#5462 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.2.4](https://github.com/axios/axios/compare/v1.2.3...v1.2.4) (2023-01-22) + + +### Bug Fixes + +* **types:** renamed `RawAxiosRequestConfig` back to `AxiosRequestConfig`; ([#5486](https://github.com/axios/axios/issues/5486)) ([2a71f49](https://github.com/axios/axios/commit/2a71f49bc6c68495fa419003a3107ed8bd703ad0)) +* **types:** fix `AxiosRequestConfig` generic; ([#5478](https://github.com/axios/axios/issues/5478)) ([9bce81b](https://github.com/axios/axios/commit/186ea062da8b7d578ae78b1a5c220986b9bce81b)) + +### Contributors to this release + +- ![avatar](https://avatars.githubusercontent.com/u/12586868?v=4&s=16) [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+242/-108 (#5486 #5482 )") +- ![avatar](https://avatars.githubusercontent.com/u/9430821?v=4&s=16) [Daniel Hillmann](https://github.com/hilleer "+1/-1 (#5478 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.2.3](https://github.com/axios/axios/compare/1.2.2...1.2.3) (2023-01-10) + + +### Bug Fixes + +* **types:** fixed AxiosRequestConfig header interface by refactoring it to RawAxiosRequestConfig; ([#5420](https://github.com/axios/axios/issues/5420)) ([0811963](https://github.com/axios/axios/commit/08119634a22f1d5b19f5c9ea0adccb6d3eebc3bc)) + +### Contributors to this release + +- ![avatar](https://avatars.githubusercontent.com/u/12586868?v=4&s=16) [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS "+938/-442 (#5456 #5455 #5453 #5451 #5449 #5447 #5446 #5443 #5442 #5439 #5420 )") + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.2.2] - 2022-12-29 + +### Fixed +- fix(ci): fix release script inputs [#5392](https://github.com/axios/axios/pull/5392) +- fix(ci): prerelease scipts [#5377](https://github.com/axios/axios/pull/5377) +- fix(ci): release scripts [#5376](https://github.com/axios/axios/pull/5376) +- fix(ci): typescript tests [#5375](https://github.com/axios/axios/pull/5375) +- fix: Brotli decompression [#5353](https://github.com/axios/axios/pull/5353) +- fix: add missing HttpStatusCode [#5345](https://github.com/axios/axios/pull/5345) + +### Chores +- chore(ci): set conventional-changelog header config [#5406](https://github.com/axios/axios/pull/5406) +- chore(ci): fix automatic contributors resolving [#5403](https://github.com/axios/axios/pull/5403) +- chore(ci): improved logging for the contributors list generator [#5398](https://github.com/axios/axios/pull/5398) +- chore(ci): fix release action [#5397](https://github.com/axios/axios/pull/5397) +- chore(ci): fix version bump script by adding bump argument for target version [#5393](https://github.com/axios/axios/pull/5393) +- chore(deps): bump decode-uri-component from 0.2.0 to 0.2.2 [#5342](https://github.com/axios/axios/pull/5342) +- chore(ci): GitHub Actions Release script [#5384](https://github.com/axios/axios/pull/5384) +- chore(ci): release scripts [#5364](https://github.com/axios/axios/pull/5364) + +### Contributors to this release +- ![avatar](https://avatars.githubusercontent.com/u/12586868?v=4&s=16) [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS) +- ![avatar](https://avatars.githubusercontent.com/u/1652293?v=4&s=16) [Winnie](https://github.com/winniehell) + +## [1.2.1] - 2022-12-05 + +### Changed +- feat(exports): export mergeConfig [#5151](https://github.com/axios/axios/pull/5151) + +### Fixed +- fix(CancelledError): include config [#4922](https://github.com/axios/axios/pull/4922) +- fix(general): removing multiple/trailing/leading whitespace [#5022](https://github.com/axios/axios/pull/5022) +- fix(headers): decompression for responses without Content-Length header [#5306](https://github.com/axios/axios/pull/5306) +- fix(webWorker): exception to sending form data in web worker [#5139](https://github.com/axios/axios/pull/5139) + +### Refactors +- refactor(types): AxiosProgressEvent.event type to any [#5308](https://github.com/axios/axios/pull/5308) +- refactor(types): add missing types for static AxiosError.from method [#4956](https://github.com/axios/axios/pull/4956) + +### Chores +- chore(docs): remove README link to non-existent upgrade guide [#5307](https://github.com/axios/axios/pull/5307) +- chore(docs): typo in issue template name [#5159](https://github.com/axios/axios/pull/5159) + +### Contributors to this release + +- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS) +- [Zachary Lysobey](https://github.com/zachlysobey) +- [Kevin Ennis](https://github.com/kevincennis) +- [Philipp Loose](https://github.com/phloose) +- [secondl1ght](https://github.com/secondl1ght) +- [wenzheng](https://github.com/0x30) +- [Ivan Barsukov](https://github.com/ovarn) +- [Arthur Fiorette](https://github.com/arthurfiorette) + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.2.0] - 2022-11-10 + +### Changed + +- changed: refactored module exports [#5162](https://github.com/axios/axios/pull/5162) +- change: re-added support for loading Axios with require('axios').default [#5225](https://github.com/axios/axios/pull/5225) + +### Fixed + +- fix: improve AxiosHeaders class [#5224](https://github.com/axios/axios/pull/5224) +- fix: TypeScript type definitions for commonjs [#5196](https://github.com/axios/axios/pull/5196) +- fix: type definition of use method on AxiosInterceptorManager to match the the README [#5071](https://github.com/axios/axios/pull/5071) +- fix: __dirname is not defined in the sandbox [#5269](https://github.com/axios/axios/pull/5269) +- fix: AxiosError.toJSON method to avoid circular references [#5247](https://github.com/axios/axios/pull/5247) +- fix: Z_BUF_ERROR when content-encoding is set but the response body is empty [#5250](https://github.com/axios/axios/pull/5250) + +### Refactors +- refactor: allowing adapters to be loaded by name [#5277](https://github.com/axios/axios/pull/5277) + +### Chores + +- chore: force CI restart [#5243](https://github.com/axios/axios/pull/5243) +- chore: update ECOSYSTEM.md [#5077](https://github.com/axios/axios/pull/5077) +- chore: update get/index.html [#5116](https://github.com/axios/axios/pull/5116) +- chore: update Sandbox UI/UX [#5205](https://github.com/axios/axios/pull/5205) +- chore:(actions): remove git credentials after checkout [#5235](https://github.com/axios/axios/pull/5235) +- chore(actions): bump actions/dependency-review-action from 2 to 3 [#5266](https://github.com/axios/axios/pull/5266) +- chore(packages): bump loader-utils from 1.4.1 to 1.4.2 [#5295](https://github.com/axios/axios/pull/5295) +- chore(packages): bump engine.io from 6.2.0 to 6.2.1 [#5294](https://github.com/axios/axios/pull/5294) +- chore(packages): bump socket.io-parser from 4.0.4 to 4.0.5 [#5241](https://github.com/axios/axios/pull/5241) +- chore(packages): bump loader-utils from 1.4.0 to 1.4.1 [#5245](https://github.com/axios/axios/pull/5245) +- chore(docs): update Resources links in README [#5119](https://github.com/axios/axios/pull/5119) +- chore(docs): update the link for JSON url [#5265](https://github.com/axios/axios/pull/5265) +- chore(docs): fix broken links [#5218](https://github.com/axios/axios/pull/5218) +- chore(docs): update and rename UPGRADE_GUIDE.md to MIGRATION_GUIDE.md [#5170](https://github.com/axios/axios/pull/5170) +- chore(docs): typo fix line #856 and #920 [#5194](https://github.com/axios/axios/pull/5194) +- chore(docs): typo fix #800 [#5193](https://github.com/axios/axios/pull/5193) +- chore(docs): fix typos [#5184](https://github.com/axios/axios/pull/5184) +- chore(docs): fix punctuation in README.md [#5197](https://github.com/axios/axios/pull/5197) +- chore(docs): update readme in the Handling Errors section - issue reference #5260 [#5261](https://github.com/axios/axios/pull/5261) +- chore: remove \b from filename [#5207](https://github.com/axios/axios/pull/5207) +- chore(docs): update CHANGELOG.md [#5137](https://github.com/axios/axios/pull/5137) +- chore: add sideEffects false to package.json [#5025](https://github.com/axios/axios/pull/5025) + +### Contributors to this release + +- [Maddy Miller](https://github.com/me4502) +- [Amit Saini](https://github.com/amitsainii) +- [ecyrbe](https://github.com/ecyrbe) +- [Ikko Ashimine](https://github.com/eltociear) +- [Geeth Gunnampalli](https://github.com/thetechie7) +- [Shreem Asati](https://github.com/shreem-123) +- [Frieder Bluemle](https://github.com/friederbluemle) +- [윤세영](https://github.com/yunseyeong) +- [Claudio Busatto](https://github.com/cjcbusatto) +- [Remco Haszing](https://github.com/remcohaszing) +- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS) +- [Csaba Maulis](https://github.com/om4csaba) +- [MoPaMo](https://github.com/MoPaMo) +- [Daniel Fjeldstad](https://github.com/w3bdesign) +- [Adrien Brunet](https://github.com/adrien-may) +- [Frazer Smith](https://github.com/Fdawgs) +- [HaiTao](https://github.com/836334258) +- [AZM](https://github.com/aziyatali) +- [relbns](https://github.com/relbns) + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.1.3] - 2022-10-15 + +### Added + +- Added custom params serializer support [#5113](https://github.com/axios/axios/pull/5113) + +### Fixed + +- Fixed top-level export to keep them in-line with static properties [#5109](https://github.com/axios/axios/pull/5109) +- Stopped including null values to query string. [#5108](https://github.com/axios/axios/pull/5108) +- Restored proxy config backwards compatibility with 0.x [#5097](https://github.com/axios/axios/pull/5097) +- Added back AxiosHeaders in AxiosHeaderValue [#5103](https://github.com/axios/axios/pull/5103) +- Pin CDN install instructions to a specific version [#5060](https://github.com/axios/axios/pull/5060) +- Handling of array values fixed for AxiosHeaders [#5085](https://github.com/axios/axios/pull/5085) + +### Chores + +- docs: match badge style, add link to them [#5046](https://github.com/axios/axios/pull/5046) +- chore: fixing comments typo [#5054](https://github.com/axios/axios/pull/5054) +- chore: update issue template [#5061](https://github.com/axios/axios/pull/5061) +- chore: added progress capturing section to the docs; [#5084](https://github.com/axios/axios/pull/5084) + +### Contributors to this release + +- [Jason Saayman](https://github.com/jasonsaayman) +- [scarf](https://github.com/scarf005) +- [Lenz Weber-Tronic](https://github.com/phryneas) +- [Arvindh](https://github.com/itsarvindh) +- [Félix Legrelle](https://github.com/FelixLgr) +- [Patrick Petrovic](https://github.com/ppati000) +- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS) +- [littledian](https://github.com/littledian) +- [ChronosMasterOfAllTime](https://github.com/ChronosMasterOfAllTime) + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.1.2] - 2022-10-07 + +### Fixed + +- Fixed broken exports for UMD builds. + +### Contributors to this release + +- [Jason Saayman](https://github.com/jasonsaayman) + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.1.1] - 2022-10-07 + +### Fixed + +- Fixed broken exports for common js. This fix breaks a prior fix, I will fix both issues ASAP but the commonJS use is more impactful. + +### Contributors to this release + +- [Jason Saayman](https://github.com/jasonsaayman) + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.1.0] - 2022-10-06 + +### Fixed + +- Fixed missing exports in type definition index.d.ts [#5003](https://github.com/axios/axios/pull/5003) +- Fixed query params composing [#5018](https://github.com/axios/axios/pull/5018) +- Fixed GenericAbortSignal interface by making it more generic [#5021](https://github.com/axios/axios/pull/5021) +- Fixed adding "clear" to AxiosInterceptorManager [#5010](https://github.com/axios/axios/pull/5010) +- Fixed commonjs & umd exports [#5030](https://github.com/axios/axios/pull/5030) +- Fixed inability to access response headers when using axios 1.x with Jest [#5036](https://github.com/axios/axios/pull/5036) + +### Contributors to this release + +- [Trim21](https://github.com/trim21) +- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS) +- [shingo.sasaki](https://github.com/s-sasaki-0529) +- [Ivan Pepelko](https://github.com/ivanpepelko) +- [Richard Kořínek](https://github.com/risa) + +### PRs +- CVE 2023 45857 ( [#6028](https://api.github.com/repos/axios/axios/pulls/6028) ) +``` + +⚠️ Critical vulnerability fix. See https://security.snyk.io/vuln/SNYK-JS-AXIOS-6032459 +``` + +## [1.0.0] - 2022-10-04 + +### Added + +- Added stack trace to AxiosError [#4624](https://github.com/axios/axios/pull/4624) +- Add AxiosError to AxiosStatic [#4654](https://github.com/axios/axios/pull/4654) +- Replaced Rollup as our build runner [#4596](https://github.com/axios/axios/pull/4596) +- Added generic TS types for the exposed toFormData helper [#4668](https://github.com/axios/axios/pull/4668) +- Added listen callback function [#4096](https://github.com/axios/axios/pull/4096) +- Added instructions for installing using PNPM [#4207](https://github.com/axios/axios/pull/4207) +- Added generic AxiosAbortSignal TS interface to avoid importing AbortController polyfill [#4229](https://github.com/axios/axios/pull/4229) +- Added axios-url-template in ECOSYSTEM.md [#4238](https://github.com/axios/axios/pull/4238) +- Added a clear() function to the request and response interceptors object so a user can ensure that all interceptors have been removed from an axios instance [#4248](https://github.com/axios/axios/pull/4248) +- Added react hook plugin [#4319](https://github.com/axios/axios/pull/4319) +- Adding HTTP status code for transformResponse [#4580](https://github.com/axios/axios/pull/4580) +- Added blob to the list of protocols supported by the browser [#4678](https://github.com/axios/axios/pull/4678) +- Resolving proxy from env on redirect [#4436](https://github.com/axios/axios/pull/4436) +- Added enhanced toFormData implementation with additional options [4704](https://github.com/axios/axios/pull/4704) +- Adding Canceler parameters config and request [#4711](https://github.com/axios/axios/pull/4711) +- Added automatic payload serialization to application/x-www-form-urlencoded [#4714](https://github.com/axios/axios/pull/4714) +- Added the ability for webpack users to overwrite built-ins [#4715](https://github.com/axios/axios/pull/4715) +- Added string[] to AxiosRequestHeaders type [#4322](https://github.com/axios/axios/pull/4322) +- Added the ability for the url-encoded-form serializer to respect the formSerializer config [#4721](https://github.com/axios/axios/pull/4721) +- Added isCancel type assert [#4293](https://github.com/axios/axios/pull/4293) +- Added data URL support for node.js [#4725](https://github.com/axios/axios/pull/4725) +- Adding types for progress event callbacks [#4675](https://github.com/axios/axios/pull/4675) +- URL params serializer [#4734](https://github.com/axios/axios/pull/4734) +- Added axios.formToJSON method [#4735](https://github.com/axios/axios/pull/4735) +- Bower platform add data protocol [#4804](https://github.com/axios/axios/pull/4804) +- Use WHATWG URL API instead of url.parse() [#4852](https://github.com/axios/axios/pull/4852) +- Add ENUM containing Http Status Codes to typings [#4903](https://github.com/axios/axios/pull/4903) +- Improve typing of timeout in index.d.ts [#4934](https://github.com/axios/axios/pull/4934) + +### Changed + +- Updated AxiosError.config to be optional in the type definition [#4665](https://github.com/axios/axios/pull/4665) +- Updated README emphasizing the URLSearchParam built-in interface over other solutions [#4590](https://github.com/axios/axios/pull/4590) +- Include request and config when creating a CanceledError instance [#4659](https://github.com/axios/axios/pull/4659) +- Changed func-names eslint rule to as-needed [#4492](https://github.com/axios/axios/pull/4492) +- Replacing deprecated substr() with slice() as substr() is deprecated [#4468](https://github.com/axios/axios/pull/4468) +- Updating HTTP links in README.md to use HTTPS [#4387](https://github.com/axios/axios/pull/4387) +- Updated to a better trim() polyfill [#4072](https://github.com/axios/axios/pull/4072) +- Updated types to allow specifying partial default headers on instance create [#4185](https://github.com/axios/axios/pull/4185) +- Expanded isAxiosError types [#4344](https://github.com/axios/axios/pull/4344) +- Updated type definition for axios instance methods [#4224](https://github.com/axios/axios/pull/4224) +- Updated eslint config [#4722](https://github.com/axios/axios/pull/4722) +- Updated Docs [#4742](https://github.com/axios/axios/pull/4742) +- Refactored Axios to use ES2017 [#4787](https://github.com/axios/axios/pull/4787) + + +### Deprecated +- There are multiple deprecations, refactors and fixes provided in this release. Please read through the full release notes to see how this may impact your project and use case. + +### Removed + +- Removed incorrect argument for NetworkError constructor [#4656](https://github.com/axios/axios/pull/4656) +- Removed Webpack [#4596](https://github.com/axios/axios/pull/4596) +- Removed function that transform arguments to array [#4544](https://github.com/axios/axios/pull/4544) + +### Fixed + +- Fixed grammar in README [#4649](https://github.com/axios/axios/pull/4649) +- Fixed code error in README [#4599](https://github.com/axios/axios/pull/4599) +- Optimized the code that checks cancellation [#4587](https://github.com/axios/axios/pull/4587) +- Fix url pointing to defaults.js in README [#4532](https://github.com/axios/axios/pull/4532) +- Use type alias instead of interface for AxiosPromise [#4505](https://github.com/axios/axios/pull/4505) +- Fix some word spelling and lint style in code comments [#4500](https://github.com/axios/axios/pull/4500) +- Edited readme with 3 updated browser icons of Chrome, FireFox and Safari [#4414](https://github.com/axios/axios/pull/4414) +- Bump follow-redirects from 1.14.9 to 1.15.0 [#4673](https://github.com/axios/axios/pull/4673) +- Fixing http tests to avoid hanging when assertions fail [#4435](https://github.com/axios/axios/pull/4435) +- Fix TS definition for AxiosRequestTransformer [#4201](https://github.com/axios/axios/pull/4201) +- Fix grammatical issues in README [#4232](https://github.com/axios/axios/pull/4232) +- Fixing instance.defaults.headers type [#4557](https://github.com/axios/axios/pull/4557) +- Fixed race condition on immediate requests cancellation [#4261](https://github.com/axios/axios/pull/4261) +- Fixing Z_BUF_ERROR when no content [#4701](https://github.com/axios/axios/pull/4701) +- Fixing proxy beforeRedirect regression [#4708](https://github.com/axios/axios/pull/4708) +- Fixed AxiosError status code type [#4717](https://github.com/axios/axios/pull/4717) +- Fixed AxiosError stack capturing [#4718](https://github.com/axios/axios/pull/4718) +- Fixing AxiosRequestHeaders typings [#4334](https://github.com/axios/axios/pull/4334) +- Fixed max body length defaults [#4731](https://github.com/axios/axios/pull/4731) +- Fixed toFormData Blob issue on node>v17 [#4728](https://github.com/axios/axios/pull/4728) +- Bump grunt from 1.5.2 to 1.5.3 [#4743](https://github.com/axios/axios/pull/4743) +- Fixing content-type header repeated [#4745](https://github.com/axios/axios/pull/4745) +- Fixed timeout error message for http [4738](https://github.com/axios/axios/pull/4738) +- Request ignores false, 0 and empty string as body values [#4785](https://github.com/axios/axios/pull/4785) +- Added back missing minified builds [#4805](https://github.com/axios/axios/pull/4805) +- Fixed a type error [#4815](https://github.com/axios/axios/pull/4815) +- Fixed a regression bug with unsubscribing from cancel token; [#4819](https://github.com/axios/axios/pull/4819) +- Remove repeated compression algorithm [#4820](https://github.com/axios/axios/pull/4820) +- The error of calling extend to pass parameters [#4857](https://github.com/axios/axios/pull/4857) +- SerializerOptions.indexes allows boolean | null | undefined [#4862](https://github.com/axios/axios/pull/4862) +- Require interceptors to return values [#4874](https://github.com/axios/axios/pull/4874) +- Removed unused imports [#4949](https://github.com/axios/axios/pull/4949) +- Allow null indexes on formSerializer and paramsSerializer [#4960](https://github.com/axios/axios/pull/4960) + +### Chores +- Set permissions for GitHub actions [#4765](https://github.com/axios/axios/pull/4765) +- Included githubactions in the dependabot config [#4770](https://github.com/axios/axios/pull/4770) +- Included dependency review [#4771](https://github.com/axios/axios/pull/4771) +- Update security.md [#4784](https://github.com/axios/axios/pull/4784) +- Remove unnecessary spaces [#4854](https://github.com/axios/axios/pull/4854) +- Simplify the import path of AxiosError [#4875](https://github.com/axios/axios/pull/4875) +- Fix Gitpod dead link [#4941](https://github.com/axios/axios/pull/4941) +- Enable syntax highlighting for a code block [#4970](https://github.com/axios/axios/pull/4970) +- Using Logo Axios in Readme.md [#4993](https://github.com/axios/axios/pull/4993) +- Fix markup for note in README [#4825](https://github.com/axios/axios/pull/4825) +- Fix typo and formatting, add colons [#4853](https://github.com/axios/axios/pull/4853) +- Fix typo in readme [#4942](https://github.com/axios/axios/pull/4942) + +### Security + +- Update SECURITY.md [#4687](https://github.com/axios/axios/pull/4687) + +### Contributors to this release + +- [Bertrand Marron](https://github.com/tusbar) +- [Dmitriy Mozgovoy](https://github.com/DigitalBrainJS) +- [Dan Mooney](https://github.com/danmooney) +- [Michael Li](https://github.com/xiaoyu-tamu) +- [aong](https://github.com/yxwzaxns) +- [Des Preston](https://github.com/despreston) +- [Ted Robertson](https://github.com/tredondo) +- [zhoulixiang](https://github.com/zh-lx) +- [Arthur Fiorette](https://github.com/arthurfiorette) +- [Kumar Shanu](https://github.com/Kr-Shanu) +- [JALAL](https://github.com/JLL32) +- [Jingyi Lin](https://github.com/MageeLin) +- [Philipp Loose](https://github.com/phloose) +- [Alexander Shchukin](https://github.com/sashsvamir) +- [Dave Cardwell](https://github.com/davecardwell) +- [Cat Scarlet](https://github.com/catscarlet) +- [Luca Pizzini](https://github.com/lpizzinidev) +- [Kai](https://github.com/Schweinepriester) +- [Maxime Bargiel](https://github.com/mbargiel) +- [Brian Helba](https://github.com/brianhelba) +- [reslear](https://github.com/reslear) +- [Jamie Slome](https://github.com/JamieSlome) +- [Landro3](https://github.com/Landro3) +- [rafw87](https://github.com/rafw87) +- [Afzal Sayed](https://github.com/afzalsayed96) +- [Koki Oyatsu](https://github.com/kaishuu0123) +- [Dave](https://github.com/wangcch) +- [暴走老七](https://github.com/baozouai) +- [Spencer](https://github.com/spalger) +- [Adrian Wieprzkowicz](https://github.com/Argeento) +- [Jamie Telin](https://github.com/lejahmie) +- [毛呆](https://github.com/aweikalee) +- [Kirill Shakirov](https://github.com/turisap) +- [Rraji Abdelbari](https://github.com/estarossa0) +- [Jelle Schutter](https://github.com/jelleschutter) +- [Tom Ceuppens](https://github.com/KyorCode) +- [Johann Cooper](https://github.com/JohannCooper) +- [Dimitris Halatsis](https://github.com/mitsos1os) +- [chenjigeng](https://github.com/chenjigeng) +- [João Gabriel Quaresma](https://github.com/joaoGabriel55) +- [Victor Augusto](https://github.com/VictorAugDB) +- [neilnaveen](https://github.com/neilnaveen) +- [Pavlos](https://github.com/psmoros) +- [Kiryl Valkovich](https://github.com/visortelle) +- [Naveen](https://github.com/naveensrinivasan) +- [wenzheng](https://github.com/0x30) +- [hcwhan](https://github.com/hcwhan) +- [Bassel Rachid](https://github.com/basselworkforce) +- [Grégoire Pineau](https://github.com/lyrixx) +- [felipedamin](https://github.com/felipedamin) +- [Karl Horky](https://github.com/karlhorky) +- [Yue JIN](https://github.com/kingyue737) +- [Usman Ali Siddiqui](https://github.com/usman250994) +- [WD](https://github.com/techbirds) +- [Günther Foidl](https://github.com/gfoidl) +- [Stephen Jennings](https://github.com/jennings) +- [C.T.Lin](https://github.com/chentsulin) +- [mia-z](https://github.com/mia-z) +- [Parth Banathia](https://github.com/Parth0105) +- [parth0105pluang](https://github.com/parth0105pluang) +- [Marco Weber](https://github.com/mrcwbr) +- [Luca Pizzini](https://github.com/lpizzinidev) +- [Willian Agostini](https://github.com/WillianAgostini) +- [Huyen Nguyen](https://github.com/huyenltnguyen) \ No newline at end of file diff --git a/project starter code/node_modules/axios/LICENSE b/project starter code/node_modules/axios/LICENSE new file mode 100644 index 00000000..05006a51 --- /dev/null +++ b/project starter code/node_modules/axios/LICENSE @@ -0,0 +1,7 @@ +# Copyright (c) 2014-present Matt Zabriskie & Collaborators + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/project starter code/node_modules/axios/MIGRATION_GUIDE.md b/project starter code/node_modules/axios/MIGRATION_GUIDE.md new file mode 100644 index 00000000..ec3ae0da --- /dev/null +++ b/project starter code/node_modules/axios/MIGRATION_GUIDE.md @@ -0,0 +1,3 @@ +# Migration Guide + +## 0.x.x -> 1.1.0 diff --git a/project starter code/node_modules/axios/README.md b/project starter code/node_modules/axios/README.md new file mode 100644 index 00000000..71381cb2 --- /dev/null +++ b/project starter code/node_modules/axios/README.md @@ -0,0 +1,1695 @@ +

+ Platinum sponsors +
+

+ +
+ + + + + + + + +

Alloy is the integration development platform that makes it simple and
fast for SaaS companies to launch critical user-facing integrations.

+

+ Sign up free • + Documentation +

+

+
+ +

+ Gold sponsors +

+

+ + + + +
+ + + + + + + +

API-first authentication, authorization, and fraud prevention

+

+ Website • + DocumentationNode.js Backend SDK +

+
+ + + + + + + +

Drag-and-drop authentication, authorization, and identity management

+

+ Website • + DocumentationCommunity +

+
+ + +

+
+
+
+ +

Promise based HTTP client for the browser and node.js

+ +

+ Website • + Documentation +

+ +
+ +[![npm version](https://img.shields.io/npm/v/axios.svg?style=flat-square)](https://www.npmjs.org/package/axios) +[![CDNJS](https://img.shields.io/cdnjs/v/axios.svg?style=flat-square)](https://cdnjs.com/libraries/axios) +[![Build status](https://img.shields.io/github/actions/workflow/status/axios/axios/ci.yml?branch=v1.x&label=CI&logo=github&style=flat-square)](https://github.com/axios/axios/actions/workflows/ci.yml) +[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod&style=flat-square)](https://gitpod.io/#https://github.com/axios/axios) +[![code coverage](https://img.shields.io/coveralls/mzabriskie/axios.svg?style=flat-square)](https://coveralls.io/r/mzabriskie/axios) +[![install size](https://img.shields.io/badge/dynamic/json?url=https://packagephobia.com/v2/api.json?p=axios&query=$.install.pretty&label=install%20size&style=flat-square)](https://packagephobia.now.sh/result?p=axios) +[![npm bundle size](https://img.shields.io/bundlephobia/minzip/axios?style=flat-square)](https://bundlephobia.com/package/axios@latest) +[![npm downloads](https://img.shields.io/npm/dm/axios.svg?style=flat-square)](https://npm-stat.com/charts.html?package=axios) +[![gitter chat](https://img.shields.io/gitter/room/mzabriskie/axios.svg?style=flat-square)](https://gitter.im/mzabriskie/axios) +[![code helpers](https://www.codetriage.com/axios/axios/badges/users.svg)](https://www.codetriage.com/axios/axios) +[![Known Vulnerabilities](https://snyk.io/test/npm/axios/badge.svg)](https://snyk.io/test/npm/axios) + + + + +
+ +## Table of Contents + + - [Features](#features) + - [Browser Support](#browser-support) + - [Installing](#installing) + - [Package manager](#package-manager) + - [CDN](#cdn) + - [Example](#example) + - [Axios API](#axios-api) + - [Request method aliases](#request-method-aliases) + - [Concurrency 👎](#concurrency-deprecated) + - [Creating an instance](#creating-an-instance) + - [Instance methods](#instance-methods) + - [Request Config](#request-config) + - [Response Schema](#response-schema) + - [Config Defaults](#config-defaults) + - [Global axios defaults](#global-axios-defaults) + - [Custom instance defaults](#custom-instance-defaults) + - [Config order of precedence](#config-order-of-precedence) + - [Interceptors](#interceptors) + - [Multiple Interceptors](#multiple-interceptors) + - [Handling Errors](#handling-errors) + - [Cancellation](#cancellation) + - [AbortController](#abortcontroller) + - [CancelToken 👎](#canceltoken-deprecated) + - [Using application/x-www-form-urlencoded format](#using-applicationx-www-form-urlencoded-format) + - [URLSearchParams](#urlsearchparams) + - [Query string](#query-string-older-browsers) + - [🆕 Automatic serialization](#-automatic-serialization-to-urlsearchparams) + - [Using multipart/form-data format](#using-multipartform-data-format) + - [FormData](#formdata) + - [🆕 Automatic serialization](#-automatic-serialization-to-formdata) + - [Files Posting](#files-posting) + - [HTML Form Posting](#-html-form-posting-browser) + - [🆕 Progress capturing](#-progress-capturing) + - [🆕 Rate limiting](#-progress-capturing) + - [🆕 AxiosHeaders](#-axiosheaders) + - [🔥 Fetch adapter](#-fetch-adapter) + - [Semver](#semver) + - [Promises](#promises) + - [TypeScript](#typescript) + - [Resources](#resources) + - [Credits](#credits) + - [License](#license) + +## Features + +- Make [XMLHttpRequests](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) from the browser +- Make [http](https://nodejs.org/api/http.html) requests from node.js +- Supports the [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) API +- Intercept request and response +- Transform request and response data +- Cancel requests +- Automatic transforms for [JSON](https://www.json.org/json-en.html) data +- 🆕 Automatic data object serialization to `multipart/form-data` and `x-www-form-urlencoded` body encodings +- Client side support for protecting against [XSRF](https://en.wikipedia.org/wiki/Cross-site_request_forgery) + +## Browser Support + +![Chrome](https://raw.githubusercontent.com/alrra/browser-logos/main/src/chrome/chrome_48x48.png) | ![Firefox](https://raw.githubusercontent.com/alrra/browser-logos/main/src/firefox/firefox_48x48.png) | ![Safari](https://raw.githubusercontent.com/alrra/browser-logos/main/src/safari/safari_48x48.png) | ![Opera](https://raw.githubusercontent.com/alrra/browser-logos/main/src/opera/opera_48x48.png) | ![Edge](https://raw.githubusercontent.com/alrra/browser-logos/main/src/edge/edge_48x48.png) | ![IE](https://raw.githubusercontent.com/alrra/browser-logos/master/src/archive/internet-explorer_9-11/internet-explorer_9-11_48x48.png) | +--- | --- | --- | --- | --- | --- | +Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | 11 ✔ | + +[![Browser Matrix](https://saucelabs.com/open_sauce/build_matrix/axios.svg)](https://saucelabs.com/u/axios) + +## Installing + +### Package manager + +Using npm: + +```bash +$ npm install axios +``` + +Using bower: + +```bash +$ bower install axios +``` + +Using yarn: + +```bash +$ yarn add axios +``` + +Using pnpm: + +```bash +$ pnpm add axios +``` + +Once the package is installed, you can import the library using `import` or `require` approach: + +```js +import axios, {isCancel, AxiosError} from 'axios'; +``` + +You can also use the default export, since the named export is just a re-export from the Axios factory: + +```js +import axios from 'axios'; + +console.log(axios.isCancel('something')); +```` + +If you use `require` for importing, **only default export is available**: + +```js +const axios = require('axios'); + +console.log(axios.isCancel('something')); +``` + +For cases where something went wrong when trying to import a module into a custom or legacy environment, +you can try importing the module package directly: + +```js +const axios = require('axios/dist/browser/axios.cjs'); // browser commonJS bundle (ES2017) +// const axios = require('axios/dist/node/axios.cjs'); // node commonJS bundle (ES2017) +``` + +### CDN + +Using jsDelivr CDN (ES5 UMD browser module): + +```html + +``` + +Using unpkg CDN: + +```html + +``` + +## Example + +> **Note**: CommonJS usage +> In order to gain the TypeScript typings (for intellisense / autocomplete) while using CommonJS imports with `require()`, use the following approach: + +```js +import axios from 'axios'; +//const axios = require('axios'); // legacy way + +// Make a request for a user with a given ID +axios.get('/user?ID=12345') + .then(function (response) { + // handle success + console.log(response); + }) + .catch(function (error) { + // handle error + console.log(error); + }) + .finally(function () { + // always executed + }); + +// Optionally the request above could also be done as +axios.get('/user', { + params: { + ID: 12345 + } + }) + .then(function (response) { + console.log(response); + }) + .catch(function (error) { + console.log(error); + }) + .finally(function () { + // always executed + }); + +// Want to use async/await? Add the `async` keyword to your outer function/method. +async function getUser() { + try { + const response = await axios.get('/user?ID=12345'); + console.log(response); + } catch (error) { + console.error(error); + } +} +``` + +> **Note**: `async/await` is part of ECMAScript 2017 and is not supported in Internet +> Explorer and older browsers, so use with caution. + +Performing a `POST` request + +```js +axios.post('/user', { + firstName: 'Fred', + lastName: 'Flintstone' + }) + .then(function (response) { + console.log(response); + }) + .catch(function (error) { + console.log(error); + }); +``` + +Performing multiple concurrent requests + +```js +function getUserAccount() { + return axios.get('/user/12345'); +} + +function getUserPermissions() { + return axios.get('/user/12345/permissions'); +} + +Promise.all([getUserAccount(), getUserPermissions()]) + .then(function (results) { + const acct = results[0]; + const perm = results[1]; + }); +``` + +## axios API + +Requests can be made by passing the relevant config to `axios`. + +##### axios(config) + +```js +// Send a POST request +axios({ + method: 'post', + url: '/user/12345', + data: { + firstName: 'Fred', + lastName: 'Flintstone' + } +}); +``` + +```js +// GET request for remote image in node.js +axios({ + method: 'get', + url: 'https://bit.ly/2mTM3nY', + responseType: 'stream' +}) + .then(function (response) { + response.data.pipe(fs.createWriteStream('ada_lovelace.jpg')) + }); +``` + +##### axios(url[, config]) + +```js +// Send a GET request (default method) +axios('/user/12345'); +``` + +### Request method aliases + +For convenience, aliases have been provided for all common request methods. + +##### axios.request(config) +##### axios.get(url[, config]) +##### axios.delete(url[, config]) +##### axios.head(url[, config]) +##### axios.options(url[, config]) +##### axios.post(url[, data[, config]]) +##### axios.put(url[, data[, config]]) +##### axios.patch(url[, data[, config]]) + +###### NOTE +When using the alias methods `url`, `method`, and `data` properties don't need to be specified in config. + +### Concurrency (Deprecated) +Please use `Promise.all` to replace the below functions. + +Helper functions for dealing with concurrent requests. + +axios.all(iterable) +axios.spread(callback) + +### Creating an instance + +You can create a new instance of axios with a custom config. + +##### axios.create([config]) + +```js +const instance = axios.create({ + baseURL: 'https://some-domain.com/api/', + timeout: 1000, + headers: {'X-Custom-Header': 'foobar'} +}); +``` + +### Instance methods + +The available instance methods are listed below. The specified config will be merged with the instance config. + +##### axios#request(config) +##### axios#get(url[, config]) +##### axios#delete(url[, config]) +##### axios#head(url[, config]) +##### axios#options(url[, config]) +##### axios#post(url[, data[, config]]) +##### axios#put(url[, data[, config]]) +##### axios#patch(url[, data[, config]]) +##### axios#getUri([config]) + +## Request Config + +These are the available config options for making requests. Only the `url` is required. Requests will default to `GET` if `method` is not specified. + +```js +{ + // `url` is the server URL that will be used for the request + url: '/user', + + // `method` is the request method to be used when making the request + method: 'get', // default + + // `baseURL` will be prepended to `url` unless `url` is absolute. + // It can be convenient to set `baseURL` for an instance of axios to pass relative URLs + // to methods of that instance. + baseURL: 'https://some-domain.com/api/', + + // `transformRequest` allows changes to the request data before it is sent to the server + // This is only applicable for request methods 'PUT', 'POST', 'PATCH' and 'DELETE' + // The last function in the array must return a string or an instance of Buffer, ArrayBuffer, + // FormData or Stream + // You may modify the headers object. + transformRequest: [function (data, headers) { + // Do whatever you want to transform the data + + return data; + }], + + // `transformResponse` allows changes to the response data to be made before + // it is passed to then/catch + transformResponse: [function (data) { + // Do whatever you want to transform the data + + return data; + }], + + // `headers` are custom headers to be sent + headers: {'X-Requested-With': 'XMLHttpRequest'}, + + // `params` are the URL parameters to be sent with the request + // Must be a plain object or a URLSearchParams object + params: { + ID: 12345 + }, + + // `paramsSerializer` is an optional config that allows you to customize serializing `params`. + paramsSerializer: { + + //Custom encoder function which sends key/value pairs in an iterative fashion. + encode?: (param: string): string => { /* Do custom operations here and return transformed string */ }, + + // Custom serializer function for the entire parameter. Allows user to mimic pre 1.x behaviour. + serialize?: (params: Record, options?: ParamsSerializerOptions ), + + //Configuration for formatting array indexes in the params. + indexes: false // Three available options: (1) indexes: null (leads to no brackets), (2) (default) indexes: false (leads to empty brackets), (3) indexes: true (leads to brackets with indexes). + }, + + // `data` is the data to be sent as the request body + // Only applicable for request methods 'PUT', 'POST', 'DELETE , and 'PATCH' + // When no `transformRequest` is set, must be of one of the following types: + // - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams + // - Browser only: FormData, File, Blob + // - Node only: Stream, Buffer, FormData (form-data package) + data: { + firstName: 'Fred' + }, + + // syntax alternative to send data into the body + // method post + // only the value is sent, not the key + data: 'Country=Brasil&City=Belo Horizonte', + + // `timeout` specifies the number of milliseconds before the request times out. + // If the request takes longer than `timeout`, the request will be aborted. + timeout: 1000, // default is `0` (no timeout) + + // `withCredentials` indicates whether or not cross-site Access-Control requests + // should be made using credentials + withCredentials: false, // default + + // `adapter` allows custom handling of requests which makes testing easier. + // Return a promise and supply a valid response (see lib/adapters/README.md) + adapter: function (config) { + /* ... */ + }, + // Also, you can set the name of the built-in adapter, or provide an array with their names + // to choose the first available in the environment + adapter: 'xhr' // 'fetch' | 'http' | ['xhr', 'http', 'fetch'] + + // `auth` indicates that HTTP Basic auth should be used, and supplies credentials. + // This will set an `Authorization` header, overwriting any existing + // `Authorization` custom headers you have set using `headers`. + // Please note that only HTTP Basic auth is configurable through this parameter. + // For Bearer tokens and such, use `Authorization` custom headers instead. + auth: { + username: 'janedoe', + password: 's00pers3cret' + }, + + // `responseType` indicates the type of data that the server will respond with + // options are: 'arraybuffer', 'document', 'json', 'text', 'stream' + // browser only: 'blob' + responseType: 'json', // default + + // `responseEncoding` indicates encoding to use for decoding responses (Node.js only) + // Note: Ignored for `responseType` of 'stream' or client-side requests + // options are: 'ascii', 'ASCII', 'ansi', 'ANSI', 'binary', 'BINARY', 'base64', 'BASE64', 'base64url', + // 'BASE64URL', 'hex', 'HEX', 'latin1', 'LATIN1', 'ucs-2', 'UCS-2', 'ucs2', 'UCS2', 'utf-8', 'UTF-8', + // 'utf8', 'UTF8', 'utf16le', 'UTF16LE' + responseEncoding: 'utf8', // default + + // `xsrfCookieName` is the name of the cookie to use as a value for xsrf token + xsrfCookieName: 'XSRF-TOKEN', // default + + // `xsrfHeaderName` is the name of the http header that carries the xsrf token value + xsrfHeaderName: 'X-XSRF-TOKEN', // default + + // `undefined` (default) - set XSRF header only for the same origin requests + withXSRFToken: boolean | undefined | ((config: InternalAxiosRequestConfig) => boolean | undefined), + + // `onUploadProgress` allows handling of progress events for uploads + // browser & node.js + onUploadProgress: function ({loaded, total, progress, bytes, estimated, rate, upload = true}) { + // Do whatever you want with the Axios progress event + }, + + // `onDownloadProgress` allows handling of progress events for downloads + // browser & node.js + onDownloadProgress: function ({loaded, total, progress, bytes, estimated, rate, download = true}) { + // Do whatever you want with the Axios progress event + }, + + // `maxContentLength` defines the max size of the http response content in bytes allowed in node.js + maxContentLength: 2000, + + // `maxBodyLength` (Node only option) defines the max size of the http request content in bytes allowed + maxBodyLength: 2000, + + // `validateStatus` defines whether to resolve or reject the promise for a given + // HTTP response status code. If `validateStatus` returns `true` (or is set to `null` + // or `undefined`), the promise will be resolved; otherwise, the promise will be + // rejected. + validateStatus: function (status) { + return status >= 200 && status < 300; // default + }, + + // `maxRedirects` defines the maximum number of redirects to follow in node.js. + // If set to 0, no redirects will be followed. + maxRedirects: 21, // default + + // `beforeRedirect` defines a function that will be called before redirect. + // Use this to adjust the request options upon redirecting, + // to inspect the latest response headers, + // or to cancel the request by throwing an error + // If maxRedirects is set to 0, `beforeRedirect` is not used. + beforeRedirect: (options, { headers }) => { + if (options.hostname === "example.com") { + options.auth = "user:password"; + } + }, + + // `socketPath` defines a UNIX Socket to be used in node.js. + // e.g. '/var/run/docker.sock' to send requests to the docker daemon. + // Only either `socketPath` or `proxy` can be specified. + // If both are specified, `socketPath` is used. + socketPath: null, // default + + // `transport` determines the transport method that will be used to make the request. If defined, it will be used. Otherwise, if `maxRedirects` is 0, the default `http` or `https` library will be used, depending on the protocol specified in `protocol`. Otherwise, the `httpFollow` or `httpsFollow` library will be used, again depending on the protocol, which can handle redirects. + transport: undefined, // default + + // `httpAgent` and `httpsAgent` define a custom agent to be used when performing http + // and https requests, respectively, in node.js. This allows options to be added like + // `keepAlive` that are not enabled by default. + httpAgent: new http.Agent({ keepAlive: true }), + httpsAgent: new https.Agent({ keepAlive: true }), + + // `proxy` defines the hostname, port, and protocol of the proxy server. + // You can also define your proxy using the conventional `http_proxy` and + // `https_proxy` environment variables. If you are using environment variables + // for your proxy configuration, you can also define a `no_proxy` environment + // variable as a comma-separated list of domains that should not be proxied. + // Use `false` to disable proxies, ignoring environment variables. + // `auth` indicates that HTTP Basic auth should be used to connect to the proxy, and + // supplies credentials. + // This will set an `Proxy-Authorization` header, overwriting any existing + // `Proxy-Authorization` custom headers you have set using `headers`. + // If the proxy server uses HTTPS, then you must set the protocol to `https`. + proxy: { + protocol: 'https', + host: '127.0.0.1', + // hostname: '127.0.0.1' // Takes precedence over 'host' if both are defined + port: 9000, + auth: { + username: 'mikeymike', + password: 'rapunz3l' + } + }, + + // `cancelToken` specifies a cancel token that can be used to cancel the request + // (see Cancellation section below for details) + cancelToken: new CancelToken(function (cancel) { + }), + + // an alternative way to cancel Axios requests using AbortController + signal: new AbortController().signal, + + // `decompress` indicates whether or not the response body should be decompressed + // automatically. If set to `true` will also remove the 'content-encoding' header + // from the responses objects of all decompressed responses + // - Node only (XHR cannot turn off decompression) + decompress: true, // default + + // `insecureHTTPParser` boolean. + // Indicates where to use an insecure HTTP parser that accepts invalid HTTP headers. + // This may allow interoperability with non-conformant HTTP implementations. + // Using the insecure parser should be avoided. + // see options https://nodejs.org/dist/latest-v12.x/docs/api/http.html#http_http_request_url_options_callback + // see also https://nodejs.org/en/blog/vulnerability/february-2020-security-releases/#strict-http-header-parsing-none + insecureHTTPParser: undefined, // default + + // transitional options for backward compatibility that may be removed in the newer versions + transitional: { + // silent JSON parsing mode + // `true` - ignore JSON parsing errors and set response.data to null if parsing failed (old behaviour) + // `false` - throw SyntaxError if JSON parsing failed (Note: responseType must be set to 'json') + silentJSONParsing: true, // default value for the current Axios version + + // try to parse the response string as JSON even if `responseType` is not 'json' + forcedJSONParsing: true, + + // throw ETIMEDOUT error instead of generic ECONNABORTED on request timeouts + clarifyTimeoutError: false, + }, + + env: { + // The FormData class to be used to automatically serialize the payload into a FormData object + FormData: window?.FormData || global?.FormData + }, + + formSerializer: { + visitor: (value, key, path, helpers) => {}; // custom visitor function to serialize form values + dots: boolean; // use dots instead of brackets format + metaTokens: boolean; // keep special endings like {} in parameter key + indexes: boolean; // array indexes format null - no brackets, false - empty brackets, true - brackets with indexes + }, + + // http adapter only (node.js) + maxRate: [ + 100 * 1024, // 100KB/s upload limit, + 100 * 1024 // 100KB/s download limit + ] +} +``` + +## Response Schema + +The response for a request contains the following information. + +```js +{ + // `data` is the response that was provided by the server + data: {}, + + // `status` is the HTTP status code from the server response + status: 200, + + // `statusText` is the HTTP status message from the server response + statusText: 'OK', + + // `headers` the HTTP headers that the server responded with + // All header names are lowercase and can be accessed using the bracket notation. + // Example: `response.headers['content-type']` + headers: {}, + + // `config` is the config that was provided to `axios` for the request + config: {}, + + // `request` is the request that generated this response + // It is the last ClientRequest instance in node.js (in redirects) + // and an XMLHttpRequest instance in the browser + request: {} +} +``` + +When using `then`, you will receive the response as follows: + +```js +axios.get('/user/12345') + .then(function (response) { + console.log(response.data); + console.log(response.status); + console.log(response.statusText); + console.log(response.headers); + console.log(response.config); + }); +``` + +When using `catch`, or passing a [rejection callback](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then) as second parameter of `then`, the response will be available through the `error` object as explained in the [Handling Errors](#handling-errors) section. + +## Config Defaults + +You can specify config defaults that will be applied to every request. + +### Global axios defaults + +```js +axios.defaults.baseURL = 'https://api.example.com'; + +// Important: If axios is used with multiple domains, the AUTH_TOKEN will be sent to all of them. +// See below for an example using Custom instance defaults instead. +axios.defaults.headers.common['Authorization'] = AUTH_TOKEN; + +axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded'; +``` + +### Custom instance defaults + +```js +// Set config defaults when creating the instance +const instance = axios.create({ + baseURL: 'https://api.example.com' +}); + +// Alter defaults after instance has been created +instance.defaults.headers.common['Authorization'] = AUTH_TOKEN; +``` + +### Config order of precedence + +Config will be merged with an order of precedence. The order is library defaults found in [lib/defaults.js](https://github.com/axios/axios/blob/master/lib/defaults/index.js#L28), then `defaults` property of the instance, and finally `config` argument for the request. The latter will take precedence over the former. Here's an example. + +```js +// Create an instance using the config defaults provided by the library +// At this point the timeout config value is `0` as is the default for the library +const instance = axios.create(); + +// Override timeout default for the library +// Now all requests using this instance will wait 2.5 seconds before timing out +instance.defaults.timeout = 2500; + +// Override timeout for this request as it's known to take a long time +instance.get('/longRequest', { + timeout: 5000 +}); +``` + +## Interceptors + +You can intercept requests or responses before they are handled by `then` or `catch`. + +```js +// Add a request interceptor +axios.interceptors.request.use(function (config) { + // Do something before request is sent + return config; + }, function (error) { + // Do something with request error + return Promise.reject(error); + }); + +// Add a response interceptor +axios.interceptors.response.use(function (response) { + // Any status code that lie within the range of 2xx cause this function to trigger + // Do something with response data + return response; + }, function (error) { + // Any status codes that falls outside the range of 2xx cause this function to trigger + // Do something with response error + return Promise.reject(error); + }); +``` + +If you need to remove an interceptor later you can. + +```js +const myInterceptor = axios.interceptors.request.use(function () {/*...*/}); +axios.interceptors.request.eject(myInterceptor); +``` + +You can also clear all interceptors for requests or responses. +```js +const instance = axios.create(); +instance.interceptors.request.use(function () {/*...*/}); +instance.interceptors.request.clear(); // Removes interceptors from requests +instance.interceptors.response.use(function () {/*...*/}); +instance.interceptors.response.clear(); // Removes interceptors from responses +``` + +You can add interceptors to a custom instance of axios. + +```js +const instance = axios.create(); +instance.interceptors.request.use(function () {/*...*/}); +``` + +When you add request interceptors, they are presumed to be asynchronous by default. This can cause a delay +in the execution of your axios request when the main thread is blocked (a promise is created under the hood for +the interceptor and your request gets put on the bottom of the call stack). If your request interceptors are synchronous you can add a flag +to the options object that will tell axios to run the code synchronously and avoid any delays in request execution. + +```js +axios.interceptors.request.use(function (config) { + config.headers.test = 'I am only a header!'; + return config; +}, null, { synchronous: true }); +``` + +If you want to execute a particular interceptor based on a runtime check, +you can add a `runWhen` function to the options object. The interceptor will not be executed **if and only if** the return +of `runWhen` is `false`. The function will be called with the config +object (don't forget that you can bind your own arguments to it as well.) This can be handy when you have an +asynchronous request interceptor that only needs to run at certain times. + +```js +function onGetCall(config) { + return config.method === 'get'; +} +axios.interceptors.request.use(function (config) { + config.headers.test = 'special get headers'; + return config; +}, null, { runWhen: onGetCall }); +``` + +### Multiple Interceptors + +Given you add multiple response interceptors +and when the response was fulfilled +- then each interceptor is executed +- then they are executed in the order they were added +- then only the last interceptor's result is returned +- then every interceptor receives the result of its predecessor +- and when the fulfillment-interceptor throws + - then the following fulfillment-interceptor is not called + - then the following rejection-interceptor is called + - once caught, another following fulfill-interceptor is called again (just like in a promise chain). + +Read [the interceptor tests](./test/specs/interceptors.spec.js) for seeing all this in code. + +## Error Types + +There are many different axios error messages that can appear that can provide basic information about the specifics of the error and where opportunities may lie in debugging. + +The general structure of axios errors is as follows: +| Property | Definition | +| -------- | ---------- | +| message | A quick summary of the error message and the status it failed with. | +| name | This defines where the error originated from. For axios, it will always be an 'AxiosError'. | +| stack | Provides the stack trace of the error. | +| config | An axios config object with specific instance configurations defined by the user from when the request was made | +| code | Represents an axios identified error. The table below lists out specific definitions for internal axios error. | +| status | HTTP response status code. See [here](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes) for common HTTP response status code meanings. + +Below is a list of potential axios identified error +| Code | Definition | +| -------- | ---------- | +| ERR_BAD_OPTION_VALUE | Invalid or unsupported value provided in axios configuration. | +| ERR_BAD_OPTION | Invalid option provided in axios configuration. | +| ECONNABORTED | Request timed out due to exceeding timeout specified in axios configuration. | +| ETIMEDOUT | Request timed out due to exceeding default axios timelimit. | +| ERR_NETWORK | Network-related issue. +| ERR_FR_TOO_MANY_REDIRECTS | Request is redirected too many times; exceeds max redirects specified in axios configuration. +| ERR_DEPRECATED | Deprecated feature or method used in axios. +| ERR_BAD_RESPONSE | Response cannot be parsed properly or is in an unexpected format. +| ERR_BAD_REQUEST | Requested has unexpected format or missing required parameters. | +| ERR_CANCELED | Feature or method is canceled explicitly by the user. +| ERR_NOT_SUPPORT | Feature or method not supported in the current axios environment. +| ERR_INVALID_URL | Invalid URL provided for axios request. + +## Handling Errors + +the default behavior is to reject every response that returns with a status code that falls out of the range of 2xx and treat it as an error. + +```js +axios.get('/user/12345') + .catch(function (error) { + if (error.response) { + // The request was made and the server responded with a status code + // that falls out of the range of 2xx + console.log(error.response.data); + console.log(error.response.status); + console.log(error.response.headers); + } else if (error.request) { + // The request was made but no response was received + // `error.request` is an instance of XMLHttpRequest in the browser and an instance of + // http.ClientRequest in node.js + console.log(error.request); + } else { + // Something happened in setting up the request that triggered an Error + console.log('Error', error.message); + } + console.log(error.config); + }); +``` + +Using the `validateStatus` config option, you can override the default condition (status >= 200 && status < 300) and define HTTP code(s) that should throw an error. + +```js +axios.get('/user/12345', { + validateStatus: function (status) { + return status < 500; // Resolve only if the status code is less than 500 + } +}) +``` + +Using `toJSON` you get an object with more information about the HTTP error. + +```js +axios.get('/user/12345') + .catch(function (error) { + console.log(error.toJSON()); + }); +``` + +## Cancellation + +### AbortController + +Starting from `v0.22.0` Axios supports AbortController to cancel requests in fetch API way: + +```js +const controller = new AbortController(); + +axios.get('/foo/bar', { + signal: controller.signal +}).then(function(response) { + //... +}); +// cancel the request +controller.abort() +``` + +### CancelToken `👎deprecated` + +You can also cancel a request using a *CancelToken*. + +> The axios cancel token API is based on the withdrawn [cancellable promises proposal](https://github.com/tc39/proposal-cancelable-promises). + +> This API is deprecated since v0.22.0 and shouldn't be used in new projects + +You can create a cancel token using the `CancelToken.source` factory as shown below: + +```js +const CancelToken = axios.CancelToken; +const source = CancelToken.source(); + +axios.get('/user/12345', { + cancelToken: source.token +}).catch(function (thrown) { + if (axios.isCancel(thrown)) { + console.log('Request canceled', thrown.message); + } else { + // handle error + } +}); + +axios.post('/user/12345', { + name: 'new name' +}, { + cancelToken: source.token +}) + +// cancel the request (the message parameter is optional) +source.cancel('Operation canceled by the user.'); +``` + +You can also create a cancel token by passing an executor function to the `CancelToken` constructor: + +```js +const CancelToken = axios.CancelToken; +let cancel; + +axios.get('/user/12345', { + cancelToken: new CancelToken(function executor(c) { + // An executor function receives a cancel function as a parameter + cancel = c; + }) +}); + +// cancel the request +cancel(); +``` + +> **Note:** you can cancel several requests with the same cancel token/abort controller. +> If a cancellation token is already cancelled at the moment of starting an Axios request, then the request is cancelled immediately, without any attempts to make a real request. + +> During the transition period, you can use both cancellation APIs, even for the same request: + +## Using `application/x-www-form-urlencoded` format + +### URLSearchParams + +By default, axios serializes JavaScript objects to `JSON`. To send data in the [`application/x-www-form-urlencoded` format](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST) instead, you can use the [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) API, which is [supported](http://www.caniuse.com/#feat=urlsearchparams) in the vast majority of browsers,and [ Node](https://nodejs.org/api/url.html#url_class_urlsearchparams) starting with v10 (released in 2018). + +```js +const params = new URLSearchParams({ foo: 'bar' }); +params.append('extraparam', 'value'); +axios.post('/foo', params); +``` + +### Query string (Older browsers) + +For compatibility with very old browsers, there is a [polyfill](https://github.com/WebReflection/url-search-params) available (make sure to polyfill the global environment). + +Alternatively, you can encode data using the [`qs`](https://github.com/ljharb/qs) library: + +```js +const qs = require('qs'); +axios.post('/foo', qs.stringify({ 'bar': 123 })); +``` + +Or in another way (ES6), + +```js +import qs from 'qs'; +const data = { 'bar': 123 }; +const options = { + method: 'POST', + headers: { 'content-type': 'application/x-www-form-urlencoded' }, + data: qs.stringify(data), + url, +}; +axios(options); +``` + +### Older Node.js versions + +For older Node.js engines, you can use the [`querystring`](https://nodejs.org/api/querystring.html) module as follows: + +```js +const querystring = require('querystring'); +axios.post('https://something.com/', querystring.stringify({ foo: 'bar' })); +``` + +You can also use the [`qs`](https://github.com/ljharb/qs) library. + +> **Note**: The `qs` library is preferable if you need to stringify nested objects, as the `querystring` method has [known issues](https://github.com/nodejs/node-v0.x-archive/issues/1665) with that use case. + +### 🆕 Automatic serialization to URLSearchParams + +Axios will automatically serialize the data object to urlencoded format if the content-type header is set to "application/x-www-form-urlencoded". + +```js +const data = { + x: 1, + arr: [1, 2, 3], + arr2: [1, [2], 3], + users: [{name: 'Peter', surname: 'Griffin'}, {name: 'Thomas', surname: 'Anderson'}], +}; + +await axios.postForm('https://postman-echo.com/post', data, + {headers: {'content-type': 'application/x-www-form-urlencoded'}} +); +``` + +The server will handle it as: + +```js + { + x: '1', + 'arr[]': [ '1', '2', '3' ], + 'arr2[0]': '1', + 'arr2[1][0]': '2', + 'arr2[2]': '3', + 'arr3[]': [ '1', '2', '3' ], + 'users[0][name]': 'Peter', + 'users[0][surname]': 'griffin', + 'users[1][name]': 'Thomas', + 'users[1][surname]': 'Anderson' + } +```` + +If your backend body-parser (like `body-parser` of `express.js`) supports nested objects decoding, you will get the same object on the server-side automatically + +```js + var app = express(); + + app.use(bodyParser.urlencoded({ extended: true })); // support encoded bodies + + app.post('/', function (req, res, next) { + // echo body as JSON + res.send(JSON.stringify(req.body)); + }); + + server = app.listen(3000); +``` + +## Using `multipart/form-data` format + +### FormData + +To send the data as a `multipart/formdata` you need to pass a formData instance as a payload. +Setting the `Content-Type` header is not required as Axios guesses it based on the payload type. + +```js +const formData = new FormData(); +formData.append('foo', 'bar'); + +axios.post('https://httpbin.org/post', formData); +``` + +In node.js, you can use the [`form-data`](https://github.com/form-data/form-data) library as follows: + +```js +const FormData = require('form-data'); + +const form = new FormData(); +form.append('my_field', 'my value'); +form.append('my_buffer', new Buffer(10)); +form.append('my_file', fs.createReadStream('/foo/bar.jpg')); + +axios.post('https://example.com', form) +``` + +### 🆕 Automatic serialization to FormData + +Starting from `v0.27.0`, Axios supports automatic object serialization to a FormData object if the request `Content-Type` +header is set to `multipart/form-data`. + +The following request will submit the data in a FormData format (Browser & Node.js): + +```js +import axios from 'axios'; + +axios.post('https://httpbin.org/post', {x: 1}, { + headers: { + 'Content-Type': 'multipart/form-data' + } +}).then(({data}) => console.log(data)); +``` + +In the `node.js` build, the ([`form-data`](https://github.com/form-data/form-data)) polyfill is used by default. + +You can overload the FormData class by setting the `env.FormData` config variable, +but you probably won't need it in most cases: + +```js +const axios = require('axios'); +var FormData = require('form-data'); + +axios.post('https://httpbin.org/post', {x: 1, buf: new Buffer(10)}, { + headers: { + 'Content-Type': 'multipart/form-data' + } +}).then(({data}) => console.log(data)); +``` + +Axios FormData serializer supports some special endings to perform the following operations: + +- `{}` - serialize the value with JSON.stringify +- `[]` - unwrap the array-like object as separate fields with the same key + +> **Note**: unwrap/expand operation will be used by default on arrays and FileList objects + +FormData serializer supports additional options via `config.formSerializer: object` property to handle rare cases: + +- `visitor: Function` - user-defined visitor function that will be called recursively to serialize the data object +to a `FormData` object by following custom rules. + +- `dots: boolean = false` - use dot notation instead of brackets to serialize arrays and objects; + +- `metaTokens: boolean = true` - add the special ending (e.g `user{}: '{"name": "John"}'`) in the FormData key. +The back-end body-parser could potentially use this meta-information to automatically parse the value as JSON. + +- `indexes: null|false|true = false` - controls how indexes will be added to unwrapped keys of `flat` array-like objects + + - `null` - don't add brackets (`arr: 1`, `arr: 2`, `arr: 3`) + - `false`(default) - add empty brackets (`arr[]: 1`, `arr[]: 2`, `arr[]: 3`) + - `true` - add brackets with indexes (`arr[0]: 1`, `arr[1]: 2`, `arr[2]: 3`) + +Let's say we have an object like this one: + +```js +const obj = { + x: 1, + arr: [1, 2, 3], + arr2: [1, [2], 3], + users: [{name: 'Peter', surname: 'Griffin'}, {name: 'Thomas', surname: 'Anderson'}], + 'obj2{}': [{x:1}] +}; +``` + +The following steps will be executed by the Axios serializer internally: + +```js +const formData = new FormData(); +formData.append('x', '1'); +formData.append('arr[]', '1'); +formData.append('arr[]', '2'); +formData.append('arr[]', '3'); +formData.append('arr2[0]', '1'); +formData.append('arr2[1][0]', '2'); +formData.append('arr2[2]', '3'); +formData.append('users[0][name]', 'Peter'); +formData.append('users[0][surname]', 'Griffin'); +formData.append('users[1][name]', 'Thomas'); +formData.append('users[1][surname]', 'Anderson'); +formData.append('obj2{}', '[{"x":1}]'); +``` + +Axios supports the following shortcut methods: `postForm`, `putForm`, `patchForm` +which are just the corresponding http methods with the `Content-Type` header preset to `multipart/form-data`. + +## Files Posting + +You can easily submit a single file: + +```js +await axios.postForm('https://httpbin.org/post', { + 'myVar' : 'foo', + 'file': document.querySelector('#fileInput').files[0] +}); +``` + +or multiple files as `multipart/form-data`: + +```js +await axios.postForm('https://httpbin.org/post', { + 'files[]': document.querySelector('#fileInput').files +}); +``` + +`FileList` object can be passed directly: + +```js +await axios.postForm('https://httpbin.org/post', document.querySelector('#fileInput').files) +``` + +All files will be sent with the same field names: `files[]`. + +## 🆕 HTML Form Posting (browser) + +Pass HTML Form element as a payload to submit it as `multipart/form-data` content. + +```js +await axios.postForm('https://httpbin.org/post', document.querySelector('#htmlForm')); +``` + +`FormData` and `HTMLForm` objects can also be posted as `JSON` by explicitly setting the `Content-Type` header to `application/json`: + +```js +await axios.post('https://httpbin.org/post', document.querySelector('#htmlForm'), { + headers: { + 'Content-Type': 'application/json' + } +}) +``` + +For example, the Form + +```html +
+ + + + + + + + + +
+``` + +will be submitted as the following JSON object: + +```js +{ + "foo": "1", + "deep": { + "prop": { + "spaced": "3" + } + }, + "baz": [ + "4", + "5" + ], + "user": { + "age": "value2" + } +} +```` + +Sending `Blobs`/`Files` as JSON (`base64`) is not currently supported. + +## 🆕 Progress capturing + +Axios supports both browser and node environments to capture request upload/download progress. +The frequency of progress events is forced to be limited to `3` times per second. + +```js +await axios.post(url, data, { + onUploadProgress: function (axiosProgressEvent) { + /*{ + loaded: number; + total?: number; + progress?: number; // in range [0..1] + bytes: number; // how many bytes have been transferred since the last trigger (delta) + estimated?: number; // estimated time in seconds + rate?: number; // upload speed in bytes + upload: true; // upload sign + }*/ + }, + + onDownloadProgress: function (axiosProgressEvent) { + /*{ + loaded: number; + total?: number; + progress?: number; + bytes: number; + estimated?: number; + rate?: number; // download speed in bytes + download: true; // download sign + }*/ + } +}); +``` + +You can also track stream upload/download progress in node.js: + +```js +const {data} = await axios.post(SERVER_URL, readableStream, { + onUploadProgress: ({progress}) => { + console.log((progress * 100).toFixed(2)); + }, + + headers: { + 'Content-Length': contentLength + }, + + maxRedirects: 0 // avoid buffering the entire stream +}); +```` + +> **Note:** +> Capturing FormData upload progress is not currently supported in node.js environments. + +> **⚠️ Warning** +> It is recommended to disable redirects by setting maxRedirects: 0 to upload the stream in the **node.js** environment, +> as follow-redirects package will buffer the entire stream in RAM without following the "backpressure" algorithm. + + +## 🆕 Rate limiting + +Download and upload rate limits can only be set for the http adapter (node.js): + +```js +const {data} = await axios.post(LOCAL_SERVER_URL, myBuffer, { + onUploadProgress: ({progress, rate}) => { + console.log(`Upload [${(progress*100).toFixed(2)}%]: ${(rate / 1024).toFixed(2)}KB/s`) + }, + + maxRate: [100 * 1024], // 100KB/s limit +}); +``` + +## 🆕 AxiosHeaders + +Axios has its own `AxiosHeaders` class to manipulate headers using a Map-like API that guarantees caseless work. +Although HTTP is case-insensitive in headers, Axios will retain the case of the original header for stylistic reasons +and for a workaround when servers mistakenly consider the header's case. +The old approach of directly manipulating headers object is still available, but deprecated and not recommended for future usage. + +### Working with headers + +An AxiosHeaders object instance can contain different types of internal values. that control setting and merging logic. +The final headers object with string values is obtained by Axios by calling the `toJSON` method. + +> Note: By JSON here we mean an object consisting only of string values intended to be sent over the network. + +The header value can be one of the following types: +- `string` - normal string value that will be sent to the server +- `null` - skip header when rendering to JSON +- `false` - skip header when rendering to JSON, additionally indicates that `set` method must be called with `rewrite` option set to `true` + to overwrite this value (Axios uses this internally to allow users to opt out of installing certain headers like `User-Agent` or `Content-Type`) +- `undefined` - value is not set + +> Note: The header value is considered set if it is not equal to undefined. + +The headers object is always initialized inside interceptors and transformers: + +```ts + axios.interceptors.request.use((request: InternalAxiosRequestConfig) => { + request.headers.set('My-header', 'value'); + + request.headers.set({ + "My-set-header1": "my-set-value1", + "My-set-header2": "my-set-value2" + }); + + request.headers.set('User-Agent', false); // disable subsequent setting the header by Axios + + request.headers.setContentType('text/plain'); + + request.headers['My-set-header2'] = 'newValue' // direct access is deprecated + + return request; + } + ); +```` + +You can iterate over an `AxiosHeaders` instance using a `for...of` statement: + +````js +const headers = new AxiosHeaders({ + foo: '1', + bar: '2', + baz: '3' +}); + +for(const [header, value] of headers) { + console.log(header, value); +} + +// foo 1 +// bar 2 +// baz 3 +```` + +### new AxiosHeaders(headers?) + +Constructs a new `AxiosHeaders` instance. + +``` +constructor(headers?: RawAxiosHeaders | AxiosHeaders | string); +``` + +If the headers object is a string, it will be parsed as RAW HTTP headers. + +````js +const headers = new AxiosHeaders(` +Host: www.bing.com +User-Agent: curl/7.54.0 +Accept: */*`); + +console.log(headers); + +// Object [AxiosHeaders] { +// host: 'www.bing.com', +// 'user-agent': 'curl/7.54.0', +// accept: '*/*' +// } +```` + +### AxiosHeaders#set + +```ts +set(headerName, value: Axios, rewrite?: boolean); +set(headerName, value, rewrite?: (this: AxiosHeaders, value: string, name: string, headers: RawAxiosHeaders) => boolean); +set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean); +``` + +The `rewrite` argument controls the overwriting behavior: +- `false` - do not overwrite if header's value is set (is not `undefined`) +- `undefined` (default) - overwrite the header unless its value is set to `false` +- `true` - rewrite anyway + +The option can also accept a user-defined function that determines whether the value should be overwritten or not. + +Returns `this`. + +### AxiosHeaders#get(header) + +``` + get(headerName: string, matcher?: true | AxiosHeaderMatcher): AxiosHeaderValue; + get(headerName: string, parser: RegExp): RegExpExecArray | null; +```` + +Returns the internal value of the header. It can take an extra argument to parse the header's value with `RegExp.exec`, +matcher function or internal key-value parser. + +```ts +const headers = new AxiosHeaders({ + 'Content-Type': 'multipart/form-data; boundary=Asrf456BGe4h' +}); + +console.log(headers.get('Content-Type')); +// multipart/form-data; boundary=Asrf456BGe4h + +console.log(headers.get('Content-Type', true)); // parse key-value pairs from a string separated with \s,;= delimiters: +// [Object: null prototype] { +// 'multipart/form-data': undefined, +// boundary: 'Asrf456BGe4h' +// } + + +console.log(headers.get('Content-Type', (value, name, headers) => { + return String(value).replace(/a/g, 'ZZZ'); +})); +// multipZZZrt/form-dZZZtZZZ; boundZZZry=Asrf456BGe4h + +console.log(headers.get('Content-Type', /boundary=(\w+)/)?.[0]); +// boundary=Asrf456BGe4h + +``` + +Returns the value of the header. + +### AxiosHeaders#has(header, matcher?) + +``` +has(header: string, matcher?: AxiosHeaderMatcher): boolean; +``` + +Returns `true` if the header is set (has no `undefined` value). + +### AxiosHeaders#delete(header, matcher?) + +``` +delete(header: string | string[], matcher?: AxiosHeaderMatcher): boolean; +``` + +Returns `true` if at least one header has been removed. + +### AxiosHeaders#clear(matcher?) + +``` +clear(matcher?: AxiosHeaderMatcher): boolean; +``` + +Removes all headers. +Unlike the `delete` method matcher, this optional matcher will be used to match against the header name rather than the value. + +```ts +const headers = new AxiosHeaders({ + 'foo': '1', + 'x-foo': '2', + 'x-bar': '3', +}); + +console.log(headers.clear(/^x-/)); // true + +console.log(headers.toJSON()); // [Object: null prototype] { foo: '1' } +``` + +Returns `true` if at least one header has been cleared. + +### AxiosHeaders#normalize(format); + +If the headers object was changed directly, it can have duplicates with the same name but in different cases. +This method normalizes the headers object by combining duplicate keys into one. +Axios uses this method internally after calling each interceptor. +Set `format` to true for converting headers name to lowercase and capitalize the initial letters (`cOntEnt-type` => `Content-Type`) + +```js +const headers = new AxiosHeaders({ + 'foo': '1', +}); + +headers.Foo = '2'; +headers.FOO = '3'; + +console.log(headers.toJSON()); // [Object: null prototype] { foo: '1', Foo: '2', FOO: '3' } +console.log(headers.normalize().toJSON()); // [Object: null prototype] { foo: '3' } +console.log(headers.normalize(true).toJSON()); // [Object: null prototype] { Foo: '3' } +``` + +Returns `this`. + +### AxiosHeaders#concat(...targets) + +``` +concat(...targets: Array): AxiosHeaders; +``` + +Merges the instance with targets into a new `AxiosHeaders` instance. If the target is a string, it will be parsed as RAW HTTP headers. + +Returns a new `AxiosHeaders` instance. + +### AxiosHeaders#toJSON(asStrings?) + +```` +toJSON(asStrings?: boolean): RawAxiosHeaders; +```` + +Resolve all internal headers values into a new null prototype object. +Set `asStrings` to true to resolve arrays as a string containing all elements, separated by commas. + +### AxiosHeaders.from(thing?) + +```` +from(thing?: AxiosHeaders | RawAxiosHeaders | string): AxiosHeaders; +```` + +Returns a new `AxiosHeaders` instance created from the raw headers passed in, +or simply returns the given headers object if it's an `AxiosHeaders` instance. + +### AxiosHeaders.concat(...targets) + +```` +concat(...targets: Array): AxiosHeaders; +```` + +Returns a new `AxiosHeaders` instance created by merging the target objects. + +### Shortcuts + +The following shortcuts are available: + +- `setContentType`, `getContentType`, `hasContentType` + +- `setContentLength`, `getContentLength`, `hasContentLength` + +- `setAccept`, `getAccept`, `hasAccept` + +- `setUserAgent`, `getUserAgent`, `hasUserAgent` + +- `setContentEncoding`, `getContentEncoding`, `hasContentEncoding` + +## 🔥 Fetch adapter + +Fetch adapter was introduced in `v1.7.0`. By default, it will be used if `xhr` and `http` adapters are not available in the build, +or not supported by the environment. +To use it by default, it must be selected explicitly: + +```js +const {data} = axios.get(url, { + adapter: 'fetch' // by default ['xhr', 'http', 'fetch'] +}) +``` + +You can create a separate instance for this: + +```js +const fetchAxios = axios.create({ + adapter: 'fetch' +}); + +const {data} = fetchAxios.get(url); +``` + +The adapter supports the same functionality as `xhr` adapter, **including upload and download progress capturing**. +Also, it supports additional response types such as `stream` and `formdata` (if supported by the environment). + +## Semver + +Until axios reaches a `1.0` release, breaking changes will be released with a new minor version. For example `0.5.1`, and `0.5.4` will have the same API, but `0.6.0` will have breaking changes. + +## Promises + +axios depends on a native ES6 Promise implementation to be [supported](https://caniuse.com/promises). +If your environment doesn't support ES6 Promises, you can [polyfill](https://github.com/jakearchibald/es6-promise). + +## TypeScript + +axios includes [TypeScript](https://typescriptlang.org) definitions and a type guard for axios errors. + +```typescript +let user: User = null; +try { + const { data } = await axios.get('/user?ID=12345'); + user = data.userDetails; +} catch (error) { + if (axios.isAxiosError(error)) { + handleAxiosError(error); + } else { + handleUnexpectedError(error); + } +} +``` + +Because axios dual publishes with an ESM default export and a CJS `module.exports`, there are some caveats. +The recommended setting is to use `"moduleResolution": "node16"` (this is implied by `"module": "node16"`). Note that this requires TypeScript 4.7 or greater. +If use ESM, your settings should be fine. +If you compile TypeScript to CJS and you can’t use `"moduleResolution": "node 16"`, you have to enable `esModuleInterop`. +If you use TypeScript to type check CJS JavaScript code, your only option is to use `"moduleResolution": "node16"`. + +## Online one-click setup + +You can use Gitpod, an online IDE(which is free for Open Source) for contributing or running the examples online. + +[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/axios/axios/blob/main/examples/server.js) + + +## Resources + +* [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md) +* [Ecosystem](https://github.com/axios/axios/blob/v1.x/ECOSYSTEM.md) +* [Contributing Guide](https://github.com/axios/axios/blob/v1.x/CONTRIBUTING.md) +* [Code of Conduct](https://github.com/axios/axios/blob/v1.x/CODE_OF_CONDUCT.md) + +## Credits + +axios is heavily inspired by the [$http service](https://docs.angularjs.org/api/ng/service/$http) provided in [AngularJS](https://angularjs.org/). Ultimately axios is an effort to provide a standalone `$http`-like service for use outside of AngularJS. + +## License + +[MIT](LICENSE) diff --git a/project starter code/node_modules/axios/SECURITY.md b/project starter code/node_modules/axios/SECURITY.md new file mode 100644 index 00000000..a5a2b7d2 --- /dev/null +++ b/project starter code/node_modules/axios/SECURITY.md @@ -0,0 +1,6 @@ +# Reporting a Vulnerability + +If you discover a security vulnerability in axios please disclose it via [our huntr page](https://huntr.dev/repos/axios/axios/). Bounty eligibility, CVE assignment, response times and past reports are all there. + + +Thank you for improving the security of axios. diff --git a/project starter code/node_modules/axios/dist/axios.js b/project starter code/node_modules/axios/dist/axios.js new file mode 100644 index 00000000..88921735 --- /dev/null +++ b/project starter code/node_modules/axios/dist/axios.js @@ -0,0 +1,4172 @@ +// Axios v1.7.2 Copyright (c) 2024 Matt Zabriskie and contributors +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.axios = factory()); +})(this, (function () { 'use strict'; + + function _AsyncGenerator(e) { + var r, t; + function resume(r, t) { + try { + var n = e[r](t), + o = n.value, + u = o instanceof _OverloadYield; + Promise.resolve(u ? o.v : o).then(function (t) { + if (u) { + var i = "return" === r ? "return" : "next"; + if (!o.k || t.done) return resume(i, t); + t = e[i](t).value; + } + settle(n.done ? "return" : "normal", t); + }, function (e) { + resume("throw", e); + }); + } catch (e) { + settle("throw", e); + } + } + function settle(e, n) { + switch (e) { + case "return": + r.resolve({ + value: n, + done: !0 + }); + break; + case "throw": + r.reject(n); + break; + default: + r.resolve({ + value: n, + done: !1 + }); + } + (r = r.next) ? resume(r.key, r.arg) : t = null; + } + this._invoke = function (e, n) { + return new Promise(function (o, u) { + var i = { + key: e, + arg: n, + resolve: o, + reject: u, + next: null + }; + t ? t = t.next = i : (r = t = i, resume(e, n)); + }); + }, "function" != typeof e.return && (this.return = void 0); + } + _AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () { + return this; + }, _AsyncGenerator.prototype.next = function (e) { + return this._invoke("next", e); + }, _AsyncGenerator.prototype.throw = function (e) { + return this._invoke("throw", e); + }, _AsyncGenerator.prototype.return = function (e) { + return this._invoke("return", e); + }; + function _OverloadYield(t, e) { + this.v = t, this.k = e; + } + function _asyncGeneratorDelegate(t) { + var e = {}, + n = !1; + function pump(e, r) { + return n = !0, r = new Promise(function (n) { + n(t[e](r)); + }), { + done: !1, + value: new _OverloadYield(r, 1) + }; + } + return e["undefined" != typeof Symbol && Symbol.iterator || "@@iterator"] = function () { + return this; + }, e.next = function (t) { + return n ? (n = !1, t) : pump("next", t); + }, "function" == typeof t.throw && (e.throw = function (t) { + if (n) throw n = !1, t; + return pump("throw", t); + }), "function" == typeof t.return && (e.return = function (t) { + return n ? (n = !1, t) : pump("return", t); + }), e; + } + function _asyncIterator(r) { + var n, + t, + o, + e = 2; + for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) { + if (t && null != (n = r[t])) return n.call(r); + if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r)); + t = "@@asyncIterator", o = "@@iterator"; + } + throw new TypeError("Object is not async iterable"); + } + function AsyncFromSyncIterator(r) { + function AsyncFromSyncIteratorContinuation(r) { + if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object.")); + var n = r.done; + return Promise.resolve(r.value).then(function (r) { + return { + value: r, + done: n + }; + }); + } + return AsyncFromSyncIterator = function (r) { + this.s = r, this.n = r.next; + }, AsyncFromSyncIterator.prototype = { + s: null, + n: null, + next: function () { + return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments)); + }, + return: function (r) { + var n = this.s.return; + return void 0 === n ? Promise.resolve({ + value: r, + done: !0 + }) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); + }, + throw: function (r) { + var n = this.s.return; + return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments)); + } + }, new AsyncFromSyncIterator(r); + } + function _awaitAsyncGenerator(e) { + return new _OverloadYield(e, 0); + } + function _iterableToArrayLimit(r, l) { + var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; + if (null != t) { + var e, + n, + i, + u, + a = [], + f = !0, + o = !1; + try { + if (i = (t = t.call(r)).next, 0 === l) { + if (Object(t) !== t) return; + f = !1; + } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); + } catch (r) { + o = !0, n = r; + } finally { + try { + if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; + } finally { + if (o) throw n; + } + } + return a; + } + } + function ownKeys(e, r) { + var t = Object.keys(e); + if (Object.getOwnPropertySymbols) { + var o = Object.getOwnPropertySymbols(e); + r && (o = o.filter(function (r) { + return Object.getOwnPropertyDescriptor(e, r).enumerable; + })), t.push.apply(t, o); + } + return t; + } + function _objectSpread2(e) { + for (var r = 1; r < arguments.length; r++) { + var t = null != arguments[r] ? arguments[r] : {}; + r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { + _defineProperty(e, r, t[r]); + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { + Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); + }); + } + return e; + } + function _regeneratorRuntime() { + _regeneratorRuntime = function () { + return e; + }; + var t, + e = {}, + r = Object.prototype, + n = r.hasOwnProperty, + o = Object.defineProperty || function (t, e, r) { + t[e] = r.value; + }, + i = "function" == typeof Symbol ? Symbol : {}, + a = i.iterator || "@@iterator", + c = i.asyncIterator || "@@asyncIterator", + u = i.toStringTag || "@@toStringTag"; + function define(t, e, r) { + return Object.defineProperty(t, e, { + value: r, + enumerable: !0, + configurable: !0, + writable: !0 + }), t[e]; + } + try { + define({}, ""); + } catch (t) { + define = function (t, e, r) { + return t[e] = r; + }; + } + function wrap(t, e, r, n) { + var i = e && e.prototype instanceof Generator ? e : Generator, + a = Object.create(i.prototype), + c = new Context(n || []); + return o(a, "_invoke", { + value: makeInvokeMethod(t, r, c) + }), a; + } + function tryCatch(t, e, r) { + try { + return { + type: "normal", + arg: t.call(e, r) + }; + } catch (t) { + return { + type: "throw", + arg: t + }; + } + } + e.wrap = wrap; + var h = "suspendedStart", + l = "suspendedYield", + f = "executing", + s = "completed", + y = {}; + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + var p = {}; + define(p, a, function () { + return this; + }); + var d = Object.getPrototypeOf, + v = d && d(d(values([]))); + v && v !== r && n.call(v, a) && (p = v); + var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); + function defineIteratorMethods(t) { + ["next", "throw", "return"].forEach(function (e) { + define(t, e, function (t) { + return this._invoke(e, t); + }); + }); + } + function AsyncIterator(t, e) { + function invoke(r, o, i, a) { + var c = tryCatch(t[r], t, o); + if ("throw" !== c.type) { + var u = c.arg, + h = u.value; + return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { + invoke("next", t, i, a); + }, function (t) { + invoke("throw", t, i, a); + }) : e.resolve(h).then(function (t) { + u.value = t, i(u); + }, function (t) { + return invoke("throw", t, i, a); + }); + } + a(c.arg); + } + var r; + o(this, "_invoke", { + value: function (t, n) { + function callInvokeWithMethodAndArg() { + return new e(function (e, r) { + invoke(t, n, e, r); + }); + } + return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); + } + }); + } + function makeInvokeMethod(e, r, n) { + var o = h; + return function (i, a) { + if (o === f) throw new Error("Generator is already running"); + if (o === s) { + if ("throw" === i) throw a; + return { + value: t, + done: !0 + }; + } + for (n.method = i, n.arg = a;;) { + var c = n.delegate; + if (c) { + var u = maybeInvokeDelegate(c, n); + if (u) { + if (u === y) continue; + return u; + } + } + if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { + if (o === h) throw o = s, n.arg; + n.dispatchException(n.arg); + } else "return" === n.method && n.abrupt("return", n.arg); + o = f; + var p = tryCatch(e, r, n); + if ("normal" === p.type) { + if (o = n.done ? s : l, p.arg === y) continue; + return { + value: p.arg, + done: n.done + }; + } + "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); + } + }; + } + function maybeInvokeDelegate(e, r) { + var n = r.method, + o = e.iterator[n]; + if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; + var i = tryCatch(o, e.iterator, r.arg); + if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; + var a = i.arg; + return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); + } + function pushTryEntry(t) { + var e = { + tryLoc: t[0] + }; + 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); + } + function resetTryEntry(t) { + var e = t.completion || {}; + e.type = "normal", delete e.arg, t.completion = e; + } + function Context(t) { + this.tryEntries = [{ + tryLoc: "root" + }], t.forEach(pushTryEntry, this), this.reset(!0); + } + function values(e) { + if (e || "" === e) { + var r = e[a]; + if (r) return r.call(e); + if ("function" == typeof e.next) return e; + if (!isNaN(e.length)) { + var o = -1, + i = function next() { + for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; + return next.value = t, next.done = !0, next; + }; + return i.next = i; + } + } + throw new TypeError(typeof e + " is not iterable"); + } + return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { + value: GeneratorFunctionPrototype, + configurable: !0 + }), o(GeneratorFunctionPrototype, "constructor", { + value: GeneratorFunction, + configurable: !0 + }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { + var e = "function" == typeof t && t.constructor; + return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); + }, e.mark = function (t) { + return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; + }, e.awrap = function (t) { + return { + __await: t + }; + }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { + return this; + }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { + void 0 === i && (i = Promise); + var a = new AsyncIterator(wrap(t, r, n, o), i); + return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { + return t.done ? t.value : a.next(); + }); + }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { + return this; + }), define(g, "toString", function () { + return "[object Generator]"; + }), e.keys = function (t) { + var e = Object(t), + r = []; + for (var n in e) r.push(n); + return r.reverse(), function next() { + for (; r.length;) { + var t = r.pop(); + if (t in e) return next.value = t, next.done = !1, next; + } + return next.done = !0, next; + }; + }, e.values = values, Context.prototype = { + constructor: Context, + reset: function (e) { + if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); + }, + stop: function () { + this.done = !0; + var t = this.tryEntries[0].completion; + if ("throw" === t.type) throw t.arg; + return this.rval; + }, + dispatchException: function (e) { + if (this.done) throw e; + var r = this; + function handle(n, o) { + return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; + } + for (var o = this.tryEntries.length - 1; o >= 0; --o) { + var i = this.tryEntries[o], + a = i.completion; + if ("root" === i.tryLoc) return handle("end"); + if (i.tryLoc <= this.prev) { + var c = n.call(i, "catchLoc"), + u = n.call(i, "finallyLoc"); + if (c && u) { + if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); + if (this.prev < i.finallyLoc) return handle(i.finallyLoc); + } else if (c) { + if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); + } else { + if (!u) throw new Error("try statement without catch or finally"); + if (this.prev < i.finallyLoc) return handle(i.finallyLoc); + } + } + } + }, + abrupt: function (t, e) { + for (var r = this.tryEntries.length - 1; r >= 0; --r) { + var o = this.tryEntries[r]; + if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { + var i = o; + break; + } + } + i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); + var a = i ? i.completion : {}; + return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); + }, + complete: function (t, e) { + if ("throw" === t.type) throw t.arg; + return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; + }, + finish: function (t) { + for (var e = this.tryEntries.length - 1; e >= 0; --e) { + var r = this.tryEntries[e]; + if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; + } + }, + catch: function (t) { + for (var e = this.tryEntries.length - 1; e >= 0; --e) { + var r = this.tryEntries[e]; + if (r.tryLoc === t) { + var n = r.completion; + if ("throw" === n.type) { + var o = n.arg; + resetTryEntry(r); + } + return o; + } + } + throw new Error("illegal catch attempt"); + }, + delegateYield: function (e, r, n) { + return this.delegate = { + iterator: values(e), + resultName: r, + nextLoc: n + }, "next" === this.method && (this.arg = t), y; + } + }, e; + } + function _toPrimitive(t, r) { + if ("object" != typeof t || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != typeof i) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); + } + function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == typeof i ? i : String(i); + } + function _typeof(o) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { + return typeof o; + } : function (o) { + return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; + }, _typeof(o); + } + function _wrapAsyncGenerator(fn) { + return function () { + return new _AsyncGenerator(fn.apply(this, arguments)); + }; + } + function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { + try { + var info = gen[key](arg); + var value = info.value; + } catch (error) { + reject(error); + return; + } + if (info.done) { + resolve(value); + } else { + Promise.resolve(value).then(_next, _throw); + } + } + function _asyncToGenerator(fn) { + return function () { + var self = this, + args = arguments; + return new Promise(function (resolve, reject) { + var gen = fn.apply(self, args); + function _next(value) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); + } + function _throw(err) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); + } + _next(undefined); + }); + }; + } + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); + } + } + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + Object.defineProperty(Constructor, "prototype", { + writable: false + }); + return Constructor; + } + function _defineProperty(obj, key, value) { + key = _toPropertyKey(key); + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); + } + function _toArray(arr) { + return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); + } + function _toConsumableArray(arr) { + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); + } + function _arrayWithoutHoles(arr) { + if (Array.isArray(arr)) return _arrayLikeToArray(arr); + } + function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; + } + function _iterableToArray(iter) { + if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); + } + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + return arr2; + } + function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + function _createForOfIteratorHelper(o, allowArrayLike) { + var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; + if (!it) { + if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + var i = 0; + var F = function () {}; + return { + s: F, + n: function () { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[i++] + }; + }, + e: function (e) { + throw e; + }, + f: F + }; + } + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + var normalCompletion = true, + didErr = false, + err; + return { + s: function () { + it = it.call(o); + }, + n: function () { + var step = it.next(); + normalCompletion = step.done; + return step; + }, + e: function (e) { + didErr = true; + err = e; + }, + f: function () { + try { + if (!normalCompletion && it.return != null) it.return(); + } finally { + if (didErr) throw err; + } + } + }; + } + + function bind(fn, thisArg) { + return function wrap() { + return fn.apply(thisArg, arguments); + }; + } + + // utils is a library of generic helper functions non-specific to axios + + var toString = Object.prototype.toString; + var getPrototypeOf = Object.getPrototypeOf; + var kindOf = function (cache) { + return function (thing) { + var str = toString.call(thing); + return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase()); + }; + }(Object.create(null)); + var kindOfTest = function kindOfTest(type) { + type = type.toLowerCase(); + return function (thing) { + return kindOf(thing) === type; + }; + }; + var typeOfTest = function typeOfTest(type) { + return function (thing) { + return _typeof(thing) === type; + }; + }; + + /** + * Determine if a value is an Array + * + * @param {Object} val The value to test + * + * @returns {boolean} True if value is an Array, otherwise false + */ + var isArray = Array.isArray; + + /** + * Determine if a value is undefined + * + * @param {*} val The value to test + * + * @returns {boolean} True if the value is undefined, otherwise false + */ + var isUndefined = typeOfTest('undefined'); + + /** + * Determine if a value is a Buffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Buffer, otherwise false + */ + function isBuffer(val) { + return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val); + } + + /** + * Determine if a value is an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is an ArrayBuffer, otherwise false + */ + var isArrayBuffer = kindOfTest('ArrayBuffer'); + + /** + * Determine if a value is a view on an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false + */ + function isArrayBufferView(val) { + var result; + if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) { + result = ArrayBuffer.isView(val); + } else { + result = val && val.buffer && isArrayBuffer(val.buffer); + } + return result; + } + + /** + * Determine if a value is a String + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a String, otherwise false + */ + var isString = typeOfTest('string'); + + /** + * Determine if a value is a Function + * + * @param {*} val The value to test + * @returns {boolean} True if value is a Function, otherwise false + */ + var isFunction = typeOfTest('function'); + + /** + * Determine if a value is a Number + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Number, otherwise false + */ + var isNumber = typeOfTest('number'); + + /** + * Determine if a value is an Object + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an Object, otherwise false + */ + var isObject = function isObject(thing) { + return thing !== null && _typeof(thing) === 'object'; + }; + + /** + * Determine if a value is a Boolean + * + * @param {*} thing The value to test + * @returns {boolean} True if value is a Boolean, otherwise false + */ + var isBoolean = function isBoolean(thing) { + return thing === true || thing === false; + }; + + /** + * Determine if a value is a plain Object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a plain Object, otherwise false + */ + var isPlainObject = function isPlainObject(val) { + if (kindOf(val) !== 'object') { + return false; + } + var prototype = getPrototypeOf(val); + return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val); + }; + + /** + * Determine if a value is a Date + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Date, otherwise false + */ + var isDate = kindOfTest('Date'); + + /** + * Determine if a value is a File + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ + var isFile = kindOfTest('File'); + + /** + * Determine if a value is a Blob + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Blob, otherwise false + */ + var isBlob = kindOfTest('Blob'); + + /** + * Determine if a value is a FileList + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ + var isFileList = kindOfTest('FileList'); + + /** + * Determine if a value is a Stream + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Stream, otherwise false + */ + var isStream = function isStream(val) { + return isObject(val) && isFunction(val.pipe); + }; + + /** + * Determine if a value is a FormData + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an FormData, otherwise false + */ + var isFormData = function isFormData(thing) { + var kind; + return thing && (typeof FormData === 'function' && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === 'formdata' || + // detect form-data instance + kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')); + }; + + /** + * Determine if a value is a URLSearchParams object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a URLSearchParams object, otherwise false + */ + var isURLSearchParams = kindOfTest('URLSearchParams'); + var _map = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest), + _map2 = _slicedToArray(_map, 4), + isReadableStream = _map2[0], + isRequest = _map2[1], + isResponse = _map2[2], + isHeaders = _map2[3]; + + /** + * Trim excess whitespace off the beginning and end of a string + * + * @param {String} str The String to trim + * + * @returns {String} The String freed of excess whitespace + */ + var trim = function trim(str) { + return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + }; + + /** + * Iterate over an Array or an Object invoking a function for each item. + * + * If `obj` is an Array callback will be called passing + * the value, index, and complete array for each item. + * + * If 'obj' is an Object callback will be called passing + * the value, key, and complete object for each property. + * + * @param {Object|Array} obj The object to iterate + * @param {Function} fn The callback to invoke for each item + * + * @param {Boolean} [allOwnKeys = false] + * @returns {any} + */ + function forEach(obj, fn) { + var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, + _ref$allOwnKeys = _ref.allOwnKeys, + allOwnKeys = _ref$allOwnKeys === void 0 ? false : _ref$allOwnKeys; + // Don't bother if no value provided + if (obj === null || typeof obj === 'undefined') { + return; + } + var i; + var l; + + // Force an array if not already something iterable + if (_typeof(obj) !== 'object') { + /*eslint no-param-reassign:0*/ + obj = [obj]; + } + if (isArray(obj)) { + // Iterate over array values + for (i = 0, l = obj.length; i < l; i++) { + fn.call(null, obj[i], i, obj); + } + } else { + // Iterate over object keys + var keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj); + var len = keys.length; + var key; + for (i = 0; i < len; i++) { + key = keys[i]; + fn.call(null, obj[key], key, obj); + } + } + } + function findKey(obj, key) { + key = key.toLowerCase(); + var keys = Object.keys(obj); + var i = keys.length; + var _key; + while (i-- > 0) { + _key = keys[i]; + if (key === _key.toLowerCase()) { + return _key; + } + } + return null; + } + var _global = function () { + /*eslint no-undef:0*/ + if (typeof globalThis !== "undefined") return globalThis; + return typeof self !== "undefined" ? self : typeof window !== 'undefined' ? window : global; + }(); + var isContextDefined = function isContextDefined(context) { + return !isUndefined(context) && context !== _global; + }; + + /** + * Accepts varargs expecting each argument to be an object, then + * immutably merges the properties of each object and returns result. + * + * When multiple objects contain the same key the later object in + * the arguments list will take precedence. + * + * Example: + * + * ```js + * var result = merge({foo: 123}, {foo: 456}); + * console.log(result.foo); // outputs 456 + * ``` + * + * @param {Object} obj1 Object to merge + * + * @returns {Object} Result of all merge properties + */ + function merge( /* obj1, obj2, obj3, ... */ + ) { + var _ref2 = isContextDefined(this) && this || {}, + caseless = _ref2.caseless; + var result = {}; + var assignValue = function assignValue(val, key) { + var targetKey = caseless && findKey(result, key) || key; + if (isPlainObject(result[targetKey]) && isPlainObject(val)) { + result[targetKey] = merge(result[targetKey], val); + } else if (isPlainObject(val)) { + result[targetKey] = merge({}, val); + } else if (isArray(val)) { + result[targetKey] = val.slice(); + } else { + result[targetKey] = val; + } + }; + for (var i = 0, l = arguments.length; i < l; i++) { + arguments[i] && forEach(arguments[i], assignValue); + } + return result; + } + + /** + * Extends object a by mutably adding to it the properties of object b. + * + * @param {Object} a The object to be extended + * @param {Object} b The object to copy properties from + * @param {Object} thisArg The object to bind function to + * + * @param {Boolean} [allOwnKeys] + * @returns {Object} The resulting value of object a + */ + var extend = function extend(a, b, thisArg) { + var _ref3 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}, + allOwnKeys = _ref3.allOwnKeys; + forEach(b, function (val, key) { + if (thisArg && isFunction(val)) { + a[key] = bind(val, thisArg); + } else { + a[key] = val; + } + }, { + allOwnKeys: allOwnKeys + }); + return a; + }; + + /** + * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) + * + * @param {string} content with BOM + * + * @returns {string} content value without BOM + */ + var stripBOM = function stripBOM(content) { + if (content.charCodeAt(0) === 0xFEFF) { + content = content.slice(1); + } + return content; + }; + + /** + * Inherit the prototype methods from one constructor into another + * @param {function} constructor + * @param {function} superConstructor + * @param {object} [props] + * @param {object} [descriptors] + * + * @returns {void} + */ + var inherits = function inherits(constructor, superConstructor, props, descriptors) { + constructor.prototype = Object.create(superConstructor.prototype, descriptors); + constructor.prototype.constructor = constructor; + Object.defineProperty(constructor, 'super', { + value: superConstructor.prototype + }); + props && Object.assign(constructor.prototype, props); + }; + + /** + * Resolve object with deep prototype chain to a flat object + * @param {Object} sourceObj source object + * @param {Object} [destObj] + * @param {Function|Boolean} [filter] + * @param {Function} [propFilter] + * + * @returns {Object} + */ + var toFlatObject = function toFlatObject(sourceObj, destObj, filter, propFilter) { + var props; + var i; + var prop; + var merged = {}; + destObj = destObj || {}; + // eslint-disable-next-line no-eq-null,eqeqeq + if (sourceObj == null) return destObj; + do { + props = Object.getOwnPropertyNames(sourceObj); + i = props.length; + while (i-- > 0) { + prop = props[i]; + if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) { + destObj[prop] = sourceObj[prop]; + merged[prop] = true; + } + } + sourceObj = filter !== false && getPrototypeOf(sourceObj); + } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype); + return destObj; + }; + + /** + * Determines whether a string ends with the characters of a specified string + * + * @param {String} str + * @param {String} searchString + * @param {Number} [position= 0] + * + * @returns {boolean} + */ + var endsWith = function endsWith(str, searchString, position) { + str = String(str); + if (position === undefined || position > str.length) { + position = str.length; + } + position -= searchString.length; + var lastIndex = str.indexOf(searchString, position); + return lastIndex !== -1 && lastIndex === position; + }; + + /** + * Returns new array from array like object or null if failed + * + * @param {*} [thing] + * + * @returns {?Array} + */ + var toArray = function toArray(thing) { + if (!thing) return null; + if (isArray(thing)) return thing; + var i = thing.length; + if (!isNumber(i)) return null; + var arr = new Array(i); + while (i-- > 0) { + arr[i] = thing[i]; + } + return arr; + }; + + /** + * Checking if the Uint8Array exists and if it does, it returns a function that checks if the + * thing passed in is an instance of Uint8Array + * + * @param {TypedArray} + * + * @returns {Array} + */ + // eslint-disable-next-line func-names + var isTypedArray = function (TypedArray) { + // eslint-disable-next-line func-names + return function (thing) { + return TypedArray && thing instanceof TypedArray; + }; + }(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array)); + + /** + * For each entry in the object, call the function with the key and value. + * + * @param {Object} obj - The object to iterate over. + * @param {Function} fn - The function to call for each entry. + * + * @returns {void} + */ + var forEachEntry = function forEachEntry(obj, fn) { + var generator = obj && obj[Symbol.iterator]; + var iterator = generator.call(obj); + var result; + while ((result = iterator.next()) && !result.done) { + var pair = result.value; + fn.call(obj, pair[0], pair[1]); + } + }; + + /** + * It takes a regular expression and a string, and returns an array of all the matches + * + * @param {string} regExp - The regular expression to match against. + * @param {string} str - The string to search. + * + * @returns {Array} + */ + var matchAll = function matchAll(regExp, str) { + var matches; + var arr = []; + while ((matches = regExp.exec(str)) !== null) { + arr.push(matches); + } + return arr; + }; + + /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */ + var isHTMLForm = kindOfTest('HTMLFormElement'); + var toCamelCase = function toCamelCase(str) { + return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) { + return p1.toUpperCase() + p2; + }); + }; + + /* Creating a function that will check if an object has a property. */ + var hasOwnProperty = function (_ref4) { + var hasOwnProperty = _ref4.hasOwnProperty; + return function (obj, prop) { + return hasOwnProperty.call(obj, prop); + }; + }(Object.prototype); + + /** + * Determine if a value is a RegExp object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a RegExp object, otherwise false + */ + var isRegExp = kindOfTest('RegExp'); + var reduceDescriptors = function reduceDescriptors(obj, reducer) { + var descriptors = Object.getOwnPropertyDescriptors(obj); + var reducedDescriptors = {}; + forEach(descriptors, function (descriptor, name) { + var ret; + if ((ret = reducer(descriptor, name, obj)) !== false) { + reducedDescriptors[name] = ret || descriptor; + } + }); + Object.defineProperties(obj, reducedDescriptors); + }; + + /** + * Makes all methods read-only + * @param {Object} obj + */ + + var freezeMethods = function freezeMethods(obj) { + reduceDescriptors(obj, function (descriptor, name) { + // skip restricted props in strict mode + if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) { + return false; + } + var value = obj[name]; + if (!isFunction(value)) return; + descriptor.enumerable = false; + if ('writable' in descriptor) { + descriptor.writable = false; + return; + } + if (!descriptor.set) { + descriptor.set = function () { + throw Error('Can not rewrite read-only method \'' + name + '\''); + }; + } + }); + }; + var toObjectSet = function toObjectSet(arrayOrString, delimiter) { + var obj = {}; + var define = function define(arr) { + arr.forEach(function (value) { + obj[value] = true; + }); + }; + isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter)); + return obj; + }; + var noop = function noop() {}; + var toFiniteNumber = function toFiniteNumber(value, defaultValue) { + return value != null && Number.isFinite(value = +value) ? value : defaultValue; + }; + var ALPHA = 'abcdefghijklmnopqrstuvwxyz'; + var DIGIT = '0123456789'; + var ALPHABET = { + DIGIT: DIGIT, + ALPHA: ALPHA, + ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT + }; + var generateString = function generateString() { + var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 16; + var alphabet = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ALPHABET.ALPHA_DIGIT; + var str = ''; + var length = alphabet.length; + while (size--) { + str += alphabet[Math.random() * length | 0]; + } + return str; + }; + + /** + * If the thing is a FormData object, return true, otherwise return false. + * + * @param {unknown} thing - The thing to check. + * + * @returns {boolean} + */ + function isSpecCompliantForm(thing) { + return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]); + } + var toJSONObject = function toJSONObject(obj) { + var stack = new Array(10); + var visit = function visit(source, i) { + if (isObject(source)) { + if (stack.indexOf(source) >= 0) { + return; + } + if (!('toJSON' in source)) { + stack[i] = source; + var target = isArray(source) ? [] : {}; + forEach(source, function (value, key) { + var reducedValue = visit(value, i + 1); + !isUndefined(reducedValue) && (target[key] = reducedValue); + }); + stack[i] = undefined; + return target; + } + } + return source; + }; + return visit(obj, 0); + }; + var isAsyncFn = kindOfTest('AsyncFunction'); + var isThenable = function isThenable(thing) { + return thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing["catch"]); + }; + var utils$1 = { + isArray: isArray, + isArrayBuffer: isArrayBuffer, + isBuffer: isBuffer, + isFormData: isFormData, + isArrayBufferView: isArrayBufferView, + isString: isString, + isNumber: isNumber, + isBoolean: isBoolean, + isObject: isObject, + isPlainObject: isPlainObject, + isReadableStream: isReadableStream, + isRequest: isRequest, + isResponse: isResponse, + isHeaders: isHeaders, + isUndefined: isUndefined, + isDate: isDate, + isFile: isFile, + isBlob: isBlob, + isRegExp: isRegExp, + isFunction: isFunction, + isStream: isStream, + isURLSearchParams: isURLSearchParams, + isTypedArray: isTypedArray, + isFileList: isFileList, + forEach: forEach, + merge: merge, + extend: extend, + trim: trim, + stripBOM: stripBOM, + inherits: inherits, + toFlatObject: toFlatObject, + kindOf: kindOf, + kindOfTest: kindOfTest, + endsWith: endsWith, + toArray: toArray, + forEachEntry: forEachEntry, + matchAll: matchAll, + isHTMLForm: isHTMLForm, + hasOwnProperty: hasOwnProperty, + hasOwnProp: hasOwnProperty, + // an alias to avoid ESLint no-prototype-builtins detection + reduceDescriptors: reduceDescriptors, + freezeMethods: freezeMethods, + toObjectSet: toObjectSet, + toCamelCase: toCamelCase, + noop: noop, + toFiniteNumber: toFiniteNumber, + findKey: findKey, + global: _global, + isContextDefined: isContextDefined, + ALPHABET: ALPHABET, + generateString: generateString, + isSpecCompliantForm: isSpecCompliantForm, + toJSONObject: toJSONObject, + isAsyncFn: isAsyncFn, + isThenable: isThenable + }; + + /** + * Create an Error with the specified message, config, error code, request and response. + * + * @param {string} message The error message. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [config] The config. + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * + * @returns {Error} The created error. + */ + function AxiosError(message, code, config, request, response) { + Error.call(this); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } else { + this.stack = new Error().stack; + } + this.message = message; + this.name = 'AxiosError'; + code && (this.code = code); + config && (this.config = config); + request && (this.request = request); + response && (this.response = response); + } + utils$1.inherits(AxiosError, Error, { + toJSON: function toJSON() { + return { + // Standard + message: this.message, + name: this.name, + // Microsoft + description: this.description, + number: this.number, + // Mozilla + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + // Axios + config: utils$1.toJSONObject(this.config), + code: this.code, + status: this.response && this.response.status ? this.response.status : null + }; + } + }); + var prototype$1 = AxiosError.prototype; + var descriptors = {}; + ['ERR_BAD_OPTION_VALUE', 'ERR_BAD_OPTION', 'ECONNABORTED', 'ETIMEDOUT', 'ERR_NETWORK', 'ERR_FR_TOO_MANY_REDIRECTS', 'ERR_DEPRECATED', 'ERR_BAD_RESPONSE', 'ERR_BAD_REQUEST', 'ERR_CANCELED', 'ERR_NOT_SUPPORT', 'ERR_INVALID_URL' + // eslint-disable-next-line func-names + ].forEach(function (code) { + descriptors[code] = { + value: code + }; + }); + Object.defineProperties(AxiosError, descriptors); + Object.defineProperty(prototype$1, 'isAxiosError', { + value: true + }); + + // eslint-disable-next-line func-names + AxiosError.from = function (error, code, config, request, response, customProps) { + var axiosError = Object.create(prototype$1); + utils$1.toFlatObject(error, axiosError, function filter(obj) { + return obj !== Error.prototype; + }, function (prop) { + return prop !== 'isAxiosError'; + }); + AxiosError.call(axiosError, error.message, code, config, request, response); + axiosError.cause = error; + axiosError.name = error.name; + customProps && Object.assign(axiosError, customProps); + return axiosError; + }; + + // eslint-disable-next-line strict + var httpAdapter = null; + + /** + * Determines if the given thing is a array or js object. + * + * @param {string} thing - The object or array to be visited. + * + * @returns {boolean} + */ + function isVisitable(thing) { + return utils$1.isPlainObject(thing) || utils$1.isArray(thing); + } + + /** + * It removes the brackets from the end of a string + * + * @param {string} key - The key of the parameter. + * + * @returns {string} the key without the brackets. + */ + function removeBrackets(key) { + return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key; + } + + /** + * It takes a path, a key, and a boolean, and returns a string + * + * @param {string} path - The path to the current key. + * @param {string} key - The key of the current object being iterated over. + * @param {string} dots - If true, the key will be rendered with dots instead of brackets. + * + * @returns {string} The path to the current key. + */ + function renderKey(path, key, dots) { + if (!path) return key; + return path.concat(key).map(function each(token, i) { + // eslint-disable-next-line no-param-reassign + token = removeBrackets(token); + return !dots && i ? '[' + token + ']' : token; + }).join(dots ? '.' : ''); + } + + /** + * If the array is an array and none of its elements are visitable, then it's a flat array. + * + * @param {Array} arr - The array to check + * + * @returns {boolean} + */ + function isFlatArray(arr) { + return utils$1.isArray(arr) && !arr.some(isVisitable); + } + var predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) { + return /^is[A-Z]/.test(prop); + }); + + /** + * Convert a data object to FormData + * + * @param {Object} obj + * @param {?Object} [formData] + * @param {?Object} [options] + * @param {Function} [options.visitor] + * @param {Boolean} [options.metaTokens = true] + * @param {Boolean} [options.dots = false] + * @param {?Boolean} [options.indexes = false] + * + * @returns {Object} + **/ + + /** + * It converts an object into a FormData object + * + * @param {Object} obj - The object to convert to form data. + * @param {string} formData - The FormData object to append to. + * @param {Object} options + * + * @returns + */ + function toFormData(obj, formData, options) { + if (!utils$1.isObject(obj)) { + throw new TypeError('target must be an object'); + } + + // eslint-disable-next-line no-param-reassign + formData = formData || new (FormData)(); + + // eslint-disable-next-line no-param-reassign + options = utils$1.toFlatObject(options, { + metaTokens: true, + dots: false, + indexes: false + }, false, function defined(option, source) { + // eslint-disable-next-line no-eq-null,eqeqeq + return !utils$1.isUndefined(source[option]); + }); + var metaTokens = options.metaTokens; + // eslint-disable-next-line no-use-before-define + var visitor = options.visitor || defaultVisitor; + var dots = options.dots; + var indexes = options.indexes; + var _Blob = options.Blob || typeof Blob !== 'undefined' && Blob; + var useBlob = _Blob && utils$1.isSpecCompliantForm(formData); + if (!utils$1.isFunction(visitor)) { + throw new TypeError('visitor must be a function'); + } + function convertValue(value) { + if (value === null) return ''; + if (utils$1.isDate(value)) { + return value.toISOString(); + } + if (!useBlob && utils$1.isBlob(value)) { + throw new AxiosError('Blob is not supported. Use a Buffer instead.'); + } + if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) { + return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value); + } + return value; + } + + /** + * Default visitor. + * + * @param {*} value + * @param {String|Number} key + * @param {Array} path + * @this {FormData} + * + * @returns {boolean} return true to visit the each prop of the value recursively + */ + function defaultVisitor(value, key, path) { + var arr = value; + if (value && !path && _typeof(value) === 'object') { + if (utils$1.endsWith(key, '{}')) { + // eslint-disable-next-line no-param-reassign + key = metaTokens ? key : key.slice(0, -2); + // eslint-disable-next-line no-param-reassign + value = JSON.stringify(value); + } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))) { + // eslint-disable-next-line no-param-reassign + key = removeBrackets(key); + arr.forEach(function each(el, index) { + !(utils$1.isUndefined(el) || el === null) && formData.append( + // eslint-disable-next-line no-nested-ternary + indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + '[]', convertValue(el)); + }); + return false; + } + } + if (isVisitable(value)) { + return true; + } + formData.append(renderKey(path, key, dots), convertValue(value)); + return false; + } + var stack = []; + var exposedHelpers = Object.assign(predicates, { + defaultVisitor: defaultVisitor, + convertValue: convertValue, + isVisitable: isVisitable + }); + function build(value, path) { + if (utils$1.isUndefined(value)) return; + if (stack.indexOf(value) !== -1) { + throw Error('Circular reference detected in ' + path.join('.')); + } + stack.push(value); + utils$1.forEach(value, function each(el, key) { + var result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers); + if (result === true) { + build(el, path ? path.concat(key) : [key]); + } + }); + stack.pop(); + } + if (!utils$1.isObject(obj)) { + throw new TypeError('data must be an object'); + } + build(obj); + return formData; + } + + /** + * It encodes a string by replacing all characters that are not in the unreserved set with + * their percent-encoded equivalents + * + * @param {string} str - The string to encode. + * + * @returns {string} The encoded string. + */ + function encode$1(str) { + var charMap = { + '!': '%21', + "'": '%27', + '(': '%28', + ')': '%29', + '~': '%7E', + '%20': '+', + '%00': '\x00' + }; + return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) { + return charMap[match]; + }); + } + + /** + * It takes a params object and converts it to a FormData object + * + * @param {Object} params - The parameters to be converted to a FormData object. + * @param {Object} options - The options object passed to the Axios constructor. + * + * @returns {void} + */ + function AxiosURLSearchParams(params, options) { + this._pairs = []; + params && toFormData(params, this, options); + } + var prototype = AxiosURLSearchParams.prototype; + prototype.append = function append(name, value) { + this._pairs.push([name, value]); + }; + prototype.toString = function toString(encoder) { + var _encode = encoder ? function (value) { + return encoder.call(this, value, encode$1); + } : encode$1; + return this._pairs.map(function each(pair) { + return _encode(pair[0]) + '=' + _encode(pair[1]); + }, '').join('&'); + }; + + /** + * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their + * URI encoded counterparts + * + * @param {string} val The value to be encoded. + * + * @returns {string} The encoded value. + */ + function encode(val) { + return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']'); + } + + /** + * Build a URL by appending params to the end + * + * @param {string} url The base of the url (e.g., http://www.google.com) + * @param {object} [params] The params to be appended + * @param {?object} options + * + * @returns {string} The formatted url + */ + function buildURL(url, params, options) { + /*eslint no-param-reassign:0*/ + if (!params) { + return url; + } + var _encode = options && options.encode || encode; + var serializeFn = options && options.serialize; + var serializedParams; + if (serializeFn) { + serializedParams = serializeFn(params, options); + } else { + serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode); + } + if (serializedParams) { + var hashmarkIndex = url.indexOf("#"); + if (hashmarkIndex !== -1) { + url = url.slice(0, hashmarkIndex); + } + url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; + } + return url; + } + + var InterceptorManager = /*#__PURE__*/function () { + function InterceptorManager() { + _classCallCheck(this, InterceptorManager); + this.handlers = []; + } + + /** + * Add a new interceptor to the stack + * + * @param {Function} fulfilled The function to handle `then` for a `Promise` + * @param {Function} rejected The function to handle `reject` for a `Promise` + * + * @return {Number} An ID used to remove interceptor later + */ + _createClass(InterceptorManager, [{ + key: "use", + value: function use(fulfilled, rejected, options) { + this.handlers.push({ + fulfilled: fulfilled, + rejected: rejected, + synchronous: options ? options.synchronous : false, + runWhen: options ? options.runWhen : null + }); + return this.handlers.length - 1; + } + + /** + * Remove an interceptor from the stack + * + * @param {Number} id The ID that was returned by `use` + * + * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise + */ + }, { + key: "eject", + value: function eject(id) { + if (this.handlers[id]) { + this.handlers[id] = null; + } + } + + /** + * Clear all interceptors from the stack + * + * @returns {void} + */ + }, { + key: "clear", + value: function clear() { + if (this.handlers) { + this.handlers = []; + } + } + + /** + * Iterate over all the registered interceptors + * + * This method is particularly useful for skipping over any + * interceptors that may have become `null` calling `eject`. + * + * @param {Function} fn The function to call for each interceptor + * + * @returns {void} + */ + }, { + key: "forEach", + value: function forEach(fn) { + utils$1.forEach(this.handlers, function forEachHandler(h) { + if (h !== null) { + fn(h); + } + }); + } + }]); + return InterceptorManager; + }(); + var InterceptorManager$1 = InterceptorManager; + + var transitionalDefaults = { + silentJSONParsing: true, + forcedJSONParsing: true, + clarifyTimeoutError: false + }; + + var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams; + + var FormData$1 = typeof FormData !== 'undefined' ? FormData : null; + + var Blob$1 = typeof Blob !== 'undefined' ? Blob : null; + + var platform$1 = { + isBrowser: true, + classes: { + URLSearchParams: URLSearchParams$1, + FormData: FormData$1, + Blob: Blob$1 + }, + protocols: ['http', 'https', 'file', 'blob', 'url', 'data'] + }; + + var hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined'; + + /** + * Determine if we're running in a standard browser environment + * + * This allows axios to run in a web worker, and react-native. + * Both environments support XMLHttpRequest, but not fully standard globals. + * + * web workers: + * typeof window -> undefined + * typeof document -> undefined + * + * react-native: + * navigator.product -> 'ReactNative' + * nativescript + * navigator.product -> 'NativeScript' or 'NS' + * + * @returns {boolean} + */ + var hasStandardBrowserEnv = function (product) { + return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0; + }(typeof navigator !== 'undefined' && navigator.product); + + /** + * Determine if we're running in a standard browser webWorker environment + * + * Although the `isStandardBrowserEnv` method indicates that + * `allows axios to run in a web worker`, the WebWorker will still be + * filtered out due to its judgment standard + * `typeof window !== 'undefined' && typeof document !== 'undefined'`. + * This leads to a problem when axios post `FormData` in webWorker + */ + var hasStandardBrowserWebWorkerEnv = function () { + return typeof WorkerGlobalScope !== 'undefined' && + // eslint-disable-next-line no-undef + self instanceof WorkerGlobalScope && typeof self.importScripts === 'function'; + }(); + var origin = hasBrowserEnv && window.location.href || 'http://localhost'; + + var utils = /*#__PURE__*/Object.freeze({ + __proto__: null, + hasBrowserEnv: hasBrowserEnv, + hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv, + hasStandardBrowserEnv: hasStandardBrowserEnv, + origin: origin + }); + + var platform = _objectSpread2(_objectSpread2({}, utils), platform$1); + + function toURLEncodedForm(data, options) { + return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({ + visitor: function visitor(value, key, path, helpers) { + if (platform.isNode && utils$1.isBuffer(value)) { + this.append(key, value.toString('base64')); + return false; + } + return helpers.defaultVisitor.apply(this, arguments); + } + }, options)); + } + + /** + * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z'] + * + * @param {string} name - The name of the property to get. + * + * @returns An array of strings. + */ + function parsePropPath(name) { + // foo[x][y][z] + // foo.x.y.z + // foo-x-y-z + // foo x y z + return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(function (match) { + return match[0] === '[]' ? '' : match[1] || match[0]; + }); + } + + /** + * Convert an array to an object. + * + * @param {Array} arr - The array to convert to an object. + * + * @returns An object with the same keys and values as the array. + */ + function arrayToObject(arr) { + var obj = {}; + var keys = Object.keys(arr); + var i; + var len = keys.length; + var key; + for (i = 0; i < len; i++) { + key = keys[i]; + obj[key] = arr[key]; + } + return obj; + } + + /** + * It takes a FormData object and returns a JavaScript object + * + * @param {string} formData The FormData object to convert to JSON. + * + * @returns {Object | null} The converted object. + */ + function formDataToJSON(formData) { + function buildPath(path, value, target, index) { + var name = path[index++]; + if (name === '__proto__') return true; + var isNumericKey = Number.isFinite(+name); + var isLast = index >= path.length; + name = !name && utils$1.isArray(target) ? target.length : name; + if (isLast) { + if (utils$1.hasOwnProp(target, name)) { + target[name] = [target[name], value]; + } else { + target[name] = value; + } + return !isNumericKey; + } + if (!target[name] || !utils$1.isObject(target[name])) { + target[name] = []; + } + var result = buildPath(path, value, target[name], index); + if (result && utils$1.isArray(target[name])) { + target[name] = arrayToObject(target[name]); + } + return !isNumericKey; + } + if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) { + var obj = {}; + utils$1.forEachEntry(formData, function (name, value) { + buildPath(parsePropPath(name), value, obj, 0); + }); + return obj; + } + return null; + } + + /** + * It takes a string, tries to parse it, and if it fails, it returns the stringified version + * of the input + * + * @param {any} rawValue - The value to be stringified. + * @param {Function} parser - A function that parses a string into a JavaScript object. + * @param {Function} encoder - A function that takes a value and returns a string. + * + * @returns {string} A stringified version of the rawValue. + */ + function stringifySafely(rawValue, parser, encoder) { + if (utils$1.isString(rawValue)) { + try { + (parser || JSON.parse)(rawValue); + return utils$1.trim(rawValue); + } catch (e) { + if (e.name !== 'SyntaxError') { + throw e; + } + } + } + return (encoder || JSON.stringify)(rawValue); + } + var defaults = { + transitional: transitionalDefaults, + adapter: ['xhr', 'http', 'fetch'], + transformRequest: [function transformRequest(data, headers) { + var contentType = headers.getContentType() || ''; + var hasJSONContentType = contentType.indexOf('application/json') > -1; + var isObjectPayload = utils$1.isObject(data); + if (isObjectPayload && utils$1.isHTMLForm(data)) { + data = new FormData(data); + } + var isFormData = utils$1.isFormData(data); + if (isFormData) { + return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data; + } + if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) { + return data; + } + if (utils$1.isArrayBufferView(data)) { + return data.buffer; + } + if (utils$1.isURLSearchParams(data)) { + headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false); + return data.toString(); + } + var isFileList; + if (isObjectPayload) { + if (contentType.indexOf('application/x-www-form-urlencoded') > -1) { + return toURLEncodedForm(data, this.formSerializer).toString(); + } + if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) { + var _FormData = this.env && this.env.FormData; + return toFormData(isFileList ? { + 'files[]': data + } : data, _FormData && new _FormData(), this.formSerializer); + } + } + if (isObjectPayload || hasJSONContentType) { + headers.setContentType('application/json', false); + return stringifySafely(data); + } + return data; + }], + transformResponse: [function transformResponse(data) { + var transitional = this.transitional || defaults.transitional; + var forcedJSONParsing = transitional && transitional.forcedJSONParsing; + var JSONRequested = this.responseType === 'json'; + if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) { + return data; + } + if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) { + var silentJSONParsing = transitional && transitional.silentJSONParsing; + var strictJSONParsing = !silentJSONParsing && JSONRequested; + try { + return JSON.parse(data); + } catch (e) { + if (strictJSONParsing) { + if (e.name === 'SyntaxError') { + throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response); + } + throw e; + } + } + } + return data; + }], + /** + * A timeout in milliseconds to abort a request. If set to 0 (default) a + * timeout is not created. + */ + timeout: 0, + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN', + maxContentLength: -1, + maxBodyLength: -1, + env: { + FormData: platform.classes.FormData, + Blob: platform.classes.Blob + }, + validateStatus: function validateStatus(status) { + return status >= 200 && status < 300; + }, + headers: { + common: { + 'Accept': 'application/json, text/plain, */*', + 'Content-Type': undefined + } + } + }; + utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], function (method) { + defaults.headers[method] = {}; + }); + var defaults$1 = defaults; + + // RawAxiosHeaders whose duplicates are ignored by node + // c.f. https://nodejs.org/api/http.html#http_message_headers + var ignoreDuplicateOf = utils$1.toObjectSet(['age', 'authorization', 'content-length', 'content-type', 'etag', 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 'referer', 'retry-after', 'user-agent']); + + /** + * Parse headers into an object + * + * ``` + * Date: Wed, 27 Aug 2014 08:58:49 GMT + * Content-Type: application/json + * Connection: keep-alive + * Transfer-Encoding: chunked + * ``` + * + * @param {String} rawHeaders Headers needing to be parsed + * + * @returns {Object} Headers parsed into an object + */ + var parseHeaders = (function (rawHeaders) { + var parsed = {}; + var key; + var val; + var i; + rawHeaders && rawHeaders.split('\n').forEach(function parser(line) { + i = line.indexOf(':'); + key = line.substring(0, i).trim().toLowerCase(); + val = line.substring(i + 1).trim(); + if (!key || parsed[key] && ignoreDuplicateOf[key]) { + return; + } + if (key === 'set-cookie') { + if (parsed[key]) { + parsed[key].push(val); + } else { + parsed[key] = [val]; + } + } else { + parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; + } + }); + return parsed; + }); + + var $internals = Symbol('internals'); + function normalizeHeader(header) { + return header && String(header).trim().toLowerCase(); + } + function normalizeValue(value) { + if (value === false || value == null) { + return value; + } + return utils$1.isArray(value) ? value.map(normalizeValue) : String(value); + } + function parseTokens(str) { + var tokens = Object.create(null); + var tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; + var match; + while (match = tokensRE.exec(str)) { + tokens[match[1]] = match[2]; + } + return tokens; + } + var isValidHeaderName = function isValidHeaderName(str) { + return /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim()); + }; + function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) { + if (utils$1.isFunction(filter)) { + return filter.call(this, value, header); + } + if (isHeaderNameFilter) { + value = header; + } + if (!utils$1.isString(value)) return; + if (utils$1.isString(filter)) { + return value.indexOf(filter) !== -1; + } + if (utils$1.isRegExp(filter)) { + return filter.test(value); + } + } + function formatHeader(header) { + return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, function (w, _char, str) { + return _char.toUpperCase() + str; + }); + } + function buildAccessors(obj, header) { + var accessorName = utils$1.toCamelCase(' ' + header); + ['get', 'set', 'has'].forEach(function (methodName) { + Object.defineProperty(obj, methodName + accessorName, { + value: function value(arg1, arg2, arg3) { + return this[methodName].call(this, header, arg1, arg2, arg3); + }, + configurable: true + }); + }); + } + var AxiosHeaders = /*#__PURE__*/function (_Symbol$iterator, _Symbol$toStringTag) { + function AxiosHeaders(headers) { + _classCallCheck(this, AxiosHeaders); + headers && this.set(headers); + } + _createClass(AxiosHeaders, [{ + key: "set", + value: function set(header, valueOrRewrite, rewrite) { + var self = this; + function setHeader(_value, _header, _rewrite) { + var lHeader = normalizeHeader(_header); + if (!lHeader) { + throw new Error('header name must be a non-empty string'); + } + var key = utils$1.findKey(self, lHeader); + if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) { + self[key || _header] = normalizeValue(_value); + } + } + var setHeaders = function setHeaders(headers, _rewrite) { + return utils$1.forEach(headers, function (_value, _header) { + return setHeader(_value, _header, _rewrite); + }); + }; + if (utils$1.isPlainObject(header) || header instanceof this.constructor) { + setHeaders(header, valueOrRewrite); + } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) { + setHeaders(parseHeaders(header), valueOrRewrite); + } else if (utils$1.isHeaders(header)) { + var _iterator = _createForOfIteratorHelper(header.entries()), + _step; + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var _step$value = _slicedToArray(_step.value, 2), + key = _step$value[0], + value = _step$value[1]; + setHeader(value, key, rewrite); + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + } else { + header != null && setHeader(valueOrRewrite, header, rewrite); + } + return this; + } + }, { + key: "get", + value: function get(header, parser) { + header = normalizeHeader(header); + if (header) { + var key = utils$1.findKey(this, header); + if (key) { + var value = this[key]; + if (!parser) { + return value; + } + if (parser === true) { + return parseTokens(value); + } + if (utils$1.isFunction(parser)) { + return parser.call(this, value, key); + } + if (utils$1.isRegExp(parser)) { + return parser.exec(value); + } + throw new TypeError('parser must be boolean|regexp|function'); + } + } + } + }, { + key: "has", + value: function has(header, matcher) { + header = normalizeHeader(header); + if (header) { + var key = utils$1.findKey(this, header); + return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher))); + } + return false; + } + }, { + key: "delete", + value: function _delete(header, matcher) { + var self = this; + var deleted = false; + function deleteHeader(_header) { + _header = normalizeHeader(_header); + if (_header) { + var key = utils$1.findKey(self, _header); + if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) { + delete self[key]; + deleted = true; + } + } + } + if (utils$1.isArray(header)) { + header.forEach(deleteHeader); + } else { + deleteHeader(header); + } + return deleted; + } + }, { + key: "clear", + value: function clear(matcher) { + var keys = Object.keys(this); + var i = keys.length; + var deleted = false; + while (i--) { + var key = keys[i]; + if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) { + delete this[key]; + deleted = true; + } + } + return deleted; + } + }, { + key: "normalize", + value: function normalize(format) { + var self = this; + var headers = {}; + utils$1.forEach(this, function (value, header) { + var key = utils$1.findKey(headers, header); + if (key) { + self[key] = normalizeValue(value); + delete self[header]; + return; + } + var normalized = format ? formatHeader(header) : String(header).trim(); + if (normalized !== header) { + delete self[header]; + } + self[normalized] = normalizeValue(value); + headers[normalized] = true; + }); + return this; + } + }, { + key: "concat", + value: function concat() { + var _this$constructor; + for (var _len = arguments.length, targets = new Array(_len), _key = 0; _key < _len; _key++) { + targets[_key] = arguments[_key]; + } + return (_this$constructor = this.constructor).concat.apply(_this$constructor, [this].concat(targets)); + } + }, { + key: "toJSON", + value: function toJSON(asStrings) { + var obj = Object.create(null); + utils$1.forEach(this, function (value, header) { + value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value); + }); + return obj; + } + }, { + key: _Symbol$iterator, + value: function value() { + return Object.entries(this.toJSON())[Symbol.iterator](); + } + }, { + key: "toString", + value: function toString() { + return Object.entries(this.toJSON()).map(function (_ref) { + var _ref2 = _slicedToArray(_ref, 2), + header = _ref2[0], + value = _ref2[1]; + return header + ': ' + value; + }).join('\n'); + } + }, { + key: _Symbol$toStringTag, + get: function get() { + return 'AxiosHeaders'; + } + }], [{ + key: "from", + value: function from(thing) { + return thing instanceof this ? thing : new this(thing); + } + }, { + key: "concat", + value: function concat(first) { + var computed = new this(first); + for (var _len2 = arguments.length, targets = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + targets[_key2 - 1] = arguments[_key2]; + } + targets.forEach(function (target) { + return computed.set(target); + }); + return computed; + } + }, { + key: "accessor", + value: function accessor(header) { + var internals = this[$internals] = this[$internals] = { + accessors: {} + }; + var accessors = internals.accessors; + var prototype = this.prototype; + function defineAccessor(_header) { + var lHeader = normalizeHeader(_header); + if (!accessors[lHeader]) { + buildAccessors(prototype, _header); + accessors[lHeader] = true; + } + } + utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header); + return this; + } + }]); + return AxiosHeaders; + }(Symbol.iterator, Symbol.toStringTag); + AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']); + + // reserved names hotfix + utils$1.reduceDescriptors(AxiosHeaders.prototype, function (_ref3, key) { + var value = _ref3.value; + var mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set` + return { + get: function get() { + return value; + }, + set: function set(headerValue) { + this[mapped] = headerValue; + } + }; + }); + utils$1.freezeMethods(AxiosHeaders); + var AxiosHeaders$1 = AxiosHeaders; + + /** + * Transform the data for a request or a response + * + * @param {Array|Function} fns A single function or Array of functions + * @param {?Object} response The response object + * + * @returns {*} The resulting transformed data + */ + function transformData(fns, response) { + var config = this || defaults$1; + var context = response || config; + var headers = AxiosHeaders$1.from(context.headers); + var data = context.data; + utils$1.forEach(fns, function transform(fn) { + data = fn.call(config, data, headers.normalize(), response ? response.status : undefined); + }); + headers.normalize(); + return data; + } + + function isCancel(value) { + return !!(value && value.__CANCEL__); + } + + /** + * A `CanceledError` is an object that is thrown when an operation is canceled. + * + * @param {string=} message The message. + * @param {Object=} config The config. + * @param {Object=} request The request. + * + * @returns {CanceledError} The created error. + */ + function CanceledError(message, config, request) { + // eslint-disable-next-line no-eq-null,eqeqeq + AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request); + this.name = 'CanceledError'; + } + utils$1.inherits(CanceledError, AxiosError, { + __CANCEL__: true + }); + + /** + * Resolve or reject a Promise based on response status. + * + * @param {Function} resolve A function that resolves the promise. + * @param {Function} reject A function that rejects the promise. + * @param {object} response The response. + * + * @returns {object} The response. + */ + function settle(resolve, reject, response) { + var validateStatus = response.config.validateStatus; + if (!response.status || !validateStatus || validateStatus(response.status)) { + resolve(response); + } else { + reject(new AxiosError('Request failed with status code ' + response.status, [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], response.config, response.request, response)); + } + } + + function parseProtocol(url) { + var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url); + return match && match[1] || ''; + } + + /** + * Calculate data maxRate + * @param {Number} [samplesCount= 10] + * @param {Number} [min= 1000] + * @returns {Function} + */ + function speedometer(samplesCount, min) { + samplesCount = samplesCount || 10; + var bytes = new Array(samplesCount); + var timestamps = new Array(samplesCount); + var head = 0; + var tail = 0; + var firstSampleTS; + min = min !== undefined ? min : 1000; + return function push(chunkLength) { + var now = Date.now(); + var startedAt = timestamps[tail]; + if (!firstSampleTS) { + firstSampleTS = now; + } + bytes[head] = chunkLength; + timestamps[head] = now; + var i = tail; + var bytesCount = 0; + while (i !== head) { + bytesCount += bytes[i++]; + i = i % samplesCount; + } + head = (head + 1) % samplesCount; + if (head === tail) { + tail = (tail + 1) % samplesCount; + } + if (now - firstSampleTS < min) { + return; + } + var passed = startedAt && now - startedAt; + return passed ? Math.round(bytesCount * 1000 / passed) : undefined; + }; + } + + /** + * Throttle decorator + * @param {Function} fn + * @param {Number} freq + * @return {Function} + */ + function throttle(fn, freq) { + var timestamp = 0; + var threshold = 1000 / freq; + var timer = null; + return function throttled() { + var _arguments = arguments; + var force = this === true; + var now = Date.now(); + if (force || now - timestamp > threshold) { + if (timer) { + clearTimeout(timer); + timer = null; + } + timestamp = now; + return fn.apply(null, arguments); + } + if (!timer) { + timer = setTimeout(function () { + timer = null; + timestamp = Date.now(); + return fn.apply(null, _arguments); + }, threshold - (now - timestamp)); + } + }; + } + + var progressEventReducer = (function (listener, isDownloadStream) { + var freq = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 3; + var bytesNotified = 0; + var _speedometer = speedometer(50, 250); + return throttle(function (e) { + var loaded = e.loaded; + var total = e.lengthComputable ? e.total : undefined; + var progressBytes = loaded - bytesNotified; + var rate = _speedometer(progressBytes); + var inRange = loaded <= total; + bytesNotified = loaded; + var data = { + loaded: loaded, + total: total, + progress: total ? loaded / total : undefined, + bytes: progressBytes, + rate: rate ? rate : undefined, + estimated: rate && total && inRange ? (total - loaded) / rate : undefined, + event: e, + lengthComputable: total != null + }; + data[isDownloadStream ? 'download' : 'upload'] = true; + listener(data); + }, freq); + }); + + var isURLSameOrigin = platform.hasStandardBrowserEnv ? + // Standard browser envs have full support of the APIs needed to test + // whether the request URL is of the same origin as current location. + function standardBrowserEnv() { + var msie = /(msie|trident)/i.test(navigator.userAgent); + var urlParsingNode = document.createElement('a'); + var originURL; + + /** + * Parse a URL to discover its components + * + * @param {String} url The URL to be parsed + * @returns {Object} + */ + function resolveURL(url) { + var href = url; + if (msie) { + // IE needs attribute set twice to normalize properties + urlParsingNode.setAttribute('href', href); + href = urlParsingNode.href; + } + urlParsingNode.setAttribute('href', href); + + // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: urlParsingNode.pathname.charAt(0) === '/' ? urlParsingNode.pathname : '/' + urlParsingNode.pathname + }; + } + originURL = resolveURL(window.location.href); + + /** + * Determine if a URL shares the same origin as the current location + * + * @param {String} requestURL The URL to test + * @returns {boolean} True if URL shares the same origin, otherwise false + */ + return function isURLSameOrigin(requestURL) { + var parsed = utils$1.isString(requestURL) ? resolveURL(requestURL) : requestURL; + return parsed.protocol === originURL.protocol && parsed.host === originURL.host; + }; + }() : + // Non standard browser envs (web workers, react-native) lack needed support. + function nonStandardBrowserEnv() { + return function isURLSameOrigin() { + return true; + }; + }(); + + var cookies = platform.hasStandardBrowserEnv ? + // Standard browser envs support document.cookie + { + write: function write(name, value, expires, path, domain, secure) { + var cookie = [name + '=' + encodeURIComponent(value)]; + utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString()); + utils$1.isString(path) && cookie.push('path=' + path); + utils$1.isString(domain) && cookie.push('domain=' + domain); + secure === true && cookie.push('secure'); + document.cookie = cookie.join('; '); + }, + read: function read(name) { + var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); + return match ? decodeURIComponent(match[3]) : null; + }, + remove: function remove(name) { + this.write(name, '', Date.now() - 86400000); + } + } : + // Non-standard browser env (web workers, react-native) lack needed support. + { + write: function write() {}, + read: function read() { + return null; + }, + remove: function remove() {} + }; + + /** + * Determines whether the specified URL is absolute + * + * @param {string} url The URL to test + * + * @returns {boolean} True if the specified URL is absolute, otherwise false + */ + function isAbsoluteURL(url) { + // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). + // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed + // by any combination of letters, digits, plus, period, or hyphen. + return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); + } + + /** + * Creates a new URL by combining the specified URLs + * + * @param {string} baseURL The base URL + * @param {string} relativeURL The relative URL + * + * @returns {string} The combined URL + */ + function combineURLs(baseURL, relativeURL) { + return relativeURL ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL; + } + + /** + * Creates a new URL by combining the baseURL with the requestedURL, + * only when the requestedURL is not already an absolute URL. + * If the requestURL is absolute, this function returns the requestedURL untouched. + * + * @param {string} baseURL The base URL + * @param {string} requestedURL Absolute or relative URL to combine + * + * @returns {string} The combined full path + */ + function buildFullPath(baseURL, requestedURL) { + if (baseURL && !isAbsoluteURL(requestedURL)) { + return combineURLs(baseURL, requestedURL); + } + return requestedURL; + } + + var headersToObject = function headersToObject(thing) { + return thing instanceof AxiosHeaders$1 ? _objectSpread2({}, thing) : thing; + }; + + /** + * Config-specific merge-function which creates a new config-object + * by merging two configuration objects together. + * + * @param {Object} config1 + * @param {Object} config2 + * + * @returns {Object} New object resulting from merging config2 to config1 + */ + function mergeConfig(config1, config2) { + // eslint-disable-next-line no-param-reassign + config2 = config2 || {}; + var config = {}; + function getMergedValue(target, source, caseless) { + if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) { + return utils$1.merge.call({ + caseless: caseless + }, target, source); + } else if (utils$1.isPlainObject(source)) { + return utils$1.merge({}, source); + } else if (utils$1.isArray(source)) { + return source.slice(); + } + return source; + } + + // eslint-disable-next-line consistent-return + function mergeDeepProperties(a, b, caseless) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(a, b, caseless); + } else if (!utils$1.isUndefined(a)) { + return getMergedValue(undefined, a, caseless); + } + } + + // eslint-disable-next-line consistent-return + function valueFromConfig2(a, b) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(undefined, b); + } + } + + // eslint-disable-next-line consistent-return + function defaultToConfig2(a, b) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(undefined, b); + } else if (!utils$1.isUndefined(a)) { + return getMergedValue(undefined, a); + } + } + + // eslint-disable-next-line consistent-return + function mergeDirectKeys(a, b, prop) { + if (prop in config2) { + return getMergedValue(a, b); + } else if (prop in config1) { + return getMergedValue(undefined, a); + } + } + var mergeMap = { + url: valueFromConfig2, + method: valueFromConfig2, + data: valueFromConfig2, + baseURL: defaultToConfig2, + transformRequest: defaultToConfig2, + transformResponse: defaultToConfig2, + paramsSerializer: defaultToConfig2, + timeout: defaultToConfig2, + timeoutMessage: defaultToConfig2, + withCredentials: defaultToConfig2, + withXSRFToken: defaultToConfig2, + adapter: defaultToConfig2, + responseType: defaultToConfig2, + xsrfCookieName: defaultToConfig2, + xsrfHeaderName: defaultToConfig2, + onUploadProgress: defaultToConfig2, + onDownloadProgress: defaultToConfig2, + decompress: defaultToConfig2, + maxContentLength: defaultToConfig2, + maxBodyLength: defaultToConfig2, + beforeRedirect: defaultToConfig2, + transport: defaultToConfig2, + httpAgent: defaultToConfig2, + httpsAgent: defaultToConfig2, + cancelToken: defaultToConfig2, + socketPath: defaultToConfig2, + responseEncoding: defaultToConfig2, + validateStatus: mergeDirectKeys, + headers: function headers(a, b) { + return mergeDeepProperties(headersToObject(a), headersToObject(b), true); + } + }; + utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) { + var merge = mergeMap[prop] || mergeDeepProperties; + var configValue = merge(config1[prop], config2[prop], prop); + utils$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue); + }); + return config; + } + + var resolveConfig = (function (config) { + var newConfig = mergeConfig({}, config); + var data = newConfig.data, + withXSRFToken = newConfig.withXSRFToken, + xsrfHeaderName = newConfig.xsrfHeaderName, + xsrfCookieName = newConfig.xsrfCookieName, + headers = newConfig.headers, + auth = newConfig.auth; + newConfig.headers = headers = AxiosHeaders$1.from(headers); + newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer); + + // HTTP basic authentication + if (auth) { + headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))); + } + var contentType; + if (utils$1.isFormData(data)) { + if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) { + headers.setContentType(undefined); // Let the browser set it + } else if ((contentType = headers.getContentType()) !== false) { + // fix semicolon duplication issue for ReactNative FormData implementation + var _ref = contentType ? contentType.split(';').map(function (token) { + return token.trim(); + }).filter(Boolean) : [], + _ref2 = _toArray(_ref), + type = _ref2[0], + tokens = _ref2.slice(1); + headers.setContentType([type || 'multipart/form-data'].concat(_toConsumableArray(tokens)).join('; ')); + } + } + + // Add xsrf header + // This is only done if running in a standard browser environment. + // Specifically not if we're in a web worker, or react-native. + + if (platform.hasStandardBrowserEnv) { + withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig)); + if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) { + // Add xsrf header + var xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName); + if (xsrfValue) { + headers.set(xsrfHeaderName, xsrfValue); + } + } + } + return newConfig; + }); + + var isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined'; + var xhrAdapter = isXHRAdapterSupported && function (config) { + return new Promise(function dispatchXhrRequest(resolve, reject) { + var _config = resolveConfig(config); + var requestData = _config.data; + var requestHeaders = AxiosHeaders$1.from(_config.headers).normalize(); + var responseType = _config.responseType; + var onCanceled; + function done() { + if (_config.cancelToken) { + _config.cancelToken.unsubscribe(onCanceled); + } + if (_config.signal) { + _config.signal.removeEventListener('abort', onCanceled); + } + } + var request = new XMLHttpRequest(); + request.open(_config.method.toUpperCase(), _config.url, true); + + // Set the request timeout in MS + request.timeout = _config.timeout; + function onloadend() { + if (!request) { + return; + } + // Prepare the response + var responseHeaders = AxiosHeaders$1.from('getAllResponseHeaders' in request && request.getAllResponseHeaders()); + var responseData = !responseType || responseType === 'text' || responseType === 'json' ? request.responseText : request.response; + var response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config: config, + request: request + }; + settle(function _resolve(value) { + resolve(value); + done(); + }, function _reject(err) { + reject(err); + done(); + }, response); + + // Clean up request + request = null; + } + if ('onloadend' in request) { + // Use onloadend if available + request.onloadend = onloadend; + } else { + // Listen for ready state to emulate onloadend + request.onreadystatechange = function handleLoad() { + if (!request || request.readyState !== 4) { + return; + } + + // The request errored out and we didn't get a response, this will be + // handled by onerror instead + // With one exception: request that using file: protocol, most browsers + // will return status as 0 even though it's a successful request + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { + return; + } + // readystate handler is calling before onerror or ontimeout handlers, + // so we should call onloadend on the next 'tick' + setTimeout(onloadend); + }; + } + + // Handle browser request cancellation (as opposed to a manual cancellation) + request.onabort = function handleAbort() { + if (!request) { + return; + } + reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, _config, request)); + + // Clean up request + request = null; + }; + + // Handle low level network errors + request.onerror = function handleError() { + // Real errors are hidden from us by the browser + // onerror should only fire if it's a network error + reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, _config, request)); + + // Clean up request + request = null; + }; + + // Handle timeout + request.ontimeout = function handleTimeout() { + var timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded'; + var transitional = _config.transitional || transitionalDefaults; + if (_config.timeoutErrorMessage) { + timeoutErrorMessage = _config.timeoutErrorMessage; + } + reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, _config, request)); + + // Clean up request + request = null; + }; + + // Remove Content-Type if data is undefined + requestData === undefined && requestHeaders.setContentType(null); + + // Add headers to the request + if ('setRequestHeader' in request) { + utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) { + request.setRequestHeader(key, val); + }); + } + + // Add withCredentials to request if needed + if (!utils$1.isUndefined(_config.withCredentials)) { + request.withCredentials = !!_config.withCredentials; + } + + // Add responseType to request if needed + if (responseType && responseType !== 'json') { + request.responseType = _config.responseType; + } + + // Handle progress if needed + if (typeof _config.onDownloadProgress === 'function') { + request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true)); + } + + // Not all browsers support upload events + if (typeof _config.onUploadProgress === 'function' && request.upload) { + request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress)); + } + if (_config.cancelToken || _config.signal) { + // Handle cancellation + // eslint-disable-next-line func-names + onCanceled = function onCanceled(cancel) { + if (!request) { + return; + } + reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel); + request.abort(); + request = null; + }; + _config.cancelToken && _config.cancelToken.subscribe(onCanceled); + if (_config.signal) { + _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled); + } + } + var protocol = parseProtocol(_config.url); + if (protocol && platform.protocols.indexOf(protocol) === -1) { + reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config)); + return; + } + + // Send the request + request.send(requestData || null); + }); + }; + + var composeSignals = function composeSignals(signals, timeout) { + var controller = new AbortController(); + var aborted; + var onabort = function onabort(cancel) { + if (!aborted) { + aborted = true; + unsubscribe(); + var err = cancel instanceof Error ? cancel : this.reason; + controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err)); + } + }; + var timer = timeout && setTimeout(function () { + onabort(new AxiosError("timeout ".concat(timeout, " of ms exceeded"), AxiosError.ETIMEDOUT)); + }, timeout); + var unsubscribe = function unsubscribe() { + if (signals) { + timer && clearTimeout(timer); + timer = null; + signals.forEach(function (signal) { + signal && (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort)); + }); + signals = null; + } + }; + signals.forEach(function (signal) { + return signal && signal.addEventListener && signal.addEventListener('abort', onabort); + }); + var signal = controller.signal; + signal.unsubscribe = unsubscribe; + return [signal, function () { + timer && clearTimeout(timer); + timer = null; + }]; + }; + var composeSignals$1 = composeSignals; + + var streamChunk = /*#__PURE__*/_regeneratorRuntime().mark(function streamChunk(chunk, chunkSize) { + var len, pos, end; + return _regeneratorRuntime().wrap(function streamChunk$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + len = chunk.byteLength; + if (!(!chunkSize || len < chunkSize)) { + _context.next = 5; + break; + } + _context.next = 4; + return chunk; + case 4: + return _context.abrupt("return"); + case 5: + pos = 0; + case 6: + if (!(pos < len)) { + _context.next = 13; + break; + } + end = pos + chunkSize; + _context.next = 10; + return chunk.slice(pos, end); + case 10: + pos = end; + _context.next = 6; + break; + case 13: + case "end": + return _context.stop(); + } + }, streamChunk); + }); + var readBytes = /*#__PURE__*/function () { + var _ref = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(iterable, chunkSize, encode) { + var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk; + return _regeneratorRuntime().wrap(function _callee$(_context2) { + while (1) switch (_context2.prev = _context2.next) { + case 0: + _iteratorAbruptCompletion = false; + _didIteratorError = false; + _context2.prev = 2; + _iterator = _asyncIterator(iterable); + case 4: + _context2.next = 6; + return _awaitAsyncGenerator(_iterator.next()); + case 6: + if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) { + _context2.next = 27; + break; + } + chunk = _step.value; + _context2.t0 = _asyncGeneratorDelegate; + _context2.t1 = _asyncIterator; + _context2.t2 = streamChunk; + if (!ArrayBuffer.isView(chunk)) { + _context2.next = 15; + break; + } + _context2.t3 = chunk; + _context2.next = 18; + break; + case 15: + _context2.next = 17; + return _awaitAsyncGenerator(encode(String(chunk))); + case 17: + _context2.t3 = _context2.sent; + case 18: + _context2.t4 = _context2.t3; + _context2.t5 = chunkSize; + _context2.t6 = (0, _context2.t2)(_context2.t4, _context2.t5); + _context2.t7 = (0, _context2.t1)(_context2.t6); + _context2.t8 = _awaitAsyncGenerator; + return _context2.delegateYield((0, _context2.t0)(_context2.t7, _context2.t8), "t9", 24); + case 24: + _iteratorAbruptCompletion = false; + _context2.next = 4; + break; + case 27: + _context2.next = 33; + break; + case 29: + _context2.prev = 29; + _context2.t10 = _context2["catch"](2); + _didIteratorError = true; + _iteratorError = _context2.t10; + case 33: + _context2.prev = 33; + _context2.prev = 34; + if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) { + _context2.next = 38; + break; + } + _context2.next = 38; + return _awaitAsyncGenerator(_iterator["return"]()); + case 38: + _context2.prev = 38; + if (!_didIteratorError) { + _context2.next = 41; + break; + } + throw _iteratorError; + case 41: + return _context2.finish(38); + case 42: + return _context2.finish(33); + case 43: + case "end": + return _context2.stop(); + } + }, _callee, null, [[2, 29, 33, 43], [34,, 38, 42]]); + })); + return function readBytes(_x, _x2, _x3) { + return _ref.apply(this, arguments); + }; + }(); + var trackStream = function trackStream(stream, chunkSize, onProgress, onFinish, encode) { + var iterator = readBytes(stream, chunkSize, encode); + var bytes = 0; + return new ReadableStream({ + type: 'bytes', + pull: function pull(controller) { + return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { + var _yield$iterator$next, done, value, len; + return _regeneratorRuntime().wrap(function _callee2$(_context3) { + while (1) switch (_context3.prev = _context3.next) { + case 0: + _context3.next = 2; + return iterator.next(); + case 2: + _yield$iterator$next = _context3.sent; + done = _yield$iterator$next.done; + value = _yield$iterator$next.value; + if (!done) { + _context3.next = 9; + break; + } + controller.close(); + onFinish(); + return _context3.abrupt("return"); + case 9: + len = value.byteLength; + onProgress && onProgress(bytes += len); + controller.enqueue(new Uint8Array(value)); + case 12: + case "end": + return _context3.stop(); + } + }, _callee2); + }))(); + }, + cancel: function cancel(reason) { + onFinish(reason); + return iterator["return"](); + } + }, { + highWaterMark: 2 + }); + }; + + var fetchProgressDecorator = function fetchProgressDecorator(total, fn) { + var lengthComputable = total != null; + return function (loaded) { + return setTimeout(function () { + return fn({ + lengthComputable: lengthComputable, + total: total, + loaded: loaded + }); + }); + }; + }; + var isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function'; + var isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function'; + + // used only inside the fetch adapter + var encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? function (encoder) { + return function (str) { + return encoder.encode(str); + }; + }(new TextEncoder()) : ( /*#__PURE__*/function () { + var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(str) { + return _regeneratorRuntime().wrap(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + _context.t0 = Uint8Array; + _context.next = 3; + return new Response(str).arrayBuffer(); + case 3: + _context.t1 = _context.sent; + return _context.abrupt("return", new _context.t0(_context.t1)); + case 5: + case "end": + return _context.stop(); + } + }, _callee); + })); + return function (_x) { + return _ref.apply(this, arguments); + }; + }())); + var supportsRequestStream = isReadableStreamSupported && function () { + var duplexAccessed = false; + var hasContentType = new Request(platform.origin, { + body: new ReadableStream(), + method: 'POST', + get duplex() { + duplexAccessed = true; + return 'half'; + } + }).headers.has('Content-Type'); + return duplexAccessed && !hasContentType; + }(); + var DEFAULT_CHUNK_SIZE = 64 * 1024; + var supportsResponseStream = isReadableStreamSupported && !!function () { + try { + return utils$1.isReadableStream(new Response('').body); + } catch (err) { + // return undefined + } + }(); + var resolvers = { + stream: supportsResponseStream && function (res) { + return res.body; + } + }; + isFetchSupported && function (res) { + ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(function (type) { + !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? function (res) { + return res[type](); + } : function (_, config) { + throw new AxiosError("Response type '".concat(type, "' is not supported"), AxiosError.ERR_NOT_SUPPORT, config); + }); + }); + }(new Response()); + var getBodyLength = /*#__PURE__*/function () { + var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(body) { + return _regeneratorRuntime().wrap(function _callee2$(_context2) { + while (1) switch (_context2.prev = _context2.next) { + case 0: + if (!(body == null)) { + _context2.next = 2; + break; + } + return _context2.abrupt("return", 0); + case 2: + if (!utils$1.isBlob(body)) { + _context2.next = 4; + break; + } + return _context2.abrupt("return", body.size); + case 4: + if (!utils$1.isSpecCompliantForm(body)) { + _context2.next = 8; + break; + } + _context2.next = 7; + return new Request(body).arrayBuffer(); + case 7: + return _context2.abrupt("return", _context2.sent.byteLength); + case 8: + if (!utils$1.isArrayBufferView(body)) { + _context2.next = 10; + break; + } + return _context2.abrupt("return", body.byteLength); + case 10: + if (utils$1.isURLSearchParams(body)) { + body = body + ''; + } + if (!utils$1.isString(body)) { + _context2.next = 15; + break; + } + _context2.next = 14; + return encodeText(body); + case 14: + return _context2.abrupt("return", _context2.sent.byteLength); + case 15: + case "end": + return _context2.stop(); + } + }, _callee2); + })); + return function getBodyLength(_x2) { + return _ref2.apply(this, arguments); + }; + }(); + var resolveBodyLength = /*#__PURE__*/function () { + var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(headers, body) { + var length; + return _regeneratorRuntime().wrap(function _callee3$(_context3) { + while (1) switch (_context3.prev = _context3.next) { + case 0: + length = utils$1.toFiniteNumber(headers.getContentLength()); + return _context3.abrupt("return", length == null ? getBodyLength(body) : length); + case 2: + case "end": + return _context3.stop(); + } + }, _callee3); + })); + return function resolveBodyLength(_x3, _x4) { + return _ref3.apply(this, arguments); + }; + }(); + var fetchAdapter = isFetchSupported && ( /*#__PURE__*/function () { + var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(config) { + var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, _ref5, _ref6, composedSignal, stopTimeout, finished, request, onFinish, requestContentLength, _request, contentTypeHeader, response, isStreamResponse, options, responseContentLength, responseData; + return _regeneratorRuntime().wrap(function _callee4$(_context4) { + while (1) switch (_context4.prev = _context4.next) { + case 0: + _resolveConfig = resolveConfig(config), url = _resolveConfig.url, method = _resolveConfig.method, data = _resolveConfig.data, signal = _resolveConfig.signal, cancelToken = _resolveConfig.cancelToken, timeout = _resolveConfig.timeout, onDownloadProgress = _resolveConfig.onDownloadProgress, onUploadProgress = _resolveConfig.onUploadProgress, responseType = _resolveConfig.responseType, headers = _resolveConfig.headers, _resolveConfig$withCr = _resolveConfig.withCredentials, withCredentials = _resolveConfig$withCr === void 0 ? 'same-origin' : _resolveConfig$withCr, fetchOptions = _resolveConfig.fetchOptions; + responseType = responseType ? (responseType + '').toLowerCase() : 'text'; + _ref5 = signal || cancelToken || timeout ? composeSignals$1([signal, cancelToken], timeout) : [], _ref6 = _slicedToArray(_ref5, 2), composedSignal = _ref6[0], stopTimeout = _ref6[1]; + onFinish = function onFinish() { + !finished && setTimeout(function () { + composedSignal && composedSignal.unsubscribe(); + }); + finished = true; + }; + _context4.prev = 4; + _context4.t0 = onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head'; + if (!_context4.t0) { + _context4.next = 11; + break; + } + _context4.next = 9; + return resolveBodyLength(headers, data); + case 9: + _context4.t1 = requestContentLength = _context4.sent; + _context4.t0 = _context4.t1 !== 0; + case 11: + if (!_context4.t0) { + _context4.next = 15; + break; + } + _request = new Request(url, { + method: 'POST', + body: data, + duplex: "half" + }); + if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) { + headers.setContentType(contentTypeHeader); + } + if (_request.body) { + data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(requestContentLength, progressEventReducer(onUploadProgress)), null, encodeText); + } + case 15: + if (!utils$1.isString(withCredentials)) { + withCredentials = withCredentials ? 'cors' : 'omit'; + } + request = new Request(url, _objectSpread2(_objectSpread2({}, fetchOptions), {}, { + signal: composedSignal, + method: method.toUpperCase(), + headers: headers.normalize().toJSON(), + body: data, + duplex: "half", + withCredentials: withCredentials + })); + _context4.next = 19; + return fetch(request); + case 19: + response = _context4.sent; + isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response'); + if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) { + options = {}; + ['status', 'statusText', 'headers'].forEach(function (prop) { + options[prop] = response[prop]; + }); + responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length')); + response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(responseContentLength, progressEventReducer(onDownloadProgress, true)), isStreamResponse && onFinish, encodeText), options); + } + responseType = responseType || 'text'; + _context4.next = 25; + return resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config); + case 25: + responseData = _context4.sent; + !isStreamResponse && onFinish(); + stopTimeout && stopTimeout(); + _context4.next = 30; + return new Promise(function (resolve, reject) { + settle(resolve, reject, { + data: responseData, + headers: AxiosHeaders$1.from(response.headers), + status: response.status, + statusText: response.statusText, + config: config, + request: request + }); + }); + case 30: + return _context4.abrupt("return", _context4.sent); + case 33: + _context4.prev = 33; + _context4.t2 = _context4["catch"](4); + onFinish(); + if (!(_context4.t2 && _context4.t2.name === 'TypeError' && /fetch/i.test(_context4.t2.message))) { + _context4.next = 38; + break; + } + throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), { + cause: _context4.t2.cause || _context4.t2 + }); + case 38: + throw AxiosError.from(_context4.t2, _context4.t2 && _context4.t2.code, config, request); + case 39: + case "end": + return _context4.stop(); + } + }, _callee4, null, [[4, 33]]); + })); + return function (_x5) { + return _ref4.apply(this, arguments); + }; + }()); + + var knownAdapters = { + http: httpAdapter, + xhr: xhrAdapter, + fetch: fetchAdapter + }; + utils$1.forEach(knownAdapters, function (fn, value) { + if (fn) { + try { + Object.defineProperty(fn, 'name', { + value: value + }); + } catch (e) { + // eslint-disable-next-line no-empty + } + Object.defineProperty(fn, 'adapterName', { + value: value + }); + } + }); + var renderReason = function renderReason(reason) { + return "- ".concat(reason); + }; + var isResolvedHandle = function isResolvedHandle(adapter) { + return utils$1.isFunction(adapter) || adapter === null || adapter === false; + }; + var adapters = { + getAdapter: function getAdapter(adapters) { + adapters = utils$1.isArray(adapters) ? adapters : [adapters]; + var _adapters = adapters, + length = _adapters.length; + var nameOrAdapter; + var adapter; + var rejectedReasons = {}; + for (var i = 0; i < length; i++) { + nameOrAdapter = adapters[i]; + var id = void 0; + adapter = nameOrAdapter; + if (!isResolvedHandle(nameOrAdapter)) { + adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()]; + if (adapter === undefined) { + throw new AxiosError("Unknown adapter '".concat(id, "'")); + } + } + if (adapter) { + break; + } + rejectedReasons[id || '#' + i] = adapter; + } + if (!adapter) { + var reasons = Object.entries(rejectedReasons).map(function (_ref) { + var _ref2 = _slicedToArray(_ref, 2), + id = _ref2[0], + state = _ref2[1]; + return "adapter ".concat(id, " ") + (state === false ? 'is not supported by the environment' : 'is not available in the build'); + }); + var s = length ? reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0]) : 'as no adapter specified'; + throw new AxiosError("There is no suitable adapter to dispatch the request " + s, 'ERR_NOT_SUPPORT'); + } + return adapter; + }, + adapters: knownAdapters + }; + + /** + * Throws a `CanceledError` if cancellation has been requested. + * + * @param {Object} config The config that is to be used for the request + * + * @returns {void} + */ + function throwIfCancellationRequested(config) { + if (config.cancelToken) { + config.cancelToken.throwIfRequested(); + } + if (config.signal && config.signal.aborted) { + throw new CanceledError(null, config); + } + } + + /** + * Dispatch a request to the server using the configured adapter. + * + * @param {object} config The config that is to be used for the request + * + * @returns {Promise} The Promise to be fulfilled + */ + function dispatchRequest(config) { + throwIfCancellationRequested(config); + config.headers = AxiosHeaders$1.from(config.headers); + + // Transform request data + config.data = transformData.call(config, config.transformRequest); + if (['post', 'put', 'patch'].indexOf(config.method) !== -1) { + config.headers.setContentType('application/x-www-form-urlencoded', false); + } + var adapter = adapters.getAdapter(config.adapter || defaults$1.adapter); + return adapter(config).then(function onAdapterResolution(response) { + throwIfCancellationRequested(config); + + // Transform response data + response.data = transformData.call(config, config.transformResponse, response); + response.headers = AxiosHeaders$1.from(response.headers); + return response; + }, function onAdapterRejection(reason) { + if (!isCancel(reason)) { + throwIfCancellationRequested(config); + + // Transform response data + if (reason && reason.response) { + reason.response.data = transformData.call(config, config.transformResponse, reason.response); + reason.response.headers = AxiosHeaders$1.from(reason.response.headers); + } + } + return Promise.reject(reason); + }); + } + + var VERSION = "1.7.2"; + + var validators$1 = {}; + + // eslint-disable-next-line func-names + ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function (type, i) { + validators$1[type] = function validator(thing) { + return _typeof(thing) === type || 'a' + (i < 1 ? 'n ' : ' ') + type; + }; + }); + var deprecatedWarnings = {}; + + /** + * Transitional option validator + * + * @param {function|boolean?} validator - set to false if the transitional option has been removed + * @param {string?} version - deprecated version / removed since version + * @param {string?} message - some message with additional info + * + * @returns {function} + */ + validators$1.transitional = function transitional(validator, version, message) { + function formatMessage(opt, desc) { + return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); + } + + // eslint-disable-next-line func-names + return function (value, opt, opts) { + if (validator === false) { + throw new AxiosError(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), AxiosError.ERR_DEPRECATED); + } + if (version && !deprecatedWarnings[opt]) { + deprecatedWarnings[opt] = true; + // eslint-disable-next-line no-console + console.warn(formatMessage(opt, ' has been deprecated since v' + version + ' and will be removed in the near future')); + } + return validator ? validator(value, opt, opts) : true; + }; + }; + + /** + * Assert object's properties type + * + * @param {object} options + * @param {object} schema + * @param {boolean?} allowUnknown + * + * @returns {object} + */ + + function assertOptions(options, schema, allowUnknown) { + if (_typeof(options) !== 'object') { + throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE); + } + var keys = Object.keys(options); + var i = keys.length; + while (i-- > 0) { + var opt = keys[i]; + var validator = schema[opt]; + if (validator) { + var value = options[opt]; + var result = value === undefined || validator(value, opt, options); + if (result !== true) { + throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE); + } + continue; + } + if (allowUnknown !== true) { + throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION); + } + } + } + var validator = { + assertOptions: assertOptions, + validators: validators$1 + }; + + var validators = validator.validators; + + /** + * Create a new instance of Axios + * + * @param {Object} instanceConfig The default config for the instance + * + * @return {Axios} A new instance of Axios + */ + var Axios = /*#__PURE__*/function () { + function Axios(instanceConfig) { + _classCallCheck(this, Axios); + this.defaults = instanceConfig; + this.interceptors = { + request: new InterceptorManager$1(), + response: new InterceptorManager$1() + }; + } + + /** + * Dispatch a request + * + * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults) + * @param {?Object} config + * + * @returns {Promise} The Promise to be fulfilled + */ + _createClass(Axios, [{ + key: "request", + value: (function () { + var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(configOrUrl, config) { + var dummy, stack; + return _regeneratorRuntime().wrap(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + _context.prev = 0; + _context.next = 3; + return this._request(configOrUrl, config); + case 3: + return _context.abrupt("return", _context.sent); + case 6: + _context.prev = 6; + _context.t0 = _context["catch"](0); + if (_context.t0 instanceof Error) { + Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : dummy = new Error(); + + // slice off the Error: ... line + stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : ''; + try { + if (!_context.t0.stack) { + _context.t0.stack = stack; + // match without the 2 top stack lines + } else if (stack && !String(_context.t0.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) { + _context.t0.stack += '\n' + stack; + } + } catch (e) { + // ignore the case where "stack" is an un-writable property + } + } + throw _context.t0; + case 10: + case "end": + return _context.stop(); + } + }, _callee, this, [[0, 6]]); + })); + function request(_x, _x2) { + return _request2.apply(this, arguments); + } + return request; + }()) + }, { + key: "_request", + value: function _request(configOrUrl, config) { + /*eslint no-param-reassign:0*/ + // Allow for axios('example/url'[, config]) a la fetch API + if (typeof configOrUrl === 'string') { + config = config || {}; + config.url = configOrUrl; + } else { + config = configOrUrl || {}; + } + config = mergeConfig(this.defaults, config); + var _config = config, + transitional = _config.transitional, + paramsSerializer = _config.paramsSerializer, + headers = _config.headers; + if (transitional !== undefined) { + validator.assertOptions(transitional, { + silentJSONParsing: validators.transitional(validators["boolean"]), + forcedJSONParsing: validators.transitional(validators["boolean"]), + clarifyTimeoutError: validators.transitional(validators["boolean"]) + }, false); + } + if (paramsSerializer != null) { + if (utils$1.isFunction(paramsSerializer)) { + config.paramsSerializer = { + serialize: paramsSerializer + }; + } else { + validator.assertOptions(paramsSerializer, { + encode: validators["function"], + serialize: validators["function"] + }, true); + } + } + + // Set config.method + config.method = (config.method || this.defaults.method || 'get').toLowerCase(); + + // Flatten headers + var contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]); + headers && utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], function (method) { + delete headers[method]; + }); + config.headers = AxiosHeaders$1.concat(contextHeaders, headers); + + // filter out skipped interceptors + var requestInterceptorChain = []; + var synchronousRequestInterceptors = true; + this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { + if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { + return; + } + synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; + requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); + }); + var responseInterceptorChain = []; + this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { + responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); + }); + var promise; + var i = 0; + var len; + if (!synchronousRequestInterceptors) { + var chain = [dispatchRequest.bind(this), undefined]; + chain.unshift.apply(chain, requestInterceptorChain); + chain.push.apply(chain, responseInterceptorChain); + len = chain.length; + promise = Promise.resolve(config); + while (i < len) { + promise = promise.then(chain[i++], chain[i++]); + } + return promise; + } + len = requestInterceptorChain.length; + var newConfig = config; + i = 0; + while (i < len) { + var onFulfilled = requestInterceptorChain[i++]; + var onRejected = requestInterceptorChain[i++]; + try { + newConfig = onFulfilled(newConfig); + } catch (error) { + onRejected.call(this, error); + break; + } + } + try { + promise = dispatchRequest.call(this, newConfig); + } catch (error) { + return Promise.reject(error); + } + i = 0; + len = responseInterceptorChain.length; + while (i < len) { + promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]); + } + return promise; + } + }, { + key: "getUri", + value: function getUri(config) { + config = mergeConfig(this.defaults, config); + var fullPath = buildFullPath(config.baseURL, config.url); + return buildURL(fullPath, config.params, config.paramsSerializer); + } + }]); + return Axios; + }(); // Provide aliases for supported request methods + utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function (url, config) { + return this.request(mergeConfig(config || {}, { + method: method, + url: url, + data: (config || {}).data + })); + }; + }); + utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + /*eslint func-names:0*/ + + function generateHTTPMethod(isForm) { + return function httpMethod(url, data, config) { + return this.request(mergeConfig(config || {}, { + method: method, + headers: isForm ? { + 'Content-Type': 'multipart/form-data' + } : {}, + url: url, + data: data + })); + }; + } + Axios.prototype[method] = generateHTTPMethod(); + Axios.prototype[method + 'Form'] = generateHTTPMethod(true); + }); + var Axios$1 = Axios; + + /** + * A `CancelToken` is an object that can be used to request cancellation of an operation. + * + * @param {Function} executor The executor function. + * + * @returns {CancelToken} + */ + var CancelToken = /*#__PURE__*/function () { + function CancelToken(executor) { + _classCallCheck(this, CancelToken); + if (typeof executor !== 'function') { + throw new TypeError('executor must be a function.'); + } + var resolvePromise; + this.promise = new Promise(function promiseExecutor(resolve) { + resolvePromise = resolve; + }); + var token = this; + + // eslint-disable-next-line func-names + this.promise.then(function (cancel) { + if (!token._listeners) return; + var i = token._listeners.length; + while (i-- > 0) { + token._listeners[i](cancel); + } + token._listeners = null; + }); + + // eslint-disable-next-line func-names + this.promise.then = function (onfulfilled) { + var _resolve; + // eslint-disable-next-line func-names + var promise = new Promise(function (resolve) { + token.subscribe(resolve); + _resolve = resolve; + }).then(onfulfilled); + promise.cancel = function reject() { + token.unsubscribe(_resolve); + }; + return promise; + }; + executor(function cancel(message, config, request) { + if (token.reason) { + // Cancellation has already been requested + return; + } + token.reason = new CanceledError(message, config, request); + resolvePromise(token.reason); + }); + } + + /** + * Throws a `CanceledError` if cancellation has been requested. + */ + _createClass(CancelToken, [{ + key: "throwIfRequested", + value: function throwIfRequested() { + if (this.reason) { + throw this.reason; + } + } + + /** + * Subscribe to the cancel signal + */ + }, { + key: "subscribe", + value: function subscribe(listener) { + if (this.reason) { + listener(this.reason); + return; + } + if (this._listeners) { + this._listeners.push(listener); + } else { + this._listeners = [listener]; + } + } + + /** + * Unsubscribe from the cancel signal + */ + }, { + key: "unsubscribe", + value: function unsubscribe(listener) { + if (!this._listeners) { + return; + } + var index = this._listeners.indexOf(listener); + if (index !== -1) { + this._listeners.splice(index, 1); + } + } + + /** + * Returns an object that contains a new `CancelToken` and a function that, when called, + * cancels the `CancelToken`. + */ + }], [{ + key: "source", + value: function source() { + var cancel; + var token = new CancelToken(function executor(c) { + cancel = c; + }); + return { + token: token, + cancel: cancel + }; + } + }]); + return CancelToken; + }(); + var CancelToken$1 = CancelToken; + + /** + * Syntactic sugar for invoking a function and expanding an array for arguments. + * + * Common use case would be to use `Function.prototype.apply`. + * + * ```js + * function f(x, y, z) {} + * var args = [1, 2, 3]; + * f.apply(null, args); + * ``` + * + * With `spread` this example can be re-written. + * + * ```js + * spread(function(x, y, z) {})([1, 2, 3]); + * ``` + * + * @param {Function} callback + * + * @returns {Function} + */ + function spread(callback) { + return function wrap(arr) { + return callback.apply(null, arr); + }; + } + + /** + * Determines whether the payload is an error thrown by Axios + * + * @param {*} payload The value to test + * + * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false + */ + function isAxiosError(payload) { + return utils$1.isObject(payload) && payload.isAxiosError === true; + } + + var HttpStatusCode = { + Continue: 100, + SwitchingProtocols: 101, + Processing: 102, + EarlyHints: 103, + Ok: 200, + Created: 201, + Accepted: 202, + NonAuthoritativeInformation: 203, + NoContent: 204, + ResetContent: 205, + PartialContent: 206, + MultiStatus: 207, + AlreadyReported: 208, + ImUsed: 226, + MultipleChoices: 300, + MovedPermanently: 301, + Found: 302, + SeeOther: 303, + NotModified: 304, + UseProxy: 305, + Unused: 306, + TemporaryRedirect: 307, + PermanentRedirect: 308, + BadRequest: 400, + Unauthorized: 401, + PaymentRequired: 402, + Forbidden: 403, + NotFound: 404, + MethodNotAllowed: 405, + NotAcceptable: 406, + ProxyAuthenticationRequired: 407, + RequestTimeout: 408, + Conflict: 409, + Gone: 410, + LengthRequired: 411, + PreconditionFailed: 412, + PayloadTooLarge: 413, + UriTooLong: 414, + UnsupportedMediaType: 415, + RangeNotSatisfiable: 416, + ExpectationFailed: 417, + ImATeapot: 418, + MisdirectedRequest: 421, + UnprocessableEntity: 422, + Locked: 423, + FailedDependency: 424, + TooEarly: 425, + UpgradeRequired: 426, + PreconditionRequired: 428, + TooManyRequests: 429, + RequestHeaderFieldsTooLarge: 431, + UnavailableForLegalReasons: 451, + InternalServerError: 500, + NotImplemented: 501, + BadGateway: 502, + ServiceUnavailable: 503, + GatewayTimeout: 504, + HttpVersionNotSupported: 505, + VariantAlsoNegotiates: 506, + InsufficientStorage: 507, + LoopDetected: 508, + NotExtended: 510, + NetworkAuthenticationRequired: 511 + }; + Object.entries(HttpStatusCode).forEach(function (_ref) { + var _ref2 = _slicedToArray(_ref, 2), + key = _ref2[0], + value = _ref2[1]; + HttpStatusCode[value] = key; + }); + var HttpStatusCode$1 = HttpStatusCode; + + /** + * Create an instance of Axios + * + * @param {Object} defaultConfig The default config for the instance + * + * @returns {Axios} A new instance of Axios + */ + function createInstance(defaultConfig) { + var context = new Axios$1(defaultConfig); + var instance = bind(Axios$1.prototype.request, context); + + // Copy axios.prototype to instance + utils$1.extend(instance, Axios$1.prototype, context, { + allOwnKeys: true + }); + + // Copy context to instance + utils$1.extend(instance, context, null, { + allOwnKeys: true + }); + + // Factory for creating new instances + instance.create = function create(instanceConfig) { + return createInstance(mergeConfig(defaultConfig, instanceConfig)); + }; + return instance; + } + + // Create the default instance to be exported + var axios = createInstance(defaults$1); + + // Expose Axios class to allow class inheritance + axios.Axios = Axios$1; + + // Expose Cancel & CancelToken + axios.CanceledError = CanceledError; + axios.CancelToken = CancelToken$1; + axios.isCancel = isCancel; + axios.VERSION = VERSION; + axios.toFormData = toFormData; + + // Expose AxiosError class + axios.AxiosError = AxiosError; + + // alias for CanceledError for backward compatibility + axios.Cancel = axios.CanceledError; + + // Expose all/spread + axios.all = function all(promises) { + return Promise.all(promises); + }; + axios.spread = spread; + + // Expose isAxiosError + axios.isAxiosError = isAxiosError; + + // Expose mergeConfig + axios.mergeConfig = mergeConfig; + axios.AxiosHeaders = AxiosHeaders$1; + axios.formToJSON = function (thing) { + return formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing); + }; + axios.getAdapter = adapters.getAdapter; + axios.HttpStatusCode = HttpStatusCode$1; + axios["default"] = axios; + + return axios; + +})); +//# sourceMappingURL=axios.js.map diff --git a/project starter code/node_modules/axios/dist/axios.js.map b/project starter code/node_modules/axios/dist/axios.js.map new file mode 100644 index 00000000..5e2fa06e --- /dev/null +++ b/project starter code/node_modules/axios/dist/axios.js.map @@ -0,0 +1 @@ +{"version":3,"file":"axios.js","sources":["../lib/helpers/bind.js","../lib/utils.js","../lib/core/AxiosError.js","../lib/helpers/null.js","../lib/helpers/toFormData.js","../lib/helpers/AxiosURLSearchParams.js","../lib/helpers/buildURL.js","../lib/core/InterceptorManager.js","../lib/defaults/transitional.js","../lib/platform/browser/classes/URLSearchParams.js","../lib/platform/browser/classes/FormData.js","../lib/platform/browser/classes/Blob.js","../lib/platform/browser/index.js","../lib/platform/common/utils.js","../lib/platform/index.js","../lib/helpers/toURLEncodedForm.js","../lib/helpers/formDataToJSON.js","../lib/defaults/index.js","../lib/helpers/parseHeaders.js","../lib/core/AxiosHeaders.js","../lib/core/transformData.js","../lib/cancel/isCancel.js","../lib/cancel/CanceledError.js","../lib/core/settle.js","../lib/helpers/parseProtocol.js","../lib/helpers/speedometer.js","../lib/helpers/throttle.js","../lib/helpers/progressEventReducer.js","../lib/helpers/isURLSameOrigin.js","../lib/helpers/cookies.js","../lib/helpers/isAbsoluteURL.js","../lib/helpers/combineURLs.js","../lib/core/buildFullPath.js","../lib/core/mergeConfig.js","../lib/helpers/resolveConfig.js","../lib/adapters/xhr.js","../lib/helpers/composeSignals.js","../lib/helpers/trackStream.js","../lib/adapters/fetch.js","../lib/adapters/adapters.js","../lib/core/dispatchRequest.js","../lib/env/data.js","../lib/helpers/validator.js","../lib/core/Axios.js","../lib/cancel/CancelToken.js","../lib/helpers/spread.js","../lib/helpers/isAxiosError.js","../lib/helpers/HttpStatusCode.js","../lib/axios.js"],"sourcesContent":["'use strict';\n\nexport default function bind(fn, thisArg) {\n return function wrap() {\n return fn.apply(thisArg, arguments);\n };\n}\n","'use strict';\n\nimport bind from './helpers/bind.js';\n\n// utils is a library of generic helper functions non-specific to axios\n\nconst {toString} = Object.prototype;\nconst {getPrototypeOf} = Object;\n\nconst kindOf = (cache => thing => {\n const str = toString.call(thing);\n return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());\n})(Object.create(null));\n\nconst kindOfTest = (type) => {\n type = type.toLowerCase();\n return (thing) => kindOf(thing) === type\n}\n\nconst typeOfTest = type => thing => typeof thing === type;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n *\n * @returns {boolean} True if value is an Array, otherwise false\n */\nconst {isArray} = Array;\n\n/**\n * Determine if a value is undefined\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nconst isUndefined = typeOfTest('undefined');\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nconst isArrayBuffer = kindOfTest('ArrayBuffer');\n\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n let result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a String, otherwise false\n */\nconst isString = typeOfTest('string');\n\n/**\n * Determine if a value is a Function\n *\n * @param {*} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nconst isFunction = typeOfTest('function');\n\n/**\n * Determine if a value is a Number\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Number, otherwise false\n */\nconst isNumber = typeOfTest('number');\n\n/**\n * Determine if a value is an Object\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an Object, otherwise false\n */\nconst isObject = (thing) => thing !== null && typeof thing === 'object';\n\n/**\n * Determine if a value is a Boolean\n *\n * @param {*} thing The value to test\n * @returns {boolean} True if value is a Boolean, otherwise false\n */\nconst isBoolean = thing => thing === true || thing === false;\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a plain Object, otherwise false\n */\nconst isPlainObject = (val) => {\n if (kindOf(val) !== 'object') {\n return false;\n }\n\n const prototype = getPrototypeOf(val);\n return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Date, otherwise false\n */\nconst isDate = kindOfTest('Date');\n\n/**\n * Determine if a value is a File\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFile = kindOfTest('File');\n\n/**\n * Determine if a value is a Blob\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nconst isBlob = kindOfTest('Blob');\n\n/**\n * Determine if a value is a FileList\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFileList = kindOfTest('FileList');\n\n/**\n * Determine if a value is a Stream\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nconst isStream = (val) => isObject(val) && isFunction(val.pipe);\n\n/**\n * Determine if a value is a FormData\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nconst isFormData = (thing) => {\n let kind;\n return thing && (\n (typeof FormData === 'function' && thing instanceof FormData) || (\n isFunction(thing.append) && (\n (kind = kindOf(thing)) === 'formdata' ||\n // detect form-data instance\n (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')\n )\n )\n )\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nconst isURLSearchParams = kindOfTest('URLSearchParams');\n\nconst [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n *\n * @returns {String} The String freed of excess whitespace\n */\nconst trim = (str) => str.trim ?\n str.trim() : str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n *\n * @param {Boolean} [allOwnKeys = false]\n * @returns {any}\n */\nfunction forEach(obj, fn, {allOwnKeys = false} = {}) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n let i;\n let l;\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);\n const len = keys.length;\n let key;\n\n for (i = 0; i < len; i++) {\n key = keys[i];\n fn.call(null, obj[key], key, obj);\n }\n }\n}\n\nfunction findKey(obj, key) {\n key = key.toLowerCase();\n const keys = Object.keys(obj);\n let i = keys.length;\n let _key;\n while (i-- > 0) {\n _key = keys[i];\n if (key === _key.toLowerCase()) {\n return _key;\n }\n }\n return null;\n}\n\nconst _global = (() => {\n /*eslint no-undef:0*/\n if (typeof globalThis !== \"undefined\") return globalThis;\n return typeof self !== \"undefined\" ? self : (typeof window !== 'undefined' ? window : global)\n})();\n\nconst isContextDefined = (context) => !isUndefined(context) && context !== _global;\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n *\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n const {caseless} = isContextDefined(this) && this || {};\n const result = {};\n const assignValue = (val, key) => {\n const targetKey = caseless && findKey(result, key) || key;\n if (isPlainObject(result[targetKey]) && isPlainObject(val)) {\n result[targetKey] = merge(result[targetKey], val);\n } else if (isPlainObject(val)) {\n result[targetKey] = merge({}, val);\n } else if (isArray(val)) {\n result[targetKey] = val.slice();\n } else {\n result[targetKey] = val;\n }\n }\n\n for (let i = 0, l = arguments.length; i < l; i++) {\n arguments[i] && forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n *\n * @param {Boolean} [allOwnKeys]\n * @returns {Object} The resulting value of object a\n */\nconst extend = (a, b, thisArg, {allOwnKeys}= {}) => {\n forEach(b, (val, key) => {\n if (thisArg && isFunction(val)) {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n }, {allOwnKeys});\n return a;\n}\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n *\n * @returns {string} content value without BOM\n */\nconst stripBOM = (content) => {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n}\n\n/**\n * Inherit the prototype methods from one constructor into another\n * @param {function} constructor\n * @param {function} superConstructor\n * @param {object} [props]\n * @param {object} [descriptors]\n *\n * @returns {void}\n */\nconst inherits = (constructor, superConstructor, props, descriptors) => {\n constructor.prototype = Object.create(superConstructor.prototype, descriptors);\n constructor.prototype.constructor = constructor;\n Object.defineProperty(constructor, 'super', {\n value: superConstructor.prototype\n });\n props && Object.assign(constructor.prototype, props);\n}\n\n/**\n * Resolve object with deep prototype chain to a flat object\n * @param {Object} sourceObj source object\n * @param {Object} [destObj]\n * @param {Function|Boolean} [filter]\n * @param {Function} [propFilter]\n *\n * @returns {Object}\n */\nconst toFlatObject = (sourceObj, destObj, filter, propFilter) => {\n let props;\n let i;\n let prop;\n const merged = {};\n\n destObj = destObj || {};\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (sourceObj == null) return destObj;\n\n do {\n props = Object.getOwnPropertyNames(sourceObj);\n i = props.length;\n while (i-- > 0) {\n prop = props[i];\n if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {\n destObj[prop] = sourceObj[prop];\n merged[prop] = true;\n }\n }\n sourceObj = filter !== false && getPrototypeOf(sourceObj);\n } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);\n\n return destObj;\n}\n\n/**\n * Determines whether a string ends with the characters of a specified string\n *\n * @param {String} str\n * @param {String} searchString\n * @param {Number} [position= 0]\n *\n * @returns {boolean}\n */\nconst endsWith = (str, searchString, position) => {\n str = String(str);\n if (position === undefined || position > str.length) {\n position = str.length;\n }\n position -= searchString.length;\n const lastIndex = str.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n}\n\n\n/**\n * Returns new array from array like object or null if failed\n *\n * @param {*} [thing]\n *\n * @returns {?Array}\n */\nconst toArray = (thing) => {\n if (!thing) return null;\n if (isArray(thing)) return thing;\n let i = thing.length;\n if (!isNumber(i)) return null;\n const arr = new Array(i);\n while (i-- > 0) {\n arr[i] = thing[i];\n }\n return arr;\n}\n\n/**\n * Checking if the Uint8Array exists and if it does, it returns a function that checks if the\n * thing passed in is an instance of Uint8Array\n *\n * @param {TypedArray}\n *\n * @returns {Array}\n */\n// eslint-disable-next-line func-names\nconst isTypedArray = (TypedArray => {\n // eslint-disable-next-line func-names\n return thing => {\n return TypedArray && thing instanceof TypedArray;\n };\n})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));\n\n/**\n * For each entry in the object, call the function with the key and value.\n *\n * @param {Object} obj - The object to iterate over.\n * @param {Function} fn - The function to call for each entry.\n *\n * @returns {void}\n */\nconst forEachEntry = (obj, fn) => {\n const generator = obj && obj[Symbol.iterator];\n\n const iterator = generator.call(obj);\n\n let result;\n\n while ((result = iterator.next()) && !result.done) {\n const pair = result.value;\n fn.call(obj, pair[0], pair[1]);\n }\n}\n\n/**\n * It takes a regular expression and a string, and returns an array of all the matches\n *\n * @param {string} regExp - The regular expression to match against.\n * @param {string} str - The string to search.\n *\n * @returns {Array}\n */\nconst matchAll = (regExp, str) => {\n let matches;\n const arr = [];\n\n while ((matches = regExp.exec(str)) !== null) {\n arr.push(matches);\n }\n\n return arr;\n}\n\n/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */\nconst isHTMLForm = kindOfTest('HTMLFormElement');\n\nconst toCamelCase = str => {\n return str.toLowerCase().replace(/[-_\\s]([a-z\\d])(\\w*)/g,\n function replacer(m, p1, p2) {\n return p1.toUpperCase() + p2;\n }\n );\n};\n\n/* Creating a function that will check if an object has a property. */\nconst hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);\n\n/**\n * Determine if a value is a RegExp object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a RegExp object, otherwise false\n */\nconst isRegExp = kindOfTest('RegExp');\n\nconst reduceDescriptors = (obj, reducer) => {\n const descriptors = Object.getOwnPropertyDescriptors(obj);\n const reducedDescriptors = {};\n\n forEach(descriptors, (descriptor, name) => {\n let ret;\n if ((ret = reducer(descriptor, name, obj)) !== false) {\n reducedDescriptors[name] = ret || descriptor;\n }\n });\n\n Object.defineProperties(obj, reducedDescriptors);\n}\n\n/**\n * Makes all methods read-only\n * @param {Object} obj\n */\n\nconst freezeMethods = (obj) => {\n reduceDescriptors(obj, (descriptor, name) => {\n // skip restricted props in strict mode\n if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {\n return false;\n }\n\n const value = obj[name];\n\n if (!isFunction(value)) return;\n\n descriptor.enumerable = false;\n\n if ('writable' in descriptor) {\n descriptor.writable = false;\n return;\n }\n\n if (!descriptor.set) {\n descriptor.set = () => {\n throw Error('Can not rewrite read-only method \\'' + name + '\\'');\n };\n }\n });\n}\n\nconst toObjectSet = (arrayOrString, delimiter) => {\n const obj = {};\n\n const define = (arr) => {\n arr.forEach(value => {\n obj[value] = true;\n });\n }\n\n isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));\n\n return obj;\n}\n\nconst noop = () => {}\n\nconst toFiniteNumber = (value, defaultValue) => {\n return value != null && Number.isFinite(value = +value) ? value : defaultValue;\n}\n\nconst ALPHA = 'abcdefghijklmnopqrstuvwxyz'\n\nconst DIGIT = '0123456789';\n\nconst ALPHABET = {\n DIGIT,\n ALPHA,\n ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT\n}\n\nconst generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {\n let str = '';\n const {length} = alphabet;\n while (size--) {\n str += alphabet[Math.random() * length|0]\n }\n\n return str;\n}\n\n/**\n * If the thing is a FormData object, return true, otherwise return false.\n *\n * @param {unknown} thing - The thing to check.\n *\n * @returns {boolean}\n */\nfunction isSpecCompliantForm(thing) {\n return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);\n}\n\nconst toJSONObject = (obj) => {\n const stack = new Array(10);\n\n const visit = (source, i) => {\n\n if (isObject(source)) {\n if (stack.indexOf(source) >= 0) {\n return;\n }\n\n if(!('toJSON' in source)) {\n stack[i] = source;\n const target = isArray(source) ? [] : {};\n\n forEach(source, (value, key) => {\n const reducedValue = visit(value, i + 1);\n !isUndefined(reducedValue) && (target[key] = reducedValue);\n });\n\n stack[i] = undefined;\n\n return target;\n }\n }\n\n return source;\n }\n\n return visit(obj, 0);\n}\n\nconst isAsyncFn = kindOfTest('AsyncFunction');\n\nconst isThenable = (thing) =>\n thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);\n\nexport default {\n isArray,\n isArrayBuffer,\n isBuffer,\n isFormData,\n isArrayBufferView,\n isString,\n isNumber,\n isBoolean,\n isObject,\n isPlainObject,\n isReadableStream,\n isRequest,\n isResponse,\n isHeaders,\n isUndefined,\n isDate,\n isFile,\n isBlob,\n isRegExp,\n isFunction,\n isStream,\n isURLSearchParams,\n isTypedArray,\n isFileList,\n forEach,\n merge,\n extend,\n trim,\n stripBOM,\n inherits,\n toFlatObject,\n kindOf,\n kindOfTest,\n endsWith,\n toArray,\n forEachEntry,\n matchAll,\n isHTMLForm,\n hasOwnProperty,\n hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection\n reduceDescriptors,\n freezeMethods,\n toObjectSet,\n toCamelCase,\n noop,\n toFiniteNumber,\n findKey,\n global: _global,\n isContextDefined,\n ALPHABET,\n generateString,\n isSpecCompliantForm,\n toJSONObject,\n isAsyncFn,\n isThenable\n};\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [config] The config.\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n *\n * @returns {Error} The created error.\n */\nfunction AxiosError(message, code, config, request, response) {\n Error.call(this);\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n this.stack = (new Error()).stack;\n }\n\n this.message = message;\n this.name = 'AxiosError';\n code && (this.code = code);\n config && (this.config = config);\n request && (this.request = request);\n response && (this.response = response);\n}\n\nutils.inherits(AxiosError, Error, {\n toJSON: function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: utils.toJSONObject(this.config),\n code: this.code,\n status: this.response && this.response.status ? this.response.status : null\n };\n }\n});\n\nconst prototype = AxiosError.prototype;\nconst descriptors = {};\n\n[\n 'ERR_BAD_OPTION_VALUE',\n 'ERR_BAD_OPTION',\n 'ECONNABORTED',\n 'ETIMEDOUT',\n 'ERR_NETWORK',\n 'ERR_FR_TOO_MANY_REDIRECTS',\n 'ERR_DEPRECATED',\n 'ERR_BAD_RESPONSE',\n 'ERR_BAD_REQUEST',\n 'ERR_CANCELED',\n 'ERR_NOT_SUPPORT',\n 'ERR_INVALID_URL'\n// eslint-disable-next-line func-names\n].forEach(code => {\n descriptors[code] = {value: code};\n});\n\nObject.defineProperties(AxiosError, descriptors);\nObject.defineProperty(prototype, 'isAxiosError', {value: true});\n\n// eslint-disable-next-line func-names\nAxiosError.from = (error, code, config, request, response, customProps) => {\n const axiosError = Object.create(prototype);\n\n utils.toFlatObject(error, axiosError, function filter(obj) {\n return obj !== Error.prototype;\n }, prop => {\n return prop !== 'isAxiosError';\n });\n\n AxiosError.call(axiosError, error.message, code, config, request, response);\n\n axiosError.cause = error;\n\n axiosError.name = error.name;\n\n customProps && Object.assign(axiosError, customProps);\n\n return axiosError;\n};\n\nexport default AxiosError;\n","// eslint-disable-next-line strict\nexport default null;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\n// temporary hotfix to avoid circular references until AxiosURLSearchParams is refactored\nimport PlatformFormData from '../platform/node/classes/FormData.js';\n\n/**\n * Determines if the given thing is a array or js object.\n *\n * @param {string} thing - The object or array to be visited.\n *\n * @returns {boolean}\n */\nfunction isVisitable(thing) {\n return utils.isPlainObject(thing) || utils.isArray(thing);\n}\n\n/**\n * It removes the brackets from the end of a string\n *\n * @param {string} key - The key of the parameter.\n *\n * @returns {string} the key without the brackets.\n */\nfunction removeBrackets(key) {\n return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;\n}\n\n/**\n * It takes a path, a key, and a boolean, and returns a string\n *\n * @param {string} path - The path to the current key.\n * @param {string} key - The key of the current object being iterated over.\n * @param {string} dots - If true, the key will be rendered with dots instead of brackets.\n *\n * @returns {string} The path to the current key.\n */\nfunction renderKey(path, key, dots) {\n if (!path) return key;\n return path.concat(key).map(function each(token, i) {\n // eslint-disable-next-line no-param-reassign\n token = removeBrackets(token);\n return !dots && i ? '[' + token + ']' : token;\n }).join(dots ? '.' : '');\n}\n\n/**\n * If the array is an array and none of its elements are visitable, then it's a flat array.\n *\n * @param {Array} arr - The array to check\n *\n * @returns {boolean}\n */\nfunction isFlatArray(arr) {\n return utils.isArray(arr) && !arr.some(isVisitable);\n}\n\nconst predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {\n return /^is[A-Z]/.test(prop);\n});\n\n/**\n * Convert a data object to FormData\n *\n * @param {Object} obj\n * @param {?Object} [formData]\n * @param {?Object} [options]\n * @param {Function} [options.visitor]\n * @param {Boolean} [options.metaTokens = true]\n * @param {Boolean} [options.dots = false]\n * @param {?Boolean} [options.indexes = false]\n *\n * @returns {Object}\n **/\n\n/**\n * It converts an object into a FormData object\n *\n * @param {Object} obj - The object to convert to form data.\n * @param {string} formData - The FormData object to append to.\n * @param {Object} options\n *\n * @returns\n */\nfunction toFormData(obj, formData, options) {\n if (!utils.isObject(obj)) {\n throw new TypeError('target must be an object');\n }\n\n // eslint-disable-next-line no-param-reassign\n formData = formData || new (PlatformFormData || FormData)();\n\n // eslint-disable-next-line no-param-reassign\n options = utils.toFlatObject(options, {\n metaTokens: true,\n dots: false,\n indexes: false\n }, false, function defined(option, source) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n return !utils.isUndefined(source[option]);\n });\n\n const metaTokens = options.metaTokens;\n // eslint-disable-next-line no-use-before-define\n const visitor = options.visitor || defaultVisitor;\n const dots = options.dots;\n const indexes = options.indexes;\n const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;\n const useBlob = _Blob && utils.isSpecCompliantForm(formData);\n\n if (!utils.isFunction(visitor)) {\n throw new TypeError('visitor must be a function');\n }\n\n function convertValue(value) {\n if (value === null) return '';\n\n if (utils.isDate(value)) {\n return value.toISOString();\n }\n\n if (!useBlob && utils.isBlob(value)) {\n throw new AxiosError('Blob is not supported. Use a Buffer instead.');\n }\n\n if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {\n return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);\n }\n\n return value;\n }\n\n /**\n * Default visitor.\n *\n * @param {*} value\n * @param {String|Number} key\n * @param {Array} path\n * @this {FormData}\n *\n * @returns {boolean} return true to visit the each prop of the value recursively\n */\n function defaultVisitor(value, key, path) {\n let arr = value;\n\n if (value && !path && typeof value === 'object') {\n if (utils.endsWith(key, '{}')) {\n // eslint-disable-next-line no-param-reassign\n key = metaTokens ? key : key.slice(0, -2);\n // eslint-disable-next-line no-param-reassign\n value = JSON.stringify(value);\n } else if (\n (utils.isArray(value) && isFlatArray(value)) ||\n ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))\n )) {\n // eslint-disable-next-line no-param-reassign\n key = removeBrackets(key);\n\n arr.forEach(function each(el, index) {\n !(utils.isUndefined(el) || el === null) && formData.append(\n // eslint-disable-next-line no-nested-ternary\n indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),\n convertValue(el)\n );\n });\n return false;\n }\n }\n\n if (isVisitable(value)) {\n return true;\n }\n\n formData.append(renderKey(path, key, dots), convertValue(value));\n\n return false;\n }\n\n const stack = [];\n\n const exposedHelpers = Object.assign(predicates, {\n defaultVisitor,\n convertValue,\n isVisitable\n });\n\n function build(value, path) {\n if (utils.isUndefined(value)) return;\n\n if (stack.indexOf(value) !== -1) {\n throw Error('Circular reference detected in ' + path.join('.'));\n }\n\n stack.push(value);\n\n utils.forEach(value, function each(el, key) {\n const result = !(utils.isUndefined(el) || el === null) && visitor.call(\n formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers\n );\n\n if (result === true) {\n build(el, path ? path.concat(key) : [key]);\n }\n });\n\n stack.pop();\n }\n\n if (!utils.isObject(obj)) {\n throw new TypeError('data must be an object');\n }\n\n build(obj);\n\n return formData;\n}\n\nexport default toFormData;\n","'use strict';\n\nimport toFormData from './toFormData.js';\n\n/**\n * It encodes a string by replacing all characters that are not in the unreserved set with\n * their percent-encoded equivalents\n *\n * @param {string} str - The string to encode.\n *\n * @returns {string} The encoded string.\n */\nfunction encode(str) {\n const charMap = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n '%00': '\\x00'\n };\n return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {\n return charMap[match];\n });\n}\n\n/**\n * It takes a params object and converts it to a FormData object\n *\n * @param {Object} params - The parameters to be converted to a FormData object.\n * @param {Object} options - The options object passed to the Axios constructor.\n *\n * @returns {void}\n */\nfunction AxiosURLSearchParams(params, options) {\n this._pairs = [];\n\n params && toFormData(params, this, options);\n}\n\nconst prototype = AxiosURLSearchParams.prototype;\n\nprototype.append = function append(name, value) {\n this._pairs.push([name, value]);\n};\n\nprototype.toString = function toString(encoder) {\n const _encode = encoder ? function(value) {\n return encoder.call(this, value, encode);\n } : encode;\n\n return this._pairs.map(function each(pair) {\n return _encode(pair[0]) + '=' + _encode(pair[1]);\n }, '').join('&');\n};\n\nexport default AxiosURLSearchParams;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js';\n\n/**\n * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their\n * URI encoded counterparts\n *\n * @param {string} val The value to be encoded.\n *\n * @returns {string} The encoded value.\n */\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @param {?object} options\n *\n * @returns {string} The formatted url\n */\nexport default function buildURL(url, params, options) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n \n const _encode = options && options.encode || encode;\n\n const serializeFn = options && options.serialize;\n\n let serializedParams;\n\n if (serializeFn) {\n serializedParams = serializeFn(params, options);\n } else {\n serializedParams = utils.isURLSearchParams(params) ?\n params.toString() :\n new AxiosURLSearchParams(params, options).toString(_encode);\n }\n\n if (serializedParams) {\n const hashmarkIndex = url.indexOf(\"#\");\n\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\nclass InterceptorManager {\n constructor() {\n this.handlers = [];\n }\n\n /**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\n use(fulfilled, rejected, options) {\n this.handlers.push({\n fulfilled,\n rejected,\n synchronous: options ? options.synchronous : false,\n runWhen: options ? options.runWhen : null\n });\n return this.handlers.length - 1;\n }\n\n /**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n *\n * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise\n */\n eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n }\n\n /**\n * Clear all interceptors from the stack\n *\n * @returns {void}\n */\n clear() {\n if (this.handlers) {\n this.handlers = [];\n }\n }\n\n /**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n *\n * @returns {void}\n */\n forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n }\n}\n\nexport default InterceptorManager;\n","'use strict';\n\nexport default {\n silentJSONParsing: true,\n forcedJSONParsing: true,\n clarifyTimeoutError: false\n};\n","'use strict';\n\nimport AxiosURLSearchParams from '../../../helpers/AxiosURLSearchParams.js';\nexport default typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;\n","'use strict';\n\nexport default typeof FormData !== 'undefined' ? FormData : null;\n","'use strict'\n\nexport default typeof Blob !== 'undefined' ? Blob : null\n","import URLSearchParams from './classes/URLSearchParams.js'\nimport FormData from './classes/FormData.js'\nimport Blob from './classes/Blob.js'\n\nexport default {\n isBrowser: true,\n classes: {\n URLSearchParams,\n FormData,\n Blob\n },\n protocols: ['http', 'https', 'file', 'blob', 'url', 'data']\n};\n","const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n *\n * @returns {boolean}\n */\nconst hasStandardBrowserEnv = (\n (product) => {\n return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0\n })(typeof navigator !== 'undefined' && navigator.product);\n\n/**\n * Determine if we're running in a standard browser webWorker environment\n *\n * Although the `isStandardBrowserEnv` method indicates that\n * `allows axios to run in a web worker`, the WebWorker will still be\n * filtered out due to its judgment standard\n * `typeof window !== 'undefined' && typeof document !== 'undefined'`.\n * This leads to a problem when axios post `FormData` in webWorker\n */\nconst hasStandardBrowserWebWorkerEnv = (() => {\n return (\n typeof WorkerGlobalScope !== 'undefined' &&\n // eslint-disable-next-line no-undef\n self instanceof WorkerGlobalScope &&\n typeof self.importScripts === 'function'\n );\n})();\n\nconst origin = hasBrowserEnv && window.location.href || 'http://localhost';\n\nexport {\n hasBrowserEnv,\n hasStandardBrowserWebWorkerEnv,\n hasStandardBrowserEnv,\n origin\n}\n","import platform from './node/index.js';\nimport * as utils from './common/utils.js';\n\nexport default {\n ...utils,\n ...platform\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport toFormData from './toFormData.js';\nimport platform from '../platform/index.js';\n\nexport default function toURLEncodedForm(data, options) {\n return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({\n visitor: function(value, key, path, helpers) {\n if (platform.isNode && utils.isBuffer(value)) {\n this.append(key, value.toString('base64'));\n return false;\n }\n\n return helpers.defaultVisitor.apply(this, arguments);\n }\n }, options));\n}\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']\n *\n * @param {string} name - The name of the property to get.\n *\n * @returns An array of strings.\n */\nfunction parsePropPath(name) {\n // foo[x][y][z]\n // foo.x.y.z\n // foo-x-y-z\n // foo x y z\n return utils.matchAll(/\\w+|\\[(\\w*)]/g, name).map(match => {\n return match[0] === '[]' ? '' : match[1] || match[0];\n });\n}\n\n/**\n * Convert an array to an object.\n *\n * @param {Array} arr - The array to convert to an object.\n *\n * @returns An object with the same keys and values as the array.\n */\nfunction arrayToObject(arr) {\n const obj = {};\n const keys = Object.keys(arr);\n let i;\n const len = keys.length;\n let key;\n for (i = 0; i < len; i++) {\n key = keys[i];\n obj[key] = arr[key];\n }\n return obj;\n}\n\n/**\n * It takes a FormData object and returns a JavaScript object\n *\n * @param {string} formData The FormData object to convert to JSON.\n *\n * @returns {Object | null} The converted object.\n */\nfunction formDataToJSON(formData) {\n function buildPath(path, value, target, index) {\n let name = path[index++];\n\n if (name === '__proto__') return true;\n\n const isNumericKey = Number.isFinite(+name);\n const isLast = index >= path.length;\n name = !name && utils.isArray(target) ? target.length : name;\n\n if (isLast) {\n if (utils.hasOwnProp(target, name)) {\n target[name] = [target[name], value];\n } else {\n target[name] = value;\n }\n\n return !isNumericKey;\n }\n\n if (!target[name] || !utils.isObject(target[name])) {\n target[name] = [];\n }\n\n const result = buildPath(path, value, target[name], index);\n\n if (result && utils.isArray(target[name])) {\n target[name] = arrayToObject(target[name]);\n }\n\n return !isNumericKey;\n }\n\n if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {\n const obj = {};\n\n utils.forEachEntry(formData, (name, value) => {\n buildPath(parsePropPath(name), value, obj, 0);\n });\n\n return obj;\n }\n\n return null;\n}\n\nexport default formDataToJSON;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\nimport transitionalDefaults from './transitional.js';\nimport toFormData from '../helpers/toFormData.js';\nimport toURLEncodedForm from '../helpers/toURLEncodedForm.js';\nimport platform from '../platform/index.js';\nimport formDataToJSON from '../helpers/formDataToJSON.js';\n\n/**\n * It takes a string, tries to parse it, and if it fails, it returns the stringified version\n * of the input\n *\n * @param {any} rawValue - The value to be stringified.\n * @param {Function} parser - A function that parses a string into a JavaScript object.\n * @param {Function} encoder - A function that takes a value and returns a string.\n *\n * @returns {string} A stringified version of the rawValue.\n */\nfunction stringifySafely(rawValue, parser, encoder) {\n if (utils.isString(rawValue)) {\n try {\n (parser || JSON.parse)(rawValue);\n return utils.trim(rawValue);\n } catch (e) {\n if (e.name !== 'SyntaxError') {\n throw e;\n }\n }\n }\n\n return (encoder || JSON.stringify)(rawValue);\n}\n\nconst defaults = {\n\n transitional: transitionalDefaults,\n\n adapter: ['xhr', 'http', 'fetch'],\n\n transformRequest: [function transformRequest(data, headers) {\n const contentType = headers.getContentType() || '';\n const hasJSONContentType = contentType.indexOf('application/json') > -1;\n const isObjectPayload = utils.isObject(data);\n\n if (isObjectPayload && utils.isHTMLForm(data)) {\n data = new FormData(data);\n }\n\n const isFormData = utils.isFormData(data);\n\n if (isFormData) {\n return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;\n }\n\n if (utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data) ||\n utils.isReadableStream(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);\n return data.toString();\n }\n\n let isFileList;\n\n if (isObjectPayload) {\n if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {\n return toURLEncodedForm(data, this.formSerializer).toString();\n }\n\n if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {\n const _FormData = this.env && this.env.FormData;\n\n return toFormData(\n isFileList ? {'files[]': data} : data,\n _FormData && new _FormData(),\n this.formSerializer\n );\n }\n }\n\n if (isObjectPayload || hasJSONContentType ) {\n headers.setContentType('application/json', false);\n return stringifySafely(data);\n }\n\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n const transitional = this.transitional || defaults.transitional;\n const forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n const JSONRequested = this.responseType === 'json';\n\n if (utils.isResponse(data) || utils.isReadableStream(data)) {\n return data;\n }\n\n if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {\n const silentJSONParsing = transitional && transitional.silentJSONParsing;\n const strictJSONParsing = !silentJSONParsing && JSONRequested;\n\n try {\n return JSON.parse(data);\n } catch (e) {\n if (strictJSONParsing) {\n if (e.name === 'SyntaxError') {\n throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);\n }\n throw e;\n }\n }\n }\n\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n env: {\n FormData: platform.classes.FormData,\n Blob: platform.classes.Blob\n },\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n },\n\n headers: {\n common: {\n 'Accept': 'application/json, text/plain, */*',\n 'Content-Type': undefined\n }\n }\n};\n\nutils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {\n defaults.headers[method] = {};\n});\n\nexport default defaults;\n","'use strict';\n\nimport utils from './../utils.js';\n\n// RawAxiosHeaders whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nconst ignoreDuplicateOf = utils.toObjectSet([\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n]);\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} rawHeaders Headers needing to be parsed\n *\n * @returns {Object} Headers parsed into an object\n */\nexport default rawHeaders => {\n const parsed = {};\n let key;\n let val;\n let i;\n\n rawHeaders && rawHeaders.split('\\n').forEach(function parser(line) {\n i = line.indexOf(':');\n key = line.substring(0, i).trim().toLowerCase();\n val = line.substring(i + 1).trim();\n\n if (!key || (parsed[key] && ignoreDuplicateOf[key])) {\n return;\n }\n\n if (key === 'set-cookie') {\n if (parsed[key]) {\n parsed[key].push(val);\n } else {\n parsed[key] = [val];\n }\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n });\n\n return parsed;\n};\n","'use strict';\n\nimport utils from '../utils.js';\nimport parseHeaders from '../helpers/parseHeaders.js';\n\nconst $internals = Symbol('internals');\n\nfunction normalizeHeader(header) {\n return header && String(header).trim().toLowerCase();\n}\n\nfunction normalizeValue(value) {\n if (value === false || value == null) {\n return value;\n }\n\n return utils.isArray(value) ? value.map(normalizeValue) : String(value);\n}\n\nfunction parseTokens(str) {\n const tokens = Object.create(null);\n const tokensRE = /([^\\s,;=]+)\\s*(?:=\\s*([^,;]+))?/g;\n let match;\n\n while ((match = tokensRE.exec(str))) {\n tokens[match[1]] = match[2];\n }\n\n return tokens;\n}\n\nconst isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());\n\nfunction matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {\n if (utils.isFunction(filter)) {\n return filter.call(this, value, header);\n }\n\n if (isHeaderNameFilter) {\n value = header;\n }\n\n if (!utils.isString(value)) return;\n\n if (utils.isString(filter)) {\n return value.indexOf(filter) !== -1;\n }\n\n if (utils.isRegExp(filter)) {\n return filter.test(value);\n }\n}\n\nfunction formatHeader(header) {\n return header.trim()\n .toLowerCase().replace(/([a-z\\d])(\\w*)/g, (w, char, str) => {\n return char.toUpperCase() + str;\n });\n}\n\nfunction buildAccessors(obj, header) {\n const accessorName = utils.toCamelCase(' ' + header);\n\n ['get', 'set', 'has'].forEach(methodName => {\n Object.defineProperty(obj, methodName + accessorName, {\n value: function(arg1, arg2, arg3) {\n return this[methodName].call(this, header, arg1, arg2, arg3);\n },\n configurable: true\n });\n });\n}\n\nclass AxiosHeaders {\n constructor(headers) {\n headers && this.set(headers);\n }\n\n set(header, valueOrRewrite, rewrite) {\n const self = this;\n\n function setHeader(_value, _header, _rewrite) {\n const lHeader = normalizeHeader(_header);\n\n if (!lHeader) {\n throw new Error('header name must be a non-empty string');\n }\n\n const key = utils.findKey(self, lHeader);\n\n if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {\n self[key || _header] = normalizeValue(_value);\n }\n }\n\n const setHeaders = (headers, _rewrite) =>\n utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));\n\n if (utils.isPlainObject(header) || header instanceof this.constructor) {\n setHeaders(header, valueOrRewrite)\n } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {\n setHeaders(parseHeaders(header), valueOrRewrite);\n } else if (utils.isHeaders(header)) {\n for (const [key, value] of header.entries()) {\n setHeader(value, key, rewrite);\n }\n } else {\n header != null && setHeader(valueOrRewrite, header, rewrite);\n }\n\n return this;\n }\n\n get(header, parser) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n if (key) {\n const value = this[key];\n\n if (!parser) {\n return value;\n }\n\n if (parser === true) {\n return parseTokens(value);\n }\n\n if (utils.isFunction(parser)) {\n return parser.call(this, value, key);\n }\n\n if (utils.isRegExp(parser)) {\n return parser.exec(value);\n }\n\n throw new TypeError('parser must be boolean|regexp|function');\n }\n }\n }\n\n has(header, matcher) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));\n }\n\n return false;\n }\n\n delete(header, matcher) {\n const self = this;\n let deleted = false;\n\n function deleteHeader(_header) {\n _header = normalizeHeader(_header);\n\n if (_header) {\n const key = utils.findKey(self, _header);\n\n if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {\n delete self[key];\n\n deleted = true;\n }\n }\n }\n\n if (utils.isArray(header)) {\n header.forEach(deleteHeader);\n } else {\n deleteHeader(header);\n }\n\n return deleted;\n }\n\n clear(matcher) {\n const keys = Object.keys(this);\n let i = keys.length;\n let deleted = false;\n\n while (i--) {\n const key = keys[i];\n if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {\n delete this[key];\n deleted = true;\n }\n }\n\n return deleted;\n }\n\n normalize(format) {\n const self = this;\n const headers = {};\n\n utils.forEach(this, (value, header) => {\n const key = utils.findKey(headers, header);\n\n if (key) {\n self[key] = normalizeValue(value);\n delete self[header];\n return;\n }\n\n const normalized = format ? formatHeader(header) : String(header).trim();\n\n if (normalized !== header) {\n delete self[header];\n }\n\n self[normalized] = normalizeValue(value);\n\n headers[normalized] = true;\n });\n\n return this;\n }\n\n concat(...targets) {\n return this.constructor.concat(this, ...targets);\n }\n\n toJSON(asStrings) {\n const obj = Object.create(null);\n\n utils.forEach(this, (value, header) => {\n value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);\n });\n\n return obj;\n }\n\n [Symbol.iterator]() {\n return Object.entries(this.toJSON())[Symbol.iterator]();\n }\n\n toString() {\n return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\\n');\n }\n\n get [Symbol.toStringTag]() {\n return 'AxiosHeaders';\n }\n\n static from(thing) {\n return thing instanceof this ? thing : new this(thing);\n }\n\n static concat(first, ...targets) {\n const computed = new this(first);\n\n targets.forEach((target) => computed.set(target));\n\n return computed;\n }\n\n static accessor(header) {\n const internals = this[$internals] = (this[$internals] = {\n accessors: {}\n });\n\n const accessors = internals.accessors;\n const prototype = this.prototype;\n\n function defineAccessor(_header) {\n const lHeader = normalizeHeader(_header);\n\n if (!accessors[lHeader]) {\n buildAccessors(prototype, _header);\n accessors[lHeader] = true;\n }\n }\n\n utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);\n\n return this;\n }\n}\n\nAxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);\n\n// reserved names hotfix\nutils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {\n let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`\n return {\n get: () => value,\n set(headerValue) {\n this[mapped] = headerValue;\n }\n }\n});\n\nutils.freezeMethods(AxiosHeaders);\n\nexport default AxiosHeaders;\n","'use strict';\n\nimport utils from './../utils.js';\nimport defaults from '../defaults/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Array|Function} fns A single function or Array of functions\n * @param {?Object} response The response object\n *\n * @returns {*} The resulting transformed data\n */\nexport default function transformData(fns, response) {\n const config = this || defaults;\n const context = response || config;\n const headers = AxiosHeaders.from(context.headers);\n let data = context.data;\n\n utils.forEach(fns, function transform(fn) {\n data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);\n });\n\n headers.normalize();\n\n return data;\n}\n","'use strict';\n\nexport default function isCancel(value) {\n return !!(value && value.__CANCEL__);\n}\n","'use strict';\n\nimport AxiosError from '../core/AxiosError.js';\nimport utils from '../utils.js';\n\n/**\n * A `CanceledError` is an object that is thrown when an operation is canceled.\n *\n * @param {string=} message The message.\n * @param {Object=} config The config.\n * @param {Object=} request The request.\n *\n * @returns {CanceledError} The created error.\n */\nfunction CanceledError(message, config, request) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);\n this.name = 'CanceledError';\n}\n\nutils.inherits(CanceledError, AxiosError, {\n __CANCEL__: true\n});\n\nexport default CanceledError;\n","'use strict';\n\nimport AxiosError from './AxiosError.js';\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n *\n * @returns {object} The response.\n */\nexport default function settle(resolve, reject, response) {\n const validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(new AxiosError(\n 'Request failed with status code ' + response.status,\n [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],\n response.config,\n response.request,\n response\n ));\n }\n}\n","'use strict';\n\nexport default function parseProtocol(url) {\n const match = /^([-+\\w]{1,25})(:?\\/\\/|:)/.exec(url);\n return match && match[1] || '';\n}\n","'use strict';\n\n/**\n * Calculate data maxRate\n * @param {Number} [samplesCount= 10]\n * @param {Number} [min= 1000]\n * @returns {Function}\n */\nfunction speedometer(samplesCount, min) {\n samplesCount = samplesCount || 10;\n const bytes = new Array(samplesCount);\n const timestamps = new Array(samplesCount);\n let head = 0;\n let tail = 0;\n let firstSampleTS;\n\n min = min !== undefined ? min : 1000;\n\n return function push(chunkLength) {\n const now = Date.now();\n\n const startedAt = timestamps[tail];\n\n if (!firstSampleTS) {\n firstSampleTS = now;\n }\n\n bytes[head] = chunkLength;\n timestamps[head] = now;\n\n let i = tail;\n let bytesCount = 0;\n\n while (i !== head) {\n bytesCount += bytes[i++];\n i = i % samplesCount;\n }\n\n head = (head + 1) % samplesCount;\n\n if (head === tail) {\n tail = (tail + 1) % samplesCount;\n }\n\n if (now - firstSampleTS < min) {\n return;\n }\n\n const passed = startedAt && now - startedAt;\n\n return passed ? Math.round(bytesCount * 1000 / passed) : undefined;\n };\n}\n\nexport default speedometer;\n","'use strict';\n\n/**\n * Throttle decorator\n * @param {Function} fn\n * @param {Number} freq\n * @return {Function}\n */\nfunction throttle(fn, freq) {\n let timestamp = 0;\n const threshold = 1000 / freq;\n let timer = null;\n return function throttled() {\n const force = this === true;\n\n const now = Date.now();\n if (force || now - timestamp > threshold) {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n timestamp = now;\n return fn.apply(null, arguments);\n }\n if (!timer) {\n timer = setTimeout(() => {\n timer = null;\n timestamp = Date.now();\n return fn.apply(null, arguments);\n }, threshold - (now - timestamp));\n }\n };\n}\n\nexport default throttle;\n","import speedometer from \"./speedometer.js\";\nimport throttle from \"./throttle.js\";\n\nexport default (listener, isDownloadStream, freq = 3) => {\n let bytesNotified = 0;\n const _speedometer = speedometer(50, 250);\n\n return throttle(e => {\n const loaded = e.loaded;\n const total = e.lengthComputable ? e.total : undefined;\n const progressBytes = loaded - bytesNotified;\n const rate = _speedometer(progressBytes);\n const inRange = loaded <= total;\n\n bytesNotified = loaded;\n\n const data = {\n loaded,\n total,\n progress: total ? (loaded / total) : undefined,\n bytes: progressBytes,\n rate: rate ? rate : undefined,\n estimated: rate && total && inRange ? (total - loaded) / rate : undefined,\n event: e,\n lengthComputable: total != null\n };\n\n data[isDownloadStream ? 'download' : 'upload'] = true;\n\n listener(data);\n }, freq);\n}\n","'use strict';\n\nimport utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n// Standard browser envs have full support of the APIs needed to test\n// whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n const msie = /(msie|trident)/i.test(navigator.userAgent);\n const urlParsingNode = document.createElement('a');\n let originURL;\n\n /**\n * Parse a URL to discover its components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n let href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })();\n","import utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n // Standard browser envs support document.cookie\n {\n write(name, value, expires, path, domain, secure) {\n const cookie = [name + '=' + encodeURIComponent(value)];\n\n utils.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());\n\n utils.isString(path) && cookie.push('path=' + path);\n\n utils.isString(domain) && cookie.push('domain=' + domain);\n\n secure === true && cookie.push('secure');\n\n document.cookie = cookie.join('; ');\n },\n\n read(name) {\n const match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n }\n\n :\n\n // Non-standard browser env (web workers, react-native) lack needed support.\n {\n write() {},\n read() {\n return null;\n },\n remove() {}\n };\n\n","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n *\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nexport default function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(url);\n}\n","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n *\n * @returns {string} The combined URL\n */\nexport default function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/?\\/$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n}\n","'use strict';\n\nimport isAbsoluteURL from '../helpers/isAbsoluteURL.js';\nimport combineURLs from '../helpers/combineURLs.js';\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n *\n * @returns {string} The combined full path\n */\nexport default function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosHeaders from \"./AxiosHeaders.js\";\n\nconst headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n *\n * @returns {Object} New object resulting from merging config2 to config1\n */\nexport default function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n const config = {};\n\n function getMergedValue(target, source, caseless) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge.call({caseless}, target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDeepProperties(a, b, caseless) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(a, b, caseless);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a, caseless);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function valueFromConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function defaultToConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDirectKeys(a, b, prop) {\n if (prop in config2) {\n return getMergedValue(a, b);\n } else if (prop in config1) {\n return getMergedValue(undefined, a);\n }\n }\n\n const mergeMap = {\n url: valueFromConfig2,\n method: valueFromConfig2,\n data: valueFromConfig2,\n baseURL: defaultToConfig2,\n transformRequest: defaultToConfig2,\n transformResponse: defaultToConfig2,\n paramsSerializer: defaultToConfig2,\n timeout: defaultToConfig2,\n timeoutMessage: defaultToConfig2,\n withCredentials: defaultToConfig2,\n withXSRFToken: defaultToConfig2,\n adapter: defaultToConfig2,\n responseType: defaultToConfig2,\n xsrfCookieName: defaultToConfig2,\n xsrfHeaderName: defaultToConfig2,\n onUploadProgress: defaultToConfig2,\n onDownloadProgress: defaultToConfig2,\n decompress: defaultToConfig2,\n maxContentLength: defaultToConfig2,\n maxBodyLength: defaultToConfig2,\n beforeRedirect: defaultToConfig2,\n transport: defaultToConfig2,\n httpAgent: defaultToConfig2,\n httpsAgent: defaultToConfig2,\n cancelToken: defaultToConfig2,\n socketPath: defaultToConfig2,\n responseEncoding: defaultToConfig2,\n validateStatus: mergeDirectKeys,\n headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)\n };\n\n utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {\n const merge = mergeMap[prop] || mergeDeepProperties;\n const configValue = merge(config1[prop], config2[prop], prop);\n (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);\n });\n\n return config;\n}\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport isURLSameOrigin from \"./isURLSameOrigin.js\";\nimport cookies from \"./cookies.js\";\nimport buildFullPath from \"../core/buildFullPath.js\";\nimport mergeConfig from \"../core/mergeConfig.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport buildURL from \"./buildURL.js\";\n\nexport default (config) => {\n const newConfig = mergeConfig({}, config);\n\n let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;\n\n newConfig.headers = headers = AxiosHeaders.from(headers);\n\n newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);\n\n // HTTP basic authentication\n if (auth) {\n headers.set('Authorization', 'Basic ' +\n btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))\n );\n }\n\n let contentType;\n\n if (utils.isFormData(data)) {\n if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {\n headers.setContentType(undefined); // Let the browser set it\n } else if ((contentType = headers.getContentType()) !== false) {\n // fix semicolon duplication issue for ReactNative FormData implementation\n const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];\n headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));\n }\n }\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n\n if (platform.hasStandardBrowserEnv) {\n withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));\n\n if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {\n // Add xsrf header\n const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);\n\n if (xsrfValue) {\n headers.set(xsrfHeaderName, xsrfValue);\n }\n }\n }\n\n return newConfig;\n}\n\n","import utils from './../utils.js';\nimport settle from './../core/settle.js';\nimport transitionalDefaults from '../defaults/transitional.js';\nimport AxiosError from '../core/AxiosError.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport parseProtocol from '../helpers/parseProtocol.js';\nimport platform from '../platform/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport progressEventReducer from '../helpers/progressEventReducer.js';\nimport resolveConfig from \"../helpers/resolveConfig.js\";\n\nconst isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';\n\nexport default isXHRAdapterSupported && function (config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n const _config = resolveConfig(config);\n let requestData = _config.data;\n const requestHeaders = AxiosHeaders.from(_config.headers).normalize();\n let {responseType} = _config;\n let onCanceled;\n function done() {\n if (_config.cancelToken) {\n _config.cancelToken.unsubscribe(onCanceled);\n }\n\n if (_config.signal) {\n _config.signal.removeEventListener('abort', onCanceled);\n }\n }\n\n let request = new XMLHttpRequest();\n\n request.open(_config.method.toUpperCase(), _config.url, true);\n\n // Set the request timeout in MS\n request.timeout = _config.timeout;\n\n function onloadend() {\n if (!request) {\n return;\n }\n // Prepare the response\n const responseHeaders = AxiosHeaders.from(\n 'getAllResponseHeaders' in request && request.getAllResponseHeaders()\n );\n const responseData = !responseType || responseType === 'text' || responseType === 'json' ?\n request.responseText : request.response;\n const response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config,\n request\n };\n\n settle(function _resolve(value) {\n resolve(value);\n done();\n }, function _reject(err) {\n reject(err);\n done();\n }, response);\n\n // Clean up request\n request = null;\n }\n\n if ('onloadend' in request) {\n // Use onloadend if available\n request.onloadend = onloadend;\n } else {\n // Listen for ready state to emulate onloadend\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n // readystate handler is calling before onerror or ontimeout handlers,\n // so we should call onloadend on the next 'tick'\n setTimeout(onloadend);\n };\n }\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';\n const transitional = _config.transitional || transitionalDefaults;\n if (_config.timeoutErrorMessage) {\n timeoutErrorMessage = _config.timeoutErrorMessage;\n }\n reject(new AxiosError(\n timeoutErrorMessage,\n transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,\n _config,\n request));\n\n // Clean up request\n request = null;\n };\n\n // Remove Content-Type if data is undefined\n requestData === undefined && requestHeaders.setContentType(null);\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {\n request.setRequestHeader(key, val);\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(_config.withCredentials)) {\n request.withCredentials = !!_config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (responseType && responseType !== 'json') {\n request.responseType = _config.responseType;\n }\n\n // Handle progress if needed\n if (typeof _config.onDownloadProgress === 'function') {\n request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true));\n }\n\n // Not all browsers support upload events\n if (typeof _config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress));\n }\n\n if (_config.cancelToken || _config.signal) {\n // Handle cancellation\n // eslint-disable-next-line func-names\n onCanceled = cancel => {\n if (!request) {\n return;\n }\n reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);\n request.abort();\n request = null;\n };\n\n _config.cancelToken && _config.cancelToken.subscribe(onCanceled);\n if (_config.signal) {\n _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);\n }\n }\n\n const protocol = parseProtocol(_config.url);\n\n if (protocol && platform.protocols.indexOf(protocol) === -1) {\n reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));\n return;\n }\n\n\n // Send the request\n request.send(requestData || null);\n });\n}\n","import CanceledError from \"../cancel/CanceledError.js\";\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst composeSignals = (signals, timeout) => {\n let controller = new AbortController();\n\n let aborted;\n\n const onabort = function (cancel) {\n if (!aborted) {\n aborted = true;\n unsubscribe();\n const err = cancel instanceof Error ? cancel : this.reason;\n controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));\n }\n }\n\n let timer = timeout && setTimeout(() => {\n onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT))\n }, timeout)\n\n const unsubscribe = () => {\n if (signals) {\n timer && clearTimeout(timer);\n timer = null;\n signals.forEach(signal => {\n signal &&\n (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));\n });\n signals = null;\n }\n }\n\n signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort));\n\n const {signal} = controller;\n\n signal.unsubscribe = unsubscribe;\n\n return [signal, () => {\n timer && clearTimeout(timer);\n timer = null;\n }];\n}\n\nexport default composeSignals;\n","\n\nexport const streamChunk = function* (chunk, chunkSize) {\n let len = chunk.byteLength;\n\n if (!chunkSize || len < chunkSize) {\n yield chunk;\n return;\n }\n\n let pos = 0;\n let end;\n\n while (pos < len) {\n end = pos + chunkSize;\n yield chunk.slice(pos, end);\n pos = end;\n }\n}\n\nexport const readBytes = async function* (iterable, chunkSize, encode) {\n for await (const chunk of iterable) {\n yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);\n }\n}\n\nexport const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {\n const iterator = readBytes(stream, chunkSize, encode);\n\n let bytes = 0;\n\n return new ReadableStream({\n type: 'bytes',\n\n async pull(controller) {\n const {done, value} = await iterator.next();\n\n if (done) {\n controller.close();\n onFinish();\n return;\n }\n\n let len = value.byteLength;\n onProgress && onProgress(bytes += len);\n controller.enqueue(new Uint8Array(value));\n },\n cancel(reason) {\n onFinish(reason);\n return iterator.return();\n }\n }, {\n highWaterMark: 2\n })\n}\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport AxiosError from \"../core/AxiosError.js\";\nimport composeSignals from \"../helpers/composeSignals.js\";\nimport {trackStream} from \"../helpers/trackStream.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport progressEventReducer from \"../helpers/progressEventReducer.js\";\nimport resolveConfig from \"../helpers/resolveConfig.js\";\nimport settle from \"../core/settle.js\";\n\nconst fetchProgressDecorator = (total, fn) => {\n const lengthComputable = total != null;\n return (loaded) => setTimeout(() => fn({\n lengthComputable,\n total,\n loaded\n }));\n}\n\nconst isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';\nconst isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';\n\n// used only inside the fetch adapter\nconst encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?\n ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :\n async (str) => new Uint8Array(await new Response(str).arrayBuffer())\n);\n\nconst supportsRequestStream = isReadableStreamSupported && (() => {\n let duplexAccessed = false;\n\n const hasContentType = new Request(platform.origin, {\n body: new ReadableStream(),\n method: 'POST',\n get duplex() {\n duplexAccessed = true;\n return 'half';\n },\n }).headers.has('Content-Type');\n\n return duplexAccessed && !hasContentType;\n})();\n\nconst DEFAULT_CHUNK_SIZE = 64 * 1024;\n\nconst supportsResponseStream = isReadableStreamSupported && !!(()=> {\n try {\n return utils.isReadableStream(new Response('').body);\n } catch(err) {\n // return undefined\n }\n})();\n\nconst resolvers = {\n stream: supportsResponseStream && ((res) => res.body)\n};\n\nisFetchSupported && (((res) => {\n ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {\n !resolvers[type] && (resolvers[type] = utils.isFunction(res[type]) ? (res) => res[type]() :\n (_, config) => {\n throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);\n })\n });\n})(new Response));\n\nconst getBodyLength = async (body) => {\n if (body == null) {\n return 0;\n }\n\n if(utils.isBlob(body)) {\n return body.size;\n }\n\n if(utils.isSpecCompliantForm(body)) {\n return (await new Request(body).arrayBuffer()).byteLength;\n }\n\n if(utils.isArrayBufferView(body)) {\n return body.byteLength;\n }\n\n if(utils.isURLSearchParams(body)) {\n body = body + '';\n }\n\n if(utils.isString(body)) {\n return (await encodeText(body)).byteLength;\n }\n}\n\nconst resolveBodyLength = async (headers, body) => {\n const length = utils.toFiniteNumber(headers.getContentLength());\n\n return length == null ? getBodyLength(body) : length;\n}\n\nexport default isFetchSupported && (async (config) => {\n let {\n url,\n method,\n data,\n signal,\n cancelToken,\n timeout,\n onDownloadProgress,\n onUploadProgress,\n responseType,\n headers,\n withCredentials = 'same-origin',\n fetchOptions\n } = resolveConfig(config);\n\n responseType = responseType ? (responseType + '').toLowerCase() : 'text';\n\n let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ?\n composeSignals([signal, cancelToken], timeout) : [];\n\n let finished, request;\n\n const onFinish = () => {\n !finished && setTimeout(() => {\n composedSignal && composedSignal.unsubscribe();\n });\n\n finished = true;\n }\n\n let requestContentLength;\n\n try {\n if (\n onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&\n (requestContentLength = await resolveBodyLength(headers, data)) !== 0\n ) {\n let _request = new Request(url, {\n method: 'POST',\n body: data,\n duplex: \"half\"\n });\n\n let contentTypeHeader;\n\n if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {\n headers.setContentType(contentTypeHeader)\n }\n\n if (_request.body) {\n data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(\n requestContentLength,\n progressEventReducer(onUploadProgress)\n ), null, encodeText);\n }\n }\n\n if (!utils.isString(withCredentials)) {\n withCredentials = withCredentials ? 'cors' : 'omit';\n }\n\n request = new Request(url, {\n ...fetchOptions,\n signal: composedSignal,\n method: method.toUpperCase(),\n headers: headers.normalize().toJSON(),\n body: data,\n duplex: \"half\",\n withCredentials\n });\n\n let response = await fetch(request);\n\n const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');\n\n if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {\n const options = {};\n\n ['status', 'statusText', 'headers'].forEach(prop => {\n options[prop] = response[prop];\n });\n\n const responseContentLength = utils.toFiniteNumber(response.headers.get('content-length'));\n\n response = new Response(\n trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(\n responseContentLength,\n progressEventReducer(onDownloadProgress, true)\n ), isStreamResponse && onFinish, encodeText),\n options\n );\n }\n\n responseType = responseType || 'text';\n\n let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](response, config);\n\n !isStreamResponse && onFinish();\n\n stopTimeout && stopTimeout();\n\n return await new Promise((resolve, reject) => {\n settle(resolve, reject, {\n data: responseData,\n headers: AxiosHeaders.from(response.headers),\n status: response.status,\n statusText: response.statusText,\n config,\n request\n })\n })\n } catch (err) {\n onFinish();\n\n if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {\n throw Object.assign(\n new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),\n {\n cause: err.cause || err\n }\n )\n }\n\n throw AxiosError.from(err, err && err.code, config, request);\n }\n});\n\n\n","import utils from '../utils.js';\nimport httpAdapter from './http.js';\nimport xhrAdapter from './xhr.js';\nimport fetchAdapter from './fetch.js';\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst knownAdapters = {\n http: httpAdapter,\n xhr: xhrAdapter,\n fetch: fetchAdapter\n}\n\nutils.forEach(knownAdapters, (fn, value) => {\n if (fn) {\n try {\n Object.defineProperty(fn, 'name', {value});\n } catch (e) {\n // eslint-disable-next-line no-empty\n }\n Object.defineProperty(fn, 'adapterName', {value});\n }\n});\n\nconst renderReason = (reason) => `- ${reason}`;\n\nconst isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;\n\nexport default {\n getAdapter: (adapters) => {\n adapters = utils.isArray(adapters) ? adapters : [adapters];\n\n const {length} = adapters;\n let nameOrAdapter;\n let adapter;\n\n const rejectedReasons = {};\n\n for (let i = 0; i < length; i++) {\n nameOrAdapter = adapters[i];\n let id;\n\n adapter = nameOrAdapter;\n\n if (!isResolvedHandle(nameOrAdapter)) {\n adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];\n\n if (adapter === undefined) {\n throw new AxiosError(`Unknown adapter '${id}'`);\n }\n }\n\n if (adapter) {\n break;\n }\n\n rejectedReasons[id || '#' + i] = adapter;\n }\n\n if (!adapter) {\n\n const reasons = Object.entries(rejectedReasons)\n .map(([id, state]) => `adapter ${id} ` +\n (state === false ? 'is not supported by the environment' : 'is not available in the build')\n );\n\n let s = length ?\n (reasons.length > 1 ? 'since :\\n' + reasons.map(renderReason).join('\\n') : ' ' + renderReason(reasons[0])) :\n 'as no adapter specified';\n\n throw new AxiosError(\n `There is no suitable adapter to dispatch the request ` + s,\n 'ERR_NOT_SUPPORT'\n );\n }\n\n return adapter;\n },\n adapters: knownAdapters\n}\n","'use strict';\n\nimport transformData from './transformData.js';\nimport isCancel from '../cancel/isCancel.js';\nimport defaults from '../defaults/index.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport adapters from \"../adapters/adapters.js\";\n\n/**\n * Throws a `CanceledError` if cancellation has been requested.\n *\n * @param {Object} config The config that is to be used for the request\n *\n * @returns {void}\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n\n if (config.signal && config.signal.aborted) {\n throw new CanceledError(null, config);\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n *\n * @returns {Promise} The Promise to be fulfilled\n */\nexport default function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n config.headers = AxiosHeaders.from(config.headers);\n\n // Transform request data\n config.data = transformData.call(\n config,\n config.transformRequest\n );\n\n if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {\n config.headers.setContentType('application/x-www-form-urlencoded', false);\n }\n\n const adapter = adapters.getAdapter(config.adapter || defaults.adapter);\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData.call(\n config,\n config.transformResponse,\n response\n );\n\n response.headers = AxiosHeaders.from(response.headers);\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData.call(\n config,\n config.transformResponse,\n reason.response\n );\n reason.response.headers = AxiosHeaders.from(reason.response.headers);\n }\n }\n\n return Promise.reject(reason);\n });\n}\n","export const VERSION = \"1.7.2\";","'use strict';\n\nimport {VERSION} from '../env/data.js';\nimport AxiosError from '../core/AxiosError.js';\n\nconst validators = {};\n\n// eslint-disable-next-line func-names\n['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {\n validators[type] = function validator(thing) {\n return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;\n };\n});\n\nconst deprecatedWarnings = {};\n\n/**\n * Transitional option validator\n *\n * @param {function|boolean?} validator - set to false if the transitional option has been removed\n * @param {string?} version - deprecated version / removed since version\n * @param {string?} message - some message with additional info\n *\n * @returns {function}\n */\nvalidators.transitional = function transitional(validator, version, message) {\n function formatMessage(opt, desc) {\n return '[Axios v' + VERSION + '] Transitional option \\'' + opt + '\\'' + desc + (message ? '. ' + message : '');\n }\n\n // eslint-disable-next-line func-names\n return (value, opt, opts) => {\n if (validator === false) {\n throw new AxiosError(\n formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),\n AxiosError.ERR_DEPRECATED\n );\n }\n\n if (version && !deprecatedWarnings[opt]) {\n deprecatedWarnings[opt] = true;\n // eslint-disable-next-line no-console\n console.warn(\n formatMessage(\n opt,\n ' has been deprecated since v' + version + ' and will be removed in the near future'\n )\n );\n }\n\n return validator ? validator(value, opt, opts) : true;\n };\n};\n\n/**\n * Assert object's properties type\n *\n * @param {object} options\n * @param {object} schema\n * @param {boolean?} allowUnknown\n *\n * @returns {object}\n */\n\nfunction assertOptions(options, schema, allowUnknown) {\n if (typeof options !== 'object') {\n throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);\n }\n const keys = Object.keys(options);\n let i = keys.length;\n while (i-- > 0) {\n const opt = keys[i];\n const validator = schema[opt];\n if (validator) {\n const value = options[opt];\n const result = value === undefined || validator(value, opt, options);\n if (result !== true) {\n throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);\n }\n continue;\n }\n if (allowUnknown !== true) {\n throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);\n }\n }\n}\n\nexport default {\n assertOptions,\n validators\n};\n","'use strict';\n\nimport utils from './../utils.js';\nimport buildURL from '../helpers/buildURL.js';\nimport InterceptorManager from './InterceptorManager.js';\nimport dispatchRequest from './dispatchRequest.js';\nimport mergeConfig from './mergeConfig.js';\nimport buildFullPath from './buildFullPath.js';\nimport validator from '../helpers/validator.js';\nimport AxiosHeaders from './AxiosHeaders.js';\n\nconst validators = validator.validators;\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n *\n * @return {Axios} A new instance of Axios\n */\nclass Axios {\n constructor(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n }\n\n /**\n * Dispatch a request\n *\n * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)\n * @param {?Object} config\n *\n * @returns {Promise} The Promise to be fulfilled\n */\n async request(configOrUrl, config) {\n try {\n return await this._request(configOrUrl, config);\n } catch (err) {\n if (err instanceof Error) {\n let dummy;\n\n Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());\n\n // slice off the Error: ... line\n const stack = dummy.stack ? dummy.stack.replace(/^.+\\n/, '') : '';\n try {\n if (!err.stack) {\n err.stack = stack;\n // match without the 2 top stack lines\n } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\\n.+\\n/, ''))) {\n err.stack += '\\n' + stack\n }\n } catch (e) {\n // ignore the case where \"stack\" is an un-writable property\n }\n }\n\n throw err;\n }\n }\n\n _request(configOrUrl, config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof configOrUrl === 'string') {\n config = config || {};\n config.url = configOrUrl;\n } else {\n config = configOrUrl || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n const {transitional, paramsSerializer, headers} = config;\n\n if (transitional !== undefined) {\n validator.assertOptions(transitional, {\n silentJSONParsing: validators.transitional(validators.boolean),\n forcedJSONParsing: validators.transitional(validators.boolean),\n clarifyTimeoutError: validators.transitional(validators.boolean)\n }, false);\n }\n\n if (paramsSerializer != null) {\n if (utils.isFunction(paramsSerializer)) {\n config.paramsSerializer = {\n serialize: paramsSerializer\n }\n } else {\n validator.assertOptions(paramsSerializer, {\n encode: validators.function,\n serialize: validators.function\n }, true);\n }\n }\n\n // Set config.method\n config.method = (config.method || this.defaults.method || 'get').toLowerCase();\n\n // Flatten headers\n let contextHeaders = headers && utils.merge(\n headers.common,\n headers[config.method]\n );\n\n headers && utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n (method) => {\n delete headers[method];\n }\n );\n\n config.headers = AxiosHeaders.concat(contextHeaders, headers);\n\n // filter out skipped interceptors\n const requestInterceptorChain = [];\n let synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n const responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n let promise;\n let i = 0;\n let len;\n\n if (!synchronousRequestInterceptors) {\n const chain = [dispatchRequest.bind(this), undefined];\n chain.unshift.apply(chain, requestInterceptorChain);\n chain.push.apply(chain, responseInterceptorChain);\n len = chain.length;\n\n promise = Promise.resolve(config);\n\n while (i < len) {\n promise = promise.then(chain[i++], chain[i++]);\n }\n\n return promise;\n }\n\n len = requestInterceptorChain.length;\n\n let newConfig = config;\n\n i = 0;\n\n while (i < len) {\n const onFulfilled = requestInterceptorChain[i++];\n const onRejected = requestInterceptorChain[i++];\n try {\n newConfig = onFulfilled(newConfig);\n } catch (error) {\n onRejected.call(this, error);\n break;\n }\n }\n\n try {\n promise = dispatchRequest.call(this, newConfig);\n } catch (error) {\n return Promise.reject(error);\n }\n\n i = 0;\n len = responseInterceptorChain.length;\n\n while (i < len) {\n promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);\n }\n\n return promise;\n }\n\n getUri(config) {\n config = mergeConfig(this.defaults, config);\n const fullPath = buildFullPath(config.baseURL, config.url);\n return buildURL(fullPath, config.params, config.paramsSerializer);\n }\n}\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n\n function generateHTTPMethod(isForm) {\n return function httpMethod(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n headers: isForm ? {\n 'Content-Type': 'multipart/form-data'\n } : {},\n url,\n data\n }));\n };\n }\n\n Axios.prototype[method] = generateHTTPMethod();\n\n Axios.prototype[method + 'Form'] = generateHTTPMethod(true);\n});\n\nexport default Axios;\n","'use strict';\n\nimport CanceledError from './CanceledError.js';\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @param {Function} executor The executor function.\n *\n * @returns {CancelToken}\n */\nclass CancelToken {\n constructor(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n let resolvePromise;\n\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n const token = this;\n\n // eslint-disable-next-line func-names\n this.promise.then(cancel => {\n if (!token._listeners) return;\n\n let i = token._listeners.length;\n\n while (i-- > 0) {\n token._listeners[i](cancel);\n }\n token._listeners = null;\n });\n\n // eslint-disable-next-line func-names\n this.promise.then = onfulfilled => {\n let _resolve;\n // eslint-disable-next-line func-names\n const promise = new Promise(resolve => {\n token.subscribe(resolve);\n _resolve = resolve;\n }).then(onfulfilled);\n\n promise.cancel = function reject() {\n token.unsubscribe(_resolve);\n };\n\n return promise;\n };\n\n executor(function cancel(message, config, request) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new CanceledError(message, config, request);\n resolvePromise(token.reason);\n });\n }\n\n /**\n * Throws a `CanceledError` if cancellation has been requested.\n */\n throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n }\n\n /**\n * Subscribe to the cancel signal\n */\n\n subscribe(listener) {\n if (this.reason) {\n listener(this.reason);\n return;\n }\n\n if (this._listeners) {\n this._listeners.push(listener);\n } else {\n this._listeners = [listener];\n }\n }\n\n /**\n * Unsubscribe from the cancel signal\n */\n\n unsubscribe(listener) {\n if (!this._listeners) {\n return;\n }\n const index = this._listeners.indexOf(listener);\n if (index !== -1) {\n this._listeners.splice(index, 1);\n }\n }\n\n /**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\n static source() {\n let cancel;\n const token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token,\n cancel\n };\n }\n}\n\nexport default CancelToken;\n","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n *\n * @returns {Function}\n */\nexport default function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n *\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nexport default function isAxiosError(payload) {\n return utils.isObject(payload) && (payload.isAxiosError === true);\n}\n","const HttpStatusCode = {\n Continue: 100,\n SwitchingProtocols: 101,\n Processing: 102,\n EarlyHints: 103,\n Ok: 200,\n Created: 201,\n Accepted: 202,\n NonAuthoritativeInformation: 203,\n NoContent: 204,\n ResetContent: 205,\n PartialContent: 206,\n MultiStatus: 207,\n AlreadyReported: 208,\n ImUsed: 226,\n MultipleChoices: 300,\n MovedPermanently: 301,\n Found: 302,\n SeeOther: 303,\n NotModified: 304,\n UseProxy: 305,\n Unused: 306,\n TemporaryRedirect: 307,\n PermanentRedirect: 308,\n BadRequest: 400,\n Unauthorized: 401,\n PaymentRequired: 402,\n Forbidden: 403,\n NotFound: 404,\n MethodNotAllowed: 405,\n NotAcceptable: 406,\n ProxyAuthenticationRequired: 407,\n RequestTimeout: 408,\n Conflict: 409,\n Gone: 410,\n LengthRequired: 411,\n PreconditionFailed: 412,\n PayloadTooLarge: 413,\n UriTooLong: 414,\n UnsupportedMediaType: 415,\n RangeNotSatisfiable: 416,\n ExpectationFailed: 417,\n ImATeapot: 418,\n MisdirectedRequest: 421,\n UnprocessableEntity: 422,\n Locked: 423,\n FailedDependency: 424,\n TooEarly: 425,\n UpgradeRequired: 426,\n PreconditionRequired: 428,\n TooManyRequests: 429,\n RequestHeaderFieldsTooLarge: 431,\n UnavailableForLegalReasons: 451,\n InternalServerError: 500,\n NotImplemented: 501,\n BadGateway: 502,\n ServiceUnavailable: 503,\n GatewayTimeout: 504,\n HttpVersionNotSupported: 505,\n VariantAlsoNegotiates: 506,\n InsufficientStorage: 507,\n LoopDetected: 508,\n NotExtended: 510,\n NetworkAuthenticationRequired: 511,\n};\n\nObject.entries(HttpStatusCode).forEach(([key, value]) => {\n HttpStatusCode[value] = key;\n});\n\nexport default HttpStatusCode;\n","'use strict';\n\nimport utils from './utils.js';\nimport bind from './helpers/bind.js';\nimport Axios from './core/Axios.js';\nimport mergeConfig from './core/mergeConfig.js';\nimport defaults from './defaults/index.js';\nimport formDataToJSON from './helpers/formDataToJSON.js';\nimport CanceledError from './cancel/CanceledError.js';\nimport CancelToken from './cancel/CancelToken.js';\nimport isCancel from './cancel/isCancel.js';\nimport {VERSION} from './env/data.js';\nimport toFormData from './helpers/toFormData.js';\nimport AxiosError from './core/AxiosError.js';\nimport spread from './helpers/spread.js';\nimport isAxiosError from './helpers/isAxiosError.js';\nimport AxiosHeaders from \"./core/AxiosHeaders.js\";\nimport adapters from './adapters/adapters.js';\nimport HttpStatusCode from './helpers/HttpStatusCode.js';\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n *\n * @returns {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n const context = new Axios(defaultConfig);\n const instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});\n\n // Copy context to instance\n utils.extend(instance, context, null, {allOwnKeys: true});\n\n // Factory for creating new instances\n instance.create = function create(instanceConfig) {\n return createInstance(mergeConfig(defaultConfig, instanceConfig));\n };\n\n return instance;\n}\n\n// Create the default instance to be exported\nconst axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Expose Cancel & CancelToken\naxios.CanceledError = CanceledError;\naxios.CancelToken = CancelToken;\naxios.isCancel = isCancel;\naxios.VERSION = VERSION;\naxios.toFormData = toFormData;\n\n// Expose AxiosError class\naxios.AxiosError = AxiosError;\n\n// alias for CanceledError for backward compatibility\naxios.Cancel = axios.CanceledError;\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\n\naxios.spread = spread;\n\n// Expose isAxiosError\naxios.isAxiosError = isAxiosError;\n\n// Expose mergeConfig\naxios.mergeConfig = mergeConfig;\n\naxios.AxiosHeaders = AxiosHeaders;\n\naxios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);\n\naxios.getAdapter = adapters.getAdapter;\n\naxios.HttpStatusCode = HttpStatusCode;\n\naxios.default = axios;\n\n// this module should only have a default export\nexport default axios\n"],"names":["bind","fn","thisArg","wrap","apply","arguments","toString","Object","prototype","getPrototypeOf","kindOf","cache","thing","str","call","slice","toLowerCase","create","kindOfTest","type","typeOfTest","_typeof","isArray","Array","isUndefined","isBuffer","val","constructor","isFunction","isArrayBuffer","isArrayBufferView","result","ArrayBuffer","isView","buffer","isString","isNumber","isObject","isBoolean","isPlainObject","Symbol","toStringTag","iterator","isDate","isFile","isBlob","isFileList","isStream","pipe","isFormData","kind","FormData","append","isURLSearchParams","_map","map","_map2","_slicedToArray","isReadableStream","isRequest","isResponse","isHeaders","trim","replace","forEach","obj","_ref","length","undefined","_ref$allOwnKeys","allOwnKeys","i","l","keys","getOwnPropertyNames","len","key","findKey","_key","_global","globalThis","self","window","global","isContextDefined","context","merge","_ref2","caseless","assignValue","targetKey","extend","a","b","_ref3","stripBOM","content","charCodeAt","inherits","superConstructor","props","descriptors","defineProperty","value","assign","toFlatObject","sourceObj","destObj","filter","propFilter","prop","merged","endsWith","searchString","position","String","lastIndex","indexOf","toArray","arr","isTypedArray","TypedArray","Uint8Array","forEachEntry","generator","next","done","pair","matchAll","regExp","matches","exec","push","isHTMLForm","toCamelCase","replacer","m","p1","p2","toUpperCase","hasOwnProperty","_ref4","isRegExp","reduceDescriptors","reducer","getOwnPropertyDescriptors","reducedDescriptors","descriptor","name","ret","defineProperties","freezeMethods","enumerable","writable","set","Error","toObjectSet","arrayOrString","delimiter","define","split","noop","toFiniteNumber","defaultValue","Number","isFinite","ALPHA","DIGIT","ALPHABET","ALPHA_DIGIT","generateString","size","alphabet","Math","random","isSpecCompliantForm","toJSONObject","stack","visit","source","target","reducedValue","isAsyncFn","isThenable","then","hasOwnProp","AxiosError","message","code","config","request","response","captureStackTrace","utils","toJSON","description","number","fileName","lineNumber","columnNumber","status","from","error","customProps","axiosError","cause","isVisitable","removeBrackets","renderKey","path","dots","concat","each","token","join","isFlatArray","some","predicates","test","toFormData","formData","options","TypeError","metaTokens","indexes","defined","option","visitor","defaultVisitor","_Blob","Blob","useBlob","convertValue","toISOString","Buffer","JSON","stringify","el","index","exposedHelpers","build","pop","encode","charMap","encodeURIComponent","match","AxiosURLSearchParams","params","_pairs","encoder","_encode","buildURL","url","serializeFn","serialize","serializedParams","hashmarkIndex","InterceptorManager","_classCallCheck","handlers","_createClass","use","fulfilled","rejected","synchronous","runWhen","eject","id","clear","forEachHandler","h","silentJSONParsing","forcedJSONParsing","clarifyTimeoutError","URLSearchParams","isBrowser","classes","protocols","hasBrowserEnv","document","hasStandardBrowserEnv","product","navigator","hasStandardBrowserWebWorkerEnv","WorkerGlobalScope","importScripts","origin","location","href","_objectSpread","platform","toURLEncodedForm","data","helpers","isNode","parsePropPath","arrayToObject","formDataToJSON","buildPath","isNumericKey","isLast","entries","stringifySafely","rawValue","parser","parse","e","defaults","transitional","transitionalDefaults","adapter","transformRequest","headers","contentType","getContentType","hasJSONContentType","isObjectPayload","setContentType","formSerializer","_FormData","env","transformResponse","JSONRequested","responseType","strictJSONParsing","ERR_BAD_RESPONSE","timeout","xsrfCookieName","xsrfHeaderName","maxContentLength","maxBodyLength","validateStatus","common","method","ignoreDuplicateOf","rawHeaders","parsed","line","substring","$internals","normalizeHeader","header","normalizeValue","parseTokens","tokens","tokensRE","isValidHeaderName","matchHeaderValue","isHeaderNameFilter","formatHeader","w","char","buildAccessors","accessorName","methodName","arg1","arg2","arg3","configurable","AxiosHeaders","_Symbol$iterator","_Symbol$toStringTag","valueOrRewrite","rewrite","setHeader","_value","_header","_rewrite","lHeader","setHeaders","parseHeaders","_iterator","_createForOfIteratorHelper","_step","s","n","_step$value","err","f","get","has","matcher","_delete","deleted","deleteHeader","normalize","format","normalized","_this$constructor","_len","targets","asStrings","first","computed","_len2","_key2","accessor","internals","accessors","defineAccessor","mapped","headerValue","transformData","fns","transform","isCancel","__CANCEL__","CanceledError","ERR_CANCELED","settle","resolve","reject","ERR_BAD_REQUEST","floor","parseProtocol","speedometer","samplesCount","min","bytes","timestamps","head","tail","firstSampleTS","chunkLength","now","Date","startedAt","bytesCount","passed","round","throttle","freq","timestamp","threshold","timer","throttled","_arguments","force","clearTimeout","setTimeout","listener","isDownloadStream","bytesNotified","_speedometer","loaded","total","lengthComputable","progressBytes","rate","inRange","progress","estimated","event","standardBrowserEnv","msie","userAgent","urlParsingNode","createElement","originURL","resolveURL","setAttribute","protocol","host","search","hash","hostname","port","pathname","charAt","isURLSameOrigin","requestURL","nonStandardBrowserEnv","write","expires","domain","secure","cookie","toGMTString","read","RegExp","decodeURIComponent","remove","isAbsoluteURL","combineURLs","baseURL","relativeURL","buildFullPath","requestedURL","headersToObject","mergeConfig","config1","config2","getMergedValue","mergeDeepProperties","valueFromConfig2","defaultToConfig2","mergeDirectKeys","mergeMap","paramsSerializer","timeoutMessage","withCredentials","withXSRFToken","onUploadProgress","onDownloadProgress","decompress","beforeRedirect","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding","computeConfigValue","configValue","newConfig","auth","btoa","username","password","unescape","Boolean","_toArray","_toConsumableArray","xsrfValue","cookies","isXHRAdapterSupported","XMLHttpRequest","Promise","dispatchXhrRequest","_config","resolveConfig","requestData","requestHeaders","onCanceled","unsubscribe","signal","removeEventListener","open","onloadend","responseHeaders","getAllResponseHeaders","responseData","responseText","statusText","_resolve","_reject","onreadystatechange","handleLoad","readyState","responseURL","onabort","handleAbort","ECONNABORTED","onerror","handleError","ERR_NETWORK","ontimeout","handleTimeout","timeoutErrorMessage","ETIMEDOUT","setRequestHeader","addEventListener","progressEventReducer","upload","cancel","abort","subscribe","aborted","send","composeSignals","signals","controller","AbortController","reason","streamChunk","_regeneratorRuntime","mark","chunk","chunkSize","pos","end","streamChunk$","_context","prev","byteLength","abrupt","stop","readBytes","_wrapAsyncGenerator","_callee","iterable","_iteratorAbruptCompletion","_didIteratorError","_iteratorError","_callee$","_context2","_asyncIterator","_awaitAsyncGenerator","sent","t0","_asyncGeneratorDelegate","t1","t2","t3","t4","t5","t6","t7","t8","delegateYield","t10","finish","_x","_x2","_x3","trackStream","stream","onProgress","onFinish","ReadableStream","pull","_asyncToGenerator","_callee2","_yield$iterator$next","_callee2$","_context3","close","enqueue","highWaterMark","fetchProgressDecorator","isFetchSupported","fetch","Request","Response","isReadableStreamSupported","encodeText","TextEncoder","arrayBuffer","supportsRequestStream","duplexAccessed","hasContentType","body","duplex","DEFAULT_CHUNK_SIZE","supportsResponseStream","resolvers","res","_","ERR_NOT_SUPPORT","getBodyLength","resolveBodyLength","_callee3","_callee3$","getContentLength","_x4","_callee4","_resolveConfig","_resolveConfig$withCr","fetchOptions","_ref5","_ref6","composedSignal","stopTimeout","finished","requestContentLength","_request","contentTypeHeader","isStreamResponse","responseContentLength","_callee4$","_context4","_x5","knownAdapters","http","httpAdapter","xhr","xhrAdapter","fetchAdapter","renderReason","isResolvedHandle","getAdapter","adapters","_adapters","nameOrAdapter","rejectedReasons","reasons","state","throwIfCancellationRequested","throwIfRequested","dispatchRequest","onAdapterResolution","onAdapterRejection","VERSION","validators","validator","deprecatedWarnings","version","formatMessage","opt","desc","opts","ERR_DEPRECATED","console","warn","assertOptions","schema","allowUnknown","ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","Axios","instanceConfig","interceptors","_request2","configOrUrl","dummy","contextHeaders","requestInterceptorChain","synchronousRequestInterceptors","unshiftRequestInterceptors","interceptor","unshift","responseInterceptorChain","pushResponseInterceptors","promise","chain","onFulfilled","onRejected","getUri","fullPath","forEachMethodNoData","forEachMethodWithData","generateHTTPMethod","isForm","httpMethod","CancelToken","executor","resolvePromise","promiseExecutor","_listeners","onfulfilled","splice","c","spread","callback","isAxiosError","payload","HttpStatusCode","Continue","SwitchingProtocols","Processing","EarlyHints","Ok","Created","Accepted","NonAuthoritativeInformation","NoContent","ResetContent","PartialContent","MultiStatus","AlreadyReported","ImUsed","MultipleChoices","MovedPermanently","Found","SeeOther","NotModified","UseProxy","Unused","TemporaryRedirect","PermanentRedirect","BadRequest","Unauthorized","PaymentRequired","Forbidden","NotFound","MethodNotAllowed","NotAcceptable","ProxyAuthenticationRequired","RequestTimeout","Conflict","Gone","LengthRequired","PreconditionFailed","PayloadTooLarge","UriTooLong","UnsupportedMediaType","RangeNotSatisfiable","ExpectationFailed","ImATeapot","MisdirectedRequest","UnprocessableEntity","Locked","FailedDependency","TooEarly","UpgradeRequired","PreconditionRequired","TooManyRequests","RequestHeaderFieldsTooLarge","UnavailableForLegalReasons","InternalServerError","NotImplemented","BadGateway","ServiceUnavailable","GatewayTimeout","HttpVersionNotSupported","VariantAlsoNegotiates","InsufficientStorage","LoopDetected","NotExtended","NetworkAuthenticationRequired","createInstance","defaultConfig","instance","axios","Cancel","all","promises","formToJSON"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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C;EACAsZ,KAAK,CAACE,GAAG,GAAG,SAASA,GAAGA,CAACC,QAAQ,EAAE;EACjC,EAAA,OAAOjS,OAAO,CAACgS,GAAG,CAACC,QAAQ,CAAC,CAAA;EAC9B,CAAC,CAAA;EAEDH,KAAK,CAACvE,MAAM,GAAGA,MAAM,CAAA;;EAErB;EACAuE,KAAK,CAACrE,YAAY,GAAGA,YAAY,CAAA;;EAEjC;EACAqE,KAAK,CAACpU,WAAW,GAAGA,WAAW,CAAA;EAE/BoU,KAAK,CAACtc,YAAY,GAAGA,cAAY,CAAA;EAEjCsc,KAAK,CAACI,UAAU,GAAG,UAAAryB,KAAK,EAAA;EAAA,EAAA,OAAI6R,cAAc,CAACxG,OAAK,CAAC5D,UAAU,CAACzH,KAAK,CAAC,GAAG,IAAIuC,QAAQ,CAACvC,KAAK,CAAC,GAAGA,KAAK,CAAC,CAAA;EAAA,CAAA,CAAA;EAEjGiyB,KAAK,CAACrI,UAAU,GAAGC,QAAQ,CAACD,UAAU,CAAA;EAEtCqI,KAAK,CAACnE,cAAc,GAAGA,gBAAc,CAAA;EAErCmE,KAAK,CAAA,SAAA,CAAQ,GAAGA,KAAK;;;;;;;;"} \ No newline at end of file diff --git a/project starter code/node_modules/axios/dist/axios.min.js b/project starter code/node_modules/axios/dist/axios.min.js new file mode 100644 index 00000000..8da3e5f2 --- /dev/null +++ b/project starter code/node_modules/axios/dist/axios.min.js @@ -0,0 +1,2 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).axios=t()}(this,(function(){"use strict";function e(e){var r,n;function o(r,n){try{var a=e[r](n),s=a.value,u=s instanceof t;Promise.resolve(u?s.v:s).then((function(t){if(u){var n="return"===r?"return":"next";if(!s.k||t.done)return o(n,t);t=e[n](t).value}i(a.done?"return":"normal",t)}),(function(e){o("throw",e)}))}catch(e){i("throw",e)}}function i(e,t){switch(e){case"return":r.resolve({value:t,done:!0});break;case"throw":r.reject(t);break;default:r.resolve({value:t,done:!1})}(r=r.next)?o(r.key,r.arg):n=null}this._invoke=function(e,t){return new Promise((function(i,a){var s={key:e,arg:t,resolve:i,reject:a,next:null};n?n=n.next=s:(r=n=s,o(e,t))}))},"function"!=typeof e.return&&(this.return=void 0)}function t(e,t){this.v=e,this.k=t}function r(e){var r={},n=!1;function o(r,o){return n=!0,o=new Promise((function(t){t(e[r](o))})),{done:!1,value:new t(o,1)}}return r["undefined"!=typeof Symbol&&Symbol.iterator||"@@iterator"]=function(){return this},r.next=function(e){return n?(n=!1,e):o("next",e)},"function"==typeof e.throw&&(r.throw=function(e){if(n)throw n=!1,e;return o("throw",e)}),"function"==typeof e.return&&(r.return=function(e){return n?(n=!1,e):o("return",e)}),r}function n(e){var t,r,n,i=2;for("undefined"!=typeof Symbol&&(r=Symbol.asyncIterator,n=Symbol.iterator);i--;){if(r&&null!=(t=e[r]))return t.call(e);if(n&&null!=(t=e[n]))return new o(t.call(e));r="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function o(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then((function(e){return{value:e,done:t}}))}return o=function(e){this.s=e,this.n=e.next},o.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var r=this.s.return;return void 0===r?Promise.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?Promise.reject(e):t(r.apply(this.s,arguments))}},new o(e)}function i(e){return new t(e,0)}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:L(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),v}},t}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function l(e,t,r,n,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,o)}function h(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){l(i,n,o,a,s,"next",e)}function s(e){l(i,n,o,a,s,"throw",e)}a(void 0)}))}}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r2&&void 0!==arguments[2]?arguments[2]:{},i=o.allOwnKeys,a=void 0!==i&&i;if(null!=e)if("object"!==f(e)&&(e=[e]),L(e))for(r=0,n=e.length;r0;)if(t===(r=n[o]).toLowerCase())return r;return null}var Y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Q=function(e){return!N(e)&&e!==Y};var Z,ee=(Z="undefined"!=typeof Uint8Array&&j(Uint8Array),function(e){return Z&&e instanceof Z}),te=A("HTMLFormElement"),re=function(e){var t=Object.prototype.hasOwnProperty;return function(e,r){return t.call(e,r)}}(),ne=A("RegExp"),oe=function(e,t){var r=Object.getOwnPropertyDescriptors(e),n={};X(r,(function(r,o){var i;!1!==(i=t(r,o,e))&&(n[o]=i||r)})),Object.defineProperties(e,n)},ie="abcdefghijklmnopqrstuvwxyz",ae="0123456789",se={DIGIT:ae,ALPHA:ie,ALPHA_DIGIT:ie+ie.toUpperCase()+ae};var ue=A("AsyncFunction"),ce={isArray:L,isArrayBuffer:_,isBuffer:function(e){return null!==e&&!N(e)&&null!==e.constructor&&!N(e.constructor)&&F(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:function(e){var t;return e&&("function"==typeof FormData&&e instanceof FormData||F(e.append)&&("formdata"===(t=k(e))||"object"===t&&F(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&_(e.buffer)},isString:C,isNumber:U,isBoolean:function(e){return!0===e||!1===e},isObject:D,isPlainObject:B,isReadableStream:W,isRequest:G,isResponse:K,isHeaders:V,isUndefined:N,isDate:I,isFile:q,isBlob:z,isRegExp:ne,isFunction:F,isStream:function(e){return D(e)&&F(e.pipe)},isURLSearchParams:H,isTypedArray:ee,isFileList:M,forEach:X,merge:function e(){for(var t=Q(this)&&this||{},r=t.caseless,n={},o=function(t,o){var i=r&&$(n,o)||o;B(n[i])&&B(t)?n[i]=e(n[i],t):B(t)?n[i]=e({},t):L(t)?n[i]=t.slice():n[i]=t},i=0,a=arguments.length;i3&&void 0!==arguments[3]?arguments[3]:{},o=n.allOwnKeys;return X(t,(function(t,n){r&&F(t)?e[n]=x(t,r):e[n]=t}),{allOwnKeys:o}),e},trim:function(e){return e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e},inherits:function(e,t,r,n){e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:function(e,t,r,n){var o,i,a,s={};if(t=t||{},null==e)return t;do{for(i=(o=Object.getOwnPropertyNames(e)).length;i-- >0;)a=o[i],n&&!n(a,e,t)||s[a]||(t[a]=e[a],s[a]=!0);e=!1!==r&&j(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:k,kindOfTest:A,endsWith:function(e,t,r){e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;var n=e.indexOf(t,r);return-1!==n&&n===r},toArray:function(e){if(!e)return null;if(L(e))return e;var t=e.length;if(!U(t))return null;for(var r=new Array(t);t-- >0;)r[t]=e[t];return r},forEachEntry:function(e,t){for(var r,n=(e&&e[Symbol.iterator]).call(e);(r=n.next())&&!r.done;){var o=r.value;t.call(e,o[0],o[1])}},matchAll:function(e,t){for(var r,n=[];null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:te,hasOwnProperty:re,hasOwnProp:re,reduceDescriptors:oe,freezeMethods:function(e){oe(e,(function(t,r){if(F(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;var n=e[r];F(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=function(){throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:function(e,t){var r={},n=function(e){e.forEach((function(e){r[e]=!0}))};return L(e)?n(e):n(String(e).split(t)),r},toCamelCase:function(e){return e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r}))},noop:function(){},toFiniteNumber:function(e,t){return null!=e&&Number.isFinite(e=+e)?e:t},findKey:$,global:Y,isContextDefined:Q,ALPHABET:se,generateString:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:16,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:se.ALPHA_DIGIT,r="",n=t.length;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&F(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:function(e){var t=new Array(10);return function e(r,n){if(D(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[n]=r;var o=L(r)?[]:{};return X(r,(function(t,r){var i=e(t,n+1);!N(i)&&(o[r]=i)})),t[n]=void 0,o}}return r}(e,0)},isAsyncFn:ue,isThenable:function(e){return e&&(D(e)||F(e))&&F(e.then)&&F(e.catch)}};function fe(e,t,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o)}ce.inherits(fe,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ce.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var le=fe.prototype,he={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((function(e){he[e]={value:e}})),Object.defineProperties(fe,he),Object.defineProperty(le,"isAxiosError",{value:!0}),fe.from=function(e,t,r,n,o,i){var a=Object.create(le);return ce.toFlatObject(e,a,(function(e){return e!==Error.prototype}),(function(e){return"isAxiosError"!==e})),fe.call(a,e.message,t,r,n,o),a.cause=e,a.name=e.name,i&&Object.assign(a,i),a};function pe(e){return ce.isPlainObject(e)||ce.isArray(e)}function de(e){return ce.endsWith(e,"[]")?e.slice(0,-2):e}function ye(e,t,r){return e?e.concat(t).map((function(e,t){return e=de(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}var ve=ce.toFlatObject(ce,{},null,(function(e){return/^is[A-Z]/.test(e)}));function me(e,t,r){if(!ce.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;var n=(r=ce.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!ce.isUndefined(t[e])}))).metaTokens,o=r.visitor||c,i=r.dots,a=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&ce.isSpecCompliantForm(t);if(!ce.isFunction(o))throw new TypeError("visitor must be a function");function u(e){if(null===e)return"";if(ce.isDate(e))return e.toISOString();if(!s&&ce.isBlob(e))throw new fe("Blob is not supported. Use a Buffer instead.");return ce.isArrayBuffer(e)||ce.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,r,o){var s=e;if(e&&!o&&"object"===f(e))if(ce.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(ce.isArray(e)&&function(e){return ce.isArray(e)&&!e.some(pe)}(e)||(ce.isFileList(e)||ce.endsWith(r,"[]"))&&(s=ce.toArray(e)))return r=de(r),s.forEach((function(e,n){!ce.isUndefined(e)&&null!==e&&t.append(!0===a?ye([r],n,i):null===a?r:r+"[]",u(e))})),!1;return!!pe(e)||(t.append(ye(o,r,i),u(e)),!1)}var l=[],h=Object.assign(ve,{defaultVisitor:c,convertValue:u,isVisitable:pe});if(!ce.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!ce.isUndefined(r)){if(-1!==l.indexOf(r))throw Error("Circular reference detected in "+n.join("."));l.push(r),ce.forEach(r,(function(r,i){!0===(!(ce.isUndefined(r)||null===r)&&o.call(t,r,ce.isString(i)?i.trim():i,n,h))&&e(r,n?n.concat(i):[i])})),l.pop()}}(e),t}function be(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function ge(e,t){this._pairs=[],e&&me(e,this,t)}var we=ge.prototype;function Ee(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Oe(e,t,r){if(!t)return e;var n,o=r&&r.encode||Ee,i=r&&r.serialize;if(n=i?i(t,r):ce.isURLSearchParams(t)?t.toString():new ge(t,r).toString(o)){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e}we.append=function(e,t){this._pairs.push([e,t])},we.toString=function(e){var t=e?function(t){return e.call(this,t,be)}:be;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var Se,xe=function(){function e(){p(this,e),this.handlers=[]}return y(e,[{key:"use",value:function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}},{key:"eject",value:function(e){this.handlers[e]&&(this.handlers[e]=null)}},{key:"clear",value:function(){this.handlers&&(this.handlers=[])}},{key:"forEach",value:function(e){ce.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}]),e}(),Re={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Te={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ge,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},je="undefined"!=typeof window&&"undefined"!=typeof document,ke=(Se="undefined"!=typeof navigator&&navigator.product,je&&["ReactNative","NativeScript","NS"].indexOf(Se)<0),Ae="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Pe=je&&window.location.href||"http://localhost",Le=s(s({},Object.freeze({__proto__:null,hasBrowserEnv:je,hasStandardBrowserWebWorkerEnv:Ae,hasStandardBrowserEnv:ke,origin:Pe})),Te);function Ne(e){function t(e,r,n,o){var i=e[o++];if("__proto__"===i)return!0;var a=Number.isFinite(+i),s=o>=e.length;return i=!i&&ce.isArray(n)?n.length:i,s?(ce.hasOwnProp(n,i)?n[i]=[n[i],r]:n[i]=r,!a):(n[i]&&ce.isObject(n[i])||(n[i]=[]),t(e,r,n[i],o)&&ce.isArray(n[i])&&(n[i]=function(e){var t,r,n={},o=Object.keys(e),i=o.length;for(t=0;t-1,i=ce.isObject(e);if(i&&ce.isHTMLForm(e)&&(e=new FormData(e)),ce.isFormData(e))return o?JSON.stringify(Ne(e)):e;if(ce.isArrayBuffer(e)||ce.isBuffer(e)||ce.isStream(e)||ce.isFile(e)||ce.isBlob(e)||ce.isReadableStream(e))return e;if(ce.isArrayBufferView(e))return e.buffer;if(ce.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return me(e,new Le.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return Le.isNode&&ce.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((r=ce.isFileList(e))||n.indexOf("multipart/form-data")>-1){var a=this.env&&this.env.FormData;return me(r?{"files[]":e}:e,a&&new a,this.formSerializer)}}return i||o?(t.setContentType("application/json",!1),function(e,t,r){if(ce.isString(e))try{return(t||JSON.parse)(e),ce.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||_e.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(ce.isResponse(e)||ce.isReadableStream(e))return e;if(e&&ce.isString(e)&&(r&&!this.responseType||n)){var o=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw fe.from(e,fe.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Le.classes.FormData,Blob:Le.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ce.forEach(["delete","get","head","post","put","patch"],(function(e){_e.headers[e]={}}));var Ce=_e,Fe=ce.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ue=Symbol("internals");function De(e){return e&&String(e).trim().toLowerCase()}function Be(e){return!1===e||null==e?e:ce.isArray(e)?e.map(Be):String(e)}function Ie(e,t,r,n,o){return ce.isFunction(n)?n.call(this,t,r):(o&&(t=r),ce.isString(t)?ce.isString(n)?-1!==t.indexOf(n):ce.isRegExp(n)?n.test(t):void 0:void 0)}var qe=function(e,t){function r(e){p(this,r),e&&this.set(e)}return y(r,[{key:"set",value:function(e,t,r){var n=this;function o(e,t,r){var o=De(t);if(!o)throw new Error("header name must be a non-empty string");var i=ce.findKey(n,o);(!i||void 0===n[i]||!0===r||void 0===r&&!1!==n[i])&&(n[i||t]=Be(e))}var i=function(e,t){return ce.forEach(e,(function(e,r){return o(e,r,t)}))};if(ce.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(ce.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i(function(e){var t,r,n,o={};return e&&e.split("\n").forEach((function(e){n=e.indexOf(":"),t=e.substring(0,n).trim().toLowerCase(),r=e.substring(n+1).trim(),!t||o[t]&&Fe[t]||("set-cookie"===t?o[t]?o[t].push(r):o[t]=[r]:o[t]=o[t]?o[t]+", "+r:r)})),o}(e),t);else if(ce.isHeaders(e)){var a,s=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=E(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}(e.entries());try{for(s.s();!(a=s.n()).done;){var u=m(a.value,2),c=u[0];o(u[1],c,r)}}catch(e){s.e(e)}finally{s.f()}}else null!=e&&o(t,e,r);return this}},{key:"get",value:function(e,t){if(e=De(e)){var r=ce.findKey(this,e);if(r){var n=this[r];if(!t)return n;if(!0===t)return function(e){for(var t,r=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;t=n.exec(e);)r[t[1]]=t[2];return r}(n);if(ce.isFunction(t))return t.call(this,n,r);if(ce.isRegExp(t))return t.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}},{key:"has",value:function(e,t){if(e=De(e)){var r=ce.findKey(this,e);return!(!r||void 0===this[r]||t&&!Ie(0,this[r],r,t))}return!1}},{key:"delete",value:function(e,t){var r=this,n=!1;function o(e){if(e=De(e)){var o=ce.findKey(r,e);!o||t&&!Ie(0,r[o],o,t)||(delete r[o],n=!0)}}return ce.isArray(e)?e.forEach(o):o(e),n}},{key:"clear",value:function(e){for(var t=Object.keys(this),r=t.length,n=!1;r--;){var o=t[r];e&&!Ie(0,this[o],o,e,!0)||(delete this[o],n=!0)}return n}},{key:"normalize",value:function(e){var t=this,r={};return ce.forEach(this,(function(n,o){var i=ce.findKey(r,o);if(i)return t[i]=Be(n),void delete t[o];var a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r}))}(o):String(o).trim();a!==o&&delete t[o],t[a]=Be(n),r[a]=!0})),this}},{key:"concat",value:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n1?r-1:0),o=1;on)return o&&(clearTimeout(o),o=null),r=a,e.apply(null,arguments);o||(o=setTimeout((function(){return o=null,r=Date.now(),e.apply(null,t)}),n-(a-r)))}}ce.inherits(Je,fe,{__CANCEL__:!0});var Ve=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,n=0,o=Ge(50,250);return Ke((function(r){var i=r.loaded,a=r.lengthComputable?r.total:void 0,s=i-n,u=o(s);n=i;var c={loaded:i,total:a,progress:a?i/a:void 0,bytes:s,rate:u||void 0,estimated:u&&a&&i<=a?(a-i)/u:void 0,event:r,lengthComputable:null!=a};c[t?"download":"upload"]=!0,e(c)}),r)},Xe=Le.hasStandardBrowserEnv?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=n(window.location.href),function(t){var r=ce.isString(t)?n(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0},$e=Le.hasStandardBrowserEnv?{write:function(e,t,r,n,o,i){var a=[e+"="+encodeURIComponent(t)];ce.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),ce.isString(n)&&a.push("path="+n),ce.isString(o)&&a.push("domain="+o),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function Ye(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var Qe=function(e){return e instanceof ze?s({},e):e};function Ze(e,t){t=t||{};var r={};function n(e,t,r){return ce.isPlainObject(e)&&ce.isPlainObject(t)?ce.merge.call({caseless:r},e,t):ce.isPlainObject(t)?ce.merge({},t):ce.isArray(t)?t.slice():t}function o(e,t,r){return ce.isUndefined(t)?ce.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function i(e,t){if(!ce.isUndefined(t))return n(void 0,t)}function a(e,t){return ce.isUndefined(t)?ce.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,o,i){return i in t?n(r,o):i in e?n(void 0,r):void 0}var u={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s,headers:function(e,t){return o(Qe(e),Qe(t),!0)}};return ce.forEach(Object.keys(Object.assign({},e,t)),(function(n){var i=u[n]||o,a=i(e[n],t[n],n);ce.isUndefined(a)&&i!==s||(r[n]=a)})),r}var et,tt,rt,nt,ot=function(e){var t,r,n=Ze({},e),o=n.data,i=n.withXSRFToken,a=n.xsrfHeaderName,s=n.xsrfCookieName,u=n.headers,c=n.auth;if(n.headers=u=ze.from(u),n.url=Oe(Ye(n.baseURL,n.url),e.params,e.paramsSerializer),c&&u.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),ce.isFormData(o))if(Le.hasStandardBrowserEnv||Le.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if(!1!==(t=u.getContentType())){var f=t?t.split(";").map((function(e){return e.trim()})).filter(Boolean):[],l=g(r=f)||w(r)||E(r)||S(),h=l[0],p=l.slice(1);u.setContentType([h||"multipart/form-data"].concat(b(p)).join("; "))}if(Le.hasStandardBrowserEnv&&(i&&ce.isFunction(i)&&(i=i(n)),i||!1!==i&&Xe(n.url))){var d=a&&s&&$e.read(s);d&&u.set(a,d)}return n},it="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){var n,o=ot(e),i=o.data,a=ze.from(o.headers).normalize(),s=o.responseType;function u(){o.cancelToken&&o.cancelToken.unsubscribe(n),o.signal&&o.signal.removeEventListener("abort",n)}var c=new XMLHttpRequest;function f(){if(c){var n=ze.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());We((function(e){t(e),u()}),(function(e){r(e),u()}),{data:s&&"text"!==s&&"json"!==s?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:n,config:e,request:c}),c=null}}c.open(o.method.toUpperCase(),o.url,!0),c.timeout=o.timeout,"onloadend"in c?c.onloadend=f:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(f)},c.onabort=function(){c&&(r(new fe("Request aborted",fe.ECONNABORTED,o,c)),c=null)},c.onerror=function(){r(new fe("Network Error",fe.ERR_NETWORK,o,c)),c=null},c.ontimeout=function(){var e=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded",t=o.transitional||Re;o.timeoutErrorMessage&&(e=o.timeoutErrorMessage),r(new fe(e,t.clarifyTimeoutError?fe.ETIMEDOUT:fe.ECONNABORTED,o,c)),c=null},void 0===i&&a.setContentType(null),"setRequestHeader"in c&&ce.forEach(a.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),ce.isUndefined(o.withCredentials)||(c.withCredentials=!!o.withCredentials),s&&"json"!==s&&(c.responseType=o.responseType),"function"==typeof o.onDownloadProgress&&c.addEventListener("progress",Ve(o.onDownloadProgress,!0)),"function"==typeof o.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",Ve(o.onUploadProgress)),(o.cancelToken||o.signal)&&(n=function(t){c&&(r(!t||t.type?new Je(null,e,c):t),c.abort(),c=null)},o.cancelToken&&o.cancelToken.subscribe(n),o.signal&&(o.signal.aborted?n():o.signal.addEventListener("abort",n)));var l,h,p=(l=o.url,(h=/^([-+\w]{1,25})(:?\/\/|:)/.exec(l))&&h[1]||"");p&&-1===Le.protocols.indexOf(p)?r(new fe("Unsupported protocol "+p+":",fe.ERR_BAD_REQUEST,e)):c.send(i||null)}))},at=function(e,t){var r,n=new AbortController,o=function(e){if(!r){r=!0,a();var t=e instanceof Error?e:this.reason;n.abort(t instanceof fe?t:new Je(t instanceof Error?t.message:t))}},i=t&&setTimeout((function(){o(new fe("timeout ".concat(t," of ms exceeded"),fe.ETIMEDOUT))}),t),a=function(){e&&(i&&clearTimeout(i),i=null,e.forEach((function(e){e&&(e.removeEventListener?e.removeEventListener("abort",o):e.unsubscribe(o))})),e=null)};e.forEach((function(e){return e&&e.addEventListener&&e.addEventListener("abort",o)}));var s=n.signal;return s.unsubscribe=a,[s,function(){i&&clearTimeout(i),i=null}]},st=u().mark((function e(t,r){var n,o,i;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.byteLength,r&&!(n1?"since :\n"+s.map(Et).join("\n"):" "+Et(s[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function xt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Je(null,e)}function Rt(e){return xt(e),e.headers=ze.from(e.headers),e.data=Me.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),St(e.adapter||Ce.adapter)(e).then((function(t){return xt(e),t.data=Me.call(e,e.transformResponse,t),t.headers=ze.from(t.headers),t}),(function(t){return He(t)||(xt(e),t&&t.response&&(t.response.data=Me.call(e,e.transformResponse,t.response),t.response.headers=ze.from(t.response.headers))),Promise.reject(t)}))}var Tt="1.7.2",jt={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){jt[e]=function(r){return f(r)===e||"a"+(t<1?"n ":" ")+e}}));var kt={};jt.transitional=function(e,t,r){function n(e,t){return"[Axios v1.7.2] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,o,i){if(!1===e)throw new fe(n(o," has been removed"+(t?" in "+t:"")),fe.ERR_DEPRECATED);return t&&!kt[o]&&(kt[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,o,i)}};var At={assertOptions:function(e,t,r){if("object"!==f(e))throw new fe("options must be an object",fe.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(e),o=n.length;o-- >0;){var i=n[o],a=t[i];if(a){var s=e[i],u=void 0===s||a(s,i,e);if(!0!==u)throw new fe("option "+i+" must be "+u,fe.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new fe("Unknown option "+i,fe.ERR_BAD_OPTION)}},validators:jt},Pt=At.validators,Lt=function(){function e(t){p(this,e),this.defaults=t,this.interceptors={request:new xe,response:new xe}}var t;return y(e,[{key:"request",value:(t=h(u().mark((function e(t,r){var n,o;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._request(t,r);case 3:return e.abrupt("return",e.sent);case 6:if(e.prev=6,e.t0=e.catch(0),e.t0 instanceof Error){Error.captureStackTrace?Error.captureStackTrace(n={}):n=new Error,o=n.stack?n.stack.replace(/^.+\n/,""):"";try{e.t0.stack?o&&!String(e.t0.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(e.t0.stack+="\n"+o):e.t0.stack=o}catch(e){}}throw e.t0;case 10:case"end":return e.stop()}}),e,this,[[0,6]])}))),function(e,r){return t.apply(this,arguments)})},{key:"_request",value:function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{};var r=t=Ze(this.defaults,t),n=r.transitional,o=r.paramsSerializer,i=r.headers;void 0!==n&&At.assertOptions(n,{silentJSONParsing:Pt.transitional(Pt.boolean),forcedJSONParsing:Pt.transitional(Pt.boolean),clarifyTimeoutError:Pt.transitional(Pt.boolean)},!1),null!=o&&(ce.isFunction(o)?t.paramsSerializer={serialize:o}:At.assertOptions(o,{encode:Pt.function,serialize:Pt.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();var a=i&&ce.merge(i.common,i[t.method]);i&&ce.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete i[e]})),t.headers=ze.concat(a,i);var s=[],u=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(u=u&&e.synchronous,s.unshift(e.fulfilled,e.rejected))}));var c,f=[];this.interceptors.response.forEach((function(e){f.push(e.fulfilled,e.rejected)}));var l,h=0;if(!u){var p=[Rt.bind(this),void 0];for(p.unshift.apply(p,s),p.push.apply(p,f),l=p.length,c=Promise.resolve(t);h0;)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},t((function(e,t,o){n.reason||(n.reason=new Je(e,t,o),r(n.reason))}))}return y(e,[{key:"throwIfRequested",value:function(){if(this.reason)throw this.reason}},{key:"subscribe",value:function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}},{key:"unsubscribe",value:function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}}}],[{key:"source",value:function(){var t;return{token:new e((function(e){t=e})),cancel:t}}}]),e}();var Ct={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ct).forEach((function(e){var t=m(e,2),r=t[0],n=t[1];Ct[n]=r}));var Ft=Ct;var Ut=function e(t){var r=new Nt(t),n=x(Nt.prototype.request,r);return ce.extend(n,Nt.prototype,r,{allOwnKeys:!0}),ce.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Ze(t,r))},n}(Ce);return Ut.Axios=Nt,Ut.CanceledError=Je,Ut.CancelToken=_t,Ut.isCancel=He,Ut.VERSION=Tt,Ut.toFormData=me,Ut.AxiosError=fe,Ut.Cancel=Ut.CanceledError,Ut.all=function(e){return Promise.all(e)},Ut.spread=function(e){return function(t){return e.apply(null,t)}},Ut.isAxiosError=function(e){return ce.isObject(e)&&!0===e.isAxiosError},Ut.mergeConfig=Ze,Ut.AxiosHeaders=ze,Ut.formToJSON=function(e){return Ne(ce.isHTMLForm(e)?new FormData(e):e)},Ut.getAdapter=St,Ut.HttpStatusCode=Ft,Ut.default=Ut,Ut})); +//# sourceMappingURL=axios.min.js.map diff --git a/project starter code/node_modules/axios/dist/axios.min.js.map b/project starter code/node_modules/axios/dist/axios.min.js.map new file mode 100644 index 00000000..870e70f5 --- /dev/null +++ b/project starter code/node_modules/axios/dist/axios.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"axios.min.js","sources":["../lib/helpers/bind.js","../lib/utils.js","../lib/core/AxiosError.js","../lib/helpers/toFormData.js","../lib/helpers/AxiosURLSearchParams.js","../lib/helpers/buildURL.js","../lib/core/InterceptorManager.js","../lib/platform/common/utils.js","../lib/defaults/transitional.js","../lib/platform/browser/index.js","../lib/platform/browser/classes/URLSearchParams.js","../lib/platform/browser/classes/FormData.js","../lib/platform/browser/classes/Blob.js","../lib/platform/index.js","../lib/helpers/formDataToJSON.js","../lib/defaults/index.js","../lib/helpers/toURLEncodedForm.js","../lib/helpers/parseHeaders.js","../lib/core/AxiosHeaders.js","../lib/core/transformData.js","../lib/cancel/isCancel.js","../lib/cancel/CanceledError.js","../lib/core/settle.js","../lib/helpers/speedometer.js","../lib/helpers/throttle.js","../lib/helpers/progressEventReducer.js","../lib/helpers/isURLSameOrigin.js","../lib/helpers/cookies.js","../lib/core/buildFullPath.js","../lib/helpers/isAbsoluteURL.js","../lib/helpers/combineURLs.js","../lib/core/mergeConfig.js","../lib/helpers/resolveConfig.js","../lib/adapters/fetch.js","../lib/adapters/xhr.js","../lib/helpers/parseProtocol.js","../lib/helpers/composeSignals.js","../lib/helpers/trackStream.js","../lib/adapters/adapters.js","../lib/helpers/null.js","../lib/core/dispatchRequest.js","../lib/env/data.js","../lib/helpers/validator.js","../lib/core/Axios.js","../lib/cancel/CancelToken.js","../lib/helpers/HttpStatusCode.js","../lib/axios.js","../lib/helpers/spread.js","../lib/helpers/isAxiosError.js"],"sourcesContent":["'use strict';\n\nexport default function bind(fn, thisArg) {\n return function wrap() {\n return fn.apply(thisArg, arguments);\n };\n}\n","'use strict';\n\nimport bind from './helpers/bind.js';\n\n// utils is a library of generic helper functions non-specific to axios\n\nconst {toString} = Object.prototype;\nconst {getPrototypeOf} = Object;\n\nconst kindOf = (cache => thing => {\n const str = toString.call(thing);\n return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());\n})(Object.create(null));\n\nconst kindOfTest = (type) => {\n type = type.toLowerCase();\n return (thing) => kindOf(thing) === type\n}\n\nconst typeOfTest = type => thing => typeof thing === type;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n *\n * @returns {boolean} True if value is an Array, otherwise false\n */\nconst {isArray} = Array;\n\n/**\n * Determine if a value is undefined\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nconst isUndefined = typeOfTest('undefined');\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nconst isArrayBuffer = kindOfTest('ArrayBuffer');\n\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n let result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a String, otherwise false\n */\nconst isString = typeOfTest('string');\n\n/**\n * Determine if a value is a Function\n *\n * @param {*} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nconst isFunction = typeOfTest('function');\n\n/**\n * Determine if a value is a Number\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Number, otherwise false\n */\nconst isNumber = typeOfTest('number');\n\n/**\n * Determine if a value is an Object\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an Object, otherwise false\n */\nconst isObject = (thing) => thing !== null && typeof thing === 'object';\n\n/**\n * Determine if a value is a Boolean\n *\n * @param {*} thing The value to test\n * @returns {boolean} True if value is a Boolean, otherwise false\n */\nconst isBoolean = thing => thing === true || thing === false;\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a plain Object, otherwise false\n */\nconst isPlainObject = (val) => {\n if (kindOf(val) !== 'object') {\n return false;\n }\n\n const prototype = getPrototypeOf(val);\n return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Date, otherwise false\n */\nconst isDate = kindOfTest('Date');\n\n/**\n * Determine if a value is a File\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFile = kindOfTest('File');\n\n/**\n * Determine if a value is a Blob\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nconst isBlob = kindOfTest('Blob');\n\n/**\n * Determine if a value is a FileList\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFileList = kindOfTest('FileList');\n\n/**\n * Determine if a value is a Stream\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nconst isStream = (val) => isObject(val) && isFunction(val.pipe);\n\n/**\n * Determine if a value is a FormData\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nconst isFormData = (thing) => {\n let kind;\n return thing && (\n (typeof FormData === 'function' && thing instanceof FormData) || (\n isFunction(thing.append) && (\n (kind = kindOf(thing)) === 'formdata' ||\n // detect form-data instance\n (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')\n )\n )\n )\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nconst isURLSearchParams = kindOfTest('URLSearchParams');\n\nconst [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n *\n * @returns {String} The String freed of excess whitespace\n */\nconst trim = (str) => str.trim ?\n str.trim() : str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n *\n * @param {Boolean} [allOwnKeys = false]\n * @returns {any}\n */\nfunction forEach(obj, fn, {allOwnKeys = false} = {}) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n let i;\n let l;\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);\n const len = keys.length;\n let key;\n\n for (i = 0; i < len; i++) {\n key = keys[i];\n fn.call(null, obj[key], key, obj);\n }\n }\n}\n\nfunction findKey(obj, key) {\n key = key.toLowerCase();\n const keys = Object.keys(obj);\n let i = keys.length;\n let _key;\n while (i-- > 0) {\n _key = keys[i];\n if (key === _key.toLowerCase()) {\n return _key;\n }\n }\n return null;\n}\n\nconst _global = (() => {\n /*eslint no-undef:0*/\n if (typeof globalThis !== \"undefined\") return globalThis;\n return typeof self !== \"undefined\" ? self : (typeof window !== 'undefined' ? window : global)\n})();\n\nconst isContextDefined = (context) => !isUndefined(context) && context !== _global;\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n *\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n const {caseless} = isContextDefined(this) && this || {};\n const result = {};\n const assignValue = (val, key) => {\n const targetKey = caseless && findKey(result, key) || key;\n if (isPlainObject(result[targetKey]) && isPlainObject(val)) {\n result[targetKey] = merge(result[targetKey], val);\n } else if (isPlainObject(val)) {\n result[targetKey] = merge({}, val);\n } else if (isArray(val)) {\n result[targetKey] = val.slice();\n } else {\n result[targetKey] = val;\n }\n }\n\n for (let i = 0, l = arguments.length; i < l; i++) {\n arguments[i] && forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n *\n * @param {Boolean} [allOwnKeys]\n * @returns {Object} The resulting value of object a\n */\nconst extend = (a, b, thisArg, {allOwnKeys}= {}) => {\n forEach(b, (val, key) => {\n if (thisArg && isFunction(val)) {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n }, {allOwnKeys});\n return a;\n}\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n *\n * @returns {string} content value without BOM\n */\nconst stripBOM = (content) => {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n}\n\n/**\n * Inherit the prototype methods from one constructor into another\n * @param {function} constructor\n * @param {function} superConstructor\n * @param {object} [props]\n * @param {object} [descriptors]\n *\n * @returns {void}\n */\nconst inherits = (constructor, superConstructor, props, descriptors) => {\n constructor.prototype = Object.create(superConstructor.prototype, descriptors);\n constructor.prototype.constructor = constructor;\n Object.defineProperty(constructor, 'super', {\n value: superConstructor.prototype\n });\n props && Object.assign(constructor.prototype, props);\n}\n\n/**\n * Resolve object with deep prototype chain to a flat object\n * @param {Object} sourceObj source object\n * @param {Object} [destObj]\n * @param {Function|Boolean} [filter]\n * @param {Function} [propFilter]\n *\n * @returns {Object}\n */\nconst toFlatObject = (sourceObj, destObj, filter, propFilter) => {\n let props;\n let i;\n let prop;\n const merged = {};\n\n destObj = destObj || {};\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (sourceObj == null) return destObj;\n\n do {\n props = Object.getOwnPropertyNames(sourceObj);\n i = props.length;\n while (i-- > 0) {\n prop = props[i];\n if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {\n destObj[prop] = sourceObj[prop];\n merged[prop] = true;\n }\n }\n sourceObj = filter !== false && getPrototypeOf(sourceObj);\n } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);\n\n return destObj;\n}\n\n/**\n * Determines whether a string ends with the characters of a specified string\n *\n * @param {String} str\n * @param {String} searchString\n * @param {Number} [position= 0]\n *\n * @returns {boolean}\n */\nconst endsWith = (str, searchString, position) => {\n str = String(str);\n if (position === undefined || position > str.length) {\n position = str.length;\n }\n position -= searchString.length;\n const lastIndex = str.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n}\n\n\n/**\n * Returns new array from array like object or null if failed\n *\n * @param {*} [thing]\n *\n * @returns {?Array}\n */\nconst toArray = (thing) => {\n if (!thing) return null;\n if (isArray(thing)) return thing;\n let i = thing.length;\n if (!isNumber(i)) return null;\n const arr = new Array(i);\n while (i-- > 0) {\n arr[i] = thing[i];\n }\n return arr;\n}\n\n/**\n * Checking if the Uint8Array exists and if it does, it returns a function that checks if the\n * thing passed in is an instance of Uint8Array\n *\n * @param {TypedArray}\n *\n * @returns {Array}\n */\n// eslint-disable-next-line func-names\nconst isTypedArray = (TypedArray => {\n // eslint-disable-next-line func-names\n return thing => {\n return TypedArray && thing instanceof TypedArray;\n };\n})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));\n\n/**\n * For each entry in the object, call the function with the key and value.\n *\n * @param {Object} obj - The object to iterate over.\n * @param {Function} fn - The function to call for each entry.\n *\n * @returns {void}\n */\nconst forEachEntry = (obj, fn) => {\n const generator = obj && obj[Symbol.iterator];\n\n const iterator = generator.call(obj);\n\n let result;\n\n while ((result = iterator.next()) && !result.done) {\n const pair = result.value;\n fn.call(obj, pair[0], pair[1]);\n }\n}\n\n/**\n * It takes a regular expression and a string, and returns an array of all the matches\n *\n * @param {string} regExp - The regular expression to match against.\n * @param {string} str - The string to search.\n *\n * @returns {Array}\n */\nconst matchAll = (regExp, str) => {\n let matches;\n const arr = [];\n\n while ((matches = regExp.exec(str)) !== null) {\n arr.push(matches);\n }\n\n return arr;\n}\n\n/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */\nconst isHTMLForm = kindOfTest('HTMLFormElement');\n\nconst toCamelCase = str => {\n return str.toLowerCase().replace(/[-_\\s]([a-z\\d])(\\w*)/g,\n function replacer(m, p1, p2) {\n return p1.toUpperCase() + p2;\n }\n );\n};\n\n/* Creating a function that will check if an object has a property. */\nconst hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);\n\n/**\n * Determine if a value is a RegExp object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a RegExp object, otherwise false\n */\nconst isRegExp = kindOfTest('RegExp');\n\nconst reduceDescriptors = (obj, reducer) => {\n const descriptors = Object.getOwnPropertyDescriptors(obj);\n const reducedDescriptors = {};\n\n forEach(descriptors, (descriptor, name) => {\n let ret;\n if ((ret = reducer(descriptor, name, obj)) !== false) {\n reducedDescriptors[name] = ret || descriptor;\n }\n });\n\n Object.defineProperties(obj, reducedDescriptors);\n}\n\n/**\n * Makes all methods read-only\n * @param {Object} obj\n */\n\nconst freezeMethods = (obj) => {\n reduceDescriptors(obj, (descriptor, name) => {\n // skip restricted props in strict mode\n if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {\n return false;\n }\n\n const value = obj[name];\n\n if (!isFunction(value)) return;\n\n descriptor.enumerable = false;\n\n if ('writable' in descriptor) {\n descriptor.writable = false;\n return;\n }\n\n if (!descriptor.set) {\n descriptor.set = () => {\n throw Error('Can not rewrite read-only method \\'' + name + '\\'');\n };\n }\n });\n}\n\nconst toObjectSet = (arrayOrString, delimiter) => {\n const obj = {};\n\n const define = (arr) => {\n arr.forEach(value => {\n obj[value] = true;\n });\n }\n\n isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));\n\n return obj;\n}\n\nconst noop = () => {}\n\nconst toFiniteNumber = (value, defaultValue) => {\n return value != null && Number.isFinite(value = +value) ? value : defaultValue;\n}\n\nconst ALPHA = 'abcdefghijklmnopqrstuvwxyz'\n\nconst DIGIT = '0123456789';\n\nconst ALPHABET = {\n DIGIT,\n ALPHA,\n ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT\n}\n\nconst generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {\n let str = '';\n const {length} = alphabet;\n while (size--) {\n str += alphabet[Math.random() * length|0]\n }\n\n return str;\n}\n\n/**\n * If the thing is a FormData object, return true, otherwise return false.\n *\n * @param {unknown} thing - The thing to check.\n *\n * @returns {boolean}\n */\nfunction isSpecCompliantForm(thing) {\n return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);\n}\n\nconst toJSONObject = (obj) => {\n const stack = new Array(10);\n\n const visit = (source, i) => {\n\n if (isObject(source)) {\n if (stack.indexOf(source) >= 0) {\n return;\n }\n\n if(!('toJSON' in source)) {\n stack[i] = source;\n const target = isArray(source) ? [] : {};\n\n forEach(source, (value, key) => {\n const reducedValue = visit(value, i + 1);\n !isUndefined(reducedValue) && (target[key] = reducedValue);\n });\n\n stack[i] = undefined;\n\n return target;\n }\n }\n\n return source;\n }\n\n return visit(obj, 0);\n}\n\nconst isAsyncFn = kindOfTest('AsyncFunction');\n\nconst isThenable = (thing) =>\n thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);\n\nexport default {\n isArray,\n isArrayBuffer,\n isBuffer,\n isFormData,\n isArrayBufferView,\n isString,\n isNumber,\n isBoolean,\n isObject,\n isPlainObject,\n isReadableStream,\n isRequest,\n isResponse,\n isHeaders,\n isUndefined,\n isDate,\n isFile,\n isBlob,\n isRegExp,\n isFunction,\n isStream,\n isURLSearchParams,\n isTypedArray,\n isFileList,\n forEach,\n merge,\n extend,\n trim,\n stripBOM,\n inherits,\n toFlatObject,\n kindOf,\n kindOfTest,\n endsWith,\n toArray,\n forEachEntry,\n matchAll,\n isHTMLForm,\n hasOwnProperty,\n hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection\n reduceDescriptors,\n freezeMethods,\n toObjectSet,\n toCamelCase,\n noop,\n toFiniteNumber,\n findKey,\n global: _global,\n isContextDefined,\n ALPHABET,\n generateString,\n isSpecCompliantForm,\n toJSONObject,\n isAsyncFn,\n isThenable\n};\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [config] The config.\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n *\n * @returns {Error} The created error.\n */\nfunction AxiosError(message, code, config, request, response) {\n Error.call(this);\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n this.stack = (new Error()).stack;\n }\n\n this.message = message;\n this.name = 'AxiosError';\n code && (this.code = code);\n config && (this.config = config);\n request && (this.request = request);\n response && (this.response = response);\n}\n\nutils.inherits(AxiosError, Error, {\n toJSON: function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: utils.toJSONObject(this.config),\n code: this.code,\n status: this.response && this.response.status ? this.response.status : null\n };\n }\n});\n\nconst prototype = AxiosError.prototype;\nconst descriptors = {};\n\n[\n 'ERR_BAD_OPTION_VALUE',\n 'ERR_BAD_OPTION',\n 'ECONNABORTED',\n 'ETIMEDOUT',\n 'ERR_NETWORK',\n 'ERR_FR_TOO_MANY_REDIRECTS',\n 'ERR_DEPRECATED',\n 'ERR_BAD_RESPONSE',\n 'ERR_BAD_REQUEST',\n 'ERR_CANCELED',\n 'ERR_NOT_SUPPORT',\n 'ERR_INVALID_URL'\n// eslint-disable-next-line func-names\n].forEach(code => {\n descriptors[code] = {value: code};\n});\n\nObject.defineProperties(AxiosError, descriptors);\nObject.defineProperty(prototype, 'isAxiosError', {value: true});\n\n// eslint-disable-next-line func-names\nAxiosError.from = (error, code, config, request, response, customProps) => {\n const axiosError = Object.create(prototype);\n\n utils.toFlatObject(error, axiosError, function filter(obj) {\n return obj !== Error.prototype;\n }, prop => {\n return prop !== 'isAxiosError';\n });\n\n AxiosError.call(axiosError, error.message, code, config, request, response);\n\n axiosError.cause = error;\n\n axiosError.name = error.name;\n\n customProps && Object.assign(axiosError, customProps);\n\n return axiosError;\n};\n\nexport default AxiosError;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\n// temporary hotfix to avoid circular references until AxiosURLSearchParams is refactored\nimport PlatformFormData from '../platform/node/classes/FormData.js';\n\n/**\n * Determines if the given thing is a array or js object.\n *\n * @param {string} thing - The object or array to be visited.\n *\n * @returns {boolean}\n */\nfunction isVisitable(thing) {\n return utils.isPlainObject(thing) || utils.isArray(thing);\n}\n\n/**\n * It removes the brackets from the end of a string\n *\n * @param {string} key - The key of the parameter.\n *\n * @returns {string} the key without the brackets.\n */\nfunction removeBrackets(key) {\n return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;\n}\n\n/**\n * It takes a path, a key, and a boolean, and returns a string\n *\n * @param {string} path - The path to the current key.\n * @param {string} key - The key of the current object being iterated over.\n * @param {string} dots - If true, the key will be rendered with dots instead of brackets.\n *\n * @returns {string} The path to the current key.\n */\nfunction renderKey(path, key, dots) {\n if (!path) return key;\n return path.concat(key).map(function each(token, i) {\n // eslint-disable-next-line no-param-reassign\n token = removeBrackets(token);\n return !dots && i ? '[' + token + ']' : token;\n }).join(dots ? '.' : '');\n}\n\n/**\n * If the array is an array and none of its elements are visitable, then it's a flat array.\n *\n * @param {Array} arr - The array to check\n *\n * @returns {boolean}\n */\nfunction isFlatArray(arr) {\n return utils.isArray(arr) && !arr.some(isVisitable);\n}\n\nconst predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {\n return /^is[A-Z]/.test(prop);\n});\n\n/**\n * Convert a data object to FormData\n *\n * @param {Object} obj\n * @param {?Object} [formData]\n * @param {?Object} [options]\n * @param {Function} [options.visitor]\n * @param {Boolean} [options.metaTokens = true]\n * @param {Boolean} [options.dots = false]\n * @param {?Boolean} [options.indexes = false]\n *\n * @returns {Object}\n **/\n\n/**\n * It converts an object into a FormData object\n *\n * @param {Object} obj - The object to convert to form data.\n * @param {string} formData - The FormData object to append to.\n * @param {Object} options\n *\n * @returns\n */\nfunction toFormData(obj, formData, options) {\n if (!utils.isObject(obj)) {\n throw new TypeError('target must be an object');\n }\n\n // eslint-disable-next-line no-param-reassign\n formData = formData || new (PlatformFormData || FormData)();\n\n // eslint-disable-next-line no-param-reassign\n options = utils.toFlatObject(options, {\n metaTokens: true,\n dots: false,\n indexes: false\n }, false, function defined(option, source) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n return !utils.isUndefined(source[option]);\n });\n\n const metaTokens = options.metaTokens;\n // eslint-disable-next-line no-use-before-define\n const visitor = options.visitor || defaultVisitor;\n const dots = options.dots;\n const indexes = options.indexes;\n const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;\n const useBlob = _Blob && utils.isSpecCompliantForm(formData);\n\n if (!utils.isFunction(visitor)) {\n throw new TypeError('visitor must be a function');\n }\n\n function convertValue(value) {\n if (value === null) return '';\n\n if (utils.isDate(value)) {\n return value.toISOString();\n }\n\n if (!useBlob && utils.isBlob(value)) {\n throw new AxiosError('Blob is not supported. Use a Buffer instead.');\n }\n\n if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {\n return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);\n }\n\n return value;\n }\n\n /**\n * Default visitor.\n *\n * @param {*} value\n * @param {String|Number} key\n * @param {Array} path\n * @this {FormData}\n *\n * @returns {boolean} return true to visit the each prop of the value recursively\n */\n function defaultVisitor(value, key, path) {\n let arr = value;\n\n if (value && !path && typeof value === 'object') {\n if (utils.endsWith(key, '{}')) {\n // eslint-disable-next-line no-param-reassign\n key = metaTokens ? key : key.slice(0, -2);\n // eslint-disable-next-line no-param-reassign\n value = JSON.stringify(value);\n } else if (\n (utils.isArray(value) && isFlatArray(value)) ||\n ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))\n )) {\n // eslint-disable-next-line no-param-reassign\n key = removeBrackets(key);\n\n arr.forEach(function each(el, index) {\n !(utils.isUndefined(el) || el === null) && formData.append(\n // eslint-disable-next-line no-nested-ternary\n indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),\n convertValue(el)\n );\n });\n return false;\n }\n }\n\n if (isVisitable(value)) {\n return true;\n }\n\n formData.append(renderKey(path, key, dots), convertValue(value));\n\n return false;\n }\n\n const stack = [];\n\n const exposedHelpers = Object.assign(predicates, {\n defaultVisitor,\n convertValue,\n isVisitable\n });\n\n function build(value, path) {\n if (utils.isUndefined(value)) return;\n\n if (stack.indexOf(value) !== -1) {\n throw Error('Circular reference detected in ' + path.join('.'));\n }\n\n stack.push(value);\n\n utils.forEach(value, function each(el, key) {\n const result = !(utils.isUndefined(el) || el === null) && visitor.call(\n formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers\n );\n\n if (result === true) {\n build(el, path ? path.concat(key) : [key]);\n }\n });\n\n stack.pop();\n }\n\n if (!utils.isObject(obj)) {\n throw new TypeError('data must be an object');\n }\n\n build(obj);\n\n return formData;\n}\n\nexport default toFormData;\n","'use strict';\n\nimport toFormData from './toFormData.js';\n\n/**\n * It encodes a string by replacing all characters that are not in the unreserved set with\n * their percent-encoded equivalents\n *\n * @param {string} str - The string to encode.\n *\n * @returns {string} The encoded string.\n */\nfunction encode(str) {\n const charMap = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n '%00': '\\x00'\n };\n return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {\n return charMap[match];\n });\n}\n\n/**\n * It takes a params object and converts it to a FormData object\n *\n * @param {Object} params - The parameters to be converted to a FormData object.\n * @param {Object} options - The options object passed to the Axios constructor.\n *\n * @returns {void}\n */\nfunction AxiosURLSearchParams(params, options) {\n this._pairs = [];\n\n params && toFormData(params, this, options);\n}\n\nconst prototype = AxiosURLSearchParams.prototype;\n\nprototype.append = function append(name, value) {\n this._pairs.push([name, value]);\n};\n\nprototype.toString = function toString(encoder) {\n const _encode = encoder ? function(value) {\n return encoder.call(this, value, encode);\n } : encode;\n\n return this._pairs.map(function each(pair) {\n return _encode(pair[0]) + '=' + _encode(pair[1]);\n }, '').join('&');\n};\n\nexport default AxiosURLSearchParams;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js';\n\n/**\n * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their\n * URI encoded counterparts\n *\n * @param {string} val The value to be encoded.\n *\n * @returns {string} The encoded value.\n */\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @param {?object} options\n *\n * @returns {string} The formatted url\n */\nexport default function buildURL(url, params, options) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n \n const _encode = options && options.encode || encode;\n\n const serializeFn = options && options.serialize;\n\n let serializedParams;\n\n if (serializeFn) {\n serializedParams = serializeFn(params, options);\n } else {\n serializedParams = utils.isURLSearchParams(params) ?\n params.toString() :\n new AxiosURLSearchParams(params, options).toString(_encode);\n }\n\n if (serializedParams) {\n const hashmarkIndex = url.indexOf(\"#\");\n\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\nclass InterceptorManager {\n constructor() {\n this.handlers = [];\n }\n\n /**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\n use(fulfilled, rejected, options) {\n this.handlers.push({\n fulfilled,\n rejected,\n synchronous: options ? options.synchronous : false,\n runWhen: options ? options.runWhen : null\n });\n return this.handlers.length - 1;\n }\n\n /**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n *\n * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise\n */\n eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n }\n\n /**\n * Clear all interceptors from the stack\n *\n * @returns {void}\n */\n clear() {\n if (this.handlers) {\n this.handlers = [];\n }\n }\n\n /**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n *\n * @returns {void}\n */\n forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n }\n}\n\nexport default InterceptorManager;\n","const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n *\n * @returns {boolean}\n */\nconst hasStandardBrowserEnv = (\n (product) => {\n return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0\n })(typeof navigator !== 'undefined' && navigator.product);\n\n/**\n * Determine if we're running in a standard browser webWorker environment\n *\n * Although the `isStandardBrowserEnv` method indicates that\n * `allows axios to run in a web worker`, the WebWorker will still be\n * filtered out due to its judgment standard\n * `typeof window !== 'undefined' && typeof document !== 'undefined'`.\n * This leads to a problem when axios post `FormData` in webWorker\n */\nconst hasStandardBrowserWebWorkerEnv = (() => {\n return (\n typeof WorkerGlobalScope !== 'undefined' &&\n // eslint-disable-next-line no-undef\n self instanceof WorkerGlobalScope &&\n typeof self.importScripts === 'function'\n );\n})();\n\nconst origin = hasBrowserEnv && window.location.href || 'http://localhost';\n\nexport {\n hasBrowserEnv,\n hasStandardBrowserWebWorkerEnv,\n hasStandardBrowserEnv,\n origin\n}\n","'use strict';\n\nexport default {\n silentJSONParsing: true,\n forcedJSONParsing: true,\n clarifyTimeoutError: false\n};\n","import URLSearchParams from './classes/URLSearchParams.js'\nimport FormData from './classes/FormData.js'\nimport Blob from './classes/Blob.js'\n\nexport default {\n isBrowser: true,\n classes: {\n URLSearchParams,\n FormData,\n Blob\n },\n protocols: ['http', 'https', 'file', 'blob', 'url', 'data']\n};\n","'use strict';\n\nimport AxiosURLSearchParams from '../../../helpers/AxiosURLSearchParams.js';\nexport default typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;\n","'use strict';\n\nexport default typeof FormData !== 'undefined' ? FormData : null;\n","'use strict'\n\nexport default typeof Blob !== 'undefined' ? Blob : null\n","import platform from './node/index.js';\nimport * as utils from './common/utils.js';\n\nexport default {\n ...utils,\n ...platform\n}\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']\n *\n * @param {string} name - The name of the property to get.\n *\n * @returns An array of strings.\n */\nfunction parsePropPath(name) {\n // foo[x][y][z]\n // foo.x.y.z\n // foo-x-y-z\n // foo x y z\n return utils.matchAll(/\\w+|\\[(\\w*)]/g, name).map(match => {\n return match[0] === '[]' ? '' : match[1] || match[0];\n });\n}\n\n/**\n * Convert an array to an object.\n *\n * @param {Array} arr - The array to convert to an object.\n *\n * @returns An object with the same keys and values as the array.\n */\nfunction arrayToObject(arr) {\n const obj = {};\n const keys = Object.keys(arr);\n let i;\n const len = keys.length;\n let key;\n for (i = 0; i < len; i++) {\n key = keys[i];\n obj[key] = arr[key];\n }\n return obj;\n}\n\n/**\n * It takes a FormData object and returns a JavaScript object\n *\n * @param {string} formData The FormData object to convert to JSON.\n *\n * @returns {Object | null} The converted object.\n */\nfunction formDataToJSON(formData) {\n function buildPath(path, value, target, index) {\n let name = path[index++];\n\n if (name === '__proto__') return true;\n\n const isNumericKey = Number.isFinite(+name);\n const isLast = index >= path.length;\n name = !name && utils.isArray(target) ? target.length : name;\n\n if (isLast) {\n if (utils.hasOwnProp(target, name)) {\n target[name] = [target[name], value];\n } else {\n target[name] = value;\n }\n\n return !isNumericKey;\n }\n\n if (!target[name] || !utils.isObject(target[name])) {\n target[name] = [];\n }\n\n const result = buildPath(path, value, target[name], index);\n\n if (result && utils.isArray(target[name])) {\n target[name] = arrayToObject(target[name]);\n }\n\n return !isNumericKey;\n }\n\n if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {\n const obj = {};\n\n utils.forEachEntry(formData, (name, value) => {\n buildPath(parsePropPath(name), value, obj, 0);\n });\n\n return obj;\n }\n\n return null;\n}\n\nexport default formDataToJSON;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\nimport transitionalDefaults from './transitional.js';\nimport toFormData from '../helpers/toFormData.js';\nimport toURLEncodedForm from '../helpers/toURLEncodedForm.js';\nimport platform from '../platform/index.js';\nimport formDataToJSON from '../helpers/formDataToJSON.js';\n\n/**\n * It takes a string, tries to parse it, and if it fails, it returns the stringified version\n * of the input\n *\n * @param {any} rawValue - The value to be stringified.\n * @param {Function} parser - A function that parses a string into a JavaScript object.\n * @param {Function} encoder - A function that takes a value and returns a string.\n *\n * @returns {string} A stringified version of the rawValue.\n */\nfunction stringifySafely(rawValue, parser, encoder) {\n if (utils.isString(rawValue)) {\n try {\n (parser || JSON.parse)(rawValue);\n return utils.trim(rawValue);\n } catch (e) {\n if (e.name !== 'SyntaxError') {\n throw e;\n }\n }\n }\n\n return (encoder || JSON.stringify)(rawValue);\n}\n\nconst defaults = {\n\n transitional: transitionalDefaults,\n\n adapter: ['xhr', 'http', 'fetch'],\n\n transformRequest: [function transformRequest(data, headers) {\n const contentType = headers.getContentType() || '';\n const hasJSONContentType = contentType.indexOf('application/json') > -1;\n const isObjectPayload = utils.isObject(data);\n\n if (isObjectPayload && utils.isHTMLForm(data)) {\n data = new FormData(data);\n }\n\n const isFormData = utils.isFormData(data);\n\n if (isFormData) {\n return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;\n }\n\n if (utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data) ||\n utils.isReadableStream(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);\n return data.toString();\n }\n\n let isFileList;\n\n if (isObjectPayload) {\n if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {\n return toURLEncodedForm(data, this.formSerializer).toString();\n }\n\n if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {\n const _FormData = this.env && this.env.FormData;\n\n return toFormData(\n isFileList ? {'files[]': data} : data,\n _FormData && new _FormData(),\n this.formSerializer\n );\n }\n }\n\n if (isObjectPayload || hasJSONContentType ) {\n headers.setContentType('application/json', false);\n return stringifySafely(data);\n }\n\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n const transitional = this.transitional || defaults.transitional;\n const forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n const JSONRequested = this.responseType === 'json';\n\n if (utils.isResponse(data) || utils.isReadableStream(data)) {\n return data;\n }\n\n if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {\n const silentJSONParsing = transitional && transitional.silentJSONParsing;\n const strictJSONParsing = !silentJSONParsing && JSONRequested;\n\n try {\n return JSON.parse(data);\n } catch (e) {\n if (strictJSONParsing) {\n if (e.name === 'SyntaxError') {\n throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);\n }\n throw e;\n }\n }\n }\n\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n env: {\n FormData: platform.classes.FormData,\n Blob: platform.classes.Blob\n },\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n },\n\n headers: {\n common: {\n 'Accept': 'application/json, text/plain, */*',\n 'Content-Type': undefined\n }\n }\n};\n\nutils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {\n defaults.headers[method] = {};\n});\n\nexport default defaults;\n","'use strict';\n\nimport utils from '../utils.js';\nimport toFormData from './toFormData.js';\nimport platform from '../platform/index.js';\n\nexport default function toURLEncodedForm(data, options) {\n return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({\n visitor: function(value, key, path, helpers) {\n if (platform.isNode && utils.isBuffer(value)) {\n this.append(key, value.toString('base64'));\n return false;\n }\n\n return helpers.defaultVisitor.apply(this, arguments);\n }\n }, options));\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\n// RawAxiosHeaders whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nconst ignoreDuplicateOf = utils.toObjectSet([\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n]);\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} rawHeaders Headers needing to be parsed\n *\n * @returns {Object} Headers parsed into an object\n */\nexport default rawHeaders => {\n const parsed = {};\n let key;\n let val;\n let i;\n\n rawHeaders && rawHeaders.split('\\n').forEach(function parser(line) {\n i = line.indexOf(':');\n key = line.substring(0, i).trim().toLowerCase();\n val = line.substring(i + 1).trim();\n\n if (!key || (parsed[key] && ignoreDuplicateOf[key])) {\n return;\n }\n\n if (key === 'set-cookie') {\n if (parsed[key]) {\n parsed[key].push(val);\n } else {\n parsed[key] = [val];\n }\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n });\n\n return parsed;\n};\n","'use strict';\n\nimport utils from '../utils.js';\nimport parseHeaders from '../helpers/parseHeaders.js';\n\nconst $internals = Symbol('internals');\n\nfunction normalizeHeader(header) {\n return header && String(header).trim().toLowerCase();\n}\n\nfunction normalizeValue(value) {\n if (value === false || value == null) {\n return value;\n }\n\n return utils.isArray(value) ? value.map(normalizeValue) : String(value);\n}\n\nfunction parseTokens(str) {\n const tokens = Object.create(null);\n const tokensRE = /([^\\s,;=]+)\\s*(?:=\\s*([^,;]+))?/g;\n let match;\n\n while ((match = tokensRE.exec(str))) {\n tokens[match[1]] = match[2];\n }\n\n return tokens;\n}\n\nconst isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());\n\nfunction matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {\n if (utils.isFunction(filter)) {\n return filter.call(this, value, header);\n }\n\n if (isHeaderNameFilter) {\n value = header;\n }\n\n if (!utils.isString(value)) return;\n\n if (utils.isString(filter)) {\n return value.indexOf(filter) !== -1;\n }\n\n if (utils.isRegExp(filter)) {\n return filter.test(value);\n }\n}\n\nfunction formatHeader(header) {\n return header.trim()\n .toLowerCase().replace(/([a-z\\d])(\\w*)/g, (w, char, str) => {\n return char.toUpperCase() + str;\n });\n}\n\nfunction buildAccessors(obj, header) {\n const accessorName = utils.toCamelCase(' ' + header);\n\n ['get', 'set', 'has'].forEach(methodName => {\n Object.defineProperty(obj, methodName + accessorName, {\n value: function(arg1, arg2, arg3) {\n return this[methodName].call(this, header, arg1, arg2, arg3);\n },\n configurable: true\n });\n });\n}\n\nclass AxiosHeaders {\n constructor(headers) {\n headers && this.set(headers);\n }\n\n set(header, valueOrRewrite, rewrite) {\n const self = this;\n\n function setHeader(_value, _header, _rewrite) {\n const lHeader = normalizeHeader(_header);\n\n if (!lHeader) {\n throw new Error('header name must be a non-empty string');\n }\n\n const key = utils.findKey(self, lHeader);\n\n if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {\n self[key || _header] = normalizeValue(_value);\n }\n }\n\n const setHeaders = (headers, _rewrite) =>\n utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));\n\n if (utils.isPlainObject(header) || header instanceof this.constructor) {\n setHeaders(header, valueOrRewrite)\n } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {\n setHeaders(parseHeaders(header), valueOrRewrite);\n } else if (utils.isHeaders(header)) {\n for (const [key, value] of header.entries()) {\n setHeader(value, key, rewrite);\n }\n } else {\n header != null && setHeader(valueOrRewrite, header, rewrite);\n }\n\n return this;\n }\n\n get(header, parser) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n if (key) {\n const value = this[key];\n\n if (!parser) {\n return value;\n }\n\n if (parser === true) {\n return parseTokens(value);\n }\n\n if (utils.isFunction(parser)) {\n return parser.call(this, value, key);\n }\n\n if (utils.isRegExp(parser)) {\n return parser.exec(value);\n }\n\n throw new TypeError('parser must be boolean|regexp|function');\n }\n }\n }\n\n has(header, matcher) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));\n }\n\n return false;\n }\n\n delete(header, matcher) {\n const self = this;\n let deleted = false;\n\n function deleteHeader(_header) {\n _header = normalizeHeader(_header);\n\n if (_header) {\n const key = utils.findKey(self, _header);\n\n if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {\n delete self[key];\n\n deleted = true;\n }\n }\n }\n\n if (utils.isArray(header)) {\n header.forEach(deleteHeader);\n } else {\n deleteHeader(header);\n }\n\n return deleted;\n }\n\n clear(matcher) {\n const keys = Object.keys(this);\n let i = keys.length;\n let deleted = false;\n\n while (i--) {\n const key = keys[i];\n if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {\n delete this[key];\n deleted = true;\n }\n }\n\n return deleted;\n }\n\n normalize(format) {\n const self = this;\n const headers = {};\n\n utils.forEach(this, (value, header) => {\n const key = utils.findKey(headers, header);\n\n if (key) {\n self[key] = normalizeValue(value);\n delete self[header];\n return;\n }\n\n const normalized = format ? formatHeader(header) : String(header).trim();\n\n if (normalized !== header) {\n delete self[header];\n }\n\n self[normalized] = normalizeValue(value);\n\n headers[normalized] = true;\n });\n\n return this;\n }\n\n concat(...targets) {\n return this.constructor.concat(this, ...targets);\n }\n\n toJSON(asStrings) {\n const obj = Object.create(null);\n\n utils.forEach(this, (value, header) => {\n value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);\n });\n\n return obj;\n }\n\n [Symbol.iterator]() {\n return Object.entries(this.toJSON())[Symbol.iterator]();\n }\n\n toString() {\n return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\\n');\n }\n\n get [Symbol.toStringTag]() {\n return 'AxiosHeaders';\n }\n\n static from(thing) {\n return thing instanceof this ? thing : new this(thing);\n }\n\n static concat(first, ...targets) {\n const computed = new this(first);\n\n targets.forEach((target) => computed.set(target));\n\n return computed;\n }\n\n static accessor(header) {\n const internals = this[$internals] = (this[$internals] = {\n accessors: {}\n });\n\n const accessors = internals.accessors;\n const prototype = this.prototype;\n\n function defineAccessor(_header) {\n const lHeader = normalizeHeader(_header);\n\n if (!accessors[lHeader]) {\n buildAccessors(prototype, _header);\n accessors[lHeader] = true;\n }\n }\n\n utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);\n\n return this;\n }\n}\n\nAxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);\n\n// reserved names hotfix\nutils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {\n let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`\n return {\n get: () => value,\n set(headerValue) {\n this[mapped] = headerValue;\n }\n }\n});\n\nutils.freezeMethods(AxiosHeaders);\n\nexport default AxiosHeaders;\n","'use strict';\n\nimport utils from './../utils.js';\nimport defaults from '../defaults/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Array|Function} fns A single function or Array of functions\n * @param {?Object} response The response object\n *\n * @returns {*} The resulting transformed data\n */\nexport default function transformData(fns, response) {\n const config = this || defaults;\n const context = response || config;\n const headers = AxiosHeaders.from(context.headers);\n let data = context.data;\n\n utils.forEach(fns, function transform(fn) {\n data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);\n });\n\n headers.normalize();\n\n return data;\n}\n","'use strict';\n\nexport default function isCancel(value) {\n return !!(value && value.__CANCEL__);\n}\n","'use strict';\n\nimport AxiosError from '../core/AxiosError.js';\nimport utils from '../utils.js';\n\n/**\n * A `CanceledError` is an object that is thrown when an operation is canceled.\n *\n * @param {string=} message The message.\n * @param {Object=} config The config.\n * @param {Object=} request The request.\n *\n * @returns {CanceledError} The created error.\n */\nfunction CanceledError(message, config, request) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);\n this.name = 'CanceledError';\n}\n\nutils.inherits(CanceledError, AxiosError, {\n __CANCEL__: true\n});\n\nexport default CanceledError;\n","'use strict';\n\nimport AxiosError from './AxiosError.js';\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n *\n * @returns {object} The response.\n */\nexport default function settle(resolve, reject, response) {\n const validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(new AxiosError(\n 'Request failed with status code ' + response.status,\n [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],\n response.config,\n response.request,\n response\n ));\n }\n}\n","'use strict';\n\n/**\n * Calculate data maxRate\n * @param {Number} [samplesCount= 10]\n * @param {Number} [min= 1000]\n * @returns {Function}\n */\nfunction speedometer(samplesCount, min) {\n samplesCount = samplesCount || 10;\n const bytes = new Array(samplesCount);\n const timestamps = new Array(samplesCount);\n let head = 0;\n let tail = 0;\n let firstSampleTS;\n\n min = min !== undefined ? min : 1000;\n\n return function push(chunkLength) {\n const now = Date.now();\n\n const startedAt = timestamps[tail];\n\n if (!firstSampleTS) {\n firstSampleTS = now;\n }\n\n bytes[head] = chunkLength;\n timestamps[head] = now;\n\n let i = tail;\n let bytesCount = 0;\n\n while (i !== head) {\n bytesCount += bytes[i++];\n i = i % samplesCount;\n }\n\n head = (head + 1) % samplesCount;\n\n if (head === tail) {\n tail = (tail + 1) % samplesCount;\n }\n\n if (now - firstSampleTS < min) {\n return;\n }\n\n const passed = startedAt && now - startedAt;\n\n return passed ? Math.round(bytesCount * 1000 / passed) : undefined;\n };\n}\n\nexport default speedometer;\n","'use strict';\n\n/**\n * Throttle decorator\n * @param {Function} fn\n * @param {Number} freq\n * @return {Function}\n */\nfunction throttle(fn, freq) {\n let timestamp = 0;\n const threshold = 1000 / freq;\n let timer = null;\n return function throttled() {\n const force = this === true;\n\n const now = Date.now();\n if (force || now - timestamp > threshold) {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n timestamp = now;\n return fn.apply(null, arguments);\n }\n if (!timer) {\n timer = setTimeout(() => {\n timer = null;\n timestamp = Date.now();\n return fn.apply(null, arguments);\n }, threshold - (now - timestamp));\n }\n };\n}\n\nexport default throttle;\n","import speedometer from \"./speedometer.js\";\nimport throttle from \"./throttle.js\";\n\nexport default (listener, isDownloadStream, freq = 3) => {\n let bytesNotified = 0;\n const _speedometer = speedometer(50, 250);\n\n return throttle(e => {\n const loaded = e.loaded;\n const total = e.lengthComputable ? e.total : undefined;\n const progressBytes = loaded - bytesNotified;\n const rate = _speedometer(progressBytes);\n const inRange = loaded <= total;\n\n bytesNotified = loaded;\n\n const data = {\n loaded,\n total,\n progress: total ? (loaded / total) : undefined,\n bytes: progressBytes,\n rate: rate ? rate : undefined,\n estimated: rate && total && inRange ? (total - loaded) / rate : undefined,\n event: e,\n lengthComputable: total != null\n };\n\n data[isDownloadStream ? 'download' : 'upload'] = true;\n\n listener(data);\n }, freq);\n}\n","'use strict';\n\nimport utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n// Standard browser envs have full support of the APIs needed to test\n// whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n const msie = /(msie|trident)/i.test(navigator.userAgent);\n const urlParsingNode = document.createElement('a');\n let originURL;\n\n /**\n * Parse a URL to discover its components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n let href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })();\n","import utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n // Standard browser envs support document.cookie\n {\n write(name, value, expires, path, domain, secure) {\n const cookie = [name + '=' + encodeURIComponent(value)];\n\n utils.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());\n\n utils.isString(path) && cookie.push('path=' + path);\n\n utils.isString(domain) && cookie.push('domain=' + domain);\n\n secure === true && cookie.push('secure');\n\n document.cookie = cookie.join('; ');\n },\n\n read(name) {\n const match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n }\n\n :\n\n // Non-standard browser env (web workers, react-native) lack needed support.\n {\n write() {},\n read() {\n return null;\n },\n remove() {}\n };\n\n","'use strict';\n\nimport isAbsoluteURL from '../helpers/isAbsoluteURL.js';\nimport combineURLs from '../helpers/combineURLs.js';\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n *\n * @returns {string} The combined full path\n */\nexport default function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n}\n","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n *\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nexport default function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(url);\n}\n","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n *\n * @returns {string} The combined URL\n */\nexport default function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/?\\/$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosHeaders from \"./AxiosHeaders.js\";\n\nconst headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n *\n * @returns {Object} New object resulting from merging config2 to config1\n */\nexport default function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n const config = {};\n\n function getMergedValue(target, source, caseless) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge.call({caseless}, target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDeepProperties(a, b, caseless) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(a, b, caseless);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a, caseless);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function valueFromConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function defaultToConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDirectKeys(a, b, prop) {\n if (prop in config2) {\n return getMergedValue(a, b);\n } else if (prop in config1) {\n return getMergedValue(undefined, a);\n }\n }\n\n const mergeMap = {\n url: valueFromConfig2,\n method: valueFromConfig2,\n data: valueFromConfig2,\n baseURL: defaultToConfig2,\n transformRequest: defaultToConfig2,\n transformResponse: defaultToConfig2,\n paramsSerializer: defaultToConfig2,\n timeout: defaultToConfig2,\n timeoutMessage: defaultToConfig2,\n withCredentials: defaultToConfig2,\n withXSRFToken: defaultToConfig2,\n adapter: defaultToConfig2,\n responseType: defaultToConfig2,\n xsrfCookieName: defaultToConfig2,\n xsrfHeaderName: defaultToConfig2,\n onUploadProgress: defaultToConfig2,\n onDownloadProgress: defaultToConfig2,\n decompress: defaultToConfig2,\n maxContentLength: defaultToConfig2,\n maxBodyLength: defaultToConfig2,\n beforeRedirect: defaultToConfig2,\n transport: defaultToConfig2,\n httpAgent: defaultToConfig2,\n httpsAgent: defaultToConfig2,\n cancelToken: defaultToConfig2,\n socketPath: defaultToConfig2,\n responseEncoding: defaultToConfig2,\n validateStatus: mergeDirectKeys,\n headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)\n };\n\n utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {\n const merge = mergeMap[prop] || mergeDeepProperties;\n const configValue = merge(config1[prop], config2[prop], prop);\n (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);\n });\n\n return config;\n}\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport isURLSameOrigin from \"./isURLSameOrigin.js\";\nimport cookies from \"./cookies.js\";\nimport buildFullPath from \"../core/buildFullPath.js\";\nimport mergeConfig from \"../core/mergeConfig.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport buildURL from \"./buildURL.js\";\n\nexport default (config) => {\n const newConfig = mergeConfig({}, config);\n\n let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;\n\n newConfig.headers = headers = AxiosHeaders.from(headers);\n\n newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);\n\n // HTTP basic authentication\n if (auth) {\n headers.set('Authorization', 'Basic ' +\n btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))\n );\n }\n\n let contentType;\n\n if (utils.isFormData(data)) {\n if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {\n headers.setContentType(undefined); // Let the browser set it\n } else if ((contentType = headers.getContentType()) !== false) {\n // fix semicolon duplication issue for ReactNative FormData implementation\n const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];\n headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));\n }\n }\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n\n if (platform.hasStandardBrowserEnv) {\n withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));\n\n if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {\n // Add xsrf header\n const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);\n\n if (xsrfValue) {\n headers.set(xsrfHeaderName, xsrfValue);\n }\n }\n }\n\n return newConfig;\n}\n\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport AxiosError from \"../core/AxiosError.js\";\nimport composeSignals from \"../helpers/composeSignals.js\";\nimport {trackStream} from \"../helpers/trackStream.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport progressEventReducer from \"../helpers/progressEventReducer.js\";\nimport resolveConfig from \"../helpers/resolveConfig.js\";\nimport settle from \"../core/settle.js\";\n\nconst fetchProgressDecorator = (total, fn) => {\n const lengthComputable = total != null;\n return (loaded) => setTimeout(() => fn({\n lengthComputable,\n total,\n loaded\n }));\n}\n\nconst isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';\nconst isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';\n\n// used only inside the fetch adapter\nconst encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?\n ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :\n async (str) => new Uint8Array(await new Response(str).arrayBuffer())\n);\n\nconst supportsRequestStream = isReadableStreamSupported && (() => {\n let duplexAccessed = false;\n\n const hasContentType = new Request(platform.origin, {\n body: new ReadableStream(),\n method: 'POST',\n get duplex() {\n duplexAccessed = true;\n return 'half';\n },\n }).headers.has('Content-Type');\n\n return duplexAccessed && !hasContentType;\n})();\n\nconst DEFAULT_CHUNK_SIZE = 64 * 1024;\n\nconst supportsResponseStream = isReadableStreamSupported && !!(()=> {\n try {\n return utils.isReadableStream(new Response('').body);\n } catch(err) {\n // return undefined\n }\n})();\n\nconst resolvers = {\n stream: supportsResponseStream && ((res) => res.body)\n};\n\nisFetchSupported && (((res) => {\n ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {\n !resolvers[type] && (resolvers[type] = utils.isFunction(res[type]) ? (res) => res[type]() :\n (_, config) => {\n throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);\n })\n });\n})(new Response));\n\nconst getBodyLength = async (body) => {\n if (body == null) {\n return 0;\n }\n\n if(utils.isBlob(body)) {\n return body.size;\n }\n\n if(utils.isSpecCompliantForm(body)) {\n return (await new Request(body).arrayBuffer()).byteLength;\n }\n\n if(utils.isArrayBufferView(body)) {\n return body.byteLength;\n }\n\n if(utils.isURLSearchParams(body)) {\n body = body + '';\n }\n\n if(utils.isString(body)) {\n return (await encodeText(body)).byteLength;\n }\n}\n\nconst resolveBodyLength = async (headers, body) => {\n const length = utils.toFiniteNumber(headers.getContentLength());\n\n return length == null ? getBodyLength(body) : length;\n}\n\nexport default isFetchSupported && (async (config) => {\n let {\n url,\n method,\n data,\n signal,\n cancelToken,\n timeout,\n onDownloadProgress,\n onUploadProgress,\n responseType,\n headers,\n withCredentials = 'same-origin',\n fetchOptions\n } = resolveConfig(config);\n\n responseType = responseType ? (responseType + '').toLowerCase() : 'text';\n\n let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ?\n composeSignals([signal, cancelToken], timeout) : [];\n\n let finished, request;\n\n const onFinish = () => {\n !finished && setTimeout(() => {\n composedSignal && composedSignal.unsubscribe();\n });\n\n finished = true;\n }\n\n let requestContentLength;\n\n try {\n if (\n onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&\n (requestContentLength = await resolveBodyLength(headers, data)) !== 0\n ) {\n let _request = new Request(url, {\n method: 'POST',\n body: data,\n duplex: \"half\"\n });\n\n let contentTypeHeader;\n\n if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {\n headers.setContentType(contentTypeHeader)\n }\n\n if (_request.body) {\n data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(\n requestContentLength,\n progressEventReducer(onUploadProgress)\n ), null, encodeText);\n }\n }\n\n if (!utils.isString(withCredentials)) {\n withCredentials = withCredentials ? 'cors' : 'omit';\n }\n\n request = new Request(url, {\n ...fetchOptions,\n signal: composedSignal,\n method: method.toUpperCase(),\n headers: headers.normalize().toJSON(),\n body: data,\n duplex: \"half\",\n withCredentials\n });\n\n let response = await fetch(request);\n\n const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');\n\n if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {\n const options = {};\n\n ['status', 'statusText', 'headers'].forEach(prop => {\n options[prop] = response[prop];\n });\n\n const responseContentLength = utils.toFiniteNumber(response.headers.get('content-length'));\n\n response = new Response(\n trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(\n responseContentLength,\n progressEventReducer(onDownloadProgress, true)\n ), isStreamResponse && onFinish, encodeText),\n options\n );\n }\n\n responseType = responseType || 'text';\n\n let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](response, config);\n\n !isStreamResponse && onFinish();\n\n stopTimeout && stopTimeout();\n\n return await new Promise((resolve, reject) => {\n settle(resolve, reject, {\n data: responseData,\n headers: AxiosHeaders.from(response.headers),\n status: response.status,\n statusText: response.statusText,\n config,\n request\n })\n })\n } catch (err) {\n onFinish();\n\n if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {\n throw Object.assign(\n new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),\n {\n cause: err.cause || err\n }\n )\n }\n\n throw AxiosError.from(err, err && err.code, config, request);\n }\n});\n\n\n","import utils from './../utils.js';\nimport settle from './../core/settle.js';\nimport transitionalDefaults from '../defaults/transitional.js';\nimport AxiosError from '../core/AxiosError.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport parseProtocol from '../helpers/parseProtocol.js';\nimport platform from '../platform/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport progressEventReducer from '../helpers/progressEventReducer.js';\nimport resolveConfig from \"../helpers/resolveConfig.js\";\n\nconst isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';\n\nexport default isXHRAdapterSupported && function (config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n const _config = resolveConfig(config);\n let requestData = _config.data;\n const requestHeaders = AxiosHeaders.from(_config.headers).normalize();\n let {responseType} = _config;\n let onCanceled;\n function done() {\n if (_config.cancelToken) {\n _config.cancelToken.unsubscribe(onCanceled);\n }\n\n if (_config.signal) {\n _config.signal.removeEventListener('abort', onCanceled);\n }\n }\n\n let request = new XMLHttpRequest();\n\n request.open(_config.method.toUpperCase(), _config.url, true);\n\n // Set the request timeout in MS\n request.timeout = _config.timeout;\n\n function onloadend() {\n if (!request) {\n return;\n }\n // Prepare the response\n const responseHeaders = AxiosHeaders.from(\n 'getAllResponseHeaders' in request && request.getAllResponseHeaders()\n );\n const responseData = !responseType || responseType === 'text' || responseType === 'json' ?\n request.responseText : request.response;\n const response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config,\n request\n };\n\n settle(function _resolve(value) {\n resolve(value);\n done();\n }, function _reject(err) {\n reject(err);\n done();\n }, response);\n\n // Clean up request\n request = null;\n }\n\n if ('onloadend' in request) {\n // Use onloadend if available\n request.onloadend = onloadend;\n } else {\n // Listen for ready state to emulate onloadend\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n // readystate handler is calling before onerror or ontimeout handlers,\n // so we should call onloadend on the next 'tick'\n setTimeout(onloadend);\n };\n }\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';\n const transitional = _config.transitional || transitionalDefaults;\n if (_config.timeoutErrorMessage) {\n timeoutErrorMessage = _config.timeoutErrorMessage;\n }\n reject(new AxiosError(\n timeoutErrorMessage,\n transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,\n _config,\n request));\n\n // Clean up request\n request = null;\n };\n\n // Remove Content-Type if data is undefined\n requestData === undefined && requestHeaders.setContentType(null);\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {\n request.setRequestHeader(key, val);\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(_config.withCredentials)) {\n request.withCredentials = !!_config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (responseType && responseType !== 'json') {\n request.responseType = _config.responseType;\n }\n\n // Handle progress if needed\n if (typeof _config.onDownloadProgress === 'function') {\n request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true));\n }\n\n // Not all browsers support upload events\n if (typeof _config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress));\n }\n\n if (_config.cancelToken || _config.signal) {\n // Handle cancellation\n // eslint-disable-next-line func-names\n onCanceled = cancel => {\n if (!request) {\n return;\n }\n reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);\n request.abort();\n request = null;\n };\n\n _config.cancelToken && _config.cancelToken.subscribe(onCanceled);\n if (_config.signal) {\n _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);\n }\n }\n\n const protocol = parseProtocol(_config.url);\n\n if (protocol && platform.protocols.indexOf(protocol) === -1) {\n reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));\n return;\n }\n\n\n // Send the request\n request.send(requestData || null);\n });\n}\n","'use strict';\n\nexport default function parseProtocol(url) {\n const match = /^([-+\\w]{1,25})(:?\\/\\/|:)/.exec(url);\n return match && match[1] || '';\n}\n","import CanceledError from \"../cancel/CanceledError.js\";\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst composeSignals = (signals, timeout) => {\n let controller = new AbortController();\n\n let aborted;\n\n const onabort = function (cancel) {\n if (!aborted) {\n aborted = true;\n unsubscribe();\n const err = cancel instanceof Error ? cancel : this.reason;\n controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));\n }\n }\n\n let timer = timeout && setTimeout(() => {\n onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT))\n }, timeout)\n\n const unsubscribe = () => {\n if (signals) {\n timer && clearTimeout(timer);\n timer = null;\n signals.forEach(signal => {\n signal &&\n (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));\n });\n signals = null;\n }\n }\n\n signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort));\n\n const {signal} = controller;\n\n signal.unsubscribe = unsubscribe;\n\n return [signal, () => {\n timer && clearTimeout(timer);\n timer = null;\n }];\n}\n\nexport default composeSignals;\n","\n\nexport const streamChunk = function* (chunk, chunkSize) {\n let len = chunk.byteLength;\n\n if (!chunkSize || len < chunkSize) {\n yield chunk;\n return;\n }\n\n let pos = 0;\n let end;\n\n while (pos < len) {\n end = pos + chunkSize;\n yield chunk.slice(pos, end);\n pos = end;\n }\n}\n\nexport const readBytes = async function* (iterable, chunkSize, encode) {\n for await (const chunk of iterable) {\n yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);\n }\n}\n\nexport const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {\n const iterator = readBytes(stream, chunkSize, encode);\n\n let bytes = 0;\n\n return new ReadableStream({\n type: 'bytes',\n\n async pull(controller) {\n const {done, value} = await iterator.next();\n\n if (done) {\n controller.close();\n onFinish();\n return;\n }\n\n let len = value.byteLength;\n onProgress && onProgress(bytes += len);\n controller.enqueue(new Uint8Array(value));\n },\n cancel(reason) {\n onFinish(reason);\n return iterator.return();\n }\n }, {\n highWaterMark: 2\n })\n}\n","import utils from '../utils.js';\nimport httpAdapter from './http.js';\nimport xhrAdapter from './xhr.js';\nimport fetchAdapter from './fetch.js';\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst knownAdapters = {\n http: httpAdapter,\n xhr: xhrAdapter,\n fetch: fetchAdapter\n}\n\nutils.forEach(knownAdapters, (fn, value) => {\n if (fn) {\n try {\n Object.defineProperty(fn, 'name', {value});\n } catch (e) {\n // eslint-disable-next-line no-empty\n }\n Object.defineProperty(fn, 'adapterName', {value});\n }\n});\n\nconst renderReason = (reason) => `- ${reason}`;\n\nconst isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;\n\nexport default {\n getAdapter: (adapters) => {\n adapters = utils.isArray(adapters) ? adapters : [adapters];\n\n const {length} = adapters;\n let nameOrAdapter;\n let adapter;\n\n const rejectedReasons = {};\n\n for (let i = 0; i < length; i++) {\n nameOrAdapter = adapters[i];\n let id;\n\n adapter = nameOrAdapter;\n\n if (!isResolvedHandle(nameOrAdapter)) {\n adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];\n\n if (adapter === undefined) {\n throw new AxiosError(`Unknown adapter '${id}'`);\n }\n }\n\n if (adapter) {\n break;\n }\n\n rejectedReasons[id || '#' + i] = adapter;\n }\n\n if (!adapter) {\n\n const reasons = Object.entries(rejectedReasons)\n .map(([id, state]) => `adapter ${id} ` +\n (state === false ? 'is not supported by the environment' : 'is not available in the build')\n );\n\n let s = length ?\n (reasons.length > 1 ? 'since :\\n' + reasons.map(renderReason).join('\\n') : ' ' + renderReason(reasons[0])) :\n 'as no adapter specified';\n\n throw new AxiosError(\n `There is no suitable adapter to dispatch the request ` + s,\n 'ERR_NOT_SUPPORT'\n );\n }\n\n return adapter;\n },\n adapters: knownAdapters\n}\n","// eslint-disable-next-line strict\nexport default null;\n","'use strict';\n\nimport transformData from './transformData.js';\nimport isCancel from '../cancel/isCancel.js';\nimport defaults from '../defaults/index.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport adapters from \"../adapters/adapters.js\";\n\n/**\n * Throws a `CanceledError` if cancellation has been requested.\n *\n * @param {Object} config The config that is to be used for the request\n *\n * @returns {void}\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n\n if (config.signal && config.signal.aborted) {\n throw new CanceledError(null, config);\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n *\n * @returns {Promise} The Promise to be fulfilled\n */\nexport default function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n config.headers = AxiosHeaders.from(config.headers);\n\n // Transform request data\n config.data = transformData.call(\n config,\n config.transformRequest\n );\n\n if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {\n config.headers.setContentType('application/x-www-form-urlencoded', false);\n }\n\n const adapter = adapters.getAdapter(config.adapter || defaults.adapter);\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData.call(\n config,\n config.transformResponse,\n response\n );\n\n response.headers = AxiosHeaders.from(response.headers);\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData.call(\n config,\n config.transformResponse,\n reason.response\n );\n reason.response.headers = AxiosHeaders.from(reason.response.headers);\n }\n }\n\n return Promise.reject(reason);\n });\n}\n","export const VERSION = \"1.7.2\";","'use strict';\n\nimport {VERSION} from '../env/data.js';\nimport AxiosError from '../core/AxiosError.js';\n\nconst validators = {};\n\n// eslint-disable-next-line func-names\n['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {\n validators[type] = function validator(thing) {\n return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;\n };\n});\n\nconst deprecatedWarnings = {};\n\n/**\n * Transitional option validator\n *\n * @param {function|boolean?} validator - set to false if the transitional option has been removed\n * @param {string?} version - deprecated version / removed since version\n * @param {string?} message - some message with additional info\n *\n * @returns {function}\n */\nvalidators.transitional = function transitional(validator, version, message) {\n function formatMessage(opt, desc) {\n return '[Axios v' + VERSION + '] Transitional option \\'' + opt + '\\'' + desc + (message ? '. ' + message : '');\n }\n\n // eslint-disable-next-line func-names\n return (value, opt, opts) => {\n if (validator === false) {\n throw new AxiosError(\n formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),\n AxiosError.ERR_DEPRECATED\n );\n }\n\n if (version && !deprecatedWarnings[opt]) {\n deprecatedWarnings[opt] = true;\n // eslint-disable-next-line no-console\n console.warn(\n formatMessage(\n opt,\n ' has been deprecated since v' + version + ' and will be removed in the near future'\n )\n );\n }\n\n return validator ? validator(value, opt, opts) : true;\n };\n};\n\n/**\n * Assert object's properties type\n *\n * @param {object} options\n * @param {object} schema\n * @param {boolean?} allowUnknown\n *\n * @returns {object}\n */\n\nfunction assertOptions(options, schema, allowUnknown) {\n if (typeof options !== 'object') {\n throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);\n }\n const keys = Object.keys(options);\n let i = keys.length;\n while (i-- > 0) {\n const opt = keys[i];\n const validator = schema[opt];\n if (validator) {\n const value = options[opt];\n const result = value === undefined || validator(value, opt, options);\n if (result !== true) {\n throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);\n }\n continue;\n }\n if (allowUnknown !== true) {\n throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);\n }\n }\n}\n\nexport default {\n assertOptions,\n validators\n};\n","'use strict';\n\nimport utils from './../utils.js';\nimport buildURL from '../helpers/buildURL.js';\nimport InterceptorManager from './InterceptorManager.js';\nimport dispatchRequest from './dispatchRequest.js';\nimport mergeConfig from './mergeConfig.js';\nimport buildFullPath from './buildFullPath.js';\nimport validator from '../helpers/validator.js';\nimport AxiosHeaders from './AxiosHeaders.js';\n\nconst validators = validator.validators;\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n *\n * @return {Axios} A new instance of Axios\n */\nclass Axios {\n constructor(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n }\n\n /**\n * Dispatch a request\n *\n * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)\n * @param {?Object} config\n *\n * @returns {Promise} The Promise to be fulfilled\n */\n async request(configOrUrl, config) {\n try {\n return await this._request(configOrUrl, config);\n } catch (err) {\n if (err instanceof Error) {\n let dummy;\n\n Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());\n\n // slice off the Error: ... line\n const stack = dummy.stack ? dummy.stack.replace(/^.+\\n/, '') : '';\n try {\n if (!err.stack) {\n err.stack = stack;\n // match without the 2 top stack lines\n } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\\n.+\\n/, ''))) {\n err.stack += '\\n' + stack\n }\n } catch (e) {\n // ignore the case where \"stack\" is an un-writable property\n }\n }\n\n throw err;\n }\n }\n\n _request(configOrUrl, config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof configOrUrl === 'string') {\n config = config || {};\n config.url = configOrUrl;\n } else {\n config = configOrUrl || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n const {transitional, paramsSerializer, headers} = config;\n\n if (transitional !== undefined) {\n validator.assertOptions(transitional, {\n silentJSONParsing: validators.transitional(validators.boolean),\n forcedJSONParsing: validators.transitional(validators.boolean),\n clarifyTimeoutError: validators.transitional(validators.boolean)\n }, false);\n }\n\n if (paramsSerializer != null) {\n if (utils.isFunction(paramsSerializer)) {\n config.paramsSerializer = {\n serialize: paramsSerializer\n }\n } else {\n validator.assertOptions(paramsSerializer, {\n encode: validators.function,\n serialize: validators.function\n }, true);\n }\n }\n\n // Set config.method\n config.method = (config.method || this.defaults.method || 'get').toLowerCase();\n\n // Flatten headers\n let contextHeaders = headers && utils.merge(\n headers.common,\n headers[config.method]\n );\n\n headers && utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n (method) => {\n delete headers[method];\n }\n );\n\n config.headers = AxiosHeaders.concat(contextHeaders, headers);\n\n // filter out skipped interceptors\n const requestInterceptorChain = [];\n let synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n const responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n let promise;\n let i = 0;\n let len;\n\n if (!synchronousRequestInterceptors) {\n const chain = [dispatchRequest.bind(this), undefined];\n chain.unshift.apply(chain, requestInterceptorChain);\n chain.push.apply(chain, responseInterceptorChain);\n len = chain.length;\n\n promise = Promise.resolve(config);\n\n while (i < len) {\n promise = promise.then(chain[i++], chain[i++]);\n }\n\n return promise;\n }\n\n len = requestInterceptorChain.length;\n\n let newConfig = config;\n\n i = 0;\n\n while (i < len) {\n const onFulfilled = requestInterceptorChain[i++];\n const onRejected = requestInterceptorChain[i++];\n try {\n newConfig = onFulfilled(newConfig);\n } catch (error) {\n onRejected.call(this, error);\n break;\n }\n }\n\n try {\n promise = dispatchRequest.call(this, newConfig);\n } catch (error) {\n return Promise.reject(error);\n }\n\n i = 0;\n len = responseInterceptorChain.length;\n\n while (i < len) {\n promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);\n }\n\n return promise;\n }\n\n getUri(config) {\n config = mergeConfig(this.defaults, config);\n const fullPath = buildFullPath(config.baseURL, config.url);\n return buildURL(fullPath, config.params, config.paramsSerializer);\n }\n}\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n\n function generateHTTPMethod(isForm) {\n return function httpMethod(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n headers: isForm ? {\n 'Content-Type': 'multipart/form-data'\n } : {},\n url,\n data\n }));\n };\n }\n\n Axios.prototype[method] = generateHTTPMethod();\n\n Axios.prototype[method + 'Form'] = generateHTTPMethod(true);\n});\n\nexport default Axios;\n","'use strict';\n\nimport CanceledError from './CanceledError.js';\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @param {Function} executor The executor function.\n *\n * @returns {CancelToken}\n */\nclass CancelToken {\n constructor(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n let resolvePromise;\n\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n const token = this;\n\n // eslint-disable-next-line func-names\n this.promise.then(cancel => {\n if (!token._listeners) return;\n\n let i = token._listeners.length;\n\n while (i-- > 0) {\n token._listeners[i](cancel);\n }\n token._listeners = null;\n });\n\n // eslint-disable-next-line func-names\n this.promise.then = onfulfilled => {\n let _resolve;\n // eslint-disable-next-line func-names\n const promise = new Promise(resolve => {\n token.subscribe(resolve);\n _resolve = resolve;\n }).then(onfulfilled);\n\n promise.cancel = function reject() {\n token.unsubscribe(_resolve);\n };\n\n return promise;\n };\n\n executor(function cancel(message, config, request) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new CanceledError(message, config, request);\n resolvePromise(token.reason);\n });\n }\n\n /**\n * Throws a `CanceledError` if cancellation has been requested.\n */\n throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n }\n\n /**\n * Subscribe to the cancel signal\n */\n\n subscribe(listener) {\n if (this.reason) {\n listener(this.reason);\n return;\n }\n\n if (this._listeners) {\n this._listeners.push(listener);\n } else {\n this._listeners = [listener];\n }\n }\n\n /**\n * Unsubscribe from the cancel signal\n */\n\n unsubscribe(listener) {\n if (!this._listeners) {\n return;\n }\n const index = this._listeners.indexOf(listener);\n if (index !== -1) {\n this._listeners.splice(index, 1);\n }\n }\n\n /**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\n static source() {\n let cancel;\n const token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token,\n cancel\n };\n }\n}\n\nexport default CancelToken;\n","const HttpStatusCode = {\n Continue: 100,\n SwitchingProtocols: 101,\n Processing: 102,\n EarlyHints: 103,\n Ok: 200,\n Created: 201,\n Accepted: 202,\n NonAuthoritativeInformation: 203,\n NoContent: 204,\n ResetContent: 205,\n PartialContent: 206,\n MultiStatus: 207,\n AlreadyReported: 208,\n ImUsed: 226,\n MultipleChoices: 300,\n MovedPermanently: 301,\n Found: 302,\n SeeOther: 303,\n NotModified: 304,\n UseProxy: 305,\n Unused: 306,\n TemporaryRedirect: 307,\n PermanentRedirect: 308,\n BadRequest: 400,\n Unauthorized: 401,\n PaymentRequired: 402,\n Forbidden: 403,\n NotFound: 404,\n MethodNotAllowed: 405,\n NotAcceptable: 406,\n ProxyAuthenticationRequired: 407,\n RequestTimeout: 408,\n Conflict: 409,\n Gone: 410,\n LengthRequired: 411,\n PreconditionFailed: 412,\n PayloadTooLarge: 413,\n UriTooLong: 414,\n UnsupportedMediaType: 415,\n RangeNotSatisfiable: 416,\n ExpectationFailed: 417,\n ImATeapot: 418,\n MisdirectedRequest: 421,\n UnprocessableEntity: 422,\n Locked: 423,\n FailedDependency: 424,\n TooEarly: 425,\n UpgradeRequired: 426,\n PreconditionRequired: 428,\n TooManyRequests: 429,\n RequestHeaderFieldsTooLarge: 431,\n UnavailableForLegalReasons: 451,\n InternalServerError: 500,\n NotImplemented: 501,\n BadGateway: 502,\n ServiceUnavailable: 503,\n GatewayTimeout: 504,\n HttpVersionNotSupported: 505,\n VariantAlsoNegotiates: 506,\n InsufficientStorage: 507,\n LoopDetected: 508,\n NotExtended: 510,\n NetworkAuthenticationRequired: 511,\n};\n\nObject.entries(HttpStatusCode).forEach(([key, value]) => {\n HttpStatusCode[value] = key;\n});\n\nexport default HttpStatusCode;\n","'use strict';\n\nimport utils from './utils.js';\nimport bind from './helpers/bind.js';\nimport Axios from './core/Axios.js';\nimport mergeConfig from './core/mergeConfig.js';\nimport defaults from './defaults/index.js';\nimport formDataToJSON from './helpers/formDataToJSON.js';\nimport CanceledError from './cancel/CanceledError.js';\nimport CancelToken from './cancel/CancelToken.js';\nimport isCancel from './cancel/isCancel.js';\nimport {VERSION} from './env/data.js';\nimport toFormData from './helpers/toFormData.js';\nimport AxiosError from './core/AxiosError.js';\nimport spread from './helpers/spread.js';\nimport isAxiosError from './helpers/isAxiosError.js';\nimport AxiosHeaders from \"./core/AxiosHeaders.js\";\nimport adapters from './adapters/adapters.js';\nimport HttpStatusCode from './helpers/HttpStatusCode.js';\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n *\n * @returns {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n const context = new Axios(defaultConfig);\n const instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});\n\n // Copy context to instance\n utils.extend(instance, context, null, {allOwnKeys: true});\n\n // Factory for creating new instances\n instance.create = function create(instanceConfig) {\n return createInstance(mergeConfig(defaultConfig, instanceConfig));\n };\n\n return instance;\n}\n\n// Create the default instance to be exported\nconst axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Expose Cancel & CancelToken\naxios.CanceledError = CanceledError;\naxios.CancelToken = CancelToken;\naxios.isCancel = isCancel;\naxios.VERSION = VERSION;\naxios.toFormData = toFormData;\n\n// Expose AxiosError class\naxios.AxiosError = AxiosError;\n\n// alias for CanceledError for backward compatibility\naxios.Cancel = axios.CanceledError;\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\n\naxios.spread = spread;\n\n// Expose isAxiosError\naxios.isAxiosError = isAxiosError;\n\n// Expose mergeConfig\naxios.mergeConfig = mergeConfig;\n\naxios.AxiosHeaders = AxiosHeaders;\n\naxios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);\n\naxios.getAdapter = adapters.getAdapter;\n\naxios.HttpStatusCode = HttpStatusCode;\n\naxios.default = axios;\n\n// this module should only have a default export\nexport default axios\n","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n *\n * @returns {Function}\n */\nexport default function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n *\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nexport default function isAxiosError(payload) {\n return utils.isObject(payload) && (payload.isAxiosError === true);\n}\n"],"names":["bind","fn","thisArg","apply","arguments","cache","toString","Object","prototype","getPrototypeOf","kindOf","create","thing","str","call","slice","toLowerCase","kindOfTest","type","typeOfTest","_typeof","isArray","Array","isUndefined","isArrayBuffer","isString","isFunction","isNumber","isObject","isPlainObject","val","Symbol","toStringTag","iterator","isDate","isFile","isBlob","isFileList","isURLSearchParams","_map2","_slicedToArray","map","isReadableStream","isRequest","isResponse","isHeaders","forEach","obj","i","l","_ref","length","undefined","_ref$allOwnKeys","allOwnKeys","key","keys","getOwnPropertyNames","len","findKey","_key","_global","globalThis","self","window","global","isContextDefined","context","TypedArray","isTypedArray","Uint8Array","isHTMLForm","hasOwnProperty","_ref4","prop","isRegExp","reduceDescriptors","reducer","descriptors","getOwnPropertyDescriptors","reducedDescriptors","descriptor","name","ret","defineProperties","ALPHA","DIGIT","ALPHABET","ALPHA_DIGIT","toUpperCase","isAsyncFn","utils$1","isBuffer","constructor","isFormData","kind","FormData","append","isArrayBufferView","ArrayBuffer","isView","buffer","isBoolean","isStream","pipe","merge","_ref2","this","caseless","result","assignValue","targetKey","extend","a","b","_ref3","trim","replace","stripBOM","content","charCodeAt","inherits","superConstructor","props","defineProperty","value","assign","toFlatObject","sourceObj","destObj","filter","propFilter","merged","endsWith","searchString","position","String","lastIndex","indexOf","toArray","arr","forEachEntry","next","done","pair","matchAll","regExp","matches","exec","push","hasOwnProp","freezeMethods","enumerable","writable","set","Error","toObjectSet","arrayOrString","delimiter","define","split","toCamelCase","m","p1","p2","noop","toFiniteNumber","defaultValue","Number","isFinite","generateString","size","alphabet","Math","random","isSpecCompliantForm","toJSONObject","stack","visit","source","target","reducedValue","isThenable","then","AxiosError","message","code","config","request","response","captureStackTrace","utils","toJSON","description","number","fileName","lineNumber","columnNumber","status","from","error","customProps","axiosError","cause","isVisitable","removeBrackets","renderKey","path","dots","concat","token","join","predicates","test","toFormData","formData","options","TypeError","metaTokens","indexes","option","visitor","defaultVisitor","useBlob","Blob","convertValue","toISOString","Buffer","JSON","stringify","some","isFlatArray","el","index","exposedHelpers","build","pop","encode","charMap","encodeURIComponent","match","AxiosURLSearchParams","params","_pairs","buildURL","url","serializedParams","_encode","serializeFn","serialize","hashmarkIndex","encoder","product","InterceptorManager$1","InterceptorManager","_classCallCheck","handlers","_createClass","fulfilled","rejected","synchronous","runWhen","id","h","transitionalDefaults","silentJSONParsing","forcedJSONParsing","clarifyTimeoutError","platform$1","isBrowser","classes","URLSearchParams","protocols","hasBrowserEnv","document","hasStandardBrowserEnv","navigator","hasStandardBrowserWebWorkerEnv","WorkerGlobalScope","importScripts","origin","location","href","_objectSpread","platform","formDataToJSON","buildPath","isNumericKey","isLast","arrayToObject","entries","parsePropPath","defaults","transitional","adapter","transformRequest","data","headers","contentType","getContentType","hasJSONContentType","isObjectPayload","setContentType","helpers","isNode","toURLEncodedForm","formSerializer","_FormData","env","rawValue","parser","parse","e","stringifySafely","transformResponse","JSONRequested","responseType","strictJSONParsing","ERR_BAD_RESPONSE","timeout","xsrfCookieName","xsrfHeaderName","maxContentLength","maxBodyLength","validateStatus","common","Accept","method","defaults$1","ignoreDuplicateOf","$internals","normalizeHeader","header","normalizeValue","matchHeaderValue","isHeaderNameFilter","AxiosHeaders","_Symbol$iterator","_Symbol$toStringTag","valueOrRewrite","rewrite","setHeader","_value","_header","_rewrite","lHeader","setHeaders","rawHeaders","parsed","line","substring","parseHeaders","_step","_iterator","_createForOfIteratorHelper","s","n","_step$value","err","f","tokens","tokensRE","parseTokens","matcher","deleted","deleteHeader","format","normalized","w","char","formatHeader","_this$constructor","_len","targets","asStrings","get","first","computed","_len2","_key2","accessors","defineAccessor","accessorName","methodName","arg1","arg2","arg3","configurable","buildAccessors","accessor","mapped","headerValue","AxiosHeaders$1","transformData","fns","normalize","isCancel","__CANCEL__","CanceledError","ERR_CANCELED","settle","resolve","reject","ERR_BAD_REQUEST","floor","speedometer","samplesCount","min","firstSampleTS","bytes","timestamps","head","tail","chunkLength","now","Date","startedAt","bytesCount","passed","round","throttle","freq","timestamp","threshold","timer","_arguments","force","clearTimeout","setTimeout","progressEventReducer","listener","isDownloadStream","bytesNotified","_speedometer","loaded","total","lengthComputable","progressBytes","rate","progress","estimated","event","originURL","msie","userAgent","urlParsingNode","createElement","resolveURL","setAttribute","protocol","host","search","hash","hostname","port","pathname","charAt","requestURL","write","expires","domain","secure","cookie","toGMTString","read","RegExp","decodeURIComponent","remove","buildFullPath","baseURL","requestedURL","relativeURL","combineURLs","headersToObject","mergeConfig","config1","config2","getMergedValue","mergeDeepProperties","valueFromConfig2","defaultToConfig2","mergeDirectKeys","mergeMap","paramsSerializer","timeoutMessage","withCredentials","withXSRFToken","onUploadProgress","onDownloadProgress","decompress","beforeRedirect","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding","configValue","duplexAccessed","hasContentType","res","resolveConfig","newConfig","auth","btoa","username","password","unescape","Boolean","_toConsumableArray","isURLSameOrigin","xsrfValue","cookies","xhrAdapter","XMLHttpRequest","Promise","onCanceled","_config","requestData","requestHeaders","unsubscribe","signal","removeEventListener","onloadend","responseHeaders","getAllResponseHeaders","responseText","statusText","open","onreadystatechange","readyState","responseURL","onabort","ECONNABORTED","onerror","ERR_NETWORK","ontimeout","timeoutErrorMessage","ETIMEDOUT","setRequestHeader","addEventListener","upload","cancel","abort","subscribe","aborted","send","composeSignals$1","signals","controller","AbortController","reason","streamChunk","_regeneratorRuntime","mark","chunk","chunkSize","pos","end","wrap","_context","prev","byteLength","abrupt","stop","readBytes","_callee","iterable","_iteratorAbruptCompletion","_didIteratorError","_iteratorError","_context2","_asyncIterator","_awaitAsyncGenerator","sent","t0","_asyncGeneratorDelegate","t1","t2","t3","t4","t5","t6","t7","t8","delegateYield","t10","finish","_x","_x2","_x3","trackStream","stream","onProgress","onFinish","ReadableStream","pull","_asyncToGenerator","_callee2","_yield$iterator$next","_context3","close","enqueue","highWaterMark","fetchProgressDecorator","isFetchSupported","fetch","Request","Response","isReadableStreamSupported","encodeText","TextEncoder","arrayBuffer","supportsRequestStream","body","duplex","has","supportsResponseStream","resolvers","_","ERR_NOT_SUPPORT","getBodyLength","resolveBodyLength","_callee3","getContentLength","_x4","_callee4","_resolveConfig","_resolveConfig$withCr","fetchOptions","_ref5","_ref6","composedSignal","stopTimeout","finished","requestContentLength","_request","contentTypeHeader","isStreamResponse","responseContentLength","responseData","_context4","composeSignals","_x5","knownAdapters","http","xhr","fetchAdapter","renderReason","isResolvedHandle","adapters","nameOrAdapter","rejectedReasons","reasons","state","throwIfCancellationRequested","throwIfRequested","dispatchRequest","VERSION","validators","deprecatedWarnings","validators$1","validator","version","formatMessage","opt","desc","opts","ERR_DEPRECATED","console","warn","assertOptions","schema","allowUnknown","ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","Axios","instanceConfig","interceptors","_request2","configOrUrl","dummy","contextHeaders","requestInterceptorChain","synchronousRequestInterceptors","interceptor","unshift","promise","responseInterceptorChain","chain","onFulfilled","onRejected","generateHTTPMethod","isForm","Axios$1","CancelToken$1","CancelToken","executor","resolvePromise","_listeners","onfulfilled","_resolve","splice","c","HttpStatusCode","Continue","SwitchingProtocols","Processing","EarlyHints","Ok","Created","Accepted","NonAuthoritativeInformation","NoContent","ResetContent","PartialContent","MultiStatus","AlreadyReported","ImUsed","MultipleChoices","MovedPermanently","Found","SeeOther","NotModified","UseProxy","Unused","TemporaryRedirect","PermanentRedirect","BadRequest","Unauthorized","PaymentRequired","Forbidden","NotFound","MethodNotAllowed","NotAcceptable","ProxyAuthenticationRequired","RequestTimeout","Conflict","Gone","LengthRequired","PreconditionFailed","PayloadTooLarge","UriTooLong","UnsupportedMediaType","RangeNotSatisfiable","ExpectationFailed","ImATeapot","MisdirectedRequest","UnprocessableEntity","Locked","FailedDependency","TooEarly","UpgradeRequired","PreconditionRequired","TooManyRequests","RequestHeaderFieldsTooLarge","UnavailableForLegalReasons","InternalServerError","NotImplemented","BadGateway","ServiceUnavailable","GatewayTimeout","HttpVersionNotSupported","VariantAlsoNegotiates","InsufficientStorage","LoopDetected","NotExtended","NetworkAuthenticationRequired","HttpStatusCode$1","axios","createInstance","defaultConfig","instance","Cancel","all","promises","spread","callback","isAxiosError","payload","formToJSON","getAdapter"],"mappings":"i1XAEe,SAASA,EAAKC,EAAIC,GAC/B,OAAO,WACL,OAAOD,EAAGE,MAAMD,EAASE,WAE7B,mSCAA,IAGgBC,EAHTC,EAAYC,OAAOC,UAAnBF,SACAG,EAAkBF,OAAlBE,eAEDC,GAAUL,EAGbE,OAAOI,OAAO,MAHQ,SAAAC,GACrB,IAAMC,EAAMP,EAASQ,KAAKF,GAC1B,OAAOP,EAAMQ,KAASR,EAAMQ,GAAOA,EAAIE,MAAM,GAAI,GAAGC,iBAGlDC,EAAa,SAACC,GAElB,OADAA,EAAOA,EAAKF,cACL,SAACJ,GAAK,OAAKF,EAAOE,KAAWM,CAAI,CAC1C,EAEMC,EAAa,SAAAD,GAAI,OAAI,SAAAN,GAAK,OAAIQ,EAAOR,KAAUM,CAAI,CAAA,EASlDG,EAAWC,MAAXD,QASDE,EAAcJ,EAAW,aAqB/B,IAAMK,EAAgBP,EAAW,eA2BjC,IAAMQ,EAAWN,EAAW,UAQtBO,EAAaP,EAAW,YASxBQ,EAAWR,EAAW,UAStBS,EAAW,SAAChB,GAAK,OAAe,OAAVA,GAAmC,WAAjBQ,EAAOR,EAAkB,EAiBjEiB,EAAgB,SAACC,GACrB,GAAoB,WAAhBpB,EAAOoB,GACT,OAAO,EAGT,IAAMtB,EAAYC,EAAeqB,GACjC,QAAsB,OAAdtB,GAAsBA,IAAcD,OAAOC,WAAkD,OAArCD,OAAOE,eAAeD,IAA0BuB,OAAOC,eAAeF,GAAUC,OAAOE,YAAYH,EACrK,EASMI,EAASjB,EAAW,QASpBkB,EAASlB,EAAW,QASpBmB,EAASnB,EAAW,QASpBoB,EAAapB,EAAW,YAsCxBqB,EAAoBrB,EAAW,mBAE4FsB,EAAAC,EAApE,CAAC,iBAAkB,UAAW,WAAY,WAAWC,IAAIxB,GAAW,GAA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S,SAAgB0pB,GAChC,OAAO6F,EAAexS,GAAYyS,EAAe9F,KAG5C+F,CACT,CAGcF,CAAe9d,WAG7B6d,GAAM7F,MAAQA,GAGd6F,GAAMnX,cAAgBA,GACtBmX,GAAMzE,YAAcA,GACpByE,GAAMrX,SAAWA,GACjBqX,GAAM/G,QAAUA,GAChB+G,GAAM3iB,WAAaA,GAGnB2iB,GAAMzkB,WAAaA,GAGnBykB,GAAMI,OAASJ,GAAMnX,cAGrBmX,GAAMK,IAAM,SAAaC,GACvB,OAAOpQ,QAAQmQ,IAAIC,EACrB,EAEAN,GAAMO,OC9CS,SAAgBC,GAC7B,OAAO,SAAc7nB,GACnB,OAAO6nB,EAAStwB,MAAM,KAAMyI,GAEhC,ED6CAqnB,GAAMS,aE7DS,SAAsBC,GACnC,OAAO5kB,GAAMnK,SAAS+uB,KAAsC,IAAzBA,EAAQD,YAC7C,EF8DAT,GAAMvS,YAAcA,GAEpBuS,GAAMjb,aAAeA,GAErBib,GAAMW,WAAa,SAAAhwB,GAAK,OAAIiR,GAAe9F,GAAMxH,WAAW3D,GAAS,IAAIoF,SAASpF,GAASA,EAAM,EAEjGqvB,GAAMY,WAAanI,GAEnBuH,GAAMjE,eAAiBA,GAEvBiE,GAAK,QAAWA"} \ No newline at end of file diff --git a/project starter code/node_modules/axios/dist/browser/axios.cjs b/project starter code/node_modules/axios/dist/browser/axios.cjs new file mode 100644 index 00000000..6936d242 --- /dev/null +++ b/project starter code/node_modules/axios/dist/browser/axios.cjs @@ -0,0 +1,3638 @@ +// Axios v1.7.2 Copyright (c) 2024 Matt Zabriskie and contributors +'use strict'; + +function bind(fn, thisArg) { + return function wrap() { + return fn.apply(thisArg, arguments); + }; +} + +// utils is a library of generic helper functions non-specific to axios + +const {toString} = Object.prototype; +const {getPrototypeOf} = Object; + +const kindOf = (cache => thing => { + const str = toString.call(thing); + return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase()); +})(Object.create(null)); + +const kindOfTest = (type) => { + type = type.toLowerCase(); + return (thing) => kindOf(thing) === type +}; + +const typeOfTest = type => thing => typeof thing === type; + +/** + * Determine if a value is an Array + * + * @param {Object} val The value to test + * + * @returns {boolean} True if value is an Array, otherwise false + */ +const {isArray} = Array; + +/** + * Determine if a value is undefined + * + * @param {*} val The value to test + * + * @returns {boolean} True if the value is undefined, otherwise false + */ +const isUndefined = typeOfTest('undefined'); + +/** + * Determine if a value is a Buffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Buffer, otherwise false + */ +function isBuffer(val) { + return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) + && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val); +} + +/** + * Determine if a value is an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is an ArrayBuffer, otherwise false + */ +const isArrayBuffer = kindOfTest('ArrayBuffer'); + + +/** + * Determine if a value is a view on an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false + */ +function isArrayBufferView(val) { + let result; + if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { + result = ArrayBuffer.isView(val); + } else { + result = (val) && (val.buffer) && (isArrayBuffer(val.buffer)); + } + return result; +} + +/** + * Determine if a value is a String + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a String, otherwise false + */ +const isString = typeOfTest('string'); + +/** + * Determine if a value is a Function + * + * @param {*} val The value to test + * @returns {boolean} True if value is a Function, otherwise false + */ +const isFunction = typeOfTest('function'); + +/** + * Determine if a value is a Number + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Number, otherwise false + */ +const isNumber = typeOfTest('number'); + +/** + * Determine if a value is an Object + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an Object, otherwise false + */ +const isObject = (thing) => thing !== null && typeof thing === 'object'; + +/** + * Determine if a value is a Boolean + * + * @param {*} thing The value to test + * @returns {boolean} True if value is a Boolean, otherwise false + */ +const isBoolean = thing => thing === true || thing === false; + +/** + * Determine if a value is a plain Object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a plain Object, otherwise false + */ +const isPlainObject = (val) => { + if (kindOf(val) !== 'object') { + return false; + } + + const prototype = getPrototypeOf(val); + return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val); +}; + +/** + * Determine if a value is a Date + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Date, otherwise false + */ +const isDate = kindOfTest('Date'); + +/** + * Determine if a value is a File + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ +const isFile = kindOfTest('File'); + +/** + * Determine if a value is a Blob + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Blob, otherwise false + */ +const isBlob = kindOfTest('Blob'); + +/** + * Determine if a value is a FileList + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ +const isFileList = kindOfTest('FileList'); + +/** + * Determine if a value is a Stream + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Stream, otherwise false + */ +const isStream = (val) => isObject(val) && isFunction(val.pipe); + +/** + * Determine if a value is a FormData + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an FormData, otherwise false + */ +const isFormData = (thing) => { + let kind; + return thing && ( + (typeof FormData === 'function' && thing instanceof FormData) || ( + isFunction(thing.append) && ( + (kind = kindOf(thing)) === 'formdata' || + // detect form-data instance + (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]') + ) + ) + ) +}; + +/** + * Determine if a value is a URLSearchParams object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a URLSearchParams object, otherwise false + */ +const isURLSearchParams = kindOfTest('URLSearchParams'); + +const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest); + +/** + * Trim excess whitespace off the beginning and end of a string + * + * @param {String} str The String to trim + * + * @returns {String} The String freed of excess whitespace + */ +const trim = (str) => str.trim ? + str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + +/** + * Iterate over an Array or an Object invoking a function for each item. + * + * If `obj` is an Array callback will be called passing + * the value, index, and complete array for each item. + * + * If 'obj' is an Object callback will be called passing + * the value, key, and complete object for each property. + * + * @param {Object|Array} obj The object to iterate + * @param {Function} fn The callback to invoke for each item + * + * @param {Boolean} [allOwnKeys = false] + * @returns {any} + */ +function forEach(obj, fn, {allOwnKeys = false} = {}) { + // Don't bother if no value provided + if (obj === null || typeof obj === 'undefined') { + return; + } + + let i; + let l; + + // Force an array if not already something iterable + if (typeof obj !== 'object') { + /*eslint no-param-reassign:0*/ + obj = [obj]; + } + + if (isArray(obj)) { + // Iterate over array values + for (i = 0, l = obj.length; i < l; i++) { + fn.call(null, obj[i], i, obj); + } + } else { + // Iterate over object keys + const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj); + const len = keys.length; + let key; + + for (i = 0; i < len; i++) { + key = keys[i]; + fn.call(null, obj[key], key, obj); + } + } +} + +function findKey(obj, key) { + key = key.toLowerCase(); + const keys = Object.keys(obj); + let i = keys.length; + let _key; + while (i-- > 0) { + _key = keys[i]; + if (key === _key.toLowerCase()) { + return _key; + } + } + return null; +} + +const _global = (() => { + /*eslint no-undef:0*/ + if (typeof globalThis !== "undefined") return globalThis; + return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global) +})(); + +const isContextDefined = (context) => !isUndefined(context) && context !== _global; + +/** + * Accepts varargs expecting each argument to be an object, then + * immutably merges the properties of each object and returns result. + * + * When multiple objects contain the same key the later object in + * the arguments list will take precedence. + * + * Example: + * + * ```js + * var result = merge({foo: 123}, {foo: 456}); + * console.log(result.foo); // outputs 456 + * ``` + * + * @param {Object} obj1 Object to merge + * + * @returns {Object} Result of all merge properties + */ +function merge(/* obj1, obj2, obj3, ... */) { + const {caseless} = isContextDefined(this) && this || {}; + const result = {}; + const assignValue = (val, key) => { + const targetKey = caseless && findKey(result, key) || key; + if (isPlainObject(result[targetKey]) && isPlainObject(val)) { + result[targetKey] = merge(result[targetKey], val); + } else if (isPlainObject(val)) { + result[targetKey] = merge({}, val); + } else if (isArray(val)) { + result[targetKey] = val.slice(); + } else { + result[targetKey] = val; + } + }; + + for (let i = 0, l = arguments.length; i < l; i++) { + arguments[i] && forEach(arguments[i], assignValue); + } + return result; +} + +/** + * Extends object a by mutably adding to it the properties of object b. + * + * @param {Object} a The object to be extended + * @param {Object} b The object to copy properties from + * @param {Object} thisArg The object to bind function to + * + * @param {Boolean} [allOwnKeys] + * @returns {Object} The resulting value of object a + */ +const extend = (a, b, thisArg, {allOwnKeys}= {}) => { + forEach(b, (val, key) => { + if (thisArg && isFunction(val)) { + a[key] = bind(val, thisArg); + } else { + a[key] = val; + } + }, {allOwnKeys}); + return a; +}; + +/** + * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) + * + * @param {string} content with BOM + * + * @returns {string} content value without BOM + */ +const stripBOM = (content) => { + if (content.charCodeAt(0) === 0xFEFF) { + content = content.slice(1); + } + return content; +}; + +/** + * Inherit the prototype methods from one constructor into another + * @param {function} constructor + * @param {function} superConstructor + * @param {object} [props] + * @param {object} [descriptors] + * + * @returns {void} + */ +const inherits = (constructor, superConstructor, props, descriptors) => { + constructor.prototype = Object.create(superConstructor.prototype, descriptors); + constructor.prototype.constructor = constructor; + Object.defineProperty(constructor, 'super', { + value: superConstructor.prototype + }); + props && Object.assign(constructor.prototype, props); +}; + +/** + * Resolve object with deep prototype chain to a flat object + * @param {Object} sourceObj source object + * @param {Object} [destObj] + * @param {Function|Boolean} [filter] + * @param {Function} [propFilter] + * + * @returns {Object} + */ +const toFlatObject = (sourceObj, destObj, filter, propFilter) => { + let props; + let i; + let prop; + const merged = {}; + + destObj = destObj || {}; + // eslint-disable-next-line no-eq-null,eqeqeq + if (sourceObj == null) return destObj; + + do { + props = Object.getOwnPropertyNames(sourceObj); + i = props.length; + while (i-- > 0) { + prop = props[i]; + if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) { + destObj[prop] = sourceObj[prop]; + merged[prop] = true; + } + } + sourceObj = filter !== false && getPrototypeOf(sourceObj); + } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype); + + return destObj; +}; + +/** + * Determines whether a string ends with the characters of a specified string + * + * @param {String} str + * @param {String} searchString + * @param {Number} [position= 0] + * + * @returns {boolean} + */ +const endsWith = (str, searchString, position) => { + str = String(str); + if (position === undefined || position > str.length) { + position = str.length; + } + position -= searchString.length; + const lastIndex = str.indexOf(searchString, position); + return lastIndex !== -1 && lastIndex === position; +}; + + +/** + * Returns new array from array like object or null if failed + * + * @param {*} [thing] + * + * @returns {?Array} + */ +const toArray = (thing) => { + if (!thing) return null; + if (isArray(thing)) return thing; + let i = thing.length; + if (!isNumber(i)) return null; + const arr = new Array(i); + while (i-- > 0) { + arr[i] = thing[i]; + } + return arr; +}; + +/** + * Checking if the Uint8Array exists and if it does, it returns a function that checks if the + * thing passed in is an instance of Uint8Array + * + * @param {TypedArray} + * + * @returns {Array} + */ +// eslint-disable-next-line func-names +const isTypedArray = (TypedArray => { + // eslint-disable-next-line func-names + return thing => { + return TypedArray && thing instanceof TypedArray; + }; +})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array)); + +/** + * For each entry in the object, call the function with the key and value. + * + * @param {Object} obj - The object to iterate over. + * @param {Function} fn - The function to call for each entry. + * + * @returns {void} + */ +const forEachEntry = (obj, fn) => { + const generator = obj && obj[Symbol.iterator]; + + const iterator = generator.call(obj); + + let result; + + while ((result = iterator.next()) && !result.done) { + const pair = result.value; + fn.call(obj, pair[0], pair[1]); + } +}; + +/** + * It takes a regular expression and a string, and returns an array of all the matches + * + * @param {string} regExp - The regular expression to match against. + * @param {string} str - The string to search. + * + * @returns {Array} + */ +const matchAll = (regExp, str) => { + let matches; + const arr = []; + + while ((matches = regExp.exec(str)) !== null) { + arr.push(matches); + } + + return arr; +}; + +/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */ +const isHTMLForm = kindOfTest('HTMLFormElement'); + +const toCamelCase = str => { + return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, + function replacer(m, p1, p2) { + return p1.toUpperCase() + p2; + } + ); +}; + +/* Creating a function that will check if an object has a property. */ +const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype); + +/** + * Determine if a value is a RegExp object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a RegExp object, otherwise false + */ +const isRegExp = kindOfTest('RegExp'); + +const reduceDescriptors = (obj, reducer) => { + const descriptors = Object.getOwnPropertyDescriptors(obj); + const reducedDescriptors = {}; + + forEach(descriptors, (descriptor, name) => { + let ret; + if ((ret = reducer(descriptor, name, obj)) !== false) { + reducedDescriptors[name] = ret || descriptor; + } + }); + + Object.defineProperties(obj, reducedDescriptors); +}; + +/** + * Makes all methods read-only + * @param {Object} obj + */ + +const freezeMethods = (obj) => { + reduceDescriptors(obj, (descriptor, name) => { + // skip restricted props in strict mode + if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) { + return false; + } + + const value = obj[name]; + + if (!isFunction(value)) return; + + descriptor.enumerable = false; + + if ('writable' in descriptor) { + descriptor.writable = false; + return; + } + + if (!descriptor.set) { + descriptor.set = () => { + throw Error('Can not rewrite read-only method \'' + name + '\''); + }; + } + }); +}; + +const toObjectSet = (arrayOrString, delimiter) => { + const obj = {}; + + const define = (arr) => { + arr.forEach(value => { + obj[value] = true; + }); + }; + + isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter)); + + return obj; +}; + +const noop = () => {}; + +const toFiniteNumber = (value, defaultValue) => { + return value != null && Number.isFinite(value = +value) ? value : defaultValue; +}; + +const ALPHA = 'abcdefghijklmnopqrstuvwxyz'; + +const DIGIT = '0123456789'; + +const ALPHABET = { + DIGIT, + ALPHA, + ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT +}; + +const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => { + let str = ''; + const {length} = alphabet; + while (size--) { + str += alphabet[Math.random() * length|0]; + } + + return str; +}; + +/** + * If the thing is a FormData object, return true, otherwise return false. + * + * @param {unknown} thing - The thing to check. + * + * @returns {boolean} + */ +function isSpecCompliantForm(thing) { + return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]); +} + +const toJSONObject = (obj) => { + const stack = new Array(10); + + const visit = (source, i) => { + + if (isObject(source)) { + if (stack.indexOf(source) >= 0) { + return; + } + + if(!('toJSON' in source)) { + stack[i] = source; + const target = isArray(source) ? [] : {}; + + forEach(source, (value, key) => { + const reducedValue = visit(value, i + 1); + !isUndefined(reducedValue) && (target[key] = reducedValue); + }); + + stack[i] = undefined; + + return target; + } + } + + return source; + }; + + return visit(obj, 0); +}; + +const isAsyncFn = kindOfTest('AsyncFunction'); + +const isThenable = (thing) => + thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch); + +var utils$1 = { + isArray, + isArrayBuffer, + isBuffer, + isFormData, + isArrayBufferView, + isString, + isNumber, + isBoolean, + isObject, + isPlainObject, + isReadableStream, + isRequest, + isResponse, + isHeaders, + isUndefined, + isDate, + isFile, + isBlob, + isRegExp, + isFunction, + isStream, + isURLSearchParams, + isTypedArray, + isFileList, + forEach, + merge, + extend, + trim, + stripBOM, + inherits, + toFlatObject, + kindOf, + kindOfTest, + endsWith, + toArray, + forEachEntry, + matchAll, + isHTMLForm, + hasOwnProperty, + hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection + reduceDescriptors, + freezeMethods, + toObjectSet, + toCamelCase, + noop, + toFiniteNumber, + findKey, + global: _global, + isContextDefined, + ALPHABET, + generateString, + isSpecCompliantForm, + toJSONObject, + isAsyncFn, + isThenable +}; + +/** + * Create an Error with the specified message, config, error code, request and response. + * + * @param {string} message The error message. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [config] The config. + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * + * @returns {Error} The created error. + */ +function AxiosError(message, code, config, request, response) { + Error.call(this); + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } else { + this.stack = (new Error()).stack; + } + + this.message = message; + this.name = 'AxiosError'; + code && (this.code = code); + config && (this.config = config); + request && (this.request = request); + response && (this.response = response); +} + +utils$1.inherits(AxiosError, Error, { + toJSON: function toJSON() { + return { + // Standard + message: this.message, + name: this.name, + // Microsoft + description: this.description, + number: this.number, + // Mozilla + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + // Axios + config: utils$1.toJSONObject(this.config), + code: this.code, + status: this.response && this.response.status ? this.response.status : null + }; + } +}); + +const prototype$1 = AxiosError.prototype; +const descriptors = {}; + +[ + 'ERR_BAD_OPTION_VALUE', + 'ERR_BAD_OPTION', + 'ECONNABORTED', + 'ETIMEDOUT', + 'ERR_NETWORK', + 'ERR_FR_TOO_MANY_REDIRECTS', + 'ERR_DEPRECATED', + 'ERR_BAD_RESPONSE', + 'ERR_BAD_REQUEST', + 'ERR_CANCELED', + 'ERR_NOT_SUPPORT', + 'ERR_INVALID_URL' +// eslint-disable-next-line func-names +].forEach(code => { + descriptors[code] = {value: code}; +}); + +Object.defineProperties(AxiosError, descriptors); +Object.defineProperty(prototype$1, 'isAxiosError', {value: true}); + +// eslint-disable-next-line func-names +AxiosError.from = (error, code, config, request, response, customProps) => { + const axiosError = Object.create(prototype$1); + + utils$1.toFlatObject(error, axiosError, function filter(obj) { + return obj !== Error.prototype; + }, prop => { + return prop !== 'isAxiosError'; + }); + + AxiosError.call(axiosError, error.message, code, config, request, response); + + axiosError.cause = error; + + axiosError.name = error.name; + + customProps && Object.assign(axiosError, customProps); + + return axiosError; +}; + +// eslint-disable-next-line strict +var httpAdapter = null; + +/** + * Determines if the given thing is a array or js object. + * + * @param {string} thing - The object or array to be visited. + * + * @returns {boolean} + */ +function isVisitable(thing) { + return utils$1.isPlainObject(thing) || utils$1.isArray(thing); +} + +/** + * It removes the brackets from the end of a string + * + * @param {string} key - The key of the parameter. + * + * @returns {string} the key without the brackets. + */ +function removeBrackets(key) { + return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key; +} + +/** + * It takes a path, a key, and a boolean, and returns a string + * + * @param {string} path - The path to the current key. + * @param {string} key - The key of the current object being iterated over. + * @param {string} dots - If true, the key will be rendered with dots instead of brackets. + * + * @returns {string} The path to the current key. + */ +function renderKey(path, key, dots) { + if (!path) return key; + return path.concat(key).map(function each(token, i) { + // eslint-disable-next-line no-param-reassign + token = removeBrackets(token); + return !dots && i ? '[' + token + ']' : token; + }).join(dots ? '.' : ''); +} + +/** + * If the array is an array and none of its elements are visitable, then it's a flat array. + * + * @param {Array} arr - The array to check + * + * @returns {boolean} + */ +function isFlatArray(arr) { + return utils$1.isArray(arr) && !arr.some(isVisitable); +} + +const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) { + return /^is[A-Z]/.test(prop); +}); + +/** + * Convert a data object to FormData + * + * @param {Object} obj + * @param {?Object} [formData] + * @param {?Object} [options] + * @param {Function} [options.visitor] + * @param {Boolean} [options.metaTokens = true] + * @param {Boolean} [options.dots = false] + * @param {?Boolean} [options.indexes = false] + * + * @returns {Object} + **/ + +/** + * It converts an object into a FormData object + * + * @param {Object} obj - The object to convert to form data. + * @param {string} formData - The FormData object to append to. + * @param {Object} options + * + * @returns + */ +function toFormData(obj, formData, options) { + if (!utils$1.isObject(obj)) { + throw new TypeError('target must be an object'); + } + + // eslint-disable-next-line no-param-reassign + formData = formData || new (FormData)(); + + // eslint-disable-next-line no-param-reassign + options = utils$1.toFlatObject(options, { + metaTokens: true, + dots: false, + indexes: false + }, false, function defined(option, source) { + // eslint-disable-next-line no-eq-null,eqeqeq + return !utils$1.isUndefined(source[option]); + }); + + const metaTokens = options.metaTokens; + // eslint-disable-next-line no-use-before-define + const visitor = options.visitor || defaultVisitor; + const dots = options.dots; + const indexes = options.indexes; + const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob; + const useBlob = _Blob && utils$1.isSpecCompliantForm(formData); + + if (!utils$1.isFunction(visitor)) { + throw new TypeError('visitor must be a function'); + } + + function convertValue(value) { + if (value === null) return ''; + + if (utils$1.isDate(value)) { + return value.toISOString(); + } + + if (!useBlob && utils$1.isBlob(value)) { + throw new AxiosError('Blob is not supported. Use a Buffer instead.'); + } + + if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) { + return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value); + } + + return value; + } + + /** + * Default visitor. + * + * @param {*} value + * @param {String|Number} key + * @param {Array} path + * @this {FormData} + * + * @returns {boolean} return true to visit the each prop of the value recursively + */ + function defaultVisitor(value, key, path) { + let arr = value; + + if (value && !path && typeof value === 'object') { + if (utils$1.endsWith(key, '{}')) { + // eslint-disable-next-line no-param-reassign + key = metaTokens ? key : key.slice(0, -2); + // eslint-disable-next-line no-param-reassign + value = JSON.stringify(value); + } else if ( + (utils$1.isArray(value) && isFlatArray(value)) || + ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)) + )) { + // eslint-disable-next-line no-param-reassign + key = removeBrackets(key); + + arr.forEach(function each(el, index) { + !(utils$1.isUndefined(el) || el === null) && formData.append( + // eslint-disable-next-line no-nested-ternary + indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'), + convertValue(el) + ); + }); + return false; + } + } + + if (isVisitable(value)) { + return true; + } + + formData.append(renderKey(path, key, dots), convertValue(value)); + + return false; + } + + const stack = []; + + const exposedHelpers = Object.assign(predicates, { + defaultVisitor, + convertValue, + isVisitable + }); + + function build(value, path) { + if (utils$1.isUndefined(value)) return; + + if (stack.indexOf(value) !== -1) { + throw Error('Circular reference detected in ' + path.join('.')); + } + + stack.push(value); + + utils$1.forEach(value, function each(el, key) { + const result = !(utils$1.isUndefined(el) || el === null) && visitor.call( + formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers + ); + + if (result === true) { + build(el, path ? path.concat(key) : [key]); + } + }); + + stack.pop(); + } + + if (!utils$1.isObject(obj)) { + throw new TypeError('data must be an object'); + } + + build(obj); + + return formData; +} + +/** + * It encodes a string by replacing all characters that are not in the unreserved set with + * their percent-encoded equivalents + * + * @param {string} str - The string to encode. + * + * @returns {string} The encoded string. + */ +function encode$1(str) { + const charMap = { + '!': '%21', + "'": '%27', + '(': '%28', + ')': '%29', + '~': '%7E', + '%20': '+', + '%00': '\x00' + }; + return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) { + return charMap[match]; + }); +} + +/** + * It takes a params object and converts it to a FormData object + * + * @param {Object} params - The parameters to be converted to a FormData object. + * @param {Object} options - The options object passed to the Axios constructor. + * + * @returns {void} + */ +function AxiosURLSearchParams(params, options) { + this._pairs = []; + + params && toFormData(params, this, options); +} + +const prototype = AxiosURLSearchParams.prototype; + +prototype.append = function append(name, value) { + this._pairs.push([name, value]); +}; + +prototype.toString = function toString(encoder) { + const _encode = encoder ? function(value) { + return encoder.call(this, value, encode$1); + } : encode$1; + + return this._pairs.map(function each(pair) { + return _encode(pair[0]) + '=' + _encode(pair[1]); + }, '').join('&'); +}; + +/** + * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their + * URI encoded counterparts + * + * @param {string} val The value to be encoded. + * + * @returns {string} The encoded value. + */ +function encode(val) { + return encodeURIComponent(val). + replace(/%3A/gi, ':'). + replace(/%24/g, '$'). + replace(/%2C/gi, ','). + replace(/%20/g, '+'). + replace(/%5B/gi, '['). + replace(/%5D/gi, ']'); +} + +/** + * Build a URL by appending params to the end + * + * @param {string} url The base of the url (e.g., http://www.google.com) + * @param {object} [params] The params to be appended + * @param {?object} options + * + * @returns {string} The formatted url + */ +function buildURL(url, params, options) { + /*eslint no-param-reassign:0*/ + if (!params) { + return url; + } + + const _encode = options && options.encode || encode; + + const serializeFn = options && options.serialize; + + let serializedParams; + + if (serializeFn) { + serializedParams = serializeFn(params, options); + } else { + serializedParams = utils$1.isURLSearchParams(params) ? + params.toString() : + new AxiosURLSearchParams(params, options).toString(_encode); + } + + if (serializedParams) { + const hashmarkIndex = url.indexOf("#"); + + if (hashmarkIndex !== -1) { + url = url.slice(0, hashmarkIndex); + } + url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; + } + + return url; +} + +class InterceptorManager { + constructor() { + this.handlers = []; + } + + /** + * Add a new interceptor to the stack + * + * @param {Function} fulfilled The function to handle `then` for a `Promise` + * @param {Function} rejected The function to handle `reject` for a `Promise` + * + * @return {Number} An ID used to remove interceptor later + */ + use(fulfilled, rejected, options) { + this.handlers.push({ + fulfilled, + rejected, + synchronous: options ? options.synchronous : false, + runWhen: options ? options.runWhen : null + }); + return this.handlers.length - 1; + } + + /** + * Remove an interceptor from the stack + * + * @param {Number} id The ID that was returned by `use` + * + * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise + */ + eject(id) { + if (this.handlers[id]) { + this.handlers[id] = null; + } + } + + /** + * Clear all interceptors from the stack + * + * @returns {void} + */ + clear() { + if (this.handlers) { + this.handlers = []; + } + } + + /** + * Iterate over all the registered interceptors + * + * This method is particularly useful for skipping over any + * interceptors that may have become `null` calling `eject`. + * + * @param {Function} fn The function to call for each interceptor + * + * @returns {void} + */ + forEach(fn) { + utils$1.forEach(this.handlers, function forEachHandler(h) { + if (h !== null) { + fn(h); + } + }); + } +} + +var InterceptorManager$1 = InterceptorManager; + +var transitionalDefaults = { + silentJSONParsing: true, + forcedJSONParsing: true, + clarifyTimeoutError: false +}; + +var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams; + +var FormData$1 = typeof FormData !== 'undefined' ? FormData : null; + +var Blob$1 = typeof Blob !== 'undefined' ? Blob : null; + +var platform$1 = { + isBrowser: true, + classes: { + URLSearchParams: URLSearchParams$1, + FormData: FormData$1, + Blob: Blob$1 + }, + protocols: ['http', 'https', 'file', 'blob', 'url', 'data'] +}; + +const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined'; + +/** + * Determine if we're running in a standard browser environment + * + * This allows axios to run in a web worker, and react-native. + * Both environments support XMLHttpRequest, but not fully standard globals. + * + * web workers: + * typeof window -> undefined + * typeof document -> undefined + * + * react-native: + * navigator.product -> 'ReactNative' + * nativescript + * navigator.product -> 'NativeScript' or 'NS' + * + * @returns {boolean} + */ +const hasStandardBrowserEnv = ( + (product) => { + return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0 + })(typeof navigator !== 'undefined' && navigator.product); + +/** + * Determine if we're running in a standard browser webWorker environment + * + * Although the `isStandardBrowserEnv` method indicates that + * `allows axios to run in a web worker`, the WebWorker will still be + * filtered out due to its judgment standard + * `typeof window !== 'undefined' && typeof document !== 'undefined'`. + * This leads to a problem when axios post `FormData` in webWorker + */ +const hasStandardBrowserWebWorkerEnv = (() => { + return ( + typeof WorkerGlobalScope !== 'undefined' && + // eslint-disable-next-line no-undef + self instanceof WorkerGlobalScope && + typeof self.importScripts === 'function' + ); +})(); + +const origin = hasBrowserEnv && window.location.href || 'http://localhost'; + +var utils = /*#__PURE__*/Object.freeze({ + __proto__: null, + hasBrowserEnv: hasBrowserEnv, + hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv, + hasStandardBrowserEnv: hasStandardBrowserEnv, + origin: origin +}); + +var platform = { + ...utils, + ...platform$1 +}; + +function toURLEncodedForm(data, options) { + return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({ + visitor: function(value, key, path, helpers) { + if (platform.isNode && utils$1.isBuffer(value)) { + this.append(key, value.toString('base64')); + return false; + } + + return helpers.defaultVisitor.apply(this, arguments); + } + }, options)); +} + +/** + * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z'] + * + * @param {string} name - The name of the property to get. + * + * @returns An array of strings. + */ +function parsePropPath(name) { + // foo[x][y][z] + // foo.x.y.z + // foo-x-y-z + // foo x y z + return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => { + return match[0] === '[]' ? '' : match[1] || match[0]; + }); +} + +/** + * Convert an array to an object. + * + * @param {Array} arr - The array to convert to an object. + * + * @returns An object with the same keys and values as the array. + */ +function arrayToObject(arr) { + const obj = {}; + const keys = Object.keys(arr); + let i; + const len = keys.length; + let key; + for (i = 0; i < len; i++) { + key = keys[i]; + obj[key] = arr[key]; + } + return obj; +} + +/** + * It takes a FormData object and returns a JavaScript object + * + * @param {string} formData The FormData object to convert to JSON. + * + * @returns {Object | null} The converted object. + */ +function formDataToJSON(formData) { + function buildPath(path, value, target, index) { + let name = path[index++]; + + if (name === '__proto__') return true; + + const isNumericKey = Number.isFinite(+name); + const isLast = index >= path.length; + name = !name && utils$1.isArray(target) ? target.length : name; + + if (isLast) { + if (utils$1.hasOwnProp(target, name)) { + target[name] = [target[name], value]; + } else { + target[name] = value; + } + + return !isNumericKey; + } + + if (!target[name] || !utils$1.isObject(target[name])) { + target[name] = []; + } + + const result = buildPath(path, value, target[name], index); + + if (result && utils$1.isArray(target[name])) { + target[name] = arrayToObject(target[name]); + } + + return !isNumericKey; + } + + if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) { + const obj = {}; + + utils$1.forEachEntry(formData, (name, value) => { + buildPath(parsePropPath(name), value, obj, 0); + }); + + return obj; + } + + return null; +} + +/** + * It takes a string, tries to parse it, and if it fails, it returns the stringified version + * of the input + * + * @param {any} rawValue - The value to be stringified. + * @param {Function} parser - A function that parses a string into a JavaScript object. + * @param {Function} encoder - A function that takes a value and returns a string. + * + * @returns {string} A stringified version of the rawValue. + */ +function stringifySafely(rawValue, parser, encoder) { + if (utils$1.isString(rawValue)) { + try { + (parser || JSON.parse)(rawValue); + return utils$1.trim(rawValue); + } catch (e) { + if (e.name !== 'SyntaxError') { + throw e; + } + } + } + + return (encoder || JSON.stringify)(rawValue); +} + +const defaults = { + + transitional: transitionalDefaults, + + adapter: ['xhr', 'http', 'fetch'], + + transformRequest: [function transformRequest(data, headers) { + const contentType = headers.getContentType() || ''; + const hasJSONContentType = contentType.indexOf('application/json') > -1; + const isObjectPayload = utils$1.isObject(data); + + if (isObjectPayload && utils$1.isHTMLForm(data)) { + data = new FormData(data); + } + + const isFormData = utils$1.isFormData(data); + + if (isFormData) { + return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data; + } + + if (utils$1.isArrayBuffer(data) || + utils$1.isBuffer(data) || + utils$1.isStream(data) || + utils$1.isFile(data) || + utils$1.isBlob(data) || + utils$1.isReadableStream(data) + ) { + return data; + } + if (utils$1.isArrayBufferView(data)) { + return data.buffer; + } + if (utils$1.isURLSearchParams(data)) { + headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false); + return data.toString(); + } + + let isFileList; + + if (isObjectPayload) { + if (contentType.indexOf('application/x-www-form-urlencoded') > -1) { + return toURLEncodedForm(data, this.formSerializer).toString(); + } + + if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) { + const _FormData = this.env && this.env.FormData; + + return toFormData( + isFileList ? {'files[]': data} : data, + _FormData && new _FormData(), + this.formSerializer + ); + } + } + + if (isObjectPayload || hasJSONContentType ) { + headers.setContentType('application/json', false); + return stringifySafely(data); + } + + return data; + }], + + transformResponse: [function transformResponse(data) { + const transitional = this.transitional || defaults.transitional; + const forcedJSONParsing = transitional && transitional.forcedJSONParsing; + const JSONRequested = this.responseType === 'json'; + + if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) { + return data; + } + + if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) { + const silentJSONParsing = transitional && transitional.silentJSONParsing; + const strictJSONParsing = !silentJSONParsing && JSONRequested; + + try { + return JSON.parse(data); + } catch (e) { + if (strictJSONParsing) { + if (e.name === 'SyntaxError') { + throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response); + } + throw e; + } + } + } + + return data; + }], + + /** + * A timeout in milliseconds to abort a request. If set to 0 (default) a + * timeout is not created. + */ + timeout: 0, + + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN', + + maxContentLength: -1, + maxBodyLength: -1, + + env: { + FormData: platform.classes.FormData, + Blob: platform.classes.Blob + }, + + validateStatus: function validateStatus(status) { + return status >= 200 && status < 300; + }, + + headers: { + common: { + 'Accept': 'application/json, text/plain, */*', + 'Content-Type': undefined + } + } +}; + +utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => { + defaults.headers[method] = {}; +}); + +var defaults$1 = defaults; + +// RawAxiosHeaders whose duplicates are ignored by node +// c.f. https://nodejs.org/api/http.html#http_message_headers +const ignoreDuplicateOf = utils$1.toObjectSet([ + 'age', 'authorization', 'content-length', 'content-type', 'etag', + 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', + 'last-modified', 'location', 'max-forwards', 'proxy-authorization', + 'referer', 'retry-after', 'user-agent' +]); + +/** + * Parse headers into an object + * + * ``` + * Date: Wed, 27 Aug 2014 08:58:49 GMT + * Content-Type: application/json + * Connection: keep-alive + * Transfer-Encoding: chunked + * ``` + * + * @param {String} rawHeaders Headers needing to be parsed + * + * @returns {Object} Headers parsed into an object + */ +var parseHeaders = rawHeaders => { + const parsed = {}; + let key; + let val; + let i; + + rawHeaders && rawHeaders.split('\n').forEach(function parser(line) { + i = line.indexOf(':'); + key = line.substring(0, i).trim().toLowerCase(); + val = line.substring(i + 1).trim(); + + if (!key || (parsed[key] && ignoreDuplicateOf[key])) { + return; + } + + if (key === 'set-cookie') { + if (parsed[key]) { + parsed[key].push(val); + } else { + parsed[key] = [val]; + } + } else { + parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; + } + }); + + return parsed; +}; + +const $internals = Symbol('internals'); + +function normalizeHeader(header) { + return header && String(header).trim().toLowerCase(); +} + +function normalizeValue(value) { + if (value === false || value == null) { + return value; + } + + return utils$1.isArray(value) ? value.map(normalizeValue) : String(value); +} + +function parseTokens(str) { + const tokens = Object.create(null); + const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; + let match; + + while ((match = tokensRE.exec(str))) { + tokens[match[1]] = match[2]; + } + + return tokens; +} + +const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim()); + +function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) { + if (utils$1.isFunction(filter)) { + return filter.call(this, value, header); + } + + if (isHeaderNameFilter) { + value = header; + } + + if (!utils$1.isString(value)) return; + + if (utils$1.isString(filter)) { + return value.indexOf(filter) !== -1; + } + + if (utils$1.isRegExp(filter)) { + return filter.test(value); + } +} + +function formatHeader(header) { + return header.trim() + .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => { + return char.toUpperCase() + str; + }); +} + +function buildAccessors(obj, header) { + const accessorName = utils$1.toCamelCase(' ' + header); + + ['get', 'set', 'has'].forEach(methodName => { + Object.defineProperty(obj, methodName + accessorName, { + value: function(arg1, arg2, arg3) { + return this[methodName].call(this, header, arg1, arg2, arg3); + }, + configurable: true + }); + }); +} + +class AxiosHeaders { + constructor(headers) { + headers && this.set(headers); + } + + set(header, valueOrRewrite, rewrite) { + const self = this; + + function setHeader(_value, _header, _rewrite) { + const lHeader = normalizeHeader(_header); + + if (!lHeader) { + throw new Error('header name must be a non-empty string'); + } + + const key = utils$1.findKey(self, lHeader); + + if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) { + self[key || _header] = normalizeValue(_value); + } + } + + const setHeaders = (headers, _rewrite) => + utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite)); + + if (utils$1.isPlainObject(header) || header instanceof this.constructor) { + setHeaders(header, valueOrRewrite); + } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) { + setHeaders(parseHeaders(header), valueOrRewrite); + } else if (utils$1.isHeaders(header)) { + for (const [key, value] of header.entries()) { + setHeader(value, key, rewrite); + } + } else { + header != null && setHeader(valueOrRewrite, header, rewrite); + } + + return this; + } + + get(header, parser) { + header = normalizeHeader(header); + + if (header) { + const key = utils$1.findKey(this, header); + + if (key) { + const value = this[key]; + + if (!parser) { + return value; + } + + if (parser === true) { + return parseTokens(value); + } + + if (utils$1.isFunction(parser)) { + return parser.call(this, value, key); + } + + if (utils$1.isRegExp(parser)) { + return parser.exec(value); + } + + throw new TypeError('parser must be boolean|regexp|function'); + } + } + } + + has(header, matcher) { + header = normalizeHeader(header); + + if (header) { + const key = utils$1.findKey(this, header); + + return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher))); + } + + return false; + } + + delete(header, matcher) { + const self = this; + let deleted = false; + + function deleteHeader(_header) { + _header = normalizeHeader(_header); + + if (_header) { + const key = utils$1.findKey(self, _header); + + if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) { + delete self[key]; + + deleted = true; + } + } + } + + if (utils$1.isArray(header)) { + header.forEach(deleteHeader); + } else { + deleteHeader(header); + } + + return deleted; + } + + clear(matcher) { + const keys = Object.keys(this); + let i = keys.length; + let deleted = false; + + while (i--) { + const key = keys[i]; + if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) { + delete this[key]; + deleted = true; + } + } + + return deleted; + } + + normalize(format) { + const self = this; + const headers = {}; + + utils$1.forEach(this, (value, header) => { + const key = utils$1.findKey(headers, header); + + if (key) { + self[key] = normalizeValue(value); + delete self[header]; + return; + } + + const normalized = format ? formatHeader(header) : String(header).trim(); + + if (normalized !== header) { + delete self[header]; + } + + self[normalized] = normalizeValue(value); + + headers[normalized] = true; + }); + + return this; + } + + concat(...targets) { + return this.constructor.concat(this, ...targets); + } + + toJSON(asStrings) { + const obj = Object.create(null); + + utils$1.forEach(this, (value, header) => { + value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value); + }); + + return obj; + } + + [Symbol.iterator]() { + return Object.entries(this.toJSON())[Symbol.iterator](); + } + + toString() { + return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n'); + } + + get [Symbol.toStringTag]() { + return 'AxiosHeaders'; + } + + static from(thing) { + return thing instanceof this ? thing : new this(thing); + } + + static concat(first, ...targets) { + const computed = new this(first); + + targets.forEach((target) => computed.set(target)); + + return computed; + } + + static accessor(header) { + const internals = this[$internals] = (this[$internals] = { + accessors: {} + }); + + const accessors = internals.accessors; + const prototype = this.prototype; + + function defineAccessor(_header) { + const lHeader = normalizeHeader(_header); + + if (!accessors[lHeader]) { + buildAccessors(prototype, _header); + accessors[lHeader] = true; + } + } + + utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header); + + return this; + } +} + +AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']); + +// reserved names hotfix +utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => { + let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set` + return { + get: () => value, + set(headerValue) { + this[mapped] = headerValue; + } + } +}); + +utils$1.freezeMethods(AxiosHeaders); + +var AxiosHeaders$1 = AxiosHeaders; + +/** + * Transform the data for a request or a response + * + * @param {Array|Function} fns A single function or Array of functions + * @param {?Object} response The response object + * + * @returns {*} The resulting transformed data + */ +function transformData(fns, response) { + const config = this || defaults$1; + const context = response || config; + const headers = AxiosHeaders$1.from(context.headers); + let data = context.data; + + utils$1.forEach(fns, function transform(fn) { + data = fn.call(config, data, headers.normalize(), response ? response.status : undefined); + }); + + headers.normalize(); + + return data; +} + +function isCancel(value) { + return !!(value && value.__CANCEL__); +} + +/** + * A `CanceledError` is an object that is thrown when an operation is canceled. + * + * @param {string=} message The message. + * @param {Object=} config The config. + * @param {Object=} request The request. + * + * @returns {CanceledError} The created error. + */ +function CanceledError(message, config, request) { + // eslint-disable-next-line no-eq-null,eqeqeq + AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request); + this.name = 'CanceledError'; +} + +utils$1.inherits(CanceledError, AxiosError, { + __CANCEL__: true +}); + +/** + * Resolve or reject a Promise based on response status. + * + * @param {Function} resolve A function that resolves the promise. + * @param {Function} reject A function that rejects the promise. + * @param {object} response The response. + * + * @returns {object} The response. + */ +function settle(resolve, reject, response) { + const validateStatus = response.config.validateStatus; + if (!response.status || !validateStatus || validateStatus(response.status)) { + resolve(response); + } else { + reject(new AxiosError( + 'Request failed with status code ' + response.status, + [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], + response.config, + response.request, + response + )); + } +} + +function parseProtocol(url) { + const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url); + return match && match[1] || ''; +} + +/** + * Calculate data maxRate + * @param {Number} [samplesCount= 10] + * @param {Number} [min= 1000] + * @returns {Function} + */ +function speedometer(samplesCount, min) { + samplesCount = samplesCount || 10; + const bytes = new Array(samplesCount); + const timestamps = new Array(samplesCount); + let head = 0; + let tail = 0; + let firstSampleTS; + + min = min !== undefined ? min : 1000; + + return function push(chunkLength) { + const now = Date.now(); + + const startedAt = timestamps[tail]; + + if (!firstSampleTS) { + firstSampleTS = now; + } + + bytes[head] = chunkLength; + timestamps[head] = now; + + let i = tail; + let bytesCount = 0; + + while (i !== head) { + bytesCount += bytes[i++]; + i = i % samplesCount; + } + + head = (head + 1) % samplesCount; + + if (head === tail) { + tail = (tail + 1) % samplesCount; + } + + if (now - firstSampleTS < min) { + return; + } + + const passed = startedAt && now - startedAt; + + return passed ? Math.round(bytesCount * 1000 / passed) : undefined; + }; +} + +/** + * Throttle decorator + * @param {Function} fn + * @param {Number} freq + * @return {Function} + */ +function throttle(fn, freq) { + let timestamp = 0; + const threshold = 1000 / freq; + let timer = null; + return function throttled() { + const force = this === true; + + const now = Date.now(); + if (force || now - timestamp > threshold) { + if (timer) { + clearTimeout(timer); + timer = null; + } + timestamp = now; + return fn.apply(null, arguments); + } + if (!timer) { + timer = setTimeout(() => { + timer = null; + timestamp = Date.now(); + return fn.apply(null, arguments); + }, threshold - (now - timestamp)); + } + }; +} + +var progressEventReducer = (listener, isDownloadStream, freq = 3) => { + let bytesNotified = 0; + const _speedometer = speedometer(50, 250); + + return throttle(e => { + const loaded = e.loaded; + const total = e.lengthComputable ? e.total : undefined; + const progressBytes = loaded - bytesNotified; + const rate = _speedometer(progressBytes); + const inRange = loaded <= total; + + bytesNotified = loaded; + + const data = { + loaded, + total, + progress: total ? (loaded / total) : undefined, + bytes: progressBytes, + rate: rate ? rate : undefined, + estimated: rate && total && inRange ? (total - loaded) / rate : undefined, + event: e, + lengthComputable: total != null + }; + + data[isDownloadStream ? 'download' : 'upload'] = true; + + listener(data); + }, freq); +}; + +var isURLSameOrigin = platform.hasStandardBrowserEnv ? + +// Standard browser envs have full support of the APIs needed to test +// whether the request URL is of the same origin as current location. + (function standardBrowserEnv() { + const msie = /(msie|trident)/i.test(navigator.userAgent); + const urlParsingNode = document.createElement('a'); + let originURL; + + /** + * Parse a URL to discover its components + * + * @param {String} url The URL to be parsed + * @returns {Object} + */ + function resolveURL(url) { + let href = url; + + if (msie) { + // IE needs attribute set twice to normalize properties + urlParsingNode.setAttribute('href', href); + href = urlParsingNode.href; + } + + urlParsingNode.setAttribute('href', href); + + // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: (urlParsingNode.pathname.charAt(0) === '/') ? + urlParsingNode.pathname : + '/' + urlParsingNode.pathname + }; + } + + originURL = resolveURL(window.location.href); + + /** + * Determine if a URL shares the same origin as the current location + * + * @param {String} requestURL The URL to test + * @returns {boolean} True if URL shares the same origin, otherwise false + */ + return function isURLSameOrigin(requestURL) { + const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL; + return (parsed.protocol === originURL.protocol && + parsed.host === originURL.host); + }; + })() : + + // Non standard browser envs (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return function isURLSameOrigin() { + return true; + }; + })(); + +var cookies = platform.hasStandardBrowserEnv ? + + // Standard browser envs support document.cookie + { + write(name, value, expires, path, domain, secure) { + const cookie = [name + '=' + encodeURIComponent(value)]; + + utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString()); + + utils$1.isString(path) && cookie.push('path=' + path); + + utils$1.isString(domain) && cookie.push('domain=' + domain); + + secure === true && cookie.push('secure'); + + document.cookie = cookie.join('; '); + }, + + read(name) { + const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); + return (match ? decodeURIComponent(match[3]) : null); + }, + + remove(name) { + this.write(name, '', Date.now() - 86400000); + } + } + + : + + // Non-standard browser env (web workers, react-native) lack needed support. + { + write() {}, + read() { + return null; + }, + remove() {} + }; + +/** + * Determines whether the specified URL is absolute + * + * @param {string} url The URL to test + * + * @returns {boolean} True if the specified URL is absolute, otherwise false + */ +function isAbsoluteURL(url) { + // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). + // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed + // by any combination of letters, digits, plus, period, or hyphen. + return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); +} + +/** + * Creates a new URL by combining the specified URLs + * + * @param {string} baseURL The base URL + * @param {string} relativeURL The relative URL + * + * @returns {string} The combined URL + */ +function combineURLs(baseURL, relativeURL) { + return relativeURL + ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') + : baseURL; +} + +/** + * Creates a new URL by combining the baseURL with the requestedURL, + * only when the requestedURL is not already an absolute URL. + * If the requestURL is absolute, this function returns the requestedURL untouched. + * + * @param {string} baseURL The base URL + * @param {string} requestedURL Absolute or relative URL to combine + * + * @returns {string} The combined full path + */ +function buildFullPath(baseURL, requestedURL) { + if (baseURL && !isAbsoluteURL(requestedURL)) { + return combineURLs(baseURL, requestedURL); + } + return requestedURL; +} + +const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing; + +/** + * Config-specific merge-function which creates a new config-object + * by merging two configuration objects together. + * + * @param {Object} config1 + * @param {Object} config2 + * + * @returns {Object} New object resulting from merging config2 to config1 + */ +function mergeConfig(config1, config2) { + // eslint-disable-next-line no-param-reassign + config2 = config2 || {}; + const config = {}; + + function getMergedValue(target, source, caseless) { + if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) { + return utils$1.merge.call({caseless}, target, source); + } else if (utils$1.isPlainObject(source)) { + return utils$1.merge({}, source); + } else if (utils$1.isArray(source)) { + return source.slice(); + } + return source; + } + + // eslint-disable-next-line consistent-return + function mergeDeepProperties(a, b, caseless) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(a, b, caseless); + } else if (!utils$1.isUndefined(a)) { + return getMergedValue(undefined, a, caseless); + } + } + + // eslint-disable-next-line consistent-return + function valueFromConfig2(a, b) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(undefined, b); + } + } + + // eslint-disable-next-line consistent-return + function defaultToConfig2(a, b) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(undefined, b); + } else if (!utils$1.isUndefined(a)) { + return getMergedValue(undefined, a); + } + } + + // eslint-disable-next-line consistent-return + function mergeDirectKeys(a, b, prop) { + if (prop in config2) { + return getMergedValue(a, b); + } else if (prop in config1) { + return getMergedValue(undefined, a); + } + } + + const mergeMap = { + url: valueFromConfig2, + method: valueFromConfig2, + data: valueFromConfig2, + baseURL: defaultToConfig2, + transformRequest: defaultToConfig2, + transformResponse: defaultToConfig2, + paramsSerializer: defaultToConfig2, + timeout: defaultToConfig2, + timeoutMessage: defaultToConfig2, + withCredentials: defaultToConfig2, + withXSRFToken: defaultToConfig2, + adapter: defaultToConfig2, + responseType: defaultToConfig2, + xsrfCookieName: defaultToConfig2, + xsrfHeaderName: defaultToConfig2, + onUploadProgress: defaultToConfig2, + onDownloadProgress: defaultToConfig2, + decompress: defaultToConfig2, + maxContentLength: defaultToConfig2, + maxBodyLength: defaultToConfig2, + beforeRedirect: defaultToConfig2, + transport: defaultToConfig2, + httpAgent: defaultToConfig2, + httpsAgent: defaultToConfig2, + cancelToken: defaultToConfig2, + socketPath: defaultToConfig2, + responseEncoding: defaultToConfig2, + validateStatus: mergeDirectKeys, + headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true) + }; + + utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) { + const merge = mergeMap[prop] || mergeDeepProperties; + const configValue = merge(config1[prop], config2[prop], prop); + (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue); + }); + + return config; +} + +var resolveConfig = (config) => { + const newConfig = mergeConfig({}, config); + + let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig; + + newConfig.headers = headers = AxiosHeaders$1.from(headers); + + newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer); + + // HTTP basic authentication + if (auth) { + headers.set('Authorization', 'Basic ' + + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')) + ); + } + + let contentType; + + if (utils$1.isFormData(data)) { + if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) { + headers.setContentType(undefined); // Let the browser set it + } else if ((contentType = headers.getContentType()) !== false) { + // fix semicolon duplication issue for ReactNative FormData implementation + const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : []; + headers.setContentType([type || 'multipart/form-data', ...tokens].join('; ')); + } + } + + // Add xsrf header + // This is only done if running in a standard browser environment. + // Specifically not if we're in a web worker, or react-native. + + if (platform.hasStandardBrowserEnv) { + withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig)); + + if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) { + // Add xsrf header + const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName); + + if (xsrfValue) { + headers.set(xsrfHeaderName, xsrfValue); + } + } + } + + return newConfig; +}; + +const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined'; + +var xhrAdapter = isXHRAdapterSupported && function (config) { + return new Promise(function dispatchXhrRequest(resolve, reject) { + const _config = resolveConfig(config); + let requestData = _config.data; + const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize(); + let {responseType} = _config; + let onCanceled; + function done() { + if (_config.cancelToken) { + _config.cancelToken.unsubscribe(onCanceled); + } + + if (_config.signal) { + _config.signal.removeEventListener('abort', onCanceled); + } + } + + let request = new XMLHttpRequest(); + + request.open(_config.method.toUpperCase(), _config.url, true); + + // Set the request timeout in MS + request.timeout = _config.timeout; + + function onloadend() { + if (!request) { + return; + } + // Prepare the response + const responseHeaders = AxiosHeaders$1.from( + 'getAllResponseHeaders' in request && request.getAllResponseHeaders() + ); + const responseData = !responseType || responseType === 'text' || responseType === 'json' ? + request.responseText : request.response; + const response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config, + request + }; + + settle(function _resolve(value) { + resolve(value); + done(); + }, function _reject(err) { + reject(err); + done(); + }, response); + + // Clean up request + request = null; + } + + if ('onloadend' in request) { + // Use onloadend if available + request.onloadend = onloadend; + } else { + // Listen for ready state to emulate onloadend + request.onreadystatechange = function handleLoad() { + if (!request || request.readyState !== 4) { + return; + } + + // The request errored out and we didn't get a response, this will be + // handled by onerror instead + // With one exception: request that using file: protocol, most browsers + // will return status as 0 even though it's a successful request + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { + return; + } + // readystate handler is calling before onerror or ontimeout handlers, + // so we should call onloadend on the next 'tick' + setTimeout(onloadend); + }; + } + + // Handle browser request cancellation (as opposed to a manual cancellation) + request.onabort = function handleAbort() { + if (!request) { + return; + } + + reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, _config, request)); + + // Clean up request + request = null; + }; + + // Handle low level network errors + request.onerror = function handleError() { + // Real errors are hidden from us by the browser + // onerror should only fire if it's a network error + reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, _config, request)); + + // Clean up request + request = null; + }; + + // Handle timeout + request.ontimeout = function handleTimeout() { + let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded'; + const transitional = _config.transitional || transitionalDefaults; + if (_config.timeoutErrorMessage) { + timeoutErrorMessage = _config.timeoutErrorMessage; + } + reject(new AxiosError( + timeoutErrorMessage, + transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, + _config, + request)); + + // Clean up request + request = null; + }; + + // Remove Content-Type if data is undefined + requestData === undefined && requestHeaders.setContentType(null); + + // Add headers to the request + if ('setRequestHeader' in request) { + utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) { + request.setRequestHeader(key, val); + }); + } + + // Add withCredentials to request if needed + if (!utils$1.isUndefined(_config.withCredentials)) { + request.withCredentials = !!_config.withCredentials; + } + + // Add responseType to request if needed + if (responseType && responseType !== 'json') { + request.responseType = _config.responseType; + } + + // Handle progress if needed + if (typeof _config.onDownloadProgress === 'function') { + request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true)); + } + + // Not all browsers support upload events + if (typeof _config.onUploadProgress === 'function' && request.upload) { + request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress)); + } + + if (_config.cancelToken || _config.signal) { + // Handle cancellation + // eslint-disable-next-line func-names + onCanceled = cancel => { + if (!request) { + return; + } + reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel); + request.abort(); + request = null; + }; + + _config.cancelToken && _config.cancelToken.subscribe(onCanceled); + if (_config.signal) { + _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled); + } + } + + const protocol = parseProtocol(_config.url); + + if (protocol && platform.protocols.indexOf(protocol) === -1) { + reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config)); + return; + } + + + // Send the request + request.send(requestData || null); + }); +}; + +const composeSignals = (signals, timeout) => { + let controller = new AbortController(); + + let aborted; + + const onabort = function (cancel) { + if (!aborted) { + aborted = true; + unsubscribe(); + const err = cancel instanceof Error ? cancel : this.reason; + controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err)); + } + }; + + let timer = timeout && setTimeout(() => { + onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT)); + }, timeout); + + const unsubscribe = () => { + if (signals) { + timer && clearTimeout(timer); + timer = null; + signals.forEach(signal => { + signal && + (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort)); + }); + signals = null; + } + }; + + signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort)); + + const {signal} = controller; + + signal.unsubscribe = unsubscribe; + + return [signal, () => { + timer && clearTimeout(timer); + timer = null; + }]; +}; + +var composeSignals$1 = composeSignals; + +const streamChunk = function* (chunk, chunkSize) { + let len = chunk.byteLength; + + if (!chunkSize || len < chunkSize) { + yield chunk; + return; + } + + let pos = 0; + let end; + + while (pos < len) { + end = pos + chunkSize; + yield chunk.slice(pos, end); + pos = end; + } +}; + +const readBytes = async function* (iterable, chunkSize, encode) { + for await (const chunk of iterable) { + yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize); + } +}; + +const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => { + const iterator = readBytes(stream, chunkSize, encode); + + let bytes = 0; + + return new ReadableStream({ + type: 'bytes', + + async pull(controller) { + const {done, value} = await iterator.next(); + + if (done) { + controller.close(); + onFinish(); + return; + } + + let len = value.byteLength; + onProgress && onProgress(bytes += len); + controller.enqueue(new Uint8Array(value)); + }, + cancel(reason) { + onFinish(reason); + return iterator.return(); + } + }, { + highWaterMark: 2 + }) +}; + +const fetchProgressDecorator = (total, fn) => { + const lengthComputable = total != null; + return (loaded) => setTimeout(() => fn({ + lengthComputable, + total, + loaded + })); +}; + +const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function'; +const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function'; + +// used only inside the fetch adapter +const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? + ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : + async (str) => new Uint8Array(await new Response(str).arrayBuffer()) +); + +const supportsRequestStream = isReadableStreamSupported && (() => { + let duplexAccessed = false; + + const hasContentType = new Request(platform.origin, { + body: new ReadableStream(), + method: 'POST', + get duplex() { + duplexAccessed = true; + return 'half'; + }, + }).headers.has('Content-Type'); + + return duplexAccessed && !hasContentType; +})(); + +const DEFAULT_CHUNK_SIZE = 64 * 1024; + +const supportsResponseStream = isReadableStreamSupported && !!(()=> { + try { + return utils$1.isReadableStream(new Response('').body); + } catch(err) { + // return undefined + } +})(); + +const resolvers = { + stream: supportsResponseStream && ((res) => res.body) +}; + +isFetchSupported && (((res) => { + ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => { + !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() : + (_, config) => { + throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config); + }); + }); +})(new Response)); + +const getBodyLength = async (body) => { + if (body == null) { + return 0; + } + + if(utils$1.isBlob(body)) { + return body.size; + } + + if(utils$1.isSpecCompliantForm(body)) { + return (await new Request(body).arrayBuffer()).byteLength; + } + + if(utils$1.isArrayBufferView(body)) { + return body.byteLength; + } + + if(utils$1.isURLSearchParams(body)) { + body = body + ''; + } + + if(utils$1.isString(body)) { + return (await encodeText(body)).byteLength; + } +}; + +const resolveBodyLength = async (headers, body) => { + const length = utils$1.toFiniteNumber(headers.getContentLength()); + + return length == null ? getBodyLength(body) : length; +}; + +var fetchAdapter = isFetchSupported && (async (config) => { + let { + url, + method, + data, + signal, + cancelToken, + timeout, + onDownloadProgress, + onUploadProgress, + responseType, + headers, + withCredentials = 'same-origin', + fetchOptions + } = resolveConfig(config); + + responseType = responseType ? (responseType + '').toLowerCase() : 'text'; + + let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ? + composeSignals$1([signal, cancelToken], timeout) : []; + + let finished, request; + + const onFinish = () => { + !finished && setTimeout(() => { + composedSignal && composedSignal.unsubscribe(); + }); + + finished = true; + }; + + let requestContentLength; + + try { + if ( + onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' && + (requestContentLength = await resolveBodyLength(headers, data)) !== 0 + ) { + let _request = new Request(url, { + method: 'POST', + body: data, + duplex: "half" + }); + + let contentTypeHeader; + + if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) { + headers.setContentType(contentTypeHeader); + } + + if (_request.body) { + data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator( + requestContentLength, + progressEventReducer(onUploadProgress) + ), null, encodeText); + } + } + + if (!utils$1.isString(withCredentials)) { + withCredentials = withCredentials ? 'cors' : 'omit'; + } + + request = new Request(url, { + ...fetchOptions, + signal: composedSignal, + method: method.toUpperCase(), + headers: headers.normalize().toJSON(), + body: data, + duplex: "half", + withCredentials + }); + + let response = await fetch(request); + + const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response'); + + if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) { + const options = {}; + + ['status', 'statusText', 'headers'].forEach(prop => { + options[prop] = response[prop]; + }); + + const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length')); + + response = new Response( + trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator( + responseContentLength, + progressEventReducer(onDownloadProgress, true) + ), isStreamResponse && onFinish, encodeText), + options + ); + } + + responseType = responseType || 'text'; + + let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config); + + !isStreamResponse && onFinish(); + + stopTimeout && stopTimeout(); + + return await new Promise((resolve, reject) => { + settle(resolve, reject, { + data: responseData, + headers: AxiosHeaders$1.from(response.headers), + status: response.status, + statusText: response.statusText, + config, + request + }); + }) + } catch (err) { + onFinish(); + + if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) { + throw Object.assign( + new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), + { + cause: err.cause || err + } + ) + } + + throw AxiosError.from(err, err && err.code, config, request); + } +}); + +const knownAdapters = { + http: httpAdapter, + xhr: xhrAdapter, + fetch: fetchAdapter +}; + +utils$1.forEach(knownAdapters, (fn, value) => { + if (fn) { + try { + Object.defineProperty(fn, 'name', {value}); + } catch (e) { + // eslint-disable-next-line no-empty + } + Object.defineProperty(fn, 'adapterName', {value}); + } +}); + +const renderReason = (reason) => `- ${reason}`; + +const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false; + +var adapters = { + getAdapter: (adapters) => { + adapters = utils$1.isArray(adapters) ? adapters : [adapters]; + + const {length} = adapters; + let nameOrAdapter; + let adapter; + + const rejectedReasons = {}; + + for (let i = 0; i < length; i++) { + nameOrAdapter = adapters[i]; + let id; + + adapter = nameOrAdapter; + + if (!isResolvedHandle(nameOrAdapter)) { + adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()]; + + if (adapter === undefined) { + throw new AxiosError(`Unknown adapter '${id}'`); + } + } + + if (adapter) { + break; + } + + rejectedReasons[id || '#' + i] = adapter; + } + + if (!adapter) { + + const reasons = Object.entries(rejectedReasons) + .map(([id, state]) => `adapter ${id} ` + + (state === false ? 'is not supported by the environment' : 'is not available in the build') + ); + + let s = length ? + (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) : + 'as no adapter specified'; + + throw new AxiosError( + `There is no suitable adapter to dispatch the request ` + s, + 'ERR_NOT_SUPPORT' + ); + } + + return adapter; + }, + adapters: knownAdapters +}; + +/** + * Throws a `CanceledError` if cancellation has been requested. + * + * @param {Object} config The config that is to be used for the request + * + * @returns {void} + */ +function throwIfCancellationRequested(config) { + if (config.cancelToken) { + config.cancelToken.throwIfRequested(); + } + + if (config.signal && config.signal.aborted) { + throw new CanceledError(null, config); + } +} + +/** + * Dispatch a request to the server using the configured adapter. + * + * @param {object} config The config that is to be used for the request + * + * @returns {Promise} The Promise to be fulfilled + */ +function dispatchRequest(config) { + throwIfCancellationRequested(config); + + config.headers = AxiosHeaders$1.from(config.headers); + + // Transform request data + config.data = transformData.call( + config, + config.transformRequest + ); + + if (['post', 'put', 'patch'].indexOf(config.method) !== -1) { + config.headers.setContentType('application/x-www-form-urlencoded', false); + } + + const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter); + + return adapter(config).then(function onAdapterResolution(response) { + throwIfCancellationRequested(config); + + // Transform response data + response.data = transformData.call( + config, + config.transformResponse, + response + ); + + response.headers = AxiosHeaders$1.from(response.headers); + + return response; + }, function onAdapterRejection(reason) { + if (!isCancel(reason)) { + throwIfCancellationRequested(config); + + // Transform response data + if (reason && reason.response) { + reason.response.data = transformData.call( + config, + config.transformResponse, + reason.response + ); + reason.response.headers = AxiosHeaders$1.from(reason.response.headers); + } + } + + return Promise.reject(reason); + }); +} + +const VERSION = "1.7.2"; + +const validators$1 = {}; + +// eslint-disable-next-line func-names +['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => { + validators$1[type] = function validator(thing) { + return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type; + }; +}); + +const deprecatedWarnings = {}; + +/** + * Transitional option validator + * + * @param {function|boolean?} validator - set to false if the transitional option has been removed + * @param {string?} version - deprecated version / removed since version + * @param {string?} message - some message with additional info + * + * @returns {function} + */ +validators$1.transitional = function transitional(validator, version, message) { + function formatMessage(opt, desc) { + return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); + } + + // eslint-disable-next-line func-names + return (value, opt, opts) => { + if (validator === false) { + throw new AxiosError( + formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), + AxiosError.ERR_DEPRECATED + ); + } + + if (version && !deprecatedWarnings[opt]) { + deprecatedWarnings[opt] = true; + // eslint-disable-next-line no-console + console.warn( + formatMessage( + opt, + ' has been deprecated since v' + version + ' and will be removed in the near future' + ) + ); + } + + return validator ? validator(value, opt, opts) : true; + }; +}; + +/** + * Assert object's properties type + * + * @param {object} options + * @param {object} schema + * @param {boolean?} allowUnknown + * + * @returns {object} + */ + +function assertOptions(options, schema, allowUnknown) { + if (typeof options !== 'object') { + throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE); + } + const keys = Object.keys(options); + let i = keys.length; + while (i-- > 0) { + const opt = keys[i]; + const validator = schema[opt]; + if (validator) { + const value = options[opt]; + const result = value === undefined || validator(value, opt, options); + if (result !== true) { + throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE); + } + continue; + } + if (allowUnknown !== true) { + throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION); + } + } +} + +var validator = { + assertOptions, + validators: validators$1 +}; + +const validators = validator.validators; + +/** + * Create a new instance of Axios + * + * @param {Object} instanceConfig The default config for the instance + * + * @return {Axios} A new instance of Axios + */ +class Axios { + constructor(instanceConfig) { + this.defaults = instanceConfig; + this.interceptors = { + request: new InterceptorManager$1(), + response: new InterceptorManager$1() + }; + } + + /** + * Dispatch a request + * + * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults) + * @param {?Object} config + * + * @returns {Promise} The Promise to be fulfilled + */ + async request(configOrUrl, config) { + try { + return await this._request(configOrUrl, config); + } catch (err) { + if (err instanceof Error) { + let dummy; + + Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error()); + + // slice off the Error: ... line + const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : ''; + try { + if (!err.stack) { + err.stack = stack; + // match without the 2 top stack lines + } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) { + err.stack += '\n' + stack; + } + } catch (e) { + // ignore the case where "stack" is an un-writable property + } + } + + throw err; + } + } + + _request(configOrUrl, config) { + /*eslint no-param-reassign:0*/ + // Allow for axios('example/url'[, config]) a la fetch API + if (typeof configOrUrl === 'string') { + config = config || {}; + config.url = configOrUrl; + } else { + config = configOrUrl || {}; + } + + config = mergeConfig(this.defaults, config); + + const {transitional, paramsSerializer, headers} = config; + + if (transitional !== undefined) { + validator.assertOptions(transitional, { + silentJSONParsing: validators.transitional(validators.boolean), + forcedJSONParsing: validators.transitional(validators.boolean), + clarifyTimeoutError: validators.transitional(validators.boolean) + }, false); + } + + if (paramsSerializer != null) { + if (utils$1.isFunction(paramsSerializer)) { + config.paramsSerializer = { + serialize: paramsSerializer + }; + } else { + validator.assertOptions(paramsSerializer, { + encode: validators.function, + serialize: validators.function + }, true); + } + } + + // Set config.method + config.method = (config.method || this.defaults.method || 'get').toLowerCase(); + + // Flatten headers + let contextHeaders = headers && utils$1.merge( + headers.common, + headers[config.method] + ); + + headers && utils$1.forEach( + ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], + (method) => { + delete headers[method]; + } + ); + + config.headers = AxiosHeaders$1.concat(contextHeaders, headers); + + // filter out skipped interceptors + const requestInterceptorChain = []; + let synchronousRequestInterceptors = true; + this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { + if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { + return; + } + + synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; + + requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); + }); + + const responseInterceptorChain = []; + this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { + responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); + }); + + let promise; + let i = 0; + let len; + + if (!synchronousRequestInterceptors) { + const chain = [dispatchRequest.bind(this), undefined]; + chain.unshift.apply(chain, requestInterceptorChain); + chain.push.apply(chain, responseInterceptorChain); + len = chain.length; + + promise = Promise.resolve(config); + + while (i < len) { + promise = promise.then(chain[i++], chain[i++]); + } + + return promise; + } + + len = requestInterceptorChain.length; + + let newConfig = config; + + i = 0; + + while (i < len) { + const onFulfilled = requestInterceptorChain[i++]; + const onRejected = requestInterceptorChain[i++]; + try { + newConfig = onFulfilled(newConfig); + } catch (error) { + onRejected.call(this, error); + break; + } + } + + try { + promise = dispatchRequest.call(this, newConfig); + } catch (error) { + return Promise.reject(error); + } + + i = 0; + len = responseInterceptorChain.length; + + while (i < len) { + promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]); + } + + return promise; + } + + getUri(config) { + config = mergeConfig(this.defaults, config); + const fullPath = buildFullPath(config.baseURL, config.url); + return buildURL(fullPath, config.params, config.paramsSerializer); + } +} + +// Provide aliases for supported request methods +utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function(url, config) { + return this.request(mergeConfig(config || {}, { + method, + url, + data: (config || {}).data + })); + }; +}); + +utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + /*eslint func-names:0*/ + + function generateHTTPMethod(isForm) { + return function httpMethod(url, data, config) { + return this.request(mergeConfig(config || {}, { + method, + headers: isForm ? { + 'Content-Type': 'multipart/form-data' + } : {}, + url, + data + })); + }; + } + + Axios.prototype[method] = generateHTTPMethod(); + + Axios.prototype[method + 'Form'] = generateHTTPMethod(true); +}); + +var Axios$1 = Axios; + +/** + * A `CancelToken` is an object that can be used to request cancellation of an operation. + * + * @param {Function} executor The executor function. + * + * @returns {CancelToken} + */ +class CancelToken { + constructor(executor) { + if (typeof executor !== 'function') { + throw new TypeError('executor must be a function.'); + } + + let resolvePromise; + + this.promise = new Promise(function promiseExecutor(resolve) { + resolvePromise = resolve; + }); + + const token = this; + + // eslint-disable-next-line func-names + this.promise.then(cancel => { + if (!token._listeners) return; + + let i = token._listeners.length; + + while (i-- > 0) { + token._listeners[i](cancel); + } + token._listeners = null; + }); + + // eslint-disable-next-line func-names + this.promise.then = onfulfilled => { + let _resolve; + // eslint-disable-next-line func-names + const promise = new Promise(resolve => { + token.subscribe(resolve); + _resolve = resolve; + }).then(onfulfilled); + + promise.cancel = function reject() { + token.unsubscribe(_resolve); + }; + + return promise; + }; + + executor(function cancel(message, config, request) { + if (token.reason) { + // Cancellation has already been requested + return; + } + + token.reason = new CanceledError(message, config, request); + resolvePromise(token.reason); + }); + } + + /** + * Throws a `CanceledError` if cancellation has been requested. + */ + throwIfRequested() { + if (this.reason) { + throw this.reason; + } + } + + /** + * Subscribe to the cancel signal + */ + + subscribe(listener) { + if (this.reason) { + listener(this.reason); + return; + } + + if (this._listeners) { + this._listeners.push(listener); + } else { + this._listeners = [listener]; + } + } + + /** + * Unsubscribe from the cancel signal + */ + + unsubscribe(listener) { + if (!this._listeners) { + return; + } + const index = this._listeners.indexOf(listener); + if (index !== -1) { + this._listeners.splice(index, 1); + } + } + + /** + * Returns an object that contains a new `CancelToken` and a function that, when called, + * cancels the `CancelToken`. + */ + static source() { + let cancel; + const token = new CancelToken(function executor(c) { + cancel = c; + }); + return { + token, + cancel + }; + } +} + +var CancelToken$1 = CancelToken; + +/** + * Syntactic sugar for invoking a function and expanding an array for arguments. + * + * Common use case would be to use `Function.prototype.apply`. + * + * ```js + * function f(x, y, z) {} + * var args = [1, 2, 3]; + * f.apply(null, args); + * ``` + * + * With `spread` this example can be re-written. + * + * ```js + * spread(function(x, y, z) {})([1, 2, 3]); + * ``` + * + * @param {Function} callback + * + * @returns {Function} + */ +function spread(callback) { + return function wrap(arr) { + return callback.apply(null, arr); + }; +} + +/** + * Determines whether the payload is an error thrown by Axios + * + * @param {*} payload The value to test + * + * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false + */ +function isAxiosError(payload) { + return utils$1.isObject(payload) && (payload.isAxiosError === true); +} + +const HttpStatusCode = { + Continue: 100, + SwitchingProtocols: 101, + Processing: 102, + EarlyHints: 103, + Ok: 200, + Created: 201, + Accepted: 202, + NonAuthoritativeInformation: 203, + NoContent: 204, + ResetContent: 205, + PartialContent: 206, + MultiStatus: 207, + AlreadyReported: 208, + ImUsed: 226, + MultipleChoices: 300, + MovedPermanently: 301, + Found: 302, + SeeOther: 303, + NotModified: 304, + UseProxy: 305, + Unused: 306, + TemporaryRedirect: 307, + PermanentRedirect: 308, + BadRequest: 400, + Unauthorized: 401, + PaymentRequired: 402, + Forbidden: 403, + NotFound: 404, + MethodNotAllowed: 405, + NotAcceptable: 406, + ProxyAuthenticationRequired: 407, + RequestTimeout: 408, + Conflict: 409, + Gone: 410, + LengthRequired: 411, + PreconditionFailed: 412, + PayloadTooLarge: 413, + UriTooLong: 414, + UnsupportedMediaType: 415, + RangeNotSatisfiable: 416, + ExpectationFailed: 417, + ImATeapot: 418, + MisdirectedRequest: 421, + UnprocessableEntity: 422, + Locked: 423, + FailedDependency: 424, + TooEarly: 425, + UpgradeRequired: 426, + PreconditionRequired: 428, + TooManyRequests: 429, + RequestHeaderFieldsTooLarge: 431, + UnavailableForLegalReasons: 451, + InternalServerError: 500, + NotImplemented: 501, + BadGateway: 502, + ServiceUnavailable: 503, + GatewayTimeout: 504, + HttpVersionNotSupported: 505, + VariantAlsoNegotiates: 506, + InsufficientStorage: 507, + LoopDetected: 508, + NotExtended: 510, + NetworkAuthenticationRequired: 511, +}; + +Object.entries(HttpStatusCode).forEach(([key, value]) => { + HttpStatusCode[value] = key; +}); + +var HttpStatusCode$1 = HttpStatusCode; + +/** + * Create an instance of Axios + * + * @param {Object} defaultConfig The default config for the instance + * + * @returns {Axios} A new instance of Axios + */ +function createInstance(defaultConfig) { + const context = new Axios$1(defaultConfig); + const instance = bind(Axios$1.prototype.request, context); + + // Copy axios.prototype to instance + utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true}); + + // Copy context to instance + utils$1.extend(instance, context, null, {allOwnKeys: true}); + + // Factory for creating new instances + instance.create = function create(instanceConfig) { + return createInstance(mergeConfig(defaultConfig, instanceConfig)); + }; + + return instance; +} + +// Create the default instance to be exported +const axios = createInstance(defaults$1); + +// Expose Axios class to allow class inheritance +axios.Axios = Axios$1; + +// Expose Cancel & CancelToken +axios.CanceledError = CanceledError; +axios.CancelToken = CancelToken$1; +axios.isCancel = isCancel; +axios.VERSION = VERSION; +axios.toFormData = toFormData; + +// Expose AxiosError class +axios.AxiosError = AxiosError; + +// alias for CanceledError for backward compatibility +axios.Cancel = axios.CanceledError; + +// Expose all/spread +axios.all = function all(promises) { + return Promise.all(promises); +}; + +axios.spread = spread; + +// Expose isAxiosError +axios.isAxiosError = isAxiosError; + +// Expose mergeConfig +axios.mergeConfig = mergeConfig; + +axios.AxiosHeaders = AxiosHeaders$1; + +axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing); + +axios.getAdapter = adapters.getAdapter; + +axios.HttpStatusCode = HttpStatusCode$1; + +axios.default = axios; + +module.exports = axios; +//# sourceMappingURL=axios.cjs.map diff --git a/project starter code/node_modules/axios/dist/browser/axios.cjs.map b/project starter code/node_modules/axios/dist/browser/axios.cjs.map new file mode 100644 index 00000000..b27fbf23 --- /dev/null +++ b/project starter code/node_modules/axios/dist/browser/axios.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"axios.cjs","sources":["../../lib/helpers/bind.js","../../lib/utils.js","../../lib/core/AxiosError.js","../../lib/helpers/null.js","../../lib/helpers/toFormData.js","../../lib/helpers/AxiosURLSearchParams.js","../../lib/helpers/buildURL.js","../../lib/core/InterceptorManager.js","../../lib/defaults/transitional.js","../../lib/platform/browser/classes/URLSearchParams.js","../../lib/platform/browser/classes/FormData.js","../../lib/platform/browser/classes/Blob.js","../../lib/platform/browser/index.js","../../lib/platform/common/utils.js","../../lib/platform/index.js","../../lib/helpers/toURLEncodedForm.js","../../lib/helpers/formDataToJSON.js","../../lib/defaults/index.js","../../lib/helpers/parseHeaders.js","../../lib/core/AxiosHeaders.js","../../lib/core/transformData.js","../../lib/cancel/isCancel.js","../../lib/cancel/CanceledError.js","../../lib/core/settle.js","../../lib/helpers/parseProtocol.js","../../lib/helpers/speedometer.js","../../lib/helpers/throttle.js","../../lib/helpers/progressEventReducer.js","../../lib/helpers/isURLSameOrigin.js","../../lib/helpers/cookies.js","../../lib/helpers/isAbsoluteURL.js","../../lib/helpers/combineURLs.js","../../lib/core/buildFullPath.js","../../lib/core/mergeConfig.js","../../lib/helpers/resolveConfig.js","../../lib/adapters/xhr.js","../../lib/helpers/composeSignals.js","../../lib/helpers/trackStream.js","../../lib/adapters/fetch.js","../../lib/adapters/adapters.js","../../lib/core/dispatchRequest.js","../../lib/env/data.js","../../lib/helpers/validator.js","../../lib/core/Axios.js","../../lib/cancel/CancelToken.js","../../lib/helpers/spread.js","../../lib/helpers/isAxiosError.js","../../lib/helpers/HttpStatusCode.js","../../lib/axios.js"],"sourcesContent":["'use strict';\n\nexport default function bind(fn, thisArg) {\n return function wrap() {\n return fn.apply(thisArg, arguments);\n };\n}\n","'use strict';\n\nimport bind from './helpers/bind.js';\n\n// utils is a library of generic helper functions non-specific to axios\n\nconst {toString} = Object.prototype;\nconst {getPrototypeOf} = Object;\n\nconst kindOf = (cache => thing => {\n const str = toString.call(thing);\n return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());\n})(Object.create(null));\n\nconst kindOfTest = (type) => {\n type = type.toLowerCase();\n return (thing) => kindOf(thing) === type\n}\n\nconst typeOfTest = type => thing => typeof thing === type;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n *\n * @returns {boolean} True if value is an Array, otherwise false\n */\nconst {isArray} = Array;\n\n/**\n * Determine if a value is undefined\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nconst isUndefined = typeOfTest('undefined');\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nconst isArrayBuffer = kindOfTest('ArrayBuffer');\n\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n let result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a String, otherwise false\n */\nconst isString = typeOfTest('string');\n\n/**\n * Determine if a value is a Function\n *\n * @param {*} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nconst isFunction = typeOfTest('function');\n\n/**\n * Determine if a value is a Number\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Number, otherwise false\n */\nconst isNumber = typeOfTest('number');\n\n/**\n * Determine if a value is an Object\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an Object, otherwise false\n */\nconst isObject = (thing) => thing !== null && typeof thing === 'object';\n\n/**\n * Determine if a value is a Boolean\n *\n * @param {*} thing The value to test\n * @returns {boolean} True if value is a Boolean, otherwise false\n */\nconst isBoolean = thing => thing === true || thing === false;\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a plain Object, otherwise false\n */\nconst isPlainObject = (val) => {\n if (kindOf(val) !== 'object') {\n return false;\n }\n\n const prototype = getPrototypeOf(val);\n return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Date, otherwise false\n */\nconst isDate = kindOfTest('Date');\n\n/**\n * Determine if a value is a File\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFile = kindOfTest('File');\n\n/**\n * Determine if a value is a Blob\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nconst isBlob = kindOfTest('Blob');\n\n/**\n * Determine if a value is a FileList\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFileList = kindOfTest('FileList');\n\n/**\n * Determine if a value is a Stream\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nconst isStream = (val) => isObject(val) && isFunction(val.pipe);\n\n/**\n * Determine if a value is a FormData\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nconst isFormData = (thing) => {\n let kind;\n return thing && (\n (typeof FormData === 'function' && thing instanceof FormData) || (\n isFunction(thing.append) && (\n (kind = kindOf(thing)) === 'formdata' ||\n // detect form-data instance\n (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')\n )\n )\n )\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nconst isURLSearchParams = kindOfTest('URLSearchParams');\n\nconst [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n *\n * @returns {String} The String freed of excess whitespace\n */\nconst trim = (str) => str.trim ?\n str.trim() : str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n *\n * @param {Boolean} [allOwnKeys = false]\n * @returns {any}\n */\nfunction forEach(obj, fn, {allOwnKeys = false} = {}) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n let i;\n let l;\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);\n const len = keys.length;\n let key;\n\n for (i = 0; i < len; i++) {\n key = keys[i];\n fn.call(null, obj[key], key, obj);\n }\n }\n}\n\nfunction findKey(obj, key) {\n key = key.toLowerCase();\n const keys = Object.keys(obj);\n let i = keys.length;\n let _key;\n while (i-- > 0) {\n _key = keys[i];\n if (key === _key.toLowerCase()) {\n return _key;\n }\n }\n return null;\n}\n\nconst _global = (() => {\n /*eslint no-undef:0*/\n if (typeof globalThis !== \"undefined\") return globalThis;\n return typeof self !== \"undefined\" ? self : (typeof window !== 'undefined' ? window : global)\n})();\n\nconst isContextDefined = (context) => !isUndefined(context) && context !== _global;\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n *\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n const {caseless} = isContextDefined(this) && this || {};\n const result = {};\n const assignValue = (val, key) => {\n const targetKey = caseless && findKey(result, key) || key;\n if (isPlainObject(result[targetKey]) && isPlainObject(val)) {\n result[targetKey] = merge(result[targetKey], val);\n } else if (isPlainObject(val)) {\n result[targetKey] = merge({}, val);\n } else if (isArray(val)) {\n result[targetKey] = val.slice();\n } else {\n result[targetKey] = val;\n }\n }\n\n for (let i = 0, l = arguments.length; i < l; i++) {\n arguments[i] && forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n *\n * @param {Boolean} [allOwnKeys]\n * @returns {Object} The resulting value of object a\n */\nconst extend = (a, b, thisArg, {allOwnKeys}= {}) => {\n forEach(b, (val, key) => {\n if (thisArg && isFunction(val)) {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n }, {allOwnKeys});\n return a;\n}\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n *\n * @returns {string} content value without BOM\n */\nconst stripBOM = (content) => {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n}\n\n/**\n * Inherit the prototype methods from one constructor into another\n * @param {function} constructor\n * @param {function} superConstructor\n * @param {object} [props]\n * @param {object} [descriptors]\n *\n * @returns {void}\n */\nconst inherits = (constructor, superConstructor, props, descriptors) => {\n constructor.prototype = Object.create(superConstructor.prototype, descriptors);\n constructor.prototype.constructor = constructor;\n Object.defineProperty(constructor, 'super', {\n value: superConstructor.prototype\n });\n props && Object.assign(constructor.prototype, props);\n}\n\n/**\n * Resolve object with deep prototype chain to a flat object\n * @param {Object} sourceObj source object\n * @param {Object} [destObj]\n * @param {Function|Boolean} [filter]\n * @param {Function} [propFilter]\n *\n * @returns {Object}\n */\nconst toFlatObject = (sourceObj, destObj, filter, propFilter) => {\n let props;\n let i;\n let prop;\n const merged = {};\n\n destObj = destObj || {};\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (sourceObj == null) return destObj;\n\n do {\n props = Object.getOwnPropertyNames(sourceObj);\n i = props.length;\n while (i-- > 0) {\n prop = props[i];\n if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {\n destObj[prop] = sourceObj[prop];\n merged[prop] = true;\n }\n }\n sourceObj = filter !== false && getPrototypeOf(sourceObj);\n } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);\n\n return destObj;\n}\n\n/**\n * Determines whether a string ends with the characters of a specified string\n *\n * @param {String} str\n * @param {String} searchString\n * @param {Number} [position= 0]\n *\n * @returns {boolean}\n */\nconst endsWith = (str, searchString, position) => {\n str = String(str);\n if (position === undefined || position > str.length) {\n position = str.length;\n }\n position -= searchString.length;\n const lastIndex = str.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n}\n\n\n/**\n * Returns new array from array like object or null if failed\n *\n * @param {*} [thing]\n *\n * @returns {?Array}\n */\nconst toArray = (thing) => {\n if (!thing) return null;\n if (isArray(thing)) return thing;\n let i = thing.length;\n if (!isNumber(i)) return null;\n const arr = new Array(i);\n while (i-- > 0) {\n arr[i] = thing[i];\n }\n return arr;\n}\n\n/**\n * Checking if the Uint8Array exists and if it does, it returns a function that checks if the\n * thing passed in is an instance of Uint8Array\n *\n * @param {TypedArray}\n *\n * @returns {Array}\n */\n// eslint-disable-next-line func-names\nconst isTypedArray = (TypedArray => {\n // eslint-disable-next-line func-names\n return thing => {\n return TypedArray && thing instanceof TypedArray;\n };\n})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));\n\n/**\n * For each entry in the object, call the function with the key and value.\n *\n * @param {Object} obj - The object to iterate over.\n * @param {Function} fn - The function to call for each entry.\n *\n * @returns {void}\n */\nconst forEachEntry = (obj, fn) => {\n const generator = obj && obj[Symbol.iterator];\n\n const iterator = generator.call(obj);\n\n let result;\n\n while ((result = iterator.next()) && !result.done) {\n const pair = result.value;\n fn.call(obj, pair[0], pair[1]);\n }\n}\n\n/**\n * It takes a regular expression and a string, and returns an array of all the matches\n *\n * @param {string} regExp - The regular expression to match against.\n * @param {string} str - The string to search.\n *\n * @returns {Array}\n */\nconst matchAll = (regExp, str) => {\n let matches;\n const arr = [];\n\n while ((matches = regExp.exec(str)) !== null) {\n arr.push(matches);\n }\n\n return arr;\n}\n\n/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */\nconst isHTMLForm = kindOfTest('HTMLFormElement');\n\nconst toCamelCase = str => {\n return str.toLowerCase().replace(/[-_\\s]([a-z\\d])(\\w*)/g,\n function replacer(m, p1, p2) {\n return p1.toUpperCase() + p2;\n }\n );\n};\n\n/* Creating a function that will check if an object has a property. */\nconst hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);\n\n/**\n * Determine if a value is a RegExp object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a RegExp object, otherwise false\n */\nconst isRegExp = kindOfTest('RegExp');\n\nconst reduceDescriptors = (obj, reducer) => {\n const descriptors = Object.getOwnPropertyDescriptors(obj);\n const reducedDescriptors = {};\n\n forEach(descriptors, (descriptor, name) => {\n let ret;\n if ((ret = reducer(descriptor, name, obj)) !== false) {\n reducedDescriptors[name] = ret || descriptor;\n }\n });\n\n Object.defineProperties(obj, reducedDescriptors);\n}\n\n/**\n * Makes all methods read-only\n * @param {Object} obj\n */\n\nconst freezeMethods = (obj) => {\n reduceDescriptors(obj, (descriptor, name) => {\n // skip restricted props in strict mode\n if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {\n return false;\n }\n\n const value = obj[name];\n\n if (!isFunction(value)) return;\n\n descriptor.enumerable = false;\n\n if ('writable' in descriptor) {\n descriptor.writable = false;\n return;\n }\n\n if (!descriptor.set) {\n descriptor.set = () => {\n throw Error('Can not rewrite read-only method \\'' + name + '\\'');\n };\n }\n });\n}\n\nconst toObjectSet = (arrayOrString, delimiter) => {\n const obj = {};\n\n const define = (arr) => {\n arr.forEach(value => {\n obj[value] = true;\n });\n }\n\n isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));\n\n return obj;\n}\n\nconst noop = () => {}\n\nconst toFiniteNumber = (value, defaultValue) => {\n return value != null && Number.isFinite(value = +value) ? value : defaultValue;\n}\n\nconst ALPHA = 'abcdefghijklmnopqrstuvwxyz'\n\nconst DIGIT = '0123456789';\n\nconst ALPHABET = {\n DIGIT,\n ALPHA,\n ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT\n}\n\nconst generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {\n let str = '';\n const {length} = alphabet;\n while (size--) {\n str += alphabet[Math.random() * length|0]\n }\n\n return str;\n}\n\n/**\n * If the thing is a FormData object, return true, otherwise return false.\n *\n * @param {unknown} thing - The thing to check.\n *\n * @returns {boolean}\n */\nfunction isSpecCompliantForm(thing) {\n return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);\n}\n\nconst toJSONObject = (obj) => {\n const stack = new Array(10);\n\n const visit = (source, i) => {\n\n if (isObject(source)) {\n if (stack.indexOf(source) >= 0) {\n return;\n }\n\n if(!('toJSON' in source)) {\n stack[i] = source;\n const target = isArray(source) ? [] : {};\n\n forEach(source, (value, key) => {\n const reducedValue = visit(value, i + 1);\n !isUndefined(reducedValue) && (target[key] = reducedValue);\n });\n\n stack[i] = undefined;\n\n return target;\n }\n }\n\n return source;\n }\n\n return visit(obj, 0);\n}\n\nconst isAsyncFn = kindOfTest('AsyncFunction');\n\nconst isThenable = (thing) =>\n thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);\n\nexport default {\n isArray,\n isArrayBuffer,\n isBuffer,\n isFormData,\n isArrayBufferView,\n isString,\n isNumber,\n isBoolean,\n isObject,\n isPlainObject,\n isReadableStream,\n isRequest,\n isResponse,\n isHeaders,\n isUndefined,\n isDate,\n isFile,\n isBlob,\n isRegExp,\n isFunction,\n isStream,\n isURLSearchParams,\n isTypedArray,\n isFileList,\n forEach,\n merge,\n extend,\n trim,\n stripBOM,\n inherits,\n toFlatObject,\n kindOf,\n kindOfTest,\n endsWith,\n toArray,\n forEachEntry,\n matchAll,\n isHTMLForm,\n hasOwnProperty,\n hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection\n reduceDescriptors,\n freezeMethods,\n toObjectSet,\n toCamelCase,\n noop,\n toFiniteNumber,\n findKey,\n global: _global,\n isContextDefined,\n ALPHABET,\n generateString,\n isSpecCompliantForm,\n toJSONObject,\n isAsyncFn,\n isThenable\n};\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [config] The config.\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n *\n * @returns {Error} The created error.\n */\nfunction AxiosError(message, code, config, request, response) {\n Error.call(this);\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n this.stack = (new Error()).stack;\n }\n\n this.message = message;\n this.name = 'AxiosError';\n code && (this.code = code);\n config && (this.config = config);\n request && (this.request = request);\n response && (this.response = response);\n}\n\nutils.inherits(AxiosError, Error, {\n toJSON: function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: utils.toJSONObject(this.config),\n code: this.code,\n status: this.response && this.response.status ? this.response.status : null\n };\n }\n});\n\nconst prototype = AxiosError.prototype;\nconst descriptors = {};\n\n[\n 'ERR_BAD_OPTION_VALUE',\n 'ERR_BAD_OPTION',\n 'ECONNABORTED',\n 'ETIMEDOUT',\n 'ERR_NETWORK',\n 'ERR_FR_TOO_MANY_REDIRECTS',\n 'ERR_DEPRECATED',\n 'ERR_BAD_RESPONSE',\n 'ERR_BAD_REQUEST',\n 'ERR_CANCELED',\n 'ERR_NOT_SUPPORT',\n 'ERR_INVALID_URL'\n// eslint-disable-next-line func-names\n].forEach(code => {\n descriptors[code] = {value: code};\n});\n\nObject.defineProperties(AxiosError, descriptors);\nObject.defineProperty(prototype, 'isAxiosError', {value: true});\n\n// eslint-disable-next-line func-names\nAxiosError.from = (error, code, config, request, response, customProps) => {\n const axiosError = Object.create(prototype);\n\n utils.toFlatObject(error, axiosError, function filter(obj) {\n return obj !== Error.prototype;\n }, prop => {\n return prop !== 'isAxiosError';\n });\n\n AxiosError.call(axiosError, error.message, code, config, request, response);\n\n axiosError.cause = error;\n\n axiosError.name = error.name;\n\n customProps && Object.assign(axiosError, customProps);\n\n return axiosError;\n};\n\nexport default AxiosError;\n","// eslint-disable-next-line strict\nexport default null;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\n// temporary hotfix to avoid circular references until AxiosURLSearchParams is refactored\nimport PlatformFormData from '../platform/node/classes/FormData.js';\n\n/**\n * Determines if the given thing is a array or js object.\n *\n * @param {string} thing - The object or array to be visited.\n *\n * @returns {boolean}\n */\nfunction isVisitable(thing) {\n return utils.isPlainObject(thing) || utils.isArray(thing);\n}\n\n/**\n * It removes the brackets from the end of a string\n *\n * @param {string} key - The key of the parameter.\n *\n * @returns {string} the key without the brackets.\n */\nfunction removeBrackets(key) {\n return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;\n}\n\n/**\n * It takes a path, a key, and a boolean, and returns a string\n *\n * @param {string} path - The path to the current key.\n * @param {string} key - The key of the current object being iterated over.\n * @param {string} dots - If true, the key will be rendered with dots instead of brackets.\n *\n * @returns {string} The path to the current key.\n */\nfunction renderKey(path, key, dots) {\n if (!path) return key;\n return path.concat(key).map(function each(token, i) {\n // eslint-disable-next-line no-param-reassign\n token = removeBrackets(token);\n return !dots && i ? '[' + token + ']' : token;\n }).join(dots ? '.' : '');\n}\n\n/**\n * If the array is an array and none of its elements are visitable, then it's a flat array.\n *\n * @param {Array} arr - The array to check\n *\n * @returns {boolean}\n */\nfunction isFlatArray(arr) {\n return utils.isArray(arr) && !arr.some(isVisitable);\n}\n\nconst predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {\n return /^is[A-Z]/.test(prop);\n});\n\n/**\n * Convert a data object to FormData\n *\n * @param {Object} obj\n * @param {?Object} [formData]\n * @param {?Object} [options]\n * @param {Function} [options.visitor]\n * @param {Boolean} [options.metaTokens = true]\n * @param {Boolean} [options.dots = false]\n * @param {?Boolean} [options.indexes = false]\n *\n * @returns {Object}\n **/\n\n/**\n * It converts an object into a FormData object\n *\n * @param {Object} obj - The object to convert to form data.\n * @param {string} formData - The FormData object to append to.\n * @param {Object} options\n *\n * @returns\n */\nfunction toFormData(obj, formData, options) {\n if (!utils.isObject(obj)) {\n throw new TypeError('target must be an object');\n }\n\n // eslint-disable-next-line no-param-reassign\n formData = formData || new (PlatformFormData || FormData)();\n\n // eslint-disable-next-line no-param-reassign\n options = utils.toFlatObject(options, {\n metaTokens: true,\n dots: false,\n indexes: false\n }, false, function defined(option, source) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n return !utils.isUndefined(source[option]);\n });\n\n const metaTokens = options.metaTokens;\n // eslint-disable-next-line no-use-before-define\n const visitor = options.visitor || defaultVisitor;\n const dots = options.dots;\n const indexes = options.indexes;\n const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;\n const useBlob = _Blob && utils.isSpecCompliantForm(formData);\n\n if (!utils.isFunction(visitor)) {\n throw new TypeError('visitor must be a function');\n }\n\n function convertValue(value) {\n if (value === null) return '';\n\n if (utils.isDate(value)) {\n return value.toISOString();\n }\n\n if (!useBlob && utils.isBlob(value)) {\n throw new AxiosError('Blob is not supported. Use a Buffer instead.');\n }\n\n if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {\n return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);\n }\n\n return value;\n }\n\n /**\n * Default visitor.\n *\n * @param {*} value\n * @param {String|Number} key\n * @param {Array} path\n * @this {FormData}\n *\n * @returns {boolean} return true to visit the each prop of the value recursively\n */\n function defaultVisitor(value, key, path) {\n let arr = value;\n\n if (value && !path && typeof value === 'object') {\n if (utils.endsWith(key, '{}')) {\n // eslint-disable-next-line no-param-reassign\n key = metaTokens ? key : key.slice(0, -2);\n // eslint-disable-next-line no-param-reassign\n value = JSON.stringify(value);\n } else if (\n (utils.isArray(value) && isFlatArray(value)) ||\n ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))\n )) {\n // eslint-disable-next-line no-param-reassign\n key = removeBrackets(key);\n\n arr.forEach(function each(el, index) {\n !(utils.isUndefined(el) || el === null) && formData.append(\n // eslint-disable-next-line no-nested-ternary\n indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),\n convertValue(el)\n );\n });\n return false;\n }\n }\n\n if (isVisitable(value)) {\n return true;\n }\n\n formData.append(renderKey(path, key, dots), convertValue(value));\n\n return false;\n }\n\n const stack = [];\n\n const exposedHelpers = Object.assign(predicates, {\n defaultVisitor,\n convertValue,\n isVisitable\n });\n\n function build(value, path) {\n if (utils.isUndefined(value)) return;\n\n if (stack.indexOf(value) !== -1) {\n throw Error('Circular reference detected in ' + path.join('.'));\n }\n\n stack.push(value);\n\n utils.forEach(value, function each(el, key) {\n const result = !(utils.isUndefined(el) || el === null) && visitor.call(\n formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers\n );\n\n if (result === true) {\n build(el, path ? path.concat(key) : [key]);\n }\n });\n\n stack.pop();\n }\n\n if (!utils.isObject(obj)) {\n throw new TypeError('data must be an object');\n }\n\n build(obj);\n\n return formData;\n}\n\nexport default toFormData;\n","'use strict';\n\nimport toFormData from './toFormData.js';\n\n/**\n * It encodes a string by replacing all characters that are not in the unreserved set with\n * their percent-encoded equivalents\n *\n * @param {string} str - The string to encode.\n *\n * @returns {string} The encoded string.\n */\nfunction encode(str) {\n const charMap = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n '%00': '\\x00'\n };\n return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {\n return charMap[match];\n });\n}\n\n/**\n * It takes a params object and converts it to a FormData object\n *\n * @param {Object} params - The parameters to be converted to a FormData object.\n * @param {Object} options - The options object passed to the Axios constructor.\n *\n * @returns {void}\n */\nfunction AxiosURLSearchParams(params, options) {\n this._pairs = [];\n\n params && toFormData(params, this, options);\n}\n\nconst prototype = AxiosURLSearchParams.prototype;\n\nprototype.append = function append(name, value) {\n this._pairs.push([name, value]);\n};\n\nprototype.toString = function toString(encoder) {\n const _encode = encoder ? function(value) {\n return encoder.call(this, value, encode);\n } : encode;\n\n return this._pairs.map(function each(pair) {\n return _encode(pair[0]) + '=' + _encode(pair[1]);\n }, '').join('&');\n};\n\nexport default AxiosURLSearchParams;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js';\n\n/**\n * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their\n * URI encoded counterparts\n *\n * @param {string} val The value to be encoded.\n *\n * @returns {string} The encoded value.\n */\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @param {?object} options\n *\n * @returns {string} The formatted url\n */\nexport default function buildURL(url, params, options) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n \n const _encode = options && options.encode || encode;\n\n const serializeFn = options && options.serialize;\n\n let serializedParams;\n\n if (serializeFn) {\n serializedParams = serializeFn(params, options);\n } else {\n serializedParams = utils.isURLSearchParams(params) ?\n params.toString() :\n new AxiosURLSearchParams(params, options).toString(_encode);\n }\n\n if (serializedParams) {\n const hashmarkIndex = url.indexOf(\"#\");\n\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\nclass InterceptorManager {\n constructor() {\n this.handlers = [];\n }\n\n /**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\n use(fulfilled, rejected, options) {\n this.handlers.push({\n fulfilled,\n rejected,\n synchronous: options ? options.synchronous : false,\n runWhen: options ? options.runWhen : null\n });\n return this.handlers.length - 1;\n }\n\n /**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n *\n * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise\n */\n eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n }\n\n /**\n * Clear all interceptors from the stack\n *\n * @returns {void}\n */\n clear() {\n if (this.handlers) {\n this.handlers = [];\n }\n }\n\n /**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n *\n * @returns {void}\n */\n forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n }\n}\n\nexport default InterceptorManager;\n","'use strict';\n\nexport default {\n silentJSONParsing: true,\n forcedJSONParsing: true,\n clarifyTimeoutError: false\n};\n","'use strict';\n\nimport AxiosURLSearchParams from '../../../helpers/AxiosURLSearchParams.js';\nexport default typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;\n","'use strict';\n\nexport default typeof FormData !== 'undefined' ? FormData : null;\n","'use strict'\n\nexport default typeof Blob !== 'undefined' ? Blob : null\n","import URLSearchParams from './classes/URLSearchParams.js'\nimport FormData from './classes/FormData.js'\nimport Blob from './classes/Blob.js'\n\nexport default {\n isBrowser: true,\n classes: {\n URLSearchParams,\n FormData,\n Blob\n },\n protocols: ['http', 'https', 'file', 'blob', 'url', 'data']\n};\n","const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n *\n * @returns {boolean}\n */\nconst hasStandardBrowserEnv = (\n (product) => {\n return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0\n })(typeof navigator !== 'undefined' && navigator.product);\n\n/**\n * Determine if we're running in a standard browser webWorker environment\n *\n * Although the `isStandardBrowserEnv` method indicates that\n * `allows axios to run in a web worker`, the WebWorker will still be\n * filtered out due to its judgment standard\n * `typeof window !== 'undefined' && typeof document !== 'undefined'`.\n * This leads to a problem when axios post `FormData` in webWorker\n */\nconst hasStandardBrowserWebWorkerEnv = (() => {\n return (\n typeof WorkerGlobalScope !== 'undefined' &&\n // eslint-disable-next-line no-undef\n self instanceof WorkerGlobalScope &&\n typeof self.importScripts === 'function'\n );\n})();\n\nconst origin = hasBrowserEnv && window.location.href || 'http://localhost';\n\nexport {\n hasBrowserEnv,\n hasStandardBrowserWebWorkerEnv,\n hasStandardBrowserEnv,\n origin\n}\n","import platform from './node/index.js';\nimport * as utils from './common/utils.js';\n\nexport default {\n ...utils,\n ...platform\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport toFormData from './toFormData.js';\nimport platform from '../platform/index.js';\n\nexport default function toURLEncodedForm(data, options) {\n return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({\n visitor: function(value, key, path, helpers) {\n if (platform.isNode && utils.isBuffer(value)) {\n this.append(key, value.toString('base64'));\n return false;\n }\n\n return helpers.defaultVisitor.apply(this, arguments);\n }\n }, options));\n}\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']\n *\n * @param {string} name - The name of the property to get.\n *\n * @returns An array of strings.\n */\nfunction parsePropPath(name) {\n // foo[x][y][z]\n // foo.x.y.z\n // foo-x-y-z\n // foo x y z\n return utils.matchAll(/\\w+|\\[(\\w*)]/g, name).map(match => {\n return match[0] === '[]' ? '' : match[1] || match[0];\n });\n}\n\n/**\n * Convert an array to an object.\n *\n * @param {Array} arr - The array to convert to an object.\n *\n * @returns An object with the same keys and values as the array.\n */\nfunction arrayToObject(arr) {\n const obj = {};\n const keys = Object.keys(arr);\n let i;\n const len = keys.length;\n let key;\n for (i = 0; i < len; i++) {\n key = keys[i];\n obj[key] = arr[key];\n }\n return obj;\n}\n\n/**\n * It takes a FormData object and returns a JavaScript object\n *\n * @param {string} formData The FormData object to convert to JSON.\n *\n * @returns {Object | null} The converted object.\n */\nfunction formDataToJSON(formData) {\n function buildPath(path, value, target, index) {\n let name = path[index++];\n\n if (name === '__proto__') return true;\n\n const isNumericKey = Number.isFinite(+name);\n const isLast = index >= path.length;\n name = !name && utils.isArray(target) ? target.length : name;\n\n if (isLast) {\n if (utils.hasOwnProp(target, name)) {\n target[name] = [target[name], value];\n } else {\n target[name] = value;\n }\n\n return !isNumericKey;\n }\n\n if (!target[name] || !utils.isObject(target[name])) {\n target[name] = [];\n }\n\n const result = buildPath(path, value, target[name], index);\n\n if (result && utils.isArray(target[name])) {\n target[name] = arrayToObject(target[name]);\n }\n\n return !isNumericKey;\n }\n\n if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {\n const obj = {};\n\n utils.forEachEntry(formData, (name, value) => {\n buildPath(parsePropPath(name), value, obj, 0);\n });\n\n return obj;\n }\n\n return null;\n}\n\nexport default formDataToJSON;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\nimport transitionalDefaults from './transitional.js';\nimport toFormData from '../helpers/toFormData.js';\nimport toURLEncodedForm from '../helpers/toURLEncodedForm.js';\nimport platform from '../platform/index.js';\nimport formDataToJSON from '../helpers/formDataToJSON.js';\n\n/**\n * It takes a string, tries to parse it, and if it fails, it returns the stringified version\n * of the input\n *\n * @param {any} rawValue - The value to be stringified.\n * @param {Function} parser - A function that parses a string into a JavaScript object.\n * @param {Function} encoder - A function that takes a value and returns a string.\n *\n * @returns {string} A stringified version of the rawValue.\n */\nfunction stringifySafely(rawValue, parser, encoder) {\n if (utils.isString(rawValue)) {\n try {\n (parser || JSON.parse)(rawValue);\n return utils.trim(rawValue);\n } catch (e) {\n if (e.name !== 'SyntaxError') {\n throw e;\n }\n }\n }\n\n return (encoder || JSON.stringify)(rawValue);\n}\n\nconst defaults = {\n\n transitional: transitionalDefaults,\n\n adapter: ['xhr', 'http', 'fetch'],\n\n transformRequest: [function transformRequest(data, headers) {\n const contentType = headers.getContentType() || '';\n const hasJSONContentType = contentType.indexOf('application/json') > -1;\n const isObjectPayload = utils.isObject(data);\n\n if (isObjectPayload && utils.isHTMLForm(data)) {\n data = new FormData(data);\n }\n\n const isFormData = utils.isFormData(data);\n\n if (isFormData) {\n return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;\n }\n\n if (utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data) ||\n utils.isReadableStream(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);\n return data.toString();\n }\n\n let isFileList;\n\n if (isObjectPayload) {\n if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {\n return toURLEncodedForm(data, this.formSerializer).toString();\n }\n\n if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {\n const _FormData = this.env && this.env.FormData;\n\n return toFormData(\n isFileList ? {'files[]': data} : data,\n _FormData && new _FormData(),\n this.formSerializer\n );\n }\n }\n\n if (isObjectPayload || hasJSONContentType ) {\n headers.setContentType('application/json', false);\n return stringifySafely(data);\n }\n\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n const transitional = this.transitional || defaults.transitional;\n const forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n const JSONRequested = this.responseType === 'json';\n\n if (utils.isResponse(data) || utils.isReadableStream(data)) {\n return data;\n }\n\n if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {\n const silentJSONParsing = transitional && transitional.silentJSONParsing;\n const strictJSONParsing = !silentJSONParsing && JSONRequested;\n\n try {\n return JSON.parse(data);\n } catch (e) {\n if (strictJSONParsing) {\n if (e.name === 'SyntaxError') {\n throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);\n }\n throw e;\n }\n }\n }\n\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n env: {\n FormData: platform.classes.FormData,\n Blob: platform.classes.Blob\n },\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n },\n\n headers: {\n common: {\n 'Accept': 'application/json, text/plain, */*',\n 'Content-Type': undefined\n }\n }\n};\n\nutils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {\n defaults.headers[method] = {};\n});\n\nexport default defaults;\n","'use strict';\n\nimport utils from './../utils.js';\n\n// RawAxiosHeaders whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nconst ignoreDuplicateOf = utils.toObjectSet([\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n]);\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} rawHeaders Headers needing to be parsed\n *\n * @returns {Object} Headers parsed into an object\n */\nexport default rawHeaders => {\n const parsed = {};\n let key;\n let val;\n let i;\n\n rawHeaders && rawHeaders.split('\\n').forEach(function parser(line) {\n i = line.indexOf(':');\n key = line.substring(0, i).trim().toLowerCase();\n val = line.substring(i + 1).trim();\n\n if (!key || (parsed[key] && ignoreDuplicateOf[key])) {\n return;\n }\n\n if (key === 'set-cookie') {\n if (parsed[key]) {\n parsed[key].push(val);\n } else {\n parsed[key] = [val];\n }\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n });\n\n return parsed;\n};\n","'use strict';\n\nimport utils from '../utils.js';\nimport parseHeaders from '../helpers/parseHeaders.js';\n\nconst $internals = Symbol('internals');\n\nfunction normalizeHeader(header) {\n return header && String(header).trim().toLowerCase();\n}\n\nfunction normalizeValue(value) {\n if (value === false || value == null) {\n return value;\n }\n\n return utils.isArray(value) ? value.map(normalizeValue) : String(value);\n}\n\nfunction parseTokens(str) {\n const tokens = Object.create(null);\n const tokensRE = /([^\\s,;=]+)\\s*(?:=\\s*([^,;]+))?/g;\n let match;\n\n while ((match = tokensRE.exec(str))) {\n tokens[match[1]] = match[2];\n }\n\n return tokens;\n}\n\nconst isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());\n\nfunction matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {\n if (utils.isFunction(filter)) {\n return filter.call(this, value, header);\n }\n\n if (isHeaderNameFilter) {\n value = header;\n }\n\n if (!utils.isString(value)) return;\n\n if (utils.isString(filter)) {\n return value.indexOf(filter) !== -1;\n }\n\n if (utils.isRegExp(filter)) {\n return filter.test(value);\n }\n}\n\nfunction formatHeader(header) {\n return header.trim()\n .toLowerCase().replace(/([a-z\\d])(\\w*)/g, (w, char, str) => {\n return char.toUpperCase() + str;\n });\n}\n\nfunction buildAccessors(obj, header) {\n const accessorName = utils.toCamelCase(' ' + header);\n\n ['get', 'set', 'has'].forEach(methodName => {\n Object.defineProperty(obj, methodName + accessorName, {\n value: function(arg1, arg2, arg3) {\n return this[methodName].call(this, header, arg1, arg2, arg3);\n },\n configurable: true\n });\n });\n}\n\nclass AxiosHeaders {\n constructor(headers) {\n headers && this.set(headers);\n }\n\n set(header, valueOrRewrite, rewrite) {\n const self = this;\n\n function setHeader(_value, _header, _rewrite) {\n const lHeader = normalizeHeader(_header);\n\n if (!lHeader) {\n throw new Error('header name must be a non-empty string');\n }\n\n const key = utils.findKey(self, lHeader);\n\n if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {\n self[key || _header] = normalizeValue(_value);\n }\n }\n\n const setHeaders = (headers, _rewrite) =>\n utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));\n\n if (utils.isPlainObject(header) || header instanceof this.constructor) {\n setHeaders(header, valueOrRewrite)\n } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {\n setHeaders(parseHeaders(header), valueOrRewrite);\n } else if (utils.isHeaders(header)) {\n for (const [key, value] of header.entries()) {\n setHeader(value, key, rewrite);\n }\n } else {\n header != null && setHeader(valueOrRewrite, header, rewrite);\n }\n\n return this;\n }\n\n get(header, parser) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n if (key) {\n const value = this[key];\n\n if (!parser) {\n return value;\n }\n\n if (parser === true) {\n return parseTokens(value);\n }\n\n if (utils.isFunction(parser)) {\n return parser.call(this, value, key);\n }\n\n if (utils.isRegExp(parser)) {\n return parser.exec(value);\n }\n\n throw new TypeError('parser must be boolean|regexp|function');\n }\n }\n }\n\n has(header, matcher) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));\n }\n\n return false;\n }\n\n delete(header, matcher) {\n const self = this;\n let deleted = false;\n\n function deleteHeader(_header) {\n _header = normalizeHeader(_header);\n\n if (_header) {\n const key = utils.findKey(self, _header);\n\n if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {\n delete self[key];\n\n deleted = true;\n }\n }\n }\n\n if (utils.isArray(header)) {\n header.forEach(deleteHeader);\n } else {\n deleteHeader(header);\n }\n\n return deleted;\n }\n\n clear(matcher) {\n const keys = Object.keys(this);\n let i = keys.length;\n let deleted = false;\n\n while (i--) {\n const key = keys[i];\n if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {\n delete this[key];\n deleted = true;\n }\n }\n\n return deleted;\n }\n\n normalize(format) {\n const self = this;\n const headers = {};\n\n utils.forEach(this, (value, header) => {\n const key = utils.findKey(headers, header);\n\n if (key) {\n self[key] = normalizeValue(value);\n delete self[header];\n return;\n }\n\n const normalized = format ? formatHeader(header) : String(header).trim();\n\n if (normalized !== header) {\n delete self[header];\n }\n\n self[normalized] = normalizeValue(value);\n\n headers[normalized] = true;\n });\n\n return this;\n }\n\n concat(...targets) {\n return this.constructor.concat(this, ...targets);\n }\n\n toJSON(asStrings) {\n const obj = Object.create(null);\n\n utils.forEach(this, (value, header) => {\n value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);\n });\n\n return obj;\n }\n\n [Symbol.iterator]() {\n return Object.entries(this.toJSON())[Symbol.iterator]();\n }\n\n toString() {\n return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\\n');\n }\n\n get [Symbol.toStringTag]() {\n return 'AxiosHeaders';\n }\n\n static from(thing) {\n return thing instanceof this ? thing : new this(thing);\n }\n\n static concat(first, ...targets) {\n const computed = new this(first);\n\n targets.forEach((target) => computed.set(target));\n\n return computed;\n }\n\n static accessor(header) {\n const internals = this[$internals] = (this[$internals] = {\n accessors: {}\n });\n\n const accessors = internals.accessors;\n const prototype = this.prototype;\n\n function defineAccessor(_header) {\n const lHeader = normalizeHeader(_header);\n\n if (!accessors[lHeader]) {\n buildAccessors(prototype, _header);\n accessors[lHeader] = true;\n }\n }\n\n utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);\n\n return this;\n }\n}\n\nAxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);\n\n// reserved names hotfix\nutils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {\n let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`\n return {\n get: () => value,\n set(headerValue) {\n this[mapped] = headerValue;\n }\n }\n});\n\nutils.freezeMethods(AxiosHeaders);\n\nexport default AxiosHeaders;\n","'use strict';\n\nimport utils from './../utils.js';\nimport defaults from '../defaults/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Array|Function} fns A single function or Array of functions\n * @param {?Object} response The response object\n *\n * @returns {*} The resulting transformed data\n */\nexport default function transformData(fns, response) {\n const config = this || defaults;\n const context = response || config;\n const headers = AxiosHeaders.from(context.headers);\n let data = context.data;\n\n utils.forEach(fns, function transform(fn) {\n data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);\n });\n\n headers.normalize();\n\n return data;\n}\n","'use strict';\n\nexport default function isCancel(value) {\n return !!(value && value.__CANCEL__);\n}\n","'use strict';\n\nimport AxiosError from '../core/AxiosError.js';\nimport utils from '../utils.js';\n\n/**\n * A `CanceledError` is an object that is thrown when an operation is canceled.\n *\n * @param {string=} message The message.\n * @param {Object=} config The config.\n * @param {Object=} request The request.\n *\n * @returns {CanceledError} The created error.\n */\nfunction CanceledError(message, config, request) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);\n this.name = 'CanceledError';\n}\n\nutils.inherits(CanceledError, AxiosError, {\n __CANCEL__: true\n});\n\nexport default CanceledError;\n","'use strict';\n\nimport AxiosError from './AxiosError.js';\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n *\n * @returns {object} The response.\n */\nexport default function settle(resolve, reject, response) {\n const validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(new AxiosError(\n 'Request failed with status code ' + response.status,\n [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],\n response.config,\n response.request,\n response\n ));\n }\n}\n","'use strict';\n\nexport default function parseProtocol(url) {\n const match = /^([-+\\w]{1,25})(:?\\/\\/|:)/.exec(url);\n return match && match[1] || '';\n}\n","'use strict';\n\n/**\n * Calculate data maxRate\n * @param {Number} [samplesCount= 10]\n * @param {Number} [min= 1000]\n * @returns {Function}\n */\nfunction speedometer(samplesCount, min) {\n samplesCount = samplesCount || 10;\n const bytes = new Array(samplesCount);\n const timestamps = new Array(samplesCount);\n let head = 0;\n let tail = 0;\n let firstSampleTS;\n\n min = min !== undefined ? min : 1000;\n\n return function push(chunkLength) {\n const now = Date.now();\n\n const startedAt = timestamps[tail];\n\n if (!firstSampleTS) {\n firstSampleTS = now;\n }\n\n bytes[head] = chunkLength;\n timestamps[head] = now;\n\n let i = tail;\n let bytesCount = 0;\n\n while (i !== head) {\n bytesCount += bytes[i++];\n i = i % samplesCount;\n }\n\n head = (head + 1) % samplesCount;\n\n if (head === tail) {\n tail = (tail + 1) % samplesCount;\n }\n\n if (now - firstSampleTS < min) {\n return;\n }\n\n const passed = startedAt && now - startedAt;\n\n return passed ? Math.round(bytesCount * 1000 / passed) : undefined;\n };\n}\n\nexport default speedometer;\n","'use strict';\n\n/**\n * Throttle decorator\n * @param {Function} fn\n * @param {Number} freq\n * @return {Function}\n */\nfunction throttle(fn, freq) {\n let timestamp = 0;\n const threshold = 1000 / freq;\n let timer = null;\n return function throttled() {\n const force = this === true;\n\n const now = Date.now();\n if (force || now - timestamp > threshold) {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n timestamp = now;\n return fn.apply(null, arguments);\n }\n if (!timer) {\n timer = setTimeout(() => {\n timer = null;\n timestamp = Date.now();\n return fn.apply(null, arguments);\n }, threshold - (now - timestamp));\n }\n };\n}\n\nexport default throttle;\n","import speedometer from \"./speedometer.js\";\nimport throttle from \"./throttle.js\";\n\nexport default (listener, isDownloadStream, freq = 3) => {\n let bytesNotified = 0;\n const _speedometer = speedometer(50, 250);\n\n return throttle(e => {\n const loaded = e.loaded;\n const total = e.lengthComputable ? e.total : undefined;\n const progressBytes = loaded - bytesNotified;\n const rate = _speedometer(progressBytes);\n const inRange = loaded <= total;\n\n bytesNotified = loaded;\n\n const data = {\n loaded,\n total,\n progress: total ? (loaded / total) : undefined,\n bytes: progressBytes,\n rate: rate ? rate : undefined,\n estimated: rate && total && inRange ? (total - loaded) / rate : undefined,\n event: e,\n lengthComputable: total != null\n };\n\n data[isDownloadStream ? 'download' : 'upload'] = true;\n\n listener(data);\n }, freq);\n}\n","'use strict';\n\nimport utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n// Standard browser envs have full support of the APIs needed to test\n// whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n const msie = /(msie|trident)/i.test(navigator.userAgent);\n const urlParsingNode = document.createElement('a');\n let originURL;\n\n /**\n * Parse a URL to discover its components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n let href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })();\n","import utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n // Standard browser envs support document.cookie\n {\n write(name, value, expires, path, domain, secure) {\n const cookie = [name + '=' + encodeURIComponent(value)];\n\n utils.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());\n\n utils.isString(path) && cookie.push('path=' + path);\n\n utils.isString(domain) && cookie.push('domain=' + domain);\n\n secure === true && cookie.push('secure');\n\n document.cookie = cookie.join('; ');\n },\n\n read(name) {\n const match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n }\n\n :\n\n // Non-standard browser env (web workers, react-native) lack needed support.\n {\n write() {},\n read() {\n return null;\n },\n remove() {}\n };\n\n","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n *\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nexport default function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(url);\n}\n","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n *\n * @returns {string} The combined URL\n */\nexport default function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/?\\/$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n}\n","'use strict';\n\nimport isAbsoluteURL from '../helpers/isAbsoluteURL.js';\nimport combineURLs from '../helpers/combineURLs.js';\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n *\n * @returns {string} The combined full path\n */\nexport default function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosHeaders from \"./AxiosHeaders.js\";\n\nconst headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n *\n * @returns {Object} New object resulting from merging config2 to config1\n */\nexport default function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n const config = {};\n\n function getMergedValue(target, source, caseless) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge.call({caseless}, target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDeepProperties(a, b, caseless) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(a, b, caseless);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a, caseless);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function valueFromConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function defaultToConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDirectKeys(a, b, prop) {\n if (prop in config2) {\n return getMergedValue(a, b);\n } else if (prop in config1) {\n return getMergedValue(undefined, a);\n }\n }\n\n const mergeMap = {\n url: valueFromConfig2,\n method: valueFromConfig2,\n data: valueFromConfig2,\n baseURL: defaultToConfig2,\n transformRequest: defaultToConfig2,\n transformResponse: defaultToConfig2,\n paramsSerializer: defaultToConfig2,\n timeout: defaultToConfig2,\n timeoutMessage: defaultToConfig2,\n withCredentials: defaultToConfig2,\n withXSRFToken: defaultToConfig2,\n adapter: defaultToConfig2,\n responseType: defaultToConfig2,\n xsrfCookieName: defaultToConfig2,\n xsrfHeaderName: defaultToConfig2,\n onUploadProgress: defaultToConfig2,\n onDownloadProgress: defaultToConfig2,\n decompress: defaultToConfig2,\n maxContentLength: defaultToConfig2,\n maxBodyLength: defaultToConfig2,\n beforeRedirect: defaultToConfig2,\n transport: defaultToConfig2,\n httpAgent: defaultToConfig2,\n httpsAgent: defaultToConfig2,\n cancelToken: defaultToConfig2,\n socketPath: defaultToConfig2,\n responseEncoding: defaultToConfig2,\n validateStatus: mergeDirectKeys,\n headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)\n };\n\n utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {\n const merge = mergeMap[prop] || mergeDeepProperties;\n const configValue = merge(config1[prop], config2[prop], prop);\n (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);\n });\n\n return config;\n}\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport isURLSameOrigin from \"./isURLSameOrigin.js\";\nimport cookies from \"./cookies.js\";\nimport buildFullPath from \"../core/buildFullPath.js\";\nimport mergeConfig from \"../core/mergeConfig.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport buildURL from \"./buildURL.js\";\n\nexport default (config) => {\n const newConfig = mergeConfig({}, config);\n\n let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;\n\n newConfig.headers = headers = AxiosHeaders.from(headers);\n\n newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);\n\n // HTTP basic authentication\n if (auth) {\n headers.set('Authorization', 'Basic ' +\n btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))\n );\n }\n\n let contentType;\n\n if (utils.isFormData(data)) {\n if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {\n headers.setContentType(undefined); // Let the browser set it\n } else if ((contentType = headers.getContentType()) !== false) {\n // fix semicolon duplication issue for ReactNative FormData implementation\n const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];\n headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));\n }\n }\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n\n if (platform.hasStandardBrowserEnv) {\n withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));\n\n if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {\n // Add xsrf header\n const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);\n\n if (xsrfValue) {\n headers.set(xsrfHeaderName, xsrfValue);\n }\n }\n }\n\n return newConfig;\n}\n\n","import utils from './../utils.js';\nimport settle from './../core/settle.js';\nimport transitionalDefaults from '../defaults/transitional.js';\nimport AxiosError from '../core/AxiosError.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport parseProtocol from '../helpers/parseProtocol.js';\nimport platform from '../platform/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport progressEventReducer from '../helpers/progressEventReducer.js';\nimport resolveConfig from \"../helpers/resolveConfig.js\";\n\nconst isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';\n\nexport default isXHRAdapterSupported && function (config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n const _config = resolveConfig(config);\n let requestData = _config.data;\n const requestHeaders = AxiosHeaders.from(_config.headers).normalize();\n let {responseType} = _config;\n let onCanceled;\n function done() {\n if (_config.cancelToken) {\n _config.cancelToken.unsubscribe(onCanceled);\n }\n\n if (_config.signal) {\n _config.signal.removeEventListener('abort', onCanceled);\n }\n }\n\n let request = new XMLHttpRequest();\n\n request.open(_config.method.toUpperCase(), _config.url, true);\n\n // Set the request timeout in MS\n request.timeout = _config.timeout;\n\n function onloadend() {\n if (!request) {\n return;\n }\n // Prepare the response\n const responseHeaders = AxiosHeaders.from(\n 'getAllResponseHeaders' in request && request.getAllResponseHeaders()\n );\n const responseData = !responseType || responseType === 'text' || responseType === 'json' ?\n request.responseText : request.response;\n const response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config,\n request\n };\n\n settle(function _resolve(value) {\n resolve(value);\n done();\n }, function _reject(err) {\n reject(err);\n done();\n }, response);\n\n // Clean up request\n request = null;\n }\n\n if ('onloadend' in request) {\n // Use onloadend if available\n request.onloadend = onloadend;\n } else {\n // Listen for ready state to emulate onloadend\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n // readystate handler is calling before onerror or ontimeout handlers,\n // so we should call onloadend on the next 'tick'\n setTimeout(onloadend);\n };\n }\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';\n const transitional = _config.transitional || transitionalDefaults;\n if (_config.timeoutErrorMessage) {\n timeoutErrorMessage = _config.timeoutErrorMessage;\n }\n reject(new AxiosError(\n timeoutErrorMessage,\n transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,\n _config,\n request));\n\n // Clean up request\n request = null;\n };\n\n // Remove Content-Type if data is undefined\n requestData === undefined && requestHeaders.setContentType(null);\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {\n request.setRequestHeader(key, val);\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(_config.withCredentials)) {\n request.withCredentials = !!_config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (responseType && responseType !== 'json') {\n request.responseType = _config.responseType;\n }\n\n // Handle progress if needed\n if (typeof _config.onDownloadProgress === 'function') {\n request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true));\n }\n\n // Not all browsers support upload events\n if (typeof _config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress));\n }\n\n if (_config.cancelToken || _config.signal) {\n // Handle cancellation\n // eslint-disable-next-line func-names\n onCanceled = cancel => {\n if (!request) {\n return;\n }\n reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);\n request.abort();\n request = null;\n };\n\n _config.cancelToken && _config.cancelToken.subscribe(onCanceled);\n if (_config.signal) {\n _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);\n }\n }\n\n const protocol = parseProtocol(_config.url);\n\n if (protocol && platform.protocols.indexOf(protocol) === -1) {\n reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));\n return;\n }\n\n\n // Send the request\n request.send(requestData || null);\n });\n}\n","import CanceledError from \"../cancel/CanceledError.js\";\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst composeSignals = (signals, timeout) => {\n let controller = new AbortController();\n\n let aborted;\n\n const onabort = function (cancel) {\n if (!aborted) {\n aborted = true;\n unsubscribe();\n const err = cancel instanceof Error ? cancel : this.reason;\n controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));\n }\n }\n\n let timer = timeout && setTimeout(() => {\n onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT))\n }, timeout)\n\n const unsubscribe = () => {\n if (signals) {\n timer && clearTimeout(timer);\n timer = null;\n signals.forEach(signal => {\n signal &&\n (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));\n });\n signals = null;\n }\n }\n\n signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort));\n\n const {signal} = controller;\n\n signal.unsubscribe = unsubscribe;\n\n return [signal, () => {\n timer && clearTimeout(timer);\n timer = null;\n }];\n}\n\nexport default composeSignals;\n","\n\nexport const streamChunk = function* (chunk, chunkSize) {\n let len = chunk.byteLength;\n\n if (!chunkSize || len < chunkSize) {\n yield chunk;\n return;\n }\n\n let pos = 0;\n let end;\n\n while (pos < len) {\n end = pos + chunkSize;\n yield chunk.slice(pos, end);\n pos = end;\n }\n}\n\nexport const readBytes = async function* (iterable, chunkSize, encode) {\n for await (const chunk of iterable) {\n yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);\n }\n}\n\nexport const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {\n const iterator = readBytes(stream, chunkSize, encode);\n\n let bytes = 0;\n\n return new ReadableStream({\n type: 'bytes',\n\n async pull(controller) {\n const {done, value} = await iterator.next();\n\n if (done) {\n controller.close();\n onFinish();\n return;\n }\n\n let len = value.byteLength;\n onProgress && onProgress(bytes += len);\n controller.enqueue(new Uint8Array(value));\n },\n cancel(reason) {\n onFinish(reason);\n return iterator.return();\n }\n }, {\n highWaterMark: 2\n })\n}\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport AxiosError from \"../core/AxiosError.js\";\nimport composeSignals from \"../helpers/composeSignals.js\";\nimport {trackStream} from \"../helpers/trackStream.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport progressEventReducer from \"../helpers/progressEventReducer.js\";\nimport resolveConfig from \"../helpers/resolveConfig.js\";\nimport settle from \"../core/settle.js\";\n\nconst fetchProgressDecorator = (total, fn) => {\n const lengthComputable = total != null;\n return (loaded) => setTimeout(() => fn({\n lengthComputable,\n total,\n loaded\n }));\n}\n\nconst isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';\nconst isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';\n\n// used only inside the fetch adapter\nconst encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?\n ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :\n async (str) => new Uint8Array(await new Response(str).arrayBuffer())\n);\n\nconst supportsRequestStream = isReadableStreamSupported && (() => {\n let duplexAccessed = false;\n\n const hasContentType = new Request(platform.origin, {\n body: new ReadableStream(),\n method: 'POST',\n get duplex() {\n duplexAccessed = true;\n return 'half';\n },\n }).headers.has('Content-Type');\n\n return duplexAccessed && !hasContentType;\n})();\n\nconst DEFAULT_CHUNK_SIZE = 64 * 1024;\n\nconst supportsResponseStream = isReadableStreamSupported && !!(()=> {\n try {\n return utils.isReadableStream(new Response('').body);\n } catch(err) {\n // return undefined\n }\n})();\n\nconst resolvers = {\n stream: supportsResponseStream && ((res) => res.body)\n};\n\nisFetchSupported && (((res) => {\n ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {\n !resolvers[type] && (resolvers[type] = utils.isFunction(res[type]) ? (res) => res[type]() :\n (_, config) => {\n throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);\n })\n });\n})(new Response));\n\nconst getBodyLength = async (body) => {\n if (body == null) {\n return 0;\n }\n\n if(utils.isBlob(body)) {\n return body.size;\n }\n\n if(utils.isSpecCompliantForm(body)) {\n return (await new Request(body).arrayBuffer()).byteLength;\n }\n\n if(utils.isArrayBufferView(body)) {\n return body.byteLength;\n }\n\n if(utils.isURLSearchParams(body)) {\n body = body + '';\n }\n\n if(utils.isString(body)) {\n return (await encodeText(body)).byteLength;\n }\n}\n\nconst resolveBodyLength = async (headers, body) => {\n const length = utils.toFiniteNumber(headers.getContentLength());\n\n return length == null ? getBodyLength(body) : length;\n}\n\nexport default isFetchSupported && (async (config) => {\n let {\n url,\n method,\n data,\n signal,\n cancelToken,\n timeout,\n onDownloadProgress,\n onUploadProgress,\n responseType,\n headers,\n withCredentials = 'same-origin',\n fetchOptions\n } = resolveConfig(config);\n\n responseType = responseType ? (responseType + '').toLowerCase() : 'text';\n\n let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ?\n composeSignals([signal, cancelToken], timeout) : [];\n\n let finished, request;\n\n const onFinish = () => {\n !finished && setTimeout(() => {\n composedSignal && composedSignal.unsubscribe();\n });\n\n finished = true;\n }\n\n let requestContentLength;\n\n try {\n if (\n onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&\n (requestContentLength = await resolveBodyLength(headers, data)) !== 0\n ) {\n let _request = new Request(url, {\n method: 'POST',\n body: data,\n duplex: \"half\"\n });\n\n let contentTypeHeader;\n\n if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {\n headers.setContentType(contentTypeHeader)\n }\n\n if (_request.body) {\n data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(\n requestContentLength,\n progressEventReducer(onUploadProgress)\n ), null, encodeText);\n }\n }\n\n if (!utils.isString(withCredentials)) {\n withCredentials = withCredentials ? 'cors' : 'omit';\n }\n\n request = new Request(url, {\n ...fetchOptions,\n signal: composedSignal,\n method: method.toUpperCase(),\n headers: headers.normalize().toJSON(),\n body: data,\n duplex: \"half\",\n withCredentials\n });\n\n let response = await fetch(request);\n\n const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');\n\n if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {\n const options = {};\n\n ['status', 'statusText', 'headers'].forEach(prop => {\n options[prop] = response[prop];\n });\n\n const responseContentLength = utils.toFiniteNumber(response.headers.get('content-length'));\n\n response = new Response(\n trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(\n responseContentLength,\n progressEventReducer(onDownloadProgress, true)\n ), isStreamResponse && onFinish, encodeText),\n options\n );\n }\n\n responseType = responseType || 'text';\n\n let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](response, config);\n\n !isStreamResponse && onFinish();\n\n stopTimeout && stopTimeout();\n\n return await new Promise((resolve, reject) => {\n settle(resolve, reject, {\n data: responseData,\n headers: AxiosHeaders.from(response.headers),\n status: response.status,\n statusText: response.statusText,\n config,\n request\n })\n })\n } catch (err) {\n onFinish();\n\n if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {\n throw Object.assign(\n new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),\n {\n cause: err.cause || err\n }\n )\n }\n\n throw AxiosError.from(err, err && err.code, config, request);\n }\n});\n\n\n","import utils from '../utils.js';\nimport httpAdapter from './http.js';\nimport xhrAdapter from './xhr.js';\nimport fetchAdapter from './fetch.js';\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst knownAdapters = {\n http: httpAdapter,\n xhr: xhrAdapter,\n fetch: fetchAdapter\n}\n\nutils.forEach(knownAdapters, (fn, value) => {\n if (fn) {\n try {\n Object.defineProperty(fn, 'name', {value});\n } catch (e) {\n // eslint-disable-next-line no-empty\n }\n Object.defineProperty(fn, 'adapterName', {value});\n }\n});\n\nconst renderReason = (reason) => `- ${reason}`;\n\nconst isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;\n\nexport default {\n getAdapter: (adapters) => {\n adapters = utils.isArray(adapters) ? adapters : [adapters];\n\n const {length} = adapters;\n let nameOrAdapter;\n let adapter;\n\n const rejectedReasons = {};\n\n for (let i = 0; i < length; i++) {\n nameOrAdapter = adapters[i];\n let id;\n\n adapter = nameOrAdapter;\n\n if (!isResolvedHandle(nameOrAdapter)) {\n adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];\n\n if (adapter === undefined) {\n throw new AxiosError(`Unknown adapter '${id}'`);\n }\n }\n\n if (adapter) {\n break;\n }\n\n rejectedReasons[id || '#' + i] = adapter;\n }\n\n if (!adapter) {\n\n const reasons = Object.entries(rejectedReasons)\n .map(([id, state]) => `adapter ${id} ` +\n (state === false ? 'is not supported by the environment' : 'is not available in the build')\n );\n\n let s = length ?\n (reasons.length > 1 ? 'since :\\n' + reasons.map(renderReason).join('\\n') : ' ' + renderReason(reasons[0])) :\n 'as no adapter specified';\n\n throw new AxiosError(\n `There is no suitable adapter to dispatch the request ` + s,\n 'ERR_NOT_SUPPORT'\n );\n }\n\n return adapter;\n },\n adapters: knownAdapters\n}\n","'use strict';\n\nimport transformData from './transformData.js';\nimport isCancel from '../cancel/isCancel.js';\nimport defaults from '../defaults/index.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport adapters from \"../adapters/adapters.js\";\n\n/**\n * Throws a `CanceledError` if cancellation has been requested.\n *\n * @param {Object} config The config that is to be used for the request\n *\n * @returns {void}\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n\n if (config.signal && config.signal.aborted) {\n throw new CanceledError(null, config);\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n *\n * @returns {Promise} The Promise to be fulfilled\n */\nexport default function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n config.headers = AxiosHeaders.from(config.headers);\n\n // Transform request data\n config.data = transformData.call(\n config,\n config.transformRequest\n );\n\n if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {\n config.headers.setContentType('application/x-www-form-urlencoded', false);\n }\n\n const adapter = adapters.getAdapter(config.adapter || defaults.adapter);\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData.call(\n config,\n config.transformResponse,\n response\n );\n\n response.headers = AxiosHeaders.from(response.headers);\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData.call(\n config,\n config.transformResponse,\n reason.response\n );\n reason.response.headers = AxiosHeaders.from(reason.response.headers);\n }\n }\n\n return Promise.reject(reason);\n });\n}\n","export const VERSION = \"1.7.2\";","'use strict';\n\nimport {VERSION} from '../env/data.js';\nimport AxiosError from '../core/AxiosError.js';\n\nconst validators = {};\n\n// eslint-disable-next-line func-names\n['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {\n validators[type] = function validator(thing) {\n return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;\n };\n});\n\nconst deprecatedWarnings = {};\n\n/**\n * Transitional option validator\n *\n * @param {function|boolean?} validator - set to false if the transitional option has been removed\n * @param {string?} version - deprecated version / removed since version\n * @param {string?} message - some message with additional info\n *\n * @returns {function}\n */\nvalidators.transitional = function transitional(validator, version, message) {\n function formatMessage(opt, desc) {\n return '[Axios v' + VERSION + '] Transitional option \\'' + opt + '\\'' + desc + (message ? '. ' + message : '');\n }\n\n // eslint-disable-next-line func-names\n return (value, opt, opts) => {\n if (validator === false) {\n throw new AxiosError(\n formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),\n AxiosError.ERR_DEPRECATED\n );\n }\n\n if (version && !deprecatedWarnings[opt]) {\n deprecatedWarnings[opt] = true;\n // eslint-disable-next-line no-console\n console.warn(\n formatMessage(\n opt,\n ' has been deprecated since v' + version + ' and will be removed in the near future'\n )\n );\n }\n\n return validator ? validator(value, opt, opts) : true;\n };\n};\n\n/**\n * Assert object's properties type\n *\n * @param {object} options\n * @param {object} schema\n * @param {boolean?} allowUnknown\n *\n * @returns {object}\n */\n\nfunction assertOptions(options, schema, allowUnknown) {\n if (typeof options !== 'object') {\n throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);\n }\n const keys = Object.keys(options);\n let i = keys.length;\n while (i-- > 0) {\n const opt = keys[i];\n const validator = schema[opt];\n if (validator) {\n const value = options[opt];\n const result = value === undefined || validator(value, opt, options);\n if (result !== true) {\n throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);\n }\n continue;\n }\n if (allowUnknown !== true) {\n throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);\n }\n }\n}\n\nexport default {\n assertOptions,\n validators\n};\n","'use strict';\n\nimport utils from './../utils.js';\nimport buildURL from '../helpers/buildURL.js';\nimport InterceptorManager from './InterceptorManager.js';\nimport dispatchRequest from './dispatchRequest.js';\nimport mergeConfig from './mergeConfig.js';\nimport buildFullPath from './buildFullPath.js';\nimport validator from '../helpers/validator.js';\nimport AxiosHeaders from './AxiosHeaders.js';\n\nconst validators = validator.validators;\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n *\n * @return {Axios} A new instance of Axios\n */\nclass Axios {\n constructor(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n }\n\n /**\n * Dispatch a request\n *\n * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)\n * @param {?Object} config\n *\n * @returns {Promise} The Promise to be fulfilled\n */\n async request(configOrUrl, config) {\n try {\n return await this._request(configOrUrl, config);\n } catch (err) {\n if (err instanceof Error) {\n let dummy;\n\n Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());\n\n // slice off the Error: ... line\n const stack = dummy.stack ? dummy.stack.replace(/^.+\\n/, '') : '';\n try {\n if (!err.stack) {\n err.stack = stack;\n // match without the 2 top stack lines\n } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\\n.+\\n/, ''))) {\n err.stack += '\\n' + stack\n }\n } catch (e) {\n // ignore the case where \"stack\" is an un-writable property\n }\n }\n\n throw err;\n }\n }\n\n _request(configOrUrl, config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof configOrUrl === 'string') {\n config = config || {};\n config.url = configOrUrl;\n } else {\n config = configOrUrl || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n const {transitional, paramsSerializer, headers} = config;\n\n if (transitional !== undefined) {\n validator.assertOptions(transitional, {\n silentJSONParsing: validators.transitional(validators.boolean),\n forcedJSONParsing: validators.transitional(validators.boolean),\n clarifyTimeoutError: validators.transitional(validators.boolean)\n }, false);\n }\n\n if (paramsSerializer != null) {\n if (utils.isFunction(paramsSerializer)) {\n config.paramsSerializer = {\n serialize: paramsSerializer\n }\n } else {\n validator.assertOptions(paramsSerializer, {\n encode: validators.function,\n serialize: validators.function\n }, true);\n }\n }\n\n // Set config.method\n config.method = (config.method || this.defaults.method || 'get').toLowerCase();\n\n // Flatten headers\n let contextHeaders = headers && utils.merge(\n headers.common,\n headers[config.method]\n );\n\n headers && utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n (method) => {\n delete headers[method];\n }\n );\n\n config.headers = AxiosHeaders.concat(contextHeaders, headers);\n\n // filter out skipped interceptors\n const requestInterceptorChain = [];\n let synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n const responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n let promise;\n let i = 0;\n let len;\n\n if (!synchronousRequestInterceptors) {\n const chain = [dispatchRequest.bind(this), undefined];\n chain.unshift.apply(chain, requestInterceptorChain);\n chain.push.apply(chain, responseInterceptorChain);\n len = chain.length;\n\n promise = Promise.resolve(config);\n\n while (i < len) {\n promise = promise.then(chain[i++], chain[i++]);\n }\n\n return promise;\n }\n\n len = requestInterceptorChain.length;\n\n let newConfig = config;\n\n i = 0;\n\n while (i < len) {\n const onFulfilled = requestInterceptorChain[i++];\n const onRejected = requestInterceptorChain[i++];\n try {\n newConfig = onFulfilled(newConfig);\n } catch (error) {\n onRejected.call(this, error);\n break;\n }\n }\n\n try {\n promise = dispatchRequest.call(this, newConfig);\n } catch (error) {\n return Promise.reject(error);\n }\n\n i = 0;\n len = responseInterceptorChain.length;\n\n while (i < len) {\n promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);\n }\n\n return promise;\n }\n\n getUri(config) {\n config = mergeConfig(this.defaults, config);\n const fullPath = buildFullPath(config.baseURL, config.url);\n return buildURL(fullPath, config.params, config.paramsSerializer);\n }\n}\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n\n function generateHTTPMethod(isForm) {\n return function httpMethod(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n headers: isForm ? {\n 'Content-Type': 'multipart/form-data'\n } : {},\n url,\n data\n }));\n };\n }\n\n Axios.prototype[method] = generateHTTPMethod();\n\n Axios.prototype[method + 'Form'] = generateHTTPMethod(true);\n});\n\nexport default Axios;\n","'use strict';\n\nimport CanceledError from './CanceledError.js';\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @param {Function} executor The executor function.\n *\n * @returns {CancelToken}\n */\nclass CancelToken {\n constructor(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n let resolvePromise;\n\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n const token = this;\n\n // eslint-disable-next-line func-names\n this.promise.then(cancel => {\n if (!token._listeners) return;\n\n let i = token._listeners.length;\n\n while (i-- > 0) {\n token._listeners[i](cancel);\n }\n token._listeners = null;\n });\n\n // eslint-disable-next-line func-names\n this.promise.then = onfulfilled => {\n let _resolve;\n // eslint-disable-next-line func-names\n const promise = new Promise(resolve => {\n token.subscribe(resolve);\n _resolve = resolve;\n }).then(onfulfilled);\n\n promise.cancel = function reject() {\n token.unsubscribe(_resolve);\n };\n\n return promise;\n };\n\n executor(function cancel(message, config, request) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new CanceledError(message, config, request);\n resolvePromise(token.reason);\n });\n }\n\n /**\n * Throws a `CanceledError` if cancellation has been requested.\n */\n throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n }\n\n /**\n * Subscribe to the cancel signal\n */\n\n subscribe(listener) {\n if (this.reason) {\n listener(this.reason);\n return;\n }\n\n if (this._listeners) {\n this._listeners.push(listener);\n } else {\n this._listeners = [listener];\n }\n }\n\n /**\n * Unsubscribe from the cancel signal\n */\n\n unsubscribe(listener) {\n if (!this._listeners) {\n return;\n }\n const index = this._listeners.indexOf(listener);\n if (index !== -1) {\n this._listeners.splice(index, 1);\n }\n }\n\n /**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\n static source() {\n let cancel;\n const token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token,\n cancel\n };\n }\n}\n\nexport default CancelToken;\n","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n *\n * @returns {Function}\n */\nexport default function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n *\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nexport default function isAxiosError(payload) {\n return utils.isObject(payload) && (payload.isAxiosError === true);\n}\n","const HttpStatusCode = {\n Continue: 100,\n SwitchingProtocols: 101,\n Processing: 102,\n EarlyHints: 103,\n Ok: 200,\n Created: 201,\n Accepted: 202,\n NonAuthoritativeInformation: 203,\n NoContent: 204,\n ResetContent: 205,\n PartialContent: 206,\n MultiStatus: 207,\n AlreadyReported: 208,\n ImUsed: 226,\n MultipleChoices: 300,\n MovedPermanently: 301,\n Found: 302,\n SeeOther: 303,\n NotModified: 304,\n UseProxy: 305,\n Unused: 306,\n TemporaryRedirect: 307,\n PermanentRedirect: 308,\n BadRequest: 400,\n Unauthorized: 401,\n PaymentRequired: 402,\n Forbidden: 403,\n NotFound: 404,\n MethodNotAllowed: 405,\n NotAcceptable: 406,\n ProxyAuthenticationRequired: 407,\n RequestTimeout: 408,\n Conflict: 409,\n Gone: 410,\n LengthRequired: 411,\n PreconditionFailed: 412,\n PayloadTooLarge: 413,\n UriTooLong: 414,\n UnsupportedMediaType: 415,\n RangeNotSatisfiable: 416,\n ExpectationFailed: 417,\n ImATeapot: 418,\n MisdirectedRequest: 421,\n UnprocessableEntity: 422,\n Locked: 423,\n FailedDependency: 424,\n TooEarly: 425,\n UpgradeRequired: 426,\n PreconditionRequired: 428,\n TooManyRequests: 429,\n RequestHeaderFieldsTooLarge: 431,\n UnavailableForLegalReasons: 451,\n InternalServerError: 500,\n NotImplemented: 501,\n BadGateway: 502,\n ServiceUnavailable: 503,\n GatewayTimeout: 504,\n HttpVersionNotSupported: 505,\n VariantAlsoNegotiates: 506,\n InsufficientStorage: 507,\n LoopDetected: 508,\n NotExtended: 510,\n NetworkAuthenticationRequired: 511,\n};\n\nObject.entries(HttpStatusCode).forEach(([key, value]) => {\n HttpStatusCode[value] = key;\n});\n\nexport default HttpStatusCode;\n","'use strict';\n\nimport utils from './utils.js';\nimport bind from './helpers/bind.js';\nimport Axios from './core/Axios.js';\nimport mergeConfig from './core/mergeConfig.js';\nimport defaults from './defaults/index.js';\nimport formDataToJSON from './helpers/formDataToJSON.js';\nimport CanceledError from './cancel/CanceledError.js';\nimport CancelToken from './cancel/CancelToken.js';\nimport isCancel from './cancel/isCancel.js';\nimport {VERSION} from './env/data.js';\nimport toFormData from './helpers/toFormData.js';\nimport AxiosError from './core/AxiosError.js';\nimport spread from './helpers/spread.js';\nimport isAxiosError from './helpers/isAxiosError.js';\nimport AxiosHeaders from \"./core/AxiosHeaders.js\";\nimport adapters from './adapters/adapters.js';\nimport HttpStatusCode from './helpers/HttpStatusCode.js';\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n *\n * @returns {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n const context = new Axios(defaultConfig);\n const instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});\n\n // Copy context to instance\n utils.extend(instance, context, null, {allOwnKeys: true});\n\n // Factory for creating new instances\n instance.create = function create(instanceConfig) {\n return createInstance(mergeConfig(defaultConfig, instanceConfig));\n };\n\n return instance;\n}\n\n// Create the default instance to be exported\nconst axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Expose Cancel & CancelToken\naxios.CanceledError = CanceledError;\naxios.CancelToken = CancelToken;\naxios.isCancel = isCancel;\naxios.VERSION = VERSION;\naxios.toFormData = toFormData;\n\n// Expose AxiosError class\naxios.AxiosError = AxiosError;\n\n// alias for CanceledError for backward compatibility\naxios.Cancel = axios.CanceledError;\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\n\naxios.spread = spread;\n\n// Expose isAxiosError\naxios.isAxiosError = isAxiosError;\n\n// Expose mergeConfig\naxios.mergeConfig = mergeConfig;\n\naxios.AxiosHeaders = AxiosHeaders;\n\naxios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);\n\naxios.getAdapter = adapters.getAdapter;\n\naxios.HttpStatusCode = HttpStatusCode;\n\naxios.default = axios;\n\n// this module should only have a default export\nexport default axios\n"],"names":["utils","prototype","encode","URLSearchParams","FormData","Blob","platform","defaults","AxiosHeaders","composeSignals","validators","InterceptorManager","Axios","CancelToken","HttpStatusCode"],"mappings":";;;AAEe,SAAS,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE;AAC1C,EAAE,OAAO,SAAS,IAAI,GAAG;AACzB,IAAI,OAAO,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AACxC,GAAG,CAAC;AACJ;;ACFA;AACA;AACA,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC;AACpC,MAAM,CAAC,cAAc,CAAC,GAAG,MAAM,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AAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC/B,CAAC,CAAC;AACF;AACA,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;AACtB;AACA;AACA,KAAK,CAAC,YAAY,GAAG,YAAY,CAAC;AAClC;AACA;AACA,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC;AAChC;AACA,KAAK,CAAC,YAAY,GAAGL,cAAY,CAAC;AAClC;AACA,KAAK,CAAC,UAAU,GAAG,KAAK,IAAI,cAAc,CAACR,OAAK,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC;AAClG;AACA,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;AACvC;AACA,KAAK,CAAC,cAAc,GAAGc,gBAAc,CAAC;AACtC;AACA,KAAK,CAAC,OAAO,GAAG,KAAK;;;;"} \ No newline at end of file diff --git a/project starter code/node_modules/axios/dist/esm/axios.js b/project starter code/node_modules/axios/dist/esm/axios.js new file mode 100644 index 00000000..c29e4a71 --- /dev/null +++ b/project starter code/node_modules/axios/dist/esm/axios.js @@ -0,0 +1,3661 @@ +// Axios v1.7.2 Copyright (c) 2024 Matt Zabriskie and contributors +function bind(fn, thisArg) { + return function wrap() { + return fn.apply(thisArg, arguments); + }; +} + +// utils is a library of generic helper functions non-specific to axios + +const {toString} = Object.prototype; +const {getPrototypeOf} = Object; + +const kindOf = (cache => thing => { + const str = toString.call(thing); + return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase()); +})(Object.create(null)); + +const kindOfTest = (type) => { + type = type.toLowerCase(); + return (thing) => kindOf(thing) === type +}; + +const typeOfTest = type => thing => typeof thing === type; + +/** + * Determine if a value is an Array + * + * @param {Object} val The value to test + * + * @returns {boolean} True if value is an Array, otherwise false + */ +const {isArray} = Array; + +/** + * Determine if a value is undefined + * + * @param {*} val The value to test + * + * @returns {boolean} True if the value is undefined, otherwise false + */ +const isUndefined = typeOfTest('undefined'); + +/** + * Determine if a value is a Buffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Buffer, otherwise false + */ +function isBuffer(val) { + return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) + && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val); +} + +/** + * Determine if a value is an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is an ArrayBuffer, otherwise false + */ +const isArrayBuffer = kindOfTest('ArrayBuffer'); + + +/** + * Determine if a value is a view on an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false + */ +function isArrayBufferView(val) { + let result; + if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { + result = ArrayBuffer.isView(val); + } else { + result = (val) && (val.buffer) && (isArrayBuffer(val.buffer)); + } + return result; +} + +/** + * Determine if a value is a String + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a String, otherwise false + */ +const isString = typeOfTest('string'); + +/** + * Determine if a value is a Function + * + * @param {*} val The value to test + * @returns {boolean} True if value is a Function, otherwise false + */ +const isFunction = typeOfTest('function'); + +/** + * Determine if a value is a Number + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Number, otherwise false + */ +const isNumber = typeOfTest('number'); + +/** + * Determine if a value is an Object + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an Object, otherwise false + */ +const isObject = (thing) => thing !== null && typeof thing === 'object'; + +/** + * Determine if a value is a Boolean + * + * @param {*} thing The value to test + * @returns {boolean} True if value is a Boolean, otherwise false + */ +const isBoolean = thing => thing === true || thing === false; + +/** + * Determine if a value is a plain Object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a plain Object, otherwise false + */ +const isPlainObject = (val) => { + if (kindOf(val) !== 'object') { + return false; + } + + const prototype = getPrototypeOf(val); + return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val); +}; + +/** + * Determine if a value is a Date + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Date, otherwise false + */ +const isDate = kindOfTest('Date'); + +/** + * Determine if a value is a File + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ +const isFile = kindOfTest('File'); + +/** + * Determine if a value is a Blob + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Blob, otherwise false + */ +const isBlob = kindOfTest('Blob'); + +/** + * Determine if a value is a FileList + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ +const isFileList = kindOfTest('FileList'); + +/** + * Determine if a value is a Stream + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Stream, otherwise false + */ +const isStream = (val) => isObject(val) && isFunction(val.pipe); + +/** + * Determine if a value is a FormData + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an FormData, otherwise false + */ +const isFormData = (thing) => { + let kind; + return thing && ( + (typeof FormData === 'function' && thing instanceof FormData) || ( + isFunction(thing.append) && ( + (kind = kindOf(thing)) === 'formdata' || + // detect form-data instance + (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]') + ) + ) + ) +}; + +/** + * Determine if a value is a URLSearchParams object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a URLSearchParams object, otherwise false + */ +const isURLSearchParams = kindOfTest('URLSearchParams'); + +const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest); + +/** + * Trim excess whitespace off the beginning and end of a string + * + * @param {String} str The String to trim + * + * @returns {String} The String freed of excess whitespace + */ +const trim = (str) => str.trim ? + str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + +/** + * Iterate over an Array or an Object invoking a function for each item. + * + * If `obj` is an Array callback will be called passing + * the value, index, and complete array for each item. + * + * If 'obj' is an Object callback will be called passing + * the value, key, and complete object for each property. + * + * @param {Object|Array} obj The object to iterate + * @param {Function} fn The callback to invoke for each item + * + * @param {Boolean} [allOwnKeys = false] + * @returns {any} + */ +function forEach(obj, fn, {allOwnKeys = false} = {}) { + // Don't bother if no value provided + if (obj === null || typeof obj === 'undefined') { + return; + } + + let i; + let l; + + // Force an array if not already something iterable + if (typeof obj !== 'object') { + /*eslint no-param-reassign:0*/ + obj = [obj]; + } + + if (isArray(obj)) { + // Iterate over array values + for (i = 0, l = obj.length; i < l; i++) { + fn.call(null, obj[i], i, obj); + } + } else { + // Iterate over object keys + const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj); + const len = keys.length; + let key; + + for (i = 0; i < len; i++) { + key = keys[i]; + fn.call(null, obj[key], key, obj); + } + } +} + +function findKey(obj, key) { + key = key.toLowerCase(); + const keys = Object.keys(obj); + let i = keys.length; + let _key; + while (i-- > 0) { + _key = keys[i]; + if (key === _key.toLowerCase()) { + return _key; + } + } + return null; +} + +const _global = (() => { + /*eslint no-undef:0*/ + if (typeof globalThis !== "undefined") return globalThis; + return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global) +})(); + +const isContextDefined = (context) => !isUndefined(context) && context !== _global; + +/** + * Accepts varargs expecting each argument to be an object, then + * immutably merges the properties of each object and returns result. + * + * When multiple objects contain the same key the later object in + * the arguments list will take precedence. + * + * Example: + * + * ```js + * var result = merge({foo: 123}, {foo: 456}); + * console.log(result.foo); // outputs 456 + * ``` + * + * @param {Object} obj1 Object to merge + * + * @returns {Object} Result of all merge properties + */ +function merge(/* obj1, obj2, obj3, ... */) { + const {caseless} = isContextDefined(this) && this || {}; + const result = {}; + const assignValue = (val, key) => { + const targetKey = caseless && findKey(result, key) || key; + if (isPlainObject(result[targetKey]) && isPlainObject(val)) { + result[targetKey] = merge(result[targetKey], val); + } else if (isPlainObject(val)) { + result[targetKey] = merge({}, val); + } else if (isArray(val)) { + result[targetKey] = val.slice(); + } else { + result[targetKey] = val; + } + }; + + for (let i = 0, l = arguments.length; i < l; i++) { + arguments[i] && forEach(arguments[i], assignValue); + } + return result; +} + +/** + * Extends object a by mutably adding to it the properties of object b. + * + * @param {Object} a The object to be extended + * @param {Object} b The object to copy properties from + * @param {Object} thisArg The object to bind function to + * + * @param {Boolean} [allOwnKeys] + * @returns {Object} The resulting value of object a + */ +const extend = (a, b, thisArg, {allOwnKeys}= {}) => { + forEach(b, (val, key) => { + if (thisArg && isFunction(val)) { + a[key] = bind(val, thisArg); + } else { + a[key] = val; + } + }, {allOwnKeys}); + return a; +}; + +/** + * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) + * + * @param {string} content with BOM + * + * @returns {string} content value without BOM + */ +const stripBOM = (content) => { + if (content.charCodeAt(0) === 0xFEFF) { + content = content.slice(1); + } + return content; +}; + +/** + * Inherit the prototype methods from one constructor into another + * @param {function} constructor + * @param {function} superConstructor + * @param {object} [props] + * @param {object} [descriptors] + * + * @returns {void} + */ +const inherits = (constructor, superConstructor, props, descriptors) => { + constructor.prototype = Object.create(superConstructor.prototype, descriptors); + constructor.prototype.constructor = constructor; + Object.defineProperty(constructor, 'super', { + value: superConstructor.prototype + }); + props && Object.assign(constructor.prototype, props); +}; + +/** + * Resolve object with deep prototype chain to a flat object + * @param {Object} sourceObj source object + * @param {Object} [destObj] + * @param {Function|Boolean} [filter] + * @param {Function} [propFilter] + * + * @returns {Object} + */ +const toFlatObject = (sourceObj, destObj, filter, propFilter) => { + let props; + let i; + let prop; + const merged = {}; + + destObj = destObj || {}; + // eslint-disable-next-line no-eq-null,eqeqeq + if (sourceObj == null) return destObj; + + do { + props = Object.getOwnPropertyNames(sourceObj); + i = props.length; + while (i-- > 0) { + prop = props[i]; + if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) { + destObj[prop] = sourceObj[prop]; + merged[prop] = true; + } + } + sourceObj = filter !== false && getPrototypeOf(sourceObj); + } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype); + + return destObj; +}; + +/** + * Determines whether a string ends with the characters of a specified string + * + * @param {String} str + * @param {String} searchString + * @param {Number} [position= 0] + * + * @returns {boolean} + */ +const endsWith = (str, searchString, position) => { + str = String(str); + if (position === undefined || position > str.length) { + position = str.length; + } + position -= searchString.length; + const lastIndex = str.indexOf(searchString, position); + return lastIndex !== -1 && lastIndex === position; +}; + + +/** + * Returns new array from array like object or null if failed + * + * @param {*} [thing] + * + * @returns {?Array} + */ +const toArray = (thing) => { + if (!thing) return null; + if (isArray(thing)) return thing; + let i = thing.length; + if (!isNumber(i)) return null; + const arr = new Array(i); + while (i-- > 0) { + arr[i] = thing[i]; + } + return arr; +}; + +/** + * Checking if the Uint8Array exists and if it does, it returns a function that checks if the + * thing passed in is an instance of Uint8Array + * + * @param {TypedArray} + * + * @returns {Array} + */ +// eslint-disable-next-line func-names +const isTypedArray = (TypedArray => { + // eslint-disable-next-line func-names + return thing => { + return TypedArray && thing instanceof TypedArray; + }; +})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array)); + +/** + * For each entry in the object, call the function with the key and value. + * + * @param {Object} obj - The object to iterate over. + * @param {Function} fn - The function to call for each entry. + * + * @returns {void} + */ +const forEachEntry = (obj, fn) => { + const generator = obj && obj[Symbol.iterator]; + + const iterator = generator.call(obj); + + let result; + + while ((result = iterator.next()) && !result.done) { + const pair = result.value; + fn.call(obj, pair[0], pair[1]); + } +}; + +/** + * It takes a regular expression and a string, and returns an array of all the matches + * + * @param {string} regExp - The regular expression to match against. + * @param {string} str - The string to search. + * + * @returns {Array} + */ +const matchAll = (regExp, str) => { + let matches; + const arr = []; + + while ((matches = regExp.exec(str)) !== null) { + arr.push(matches); + } + + return arr; +}; + +/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */ +const isHTMLForm = kindOfTest('HTMLFormElement'); + +const toCamelCase = str => { + return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, + function replacer(m, p1, p2) { + return p1.toUpperCase() + p2; + } + ); +}; + +/* Creating a function that will check if an object has a property. */ +const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype); + +/** + * Determine if a value is a RegExp object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a RegExp object, otherwise false + */ +const isRegExp = kindOfTest('RegExp'); + +const reduceDescriptors = (obj, reducer) => { + const descriptors = Object.getOwnPropertyDescriptors(obj); + const reducedDescriptors = {}; + + forEach(descriptors, (descriptor, name) => { + let ret; + if ((ret = reducer(descriptor, name, obj)) !== false) { + reducedDescriptors[name] = ret || descriptor; + } + }); + + Object.defineProperties(obj, reducedDescriptors); +}; + +/** + * Makes all methods read-only + * @param {Object} obj + */ + +const freezeMethods = (obj) => { + reduceDescriptors(obj, (descriptor, name) => { + // skip restricted props in strict mode + if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) { + return false; + } + + const value = obj[name]; + + if (!isFunction(value)) return; + + descriptor.enumerable = false; + + if ('writable' in descriptor) { + descriptor.writable = false; + return; + } + + if (!descriptor.set) { + descriptor.set = () => { + throw Error('Can not rewrite read-only method \'' + name + '\''); + }; + } + }); +}; + +const toObjectSet = (arrayOrString, delimiter) => { + const obj = {}; + + const define = (arr) => { + arr.forEach(value => { + obj[value] = true; + }); + }; + + isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter)); + + return obj; +}; + +const noop = () => {}; + +const toFiniteNumber = (value, defaultValue) => { + return value != null && Number.isFinite(value = +value) ? value : defaultValue; +}; + +const ALPHA = 'abcdefghijklmnopqrstuvwxyz'; + +const DIGIT = '0123456789'; + +const ALPHABET = { + DIGIT, + ALPHA, + ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT +}; + +const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => { + let str = ''; + const {length} = alphabet; + while (size--) { + str += alphabet[Math.random() * length|0]; + } + + return str; +}; + +/** + * If the thing is a FormData object, return true, otherwise return false. + * + * @param {unknown} thing - The thing to check. + * + * @returns {boolean} + */ +function isSpecCompliantForm(thing) { + return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]); +} + +const toJSONObject = (obj) => { + const stack = new Array(10); + + const visit = (source, i) => { + + if (isObject(source)) { + if (stack.indexOf(source) >= 0) { + return; + } + + if(!('toJSON' in source)) { + stack[i] = source; + const target = isArray(source) ? [] : {}; + + forEach(source, (value, key) => { + const reducedValue = visit(value, i + 1); + !isUndefined(reducedValue) && (target[key] = reducedValue); + }); + + stack[i] = undefined; + + return target; + } + } + + return source; + }; + + return visit(obj, 0); +}; + +const isAsyncFn = kindOfTest('AsyncFunction'); + +const isThenable = (thing) => + thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch); + +const utils$1 = { + isArray, + isArrayBuffer, + isBuffer, + isFormData, + isArrayBufferView, + isString, + isNumber, + isBoolean, + isObject, + isPlainObject, + isReadableStream, + isRequest, + isResponse, + isHeaders, + isUndefined, + isDate, + isFile, + isBlob, + isRegExp, + isFunction, + isStream, + isURLSearchParams, + isTypedArray, + isFileList, + forEach, + merge, + extend, + trim, + stripBOM, + inherits, + toFlatObject, + kindOf, + kindOfTest, + endsWith, + toArray, + forEachEntry, + matchAll, + isHTMLForm, + hasOwnProperty, + hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection + reduceDescriptors, + freezeMethods, + toObjectSet, + toCamelCase, + noop, + toFiniteNumber, + findKey, + global: _global, + isContextDefined, + ALPHABET, + generateString, + isSpecCompliantForm, + toJSONObject, + isAsyncFn, + isThenable +}; + +/** + * Create an Error with the specified message, config, error code, request and response. + * + * @param {string} message The error message. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [config] The config. + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * + * @returns {Error} The created error. + */ +function AxiosError$1(message, code, config, request, response) { + Error.call(this); + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } else { + this.stack = (new Error()).stack; + } + + this.message = message; + this.name = 'AxiosError'; + code && (this.code = code); + config && (this.config = config); + request && (this.request = request); + response && (this.response = response); +} + +utils$1.inherits(AxiosError$1, Error, { + toJSON: function toJSON() { + return { + // Standard + message: this.message, + name: this.name, + // Microsoft + description: this.description, + number: this.number, + // Mozilla + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + // Axios + config: utils$1.toJSONObject(this.config), + code: this.code, + status: this.response && this.response.status ? this.response.status : null + }; + } +}); + +const prototype$1 = AxiosError$1.prototype; +const descriptors = {}; + +[ + 'ERR_BAD_OPTION_VALUE', + 'ERR_BAD_OPTION', + 'ECONNABORTED', + 'ETIMEDOUT', + 'ERR_NETWORK', + 'ERR_FR_TOO_MANY_REDIRECTS', + 'ERR_DEPRECATED', + 'ERR_BAD_RESPONSE', + 'ERR_BAD_REQUEST', + 'ERR_CANCELED', + 'ERR_NOT_SUPPORT', + 'ERR_INVALID_URL' +// eslint-disable-next-line func-names +].forEach(code => { + descriptors[code] = {value: code}; +}); + +Object.defineProperties(AxiosError$1, descriptors); +Object.defineProperty(prototype$1, 'isAxiosError', {value: true}); + +// eslint-disable-next-line func-names +AxiosError$1.from = (error, code, config, request, response, customProps) => { + const axiosError = Object.create(prototype$1); + + utils$1.toFlatObject(error, axiosError, function filter(obj) { + return obj !== Error.prototype; + }, prop => { + return prop !== 'isAxiosError'; + }); + + AxiosError$1.call(axiosError, error.message, code, config, request, response); + + axiosError.cause = error; + + axiosError.name = error.name; + + customProps && Object.assign(axiosError, customProps); + + return axiosError; +}; + +// eslint-disable-next-line strict +const httpAdapter = null; + +/** + * Determines if the given thing is a array or js object. + * + * @param {string} thing - The object or array to be visited. + * + * @returns {boolean} + */ +function isVisitable(thing) { + return utils$1.isPlainObject(thing) || utils$1.isArray(thing); +} + +/** + * It removes the brackets from the end of a string + * + * @param {string} key - The key of the parameter. + * + * @returns {string} the key without the brackets. + */ +function removeBrackets(key) { + return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key; +} + +/** + * It takes a path, a key, and a boolean, and returns a string + * + * @param {string} path - The path to the current key. + * @param {string} key - The key of the current object being iterated over. + * @param {string} dots - If true, the key will be rendered with dots instead of brackets. + * + * @returns {string} The path to the current key. + */ +function renderKey(path, key, dots) { + if (!path) return key; + return path.concat(key).map(function each(token, i) { + // eslint-disable-next-line no-param-reassign + token = removeBrackets(token); + return !dots && i ? '[' + token + ']' : token; + }).join(dots ? '.' : ''); +} + +/** + * If the array is an array and none of its elements are visitable, then it's a flat array. + * + * @param {Array} arr - The array to check + * + * @returns {boolean} + */ +function isFlatArray(arr) { + return utils$1.isArray(arr) && !arr.some(isVisitable); +} + +const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) { + return /^is[A-Z]/.test(prop); +}); + +/** + * Convert a data object to FormData + * + * @param {Object} obj + * @param {?Object} [formData] + * @param {?Object} [options] + * @param {Function} [options.visitor] + * @param {Boolean} [options.metaTokens = true] + * @param {Boolean} [options.dots = false] + * @param {?Boolean} [options.indexes = false] + * + * @returns {Object} + **/ + +/** + * It converts an object into a FormData object + * + * @param {Object} obj - The object to convert to form data. + * @param {string} formData - The FormData object to append to. + * @param {Object} options + * + * @returns + */ +function toFormData$1(obj, formData, options) { + if (!utils$1.isObject(obj)) { + throw new TypeError('target must be an object'); + } + + // eslint-disable-next-line no-param-reassign + formData = formData || new (FormData)(); + + // eslint-disable-next-line no-param-reassign + options = utils$1.toFlatObject(options, { + metaTokens: true, + dots: false, + indexes: false + }, false, function defined(option, source) { + // eslint-disable-next-line no-eq-null,eqeqeq + return !utils$1.isUndefined(source[option]); + }); + + const metaTokens = options.metaTokens; + // eslint-disable-next-line no-use-before-define + const visitor = options.visitor || defaultVisitor; + const dots = options.dots; + const indexes = options.indexes; + const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob; + const useBlob = _Blob && utils$1.isSpecCompliantForm(formData); + + if (!utils$1.isFunction(visitor)) { + throw new TypeError('visitor must be a function'); + } + + function convertValue(value) { + if (value === null) return ''; + + if (utils$1.isDate(value)) { + return value.toISOString(); + } + + if (!useBlob && utils$1.isBlob(value)) { + throw new AxiosError$1('Blob is not supported. Use a Buffer instead.'); + } + + if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) { + return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value); + } + + return value; + } + + /** + * Default visitor. + * + * @param {*} value + * @param {String|Number} key + * @param {Array} path + * @this {FormData} + * + * @returns {boolean} return true to visit the each prop of the value recursively + */ + function defaultVisitor(value, key, path) { + let arr = value; + + if (value && !path && typeof value === 'object') { + if (utils$1.endsWith(key, '{}')) { + // eslint-disable-next-line no-param-reassign + key = metaTokens ? key : key.slice(0, -2); + // eslint-disable-next-line no-param-reassign + value = JSON.stringify(value); + } else if ( + (utils$1.isArray(value) && isFlatArray(value)) || + ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)) + )) { + // eslint-disable-next-line no-param-reassign + key = removeBrackets(key); + + arr.forEach(function each(el, index) { + !(utils$1.isUndefined(el) || el === null) && formData.append( + // eslint-disable-next-line no-nested-ternary + indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'), + convertValue(el) + ); + }); + return false; + } + } + + if (isVisitable(value)) { + return true; + } + + formData.append(renderKey(path, key, dots), convertValue(value)); + + return false; + } + + const stack = []; + + const exposedHelpers = Object.assign(predicates, { + defaultVisitor, + convertValue, + isVisitable + }); + + function build(value, path) { + if (utils$1.isUndefined(value)) return; + + if (stack.indexOf(value) !== -1) { + throw Error('Circular reference detected in ' + path.join('.')); + } + + stack.push(value); + + utils$1.forEach(value, function each(el, key) { + const result = !(utils$1.isUndefined(el) || el === null) && visitor.call( + formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers + ); + + if (result === true) { + build(el, path ? path.concat(key) : [key]); + } + }); + + stack.pop(); + } + + if (!utils$1.isObject(obj)) { + throw new TypeError('data must be an object'); + } + + build(obj); + + return formData; +} + +/** + * It encodes a string by replacing all characters that are not in the unreserved set with + * their percent-encoded equivalents + * + * @param {string} str - The string to encode. + * + * @returns {string} The encoded string. + */ +function encode$1(str) { + const charMap = { + '!': '%21', + "'": '%27', + '(': '%28', + ')': '%29', + '~': '%7E', + '%20': '+', + '%00': '\x00' + }; + return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) { + return charMap[match]; + }); +} + +/** + * It takes a params object and converts it to a FormData object + * + * @param {Object} params - The parameters to be converted to a FormData object. + * @param {Object} options - The options object passed to the Axios constructor. + * + * @returns {void} + */ +function AxiosURLSearchParams(params, options) { + this._pairs = []; + + params && toFormData$1(params, this, options); +} + +const prototype = AxiosURLSearchParams.prototype; + +prototype.append = function append(name, value) { + this._pairs.push([name, value]); +}; + +prototype.toString = function toString(encoder) { + const _encode = encoder ? function(value) { + return encoder.call(this, value, encode$1); + } : encode$1; + + return this._pairs.map(function each(pair) { + return _encode(pair[0]) + '=' + _encode(pair[1]); + }, '').join('&'); +}; + +/** + * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their + * URI encoded counterparts + * + * @param {string} val The value to be encoded. + * + * @returns {string} The encoded value. + */ +function encode(val) { + return encodeURIComponent(val). + replace(/%3A/gi, ':'). + replace(/%24/g, '$'). + replace(/%2C/gi, ','). + replace(/%20/g, '+'). + replace(/%5B/gi, '['). + replace(/%5D/gi, ']'); +} + +/** + * Build a URL by appending params to the end + * + * @param {string} url The base of the url (e.g., http://www.google.com) + * @param {object} [params] The params to be appended + * @param {?object} options + * + * @returns {string} The formatted url + */ +function buildURL(url, params, options) { + /*eslint no-param-reassign:0*/ + if (!params) { + return url; + } + + const _encode = options && options.encode || encode; + + const serializeFn = options && options.serialize; + + let serializedParams; + + if (serializeFn) { + serializedParams = serializeFn(params, options); + } else { + serializedParams = utils$1.isURLSearchParams(params) ? + params.toString() : + new AxiosURLSearchParams(params, options).toString(_encode); + } + + if (serializedParams) { + const hashmarkIndex = url.indexOf("#"); + + if (hashmarkIndex !== -1) { + url = url.slice(0, hashmarkIndex); + } + url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; + } + + return url; +} + +class InterceptorManager { + constructor() { + this.handlers = []; + } + + /** + * Add a new interceptor to the stack + * + * @param {Function} fulfilled The function to handle `then` for a `Promise` + * @param {Function} rejected The function to handle `reject` for a `Promise` + * + * @return {Number} An ID used to remove interceptor later + */ + use(fulfilled, rejected, options) { + this.handlers.push({ + fulfilled, + rejected, + synchronous: options ? options.synchronous : false, + runWhen: options ? options.runWhen : null + }); + return this.handlers.length - 1; + } + + /** + * Remove an interceptor from the stack + * + * @param {Number} id The ID that was returned by `use` + * + * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise + */ + eject(id) { + if (this.handlers[id]) { + this.handlers[id] = null; + } + } + + /** + * Clear all interceptors from the stack + * + * @returns {void} + */ + clear() { + if (this.handlers) { + this.handlers = []; + } + } + + /** + * Iterate over all the registered interceptors + * + * This method is particularly useful for skipping over any + * interceptors that may have become `null` calling `eject`. + * + * @param {Function} fn The function to call for each interceptor + * + * @returns {void} + */ + forEach(fn) { + utils$1.forEach(this.handlers, function forEachHandler(h) { + if (h !== null) { + fn(h); + } + }); + } +} + +const InterceptorManager$1 = InterceptorManager; + +const transitionalDefaults = { + silentJSONParsing: true, + forcedJSONParsing: true, + clarifyTimeoutError: false +}; + +const URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams; + +const FormData$1 = typeof FormData !== 'undefined' ? FormData : null; + +const Blob$1 = typeof Blob !== 'undefined' ? Blob : null; + +const platform$1 = { + isBrowser: true, + classes: { + URLSearchParams: URLSearchParams$1, + FormData: FormData$1, + Blob: Blob$1 + }, + protocols: ['http', 'https', 'file', 'blob', 'url', 'data'] +}; + +const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined'; + +/** + * Determine if we're running in a standard browser environment + * + * This allows axios to run in a web worker, and react-native. + * Both environments support XMLHttpRequest, but not fully standard globals. + * + * web workers: + * typeof window -> undefined + * typeof document -> undefined + * + * react-native: + * navigator.product -> 'ReactNative' + * nativescript + * navigator.product -> 'NativeScript' or 'NS' + * + * @returns {boolean} + */ +const hasStandardBrowserEnv = ( + (product) => { + return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0 + })(typeof navigator !== 'undefined' && navigator.product); + +/** + * Determine if we're running in a standard browser webWorker environment + * + * Although the `isStandardBrowserEnv` method indicates that + * `allows axios to run in a web worker`, the WebWorker will still be + * filtered out due to its judgment standard + * `typeof window !== 'undefined' && typeof document !== 'undefined'`. + * This leads to a problem when axios post `FormData` in webWorker + */ +const hasStandardBrowserWebWorkerEnv = (() => { + return ( + typeof WorkerGlobalScope !== 'undefined' && + // eslint-disable-next-line no-undef + self instanceof WorkerGlobalScope && + typeof self.importScripts === 'function' + ); +})(); + +const origin = hasBrowserEnv && window.location.href || 'http://localhost'; + +const utils = /*#__PURE__*/Object.freeze({ + __proto__: null, + hasBrowserEnv: hasBrowserEnv, + hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv, + hasStandardBrowserEnv: hasStandardBrowserEnv, + origin: origin +}); + +const platform = { + ...utils, + ...platform$1 +}; + +function toURLEncodedForm(data, options) { + return toFormData$1(data, new platform.classes.URLSearchParams(), Object.assign({ + visitor: function(value, key, path, helpers) { + if (platform.isNode && utils$1.isBuffer(value)) { + this.append(key, value.toString('base64')); + return false; + } + + return helpers.defaultVisitor.apply(this, arguments); + } + }, options)); +} + +/** + * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z'] + * + * @param {string} name - The name of the property to get. + * + * @returns An array of strings. + */ +function parsePropPath(name) { + // foo[x][y][z] + // foo.x.y.z + // foo-x-y-z + // foo x y z + return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => { + return match[0] === '[]' ? '' : match[1] || match[0]; + }); +} + +/** + * Convert an array to an object. + * + * @param {Array} arr - The array to convert to an object. + * + * @returns An object with the same keys and values as the array. + */ +function arrayToObject(arr) { + const obj = {}; + const keys = Object.keys(arr); + let i; + const len = keys.length; + let key; + for (i = 0; i < len; i++) { + key = keys[i]; + obj[key] = arr[key]; + } + return obj; +} + +/** + * It takes a FormData object and returns a JavaScript object + * + * @param {string} formData The FormData object to convert to JSON. + * + * @returns {Object | null} The converted object. + */ +function formDataToJSON(formData) { + function buildPath(path, value, target, index) { + let name = path[index++]; + + if (name === '__proto__') return true; + + const isNumericKey = Number.isFinite(+name); + const isLast = index >= path.length; + name = !name && utils$1.isArray(target) ? target.length : name; + + if (isLast) { + if (utils$1.hasOwnProp(target, name)) { + target[name] = [target[name], value]; + } else { + target[name] = value; + } + + return !isNumericKey; + } + + if (!target[name] || !utils$1.isObject(target[name])) { + target[name] = []; + } + + const result = buildPath(path, value, target[name], index); + + if (result && utils$1.isArray(target[name])) { + target[name] = arrayToObject(target[name]); + } + + return !isNumericKey; + } + + if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) { + const obj = {}; + + utils$1.forEachEntry(formData, (name, value) => { + buildPath(parsePropPath(name), value, obj, 0); + }); + + return obj; + } + + return null; +} + +/** + * It takes a string, tries to parse it, and if it fails, it returns the stringified version + * of the input + * + * @param {any} rawValue - The value to be stringified. + * @param {Function} parser - A function that parses a string into a JavaScript object. + * @param {Function} encoder - A function that takes a value and returns a string. + * + * @returns {string} A stringified version of the rawValue. + */ +function stringifySafely(rawValue, parser, encoder) { + if (utils$1.isString(rawValue)) { + try { + (parser || JSON.parse)(rawValue); + return utils$1.trim(rawValue); + } catch (e) { + if (e.name !== 'SyntaxError') { + throw e; + } + } + } + + return (encoder || JSON.stringify)(rawValue); +} + +const defaults = { + + transitional: transitionalDefaults, + + adapter: ['xhr', 'http', 'fetch'], + + transformRequest: [function transformRequest(data, headers) { + const contentType = headers.getContentType() || ''; + const hasJSONContentType = contentType.indexOf('application/json') > -1; + const isObjectPayload = utils$1.isObject(data); + + if (isObjectPayload && utils$1.isHTMLForm(data)) { + data = new FormData(data); + } + + const isFormData = utils$1.isFormData(data); + + if (isFormData) { + return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data; + } + + if (utils$1.isArrayBuffer(data) || + utils$1.isBuffer(data) || + utils$1.isStream(data) || + utils$1.isFile(data) || + utils$1.isBlob(data) || + utils$1.isReadableStream(data) + ) { + return data; + } + if (utils$1.isArrayBufferView(data)) { + return data.buffer; + } + if (utils$1.isURLSearchParams(data)) { + headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false); + return data.toString(); + } + + let isFileList; + + if (isObjectPayload) { + if (contentType.indexOf('application/x-www-form-urlencoded') > -1) { + return toURLEncodedForm(data, this.formSerializer).toString(); + } + + if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) { + const _FormData = this.env && this.env.FormData; + + return toFormData$1( + isFileList ? {'files[]': data} : data, + _FormData && new _FormData(), + this.formSerializer + ); + } + } + + if (isObjectPayload || hasJSONContentType ) { + headers.setContentType('application/json', false); + return stringifySafely(data); + } + + return data; + }], + + transformResponse: [function transformResponse(data) { + const transitional = this.transitional || defaults.transitional; + const forcedJSONParsing = transitional && transitional.forcedJSONParsing; + const JSONRequested = this.responseType === 'json'; + + if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) { + return data; + } + + if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) { + const silentJSONParsing = transitional && transitional.silentJSONParsing; + const strictJSONParsing = !silentJSONParsing && JSONRequested; + + try { + return JSON.parse(data); + } catch (e) { + if (strictJSONParsing) { + if (e.name === 'SyntaxError') { + throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response); + } + throw e; + } + } + } + + return data; + }], + + /** + * A timeout in milliseconds to abort a request. If set to 0 (default) a + * timeout is not created. + */ + timeout: 0, + + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN', + + maxContentLength: -1, + maxBodyLength: -1, + + env: { + FormData: platform.classes.FormData, + Blob: platform.classes.Blob + }, + + validateStatus: function validateStatus(status) { + return status >= 200 && status < 300; + }, + + headers: { + common: { + 'Accept': 'application/json, text/plain, */*', + 'Content-Type': undefined + } + } +}; + +utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => { + defaults.headers[method] = {}; +}); + +const defaults$1 = defaults; + +// RawAxiosHeaders whose duplicates are ignored by node +// c.f. https://nodejs.org/api/http.html#http_message_headers +const ignoreDuplicateOf = utils$1.toObjectSet([ + 'age', 'authorization', 'content-length', 'content-type', 'etag', + 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', + 'last-modified', 'location', 'max-forwards', 'proxy-authorization', + 'referer', 'retry-after', 'user-agent' +]); + +/** + * Parse headers into an object + * + * ``` + * Date: Wed, 27 Aug 2014 08:58:49 GMT + * Content-Type: application/json + * Connection: keep-alive + * Transfer-Encoding: chunked + * ``` + * + * @param {String} rawHeaders Headers needing to be parsed + * + * @returns {Object} Headers parsed into an object + */ +const parseHeaders = rawHeaders => { + const parsed = {}; + let key; + let val; + let i; + + rawHeaders && rawHeaders.split('\n').forEach(function parser(line) { + i = line.indexOf(':'); + key = line.substring(0, i).trim().toLowerCase(); + val = line.substring(i + 1).trim(); + + if (!key || (parsed[key] && ignoreDuplicateOf[key])) { + return; + } + + if (key === 'set-cookie') { + if (parsed[key]) { + parsed[key].push(val); + } else { + parsed[key] = [val]; + } + } else { + parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; + } + }); + + return parsed; +}; + +const $internals = Symbol('internals'); + +function normalizeHeader(header) { + return header && String(header).trim().toLowerCase(); +} + +function normalizeValue(value) { + if (value === false || value == null) { + return value; + } + + return utils$1.isArray(value) ? value.map(normalizeValue) : String(value); +} + +function parseTokens(str) { + const tokens = Object.create(null); + const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; + let match; + + while ((match = tokensRE.exec(str))) { + tokens[match[1]] = match[2]; + } + + return tokens; +} + +const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim()); + +function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) { + if (utils$1.isFunction(filter)) { + return filter.call(this, value, header); + } + + if (isHeaderNameFilter) { + value = header; + } + + if (!utils$1.isString(value)) return; + + if (utils$1.isString(filter)) { + return value.indexOf(filter) !== -1; + } + + if (utils$1.isRegExp(filter)) { + return filter.test(value); + } +} + +function formatHeader(header) { + return header.trim() + .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => { + return char.toUpperCase() + str; + }); +} + +function buildAccessors(obj, header) { + const accessorName = utils$1.toCamelCase(' ' + header); + + ['get', 'set', 'has'].forEach(methodName => { + Object.defineProperty(obj, methodName + accessorName, { + value: function(arg1, arg2, arg3) { + return this[methodName].call(this, header, arg1, arg2, arg3); + }, + configurable: true + }); + }); +} + +class AxiosHeaders$1 { + constructor(headers) { + headers && this.set(headers); + } + + set(header, valueOrRewrite, rewrite) { + const self = this; + + function setHeader(_value, _header, _rewrite) { + const lHeader = normalizeHeader(_header); + + if (!lHeader) { + throw new Error('header name must be a non-empty string'); + } + + const key = utils$1.findKey(self, lHeader); + + if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) { + self[key || _header] = normalizeValue(_value); + } + } + + const setHeaders = (headers, _rewrite) => + utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite)); + + if (utils$1.isPlainObject(header) || header instanceof this.constructor) { + setHeaders(header, valueOrRewrite); + } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) { + setHeaders(parseHeaders(header), valueOrRewrite); + } else if (utils$1.isHeaders(header)) { + for (const [key, value] of header.entries()) { + setHeader(value, key, rewrite); + } + } else { + header != null && setHeader(valueOrRewrite, header, rewrite); + } + + return this; + } + + get(header, parser) { + header = normalizeHeader(header); + + if (header) { + const key = utils$1.findKey(this, header); + + if (key) { + const value = this[key]; + + if (!parser) { + return value; + } + + if (parser === true) { + return parseTokens(value); + } + + if (utils$1.isFunction(parser)) { + return parser.call(this, value, key); + } + + if (utils$1.isRegExp(parser)) { + return parser.exec(value); + } + + throw new TypeError('parser must be boolean|regexp|function'); + } + } + } + + has(header, matcher) { + header = normalizeHeader(header); + + if (header) { + const key = utils$1.findKey(this, header); + + return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher))); + } + + return false; + } + + delete(header, matcher) { + const self = this; + let deleted = false; + + function deleteHeader(_header) { + _header = normalizeHeader(_header); + + if (_header) { + const key = utils$1.findKey(self, _header); + + if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) { + delete self[key]; + + deleted = true; + } + } + } + + if (utils$1.isArray(header)) { + header.forEach(deleteHeader); + } else { + deleteHeader(header); + } + + return deleted; + } + + clear(matcher) { + const keys = Object.keys(this); + let i = keys.length; + let deleted = false; + + while (i--) { + const key = keys[i]; + if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) { + delete this[key]; + deleted = true; + } + } + + return deleted; + } + + normalize(format) { + const self = this; + const headers = {}; + + utils$1.forEach(this, (value, header) => { + const key = utils$1.findKey(headers, header); + + if (key) { + self[key] = normalizeValue(value); + delete self[header]; + return; + } + + const normalized = format ? formatHeader(header) : String(header).trim(); + + if (normalized !== header) { + delete self[header]; + } + + self[normalized] = normalizeValue(value); + + headers[normalized] = true; + }); + + return this; + } + + concat(...targets) { + return this.constructor.concat(this, ...targets); + } + + toJSON(asStrings) { + const obj = Object.create(null); + + utils$1.forEach(this, (value, header) => { + value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value); + }); + + return obj; + } + + [Symbol.iterator]() { + return Object.entries(this.toJSON())[Symbol.iterator](); + } + + toString() { + return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n'); + } + + get [Symbol.toStringTag]() { + return 'AxiosHeaders'; + } + + static from(thing) { + return thing instanceof this ? thing : new this(thing); + } + + static concat(first, ...targets) { + const computed = new this(first); + + targets.forEach((target) => computed.set(target)); + + return computed; + } + + static accessor(header) { + const internals = this[$internals] = (this[$internals] = { + accessors: {} + }); + + const accessors = internals.accessors; + const prototype = this.prototype; + + function defineAccessor(_header) { + const lHeader = normalizeHeader(_header); + + if (!accessors[lHeader]) { + buildAccessors(prototype, _header); + accessors[lHeader] = true; + } + } + + utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header); + + return this; + } +} + +AxiosHeaders$1.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']); + +// reserved names hotfix +utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => { + let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set` + return { + get: () => value, + set(headerValue) { + this[mapped] = headerValue; + } + } +}); + +utils$1.freezeMethods(AxiosHeaders$1); + +const AxiosHeaders$2 = AxiosHeaders$1; + +/** + * Transform the data for a request or a response + * + * @param {Array|Function} fns A single function or Array of functions + * @param {?Object} response The response object + * + * @returns {*} The resulting transformed data + */ +function transformData(fns, response) { + const config = this || defaults$1; + const context = response || config; + const headers = AxiosHeaders$2.from(context.headers); + let data = context.data; + + utils$1.forEach(fns, function transform(fn) { + data = fn.call(config, data, headers.normalize(), response ? response.status : undefined); + }); + + headers.normalize(); + + return data; +} + +function isCancel$1(value) { + return !!(value && value.__CANCEL__); +} + +/** + * A `CanceledError` is an object that is thrown when an operation is canceled. + * + * @param {string=} message The message. + * @param {Object=} config The config. + * @param {Object=} request The request. + * + * @returns {CanceledError} The created error. + */ +function CanceledError$1(message, config, request) { + // eslint-disable-next-line no-eq-null,eqeqeq + AxiosError$1.call(this, message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request); + this.name = 'CanceledError'; +} + +utils$1.inherits(CanceledError$1, AxiosError$1, { + __CANCEL__: true +}); + +/** + * Resolve or reject a Promise based on response status. + * + * @param {Function} resolve A function that resolves the promise. + * @param {Function} reject A function that rejects the promise. + * @param {object} response The response. + * + * @returns {object} The response. + */ +function settle(resolve, reject, response) { + const validateStatus = response.config.validateStatus; + if (!response.status || !validateStatus || validateStatus(response.status)) { + resolve(response); + } else { + reject(new AxiosError$1( + 'Request failed with status code ' + response.status, + [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], + response.config, + response.request, + response + )); + } +} + +function parseProtocol(url) { + const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url); + return match && match[1] || ''; +} + +/** + * Calculate data maxRate + * @param {Number} [samplesCount= 10] + * @param {Number} [min= 1000] + * @returns {Function} + */ +function speedometer(samplesCount, min) { + samplesCount = samplesCount || 10; + const bytes = new Array(samplesCount); + const timestamps = new Array(samplesCount); + let head = 0; + let tail = 0; + let firstSampleTS; + + min = min !== undefined ? min : 1000; + + return function push(chunkLength) { + const now = Date.now(); + + const startedAt = timestamps[tail]; + + if (!firstSampleTS) { + firstSampleTS = now; + } + + bytes[head] = chunkLength; + timestamps[head] = now; + + let i = tail; + let bytesCount = 0; + + while (i !== head) { + bytesCount += bytes[i++]; + i = i % samplesCount; + } + + head = (head + 1) % samplesCount; + + if (head === tail) { + tail = (tail + 1) % samplesCount; + } + + if (now - firstSampleTS < min) { + return; + } + + const passed = startedAt && now - startedAt; + + return passed ? Math.round(bytesCount * 1000 / passed) : undefined; + }; +} + +/** + * Throttle decorator + * @param {Function} fn + * @param {Number} freq + * @return {Function} + */ +function throttle(fn, freq) { + let timestamp = 0; + const threshold = 1000 / freq; + let timer = null; + return function throttled() { + const force = this === true; + + const now = Date.now(); + if (force || now - timestamp > threshold) { + if (timer) { + clearTimeout(timer); + timer = null; + } + timestamp = now; + return fn.apply(null, arguments); + } + if (!timer) { + timer = setTimeout(() => { + timer = null; + timestamp = Date.now(); + return fn.apply(null, arguments); + }, threshold - (now - timestamp)); + } + }; +} + +const progressEventReducer = (listener, isDownloadStream, freq = 3) => { + let bytesNotified = 0; + const _speedometer = speedometer(50, 250); + + return throttle(e => { + const loaded = e.loaded; + const total = e.lengthComputable ? e.total : undefined; + const progressBytes = loaded - bytesNotified; + const rate = _speedometer(progressBytes); + const inRange = loaded <= total; + + bytesNotified = loaded; + + const data = { + loaded, + total, + progress: total ? (loaded / total) : undefined, + bytes: progressBytes, + rate: rate ? rate : undefined, + estimated: rate && total && inRange ? (total - loaded) / rate : undefined, + event: e, + lengthComputable: total != null + }; + + data[isDownloadStream ? 'download' : 'upload'] = true; + + listener(data); + }, freq); +}; + +const isURLSameOrigin = platform.hasStandardBrowserEnv ? + +// Standard browser envs have full support of the APIs needed to test +// whether the request URL is of the same origin as current location. + (function standardBrowserEnv() { + const msie = /(msie|trident)/i.test(navigator.userAgent); + const urlParsingNode = document.createElement('a'); + let originURL; + + /** + * Parse a URL to discover its components + * + * @param {String} url The URL to be parsed + * @returns {Object} + */ + function resolveURL(url) { + let href = url; + + if (msie) { + // IE needs attribute set twice to normalize properties + urlParsingNode.setAttribute('href', href); + href = urlParsingNode.href; + } + + urlParsingNode.setAttribute('href', href); + + // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: (urlParsingNode.pathname.charAt(0) === '/') ? + urlParsingNode.pathname : + '/' + urlParsingNode.pathname + }; + } + + originURL = resolveURL(window.location.href); + + /** + * Determine if a URL shares the same origin as the current location + * + * @param {String} requestURL The URL to test + * @returns {boolean} True if URL shares the same origin, otherwise false + */ + return function isURLSameOrigin(requestURL) { + const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL; + return (parsed.protocol === originURL.protocol && + parsed.host === originURL.host); + }; + })() : + + // Non standard browser envs (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return function isURLSameOrigin() { + return true; + }; + })(); + +const cookies = platform.hasStandardBrowserEnv ? + + // Standard browser envs support document.cookie + { + write(name, value, expires, path, domain, secure) { + const cookie = [name + '=' + encodeURIComponent(value)]; + + utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString()); + + utils$1.isString(path) && cookie.push('path=' + path); + + utils$1.isString(domain) && cookie.push('domain=' + domain); + + secure === true && cookie.push('secure'); + + document.cookie = cookie.join('; '); + }, + + read(name) { + const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); + return (match ? decodeURIComponent(match[3]) : null); + }, + + remove(name) { + this.write(name, '', Date.now() - 86400000); + } + } + + : + + // Non-standard browser env (web workers, react-native) lack needed support. + { + write() {}, + read() { + return null; + }, + remove() {} + }; + +/** + * Determines whether the specified URL is absolute + * + * @param {string} url The URL to test + * + * @returns {boolean} True if the specified URL is absolute, otherwise false + */ +function isAbsoluteURL(url) { + // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). + // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed + // by any combination of letters, digits, plus, period, or hyphen. + return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); +} + +/** + * Creates a new URL by combining the specified URLs + * + * @param {string} baseURL The base URL + * @param {string} relativeURL The relative URL + * + * @returns {string} The combined URL + */ +function combineURLs(baseURL, relativeURL) { + return relativeURL + ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') + : baseURL; +} + +/** + * Creates a new URL by combining the baseURL with the requestedURL, + * only when the requestedURL is not already an absolute URL. + * If the requestURL is absolute, this function returns the requestedURL untouched. + * + * @param {string} baseURL The base URL + * @param {string} requestedURL Absolute or relative URL to combine + * + * @returns {string} The combined full path + */ +function buildFullPath(baseURL, requestedURL) { + if (baseURL && !isAbsoluteURL(requestedURL)) { + return combineURLs(baseURL, requestedURL); + } + return requestedURL; +} + +const headersToObject = (thing) => thing instanceof AxiosHeaders$2 ? { ...thing } : thing; + +/** + * Config-specific merge-function which creates a new config-object + * by merging two configuration objects together. + * + * @param {Object} config1 + * @param {Object} config2 + * + * @returns {Object} New object resulting from merging config2 to config1 + */ +function mergeConfig$1(config1, config2) { + // eslint-disable-next-line no-param-reassign + config2 = config2 || {}; + const config = {}; + + function getMergedValue(target, source, caseless) { + if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) { + return utils$1.merge.call({caseless}, target, source); + } else if (utils$1.isPlainObject(source)) { + return utils$1.merge({}, source); + } else if (utils$1.isArray(source)) { + return source.slice(); + } + return source; + } + + // eslint-disable-next-line consistent-return + function mergeDeepProperties(a, b, caseless) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(a, b, caseless); + } else if (!utils$1.isUndefined(a)) { + return getMergedValue(undefined, a, caseless); + } + } + + // eslint-disable-next-line consistent-return + function valueFromConfig2(a, b) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(undefined, b); + } + } + + // eslint-disable-next-line consistent-return + function defaultToConfig2(a, b) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(undefined, b); + } else if (!utils$1.isUndefined(a)) { + return getMergedValue(undefined, a); + } + } + + // eslint-disable-next-line consistent-return + function mergeDirectKeys(a, b, prop) { + if (prop in config2) { + return getMergedValue(a, b); + } else if (prop in config1) { + return getMergedValue(undefined, a); + } + } + + const mergeMap = { + url: valueFromConfig2, + method: valueFromConfig2, + data: valueFromConfig2, + baseURL: defaultToConfig2, + transformRequest: defaultToConfig2, + transformResponse: defaultToConfig2, + paramsSerializer: defaultToConfig2, + timeout: defaultToConfig2, + timeoutMessage: defaultToConfig2, + withCredentials: defaultToConfig2, + withXSRFToken: defaultToConfig2, + adapter: defaultToConfig2, + responseType: defaultToConfig2, + xsrfCookieName: defaultToConfig2, + xsrfHeaderName: defaultToConfig2, + onUploadProgress: defaultToConfig2, + onDownloadProgress: defaultToConfig2, + decompress: defaultToConfig2, + maxContentLength: defaultToConfig2, + maxBodyLength: defaultToConfig2, + beforeRedirect: defaultToConfig2, + transport: defaultToConfig2, + httpAgent: defaultToConfig2, + httpsAgent: defaultToConfig2, + cancelToken: defaultToConfig2, + socketPath: defaultToConfig2, + responseEncoding: defaultToConfig2, + validateStatus: mergeDirectKeys, + headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true) + }; + + utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) { + const merge = mergeMap[prop] || mergeDeepProperties; + const configValue = merge(config1[prop], config2[prop], prop); + (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue); + }); + + return config; +} + +const resolveConfig = (config) => { + const newConfig = mergeConfig$1({}, config); + + let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig; + + newConfig.headers = headers = AxiosHeaders$2.from(headers); + + newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer); + + // HTTP basic authentication + if (auth) { + headers.set('Authorization', 'Basic ' + + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')) + ); + } + + let contentType; + + if (utils$1.isFormData(data)) { + if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) { + headers.setContentType(undefined); // Let the browser set it + } else if ((contentType = headers.getContentType()) !== false) { + // fix semicolon duplication issue for ReactNative FormData implementation + const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : []; + headers.setContentType([type || 'multipart/form-data', ...tokens].join('; ')); + } + } + + // Add xsrf header + // This is only done if running in a standard browser environment. + // Specifically not if we're in a web worker, or react-native. + + if (platform.hasStandardBrowserEnv) { + withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig)); + + if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) { + // Add xsrf header + const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName); + + if (xsrfValue) { + headers.set(xsrfHeaderName, xsrfValue); + } + } + } + + return newConfig; +}; + +const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined'; + +const xhrAdapter = isXHRAdapterSupported && function (config) { + return new Promise(function dispatchXhrRequest(resolve, reject) { + const _config = resolveConfig(config); + let requestData = _config.data; + const requestHeaders = AxiosHeaders$2.from(_config.headers).normalize(); + let {responseType} = _config; + let onCanceled; + function done() { + if (_config.cancelToken) { + _config.cancelToken.unsubscribe(onCanceled); + } + + if (_config.signal) { + _config.signal.removeEventListener('abort', onCanceled); + } + } + + let request = new XMLHttpRequest(); + + request.open(_config.method.toUpperCase(), _config.url, true); + + // Set the request timeout in MS + request.timeout = _config.timeout; + + function onloadend() { + if (!request) { + return; + } + // Prepare the response + const responseHeaders = AxiosHeaders$2.from( + 'getAllResponseHeaders' in request && request.getAllResponseHeaders() + ); + const responseData = !responseType || responseType === 'text' || responseType === 'json' ? + request.responseText : request.response; + const response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config, + request + }; + + settle(function _resolve(value) { + resolve(value); + done(); + }, function _reject(err) { + reject(err); + done(); + }, response); + + // Clean up request + request = null; + } + + if ('onloadend' in request) { + // Use onloadend if available + request.onloadend = onloadend; + } else { + // Listen for ready state to emulate onloadend + request.onreadystatechange = function handleLoad() { + if (!request || request.readyState !== 4) { + return; + } + + // The request errored out and we didn't get a response, this will be + // handled by onerror instead + // With one exception: request that using file: protocol, most browsers + // will return status as 0 even though it's a successful request + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { + return; + } + // readystate handler is calling before onerror or ontimeout handlers, + // so we should call onloadend on the next 'tick' + setTimeout(onloadend); + }; + } + + // Handle browser request cancellation (as opposed to a manual cancellation) + request.onabort = function handleAbort() { + if (!request) { + return; + } + + reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, _config, request)); + + // Clean up request + request = null; + }; + + // Handle low level network errors + request.onerror = function handleError() { + // Real errors are hidden from us by the browser + // onerror should only fire if it's a network error + reject(new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, _config, request)); + + // Clean up request + request = null; + }; + + // Handle timeout + request.ontimeout = function handleTimeout() { + let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded'; + const transitional = _config.transitional || transitionalDefaults; + if (_config.timeoutErrorMessage) { + timeoutErrorMessage = _config.timeoutErrorMessage; + } + reject(new AxiosError$1( + timeoutErrorMessage, + transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED, + _config, + request)); + + // Clean up request + request = null; + }; + + // Remove Content-Type if data is undefined + requestData === undefined && requestHeaders.setContentType(null); + + // Add headers to the request + if ('setRequestHeader' in request) { + utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) { + request.setRequestHeader(key, val); + }); + } + + // Add withCredentials to request if needed + if (!utils$1.isUndefined(_config.withCredentials)) { + request.withCredentials = !!_config.withCredentials; + } + + // Add responseType to request if needed + if (responseType && responseType !== 'json') { + request.responseType = _config.responseType; + } + + // Handle progress if needed + if (typeof _config.onDownloadProgress === 'function') { + request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true)); + } + + // Not all browsers support upload events + if (typeof _config.onUploadProgress === 'function' && request.upload) { + request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress)); + } + + if (_config.cancelToken || _config.signal) { + // Handle cancellation + // eslint-disable-next-line func-names + onCanceled = cancel => { + if (!request) { + return; + } + reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel); + request.abort(); + request = null; + }; + + _config.cancelToken && _config.cancelToken.subscribe(onCanceled); + if (_config.signal) { + _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled); + } + } + + const protocol = parseProtocol(_config.url); + + if (protocol && platform.protocols.indexOf(protocol) === -1) { + reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config)); + return; + } + + + // Send the request + request.send(requestData || null); + }); +}; + +const composeSignals = (signals, timeout) => { + let controller = new AbortController(); + + let aborted; + + const onabort = function (cancel) { + if (!aborted) { + aborted = true; + unsubscribe(); + const err = cancel instanceof Error ? cancel : this.reason; + controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err)); + } + }; + + let timer = timeout && setTimeout(() => { + onabort(new AxiosError$1(`timeout ${timeout} of ms exceeded`, AxiosError$1.ETIMEDOUT)); + }, timeout); + + const unsubscribe = () => { + if (signals) { + timer && clearTimeout(timer); + timer = null; + signals.forEach(signal => { + signal && + (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort)); + }); + signals = null; + } + }; + + signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort)); + + const {signal} = controller; + + signal.unsubscribe = unsubscribe; + + return [signal, () => { + timer && clearTimeout(timer); + timer = null; + }]; +}; + +const composeSignals$1 = composeSignals; + +const streamChunk = function* (chunk, chunkSize) { + let len = chunk.byteLength; + + if (!chunkSize || len < chunkSize) { + yield chunk; + return; + } + + let pos = 0; + let end; + + while (pos < len) { + end = pos + chunkSize; + yield chunk.slice(pos, end); + pos = end; + } +}; + +const readBytes = async function* (iterable, chunkSize, encode) { + for await (const chunk of iterable) { + yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize); + } +}; + +const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => { + const iterator = readBytes(stream, chunkSize, encode); + + let bytes = 0; + + return new ReadableStream({ + type: 'bytes', + + async pull(controller) { + const {done, value} = await iterator.next(); + + if (done) { + controller.close(); + onFinish(); + return; + } + + let len = value.byteLength; + onProgress && onProgress(bytes += len); + controller.enqueue(new Uint8Array(value)); + }, + cancel(reason) { + onFinish(reason); + return iterator.return(); + } + }, { + highWaterMark: 2 + }) +}; + +const fetchProgressDecorator = (total, fn) => { + const lengthComputable = total != null; + return (loaded) => setTimeout(() => fn({ + lengthComputable, + total, + loaded + })); +}; + +const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function'; +const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function'; + +// used only inside the fetch adapter +const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? + ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : + async (str) => new Uint8Array(await new Response(str).arrayBuffer()) +); + +const supportsRequestStream = isReadableStreamSupported && (() => { + let duplexAccessed = false; + + const hasContentType = new Request(platform.origin, { + body: new ReadableStream(), + method: 'POST', + get duplex() { + duplexAccessed = true; + return 'half'; + }, + }).headers.has('Content-Type'); + + return duplexAccessed && !hasContentType; +})(); + +const DEFAULT_CHUNK_SIZE = 64 * 1024; + +const supportsResponseStream = isReadableStreamSupported && !!(()=> { + try { + return utils$1.isReadableStream(new Response('').body); + } catch(err) { + // return undefined + } +})(); + +const resolvers = { + stream: supportsResponseStream && ((res) => res.body) +}; + +isFetchSupported && (((res) => { + ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => { + !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() : + (_, config) => { + throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config); + }); + }); +})(new Response)); + +const getBodyLength = async (body) => { + if (body == null) { + return 0; + } + + if(utils$1.isBlob(body)) { + return body.size; + } + + if(utils$1.isSpecCompliantForm(body)) { + return (await new Request(body).arrayBuffer()).byteLength; + } + + if(utils$1.isArrayBufferView(body)) { + return body.byteLength; + } + + if(utils$1.isURLSearchParams(body)) { + body = body + ''; + } + + if(utils$1.isString(body)) { + return (await encodeText(body)).byteLength; + } +}; + +const resolveBodyLength = async (headers, body) => { + const length = utils$1.toFiniteNumber(headers.getContentLength()); + + return length == null ? getBodyLength(body) : length; +}; + +const fetchAdapter = isFetchSupported && (async (config) => { + let { + url, + method, + data, + signal, + cancelToken, + timeout, + onDownloadProgress, + onUploadProgress, + responseType, + headers, + withCredentials = 'same-origin', + fetchOptions + } = resolveConfig(config); + + responseType = responseType ? (responseType + '').toLowerCase() : 'text'; + + let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ? + composeSignals$1([signal, cancelToken], timeout) : []; + + let finished, request; + + const onFinish = () => { + !finished && setTimeout(() => { + composedSignal && composedSignal.unsubscribe(); + }); + + finished = true; + }; + + let requestContentLength; + + try { + if ( + onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' && + (requestContentLength = await resolveBodyLength(headers, data)) !== 0 + ) { + let _request = new Request(url, { + method: 'POST', + body: data, + duplex: "half" + }); + + let contentTypeHeader; + + if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) { + headers.setContentType(contentTypeHeader); + } + + if (_request.body) { + data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator( + requestContentLength, + progressEventReducer(onUploadProgress) + ), null, encodeText); + } + } + + if (!utils$1.isString(withCredentials)) { + withCredentials = withCredentials ? 'cors' : 'omit'; + } + + request = new Request(url, { + ...fetchOptions, + signal: composedSignal, + method: method.toUpperCase(), + headers: headers.normalize().toJSON(), + body: data, + duplex: "half", + withCredentials + }); + + let response = await fetch(request); + + const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response'); + + if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) { + const options = {}; + + ['status', 'statusText', 'headers'].forEach(prop => { + options[prop] = response[prop]; + }); + + const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length')); + + response = new Response( + trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator( + responseContentLength, + progressEventReducer(onDownloadProgress, true) + ), isStreamResponse && onFinish, encodeText), + options + ); + } + + responseType = responseType || 'text'; + + let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config); + + !isStreamResponse && onFinish(); + + stopTimeout && stopTimeout(); + + return await new Promise((resolve, reject) => { + settle(resolve, reject, { + data: responseData, + headers: AxiosHeaders$2.from(response.headers), + status: response.status, + statusText: response.statusText, + config, + request + }); + }) + } catch (err) { + onFinish(); + + if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) { + throw Object.assign( + new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request), + { + cause: err.cause || err + } + ) + } + + throw AxiosError$1.from(err, err && err.code, config, request); + } +}); + +const knownAdapters = { + http: httpAdapter, + xhr: xhrAdapter, + fetch: fetchAdapter +}; + +utils$1.forEach(knownAdapters, (fn, value) => { + if (fn) { + try { + Object.defineProperty(fn, 'name', {value}); + } catch (e) { + // eslint-disable-next-line no-empty + } + Object.defineProperty(fn, 'adapterName', {value}); + } +}); + +const renderReason = (reason) => `- ${reason}`; + +const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false; + +const adapters = { + getAdapter: (adapters) => { + adapters = utils$1.isArray(adapters) ? adapters : [adapters]; + + const {length} = adapters; + let nameOrAdapter; + let adapter; + + const rejectedReasons = {}; + + for (let i = 0; i < length; i++) { + nameOrAdapter = adapters[i]; + let id; + + adapter = nameOrAdapter; + + if (!isResolvedHandle(nameOrAdapter)) { + adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()]; + + if (adapter === undefined) { + throw new AxiosError$1(`Unknown adapter '${id}'`); + } + } + + if (adapter) { + break; + } + + rejectedReasons[id || '#' + i] = adapter; + } + + if (!adapter) { + + const reasons = Object.entries(rejectedReasons) + .map(([id, state]) => `adapter ${id} ` + + (state === false ? 'is not supported by the environment' : 'is not available in the build') + ); + + let s = length ? + (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) : + 'as no adapter specified'; + + throw new AxiosError$1( + `There is no suitable adapter to dispatch the request ` + s, + 'ERR_NOT_SUPPORT' + ); + } + + return adapter; + }, + adapters: knownAdapters +}; + +/** + * Throws a `CanceledError` if cancellation has been requested. + * + * @param {Object} config The config that is to be used for the request + * + * @returns {void} + */ +function throwIfCancellationRequested(config) { + if (config.cancelToken) { + config.cancelToken.throwIfRequested(); + } + + if (config.signal && config.signal.aborted) { + throw new CanceledError$1(null, config); + } +} + +/** + * Dispatch a request to the server using the configured adapter. + * + * @param {object} config The config that is to be used for the request + * + * @returns {Promise} The Promise to be fulfilled + */ +function dispatchRequest(config) { + throwIfCancellationRequested(config); + + config.headers = AxiosHeaders$2.from(config.headers); + + // Transform request data + config.data = transformData.call( + config, + config.transformRequest + ); + + if (['post', 'put', 'patch'].indexOf(config.method) !== -1) { + config.headers.setContentType('application/x-www-form-urlencoded', false); + } + + const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter); + + return adapter(config).then(function onAdapterResolution(response) { + throwIfCancellationRequested(config); + + // Transform response data + response.data = transformData.call( + config, + config.transformResponse, + response + ); + + response.headers = AxiosHeaders$2.from(response.headers); + + return response; + }, function onAdapterRejection(reason) { + if (!isCancel$1(reason)) { + throwIfCancellationRequested(config); + + // Transform response data + if (reason && reason.response) { + reason.response.data = transformData.call( + config, + config.transformResponse, + reason.response + ); + reason.response.headers = AxiosHeaders$2.from(reason.response.headers); + } + } + + return Promise.reject(reason); + }); +} + +const VERSION$1 = "1.7.2"; + +const validators$1 = {}; + +// eslint-disable-next-line func-names +['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => { + validators$1[type] = function validator(thing) { + return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type; + }; +}); + +const deprecatedWarnings = {}; + +/** + * Transitional option validator + * + * @param {function|boolean?} validator - set to false if the transitional option has been removed + * @param {string?} version - deprecated version / removed since version + * @param {string?} message - some message with additional info + * + * @returns {function} + */ +validators$1.transitional = function transitional(validator, version, message) { + function formatMessage(opt, desc) { + return '[Axios v' + VERSION$1 + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); + } + + // eslint-disable-next-line func-names + return (value, opt, opts) => { + if (validator === false) { + throw new AxiosError$1( + formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), + AxiosError$1.ERR_DEPRECATED + ); + } + + if (version && !deprecatedWarnings[opt]) { + deprecatedWarnings[opt] = true; + // eslint-disable-next-line no-console + console.warn( + formatMessage( + opt, + ' has been deprecated since v' + version + ' and will be removed in the near future' + ) + ); + } + + return validator ? validator(value, opt, opts) : true; + }; +}; + +/** + * Assert object's properties type + * + * @param {object} options + * @param {object} schema + * @param {boolean?} allowUnknown + * + * @returns {object} + */ + +function assertOptions(options, schema, allowUnknown) { + if (typeof options !== 'object') { + throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE); + } + const keys = Object.keys(options); + let i = keys.length; + while (i-- > 0) { + const opt = keys[i]; + const validator = schema[opt]; + if (validator) { + const value = options[opt]; + const result = value === undefined || validator(value, opt, options); + if (result !== true) { + throw new AxiosError$1('option ' + opt + ' must be ' + result, AxiosError$1.ERR_BAD_OPTION_VALUE); + } + continue; + } + if (allowUnknown !== true) { + throw new AxiosError$1('Unknown option ' + opt, AxiosError$1.ERR_BAD_OPTION); + } + } +} + +const validator = { + assertOptions, + validators: validators$1 +}; + +const validators = validator.validators; + +/** + * Create a new instance of Axios + * + * @param {Object} instanceConfig The default config for the instance + * + * @return {Axios} A new instance of Axios + */ +class Axios$1 { + constructor(instanceConfig) { + this.defaults = instanceConfig; + this.interceptors = { + request: new InterceptorManager$1(), + response: new InterceptorManager$1() + }; + } + + /** + * Dispatch a request + * + * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults) + * @param {?Object} config + * + * @returns {Promise} The Promise to be fulfilled + */ + async request(configOrUrl, config) { + try { + return await this._request(configOrUrl, config); + } catch (err) { + if (err instanceof Error) { + let dummy; + + Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error()); + + // slice off the Error: ... line + const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : ''; + try { + if (!err.stack) { + err.stack = stack; + // match without the 2 top stack lines + } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) { + err.stack += '\n' + stack; + } + } catch (e) { + // ignore the case where "stack" is an un-writable property + } + } + + throw err; + } + } + + _request(configOrUrl, config) { + /*eslint no-param-reassign:0*/ + // Allow for axios('example/url'[, config]) a la fetch API + if (typeof configOrUrl === 'string') { + config = config || {}; + config.url = configOrUrl; + } else { + config = configOrUrl || {}; + } + + config = mergeConfig$1(this.defaults, config); + + const {transitional, paramsSerializer, headers} = config; + + if (transitional !== undefined) { + validator.assertOptions(transitional, { + silentJSONParsing: validators.transitional(validators.boolean), + forcedJSONParsing: validators.transitional(validators.boolean), + clarifyTimeoutError: validators.transitional(validators.boolean) + }, false); + } + + if (paramsSerializer != null) { + if (utils$1.isFunction(paramsSerializer)) { + config.paramsSerializer = { + serialize: paramsSerializer + }; + } else { + validator.assertOptions(paramsSerializer, { + encode: validators.function, + serialize: validators.function + }, true); + } + } + + // Set config.method + config.method = (config.method || this.defaults.method || 'get').toLowerCase(); + + // Flatten headers + let contextHeaders = headers && utils$1.merge( + headers.common, + headers[config.method] + ); + + headers && utils$1.forEach( + ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], + (method) => { + delete headers[method]; + } + ); + + config.headers = AxiosHeaders$2.concat(contextHeaders, headers); + + // filter out skipped interceptors + const requestInterceptorChain = []; + let synchronousRequestInterceptors = true; + this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { + if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { + return; + } + + synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; + + requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); + }); + + const responseInterceptorChain = []; + this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { + responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); + }); + + let promise; + let i = 0; + let len; + + if (!synchronousRequestInterceptors) { + const chain = [dispatchRequest.bind(this), undefined]; + chain.unshift.apply(chain, requestInterceptorChain); + chain.push.apply(chain, responseInterceptorChain); + len = chain.length; + + promise = Promise.resolve(config); + + while (i < len) { + promise = promise.then(chain[i++], chain[i++]); + } + + return promise; + } + + len = requestInterceptorChain.length; + + let newConfig = config; + + i = 0; + + while (i < len) { + const onFulfilled = requestInterceptorChain[i++]; + const onRejected = requestInterceptorChain[i++]; + try { + newConfig = onFulfilled(newConfig); + } catch (error) { + onRejected.call(this, error); + break; + } + } + + try { + promise = dispatchRequest.call(this, newConfig); + } catch (error) { + return Promise.reject(error); + } + + i = 0; + len = responseInterceptorChain.length; + + while (i < len) { + promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]); + } + + return promise; + } + + getUri(config) { + config = mergeConfig$1(this.defaults, config); + const fullPath = buildFullPath(config.baseURL, config.url); + return buildURL(fullPath, config.params, config.paramsSerializer); + } +} + +// Provide aliases for supported request methods +utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { + /*eslint func-names:0*/ + Axios$1.prototype[method] = function(url, config) { + return this.request(mergeConfig$1(config || {}, { + method, + url, + data: (config || {}).data + })); + }; +}); + +utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + /*eslint func-names:0*/ + + function generateHTTPMethod(isForm) { + return function httpMethod(url, data, config) { + return this.request(mergeConfig$1(config || {}, { + method, + headers: isForm ? { + 'Content-Type': 'multipart/form-data' + } : {}, + url, + data + })); + }; + } + + Axios$1.prototype[method] = generateHTTPMethod(); + + Axios$1.prototype[method + 'Form'] = generateHTTPMethod(true); +}); + +const Axios$2 = Axios$1; + +/** + * A `CancelToken` is an object that can be used to request cancellation of an operation. + * + * @param {Function} executor The executor function. + * + * @returns {CancelToken} + */ +class CancelToken$1 { + constructor(executor) { + if (typeof executor !== 'function') { + throw new TypeError('executor must be a function.'); + } + + let resolvePromise; + + this.promise = new Promise(function promiseExecutor(resolve) { + resolvePromise = resolve; + }); + + const token = this; + + // eslint-disable-next-line func-names + this.promise.then(cancel => { + if (!token._listeners) return; + + let i = token._listeners.length; + + while (i-- > 0) { + token._listeners[i](cancel); + } + token._listeners = null; + }); + + // eslint-disable-next-line func-names + this.promise.then = onfulfilled => { + let _resolve; + // eslint-disable-next-line func-names + const promise = new Promise(resolve => { + token.subscribe(resolve); + _resolve = resolve; + }).then(onfulfilled); + + promise.cancel = function reject() { + token.unsubscribe(_resolve); + }; + + return promise; + }; + + executor(function cancel(message, config, request) { + if (token.reason) { + // Cancellation has already been requested + return; + } + + token.reason = new CanceledError$1(message, config, request); + resolvePromise(token.reason); + }); + } + + /** + * Throws a `CanceledError` if cancellation has been requested. + */ + throwIfRequested() { + if (this.reason) { + throw this.reason; + } + } + + /** + * Subscribe to the cancel signal + */ + + subscribe(listener) { + if (this.reason) { + listener(this.reason); + return; + } + + if (this._listeners) { + this._listeners.push(listener); + } else { + this._listeners = [listener]; + } + } + + /** + * Unsubscribe from the cancel signal + */ + + unsubscribe(listener) { + if (!this._listeners) { + return; + } + const index = this._listeners.indexOf(listener); + if (index !== -1) { + this._listeners.splice(index, 1); + } + } + + /** + * Returns an object that contains a new `CancelToken` and a function that, when called, + * cancels the `CancelToken`. + */ + static source() { + let cancel; + const token = new CancelToken$1(function executor(c) { + cancel = c; + }); + return { + token, + cancel + }; + } +} + +const CancelToken$2 = CancelToken$1; + +/** + * Syntactic sugar for invoking a function and expanding an array for arguments. + * + * Common use case would be to use `Function.prototype.apply`. + * + * ```js + * function f(x, y, z) {} + * var args = [1, 2, 3]; + * f.apply(null, args); + * ``` + * + * With `spread` this example can be re-written. + * + * ```js + * spread(function(x, y, z) {})([1, 2, 3]); + * ``` + * + * @param {Function} callback + * + * @returns {Function} + */ +function spread$1(callback) { + return function wrap(arr) { + return callback.apply(null, arr); + }; +} + +/** + * Determines whether the payload is an error thrown by Axios + * + * @param {*} payload The value to test + * + * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false + */ +function isAxiosError$1(payload) { + return utils$1.isObject(payload) && (payload.isAxiosError === true); +} + +const HttpStatusCode$1 = { + Continue: 100, + SwitchingProtocols: 101, + Processing: 102, + EarlyHints: 103, + Ok: 200, + Created: 201, + Accepted: 202, + NonAuthoritativeInformation: 203, + NoContent: 204, + ResetContent: 205, + PartialContent: 206, + MultiStatus: 207, + AlreadyReported: 208, + ImUsed: 226, + MultipleChoices: 300, + MovedPermanently: 301, + Found: 302, + SeeOther: 303, + NotModified: 304, + UseProxy: 305, + Unused: 306, + TemporaryRedirect: 307, + PermanentRedirect: 308, + BadRequest: 400, + Unauthorized: 401, + PaymentRequired: 402, + Forbidden: 403, + NotFound: 404, + MethodNotAllowed: 405, + NotAcceptable: 406, + ProxyAuthenticationRequired: 407, + RequestTimeout: 408, + Conflict: 409, + Gone: 410, + LengthRequired: 411, + PreconditionFailed: 412, + PayloadTooLarge: 413, + UriTooLong: 414, + UnsupportedMediaType: 415, + RangeNotSatisfiable: 416, + ExpectationFailed: 417, + ImATeapot: 418, + MisdirectedRequest: 421, + UnprocessableEntity: 422, + Locked: 423, + FailedDependency: 424, + TooEarly: 425, + UpgradeRequired: 426, + PreconditionRequired: 428, + TooManyRequests: 429, + RequestHeaderFieldsTooLarge: 431, + UnavailableForLegalReasons: 451, + InternalServerError: 500, + NotImplemented: 501, + BadGateway: 502, + ServiceUnavailable: 503, + GatewayTimeout: 504, + HttpVersionNotSupported: 505, + VariantAlsoNegotiates: 506, + InsufficientStorage: 507, + LoopDetected: 508, + NotExtended: 510, + NetworkAuthenticationRequired: 511, +}; + +Object.entries(HttpStatusCode$1).forEach(([key, value]) => { + HttpStatusCode$1[value] = key; +}); + +const HttpStatusCode$2 = HttpStatusCode$1; + +/** + * Create an instance of Axios + * + * @param {Object} defaultConfig The default config for the instance + * + * @returns {Axios} A new instance of Axios + */ +function createInstance(defaultConfig) { + const context = new Axios$2(defaultConfig); + const instance = bind(Axios$2.prototype.request, context); + + // Copy axios.prototype to instance + utils$1.extend(instance, Axios$2.prototype, context, {allOwnKeys: true}); + + // Copy context to instance + utils$1.extend(instance, context, null, {allOwnKeys: true}); + + // Factory for creating new instances + instance.create = function create(instanceConfig) { + return createInstance(mergeConfig$1(defaultConfig, instanceConfig)); + }; + + return instance; +} + +// Create the default instance to be exported +const axios = createInstance(defaults$1); + +// Expose Axios class to allow class inheritance +axios.Axios = Axios$2; + +// Expose Cancel & CancelToken +axios.CanceledError = CanceledError$1; +axios.CancelToken = CancelToken$2; +axios.isCancel = isCancel$1; +axios.VERSION = VERSION$1; +axios.toFormData = toFormData$1; + +// Expose AxiosError class +axios.AxiosError = AxiosError$1; + +// alias for CanceledError for backward compatibility +axios.Cancel = axios.CanceledError; + +// Expose all/spread +axios.all = function all(promises) { + return Promise.all(promises); +}; + +axios.spread = spread$1; + +// Expose isAxiosError +axios.isAxiosError = isAxiosError$1; + +// Expose mergeConfig +axios.mergeConfig = mergeConfig$1; + +axios.AxiosHeaders = AxiosHeaders$2; + +axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing); + +axios.getAdapter = adapters.getAdapter; + +axios.HttpStatusCode = HttpStatusCode$2; + +axios.default = axios; + +// this module should only have a default export +const axios$1 = axios; + +// This module is intended to unwrap Axios default export as named. +// Keep top-level export same with static properties +// so that it can keep same with es module or cjs +const { + Axios, + AxiosError, + CanceledError, + isCancel, + CancelToken, + VERSION, + all, + Cancel, + isAxiosError, + spread, + toFormData, + AxiosHeaders, + HttpStatusCode, + formToJSON, + getAdapter, + mergeConfig +} = axios$1; + +export { Axios, AxiosError, AxiosHeaders, Cancel, CancelToken, CanceledError, HttpStatusCode, VERSION, all, axios$1 as default, formToJSON, getAdapter, isAxiosError, isCancel, mergeConfig, spread, toFormData }; +//# sourceMappingURL=axios.js.map diff --git a/project starter code/node_modules/axios/dist/esm/axios.js.map b/project starter code/node_modules/axios/dist/esm/axios.js.map new file mode 100644 index 00000000..ea2ab215 --- /dev/null +++ b/project starter code/node_modules/axios/dist/esm/axios.js.map @@ -0,0 +1 @@ +{"version":3,"file":"axios.js","sources":["../../lib/helpers/bind.js","../../lib/utils.js","../../lib/core/AxiosError.js","../../lib/helpers/null.js","../../lib/helpers/toFormData.js","../../lib/helpers/AxiosURLSearchParams.js","../../lib/helpers/buildURL.js","../../lib/core/InterceptorManager.js","../../lib/defaults/transitional.js","../../lib/platform/browser/classes/URLSearchParams.js","../../lib/platform/browser/classes/FormData.js","../../lib/platform/browser/classes/Blob.js","../../lib/platform/browser/index.js","../../lib/platform/common/utils.js","../../lib/platform/index.js","../../lib/helpers/toURLEncodedForm.js","../../lib/helpers/formDataToJSON.js","../../lib/defaults/index.js","../../lib/helpers/parseHeaders.js","../../lib/core/AxiosHeaders.js","../../lib/core/transformData.js","../../lib/cancel/isCancel.js","../../lib/cancel/CanceledError.js","../../lib/core/settle.js","../../lib/helpers/parseProtocol.js","../../lib/helpers/speedometer.js","../../lib/helpers/throttle.js","../../lib/helpers/progressEventReducer.js","../../lib/helpers/isURLSameOrigin.js","../../lib/helpers/cookies.js","../../lib/helpers/isAbsoluteURL.js","../../lib/helpers/combineURLs.js","../../lib/core/buildFullPath.js","../../lib/core/mergeConfig.js","../../lib/helpers/resolveConfig.js","../../lib/adapters/xhr.js","../../lib/helpers/composeSignals.js","../../lib/helpers/trackStream.js","../../lib/adapters/fetch.js","../../lib/adapters/adapters.js","../../lib/core/dispatchRequest.js","../../lib/env/data.js","../../lib/helpers/validator.js","../../lib/core/Axios.js","../../lib/cancel/CancelToken.js","../../lib/helpers/spread.js","../../lib/helpers/isAxiosError.js","../../lib/helpers/HttpStatusCode.js","../../lib/axios.js","../../index.js"],"sourcesContent":["'use strict';\n\nexport default function bind(fn, thisArg) {\n return function wrap() {\n return fn.apply(thisArg, arguments);\n };\n}\n","'use strict';\n\nimport bind from './helpers/bind.js';\n\n// utils is a library of generic helper functions non-specific to axios\n\nconst {toString} = Object.prototype;\nconst {getPrototypeOf} = Object;\n\nconst kindOf = (cache => thing => {\n const str = toString.call(thing);\n return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());\n})(Object.create(null));\n\nconst kindOfTest = (type) => {\n type = type.toLowerCase();\n return (thing) => kindOf(thing) === type\n}\n\nconst typeOfTest = type => thing => typeof thing === type;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n *\n * @returns {boolean} True if value is an Array, otherwise false\n */\nconst {isArray} = Array;\n\n/**\n * Determine if a value is undefined\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nconst isUndefined = typeOfTest('undefined');\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nconst isArrayBuffer = kindOfTest('ArrayBuffer');\n\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n let result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a String, otherwise false\n */\nconst isString = typeOfTest('string');\n\n/**\n * Determine if a value is a Function\n *\n * @param {*} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nconst isFunction = typeOfTest('function');\n\n/**\n * Determine if a value is a Number\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Number, otherwise false\n */\nconst isNumber = typeOfTest('number');\n\n/**\n * Determine if a value is an Object\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an Object, otherwise false\n */\nconst isObject = (thing) => thing !== null && typeof thing === 'object';\n\n/**\n * Determine if a value is a Boolean\n *\n * @param {*} thing The value to test\n * @returns {boolean} True if value is a Boolean, otherwise false\n */\nconst isBoolean = thing => thing === true || thing === false;\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a plain Object, otherwise false\n */\nconst isPlainObject = (val) => {\n if (kindOf(val) !== 'object') {\n return false;\n }\n\n const prototype = getPrototypeOf(val);\n return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Date, otherwise false\n */\nconst isDate = kindOfTest('Date');\n\n/**\n * Determine if a value is a File\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFile = kindOfTest('File');\n\n/**\n * Determine if a value is a Blob\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nconst isBlob = kindOfTest('Blob');\n\n/**\n * Determine if a value is a FileList\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFileList = kindOfTest('FileList');\n\n/**\n * Determine if a value is a Stream\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nconst isStream = (val) => isObject(val) && isFunction(val.pipe);\n\n/**\n * Determine if a value is a FormData\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nconst isFormData = (thing) => {\n let kind;\n return thing && (\n (typeof FormData === 'function' && thing instanceof FormData) || (\n isFunction(thing.append) && (\n (kind = kindOf(thing)) === 'formdata' ||\n // detect form-data instance\n (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')\n )\n )\n )\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nconst isURLSearchParams = kindOfTest('URLSearchParams');\n\nconst [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n *\n * @returns {String} The String freed of excess whitespace\n */\nconst trim = (str) => str.trim ?\n str.trim() : str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n *\n * @param {Boolean} [allOwnKeys = false]\n * @returns {any}\n */\nfunction forEach(obj, fn, {allOwnKeys = false} = {}) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n let i;\n let l;\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);\n const len = keys.length;\n let key;\n\n for (i = 0; i < len; i++) {\n key = keys[i];\n fn.call(null, obj[key], key, obj);\n }\n }\n}\n\nfunction findKey(obj, key) {\n key = key.toLowerCase();\n const keys = Object.keys(obj);\n let i = keys.length;\n let _key;\n while (i-- > 0) {\n _key = keys[i];\n if (key === _key.toLowerCase()) {\n return _key;\n }\n }\n return null;\n}\n\nconst _global = (() => {\n /*eslint no-undef:0*/\n if (typeof globalThis !== \"undefined\") return globalThis;\n return typeof self !== \"undefined\" ? self : (typeof window !== 'undefined' ? window : global)\n})();\n\nconst isContextDefined = (context) => !isUndefined(context) && context !== _global;\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n *\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n const {caseless} = isContextDefined(this) && this || {};\n const result = {};\n const assignValue = (val, key) => {\n const targetKey = caseless && findKey(result, key) || key;\n if (isPlainObject(result[targetKey]) && isPlainObject(val)) {\n result[targetKey] = merge(result[targetKey], val);\n } else if (isPlainObject(val)) {\n result[targetKey] = merge({}, val);\n } else if (isArray(val)) {\n result[targetKey] = val.slice();\n } else {\n result[targetKey] = val;\n }\n }\n\n for (let i = 0, l = arguments.length; i < l; i++) {\n arguments[i] && forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n *\n * @param {Boolean} [allOwnKeys]\n * @returns {Object} The resulting value of object a\n */\nconst extend = (a, b, thisArg, {allOwnKeys}= {}) => {\n forEach(b, (val, key) => {\n if (thisArg && isFunction(val)) {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n }, {allOwnKeys});\n return a;\n}\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n *\n * @returns {string} content value without BOM\n */\nconst stripBOM = (content) => {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n}\n\n/**\n * Inherit the prototype methods from one constructor into another\n * @param {function} constructor\n * @param {function} superConstructor\n * @param {object} [props]\n * @param {object} [descriptors]\n *\n * @returns {void}\n */\nconst inherits = (constructor, superConstructor, props, descriptors) => {\n constructor.prototype = Object.create(superConstructor.prototype, descriptors);\n constructor.prototype.constructor = constructor;\n Object.defineProperty(constructor, 'super', {\n value: superConstructor.prototype\n });\n props && Object.assign(constructor.prototype, props);\n}\n\n/**\n * Resolve object with deep prototype chain to a flat object\n * @param {Object} sourceObj source object\n * @param {Object} [destObj]\n * @param {Function|Boolean} [filter]\n * @param {Function} [propFilter]\n *\n * @returns {Object}\n */\nconst toFlatObject = (sourceObj, destObj, filter, propFilter) => {\n let props;\n let i;\n let prop;\n const merged = {};\n\n destObj = destObj || {};\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (sourceObj == null) return destObj;\n\n do {\n props = Object.getOwnPropertyNames(sourceObj);\n i = props.length;\n while (i-- > 0) {\n prop = props[i];\n if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {\n destObj[prop] = sourceObj[prop];\n merged[prop] = true;\n }\n }\n sourceObj = filter !== false && getPrototypeOf(sourceObj);\n } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);\n\n return destObj;\n}\n\n/**\n * Determines whether a string ends with the characters of a specified string\n *\n * @param {String} str\n * @param {String} searchString\n * @param {Number} [position= 0]\n *\n * @returns {boolean}\n */\nconst endsWith = (str, searchString, position) => {\n str = String(str);\n if (position === undefined || position > str.length) {\n position = str.length;\n }\n position -= searchString.length;\n const lastIndex = str.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n}\n\n\n/**\n * Returns new array from array like object or null if failed\n *\n * @param {*} [thing]\n *\n * @returns {?Array}\n */\nconst toArray = (thing) => {\n if (!thing) return null;\n if (isArray(thing)) return thing;\n let i = thing.length;\n if (!isNumber(i)) return null;\n const arr = new Array(i);\n while (i-- > 0) {\n arr[i] = thing[i];\n }\n return arr;\n}\n\n/**\n * Checking if the Uint8Array exists and if it does, it returns a function that checks if the\n * thing passed in is an instance of Uint8Array\n *\n * @param {TypedArray}\n *\n * @returns {Array}\n */\n// eslint-disable-next-line func-names\nconst isTypedArray = (TypedArray => {\n // eslint-disable-next-line func-names\n return thing => {\n return TypedArray && thing instanceof TypedArray;\n };\n})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));\n\n/**\n * For each entry in the object, call the function with the key and value.\n *\n * @param {Object} obj - The object to iterate over.\n * @param {Function} fn - The function to call for each entry.\n *\n * @returns {void}\n */\nconst forEachEntry = (obj, fn) => {\n const generator = obj && obj[Symbol.iterator];\n\n const iterator = generator.call(obj);\n\n let result;\n\n while ((result = iterator.next()) && !result.done) {\n const pair = result.value;\n fn.call(obj, pair[0], pair[1]);\n }\n}\n\n/**\n * It takes a regular expression and a string, and returns an array of all the matches\n *\n * @param {string} regExp - The regular expression to match against.\n * @param {string} str - The string to search.\n *\n * @returns {Array}\n */\nconst matchAll = (regExp, str) => {\n let matches;\n const arr = [];\n\n while ((matches = regExp.exec(str)) !== null) {\n arr.push(matches);\n }\n\n return arr;\n}\n\n/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */\nconst isHTMLForm = kindOfTest('HTMLFormElement');\n\nconst toCamelCase = str => {\n return str.toLowerCase().replace(/[-_\\s]([a-z\\d])(\\w*)/g,\n function replacer(m, p1, p2) {\n return p1.toUpperCase() + p2;\n }\n );\n};\n\n/* Creating a function that will check if an object has a property. */\nconst hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);\n\n/**\n * Determine if a value is a RegExp object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a RegExp object, otherwise false\n */\nconst isRegExp = kindOfTest('RegExp');\n\nconst reduceDescriptors = (obj, reducer) => {\n const descriptors = Object.getOwnPropertyDescriptors(obj);\n const reducedDescriptors = {};\n\n forEach(descriptors, (descriptor, name) => {\n let ret;\n if ((ret = reducer(descriptor, name, obj)) !== false) {\n reducedDescriptors[name] = ret || descriptor;\n }\n });\n\n Object.defineProperties(obj, reducedDescriptors);\n}\n\n/**\n * Makes all methods read-only\n * @param {Object} obj\n */\n\nconst freezeMethods = (obj) => {\n reduceDescriptors(obj, (descriptor, name) => {\n // skip restricted props in strict mode\n if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {\n return false;\n }\n\n const value = obj[name];\n\n if (!isFunction(value)) return;\n\n descriptor.enumerable = false;\n\n if ('writable' in descriptor) {\n descriptor.writable = false;\n return;\n }\n\n if (!descriptor.set) {\n descriptor.set = () => {\n throw Error('Can not rewrite read-only method \\'' + name + '\\'');\n };\n }\n });\n}\n\nconst toObjectSet = (arrayOrString, delimiter) => {\n const obj = {};\n\n const define = (arr) => {\n arr.forEach(value => {\n obj[value] = true;\n });\n }\n\n isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));\n\n return obj;\n}\n\nconst noop = () => {}\n\nconst toFiniteNumber = (value, defaultValue) => {\n return value != null && Number.isFinite(value = +value) ? value : defaultValue;\n}\n\nconst ALPHA = 'abcdefghijklmnopqrstuvwxyz'\n\nconst DIGIT = '0123456789';\n\nconst ALPHABET = {\n DIGIT,\n ALPHA,\n ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT\n}\n\nconst generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {\n let str = '';\n const {length} = alphabet;\n while (size--) {\n str += alphabet[Math.random() * length|0]\n }\n\n return str;\n}\n\n/**\n * If the thing is a FormData object, return true, otherwise return false.\n *\n * @param {unknown} thing - The thing to check.\n *\n * @returns {boolean}\n */\nfunction isSpecCompliantForm(thing) {\n return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);\n}\n\nconst toJSONObject = (obj) => {\n const stack = new Array(10);\n\n const visit = (source, i) => {\n\n if (isObject(source)) {\n if (stack.indexOf(source) >= 0) {\n return;\n }\n\n if(!('toJSON' in source)) {\n stack[i] = source;\n const target = isArray(source) ? [] : {};\n\n forEach(source, (value, key) => {\n const reducedValue = visit(value, i + 1);\n !isUndefined(reducedValue) && (target[key] = reducedValue);\n });\n\n stack[i] = undefined;\n\n return target;\n }\n }\n\n return source;\n }\n\n return visit(obj, 0);\n}\n\nconst isAsyncFn = kindOfTest('AsyncFunction');\n\nconst isThenable = (thing) =>\n thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);\n\nexport default {\n isArray,\n isArrayBuffer,\n isBuffer,\n isFormData,\n isArrayBufferView,\n isString,\n isNumber,\n isBoolean,\n isObject,\n isPlainObject,\n isReadableStream,\n isRequest,\n isResponse,\n isHeaders,\n isUndefined,\n isDate,\n isFile,\n isBlob,\n isRegExp,\n isFunction,\n isStream,\n isURLSearchParams,\n isTypedArray,\n isFileList,\n forEach,\n merge,\n extend,\n trim,\n stripBOM,\n inherits,\n toFlatObject,\n kindOf,\n kindOfTest,\n endsWith,\n toArray,\n forEachEntry,\n matchAll,\n isHTMLForm,\n hasOwnProperty,\n hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection\n reduceDescriptors,\n freezeMethods,\n toObjectSet,\n toCamelCase,\n noop,\n toFiniteNumber,\n findKey,\n global: _global,\n isContextDefined,\n ALPHABET,\n generateString,\n isSpecCompliantForm,\n toJSONObject,\n isAsyncFn,\n isThenable\n};\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [config] The config.\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n *\n * @returns {Error} The created error.\n */\nfunction AxiosError(message, code, config, request, response) {\n Error.call(this);\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n this.stack = (new Error()).stack;\n }\n\n this.message = message;\n this.name = 'AxiosError';\n code && (this.code = code);\n config && (this.config = config);\n request && (this.request = request);\n response && (this.response = response);\n}\n\nutils.inherits(AxiosError, Error, {\n toJSON: function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: utils.toJSONObject(this.config),\n code: this.code,\n status: this.response && this.response.status ? this.response.status : null\n };\n }\n});\n\nconst prototype = AxiosError.prototype;\nconst descriptors = {};\n\n[\n 'ERR_BAD_OPTION_VALUE',\n 'ERR_BAD_OPTION',\n 'ECONNABORTED',\n 'ETIMEDOUT',\n 'ERR_NETWORK',\n 'ERR_FR_TOO_MANY_REDIRECTS',\n 'ERR_DEPRECATED',\n 'ERR_BAD_RESPONSE',\n 'ERR_BAD_REQUEST',\n 'ERR_CANCELED',\n 'ERR_NOT_SUPPORT',\n 'ERR_INVALID_URL'\n// eslint-disable-next-line func-names\n].forEach(code => {\n descriptors[code] = {value: code};\n});\n\nObject.defineProperties(AxiosError, descriptors);\nObject.defineProperty(prototype, 'isAxiosError', {value: true});\n\n// eslint-disable-next-line func-names\nAxiosError.from = (error, code, config, request, response, customProps) => {\n const axiosError = Object.create(prototype);\n\n utils.toFlatObject(error, axiosError, function filter(obj) {\n return obj !== Error.prototype;\n }, prop => {\n return prop !== 'isAxiosError';\n });\n\n AxiosError.call(axiosError, error.message, code, config, request, response);\n\n axiosError.cause = error;\n\n axiosError.name = error.name;\n\n customProps && Object.assign(axiosError, customProps);\n\n return axiosError;\n};\n\nexport default AxiosError;\n","// eslint-disable-next-line strict\nexport default null;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\n// temporary hotfix to avoid circular references until AxiosURLSearchParams is refactored\nimport PlatformFormData from '../platform/node/classes/FormData.js';\n\n/**\n * Determines if the given thing is a array or js object.\n *\n * @param {string} thing - The object or array to be visited.\n *\n * @returns {boolean}\n */\nfunction isVisitable(thing) {\n return utils.isPlainObject(thing) || utils.isArray(thing);\n}\n\n/**\n * It removes the brackets from the end of a string\n *\n * @param {string} key - The key of the parameter.\n *\n * @returns {string} the key without the brackets.\n */\nfunction removeBrackets(key) {\n return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;\n}\n\n/**\n * It takes a path, a key, and a boolean, and returns a string\n *\n * @param {string} path - The path to the current key.\n * @param {string} key - The key of the current object being iterated over.\n * @param {string} dots - If true, the key will be rendered with dots instead of brackets.\n *\n * @returns {string} The path to the current key.\n */\nfunction renderKey(path, key, dots) {\n if (!path) return key;\n return path.concat(key).map(function each(token, i) {\n // eslint-disable-next-line no-param-reassign\n token = removeBrackets(token);\n return !dots && i ? '[' + token + ']' : token;\n }).join(dots ? '.' : '');\n}\n\n/**\n * If the array is an array and none of its elements are visitable, then it's a flat array.\n *\n * @param {Array} arr - The array to check\n *\n * @returns {boolean}\n */\nfunction isFlatArray(arr) {\n return utils.isArray(arr) && !arr.some(isVisitable);\n}\n\nconst predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {\n return /^is[A-Z]/.test(prop);\n});\n\n/**\n * Convert a data object to FormData\n *\n * @param {Object} obj\n * @param {?Object} [formData]\n * @param {?Object} [options]\n * @param {Function} [options.visitor]\n * @param {Boolean} [options.metaTokens = true]\n * @param {Boolean} [options.dots = false]\n * @param {?Boolean} [options.indexes = false]\n *\n * @returns {Object}\n **/\n\n/**\n * It converts an object into a FormData object\n *\n * @param {Object} obj - The object to convert to form data.\n * @param {string} formData - The FormData object to append to.\n * @param {Object} options\n *\n * @returns\n */\nfunction toFormData(obj, formData, options) {\n if (!utils.isObject(obj)) {\n throw new TypeError('target must be an object');\n }\n\n // eslint-disable-next-line no-param-reassign\n formData = formData || new (PlatformFormData || FormData)();\n\n // eslint-disable-next-line no-param-reassign\n options = utils.toFlatObject(options, {\n metaTokens: true,\n dots: false,\n indexes: false\n }, false, function defined(option, source) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n return !utils.isUndefined(source[option]);\n });\n\n const metaTokens = options.metaTokens;\n // eslint-disable-next-line no-use-before-define\n const visitor = options.visitor || defaultVisitor;\n const dots = options.dots;\n const indexes = options.indexes;\n const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;\n const useBlob = _Blob && utils.isSpecCompliantForm(formData);\n\n if (!utils.isFunction(visitor)) {\n throw new TypeError('visitor must be a function');\n }\n\n function convertValue(value) {\n if (value === null) return '';\n\n if (utils.isDate(value)) {\n return value.toISOString();\n }\n\n if (!useBlob && utils.isBlob(value)) {\n throw new AxiosError('Blob is not supported. Use a Buffer instead.');\n }\n\n if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {\n return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);\n }\n\n return value;\n }\n\n /**\n * Default visitor.\n *\n * @param {*} value\n * @param {String|Number} key\n * @param {Array} path\n * @this {FormData}\n *\n * @returns {boolean} return true to visit the each prop of the value recursively\n */\n function defaultVisitor(value, key, path) {\n let arr = value;\n\n if (value && !path && typeof value === 'object') {\n if (utils.endsWith(key, '{}')) {\n // eslint-disable-next-line no-param-reassign\n key = metaTokens ? key : key.slice(0, -2);\n // eslint-disable-next-line no-param-reassign\n value = JSON.stringify(value);\n } else if (\n (utils.isArray(value) && isFlatArray(value)) ||\n ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))\n )) {\n // eslint-disable-next-line no-param-reassign\n key = removeBrackets(key);\n\n arr.forEach(function each(el, index) {\n !(utils.isUndefined(el) || el === null) && formData.append(\n // eslint-disable-next-line no-nested-ternary\n indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),\n convertValue(el)\n );\n });\n return false;\n }\n }\n\n if (isVisitable(value)) {\n return true;\n }\n\n formData.append(renderKey(path, key, dots), convertValue(value));\n\n return false;\n }\n\n const stack = [];\n\n const exposedHelpers = Object.assign(predicates, {\n defaultVisitor,\n convertValue,\n isVisitable\n });\n\n function build(value, path) {\n if (utils.isUndefined(value)) return;\n\n if (stack.indexOf(value) !== -1) {\n throw Error('Circular reference detected in ' + path.join('.'));\n }\n\n stack.push(value);\n\n utils.forEach(value, function each(el, key) {\n const result = !(utils.isUndefined(el) || el === null) && visitor.call(\n formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers\n );\n\n if (result === true) {\n build(el, path ? path.concat(key) : [key]);\n }\n });\n\n stack.pop();\n }\n\n if (!utils.isObject(obj)) {\n throw new TypeError('data must be an object');\n }\n\n build(obj);\n\n return formData;\n}\n\nexport default toFormData;\n","'use strict';\n\nimport toFormData from './toFormData.js';\n\n/**\n * It encodes a string by replacing all characters that are not in the unreserved set with\n * their percent-encoded equivalents\n *\n * @param {string} str - The string to encode.\n *\n * @returns {string} The encoded string.\n */\nfunction encode(str) {\n const charMap = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n '%00': '\\x00'\n };\n return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {\n return charMap[match];\n });\n}\n\n/**\n * It takes a params object and converts it to a FormData object\n *\n * @param {Object} params - The parameters to be converted to a FormData object.\n * @param {Object} options - The options object passed to the Axios constructor.\n *\n * @returns {void}\n */\nfunction AxiosURLSearchParams(params, options) {\n this._pairs = [];\n\n params && toFormData(params, this, options);\n}\n\nconst prototype = AxiosURLSearchParams.prototype;\n\nprototype.append = function append(name, value) {\n this._pairs.push([name, value]);\n};\n\nprototype.toString = function toString(encoder) {\n const _encode = encoder ? function(value) {\n return encoder.call(this, value, encode);\n } : encode;\n\n return this._pairs.map(function each(pair) {\n return _encode(pair[0]) + '=' + _encode(pair[1]);\n }, '').join('&');\n};\n\nexport default AxiosURLSearchParams;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js';\n\n/**\n * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their\n * URI encoded counterparts\n *\n * @param {string} val The value to be encoded.\n *\n * @returns {string} The encoded value.\n */\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @param {?object} options\n *\n * @returns {string} The formatted url\n */\nexport default function buildURL(url, params, options) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n \n const _encode = options && options.encode || encode;\n\n const serializeFn = options && options.serialize;\n\n let serializedParams;\n\n if (serializeFn) {\n serializedParams = serializeFn(params, options);\n } else {\n serializedParams = utils.isURLSearchParams(params) ?\n params.toString() :\n new AxiosURLSearchParams(params, options).toString(_encode);\n }\n\n if (serializedParams) {\n const hashmarkIndex = url.indexOf(\"#\");\n\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\nclass InterceptorManager {\n constructor() {\n this.handlers = [];\n }\n\n /**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\n use(fulfilled, rejected, options) {\n this.handlers.push({\n fulfilled,\n rejected,\n synchronous: options ? options.synchronous : false,\n runWhen: options ? options.runWhen : null\n });\n return this.handlers.length - 1;\n }\n\n /**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n *\n * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise\n */\n eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n }\n\n /**\n * Clear all interceptors from the stack\n *\n * @returns {void}\n */\n clear() {\n if (this.handlers) {\n this.handlers = [];\n }\n }\n\n /**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n *\n * @returns {void}\n */\n forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n }\n}\n\nexport default InterceptorManager;\n","'use strict';\n\nexport default {\n silentJSONParsing: true,\n forcedJSONParsing: true,\n clarifyTimeoutError: false\n};\n","'use strict';\n\nimport AxiosURLSearchParams from '../../../helpers/AxiosURLSearchParams.js';\nexport default typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;\n","'use strict';\n\nexport default typeof FormData !== 'undefined' ? FormData : null;\n","'use strict'\n\nexport default typeof Blob !== 'undefined' ? Blob : null\n","import URLSearchParams from './classes/URLSearchParams.js'\nimport FormData from './classes/FormData.js'\nimport Blob from './classes/Blob.js'\n\nexport default {\n isBrowser: true,\n classes: {\n URLSearchParams,\n FormData,\n Blob\n },\n protocols: ['http', 'https', 'file', 'blob', 'url', 'data']\n};\n","const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n *\n * @returns {boolean}\n */\nconst hasStandardBrowserEnv = (\n (product) => {\n return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0\n })(typeof navigator !== 'undefined' && navigator.product);\n\n/**\n * Determine if we're running in a standard browser webWorker environment\n *\n * Although the `isStandardBrowserEnv` method indicates that\n * `allows axios to run in a web worker`, the WebWorker will still be\n * filtered out due to its judgment standard\n * `typeof window !== 'undefined' && typeof document !== 'undefined'`.\n * This leads to a problem when axios post `FormData` in webWorker\n */\nconst hasStandardBrowserWebWorkerEnv = (() => {\n return (\n typeof WorkerGlobalScope !== 'undefined' &&\n // eslint-disable-next-line no-undef\n self instanceof WorkerGlobalScope &&\n typeof self.importScripts === 'function'\n );\n})();\n\nconst origin = hasBrowserEnv && window.location.href || 'http://localhost';\n\nexport {\n hasBrowserEnv,\n hasStandardBrowserWebWorkerEnv,\n hasStandardBrowserEnv,\n origin\n}\n","import platform from './node/index.js';\nimport * as utils from './common/utils.js';\n\nexport default {\n ...utils,\n ...platform\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport toFormData from './toFormData.js';\nimport platform from '../platform/index.js';\n\nexport default function toURLEncodedForm(data, options) {\n return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({\n visitor: function(value, key, path, helpers) {\n if (platform.isNode && utils.isBuffer(value)) {\n this.append(key, value.toString('base64'));\n return false;\n }\n\n return helpers.defaultVisitor.apply(this, arguments);\n }\n }, options));\n}\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']\n *\n * @param {string} name - The name of the property to get.\n *\n * @returns An array of strings.\n */\nfunction parsePropPath(name) {\n // foo[x][y][z]\n // foo.x.y.z\n // foo-x-y-z\n // foo x y z\n return utils.matchAll(/\\w+|\\[(\\w*)]/g, name).map(match => {\n return match[0] === '[]' ? '' : match[1] || match[0];\n });\n}\n\n/**\n * Convert an array to an object.\n *\n * @param {Array} arr - The array to convert to an object.\n *\n * @returns An object with the same keys and values as the array.\n */\nfunction arrayToObject(arr) {\n const obj = {};\n const keys = Object.keys(arr);\n let i;\n const len = keys.length;\n let key;\n for (i = 0; i < len; i++) {\n key = keys[i];\n obj[key] = arr[key];\n }\n return obj;\n}\n\n/**\n * It takes a FormData object and returns a JavaScript object\n *\n * @param {string} formData The FormData object to convert to JSON.\n *\n * @returns {Object | null} The converted object.\n */\nfunction formDataToJSON(formData) {\n function buildPath(path, value, target, index) {\n let name = path[index++];\n\n if (name === '__proto__') return true;\n\n const isNumericKey = Number.isFinite(+name);\n const isLast = index >= path.length;\n name = !name && utils.isArray(target) ? target.length : name;\n\n if (isLast) {\n if (utils.hasOwnProp(target, name)) {\n target[name] = [target[name], value];\n } else {\n target[name] = value;\n }\n\n return !isNumericKey;\n }\n\n if (!target[name] || !utils.isObject(target[name])) {\n target[name] = [];\n }\n\n const result = buildPath(path, value, target[name], index);\n\n if (result && utils.isArray(target[name])) {\n target[name] = arrayToObject(target[name]);\n }\n\n return !isNumericKey;\n }\n\n if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {\n const obj = {};\n\n utils.forEachEntry(formData, (name, value) => {\n buildPath(parsePropPath(name), value, obj, 0);\n });\n\n return obj;\n }\n\n return null;\n}\n\nexport default formDataToJSON;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\nimport transitionalDefaults from './transitional.js';\nimport toFormData from '../helpers/toFormData.js';\nimport toURLEncodedForm from '../helpers/toURLEncodedForm.js';\nimport platform from '../platform/index.js';\nimport formDataToJSON from '../helpers/formDataToJSON.js';\n\n/**\n * It takes a string, tries to parse it, and if it fails, it returns the stringified version\n * of the input\n *\n * @param {any} rawValue - The value to be stringified.\n * @param {Function} parser - A function that parses a string into a JavaScript object.\n * @param {Function} encoder - A function that takes a value and returns a string.\n *\n * @returns {string} A stringified version of the rawValue.\n */\nfunction stringifySafely(rawValue, parser, encoder) {\n if (utils.isString(rawValue)) {\n try {\n (parser || JSON.parse)(rawValue);\n return utils.trim(rawValue);\n } catch (e) {\n if (e.name !== 'SyntaxError') {\n throw e;\n }\n }\n }\n\n return (encoder || JSON.stringify)(rawValue);\n}\n\nconst defaults = {\n\n transitional: transitionalDefaults,\n\n adapter: ['xhr', 'http', 'fetch'],\n\n transformRequest: [function transformRequest(data, headers) {\n const contentType = headers.getContentType() || '';\n const hasJSONContentType = contentType.indexOf('application/json') > -1;\n const isObjectPayload = utils.isObject(data);\n\n if (isObjectPayload && utils.isHTMLForm(data)) {\n data = new FormData(data);\n }\n\n const isFormData = utils.isFormData(data);\n\n if (isFormData) {\n return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;\n }\n\n if (utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data) ||\n utils.isReadableStream(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);\n return data.toString();\n }\n\n let isFileList;\n\n if (isObjectPayload) {\n if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {\n return toURLEncodedForm(data, this.formSerializer).toString();\n }\n\n if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {\n const _FormData = this.env && this.env.FormData;\n\n return toFormData(\n isFileList ? {'files[]': data} : data,\n _FormData && new _FormData(),\n this.formSerializer\n );\n }\n }\n\n if (isObjectPayload || hasJSONContentType ) {\n headers.setContentType('application/json', false);\n return stringifySafely(data);\n }\n\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n const transitional = this.transitional || defaults.transitional;\n const forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n const JSONRequested = this.responseType === 'json';\n\n if (utils.isResponse(data) || utils.isReadableStream(data)) {\n return data;\n }\n\n if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {\n const silentJSONParsing = transitional && transitional.silentJSONParsing;\n const strictJSONParsing = !silentJSONParsing && JSONRequested;\n\n try {\n return JSON.parse(data);\n } catch (e) {\n if (strictJSONParsing) {\n if (e.name === 'SyntaxError') {\n throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);\n }\n throw e;\n }\n }\n }\n\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n env: {\n FormData: platform.classes.FormData,\n Blob: platform.classes.Blob\n },\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n },\n\n headers: {\n common: {\n 'Accept': 'application/json, text/plain, */*',\n 'Content-Type': undefined\n }\n }\n};\n\nutils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {\n defaults.headers[method] = {};\n});\n\nexport default defaults;\n","'use strict';\n\nimport utils from './../utils.js';\n\n// RawAxiosHeaders whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nconst ignoreDuplicateOf = utils.toObjectSet([\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n]);\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} rawHeaders Headers needing to be parsed\n *\n * @returns {Object} Headers parsed into an object\n */\nexport default rawHeaders => {\n const parsed = {};\n let key;\n let val;\n let i;\n\n rawHeaders && rawHeaders.split('\\n').forEach(function parser(line) {\n i = line.indexOf(':');\n key = line.substring(0, i).trim().toLowerCase();\n val = line.substring(i + 1).trim();\n\n if (!key || (parsed[key] && ignoreDuplicateOf[key])) {\n return;\n }\n\n if (key === 'set-cookie') {\n if (parsed[key]) {\n parsed[key].push(val);\n } else {\n parsed[key] = [val];\n }\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n });\n\n return parsed;\n};\n","'use strict';\n\nimport utils from '../utils.js';\nimport parseHeaders from '../helpers/parseHeaders.js';\n\nconst $internals = Symbol('internals');\n\nfunction normalizeHeader(header) {\n return header && String(header).trim().toLowerCase();\n}\n\nfunction normalizeValue(value) {\n if (value === false || value == null) {\n return value;\n }\n\n return utils.isArray(value) ? value.map(normalizeValue) : String(value);\n}\n\nfunction parseTokens(str) {\n const tokens = Object.create(null);\n const tokensRE = /([^\\s,;=]+)\\s*(?:=\\s*([^,;]+))?/g;\n let match;\n\n while ((match = tokensRE.exec(str))) {\n tokens[match[1]] = match[2];\n }\n\n return tokens;\n}\n\nconst isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());\n\nfunction matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {\n if (utils.isFunction(filter)) {\n return filter.call(this, value, header);\n }\n\n if (isHeaderNameFilter) {\n value = header;\n }\n\n if (!utils.isString(value)) return;\n\n if (utils.isString(filter)) {\n return value.indexOf(filter) !== -1;\n }\n\n if (utils.isRegExp(filter)) {\n return filter.test(value);\n }\n}\n\nfunction formatHeader(header) {\n return header.trim()\n .toLowerCase().replace(/([a-z\\d])(\\w*)/g, (w, char, str) => {\n return char.toUpperCase() + str;\n });\n}\n\nfunction buildAccessors(obj, header) {\n const accessorName = utils.toCamelCase(' ' + header);\n\n ['get', 'set', 'has'].forEach(methodName => {\n Object.defineProperty(obj, methodName + accessorName, {\n value: function(arg1, arg2, arg3) {\n return this[methodName].call(this, header, arg1, arg2, arg3);\n },\n configurable: true\n });\n });\n}\n\nclass AxiosHeaders {\n constructor(headers) {\n headers && this.set(headers);\n }\n\n set(header, valueOrRewrite, rewrite) {\n const self = this;\n\n function setHeader(_value, _header, _rewrite) {\n const lHeader = normalizeHeader(_header);\n\n if (!lHeader) {\n throw new Error('header name must be a non-empty string');\n }\n\n const key = utils.findKey(self, lHeader);\n\n if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {\n self[key || _header] = normalizeValue(_value);\n }\n }\n\n const setHeaders = (headers, _rewrite) =>\n utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));\n\n if (utils.isPlainObject(header) || header instanceof this.constructor) {\n setHeaders(header, valueOrRewrite)\n } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {\n setHeaders(parseHeaders(header), valueOrRewrite);\n } else if (utils.isHeaders(header)) {\n for (const [key, value] of header.entries()) {\n setHeader(value, key, rewrite);\n }\n } else {\n header != null && setHeader(valueOrRewrite, header, rewrite);\n }\n\n return this;\n }\n\n get(header, parser) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n if (key) {\n const value = this[key];\n\n if (!parser) {\n return value;\n }\n\n if (parser === true) {\n return parseTokens(value);\n }\n\n if (utils.isFunction(parser)) {\n return parser.call(this, value, key);\n }\n\n if (utils.isRegExp(parser)) {\n return parser.exec(value);\n }\n\n throw new TypeError('parser must be boolean|regexp|function');\n }\n }\n }\n\n has(header, matcher) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));\n }\n\n return false;\n }\n\n delete(header, matcher) {\n const self = this;\n let deleted = false;\n\n function deleteHeader(_header) {\n _header = normalizeHeader(_header);\n\n if (_header) {\n const key = utils.findKey(self, _header);\n\n if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {\n delete self[key];\n\n deleted = true;\n }\n }\n }\n\n if (utils.isArray(header)) {\n header.forEach(deleteHeader);\n } else {\n deleteHeader(header);\n }\n\n return deleted;\n }\n\n clear(matcher) {\n const keys = Object.keys(this);\n let i = keys.length;\n let deleted = false;\n\n while (i--) {\n const key = keys[i];\n if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {\n delete this[key];\n deleted = true;\n }\n }\n\n return deleted;\n }\n\n normalize(format) {\n const self = this;\n const headers = {};\n\n utils.forEach(this, (value, header) => {\n const key = utils.findKey(headers, header);\n\n if (key) {\n self[key] = normalizeValue(value);\n delete self[header];\n return;\n }\n\n const normalized = format ? formatHeader(header) : String(header).trim();\n\n if (normalized !== header) {\n delete self[header];\n }\n\n self[normalized] = normalizeValue(value);\n\n headers[normalized] = true;\n });\n\n return this;\n }\n\n concat(...targets) {\n return this.constructor.concat(this, ...targets);\n }\n\n toJSON(asStrings) {\n const obj = Object.create(null);\n\n utils.forEach(this, (value, header) => {\n value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);\n });\n\n return obj;\n }\n\n [Symbol.iterator]() {\n return Object.entries(this.toJSON())[Symbol.iterator]();\n }\n\n toString() {\n return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\\n');\n }\n\n get [Symbol.toStringTag]() {\n return 'AxiosHeaders';\n }\n\n static from(thing) {\n return thing instanceof this ? thing : new this(thing);\n }\n\n static concat(first, ...targets) {\n const computed = new this(first);\n\n targets.forEach((target) => computed.set(target));\n\n return computed;\n }\n\n static accessor(header) {\n const internals = this[$internals] = (this[$internals] = {\n accessors: {}\n });\n\n const accessors = internals.accessors;\n const prototype = this.prototype;\n\n function defineAccessor(_header) {\n const lHeader = normalizeHeader(_header);\n\n if (!accessors[lHeader]) {\n buildAccessors(prototype, _header);\n accessors[lHeader] = true;\n }\n }\n\n utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);\n\n return this;\n }\n}\n\nAxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);\n\n// reserved names hotfix\nutils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {\n let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`\n return {\n get: () => value,\n set(headerValue) {\n this[mapped] = headerValue;\n }\n }\n});\n\nutils.freezeMethods(AxiosHeaders);\n\nexport default AxiosHeaders;\n","'use strict';\n\nimport utils from './../utils.js';\nimport defaults from '../defaults/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Array|Function} fns A single function or Array of functions\n * @param {?Object} response The response object\n *\n * @returns {*} The resulting transformed data\n */\nexport default function transformData(fns, response) {\n const config = this || defaults;\n const context = response || config;\n const headers = AxiosHeaders.from(context.headers);\n let data = context.data;\n\n utils.forEach(fns, function transform(fn) {\n data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);\n });\n\n headers.normalize();\n\n return data;\n}\n","'use strict';\n\nexport default function isCancel(value) {\n return !!(value && value.__CANCEL__);\n}\n","'use strict';\n\nimport AxiosError from '../core/AxiosError.js';\nimport utils from '../utils.js';\n\n/**\n * A `CanceledError` is an object that is thrown when an operation is canceled.\n *\n * @param {string=} message The message.\n * @param {Object=} config The config.\n * @param {Object=} request The request.\n *\n * @returns {CanceledError} The created error.\n */\nfunction CanceledError(message, config, request) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);\n this.name = 'CanceledError';\n}\n\nutils.inherits(CanceledError, AxiosError, {\n __CANCEL__: true\n});\n\nexport default CanceledError;\n","'use strict';\n\nimport AxiosError from './AxiosError.js';\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n *\n * @returns {object} The response.\n */\nexport default function settle(resolve, reject, response) {\n const validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(new AxiosError(\n 'Request failed with status code ' + response.status,\n [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],\n response.config,\n response.request,\n response\n ));\n }\n}\n","'use strict';\n\nexport default function parseProtocol(url) {\n const match = /^([-+\\w]{1,25})(:?\\/\\/|:)/.exec(url);\n return match && match[1] || '';\n}\n","'use strict';\n\n/**\n * Calculate data maxRate\n * @param {Number} [samplesCount= 10]\n * @param {Number} [min= 1000]\n * @returns {Function}\n */\nfunction speedometer(samplesCount, min) {\n samplesCount = samplesCount || 10;\n const bytes = new Array(samplesCount);\n const timestamps = new Array(samplesCount);\n let head = 0;\n let tail = 0;\n let firstSampleTS;\n\n min = min !== undefined ? min : 1000;\n\n return function push(chunkLength) {\n const now = Date.now();\n\n const startedAt = timestamps[tail];\n\n if (!firstSampleTS) {\n firstSampleTS = now;\n }\n\n bytes[head] = chunkLength;\n timestamps[head] = now;\n\n let i = tail;\n let bytesCount = 0;\n\n while (i !== head) {\n bytesCount += bytes[i++];\n i = i % samplesCount;\n }\n\n head = (head + 1) % samplesCount;\n\n if (head === tail) {\n tail = (tail + 1) % samplesCount;\n }\n\n if (now - firstSampleTS < min) {\n return;\n }\n\n const passed = startedAt && now - startedAt;\n\n return passed ? Math.round(bytesCount * 1000 / passed) : undefined;\n };\n}\n\nexport default speedometer;\n","'use strict';\n\n/**\n * Throttle decorator\n * @param {Function} fn\n * @param {Number} freq\n * @return {Function}\n */\nfunction throttle(fn, freq) {\n let timestamp = 0;\n const threshold = 1000 / freq;\n let timer = null;\n return function throttled() {\n const force = this === true;\n\n const now = Date.now();\n if (force || now - timestamp > threshold) {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n timestamp = now;\n return fn.apply(null, arguments);\n }\n if (!timer) {\n timer = setTimeout(() => {\n timer = null;\n timestamp = Date.now();\n return fn.apply(null, arguments);\n }, threshold - (now - timestamp));\n }\n };\n}\n\nexport default throttle;\n","import speedometer from \"./speedometer.js\";\nimport throttle from \"./throttle.js\";\n\nexport default (listener, isDownloadStream, freq = 3) => {\n let bytesNotified = 0;\n const _speedometer = speedometer(50, 250);\n\n return throttle(e => {\n const loaded = e.loaded;\n const total = e.lengthComputable ? e.total : undefined;\n const progressBytes = loaded - bytesNotified;\n const rate = _speedometer(progressBytes);\n const inRange = loaded <= total;\n\n bytesNotified = loaded;\n\n const data = {\n loaded,\n total,\n progress: total ? (loaded / total) : undefined,\n bytes: progressBytes,\n rate: rate ? rate : undefined,\n estimated: rate && total && inRange ? (total - loaded) / rate : undefined,\n event: e,\n lengthComputable: total != null\n };\n\n data[isDownloadStream ? 'download' : 'upload'] = true;\n\n listener(data);\n }, freq);\n}\n","'use strict';\n\nimport utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n// Standard browser envs have full support of the APIs needed to test\n// whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n const msie = /(msie|trident)/i.test(navigator.userAgent);\n const urlParsingNode = document.createElement('a');\n let originURL;\n\n /**\n * Parse a URL to discover its components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n let href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })();\n","import utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n // Standard browser envs support document.cookie\n {\n write(name, value, expires, path, domain, secure) {\n const cookie = [name + '=' + encodeURIComponent(value)];\n\n utils.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());\n\n utils.isString(path) && cookie.push('path=' + path);\n\n utils.isString(domain) && cookie.push('domain=' + domain);\n\n secure === true && cookie.push('secure');\n\n document.cookie = cookie.join('; ');\n },\n\n read(name) {\n const match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n }\n\n :\n\n // Non-standard browser env (web workers, react-native) lack needed support.\n {\n write() {},\n read() {\n return null;\n },\n remove() {}\n };\n\n","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n *\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nexport default function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(url);\n}\n","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n *\n * @returns {string} The combined URL\n */\nexport default function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/?\\/$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n}\n","'use strict';\n\nimport isAbsoluteURL from '../helpers/isAbsoluteURL.js';\nimport combineURLs from '../helpers/combineURLs.js';\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n *\n * @returns {string} The combined full path\n */\nexport default function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosHeaders from \"./AxiosHeaders.js\";\n\nconst headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n *\n * @returns {Object} New object resulting from merging config2 to config1\n */\nexport default function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n const config = {};\n\n function getMergedValue(target, source, caseless) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge.call({caseless}, target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDeepProperties(a, b, caseless) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(a, b, caseless);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a, caseless);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function valueFromConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function defaultToConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDirectKeys(a, b, prop) {\n if (prop in config2) {\n return getMergedValue(a, b);\n } else if (prop in config1) {\n return getMergedValue(undefined, a);\n }\n }\n\n const mergeMap = {\n url: valueFromConfig2,\n method: valueFromConfig2,\n data: valueFromConfig2,\n baseURL: defaultToConfig2,\n transformRequest: defaultToConfig2,\n transformResponse: defaultToConfig2,\n paramsSerializer: defaultToConfig2,\n timeout: defaultToConfig2,\n timeoutMessage: defaultToConfig2,\n withCredentials: defaultToConfig2,\n withXSRFToken: defaultToConfig2,\n adapter: defaultToConfig2,\n responseType: defaultToConfig2,\n xsrfCookieName: defaultToConfig2,\n xsrfHeaderName: defaultToConfig2,\n onUploadProgress: defaultToConfig2,\n onDownloadProgress: defaultToConfig2,\n decompress: defaultToConfig2,\n maxContentLength: defaultToConfig2,\n maxBodyLength: defaultToConfig2,\n beforeRedirect: defaultToConfig2,\n transport: defaultToConfig2,\n httpAgent: defaultToConfig2,\n httpsAgent: defaultToConfig2,\n cancelToken: defaultToConfig2,\n socketPath: defaultToConfig2,\n responseEncoding: defaultToConfig2,\n validateStatus: mergeDirectKeys,\n headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)\n };\n\n utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {\n const merge = mergeMap[prop] || mergeDeepProperties;\n const configValue = merge(config1[prop], config2[prop], prop);\n (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);\n });\n\n return config;\n}\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport isURLSameOrigin from \"./isURLSameOrigin.js\";\nimport cookies from \"./cookies.js\";\nimport buildFullPath from \"../core/buildFullPath.js\";\nimport mergeConfig from \"../core/mergeConfig.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport buildURL from \"./buildURL.js\";\n\nexport default (config) => {\n const newConfig = mergeConfig({}, config);\n\n let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;\n\n newConfig.headers = headers = AxiosHeaders.from(headers);\n\n newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);\n\n // HTTP basic authentication\n if (auth) {\n headers.set('Authorization', 'Basic ' +\n btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))\n );\n }\n\n let contentType;\n\n if (utils.isFormData(data)) {\n if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {\n headers.setContentType(undefined); // Let the browser set it\n } else if ((contentType = headers.getContentType()) !== false) {\n // fix semicolon duplication issue for ReactNative FormData implementation\n const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];\n headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));\n }\n }\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n\n if (platform.hasStandardBrowserEnv) {\n withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));\n\n if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {\n // Add xsrf header\n const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);\n\n if (xsrfValue) {\n headers.set(xsrfHeaderName, xsrfValue);\n }\n }\n }\n\n return newConfig;\n}\n\n","import utils from './../utils.js';\nimport settle from './../core/settle.js';\nimport transitionalDefaults from '../defaults/transitional.js';\nimport AxiosError from '../core/AxiosError.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport parseProtocol from '../helpers/parseProtocol.js';\nimport platform from '../platform/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport progressEventReducer from '../helpers/progressEventReducer.js';\nimport resolveConfig from \"../helpers/resolveConfig.js\";\n\nconst isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';\n\nexport default isXHRAdapterSupported && function (config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n const _config = resolveConfig(config);\n let requestData = _config.data;\n const requestHeaders = AxiosHeaders.from(_config.headers).normalize();\n let {responseType} = _config;\n let onCanceled;\n function done() {\n if (_config.cancelToken) {\n _config.cancelToken.unsubscribe(onCanceled);\n }\n\n if (_config.signal) {\n _config.signal.removeEventListener('abort', onCanceled);\n }\n }\n\n let request = new XMLHttpRequest();\n\n request.open(_config.method.toUpperCase(), _config.url, true);\n\n // Set the request timeout in MS\n request.timeout = _config.timeout;\n\n function onloadend() {\n if (!request) {\n return;\n }\n // Prepare the response\n const responseHeaders = AxiosHeaders.from(\n 'getAllResponseHeaders' in request && request.getAllResponseHeaders()\n );\n const responseData = !responseType || responseType === 'text' || responseType === 'json' ?\n request.responseText : request.response;\n const response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config,\n request\n };\n\n settle(function _resolve(value) {\n resolve(value);\n done();\n }, function _reject(err) {\n reject(err);\n done();\n }, response);\n\n // Clean up request\n request = null;\n }\n\n if ('onloadend' in request) {\n // Use onloadend if available\n request.onloadend = onloadend;\n } else {\n // Listen for ready state to emulate onloadend\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n // readystate handler is calling before onerror or ontimeout handlers,\n // so we should call onloadend on the next 'tick'\n setTimeout(onloadend);\n };\n }\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';\n const transitional = _config.transitional || transitionalDefaults;\n if (_config.timeoutErrorMessage) {\n timeoutErrorMessage = _config.timeoutErrorMessage;\n }\n reject(new AxiosError(\n timeoutErrorMessage,\n transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,\n _config,\n request));\n\n // Clean up request\n request = null;\n };\n\n // Remove Content-Type if data is undefined\n requestData === undefined && requestHeaders.setContentType(null);\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {\n request.setRequestHeader(key, val);\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(_config.withCredentials)) {\n request.withCredentials = !!_config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (responseType && responseType !== 'json') {\n request.responseType = _config.responseType;\n }\n\n // Handle progress if needed\n if (typeof _config.onDownloadProgress === 'function') {\n request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true));\n }\n\n // Not all browsers support upload events\n if (typeof _config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress));\n }\n\n if (_config.cancelToken || _config.signal) {\n // Handle cancellation\n // eslint-disable-next-line func-names\n onCanceled = cancel => {\n if (!request) {\n return;\n }\n reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);\n request.abort();\n request = null;\n };\n\n _config.cancelToken && _config.cancelToken.subscribe(onCanceled);\n if (_config.signal) {\n _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);\n }\n }\n\n const protocol = parseProtocol(_config.url);\n\n if (protocol && platform.protocols.indexOf(protocol) === -1) {\n reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));\n return;\n }\n\n\n // Send the request\n request.send(requestData || null);\n });\n}\n","import CanceledError from \"../cancel/CanceledError.js\";\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst composeSignals = (signals, timeout) => {\n let controller = new AbortController();\n\n let aborted;\n\n const onabort = function (cancel) {\n if (!aborted) {\n aborted = true;\n unsubscribe();\n const err = cancel instanceof Error ? cancel : this.reason;\n controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));\n }\n }\n\n let timer = timeout && setTimeout(() => {\n onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT))\n }, timeout)\n\n const unsubscribe = () => {\n if (signals) {\n timer && clearTimeout(timer);\n timer = null;\n signals.forEach(signal => {\n signal &&\n (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));\n });\n signals = null;\n }\n }\n\n signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort));\n\n const {signal} = controller;\n\n signal.unsubscribe = unsubscribe;\n\n return [signal, () => {\n timer && clearTimeout(timer);\n timer = null;\n }];\n}\n\nexport default composeSignals;\n","\n\nexport const streamChunk = function* (chunk, chunkSize) {\n let len = chunk.byteLength;\n\n if (!chunkSize || len < chunkSize) {\n yield chunk;\n return;\n }\n\n let pos = 0;\n let end;\n\n while (pos < len) {\n end = pos + chunkSize;\n yield chunk.slice(pos, end);\n pos = end;\n }\n}\n\nexport const readBytes = async function* (iterable, chunkSize, encode) {\n for await (const chunk of iterable) {\n yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);\n }\n}\n\nexport const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {\n const iterator = readBytes(stream, chunkSize, encode);\n\n let bytes = 0;\n\n return new ReadableStream({\n type: 'bytes',\n\n async pull(controller) {\n const {done, value} = await iterator.next();\n\n if (done) {\n controller.close();\n onFinish();\n return;\n }\n\n let len = value.byteLength;\n onProgress && onProgress(bytes += len);\n controller.enqueue(new Uint8Array(value));\n },\n cancel(reason) {\n onFinish(reason);\n return iterator.return();\n }\n }, {\n highWaterMark: 2\n })\n}\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport AxiosError from \"../core/AxiosError.js\";\nimport composeSignals from \"../helpers/composeSignals.js\";\nimport {trackStream} from \"../helpers/trackStream.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport progressEventReducer from \"../helpers/progressEventReducer.js\";\nimport resolveConfig from \"../helpers/resolveConfig.js\";\nimport settle from \"../core/settle.js\";\n\nconst fetchProgressDecorator = (total, fn) => {\n const lengthComputable = total != null;\n return (loaded) => setTimeout(() => fn({\n lengthComputable,\n total,\n loaded\n }));\n}\n\nconst isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';\nconst isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';\n\n// used only inside the fetch adapter\nconst encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?\n ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :\n async (str) => new Uint8Array(await new Response(str).arrayBuffer())\n);\n\nconst supportsRequestStream = isReadableStreamSupported && (() => {\n let duplexAccessed = false;\n\n const hasContentType = new Request(platform.origin, {\n body: new ReadableStream(),\n method: 'POST',\n get duplex() {\n duplexAccessed = true;\n return 'half';\n },\n }).headers.has('Content-Type');\n\n return duplexAccessed && !hasContentType;\n})();\n\nconst DEFAULT_CHUNK_SIZE = 64 * 1024;\n\nconst supportsResponseStream = isReadableStreamSupported && !!(()=> {\n try {\n return utils.isReadableStream(new Response('').body);\n } catch(err) {\n // return undefined\n }\n})();\n\nconst resolvers = {\n stream: supportsResponseStream && ((res) => res.body)\n};\n\nisFetchSupported && (((res) => {\n ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {\n !resolvers[type] && (resolvers[type] = utils.isFunction(res[type]) ? (res) => res[type]() :\n (_, config) => {\n throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);\n })\n });\n})(new Response));\n\nconst getBodyLength = async (body) => {\n if (body == null) {\n return 0;\n }\n\n if(utils.isBlob(body)) {\n return body.size;\n }\n\n if(utils.isSpecCompliantForm(body)) {\n return (await new Request(body).arrayBuffer()).byteLength;\n }\n\n if(utils.isArrayBufferView(body)) {\n return body.byteLength;\n }\n\n if(utils.isURLSearchParams(body)) {\n body = body + '';\n }\n\n if(utils.isString(body)) {\n return (await encodeText(body)).byteLength;\n }\n}\n\nconst resolveBodyLength = async (headers, body) => {\n const length = utils.toFiniteNumber(headers.getContentLength());\n\n return length == null ? getBodyLength(body) : length;\n}\n\nexport default isFetchSupported && (async (config) => {\n let {\n url,\n method,\n data,\n signal,\n cancelToken,\n timeout,\n onDownloadProgress,\n onUploadProgress,\n responseType,\n headers,\n withCredentials = 'same-origin',\n fetchOptions\n } = resolveConfig(config);\n\n responseType = responseType ? (responseType + '').toLowerCase() : 'text';\n\n let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ?\n composeSignals([signal, cancelToken], timeout) : [];\n\n let finished, request;\n\n const onFinish = () => {\n !finished && setTimeout(() => {\n composedSignal && composedSignal.unsubscribe();\n });\n\n finished = true;\n }\n\n let requestContentLength;\n\n try {\n if (\n onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&\n (requestContentLength = await resolveBodyLength(headers, data)) !== 0\n ) {\n let _request = new Request(url, {\n method: 'POST',\n body: data,\n duplex: \"half\"\n });\n\n let contentTypeHeader;\n\n if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {\n headers.setContentType(contentTypeHeader)\n }\n\n if (_request.body) {\n data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(\n requestContentLength,\n progressEventReducer(onUploadProgress)\n ), null, encodeText);\n }\n }\n\n if (!utils.isString(withCredentials)) {\n withCredentials = withCredentials ? 'cors' : 'omit';\n }\n\n request = new Request(url, {\n ...fetchOptions,\n signal: composedSignal,\n method: method.toUpperCase(),\n headers: headers.normalize().toJSON(),\n body: data,\n duplex: \"half\",\n withCredentials\n });\n\n let response = await fetch(request);\n\n const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');\n\n if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {\n const options = {};\n\n ['status', 'statusText', 'headers'].forEach(prop => {\n options[prop] = response[prop];\n });\n\n const responseContentLength = utils.toFiniteNumber(response.headers.get('content-length'));\n\n response = new Response(\n trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(\n responseContentLength,\n progressEventReducer(onDownloadProgress, true)\n ), isStreamResponse && onFinish, encodeText),\n options\n );\n }\n\n responseType = responseType || 'text';\n\n let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](response, config);\n\n !isStreamResponse && onFinish();\n\n stopTimeout && stopTimeout();\n\n return await new Promise((resolve, reject) => {\n settle(resolve, reject, {\n data: responseData,\n headers: AxiosHeaders.from(response.headers),\n status: response.status,\n statusText: response.statusText,\n config,\n request\n })\n })\n } catch (err) {\n onFinish();\n\n if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {\n throw Object.assign(\n new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),\n {\n cause: err.cause || err\n }\n )\n }\n\n throw AxiosError.from(err, err && err.code, config, request);\n }\n});\n\n\n","import utils from '../utils.js';\nimport httpAdapter from './http.js';\nimport xhrAdapter from './xhr.js';\nimport fetchAdapter from './fetch.js';\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst knownAdapters = {\n http: httpAdapter,\n xhr: xhrAdapter,\n fetch: fetchAdapter\n}\n\nutils.forEach(knownAdapters, (fn, value) => {\n if (fn) {\n try {\n Object.defineProperty(fn, 'name', {value});\n } catch (e) {\n // eslint-disable-next-line no-empty\n }\n Object.defineProperty(fn, 'adapterName', {value});\n }\n});\n\nconst renderReason = (reason) => `- ${reason}`;\n\nconst isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;\n\nexport default {\n getAdapter: (adapters) => {\n adapters = utils.isArray(adapters) ? adapters : [adapters];\n\n const {length} = adapters;\n let nameOrAdapter;\n let adapter;\n\n const rejectedReasons = {};\n\n for (let i = 0; i < length; i++) {\n nameOrAdapter = adapters[i];\n let id;\n\n adapter = nameOrAdapter;\n\n if (!isResolvedHandle(nameOrAdapter)) {\n adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];\n\n if (adapter === undefined) {\n throw new AxiosError(`Unknown adapter '${id}'`);\n }\n }\n\n if (adapter) {\n break;\n }\n\n rejectedReasons[id || '#' + i] = adapter;\n }\n\n if (!adapter) {\n\n const reasons = Object.entries(rejectedReasons)\n .map(([id, state]) => `adapter ${id} ` +\n (state === false ? 'is not supported by the environment' : 'is not available in the build')\n );\n\n let s = length ?\n (reasons.length > 1 ? 'since :\\n' + reasons.map(renderReason).join('\\n') : ' ' + renderReason(reasons[0])) :\n 'as no adapter specified';\n\n throw new AxiosError(\n `There is no suitable adapter to dispatch the request ` + s,\n 'ERR_NOT_SUPPORT'\n );\n }\n\n return adapter;\n },\n adapters: knownAdapters\n}\n","'use strict';\n\nimport transformData from './transformData.js';\nimport isCancel from '../cancel/isCancel.js';\nimport defaults from '../defaults/index.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport adapters from \"../adapters/adapters.js\";\n\n/**\n * Throws a `CanceledError` if cancellation has been requested.\n *\n * @param {Object} config The config that is to be used for the request\n *\n * @returns {void}\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n\n if (config.signal && config.signal.aborted) {\n throw new CanceledError(null, config);\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n *\n * @returns {Promise} The Promise to be fulfilled\n */\nexport default function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n config.headers = AxiosHeaders.from(config.headers);\n\n // Transform request data\n config.data = transformData.call(\n config,\n config.transformRequest\n );\n\n if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {\n config.headers.setContentType('application/x-www-form-urlencoded', false);\n }\n\n const adapter = adapters.getAdapter(config.adapter || defaults.adapter);\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData.call(\n config,\n config.transformResponse,\n response\n );\n\n response.headers = AxiosHeaders.from(response.headers);\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData.call(\n config,\n config.transformResponse,\n reason.response\n );\n reason.response.headers = AxiosHeaders.from(reason.response.headers);\n }\n }\n\n return Promise.reject(reason);\n });\n}\n","export const VERSION = \"1.7.2\";","'use strict';\n\nimport {VERSION} from '../env/data.js';\nimport AxiosError from '../core/AxiosError.js';\n\nconst validators = {};\n\n// eslint-disable-next-line func-names\n['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {\n validators[type] = function validator(thing) {\n return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;\n };\n});\n\nconst deprecatedWarnings = {};\n\n/**\n * Transitional option validator\n *\n * @param {function|boolean?} validator - set to false if the transitional option has been removed\n * @param {string?} version - deprecated version / removed since version\n * @param {string?} message - some message with additional info\n *\n * @returns {function}\n */\nvalidators.transitional = function transitional(validator, version, message) {\n function formatMessage(opt, desc) {\n return '[Axios v' + VERSION + '] Transitional option \\'' + opt + '\\'' + desc + (message ? '. ' + message : '');\n }\n\n // eslint-disable-next-line func-names\n return (value, opt, opts) => {\n if (validator === false) {\n throw new AxiosError(\n formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),\n AxiosError.ERR_DEPRECATED\n );\n }\n\n if (version && !deprecatedWarnings[opt]) {\n deprecatedWarnings[opt] = true;\n // eslint-disable-next-line no-console\n console.warn(\n formatMessage(\n opt,\n ' has been deprecated since v' + version + ' and will be removed in the near future'\n )\n );\n }\n\n return validator ? validator(value, opt, opts) : true;\n };\n};\n\n/**\n * Assert object's properties type\n *\n * @param {object} options\n * @param {object} schema\n * @param {boolean?} allowUnknown\n *\n * @returns {object}\n */\n\nfunction assertOptions(options, schema, allowUnknown) {\n if (typeof options !== 'object') {\n throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);\n }\n const keys = Object.keys(options);\n let i = keys.length;\n while (i-- > 0) {\n const opt = keys[i];\n const validator = schema[opt];\n if (validator) {\n const value = options[opt];\n const result = value === undefined || validator(value, opt, options);\n if (result !== true) {\n throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);\n }\n continue;\n }\n if (allowUnknown !== true) {\n throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);\n }\n }\n}\n\nexport default {\n assertOptions,\n validators\n};\n","'use strict';\n\nimport utils from './../utils.js';\nimport buildURL from '../helpers/buildURL.js';\nimport InterceptorManager from './InterceptorManager.js';\nimport dispatchRequest from './dispatchRequest.js';\nimport mergeConfig from './mergeConfig.js';\nimport buildFullPath from './buildFullPath.js';\nimport validator from '../helpers/validator.js';\nimport AxiosHeaders from './AxiosHeaders.js';\n\nconst validators = validator.validators;\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n *\n * @return {Axios} A new instance of Axios\n */\nclass Axios {\n constructor(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n }\n\n /**\n * Dispatch a request\n *\n * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)\n * @param {?Object} config\n *\n * @returns {Promise} The Promise to be fulfilled\n */\n async request(configOrUrl, config) {\n try {\n return await this._request(configOrUrl, config);\n } catch (err) {\n if (err instanceof Error) {\n let dummy;\n\n Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());\n\n // slice off the Error: ... line\n const stack = dummy.stack ? dummy.stack.replace(/^.+\\n/, '') : '';\n try {\n if (!err.stack) {\n err.stack = stack;\n // match without the 2 top stack lines\n } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\\n.+\\n/, ''))) {\n err.stack += '\\n' + stack\n }\n } catch (e) {\n // ignore the case where \"stack\" is an un-writable property\n }\n }\n\n throw err;\n }\n }\n\n _request(configOrUrl, config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof configOrUrl === 'string') {\n config = config || {};\n config.url = configOrUrl;\n } else {\n config = configOrUrl || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n const {transitional, paramsSerializer, headers} = config;\n\n if (transitional !== undefined) {\n validator.assertOptions(transitional, {\n silentJSONParsing: validators.transitional(validators.boolean),\n forcedJSONParsing: validators.transitional(validators.boolean),\n clarifyTimeoutError: validators.transitional(validators.boolean)\n }, false);\n }\n\n if (paramsSerializer != null) {\n if (utils.isFunction(paramsSerializer)) {\n config.paramsSerializer = {\n serialize: paramsSerializer\n }\n } else {\n validator.assertOptions(paramsSerializer, {\n encode: validators.function,\n serialize: validators.function\n }, true);\n }\n }\n\n // Set config.method\n config.method = (config.method || this.defaults.method || 'get').toLowerCase();\n\n // Flatten headers\n let contextHeaders = headers && utils.merge(\n headers.common,\n headers[config.method]\n );\n\n headers && utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n (method) => {\n delete headers[method];\n }\n );\n\n config.headers = AxiosHeaders.concat(contextHeaders, headers);\n\n // filter out skipped interceptors\n const requestInterceptorChain = [];\n let synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n const responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n let promise;\n let i = 0;\n let len;\n\n if (!synchronousRequestInterceptors) {\n const chain = [dispatchRequest.bind(this), undefined];\n chain.unshift.apply(chain, requestInterceptorChain);\n chain.push.apply(chain, responseInterceptorChain);\n len = chain.length;\n\n promise = Promise.resolve(config);\n\n while (i < len) {\n promise = promise.then(chain[i++], chain[i++]);\n }\n\n return promise;\n }\n\n len = requestInterceptorChain.length;\n\n let newConfig = config;\n\n i = 0;\n\n while (i < len) {\n const onFulfilled = requestInterceptorChain[i++];\n const onRejected = requestInterceptorChain[i++];\n try {\n newConfig = onFulfilled(newConfig);\n } catch (error) {\n onRejected.call(this, error);\n break;\n }\n }\n\n try {\n promise = dispatchRequest.call(this, newConfig);\n } catch (error) {\n return Promise.reject(error);\n }\n\n i = 0;\n len = responseInterceptorChain.length;\n\n while (i < len) {\n promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);\n }\n\n return promise;\n }\n\n getUri(config) {\n config = mergeConfig(this.defaults, config);\n const fullPath = buildFullPath(config.baseURL, config.url);\n return buildURL(fullPath, config.params, config.paramsSerializer);\n }\n}\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n\n function generateHTTPMethod(isForm) {\n return function httpMethod(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n headers: isForm ? {\n 'Content-Type': 'multipart/form-data'\n } : {},\n url,\n data\n }));\n };\n }\n\n Axios.prototype[method] = generateHTTPMethod();\n\n Axios.prototype[method + 'Form'] = generateHTTPMethod(true);\n});\n\nexport default Axios;\n","'use strict';\n\nimport CanceledError from './CanceledError.js';\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @param {Function} executor The executor function.\n *\n * @returns {CancelToken}\n */\nclass CancelToken {\n constructor(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n let resolvePromise;\n\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n const token = this;\n\n // eslint-disable-next-line func-names\n this.promise.then(cancel => {\n if (!token._listeners) return;\n\n let i = token._listeners.length;\n\n while (i-- > 0) {\n token._listeners[i](cancel);\n }\n token._listeners = null;\n });\n\n // eslint-disable-next-line func-names\n this.promise.then = onfulfilled => {\n let _resolve;\n // eslint-disable-next-line func-names\n const promise = new Promise(resolve => {\n token.subscribe(resolve);\n _resolve = resolve;\n }).then(onfulfilled);\n\n promise.cancel = function reject() {\n token.unsubscribe(_resolve);\n };\n\n return promise;\n };\n\n executor(function cancel(message, config, request) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new CanceledError(message, config, request);\n resolvePromise(token.reason);\n });\n }\n\n /**\n * Throws a `CanceledError` if cancellation has been requested.\n */\n throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n }\n\n /**\n * Subscribe to the cancel signal\n */\n\n subscribe(listener) {\n if (this.reason) {\n listener(this.reason);\n return;\n }\n\n if (this._listeners) {\n this._listeners.push(listener);\n } else {\n this._listeners = [listener];\n }\n }\n\n /**\n * Unsubscribe from the cancel signal\n */\n\n unsubscribe(listener) {\n if (!this._listeners) {\n return;\n }\n const index = this._listeners.indexOf(listener);\n if (index !== -1) {\n this._listeners.splice(index, 1);\n }\n }\n\n /**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\n static source() {\n let cancel;\n const token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token,\n cancel\n };\n }\n}\n\nexport default CancelToken;\n","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n *\n * @returns {Function}\n */\nexport default function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n *\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nexport default function isAxiosError(payload) {\n return utils.isObject(payload) && (payload.isAxiosError === true);\n}\n","const HttpStatusCode = {\n Continue: 100,\n SwitchingProtocols: 101,\n Processing: 102,\n EarlyHints: 103,\n Ok: 200,\n Created: 201,\n Accepted: 202,\n NonAuthoritativeInformation: 203,\n NoContent: 204,\n ResetContent: 205,\n PartialContent: 206,\n MultiStatus: 207,\n AlreadyReported: 208,\n ImUsed: 226,\n MultipleChoices: 300,\n MovedPermanently: 301,\n Found: 302,\n SeeOther: 303,\n NotModified: 304,\n UseProxy: 305,\n Unused: 306,\n TemporaryRedirect: 307,\n PermanentRedirect: 308,\n BadRequest: 400,\n Unauthorized: 401,\n PaymentRequired: 402,\n Forbidden: 403,\n NotFound: 404,\n MethodNotAllowed: 405,\n NotAcceptable: 406,\n ProxyAuthenticationRequired: 407,\n RequestTimeout: 408,\n Conflict: 409,\n Gone: 410,\n LengthRequired: 411,\n PreconditionFailed: 412,\n PayloadTooLarge: 413,\n UriTooLong: 414,\n UnsupportedMediaType: 415,\n RangeNotSatisfiable: 416,\n ExpectationFailed: 417,\n ImATeapot: 418,\n MisdirectedRequest: 421,\n UnprocessableEntity: 422,\n Locked: 423,\n FailedDependency: 424,\n TooEarly: 425,\n UpgradeRequired: 426,\n PreconditionRequired: 428,\n TooManyRequests: 429,\n RequestHeaderFieldsTooLarge: 431,\n UnavailableForLegalReasons: 451,\n InternalServerError: 500,\n NotImplemented: 501,\n BadGateway: 502,\n ServiceUnavailable: 503,\n GatewayTimeout: 504,\n HttpVersionNotSupported: 505,\n VariantAlsoNegotiates: 506,\n InsufficientStorage: 507,\n LoopDetected: 508,\n NotExtended: 510,\n NetworkAuthenticationRequired: 511,\n};\n\nObject.entries(HttpStatusCode).forEach(([key, value]) => {\n HttpStatusCode[value] = key;\n});\n\nexport default HttpStatusCode;\n","'use strict';\n\nimport utils from './utils.js';\nimport bind from './helpers/bind.js';\nimport Axios from './core/Axios.js';\nimport mergeConfig from './core/mergeConfig.js';\nimport defaults from './defaults/index.js';\nimport formDataToJSON from './helpers/formDataToJSON.js';\nimport CanceledError from './cancel/CanceledError.js';\nimport CancelToken from './cancel/CancelToken.js';\nimport isCancel from './cancel/isCancel.js';\nimport {VERSION} from './env/data.js';\nimport toFormData from './helpers/toFormData.js';\nimport AxiosError from './core/AxiosError.js';\nimport spread from './helpers/spread.js';\nimport isAxiosError from './helpers/isAxiosError.js';\nimport AxiosHeaders from \"./core/AxiosHeaders.js\";\nimport adapters from './adapters/adapters.js';\nimport HttpStatusCode from './helpers/HttpStatusCode.js';\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n *\n * @returns {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n const context = new Axios(defaultConfig);\n const instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});\n\n // Copy context to instance\n utils.extend(instance, context, null, {allOwnKeys: true});\n\n // Factory for creating new instances\n instance.create = function create(instanceConfig) {\n return createInstance(mergeConfig(defaultConfig, instanceConfig));\n };\n\n return instance;\n}\n\n// Create the default instance to be exported\nconst axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Expose Cancel & CancelToken\naxios.CanceledError = CanceledError;\naxios.CancelToken = CancelToken;\naxios.isCancel = isCancel;\naxios.VERSION = VERSION;\naxios.toFormData = toFormData;\n\n// Expose AxiosError class\naxios.AxiosError = AxiosError;\n\n// alias for CanceledError for backward compatibility\naxios.Cancel = axios.CanceledError;\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\n\naxios.spread = spread;\n\n// Expose isAxiosError\naxios.isAxiosError = isAxiosError;\n\n// Expose mergeConfig\naxios.mergeConfig = mergeConfig;\n\naxios.AxiosHeaders = AxiosHeaders;\n\naxios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);\n\naxios.getAdapter = adapters.getAdapter;\n\naxios.HttpStatusCode = HttpStatusCode;\n\naxios.default = axios;\n\n// this module should only have a default export\nexport default axios\n","import axios from './lib/axios.js';\n\n// This module is intended to unwrap Axios default export as named.\n// Keep top-level export same with static properties\n// so that it can keep same with es module or cjs\nconst {\n Axios,\n AxiosError,\n CanceledError,\n isCancel,\n CancelToken,\n VERSION,\n all,\n Cancel,\n isAxiosError,\n spread,\n toFormData,\n AxiosHeaders,\n HttpStatusCode,\n formToJSON,\n getAdapter,\n mergeConfig\n} = axios;\n\nexport {\n axios as default,\n Axios,\n AxiosError,\n CanceledError,\n isCancel,\n CancelToken,\n VERSION,\n all,\n Cancel,\n isAxiosError,\n spread,\n toFormData,\n AxiosHeaders,\n HttpStatusCode,\n formToJSON,\n getAdapter,\n mergeConfig\n}\n"],"names":["AxiosError","utils","prototype","toFormData","encode","URLSearchParams","FormData","Blob","platform","AxiosHeaders","defaults","isCancel","CanceledError","mergeConfig","composeSignals","VERSION","validators","Axios","InterceptorManager","CancelToken","spread","isAxiosError","HttpStatusCode","axios"],"mappings":";AAEe,SAAS,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE;AAC1C,EAAE,OAAO,SAAS,IAAI,GAAG;AACzB,IAAI,OAAO,EAAE,CAAC,KAAK,CAAC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/project starter code/node_modules/axios/dist/esm/axios.min.js b/project starter code/node_modules/axios/dist/esm/axios.min.js new file mode 100644 index 00000000..6373f437 --- /dev/null +++ b/project starter code/node_modules/axios/dist/esm/axios.min.js @@ -0,0 +1,2 @@ +function e(e,t){return function(){return e.apply(t,arguments)}}const{toString:t}=Object.prototype,{getPrototypeOf:n}=Object,r=(o=Object.create(null),e=>{const n=t.call(e);return o[n]||(o[n]=n.slice(8,-1).toLowerCase())});var o;const s=e=>(e=e.toLowerCase(),t=>r(t)===e),i=e=>t=>typeof t===e,{isArray:a}=Array,c=i("undefined");const u=s("ArrayBuffer");const l=i("string"),f=i("function"),d=i("number"),h=e=>null!==e&&"object"==typeof e,p=e=>{if("object"!==r(e))return!1;const t=n(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},m=s("Date"),y=s("File"),b=s("Blob"),g=s("FileList"),w=s("URLSearchParams"),[E,O,R,S]=["ReadableStream","Request","Response","Headers"].map(s);function T(e,t,{allOwnKeys:n=!1}={}){if(null==e)return;let r,o;if("object"!=typeof e&&(e=[e]),a(e))for(r=0,o=e.length;r0;)if(r=n[o],t===r.toLowerCase())return r;return null}const v="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,C=e=>!c(e)&&e!==v;const x=(N="undefined"!=typeof Uint8Array&&n(Uint8Array),e=>N&&e instanceof N);var N;const j=s("HTMLFormElement"),P=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),_=s("RegExp"),F=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};T(n,((n,o)=>{let s;!1!==(s=t(n,o,e))&&(r[o]=s||n)})),Object.defineProperties(e,r)},L="abcdefghijklmnopqrstuvwxyz",U={DIGIT:"0123456789",ALPHA:L,ALPHA_DIGIT:L+L.toUpperCase()+"0123456789"};const B=s("AsyncFunction"),D={isArray:a,isArrayBuffer:u,isBuffer:function(e){return null!==e&&!c(e)&&null!==e.constructor&&!c(e.constructor)&&f(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||f(e.append)&&("formdata"===(t=r(e))||"object"===t&&f(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&u(e.buffer),t},isString:l,isNumber:d,isBoolean:e=>!0===e||!1===e,isObject:h,isPlainObject:p,isReadableStream:E,isRequest:O,isResponse:R,isHeaders:S,isUndefined:c,isDate:m,isFile:y,isBlob:b,isRegExp:_,isFunction:f,isStream:e=>h(e)&&f(e.pipe),isURLSearchParams:w,isTypedArray:x,isFileList:g,forEach:T,merge:function e(){const{caseless:t}=C(this)&&this||{},n={},r=(r,o)=>{const s=t&&A(n,o)||o;p(n[s])&&p(r)?n[s]=e(n[s],r):p(r)?n[s]=e({},r):a(r)?n[s]=r.slice():n[s]=r};for(let e=0,t=arguments.length;e(T(n,((n,o)=>{r&&f(n)?t[o]=e(n,r):t[o]=n}),{allOwnKeys:o}),t),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},toFlatObject:(e,t,r,o)=>{let s,i,a;const c={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)a=s[i],o&&!o(a,e,t)||c[a]||(t[a]=e[a],c[a]=!0);e=!1!==r&&n(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:r,kindOfTest:s,endsWith:(e,t,n)=>{e=String(e),(void 0===n||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return-1!==r&&r===n},toArray:e=>{if(!e)return null;if(a(e))return e;let t=e.length;if(!d(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},forEachEntry:(e,t)=>{const n=(e&&e[Symbol.iterator]).call(e);let r;for(;(r=n.next())&&!r.done;){const n=r.value;t.call(e,n[0],n[1])}},matchAll:(e,t)=>{let n;const r=[];for(;null!==(n=e.exec(t));)r.push(n);return r},isHTMLForm:j,hasOwnProperty:P,hasOwnProp:P,reduceDescriptors:F,freezeMethods:e=>{F(e,((t,n)=>{if(f(e)&&-1!==["arguments","caller","callee"].indexOf(n))return!1;const r=e[n];f(r)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")}))}))},toObjectSet:(e,t)=>{const n={},r=e=>{e.forEach((e=>{n[e]=!0}))};return a(e)?r(e):r(String(e).split(t)),n},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,n){return t.toUpperCase()+n})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:A,global:v,isContextDefined:C,ALPHABET:U,generateString:(e=16,t=U.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n},isSpecCompliantForm:function(e){return!!(e&&f(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),n=(e,r)=>{if(h(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[r]=e;const o=a(e)?[]:{};return T(e,((e,t)=>{const s=n(e,r+1);!c(s)&&(o[t]=s)})),t[r]=void 0,o}}return e};return n(e,0)},isAsyncFn:B,isThenable:e=>e&&(h(e)||f(e))&&f(e.then)&&f(e.catch)};function k(e,t,n,r,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),o&&(this.response=o)}D.inherits(k,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:D.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const q=k.prototype,I={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{I[e]={value:e}})),Object.defineProperties(k,I),Object.defineProperty(q,"isAxiosError",{value:!0}),k.from=(e,t,n,r,o,s)=>{const i=Object.create(q);return D.toFlatObject(e,i,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),k.call(i,e.message,t,n,r,o),i.cause=e,i.name=e.name,s&&Object.assign(i,s),i};function z(e){return D.isPlainObject(e)||D.isArray(e)}function M(e){return D.endsWith(e,"[]")?e.slice(0,-2):e}function H(e,t,n){return e?e.concat(t).map((function(e,t){return e=M(e),!n&&t?"["+e+"]":e})).join(n?".":""):t}const J=D.toFlatObject(D,{},null,(function(e){return/^is[A-Z]/.test(e)}));function W(e,t,n){if(!D.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(n=D.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!D.isUndefined(t[e])}))).metaTokens,o=n.visitor||u,s=n.dots,i=n.indexes,a=(n.Blob||"undefined"!=typeof Blob&&Blob)&&D.isSpecCompliantForm(t);if(!D.isFunction(o))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(D.isDate(e))return e.toISOString();if(!a&&D.isBlob(e))throw new k("Blob is not supported. Use a Buffer instead.");return D.isArrayBuffer(e)||D.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,n,o){let a=e;if(e&&!o&&"object"==typeof e)if(D.endsWith(n,"{}"))n=r?n:n.slice(0,-2),e=JSON.stringify(e);else if(D.isArray(e)&&function(e){return D.isArray(e)&&!e.some(z)}(e)||(D.isFileList(e)||D.endsWith(n,"[]"))&&(a=D.toArray(e)))return n=M(n),a.forEach((function(e,r){!D.isUndefined(e)&&null!==e&&t.append(!0===i?H([n],r,s):null===i?n:n+"[]",c(e))})),!1;return!!z(e)||(t.append(H(o,n,s),c(e)),!1)}const l=[],f=Object.assign(J,{defaultVisitor:u,convertValue:c,isVisitable:z});if(!D.isObject(e))throw new TypeError("data must be an object");return function e(n,r){if(!D.isUndefined(n)){if(-1!==l.indexOf(n))throw Error("Circular reference detected in "+r.join("."));l.push(n),D.forEach(n,(function(n,s){!0===(!(D.isUndefined(n)||null===n)&&o.call(t,n,D.isString(s)?s.trim():s,r,f))&&e(n,r?r.concat(s):[s])})),l.pop()}}(e),t}function V(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function K(e,t){this._pairs=[],e&&W(e,this,t)}const $=K.prototype;function G(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function X(e,t,n){if(!t)return e;const r=n&&n.encode||G,o=n&&n.serialize;let s;if(s=o?o(t,n):D.isURLSearchParams(t)?t.toString():new K(t,n).toString(r),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}$.append=function(e,t){this._pairs.push([e,t])},$.toString=function(e){const t=e?function(t){return e.call(this,t,V)}:V;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};const Q=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){D.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Z={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Y={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:K,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},ee="undefined"!=typeof window&&"undefined"!=typeof document,te=(ne="undefined"!=typeof navigator&&navigator.product,ee&&["ReactNative","NativeScript","NS"].indexOf(ne)<0);var ne;const re="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,oe=ee&&window.location.href||"http://localhost",se={...Object.freeze({__proto__:null,hasBrowserEnv:ee,hasStandardBrowserWebWorkerEnv:re,hasStandardBrowserEnv:te,origin:oe}),...Y};function ie(e){function t(e,n,r,o){let s=e[o++];if("__proto__"===s)return!0;const i=Number.isFinite(+s),a=o>=e.length;if(s=!s&&D.isArray(r)?r.length:s,a)return D.hasOwnProp(r,s)?r[s]=[r[s],n]:r[s]=n,!i;r[s]&&D.isObject(r[s])||(r[s]=[]);return t(e,n,r[s],o)&&D.isArray(r[s])&&(r[s]=function(e){const t={},n=Object.keys(e);let r;const o=n.length;let s;for(r=0;r{t(function(e){return D.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),r,n,0)})),n}return null}const ae={transitional:Z,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const n=t.getContentType()||"",r=n.indexOf("application/json")>-1,o=D.isObject(e);o&&D.isHTMLForm(e)&&(e=new FormData(e));if(D.isFormData(e))return r?JSON.stringify(ie(e)):e;if(D.isArrayBuffer(e)||D.isBuffer(e)||D.isStream(e)||D.isFile(e)||D.isBlob(e)||D.isReadableStream(e))return e;if(D.isArrayBufferView(e))return e.buffer;if(D.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let s;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return W(e,new se.classes.URLSearchParams,Object.assign({visitor:function(e,t,n,r){return se.isNode&&D.isBuffer(e)?(this.append(t,e.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((s=D.isFileList(e))||n.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return W(s?{"files[]":e}:e,t&&new t,this.formSerializer)}}return o||r?(t.setContentType("application/json",!1),function(e,t,n){if(D.isString(e))try{return(t||JSON.parse)(e),D.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||ae.transitional,n=t&&t.forcedJSONParsing,r="json"===this.responseType;if(D.isResponse(e)||D.isReadableStream(e))return e;if(e&&D.isString(e)&&(n&&!this.responseType||r)){const n=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(e){if(n){if("SyntaxError"===e.name)throw k.from(e,k.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:se.classes.FormData,Blob:se.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};D.forEach(["delete","get","head","post","put","patch"],(e=>{ae.headers[e]={}}));const ce=ae,ue=D.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),le=Symbol("internals");function fe(e){return e&&String(e).trim().toLowerCase()}function de(e){return!1===e||null==e?e:D.isArray(e)?e.map(de):String(e)}function he(e,t,n,r,o){return D.isFunction(r)?r.call(this,t,n):(o&&(t=n),D.isString(t)?D.isString(r)?-1!==t.indexOf(r):D.isRegExp(r)?r.test(t):void 0:void 0)}class pe{constructor(e){e&&this.set(e)}set(e,t,n){const r=this;function o(e,t,n){const o=fe(t);if(!o)throw new Error("header name must be a non-empty string");const s=D.findKey(r,o);(!s||void 0===r[s]||!0===n||void 0===n&&!1!==r[s])&&(r[s||t]=de(e))}const s=(e,t)=>D.forEach(e,((e,n)=>o(e,n,t)));if(D.isPlainObject(e)||e instanceof this.constructor)s(e,t);else if(D.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))s((e=>{const t={};let n,r,o;return e&&e.split("\n").forEach((function(e){o=e.indexOf(":"),n=e.substring(0,o).trim().toLowerCase(),r=e.substring(o+1).trim(),!n||t[n]&&ue[n]||("set-cookie"===n?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)})),t})(e),t);else if(D.isHeaders(e))for(const[t,r]of e.entries())o(r,t,n);else null!=e&&o(t,e,n);return this}get(e,t){if(e=fe(e)){const n=D.findKey(this,e);if(n){const e=this[n];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}(e);if(D.isFunction(t))return t.call(this,e,n);if(D.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=fe(e)){const n=D.findKey(this,e);return!(!n||void 0===this[n]||t&&!he(0,this[n],n,t))}return!1}delete(e,t){const n=this;let r=!1;function o(e){if(e=fe(e)){const o=D.findKey(n,e);!o||t&&!he(0,n[o],o,t)||(delete n[o],r=!0)}}return D.isArray(e)?e.forEach(o):o(e),r}clear(e){const t=Object.keys(this);let n=t.length,r=!1;for(;n--;){const o=t[n];e&&!he(0,this[o],o,e,!0)||(delete this[o],r=!0)}return r}normalize(e){const t=this,n={};return D.forEach(this,((r,o)=>{const s=D.findKey(n,o);if(s)return t[s]=de(r),void delete t[o];const i=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,n)=>t.toUpperCase()+n))}(o):String(o).trim();i!==o&&delete t[o],t[i]=de(r),n[i]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return D.forEach(this,((n,r)=>{null!=n&&!1!==n&&(t[r]=e&&D.isArray(n)?n.join(", "):n)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const n=new this(e);return t.forEach((e=>n.set(e))),n}static accessor(e){const t=(this[le]=this[le]={accessors:{}}).accessors,n=this.prototype;function r(e){const r=fe(e);t[r]||(!function(e,t){const n=D.toCamelCase(" "+t);["get","set","has"].forEach((r=>{Object.defineProperty(e,r+n,{value:function(e,n,o){return this[r].call(this,t,e,n,o)},configurable:!0})}))}(n,e),t[r]=!0)}return D.isArray(e)?e.forEach(r):r(e),this}}pe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),D.reduceDescriptors(pe.prototype,(({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[n]=e}}})),D.freezeMethods(pe);const me=pe;function ye(e,t){const n=this||ce,r=t||n,o=me.from(r.headers);let s=r.data;return D.forEach(e,(function(e){s=e.call(n,s,o.normalize(),t?t.status:void 0)})),o.normalize(),s}function be(e){return!(!e||!e.__CANCEL__)}function ge(e,t,n){k.call(this,null==e?"canceled":e,k.ERR_CANCELED,t,n),this.name="CanceledError"}function we(e,t,n){const r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(new k("Request failed with status code "+n.status,[k.ERR_BAD_REQUEST,k.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):e(n)}D.inherits(ge,k,{__CANCEL__:!0});const Ee=(e,t,n=3)=>{let r=0;const o=function(e,t){e=e||10;const n=new Array(e),r=new Array(e);let o,s=0,i=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=r[i];o||(o=c),n[s]=a,r[s]=c;let l=i,f=0;for(;l!==s;)f+=n[l++],l%=e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-or)return o&&(clearTimeout(o),o=null),n=s,e.apply(null,arguments);o||(o=setTimeout((()=>(o=null,n=Date.now(),e.apply(null,arguments))),r-(s-n)))}}((n=>{const s=n.loaded,i=n.lengthComputable?n.total:void 0,a=s-r,c=o(a);r=s;const u={loaded:s,total:i,progress:i?s/i:void 0,bytes:a,rate:c||void 0,estimated:c&&i&&s<=i?(i-s)/c:void 0,event:n,lengthComputable:null!=i};u[t?"download":"upload"]=!0,e(u)}),n)},Oe=se.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let n;function r(n){let r=n;return e&&(t.setAttribute("href",r),r=t.href),t.setAttribute("href",r),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return n=r(window.location.href),function(e){const t=D.isString(e)?r(e):e;return t.protocol===n.protocol&&t.host===n.host}}():function(){return!0},Re=se.hasStandardBrowserEnv?{write(e,t,n,r,o,s){const i=[e+"="+encodeURIComponent(t)];D.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),D.isString(r)&&i.push("path="+r),D.isString(o)&&i.push("domain="+o),!0===s&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Se(e,t){return e&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Te=e=>e instanceof me?{...e}:e;function Ae(e,t){t=t||{};const n={};function r(e,t,n){return D.isPlainObject(e)&&D.isPlainObject(t)?D.merge.call({caseless:n},e,t):D.isPlainObject(t)?D.merge({},t):D.isArray(t)?t.slice():t}function o(e,t,n){return D.isUndefined(t)?D.isUndefined(e)?void 0:r(void 0,e,n):r(e,t,n)}function s(e,t){if(!D.isUndefined(t))return r(void 0,t)}function i(e,t){return D.isUndefined(t)?D.isUndefined(e)?void 0:r(void 0,e):r(void 0,t)}function a(n,o,s){return s in t?r(n,o):s in e?r(void 0,n):void 0}const c={url:s,method:s,data:s,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:a,headers:(e,t)=>o(Te(e),Te(t),!0)};return D.forEach(Object.keys(Object.assign({},e,t)),(function(r){const s=c[r]||o,i=s(e[r],t[r],r);D.isUndefined(i)&&s!==a||(n[r]=i)})),n}const ve=e=>{const t=Ae({},e);let n,{data:r,withXSRFToken:o,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:c}=t;if(t.headers=a=me.from(a),t.url=X(Se(t.baseURL,t.url),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),D.isFormData(r))if(se.hasStandardBrowserEnv||se.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(n=a.getContentType())){const[e,...t]=n?n.split(";").map((e=>e.trim())).filter(Boolean):[];a.setContentType([e||"multipart/form-data",...t].join("; "))}if(se.hasStandardBrowserEnv&&(o&&D.isFunction(o)&&(o=o(t)),o||!1!==o&&Oe(t.url))){const e=s&&i&&Re.read(i);e&&a.set(s,e)}return t},Ce="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,n){const r=ve(e);let o=r.data;const s=me.from(r.headers).normalize();let i,{responseType:a}=r;function c(){r.cancelToken&&r.cancelToken.unsubscribe(i),r.signal&&r.signal.removeEventListener("abort",i)}let u=new XMLHttpRequest;function l(){if(!u)return;const r=me.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders());we((function(e){t(e),c()}),(function(e){n(e),c()}),{data:a&&"text"!==a&&"json"!==a?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:r,config:e,request:u}),u=null}u.open(r.method.toUpperCase(),r.url,!0),u.timeout=r.timeout,"onloadend"in u?u.onloadend=l:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(l)},u.onabort=function(){u&&(n(new k("Request aborted",k.ECONNABORTED,r,u)),u=null)},u.onerror=function(){n(new k("Network Error",k.ERR_NETWORK,r,u)),u=null},u.ontimeout=function(){let e=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const t=r.transitional||Z;r.timeoutErrorMessage&&(e=r.timeoutErrorMessage),n(new k(e,t.clarifyTimeoutError?k.ETIMEDOUT:k.ECONNABORTED,r,u)),u=null},void 0===o&&s.setContentType(null),"setRequestHeader"in u&&D.forEach(s.toJSON(),(function(e,t){u.setRequestHeader(t,e)})),D.isUndefined(r.withCredentials)||(u.withCredentials=!!r.withCredentials),a&&"json"!==a&&(u.responseType=r.responseType),"function"==typeof r.onDownloadProgress&&u.addEventListener("progress",Ee(r.onDownloadProgress,!0)),"function"==typeof r.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",Ee(r.onUploadProgress)),(r.cancelToken||r.signal)&&(i=t=>{u&&(n(!t||t.type?new ge(null,e,u):t),u.abort(),u=null)},r.cancelToken&&r.cancelToken.subscribe(i),r.signal&&(r.signal.aborted?i():r.signal.addEventListener("abort",i)));const f=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(r.url);f&&-1===se.protocols.indexOf(f)?n(new k("Unsupported protocol "+f+":",k.ERR_BAD_REQUEST,e)):u.send(o||null)}))},xe=(e,t)=>{let n,r=new AbortController;const o=function(e){if(!n){n=!0,i();const t=e instanceof Error?e:this.reason;r.abort(t instanceof k?t:new ge(t instanceof Error?t.message:t))}};let s=t&&setTimeout((()=>{o(new k(`timeout ${t} of ms exceeded`,k.ETIMEDOUT))}),t);const i=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach((e=>{e&&(e.removeEventListener?e.removeEventListener("abort",o):e.unsubscribe(o))})),e=null)};e.forEach((e=>e&&e.addEventListener&&e.addEventListener("abort",o)));const{signal:a}=r;return a.unsubscribe=i,[a,()=>{s&&clearTimeout(s),s=null}]},Ne=function*(e,t){let n=e.byteLength;if(!t||n{const s=async function*(e,t,n){for await(const r of e)yield*Ne(ArrayBuffer.isView(r)?r:await n(String(r)),t)}(e,t,o);let i=0;return new ReadableStream({type:"bytes",async pull(e){const{done:t,value:o}=await s.next();if(t)return e.close(),void r();let a=o.byteLength;n&&n(i+=a),e.enqueue(new Uint8Array(o))},cancel:e=>(r(e),s.return())},{highWaterMark:2})},Pe=(e,t)=>{const n=null!=e;return r=>setTimeout((()=>t({lengthComputable:n,total:e,loaded:r})))},_e="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Fe=_e&&"function"==typeof ReadableStream,Le=_e&&("function"==typeof TextEncoder?(Ue=new TextEncoder,e=>Ue.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var Ue;const Be=Fe&&(()=>{let e=!1;const t=new Request(se.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})(),De=Fe&&!!(()=>{try{return D.isReadableStream(new Response("").body)}catch(e){}})(),ke={stream:De&&(e=>e.body)};var qe;_e&&(qe=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!ke[e]&&(ke[e]=D.isFunction(qe[e])?t=>t[e]():(t,n)=>{throw new k(`Response type '${e}' is not supported`,k.ERR_NOT_SUPPORT,n)})})));const Ie=async(e,t)=>{const n=D.toFiniteNumber(e.getContentLength());return null==n?(async e=>null==e?0:D.isBlob(e)?e.size:D.isSpecCompliantForm(e)?(await new Request(e).arrayBuffer()).byteLength:D.isArrayBufferView(e)?e.byteLength:(D.isURLSearchParams(e)&&(e+=""),D.isString(e)?(await Le(e)).byteLength:void 0))(t):n},ze={http:null,xhr:Ce,fetch:_e&&(async e=>{let{url:t,method:n,data:r,signal:o,cancelToken:s,timeout:i,onDownloadProgress:a,onUploadProgress:c,responseType:u,headers:l,withCredentials:f="same-origin",fetchOptions:d}=ve(e);u=u?(u+"").toLowerCase():"text";let h,p,[m,y]=o||s||i?xe([o,s],i):[];const b=()=>{!h&&setTimeout((()=>{m&&m.unsubscribe()})),h=!0};let g;try{if(c&&Be&&"get"!==n&&"head"!==n&&0!==(g=await Ie(l,r))){let e,n=new Request(t,{method:"POST",body:r,duplex:"half"});D.isFormData(r)&&(e=n.headers.get("content-type"))&&l.setContentType(e),n.body&&(r=je(n.body,65536,Pe(g,Ee(c)),null,Le))}D.isString(f)||(f=f?"cors":"omit"),p=new Request(t,{...d,signal:m,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:r,duplex:"half",withCredentials:f});let o=await fetch(p);const s=De&&("stream"===u||"response"===u);if(De&&(a||s)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=o[t]}));const t=D.toFiniteNumber(o.headers.get("content-length"));o=new Response(je(o.body,65536,a&&Pe(t,Ee(a,!0)),s&&b,Le),e)}u=u||"text";let i=await ke[D.findKey(ke,u)||"text"](o,e);return!s&&b(),y&&y(),await new Promise(((t,n)=>{we(t,n,{data:i,headers:me.from(o.headers),status:o.status,statusText:o.statusText,config:e,request:p})}))}catch(t){if(b(),t&&"TypeError"===t.name&&/fetch/i.test(t.message))throw Object.assign(new k("Network Error",k.ERR_NETWORK,e,p),{cause:t.cause||t});throw k.from(t,t&&t.code,e,p)}})};D.forEach(ze,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const Me=e=>`- ${e}`,He=e=>D.isFunction(e)||null===e||!1===e,Je=e=>{e=D.isArray(e)?e:[e];const{length:t}=e;let n,r;const o={};for(let s=0;s`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new k("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(Me).join("\n"):" "+Me(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function We(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ge(null,e)}function Ve(e){We(e),e.headers=me.from(e.headers),e.data=ye.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Je(e.adapter||ce.adapter)(e).then((function(t){return We(e),t.data=ye.call(e,e.transformResponse,t),t.headers=me.from(t.headers),t}),(function(t){return be(t)||(We(e),t&&t.response&&(t.response.data=ye.call(e,e.transformResponse,t.response),t.response.headers=me.from(t.response.headers))),Promise.reject(t)}))}const Ke={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Ke[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));const $e={};Ke.transitional=function(e,t,n){function r(e,t){return"[Axios v1.7.2] Transitional option '"+e+"'"+t+(n?". "+n:"")}return(n,o,s)=>{if(!1===e)throw new k(r(o," has been removed"+(t?" in "+t:"")),k.ERR_DEPRECATED);return t&&!$e[o]&&($e[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,o,s)}};const Ge={assertOptions:function(e,t,n){if("object"!=typeof e)throw new k("options must be an object",k.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let o=r.length;for(;o-- >0;){const s=r[o],i=t[s];if(i){const t=e[s],n=void 0===t||i(t,s,e);if(!0!==n)throw new k("option "+s+" must be "+n,k.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new k("Unknown option "+s,k.ERR_BAD_OPTION)}},validators:Ke},Xe=Ge.validators;class Qe{constructor(e){this.defaults=e,this.interceptors={request:new Q,response:new Q}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t;Error.captureStackTrace?Error.captureStackTrace(t={}):t=new Error;const n=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?n&&!String(e.stack).endsWith(n.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+n):e.stack=n}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Ae(this.defaults,t);const{transitional:n,paramsSerializer:r,headers:o}=t;void 0!==n&&Ge.assertOptions(n,{silentJSONParsing:Xe.transitional(Xe.boolean),forcedJSONParsing:Xe.transitional(Xe.boolean),clarifyTimeoutError:Xe.transitional(Xe.boolean)},!1),null!=r&&(D.isFunction(r)?t.paramsSerializer={serialize:r}:Ge.assertOptions(r,{encode:Xe.function,serialize:Xe.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&D.merge(o.common,o[t.method]);o&&D.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete o[e]})),t.headers=me.concat(s,o);const i=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,i.unshift(e.fulfilled,e.rejected))}));const c=[];let u;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let l,f=0;if(!a){const e=[Ve.bind(this),void 0];for(e.unshift.apply(e,i),e.push.apply(e,c),l=e.length,u=Promise.resolve(t);f{if(!n._listeners)return;let t=n._listeners.length;for(;t-- >0;)n._listeners[t](e);n._listeners=null})),this.promise.then=e=>{let t;const r=new Promise((e=>{n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e,r,o){n.reason||(n.reason=new ge(e,r,o),t(n.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new Ye((function(t){e=t})),cancel:e}}}const et=Ye;const tt={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(tt).forEach((([e,t])=>{tt[t]=e}));const nt=tt;const rt=function t(n){const r=new Ze(n),o=e(Ze.prototype.request,r);return D.extend(o,Ze.prototype,r,{allOwnKeys:!0}),D.extend(o,r,null,{allOwnKeys:!0}),o.create=function(e){return t(Ae(n,e))},o}(ce);rt.Axios=Ze,rt.CanceledError=ge,rt.CancelToken=et,rt.isCancel=be,rt.VERSION="1.7.2",rt.toFormData=W,rt.AxiosError=k,rt.Cancel=rt.CanceledError,rt.all=function(e){return Promise.all(e)},rt.spread=function(e){return function(t){return e.apply(null,t)}},rt.isAxiosError=function(e){return D.isObject(e)&&!0===e.isAxiosError},rt.mergeConfig=Ae,rt.AxiosHeaders=me,rt.formToJSON=e=>ie(D.isHTMLForm(e)?new FormData(e):e),rt.getAdapter=Je,rt.HttpStatusCode=nt,rt.default=rt;const ot=rt,{Axios:st,AxiosError:it,CanceledError:at,isCancel:ct,CancelToken:ut,VERSION:lt,all:ft,Cancel:dt,isAxiosError:ht,spread:pt,toFormData:mt,AxiosHeaders:yt,HttpStatusCode:bt,formToJSON:gt,getAdapter:wt,mergeConfig:Et}=ot;export{st as Axios,it as AxiosError,yt as AxiosHeaders,dt as Cancel,ut as CancelToken,at as CanceledError,bt as HttpStatusCode,lt as VERSION,ft as all,ot as default,gt as formToJSON,wt as getAdapter,ht as isAxiosError,ct as isCancel,Et as mergeConfig,pt as spread,mt as toFormData}; +//# sourceMappingURL=axios.min.js.map diff --git a/project starter code/node_modules/axios/dist/esm/axios.min.js.map b/project starter code/node_modules/axios/dist/esm/axios.min.js.map new file mode 100644 index 00000000..0901b22d --- /dev/null +++ b/project starter code/node_modules/axios/dist/esm/axios.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"axios.min.js","sources":["../../lib/helpers/bind.js","../../lib/utils.js","../../lib/core/AxiosError.js","../../lib/helpers/toFormData.js","../../lib/helpers/AxiosURLSearchParams.js","../../lib/helpers/buildURL.js","../../lib/core/InterceptorManager.js","../../lib/defaults/transitional.js","../../lib/platform/browser/index.js","../../lib/platform/browser/classes/URLSearchParams.js","../../lib/platform/browser/classes/FormData.js","../../lib/platform/browser/classes/Blob.js","../../lib/platform/common/utils.js","../../lib/platform/index.js","../../lib/helpers/formDataToJSON.js","../../lib/defaults/index.js","../../lib/helpers/toURLEncodedForm.js","../../lib/helpers/parseHeaders.js","../../lib/core/AxiosHeaders.js","../../lib/core/transformData.js","../../lib/cancel/isCancel.js","../../lib/cancel/CanceledError.js","../../lib/core/settle.js","../../lib/helpers/progressEventReducer.js","../../lib/helpers/speedometer.js","../../lib/helpers/throttle.js","../../lib/helpers/isURLSameOrigin.js","../../lib/helpers/cookies.js","../../lib/core/buildFullPath.js","../../lib/helpers/isAbsoluteURL.js","../../lib/helpers/combineURLs.js","../../lib/core/mergeConfig.js","../../lib/helpers/resolveConfig.js","../../lib/adapters/xhr.js","../../lib/helpers/parseProtocol.js","../../lib/helpers/composeSignals.js","../../lib/helpers/trackStream.js","../../lib/adapters/fetch.js","../../lib/adapters/adapters.js","../../lib/helpers/null.js","../../lib/core/dispatchRequest.js","../../lib/env/data.js","../../lib/helpers/validator.js","../../lib/core/Axios.js","../../lib/cancel/CancelToken.js","../../lib/helpers/HttpStatusCode.js","../../lib/axios.js","../../lib/helpers/spread.js","../../lib/helpers/isAxiosError.js","../../index.js"],"sourcesContent":["'use strict';\n\nexport default function bind(fn, thisArg) {\n return function wrap() {\n return fn.apply(thisArg, arguments);\n };\n}\n","'use strict';\n\nimport bind from './helpers/bind.js';\n\n// utils is a library of generic helper functions non-specific to axios\n\nconst {toString} = Object.prototype;\nconst {getPrototypeOf} = Object;\n\nconst kindOf = (cache => thing => {\n const str = toString.call(thing);\n return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());\n})(Object.create(null));\n\nconst kindOfTest = (type) => {\n type = type.toLowerCase();\n return (thing) => kindOf(thing) === type\n}\n\nconst typeOfTest = type => thing => typeof thing === type;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n *\n * @returns {boolean} True if value is an Array, otherwise false\n */\nconst {isArray} = Array;\n\n/**\n * Determine if a value is undefined\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nconst isUndefined = typeOfTest('undefined');\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nconst isArrayBuffer = kindOfTest('ArrayBuffer');\n\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n let result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a String, otherwise false\n */\nconst isString = typeOfTest('string');\n\n/**\n * Determine if a value is a Function\n *\n * @param {*} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nconst isFunction = typeOfTest('function');\n\n/**\n * Determine if a value is a Number\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Number, otherwise false\n */\nconst isNumber = typeOfTest('number');\n\n/**\n * Determine if a value is an Object\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an Object, otherwise false\n */\nconst isObject = (thing) => thing !== null && typeof thing === 'object';\n\n/**\n * Determine if a value is a Boolean\n *\n * @param {*} thing The value to test\n * @returns {boolean} True if value is a Boolean, otherwise false\n */\nconst isBoolean = thing => thing === true || thing === false;\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a plain Object, otherwise false\n */\nconst isPlainObject = (val) => {\n if (kindOf(val) !== 'object') {\n return false;\n }\n\n const prototype = getPrototypeOf(val);\n return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Date, otherwise false\n */\nconst isDate = kindOfTest('Date');\n\n/**\n * Determine if a value is a File\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFile = kindOfTest('File');\n\n/**\n * Determine if a value is a Blob\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nconst isBlob = kindOfTest('Blob');\n\n/**\n * Determine if a value is a FileList\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFileList = kindOfTest('FileList');\n\n/**\n * Determine if a value is a Stream\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nconst isStream = (val) => isObject(val) && isFunction(val.pipe);\n\n/**\n * Determine if a value is a FormData\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nconst isFormData = (thing) => {\n let kind;\n return thing && (\n (typeof FormData === 'function' && thing instanceof FormData) || (\n isFunction(thing.append) && (\n (kind = kindOf(thing)) === 'formdata' ||\n // detect form-data instance\n (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')\n )\n )\n )\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nconst isURLSearchParams = kindOfTest('URLSearchParams');\n\nconst [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n *\n * @returns {String} The String freed of excess whitespace\n */\nconst trim = (str) => str.trim ?\n str.trim() : str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n *\n * @param {Boolean} [allOwnKeys = false]\n * @returns {any}\n */\nfunction forEach(obj, fn, {allOwnKeys = false} = {}) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n let i;\n let l;\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);\n const len = keys.length;\n let key;\n\n for (i = 0; i < len; i++) {\n key = keys[i];\n fn.call(null, obj[key], key, obj);\n }\n }\n}\n\nfunction findKey(obj, key) {\n key = key.toLowerCase();\n const keys = Object.keys(obj);\n let i = keys.length;\n let _key;\n while (i-- > 0) {\n _key = keys[i];\n if (key === _key.toLowerCase()) {\n return _key;\n }\n }\n return null;\n}\n\nconst _global = (() => {\n /*eslint no-undef:0*/\n if (typeof globalThis !== \"undefined\") return globalThis;\n return typeof self !== \"undefined\" ? self : (typeof window !== 'undefined' ? window : global)\n})();\n\nconst isContextDefined = (context) => !isUndefined(context) && context !== _global;\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n *\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n const {caseless} = isContextDefined(this) && this || {};\n const result = {};\n const assignValue = (val, key) => {\n const targetKey = caseless && findKey(result, key) || key;\n if (isPlainObject(result[targetKey]) && isPlainObject(val)) {\n result[targetKey] = merge(result[targetKey], val);\n } else if (isPlainObject(val)) {\n result[targetKey] = merge({}, val);\n } else if (isArray(val)) {\n result[targetKey] = val.slice();\n } else {\n result[targetKey] = val;\n }\n }\n\n for (let i = 0, l = arguments.length; i < l; i++) {\n arguments[i] && forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n *\n * @param {Boolean} [allOwnKeys]\n * @returns {Object} The resulting value of object a\n */\nconst extend = (a, b, thisArg, {allOwnKeys}= {}) => {\n forEach(b, (val, key) => {\n if (thisArg && isFunction(val)) {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n }, {allOwnKeys});\n return a;\n}\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n *\n * @returns {string} content value without BOM\n */\nconst stripBOM = (content) => {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n}\n\n/**\n * Inherit the prototype methods from one constructor into another\n * @param {function} constructor\n * @param {function} superConstructor\n * @param {object} [props]\n * @param {object} [descriptors]\n *\n * @returns {void}\n */\nconst inherits = (constructor, superConstructor, props, descriptors) => {\n constructor.prototype = Object.create(superConstructor.prototype, descriptors);\n constructor.prototype.constructor = constructor;\n Object.defineProperty(constructor, 'super', {\n value: superConstructor.prototype\n });\n props && Object.assign(constructor.prototype, props);\n}\n\n/**\n * Resolve object with deep prototype chain to a flat object\n * @param {Object} sourceObj source object\n * @param {Object} [destObj]\n * @param {Function|Boolean} [filter]\n * @param {Function} [propFilter]\n *\n * @returns {Object}\n */\nconst toFlatObject = (sourceObj, destObj, filter, propFilter) => {\n let props;\n let i;\n let prop;\n const merged = {};\n\n destObj = destObj || {};\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (sourceObj == null) return destObj;\n\n do {\n props = Object.getOwnPropertyNames(sourceObj);\n i = props.length;\n while (i-- > 0) {\n prop = props[i];\n if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {\n destObj[prop] = sourceObj[prop];\n merged[prop] = true;\n }\n }\n sourceObj = filter !== false && getPrototypeOf(sourceObj);\n } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);\n\n return destObj;\n}\n\n/**\n * Determines whether a string ends with the characters of a specified string\n *\n * @param {String} str\n * @param {String} searchString\n * @param {Number} [position= 0]\n *\n * @returns {boolean}\n */\nconst endsWith = (str, searchString, position) => {\n str = String(str);\n if (position === undefined || position > str.length) {\n position = str.length;\n }\n position -= searchString.length;\n const lastIndex = str.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n}\n\n\n/**\n * Returns new array from array like object or null if failed\n *\n * @param {*} [thing]\n *\n * @returns {?Array}\n */\nconst toArray = (thing) => {\n if (!thing) return null;\n if (isArray(thing)) return thing;\n let i = thing.length;\n if (!isNumber(i)) return null;\n const arr = new Array(i);\n while (i-- > 0) {\n arr[i] = thing[i];\n }\n return arr;\n}\n\n/**\n * Checking if the Uint8Array exists and if it does, it returns a function that checks if the\n * thing passed in is an instance of Uint8Array\n *\n * @param {TypedArray}\n *\n * @returns {Array}\n */\n// eslint-disable-next-line func-names\nconst isTypedArray = (TypedArray => {\n // eslint-disable-next-line func-names\n return thing => {\n return TypedArray && thing instanceof TypedArray;\n };\n})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));\n\n/**\n * For each entry in the object, call the function with the key and value.\n *\n * @param {Object} obj - The object to iterate over.\n * @param {Function} fn - The function to call for each entry.\n *\n * @returns {void}\n */\nconst forEachEntry = (obj, fn) => {\n const generator = obj && obj[Symbol.iterator];\n\n const iterator = generator.call(obj);\n\n let result;\n\n while ((result = iterator.next()) && !result.done) {\n const pair = result.value;\n fn.call(obj, pair[0], pair[1]);\n }\n}\n\n/**\n * It takes a regular expression and a string, and returns an array of all the matches\n *\n * @param {string} regExp - The regular expression to match against.\n * @param {string} str - The string to search.\n *\n * @returns {Array}\n */\nconst matchAll = (regExp, str) => {\n let matches;\n const arr = [];\n\n while ((matches = regExp.exec(str)) !== null) {\n arr.push(matches);\n }\n\n return arr;\n}\n\n/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */\nconst isHTMLForm = kindOfTest('HTMLFormElement');\n\nconst toCamelCase = str => {\n return str.toLowerCase().replace(/[-_\\s]([a-z\\d])(\\w*)/g,\n function replacer(m, p1, p2) {\n return p1.toUpperCase() + p2;\n }\n );\n};\n\n/* Creating a function that will check if an object has a property. */\nconst hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);\n\n/**\n * Determine if a value is a RegExp object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a RegExp object, otherwise false\n */\nconst isRegExp = kindOfTest('RegExp');\n\nconst reduceDescriptors = (obj, reducer) => {\n const descriptors = Object.getOwnPropertyDescriptors(obj);\n const reducedDescriptors = {};\n\n forEach(descriptors, (descriptor, name) => {\n let ret;\n if ((ret = reducer(descriptor, name, obj)) !== false) {\n reducedDescriptors[name] = ret || descriptor;\n }\n });\n\n Object.defineProperties(obj, reducedDescriptors);\n}\n\n/**\n * Makes all methods read-only\n * @param {Object} obj\n */\n\nconst freezeMethods = (obj) => {\n reduceDescriptors(obj, (descriptor, name) => {\n // skip restricted props in strict mode\n if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {\n return false;\n }\n\n const value = obj[name];\n\n if (!isFunction(value)) return;\n\n descriptor.enumerable = false;\n\n if ('writable' in descriptor) {\n descriptor.writable = false;\n return;\n }\n\n if (!descriptor.set) {\n descriptor.set = () => {\n throw Error('Can not rewrite read-only method \\'' + name + '\\'');\n };\n }\n });\n}\n\nconst toObjectSet = (arrayOrString, delimiter) => {\n const obj = {};\n\n const define = (arr) => {\n arr.forEach(value => {\n obj[value] = true;\n });\n }\n\n isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));\n\n return obj;\n}\n\nconst noop = () => {}\n\nconst toFiniteNumber = (value, defaultValue) => {\n return value != null && Number.isFinite(value = +value) ? value : defaultValue;\n}\n\nconst ALPHA = 'abcdefghijklmnopqrstuvwxyz'\n\nconst DIGIT = '0123456789';\n\nconst ALPHABET = {\n DIGIT,\n ALPHA,\n ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT\n}\n\nconst generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {\n let str = '';\n const {length} = alphabet;\n while (size--) {\n str += alphabet[Math.random() * length|0]\n }\n\n return str;\n}\n\n/**\n * If the thing is a FormData object, return true, otherwise return false.\n *\n * @param {unknown} thing - The thing to check.\n *\n * @returns {boolean}\n */\nfunction isSpecCompliantForm(thing) {\n return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);\n}\n\nconst toJSONObject = (obj) => {\n const stack = new Array(10);\n\n const visit = (source, i) => {\n\n if (isObject(source)) {\n if (stack.indexOf(source) >= 0) {\n return;\n }\n\n if(!('toJSON' in source)) {\n stack[i] = source;\n const target = isArray(source) ? [] : {};\n\n forEach(source, (value, key) => {\n const reducedValue = visit(value, i + 1);\n !isUndefined(reducedValue) && (target[key] = reducedValue);\n });\n\n stack[i] = undefined;\n\n return target;\n }\n }\n\n return source;\n }\n\n return visit(obj, 0);\n}\n\nconst isAsyncFn = kindOfTest('AsyncFunction');\n\nconst isThenable = (thing) =>\n thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);\n\nexport default {\n isArray,\n isArrayBuffer,\n isBuffer,\n isFormData,\n isArrayBufferView,\n isString,\n isNumber,\n isBoolean,\n isObject,\n isPlainObject,\n isReadableStream,\n isRequest,\n isResponse,\n isHeaders,\n isUndefined,\n isDate,\n isFile,\n isBlob,\n isRegExp,\n isFunction,\n isStream,\n isURLSearchParams,\n isTypedArray,\n isFileList,\n forEach,\n merge,\n extend,\n trim,\n stripBOM,\n inherits,\n toFlatObject,\n kindOf,\n kindOfTest,\n endsWith,\n toArray,\n forEachEntry,\n matchAll,\n isHTMLForm,\n hasOwnProperty,\n hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection\n reduceDescriptors,\n freezeMethods,\n toObjectSet,\n toCamelCase,\n noop,\n toFiniteNumber,\n findKey,\n global: _global,\n isContextDefined,\n ALPHABET,\n generateString,\n isSpecCompliantForm,\n toJSONObject,\n isAsyncFn,\n isThenable\n};\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [config] The config.\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n *\n * @returns {Error} The created error.\n */\nfunction AxiosError(message, code, config, request, response) {\n Error.call(this);\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n this.stack = (new Error()).stack;\n }\n\n this.message = message;\n this.name = 'AxiosError';\n code && (this.code = code);\n config && (this.config = config);\n request && (this.request = request);\n response && (this.response = response);\n}\n\nutils.inherits(AxiosError, Error, {\n toJSON: function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: utils.toJSONObject(this.config),\n code: this.code,\n status: this.response && this.response.status ? this.response.status : null\n };\n }\n});\n\nconst prototype = AxiosError.prototype;\nconst descriptors = {};\n\n[\n 'ERR_BAD_OPTION_VALUE',\n 'ERR_BAD_OPTION',\n 'ECONNABORTED',\n 'ETIMEDOUT',\n 'ERR_NETWORK',\n 'ERR_FR_TOO_MANY_REDIRECTS',\n 'ERR_DEPRECATED',\n 'ERR_BAD_RESPONSE',\n 'ERR_BAD_REQUEST',\n 'ERR_CANCELED',\n 'ERR_NOT_SUPPORT',\n 'ERR_INVALID_URL'\n// eslint-disable-next-line func-names\n].forEach(code => {\n descriptors[code] = {value: code};\n});\n\nObject.defineProperties(AxiosError, descriptors);\nObject.defineProperty(prototype, 'isAxiosError', {value: true});\n\n// eslint-disable-next-line func-names\nAxiosError.from = (error, code, config, request, response, customProps) => {\n const axiosError = Object.create(prototype);\n\n utils.toFlatObject(error, axiosError, function filter(obj) {\n return obj !== Error.prototype;\n }, prop => {\n return prop !== 'isAxiosError';\n });\n\n AxiosError.call(axiosError, error.message, code, config, request, response);\n\n axiosError.cause = error;\n\n axiosError.name = error.name;\n\n customProps && Object.assign(axiosError, customProps);\n\n return axiosError;\n};\n\nexport default AxiosError;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\n// temporary hotfix to avoid circular references until AxiosURLSearchParams is refactored\nimport PlatformFormData from '../platform/node/classes/FormData.js';\n\n/**\n * Determines if the given thing is a array or js object.\n *\n * @param {string} thing - The object or array to be visited.\n *\n * @returns {boolean}\n */\nfunction isVisitable(thing) {\n return utils.isPlainObject(thing) || utils.isArray(thing);\n}\n\n/**\n * It removes the brackets from the end of a string\n *\n * @param {string} key - The key of the parameter.\n *\n * @returns {string} the key without the brackets.\n */\nfunction removeBrackets(key) {\n return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;\n}\n\n/**\n * It takes a path, a key, and a boolean, and returns a string\n *\n * @param {string} path - The path to the current key.\n * @param {string} key - The key of the current object being iterated over.\n * @param {string} dots - If true, the key will be rendered with dots instead of brackets.\n *\n * @returns {string} The path to the current key.\n */\nfunction renderKey(path, key, dots) {\n if (!path) return key;\n return path.concat(key).map(function each(token, i) {\n // eslint-disable-next-line no-param-reassign\n token = removeBrackets(token);\n return !dots && i ? '[' + token + ']' : token;\n }).join(dots ? '.' : '');\n}\n\n/**\n * If the array is an array and none of its elements are visitable, then it's a flat array.\n *\n * @param {Array} arr - The array to check\n *\n * @returns {boolean}\n */\nfunction isFlatArray(arr) {\n return utils.isArray(arr) && !arr.some(isVisitable);\n}\n\nconst predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {\n return /^is[A-Z]/.test(prop);\n});\n\n/**\n * Convert a data object to FormData\n *\n * @param {Object} obj\n * @param {?Object} [formData]\n * @param {?Object} [options]\n * @param {Function} [options.visitor]\n * @param {Boolean} [options.metaTokens = true]\n * @param {Boolean} [options.dots = false]\n * @param {?Boolean} [options.indexes = false]\n *\n * @returns {Object}\n **/\n\n/**\n * It converts an object into a FormData object\n *\n * @param {Object} obj - The object to convert to form data.\n * @param {string} formData - The FormData object to append to.\n * @param {Object} options\n *\n * @returns\n */\nfunction toFormData(obj, formData, options) {\n if (!utils.isObject(obj)) {\n throw new TypeError('target must be an object');\n }\n\n // eslint-disable-next-line no-param-reassign\n formData = formData || new (PlatformFormData || FormData)();\n\n // eslint-disable-next-line no-param-reassign\n options = utils.toFlatObject(options, {\n metaTokens: true,\n dots: false,\n indexes: false\n }, false, function defined(option, source) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n return !utils.isUndefined(source[option]);\n });\n\n const metaTokens = options.metaTokens;\n // eslint-disable-next-line no-use-before-define\n const visitor = options.visitor || defaultVisitor;\n const dots = options.dots;\n const indexes = options.indexes;\n const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;\n const useBlob = _Blob && utils.isSpecCompliantForm(formData);\n\n if (!utils.isFunction(visitor)) {\n throw new TypeError('visitor must be a function');\n }\n\n function convertValue(value) {\n if (value === null) return '';\n\n if (utils.isDate(value)) {\n return value.toISOString();\n }\n\n if (!useBlob && utils.isBlob(value)) {\n throw new AxiosError('Blob is not supported. Use a Buffer instead.');\n }\n\n if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {\n return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);\n }\n\n return value;\n }\n\n /**\n * Default visitor.\n *\n * @param {*} value\n * @param {String|Number} key\n * @param {Array} path\n * @this {FormData}\n *\n * @returns {boolean} return true to visit the each prop of the value recursively\n */\n function defaultVisitor(value, key, path) {\n let arr = value;\n\n if (value && !path && typeof value === 'object') {\n if (utils.endsWith(key, '{}')) {\n // eslint-disable-next-line no-param-reassign\n key = metaTokens ? key : key.slice(0, -2);\n // eslint-disable-next-line no-param-reassign\n value = JSON.stringify(value);\n } else if (\n (utils.isArray(value) && isFlatArray(value)) ||\n ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))\n )) {\n // eslint-disable-next-line no-param-reassign\n key = removeBrackets(key);\n\n arr.forEach(function each(el, index) {\n !(utils.isUndefined(el) || el === null) && formData.append(\n // eslint-disable-next-line no-nested-ternary\n indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),\n convertValue(el)\n );\n });\n return false;\n }\n }\n\n if (isVisitable(value)) {\n return true;\n }\n\n formData.append(renderKey(path, key, dots), convertValue(value));\n\n return false;\n }\n\n const stack = [];\n\n const exposedHelpers = Object.assign(predicates, {\n defaultVisitor,\n convertValue,\n isVisitable\n });\n\n function build(value, path) {\n if (utils.isUndefined(value)) return;\n\n if (stack.indexOf(value) !== -1) {\n throw Error('Circular reference detected in ' + path.join('.'));\n }\n\n stack.push(value);\n\n utils.forEach(value, function each(el, key) {\n const result = !(utils.isUndefined(el) || el === null) && visitor.call(\n formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers\n );\n\n if (result === true) {\n build(el, path ? path.concat(key) : [key]);\n }\n });\n\n stack.pop();\n }\n\n if (!utils.isObject(obj)) {\n throw new TypeError('data must be an object');\n }\n\n build(obj);\n\n return formData;\n}\n\nexport default toFormData;\n","'use strict';\n\nimport toFormData from './toFormData.js';\n\n/**\n * It encodes a string by replacing all characters that are not in the unreserved set with\n * their percent-encoded equivalents\n *\n * @param {string} str - The string to encode.\n *\n * @returns {string} The encoded string.\n */\nfunction encode(str) {\n const charMap = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n '%00': '\\x00'\n };\n return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {\n return charMap[match];\n });\n}\n\n/**\n * It takes a params object and converts it to a FormData object\n *\n * @param {Object} params - The parameters to be converted to a FormData object.\n * @param {Object} options - The options object passed to the Axios constructor.\n *\n * @returns {void}\n */\nfunction AxiosURLSearchParams(params, options) {\n this._pairs = [];\n\n params && toFormData(params, this, options);\n}\n\nconst prototype = AxiosURLSearchParams.prototype;\n\nprototype.append = function append(name, value) {\n this._pairs.push([name, value]);\n};\n\nprototype.toString = function toString(encoder) {\n const _encode = encoder ? function(value) {\n return encoder.call(this, value, encode);\n } : encode;\n\n return this._pairs.map(function each(pair) {\n return _encode(pair[0]) + '=' + _encode(pair[1]);\n }, '').join('&');\n};\n\nexport default AxiosURLSearchParams;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js';\n\n/**\n * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their\n * URI encoded counterparts\n *\n * @param {string} val The value to be encoded.\n *\n * @returns {string} The encoded value.\n */\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @param {?object} options\n *\n * @returns {string} The formatted url\n */\nexport default function buildURL(url, params, options) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n \n const _encode = options && options.encode || encode;\n\n const serializeFn = options && options.serialize;\n\n let serializedParams;\n\n if (serializeFn) {\n serializedParams = serializeFn(params, options);\n } else {\n serializedParams = utils.isURLSearchParams(params) ?\n params.toString() :\n new AxiosURLSearchParams(params, options).toString(_encode);\n }\n\n if (serializedParams) {\n const hashmarkIndex = url.indexOf(\"#\");\n\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\nclass InterceptorManager {\n constructor() {\n this.handlers = [];\n }\n\n /**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\n use(fulfilled, rejected, options) {\n this.handlers.push({\n fulfilled,\n rejected,\n synchronous: options ? options.synchronous : false,\n runWhen: options ? options.runWhen : null\n });\n return this.handlers.length - 1;\n }\n\n /**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n *\n * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise\n */\n eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n }\n\n /**\n * Clear all interceptors from the stack\n *\n * @returns {void}\n */\n clear() {\n if (this.handlers) {\n this.handlers = [];\n }\n }\n\n /**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n *\n * @returns {void}\n */\n forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n }\n}\n\nexport default InterceptorManager;\n","'use strict';\n\nexport default {\n silentJSONParsing: true,\n forcedJSONParsing: true,\n clarifyTimeoutError: false\n};\n","import URLSearchParams from './classes/URLSearchParams.js'\nimport FormData from './classes/FormData.js'\nimport Blob from './classes/Blob.js'\n\nexport default {\n isBrowser: true,\n classes: {\n URLSearchParams,\n FormData,\n Blob\n },\n protocols: ['http', 'https', 'file', 'blob', 'url', 'data']\n};\n","'use strict';\n\nimport AxiosURLSearchParams from '../../../helpers/AxiosURLSearchParams.js';\nexport default typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;\n","'use strict';\n\nexport default typeof FormData !== 'undefined' ? FormData : null;\n","'use strict'\n\nexport default typeof Blob !== 'undefined' ? Blob : null\n","const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n *\n * @returns {boolean}\n */\nconst hasStandardBrowserEnv = (\n (product) => {\n return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0\n })(typeof navigator !== 'undefined' && navigator.product);\n\n/**\n * Determine if we're running in a standard browser webWorker environment\n *\n * Although the `isStandardBrowserEnv` method indicates that\n * `allows axios to run in a web worker`, the WebWorker will still be\n * filtered out due to its judgment standard\n * `typeof window !== 'undefined' && typeof document !== 'undefined'`.\n * This leads to a problem when axios post `FormData` in webWorker\n */\nconst hasStandardBrowserWebWorkerEnv = (() => {\n return (\n typeof WorkerGlobalScope !== 'undefined' &&\n // eslint-disable-next-line no-undef\n self instanceof WorkerGlobalScope &&\n typeof self.importScripts === 'function'\n );\n})();\n\nconst origin = hasBrowserEnv && window.location.href || 'http://localhost';\n\nexport {\n hasBrowserEnv,\n hasStandardBrowserWebWorkerEnv,\n hasStandardBrowserEnv,\n origin\n}\n","import platform from './node/index.js';\nimport * as utils from './common/utils.js';\n\nexport default {\n ...utils,\n ...platform\n}\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']\n *\n * @param {string} name - The name of the property to get.\n *\n * @returns An array of strings.\n */\nfunction parsePropPath(name) {\n // foo[x][y][z]\n // foo.x.y.z\n // foo-x-y-z\n // foo x y z\n return utils.matchAll(/\\w+|\\[(\\w*)]/g, name).map(match => {\n return match[0] === '[]' ? '' : match[1] || match[0];\n });\n}\n\n/**\n * Convert an array to an object.\n *\n * @param {Array} arr - The array to convert to an object.\n *\n * @returns An object with the same keys and values as the array.\n */\nfunction arrayToObject(arr) {\n const obj = {};\n const keys = Object.keys(arr);\n let i;\n const len = keys.length;\n let key;\n for (i = 0; i < len; i++) {\n key = keys[i];\n obj[key] = arr[key];\n }\n return obj;\n}\n\n/**\n * It takes a FormData object and returns a JavaScript object\n *\n * @param {string} formData The FormData object to convert to JSON.\n *\n * @returns {Object | null} The converted object.\n */\nfunction formDataToJSON(formData) {\n function buildPath(path, value, target, index) {\n let name = path[index++];\n\n if (name === '__proto__') return true;\n\n const isNumericKey = Number.isFinite(+name);\n const isLast = index >= path.length;\n name = !name && utils.isArray(target) ? target.length : name;\n\n if (isLast) {\n if (utils.hasOwnProp(target, name)) {\n target[name] = [target[name], value];\n } else {\n target[name] = value;\n }\n\n return !isNumericKey;\n }\n\n if (!target[name] || !utils.isObject(target[name])) {\n target[name] = [];\n }\n\n const result = buildPath(path, value, target[name], index);\n\n if (result && utils.isArray(target[name])) {\n target[name] = arrayToObject(target[name]);\n }\n\n return !isNumericKey;\n }\n\n if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {\n const obj = {};\n\n utils.forEachEntry(formData, (name, value) => {\n buildPath(parsePropPath(name), value, obj, 0);\n });\n\n return obj;\n }\n\n return null;\n}\n\nexport default formDataToJSON;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\nimport transitionalDefaults from './transitional.js';\nimport toFormData from '../helpers/toFormData.js';\nimport toURLEncodedForm from '../helpers/toURLEncodedForm.js';\nimport platform from '../platform/index.js';\nimport formDataToJSON from '../helpers/formDataToJSON.js';\n\n/**\n * It takes a string, tries to parse it, and if it fails, it returns the stringified version\n * of the input\n *\n * @param {any} rawValue - The value to be stringified.\n * @param {Function} parser - A function that parses a string into a JavaScript object.\n * @param {Function} encoder - A function that takes a value and returns a string.\n *\n * @returns {string} A stringified version of the rawValue.\n */\nfunction stringifySafely(rawValue, parser, encoder) {\n if (utils.isString(rawValue)) {\n try {\n (parser || JSON.parse)(rawValue);\n return utils.trim(rawValue);\n } catch (e) {\n if (e.name !== 'SyntaxError') {\n throw e;\n }\n }\n }\n\n return (encoder || JSON.stringify)(rawValue);\n}\n\nconst defaults = {\n\n transitional: transitionalDefaults,\n\n adapter: ['xhr', 'http', 'fetch'],\n\n transformRequest: [function transformRequest(data, headers) {\n const contentType = headers.getContentType() || '';\n const hasJSONContentType = contentType.indexOf('application/json') > -1;\n const isObjectPayload = utils.isObject(data);\n\n if (isObjectPayload && utils.isHTMLForm(data)) {\n data = new FormData(data);\n }\n\n const isFormData = utils.isFormData(data);\n\n if (isFormData) {\n return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;\n }\n\n if (utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data) ||\n utils.isReadableStream(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);\n return data.toString();\n }\n\n let isFileList;\n\n if (isObjectPayload) {\n if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {\n return toURLEncodedForm(data, this.formSerializer).toString();\n }\n\n if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {\n const _FormData = this.env && this.env.FormData;\n\n return toFormData(\n isFileList ? {'files[]': data} : data,\n _FormData && new _FormData(),\n this.formSerializer\n );\n }\n }\n\n if (isObjectPayload || hasJSONContentType ) {\n headers.setContentType('application/json', false);\n return stringifySafely(data);\n }\n\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n const transitional = this.transitional || defaults.transitional;\n const forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n const JSONRequested = this.responseType === 'json';\n\n if (utils.isResponse(data) || utils.isReadableStream(data)) {\n return data;\n }\n\n if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {\n const silentJSONParsing = transitional && transitional.silentJSONParsing;\n const strictJSONParsing = !silentJSONParsing && JSONRequested;\n\n try {\n return JSON.parse(data);\n } catch (e) {\n if (strictJSONParsing) {\n if (e.name === 'SyntaxError') {\n throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);\n }\n throw e;\n }\n }\n }\n\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n env: {\n FormData: platform.classes.FormData,\n Blob: platform.classes.Blob\n },\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n },\n\n headers: {\n common: {\n 'Accept': 'application/json, text/plain, */*',\n 'Content-Type': undefined\n }\n }\n};\n\nutils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {\n defaults.headers[method] = {};\n});\n\nexport default defaults;\n","'use strict';\n\nimport utils from '../utils.js';\nimport toFormData from './toFormData.js';\nimport platform from '../platform/index.js';\n\nexport default function toURLEncodedForm(data, options) {\n return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({\n visitor: function(value, key, path, helpers) {\n if (platform.isNode && utils.isBuffer(value)) {\n this.append(key, value.toString('base64'));\n return false;\n }\n\n return helpers.defaultVisitor.apply(this, arguments);\n }\n }, options));\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\n// RawAxiosHeaders whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nconst ignoreDuplicateOf = utils.toObjectSet([\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n]);\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} rawHeaders Headers needing to be parsed\n *\n * @returns {Object} Headers parsed into an object\n */\nexport default rawHeaders => {\n const parsed = {};\n let key;\n let val;\n let i;\n\n rawHeaders && rawHeaders.split('\\n').forEach(function parser(line) {\n i = line.indexOf(':');\n key = line.substring(0, i).trim().toLowerCase();\n val = line.substring(i + 1).trim();\n\n if (!key || (parsed[key] && ignoreDuplicateOf[key])) {\n return;\n }\n\n if (key === 'set-cookie') {\n if (parsed[key]) {\n parsed[key].push(val);\n } else {\n parsed[key] = [val];\n }\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n });\n\n return parsed;\n};\n","'use strict';\n\nimport utils from '../utils.js';\nimport parseHeaders from '../helpers/parseHeaders.js';\n\nconst $internals = Symbol('internals');\n\nfunction normalizeHeader(header) {\n return header && String(header).trim().toLowerCase();\n}\n\nfunction normalizeValue(value) {\n if (value === false || value == null) {\n return value;\n }\n\n return utils.isArray(value) ? value.map(normalizeValue) : String(value);\n}\n\nfunction parseTokens(str) {\n const tokens = Object.create(null);\n const tokensRE = /([^\\s,;=]+)\\s*(?:=\\s*([^,;]+))?/g;\n let match;\n\n while ((match = tokensRE.exec(str))) {\n tokens[match[1]] = match[2];\n }\n\n return tokens;\n}\n\nconst isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());\n\nfunction matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {\n if (utils.isFunction(filter)) {\n return filter.call(this, value, header);\n }\n\n if (isHeaderNameFilter) {\n value = header;\n }\n\n if (!utils.isString(value)) return;\n\n if (utils.isString(filter)) {\n return value.indexOf(filter) !== -1;\n }\n\n if (utils.isRegExp(filter)) {\n return filter.test(value);\n }\n}\n\nfunction formatHeader(header) {\n return header.trim()\n .toLowerCase().replace(/([a-z\\d])(\\w*)/g, (w, char, str) => {\n return char.toUpperCase() + str;\n });\n}\n\nfunction buildAccessors(obj, header) {\n const accessorName = utils.toCamelCase(' ' + header);\n\n ['get', 'set', 'has'].forEach(methodName => {\n Object.defineProperty(obj, methodName + accessorName, {\n value: function(arg1, arg2, arg3) {\n return this[methodName].call(this, header, arg1, arg2, arg3);\n },\n configurable: true\n });\n });\n}\n\nclass AxiosHeaders {\n constructor(headers) {\n headers && this.set(headers);\n }\n\n set(header, valueOrRewrite, rewrite) {\n const self = this;\n\n function setHeader(_value, _header, _rewrite) {\n const lHeader = normalizeHeader(_header);\n\n if (!lHeader) {\n throw new Error('header name must be a non-empty string');\n }\n\n const key = utils.findKey(self, lHeader);\n\n if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {\n self[key || _header] = normalizeValue(_value);\n }\n }\n\n const setHeaders = (headers, _rewrite) =>\n utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));\n\n if (utils.isPlainObject(header) || header instanceof this.constructor) {\n setHeaders(header, valueOrRewrite)\n } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {\n setHeaders(parseHeaders(header), valueOrRewrite);\n } else if (utils.isHeaders(header)) {\n for (const [key, value] of header.entries()) {\n setHeader(value, key, rewrite);\n }\n } else {\n header != null && setHeader(valueOrRewrite, header, rewrite);\n }\n\n return this;\n }\n\n get(header, parser) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n if (key) {\n const value = this[key];\n\n if (!parser) {\n return value;\n }\n\n if (parser === true) {\n return parseTokens(value);\n }\n\n if (utils.isFunction(parser)) {\n return parser.call(this, value, key);\n }\n\n if (utils.isRegExp(parser)) {\n return parser.exec(value);\n }\n\n throw new TypeError('parser must be boolean|regexp|function');\n }\n }\n }\n\n has(header, matcher) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));\n }\n\n return false;\n }\n\n delete(header, matcher) {\n const self = this;\n let deleted = false;\n\n function deleteHeader(_header) {\n _header = normalizeHeader(_header);\n\n if (_header) {\n const key = utils.findKey(self, _header);\n\n if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {\n delete self[key];\n\n deleted = true;\n }\n }\n }\n\n if (utils.isArray(header)) {\n header.forEach(deleteHeader);\n } else {\n deleteHeader(header);\n }\n\n return deleted;\n }\n\n clear(matcher) {\n const keys = Object.keys(this);\n let i = keys.length;\n let deleted = false;\n\n while (i--) {\n const key = keys[i];\n if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {\n delete this[key];\n deleted = true;\n }\n }\n\n return deleted;\n }\n\n normalize(format) {\n const self = this;\n const headers = {};\n\n utils.forEach(this, (value, header) => {\n const key = utils.findKey(headers, header);\n\n if (key) {\n self[key] = normalizeValue(value);\n delete self[header];\n return;\n }\n\n const normalized = format ? formatHeader(header) : String(header).trim();\n\n if (normalized !== header) {\n delete self[header];\n }\n\n self[normalized] = normalizeValue(value);\n\n headers[normalized] = true;\n });\n\n return this;\n }\n\n concat(...targets) {\n return this.constructor.concat(this, ...targets);\n }\n\n toJSON(asStrings) {\n const obj = Object.create(null);\n\n utils.forEach(this, (value, header) => {\n value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);\n });\n\n return obj;\n }\n\n [Symbol.iterator]() {\n return Object.entries(this.toJSON())[Symbol.iterator]();\n }\n\n toString() {\n return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\\n');\n }\n\n get [Symbol.toStringTag]() {\n return 'AxiosHeaders';\n }\n\n static from(thing) {\n return thing instanceof this ? thing : new this(thing);\n }\n\n static concat(first, ...targets) {\n const computed = new this(first);\n\n targets.forEach((target) => computed.set(target));\n\n return computed;\n }\n\n static accessor(header) {\n const internals = this[$internals] = (this[$internals] = {\n accessors: {}\n });\n\n const accessors = internals.accessors;\n const prototype = this.prototype;\n\n function defineAccessor(_header) {\n const lHeader = normalizeHeader(_header);\n\n if (!accessors[lHeader]) {\n buildAccessors(prototype, _header);\n accessors[lHeader] = true;\n }\n }\n\n utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);\n\n return this;\n }\n}\n\nAxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);\n\n// reserved names hotfix\nutils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {\n let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`\n return {\n get: () => value,\n set(headerValue) {\n this[mapped] = headerValue;\n }\n }\n});\n\nutils.freezeMethods(AxiosHeaders);\n\nexport default AxiosHeaders;\n","'use strict';\n\nimport utils from './../utils.js';\nimport defaults from '../defaults/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Array|Function} fns A single function or Array of functions\n * @param {?Object} response The response object\n *\n * @returns {*} The resulting transformed data\n */\nexport default function transformData(fns, response) {\n const config = this || defaults;\n const context = response || config;\n const headers = AxiosHeaders.from(context.headers);\n let data = context.data;\n\n utils.forEach(fns, function transform(fn) {\n data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);\n });\n\n headers.normalize();\n\n return data;\n}\n","'use strict';\n\nexport default function isCancel(value) {\n return !!(value && value.__CANCEL__);\n}\n","'use strict';\n\nimport AxiosError from '../core/AxiosError.js';\nimport utils from '../utils.js';\n\n/**\n * A `CanceledError` is an object that is thrown when an operation is canceled.\n *\n * @param {string=} message The message.\n * @param {Object=} config The config.\n * @param {Object=} request The request.\n *\n * @returns {CanceledError} The created error.\n */\nfunction CanceledError(message, config, request) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);\n this.name = 'CanceledError';\n}\n\nutils.inherits(CanceledError, AxiosError, {\n __CANCEL__: true\n});\n\nexport default CanceledError;\n","'use strict';\n\nimport AxiosError from './AxiosError.js';\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n *\n * @returns {object} The response.\n */\nexport default function settle(resolve, reject, response) {\n const validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(new AxiosError(\n 'Request failed with status code ' + response.status,\n [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],\n response.config,\n response.request,\n response\n ));\n }\n}\n","import speedometer from \"./speedometer.js\";\nimport throttle from \"./throttle.js\";\n\nexport default (listener, isDownloadStream, freq = 3) => {\n let bytesNotified = 0;\n const _speedometer = speedometer(50, 250);\n\n return throttle(e => {\n const loaded = e.loaded;\n const total = e.lengthComputable ? e.total : undefined;\n const progressBytes = loaded - bytesNotified;\n const rate = _speedometer(progressBytes);\n const inRange = loaded <= total;\n\n bytesNotified = loaded;\n\n const data = {\n loaded,\n total,\n progress: total ? (loaded / total) : undefined,\n bytes: progressBytes,\n rate: rate ? rate : undefined,\n estimated: rate && total && inRange ? (total - loaded) / rate : undefined,\n event: e,\n lengthComputable: total != null\n };\n\n data[isDownloadStream ? 'download' : 'upload'] = true;\n\n listener(data);\n }, freq);\n}\n","'use strict';\n\n/**\n * Calculate data maxRate\n * @param {Number} [samplesCount= 10]\n * @param {Number} [min= 1000]\n * @returns {Function}\n */\nfunction speedometer(samplesCount, min) {\n samplesCount = samplesCount || 10;\n const bytes = new Array(samplesCount);\n const timestamps = new Array(samplesCount);\n let head = 0;\n let tail = 0;\n let firstSampleTS;\n\n min = min !== undefined ? min : 1000;\n\n return function push(chunkLength) {\n const now = Date.now();\n\n const startedAt = timestamps[tail];\n\n if (!firstSampleTS) {\n firstSampleTS = now;\n }\n\n bytes[head] = chunkLength;\n timestamps[head] = now;\n\n let i = tail;\n let bytesCount = 0;\n\n while (i !== head) {\n bytesCount += bytes[i++];\n i = i % samplesCount;\n }\n\n head = (head + 1) % samplesCount;\n\n if (head === tail) {\n tail = (tail + 1) % samplesCount;\n }\n\n if (now - firstSampleTS < min) {\n return;\n }\n\n const passed = startedAt && now - startedAt;\n\n return passed ? Math.round(bytesCount * 1000 / passed) : undefined;\n };\n}\n\nexport default speedometer;\n","'use strict';\n\n/**\n * Throttle decorator\n * @param {Function} fn\n * @param {Number} freq\n * @return {Function}\n */\nfunction throttle(fn, freq) {\n let timestamp = 0;\n const threshold = 1000 / freq;\n let timer = null;\n return function throttled() {\n const force = this === true;\n\n const now = Date.now();\n if (force || now - timestamp > threshold) {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n timestamp = now;\n return fn.apply(null, arguments);\n }\n if (!timer) {\n timer = setTimeout(() => {\n timer = null;\n timestamp = Date.now();\n return fn.apply(null, arguments);\n }, threshold - (now - timestamp));\n }\n };\n}\n\nexport default throttle;\n","'use strict';\n\nimport utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n// Standard browser envs have full support of the APIs needed to test\n// whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n const msie = /(msie|trident)/i.test(navigator.userAgent);\n const urlParsingNode = document.createElement('a');\n let originURL;\n\n /**\n * Parse a URL to discover its components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n let href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })();\n","import utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n // Standard browser envs support document.cookie\n {\n write(name, value, expires, path, domain, secure) {\n const cookie = [name + '=' + encodeURIComponent(value)];\n\n utils.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());\n\n utils.isString(path) && cookie.push('path=' + path);\n\n utils.isString(domain) && cookie.push('domain=' + domain);\n\n secure === true && cookie.push('secure');\n\n document.cookie = cookie.join('; ');\n },\n\n read(name) {\n const match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n }\n\n :\n\n // Non-standard browser env (web workers, react-native) lack needed support.\n {\n write() {},\n read() {\n return null;\n },\n remove() {}\n };\n\n","'use strict';\n\nimport isAbsoluteURL from '../helpers/isAbsoluteURL.js';\nimport combineURLs from '../helpers/combineURLs.js';\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n *\n * @returns {string} The combined full path\n */\nexport default function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n}\n","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n *\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nexport default function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(url);\n}\n","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n *\n * @returns {string} The combined URL\n */\nexport default function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/?\\/$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosHeaders from \"./AxiosHeaders.js\";\n\nconst headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n *\n * @returns {Object} New object resulting from merging config2 to config1\n */\nexport default function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n const config = {};\n\n function getMergedValue(target, source, caseless) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge.call({caseless}, target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDeepProperties(a, b, caseless) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(a, b, caseless);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a, caseless);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function valueFromConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function defaultToConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDirectKeys(a, b, prop) {\n if (prop in config2) {\n return getMergedValue(a, b);\n } else if (prop in config1) {\n return getMergedValue(undefined, a);\n }\n }\n\n const mergeMap = {\n url: valueFromConfig2,\n method: valueFromConfig2,\n data: valueFromConfig2,\n baseURL: defaultToConfig2,\n transformRequest: defaultToConfig2,\n transformResponse: defaultToConfig2,\n paramsSerializer: defaultToConfig2,\n timeout: defaultToConfig2,\n timeoutMessage: defaultToConfig2,\n withCredentials: defaultToConfig2,\n withXSRFToken: defaultToConfig2,\n adapter: defaultToConfig2,\n responseType: defaultToConfig2,\n xsrfCookieName: defaultToConfig2,\n xsrfHeaderName: defaultToConfig2,\n onUploadProgress: defaultToConfig2,\n onDownloadProgress: defaultToConfig2,\n decompress: defaultToConfig2,\n maxContentLength: defaultToConfig2,\n maxBodyLength: defaultToConfig2,\n beforeRedirect: defaultToConfig2,\n transport: defaultToConfig2,\n httpAgent: defaultToConfig2,\n httpsAgent: defaultToConfig2,\n cancelToken: defaultToConfig2,\n socketPath: defaultToConfig2,\n responseEncoding: defaultToConfig2,\n validateStatus: mergeDirectKeys,\n headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)\n };\n\n utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {\n const merge = mergeMap[prop] || mergeDeepProperties;\n const configValue = merge(config1[prop], config2[prop], prop);\n (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);\n });\n\n return config;\n}\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport isURLSameOrigin from \"./isURLSameOrigin.js\";\nimport cookies from \"./cookies.js\";\nimport buildFullPath from \"../core/buildFullPath.js\";\nimport mergeConfig from \"../core/mergeConfig.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport buildURL from \"./buildURL.js\";\n\nexport default (config) => {\n const newConfig = mergeConfig({}, config);\n\n let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;\n\n newConfig.headers = headers = AxiosHeaders.from(headers);\n\n newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);\n\n // HTTP basic authentication\n if (auth) {\n headers.set('Authorization', 'Basic ' +\n btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))\n );\n }\n\n let contentType;\n\n if (utils.isFormData(data)) {\n if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {\n headers.setContentType(undefined); // Let the browser set it\n } else if ((contentType = headers.getContentType()) !== false) {\n // fix semicolon duplication issue for ReactNative FormData implementation\n const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];\n headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));\n }\n }\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n\n if (platform.hasStandardBrowserEnv) {\n withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));\n\n if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {\n // Add xsrf header\n const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);\n\n if (xsrfValue) {\n headers.set(xsrfHeaderName, xsrfValue);\n }\n }\n }\n\n return newConfig;\n}\n\n","import utils from './../utils.js';\nimport settle from './../core/settle.js';\nimport transitionalDefaults from '../defaults/transitional.js';\nimport AxiosError from '../core/AxiosError.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport parseProtocol from '../helpers/parseProtocol.js';\nimport platform from '../platform/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport progressEventReducer from '../helpers/progressEventReducer.js';\nimport resolveConfig from \"../helpers/resolveConfig.js\";\n\nconst isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';\n\nexport default isXHRAdapterSupported && function (config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n const _config = resolveConfig(config);\n let requestData = _config.data;\n const requestHeaders = AxiosHeaders.from(_config.headers).normalize();\n let {responseType} = _config;\n let onCanceled;\n function done() {\n if (_config.cancelToken) {\n _config.cancelToken.unsubscribe(onCanceled);\n }\n\n if (_config.signal) {\n _config.signal.removeEventListener('abort', onCanceled);\n }\n }\n\n let request = new XMLHttpRequest();\n\n request.open(_config.method.toUpperCase(), _config.url, true);\n\n // Set the request timeout in MS\n request.timeout = _config.timeout;\n\n function onloadend() {\n if (!request) {\n return;\n }\n // Prepare the response\n const responseHeaders = AxiosHeaders.from(\n 'getAllResponseHeaders' in request && request.getAllResponseHeaders()\n );\n const responseData = !responseType || responseType === 'text' || responseType === 'json' ?\n request.responseText : request.response;\n const response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config,\n request\n };\n\n settle(function _resolve(value) {\n resolve(value);\n done();\n }, function _reject(err) {\n reject(err);\n done();\n }, response);\n\n // Clean up request\n request = null;\n }\n\n if ('onloadend' in request) {\n // Use onloadend if available\n request.onloadend = onloadend;\n } else {\n // Listen for ready state to emulate onloadend\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n // readystate handler is calling before onerror or ontimeout handlers,\n // so we should call onloadend on the next 'tick'\n setTimeout(onloadend);\n };\n }\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';\n const transitional = _config.transitional || transitionalDefaults;\n if (_config.timeoutErrorMessage) {\n timeoutErrorMessage = _config.timeoutErrorMessage;\n }\n reject(new AxiosError(\n timeoutErrorMessage,\n transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,\n _config,\n request));\n\n // Clean up request\n request = null;\n };\n\n // Remove Content-Type if data is undefined\n requestData === undefined && requestHeaders.setContentType(null);\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {\n request.setRequestHeader(key, val);\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(_config.withCredentials)) {\n request.withCredentials = !!_config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (responseType && responseType !== 'json') {\n request.responseType = _config.responseType;\n }\n\n // Handle progress if needed\n if (typeof _config.onDownloadProgress === 'function') {\n request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true));\n }\n\n // Not all browsers support upload events\n if (typeof _config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress));\n }\n\n if (_config.cancelToken || _config.signal) {\n // Handle cancellation\n // eslint-disable-next-line func-names\n onCanceled = cancel => {\n if (!request) {\n return;\n }\n reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);\n request.abort();\n request = null;\n };\n\n _config.cancelToken && _config.cancelToken.subscribe(onCanceled);\n if (_config.signal) {\n _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);\n }\n }\n\n const protocol = parseProtocol(_config.url);\n\n if (protocol && platform.protocols.indexOf(protocol) === -1) {\n reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));\n return;\n }\n\n\n // Send the request\n request.send(requestData || null);\n });\n}\n","'use strict';\n\nexport default function parseProtocol(url) {\n const match = /^([-+\\w]{1,25})(:?\\/\\/|:)/.exec(url);\n return match && match[1] || '';\n}\n","import CanceledError from \"../cancel/CanceledError.js\";\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst composeSignals = (signals, timeout) => {\n let controller = new AbortController();\n\n let aborted;\n\n const onabort = function (cancel) {\n if (!aborted) {\n aborted = true;\n unsubscribe();\n const err = cancel instanceof Error ? cancel : this.reason;\n controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));\n }\n }\n\n let timer = timeout && setTimeout(() => {\n onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT))\n }, timeout)\n\n const unsubscribe = () => {\n if (signals) {\n timer && clearTimeout(timer);\n timer = null;\n signals.forEach(signal => {\n signal &&\n (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));\n });\n signals = null;\n }\n }\n\n signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort));\n\n const {signal} = controller;\n\n signal.unsubscribe = unsubscribe;\n\n return [signal, () => {\n timer && clearTimeout(timer);\n timer = null;\n }];\n}\n\nexport default composeSignals;\n","\n\nexport const streamChunk = function* (chunk, chunkSize) {\n let len = chunk.byteLength;\n\n if (!chunkSize || len < chunkSize) {\n yield chunk;\n return;\n }\n\n let pos = 0;\n let end;\n\n while (pos < len) {\n end = pos + chunkSize;\n yield chunk.slice(pos, end);\n pos = end;\n }\n}\n\nexport const readBytes = async function* (iterable, chunkSize, encode) {\n for await (const chunk of iterable) {\n yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);\n }\n}\n\nexport const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {\n const iterator = readBytes(stream, chunkSize, encode);\n\n let bytes = 0;\n\n return new ReadableStream({\n type: 'bytes',\n\n async pull(controller) {\n const {done, value} = await iterator.next();\n\n if (done) {\n controller.close();\n onFinish();\n return;\n }\n\n let len = value.byteLength;\n onProgress && onProgress(bytes += len);\n controller.enqueue(new Uint8Array(value));\n },\n cancel(reason) {\n onFinish(reason);\n return iterator.return();\n }\n }, {\n highWaterMark: 2\n })\n}\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport AxiosError from \"../core/AxiosError.js\";\nimport composeSignals from \"../helpers/composeSignals.js\";\nimport {trackStream} from \"../helpers/trackStream.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport progressEventReducer from \"../helpers/progressEventReducer.js\";\nimport resolveConfig from \"../helpers/resolveConfig.js\";\nimport settle from \"../core/settle.js\";\n\nconst fetchProgressDecorator = (total, fn) => {\n const lengthComputable = total != null;\n return (loaded) => setTimeout(() => fn({\n lengthComputable,\n total,\n loaded\n }));\n}\n\nconst isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';\nconst isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';\n\n// used only inside the fetch adapter\nconst encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?\n ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :\n async (str) => new Uint8Array(await new Response(str).arrayBuffer())\n);\n\nconst supportsRequestStream = isReadableStreamSupported && (() => {\n let duplexAccessed = false;\n\n const hasContentType = new Request(platform.origin, {\n body: new ReadableStream(),\n method: 'POST',\n get duplex() {\n duplexAccessed = true;\n return 'half';\n },\n }).headers.has('Content-Type');\n\n return duplexAccessed && !hasContentType;\n})();\n\nconst DEFAULT_CHUNK_SIZE = 64 * 1024;\n\nconst supportsResponseStream = isReadableStreamSupported && !!(()=> {\n try {\n return utils.isReadableStream(new Response('').body);\n } catch(err) {\n // return undefined\n }\n})();\n\nconst resolvers = {\n stream: supportsResponseStream && ((res) => res.body)\n};\n\nisFetchSupported && (((res) => {\n ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {\n !resolvers[type] && (resolvers[type] = utils.isFunction(res[type]) ? (res) => res[type]() :\n (_, config) => {\n throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);\n })\n });\n})(new Response));\n\nconst getBodyLength = async (body) => {\n if (body == null) {\n return 0;\n }\n\n if(utils.isBlob(body)) {\n return body.size;\n }\n\n if(utils.isSpecCompliantForm(body)) {\n return (await new Request(body).arrayBuffer()).byteLength;\n }\n\n if(utils.isArrayBufferView(body)) {\n return body.byteLength;\n }\n\n if(utils.isURLSearchParams(body)) {\n body = body + '';\n }\n\n if(utils.isString(body)) {\n return (await encodeText(body)).byteLength;\n }\n}\n\nconst resolveBodyLength = async (headers, body) => {\n const length = utils.toFiniteNumber(headers.getContentLength());\n\n return length == null ? getBodyLength(body) : length;\n}\n\nexport default isFetchSupported && (async (config) => {\n let {\n url,\n method,\n data,\n signal,\n cancelToken,\n timeout,\n onDownloadProgress,\n onUploadProgress,\n responseType,\n headers,\n withCredentials = 'same-origin',\n fetchOptions\n } = resolveConfig(config);\n\n responseType = responseType ? (responseType + '').toLowerCase() : 'text';\n\n let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ?\n composeSignals([signal, cancelToken], timeout) : [];\n\n let finished, request;\n\n const onFinish = () => {\n !finished && setTimeout(() => {\n composedSignal && composedSignal.unsubscribe();\n });\n\n finished = true;\n }\n\n let requestContentLength;\n\n try {\n if (\n onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&\n (requestContentLength = await resolveBodyLength(headers, data)) !== 0\n ) {\n let _request = new Request(url, {\n method: 'POST',\n body: data,\n duplex: \"half\"\n });\n\n let contentTypeHeader;\n\n if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {\n headers.setContentType(contentTypeHeader)\n }\n\n if (_request.body) {\n data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(\n requestContentLength,\n progressEventReducer(onUploadProgress)\n ), null, encodeText);\n }\n }\n\n if (!utils.isString(withCredentials)) {\n withCredentials = withCredentials ? 'cors' : 'omit';\n }\n\n request = new Request(url, {\n ...fetchOptions,\n signal: composedSignal,\n method: method.toUpperCase(),\n headers: headers.normalize().toJSON(),\n body: data,\n duplex: \"half\",\n withCredentials\n });\n\n let response = await fetch(request);\n\n const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');\n\n if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {\n const options = {};\n\n ['status', 'statusText', 'headers'].forEach(prop => {\n options[prop] = response[prop];\n });\n\n const responseContentLength = utils.toFiniteNumber(response.headers.get('content-length'));\n\n response = new Response(\n trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(\n responseContentLength,\n progressEventReducer(onDownloadProgress, true)\n ), isStreamResponse && onFinish, encodeText),\n options\n );\n }\n\n responseType = responseType || 'text';\n\n let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](response, config);\n\n !isStreamResponse && onFinish();\n\n stopTimeout && stopTimeout();\n\n return await new Promise((resolve, reject) => {\n settle(resolve, reject, {\n data: responseData,\n headers: AxiosHeaders.from(response.headers),\n status: response.status,\n statusText: response.statusText,\n config,\n request\n })\n })\n } catch (err) {\n onFinish();\n\n if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {\n throw Object.assign(\n new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),\n {\n cause: err.cause || err\n }\n )\n }\n\n throw AxiosError.from(err, err && err.code, config, request);\n }\n});\n\n\n","import utils from '../utils.js';\nimport httpAdapter from './http.js';\nimport xhrAdapter from './xhr.js';\nimport fetchAdapter from './fetch.js';\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst knownAdapters = {\n http: httpAdapter,\n xhr: xhrAdapter,\n fetch: fetchAdapter\n}\n\nutils.forEach(knownAdapters, (fn, value) => {\n if (fn) {\n try {\n Object.defineProperty(fn, 'name', {value});\n } catch (e) {\n // eslint-disable-next-line no-empty\n }\n Object.defineProperty(fn, 'adapterName', {value});\n }\n});\n\nconst renderReason = (reason) => `- ${reason}`;\n\nconst isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;\n\nexport default {\n getAdapter: (adapters) => {\n adapters = utils.isArray(adapters) ? adapters : [adapters];\n\n const {length} = adapters;\n let nameOrAdapter;\n let adapter;\n\n const rejectedReasons = {};\n\n for (let i = 0; i < length; i++) {\n nameOrAdapter = adapters[i];\n let id;\n\n adapter = nameOrAdapter;\n\n if (!isResolvedHandle(nameOrAdapter)) {\n adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];\n\n if (adapter === undefined) {\n throw new AxiosError(`Unknown adapter '${id}'`);\n }\n }\n\n if (adapter) {\n break;\n }\n\n rejectedReasons[id || '#' + i] = adapter;\n }\n\n if (!adapter) {\n\n const reasons = Object.entries(rejectedReasons)\n .map(([id, state]) => `adapter ${id} ` +\n (state === false ? 'is not supported by the environment' : 'is not available in the build')\n );\n\n let s = length ?\n (reasons.length > 1 ? 'since :\\n' + reasons.map(renderReason).join('\\n') : ' ' + renderReason(reasons[0])) :\n 'as no adapter specified';\n\n throw new AxiosError(\n `There is no suitable adapter to dispatch the request ` + s,\n 'ERR_NOT_SUPPORT'\n );\n }\n\n return adapter;\n },\n adapters: knownAdapters\n}\n","// eslint-disable-next-line strict\nexport default null;\n","'use strict';\n\nimport transformData from './transformData.js';\nimport isCancel from '../cancel/isCancel.js';\nimport defaults from '../defaults/index.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport adapters from \"../adapters/adapters.js\";\n\n/**\n * Throws a `CanceledError` if cancellation has been requested.\n *\n * @param {Object} config The config that is to be used for the request\n *\n * @returns {void}\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n\n if (config.signal && config.signal.aborted) {\n throw new CanceledError(null, config);\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n *\n * @returns {Promise} The Promise to be fulfilled\n */\nexport default function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n config.headers = AxiosHeaders.from(config.headers);\n\n // Transform request data\n config.data = transformData.call(\n config,\n config.transformRequest\n );\n\n if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {\n config.headers.setContentType('application/x-www-form-urlencoded', false);\n }\n\n const adapter = adapters.getAdapter(config.adapter || defaults.adapter);\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData.call(\n config,\n config.transformResponse,\n response\n );\n\n response.headers = AxiosHeaders.from(response.headers);\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData.call(\n config,\n config.transformResponse,\n reason.response\n );\n reason.response.headers = AxiosHeaders.from(reason.response.headers);\n }\n }\n\n return Promise.reject(reason);\n });\n}\n","export const VERSION = \"1.7.2\";","'use strict';\n\nimport {VERSION} from '../env/data.js';\nimport AxiosError from '../core/AxiosError.js';\n\nconst validators = {};\n\n// eslint-disable-next-line func-names\n['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {\n validators[type] = function validator(thing) {\n return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;\n };\n});\n\nconst deprecatedWarnings = {};\n\n/**\n * Transitional option validator\n *\n * @param {function|boolean?} validator - set to false if the transitional option has been removed\n * @param {string?} version - deprecated version / removed since version\n * @param {string?} message - some message with additional info\n *\n * @returns {function}\n */\nvalidators.transitional = function transitional(validator, version, message) {\n function formatMessage(opt, desc) {\n return '[Axios v' + VERSION + '] Transitional option \\'' + opt + '\\'' + desc + (message ? '. ' + message : '');\n }\n\n // eslint-disable-next-line func-names\n return (value, opt, opts) => {\n if (validator === false) {\n throw new AxiosError(\n formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),\n AxiosError.ERR_DEPRECATED\n );\n }\n\n if (version && !deprecatedWarnings[opt]) {\n deprecatedWarnings[opt] = true;\n // eslint-disable-next-line no-console\n console.warn(\n formatMessage(\n opt,\n ' has been deprecated since v' + version + ' and will be removed in the near future'\n )\n );\n }\n\n return validator ? validator(value, opt, opts) : true;\n };\n};\n\n/**\n * Assert object's properties type\n *\n * @param {object} options\n * @param {object} schema\n * @param {boolean?} allowUnknown\n *\n * @returns {object}\n */\n\nfunction assertOptions(options, schema, allowUnknown) {\n if (typeof options !== 'object') {\n throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);\n }\n const keys = Object.keys(options);\n let i = keys.length;\n while (i-- > 0) {\n const opt = keys[i];\n const validator = schema[opt];\n if (validator) {\n const value = options[opt];\n const result = value === undefined || validator(value, opt, options);\n if (result !== true) {\n throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);\n }\n continue;\n }\n if (allowUnknown !== true) {\n throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);\n }\n }\n}\n\nexport default {\n assertOptions,\n validators\n};\n","'use strict';\n\nimport utils from './../utils.js';\nimport buildURL from '../helpers/buildURL.js';\nimport InterceptorManager from './InterceptorManager.js';\nimport dispatchRequest from './dispatchRequest.js';\nimport mergeConfig from './mergeConfig.js';\nimport buildFullPath from './buildFullPath.js';\nimport validator from '../helpers/validator.js';\nimport AxiosHeaders from './AxiosHeaders.js';\n\nconst validators = validator.validators;\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n *\n * @return {Axios} A new instance of Axios\n */\nclass Axios {\n constructor(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n }\n\n /**\n * Dispatch a request\n *\n * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)\n * @param {?Object} config\n *\n * @returns {Promise} The Promise to be fulfilled\n */\n async request(configOrUrl, config) {\n try {\n return await this._request(configOrUrl, config);\n } catch (err) {\n if (err instanceof Error) {\n let dummy;\n\n Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());\n\n // slice off the Error: ... line\n const stack = dummy.stack ? dummy.stack.replace(/^.+\\n/, '') : '';\n try {\n if (!err.stack) {\n err.stack = stack;\n // match without the 2 top stack lines\n } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\\n.+\\n/, ''))) {\n err.stack += '\\n' + stack\n }\n } catch (e) {\n // ignore the case where \"stack\" is an un-writable property\n }\n }\n\n throw err;\n }\n }\n\n _request(configOrUrl, config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof configOrUrl === 'string') {\n config = config || {};\n config.url = configOrUrl;\n } else {\n config = configOrUrl || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n const {transitional, paramsSerializer, headers} = config;\n\n if (transitional !== undefined) {\n validator.assertOptions(transitional, {\n silentJSONParsing: validators.transitional(validators.boolean),\n forcedJSONParsing: validators.transitional(validators.boolean),\n clarifyTimeoutError: validators.transitional(validators.boolean)\n }, false);\n }\n\n if (paramsSerializer != null) {\n if (utils.isFunction(paramsSerializer)) {\n config.paramsSerializer = {\n serialize: paramsSerializer\n }\n } else {\n validator.assertOptions(paramsSerializer, {\n encode: validators.function,\n serialize: validators.function\n }, true);\n }\n }\n\n // Set config.method\n config.method = (config.method || this.defaults.method || 'get').toLowerCase();\n\n // Flatten headers\n let contextHeaders = headers && utils.merge(\n headers.common,\n headers[config.method]\n );\n\n headers && utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n (method) => {\n delete headers[method];\n }\n );\n\n config.headers = AxiosHeaders.concat(contextHeaders, headers);\n\n // filter out skipped interceptors\n const requestInterceptorChain = [];\n let synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n const responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n let promise;\n let i = 0;\n let len;\n\n if (!synchronousRequestInterceptors) {\n const chain = [dispatchRequest.bind(this), undefined];\n chain.unshift.apply(chain, requestInterceptorChain);\n chain.push.apply(chain, responseInterceptorChain);\n len = chain.length;\n\n promise = Promise.resolve(config);\n\n while (i < len) {\n promise = promise.then(chain[i++], chain[i++]);\n }\n\n return promise;\n }\n\n len = requestInterceptorChain.length;\n\n let newConfig = config;\n\n i = 0;\n\n while (i < len) {\n const onFulfilled = requestInterceptorChain[i++];\n const onRejected = requestInterceptorChain[i++];\n try {\n newConfig = onFulfilled(newConfig);\n } catch (error) {\n onRejected.call(this, error);\n break;\n }\n }\n\n try {\n promise = dispatchRequest.call(this, newConfig);\n } catch (error) {\n return Promise.reject(error);\n }\n\n i = 0;\n len = responseInterceptorChain.length;\n\n while (i < len) {\n promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);\n }\n\n return promise;\n }\n\n getUri(config) {\n config = mergeConfig(this.defaults, config);\n const fullPath = buildFullPath(config.baseURL, config.url);\n return buildURL(fullPath, config.params, config.paramsSerializer);\n }\n}\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n\n function generateHTTPMethod(isForm) {\n return function httpMethod(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n headers: isForm ? {\n 'Content-Type': 'multipart/form-data'\n } : {},\n url,\n data\n }));\n };\n }\n\n Axios.prototype[method] = generateHTTPMethod();\n\n Axios.prototype[method + 'Form'] = generateHTTPMethod(true);\n});\n\nexport default Axios;\n","'use strict';\n\nimport CanceledError from './CanceledError.js';\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @param {Function} executor The executor function.\n *\n * @returns {CancelToken}\n */\nclass CancelToken {\n constructor(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n let resolvePromise;\n\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n const token = this;\n\n // eslint-disable-next-line func-names\n this.promise.then(cancel => {\n if (!token._listeners) return;\n\n let i = token._listeners.length;\n\n while (i-- > 0) {\n token._listeners[i](cancel);\n }\n token._listeners = null;\n });\n\n // eslint-disable-next-line func-names\n this.promise.then = onfulfilled => {\n let _resolve;\n // eslint-disable-next-line func-names\n const promise = new Promise(resolve => {\n token.subscribe(resolve);\n _resolve = resolve;\n }).then(onfulfilled);\n\n promise.cancel = function reject() {\n token.unsubscribe(_resolve);\n };\n\n return promise;\n };\n\n executor(function cancel(message, config, request) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new CanceledError(message, config, request);\n resolvePromise(token.reason);\n });\n }\n\n /**\n * Throws a `CanceledError` if cancellation has been requested.\n */\n throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n }\n\n /**\n * Subscribe to the cancel signal\n */\n\n subscribe(listener) {\n if (this.reason) {\n listener(this.reason);\n return;\n }\n\n if (this._listeners) {\n this._listeners.push(listener);\n } else {\n this._listeners = [listener];\n }\n }\n\n /**\n * Unsubscribe from the cancel signal\n */\n\n unsubscribe(listener) {\n if (!this._listeners) {\n return;\n }\n const index = this._listeners.indexOf(listener);\n if (index !== -1) {\n this._listeners.splice(index, 1);\n }\n }\n\n /**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\n static source() {\n let cancel;\n const token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token,\n cancel\n };\n }\n}\n\nexport default CancelToken;\n","const HttpStatusCode = {\n Continue: 100,\n SwitchingProtocols: 101,\n Processing: 102,\n EarlyHints: 103,\n Ok: 200,\n Created: 201,\n Accepted: 202,\n NonAuthoritativeInformation: 203,\n NoContent: 204,\n ResetContent: 205,\n PartialContent: 206,\n MultiStatus: 207,\n AlreadyReported: 208,\n ImUsed: 226,\n MultipleChoices: 300,\n MovedPermanently: 301,\n Found: 302,\n SeeOther: 303,\n NotModified: 304,\n UseProxy: 305,\n Unused: 306,\n TemporaryRedirect: 307,\n PermanentRedirect: 308,\n BadRequest: 400,\n Unauthorized: 401,\n PaymentRequired: 402,\n Forbidden: 403,\n NotFound: 404,\n MethodNotAllowed: 405,\n NotAcceptable: 406,\n ProxyAuthenticationRequired: 407,\n RequestTimeout: 408,\n Conflict: 409,\n Gone: 410,\n LengthRequired: 411,\n PreconditionFailed: 412,\n PayloadTooLarge: 413,\n UriTooLong: 414,\n UnsupportedMediaType: 415,\n RangeNotSatisfiable: 416,\n ExpectationFailed: 417,\n ImATeapot: 418,\n MisdirectedRequest: 421,\n UnprocessableEntity: 422,\n Locked: 423,\n FailedDependency: 424,\n TooEarly: 425,\n UpgradeRequired: 426,\n PreconditionRequired: 428,\n TooManyRequests: 429,\n RequestHeaderFieldsTooLarge: 431,\n UnavailableForLegalReasons: 451,\n InternalServerError: 500,\n NotImplemented: 501,\n BadGateway: 502,\n ServiceUnavailable: 503,\n GatewayTimeout: 504,\n HttpVersionNotSupported: 505,\n VariantAlsoNegotiates: 506,\n InsufficientStorage: 507,\n LoopDetected: 508,\n NotExtended: 510,\n NetworkAuthenticationRequired: 511,\n};\n\nObject.entries(HttpStatusCode).forEach(([key, value]) => {\n HttpStatusCode[value] = key;\n});\n\nexport default HttpStatusCode;\n","'use strict';\n\nimport utils from './utils.js';\nimport bind from './helpers/bind.js';\nimport Axios from './core/Axios.js';\nimport mergeConfig from './core/mergeConfig.js';\nimport defaults from './defaults/index.js';\nimport formDataToJSON from './helpers/formDataToJSON.js';\nimport CanceledError from './cancel/CanceledError.js';\nimport CancelToken from './cancel/CancelToken.js';\nimport isCancel from './cancel/isCancel.js';\nimport {VERSION} from './env/data.js';\nimport toFormData from './helpers/toFormData.js';\nimport AxiosError from './core/AxiosError.js';\nimport spread from './helpers/spread.js';\nimport isAxiosError from './helpers/isAxiosError.js';\nimport AxiosHeaders from \"./core/AxiosHeaders.js\";\nimport adapters from './adapters/adapters.js';\nimport HttpStatusCode from './helpers/HttpStatusCode.js';\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n *\n * @returns {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n const context = new Axios(defaultConfig);\n const instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});\n\n // Copy context to instance\n utils.extend(instance, context, null, {allOwnKeys: true});\n\n // Factory for creating new instances\n instance.create = function create(instanceConfig) {\n return createInstance(mergeConfig(defaultConfig, instanceConfig));\n };\n\n return instance;\n}\n\n// Create the default instance to be exported\nconst axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Expose Cancel & CancelToken\naxios.CanceledError = CanceledError;\naxios.CancelToken = CancelToken;\naxios.isCancel = isCancel;\naxios.VERSION = VERSION;\naxios.toFormData = toFormData;\n\n// Expose AxiosError class\naxios.AxiosError = AxiosError;\n\n// alias for CanceledError for backward compatibility\naxios.Cancel = axios.CanceledError;\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\n\naxios.spread = spread;\n\n// Expose isAxiosError\naxios.isAxiosError = isAxiosError;\n\n// Expose mergeConfig\naxios.mergeConfig = mergeConfig;\n\naxios.AxiosHeaders = AxiosHeaders;\n\naxios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);\n\naxios.getAdapter = adapters.getAdapter;\n\naxios.HttpStatusCode = HttpStatusCode;\n\naxios.default = axios;\n\n// this module should only have a default export\nexport default axios\n","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n *\n * @returns {Function}\n */\nexport default function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n *\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nexport default function isAxiosError(payload) {\n return utils.isObject(payload) && (payload.isAxiosError === true);\n}\n","import axios from './lib/axios.js';\n\n// This module is intended to unwrap Axios default export as named.\n// Keep top-level export same with static properties\n// so that it can keep same with es module or cjs\nconst {\n Axios,\n AxiosError,\n CanceledError,\n isCancel,\n CancelToken,\n VERSION,\n all,\n Cancel,\n isAxiosError,\n spread,\n toFormData,\n AxiosHeaders,\n HttpStatusCode,\n formToJSON,\n getAdapter,\n mergeConfig\n} = axios;\n\nexport {\n axios as default,\n Axios,\n AxiosError,\n CanceledError,\n isCancel,\n CancelToken,\n VERSION,\n all,\n Cancel,\n isAxiosError,\n spread,\n toFormData,\n AxiosHeaders,\n HttpStatusCode,\n formToJSON,\n getAdapter,\n mergeConfig\n}\n"],"names":["bind","fn","thisArg","apply","arguments","toString","Object","prototype","getPrototypeOf","kindOf","cache","create","thing","str","call","slice","toLowerCase","kindOfTest","type","typeOfTest","isArray","Array","isUndefined","isArrayBuffer","isString","isFunction","isNumber","isObject","isPlainObject","val","Symbol","toStringTag","iterator","isDate","isFile","isBlob","isFileList","isURLSearchParams","isReadableStream","isRequest","isResponse","isHeaders","map","forEach","obj","allOwnKeys","i","l","length","keys","getOwnPropertyNames","len","key","findKey","_key","_global","globalThis","self","window","global","isContextDefined","context","isTypedArray","TypedArray","Uint8Array","isHTMLForm","hasOwnProperty","prop","isRegExp","reduceDescriptors","reducer","descriptors","getOwnPropertyDescriptors","reducedDescriptors","descriptor","name","ret","defineProperties","ALPHA","ALPHABET","DIGIT","ALPHA_DIGIT","toUpperCase","isAsyncFn","utils$1","isBuffer","constructor","isFormData","kind","FormData","append","isArrayBufferView","result","ArrayBuffer","isView","buffer","isBoolean","isStream","pipe","merge","caseless","this","assignValue","targetKey","extend","a","b","trim","replace","stripBOM","content","charCodeAt","inherits","superConstructor","props","defineProperty","value","assign","toFlatObject","sourceObj","destObj","filter","propFilter","merged","endsWith","searchString","position","String","undefined","lastIndex","indexOf","toArray","arr","forEachEntry","next","done","pair","matchAll","regExp","matches","exec","push","hasOwnProp","freezeMethods","enumerable","writable","set","Error","toObjectSet","arrayOrString","delimiter","define","split","toCamelCase","m","p1","p2","noop","toFiniteNumber","defaultValue","Number","isFinite","generateString","size","alphabet","Math","random","isSpecCompliantForm","toJSONObject","stack","visit","source","target","reducedValue","isThenable","then","catch","AxiosError","message","code","config","request","response","captureStackTrace","utils","toJSON","description","number","fileName","lineNumber","columnNumber","status","from","error","customProps","axiosError","cause","isVisitable","removeBrackets","renderKey","path","dots","concat","token","join","predicates","test","toFormData","formData","options","TypeError","metaTokens","indexes","option","visitor","defaultVisitor","useBlob","Blob","convertValue","toISOString","Buffer","JSON","stringify","some","isFlatArray","el","index","exposedHelpers","build","pop","encode","charMap","encodeURIComponent","match","AxiosURLSearchParams","params","_pairs","buildURL","url","_encode","serializeFn","serialize","serializedParams","hashmarkIndex","encoder","InterceptorManager$1","handlers","use","fulfilled","rejected","synchronous","runWhen","eject","id","clear","h","transitionalDefaults","silentJSONParsing","forcedJSONParsing","clarifyTimeoutError","platform$1","isBrowser","classes","URLSearchParams","protocols","hasBrowserEnv","document","hasStandardBrowserEnv","product","navigator","hasStandardBrowserWebWorkerEnv","WorkerGlobalScope","importScripts","origin","location","href","platform","formDataToJSON","buildPath","isNumericKey","isLast","arrayToObject","entries","parsePropPath","defaults","transitional","adapter","transformRequest","data","headers","contentType","getContentType","hasJSONContentType","isObjectPayload","setContentType","helpers","isNode","toURLEncodedForm","formSerializer","_FormData","env","rawValue","parser","parse","e","stringifySafely","transformResponse","JSONRequested","responseType","strictJSONParsing","ERR_BAD_RESPONSE","timeout","xsrfCookieName","xsrfHeaderName","maxContentLength","maxBodyLength","validateStatus","common","Accept","method","defaults$1","ignoreDuplicateOf","$internals","normalizeHeader","header","normalizeValue","matchHeaderValue","isHeaderNameFilter","AxiosHeaders","valueOrRewrite","rewrite","setHeader","_value","_header","_rewrite","lHeader","setHeaders","rawHeaders","parsed","line","substring","parseHeaders","get","tokens","tokensRE","parseTokens","has","matcher","delete","deleted","deleteHeader","normalize","format","normalized","w","char","formatHeader","targets","asStrings","static","first","computed","accessors","defineAccessor","accessorName","methodName","arg1","arg2","arg3","configurable","buildAccessors","accessor","mapped","headerValue","AxiosHeaders$2","transformData","fns","isCancel","__CANCEL__","CanceledError","ERR_CANCELED","settle","resolve","reject","ERR_BAD_REQUEST","floor","progressEventReducer","listener","isDownloadStream","freq","bytesNotified","_speedometer","samplesCount","min","bytes","timestamps","firstSampleTS","head","tail","chunkLength","now","Date","startedAt","bytesCount","passed","round","speedometer","timestamp","threshold","timer","force","clearTimeout","setTimeout","throttle","loaded","total","lengthComputable","progressBytes","rate","progress","estimated","event","isURLSameOrigin","msie","userAgent","urlParsingNode","createElement","originURL","resolveURL","setAttribute","protocol","host","search","hash","hostname","port","pathname","charAt","requestURL","cookies","write","expires","domain","secure","cookie","toGMTString","read","RegExp","decodeURIComponent","remove","buildFullPath","baseURL","requestedURL","relativeURL","combineURLs","headersToObject","mergeConfig","config1","config2","getMergedValue","mergeDeepProperties","valueFromConfig2","defaultToConfig2","mergeDirectKeys","mergeMap","paramsSerializer","timeoutMessage","withCredentials","withXSRFToken","onUploadProgress","onDownloadProgress","decompress","beforeRedirect","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding","configValue","resolveConfig","newConfig","auth","btoa","username","password","unescape","Boolean","xsrfValue","xhrAdapter","XMLHttpRequest","Promise","_config","requestData","requestHeaders","onCanceled","unsubscribe","signal","removeEventListener","onloadend","responseHeaders","getAllResponseHeaders","err","responseText","statusText","open","onreadystatechange","readyState","responseURL","onabort","ECONNABORTED","onerror","ERR_NETWORK","ontimeout","timeoutErrorMessage","ETIMEDOUT","setRequestHeader","addEventListener","upload","cancel","abort","subscribe","aborted","parseProtocol","send","composeSignals$1","signals","controller","AbortController","reason","streamChunk","chunk","chunkSize","byteLength","end","pos","trackStream","stream","onProgress","onFinish","async","iterable","readBytes","ReadableStream","close","enqueue","return","highWaterMark","fetchProgressDecorator","isFetchSupported","fetch","Request","Response","isReadableStreamSupported","encodeText","TextEncoder","arrayBuffer","supportsRequestStream","duplexAccessed","hasContentType","body","duplex","supportsResponseStream","resolvers","res","_","ERR_NOT_SUPPORT","resolveBodyLength","getContentLength","getBodyLength","knownAdapters","http","xhr","fetchOptions","finished","composedSignal","stopTimeout","composeSignals","requestContentLength","contentTypeHeader","_request","isStreamResponse","responseContentLength","responseData","renderReason","isResolvedHandle","adapters","nameOrAdapter","rejectedReasons","reasons","state","throwIfCancellationRequested","throwIfRequested","dispatchRequest","validators","deprecatedWarnings","validator","version","formatMessage","opt","desc","opts","ERR_DEPRECATED","console","warn","assertOptions","schema","allowUnknown","ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","Axios","instanceConfig","interceptors","InterceptorManager","configOrUrl","dummy","boolean","function","contextHeaders","requestInterceptorChain","synchronousRequestInterceptors","interceptor","unshift","responseInterceptorChain","promise","chain","onFulfilled","onRejected","getUri","generateHTTPMethod","isForm","Axios$2","CancelToken","executor","resolvePromise","_listeners","onfulfilled","_resolve","splice","c","CancelToken$2","HttpStatusCode","Continue","SwitchingProtocols","Processing","EarlyHints","Ok","Created","Accepted","NonAuthoritativeInformation","NoContent","ResetContent","PartialContent","MultiStatus","AlreadyReported","ImUsed","MultipleChoices","MovedPermanently","Found","SeeOther","NotModified","UseProxy","Unused","TemporaryRedirect","PermanentRedirect","BadRequest","Unauthorized","PaymentRequired","Forbidden","NotFound","MethodNotAllowed","NotAcceptable","ProxyAuthenticationRequired","RequestTimeout","Conflict","Gone","LengthRequired","PreconditionFailed","PayloadTooLarge","UriTooLong","UnsupportedMediaType","RangeNotSatisfiable","ExpectationFailed","ImATeapot","MisdirectedRequest","UnprocessableEntity","Locked","FailedDependency","TooEarly","UpgradeRequired","PreconditionRequired","TooManyRequests","RequestHeaderFieldsTooLarge","UnavailableForLegalReasons","InternalServerError","NotImplemented","BadGateway","ServiceUnavailable","GatewayTimeout","HttpVersionNotSupported","VariantAlsoNegotiates","InsufficientStorage","LoopDetected","NotExtended","NetworkAuthenticationRequired","HttpStatusCode$2","axios","createInstance","defaultConfig","instance","VERSION","Cancel","all","promises","spread","callback","isAxiosError","payload","formToJSON","getAdapter","default","axios$1"],"mappings":"AAEe,SAASA,EAAKC,EAAIC,GAC/B,OAAO,WACL,OAAOD,EAAGE,MAAMD,EAASE,UAC7B,CACA,CCAA,MAAMC,SAACA,GAAYC,OAAOC,WACpBC,eAACA,GAAkBF,OA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,GAAW8E,QACXA,GAAOE,IACPA,GAAGD,OACHA,GAAMK,aACNA,GAAYF,OACZA,GAAM3f,WACNA,GAAUyH,aACVA,GAAYyT,eACZA,GAAc6E,WACdA,GAAUC,WACVA,GAAUvQ,YACVA,IACE0P"} \ No newline at end of file diff --git a/project starter code/node_modules/axios/dist/node/axios.cjs b/project starter code/node_modules/axios/dist/node/axios.cjs new file mode 100644 index 00000000..a2edf8c2 --- /dev/null +++ b/project starter code/node_modules/axios/dist/node/axios.cjs @@ -0,0 +1,4705 @@ +// Axios v1.7.2 Copyright (c) 2024 Matt Zabriskie and contributors +'use strict'; + +const FormData$1 = require('form-data'); +const url = require('url'); +const proxyFromEnv = require('proxy-from-env'); +const http = require('http'); +const https = require('https'); +const util = require('util'); +const followRedirects = require('follow-redirects'); +const zlib = require('zlib'); +const stream = require('stream'); +const events = require('events'); + +function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + +const FormData__default = /*#__PURE__*/_interopDefaultLegacy(FormData$1); +const url__default = /*#__PURE__*/_interopDefaultLegacy(url); +const http__default = /*#__PURE__*/_interopDefaultLegacy(http); +const https__default = /*#__PURE__*/_interopDefaultLegacy(https); +const util__default = /*#__PURE__*/_interopDefaultLegacy(util); +const followRedirects__default = /*#__PURE__*/_interopDefaultLegacy(followRedirects); +const zlib__default = /*#__PURE__*/_interopDefaultLegacy(zlib); +const stream__default = /*#__PURE__*/_interopDefaultLegacy(stream); + +function bind(fn, thisArg) { + return function wrap() { + return fn.apply(thisArg, arguments); + }; +} + +// utils is a library of generic helper functions non-specific to axios + +const {toString} = Object.prototype; +const {getPrototypeOf} = Object; + +const kindOf = (cache => thing => { + const str = toString.call(thing); + return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase()); +})(Object.create(null)); + +const kindOfTest = (type) => { + type = type.toLowerCase(); + return (thing) => kindOf(thing) === type +}; + +const typeOfTest = type => thing => typeof thing === type; + +/** + * Determine if a value is an Array + * + * @param {Object} val The value to test + * + * @returns {boolean} True if value is an Array, otherwise false + */ +const {isArray} = Array; + +/** + * Determine if a value is undefined + * + * @param {*} val The value to test + * + * @returns {boolean} True if the value is undefined, otherwise false + */ +const isUndefined = typeOfTest('undefined'); + +/** + * Determine if a value is a Buffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Buffer, otherwise false + */ +function isBuffer(val) { + return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) + && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val); +} + +/** + * Determine if a value is an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is an ArrayBuffer, otherwise false + */ +const isArrayBuffer = kindOfTest('ArrayBuffer'); + + +/** + * Determine if a value is a view on an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false + */ +function isArrayBufferView(val) { + let result; + if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { + result = ArrayBuffer.isView(val); + } else { + result = (val) && (val.buffer) && (isArrayBuffer(val.buffer)); + } + return result; +} + +/** + * Determine if a value is a String + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a String, otherwise false + */ +const isString = typeOfTest('string'); + +/** + * Determine if a value is a Function + * + * @param {*} val The value to test + * @returns {boolean} True if value is a Function, otherwise false + */ +const isFunction = typeOfTest('function'); + +/** + * Determine if a value is a Number + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Number, otherwise false + */ +const isNumber = typeOfTest('number'); + +/** + * Determine if a value is an Object + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an Object, otherwise false + */ +const isObject = (thing) => thing !== null && typeof thing === 'object'; + +/** + * Determine if a value is a Boolean + * + * @param {*} thing The value to test + * @returns {boolean} True if value is a Boolean, otherwise false + */ +const isBoolean = thing => thing === true || thing === false; + +/** + * Determine if a value is a plain Object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a plain Object, otherwise false + */ +const isPlainObject = (val) => { + if (kindOf(val) !== 'object') { + return false; + } + + const prototype = getPrototypeOf(val); + return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val); +}; + +/** + * Determine if a value is a Date + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Date, otherwise false + */ +const isDate = kindOfTest('Date'); + +/** + * Determine if a value is a File + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ +const isFile = kindOfTest('File'); + +/** + * Determine if a value is a Blob + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Blob, otherwise false + */ +const isBlob = kindOfTest('Blob'); + +/** + * Determine if a value is a FileList + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ +const isFileList = kindOfTest('FileList'); + +/** + * Determine if a value is a Stream + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Stream, otherwise false + */ +const isStream = (val) => isObject(val) && isFunction(val.pipe); + +/** + * Determine if a value is a FormData + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an FormData, otherwise false + */ +const isFormData = (thing) => { + let kind; + return thing && ( + (typeof FormData === 'function' && thing instanceof FormData) || ( + isFunction(thing.append) && ( + (kind = kindOf(thing)) === 'formdata' || + // detect form-data instance + (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]') + ) + ) + ) +}; + +/** + * Determine if a value is a URLSearchParams object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a URLSearchParams object, otherwise false + */ +const isURLSearchParams = kindOfTest('URLSearchParams'); + +const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest); + +/** + * Trim excess whitespace off the beginning and end of a string + * + * @param {String} str The String to trim + * + * @returns {String} The String freed of excess whitespace + */ +const trim = (str) => str.trim ? + str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + +/** + * Iterate over an Array or an Object invoking a function for each item. + * + * If `obj` is an Array callback will be called passing + * the value, index, and complete array for each item. + * + * If 'obj' is an Object callback will be called passing + * the value, key, and complete object for each property. + * + * @param {Object|Array} obj The object to iterate + * @param {Function} fn The callback to invoke for each item + * + * @param {Boolean} [allOwnKeys = false] + * @returns {any} + */ +function forEach(obj, fn, {allOwnKeys = false} = {}) { + // Don't bother if no value provided + if (obj === null || typeof obj === 'undefined') { + return; + } + + let i; + let l; + + // Force an array if not already something iterable + if (typeof obj !== 'object') { + /*eslint no-param-reassign:0*/ + obj = [obj]; + } + + if (isArray(obj)) { + // Iterate over array values + for (i = 0, l = obj.length; i < l; i++) { + fn.call(null, obj[i], i, obj); + } + } else { + // Iterate over object keys + const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj); + const len = keys.length; + let key; + + for (i = 0; i < len; i++) { + key = keys[i]; + fn.call(null, obj[key], key, obj); + } + } +} + +function findKey(obj, key) { + key = key.toLowerCase(); + const keys = Object.keys(obj); + let i = keys.length; + let _key; + while (i-- > 0) { + _key = keys[i]; + if (key === _key.toLowerCase()) { + return _key; + } + } + return null; +} + +const _global = (() => { + /*eslint no-undef:0*/ + if (typeof globalThis !== "undefined") return globalThis; + return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global) +})(); + +const isContextDefined = (context) => !isUndefined(context) && context !== _global; + +/** + * Accepts varargs expecting each argument to be an object, then + * immutably merges the properties of each object and returns result. + * + * When multiple objects contain the same key the later object in + * the arguments list will take precedence. + * + * Example: + * + * ```js + * var result = merge({foo: 123}, {foo: 456}); + * console.log(result.foo); // outputs 456 + * ``` + * + * @param {Object} obj1 Object to merge + * + * @returns {Object} Result of all merge properties + */ +function merge(/* obj1, obj2, obj3, ... */) { + const {caseless} = isContextDefined(this) && this || {}; + const result = {}; + const assignValue = (val, key) => { + const targetKey = caseless && findKey(result, key) || key; + if (isPlainObject(result[targetKey]) && isPlainObject(val)) { + result[targetKey] = merge(result[targetKey], val); + } else if (isPlainObject(val)) { + result[targetKey] = merge({}, val); + } else if (isArray(val)) { + result[targetKey] = val.slice(); + } else { + result[targetKey] = val; + } + }; + + for (let i = 0, l = arguments.length; i < l; i++) { + arguments[i] && forEach(arguments[i], assignValue); + } + return result; +} + +/** + * Extends object a by mutably adding to it the properties of object b. + * + * @param {Object} a The object to be extended + * @param {Object} b The object to copy properties from + * @param {Object} thisArg The object to bind function to + * + * @param {Boolean} [allOwnKeys] + * @returns {Object} The resulting value of object a + */ +const extend = (a, b, thisArg, {allOwnKeys}= {}) => { + forEach(b, (val, key) => { + if (thisArg && isFunction(val)) { + a[key] = bind(val, thisArg); + } else { + a[key] = val; + } + }, {allOwnKeys}); + return a; +}; + +/** + * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) + * + * @param {string} content with BOM + * + * @returns {string} content value without BOM + */ +const stripBOM = (content) => { + if (content.charCodeAt(0) === 0xFEFF) { + content = content.slice(1); + } + return content; +}; + +/** + * Inherit the prototype methods from one constructor into another + * @param {function} constructor + * @param {function} superConstructor + * @param {object} [props] + * @param {object} [descriptors] + * + * @returns {void} + */ +const inherits = (constructor, superConstructor, props, descriptors) => { + constructor.prototype = Object.create(superConstructor.prototype, descriptors); + constructor.prototype.constructor = constructor; + Object.defineProperty(constructor, 'super', { + value: superConstructor.prototype + }); + props && Object.assign(constructor.prototype, props); +}; + +/** + * Resolve object with deep prototype chain to a flat object + * @param {Object} sourceObj source object + * @param {Object} [destObj] + * @param {Function|Boolean} [filter] + * @param {Function} [propFilter] + * + * @returns {Object} + */ +const toFlatObject = (sourceObj, destObj, filter, propFilter) => { + let props; + let i; + let prop; + const merged = {}; + + destObj = destObj || {}; + // eslint-disable-next-line no-eq-null,eqeqeq + if (sourceObj == null) return destObj; + + do { + props = Object.getOwnPropertyNames(sourceObj); + i = props.length; + while (i-- > 0) { + prop = props[i]; + if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) { + destObj[prop] = sourceObj[prop]; + merged[prop] = true; + } + } + sourceObj = filter !== false && getPrototypeOf(sourceObj); + } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype); + + return destObj; +}; + +/** + * Determines whether a string ends with the characters of a specified string + * + * @param {String} str + * @param {String} searchString + * @param {Number} [position= 0] + * + * @returns {boolean} + */ +const endsWith = (str, searchString, position) => { + str = String(str); + if (position === undefined || position > str.length) { + position = str.length; + } + position -= searchString.length; + const lastIndex = str.indexOf(searchString, position); + return lastIndex !== -1 && lastIndex === position; +}; + + +/** + * Returns new array from array like object or null if failed + * + * @param {*} [thing] + * + * @returns {?Array} + */ +const toArray = (thing) => { + if (!thing) return null; + if (isArray(thing)) return thing; + let i = thing.length; + if (!isNumber(i)) return null; + const arr = new Array(i); + while (i-- > 0) { + arr[i] = thing[i]; + } + return arr; +}; + +/** + * Checking if the Uint8Array exists and if it does, it returns a function that checks if the + * thing passed in is an instance of Uint8Array + * + * @param {TypedArray} + * + * @returns {Array} + */ +// eslint-disable-next-line func-names +const isTypedArray = (TypedArray => { + // eslint-disable-next-line func-names + return thing => { + return TypedArray && thing instanceof TypedArray; + }; +})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array)); + +/** + * For each entry in the object, call the function with the key and value. + * + * @param {Object} obj - The object to iterate over. + * @param {Function} fn - The function to call for each entry. + * + * @returns {void} + */ +const forEachEntry = (obj, fn) => { + const generator = obj && obj[Symbol.iterator]; + + const iterator = generator.call(obj); + + let result; + + while ((result = iterator.next()) && !result.done) { + const pair = result.value; + fn.call(obj, pair[0], pair[1]); + } +}; + +/** + * It takes a regular expression and a string, and returns an array of all the matches + * + * @param {string} regExp - The regular expression to match against. + * @param {string} str - The string to search. + * + * @returns {Array} + */ +const matchAll = (regExp, str) => { + let matches; + const arr = []; + + while ((matches = regExp.exec(str)) !== null) { + arr.push(matches); + } + + return arr; +}; + +/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */ +const isHTMLForm = kindOfTest('HTMLFormElement'); + +const toCamelCase = str => { + return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, + function replacer(m, p1, p2) { + return p1.toUpperCase() + p2; + } + ); +}; + +/* Creating a function that will check if an object has a property. */ +const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype); + +/** + * Determine if a value is a RegExp object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a RegExp object, otherwise false + */ +const isRegExp = kindOfTest('RegExp'); + +const reduceDescriptors = (obj, reducer) => { + const descriptors = Object.getOwnPropertyDescriptors(obj); + const reducedDescriptors = {}; + + forEach(descriptors, (descriptor, name) => { + let ret; + if ((ret = reducer(descriptor, name, obj)) !== false) { + reducedDescriptors[name] = ret || descriptor; + } + }); + + Object.defineProperties(obj, reducedDescriptors); +}; + +/** + * Makes all methods read-only + * @param {Object} obj + */ + +const freezeMethods = (obj) => { + reduceDescriptors(obj, (descriptor, name) => { + // skip restricted props in strict mode + if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) { + return false; + } + + const value = obj[name]; + + if (!isFunction(value)) return; + + descriptor.enumerable = false; + + if ('writable' in descriptor) { + descriptor.writable = false; + return; + } + + if (!descriptor.set) { + descriptor.set = () => { + throw Error('Can not rewrite read-only method \'' + name + '\''); + }; + } + }); +}; + +const toObjectSet = (arrayOrString, delimiter) => { + const obj = {}; + + const define = (arr) => { + arr.forEach(value => { + obj[value] = true; + }); + }; + + isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter)); + + return obj; +}; + +const noop = () => {}; + +const toFiniteNumber = (value, defaultValue) => { + return value != null && Number.isFinite(value = +value) ? value : defaultValue; +}; + +const ALPHA = 'abcdefghijklmnopqrstuvwxyz'; + +const DIGIT = '0123456789'; + +const ALPHABET = { + DIGIT, + ALPHA, + ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT +}; + +const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => { + let str = ''; + const {length} = alphabet; + while (size--) { + str += alphabet[Math.random() * length|0]; + } + + return str; +}; + +/** + * If the thing is a FormData object, return true, otherwise return false. + * + * @param {unknown} thing - The thing to check. + * + * @returns {boolean} + */ +function isSpecCompliantForm(thing) { + return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]); +} + +const toJSONObject = (obj) => { + const stack = new Array(10); + + const visit = (source, i) => { + + if (isObject(source)) { + if (stack.indexOf(source) >= 0) { + return; + } + + if(!('toJSON' in source)) { + stack[i] = source; + const target = isArray(source) ? [] : {}; + + forEach(source, (value, key) => { + const reducedValue = visit(value, i + 1); + !isUndefined(reducedValue) && (target[key] = reducedValue); + }); + + stack[i] = undefined; + + return target; + } + } + + return source; + }; + + return visit(obj, 0); +}; + +const isAsyncFn = kindOfTest('AsyncFunction'); + +const isThenable = (thing) => + thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch); + +const utils$1 = { + isArray, + isArrayBuffer, + isBuffer, + isFormData, + isArrayBufferView, + isString, + isNumber, + isBoolean, + isObject, + isPlainObject, + isReadableStream, + isRequest, + isResponse, + isHeaders, + isUndefined, + isDate, + isFile, + isBlob, + isRegExp, + isFunction, + isStream, + isURLSearchParams, + isTypedArray, + isFileList, + forEach, + merge, + extend, + trim, + stripBOM, + inherits, + toFlatObject, + kindOf, + kindOfTest, + endsWith, + toArray, + forEachEntry, + matchAll, + isHTMLForm, + hasOwnProperty, + hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection + reduceDescriptors, + freezeMethods, + toObjectSet, + toCamelCase, + noop, + toFiniteNumber, + findKey, + global: _global, + isContextDefined, + ALPHABET, + generateString, + isSpecCompliantForm, + toJSONObject, + isAsyncFn, + isThenable +}; + +/** + * Create an Error with the specified message, config, error code, request and response. + * + * @param {string} message The error message. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [config] The config. + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * + * @returns {Error} The created error. + */ +function AxiosError(message, code, config, request, response) { + Error.call(this); + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } else { + this.stack = (new Error()).stack; + } + + this.message = message; + this.name = 'AxiosError'; + code && (this.code = code); + config && (this.config = config); + request && (this.request = request); + response && (this.response = response); +} + +utils$1.inherits(AxiosError, Error, { + toJSON: function toJSON() { + return { + // Standard + message: this.message, + name: this.name, + // Microsoft + description: this.description, + number: this.number, + // Mozilla + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + // Axios + config: utils$1.toJSONObject(this.config), + code: this.code, + status: this.response && this.response.status ? this.response.status : null + }; + } +}); + +const prototype$1 = AxiosError.prototype; +const descriptors = {}; + +[ + 'ERR_BAD_OPTION_VALUE', + 'ERR_BAD_OPTION', + 'ECONNABORTED', + 'ETIMEDOUT', + 'ERR_NETWORK', + 'ERR_FR_TOO_MANY_REDIRECTS', + 'ERR_DEPRECATED', + 'ERR_BAD_RESPONSE', + 'ERR_BAD_REQUEST', + 'ERR_CANCELED', + 'ERR_NOT_SUPPORT', + 'ERR_INVALID_URL' +// eslint-disable-next-line func-names +].forEach(code => { + descriptors[code] = {value: code}; +}); + +Object.defineProperties(AxiosError, descriptors); +Object.defineProperty(prototype$1, 'isAxiosError', {value: true}); + +// eslint-disable-next-line func-names +AxiosError.from = (error, code, config, request, response, customProps) => { + const axiosError = Object.create(prototype$1); + + utils$1.toFlatObject(error, axiosError, function filter(obj) { + return obj !== Error.prototype; + }, prop => { + return prop !== 'isAxiosError'; + }); + + AxiosError.call(axiosError, error.message, code, config, request, response); + + axiosError.cause = error; + + axiosError.name = error.name; + + customProps && Object.assign(axiosError, customProps); + + return axiosError; +}; + +/** + * Determines if the given thing is a array or js object. + * + * @param {string} thing - The object or array to be visited. + * + * @returns {boolean} + */ +function isVisitable(thing) { + return utils$1.isPlainObject(thing) || utils$1.isArray(thing); +} + +/** + * It removes the brackets from the end of a string + * + * @param {string} key - The key of the parameter. + * + * @returns {string} the key without the brackets. + */ +function removeBrackets(key) { + return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key; +} + +/** + * It takes a path, a key, and a boolean, and returns a string + * + * @param {string} path - The path to the current key. + * @param {string} key - The key of the current object being iterated over. + * @param {string} dots - If true, the key will be rendered with dots instead of brackets. + * + * @returns {string} The path to the current key. + */ +function renderKey(path, key, dots) { + if (!path) return key; + return path.concat(key).map(function each(token, i) { + // eslint-disable-next-line no-param-reassign + token = removeBrackets(token); + return !dots && i ? '[' + token + ']' : token; + }).join(dots ? '.' : ''); +} + +/** + * If the array is an array and none of its elements are visitable, then it's a flat array. + * + * @param {Array} arr - The array to check + * + * @returns {boolean} + */ +function isFlatArray(arr) { + return utils$1.isArray(arr) && !arr.some(isVisitable); +} + +const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) { + return /^is[A-Z]/.test(prop); +}); + +/** + * Convert a data object to FormData + * + * @param {Object} obj + * @param {?Object} [formData] + * @param {?Object} [options] + * @param {Function} [options.visitor] + * @param {Boolean} [options.metaTokens = true] + * @param {Boolean} [options.dots = false] + * @param {?Boolean} [options.indexes = false] + * + * @returns {Object} + **/ + +/** + * It converts an object into a FormData object + * + * @param {Object} obj - The object to convert to form data. + * @param {string} formData - The FormData object to append to. + * @param {Object} options + * + * @returns + */ +function toFormData(obj, formData, options) { + if (!utils$1.isObject(obj)) { + throw new TypeError('target must be an object'); + } + + // eslint-disable-next-line no-param-reassign + formData = formData || new (FormData__default["default"] || FormData)(); + + // eslint-disable-next-line no-param-reassign + options = utils$1.toFlatObject(options, { + metaTokens: true, + dots: false, + indexes: false + }, false, function defined(option, source) { + // eslint-disable-next-line no-eq-null,eqeqeq + return !utils$1.isUndefined(source[option]); + }); + + const metaTokens = options.metaTokens; + // eslint-disable-next-line no-use-before-define + const visitor = options.visitor || defaultVisitor; + const dots = options.dots; + const indexes = options.indexes; + const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob; + const useBlob = _Blob && utils$1.isSpecCompliantForm(formData); + + if (!utils$1.isFunction(visitor)) { + throw new TypeError('visitor must be a function'); + } + + function convertValue(value) { + if (value === null) return ''; + + if (utils$1.isDate(value)) { + return value.toISOString(); + } + + if (!useBlob && utils$1.isBlob(value)) { + throw new AxiosError('Blob is not supported. Use a Buffer instead.'); + } + + if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) { + return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value); + } + + return value; + } + + /** + * Default visitor. + * + * @param {*} value + * @param {String|Number} key + * @param {Array} path + * @this {FormData} + * + * @returns {boolean} return true to visit the each prop of the value recursively + */ + function defaultVisitor(value, key, path) { + let arr = value; + + if (value && !path && typeof value === 'object') { + if (utils$1.endsWith(key, '{}')) { + // eslint-disable-next-line no-param-reassign + key = metaTokens ? key : key.slice(0, -2); + // eslint-disable-next-line no-param-reassign + value = JSON.stringify(value); + } else if ( + (utils$1.isArray(value) && isFlatArray(value)) || + ((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value)) + )) { + // eslint-disable-next-line no-param-reassign + key = removeBrackets(key); + + arr.forEach(function each(el, index) { + !(utils$1.isUndefined(el) || el === null) && formData.append( + // eslint-disable-next-line no-nested-ternary + indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'), + convertValue(el) + ); + }); + return false; + } + } + + if (isVisitable(value)) { + return true; + } + + formData.append(renderKey(path, key, dots), convertValue(value)); + + return false; + } + + const stack = []; + + const exposedHelpers = Object.assign(predicates, { + defaultVisitor, + convertValue, + isVisitable + }); + + function build(value, path) { + if (utils$1.isUndefined(value)) return; + + if (stack.indexOf(value) !== -1) { + throw Error('Circular reference detected in ' + path.join('.')); + } + + stack.push(value); + + utils$1.forEach(value, function each(el, key) { + const result = !(utils$1.isUndefined(el) || el === null) && visitor.call( + formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers + ); + + if (result === true) { + build(el, path ? path.concat(key) : [key]); + } + }); + + stack.pop(); + } + + if (!utils$1.isObject(obj)) { + throw new TypeError('data must be an object'); + } + + build(obj); + + return formData; +} + +/** + * It encodes a string by replacing all characters that are not in the unreserved set with + * their percent-encoded equivalents + * + * @param {string} str - The string to encode. + * + * @returns {string} The encoded string. + */ +function encode$1(str) { + const charMap = { + '!': '%21', + "'": '%27', + '(': '%28', + ')': '%29', + '~': '%7E', + '%20': '+', + '%00': '\x00' + }; + return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) { + return charMap[match]; + }); +} + +/** + * It takes a params object and converts it to a FormData object + * + * @param {Object} params - The parameters to be converted to a FormData object. + * @param {Object} options - The options object passed to the Axios constructor. + * + * @returns {void} + */ +function AxiosURLSearchParams(params, options) { + this._pairs = []; + + params && toFormData(params, this, options); +} + +const prototype = AxiosURLSearchParams.prototype; + +prototype.append = function append(name, value) { + this._pairs.push([name, value]); +}; + +prototype.toString = function toString(encoder) { + const _encode = encoder ? function(value) { + return encoder.call(this, value, encode$1); + } : encode$1; + + return this._pairs.map(function each(pair) { + return _encode(pair[0]) + '=' + _encode(pair[1]); + }, '').join('&'); +}; + +/** + * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their + * URI encoded counterparts + * + * @param {string} val The value to be encoded. + * + * @returns {string} The encoded value. + */ +function encode(val) { + return encodeURIComponent(val). + replace(/%3A/gi, ':'). + replace(/%24/g, '$'). + replace(/%2C/gi, ','). + replace(/%20/g, '+'). + replace(/%5B/gi, '['). + replace(/%5D/gi, ']'); +} + +/** + * Build a URL by appending params to the end + * + * @param {string} url The base of the url (e.g., http://www.google.com) + * @param {object} [params] The params to be appended + * @param {?object} options + * + * @returns {string} The formatted url + */ +function buildURL(url, params, options) { + /*eslint no-param-reassign:0*/ + if (!params) { + return url; + } + + const _encode = options && options.encode || encode; + + const serializeFn = options && options.serialize; + + let serializedParams; + + if (serializeFn) { + serializedParams = serializeFn(params, options); + } else { + serializedParams = utils$1.isURLSearchParams(params) ? + params.toString() : + new AxiosURLSearchParams(params, options).toString(_encode); + } + + if (serializedParams) { + const hashmarkIndex = url.indexOf("#"); + + if (hashmarkIndex !== -1) { + url = url.slice(0, hashmarkIndex); + } + url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; + } + + return url; +} + +class InterceptorManager { + constructor() { + this.handlers = []; + } + + /** + * Add a new interceptor to the stack + * + * @param {Function} fulfilled The function to handle `then` for a `Promise` + * @param {Function} rejected The function to handle `reject` for a `Promise` + * + * @return {Number} An ID used to remove interceptor later + */ + use(fulfilled, rejected, options) { + this.handlers.push({ + fulfilled, + rejected, + synchronous: options ? options.synchronous : false, + runWhen: options ? options.runWhen : null + }); + return this.handlers.length - 1; + } + + /** + * Remove an interceptor from the stack + * + * @param {Number} id The ID that was returned by `use` + * + * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise + */ + eject(id) { + if (this.handlers[id]) { + this.handlers[id] = null; + } + } + + /** + * Clear all interceptors from the stack + * + * @returns {void} + */ + clear() { + if (this.handlers) { + this.handlers = []; + } + } + + /** + * Iterate over all the registered interceptors + * + * This method is particularly useful for skipping over any + * interceptors that may have become `null` calling `eject`. + * + * @param {Function} fn The function to call for each interceptor + * + * @returns {void} + */ + forEach(fn) { + utils$1.forEach(this.handlers, function forEachHandler(h) { + if (h !== null) { + fn(h); + } + }); + } +} + +const InterceptorManager$1 = InterceptorManager; + +const transitionalDefaults = { + silentJSONParsing: true, + forcedJSONParsing: true, + clarifyTimeoutError: false +}; + +const URLSearchParams = url__default["default"].URLSearchParams; + +const platform$1 = { + isNode: true, + classes: { + URLSearchParams, + FormData: FormData__default["default"], + Blob: typeof Blob !== 'undefined' && Blob || null + }, + protocols: [ 'http', 'https', 'file', 'data' ] +}; + +const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined'; + +/** + * Determine if we're running in a standard browser environment + * + * This allows axios to run in a web worker, and react-native. + * Both environments support XMLHttpRequest, but not fully standard globals. + * + * web workers: + * typeof window -> undefined + * typeof document -> undefined + * + * react-native: + * navigator.product -> 'ReactNative' + * nativescript + * navigator.product -> 'NativeScript' or 'NS' + * + * @returns {boolean} + */ +const hasStandardBrowserEnv = ( + (product) => { + return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0 + })(typeof navigator !== 'undefined' && navigator.product); + +/** + * Determine if we're running in a standard browser webWorker environment + * + * Although the `isStandardBrowserEnv` method indicates that + * `allows axios to run in a web worker`, the WebWorker will still be + * filtered out due to its judgment standard + * `typeof window !== 'undefined' && typeof document !== 'undefined'`. + * This leads to a problem when axios post `FormData` in webWorker + */ +const hasStandardBrowserWebWorkerEnv = (() => { + return ( + typeof WorkerGlobalScope !== 'undefined' && + // eslint-disable-next-line no-undef + self instanceof WorkerGlobalScope && + typeof self.importScripts === 'function' + ); +})(); + +const origin = hasBrowserEnv && window.location.href || 'http://localhost'; + +const utils = /*#__PURE__*/Object.freeze({ + __proto__: null, + hasBrowserEnv: hasBrowserEnv, + hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv, + hasStandardBrowserEnv: hasStandardBrowserEnv, + origin: origin +}); + +const platform = { + ...utils, + ...platform$1 +}; + +function toURLEncodedForm(data, options) { + return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({ + visitor: function(value, key, path, helpers) { + if (platform.isNode && utils$1.isBuffer(value)) { + this.append(key, value.toString('base64')); + return false; + } + + return helpers.defaultVisitor.apply(this, arguments); + } + }, options)); +} + +/** + * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z'] + * + * @param {string} name - The name of the property to get. + * + * @returns An array of strings. + */ +function parsePropPath(name) { + // foo[x][y][z] + // foo.x.y.z + // foo-x-y-z + // foo x y z + return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => { + return match[0] === '[]' ? '' : match[1] || match[0]; + }); +} + +/** + * Convert an array to an object. + * + * @param {Array} arr - The array to convert to an object. + * + * @returns An object with the same keys and values as the array. + */ +function arrayToObject(arr) { + const obj = {}; + const keys = Object.keys(arr); + let i; + const len = keys.length; + let key; + for (i = 0; i < len; i++) { + key = keys[i]; + obj[key] = arr[key]; + } + return obj; +} + +/** + * It takes a FormData object and returns a JavaScript object + * + * @param {string} formData The FormData object to convert to JSON. + * + * @returns {Object | null} The converted object. + */ +function formDataToJSON(formData) { + function buildPath(path, value, target, index) { + let name = path[index++]; + + if (name === '__proto__') return true; + + const isNumericKey = Number.isFinite(+name); + const isLast = index >= path.length; + name = !name && utils$1.isArray(target) ? target.length : name; + + if (isLast) { + if (utils$1.hasOwnProp(target, name)) { + target[name] = [target[name], value]; + } else { + target[name] = value; + } + + return !isNumericKey; + } + + if (!target[name] || !utils$1.isObject(target[name])) { + target[name] = []; + } + + const result = buildPath(path, value, target[name], index); + + if (result && utils$1.isArray(target[name])) { + target[name] = arrayToObject(target[name]); + } + + return !isNumericKey; + } + + if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) { + const obj = {}; + + utils$1.forEachEntry(formData, (name, value) => { + buildPath(parsePropPath(name), value, obj, 0); + }); + + return obj; + } + + return null; +} + +/** + * It takes a string, tries to parse it, and if it fails, it returns the stringified version + * of the input + * + * @param {any} rawValue - The value to be stringified. + * @param {Function} parser - A function that parses a string into a JavaScript object. + * @param {Function} encoder - A function that takes a value and returns a string. + * + * @returns {string} A stringified version of the rawValue. + */ +function stringifySafely(rawValue, parser, encoder) { + if (utils$1.isString(rawValue)) { + try { + (parser || JSON.parse)(rawValue); + return utils$1.trim(rawValue); + } catch (e) { + if (e.name !== 'SyntaxError') { + throw e; + } + } + } + + return (encoder || JSON.stringify)(rawValue); +} + +const defaults = { + + transitional: transitionalDefaults, + + adapter: ['xhr', 'http', 'fetch'], + + transformRequest: [function transformRequest(data, headers) { + const contentType = headers.getContentType() || ''; + const hasJSONContentType = contentType.indexOf('application/json') > -1; + const isObjectPayload = utils$1.isObject(data); + + if (isObjectPayload && utils$1.isHTMLForm(data)) { + data = new FormData(data); + } + + const isFormData = utils$1.isFormData(data); + + if (isFormData) { + return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data; + } + + if (utils$1.isArrayBuffer(data) || + utils$1.isBuffer(data) || + utils$1.isStream(data) || + utils$1.isFile(data) || + utils$1.isBlob(data) || + utils$1.isReadableStream(data) + ) { + return data; + } + if (utils$1.isArrayBufferView(data)) { + return data.buffer; + } + if (utils$1.isURLSearchParams(data)) { + headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false); + return data.toString(); + } + + let isFileList; + + if (isObjectPayload) { + if (contentType.indexOf('application/x-www-form-urlencoded') > -1) { + return toURLEncodedForm(data, this.formSerializer).toString(); + } + + if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) { + const _FormData = this.env && this.env.FormData; + + return toFormData( + isFileList ? {'files[]': data} : data, + _FormData && new _FormData(), + this.formSerializer + ); + } + } + + if (isObjectPayload || hasJSONContentType ) { + headers.setContentType('application/json', false); + return stringifySafely(data); + } + + return data; + }], + + transformResponse: [function transformResponse(data) { + const transitional = this.transitional || defaults.transitional; + const forcedJSONParsing = transitional && transitional.forcedJSONParsing; + const JSONRequested = this.responseType === 'json'; + + if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) { + return data; + } + + if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) { + const silentJSONParsing = transitional && transitional.silentJSONParsing; + const strictJSONParsing = !silentJSONParsing && JSONRequested; + + try { + return JSON.parse(data); + } catch (e) { + if (strictJSONParsing) { + if (e.name === 'SyntaxError') { + throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response); + } + throw e; + } + } + } + + return data; + }], + + /** + * A timeout in milliseconds to abort a request. If set to 0 (default) a + * timeout is not created. + */ + timeout: 0, + + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN', + + maxContentLength: -1, + maxBodyLength: -1, + + env: { + FormData: platform.classes.FormData, + Blob: platform.classes.Blob + }, + + validateStatus: function validateStatus(status) { + return status >= 200 && status < 300; + }, + + headers: { + common: { + 'Accept': 'application/json, text/plain, */*', + 'Content-Type': undefined + } + } +}; + +utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => { + defaults.headers[method] = {}; +}); + +const defaults$1 = defaults; + +// RawAxiosHeaders whose duplicates are ignored by node +// c.f. https://nodejs.org/api/http.html#http_message_headers +const ignoreDuplicateOf = utils$1.toObjectSet([ + 'age', 'authorization', 'content-length', 'content-type', 'etag', + 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', + 'last-modified', 'location', 'max-forwards', 'proxy-authorization', + 'referer', 'retry-after', 'user-agent' +]); + +/** + * Parse headers into an object + * + * ``` + * Date: Wed, 27 Aug 2014 08:58:49 GMT + * Content-Type: application/json + * Connection: keep-alive + * Transfer-Encoding: chunked + * ``` + * + * @param {String} rawHeaders Headers needing to be parsed + * + * @returns {Object} Headers parsed into an object + */ +const parseHeaders = rawHeaders => { + const parsed = {}; + let key; + let val; + let i; + + rawHeaders && rawHeaders.split('\n').forEach(function parser(line) { + i = line.indexOf(':'); + key = line.substring(0, i).trim().toLowerCase(); + val = line.substring(i + 1).trim(); + + if (!key || (parsed[key] && ignoreDuplicateOf[key])) { + return; + } + + if (key === 'set-cookie') { + if (parsed[key]) { + parsed[key].push(val); + } else { + parsed[key] = [val]; + } + } else { + parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; + } + }); + + return parsed; +}; + +const $internals = Symbol('internals'); + +function normalizeHeader(header) { + return header && String(header).trim().toLowerCase(); +} + +function normalizeValue(value) { + if (value === false || value == null) { + return value; + } + + return utils$1.isArray(value) ? value.map(normalizeValue) : String(value); +} + +function parseTokens(str) { + const tokens = Object.create(null); + const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; + let match; + + while ((match = tokensRE.exec(str))) { + tokens[match[1]] = match[2]; + } + + return tokens; +} + +const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim()); + +function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) { + if (utils$1.isFunction(filter)) { + return filter.call(this, value, header); + } + + if (isHeaderNameFilter) { + value = header; + } + + if (!utils$1.isString(value)) return; + + if (utils$1.isString(filter)) { + return value.indexOf(filter) !== -1; + } + + if (utils$1.isRegExp(filter)) { + return filter.test(value); + } +} + +function formatHeader(header) { + return header.trim() + .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => { + return char.toUpperCase() + str; + }); +} + +function buildAccessors(obj, header) { + const accessorName = utils$1.toCamelCase(' ' + header); + + ['get', 'set', 'has'].forEach(methodName => { + Object.defineProperty(obj, methodName + accessorName, { + value: function(arg1, arg2, arg3) { + return this[methodName].call(this, header, arg1, arg2, arg3); + }, + configurable: true + }); + }); +} + +class AxiosHeaders { + constructor(headers) { + headers && this.set(headers); + } + + set(header, valueOrRewrite, rewrite) { + const self = this; + + function setHeader(_value, _header, _rewrite) { + const lHeader = normalizeHeader(_header); + + if (!lHeader) { + throw new Error('header name must be a non-empty string'); + } + + const key = utils$1.findKey(self, lHeader); + + if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) { + self[key || _header] = normalizeValue(_value); + } + } + + const setHeaders = (headers, _rewrite) => + utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite)); + + if (utils$1.isPlainObject(header) || header instanceof this.constructor) { + setHeaders(header, valueOrRewrite); + } else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) { + setHeaders(parseHeaders(header), valueOrRewrite); + } else if (utils$1.isHeaders(header)) { + for (const [key, value] of header.entries()) { + setHeader(value, key, rewrite); + } + } else { + header != null && setHeader(valueOrRewrite, header, rewrite); + } + + return this; + } + + get(header, parser) { + header = normalizeHeader(header); + + if (header) { + const key = utils$1.findKey(this, header); + + if (key) { + const value = this[key]; + + if (!parser) { + return value; + } + + if (parser === true) { + return parseTokens(value); + } + + if (utils$1.isFunction(parser)) { + return parser.call(this, value, key); + } + + if (utils$1.isRegExp(parser)) { + return parser.exec(value); + } + + throw new TypeError('parser must be boolean|regexp|function'); + } + } + } + + has(header, matcher) { + header = normalizeHeader(header); + + if (header) { + const key = utils$1.findKey(this, header); + + return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher))); + } + + return false; + } + + delete(header, matcher) { + const self = this; + let deleted = false; + + function deleteHeader(_header) { + _header = normalizeHeader(_header); + + if (_header) { + const key = utils$1.findKey(self, _header); + + if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) { + delete self[key]; + + deleted = true; + } + } + } + + if (utils$1.isArray(header)) { + header.forEach(deleteHeader); + } else { + deleteHeader(header); + } + + return deleted; + } + + clear(matcher) { + const keys = Object.keys(this); + let i = keys.length; + let deleted = false; + + while (i--) { + const key = keys[i]; + if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) { + delete this[key]; + deleted = true; + } + } + + return deleted; + } + + normalize(format) { + const self = this; + const headers = {}; + + utils$1.forEach(this, (value, header) => { + const key = utils$1.findKey(headers, header); + + if (key) { + self[key] = normalizeValue(value); + delete self[header]; + return; + } + + const normalized = format ? formatHeader(header) : String(header).trim(); + + if (normalized !== header) { + delete self[header]; + } + + self[normalized] = normalizeValue(value); + + headers[normalized] = true; + }); + + return this; + } + + concat(...targets) { + return this.constructor.concat(this, ...targets); + } + + toJSON(asStrings) { + const obj = Object.create(null); + + utils$1.forEach(this, (value, header) => { + value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value); + }); + + return obj; + } + + [Symbol.iterator]() { + return Object.entries(this.toJSON())[Symbol.iterator](); + } + + toString() { + return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n'); + } + + get [Symbol.toStringTag]() { + return 'AxiosHeaders'; + } + + static from(thing) { + return thing instanceof this ? thing : new this(thing); + } + + static concat(first, ...targets) { + const computed = new this(first); + + targets.forEach((target) => computed.set(target)); + + return computed; + } + + static accessor(header) { + const internals = this[$internals] = (this[$internals] = { + accessors: {} + }); + + const accessors = internals.accessors; + const prototype = this.prototype; + + function defineAccessor(_header) { + const lHeader = normalizeHeader(_header); + + if (!accessors[lHeader]) { + buildAccessors(prototype, _header); + accessors[lHeader] = true; + } + } + + utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header); + + return this; + } +} + +AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']); + +// reserved names hotfix +utils$1.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => { + let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set` + return { + get: () => value, + set(headerValue) { + this[mapped] = headerValue; + } + } +}); + +utils$1.freezeMethods(AxiosHeaders); + +const AxiosHeaders$1 = AxiosHeaders; + +/** + * Transform the data for a request or a response + * + * @param {Array|Function} fns A single function or Array of functions + * @param {?Object} response The response object + * + * @returns {*} The resulting transformed data + */ +function transformData(fns, response) { + const config = this || defaults$1; + const context = response || config; + const headers = AxiosHeaders$1.from(context.headers); + let data = context.data; + + utils$1.forEach(fns, function transform(fn) { + data = fn.call(config, data, headers.normalize(), response ? response.status : undefined); + }); + + headers.normalize(); + + return data; +} + +function isCancel(value) { + return !!(value && value.__CANCEL__); +} + +/** + * A `CanceledError` is an object that is thrown when an operation is canceled. + * + * @param {string=} message The message. + * @param {Object=} config The config. + * @param {Object=} request The request. + * + * @returns {CanceledError} The created error. + */ +function CanceledError(message, config, request) { + // eslint-disable-next-line no-eq-null,eqeqeq + AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request); + this.name = 'CanceledError'; +} + +utils$1.inherits(CanceledError, AxiosError, { + __CANCEL__: true +}); + +/** + * Resolve or reject a Promise based on response status. + * + * @param {Function} resolve A function that resolves the promise. + * @param {Function} reject A function that rejects the promise. + * @param {object} response The response. + * + * @returns {object} The response. + */ +function settle(resolve, reject, response) { + const validateStatus = response.config.validateStatus; + if (!response.status || !validateStatus || validateStatus(response.status)) { + resolve(response); + } else { + reject(new AxiosError( + 'Request failed with status code ' + response.status, + [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], + response.config, + response.request, + response + )); + } +} + +/** + * Determines whether the specified URL is absolute + * + * @param {string} url The URL to test + * + * @returns {boolean} True if the specified URL is absolute, otherwise false + */ +function isAbsoluteURL(url) { + // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). + // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed + // by any combination of letters, digits, plus, period, or hyphen. + return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); +} + +/** + * Creates a new URL by combining the specified URLs + * + * @param {string} baseURL The base URL + * @param {string} relativeURL The relative URL + * + * @returns {string} The combined URL + */ +function combineURLs(baseURL, relativeURL) { + return relativeURL + ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') + : baseURL; +} + +/** + * Creates a new URL by combining the baseURL with the requestedURL, + * only when the requestedURL is not already an absolute URL. + * If the requestURL is absolute, this function returns the requestedURL untouched. + * + * @param {string} baseURL The base URL + * @param {string} requestedURL Absolute or relative URL to combine + * + * @returns {string} The combined full path + */ +function buildFullPath(baseURL, requestedURL) { + if (baseURL && !isAbsoluteURL(requestedURL)) { + return combineURLs(baseURL, requestedURL); + } + return requestedURL; +} + +const VERSION = "1.7.2"; + +function parseProtocol(url) { + const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url); + return match && match[1] || ''; +} + +const DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/; + +/** + * Parse data uri to a Buffer or Blob + * + * @param {String} uri + * @param {?Boolean} asBlob + * @param {?Object} options + * @param {?Function} options.Blob + * + * @returns {Buffer|Blob} + */ +function fromDataURI(uri, asBlob, options) { + const _Blob = options && options.Blob || platform.classes.Blob; + const protocol = parseProtocol(uri); + + if (asBlob === undefined && _Blob) { + asBlob = true; + } + + if (protocol === 'data') { + uri = protocol.length ? uri.slice(protocol.length + 1) : uri; + + const match = DATA_URL_PATTERN.exec(uri); + + if (!match) { + throw new AxiosError('Invalid URL', AxiosError.ERR_INVALID_URL); + } + + const mime = match[1]; + const isBase64 = match[2]; + const body = match[3]; + const buffer = Buffer.from(decodeURIComponent(body), isBase64 ? 'base64' : 'utf8'); + + if (asBlob) { + if (!_Blob) { + throw new AxiosError('Blob is not supported', AxiosError.ERR_NOT_SUPPORT); + } + + return new _Blob([buffer], {type: mime}); + } + + return buffer; + } + + throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT); +} + +/** + * Throttle decorator + * @param {Function} fn + * @param {Number} freq + * @return {Function} + */ +function throttle(fn, freq) { + let timestamp = 0; + const threshold = 1000 / freq; + let timer = null; + return function throttled() { + const force = this === true; + + const now = Date.now(); + if (force || now - timestamp > threshold) { + if (timer) { + clearTimeout(timer); + timer = null; + } + timestamp = now; + return fn.apply(null, arguments); + } + if (!timer) { + timer = setTimeout(() => { + timer = null; + timestamp = Date.now(); + return fn.apply(null, arguments); + }, threshold - (now - timestamp)); + } + }; +} + +/** + * Calculate data maxRate + * @param {Number} [samplesCount= 10] + * @param {Number} [min= 1000] + * @returns {Function} + */ +function speedometer(samplesCount, min) { + samplesCount = samplesCount || 10; + const bytes = new Array(samplesCount); + const timestamps = new Array(samplesCount); + let head = 0; + let tail = 0; + let firstSampleTS; + + min = min !== undefined ? min : 1000; + + return function push(chunkLength) { + const now = Date.now(); + + const startedAt = timestamps[tail]; + + if (!firstSampleTS) { + firstSampleTS = now; + } + + bytes[head] = chunkLength; + timestamps[head] = now; + + let i = tail; + let bytesCount = 0; + + while (i !== head) { + bytesCount += bytes[i++]; + i = i % samplesCount; + } + + head = (head + 1) % samplesCount; + + if (head === tail) { + tail = (tail + 1) % samplesCount; + } + + if (now - firstSampleTS < min) { + return; + } + + const passed = startedAt && now - startedAt; + + return passed ? Math.round(bytesCount * 1000 / passed) : undefined; + }; +} + +const kInternals = Symbol('internals'); + +class AxiosTransformStream extends stream__default["default"].Transform{ + constructor(options) { + options = utils$1.toFlatObject(options, { + maxRate: 0, + chunkSize: 64 * 1024, + minChunkSize: 100, + timeWindow: 500, + ticksRate: 2, + samplesCount: 15 + }, null, (prop, source) => { + return !utils$1.isUndefined(source[prop]); + }); + + super({ + readableHighWaterMark: options.chunkSize + }); + + const self = this; + + const internals = this[kInternals] = { + length: options.length, + timeWindow: options.timeWindow, + ticksRate: options.ticksRate, + chunkSize: options.chunkSize, + maxRate: options.maxRate, + minChunkSize: options.minChunkSize, + bytesSeen: 0, + isCaptured: false, + notifiedBytesLoaded: 0, + ts: Date.now(), + bytes: 0, + onReadCallback: null + }; + + const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow); + + this.on('newListener', event => { + if (event === 'progress') { + if (!internals.isCaptured) { + internals.isCaptured = true; + } + } + }); + + let bytesNotified = 0; + + internals.updateProgress = throttle(function throttledHandler() { + const totalBytes = internals.length; + const bytesTransferred = internals.bytesSeen; + const progressBytes = bytesTransferred - bytesNotified; + if (!progressBytes || self.destroyed) return; + + const rate = _speedometer(progressBytes); + + bytesNotified = bytesTransferred; + + process.nextTick(() => { + self.emit('progress', { + loaded: bytesTransferred, + total: totalBytes, + progress: totalBytes ? (bytesTransferred / totalBytes) : undefined, + bytes: progressBytes, + rate: rate ? rate : undefined, + estimated: rate && totalBytes && bytesTransferred <= totalBytes ? + (totalBytes - bytesTransferred) / rate : undefined, + lengthComputable: totalBytes != null + }); + }); + }, internals.ticksRate); + + const onFinish = () => { + internals.updateProgress.call(true); + }; + + this.once('end', onFinish); + this.once('error', onFinish); + } + + _read(size) { + const internals = this[kInternals]; + + if (internals.onReadCallback) { + internals.onReadCallback(); + } + + return super._read(size); + } + + _transform(chunk, encoding, callback) { + const self = this; + const internals = this[kInternals]; + const maxRate = internals.maxRate; + + const readableHighWaterMark = this.readableHighWaterMark; + + const timeWindow = internals.timeWindow; + + const divider = 1000 / timeWindow; + const bytesThreshold = (maxRate / divider); + const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0; + + function pushChunk(_chunk, _callback) { + const bytes = Buffer.byteLength(_chunk); + internals.bytesSeen += bytes; + internals.bytes += bytes; + + if (internals.isCaptured) { + internals.updateProgress(); + } + + if (self.push(_chunk)) { + process.nextTick(_callback); + } else { + internals.onReadCallback = () => { + internals.onReadCallback = null; + process.nextTick(_callback); + }; + } + } + + const transformChunk = (_chunk, _callback) => { + const chunkSize = Buffer.byteLength(_chunk); + let chunkRemainder = null; + let maxChunkSize = readableHighWaterMark; + let bytesLeft; + let passed = 0; + + if (maxRate) { + const now = Date.now(); + + if (!internals.ts || (passed = (now - internals.ts)) >= timeWindow) { + internals.ts = now; + bytesLeft = bytesThreshold - internals.bytes; + internals.bytes = bytesLeft < 0 ? -bytesLeft : 0; + passed = 0; + } + + bytesLeft = bytesThreshold - internals.bytes; + } + + if (maxRate) { + if (bytesLeft <= 0) { + // next time window + return setTimeout(() => { + _callback(null, _chunk); + }, timeWindow - passed); + } + + if (bytesLeft < maxChunkSize) { + maxChunkSize = bytesLeft; + } + } + + if (maxChunkSize && chunkSize > maxChunkSize && (chunkSize - maxChunkSize) > minChunkSize) { + chunkRemainder = _chunk.subarray(maxChunkSize); + _chunk = _chunk.subarray(0, maxChunkSize); + } + + pushChunk(_chunk, chunkRemainder ? () => { + process.nextTick(_callback, null, chunkRemainder); + } : _callback); + }; + + transformChunk(chunk, function transformNextChunk(err, _chunk) { + if (err) { + return callback(err); + } + + if (_chunk) { + transformChunk(_chunk, transformNextChunk); + } else { + callback(null); + } + }); + } + + setLength(length) { + this[kInternals].length = +length; + return this; + } +} + +const AxiosTransformStream$1 = AxiosTransformStream; + +const {asyncIterator} = Symbol; + +const readBlob = async function* (blob) { + if (blob.stream) { + yield* blob.stream(); + } else if (blob.arrayBuffer) { + yield await blob.arrayBuffer(); + } else if (blob[asyncIterator]) { + yield* blob[asyncIterator](); + } else { + yield blob; + } +}; + +const readBlob$1 = readBlob; + +const BOUNDARY_ALPHABET = utils$1.ALPHABET.ALPHA_DIGIT + '-_'; + +const textEncoder = new util.TextEncoder(); + +const CRLF = '\r\n'; +const CRLF_BYTES = textEncoder.encode(CRLF); +const CRLF_BYTES_COUNT = 2; + +class FormDataPart { + constructor(name, value) { + const {escapeName} = this.constructor; + const isStringValue = utils$1.isString(value); + + let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${ + !isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : '' + }${CRLF}`; + + if (isStringValue) { + value = textEncoder.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF)); + } else { + headers += `Content-Type: ${value.type || "application/octet-stream"}${CRLF}`; + } + + this.headers = textEncoder.encode(headers + CRLF); + + this.contentLength = isStringValue ? value.byteLength : value.size; + + this.size = this.headers.byteLength + this.contentLength + CRLF_BYTES_COUNT; + + this.name = name; + this.value = value; + } + + async *encode(){ + yield this.headers; + + const {value} = this; + + if(utils$1.isTypedArray(value)) { + yield value; + } else { + yield* readBlob$1(value); + } + + yield CRLF_BYTES; + } + + static escapeName(name) { + return String(name).replace(/[\r\n"]/g, (match) => ({ + '\r' : '%0D', + '\n' : '%0A', + '"' : '%22', + }[match])); + } +} + +const formDataToStream = (form, headersHandler, options) => { + const { + tag = 'form-data-boundary', + size = 25, + boundary = tag + '-' + utils$1.generateString(size, BOUNDARY_ALPHABET) + } = options || {}; + + if(!utils$1.isFormData(form)) { + throw TypeError('FormData instance required'); + } + + if (boundary.length < 1 || boundary.length > 70) { + throw Error('boundary must be 10-70 characters long') + } + + const boundaryBytes = textEncoder.encode('--' + boundary + CRLF); + const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF + CRLF); + let contentLength = footerBytes.byteLength; + + const parts = Array.from(form.entries()).map(([name, value]) => { + const part = new FormDataPart(name, value); + contentLength += part.size; + return part; + }); + + contentLength += boundaryBytes.byteLength * parts.length; + + contentLength = utils$1.toFiniteNumber(contentLength); + + const computedHeaders = { + 'Content-Type': `multipart/form-data; boundary=${boundary}` + }; + + if (Number.isFinite(contentLength)) { + computedHeaders['Content-Length'] = contentLength; + } + + headersHandler && headersHandler(computedHeaders); + + return stream.Readable.from((async function *() { + for(const part of parts) { + yield boundaryBytes; + yield* part.encode(); + } + + yield footerBytes; + })()); +}; + +const formDataToStream$1 = formDataToStream; + +class ZlibHeaderTransformStream extends stream__default["default"].Transform { + __transform(chunk, encoding, callback) { + this.push(chunk); + callback(); + } + + _transform(chunk, encoding, callback) { + if (chunk.length !== 0) { + this._transform = this.__transform; + + // Add Default Compression headers if no zlib headers are present + if (chunk[0] !== 120) { // Hex: 78 + const header = Buffer.alloc(2); + header[0] = 120; // Hex: 78 + header[1] = 156; // Hex: 9C + this.push(header, encoding); + } + } + + this.__transform(chunk, encoding, callback); + } +} + +const ZlibHeaderTransformStream$1 = ZlibHeaderTransformStream; + +const callbackify = (fn, reducer) => { + return utils$1.isAsyncFn(fn) ? function (...args) { + const cb = args.pop(); + fn.apply(this, args).then((value) => { + try { + reducer ? cb(null, ...reducer(value)) : cb(null, value); + } catch (err) { + cb(err); + } + }, cb); + } : fn; +}; + +const callbackify$1 = callbackify; + +const zlibOptions = { + flush: zlib__default["default"].constants.Z_SYNC_FLUSH, + finishFlush: zlib__default["default"].constants.Z_SYNC_FLUSH +}; + +const brotliOptions = { + flush: zlib__default["default"].constants.BROTLI_OPERATION_FLUSH, + finishFlush: zlib__default["default"].constants.BROTLI_OPERATION_FLUSH +}; + +const isBrotliSupported = utils$1.isFunction(zlib__default["default"].createBrotliDecompress); + +const {http: httpFollow, https: httpsFollow} = followRedirects__default["default"]; + +const isHttps = /https:?/; + +const supportedProtocols = platform.protocols.map(protocol => { + return protocol + ':'; +}); + +/** + * If the proxy or config beforeRedirects functions are defined, call them with the options + * object. + * + * @param {Object} options - The options object that was passed to the request. + * + * @returns {Object} + */ +function dispatchBeforeRedirect(options, responseDetails) { + if (options.beforeRedirects.proxy) { + options.beforeRedirects.proxy(options); + } + if (options.beforeRedirects.config) { + options.beforeRedirects.config(options, responseDetails); + } +} + +/** + * If the proxy or config afterRedirects functions are defined, call them with the options + * + * @param {http.ClientRequestArgs} options + * @param {AxiosProxyConfig} configProxy configuration from Axios options object + * @param {string} location + * + * @returns {http.ClientRequestArgs} + */ +function setProxy(options, configProxy, location) { + let proxy = configProxy; + if (!proxy && proxy !== false) { + const proxyUrl = proxyFromEnv.getProxyForUrl(location); + if (proxyUrl) { + proxy = new URL(proxyUrl); + } + } + if (proxy) { + // Basic proxy authorization + if (proxy.username) { + proxy.auth = (proxy.username || '') + ':' + (proxy.password || ''); + } + + if (proxy.auth) { + // Support proxy auth object form + if (proxy.auth.username || proxy.auth.password) { + proxy.auth = (proxy.auth.username || '') + ':' + (proxy.auth.password || ''); + } + const base64 = Buffer + .from(proxy.auth, 'utf8') + .toString('base64'); + options.headers['Proxy-Authorization'] = 'Basic ' + base64; + } + + options.headers.host = options.hostname + (options.port ? ':' + options.port : ''); + const proxyHost = proxy.hostname || proxy.host; + options.hostname = proxyHost; + // Replace 'host' since options is not a URL object + options.host = proxyHost; + options.port = proxy.port; + options.path = location; + if (proxy.protocol) { + options.protocol = proxy.protocol.includes(':') ? proxy.protocol : `${proxy.protocol}:`; + } + } + + options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) { + // Configure proxy for redirected request, passing the original config proxy to apply + // the exact same logic as if the redirected request was performed by axios directly. + setProxy(redirectOptions, configProxy, redirectOptions.href); + }; +} + +const isHttpAdapterSupported = typeof process !== 'undefined' && utils$1.kindOf(process) === 'process'; + +// temporary hotfix + +const wrapAsync = (asyncExecutor) => { + return new Promise((resolve, reject) => { + let onDone; + let isDone; + + const done = (value, isRejected) => { + if (isDone) return; + isDone = true; + onDone && onDone(value, isRejected); + }; + + const _resolve = (value) => { + done(value); + resolve(value); + }; + + const _reject = (reason) => { + done(reason, true); + reject(reason); + }; + + asyncExecutor(_resolve, _reject, (onDoneHandler) => (onDone = onDoneHandler)).catch(_reject); + }) +}; + +const resolveFamily = ({address, family}) => { + if (!utils$1.isString(address)) { + throw TypeError('address must be a string'); + } + return ({ + address, + family: family || (address.indexOf('.') < 0 ? 6 : 4) + }); +}; + +const buildAddressEntry = (address, family) => resolveFamily(utils$1.isObject(address) ? address : {address, family}); + +/*eslint consistent-return:0*/ +const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) { + return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) { + let {data, lookup, family} = config; + const {responseType, responseEncoding} = config; + const method = config.method.toUpperCase(); + let isDone; + let rejected = false; + let req; + + if (lookup) { + const _lookup = callbackify$1(lookup, (value) => utils$1.isArray(value) ? value : [value]); + // hotfix to support opt.all option which is required for node 20.x + lookup = (hostname, opt, cb) => { + _lookup(hostname, opt, (err, arg0, arg1) => { + if (err) { + return cb(err); + } + + const addresses = utils$1.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)]; + + opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family); + }); + }; + } + + // temporary internal emitter until the AxiosRequest class will be implemented + const emitter = new events.EventEmitter(); + + const onFinished = () => { + if (config.cancelToken) { + config.cancelToken.unsubscribe(abort); + } + + if (config.signal) { + config.signal.removeEventListener('abort', abort); + } + + emitter.removeAllListeners(); + }; + + onDone((value, isRejected) => { + isDone = true; + if (isRejected) { + rejected = true; + onFinished(); + } + }); + + function abort(reason) { + emitter.emit('abort', !reason || reason.type ? new CanceledError(null, config, req) : reason); + } + + emitter.once('abort', reject); + + if (config.cancelToken || config.signal) { + config.cancelToken && config.cancelToken.subscribe(abort); + if (config.signal) { + config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort); + } + } + + // Parse url + const fullPath = buildFullPath(config.baseURL, config.url); + const parsed = new URL(fullPath, 'http://localhost'); + const protocol = parsed.protocol || supportedProtocols[0]; + + if (protocol === 'data:') { + let convertedData; + + if (method !== 'GET') { + return settle(resolve, reject, { + status: 405, + statusText: 'method not allowed', + headers: {}, + config + }); + } + + try { + convertedData = fromDataURI(config.url, responseType === 'blob', { + Blob: config.env && config.env.Blob + }); + } catch (err) { + throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config); + } + + if (responseType === 'text') { + convertedData = convertedData.toString(responseEncoding); + + if (!responseEncoding || responseEncoding === 'utf8') { + convertedData = utils$1.stripBOM(convertedData); + } + } else if (responseType === 'stream') { + convertedData = stream__default["default"].Readable.from(convertedData); + } + + return settle(resolve, reject, { + data: convertedData, + status: 200, + statusText: 'OK', + headers: new AxiosHeaders$1(), + config + }); + } + + if (supportedProtocols.indexOf(protocol) === -1) { + return reject(new AxiosError( + 'Unsupported protocol ' + protocol, + AxiosError.ERR_BAD_REQUEST, + config + )); + } + + const headers = AxiosHeaders$1.from(config.headers).normalize(); + + // Set User-Agent (required by some servers) + // See https://github.com/axios/axios/issues/69 + // User-Agent is specified; handle case where no UA header is desired + // Only set header if it hasn't been set in config + headers.set('User-Agent', 'axios/' + VERSION, false); + + const onDownloadProgress = config.onDownloadProgress; + const onUploadProgress = config.onUploadProgress; + const maxRate = config.maxRate; + let maxUploadRate = undefined; + let maxDownloadRate = undefined; + + // support for spec compliant FormData objects + if (utils$1.isSpecCompliantForm(data)) { + const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i); + + data = formDataToStream$1(data, (formHeaders) => { + headers.set(formHeaders); + }, { + tag: `axios-${VERSION}-boundary`, + boundary: userBoundary && userBoundary[1] || undefined + }); + // support for https://www.npmjs.com/package/form-data api + } else if (utils$1.isFormData(data) && utils$1.isFunction(data.getHeaders)) { + headers.set(data.getHeaders()); + + if (!headers.hasContentLength()) { + try { + const knownLength = await util__default["default"].promisify(data.getLength).call(data); + Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength); + /*eslint no-empty:0*/ + } catch (e) { + } + } + } else if (utils$1.isBlob(data)) { + data.size && headers.setContentType(data.type || 'application/octet-stream'); + headers.setContentLength(data.size || 0); + data = stream__default["default"].Readable.from(readBlob$1(data)); + } else if (data && !utils$1.isStream(data)) { + if (Buffer.isBuffer(data)) ; else if (utils$1.isArrayBuffer(data)) { + data = Buffer.from(new Uint8Array(data)); + } else if (utils$1.isString(data)) { + data = Buffer.from(data, 'utf-8'); + } else { + return reject(new AxiosError( + 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream', + AxiosError.ERR_BAD_REQUEST, + config + )); + } + + // Add Content-Length header if data exists + headers.setContentLength(data.length, false); + + if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) { + return reject(new AxiosError( + 'Request body larger than maxBodyLength limit', + AxiosError.ERR_BAD_REQUEST, + config + )); + } + } + + const contentLength = utils$1.toFiniteNumber(headers.getContentLength()); + + if (utils$1.isArray(maxRate)) { + maxUploadRate = maxRate[0]; + maxDownloadRate = maxRate[1]; + } else { + maxUploadRate = maxDownloadRate = maxRate; + } + + if (data && (onUploadProgress || maxUploadRate)) { + if (!utils$1.isStream(data)) { + data = stream__default["default"].Readable.from(data, {objectMode: false}); + } + + data = stream__default["default"].pipeline([data, new AxiosTransformStream$1({ + length: contentLength, + maxRate: utils$1.toFiniteNumber(maxUploadRate) + })], utils$1.noop); + + onUploadProgress && data.on('progress', progress => { + onUploadProgress(Object.assign(progress, { + upload: true + })); + }); + } + + // HTTP basic authentication + let auth = undefined; + if (config.auth) { + const username = config.auth.username || ''; + const password = config.auth.password || ''; + auth = username + ':' + password; + } + + if (!auth && parsed.username) { + const urlUsername = parsed.username; + const urlPassword = parsed.password; + auth = urlUsername + ':' + urlPassword; + } + + auth && headers.delete('authorization'); + + let path; + + try { + path = buildURL( + parsed.pathname + parsed.search, + config.params, + config.paramsSerializer + ).replace(/^\?/, ''); + } catch (err) { + const customErr = new Error(err.message); + customErr.config = config; + customErr.url = config.url; + customErr.exists = true; + return reject(customErr); + } + + headers.set( + 'Accept-Encoding', + 'gzip, compress, deflate' + (isBrotliSupported ? ', br' : ''), false + ); + + const options = { + path, + method: method, + headers: headers.toJSON(), + agents: { http: config.httpAgent, https: config.httpsAgent }, + auth, + protocol, + family, + beforeRedirect: dispatchBeforeRedirect, + beforeRedirects: {} + }; + + // cacheable-lookup integration hotfix + !utils$1.isUndefined(lookup) && (options.lookup = lookup); + + if (config.socketPath) { + options.socketPath = config.socketPath; + } else { + options.hostname = parsed.hostname; + options.port = parsed.port; + setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path); + } + + let transport; + const isHttpsRequest = isHttps.test(options.protocol); + options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent; + if (config.transport) { + transport = config.transport; + } else if (config.maxRedirects === 0) { + transport = isHttpsRequest ? https__default["default"] : http__default["default"]; + } else { + if (config.maxRedirects) { + options.maxRedirects = config.maxRedirects; + } + if (config.beforeRedirect) { + options.beforeRedirects.config = config.beforeRedirect; + } + transport = isHttpsRequest ? httpsFollow : httpFollow; + } + + if (config.maxBodyLength > -1) { + options.maxBodyLength = config.maxBodyLength; + } else { + // follow-redirects does not skip comparison, so it should always succeed for axios -1 unlimited + options.maxBodyLength = Infinity; + } + + if (config.insecureHTTPParser) { + options.insecureHTTPParser = config.insecureHTTPParser; + } + + // Create the request + req = transport.request(options, function handleResponse(res) { + if (req.destroyed) return; + + const streams = [res]; + + const responseLength = +res.headers['content-length']; + + if (onDownloadProgress) { + const transformStream = new AxiosTransformStream$1({ + length: utils$1.toFiniteNumber(responseLength), + maxRate: utils$1.toFiniteNumber(maxDownloadRate) + }); + + onDownloadProgress && transformStream.on('progress', progress => { + onDownloadProgress(Object.assign(progress, { + download: true + })); + }); + + streams.push(transformStream); + } + + // decompress the response body transparently if required + let responseStream = res; + + // return the last request in case of redirects + const lastRequest = res.req || req; + + // if decompress disabled we should not decompress + if (config.decompress !== false && res.headers['content-encoding']) { + // if no content, but headers still say that it is encoded, + // remove the header not confuse downstream operations + if (method === 'HEAD' || res.statusCode === 204) { + delete res.headers['content-encoding']; + } + + switch ((res.headers['content-encoding'] || '').toLowerCase()) { + /*eslint default-case:0*/ + case 'gzip': + case 'x-gzip': + case 'compress': + case 'x-compress': + // add the unzipper to the body stream processing pipeline + streams.push(zlib__default["default"].createUnzip(zlibOptions)); + + // remove the content-encoding in order to not confuse downstream operations + delete res.headers['content-encoding']; + break; + case 'deflate': + streams.push(new ZlibHeaderTransformStream$1()); + + // add the unzipper to the body stream processing pipeline + streams.push(zlib__default["default"].createUnzip(zlibOptions)); + + // remove the content-encoding in order to not confuse downstream operations + delete res.headers['content-encoding']; + break; + case 'br': + if (isBrotliSupported) { + streams.push(zlib__default["default"].createBrotliDecompress(brotliOptions)); + delete res.headers['content-encoding']; + } + } + } + + responseStream = streams.length > 1 ? stream__default["default"].pipeline(streams, utils$1.noop) : streams[0]; + + const offListeners = stream__default["default"].finished(responseStream, () => { + offListeners(); + onFinished(); + }); + + const response = { + status: res.statusCode, + statusText: res.statusMessage, + headers: new AxiosHeaders$1(res.headers), + config, + request: lastRequest + }; + + if (responseType === 'stream') { + response.data = responseStream; + settle(resolve, reject, response); + } else { + const responseBuffer = []; + let totalResponseBytes = 0; + + responseStream.on('data', function handleStreamData(chunk) { + responseBuffer.push(chunk); + totalResponseBytes += chunk.length; + + // make sure the content length is not over the maxContentLength if specified + if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) { + // stream.destroy() emit aborted event before calling reject() on Node.js v16 + rejected = true; + responseStream.destroy(); + reject(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded', + AxiosError.ERR_BAD_RESPONSE, config, lastRequest)); + } + }); + + responseStream.on('aborted', function handlerStreamAborted() { + if (rejected) { + return; + } + + const err = new AxiosError( + 'maxContentLength size of ' + config.maxContentLength + ' exceeded', + AxiosError.ERR_BAD_RESPONSE, + config, + lastRequest + ); + responseStream.destroy(err); + reject(err); + }); + + responseStream.on('error', function handleStreamError(err) { + if (req.destroyed) return; + reject(AxiosError.from(err, null, config, lastRequest)); + }); + + responseStream.on('end', function handleStreamEnd() { + try { + let responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer); + if (responseType !== 'arraybuffer') { + responseData = responseData.toString(responseEncoding); + if (!responseEncoding || responseEncoding === 'utf8') { + responseData = utils$1.stripBOM(responseData); + } + } + response.data = responseData; + } catch (err) { + return reject(AxiosError.from(err, null, config, response.request, response)); + } + settle(resolve, reject, response); + }); + } + + emitter.once('abort', err => { + if (!responseStream.destroyed) { + responseStream.emit('error', err); + responseStream.destroy(); + } + }); + }); + + emitter.once('abort', err => { + reject(err); + req.destroy(err); + }); + + // Handle errors + req.on('error', function handleRequestError(err) { + // @todo remove + // if (req.aborted && err.code !== AxiosError.ERR_FR_TOO_MANY_REDIRECTS) return; + reject(AxiosError.from(err, null, config, req)); + }); + + // set tcp keep alive to prevent drop connection by peer + req.on('socket', function handleRequestSocket(socket) { + // default interval of sending ack packet is 1 minute + socket.setKeepAlive(true, 1000 * 60); + }); + + // Handle request timeout + if (config.timeout) { + // This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types. + const timeout = parseInt(config.timeout, 10); + + if (Number.isNaN(timeout)) { + reject(new AxiosError( + 'error trying to parse `config.timeout` to int', + AxiosError.ERR_BAD_OPTION_VALUE, + config, + req + )); + + return; + } + + // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system. + // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET. + // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up. + // And then these socket which be hang up will devouring CPU little by little. + // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect. + req.setTimeout(timeout, function handleRequestTimeout() { + if (isDone) return; + let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded'; + const transitional = config.transitional || transitionalDefaults; + if (config.timeoutErrorMessage) { + timeoutErrorMessage = config.timeoutErrorMessage; + } + reject(new AxiosError( + timeoutErrorMessage, + transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, + config, + req + )); + abort(); + }); + } + + + // Send the request + if (utils$1.isStream(data)) { + let ended = false; + let errored = false; + + data.on('end', () => { + ended = true; + }); + + data.once('error', err => { + errored = true; + req.destroy(err); + }); + + data.on('close', () => { + if (!ended && !errored) { + abort(new CanceledError('Request stream has been aborted', config, req)); + } + }); + + data.pipe(req); + } else { + req.end(data); + } + }); +}; + +const progressEventReducer = (listener, isDownloadStream, freq = 3) => { + let bytesNotified = 0; + const _speedometer = speedometer(50, 250); + + return throttle(e => { + const loaded = e.loaded; + const total = e.lengthComputable ? e.total : undefined; + const progressBytes = loaded - bytesNotified; + const rate = _speedometer(progressBytes); + const inRange = loaded <= total; + + bytesNotified = loaded; + + const data = { + loaded, + total, + progress: total ? (loaded / total) : undefined, + bytes: progressBytes, + rate: rate ? rate : undefined, + estimated: rate && total && inRange ? (total - loaded) / rate : undefined, + event: e, + lengthComputable: total != null + }; + + data[isDownloadStream ? 'download' : 'upload'] = true; + + listener(data); + }, freq); +}; + +const isURLSameOrigin = platform.hasStandardBrowserEnv ? + +// Standard browser envs have full support of the APIs needed to test +// whether the request URL is of the same origin as current location. + (function standardBrowserEnv() { + const msie = /(msie|trident)/i.test(navigator.userAgent); + const urlParsingNode = document.createElement('a'); + let originURL; + + /** + * Parse a URL to discover its components + * + * @param {String} url The URL to be parsed + * @returns {Object} + */ + function resolveURL(url) { + let href = url; + + if (msie) { + // IE needs attribute set twice to normalize properties + urlParsingNode.setAttribute('href', href); + href = urlParsingNode.href; + } + + urlParsingNode.setAttribute('href', href); + + // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: (urlParsingNode.pathname.charAt(0) === '/') ? + urlParsingNode.pathname : + '/' + urlParsingNode.pathname + }; + } + + originURL = resolveURL(window.location.href); + + /** + * Determine if a URL shares the same origin as the current location + * + * @param {String} requestURL The URL to test + * @returns {boolean} True if URL shares the same origin, otherwise false + */ + return function isURLSameOrigin(requestURL) { + const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL; + return (parsed.protocol === originURL.protocol && + parsed.host === originURL.host); + }; + })() : + + // Non standard browser envs (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return function isURLSameOrigin() { + return true; + }; + })(); + +const cookies = platform.hasStandardBrowserEnv ? + + // Standard browser envs support document.cookie + { + write(name, value, expires, path, domain, secure) { + const cookie = [name + '=' + encodeURIComponent(value)]; + + utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString()); + + utils$1.isString(path) && cookie.push('path=' + path); + + utils$1.isString(domain) && cookie.push('domain=' + domain); + + secure === true && cookie.push('secure'); + + document.cookie = cookie.join('; '); + }, + + read(name) { + const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); + return (match ? decodeURIComponent(match[3]) : null); + }, + + remove(name) { + this.write(name, '', Date.now() - 86400000); + } + } + + : + + // Non-standard browser env (web workers, react-native) lack needed support. + { + write() {}, + read() { + return null; + }, + remove() {} + }; + +const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing; + +/** + * Config-specific merge-function which creates a new config-object + * by merging two configuration objects together. + * + * @param {Object} config1 + * @param {Object} config2 + * + * @returns {Object} New object resulting from merging config2 to config1 + */ +function mergeConfig(config1, config2) { + // eslint-disable-next-line no-param-reassign + config2 = config2 || {}; + const config = {}; + + function getMergedValue(target, source, caseless) { + if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) { + return utils$1.merge.call({caseless}, target, source); + } else if (utils$1.isPlainObject(source)) { + return utils$1.merge({}, source); + } else if (utils$1.isArray(source)) { + return source.slice(); + } + return source; + } + + // eslint-disable-next-line consistent-return + function mergeDeepProperties(a, b, caseless) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(a, b, caseless); + } else if (!utils$1.isUndefined(a)) { + return getMergedValue(undefined, a, caseless); + } + } + + // eslint-disable-next-line consistent-return + function valueFromConfig2(a, b) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(undefined, b); + } + } + + // eslint-disable-next-line consistent-return + function defaultToConfig2(a, b) { + if (!utils$1.isUndefined(b)) { + return getMergedValue(undefined, b); + } else if (!utils$1.isUndefined(a)) { + return getMergedValue(undefined, a); + } + } + + // eslint-disable-next-line consistent-return + function mergeDirectKeys(a, b, prop) { + if (prop in config2) { + return getMergedValue(a, b); + } else if (prop in config1) { + return getMergedValue(undefined, a); + } + } + + const mergeMap = { + url: valueFromConfig2, + method: valueFromConfig2, + data: valueFromConfig2, + baseURL: defaultToConfig2, + transformRequest: defaultToConfig2, + transformResponse: defaultToConfig2, + paramsSerializer: defaultToConfig2, + timeout: defaultToConfig2, + timeoutMessage: defaultToConfig2, + withCredentials: defaultToConfig2, + withXSRFToken: defaultToConfig2, + adapter: defaultToConfig2, + responseType: defaultToConfig2, + xsrfCookieName: defaultToConfig2, + xsrfHeaderName: defaultToConfig2, + onUploadProgress: defaultToConfig2, + onDownloadProgress: defaultToConfig2, + decompress: defaultToConfig2, + maxContentLength: defaultToConfig2, + maxBodyLength: defaultToConfig2, + beforeRedirect: defaultToConfig2, + transport: defaultToConfig2, + httpAgent: defaultToConfig2, + httpsAgent: defaultToConfig2, + cancelToken: defaultToConfig2, + socketPath: defaultToConfig2, + responseEncoding: defaultToConfig2, + validateStatus: mergeDirectKeys, + headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true) + }; + + utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) { + const merge = mergeMap[prop] || mergeDeepProperties; + const configValue = merge(config1[prop], config2[prop], prop); + (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue); + }); + + return config; +} + +const resolveConfig = (config) => { + const newConfig = mergeConfig({}, config); + + let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig; + + newConfig.headers = headers = AxiosHeaders$1.from(headers); + + newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer); + + // HTTP basic authentication + if (auth) { + headers.set('Authorization', 'Basic ' + + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')) + ); + } + + let contentType; + + if (utils$1.isFormData(data)) { + if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) { + headers.setContentType(undefined); // Let the browser set it + } else if ((contentType = headers.getContentType()) !== false) { + // fix semicolon duplication issue for ReactNative FormData implementation + const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : []; + headers.setContentType([type || 'multipart/form-data', ...tokens].join('; ')); + } + } + + // Add xsrf header + // This is only done if running in a standard browser environment. + // Specifically not if we're in a web worker, or react-native. + + if (platform.hasStandardBrowserEnv) { + withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig)); + + if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) { + // Add xsrf header + const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName); + + if (xsrfValue) { + headers.set(xsrfHeaderName, xsrfValue); + } + } + } + + return newConfig; +}; + +const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined'; + +const xhrAdapter = isXHRAdapterSupported && function (config) { + return new Promise(function dispatchXhrRequest(resolve, reject) { + const _config = resolveConfig(config); + let requestData = _config.data; + const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize(); + let {responseType} = _config; + let onCanceled; + function done() { + if (_config.cancelToken) { + _config.cancelToken.unsubscribe(onCanceled); + } + + if (_config.signal) { + _config.signal.removeEventListener('abort', onCanceled); + } + } + + let request = new XMLHttpRequest(); + + request.open(_config.method.toUpperCase(), _config.url, true); + + // Set the request timeout in MS + request.timeout = _config.timeout; + + function onloadend() { + if (!request) { + return; + } + // Prepare the response + const responseHeaders = AxiosHeaders$1.from( + 'getAllResponseHeaders' in request && request.getAllResponseHeaders() + ); + const responseData = !responseType || responseType === 'text' || responseType === 'json' ? + request.responseText : request.response; + const response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config, + request + }; + + settle(function _resolve(value) { + resolve(value); + done(); + }, function _reject(err) { + reject(err); + done(); + }, response); + + // Clean up request + request = null; + } + + if ('onloadend' in request) { + // Use onloadend if available + request.onloadend = onloadend; + } else { + // Listen for ready state to emulate onloadend + request.onreadystatechange = function handleLoad() { + if (!request || request.readyState !== 4) { + return; + } + + // The request errored out and we didn't get a response, this will be + // handled by onerror instead + // With one exception: request that using file: protocol, most browsers + // will return status as 0 even though it's a successful request + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { + return; + } + // readystate handler is calling before onerror or ontimeout handlers, + // so we should call onloadend on the next 'tick' + setTimeout(onloadend); + }; + } + + // Handle browser request cancellation (as opposed to a manual cancellation) + request.onabort = function handleAbort() { + if (!request) { + return; + } + + reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, _config, request)); + + // Clean up request + request = null; + }; + + // Handle low level network errors + request.onerror = function handleError() { + // Real errors are hidden from us by the browser + // onerror should only fire if it's a network error + reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, _config, request)); + + // Clean up request + request = null; + }; + + // Handle timeout + request.ontimeout = function handleTimeout() { + let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded'; + const transitional = _config.transitional || transitionalDefaults; + if (_config.timeoutErrorMessage) { + timeoutErrorMessage = _config.timeoutErrorMessage; + } + reject(new AxiosError( + timeoutErrorMessage, + transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, + _config, + request)); + + // Clean up request + request = null; + }; + + // Remove Content-Type if data is undefined + requestData === undefined && requestHeaders.setContentType(null); + + // Add headers to the request + if ('setRequestHeader' in request) { + utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) { + request.setRequestHeader(key, val); + }); + } + + // Add withCredentials to request if needed + if (!utils$1.isUndefined(_config.withCredentials)) { + request.withCredentials = !!_config.withCredentials; + } + + // Add responseType to request if needed + if (responseType && responseType !== 'json') { + request.responseType = _config.responseType; + } + + // Handle progress if needed + if (typeof _config.onDownloadProgress === 'function') { + request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true)); + } + + // Not all browsers support upload events + if (typeof _config.onUploadProgress === 'function' && request.upload) { + request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress)); + } + + if (_config.cancelToken || _config.signal) { + // Handle cancellation + // eslint-disable-next-line func-names + onCanceled = cancel => { + if (!request) { + return; + } + reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel); + request.abort(); + request = null; + }; + + _config.cancelToken && _config.cancelToken.subscribe(onCanceled); + if (_config.signal) { + _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled); + } + } + + const protocol = parseProtocol(_config.url); + + if (protocol && platform.protocols.indexOf(protocol) === -1) { + reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config)); + return; + } + + + // Send the request + request.send(requestData || null); + }); +}; + +const composeSignals = (signals, timeout) => { + let controller = new AbortController(); + + let aborted; + + const onabort = function (cancel) { + if (!aborted) { + aborted = true; + unsubscribe(); + const err = cancel instanceof Error ? cancel : this.reason; + controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err)); + } + }; + + let timer = timeout && setTimeout(() => { + onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT)); + }, timeout); + + const unsubscribe = () => { + if (signals) { + timer && clearTimeout(timer); + timer = null; + signals.forEach(signal => { + signal && + (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort)); + }); + signals = null; + } + }; + + signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort)); + + const {signal} = controller; + + signal.unsubscribe = unsubscribe; + + return [signal, () => { + timer && clearTimeout(timer); + timer = null; + }]; +}; + +const composeSignals$1 = composeSignals; + +const streamChunk = function* (chunk, chunkSize) { + let len = chunk.byteLength; + + if (!chunkSize || len < chunkSize) { + yield chunk; + return; + } + + let pos = 0; + let end; + + while (pos < len) { + end = pos + chunkSize; + yield chunk.slice(pos, end); + pos = end; + } +}; + +const readBytes = async function* (iterable, chunkSize, encode) { + for await (const chunk of iterable) { + yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize); + } +}; + +const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => { + const iterator = readBytes(stream, chunkSize, encode); + + let bytes = 0; + + return new ReadableStream({ + type: 'bytes', + + async pull(controller) { + const {done, value} = await iterator.next(); + + if (done) { + controller.close(); + onFinish(); + return; + } + + let len = value.byteLength; + onProgress && onProgress(bytes += len); + controller.enqueue(new Uint8Array(value)); + }, + cancel(reason) { + onFinish(reason); + return iterator.return(); + } + }, { + highWaterMark: 2 + }) +}; + +const fetchProgressDecorator = (total, fn) => { + const lengthComputable = total != null; + return (loaded) => setTimeout(() => fn({ + lengthComputable, + total, + loaded + })); +}; + +const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function'; +const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function'; + +// used only inside the fetch adapter +const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? + ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : + async (str) => new Uint8Array(await new Response(str).arrayBuffer()) +); + +const supportsRequestStream = isReadableStreamSupported && (() => { + let duplexAccessed = false; + + const hasContentType = new Request(platform.origin, { + body: new ReadableStream(), + method: 'POST', + get duplex() { + duplexAccessed = true; + return 'half'; + }, + }).headers.has('Content-Type'); + + return duplexAccessed && !hasContentType; +})(); + +const DEFAULT_CHUNK_SIZE = 64 * 1024; + +const supportsResponseStream = isReadableStreamSupported && !!(()=> { + try { + return utils$1.isReadableStream(new Response('').body); + } catch(err) { + // return undefined + } +})(); + +const resolvers = { + stream: supportsResponseStream && ((res) => res.body) +}; + +isFetchSupported && (((res) => { + ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => { + !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() : + (_, config) => { + throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config); + }); + }); +})(new Response)); + +const getBodyLength = async (body) => { + if (body == null) { + return 0; + } + + if(utils$1.isBlob(body)) { + return body.size; + } + + if(utils$1.isSpecCompliantForm(body)) { + return (await new Request(body).arrayBuffer()).byteLength; + } + + if(utils$1.isArrayBufferView(body)) { + return body.byteLength; + } + + if(utils$1.isURLSearchParams(body)) { + body = body + ''; + } + + if(utils$1.isString(body)) { + return (await encodeText(body)).byteLength; + } +}; + +const resolveBodyLength = async (headers, body) => { + const length = utils$1.toFiniteNumber(headers.getContentLength()); + + return length == null ? getBodyLength(body) : length; +}; + +const fetchAdapter = isFetchSupported && (async (config) => { + let { + url, + method, + data, + signal, + cancelToken, + timeout, + onDownloadProgress, + onUploadProgress, + responseType, + headers, + withCredentials = 'same-origin', + fetchOptions + } = resolveConfig(config); + + responseType = responseType ? (responseType + '').toLowerCase() : 'text'; + + let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ? + composeSignals$1([signal, cancelToken], timeout) : []; + + let finished, request; + + const onFinish = () => { + !finished && setTimeout(() => { + composedSignal && composedSignal.unsubscribe(); + }); + + finished = true; + }; + + let requestContentLength; + + try { + if ( + onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' && + (requestContentLength = await resolveBodyLength(headers, data)) !== 0 + ) { + let _request = new Request(url, { + method: 'POST', + body: data, + duplex: "half" + }); + + let contentTypeHeader; + + if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) { + headers.setContentType(contentTypeHeader); + } + + if (_request.body) { + data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator( + requestContentLength, + progressEventReducer(onUploadProgress) + ), null, encodeText); + } + } + + if (!utils$1.isString(withCredentials)) { + withCredentials = withCredentials ? 'cors' : 'omit'; + } + + request = new Request(url, { + ...fetchOptions, + signal: composedSignal, + method: method.toUpperCase(), + headers: headers.normalize().toJSON(), + body: data, + duplex: "half", + withCredentials + }); + + let response = await fetch(request); + + const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response'); + + if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) { + const options = {}; + + ['status', 'statusText', 'headers'].forEach(prop => { + options[prop] = response[prop]; + }); + + const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length')); + + response = new Response( + trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator( + responseContentLength, + progressEventReducer(onDownloadProgress, true) + ), isStreamResponse && onFinish, encodeText), + options + ); + } + + responseType = responseType || 'text'; + + let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config); + + !isStreamResponse && onFinish(); + + stopTimeout && stopTimeout(); + + return await new Promise((resolve, reject) => { + settle(resolve, reject, { + data: responseData, + headers: AxiosHeaders$1.from(response.headers), + status: response.status, + statusText: response.statusText, + config, + request + }); + }) + } catch (err) { + onFinish(); + + if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) { + throw Object.assign( + new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), + { + cause: err.cause || err + } + ) + } + + throw AxiosError.from(err, err && err.code, config, request); + } +}); + +const knownAdapters = { + http: httpAdapter, + xhr: xhrAdapter, + fetch: fetchAdapter +}; + +utils$1.forEach(knownAdapters, (fn, value) => { + if (fn) { + try { + Object.defineProperty(fn, 'name', {value}); + } catch (e) { + // eslint-disable-next-line no-empty + } + Object.defineProperty(fn, 'adapterName', {value}); + } +}); + +const renderReason = (reason) => `- ${reason}`; + +const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false; + +const adapters = { + getAdapter: (adapters) => { + adapters = utils$1.isArray(adapters) ? adapters : [adapters]; + + const {length} = adapters; + let nameOrAdapter; + let adapter; + + const rejectedReasons = {}; + + for (let i = 0; i < length; i++) { + nameOrAdapter = adapters[i]; + let id; + + adapter = nameOrAdapter; + + if (!isResolvedHandle(nameOrAdapter)) { + adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()]; + + if (adapter === undefined) { + throw new AxiosError(`Unknown adapter '${id}'`); + } + } + + if (adapter) { + break; + } + + rejectedReasons[id || '#' + i] = adapter; + } + + if (!adapter) { + + const reasons = Object.entries(rejectedReasons) + .map(([id, state]) => `adapter ${id} ` + + (state === false ? 'is not supported by the environment' : 'is not available in the build') + ); + + let s = length ? + (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) : + 'as no adapter specified'; + + throw new AxiosError( + `There is no suitable adapter to dispatch the request ` + s, + 'ERR_NOT_SUPPORT' + ); + } + + return adapter; + }, + adapters: knownAdapters +}; + +/** + * Throws a `CanceledError` if cancellation has been requested. + * + * @param {Object} config The config that is to be used for the request + * + * @returns {void} + */ +function throwIfCancellationRequested(config) { + if (config.cancelToken) { + config.cancelToken.throwIfRequested(); + } + + if (config.signal && config.signal.aborted) { + throw new CanceledError(null, config); + } +} + +/** + * Dispatch a request to the server using the configured adapter. + * + * @param {object} config The config that is to be used for the request + * + * @returns {Promise} The Promise to be fulfilled + */ +function dispatchRequest(config) { + throwIfCancellationRequested(config); + + config.headers = AxiosHeaders$1.from(config.headers); + + // Transform request data + config.data = transformData.call( + config, + config.transformRequest + ); + + if (['post', 'put', 'patch'].indexOf(config.method) !== -1) { + config.headers.setContentType('application/x-www-form-urlencoded', false); + } + + const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter); + + return adapter(config).then(function onAdapterResolution(response) { + throwIfCancellationRequested(config); + + // Transform response data + response.data = transformData.call( + config, + config.transformResponse, + response + ); + + response.headers = AxiosHeaders$1.from(response.headers); + + return response; + }, function onAdapterRejection(reason) { + if (!isCancel(reason)) { + throwIfCancellationRequested(config); + + // Transform response data + if (reason && reason.response) { + reason.response.data = transformData.call( + config, + config.transformResponse, + reason.response + ); + reason.response.headers = AxiosHeaders$1.from(reason.response.headers); + } + } + + return Promise.reject(reason); + }); +} + +const validators$1 = {}; + +// eslint-disable-next-line func-names +['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => { + validators$1[type] = function validator(thing) { + return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type; + }; +}); + +const deprecatedWarnings = {}; + +/** + * Transitional option validator + * + * @param {function|boolean?} validator - set to false if the transitional option has been removed + * @param {string?} version - deprecated version / removed since version + * @param {string?} message - some message with additional info + * + * @returns {function} + */ +validators$1.transitional = function transitional(validator, version, message) { + function formatMessage(opt, desc) { + return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); + } + + // eslint-disable-next-line func-names + return (value, opt, opts) => { + if (validator === false) { + throw new AxiosError( + formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), + AxiosError.ERR_DEPRECATED + ); + } + + if (version && !deprecatedWarnings[opt]) { + deprecatedWarnings[opt] = true; + // eslint-disable-next-line no-console + console.warn( + formatMessage( + opt, + ' has been deprecated since v' + version + ' and will be removed in the near future' + ) + ); + } + + return validator ? validator(value, opt, opts) : true; + }; +}; + +/** + * Assert object's properties type + * + * @param {object} options + * @param {object} schema + * @param {boolean?} allowUnknown + * + * @returns {object} + */ + +function assertOptions(options, schema, allowUnknown) { + if (typeof options !== 'object') { + throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE); + } + const keys = Object.keys(options); + let i = keys.length; + while (i-- > 0) { + const opt = keys[i]; + const validator = schema[opt]; + if (validator) { + const value = options[opt]; + const result = value === undefined || validator(value, opt, options); + if (result !== true) { + throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE); + } + continue; + } + if (allowUnknown !== true) { + throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION); + } + } +} + +const validator = { + assertOptions, + validators: validators$1 +}; + +const validators = validator.validators; + +/** + * Create a new instance of Axios + * + * @param {Object} instanceConfig The default config for the instance + * + * @return {Axios} A new instance of Axios + */ +class Axios { + constructor(instanceConfig) { + this.defaults = instanceConfig; + this.interceptors = { + request: new InterceptorManager$1(), + response: new InterceptorManager$1() + }; + } + + /** + * Dispatch a request + * + * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults) + * @param {?Object} config + * + * @returns {Promise} The Promise to be fulfilled + */ + async request(configOrUrl, config) { + try { + return await this._request(configOrUrl, config); + } catch (err) { + if (err instanceof Error) { + let dummy; + + Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error()); + + // slice off the Error: ... line + const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : ''; + try { + if (!err.stack) { + err.stack = stack; + // match without the 2 top stack lines + } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) { + err.stack += '\n' + stack; + } + } catch (e) { + // ignore the case where "stack" is an un-writable property + } + } + + throw err; + } + } + + _request(configOrUrl, config) { + /*eslint no-param-reassign:0*/ + // Allow for axios('example/url'[, config]) a la fetch API + if (typeof configOrUrl === 'string') { + config = config || {}; + config.url = configOrUrl; + } else { + config = configOrUrl || {}; + } + + config = mergeConfig(this.defaults, config); + + const {transitional, paramsSerializer, headers} = config; + + if (transitional !== undefined) { + validator.assertOptions(transitional, { + silentJSONParsing: validators.transitional(validators.boolean), + forcedJSONParsing: validators.transitional(validators.boolean), + clarifyTimeoutError: validators.transitional(validators.boolean) + }, false); + } + + if (paramsSerializer != null) { + if (utils$1.isFunction(paramsSerializer)) { + config.paramsSerializer = { + serialize: paramsSerializer + }; + } else { + validator.assertOptions(paramsSerializer, { + encode: validators.function, + serialize: validators.function + }, true); + } + } + + // Set config.method + config.method = (config.method || this.defaults.method || 'get').toLowerCase(); + + // Flatten headers + let contextHeaders = headers && utils$1.merge( + headers.common, + headers[config.method] + ); + + headers && utils$1.forEach( + ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], + (method) => { + delete headers[method]; + } + ); + + config.headers = AxiosHeaders$1.concat(contextHeaders, headers); + + // filter out skipped interceptors + const requestInterceptorChain = []; + let synchronousRequestInterceptors = true; + this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { + if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { + return; + } + + synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; + + requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); + }); + + const responseInterceptorChain = []; + this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { + responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); + }); + + let promise; + let i = 0; + let len; + + if (!synchronousRequestInterceptors) { + const chain = [dispatchRequest.bind(this), undefined]; + chain.unshift.apply(chain, requestInterceptorChain); + chain.push.apply(chain, responseInterceptorChain); + len = chain.length; + + promise = Promise.resolve(config); + + while (i < len) { + promise = promise.then(chain[i++], chain[i++]); + } + + return promise; + } + + len = requestInterceptorChain.length; + + let newConfig = config; + + i = 0; + + while (i < len) { + const onFulfilled = requestInterceptorChain[i++]; + const onRejected = requestInterceptorChain[i++]; + try { + newConfig = onFulfilled(newConfig); + } catch (error) { + onRejected.call(this, error); + break; + } + } + + try { + promise = dispatchRequest.call(this, newConfig); + } catch (error) { + return Promise.reject(error); + } + + i = 0; + len = responseInterceptorChain.length; + + while (i < len) { + promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]); + } + + return promise; + } + + getUri(config) { + config = mergeConfig(this.defaults, config); + const fullPath = buildFullPath(config.baseURL, config.url); + return buildURL(fullPath, config.params, config.paramsSerializer); + } +} + +// Provide aliases for supported request methods +utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function(url, config) { + return this.request(mergeConfig(config || {}, { + method, + url, + data: (config || {}).data + })); + }; +}); + +utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + /*eslint func-names:0*/ + + function generateHTTPMethod(isForm) { + return function httpMethod(url, data, config) { + return this.request(mergeConfig(config || {}, { + method, + headers: isForm ? { + 'Content-Type': 'multipart/form-data' + } : {}, + url, + data + })); + }; + } + + Axios.prototype[method] = generateHTTPMethod(); + + Axios.prototype[method + 'Form'] = generateHTTPMethod(true); +}); + +const Axios$1 = Axios; + +/** + * A `CancelToken` is an object that can be used to request cancellation of an operation. + * + * @param {Function} executor The executor function. + * + * @returns {CancelToken} + */ +class CancelToken { + constructor(executor) { + if (typeof executor !== 'function') { + throw new TypeError('executor must be a function.'); + } + + let resolvePromise; + + this.promise = new Promise(function promiseExecutor(resolve) { + resolvePromise = resolve; + }); + + const token = this; + + // eslint-disable-next-line func-names + this.promise.then(cancel => { + if (!token._listeners) return; + + let i = token._listeners.length; + + while (i-- > 0) { + token._listeners[i](cancel); + } + token._listeners = null; + }); + + // eslint-disable-next-line func-names + this.promise.then = onfulfilled => { + let _resolve; + // eslint-disable-next-line func-names + const promise = new Promise(resolve => { + token.subscribe(resolve); + _resolve = resolve; + }).then(onfulfilled); + + promise.cancel = function reject() { + token.unsubscribe(_resolve); + }; + + return promise; + }; + + executor(function cancel(message, config, request) { + if (token.reason) { + // Cancellation has already been requested + return; + } + + token.reason = new CanceledError(message, config, request); + resolvePromise(token.reason); + }); + } + + /** + * Throws a `CanceledError` if cancellation has been requested. + */ + throwIfRequested() { + if (this.reason) { + throw this.reason; + } + } + + /** + * Subscribe to the cancel signal + */ + + subscribe(listener) { + if (this.reason) { + listener(this.reason); + return; + } + + if (this._listeners) { + this._listeners.push(listener); + } else { + this._listeners = [listener]; + } + } + + /** + * Unsubscribe from the cancel signal + */ + + unsubscribe(listener) { + if (!this._listeners) { + return; + } + const index = this._listeners.indexOf(listener); + if (index !== -1) { + this._listeners.splice(index, 1); + } + } + + /** + * Returns an object that contains a new `CancelToken` and a function that, when called, + * cancels the `CancelToken`. + */ + static source() { + let cancel; + const token = new CancelToken(function executor(c) { + cancel = c; + }); + return { + token, + cancel + }; + } +} + +const CancelToken$1 = CancelToken; + +/** + * Syntactic sugar for invoking a function and expanding an array for arguments. + * + * Common use case would be to use `Function.prototype.apply`. + * + * ```js + * function f(x, y, z) {} + * var args = [1, 2, 3]; + * f.apply(null, args); + * ``` + * + * With `spread` this example can be re-written. + * + * ```js + * spread(function(x, y, z) {})([1, 2, 3]); + * ``` + * + * @param {Function} callback + * + * @returns {Function} + */ +function spread(callback) { + return function wrap(arr) { + return callback.apply(null, arr); + }; +} + +/** + * Determines whether the payload is an error thrown by Axios + * + * @param {*} payload The value to test + * + * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false + */ +function isAxiosError(payload) { + return utils$1.isObject(payload) && (payload.isAxiosError === true); +} + +const HttpStatusCode = { + Continue: 100, + SwitchingProtocols: 101, + Processing: 102, + EarlyHints: 103, + Ok: 200, + Created: 201, + Accepted: 202, + NonAuthoritativeInformation: 203, + NoContent: 204, + ResetContent: 205, + PartialContent: 206, + MultiStatus: 207, + AlreadyReported: 208, + ImUsed: 226, + MultipleChoices: 300, + MovedPermanently: 301, + Found: 302, + SeeOther: 303, + NotModified: 304, + UseProxy: 305, + Unused: 306, + TemporaryRedirect: 307, + PermanentRedirect: 308, + BadRequest: 400, + Unauthorized: 401, + PaymentRequired: 402, + Forbidden: 403, + NotFound: 404, + MethodNotAllowed: 405, + NotAcceptable: 406, + ProxyAuthenticationRequired: 407, + RequestTimeout: 408, + Conflict: 409, + Gone: 410, + LengthRequired: 411, + PreconditionFailed: 412, + PayloadTooLarge: 413, + UriTooLong: 414, + UnsupportedMediaType: 415, + RangeNotSatisfiable: 416, + ExpectationFailed: 417, + ImATeapot: 418, + MisdirectedRequest: 421, + UnprocessableEntity: 422, + Locked: 423, + FailedDependency: 424, + TooEarly: 425, + UpgradeRequired: 426, + PreconditionRequired: 428, + TooManyRequests: 429, + RequestHeaderFieldsTooLarge: 431, + UnavailableForLegalReasons: 451, + InternalServerError: 500, + NotImplemented: 501, + BadGateway: 502, + ServiceUnavailable: 503, + GatewayTimeout: 504, + HttpVersionNotSupported: 505, + VariantAlsoNegotiates: 506, + InsufficientStorage: 507, + LoopDetected: 508, + NotExtended: 510, + NetworkAuthenticationRequired: 511, +}; + +Object.entries(HttpStatusCode).forEach(([key, value]) => { + HttpStatusCode[value] = key; +}); + +const HttpStatusCode$1 = HttpStatusCode; + +/** + * Create an instance of Axios + * + * @param {Object} defaultConfig The default config for the instance + * + * @returns {Axios} A new instance of Axios + */ +function createInstance(defaultConfig) { + const context = new Axios$1(defaultConfig); + const instance = bind(Axios$1.prototype.request, context); + + // Copy axios.prototype to instance + utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true}); + + // Copy context to instance + utils$1.extend(instance, context, null, {allOwnKeys: true}); + + // Factory for creating new instances + instance.create = function create(instanceConfig) { + return createInstance(mergeConfig(defaultConfig, instanceConfig)); + }; + + return instance; +} + +// Create the default instance to be exported +const axios = createInstance(defaults$1); + +// Expose Axios class to allow class inheritance +axios.Axios = Axios$1; + +// Expose Cancel & CancelToken +axios.CanceledError = CanceledError; +axios.CancelToken = CancelToken$1; +axios.isCancel = isCancel; +axios.VERSION = VERSION; +axios.toFormData = toFormData; + +// Expose AxiosError class +axios.AxiosError = AxiosError; + +// alias for CanceledError for backward compatibility +axios.Cancel = axios.CanceledError; + +// Expose all/spread +axios.all = function all(promises) { + return Promise.all(promises); +}; + +axios.spread = spread; + +// Expose isAxiosError +axios.isAxiosError = isAxiosError; + +// Expose mergeConfig +axios.mergeConfig = mergeConfig; + +axios.AxiosHeaders = AxiosHeaders$1; + +axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing); + +axios.getAdapter = adapters.getAdapter; + +axios.HttpStatusCode = HttpStatusCode$1; + +axios.default = axios; + +module.exports = axios; +//# sourceMappingURL=axios.cjs.map diff --git a/project starter code/node_modules/axios/dist/node/axios.cjs.map b/project starter code/node_modules/axios/dist/node/axios.cjs.map new file mode 100644 index 00000000..825edd67 --- /dev/null +++ b/project starter code/node_modules/axios/dist/node/axios.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"axios.cjs","sources":["../../lib/helpers/bind.js","../../lib/utils.js","../../lib/core/AxiosError.js","../../lib/helpers/toFormData.js","../../lib/helpers/AxiosURLSearchParams.js","../../lib/helpers/buildURL.js","../../lib/core/InterceptorManager.js","../../lib/defaults/transitional.js","../../lib/platform/node/classes/URLSearchParams.js","../../lib/platform/node/index.js","../../lib/platform/common/utils.js","../../lib/platform/index.js","../../lib/helpers/toURLEncodedForm.js","../../lib/helpers/formDataToJSON.js","../../lib/defaults/index.js","../../lib/helpers/parseHeaders.js","../../lib/core/AxiosHeaders.js","../../lib/core/transformData.js","../../lib/cancel/isCancel.js","../../lib/cancel/CanceledError.js","../../lib/core/settle.js","../../lib/helpers/isAbsoluteURL.js","../../lib/helpers/combineURLs.js","../../lib/core/buildFullPath.js","../../lib/env/data.js","../../lib/helpers/parseProtocol.js","../../lib/helpers/fromDataURI.js","../../lib/helpers/throttle.js","../../lib/helpers/speedometer.js","../../lib/helpers/AxiosTransformStream.js","../../lib/helpers/readBlob.js","../../lib/helpers/formDataToStream.js","../../lib/helpers/ZlibHeaderTransformStream.js","../../lib/helpers/callbackify.js","../../lib/adapters/http.js","../../lib/helpers/progressEventReducer.js","../../lib/helpers/isURLSameOrigin.js","../../lib/helpers/cookies.js","../../lib/core/mergeConfig.js","../../lib/helpers/resolveConfig.js","../../lib/adapters/xhr.js","../../lib/helpers/composeSignals.js","../../lib/helpers/trackStream.js","../../lib/adapters/fetch.js","../../lib/adapters/adapters.js","../../lib/core/dispatchRequest.js","../../lib/helpers/validator.js","../../lib/core/Axios.js","../../lib/cancel/CancelToken.js","../../lib/helpers/spread.js","../../lib/helpers/isAxiosError.js","../../lib/helpers/HttpStatusCode.js","../../lib/axios.js"],"sourcesContent":["'use strict';\n\nexport default function bind(fn, thisArg) {\n return function wrap() {\n return fn.apply(thisArg, arguments);\n };\n}\n","'use strict';\n\nimport bind from './helpers/bind.js';\n\n// utils is a library of generic helper functions non-specific to axios\n\nconst {toString} = Object.prototype;\nconst {getPrototypeOf} = Object;\n\nconst kindOf = (cache => thing => {\n const str = toString.call(thing);\n return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());\n})(Object.create(null));\n\nconst kindOfTest = (type) => {\n type = type.toLowerCase();\n return (thing) => kindOf(thing) === type\n}\n\nconst typeOfTest = type => thing => typeof thing === type;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n *\n * @returns {boolean} True if value is an Array, otherwise false\n */\nconst {isArray} = Array;\n\n/**\n * Determine if a value is undefined\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nconst isUndefined = typeOfTest('undefined');\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nconst isArrayBuffer = kindOfTest('ArrayBuffer');\n\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n let result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a String, otherwise false\n */\nconst isString = typeOfTest('string');\n\n/**\n * Determine if a value is a Function\n *\n * @param {*} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nconst isFunction = typeOfTest('function');\n\n/**\n * Determine if a value is a Number\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Number, otherwise false\n */\nconst isNumber = typeOfTest('number');\n\n/**\n * Determine if a value is an Object\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an Object, otherwise false\n */\nconst isObject = (thing) => thing !== null && typeof thing === 'object';\n\n/**\n * Determine if a value is a Boolean\n *\n * @param {*} thing The value to test\n * @returns {boolean} True if value is a Boolean, otherwise false\n */\nconst isBoolean = thing => thing === true || thing === false;\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a plain Object, otherwise false\n */\nconst isPlainObject = (val) => {\n if (kindOf(val) !== 'object') {\n return false;\n }\n\n const prototype = getPrototypeOf(val);\n return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Date, otherwise false\n */\nconst isDate = kindOfTest('Date');\n\n/**\n * Determine if a value is a File\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFile = kindOfTest('File');\n\n/**\n * Determine if a value is a Blob\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nconst isBlob = kindOfTest('Blob');\n\n/**\n * Determine if a value is a FileList\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFileList = kindOfTest('FileList');\n\n/**\n * Determine if a value is a Stream\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nconst isStream = (val) => isObject(val) && isFunction(val.pipe);\n\n/**\n * Determine if a value is a FormData\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nconst isFormData = (thing) => {\n let kind;\n return thing && (\n (typeof FormData === 'function' && thing instanceof FormData) || (\n isFunction(thing.append) && (\n (kind = kindOf(thing)) === 'formdata' ||\n // detect form-data instance\n (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')\n )\n )\n )\n}\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nconst isURLSearchParams = kindOfTest('URLSearchParams');\n\nconst [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n *\n * @returns {String} The String freed of excess whitespace\n */\nconst trim = (str) => str.trim ?\n str.trim() : str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n *\n * @param {Boolean} [allOwnKeys = false]\n * @returns {any}\n */\nfunction forEach(obj, fn, {allOwnKeys = false} = {}) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n let i;\n let l;\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);\n const len = keys.length;\n let key;\n\n for (i = 0; i < len; i++) {\n key = keys[i];\n fn.call(null, obj[key], key, obj);\n }\n }\n}\n\nfunction findKey(obj, key) {\n key = key.toLowerCase();\n const keys = Object.keys(obj);\n let i = keys.length;\n let _key;\n while (i-- > 0) {\n _key = keys[i];\n if (key === _key.toLowerCase()) {\n return _key;\n }\n }\n return null;\n}\n\nconst _global = (() => {\n /*eslint no-undef:0*/\n if (typeof globalThis !== \"undefined\") return globalThis;\n return typeof self !== \"undefined\" ? self : (typeof window !== 'undefined' ? window : global)\n})();\n\nconst isContextDefined = (context) => !isUndefined(context) && context !== _global;\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n *\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n const {caseless} = isContextDefined(this) && this || {};\n const result = {};\n const assignValue = (val, key) => {\n const targetKey = caseless && findKey(result, key) || key;\n if (isPlainObject(result[targetKey]) && isPlainObject(val)) {\n result[targetKey] = merge(result[targetKey], val);\n } else if (isPlainObject(val)) {\n result[targetKey] = merge({}, val);\n } else if (isArray(val)) {\n result[targetKey] = val.slice();\n } else {\n result[targetKey] = val;\n }\n }\n\n for (let i = 0, l = arguments.length; i < l; i++) {\n arguments[i] && forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n *\n * @param {Boolean} [allOwnKeys]\n * @returns {Object} The resulting value of object a\n */\nconst extend = (a, b, thisArg, {allOwnKeys}= {}) => {\n forEach(b, (val, key) => {\n if (thisArg && isFunction(val)) {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n }, {allOwnKeys});\n return a;\n}\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n *\n * @returns {string} content value without BOM\n */\nconst stripBOM = (content) => {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n}\n\n/**\n * Inherit the prototype methods from one constructor into another\n * @param {function} constructor\n * @param {function} superConstructor\n * @param {object} [props]\n * @param {object} [descriptors]\n *\n * @returns {void}\n */\nconst inherits = (constructor, superConstructor, props, descriptors) => {\n constructor.prototype = Object.create(superConstructor.prototype, descriptors);\n constructor.prototype.constructor = constructor;\n Object.defineProperty(constructor, 'super', {\n value: superConstructor.prototype\n });\n props && Object.assign(constructor.prototype, props);\n}\n\n/**\n * Resolve object with deep prototype chain to a flat object\n * @param {Object} sourceObj source object\n * @param {Object} [destObj]\n * @param {Function|Boolean} [filter]\n * @param {Function} [propFilter]\n *\n * @returns {Object}\n */\nconst toFlatObject = (sourceObj, destObj, filter, propFilter) => {\n let props;\n let i;\n let prop;\n const merged = {};\n\n destObj = destObj || {};\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (sourceObj == null) return destObj;\n\n do {\n props = Object.getOwnPropertyNames(sourceObj);\n i = props.length;\n while (i-- > 0) {\n prop = props[i];\n if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {\n destObj[prop] = sourceObj[prop];\n merged[prop] = true;\n }\n }\n sourceObj = filter !== false && getPrototypeOf(sourceObj);\n } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);\n\n return destObj;\n}\n\n/**\n * Determines whether a string ends with the characters of a specified string\n *\n * @param {String} str\n * @param {String} searchString\n * @param {Number} [position= 0]\n *\n * @returns {boolean}\n */\nconst endsWith = (str, searchString, position) => {\n str = String(str);\n if (position === undefined || position > str.length) {\n position = str.length;\n }\n position -= searchString.length;\n const lastIndex = str.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n}\n\n\n/**\n * Returns new array from array like object or null if failed\n *\n * @param {*} [thing]\n *\n * @returns {?Array}\n */\nconst toArray = (thing) => {\n if (!thing) return null;\n if (isArray(thing)) return thing;\n let i = thing.length;\n if (!isNumber(i)) return null;\n const arr = new Array(i);\n while (i-- > 0) {\n arr[i] = thing[i];\n }\n return arr;\n}\n\n/**\n * Checking if the Uint8Array exists and if it does, it returns a function that checks if the\n * thing passed in is an instance of Uint8Array\n *\n * @param {TypedArray}\n *\n * @returns {Array}\n */\n// eslint-disable-next-line func-names\nconst isTypedArray = (TypedArray => {\n // eslint-disable-next-line func-names\n return thing => {\n return TypedArray && thing instanceof TypedArray;\n };\n})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));\n\n/**\n * For each entry in the object, call the function with the key and value.\n *\n * @param {Object} obj - The object to iterate over.\n * @param {Function} fn - The function to call for each entry.\n *\n * @returns {void}\n */\nconst forEachEntry = (obj, fn) => {\n const generator = obj && obj[Symbol.iterator];\n\n const iterator = generator.call(obj);\n\n let result;\n\n while ((result = iterator.next()) && !result.done) {\n const pair = result.value;\n fn.call(obj, pair[0], pair[1]);\n }\n}\n\n/**\n * It takes a regular expression and a string, and returns an array of all the matches\n *\n * @param {string} regExp - The regular expression to match against.\n * @param {string} str - The string to search.\n *\n * @returns {Array}\n */\nconst matchAll = (regExp, str) => {\n let matches;\n const arr = [];\n\n while ((matches = regExp.exec(str)) !== null) {\n arr.push(matches);\n }\n\n return arr;\n}\n\n/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */\nconst isHTMLForm = kindOfTest('HTMLFormElement');\n\nconst toCamelCase = str => {\n return str.toLowerCase().replace(/[-_\\s]([a-z\\d])(\\w*)/g,\n function replacer(m, p1, p2) {\n return p1.toUpperCase() + p2;\n }\n );\n};\n\n/* Creating a function that will check if an object has a property. */\nconst hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);\n\n/**\n * Determine if a value is a RegExp object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a RegExp object, otherwise false\n */\nconst isRegExp = kindOfTest('RegExp');\n\nconst reduceDescriptors = (obj, reducer) => {\n const descriptors = Object.getOwnPropertyDescriptors(obj);\n const reducedDescriptors = {};\n\n forEach(descriptors, (descriptor, name) => {\n let ret;\n if ((ret = reducer(descriptor, name, obj)) !== false) {\n reducedDescriptors[name] = ret || descriptor;\n }\n });\n\n Object.defineProperties(obj, reducedDescriptors);\n}\n\n/**\n * Makes all methods read-only\n * @param {Object} obj\n */\n\nconst freezeMethods = (obj) => {\n reduceDescriptors(obj, (descriptor, name) => {\n // skip restricted props in strict mode\n if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {\n return false;\n }\n\n const value = obj[name];\n\n if (!isFunction(value)) return;\n\n descriptor.enumerable = false;\n\n if ('writable' in descriptor) {\n descriptor.writable = false;\n return;\n }\n\n if (!descriptor.set) {\n descriptor.set = () => {\n throw Error('Can not rewrite read-only method \\'' + name + '\\'');\n };\n }\n });\n}\n\nconst toObjectSet = (arrayOrString, delimiter) => {\n const obj = {};\n\n const define = (arr) => {\n arr.forEach(value => {\n obj[value] = true;\n });\n }\n\n isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));\n\n return obj;\n}\n\nconst noop = () => {}\n\nconst toFiniteNumber = (value, defaultValue) => {\n return value != null && Number.isFinite(value = +value) ? value : defaultValue;\n}\n\nconst ALPHA = 'abcdefghijklmnopqrstuvwxyz'\n\nconst DIGIT = '0123456789';\n\nconst ALPHABET = {\n DIGIT,\n ALPHA,\n ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT\n}\n\nconst generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {\n let str = '';\n const {length} = alphabet;\n while (size--) {\n str += alphabet[Math.random() * length|0]\n }\n\n return str;\n}\n\n/**\n * If the thing is a FormData object, return true, otherwise return false.\n *\n * @param {unknown} thing - The thing to check.\n *\n * @returns {boolean}\n */\nfunction isSpecCompliantForm(thing) {\n return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);\n}\n\nconst toJSONObject = (obj) => {\n const stack = new Array(10);\n\n const visit = (source, i) => {\n\n if (isObject(source)) {\n if (stack.indexOf(source) >= 0) {\n return;\n }\n\n if(!('toJSON' in source)) {\n stack[i] = source;\n const target = isArray(source) ? [] : {};\n\n forEach(source, (value, key) => {\n const reducedValue = visit(value, i + 1);\n !isUndefined(reducedValue) && (target[key] = reducedValue);\n });\n\n stack[i] = undefined;\n\n return target;\n }\n }\n\n return source;\n }\n\n return visit(obj, 0);\n}\n\nconst isAsyncFn = kindOfTest('AsyncFunction');\n\nconst isThenable = (thing) =>\n thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);\n\nexport default {\n isArray,\n isArrayBuffer,\n isBuffer,\n isFormData,\n isArrayBufferView,\n isString,\n isNumber,\n isBoolean,\n isObject,\n isPlainObject,\n isReadableStream,\n isRequest,\n isResponse,\n isHeaders,\n isUndefined,\n isDate,\n isFile,\n isBlob,\n isRegExp,\n isFunction,\n isStream,\n isURLSearchParams,\n isTypedArray,\n isFileList,\n forEach,\n merge,\n extend,\n trim,\n stripBOM,\n inherits,\n toFlatObject,\n kindOf,\n kindOfTest,\n endsWith,\n toArray,\n forEachEntry,\n matchAll,\n isHTMLForm,\n hasOwnProperty,\n hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection\n reduceDescriptors,\n freezeMethods,\n toObjectSet,\n toCamelCase,\n noop,\n toFiniteNumber,\n findKey,\n global: _global,\n isContextDefined,\n ALPHABET,\n generateString,\n isSpecCompliantForm,\n toJSONObject,\n isAsyncFn,\n isThenable\n};\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [config] The config.\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n *\n * @returns {Error} The created error.\n */\nfunction AxiosError(message, code, config, request, response) {\n Error.call(this);\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n } else {\n this.stack = (new Error()).stack;\n }\n\n this.message = message;\n this.name = 'AxiosError';\n code && (this.code = code);\n config && (this.config = config);\n request && (this.request = request);\n response && (this.response = response);\n}\n\nutils.inherits(AxiosError, Error, {\n toJSON: function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: utils.toJSONObject(this.config),\n code: this.code,\n status: this.response && this.response.status ? this.response.status : null\n };\n }\n});\n\nconst prototype = AxiosError.prototype;\nconst descriptors = {};\n\n[\n 'ERR_BAD_OPTION_VALUE',\n 'ERR_BAD_OPTION',\n 'ECONNABORTED',\n 'ETIMEDOUT',\n 'ERR_NETWORK',\n 'ERR_FR_TOO_MANY_REDIRECTS',\n 'ERR_DEPRECATED',\n 'ERR_BAD_RESPONSE',\n 'ERR_BAD_REQUEST',\n 'ERR_CANCELED',\n 'ERR_NOT_SUPPORT',\n 'ERR_INVALID_URL'\n// eslint-disable-next-line func-names\n].forEach(code => {\n descriptors[code] = {value: code};\n});\n\nObject.defineProperties(AxiosError, descriptors);\nObject.defineProperty(prototype, 'isAxiosError', {value: true});\n\n// eslint-disable-next-line func-names\nAxiosError.from = (error, code, config, request, response, customProps) => {\n const axiosError = Object.create(prototype);\n\n utils.toFlatObject(error, axiosError, function filter(obj) {\n return obj !== Error.prototype;\n }, prop => {\n return prop !== 'isAxiosError';\n });\n\n AxiosError.call(axiosError, error.message, code, config, request, response);\n\n axiosError.cause = error;\n\n axiosError.name = error.name;\n\n customProps && Object.assign(axiosError, customProps);\n\n return axiosError;\n};\n\nexport default AxiosError;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\n// temporary hotfix to avoid circular references until AxiosURLSearchParams is refactored\nimport PlatformFormData from '../platform/node/classes/FormData.js';\n\n/**\n * Determines if the given thing is a array or js object.\n *\n * @param {string} thing - The object or array to be visited.\n *\n * @returns {boolean}\n */\nfunction isVisitable(thing) {\n return utils.isPlainObject(thing) || utils.isArray(thing);\n}\n\n/**\n * It removes the brackets from the end of a string\n *\n * @param {string} key - The key of the parameter.\n *\n * @returns {string} the key without the brackets.\n */\nfunction removeBrackets(key) {\n return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;\n}\n\n/**\n * It takes a path, a key, and a boolean, and returns a string\n *\n * @param {string} path - The path to the current key.\n * @param {string} key - The key of the current object being iterated over.\n * @param {string} dots - If true, the key will be rendered with dots instead of brackets.\n *\n * @returns {string} The path to the current key.\n */\nfunction renderKey(path, key, dots) {\n if (!path) return key;\n return path.concat(key).map(function each(token, i) {\n // eslint-disable-next-line no-param-reassign\n token = removeBrackets(token);\n return !dots && i ? '[' + token + ']' : token;\n }).join(dots ? '.' : '');\n}\n\n/**\n * If the array is an array and none of its elements are visitable, then it's a flat array.\n *\n * @param {Array} arr - The array to check\n *\n * @returns {boolean}\n */\nfunction isFlatArray(arr) {\n return utils.isArray(arr) && !arr.some(isVisitable);\n}\n\nconst predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {\n return /^is[A-Z]/.test(prop);\n});\n\n/**\n * Convert a data object to FormData\n *\n * @param {Object} obj\n * @param {?Object} [formData]\n * @param {?Object} [options]\n * @param {Function} [options.visitor]\n * @param {Boolean} [options.metaTokens = true]\n * @param {Boolean} [options.dots = false]\n * @param {?Boolean} [options.indexes = false]\n *\n * @returns {Object}\n **/\n\n/**\n * It converts an object into a FormData object\n *\n * @param {Object} obj - The object to convert to form data.\n * @param {string} formData - The FormData object to append to.\n * @param {Object} options\n *\n * @returns\n */\nfunction toFormData(obj, formData, options) {\n if (!utils.isObject(obj)) {\n throw new TypeError('target must be an object');\n }\n\n // eslint-disable-next-line no-param-reassign\n formData = formData || new (PlatformFormData || FormData)();\n\n // eslint-disable-next-line no-param-reassign\n options = utils.toFlatObject(options, {\n metaTokens: true,\n dots: false,\n indexes: false\n }, false, function defined(option, source) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n return !utils.isUndefined(source[option]);\n });\n\n const metaTokens = options.metaTokens;\n // eslint-disable-next-line no-use-before-define\n const visitor = options.visitor || defaultVisitor;\n const dots = options.dots;\n const indexes = options.indexes;\n const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;\n const useBlob = _Blob && utils.isSpecCompliantForm(formData);\n\n if (!utils.isFunction(visitor)) {\n throw new TypeError('visitor must be a function');\n }\n\n function convertValue(value) {\n if (value === null) return '';\n\n if (utils.isDate(value)) {\n return value.toISOString();\n }\n\n if (!useBlob && utils.isBlob(value)) {\n throw new AxiosError('Blob is not supported. Use a Buffer instead.');\n }\n\n if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {\n return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);\n }\n\n return value;\n }\n\n /**\n * Default visitor.\n *\n * @param {*} value\n * @param {String|Number} key\n * @param {Array} path\n * @this {FormData}\n *\n * @returns {boolean} return true to visit the each prop of the value recursively\n */\n function defaultVisitor(value, key, path) {\n let arr = value;\n\n if (value && !path && typeof value === 'object') {\n if (utils.endsWith(key, '{}')) {\n // eslint-disable-next-line no-param-reassign\n key = metaTokens ? key : key.slice(0, -2);\n // eslint-disable-next-line no-param-reassign\n value = JSON.stringify(value);\n } else if (\n (utils.isArray(value) && isFlatArray(value)) ||\n ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))\n )) {\n // eslint-disable-next-line no-param-reassign\n key = removeBrackets(key);\n\n arr.forEach(function each(el, index) {\n !(utils.isUndefined(el) || el === null) && formData.append(\n // eslint-disable-next-line no-nested-ternary\n indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),\n convertValue(el)\n );\n });\n return false;\n }\n }\n\n if (isVisitable(value)) {\n return true;\n }\n\n formData.append(renderKey(path, key, dots), convertValue(value));\n\n return false;\n }\n\n const stack = [];\n\n const exposedHelpers = Object.assign(predicates, {\n defaultVisitor,\n convertValue,\n isVisitable\n });\n\n function build(value, path) {\n if (utils.isUndefined(value)) return;\n\n if (stack.indexOf(value) !== -1) {\n throw Error('Circular reference detected in ' + path.join('.'));\n }\n\n stack.push(value);\n\n utils.forEach(value, function each(el, key) {\n const result = !(utils.isUndefined(el) || el === null) && visitor.call(\n formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers\n );\n\n if (result === true) {\n build(el, path ? path.concat(key) : [key]);\n }\n });\n\n stack.pop();\n }\n\n if (!utils.isObject(obj)) {\n throw new TypeError('data must be an object');\n }\n\n build(obj);\n\n return formData;\n}\n\nexport default toFormData;\n","'use strict';\n\nimport toFormData from './toFormData.js';\n\n/**\n * It encodes a string by replacing all characters that are not in the unreserved set with\n * their percent-encoded equivalents\n *\n * @param {string} str - The string to encode.\n *\n * @returns {string} The encoded string.\n */\nfunction encode(str) {\n const charMap = {\n '!': '%21',\n \"'\": '%27',\n '(': '%28',\n ')': '%29',\n '~': '%7E',\n '%20': '+',\n '%00': '\\x00'\n };\n return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {\n return charMap[match];\n });\n}\n\n/**\n * It takes a params object and converts it to a FormData object\n *\n * @param {Object} params - The parameters to be converted to a FormData object.\n * @param {Object} options - The options object passed to the Axios constructor.\n *\n * @returns {void}\n */\nfunction AxiosURLSearchParams(params, options) {\n this._pairs = [];\n\n params && toFormData(params, this, options);\n}\n\nconst prototype = AxiosURLSearchParams.prototype;\n\nprototype.append = function append(name, value) {\n this._pairs.push([name, value]);\n};\n\nprototype.toString = function toString(encoder) {\n const _encode = encoder ? function(value) {\n return encoder.call(this, value, encode);\n } : encode;\n\n return this._pairs.map(function each(pair) {\n return _encode(pair[0]) + '=' + _encode(pair[1]);\n }, '').join('&');\n};\n\nexport default AxiosURLSearchParams;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js';\n\n/**\n * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their\n * URI encoded counterparts\n *\n * @param {string} val The value to be encoded.\n *\n * @returns {string} The encoded value.\n */\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @param {?object} options\n *\n * @returns {string} The formatted url\n */\nexport default function buildURL(url, params, options) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n \n const _encode = options && options.encode || encode;\n\n const serializeFn = options && options.serialize;\n\n let serializedParams;\n\n if (serializeFn) {\n serializedParams = serializeFn(params, options);\n } else {\n serializedParams = utils.isURLSearchParams(params) ?\n params.toString() :\n new AxiosURLSearchParams(params, options).toString(_encode);\n }\n\n if (serializedParams) {\n const hashmarkIndex = url.indexOf(\"#\");\n\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\nclass InterceptorManager {\n constructor() {\n this.handlers = [];\n }\n\n /**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\n use(fulfilled, rejected, options) {\n this.handlers.push({\n fulfilled,\n rejected,\n synchronous: options ? options.synchronous : false,\n runWhen: options ? options.runWhen : null\n });\n return this.handlers.length - 1;\n }\n\n /**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n *\n * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise\n */\n eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n }\n\n /**\n * Clear all interceptors from the stack\n *\n * @returns {void}\n */\n clear() {\n if (this.handlers) {\n this.handlers = [];\n }\n }\n\n /**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n *\n * @returns {void}\n */\n forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n }\n}\n\nexport default InterceptorManager;\n","'use strict';\n\nexport default {\n silentJSONParsing: true,\n forcedJSONParsing: true,\n clarifyTimeoutError: false\n};\n","'use strict';\n\nimport url from 'url';\nexport default url.URLSearchParams;\n","import URLSearchParams from './classes/URLSearchParams.js'\nimport FormData from './classes/FormData.js'\n\nexport default {\n isNode: true,\n classes: {\n URLSearchParams,\n FormData,\n Blob: typeof Blob !== 'undefined' && Blob || null\n },\n protocols: [ 'http', 'https', 'file', 'data' ]\n};\n","const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * navigator.product -> 'ReactNative'\n * nativescript\n * navigator.product -> 'NativeScript' or 'NS'\n *\n * @returns {boolean}\n */\nconst hasStandardBrowserEnv = (\n (product) => {\n return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0\n })(typeof navigator !== 'undefined' && navigator.product);\n\n/**\n * Determine if we're running in a standard browser webWorker environment\n *\n * Although the `isStandardBrowserEnv` method indicates that\n * `allows axios to run in a web worker`, the WebWorker will still be\n * filtered out due to its judgment standard\n * `typeof window !== 'undefined' && typeof document !== 'undefined'`.\n * This leads to a problem when axios post `FormData` in webWorker\n */\nconst hasStandardBrowserWebWorkerEnv = (() => {\n return (\n typeof WorkerGlobalScope !== 'undefined' &&\n // eslint-disable-next-line no-undef\n self instanceof WorkerGlobalScope &&\n typeof self.importScripts === 'function'\n );\n})();\n\nconst origin = hasBrowserEnv && window.location.href || 'http://localhost';\n\nexport {\n hasBrowserEnv,\n hasStandardBrowserWebWorkerEnv,\n hasStandardBrowserEnv,\n origin\n}\n","import platform from './node/index.js';\nimport * as utils from './common/utils.js';\n\nexport default {\n ...utils,\n ...platform\n}\n","'use strict';\n\nimport utils from '../utils.js';\nimport toFormData from './toFormData.js';\nimport platform from '../platform/index.js';\n\nexport default function toURLEncodedForm(data, options) {\n return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({\n visitor: function(value, key, path, helpers) {\n if (platform.isNode && utils.isBuffer(value)) {\n this.append(key, value.toString('base64'));\n return false;\n }\n\n return helpers.defaultVisitor.apply(this, arguments);\n }\n }, options));\n}\n","'use strict';\n\nimport utils from '../utils.js';\n\n/**\n * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']\n *\n * @param {string} name - The name of the property to get.\n *\n * @returns An array of strings.\n */\nfunction parsePropPath(name) {\n // foo[x][y][z]\n // foo.x.y.z\n // foo-x-y-z\n // foo x y z\n return utils.matchAll(/\\w+|\\[(\\w*)]/g, name).map(match => {\n return match[0] === '[]' ? '' : match[1] || match[0];\n });\n}\n\n/**\n * Convert an array to an object.\n *\n * @param {Array} arr - The array to convert to an object.\n *\n * @returns An object with the same keys and values as the array.\n */\nfunction arrayToObject(arr) {\n const obj = {};\n const keys = Object.keys(arr);\n let i;\n const len = keys.length;\n let key;\n for (i = 0; i < len; i++) {\n key = keys[i];\n obj[key] = arr[key];\n }\n return obj;\n}\n\n/**\n * It takes a FormData object and returns a JavaScript object\n *\n * @param {string} formData The FormData object to convert to JSON.\n *\n * @returns {Object | null} The converted object.\n */\nfunction formDataToJSON(formData) {\n function buildPath(path, value, target, index) {\n let name = path[index++];\n\n if (name === '__proto__') return true;\n\n const isNumericKey = Number.isFinite(+name);\n const isLast = index >= path.length;\n name = !name && utils.isArray(target) ? target.length : name;\n\n if (isLast) {\n if (utils.hasOwnProp(target, name)) {\n target[name] = [target[name], value];\n } else {\n target[name] = value;\n }\n\n return !isNumericKey;\n }\n\n if (!target[name] || !utils.isObject(target[name])) {\n target[name] = [];\n }\n\n const result = buildPath(path, value, target[name], index);\n\n if (result && utils.isArray(target[name])) {\n target[name] = arrayToObject(target[name]);\n }\n\n return !isNumericKey;\n }\n\n if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {\n const obj = {};\n\n utils.forEachEntry(formData, (name, value) => {\n buildPath(parsePropPath(name), value, obj, 0);\n });\n\n return obj;\n }\n\n return null;\n}\n\nexport default formDataToJSON;\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosError from '../core/AxiosError.js';\nimport transitionalDefaults from './transitional.js';\nimport toFormData from '../helpers/toFormData.js';\nimport toURLEncodedForm from '../helpers/toURLEncodedForm.js';\nimport platform from '../platform/index.js';\nimport formDataToJSON from '../helpers/formDataToJSON.js';\n\n/**\n * It takes a string, tries to parse it, and if it fails, it returns the stringified version\n * of the input\n *\n * @param {any} rawValue - The value to be stringified.\n * @param {Function} parser - A function that parses a string into a JavaScript object.\n * @param {Function} encoder - A function that takes a value and returns a string.\n *\n * @returns {string} A stringified version of the rawValue.\n */\nfunction stringifySafely(rawValue, parser, encoder) {\n if (utils.isString(rawValue)) {\n try {\n (parser || JSON.parse)(rawValue);\n return utils.trim(rawValue);\n } catch (e) {\n if (e.name !== 'SyntaxError') {\n throw e;\n }\n }\n }\n\n return (encoder || JSON.stringify)(rawValue);\n}\n\nconst defaults = {\n\n transitional: transitionalDefaults,\n\n adapter: ['xhr', 'http', 'fetch'],\n\n transformRequest: [function transformRequest(data, headers) {\n const contentType = headers.getContentType() || '';\n const hasJSONContentType = contentType.indexOf('application/json') > -1;\n const isObjectPayload = utils.isObject(data);\n\n if (isObjectPayload && utils.isHTMLForm(data)) {\n data = new FormData(data);\n }\n\n const isFormData = utils.isFormData(data);\n\n if (isFormData) {\n return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;\n }\n\n if (utils.isArrayBuffer(data) ||\n utils.isBuffer(data) ||\n utils.isStream(data) ||\n utils.isFile(data) ||\n utils.isBlob(data) ||\n utils.isReadableStream(data)\n ) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isURLSearchParams(data)) {\n headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);\n return data.toString();\n }\n\n let isFileList;\n\n if (isObjectPayload) {\n if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {\n return toURLEncodedForm(data, this.formSerializer).toString();\n }\n\n if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {\n const _FormData = this.env && this.env.FormData;\n\n return toFormData(\n isFileList ? {'files[]': data} : data,\n _FormData && new _FormData(),\n this.formSerializer\n );\n }\n }\n\n if (isObjectPayload || hasJSONContentType ) {\n headers.setContentType('application/json', false);\n return stringifySafely(data);\n }\n\n return data;\n }],\n\n transformResponse: [function transformResponse(data) {\n const transitional = this.transitional || defaults.transitional;\n const forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n const JSONRequested = this.responseType === 'json';\n\n if (utils.isResponse(data) || utils.isReadableStream(data)) {\n return data;\n }\n\n if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {\n const silentJSONParsing = transitional && transitional.silentJSONParsing;\n const strictJSONParsing = !silentJSONParsing && JSONRequested;\n\n try {\n return JSON.parse(data);\n } catch (e) {\n if (strictJSONParsing) {\n if (e.name === 'SyntaxError') {\n throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);\n }\n throw e;\n }\n }\n }\n\n return data;\n }],\n\n /**\n * A timeout in milliseconds to abort a request. If set to 0 (default) a\n * timeout is not created.\n */\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n\n maxContentLength: -1,\n maxBodyLength: -1,\n\n env: {\n FormData: platform.classes.FormData,\n Blob: platform.classes.Blob\n },\n\n validateStatus: function validateStatus(status) {\n return status >= 200 && status < 300;\n },\n\n headers: {\n common: {\n 'Accept': 'application/json, text/plain, */*',\n 'Content-Type': undefined\n }\n }\n};\n\nutils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {\n defaults.headers[method] = {};\n});\n\nexport default defaults;\n","'use strict';\n\nimport utils from './../utils.js';\n\n// RawAxiosHeaders whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nconst ignoreDuplicateOf = utils.toObjectSet([\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n]);\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} rawHeaders Headers needing to be parsed\n *\n * @returns {Object} Headers parsed into an object\n */\nexport default rawHeaders => {\n const parsed = {};\n let key;\n let val;\n let i;\n\n rawHeaders && rawHeaders.split('\\n').forEach(function parser(line) {\n i = line.indexOf(':');\n key = line.substring(0, i).trim().toLowerCase();\n val = line.substring(i + 1).trim();\n\n if (!key || (parsed[key] && ignoreDuplicateOf[key])) {\n return;\n }\n\n if (key === 'set-cookie') {\n if (parsed[key]) {\n parsed[key].push(val);\n } else {\n parsed[key] = [val];\n }\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n });\n\n return parsed;\n};\n","'use strict';\n\nimport utils from '../utils.js';\nimport parseHeaders from '../helpers/parseHeaders.js';\n\nconst $internals = Symbol('internals');\n\nfunction normalizeHeader(header) {\n return header && String(header).trim().toLowerCase();\n}\n\nfunction normalizeValue(value) {\n if (value === false || value == null) {\n return value;\n }\n\n return utils.isArray(value) ? value.map(normalizeValue) : String(value);\n}\n\nfunction parseTokens(str) {\n const tokens = Object.create(null);\n const tokensRE = /([^\\s,;=]+)\\s*(?:=\\s*([^,;]+))?/g;\n let match;\n\n while ((match = tokensRE.exec(str))) {\n tokens[match[1]] = match[2];\n }\n\n return tokens;\n}\n\nconst isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());\n\nfunction matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {\n if (utils.isFunction(filter)) {\n return filter.call(this, value, header);\n }\n\n if (isHeaderNameFilter) {\n value = header;\n }\n\n if (!utils.isString(value)) return;\n\n if (utils.isString(filter)) {\n return value.indexOf(filter) !== -1;\n }\n\n if (utils.isRegExp(filter)) {\n return filter.test(value);\n }\n}\n\nfunction formatHeader(header) {\n return header.trim()\n .toLowerCase().replace(/([a-z\\d])(\\w*)/g, (w, char, str) => {\n return char.toUpperCase() + str;\n });\n}\n\nfunction buildAccessors(obj, header) {\n const accessorName = utils.toCamelCase(' ' + header);\n\n ['get', 'set', 'has'].forEach(methodName => {\n Object.defineProperty(obj, methodName + accessorName, {\n value: function(arg1, arg2, arg3) {\n return this[methodName].call(this, header, arg1, arg2, arg3);\n },\n configurable: true\n });\n });\n}\n\nclass AxiosHeaders {\n constructor(headers) {\n headers && this.set(headers);\n }\n\n set(header, valueOrRewrite, rewrite) {\n const self = this;\n\n function setHeader(_value, _header, _rewrite) {\n const lHeader = normalizeHeader(_header);\n\n if (!lHeader) {\n throw new Error('header name must be a non-empty string');\n }\n\n const key = utils.findKey(self, lHeader);\n\n if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {\n self[key || _header] = normalizeValue(_value);\n }\n }\n\n const setHeaders = (headers, _rewrite) =>\n utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));\n\n if (utils.isPlainObject(header) || header instanceof this.constructor) {\n setHeaders(header, valueOrRewrite)\n } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {\n setHeaders(parseHeaders(header), valueOrRewrite);\n } else if (utils.isHeaders(header)) {\n for (const [key, value] of header.entries()) {\n setHeader(value, key, rewrite);\n }\n } else {\n header != null && setHeader(valueOrRewrite, header, rewrite);\n }\n\n return this;\n }\n\n get(header, parser) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n if (key) {\n const value = this[key];\n\n if (!parser) {\n return value;\n }\n\n if (parser === true) {\n return parseTokens(value);\n }\n\n if (utils.isFunction(parser)) {\n return parser.call(this, value, key);\n }\n\n if (utils.isRegExp(parser)) {\n return parser.exec(value);\n }\n\n throw new TypeError('parser must be boolean|regexp|function');\n }\n }\n }\n\n has(header, matcher) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));\n }\n\n return false;\n }\n\n delete(header, matcher) {\n const self = this;\n let deleted = false;\n\n function deleteHeader(_header) {\n _header = normalizeHeader(_header);\n\n if (_header) {\n const key = utils.findKey(self, _header);\n\n if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {\n delete self[key];\n\n deleted = true;\n }\n }\n }\n\n if (utils.isArray(header)) {\n header.forEach(deleteHeader);\n } else {\n deleteHeader(header);\n }\n\n return deleted;\n }\n\n clear(matcher) {\n const keys = Object.keys(this);\n let i = keys.length;\n let deleted = false;\n\n while (i--) {\n const key = keys[i];\n if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {\n delete this[key];\n deleted = true;\n }\n }\n\n return deleted;\n }\n\n normalize(format) {\n const self = this;\n const headers = {};\n\n utils.forEach(this, (value, header) => {\n const key = utils.findKey(headers, header);\n\n if (key) {\n self[key] = normalizeValue(value);\n delete self[header];\n return;\n }\n\n const normalized = format ? formatHeader(header) : String(header).trim();\n\n if (normalized !== header) {\n delete self[header];\n }\n\n self[normalized] = normalizeValue(value);\n\n headers[normalized] = true;\n });\n\n return this;\n }\n\n concat(...targets) {\n return this.constructor.concat(this, ...targets);\n }\n\n toJSON(asStrings) {\n const obj = Object.create(null);\n\n utils.forEach(this, (value, header) => {\n value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);\n });\n\n return obj;\n }\n\n [Symbol.iterator]() {\n return Object.entries(this.toJSON())[Symbol.iterator]();\n }\n\n toString() {\n return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\\n');\n }\n\n get [Symbol.toStringTag]() {\n return 'AxiosHeaders';\n }\n\n static from(thing) {\n return thing instanceof this ? thing : new this(thing);\n }\n\n static concat(first, ...targets) {\n const computed = new this(first);\n\n targets.forEach((target) => computed.set(target));\n\n return computed;\n }\n\n static accessor(header) {\n const internals = this[$internals] = (this[$internals] = {\n accessors: {}\n });\n\n const accessors = internals.accessors;\n const prototype = this.prototype;\n\n function defineAccessor(_header) {\n const lHeader = normalizeHeader(_header);\n\n if (!accessors[lHeader]) {\n buildAccessors(prototype, _header);\n accessors[lHeader] = true;\n }\n }\n\n utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);\n\n return this;\n }\n}\n\nAxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);\n\n// reserved names hotfix\nutils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {\n let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`\n return {\n get: () => value,\n set(headerValue) {\n this[mapped] = headerValue;\n }\n }\n});\n\nutils.freezeMethods(AxiosHeaders);\n\nexport default AxiosHeaders;\n","'use strict';\n\nimport utils from './../utils.js';\nimport defaults from '../defaults/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Array|Function} fns A single function or Array of functions\n * @param {?Object} response The response object\n *\n * @returns {*} The resulting transformed data\n */\nexport default function transformData(fns, response) {\n const config = this || defaults;\n const context = response || config;\n const headers = AxiosHeaders.from(context.headers);\n let data = context.data;\n\n utils.forEach(fns, function transform(fn) {\n data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);\n });\n\n headers.normalize();\n\n return data;\n}\n","'use strict';\n\nexport default function isCancel(value) {\n return !!(value && value.__CANCEL__);\n}\n","'use strict';\n\nimport AxiosError from '../core/AxiosError.js';\nimport utils from '../utils.js';\n\n/**\n * A `CanceledError` is an object that is thrown when an operation is canceled.\n *\n * @param {string=} message The message.\n * @param {Object=} config The config.\n * @param {Object=} request The request.\n *\n * @returns {CanceledError} The created error.\n */\nfunction CanceledError(message, config, request) {\n // eslint-disable-next-line no-eq-null,eqeqeq\n AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);\n this.name = 'CanceledError';\n}\n\nutils.inherits(CanceledError, AxiosError, {\n __CANCEL__: true\n});\n\nexport default CanceledError;\n","'use strict';\n\nimport AxiosError from './AxiosError.js';\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n *\n * @returns {object} The response.\n */\nexport default function settle(resolve, reject, response) {\n const validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(new AxiosError(\n 'Request failed with status code ' + response.status,\n [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],\n response.config,\n response.request,\n response\n ));\n }\n}\n","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n *\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nexport default function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d+\\-.]*:)?\\/\\//i.test(url);\n}\n","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n *\n * @returns {string} The combined URL\n */\nexport default function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/?\\/$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n}\n","'use strict';\n\nimport isAbsoluteURL from '../helpers/isAbsoluteURL.js';\nimport combineURLs from '../helpers/combineURLs.js';\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n *\n * @returns {string} The combined full path\n */\nexport default function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n}\n","export const VERSION = \"1.7.2\";","'use strict';\n\nexport default function parseProtocol(url) {\n const match = /^([-+\\w]{1,25})(:?\\/\\/|:)/.exec(url);\n return match && match[1] || '';\n}\n","'use strict';\n\nimport AxiosError from '../core/AxiosError.js';\nimport parseProtocol from './parseProtocol.js';\nimport platform from '../platform/index.js';\n\nconst DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\\s\\S]*)$/;\n\n/**\n * Parse data uri to a Buffer or Blob\n *\n * @param {String} uri\n * @param {?Boolean} asBlob\n * @param {?Object} options\n * @param {?Function} options.Blob\n *\n * @returns {Buffer|Blob}\n */\nexport default function fromDataURI(uri, asBlob, options) {\n const _Blob = options && options.Blob || platform.classes.Blob;\n const protocol = parseProtocol(uri);\n\n if (asBlob === undefined && _Blob) {\n asBlob = true;\n }\n\n if (protocol === 'data') {\n uri = protocol.length ? uri.slice(protocol.length + 1) : uri;\n\n const match = DATA_URL_PATTERN.exec(uri);\n\n if (!match) {\n throw new AxiosError('Invalid URL', AxiosError.ERR_INVALID_URL);\n }\n\n const mime = match[1];\n const isBase64 = match[2];\n const body = match[3];\n const buffer = Buffer.from(decodeURIComponent(body), isBase64 ? 'base64' : 'utf8');\n\n if (asBlob) {\n if (!_Blob) {\n throw new AxiosError('Blob is not supported', AxiosError.ERR_NOT_SUPPORT);\n }\n\n return new _Blob([buffer], {type: mime});\n }\n\n return buffer;\n }\n\n throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT);\n}\n","'use strict';\n\n/**\n * Throttle decorator\n * @param {Function} fn\n * @param {Number} freq\n * @return {Function}\n */\nfunction throttle(fn, freq) {\n let timestamp = 0;\n const threshold = 1000 / freq;\n let timer = null;\n return function throttled() {\n const force = this === true;\n\n const now = Date.now();\n if (force || now - timestamp > threshold) {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n timestamp = now;\n return fn.apply(null, arguments);\n }\n if (!timer) {\n timer = setTimeout(() => {\n timer = null;\n timestamp = Date.now();\n return fn.apply(null, arguments);\n }, threshold - (now - timestamp));\n }\n };\n}\n\nexport default throttle;\n","'use strict';\n\n/**\n * Calculate data maxRate\n * @param {Number} [samplesCount= 10]\n * @param {Number} [min= 1000]\n * @returns {Function}\n */\nfunction speedometer(samplesCount, min) {\n samplesCount = samplesCount || 10;\n const bytes = new Array(samplesCount);\n const timestamps = new Array(samplesCount);\n let head = 0;\n let tail = 0;\n let firstSampleTS;\n\n min = min !== undefined ? min : 1000;\n\n return function push(chunkLength) {\n const now = Date.now();\n\n const startedAt = timestamps[tail];\n\n if (!firstSampleTS) {\n firstSampleTS = now;\n }\n\n bytes[head] = chunkLength;\n timestamps[head] = now;\n\n let i = tail;\n let bytesCount = 0;\n\n while (i !== head) {\n bytesCount += bytes[i++];\n i = i % samplesCount;\n }\n\n head = (head + 1) % samplesCount;\n\n if (head === tail) {\n tail = (tail + 1) % samplesCount;\n }\n\n if (now - firstSampleTS < min) {\n return;\n }\n\n const passed = startedAt && now - startedAt;\n\n return passed ? Math.round(bytesCount * 1000 / passed) : undefined;\n };\n}\n\nexport default speedometer;\n","'use strict';\n\nimport stream from 'stream';\nimport utils from '../utils.js';\nimport throttle from './throttle.js';\nimport speedometer from './speedometer.js';\n\nconst kInternals = Symbol('internals');\n\nclass AxiosTransformStream extends stream.Transform{\n constructor(options) {\n options = utils.toFlatObject(options, {\n maxRate: 0,\n chunkSize: 64 * 1024,\n minChunkSize: 100,\n timeWindow: 500,\n ticksRate: 2,\n samplesCount: 15\n }, null, (prop, source) => {\n return !utils.isUndefined(source[prop]);\n });\n\n super({\n readableHighWaterMark: options.chunkSize\n });\n\n const self = this;\n\n const internals = this[kInternals] = {\n length: options.length,\n timeWindow: options.timeWindow,\n ticksRate: options.ticksRate,\n chunkSize: options.chunkSize,\n maxRate: options.maxRate,\n minChunkSize: options.minChunkSize,\n bytesSeen: 0,\n isCaptured: false,\n notifiedBytesLoaded: 0,\n ts: Date.now(),\n bytes: 0,\n onReadCallback: null\n };\n\n const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow);\n\n this.on('newListener', event => {\n if (event === 'progress') {\n if (!internals.isCaptured) {\n internals.isCaptured = true;\n }\n }\n });\n\n let bytesNotified = 0;\n\n internals.updateProgress = throttle(function throttledHandler() {\n const totalBytes = internals.length;\n const bytesTransferred = internals.bytesSeen;\n const progressBytes = bytesTransferred - bytesNotified;\n if (!progressBytes || self.destroyed) return;\n\n const rate = _speedometer(progressBytes);\n\n bytesNotified = bytesTransferred;\n\n process.nextTick(() => {\n self.emit('progress', {\n loaded: bytesTransferred,\n total: totalBytes,\n progress: totalBytes ? (bytesTransferred / totalBytes) : undefined,\n bytes: progressBytes,\n rate: rate ? rate : undefined,\n estimated: rate && totalBytes && bytesTransferred <= totalBytes ?\n (totalBytes - bytesTransferred) / rate : undefined,\n lengthComputable: totalBytes != null\n });\n });\n }, internals.ticksRate);\n\n const onFinish = () => {\n internals.updateProgress.call(true);\n };\n\n this.once('end', onFinish);\n this.once('error', onFinish);\n }\n\n _read(size) {\n const internals = this[kInternals];\n\n if (internals.onReadCallback) {\n internals.onReadCallback();\n }\n\n return super._read(size);\n }\n\n _transform(chunk, encoding, callback) {\n const self = this;\n const internals = this[kInternals];\n const maxRate = internals.maxRate;\n\n const readableHighWaterMark = this.readableHighWaterMark;\n\n const timeWindow = internals.timeWindow;\n\n const divider = 1000 / timeWindow;\n const bytesThreshold = (maxRate / divider);\n const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;\n\n function pushChunk(_chunk, _callback) {\n const bytes = Buffer.byteLength(_chunk);\n internals.bytesSeen += bytes;\n internals.bytes += bytes;\n\n if (internals.isCaptured) {\n internals.updateProgress();\n }\n\n if (self.push(_chunk)) {\n process.nextTick(_callback);\n } else {\n internals.onReadCallback = () => {\n internals.onReadCallback = null;\n process.nextTick(_callback);\n };\n }\n }\n\n const transformChunk = (_chunk, _callback) => {\n const chunkSize = Buffer.byteLength(_chunk);\n let chunkRemainder = null;\n let maxChunkSize = readableHighWaterMark;\n let bytesLeft;\n let passed = 0;\n\n if (maxRate) {\n const now = Date.now();\n\n if (!internals.ts || (passed = (now - internals.ts)) >= timeWindow) {\n internals.ts = now;\n bytesLeft = bytesThreshold - internals.bytes;\n internals.bytes = bytesLeft < 0 ? -bytesLeft : 0;\n passed = 0;\n }\n\n bytesLeft = bytesThreshold - internals.bytes;\n }\n\n if (maxRate) {\n if (bytesLeft <= 0) {\n // next time window\n return setTimeout(() => {\n _callback(null, _chunk);\n }, timeWindow - passed);\n }\n\n if (bytesLeft < maxChunkSize) {\n maxChunkSize = bytesLeft;\n }\n }\n\n if (maxChunkSize && chunkSize > maxChunkSize && (chunkSize - maxChunkSize) > minChunkSize) {\n chunkRemainder = _chunk.subarray(maxChunkSize);\n _chunk = _chunk.subarray(0, maxChunkSize);\n }\n\n pushChunk(_chunk, chunkRemainder ? () => {\n process.nextTick(_callback, null, chunkRemainder);\n } : _callback);\n };\n\n transformChunk(chunk, function transformNextChunk(err, _chunk) {\n if (err) {\n return callback(err);\n }\n\n if (_chunk) {\n transformChunk(_chunk, transformNextChunk);\n } else {\n callback(null);\n }\n });\n }\n\n setLength(length) {\n this[kInternals].length = +length;\n return this;\n }\n}\n\nexport default AxiosTransformStream;\n","const {asyncIterator} = Symbol;\n\nconst readBlob = async function* (blob) {\n if (blob.stream) {\n yield* blob.stream()\n } else if (blob.arrayBuffer) {\n yield await blob.arrayBuffer()\n } else if (blob[asyncIterator]) {\n yield* blob[asyncIterator]();\n } else {\n yield blob;\n }\n}\n\nexport default readBlob;\n","import {TextEncoder} from 'util';\nimport {Readable} from 'stream';\nimport utils from \"../utils.js\";\nimport readBlob from \"./readBlob.js\";\n\nconst BOUNDARY_ALPHABET = utils.ALPHABET.ALPHA_DIGIT + '-_';\n\nconst textEncoder = new TextEncoder();\n\nconst CRLF = '\\r\\n';\nconst CRLF_BYTES = textEncoder.encode(CRLF);\nconst CRLF_BYTES_COUNT = 2;\n\nclass FormDataPart {\n constructor(name, value) {\n const {escapeName} = this.constructor;\n const isStringValue = utils.isString(value);\n\n let headers = `Content-Disposition: form-data; name=\"${escapeName(name)}\"${\n !isStringValue && value.name ? `; filename=\"${escapeName(value.name)}\"` : ''\n }${CRLF}`;\n\n if (isStringValue) {\n value = textEncoder.encode(String(value).replace(/\\r?\\n|\\r\\n?/g, CRLF));\n } else {\n headers += `Content-Type: ${value.type || \"application/octet-stream\"}${CRLF}`\n }\n\n this.headers = textEncoder.encode(headers + CRLF);\n\n this.contentLength = isStringValue ? value.byteLength : value.size;\n\n this.size = this.headers.byteLength + this.contentLength + CRLF_BYTES_COUNT;\n\n this.name = name;\n this.value = value;\n }\n\n async *encode(){\n yield this.headers;\n\n const {value} = this;\n\n if(utils.isTypedArray(value)) {\n yield value;\n } else {\n yield* readBlob(value);\n }\n\n yield CRLF_BYTES;\n }\n\n static escapeName(name) {\n return String(name).replace(/[\\r\\n\"]/g, (match) => ({\n '\\r' : '%0D',\n '\\n' : '%0A',\n '\"' : '%22',\n }[match]));\n }\n}\n\nconst formDataToStream = (form, headersHandler, options) => {\n const {\n tag = 'form-data-boundary',\n size = 25,\n boundary = tag + '-' + utils.generateString(size, BOUNDARY_ALPHABET)\n } = options || {};\n\n if(!utils.isFormData(form)) {\n throw TypeError('FormData instance required');\n }\n\n if (boundary.length < 1 || boundary.length > 70) {\n throw Error('boundary must be 10-70 characters long')\n }\n\n const boundaryBytes = textEncoder.encode('--' + boundary + CRLF);\n const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF + CRLF);\n let contentLength = footerBytes.byteLength;\n\n const parts = Array.from(form.entries()).map(([name, value]) => {\n const part = new FormDataPart(name, value);\n contentLength += part.size;\n return part;\n });\n\n contentLength += boundaryBytes.byteLength * parts.length;\n\n contentLength = utils.toFiniteNumber(contentLength);\n\n const computedHeaders = {\n 'Content-Type': `multipart/form-data; boundary=${boundary}`\n }\n\n if (Number.isFinite(contentLength)) {\n computedHeaders['Content-Length'] = contentLength;\n }\n\n headersHandler && headersHandler(computedHeaders);\n\n return Readable.from((async function *() {\n for(const part of parts) {\n yield boundaryBytes;\n yield* part.encode();\n }\n\n yield footerBytes;\n })());\n};\n\nexport default formDataToStream;\n","\"use strict\";\n\nimport stream from \"stream\";\n\nclass ZlibHeaderTransformStream extends stream.Transform {\n __transform(chunk, encoding, callback) {\n this.push(chunk);\n callback();\n }\n\n _transform(chunk, encoding, callback) {\n if (chunk.length !== 0) {\n this._transform = this.__transform;\n\n // Add Default Compression headers if no zlib headers are present\n if (chunk[0] !== 120) { // Hex: 78\n const header = Buffer.alloc(2);\n header[0] = 120; // Hex: 78\n header[1] = 156; // Hex: 9C \n this.push(header, encoding);\n }\n }\n\n this.__transform(chunk, encoding, callback);\n }\n}\n\nexport default ZlibHeaderTransformStream;\n","import utils from \"../utils.js\";\n\nconst callbackify = (fn, reducer) => {\n return utils.isAsyncFn(fn) ? function (...args) {\n const cb = args.pop();\n fn.apply(this, args).then((value) => {\n try {\n reducer ? cb(null, ...reducer(value)) : cb(null, value);\n } catch (err) {\n cb(err);\n }\n }, cb);\n } : fn;\n}\n\nexport default callbackify;\n","'use strict';\n\nimport utils from './../utils.js';\nimport settle from './../core/settle.js';\nimport buildFullPath from '../core/buildFullPath.js';\nimport buildURL from './../helpers/buildURL.js';\nimport {getProxyForUrl} from 'proxy-from-env';\nimport http from 'http';\nimport https from 'https';\nimport util from 'util';\nimport followRedirects from 'follow-redirects';\nimport zlib from 'zlib';\nimport {VERSION} from '../env/data.js';\nimport transitionalDefaults from '../defaults/transitional.js';\nimport AxiosError from '../core/AxiosError.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport platform from '../platform/index.js';\nimport fromDataURI from '../helpers/fromDataURI.js';\nimport stream from 'stream';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport AxiosTransformStream from '../helpers/AxiosTransformStream.js';\nimport {EventEmitter} from 'events';\nimport formDataToStream from \"../helpers/formDataToStream.js\";\nimport readBlob from \"../helpers/readBlob.js\";\nimport ZlibHeaderTransformStream from '../helpers/ZlibHeaderTransformStream.js';\nimport callbackify from \"../helpers/callbackify.js\";\n\nconst zlibOptions = {\n flush: zlib.constants.Z_SYNC_FLUSH,\n finishFlush: zlib.constants.Z_SYNC_FLUSH\n};\n\nconst brotliOptions = {\n flush: zlib.constants.BROTLI_OPERATION_FLUSH,\n finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH\n}\n\nconst isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress);\n\nconst {http: httpFollow, https: httpsFollow} = followRedirects;\n\nconst isHttps = /https:?/;\n\nconst supportedProtocols = platform.protocols.map(protocol => {\n return protocol + ':';\n});\n\n/**\n * If the proxy or config beforeRedirects functions are defined, call them with the options\n * object.\n *\n * @param {Object} options - The options object that was passed to the request.\n *\n * @returns {Object}\n */\nfunction dispatchBeforeRedirect(options, responseDetails) {\n if (options.beforeRedirects.proxy) {\n options.beforeRedirects.proxy(options);\n }\n if (options.beforeRedirects.config) {\n options.beforeRedirects.config(options, responseDetails);\n }\n}\n\n/**\n * If the proxy or config afterRedirects functions are defined, call them with the options\n *\n * @param {http.ClientRequestArgs} options\n * @param {AxiosProxyConfig} configProxy configuration from Axios options object\n * @param {string} location\n *\n * @returns {http.ClientRequestArgs}\n */\nfunction setProxy(options, configProxy, location) {\n let proxy = configProxy;\n if (!proxy && proxy !== false) {\n const proxyUrl = getProxyForUrl(location);\n if (proxyUrl) {\n proxy = new URL(proxyUrl);\n }\n }\n if (proxy) {\n // Basic proxy authorization\n if (proxy.username) {\n proxy.auth = (proxy.username || '') + ':' + (proxy.password || '');\n }\n\n if (proxy.auth) {\n // Support proxy auth object form\n if (proxy.auth.username || proxy.auth.password) {\n proxy.auth = (proxy.auth.username || '') + ':' + (proxy.auth.password || '');\n }\n const base64 = Buffer\n .from(proxy.auth, 'utf8')\n .toString('base64');\n options.headers['Proxy-Authorization'] = 'Basic ' + base64;\n }\n\n options.headers.host = options.hostname + (options.port ? ':' + options.port : '');\n const proxyHost = proxy.hostname || proxy.host;\n options.hostname = proxyHost;\n // Replace 'host' since options is not a URL object\n options.host = proxyHost;\n options.port = proxy.port;\n options.path = location;\n if (proxy.protocol) {\n options.protocol = proxy.protocol.includes(':') ? proxy.protocol : `${proxy.protocol}:`;\n }\n }\n\n options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) {\n // Configure proxy for redirected request, passing the original config proxy to apply\n // the exact same logic as if the redirected request was performed by axios directly.\n setProxy(redirectOptions, configProxy, redirectOptions.href);\n };\n}\n\nconst isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(process) === 'process';\n\n// temporary hotfix\n\nconst wrapAsync = (asyncExecutor) => {\n return new Promise((resolve, reject) => {\n let onDone;\n let isDone;\n\n const done = (value, isRejected) => {\n if (isDone) return;\n isDone = true;\n onDone && onDone(value, isRejected);\n }\n\n const _resolve = (value) => {\n done(value);\n resolve(value);\n };\n\n const _reject = (reason) => {\n done(reason, true);\n reject(reason);\n }\n\n asyncExecutor(_resolve, _reject, (onDoneHandler) => (onDone = onDoneHandler)).catch(_reject);\n })\n};\n\nconst resolveFamily = ({address, family}) => {\n if (!utils.isString(address)) {\n throw TypeError('address must be a string');\n }\n return ({\n address,\n family: family || (address.indexOf('.') < 0 ? 6 : 4)\n });\n}\n\nconst buildAddressEntry = (address, family) => resolveFamily(utils.isObject(address) ? address : {address, family});\n\n/*eslint consistent-return:0*/\nexport default isHttpAdapterSupported && function httpAdapter(config) {\n return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {\n let {data, lookup, family} = config;\n const {responseType, responseEncoding} = config;\n const method = config.method.toUpperCase();\n let isDone;\n let rejected = false;\n let req;\n\n if (lookup) {\n const _lookup = callbackify(lookup, (value) => utils.isArray(value) ? value : [value]);\n // hotfix to support opt.all option which is required for node 20.x\n lookup = (hostname, opt, cb) => {\n _lookup(hostname, opt, (err, arg0, arg1) => {\n if (err) {\n return cb(err);\n }\n\n const addresses = utils.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];\n\n opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);\n });\n }\n }\n\n // temporary internal emitter until the AxiosRequest class will be implemented\n const emitter = new EventEmitter();\n\n const onFinished = () => {\n if (config.cancelToken) {\n config.cancelToken.unsubscribe(abort);\n }\n\n if (config.signal) {\n config.signal.removeEventListener('abort', abort);\n }\n\n emitter.removeAllListeners();\n }\n\n onDone((value, isRejected) => {\n isDone = true;\n if (isRejected) {\n rejected = true;\n onFinished();\n }\n });\n\n function abort(reason) {\n emitter.emit('abort', !reason || reason.type ? new CanceledError(null, config, req) : reason);\n }\n\n emitter.once('abort', reject);\n\n if (config.cancelToken || config.signal) {\n config.cancelToken && config.cancelToken.subscribe(abort);\n if (config.signal) {\n config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort);\n }\n }\n\n // Parse url\n const fullPath = buildFullPath(config.baseURL, config.url);\n const parsed = new URL(fullPath, 'http://localhost');\n const protocol = parsed.protocol || supportedProtocols[0];\n\n if (protocol === 'data:') {\n let convertedData;\n\n if (method !== 'GET') {\n return settle(resolve, reject, {\n status: 405,\n statusText: 'method not allowed',\n headers: {},\n config\n });\n }\n\n try {\n convertedData = fromDataURI(config.url, responseType === 'blob', {\n Blob: config.env && config.env.Blob\n });\n } catch (err) {\n throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config);\n }\n\n if (responseType === 'text') {\n convertedData = convertedData.toString(responseEncoding);\n\n if (!responseEncoding || responseEncoding === 'utf8') {\n convertedData = utils.stripBOM(convertedData);\n }\n } else if (responseType === 'stream') {\n convertedData = stream.Readable.from(convertedData);\n }\n\n return settle(resolve, reject, {\n data: convertedData,\n status: 200,\n statusText: 'OK',\n headers: new AxiosHeaders(),\n config\n });\n }\n\n if (supportedProtocols.indexOf(protocol) === -1) {\n return reject(new AxiosError(\n 'Unsupported protocol ' + protocol,\n AxiosError.ERR_BAD_REQUEST,\n config\n ));\n }\n\n const headers = AxiosHeaders.from(config.headers).normalize();\n\n // Set User-Agent (required by some servers)\n // See https://github.com/axios/axios/issues/69\n // User-Agent is specified; handle case where no UA header is desired\n // Only set header if it hasn't been set in config\n headers.set('User-Agent', 'axios/' + VERSION, false);\n\n const onDownloadProgress = config.onDownloadProgress;\n const onUploadProgress = config.onUploadProgress;\n const maxRate = config.maxRate;\n let maxUploadRate = undefined;\n let maxDownloadRate = undefined;\n\n // support for spec compliant FormData objects\n if (utils.isSpecCompliantForm(data)) {\n const userBoundary = headers.getContentType(/boundary=([-_\\w\\d]{10,70})/i);\n\n data = formDataToStream(data, (formHeaders) => {\n headers.set(formHeaders);\n }, {\n tag: `axios-${VERSION}-boundary`,\n boundary: userBoundary && userBoundary[1] || undefined\n });\n // support for https://www.npmjs.com/package/form-data api\n } else if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) {\n headers.set(data.getHeaders());\n\n if (!headers.hasContentLength()) {\n try {\n const knownLength = await util.promisify(data.getLength).call(data);\n Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);\n /*eslint no-empty:0*/\n } catch (e) {\n }\n }\n } else if (utils.isBlob(data)) {\n data.size && headers.setContentType(data.type || 'application/octet-stream');\n headers.setContentLength(data.size || 0);\n data = stream.Readable.from(readBlob(data));\n } else if (data && !utils.isStream(data)) {\n if (Buffer.isBuffer(data)) {\n // Nothing to do...\n } else if (utils.isArrayBuffer(data)) {\n data = Buffer.from(new Uint8Array(data));\n } else if (utils.isString(data)) {\n data = Buffer.from(data, 'utf-8');\n } else {\n return reject(new AxiosError(\n 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',\n AxiosError.ERR_BAD_REQUEST,\n config\n ));\n }\n\n // Add Content-Length header if data exists\n headers.setContentLength(data.length, false);\n\n if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {\n return reject(new AxiosError(\n 'Request body larger than maxBodyLength limit',\n AxiosError.ERR_BAD_REQUEST,\n config\n ));\n }\n }\n\n const contentLength = utils.toFiniteNumber(headers.getContentLength());\n\n if (utils.isArray(maxRate)) {\n maxUploadRate = maxRate[0];\n maxDownloadRate = maxRate[1];\n } else {\n maxUploadRate = maxDownloadRate = maxRate;\n }\n\n if (data && (onUploadProgress || maxUploadRate)) {\n if (!utils.isStream(data)) {\n data = stream.Readable.from(data, {objectMode: false});\n }\n\n data = stream.pipeline([data, new AxiosTransformStream({\n length: contentLength,\n maxRate: utils.toFiniteNumber(maxUploadRate)\n })], utils.noop);\n\n onUploadProgress && data.on('progress', progress => {\n onUploadProgress(Object.assign(progress, {\n upload: true\n }));\n });\n }\n\n // HTTP basic authentication\n let auth = undefined;\n if (config.auth) {\n const username = config.auth.username || '';\n const password = config.auth.password || '';\n auth = username + ':' + password;\n }\n\n if (!auth && parsed.username) {\n const urlUsername = parsed.username;\n const urlPassword = parsed.password;\n auth = urlUsername + ':' + urlPassword;\n }\n\n auth && headers.delete('authorization');\n\n let path;\n\n try {\n path = buildURL(\n parsed.pathname + parsed.search,\n config.params,\n config.paramsSerializer\n ).replace(/^\\?/, '');\n } catch (err) {\n const customErr = new Error(err.message);\n customErr.config = config;\n customErr.url = config.url;\n customErr.exists = true;\n return reject(customErr);\n }\n\n headers.set(\n 'Accept-Encoding',\n 'gzip, compress, deflate' + (isBrotliSupported ? ', br' : ''), false\n );\n\n const options = {\n path,\n method: method,\n headers: headers.toJSON(),\n agents: { http: config.httpAgent, https: config.httpsAgent },\n auth,\n protocol,\n family,\n beforeRedirect: dispatchBeforeRedirect,\n beforeRedirects: {}\n };\n\n // cacheable-lookup integration hotfix\n !utils.isUndefined(lookup) && (options.lookup = lookup);\n\n if (config.socketPath) {\n options.socketPath = config.socketPath;\n } else {\n options.hostname = parsed.hostname;\n options.port = parsed.port;\n setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);\n }\n\n let transport;\n const isHttpsRequest = isHttps.test(options.protocol);\n options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;\n if (config.transport) {\n transport = config.transport;\n } else if (config.maxRedirects === 0) {\n transport = isHttpsRequest ? https : http;\n } else {\n if (config.maxRedirects) {\n options.maxRedirects = config.maxRedirects;\n }\n if (config.beforeRedirect) {\n options.beforeRedirects.config = config.beforeRedirect;\n }\n transport = isHttpsRequest ? httpsFollow : httpFollow;\n }\n\n if (config.maxBodyLength > -1) {\n options.maxBodyLength = config.maxBodyLength;\n } else {\n // follow-redirects does not skip comparison, so it should always succeed for axios -1 unlimited\n options.maxBodyLength = Infinity;\n }\n\n if (config.insecureHTTPParser) {\n options.insecureHTTPParser = config.insecureHTTPParser;\n }\n\n // Create the request\n req = transport.request(options, function handleResponse(res) {\n if (req.destroyed) return;\n\n const streams = [res];\n\n const responseLength = +res.headers['content-length'];\n\n if (onDownloadProgress) {\n const transformStream = new AxiosTransformStream({\n length: utils.toFiniteNumber(responseLength),\n maxRate: utils.toFiniteNumber(maxDownloadRate)\n });\n\n onDownloadProgress && transformStream.on('progress', progress => {\n onDownloadProgress(Object.assign(progress, {\n download: true\n }));\n });\n\n streams.push(transformStream);\n }\n\n // decompress the response body transparently if required\n let responseStream = res;\n\n // return the last request in case of redirects\n const lastRequest = res.req || req;\n\n // if decompress disabled we should not decompress\n if (config.decompress !== false && res.headers['content-encoding']) {\n // if no content, but headers still say that it is encoded,\n // remove the header not confuse downstream operations\n if (method === 'HEAD' || res.statusCode === 204) {\n delete res.headers['content-encoding'];\n }\n\n switch ((res.headers['content-encoding'] || '').toLowerCase()) {\n /*eslint default-case:0*/\n case 'gzip':\n case 'x-gzip':\n case 'compress':\n case 'x-compress':\n // add the unzipper to the body stream processing pipeline\n streams.push(zlib.createUnzip(zlibOptions));\n\n // remove the content-encoding in order to not confuse downstream operations\n delete res.headers['content-encoding'];\n break;\n case 'deflate':\n streams.push(new ZlibHeaderTransformStream());\n\n // add the unzipper to the body stream processing pipeline\n streams.push(zlib.createUnzip(zlibOptions));\n\n // remove the content-encoding in order to not confuse downstream operations\n delete res.headers['content-encoding'];\n break;\n case 'br':\n if (isBrotliSupported) {\n streams.push(zlib.createBrotliDecompress(brotliOptions));\n delete res.headers['content-encoding'];\n }\n }\n }\n\n responseStream = streams.length > 1 ? stream.pipeline(streams, utils.noop) : streams[0];\n\n const offListeners = stream.finished(responseStream, () => {\n offListeners();\n onFinished();\n });\n\n const response = {\n status: res.statusCode,\n statusText: res.statusMessage,\n headers: new AxiosHeaders(res.headers),\n config,\n request: lastRequest\n };\n\n if (responseType === 'stream') {\n response.data = responseStream;\n settle(resolve, reject, response);\n } else {\n const responseBuffer = [];\n let totalResponseBytes = 0;\n\n responseStream.on('data', function handleStreamData(chunk) {\n responseBuffer.push(chunk);\n totalResponseBytes += chunk.length;\n\n // make sure the content length is not over the maxContentLength if specified\n if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {\n // stream.destroy() emit aborted event before calling reject() on Node.js v16\n rejected = true;\n responseStream.destroy();\n reject(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded',\n AxiosError.ERR_BAD_RESPONSE, config, lastRequest));\n }\n });\n\n responseStream.on('aborted', function handlerStreamAborted() {\n if (rejected) {\n return;\n }\n\n const err = new AxiosError(\n 'maxContentLength size of ' + config.maxContentLength + ' exceeded',\n AxiosError.ERR_BAD_RESPONSE,\n config,\n lastRequest\n );\n responseStream.destroy(err);\n reject(err);\n });\n\n responseStream.on('error', function handleStreamError(err) {\n if (req.destroyed) return;\n reject(AxiosError.from(err, null, config, lastRequest));\n });\n\n responseStream.on('end', function handleStreamEnd() {\n try {\n let responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);\n if (responseType !== 'arraybuffer') {\n responseData = responseData.toString(responseEncoding);\n if (!responseEncoding || responseEncoding === 'utf8') {\n responseData = utils.stripBOM(responseData);\n }\n }\n response.data = responseData;\n } catch (err) {\n return reject(AxiosError.from(err, null, config, response.request, response));\n }\n settle(resolve, reject, response);\n });\n }\n\n emitter.once('abort', err => {\n if (!responseStream.destroyed) {\n responseStream.emit('error', err);\n responseStream.destroy();\n }\n });\n });\n\n emitter.once('abort', err => {\n reject(err);\n req.destroy(err);\n });\n\n // Handle errors\n req.on('error', function handleRequestError(err) {\n // @todo remove\n // if (req.aborted && err.code !== AxiosError.ERR_FR_TOO_MANY_REDIRECTS) return;\n reject(AxiosError.from(err, null, config, req));\n });\n\n // set tcp keep alive to prevent drop connection by peer\n req.on('socket', function handleRequestSocket(socket) {\n // default interval of sending ack packet is 1 minute\n socket.setKeepAlive(true, 1000 * 60);\n });\n\n // Handle request timeout\n if (config.timeout) {\n // This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.\n const timeout = parseInt(config.timeout, 10);\n\n if (Number.isNaN(timeout)) {\n reject(new AxiosError(\n 'error trying to parse `config.timeout` to int',\n AxiosError.ERR_BAD_OPTION_VALUE,\n config,\n req\n ));\n\n return;\n }\n\n // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.\n // And timer callback will be fired, and abort() will be invoked before connection, then get \"socket hang up\" and code ECONNRESET.\n // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up.\n // And then these socket which be hang up will devouring CPU little by little.\n // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.\n req.setTimeout(timeout, function handleRequestTimeout() {\n if (isDone) return;\n let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';\n const transitional = config.transitional || transitionalDefaults;\n if (config.timeoutErrorMessage) {\n timeoutErrorMessage = config.timeoutErrorMessage;\n }\n reject(new AxiosError(\n timeoutErrorMessage,\n transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,\n config,\n req\n ));\n abort();\n });\n }\n\n\n // Send the request\n if (utils.isStream(data)) {\n let ended = false;\n let errored = false;\n\n data.on('end', () => {\n ended = true;\n });\n\n data.once('error', err => {\n errored = true;\n req.destroy(err);\n });\n\n data.on('close', () => {\n if (!ended && !errored) {\n abort(new CanceledError('Request stream has been aborted', config, req));\n }\n });\n\n data.pipe(req);\n } else {\n req.end(data);\n }\n });\n}\n\nexport const __setProxy = setProxy;\n","import speedometer from \"./speedometer.js\";\nimport throttle from \"./throttle.js\";\n\nexport default (listener, isDownloadStream, freq = 3) => {\n let bytesNotified = 0;\n const _speedometer = speedometer(50, 250);\n\n return throttle(e => {\n const loaded = e.loaded;\n const total = e.lengthComputable ? e.total : undefined;\n const progressBytes = loaded - bytesNotified;\n const rate = _speedometer(progressBytes);\n const inRange = loaded <= total;\n\n bytesNotified = loaded;\n\n const data = {\n loaded,\n total,\n progress: total ? (loaded / total) : undefined,\n bytes: progressBytes,\n rate: rate ? rate : undefined,\n estimated: rate && total && inRange ? (total - loaded) / rate : undefined,\n event: e,\n lengthComputable: total != null\n };\n\n data[isDownloadStream ? 'download' : 'upload'] = true;\n\n listener(data);\n }, freq);\n}\n","'use strict';\n\nimport utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n// Standard browser envs have full support of the APIs needed to test\n// whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n const msie = /(msie|trident)/i.test(navigator.userAgent);\n const urlParsingNode = document.createElement('a');\n let originURL;\n\n /**\n * Parse a URL to discover its components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n let href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })();\n","import utils from './../utils.js';\nimport platform from '../platform/index.js';\n\nexport default platform.hasStandardBrowserEnv ?\n\n // Standard browser envs support document.cookie\n {\n write(name, value, expires, path, domain, secure) {\n const cookie = [name + '=' + encodeURIComponent(value)];\n\n utils.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());\n\n utils.isString(path) && cookie.push('path=' + path);\n\n utils.isString(domain) && cookie.push('domain=' + domain);\n\n secure === true && cookie.push('secure');\n\n document.cookie = cookie.join('; ');\n },\n\n read(name) {\n const match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n }\n\n :\n\n // Non-standard browser env (web workers, react-native) lack needed support.\n {\n write() {},\n read() {\n return null;\n },\n remove() {}\n };\n\n","'use strict';\n\nimport utils from '../utils.js';\nimport AxiosHeaders from \"./AxiosHeaders.js\";\n\nconst headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n *\n * @returns {Object} New object resulting from merging config2 to config1\n */\nexport default function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n const config = {};\n\n function getMergedValue(target, source, caseless) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge.call({caseless}, target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDeepProperties(a, b, caseless) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(a, b, caseless);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a, caseless);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function valueFromConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function defaultToConfig2(a, b) {\n if (!utils.isUndefined(b)) {\n return getMergedValue(undefined, b);\n } else if (!utils.isUndefined(a)) {\n return getMergedValue(undefined, a);\n }\n }\n\n // eslint-disable-next-line consistent-return\n function mergeDirectKeys(a, b, prop) {\n if (prop in config2) {\n return getMergedValue(a, b);\n } else if (prop in config1) {\n return getMergedValue(undefined, a);\n }\n }\n\n const mergeMap = {\n url: valueFromConfig2,\n method: valueFromConfig2,\n data: valueFromConfig2,\n baseURL: defaultToConfig2,\n transformRequest: defaultToConfig2,\n transformResponse: defaultToConfig2,\n paramsSerializer: defaultToConfig2,\n timeout: defaultToConfig2,\n timeoutMessage: defaultToConfig2,\n withCredentials: defaultToConfig2,\n withXSRFToken: defaultToConfig2,\n adapter: defaultToConfig2,\n responseType: defaultToConfig2,\n xsrfCookieName: defaultToConfig2,\n xsrfHeaderName: defaultToConfig2,\n onUploadProgress: defaultToConfig2,\n onDownloadProgress: defaultToConfig2,\n decompress: defaultToConfig2,\n maxContentLength: defaultToConfig2,\n maxBodyLength: defaultToConfig2,\n beforeRedirect: defaultToConfig2,\n transport: defaultToConfig2,\n httpAgent: defaultToConfig2,\n httpsAgent: defaultToConfig2,\n cancelToken: defaultToConfig2,\n socketPath: defaultToConfig2,\n responseEncoding: defaultToConfig2,\n validateStatus: mergeDirectKeys,\n headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)\n };\n\n utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {\n const merge = mergeMap[prop] || mergeDeepProperties;\n const configValue = merge(config1[prop], config2[prop], prop);\n (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);\n });\n\n return config;\n}\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport isURLSameOrigin from \"./isURLSameOrigin.js\";\nimport cookies from \"./cookies.js\";\nimport buildFullPath from \"../core/buildFullPath.js\";\nimport mergeConfig from \"../core/mergeConfig.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport buildURL from \"./buildURL.js\";\n\nexport default (config) => {\n const newConfig = mergeConfig({}, config);\n\n let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;\n\n newConfig.headers = headers = AxiosHeaders.from(headers);\n\n newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);\n\n // HTTP basic authentication\n if (auth) {\n headers.set('Authorization', 'Basic ' +\n btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))\n );\n }\n\n let contentType;\n\n if (utils.isFormData(data)) {\n if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {\n headers.setContentType(undefined); // Let the browser set it\n } else if ((contentType = headers.getContentType()) !== false) {\n // fix semicolon duplication issue for ReactNative FormData implementation\n const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];\n headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));\n }\n }\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n\n if (platform.hasStandardBrowserEnv) {\n withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));\n\n if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {\n // Add xsrf header\n const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);\n\n if (xsrfValue) {\n headers.set(xsrfHeaderName, xsrfValue);\n }\n }\n }\n\n return newConfig;\n}\n\n","import utils from './../utils.js';\nimport settle from './../core/settle.js';\nimport transitionalDefaults from '../defaults/transitional.js';\nimport AxiosError from '../core/AxiosError.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport parseProtocol from '../helpers/parseProtocol.js';\nimport platform from '../platform/index.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport progressEventReducer from '../helpers/progressEventReducer.js';\nimport resolveConfig from \"../helpers/resolveConfig.js\";\n\nconst isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';\n\nexport default isXHRAdapterSupported && function (config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n const _config = resolveConfig(config);\n let requestData = _config.data;\n const requestHeaders = AxiosHeaders.from(_config.headers).normalize();\n let {responseType} = _config;\n let onCanceled;\n function done() {\n if (_config.cancelToken) {\n _config.cancelToken.unsubscribe(onCanceled);\n }\n\n if (_config.signal) {\n _config.signal.removeEventListener('abort', onCanceled);\n }\n }\n\n let request = new XMLHttpRequest();\n\n request.open(_config.method.toUpperCase(), _config.url, true);\n\n // Set the request timeout in MS\n request.timeout = _config.timeout;\n\n function onloadend() {\n if (!request) {\n return;\n }\n // Prepare the response\n const responseHeaders = AxiosHeaders.from(\n 'getAllResponseHeaders' in request && request.getAllResponseHeaders()\n );\n const responseData = !responseType || responseType === 'text' || responseType === 'json' ?\n request.responseText : request.response;\n const response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config,\n request\n };\n\n settle(function _resolve(value) {\n resolve(value);\n done();\n }, function _reject(err) {\n reject(err);\n done();\n }, response);\n\n // Clean up request\n request = null;\n }\n\n if ('onloadend' in request) {\n // Use onloadend if available\n request.onloadend = onloadend;\n } else {\n // Listen for ready state to emulate onloadend\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n // readystate handler is calling before onerror or ontimeout handlers,\n // so we should call onloadend on the next 'tick'\n setTimeout(onloadend);\n };\n }\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, _config, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';\n const transitional = _config.transitional || transitionalDefaults;\n if (_config.timeoutErrorMessage) {\n timeoutErrorMessage = _config.timeoutErrorMessage;\n }\n reject(new AxiosError(\n timeoutErrorMessage,\n transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,\n _config,\n request));\n\n // Clean up request\n request = null;\n };\n\n // Remove Content-Type if data is undefined\n requestData === undefined && requestHeaders.setContentType(null);\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {\n request.setRequestHeader(key, val);\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(_config.withCredentials)) {\n request.withCredentials = !!_config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (responseType && responseType !== 'json') {\n request.responseType = _config.responseType;\n }\n\n // Handle progress if needed\n if (typeof _config.onDownloadProgress === 'function') {\n request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true));\n }\n\n // Not all browsers support upload events\n if (typeof _config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress));\n }\n\n if (_config.cancelToken || _config.signal) {\n // Handle cancellation\n // eslint-disable-next-line func-names\n onCanceled = cancel => {\n if (!request) {\n return;\n }\n reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);\n request.abort();\n request = null;\n };\n\n _config.cancelToken && _config.cancelToken.subscribe(onCanceled);\n if (_config.signal) {\n _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);\n }\n }\n\n const protocol = parseProtocol(_config.url);\n\n if (protocol && platform.protocols.indexOf(protocol) === -1) {\n reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));\n return;\n }\n\n\n // Send the request\n request.send(requestData || null);\n });\n}\n","import CanceledError from \"../cancel/CanceledError.js\";\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst composeSignals = (signals, timeout) => {\n let controller = new AbortController();\n\n let aborted;\n\n const onabort = function (cancel) {\n if (!aborted) {\n aborted = true;\n unsubscribe();\n const err = cancel instanceof Error ? cancel : this.reason;\n controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));\n }\n }\n\n let timer = timeout && setTimeout(() => {\n onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT))\n }, timeout)\n\n const unsubscribe = () => {\n if (signals) {\n timer && clearTimeout(timer);\n timer = null;\n signals.forEach(signal => {\n signal &&\n (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));\n });\n signals = null;\n }\n }\n\n signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort));\n\n const {signal} = controller;\n\n signal.unsubscribe = unsubscribe;\n\n return [signal, () => {\n timer && clearTimeout(timer);\n timer = null;\n }];\n}\n\nexport default composeSignals;\n","\n\nexport const streamChunk = function* (chunk, chunkSize) {\n let len = chunk.byteLength;\n\n if (!chunkSize || len < chunkSize) {\n yield chunk;\n return;\n }\n\n let pos = 0;\n let end;\n\n while (pos < len) {\n end = pos + chunkSize;\n yield chunk.slice(pos, end);\n pos = end;\n }\n}\n\nexport const readBytes = async function* (iterable, chunkSize, encode) {\n for await (const chunk of iterable) {\n yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);\n }\n}\n\nexport const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {\n const iterator = readBytes(stream, chunkSize, encode);\n\n let bytes = 0;\n\n return new ReadableStream({\n type: 'bytes',\n\n async pull(controller) {\n const {done, value} = await iterator.next();\n\n if (done) {\n controller.close();\n onFinish();\n return;\n }\n\n let len = value.byteLength;\n onProgress && onProgress(bytes += len);\n controller.enqueue(new Uint8Array(value));\n },\n cancel(reason) {\n onFinish(reason);\n return iterator.return();\n }\n }, {\n highWaterMark: 2\n })\n}\n","import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport AxiosError from \"../core/AxiosError.js\";\nimport composeSignals from \"../helpers/composeSignals.js\";\nimport {trackStream} from \"../helpers/trackStream.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport progressEventReducer from \"../helpers/progressEventReducer.js\";\nimport resolveConfig from \"../helpers/resolveConfig.js\";\nimport settle from \"../core/settle.js\";\n\nconst fetchProgressDecorator = (total, fn) => {\n const lengthComputable = total != null;\n return (loaded) => setTimeout(() => fn({\n lengthComputable,\n total,\n loaded\n }));\n}\n\nconst isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';\nconst isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';\n\n// used only inside the fetch adapter\nconst encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?\n ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :\n async (str) => new Uint8Array(await new Response(str).arrayBuffer())\n);\n\nconst supportsRequestStream = isReadableStreamSupported && (() => {\n let duplexAccessed = false;\n\n const hasContentType = new Request(platform.origin, {\n body: new ReadableStream(),\n method: 'POST',\n get duplex() {\n duplexAccessed = true;\n return 'half';\n },\n }).headers.has('Content-Type');\n\n return duplexAccessed && !hasContentType;\n})();\n\nconst DEFAULT_CHUNK_SIZE = 64 * 1024;\n\nconst supportsResponseStream = isReadableStreamSupported && !!(()=> {\n try {\n return utils.isReadableStream(new Response('').body);\n } catch(err) {\n // return undefined\n }\n})();\n\nconst resolvers = {\n stream: supportsResponseStream && ((res) => res.body)\n};\n\nisFetchSupported && (((res) => {\n ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {\n !resolvers[type] && (resolvers[type] = utils.isFunction(res[type]) ? (res) => res[type]() :\n (_, config) => {\n throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);\n })\n });\n})(new Response));\n\nconst getBodyLength = async (body) => {\n if (body == null) {\n return 0;\n }\n\n if(utils.isBlob(body)) {\n return body.size;\n }\n\n if(utils.isSpecCompliantForm(body)) {\n return (await new Request(body).arrayBuffer()).byteLength;\n }\n\n if(utils.isArrayBufferView(body)) {\n return body.byteLength;\n }\n\n if(utils.isURLSearchParams(body)) {\n body = body + '';\n }\n\n if(utils.isString(body)) {\n return (await encodeText(body)).byteLength;\n }\n}\n\nconst resolveBodyLength = async (headers, body) => {\n const length = utils.toFiniteNumber(headers.getContentLength());\n\n return length == null ? getBodyLength(body) : length;\n}\n\nexport default isFetchSupported && (async (config) => {\n let {\n url,\n method,\n data,\n signal,\n cancelToken,\n timeout,\n onDownloadProgress,\n onUploadProgress,\n responseType,\n headers,\n withCredentials = 'same-origin',\n fetchOptions\n } = resolveConfig(config);\n\n responseType = responseType ? (responseType + '').toLowerCase() : 'text';\n\n let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ?\n composeSignals([signal, cancelToken], timeout) : [];\n\n let finished, request;\n\n const onFinish = () => {\n !finished && setTimeout(() => {\n composedSignal && composedSignal.unsubscribe();\n });\n\n finished = true;\n }\n\n let requestContentLength;\n\n try {\n if (\n onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&\n (requestContentLength = await resolveBodyLength(headers, data)) !== 0\n ) {\n let _request = new Request(url, {\n method: 'POST',\n body: data,\n duplex: \"half\"\n });\n\n let contentTypeHeader;\n\n if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {\n headers.setContentType(contentTypeHeader)\n }\n\n if (_request.body) {\n data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator(\n requestContentLength,\n progressEventReducer(onUploadProgress)\n ), null, encodeText);\n }\n }\n\n if (!utils.isString(withCredentials)) {\n withCredentials = withCredentials ? 'cors' : 'omit';\n }\n\n request = new Request(url, {\n ...fetchOptions,\n signal: composedSignal,\n method: method.toUpperCase(),\n headers: headers.normalize().toJSON(),\n body: data,\n duplex: \"half\",\n withCredentials\n });\n\n let response = await fetch(request);\n\n const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');\n\n if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {\n const options = {};\n\n ['status', 'statusText', 'headers'].forEach(prop => {\n options[prop] = response[prop];\n });\n\n const responseContentLength = utils.toFiniteNumber(response.headers.get('content-length'));\n\n response = new Response(\n trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator(\n responseContentLength,\n progressEventReducer(onDownloadProgress, true)\n ), isStreamResponse && onFinish, encodeText),\n options\n );\n }\n\n responseType = responseType || 'text';\n\n let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](response, config);\n\n !isStreamResponse && onFinish();\n\n stopTimeout && stopTimeout();\n\n return await new Promise((resolve, reject) => {\n settle(resolve, reject, {\n data: responseData,\n headers: AxiosHeaders.from(response.headers),\n status: response.status,\n statusText: response.statusText,\n config,\n request\n })\n })\n } catch (err) {\n onFinish();\n\n if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {\n throw Object.assign(\n new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),\n {\n cause: err.cause || err\n }\n )\n }\n\n throw AxiosError.from(err, err && err.code, config, request);\n }\n});\n\n\n","import utils from '../utils.js';\nimport httpAdapter from './http.js';\nimport xhrAdapter from './xhr.js';\nimport fetchAdapter from './fetch.js';\nimport AxiosError from \"../core/AxiosError.js\";\n\nconst knownAdapters = {\n http: httpAdapter,\n xhr: xhrAdapter,\n fetch: fetchAdapter\n}\n\nutils.forEach(knownAdapters, (fn, value) => {\n if (fn) {\n try {\n Object.defineProperty(fn, 'name', {value});\n } catch (e) {\n // eslint-disable-next-line no-empty\n }\n Object.defineProperty(fn, 'adapterName', {value});\n }\n});\n\nconst renderReason = (reason) => `- ${reason}`;\n\nconst isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;\n\nexport default {\n getAdapter: (adapters) => {\n adapters = utils.isArray(adapters) ? adapters : [adapters];\n\n const {length} = adapters;\n let nameOrAdapter;\n let adapter;\n\n const rejectedReasons = {};\n\n for (let i = 0; i < length; i++) {\n nameOrAdapter = adapters[i];\n let id;\n\n adapter = nameOrAdapter;\n\n if (!isResolvedHandle(nameOrAdapter)) {\n adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];\n\n if (adapter === undefined) {\n throw new AxiosError(`Unknown adapter '${id}'`);\n }\n }\n\n if (adapter) {\n break;\n }\n\n rejectedReasons[id || '#' + i] = adapter;\n }\n\n if (!adapter) {\n\n const reasons = Object.entries(rejectedReasons)\n .map(([id, state]) => `adapter ${id} ` +\n (state === false ? 'is not supported by the environment' : 'is not available in the build')\n );\n\n let s = length ?\n (reasons.length > 1 ? 'since :\\n' + reasons.map(renderReason).join('\\n') : ' ' + renderReason(reasons[0])) :\n 'as no adapter specified';\n\n throw new AxiosError(\n `There is no suitable adapter to dispatch the request ` + s,\n 'ERR_NOT_SUPPORT'\n );\n }\n\n return adapter;\n },\n adapters: knownAdapters\n}\n","'use strict';\n\nimport transformData from './transformData.js';\nimport isCancel from '../cancel/isCancel.js';\nimport defaults from '../defaults/index.js';\nimport CanceledError from '../cancel/CanceledError.js';\nimport AxiosHeaders from '../core/AxiosHeaders.js';\nimport adapters from \"../adapters/adapters.js\";\n\n/**\n * Throws a `CanceledError` if cancellation has been requested.\n *\n * @param {Object} config The config that is to be used for the request\n *\n * @returns {void}\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n\n if (config.signal && config.signal.aborted) {\n throw new CanceledError(null, config);\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n *\n * @returns {Promise} The Promise to be fulfilled\n */\nexport default function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n config.headers = AxiosHeaders.from(config.headers);\n\n // Transform request data\n config.data = transformData.call(\n config,\n config.transformRequest\n );\n\n if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {\n config.headers.setContentType('application/x-www-form-urlencoded', false);\n }\n\n const adapter = adapters.getAdapter(config.adapter || defaults.adapter);\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData.call(\n config,\n config.transformResponse,\n response\n );\n\n response.headers = AxiosHeaders.from(response.headers);\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData.call(\n config,\n config.transformResponse,\n reason.response\n );\n reason.response.headers = AxiosHeaders.from(reason.response.headers);\n }\n }\n\n return Promise.reject(reason);\n });\n}\n","'use strict';\n\nimport {VERSION} from '../env/data.js';\nimport AxiosError from '../core/AxiosError.js';\n\nconst validators = {};\n\n// eslint-disable-next-line func-names\n['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {\n validators[type] = function validator(thing) {\n return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;\n };\n});\n\nconst deprecatedWarnings = {};\n\n/**\n * Transitional option validator\n *\n * @param {function|boolean?} validator - set to false if the transitional option has been removed\n * @param {string?} version - deprecated version / removed since version\n * @param {string?} message - some message with additional info\n *\n * @returns {function}\n */\nvalidators.transitional = function transitional(validator, version, message) {\n function formatMessage(opt, desc) {\n return '[Axios v' + VERSION + '] Transitional option \\'' + opt + '\\'' + desc + (message ? '. ' + message : '');\n }\n\n // eslint-disable-next-line func-names\n return (value, opt, opts) => {\n if (validator === false) {\n throw new AxiosError(\n formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),\n AxiosError.ERR_DEPRECATED\n );\n }\n\n if (version && !deprecatedWarnings[opt]) {\n deprecatedWarnings[opt] = true;\n // eslint-disable-next-line no-console\n console.warn(\n formatMessage(\n opt,\n ' has been deprecated since v' + version + ' and will be removed in the near future'\n )\n );\n }\n\n return validator ? validator(value, opt, opts) : true;\n };\n};\n\n/**\n * Assert object's properties type\n *\n * @param {object} options\n * @param {object} schema\n * @param {boolean?} allowUnknown\n *\n * @returns {object}\n */\n\nfunction assertOptions(options, schema, allowUnknown) {\n if (typeof options !== 'object') {\n throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);\n }\n const keys = Object.keys(options);\n let i = keys.length;\n while (i-- > 0) {\n const opt = keys[i];\n const validator = schema[opt];\n if (validator) {\n const value = options[opt];\n const result = value === undefined || validator(value, opt, options);\n if (result !== true) {\n throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);\n }\n continue;\n }\n if (allowUnknown !== true) {\n throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);\n }\n }\n}\n\nexport default {\n assertOptions,\n validators\n};\n","'use strict';\n\nimport utils from './../utils.js';\nimport buildURL from '../helpers/buildURL.js';\nimport InterceptorManager from './InterceptorManager.js';\nimport dispatchRequest from './dispatchRequest.js';\nimport mergeConfig from './mergeConfig.js';\nimport buildFullPath from './buildFullPath.js';\nimport validator from '../helpers/validator.js';\nimport AxiosHeaders from './AxiosHeaders.js';\n\nconst validators = validator.validators;\n\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n *\n * @return {Axios} A new instance of Axios\n */\nclass Axios {\n constructor(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n }\n\n /**\n * Dispatch a request\n *\n * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)\n * @param {?Object} config\n *\n * @returns {Promise} The Promise to be fulfilled\n */\n async request(configOrUrl, config) {\n try {\n return await this._request(configOrUrl, config);\n } catch (err) {\n if (err instanceof Error) {\n let dummy;\n\n Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error());\n\n // slice off the Error: ... line\n const stack = dummy.stack ? dummy.stack.replace(/^.+\\n/, '') : '';\n try {\n if (!err.stack) {\n err.stack = stack;\n // match without the 2 top stack lines\n } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\\n.+\\n/, ''))) {\n err.stack += '\\n' + stack\n }\n } catch (e) {\n // ignore the case where \"stack\" is an un-writable property\n }\n }\n\n throw err;\n }\n }\n\n _request(configOrUrl, config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof configOrUrl === 'string') {\n config = config || {};\n config.url = configOrUrl;\n } else {\n config = configOrUrl || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n const {transitional, paramsSerializer, headers} = config;\n\n if (transitional !== undefined) {\n validator.assertOptions(transitional, {\n silentJSONParsing: validators.transitional(validators.boolean),\n forcedJSONParsing: validators.transitional(validators.boolean),\n clarifyTimeoutError: validators.transitional(validators.boolean)\n }, false);\n }\n\n if (paramsSerializer != null) {\n if (utils.isFunction(paramsSerializer)) {\n config.paramsSerializer = {\n serialize: paramsSerializer\n }\n } else {\n validator.assertOptions(paramsSerializer, {\n encode: validators.function,\n serialize: validators.function\n }, true);\n }\n }\n\n // Set config.method\n config.method = (config.method || this.defaults.method || 'get').toLowerCase();\n\n // Flatten headers\n let contextHeaders = headers && utils.merge(\n headers.common,\n headers[config.method]\n );\n\n headers && utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n (method) => {\n delete headers[method];\n }\n );\n\n config.headers = AxiosHeaders.concat(contextHeaders, headers);\n\n // filter out skipped interceptors\n const requestInterceptorChain = [];\n let synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n const responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n let promise;\n let i = 0;\n let len;\n\n if (!synchronousRequestInterceptors) {\n const chain = [dispatchRequest.bind(this), undefined];\n chain.unshift.apply(chain, requestInterceptorChain);\n chain.push.apply(chain, responseInterceptorChain);\n len = chain.length;\n\n promise = Promise.resolve(config);\n\n while (i < len) {\n promise = promise.then(chain[i++], chain[i++]);\n }\n\n return promise;\n }\n\n len = requestInterceptorChain.length;\n\n let newConfig = config;\n\n i = 0;\n\n while (i < len) {\n const onFulfilled = requestInterceptorChain[i++];\n const onRejected = requestInterceptorChain[i++];\n try {\n newConfig = onFulfilled(newConfig);\n } catch (error) {\n onRejected.call(this, error);\n break;\n }\n }\n\n try {\n promise = dispatchRequest.call(this, newConfig);\n } catch (error) {\n return Promise.reject(error);\n }\n\n i = 0;\n len = responseInterceptorChain.length;\n\n while (i < len) {\n promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);\n }\n\n return promise;\n }\n\n getUri(config) {\n config = mergeConfig(this.defaults, config);\n const fullPath = buildFullPath(config.baseURL, config.url);\n return buildURL(fullPath, config.params, config.paramsSerializer);\n }\n}\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n\n function generateHTTPMethod(isForm) {\n return function httpMethod(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method,\n headers: isForm ? {\n 'Content-Type': 'multipart/form-data'\n } : {},\n url,\n data\n }));\n };\n }\n\n Axios.prototype[method] = generateHTTPMethod();\n\n Axios.prototype[method + 'Form'] = generateHTTPMethod(true);\n});\n\nexport default Axios;\n","'use strict';\n\nimport CanceledError from './CanceledError.js';\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @param {Function} executor The executor function.\n *\n * @returns {CancelToken}\n */\nclass CancelToken {\n constructor(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n let resolvePromise;\n\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n const token = this;\n\n // eslint-disable-next-line func-names\n this.promise.then(cancel => {\n if (!token._listeners) return;\n\n let i = token._listeners.length;\n\n while (i-- > 0) {\n token._listeners[i](cancel);\n }\n token._listeners = null;\n });\n\n // eslint-disable-next-line func-names\n this.promise.then = onfulfilled => {\n let _resolve;\n // eslint-disable-next-line func-names\n const promise = new Promise(resolve => {\n token.subscribe(resolve);\n _resolve = resolve;\n }).then(onfulfilled);\n\n promise.cancel = function reject() {\n token.unsubscribe(_resolve);\n };\n\n return promise;\n };\n\n executor(function cancel(message, config, request) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new CanceledError(message, config, request);\n resolvePromise(token.reason);\n });\n }\n\n /**\n * Throws a `CanceledError` if cancellation has been requested.\n */\n throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n }\n\n /**\n * Subscribe to the cancel signal\n */\n\n subscribe(listener) {\n if (this.reason) {\n listener(this.reason);\n return;\n }\n\n if (this._listeners) {\n this._listeners.push(listener);\n } else {\n this._listeners = [listener];\n }\n }\n\n /**\n * Unsubscribe from the cancel signal\n */\n\n unsubscribe(listener) {\n if (!this._listeners) {\n return;\n }\n const index = this._listeners.indexOf(listener);\n if (index !== -1) {\n this._listeners.splice(index, 1);\n }\n }\n\n /**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\n static source() {\n let cancel;\n const token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token,\n cancel\n };\n }\n}\n\nexport default CancelToken;\n","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n *\n * @returns {Function}\n */\nexport default function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n}\n","'use strict';\n\nimport utils from './../utils.js';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n *\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nexport default function isAxiosError(payload) {\n return utils.isObject(payload) && (payload.isAxiosError === true);\n}\n","const HttpStatusCode = {\n Continue: 100,\n SwitchingProtocols: 101,\n Processing: 102,\n EarlyHints: 103,\n Ok: 200,\n Created: 201,\n Accepted: 202,\n NonAuthoritativeInformation: 203,\n NoContent: 204,\n ResetContent: 205,\n PartialContent: 206,\n MultiStatus: 207,\n AlreadyReported: 208,\n ImUsed: 226,\n MultipleChoices: 300,\n MovedPermanently: 301,\n Found: 302,\n SeeOther: 303,\n NotModified: 304,\n UseProxy: 305,\n Unused: 306,\n TemporaryRedirect: 307,\n PermanentRedirect: 308,\n BadRequest: 400,\n Unauthorized: 401,\n PaymentRequired: 402,\n Forbidden: 403,\n NotFound: 404,\n MethodNotAllowed: 405,\n NotAcceptable: 406,\n ProxyAuthenticationRequired: 407,\n RequestTimeout: 408,\n Conflict: 409,\n Gone: 410,\n LengthRequired: 411,\n PreconditionFailed: 412,\n PayloadTooLarge: 413,\n UriTooLong: 414,\n UnsupportedMediaType: 415,\n RangeNotSatisfiable: 416,\n ExpectationFailed: 417,\n ImATeapot: 418,\n MisdirectedRequest: 421,\n UnprocessableEntity: 422,\n Locked: 423,\n FailedDependency: 424,\n TooEarly: 425,\n UpgradeRequired: 426,\n PreconditionRequired: 428,\n TooManyRequests: 429,\n RequestHeaderFieldsTooLarge: 431,\n UnavailableForLegalReasons: 451,\n InternalServerError: 500,\n NotImplemented: 501,\n BadGateway: 502,\n ServiceUnavailable: 503,\n GatewayTimeout: 504,\n HttpVersionNotSupported: 505,\n VariantAlsoNegotiates: 506,\n InsufficientStorage: 507,\n LoopDetected: 508,\n NotExtended: 510,\n NetworkAuthenticationRequired: 511,\n};\n\nObject.entries(HttpStatusCode).forEach(([key, value]) => {\n HttpStatusCode[value] = key;\n});\n\nexport default HttpStatusCode;\n","'use strict';\n\nimport utils from './utils.js';\nimport bind from './helpers/bind.js';\nimport Axios from './core/Axios.js';\nimport mergeConfig from './core/mergeConfig.js';\nimport defaults from './defaults/index.js';\nimport formDataToJSON from './helpers/formDataToJSON.js';\nimport CanceledError from './cancel/CanceledError.js';\nimport CancelToken from './cancel/CancelToken.js';\nimport isCancel from './cancel/isCancel.js';\nimport {VERSION} from './env/data.js';\nimport toFormData from './helpers/toFormData.js';\nimport AxiosError from './core/AxiosError.js';\nimport spread from './helpers/spread.js';\nimport isAxiosError from './helpers/isAxiosError.js';\nimport AxiosHeaders from \"./core/AxiosHeaders.js\";\nimport adapters from './adapters/adapters.js';\nimport HttpStatusCode from './helpers/HttpStatusCode.js';\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n *\n * @returns {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n const context = new Axios(defaultConfig);\n const instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});\n\n // Copy context to instance\n utils.extend(instance, context, null, {allOwnKeys: true});\n\n // Factory for creating new instances\n instance.create = function create(instanceConfig) {\n return createInstance(mergeConfig(defaultConfig, instanceConfig));\n };\n\n return instance;\n}\n\n// Create the default instance to be exported\nconst axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Expose Cancel & CancelToken\naxios.CanceledError = CanceledError;\naxios.CancelToken = CancelToken;\naxios.isCancel = isCancel;\naxios.VERSION = VERSION;\naxios.toFormData = toFormData;\n\n// Expose AxiosError class\naxios.AxiosError = AxiosError;\n\n// alias for CanceledError for backward compatibility\naxios.Cancel = axios.CanceledError;\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\n\naxios.spread = spread;\n\n// Expose isAxiosError\naxios.isAxiosError = isAxiosError;\n\n// Expose mergeConfig\naxios.mergeConfig = mergeConfig;\n\naxios.AxiosHeaders = AxiosHeaders;\n\naxios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);\n\naxios.getAdapter = adapters.getAdapter;\n\naxios.HttpStatusCode = HttpStatusCode;\n\naxios.default = axios;\n\n// this module should only have a default export\nexport default axios\n"],"names":["utils","prototype","PlatformFormData","encode","url","FormData","platform","defaults","AxiosHeaders","stream","TextEncoder","readBlob","Readable","zlib","followRedirects","getProxyForUrl","callbackify","EventEmitter","formDataToStream","util","AxiosTransformStream","https","http","ZlibHeaderTransformStream","composeSignals","validators","InterceptorManager","Axios","CancelToken","HttpStatusCode"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEe,SAAS,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE;AAC1C,EAAE,OAAO,SAAS,IAAI,GAAG;AACzB,IAAI,OAAO,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AACxC,GAAG,CAAC;AACJ;;ACFA;AACA;AACA,MAAM,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC;AACpC,MAAM,CAAC,cAAc,CAAC,GAAG,MAAM,CAAC;AAChC;AACA,MAAM,MAAM,GAAG,CAAC,KAAK,IAAI,KAAK,IAAI;AAClC,IAAI,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACrC,IAAI,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,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.cts b/project starter code/node_modules/axios/index.d.cts new file mode 100644 index 00000000..7d12dd32 --- /dev/null +++ b/project starter code/node_modules/axios/index.d.cts @@ -0,0 +1,545 @@ +interface RawAxiosHeaders { + [key: string]: axios.AxiosHeaderValue; +} + +type MethodsHeaders = Partial<{ + [Key in axios.Method as Lowercase]: AxiosHeaders; +} & {common: AxiosHeaders}>; + +type AxiosHeaderMatcher = (this: AxiosHeaders, value: string, name: string, headers: RawAxiosHeaders) => boolean; + +type AxiosHeaderParser = (this: AxiosHeaders, value: axios.AxiosHeaderValue, header: string) => any; + +type CommonRequestHeadersList = 'Accept' | 'Content-Length' | 'User-Agent'| 'Content-Encoding' | 'Authorization'; + +type ContentType = axios.AxiosHeaderValue | 'text/html' | 'text/plain' | 'multipart/form-data' | 'application/json' | 'application/x-www-form-urlencoded' | 'application/octet-stream'; + +type CommonResponseHeadersList = 'Server' | 'Content-Type' | 'Content-Length' | 'Cache-Control'| 'Content-Encoding'; + +declare class AxiosHeaders { + constructor( + headers?: RawAxiosHeaders | AxiosHeaders | string + ); + + [key: string]: any; + + set(headerName?: string, value?: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders; + + get(headerName: string, parser: RegExp): RegExpExecArray | null; + get(headerName: string, matcher?: true | AxiosHeaderParser): axios.AxiosHeaderValue; + + has(header: string, matcher?: AxiosHeaderMatcher): boolean; + + delete(header: string | string[], matcher?: AxiosHeaderMatcher): boolean; + + clear(matcher?: AxiosHeaderMatcher): boolean; + + normalize(format: boolean): AxiosHeaders; + + concat(...targets: Array): AxiosHeaders; + + toJSON(asStrings?: boolean): RawAxiosHeaders; + + static from(thing?: AxiosHeaders | RawAxiosHeaders | string): AxiosHeaders; + + static accessor(header: string | string[]): AxiosHeaders; + + static concat(...targets: Array): AxiosHeaders; + + setContentType(value: ContentType, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getContentType(parser?: RegExp): RegExpExecArray | null; + getContentType(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue; + hasContentType(matcher?: AxiosHeaderMatcher): boolean; + + setContentLength(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getContentLength(parser?: RegExp): RegExpExecArray | null; + getContentLength(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue; + hasContentLength(matcher?: AxiosHeaderMatcher): boolean; + + setAccept(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getAccept(parser?: RegExp): RegExpExecArray | null; + getAccept(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue; + hasAccept(matcher?: AxiosHeaderMatcher): boolean; + + setUserAgent(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getUserAgent(parser?: RegExp): RegExpExecArray | null; + getUserAgent(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue; + hasUserAgent(matcher?: AxiosHeaderMatcher): boolean; + + setContentEncoding(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getContentEncoding(parser?: RegExp): RegExpExecArray | null; + getContentEncoding(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue; + hasContentEncoding(matcher?: AxiosHeaderMatcher): boolean; + + setAuthorization(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getAuthorization(parser?: RegExp): RegExpExecArray | null; + getAuthorization(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue; + hasAuthorization(matcher?: AxiosHeaderMatcher): boolean; + + [Symbol.iterator](): IterableIterator<[string, axios.AxiosHeaderValue]>; +} + +declare class AxiosError extends Error { + constructor( + message?: string, + code?: string, + config?: axios.InternalAxiosRequestConfig, + request?: any, + response?: axios.AxiosResponse + ); + + config?: axios.InternalAxiosRequestConfig; + code?: string; + request?: any; + response?: axios.AxiosResponse; + isAxiosError: boolean; + status?: number; + toJSON: () => object; + cause?: Error; + static readonly ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS"; + static readonly ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE"; + static readonly ERR_BAD_OPTION = "ERR_BAD_OPTION"; + static readonly ERR_NETWORK = "ERR_NETWORK"; + static readonly ERR_DEPRECATED = "ERR_DEPRECATED"; + static readonly ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE"; + static readonly ERR_BAD_REQUEST = "ERR_BAD_REQUEST"; + static readonly ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT"; + static readonly ERR_INVALID_URL = "ERR_INVALID_URL"; + static readonly ERR_CANCELED = "ERR_CANCELED"; + static readonly ECONNABORTED = "ECONNABORTED"; + static readonly ETIMEDOUT = "ETIMEDOUT"; +} + +declare class CanceledError extends AxiosError { +} + +declare class Axios { + constructor(config?: axios.AxiosRequestConfig); + defaults: axios.AxiosDefaults; + interceptors: { + request: axios.AxiosInterceptorManager; + response: axios.AxiosInterceptorManager; + }; + getUri(config?: axios.AxiosRequestConfig): string; + request, D = any>(config: axios.AxiosRequestConfig): Promise; + get, D = any>(url: string, config?: axios.AxiosRequestConfig): Promise; + delete, D = any>(url: string, config?: axios.AxiosRequestConfig): Promise; + head, D = any>(url: string, config?: axios.AxiosRequestConfig): Promise; + options, D = any>(url: string, config?: axios.AxiosRequestConfig): Promise; + post, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig): Promise; + put, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig): Promise; + patch, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig): Promise; + postForm, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig): Promise; + putForm, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig): Promise; + patchForm, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig): Promise; +} + +declare enum HttpStatusCode { + Continue = 100, + SwitchingProtocols = 101, + Processing = 102, + EarlyHints = 103, + Ok = 200, + Created = 201, + Accepted = 202, + NonAuthoritativeInformation = 203, + NoContent = 204, + ResetContent = 205, + PartialContent = 206, + MultiStatus = 207, + AlreadyReported = 208, + ImUsed = 226, + MultipleChoices = 300, + MovedPermanently = 301, + Found = 302, + SeeOther = 303, + NotModified = 304, + UseProxy = 305, + Unused = 306, + TemporaryRedirect = 307, + PermanentRedirect = 308, + BadRequest = 400, + Unauthorized = 401, + PaymentRequired = 402, + Forbidden = 403, + NotFound = 404, + MethodNotAllowed = 405, + NotAcceptable = 406, + ProxyAuthenticationRequired = 407, + RequestTimeout = 408, + Conflict = 409, + Gone = 410, + LengthRequired = 411, + PreconditionFailed = 412, + PayloadTooLarge = 413, + UriTooLong = 414, + UnsupportedMediaType = 415, + RangeNotSatisfiable = 416, + ExpectationFailed = 417, + ImATeapot = 418, + MisdirectedRequest = 421, + UnprocessableEntity = 422, + Locked = 423, + FailedDependency = 424, + TooEarly = 425, + UpgradeRequired = 426, + PreconditionRequired = 428, + TooManyRequests = 429, + RequestHeaderFieldsTooLarge = 431, + UnavailableForLegalReasons = 451, + InternalServerError = 500, + NotImplemented = 501, + BadGateway = 502, + ServiceUnavailable = 503, + GatewayTimeout = 504, + HttpVersionNotSupported = 505, + VariantAlsoNegotiates = 506, + InsufficientStorage = 507, + LoopDetected = 508, + NotExtended = 510, + NetworkAuthenticationRequired = 511, +} + +type InternalAxiosError = AxiosError; + +declare namespace axios { + type AxiosError = InternalAxiosError; + + type RawAxiosRequestHeaders = Partial; + + type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders; + + type AxiosHeaderValue = AxiosHeaders | string | string[] | number | boolean | null; + + type RawCommonResponseHeaders = { + [Key in CommonResponseHeadersList]: AxiosHeaderValue; + } & { + "set-cookie": string[]; + }; + + type RawAxiosResponseHeaders = Partial; + + type AxiosResponseHeaders = RawAxiosResponseHeaders & AxiosHeaders; + + interface AxiosRequestTransformer { + (this: InternalAxiosRequestConfig, data: any, headers: AxiosRequestHeaders): any; + } + + interface AxiosResponseTransformer { + (this: InternalAxiosRequestConfig, data: any, headers: AxiosResponseHeaders, status?: number): any; + } + + interface AxiosAdapter { + (config: InternalAxiosRequestConfig): AxiosPromise; + } + + interface AxiosBasicCredentials { + username: string; + password: string; + } + + interface AxiosProxyConfig { + host: string; + port: number; + auth?: AxiosBasicCredentials; + protocol?: string; + } + + type Method = + | 'get' | 'GET' + | 'delete' | 'DELETE' + | 'head' | 'HEAD' + | 'options' | 'OPTIONS' + | 'post' | 'POST' + | 'put' | 'PUT' + | 'patch' | 'PATCH' + | 'purge' | 'PURGE' + | 'link' | 'LINK' + | 'unlink' | 'UNLINK'; + + type ResponseType = + | 'arraybuffer' + | 'blob' + | 'document' + | 'json' + | 'text' + | 'stream' + | 'formdata'; + + type responseEncoding = + | 'ascii' | 'ASCII' + | 'ansi' | 'ANSI' + | 'binary' | 'BINARY' + | 'base64' | 'BASE64' + | 'base64url' | 'BASE64URL' + | 'hex' | 'HEX' + | 'latin1' | 'LATIN1' + | 'ucs-2' | 'UCS-2' + | 'ucs2' | 'UCS2' + | 'utf-8' | 'UTF-8' + | 'utf8' | 'UTF8' + | 'utf16le' | 'UTF16LE'; + + interface TransitionalOptions { + silentJSONParsing?: boolean; + forcedJSONParsing?: boolean; + clarifyTimeoutError?: boolean; + } + + interface GenericAbortSignal { + readonly aborted: boolean; + onabort?: ((...args: any) => any) | null; + addEventListener?: (...args: any) => any; + removeEventListener?: (...args: any) => any; + } + + interface FormDataVisitorHelpers { + defaultVisitor: SerializerVisitor; + convertValue: (value: any) => any; + isVisitable: (value: any) => boolean; + } + + interface SerializerVisitor { + ( + this: GenericFormData, + value: any, + key: string | number, + path: null | Array, + helpers: FormDataVisitorHelpers + ): boolean; + } + + interface SerializerOptions { + visitor?: SerializerVisitor; + dots?: boolean; + metaTokens?: boolean; + indexes?: boolean | null; + } + + // tslint:disable-next-line + interface FormSerializerOptions extends SerializerOptions { + } + + interface ParamEncoder { + (value: any, defaultEncoder: (value: any) => any): any; + } + + interface CustomParamsSerializer { + (params: Record, options?: ParamsSerializerOptions): string; + } + + interface ParamsSerializerOptions extends SerializerOptions { + encode?: ParamEncoder; + serialize?: CustomParamsSerializer; + } + + type MaxUploadRate = number; + + type MaxDownloadRate = number; + + type BrowserProgressEvent = any; + + interface AxiosProgressEvent { + loaded: number; + total?: number; + progress?: number; + bytes: number; + rate?: number; + estimated?: number; + upload?: boolean; + download?: boolean; + event?: BrowserProgressEvent; + lengthComputable: boolean; + } + + type Milliseconds = number; + + type AxiosAdapterName = 'fetch' | 'xhr' | 'http' | string; + + type AxiosAdapterConfig = AxiosAdapter | AxiosAdapterName; + + type AddressFamily = 4 | 6 | undefined; + + interface LookupAddressEntry { + address: string; + family?: AddressFamily; + } + + type LookupAddress = string | LookupAddressEntry; + + interface AxiosRequestConfig { + url?: string; + method?: Method | string; + baseURL?: string; + transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[]; + transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[]; + headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHeaders; + params?: any; + paramsSerializer?: ParamsSerializerOptions | CustomParamsSerializer; + data?: D; + timeout?: Milliseconds; + timeoutErrorMessage?: string; + withCredentials?: boolean; + adapter?: AxiosAdapterConfig | AxiosAdapterConfig[]; + auth?: AxiosBasicCredentials; + responseType?: ResponseType; + responseEncoding?: responseEncoding | string; + xsrfCookieName?: string; + xsrfHeaderName?: string; + onUploadProgress?: (progressEvent: AxiosProgressEvent) => void; + onDownloadProgress?: (progressEvent: AxiosProgressEvent) => void; + maxContentLength?: number; + validateStatus?: ((status: number) => boolean) | null; + maxBodyLength?: number; + maxRedirects?: number; + maxRate?: number | [MaxUploadRate, MaxDownloadRate]; + beforeRedirect?: (options: Record, responseDetails: {headers: Record, statusCode: HttpStatusCode}) => void; + socketPath?: string | null; + transport?: any; + httpAgent?: any; + httpsAgent?: any; + proxy?: AxiosProxyConfig | false; + cancelToken?: CancelToken; + decompress?: boolean; + transitional?: TransitionalOptions; + signal?: GenericAbortSignal; + insecureHTTPParser?: boolean; + env?: { + FormData?: new (...args: any[]) => object; + }; + formSerializer?: FormSerializerOptions; + family?: AddressFamily; + lookup?: ((hostname: string, options: object, cb: (err: Error | null, address: LookupAddress | LookupAddress[], family?: AddressFamily) => void) => void) | + ((hostname: string, options: object) => Promise<[address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress>); + withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined); + fetchOptions?: Record; + } + + // Alias + type RawAxiosRequestConfig = AxiosRequestConfig; + + interface InternalAxiosRequestConfig extends AxiosRequestConfig { + headers: AxiosRequestHeaders; + } + + interface HeadersDefaults { + common: RawAxiosRequestHeaders; + delete: RawAxiosRequestHeaders; + get: RawAxiosRequestHeaders; + head: RawAxiosRequestHeaders; + post: RawAxiosRequestHeaders; + put: RawAxiosRequestHeaders; + patch: RawAxiosRequestHeaders; + options?: RawAxiosRequestHeaders; + purge?: RawAxiosRequestHeaders; + link?: RawAxiosRequestHeaders; + unlink?: RawAxiosRequestHeaders; + } + + interface AxiosDefaults extends Omit, 'headers'> { + headers: HeadersDefaults; + } + + interface CreateAxiosDefaults extends Omit, 'headers'> { + headers?: RawAxiosRequestHeaders | AxiosHeaders | Partial; + } + + interface AxiosResponse { + data: T; + status: number; + statusText: string; + headers: RawAxiosResponseHeaders | AxiosResponseHeaders; + config: InternalAxiosRequestConfig; + request?: any; + } + + type AxiosPromise = Promise>; + + interface CancelStatic { + new (message?: string): Cancel; + } + + interface Cancel { + message: string | undefined; + } + + interface Canceler { + (message?: string, config?: AxiosRequestConfig, request?: any): void; + } + + interface CancelTokenStatic { + new (executor: (cancel: Canceler) => void): CancelToken; + source(): CancelTokenSource; + } + + interface CancelToken { + promise: Promise; + reason?: Cancel; + throwIfRequested(): void; + } + + interface CancelTokenSource { + token: CancelToken; + cancel: Canceler; + } + + interface AxiosInterceptorOptions { + synchronous?: boolean; + runWhen?: (config: InternalAxiosRequestConfig) => boolean; + } + + interface AxiosInterceptorManager { + use(onFulfilled?: (value: V) => V | Promise, onRejected?: (error: any) => any, options?: AxiosInterceptorOptions): number; + eject(id: number): void; + clear(): void; + } + + interface AxiosInstance extends Axios { + , D = any>(config: AxiosRequestConfig): Promise; + , D = any>(url: string, config?: AxiosRequestConfig): Promise; + + defaults: Omit & { + headers: HeadersDefaults & { + [key: string]: AxiosHeaderValue + } + }; + } + + interface GenericFormData { + append(name: string, value: any, options?: any): any; + } + + interface GenericHTMLFormElement { + name: string; + method: string; + submit(): void; + } + + interface AxiosStatic extends AxiosInstance { + create(config?: CreateAxiosDefaults): AxiosInstance; + Cancel: CancelStatic; + CancelToken: CancelTokenStatic; + Axios: typeof Axios; + AxiosError: typeof AxiosError; + CanceledError: typeof CanceledError; + HttpStatusCode: typeof HttpStatusCode; + readonly VERSION: string; + isCancel(value: any): value is Cancel; + all(values: Array>): Promise; + spread(callback: (...args: T[]) => R): (array: T[]) => R; + isAxiosError(payload: any): payload is AxiosError; + toFormData(sourceObj: object, targetFormData?: GenericFormData, options?: FormSerializerOptions): GenericFormData; + formToJSON(form: GenericFormData|GenericHTMLFormElement): object; + getAdapter(adapters: AxiosAdapterConfig | AxiosAdapterConfig[] | undefined): AxiosAdapter; + AxiosHeaders: typeof AxiosHeaders; + } +} + +declare const axios: axios.AxiosStatic; + +export = axios; diff --git a/project starter code/node_modules/axios/index.d.ts b/project starter code/node_modules/axios/index.d.ts new file mode 100644 index 00000000..dbb7dca3 --- /dev/null +++ b/project starter code/node_modules/axios/index.d.ts @@ -0,0 +1,562 @@ +// TypeScript Version: 4.7 +export type AxiosHeaderValue = AxiosHeaders | string | string[] | number | boolean | null; + +interface RawAxiosHeaders { + [key: string]: AxiosHeaderValue; +} + +type MethodsHeaders = Partial<{ + [Key in Method as Lowercase]: AxiosHeaders; +} & {common: AxiosHeaders}>; + +type AxiosHeaderMatcher = string | RegExp | ((this: AxiosHeaders, value: string, name: string) => boolean); + +type AxiosHeaderParser = (this: AxiosHeaders, value: AxiosHeaderValue, header: string) => any; + +export class AxiosHeaders { + constructor( + headers?: RawAxiosHeaders | AxiosHeaders | string + ); + + [key: string]: any; + + set(headerName?: string, value?: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders; + + get(headerName: string, parser: RegExp): RegExpExecArray | null; + get(headerName: string, matcher?: true | AxiosHeaderParser): AxiosHeaderValue; + + has(header: string, matcher?: AxiosHeaderMatcher): boolean; + + delete(header: string | string[], matcher?: AxiosHeaderMatcher): boolean; + + clear(matcher?: AxiosHeaderMatcher): boolean; + + normalize(format: boolean): AxiosHeaders; + + concat(...targets: Array): AxiosHeaders; + + toJSON(asStrings?: boolean): RawAxiosHeaders; + + static from(thing?: AxiosHeaders | RawAxiosHeaders | string): AxiosHeaders; + + static accessor(header: string | string[]): AxiosHeaders; + + static concat(...targets: Array): AxiosHeaders; + + setContentType(value: ContentType, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getContentType(parser?: RegExp): RegExpExecArray | null; + getContentType(matcher?: AxiosHeaderMatcher): AxiosHeaderValue; + hasContentType(matcher?: AxiosHeaderMatcher): boolean; + + setContentLength(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getContentLength(parser?: RegExp): RegExpExecArray | null; + getContentLength(matcher?: AxiosHeaderMatcher): AxiosHeaderValue; + hasContentLength(matcher?: AxiosHeaderMatcher): boolean; + + setAccept(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getAccept(parser?: RegExp): RegExpExecArray | null; + getAccept(matcher?: AxiosHeaderMatcher): AxiosHeaderValue; + hasAccept(matcher?: AxiosHeaderMatcher): boolean; + + setUserAgent(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getUserAgent(parser?: RegExp): RegExpExecArray | null; + getUserAgent(matcher?: AxiosHeaderMatcher): AxiosHeaderValue; + hasUserAgent(matcher?: AxiosHeaderMatcher): boolean; + + setContentEncoding(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getContentEncoding(parser?: RegExp): RegExpExecArray | null; + getContentEncoding(matcher?: AxiosHeaderMatcher): AxiosHeaderValue; + hasContentEncoding(matcher?: AxiosHeaderMatcher): boolean; + + setAuthorization(value: AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders; + getAuthorization(parser?: RegExp): RegExpExecArray | null; + getAuthorization(matcher?: AxiosHeaderMatcher): AxiosHeaderValue; + hasAuthorization(matcher?: AxiosHeaderMatcher): boolean; + + [Symbol.iterator](): IterableIterator<[string, AxiosHeaderValue]>; +} + +type CommonRequestHeadersList = 'Accept' | 'Content-Length' | 'User-Agent' | 'Content-Encoding' | 'Authorization'; + +type ContentType = AxiosHeaderValue | 'text/html' | 'text/plain' | 'multipart/form-data' | 'application/json' | 'application/x-www-form-urlencoded' | 'application/octet-stream'; + +export type RawAxiosRequestHeaders = Partial; + +export type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders; + +type CommonResponseHeadersList = 'Server' | 'Content-Type' | 'Content-Length' | 'Cache-Control'| 'Content-Encoding'; + +type RawCommonResponseHeaders = { + [Key in CommonResponseHeadersList]: AxiosHeaderValue; +} & { + "set-cookie": string[]; +}; + +export type RawAxiosResponseHeaders = Partial; + +export type AxiosResponseHeaders = RawAxiosResponseHeaders & AxiosHeaders; + +export interface AxiosRequestTransformer { + (this: InternalAxiosRequestConfig, data: any, headers: AxiosRequestHeaders): any; +} + +export interface AxiosResponseTransformer { + (this: InternalAxiosRequestConfig, data: any, headers: AxiosResponseHeaders, status?: number): any; +} + +export interface AxiosAdapter { + (config: InternalAxiosRequestConfig): AxiosPromise; +} + +export interface AxiosBasicCredentials { + username: string; + password: string; +} + +export interface AxiosProxyConfig { + host: string; + port: number; + auth?: AxiosBasicCredentials; + protocol?: string; +} + +export enum HttpStatusCode { + Continue = 100, + SwitchingProtocols = 101, + Processing = 102, + EarlyHints = 103, + Ok = 200, + Created = 201, + Accepted = 202, + NonAuthoritativeInformation = 203, + NoContent = 204, + ResetContent = 205, + PartialContent = 206, + MultiStatus = 207, + AlreadyReported = 208, + ImUsed = 226, + MultipleChoices = 300, + MovedPermanently = 301, + Found = 302, + SeeOther = 303, + NotModified = 304, + UseProxy = 305, + Unused = 306, + TemporaryRedirect = 307, + PermanentRedirect = 308, + BadRequest = 400, + Unauthorized = 401, + PaymentRequired = 402, + Forbidden = 403, + NotFound = 404, + MethodNotAllowed = 405, + NotAcceptable = 406, + ProxyAuthenticationRequired = 407, + RequestTimeout = 408, + Conflict = 409, + Gone = 410, + LengthRequired = 411, + PreconditionFailed = 412, + PayloadTooLarge = 413, + UriTooLong = 414, + UnsupportedMediaType = 415, + RangeNotSatisfiable = 416, + ExpectationFailed = 417, + ImATeapot = 418, + MisdirectedRequest = 421, + UnprocessableEntity = 422, + Locked = 423, + FailedDependency = 424, + TooEarly = 425, + UpgradeRequired = 426, + PreconditionRequired = 428, + TooManyRequests = 429, + RequestHeaderFieldsTooLarge = 431, + UnavailableForLegalReasons = 451, + InternalServerError = 500, + NotImplemented = 501, + BadGateway = 502, + ServiceUnavailable = 503, + GatewayTimeout = 504, + HttpVersionNotSupported = 505, + VariantAlsoNegotiates = 506, + InsufficientStorage = 507, + LoopDetected = 508, + NotExtended = 510, + NetworkAuthenticationRequired = 511, +} + +export type Method = + | 'get' | 'GET' + | 'delete' | 'DELETE' + | 'head' | 'HEAD' + | 'options' | 'OPTIONS' + | 'post' | 'POST' + | 'put' | 'PUT' + | 'patch' | 'PATCH' + | 'purge' | 'PURGE' + | 'link' | 'LINK' + | 'unlink' | 'UNLINK'; + +export type ResponseType = + | 'arraybuffer' + | 'blob' + | 'document' + | 'json' + | 'text' + | 'stream' + | 'formdata'; + +export type responseEncoding = + | 'ascii' | 'ASCII' + | 'ansi' | 'ANSI' + | 'binary' | 'BINARY' + | 'base64' | 'BASE64' + | 'base64url' | 'BASE64URL' + | 'hex' | 'HEX' + | 'latin1' | 'LATIN1' + | 'ucs-2' | 'UCS-2' + | 'ucs2' | 'UCS2' + | 'utf-8' | 'UTF-8' + | 'utf8' | 'UTF8' + | 'utf16le' | 'UTF16LE'; + +export interface TransitionalOptions { + silentJSONParsing?: boolean; + forcedJSONParsing?: boolean; + clarifyTimeoutError?: boolean; +} + +export interface GenericAbortSignal { + readonly aborted: boolean; + onabort?: ((...args: any) => any) | null; + addEventListener?: (...args: any) => any; + removeEventListener?: (...args: any) => any; +} + +export interface FormDataVisitorHelpers { + defaultVisitor: SerializerVisitor; + convertValue: (value: any) => any; + isVisitable: (value: any) => boolean; +} + +export interface SerializerVisitor { + ( + this: GenericFormData, + value: any, + key: string | number, + path: null | Array, + helpers: FormDataVisitorHelpers + ): boolean; +} + +export interface SerializerOptions { + visitor?: SerializerVisitor; + dots?: boolean; + metaTokens?: boolean; + indexes?: boolean | null; +} + +// tslint:disable-next-line +export interface FormSerializerOptions extends SerializerOptions { +} + +export interface ParamEncoder { + (value: any, defaultEncoder: (value: any) => any): any; +} + +export interface CustomParamsSerializer { + (params: Record, options?: ParamsSerializerOptions): string; +} + +export interface ParamsSerializerOptions extends SerializerOptions { + encode?: ParamEncoder; + serialize?: CustomParamsSerializer; +} + +type MaxUploadRate = number; + +type MaxDownloadRate = number; + +type BrowserProgressEvent = any; + +export interface AxiosProgressEvent { + loaded: number; + total?: number; + progress?: number; + bytes: number; + rate?: number; + estimated?: number; + upload?: boolean; + download?: boolean; + event?: BrowserProgressEvent; + lengthComputable: boolean; +} + +type Milliseconds = number; + +type AxiosAdapterName = 'fetch' | 'xhr' | 'http' | string; + +type AxiosAdapterConfig = AxiosAdapter | AxiosAdapterName; + +export type AddressFamily = 4 | 6 | undefined; + +export interface LookupAddressEntry { + address: string; + family?: AddressFamily; +} + +export type LookupAddress = string | LookupAddressEntry; + +export interface AxiosRequestConfig { + url?: string; + method?: Method | string; + baseURL?: string; + transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[]; + transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[]; + headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHeaders; + params?: any; + paramsSerializer?: ParamsSerializerOptions | CustomParamsSerializer; + data?: D; + timeout?: Milliseconds; + timeoutErrorMessage?: string; + withCredentials?: boolean; + adapter?: AxiosAdapterConfig | AxiosAdapterConfig[]; + auth?: AxiosBasicCredentials; + responseType?: ResponseType; + responseEncoding?: responseEncoding | string; + xsrfCookieName?: string; + xsrfHeaderName?: string; + onUploadProgress?: (progressEvent: AxiosProgressEvent) => void; + onDownloadProgress?: (progressEvent: AxiosProgressEvent) => void; + maxContentLength?: number; + validateStatus?: ((status: number) => boolean) | null; + maxBodyLength?: number; + maxRedirects?: number; + maxRate?: number | [MaxUploadRate, MaxDownloadRate]; + beforeRedirect?: (options: Record, responseDetails: {headers: Record, statusCode: HttpStatusCode}) => void; + socketPath?: string | null; + transport?: any; + httpAgent?: any; + httpsAgent?: any; + proxy?: AxiosProxyConfig | false; + cancelToken?: CancelToken; + decompress?: boolean; + transitional?: TransitionalOptions; + signal?: GenericAbortSignal; + insecureHTTPParser?: boolean; + env?: { + FormData?: new (...args: any[]) => object; + }; + formSerializer?: FormSerializerOptions; + family?: AddressFamily; + lookup?: ((hostname: string, options: object, cb: (err: Error | null, address: LookupAddress | LookupAddress[], family?: AddressFamily) => void) => void) | + ((hostname: string, options: object) => Promise<[address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress>); + withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined); + fetchOptions?: Record; +} + +// Alias +export type RawAxiosRequestConfig = AxiosRequestConfig; + +export interface InternalAxiosRequestConfig extends AxiosRequestConfig { + headers: AxiosRequestHeaders; +} + +export interface HeadersDefaults { + common: RawAxiosRequestHeaders; + delete: RawAxiosRequestHeaders; + get: RawAxiosRequestHeaders; + head: RawAxiosRequestHeaders; + post: RawAxiosRequestHeaders; + put: RawAxiosRequestHeaders; + patch: RawAxiosRequestHeaders; + options?: RawAxiosRequestHeaders; + purge?: RawAxiosRequestHeaders; + link?: RawAxiosRequestHeaders; + unlink?: RawAxiosRequestHeaders; +} + +export interface AxiosDefaults extends Omit, 'headers'> { + headers: HeadersDefaults; +} + +export interface CreateAxiosDefaults extends Omit, 'headers'> { + headers?: RawAxiosRequestHeaders | AxiosHeaders | Partial; +} + +export interface AxiosResponse { + data: T; + status: number; + statusText: string; + headers: RawAxiosResponseHeaders | AxiosResponseHeaders; + config: InternalAxiosRequestConfig; + request?: any; +} + +export class AxiosError extends Error { + constructor( + message?: string, + code?: string, + config?: InternalAxiosRequestConfig, + request?: any, + response?: AxiosResponse + ); + + config?: InternalAxiosRequestConfig; + code?: string; + request?: any; + response?: AxiosResponse; + isAxiosError: boolean; + status?: number; + toJSON: () => object; + cause?: Error; + static from( + error: Error | unknown, + code?: string, + config?: InternalAxiosRequestConfig, + request?: any, + response?: AxiosResponse, + customProps?: object, +): AxiosError; + static readonly ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS"; + static readonly ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE"; + static readonly ERR_BAD_OPTION = "ERR_BAD_OPTION"; + static readonly ERR_NETWORK = "ERR_NETWORK"; + static readonly ERR_DEPRECATED = "ERR_DEPRECATED"; + static readonly ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE"; + static readonly ERR_BAD_REQUEST = "ERR_BAD_REQUEST"; + static readonly ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT"; + static readonly ERR_INVALID_URL = "ERR_INVALID_URL"; + static readonly ERR_CANCELED = "ERR_CANCELED"; + static readonly ECONNABORTED = "ECONNABORTED"; + static readonly ETIMEDOUT = "ETIMEDOUT"; +} + +export class CanceledError extends AxiosError { +} + +export type AxiosPromise = Promise>; + +export interface CancelStatic { + new (message?: string): Cancel; +} + +export interface Cancel { + message: string | undefined; +} + +export interface Canceler { + (message?: string, config?: AxiosRequestConfig, request?: any): void; +} + +export interface CancelTokenStatic { + new (executor: (cancel: Canceler) => void): CancelToken; + source(): CancelTokenSource; +} + +export interface CancelToken { + promise: Promise; + reason?: Cancel; + throwIfRequested(): void; +} + +export interface CancelTokenSource { + token: CancelToken; + cancel: Canceler; +} + +export interface AxiosInterceptorOptions { + synchronous?: boolean; + runWhen?: (config: InternalAxiosRequestConfig) => boolean; +} + +export interface AxiosInterceptorManager { + use(onFulfilled?: ((value: V) => V | Promise) | null, onRejected?: ((error: any) => any) | null, options?: AxiosInterceptorOptions): number; + eject(id: number): void; + clear(): void; +} + +export class Axios { + constructor(config?: AxiosRequestConfig); + defaults: AxiosDefaults; + interceptors: { + request: AxiosInterceptorManager; + response: AxiosInterceptorManager; + }; + getUri(config?: AxiosRequestConfig): string; + request, D = any>(config: AxiosRequestConfig): Promise; + get, D = any>(url: string, config?: AxiosRequestConfig): Promise; + delete, D = any>(url: string, config?: AxiosRequestConfig): Promise; + head, D = any>(url: string, config?: AxiosRequestConfig): Promise; + options, D = any>(url: string, config?: AxiosRequestConfig): Promise; + post, D = any>(url: string, data?: D, config?: AxiosRequestConfig): Promise; + put, D = any>(url: string, data?: D, config?: AxiosRequestConfig): Promise; + patch, D = any>(url: string, data?: D, config?: AxiosRequestConfig): Promise; + postForm, D = any>(url: string, data?: D, config?: AxiosRequestConfig): Promise; + putForm, D = any>(url: string, data?: D, config?: AxiosRequestConfig): Promise; + patchForm, D = any>(url: string, data?: D, config?: AxiosRequestConfig): Promise; +} + +export interface AxiosInstance extends Axios { + , D = any>(config: AxiosRequestConfig): Promise; + , D = any>(url: string, config?: AxiosRequestConfig): Promise; + + defaults: Omit & { + headers: HeadersDefaults & { + [key: string]: AxiosHeaderValue + } + }; +} + +export interface GenericFormData { + append(name: string, value: any, options?: any): any; +} + +export interface GenericHTMLFormElement { + name: string; + method: string; + submit(): void; +} + +export function getAdapter(adapters: AxiosAdapterConfig | AxiosAdapterConfig[] | undefined): AxiosAdapter; + +export function toFormData(sourceObj: object, targetFormData?: GenericFormData, options?: FormSerializerOptions): GenericFormData; + +export function formToJSON(form: GenericFormData|GenericHTMLFormElement): object; + +export function isAxiosError(payload: any): payload is AxiosError; + +export function spread(callback: (...args: T[]) => R): (array: T[]) => R; + +export function isCancel(value: any): value is Cancel; + +export function all(values: Array>): Promise; + +export interface AxiosStatic extends AxiosInstance { + create(config?: CreateAxiosDefaults): AxiosInstance; + Cancel: CancelStatic; + CancelToken: CancelTokenStatic; + Axios: typeof Axios; + AxiosError: typeof AxiosError; + HttpStatusCode: typeof HttpStatusCode; + readonly VERSION: string; + isCancel: typeof isCancel; + all: typeof all; + spread: typeof spread; + isAxiosError: typeof isAxiosError; + toFormData: typeof toFormData; + formToJSON: typeof formToJSON; + getAdapter: typeof getAdapter; + CanceledError: typeof CanceledError; + AxiosHeaders: typeof AxiosHeaders; +} + +declare const axios: AxiosStatic; + +export default axios; diff --git a/project starter code/node_modules/axios/index.js b/project starter code/node_modules/axios/index.js new file mode 100644 index 00000000..fba3990d --- /dev/null +++ b/project starter code/node_modules/axios/index.js @@ -0,0 +1,43 @@ +import axios from './lib/axios.js'; + +// This module is intended to unwrap Axios default export as named. +// Keep top-level export same with static properties +// so that it can keep same with es module or cjs +const { + Axios, + AxiosError, + CanceledError, + isCancel, + CancelToken, + VERSION, + all, + Cancel, + isAxiosError, + spread, + toFormData, + AxiosHeaders, + HttpStatusCode, + formToJSON, + getAdapter, + mergeConfig +} = axios; + +export { + axios as default, + Axios, + AxiosError, + CanceledError, + isCancel, + CancelToken, + VERSION, + all, + Cancel, + isAxiosError, + spread, + toFormData, + AxiosHeaders, + HttpStatusCode, + formToJSON, + getAdapter, + mergeConfig +} diff --git a/project starter code/node_modules/axios/lib/adapters/README.md b/project starter code/node_modules/axios/lib/adapters/README.md new file mode 100644 index 00000000..68f11189 --- /dev/null +++ b/project starter code/node_modules/axios/lib/adapters/README.md @@ -0,0 +1,37 @@ +# axios // adapters + +The modules under `adapters/` are modules that handle dispatching a request and settling a returned `Promise` once a response is received. + +## Example + +```js +var settle = require('./../core/settle'); + +module.exports = function myAdapter(config) { + // At this point: + // - config has been merged with defaults + // - request transformers have already run + // - request interceptors have already run + + // Make the request using config provided + // Upon response settle the Promise + + return new Promise(function(resolve, reject) { + + var response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config: config, + request: request + }; + + settle(resolve, reject, response); + + // From here: + // - response transformers will run + // - response interceptors will run + }); +} +``` diff --git a/project starter code/node_modules/axios/lib/adapters/adapters.js b/project starter code/node_modules/axios/lib/adapters/adapters.js new file mode 100644 index 00000000..b466dd51 --- /dev/null +++ b/project starter code/node_modules/axios/lib/adapters/adapters.js @@ -0,0 +1,79 @@ +import utils from '../utils.js'; +import httpAdapter from './http.js'; +import xhrAdapter from './xhr.js'; +import fetchAdapter from './fetch.js'; +import AxiosError from "../core/AxiosError.js"; + +const knownAdapters = { + http: httpAdapter, + xhr: xhrAdapter, + fetch: fetchAdapter +} + +utils.forEach(knownAdapters, (fn, value) => { + if (fn) { + try { + Object.defineProperty(fn, 'name', {value}); + } catch (e) { + // eslint-disable-next-line no-empty + } + Object.defineProperty(fn, 'adapterName', {value}); + } +}); + +const renderReason = (reason) => `- ${reason}`; + +const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false; + +export default { + getAdapter: (adapters) => { + adapters = utils.isArray(adapters) ? adapters : [adapters]; + + const {length} = adapters; + let nameOrAdapter; + let adapter; + + const rejectedReasons = {}; + + for (let i = 0; i < length; i++) { + nameOrAdapter = adapters[i]; + let id; + + adapter = nameOrAdapter; + + if (!isResolvedHandle(nameOrAdapter)) { + adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()]; + + if (adapter === undefined) { + throw new AxiosError(`Unknown adapter '${id}'`); + } + } + + if (adapter) { + break; + } + + rejectedReasons[id || '#' + i] = adapter; + } + + if (!adapter) { + + const reasons = Object.entries(rejectedReasons) + .map(([id, state]) => `adapter ${id} ` + + (state === false ? 'is not supported by the environment' : 'is not available in the build') + ); + + let s = length ? + (reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) : + 'as no adapter specified'; + + throw new AxiosError( + `There is no suitable adapter to dispatch the request ` + s, + 'ERR_NOT_SUPPORT' + ); + } + + return adapter; + }, + adapters: knownAdapters +} diff --git a/project starter code/node_modules/axios/lib/adapters/fetch.js b/project starter code/node_modules/axios/lib/adapters/fetch.js new file mode 100644 index 00000000..11045535 --- /dev/null +++ b/project starter code/node_modules/axios/lib/adapters/fetch.js @@ -0,0 +1,227 @@ +import platform from "../platform/index.js"; +import utils from "../utils.js"; +import AxiosError from "../core/AxiosError.js"; +import composeSignals from "../helpers/composeSignals.js"; +import {trackStream} from "../helpers/trackStream.js"; +import AxiosHeaders from "../core/AxiosHeaders.js"; +import progressEventReducer from "../helpers/progressEventReducer.js"; +import resolveConfig from "../helpers/resolveConfig.js"; +import settle from "../core/settle.js"; + +const fetchProgressDecorator = (total, fn) => { + const lengthComputable = total != null; + return (loaded) => setTimeout(() => fn({ + lengthComputable, + total, + loaded + })); +} + +const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function'; +const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function'; + +// used only inside the fetch adapter +const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? + ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : + async (str) => new Uint8Array(await new Response(str).arrayBuffer()) +); + +const supportsRequestStream = isReadableStreamSupported && (() => { + let duplexAccessed = false; + + const hasContentType = new Request(platform.origin, { + body: new ReadableStream(), + method: 'POST', + get duplex() { + duplexAccessed = true; + return 'half'; + }, + }).headers.has('Content-Type'); + + return duplexAccessed && !hasContentType; +})(); + +const DEFAULT_CHUNK_SIZE = 64 * 1024; + +const supportsResponseStream = isReadableStreamSupported && !!(()=> { + try { + return utils.isReadableStream(new Response('').body); + } catch(err) { + // return undefined + } +})(); + +const resolvers = { + stream: supportsResponseStream && ((res) => res.body) +}; + +isFetchSupported && (((res) => { + ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => { + !resolvers[type] && (resolvers[type] = utils.isFunction(res[type]) ? (res) => res[type]() : + (_, config) => { + throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config); + }) + }); +})(new Response)); + +const getBodyLength = async (body) => { + if (body == null) { + return 0; + } + + if(utils.isBlob(body)) { + return body.size; + } + + if(utils.isSpecCompliantForm(body)) { + return (await new Request(body).arrayBuffer()).byteLength; + } + + if(utils.isArrayBufferView(body)) { + return body.byteLength; + } + + if(utils.isURLSearchParams(body)) { + body = body + ''; + } + + if(utils.isString(body)) { + return (await encodeText(body)).byteLength; + } +} + +const resolveBodyLength = async (headers, body) => { + const length = utils.toFiniteNumber(headers.getContentLength()); + + return length == null ? getBodyLength(body) : length; +} + +export default isFetchSupported && (async (config) => { + let { + url, + method, + data, + signal, + cancelToken, + timeout, + onDownloadProgress, + onUploadProgress, + responseType, + headers, + withCredentials = 'same-origin', + fetchOptions + } = resolveConfig(config); + + responseType = responseType ? (responseType + '').toLowerCase() : 'text'; + + let [composedSignal, stopTimeout] = (signal || cancelToken || timeout) ? + composeSignals([signal, cancelToken], timeout) : []; + + let finished, request; + + const onFinish = () => { + !finished && setTimeout(() => { + composedSignal && composedSignal.unsubscribe(); + }); + + finished = true; + } + + let requestContentLength; + + try { + if ( + onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' && + (requestContentLength = await resolveBodyLength(headers, data)) !== 0 + ) { + let _request = new Request(url, { + method: 'POST', + body: data, + duplex: "half" + }); + + let contentTypeHeader; + + if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) { + headers.setContentType(contentTypeHeader) + } + + if (_request.body) { + data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, fetchProgressDecorator( + requestContentLength, + progressEventReducer(onUploadProgress) + ), null, encodeText); + } + } + + if (!utils.isString(withCredentials)) { + withCredentials = withCredentials ? 'cors' : 'omit'; + } + + request = new Request(url, { + ...fetchOptions, + signal: composedSignal, + method: method.toUpperCase(), + headers: headers.normalize().toJSON(), + body: data, + duplex: "half", + withCredentials + }); + + let response = await fetch(request); + + const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response'); + + if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) { + const options = {}; + + ['status', 'statusText', 'headers'].forEach(prop => { + options[prop] = response[prop]; + }); + + const responseContentLength = utils.toFiniteNumber(response.headers.get('content-length')); + + response = new Response( + trackStream(response.body, DEFAULT_CHUNK_SIZE, onDownloadProgress && fetchProgressDecorator( + responseContentLength, + progressEventReducer(onDownloadProgress, true) + ), isStreamResponse && onFinish, encodeText), + options + ); + } + + responseType = responseType || 'text'; + + let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](response, config); + + !isStreamResponse && onFinish(); + + stopTimeout && stopTimeout(); + + return await new Promise((resolve, reject) => { + settle(resolve, reject, { + data: responseData, + headers: AxiosHeaders.from(response.headers), + status: response.status, + statusText: response.statusText, + config, + request + }) + }) + } catch (err) { + onFinish(); + + if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) { + throw Object.assign( + new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), + { + cause: err.cause || err + } + ) + } + + throw AxiosError.from(err, err && err.code, config, request); + } +}); + + diff --git a/project starter code/node_modules/axios/lib/adapters/http.js b/project starter code/node_modules/axios/lib/adapters/http.js new file mode 100644 index 00000000..768e4a5d --- /dev/null +++ b/project starter code/node_modules/axios/lib/adapters/http.js @@ -0,0 +1,685 @@ +'use strict'; + +import utils from './../utils.js'; +import settle from './../core/settle.js'; +import buildFullPath from '../core/buildFullPath.js'; +import buildURL from './../helpers/buildURL.js'; +import {getProxyForUrl} from 'proxy-from-env'; +import http from 'http'; +import https from 'https'; +import util from 'util'; +import followRedirects from 'follow-redirects'; +import zlib from 'zlib'; +import {VERSION} from '../env/data.js'; +import transitionalDefaults from '../defaults/transitional.js'; +import AxiosError from '../core/AxiosError.js'; +import CanceledError from '../cancel/CanceledError.js'; +import platform from '../platform/index.js'; +import fromDataURI from '../helpers/fromDataURI.js'; +import stream from 'stream'; +import AxiosHeaders from '../core/AxiosHeaders.js'; +import AxiosTransformStream from '../helpers/AxiosTransformStream.js'; +import {EventEmitter} from 'events'; +import formDataToStream from "../helpers/formDataToStream.js"; +import readBlob from "../helpers/readBlob.js"; +import ZlibHeaderTransformStream from '../helpers/ZlibHeaderTransformStream.js'; +import callbackify from "../helpers/callbackify.js"; + +const zlibOptions = { + flush: zlib.constants.Z_SYNC_FLUSH, + finishFlush: zlib.constants.Z_SYNC_FLUSH +}; + +const brotliOptions = { + flush: zlib.constants.BROTLI_OPERATION_FLUSH, + finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH +} + +const isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress); + +const {http: httpFollow, https: httpsFollow} = followRedirects; + +const isHttps = /https:?/; + +const supportedProtocols = platform.protocols.map(protocol => { + return protocol + ':'; +}); + +/** + * If the proxy or config beforeRedirects functions are defined, call them with the options + * object. + * + * @param {Object} options - The options object that was passed to the request. + * + * @returns {Object} + */ +function dispatchBeforeRedirect(options, responseDetails) { + if (options.beforeRedirects.proxy) { + options.beforeRedirects.proxy(options); + } + if (options.beforeRedirects.config) { + options.beforeRedirects.config(options, responseDetails); + } +} + +/** + * If the proxy or config afterRedirects functions are defined, call them with the options + * + * @param {http.ClientRequestArgs} options + * @param {AxiosProxyConfig} configProxy configuration from Axios options object + * @param {string} location + * + * @returns {http.ClientRequestArgs} + */ +function setProxy(options, configProxy, location) { + let proxy = configProxy; + if (!proxy && proxy !== false) { + const proxyUrl = getProxyForUrl(location); + if (proxyUrl) { + proxy = new URL(proxyUrl); + } + } + if (proxy) { + // Basic proxy authorization + if (proxy.username) { + proxy.auth = (proxy.username || '') + ':' + (proxy.password || ''); + } + + if (proxy.auth) { + // Support proxy auth object form + if (proxy.auth.username || proxy.auth.password) { + proxy.auth = (proxy.auth.username || '') + ':' + (proxy.auth.password || ''); + } + const base64 = Buffer + .from(proxy.auth, 'utf8') + .toString('base64'); + options.headers['Proxy-Authorization'] = 'Basic ' + base64; + } + + options.headers.host = options.hostname + (options.port ? ':' + options.port : ''); + const proxyHost = proxy.hostname || proxy.host; + options.hostname = proxyHost; + // Replace 'host' since options is not a URL object + options.host = proxyHost; + options.port = proxy.port; + options.path = location; + if (proxy.protocol) { + options.protocol = proxy.protocol.includes(':') ? proxy.protocol : `${proxy.protocol}:`; + } + } + + options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) { + // Configure proxy for redirected request, passing the original config proxy to apply + // the exact same logic as if the redirected request was performed by axios directly. + setProxy(redirectOptions, configProxy, redirectOptions.href); + }; +} + +const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(process) === 'process'; + +// temporary hotfix + +const wrapAsync = (asyncExecutor) => { + return new Promise((resolve, reject) => { + let onDone; + let isDone; + + const done = (value, isRejected) => { + if (isDone) return; + isDone = true; + onDone && onDone(value, isRejected); + } + + const _resolve = (value) => { + done(value); + resolve(value); + }; + + const _reject = (reason) => { + done(reason, true); + reject(reason); + } + + asyncExecutor(_resolve, _reject, (onDoneHandler) => (onDone = onDoneHandler)).catch(_reject); + }) +}; + +const resolveFamily = ({address, family}) => { + if (!utils.isString(address)) { + throw TypeError('address must be a string'); + } + return ({ + address, + family: family || (address.indexOf('.') < 0 ? 6 : 4) + }); +} + +const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(address) ? address : {address, family}); + +/*eslint consistent-return:0*/ +export default isHttpAdapterSupported && function httpAdapter(config) { + return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) { + let {data, lookup, family} = config; + const {responseType, responseEncoding} = config; + const method = config.method.toUpperCase(); + let isDone; + let rejected = false; + let req; + + if (lookup) { + const _lookup = callbackify(lookup, (value) => utils.isArray(value) ? value : [value]); + // hotfix to support opt.all option which is required for node 20.x + lookup = (hostname, opt, cb) => { + _lookup(hostname, opt, (err, arg0, arg1) => { + if (err) { + return cb(err); + } + + const addresses = utils.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)]; + + opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family); + }); + } + } + + // temporary internal emitter until the AxiosRequest class will be implemented + const emitter = new EventEmitter(); + + const onFinished = () => { + if (config.cancelToken) { + config.cancelToken.unsubscribe(abort); + } + + if (config.signal) { + config.signal.removeEventListener('abort', abort); + } + + emitter.removeAllListeners(); + } + + onDone((value, isRejected) => { + isDone = true; + if (isRejected) { + rejected = true; + onFinished(); + } + }); + + function abort(reason) { + emitter.emit('abort', !reason || reason.type ? new CanceledError(null, config, req) : reason); + } + + emitter.once('abort', reject); + + if (config.cancelToken || config.signal) { + config.cancelToken && config.cancelToken.subscribe(abort); + if (config.signal) { + config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort); + } + } + + // Parse url + const fullPath = buildFullPath(config.baseURL, config.url); + const parsed = new URL(fullPath, 'http://localhost'); + const protocol = parsed.protocol || supportedProtocols[0]; + + if (protocol === 'data:') { + let convertedData; + + if (method !== 'GET') { + return settle(resolve, reject, { + status: 405, + statusText: 'method not allowed', + headers: {}, + config + }); + } + + try { + convertedData = fromDataURI(config.url, responseType === 'blob', { + Blob: config.env && config.env.Blob + }); + } catch (err) { + throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config); + } + + if (responseType === 'text') { + convertedData = convertedData.toString(responseEncoding); + + if (!responseEncoding || responseEncoding === 'utf8') { + convertedData = utils.stripBOM(convertedData); + } + } else if (responseType === 'stream') { + convertedData = stream.Readable.from(convertedData); + } + + return settle(resolve, reject, { + data: convertedData, + status: 200, + statusText: 'OK', + headers: new AxiosHeaders(), + config + }); + } + + if (supportedProtocols.indexOf(protocol) === -1) { + return reject(new AxiosError( + 'Unsupported protocol ' + protocol, + AxiosError.ERR_BAD_REQUEST, + config + )); + } + + const headers = AxiosHeaders.from(config.headers).normalize(); + + // Set User-Agent (required by some servers) + // See https://github.com/axios/axios/issues/69 + // User-Agent is specified; handle case where no UA header is desired + // Only set header if it hasn't been set in config + headers.set('User-Agent', 'axios/' + VERSION, false); + + const onDownloadProgress = config.onDownloadProgress; + const onUploadProgress = config.onUploadProgress; + const maxRate = config.maxRate; + let maxUploadRate = undefined; + let maxDownloadRate = undefined; + + // support for spec compliant FormData objects + if (utils.isSpecCompliantForm(data)) { + const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i); + + data = formDataToStream(data, (formHeaders) => { + headers.set(formHeaders); + }, { + tag: `axios-${VERSION}-boundary`, + boundary: userBoundary && userBoundary[1] || undefined + }); + // support for https://www.npmjs.com/package/form-data api + } else if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) { + headers.set(data.getHeaders()); + + if (!headers.hasContentLength()) { + try { + const knownLength = await util.promisify(data.getLength).call(data); + Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength); + /*eslint no-empty:0*/ + } catch (e) { + } + } + } else if (utils.isBlob(data)) { + data.size && headers.setContentType(data.type || 'application/octet-stream'); + headers.setContentLength(data.size || 0); + data = stream.Readable.from(readBlob(data)); + } else if (data && !utils.isStream(data)) { + if (Buffer.isBuffer(data)) { + // Nothing to do... + } else if (utils.isArrayBuffer(data)) { + data = Buffer.from(new Uint8Array(data)); + } else if (utils.isString(data)) { + data = Buffer.from(data, 'utf-8'); + } else { + return reject(new AxiosError( + 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream', + AxiosError.ERR_BAD_REQUEST, + config + )); + } + + // Add Content-Length header if data exists + headers.setContentLength(data.length, false); + + if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) { + return reject(new AxiosError( + 'Request body larger than maxBodyLength limit', + AxiosError.ERR_BAD_REQUEST, + config + )); + } + } + + const contentLength = utils.toFiniteNumber(headers.getContentLength()); + + if (utils.isArray(maxRate)) { + maxUploadRate = maxRate[0]; + maxDownloadRate = maxRate[1]; + } else { + maxUploadRate = maxDownloadRate = maxRate; + } + + if (data && (onUploadProgress || maxUploadRate)) { + if (!utils.isStream(data)) { + data = stream.Readable.from(data, {objectMode: false}); + } + + data = stream.pipeline([data, new AxiosTransformStream({ + length: contentLength, + maxRate: utils.toFiniteNumber(maxUploadRate) + })], utils.noop); + + onUploadProgress && data.on('progress', progress => { + onUploadProgress(Object.assign(progress, { + upload: true + })); + }); + } + + // HTTP basic authentication + let auth = undefined; + if (config.auth) { + const username = config.auth.username || ''; + const password = config.auth.password || ''; + auth = username + ':' + password; + } + + if (!auth && parsed.username) { + const urlUsername = parsed.username; + const urlPassword = parsed.password; + auth = urlUsername + ':' + urlPassword; + } + + auth && headers.delete('authorization'); + + let path; + + try { + path = buildURL( + parsed.pathname + parsed.search, + config.params, + config.paramsSerializer + ).replace(/^\?/, ''); + } catch (err) { + const customErr = new Error(err.message); + customErr.config = config; + customErr.url = config.url; + customErr.exists = true; + return reject(customErr); + } + + headers.set( + 'Accept-Encoding', + 'gzip, compress, deflate' + (isBrotliSupported ? ', br' : ''), false + ); + + const options = { + path, + method: method, + headers: headers.toJSON(), + agents: { http: config.httpAgent, https: config.httpsAgent }, + auth, + protocol, + family, + beforeRedirect: dispatchBeforeRedirect, + beforeRedirects: {} + }; + + // cacheable-lookup integration hotfix + !utils.isUndefined(lookup) && (options.lookup = lookup); + + if (config.socketPath) { + options.socketPath = config.socketPath; + } else { + options.hostname = parsed.hostname; + options.port = parsed.port; + setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path); + } + + let transport; + const isHttpsRequest = isHttps.test(options.protocol); + options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent; + if (config.transport) { + transport = config.transport; + } else if (config.maxRedirects === 0) { + transport = isHttpsRequest ? https : http; + } else { + if (config.maxRedirects) { + options.maxRedirects = config.maxRedirects; + } + if (config.beforeRedirect) { + options.beforeRedirects.config = config.beforeRedirect; + } + transport = isHttpsRequest ? httpsFollow : httpFollow; + } + + if (config.maxBodyLength > -1) { + options.maxBodyLength = config.maxBodyLength; + } else { + // follow-redirects does not skip comparison, so it should always succeed for axios -1 unlimited + options.maxBodyLength = Infinity; + } + + if (config.insecureHTTPParser) { + options.insecureHTTPParser = config.insecureHTTPParser; + } + + // Create the request + req = transport.request(options, function handleResponse(res) { + if (req.destroyed) return; + + const streams = [res]; + + const responseLength = +res.headers['content-length']; + + if (onDownloadProgress) { + const transformStream = new AxiosTransformStream({ + length: utils.toFiniteNumber(responseLength), + maxRate: utils.toFiniteNumber(maxDownloadRate) + }); + + onDownloadProgress && transformStream.on('progress', progress => { + onDownloadProgress(Object.assign(progress, { + download: true + })); + }); + + streams.push(transformStream); + } + + // decompress the response body transparently if required + let responseStream = res; + + // return the last request in case of redirects + const lastRequest = res.req || req; + + // if decompress disabled we should not decompress + if (config.decompress !== false && res.headers['content-encoding']) { + // if no content, but headers still say that it is encoded, + // remove the header not confuse downstream operations + if (method === 'HEAD' || res.statusCode === 204) { + delete res.headers['content-encoding']; + } + + switch ((res.headers['content-encoding'] || '').toLowerCase()) { + /*eslint default-case:0*/ + case 'gzip': + case 'x-gzip': + case 'compress': + case 'x-compress': + // add the unzipper to the body stream processing pipeline + streams.push(zlib.createUnzip(zlibOptions)); + + // remove the content-encoding in order to not confuse downstream operations + delete res.headers['content-encoding']; + break; + case 'deflate': + streams.push(new ZlibHeaderTransformStream()); + + // add the unzipper to the body stream processing pipeline + streams.push(zlib.createUnzip(zlibOptions)); + + // remove the content-encoding in order to not confuse downstream operations + delete res.headers['content-encoding']; + break; + case 'br': + if (isBrotliSupported) { + streams.push(zlib.createBrotliDecompress(brotliOptions)); + delete res.headers['content-encoding']; + } + } + } + + responseStream = streams.length > 1 ? stream.pipeline(streams, utils.noop) : streams[0]; + + const offListeners = stream.finished(responseStream, () => { + offListeners(); + onFinished(); + }); + + const response = { + status: res.statusCode, + statusText: res.statusMessage, + headers: new AxiosHeaders(res.headers), + config, + request: lastRequest + }; + + if (responseType === 'stream') { + response.data = responseStream; + settle(resolve, reject, response); + } else { + const responseBuffer = []; + let totalResponseBytes = 0; + + responseStream.on('data', function handleStreamData(chunk) { + responseBuffer.push(chunk); + totalResponseBytes += chunk.length; + + // make sure the content length is not over the maxContentLength if specified + if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) { + // stream.destroy() emit aborted event before calling reject() on Node.js v16 + rejected = true; + responseStream.destroy(); + reject(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded', + AxiosError.ERR_BAD_RESPONSE, config, lastRequest)); + } + }); + + responseStream.on('aborted', function handlerStreamAborted() { + if (rejected) { + return; + } + + const err = new AxiosError( + 'maxContentLength size of ' + config.maxContentLength + ' exceeded', + AxiosError.ERR_BAD_RESPONSE, + config, + lastRequest + ); + responseStream.destroy(err); + reject(err); + }); + + responseStream.on('error', function handleStreamError(err) { + if (req.destroyed) return; + reject(AxiosError.from(err, null, config, lastRequest)); + }); + + responseStream.on('end', function handleStreamEnd() { + try { + let responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer); + if (responseType !== 'arraybuffer') { + responseData = responseData.toString(responseEncoding); + if (!responseEncoding || responseEncoding === 'utf8') { + responseData = utils.stripBOM(responseData); + } + } + response.data = responseData; + } catch (err) { + return reject(AxiosError.from(err, null, config, response.request, response)); + } + settle(resolve, reject, response); + }); + } + + emitter.once('abort', err => { + if (!responseStream.destroyed) { + responseStream.emit('error', err); + responseStream.destroy(); + } + }); + }); + + emitter.once('abort', err => { + reject(err); + req.destroy(err); + }); + + // Handle errors + req.on('error', function handleRequestError(err) { + // @todo remove + // if (req.aborted && err.code !== AxiosError.ERR_FR_TOO_MANY_REDIRECTS) return; + reject(AxiosError.from(err, null, config, req)); + }); + + // set tcp keep alive to prevent drop connection by peer + req.on('socket', function handleRequestSocket(socket) { + // default interval of sending ack packet is 1 minute + socket.setKeepAlive(true, 1000 * 60); + }); + + // Handle request timeout + if (config.timeout) { + // This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types. + const timeout = parseInt(config.timeout, 10); + + if (Number.isNaN(timeout)) { + reject(new AxiosError( + 'error trying to parse `config.timeout` to int', + AxiosError.ERR_BAD_OPTION_VALUE, + config, + req + )); + + return; + } + + // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system. + // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET. + // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up. + // And then these socket which be hang up will devouring CPU little by little. + // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect. + req.setTimeout(timeout, function handleRequestTimeout() { + if (isDone) return; + let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded'; + const transitional = config.transitional || transitionalDefaults; + if (config.timeoutErrorMessage) { + timeoutErrorMessage = config.timeoutErrorMessage; + } + reject(new AxiosError( + timeoutErrorMessage, + transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, + config, + req + )); + abort(); + }); + } + + + // Send the request + if (utils.isStream(data)) { + let ended = false; + let errored = false; + + data.on('end', () => { + ended = true; + }); + + data.once('error', err => { + errored = true; + req.destroy(err); + }); + + data.on('close', () => { + if (!ended && !errored) { + abort(new CanceledError('Request stream has been aborted', config, req)); + } + }); + + data.pipe(req); + } else { + req.end(data); + } + }); +} + +export const __setProxy = setProxy; diff --git a/project starter code/node_modules/axios/lib/adapters/xhr.js b/project starter code/node_modules/axios/lib/adapters/xhr.js new file mode 100644 index 00000000..e9b8e805 --- /dev/null +++ b/project starter code/node_modules/axios/lib/adapters/xhr.js @@ -0,0 +1,190 @@ +import utils from './../utils.js'; +import settle from './../core/settle.js'; +import transitionalDefaults from '../defaults/transitional.js'; +import AxiosError from '../core/AxiosError.js'; +import CanceledError from '../cancel/CanceledError.js'; +import parseProtocol from '../helpers/parseProtocol.js'; +import platform from '../platform/index.js'; +import AxiosHeaders from '../core/AxiosHeaders.js'; +import progressEventReducer from '../helpers/progressEventReducer.js'; +import resolveConfig from "../helpers/resolveConfig.js"; + +const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined'; + +export default isXHRAdapterSupported && function (config) { + return new Promise(function dispatchXhrRequest(resolve, reject) { + const _config = resolveConfig(config); + let requestData = _config.data; + const requestHeaders = AxiosHeaders.from(_config.headers).normalize(); + let {responseType} = _config; + let onCanceled; + function done() { + if (_config.cancelToken) { + _config.cancelToken.unsubscribe(onCanceled); + } + + if (_config.signal) { + _config.signal.removeEventListener('abort', onCanceled); + } + } + + let request = new XMLHttpRequest(); + + request.open(_config.method.toUpperCase(), _config.url, true); + + // Set the request timeout in MS + request.timeout = _config.timeout; + + function onloadend() { + if (!request) { + return; + } + // Prepare the response + const responseHeaders = AxiosHeaders.from( + 'getAllResponseHeaders' in request && request.getAllResponseHeaders() + ); + const responseData = !responseType || responseType === 'text' || responseType === 'json' ? + request.responseText : request.response; + const response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config, + request + }; + + settle(function _resolve(value) { + resolve(value); + done(); + }, function _reject(err) { + reject(err); + done(); + }, response); + + // Clean up request + request = null; + } + + if ('onloadend' in request) { + // Use onloadend if available + request.onloadend = onloadend; + } else { + // Listen for ready state to emulate onloadend + request.onreadystatechange = function handleLoad() { + if (!request || request.readyState !== 4) { + return; + } + + // The request errored out and we didn't get a response, this will be + // handled by onerror instead + // With one exception: request that using file: protocol, most browsers + // will return status as 0 even though it's a successful request + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { + return; + } + // readystate handler is calling before onerror or ontimeout handlers, + // so we should call onloadend on the next 'tick' + setTimeout(onloadend); + }; + } + + // Handle browser request cancellation (as opposed to a manual cancellation) + request.onabort = function handleAbort() { + if (!request) { + return; + } + + reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, _config, request)); + + // Clean up request + request = null; + }; + + // Handle low level network errors + request.onerror = function handleError() { + // Real errors are hidden from us by the browser + // onerror should only fire if it's a network error + reject(new AxiosError('Network Error', AxiosError.ERR_NETWORK, _config, request)); + + // Clean up request + request = null; + }; + + // Handle timeout + request.ontimeout = function handleTimeout() { + let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded'; + const transitional = _config.transitional || transitionalDefaults; + if (_config.timeoutErrorMessage) { + timeoutErrorMessage = _config.timeoutErrorMessage; + } + reject(new AxiosError( + timeoutErrorMessage, + transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, + _config, + request)); + + // Clean up request + request = null; + }; + + // Remove Content-Type if data is undefined + requestData === undefined && requestHeaders.setContentType(null); + + // Add headers to the request + if ('setRequestHeader' in request) { + utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) { + request.setRequestHeader(key, val); + }); + } + + // Add withCredentials to request if needed + if (!utils.isUndefined(_config.withCredentials)) { + request.withCredentials = !!_config.withCredentials; + } + + // Add responseType to request if needed + if (responseType && responseType !== 'json') { + request.responseType = _config.responseType; + } + + // Handle progress if needed + if (typeof _config.onDownloadProgress === 'function') { + request.addEventListener('progress', progressEventReducer(_config.onDownloadProgress, true)); + } + + // Not all browsers support upload events + if (typeof _config.onUploadProgress === 'function' && request.upload) { + request.upload.addEventListener('progress', progressEventReducer(_config.onUploadProgress)); + } + + if (_config.cancelToken || _config.signal) { + // Handle cancellation + // eslint-disable-next-line func-names + onCanceled = cancel => { + if (!request) { + return; + } + reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel); + request.abort(); + request = null; + }; + + _config.cancelToken && _config.cancelToken.subscribe(onCanceled); + if (_config.signal) { + _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled); + } + } + + const protocol = parseProtocol(_config.url); + + if (protocol && platform.protocols.indexOf(protocol) === -1) { + reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config)); + return; + } + + + // Send the request + request.send(requestData || null); + }); +} diff --git a/project starter code/node_modules/axios/lib/axios.js b/project starter code/node_modules/axios/lib/axios.js new file mode 100644 index 00000000..873f246d --- /dev/null +++ b/project starter code/node_modules/axios/lib/axios.js @@ -0,0 +1,89 @@ +'use strict'; + +import utils from './utils.js'; +import bind from './helpers/bind.js'; +import Axios from './core/Axios.js'; +import mergeConfig from './core/mergeConfig.js'; +import defaults from './defaults/index.js'; +import formDataToJSON from './helpers/formDataToJSON.js'; +import CanceledError from './cancel/CanceledError.js'; +import CancelToken from './cancel/CancelToken.js'; +import isCancel from './cancel/isCancel.js'; +import {VERSION} from './env/data.js'; +import toFormData from './helpers/toFormData.js'; +import AxiosError from './core/AxiosError.js'; +import spread from './helpers/spread.js'; +import isAxiosError from './helpers/isAxiosError.js'; +import AxiosHeaders from "./core/AxiosHeaders.js"; +import adapters from './adapters/adapters.js'; +import HttpStatusCode from './helpers/HttpStatusCode.js'; + +/** + * Create an instance of Axios + * + * @param {Object} defaultConfig The default config for the instance + * + * @returns {Axios} A new instance of Axios + */ +function createInstance(defaultConfig) { + const context = new Axios(defaultConfig); + const instance = bind(Axios.prototype.request, context); + + // Copy axios.prototype to instance + utils.extend(instance, Axios.prototype, context, {allOwnKeys: true}); + + // Copy context to instance + utils.extend(instance, context, null, {allOwnKeys: true}); + + // Factory for creating new instances + instance.create = function create(instanceConfig) { + return createInstance(mergeConfig(defaultConfig, instanceConfig)); + }; + + return instance; +} + +// Create the default instance to be exported +const axios = createInstance(defaults); + +// Expose Axios class to allow class inheritance +axios.Axios = Axios; + +// Expose Cancel & CancelToken +axios.CanceledError = CanceledError; +axios.CancelToken = CancelToken; +axios.isCancel = isCancel; +axios.VERSION = VERSION; +axios.toFormData = toFormData; + +// Expose AxiosError class +axios.AxiosError = AxiosError; + +// alias for CanceledError for backward compatibility +axios.Cancel = axios.CanceledError; + +// Expose all/spread +axios.all = function all(promises) { + return Promise.all(promises); +}; + +axios.spread = spread; + +// Expose isAxiosError +axios.isAxiosError = isAxiosError; + +// Expose mergeConfig +axios.mergeConfig = mergeConfig; + +axios.AxiosHeaders = AxiosHeaders; + +axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing); + +axios.getAdapter = adapters.getAdapter; + +axios.HttpStatusCode = HttpStatusCode; + +axios.default = axios; + +// this module should only have a default export +export default axios diff --git a/project starter code/node_modules/axios/lib/cancel/CancelToken.js b/project starter code/node_modules/axios/lib/cancel/CancelToken.js new file mode 100644 index 00000000..20d8f68a --- /dev/null +++ b/project starter code/node_modules/axios/lib/cancel/CancelToken.js @@ -0,0 +1,121 @@ +'use strict'; + +import CanceledError from './CanceledError.js'; + +/** + * A `CancelToken` is an object that can be used to request cancellation of an operation. + * + * @param {Function} executor The executor function. + * + * @returns {CancelToken} + */ +class CancelToken { + constructor(executor) { + if (typeof executor !== 'function') { + throw new TypeError('executor must be a function.'); + } + + let resolvePromise; + + this.promise = new Promise(function promiseExecutor(resolve) { + resolvePromise = resolve; + }); + + const token = this; + + // eslint-disable-next-line func-names + this.promise.then(cancel => { + if (!token._listeners) return; + + let i = token._listeners.length; + + while (i-- > 0) { + token._listeners[i](cancel); + } + token._listeners = null; + }); + + // eslint-disable-next-line func-names + this.promise.then = onfulfilled => { + let _resolve; + // eslint-disable-next-line func-names + const promise = new Promise(resolve => { + token.subscribe(resolve); + _resolve = resolve; + }).then(onfulfilled); + + promise.cancel = function reject() { + token.unsubscribe(_resolve); + }; + + return promise; + }; + + executor(function cancel(message, config, request) { + if (token.reason) { + // Cancellation has already been requested + return; + } + + token.reason = new CanceledError(message, config, request); + resolvePromise(token.reason); + }); + } + + /** + * Throws a `CanceledError` if cancellation has been requested. + */ + throwIfRequested() { + if (this.reason) { + throw this.reason; + } + } + + /** + * Subscribe to the cancel signal + */ + + subscribe(listener) { + if (this.reason) { + listener(this.reason); + return; + } + + if (this._listeners) { + this._listeners.push(listener); + } else { + this._listeners = [listener]; + } + } + + /** + * Unsubscribe from the cancel signal + */ + + unsubscribe(listener) { + if (!this._listeners) { + return; + } + const index = this._listeners.indexOf(listener); + if (index !== -1) { + this._listeners.splice(index, 1); + } + } + + /** + * Returns an object that contains a new `CancelToken` and a function that, when called, + * cancels the `CancelToken`. + */ + static source() { + let cancel; + const token = new CancelToken(function executor(c) { + cancel = c; + }); + return { + token, + cancel + }; + } +} + +export default CancelToken; diff --git a/project starter code/node_modules/axios/lib/cancel/CanceledError.js b/project starter code/node_modules/axios/lib/cancel/CanceledError.js new file mode 100644 index 00000000..880066ed --- /dev/null +++ b/project starter code/node_modules/axios/lib/cancel/CanceledError.js @@ -0,0 +1,25 @@ +'use strict'; + +import AxiosError from '../core/AxiosError.js'; +import utils from '../utils.js'; + +/** + * A `CanceledError` is an object that is thrown when an operation is canceled. + * + * @param {string=} message The message. + * @param {Object=} config The config. + * @param {Object=} request The request. + * + * @returns {CanceledError} The created error. + */ +function CanceledError(message, config, request) { + // eslint-disable-next-line no-eq-null,eqeqeq + AxiosError.call(this, message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request); + this.name = 'CanceledError'; +} + +utils.inherits(CanceledError, AxiosError, { + __CANCEL__: true +}); + +export default CanceledError; diff --git a/project starter code/node_modules/axios/lib/cancel/isCancel.js b/project starter code/node_modules/axios/lib/cancel/isCancel.js new file mode 100644 index 00000000..a444a129 --- /dev/null +++ b/project starter code/node_modules/axios/lib/cancel/isCancel.js @@ -0,0 +1,5 @@ +'use strict'; + +export default function isCancel(value) { + return !!(value && value.__CANCEL__); +} diff --git a/project starter code/node_modules/axios/lib/core/Axios.js b/project starter code/node_modules/axios/lib/core/Axios.js new file mode 100644 index 00000000..2765bbbd --- /dev/null +++ b/project starter code/node_modules/axios/lib/core/Axios.js @@ -0,0 +1,228 @@ +'use strict'; + +import utils from './../utils.js'; +import buildURL from '../helpers/buildURL.js'; +import InterceptorManager from './InterceptorManager.js'; +import dispatchRequest from './dispatchRequest.js'; +import mergeConfig from './mergeConfig.js'; +import buildFullPath from './buildFullPath.js'; +import validator from '../helpers/validator.js'; +import AxiosHeaders from './AxiosHeaders.js'; + +const validators = validator.validators; + +/** + * Create a new instance of Axios + * + * @param {Object} instanceConfig The default config for the instance + * + * @return {Axios} A new instance of Axios + */ +class Axios { + constructor(instanceConfig) { + this.defaults = instanceConfig; + this.interceptors = { + request: new InterceptorManager(), + response: new InterceptorManager() + }; + } + + /** + * Dispatch a request + * + * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults) + * @param {?Object} config + * + * @returns {Promise} The Promise to be fulfilled + */ + async request(configOrUrl, config) { + try { + return await this._request(configOrUrl, config); + } catch (err) { + if (err instanceof Error) { + let dummy; + + Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : (dummy = new Error()); + + // slice off the Error: ... line + const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : ''; + try { + if (!err.stack) { + err.stack = stack; + // match without the 2 top stack lines + } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) { + err.stack += '\n' + stack + } + } catch (e) { + // ignore the case where "stack" is an un-writable property + } + } + + throw err; + } + } + + _request(configOrUrl, config) { + /*eslint no-param-reassign:0*/ + // Allow for axios('example/url'[, config]) a la fetch API + if (typeof configOrUrl === 'string') { + config = config || {}; + config.url = configOrUrl; + } else { + config = configOrUrl || {}; + } + + config = mergeConfig(this.defaults, config); + + const {transitional, paramsSerializer, headers} = config; + + if (transitional !== undefined) { + validator.assertOptions(transitional, { + silentJSONParsing: validators.transitional(validators.boolean), + forcedJSONParsing: validators.transitional(validators.boolean), + clarifyTimeoutError: validators.transitional(validators.boolean) + }, false); + } + + if (paramsSerializer != null) { + if (utils.isFunction(paramsSerializer)) { + config.paramsSerializer = { + serialize: paramsSerializer + } + } else { + validator.assertOptions(paramsSerializer, { + encode: validators.function, + serialize: validators.function + }, true); + } + } + + // Set config.method + config.method = (config.method || this.defaults.method || 'get').toLowerCase(); + + // Flatten headers + let contextHeaders = headers && utils.merge( + headers.common, + headers[config.method] + ); + + headers && utils.forEach( + ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], + (method) => { + delete headers[method]; + } + ); + + config.headers = AxiosHeaders.concat(contextHeaders, headers); + + // filter out skipped interceptors + const requestInterceptorChain = []; + let synchronousRequestInterceptors = true; + this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { + if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { + return; + } + + synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; + + requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); + }); + + const responseInterceptorChain = []; + this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { + responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); + }); + + let promise; + let i = 0; + let len; + + if (!synchronousRequestInterceptors) { + const chain = [dispatchRequest.bind(this), undefined]; + chain.unshift.apply(chain, requestInterceptorChain); + chain.push.apply(chain, responseInterceptorChain); + len = chain.length; + + promise = Promise.resolve(config); + + while (i < len) { + promise = promise.then(chain[i++], chain[i++]); + } + + return promise; + } + + len = requestInterceptorChain.length; + + let newConfig = config; + + i = 0; + + while (i < len) { + const onFulfilled = requestInterceptorChain[i++]; + const onRejected = requestInterceptorChain[i++]; + try { + newConfig = onFulfilled(newConfig); + } catch (error) { + onRejected.call(this, error); + break; + } + } + + try { + promise = dispatchRequest.call(this, newConfig); + } catch (error) { + return Promise.reject(error); + } + + i = 0; + len = responseInterceptorChain.length; + + while (i < len) { + promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]); + } + + return promise; + } + + getUri(config) { + config = mergeConfig(this.defaults, config); + const fullPath = buildFullPath(config.baseURL, config.url); + return buildURL(fullPath, config.params, config.paramsSerializer); + } +} + +// Provide aliases for supported request methods +utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function(url, config) { + return this.request(mergeConfig(config || {}, { + method, + url, + data: (config || {}).data + })); + }; +}); + +utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + /*eslint func-names:0*/ + + function generateHTTPMethod(isForm) { + return function httpMethod(url, data, config) { + return this.request(mergeConfig(config || {}, { + method, + headers: isForm ? { + 'Content-Type': 'multipart/form-data' + } : {}, + url, + data + })); + }; + } + + Axios.prototype[method] = generateHTTPMethod(); + + Axios.prototype[method + 'Form'] = generateHTTPMethod(true); +}); + +export default Axios; diff --git a/project starter code/node_modules/axios/lib/core/AxiosError.js b/project starter code/node_modules/axios/lib/core/AxiosError.js new file mode 100644 index 00000000..7141a8cd --- /dev/null +++ b/project starter code/node_modules/axios/lib/core/AxiosError.js @@ -0,0 +1,100 @@ +'use strict'; + +import utils from '../utils.js'; + +/** + * Create an Error with the specified message, config, error code, request and response. + * + * @param {string} message The error message. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [config] The config. + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * + * @returns {Error} The created error. + */ +function AxiosError(message, code, config, request, response) { + Error.call(this); + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } else { + this.stack = (new Error()).stack; + } + + this.message = message; + this.name = 'AxiosError'; + code && (this.code = code); + config && (this.config = config); + request && (this.request = request); + response && (this.response = response); +} + +utils.inherits(AxiosError, Error, { + toJSON: function toJSON() { + return { + // Standard + message: this.message, + name: this.name, + // Microsoft + description: this.description, + number: this.number, + // Mozilla + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + // Axios + config: utils.toJSONObject(this.config), + code: this.code, + status: this.response && this.response.status ? this.response.status : null + }; + } +}); + +const prototype = AxiosError.prototype; +const descriptors = {}; + +[ + 'ERR_BAD_OPTION_VALUE', + 'ERR_BAD_OPTION', + 'ECONNABORTED', + 'ETIMEDOUT', + 'ERR_NETWORK', + 'ERR_FR_TOO_MANY_REDIRECTS', + 'ERR_DEPRECATED', + 'ERR_BAD_RESPONSE', + 'ERR_BAD_REQUEST', + 'ERR_CANCELED', + 'ERR_NOT_SUPPORT', + 'ERR_INVALID_URL' +// eslint-disable-next-line func-names +].forEach(code => { + descriptors[code] = {value: code}; +}); + +Object.defineProperties(AxiosError, descriptors); +Object.defineProperty(prototype, 'isAxiosError', {value: true}); + +// eslint-disable-next-line func-names +AxiosError.from = (error, code, config, request, response, customProps) => { + const axiosError = Object.create(prototype); + + utils.toFlatObject(error, axiosError, function filter(obj) { + return obj !== Error.prototype; + }, prop => { + return prop !== 'isAxiosError'; + }); + + AxiosError.call(axiosError, error.message, code, config, request, response); + + axiosError.cause = error; + + axiosError.name = error.name; + + customProps && Object.assign(axiosError, customProps); + + return axiosError; +}; + +export default AxiosError; diff --git a/project starter code/node_modules/axios/lib/core/AxiosHeaders.js b/project starter code/node_modules/axios/lib/core/AxiosHeaders.js new file mode 100644 index 00000000..7b576e9e --- /dev/null +++ b/project starter code/node_modules/axios/lib/core/AxiosHeaders.js @@ -0,0 +1,302 @@ +'use strict'; + +import utils from '../utils.js'; +import parseHeaders from '../helpers/parseHeaders.js'; + +const $internals = Symbol('internals'); + +function normalizeHeader(header) { + return header && String(header).trim().toLowerCase(); +} + +function normalizeValue(value) { + if (value === false || value == null) { + return value; + } + + return utils.isArray(value) ? value.map(normalizeValue) : String(value); +} + +function parseTokens(str) { + const tokens = Object.create(null); + const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; + let match; + + while ((match = tokensRE.exec(str))) { + tokens[match[1]] = match[2]; + } + + return tokens; +} + +const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim()); + +function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) { + if (utils.isFunction(filter)) { + return filter.call(this, value, header); + } + + if (isHeaderNameFilter) { + value = header; + } + + if (!utils.isString(value)) return; + + if (utils.isString(filter)) { + return value.indexOf(filter) !== -1; + } + + if (utils.isRegExp(filter)) { + return filter.test(value); + } +} + +function formatHeader(header) { + return header.trim() + .toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => { + return char.toUpperCase() + str; + }); +} + +function buildAccessors(obj, header) { + const accessorName = utils.toCamelCase(' ' + header); + + ['get', 'set', 'has'].forEach(methodName => { + Object.defineProperty(obj, methodName + accessorName, { + value: function(arg1, arg2, arg3) { + return this[methodName].call(this, header, arg1, arg2, arg3); + }, + configurable: true + }); + }); +} + +class AxiosHeaders { + constructor(headers) { + headers && this.set(headers); + } + + set(header, valueOrRewrite, rewrite) { + const self = this; + + function setHeader(_value, _header, _rewrite) { + const lHeader = normalizeHeader(_header); + + if (!lHeader) { + throw new Error('header name must be a non-empty string'); + } + + const key = utils.findKey(self, lHeader); + + if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) { + self[key || _header] = normalizeValue(_value); + } + } + + const setHeaders = (headers, _rewrite) => + utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite)); + + if (utils.isPlainObject(header) || header instanceof this.constructor) { + setHeaders(header, valueOrRewrite) + } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) { + setHeaders(parseHeaders(header), valueOrRewrite); + } else if (utils.isHeaders(header)) { + for (const [key, value] of header.entries()) { + setHeader(value, key, rewrite); + } + } else { + header != null && setHeader(valueOrRewrite, header, rewrite); + } + + return this; + } + + get(header, parser) { + header = normalizeHeader(header); + + if (header) { + const key = utils.findKey(this, header); + + if (key) { + const value = this[key]; + + if (!parser) { + return value; + } + + if (parser === true) { + return parseTokens(value); + } + + if (utils.isFunction(parser)) { + return parser.call(this, value, key); + } + + if (utils.isRegExp(parser)) { + return parser.exec(value); + } + + throw new TypeError('parser must be boolean|regexp|function'); + } + } + } + + has(header, matcher) { + header = normalizeHeader(header); + + if (header) { + const key = utils.findKey(this, header); + + return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher))); + } + + return false; + } + + delete(header, matcher) { + const self = this; + let deleted = false; + + function deleteHeader(_header) { + _header = normalizeHeader(_header); + + if (_header) { + const key = utils.findKey(self, _header); + + if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) { + delete self[key]; + + deleted = true; + } + } + } + + if (utils.isArray(header)) { + header.forEach(deleteHeader); + } else { + deleteHeader(header); + } + + return deleted; + } + + clear(matcher) { + const keys = Object.keys(this); + let i = keys.length; + let deleted = false; + + while (i--) { + const key = keys[i]; + if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) { + delete this[key]; + deleted = true; + } + } + + return deleted; + } + + normalize(format) { + const self = this; + const headers = {}; + + utils.forEach(this, (value, header) => { + const key = utils.findKey(headers, header); + + if (key) { + self[key] = normalizeValue(value); + delete self[header]; + return; + } + + const normalized = format ? formatHeader(header) : String(header).trim(); + + if (normalized !== header) { + delete self[header]; + } + + self[normalized] = normalizeValue(value); + + headers[normalized] = true; + }); + + return this; + } + + concat(...targets) { + return this.constructor.concat(this, ...targets); + } + + toJSON(asStrings) { + const obj = Object.create(null); + + utils.forEach(this, (value, header) => { + value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value); + }); + + return obj; + } + + [Symbol.iterator]() { + return Object.entries(this.toJSON())[Symbol.iterator](); + } + + toString() { + return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n'); + } + + get [Symbol.toStringTag]() { + return 'AxiosHeaders'; + } + + static from(thing) { + return thing instanceof this ? thing : new this(thing); + } + + static concat(first, ...targets) { + const computed = new this(first); + + targets.forEach((target) => computed.set(target)); + + return computed; + } + + static accessor(header) { + const internals = this[$internals] = (this[$internals] = { + accessors: {} + }); + + const accessors = internals.accessors; + const prototype = this.prototype; + + function defineAccessor(_header) { + const lHeader = normalizeHeader(_header); + + if (!accessors[lHeader]) { + buildAccessors(prototype, _header); + accessors[lHeader] = true; + } + } + + utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header); + + return this; + } +} + +AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']); + +// reserved names hotfix +utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => { + let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set` + return { + get: () => value, + set(headerValue) { + this[mapped] = headerValue; + } + } +}); + +utils.freezeMethods(AxiosHeaders); + +export default AxiosHeaders; diff --git a/project starter code/node_modules/axios/lib/core/InterceptorManager.js b/project starter code/node_modules/axios/lib/core/InterceptorManager.js new file mode 100644 index 00000000..6657a9d2 --- /dev/null +++ b/project starter code/node_modules/axios/lib/core/InterceptorManager.js @@ -0,0 +1,71 @@ +'use strict'; + +import utils from './../utils.js'; + +class InterceptorManager { + constructor() { + this.handlers = []; + } + + /** + * Add a new interceptor to the stack + * + * @param {Function} fulfilled The function to handle `then` for a `Promise` + * @param {Function} rejected The function to handle `reject` for a `Promise` + * + * @return {Number} An ID used to remove interceptor later + */ + use(fulfilled, rejected, options) { + this.handlers.push({ + fulfilled, + rejected, + synchronous: options ? options.synchronous : false, + runWhen: options ? options.runWhen : null + }); + return this.handlers.length - 1; + } + + /** + * Remove an interceptor from the stack + * + * @param {Number} id The ID that was returned by `use` + * + * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise + */ + eject(id) { + if (this.handlers[id]) { + this.handlers[id] = null; + } + } + + /** + * Clear all interceptors from the stack + * + * @returns {void} + */ + clear() { + if (this.handlers) { + this.handlers = []; + } + } + + /** + * Iterate over all the registered interceptors + * + * This method is particularly useful for skipping over any + * interceptors that may have become `null` calling `eject`. + * + * @param {Function} fn The function to call for each interceptor + * + * @returns {void} + */ + forEach(fn) { + utils.forEach(this.handlers, function forEachHandler(h) { + if (h !== null) { + fn(h); + } + }); + } +} + +export default InterceptorManager; diff --git a/project starter code/node_modules/axios/lib/core/README.md b/project starter code/node_modules/axios/lib/core/README.md new file mode 100644 index 00000000..84559ce7 --- /dev/null +++ b/project starter code/node_modules/axios/lib/core/README.md @@ -0,0 +1,8 @@ +# axios // core + +The modules found in `core/` should be modules that are specific to the domain logic of axios. These modules would most likely not make sense to be consumed outside of the axios module, as their logic is too specific. Some examples of core modules are: + +- Dispatching requests + - Requests sent via `adapters/` (see lib/adapters/README.md) +- Managing interceptors +- Handling config diff --git a/project starter code/node_modules/axios/lib/core/buildFullPath.js b/project starter code/node_modules/axios/lib/core/buildFullPath.js new file mode 100644 index 00000000..b60927c0 --- /dev/null +++ b/project starter code/node_modules/axios/lib/core/buildFullPath.js @@ -0,0 +1,21 @@ +'use strict'; + +import isAbsoluteURL from '../helpers/isAbsoluteURL.js'; +import combineURLs from '../helpers/combineURLs.js'; + +/** + * Creates a new URL by combining the baseURL with the requestedURL, + * only when the requestedURL is not already an absolute URL. + * If the requestURL is absolute, this function returns the requestedURL untouched. + * + * @param {string} baseURL The base URL + * @param {string} requestedURL Absolute or relative URL to combine + * + * @returns {string} The combined full path + */ +export default function buildFullPath(baseURL, requestedURL) { + if (baseURL && !isAbsoluteURL(requestedURL)) { + return combineURLs(baseURL, requestedURL); + } + return requestedURL; +} diff --git a/project starter code/node_modules/axios/lib/core/dispatchRequest.js b/project starter code/node_modules/axios/lib/core/dispatchRequest.js new file mode 100644 index 00000000..9e306aac --- /dev/null +++ b/project starter code/node_modules/axios/lib/core/dispatchRequest.js @@ -0,0 +1,81 @@ +'use strict'; + +import transformData from './transformData.js'; +import isCancel from '../cancel/isCancel.js'; +import defaults from '../defaults/index.js'; +import CanceledError from '../cancel/CanceledError.js'; +import AxiosHeaders from '../core/AxiosHeaders.js'; +import adapters from "../adapters/adapters.js"; + +/** + * Throws a `CanceledError` if cancellation has been requested. + * + * @param {Object} config The config that is to be used for the request + * + * @returns {void} + */ +function throwIfCancellationRequested(config) { + if (config.cancelToken) { + config.cancelToken.throwIfRequested(); + } + + if (config.signal && config.signal.aborted) { + throw new CanceledError(null, config); + } +} + +/** + * Dispatch a request to the server using the configured adapter. + * + * @param {object} config The config that is to be used for the request + * + * @returns {Promise} The Promise to be fulfilled + */ +export default function dispatchRequest(config) { + throwIfCancellationRequested(config); + + config.headers = AxiosHeaders.from(config.headers); + + // Transform request data + config.data = transformData.call( + config, + config.transformRequest + ); + + if (['post', 'put', 'patch'].indexOf(config.method) !== -1) { + config.headers.setContentType('application/x-www-form-urlencoded', false); + } + + const adapter = adapters.getAdapter(config.adapter || defaults.adapter); + + return adapter(config).then(function onAdapterResolution(response) { + throwIfCancellationRequested(config); + + // Transform response data + response.data = transformData.call( + config, + config.transformResponse, + response + ); + + response.headers = AxiosHeaders.from(response.headers); + + return response; + }, function onAdapterRejection(reason) { + if (!isCancel(reason)) { + throwIfCancellationRequested(config); + + // Transform response data + if (reason && reason.response) { + reason.response.data = transformData.call( + config, + config.transformResponse, + reason.response + ); + reason.response.headers = AxiosHeaders.from(reason.response.headers); + } + } + + return Promise.reject(reason); + }); +} diff --git a/project starter code/node_modules/axios/lib/core/mergeConfig.js b/project starter code/node_modules/axios/lib/core/mergeConfig.js new file mode 100644 index 00000000..e4600e57 --- /dev/null +++ b/project starter code/node_modules/axios/lib/core/mergeConfig.js @@ -0,0 +1,106 @@ +'use strict'; + +import utils from '../utils.js'; +import AxiosHeaders from "./AxiosHeaders.js"; + +const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing; + +/** + * Config-specific merge-function which creates a new config-object + * by merging two configuration objects together. + * + * @param {Object} config1 + * @param {Object} config2 + * + * @returns {Object} New object resulting from merging config2 to config1 + */ +export default function mergeConfig(config1, config2) { + // eslint-disable-next-line no-param-reassign + config2 = config2 || {}; + const config = {}; + + function getMergedValue(target, source, caseless) { + if (utils.isPlainObject(target) && utils.isPlainObject(source)) { + return utils.merge.call({caseless}, target, source); + } else if (utils.isPlainObject(source)) { + return utils.merge({}, source); + } else if (utils.isArray(source)) { + return source.slice(); + } + return source; + } + + // eslint-disable-next-line consistent-return + function mergeDeepProperties(a, b, caseless) { + if (!utils.isUndefined(b)) { + return getMergedValue(a, b, caseless); + } else if (!utils.isUndefined(a)) { + return getMergedValue(undefined, a, caseless); + } + } + + // eslint-disable-next-line consistent-return + function valueFromConfig2(a, b) { + if (!utils.isUndefined(b)) { + return getMergedValue(undefined, b); + } + } + + // eslint-disable-next-line consistent-return + function defaultToConfig2(a, b) { + if (!utils.isUndefined(b)) { + return getMergedValue(undefined, b); + } else if (!utils.isUndefined(a)) { + return getMergedValue(undefined, a); + } + } + + // eslint-disable-next-line consistent-return + function mergeDirectKeys(a, b, prop) { + if (prop in config2) { + return getMergedValue(a, b); + } else if (prop in config1) { + return getMergedValue(undefined, a); + } + } + + const mergeMap = { + url: valueFromConfig2, + method: valueFromConfig2, + data: valueFromConfig2, + baseURL: defaultToConfig2, + transformRequest: defaultToConfig2, + transformResponse: defaultToConfig2, + paramsSerializer: defaultToConfig2, + timeout: defaultToConfig2, + timeoutMessage: defaultToConfig2, + withCredentials: defaultToConfig2, + withXSRFToken: defaultToConfig2, + adapter: defaultToConfig2, + responseType: defaultToConfig2, + xsrfCookieName: defaultToConfig2, + xsrfHeaderName: defaultToConfig2, + onUploadProgress: defaultToConfig2, + onDownloadProgress: defaultToConfig2, + decompress: defaultToConfig2, + maxContentLength: defaultToConfig2, + maxBodyLength: defaultToConfig2, + beforeRedirect: defaultToConfig2, + transport: defaultToConfig2, + httpAgent: defaultToConfig2, + httpsAgent: defaultToConfig2, + cancelToken: defaultToConfig2, + socketPath: defaultToConfig2, + responseEncoding: defaultToConfig2, + validateStatus: mergeDirectKeys, + headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true) + }; + + utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) { + const merge = mergeMap[prop] || mergeDeepProperties; + const configValue = merge(config1[prop], config2[prop], prop); + (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue); + }); + + return config; +} diff --git a/project starter code/node_modules/axios/lib/core/settle.js b/project starter code/node_modules/axios/lib/core/settle.js new file mode 100644 index 00000000..ac905c43 --- /dev/null +++ b/project starter code/node_modules/axios/lib/core/settle.js @@ -0,0 +1,27 @@ +'use strict'; + +import AxiosError from './AxiosError.js'; + +/** + * Resolve or reject a Promise based on response status. + * + * @param {Function} resolve A function that resolves the promise. + * @param {Function} reject A function that rejects the promise. + * @param {object} response The response. + * + * @returns {object} The response. + */ +export default function settle(resolve, reject, response) { + const validateStatus = response.config.validateStatus; + if (!response.status || !validateStatus || validateStatus(response.status)) { + resolve(response); + } else { + reject(new AxiosError( + 'Request failed with status code ' + response.status, + [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], + response.config, + response.request, + response + )); + } +} diff --git a/project starter code/node_modules/axios/lib/core/transformData.js b/project starter code/node_modules/axios/lib/core/transformData.js new file mode 100644 index 00000000..eeb5a8a1 --- /dev/null +++ b/project starter code/node_modules/axios/lib/core/transformData.js @@ -0,0 +1,28 @@ +'use strict'; + +import utils from './../utils.js'; +import defaults from '../defaults/index.js'; +import AxiosHeaders from '../core/AxiosHeaders.js'; + +/** + * Transform the data for a request or a response + * + * @param {Array|Function} fns A single function or Array of functions + * @param {?Object} response The response object + * + * @returns {*} The resulting transformed data + */ +export default function transformData(fns, response) { + const config = this || defaults; + const context = response || config; + const headers = AxiosHeaders.from(context.headers); + let data = context.data; + + utils.forEach(fns, function transform(fn) { + data = fn.call(config, data, headers.normalize(), response ? response.status : undefined); + }); + + headers.normalize(); + + return data; +} diff --git a/project starter code/node_modules/axios/lib/defaults/index.js b/project starter code/node_modules/axios/lib/defaults/index.js new file mode 100644 index 00000000..e543fea2 --- /dev/null +++ b/project starter code/node_modules/axios/lib/defaults/index.js @@ -0,0 +1,161 @@ +'use strict'; + +import utils from '../utils.js'; +import AxiosError from '../core/AxiosError.js'; +import transitionalDefaults from './transitional.js'; +import toFormData from '../helpers/toFormData.js'; +import toURLEncodedForm from '../helpers/toURLEncodedForm.js'; +import platform from '../platform/index.js'; +import formDataToJSON from '../helpers/formDataToJSON.js'; + +/** + * It takes a string, tries to parse it, and if it fails, it returns the stringified version + * of the input + * + * @param {any} rawValue - The value to be stringified. + * @param {Function} parser - A function that parses a string into a JavaScript object. + * @param {Function} encoder - A function that takes a value and returns a string. + * + * @returns {string} A stringified version of the rawValue. + */ +function stringifySafely(rawValue, parser, encoder) { + if (utils.isString(rawValue)) { + try { + (parser || JSON.parse)(rawValue); + return utils.trim(rawValue); + } catch (e) { + if (e.name !== 'SyntaxError') { + throw e; + } + } + } + + return (encoder || JSON.stringify)(rawValue); +} + +const defaults = { + + transitional: transitionalDefaults, + + adapter: ['xhr', 'http', 'fetch'], + + transformRequest: [function transformRequest(data, headers) { + const contentType = headers.getContentType() || ''; + const hasJSONContentType = contentType.indexOf('application/json') > -1; + const isObjectPayload = utils.isObject(data); + + if (isObjectPayload && utils.isHTMLForm(data)) { + data = new FormData(data); + } + + const isFormData = utils.isFormData(data); + + if (isFormData) { + return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data; + } + + if (utils.isArrayBuffer(data) || + utils.isBuffer(data) || + utils.isStream(data) || + utils.isFile(data) || + utils.isBlob(data) || + utils.isReadableStream(data) + ) { + return data; + } + if (utils.isArrayBufferView(data)) { + return data.buffer; + } + if (utils.isURLSearchParams(data)) { + headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false); + return data.toString(); + } + + let isFileList; + + if (isObjectPayload) { + if (contentType.indexOf('application/x-www-form-urlencoded') > -1) { + return toURLEncodedForm(data, this.formSerializer).toString(); + } + + if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) { + const _FormData = this.env && this.env.FormData; + + return toFormData( + isFileList ? {'files[]': data} : data, + _FormData && new _FormData(), + this.formSerializer + ); + } + } + + if (isObjectPayload || hasJSONContentType ) { + headers.setContentType('application/json', false); + return stringifySafely(data); + } + + return data; + }], + + transformResponse: [function transformResponse(data) { + const transitional = this.transitional || defaults.transitional; + const forcedJSONParsing = transitional && transitional.forcedJSONParsing; + const JSONRequested = this.responseType === 'json'; + + if (utils.isResponse(data) || utils.isReadableStream(data)) { + return data; + } + + if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) { + const silentJSONParsing = transitional && transitional.silentJSONParsing; + const strictJSONParsing = !silentJSONParsing && JSONRequested; + + try { + return JSON.parse(data); + } catch (e) { + if (strictJSONParsing) { + if (e.name === 'SyntaxError') { + throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response); + } + throw e; + } + } + } + + return data; + }], + + /** + * A timeout in milliseconds to abort a request. If set to 0 (default) a + * timeout is not created. + */ + timeout: 0, + + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN', + + maxContentLength: -1, + maxBodyLength: -1, + + env: { + FormData: platform.classes.FormData, + Blob: platform.classes.Blob + }, + + validateStatus: function validateStatus(status) { + return status >= 200 && status < 300; + }, + + headers: { + common: { + 'Accept': 'application/json, text/plain, */*', + 'Content-Type': undefined + } + } +}; + +utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => { + defaults.headers[method] = {}; +}); + +export default defaults; diff --git a/project starter code/node_modules/axios/lib/defaults/transitional.js b/project starter code/node_modules/axios/lib/defaults/transitional.js new file mode 100644 index 00000000..f8913319 --- /dev/null +++ b/project starter code/node_modules/axios/lib/defaults/transitional.js @@ -0,0 +1,7 @@ +'use strict'; + +export default { + silentJSONParsing: true, + forcedJSONParsing: true, + clarifyTimeoutError: false +}; diff --git a/project starter code/node_modules/axios/lib/env/README.md b/project starter code/node_modules/axios/lib/env/README.md new file mode 100644 index 00000000..b41baff3 --- /dev/null +++ b/project starter code/node_modules/axios/lib/env/README.md @@ -0,0 +1,3 @@ +# axios // env + +The `data.js` file is updated automatically when the package version is upgrading. Please do not edit it manually. diff --git a/project starter code/node_modules/axios/lib/env/classes/FormData.js b/project starter code/node_modules/axios/lib/env/classes/FormData.js new file mode 100644 index 00000000..862adb93 --- /dev/null +++ b/project starter code/node_modules/axios/lib/env/classes/FormData.js @@ -0,0 +1,2 @@ +import _FormData from 'form-data'; +export default typeof FormData !== 'undefined' ? FormData : _FormData; diff --git a/project starter code/node_modules/axios/lib/env/data.js b/project starter code/node_modules/axios/lib/env/data.js new file mode 100644 index 00000000..487d829f --- /dev/null +++ b/project starter code/node_modules/axios/lib/env/data.js @@ -0,0 +1 @@ +export const VERSION = "1.7.2"; \ No newline at end of file diff --git a/project starter code/node_modules/axios/lib/helpers/AxiosTransformStream.js b/project starter code/node_modules/axios/lib/helpers/AxiosTransformStream.js new file mode 100644 index 00000000..92ba8833 --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/AxiosTransformStream.js @@ -0,0 +1,192 @@ +'use strict'; + +import stream from 'stream'; +import utils from '../utils.js'; +import throttle from './throttle.js'; +import speedometer from './speedometer.js'; + +const kInternals = Symbol('internals'); + +class AxiosTransformStream extends stream.Transform{ + constructor(options) { + options = utils.toFlatObject(options, { + maxRate: 0, + chunkSize: 64 * 1024, + minChunkSize: 100, + timeWindow: 500, + ticksRate: 2, + samplesCount: 15 + }, null, (prop, source) => { + return !utils.isUndefined(source[prop]); + }); + + super({ + readableHighWaterMark: options.chunkSize + }); + + const self = this; + + const internals = this[kInternals] = { + length: options.length, + timeWindow: options.timeWindow, + ticksRate: options.ticksRate, + chunkSize: options.chunkSize, + maxRate: options.maxRate, + minChunkSize: options.minChunkSize, + bytesSeen: 0, + isCaptured: false, + notifiedBytesLoaded: 0, + ts: Date.now(), + bytes: 0, + onReadCallback: null + }; + + const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow); + + this.on('newListener', event => { + if (event === 'progress') { + if (!internals.isCaptured) { + internals.isCaptured = true; + } + } + }); + + let bytesNotified = 0; + + internals.updateProgress = throttle(function throttledHandler() { + const totalBytes = internals.length; + const bytesTransferred = internals.bytesSeen; + const progressBytes = bytesTransferred - bytesNotified; + if (!progressBytes || self.destroyed) return; + + const rate = _speedometer(progressBytes); + + bytesNotified = bytesTransferred; + + process.nextTick(() => { + self.emit('progress', { + loaded: bytesTransferred, + total: totalBytes, + progress: totalBytes ? (bytesTransferred / totalBytes) : undefined, + bytes: progressBytes, + rate: rate ? rate : undefined, + estimated: rate && totalBytes && bytesTransferred <= totalBytes ? + (totalBytes - bytesTransferred) / rate : undefined, + lengthComputable: totalBytes != null + }); + }); + }, internals.ticksRate); + + const onFinish = () => { + internals.updateProgress.call(true); + }; + + this.once('end', onFinish); + this.once('error', onFinish); + } + + _read(size) { + const internals = this[kInternals]; + + if (internals.onReadCallback) { + internals.onReadCallback(); + } + + return super._read(size); + } + + _transform(chunk, encoding, callback) { + const self = this; + const internals = this[kInternals]; + const maxRate = internals.maxRate; + + const readableHighWaterMark = this.readableHighWaterMark; + + const timeWindow = internals.timeWindow; + + const divider = 1000 / timeWindow; + const bytesThreshold = (maxRate / divider); + const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0; + + function pushChunk(_chunk, _callback) { + const bytes = Buffer.byteLength(_chunk); + internals.bytesSeen += bytes; + internals.bytes += bytes; + + if (internals.isCaptured) { + internals.updateProgress(); + } + + if (self.push(_chunk)) { + process.nextTick(_callback); + } else { + internals.onReadCallback = () => { + internals.onReadCallback = null; + process.nextTick(_callback); + }; + } + } + + const transformChunk = (_chunk, _callback) => { + const chunkSize = Buffer.byteLength(_chunk); + let chunkRemainder = null; + let maxChunkSize = readableHighWaterMark; + let bytesLeft; + let passed = 0; + + if (maxRate) { + const now = Date.now(); + + if (!internals.ts || (passed = (now - internals.ts)) >= timeWindow) { + internals.ts = now; + bytesLeft = bytesThreshold - internals.bytes; + internals.bytes = bytesLeft < 0 ? -bytesLeft : 0; + passed = 0; + } + + bytesLeft = bytesThreshold - internals.bytes; + } + + if (maxRate) { + if (bytesLeft <= 0) { + // next time window + return setTimeout(() => { + _callback(null, _chunk); + }, timeWindow - passed); + } + + if (bytesLeft < maxChunkSize) { + maxChunkSize = bytesLeft; + } + } + + if (maxChunkSize && chunkSize > maxChunkSize && (chunkSize - maxChunkSize) > minChunkSize) { + chunkRemainder = _chunk.subarray(maxChunkSize); + _chunk = _chunk.subarray(0, maxChunkSize); + } + + pushChunk(_chunk, chunkRemainder ? () => { + process.nextTick(_callback, null, chunkRemainder); + } : _callback); + }; + + transformChunk(chunk, function transformNextChunk(err, _chunk) { + if (err) { + return callback(err); + } + + if (_chunk) { + transformChunk(_chunk, transformNextChunk); + } else { + callback(null); + } + }); + } + + setLength(length) { + this[kInternals].length = +length; + return this; + } +} + +export default AxiosTransformStream; diff --git a/project starter code/node_modules/axios/lib/helpers/AxiosURLSearchParams.js b/project starter code/node_modules/axios/lib/helpers/AxiosURLSearchParams.js new file mode 100644 index 00000000..b9aa9f02 --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/AxiosURLSearchParams.js @@ -0,0 +1,58 @@ +'use strict'; + +import toFormData from './toFormData.js'; + +/** + * It encodes a string by replacing all characters that are not in the unreserved set with + * their percent-encoded equivalents + * + * @param {string} str - The string to encode. + * + * @returns {string} The encoded string. + */ +function encode(str) { + const charMap = { + '!': '%21', + "'": '%27', + '(': '%28', + ')': '%29', + '~': '%7E', + '%20': '+', + '%00': '\x00' + }; + return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) { + return charMap[match]; + }); +} + +/** + * It takes a params object and converts it to a FormData object + * + * @param {Object} params - The parameters to be converted to a FormData object. + * @param {Object} options - The options object passed to the Axios constructor. + * + * @returns {void} + */ +function AxiosURLSearchParams(params, options) { + this._pairs = []; + + params && toFormData(params, this, options); +} + +const prototype = AxiosURLSearchParams.prototype; + +prototype.append = function append(name, value) { + this._pairs.push([name, value]); +}; + +prototype.toString = function toString(encoder) { + const _encode = encoder ? function(value) { + return encoder.call(this, value, encode); + } : encode; + + return this._pairs.map(function each(pair) { + return _encode(pair[0]) + '=' + _encode(pair[1]); + }, '').join('&'); +}; + +export default AxiosURLSearchParams; diff --git a/project starter code/node_modules/axios/lib/helpers/HttpStatusCode.js b/project starter code/node_modules/axios/lib/helpers/HttpStatusCode.js new file mode 100644 index 00000000..b3e7adca --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/HttpStatusCode.js @@ -0,0 +1,71 @@ +const HttpStatusCode = { + Continue: 100, + SwitchingProtocols: 101, + Processing: 102, + EarlyHints: 103, + Ok: 200, + Created: 201, + Accepted: 202, + NonAuthoritativeInformation: 203, + NoContent: 204, + ResetContent: 205, + PartialContent: 206, + MultiStatus: 207, + AlreadyReported: 208, + ImUsed: 226, + MultipleChoices: 300, + MovedPermanently: 301, + Found: 302, + SeeOther: 303, + NotModified: 304, + UseProxy: 305, + Unused: 306, + TemporaryRedirect: 307, + PermanentRedirect: 308, + BadRequest: 400, + Unauthorized: 401, + PaymentRequired: 402, + Forbidden: 403, + NotFound: 404, + MethodNotAllowed: 405, + NotAcceptable: 406, + ProxyAuthenticationRequired: 407, + RequestTimeout: 408, + Conflict: 409, + Gone: 410, + LengthRequired: 411, + PreconditionFailed: 412, + PayloadTooLarge: 413, + UriTooLong: 414, + UnsupportedMediaType: 415, + RangeNotSatisfiable: 416, + ExpectationFailed: 417, + ImATeapot: 418, + MisdirectedRequest: 421, + UnprocessableEntity: 422, + Locked: 423, + FailedDependency: 424, + TooEarly: 425, + UpgradeRequired: 426, + PreconditionRequired: 428, + TooManyRequests: 429, + RequestHeaderFieldsTooLarge: 431, + UnavailableForLegalReasons: 451, + InternalServerError: 500, + NotImplemented: 501, + BadGateway: 502, + ServiceUnavailable: 503, + GatewayTimeout: 504, + HttpVersionNotSupported: 505, + VariantAlsoNegotiates: 506, + InsufficientStorage: 507, + LoopDetected: 508, + NotExtended: 510, + NetworkAuthenticationRequired: 511, +}; + +Object.entries(HttpStatusCode).forEach(([key, value]) => { + HttpStatusCode[value] = key; +}); + +export default HttpStatusCode; diff --git a/project starter code/node_modules/axios/lib/helpers/README.md b/project starter code/node_modules/axios/lib/helpers/README.md new file mode 100644 index 00000000..4ae34193 --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/README.md @@ -0,0 +1,7 @@ +# axios // helpers + +The modules found in `helpers/` should be generic modules that are _not_ specific to the domain logic of axios. These modules could theoretically be published to npm on their own and consumed by other modules or apps. Some examples of generic modules are things like: + +- Browser polyfills +- Managing cookies +- Parsing HTTP headers diff --git a/project starter code/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js b/project starter code/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js new file mode 100644 index 00000000..d1791f0b --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js @@ -0,0 +1,28 @@ +"use strict"; + +import stream from "stream"; + +class ZlibHeaderTransformStream extends stream.Transform { + __transform(chunk, encoding, callback) { + this.push(chunk); + callback(); + } + + _transform(chunk, encoding, callback) { + if (chunk.length !== 0) { + this._transform = this.__transform; + + // Add Default Compression headers if no zlib headers are present + if (chunk[0] !== 120) { // Hex: 78 + const header = Buffer.alloc(2); + header[0] = 120; // Hex: 78 + header[1] = 156; // Hex: 9C + this.push(header, encoding); + } + } + + this.__transform(chunk, encoding, callback); + } +} + +export default ZlibHeaderTransformStream; diff --git a/project starter code/node_modules/axios/lib/helpers/bind.js b/project starter code/node_modules/axios/lib/helpers/bind.js new file mode 100644 index 00000000..b3aa83b7 --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/bind.js @@ -0,0 +1,7 @@ +'use strict'; + +export default function bind(fn, thisArg) { + return function wrap() { + return fn.apply(thisArg, arguments); + }; +} diff --git a/project starter code/node_modules/axios/lib/helpers/buildURL.js b/project starter code/node_modules/axios/lib/helpers/buildURL.js new file mode 100644 index 00000000..d769fdf4 --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/buildURL.js @@ -0,0 +1,63 @@ +'use strict'; + +import utils from '../utils.js'; +import AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js'; + +/** + * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their + * URI encoded counterparts + * + * @param {string} val The value to be encoded. + * + * @returns {string} The encoded value. + */ +function encode(val) { + return encodeURIComponent(val). + replace(/%3A/gi, ':'). + replace(/%24/g, '$'). + replace(/%2C/gi, ','). + replace(/%20/g, '+'). + replace(/%5B/gi, '['). + replace(/%5D/gi, ']'); +} + +/** + * Build a URL by appending params to the end + * + * @param {string} url The base of the url (e.g., http://www.google.com) + * @param {object} [params] The params to be appended + * @param {?object} options + * + * @returns {string} The formatted url + */ +export default function buildURL(url, params, options) { + /*eslint no-param-reassign:0*/ + if (!params) { + return url; + } + + const _encode = options && options.encode || encode; + + const serializeFn = options && options.serialize; + + let serializedParams; + + if (serializeFn) { + serializedParams = serializeFn(params, options); + } else { + serializedParams = utils.isURLSearchParams(params) ? + params.toString() : + new AxiosURLSearchParams(params, options).toString(_encode); + } + + if (serializedParams) { + const hashmarkIndex = url.indexOf("#"); + + if (hashmarkIndex !== -1) { + url = url.slice(0, hashmarkIndex); + } + url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; + } + + return url; +} diff --git a/project starter code/node_modules/axios/lib/helpers/callbackify.js b/project starter code/node_modules/axios/lib/helpers/callbackify.js new file mode 100644 index 00000000..4603badc --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/callbackify.js @@ -0,0 +1,16 @@ +import utils from "../utils.js"; + +const callbackify = (fn, reducer) => { + return utils.isAsyncFn(fn) ? function (...args) { + const cb = args.pop(); + fn.apply(this, args).then((value) => { + try { + reducer ? cb(null, ...reducer(value)) : cb(null, value); + } catch (err) { + cb(err); + } + }, cb); + } : fn; +} + +export default callbackify; diff --git a/project starter code/node_modules/axios/lib/helpers/combineURLs.js b/project starter code/node_modules/axios/lib/helpers/combineURLs.js new file mode 100644 index 00000000..9f04f020 --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/combineURLs.js @@ -0,0 +1,15 @@ +'use strict'; + +/** + * Creates a new URL by combining the specified URLs + * + * @param {string} baseURL The base URL + * @param {string} relativeURL The relative URL + * + * @returns {string} The combined URL + */ +export default function combineURLs(baseURL, relativeURL) { + return relativeURL + ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') + : baseURL; +} diff --git a/project starter code/node_modules/axios/lib/helpers/composeSignals.js b/project starter code/node_modules/axios/lib/helpers/composeSignals.js new file mode 100644 index 00000000..3f6f2035 --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/composeSignals.js @@ -0,0 +1,46 @@ +import CanceledError from "../cancel/CanceledError.js"; +import AxiosError from "../core/AxiosError.js"; + +const composeSignals = (signals, timeout) => { + let controller = new AbortController(); + + let aborted; + + const onabort = function (cancel) { + if (!aborted) { + aborted = true; + unsubscribe(); + const err = cancel instanceof Error ? cancel : this.reason; + controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err)); + } + } + + let timer = timeout && setTimeout(() => { + onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT)) + }, timeout) + + const unsubscribe = () => { + if (signals) { + timer && clearTimeout(timer); + timer = null; + signals.forEach(signal => { + signal && + (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort)); + }); + signals = null; + } + } + + signals.forEach((signal) => signal && signal.addEventListener && signal.addEventListener('abort', onabort)); + + const {signal} = controller; + + signal.unsubscribe = unsubscribe; + + return [signal, () => { + timer && clearTimeout(timer); + timer = null; + }]; +} + +export default composeSignals; diff --git a/project starter code/node_modules/axios/lib/helpers/cookies.js b/project starter code/node_modules/axios/lib/helpers/cookies.js new file mode 100644 index 00000000..d039ac4f --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/cookies.js @@ -0,0 +1,42 @@ +import utils from './../utils.js'; +import platform from '../platform/index.js'; + +export default platform.hasStandardBrowserEnv ? + + // Standard browser envs support document.cookie + { + write(name, value, expires, path, domain, secure) { + const cookie = [name + '=' + encodeURIComponent(value)]; + + utils.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString()); + + utils.isString(path) && cookie.push('path=' + path); + + utils.isString(domain) && cookie.push('domain=' + domain); + + secure === true && cookie.push('secure'); + + document.cookie = cookie.join('; '); + }, + + read(name) { + const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); + return (match ? decodeURIComponent(match[3]) : null); + }, + + remove(name) { + this.write(name, '', Date.now() - 86400000); + } + } + + : + + // Non-standard browser env (web workers, react-native) lack needed support. + { + write() {}, + read() { + return null; + }, + remove() {} + }; + diff --git a/project starter code/node_modules/axios/lib/helpers/deprecatedMethod.js b/project starter code/node_modules/axios/lib/helpers/deprecatedMethod.js new file mode 100644 index 00000000..9e8fae6b --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/deprecatedMethod.js @@ -0,0 +1,26 @@ +'use strict'; + +/*eslint no-console:0*/ + +/** + * Supply a warning to the developer that a method they are using + * has been deprecated. + * + * @param {string} method The name of the deprecated method + * @param {string} [instead] The alternate method to use if applicable + * @param {string} [docs] The documentation URL to get further details + * + * @returns {void} + */ +export default function deprecatedMethod(method, instead, docs) { + try { + console.warn( + 'DEPRECATED method `' + method + '`.' + + (instead ? ' Use `' + instead + '` instead.' : '') + + ' This method will be removed in a future release.'); + + if (docs) { + console.warn('For more information about usage see ' + docs); + } + } catch (e) { /* Ignore */ } +} diff --git a/project starter code/node_modules/axios/lib/helpers/formDataToJSON.js b/project starter code/node_modules/axios/lib/helpers/formDataToJSON.js new file mode 100644 index 00000000..906ce602 --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/formDataToJSON.js @@ -0,0 +1,95 @@ +'use strict'; + +import utils from '../utils.js'; + +/** + * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z'] + * + * @param {string} name - The name of the property to get. + * + * @returns An array of strings. + */ +function parsePropPath(name) { + // foo[x][y][z] + // foo.x.y.z + // foo-x-y-z + // foo x y z + return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => { + return match[0] === '[]' ? '' : match[1] || match[0]; + }); +} + +/** + * Convert an array to an object. + * + * @param {Array} arr - The array to convert to an object. + * + * @returns An object with the same keys and values as the array. + */ +function arrayToObject(arr) { + const obj = {}; + const keys = Object.keys(arr); + let i; + const len = keys.length; + let key; + for (i = 0; i < len; i++) { + key = keys[i]; + obj[key] = arr[key]; + } + return obj; +} + +/** + * It takes a FormData object and returns a JavaScript object + * + * @param {string} formData The FormData object to convert to JSON. + * + * @returns {Object | null} The converted object. + */ +function formDataToJSON(formData) { + function buildPath(path, value, target, index) { + let name = path[index++]; + + if (name === '__proto__') return true; + + const isNumericKey = Number.isFinite(+name); + const isLast = index >= path.length; + name = !name && utils.isArray(target) ? target.length : name; + + if (isLast) { + if (utils.hasOwnProp(target, name)) { + target[name] = [target[name], value]; + } else { + target[name] = value; + } + + return !isNumericKey; + } + + if (!target[name] || !utils.isObject(target[name])) { + target[name] = []; + } + + const result = buildPath(path, value, target[name], index); + + if (result && utils.isArray(target[name])) { + target[name] = arrayToObject(target[name]); + } + + return !isNumericKey; + } + + if (utils.isFormData(formData) && utils.isFunction(formData.entries)) { + const obj = {}; + + utils.forEachEntry(formData, (name, value) => { + buildPath(parsePropPath(name), value, obj, 0); + }); + + return obj; + } + + return null; +} + +export default formDataToJSON; diff --git a/project starter code/node_modules/axios/lib/helpers/formDataToStream.js b/project starter code/node_modules/axios/lib/helpers/formDataToStream.js new file mode 100644 index 00000000..9187e73e --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/formDataToStream.js @@ -0,0 +1,111 @@ +import {TextEncoder} from 'util'; +import {Readable} from 'stream'; +import utils from "../utils.js"; +import readBlob from "./readBlob.js"; + +const BOUNDARY_ALPHABET = utils.ALPHABET.ALPHA_DIGIT + '-_'; + +const textEncoder = new TextEncoder(); + +const CRLF = '\r\n'; +const CRLF_BYTES = textEncoder.encode(CRLF); +const CRLF_BYTES_COUNT = 2; + +class FormDataPart { + constructor(name, value) { + const {escapeName} = this.constructor; + const isStringValue = utils.isString(value); + + let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${ + !isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : '' + }${CRLF}`; + + if (isStringValue) { + value = textEncoder.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF)); + } else { + headers += `Content-Type: ${value.type || "application/octet-stream"}${CRLF}` + } + + this.headers = textEncoder.encode(headers + CRLF); + + this.contentLength = isStringValue ? value.byteLength : value.size; + + this.size = this.headers.byteLength + this.contentLength + CRLF_BYTES_COUNT; + + this.name = name; + this.value = value; + } + + async *encode(){ + yield this.headers; + + const {value} = this; + + if(utils.isTypedArray(value)) { + yield value; + } else { + yield* readBlob(value); + } + + yield CRLF_BYTES; + } + + static escapeName(name) { + return String(name).replace(/[\r\n"]/g, (match) => ({ + '\r' : '%0D', + '\n' : '%0A', + '"' : '%22', + }[match])); + } +} + +const formDataToStream = (form, headersHandler, options) => { + const { + tag = 'form-data-boundary', + size = 25, + boundary = tag + '-' + utils.generateString(size, BOUNDARY_ALPHABET) + } = options || {}; + + if(!utils.isFormData(form)) { + throw TypeError('FormData instance required'); + } + + if (boundary.length < 1 || boundary.length > 70) { + throw Error('boundary must be 10-70 characters long') + } + + const boundaryBytes = textEncoder.encode('--' + boundary + CRLF); + const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF + CRLF); + let contentLength = footerBytes.byteLength; + + const parts = Array.from(form.entries()).map(([name, value]) => { + const part = new FormDataPart(name, value); + contentLength += part.size; + return part; + }); + + contentLength += boundaryBytes.byteLength * parts.length; + + contentLength = utils.toFiniteNumber(contentLength); + + const computedHeaders = { + 'Content-Type': `multipart/form-data; boundary=${boundary}` + } + + if (Number.isFinite(contentLength)) { + computedHeaders['Content-Length'] = contentLength; + } + + headersHandler && headersHandler(computedHeaders); + + return Readable.from((async function *() { + for(const part of parts) { + yield boundaryBytes; + yield* part.encode(); + } + + yield footerBytes; + })()); +}; + +export default formDataToStream; diff --git a/project starter code/node_modules/axios/lib/helpers/fromDataURI.js b/project starter code/node_modules/axios/lib/helpers/fromDataURI.js new file mode 100644 index 00000000..eb71d3f3 --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/fromDataURI.js @@ -0,0 +1,53 @@ +'use strict'; + +import AxiosError from '../core/AxiosError.js'; +import parseProtocol from './parseProtocol.js'; +import platform from '../platform/index.js'; + +const DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/; + +/** + * Parse data uri to a Buffer or Blob + * + * @param {String} uri + * @param {?Boolean} asBlob + * @param {?Object} options + * @param {?Function} options.Blob + * + * @returns {Buffer|Blob} + */ +export default function fromDataURI(uri, asBlob, options) { + const _Blob = options && options.Blob || platform.classes.Blob; + const protocol = parseProtocol(uri); + + if (asBlob === undefined && _Blob) { + asBlob = true; + } + + if (protocol === 'data') { + uri = protocol.length ? uri.slice(protocol.length + 1) : uri; + + const match = DATA_URL_PATTERN.exec(uri); + + if (!match) { + throw new AxiosError('Invalid URL', AxiosError.ERR_INVALID_URL); + } + + const mime = match[1]; + const isBase64 = match[2]; + const body = match[3]; + const buffer = Buffer.from(decodeURIComponent(body), isBase64 ? 'base64' : 'utf8'); + + if (asBlob) { + if (!_Blob) { + throw new AxiosError('Blob is not supported', AxiosError.ERR_NOT_SUPPORT); + } + + return new _Blob([buffer], {type: mime}); + } + + return buffer; + } + + throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT); +} diff --git a/project starter code/node_modules/axios/lib/helpers/isAbsoluteURL.js b/project starter code/node_modules/axios/lib/helpers/isAbsoluteURL.js new file mode 100644 index 00000000..4747a457 --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/isAbsoluteURL.js @@ -0,0 +1,15 @@ +'use strict'; + +/** + * Determines whether the specified URL is absolute + * + * @param {string} url The URL to test + * + * @returns {boolean} True if the specified URL is absolute, otherwise false + */ +export default function isAbsoluteURL(url) { + // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). + // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed + // by any combination of letters, digits, plus, period, or hyphen. + return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); +} diff --git a/project starter code/node_modules/axios/lib/helpers/isAxiosError.js b/project starter code/node_modules/axios/lib/helpers/isAxiosError.js new file mode 100644 index 00000000..da6cd63f --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/isAxiosError.js @@ -0,0 +1,14 @@ +'use strict'; + +import utils from './../utils.js'; + +/** + * Determines whether the payload is an error thrown by Axios + * + * @param {*} payload The value to test + * + * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false + */ +export default function isAxiosError(payload) { + return utils.isObject(payload) && (payload.isAxiosError === true); +} diff --git a/project starter code/node_modules/axios/lib/helpers/isURLSameOrigin.js b/project starter code/node_modules/axios/lib/helpers/isURLSameOrigin.js new file mode 100644 index 00000000..a8678a4e --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/isURLSameOrigin.js @@ -0,0 +1,67 @@ +'use strict'; + +import utils from './../utils.js'; +import platform from '../platform/index.js'; + +export default platform.hasStandardBrowserEnv ? + +// Standard browser envs have full support of the APIs needed to test +// whether the request URL is of the same origin as current location. + (function standardBrowserEnv() { + const msie = /(msie|trident)/i.test(navigator.userAgent); + const urlParsingNode = document.createElement('a'); + let originURL; + + /** + * Parse a URL to discover its components + * + * @param {String} url The URL to be parsed + * @returns {Object} + */ + function resolveURL(url) { + let href = url; + + if (msie) { + // IE needs attribute set twice to normalize properties + urlParsingNode.setAttribute('href', href); + href = urlParsingNode.href; + } + + urlParsingNode.setAttribute('href', href); + + // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: (urlParsingNode.pathname.charAt(0) === '/') ? + urlParsingNode.pathname : + '/' + urlParsingNode.pathname + }; + } + + originURL = resolveURL(window.location.href); + + /** + * Determine if a URL shares the same origin as the current location + * + * @param {String} requestURL The URL to test + * @returns {boolean} True if URL shares the same origin, otherwise false + */ + return function isURLSameOrigin(requestURL) { + const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; + return (parsed.protocol === originURL.protocol && + parsed.host === originURL.host); + }; + })() : + + // Non standard browser envs (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return function isURLSameOrigin() { + return true; + }; + })(); diff --git a/project starter code/node_modules/axios/lib/helpers/null.js b/project starter code/node_modules/axios/lib/helpers/null.js new file mode 100644 index 00000000..b9f82c46 --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/null.js @@ -0,0 +1,2 @@ +// eslint-disable-next-line strict +export default null; diff --git a/project starter code/node_modules/axios/lib/helpers/parseHeaders.js b/project starter code/node_modules/axios/lib/helpers/parseHeaders.js new file mode 100644 index 00000000..50af9480 --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/parseHeaders.js @@ -0,0 +1,55 @@ +'use strict'; + +import utils from './../utils.js'; + +// RawAxiosHeaders whose duplicates are ignored by node +// c.f. https://nodejs.org/api/http.html#http_message_headers +const ignoreDuplicateOf = utils.toObjectSet([ + 'age', 'authorization', 'content-length', 'content-type', 'etag', + 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', + 'last-modified', 'location', 'max-forwards', 'proxy-authorization', + 'referer', 'retry-after', 'user-agent' +]); + +/** + * Parse headers into an object + * + * ``` + * Date: Wed, 27 Aug 2014 08:58:49 GMT + * Content-Type: application/json + * Connection: keep-alive + * Transfer-Encoding: chunked + * ``` + * + * @param {String} rawHeaders Headers needing to be parsed + * + * @returns {Object} Headers parsed into an object + */ +export default rawHeaders => { + const parsed = {}; + let key; + let val; + let i; + + rawHeaders && rawHeaders.split('\n').forEach(function parser(line) { + i = line.indexOf(':'); + key = line.substring(0, i).trim().toLowerCase(); + val = line.substring(i + 1).trim(); + + if (!key || (parsed[key] && ignoreDuplicateOf[key])) { + return; + } + + if (key === 'set-cookie') { + if (parsed[key]) { + parsed[key].push(val); + } else { + parsed[key] = [val]; + } + } else { + parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; + } + }); + + return parsed; +}; diff --git a/project starter code/node_modules/axios/lib/helpers/parseProtocol.js b/project starter code/node_modules/axios/lib/helpers/parseProtocol.js new file mode 100644 index 00000000..586ec964 --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/parseProtocol.js @@ -0,0 +1,6 @@ +'use strict'; + +export default function parseProtocol(url) { + const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url); + return match && match[1] || ''; +} diff --git a/project starter code/node_modules/axios/lib/helpers/progressEventReducer.js b/project starter code/node_modules/axios/lib/helpers/progressEventReducer.js new file mode 100644 index 00000000..7829be34 --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/progressEventReducer.js @@ -0,0 +1,32 @@ +import speedometer from "./speedometer.js"; +import throttle from "./throttle.js"; + +export default (listener, isDownloadStream, freq = 3) => { + let bytesNotified = 0; + const _speedometer = speedometer(50, 250); + + return throttle(e => { + const loaded = e.loaded; + const total = e.lengthComputable ? e.total : undefined; + const progressBytes = loaded - bytesNotified; + const rate = _speedometer(progressBytes); + const inRange = loaded <= total; + + bytesNotified = loaded; + + const data = { + loaded, + total, + progress: total ? (loaded / total) : undefined, + bytes: progressBytes, + rate: rate ? rate : undefined, + estimated: rate && total && inRange ? (total - loaded) / rate : undefined, + event: e, + lengthComputable: total != null + }; + + data[isDownloadStream ? 'download' : 'upload'] = true; + + listener(data); + }, freq); +} diff --git a/project starter code/node_modules/axios/lib/helpers/readBlob.js b/project starter code/node_modules/axios/lib/helpers/readBlob.js new file mode 100644 index 00000000..6de748e8 --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/readBlob.js @@ -0,0 +1,15 @@ +const {asyncIterator} = Symbol; + +const readBlob = async function* (blob) { + if (blob.stream) { + yield* blob.stream() + } else if (blob.arrayBuffer) { + yield await blob.arrayBuffer() + } else if (blob[asyncIterator]) { + yield* blob[asyncIterator](); + } else { + yield blob; + } +} + +export default readBlob; diff --git a/project starter code/node_modules/axios/lib/helpers/resolveConfig.js b/project starter code/node_modules/axios/lib/helpers/resolveConfig.js new file mode 100644 index 00000000..5e84c5cc --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/resolveConfig.js @@ -0,0 +1,57 @@ +import platform from "../platform/index.js"; +import utils from "../utils.js"; +import isURLSameOrigin from "./isURLSameOrigin.js"; +import cookies from "./cookies.js"; +import buildFullPath from "../core/buildFullPath.js"; +import mergeConfig from "../core/mergeConfig.js"; +import AxiosHeaders from "../core/AxiosHeaders.js"; +import buildURL from "./buildURL.js"; + +export default (config) => { + const newConfig = mergeConfig({}, config); + + let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig; + + newConfig.headers = headers = AxiosHeaders.from(headers); + + newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer); + + // HTTP basic authentication + if (auth) { + headers.set('Authorization', 'Basic ' + + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')) + ); + } + + let contentType; + + if (utils.isFormData(data)) { + if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) { + headers.setContentType(undefined); // Let the browser set it + } else if ((contentType = headers.getContentType()) !== false) { + // fix semicolon duplication issue for ReactNative FormData implementation + const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : []; + headers.setContentType([type || 'multipart/form-data', ...tokens].join('; ')); + } + } + + // Add xsrf header + // This is only done if running in a standard browser environment. + // Specifically not if we're in a web worker, or react-native. + + if (platform.hasStandardBrowserEnv) { + withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig)); + + if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) { + // Add xsrf header + const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName); + + if (xsrfValue) { + headers.set(xsrfHeaderName, xsrfValue); + } + } + } + + return newConfig; +} + diff --git a/project starter code/node_modules/axios/lib/helpers/speedometer.js b/project starter code/node_modules/axios/lib/helpers/speedometer.js new file mode 100644 index 00000000..3b3c6662 --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/speedometer.js @@ -0,0 +1,55 @@ +'use strict'; + +/** + * Calculate data maxRate + * @param {Number} [samplesCount= 10] + * @param {Number} [min= 1000] + * @returns {Function} + */ +function speedometer(samplesCount, min) { + samplesCount = samplesCount || 10; + const bytes = new Array(samplesCount); + const timestamps = new Array(samplesCount); + let head = 0; + let tail = 0; + let firstSampleTS; + + min = min !== undefined ? min : 1000; + + return function push(chunkLength) { + const now = Date.now(); + + const startedAt = timestamps[tail]; + + if (!firstSampleTS) { + firstSampleTS = now; + } + + bytes[head] = chunkLength; + timestamps[head] = now; + + let i = tail; + let bytesCount = 0; + + while (i !== head) { + bytesCount += bytes[i++]; + i = i % samplesCount; + } + + head = (head + 1) % samplesCount; + + if (head === tail) { + tail = (tail + 1) % samplesCount; + } + + if (now - firstSampleTS < min) { + return; + } + + const passed = startedAt && now - startedAt; + + return passed ? Math.round(bytesCount * 1000 / passed) : undefined; + }; +} + +export default speedometer; diff --git a/project starter code/node_modules/axios/lib/helpers/spread.js b/project starter code/node_modules/axios/lib/helpers/spread.js new file mode 100644 index 00000000..13479cb2 --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/spread.js @@ -0,0 +1,28 @@ +'use strict'; + +/** + * Syntactic sugar for invoking a function and expanding an array for arguments. + * + * Common use case would be to use `Function.prototype.apply`. + * + * ```js + * function f(x, y, z) {} + * var args = [1, 2, 3]; + * f.apply(null, args); + * ``` + * + * With `spread` this example can be re-written. + * + * ```js + * spread(function(x, y, z) {})([1, 2, 3]); + * ``` + * + * @param {Function} callback + * + * @returns {Function} + */ +export default function spread(callback) { + return function wrap(arr) { + return callback.apply(null, arr); + }; +} diff --git a/project starter code/node_modules/axios/lib/helpers/throttle.js b/project starter code/node_modules/axios/lib/helpers/throttle.js new file mode 100644 index 00000000..a3204fde --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/throttle.js @@ -0,0 +1,35 @@ +'use strict'; + +/** + * Throttle decorator + * @param {Function} fn + * @param {Number} freq + * @return {Function} + */ +function throttle(fn, freq) { + let timestamp = 0; + const threshold = 1000 / freq; + let timer = null; + return function throttled() { + const force = this === true; + + const now = Date.now(); + if (force || now - timestamp > threshold) { + if (timer) { + clearTimeout(timer); + timer = null; + } + timestamp = now; + return fn.apply(null, arguments); + } + if (!timer) { + timer = setTimeout(() => { + timer = null; + timestamp = Date.now(); + return fn.apply(null, arguments); + }, threshold - (now - timestamp)); + } + }; +} + +export default throttle; diff --git a/project starter code/node_modules/axios/lib/helpers/toFormData.js b/project starter code/node_modules/axios/lib/helpers/toFormData.js new file mode 100644 index 00000000..a41e966c --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/toFormData.js @@ -0,0 +1,219 @@ +'use strict'; + +import utils from '../utils.js'; +import AxiosError from '../core/AxiosError.js'; +// temporary hotfix to avoid circular references until AxiosURLSearchParams is refactored +import PlatformFormData from '../platform/node/classes/FormData.js'; + +/** + * Determines if the given thing is a array or js object. + * + * @param {string} thing - The object or array to be visited. + * + * @returns {boolean} + */ +function isVisitable(thing) { + return utils.isPlainObject(thing) || utils.isArray(thing); +} + +/** + * It removes the brackets from the end of a string + * + * @param {string} key - The key of the parameter. + * + * @returns {string} the key without the brackets. + */ +function removeBrackets(key) { + return utils.endsWith(key, '[]') ? key.slice(0, -2) : key; +} + +/** + * It takes a path, a key, and a boolean, and returns a string + * + * @param {string} path - The path to the current key. + * @param {string} key - The key of the current object being iterated over. + * @param {string} dots - If true, the key will be rendered with dots instead of brackets. + * + * @returns {string} The path to the current key. + */ +function renderKey(path, key, dots) { + if (!path) return key; + return path.concat(key).map(function each(token, i) { + // eslint-disable-next-line no-param-reassign + token = removeBrackets(token); + return !dots && i ? '[' + token + ']' : token; + }).join(dots ? '.' : ''); +} + +/** + * If the array is an array and none of its elements are visitable, then it's a flat array. + * + * @param {Array} arr - The array to check + * + * @returns {boolean} + */ +function isFlatArray(arr) { + return utils.isArray(arr) && !arr.some(isVisitable); +} + +const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) { + return /^is[A-Z]/.test(prop); +}); + +/** + * Convert a data object to FormData + * + * @param {Object} obj + * @param {?Object} [formData] + * @param {?Object} [options] + * @param {Function} [options.visitor] + * @param {Boolean} [options.metaTokens = true] + * @param {Boolean} [options.dots = false] + * @param {?Boolean} [options.indexes = false] + * + * @returns {Object} + **/ + +/** + * It converts an object into a FormData object + * + * @param {Object} obj - The object to convert to form data. + * @param {string} formData - The FormData object to append to. + * @param {Object} options + * + * @returns + */ +function toFormData(obj, formData, options) { + if (!utils.isObject(obj)) { + throw new TypeError('target must be an object'); + } + + // eslint-disable-next-line no-param-reassign + formData = formData || new (PlatformFormData || FormData)(); + + // eslint-disable-next-line no-param-reassign + options = utils.toFlatObject(options, { + metaTokens: true, + dots: false, + indexes: false + }, false, function defined(option, source) { + // eslint-disable-next-line no-eq-null,eqeqeq + return !utils.isUndefined(source[option]); + }); + + const metaTokens = options.metaTokens; + // eslint-disable-next-line no-use-before-define + const visitor = options.visitor || defaultVisitor; + const dots = options.dots; + const indexes = options.indexes; + const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob; + const useBlob = _Blob && utils.isSpecCompliantForm(formData); + + if (!utils.isFunction(visitor)) { + throw new TypeError('visitor must be a function'); + } + + function convertValue(value) { + if (value === null) return ''; + + if (utils.isDate(value)) { + return value.toISOString(); + } + + if (!useBlob && utils.isBlob(value)) { + throw new AxiosError('Blob is not supported. Use a Buffer instead.'); + } + + if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) { + return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value); + } + + return value; + } + + /** + * Default visitor. + * + * @param {*} value + * @param {String|Number} key + * @param {Array} path + * @this {FormData} + * + * @returns {boolean} return true to visit the each prop of the value recursively + */ + function defaultVisitor(value, key, path) { + let arr = value; + + if (value && !path && typeof value === 'object') { + if (utils.endsWith(key, '{}')) { + // eslint-disable-next-line no-param-reassign + key = metaTokens ? key : key.slice(0, -2); + // eslint-disable-next-line no-param-reassign + value = JSON.stringify(value); + } else if ( + (utils.isArray(value) && isFlatArray(value)) || + ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value)) + )) { + // eslint-disable-next-line no-param-reassign + key = removeBrackets(key); + + arr.forEach(function each(el, index) { + !(utils.isUndefined(el) || el === null) && formData.append( + // eslint-disable-next-line no-nested-ternary + indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'), + convertValue(el) + ); + }); + return false; + } + } + + if (isVisitable(value)) { + return true; + } + + formData.append(renderKey(path, key, dots), convertValue(value)); + + return false; + } + + const stack = []; + + const exposedHelpers = Object.assign(predicates, { + defaultVisitor, + convertValue, + isVisitable + }); + + function build(value, path) { + if (utils.isUndefined(value)) return; + + if (stack.indexOf(value) !== -1) { + throw Error('Circular reference detected in ' + path.join('.')); + } + + stack.push(value); + + utils.forEach(value, function each(el, key) { + const result = !(utils.isUndefined(el) || el === null) && visitor.call( + formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers + ); + + if (result === true) { + build(el, path ? path.concat(key) : [key]); + } + }); + + stack.pop(); + } + + if (!utils.isObject(obj)) { + throw new TypeError('data must be an object'); + } + + build(obj); + + return formData; +} + +export default toFormData; diff --git a/project starter code/node_modules/axios/lib/helpers/toURLEncodedForm.js b/project starter code/node_modules/axios/lib/helpers/toURLEncodedForm.js new file mode 100644 index 00000000..988a38a1 --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/toURLEncodedForm.js @@ -0,0 +1,18 @@ +'use strict'; + +import utils from '../utils.js'; +import toFormData from './toFormData.js'; +import platform from '../platform/index.js'; + +export default function toURLEncodedForm(data, options) { + return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({ + visitor: function(value, key, path, helpers) { + if (platform.isNode && utils.isBuffer(value)) { + this.append(key, value.toString('base64')); + return false; + } + + return helpers.defaultVisitor.apply(this, arguments); + } + }, options)); +} diff --git a/project starter code/node_modules/axios/lib/helpers/trackStream.js b/project starter code/node_modules/axios/lib/helpers/trackStream.js new file mode 100644 index 00000000..6241d06f --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/trackStream.js @@ -0,0 +1,55 @@ + + +export const streamChunk = function* (chunk, chunkSize) { + let len = chunk.byteLength; + + if (!chunkSize || len < chunkSize) { + yield chunk; + return; + } + + let pos = 0; + let end; + + while (pos < len) { + end = pos + chunkSize; + yield chunk.slice(pos, end); + pos = end; + } +} + +export const readBytes = async function* (iterable, chunkSize, encode) { + for await (const chunk of iterable) { + yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize); + } +} + +export const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => { + const iterator = readBytes(stream, chunkSize, encode); + + let bytes = 0; + + return new ReadableStream({ + type: 'bytes', + + async pull(controller) { + const {done, value} = await iterator.next(); + + if (done) { + controller.close(); + onFinish(); + return; + } + + let len = value.byteLength; + onProgress && onProgress(bytes += len); + controller.enqueue(new Uint8Array(value)); + }, + cancel(reason) { + onFinish(reason); + return iterator.return(); + } + }, { + highWaterMark: 2 + }) +} diff --git a/project starter code/node_modules/axios/lib/helpers/validator.js b/project starter code/node_modules/axios/lib/helpers/validator.js new file mode 100644 index 00000000..14b46960 --- /dev/null +++ b/project starter code/node_modules/axios/lib/helpers/validator.js @@ -0,0 +1,91 @@ +'use strict'; + +import {VERSION} from '../env/data.js'; +import AxiosError from '../core/AxiosError.js'; + +const validators = {}; + +// eslint-disable-next-line func-names +['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => { + validators[type] = function validator(thing) { + return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type; + }; +}); + +const deprecatedWarnings = {}; + +/** + * Transitional option validator + * + * @param {function|boolean?} validator - set to false if the transitional option has been removed + * @param {string?} version - deprecated version / removed since version + * @param {string?} message - some message with additional info + * + * @returns {function} + */ +validators.transitional = function transitional(validator, version, message) { + function formatMessage(opt, desc) { + return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); + } + + // eslint-disable-next-line func-names + return (value, opt, opts) => { + if (validator === false) { + throw new AxiosError( + formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), + AxiosError.ERR_DEPRECATED + ); + } + + if (version && !deprecatedWarnings[opt]) { + deprecatedWarnings[opt] = true; + // eslint-disable-next-line no-console + console.warn( + formatMessage( + opt, + ' has been deprecated since v' + version + ' and will be removed in the near future' + ) + ); + } + + return validator ? validator(value, opt, opts) : true; + }; +}; + +/** + * Assert object's properties type + * + * @param {object} options + * @param {object} schema + * @param {boolean?} allowUnknown + * + * @returns {object} + */ + +function assertOptions(options, schema, allowUnknown) { + if (typeof options !== 'object') { + throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE); + } + const keys = Object.keys(options); + let i = keys.length; + while (i-- > 0) { + const opt = keys[i]; + const validator = schema[opt]; + if (validator) { + const value = options[opt]; + const result = value === undefined || validator(value, opt, options); + if (result !== true) { + throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE); + } + continue; + } + if (allowUnknown !== true) { + throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION); + } + } +} + +export default { + assertOptions, + validators +}; diff --git a/project starter code/node_modules/axios/lib/platform/browser/classes/Blob.js b/project starter code/node_modules/axios/lib/platform/browser/classes/Blob.js new file mode 100644 index 00000000..6c506c48 --- /dev/null +++ b/project starter code/node_modules/axios/lib/platform/browser/classes/Blob.js @@ -0,0 +1,3 @@ +'use strict' + +export default typeof Blob !== 'undefined' ? Blob : null diff --git a/project starter code/node_modules/axios/lib/platform/browser/classes/FormData.js b/project starter code/node_modules/axios/lib/platform/browser/classes/FormData.js new file mode 100644 index 00000000..f36d31b2 --- /dev/null +++ b/project starter code/node_modules/axios/lib/platform/browser/classes/FormData.js @@ -0,0 +1,3 @@ +'use strict'; + +export default typeof FormData !== 'undefined' ? FormData : null; diff --git a/project starter code/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js b/project starter code/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js new file mode 100644 index 00000000..b7dae953 --- /dev/null +++ b/project starter code/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js @@ -0,0 +1,4 @@ +'use strict'; + +import AxiosURLSearchParams from '../../../helpers/AxiosURLSearchParams.js'; +export default typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams; diff --git a/project starter code/node_modules/axios/lib/platform/browser/index.js b/project starter code/node_modules/axios/lib/platform/browser/index.js new file mode 100644 index 00000000..08c206f3 --- /dev/null +++ b/project starter code/node_modules/axios/lib/platform/browser/index.js @@ -0,0 +1,13 @@ +import URLSearchParams from './classes/URLSearchParams.js' +import FormData from './classes/FormData.js' +import Blob from './classes/Blob.js' + +export default { + isBrowser: true, + classes: { + URLSearchParams, + FormData, + Blob + }, + protocols: ['http', 'https', 'file', 'blob', 'url', 'data'] +}; diff --git a/project starter code/node_modules/axios/lib/platform/common/utils.js b/project starter code/node_modules/axios/lib/platform/common/utils.js new file mode 100644 index 00000000..d60921b0 --- /dev/null +++ b/project starter code/node_modules/axios/lib/platform/common/utils.js @@ -0,0 +1,50 @@ +const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined'; + +/** + * Determine if we're running in a standard browser environment + * + * This allows axios to run in a web worker, and react-native. + * Both environments support XMLHttpRequest, but not fully standard globals. + * + * web workers: + * typeof window -> undefined + * typeof document -> undefined + * + * react-native: + * navigator.product -> 'ReactNative' + * nativescript + * navigator.product -> 'NativeScript' or 'NS' + * + * @returns {boolean} + */ +const hasStandardBrowserEnv = ( + (product) => { + return hasBrowserEnv && ['ReactNative', 'NativeScript', 'NS'].indexOf(product) < 0 + })(typeof navigator !== 'undefined' && navigator.product); + +/** + * Determine if we're running in a standard browser webWorker environment + * + * Although the `isStandardBrowserEnv` method indicates that + * `allows axios to run in a web worker`, the WebWorker will still be + * filtered out due to its judgment standard + * `typeof window !== 'undefined' && typeof document !== 'undefined'`. + * This leads to a problem when axios post `FormData` in webWorker + */ +const hasStandardBrowserWebWorkerEnv = (() => { + return ( + typeof WorkerGlobalScope !== 'undefined' && + // eslint-disable-next-line no-undef + self instanceof WorkerGlobalScope && + typeof self.importScripts === 'function' + ); +})(); + +const origin = hasBrowserEnv && window.location.href || 'http://localhost'; + +export { + hasBrowserEnv, + hasStandardBrowserWebWorkerEnv, + hasStandardBrowserEnv, + origin +} diff --git a/project starter code/node_modules/axios/lib/platform/index.js b/project starter code/node_modules/axios/lib/platform/index.js new file mode 100644 index 00000000..860ba21a --- /dev/null +++ b/project starter code/node_modules/axios/lib/platform/index.js @@ -0,0 +1,7 @@ +import platform from './node/index.js'; +import * as utils from './common/utils.js'; + +export default { + ...utils, + ...platform +} diff --git a/project starter code/node_modules/axios/lib/platform/node/classes/FormData.js b/project starter code/node_modules/axios/lib/platform/node/classes/FormData.js new file mode 100644 index 00000000..b07f9476 --- /dev/null +++ b/project starter code/node_modules/axios/lib/platform/node/classes/FormData.js @@ -0,0 +1,3 @@ +import FormData from 'form-data'; + +export default FormData; diff --git a/project starter code/node_modules/axios/lib/platform/node/classes/URLSearchParams.js b/project starter code/node_modules/axios/lib/platform/node/classes/URLSearchParams.js new file mode 100644 index 00000000..fba58428 --- /dev/null +++ b/project starter code/node_modules/axios/lib/platform/node/classes/URLSearchParams.js @@ -0,0 +1,4 @@ +'use strict'; + +import url from 'url'; +export default url.URLSearchParams; diff --git a/project starter code/node_modules/axios/lib/platform/node/index.js b/project starter code/node_modules/axios/lib/platform/node/index.js new file mode 100644 index 00000000..aef514aa --- /dev/null +++ b/project starter code/node_modules/axios/lib/platform/node/index.js @@ -0,0 +1,12 @@ +import URLSearchParams from './classes/URLSearchParams.js' +import FormData from './classes/FormData.js' + +export default { + isNode: true, + classes: { + URLSearchParams, + FormData, + Blob: typeof Blob !== 'undefined' && Blob || null + }, + protocols: [ 'http', 'https', 'file', 'data' ] +}; diff --git a/project starter code/node_modules/axios/lib/utils.js b/project starter code/node_modules/axios/lib/utils.js new file mode 100644 index 00000000..72b9f1da --- /dev/null +++ b/project starter code/node_modules/axios/lib/utils.js @@ -0,0 +1,728 @@ +'use strict'; + +import bind from './helpers/bind.js'; + +// utils is a library of generic helper functions non-specific to axios + +const {toString} = Object.prototype; +const {getPrototypeOf} = Object; + +const kindOf = (cache => thing => { + const str = toString.call(thing); + return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase()); +})(Object.create(null)); + +const kindOfTest = (type) => { + type = type.toLowerCase(); + return (thing) => kindOf(thing) === type +} + +const typeOfTest = type => thing => typeof thing === type; + +/** + * Determine if a value is an Array + * + * @param {Object} val The value to test + * + * @returns {boolean} True if value is an Array, otherwise false + */ +const {isArray} = Array; + +/** + * Determine if a value is undefined + * + * @param {*} val The value to test + * + * @returns {boolean} True if the value is undefined, otherwise false + */ +const isUndefined = typeOfTest('undefined'); + +/** + * Determine if a value is a Buffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Buffer, otherwise false + */ +function isBuffer(val) { + return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) + && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val); +} + +/** + * Determine if a value is an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is an ArrayBuffer, otherwise false + */ +const isArrayBuffer = kindOfTest('ArrayBuffer'); + + +/** + * Determine if a value is a view on an ArrayBuffer + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false + */ +function isArrayBufferView(val) { + let result; + if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { + result = ArrayBuffer.isView(val); + } else { + result = (val) && (val.buffer) && (isArrayBuffer(val.buffer)); + } + return result; +} + +/** + * Determine if a value is a String + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a String, otherwise false + */ +const isString = typeOfTest('string'); + +/** + * Determine if a value is a Function + * + * @param {*} val The value to test + * @returns {boolean} True if value is a Function, otherwise false + */ +const isFunction = typeOfTest('function'); + +/** + * Determine if a value is a Number + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Number, otherwise false + */ +const isNumber = typeOfTest('number'); + +/** + * Determine if a value is an Object + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an Object, otherwise false + */ +const isObject = (thing) => thing !== null && typeof thing === 'object'; + +/** + * Determine if a value is a Boolean + * + * @param {*} thing The value to test + * @returns {boolean} True if value is a Boolean, otherwise false + */ +const isBoolean = thing => thing === true || thing === false; + +/** + * Determine if a value is a plain Object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a plain Object, otherwise false + */ +const isPlainObject = (val) => { + if (kindOf(val) !== 'object') { + return false; + } + + const prototype = getPrototypeOf(val); + return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val); +} + +/** + * Determine if a value is a Date + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Date, otherwise false + */ +const isDate = kindOfTest('Date'); + +/** + * Determine if a value is a File + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ +const isFile = kindOfTest('File'); + +/** + * Determine if a value is a Blob + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Blob, otherwise false + */ +const isBlob = kindOfTest('Blob'); + +/** + * Determine if a value is a FileList + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a File, otherwise false + */ +const isFileList = kindOfTest('FileList'); + +/** + * Determine if a value is a Stream + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a Stream, otherwise false + */ +const isStream = (val) => isObject(val) && isFunction(val.pipe); + +/** + * Determine if a value is a FormData + * + * @param {*} thing The value to test + * + * @returns {boolean} True if value is an FormData, otherwise false + */ +const isFormData = (thing) => { + let kind; + return thing && ( + (typeof FormData === 'function' && thing instanceof FormData) || ( + isFunction(thing.append) && ( + (kind = kindOf(thing)) === 'formdata' || + // detect form-data instance + (kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]') + ) + ) + ) +} + +/** + * Determine if a value is a URLSearchParams object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a URLSearchParams object, otherwise false + */ +const isURLSearchParams = kindOfTest('URLSearchParams'); + +const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest); + +/** + * Trim excess whitespace off the beginning and end of a string + * + * @param {String} str The String to trim + * + * @returns {String} The String freed of excess whitespace + */ +const trim = (str) => str.trim ? + str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); + +/** + * Iterate over an Array or an Object invoking a function for each item. + * + * If `obj` is an Array callback will be called passing + * the value, index, and complete array for each item. + * + * If 'obj' is an Object callback will be called passing + * the value, key, and complete object for each property. + * + * @param {Object|Array} obj The object to iterate + * @param {Function} fn The callback to invoke for each item + * + * @param {Boolean} [allOwnKeys = false] + * @returns {any} + */ +function forEach(obj, fn, {allOwnKeys = false} = {}) { + // Don't bother if no value provided + if (obj === null || typeof obj === 'undefined') { + return; + } + + let i; + let l; + + // Force an array if not already something iterable + if (typeof obj !== 'object') { + /*eslint no-param-reassign:0*/ + obj = [obj]; + } + + if (isArray(obj)) { + // Iterate over array values + for (i = 0, l = obj.length; i < l; i++) { + fn.call(null, obj[i], i, obj); + } + } else { + // Iterate over object keys + const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj); + const len = keys.length; + let key; + + for (i = 0; i < len; i++) { + key = keys[i]; + fn.call(null, obj[key], key, obj); + } + } +} + +function findKey(obj, key) { + key = key.toLowerCase(); + const keys = Object.keys(obj); + let i = keys.length; + let _key; + while (i-- > 0) { + _key = keys[i]; + if (key === _key.toLowerCase()) { + return _key; + } + } + return null; +} + +const _global = (() => { + /*eslint no-undef:0*/ + if (typeof globalThis !== "undefined") return globalThis; + return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global) +})(); + +const isContextDefined = (context) => !isUndefined(context) && context !== _global; + +/** + * Accepts varargs expecting each argument to be an object, then + * immutably merges the properties of each object and returns result. + * + * When multiple objects contain the same key the later object in + * the arguments list will take precedence. + * + * Example: + * + * ```js + * var result = merge({foo: 123}, {foo: 456}); + * console.log(result.foo); // outputs 456 + * ``` + * + * @param {Object} obj1 Object to merge + * + * @returns {Object} Result of all merge properties + */ +function merge(/* obj1, obj2, obj3, ... */) { + const {caseless} = isContextDefined(this) && this || {}; + const result = {}; + const assignValue = (val, key) => { + const targetKey = caseless && findKey(result, key) || key; + if (isPlainObject(result[targetKey]) && isPlainObject(val)) { + result[targetKey] = merge(result[targetKey], val); + } else if (isPlainObject(val)) { + result[targetKey] = merge({}, val); + } else if (isArray(val)) { + result[targetKey] = val.slice(); + } else { + result[targetKey] = val; + } + } + + for (let i = 0, l = arguments.length; i < l; i++) { + arguments[i] && forEach(arguments[i], assignValue); + } + return result; +} + +/** + * Extends object a by mutably adding to it the properties of object b. + * + * @param {Object} a The object to be extended + * @param {Object} b The object to copy properties from + * @param {Object} thisArg The object to bind function to + * + * @param {Boolean} [allOwnKeys] + * @returns {Object} The resulting value of object a + */ +const extend = (a, b, thisArg, {allOwnKeys}= {}) => { + forEach(b, (val, key) => { + if (thisArg && isFunction(val)) { + a[key] = bind(val, thisArg); + } else { + a[key] = val; + } + }, {allOwnKeys}); + return a; +} + +/** + * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) + * + * @param {string} content with BOM + * + * @returns {string} content value without BOM + */ +const stripBOM = (content) => { + if (content.charCodeAt(0) === 0xFEFF) { + content = content.slice(1); + } + return content; +} + +/** + * Inherit the prototype methods from one constructor into another + * @param {function} constructor + * @param {function} superConstructor + * @param {object} [props] + * @param {object} [descriptors] + * + * @returns {void} + */ +const inherits = (constructor, superConstructor, props, descriptors) => { + constructor.prototype = Object.create(superConstructor.prototype, descriptors); + constructor.prototype.constructor = constructor; + Object.defineProperty(constructor, 'super', { + value: superConstructor.prototype + }); + props && Object.assign(constructor.prototype, props); +} + +/** + * Resolve object with deep prototype chain to a flat object + * @param {Object} sourceObj source object + * @param {Object} [destObj] + * @param {Function|Boolean} [filter] + * @param {Function} [propFilter] + * + * @returns {Object} + */ +const toFlatObject = (sourceObj, destObj, filter, propFilter) => { + let props; + let i; + let prop; + const merged = {}; + + destObj = destObj || {}; + // eslint-disable-next-line no-eq-null,eqeqeq + if (sourceObj == null) return destObj; + + do { + props = Object.getOwnPropertyNames(sourceObj); + i = props.length; + while (i-- > 0) { + prop = props[i]; + if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) { + destObj[prop] = sourceObj[prop]; + merged[prop] = true; + } + } + sourceObj = filter !== false && getPrototypeOf(sourceObj); + } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype); + + return destObj; +} + +/** + * Determines whether a string ends with the characters of a specified string + * + * @param {String} str + * @param {String} searchString + * @param {Number} [position= 0] + * + * @returns {boolean} + */ +const endsWith = (str, searchString, position) => { + str = String(str); + if (position === undefined || position > str.length) { + position = str.length; + } + position -= searchString.length; + const lastIndex = str.indexOf(searchString, position); + return lastIndex !== -1 && lastIndex === position; +} + + +/** + * Returns new array from array like object or null if failed + * + * @param {*} [thing] + * + * @returns {?Array} + */ +const toArray = (thing) => { + if (!thing) return null; + if (isArray(thing)) return thing; + let i = thing.length; + if (!isNumber(i)) return null; + const arr = new Array(i); + while (i-- > 0) { + arr[i] = thing[i]; + } + return arr; +} + +/** + * Checking if the Uint8Array exists and if it does, it returns a function that checks if the + * thing passed in is an instance of Uint8Array + * + * @param {TypedArray} + * + * @returns {Array} + */ +// eslint-disable-next-line func-names +const isTypedArray = (TypedArray => { + // eslint-disable-next-line func-names + return thing => { + return TypedArray && thing instanceof TypedArray; + }; +})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array)); + +/** + * For each entry in the object, call the function with the key and value. + * + * @param {Object} obj - The object to iterate over. + * @param {Function} fn - The function to call for each entry. + * + * @returns {void} + */ +const forEachEntry = (obj, fn) => { + const generator = obj && obj[Symbol.iterator]; + + const iterator = generator.call(obj); + + let result; + + while ((result = iterator.next()) && !result.done) { + const pair = result.value; + fn.call(obj, pair[0], pair[1]); + } +} + +/** + * It takes a regular expression and a string, and returns an array of all the matches + * + * @param {string} regExp - The regular expression to match against. + * @param {string} str - The string to search. + * + * @returns {Array} + */ +const matchAll = (regExp, str) => { + let matches; + const arr = []; + + while ((matches = regExp.exec(str)) !== null) { + arr.push(matches); + } + + return arr; +} + +/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */ +const isHTMLForm = kindOfTest('HTMLFormElement'); + +const toCamelCase = str => { + return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, + function replacer(m, p1, p2) { + return p1.toUpperCase() + p2; + } + ); +}; + +/* Creating a function that will check if an object has a property. */ +const hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype); + +/** + * Determine if a value is a RegExp object + * + * @param {*} val The value to test + * + * @returns {boolean} True if value is a RegExp object, otherwise false + */ +const isRegExp = kindOfTest('RegExp'); + +const reduceDescriptors = (obj, reducer) => { + const descriptors = Object.getOwnPropertyDescriptors(obj); + const reducedDescriptors = {}; + + forEach(descriptors, (descriptor, name) => { + let ret; + if ((ret = reducer(descriptor, name, obj)) !== false) { + reducedDescriptors[name] = ret || descriptor; + } + }); + + Object.defineProperties(obj, reducedDescriptors); +} + +/** + * Makes all methods read-only + * @param {Object} obj + */ + +const freezeMethods = (obj) => { + reduceDescriptors(obj, (descriptor, name) => { + // skip restricted props in strict mode + if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) { + return false; + } + + const value = obj[name]; + + if (!isFunction(value)) return; + + descriptor.enumerable = false; + + if ('writable' in descriptor) { + descriptor.writable = false; + return; + } + + if (!descriptor.set) { + descriptor.set = () => { + throw Error('Can not rewrite read-only method \'' + name + '\''); + }; + } + }); +} + +const toObjectSet = (arrayOrString, delimiter) => { + const obj = {}; + + const define = (arr) => { + arr.forEach(value => { + obj[value] = true; + }); + } + + isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter)); + + return obj; +} + +const noop = () => {} + +const toFiniteNumber = (value, defaultValue) => { + return value != null && Number.isFinite(value = +value) ? value : defaultValue; +} + +const ALPHA = 'abcdefghijklmnopqrstuvwxyz' + +const DIGIT = '0123456789'; + +const ALPHABET = { + DIGIT, + ALPHA, + ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT +} + +const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => { + let str = ''; + const {length} = alphabet; + while (size--) { + str += alphabet[Math.random() * length|0] + } + + return str; +} + +/** + * If the thing is a FormData object, return true, otherwise return false. + * + * @param {unknown} thing - The thing to check. + * + * @returns {boolean} + */ +function isSpecCompliantForm(thing) { + return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]); +} + +const toJSONObject = (obj) => { + const stack = new Array(10); + + const visit = (source, i) => { + + if (isObject(source)) { + if (stack.indexOf(source) >= 0) { + return; + } + + if(!('toJSON' in source)) { + stack[i] = source; + const target = isArray(source) ? [] : {}; + + forEach(source, (value, key) => { + const reducedValue = visit(value, i + 1); + !isUndefined(reducedValue) && (target[key] = reducedValue); + }); + + stack[i] = undefined; + + return target; + } + } + + return source; + } + + return visit(obj, 0); +} + +const isAsyncFn = kindOfTest('AsyncFunction'); + +const isThenable = (thing) => + thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch); + +export default { + isArray, + isArrayBuffer, + isBuffer, + isFormData, + isArrayBufferView, + isString, + isNumber, + isBoolean, + isObject, + isPlainObject, + isReadableStream, + isRequest, + isResponse, + isHeaders, + isUndefined, + isDate, + isFile, + isBlob, + isRegExp, + isFunction, + isStream, + isURLSearchParams, + isTypedArray, + isFileList, + forEach, + merge, + extend, + trim, + stripBOM, + inherits, + toFlatObject, + kindOf, + kindOfTest, + endsWith, + toArray, + forEachEntry, + matchAll, + isHTMLForm, + hasOwnProperty, + hasOwnProp: hasOwnProperty, // an alias to avoid ESLint no-prototype-builtins detection + reduceDescriptors, + freezeMethods, + toObjectSet, + toCamelCase, + noop, + toFiniteNumber, + findKey, + global: _global, + isContextDefined, + ALPHABET, + generateString, + isSpecCompliantForm, + toJSONObject, + isAsyncFn, + isThenable +}; diff --git a/project starter code/node_modules/axios/package.json b/project starter code/node_modules/axios/package.json new file mode 100644 index 00000000..860d6140 --- /dev/null +++ b/project starter code/node_modules/axios/package.json @@ -0,0 +1,219 @@ +{ + "name": "axios", + "version": "1.7.2", + "description": "Promise based HTTP client for the browser and node.js", + "main": "index.js", + "exports": { + ".": { + "types": { + "require": "./index.d.cts", + "default": "./index.d.ts" + }, + "browser": { + "require": "./dist/browser/axios.cjs", + "default": "./index.js" + }, + "default": { + "require": "./dist/node/axios.cjs", + "default": "./index.js" + } + }, + "./lib/adapters/http.js": "./lib/adapters/http.js", + "./lib/adapters/xhr.js": "./lib/adapters/xhr.js", + "./unsafe/*": "./lib/*", + "./unsafe/core/settle.js": "./lib/core/settle.js", + "./unsafe/core/buildFullPath.js": "./lib/core/buildFullPath.js", + "./unsafe/helpers/isAbsoluteURL.js": "./lib/helpers/isAbsoluteURL.js", + "./unsafe/helpers/buildURL.js": "./lib/helpers/buildURL.js", + "./unsafe/helpers/combineURLs.js": "./lib/helpers/combineURLs.js", + "./unsafe/adapters/http.js": "./lib/adapters/http.js", + "./unsafe/adapters/xhr.js": "./lib/adapters/xhr.js", + "./unsafe/utils.js": "./lib/utils.js", + "./package.json": "./package.json" + }, + "type": "module", + "types": "index.d.ts", + "scripts": { + "test": "npm run test:eslint && npm run test:mocha && npm run test:karma && npm run test:dtslint && npm run test:exports", + "test:eslint": "node bin/ssl_hotfix.js eslint lib/**/*.js", + "test:dtslint": "dtslint --localTs node_modules/typescript/lib", + "test:mocha": "node bin/ssl_hotfix.js mocha test/unit/**/*.js --timeout 30000 --exit", + "test:exports": "node bin/ssl_hotfix.js mocha test/module/test.js --timeout 30000 --exit", + "test:karma": "node bin/ssl_hotfix.js cross-env LISTEN_ADDR=:: karma start karma.conf.cjs --single-run", + "test:karma:firefox": "node bin/ssl_hotfix.js cross-env LISTEN_ADDR=:: Browsers=Firefox karma start karma.conf.cjs --single-run", + "test:karma:server": "node bin/ssl_hotfix.js cross-env karma start karma.conf.cjs", + "test:build:version": "node ./bin/check-build-version.js", + "start": "node ./sandbox/server.js", + "preversion": "gulp version", + "version": "npm run build && git add dist && git add package.json", + "prepublishOnly": "npm run test:build:version", + "postpublish": "git push && git push --tags", + "build": "gulp clear && cross-env NODE_ENV=production rollup -c -m", + "examples": "node ./examples/server.js", + "coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", + "fix": "eslint --fix lib/**/*.js", + "prepare": "husky install && npm run prepare:hooks", + "prepare:hooks": "npx husky set .husky/commit-msg \"npx commitlint --edit $1\"", + "release:dry": "release-it --dry-run --no-npm", + "release:info": "release-it --release-version", + "release:beta:no-npm": "release-it --preRelease=beta --no-npm", + "release:beta": "release-it --preRelease=beta", + "release:no-npm": "release-it --no-npm", + "release:changelog:fix": "node ./bin/injectContributorsList.js && git add CHANGELOG.md", + "release": "release-it" + }, + "repository": { + "type": "git", + "url": "https://github.com/axios/axios.git" + }, + "keywords": [ + "xhr", + "http", + "ajax", + "promise", + "node" + ], + "author": "Matt Zabriskie", + "license": "MIT", + "bugs": { + "url": "https://github.com/axios/axios/issues" + }, + "homepage": "https://axios-http.com", + "devDependencies": { + "@babel/core": "^7.23.9", + "@babel/preset-env": "^7.23.9", + "@commitlint/cli": "^17.8.1", + "@commitlint/config-conventional": "^17.8.1", + "@release-it/conventional-changelog": "^5.1.1", + "@rollup/plugin-babel": "^5.3.1", + "@rollup/plugin-commonjs": "^15.1.0", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-multi-entry": "^4.1.0", + "@rollup/plugin-node-resolve": "^9.0.0", + "abortcontroller-polyfill": "^1.7.5", + "auto-changelog": "^2.4.0", + "body-parser": "^1.20.2", + "chalk": "^5.3.0", + "coveralls": "^3.1.1", + "cross-env": "^7.0.3", + "dev-null": "^0.1.1", + "dtslint": "^4.2.1", + "es6-promise": "^4.2.8", + "eslint": "^8.56.0", + "express": "^4.18.2", + "formdata-node": "^5.0.1", + "formidable": "^2.1.2", + "fs-extra": "^10.1.0", + "get-stream": "^3.0.0", + "gulp": "^4.0.2", + "gzip-size": "^7.0.0", + "handlebars": "^4.7.8", + "husky": "^8.0.3", + "istanbul-instrumenter-loader": "^3.0.1", + "jasmine-core": "^2.99.1", + "karma": "^6.3.17", + "karma-chrome-launcher": "^3.2.0", + "karma-firefox-launcher": "^2.1.2", + "karma-jasmine": "^1.1.2", + "karma-jasmine-ajax": "^0.1.13", + "karma-rollup-preprocessor": "^7.0.8", + "karma-safari-launcher": "^1.0.0", + "karma-sauce-launcher": "^4.3.6", + "karma-sinon": "^1.0.5", + "karma-sourcemap-loader": "^0.3.8", + "memoizee": "^0.4.15", + "minimist": "^1.2.8", + "mocha": "^10.3.0", + "multer": "^1.4.4", + "pretty-bytes": "^6.1.1", + "release-it": "^15.11.0", + "rollup": "^2.79.1", + "rollup-plugin-auto-external": "^2.0.0", + "rollup-plugin-bundle-size": "^1.0.3", + "rollup-plugin-terser": "^7.0.2", + "sinon": "^4.5.0", + "stream-throttle": "^0.1.3", + "string-replace-async": "^3.0.2", + "terser-webpack-plugin": "^4.2.3", + "typescript": "^4.9.5", + "@rollup/plugin-alias": "^5.1.0" + }, + "browser": { + "./lib/adapters/http.js": "./lib/helpers/null.js", + "./lib/platform/node/index.js": "./lib/platform/browser/index.js", + "./lib/platform/node/classes/FormData.js": "./lib/helpers/null.js" + }, + "jsdelivr": "dist/axios.min.js", + "unpkg": "dist/axios.min.js", + "typings": "./index.d.ts", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + }, + "bundlesize": [ + { + "path": "./dist/axios.min.js", + "threshold": "5kB" + } + ], + "contributors": [ + "Matt Zabriskie (https://github.com/mzabriskie)", + "Nick Uraltsev (https://github.com/nickuraltsev)", + "Dmitriy Mozgovoy (https://github.com/DigitalBrainJS)", + "Jay (https://github.com/jasonsaayman)", + "Emily Morehouse (https://github.com/emilyemorehouse)", + "Rubén Norte (https://github.com/rubennorte)", + "Justin Beckwith (https://github.com/JustinBeckwith)", + "Martti Laine (https://github.com/codeclown)", + "Xianming Zhong (https://github.com/chinesedfan)", + "Rikki Gibson (https://github.com/RikkiGibson)", + "Remco Haszing (https://github.com/remcohaszing)", + "Yasu Flores (https://github.com/yasuf)", + "Ben Carp (https://github.com/carpben)" + ], + "sideEffects": false, + "release-it": { + "git": { + "commitMessage": "chore(release): v${version}", + "push": true, + "commit": true, + "tag": true, + "requireCommits": false, + "requireCleanWorkingDir": false + }, + "github": { + "release": true, + "draft": true + }, + "npm": { + "publish": false, + "ignoreVersion": false + }, + "plugins": { + "@release-it/conventional-changelog": { + "preset": "angular", + "infile": "CHANGELOG.md", + "header": "# Changelog" + } + }, + "hooks": { + "before:init": "npm test", + "after:bump": "gulp version --bump ${version} && npm run build && npm run test:build:version && git add ./dist && git add ./package-lock.json", + "before:release": "npm run release:changelog:fix", + "after:release": "echo Successfully released ${name} v${version} to ${repo.repository}." + } + }, + "commitlint": { + "rules": { + "header-max-length": [ + 2, + "always", + 130 + ] + }, + "extends": [ + "@commitlint/config-conventional" + ] + } +} \ No newline at end of file diff --git a/project starter code/node_modules/balanced-match/.github/FUNDING.yml b/project starter code/node_modules/balanced-match/.github/FUNDING.yml new file mode 100644 index 00000000..cea8b16e --- /dev/null +++ b/project starter code/node_modules/balanced-match/.github/FUNDING.yml @@ -0,0 +1,2 @@ +tidelift: "npm/balanced-match" +patreon: juliangruber diff --git a/project starter code/node_modules/balanced-match/LICENSE.md b/project starter code/node_modules/balanced-match/LICENSE.md new file mode 100644 index 00000000..2cdc8e41 --- /dev/null +++ b/project starter code/node_modules/balanced-match/LICENSE.md @@ -0,0 +1,21 @@ +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/project starter code/node_modules/balanced-match/README.md b/project starter code/node_modules/balanced-match/README.md new file mode 100644 index 00000000..d2a48b6b --- /dev/null +++ b/project starter code/node_modules/balanced-match/README.md @@ -0,0 +1,97 @@ +# balanced-match + +Match balanced string pairs, like `{` and `}` or `` and ``. Supports regular expressions as well! + +[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match) +[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match) + +[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match) + +## Example + +Get the first matching pair of braces: + +```js +var balanced = require('balanced-match'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); +console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post')); +``` + +The matches are: + +```bash +$ node example.js +{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' } +{ start: 3, + end: 9, + pre: 'pre', + body: 'first', + post: 'between{second}post' } +{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' } +``` + +## API + +### var m = balanced(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +object with those keys: + +* **start** the index of the first match of `a` +* **end** the index of the matching `b` +* **pre** the preamble, `a` and `b` not included +* **body** the match, `a` and `b` not included +* **post** the postscript, `a` and `b` not included + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`. + +### var r = balanced.range(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +array with indexes: `[ , ]`. + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install balanced-match +``` + +## Security contact information + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/project starter code/node_modules/balanced-match/index.js b/project starter code/node_modules/balanced-match/index.js new file mode 100644 index 00000000..c67a6460 --- /dev/null +++ b/project starter code/node_modules/balanced-match/index.js @@ -0,0 +1,62 @@ +'use strict'; +module.exports = balanced; +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + + var r = range(a, b, str); + + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; +} + +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + +balanced.range = range; +function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + + if (ai >= 0 && bi > 0) { + if(a===b) { + return [ai, bi]; + } + begs = []; + left = str.length; + + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [ begs.pop(), bi ]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [ left, right ]; + } + } + + return result; +} diff --git a/project starter code/node_modules/balanced-match/package.json b/project starter code/node_modules/balanced-match/package.json new file mode 100644 index 00000000..ce6073e0 --- /dev/null +++ b/project starter code/node_modules/balanced-match/package.json @@ -0,0 +1,48 @@ +{ + "name": "balanced-match", + "description": "Match balanced character pairs, like \"{\" and \"}\"", + "version": "1.0.2", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/balanced-match.git" + }, + "homepage": "https://github.com/juliangruber/balanced-match", + "main": "index.js", + "scripts": { + "test": "tape test/test.js", + "bench": "matcha test/bench.js" + }, + "devDependencies": { + "matcha": "^0.7.0", + "tape": "^4.6.0" + }, + "keywords": [ + "match", + "regexp", + "test", + "balanced", + "parse" + ], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + } +} diff --git a/project starter code/node_modules/binary-extensions/binary-extensions.json b/project starter code/node_modules/binary-extensions/binary-extensions.json new file mode 100644 index 00000000..ac08048e --- /dev/null +++ b/project starter code/node_modules/binary-extensions/binary-extensions.json @@ -0,0 +1,263 @@ +[ + "3dm", + "3ds", + "3g2", + "3gp", + "7z", + "a", + "aac", + "adp", + "afdesign", + "afphoto", + "afpub", + "ai", + "aif", + "aiff", + "alz", + "ape", + "apk", + "appimage", + "ar", + "arj", + "asf", + "au", + "avi", + "bak", + "baml", + "bh", + "bin", + "bk", + "bmp", + "btif", + "bz2", + "bzip2", + "cab", + "caf", + "cgm", + "class", + "cmx", + "cpio", + "cr2", + "cur", + "dat", + "dcm", + "deb", + "dex", + "djvu", + "dll", + "dmg", + "dng", + "doc", + "docm", + "docx", + "dot", + "dotm", + "dra", + "DS_Store", + "dsk", + "dts", + "dtshd", + "dvb", + "dwg", + "dxf", + "ecelp4800", + "ecelp7470", + "ecelp9600", + "egg", + "eol", + "eot", + "epub", + "exe", + "f4v", + "fbs", + "fh", + "fla", + "flac", + "flatpak", + "fli", + "flv", + "fpx", + "fst", + "fvt", + "g3", + "gh", + "gif", + "graffle", + "gz", + "gzip", + "h261", + "h263", + "h264", + "icns", + "ico", + "ief", + "img", + "ipa", + "iso", + "jar", + "jpeg", + "jpg", + "jpgv", + "jpm", + "jxr", + "key", + "ktx", + "lha", + "lib", + "lvp", + "lz", + "lzh", + "lzma", + "lzo", + "m3u", + "m4a", + "m4v", + "mar", + "mdi", + "mht", + "mid", + "midi", + "mj2", + "mka", + "mkv", + "mmr", + "mng", + "mobi", + "mov", + "movie", + "mp3", + "mp4", + "mp4a", + "mpeg", + "mpg", + "mpga", + "mxu", + "nef", + "npx", + "numbers", + "nupkg", + "o", + "odp", + "ods", + "odt", + "oga", + "ogg", + "ogv", + "otf", + "ott", + "pages", + "pbm", + "pcx", + "pdb", + "pdf", + "pea", + "pgm", + "pic", + "png", + "pnm", + "pot", + "potm", + "potx", + "ppa", + "ppam", + "ppm", + "pps", + "ppsm", + "ppsx", + "ppt", + "pptm", + "pptx", + "psd", + "pya", + "pyc", + "pyo", + "pyv", + "qt", + "rar", + "ras", + "raw", + "resources", + "rgb", + "rip", + "rlc", + "rmf", + "rmvb", + "rpm", + "rtf", + "rz", + "s3m", + "s7z", + "scpt", + "sgi", + "shar", + "snap", + "sil", + "sketch", + "slk", + "smv", + "snk", + "so", + "stl", + "suo", + "sub", + "swf", + "tar", + "tbz", + "tbz2", + "tga", + "tgz", + "thmx", + "tif", + "tiff", + "tlz", + "ttc", + "ttf", + "txz", + "udf", + "uvh", + "uvi", + "uvm", + "uvp", + "uvs", + "uvu", + "viv", + "vob", + "war", + "wav", + "wax", + "wbmp", + "wdp", + "weba", + "webm", + "webp", + "whl", + "wim", + "wm", + "wma", + "wmv", + "wmx", + "woff", + "woff2", + "wrm", + "wvx", + "xbm", + "xif", + "xla", + "xlam", + "xls", + "xlsb", + "xlsm", + "xlsx", + "xlt", + "xltm", + "xltx", + "xm", + "xmind", + "xpi", + "xpm", + "xwd", + "xz", + "z", + "zip", + "zipx" +] diff --git a/project starter code/node_modules/binary-extensions/binary-extensions.json.d.ts b/project starter code/node_modules/binary-extensions/binary-extensions.json.d.ts new file mode 100644 index 00000000..94a248c2 --- /dev/null +++ b/project starter code/node_modules/binary-extensions/binary-extensions.json.d.ts @@ -0,0 +1,3 @@ +declare const binaryExtensionsJson: readonly string[]; + +export = binaryExtensionsJson; diff --git a/project starter code/node_modules/binary-extensions/index.d.ts b/project starter code/node_modules/binary-extensions/index.d.ts new file mode 100644 index 00000000..f469ac5f --- /dev/null +++ b/project starter code/node_modules/binary-extensions/index.d.ts @@ -0,0 +1,14 @@ +/** +List of binary file extensions. + +@example +``` +import binaryExtensions = require('binary-extensions'); + +console.log(binaryExtensions); +//=> ['3ds', '3g2', …] +``` +*/ +declare const binaryExtensions: readonly string[]; + +export = binaryExtensions; diff --git a/project starter code/node_modules/binary-extensions/index.js b/project starter code/node_modules/binary-extensions/index.js new file mode 100644 index 00000000..d46e4688 --- /dev/null +++ b/project starter code/node_modules/binary-extensions/index.js @@ -0,0 +1 @@ +module.exports = require('./binary-extensions.json'); diff --git a/project starter code/node_modules/binary-extensions/license b/project starter code/node_modules/binary-extensions/license new file mode 100644 index 00000000..5493a1a6 --- /dev/null +++ b/project starter code/node_modules/binary-extensions/license @@ -0,0 +1,10 @@ +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) +Copyright (c) Paul Miller (https://paulmillr.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/project starter code/node_modules/binary-extensions/package.json b/project starter code/node_modules/binary-extensions/package.json new file mode 100644 index 00000000..4710c339 --- /dev/null +++ b/project starter code/node_modules/binary-extensions/package.json @@ -0,0 +1,40 @@ +{ + "name": "binary-extensions", + "version": "2.3.0", + "description": "List of binary file extensions", + "license": "MIT", + "repository": "sindresorhus/binary-extensions", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "sideEffects": false, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts", + "binary-extensions.json", + "binary-extensions.json.d.ts" + ], + "keywords": [ + "binary", + "extensions", + "extension", + "file", + "json", + "list", + "array" + ], + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/project starter code/node_modules/binary-extensions/readme.md b/project starter code/node_modules/binary-extensions/readme.md new file mode 100644 index 00000000..88519b3a --- /dev/null +++ b/project starter code/node_modules/binary-extensions/readme.md @@ -0,0 +1,25 @@ +# binary-extensions + +> List of binary file extensions + +The list is just a [JSON file](binary-extensions.json) and can be used anywhere. + +## Install + +```sh +npm install binary-extensions +``` + +## Usage + +```js +const binaryExtensions = require('binary-extensions'); + +console.log(binaryExtensions); +//=> ['3ds', '3g2', …] +``` + +## Related + +- [is-binary-path](https://github.com/sindresorhus/is-binary-path) - Check if a filepath is a binary file +- [text-extensions](https://github.com/sindresorhus/text-extensions) - List of text file extensions diff --git a/project starter code/node_modules/body-parser/HISTORY.md b/project starter code/node_modules/body-parser/HISTORY.md index fb212b36..b8924919 100644 --- a/project starter code/node_modules/body-parser/HISTORY.md +++ b/project starter code/node_modules/body-parser/HISTORY.md @@ -1,3 +1,11 @@ +1.20.2 / 2023-02-21 +=================== + + * Fix strict json error message on Node.js 19+ + * deps: content-type@~1.0.5 + - perf: skip value escaping when unnecessary + * deps: raw-body@2.5.2 + 1.20.1 / 2022-10-06 =================== diff --git a/project starter code/node_modules/body-parser/README.md b/project starter code/node_modules/body-parser/README.md index c507cbb0..38553bf7 100644 --- a/project starter code/node_modules/body-parser/README.md +++ b/project starter code/node_modules/body-parser/README.md @@ -1,8 +1,8 @@ # body-parser -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Build Status][github-actions-ci-image]][github-actions-ci-url] +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Build Status][ci-image]][ci-url] [![Test Coverage][coveralls-image]][coveralls-url] Node.js body parsing middleware. @@ -454,11 +454,12 @@ app.use(bodyParser.text({ type: 'text/html' })) [MIT](LICENSE) -[npm-image]: https://img.shields.io/npm/v/body-parser.svg -[npm-url]: https://npmjs.org/package/body-parser -[coveralls-image]: https://img.shields.io/coveralls/expressjs/body-parser/master.svg +[ci-image]: https://badgen.net/github/checks/expressjs/body-parser/master?label=ci +[ci-url]: https://github.com/expressjs/body-parser/actions/workflows/ci.yml +[coveralls-image]: https://badgen.net/coveralls/c/github/expressjs/body-parser/master [coveralls-url]: https://coveralls.io/r/expressjs/body-parser?branch=master -[downloads-image]: https://img.shields.io/npm/dm/body-parser.svg -[downloads-url]: https://npmjs.org/package/body-parser -[github-actions-ci-image]: https://img.shields.io/github/workflow/status/expressjs/body-parser/ci/master?label=ci -[github-actions-ci-url]: https://github.com/expressjs/body-parser/actions/workflows/ci.yml +[node-version-image]: https://badgen.net/npm/node/body-parser +[node-version-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/body-parser +[npm-url]: https://npmjs.org/package/body-parser +[npm-version-image]: https://badgen.net/npm/v/body-parser diff --git a/project starter code/node_modules/body-parser/index.js b/project starter code/node_modules/body-parser/index.js index b2b48221..bb24d739 100644 --- a/project starter code/node_modules/body-parser/index.js +++ b/project starter code/node_modules/body-parser/index.js @@ -138,16 +138,16 @@ function loadParser (parserName) { // this uses a switch for static require analysis switch (parserName) { case 'json': - parser = require('body-parser/lib/types/json') + parser = require('./lib/types/json') break case 'raw': - parser = require('body-parser/lib/types/raw') + parser = require('./lib/types/raw') break case 'text': - parser = require('body-parser/lib/types/text') + parser = require('./lib/types/text') break case 'urlencoded': - parser = require('body-parser/lib/types/urlencoded') + parser = require('./lib/types/urlencoded') break } diff --git a/project starter code/node_modules/body-parser/lib/types/json.js b/project starter code/node_modules/body-parser/lib/types/json.js index f3e503ab..59f3f7e2 100644 --- a/project starter code/node_modules/body-parser/lib/types/json.js +++ b/project starter code/node_modules/body-parser/lib/types/json.js @@ -16,7 +16,7 @@ var bytes = require('bytes') var contentType = require('content-type') var createError = require('http-errors') var debug = require('debug')('body-parser:json') -var read = require('body-parser/lib/read') +var read = require('../read') var typeis = require('type-is') /** @@ -39,6 +39,9 @@ module.exports = json var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d])/ // eslint-disable-line no-control-regex +var JSON_SYNTAX_CHAR = '#' +var JSON_SYNTAX_REGEXP = /#+/g + /** * Create a middleware to parse JSON bodies. * @@ -152,15 +155,23 @@ function json (options) { function createStrictSyntaxError (str, char) { var index = str.indexOf(char) - var partial = index !== -1 - ? str.substring(0, index) + '#' - : '' + var partial = '' + + if (index !== -1) { + partial = str.substring(0, index) + JSON_SYNTAX_CHAR + + for (var i = index + 1; i < str.length; i++) { + partial += JSON_SYNTAX_CHAR + } + } try { JSON.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation') } catch (e) { return normalizeJsonSyntaxError(e, { - message: e.message.replace('#', char), + message: e.message.replace(JSON_SYNTAX_REGEXP, function (placeholder) { + return str.substring(index, index + placeholder.length) + }), stack: e.stack }) } diff --git a/project starter code/node_modules/body-parser/lib/types/raw.js b/project starter code/node_modules/body-parser/lib/types/raw.js index 7b3a366d..f5d1b674 100644 --- a/project starter code/node_modules/body-parser/lib/types/raw.js +++ b/project starter code/node_modules/body-parser/lib/types/raw.js @@ -12,7 +12,7 @@ var bytes = require('bytes') var debug = require('debug')('body-parser:raw') -var read = require('body-parser/lib/read') +var read = require('../read') var typeis = require('type-is') /** diff --git a/project starter code/node_modules/body-parser/lib/types/text.js b/project starter code/node_modules/body-parser/lib/types/text.js index 6fe6a780..083a0090 100644 --- a/project starter code/node_modules/body-parser/lib/types/text.js +++ b/project starter code/node_modules/body-parser/lib/types/text.js @@ -13,7 +13,7 @@ var bytes = require('bytes') var contentType = require('content-type') var debug = require('debug')('body-parser:text') -var read = require('body-parser/lib/read') +var read = require('../read') var typeis = require('type-is') /** diff --git a/project starter code/node_modules/body-parser/lib/types/urlencoded.js b/project starter code/node_modules/body-parser/lib/types/urlencoded.js index 6c0fc14f..b2ca8f16 100644 --- a/project starter code/node_modules/body-parser/lib/types/urlencoded.js +++ b/project starter code/node_modules/body-parser/lib/types/urlencoded.js @@ -17,7 +17,7 @@ var contentType = require('content-type') var createError = require('http-errors') var debug = require('debug')('body-parser:urlencoded') var deprecate = require('depd')('body-parser') -var read = require('body-parser/lib/read') +var read = require('../read') var typeis = require('type-is') /** diff --git a/project starter code/node_modules/body-parser/package.json b/project starter code/node_modules/body-parser/package.json index 9cd2ccbb..46373043 100644 --- a/project starter code/node_modules/body-parser/package.json +++ b/project starter code/node_modules/body-parser/package.json @@ -1,7 +1,7 @@ { "name": "body-parser", "description": "Node.js body parsing middleware", - "version": "1.20.1", + "version": "1.20.2", "contributors": [ "Douglas Christopher Wilson ", "Jonathan Ong (http://jongleberry.com)" @@ -10,7 +10,7 @@ "repository": "expressjs/body-parser", "dependencies": { "bytes": "3.1.2", - "content-type": "~1.0.4", + "content-type": "~1.0.5", "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", @@ -18,23 +18,23 @@ "iconv-lite": "0.4.24", "on-finished": "2.4.1", "qs": "6.11.0", - "raw-body": "2.5.1", + "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" }, "devDependencies": { - "eslint": "8.24.0", + "eslint": "8.34.0", "eslint-config-standard": "14.1.1", - "eslint-plugin-import": "2.26.0", + "eslint-plugin-import": "2.27.5", "eslint-plugin-markdown": "3.0.0", "eslint-plugin-node": "11.1.0", - "eslint-plugin-promise": "6.0.1", + "eslint-plugin-promise": "6.1.1", "eslint-plugin-standard": "4.1.0", "methods": "1.1.2", - "mocha": "10.0.0", + "mocha": "10.2.0", "nyc": "15.1.0", "safe-buffer": "5.2.1", - "supertest": "6.3.0" + "supertest": "6.3.3" }, "files": [ "lib/", diff --git a/project starter code/node_modules/brace-expansion/LICENSE b/project starter code/node_modules/brace-expansion/LICENSE new file mode 100644 index 00000000..de322667 --- /dev/null +++ b/project starter code/node_modules/brace-expansion/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013 Julian Gruber + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/project starter code/node_modules/brace-expansion/README.md b/project starter code/node_modules/brace-expansion/README.md new file mode 100644 index 00000000..6b4e0e16 --- /dev/null +++ b/project starter code/node_modules/brace-expansion/README.md @@ -0,0 +1,129 @@ +# brace-expansion + +[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), +as known from sh/bash, in JavaScript. + +[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion) +[![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion) +[![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/) + +[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion) + +## Example + +```js +var expand = require('brace-expansion'); + +expand('file-{a,b,c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('-v{,,}') +// => ['-v', '-v', '-v'] + +expand('file{0..2}.jpg') +// => ['file0.jpg', 'file1.jpg', 'file2.jpg'] + +expand('file-{a..c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('file{2..0}.jpg') +// => ['file2.jpg', 'file1.jpg', 'file0.jpg'] + +expand('file{0..4..2}.jpg') +// => ['file0.jpg', 'file2.jpg', 'file4.jpg'] + +expand('file-{a..e..2}.jpg') +// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] + +expand('file{00..10..5}.jpg') +// => ['file00.jpg', 'file05.jpg', 'file10.jpg'] + +expand('{{A..C},{a..c}}') +// => ['A', 'B', 'C', 'a', 'b', 'c'] + +expand('ppp{,config,oe{,conf}}') +// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] +``` + +## API + +```js +var expand = require('brace-expansion'); +``` + +### var expanded = expand(str) + +Return an array of all possible and valid expansions of `str`. If none are +found, `[str]` is returned. + +Valid expansions are: + +```js +/^(.*,)+(.+)?$/ +// {a,b,...} +``` + +A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +A numeric sequence from `x` to `y` inclusive, with optional increment. +If `x` or `y` start with a leading `0`, all the numbers will be padded +to have equal length. Negative numbers and backwards iteration work too. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +An alphabetic sequence from `x` to `y` inclusive, with optional increment. +`x` and `y` must be exactly one character, and if given, `incr` must be a +number. + +For compatibility reasons, the string `${` is not eligible for brace expansion. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install brace-expansion +``` + +## Contributors + +- [Julian Gruber](https://github.com/juliangruber) +- [Isaac Z. Schlueter](https://github.com/isaacs) + +## Sponsors + +This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)! + +Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)! + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/project starter code/node_modules/brace-expansion/index.js b/project starter code/node_modules/brace-expansion/index.js new file mode 100644 index 00000000..0478be81 --- /dev/null +++ b/project starter code/node_modules/brace-expansion/index.js @@ -0,0 +1,201 @@ +var concatMap = require('concat-map'); +var balanced = require('balanced-match'); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + // I don't know why Bash 4.3 does this, but it does. + // Anything starting with {} will have the first two bytes preserved + // but *only* at the top level, so {},a}b will not expand to anything, + // but a{},b}c will be expanded to [a}c,abc]. + // One could argue that this is a bug in Bash, but since the goal of + // this module is to match Bash's rules, we escape a leading {} + if (str.substr(0, 2) === '{}') { + str = '\\{\\}' + str.substr(2); + } + + return expand(escapeBraces(str), true).map(unescapeBraces); +} + +function identity(e) { + return e; +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post, false) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el, false) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + + return expansions; +} + diff --git a/project starter code/node_modules/brace-expansion/package.json b/project starter code/node_modules/brace-expansion/package.json new file mode 100644 index 00000000..a18faa8f --- /dev/null +++ b/project starter code/node_modules/brace-expansion/package.json @@ -0,0 +1,47 @@ +{ + "name": "brace-expansion", + "description": "Brace expansion as known from sh/bash", + "version": "1.1.11", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/brace-expansion.git" + }, + "homepage": "https://github.com/juliangruber/brace-expansion", + "main": "index.js", + "scripts": { + "test": "tape test/*.js", + "gentest": "bash test/generate.sh", + "bench": "matcha test/perf/bench.js" + }, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + }, + "devDependencies": { + "matcha": "^0.7.0", + "tape": "^4.6.0" + }, + "keywords": [], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + } +} diff --git a/project starter code/node_modules/braces/LICENSE b/project starter code/node_modules/braces/LICENSE new file mode 100644 index 00000000..9af4a67d --- /dev/null +++ b/project starter code/node_modules/braces/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-present, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/project starter code/node_modules/braces/README.md b/project starter code/node_modules/braces/README.md new file mode 100644 index 00000000..f59dd604 --- /dev/null +++ b/project starter code/node_modules/braces/README.md @@ -0,0 +1,586 @@ +# braces [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [![NPM version](https://img.shields.io/npm/v/braces.svg?style=flat)](https://www.npmjs.com/package/braces) [![NPM monthly downloads](https://img.shields.io/npm/dm/braces.svg?style=flat)](https://npmjs.org/package/braces) [![NPM total downloads](https://img.shields.io/npm/dt/braces.svg?style=flat)](https://npmjs.org/package/braces) [![Linux Build Status](https://img.shields.io/travis/micromatch/braces.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/braces) + +> Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save braces +``` + +## v3.0.0 Released!! + +See the [changelog](CHANGELOG.md) for details. + +## Why use braces? + +Brace patterns make globs more powerful by adding the ability to match specific ranges and sequences of characters. + +- **Accurate** - complete support for the [Bash 4.3 Brace Expansion](www.gnu.org/software/bash/) specification (passes all of the Bash braces tests) +- **[fast and performant](#benchmarks)** - Starts fast, runs fast and [scales well](#performance) as patterns increase in complexity. +- **Organized code base** - The parser and compiler are easy to maintain and update when edge cases crop up. +- **Well-tested** - Thousands of test assertions, and passes all of the Bash, minimatch, and [brace-expansion](https://github.com/juliangruber/brace-expansion) unit tests (as of the date this was written). +- **Safer** - You shouldn't have to worry about users defining aggressive or malicious brace patterns that can break your application. Braces takes measures to prevent malicious regex that can be used for DDoS attacks (see [catastrophic backtracking](https://www.regular-expressions.info/catastrophic.html)). +- [Supports lists](#lists) - (aka "sets") `a/{b,c}/d` => `['a/b/d', 'a/c/d']` +- [Supports sequences](#sequences) - (aka "ranges") `{01..03}` => `['01', '02', '03']` +- [Supports steps](#steps) - (aka "increments") `{2..10..2}` => `['2', '4', '6', '8', '10']` +- [Supports escaping](#escaping) - To prevent evaluation of special characters. + +## Usage + +The main export is a function that takes one or more brace `patterns` and `options`. + +```js +const braces = require('braces'); +// braces(patterns[, options]); + +console.log(braces(['{01..05}', '{a..e}'])); +//=> ['(0[1-5])', '([a-e])'] + +console.log(braces(['{01..05}', '{a..e}'], { expand: true })); +//=> ['01', '02', '03', '04', '05', 'a', 'b', 'c', 'd', 'e'] +``` + +### Brace Expansion vs. Compilation + +By default, brace patterns are compiled into strings that are optimized for creating regular expressions and matching. + +**Compiled** + +```js +console.log(braces('a/{x,y,z}/b')); +//=> ['a/(x|y|z)/b'] +console.log(braces(['a/{01..20}/b', 'a/{1..5}/b'])); +//=> [ 'a/(0[1-9]|1[0-9]|20)/b', 'a/([1-5])/b' ] +``` + +**Expanded** + +Enable brace expansion by setting the `expand` option to true, or by using [braces.expand()](#expand) (returns an array similar to what you'd expect from Bash, or `echo {1..5}`, or [minimatch](https://github.com/isaacs/minimatch)): + +```js +console.log(braces('a/{x,y,z}/b', { expand: true })); +//=> ['a/x/b', 'a/y/b', 'a/z/b'] + +console.log(braces.expand('{01..10}')); +//=> ['01','02','03','04','05','06','07','08','09','10'] +``` + +### Lists + +Expand lists (like Bash "sets"): + +```js +console.log(braces('a/{foo,bar,baz}/*.js')); +//=> ['a/(foo|bar|baz)/*.js'] + +console.log(braces.expand('a/{foo,bar,baz}/*.js')); +//=> ['a/foo/*.js', 'a/bar/*.js', 'a/baz/*.js'] +``` + +### Sequences + +Expand ranges of characters (like Bash "sequences"): + +```js +console.log(braces.expand('{1..3}')); // ['1', '2', '3'] +console.log(braces.expand('a/{1..3}/b')); // ['a/1/b', 'a/2/b', 'a/3/b'] +console.log(braces('{a..c}', { expand: true })); // ['a', 'b', 'c'] +console.log(braces('foo/{a..c}', { expand: true })); // ['foo/a', 'foo/b', 'foo/c'] + +// supports zero-padded ranges +console.log(braces('a/{01..03}/b')); //=> ['a/(0[1-3])/b'] +console.log(braces('a/{001..300}/b')); //=> ['a/(0{2}[1-9]|0[1-9][0-9]|[12][0-9]{2}|300)/b'] +``` + +See [fill-range](https://github.com/jonschlinkert/fill-range) for all available range-expansion options. + +### Steppped ranges + +Steps, or increments, may be used with ranges: + +```js +console.log(braces.expand('{2..10..2}')); +//=> ['2', '4', '6', '8', '10'] + +console.log(braces('{2..10..2}')); +//=> ['(2|4|6|8|10)'] +``` + +When the [.optimize](#optimize) method is used, or [options.optimize](#optionsoptimize) is set to true, sequences are passed to [to-regex-range](https://github.com/jonschlinkert/to-regex-range) for expansion. + +### Nesting + +Brace patterns may be nested. The results of each expanded string are not sorted, and left to right order is preserved. + +**"Expanded" braces** + +```js +console.log(braces.expand('a{b,c,/{x,y}}/e')); +//=> ['ab/e', 'ac/e', 'a/x/e', 'a/y/e'] + +console.log(braces.expand('a/{x,{1..5},y}/c')); +//=> ['a/x/c', 'a/1/c', 'a/2/c', 'a/3/c', 'a/4/c', 'a/5/c', 'a/y/c'] +``` + +**"Optimized" braces** + +```js +console.log(braces('a{b,c,/{x,y}}/e')); +//=> ['a(b|c|/(x|y))/e'] + +console.log(braces('a/{x,{1..5},y}/c')); +//=> ['a/(x|([1-5])|y)/c'] +``` + +### Escaping + +**Escaping braces** + +A brace pattern will not be expanded or evaluted if _either the opening or closing brace is escaped_: + +```js +console.log(braces.expand('a\\{d,c,b}e')); +//=> ['a{d,c,b}e'] + +console.log(braces.expand('a{d,c,b\\}e')); +//=> ['a{d,c,b}e'] +``` + +**Escaping commas** + +Commas inside braces may also be escaped: + +```js +console.log(braces.expand('a{b\\,c}d')); +//=> ['a{b,c}d'] + +console.log(braces.expand('a{d\\,c,b}e')); +//=> ['ad,ce', 'abe'] +``` + +**Single items** + +Following bash conventions, a brace pattern is also not expanded when it contains a single character: + +```js +console.log(braces.expand('a{b}c')); +//=> ['a{b}c'] +``` + +## Options + +### options.maxLength + +**Type**: `Number` + +**Default**: `10,000` + +**Description**: Limit the length of the input string. Useful when the input string is generated or your application allows users to pass a string, et cetera. + +```js +console.log(braces('a/{b,c}/d', { maxLength: 3 })); //=> throws an error +``` + +### options.expand + +**Type**: `Boolean` + +**Default**: `undefined` + +**Description**: Generate an "expanded" brace pattern (alternatively you can use the `braces.expand()` method, which does the same thing). + +```js +console.log(braces('a/{b,c}/d', { expand: true })); +//=> [ 'a/b/d', 'a/c/d' ] +``` + +### options.nodupes + +**Type**: `Boolean` + +**Default**: `undefined` + +**Description**: Remove duplicates from the returned array. + +### options.rangeLimit + +**Type**: `Number` + +**Default**: `1000` + +**Description**: To prevent malicious patterns from being passed by users, an error is thrown when `braces.expand()` is used or `options.expand` is true and the generated range will exceed the `rangeLimit`. + +You can customize `options.rangeLimit` or set it to `Inifinity` to disable this altogether. + +**Examples** + +```js +// pattern exceeds the "rangeLimit", so it's optimized automatically +console.log(braces.expand('{1..1000}')); +//=> ['([1-9]|[1-9][0-9]{1,2}|1000)'] + +// pattern does not exceed "rangeLimit", so it's NOT optimized +console.log(braces.expand('{1..100}')); +//=> ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100'] +``` + +### options.transform + +**Type**: `Function` + +**Default**: `undefined` + +**Description**: Customize range expansion. + +**Example: Transforming non-numeric values** + +```js +const alpha = braces.expand('x/{a..e}/y', { + transform(value, index) { + // When non-numeric values are passed, "value" is a character code. + return 'foo/' + String.fromCharCode(value) + '-' + index; + }, +}); +console.log(alpha); +//=> [ 'x/foo/a-0/y', 'x/foo/b-1/y', 'x/foo/c-2/y', 'x/foo/d-3/y', 'x/foo/e-4/y' ] +``` + +**Example: Transforming numeric values** + +```js +const numeric = braces.expand('{1..5}', { + transform(value) { + // when numeric values are passed, "value" is a number + return 'foo/' + value * 2; + }, +}); +console.log(numeric); +//=> [ 'foo/2', 'foo/4', 'foo/6', 'foo/8', 'foo/10' ] +``` + +### options.quantifiers + +**Type**: `Boolean` + +**Default**: `undefined` + +**Description**: In regular expressions, quanitifiers can be used to specify how many times a token can be repeated. For example, `a{1,3}` will match the letter `a` one to three times. + +Unfortunately, regex quantifiers happen to share the same syntax as [Bash lists](#lists) + +The `quantifiers` option tells braces to detect when [regex quantifiers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#quantifiers) are defined in the given pattern, and not to try to expand them as lists. + +**Examples** + +```js +const braces = require('braces'); +console.log(braces('a/b{1,3}/{x,y,z}')); +//=> [ 'a/b(1|3)/(x|y|z)' ] +console.log(braces('a/b{1,3}/{x,y,z}', { quantifiers: true })); +//=> [ 'a/b{1,3}/(x|y|z)' ] +console.log(braces('a/b{1,3}/{x,y,z}', { quantifiers: true, expand: true })); +//=> [ 'a/b{1,3}/x', 'a/b{1,3}/y', 'a/b{1,3}/z' ] +``` + +### options.keepEscaping + +**Type**: `Boolean` + +**Default**: `undefined` + +**Description**: Do not strip backslashes that were used for escaping from the result. + +## What is "brace expansion"? + +Brace expansion is a type of parameter expansion that was made popular by unix shells for generating lists of strings, as well as regex-like matching when used alongside wildcards (globs). + +In addition to "expansion", braces are also used for matching. In other words: + +- [brace expansion](#brace-expansion) is for generating new lists +- [brace matching](#brace-matching) is for filtering existing lists + +
+More about brace expansion (click to expand) + +There are two main types of brace expansion: + +1. **lists**: which are defined using comma-separated values inside curly braces: `{a,b,c}` +2. **sequences**: which are defined using a starting value and an ending value, separated by two dots: `a{1..3}b`. Optionally, a third argument may be passed to define a "step" or increment to use: `a{1..100..10}b`. These are also sometimes referred to as "ranges". + +Here are some example brace patterns to illustrate how they work: + +**Sets** + +``` +{a,b,c} => a b c +{a,b,c}{1,2} => a1 a2 b1 b2 c1 c2 +``` + +**Sequences** + +``` +{1..9} => 1 2 3 4 5 6 7 8 9 +{4..-4} => 4 3 2 1 0 -1 -2 -3 -4 +{1..20..3} => 1 4 7 10 13 16 19 +{a..j} => a b c d e f g h i j +{j..a} => j i h g f e d c b a +{a..z..3} => a d g j m p s v y +``` + +**Combination** + +Sets and sequences can be mixed together or used along with any other strings. + +``` +{a,b,c}{1..3} => a1 a2 a3 b1 b2 b3 c1 c2 c3 +foo/{a,b,c}/bar => foo/a/bar foo/b/bar foo/c/bar +``` + +The fact that braces can be "expanded" from relatively simple patterns makes them ideal for quickly generating test fixtures, file paths, and similar use cases. + +## Brace matching + +In addition to _expansion_, brace patterns are also useful for performing regular-expression-like matching. + +For example, the pattern `foo/{1..3}/bar` would match any of following strings: + +``` +foo/1/bar +foo/2/bar +foo/3/bar +``` + +But not: + +``` +baz/1/qux +baz/2/qux +baz/3/qux +``` + +Braces can also be combined with [glob patterns](https://github.com/jonschlinkert/micromatch) to perform more advanced wildcard matching. For example, the pattern `*/{1..3}/*` would match any of following strings: + +``` +foo/1/bar +foo/2/bar +foo/3/bar +baz/1/qux +baz/2/qux +baz/3/qux +``` + +## Brace matching pitfalls + +Although brace patterns offer a user-friendly way of matching ranges or sets of strings, there are also some major disadvantages and potential risks you should be aware of. + +### tldr + +**"brace bombs"** + +- brace expansion can eat up a huge amount of processing resources +- as brace patterns increase _linearly in size_, the system resources required to expand the pattern increase exponentially +- users can accidentally (or intentially) exhaust your system's resources resulting in the equivalent of a DoS attack (bonus: no programming knowledge is required!) + +For a more detailed explanation with examples, see the [geometric complexity](#geometric-complexity) section. + +### The solution + +Jump to the [performance section](#performance) to see how Braces solves this problem in comparison to other libraries. + +### Geometric complexity + +At minimum, brace patterns with sets limited to two elements have quadradic or `O(n^2)` complexity. But the complexity of the algorithm increases exponentially as the number of sets, _and elements per set_, increases, which is `O(n^c)`. + +For example, the following sets demonstrate quadratic (`O(n^2)`) complexity: + +``` +{1,2}{3,4} => (2X2) => 13 14 23 24 +{1,2}{3,4}{5,6} => (2X2X2) => 135 136 145 146 235 236 245 246 +``` + +But add an element to a set, and we get a n-fold Cartesian product with `O(n^c)` complexity: + +``` +{1,2,3}{4,5,6}{7,8,9} => (3X3X3) => 147 148 149 157 158 159 167 168 169 247 248 + 249 257 258 259 267 268 269 347 348 349 357 + 358 359 367 368 369 +``` + +Now, imagine how this complexity grows given that each element is a n-tuple: + +``` +{1..100}{1..100} => (100X100) => 10,000 elements (38.4 kB) +{1..100}{1..100}{1..100} => (100X100X100) => 1,000,000 elements (5.76 MB) +``` + +Although these examples are clearly contrived, they demonstrate how brace patterns can quickly grow out of control. + +**More information** + +Interested in learning more about brace expansion? + +- [linuxjournal/bash-brace-expansion](http://www.linuxjournal.com/content/bash-brace-expansion) +- [rosettacode/Brace_expansion](https://rosettacode.org/wiki/Brace_expansion) +- [cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) + +
+ +## Performance + +Braces is not only screaming fast, it's also more accurate the other brace expansion libraries. + +### Better algorithms + +Fortunately there is a solution to the ["brace bomb" problem](#brace-matching-pitfalls): _don't expand brace patterns into an array when they're used for matching_. + +Instead, convert the pattern into an optimized regular expression. This is easier said than done, and braces is the only library that does this currently. + +**The proof is in the numbers** + +Minimatch gets exponentially slower as patterns increase in complexity, braces does not. The following results were generated using `braces()` and `minimatch.braceExpand()`, respectively. + +| **Pattern** | **braces** | **[minimatch][]** | +| --------------------------- | ------------------- | ---------------------------- | +| `{1..9007199254740991}`[^1] | `298 B` (5ms 459μs) | N/A (freezes) | +| `{1..1000000000000000}` | `41 B` (1ms 15μs) | N/A (freezes) | +| `{1..100000000000000}` | `40 B` (890μs) | N/A (freezes) | +| `{1..10000000000000}` | `39 B` (2ms 49μs) | N/A (freezes) | +| `{1..1000000000000}` | `38 B` (608μs) | N/A (freezes) | +| `{1..100000000000}` | `37 B` (397μs) | N/A (freezes) | +| `{1..10000000000}` | `35 B` (983μs) | N/A (freezes) | +| `{1..1000000000}` | `34 B` (798μs) | N/A (freezes) | +| `{1..100000000}` | `33 B` (733μs) | N/A (freezes) | +| `{1..10000000}` | `32 B` (5ms 632μs) | `78.89 MB` (16s 388ms 569μs) | +| `{1..1000000}` | `31 B` (1ms 381μs) | `6.89 MB` (1s 496ms 887μs) | +| `{1..100000}` | `30 B` (950μs) | `588.89 kB` (146ms 921μs) | +| `{1..10000}` | `29 B` (1ms 114μs) | `48.89 kB` (14ms 187μs) | +| `{1..1000}` | `28 B` (760μs) | `3.89 kB` (1ms 453μs) | +| `{1..100}` | `22 B` (345μs) | `291 B` (196μs) | +| `{1..10}` | `10 B` (533μs) | `20 B` (37μs) | +| `{1..3}` | `7 B` (190μs) | `5 B` (27μs) | + +### Faster algorithms + +When you need expansion, braces is still much faster. + +_(the following results were generated using `braces.expand()` and `minimatch.braceExpand()`, respectively)_ + +| **Pattern** | **braces** | **[minimatch][]** | +| --------------- | --------------------------- | ---------------------------- | +| `{1..10000000}` | `78.89 MB` (2s 698ms 642μs) | `78.89 MB` (18s 601ms 974μs) | +| `{1..1000000}` | `6.89 MB` (458ms 576μs) | `6.89 MB` (1s 491ms 621μs) | +| `{1..100000}` | `588.89 kB` (20ms 728μs) | `588.89 kB` (156ms 919μs) | +| `{1..10000}` | `48.89 kB` (2ms 202μs) | `48.89 kB` (13ms 641μs) | +| `{1..1000}` | `3.89 kB` (1ms 796μs) | `3.89 kB` (1ms 958μs) | +| `{1..100}` | `291 B` (424μs) | `291 B` (211μs) | +| `{1..10}` | `20 B` (487μs) | `20 B` (72μs) | +| `{1..3}` | `5 B` (166μs) | `5 B` (27μs) | + +If you'd like to run these comparisons yourself, see [test/support/generate.js](test/support/generate.js). + +## Benchmarks + +### Running benchmarks + +Install dev dependencies: + +```bash +npm i -d && npm benchmark +``` + +### Latest results + +Braces is more accurate, without sacrificing performance. + +```bash +● expand - range (expanded) + braces x 53,167 ops/sec ±0.12% (102 runs sampled) + minimatch x 11,378 ops/sec ±0.10% (102 runs sampled) +● expand - range (optimized for regex) + braces x 373,442 ops/sec ±0.04% (100 runs sampled) + minimatch x 3,262 ops/sec ±0.18% (100 runs sampled) +● expand - nested ranges (expanded) + braces x 33,921 ops/sec ±0.09% (99 runs sampled) + minimatch x 10,855 ops/sec ±0.28% (100 runs sampled) +● expand - nested ranges (optimized for regex) + braces x 287,479 ops/sec ±0.52% (98 runs sampled) + minimatch x 3,219 ops/sec ±0.28% (101 runs sampled) +● expand - set (expanded) + braces x 238,243 ops/sec ±0.19% (97 runs sampled) + minimatch x 538,268 ops/sec ±0.31% (96 runs sampled) +● expand - set (optimized for regex) + braces x 321,844 ops/sec ±0.10% (97 runs sampled) + minimatch x 140,600 ops/sec ±0.15% (100 runs sampled) +● expand - nested sets (expanded) + braces x 165,371 ops/sec ±0.42% (96 runs sampled) + minimatch x 337,720 ops/sec ±0.28% (100 runs sampled) +● expand - nested sets (optimized for regex) + braces x 242,948 ops/sec ±0.12% (99 runs sampled) + minimatch x 87,403 ops/sec ±0.79% (96 runs sampled) +``` + +## About + +
+Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
+ +
+Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
+ +
+Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
+ +### Contributors + +| **Commits** | **Contributor** | +| ----------- | ------------------------------------------------------------- | +| 197 | [jonschlinkert](https://github.com/jonschlinkert) | +| 4 | [doowb](https://github.com/doowb) | +| 1 | [es128](https://github.com/es128) | +| 1 | [eush77](https://github.com/eush77) | +| 1 | [hemanth](https://github.com/hemanth) | +| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) | + +### Author + +**Jon Schlinkert** + +- [GitHub Profile](https://github.com/jonschlinkert) +- [Twitter Profile](https://twitter.com/jonschlinkert) +- [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) + +### License + +Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +--- + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 08, 2019._ diff --git a/project starter code/node_modules/braces/index.js b/project starter code/node_modules/braces/index.js new file mode 100644 index 00000000..d222c13b --- /dev/null +++ b/project starter code/node_modules/braces/index.js @@ -0,0 +1,170 @@ +'use strict'; + +const stringify = require('./lib/stringify'); +const compile = require('./lib/compile'); +const expand = require('./lib/expand'); +const parse = require('./lib/parse'); + +/** + * Expand the given pattern or create a regex-compatible string. + * + * ```js + * const braces = require('braces'); + * console.log(braces('{a,b,c}', { compile: true })); //=> ['(a|b|c)'] + * console.log(braces('{a,b,c}')); //=> ['a', 'b', 'c'] + * ``` + * @param {String} `str` + * @param {Object} `options` + * @return {String} + * @api public + */ + +const braces = (input, options = {}) => { + let output = []; + + if (Array.isArray(input)) { + for (const pattern of input) { + const result = braces.create(pattern, options); + if (Array.isArray(result)) { + output.push(...result); + } else { + output.push(result); + } + } + } else { + output = [].concat(braces.create(input, options)); + } + + if (options && options.expand === true && options.nodupes === true) { + output = [...new Set(output)]; + } + return output; +}; + +/** + * Parse the given `str` with the given `options`. + * + * ```js + * // braces.parse(pattern, [, options]); + * const ast = braces.parse('a/{b,c}/d'); + * console.log(ast); + * ``` + * @param {String} pattern Brace pattern to parse + * @param {Object} options + * @return {Object} Returns an AST + * @api public + */ + +braces.parse = (input, options = {}) => parse(input, options); + +/** + * Creates a braces string from an AST, or an AST node. + * + * ```js + * const braces = require('braces'); + * let ast = braces.parse('foo/{a,b}/bar'); + * console.log(stringify(ast.nodes[2])); //=> '{a,b}' + * ``` + * @param {String} `input` Brace pattern or AST. + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces.stringify = (input, options = {}) => { + if (typeof input === 'string') { + return stringify(braces.parse(input, options), options); + } + return stringify(input, options); +}; + +/** + * Compiles a brace pattern into a regex-compatible, optimized string. + * This method is called by the main [braces](#braces) function by default. + * + * ```js + * const braces = require('braces'); + * console.log(braces.compile('a/{b,c}/d')); + * //=> ['a/(b|c)/d'] + * ``` + * @param {String} `input` Brace pattern or AST. + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces.compile = (input, options = {}) => { + if (typeof input === 'string') { + input = braces.parse(input, options); + } + return compile(input, options); +}; + +/** + * Expands a brace pattern into an array. This method is called by the + * main [braces](#braces) function when `options.expand` is true. Before + * using this method it's recommended that you read the [performance notes](#performance)) + * and advantages of using [.compile](#compile) instead. + * + * ```js + * const braces = require('braces'); + * console.log(braces.expand('a/{b,c}/d')); + * //=> ['a/b/d', 'a/c/d']; + * ``` + * @param {String} `pattern` Brace pattern + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces.expand = (input, options = {}) => { + if (typeof input === 'string') { + input = braces.parse(input, options); + } + + let result = expand(input, options); + + // filter out empty strings if specified + if (options.noempty === true) { + result = result.filter(Boolean); + } + + // filter out duplicates if specified + if (options.nodupes === true) { + result = [...new Set(result)]; + } + + return result; +}; + +/** + * Processes a brace pattern and returns either an expanded array + * (if `options.expand` is true), a highly optimized regex-compatible string. + * This method is called by the main [braces](#braces) function. + * + * ```js + * const braces = require('braces'); + * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}')) + * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)' + * ``` + * @param {String} `pattern` Brace pattern + * @param {Object} `options` + * @return {Array} Returns an array of expanded values. + * @api public + */ + +braces.create = (input, options = {}) => { + if (input === '' || input.length < 3) { + return [input]; + } + + return options.expand !== true + ? braces.compile(input, options) + : braces.expand(input, options); +}; + +/** + * Expose "braces" + */ + +module.exports = braces; diff --git a/project starter code/node_modules/braces/lib/compile.js b/project starter code/node_modules/braces/lib/compile.js new file mode 100644 index 00000000..dce69beb --- /dev/null +++ b/project starter code/node_modules/braces/lib/compile.js @@ -0,0 +1,60 @@ +'use strict'; + +const fill = require('fill-range'); +const utils = require('./utils'); + +const compile = (ast, options = {}) => { + const walk = (node, parent = {}) => { + const invalidBlock = utils.isInvalidBrace(parent); + const invalidNode = node.invalid === true && options.escapeInvalid === true; + const invalid = invalidBlock === true || invalidNode === true; + const prefix = options.escapeInvalid === true ? '\\' : ''; + let output = ''; + + if (node.isOpen === true) { + return prefix + node.value; + } + + if (node.isClose === true) { + console.log('node.isClose', prefix, node.value); + return prefix + node.value; + } + + if (node.type === 'open') { + return invalid ? prefix + node.value : '('; + } + + if (node.type === 'close') { + return invalid ? prefix + node.value : ')'; + } + + if (node.type === 'comma') { + return node.prev.type === 'comma' ? '' : invalid ? node.value : '|'; + } + + if (node.value) { + return node.value; + } + + if (node.nodes && node.ranges > 0) { + const args = utils.reduce(node.nodes); + const range = fill(...args, { ...options, wrap: false, toRegex: true, strictZeros: true }); + + if (range.length !== 0) { + return args.length > 1 && range.length > 1 ? `(${range})` : range; + } + } + + if (node.nodes) { + for (const child of node.nodes) { + output += walk(child, node); + } + } + + return output; + }; + + return walk(ast); +}; + +module.exports = compile; diff --git a/project starter code/node_modules/braces/lib/constants.js b/project starter code/node_modules/braces/lib/constants.js new file mode 100644 index 00000000..2bb3b884 --- /dev/null +++ b/project starter code/node_modules/braces/lib/constants.js @@ -0,0 +1,57 @@ +'use strict'; + +module.exports = { + MAX_LENGTH: 10000, + + // Digits + CHAR_0: '0', /* 0 */ + CHAR_9: '9', /* 9 */ + + // Alphabet chars. + CHAR_UPPERCASE_A: 'A', /* A */ + CHAR_LOWERCASE_A: 'a', /* a */ + CHAR_UPPERCASE_Z: 'Z', /* Z */ + CHAR_LOWERCASE_Z: 'z', /* z */ + + CHAR_LEFT_PARENTHESES: '(', /* ( */ + CHAR_RIGHT_PARENTHESES: ')', /* ) */ + + CHAR_ASTERISK: '*', /* * */ + + // Non-alphabetic chars. + CHAR_AMPERSAND: '&', /* & */ + CHAR_AT: '@', /* @ */ + CHAR_BACKSLASH: '\\', /* \ */ + CHAR_BACKTICK: '`', /* ` */ + CHAR_CARRIAGE_RETURN: '\r', /* \r */ + CHAR_CIRCUMFLEX_ACCENT: '^', /* ^ */ + CHAR_COLON: ':', /* : */ + CHAR_COMMA: ',', /* , */ + CHAR_DOLLAR: '$', /* . */ + CHAR_DOT: '.', /* . */ + CHAR_DOUBLE_QUOTE: '"', /* " */ + CHAR_EQUAL: '=', /* = */ + CHAR_EXCLAMATION_MARK: '!', /* ! */ + CHAR_FORM_FEED: '\f', /* \f */ + CHAR_FORWARD_SLASH: '/', /* / */ + CHAR_HASH: '#', /* # */ + CHAR_HYPHEN_MINUS: '-', /* - */ + CHAR_LEFT_ANGLE_BRACKET: '<', /* < */ + CHAR_LEFT_CURLY_BRACE: '{', /* { */ + CHAR_LEFT_SQUARE_BRACKET: '[', /* [ */ + CHAR_LINE_FEED: '\n', /* \n */ + CHAR_NO_BREAK_SPACE: '\u00A0', /* \u00A0 */ + CHAR_PERCENT: '%', /* % */ + CHAR_PLUS: '+', /* + */ + CHAR_QUESTION_MARK: '?', /* ? */ + CHAR_RIGHT_ANGLE_BRACKET: '>', /* > */ + CHAR_RIGHT_CURLY_BRACE: '}', /* } */ + CHAR_RIGHT_SQUARE_BRACKET: ']', /* ] */ + CHAR_SEMICOLON: ';', /* ; */ + CHAR_SINGLE_QUOTE: '\'', /* ' */ + CHAR_SPACE: ' ', /* */ + CHAR_TAB: '\t', /* \t */ + CHAR_UNDERSCORE: '_', /* _ */ + CHAR_VERTICAL_LINE: '|', /* | */ + CHAR_ZERO_WIDTH_NOBREAK_SPACE: '\uFEFF' /* \uFEFF */ +}; diff --git a/project starter code/node_modules/braces/lib/expand.js b/project starter code/node_modules/braces/lib/expand.js new file mode 100644 index 00000000..35b2c41d --- /dev/null +++ b/project starter code/node_modules/braces/lib/expand.js @@ -0,0 +1,113 @@ +'use strict'; + +const fill = require('fill-range'); +const stringify = require('./stringify'); +const utils = require('./utils'); + +const append = (queue = '', stash = '', enclose = false) => { + const result = []; + + queue = [].concat(queue); + stash = [].concat(stash); + + if (!stash.length) return queue; + if (!queue.length) { + return enclose ? utils.flatten(stash).map(ele => `{${ele}}`) : stash; + } + + for (const item of queue) { + if (Array.isArray(item)) { + for (const value of item) { + result.push(append(value, stash, enclose)); + } + } else { + for (let ele of stash) { + if (enclose === true && typeof ele === 'string') ele = `{${ele}}`; + result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele); + } + } + } + return utils.flatten(result); +}; + +const expand = (ast, options = {}) => { + const rangeLimit = options.rangeLimit === undefined ? 1000 : options.rangeLimit; + + const walk = (node, parent = {}) => { + node.queue = []; + + let p = parent; + let q = parent.queue; + + while (p.type !== 'brace' && p.type !== 'root' && p.parent) { + p = p.parent; + q = p.queue; + } + + if (node.invalid || node.dollar) { + q.push(append(q.pop(), stringify(node, options))); + return; + } + + if (node.type === 'brace' && node.invalid !== true && node.nodes.length === 2) { + q.push(append(q.pop(), ['{}'])); + return; + } + + if (node.nodes && node.ranges > 0) { + const args = utils.reduce(node.nodes); + + if (utils.exceedsLimit(...args, options.step, rangeLimit)) { + throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.'); + } + + let range = fill(...args, options); + if (range.length === 0) { + range = stringify(node, options); + } + + q.push(append(q.pop(), range)); + node.nodes = []; + return; + } + + const enclose = utils.encloseBrace(node); + let queue = node.queue; + let block = node; + + while (block.type !== 'brace' && block.type !== 'root' && block.parent) { + block = block.parent; + queue = block.queue; + } + + for (let i = 0; i < node.nodes.length; i++) { + const child = node.nodes[i]; + + if (child.type === 'comma' && node.type === 'brace') { + if (i === 1) queue.push(''); + queue.push(''); + continue; + } + + if (child.type === 'close') { + q.push(append(q.pop(), queue, enclose)); + continue; + } + + if (child.value && child.type !== 'open') { + queue.push(append(queue.pop(), child.value)); + continue; + } + + if (child.nodes) { + walk(child, node); + } + } + + return queue; + }; + + return utils.flatten(walk(ast)); +}; + +module.exports = expand; diff --git a/project starter code/node_modules/braces/lib/parse.js b/project starter code/node_modules/braces/lib/parse.js new file mode 100644 index 00000000..3a6988e6 --- /dev/null +++ b/project starter code/node_modules/braces/lib/parse.js @@ -0,0 +1,331 @@ +'use strict'; + +const stringify = require('./stringify'); + +/** + * Constants + */ + +const { + MAX_LENGTH, + CHAR_BACKSLASH, /* \ */ + CHAR_BACKTICK, /* ` */ + CHAR_COMMA, /* , */ + CHAR_DOT, /* . */ + CHAR_LEFT_PARENTHESES, /* ( */ + CHAR_RIGHT_PARENTHESES, /* ) */ + CHAR_LEFT_CURLY_BRACE, /* { */ + CHAR_RIGHT_CURLY_BRACE, /* } */ + CHAR_LEFT_SQUARE_BRACKET, /* [ */ + CHAR_RIGHT_SQUARE_BRACKET, /* ] */ + CHAR_DOUBLE_QUOTE, /* " */ + CHAR_SINGLE_QUOTE, /* ' */ + CHAR_NO_BREAK_SPACE, + CHAR_ZERO_WIDTH_NOBREAK_SPACE +} = require('./constants'); + +/** + * parse + */ + +const parse = (input, options = {}) => { + if (typeof input !== 'string') { + throw new TypeError('Expected a string'); + } + + const opts = options || {}; + const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + if (input.length > max) { + throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`); + } + + const ast = { type: 'root', input, nodes: [] }; + const stack = [ast]; + let block = ast; + let prev = ast; + let brackets = 0; + const length = input.length; + let index = 0; + let depth = 0; + let value; + + /** + * Helpers + */ + + const advance = () => input[index++]; + const push = node => { + if (node.type === 'text' && prev.type === 'dot') { + prev.type = 'text'; + } + + if (prev && prev.type === 'text' && node.type === 'text') { + prev.value += node.value; + return; + } + + block.nodes.push(node); + node.parent = block; + node.prev = prev; + prev = node; + return node; + }; + + push({ type: 'bos' }); + + while (index < length) { + block = stack[stack.length - 1]; + value = advance(); + + /** + * Invalid chars + */ + + if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) { + continue; + } + + /** + * Escaped chars + */ + + if (value === CHAR_BACKSLASH) { + push({ type: 'text', value: (options.keepEscaping ? value : '') + advance() }); + continue; + } + + /** + * Right square bracket (literal): ']' + */ + + if (value === CHAR_RIGHT_SQUARE_BRACKET) { + push({ type: 'text', value: '\\' + value }); + continue; + } + + /** + * Left square bracket: '[' + */ + + if (value === CHAR_LEFT_SQUARE_BRACKET) { + brackets++; + + let next; + + while (index < length && (next = advance())) { + value += next; + + if (next === CHAR_LEFT_SQUARE_BRACKET) { + brackets++; + continue; + } + + if (next === CHAR_BACKSLASH) { + value += advance(); + continue; + } + + if (next === CHAR_RIGHT_SQUARE_BRACKET) { + brackets--; + + if (brackets === 0) { + break; + } + } + } + + push({ type: 'text', value }); + continue; + } + + /** + * Parentheses + */ + + if (value === CHAR_LEFT_PARENTHESES) { + block = push({ type: 'paren', nodes: [] }); + stack.push(block); + push({ type: 'text', value }); + continue; + } + + if (value === CHAR_RIGHT_PARENTHESES) { + if (block.type !== 'paren') { + push({ type: 'text', value }); + continue; + } + block = stack.pop(); + push({ type: 'text', value }); + block = stack[stack.length - 1]; + continue; + } + + /** + * Quotes: '|"|` + */ + + if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) { + const open = value; + let next; + + if (options.keepQuotes !== true) { + value = ''; + } + + while (index < length && (next = advance())) { + if (next === CHAR_BACKSLASH) { + value += next + advance(); + continue; + } + + if (next === open) { + if (options.keepQuotes === true) value += next; + break; + } + + value += next; + } + + push({ type: 'text', value }); + continue; + } + + /** + * Left curly brace: '{' + */ + + if (value === CHAR_LEFT_CURLY_BRACE) { + depth++; + + const dollar = prev.value && prev.value.slice(-1) === '$' || block.dollar === true; + const brace = { + type: 'brace', + open: true, + close: false, + dollar, + depth, + commas: 0, + ranges: 0, + nodes: [] + }; + + block = push(brace); + stack.push(block); + push({ type: 'open', value }); + continue; + } + + /** + * Right curly brace: '}' + */ + + if (value === CHAR_RIGHT_CURLY_BRACE) { + if (block.type !== 'brace') { + push({ type: 'text', value }); + continue; + } + + const type = 'close'; + block = stack.pop(); + block.close = true; + + push({ type, value }); + depth--; + + block = stack[stack.length - 1]; + continue; + } + + /** + * Comma: ',' + */ + + if (value === CHAR_COMMA && depth > 0) { + if (block.ranges > 0) { + block.ranges = 0; + const open = block.nodes.shift(); + block.nodes = [open, { type: 'text', value: stringify(block) }]; + } + + push({ type: 'comma', value }); + block.commas++; + continue; + } + + /** + * Dot: '.' + */ + + if (value === CHAR_DOT && depth > 0 && block.commas === 0) { + const siblings = block.nodes; + + if (depth === 0 || siblings.length === 0) { + push({ type: 'text', value }); + continue; + } + + if (prev.type === 'dot') { + block.range = []; + prev.value += value; + prev.type = 'range'; + + if (block.nodes.length !== 3 && block.nodes.length !== 5) { + block.invalid = true; + block.ranges = 0; + prev.type = 'text'; + continue; + } + + block.ranges++; + block.args = []; + continue; + } + + if (prev.type === 'range') { + siblings.pop(); + + const before = siblings[siblings.length - 1]; + before.value += prev.value + value; + prev = before; + block.ranges--; + continue; + } + + push({ type: 'dot', value }); + continue; + } + + /** + * Text + */ + + push({ type: 'text', value }); + } + + // Mark imbalanced braces and brackets as invalid + do { + block = stack.pop(); + + if (block.type !== 'root') { + block.nodes.forEach(node => { + if (!node.nodes) { + if (node.type === 'open') node.isOpen = true; + if (node.type === 'close') node.isClose = true; + if (!node.nodes) node.type = 'text'; + node.invalid = true; + } + }); + + // get the location of the block on parent.nodes (block's siblings) + const parent = stack[stack.length - 1]; + const index = parent.nodes.indexOf(block); + // replace the (invalid) block with it's nodes + parent.nodes.splice(index, 1, ...block.nodes); + } + } while (stack.length > 0); + + push({ type: 'eos' }); + return ast; +}; + +module.exports = parse; diff --git a/project starter code/node_modules/braces/lib/stringify.js b/project starter code/node_modules/braces/lib/stringify.js new file mode 100644 index 00000000..8bcf872c --- /dev/null +++ b/project starter code/node_modules/braces/lib/stringify.js @@ -0,0 +1,32 @@ +'use strict'; + +const utils = require('./utils'); + +module.exports = (ast, options = {}) => { + const stringify = (node, parent = {}) => { + const invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent); + const invalidNode = node.invalid === true && options.escapeInvalid === true; + let output = ''; + + if (node.value) { + if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) { + return '\\' + node.value; + } + return node.value; + } + + if (node.value) { + return node.value; + } + + if (node.nodes) { + for (const child of node.nodes) { + output += stringify(child); + } + } + return output; + }; + + return stringify(ast); +}; + diff --git a/project starter code/node_modules/braces/lib/utils.js b/project starter code/node_modules/braces/lib/utils.js new file mode 100644 index 00000000..d19311fe --- /dev/null +++ b/project starter code/node_modules/braces/lib/utils.js @@ -0,0 +1,122 @@ +'use strict'; + +exports.isInteger = num => { + if (typeof num === 'number') { + return Number.isInteger(num); + } + if (typeof num === 'string' && num.trim() !== '') { + return Number.isInteger(Number(num)); + } + return false; +}; + +/** + * Find a node of the given type + */ + +exports.find = (node, type) => node.nodes.find(node => node.type === type); + +/** + * Find a node of the given type + */ + +exports.exceedsLimit = (min, max, step = 1, limit) => { + if (limit === false) return false; + if (!exports.isInteger(min) || !exports.isInteger(max)) return false; + return ((Number(max) - Number(min)) / Number(step)) >= limit; +}; + +/** + * Escape the given node with '\\' before node.value + */ + +exports.escapeNode = (block, n = 0, type) => { + const node = block.nodes[n]; + if (!node) return; + + if ((type && node.type === type) || node.type === 'open' || node.type === 'close') { + if (node.escaped !== true) { + node.value = '\\' + node.value; + node.escaped = true; + } + } +}; + +/** + * Returns true if the given brace node should be enclosed in literal braces + */ + +exports.encloseBrace = node => { + if (node.type !== 'brace') return false; + if ((node.commas >> 0 + node.ranges >> 0) === 0) { + node.invalid = true; + return true; + } + return false; +}; + +/** + * Returns true if a brace node is invalid. + */ + +exports.isInvalidBrace = block => { + if (block.type !== 'brace') return false; + if (block.invalid === true || block.dollar) return true; + if ((block.commas >> 0 + block.ranges >> 0) === 0) { + block.invalid = true; + return true; + } + if (block.open !== true || block.close !== true) { + block.invalid = true; + return true; + } + return false; +}; + +/** + * Returns true if a node is an open or close node + */ + +exports.isOpenOrClose = node => { + if (node.type === 'open' || node.type === 'close') { + return true; + } + return node.open === true || node.close === true; +}; + +/** + * Reduce an array of text nodes. + */ + +exports.reduce = nodes => nodes.reduce((acc, node) => { + if (node.type === 'text') acc.push(node.value); + if (node.type === 'range') node.type = 'text'; + return acc; +}, []); + +/** + * Flatten an array + */ + +exports.flatten = (...args) => { + const result = []; + + const flat = arr => { + for (let i = 0; i < arr.length; i++) { + const ele = arr[i]; + + if (Array.isArray(ele)) { + flat(ele); + continue; + } + + if (ele !== undefined) { + result.push(ele); + } + } + return result; + }; + + flat(args); + return result; +}; diff --git a/project starter code/node_modules/braces/package.json b/project starter code/node_modules/braces/package.json new file mode 100644 index 00000000..c3c056e4 --- /dev/null +++ b/project starter code/node_modules/braces/package.json @@ -0,0 +1,77 @@ +{ + "name": "braces", + "description": "Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed.", + "version": "3.0.3", + "homepage": "https://github.com/micromatch/braces", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "Brian Woodward (https://twitter.com/doowb)", + "Elan Shanker (https://github.com/es128)", + "Eugene Sharygin (https://github.com/eush77)", + "hemanth.hm (http://h3manth.com)", + "Jon Schlinkert (http://twitter.com/jonschlinkert)" + ], + "repository": "micromatch/braces", + "bugs": { + "url": "https://github.com/micromatch/braces/issues" + }, + "license": "MIT", + "files": [ + "index.js", + "lib" + ], + "main": "index.js", + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "mocha", + "benchmark": "node benchmark" + }, + "dependencies": { + "fill-range": "^7.1.1" + }, + "devDependencies": { + "ansi-colors": "^3.2.4", + "bash-path": "^2.0.1", + "gulp-format-md": "^2.0.0", + "mocha": "^6.1.1" + }, + "keywords": [ + "alpha", + "alphabetical", + "bash", + "brace", + "braces", + "expand", + "expansion", + "filepath", + "fill", + "fs", + "glob", + "globbing", + "letter", + "match", + "matches", + "matching", + "number", + "numerical", + "path", + "range", + "ranges", + "sh" + ], + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "lint": { + "reflinks": true + }, + "plugins": [ + "gulp-format-md" + ] + } +} diff --git a/project starter code/node_modules/call-bind/.eslintrc b/project starter code/node_modules/call-bind/.eslintrc index e5d3c9a9..dfa9a6cd 100644 --- a/project starter code/node_modules/call-bind/.eslintrc +++ b/project starter code/node_modules/call-bind/.eslintrc @@ -12,6 +12,5 @@ ], }], "no-magic-numbers": 0, - "operator-linebreak": [2, "before"], }, } diff --git a/project starter code/node_modules/call-bind/.nycrc b/project starter code/node_modules/call-bind/.nycrc index 1826526e..bdd626ce 100644 --- a/project starter code/node_modules/call-bind/.nycrc +++ b/project starter code/node_modules/call-bind/.nycrc @@ -2,10 +2,6 @@ "all": true, "check-coverage": false, "reporter": ["text-summary", "text", "html", "json"], - "lines": 86, - "statements": 85.93, - "functions": 82.43, - "branches": 76.06, "exclude": [ "coverage", "test" diff --git a/project starter code/node_modules/call-bind/CHANGELOG.md b/project starter code/node_modules/call-bind/CHANGELOG.md index 62a37279..c653f701 100644 --- a/project starter code/node_modules/call-bind/CHANGELOG.md +++ b/project starter code/node_modules/call-bind/CHANGELOG.md @@ -5,6 +5,57 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v1.0.7](https://github.com/ljharb/call-bind/compare/v1.0.6...v1.0.7) - 2024-02-12 + +### Commits + +- [Refactor] use `es-define-property` [`09b76a0`](https://github.com/ljharb/call-bind/commit/09b76a01634440461d44a80c9924ec4b500f3b03) +- [Deps] update `get-intrinsic`, `set-function-length` [`ad5136d`](https://github.com/ljharb/call-bind/commit/ad5136ddda2a45c590959829ad3dce0c9f4e3590) + +## [v1.0.6](https://github.com/ljharb/call-bind/compare/v1.0.5...v1.0.6) - 2024-02-05 + +### Commits + +- [Dev Deps] update `aud`, `npmignore`, `tape` [`d564d5c`](https://github.com/ljharb/call-bind/commit/d564d5ce3e06a19df4d499c77f8d1a9da44e77aa) +- [Deps] update `get-intrinsic`, `set-function-length` [`cfc2bdc`](https://github.com/ljharb/call-bind/commit/cfc2bdca7b633df0e0e689e6b637f668f1c6792e) +- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`64cd289`](https://github.com/ljharb/call-bind/commit/64cd289ae5862c250a4ca80aa8d461047c166af5) +- [meta] add missing `engines.node` [`32a4038`](https://github.com/ljharb/call-bind/commit/32a4038857b62179f7f9b7b3df2c5260036be582) + +## [v1.0.5](https://github.com/ljharb/call-bind/compare/v1.0.4...v1.0.5) - 2023-10-19 + +### Commits + +- [Fix] throw an error on non-functions as early as possible [`f262408`](https://github.com/ljharb/call-bind/commit/f262408f822c840fbc268080f3ad7c429611066d) +- [Deps] update `set-function-length` [`3fff271`](https://github.com/ljharb/call-bind/commit/3fff27145a1e3a76a5b74f1d7c3c43d0fa3b9871) + +## [v1.0.4](https://github.com/ljharb/call-bind/compare/v1.0.3...v1.0.4) - 2023-10-19 + +## [v1.0.3](https://github.com/ljharb/call-bind/compare/v1.0.2...v1.0.3) - 2023-10-19 + +### Commits + +- [actions] reuse common workflows [`a994df6`](https://github.com/ljharb/call-bind/commit/a994df69f401f4bf735a4ccd77029b85d1549453) +- [meta] use `npmignore` to autogenerate an npmignore file [`eef3ef2`](https://github.com/ljharb/call-bind/commit/eef3ef21e1f002790837fedb8af2679c761fbdf5) +- [readme] flesh out content [`1845ccf`](https://github.com/ljharb/call-bind/commit/1845ccfd9976a607884cfc7157c93192cc16cf22) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`5b47d53`](https://github.com/ljharb/call-bind/commit/5b47d53d2fd74af5ea0a44f1d51e503cd42f7a90) +- [Refactor] use `set-function-length` [`a0e165c`](https://github.com/ljharb/call-bind/commit/a0e165c5dc61db781cbc919b586b1c2b8da0b150) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`9c50103`](https://github.com/ljharb/call-bind/commit/9c50103f44137279a817317cf6cc421a658f85b4) +- [meta] simplify "exports" [`019c6d0`](https://github.com/ljharb/call-bind/commit/019c6d06b0e1246ceed8e579f57e44441cbbf6d9) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `safe-publish-latest`, `tape` [`23bd718`](https://github.com/ljharb/call-bind/commit/23bd718a288d3b03042062b4ef5153b3cea83f11) +- [actions] update codecov uploader [`62552d7`](https://github.com/ljharb/call-bind/commit/62552d79cc79e05825e99aaba134ae5b37f33da5) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`ec81665`](https://github.com/ljharb/call-bind/commit/ec81665b300f87eabff597afdc8b8092adfa7afd) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`35d67fc`](https://github.com/ljharb/call-bind/commit/35d67fcea883e686650f736f61da5ddca2592de8) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`0266d8d`](https://github.com/ljharb/call-bind/commit/0266d8d2a45086a922db366d0c2932fa463662ff) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`43a5b28`](https://github.com/ljharb/call-bind/commit/43a5b28a444e710e1bbf92adb8afb5cf7523a223) +- [Deps] update `define-data-property`, `function-bind`, `get-intrinsic` [`780eb36`](https://github.com/ljharb/call-bind/commit/780eb36552514f8cc99c70821ce698697c2726a5) +- [Dev Deps] update `aud`, `tape` [`90d50ad`](https://github.com/ljharb/call-bind/commit/90d50ad03b061e0268b3380b0065fcaec183dc05) +- [meta] use `prepublishOnly` script for npm 7+ [`44c5433`](https://github.com/ljharb/call-bind/commit/44c5433b7980e02b4870007046407cf6fc543329) +- [Deps] update `get-intrinsic` [`86bfbfc`](https://github.com/ljharb/call-bind/commit/86bfbfcf34afdc6eabc93ce3d408548d0e27d958) +- [Deps] update `get-intrinsic` [`5c53354`](https://github.com/ljharb/call-bind/commit/5c5335489be0294c18cd7a8bb6e08226ee019ff5) +- [actions] update checkout action [`4c393a8`](https://github.com/ljharb/call-bind/commit/4c393a8173b3c8e5b30d5b3297b3b94d48bf87f3) +- [Deps] update `get-intrinsic` [`4e70bde`](https://github.com/ljharb/call-bind/commit/4e70bdec0626acb11616d66250fc14565e716e91) +- [Deps] update `get-intrinsic` [`55ae803`](https://github.com/ljharb/call-bind/commit/55ae803a920bd93c369cd798c20de31f91e9fc60) + ## [v1.0.2](https://github.com/ljharb/call-bind/compare/v1.0.1...v1.0.2) - 2021-01-11 ### Commits diff --git a/project starter code/node_modules/call-bind/README.md b/project starter code/node_modules/call-bind/README.md index 53649eb4..48e9047f 100644 --- a/project starter code/node_modules/call-bind/README.md +++ b/project starter code/node_modules/call-bind/README.md @@ -1,2 +1,64 @@ -# call-bind +# call-bind [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + Robustly `.call.bind()` a function. + +## Getting started + +```sh +npm install --save call-bind +``` + +## Usage/Examples + +```js +const assert = require('assert'); +const callBind = require('call-bind'); +const callBound = require('call-bind/callBound'); + +function f(a, b) { + assert.equal(this, 1); + assert.equal(a, 2); + assert.equal(b, 3); + assert.equal(arguments.length, 2); +} + +const fBound = callBind(f); + +const slice = callBound('Array.prototype.slice'); + +delete Function.prototype.call; +delete Function.prototype.bind; + +fBound(1, 2, 3); + +assert.deepEqual(slice([1, 2, 3, 4], 1, -1), [2, 3]); +``` + +## Tests + +Clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/call-bind +[npm-version-svg]: https://versionbadg.es/ljharb/call-bind.svg +[deps-svg]: https://david-dm.org/ljharb/call-bind.svg +[deps-url]: https://david-dm.org/ljharb/call-bind +[dev-deps-svg]: https://david-dm.org/ljharb/call-bind/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/call-bind#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/call-bind.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/call-bind.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/call-bind.svg +[downloads-url]: https://npm-stat.com/charts.html?package=call-bind +[codecov-image]: https://codecov.io/gh/ljharb/call-bind/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/call-bind/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/call-bind +[actions-url]: https://github.com/ljharb/call-bind/actions diff --git a/project starter code/node_modules/call-bind/index.js b/project starter code/node_modules/call-bind/index.js index 6fa3e4af..01c5b3d4 100644 --- a/project starter code/node_modules/call-bind/index.js +++ b/project starter code/node_modules/call-bind/index.js @@ -2,38 +2,26 @@ var bind = require('function-bind'); var GetIntrinsic = require('get-intrinsic'); +var setFunctionLength = require('set-function-length'); +var $TypeError = require('es-errors/type'); var $apply = GetIntrinsic('%Function.prototype.apply%'); var $call = GetIntrinsic('%Function.prototype.call%'); var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); -var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); -var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); +var $defineProperty = require('es-define-property'); var $max = GetIntrinsic('%Math.max%'); -if ($defineProperty) { - try { - $defineProperty({}, 'a', { value: 1 }); - } catch (e) { - // IE 8 has a broken defineProperty - $defineProperty = null; - } -} - module.exports = function callBind(originalFunction) { - var func = $reflectApply(bind, $call, arguments); - if ($gOPD && $defineProperty) { - var desc = $gOPD(func, 'length'); - if (desc.configurable) { - // original length, plus the receiver, minus any additional arguments (after the receiver) - $defineProperty( - func, - 'length', - { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) } - ); - } + if (typeof originalFunction !== 'function') { + throw new $TypeError('a function is required'); } - return func; + var func = $reflectApply(bind, $call, arguments); + return setFunctionLength( + func, + 1 + $max(0, originalFunction.length - (arguments.length - 1)), + true + ); }; var applyBind = function applyBind() { diff --git a/project starter code/node_modules/call-bind/package.json b/project starter code/node_modules/call-bind/package.json index 4360556a..5ba88ff8 100644 --- a/project starter code/node_modules/call-bind/package.json +++ b/project starter code/node_modules/call-bind/package.json @@ -1,28 +1,21 @@ { "name": "call-bind", - "version": "1.0.2", + "version": "1.0.7", "description": "Robustly `.call.bind()` a function", "main": "index.js", "exports": { - ".": [ - { - "default": "./index.js" - }, - "./index.js" - ], - "./callBound": [ - { - "default": "./callBound.js" - }, - "./callBound.js" - ], + ".": "./index.js", + "./callBound": "./callBound.js", "./package.json": "./package.json" }, "scripts": { - "prepublish": "safe-publish-latest", + "prepack": "npmignore --auto --commentLines=auto", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", "lint": "eslint --ext=.js,.mjs .", + "postlint": "evalmd README.md", "pretest": "npm run lint", - "tests-only": "nyc tape 'test/*'", + "tests-only": "nyc tape 'test/**/*.js'", "test": "npm run tests-only", "posttest": "aud --production", "version": "auto-changelog && git add CHANGELOG.md", @@ -57,17 +50,31 @@ }, "homepage": "https://github.com/ljharb/call-bind#readme", "devDependencies": { - "@ljharb/eslint-config": "^17.3.0", - "aud": "^1.1.3", - "auto-changelog": "^2.2.1", - "eslint": "^7.17.0", + "@ljharb/eslint-config": "^21.1.0", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "es-value-fixtures": "^1.4.2", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-strict-mode": "^1.0.1", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", "nyc": "^10.3.2", - "safe-publish-latest": "^1.1.4", - "tape": "^5.1.1" + "object-inspect": "^1.13.1", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.4" }, "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "testling": { + "files": "test/index.js" }, "auto-changelog": { "output": "CHANGELOG.md", @@ -76,5 +83,13 @@ "commitLimit": false, "backfillLimit": false, "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" } } diff --git a/project starter code/node_modules/call-bind/test/callBound.js b/project starter code/node_modules/call-bind/test/callBound.js index 209ce3cc..c32319d7 100644 --- a/project starter code/node_modules/call-bind/test/callBound.js +++ b/project starter code/node_modules/call-bind/test/callBound.js @@ -40,7 +40,6 @@ test('callBound', function (t) { 'allowMissing arg still throws for unknown intrinsic' ); - /* globals WeakRef: false */ t.test('real but absent intrinsic', { skip: typeof WeakRef !== 'undefined' }, function (st) { st['throws']( function () { callBound('WeakRef'); }, diff --git a/project starter code/node_modules/call-bind/test/index.js b/project starter code/node_modules/call-bind/test/index.js index bf6769c7..1fd46689 100644 --- a/project starter code/node_modules/call-bind/test/index.js +++ b/project starter code/node_modules/call-bind/test/index.js @@ -2,6 +2,11 @@ var callBind = require('../'); var bind = require('function-bind'); +var gOPD = require('gopd'); +var hasStrictMode = require('has-strict-mode')(); +var forEach = require('for-each'); +var inspect = require('object-inspect'); +var v = require('es-value-fixtures'); var test = require('tape'); @@ -10,15 +15,24 @@ var test = require('tape'); * in io.js v3, it is configurable except on bound functions, hence the .bind() */ var functionsHaveConfigurableLengths = !!( - Object.getOwnPropertyDescriptor + gOPD + && Object.getOwnPropertyDescriptor && Object.getOwnPropertyDescriptor(bind.call(function () {}), 'length').configurable ); test('callBind', function (t) { + forEach(v.nonFunctions, function (nonFunction) { + t['throws']( + function () { callBind(nonFunction); }, + TypeError, + inspect(nonFunction) + ' is not a function' + ); + }); + var sentinel = { sentinel: true }; var func = function (a, b) { // eslint-disable-next-line no-invalid-this - return [this, a, b]; + return [!hasStrictMode && this === global ? undefined : this, a, b]; }; t.equal(func.length, 2, 'original function length is 2'); t.deepEqual(func(), [undefined, undefined, undefined], 'unbound func with too few args'); @@ -28,8 +42,8 @@ test('callBind', function (t) { var bound = callBind(func); t.equal(bound.length, func.length + 1, 'function length is preserved', { skip: !functionsHaveConfigurableLengths }); t.deepEqual(bound(), [undefined, undefined, undefined], 'bound func with too few args'); - t.deepEqual(bound(1, 2), [1, 2, undefined], 'bound func with right args'); - t.deepEqual(bound(1, 2, 3), [1, 2, 3], 'bound func with too many args'); + t.deepEqual(bound(1, 2), [hasStrictMode ? 1 : Object(1), 2, undefined], 'bound func with right args'); + t.deepEqual(bound(1, 2, 3), [hasStrictMode ? 1 : Object(1), 2, 3], 'bound func with too many args'); var boundR = callBind(func, sentinel); t.equal(boundR.length, func.length, 'function length is preserved', { skip: !functionsHaveConfigurableLengths }); diff --git a/project starter code/node_modules/chokidar/LICENSE b/project starter code/node_modules/chokidar/LICENSE new file mode 100644 index 00000000..fa9162b5 --- /dev/null +++ b/project starter code/node_modules/chokidar/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2012-2019 Paul Miller (https://paulmillr.com), Elan Shanker + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the “Software”), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/project starter code/node_modules/chokidar/README.md b/project starter code/node_modules/chokidar/README.md new file mode 100644 index 00000000..8e25decb --- /dev/null +++ b/project starter code/node_modules/chokidar/README.md @@ -0,0 +1,308 @@ +# Chokidar [![Weekly downloads](https://img.shields.io/npm/dw/chokidar.svg)](https://github.com/paulmillr/chokidar) [![Yearly downloads](https://img.shields.io/npm/dy/chokidar.svg)](https://github.com/paulmillr/chokidar) + +> Minimal and efficient cross-platform file watching library + +[![NPM](https://nodei.co/npm/chokidar.png)](https://www.npmjs.com/package/chokidar) + +## Why? + +Node.js `fs.watch`: + +* Doesn't report filenames on MacOS. +* Doesn't report events at all when using editors like Sublime on MacOS. +* Often reports events twice. +* Emits most changes as `rename`. +* Does not provide an easy way to recursively watch file trees. +* Does not support recursive watching on Linux. + +Node.js `fs.watchFile`: + +* Almost as bad at event handling. +* Also does not provide any recursive watching. +* Results in high CPU utilization. + +Chokidar resolves these problems. + +Initially made for **[Brunch](https://brunch.io/)** (an ultra-swift web app build tool), it is now used in +[Microsoft's Visual Studio Code](https://github.com/microsoft/vscode), +[gulp](https://github.com/gulpjs/gulp/), +[karma](https://karma-runner.github.io/), +[PM2](https://github.com/Unitech/PM2), +[browserify](http://browserify.org/), +[webpack](https://webpack.github.io/), +[BrowserSync](https://www.browsersync.io/), +and [many others](https://www.npmjs.com/browse/depended/chokidar). +It has proven itself in production environments. + +Version 3 is out! Check out our blog post about it: [Chokidar 3: How to save 32TB of traffic every week](https://paulmillr.com/posts/chokidar-3-save-32tb-of-traffic/) + +## How? + +Chokidar does still rely on the Node.js core `fs` module, but when using +`fs.watch` and `fs.watchFile` for watching, it normalizes the events it +receives, often checking for truth by getting file stats and/or dir contents. + +On MacOS, chokidar by default uses a native extension exposing the Darwin +`FSEvents` API. This provides very efficient recursive watching compared with +implementations like `kqueue` available on most \*nix platforms. Chokidar still +does have to do some work to normalize the events received that way as well. + +On most other platforms, the `fs.watch`-based implementation is the default, which +avoids polling and keeps CPU usage down. Be advised that chokidar will initiate +watchers recursively for everything within scope of the paths that have been +specified, so be judicious about not wasting system resources by watching much +more than needed. + +## Getting started + +Install with npm: + +```sh +npm install chokidar +``` + +Then `require` and use it in your code: + +```javascript +const chokidar = require('chokidar'); + +// One-liner for current directory +chokidar.watch('.').on('all', (event, path) => { + console.log(event, path); +}); +``` + +## API + +```javascript +// Example of a more typical implementation structure + +// Initialize watcher. +const watcher = chokidar.watch('file, dir, glob, or array', { + ignored: /(^|[\/\\])\../, // ignore dotfiles + persistent: true +}); + +// Something to use when events are received. +const log = console.log.bind(console); +// Add event listeners. +watcher + .on('add', path => log(`File ${path} has been added`)) + .on('change', path => log(`File ${path} has been changed`)) + .on('unlink', path => log(`File ${path} has been removed`)); + +// More possible events. +watcher + .on('addDir', path => log(`Directory ${path} has been added`)) + .on('unlinkDir', path => log(`Directory ${path} has been removed`)) + .on('error', error => log(`Watcher error: ${error}`)) + .on('ready', () => log('Initial scan complete. Ready for changes')) + .on('raw', (event, path, details) => { // internal + log('Raw event info:', event, path, details); + }); + +// 'add', 'addDir' and 'change' events also receive stat() results as second +// argument when available: https://nodejs.org/api/fs.html#fs_class_fs_stats +watcher.on('change', (path, stats) => { + if (stats) console.log(`File ${path} changed size to ${stats.size}`); +}); + +// Watch new files. +watcher.add('new-file'); +watcher.add(['new-file-2', 'new-file-3', '**/other-file*']); + +// Get list of actual paths being watched on the filesystem +var watchedPaths = watcher.getWatched(); + +// Un-watch some files. +await watcher.unwatch('new-file*'); + +// Stop watching. +// The method is async! +watcher.close().then(() => console.log('closed')); + +// Full list of options. See below for descriptions. +// Do not use this example! +chokidar.watch('file', { + persistent: true, + + ignored: '*.txt', + ignoreInitial: false, + followSymlinks: true, + cwd: '.', + disableGlobbing: false, + + usePolling: false, + interval: 100, + binaryInterval: 300, + alwaysStat: false, + depth: 99, + awaitWriteFinish: { + stabilityThreshold: 2000, + pollInterval: 100 + }, + + ignorePermissionErrors: false, + atomic: true // or a custom 'atomicity delay', in milliseconds (default 100) +}); + +``` + +`chokidar.watch(paths, [options])` + +* `paths` (string or array of strings). Paths to files, dirs to be watched +recursively, or glob patterns. + - Note: globs must not contain windows separators (`\`), + because that's how they work by the standard — + you'll need to replace them with forward slashes (`/`). + - Note 2: for additional glob documentation, check out low-level + library: [picomatch](https://github.com/micromatch/picomatch). +* `options` (object) Options object as defined below: + +#### Persistence + +* `persistent` (default: `true`). Indicates whether the process +should continue to run as long as files are being watched. If set to +`false` when using `fsevents` to watch, no more events will be emitted +after `ready`, even if the process continues to run. + +#### Path filtering + +* `ignored` ([anymatch](https://github.com/es128/anymatch)-compatible definition) +Defines files/paths to be ignored. The whole relative or absolute path is +tested, not just filename. If a function with two arguments is provided, it +gets called twice per path - once with a single argument (the path), second +time with two arguments (the path and the +[`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) +object of that path). +* `ignoreInitial` (default: `false`). If set to `false` then `add`/`addDir` events are also emitted for matching paths while +instantiating the watching as chokidar discovers these file paths (before the `ready` event). +* `followSymlinks` (default: `true`). When `false`, only the +symlinks themselves will be watched for changes instead of following +the link references and bubbling events through the link's path. +* `cwd` (no default). The base directory from which watch `paths` are to be +derived. Paths emitted with events will be relative to this. +* `disableGlobbing` (default: `false`). If set to `true` then the strings passed to `.watch()` and `.add()` are treated as +literal path names, even if they look like globs. + +#### Performance + +* `usePolling` (default: `false`). +Whether to use fs.watchFile (backed by polling), or fs.watch. If polling +leads to high CPU utilization, consider setting this to `false`. It is +typically necessary to **set this to `true` to successfully watch files over +a network**, and it may be necessary to successfully watch files in other +non-standard situations. Setting to `true` explicitly on MacOS overrides the +`useFsEvents` default. You may also set the CHOKIDAR_USEPOLLING env variable +to true (1) or false (0) in order to override this option. +* _Polling-specific settings_ (effective when `usePolling: true`) + * `interval` (default: `100`). Interval of file system polling, in milliseconds. You may also + set the CHOKIDAR_INTERVAL env variable to override this option. + * `binaryInterval` (default: `300`). Interval of file system + polling for binary files. + ([see list of binary extensions](https://github.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json)) +* `useFsEvents` (default: `true` on MacOS). Whether to use the +`fsevents` watching interface if available. When set to `true` explicitly +and `fsevents` is available this supercedes the `usePolling` setting. When +set to `false` on MacOS, `usePolling: true` becomes the default. +* `alwaysStat` (default: `false`). If relying upon the +[`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) +object that may get passed with `add`, `addDir`, and `change` events, set +this to `true` to ensure it is provided even in cases where it wasn't +already available from the underlying watch events. +* `depth` (default: `undefined`). If set, limits how many levels of +subdirectories will be traversed. +* `awaitWriteFinish` (default: `false`). +By default, the `add` event will fire when a file first appears on disk, before +the entire file has been written. Furthermore, in some cases some `change` +events will be emitted while the file is being written. In some cases, +especially when watching for large files there will be a need to wait for the +write operation to finish before responding to a file creation or modification. +Setting `awaitWriteFinish` to `true` (or a truthy value) will poll file size, +holding its `add` and `change` events until the size does not change for a +configurable amount of time. The appropriate duration setting is heavily +dependent on the OS and hardware. For accurate detection this parameter should +be relatively high, making file watching much less responsive. +Use with caution. + * *`options.awaitWriteFinish` can be set to an object in order to adjust + timing params:* + * `awaitWriteFinish.stabilityThreshold` (default: 2000). Amount of time in + milliseconds for a file size to remain constant before emitting its event. + * `awaitWriteFinish.pollInterval` (default: 100). File size polling interval, in milliseconds. + +#### Errors + +* `ignorePermissionErrors` (default: `false`). Indicates whether to watch files +that don't have read permissions if possible. If watching fails due to `EPERM` +or `EACCES` with this set to `true`, the errors will be suppressed silently. +* `atomic` (default: `true` if `useFsEvents` and `usePolling` are `false`). +Automatically filters out artifacts that occur when using editors that use +"atomic writes" instead of writing directly to the source file. If a file is +re-added within 100 ms of being deleted, Chokidar emits a `change` event +rather than `unlink` then `add`. If the default of 100 ms does not work well +for you, you can override it by setting `atomic` to a custom value, in +milliseconds. + +### Methods & Events + +`chokidar.watch()` produces an instance of `FSWatcher`. Methods of `FSWatcher`: + +* `.add(path / paths)`: Add files, directories, or glob patterns for tracking. +Takes an array of strings or just one string. +* `.on(event, callback)`: Listen for an FS event. +Available events: `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `ready`, +`raw`, `error`. +Additionally `all` is available which gets emitted with the underlying event +name and path for every event other than `ready`, `raw`, and `error`. `raw` is internal, use it carefully. +* `.unwatch(path / paths)`: Stop watching files, directories, or glob patterns. +Takes an array of strings or just one string. +* `.close()`: **async** Removes all listeners from watched files. Asynchronous, returns Promise. Use with `await` to ensure bugs don't happen. +* `.getWatched()`: Returns an object representing all the paths on the file +system being watched by this `FSWatcher` instance. The object's keys are all the +directories (using absolute paths unless the `cwd` option was used), and the +values are arrays of the names of the items contained in each directory. + +## CLI + +If you need a CLI interface for your file watching, check out +[chokidar-cli](https://github.com/open-cli-tools/chokidar-cli), allowing you to +execute a command on each change, or get a stdio stream of change events. + +## Install Troubleshooting + +* `npm WARN optional dep failed, continuing fsevents@n.n.n` + * This message is normal part of how `npm` handles optional dependencies and is + not indicative of a problem. Even if accompanied by other related error messages, + Chokidar should function properly. + +* `TypeError: fsevents is not a constructor` + * Update chokidar by doing `rm -rf node_modules package-lock.json yarn.lock && npm install`, or update your dependency that uses chokidar. + +* Chokidar is producing `ENOSP` error on Linux, like this: + * `bash: cannot set terminal process group (-1): Inappropriate ioctl for device bash: no job control in this shell` + `Error: watch /home/ ENOSPC` + * This means Chokidar ran out of file handles and you'll need to increase their count by executing the following command in Terminal: + `echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p` + +## Changelog + +For more detailed changelog, see [`full_changelog.md`](.github/full_changelog.md). +- **v3.5 (Jan 6, 2021):** Support for ARM Macs with Apple Silicon. Fixes for deleted symlinks. +- **v3.4 (Apr 26, 2020):** Support for directory-based symlinks. Fixes for macos file replacement. +- **v3.3 (Nov 2, 2019):** `FSWatcher#close()` method became async. That fixes IO race conditions related to close method. +- **v3.2 (Oct 1, 2019):** Improve Linux RAM usage by 50%. Race condition fixes. Windows glob fixes. Improve stability by using tight range of dependency versions. +- **v3.1 (Sep 16, 2019):** dotfiles are no longer filtered out by default. Use `ignored` option if needed. Improve initial Linux scan time by 50%. +- **v3 (Apr 30, 2019):** massive CPU & RAM consumption improvements; reduces deps / package size by a factor of 17x and bumps Node.js requirement to v8.16 and higher. +- **v2 (Dec 29, 2017):** Globs are now posix-style-only; without windows support. Tons of bugfixes. +- **v1 (Apr 7, 2015):** Glob support, symlink support, tons of bugfixes. Node 0.8+ is supported +- **v0.1 (Apr 20, 2012):** Initial release, extracted from [Brunch](https://github.com/brunch/brunch/blob/9847a065aea300da99bd0753f90354cde9de1261/src/helpers.coffee#L66) + +## Also + +Why was chokidar named this way? What's the meaning behind it? + +>Chowkidar is a transliteration of a Hindi word meaning 'watchman, gatekeeper', चौकीदार. This ultimately comes from Sanskrit _ चतुष्क_ (crossway, quadrangle, consisting-of-four). This word is also used in other languages like Urdu as (چوکیدار) which is widely used in Pakistan and India. + +## License + +MIT (c) Paul Miller (), see [LICENSE](LICENSE) file. diff --git a/project starter code/node_modules/chokidar/index.js b/project starter code/node_modules/chokidar/index.js new file mode 100644 index 00000000..8752893c --- /dev/null +++ b/project starter code/node_modules/chokidar/index.js @@ -0,0 +1,973 @@ +'use strict'; + +const { EventEmitter } = require('events'); +const fs = require('fs'); +const sysPath = require('path'); +const { promisify } = require('util'); +const readdirp = require('readdirp'); +const anymatch = require('anymatch').default; +const globParent = require('glob-parent'); +const isGlob = require('is-glob'); +const braces = require('braces'); +const normalizePath = require('normalize-path'); + +const NodeFsHandler = require('./lib/nodefs-handler'); +const FsEventsHandler = require('./lib/fsevents-handler'); +const { + EV_ALL, + EV_READY, + EV_ADD, + EV_CHANGE, + EV_UNLINK, + EV_ADD_DIR, + EV_UNLINK_DIR, + EV_RAW, + EV_ERROR, + + STR_CLOSE, + STR_END, + + BACK_SLASH_RE, + DOUBLE_SLASH_RE, + SLASH_OR_BACK_SLASH_RE, + DOT_RE, + REPLACER_RE, + + SLASH, + SLASH_SLASH, + BRACE_START, + BANG, + ONE_DOT, + TWO_DOTS, + GLOBSTAR, + SLASH_GLOBSTAR, + ANYMATCH_OPTS, + STRING_TYPE, + FUNCTION_TYPE, + EMPTY_STR, + EMPTY_FN, + + isWindows, + isMacos, + isIBMi +} = require('./lib/constants'); + +const stat = promisify(fs.stat); +const readdir = promisify(fs.readdir); + +/** + * @typedef {String} Path + * @typedef {'all'|'add'|'addDir'|'change'|'unlink'|'unlinkDir'|'raw'|'error'|'ready'} EventName + * @typedef {'readdir'|'watch'|'add'|'remove'|'change'} ThrottleType + */ + +/** + * + * @typedef {Object} WatchHelpers + * @property {Boolean} followSymlinks + * @property {'stat'|'lstat'} statMethod + * @property {Path} path + * @property {Path} watchPath + * @property {Function} entryPath + * @property {Boolean} hasGlob + * @property {Object} globFilter + * @property {Function} filterPath + * @property {Function} filterDir + */ + +const arrify = (value = []) => Array.isArray(value) ? value : [value]; +const flatten = (list, result = []) => { + list.forEach(item => { + if (Array.isArray(item)) { + flatten(item, result); + } else { + result.push(item); + } + }); + return result; +}; + +const unifyPaths = (paths_) => { + /** + * @type {Array} + */ + const paths = flatten(arrify(paths_)); + if (!paths.every(p => typeof p === STRING_TYPE)) { + throw new TypeError(`Non-string provided as watch path: ${paths}`); + } + return paths.map(normalizePathToUnix); +}; + +// If SLASH_SLASH occurs at the beginning of path, it is not replaced +// because "//StoragePC/DrivePool/Movies" is a valid network path +const toUnix = (string) => { + let str = string.replace(BACK_SLASH_RE, SLASH); + let prepend = false; + if (str.startsWith(SLASH_SLASH)) { + prepend = true; + } + while (str.match(DOUBLE_SLASH_RE)) { + str = str.replace(DOUBLE_SLASH_RE, SLASH); + } + if (prepend) { + str = SLASH + str; + } + return str; +}; + +// Our version of upath.normalize +// TODO: this is not equal to path-normalize module - investigate why +const normalizePathToUnix = (path) => toUnix(sysPath.normalize(toUnix(path))); + +const normalizeIgnored = (cwd = EMPTY_STR) => (path) => { + if (typeof path !== STRING_TYPE) return path; + return normalizePathToUnix(sysPath.isAbsolute(path) ? path : sysPath.join(cwd, path)); +}; + +const getAbsolutePath = (path, cwd) => { + if (sysPath.isAbsolute(path)) { + return path; + } + if (path.startsWith(BANG)) { + return BANG + sysPath.join(cwd, path.slice(1)); + } + return sysPath.join(cwd, path); +}; + +const undef = (opts, key) => opts[key] === undefined; + +/** + * Directory entry. + * @property {Path} path + * @property {Set} items + */ +class DirEntry { + /** + * @param {Path} dir + * @param {Function} removeWatcher + */ + constructor(dir, removeWatcher) { + this.path = dir; + this._removeWatcher = removeWatcher; + /** @type {Set} */ + this.items = new Set(); + } + + add(item) { + const {items} = this; + if (!items) return; + if (item !== ONE_DOT && item !== TWO_DOTS) items.add(item); + } + + async remove(item) { + const {items} = this; + if (!items) return; + items.delete(item); + if (items.size > 0) return; + + const dir = this.path; + try { + await readdir(dir); + } catch (err) { + if (this._removeWatcher) { + this._removeWatcher(sysPath.dirname(dir), sysPath.basename(dir)); + } + } + } + + has(item) { + const {items} = this; + if (!items) return; + return items.has(item); + } + + /** + * @returns {Array} + */ + getChildren() { + const {items} = this; + if (!items) return; + return [...items.values()]; + } + + dispose() { + this.items.clear(); + delete this.path; + delete this._removeWatcher; + delete this.items; + Object.freeze(this); + } +} + +const STAT_METHOD_F = 'stat'; +const STAT_METHOD_L = 'lstat'; +class WatchHelper { + constructor(path, watchPath, follow, fsw) { + this.fsw = fsw; + this.path = path = path.replace(REPLACER_RE, EMPTY_STR); + this.watchPath = watchPath; + this.fullWatchPath = sysPath.resolve(watchPath); + this.hasGlob = watchPath !== path; + /** @type {object|boolean} */ + if (path === EMPTY_STR) this.hasGlob = false; + this.globSymlink = this.hasGlob && follow ? undefined : false; + this.globFilter = this.hasGlob ? anymatch(path, undefined, ANYMATCH_OPTS) : false; + this.dirParts = this.getDirParts(path); + this.dirParts.forEach((parts) => { + if (parts.length > 1) parts.pop(); + }); + this.followSymlinks = follow; + this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L; + } + + checkGlobSymlink(entry) { + // only need to resolve once + // first entry should always have entry.parentDir === EMPTY_STR + if (this.globSymlink === undefined) { + this.globSymlink = entry.fullParentDir === this.fullWatchPath ? + false : {realPath: entry.fullParentDir, linkPath: this.fullWatchPath}; + } + + if (this.globSymlink) { + return entry.fullPath.replace(this.globSymlink.realPath, this.globSymlink.linkPath); + } + + return entry.fullPath; + } + + entryPath(entry) { + return sysPath.join(this.watchPath, + sysPath.relative(this.watchPath, this.checkGlobSymlink(entry)) + ); + } + + filterPath(entry) { + const {stats} = entry; + if (stats && stats.isSymbolicLink()) return this.filterDir(entry); + const resolvedPath = this.entryPath(entry); + const matchesGlob = this.hasGlob && typeof this.globFilter === FUNCTION_TYPE ? + this.globFilter(resolvedPath) : true; + return matchesGlob && + this.fsw._isntIgnored(resolvedPath, stats) && + this.fsw._hasReadPermissions(stats); + } + + getDirParts(path) { + if (!this.hasGlob) return []; + const parts = []; + const expandedPath = path.includes(BRACE_START) ? braces.expand(path) : [path]; + expandedPath.forEach((path) => { + parts.push(sysPath.relative(this.watchPath, path).split(SLASH_OR_BACK_SLASH_RE)); + }); + return parts; + } + + filterDir(entry) { + if (this.hasGlob) { + const entryParts = this.getDirParts(this.checkGlobSymlink(entry)); + let globstar = false; + this.unmatchedGlob = !this.dirParts.some((parts) => { + return parts.every((part, i) => { + if (part === GLOBSTAR) globstar = true; + return globstar || !entryParts[0][i] || anymatch(part, entryParts[0][i], ANYMATCH_OPTS); + }); + }); + } + return !this.unmatchedGlob && this.fsw._isntIgnored(this.entryPath(entry), entry.stats); + } +} + +/** + * Watches files & directories for changes. Emitted events: + * `add`, `addDir`, `change`, `unlink`, `unlinkDir`, `all`, `error` + * + * new FSWatcher() + * .add(directories) + * .on('add', path => log('File', path, 'was added')) + */ +class FSWatcher extends EventEmitter { +// Not indenting methods for history sake; for now. +constructor(_opts) { + super(); + + const opts = {}; + if (_opts) Object.assign(opts, _opts); // for frozen objects + + /** @type {Map} */ + this._watched = new Map(); + /** @type {Map} */ + this._closers = new Map(); + /** @type {Set} */ + this._ignoredPaths = new Set(); + + /** @type {Map} */ + this._throttled = new Map(); + + /** @type {Map} */ + this._symlinkPaths = new Map(); + + this._streams = new Set(); + this.closed = false; + + // Set up default options. + if (undef(opts, 'persistent')) opts.persistent = true; + if (undef(opts, 'ignoreInitial')) opts.ignoreInitial = false; + if (undef(opts, 'ignorePermissionErrors')) opts.ignorePermissionErrors = false; + if (undef(opts, 'interval')) opts.interval = 100; + if (undef(opts, 'binaryInterval')) opts.binaryInterval = 300; + if (undef(opts, 'disableGlobbing')) opts.disableGlobbing = false; + opts.enableBinaryInterval = opts.binaryInterval !== opts.interval; + + // Enable fsevents on OS X when polling isn't explicitly enabled. + if (undef(opts, 'useFsEvents')) opts.useFsEvents = !opts.usePolling; + + // If we can't use fsevents, ensure the options reflect it's disabled. + const canUseFsEvents = FsEventsHandler.canUse(); + if (!canUseFsEvents) opts.useFsEvents = false; + + // Use polling on Mac if not using fsevents. + // Other platforms use non-polling fs_watch. + if (undef(opts, 'usePolling') && !opts.useFsEvents) { + opts.usePolling = isMacos; + } + + // Always default to polling on IBM i because fs.watch() is not available on IBM i. + if(isIBMi) { + opts.usePolling = true; + } + + // Global override (useful for end-developers that need to force polling for all + // instances of chokidar, regardless of usage/dependency depth) + const envPoll = process.env.CHOKIDAR_USEPOLLING; + if (envPoll !== undefined) { + const envLower = envPoll.toLowerCase(); + + if (envLower === 'false' || envLower === '0') { + opts.usePolling = false; + } else if (envLower === 'true' || envLower === '1') { + opts.usePolling = true; + } else { + opts.usePolling = !!envLower; + } + } + const envInterval = process.env.CHOKIDAR_INTERVAL; + if (envInterval) { + opts.interval = Number.parseInt(envInterval, 10); + } + + // Editor atomic write normalization enabled by default with fs.watch + if (undef(opts, 'atomic')) opts.atomic = !opts.usePolling && !opts.useFsEvents; + if (opts.atomic) this._pendingUnlinks = new Map(); + + if (undef(opts, 'followSymlinks')) opts.followSymlinks = true; + + if (undef(opts, 'awaitWriteFinish')) opts.awaitWriteFinish = false; + if (opts.awaitWriteFinish === true) opts.awaitWriteFinish = {}; + const awf = opts.awaitWriteFinish; + if (awf) { + if (!awf.stabilityThreshold) awf.stabilityThreshold = 2000; + if (!awf.pollInterval) awf.pollInterval = 100; + this._pendingWrites = new Map(); + } + if (opts.ignored) opts.ignored = arrify(opts.ignored); + + let readyCalls = 0; + this._emitReady = () => { + readyCalls++; + if (readyCalls >= this._readyCount) { + this._emitReady = EMPTY_FN; + this._readyEmitted = true; + // use process.nextTick to allow time for listener to be bound + process.nextTick(() => this.emit(EV_READY)); + } + }; + this._emitRaw = (...args) => this.emit(EV_RAW, ...args); + this._readyEmitted = false; + this.options = opts; + + // Initialize with proper watcher. + if (opts.useFsEvents) { + this._fsEventsHandler = new FsEventsHandler(this); + } else { + this._nodeFsHandler = new NodeFsHandler(this); + } + + // You’re frozen when your heart’s not open. + Object.freeze(opts); +} + +// Public methods + +/** + * Adds paths to be watched on an existing FSWatcher instance + * @param {Path|Array} paths_ + * @param {String=} _origAdd private; for handling non-existent paths to be watched + * @param {Boolean=} _internal private; indicates a non-user add + * @returns {FSWatcher} for chaining + */ +add(paths_, _origAdd, _internal) { + const {cwd, disableGlobbing} = this.options; + this.closed = false; + let paths = unifyPaths(paths_); + if (cwd) { + paths = paths.map((path) => { + const absPath = getAbsolutePath(path, cwd); + + // Check `path` instead of `absPath` because the cwd portion can't be a glob + if (disableGlobbing || !isGlob(path)) { + return absPath; + } + return normalizePath(absPath); + }); + } + + // set aside negated glob strings + paths = paths.filter((path) => { + if (path.startsWith(BANG)) { + this._ignoredPaths.add(path.slice(1)); + return false; + } + + // if a path is being added that was previously ignored, stop ignoring it + this._ignoredPaths.delete(path); + this._ignoredPaths.delete(path + SLASH_GLOBSTAR); + + // reset the cached userIgnored anymatch fn + // to make ignoredPaths changes effective + this._userIgnored = undefined; + + return true; + }); + + if (this.options.useFsEvents && this._fsEventsHandler) { + if (!this._readyCount) this._readyCount = paths.length; + if (this.options.persistent) this._readyCount += paths.length; + paths.forEach((path) => this._fsEventsHandler._addToFsEvents(path)); + } else { + if (!this._readyCount) this._readyCount = 0; + this._readyCount += paths.length; + Promise.all( + paths.map(async path => { + const res = await this._nodeFsHandler._addToNodeFs(path, !_internal, 0, 0, _origAdd); + if (res) this._emitReady(); + return res; + }) + ).then(results => { + if (this.closed) return; + results.filter(item => item).forEach(item => { + this.add(sysPath.dirname(item), sysPath.basename(_origAdd || item)); + }); + }); + } + + return this; +} + +/** + * Close watchers or start ignoring events from specified paths. + * @param {Path|Array} paths_ - string or array of strings, file/directory paths and/or globs + * @returns {FSWatcher} for chaining +*/ +unwatch(paths_) { + if (this.closed) return this; + const paths = unifyPaths(paths_); + const {cwd} = this.options; + + paths.forEach((path) => { + // convert to absolute path unless relative path already matches + if (!sysPath.isAbsolute(path) && !this._closers.has(path)) { + if (cwd) path = sysPath.join(cwd, path); + path = sysPath.resolve(path); + } + + this._closePath(path); + + this._ignoredPaths.add(path); + if (this._watched.has(path)) { + this._ignoredPaths.add(path + SLASH_GLOBSTAR); + } + + // reset the cached userIgnored anymatch fn + // to make ignoredPaths changes effective + this._userIgnored = undefined; + }); + + return this; +} + +/** + * Close watchers and remove all listeners from watched paths. + * @returns {Promise}. +*/ +close() { + if (this.closed) return this._closePromise; + this.closed = true; + + // Memory management. + this.removeAllListeners(); + const closers = []; + this._closers.forEach(closerList => closerList.forEach(closer => { + const promise = closer(); + if (promise instanceof Promise) closers.push(promise); + })); + this._streams.forEach(stream => stream.destroy()); + this._userIgnored = undefined; + this._readyCount = 0; + this._readyEmitted = false; + this._watched.forEach(dirent => dirent.dispose()); + ['closers', 'watched', 'streams', 'symlinkPaths', 'throttled'].forEach(key => { + this[`_${key}`].clear(); + }); + + this._closePromise = closers.length ? Promise.all(closers).then(() => undefined) : Promise.resolve(); + return this._closePromise; +} + +/** + * Expose list of watched paths + * @returns {Object} for chaining +*/ +getWatched() { + const watchList = {}; + this._watched.forEach((entry, dir) => { + const key = this.options.cwd ? sysPath.relative(this.options.cwd, dir) : dir; + watchList[key || ONE_DOT] = entry.getChildren().sort(); + }); + return watchList; +} + +emitWithAll(event, args) { + this.emit(...args); + if (event !== EV_ERROR) this.emit(EV_ALL, ...args); +} + +// Common helpers +// -------------- + +/** + * Normalize and emit events. + * Calling _emit DOES NOT MEAN emit() would be called! + * @param {EventName} event Type of event + * @param {Path} path File or directory path + * @param {*=} val1 arguments to be passed with event + * @param {*=} val2 + * @param {*=} val3 + * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag + */ +async _emit(event, path, val1, val2, val3) { + if (this.closed) return; + + const opts = this.options; + if (isWindows) path = sysPath.normalize(path); + if (opts.cwd) path = sysPath.relative(opts.cwd, path); + /** @type Array */ + const args = [event, path]; + if (val3 !== undefined) args.push(val1, val2, val3); + else if (val2 !== undefined) args.push(val1, val2); + else if (val1 !== undefined) args.push(val1); + + const awf = opts.awaitWriteFinish; + let pw; + if (awf && (pw = this._pendingWrites.get(path))) { + pw.lastChange = new Date(); + return this; + } + + if (opts.atomic) { + if (event === EV_UNLINK) { + this._pendingUnlinks.set(path, args); + setTimeout(() => { + this._pendingUnlinks.forEach((entry, path) => { + this.emit(...entry); + this.emit(EV_ALL, ...entry); + this._pendingUnlinks.delete(path); + }); + }, typeof opts.atomic === 'number' ? opts.atomic : 100); + return this; + } + if (event === EV_ADD && this._pendingUnlinks.has(path)) { + event = args[0] = EV_CHANGE; + this._pendingUnlinks.delete(path); + } + } + + if (awf && (event === EV_ADD || event === EV_CHANGE) && this._readyEmitted) { + const awfEmit = (err, stats) => { + if (err) { + event = args[0] = EV_ERROR; + args[1] = err; + this.emitWithAll(event, args); + } else if (stats) { + // if stats doesn't exist the file must have been deleted + if (args.length > 2) { + args[2] = stats; + } else { + args.push(stats); + } + this.emitWithAll(event, args); + } + }; + + this._awaitWriteFinish(path, awf.stabilityThreshold, event, awfEmit); + return this; + } + + if (event === EV_CHANGE) { + const isThrottled = !this._throttle(EV_CHANGE, path, 50); + if (isThrottled) return this; + } + + if (opts.alwaysStat && val1 === undefined && + (event === EV_ADD || event === EV_ADD_DIR || event === EV_CHANGE) + ) { + const fullPath = opts.cwd ? sysPath.join(opts.cwd, path) : path; + let stats; + try { + stats = await stat(fullPath); + } catch (err) {} + // Suppress event when fs_stat fails, to avoid sending undefined 'stat' + if (!stats || this.closed) return; + args.push(stats); + } + this.emitWithAll(event, args); + + return this; +} + +/** + * Common handler for errors + * @param {Error} error + * @returns {Error|Boolean} The error if defined, otherwise the value of the FSWatcher instance's `closed` flag + */ +_handleError(error) { + const code = error && error.code; + if (error && code !== 'ENOENT' && code !== 'ENOTDIR' && + (!this.options.ignorePermissionErrors || (code !== 'EPERM' && code !== 'EACCES')) + ) { + this.emit(EV_ERROR, error); + } + return error || this.closed; +} + +/** + * Helper utility for throttling + * @param {ThrottleType} actionType type being throttled + * @param {Path} path being acted upon + * @param {Number} timeout duration of time to suppress duplicate actions + * @returns {Object|false} tracking object or false if action should be suppressed + */ +_throttle(actionType, path, timeout) { + if (!this._throttled.has(actionType)) { + this._throttled.set(actionType, new Map()); + } + + /** @type {Map} */ + const action = this._throttled.get(actionType); + /** @type {Object} */ + const actionPath = action.get(path); + + if (actionPath) { + actionPath.count++; + return false; + } + + let timeoutObject; + const clear = () => { + const item = action.get(path); + const count = item ? item.count : 0; + action.delete(path); + clearTimeout(timeoutObject); + if (item) clearTimeout(item.timeoutObject); + return count; + }; + timeoutObject = setTimeout(clear, timeout); + const thr = {timeoutObject, clear, count: 0}; + action.set(path, thr); + return thr; +} + +_incrReadyCount() { + return this._readyCount++; +} + +/** + * Awaits write operation to finish. + * Polls a newly created file for size variations. When files size does not change for 'threshold' milliseconds calls callback. + * @param {Path} path being acted upon + * @param {Number} threshold Time in milliseconds a file size must be fixed before acknowledging write OP is finished + * @param {EventName} event + * @param {Function} awfEmit Callback to be called when ready for event to be emitted. + */ +_awaitWriteFinish(path, threshold, event, awfEmit) { + let timeoutHandler; + + let fullPath = path; + if (this.options.cwd && !sysPath.isAbsolute(path)) { + fullPath = sysPath.join(this.options.cwd, path); + } + + const now = new Date(); + + const awaitWriteFinish = (prevStat) => { + fs.stat(fullPath, (err, curStat) => { + if (err || !this._pendingWrites.has(path)) { + if (err && err.code !== 'ENOENT') awfEmit(err); + return; + } + + const now = Number(new Date()); + + if (prevStat && curStat.size !== prevStat.size) { + this._pendingWrites.get(path).lastChange = now; + } + const pw = this._pendingWrites.get(path); + const df = now - pw.lastChange; + + if (df >= threshold) { + this._pendingWrites.delete(path); + awfEmit(undefined, curStat); + } else { + timeoutHandler = setTimeout( + awaitWriteFinish, + this.options.awaitWriteFinish.pollInterval, + curStat + ); + } + }); + }; + + if (!this._pendingWrites.has(path)) { + this._pendingWrites.set(path, { + lastChange: now, + cancelWait: () => { + this._pendingWrites.delete(path); + clearTimeout(timeoutHandler); + return event; + } + }); + timeoutHandler = setTimeout( + awaitWriteFinish, + this.options.awaitWriteFinish.pollInterval + ); + } +} + +_getGlobIgnored() { + return [...this._ignoredPaths.values()]; +} + +/** + * Determines whether user has asked to ignore this path. + * @param {Path} path filepath or dir + * @param {fs.Stats=} stats result of fs.stat + * @returns {Boolean} + */ +_isIgnored(path, stats) { + if (this.options.atomic && DOT_RE.test(path)) return true; + if (!this._userIgnored) { + const {cwd} = this.options; + const ign = this.options.ignored; + + const ignored = ign && ign.map(normalizeIgnored(cwd)); + const paths = arrify(ignored) + .filter((path) => typeof path === STRING_TYPE && !isGlob(path)) + .map((path) => path + SLASH_GLOBSTAR); + const list = this._getGlobIgnored().map(normalizeIgnored(cwd)).concat(ignored, paths); + this._userIgnored = anymatch(list, undefined, ANYMATCH_OPTS); + } + + return this._userIgnored([path, stats]); +} + +_isntIgnored(path, stat) { + return !this._isIgnored(path, stat); +} + +/** + * Provides a set of common helpers and properties relating to symlink and glob handling. + * @param {Path} path file, directory, or glob pattern being watched + * @param {Number=} depth at any depth > 0, this isn't a glob + * @returns {WatchHelper} object containing helpers for this path + */ +_getWatchHelpers(path, depth) { + const watchPath = depth || this.options.disableGlobbing || !isGlob(path) ? path : globParent(path); + const follow = this.options.followSymlinks; + + return new WatchHelper(path, watchPath, follow, this); +} + +// Directory helpers +// ----------------- + +/** + * Provides directory tracking objects + * @param {String} directory path of the directory + * @returns {DirEntry} the directory's tracking object + */ +_getWatchedDir(directory) { + if (!this._boundRemove) this._boundRemove = this._remove.bind(this); + const dir = sysPath.resolve(directory); + if (!this._watched.has(dir)) this._watched.set(dir, new DirEntry(dir, this._boundRemove)); + return this._watched.get(dir); +} + +// File helpers +// ------------ + +/** + * Check for read permissions. + * Based on this answer on SO: https://stackoverflow.com/a/11781404/1358405 + * @param {fs.Stats} stats - object, result of fs_stat + * @returns {Boolean} indicates whether the file can be read +*/ +_hasReadPermissions(stats) { + if (this.options.ignorePermissionErrors) return true; + + // stats.mode may be bigint + const md = stats && Number.parseInt(stats.mode, 10); + const st = md & 0o777; + const it = Number.parseInt(st.toString(8)[0], 10); + return Boolean(4 & it); +} + +/** + * Handles emitting unlink events for + * files and directories, and via recursion, for + * files and directories within directories that are unlinked + * @param {String} directory within which the following item is located + * @param {String} item base path of item/directory + * @returns {void} +*/ +_remove(directory, item, isDirectory) { + // if what is being deleted is a directory, get that directory's paths + // for recursive deleting and cleaning of watched object + // if it is not a directory, nestedDirectoryChildren will be empty array + const path = sysPath.join(directory, item); + const fullPath = sysPath.resolve(path); + isDirectory = isDirectory != null + ? isDirectory + : this._watched.has(path) || this._watched.has(fullPath); + + // prevent duplicate handling in case of arriving here nearly simultaneously + // via multiple paths (such as _handleFile and _handleDir) + if (!this._throttle('remove', path, 100)) return; + + // if the only watched file is removed, watch for its return + if (!isDirectory && !this.options.useFsEvents && this._watched.size === 1) { + this.add(directory, item, true); + } + + // This will create a new entry in the watched object in either case + // so we got to do the directory check beforehand + const wp = this._getWatchedDir(path); + const nestedDirectoryChildren = wp.getChildren(); + + // Recursively remove children directories / files. + nestedDirectoryChildren.forEach(nested => this._remove(path, nested)); + + // Check if item was on the watched list and remove it + const parent = this._getWatchedDir(directory); + const wasTracked = parent.has(item); + parent.remove(item); + + // Fixes issue #1042 -> Relative paths were detected and added as symlinks + // (https://github.com/paulmillr/chokidar/blob/e1753ddbc9571bdc33b4a4af172d52cb6e611c10/lib/nodefs-handler.js#L612), + // but never removed from the map in case the path was deleted. + // This leads to an incorrect state if the path was recreated: + // https://github.com/paulmillr/chokidar/blob/e1753ddbc9571bdc33b4a4af172d52cb6e611c10/lib/nodefs-handler.js#L553 + if (this._symlinkPaths.has(fullPath)) { + this._symlinkPaths.delete(fullPath); + } + + // If we wait for this file to be fully written, cancel the wait. + let relPath = path; + if (this.options.cwd) relPath = sysPath.relative(this.options.cwd, path); + if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) { + const event = this._pendingWrites.get(relPath).cancelWait(); + if (event === EV_ADD) return; + } + + // The Entry will either be a directory that just got removed + // or a bogus entry to a file, in either case we have to remove it + this._watched.delete(path); + this._watched.delete(fullPath); + const eventName = isDirectory ? EV_UNLINK_DIR : EV_UNLINK; + if (wasTracked && !this._isIgnored(path)) this._emit(eventName, path); + + // Avoid conflicts if we later create another file with the same name + if (!this.options.useFsEvents) { + this._closePath(path); + } +} + +/** + * Closes all watchers for a path + * @param {Path} path + */ +_closePath(path) { + this._closeFile(path) + const dir = sysPath.dirname(path); + this._getWatchedDir(dir).remove(sysPath.basename(path)); +} + +/** + * Closes only file-specific watchers + * @param {Path} path + */ +_closeFile(path) { + const closers = this._closers.get(path); + if (!closers) return; + closers.forEach(closer => closer()); + this._closers.delete(path); +} + +/** + * + * @param {Path} path + * @param {Function} closer + */ +_addPathCloser(path, closer) { + if (!closer) return; + let list = this._closers.get(path); + if (!list) { + list = []; + this._closers.set(path, list); + } + list.push(closer); +} + +_readdirp(root, opts) { + if (this.closed) return; + const options = {type: EV_ALL, alwaysStat: true, lstat: true, ...opts}; + let stream = readdirp(root, options); + this._streams.add(stream); + stream.once(STR_CLOSE, () => { + stream = undefined; + }); + stream.once(STR_END, () => { + if (stream) { + this._streams.delete(stream); + stream = undefined; + } + }); + return stream; +} + +} + +// Export FSWatcher class +exports.FSWatcher = FSWatcher; + +/** + * Instantiates watcher with paths to be tracked. + * @param {String|Array} paths file/directory paths and/or globs + * @param {Object=} options chokidar opts + * @returns an instance of FSWatcher for chaining. + */ +const watch = (paths, options) => { + const watcher = new FSWatcher(options); + watcher.add(paths); + return watcher; +}; + +exports.watch = watch; diff --git a/project starter code/node_modules/chokidar/lib/constants.js b/project starter code/node_modules/chokidar/lib/constants.js new file mode 100644 index 00000000..4743865d --- /dev/null +++ b/project starter code/node_modules/chokidar/lib/constants.js @@ -0,0 +1,66 @@ +'use strict'; + +const {sep} = require('path'); +const {platform} = process; +const os = require('os'); + +exports.EV_ALL = 'all'; +exports.EV_READY = 'ready'; +exports.EV_ADD = 'add'; +exports.EV_CHANGE = 'change'; +exports.EV_ADD_DIR = 'addDir'; +exports.EV_UNLINK = 'unlink'; +exports.EV_UNLINK_DIR = 'unlinkDir'; +exports.EV_RAW = 'raw'; +exports.EV_ERROR = 'error'; + +exports.STR_DATA = 'data'; +exports.STR_END = 'end'; +exports.STR_CLOSE = 'close'; + +exports.FSEVENT_CREATED = 'created'; +exports.FSEVENT_MODIFIED = 'modified'; +exports.FSEVENT_DELETED = 'deleted'; +exports.FSEVENT_MOVED = 'moved'; +exports.FSEVENT_CLONED = 'cloned'; +exports.FSEVENT_UNKNOWN = 'unknown'; +exports.FSEVENT_FLAG_MUST_SCAN_SUBDIRS = 1; +exports.FSEVENT_TYPE_FILE = 'file'; +exports.FSEVENT_TYPE_DIRECTORY = 'directory'; +exports.FSEVENT_TYPE_SYMLINK = 'symlink'; + +exports.KEY_LISTENERS = 'listeners'; +exports.KEY_ERR = 'errHandlers'; +exports.KEY_RAW = 'rawEmitters'; +exports.HANDLER_KEYS = [exports.KEY_LISTENERS, exports.KEY_ERR, exports.KEY_RAW]; + +exports.DOT_SLASH = `.${sep}`; + +exports.BACK_SLASH_RE = /\\/g; +exports.DOUBLE_SLASH_RE = /\/\//; +exports.SLASH_OR_BACK_SLASH_RE = /[/\\]/; +exports.DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/; +exports.REPLACER_RE = /^\.[/\\]/; + +exports.SLASH = '/'; +exports.SLASH_SLASH = '//'; +exports.BRACE_START = '{'; +exports.BANG = '!'; +exports.ONE_DOT = '.'; +exports.TWO_DOTS = '..'; +exports.STAR = '*'; +exports.GLOBSTAR = '**'; +exports.ROOT_GLOBSTAR = '/**/*'; +exports.SLASH_GLOBSTAR = '/**'; +exports.DIR_SUFFIX = 'Dir'; +exports.ANYMATCH_OPTS = {dot: true}; +exports.STRING_TYPE = 'string'; +exports.FUNCTION_TYPE = 'function'; +exports.EMPTY_STR = ''; +exports.EMPTY_FN = () => {}; +exports.IDENTITY_FN = val => val; + +exports.isWindows = platform === 'win32'; +exports.isMacos = platform === 'darwin'; +exports.isLinux = platform === 'linux'; +exports.isIBMi = os.type() === 'OS400'; diff --git a/project starter code/node_modules/chokidar/lib/fsevents-handler.js b/project starter code/node_modules/chokidar/lib/fsevents-handler.js new file mode 100644 index 00000000..fe29393c --- /dev/null +++ b/project starter code/node_modules/chokidar/lib/fsevents-handler.js @@ -0,0 +1,526 @@ +'use strict'; + +const fs = require('fs'); +const sysPath = require('path'); +const { promisify } = require('util'); + +let fsevents; +try { + fsevents = require('fsevents'); +} catch (error) { + if (process.env.CHOKIDAR_PRINT_FSEVENTS_REQUIRE_ERROR) console.error(error); +} + +if (fsevents) { + // TODO: real check + const mtch = process.version.match(/v(\d+)\.(\d+)/); + if (mtch && mtch[1] && mtch[2]) { + const maj = Number.parseInt(mtch[1], 10); + const min = Number.parseInt(mtch[2], 10); + if (maj === 8 && min < 16) { + fsevents = undefined; + } + } +} + +const { + EV_ADD, + EV_CHANGE, + EV_ADD_DIR, + EV_UNLINK, + EV_ERROR, + STR_DATA, + STR_END, + FSEVENT_CREATED, + FSEVENT_MODIFIED, + FSEVENT_DELETED, + FSEVENT_MOVED, + // FSEVENT_CLONED, + FSEVENT_UNKNOWN, + FSEVENT_FLAG_MUST_SCAN_SUBDIRS, + FSEVENT_TYPE_FILE, + FSEVENT_TYPE_DIRECTORY, + FSEVENT_TYPE_SYMLINK, + + ROOT_GLOBSTAR, + DIR_SUFFIX, + DOT_SLASH, + FUNCTION_TYPE, + EMPTY_FN, + IDENTITY_FN +} = require('./constants'); + +const Depth = (value) => isNaN(value) ? {} : {depth: value}; + +const stat = promisify(fs.stat); +const lstat = promisify(fs.lstat); +const realpath = promisify(fs.realpath); + +const statMethods = { stat, lstat }; + +/** + * @typedef {String} Path + */ + +/** + * @typedef {Object} FsEventsWatchContainer + * @property {Set} listeners + * @property {Function} rawEmitter + * @property {{stop: Function}} watcher + */ + +// fsevents instance helper functions +/** + * Object to hold per-process fsevents instances (may be shared across chokidar FSWatcher instances) + * @type {Map} + */ +const FSEventsWatchers = new Map(); + +// Threshold of duplicate path prefixes at which to start +// consolidating going forward +const consolidateThreshhold = 10; + +const wrongEventFlags = new Set([ + 69888, 70400, 71424, 72704, 73472, 131328, 131840, 262912 +]); + +/** + * Instantiates the fsevents interface + * @param {Path} path path to be watched + * @param {Function} callback called when fsevents is bound and ready + * @returns {{stop: Function}} new fsevents instance + */ +const createFSEventsInstance = (path, callback) => { + const stop = fsevents.watch(path, callback); + return {stop}; +}; + +/** + * Instantiates the fsevents interface or binds listeners to an existing one covering + * the same file tree. + * @param {Path} path - to be watched + * @param {Path} realPath - real path for symlinks + * @param {Function} listener - called when fsevents emits events + * @param {Function} rawEmitter - passes data to listeners of the 'raw' event + * @returns {Function} closer + */ +function setFSEventsListener(path, realPath, listener, rawEmitter) { + let watchPath = sysPath.extname(realPath) ? sysPath.dirname(realPath) : realPath; + + const parentPath = sysPath.dirname(watchPath); + let cont = FSEventsWatchers.get(watchPath); + + // If we've accumulated a substantial number of paths that + // could have been consolidated by watching one directory + // above the current one, create a watcher on the parent + // path instead, so that we do consolidate going forward. + if (couldConsolidate(parentPath)) { + watchPath = parentPath; + } + + const resolvedPath = sysPath.resolve(path); + const hasSymlink = resolvedPath !== realPath; + + const filteredListener = (fullPath, flags, info) => { + if (hasSymlink) fullPath = fullPath.replace(realPath, resolvedPath); + if ( + fullPath === resolvedPath || + !fullPath.indexOf(resolvedPath + sysPath.sep) + ) listener(fullPath, flags, info); + }; + + // check if there is already a watcher on a parent path + // modifies `watchPath` to the parent path when it finds a match + let watchedParent = false; + for (const watchedPath of FSEventsWatchers.keys()) { + if (realPath.indexOf(sysPath.resolve(watchedPath) + sysPath.sep) === 0) { + watchPath = watchedPath; + cont = FSEventsWatchers.get(watchPath); + watchedParent = true; + break; + } + } + + if (cont || watchedParent) { + cont.listeners.add(filteredListener); + } else { + cont = { + listeners: new Set([filteredListener]), + rawEmitter, + watcher: createFSEventsInstance(watchPath, (fullPath, flags) => { + if (!cont.listeners.size) return; + if (flags & FSEVENT_FLAG_MUST_SCAN_SUBDIRS) return; + const info = fsevents.getInfo(fullPath, flags); + cont.listeners.forEach(list => { + list(fullPath, flags, info); + }); + + cont.rawEmitter(info.event, fullPath, info); + }) + }; + FSEventsWatchers.set(watchPath, cont); + } + + // removes this instance's listeners and closes the underlying fsevents + // instance if there are no more listeners left + return () => { + const lst = cont.listeners; + + lst.delete(filteredListener); + if (!lst.size) { + FSEventsWatchers.delete(watchPath); + if (cont.watcher) return cont.watcher.stop().then(() => { + cont.rawEmitter = cont.watcher = undefined; + Object.freeze(cont); + }); + } + }; +} + +// Decide whether or not we should start a new higher-level +// parent watcher +const couldConsolidate = (path) => { + let count = 0; + for (const watchPath of FSEventsWatchers.keys()) { + if (watchPath.indexOf(path) === 0) { + count++; + if (count >= consolidateThreshhold) { + return true; + } + } + } + + return false; +}; + +// returns boolean indicating whether fsevents can be used +const canUse = () => fsevents && FSEventsWatchers.size < 128; + +// determines subdirectory traversal levels from root to path +const calcDepth = (path, root) => { + let i = 0; + while (!path.indexOf(root) && (path = sysPath.dirname(path)) !== root) i++; + return i; +}; + +// returns boolean indicating whether the fsevents' event info has the same type +// as the one returned by fs.stat +const sameTypes = (info, stats) => ( + info.type === FSEVENT_TYPE_DIRECTORY && stats.isDirectory() || + info.type === FSEVENT_TYPE_SYMLINK && stats.isSymbolicLink() || + info.type === FSEVENT_TYPE_FILE && stats.isFile() +) + +/** + * @mixin + */ +class FsEventsHandler { + +/** + * @param {import('../index').FSWatcher} fsw + */ +constructor(fsw) { + this.fsw = fsw; +} +checkIgnored(path, stats) { + const ipaths = this.fsw._ignoredPaths; + if (this.fsw._isIgnored(path, stats)) { + ipaths.add(path); + if (stats && stats.isDirectory()) { + ipaths.add(path + ROOT_GLOBSTAR); + } + return true; + } + + ipaths.delete(path); + ipaths.delete(path + ROOT_GLOBSTAR); +} + +addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts) { + const event = watchedDir.has(item) ? EV_CHANGE : EV_ADD; + this.handleEvent(event, path, fullPath, realPath, parent, watchedDir, item, info, opts); +} + +async checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts) { + try { + const stats = await stat(path) + if (this.fsw.closed) return; + if (sameTypes(info, stats)) { + this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); + } else { + this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts); + } + } catch (error) { + if (error.code === 'EACCES') { + this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); + } else { + this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts); + } + } +} + +handleEvent(event, path, fullPath, realPath, parent, watchedDir, item, info, opts) { + if (this.fsw.closed || this.checkIgnored(path)) return; + + if (event === EV_UNLINK) { + const isDirectory = info.type === FSEVENT_TYPE_DIRECTORY + // suppress unlink events on never before seen files + if (isDirectory || watchedDir.has(item)) { + this.fsw._remove(parent, item, isDirectory); + } + } else { + if (event === EV_ADD) { + // track new directories + if (info.type === FSEVENT_TYPE_DIRECTORY) this.fsw._getWatchedDir(path); + + if (info.type === FSEVENT_TYPE_SYMLINK && opts.followSymlinks) { + // push symlinks back to the top of the stack to get handled + const curDepth = opts.depth === undefined ? + undefined : calcDepth(fullPath, realPath) + 1; + return this._addToFsEvents(path, false, true, curDepth); + } + + // track new paths + // (other than symlinks being followed, which will be tracked soon) + this.fsw._getWatchedDir(parent).add(item); + } + /** + * @type {'add'|'addDir'|'unlink'|'unlinkDir'} + */ + const eventName = info.type === FSEVENT_TYPE_DIRECTORY ? event + DIR_SUFFIX : event; + this.fsw._emit(eventName, path); + if (eventName === EV_ADD_DIR) this._addToFsEvents(path, false, true); + } +} + +/** + * Handle symlinks encountered during directory scan + * @param {String} watchPath - file/dir path to be watched with fsevents + * @param {String} realPath - real path (in case of symlinks) + * @param {Function} transform - path transformer + * @param {Function} globFilter - path filter in case a glob pattern was provided + * @returns {Function} closer for the watcher instance +*/ +_watchWithFsEvents(watchPath, realPath, transform, globFilter) { + if (this.fsw.closed || this.fsw._isIgnored(watchPath)) return; + const opts = this.fsw.options; + const watchCallback = async (fullPath, flags, info) => { + if (this.fsw.closed) return; + if ( + opts.depth !== undefined && + calcDepth(fullPath, realPath) > opts.depth + ) return; + const path = transform(sysPath.join( + watchPath, sysPath.relative(watchPath, fullPath) + )); + if (globFilter && !globFilter(path)) return; + // ensure directories are tracked + const parent = sysPath.dirname(path); + const item = sysPath.basename(path); + const watchedDir = this.fsw._getWatchedDir( + info.type === FSEVENT_TYPE_DIRECTORY ? path : parent + ); + + // correct for wrong events emitted + if (wrongEventFlags.has(flags) || info.event === FSEVENT_UNKNOWN) { + if (typeof opts.ignored === FUNCTION_TYPE) { + let stats; + try { + stats = await stat(path); + } catch (error) {} + if (this.fsw.closed) return; + if (this.checkIgnored(path, stats)) return; + if (sameTypes(info, stats)) { + this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); + } else { + this.handleEvent(EV_UNLINK, path, fullPath, realPath, parent, watchedDir, item, info, opts); + } + } else { + this.checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts); + } + } else { + switch (info.event) { + case FSEVENT_CREATED: + case FSEVENT_MODIFIED: + return this.addOrChange(path, fullPath, realPath, parent, watchedDir, item, info, opts); + case FSEVENT_DELETED: + case FSEVENT_MOVED: + return this.checkExists(path, fullPath, realPath, parent, watchedDir, item, info, opts); + } + } + }; + + const closer = setFSEventsListener( + watchPath, + realPath, + watchCallback, + this.fsw._emitRaw + ); + + this.fsw._emitReady(); + return closer; +} + +/** + * Handle symlinks encountered during directory scan + * @param {String} linkPath path to symlink + * @param {String} fullPath absolute path to the symlink + * @param {Function} transform pre-existing path transformer + * @param {Number} curDepth level of subdirectories traversed to where symlink is + * @returns {Promise} + */ +async _handleFsEventsSymlink(linkPath, fullPath, transform, curDepth) { + // don't follow the same symlink more than once + if (this.fsw.closed || this.fsw._symlinkPaths.has(fullPath)) return; + + this.fsw._symlinkPaths.set(fullPath, true); + this.fsw._incrReadyCount(); + + try { + const linkTarget = await realpath(linkPath); + if (this.fsw.closed) return; + if (this.fsw._isIgnored(linkTarget)) { + return this.fsw._emitReady(); + } + + this.fsw._incrReadyCount(); + + // add the linkTarget for watching with a wrapper for transform + // that causes emitted paths to incorporate the link's path + this._addToFsEvents(linkTarget || linkPath, (path) => { + let aliasedPath = linkPath; + if (linkTarget && linkTarget !== DOT_SLASH) { + aliasedPath = path.replace(linkTarget, linkPath); + } else if (path !== DOT_SLASH) { + aliasedPath = sysPath.join(linkPath, path); + } + return transform(aliasedPath); + }, false, curDepth); + } catch(error) { + if (this.fsw._handleError(error)) { + return this.fsw._emitReady(); + } + } +} + +/** + * + * @param {Path} newPath + * @param {fs.Stats} stats + */ +emitAdd(newPath, stats, processPath, opts, forceAdd) { + const pp = processPath(newPath); + const isDir = stats.isDirectory(); + const dirObj = this.fsw._getWatchedDir(sysPath.dirname(pp)); + const base = sysPath.basename(pp); + + // ensure empty dirs get tracked + if (isDir) this.fsw._getWatchedDir(pp); + if (dirObj.has(base)) return; + dirObj.add(base); + + if (!opts.ignoreInitial || forceAdd === true) { + this.fsw._emit(isDir ? EV_ADD_DIR : EV_ADD, pp, stats); + } +} + +initWatch(realPath, path, wh, processPath) { + if (this.fsw.closed) return; + const closer = this._watchWithFsEvents( + wh.watchPath, + sysPath.resolve(realPath || wh.watchPath), + processPath, + wh.globFilter + ); + this.fsw._addPathCloser(path, closer); +} + +/** + * Handle added path with fsevents + * @param {String} path file/dir path or glob pattern + * @param {Function|Boolean=} transform converts working path to what the user expects + * @param {Boolean=} forceAdd ensure add is emitted + * @param {Number=} priorDepth Level of subdirectories already traversed. + * @returns {Promise} + */ +async _addToFsEvents(path, transform, forceAdd, priorDepth) { + if (this.fsw.closed) { + return; + } + const opts = this.fsw.options; + const processPath = typeof transform === FUNCTION_TYPE ? transform : IDENTITY_FN; + + const wh = this.fsw._getWatchHelpers(path); + + // evaluate what is at the path we're being asked to watch + try { + const stats = await statMethods[wh.statMethod](wh.watchPath); + if (this.fsw.closed) return; + if (this.fsw._isIgnored(wh.watchPath, stats)) { + throw null; + } + if (stats.isDirectory()) { + // emit addDir unless this is a glob parent + if (!wh.globFilter) this.emitAdd(processPath(path), stats, processPath, opts, forceAdd); + + // don't recurse further if it would exceed depth setting + if (priorDepth && priorDepth > opts.depth) return; + + // scan the contents of the dir + this.fsw._readdirp(wh.watchPath, { + fileFilter: entry => wh.filterPath(entry), + directoryFilter: entry => wh.filterDir(entry), + ...Depth(opts.depth - (priorDepth || 0)) + }).on(STR_DATA, (entry) => { + // need to check filterPath on dirs b/c filterDir is less restrictive + if (this.fsw.closed) { + return; + } + if (entry.stats.isDirectory() && !wh.filterPath(entry)) return; + + const joinedPath = sysPath.join(wh.watchPath, entry.path); + const {fullPath} = entry; + + if (wh.followSymlinks && entry.stats.isSymbolicLink()) { + // preserve the current depth here since it can't be derived from + // real paths past the symlink + const curDepth = opts.depth === undefined ? + undefined : calcDepth(joinedPath, sysPath.resolve(wh.watchPath)) + 1; + + this._handleFsEventsSymlink(joinedPath, fullPath, processPath, curDepth); + } else { + this.emitAdd(joinedPath, entry.stats, processPath, opts, forceAdd); + } + }).on(EV_ERROR, EMPTY_FN).on(STR_END, () => { + this.fsw._emitReady(); + }); + } else { + this.emitAdd(wh.watchPath, stats, processPath, opts, forceAdd); + this.fsw._emitReady(); + } + } catch (error) { + if (!error || this.fsw._handleError(error)) { + // TODO: Strange thing: "should not choke on an ignored watch path" will be failed without 2 ready calls -__- + this.fsw._emitReady(); + this.fsw._emitReady(); + } + } + + if (opts.persistent && forceAdd !== true) { + if (typeof transform === FUNCTION_TYPE) { + // realpath has already been resolved + this.initWatch(undefined, path, wh, processPath); + } else { + let realPath; + try { + realPath = await realpath(wh.watchPath); + } catch (e) {} + this.initWatch(realPath, path, wh, processPath); + } + } +} + +} + +module.exports = FsEventsHandler; +module.exports.canUse = canUse; diff --git a/project starter code/node_modules/chokidar/lib/nodefs-handler.js b/project starter code/node_modules/chokidar/lib/nodefs-handler.js new file mode 100644 index 00000000..199cfe9f --- /dev/null +++ b/project starter code/node_modules/chokidar/lib/nodefs-handler.js @@ -0,0 +1,654 @@ +'use strict'; + +const fs = require('fs'); +const sysPath = require('path'); +const { promisify } = require('util'); +const isBinaryPath = require('is-binary-path'); +const { + isWindows, + isLinux, + EMPTY_FN, + EMPTY_STR, + KEY_LISTENERS, + KEY_ERR, + KEY_RAW, + HANDLER_KEYS, + EV_CHANGE, + EV_ADD, + EV_ADD_DIR, + EV_ERROR, + STR_DATA, + STR_END, + BRACE_START, + STAR +} = require('./constants'); + +const THROTTLE_MODE_WATCH = 'watch'; + +const open = promisify(fs.open); +const stat = promisify(fs.stat); +const lstat = promisify(fs.lstat); +const close = promisify(fs.close); +const fsrealpath = promisify(fs.realpath); + +const statMethods = { lstat, stat }; + +// TODO: emit errors properly. Example: EMFILE on Macos. +const foreach = (val, fn) => { + if (val instanceof Set) { + val.forEach(fn); + } else { + fn(val); + } +}; + +const addAndConvert = (main, prop, item) => { + let container = main[prop]; + if (!(container instanceof Set)) { + main[prop] = container = new Set([container]); + } + container.add(item); +}; + +const clearItem = cont => key => { + const set = cont[key]; + if (set instanceof Set) { + set.clear(); + } else { + delete cont[key]; + } +}; + +const delFromSet = (main, prop, item) => { + const container = main[prop]; + if (container instanceof Set) { + container.delete(item); + } else if (container === item) { + delete main[prop]; + } +}; + +const isEmptySet = (val) => val instanceof Set ? val.size === 0 : !val; + +/** + * @typedef {String} Path + */ + +// fs_watch helpers + +// object to hold per-process fs_watch instances +// (may be shared across chokidar FSWatcher instances) + +/** + * @typedef {Object} FsWatchContainer + * @property {Set} listeners + * @property {Set} errHandlers + * @property {Set} rawEmitters + * @property {fs.FSWatcher=} watcher + * @property {Boolean=} watcherUnusable + */ + +/** + * @type {Map} + */ +const FsWatchInstances = new Map(); + +/** + * Instantiates the fs_watch interface + * @param {String} path to be watched + * @param {Object} options to be passed to fs_watch + * @param {Function} listener main event handler + * @param {Function} errHandler emits info about errors + * @param {Function} emitRaw emits raw event data + * @returns {fs.FSWatcher} new fsevents instance + */ +function createFsWatchInstance(path, options, listener, errHandler, emitRaw) { + const handleEvent = (rawEvent, evPath) => { + listener(path); + emitRaw(rawEvent, evPath, {watchedPath: path}); + + // emit based on events occurring for files from a directory's watcher in + // case the file's watcher misses it (and rely on throttling to de-dupe) + if (evPath && path !== evPath) { + fsWatchBroadcast( + sysPath.resolve(path, evPath), KEY_LISTENERS, sysPath.join(path, evPath) + ); + } + }; + try { + return fs.watch(path, options, handleEvent); + } catch (error) { + errHandler(error); + } +} + +/** + * Helper for passing fs_watch event data to a collection of listeners + * @param {Path} fullPath absolute path bound to fs_watch instance + * @param {String} type listener type + * @param {*=} val1 arguments to be passed to listeners + * @param {*=} val2 + * @param {*=} val3 + */ +const fsWatchBroadcast = (fullPath, type, val1, val2, val3) => { + const cont = FsWatchInstances.get(fullPath); + if (!cont) return; + foreach(cont[type], (listener) => { + listener(val1, val2, val3); + }); +}; + +/** + * Instantiates the fs_watch interface or binds listeners + * to an existing one covering the same file system entry + * @param {String} path + * @param {String} fullPath absolute path + * @param {Object} options to be passed to fs_watch + * @param {Object} handlers container for event listener functions + */ +const setFsWatchListener = (path, fullPath, options, handlers) => { + const {listener, errHandler, rawEmitter} = handlers; + let cont = FsWatchInstances.get(fullPath); + + /** @type {fs.FSWatcher=} */ + let watcher; + if (!options.persistent) { + watcher = createFsWatchInstance( + path, options, listener, errHandler, rawEmitter + ); + return watcher.close.bind(watcher); + } + if (cont) { + addAndConvert(cont, KEY_LISTENERS, listener); + addAndConvert(cont, KEY_ERR, errHandler); + addAndConvert(cont, KEY_RAW, rawEmitter); + } else { + watcher = createFsWatchInstance( + path, + options, + fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS), + errHandler, // no need to use broadcast here + fsWatchBroadcast.bind(null, fullPath, KEY_RAW) + ); + if (!watcher) return; + watcher.on(EV_ERROR, async (error) => { + const broadcastErr = fsWatchBroadcast.bind(null, fullPath, KEY_ERR); + cont.watcherUnusable = true; // documented since Node 10.4.1 + // Workaround for https://github.com/joyent/node/issues/4337 + if (isWindows && error.code === 'EPERM') { + try { + const fd = await open(path, 'r'); + await close(fd); + broadcastErr(error); + } catch (err) {} + } else { + broadcastErr(error); + } + }); + cont = { + listeners: listener, + errHandlers: errHandler, + rawEmitters: rawEmitter, + watcher + }; + FsWatchInstances.set(fullPath, cont); + } + // const index = cont.listeners.indexOf(listener); + + // removes this instance's listeners and closes the underlying fs_watch + // instance if there are no more listeners left + return () => { + delFromSet(cont, KEY_LISTENERS, listener); + delFromSet(cont, KEY_ERR, errHandler); + delFromSet(cont, KEY_RAW, rawEmitter); + if (isEmptySet(cont.listeners)) { + // Check to protect against issue gh-730. + // if (cont.watcherUnusable) { + cont.watcher.close(); + // } + FsWatchInstances.delete(fullPath); + HANDLER_KEYS.forEach(clearItem(cont)); + cont.watcher = undefined; + Object.freeze(cont); + } + }; +}; + +// fs_watchFile helpers + +// object to hold per-process fs_watchFile instances +// (may be shared across chokidar FSWatcher instances) +const FsWatchFileInstances = new Map(); + +/** + * Instantiates the fs_watchFile interface or binds listeners + * to an existing one covering the same file system entry + * @param {String} path to be watched + * @param {String} fullPath absolute path + * @param {Object} options options to be passed to fs_watchFile + * @param {Object} handlers container for event listener functions + * @returns {Function} closer + */ +const setFsWatchFileListener = (path, fullPath, options, handlers) => { + const {listener, rawEmitter} = handlers; + let cont = FsWatchFileInstances.get(fullPath); + + /* eslint-disable no-unused-vars, prefer-destructuring */ + let listeners = new Set(); + let rawEmitters = new Set(); + + const copts = cont && cont.options; + if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) { + // "Upgrade" the watcher to persistence or a quicker interval. + // This creates some unlikely edge case issues if the user mixes + // settings in a very weird way, but solving for those cases + // doesn't seem worthwhile for the added complexity. + listeners = cont.listeners; + rawEmitters = cont.rawEmitters; + fs.unwatchFile(fullPath); + cont = undefined; + } + + /* eslint-enable no-unused-vars, prefer-destructuring */ + + if (cont) { + addAndConvert(cont, KEY_LISTENERS, listener); + addAndConvert(cont, KEY_RAW, rawEmitter); + } else { + // TODO + // listeners.add(listener); + // rawEmitters.add(rawEmitter); + cont = { + listeners: listener, + rawEmitters: rawEmitter, + options, + watcher: fs.watchFile(fullPath, options, (curr, prev) => { + foreach(cont.rawEmitters, (rawEmitter) => { + rawEmitter(EV_CHANGE, fullPath, {curr, prev}); + }); + const currmtime = curr.mtimeMs; + if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) { + foreach(cont.listeners, (listener) => listener(path, curr)); + } + }) + }; + FsWatchFileInstances.set(fullPath, cont); + } + // const index = cont.listeners.indexOf(listener); + + // Removes this instance's listeners and closes the underlying fs_watchFile + // instance if there are no more listeners left. + return () => { + delFromSet(cont, KEY_LISTENERS, listener); + delFromSet(cont, KEY_RAW, rawEmitter); + if (isEmptySet(cont.listeners)) { + FsWatchFileInstances.delete(fullPath); + fs.unwatchFile(fullPath); + cont.options = cont.watcher = undefined; + Object.freeze(cont); + } + }; +}; + +/** + * @mixin + */ +class NodeFsHandler { + +/** + * @param {import("../index").FSWatcher} fsW + */ +constructor(fsW) { + this.fsw = fsW; + this._boundHandleError = (error) => fsW._handleError(error); +} + +/** + * Watch file for changes with fs_watchFile or fs_watch. + * @param {String} path to file or dir + * @param {Function} listener on fs change + * @returns {Function} closer for the watcher instance + */ +_watchWithNodeFs(path, listener) { + const opts = this.fsw.options; + const directory = sysPath.dirname(path); + const basename = sysPath.basename(path); + const parent = this.fsw._getWatchedDir(directory); + parent.add(basename); + const absolutePath = sysPath.resolve(path); + const options = {persistent: opts.persistent}; + if (!listener) listener = EMPTY_FN; + + let closer; + if (opts.usePolling) { + options.interval = opts.enableBinaryInterval && isBinaryPath(basename) ? + opts.binaryInterval : opts.interval; + closer = setFsWatchFileListener(path, absolutePath, options, { + listener, + rawEmitter: this.fsw._emitRaw + }); + } else { + closer = setFsWatchListener(path, absolutePath, options, { + listener, + errHandler: this._boundHandleError, + rawEmitter: this.fsw._emitRaw + }); + } + return closer; +} + +/** + * Watch a file and emit add event if warranted. + * @param {Path} file Path + * @param {fs.Stats} stats result of fs_stat + * @param {Boolean} initialAdd was the file added at watch instantiation? + * @returns {Function} closer for the watcher instance + */ +_handleFile(file, stats, initialAdd) { + if (this.fsw.closed) { + return; + } + const dirname = sysPath.dirname(file); + const basename = sysPath.basename(file); + const parent = this.fsw._getWatchedDir(dirname); + // stats is always present + let prevStats = stats; + + // if the file is already being watched, do nothing + if (parent.has(basename)) return; + + const listener = async (path, newStats) => { + if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5)) return; + if (!newStats || newStats.mtimeMs === 0) { + try { + const newStats = await stat(file); + if (this.fsw.closed) return; + // Check that change event was not fired because of changed only accessTime. + const at = newStats.atimeMs; + const mt = newStats.mtimeMs; + if (!at || at <= mt || mt !== prevStats.mtimeMs) { + this.fsw._emit(EV_CHANGE, file, newStats); + } + if (isLinux && prevStats.ino !== newStats.ino) { + this.fsw._closeFile(path) + prevStats = newStats; + this.fsw._addPathCloser(path, this._watchWithNodeFs(file, listener)); + } else { + prevStats = newStats; + } + } catch (error) { + // Fix issues where mtime is null but file is still present + this.fsw._remove(dirname, basename); + } + // add is about to be emitted if file not already tracked in parent + } else if (parent.has(basename)) { + // Check that change event was not fired because of changed only accessTime. + const at = newStats.atimeMs; + const mt = newStats.mtimeMs; + if (!at || at <= mt || mt !== prevStats.mtimeMs) { + this.fsw._emit(EV_CHANGE, file, newStats); + } + prevStats = newStats; + } + } + // kick off the watcher + const closer = this._watchWithNodeFs(file, listener); + + // emit an add event if we're supposed to + if (!(initialAdd && this.fsw.options.ignoreInitial) && this.fsw._isntIgnored(file)) { + if (!this.fsw._throttle(EV_ADD, file, 0)) return; + this.fsw._emit(EV_ADD, file, stats); + } + + return closer; +} + +/** + * Handle symlinks encountered while reading a dir. + * @param {Object} entry returned by readdirp + * @param {String} directory path of dir being read + * @param {String} path of this item + * @param {String} item basename of this item + * @returns {Promise} true if no more processing is needed for this entry. + */ +async _handleSymlink(entry, directory, path, item) { + if (this.fsw.closed) { + return; + } + const full = entry.fullPath; + const dir = this.fsw._getWatchedDir(directory); + + if (!this.fsw.options.followSymlinks) { + // watch symlink directly (don't follow) and detect changes + this.fsw._incrReadyCount(); + + let linkPath; + try { + linkPath = await fsrealpath(path); + } catch (e) { + this.fsw._emitReady(); + return true; + } + + if (this.fsw.closed) return; + if (dir.has(item)) { + if (this.fsw._symlinkPaths.get(full) !== linkPath) { + this.fsw._symlinkPaths.set(full, linkPath); + this.fsw._emit(EV_CHANGE, path, entry.stats); + } + } else { + dir.add(item); + this.fsw._symlinkPaths.set(full, linkPath); + this.fsw._emit(EV_ADD, path, entry.stats); + } + this.fsw._emitReady(); + return true; + } + + // don't follow the same symlink more than once + if (this.fsw._symlinkPaths.has(full)) { + return true; + } + + this.fsw._symlinkPaths.set(full, true); +} + +_handleRead(directory, initialAdd, wh, target, dir, depth, throttler) { + // Normalize the directory name on Windows + directory = sysPath.join(directory, EMPTY_STR); + + if (!wh.hasGlob) { + throttler = this.fsw._throttle('readdir', directory, 1000); + if (!throttler) return; + } + + const previous = this.fsw._getWatchedDir(wh.path); + const current = new Set(); + + let stream = this.fsw._readdirp(directory, { + fileFilter: entry => wh.filterPath(entry), + directoryFilter: entry => wh.filterDir(entry), + depth: 0 + }).on(STR_DATA, async (entry) => { + if (this.fsw.closed) { + stream = undefined; + return; + } + const item = entry.path; + let path = sysPath.join(directory, item); + current.add(item); + + if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path, item)) { + return; + } + + if (this.fsw.closed) { + stream = undefined; + return; + } + // Files that present in current directory snapshot + // but absent in previous are added to watch list and + // emit `add` event. + if (item === target || !target && !previous.has(item)) { + this.fsw._incrReadyCount(); + + // ensure relativeness of path is preserved in case of watcher reuse + path = sysPath.join(dir, sysPath.relative(dir, path)); + + this._addToNodeFs(path, initialAdd, wh, depth + 1); + } + }).on(EV_ERROR, this._boundHandleError); + + return new Promise(resolve => + stream.once(STR_END, () => { + if (this.fsw.closed) { + stream = undefined; + return; + } + const wasThrottled = throttler ? throttler.clear() : false; + + resolve(); + + // Files that absent in current directory snapshot + // but present in previous emit `remove` event + // and are removed from @watched[directory]. + previous.getChildren().filter((item) => { + return item !== directory && + !current.has(item) && + // in case of intersecting globs; + // a path may have been filtered out of this readdir, but + // shouldn't be removed because it matches a different glob + (!wh.hasGlob || wh.filterPath({ + fullPath: sysPath.resolve(directory, item) + })); + }).forEach((item) => { + this.fsw._remove(directory, item); + }); + + stream = undefined; + + // one more time for any missed in case changes came in extremely quickly + if (wasThrottled) this._handleRead(directory, false, wh, target, dir, depth, throttler); + }) + ); +} + +/** + * Read directory to add / remove files from `@watched` list and re-read it on change. + * @param {String} dir fs path + * @param {fs.Stats} stats + * @param {Boolean} initialAdd + * @param {Number} depth relative to user-supplied path + * @param {String} target child path targeted for watch + * @param {Object} wh Common watch helpers for this path + * @param {String} realpath + * @returns {Promise} closer for the watcher instance. + */ +async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath) { + const parentDir = this.fsw._getWatchedDir(sysPath.dirname(dir)); + const tracked = parentDir.has(sysPath.basename(dir)); + if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) { + if (!wh.hasGlob || wh.globFilter(dir)) this.fsw._emit(EV_ADD_DIR, dir, stats); + } + + // ensure dir is tracked (harmless if redundant) + parentDir.add(sysPath.basename(dir)); + this.fsw._getWatchedDir(dir); + let throttler; + let closer; + + const oDepth = this.fsw.options.depth; + if ((oDepth == null || depth <= oDepth) && !this.fsw._symlinkPaths.has(realpath)) { + if (!target) { + await this._handleRead(dir, initialAdd, wh, target, dir, depth, throttler); + if (this.fsw.closed) return; + } + + closer = this._watchWithNodeFs(dir, (dirPath, stats) => { + // if current directory is removed, do nothing + if (stats && stats.mtimeMs === 0) return; + + this._handleRead(dirPath, false, wh, target, dir, depth, throttler); + }); + } + return closer; +} + +/** + * Handle added file, directory, or glob pattern. + * Delegates call to _handleFile / _handleDir after checks. + * @param {String} path to file or ir + * @param {Boolean} initialAdd was the file added at watch instantiation? + * @param {Object} priorWh depth relative to user-supplied path + * @param {Number} depth Child path actually targeted for watch + * @param {String=} target Child path actually targeted for watch + * @returns {Promise} + */ +async _addToNodeFs(path, initialAdd, priorWh, depth, target) { + const ready = this.fsw._emitReady; + if (this.fsw._isIgnored(path) || this.fsw.closed) { + ready(); + return false; + } + + const wh = this.fsw._getWatchHelpers(path, depth); + if (!wh.hasGlob && priorWh) { + wh.hasGlob = priorWh.hasGlob; + wh.globFilter = priorWh.globFilter; + wh.filterPath = entry => priorWh.filterPath(entry); + wh.filterDir = entry => priorWh.filterDir(entry); + } + + // evaluate what is at the path we're being asked to watch + try { + const stats = await statMethods[wh.statMethod](wh.watchPath); + if (this.fsw.closed) return; + if (this.fsw._isIgnored(wh.watchPath, stats)) { + ready(); + return false; + } + + const follow = this.fsw.options.followSymlinks && !path.includes(STAR) && !path.includes(BRACE_START); + let closer; + if (stats.isDirectory()) { + const absPath = sysPath.resolve(path); + const targetPath = follow ? await fsrealpath(path) : path; + if (this.fsw.closed) return; + closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath); + if (this.fsw.closed) return; + // preserve this symlink's target path + if (absPath !== targetPath && targetPath !== undefined) { + this.fsw._symlinkPaths.set(absPath, targetPath); + } + } else if (stats.isSymbolicLink()) { + const targetPath = follow ? await fsrealpath(path) : path; + if (this.fsw.closed) return; + const parent = sysPath.dirname(wh.watchPath); + this.fsw._getWatchedDir(parent).add(wh.watchPath); + this.fsw._emit(EV_ADD, wh.watchPath, stats); + closer = await this._handleDir(parent, stats, initialAdd, depth, path, wh, targetPath); + if (this.fsw.closed) return; + + // preserve this symlink's target path + if (targetPath !== undefined) { + this.fsw._symlinkPaths.set(sysPath.resolve(path), targetPath); + } + } else { + closer = this._handleFile(wh.watchPath, stats, initialAdd); + } + ready(); + + this.fsw._addPathCloser(path, closer); + return false; + + } catch (error) { + if (this.fsw._handleError(error)) { + ready(); + return path; + } + } +} + +} + +module.exports = NodeFsHandler; diff --git a/project starter code/node_modules/chokidar/package.json b/project starter code/node_modules/chokidar/package.json new file mode 100644 index 00000000..e8f8b3d9 --- /dev/null +++ b/project starter code/node_modules/chokidar/package.json @@ -0,0 +1,70 @@ +{ + "name": "chokidar", + "description": "Minimal and efficient cross-platform file watching library", + "version": "3.6.0", + "homepage": "https://github.com/paulmillr/chokidar", + "author": "Paul Miller (https://paulmillr.com)", + "contributors": [ + "Paul Miller (https://paulmillr.com)", + "Elan Shanker" + ], + "engines": { + "node": ">= 8.10.0" + }, + "main": "index.js", + "types": "./types/index.d.ts", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + }, + "devDependencies": { + "@types/node": "^14", + "chai": "^4.3", + "dtslint": "^3.3.0", + "eslint": "^7.0.0", + "mocha": "^7.0.0", + "rimraf": "^3.0.0", + "sinon": "^9.0.1", + "sinon-chai": "^3.3.0", + "typescript": "^4.4.3", + "upath": "^1.2.0" + }, + "files": [ + "index.js", + "lib/*.js", + "types/index.d.ts" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/paulmillr/chokidar.git" + }, + "bugs": { + "url": "https://github.com/paulmillr/chokidar/issues" + }, + "license": "MIT", + "scripts": { + "dtslint": "dtslint types", + "lint": "eslint --report-unused-disable-directives --ignore-path .gitignore .", + "build": "npm ls", + "mocha": "mocha --exit --timeout 90000", + "test": "npm run lint && npm run mocha" + }, + "keywords": [ + "fs", + "watch", + "watchFile", + "watcher", + "watching", + "file", + "fsevents" + ], + "funding": "https://paulmillr.com/funding/" +} diff --git a/project starter code/node_modules/chokidar/types/index.d.ts b/project starter code/node_modules/chokidar/types/index.d.ts new file mode 100644 index 00000000..45580663 --- /dev/null +++ b/project starter code/node_modules/chokidar/types/index.d.ts @@ -0,0 +1,192 @@ +// TypeScript Version: 3.0 + +/// + +import * as fs from "fs"; +import { EventEmitter } from "events"; +import { Matcher } from 'anymatch'; + +export class FSWatcher extends EventEmitter implements fs.FSWatcher { + options: WatchOptions; + + /** + * Constructs a new FSWatcher instance with optional WatchOptions parameter. + */ + constructor(options?: WatchOptions); + + /** + * Add files, directories, or glob patterns for tracking. Takes an array of strings or just one + * string. + */ + add(paths: string | ReadonlyArray): this; + + /** + * Stop watching files, directories, or glob patterns. Takes an array of strings or just one + * string. + */ + unwatch(paths: string | ReadonlyArray): this; + + /** + * Returns an object representing all the paths on the file system being watched by this + * `FSWatcher` instance. The object's keys are all the directories (using absolute paths unless + * the `cwd` option was used), and the values are arrays of the names of the items contained in + * each directory. + */ + getWatched(): { + [directory: string]: string[]; + }; + + /** + * Removes all listeners from watched files. + */ + close(): Promise; + + on(event: 'add'|'addDir'|'change', listener: (path: string, stats?: fs.Stats) => void): this; + + on(event: 'all', listener: (eventName: 'add'|'addDir'|'change'|'unlink'|'unlinkDir', path: string, stats?: fs.Stats) => void): this; + + /** + * Error occurred + */ + on(event: 'error', listener: (error: Error) => void): this; + + /** + * Exposes the native Node `fs.FSWatcher events` + */ + on(event: 'raw', listener: (eventName: string, path: string, details: any) => void): this; + + /** + * Fires when the initial scan is complete + */ + on(event: 'ready', listener: () => void): this; + + on(event: 'unlink'|'unlinkDir', listener: (path: string) => void): this; + + on(event: string, listener: (...args: any[]) => void): this; + + ref(): this; + + unref(): this; +} + +export interface WatchOptions { + /** + * Indicates whether the process should continue to run as long as files are being watched. If + * set to `false` when using `fsevents` to watch, no more events will be emitted after `ready`, + * even if the process continues to run. + */ + persistent?: boolean; + + /** + * ([anymatch](https://github.com/micromatch/anymatch)-compatible definition) Defines files/paths to + * be ignored. The whole relative or absolute path is tested, not just filename. If a function + * with two arguments is provided, it gets called twice per path - once with a single argument + * (the path), second time with two arguments (the path and the + * [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object of that path). + */ + ignored?: Matcher; + + /** + * If set to `false` then `add`/`addDir` events are also emitted for matching paths while + * instantiating the watching as chokidar discovers these file paths (before the `ready` event). + */ + ignoreInitial?: boolean; + + /** + * When `false`, only the symlinks themselves will be watched for changes instead of following + * the link references and bubbling events through the link's path. + */ + followSymlinks?: boolean; + + /** + * The base directory from which watch `paths` are to be derived. Paths emitted with events will + * be relative to this. + */ + cwd?: string; + + /** + * If set to true then the strings passed to .watch() and .add() are treated as literal path + * names, even if they look like globs. Default: false. + */ + disableGlobbing?: boolean; + + /** + * Whether to use fs.watchFile (backed by polling), or fs.watch. If polling leads to high CPU + * utilization, consider setting this to `false`. It is typically necessary to **set this to + * `true` to successfully watch files over a network**, and it may be necessary to successfully + * watch files in other non-standard situations. Setting to `true` explicitly on OS X overrides + * the `useFsEvents` default. + */ + usePolling?: boolean; + + /** + * Whether to use the `fsevents` watching interface if available. When set to `true` explicitly + * and `fsevents` is available this supercedes the `usePolling` setting. When set to `false` on + * OS X, `usePolling: true` becomes the default. + */ + useFsEvents?: boolean; + + /** + * If relying upon the [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object that + * may get passed with `add`, `addDir`, and `change` events, set this to `true` to ensure it is + * provided even in cases where it wasn't already available from the underlying watch events. + */ + alwaysStat?: boolean; + + /** + * If set, limits how many levels of subdirectories will be traversed. + */ + depth?: number; + + /** + * Interval of file system polling. + */ + interval?: number; + + /** + * Interval of file system polling for binary files. ([see list of binary extensions](https://gi + * thub.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json)) + */ + binaryInterval?: number; + + /** + * Indicates whether to watch files that don't have read permissions if possible. If watching + * fails due to `EPERM` or `EACCES` with this set to `true`, the errors will be suppressed + * silently. + */ + ignorePermissionErrors?: boolean; + + /** + * `true` if `useFsEvents` and `usePolling` are `false`). Automatically filters out artifacts + * that occur when using editors that use "atomic writes" instead of writing directly to the + * source file. If a file is re-added within 100 ms of being deleted, Chokidar emits a `change` + * event rather than `unlink` then `add`. If the default of 100 ms does not work well for you, + * you can override it by setting `atomic` to a custom value, in milliseconds. + */ + atomic?: boolean | number; + + /** + * can be set to an object in order to adjust timing params: + */ + awaitWriteFinish?: AwaitWriteFinishOptions | boolean; +} + +export interface AwaitWriteFinishOptions { + /** + * Amount of time in milliseconds for a file size to remain constant before emitting its event. + */ + stabilityThreshold?: number; + + /** + * File size polling interval. + */ + pollInterval?: number; +} + +/** + * produces an instance of `FSWatcher`. + */ +export function watch( + paths: string | ReadonlyArray, + options?: WatchOptions +): FSWatcher; diff --git a/project starter code/node_modules/combined-stream/License b/project starter code/node_modules/combined-stream/License new file mode 100644 index 00000000..4804b7ab --- /dev/null +++ b/project starter code/node_modules/combined-stream/License @@ -0,0 +1,19 @@ +Copyright (c) 2011 Debuggable Limited + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/project starter code/node_modules/combined-stream/Readme.md b/project starter code/node_modules/combined-stream/Readme.md new file mode 100644 index 00000000..9e367b5b --- /dev/null +++ b/project starter code/node_modules/combined-stream/Readme.md @@ -0,0 +1,138 @@ +# combined-stream + +A stream that emits multiple other streams one after another. + +**NB** Currently `combined-stream` works with streams version 1 only. There is ongoing effort to switch this library to streams version 2. Any help is welcome. :) Meanwhile you can explore other libraries that provide streams2 support with more or less compatibility with `combined-stream`. + +- [combined-stream2](https://www.npmjs.com/package/combined-stream2): A drop-in streams2-compatible replacement for the combined-stream module. + +- [multistream](https://www.npmjs.com/package/multistream): A stream that emits multiple other streams one after another. + +## Installation + +``` bash +npm install combined-stream +``` + +## Usage + +Here is a simple example that shows how you can use combined-stream to combine +two files into one: + +``` javascript +var CombinedStream = require('combined-stream'); +var fs = require('fs'); + +var combinedStream = CombinedStream.create(); +combinedStream.append(fs.createReadStream('file1.txt')); +combinedStream.append(fs.createReadStream('file2.txt')); + +combinedStream.pipe(fs.createWriteStream('combined.txt')); +``` + +While the example above works great, it will pause all source streams until +they are needed. If you don't want that to happen, you can set `pauseStreams` +to `false`: + +``` javascript +var CombinedStream = require('combined-stream'); +var fs = require('fs'); + +var combinedStream = CombinedStream.create({pauseStreams: false}); +combinedStream.append(fs.createReadStream('file1.txt')); +combinedStream.append(fs.createReadStream('file2.txt')); + +combinedStream.pipe(fs.createWriteStream('combined.txt')); +``` + +However, what if you don't have all the source streams yet, or you don't want +to allocate the resources (file descriptors, memory, etc.) for them right away? +Well, in that case you can simply provide a callback that supplies the stream +by calling a `next()` function: + +``` javascript +var CombinedStream = require('combined-stream'); +var fs = require('fs'); + +var combinedStream = CombinedStream.create(); +combinedStream.append(function(next) { + next(fs.createReadStream('file1.txt')); +}); +combinedStream.append(function(next) { + next(fs.createReadStream('file2.txt')); +}); + +combinedStream.pipe(fs.createWriteStream('combined.txt')); +``` + +## API + +### CombinedStream.create([options]) + +Returns a new combined stream object. Available options are: + +* `maxDataSize` +* `pauseStreams` + +The effect of those options is described below. + +### combinedStream.pauseStreams = `true` + +Whether to apply back pressure to the underlaying streams. If set to `false`, +the underlaying streams will never be paused. If set to `true`, the +underlaying streams will be paused right after being appended, as well as when +`delayedStream.pipe()` wants to throttle. + +### combinedStream.maxDataSize = `2 * 1024 * 1024` + +The maximum amount of bytes (or characters) to buffer for all source streams. +If this value is exceeded, `combinedStream` emits an `'error'` event. + +### combinedStream.dataSize = `0` + +The amount of bytes (or characters) currently buffered by `combinedStream`. + +### combinedStream.append(stream) + +Appends the given `stream` to the combinedStream object. If `pauseStreams` is +set to `true, this stream will also be paused right away. + +`streams` can also be a function that takes one parameter called `next`. `next` +is a function that must be invoked in order to provide the `next` stream, see +example above. + +Regardless of how the `stream` is appended, combined-stream always attaches an +`'error'` listener to it, so you don't have to do that manually. + +Special case: `stream` can also be a String or Buffer. + +### combinedStream.write(data) + +You should not call this, `combinedStream` takes care of piping the appended +streams into itself for you. + +### combinedStream.resume() + +Causes `combinedStream` to start drain the streams it manages. The function is +idempotent, and also emits a `'resume'` event each time which usually goes to +the stream that is currently being drained. + +### combinedStream.pause(); + +If `combinedStream.pauseStreams` is set to `false`, this does nothing. +Otherwise a `'pause'` event is emitted, this goes to the stream that is +currently being drained, so you can use it to apply back pressure. + +### combinedStream.end(); + +Sets `combinedStream.writable` to false, emits an `'end'` event, and removes +all streams from the queue. + +### combinedStream.destroy(); + +Same as `combinedStream.end()`, except it emits a `'close'` event instead of +`'end'`. + +## License + +combined-stream is licensed under the MIT license. diff --git a/project starter code/node_modules/combined-stream/lib/combined_stream.js b/project starter code/node_modules/combined-stream/lib/combined_stream.js new file mode 100644 index 00000000..125f097f --- /dev/null +++ b/project starter code/node_modules/combined-stream/lib/combined_stream.js @@ -0,0 +1,208 @@ +var util = require('util'); +var Stream = require('stream').Stream; +var DelayedStream = require('delayed-stream'); + +module.exports = CombinedStream; +function CombinedStream() { + this.writable = false; + this.readable = true; + this.dataSize = 0; + this.maxDataSize = 2 * 1024 * 1024; + this.pauseStreams = true; + + this._released = false; + this._streams = []; + this._currentStream = null; + this._insideLoop = false; + this._pendingNext = false; +} +util.inherits(CombinedStream, Stream); + +CombinedStream.create = function(options) { + var combinedStream = new this(); + + options = options || {}; + for (var option in options) { + combinedStream[option] = options[option]; + } + + return combinedStream; +}; + +CombinedStream.isStreamLike = function(stream) { + return (typeof stream !== 'function') + && (typeof stream !== 'string') + && (typeof stream !== 'boolean') + && (typeof stream !== 'number') + && (!Buffer.isBuffer(stream)); +}; + +CombinedStream.prototype.append = function(stream) { + var isStreamLike = CombinedStream.isStreamLike(stream); + + if (isStreamLike) { + if (!(stream instanceof DelayedStream)) { + var newStream = DelayedStream.create(stream, { + maxDataSize: Infinity, + pauseStream: this.pauseStreams, + }); + stream.on('data', this._checkDataSize.bind(this)); + stream = newStream; + } + + this._handleErrors(stream); + + if (this.pauseStreams) { + stream.pause(); + } + } + + this._streams.push(stream); + return this; +}; + +CombinedStream.prototype.pipe = function(dest, options) { + Stream.prototype.pipe.call(this, dest, options); + this.resume(); + return dest; +}; + +CombinedStream.prototype._getNext = function() { + this._currentStream = null; + + if (this._insideLoop) { + this._pendingNext = true; + return; // defer call + } + + this._insideLoop = true; + try { + do { + this._pendingNext = false; + this._realGetNext(); + } while (this._pendingNext); + } finally { + this._insideLoop = false; + } +}; + +CombinedStream.prototype._realGetNext = function() { + var stream = this._streams.shift(); + + + if (typeof stream == 'undefined') { + this.end(); + return; + } + + if (typeof stream !== 'function') { + this._pipeNext(stream); + return; + } + + var getStream = stream; + getStream(function(stream) { + var isStreamLike = CombinedStream.isStreamLike(stream); + if (isStreamLike) { + stream.on('data', this._checkDataSize.bind(this)); + this._handleErrors(stream); + } + + this._pipeNext(stream); + }.bind(this)); +}; + +CombinedStream.prototype._pipeNext = function(stream) { + this._currentStream = stream; + + var isStreamLike = CombinedStream.isStreamLike(stream); + if (isStreamLike) { + stream.on('end', this._getNext.bind(this)); + stream.pipe(this, {end: false}); + return; + } + + var value = stream; + this.write(value); + this._getNext(); +}; + +CombinedStream.prototype._handleErrors = function(stream) { + var self = this; + stream.on('error', function(err) { + self._emitError(err); + }); +}; + +CombinedStream.prototype.write = function(data) { + this.emit('data', data); +}; + +CombinedStream.prototype.pause = function() { + if (!this.pauseStreams) { + return; + } + + if(this.pauseStreams && this._currentStream && typeof(this._currentStream.pause) == 'function') this._currentStream.pause(); + this.emit('pause'); +}; + +CombinedStream.prototype.resume = function() { + if (!this._released) { + this._released = true; + this.writable = true; + this._getNext(); + } + + if(this.pauseStreams && this._currentStream && typeof(this._currentStream.resume) == 'function') this._currentStream.resume(); + this.emit('resume'); +}; + +CombinedStream.prototype.end = function() { + this._reset(); + this.emit('end'); +}; + +CombinedStream.prototype.destroy = function() { + this._reset(); + this.emit('close'); +}; + +CombinedStream.prototype._reset = function() { + this.writable = false; + this._streams = []; + this._currentStream = null; +}; + +CombinedStream.prototype._checkDataSize = function() { + this._updateDataSize(); + if (this.dataSize <= this.maxDataSize) { + return; + } + + var message = + 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.'; + this._emitError(new Error(message)); +}; + +CombinedStream.prototype._updateDataSize = function() { + this.dataSize = 0; + + var self = this; + this._streams.forEach(function(stream) { + if (!stream.dataSize) { + return; + } + + self.dataSize += stream.dataSize; + }); + + if (this._currentStream && this._currentStream.dataSize) { + this.dataSize += this._currentStream.dataSize; + } +}; + +CombinedStream.prototype._emitError = function(err) { + this._reset(); + this.emit('error', err); +}; diff --git a/project starter code/node_modules/combined-stream/package.json b/project starter code/node_modules/combined-stream/package.json new file mode 100644 index 00000000..6982b6da --- /dev/null +++ b/project starter code/node_modules/combined-stream/package.json @@ -0,0 +1,25 @@ +{ + "author": "Felix Geisendörfer (http://debuggable.com/)", + "name": "combined-stream", + "description": "A stream that emits multiple other streams one after another.", + "version": "1.0.8", + "homepage": "https://github.com/felixge/node-combined-stream", + "repository": { + "type": "git", + "url": "git://github.com/felixge/node-combined-stream.git" + }, + "main": "./lib/combined_stream", + "scripts": { + "test": "node test/run.js" + }, + "engines": { + "node": ">= 0.8" + }, + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "devDependencies": { + "far": "~0.0.7" + }, + "license": "MIT" +} diff --git a/project starter code/node_modules/combined-stream/yarn.lock b/project starter code/node_modules/combined-stream/yarn.lock new file mode 100644 index 00000000..7edf4184 --- /dev/null +++ b/project starter code/node_modules/combined-stream/yarn.lock @@ -0,0 +1,17 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + +far@~0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/far/-/far-0.0.7.tgz#01c1fd362bcd26ce9cf161af3938aa34619f79a7" + dependencies: + oop "0.0.3" + +oop@0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/oop/-/oop-0.0.3.tgz#70fa405a5650891a194fdc82ca68dad6dabf4401" diff --git a/project starter code/node_modules/concat-map/.travis.yml b/project starter code/node_modules/concat-map/.travis.yml new file mode 100644 index 00000000..f1d0f13c --- /dev/null +++ b/project starter code/node_modules/concat-map/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.4 + - 0.6 diff --git a/project starter code/node_modules/minimist/LICENSE b/project starter code/node_modules/concat-map/LICENSE similarity index 100% rename from project starter code/node_modules/minimist/LICENSE rename to project starter code/node_modules/concat-map/LICENSE diff --git a/project starter code/node_modules/concat-map/README.markdown b/project starter code/node_modules/concat-map/README.markdown new file mode 100644 index 00000000..408f70a1 --- /dev/null +++ b/project starter code/node_modules/concat-map/README.markdown @@ -0,0 +1,62 @@ +concat-map +========== + +Concatenative mapdashery. + +[![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map) + +[![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map) + +example +======= + +``` js +var concatMap = require('concat-map'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); +``` + +*** + +``` +[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ] +``` + +methods +======= + +``` js +var concatMap = require('concat-map') +``` + +concatMap(xs, fn) +----------------- + +Return an array of concatenated elements by calling `fn(x, i)` for each element +`x` and each index `i` in the array `xs`. + +When `fn(x, i)` returns an array, its result will be concatenated with the +result array. If `fn(x, i)` returns anything else, that value will be pushed +onto the end of the result array. + +install +======= + +With [npm](http://npmjs.org) do: + +``` +npm install concat-map +``` + +license +======= + +MIT + +notes +===== + +This module was written while sitting high above the ground in a tree. diff --git a/project starter code/node_modules/concat-map/example/map.js b/project starter code/node_modules/concat-map/example/map.js new file mode 100644 index 00000000..33656217 --- /dev/null +++ b/project starter code/node_modules/concat-map/example/map.js @@ -0,0 +1,6 @@ +var concatMap = require('../'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); diff --git a/project starter code/node_modules/concat-map/index.js b/project starter code/node_modules/concat-map/index.js new file mode 100644 index 00000000..b29a7812 --- /dev/null +++ b/project starter code/node_modules/concat-map/index.js @@ -0,0 +1,13 @@ +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; diff --git a/project starter code/node_modules/concat-map/package.json b/project starter code/node_modules/concat-map/package.json new file mode 100644 index 00000000..d3640e6b --- /dev/null +++ b/project starter code/node_modules/concat-map/package.json @@ -0,0 +1,43 @@ +{ + "name" : "concat-map", + "description" : "concatenative mapdashery", + "version" : "0.0.1", + "repository" : { + "type" : "git", + "url" : "git://github.com/substack/node-concat-map.git" + }, + "main" : "index.js", + "keywords" : [ + "concat", + "concatMap", + "map", + "functional", + "higher-order" + ], + "directories" : { + "example" : "example", + "test" : "test" + }, + "scripts" : { + "test" : "tape test/*.js" + }, + "devDependencies" : { + "tape" : "~2.4.0" + }, + "license" : "MIT", + "author" : { + "name" : "James Halliday", + "email" : "mail@substack.net", + "url" : "http://substack.net" + }, + "testling" : { + "files" : "test/*.js", + "browsers" : { + "ie" : [ 6, 7, 8, 9 ], + "ff" : [ 3.5, 10, 15.0 ], + "chrome" : [ 10, 22 ], + "safari" : [ 5.1 ], + "opera" : [ 12 ] + } + } +} diff --git a/project starter code/node_modules/concat-map/test/map.js b/project starter code/node_modules/concat-map/test/map.js new file mode 100644 index 00000000..fdbd7022 --- /dev/null +++ b/project starter code/node_modules/concat-map/test/map.js @@ -0,0 +1,39 @@ +var concatMap = require('../'); +var test = require('tape'); + +test('empty or not', function (t) { + var xs = [ 1, 2, 3, 4, 5, 6 ]; + var ixes = []; + var ys = concatMap(xs, function (x, ix) { + ixes.push(ix); + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; + }); + t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]); + t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]); + t.end(); +}); + +test('always something', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ]; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('scalars', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : x; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('undefs', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function () {}); + t.same(ys, [ undefined, undefined, undefined, undefined ]); + t.end(); +}); diff --git a/project starter code/node_modules/content-type/HISTORY.md b/project starter code/node_modules/content-type/HISTORY.md index 8f5cb703..45836713 100644 --- a/project starter code/node_modules/content-type/HISTORY.md +++ b/project starter code/node_modules/content-type/HISTORY.md @@ -1,3 +1,8 @@ +1.0.5 / 2023-01-29 +================== + + * perf: skip value escaping when unnecessary + 1.0.4 / 2017-09-11 ================== diff --git a/project starter code/node_modules/content-type/README.md b/project starter code/node_modules/content-type/README.md index 3ed67413..c1a922a9 100644 --- a/project starter code/node_modules/content-type/README.md +++ b/project starter code/node_modules/content-type/README.md @@ -1,10 +1,10 @@ # content-type -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Node.js Version][node-version-image]][node-version-url] -[![Build Status][travis-image]][travis-url] -[![Test Coverage][coveralls-image]][coveralls-url] +[![NPM Version][npm-version-image]][npm-url] +[![NPM Downloads][npm-downloads-image]][npm-url] +[![Node.js Version][node-image]][node-url] +[![Build Status][ci-image]][ci-url] +[![Coverage Status][coveralls-image]][coveralls-url] Create and parse HTTP Content-Type header according to RFC 7231 @@ -26,7 +26,7 @@ var contentType = require('content-type') var obj = contentType.parse('image/svg+xml; charset=utf-8') ``` -Parse a content type string. This will return an object with the following +Parse a `Content-Type` header. This will return an object with the following properties (examples are shown for the string `'image/svg+xml; charset=utf-8'`): - `type`: The media type (the type and subtype, always lower case). @@ -43,7 +43,7 @@ Throws a `TypeError` if the string is missing or invalid. var obj = contentType.parse(req) ``` -Parse the `content-type` header from the given `req`. Short-cut for +Parse the `Content-Type` header from the given `req`. Short-cut for `contentType.parse(req.headers['content-type'])`. Throws a `TypeError` if the `Content-Type` header is missing or invalid. @@ -54,7 +54,7 @@ Throws a `TypeError` if the `Content-Type` header is missing or invalid. var obj = contentType.parse(res) ``` -Parse the `content-type` header set on the given `res`. Short-cut for +Parse the `Content-Type` header set on the given `res`. Short-cut for `contentType.parse(res.getHeader('content-type'))`. Throws a `TypeError` if the `Content-Type` header is missing or invalid. @@ -62,10 +62,13 @@ Throws a `TypeError` if the `Content-Type` header is missing or invalid. ### contentType.format(obj) ```js -var str = contentType.format({type: 'image/svg+xml'}) +var str = contentType.format({ + type: 'image/svg+xml', + parameters: { charset: 'utf-8' } +}) ``` -Format an object into a content type string. This will return a string of the +Format an object into a `Content-Type` header. This will return a string of the content type for the given object with the following properties (examples are shown that produce the string `'image/svg+xml; charset=utf-8'`): @@ -80,13 +83,12 @@ Throws a `TypeError` if the object contains an invalid type or parameter names. [MIT](LICENSE) -[npm-image]: https://img.shields.io/npm/v/content-type.svg +[ci-image]: https://badgen.net/github/checks/jshttp/content-type/master?label=ci +[ci-url]: https://github.com/jshttp/content-type/actions/workflows/ci.yml +[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/content-type/master +[coveralls-url]: https://coveralls.io/r/jshttp/content-type?branch=master +[node-image]: https://badgen.net/npm/node/content-type +[node-url]: https://nodejs.org/en/download +[npm-downloads-image]: https://badgen.net/npm/dm/content-type [npm-url]: https://npmjs.org/package/content-type -[node-version-image]: https://img.shields.io/node/v/content-type.svg -[node-version-url]: http://nodejs.org/download/ -[travis-image]: https://img.shields.io/travis/jshttp/content-type/master.svg -[travis-url]: https://travis-ci.org/jshttp/content-type -[coveralls-image]: https://img.shields.io/coveralls/jshttp/content-type/master.svg -[coveralls-url]: https://coveralls.io/r/jshttp/content-type -[downloads-image]: https://img.shields.io/npm/dm/content-type.svg -[downloads-url]: https://npmjs.org/package/content-type +[npm-version-image]: https://badgen.net/npm/v/content-type diff --git a/project starter code/node_modules/content-type/index.js b/project starter code/node_modules/content-type/index.js index 6ce03f20..41840e7b 100644 --- a/project starter code/node_modules/content-type/index.js +++ b/project starter code/node_modules/content-type/index.js @@ -20,8 +20,8 @@ * obs-text = %x80-FF * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text ) */ -var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g -var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/ +var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g // eslint-disable-line no-control-regex +var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/ // eslint-disable-line no-control-regex var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/ /** @@ -30,7 +30,7 @@ var TOKEN_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/ * quoted-pair = "\" ( HTAB / SP / VCHAR / obs-text ) * obs-text = %x80-FF */ -var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g +var QESC_REGEXP = /\\([\u000b\u0020-\u00ff])/g // eslint-disable-line no-control-regex /** * RegExp to match chars that must be quoted-pair in RFC 7230 sec 3.2.6 @@ -119,7 +119,7 @@ function parse (string) { var index = header.indexOf(';') var type = index !== -1 - ? header.substr(0, index).trim() + ? header.slice(0, index).trim() : header.trim() if (!TYPE_REGEXP.test(type)) { @@ -145,11 +145,14 @@ function parse (string) { key = match[1].toLowerCase() value = match[2] - if (value[0] === '"') { - // remove quotes and escapes - value = value - .substr(1, value.length - 2) - .replace(QESC_REGEXP, '$1') + if (value.charCodeAt(0) === 0x22 /* " */) { + // remove quotes + value = value.slice(1, -1) + + // remove escapes + if (value.indexOf('\\') !== -1) { + value = value.replace(QESC_REGEXP, '$1') + } } obj.parameters[key] = value diff --git a/project starter code/node_modules/content-type/package.json b/project starter code/node_modules/content-type/package.json index f2d31d41..9db19f63 100644 --- a/project starter code/node_modules/content-type/package.json +++ b/project starter code/node_modules/content-type/package.json @@ -1,7 +1,7 @@ { "name": "content-type", "description": "Create and parse HTTP Content-Type header", - "version": "1.0.4", + "version": "1.0.5", "author": "Douglas Christopher Wilson ", "license": "MIT", "keywords": [ @@ -13,14 +13,15 @@ ], "repository": "jshttp/content-type", "devDependencies": { - "eslint": "3.19.0", - "eslint-config-standard": "10.2.1", - "eslint-plugin-import": "2.7.0", - "eslint-plugin-node": "5.1.1", - "eslint-plugin-promise": "3.5.0", - "eslint-plugin-standard": "3.0.1", - "istanbul": "0.4.5", - "mocha": "~1.21.5" + "deep-equal": "1.0.1", + "eslint": "8.32.0", + "eslint-config-standard": "15.0.1", + "eslint-plugin-import": "2.27.5", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-promise": "6.1.1", + "eslint-plugin-standard": "4.1.0", + "mocha": "10.2.0", + "nyc": "15.1.0" }, "files": [ "LICENSE", @@ -34,7 +35,8 @@ "scripts": { "lint": "eslint .", "test": "mocha --reporter spec --check-leaks --bail test/", - "test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/" + "test-ci": "nyc --reporter=lcovonly --reporter=text npm test", + "test-cov": "nyc --reporter=html --reporter=text npm test", + "version": "node scripts/version-history.js && git add HISTORY.md" } } diff --git a/project starter code/node_modules/cookie/HISTORY.md b/project starter code/node_modules/cookie/HISTORY.md index ae9b995b..41ae4b01 100644 --- a/project starter code/node_modules/cookie/HISTORY.md +++ b/project starter code/node_modules/cookie/HISTORY.md @@ -1,16 +1,21 @@ +0.6.0 / 2023-11-06 +================== + + * Add `partitioned` option + 0.5.0 / 2022-04-11 ================== * Add `priority` option * Fix `expires` option to reject invalid dates - * pref: improve default decode speed - * pref: remove slow string split in parse + * perf: improve default decode speed + * perf: remove slow string split in parse 0.4.2 / 2022-02-02 ================== - * pref: read value only when assigning in parse - * pref: remove unnecessary regexp in parse + * perf: read value only when assigning in parse + * perf: remove unnecessary regexp in parse 0.4.1 / 2020-04-21 ================== @@ -41,7 +46,7 @@ * perf: enable strict mode * perf: use for loop in parse - * perf: use string concatination for serialization + * perf: use string concatenation for serialization 0.2.3 / 2015-10-25 ================== diff --git a/project starter code/node_modules/cookie/README.md b/project starter code/node_modules/cookie/README.md index 5449c3a2..71fdac11 100644 --- a/project starter code/node_modules/cookie/README.md +++ b/project starter code/node_modules/cookie/README.md @@ -2,9 +2,9 @@ [![NPM Version][npm-version-image]][npm-url] [![NPM Downloads][npm-downloads-image]][npm-url] -[![Node.js Version][node-version-image]][node-version-url] -[![Build Status][github-actions-ci-image]][github-actions-ci-url] -[![Test Coverage][coveralls-image]][coveralls-url] +[![Node.js Version][node-image]][node-url] +[![Build Status][ci-image]][ci-url] +[![Coverage Status][coveralls-image]][coveralls-url] Basic HTTP cookie parser and serializer for HTTP servers. @@ -107,6 +107,17 @@ The given number will be converted to an integer by rounding down. By default, n `maxAge` are set, then `maxAge` takes precedence, but it is possible not all clients by obey this, so if both are set, they should point to the same date and time. +##### partitioned + +Specifies the `boolean` value for the [`Partitioned` `Set-Cookie`](rfc-cutler-httpbis-partitioned-cookies) +attribute. When truthy, the `Partitioned` attribute is set, otherwise it is not. By default, the +`Partitioned` attribute is not set. + +**note** This is an attribute that has not yet been fully standardized, and may change in the future. +This also means many clients may ignore this attribute until they understand it. + +More information about can be found in [the proposal](https://github.com/privacycg/CHIPS). + ##### path Specifies the value for the [`Path` `Set-Cookie` attribute][rfc-6265-5.2.4]. By default, the path @@ -212,49 +223,52 @@ $ npm test ``` $ npm run bench -> cookie@0.4.2 bench +> cookie@0.5.0 bench > node benchmark/index.js - node@16.14.0 - v8@9.4.146.24-node.20 - uv@1.43.0 - zlib@1.2.11 + node@18.18.2 + acorn@8.10.0 + ada@2.6.0 + ares@1.19.1 brotli@1.0.9 - ares@1.18.1 - modules@93 - nghttp2@1.45.1 - napi@8 - llhttp@6.0.4 - openssl@1.1.1m+quic - cldr@40.0 - icu@70.1 - tz@2021a3 - unicode@14.0 - ngtcp2@0.1.0-DEV - nghttp3@0.1.0-DEV + cldr@43.1 + icu@73.2 + llhttp@6.0.11 + modules@108 + napi@9 + nghttp2@1.57.0 + nghttp3@0.7.0 + ngtcp2@0.8.1 + openssl@3.0.10+quic + simdutf@3.2.14 + tz@2023c + undici@5.26.3 + unicode@15.0 + uv@1.44.2 + uvwasi@0.0.18 + v8@10.2.154.26-node.26 + zlib@1.2.13.1-motley > node benchmark/parse-top.js cookie.parse - top sites - 15 tests completed. - - parse accounts.google.com x 2,421,245 ops/sec ±0.80% (188 runs sampled) - parse apple.com x 2,684,710 ops/sec ±0.59% (189 runs sampled) - parse cloudflare.com x 2,231,418 ops/sec ±0.76% (186 runs sampled) - parse docs.google.com x 2,316,357 ops/sec ±1.28% (187 runs sampled) - parse drive.google.com x 2,363,543 ops/sec ±0.49% (189 runs sampled) - parse en.wikipedia.org x 839,414 ops/sec ±0.53% (189 runs sampled) - parse linkedin.com x 553,797 ops/sec ±0.63% (190 runs sampled) - parse maps.google.com x 1,314,779 ops/sec ±0.72% (189 runs sampled) - parse microsoft.com x 153,783 ops/sec ±0.53% (190 runs sampled) - parse play.google.com x 2,249,574 ops/sec ±0.59% (187 runs sampled) - parse plus.google.com x 2,258,682 ops/sec ±0.60% (188 runs sampled) - parse sites.google.com x 2,247,069 ops/sec ±0.68% (189 runs sampled) - parse support.google.com x 1,456,840 ops/sec ±0.70% (187 runs sampled) - parse www.google.com x 1,046,028 ops/sec ±0.58% (188 runs sampled) - parse youtu.be x 937,428 ops/sec ±1.47% (190 runs sampled) - parse youtube.com x 963,878 ops/sec ±0.59% (190 runs sampled) + 14 tests completed. + + parse accounts.google.com x 2,588,913 ops/sec ±0.74% (186 runs sampled) + parse apple.com x 2,370,002 ops/sec ±0.69% (186 runs sampled) + parse cloudflare.com x 2,213,102 ops/sec ±0.88% (188 runs sampled) + parse docs.google.com x 2,194,157 ops/sec ±1.03% (184 runs sampled) + parse drive.google.com x 2,265,084 ops/sec ±0.79% (187 runs sampled) + parse en.wikipedia.org x 457,099 ops/sec ±0.81% (186 runs sampled) + parse linkedin.com x 504,407 ops/sec ±0.89% (186 runs sampled) + parse maps.google.com x 1,230,959 ops/sec ±0.98% (186 runs sampled) + parse microsoft.com x 926,294 ops/sec ±0.88% (184 runs sampled) + parse play.google.com x 2,311,338 ops/sec ±0.83% (185 runs sampled) + parse support.google.com x 1,508,850 ops/sec ±0.86% (186 runs sampled) + parse www.google.com x 1,022,582 ops/sec ±1.32% (182 runs sampled) + parse youtu.be x 332,136 ops/sec ±1.02% (185 runs sampled) + parse youtube.com x 323,833 ops/sec ±0.77% (183 runs sampled) > node benchmark/parse.js @@ -262,12 +276,12 @@ $ npm run bench 6 tests completed. - simple x 2,745,604 ops/sec ±0.77% (185 runs sampled) - decode x 557,287 ops/sec ±0.60% (188 runs sampled) - unquote x 2,498,475 ops/sec ±0.55% (189 runs sampled) - duplicates x 868,591 ops/sec ±0.89% (187 runs sampled) - 10 cookies x 306,745 ops/sec ±0.49% (190 runs sampled) - 100 cookies x 22,414 ops/sec ±2.38% (182 runs sampled) + simple x 3,214,032 ops/sec ±1.61% (183 runs sampled) + decode x 587,237 ops/sec ±1.16% (187 runs sampled) + unquote x 2,954,618 ops/sec ±1.35% (183 runs sampled) + duplicates x 857,008 ops/sec ±0.89% (187 runs sampled) + 10 cookies x 292,133 ops/sec ±0.89% (187 runs sampled) + 100 cookies x 22,610 ops/sec ±0.68% (187 runs sampled) ``` ## References @@ -275,6 +289,7 @@ $ npm run bench - [RFC 6265: HTTP State Management Mechanism][rfc-6265] - [Same-site Cookies][rfc-6265bis-09-5.4.7] +[rfc-cutler-httpbis-partitioned-cookies]: https://tools.ietf.org/html/draft-cutler-httpbis-partitioned-cookies/ [rfc-west-cookie-priority-00-4.1]: https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1 [rfc-6265bis-09-5.4.7]: https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-09#section-5.4.7 [rfc-6265]: https://tools.ietf.org/html/rfc6265 @@ -291,12 +306,12 @@ $ npm run bench [MIT](LICENSE) +[ci-image]: https://badgen.net/github/checks/jshttp/cookie/master?label=ci +[ci-url]: https://github.com/jshttp/cookie/actions/workflows/ci.yml [coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/cookie/master [coveralls-url]: https://coveralls.io/r/jshttp/cookie?branch=master -[github-actions-ci-image]: https://img.shields.io/github/workflow/status/jshttp/cookie/ci/master?label=ci -[github-actions-ci-url]: https://github.com/jshttp/cookie/actions/workflows/ci.yml -[node-version-image]: https://badgen.net/npm/node/cookie -[node-version-url]: https://nodejs.org/en/download +[node-image]: https://badgen.net/npm/node/cookie +[node-url]: https://nodejs.org/en/download [npm-downloads-image]: https://badgen.net/npm/dm/cookie [npm-url]: https://npmjs.org/package/cookie [npm-version-image]: https://badgen.net/npm/v/cookie diff --git a/project starter code/node_modules/cookie/index.js b/project starter code/node_modules/cookie/index.js index 9c3d07d8..03d4c386 100644 --- a/project starter code/node_modules/cookie/index.js +++ b/project starter code/node_modules/cookie/index.js @@ -172,6 +172,10 @@ function serialize(name, val, options) { str += '; Secure'; } + if (opt.partitioned) { + str += '; Partitioned' + } + if (opt.priority) { var priority = typeof opt.priority === 'string' ? opt.priority.toLowerCase() @@ -233,7 +237,7 @@ function decode (str) { /** * URL-encode value. * - * @param {string} str + * @param {string} val * @returns {string} */ diff --git a/project starter code/node_modules/cookie/package.json b/project starter code/node_modules/cookie/package.json index ed5606a9..0c3f0063 100644 --- a/project starter code/node_modules/cookie/package.json +++ b/project starter code/node_modules/cookie/package.json @@ -1,7 +1,7 @@ { "name": "cookie", "description": "HTTP server cookie parsing and serialization", - "version": "0.5.0", + "version": "0.6.0", "author": "Roman Shtylman ", "contributors": [ "Douglas Christopher Wilson " @@ -15,12 +15,12 @@ "devDependencies": { "beautify-benchmark": "0.2.4", "benchmark": "2.1.4", - "eslint": "7.32.0", - "eslint-plugin-markdown": "2.2.1", - "mocha": "9.2.2", + "eslint": "8.53.0", + "eslint-plugin-markdown": "3.0.1", + "mocha": "10.2.0", "nyc": "15.1.0", "safe-buffer": "5.2.1", - "top-sites": "1.1.97" + "top-sites": "1.1.194" }, "files": [ "HISTORY.md", diff --git a/project starter code/node_modules/define-data-property/.eslintrc b/project starter code/node_modules/define-data-property/.eslintrc new file mode 100644 index 00000000..75443e81 --- /dev/null +++ b/project starter code/node_modules/define-data-property/.eslintrc @@ -0,0 +1,24 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "complexity": 0, + "id-length": 0, + "new-cap": ["error", { + "capIsNewExceptions": [ + "GetIntrinsic", + ], + }], + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "max-lines-per-function": "off", + }, + }, + ], +} diff --git a/project starter code/node_modules/define-data-property/.github/FUNDING.yml b/project starter code/node_modules/define-data-property/.github/FUNDING.yml new file mode 100644 index 00000000..3e17725d --- /dev/null +++ b/project starter code/node_modules/define-data-property/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/define-data-property +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/project starter code/node_modules/define-data-property/.nycrc b/project starter code/node_modules/define-data-property/.nycrc new file mode 100644 index 00000000..1826526e --- /dev/null +++ b/project starter code/node_modules/define-data-property/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/project starter code/node_modules/define-data-property/CHANGELOG.md b/project starter code/node_modules/define-data-property/CHANGELOG.md new file mode 100644 index 00000000..4eed75ea --- /dev/null +++ b/project starter code/node_modules/define-data-property/CHANGELOG.md @@ -0,0 +1,70 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.1.4](https://github.com/ljharb/define-data-property/compare/v1.1.3...v1.1.4) - 2024-02-13 + +### Commits + +- [Refactor] use `es-define-property` [`90f2f4c`](https://github.com/ljharb/define-data-property/commit/90f2f4cc20298401e71c28e1e08888db12021453) +- [Dev Deps] update `@types/object.getownpropertydescriptors` [`cd929d9`](https://github.com/ljharb/define-data-property/commit/cd929d9a04f5f2fdcfa9d5be140940b91a083153) + +## [v1.1.3](https://github.com/ljharb/define-data-property/compare/v1.1.2...v1.1.3) - 2024-02-12 + +### Commits + +- [types] hand-write d.ts instead of emitting it [`0cbc988`](https://github.com/ljharb/define-data-property/commit/0cbc988203c105f2d97948327c7167ebd33bd318) +- [meta] simplify `exports` [`690781e`](https://github.com/ljharb/define-data-property/commit/690781eed28bbf2d6766237efda0ba6dd591609e) +- [Dev Deps] update `hasown`; clean up DT packages [`6cdfd1c`](https://github.com/ljharb/define-data-property/commit/6cdfd1cb2d91d791bfd18cda5d5cab232fd5d8fc) +- [actions] cleanup [`3142bc6`](https://github.com/ljharb/define-data-property/commit/3142bc6a4bc406a51f5b04f31e98562a27f35ffd) +- [meta] add `funding` [`8474423`](https://github.com/ljharb/define-data-property/commit/847442391a79779af3e0f1bf0b5bb923552b7804) +- [Deps] update `get-intrinsic` [`3e9be00`](https://github.com/ljharb/define-data-property/commit/3e9be00e07784ba34e7c77d8bc0fdbc832ad61de) + +## [v1.1.2](https://github.com/ljharb/define-data-property/compare/v1.1.1...v1.1.2) - 2024-02-05 + +### Commits + +- [Dev Deps] update @types packages, `object-inspect`, `tape`, `typescript` [`df41bf8`](https://github.com/ljharb/define-data-property/commit/df41bf84ca3456be6226055caab44e38e3a7fd2f) +- [Dev Deps] update DT packages, `aud`, `npmignore`, `tape`, typescript` [`fab0e4e`](https://github.com/ljharb/define-data-property/commit/fab0e4ec709ee02b79f42d6db3ee5f26e0a34b8a) +- [Dev Deps] use `hasown` instead of `has` [`aa51ef9`](https://github.com/ljharb/define-data-property/commit/aa51ef93f6403d49d9bb72a807bcdb6e418978c0) +- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`d89be50`](https://github.com/ljharb/define-data-property/commit/d89be50571175888d391238605122679f7e65ffc) +- [Deps] update `has-property-descriptors` [`7af887c`](https://github.com/ljharb/define-data-property/commit/7af887c9083b59b195b0079e04815cfed9fcee2b) +- [Deps] update `get-intrinsic` [`bb8728e`](https://github.com/ljharb/define-data-property/commit/bb8728ec42cd998505a7157ae24853a560c20646) + +## [v1.1.1](https://github.com/ljharb/define-data-property/compare/v1.1.0...v1.1.1) - 2023-10-12 + +### Commits + +- [Tests] fix tests in ES3 engines [`5c6920e`](https://github.com/ljharb/define-data-property/commit/5c6920edd1f52f675b02f417e539c28135b43f94) +- [Dev Deps] update `@types/es-value-fixtures`, `@types/for-each`, `@types/gopd`, `@types/has-property-descriptors`, `tape`, `typescript` [`7d82dfc`](https://github.com/ljharb/define-data-property/commit/7d82dfc20f778b4465bba06335dd53f6f431aea3) +- [Fix] IE 8 has a broken `Object.defineProperty` [`0672e1a`](https://github.com/ljharb/define-data-property/commit/0672e1af2a9fcc787e7c23b96dea60d290df5548) +- [meta] emit types on prepack [`73acb1f`](https://github.com/ljharb/define-data-property/commit/73acb1f903c21b314ec7156bf10f73c7910530c0) +- [Dev Deps] update `tape`, `typescript` [`9489a77`](https://github.com/ljharb/define-data-property/commit/9489a7738bf2ecf0ac71d5b78ec4ca6ad7ba0142) + +## [v1.1.0](https://github.com/ljharb/define-data-property/compare/v1.0.1...v1.1.0) - 2023-09-13 + +### Commits + +- [New] add `loose` arg [`155235a`](https://github.com/ljharb/define-data-property/commit/155235a4c4d7741f6de01cd87c99599a56654b72) +- [New] allow `null` to be passed for the non* args [`7d2fa5f`](https://github.com/ljharb/define-data-property/commit/7d2fa5f06be0392736c13b126f7cd38979f34792) + +## [v1.0.1](https://github.com/ljharb/define-data-property/compare/v1.0.0...v1.0.1) - 2023-09-12 + +### Commits + +- [meta] add TS types [`43d763c`](https://github.com/ljharb/define-data-property/commit/43d763c6c883f652de1c9c02ef6216ee507ffa69) +- [Dev Deps] update `@types/tape`, `typescript` [`f444985`](https://github.com/ljharb/define-data-property/commit/f444985811c36f3e6448a03ad2f9b7898917f4c7) +- [meta] add `safe-publish-latest`, [`172bb10`](https://github.com/ljharb/define-data-property/commit/172bb10890896ebb160e64398f6ee55760107bee) + +## v1.0.0 - 2023-09-12 + +### Commits + +- Initial implementation, tests, readme [`5b43d6b`](https://github.com/ljharb/define-data-property/commit/5b43d6b44e675a904810467a7d4e0adb7efc3196) +- Initial commit [`35e577a`](https://github.com/ljharb/define-data-property/commit/35e577a6ba59a98befa97776d70d90f3bea9009d) +- npm init [`82a0a04`](https://github.com/ljharb/define-data-property/commit/82a0a04a321ca7de220af02d41e2745e8a9962ed) +- Only apps should have lockfiles [`96df244`](https://github.com/ljharb/define-data-property/commit/96df244a3c6f426f9a2437be825d1c6f5dd7158e) +- [meta] use `npmignore` to autogenerate an npmignore file [`a87ff18`](https://github.com/ljharb/define-data-property/commit/a87ff18cb79e14c2eb5720486c4759fd9a189375) diff --git a/project starter code/node_modules/define-data-property/LICENSE b/project starter code/node_modules/define-data-property/LICENSE new file mode 100644 index 00000000..b4213ac6 --- /dev/null +++ b/project starter code/node_modules/define-data-property/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/project starter code/node_modules/define-data-property/README.md b/project starter code/node_modules/define-data-property/README.md new file mode 100644 index 00000000..f2304dae --- /dev/null +++ b/project starter code/node_modules/define-data-property/README.md @@ -0,0 +1,67 @@ +# define-data-property [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Define a data property on an object. Will fall back to assignment in an engine without descriptors. + +The three `non*` argument can also be passed `null`, which will use the existing state if available. + +The `loose` argument will mean that if you attempt to set a non-normal data property, in an environment without descriptor support, it will fall back to normal assignment. + +## Usage + +```javascript +var defineDataProperty = require('define-data-property'); +var assert = require('assert'); + +var obj = {}; +defineDataProperty(obj, 'key', 'value'); +defineDataProperty( + obj, + 'key2', + 'value', + true, // nonEnumerable, optional + false, // nonWritable, optional + true, // nonConfigurable, optional + false // loose, optional +); + +assert.deepEqual( + Object.getOwnPropertyDescriptors(obj), + { + key: { + configurable: true, + enumerable: true, + value: 'value', + writable: true, + }, + key2: { + configurable: false, + enumerable: false, + value: 'value', + writable: true, + }, + } +); +``` + +[package-url]: https://npmjs.org/package/define-data-property +[npm-version-svg]: https://versionbadg.es/ljharb/define-data-property.svg +[deps-svg]: https://david-dm.org/ljharb/define-data-property.svg +[deps-url]: https://david-dm.org/ljharb/define-data-property +[dev-deps-svg]: https://david-dm.org/ljharb/define-data-property/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/define-data-property#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/define-data-property.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/define-data-property.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/define-data-property.svg +[downloads-url]: https://npm-stat.com/charts.html?package=define-data-property +[codecov-image]: https://codecov.io/gh/ljharb/define-data-property/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/define-data-property/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/define-data-property +[actions-url]: https://github.com/ljharb/define-data-property/actions diff --git a/project starter code/node_modules/define-data-property/index.d.ts b/project starter code/node_modules/define-data-property/index.d.ts new file mode 100644 index 00000000..b56a77da --- /dev/null +++ b/project starter code/node_modules/define-data-property/index.d.ts @@ -0,0 +1,12 @@ + +declare function defineDataProperty( + obj: Record, + property: keyof typeof obj, + value: typeof obj[typeof property], + nonEnumerable?: boolean | null, + nonWritable?: boolean | null, + nonConfigurable?: boolean | null, + loose?: boolean +): void; + +export = defineDataProperty; \ No newline at end of file diff --git a/project starter code/node_modules/define-data-property/index.js b/project starter code/node_modules/define-data-property/index.js new file mode 100644 index 00000000..e1a38c07 --- /dev/null +++ b/project starter code/node_modules/define-data-property/index.js @@ -0,0 +1,56 @@ +'use strict'; + +var $defineProperty = require('es-define-property'); + +var $SyntaxError = require('es-errors/syntax'); +var $TypeError = require('es-errors/type'); + +var gopd = require('gopd'); + +/** @type {import('.')} */ +module.exports = function defineDataProperty( + obj, + property, + value +) { + if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { + throw new $TypeError('`obj` must be an object or a function`'); + } + if (typeof property !== 'string' && typeof property !== 'symbol') { + throw new $TypeError('`property` must be a string or a symbol`'); + } + if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) { + throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null'); + } + if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) { + throw new $TypeError('`nonWritable`, if provided, must be a boolean or null'); + } + if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) { + throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null'); + } + if (arguments.length > 6 && typeof arguments[6] !== 'boolean') { + throw new $TypeError('`loose`, if provided, must be a boolean'); + } + + var nonEnumerable = arguments.length > 3 ? arguments[3] : null; + var nonWritable = arguments.length > 4 ? arguments[4] : null; + var nonConfigurable = arguments.length > 5 ? arguments[5] : null; + var loose = arguments.length > 6 ? arguments[6] : false; + + /* @type {false | TypedPropertyDescriptor} */ + var desc = !!gopd && gopd(obj, property); + + if ($defineProperty) { + $defineProperty(obj, property, { + configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable, + enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable, + value: value, + writable: nonWritable === null && desc ? desc.writable : !nonWritable + }); + } else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) { + // must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable + obj[property] = value; // eslint-disable-line no-param-reassign + } else { + throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.'); + } +}; diff --git a/project starter code/node_modules/define-data-property/package.json b/project starter code/node_modules/define-data-property/package.json new file mode 100644 index 00000000..eec40971 --- /dev/null +++ b/project starter code/node_modules/define-data-property/package.json @@ -0,0 +1,106 @@ +{ + "name": "define-data-property", + "version": "1.1.4", + "description": "Define a data property on an object. Will fall back to assignment in an engine without descriptors.", + "main": "index.js", + "types": "./index.d.ts", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "tsc": "tsc -p .", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "npm run tsc", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/define-data-property.git" + }, + "keywords": [ + "define", + "data", + "property", + "object", + "accessor", + "javascript", + "ecmascript", + "enumerable", + "configurable", + "writable" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/define-data-property/issues" + }, + "homepage": "https://github.com/ljharb/define-data-property#readme", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "@types/call-bind": "^1.0.5", + "@types/define-properties": "^1.1.5", + "@types/es-value-fixtures": "^1.4.4", + "@types/for-each": "^0.3.3", + "@types/get-intrinsic": "^1.2.2", + "@types/gopd": "^1.0.3", + "@types/has-property-descriptors": "^1.0.3", + "@types/object-inspect": "^1.8.4", + "@types/object.getownpropertydescriptors": "^2.1.4", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "es-value-fixtures": "^1.4.2", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.3", + "hasown": "^2.0.1", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.1", + "object.getownpropertydescriptors": "^2.1.7", + "reflect.ownkeys": "^1.1.4", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.4", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "testling": { + "files": "test/index.js" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "types/reflect.ownkeys" + ] + } +} diff --git a/project starter code/node_modules/define-data-property/test/index.js b/project starter code/node_modules/define-data-property/test/index.js new file mode 100644 index 00000000..68204c66 --- /dev/null +++ b/project starter code/node_modules/define-data-property/test/index.js @@ -0,0 +1,392 @@ +'use strict'; + +var test = require('tape'); +var v = require('es-value-fixtures'); +var forEach = require('for-each'); +var inspect = require('object-inspect'); +var hasOwn = require('hasown'); +var hasPropertyDescriptors = require('has-property-descriptors')(); +var getOwnPropertyDescriptors = require('object.getownpropertydescriptors'); +var ownKeys = require('reflect.ownkeys'); + +var defineDataProperty = require('../'); + +test('defineDataProperty', function (t) { + t.test('argument validation', function (st) { + forEach(v.primitives, function (nonObject) { + st['throws']( + // @ts-expect-error + function () { defineDataProperty(nonObject, 'key', 'value'); }, + TypeError, + 'throws on non-object input: ' + inspect(nonObject) + ); + }); + + forEach(v.nonPropertyKeys, function (nonPropertyKey) { + st['throws']( + // @ts-expect-error + function () { defineDataProperty({}, nonPropertyKey, 'value'); }, + TypeError, + 'throws on non-PropertyKey input: ' + inspect(nonPropertyKey) + ); + }); + + forEach(v.nonBooleans, function (nonBoolean) { + if (nonBoolean !== null) { + st['throws']( + // @ts-expect-error + function () { defineDataProperty({}, 'key', 'value', nonBoolean); }, + TypeError, + 'throws on non-boolean nonEnumerable: ' + inspect(nonBoolean) + ); + + st['throws']( + // @ts-expect-error + function () { defineDataProperty({}, 'key', 'value', false, nonBoolean); }, + TypeError, + 'throws on non-boolean nonWritable: ' + inspect(nonBoolean) + ); + + st['throws']( + // @ts-expect-error + function () { defineDataProperty({}, 'key', 'value', false, false, nonBoolean); }, + TypeError, + 'throws on non-boolean nonConfigurable: ' + inspect(nonBoolean) + ); + } + }); + + st.end(); + }); + + t.test('normal data property', function (st) { + /** @type {Record} */ + var obj = { existing: 'existing property' }; + st.ok(hasOwn(obj, 'existing'), 'has initial own property'); + st.equal(obj.existing, 'existing property', 'has expected initial value'); + + var res = defineDataProperty(obj, 'added', 'added property'); + st.equal(res, void undefined, 'returns `undefined`'); + st.ok(hasOwn(obj, 'added'), 'has expected own property'); + st.equal(obj.added, 'added property', 'has expected value'); + + defineDataProperty(obj, 'existing', 'new value'); + st.ok(hasOwn(obj, 'existing'), 'still has expected own property'); + st.equal(obj.existing, 'new value', 'has new expected value'); + + defineDataProperty(obj, 'explicit1', 'new value', false); + st.ok(hasOwn(obj, 'explicit1'), 'has expected own property (explicit enumerable)'); + st.equal(obj.explicit1, 'new value', 'has new expected value (explicit enumerable)'); + + defineDataProperty(obj, 'explicit2', 'new value', false, false); + st.ok(hasOwn(obj, 'explicit2'), 'has expected own property (explicit writable)'); + st.equal(obj.explicit2, 'new value', 'has new expected value (explicit writable)'); + + defineDataProperty(obj, 'explicit3', 'new value', false, false, false); + st.ok(hasOwn(obj, 'explicit3'), 'has expected own property (explicit configurable)'); + st.equal(obj.explicit3, 'new value', 'has new expected value (explicit configurable)'); + + st.end(); + }); + + t.test('loose mode', { skip: !hasPropertyDescriptors }, function (st) { + var obj = { existing: 'existing property' }; + + defineDataProperty(obj, 'added', 'added value 1', true, null, null, true); + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + existing: { + configurable: true, + enumerable: true, + value: 'existing property', + writable: true + }, + added: { + configurable: true, + enumerable: !hasPropertyDescriptors, + value: 'added value 1', + writable: true + } + }, + 'in loose mode, obj still adds property 1' + ); + + defineDataProperty(obj, 'added', 'added value 2', false, true, null, true); + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + existing: { + configurable: true, + enumerable: true, + value: 'existing property', + writable: true + }, + added: { + configurable: true, + enumerable: true, + value: 'added value 2', + writable: !hasPropertyDescriptors + } + }, + 'in loose mode, obj still adds property 2' + ); + + defineDataProperty(obj, 'added', 'added value 3', false, false, true, true); + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + existing: { + configurable: true, + enumerable: true, + value: 'existing property', + writable: true + }, + added: { + configurable: !hasPropertyDescriptors, + enumerable: true, + value: 'added value 3', + writable: true + } + }, + 'in loose mode, obj still adds property 3' + ); + + st.end(); + }); + + t.test('non-normal data property, ES3', { skip: hasPropertyDescriptors }, function (st) { + /** @type {Record} */ + var obj = { existing: 'existing property' }; + + st['throws']( + function () { defineDataProperty(obj, 'added', 'added value', true); }, + SyntaxError, + 'nonEnumerable throws a Syntax Error' + ); + + st['throws']( + function () { defineDataProperty(obj, 'added', 'added value', false, true); }, + SyntaxError, + 'nonWritable throws a Syntax Error' + ); + + st['throws']( + function () { defineDataProperty(obj, 'added', 'added value', false, false, true); }, + SyntaxError, + 'nonWritable throws a Syntax Error' + ); + + st.deepEqual( + ownKeys(obj), + ['existing'], + 'obj still has expected keys' + ); + st.equal(obj.existing, 'existing property', 'obj still has expected values'); + + st.end(); + }); + + t.test('new non-normal data property, ES5+', { skip: !hasPropertyDescriptors }, function (st) { + /** @type {Record} */ + var obj = { existing: 'existing property' }; + + defineDataProperty(obj, 'nonEnum', null, true); + defineDataProperty(obj, 'nonWrit', null, false, true); + defineDataProperty(obj, 'nonConf', null, false, false, true); + + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + existing: { + configurable: true, + enumerable: true, + value: 'existing property', + writable: true + }, + nonEnum: { + configurable: true, + enumerable: false, + value: null, + writable: true + }, + nonWrit: { + configurable: true, + enumerable: true, + value: null, + writable: false + }, + nonConf: { + configurable: false, + enumerable: true, + value: null, + writable: true + } + }, + 'obj has expected property descriptors' + ); + + st.end(); + }); + + t.test('existing non-normal data property, ES5+', { skip: !hasPropertyDescriptors }, function (st) { + // test case changing an existing non-normal property + + /** @type {Record} */ + var obj = {}; + Object.defineProperty(obj, 'nonEnum', { configurable: true, enumerable: false, value: null, writable: true }); + Object.defineProperty(obj, 'nonWrit', { configurable: true, enumerable: true, value: null, writable: false }); + Object.defineProperty(obj, 'nonConf', { configurable: false, enumerable: true, value: null, writable: true }); + + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + nonEnum: { + configurable: true, + enumerable: false, + value: null, + writable: true + }, + nonWrit: { + configurable: true, + enumerable: true, + value: null, + writable: false + }, + nonConf: { + configurable: false, + enumerable: true, + value: null, + writable: true + } + }, + 'obj initially has expected property descriptors' + ); + + defineDataProperty(obj, 'nonEnum', 'new value', false); + defineDataProperty(obj, 'nonWrit', 'new value', false, false); + st['throws']( + function () { defineDataProperty(obj, 'nonConf', 'new value', false, false, false); }, + TypeError, + 'can not alter a nonconfigurable property' + ); + + st.deepEqual( + getOwnPropertyDescriptors(obj), + { + nonEnum: { + configurable: true, + enumerable: true, + value: 'new value', + writable: true + }, + nonWrit: { + configurable: true, + enumerable: true, + value: 'new value', + writable: true + }, + nonConf: { + configurable: false, + enumerable: true, + value: null, + writable: true + } + }, + 'obj ends up with expected property descriptors' + ); + + st.end(); + }); + + t.test('frozen object, ES5+', { skip: !hasPropertyDescriptors }, function (st) { + var frozen = Object.freeze({ existing: true }); + + st['throws']( + function () { defineDataProperty(frozen, 'existing', 'new value'); }, + TypeError, + 'frozen object can not modify an existing property' + ); + + st['throws']( + function () { defineDataProperty(frozen, 'new', 'new property'); }, + TypeError, + 'frozen object can not add a new property' + ); + + st.end(); + }); + + t.test('sealed object, ES5+', { skip: !hasPropertyDescriptors }, function (st) { + var sealed = Object.seal({ existing: true }); + st.deepEqual( + Object.getOwnPropertyDescriptor(sealed, 'existing'), + { + configurable: false, + enumerable: true, + value: true, + writable: true + }, + 'existing value on sealed object has expected descriptor' + ); + + defineDataProperty(sealed, 'existing', 'new value'); + + st.deepEqual( + Object.getOwnPropertyDescriptor(sealed, 'existing'), + { + configurable: false, + enumerable: true, + value: 'new value', + writable: true + }, + 'existing value on sealed object has changed descriptor' + ); + + st['throws']( + function () { defineDataProperty(sealed, 'new', 'new property'); }, + TypeError, + 'sealed object can not add a new property' + ); + + st.end(); + }); + + t.test('nonextensible object, ES5+', { skip: !hasPropertyDescriptors }, function (st) { + var nonExt = Object.preventExtensions({ existing: true }); + + st.deepEqual( + Object.getOwnPropertyDescriptor(nonExt, 'existing'), + { + configurable: true, + enumerable: true, + value: true, + writable: true + }, + 'existing value on non-extensible object has expected descriptor' + ); + + defineDataProperty(nonExt, 'existing', 'new value', true); + + st.deepEqual( + Object.getOwnPropertyDescriptor(nonExt, 'existing'), + { + configurable: true, + enumerable: false, + value: 'new value', + writable: true + }, + 'existing value on non-extensible object has changed descriptor' + ); + + st['throws']( + function () { defineDataProperty(nonExt, 'new', 'new property'); }, + TypeError, + 'non-extensible object can not add a new property' + ); + + st.end(); + }); + + t.end(); +}); diff --git a/project starter code/node_modules/define-data-property/tsconfig.json b/project starter code/node_modules/define-data-property/tsconfig.json new file mode 100644 index 00000000..69f060dc --- /dev/null +++ b/project starter code/node_modules/define-data-property/tsconfig.json @@ -0,0 +1,59 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + + /* Language and Environment */ + "target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + "typeRoots": ["types"], /* Specify multiple folders that act like './node_modules/@types'. */ + "resolveJsonModule": true, /* Enable importing .json files. */ + + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + "noEmit": true, /* Disable emitting files from a compilation. */ + + /* Interop Constraints */ + "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + + /* Completeness */ + // "skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "exclude": [ + "coverage" + ] +} diff --git a/project starter code/node_modules/delayed-stream/.npmignore b/project starter code/node_modules/delayed-stream/.npmignore new file mode 100644 index 00000000..9daeafb9 --- /dev/null +++ b/project starter code/node_modules/delayed-stream/.npmignore @@ -0,0 +1 @@ +test diff --git a/project starter code/node_modules/delayed-stream/License b/project starter code/node_modules/delayed-stream/License new file mode 100644 index 00000000..4804b7ab --- /dev/null +++ b/project starter code/node_modules/delayed-stream/License @@ -0,0 +1,19 @@ +Copyright (c) 2011 Debuggable Limited + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/project starter code/node_modules/delayed-stream/Makefile b/project starter code/node_modules/delayed-stream/Makefile new file mode 100644 index 00000000..b4ff85a3 --- /dev/null +++ b/project starter code/node_modules/delayed-stream/Makefile @@ -0,0 +1,7 @@ +SHELL := /bin/bash + +test: + @./test/run.js + +.PHONY: test + diff --git a/project starter code/node_modules/delayed-stream/Readme.md b/project starter code/node_modules/delayed-stream/Readme.md new file mode 100644 index 00000000..aca36f9f --- /dev/null +++ b/project starter code/node_modules/delayed-stream/Readme.md @@ -0,0 +1,141 @@ +# delayed-stream + +Buffers events from a stream until you are ready to handle them. + +## Installation + +``` bash +npm install delayed-stream +``` + +## Usage + +The following example shows how to write a http echo server that delays its +response by 1000 ms. + +``` javascript +var DelayedStream = require('delayed-stream'); +var http = require('http'); + +http.createServer(function(req, res) { + var delayed = DelayedStream.create(req); + + setTimeout(function() { + res.writeHead(200); + delayed.pipe(res); + }, 1000); +}); +``` + +If you are not using `Stream#pipe`, you can also manually release the buffered +events by calling `delayedStream.resume()`: + +``` javascript +var delayed = DelayedStream.create(req); + +setTimeout(function() { + // Emit all buffered events and resume underlaying source + delayed.resume(); +}, 1000); +``` + +## Implementation + +In order to use this meta stream properly, here are a few things you should +know about the implementation. + +### Event Buffering / Proxying + +All events of the `source` stream are hijacked by overwriting the `source.emit` +method. Until node implements a catch-all event listener, this is the only way. + +However, delayed-stream still continues to emit all events it captures on the +`source`, regardless of whether you have released the delayed stream yet or +not. + +Upon creation, delayed-stream captures all `source` events and stores them in +an internal event buffer. Once `delayedStream.release()` is called, all +buffered events are emitted on the `delayedStream`, and the event buffer is +cleared. After that, delayed-stream merely acts as a proxy for the underlaying +source. + +### Error handling + +Error events on `source` are buffered / proxied just like any other events. +However, `delayedStream.create` attaches a no-op `'error'` listener to the +`source`. This way you only have to handle errors on the `delayedStream` +object, rather than in two places. + +### Buffer limits + +delayed-stream provides a `maxDataSize` property that can be used to limit +the amount of data being buffered. In order to protect you from bad `source` +streams that don't react to `source.pause()`, this feature is enabled by +default. + +## API + +### DelayedStream.create(source, [options]) + +Returns a new `delayedStream`. Available options are: + +* `pauseStream` +* `maxDataSize` + +The description for those properties can be found below. + +### delayedStream.source + +The `source` stream managed by this object. This is useful if you are +passing your `delayedStream` around, and you still want to access properties +on the `source` object. + +### delayedStream.pauseStream = true + +Whether to pause the underlaying `source` when calling +`DelayedStream.create()`. Modifying this property afterwards has no effect. + +### delayedStream.maxDataSize = 1024 * 1024 + +The amount of data to buffer before emitting an `error`. + +If the underlaying source is emitting `Buffer` objects, the `maxDataSize` +refers to bytes. + +If the underlaying source is emitting JavaScript strings, the size refers to +characters. + +If you know what you are doing, you can set this property to `Infinity` to +disable this feature. You can also modify this property during runtime. + +### delayedStream.dataSize = 0 + +The amount of data buffered so far. + +### delayedStream.readable + +An ECMA5 getter that returns the value of `source.readable`. + +### delayedStream.resume() + +If the `delayedStream` has not been released so far, `delayedStream.release()` +is called. + +In either case, `source.resume()` is called. + +### delayedStream.pause() + +Calls `source.pause()`. + +### delayedStream.pipe(dest) + +Calls `delayedStream.resume()` and then proxies the arguments to `source.pipe`. + +### delayedStream.release() + +Emits and clears all events that have been buffered up so far. This does not +resume the underlaying source, use `delayedStream.resume()` instead. + +## License + +delayed-stream is licensed under the MIT license. diff --git a/project starter code/node_modules/delayed-stream/lib/delayed_stream.js b/project starter code/node_modules/delayed-stream/lib/delayed_stream.js new file mode 100644 index 00000000..b38fc85f --- /dev/null +++ b/project starter code/node_modules/delayed-stream/lib/delayed_stream.js @@ -0,0 +1,107 @@ +var Stream = require('stream').Stream; +var util = require('util'); + +module.exports = DelayedStream; +function DelayedStream() { + this.source = null; + this.dataSize = 0; + this.maxDataSize = 1024 * 1024; + this.pauseStream = true; + + this._maxDataSizeExceeded = false; + this._released = false; + this._bufferedEvents = []; +} +util.inherits(DelayedStream, Stream); + +DelayedStream.create = function(source, options) { + var delayedStream = new this(); + + options = options || {}; + for (var option in options) { + delayedStream[option] = options[option]; + } + + delayedStream.source = source; + + var realEmit = source.emit; + source.emit = function() { + delayedStream._handleEmit(arguments); + return realEmit.apply(source, arguments); + }; + + source.on('error', function() {}); + if (delayedStream.pauseStream) { + source.pause(); + } + + return delayedStream; +}; + +Object.defineProperty(DelayedStream.prototype, 'readable', { + configurable: true, + enumerable: true, + get: function() { + return this.source.readable; + } +}); + +DelayedStream.prototype.setEncoding = function() { + return this.source.setEncoding.apply(this.source, arguments); +}; + +DelayedStream.prototype.resume = function() { + if (!this._released) { + this.release(); + } + + this.source.resume(); +}; + +DelayedStream.prototype.pause = function() { + this.source.pause(); +}; + +DelayedStream.prototype.release = function() { + this._released = true; + + this._bufferedEvents.forEach(function(args) { + this.emit.apply(this, args); + }.bind(this)); + this._bufferedEvents = []; +}; + +DelayedStream.prototype.pipe = function() { + var r = Stream.prototype.pipe.apply(this, arguments); + this.resume(); + return r; +}; + +DelayedStream.prototype._handleEmit = function(args) { + if (this._released) { + this.emit.apply(this, args); + return; + } + + if (args[0] === 'data') { + this.dataSize += args[1].length; + this._checkIfMaxDataSizeExceeded(); + } + + this._bufferedEvents.push(args); +}; + +DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() { + if (this._maxDataSizeExceeded) { + return; + } + + if (this.dataSize <= this.maxDataSize) { + return; + } + + this._maxDataSizeExceeded = true; + var message = + 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.' + this.emit('error', new Error(message)); +}; diff --git a/project starter code/node_modules/delayed-stream/package.json b/project starter code/node_modules/delayed-stream/package.json new file mode 100644 index 00000000..eea3291c --- /dev/null +++ b/project starter code/node_modules/delayed-stream/package.json @@ -0,0 +1,27 @@ +{ + "author": "Felix Geisendörfer (http://debuggable.com/)", + "contributors": [ + "Mike Atkins " + ], + "name": "delayed-stream", + "description": "Buffers events from a stream until you are ready to handle them.", + "license": "MIT", + "version": "1.0.0", + "homepage": "https://github.com/felixge/node-delayed-stream", + "repository": { + "type": "git", + "url": "git://github.com/felixge/node-delayed-stream.git" + }, + "main": "./lib/delayed_stream", + "engines": { + "node": ">=0.4.0" + }, + "scripts": { + "test": "make test" + }, + "dependencies": {}, + "devDependencies": { + "fake": "0.2.0", + "far": "0.0.1" + } +} diff --git a/project starter code/node_modules/es-define-property/.eslintrc b/project starter code/node_modules/es-define-property/.eslintrc new file mode 100644 index 00000000..46f3b120 --- /dev/null +++ b/project starter code/node_modules/es-define-property/.eslintrc @@ -0,0 +1,13 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "new-cap": ["error", { + "capIsNewExceptions": [ + "GetIntrinsic", + ], + }], + }, +} diff --git a/project starter code/node_modules/es-define-property/.github/FUNDING.yml b/project starter code/node_modules/es-define-property/.github/FUNDING.yml new file mode 100644 index 00000000..4445451f --- /dev/null +++ b/project starter code/node_modules/es-define-property/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/es-define-property +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with a single custom sponsorship URL diff --git a/project starter code/node_modules/es-define-property/.nycrc b/project starter code/node_modules/es-define-property/.nycrc new file mode 100644 index 00000000..bdd626ce --- /dev/null +++ b/project starter code/node_modules/es-define-property/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/project starter code/node_modules/es-define-property/CHANGELOG.md b/project starter code/node_modules/es-define-property/CHANGELOG.md new file mode 100644 index 00000000..4dce2ec5 --- /dev/null +++ b/project starter code/node_modules/es-define-property/CHANGELOG.md @@ -0,0 +1,15 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## v1.0.0 - 2024-02-12 + +### Commits + +- Initial implementation, tests, readme, types [`3e154e1`](https://github.com/ljharb/es-define-property/commit/3e154e11a2fee09127220f5e503bf2c0a31dd480) +- Initial commit [`07d98de`](https://github.com/ljharb/es-define-property/commit/07d98de34a4dc31ff5e83a37c0c3f49e0d85cd50) +- npm init [`c4eb634`](https://github.com/ljharb/es-define-property/commit/c4eb6348b0d3886aac36cef34ad2ee0665ea6f3e) +- Only apps should have lockfiles [`7af86ec`](https://github.com/ljharb/es-define-property/commit/7af86ec1d311ec0b17fdfe616a25f64276903856) diff --git a/project starter code/node_modules/es-define-property/LICENSE b/project starter code/node_modules/es-define-property/LICENSE new file mode 100644 index 00000000..f82f3896 --- /dev/null +++ b/project starter code/node_modules/es-define-property/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/project starter code/node_modules/es-define-property/README.md b/project starter code/node_modules/es-define-property/README.md new file mode 100644 index 00000000..9b291bdd --- /dev/null +++ b/project starter code/node_modules/es-define-property/README.md @@ -0,0 +1,49 @@ +# es-define-property [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +`Object.defineProperty`, but not IE 8's broken one. + +## Example + +```js +const assert = require('assert'); + +const $defineProperty = require('es-define-property'); + +if ($defineProperty) { + assert.equal($defineProperty, Object.defineProperty); +} else if (Object.defineProperty) { + assert.equal($defineProperty, false, 'this is IE 8'); +} else { + assert.equal($defineProperty, false, 'this is an ES3 engine'); +} +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +## Security + +Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. + +[package-url]: https://npmjs.org/package/es-define-property +[npm-version-svg]: https://versionbadg.es/ljharb/es-define-property.svg +[deps-svg]: https://david-dm.org/ljharb/es-define-property.svg +[deps-url]: https://david-dm.org/ljharb/es-define-property +[dev-deps-svg]: https://david-dm.org/ljharb/es-define-property/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/es-define-property#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/es-define-property.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/es-define-property.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/es-define-property.svg +[downloads-url]: https://npm-stat.com/charts.html?package=es-define-property +[codecov-image]: https://codecov.io/gh/ljharb/es-define-property/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/es-define-property/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/es-define-property +[actions-url]: https://github.com/ljharb/es-define-property/actions diff --git a/project starter code/node_modules/es-define-property/index.d.ts b/project starter code/node_modules/es-define-property/index.d.ts new file mode 100644 index 00000000..6012247c --- /dev/null +++ b/project starter code/node_modules/es-define-property/index.d.ts @@ -0,0 +1,3 @@ +declare const defineProperty: false | typeof Object.defineProperty; + +export = defineProperty; \ No newline at end of file diff --git a/project starter code/node_modules/es-define-property/index.js b/project starter code/node_modules/es-define-property/index.js new file mode 100644 index 00000000..f32737d2 --- /dev/null +++ b/project starter code/node_modules/es-define-property/index.js @@ -0,0 +1,16 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +/** @type {import('.')} */ +var $defineProperty = GetIntrinsic('%Object.defineProperty%', true) || false; +if ($defineProperty) { + try { + $defineProperty({}, 'a', { value: 1 }); + } catch (e) { + // IE 8 has a broken defineProperty + $defineProperty = false; + } +} + +module.exports = $defineProperty; diff --git a/project starter code/node_modules/es-define-property/package.json b/project starter code/node_modules/es-define-property/package.json new file mode 100644 index 00000000..45bc90f3 --- /dev/null +++ b/project starter code/node_modules/es-define-property/package.json @@ -0,0 +1,81 @@ +{ + "name": "es-define-property", + "version": "1.0.0", + "description": "`Object.defineProperty`, but not IE 8's broken one.", + "main": "index.js", + "types": "./index.d.ts", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -p .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/es-define-property.git" + }, + "keywords": [ + "javascript", + "ecmascript", + "object", + "define", + "property", + "defineProperty", + "Object.defineProperty" + ], + "author": "Jordan Harband ", + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/es-define-property/issues" + }, + "homepage": "https://github.com/ljharb/es-define-property#readme", + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "@types/get-intrinsic": "^1.2.2", + "@types/gopd": "^1.0.3", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eslint": "^8.8.0", + "evalmd": "^0.0.19", + "gopd": "^1.0.1", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.4", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/project starter code/node_modules/es-define-property/test/index.js b/project starter code/node_modules/es-define-property/test/index.js new file mode 100644 index 00000000..dbc054ef --- /dev/null +++ b/project starter code/node_modules/es-define-property/test/index.js @@ -0,0 +1,55 @@ +'use strict'; + +var $defineProperty = require('../'); + +var test = require('tape'); +var gOPD = require('gopd'); + +test('defineProperty: supported', { skip: !$defineProperty }, function (t) { + t.plan(4); + + t.equal(typeof $defineProperty, 'function', 'defineProperty is supported'); + if ($defineProperty && gOPD) { // this `if` check is just to shut TS up + var o = { a: 1 }; + + $defineProperty(o, 'b', { enumerable: true, value: 2 }); + t.deepEqual( + gOPD(o, 'b'), + { + configurable: false, + enumerable: true, + value: 2, + writable: false + }, + 'property descriptor is as expected' + ); + + $defineProperty(o, 'c', { enumerable: false, value: 3, writable: true }); + t.deepEqual( + gOPD(o, 'c'), + { + configurable: false, + enumerable: false, + value: 3, + writable: true + }, + 'property descriptor is as expected' + ); + } + + t.equal($defineProperty, Object.defineProperty, 'defineProperty is Object.defineProperty'); + + t.end(); +}); + +test('defineProperty: not supported', { skip: !!$defineProperty }, function (t) { + t.notOk($defineProperty, 'defineProperty is not supported'); + + t.match( + typeof $defineProperty, + /^(?:undefined|boolean)$/, + '`typeof defineProperty` is `undefined` or `boolean`' + ); + + t.end(); +}); diff --git a/project starter code/node_modules/es-define-property/tsconfig.json b/project starter code/node_modules/es-define-property/tsconfig.json new file mode 100644 index 00000000..fdfa1550 --- /dev/null +++ b/project starter code/node_modules/es-define-property/tsconfig.json @@ -0,0 +1,50 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + + /* Language and Environment */ + "target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": ["types"], /* Specify multiple folders that act like `./node_modules/@types`. */ + "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ + "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ + "noEmit": true, /* Disable emitting files from a compilation. */ + + /* Interop Constraints */ + "allowSyntheticDefaultImports": true, /* Allow `import x from y` when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + + /* Completeness */ + // "skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "exclude": [ + "coverage", + "test/list-exports" + ], +} diff --git a/project starter code/node_modules/es-errors/.eslintrc b/project starter code/node_modules/es-errors/.eslintrc new file mode 100644 index 00000000..3b5d9e90 --- /dev/null +++ b/project starter code/node_modules/es-errors/.eslintrc @@ -0,0 +1,5 @@ +{ + "root": true, + + "extends": "@ljharb", +} diff --git a/project starter code/node_modules/es-errors/.github/FUNDING.yml b/project starter code/node_modules/es-errors/.github/FUNDING.yml new file mode 100644 index 00000000..f1b88055 --- /dev/null +++ b/project starter code/node_modules/es-errors/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/es-errors +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with a single custom sponsorship URL diff --git a/project starter code/node_modules/es-errors/CHANGELOG.md b/project starter code/node_modules/es-errors/CHANGELOG.md new file mode 100644 index 00000000..204a9e90 --- /dev/null +++ b/project starter code/node_modules/es-errors/CHANGELOG.md @@ -0,0 +1,40 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.3.0](https://github.com/ljharb/es-errors/compare/v1.2.1...v1.3.0) - 2024-02-05 + +### Commits + +- [New] add `EvalError` and `URIError` [`1927627`](https://github.com/ljharb/es-errors/commit/1927627ba68cb6c829d307231376c967db53acdf) + +## [v1.2.1](https://github.com/ljharb/es-errors/compare/v1.2.0...v1.2.1) - 2024-02-04 + +### Commits + +- [Fix] add missing `exports` entry [`5bb5f28`](https://github.com/ljharb/es-errors/commit/5bb5f280f98922701109d6ebb82eea2257cecc7e) + +## [v1.2.0](https://github.com/ljharb/es-errors/compare/v1.1.0...v1.2.0) - 2024-02-04 + +### Commits + +- [New] add `ReferenceError` [`6d8cf5b`](https://github.com/ljharb/es-errors/commit/6d8cf5bbb6f3f598d02cf6f30e468ba2caa8e143) + +## [v1.1.0](https://github.com/ljharb/es-errors/compare/v1.0.0...v1.1.0) - 2024-02-04 + +### Commits + +- [New] add base Error [`2983ab6`](https://github.com/ljharb/es-errors/commit/2983ab65f7bc5441276cb021dc3aa03c78881698) + +## v1.0.0 - 2024-02-03 + +### Commits + +- Initial implementation, tests, readme, type [`8f47631`](https://github.com/ljharb/es-errors/commit/8f476317e9ad76f40ad648081829b1a1a3a1288b) +- Initial commit [`ea5d099`](https://github.com/ljharb/es-errors/commit/ea5d099ef18e550509ab9e2be000526afd81c385) +- npm init [`6f5ebf9`](https://github.com/ljharb/es-errors/commit/6f5ebf9cead474dadd72b9e63dad315820a089ae) +- Only apps should have lockfiles [`e1a0aeb`](https://github.com/ljharb/es-errors/commit/e1a0aeb7b80f5cfc56be54d6b2100e915d47def8) +- [meta] add `sideEffects` flag [`a9c7d46`](https://github.com/ljharb/es-errors/commit/a9c7d460a492f1d8a241c836bc25a322a19cc043) diff --git a/project starter code/node_modules/es-errors/LICENSE b/project starter code/node_modules/es-errors/LICENSE new file mode 100644 index 00000000..f82f3896 --- /dev/null +++ b/project starter code/node_modules/es-errors/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/project starter code/node_modules/es-errors/README.md b/project starter code/node_modules/es-errors/README.md new file mode 100644 index 00000000..8dbfacfe --- /dev/null +++ b/project starter code/node_modules/es-errors/README.md @@ -0,0 +1,55 @@ +# es-errors [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +A simple cache for a few of the JS Error constructors. + +## Example + +```js +const assert = require('assert'); + +const Base = require('es-errors'); +const Eval = require('es-errors/eval'); +const Range = require('es-errors/range'); +const Ref = require('es-errors/ref'); +const Syntax = require('es-errors/syntax'); +const Type = require('es-errors/type'); +const URI = require('es-errors/uri'); + +assert.equal(Base, Error); +assert.equal(Eval, EvalError); +assert.equal(Range, RangeError); +assert.equal(Ref, ReferenceError); +assert.equal(Syntax, SyntaxError); +assert.equal(Type, TypeError); +assert.equal(URI, URIError); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +## Security + +Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. + +[package-url]: https://npmjs.org/package/es-errors +[npm-version-svg]: https://versionbadg.es/ljharb/es-errors.svg +[deps-svg]: https://david-dm.org/ljharb/es-errors.svg +[deps-url]: https://david-dm.org/ljharb/es-errors +[dev-deps-svg]: https://david-dm.org/ljharb/es-errors/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/es-errors#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/es-errors.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/es-errors.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/es-errors.svg +[downloads-url]: https://npm-stat.com/charts.html?package=es-errors +[codecov-image]: https://codecov.io/gh/ljharb/es-errors/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/es-errors/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/es-errors +[actions-url]: https://github.com/ljharb/es-errors/actions diff --git a/project starter code/node_modules/es-errors/eval.d.ts b/project starter code/node_modules/es-errors/eval.d.ts new file mode 100644 index 00000000..e4210e01 --- /dev/null +++ b/project starter code/node_modules/es-errors/eval.d.ts @@ -0,0 +1,3 @@ +declare const EvalError: EvalErrorConstructor; + +export = EvalError; diff --git a/project starter code/node_modules/es-errors/eval.js b/project starter code/node_modules/es-errors/eval.js new file mode 100644 index 00000000..725ccb61 --- /dev/null +++ b/project starter code/node_modules/es-errors/eval.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./eval')} */ +module.exports = EvalError; diff --git a/project starter code/node_modules/es-errors/index.d.ts b/project starter code/node_modules/es-errors/index.d.ts new file mode 100644 index 00000000..69bdbc92 --- /dev/null +++ b/project starter code/node_modules/es-errors/index.d.ts @@ -0,0 +1,3 @@ +declare const Error: ErrorConstructor; + +export = Error; diff --git a/project starter code/node_modules/es-errors/index.js b/project starter code/node_modules/es-errors/index.js new file mode 100644 index 00000000..cc0c5212 --- /dev/null +++ b/project starter code/node_modules/es-errors/index.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('.')} */ +module.exports = Error; diff --git a/project starter code/node_modules/es-errors/package.json b/project starter code/node_modules/es-errors/package.json new file mode 100644 index 00000000..ff8c2a53 --- /dev/null +++ b/project starter code/node_modules/es-errors/package.json @@ -0,0 +1,80 @@ +{ + "name": "es-errors", + "version": "1.3.0", + "description": "A simple cache for a few of the JS Error constructors.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./eval": "./eval.js", + "./range": "./range.js", + "./ref": "./ref.js", + "./syntax": "./syntax.js", + "./type": "./type.js", + "./uri": "./uri.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run lint", + "test": "npm run tests-only", + "tests-only": "nyc tape 'test/**/*.js'", + "posttest": "aud --production", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -p . && eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git' | grep -v dist/)", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/es-errors.git" + }, + "keywords": [ + "javascript", + "ecmascript", + "error", + "typeerror", + "syntaxerror", + "rangeerror" + ], + "author": "Jordan Harband ", + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/es-errors/issues" + }, + "homepage": "https://github.com/ljharb/es-errors#readme", + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eclint": "^2.8.1", + "eslint": "^8.8.0", + "evalmd": "^0.0.19", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.4", + "typescript": "next" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" + } +} diff --git a/project starter code/node_modules/es-errors/range.d.ts b/project starter code/node_modules/es-errors/range.d.ts new file mode 100644 index 00000000..3a12e864 --- /dev/null +++ b/project starter code/node_modules/es-errors/range.d.ts @@ -0,0 +1,3 @@ +declare const RangeError: RangeErrorConstructor; + +export = RangeError; diff --git a/project starter code/node_modules/es-errors/range.js b/project starter code/node_modules/es-errors/range.js new file mode 100644 index 00000000..2044fe03 --- /dev/null +++ b/project starter code/node_modules/es-errors/range.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./range')} */ +module.exports = RangeError; diff --git a/project starter code/node_modules/es-errors/ref.d.ts b/project starter code/node_modules/es-errors/ref.d.ts new file mode 100644 index 00000000..a13107e2 --- /dev/null +++ b/project starter code/node_modules/es-errors/ref.d.ts @@ -0,0 +1,3 @@ +declare const ReferenceError: ReferenceErrorConstructor; + +export = ReferenceError; diff --git a/project starter code/node_modules/es-errors/ref.js b/project starter code/node_modules/es-errors/ref.js new file mode 100644 index 00000000..d7c430fd --- /dev/null +++ b/project starter code/node_modules/es-errors/ref.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./ref')} */ +module.exports = ReferenceError; diff --git a/project starter code/node_modules/es-errors/syntax.d.ts b/project starter code/node_modules/es-errors/syntax.d.ts new file mode 100644 index 00000000..6a0c53c5 --- /dev/null +++ b/project starter code/node_modules/es-errors/syntax.d.ts @@ -0,0 +1,3 @@ +declare const SyntaxError: SyntaxErrorConstructor; + +export = SyntaxError; diff --git a/project starter code/node_modules/es-errors/syntax.js b/project starter code/node_modules/es-errors/syntax.js new file mode 100644 index 00000000..5f5fddee --- /dev/null +++ b/project starter code/node_modules/es-errors/syntax.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./syntax')} */ +module.exports = SyntaxError; diff --git a/project starter code/node_modules/es-errors/test/index.js b/project starter code/node_modules/es-errors/test/index.js new file mode 100644 index 00000000..1ff02772 --- /dev/null +++ b/project starter code/node_modules/es-errors/test/index.js @@ -0,0 +1,19 @@ +'use strict'; + +var test = require('tape'); + +var E = require('../'); +var R = require('../range'); +var Ref = require('../ref'); +var S = require('../syntax'); +var T = require('../type'); + +test('errors', function (t) { + t.equal(E, Error); + t.equal(R, RangeError); + t.equal(Ref, ReferenceError); + t.equal(S, SyntaxError); + t.equal(T, TypeError); + + t.end(); +}); diff --git a/project starter code/node_modules/es-errors/tsconfig.json b/project starter code/node_modules/es-errors/tsconfig.json new file mode 100644 index 00000000..99dfeb6c --- /dev/null +++ b/project starter code/node_modules/es-errors/tsconfig.json @@ -0,0 +1,49 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + + /* Language and Environment */ + "target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": ["types"], /* Specify multiple folders that act like `./node_modules/@types`. */ + "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ + "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ + "noEmit": true, /* Disable emitting files from a compilation. */ + + /* Interop Constraints */ + "allowSyntheticDefaultImports": true, /* Allow `import x from y` when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + + /* Completeness */ + // "skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "exclude": [ + "coverage", + ], +} diff --git a/project starter code/node_modules/es-errors/type.d.ts b/project starter code/node_modules/es-errors/type.d.ts new file mode 100644 index 00000000..576fb516 --- /dev/null +++ b/project starter code/node_modules/es-errors/type.d.ts @@ -0,0 +1,3 @@ +declare const TypeError: TypeErrorConstructor + +export = TypeError; diff --git a/project starter code/node_modules/es-errors/type.js b/project starter code/node_modules/es-errors/type.js new file mode 100644 index 00000000..9769e44e --- /dev/null +++ b/project starter code/node_modules/es-errors/type.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./type')} */ +module.exports = TypeError; diff --git a/project starter code/node_modules/es-errors/uri.d.ts b/project starter code/node_modules/es-errors/uri.d.ts new file mode 100644 index 00000000..c3261c91 --- /dev/null +++ b/project starter code/node_modules/es-errors/uri.d.ts @@ -0,0 +1,3 @@ +declare const URIError: URIErrorConstructor; + +export = URIError; diff --git a/project starter code/node_modules/es-errors/uri.js b/project starter code/node_modules/es-errors/uri.js new file mode 100644 index 00000000..e9cd1c78 --- /dev/null +++ b/project starter code/node_modules/es-errors/uri.js @@ -0,0 +1,4 @@ +'use strict'; + +/** @type {import('./uri')} */ +module.exports = URIError; diff --git a/project starter code/node_modules/express/History.md b/project starter code/node_modules/express/History.md index e49870fe..ac2e7cf7 100644 --- a/project starter code/node_modules/express/History.md +++ b/project starter code/node_modules/express/History.md @@ -1,3 +1,30 @@ +4.19.2 / 2024-03-25 +========== + + * Improved fix for open redirect allow list bypass + +4.19.1 / 2024-03-20 +========== + + * Allow passing non-strings to res.location with new encoding handling checks + +4.19.0 / 2024-03-20 +========== + + * Prevent open redirect allow list bypass due to encodeurl + * deps: cookie@0.6.0 + +4.18.3 / 2024-02-29 +========== + + * Fix routing requests without method + * deps: body-parser@1.20.2 + - Fix strict json error message on Node.js 19+ + - deps: content-type@~1.0.5 + - deps: raw-body@2.5.2 + * deps: cookie@0.6.0 + - Add `partitioned` option + 4.18.2 / 2022-10-08 =================== @@ -2111,7 +2138,7 @@ * deps: connect@2.21.0 - deprecate `connect(middleware)` -- use `app.use(middleware)` instead - deprecate `connect.createServer()` -- use `connect()` instead - - fix `res.setHeader()` patch to work with with get -> append -> set pattern + - fix `res.setHeader()` patch to work with get -> append -> set pattern - deps: compression@~1.0.8 - deps: errorhandler@~1.1.1 - deps: express-session@~1.5.0 @@ -3322,8 +3349,8 @@ Shaw] * Added node v0.1.97 compatibility * Added support for deleting cookies via Request#cookie('key', null) * Updated haml submodule - * Fixed not-found page, now using using charset utf-8 - * Fixed show-exceptions page, now using using charset utf-8 + * Fixed not-found page, now using charset utf-8 + * Fixed show-exceptions page, now using charset utf-8 * Fixed view support due to fs.readFile Buffers * Changed; mime.type() no longer accepts ".type" due to node extname() changes @@ -3358,7 +3385,7 @@ Shaw] ================== * Added charset support via Request#charset (automatically assigned to 'UTF-8' when respond()'s - encoding is set to 'utf8' or 'utf-8'. + encoding is set to 'utf8' or 'utf-8'). * Added "encoding" option to Request#render(). Closes #299 * Added "dump exceptions" setting, which is enabled by default. * Added simple ejs template engine support @@ -3397,7 +3424,7 @@ Shaw] * Added [haml.js](http://github.com/visionmedia/haml.js) submodule; removed haml-js * Added callback function support to Request#halt() as 3rd/4th arg * Added preprocessing of route param wildcards using param(). Closes #251 - * Added view partial support (with collections etc) + * Added view partial support (with collections etc.) * Fixed bug preventing falsey params (such as ?page=0). Closes #286 * Fixed setting of multiple cookies. Closes #199 * Changed; view naming convention is now NAME.TYPE.ENGINE (for example page.html.haml) diff --git a/project starter code/node_modules/express/Readme.md b/project starter code/node_modules/express/Readme.md index 0936816b..d0f3cf56 100644 --- a/project starter code/node_modules/express/Readme.md +++ b/project starter code/node_modules/express/Readme.md @@ -104,7 +104,7 @@ $ npm start To view the examples, clone the Express repo and install the dependencies: ```console -$ git clone git://github.com/expressjs/express.git --depth 1 +$ git clone https://github.com/expressjs/express.git --depth 1 $ cd express $ npm install ``` diff --git a/project starter code/node_modules/express/index.js b/project starter code/node_modules/express/index.js index 6551c202..d219b0c8 100644 --- a/project starter code/node_modules/express/index.js +++ b/project starter code/node_modules/express/index.js @@ -8,4 +8,4 @@ 'use strict'; -module.exports = require('express/lib/express'); +module.exports = require('./lib/express'); diff --git a/project starter code/node_modules/express/lib/express.js b/project starter code/node_modules/express/lib/express.js index 11c942f2..d188a16d 100644 --- a/project starter code/node_modules/express/lib/express.js +++ b/project starter code/node_modules/express/lib/express.js @@ -15,11 +15,11 @@ var bodyParser = require('body-parser') var EventEmitter = require('events').EventEmitter; var mixin = require('merge-descriptors'); -var proto = require('express/lib/application'); -var Route = require('express/lib/router/route'); -var Router = require('express/lib/router'); -var req = require('express/lib/request'); -var res = require('express/lib/response'); +var proto = require('./application'); +var Route = require('./router/route'); +var Router = require('./router'); +var req = require('./request'); +var res = require('./response'); /** * Expose `createApplication()`. @@ -76,7 +76,7 @@ exports.Router = Router; */ exports.json = bodyParser.json -exports.query = require('express/lib/middleware/query'); +exports.query = require('./middleware/query'); exports.raw = bodyParser.raw exports.static = require('serve-static'); exports.text = bodyParser.text diff --git a/project starter code/node_modules/express/lib/response.js b/project starter code/node_modules/express/lib/response.js index fede486c..dd7b3c82 100644 --- a/project starter code/node_modules/express/lib/response.js +++ b/project starter code/node_modules/express/lib/response.js @@ -55,6 +55,7 @@ module.exports = res */ var charsetRegExp = /;\s*charset\s*=/; +var schemaAndHostRegExp = /^(?:[a-zA-Z][a-zA-Z0-9+.-]*:)?\/\/[^\\\/\?]+/; /** * Set status `code`. @@ -904,15 +905,23 @@ res.cookie = function (name, value, options) { */ res.location = function location(url) { - var loc = url; + var loc; // "back" is an alias for the referrer if (url === 'back') { loc = this.req.get('Referrer') || '/'; + } else { + loc = String(url); } - // set location - return this.set('Location', encodeUrl(loc)); + var m = schemaAndHostRegExp.exec(loc); + var pos = m ? m[0].length + 1 : 0; + + // Only encode after host to avoid invalid encoding which can introduce + // vulnerabilities (e.g. `\\` to `%5C`). + loc = loc.slice(0, pos) + encodeUrl(loc.slice(pos)); + + return this.set('Location', loc); }; /** diff --git a/project starter code/node_modules/express/lib/router/index.js b/project starter code/node_modules/express/lib/router/index.js index 5174c34f..abb3a6f5 100644 --- a/project starter code/node_modules/express/lib/router/index.js +++ b/project starter code/node_modules/express/lib/router/index.js @@ -36,7 +36,7 @@ var toString = Object.prototype.toString; * Initialize a new `Router` with the given `options`. * * @param {Object} [options] - * @return {Router} which is an callable function + * @return {Router} which is a callable function * @public */ diff --git a/project starter code/node_modules/express/lib/router/route.js b/project starter code/node_modules/express/lib/router/route.js index cc643ac8..a65756d6 100644 --- a/project starter code/node_modules/express/lib/router/route.js +++ b/project starter code/node_modules/express/lib/router/route.js @@ -60,7 +60,10 @@ Route.prototype._handles_method = function _handles_method(method) { return true; } - var name = method.toLowerCase(); + // normalize name + var name = typeof method === 'string' + ? method.toLowerCase() + : method if (name === 'head' && !this.methods['head']) { name = 'get'; @@ -103,8 +106,10 @@ Route.prototype.dispatch = function dispatch(req, res, done) { if (stack.length === 0) { return done(); } + var method = typeof req.method === 'string' + ? req.method.toLowerCase() + : req.method - var method = req.method.toLowerCase(); if (method === 'head' && !this.methods['head']) { method = 'get'; } diff --git a/project starter code/node_modules/express/lib/utils.js b/project starter code/node_modules/express/lib/utils.js index 799a6a2b..56e12b9b 100644 --- a/project starter code/node_modules/express/lib/utils.js +++ b/project starter code/node_modules/express/lib/utils.js @@ -117,17 +117,15 @@ exports.contentDisposition = deprecate.function(contentDisposition, /** * Parse accept params `str` returning an * object with `.value`, `.quality` and `.params`. - * also includes `.originalIndex` for stable sorting * * @param {String} str - * @param {Number} index * @return {Object} * @api private */ -function acceptParams(str, index) { +function acceptParams (str) { var parts = str.split(/ *; */); - var ret = { value: parts[0], quality: 1, params: {}, originalIndex: index }; + var ret = { value: parts[0], quality: 1, params: {} } for (var i = 1; i < parts.length; ++i) { var pms = parts[i].split(/ *= */); @@ -282,6 +280,7 @@ function createETagGenerator (options) { /** * Parse an extended query string with qs. * + * @param {String} str * @return {Object} * @private */ diff --git a/project starter code/node_modules/express/package.json b/project starter code/node_modules/express/package.json index 0996637d..f299d882 100644 --- a/project starter code/node_modules/express/package.json +++ b/project starter code/node_modules/express/package.json @@ -1,7 +1,7 @@ { "name": "express", "description": "Fast, unopinionated, minimalist web framework", - "version": "4.18.2", + "version": "4.19.2", "author": "TJ Holowaychuk ", "contributors": [ "Aaron Heckmann ", @@ -30,10 +30,10 @@ "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.1", + "body-parser": "1.20.2", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.5.0", + "cookie": "0.6.0", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", @@ -65,15 +65,14 @@ "connect-redis": "3.4.2", "cookie-parser": "1.4.6", "cookie-session": "2.0.0", - "ejs": "3.1.8", - "eslint": "8.24.0", + "ejs": "3.1.9", + "eslint": "8.47.0", "express-session": "1.17.2", "hbs": "4.2.0", "marked": "0.7.0", "method-override": "3.0.0", - "mocha": "10.0.0", + "mocha": "10.2.0", "morgan": "1.10.0", - "multiparty": "4.2.3", "nyc": "15.1.0", "pbkdf2-password": "1.2.1", "supertest": "6.3.0", diff --git a/project starter code/node_modules/file-type/browser.d.ts b/project starter code/node_modules/file-type/browser.d.ts new file mode 100644 index 00000000..5aeacb6e --- /dev/null +++ b/project starter code/node_modules/file-type/browser.d.ts @@ -0,0 +1,50 @@ +/// +import * as core from './core'; + +export type FileTypeResult = core.FileTypeResult; +export type FileExtension = core.FileExtension; +export type MimeType = core.MimeType; + +/** +Determine file type from a [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream). + +``` +import FileType = require('file-type/browser'); + +const url = 'https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg'; + +(async () => { + const response = await fetch(url); + const fileType = await FileType.fromStream(response.body); + + console.log(fileType); + //=> {ext: 'jpg', mime: 'image/jpeg'} +})(); +``` +*/ +export declare function fromStream(stream: ReadableStream): Promise; + +/** +Determine file type from a [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob). + +``` +import FileType = require('file-type/browser'); + +(async () => { + const blob = new Blob([''], { + type: 'plain/text', + endings: 'native' + }); + + console.log(await FileType.fromBlob(blob)); + //=> {ext: 'txt', mime: 'plain/text'} +})(); +``` +*/ +export declare function fromBlob(blob: Blob): Promise; + +export { + fromBuffer, + extensions, + mimeTypes +} from './core'; diff --git a/project starter code/node_modules/file-type/browser.js b/project starter code/node_modules/file-type/browser.js new file mode 100644 index 00000000..299dd767 --- /dev/null +++ b/project starter code/node_modules/file-type/browser.js @@ -0,0 +1,49 @@ +'use strict'; +const {ReadableWebToNodeStream} = require('readable-web-to-node-stream'); +const core = require('./core'); + +async function fromStream(stream) { + const readableWebToNodeStream = new ReadableWebToNodeStream(stream); + const fileType = await core.fromStream(readableWebToNodeStream); + await readableWebToNodeStream.close(); + return fileType; +} + +async function fromBlob(blob) { + const buffer = await blobToArrayBuffer(blob); + return core.fromBuffer(Buffer.from(buffer)); +} + +/** +Convert Blobs to ArrayBuffer. +@param {Blob} blob - Web API Blob. +@returns {Promise} +*/ +function blobToArrayBuffer(blob) { + if (blob.arrayBuffer) { + return blob.arrayBuffer(); + } + + // TODO: Remove when stop supporting older environments + return new Promise((resolve, reject) => { + const fileReader = new FileReader(); + fileReader.addEventListener('loadend', event => { + resolve(event.target.result); + }); + + fileReader.addEventListener('error', event => { + reject(new Error(event.message)); + }); + + fileReader.addEventListener('abort', event => { + reject(new Error(event.type)); + }); + + fileReader.readAsArrayBuffer(blob); + }); +} + +Object.assign(module.exports, core, { + fromStream, + fromBlob +}); diff --git a/project starter code/node_modules/file-type/core.d.ts b/project starter code/node_modules/file-type/core.d.ts new file mode 100644 index 00000000..e234094a --- /dev/null +++ b/project starter code/node_modules/file-type/core.d.ts @@ -0,0 +1,386 @@ +/// +import {Readable as ReadableStream} from 'stream'; +import {ITokenizer} from 'strtok3/lib/core'; + +declare namespace core { + type FileExtension = + | 'jpg' + | 'png' + | 'apng' + | 'gif' + | 'webp' + | 'flif' + | 'xcf' + | 'cr2' + | 'cr3' + | 'orf' + | 'arw' + | 'dng' + | 'nef' + | 'rw2' + | 'raf' + | 'tif' + | 'bmp' + | 'icns' + | 'jxr' + | 'psd' + | 'indd' + | 'zip' + | 'tar' + | 'rar' + | 'gz' + | 'bz2' + | '7z' + | 'dmg' + | 'mp4' + | 'mid' + | 'mkv' + | 'webm' + | 'mov' + | 'avi' + | 'mpg' + | 'mp2' + | 'mp3' + | 'm4a' + | 'ogg' + | 'opus' + | 'flac' + | 'wav' + | 'qcp' + | 'amr' + | 'pdf' + | 'epub' + | 'mobi' + | 'exe' + | 'swf' + | 'rtf' + | 'woff' + | 'woff2' + | 'eot' + | 'ttf' + | 'otf' + | 'ico' + | 'flv' + | 'ps' + | 'xz' + | 'sqlite' + | 'nes' + | 'crx' + | 'xpi' + | 'cab' + | 'deb' + | 'ar' + | 'rpm' + | 'Z' + | 'lz' + | 'cfb' + | 'mxf' + | 'mts' + | 'wasm' + | 'blend' + | 'bpg' + | 'docx' + | 'pptx' + | 'xlsx' + | '3gp' + | '3g2' + | 'jp2' + | 'jpm' + | 'jpx' + | 'mj2' + | 'aif' + | 'odt' + | 'ods' + | 'odp' + | 'xml' + | 'heic' + | 'cur' + | 'ktx' + | 'ape' + | 'wv' + | 'asf' + | 'dcm' + | 'mpc' + | 'ics' + | 'glb' + | 'pcap' + | 'dsf' + | 'lnk' + | 'alias' + | 'voc' + | 'ac3' + | 'm4b' + | 'm4p' + | 'm4v' + | 'f4a' + | 'f4b' + | 'f4p' + | 'f4v' + | 'mie' + | 'ogv' + | 'ogm' + | 'oga' + | 'spx' + | 'ogx' + | 'arrow' + | 'shp' + | 'aac' + | 'mp1' + | 'it' + | 's3m' + | 'xm' + | 'ai' + | 'skp' + | 'avif' + | 'eps' + | 'lzh' + | 'pgp' + | 'asar' + | 'stl' + | 'chm' + | '3mf' + | 'zst' + | 'jxl' + | 'vcf'; + + type MimeType = + | 'image/jpeg' + | 'image/png' + | 'image/gif' + | 'image/webp' + | 'image/flif' + | 'image/x-xcf' + | 'image/x-canon-cr2' + | 'image/x-canon-cr3' + | 'image/tiff' + | 'image/bmp' + | 'image/icns' + | 'image/vnd.ms-photo' + | 'image/vnd.adobe.photoshop' + | 'application/x-indesign' + | 'application/epub+zip' + | 'application/x-xpinstall' + | 'application/vnd.oasis.opendocument.text' + | 'application/vnd.oasis.opendocument.spreadsheet' + | 'application/vnd.oasis.opendocument.presentation' + | 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' + | 'application/vnd.openxmlformats-officedocument.presentationml.presentation' + | 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + | 'application/zip' + | 'application/x-tar' + | 'application/x-rar-compressed' + | 'application/gzip' + | 'application/x-bzip2' + | 'application/x-7z-compressed' + | 'application/x-apple-diskimage' + | 'video/mp4' + | 'audio/midi' + | 'video/x-matroska' + | 'video/webm' + | 'video/quicktime' + | 'video/vnd.avi' + | 'audio/vnd.wave' + | 'audio/qcelp' + | 'audio/x-ms-asf' + | 'video/x-ms-asf' + | 'application/vnd.ms-asf' + | 'video/mpeg' + | 'video/3gpp' + | 'audio/mpeg' + | 'audio/mp4' // RFC 4337 + | 'audio/opus' + | 'video/ogg' + | 'audio/ogg' + | 'application/ogg' + | 'audio/x-flac' + | 'audio/ape' + | 'audio/wavpack' + | 'audio/amr' + | 'application/pdf' + | 'application/x-msdownload' + | 'application/x-shockwave-flash' + | 'application/rtf' + | 'application/wasm' + | 'font/woff' + | 'font/woff2' + | 'application/vnd.ms-fontobject' + | 'font/ttf' + | 'font/otf' + | 'image/x-icon' + | 'video/x-flv' + | 'application/postscript' + | 'application/eps' + | 'application/x-xz' + | 'application/x-sqlite3' + | 'application/x-nintendo-nes-rom' + | 'application/x-google-chrome-extension' + | 'application/vnd.ms-cab-compressed' + | 'application/x-deb' + | 'application/x-unix-archive' + | 'application/x-rpm' + | 'application/x-compress' + | 'application/x-lzip' + | 'application/x-cfb' + | 'application/x-mie' + | 'application/x-apache-arrow' + | 'application/mxf' + | 'video/mp2t' + | 'application/x-blender' + | 'image/bpg' + | 'image/jp2' + | 'image/jpx' + | 'image/jpm' + | 'image/mj2' + | 'audio/aiff' + | 'application/xml' + | 'application/x-mobipocket-ebook' + | 'image/heif' + | 'image/heif-sequence' + | 'image/heic' + | 'image/heic-sequence' + | 'image/ktx' + | 'application/dicom' + | 'audio/x-musepack' + | 'text/calendar' + | 'text/vcard' + | 'model/gltf-binary' + | 'application/vnd.tcpdump.pcap' + | 'audio/x-dsf' // Non-standard + | 'application/x.ms.shortcut' // Invented by us + | 'application/x.apple.alias' // Invented by us + | 'audio/x-voc' + | 'audio/vnd.dolby.dd-raw' + | 'audio/x-m4a' + | 'image/apng' + | 'image/x-olympus-orf' + | 'image/x-sony-arw' + | 'image/x-adobe-dng' + | 'image/x-nikon-nef' + | 'image/x-panasonic-rw2' + | 'image/x-fujifilm-raf' + | 'video/x-m4v' + | 'video/3gpp2' + | 'application/x-esri-shape' + | 'audio/aac' + | 'audio/x-it' + | 'audio/x-s3m' + | 'audio/x-xm' + | 'video/MP1S' + | 'video/MP2P' + | 'application/vnd.sketchup.skp' + | 'image/avif' + | 'application/x-lzh-compressed' + | 'application/pgp-encrypted' + | 'application/x-asar' + | 'model/stl' + | 'application/vnd.ms-htmlhelp' + | 'model/3mf' + | 'image/jxl' + | 'application/zstd'; + + interface FileTypeResult { + /** + One of the supported [file types](https://github.com/sindresorhus/file-type#supported-file-types). + */ + readonly ext: FileExtension; + + /** + The detected [MIME type](https://en.wikipedia.org/wiki/Internet_media_type). + */ + readonly mime: MimeType; + } + + type ReadableStreamWithFileType = ReadableStream & { + readonly fileType?: FileTypeResult; + }; + + /** + Detect the file type of a `Buffer`, `Uint8Array`, or `ArrayBuffer`. + + The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer. + + If file access is available, it is recommended to use `.fromFile()` instead. + + @param buffer - A buffer representing file data. It works best if the buffer contains the entire file, it may work with a smaller portion as well. + @returns The detected file type and MIME type, or `undefined` when there is no match. + */ + function fromBuffer(buffer: Buffer | Uint8Array | ArrayBuffer): Promise; + + /** + Detect the file type of a Node.js [readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable). + + The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer. + + @param stream - A readable stream representing file data. + @returns The detected file type and MIME type, or `undefined` when there is no match. + */ + function fromStream(stream: ReadableStream): Promise; + + /** + Detect the file type from an [`ITokenizer`](https://github.com/Borewit/strtok3#tokenizer) source. + + This method is used internally, but can also be used for a special "tokenizer" reader. + + A tokenizer propagates the internal read functions, allowing alternative transport mechanisms, to access files, to be implemented and used. + + An example is [`@tokenizer/http`](https://github.com/Borewit/tokenizer-http), which requests data using [HTTP-range-requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests). A difference with a conventional stream and the [*tokenizer*](https://github.com/Borewit/strtok3#tokenizer), is that it is able to *ignore* (seek, fast-forward) in the stream. For example, you may only need and read the first 6 bytes, and the last 128 bytes, which may be an advantage in case reading the entire file would take longer. + + ``` + import {makeTokenizer} = require('@tokenizer/http'); + import FileType = require('file-type'); + + const audioTrackUrl = 'https://test-audio.netlify.com/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/01%20-%20Diablo%20Swing%20Orchestra%20-%20Heroines.mp3'; + + (async () => { + const httpTokenizer = await makeTokenizer(audioTrackUrl); + const fileType = await FileType.fromTokenizer(httpTokenizer); + + console.log(fileType); + //=> {ext: 'mp3', mime: 'audio/mpeg'} + })(); + ``` + + @param tokenizer - File source implementing the tokenizer interface. + @returns The detected file type and MIME type, or `undefined` when there is no match. + */ + function fromTokenizer(tokenizer: ITokenizer): Promise; + + /** + Supported file extensions. + */ + const extensions: Set; + + /** + Supported MIME types. + */ + const mimeTypes: Set; + + /** + Detect the file type of a readable stream. + + @param readableStream - A [readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable) containing a file to examine. + @returns A `Promise` which resolves to the original readable stream argument, but with an added `fileType` property, which is an object like the one returned from `FileType.fromFile()`. + + @example + ``` + import * as fs from 'fs'; + import * as crypto from 'crypto'; + import fileType = require('file-type'); + + (async () => { + const read = fs.createReadStream('encrypted.enc'); + const decipher = crypto.createDecipheriv(alg, key, iv); + const stream = await fileType.stream(read.pipe(decipher)); + + console.log(stream.fileType); + //=> {ext: 'mov', mime: 'video/quicktime'} + + const write = fs.createWriteStream(`decrypted.${stream.fileType.ext}`); + stream.pipe(write); + })(); + ``` + */ + function stream(readableStream: ReadableStream): Promise +} + +export = core; diff --git a/project starter code/node_modules/file-type/core.js b/project starter code/node_modules/file-type/core.js new file mode 100644 index 00000000..d653e66a --- /dev/null +++ b/project starter code/node_modules/file-type/core.js @@ -0,0 +1,1465 @@ +'use strict'; +const Token = require('token-types'); +const strtok3 = require('strtok3/lib/core'); +const { + stringToBytes, + tarHeaderChecksumMatches, + uint32SyncSafeToken +} = require('./util'); +const supported = require('./supported'); + +const minimumBytes = 4100; // A fair amount of file-types are detectable within this range + +async function fromStream(stream) { + const tokenizer = await strtok3.fromStream(stream); + try { + return await fromTokenizer(tokenizer); + } finally { + await tokenizer.close(); + } +} + +async function fromBuffer(input) { + if (!(input instanceof Uint8Array || input instanceof ArrayBuffer || Buffer.isBuffer(input))) { + throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`Buffer\` or \`ArrayBuffer\`, got \`${typeof input}\``); + } + + const buffer = input instanceof Buffer ? input : Buffer.from(input); + + if (!(buffer && buffer.length > 1)) { + return; + } + + const tokenizer = strtok3.fromBuffer(buffer); + return fromTokenizer(tokenizer); +} + +function _check(buffer, headers, options) { + options = { + offset: 0, + ...options + }; + + for (const [index, header] of headers.entries()) { + // If a bitmask is set + if (options.mask) { + // If header doesn't equal `buf` with bits masked off + if (header !== (options.mask[index] & buffer[index + options.offset])) { + return false; + } + } else if (header !== buffer[index + options.offset]) { + return false; + } + } + + return true; +} + +async function fromTokenizer(tokenizer) { + try { + return _fromTokenizer(tokenizer); + } catch (error) { + if (!(error instanceof strtok3.EndOfStreamError)) { + throw error; + } + } +} + +async function _fromTokenizer(tokenizer) { + let buffer = Buffer.alloc(minimumBytes); + const bytesRead = 12; + const check = (header, options) => _check(buffer, header, options); + const checkString = (header, options) => check(stringToBytes(header), options); + + // Keep reading until EOF if the file size is unknown. + if (!tokenizer.fileInfo.size) { + tokenizer.fileInfo.size = Number.MAX_SAFE_INTEGER; + } + + await tokenizer.peekBuffer(buffer, {length: bytesRead, mayBeLess: true}); + + // -- 2-byte signatures -- + + if (check([0x42, 0x4D])) { + return { + ext: 'bmp', + mime: 'image/bmp' + }; + } + + if (check([0x0B, 0x77])) { + return { + ext: 'ac3', + mime: 'audio/vnd.dolby.dd-raw' + }; + } + + if (check([0x78, 0x01])) { + return { + ext: 'dmg', + mime: 'application/x-apple-diskimage' + }; + } + + if (check([0x4D, 0x5A])) { + return { + ext: 'exe', + mime: 'application/x-msdownload' + }; + } + + if (check([0x25, 0x21])) { + await tokenizer.peekBuffer(buffer, {length: 24, mayBeLess: true}); + + if (checkString('PS-Adobe-', {offset: 2}) && + checkString(' EPSF-', {offset: 14})) { + return { + ext: 'eps', + mime: 'application/eps' + }; + } + + return { + ext: 'ps', + mime: 'application/postscript' + }; + } + + if ( + check([0x1F, 0xA0]) || + check([0x1F, 0x9D]) + ) { + return { + ext: 'Z', + mime: 'application/x-compress' + }; + } + + // -- 3-byte signatures -- + + if (check([0xFF, 0xD8, 0xFF])) { + return { + ext: 'jpg', + mime: 'image/jpeg' + }; + } + + if (check([0x49, 0x49, 0xBC])) { + return { + ext: 'jxr', + mime: 'image/vnd.ms-photo' + }; + } + + if (check([0x1F, 0x8B, 0x8])) { + return { + ext: 'gz', + mime: 'application/gzip' + }; + } + + if (check([0x42, 0x5A, 0x68])) { + return { + ext: 'bz2', + mime: 'application/x-bzip2' + }; + } + + if (checkString('ID3')) { + await tokenizer.ignore(6); // Skip ID3 header until the header size + const id3HeaderLen = await tokenizer.readToken(uint32SyncSafeToken); + if (tokenizer.position + id3HeaderLen > tokenizer.fileInfo.size) { + // Guess file type based on ID3 header for backward compatibility + return { + ext: 'mp3', + mime: 'audio/mpeg' + }; + } + + await tokenizer.ignore(id3HeaderLen); + return fromTokenizer(tokenizer); // Skip ID3 header, recursion + } + + // Musepack, SV7 + if (checkString('MP+')) { + return { + ext: 'mpc', + mime: 'audio/x-musepack' + }; + } + + if ( + (buffer[0] === 0x43 || buffer[0] === 0x46) && + check([0x57, 0x53], {offset: 1}) + ) { + return { + ext: 'swf', + mime: 'application/x-shockwave-flash' + }; + } + + // -- 4-byte signatures -- + + if (check([0x47, 0x49, 0x46])) { + return { + ext: 'gif', + mime: 'image/gif' + }; + } + + if (checkString('FLIF')) { + return { + ext: 'flif', + mime: 'image/flif' + }; + } + + if (checkString('8BPS')) { + return { + ext: 'psd', + mime: 'image/vnd.adobe.photoshop' + }; + } + + if (checkString('WEBP', {offset: 8})) { + return { + ext: 'webp', + mime: 'image/webp' + }; + } + + // Musepack, SV8 + if (checkString('MPCK')) { + return { + ext: 'mpc', + mime: 'audio/x-musepack' + }; + } + + if (checkString('FORM')) { + return { + ext: 'aif', + mime: 'audio/aiff' + }; + } + + if (checkString('icns', {offset: 0})) { + return { + ext: 'icns', + mime: 'image/icns' + }; + } + + // Zip-based file formats + // Need to be before the `zip` check + if (check([0x50, 0x4B, 0x3, 0x4])) { // Local file header signature + try { + while (tokenizer.position + 30 < tokenizer.fileInfo.size) { + await tokenizer.readBuffer(buffer, {length: 30}); + + // https://en.wikipedia.org/wiki/Zip_(file_format)#File_headers + const zipHeader = { + compressedSize: buffer.readUInt32LE(18), + uncompressedSize: buffer.readUInt32LE(22), + filenameLength: buffer.readUInt16LE(26), + extraFieldLength: buffer.readUInt16LE(28) + }; + + zipHeader.filename = await tokenizer.readToken(new Token.StringType(zipHeader.filenameLength, 'utf-8')); + await tokenizer.ignore(zipHeader.extraFieldLength); + + // Assumes signed `.xpi` from addons.mozilla.org + if (zipHeader.filename === 'META-INF/mozilla.rsa') { + return { + ext: 'xpi', + mime: 'application/x-xpinstall' + }; + } + + if (zipHeader.filename.endsWith('.rels') || zipHeader.filename.endsWith('.xml')) { + const type = zipHeader.filename.split('/')[0]; + switch (type) { + case '_rels': + break; + case 'word': + return { + ext: 'docx', + mime: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' + }; + case 'ppt': + return { + ext: 'pptx', + mime: 'application/vnd.openxmlformats-officedocument.presentationml.presentation' + }; + case 'xl': + return { + ext: 'xlsx', + mime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + }; + default: + break; + } + } + + if (zipHeader.filename.startsWith('xl/')) { + return { + ext: 'xlsx', + mime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' + }; + } + + if (zipHeader.filename.startsWith('3D/') && zipHeader.filename.endsWith('.model')) { + return { + ext: '3mf', + mime: 'model/3mf' + }; + } + + // The docx, xlsx and pptx file types extend the Office Open XML file format: + // https://en.wikipedia.org/wiki/Office_Open_XML_file_formats + // We look for: + // - one entry named '[Content_Types].xml' or '_rels/.rels', + // - one entry indicating specific type of file. + // MS Office, OpenOffice and LibreOffice may put the parts in different order, so the check should not rely on it. + if (zipHeader.filename === 'mimetype' && zipHeader.compressedSize === zipHeader.uncompressedSize) { + const mimeType = await tokenizer.readToken(new Token.StringType(zipHeader.compressedSize, 'utf-8')); + + switch (mimeType) { + case 'application/epub+zip': + return { + ext: 'epub', + mime: 'application/epub+zip' + }; + case 'application/vnd.oasis.opendocument.text': + return { + ext: 'odt', + mime: 'application/vnd.oasis.opendocument.text' + }; + case 'application/vnd.oasis.opendocument.spreadsheet': + return { + ext: 'ods', + mime: 'application/vnd.oasis.opendocument.spreadsheet' + }; + case 'application/vnd.oasis.opendocument.presentation': + return { + ext: 'odp', + mime: 'application/vnd.oasis.opendocument.presentation' + }; + default: + } + } + + // Try to find next header manually when current one is corrupted + if (zipHeader.compressedSize === 0) { + let nextHeaderIndex = -1; + + while (nextHeaderIndex < 0 && (tokenizer.position < tokenizer.fileInfo.size)) { + await tokenizer.peekBuffer(buffer, {mayBeLess: true}); + + nextHeaderIndex = buffer.indexOf('504B0304', 0, 'hex'); + // Move position to the next header if found, skip the whole buffer otherwise + await tokenizer.ignore(nextHeaderIndex >= 0 ? nextHeaderIndex : buffer.length); + } + } else { + await tokenizer.ignore(zipHeader.compressedSize); + } + } + } catch (error) { + if (!(error instanceof strtok3.EndOfStreamError)) { + throw error; + } + } + + return { + ext: 'zip', + mime: 'application/zip' + }; + } + + if (checkString('OggS')) { + // This is an OGG container + await tokenizer.ignore(28); + const type = Buffer.alloc(8); + await tokenizer.readBuffer(type); + + // Needs to be before `ogg` check + if (_check(type, [0x4F, 0x70, 0x75, 0x73, 0x48, 0x65, 0x61, 0x64])) { + return { + ext: 'opus', + mime: 'audio/opus' + }; + } + + // If ' theora' in header. + if (_check(type, [0x80, 0x74, 0x68, 0x65, 0x6F, 0x72, 0x61])) { + return { + ext: 'ogv', + mime: 'video/ogg' + }; + } + + // If '\x01video' in header. + if (_check(type, [0x01, 0x76, 0x69, 0x64, 0x65, 0x6F, 0x00])) { + return { + ext: 'ogm', + mime: 'video/ogg' + }; + } + + // If ' FLAC' in header https://xiph.org/flac/faq.html + if (_check(type, [0x7F, 0x46, 0x4C, 0x41, 0x43])) { + return { + ext: 'oga', + mime: 'audio/ogg' + }; + } + + // 'Speex ' in header https://en.wikipedia.org/wiki/Speex + if (_check(type, [0x53, 0x70, 0x65, 0x65, 0x78, 0x20, 0x20])) { + return { + ext: 'spx', + mime: 'audio/ogg' + }; + } + + // If '\x01vorbis' in header + if (_check(type, [0x01, 0x76, 0x6F, 0x72, 0x62, 0x69, 0x73])) { + return { + ext: 'ogg', + mime: 'audio/ogg' + }; + } + + // Default OGG container https://www.iana.org/assignments/media-types/application/ogg + return { + ext: 'ogx', + mime: 'application/ogg' + }; + } + + if ( + check([0x50, 0x4B]) && + (buffer[2] === 0x3 || buffer[2] === 0x5 || buffer[2] === 0x7) && + (buffer[3] === 0x4 || buffer[3] === 0x6 || buffer[3] === 0x8) + ) { + return { + ext: 'zip', + mime: 'application/zip' + }; + } + + // + + // File Type Box (https://en.wikipedia.org/wiki/ISO_base_media_file_format) + // It's not required to be first, but it's recommended to be. Almost all ISO base media files start with `ftyp` box. + // `ftyp` box must contain a brand major identifier, which must consist of ISO 8859-1 printable characters. + // Here we check for 8859-1 printable characters (for simplicity, it's a mask which also catches one non-printable character). + if ( + checkString('ftyp', {offset: 4}) && + (buffer[8] & 0x60) !== 0x00 // Brand major, first character ASCII? + ) { + // They all can have MIME `video/mp4` except `application/mp4` special-case which is hard to detect. + // For some cases, we're specific, everything else falls to `video/mp4` with `mp4` extension. + const brandMajor = buffer.toString('binary', 8, 12).replace('\0', ' ').trim(); + switch (brandMajor) { + case 'avif': + return {ext: 'avif', mime: 'image/avif'}; + case 'mif1': + return {ext: 'heic', mime: 'image/heif'}; + case 'msf1': + return {ext: 'heic', mime: 'image/heif-sequence'}; + case 'heic': + case 'heix': + return {ext: 'heic', mime: 'image/heic'}; + case 'hevc': + case 'hevx': + return {ext: 'heic', mime: 'image/heic-sequence'}; + case 'qt': + return {ext: 'mov', mime: 'video/quicktime'}; + case 'M4V': + case 'M4VH': + case 'M4VP': + return {ext: 'm4v', mime: 'video/x-m4v'}; + case 'M4P': + return {ext: 'm4p', mime: 'video/mp4'}; + case 'M4B': + return {ext: 'm4b', mime: 'audio/mp4'}; + case 'M4A': + return {ext: 'm4a', mime: 'audio/x-m4a'}; + case 'F4V': + return {ext: 'f4v', mime: 'video/mp4'}; + case 'F4P': + return {ext: 'f4p', mime: 'video/mp4'}; + case 'F4A': + return {ext: 'f4a', mime: 'audio/mp4'}; + case 'F4B': + return {ext: 'f4b', mime: 'audio/mp4'}; + case 'crx': + return {ext: 'cr3', mime: 'image/x-canon-cr3'}; + default: + if (brandMajor.startsWith('3g')) { + if (brandMajor.startsWith('3g2')) { + return {ext: '3g2', mime: 'video/3gpp2'}; + } + + return {ext: '3gp', mime: 'video/3gpp'}; + } + + return {ext: 'mp4', mime: 'video/mp4'}; + } + } + + if (checkString('MThd')) { + return { + ext: 'mid', + mime: 'audio/midi' + }; + } + + if ( + checkString('wOFF') && + ( + check([0x00, 0x01, 0x00, 0x00], {offset: 4}) || + checkString('OTTO', {offset: 4}) + ) + ) { + return { + ext: 'woff', + mime: 'font/woff' + }; + } + + if ( + checkString('wOF2') && + ( + check([0x00, 0x01, 0x00, 0x00], {offset: 4}) || + checkString('OTTO', {offset: 4}) + ) + ) { + return { + ext: 'woff2', + mime: 'font/woff2' + }; + } + + if (check([0xD4, 0xC3, 0xB2, 0xA1]) || check([0xA1, 0xB2, 0xC3, 0xD4])) { + return { + ext: 'pcap', + mime: 'application/vnd.tcpdump.pcap' + }; + } + + // Sony DSD Stream File (DSF) + if (checkString('DSD ')) { + return { + ext: 'dsf', + mime: 'audio/x-dsf' // Non-standard + }; + } + + if (checkString('LZIP')) { + return { + ext: 'lz', + mime: 'application/x-lzip' + }; + } + + if (checkString('fLaC')) { + return { + ext: 'flac', + mime: 'audio/x-flac' + }; + } + + if (check([0x42, 0x50, 0x47, 0xFB])) { + return { + ext: 'bpg', + mime: 'image/bpg' + }; + } + + if (checkString('wvpk')) { + return { + ext: 'wv', + mime: 'audio/wavpack' + }; + } + + if (checkString('%PDF')) { + await tokenizer.ignore(1350); + const maxBufferSize = 10 * 1024 * 1024; + const buffer = Buffer.alloc(Math.min(maxBufferSize, tokenizer.fileInfo.size)); + await tokenizer.readBuffer(buffer, {mayBeLess: true}); + + // Check if this is an Adobe Illustrator file + if (buffer.includes(Buffer.from('AIPrivateData'))) { + return { + ext: 'ai', + mime: 'application/postscript' + }; + } + + // Assume this is just a normal PDF + return { + ext: 'pdf', + mime: 'application/pdf' + }; + } + + if (check([0x00, 0x61, 0x73, 0x6D])) { + return { + ext: 'wasm', + mime: 'application/wasm' + }; + } + + // TIFF, little-endian type + if (check([0x49, 0x49, 0x2A, 0x0])) { + if (checkString('CR', {offset: 8})) { + return { + ext: 'cr2', + mime: 'image/x-canon-cr2' + }; + } + + if (check([0x1C, 0x00, 0xFE, 0x00], {offset: 8}) || check([0x1F, 0x00, 0x0B, 0x00], {offset: 8})) { + return { + ext: 'nef', + mime: 'image/x-nikon-nef' + }; + } + + if ( + check([0x08, 0x00, 0x00, 0x00], {offset: 4}) && + (check([0x2D, 0x00, 0xFE, 0x00], {offset: 8}) || + check([0x27, 0x00, 0xFE, 0x00], {offset: 8})) + ) { + return { + ext: 'dng', + mime: 'image/x-adobe-dng' + }; + } + + buffer = Buffer.alloc(24); + await tokenizer.peekBuffer(buffer); + if ( + (check([0x10, 0xFB, 0x86, 0x01], {offset: 4}) || check([0x08, 0x00, 0x00, 0x00], {offset: 4})) && + // This pattern differentiates ARW from other TIFF-ish file types: + check([0x00, 0xFE, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x01], {offset: 9}) + ) { + return { + ext: 'arw', + mime: 'image/x-sony-arw' + }; + } + + return { + ext: 'tif', + mime: 'image/tiff' + }; + } + + // TIFF, big-endian type + if (check([0x4D, 0x4D, 0x0, 0x2A])) { + return { + ext: 'tif', + mime: 'image/tiff' + }; + } + + if (checkString('MAC ')) { + return { + ext: 'ape', + mime: 'audio/ape' + }; + } + + // https://github.com/threatstack/libmagic/blob/master/magic/Magdir/matroska + if (check([0x1A, 0x45, 0xDF, 0xA3])) { // Root element: EBML + async function readField() { + const msb = await tokenizer.peekNumber(Token.UINT8); + let mask = 0x80; + let ic = 0; // 0 = A, 1 = B, 2 = C, 3 = D + + while ((msb & mask) === 0 && mask !== 0) { + ++ic; + mask >>= 1; + } + + const id = Buffer.alloc(ic + 1); + await tokenizer.readBuffer(id); + return id; + } + + async function readElement() { + const id = await readField(); + const lenField = await readField(); + lenField[0] ^= 0x80 >> (lenField.length - 1); + const nrLen = Math.min(6, lenField.length); // JavaScript can max read 6 bytes integer + return { + id: id.readUIntBE(0, id.length), + len: lenField.readUIntBE(lenField.length - nrLen, nrLen) + }; + } + + async function readChildren(level, children) { + while (children > 0) { + const e = await readElement(); + if (e.id === 0x4282) { + return tokenizer.readToken(new Token.StringType(e.len, 'utf-8')); // Return DocType + } + + await tokenizer.ignore(e.len); // ignore payload + --children; + } + } + + const re = await readElement(); + const docType = await readChildren(1, re.len); + + switch (docType) { + case 'webm': + return { + ext: 'webm', + mime: 'video/webm' + }; + + case 'matroska': + return { + ext: 'mkv', + mime: 'video/x-matroska' + }; + + default: + return; + } + } + + // RIFF file format which might be AVI, WAV, QCP, etc + if (check([0x52, 0x49, 0x46, 0x46])) { + if (check([0x41, 0x56, 0x49], {offset: 8})) { + return { + ext: 'avi', + mime: 'video/vnd.avi' + }; + } + + if (check([0x57, 0x41, 0x56, 0x45], {offset: 8})) { + return { + ext: 'wav', + mime: 'audio/vnd.wave' + }; + } + + // QLCM, QCP file + if (check([0x51, 0x4C, 0x43, 0x4D], {offset: 8})) { + return { + ext: 'qcp', + mime: 'audio/qcelp' + }; + } + } + + if (checkString('SQLi')) { + return { + ext: 'sqlite', + mime: 'application/x-sqlite3' + }; + } + + if (check([0x4E, 0x45, 0x53, 0x1A])) { + return { + ext: 'nes', + mime: 'application/x-nintendo-nes-rom' + }; + } + + if (checkString('Cr24')) { + return { + ext: 'crx', + mime: 'application/x-google-chrome-extension' + }; + } + + if ( + checkString('MSCF') || + checkString('ISc(') + ) { + return { + ext: 'cab', + mime: 'application/vnd.ms-cab-compressed' + }; + } + + if (check([0xED, 0xAB, 0xEE, 0xDB])) { + return { + ext: 'rpm', + mime: 'application/x-rpm' + }; + } + + if (check([0xC5, 0xD0, 0xD3, 0xC6])) { + return { + ext: 'eps', + mime: 'application/eps' + }; + } + + if (check([0x28, 0xB5, 0x2F, 0xFD])) { + return { + ext: 'zst', + mime: 'application/zstd' + }; + } + + // -- 5-byte signatures -- + + if (check([0x4F, 0x54, 0x54, 0x4F, 0x00])) { + return { + ext: 'otf', + mime: 'font/otf' + }; + } + + if (checkString('#!AMR')) { + return { + ext: 'amr', + mime: 'audio/amr' + }; + } + + if (checkString('{\\rtf')) { + return { + ext: 'rtf', + mime: 'application/rtf' + }; + } + + if (check([0x46, 0x4C, 0x56, 0x01])) { + return { + ext: 'flv', + mime: 'video/x-flv' + }; + } + + if (checkString('IMPM')) { + return { + ext: 'it', + mime: 'audio/x-it' + }; + } + + if ( + checkString('-lh0-', {offset: 2}) || + checkString('-lh1-', {offset: 2}) || + checkString('-lh2-', {offset: 2}) || + checkString('-lh3-', {offset: 2}) || + checkString('-lh4-', {offset: 2}) || + checkString('-lh5-', {offset: 2}) || + checkString('-lh6-', {offset: 2}) || + checkString('-lh7-', {offset: 2}) || + checkString('-lzs-', {offset: 2}) || + checkString('-lz4-', {offset: 2}) || + checkString('-lz5-', {offset: 2}) || + checkString('-lhd-', {offset: 2}) + ) { + return { + ext: 'lzh', + mime: 'application/x-lzh-compressed' + }; + } + + // MPEG program stream (PS or MPEG-PS) + if (check([0x00, 0x00, 0x01, 0xBA])) { + // MPEG-PS, MPEG-1 Part 1 + if (check([0x21], {offset: 4, mask: [0xF1]})) { + return { + ext: 'mpg', // May also be .ps, .mpeg + mime: 'video/MP1S' + }; + } + + // MPEG-PS, MPEG-2 Part 1 + if (check([0x44], {offset: 4, mask: [0xC4]})) { + return { + ext: 'mpg', // May also be .mpg, .m2p, .vob or .sub + mime: 'video/MP2P' + }; + } + } + + if (checkString('ITSF')) { + return { + ext: 'chm', + mime: 'application/vnd.ms-htmlhelp' + }; + } + + // -- 6-byte signatures -- + + if (check([0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00])) { + return { + ext: 'xz', + mime: 'application/x-xz' + }; + } + + if (checkString('')) { + await tokenizer.ignore(8); + const str = await tokenizer.readToken(new Token.StringType(13, 'ascii')); + if (str === 'debian-binary') { + return { + ext: 'deb', + mime: 'application/x-deb' + }; + } + + return { + ext: 'ar', + mime: 'application/x-unix-archive' + }; + } + + // -- 8-byte signatures -- + + if (check([0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A])) { + // APNG format (https://wiki.mozilla.org/APNG_Specification) + // 1. Find the first IDAT (image data) chunk (49 44 41 54) + // 2. Check if there is an "acTL" chunk before the IDAT one (61 63 54 4C) + + // Offset calculated as follows: + // - 8 bytes: PNG signature + // - 4 (length) + 4 (chunk type) + 13 (chunk data) + 4 (CRC): IHDR chunk + + await tokenizer.ignore(8); // ignore PNG signature + + async function readChunkHeader() { + return { + length: await tokenizer.readToken(Token.INT32_BE), + type: await tokenizer.readToken(new Token.StringType(4, 'binary')) + }; + } + + do { + const chunk = await readChunkHeader(); + if (chunk.length < 0) { + return; // Invalid chunk length + } + + switch (chunk.type) { + case 'IDAT': + return { + ext: 'png', + mime: 'image/png' + }; + case 'acTL': + return { + ext: 'apng', + mime: 'image/apng' + }; + default: + await tokenizer.ignore(chunk.length + 4); // Ignore chunk-data + CRC + } + } while (tokenizer.position + 8 < tokenizer.fileInfo.size); + + return { + ext: 'png', + mime: 'image/png' + }; + } + + if (check([0x41, 0x52, 0x52, 0x4F, 0x57, 0x31, 0x00, 0x00])) { + return { + ext: 'arrow', + mime: 'application/x-apache-arrow' + }; + } + + if (check([0x67, 0x6C, 0x54, 0x46, 0x02, 0x00, 0x00, 0x00])) { + return { + ext: 'glb', + mime: 'model/gltf-binary' + }; + } + + // `mov` format variants + if ( + check([0x66, 0x72, 0x65, 0x65], {offset: 4}) || // `free` + check([0x6D, 0x64, 0x61, 0x74], {offset: 4}) || // `mdat` MJPEG + check([0x6D, 0x6F, 0x6F, 0x76], {offset: 4}) || // `moov` + check([0x77, 0x69, 0x64, 0x65], {offset: 4}) // `wide` + ) { + return { + ext: 'mov', + mime: 'video/quicktime' + }; + } + + // -- 9-byte signatures -- + + if (check([0x49, 0x49, 0x52, 0x4F, 0x08, 0x00, 0x00, 0x00, 0x18])) { + return { + ext: 'orf', + mime: 'image/x-olympus-orf' + }; + } + + if (checkString('gimp xcf ')) { + return { + ext: 'xcf', + mime: 'image/x-xcf' + }; + } + + // -- 12-byte signatures -- + + if (check([0x49, 0x49, 0x55, 0x00, 0x18, 0x00, 0x00, 0x00, 0x88, 0xE7, 0x74, 0xD8])) { + return { + ext: 'rw2', + mime: 'image/x-panasonic-rw2' + }; + } + + // ASF_Header_Object first 80 bytes + if (check([0x30, 0x26, 0xB2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xA6, 0xD9])) { + async function readHeader() { + const guid = Buffer.alloc(16); + await tokenizer.readBuffer(guid); + return { + id: guid, + size: Number(await tokenizer.readToken(Token.UINT64_LE)) + }; + } + + await tokenizer.ignore(30); + // Search for header should be in first 1KB of file. + while (tokenizer.position + 24 < tokenizer.fileInfo.size) { + const header = await readHeader(); + let payload = header.size - 24; + if (_check(header.id, [0x91, 0x07, 0xDC, 0xB7, 0xB7, 0xA9, 0xCF, 0x11, 0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65])) { + // Sync on Stream-Properties-Object (B7DC0791-A9B7-11CF-8EE6-00C00C205365) + const typeId = Buffer.alloc(16); + payload -= await tokenizer.readBuffer(typeId); + + if (_check(typeId, [0x40, 0x9E, 0x69, 0xF8, 0x4D, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B])) { + // Found audio: + return { + ext: 'asf', + mime: 'audio/x-ms-asf' + }; + } + + if (_check(typeId, [0xC0, 0xEF, 0x19, 0xBC, 0x4D, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B])) { + // Found video: + return { + ext: 'asf', + mime: 'video/x-ms-asf' + }; + } + + break; + } + + await tokenizer.ignore(payload); + } + + // Default to ASF generic extension + return { + ext: 'asf', + mime: 'application/vnd.ms-asf' + }; + } + + if (check([0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A])) { + return { + ext: 'ktx', + mime: 'image/ktx' + }; + } + + if ((check([0x7E, 0x10, 0x04]) || check([0x7E, 0x18, 0x04])) && check([0x30, 0x4D, 0x49, 0x45], {offset: 4})) { + return { + ext: 'mie', + mime: 'application/x-mie' + }; + } + + if (check([0x27, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], {offset: 2})) { + return { + ext: 'shp', + mime: 'application/x-esri-shape' + }; + } + + if (check([0x00, 0x00, 0x00, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A])) { + // JPEG-2000 family + + await tokenizer.ignore(20); + const type = await tokenizer.readToken(new Token.StringType(4, 'ascii')); + switch (type) { + case 'jp2 ': + return { + ext: 'jp2', + mime: 'image/jp2' + }; + case 'jpx ': + return { + ext: 'jpx', + mime: 'image/jpx' + }; + case 'jpm ': + return { + ext: 'jpm', + mime: 'image/jpm' + }; + case 'mjp2': + return { + ext: 'mj2', + mime: 'image/mj2' + }; + default: + return; + } + } + + if ( + check([0xFF, 0x0A]) || + check([0x00, 0x00, 0x00, 0x0C, 0x4A, 0x58, 0x4C, 0x20, 0x0D, 0x0A, 0x87, 0x0A]) + ) { + return { + ext: 'jxl', + mime: 'image/jxl' + }; + } + + // -- Unsafe signatures -- + + if ( + check([0x0, 0x0, 0x1, 0xBA]) || + check([0x0, 0x0, 0x1, 0xB3]) + ) { + return { + ext: 'mpg', + mime: 'video/mpeg' + }; + } + + if (check([0x00, 0x01, 0x00, 0x00, 0x00])) { + return { + ext: 'ttf', + mime: 'font/ttf' + }; + } + + if (check([0x00, 0x00, 0x01, 0x00])) { + return { + ext: 'ico', + mime: 'image/x-icon' + }; + } + + if (check([0x00, 0x00, 0x02, 0x00])) { + return { + ext: 'cur', + mime: 'image/x-icon' + }; + } + + if (check([0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1])) { + // Detected Microsoft Compound File Binary File (MS-CFB) Format. + return { + ext: 'cfb', + mime: 'application/x-cfb' + }; + } + + // Increase sample size from 12 to 256. + await tokenizer.peekBuffer(buffer, {length: Math.min(256, tokenizer.fileInfo.size), mayBeLess: true}); + + // -- 15-byte signatures -- + + if (checkString('BEGIN:')) { + if (checkString('VCARD', {offset: 6})) { + return { + ext: 'vcf', + mime: 'text/vcard' + }; + } + + if (checkString('VCALENDAR', {offset: 6})) { + return { + ext: 'ics', + mime: 'text/calendar' + }; + } + } + + // `raf` is here just to keep all the raw image detectors together. + if (checkString('FUJIFILMCCD-RAW')) { + return { + ext: 'raf', + mime: 'image/x-fujifilm-raf' + }; + } + + if (checkString('Extended Module:')) { + return { + ext: 'xm', + mime: 'audio/x-xm' + }; + } + + if (checkString('Creative Voice File')) { + return { + ext: 'voc', + mime: 'audio/x-voc' + }; + } + + if (check([0x04, 0x00, 0x00, 0x00]) && buffer.length >= 16) { // Rough & quick check Pickle/ASAR + const jsonSize = buffer.readUInt32LE(12); + if (jsonSize > 12 && buffer.length >= jsonSize + 16) { + try { + const header = buffer.slice(16, jsonSize + 16).toString(); + const json = JSON.parse(header); + // Check if Pickle is ASAR + if (json.files) { // Final check, assuring Pickle/ASAR format + return { + ext: 'asar', + mime: 'application/x-asar' + }; + } + } catch (_) { + } + } + } + + if (check([0x06, 0x0E, 0x2B, 0x34, 0x02, 0x05, 0x01, 0x01, 0x0D, 0x01, 0x02, 0x01, 0x01, 0x02])) { + return { + ext: 'mxf', + mime: 'application/mxf' + }; + } + + if (checkString('SCRM', {offset: 44})) { + return { + ext: 's3m', + mime: 'audio/x-s3m' + }; + } + + if (check([0x47], {offset: 4}) && (check([0x47], {offset: 192}) || check([0x47], {offset: 196}))) { + return { + ext: 'mts', + mime: 'video/mp2t' + }; + } + + if (check([0x42, 0x4F, 0x4F, 0x4B, 0x4D, 0x4F, 0x42, 0x49], {offset: 60})) { + return { + ext: 'mobi', + mime: 'application/x-mobipocket-ebook' + }; + } + + if (check([0x44, 0x49, 0x43, 0x4D], {offset: 128})) { + return { + ext: 'dcm', + mime: 'application/dicom' + }; + } + + if (check([0x4C, 0x00, 0x00, 0x00, 0x01, 0x14, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46])) { + return { + ext: 'lnk', + mime: 'application/x.ms.shortcut' // Invented by us + }; + } + + if (check([0x62, 0x6F, 0x6F, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x6D, 0x61, 0x72, 0x6B, 0x00, 0x00, 0x00, 0x00])) { + return { + ext: 'alias', + mime: 'application/x.apple.alias' // Invented by us + }; + } + + if ( + check([0x4C, 0x50], {offset: 34}) && + ( + check([0x00, 0x00, 0x01], {offset: 8}) || + check([0x01, 0x00, 0x02], {offset: 8}) || + check([0x02, 0x00, 0x02], {offset: 8}) + ) + ) { + return { + ext: 'eot', + mime: 'application/vnd.ms-fontobject' + }; + } + + if (check([0x06, 0x06, 0xED, 0xF5, 0xD8, 0x1D, 0x46, 0xE5, 0xBD, 0x31, 0xEF, 0xE7, 0xFE, 0x74, 0xB7, 0x1D])) { + return { + ext: 'indd', + mime: 'application/x-indesign' + }; + } + + // Increase sample size from 256 to 512 + await tokenizer.peekBuffer(buffer, {length: Math.min(512, tokenizer.fileInfo.size), mayBeLess: true}); + + // Requires a buffer size of 512 bytes + if (tarHeaderChecksumMatches(buffer)) { + return { + ext: 'tar', + mime: 'application/x-tar' + }; + } + + if (check([0xFF, 0xFE, 0xFF, 0x0E, 0x53, 0x00, 0x6B, 0x00, 0x65, 0x00, 0x74, 0x00, 0x63, 0x00, 0x68, 0x00, 0x55, 0x00, 0x70, 0x00, 0x20, 0x00, 0x4D, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x65, 0x00, 0x6C, 0x00])) { + return { + ext: 'skp', + mime: 'application/vnd.sketchup.skp' + }; + } + + if (checkString('-----BEGIN PGP MESSAGE-----')) { + return { + ext: 'pgp', + mime: 'application/pgp-encrypted' + }; + } + + // Check MPEG 1 or 2 Layer 3 header, or 'layer 0' for ADTS (MPEG sync-word 0xFFE) + if (buffer.length >= 2 && check([0xFF, 0xE0], {offset: 0, mask: [0xFF, 0xE0]})) { + if (check([0x10], {offset: 1, mask: [0x16]})) { + // Check for (ADTS) MPEG-2 + if (check([0x08], {offset: 1, mask: [0x08]})) { + return { + ext: 'aac', + mime: 'audio/aac' + }; + } + + // Must be (ADTS) MPEG-4 + return { + ext: 'aac', + mime: 'audio/aac' + }; + } + + // MPEG 1 or 2 Layer 3 header + // Check for MPEG layer 3 + if (check([0x02], {offset: 1, mask: [0x06]})) { + return { + ext: 'mp3', + mime: 'audio/mpeg' + }; + } + + // Check for MPEG layer 2 + if (check([0x04], {offset: 1, mask: [0x06]})) { + return { + ext: 'mp2', + mime: 'audio/mpeg' + }; + } + + // Check for MPEG layer 1 + if (check([0x06], {offset: 1, mask: [0x06]})) { + return { + ext: 'mp1', + mime: 'audio/mpeg' + }; + } + } +} + +const stream = readableStream => new Promise((resolve, reject) => { + // Using `eval` to work around issues when bundling with Webpack + const stream = eval('require')('stream'); // eslint-disable-line no-eval + + readableStream.on('error', reject); + readableStream.once('readable', async () => { + // Set up output stream + const pass = new stream.PassThrough(); + let outputStream; + if (stream.pipeline) { + outputStream = stream.pipeline(readableStream, pass, () => { + }); + } else { + outputStream = readableStream.pipe(pass); + } + + // Read the input stream and detect the filetype + const chunk = readableStream.read(minimumBytes) || readableStream.read() || Buffer.alloc(0); + try { + const fileType = await fromBuffer(chunk); + pass.fileType = fileType; + } catch (error) { + reject(error); + } + + resolve(outputStream); + }); +}); + +const fileType = { + fromStream, + fromTokenizer, + fromBuffer, + stream +}; + +Object.defineProperty(fileType, 'extensions', { + get() { + return new Set(supported.extensions); + } +}); + +Object.defineProperty(fileType, 'mimeTypes', { + get() { + return new Set(supported.mimeTypes); + } +}); + +module.exports = fileType; diff --git a/project starter code/node_modules/file-type/index.d.ts b/project starter code/node_modules/file-type/index.d.ts new file mode 100644 index 00000000..30c8eff5 --- /dev/null +++ b/project starter code/node_modules/file-type/index.d.ts @@ -0,0 +1,27 @@ +/// +import {Readable as ReadableStream} from 'stream'; +import * as core from './core'; + +export type ReadableStreamWithFileType = core.ReadableStreamWithFileType; +export type FileTypeResult = core.FileTypeResult; +export type FileExtension = core.FileExtension; +export type MimeType = core.MimeType; + +/** +Detect the file type of a file path. + +The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer. + +@param path - The file path to parse. +@returns The detected file type and MIME type or `undefined` when there is no match. +*/ +export function fromFile(path: string): Promise; + +export { + fromBuffer, + fromStream, + fromTokenizer, + extensions, + mimeTypes, + stream +} from './core'; diff --git a/project starter code/node_modules/file-type/index.js b/project starter code/node_modules/file-type/index.js index e2d39b65..2c42ac0e 100644 --- a/project starter code/node_modules/file-type/index.js +++ b/project starter code/node_modules/file-type/index.js @@ -1,829 +1,32 @@ 'use strict'; -const toBytes = s => [...s].map(c => c.charCodeAt(0)); -const xpiZipFilename = toBytes('META-INF/mozilla.rsa'); -const oxmlContentTypes = toBytes('[Content_Types].xml'); -const oxmlRels = toBytes('_rels/.rels'); +const strtok3 = require('strtok3'); +const core = require('./core'); -module.exports = input => { - const buf = input instanceof Uint8Array ? input : new Uint8Array(input); - - if (!(buf && buf.length > 1)) { - return null; - } - - const check = (header, options) => { - options = Object.assign({ - offset: 0 - }, options); - - for (let i = 0; i < header.length; i++) { - // If a bitmask is set - if (options.mask) { - // If header doesn't equal `buf` with bits masked off - if (header[i] !== (options.mask[i] & buf[i + options.offset])) { - return false; - } - } else if (header[i] !== buf[i + options.offset]) { - return false; - } - } - - return true; - }; - - const checkString = (header, options) => check(toBytes(header), options); - - if (check([0xFF, 0xD8, 0xFF])) { - return { - ext: 'jpg', - mime: 'image/jpeg' - }; - } - - if (check([0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A])) { - return { - ext: 'png', - mime: 'image/png' - }; - } - - if (check([0x47, 0x49, 0x46])) { - return { - ext: 'gif', - mime: 'image/gif' - }; - } - - if (check([0x57, 0x45, 0x42, 0x50], {offset: 8})) { - return { - ext: 'webp', - mime: 'image/webp' - }; - } - - if (check([0x46, 0x4C, 0x49, 0x46])) { - return { - ext: 'flif', - mime: 'image/flif' - }; - } - - // Needs to be before `tif` check - if ( - (check([0x49, 0x49, 0x2A, 0x0]) || check([0x4D, 0x4D, 0x0, 0x2A])) && - check([0x43, 0x52], {offset: 8}) - ) { - return { - ext: 'cr2', - mime: 'image/x-canon-cr2' - }; - } - - if ( - check([0x49, 0x49, 0x2A, 0x0]) || - check([0x4D, 0x4D, 0x0, 0x2A]) - ) { - return { - ext: 'tif', - mime: 'image/tiff' - }; - } - - if (check([0x42, 0x4D])) { - return { - ext: 'bmp', - mime: 'image/bmp' - }; - } - - if (check([0x49, 0x49, 0xBC])) { - return { - ext: 'jxr', - mime: 'image/vnd.ms-photo' - }; - } - - if (check([0x38, 0x42, 0x50, 0x53])) { - return { - ext: 'psd', - mime: 'image/vnd.adobe.photoshop' - }; - } - - // Zip-based file formats - // Need to be before the `zip` check - if (check([0x50, 0x4B, 0x3, 0x4])) { - if ( - check([0x6D, 0x69, 0x6D, 0x65, 0x74, 0x79, 0x70, 0x65, 0x61, 0x70, 0x70, 0x6C, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x2F, 0x65, 0x70, 0x75, 0x62, 0x2B, 0x7A, 0x69, 0x70], {offset: 30}) - ) { - return { - ext: 'epub', - mime: 'application/epub+zip' - }; - } - - // Assumes signed `.xpi` from addons.mozilla.org - if (check(xpiZipFilename, {offset: 30})) { - return { - ext: 'xpi', - mime: 'application/x-xpinstall' - }; - } - - if (checkString('mimetypeapplication/vnd.oasis.opendocument.text', {offset: 30})) { - return { - ext: 'odt', - mime: 'application/vnd.oasis.opendocument.text' - }; - } - - if (checkString('mimetypeapplication/vnd.oasis.opendocument.spreadsheet', {offset: 30})) { - return { - ext: 'ods', - mime: 'application/vnd.oasis.opendocument.spreadsheet' - }; - } - - if (checkString('mimetypeapplication/vnd.oasis.opendocument.presentation', {offset: 30})) { - return { - ext: 'odp', - mime: 'application/vnd.oasis.opendocument.presentation' - }; - } - - // The docx, xlsx and pptx file types extend the Office Open XML file format: - // https://en.wikipedia.org/wiki/Office_Open_XML_file_formats - // We look for: - // - one entry named '[Content_Types].xml' or '_rels/.rels', - // - one entry indicating specific type of file. - // MS Office, OpenOffice and LibreOffice may put the parts in different order, so the check should not rely on it. - const findNextZipHeaderIndex = (arr, startAt = 0) => arr.findIndex((el, i, arr) => i >= startAt && arr[i] === 0x50 && arr[i + 1] === 0x4B && arr[i + 2] === 0x3 && arr[i + 3] === 0x4); - - let zipHeaderIndex = 0; // The first zip header was already found at index 0 - let oxmlFound = false; - let type = null; - - do { - const offset = zipHeaderIndex + 30; - - if (!oxmlFound) { - oxmlFound = (check(oxmlContentTypes, {offset}) || check(oxmlRels, {offset})); - } - - if (!type) { - if (checkString('word/', {offset})) { - type = { - ext: 'docx', - mime: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' - }; - } else if (checkString('ppt/', {offset})) { - type = { - ext: 'pptx', - mime: 'application/vnd.openxmlformats-officedocument.presentationml.presentation' - }; - } else if (checkString('xl/', {offset})) { - type = { - ext: 'xlsx', - mime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' - }; - } - } - - if (oxmlFound && type) { - return type; - } - - zipHeaderIndex = findNextZipHeaderIndex(buf, offset); - } while (zipHeaderIndex >= 0); - - // No more zip parts available in the buffer, but maybe we are almost certain about the type? - if (type) { - return type; - } - } - - if ( - check([0x50, 0x4B]) && - (buf[2] === 0x3 || buf[2] === 0x5 || buf[2] === 0x7) && - (buf[3] === 0x4 || buf[3] === 0x6 || buf[3] === 0x8) - ) { - return { - ext: 'zip', - mime: 'application/zip' - }; - } - - if (check([0x75, 0x73, 0x74, 0x61, 0x72], {offset: 257})) { - return { - ext: 'tar', - mime: 'application/x-tar' - }; - } - - if ( - check([0x52, 0x61, 0x72, 0x21, 0x1A, 0x7]) && - (buf[6] === 0x0 || buf[6] === 0x1) - ) { - return { - ext: 'rar', - mime: 'application/x-rar-compressed' - }; - } - - if (check([0x1F, 0x8B, 0x8])) { - return { - ext: 'gz', - mime: 'application/gzip' - }; - } - - if (check([0x42, 0x5A, 0x68])) { - return { - ext: 'bz2', - mime: 'application/x-bzip2' - }; - } - - if (check([0x37, 0x7A, 0xBC, 0xAF, 0x27, 0x1C])) { - return { - ext: '7z', - mime: 'application/x-7z-compressed' - }; - } - - if (check([0x78, 0x01])) { - return { - ext: 'dmg', - mime: 'application/x-apple-diskimage' - }; - } - - if (check([0x33, 0x67, 0x70, 0x35]) || // 3gp5 - ( - check([0x0, 0x0, 0x0]) && check([0x66, 0x74, 0x79, 0x70], {offset: 4}) && - ( - check([0x6D, 0x70, 0x34, 0x31], {offset: 8}) || // MP41 - check([0x6D, 0x70, 0x34, 0x32], {offset: 8}) || // MP42 - check([0x69, 0x73, 0x6F, 0x6D], {offset: 8}) || // ISOM - check([0x69, 0x73, 0x6F, 0x32], {offset: 8}) || // ISO2 - check([0x6D, 0x6D, 0x70, 0x34], {offset: 8}) || // MMP4 - check([0x4D, 0x34, 0x56], {offset: 8}) || // M4V - check([0x64, 0x61, 0x73, 0x68], {offset: 8}) // DASH - ) - )) { - return { - ext: 'mp4', - mime: 'video/mp4' - }; - } - - if (check([0x4D, 0x54, 0x68, 0x64])) { - return { - ext: 'mid', - mime: 'audio/midi' - }; - } - - // https://github.com/threatstack/libmagic/blob/master/magic/Magdir/matroska - if (check([0x1A, 0x45, 0xDF, 0xA3])) { - const sliced = buf.subarray(4, 4 + 4096); - const idPos = sliced.findIndex((el, i, arr) => arr[i] === 0x42 && arr[i + 1] === 0x82); - - if (idPos !== -1) { - const docTypePos = idPos + 3; - const findDocType = type => [...type].every((c, i) => sliced[docTypePos + i] === c.charCodeAt(0)); - - if (findDocType('matroska')) { - return { - ext: 'mkv', - mime: 'video/x-matroska' - }; - } - - if (findDocType('webm')) { - return { - ext: 'webm', - mime: 'video/webm' - }; - } - } - } - - if (check([0x0, 0x0, 0x0, 0x14, 0x66, 0x74, 0x79, 0x70, 0x71, 0x74, 0x20, 0x20]) || - check([0x66, 0x72, 0x65, 0x65], {offset: 4}) || - check([0x66, 0x74, 0x79, 0x70, 0x71, 0x74, 0x20, 0x20], {offset: 4}) || - check([0x6D, 0x64, 0x61, 0x74], {offset: 4}) || // MJPEG - check([0x77, 0x69, 0x64, 0x65], {offset: 4})) { - return { - ext: 'mov', - mime: 'video/quicktime' - }; - } - - // RIFF file format which might be AVI, WAV, QCP, etc - if (check([0x52, 0x49, 0x46, 0x46])) { - if (check([0x41, 0x56, 0x49], {offset: 8})) { - return { - ext: 'avi', - mime: 'video/vnd.avi' - }; - } - if (check([0x57, 0x41, 0x56, 0x45], {offset: 8})) { - return { - ext: 'wav', - mime: 'audio/vnd.wave' - }; - } - // QLCM, QCP file - if (check([0x51, 0x4C, 0x43, 0x4D], {offset: 8})) { - return { - ext: 'qcp', - mime: 'audio/qcelp' - }; - } - } - - if (check([0x30, 0x26, 0xB2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xA6, 0xD9])) { - return { - ext: 'wmv', - mime: 'video/x-ms-wmv' - }; - } - - if ( - check([0x0, 0x0, 0x1, 0xBA]) || - check([0x0, 0x0, 0x1, 0xB3]) - ) { - return { - ext: 'mpg', - mime: 'video/mpeg' - }; - } - - if (check([0x66, 0x74, 0x79, 0x70, 0x33, 0x67], {offset: 4})) { - return { - ext: '3gp', - mime: 'video/3gpp' - }; - } - - // Check for MPEG header at different starting offsets - for (let start = 0; start < 2 && start < (buf.length - 16); start++) { - if ( - check([0x49, 0x44, 0x33], {offset: start}) || // ID3 header - check([0xFF, 0xE2], {offset: start, mask: [0xFF, 0xE2]}) // MPEG 1 or 2 Layer 3 header - ) { - return { - ext: 'mp3', - mime: 'audio/mpeg' - }; - } - - if ( - check([0xFF, 0xE4], {offset: start, mask: [0xFF, 0xE4]}) // MPEG 1 or 2 Layer 2 header - ) { - return { - ext: 'mp2', - mime: 'audio/mpeg' - }; - } - - if ( - check([0xFF, 0xF8], {offset: start, mask: [0xFF, 0xFC]}) // MPEG 2 layer 0 using ADTS - ) { - return { - ext: 'mp2', - mime: 'audio/mpeg' - }; - } - - if ( - check([0xFF, 0xF0], {offset: start, mask: [0xFF, 0xFC]}) // MPEG 4 layer 0 using ADTS - ) { - return { - ext: 'mp4', - mime: 'audio/mpeg' - }; - } - } - - if ( - check([0x66, 0x74, 0x79, 0x70, 0x4D, 0x34, 0x41], {offset: 4}) || - check([0x4D, 0x34, 0x41, 0x20]) - ) { - return { // MPEG-4 layer 3 (audio) - ext: 'm4a', - mime: 'audio/mp4' // RFC 4337 - }; - } - - // Needs to be before `ogg` check - if (check([0x4F, 0x70, 0x75, 0x73, 0x48, 0x65, 0x61, 0x64], {offset: 28})) { - return { - ext: 'opus', - mime: 'audio/opus' - }; - } - - // If 'OggS' in first bytes, then OGG container - if (check([0x4F, 0x67, 0x67, 0x53])) { - // This is a OGG container - - // If ' theora' in header. - if (check([0x80, 0x74, 0x68, 0x65, 0x6F, 0x72, 0x61], {offset: 28})) { - return { - ext: 'ogv', - mime: 'video/ogg' - }; - } - // If '\x01video' in header. - if (check([0x01, 0x76, 0x69, 0x64, 0x65, 0x6F, 0x00], {offset: 28})) { - return { - ext: 'ogm', - mime: 'video/ogg' - }; - } - // If ' FLAC' in header https://xiph.org/flac/faq.html - if (check([0x7F, 0x46, 0x4C, 0x41, 0x43], {offset: 28})) { - return { - ext: 'oga', - mime: 'audio/ogg' - }; - } - - // 'Speex ' in header https://en.wikipedia.org/wiki/Speex - if (check([0x53, 0x70, 0x65, 0x65, 0x78, 0x20, 0x20], {offset: 28})) { - return { - ext: 'spx', - mime: 'audio/ogg' - }; - } - - // If '\x01vorbis' in header - if (check([0x01, 0x76, 0x6F, 0x72, 0x62, 0x69, 0x73], {offset: 28})) { - return { - ext: 'ogg', - mime: 'audio/ogg' - }; - } - - // Default OGG container https://www.iana.org/assignments/media-types/application/ogg - return { - ext: 'ogx', - mime: 'application/ogg' - }; - } - - if (check([0x66, 0x4C, 0x61, 0x43])) { - return { - ext: 'flac', - mime: 'audio/x-flac' - }; - } - - if (check([0x4D, 0x41, 0x43, 0x20])) { // 'MAC ' - return { - ext: 'ape', - mime: 'audio/ape' - }; - } - - if (check([0x77, 0x76, 0x70, 0x6B])) { // 'wvpk' - return { - ext: 'wv', - mime: 'audio/wavpack' - }; - } - - if (check([0x23, 0x21, 0x41, 0x4D, 0x52, 0x0A])) { - return { - ext: 'amr', - mime: 'audio/amr' - }; - } - - if (check([0x25, 0x50, 0x44, 0x46])) { - return { - ext: 'pdf', - mime: 'application/pdf' - }; - } - - if (check([0x4D, 0x5A])) { - return { - ext: 'exe', - mime: 'application/x-msdownload' - }; - } - - if ( - (buf[0] === 0x43 || buf[0] === 0x46) && - check([0x57, 0x53], {offset: 1}) - ) { - return { - ext: 'swf', - mime: 'application/x-shockwave-flash' - }; - } - - if (check([0x7B, 0x5C, 0x72, 0x74, 0x66])) { - return { - ext: 'rtf', - mime: 'application/rtf' - }; - } - - if (check([0x00, 0x61, 0x73, 0x6D])) { - return { - ext: 'wasm', - mime: 'application/wasm' - }; - } - - if ( - check([0x77, 0x4F, 0x46, 0x46]) && - ( - check([0x00, 0x01, 0x00, 0x00], {offset: 4}) || - check([0x4F, 0x54, 0x54, 0x4F], {offset: 4}) - ) - ) { - return { - ext: 'woff', - mime: 'font/woff' - }; - } - - if ( - check([0x77, 0x4F, 0x46, 0x32]) && - ( - check([0x00, 0x01, 0x00, 0x00], {offset: 4}) || - check([0x4F, 0x54, 0x54, 0x4F], {offset: 4}) - ) - ) { - return { - ext: 'woff2', - mime: 'font/woff2' - }; - } - - if ( - check([0x4C, 0x50], {offset: 34}) && - ( - check([0x00, 0x00, 0x01], {offset: 8}) || - check([0x01, 0x00, 0x02], {offset: 8}) || - check([0x02, 0x00, 0x02], {offset: 8}) - ) - ) { - return { - ext: 'eot', - mime: 'application/vnd.ms-fontobject' - }; - } - - if (check([0x00, 0x01, 0x00, 0x00, 0x00])) { - return { - ext: 'ttf', - mime: 'font/ttf' - }; - } - - if (check([0x4F, 0x54, 0x54, 0x4F, 0x00])) { - return { - ext: 'otf', - mime: 'font/otf' - }; - } - - if (check([0x00, 0x00, 0x01, 0x00])) { - return { - ext: 'ico', - mime: 'image/x-icon' - }; - } - - if (check([0x00, 0x00, 0x02, 0x00])) { - return { - ext: 'cur', - mime: 'image/x-icon' - }; - } - - if (check([0x46, 0x4C, 0x56, 0x01])) { - return { - ext: 'flv', - mime: 'video/x-flv' - }; - } - - if (check([0x25, 0x21])) { - return { - ext: 'ps', - mime: 'application/postscript' - }; - } - - if (check([0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00])) { - return { - ext: 'xz', - mime: 'application/x-xz' - }; - } - - if (check([0x53, 0x51, 0x4C, 0x69])) { - return { - ext: 'sqlite', - mime: 'application/x-sqlite3' - }; - } - - if (check([0x4E, 0x45, 0x53, 0x1A])) { - return { - ext: 'nes', - mime: 'application/x-nintendo-nes-rom' - }; - } - - if (check([0x43, 0x72, 0x32, 0x34])) { - return { - ext: 'crx', - mime: 'application/x-google-chrome-extension' - }; - } - - if ( - check([0x4D, 0x53, 0x43, 0x46]) || - check([0x49, 0x53, 0x63, 0x28]) - ) { - return { - ext: 'cab', - mime: 'application/vnd.ms-cab-compressed' - }; - } - - // Needs to be before `ar` check - if (check([0x21, 0x3C, 0x61, 0x72, 0x63, 0x68, 0x3E, 0x0A, 0x64, 0x65, 0x62, 0x69, 0x61, 0x6E, 0x2D, 0x62, 0x69, 0x6E, 0x61, 0x72, 0x79])) { - return { - ext: 'deb', - mime: 'application/x-deb' - }; - } - - if (check([0x21, 0x3C, 0x61, 0x72, 0x63, 0x68, 0x3E])) { - return { - ext: 'ar', - mime: 'application/x-unix-archive' - }; - } - - if (check([0xED, 0xAB, 0xEE, 0xDB])) { - return { - ext: 'rpm', - mime: 'application/x-rpm' - }; - } - - if ( - check([0x1F, 0xA0]) || - check([0x1F, 0x9D]) - ) { - return { - ext: 'Z', - mime: 'application/x-compress' - }; - } - - if (check([0x4C, 0x5A, 0x49, 0x50])) { - return { - ext: 'lz', - mime: 'application/x-lzip' - }; - } - - if (check([0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1])) { - return { - ext: 'msi', - mime: 'application/x-msi' - }; - } - - if (check([0x06, 0x0E, 0x2B, 0x34, 0x02, 0x05, 0x01, 0x01, 0x0D, 0x01, 0x02, 0x01, 0x01, 0x02])) { - return { - ext: 'mxf', - mime: 'application/mxf' - }; +async function fromFile(path) { + const tokenizer = await strtok3.fromFile(path); + try { + return await core.fromTokenizer(tokenizer); + } finally { + await tokenizer.close(); } +} - if (check([0x47], {offset: 4}) && (check([0x47], {offset: 192}) || check([0x47], {offset: 196}))) { - return { - ext: 'mts', - mime: 'video/mp2t' - }; - } - - if (check([0x42, 0x4C, 0x45, 0x4E, 0x44, 0x45, 0x52])) { - return { - ext: 'blend', - mime: 'application/x-blender' - }; - } - - if (check([0x42, 0x50, 0x47, 0xFB])) { - return { - ext: 'bpg', - mime: 'image/bpg' - }; - } - - if (check([0x00, 0x00, 0x00, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A])) { - // JPEG-2000 family - - if (check([0x6A, 0x70, 0x32, 0x20], {offset: 20})) { - return { - ext: 'jp2', - mime: 'image/jp2' - }; - } - - if (check([0x6A, 0x70, 0x78, 0x20], {offset: 20})) { - return { - ext: 'jpx', - mime: 'image/jpx' - }; - } - - if (check([0x6A, 0x70, 0x6D, 0x20], {offset: 20})) { - return { - ext: 'jpm', - mime: 'image/jpm' - }; - } - - if (check([0x6D, 0x6A, 0x70, 0x32], {offset: 20})) { - return { - ext: 'mj2', - mime: 'image/mj2' - }; - } - } - - if (check([0x46, 0x4F, 0x52, 0x4D, 0x00])) { - return { - ext: 'aif', - mime: 'audio/aiff' - }; - } - - if (checkString(' (sindresorhus.com) +Copyright (c) Sindre Sorhus (https://sindresorhus.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/project starter code/node_modules/file-type/package.json b/project starter code/node_modules/file-type/package.json index d9ab5db2..82b840b0 100644 --- a/project starter code/node_modules/file-type/package.json +++ b/project starter code/node_modules/file-type/package.json @@ -1,27 +1,37 @@ { "name": "file-type", - "version": "9.0.0", - "description": "Detect the file type of a Buffer/Uint8Array", + "version": "16.5.4", + "description": "Detect the file type of a Buffer/Uint8Array/ArrayBuffer", "license": "MIT", "repository": "sindresorhus/file-type", + "funding": "https://github.com/sindresorhus/file-type?sponsor=1", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" + "url": "https://sindresorhus.com" }, "engines": { - "node": ">=6" + "node": ">=10" }, "scripts": { - "test": "xo && ava" + "ava": "ava --serial --verbose", + "test": "xo && ava && tsd" }, "files": [ - "index.js" + "index.js", + "index.d.ts", + "browser.js", + "browser.d.ts", + "core.js", + "core.d.ts", + "supported.js", + "util.js" ], "keywords": [ "mime", "file", "type", + "magic", "archive", "image", "img", @@ -40,14 +50,25 @@ "uint8array", "jpg", "png", + "apng", "gif", "webp", "flif", + "xcf", "cr2", + "cr3", + "orf", + "arw", + "dng", + "nef", + "rw2", + "raf", "tif", "bmp", + "icns", "jxr", "psd", + "indd", "zip", "tar", "rar", @@ -56,7 +77,6 @@ "7z", "dmg", "mp4", - "m4v", "mid", "mkv", "webm", @@ -93,7 +113,7 @@ "rpm", "Z", "lz", - "msi", + "cfb", "mxf", "mts", "wasm", @@ -113,11 +133,83 @@ "ods", "odp", "xml", - "heic" + "heic", + "ics", + "glb", + "pcap", + "dsf", + "lnk", + "alias", + "voc", + "ac3", + "3g2", + "m4b", + "m4p", + "m4v", + "f4a", + "f4b", + "f4p", + "f4v", + "mie", + "qcp", + "asf", + "ogv", + "ogm", + "oga", + "spx", + "ogx", + "ape", + "wv", + "cur", + "nes", + "crx", + "ktx", + "dcm", + "mpc", + "arrow", + "shp", + "aac", + "mp1", + "it", + "s3m", + "xm", + "ai", + "skp", + "avif", + "eps", + "lzh", + "pgp", + "asar", + "stl", + "chm", + "3mf", + "zst", + "jxl", + "vcf" ], "devDependencies": { - "ava": "*", - "read-chunk": "^2.0.0", - "xo": "*" + "@types/node": "^13.1.4", + "ava": "^2.3.0", + "noop-stream": "^0.1.0", + "read-chunk": "^3.2.0", + "tsd": "^0.11.0", + "xo": "^0.25.3" + }, + "dependencies": { + "readable-web-to-node-stream": "^3.0.0", + "strtok3": "^6.2.4", + "token-types": "^4.1.1" + }, + "xo": { + "envs": [ + "node", + "browser" + ], + "rules": { + "no-inner-declarations": "warn", + "no-await-in-loop": "warn", + "promise/prefer-await-to-then": "warn", + "prefer-named-capture-group": "off" + } } } diff --git a/project starter code/node_modules/file-type/readme.md b/project starter code/node_modules/file-type/readme.md index 187ff715..72474d60 100644 --- a/project starter code/node_modules/file-type/readme.md +++ b/project starter code/node_modules/file-type/readme.md @@ -1,9 +1,40 @@ -# file-type [![Build Status](https://travis-ci.org/sindresorhus/file-type.svg?branch=master)](https://travis-ci.org/sindresorhus/file-type) +# file-type -> Detect the file type of a Buffer/Uint8Array +> Detect the file type of a Buffer/Uint8Array/ArrayBuffer -The file type is detected by checking the [magic number](http://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer. +The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer. +This package is for detecting binary-based file formats, not text-based formats like `.txt`, `.csv`, `.svg`, etc. + +
+ +--- + +
+ +--- + +
## Install @@ -11,177 +42,429 @@ The file type is detected by checking the [magic number](http://en.wikipedia.org $ npm install file-type ``` - - - +## Usage +#### Node.js -## Usage +Determine file type from a file: -##### Node.js +```js +const FileType = require('file-type'); + +(async () => { + console.log(await FileType.fromFile('Unicorn.png')); + //=> {ext: 'png', mime: 'image/png'} +})(); +``` + +Determine file type from a Buffer, which may be a portion of the beginning of a file: ```js +const FileType = require('file-type'); const readChunk = require('read-chunk'); -const fileType = require('file-type'); -const buffer = readChunk.sync('unicorn.png', 0, 4100); -fileType(buffer); -//=> {ext: 'png', mime: 'image/png'} +(async () => { + const buffer = readChunk.sync('Unicorn.png', 0, 4100); + + console.log(await FileType.fromBuffer(buffer)); + //=> {ext: 'png', mime: 'image/png'} +})(); ``` -Or from a remote location: +Determine file type from a stream: ```js -const http = require('http'); -const fileType = require('file-type'); -const url = 'http://assets-cdn.github.com/images/spinners/octocat-spinner-32.gif'; - -http.get(url, res => { - res.once('data', chunk => { - res.destroy(); - console.log(fileType(chunk)); - //=> {ext: 'gif', mime: 'image/gif'} - }); -}); +const fs = require('fs'); +const FileType = require('file-type'); + +(async () => { + const stream = fs.createReadStream('Unicorn.mp4'); + + console.log(await FileType.fromStream(stream)); + //=> {ext: 'mp4', mime: 'video/mp4'} +} +)(); ``` -##### Browser +The stream method can also be used to read from a remote location: ```js -const xhr = new XMLHttpRequest(); -xhr.open('GET', 'unicorn.png'); -xhr.responseType = 'arraybuffer'; +const got = require('got'); +const FileType = require('file-type'); -xhr.onload = () => { - fileType(new Uint8Array(this.response)); - //=> {ext: 'png', mime: 'image/png'} -}; +const url = 'https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg'; + +(async () => { + const stream = got.stream(url); + + console.log(await FileType.fromStream(stream)); + //=> {ext: 'jpg', mime: 'image/jpeg'} +})(); +``` + +Another stream example: + +```js +const stream = require('stream'); +const fs = require('fs'); +const crypto = require('crypto'); +const FileType = require('file-type'); + +(async () => { + const read = fs.createReadStream('encrypted.enc'); + const decipher = crypto.createDecipheriv(alg, key, iv); + + const fileTypeStream = await FileType.stream(stream.pipeline(read, decipher)); -xhr.send(); + console.log(fileTypeStream.fileType); + //=> {ext: 'mov', mime: 'video/quicktime'} + + const write = fs.createWriteStream(`decrypted.${fileTypeStream.fileType.ext}`); + fileTypeStream.pipe(write); +})(); ``` +#### Browser + +```js +const FileType = require('file-type/browser'); + +const url = 'https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg'; + +(async () => { + const response = await fetch(url); + const fileType = await FileType.fromStream(response.body); + + console.log(fileType); + //=> {ext: 'jpg', mime: 'image/jpeg'} +})(); +``` + +```js +const FileType = require('file-type/browser'); + +(async () => { + const blob = new Blob([''], { + type: 'plain/text', + endings: 'native' + }); + + console.log(await FileType.fromBlob(blob)); + //=> {ext: 'txt', mime: 'plain/text'} +})(); +``` ## API -### fileType(input) +### FileType.fromBuffer(buffer) + +Detect the file type of a `Buffer`, `Uint8Array`, or `ArrayBuffer`. + +The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer. + +If file access is available, it is recommended to use `FileType.fromFile()` instead. + +Returns a `Promise` for an object with the detected file type and MIME type: + +- `ext` - One of the [supported file types](#supported-file-types) +- `mime` - The [MIME type](https://en.wikipedia.org/wiki/Internet_media_type) + +Or `undefined` when there is no match. + +#### buffer + +Type: `Buffer | Uint8Array | ArrayBuffer` + +A buffer representing file data. It works best if the buffer contains the entire file, it may work with a smaller portion as well. + +### FileType.fromFile(filePath) + +Detect the file type of a file path. + +The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer. -Returns an `Object` with: +Returns a `Promise` for an object with the detected file type and MIME type: - `ext` - One of the [supported file types](#supported-file-types) -- `mime` - The [MIME type](http://en.wikipedia.org/wiki/Internet_media_type) +- `mime` - The [MIME type](https://en.wikipedia.org/wiki/Internet_media_type) -Or `null` when no match. +Or `undefined` when there is no match. -#### input +#### filePath -Type: `Buffer` `Uint8Array` +Type: `string` -It only needs the first 4100 bytes. The exception is detection of `docx`, `pptx`, and `xlsx` which potentially requires reading the whole file. +The file path to parse. +### FileType.fromStream(stream) + +Detect the file type of a Node.js [readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable). + +The file type is detected by checking the [magic number](https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files) of the buffer. + +Returns a `Promise` for an object with the detected file type and MIME type: + +- `ext` - One of the [supported file types](#supported-file-types) +- `mime` - The [MIME type](https://en.wikipedia.org/wiki/Internet_media_type) + +Or `undefined` when there is no match. + +#### stream + +Type: [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable) + +A readable stream representing file data. + +### FileType.fromTokenizer(tokenizer) + +Detect the file type from an `ITokenizer` source. + +This method is used internally, but can also be used for a special "tokenizer" reader. + +A tokenizer propagates the internal read functions, allowing alternative transport mechanisms, to access files, to be implemented and used. + +Returns a `Promise` for an object with the detected file type and MIME type: + +- `ext` - One of the [supported file types](#supported-file-types) +- `mime` - The [MIME type](https://en.wikipedia.org/wiki/Internet_media_type) + +Or `undefined` when there is no match. + +An example is [`@tokenizer/http`](https://github.com/Borewit/tokenizer-http), which requests data using [HTTP-range-requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests). A difference with a conventional stream and the [*tokenizer*](https://github.com/Borewit/strtok3#tokenizer), is that it can *ignore* (seek, fast-forward) in the stream. For example, you may only need and read the first 6 bytes, and the last 128 bytes, which may be an advantage in case reading the entire file would take longer. + +```js +const {makeTokenizer} = require('@tokenizer/http'); +const FileType = require('file-type'); + +const audioTrackUrl = 'https://test-audio.netlify.com/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/01%20-%20Diablo%20Swing%20Orchestra%20-%20Heroines.mp3'; + +(async () => { + const httpTokenizer = await makeTokenizer(audioTrackUrl); + const fileType = await FileType.fromTokenizer(httpTokenizer); + + console.log(fileType); + //=> {ext: 'mp3', mime: 'audio/mpeg'} +})(); +``` + +Or use [`@tokenizer/s3`](https://github.com/Borewit/tokenizer-s3) to determine the file type of a file stored on [Amazon S3](https://aws.amazon.com/s3): + +```js +const FileType = require('file-type'); +const S3 = require('aws-sdk/clients/s3'); +const {makeTokenizer} = require('@tokenizer/s3'); + +(async () => { + // Initialize the S3 client + const s3 = new S3(); + + // Initialize the S3 tokenizer. + const s3Tokenizer = await makeTokenizer(s3, { + Bucket: 'affectlab', + Key: '1min_35sec.mp4' + }); + + // Figure out what kind of file it is. + const fileType = await FileType.fromTokenizer(s3Tokenizer); + console.log(fileType); +})(); +``` + +Note that only the minimum amount of data required to determine the file type is read (okay, just a bit extra to prevent too many fragmented reads). + +#### tokenizer + +Type: [`ITokenizer`](https://github.com/Borewit/strtok3#tokenizer) + +A file source implementing the [tokenizer interface](https://github.com/Borewit/strtok3#tokenizer). + +### FileType.stream(readableStream) + +Detect the file type of a readable stream. + +Returns a `Promise` which resolves to the original readable stream argument, but with an added `fileType` property, which is an object like the one returned from `FileType.fromFile()`. + +*Note:* This method is only available using Node.js. + +#### readableStream + +Type: [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable) + +The input stream. + +### FileType.extensions + +Returns a set of supported file extensions. + +### FileType.mimeTypes + +Returns a set of supported MIME types. ## Supported file types -- [`jpg`](https://en.wikipedia.org/wiki/JPEG) -- [`png`](https://en.wikipedia.org/wiki/Portable_Network_Graphics) -- [`gif`](https://en.wikipedia.org/wiki/GIF) -- [`webp`](https://en.wikipedia.org/wiki/WebP) -- [`flif`](https://en.wikipedia.org/wiki/Free_Lossless_Image_Format) -- [`cr2`](http://fileinfo.com/extension/cr2) -- [`tif`](https://en.wikipedia.org/wiki/Tagged_Image_File_Format) -- [`bmp`](https://en.wikipedia.org/wiki/BMP_file_format) -- [`jxr`](https://en.wikipedia.org/wiki/JPEG_XR) -- [`psd`](https://en.wikipedia.org/wiki/Adobe_Photoshop#File_format) -- [`zip`](https://en.wikipedia.org/wiki/Zip_(file_format)) -- [`tar`](https://en.wikipedia.org/wiki/Tar_(computing)#File_format) -- [`rar`](https://en.wikipedia.org/wiki/RAR_(file_format)) -- [`gz`](https://en.wikipedia.org/wiki/Gzip) -- [`bz2`](https://en.wikipedia.org/wiki/Bzip2) -- [`7z`](https://en.wikipedia.org/wiki/7z) -- [`dmg`](https://en.wikipedia.org/wiki/Apple_Disk_Image) -- [`mp4`](https://en.wikipedia.org/wiki/MPEG-4_Part_14#Filename_extensions) -- [`m4v`](https://en.wikipedia.org/wiki/M4V) -- [`mid`](https://en.wikipedia.org/wiki/MIDI) -- [`mkv`](https://en.wikipedia.org/wiki/Matroska) -- [`webm`](https://en.wikipedia.org/wiki/WebM) -- [`mov`](https://en.wikipedia.org/wiki/QuickTime_File_Format) -- [`avi`](https://en.wikipedia.org/wiki/Audio_Video_Interleave) -- [`wmv`](https://en.wikipedia.org/wiki/Windows_Media_Video) -- [`mpg`](https://en.wikipedia.org/wiki/MPEG-1) -- [`mp2`](https://en.wikipedia.org/wiki/MPEG-1_Audio_Layer_II) -- [`mp3`](https://en.wikipedia.org/wiki/MP3) -- [`m4a`](https://en.wikipedia.org/wiki/MPEG-4_Part_14#.MP4_versus_.M4A) -- [`ogg`](https://en.wikipedia.org/wiki/Ogg) -- [`opus`](https://en.wikipedia.org/wiki/Opus_(audio_format)) -- [`flac`](https://en.wikipedia.org/wiki/FLAC) -- [`wav`](https://en.wikipedia.org/wiki/WAV) -- [`qcp`](https://en.wikipedia.org/wiki/QCP) -- [`amr`](https://en.wikipedia.org/wiki/Adaptive_Multi-Rate_audio_codec) -- [`pdf`](https://en.wikipedia.org/wiki/Portable_Document_Format) -- [`epub`](https://en.wikipedia.org/wiki/EPUB) +- [`jpg`](https://en.wikipedia.org/wiki/JPEG) - Joint Photographic Experts Group image +- [`png`](https://en.wikipedia.org/wiki/Portable_Network_Graphics) - Portable Network Graphics +- [`apng`](https://en.wikipedia.org/wiki/APNG) - Animated Portable Network Graphics +- [`gif`](https://en.wikipedia.org/wiki/GIF) - Graphics Interchange Format +- [`webp`](https://en.wikipedia.org/wiki/WebP) - Web Picture format +- [`flif`](https://en.wikipedia.org/wiki/Free_Lossless_Image_Format) - Free Lossless Image Format +- [`xcf`](https://en.wikipedia.org/wiki/XCF_(file_format)) - eXperimental Computing Facility +- [`cr2`](https://fileinfo.com/extension/cr2) - Canon Raw image file (v2) +- [`cr3`](https://fileinfo.com/extension/cr3) - Canon Raw image file (v3) +- [`orf`](https://en.wikipedia.org/wiki/ORF_format) - Olympus Raw image file +- [`arw`](https://en.wikipedia.org/wiki/Raw_image_format#ARW) - Sony Alpha Raw image file +- [`dng`](https://en.wikipedia.org/wiki/Digital_Negative) - Adobe Digital Negative image file +- [`nef`](https://www.nikonusa.com/en/learn-and-explore/a/products-and-innovation/nikon-electronic-format-nef.html) - Nikon Electronic Format image file +- [`rw2`](https://en.wikipedia.org/wiki/Raw_image_format) - Panasonic RAW image file +- [`raf`](https://en.wikipedia.org/wiki/Raw_image_format) - Fujifilm RAW image file +- [`tif`](https://en.wikipedia.org/wiki/Tagged_Image_File_Format) - Tagged Image file +- [`bmp`](https://en.wikipedia.org/wiki/BMP_file_format) - Bitmap image file +- [`icns`](https://en.wikipedia.org/wiki/Apple_Icon_Image_format) - Apple Icon image +- [`jxr`](https://en.wikipedia.org/wiki/JPEG_XR) - Joint Photographic Experts Group extended range +- [`psd`](https://en.wikipedia.org/wiki/Adobe_Photoshop#File_format) - Adobe Photoshop document +- [`indd`](https://en.wikipedia.org/wiki/Adobe_InDesign#File_format) - Adobe InDesign document +- [`zip`](https://en.wikipedia.org/wiki/Zip_(file_format)) - Archive file +- [`tar`](https://en.wikipedia.org/wiki/Tar_(computing)#File_format) - Tarball archive file +- [`rar`](https://en.wikipedia.org/wiki/RAR_(file_format)) - Archive file +- [`gz`](https://en.wikipedia.org/wiki/Gzip) - Archive file +- [`bz2`](https://en.wikipedia.org/wiki/Bzip2) - Archive file +- [`zst`](https://en.wikipedia.org/wiki/Zstandard) - Archive file +- [`7z`](https://en.wikipedia.org/wiki/7z) - 7-Zip archive +- [`dmg`](https://en.wikipedia.org/wiki/Apple_Disk_Image) - Apple Disk Image +- [`mp4`](https://en.wikipedia.org/wiki/MPEG-4_Part_14#Filename_extensions) - MPEG-4 Part 14 video file +- [`mid`](https://en.wikipedia.org/wiki/MIDI) - Musical Instrument Digital Interface file +- [`mkv`](https://en.wikipedia.org/wiki/Matroska) - Matroska video file +- [`webm`](https://en.wikipedia.org/wiki/WebM) - Web video file +- [`mov`](https://en.wikipedia.org/wiki/QuickTime_File_Format) - QuickTime video file +- [`avi`](https://en.wikipedia.org/wiki/Audio_Video_Interleave) - Audio Video Interleave file +- [`mpg`](https://en.wikipedia.org/wiki/MPEG-1) - MPEG-1 file +- [`mp1`](https://en.wikipedia.org/wiki/MPEG-1_Audio_Layer_I) - MPEG-1 Audio Layer I +- [`mp2`](https://en.wikipedia.org/wiki/MPEG-1_Audio_Layer_II) - MPEG-1 Audio Layer II +- [`mp3`](https://en.wikipedia.org/wiki/MP3) - Audio file +- [`ogg`](https://en.wikipedia.org/wiki/Ogg) - Audio file +- [`ogv`](https://en.wikipedia.org/wiki/Ogg) - Audio file +- [`ogm`](https://en.wikipedia.org/wiki/Ogg) - Audio file +- [`oga`](https://en.wikipedia.org/wiki/Ogg) - Audio file +- [`spx`](https://en.wikipedia.org/wiki/Ogg) - Audio file +- [`ogx`](https://en.wikipedia.org/wiki/Ogg) - Audio file +- [`opus`](https://en.wikipedia.org/wiki/Opus_(audio_format)) - Audio file +- [`flac`](https://en.wikipedia.org/wiki/FLAC) - Free Lossless Audio Codec +- [`wav`](https://en.wikipedia.org/wiki/WAV) - Waveform Audio file +- [`qcp`](https://en.wikipedia.org/wiki/QCP) - Tagged and chunked data +- [`amr`](https://en.wikipedia.org/wiki/Adaptive_Multi-Rate_audio_codec) - Adaptive Multi-Rate audio codec +- [`pdf`](https://en.wikipedia.org/wiki/Portable_Document_Format) - Portable Document Format +- [`epub`](https://en.wikipedia.org/wiki/EPUB) - E-book file - [`mobi`](https://en.wikipedia.org/wiki/Mobipocket) - Mobipocket -- [`exe`](https://en.wikipedia.org/wiki/.exe) -- [`swf`](https://en.wikipedia.org/wiki/SWF) -- [`rtf`](https://en.wikipedia.org/wiki/Rich_Text_Format) -- [`woff`](https://en.wikipedia.org/wiki/Web_Open_Font_Format) -- [`woff2`](https://en.wikipedia.org/wiki/Web_Open_Font_Format) -- [`eot`](https://en.wikipedia.org/wiki/Embedded_OpenType) -- [`ttf`](https://en.wikipedia.org/wiki/TrueType) -- [`otf`](https://en.wikipedia.org/wiki/OpenType) -- [`ico`](https://en.wikipedia.org/wiki/ICO_(file_format)) -- [`flv`](https://en.wikipedia.org/wiki/Flash_Video) -- [`ps`](https://en.wikipedia.org/wiki/Postscript) -- [`xz`](https://en.wikipedia.org/wiki/Xz) -- [`sqlite`](https://www.sqlite.org/fileformat2.html) -- [`nes`](http://fileinfo.com/extension/nes) -- [`crx`](https://developer.chrome.com/extensions/crx) -- [`xpi`](https://en.wikipedia.org/wiki/XPInstall) -- [`cab`](https://en.wikipedia.org/wiki/Cabinet_(file_format)) -- [`deb`](https://en.wikipedia.org/wiki/Deb_(file_format)) -- [`ar`](https://en.wikipedia.org/wiki/Ar_(Unix)) -- [`rpm`](http://fileinfo.com/extension/rpm) -- [`Z`](http://fileinfo.com/extension/z) -- [`lz`](https://en.wikipedia.org/wiki/Lzip) -- [`msi`](https://en.wikipedia.org/wiki/Windows_Installer) -- [`mxf`](https://en.wikipedia.org/wiki/Material_Exchange_Format) -- [`mts`](https://en.wikipedia.org/wiki/.m2ts) -- [`wasm`](https://en.wikipedia.org/wiki/WebAssembly) -- [`blend`](https://wiki.blender.org/index.php/Dev:Source/Architecture/File_Format) -- [`bpg`](https://bellard.org/bpg/) -- [`docx`](https://en.wikipedia.org/wiki/Office_Open_XML) -- [`pptx`](https://en.wikipedia.org/wiki/Office_Open_XML) -- [`xlsx`](https://en.wikipedia.org/wiki/Office_Open_XML) -- [`3gp`](https://en.wikipedia.org/wiki/3GP_and_3G2) +- [`exe`](https://en.wikipedia.org/wiki/.exe) - Executable file +- [`swf`](https://en.wikipedia.org/wiki/SWF) - Adobe Flash Player file +- [`rtf`](https://en.wikipedia.org/wiki/Rich_Text_Format) - Rich Text Format +- [`woff`](https://en.wikipedia.org/wiki/Web_Open_Font_Format) - Web Open Font Format +- [`woff2`](https://en.wikipedia.org/wiki/Web_Open_Font_Format) - Web Open Font Format +- [`eot`](https://en.wikipedia.org/wiki/Embedded_OpenType) - Embedded OpenType font +- [`ttf`](https://en.wikipedia.org/wiki/TrueType) - TrueType font +- [`otf`](https://en.wikipedia.org/wiki/OpenType) - OpenType font +- [`ico`](https://en.wikipedia.org/wiki/ICO_(file_format)) - Windows icon file +- [`flv`](https://en.wikipedia.org/wiki/Flash_Video) - Flash video +- [`ps`](https://en.wikipedia.org/wiki/Postscript) - Postscript +- [`xz`](https://en.wikipedia.org/wiki/Xz) - Compressed file +- [`sqlite`](https://www.sqlite.org/fileformat2.html) - SQLite file +- [`nes`](https://fileinfo.com/extension/nes) - Nintendo NES ROM +- [`crx`](https://developer.chrome.com/extensions/crx) - Google Chrome extension +- [`xpi`](https://en.wikipedia.org/wiki/XPInstall) - XPInstall file +- [`cab`](https://en.wikipedia.org/wiki/Cabinet_(file_format)) - Cabinet file +- [`deb`](https://en.wikipedia.org/wiki/Deb_(file_format)) - Debian package +- [`ar`](https://en.wikipedia.org/wiki/Ar_(Unix)) - Archive file +- [`rpm`](https://fileinfo.com/extension/rpm) - Red Hat Package Manager file +- [`Z`](https://fileinfo.com/extension/z) - Unix Compressed File +- [`lz`](https://en.wikipedia.org/wiki/Lzip) - Arhive file +- [`cfb`](https://en.wikipedia.org/wiki/Compound_File_Binary_Format) - Compount File Binary Format +- [`mxf`](https://en.wikipedia.org/wiki/Material_Exchange_Format) - Material Exchange Format +- [`mts`](https://en.wikipedia.org/wiki/.m2ts) - Blu-ray Disc Audio-Video MPEG-2 Transport Stream +- [`wasm`](https://en.wikipedia.org/wiki/WebAssembly) - WebAssembly intermediate compiled format +- [`blend`](https://wiki.blender.org/index.php/Dev:Source/Architecture/File_Format) - Blender project +- [`bpg`](https://bellard.org/bpg/) - Better Portable Graphics file +- [`docx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Word +- [`pptx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Powerpoint +- [`xlsx`](https://en.wikipedia.org/wiki/Office_Open_XML) - Microsoft Excel - [`jp2`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000 - [`jpm`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000 - [`jpx`](https://en.wikipedia.org/wiki/JPEG_2000) - JPEG 2000 - [`mj2`](https://en.wikipedia.org/wiki/Motion_JPEG_2000) - Motion JPEG 2000 -- [`aif`](https://en.wikipedia.org/wiki/Audio_Interchange_File_Format) +- [`aif`](https://en.wikipedia.org/wiki/Audio_Interchange_File_Format) - Audio Interchange file - [`odt`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for word processing - [`ods`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for spreadsheets - [`odp`](https://en.wikipedia.org/wiki/OpenDocument) - OpenDocument for presentations -- [`xml`](https://en.wikipedia.org/wiki/XML) -- [`heic`](http://nokiatech.github.io/heif/technical.html) -- [`cur`](https://en.wikipedia.org/wiki/ICO_(file_format)) -- [`ktx`](https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/) +- [`xml`](https://en.wikipedia.org/wiki/XML) - eXtensible Markup Language +- [`heic`](https://nokiatech.github.io/heif/technical.html) - High Efficiency Image File Format +- [`cur`](https://en.wikipedia.org/wiki/ICO_(file_format)) - Icon file +- [`ktx`](https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/) - OpenGL and OpenGL ES textures - [`ape`](https://en.wikipedia.org/wiki/Monkey%27s_Audio) - Monkey's Audio - [`wv`](https://en.wikipedia.org/wiki/WavPack) - WavPack - -*SVG isn't included as it requires the whole file to be read, but you can get it [here](https://github.com/sindresorhus/is-svg).* - -*Pull request welcome for additional commonly used file types.* - +- [`asf`](https://en.wikipedia.org/wiki/Advanced_Systems_Format) - Advanced Systems Format +- [`dcm`](https://en.wikipedia.org/wiki/DICOM#Data_format) - DICOM Image File +- [`mpc`](https://en.wikipedia.org/wiki/Musepack) - Musepack (SV7 & SV8) +- [`ics`](https://en.wikipedia.org/wiki/ICalendar#Data_format) - iCalendar +- [`vcf`](https://en.wikipedia.org/wiki/VCard) - vCard +- [`glb`](https://github.com/KhronosGroup/glTF) - GL Transmission Format +- [`pcap`](https://wiki.wireshark.org/Development/LibpcapFileFormat) - Libpcap File Format +- [`dsf`](https://dsd-guide.com/sites/default/files/white-papers/DSFFileFormatSpec_E.pdf) - Sony DSD Stream File (DSF) +- [`lnk`](https://en.wikipedia.org/wiki/Shortcut_%28computing%29#Microsoft_Windows) - Microsoft Windows file shortcut +- [`alias`](https://en.wikipedia.org/wiki/Alias_%28Mac_OS%29) - macOS Alias file +- [`voc`](https://wiki.multimedia.cx/index.php/Creative_Voice) - Creative Voice File +- [`ac3`](https://www.atsc.org/standard/a522012-digital-audio-compression-ac-3-e-ac-3-standard-12172012/) - ATSC A/52 Audio File +- [`3gp`](https://en.wikipedia.org/wiki/3GP_and_3G2#3GP) - Multimedia container format defined by the Third Generation Partnership Project (3GPP) for 3G UMTS multimedia services +- [`3g2`](https://en.wikipedia.org/wiki/3GP_and_3G2#3G2) - Multimedia container format defined by the 3GPP2 for 3G CDMA2000 multimedia services +- [`m4v`](https://en.wikipedia.org/wiki/M4V) - MPEG-4 Visual bitstreams +- [`m4p`](https://en.wikipedia.org/wiki/MPEG-4_Part_14#Filename_extensions) - MPEG-4 files with audio streams encrypted by FairPlay Digital Rights Management as were sold through the iTunes Store +- [`m4a`](https://en.wikipedia.org/wiki/M4A) - Audio-only MPEG-4 files +- [`m4b`](https://en.wikipedia.org/wiki/M4B) - Audiobook and podcast MPEG-4 files, which also contain metadata including chapter markers, images, and hyperlinks +- [`f4v`](https://en.wikipedia.org/wiki/Flash_Video) - ISO base media file format used by Adobe Flash Player +- [`f4p`](https://en.wikipedia.org/wiki/Flash_Video) - ISO base media file format protected by Adobe Access DRM used by Adobe Flash Player +- [`f4a`](https://en.wikipedia.org/wiki/Flash_Video) - Audio-only ISO base media file format used by Adobe Flash Player +- [`f4b`](https://en.wikipedia.org/wiki/Flash_Video) - Audiobook and podcast ISO base media file format used by Adobe Flash Player +- [`mie`](https://en.wikipedia.org/wiki/Sidecar_file) - Dedicated meta information format which supports storage of binary as well as textual meta information +- [`shp`](https://en.wikipedia.org/wiki/Shapefile) - Geospatial vector data format +- [`arrow`](https://arrow.apache.org) - Columnar format for tables of data +- [`aac`](https://en.wikipedia.org/wiki/Advanced_Audio_Coding) - Advanced Audio Coding +- [`it`](https://wiki.openmpt.org/Manual:_Module_formats#The_Impulse_Tracker_format_.28.it.29) - Audio module format: Impulse Tracker +- [`s3m`](https://wiki.openmpt.org/Manual:_Module_formats#The_ScreamTracker_3_format_.28.s3m.29) - Audio module format: ScreamTracker 3 +- [`xm`](https://wiki.openmpt.org/Manual:_Module_formats#The_FastTracker_2_format_.28.xm.29) - Audio module format: FastTracker 2 +- [`ai`](https://en.wikipedia.org/wiki/Adobe_Illustrator_Artwork) - Adobe Illustrator Artwork +- [`skp`](https://en.wikipedia.org/wiki/SketchUp) - SketchUp +- [`avif`](https://en.wikipedia.org/wiki/AV1#AV1_Image_File_Format_(AVIF)) - AV1 Image File Format +- [`eps`](https://en.wikipedia.org/wiki/Encapsulated_PostScript) - Encapsulated PostScript +- [`lzh`](https://en.wikipedia.org/wiki/LHA_(file_format)) - LZH archive +- [`pgp`](https://en.wikipedia.org/wiki/Pretty_Good_Privacy) - Pretty Good Privacy +- [`asar`](https://github.com/electron/asar#format) - Archive format primarily used to enclose Electron applications +- [`stl`](https://en.wikipedia.org/wiki/STL_(file_format)) - Standard Tesselated Geometry File Format (ASCII only) +- [`chm`](https://en.wikipedia.org/wiki/Microsoft_Compiled_HTML_Help) - Microsoft Compiled HTML Help +- [`3mf`](https://en.wikipedia.org/wiki/3D_Manufacturing_Format) - 3D Manufacturing Format +- [`jxl`](https://en.wikipedia.org/wiki/JPEG_XL) - JPEG XL image format + +*Pull requests are welcome for additional commonly used file types.* + +The following file types will not be accepted: +- [MS-CFB: Microsoft Compound File Binary File Format based formats](https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-cfb/53989ce4-7b05-4f8d-829b-d08d6148375b), too old and difficult to parse: + - `.doc` - Microsoft Word 97-2003 Document + - `.xls` - Microsoft Excel 97-2003 Document + - `.ppt` - Microsoft PowerPoint97-2003 Document + - `.msi` - Microsoft Windows Installer +- `.csv` - [Reason.](https://github.com/sindresorhus/file-type/issues/264#issuecomment-568439196) +- `.svg` - Detecting it requires a full-blown parser. Check out [`is-svg`](https://github.com/sindresorhus/is-svg) for something that mostly works. + +## file-type for enterprise + +Available as part of the Tidelift Subscription. + +The maintainers of file-type and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-file-type?utm_source=npm-file-type&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) ## Related - [file-type-cli](https://github.com/sindresorhus/file-type-cli) - CLI for this module - -## Created by +## Maintainers - [Sindre Sorhus](https://github.com/sindresorhus) - [Mikael Finstad](https://github.com/mifi) - - -## License - -MIT +- [Ben Brook](https://github.com/bencmbrook) +- [Borewit](https://github.com/Borewit) diff --git a/project starter code/node_modules/file-type/supported.js b/project starter code/node_modules/file-type/supported.js new file mode 100644 index 00000000..1c39f909 --- /dev/null +++ b/project starter code/node_modules/file-type/supported.js @@ -0,0 +1,279 @@ +'use strict'; + +module.exports = { + extensions: [ + 'jpg', + 'png', + 'apng', + 'gif', + 'webp', + 'flif', + 'xcf', + 'cr2', + 'cr3', + 'orf', + 'arw', + 'dng', + 'nef', + 'rw2', + 'raf', + 'tif', + 'bmp', + 'icns', + 'jxr', + 'psd', + 'indd', + 'zip', + 'tar', + 'rar', + 'gz', + 'bz2', + '7z', + 'dmg', + 'mp4', + 'mid', + 'mkv', + 'webm', + 'mov', + 'avi', + 'mpg', + 'mp2', + 'mp3', + 'm4a', + 'oga', + 'ogg', + 'ogv', + 'opus', + 'flac', + 'wav', + 'spx', + 'amr', + 'pdf', + 'epub', + 'exe', + 'swf', + 'rtf', + 'wasm', + 'woff', + 'woff2', + 'eot', + 'ttf', + 'otf', + 'ico', + 'flv', + 'ps', + 'xz', + 'sqlite', + 'nes', + 'crx', + 'xpi', + 'cab', + 'deb', + 'ar', + 'rpm', + 'Z', + 'lz', + 'cfb', + 'mxf', + 'mts', + 'blend', + 'bpg', + 'docx', + 'pptx', + 'xlsx', + '3gp', + '3g2', + 'jp2', + 'jpm', + 'jpx', + 'mj2', + 'aif', + 'qcp', + 'odt', + 'ods', + 'odp', + 'xml', + 'mobi', + 'heic', + 'cur', + 'ktx', + 'ape', + 'wv', + 'dcm', + 'ics', + 'glb', + 'pcap', + 'dsf', + 'lnk', + 'alias', + 'voc', + 'ac3', + 'm4v', + 'm4p', + 'm4b', + 'f4v', + 'f4p', + 'f4b', + 'f4a', + 'mie', + 'asf', + 'ogm', + 'ogx', + 'mpc', + 'arrow', + 'shp', + 'aac', + 'mp1', + 'it', + 's3m', + 'xm', + 'ai', + 'skp', + 'avif', + 'eps', + 'lzh', + 'pgp', + 'asar', + 'stl', + 'chm', + '3mf', + 'zst', + 'jxl', + 'vcf' + ], + mimeTypes: [ + 'image/jpeg', + 'image/png', + 'image/gif', + 'image/webp', + 'image/flif', + 'image/x-xcf', + 'image/x-canon-cr2', + 'image/x-canon-cr3', + 'image/tiff', + 'image/bmp', + 'image/vnd.ms-photo', + 'image/vnd.adobe.photoshop', + 'application/x-indesign', + 'application/epub+zip', + 'application/x-xpinstall', + 'application/vnd.oasis.opendocument.text', + 'application/vnd.oasis.opendocument.spreadsheet', + 'application/vnd.oasis.opendocument.presentation', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'application/zip', + 'application/x-tar', + 'application/x-rar-compressed', + 'application/gzip', + 'application/x-bzip2', + 'application/x-7z-compressed', + 'application/x-apple-diskimage', + 'application/x-apache-arrow', + 'video/mp4', + 'audio/midi', + 'video/x-matroska', + 'video/webm', + 'video/quicktime', + 'video/vnd.avi', + 'audio/vnd.wave', + 'audio/qcelp', + 'audio/x-ms-asf', + 'video/x-ms-asf', + 'application/vnd.ms-asf', + 'video/mpeg', + 'video/3gpp', + 'audio/mpeg', + 'audio/mp4', // RFC 4337 + 'audio/opus', + 'video/ogg', + 'audio/ogg', + 'application/ogg', + 'audio/x-flac', + 'audio/ape', + 'audio/wavpack', + 'audio/amr', + 'application/pdf', + 'application/x-msdownload', + 'application/x-shockwave-flash', + 'application/rtf', + 'application/wasm', + 'font/woff', + 'font/woff2', + 'application/vnd.ms-fontobject', + 'font/ttf', + 'font/otf', + 'image/x-icon', + 'video/x-flv', + 'application/postscript', + 'application/eps', + 'application/x-xz', + 'application/x-sqlite3', + 'application/x-nintendo-nes-rom', + 'application/x-google-chrome-extension', + 'application/vnd.ms-cab-compressed', + 'application/x-deb', + 'application/x-unix-archive', + 'application/x-rpm', + 'application/x-compress', + 'application/x-lzip', + 'application/x-cfb', + 'application/x-mie', + 'application/mxf', + 'video/mp2t', + 'application/x-blender', + 'image/bpg', + 'image/jp2', + 'image/jpx', + 'image/jpm', + 'image/mj2', + 'audio/aiff', + 'application/xml', + 'application/x-mobipocket-ebook', + 'image/heif', + 'image/heif-sequence', + 'image/heic', + 'image/heic-sequence', + 'image/icns', + 'image/ktx', + 'application/dicom', + 'audio/x-musepack', + 'text/calendar', + 'text/vcard', + 'model/gltf-binary', + 'application/vnd.tcpdump.pcap', + 'audio/x-dsf', // Non-standard + 'application/x.ms.shortcut', // Invented by us + 'application/x.apple.alias', // Invented by us + 'audio/x-voc', + 'audio/vnd.dolby.dd-raw', + 'audio/x-m4a', + 'image/apng', + 'image/x-olympus-orf', + 'image/x-sony-arw', + 'image/x-adobe-dng', + 'image/x-nikon-nef', + 'image/x-panasonic-rw2', + 'image/x-fujifilm-raf', + 'video/x-m4v', + 'video/3gpp2', + 'application/x-esri-shape', + 'audio/aac', + 'audio/x-it', + 'audio/x-s3m', + 'audio/x-xm', + 'video/MP1S', + 'video/MP2P', + 'application/vnd.sketchup.skp', + 'image/avif', + 'application/x-lzh-compressed', + 'application/pgp-encrypted', + 'application/x-asar', + 'model/stl', + 'application/vnd.ms-htmlhelp', + 'model/3mf', + 'image/jxl', + 'application/zstd' + ] +}; diff --git a/project starter code/node_modules/file-type/util.js b/project starter code/node_modules/file-type/util.js new file mode 100644 index 00000000..d9cd54dd --- /dev/null +++ b/project starter code/node_modules/file-type/util.js @@ -0,0 +1,40 @@ +'use strict'; + +exports.stringToBytes = string => [...string].map(character => character.charCodeAt(0)); + +/** +Checks whether the TAR checksum is valid. + +@param {Buffer} buffer - The TAR header `[offset ... offset + 512]`. +@param {number} offset - TAR header offset. +@returns {boolean} `true` if the TAR checksum is valid, otherwise `false`. +*/ +exports.tarHeaderChecksumMatches = (buffer, offset = 0) => { + const readSum = parseInt(buffer.toString('utf8', 148, 154).replace(/\0.*$/, '').trim(), 8); // Read sum in header + if (isNaN(readSum)) { + return false; + } + + let sum = 8 * 0x20; // Initialize signed bit sum + + for (let i = offset; i < offset + 148; i++) { + sum += buffer[i]; + } + + for (let i = offset + 156; i < offset + 512; i++) { + sum += buffer[i]; + } + + return readSum === sum; +}; + +/** +ID3 UINT32 sync-safe tokenizer token. +28 bits (representing up to 256MB) integer, the msb is 0 to avoid "false syncsignals". +*/ +exports.uint32SyncSafeToken = { + get: (buffer, offset) => { + return (buffer[offset + 3] & 0x7F) | ((buffer[offset + 2]) << 7) | ((buffer[offset + 1]) << 14) | ((buffer[offset]) << 21); + }, + len: 4 +}; diff --git a/project starter code/node_modules/fill-range/LICENSE b/project starter code/node_modules/fill-range/LICENSE new file mode 100644 index 00000000..9af4a67d --- /dev/null +++ b/project starter code/node_modules/fill-range/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-present, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/project starter code/node_modules/fill-range/README.md b/project starter code/node_modules/fill-range/README.md new file mode 100644 index 00000000..8d756fe9 --- /dev/null +++ b/project starter code/node_modules/fill-range/README.md @@ -0,0 +1,237 @@ +# fill-range [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [![NPM version](https://img.shields.io/npm/v/fill-range.svg?style=flat)](https://www.npmjs.com/package/fill-range) [![NPM monthly downloads](https://img.shields.io/npm/dm/fill-range.svg?style=flat)](https://npmjs.org/package/fill-range) [![NPM total downloads](https://img.shields.io/npm/dt/fill-range.svg?style=flat)](https://npmjs.org/package/fill-range) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/fill-range.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/fill-range) + +> Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex` + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save fill-range +``` + +## Usage + +Expands numbers and letters, optionally using a `step` as the last argument. _(Numbers may be defined as JavaScript numbers or strings)_. + +```js +const fill = require('fill-range'); +// fill(from, to[, step, options]); + +console.log(fill('1', '10')); //=> ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'] +console.log(fill('1', '10', { toRegex: true })); //=> [1-9]|10 +``` + +**Params** + +* `from`: **{String|Number}** the number or letter to start with +* `to`: **{String|Number}** the number or letter to end with +* `step`: **{String|Number|Object|Function}** Optionally pass a [step](#optionsstep) to use. +* `options`: **{Object|Function}**: See all available [options](#options) + +## Examples + +By default, an array of values is returned. + +**Alphabetical ranges** + +```js +console.log(fill('a', 'e')); //=> ['a', 'b', 'c', 'd', 'e'] +console.log(fill('A', 'E')); //=> [ 'A', 'B', 'C', 'D', 'E' ] +``` + +**Numerical ranges** + +Numbers can be defined as actual numbers or strings. + +```js +console.log(fill(1, 5)); //=> [ 1, 2, 3, 4, 5 ] +console.log(fill('1', '5')); //=> [ 1, 2, 3, 4, 5 ] +``` + +**Negative ranges** + +Numbers can be defined as actual numbers or strings. + +```js +console.log(fill('-5', '-1')); //=> [ '-5', '-4', '-3', '-2', '-1' ] +console.log(fill('-5', '5')); //=> [ '-5', '-4', '-3', '-2', '-1', '0', '1', '2', '3', '4', '5' ] +``` + +**Steps (increments)** + +```js +// numerical ranges with increments +console.log(fill('0', '25', 4)); //=> [ '0', '4', '8', '12', '16', '20', '24' ] +console.log(fill('0', '25', 5)); //=> [ '0', '5', '10', '15', '20', '25' ] +console.log(fill('0', '25', 6)); //=> [ '0', '6', '12', '18', '24' ] + +// alphabetical ranges with increments +console.log(fill('a', 'z', 4)); //=> [ 'a', 'e', 'i', 'm', 'q', 'u', 'y' ] +console.log(fill('a', 'z', 5)); //=> [ 'a', 'f', 'k', 'p', 'u', 'z' ] +console.log(fill('a', 'z', 6)); //=> [ 'a', 'g', 'm', 's', 'y' ] +``` + +## Options + +### options.step + +**Type**: `number` (formatted as a string or number) + +**Default**: `undefined` + +**Description**: The increment to use for the range. Can be used with letters or numbers. + +**Example(s)** + +```js +// numbers +console.log(fill('1', '10', 2)); //=> [ '1', '3', '5', '7', '9' ] +console.log(fill('1', '10', 3)); //=> [ '1', '4', '7', '10' ] +console.log(fill('1', '10', 4)); //=> [ '1', '5', '9' ] + +// letters +console.log(fill('a', 'z', 5)); //=> [ 'a', 'f', 'k', 'p', 'u', 'z' ] +console.log(fill('a', 'z', 7)); //=> [ 'a', 'h', 'o', 'v' ] +console.log(fill('a', 'z', 9)); //=> [ 'a', 'j', 's' ] +``` + +### options.strictRanges + +**Type**: `boolean` + +**Default**: `false` + +**Description**: By default, `null` is returned when an invalid range is passed. Enable this option to throw a `RangeError` on invalid ranges. + +**Example(s)** + +The following are all invalid: + +```js +fill('1.1', '2'); // decimals not supported in ranges +fill('a', '2'); // incompatible range values +fill(1, 10, 'foo'); // invalid "step" argument +``` + +### options.stringify + +**Type**: `boolean` + +**Default**: `undefined` + +**Description**: Cast all returned values to strings. By default, integers are returned as numbers. + +**Example(s)** + +```js +console.log(fill(1, 5)); //=> [ 1, 2, 3, 4, 5 ] +console.log(fill(1, 5, { stringify: true })); //=> [ '1', '2', '3', '4', '5' ] +``` + +### options.toRegex + +**Type**: `boolean` + +**Default**: `undefined` + +**Description**: Create a regex-compatible source string, instead of expanding values to an array. + +**Example(s)** + +```js +// alphabetical range +console.log(fill('a', 'e', { toRegex: true })); //=> '[a-e]' +// alphabetical with step +console.log(fill('a', 'z', 3, { toRegex: true })); //=> 'a|d|g|j|m|p|s|v|y' +// numerical range +console.log(fill('1', '100', { toRegex: true })); //=> '[1-9]|[1-9][0-9]|100' +// numerical range with zero padding +console.log(fill('000001', '100000', { toRegex: true })); +//=> '0{5}[1-9]|0{4}[1-9][0-9]|0{3}[1-9][0-9]{2}|0{2}[1-9][0-9]{3}|0[1-9][0-9]{4}|100000' +``` + +### options.transform + +**Type**: `function` + +**Default**: `undefined` + +**Description**: Customize each value in the returned array (or [string](#optionstoRegex)). _(you can also pass this function as the last argument to `fill()`)_. + +**Example(s)** + +```js +// add zero padding +console.log(fill(1, 5, value => String(value).padStart(4, '0'))); +//=> ['0001', '0002', '0003', '0004', '0005'] +``` + +## About + +
+Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
+ +
+Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
+ +
+Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
+ +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 116 | [jonschlinkert](https://github.com/jonschlinkert) | +| 4 | [paulmillr](https://github.com/paulmillr) | +| 2 | [realityking](https://github.com/realityking) | +| 2 | [bluelovers](https://github.com/bluelovers) | +| 1 | [edorivai](https://github.com/edorivai) | +| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) | + +### Author + +**Jon Schlinkert** + +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) + +Please consider supporting me on Patreon, or [start your own Patreon page](https://patreon.com/invite/bxpbvm)! + + + + + +### License + +Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 08, 2019._ \ No newline at end of file diff --git a/project starter code/node_modules/fill-range/index.js b/project starter code/node_modules/fill-range/index.js new file mode 100644 index 00000000..ddb212ee --- /dev/null +++ b/project starter code/node_modules/fill-range/index.js @@ -0,0 +1,248 @@ +/*! + * fill-range + * + * Copyright (c) 2014-present, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +const util = require('util'); +const toRegexRange = require('to-regex-range'); + +const isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); + +const transform = toNumber => { + return value => toNumber === true ? Number(value) : String(value); +}; + +const isValidValue = value => { + return typeof value === 'number' || (typeof value === 'string' && value !== ''); +}; + +const isNumber = num => Number.isInteger(+num); + +const zeros = input => { + let value = `${input}`; + let index = -1; + if (value[0] === '-') value = value.slice(1); + if (value === '0') return false; + while (value[++index] === '0'); + return index > 0; +}; + +const stringify = (start, end, options) => { + if (typeof start === 'string' || typeof end === 'string') { + return true; + } + return options.stringify === true; +}; + +const pad = (input, maxLength, toNumber) => { + if (maxLength > 0) { + let dash = input[0] === '-' ? '-' : ''; + if (dash) input = input.slice(1); + input = (dash + input.padStart(dash ? maxLength - 1 : maxLength, '0')); + } + if (toNumber === false) { + return String(input); + } + return input; +}; + +const toMaxLen = (input, maxLength) => { + let negative = input[0] === '-' ? '-' : ''; + if (negative) { + input = input.slice(1); + maxLength--; + } + while (input.length < maxLength) input = '0' + input; + return negative ? ('-' + input) : input; +}; + +const toSequence = (parts, options, maxLen) => { + parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); + parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0); + + let prefix = options.capture ? '' : '?:'; + let positives = ''; + let negatives = ''; + let result; + + if (parts.positives.length) { + positives = parts.positives.map(v => toMaxLen(String(v), maxLen)).join('|'); + } + + if (parts.negatives.length) { + negatives = `-(${prefix}${parts.negatives.map(v => toMaxLen(String(v), maxLen)).join('|')})`; + } + + if (positives && negatives) { + result = `${positives}|${negatives}`; + } else { + result = positives || negatives; + } + + if (options.wrap) { + return `(${prefix}${result})`; + } + + return result; +}; + +const toRange = (a, b, isNumbers, options) => { + if (isNumbers) { + return toRegexRange(a, b, { wrap: false, ...options }); + } + + let start = String.fromCharCode(a); + if (a === b) return start; + + let stop = String.fromCharCode(b); + return `[${start}-${stop}]`; +}; + +const toRegex = (start, end, options) => { + if (Array.isArray(start)) { + let wrap = options.wrap === true; + let prefix = options.capture ? '' : '?:'; + return wrap ? `(${prefix}${start.join('|')})` : start.join('|'); + } + return toRegexRange(start, end, options); +}; + +const rangeError = (...args) => { + return new RangeError('Invalid range arguments: ' + util.inspect(...args)); +}; + +const invalidRange = (start, end, options) => { + if (options.strictRanges === true) throw rangeError([start, end]); + return []; +}; + +const invalidStep = (step, options) => { + if (options.strictRanges === true) { + throw new TypeError(`Expected step "${step}" to be a number`); + } + return []; +}; + +const fillNumbers = (start, end, step = 1, options = {}) => { + let a = Number(start); + let b = Number(end); + + if (!Number.isInteger(a) || !Number.isInteger(b)) { + if (options.strictRanges === true) throw rangeError([start, end]); + return []; + } + + // fix negative zero + if (a === 0) a = 0; + if (b === 0) b = 0; + + let descending = a > b; + let startString = String(start); + let endString = String(end); + let stepString = String(step); + step = Math.max(Math.abs(step), 1); + + let padded = zeros(startString) || zeros(endString) || zeros(stepString); + let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0; + let toNumber = padded === false && stringify(start, end, options) === false; + let format = options.transform || transform(toNumber); + + if (options.toRegex && step === 1) { + return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options); + } + + let parts = { negatives: [], positives: [] }; + let push = num => parts[num < 0 ? 'negatives' : 'positives'].push(Math.abs(num)); + let range = []; + let index = 0; + + while (descending ? a >= b : a <= b) { + if (options.toRegex === true && step > 1) { + push(a); + } else { + range.push(pad(format(a, index), maxLen, toNumber)); + } + a = descending ? a - step : a + step; + index++; + } + + if (options.toRegex === true) { + return step > 1 + ? toSequence(parts, options, maxLen) + : toRegex(range, null, { wrap: false, ...options }); + } + + return range; +}; + +const fillLetters = (start, end, step = 1, options = {}) => { + if ((!isNumber(start) && start.length > 1) || (!isNumber(end) && end.length > 1)) { + return invalidRange(start, end, options); + } + + let format = options.transform || (val => String.fromCharCode(val)); + let a = `${start}`.charCodeAt(0); + let b = `${end}`.charCodeAt(0); + + let descending = a > b; + let min = Math.min(a, b); + let max = Math.max(a, b); + + if (options.toRegex && step === 1) { + return toRange(min, max, false, options); + } + + let range = []; + let index = 0; + + while (descending ? a >= b : a <= b) { + range.push(format(a, index)); + a = descending ? a - step : a + step; + index++; + } + + if (options.toRegex === true) { + return toRegex(range, null, { wrap: false, options }); + } + + return range; +}; + +const fill = (start, end, step, options = {}) => { + if (end == null && isValidValue(start)) { + return [start]; + } + + if (!isValidValue(start) || !isValidValue(end)) { + return invalidRange(start, end, options); + } + + if (typeof step === 'function') { + return fill(start, end, 1, { transform: step }); + } + + if (isObject(step)) { + return fill(start, end, 0, step); + } + + let opts = { ...options }; + if (opts.capture === true) opts.wrap = true; + step = step || opts.step || 1; + + if (!isNumber(step)) { + if (step != null && !isObject(step)) return invalidStep(step, opts); + return fill(start, end, 1, step); + } + + if (isNumber(start) && isNumber(end)) { + return fillNumbers(start, end, step, opts); + } + + return fillLetters(start, end, Math.max(Math.abs(step), 1), opts); +}; + +module.exports = fill; diff --git a/project starter code/node_modules/fill-range/package.json b/project starter code/node_modules/fill-range/package.json new file mode 100644 index 00000000..582357fb --- /dev/null +++ b/project starter code/node_modules/fill-range/package.json @@ -0,0 +1,74 @@ +{ + "name": "fill-range", + "description": "Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex`", + "version": "7.1.1", + "homepage": "https://github.com/jonschlinkert/fill-range", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "Edo Rivai (edo.rivai.nl)", + "Jon Schlinkert (http://twitter.com/jonschlinkert)", + "Paul Miller (paulmillr.com)", + "Rouven Weßling (www.rouvenwessling.de)", + "(https://github.com/wtgtybhertgeghgtwtg)" + ], + "repository": "jonschlinkert/fill-range", + "bugs": { + "url": "https://github.com/jonschlinkert/fill-range/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=8" + }, + "scripts": { + "lint": "eslint --cache --cache-location node_modules/.cache/.eslintcache --report-unused-disable-directives --ignore-path .gitignore .", + "mocha": "mocha --reporter dot", + "test": "npm run lint && npm run mocha", + "test:ci": "npm run test:cover", + "test:cover": "nyc npm run mocha" + }, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "devDependencies": { + "gulp-format-md": "^2.0.0", + "mocha": "^6.1.1", + "nyc": "^15.1.0" + }, + "keywords": [ + "alpha", + "alphabetical", + "array", + "bash", + "brace", + "expand", + "expansion", + "fill", + "glob", + "match", + "matches", + "matching", + "number", + "numerical", + "range", + "ranges", + "regex", + "sh" + ], + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + } + } +} diff --git a/project starter code/node_modules/follow-redirects/LICENSE b/project starter code/node_modules/follow-redirects/LICENSE new file mode 100644 index 00000000..742cbada --- /dev/null +++ b/project starter code/node_modules/follow-redirects/LICENSE @@ -0,0 +1,18 @@ +Copyright 2014–present Olivier Lalonde , James Talmage , Ruben Verborgh + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/project starter code/node_modules/follow-redirects/README.md b/project starter code/node_modules/follow-redirects/README.md new file mode 100644 index 00000000..eb869a6f --- /dev/null +++ b/project starter code/node_modules/follow-redirects/README.md @@ -0,0 +1,155 @@ +## Follow Redirects + +Drop-in replacement for Node's `http` and `https` modules that automatically follows redirects. + +[![npm version](https://img.shields.io/npm/v/follow-redirects.svg)](https://www.npmjs.com/package/follow-redirects) +[![Build Status](https://github.com/follow-redirects/follow-redirects/workflows/CI/badge.svg)](https://github.com/follow-redirects/follow-redirects/actions) +[![Coverage Status](https://coveralls.io/repos/follow-redirects/follow-redirects/badge.svg?branch=master)](https://coveralls.io/r/follow-redirects/follow-redirects?branch=master) +[![npm downloads](https://img.shields.io/npm/dm/follow-redirects.svg)](https://www.npmjs.com/package/follow-redirects) +[![Sponsor on GitHub](https://img.shields.io/static/v1?label=Sponsor&message=%F0%9F%92%96&logo=GitHub)](https://github.com/sponsors/RubenVerborgh) + +`follow-redirects` provides [request](https://nodejs.org/api/http.html#http_http_request_options_callback) and [get](https://nodejs.org/api/http.html#http_http_get_options_callback) + methods that behave identically to those found on the native [http](https://nodejs.org/api/http.html#http_http_request_options_callback) and [https](https://nodejs.org/api/https.html#https_https_request_options_callback) + modules, with the exception that they will seamlessly follow redirects. + +```javascript +const { http, https } = require('follow-redirects'); + +http.get('http://bit.ly/900913', response => { + response.on('data', chunk => { + console.log(chunk); + }); +}).on('error', err => { + console.error(err); +}); +``` + +You can inspect the final redirected URL through the `responseUrl` property on the `response`. +If no redirection happened, `responseUrl` is the original request URL. + +```javascript +const request = https.request({ + host: 'bitly.com', + path: '/UHfDGO', +}, response => { + console.log(response.responseUrl); + // 'http://duckduckgo.com/robots.txt' +}); +request.end(); +``` + +## Options +### Global options +Global options are set directly on the `follow-redirects` module: + +```javascript +const followRedirects = require('follow-redirects'); +followRedirects.maxRedirects = 10; +followRedirects.maxBodyLength = 20 * 1024 * 1024; // 20 MB +``` + +The following global options are supported: + +- `maxRedirects` (default: `21`) – sets the maximum number of allowed redirects; if exceeded, an error will be emitted. + +- `maxBodyLength` (default: 10MB) – sets the maximum size of the request body; if exceeded, an error will be emitted. + +### Per-request options +Per-request options are set by passing an `options` object: + +```javascript +const url = require('url'); +const { http, https } = require('follow-redirects'); + +const options = url.parse('http://bit.ly/900913'); +options.maxRedirects = 10; +options.beforeRedirect = (options, response, request) => { + // Use this to adjust the request options upon redirecting, + // to inspect the latest response headers, + // or to cancel the request by throwing an error + + // response.headers = the redirect response headers + // response.statusCode = the redirect response code (eg. 301, 307, etc.) + + // request.url = the requested URL that resulted in a redirect + // request.headers = the headers in the request that resulted in a redirect + // request.method = the method of the request that resulted in a redirect + if (options.hostname === "example.com") { + options.auth = "user:password"; + } +}; +http.request(options); +``` + +In addition to the [standard HTTP](https://nodejs.org/api/http.html#http_http_request_options_callback) and [HTTPS options](https://nodejs.org/api/https.html#https_https_request_options_callback), +the following per-request options are supported: +- `followRedirects` (default: `true`) – whether redirects should be followed. + +- `maxRedirects` (default: `21`) – sets the maximum number of allowed redirects; if exceeded, an error will be emitted. + +- `maxBodyLength` (default: 10MB) – sets the maximum size of the request body; if exceeded, an error will be emitted. + +- `beforeRedirect` (default: `undefined`) – optionally change the request `options` on redirects, or abort the request by throwing an error. + +- `agents` (default: `undefined`) – sets the `agent` option per protocol, since HTTP and HTTPS use different agents. Example value: `{ http: new http.Agent(), https: new https.Agent() }` + +- `trackRedirects` (default: `false`) – whether to store the redirected response details into the `redirects` array on the response object. + + +### Advanced usage +By default, `follow-redirects` will use the Node.js default implementations +of [`http`](https://nodejs.org/api/http.html) +and [`https`](https://nodejs.org/api/https.html). +To enable features such as caching and/or intermediate request tracking, +you might instead want to wrap `follow-redirects` around custom protocol implementations: + +```javascript +const { http, https } = require('follow-redirects').wrap({ + http: require('your-custom-http'), + https: require('your-custom-https'), +}); +``` + +Such custom protocols only need an implementation of the `request` method. + +## Browser Usage + +Due to the way the browser works, +the `http` and `https` browser equivalents perform redirects by default. + +By requiring `follow-redirects` this way: +```javascript +const http = require('follow-redirects/http'); +const https = require('follow-redirects/https'); +``` +you can easily tell webpack and friends to replace +`follow-redirect` by the built-in versions: + +```json +{ + "follow-redirects/http" : "http", + "follow-redirects/https" : "https" +} +``` + +## Contributing + +Pull Requests are always welcome. Please [file an issue](https://github.com/follow-redirects/follow-redirects/issues) + detailing your proposal before you invest your valuable time. Additional features and bug fixes should be accompanied + by tests. You can run the test suite locally with a simple `npm test` command. + +## Debug Logging + +`follow-redirects` uses the excellent [debug](https://www.npmjs.com/package/debug) for logging. To turn on logging + set the environment variable `DEBUG=follow-redirects` for debug output from just this module. When running the test + suite it is sometimes advantageous to set `DEBUG=*` to see output from the express server as well. + +## Authors + +- [Ruben Verborgh](https://ruben.verborgh.org/) +- [Olivier Lalonde](mailto:olalonde@gmail.com) +- [James Talmage](mailto:james@talmage.io) + +## License + +[MIT License](https://github.com/follow-redirects/follow-redirects/blob/master/LICENSE) diff --git a/project starter code/node_modules/follow-redirects/debug.js b/project starter code/node_modules/follow-redirects/debug.js new file mode 100644 index 00000000..decb77de --- /dev/null +++ b/project starter code/node_modules/follow-redirects/debug.js @@ -0,0 +1,15 @@ +var debug; + +module.exports = function () { + if (!debug) { + try { + /* eslint global-require: off */ + debug = require("debug")("follow-redirects"); + } + catch (error) { /* */ } + if (typeof debug !== "function") { + debug = function () { /* */ }; + } + } + debug.apply(null, arguments); +}; diff --git a/project starter code/node_modules/follow-redirects/http.js b/project starter code/node_modules/follow-redirects/http.js new file mode 100644 index 00000000..695e3561 --- /dev/null +++ b/project starter code/node_modules/follow-redirects/http.js @@ -0,0 +1 @@ +module.exports = require("./").http; diff --git a/project starter code/node_modules/follow-redirects/https.js b/project starter code/node_modules/follow-redirects/https.js new file mode 100644 index 00000000..d21c921d --- /dev/null +++ b/project starter code/node_modules/follow-redirects/https.js @@ -0,0 +1 @@ +module.exports = require("./").https; diff --git a/project starter code/node_modules/follow-redirects/index.js b/project starter code/node_modules/follow-redirects/index.js new file mode 100644 index 00000000..c649cab4 --- /dev/null +++ b/project starter code/node_modules/follow-redirects/index.js @@ -0,0 +1,672 @@ +var url = require("url"); +var URL = url.URL; +var http = require("http"); +var https = require("https"); +var Writable = require("stream").Writable; +var assert = require("assert"); +var debug = require("./debug"); + +// Whether to use the native URL object or the legacy url module +var useNativeURL = false; +try { + assert(new URL()); +} +catch (error) { + useNativeURL = error.code === "ERR_INVALID_URL"; +} + +// URL fields to preserve in copy operations +var preservedUrlFields = [ + "auth", + "host", + "hostname", + "href", + "path", + "pathname", + "port", + "protocol", + "query", + "search", + "hash", +]; + +// Create handlers that pass events from native requests +var events = ["abort", "aborted", "connect", "error", "socket", "timeout"]; +var eventHandlers = Object.create(null); +events.forEach(function (event) { + eventHandlers[event] = function (arg1, arg2, arg3) { + this._redirectable.emit(event, arg1, arg2, arg3); + }; +}); + +// Error types with codes +var InvalidUrlError = createErrorType( + "ERR_INVALID_URL", + "Invalid URL", + TypeError +); +var RedirectionError = createErrorType( + "ERR_FR_REDIRECTION_FAILURE", + "Redirected request failed" +); +var TooManyRedirectsError = createErrorType( + "ERR_FR_TOO_MANY_REDIRECTS", + "Maximum number of redirects exceeded", + RedirectionError +); +var MaxBodyLengthExceededError = createErrorType( + "ERR_FR_MAX_BODY_LENGTH_EXCEEDED", + "Request body larger than maxBodyLength limit" +); +var WriteAfterEndError = createErrorType( + "ERR_STREAM_WRITE_AFTER_END", + "write after end" +); + +// istanbul ignore next +var destroy = Writable.prototype.destroy || noop; + +// An HTTP(S) request that can be redirected +function RedirectableRequest(options, responseCallback) { + // Initialize the request + Writable.call(this); + this._sanitizeOptions(options); + this._options = options; + this._ended = false; + this._ending = false; + this._redirectCount = 0; + this._redirects = []; + this._requestBodyLength = 0; + this._requestBodyBuffers = []; + + // Attach a callback if passed + if (responseCallback) { + this.on("response", responseCallback); + } + + // React to responses of native requests + var self = this; + this._onNativeResponse = function (response) { + try { + self._processResponse(response); + } + catch (cause) { + self.emit("error", cause instanceof RedirectionError ? + cause : new RedirectionError({ cause: cause })); + } + }; + + // Perform the first request + this._performRequest(); +} +RedirectableRequest.prototype = Object.create(Writable.prototype); + +RedirectableRequest.prototype.abort = function () { + destroyRequest(this._currentRequest); + this._currentRequest.abort(); + this.emit("abort"); +}; + +RedirectableRequest.prototype.destroy = function (error) { + destroyRequest(this._currentRequest, error); + destroy.call(this, error); + return this; +}; + +// Writes buffered data to the current native request +RedirectableRequest.prototype.write = function (data, encoding, callback) { + // Writing is not allowed if end has been called + if (this._ending) { + throw new WriteAfterEndError(); + } + + // Validate input and shift parameters if necessary + if (!isString(data) && !isBuffer(data)) { + throw new TypeError("data should be a string, Buffer or Uint8Array"); + } + if (isFunction(encoding)) { + callback = encoding; + encoding = null; + } + + // Ignore empty buffers, since writing them doesn't invoke the callback + // https://github.com/nodejs/node/issues/22066 + if (data.length === 0) { + if (callback) { + callback(); + } + return; + } + // Only write when we don't exceed the maximum body length + if (this._requestBodyLength + data.length <= this._options.maxBodyLength) { + this._requestBodyLength += data.length; + this._requestBodyBuffers.push({ data: data, encoding: encoding }); + this._currentRequest.write(data, encoding, callback); + } + // Error when we exceed the maximum body length + else { + this.emit("error", new MaxBodyLengthExceededError()); + this.abort(); + } +}; + +// Ends the current native request +RedirectableRequest.prototype.end = function (data, encoding, callback) { + // Shift parameters if necessary + if (isFunction(data)) { + callback = data; + data = encoding = null; + } + else if (isFunction(encoding)) { + callback = encoding; + encoding = null; + } + + // Write data if needed and end + if (!data) { + this._ended = this._ending = true; + this._currentRequest.end(null, null, callback); + } + else { + var self = this; + var currentRequest = this._currentRequest; + this.write(data, encoding, function () { + self._ended = true; + currentRequest.end(null, null, callback); + }); + this._ending = true; + } +}; + +// Sets a header value on the current native request +RedirectableRequest.prototype.setHeader = function (name, value) { + this._options.headers[name] = value; + this._currentRequest.setHeader(name, value); +}; + +// Clears a header value on the current native request +RedirectableRequest.prototype.removeHeader = function (name) { + delete this._options.headers[name]; + this._currentRequest.removeHeader(name); +}; + +// Global timeout for all underlying requests +RedirectableRequest.prototype.setTimeout = function (msecs, callback) { + var self = this; + + // Destroys the socket on timeout + function destroyOnTimeout(socket) { + socket.setTimeout(msecs); + socket.removeListener("timeout", socket.destroy); + socket.addListener("timeout", socket.destroy); + } + + // Sets up a timer to trigger a timeout event + function startTimer(socket) { + if (self._timeout) { + clearTimeout(self._timeout); + } + self._timeout = setTimeout(function () { + self.emit("timeout"); + clearTimer(); + }, msecs); + destroyOnTimeout(socket); + } + + // Stops a timeout from triggering + function clearTimer() { + // Clear the timeout + if (self._timeout) { + clearTimeout(self._timeout); + self._timeout = null; + } + + // Clean up all attached listeners + self.removeListener("abort", clearTimer); + self.removeListener("error", clearTimer); + self.removeListener("response", clearTimer); + self.removeListener("close", clearTimer); + if (callback) { + self.removeListener("timeout", callback); + } + if (!self.socket) { + self._currentRequest.removeListener("socket", startTimer); + } + } + + // Attach callback if passed + if (callback) { + this.on("timeout", callback); + } + + // Start the timer if or when the socket is opened + if (this.socket) { + startTimer(this.socket); + } + else { + this._currentRequest.once("socket", startTimer); + } + + // Clean up on events + this.on("socket", destroyOnTimeout); + this.on("abort", clearTimer); + this.on("error", clearTimer); + this.on("response", clearTimer); + this.on("close", clearTimer); + + return this; +}; + +// Proxy all other public ClientRequest methods +[ + "flushHeaders", "getHeader", + "setNoDelay", "setSocketKeepAlive", +].forEach(function (method) { + RedirectableRequest.prototype[method] = function (a, b) { + return this._currentRequest[method](a, b); + }; +}); + +// Proxy all public ClientRequest properties +["aborted", "connection", "socket"].forEach(function (property) { + Object.defineProperty(RedirectableRequest.prototype, property, { + get: function () { return this._currentRequest[property]; }, + }); +}); + +RedirectableRequest.prototype._sanitizeOptions = function (options) { + // Ensure headers are always present + if (!options.headers) { + options.headers = {}; + } + + // Since http.request treats host as an alias of hostname, + // but the url module interprets host as hostname plus port, + // eliminate the host property to avoid confusion. + if (options.host) { + // Use hostname if set, because it has precedence + if (!options.hostname) { + options.hostname = options.host; + } + delete options.host; + } + + // Complete the URL object when necessary + if (!options.pathname && options.path) { + var searchPos = options.path.indexOf("?"); + if (searchPos < 0) { + options.pathname = options.path; + } + else { + options.pathname = options.path.substring(0, searchPos); + options.search = options.path.substring(searchPos); + } + } +}; + + +// Executes the next native request (initial or redirect) +RedirectableRequest.prototype._performRequest = function () { + // Load the native protocol + var protocol = this._options.protocol; + var nativeProtocol = this._options.nativeProtocols[protocol]; + if (!nativeProtocol) { + throw new TypeError("Unsupported protocol " + protocol); + } + + // If specified, use the agent corresponding to the protocol + // (HTTP and HTTPS use different types of agents) + if (this._options.agents) { + var scheme = protocol.slice(0, -1); + this._options.agent = this._options.agents[scheme]; + } + + // Create the native request and set up its event handlers + var request = this._currentRequest = + nativeProtocol.request(this._options, this._onNativeResponse); + request._redirectable = this; + for (var event of events) { + request.on(event, eventHandlers[event]); + } + + // RFC7230§5.3.1: When making a request directly to an origin server, […] + // a client MUST send only the absolute path […] as the request-target. + this._currentUrl = /^\//.test(this._options.path) ? + url.format(this._options) : + // When making a request to a proxy, […] + // a client MUST send the target URI in absolute-form […]. + this._options.path; + + // End a redirected request + // (The first request must be ended explicitly with RedirectableRequest#end) + if (this._isRedirect) { + // Write the request entity and end + var i = 0; + var self = this; + var buffers = this._requestBodyBuffers; + (function writeNext(error) { + // Only write if this request has not been redirected yet + /* istanbul ignore else */ + if (request === self._currentRequest) { + // Report any write errors + /* istanbul ignore if */ + if (error) { + self.emit("error", error); + } + // Write the next buffer if there are still left + else if (i < buffers.length) { + var buffer = buffers[i++]; + /* istanbul ignore else */ + if (!request.finished) { + request.write(buffer.data, buffer.encoding, writeNext); + } + } + // End the request if `end` has been called on us + else if (self._ended) { + request.end(); + } + } + }()); + } +}; + +// Processes a response from the current native request +RedirectableRequest.prototype._processResponse = function (response) { + // Store the redirected response + var statusCode = response.statusCode; + if (this._options.trackRedirects) { + this._redirects.push({ + url: this._currentUrl, + headers: response.headers, + statusCode: statusCode, + }); + } + + // RFC7231§6.4: The 3xx (Redirection) class of status code indicates + // that further action needs to be taken by the user agent in order to + // fulfill the request. If a Location header field is provided, + // the user agent MAY automatically redirect its request to the URI + // referenced by the Location field value, + // even if the specific status code is not understood. + + // If the response is not a redirect; return it as-is + var location = response.headers.location; + if (!location || this._options.followRedirects === false || + statusCode < 300 || statusCode >= 400) { + response.responseUrl = this._currentUrl; + response.redirects = this._redirects; + this.emit("response", response); + + // Clean up + this._requestBodyBuffers = []; + return; + } + + // The response is a redirect, so abort the current request + destroyRequest(this._currentRequest); + // Discard the remainder of the response to avoid waiting for data + response.destroy(); + + // RFC7231§6.4: A client SHOULD detect and intervene + // in cyclical redirections (i.e., "infinite" redirection loops). + if (++this._redirectCount > this._options.maxRedirects) { + throw new TooManyRedirectsError(); + } + + // Store the request headers if applicable + var requestHeaders; + var beforeRedirect = this._options.beforeRedirect; + if (beforeRedirect) { + requestHeaders = Object.assign({ + // The Host header was set by nativeProtocol.request + Host: response.req.getHeader("host"), + }, this._options.headers); + } + + // RFC7231§6.4: Automatic redirection needs to done with + // care for methods not known to be safe, […] + // RFC7231§6.4.2–3: For historical reasons, a user agent MAY change + // the request method from POST to GET for the subsequent request. + var method = this._options.method; + if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" || + // RFC7231§6.4.4: The 303 (See Other) status code indicates that + // the server is redirecting the user agent to a different resource […] + // A user agent can perform a retrieval request targeting that URI + // (a GET or HEAD request if using HTTP) […] + (statusCode === 303) && !/^(?:GET|HEAD)$/.test(this._options.method)) { + this._options.method = "GET"; + // Drop a possible entity and headers related to it + this._requestBodyBuffers = []; + removeMatchingHeaders(/^content-/i, this._options.headers); + } + + // Drop the Host header, as the redirect might lead to a different host + var currentHostHeader = removeMatchingHeaders(/^host$/i, this._options.headers); + + // If the redirect is relative, carry over the host of the last request + var currentUrlParts = parseUrl(this._currentUrl); + var currentHost = currentHostHeader || currentUrlParts.host; + var currentUrl = /^\w+:/.test(location) ? this._currentUrl : + url.format(Object.assign(currentUrlParts, { host: currentHost })); + + // Create the redirected request + var redirectUrl = resolveUrl(location, currentUrl); + debug("redirecting to", redirectUrl.href); + this._isRedirect = true; + spreadUrlObject(redirectUrl, this._options); + + // Drop confidential headers when redirecting to a less secure protocol + // or to a different domain that is not a superdomain + if (redirectUrl.protocol !== currentUrlParts.protocol && + redirectUrl.protocol !== "https:" || + redirectUrl.host !== currentHost && + !isSubdomain(redirectUrl.host, currentHost)) { + removeMatchingHeaders(/^(?:(?:proxy-)?authorization|cookie)$/i, this._options.headers); + } + + // Evaluate the beforeRedirect callback + if (isFunction(beforeRedirect)) { + var responseDetails = { + headers: response.headers, + statusCode: statusCode, + }; + var requestDetails = { + url: currentUrl, + method: method, + headers: requestHeaders, + }; + beforeRedirect(this._options, responseDetails, requestDetails); + this._sanitizeOptions(this._options); + } + + // Perform the redirected request + this._performRequest(); +}; + +// Wraps the key/value object of protocols with redirect functionality +function wrap(protocols) { + // Default settings + var exports = { + maxRedirects: 21, + maxBodyLength: 10 * 1024 * 1024, + }; + + // Wrap each protocol + var nativeProtocols = {}; + Object.keys(protocols).forEach(function (scheme) { + var protocol = scheme + ":"; + var nativeProtocol = nativeProtocols[protocol] = protocols[scheme]; + var wrappedProtocol = exports[scheme] = Object.create(nativeProtocol); + + // Executes a request, following redirects + function request(input, options, callback) { + // Parse parameters, ensuring that input is an object + if (isURL(input)) { + input = spreadUrlObject(input); + } + else if (isString(input)) { + input = spreadUrlObject(parseUrl(input)); + } + else { + callback = options; + options = validateUrl(input); + input = { protocol: protocol }; + } + if (isFunction(options)) { + callback = options; + options = null; + } + + // Set defaults + options = Object.assign({ + maxRedirects: exports.maxRedirects, + maxBodyLength: exports.maxBodyLength, + }, input, options); + options.nativeProtocols = nativeProtocols; + if (!isString(options.host) && !isString(options.hostname)) { + options.hostname = "::1"; + } + + assert.equal(options.protocol, protocol, "protocol mismatch"); + debug("options", options); + return new RedirectableRequest(options, callback); + } + + // Executes a GET request, following redirects + function get(input, options, callback) { + var wrappedRequest = wrappedProtocol.request(input, options, callback); + wrappedRequest.end(); + return wrappedRequest; + } + + // Expose the properties on the wrapped protocol + Object.defineProperties(wrappedProtocol, { + request: { value: request, configurable: true, enumerable: true, writable: true }, + get: { value: get, configurable: true, enumerable: true, writable: true }, + }); + }); + return exports; +} + +function noop() { /* empty */ } + +function parseUrl(input) { + var parsed; + /* istanbul ignore else */ + if (useNativeURL) { + parsed = new URL(input); + } + else { + // Ensure the URL is valid and absolute + parsed = validateUrl(url.parse(input)); + if (!isString(parsed.protocol)) { + throw new InvalidUrlError({ input }); + } + } + return parsed; +} + +function resolveUrl(relative, base) { + /* istanbul ignore next */ + return useNativeURL ? new URL(relative, base) : parseUrl(url.resolve(base, relative)); +} + +function validateUrl(input) { + if (/^\[/.test(input.hostname) && !/^\[[:0-9a-f]+\]$/i.test(input.hostname)) { + throw new InvalidUrlError({ input: input.href || input }); + } + if (/^\[/.test(input.host) && !/^\[[:0-9a-f]+\](:\d+)?$/i.test(input.host)) { + throw new InvalidUrlError({ input: input.href || input }); + } + return input; +} + +function spreadUrlObject(urlObject, target) { + var spread = target || {}; + for (var key of preservedUrlFields) { + spread[key] = urlObject[key]; + } + + // Fix IPv6 hostname + if (spread.hostname.startsWith("[")) { + spread.hostname = spread.hostname.slice(1, -1); + } + // Ensure port is a number + if (spread.port !== "") { + spread.port = Number(spread.port); + } + // Concatenate path + spread.path = spread.search ? spread.pathname + spread.search : spread.pathname; + + return spread; +} + +function removeMatchingHeaders(regex, headers) { + var lastValue; + for (var header in headers) { + if (regex.test(header)) { + lastValue = headers[header]; + delete headers[header]; + } + } + return (lastValue === null || typeof lastValue === "undefined") ? + undefined : String(lastValue).trim(); +} + +function createErrorType(code, message, baseClass) { + // Create constructor + function CustomError(properties) { + Error.captureStackTrace(this, this.constructor); + Object.assign(this, properties || {}); + this.code = code; + this.message = this.cause ? message + ": " + this.cause.message : message; + } + + // Attach constructor and set default properties + CustomError.prototype = new (baseClass || Error)(); + Object.defineProperties(CustomError.prototype, { + constructor: { + value: CustomError, + enumerable: false, + }, + name: { + value: "Error [" + code + "]", + enumerable: false, + }, + }); + return CustomError; +} + +function destroyRequest(request, error) { + for (var event of events) { + request.removeListener(event, eventHandlers[event]); + } + request.on("error", noop); + request.destroy(error); +} + +function isSubdomain(subdomain, domain) { + assert(isString(subdomain) && isString(domain)); + var dot = subdomain.length - domain.length - 1; + return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain); +} + +function isString(value) { + return typeof value === "string" || value instanceof String; +} + +function isFunction(value) { + return typeof value === "function"; +} + +function isBuffer(value) { + return typeof value === "object" && ("length" in value); +} + +function isURL(value) { + return URL && value instanceof URL; +} + +// Exports +module.exports = wrap({ http: http, https: https }); +module.exports.wrap = wrap; diff --git a/project starter code/node_modules/follow-redirects/package.json b/project starter code/node_modules/follow-redirects/package.json new file mode 100644 index 00000000..149943bb --- /dev/null +++ b/project starter code/node_modules/follow-redirects/package.json @@ -0,0 +1,58 @@ +{ + "name": "follow-redirects", + "version": "1.15.6", + "description": "HTTP and HTTPS modules that follow redirects.", + "license": "MIT", + "main": "index.js", + "files": [ + "*.js" + ], + "engines": { + "node": ">=4.0" + }, + "scripts": { + "lint": "eslint *.js test", + "test": "nyc mocha" + }, + "repository": { + "type": "git", + "url": "git@github.com:follow-redirects/follow-redirects.git" + }, + "homepage": "https://github.com/follow-redirects/follow-redirects", + "bugs": { + "url": "https://github.com/follow-redirects/follow-redirects/issues" + }, + "keywords": [ + "http", + "https", + "url", + "redirect", + "client", + "location", + "utility" + ], + "author": "Ruben Verborgh (https://ruben.verborgh.org/)", + "contributors": [ + "Olivier Lalonde (http://www.syskall.com)", + "James Talmage " + ], + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "peerDependenciesMeta": { + "debug": { + "optional": true + } + }, + "devDependencies": { + "concat-stream": "^2.0.0", + "eslint": "^5.16.0", + "express": "^4.16.4", + "lolex": "^3.1.0", + "mocha": "^6.0.2", + "nyc": "^14.1.1" + } +} diff --git a/project starter code/node_modules/form-data/License b/project starter code/node_modules/form-data/License new file mode 100644 index 00000000..c7ff12a2 --- /dev/null +++ b/project starter code/node_modules/form-data/License @@ -0,0 +1,19 @@ +Copyright (c) 2012 Felix Geisendörfer (felix@debuggable.com) and contributors + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. diff --git a/project starter code/node_modules/form-data/README.md.bak b/project starter code/node_modules/form-data/README.md.bak new file mode 100644 index 00000000..298a1a24 --- /dev/null +++ b/project starter code/node_modules/form-data/README.md.bak @@ -0,0 +1,358 @@ +# Form-Data [![NPM Module](https://img.shields.io/npm/v/form-data.svg)](https://www.npmjs.com/package/form-data) [![Join the chat at https://gitter.im/form-data/form-data](http://form-data.github.io/images/gitterbadge.svg)](https://gitter.im/form-data/form-data) + +A library to create readable ```"multipart/form-data"``` streams. Can be used to submit forms and file uploads to other web applications. + +The API of this library is inspired by the [XMLHttpRequest-2 FormData Interface][xhr2-fd]. + +[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface + +[![Linux Build](https://img.shields.io/travis/form-data/form-data/v4.0.0.svg?label=linux:6.x-12.x)](https://travis-ci.org/form-data/form-data) +[![MacOS Build](https://img.shields.io/travis/form-data/form-data/v4.0.0.svg?label=macos:6.x-12.x)](https://travis-ci.org/form-data/form-data) +[![Windows Build](https://img.shields.io/travis/form-data/form-data/v4.0.0.svg?label=windows:6.x-12.x)](https://travis-ci.org/form-data/form-data) + +[![Coverage Status](https://img.shields.io/coveralls/form-data/form-data/v4.0.0.svg?label=code+coverage)](https://coveralls.io/github/form-data/form-data?branch=master) +[![Dependency Status](https://img.shields.io/david/form-data/form-data.svg)](https://david-dm.org/form-data/form-data) + +## Install + +``` +npm install --save form-data +``` + +## Usage + +In this example we are constructing a form with 3 fields that contain a string, +a buffer and a file stream. + +``` javascript +var FormData = require('form-data'); +var fs = require('fs'); + +var form = new FormData(); +form.append('my_field', 'my value'); +form.append('my_buffer', new Buffer(10)); +form.append('my_file', fs.createReadStream('/foo/bar.jpg')); +``` + +Also you can use http-response stream: + +``` javascript +var FormData = require('form-data'); +var http = require('http'); + +var form = new FormData(); + +http.request('http://nodejs.org/images/logo.png', function(response) { + form.append('my_field', 'my value'); + form.append('my_buffer', new Buffer(10)); + form.append('my_logo', response); +}); +``` + +Or @mikeal's [request](https://github.com/request/request) stream: + +``` javascript +var FormData = require('form-data'); +var request = require('request'); + +var form = new FormData(); + +form.append('my_field', 'my value'); +form.append('my_buffer', new Buffer(10)); +form.append('my_logo', request('http://nodejs.org/images/logo.png')); +``` + +In order to submit this form to a web application, call ```submit(url, [callback])``` method: + +``` javascript +form.submit('http://example.org/', function(err, res) { + // res – response object (http.IncomingMessage) // + res.resume(); +}); + +``` + +For more advanced request manipulations ```submit()``` method returns ```http.ClientRequest``` object, or you can choose from one of the alternative submission methods. + +### Custom options + +You can provide custom options, such as `maxDataSize`: + +``` javascript +var FormData = require('form-data'); + +var form = new FormData({ maxDataSize: 20971520 }); +form.append('my_field', 'my value'); +form.append('my_buffer', /* something big */); +``` + +List of available options could be found in [combined-stream](https://github.com/felixge/node-combined-stream/blob/master/lib/combined_stream.js#L7-L15) + +### Alternative submission methods + +You can use node's http client interface: + +``` javascript +var http = require('http'); + +var request = http.request({ + method: 'post', + host: 'example.org', + path: '/upload', + headers: form.getHeaders() +}); + +form.pipe(request); + +request.on('response', function(res) { + console.log(res.statusCode); +}); +``` + +Or if you would prefer the `'Content-Length'` header to be set for you: + +``` javascript +form.submit('example.org/upload', function(err, res) { + console.log(res.statusCode); +}); +``` + +To use custom headers and pre-known length in parts: + +``` javascript +var CRLF = '\r\n'; +var form = new FormData(); + +var options = { + header: CRLF + '--' + form.getBoundary() + CRLF + 'X-Custom-Header: 123' + CRLF + CRLF, + knownLength: 1 +}; + +form.append('my_buffer', buffer, options); + +form.submit('http://example.com/', function(err, res) { + if (err) throw err; + console.log('Done'); +}); +``` + +Form-Data can recognize and fetch all the required information from common types of streams (```fs.readStream```, ```http.response``` and ```mikeal's request```), for some other types of streams you'd need to provide "file"-related information manually: + +``` javascript +someModule.stream(function(err, stdout, stderr) { + if (err) throw err; + + var form = new FormData(); + + form.append('file', stdout, { + filename: 'unicycle.jpg', // ... or: + filepath: 'photos/toys/unicycle.jpg', + contentType: 'image/jpeg', + knownLength: 19806 + }); + + form.submit('http://example.com/', function(err, res) { + if (err) throw err; + console.log('Done'); + }); +}); +``` + +The `filepath` property overrides `filename` and may contain a relative path. This is typically used when uploading [multiple files from a directory](https://wicg.github.io/entries-api/#dom-htmlinputelement-webkitdirectory). + +For edge cases, like POST request to URL with query string or to pass HTTP auth credentials, object can be passed to `form.submit()` as first parameter: + +``` javascript +form.submit({ + host: 'example.com', + path: '/probably.php?extra=params', + auth: 'username:password' +}, function(err, res) { + console.log(res.statusCode); +}); +``` + +In case you need to also send custom HTTP headers with the POST request, you can use the `headers` key in first parameter of `form.submit()`: + +``` javascript +form.submit({ + host: 'example.com', + path: '/surelynot.php', + headers: {'x-test-header': 'test-header-value'} +}, function(err, res) { + console.log(res.statusCode); +}); +``` + +### Methods + +- [_Void_ append( **String** _field_, **Mixed** _value_ [, **Mixed** _options_] )](https://github.com/form-data/form-data#void-append-string-field-mixed-value--mixed-options-). +- [_Headers_ getHeaders( [**Headers** _userHeaders_] )](https://github.com/form-data/form-data#array-getheaders-array-userheaders-) +- [_String_ getBoundary()](https://github.com/form-data/form-data#string-getboundary) +- [_Void_ setBoundary()](https://github.com/form-data/form-data#void-setboundary) +- [_Buffer_ getBuffer()](https://github.com/form-data/form-data#buffer-getbuffer) +- [_Integer_ getLengthSync()](https://github.com/form-data/form-data#integer-getlengthsync) +- [_Integer_ getLength( **function** _callback_ )](https://github.com/form-data/form-data#integer-getlength-function-callback-) +- [_Boolean_ hasKnownLength()](https://github.com/form-data/form-data#boolean-hasknownlength) +- [_Request_ submit( _params_, **function** _callback_ )](https://github.com/form-data/form-data#request-submit-params-function-callback-) +- [_String_ toString()](https://github.com/form-data/form-data#string-tostring) + +#### _Void_ append( **String** _field_, **Mixed** _value_ [, **Mixed** _options_] ) +Append data to the form. You can submit about any format (string, integer, boolean, buffer, etc.). However, Arrays are not supported and need to be turned into strings by the user. +```javascript +var form = new FormData(); +form.append( 'my_string', 'my value' ); +form.append( 'my_integer', 1 ); +form.append( 'my_boolean', true ); +form.append( 'my_buffer', new Buffer(10) ); +form.append( 'my_array_as_json', JSON.stringify( ['bird','cute'] ) ) +``` + +You may provide a string for options, or an object. +```javascript +// Set filename by providing a string for options +form.append( 'my_file', fs.createReadStream('/foo/bar.jpg'), 'bar.jpg' ); + +// provide an object. +form.append( 'my_file', fs.createReadStream('/foo/bar.jpg'), {filename: 'bar.jpg', contentType: 'image/jpeg', knownLength: 19806} ); +``` + +#### _Headers_ getHeaders( [**Headers** _userHeaders_] ) +This method adds the correct `content-type` header to the provided array of `userHeaders`. + +#### _String_ getBoundary() +Return the boundary of the formData. By default, the boundary consists of 26 `-` followed by 24 numbers +for example: +```javascript +--------------------------515890814546601021194782 +``` + +#### _Void_ setBoundary(String _boundary_) +Set the boundary string, overriding the default behavior described above. + +_Note: The boundary must be unique and may not appear in the data._ + +#### _Buffer_ getBuffer() +Return the full formdata request package, as a Buffer. You can insert this Buffer in e.g. Axios to send multipart data. +```javascript +var form = new FormData(); +form.append( 'my_buffer', Buffer.from([0x4a,0x42,0x20,0x52,0x6f,0x63,0x6b,0x73]) ); +form.append( 'my_file', fs.readFileSync('/foo/bar.jpg') ); + +axios.post( 'https://example.com/path/to/api', + form.getBuffer(), + form.getHeaders() + ) +``` +**Note:** Because the output is of type Buffer, you can only append types that are accepted by Buffer: *string, Buffer, ArrayBuffer, Array, or Array-like Object*. A ReadStream for example will result in an error. + +#### _Integer_ getLengthSync() +Same as `getLength` but synchronous. + +_Note: getLengthSync __doesn't__ calculate streams length._ + +#### _Integer_ getLength( **function** _callback_ ) +Returns the `Content-Length` async. The callback is used to handle errors and continue once the length has been calculated +```javascript +this.getLength(function(err, length) { + if (err) { + this._error(err); + return; + } + + // add content length + request.setHeader('Content-Length', length); + + ... +}.bind(this)); +``` + +#### _Boolean_ hasKnownLength() +Checks if the length of added values is known. + +#### _Request_ submit( _params_, **function** _callback_ ) +Submit the form to a web application. +```javascript +var form = new FormData(); +form.append( 'my_string', 'Hello World' ); + +form.submit( 'http://example.com/', function(err, res) { + // res – response object (http.IncomingMessage) // + res.resume(); +} ); +``` + +#### _String_ toString() +Returns the form data as a string. Don't use this if you are sending files or buffers, use `getBuffer()` instead. + +### Integration with other libraries + +#### Request + +Form submission using [request](https://github.com/request/request): + +```javascript +var formData = { + my_field: 'my_value', + my_file: fs.createReadStream(__dirname + '/unicycle.jpg'), +}; + +request.post({url:'http://service.com/upload', formData: formData}, function(err, httpResponse, body) { + if (err) { + return console.error('upload failed:', err); + } + console.log('Upload successful! Server responded with:', body); +}); +``` + +For more details see [request readme](https://github.com/request/request#multipartform-data-multipart-form-uploads). + +#### node-fetch + +You can also submit a form using [node-fetch](https://github.com/bitinn/node-fetch): + +```javascript +var form = new FormData(); + +form.append('a', 1); + +fetch('http://example.com', { method: 'POST', body: form }) + .then(function(res) { + return res.json(); + }).then(function(json) { + console.log(json); + }); +``` + +#### axios + +In Node.js you can post a file using [axios](https://github.com/axios/axios): +```javascript +const form = new FormData(); +const stream = fs.createReadStream(PATH_TO_FILE); + +form.append('image', stream); + +// In Node.js environment you need to set boundary in the header field 'Content-Type' by calling method `getHeaders` +const formHeaders = form.getHeaders(); + +axios.post('http://example.com', form, { + headers: { + ...formHeaders, + }, +}) +.then(response => response) +.catch(error => error) +``` + +## Notes + +- ```getLengthSync()``` method DOESN'T calculate length for streams, use ```knownLength``` options as workaround. +- ```getLength(cb)``` will send an error as first parameter of callback if stream length cannot be calculated (e.g. send in custom streams w/o using ```knownLength```). +- ```submit``` will not add `content-length` if form length is unknown or not calculable. +- Starting version `2.x` FormData has dropped support for `node@0.10.x`. +- Starting version `3.x` FormData has dropped support for `node@4.x`. + +## License + +Form-Data is released under the [MIT](License) license. diff --git a/project starter code/node_modules/form-data/Readme.md b/project starter code/node_modules/form-data/Readme.md new file mode 100644 index 00000000..298a1a24 --- /dev/null +++ b/project starter code/node_modules/form-data/Readme.md @@ -0,0 +1,358 @@ +# Form-Data [![NPM Module](https://img.shields.io/npm/v/form-data.svg)](https://www.npmjs.com/package/form-data) [![Join the chat at https://gitter.im/form-data/form-data](http://form-data.github.io/images/gitterbadge.svg)](https://gitter.im/form-data/form-data) + +A library to create readable ```"multipart/form-data"``` streams. Can be used to submit forms and file uploads to other web applications. + +The API of this library is inspired by the [XMLHttpRequest-2 FormData Interface][xhr2-fd]. + +[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface + +[![Linux Build](https://img.shields.io/travis/form-data/form-data/v4.0.0.svg?label=linux:6.x-12.x)](https://travis-ci.org/form-data/form-data) +[![MacOS Build](https://img.shields.io/travis/form-data/form-data/v4.0.0.svg?label=macos:6.x-12.x)](https://travis-ci.org/form-data/form-data) +[![Windows Build](https://img.shields.io/travis/form-data/form-data/v4.0.0.svg?label=windows:6.x-12.x)](https://travis-ci.org/form-data/form-data) + +[![Coverage Status](https://img.shields.io/coveralls/form-data/form-data/v4.0.0.svg?label=code+coverage)](https://coveralls.io/github/form-data/form-data?branch=master) +[![Dependency Status](https://img.shields.io/david/form-data/form-data.svg)](https://david-dm.org/form-data/form-data) + +## Install + +``` +npm install --save form-data +``` + +## Usage + +In this example we are constructing a form with 3 fields that contain a string, +a buffer and a file stream. + +``` javascript +var FormData = require('form-data'); +var fs = require('fs'); + +var form = new FormData(); +form.append('my_field', 'my value'); +form.append('my_buffer', new Buffer(10)); +form.append('my_file', fs.createReadStream('/foo/bar.jpg')); +``` + +Also you can use http-response stream: + +``` javascript +var FormData = require('form-data'); +var http = require('http'); + +var form = new FormData(); + +http.request('http://nodejs.org/images/logo.png', function(response) { + form.append('my_field', 'my value'); + form.append('my_buffer', new Buffer(10)); + form.append('my_logo', response); +}); +``` + +Or @mikeal's [request](https://github.com/request/request) stream: + +``` javascript +var FormData = require('form-data'); +var request = require('request'); + +var form = new FormData(); + +form.append('my_field', 'my value'); +form.append('my_buffer', new Buffer(10)); +form.append('my_logo', request('http://nodejs.org/images/logo.png')); +``` + +In order to submit this form to a web application, call ```submit(url, [callback])``` method: + +``` javascript +form.submit('http://example.org/', function(err, res) { + // res – response object (http.IncomingMessage) // + res.resume(); +}); + +``` + +For more advanced request manipulations ```submit()``` method returns ```http.ClientRequest``` object, or you can choose from one of the alternative submission methods. + +### Custom options + +You can provide custom options, such as `maxDataSize`: + +``` javascript +var FormData = require('form-data'); + +var form = new FormData({ maxDataSize: 20971520 }); +form.append('my_field', 'my value'); +form.append('my_buffer', /* something big */); +``` + +List of available options could be found in [combined-stream](https://github.com/felixge/node-combined-stream/blob/master/lib/combined_stream.js#L7-L15) + +### Alternative submission methods + +You can use node's http client interface: + +``` javascript +var http = require('http'); + +var request = http.request({ + method: 'post', + host: 'example.org', + path: '/upload', + headers: form.getHeaders() +}); + +form.pipe(request); + +request.on('response', function(res) { + console.log(res.statusCode); +}); +``` + +Or if you would prefer the `'Content-Length'` header to be set for you: + +``` javascript +form.submit('example.org/upload', function(err, res) { + console.log(res.statusCode); +}); +``` + +To use custom headers and pre-known length in parts: + +``` javascript +var CRLF = '\r\n'; +var form = new FormData(); + +var options = { + header: CRLF + '--' + form.getBoundary() + CRLF + 'X-Custom-Header: 123' + CRLF + CRLF, + knownLength: 1 +}; + +form.append('my_buffer', buffer, options); + +form.submit('http://example.com/', function(err, res) { + if (err) throw err; + console.log('Done'); +}); +``` + +Form-Data can recognize and fetch all the required information from common types of streams (```fs.readStream```, ```http.response``` and ```mikeal's request```), for some other types of streams you'd need to provide "file"-related information manually: + +``` javascript +someModule.stream(function(err, stdout, stderr) { + if (err) throw err; + + var form = new FormData(); + + form.append('file', stdout, { + filename: 'unicycle.jpg', // ... or: + filepath: 'photos/toys/unicycle.jpg', + contentType: 'image/jpeg', + knownLength: 19806 + }); + + form.submit('http://example.com/', function(err, res) { + if (err) throw err; + console.log('Done'); + }); +}); +``` + +The `filepath` property overrides `filename` and may contain a relative path. This is typically used when uploading [multiple files from a directory](https://wicg.github.io/entries-api/#dom-htmlinputelement-webkitdirectory). + +For edge cases, like POST request to URL with query string or to pass HTTP auth credentials, object can be passed to `form.submit()` as first parameter: + +``` javascript +form.submit({ + host: 'example.com', + path: '/probably.php?extra=params', + auth: 'username:password' +}, function(err, res) { + console.log(res.statusCode); +}); +``` + +In case you need to also send custom HTTP headers with the POST request, you can use the `headers` key in first parameter of `form.submit()`: + +``` javascript +form.submit({ + host: 'example.com', + path: '/surelynot.php', + headers: {'x-test-header': 'test-header-value'} +}, function(err, res) { + console.log(res.statusCode); +}); +``` + +### Methods + +- [_Void_ append( **String** _field_, **Mixed** _value_ [, **Mixed** _options_] )](https://github.com/form-data/form-data#void-append-string-field-mixed-value--mixed-options-). +- [_Headers_ getHeaders( [**Headers** _userHeaders_] )](https://github.com/form-data/form-data#array-getheaders-array-userheaders-) +- [_String_ getBoundary()](https://github.com/form-data/form-data#string-getboundary) +- [_Void_ setBoundary()](https://github.com/form-data/form-data#void-setboundary) +- [_Buffer_ getBuffer()](https://github.com/form-data/form-data#buffer-getbuffer) +- [_Integer_ getLengthSync()](https://github.com/form-data/form-data#integer-getlengthsync) +- [_Integer_ getLength( **function** _callback_ )](https://github.com/form-data/form-data#integer-getlength-function-callback-) +- [_Boolean_ hasKnownLength()](https://github.com/form-data/form-data#boolean-hasknownlength) +- [_Request_ submit( _params_, **function** _callback_ )](https://github.com/form-data/form-data#request-submit-params-function-callback-) +- [_String_ toString()](https://github.com/form-data/form-data#string-tostring) + +#### _Void_ append( **String** _field_, **Mixed** _value_ [, **Mixed** _options_] ) +Append data to the form. You can submit about any format (string, integer, boolean, buffer, etc.). However, Arrays are not supported and need to be turned into strings by the user. +```javascript +var form = new FormData(); +form.append( 'my_string', 'my value' ); +form.append( 'my_integer', 1 ); +form.append( 'my_boolean', true ); +form.append( 'my_buffer', new Buffer(10) ); +form.append( 'my_array_as_json', JSON.stringify( ['bird','cute'] ) ) +``` + +You may provide a string for options, or an object. +```javascript +// Set filename by providing a string for options +form.append( 'my_file', fs.createReadStream('/foo/bar.jpg'), 'bar.jpg' ); + +// provide an object. +form.append( 'my_file', fs.createReadStream('/foo/bar.jpg'), {filename: 'bar.jpg', contentType: 'image/jpeg', knownLength: 19806} ); +``` + +#### _Headers_ getHeaders( [**Headers** _userHeaders_] ) +This method adds the correct `content-type` header to the provided array of `userHeaders`. + +#### _String_ getBoundary() +Return the boundary of the formData. By default, the boundary consists of 26 `-` followed by 24 numbers +for example: +```javascript +--------------------------515890814546601021194782 +``` + +#### _Void_ setBoundary(String _boundary_) +Set the boundary string, overriding the default behavior described above. + +_Note: The boundary must be unique and may not appear in the data._ + +#### _Buffer_ getBuffer() +Return the full formdata request package, as a Buffer. You can insert this Buffer in e.g. Axios to send multipart data. +```javascript +var form = new FormData(); +form.append( 'my_buffer', Buffer.from([0x4a,0x42,0x20,0x52,0x6f,0x63,0x6b,0x73]) ); +form.append( 'my_file', fs.readFileSync('/foo/bar.jpg') ); + +axios.post( 'https://example.com/path/to/api', + form.getBuffer(), + form.getHeaders() + ) +``` +**Note:** Because the output is of type Buffer, you can only append types that are accepted by Buffer: *string, Buffer, ArrayBuffer, Array, or Array-like Object*. A ReadStream for example will result in an error. + +#### _Integer_ getLengthSync() +Same as `getLength` but synchronous. + +_Note: getLengthSync __doesn't__ calculate streams length._ + +#### _Integer_ getLength( **function** _callback_ ) +Returns the `Content-Length` async. The callback is used to handle errors and continue once the length has been calculated +```javascript +this.getLength(function(err, length) { + if (err) { + this._error(err); + return; + } + + // add content length + request.setHeader('Content-Length', length); + + ... +}.bind(this)); +``` + +#### _Boolean_ hasKnownLength() +Checks if the length of added values is known. + +#### _Request_ submit( _params_, **function** _callback_ ) +Submit the form to a web application. +```javascript +var form = new FormData(); +form.append( 'my_string', 'Hello World' ); + +form.submit( 'http://example.com/', function(err, res) { + // res – response object (http.IncomingMessage) // + res.resume(); +} ); +``` + +#### _String_ toString() +Returns the form data as a string. Don't use this if you are sending files or buffers, use `getBuffer()` instead. + +### Integration with other libraries + +#### Request + +Form submission using [request](https://github.com/request/request): + +```javascript +var formData = { + my_field: 'my_value', + my_file: fs.createReadStream(__dirname + '/unicycle.jpg'), +}; + +request.post({url:'http://service.com/upload', formData: formData}, function(err, httpResponse, body) { + if (err) { + return console.error('upload failed:', err); + } + console.log('Upload successful! Server responded with:', body); +}); +``` + +For more details see [request readme](https://github.com/request/request#multipartform-data-multipart-form-uploads). + +#### node-fetch + +You can also submit a form using [node-fetch](https://github.com/bitinn/node-fetch): + +```javascript +var form = new FormData(); + +form.append('a', 1); + +fetch('http://example.com', { method: 'POST', body: form }) + .then(function(res) { + return res.json(); + }).then(function(json) { + console.log(json); + }); +``` + +#### axios + +In Node.js you can post a file using [axios](https://github.com/axios/axios): +```javascript +const form = new FormData(); +const stream = fs.createReadStream(PATH_TO_FILE); + +form.append('image', stream); + +// In Node.js environment you need to set boundary in the header field 'Content-Type' by calling method `getHeaders` +const formHeaders = form.getHeaders(); + +axios.post('http://example.com', form, { + headers: { + ...formHeaders, + }, +}) +.then(response => response) +.catch(error => error) +``` + +## Notes + +- ```getLengthSync()``` method DOESN'T calculate length for streams, use ```knownLength``` options as workaround. +- ```getLength(cb)``` will send an error as first parameter of callback if stream length cannot be calculated (e.g. send in custom streams w/o using ```knownLength```). +- ```submit``` will not add `content-length` if form length is unknown or not calculable. +- Starting version `2.x` FormData has dropped support for `node@0.10.x`. +- Starting version `3.x` FormData has dropped support for `node@4.x`. + +## License + +Form-Data is released under the [MIT](License) license. diff --git a/project starter code/node_modules/form-data/index.d.ts b/project starter code/node_modules/form-data/index.d.ts new file mode 100644 index 00000000..295e9e9b --- /dev/null +++ b/project starter code/node_modules/form-data/index.d.ts @@ -0,0 +1,62 @@ +// Definitions by: Carlos Ballesteros Velasco +// Leon Yu +// BendingBender +// Maple Miao + +/// +import * as stream from 'stream'; +import * as http from 'http'; + +export = FormData; + +// Extracted because @types/node doesn't export interfaces. +interface ReadableOptions { + highWaterMark?: number; + encoding?: string; + objectMode?: boolean; + read?(this: stream.Readable, size: number): void; + destroy?(this: stream.Readable, error: Error | null, callback: (error: Error | null) => void): void; + autoDestroy?: boolean; +} + +interface Options extends ReadableOptions { + writable?: boolean; + readable?: boolean; + dataSize?: number; + maxDataSize?: number; + pauseStreams?: boolean; +} + +declare class FormData extends stream.Readable { + constructor(options?: Options); + append(key: string, value: any, options?: FormData.AppendOptions | string): void; + getHeaders(userHeaders?: FormData.Headers): FormData.Headers; + submit( + params: string | FormData.SubmitOptions, + callback?: (error: Error | null, response: http.IncomingMessage) => void + ): http.ClientRequest; + getBuffer(): Buffer; + setBoundary(boundary: string): void; + getBoundary(): string; + getLength(callback: (err: Error | null, length: number) => void): void; + getLengthSync(): number; + hasKnownLength(): boolean; +} + +declare namespace FormData { + interface Headers { + [key: string]: any; + } + + interface AppendOptions { + header?: string | Headers; + knownLength?: number; + filename?: string; + filepath?: string; + contentType?: string; + } + + interface SubmitOptions extends http.RequestOptions { + protocol?: 'https:' | 'http:'; + } +} diff --git a/project starter code/node_modules/form-data/lib/browser.js b/project starter code/node_modules/form-data/lib/browser.js new file mode 100644 index 00000000..09e7c70e --- /dev/null +++ b/project starter code/node_modules/form-data/lib/browser.js @@ -0,0 +1,2 @@ +/* eslint-env browser */ +module.exports = typeof self == 'object' ? self.FormData : window.FormData; diff --git a/project starter code/node_modules/form-data/lib/form_data.js b/project starter code/node_modules/form-data/lib/form_data.js new file mode 100644 index 00000000..18dc819c --- /dev/null +++ b/project starter code/node_modules/form-data/lib/form_data.js @@ -0,0 +1,501 @@ +var CombinedStream = require('combined-stream'); +var util = require('util'); +var path = require('path'); +var http = require('http'); +var https = require('https'); +var parseUrl = require('url').parse; +var fs = require('fs'); +var Stream = require('stream').Stream; +var mime = require('mime-types'); +var asynckit = require('asynckit'); +var populate = require('./populate.js'); + +// Public API +module.exports = FormData; + +// make it a Stream +util.inherits(FormData, CombinedStream); + +/** + * Create readable "multipart/form-data" streams. + * Can be used to submit forms + * and file uploads to other web applications. + * + * @constructor + * @param {Object} options - Properties to be added/overriden for FormData and CombinedStream + */ +function FormData(options) { + if (!(this instanceof FormData)) { + return new FormData(options); + } + + this._overheadLength = 0; + this._valueLength = 0; + this._valuesToMeasure = []; + + CombinedStream.call(this); + + options = options || {}; + for (var option in options) { + this[option] = options[option]; + } +} + +FormData.LINE_BREAK = '\r\n'; +FormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream'; + +FormData.prototype.append = function(field, value, options) { + + options = options || {}; + + // allow filename as single option + if (typeof options == 'string') { + options = {filename: options}; + } + + var append = CombinedStream.prototype.append.bind(this); + + // all that streamy business can't handle numbers + if (typeof value == 'number') { + value = '' + value; + } + + // https://github.com/felixge/node-form-data/issues/38 + if (util.isArray(value)) { + // Please convert your array into string + // the way web server expects it + this._error(new Error('Arrays are not supported.')); + return; + } + + var header = this._multiPartHeader(field, value, options); + var footer = this._multiPartFooter(); + + append(header); + append(value); + append(footer); + + // pass along options.knownLength + this._trackLength(header, value, options); +}; + +FormData.prototype._trackLength = function(header, value, options) { + var valueLength = 0; + + // used w/ getLengthSync(), when length is known. + // e.g. for streaming directly from a remote server, + // w/ a known file a size, and not wanting to wait for + // incoming file to finish to get its size. + if (options.knownLength != null) { + valueLength += +options.knownLength; + } else if (Buffer.isBuffer(value)) { + valueLength = value.length; + } else if (typeof value === 'string') { + valueLength = Buffer.byteLength(value); + } + + this._valueLength += valueLength; + + // @check why add CRLF? does this account for custom/multiple CRLFs? + this._overheadLength += + Buffer.byteLength(header) + + FormData.LINE_BREAK.length; + + // empty or either doesn't have path or not an http response or not a stream + if (!value || ( !value.path && !(value.readable && value.hasOwnProperty('httpVersion')) && !(value instanceof Stream))) { + return; + } + + // no need to bother with the length + if (!options.knownLength) { + this._valuesToMeasure.push(value); + } +}; + +FormData.prototype._lengthRetriever = function(value, callback) { + + if (value.hasOwnProperty('fd')) { + + // take read range into a account + // `end` = Infinity –> read file till the end + // + // TODO: Looks like there is bug in Node fs.createReadStream + // it doesn't respect `end` options without `start` options + // Fix it when node fixes it. + // https://github.com/joyent/node/issues/7819 + if (value.end != undefined && value.end != Infinity && value.start != undefined) { + + // when end specified + // no need to calculate range + // inclusive, starts with 0 + callback(null, value.end + 1 - (value.start ? value.start : 0)); + + // not that fast snoopy + } else { + // still need to fetch file size from fs + fs.stat(value.path, function(err, stat) { + + var fileSize; + + if (err) { + callback(err); + return; + } + + // update final size based on the range options + fileSize = stat.size - (value.start ? value.start : 0); + callback(null, fileSize); + }); + } + + // or http response + } else if (value.hasOwnProperty('httpVersion')) { + callback(null, +value.headers['content-length']); + + // or request stream http://github.com/mikeal/request + } else if (value.hasOwnProperty('httpModule')) { + // wait till response come back + value.on('response', function(response) { + value.pause(); + callback(null, +response.headers['content-length']); + }); + value.resume(); + + // something else + } else { + callback('Unknown stream'); + } +}; + +FormData.prototype._multiPartHeader = function(field, value, options) { + // custom header specified (as string)? + // it becomes responsible for boundary + // (e.g. to handle extra CRLFs on .NET servers) + if (typeof options.header == 'string') { + return options.header; + } + + var contentDisposition = this._getContentDisposition(value, options); + var contentType = this._getContentType(value, options); + + var contents = ''; + var headers = { + // add custom disposition as third element or keep it two elements if not + 'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []), + // if no content type. allow it to be empty array + 'Content-Type': [].concat(contentType || []) + }; + + // allow custom headers. + if (typeof options.header == 'object') { + populate(headers, options.header); + } + + var header; + for (var prop in headers) { + if (!headers.hasOwnProperty(prop)) continue; + header = headers[prop]; + + // skip nullish headers. + if (header == null) { + continue; + } + + // convert all headers to arrays. + if (!Array.isArray(header)) { + header = [header]; + } + + // add non-empty headers. + if (header.length) { + contents += prop + ': ' + header.join('; ') + FormData.LINE_BREAK; + } + } + + return '--' + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK; +}; + +FormData.prototype._getContentDisposition = function(value, options) { + + var filename + , contentDisposition + ; + + if (typeof options.filepath === 'string') { + // custom filepath for relative paths + filename = path.normalize(options.filepath).replace(/\\/g, '/'); + } else if (options.filename || value.name || value.path) { + // custom filename take precedence + // formidable and the browser add a name property + // fs- and request- streams have path property + filename = path.basename(options.filename || value.name || value.path); + } else if (value.readable && value.hasOwnProperty('httpVersion')) { + // or try http response + filename = path.basename(value.client._httpMessage.path || ''); + } + + if (filename) { + contentDisposition = 'filename="' + filename + '"'; + } + + return contentDisposition; +}; + +FormData.prototype._getContentType = function(value, options) { + + // use custom content-type above all + var contentType = options.contentType; + + // or try `name` from formidable, browser + if (!contentType && value.name) { + contentType = mime.lookup(value.name); + } + + // or try `path` from fs-, request- streams + if (!contentType && value.path) { + contentType = mime.lookup(value.path); + } + + // or if it's http-reponse + if (!contentType && value.readable && value.hasOwnProperty('httpVersion')) { + contentType = value.headers['content-type']; + } + + // or guess it from the filepath or filename + if (!contentType && (options.filepath || options.filename)) { + contentType = mime.lookup(options.filepath || options.filename); + } + + // fallback to the default content type if `value` is not simple value + if (!contentType && typeof value == 'object') { + contentType = FormData.DEFAULT_CONTENT_TYPE; + } + + return contentType; +}; + +FormData.prototype._multiPartFooter = function() { + return function(next) { + var footer = FormData.LINE_BREAK; + + var lastPart = (this._streams.length === 0); + if (lastPart) { + footer += this._lastBoundary(); + } + + next(footer); + }.bind(this); +}; + +FormData.prototype._lastBoundary = function() { + return '--' + this.getBoundary() + '--' + FormData.LINE_BREAK; +}; + +FormData.prototype.getHeaders = function(userHeaders) { + var header; + var formHeaders = { + 'content-type': 'multipart/form-data; boundary=' + this.getBoundary() + }; + + for (header in userHeaders) { + if (userHeaders.hasOwnProperty(header)) { + formHeaders[header.toLowerCase()] = userHeaders[header]; + } + } + + return formHeaders; +}; + +FormData.prototype.setBoundary = function(boundary) { + this._boundary = boundary; +}; + +FormData.prototype.getBoundary = function() { + if (!this._boundary) { + this._generateBoundary(); + } + + return this._boundary; +}; + +FormData.prototype.getBuffer = function() { + var dataBuffer = new Buffer.alloc( 0 ); + var boundary = this.getBoundary(); + + // Create the form content. Add Line breaks to the end of data. + for (var i = 0, len = this._streams.length; i < len; i++) { + if (typeof this._streams[i] !== 'function') { + + // Add content to the buffer. + if(Buffer.isBuffer(this._streams[i])) { + dataBuffer = Buffer.concat( [dataBuffer, this._streams[i]]); + }else { + dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(this._streams[i])]); + } + + // Add break after content. + if (typeof this._streams[i] !== 'string' || this._streams[i].substring( 2, boundary.length + 2 ) !== boundary) { + dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(FormData.LINE_BREAK)] ); + } + } + } + + // Add the footer and return the Buffer object. + return Buffer.concat( [dataBuffer, Buffer.from(this._lastBoundary())] ); +}; + +FormData.prototype._generateBoundary = function() { + // This generates a 50 character boundary similar to those used by Firefox. + // They are optimized for boyer-moore parsing. + var boundary = '--------------------------'; + for (var i = 0; i < 24; i++) { + boundary += Math.floor(Math.random() * 10).toString(16); + } + + this._boundary = boundary; +}; + +// Note: getLengthSync DOESN'T calculate streams length +// As workaround one can calculate file size manually +// and add it as knownLength option +FormData.prototype.getLengthSync = function() { + var knownLength = this._overheadLength + this._valueLength; + + // Don't get confused, there are 3 "internal" streams for each keyval pair + // so it basically checks if there is any value added to the form + if (this._streams.length) { + knownLength += this._lastBoundary().length; + } + + // https://github.com/form-data/form-data/issues/40 + if (!this.hasKnownLength()) { + // Some async length retrievers are present + // therefore synchronous length calculation is false. + // Please use getLength(callback) to get proper length + this._error(new Error('Cannot calculate proper length in synchronous way.')); + } + + return knownLength; +}; + +// Public API to check if length of added values is known +// https://github.com/form-data/form-data/issues/196 +// https://github.com/form-data/form-data/issues/262 +FormData.prototype.hasKnownLength = function() { + var hasKnownLength = true; + + if (this._valuesToMeasure.length) { + hasKnownLength = false; + } + + return hasKnownLength; +}; + +FormData.prototype.getLength = function(cb) { + var knownLength = this._overheadLength + this._valueLength; + + if (this._streams.length) { + knownLength += this._lastBoundary().length; + } + + if (!this._valuesToMeasure.length) { + process.nextTick(cb.bind(this, null, knownLength)); + return; + } + + asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) { + if (err) { + cb(err); + return; + } + + values.forEach(function(length) { + knownLength += length; + }); + + cb(null, knownLength); + }); +}; + +FormData.prototype.submit = function(params, cb) { + var request + , options + , defaults = {method: 'post'} + ; + + // parse provided url if it's string + // or treat it as options object + if (typeof params == 'string') { + + params = parseUrl(params); + options = populate({ + port: params.port, + path: params.pathname, + host: params.hostname, + protocol: params.protocol + }, defaults); + + // use custom params + } else { + + options = populate(params, defaults); + // if no port provided use default one + if (!options.port) { + options.port = options.protocol == 'https:' ? 443 : 80; + } + } + + // put that good code in getHeaders to some use + options.headers = this.getHeaders(params.headers); + + // https if specified, fallback to http in any other case + if (options.protocol == 'https:') { + request = https.request(options); + } else { + request = http.request(options); + } + + // get content length and fire away + this.getLength(function(err, length) { + if (err && err !== 'Unknown stream') { + this._error(err); + return; + } + + // add content length + if (length) { + request.setHeader('Content-Length', length); + } + + this.pipe(request); + if (cb) { + var onResponse; + + var callback = function (error, responce) { + request.removeListener('error', callback); + request.removeListener('response', onResponse); + + return cb.call(this, error, responce); + }; + + onResponse = callback.bind(this, null); + + request.on('error', callback); + request.on('response', onResponse); + } + }.bind(this)); + + return request; +}; + +FormData.prototype._error = function(err) { + if (!this.error) { + this.error = err; + this.pause(); + this.emit('error', err); + } +}; + +FormData.prototype.toString = function () { + return '[object FormData]'; +}; diff --git a/project starter code/node_modules/form-data/lib/populate.js b/project starter code/node_modules/form-data/lib/populate.js new file mode 100644 index 00000000..4d35738d --- /dev/null +++ b/project starter code/node_modules/form-data/lib/populate.js @@ -0,0 +1,10 @@ +// populates missing values +module.exports = function(dst, src) { + + Object.keys(src).forEach(function(prop) + { + dst[prop] = dst[prop] || src[prop]; + }); + + return dst; +}; diff --git a/project starter code/node_modules/form-data/package.json b/project starter code/node_modules/form-data/package.json new file mode 100644 index 00000000..0f20240b --- /dev/null +++ b/project starter code/node_modules/form-data/package.json @@ -0,0 +1,68 @@ +{ + "author": "Felix Geisendörfer (http://debuggable.com/)", + "name": "form-data", + "description": "A library to create readable \"multipart/form-data\" streams. Can be used to submit forms and file uploads to other web applications.", + "version": "4.0.0", + "repository": { + "type": "git", + "url": "git://github.com/form-data/form-data.git" + }, + "main": "./lib/form_data", + "browser": "./lib/browser", + "typings": "./index.d.ts", + "scripts": { + "pretest": "rimraf coverage test/tmp", + "test": "istanbul cover test/run.js", + "posttest": "istanbul report lcov text", + "lint": "eslint lib/*.js test/*.js test/integration/*.js", + "report": "istanbul report lcov text", + "ci-lint": "is-node-modern 8 && npm run lint || is-node-not-modern 8", + "ci-test": "npm run test && npm run browser && npm run report", + "predebug": "rimraf coverage test/tmp", + "debug": "verbose=1 ./test/run.js", + "browser": "browserify -t browserify-istanbul test/run-browser.js | obake --coverage", + "check": "istanbul check-coverage coverage/coverage*.json", + "files": "pkgfiles --sort=name", + "get-version": "node -e \"console.log(require('./package.json').version)\"", + "update-readme": "sed -i.bak 's/\\/master\\.svg/\\/v'$(npm --silent run get-version)'.svg/g' README.md", + "restore-readme": "mv README.md.bak README.md", + "prepublish": "in-publish && npm run update-readme || not-in-publish", + "postpublish": "npm run restore-readme" + }, + "pre-commit": [ + "lint", + "ci-test", + "check" + ], + "engines": { + "node": ">= 6" + }, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "devDependencies": { + "@types/node": "^12.0.10", + "browserify": "^13.1.1", + "browserify-istanbul": "^2.0.0", + "coveralls": "^3.0.4", + "cross-spawn": "^6.0.5", + "eslint": "^6.0.1", + "fake": "^0.2.2", + "far": "^0.0.7", + "formidable": "^1.0.17", + "in-publish": "^2.0.0", + "is-node-modern": "^1.0.0", + "istanbul": "^0.4.5", + "obake": "^0.1.2", + "puppeteer": "^1.19.0", + "pkgfiles": "^2.3.0", + "pre-commit": "^1.1.3", + "request": "^2.88.0", + "rimraf": "^2.7.1", + "tape": "^4.6.2", + "typescript": "^3.5.2" + }, + "license": "MIT" +} diff --git a/project starter code/node_modules/function-bind/.editorconfig b/project starter code/node_modules/function-bind/.editorconfig deleted file mode 100644 index ac29adef..00000000 --- a/project starter code/node_modules/function-bind/.editorconfig +++ /dev/null @@ -1,20 +0,0 @@ -root = true - -[*] -indent_style = tab -indent_size = 4 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true -max_line_length = 120 - -[CHANGELOG.md] -indent_style = space -indent_size = 2 - -[*.json] -max_line_length = off - -[Makefile] -max_line_length = off diff --git a/project starter code/node_modules/function-bind/.eslintrc b/project starter code/node_modules/function-bind/.eslintrc index 9b33d8ed..71a054fd 100644 --- a/project starter code/node_modules/function-bind/.eslintrc +++ b/project starter code/node_modules/function-bind/.eslintrc @@ -6,10 +6,16 @@ "rules": { "func-name-matching": 0, "indent": [2, 4], - "max-nested-callbacks": [2, 3], - "max-params": [2, 3], - "max-statements": [2, 20], "no-new-func": [1], - "strict": [0] - } + }, + + "overrides": [ + { + "files": "test/**", + "rules": { + "max-lines-per-function": 0, + "strict": [0] + }, + }, + ], } diff --git a/project starter code/node_modules/function-bind/.github/FUNDING.yml b/project starter code/node_modules/function-bind/.github/FUNDING.yml new file mode 100644 index 00000000..74482195 --- /dev/null +++ b/project starter code/node_modules/function-bind/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/function-bind +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/project starter code/node_modules/function-bind/.github/SECURITY.md b/project starter code/node_modules/function-bind/.github/SECURITY.md new file mode 100644 index 00000000..82e4285a --- /dev/null +++ b/project starter code/node_modules/function-bind/.github/SECURITY.md @@ -0,0 +1,3 @@ +# Security + +Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. diff --git a/project starter code/node_modules/function-bind/.jscs.json b/project starter code/node_modules/function-bind/.jscs.json deleted file mode 100644 index 8c447948..00000000 --- a/project starter code/node_modules/function-bind/.jscs.json +++ /dev/null @@ -1,176 +0,0 @@ -{ - "es3": true, - - "additionalRules": [], - - "requireSemicolons": true, - - "disallowMultipleSpaces": true, - - "disallowIdentifierNames": [], - - "requireCurlyBraces": { - "allExcept": [], - "keywords": ["if", "else", "for", "while", "do", "try", "catch"] - }, - - "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], - - "disallowSpaceAfterKeywords": [], - - "disallowSpaceBeforeComma": true, - "disallowSpaceAfterComma": false, - "disallowSpaceBeforeSemicolon": true, - - "disallowNodeTypes": [ - "DebuggerStatement", - "ForInStatement", - "LabeledStatement", - "SwitchCase", - "SwitchStatement", - "WithStatement" - ], - - "requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, - - "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, - "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, - "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, - "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, - "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, - - "requireSpaceBetweenArguments": true, - - "disallowSpacesInsideParentheses": true, - - "disallowSpacesInsideArrayBrackets": true, - - "disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, - - "disallowSpaceAfterObjectKeys": true, - - "requireCommaBeforeLineBreak": true, - - "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], - "requireSpaceAfterPrefixUnaryOperators": [], - - "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], - "requireSpaceBeforePostfixUnaryOperators": [], - - "disallowSpaceBeforeBinaryOperators": [], - "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], - - "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], - "disallowSpaceAfterBinaryOperators": [], - - "disallowImplicitTypeConversion": ["binary", "string"], - - "disallowKeywords": ["with", "eval"], - - "requireKeywordsOnNewLine": [], - "disallowKeywordsOnNewLine": ["else"], - - "requireLineFeedAtFileEnd": true, - - "disallowTrailingWhitespace": true, - - "disallowTrailingComma": true, - - "excludeFiles": ["node_modules/**", "vendor/**"], - - "disallowMultipleLineStrings": true, - - "requireDotNotation": { "allExcept": ["keywords"] }, - - "requireParenthesesAroundIIFE": true, - - "validateLineBreaks": "LF", - - "validateQuoteMarks": { - "escape": true, - "mark": "'" - }, - - "disallowOperatorBeforeLineBreak": [], - - "requireSpaceBeforeKeywords": [ - "do", - "for", - "if", - "else", - "switch", - "case", - "try", - "catch", - "finally", - "while", - "with", - "return" - ], - - "validateAlignedFunctionParameters": { - "lineBreakAfterOpeningBraces": true, - "lineBreakBeforeClosingBraces": true - }, - - "requirePaddingNewLinesBeforeExport": true, - - "validateNewlineAfterArrayElements": { - "maximum": 8 - }, - - "requirePaddingNewLinesAfterUseStrict": true, - - "disallowArrowFunctions": true, - - "disallowMultiLineTernary": true, - - "validateOrderInObjectKeys": "asc-insensitive", - - "disallowIdenticalDestructuringNames": true, - - "disallowNestedTernaries": { "maxLevel": 1 }, - - "requireSpaceAfterComma": { "allExcept": ["trailing"] }, - "requireAlignedMultilineParams": false, - - "requireSpacesInGenerator": { - "afterStar": true - }, - - "disallowSpacesInGenerator": { - "beforeStar": true - }, - - "disallowVar": false, - - "requireArrayDestructuring": false, - - "requireEnhancedObjectLiterals": false, - - "requireObjectDestructuring": false, - - "requireEarlyReturn": false, - - "requireCapitalizedConstructorsNew": { - "allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"] - }, - - "requireImportAlphabetized": false, - - "requireSpaceBeforeObjectValues": true, - "requireSpaceBeforeDestructuredValues": true, - - "disallowSpacesInsideTemplateStringPlaceholders": true, - - "disallowArrayDestructuringReturn": false, - - "requireNewlineBeforeSingleStatementsInIf": false, - - "disallowUnusedVariables": true, - - "requireSpacesInsideImportedObjectBraces": true, - - "requireUseStrict": true -} - diff --git a/project starter code/node_modules/function-bind/.npmignore b/project starter code/node_modules/function-bind/.npmignore deleted file mode 100644 index dbb555fd..00000000 --- a/project starter code/node_modules/function-bind/.npmignore +++ /dev/null @@ -1,22 +0,0 @@ -# gitignore -.DS_Store -.monitor -.*.swp -.nodemonignore -releases -*.log -*.err -fleet.json -public/browserify -bin/*.json -.bin -build -compile -.lock-wscript -coverage -node_modules - -# Only apps should have lockfiles -npm-shrinkwrap.json -package-lock.json -yarn.lock diff --git a/project starter code/node_modules/function-bind/.nycrc b/project starter code/node_modules/function-bind/.nycrc new file mode 100644 index 00000000..1826526e --- /dev/null +++ b/project starter code/node_modules/function-bind/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/project starter code/node_modules/function-bind/.travis.yml b/project starter code/node_modules/function-bind/.travis.yml deleted file mode 100644 index 85f70d24..00000000 --- a/project starter code/node_modules/function-bind/.travis.yml +++ /dev/null @@ -1,168 +0,0 @@ -language: node_js -os: - - linux -node_js: - - "8.4" - - "7.10" - - "6.11" - - "5.12" - - "4.8" - - "iojs-v3.3" - - "iojs-v2.5" - - "iojs-v1.8" - - "0.12" - - "0.10" - - "0.8" -before_install: - - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then npm install -g npm@1.3 ; elif [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then case "$(npm --version)" in 1.*) npm install -g npm@1.4.28 ;; 2.*) npm install -g npm@2 ;; esac ; fi' - - 'if [ "${TRAVIS_NODE_VERSION}" != "0.6" ] && [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then if [ "${TRAVIS_NODE_VERSION%${TRAVIS_NODE_VERSION#[0-9]}}" = "0" ] || [ "${TRAVIS_NODE_VERSION:0:4}" = "iojs" ]; then npm install -g npm@4.5 ; else npm install -g npm; fi; fi' -install: - - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then nvm install 0.8 && npm install -g npm@1.3 && npm install -g npm@1.4.28 && npm install -g npm@2 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' -script: - - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' - - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi' - - 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi' - - 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi' -sudo: false -env: - - TEST=true -matrix: - fast_finish: true - include: - - node_js: "node" - env: PRETEST=true - - node_js: "4" - env: COVERAGE=true - - node_js: "8.3" - env: TEST=true ALLOW_FAILURE=true - - node_js: "8.2" - env: TEST=true ALLOW_FAILURE=true - - node_js: "8.1" - env: TEST=true ALLOW_FAILURE=true - - node_js: "8.0" - env: TEST=true ALLOW_FAILURE=true - - node_js: "7.9" - env: TEST=true ALLOW_FAILURE=true - - node_js: "7.8" - env: TEST=true ALLOW_FAILURE=true - - node_js: "7.7" - env: TEST=true ALLOW_FAILURE=true - - node_js: "7.6" - env: TEST=true ALLOW_FAILURE=true - - node_js: "7.5" - env: TEST=true ALLOW_FAILURE=true - - node_js: "7.4" - env: TEST=true ALLOW_FAILURE=true - - node_js: "7.3" - env: TEST=true ALLOW_FAILURE=true - - node_js: "7.2" - env: TEST=true ALLOW_FAILURE=true - - node_js: "7.1" - env: TEST=true ALLOW_FAILURE=true - - node_js: "7.0" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.10" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.9" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.8" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.7" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.6" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.5" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.4" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.3" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.2" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.1" - env: TEST=true ALLOW_FAILURE=true - - node_js: "6.0" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.11" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.10" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.9" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.8" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.7" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.6" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.5" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.4" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.3" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.2" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.1" - env: TEST=true ALLOW_FAILURE=true - - node_js: "5.0" - env: TEST=true ALLOW_FAILURE=true - - node_js: "4.7" - env: TEST=true ALLOW_FAILURE=true - - node_js: "4.6" - env: TEST=true ALLOW_FAILURE=true - - node_js: "4.5" - env: TEST=true ALLOW_FAILURE=true - - node_js: "4.4" - env: TEST=true ALLOW_FAILURE=true - - node_js: "4.3" - env: TEST=true ALLOW_FAILURE=true - - node_js: "4.2" - env: TEST=true ALLOW_FAILURE=true - - node_js: "4.1" - env: TEST=true ALLOW_FAILURE=true - - node_js: "4.0" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v3.2" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v3.1" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v3.0" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v2.4" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v2.3" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v2.2" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v2.1" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v2.0" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v1.7" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v1.6" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v1.5" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v1.4" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v1.3" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v1.2" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v1.1" - env: TEST=true ALLOW_FAILURE=true - - node_js: "iojs-v1.0" - env: TEST=true ALLOW_FAILURE=true - - node_js: "0.11" - env: TEST=true ALLOW_FAILURE=true - - node_js: "0.9" - env: TEST=true ALLOW_FAILURE=true - - node_js: "0.6" - env: TEST=true ALLOW_FAILURE=true - - node_js: "0.4" - env: TEST=true ALLOW_FAILURE=true - allow_failures: - - os: osx - - env: TEST=true ALLOW_FAILURE=true diff --git a/project starter code/node_modules/function-bind/CHANGELOG.md b/project starter code/node_modules/function-bind/CHANGELOG.md new file mode 100644 index 00000000..f9e6cc07 --- /dev/null +++ b/project starter code/node_modules/function-bind/CHANGELOG.md @@ -0,0 +1,136 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.1.2](https://github.com/ljharb/function-bind/compare/v1.1.1...v1.1.2) - 2023-10-12 + +### Merged + +- Point to the correct file [`#16`](https://github.com/ljharb/function-bind/pull/16) + +### Commits + +- [Tests] migrate tests to Github Actions [`4f8b57c`](https://github.com/ljharb/function-bind/commit/4f8b57c02f2011fe9ae353d5e74e8745f0988af8) +- [Tests] remove `jscs` [`90eb2ed`](https://github.com/ljharb/function-bind/commit/90eb2edbeefd5b76cd6c3a482ea3454db169b31f) +- [meta] update `.gitignore` [`53fcdc3`](https://github.com/ljharb/function-bind/commit/53fcdc371cd66634d6e9b71c836a50f437e89fed) +- [Tests] up to `node` `v11.10`, `v10.15`, `v9.11`, `v8.15`, `v6.16`, `v4.9`; use `nvm install-latest-npm`; run audit script in tests [`1fe8f6e`](https://github.com/ljharb/function-bind/commit/1fe8f6e9aed0dfa8d8b3cdbd00c7f5ea0cd2b36e) +- [meta] add `auto-changelog` [`1921fcb`](https://github.com/ljharb/function-bind/commit/1921fcb5b416b63ffc4acad051b6aad5722f777d) +- [Robustness] remove runtime dependency on all builtins except `.apply` [`f743e61`](https://github.com/ljharb/function-bind/commit/f743e61aa6bb2360358c04d4884c9db853d118b7) +- Docs: enable badges; update wording [`503cb12`](https://github.com/ljharb/function-bind/commit/503cb12d998b5f91822776c73332c7adcd6355dd) +- [readme] update badges [`290c5db`](https://github.com/ljharb/function-bind/commit/290c5dbbbda7264efaeb886552a374b869a4bb48) +- [Tests] switch to nyc for coverage [`ea360ba`](https://github.com/ljharb/function-bind/commit/ea360ba907fc2601ed18d01a3827fa2d3533cdf8) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`cae5e9e`](https://github.com/ljharb/function-bind/commit/cae5e9e07a5578dc6df26c03ee22851ce05b943c) +- [meta] add `funding` field; create FUNDING.yml [`c9f4274`](https://github.com/ljharb/function-bind/commit/c9f4274aa80ea3aae9657a3938fdba41a3b04ca6) +- [Tests] fix eslint errors from #15 [`f69aaa2`](https://github.com/ljharb/function-bind/commit/f69aaa2beb2fdab4415bfb885760a699d0b9c964) +- [actions] fix permissions [`99a0cd9`](https://github.com/ljharb/function-bind/commit/99a0cd9f3b5bac223a0d572f081834cd73314be7) +- [meta] use `npmignore` to autogenerate an npmignore file [`f03b524`](https://github.com/ljharb/function-bind/commit/f03b524ca91f75a109a5d062f029122c86ecd1ae) +- [Dev Deps] update `@ljharb/eslint‑config`, `eslint`, `tape` [`7af9300`](https://github.com/ljharb/function-bind/commit/7af930023ae2ce7645489532821e4fbbcd7a2280) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `covert`, `tape` [`64a9127`](https://github.com/ljharb/function-bind/commit/64a9127ab0bd331b93d6572eaf6e9971967fc08c) +- [Tests] use `aud` instead of `npm audit` [`e75069c`](https://github.com/ljharb/function-bind/commit/e75069c50010a8fcce2a9ce2324934c35fdb4386) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`d03555c`](https://github.com/ljharb/function-bind/commit/d03555ca59dea3b71ce710045e4303b9e2619e28) +- [meta] add `safe-publish-latest` [`9c8f809`](https://github.com/ljharb/function-bind/commit/9c8f8092aed027d7e80c94f517aa892385b64f09) +- [Dev Deps] update `@ljharb/eslint-config`, `tape` [`baf6893`](https://github.com/ljharb/function-bind/commit/baf6893e27f5b59abe88bc1995e6f6ed1e527397) +- [meta] create SECURITY.md [`4db1779`](https://github.com/ljharb/function-bind/commit/4db17799f1f28ae294cb95e0081ca2b591c3911b) +- [Tests] add `npm run audit` [`c8b38ec`](https://github.com/ljharb/function-bind/commit/c8b38ec40ed3f85dabdee40ed4148f1748375bc2) +- Revert "Point to the correct file" [`05cdf0f`](https://github.com/ljharb/function-bind/commit/05cdf0fa205c6a3c5ba40bbedd1dfa9874f915c9) + +## [v1.1.1](https://github.com/ljharb/function-bind/compare/v1.1.0...v1.1.1) - 2017-08-28 + +### Commits + +- [Tests] up to `node` `v8`; newer npm breaks on older node; fix scripts [`817f7d2`](https://github.com/ljharb/function-bind/commit/817f7d28470fdbff8ef608d4d565dd4d1430bc5e) +- [Dev Deps] update `eslint`, `jscs`, `tape`, `@ljharb/eslint-config` [`854288b`](https://github.com/ljharb/function-bind/commit/854288b1b6f5c555f89aceb9eff1152510262084) +- [Dev Deps] update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`83e639f`](https://github.com/ljharb/function-bind/commit/83e639ff74e6cd6921285bccec22c1bcf72311bd) +- Only apps should have lockfiles [`5ed97f5`](https://github.com/ljharb/function-bind/commit/5ed97f51235c17774e0832e122abda0f3229c908) +- Use a SPDX-compliant “license” field. [`5feefea`](https://github.com/ljharb/function-bind/commit/5feefea0dc0193993e83e5df01ded424403a5381) + +## [v1.1.0](https://github.com/ljharb/function-bind/compare/v1.0.2...v1.1.0) - 2016-02-14 + +### Commits + +- Update `eslint`, `tape`; use my personal shared `eslint` config [`9c9062a`](https://github.com/ljharb/function-bind/commit/9c9062abbe9dd70b59ea2c3a3c3a81f29b457097) +- Add `npm run eslint` [`dd96c56`](https://github.com/ljharb/function-bind/commit/dd96c56720034a3c1ffee10b8a59a6f7c53e24ad) +- [New] return the native `bind` when available. [`82186e0`](https://github.com/ljharb/function-bind/commit/82186e03d73e580f95ff167e03f3582bed90ed72) +- [Dev Deps] update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`a3dd767`](https://github.com/ljharb/function-bind/commit/a3dd76720c795cb7f4586b0544efabf8aa107b8b) +- Update `eslint` [`3dae2f7`](https://github.com/ljharb/function-bind/commit/3dae2f7423de30a2d20313ddb1edc19660142fe9) +- Update `tape`, `covert`, `jscs` [`a181eee`](https://github.com/ljharb/function-bind/commit/a181eee0cfa24eb229c6e843a971f36e060a2f6a) +- [Tests] up to `node` `v5.6`, `v4.3` [`964929a`](https://github.com/ljharb/function-bind/commit/964929a6a4ddb36fb128de2bcc20af5e4f22e1ed) +- Test up to `io.js` `v2.1` [`2be7310`](https://github.com/ljharb/function-bind/commit/2be7310f2f74886a7124ca925be411117d41d5ea) +- Update `tape`, `jscs`, `eslint`, `@ljharb/eslint-config` [`45f3d68`](https://github.com/ljharb/function-bind/commit/45f3d6865c6ca93726abcef54febe009087af101) +- [Dev Deps] update `tape`, `jscs` [`6e1340d`](https://github.com/ljharb/function-bind/commit/6e1340d94642deaecad3e717825db641af4f8b1f) +- [Tests] up to `io.js` `v3.3`, `node` `v4.1` [`d9bad2b`](https://github.com/ljharb/function-bind/commit/d9bad2b778b1b3a6dd2876087b88b3acf319f8cc) +- Update `eslint` [`935590c`](https://github.com/ljharb/function-bind/commit/935590caa024ab356102e4858e8fc315b2ccc446) +- [Dev Deps] update `jscs`, `eslint`, `@ljharb/eslint-config` [`8c9a1ef`](https://github.com/ljharb/function-bind/commit/8c9a1efd848e5167887aa8501857a0940a480c57) +- Test on `io.js` `v2.2` [`9a3a38c`](https://github.com/ljharb/function-bind/commit/9a3a38c92013aed6e108666e7bd40969b84ac86e) +- Run `travis-ci` tests on `iojs` and `node` v0.12; speed up builds; allow 0.8 failures. [`69afc26`](https://github.com/ljharb/function-bind/commit/69afc2617405b147dd2a8d8ae73ca9e9283f18b4) +- [Dev Deps] Update `tape`, `eslint` [`36c1be0`](https://github.com/ljharb/function-bind/commit/36c1be0ab12b45fe5df6b0fdb01a5d5137fd0115) +- Update `tape`, `jscs` [`98d8303`](https://github.com/ljharb/function-bind/commit/98d8303cd5ca1c6b8f985469f86b0d44d7d45f6e) +- Update `jscs` [`9633a4e`](https://github.com/ljharb/function-bind/commit/9633a4e9fbf82051c240855166e468ba8ba0846f) +- Update `tape`, `jscs` [`c80ef0f`](https://github.com/ljharb/function-bind/commit/c80ef0f46efc9791e76fa50de4414092ac147831) +- Test up to `io.js` `v3.0` [`7e2c853`](https://github.com/ljharb/function-bind/commit/7e2c8537d52ab9cf5a655755561d8917684c0df4) +- Test on `io.js` `v2.4` [`5a199a2`](https://github.com/ljharb/function-bind/commit/5a199a27ba46795ba5eaf0845d07d4b8232895c9) +- Test on `io.js` `v2.3` [`a511b88`](https://github.com/ljharb/function-bind/commit/a511b8896de0bddf3b56862daa416c701f4d0453) +- Fixing a typo from 822b4e1938db02dc9584aa434fd3a45cb20caf43 [`732d6b6`](https://github.com/ljharb/function-bind/commit/732d6b63a9b33b45230e630dbcac7a10855d3266) +- Update `jscs` [`da52a48`](https://github.com/ljharb/function-bind/commit/da52a4886c06d6490f46ae30b15e4163ba08905d) +- Lock covert to v1.0.0. [`d6150fd`](https://github.com/ljharb/function-bind/commit/d6150fda1e6f486718ebdeff823333d9e48e7430) + +## [v1.0.2](https://github.com/ljharb/function-bind/compare/v1.0.1...v1.0.2) - 2014-10-04 + +## [v1.0.1](https://github.com/ljharb/function-bind/compare/v1.0.0...v1.0.1) - 2014-10-03 + +### Merged + +- make CI build faster [`#3`](https://github.com/ljharb/function-bind/pull/3) + +### Commits + +- Using my standard jscs.json [`d8ee94c`](https://github.com/ljharb/function-bind/commit/d8ee94c993eff0a84cf5744fe6a29627f5cffa1a) +- Adding `npm run lint` [`7571ab7`](https://github.com/ljharb/function-bind/commit/7571ab7dfdbd99b25a1dbb2d232622bd6f4f9c10) +- Using consistent indentation [`e91a1b1`](https://github.com/ljharb/function-bind/commit/e91a1b13a61e99ec1e530e299b55508f74218a95) +- Updating jscs [`7e17892`](https://github.com/ljharb/function-bind/commit/7e1789284bc629bc9c1547a61c9b227bbd8c7a65) +- Using consistent quotes [`c50b57f`](https://github.com/ljharb/function-bind/commit/c50b57fcd1c5ec38320979c837006069ebe02b77) +- Adding keywords [`cb94631`](https://github.com/ljharb/function-bind/commit/cb946314eed35f21186a25fb42fc118772f9ee00) +- Directly export a function expression instead of using a declaration, and relying on hoisting. [`5a33c5f`](https://github.com/ljharb/function-bind/commit/5a33c5f45642de180e0d207110bf7d1843ceb87c) +- Naming npm URL and badge in README; use SVG [`2aef8fc`](https://github.com/ljharb/function-bind/commit/2aef8fcb79d54e63a58ae557c4e60949e05d5e16) +- Naming deps URLs in README [`04228d7`](https://github.com/ljharb/function-bind/commit/04228d766670ee45ca24e98345c1f6a7621065b5) +- Naming travis-ci URLs in README; using SVG [`62c810c`](https://github.com/ljharb/function-bind/commit/62c810c2f54ced956cd4d4ab7b793055addfe36e) +- Make sure functions are invoked correctly (also passing coverage tests) [`2b289b4`](https://github.com/ljharb/function-bind/commit/2b289b4dfbf037ffcfa4dc95eb540f6165e9e43a) +- Removing the strict mode pragmas; they make tests fail. [`1aa701d`](https://github.com/ljharb/function-bind/commit/1aa701d199ddc3782476e8f7eef82679be97b845) +- Adding myself as a contributor [`85fd57b`](https://github.com/ljharb/function-bind/commit/85fd57b0860e5a7af42de9a287f3f265fc6d72fc) +- Adding strict mode pragmas [`915b08e`](https://github.com/ljharb/function-bind/commit/915b08e084c86a722eafe7245e21db74aa21ca4c) +- Adding devDeps URLs to README [`4ccc731`](https://github.com/ljharb/function-bind/commit/4ccc73112c1769859e4ca3076caf4086b3cba2cd) +- Fixing the description. [`a7a472c`](https://github.com/ljharb/function-bind/commit/a7a472cf649af515c635cf560fc478fbe48999c8) +- Using a function expression instead of a function declaration. [`b5d3e4e`](https://github.com/ljharb/function-bind/commit/b5d3e4ea6aaffc63888953eeb1fbc7ff45f1fa14) +- Updating tape [`f086be6`](https://github.com/ljharb/function-bind/commit/f086be6029fb56dde61a258c1340600fa174d1e0) +- Updating jscs [`5f9bdb3`](https://github.com/ljharb/function-bind/commit/5f9bdb375ab13ba48f30852aab94029520c54d71) +- Updating jscs [`9b409ba`](https://github.com/ljharb/function-bind/commit/9b409ba6118e23395a4e5d83ef39152aab9d3bfc) +- Run coverage as part of tests. [`8e1b6d4`](https://github.com/ljharb/function-bind/commit/8e1b6d459f047d1bd4fee814e01247c984c80bd0) +- Run linter as part of tests [`c1ca83f`](https://github.com/ljharb/function-bind/commit/c1ca83f832df94587d09e621beba682fabfaa987) +- Updating covert [`701e837`](https://github.com/ljharb/function-bind/commit/701e83774b57b4d3ef631e1948143f43a72f4bb9) + +## [v1.0.0](https://github.com/ljharb/function-bind/compare/v0.2.0...v1.0.0) - 2014-08-09 + +### Commits + +- Make sure old and unstable nodes don't fail Travis [`27adca3`](https://github.com/ljharb/function-bind/commit/27adca34a4ab6ad67b6dfde43942a1b103ce4d75) +- Fixing an issue when the bound function is called as a constructor in ES3. [`e20122d`](https://github.com/ljharb/function-bind/commit/e20122d267d92ce553859b280cbbea5d27c07731) +- Adding `npm run coverage` [`a2e29c4`](https://github.com/ljharb/function-bind/commit/a2e29c4ecaef9e2f6cd1603e868c139073375502) +- Updating tape [`b741168`](https://github.com/ljharb/function-bind/commit/b741168b12b235b1717ff696087645526b69213c) +- Upgrading tape [`63631a0`](https://github.com/ljharb/function-bind/commit/63631a04c7fbe97cc2fa61829cc27246d6986f74) +- Updating tape [`363cb46`](https://github.com/ljharb/function-bind/commit/363cb46dafb23cb3e347729a22f9448051d78464) + +## v0.2.0 - 2014-03-23 + +### Commits + +- Updating test coverage to match es5-shim. [`aa94d44`](https://github.com/ljharb/function-bind/commit/aa94d44b8f9d7f69f10e060db7709aa7a694e5d4) +- initial [`942ee07`](https://github.com/ljharb/function-bind/commit/942ee07e94e542d91798137bc4b80b926137e066) +- Setting the bound function's length properly. [`079f46a`](https://github.com/ljharb/function-bind/commit/079f46a2d3515b7c0b308c2c13fceb641f97ca25) +- Ensuring that some older browsers will throw when given a regex. [`36ac55b`](https://github.com/ljharb/function-bind/commit/36ac55b87f460d4330253c92870aa26fbfe8227f) +- Removing npm scripts that don't have dependencies [`9d2be60`](https://github.com/ljharb/function-bind/commit/9d2be600002cb8bc8606f8f3585ad3e05868c750) +- Updating tape [`297a4ac`](https://github.com/ljharb/function-bind/commit/297a4acc5464db381940aafb194d1c88f4e678f3) +- Skipping length tests for now. [`d9891ea`](https://github.com/ljharb/function-bind/commit/d9891ea4d2aaffa69f408339cdd61ff740f70565) +- don't take my tea [`dccd930`](https://github.com/ljharb/function-bind/commit/dccd930bfd60ea10cb178d28c97550c3bc8c1e07) diff --git a/project starter code/node_modules/function-bind/README.md b/project starter code/node_modules/function-bind/README.md index 81862a02..814c20b5 100644 --- a/project starter code/node_modules/function-bind/README.md +++ b/project starter code/node_modules/function-bind/README.md @@ -1,22 +1,19 @@ -# function-bind +# function-bind [![Version Badge][npm-version-svg]][package-url] - +[![github actions][actions-image]][actions-url] + +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] - +[![npm badge][npm-badge-png]][package-url] Implementation of function.prototype.bind -## Example +Old versions of phantomjs, Internet Explorer < 9, and node < 0.6 don't support `Function.prototype.bind`. -I mainly do this for unit tests I run on phantomjs. -PhantomJS does not have Function.prototype.bind :( +## Example ```js Function.prototype.bind = require("function-bind") @@ -32,17 +29,18 @@ Function.prototype.bind = require("function-bind") ## MIT Licenced - [travis-svg]: https://travis-ci.org/Raynos/function-bind.svg - [travis-url]: https://travis-ci.org/Raynos/function-bind - [npm-badge-svg]: https://badge.fury.io/js/function-bind.svg - [npm-url]: https://npmjs.org/package/function-bind - [5]: https://coveralls.io/repos/Raynos/function-bind/badge.png - [6]: https://coveralls.io/r/Raynos/function-bind - [7]: https://gemnasium.com/Raynos/function-bind.png - [8]: https://gemnasium.com/Raynos/function-bind - [deps-svg]: https://david-dm.org/Raynos/function-bind.svg - [deps-url]: https://david-dm.org/Raynos/function-bind - [dev-deps-svg]: https://david-dm.org/Raynos/function-bind/dev-status.svg - [dev-deps-url]: https://david-dm.org/Raynos/function-bind#info=devDependencies - [11]: https://ci.testling.com/Raynos/function-bind.png - [12]: https://ci.testling.com/Raynos/function-bind +[package-url]: https://npmjs.org/package/function-bind +[npm-version-svg]: https://versionbadg.es/Raynos/function-bind.svg +[deps-svg]: https://david-dm.org/Raynos/function-bind.svg +[deps-url]: https://david-dm.org/Raynos/function-bind +[dev-deps-svg]: https://david-dm.org/Raynos/function-bind/dev-status.svg +[dev-deps-url]: https://david-dm.org/Raynos/function-bind#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/function-bind.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/function-bind.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/function-bind.svg +[downloads-url]: https://npm-stat.com/charts.html?package=function-bind +[codecov-image]: https://codecov.io/gh/Raynos/function-bind/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/Raynos/function-bind/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/Raynos/function-bind +[actions-url]: https://github.com/Raynos/function-bind/actions diff --git a/project starter code/node_modules/function-bind/implementation.js b/project starter code/node_modules/function-bind/implementation.js index cc4daec1..fd4384cc 100644 --- a/project starter code/node_modules/function-bind/implementation.js +++ b/project starter code/node_modules/function-bind/implementation.js @@ -3,43 +3,75 @@ /* eslint no-invalid-this: 1 */ var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; -var slice = Array.prototype.slice; var toStr = Object.prototype.toString; +var max = Math.max; var funcType = '[object Function]'; +var concatty = function concatty(a, b) { + var arr = []; + + for (var i = 0; i < a.length; i += 1) { + arr[i] = a[i]; + } + for (var j = 0; j < b.length; j += 1) { + arr[j + a.length] = b[j]; + } + + return arr; +}; + +var slicy = function slicy(arrLike, offset) { + var arr = []; + for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) { + arr[j] = arrLike[i]; + } + return arr; +}; + +var joiny = function (arr, joiner) { + var str = ''; + for (var i = 0; i < arr.length; i += 1) { + str += arr[i]; + if (i + 1 < arr.length) { + str += joiner; + } + } + return str; +}; + module.exports = function bind(that) { var target = this; - if (typeof target !== 'function' || toStr.call(target) !== funcType) { + if (typeof target !== 'function' || toStr.apply(target) !== funcType) { throw new TypeError(ERROR_MESSAGE + target); } - var args = slice.call(arguments, 1); + var args = slicy(arguments, 1); var bound; var binder = function () { if (this instanceof bound) { var result = target.apply( this, - args.concat(slice.call(arguments)) + concatty(args, arguments) ); if (Object(result) === result) { return result; } return this; - } else { - return target.apply( - that, - args.concat(slice.call(arguments)) - ); } + return target.apply( + that, + concatty(args, arguments) + ); + }; - var boundLength = Math.max(0, target.length - args.length); + var boundLength = max(0, target.length - args.length); var boundArgs = []; for (var i = 0; i < boundLength; i++) { - boundArgs.push('$' + i); + boundArgs[i] = '$' + i; } - bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder); + bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder); if (target.prototype) { var Empty = function Empty() {}; diff --git a/project starter code/node_modules/function-bind/package.json b/project starter code/node_modules/function-bind/package.json index 20a1727c..61859638 100644 --- a/project starter code/node_modules/function-bind/package.json +++ b/project starter code/node_modules/function-bind/package.json @@ -1,6 +1,6 @@ { "name": "function-bind", - "version": "1.1.1", + "version": "1.1.2", "description": "Implementation of Function.prototype.bind", "keywords": [ "function", @@ -9,7 +9,13 @@ "es5" ], "author": "Raynos ", - "repository": "git://github.com/Raynos/function-bind.git", + "repository": { + "type": "git", + "url": "https://github.com/Raynos/function-bind.git" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, "main": "index", "homepage": "https://github.com/Raynos/function-bind", "contributors": [ @@ -25,24 +31,29 @@ "url": "https://github.com/Raynos/function-bind/issues", "email": "raynos2@gmail.com" }, - "dependencies": {}, "devDependencies": { - "@ljharb/eslint-config": "^12.2.1", - "covert": "^1.1.0", - "eslint": "^4.5.0", - "jscs": "^3.0.7", - "tape": "^4.8.0" + "@ljharb/eslint-config": "^21.1.0", + "aud": "^2.0.3", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.0", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.1" }, "license": "MIT", "scripts": { + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepack": "npmignore --auto --commentLines=autogenerated", "pretest": "npm run lint", "test": "npm run tests-only", - "posttest": "npm run coverage -- --quiet", - "tests-only": "node test", - "coverage": "covert test/*.js", - "lint": "npm run jscs && npm run eslint", - "jscs": "jscs *.js */*.js", - "eslint": "eslint *.js */*.js" + "posttest": "aud --production", + "tests-only": "nyc tape 'test/**/*.js'", + "lint": "eslint --ext=js,mjs .", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" }, "testling": { "files": "test/index.js", @@ -59,5 +70,18 @@ "iphone/6.0..latest", "android-browser/4.2..latest" ] + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] } } diff --git a/project starter code/node_modules/get-intrinsic/.eslintrc b/project starter code/node_modules/get-intrinsic/.eslintrc index 0ab0876e..83766362 100644 --- a/project starter code/node_modules/get-intrinsic/.eslintrc +++ b/project starter code/node_modules/get-intrinsic/.eslintrc @@ -17,6 +17,7 @@ "eqeqeq": [2, "allow-null"], "func-name-matching": 0, "id-length": 0, + "max-lines": 0, "max-lines-per-function": [2, 90], "max-params": [2, 4], "max-statements": 0, diff --git a/project starter code/node_modules/get-intrinsic/CHANGELOG.md b/project starter code/node_modules/get-intrinsic/CHANGELOG.md index 1bb52d38..96d5397f 100644 --- a/project starter code/node_modules/get-intrinsic/CHANGELOG.md +++ b/project starter code/node_modules/get-intrinsic/CHANGELOG.md @@ -5,6 +5,51 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v1.2.4](https://github.com/ljharb/get-intrinsic/compare/v1.2.3...v1.2.4) - 2024-02-05 + +### Commits + +- [Refactor] use all 7 <+ ES6 Errors from `es-errors` [`bcac811`](https://github.com/ljharb/get-intrinsic/commit/bcac811abdc1c982e12abf848a410d6aae148d14) + +## [v1.2.3](https://github.com/ljharb/get-intrinsic/compare/v1.2.2...v1.2.3) - 2024-02-03 + +### Commits + +- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`f11db9c`](https://github.com/ljharb/get-intrinsic/commit/f11db9c4fb97d87bbd53d3c73ac6b3db3613ad3b) +- [Dev Deps] update `aud`, `es-abstract`, `mock-property`, `npmignore` [`b7ac7d1`](https://github.com/ljharb/get-intrinsic/commit/b7ac7d1616fefb03877b1aed0c8f8d61aad32b6c) +- [meta] simplify `exports` [`faa0cc6`](https://github.com/ljharb/get-intrinsic/commit/faa0cc618e2830ffb51a8202490b0c215d965cbc) +- [meta] add missing `engines.node` [`774dd0b`](https://github.com/ljharb/get-intrinsic/commit/774dd0b3e8f741c3f05a6322d124d6087f146af1) +- [Dev Deps] update `tape` [`5828e8e`](https://github.com/ljharb/get-intrinsic/commit/5828e8e4a04e69312e87a36c0ea39428a7a4c3d8) +- [Robustness] use null objects for lookups [`eb9a11f`](https://github.com/ljharb/get-intrinsic/commit/eb9a11fa9eb3e13b193fcc05a7fb814341b1a7b7) +- [meta] add `sideEffects` flag [`89bcc7a`](https://github.com/ljharb/get-intrinsic/commit/89bcc7a42e19bf07b7c21e3094d5ab177109e6d2) + +## [v1.2.2](https://github.com/ljharb/get-intrinsic/compare/v1.2.1...v1.2.2) - 2023-10-20 + +### Commits + +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `call-bind`, `es-abstract`, `mock-property`, `object-inspect`, `tape` [`f51bcf2`](https://github.com/ljharb/get-intrinsic/commit/f51bcf26412d58d17ce17c91c9afd0ad271f0762) +- [Refactor] use `hasown` instead of `has` [`18d14b7`](https://github.com/ljharb/get-intrinsic/commit/18d14b799bea6b5765e1cec91890830cbcdb0587) +- [Deps] update `function-bind` [`6e109c8`](https://github.com/ljharb/get-intrinsic/commit/6e109c81e03804cc5e7824fb64353cdc3d8ee2c7) + +## [v1.2.1](https://github.com/ljharb/get-intrinsic/compare/v1.2.0...v1.2.1) - 2023-05-13 + +### Commits + +- [Fix] avoid a crash in envs without `__proto__` [`7bad8d0`](https://github.com/ljharb/get-intrinsic/commit/7bad8d061bf8721733b58b73a2565af2b6756b64) +- [Dev Deps] update `es-abstract` [`c60e6b7`](https://github.com/ljharb/get-intrinsic/commit/c60e6b7b4cf9660c7f27ed970970fd55fac48dc5) + +## [v1.2.0](https://github.com/ljharb/get-intrinsic/compare/v1.1.3...v1.2.0) - 2023-01-19 + +### Commits + +- [actions] update checkout action [`ca6b12f`](https://github.com/ljharb/get-intrinsic/commit/ca6b12f31eaacea4ea3b055e744cd61623385ffb) +- [Dev Deps] update `@ljharb/eslint-config`, `es-abstract`, `object-inspect`, `tape` [`41a3727`](https://github.com/ljharb/get-intrinsic/commit/41a3727d0026fa04273ae216a5f8e12eefd72da8) +- [Fix] ensure `Error.prototype` is undeniable [`c511e97`](https://github.com/ljharb/get-intrinsic/commit/c511e97ae99c764c4524b540dee7a70757af8da3) +- [Dev Deps] update `aud`, `es-abstract`, `tape` [`1bef8a8`](https://github.com/ljharb/get-intrinsic/commit/1bef8a8fd439ebb80863199b6189199e0851ac67) +- [Dev Deps] update `aud`, `es-abstract` [`0d41f16`](https://github.com/ljharb/get-intrinsic/commit/0d41f16bcd500bc28b7bfc98043ebf61ea081c26) +- [New] add `BigInt64Array` and `BigUint64Array` [`a6cca25`](https://github.com/ljharb/get-intrinsic/commit/a6cca25f29635889b7e9bd669baf9e04be90e48c) +- [Tests] use `gopd` [`ecf7722`](https://github.com/ljharb/get-intrinsic/commit/ecf7722240d15cfd16edda06acf63359c10fb9bd) + ## [v1.1.3](https://github.com/ljharb/get-intrinsic/compare/v1.1.2...v1.1.3) - 2022-09-12 ### Commits diff --git a/project starter code/node_modules/get-intrinsic/index.js b/project starter code/node_modules/get-intrinsic/index.js index 3c3d93eb..c25e2c42 100644 --- a/project starter code/node_modules/get-intrinsic/index.js +++ b/project starter code/node_modules/get-intrinsic/index.js @@ -2,9 +2,15 @@ var undefined; -var $SyntaxError = SyntaxError; +var $Error = require('es-errors'); +var $EvalError = require('es-errors/eval'); +var $RangeError = require('es-errors/range'); +var $ReferenceError = require('es-errors/ref'); +var $SyntaxError = require('es-errors/syntax'); +var $TypeError = require('es-errors/type'); +var $URIError = require('es-errors/uri'); + var $Function = Function; -var $TypeError = TypeError; // eslint-disable-next-line consistent-return var getEvalledConstructor = function (expressionSyntax) { @@ -43,18 +49,24 @@ var ThrowTypeError = $gOPD : throwTypeError; var hasSymbols = require('has-symbols')(); +var hasProto = require('has-proto')(); -var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto +var getProto = Object.getPrototypeOf || ( + hasProto + ? function (x) { return x.__proto__; } // eslint-disable-line no-proto + : null +); var needsEval = {}; -var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array); +var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined : getProto(Uint8Array); var INTRINSICS = { + __proto__: null, '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError, '%Array%': Array, '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer, - '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined, + '%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined, '%AsyncFromSyncIteratorPrototype%': undefined, '%AsyncFunction%': needsEval, '%AsyncGenerator%': needsEval, @@ -62,6 +74,8 @@ var INTRINSICS = { '%AsyncIteratorPrototype%': needsEval, '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics, '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt, + '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array, + '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array, '%Boolean%': Boolean, '%DataView%': typeof DataView === 'undefined' ? undefined : DataView, '%Date%': Date, @@ -69,9 +83,9 @@ var INTRINSICS = { '%decodeURIComponent%': decodeURIComponent, '%encodeURI%': encodeURI, '%encodeURIComponent%': encodeURIComponent, - '%Error%': Error, + '%Error%': $Error, '%eval%': eval, // eslint-disable-line no-eval - '%EvalError%': EvalError, + '%EvalError%': $EvalError, '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array, '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array, '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry, @@ -82,10 +96,10 @@ var INTRINSICS = { '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array, '%isFinite%': isFinite, '%isNaN%': isNaN, - '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined, + '%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined, '%JSON%': typeof JSON === 'object' ? JSON : undefined, '%Map%': typeof Map === 'undefined' ? undefined : Map, - '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()), + '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()), '%Math%': Math, '%Number%': Number, '%Object%': Object, @@ -93,15 +107,15 @@ var INTRINSICS = { '%parseInt%': parseInt, '%Promise%': typeof Promise === 'undefined' ? undefined : Promise, '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy, - '%RangeError%': RangeError, - '%ReferenceError%': ReferenceError, + '%RangeError%': $RangeError, + '%ReferenceError%': $ReferenceError, '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect, '%RegExp%': RegExp, '%Set%': typeof Set === 'undefined' ? undefined : Set, - '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()), + '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()), '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer, '%String%': String, - '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined, + '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined, '%Symbol%': hasSymbols ? Symbol : undefined, '%SyntaxError%': $SyntaxError, '%ThrowTypeError%': ThrowTypeError, @@ -111,12 +125,22 @@ var INTRINSICS = { '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray, '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array, '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array, - '%URIError%': URIError, + '%URIError%': $URIError, '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap, '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef, '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet }; +if (getProto) { + try { + null.error; // eslint-disable-line no-unused-expressions + } catch (e) { + // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229 + var errorProto = getProto(getProto(e)); + INTRINSICS['%Error.prototype%'] = errorProto; + } +} + var doEval = function doEval(name) { var value; if (name === '%AsyncFunction%') { @@ -132,7 +156,7 @@ var doEval = function doEval(name) { } } else if (name === '%AsyncIteratorPrototype%') { var gen = doEval('%AsyncGenerator%'); - if (gen) { + if (gen && getProto) { value = getProto(gen.prototype); } } @@ -143,6 +167,7 @@ var doEval = function doEval(name) { }; var LEGACY_ALIASES = { + __proto__: null, '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'], '%ArrayPrototype%': ['Array', 'prototype'], '%ArrayProto_entries%': ['Array', 'prototype', 'entries'], @@ -197,7 +222,7 @@ var LEGACY_ALIASES = { }; var bind = require('function-bind'); -var hasOwn = require('has'); +var hasOwn = require('hasown'); var $concat = bind.call(Function.call, Array.prototype.concat); var $spliceApply = bind.call(Function.apply, Array.prototype.splice); var $replace = bind.call(Function.call, String.prototype.replace); diff --git a/project starter code/node_modules/get-intrinsic/package.json b/project starter code/node_modules/get-intrinsic/package.json index dfde0329..568dff99 100644 --- a/project starter code/node_modules/get-intrinsic/package.json +++ b/project starter code/node_modules/get-intrinsic/package.json @@ -1,17 +1,13 @@ { "name": "get-intrinsic", - "version": "1.1.3", + "version": "1.2.4", "description": "Get and robustly cache all JS language-level intrinsics at first require time", "main": "index.js", "exports": { - ".": [ - { - "default": "./index.js" - }, - "./index.js" - ], + ".": "./index.js", "./package.json": "./package.json" }, + "sideEffects": false, "scripts": { "prepack": "npmignore --auto --commentLines=autogenerated", "prepublish": "not-in-publish || npm run prepublishOnly", @@ -48,24 +44,25 @@ }, "homepage": "https://github.com/ljharb/get-intrinsic#readme", "devDependencies": { - "@ljharb/eslint-config": "^21.0.0", - "aud": "^2.0.0", + "@ljharb/eslint-config": "^21.1.0", + "aud": "^2.0.4", "auto-changelog": "^2.4.0", - "call-bind": "^1.0.2", - "es-abstract": "^1.20.2", + "call-bind": "^1.0.5", + "es-abstract": "^1.22.3", "es-value-fixtures": "^1.4.2", "eslint": "=8.8.0", "evalmd": "^0.0.19", "for-each": "^0.3.3", + "gopd": "^1.0.1", "make-async-function": "^1.0.0", "make-async-generator-function": "^1.0.0", "make-generator-function": "^2.0.0", - "mock-property": "^1.0.0", - "npmignore": "^0.3.0", + "mock-property": "^1.0.3", + "npmignore": "^0.3.1", "nyc": "^10.3.2", - "object-inspect": "^1.12.2", + "object-inspect": "^1.13.1", "safe-publish-latest": "^2.0.0", - "tape": "^5.6.0" + "tape": "^5.7.4" }, "auto-changelog": { "output": "CHANGELOG.md", @@ -76,9 +73,11 @@ "hideCredit": true }, "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.3" + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" }, "testling": { "files": "test/GetIntrinsic.js" @@ -87,5 +86,8 @@ "ignore": [ ".github/workflows" ] + }, + "engines": { + "node": ">= 0.4" } } diff --git a/project starter code/node_modules/get-intrinsic/test/GetIntrinsic.js b/project starter code/node_modules/get-intrinsic/test/GetIntrinsic.js index 7e0ea30f..1cc08e00 100644 --- a/project starter code/node_modules/get-intrinsic/test/GetIntrinsic.js +++ b/project starter code/node_modules/get-intrinsic/test/GetIntrinsic.js @@ -12,7 +12,7 @@ var mockProperty = require('mock-property'); var callBound = require('call-bind/callBound'); var v = require('es-value-fixtures'); -var $gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor'); +var $gOPD = require('gopd'); var DefinePropertyOrThrow = require('es-abstract/2021/DefinePropertyOrThrow'); var $isProto = callBound('%Object.prototype.isPrototypeOf%'); diff --git a/project starter code/node_modules/gifwrap/README.md b/project starter code/node_modules/gifwrap/README.md index 52bb13fa..82f6e756 100644 --- a/project starter code/node_modules/gifwrap/README.md +++ b/project starter code/node_modules/gifwrap/README.md @@ -284,7 +284,7 @@ Property | Description --- | --- width | width of the GIF at its widest height | height of the GIF at its highest -loops | the number of times the GIF should loop before stopping; 0 => loop indefinately +loops | the number of times the GIF should loop before stopping; 0 => loop indefinitely usesTransparency | boolean indicating whether at least one frame contains at least one transparent pixel colorScope | the scope of the color tables as encoded within the GIF; either Gif.GlobalColorsOnly (== 1) or Gif.LocalColorsOnly (== 2). frames | a array of GifFrame instances, one for each frame of the GIF @@ -627,7 +627,7 @@ Decodes a GIF from a Buffer to yield an instance of Gif. Transparent pixels of t | Param | Type | Description | | --- | --- | --- | | frames | [Array.<GifFrame>](#GifFrame) | Array of frames to encode | -| spec | object | An optional object that may provide values for `loops` and `colorScope`, as defined for the Gif class. However, `colorSpace` may also take the value Gif.GlobalColorsPreferred (== 0) to indicate that the encoder should attempt to create only a global color table. `loop` defaults to 0, looping indefinitely, and `colorScope` defaults to Gif.GlobalColorsPreferred. | +| spec | object | An optional object that may provide values for `loops` and `colorScope`, as defined for the Gif class. However, `colorSpace` may also take the value Gif.GlobalColorsPreferred (== 0) to indicate that the encoder should attempt to create only a global color table. `loop` defaults to 0, looping indefinitely. Set `loop` to null to disable looping, playing only once. `colorScope` defaults to Gif.GlobalColorsPreferred. | Encodes a GIF from provided frames. Each pixel having an alpha value of 0x00 renders as transparent within the encoding, while all pixels of non-zero alpha value render as opaque. diff --git a/project starter code/node_modules/gifwrap/package.json b/project starter code/node_modules/gifwrap/package.json index 6750ddfc..71c2a6e2 100644 --- a/project starter code/node_modules/gifwrap/package.json +++ b/project starter code/node_modules/gifwrap/package.json @@ -1,6 +1,6 @@ { "name": "gifwrap", - "version": "0.9.4", + "version": "0.10.1", "description": "A Jimp-compatible library for working with GIFs", "main": "src/index.js", "scripts": { diff --git a/project starter code/node_modules/gifwrap/src/gif.js b/project starter code/node_modules/gifwrap/src/gif.js index 6d0959ce..c40579a4 100644 --- a/project starter code/node_modules/gifwrap/src/gif.js +++ b/project starter code/node_modules/gifwrap/src/gif.js @@ -19,7 +19,7 @@ class Gif { * --- | --- * width | width of the GIF at its widest * height | height of the GIF at its highest - * loops | the number of times the GIF should loop before stopping; 0 => loop indefinately + * loops | the number of times the GIF should loop before stopping; 0 => loop indefinitely * usesTransparency | boolean indicating whether at least one frame contains at least one transparent pixel * colorScope | the scope of the color tables as encoded within the GIF; either Gif.GlobalColorsOnly (== 1) or Gif.LocalColorsOnly (== 2). * frames | a array of GifFrame instances, one for each frame of the GIF diff --git a/project starter code/node_modules/gifwrap/src/gifcodec.js b/project starter code/node_modules/gifwrap/src/gifcodec.js index 5d72d5a2..16635427 100644 --- a/project starter code/node_modules/gifwrap/src/gifcodec.js +++ b/project starter code/node_modules/gifwrap/src/gifcodec.js @@ -92,7 +92,7 @@ class GifCodec * Encodes a GIF from provided frames. Each pixel having an alpha value of 0x00 renders as transparent within the encoding, while all pixels of non-zero alpha value render as opaque. * * @param {GifFrame[]} frames Array of frames to encode - * @param {object} spec An optional object that may provide values for `loops` and `colorScope`, as defined for the Gif class. However, `colorSpace` may also take the value Gif.GlobalColorsPreferred (== 0) to indicate that the encoder should attempt to create only a global color table. `loop` defaults to 0, looping indefinitely, and `colorScope` defaults to Gif.GlobalColorsPreferred. + * @param {object} spec An optional object that may provide values for `loops` and `colorScope`, as defined for the Gif class. However, `colorSpace` may also take the value Gif.GlobalColorsPreferred (== 0) to indicate that the encoder should attempt to create only a global color table. `loop` defaults to 0, looping indefinitely. Set `loop` to null to disable looping, playing only once. `colorScope` defaults to Gif.GlobalColorsPreferred. * @return {Promise} A Promise that resolves to an instance of the Gif class, representing the encoded GIF. * @throws {GifError} Error upon encountered an encoding-related problem with a GIF, so that the caller can distinguish between software errors and problems with GIFs. */ @@ -107,7 +107,9 @@ class GifCodec spec = Object.assign({}, spec); // don't munge caller's spec spec.width = dims.maxWidth; spec.height = dims.maxHeight; - spec.loops = spec.loops || 0; + if (spec.loops === undefined) { + spec.loops = 0; + } spec.colorScope = spec.colorScope || Gif.GlobalColorsPreferred; return Promise.resolve(this._encodeGif(frames, spec)); diff --git a/project starter code/node_modules/gifwrap/templates/README.hbs b/project starter code/node_modules/gifwrap/templates/README.hbs index 6b49cc52..c8aadc96 100644 --- a/project starter code/node_modules/gifwrap/templates/README.hbs +++ b/project starter code/node_modules/gifwrap/templates/README.hbs @@ -68,7 +68,7 @@ GIFs do not support partial transparency, so within `frame.bitmap.data`, pixels const { GifUtil } = require('gifwrap'); GifUtil.read("fancy.gif").then(inputGif => { - inputGif.frames.foreach(frame => { + inputGif.frames.forEach(frame => { const buf = frame.bitmap.data; frame.scanAllCoords((x, y, bi) => { @@ -139,10 +139,10 @@ const Jimp = require('jimp'); const j = new Jimp(200, 100, 0xFFFFFFFF); // create a frame clone of a Jip bitmap -const fCopied = new GifFrame(new BitmapImage(j)); +const fCopied = new GifFrame(new BitmapImage(j.bitmap)); // create a frame that shares a bitmap with Jimp (one way) -const fShared1 = new GifFrame(j); +const fShared1 = new GifFrame(j.bitmap); // create a frame that shares a bitmap with Jimp (another way) const fShared2 = new GifFrame(1, 1, 0); // any GifFrame diff --git a/project starter code/node_modules/glob-parent/CHANGELOG.md b/project starter code/node_modules/glob-parent/CHANGELOG.md new file mode 100644 index 00000000..fb9de961 --- /dev/null +++ b/project starter code/node_modules/glob-parent/CHANGELOG.md @@ -0,0 +1,110 @@ +### [5.1.2](https://github.com/gulpjs/glob-parent/compare/v5.1.1...v5.1.2) (2021-03-06) + + +### Bug Fixes + +* eliminate ReDoS ([#36](https://github.com/gulpjs/glob-parent/issues/36)) ([f923116](https://github.com/gulpjs/glob-parent/commit/f9231168b0041fea3f8f954b3cceb56269fc6366)) + +### [5.1.1](https://github.com/gulpjs/glob-parent/compare/v5.1.0...v5.1.1) (2021-01-27) + + +### Bug Fixes + +* unescape exclamation mark ([#26](https://github.com/gulpjs/glob-parent/issues/26)) ([a98874f](https://github.com/gulpjs/glob-parent/commit/a98874f1a59e407f4fb1beb0db4efa8392da60bb)) + +## [5.1.0](https://github.com/gulpjs/glob-parent/compare/v5.0.0...v5.1.0) (2021-01-27) + + +### Features + +* add `flipBackslashes` option to disable auto conversion of slashes (closes [#24](https://github.com/gulpjs/glob-parent/issues/24)) ([#25](https://github.com/gulpjs/glob-parent/issues/25)) ([eecf91d](https://github.com/gulpjs/glob-parent/commit/eecf91d5e3834ed78aee39c4eaaae654d76b87b3)) + +## [5.0.0](https://github.com/gulpjs/glob-parent/compare/v4.0.0...v5.0.0) (2021-01-27) + + +### ⚠ BREAKING CHANGES + +* Drop support for node <6 & bump dependencies + +### Miscellaneous Chores + +* Drop support for node <6 & bump dependencies ([896c0c0](https://github.com/gulpjs/glob-parent/commit/896c0c00b4e7362f60b96e7fc295ae929245255a)) + +## [4.0.0](https://github.com/gulpjs/glob-parent/compare/v3.1.0...v4.0.0) (2021-01-27) + + +### ⚠ BREAKING CHANGES + +* question marks are valid path characters on Windows so avoid flagging as a glob when alone +* Update is-glob dependency + +### Features + +* hoist regexps and strings for performance gains ([4a80667](https://github.com/gulpjs/glob-parent/commit/4a80667c69355c76a572a5892b0f133c8e1f457e)) +* question marks are valid path characters on Windows so avoid flagging as a glob when alone ([2a551dd](https://github.com/gulpjs/glob-parent/commit/2a551dd0dc3235e78bf3c94843d4107072d17841)) +* Update is-glob dependency ([e41fcd8](https://github.com/gulpjs/glob-parent/commit/e41fcd895d1f7bc617dba45c9d935a7949b9c281)) + +## [3.1.0](https://github.com/gulpjs/glob-parent/compare/v3.0.1...v3.1.0) (2021-01-27) + + +### Features + +* allow basic win32 backslash use ([272afa5](https://github.com/gulpjs/glob-parent/commit/272afa5fd070fc0f796386a5993d4ee4a846988b)) +* handle extglobs (parentheses) containing separators ([7db1bdb](https://github.com/gulpjs/glob-parent/commit/7db1bdb0756e55fd14619e8ce31aa31b17b117fd)) +* new approach to braces/brackets handling ([8269bd8](https://github.com/gulpjs/glob-parent/commit/8269bd89290d99fac9395a354fb56fdcdb80f0be)) +* pre-process braces/brackets sections ([9ef8a87](https://github.com/gulpjs/glob-parent/commit/9ef8a87f66b1a43d0591e7a8e4fc5a18415ee388)) +* preserve escaped brace/bracket at end of string ([8cfb0ba](https://github.com/gulpjs/glob-parent/commit/8cfb0ba84202d51571340dcbaf61b79d16a26c76)) + + +### Bug Fixes + +* trailing escaped square brackets ([99ec9fe](https://github.com/gulpjs/glob-parent/commit/99ec9fecc60ee488ded20a94dd4f18b4f55c4ccf)) + +### [3.0.1](https://github.com/gulpjs/glob-parent/compare/v3.0.0...v3.0.1) (2021-01-27) + + +### Features + +* use path-dirname ponyfill ([cdbea5f](https://github.com/gulpjs/glob-parent/commit/cdbea5f32a58a54e001a75ddd7c0fccd4776aacc)) + + +### Bug Fixes + +* unescape glob-escaped dirnames on output ([598c533](https://github.com/gulpjs/glob-parent/commit/598c533bdf49c1428bc063aa9b8db40c5a86b030)) + +## [3.0.0](https://github.com/gulpjs/glob-parent/compare/v2.0.0...v3.0.0) (2021-01-27) + + +### ⚠ BREAKING CHANGES + +* update is-glob dependency + +### Features + +* update is-glob dependency ([5c5f8ef](https://github.com/gulpjs/glob-parent/commit/5c5f8efcee362a8e7638cf8220666acd8784f6bd)) + +## [2.0.0](https://github.com/gulpjs/glob-parent/compare/v1.3.0...v2.0.0) (2021-01-27) + + +### Features + +* move up to dirname regardless of glob characters ([f97fb83](https://github.com/gulpjs/glob-parent/commit/f97fb83be2e0a9fc8d3b760e789d2ecadd6aa0c2)) + +## [1.3.0](https://github.com/gulpjs/glob-parent/compare/v1.2.0...v1.3.0) (2021-01-27) + +## [1.2.0](https://github.com/gulpjs/glob-parent/compare/v1.1.0...v1.2.0) (2021-01-27) + + +### Reverts + +* feat: make regex test strings smaller ([dc80fa9](https://github.com/gulpjs/glob-parent/commit/dc80fa9658dca20549cfeba44bbd37d5246fcce0)) + +## [1.1.0](https://github.com/gulpjs/glob-parent/compare/v1.0.0...v1.1.0) (2021-01-27) + + +### Features + +* make regex test strings smaller ([cd83220](https://github.com/gulpjs/glob-parent/commit/cd832208638f45169f986d80fcf66e401f35d233)) + +## 1.0.0 (2021-01-27) + diff --git a/project starter code/node_modules/glob-parent/LICENSE b/project starter code/node_modules/glob-parent/LICENSE new file mode 100644 index 00000000..63222d7a --- /dev/null +++ b/project starter code/node_modules/glob-parent/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) 2015, 2019 Elan Shanker + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/project starter code/node_modules/glob-parent/README.md b/project starter code/node_modules/glob-parent/README.md new file mode 100644 index 00000000..36a27938 --- /dev/null +++ b/project starter code/node_modules/glob-parent/README.md @@ -0,0 +1,137 @@ +

+ + + +

+ +# glob-parent + +[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Azure Pipelines Build Status][azure-pipelines-image]][azure-pipelines-url] [![Travis Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] + +Extract the non-magic parent path from a glob string. + +## Usage + +```js +var globParent = require('glob-parent'); + +globParent('path/to/*.js'); // 'path/to' +globParent('/root/path/to/*.js'); // '/root/path/to' +globParent('/*.js'); // '/' +globParent('*.js'); // '.' +globParent('**/*.js'); // '.' +globParent('path/{to,from}'); // 'path' +globParent('path/!(to|from)'); // 'path' +globParent('path/?(to|from)'); // 'path' +globParent('path/+(to|from)'); // 'path' +globParent('path/*(to|from)'); // 'path' +globParent('path/@(to|from)'); // 'path' +globParent('path/**/*'); // 'path' + +// if provided a non-glob path, returns the nearest dir +globParent('path/foo/bar.js'); // 'path/foo' +globParent('path/foo/'); // 'path/foo' +globParent('path/foo'); // 'path' (see issue #3 for details) +``` + +## API + +### `globParent(maybeGlobString, [options])` + +Takes a string and returns the part of the path before the glob begins. Be aware of Escaping rules and Limitations below. + +#### options + +```js +{ + // Disables the automatic conversion of slashes for Windows + flipBackslashes: true +} +``` + +## Escaping + +The following characters have special significance in glob patterns and must be escaped if you want them to be treated as regular path characters: + +- `?` (question mark) unless used as a path segment alone +- `*` (asterisk) +- `|` (pipe) +- `(` (opening parenthesis) +- `)` (closing parenthesis) +- `{` (opening curly brace) +- `}` (closing curly brace) +- `[` (opening bracket) +- `]` (closing bracket) + +**Example** + +```js +globParent('foo/[bar]/') // 'foo' +globParent('foo/\\[bar]/') // 'foo/[bar]' +``` + +## Limitations + +### Braces & Brackets +This library attempts a quick and imperfect method of determining which path +parts have glob magic without fully parsing/lexing the pattern. There are some +advanced use cases that can trip it up, such as nested braces where the outer +pair is escaped and the inner one contains a path separator. If you find +yourself in the unlikely circumstance of being affected by this or need to +ensure higher-fidelity glob handling in your library, it is recommended that you +pre-process your input with [expand-braces] and/or [expand-brackets]. + +### Windows +Backslashes are not valid path separators for globs. If a path with backslashes +is provided anyway, for simple cases, glob-parent will replace the path +separator for you and return the non-glob parent path (now with +forward-slashes, which are still valid as Windows path separators). + +This cannot be used in conjunction with escape characters. + +```js +// BAD +globParent('C:\\Program Files \\(x86\\)\\*.ext') // 'C:/Program Files /(x86/)' + +// GOOD +globParent('C:/Program Files\\(x86\\)/*.ext') // 'C:/Program Files (x86)' +``` + +If you are using escape characters for a pattern without path parts (i.e. +relative to `cwd`), prefix with `./` to avoid confusing glob-parent. + +```js +// BAD +globParent('foo \\[bar]') // 'foo ' +globParent('foo \\[bar]*') // 'foo ' + +// GOOD +globParent('./foo \\[bar]') // 'foo [bar]' +globParent('./foo \\[bar]*') // '.' +``` + +## License + +ISC + +[expand-braces]: https://github.com/jonschlinkert/expand-braces +[expand-brackets]: https://github.com/jonschlinkert/expand-brackets + +[downloads-image]: https://img.shields.io/npm/dm/glob-parent.svg +[npm-url]: https://www.npmjs.com/package/glob-parent +[npm-image]: https://img.shields.io/npm/v/glob-parent.svg + +[azure-pipelines-url]: https://dev.azure.com/gulpjs/gulp/_build/latest?definitionId=2&branchName=master +[azure-pipelines-image]: https://dev.azure.com/gulpjs/gulp/_apis/build/status/glob-parent?branchName=master + +[travis-url]: https://travis-ci.org/gulpjs/glob-parent +[travis-image]: https://img.shields.io/travis/gulpjs/glob-parent.svg?label=travis-ci + +[appveyor-url]: https://ci.appveyor.com/project/gulpjs/glob-parent +[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/glob-parent.svg?label=appveyor + +[coveralls-url]: https://coveralls.io/r/gulpjs/glob-parent +[coveralls-image]: https://img.shields.io/coveralls/gulpjs/glob-parent/master.svg + +[gitter-url]: https://gitter.im/gulpjs/gulp +[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg diff --git a/project starter code/node_modules/glob-parent/index.js b/project starter code/node_modules/glob-parent/index.js new file mode 100644 index 00000000..09e257ea --- /dev/null +++ b/project starter code/node_modules/glob-parent/index.js @@ -0,0 +1,42 @@ +'use strict'; + +var isGlob = require('is-glob'); +var pathPosixDirname = require('path').posix.dirname; +var isWin32 = require('os').platform() === 'win32'; + +var slash = '/'; +var backslash = /\\/g; +var enclosure = /[\{\[].*[\}\]]$/; +var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/; +var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g; + +/** + * @param {string} str + * @param {Object} opts + * @param {boolean} [opts.flipBackslashes=true] + * @returns {string} + */ +module.exports = function globParent(str, opts) { + var options = Object.assign({ flipBackslashes: true }, opts); + + // flip windows path separators + if (options.flipBackslashes && isWin32 && str.indexOf(slash) < 0) { + str = str.replace(backslash, slash); + } + + // special case for strings ending in enclosure containing path separator + if (enclosure.test(str)) { + str += slash; + } + + // preserves full path in case of trailing path separator + str += 'a'; + + // remove path parts that are globby + do { + str = pathPosixDirname(str); + } while (isGlob(str) || globby.test(str)); + + // remove escape chars and return result + return str.replace(escaped, '$1'); +}; diff --git a/project starter code/node_modules/glob-parent/package.json b/project starter code/node_modules/glob-parent/package.json new file mode 100644 index 00000000..125c971c --- /dev/null +++ b/project starter code/node_modules/glob-parent/package.json @@ -0,0 +1,48 @@ +{ + "name": "glob-parent", + "version": "5.1.2", + "description": "Extract the non-magic parent path from a glob string.", + "author": "Gulp Team (https://gulpjs.com/)", + "contributors": [ + "Elan Shanker (https://github.com/es128)", + "Blaine Bublitz " + ], + "repository": "gulpjs/glob-parent", + "license": "ISC", + "engines": { + "node": ">= 6" + }, + "main": "index.js", + "files": [ + "LICENSE", + "index.js" + ], + "scripts": { + "lint": "eslint .", + "pretest": "npm run lint", + "test": "nyc mocha --async-only", + "azure-pipelines": "nyc mocha --async-only --reporter xunit -O output=test.xunit", + "coveralls": "nyc report --reporter=text-lcov | coveralls" + }, + "dependencies": { + "is-glob": "^4.0.1" + }, + "devDependencies": { + "coveralls": "^3.0.11", + "eslint": "^2.13.1", + "eslint-config-gulp": "^3.0.1", + "expect": "^1.20.2", + "mocha": "^6.0.2", + "nyc": "^13.3.0" + }, + "keywords": [ + "glob", + "parent", + "strip", + "path", + "dirname", + "directory", + "base", + "wildcard" + ] +} diff --git a/project starter code/node_modules/gopd/.eslintrc b/project starter code/node_modules/gopd/.eslintrc new file mode 100644 index 00000000..e2550c0f --- /dev/null +++ b/project starter code/node_modules/gopd/.eslintrc @@ -0,0 +1,16 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "func-style": [2, "declaration"], + "id-length": 0, + "multiline-comment-style": 0, + "new-cap": [2, { + "capIsNewExceptions": [ + "GetIntrinsic", + ], + }], + }, +} diff --git a/project starter code/node_modules/gopd/.github/FUNDING.yml b/project starter code/node_modules/gopd/.github/FUNDING.yml new file mode 100644 index 00000000..94a44a8e --- /dev/null +++ b/project starter code/node_modules/gopd/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/gopd +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/project starter code/node_modules/gopd/CHANGELOG.md b/project starter code/node_modules/gopd/CHANGELOG.md new file mode 100644 index 00000000..f111eb17 --- /dev/null +++ b/project starter code/node_modules/gopd/CHANGELOG.md @@ -0,0 +1,25 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.1](https://github.com/ljharb/gopd/compare/v1.0.0...v1.0.1) - 2022-11-01 + +### Commits + +- [Fix] actually export gOPD instead of dP [`4b624bf`](https://github.com/ljharb/gopd/commit/4b624bfbeff788c5e3ff16d9443a83627847234f) + +## v1.0.0 - 2022-11-01 + +### Commits + +- Initial implementation, tests, readme [`0911e01`](https://github.com/ljharb/gopd/commit/0911e012cd642092bd88b732c161c58bf4f20bea) +- Initial commit [`b84e33f`](https://github.com/ljharb/gopd/commit/b84e33f5808a805ac57ff88d4247ad935569acbe) +- [actions] add reusable workflows [`12ae28a`](https://github.com/ljharb/gopd/commit/12ae28ae5f50f86e750215b6e2188901646d0119) +- npm init [`280118b`](https://github.com/ljharb/gopd/commit/280118badb45c80b4483836b5cb5315bddf6e582) +- [meta] add `auto-changelog` [`bb78de5`](https://github.com/ljharb/gopd/commit/bb78de5639a180747fb290c28912beaaf1615709) +- [meta] create FUNDING.yml; add `funding` in package.json [`11c22e6`](https://github.com/ljharb/gopd/commit/11c22e6355bb01f24e7fac4c9bb3055eb5b25002) +- [meta] use `npmignore` to autogenerate an npmignore file [`4f4537a`](https://github.com/ljharb/gopd/commit/4f4537a843b39f698c52f072845092e6fca345bb) +- Only apps should have lockfiles [`c567022`](https://github.com/ljharb/gopd/commit/c567022a18573aa7951cf5399445d9840e23e98b) diff --git a/project starter code/node_modules/gopd/LICENSE b/project starter code/node_modules/gopd/LICENSE new file mode 100644 index 00000000..6abfe143 --- /dev/null +++ b/project starter code/node_modules/gopd/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/project starter code/node_modules/gopd/README.md b/project starter code/node_modules/gopd/README.md new file mode 100644 index 00000000..784e56a0 --- /dev/null +++ b/project starter code/node_modules/gopd/README.md @@ -0,0 +1,40 @@ +# gopd [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +`Object.getOwnPropertyDescriptor`, but accounts for IE's broken implementation. + +## Usage + +```javascript +var gOPD = require('gopd'); +var assert = require('assert'); + +if (gOPD) { + assert.equal(typeof gOPD, 'function', 'descriptors supported'); + // use gOPD like Object.getOwnPropertyDescriptor here +} else { + assert.ok(!gOPD, 'descriptors not supported'); +} +``` + +[package-url]: https://npmjs.org/package/gopd +[npm-version-svg]: https://versionbadg.es/ljharb/gopd.svg +[deps-svg]: https://david-dm.org/ljharb/gopd.svg +[deps-url]: https://david-dm.org/ljharb/gopd +[dev-deps-svg]: https://david-dm.org/ljharb/gopd/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/gopd#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/gopd.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/gopd.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/gopd.svg +[downloads-url]: https://npm-stat.com/charts.html?package=gopd +[codecov-image]: https://codecov.io/gh/ljharb/gopd/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/gopd/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/gopd +[actions-url]: https://github.com/ljharb/gopd/actions diff --git a/project starter code/node_modules/gopd/index.js b/project starter code/node_modules/gopd/index.js new file mode 100644 index 00000000..fb6d3bbe --- /dev/null +++ b/project starter code/node_modules/gopd/index.js @@ -0,0 +1,16 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); + +var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); + +if ($gOPD) { + try { + $gOPD([], 'length'); + } catch (e) { + // IE 8 has a broken gOPD + $gOPD = null; + } +} + +module.exports = $gOPD; diff --git a/project starter code/node_modules/gopd/package.json b/project starter code/node_modules/gopd/package.json new file mode 100644 index 00000000..d5e1fa4a --- /dev/null +++ b/project starter code/node_modules/gopd/package.json @@ -0,0 +1,71 @@ +{ + "name": "gopd", + "version": "1.0.1", + "description": "`Object.getOwnPropertyDescriptor`, but accounts for IE's broken implementation.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "lint": "eslint --ext=js,mjs .", + "postlint": "evalmd README.md", + "pretest": "npm run lint", + "tests-only": "tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/gopd.git" + }, + "keywords": [ + "ecmascript", + "javascript", + "getownpropertydescriptor", + "property", + "descriptor" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/gopd/issues" + }, + "homepage": "https://github.com/ljharb/gopd#readme", + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.0.0", + "aud": "^2.0.1", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "in-publish": "^2.0.1", + "npmignore": "^0.3.0", + "safe-publish-latest": "^2.0.0", + "tape": "^5.6.1" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/project starter code/node_modules/gopd/test/index.js b/project starter code/node_modules/gopd/test/index.js new file mode 100644 index 00000000..0376bfba --- /dev/null +++ b/project starter code/node_modules/gopd/test/index.js @@ -0,0 +1,35 @@ +'use strict'; + +var test = require('tape'); +var gOPD = require('../'); + +test('gOPD', function (t) { + t.test('supported', { skip: !gOPD }, function (st) { + st.equal(typeof gOPD, 'function', 'is a function'); + + var obj = { x: 1 }; + st.ok('x' in obj, 'property exists'); + + var desc = gOPD(obj, 'x'); + st.deepEqual( + desc, + { + configurable: true, + enumerable: true, + value: 1, + writable: true + }, + 'descriptor is as expected' + ); + + st.end(); + }); + + t.test('not supported', { skip: gOPD }, function (st) { + st.notOk(gOPD, 'is falsy'); + + st.end(); + }); + + t.end(); +}); diff --git a/project starter code/node_modules/has-flag/index.js b/project starter code/node_modules/has-flag/index.js new file mode 100644 index 00000000..5139728f --- /dev/null +++ b/project starter code/node_modules/has-flag/index.js @@ -0,0 +1,8 @@ +'use strict'; +module.exports = (flag, argv) => { + argv = argv || process.argv; + const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--'); + const pos = argv.indexOf(prefix + flag); + const terminatorPos = argv.indexOf('--'); + return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); +}; diff --git a/project starter code/node_modules/has-flag/license b/project starter code/node_modules/has-flag/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/project starter code/node_modules/has-flag/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/project starter code/node_modules/has-flag/package.json b/project starter code/node_modules/has-flag/package.json new file mode 100644 index 00000000..e1eb17a1 --- /dev/null +++ b/project starter code/node_modules/has-flag/package.json @@ -0,0 +1,44 @@ +{ + "name": "has-flag", + "version": "3.0.0", + "description": "Check if argv has a specific flag", + "license": "MIT", + "repository": "sindresorhus/has-flag", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "has", + "check", + "detect", + "contains", + "find", + "flag", + "cli", + "command-line", + "argv", + "process", + "arg", + "args", + "argument", + "arguments", + "getopt", + "minimist", + "optimist" + ], + "devDependencies": { + "ava": "*", + "xo": "*" + } +} diff --git a/project starter code/node_modules/has-flag/readme.md b/project starter code/node_modules/has-flag/readme.md new file mode 100644 index 00000000..677893c2 --- /dev/null +++ b/project starter code/node_modules/has-flag/readme.md @@ -0,0 +1,70 @@ +# has-flag [![Build Status](https://travis-ci.org/sindresorhus/has-flag.svg?branch=master)](https://travis-ci.org/sindresorhus/has-flag) + +> Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag + +Correctly stops looking after an `--` argument terminator. + + +## Install + +``` +$ npm install has-flag +``` + + +## Usage + +```js +// foo.js +const hasFlag = require('has-flag'); + +hasFlag('unicorn'); +//=> true + +hasFlag('--unicorn'); +//=> true + +hasFlag('f'); +//=> true + +hasFlag('-f'); +//=> true + +hasFlag('foo=bar'); +//=> true + +hasFlag('foo'); +//=> false + +hasFlag('rainbow'); +//=> false +``` + +``` +$ node foo.js -f --unicorn --foo=bar -- --rainbow +``` + + +## API + +### hasFlag(flag, [argv]) + +Returns a boolean for whether the flag exists. + +#### flag + +Type: `string` + +CLI flag to look for. The `--` prefix is optional. + +#### argv + +Type: `string[]`
+Default: `process.argv` + +CLI arguments. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/project starter code/node_modules/has-property-descriptors/.eslintrc b/project starter code/node_modules/has-property-descriptors/.eslintrc new file mode 100644 index 00000000..2fcc002b --- /dev/null +++ b/project starter code/node_modules/has-property-descriptors/.eslintrc @@ -0,0 +1,13 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "func-name-matching": 0, + "id-length": 0, + "new-cap": [2, { + "capIsNewExceptions": ["GetIntrinsic"], + }], + }, +} diff --git a/project starter code/node_modules/has-property-descriptors/.github/FUNDING.yml b/project starter code/node_modules/has-property-descriptors/.github/FUNDING.yml new file mode 100644 index 00000000..817aacf1 --- /dev/null +++ b/project starter code/node_modules/has-property-descriptors/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/has-property-descriptors +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/project starter code/node_modules/has-property-descriptors/.nycrc b/project starter code/node_modules/has-property-descriptors/.nycrc new file mode 100644 index 00000000..bdd626ce --- /dev/null +++ b/project starter code/node_modules/has-property-descriptors/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/project starter code/node_modules/has-property-descriptors/CHANGELOG.md b/project starter code/node_modules/has-property-descriptors/CHANGELOG.md new file mode 100644 index 00000000..19c8a959 --- /dev/null +++ b/project starter code/node_modules/has-property-descriptors/CHANGELOG.md @@ -0,0 +1,35 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.2](https://github.com/inspect-js/has-property-descriptors/compare/v1.0.1...v1.0.2) - 2024-02-12 + +### Commits + +- [Refactor] use `es-define-property` [`f93a8c8`](https://github.com/inspect-js/has-property-descriptors/commit/f93a8c85eba70cbceab500f2619fb5cce73a1805) +- [Dev Deps] update `aud`, `npmignore`, `tape` [`42b0c9d`](https://github.com/inspect-js/has-property-descriptors/commit/42b0c9d1c23e747755f0f2924923c418ea34a9ee) +- [Deps] update `get-intrinsic` [`35e9b46`](https://github.com/inspect-js/has-property-descriptors/commit/35e9b46a7f14331bf0de98b644dd803676746037) + +## [v1.0.1](https://github.com/inspect-js/has-property-descriptors/compare/v1.0.0...v1.0.1) - 2023-10-20 + +### Commits + +- [meta] use `npmignore` to autogenerate an npmignore file [`5bbf4da`](https://github.com/inspect-js/has-property-descriptors/commit/5bbf4dae1b58950d87bb3af508bee7513e640868) +- [actions] update rebase action to use reusable workflow [`3a5585b`](https://github.com/inspect-js/has-property-descriptors/commit/3a5585bf74988f71a8f59e67a07d594e62c51fd8) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`e5c1212`](https://github.com/inspect-js/has-property-descriptors/commit/e5c1212048a8fda549794c47863724ca60b89cae) +- [Dev Deps] update `aud`, `tape` [`e942917`](https://github.com/inspect-js/has-property-descriptors/commit/e942917b6c2f7c090d5623048989cf20d0834ebf) +- [Deps] update `get-intrinsic` [`f4a44ec`](https://github.com/inspect-js/has-property-descriptors/commit/f4a44ec6d94146fa6c550d3c15c31a2062c83ef4) +- [Deps] update `get-intrinsic` [`eeb275b`](https://github.com/inspect-js/has-property-descriptors/commit/eeb275b473e5d72ca843b61ca25cfcb06a5d4300) + +## v1.0.0 - 2022-04-14 + +### Commits + +- Initial implementation, tests [`303559f`](https://github.com/inspect-js/has-property-descriptors/commit/303559f2a72dfe7111573a1aec475ed4a184c35a) +- Initial commit [`3a7ca2d`](https://github.com/inspect-js/has-property-descriptors/commit/3a7ca2dc49f1fff0279a28bb16265e7615e14749) +- read me [`dd73dce`](https://github.com/inspect-js/has-property-descriptors/commit/dd73dce09d89d0f7a4a6e3b1e562a506f979a767) +- npm init [`c1e6557`](https://github.com/inspect-js/has-property-descriptors/commit/c1e655779de632d68cb944c50da6b71bcb7b8c85) +- Only apps should have lockfiles [`e72f7c6`](https://github.com/inspect-js/has-property-descriptors/commit/e72f7c68de534b2d273ee665f8b18d4ecc7f70b0) diff --git a/project starter code/node_modules/has-property-descriptors/LICENSE b/project starter code/node_modules/has-property-descriptors/LICENSE new file mode 100644 index 00000000..2e7b9a3e --- /dev/null +++ b/project starter code/node_modules/has-property-descriptors/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Inspect JS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/project starter code/node_modules/has-property-descriptors/README.md b/project starter code/node_modules/has-property-descriptors/README.md new file mode 100644 index 00000000..d81fbd99 --- /dev/null +++ b/project starter code/node_modules/has-property-descriptors/README.md @@ -0,0 +1,43 @@ +# has-property-descriptors [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][deps-svg]][deps-url] +[![dev dependency status][dev-deps-svg]][dev-deps-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Does the environment have full property descriptor support? Handles IE 8's broken defineProperty/gOPD. + +## Example + +```js +var hasPropertyDescriptors = require('has-property-descriptors'); +var assert = require('assert'); + +assert.equal(hasPropertyDescriptors(), true); // will be `false` in IE 6-8, and ES5 engines + +// Arrays can not have their length `[[Defined]]` in some engines +assert.equal(hasPropertyDescriptors.hasArrayLengthDefineBug(), false); // will be `true` in Firefox 4-22, and node v0.6 +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/has-property-descriptors +[npm-version-svg]: https://versionbadg.es/inspect-js/has-property-descriptors.svg +[deps-svg]: https://david-dm.org/inspect-js/has-property-descriptors.svg +[deps-url]: https://david-dm.org/inspect-js/has-property-descriptors +[dev-deps-svg]: https://david-dm.org/inspect-js/has-property-descriptors/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/has-property-descriptors#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/has-property-descriptors.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/has-property-descriptors.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/has-property-descriptors.svg +[downloads-url]: https://npm-stat.com/charts.html?package=has-property-descriptors +[codecov-image]: https://codecov.io/gh/inspect-js/has-property-descriptors/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/has-property-descriptors/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/has-property-descriptors +[actions-url]: https://github.com/inspect-js/has-property-descriptors/actions diff --git a/project starter code/node_modules/has-property-descriptors/index.js b/project starter code/node_modules/has-property-descriptors/index.js new file mode 100644 index 00000000..04804379 --- /dev/null +++ b/project starter code/node_modules/has-property-descriptors/index.js @@ -0,0 +1,22 @@ +'use strict'; + +var $defineProperty = require('es-define-property'); + +var hasPropertyDescriptors = function hasPropertyDescriptors() { + return !!$defineProperty; +}; + +hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() { + // node v0.6 has a bug where array lengths can be Set but not Defined + if (!$defineProperty) { + return null; + } + try { + return $defineProperty([], 'length', { value: 1 }).length !== 1; + } catch (e) { + // In Firefox 4-22, defining length on an array throws an exception. + return true; + } +}; + +module.exports = hasPropertyDescriptors; diff --git a/project starter code/node_modules/has-property-descriptors/package.json b/project starter code/node_modules/has-property-descriptors/package.json new file mode 100644 index 00000000..7e70218b --- /dev/null +++ b/project starter code/node_modules/has-property-descriptors/package.json @@ -0,0 +1,77 @@ +{ + "name": "has-property-descriptors", + "version": "1.0.2", + "description": "Does the environment have full property descriptor support? Handles IE 8's broken defineProperty/gOPD.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "pretest": "npm run lint", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/has-property-descriptors.git" + }, + "keywords": [ + "property", + "descriptors", + "has", + "environment", + "env", + "defineProperty", + "getOwnPropertyDescriptor" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/has-property-descriptors/issues" + }, + "homepage": "https://github.com/inspect-js/has-property-descriptors#readme", + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.4" + }, + "dependencies": { + "es-define-property": "^1.0.0" + }, + "testling": { + "files": "test/index.js" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/project starter code/node_modules/has-property-descriptors/test/index.js b/project starter code/node_modules/has-property-descriptors/test/index.js new file mode 100644 index 00000000..7f02bd3e --- /dev/null +++ b/project starter code/node_modules/has-property-descriptors/test/index.js @@ -0,0 +1,57 @@ +'use strict'; + +var test = require('tape'); + +var hasPropertyDescriptors = require('../'); + +var sentinel = {}; + +test('hasPropertyDescriptors', function (t) { + t.equal(typeof hasPropertyDescriptors, 'function', 'is a function'); + t.equal(typeof hasPropertyDescriptors.hasArrayLengthDefineBug, 'function', '`hasArrayLengthDefineBug` property is a function'); + + var yes = hasPropertyDescriptors(); + t.test('property descriptors', { skip: !yes }, function (st) { + var o = { a: sentinel }; + + st.deepEqual( + Object.getOwnPropertyDescriptor(o, 'a'), + { + configurable: true, + enumerable: true, + value: sentinel, + writable: true + }, + 'has expected property descriptor' + ); + + Object.defineProperty(o, 'a', { enumerable: false, writable: false }); + + st.deepEqual( + Object.getOwnPropertyDescriptor(o, 'a'), + { + configurable: true, + enumerable: false, + value: sentinel, + writable: false + }, + 'has expected property descriptor after [[Define]]' + ); + + st.end(); + }); + + var arrayBug = hasPropertyDescriptors.hasArrayLengthDefineBug(); + t.test('defining array lengths', { skip: !yes || arrayBug }, function (st) { + var arr = [1, , 3]; // eslint-disable-line no-sparse-arrays + st.equal(arr.length, 3, 'array starts with length 3'); + + Object.defineProperty(arr, 'length', { value: 5 }); + + st.equal(arr.length, 5, 'array ends with length 5'); + + st.end(); + }); + + t.end(); +}); diff --git a/project starter code/node_modules/has-proto/.eslintrc b/project starter code/node_modules/has-proto/.eslintrc new file mode 100644 index 00000000..3b5d9e90 --- /dev/null +++ b/project starter code/node_modules/has-proto/.eslintrc @@ -0,0 +1,5 @@ +{ + "root": true, + + "extends": "@ljharb", +} diff --git a/project starter code/node_modules/has-proto/.github/FUNDING.yml b/project starter code/node_modules/has-proto/.github/FUNDING.yml new file mode 100644 index 00000000..613705c7 --- /dev/null +++ b/project starter code/node_modules/has-proto/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/has-proto +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/project starter code/node_modules/has-proto/CHANGELOG.md b/project starter code/node_modules/has-proto/CHANGELOG.md new file mode 100644 index 00000000..6690f28e --- /dev/null +++ b/project starter code/node_modules/has-proto/CHANGELOG.md @@ -0,0 +1,38 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.0.3](https://github.com/inspect-js/has-proto/compare/v1.0.2...v1.0.3) - 2024-02-19 + +### Commits + +- [types] add missing declaration file [`26ecade`](https://github.com/inspect-js/has-proto/commit/26ecade05d253bb5dc376945ee3186d1fbe334f8) + +## [v1.0.2](https://github.com/inspect-js/has-proto/compare/v1.0.1...v1.0.2) - 2024-02-19 + +### Commits + +- add types [`6435262`](https://github.com/inspect-js/has-proto/commit/64352626cf511c0276d5f4bb6be770a0bf0f8524) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `npmignore`, `tape` [`f16a5e4`](https://github.com/inspect-js/has-proto/commit/f16a5e4121651e551271419f9d60fdd3561fd82c) +- [Refactor] tiny cleanup [`d1f1a4b`](https://github.com/inspect-js/has-proto/commit/d1f1a4bdc135f115a10f148ce302676224534702) +- [meta] add `sideEffects` flag [`e7ab1a6`](https://github.com/inspect-js/has-proto/commit/e7ab1a6f153b3e80dee68d1748b71e46767a0531) + +## [v1.0.1](https://github.com/inspect-js/has-proto/compare/v1.0.0...v1.0.1) - 2022-12-21 + +### Commits + +- [meta] correct URLs and description [`ef34483`](https://github.com/inspect-js/has-proto/commit/ef34483ca0d35680f271b6b96e35526151b25dfc) +- [patch] add an additional criteria [`e81959e`](https://github.com/inspect-js/has-proto/commit/e81959ed7c7a77fbf459f00cb4ef824f1099497f) +- [Dev Deps] update `aud` [`2bec2c4`](https://github.com/inspect-js/has-proto/commit/2bec2c47b072b122ff5443fba0263f6dc649531f) + +## v1.0.0 - 2022-12-12 + +### Commits + +- Initial implementation, tests, readme [`6886fea`](https://github.com/inspect-js/has-proto/commit/6886fea578f67daf69a7920b2eb7637ea6ebb0bc) +- Initial commit [`99129c8`](https://github.com/inspect-js/has-proto/commit/99129c8f42471ac89cb681ba9cb9d52a583eb94f) +- npm init [`2844ad8`](https://github.com/inspect-js/has-proto/commit/2844ad8e75b84d66a46765b3bab9d2e8ea692e10) +- Only apps should have lockfiles [`c65bc5e`](https://github.com/inspect-js/has-proto/commit/c65bc5e40b9004463f7336d47c67245fb139a36a) diff --git a/project starter code/node_modules/has-proto/LICENSE b/project starter code/node_modules/has-proto/LICENSE new file mode 100644 index 00000000..2e7b9a3e --- /dev/null +++ b/project starter code/node_modules/has-proto/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Inspect JS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/project starter code/node_modules/has-proto/README.md b/project starter code/node_modules/has-proto/README.md new file mode 100644 index 00000000..14567654 --- /dev/null +++ b/project starter code/node_modules/has-proto/README.md @@ -0,0 +1,38 @@ +# has-proto [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Does this environment have the ability to set the [[Prototype]] of an object on creation with `__proto__`? + +## Example + +```js +var hasProto = require('has-proto'); +var assert = require('assert'); + +assert.equal(typeof hasProto(), 'boolean'); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/has-proto +[npm-version-svg]: https://versionbadg.es/inspect-js/has-proto.svg +[deps-svg]: https://david-dm.org/inspect-js/has-proto.svg +[deps-url]: https://david-dm.org/inspect-js/has-proto +[dev-deps-svg]: https://david-dm.org/inspect-js/has-proto/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/has-proto#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/has-proto.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/has-proto.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/has-proto.svg +[downloads-url]: https://npm-stat.com/charts.html?package=has-proto +[codecov-image]: https://codecov.io/gh/inspect-js/has-proto/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/has-proto/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/has-proto +[actions-url]: https://github.com/inspect-js/has-proto/actions diff --git a/project starter code/node_modules/has-proto/index.d.ts b/project starter code/node_modules/has-proto/index.d.ts new file mode 100644 index 00000000..cfed6951 --- /dev/null +++ b/project starter code/node_modules/has-proto/index.d.ts @@ -0,0 +1,3 @@ +declare function hasProto(): boolean; + +export = hasProto; \ No newline at end of file diff --git a/project starter code/node_modules/has-proto/index.js b/project starter code/node_modules/has-proto/index.js new file mode 100644 index 00000000..d3c8a0af --- /dev/null +++ b/project starter code/node_modules/has-proto/index.js @@ -0,0 +1,15 @@ +'use strict'; + +var test = { + __proto__: null, + foo: {} +}; + +var $Object = Object; + +/** @type {import('.')} */ +module.exports = function hasProto() { + // @ts-expect-error: TS errors on an inherited property for some reason + return { __proto__: test }.foo === test.foo + && !(test instanceof $Object); +}; diff --git a/project starter code/node_modules/has-proto/package.json b/project starter code/node_modules/has-proto/package.json new file mode 100644 index 00000000..9d37e4ed --- /dev/null +++ b/project starter code/node_modules/has-proto/package.json @@ -0,0 +1,78 @@ +{ + "name": "has-proto", + "version": "1.0.3", + "description": "Does this environment have the ability to get the [[Prototype]] of an object on creation with `__proto__`?", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -p .", + "pretest": "npm run lint", + "tests-only": "tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/has-proto.git" + }, + "keywords": [ + "prototype", + "proto", + "set", + "get", + "__proto__", + "getPrototypeOf", + "setPrototypeOf", + "has" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/has-proto/issues" + }, + "homepage": "https://github.com/inspect-js/has-proto#readme", + "testling": { + "files": "test/index.js" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.1.0", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.5", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + } +} diff --git a/project starter code/node_modules/has-proto/test/index.js b/project starter code/node_modules/has-proto/test/index.js new file mode 100644 index 00000000..5da1a3aa --- /dev/null +++ b/project starter code/node_modules/has-proto/test/index.js @@ -0,0 +1,19 @@ +'use strict'; + +var test = require('tape'); +var hasProto = require('../'); + +test('hasProto', function (t) { + var result = hasProto(); + t.equal(typeof result, 'boolean', 'returns a boolean (' + result + ')'); + + var obj = { __proto__: null }; + if (result) { + t.notOk('toString' in obj, 'null object lacks toString'); + } else { + t.ok('toString' in obj, 'without proto, null object has toString'); + t.equal(obj.__proto__, null); // eslint-disable-line no-proto + } + + t.end(); +}); diff --git a/project starter code/node_modules/has-proto/tsconfig.json b/project starter code/node_modules/has-proto/tsconfig.json new file mode 100644 index 00000000..2002ce5a --- /dev/null +++ b/project starter code/node_modules/has-proto/tsconfig.json @@ -0,0 +1,49 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + + /* Language and Environment */ + "target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + "typeRoots": ["types"], /* Specify multiple folders that act like './node_modules/@types'. */ + "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + "maxNodeModuleJsDepth": 0, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ + "noEmit": true, /* Disable emitting files from a compilation. */ + + /* Interop Constraints */ + "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + + /* Completeness */ + //"skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "exclude": [ + "coverage" + ] +} diff --git a/project starter code/node_modules/has/LICENSE-MIT b/project starter code/node_modules/has/LICENSE-MIT deleted file mode 100644 index ae7014d3..00000000 --- a/project starter code/node_modules/has/LICENSE-MIT +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2013 Thiago de Arruda - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/project starter code/node_modules/has/README.md b/project starter code/node_modules/has/README.md deleted file mode 100644 index 635e3a4b..00000000 --- a/project starter code/node_modules/has/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# has - -> Object.prototype.hasOwnProperty.call shortcut - -## Installation - -```sh -npm install --save has -``` - -## Usage - -```js -var has = require('has'); - -has({}, 'hasOwnProperty'); // false -has(Object.prototype, 'hasOwnProperty'); // true -``` diff --git a/project starter code/node_modules/has/package.json b/project starter code/node_modules/has/package.json deleted file mode 100644 index 7c4592f1..00000000 --- a/project starter code/node_modules/has/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "has", - "description": "Object.prototype.hasOwnProperty.call shortcut", - "version": "1.0.3", - "homepage": "https://github.com/tarruda/has", - "author": { - "name": "Thiago de Arruda", - "email": "tpadilha84@gmail.com" - }, - "contributors": [ - { - "name": "Jordan Harband", - "email": "ljharb@gmail.com", - "url": "http://ljharb.codes" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/tarruda/has.git" - }, - "bugs": { - "url": "https://github.com/tarruda/has/issues" - }, - "license": "MIT", - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/tarruda/has/blob/master/LICENSE-MIT" - } - ], - "main": "./src", - "dependencies": { - "function-bind": "^1.1.1" - }, - "devDependencies": { - "@ljharb/eslint-config": "^12.2.1", - "eslint": "^4.19.1", - "tape": "^4.9.0" - }, - "engines": { - "node": ">= 0.4.0" - }, - "scripts": { - "lint": "eslint .", - "pretest": "npm run lint", - "test": "tape test" - } -} diff --git a/project starter code/node_modules/has/src/index.js b/project starter code/node_modules/has/src/index.js deleted file mode 100644 index dd92dd90..00000000 --- a/project starter code/node_modules/has/src/index.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -var bind = require('function-bind'); - -module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); diff --git a/project starter code/node_modules/has/test/index.js b/project starter code/node_modules/has/test/index.js deleted file mode 100644 index 43d480b2..00000000 --- a/project starter code/node_modules/has/test/index.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -var test = require('tape'); -var has = require('../'); - -test('has', function (t) { - t.equal(has({}, 'hasOwnProperty'), false, 'object literal does not have own property "hasOwnProperty"'); - t.equal(has(Object.prototype, 'hasOwnProperty'), true, 'Object.prototype has own property "hasOwnProperty"'); - t.end(); -}); diff --git a/project starter code/node_modules/hasown/.eslintrc b/project starter code/node_modules/hasown/.eslintrc new file mode 100644 index 00000000..3b5d9e90 --- /dev/null +++ b/project starter code/node_modules/hasown/.eslintrc @@ -0,0 +1,5 @@ +{ + "root": true, + + "extends": "@ljharb", +} diff --git a/project starter code/node_modules/hasown/.github/FUNDING.yml b/project starter code/node_modules/hasown/.github/FUNDING.yml new file mode 100644 index 00000000..d68c8b71 --- /dev/null +++ b/project starter code/node_modules/hasown/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/hasown +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with a single custom sponsorship URL diff --git a/project starter code/node_modules/hasown/.nycrc b/project starter code/node_modules/hasown/.nycrc new file mode 100644 index 00000000..1826526e --- /dev/null +++ b/project starter code/node_modules/hasown/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/project starter code/node_modules/hasown/CHANGELOG.md b/project starter code/node_modules/hasown/CHANGELOG.md new file mode 100644 index 00000000..2b0a980f --- /dev/null +++ b/project starter code/node_modules/hasown/CHANGELOG.md @@ -0,0 +1,40 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v2.0.2](https://github.com/inspect-js/hasOwn/compare/v2.0.1...v2.0.2) - 2024-03-10 + +### Commits + +- [types] use shared config [`68e9d4d`](https://github.com/inspect-js/hasOwn/commit/68e9d4dab6facb4f05f02c6baea94a3f2a4e44b2) +- [actions] remove redundant finisher; use reusable workflow [`241a68e`](https://github.com/inspect-js/hasOwn/commit/241a68e13ea1fe52bec5ba7f74144befc31fae7b) +- [Tests] increase coverage [`4125c0d`](https://github.com/inspect-js/hasOwn/commit/4125c0d6121db56ae30e38346dfb0c000b04f0a7) +- [Tests] skip `npm ls` in old node due to TS [`01b9282`](https://github.com/inspect-js/hasOwn/commit/01b92822f9971dea031eafdd14767df41d61c202) +- [types] improve predicate type [`d340f85`](https://github.com/inspect-js/hasOwn/commit/d340f85ce02e286ef61096cbbb6697081d40a12b) +- [Dev Deps] update `tape` [`70089fc`](https://github.com/inspect-js/hasOwn/commit/70089fcf544e64acc024cbe60f5a9b00acad86de) +- [Tests] use `@arethetypeswrong/cli` [`50b272c`](https://github.com/inspect-js/hasOwn/commit/50b272c829f40d053a3dd91c9796e0ac0b2af084) + +## [v2.0.1](https://github.com/inspect-js/hasOwn/compare/v2.0.0...v2.0.1) - 2024-02-10 + +### Commits + +- [types] use a handwritten d.ts file; fix exported type [`012b989`](https://github.com/inspect-js/hasOwn/commit/012b9898ccf91dc441e2ebf594ff70270a5fda58) +- [Dev Deps] update `@types/function-bind`, `@types/mock-property`, `@types/tape`, `aud`, `mock-property`, `npmignore`, `tape`, `typescript` [`977a56f`](https://github.com/inspect-js/hasOwn/commit/977a56f51a1f8b20566f3c471612137894644025) +- [meta] add `sideEffects` flag [`3a60b7b`](https://github.com/inspect-js/hasOwn/commit/3a60b7bf42fccd8c605e5f145a6fcc83b13cb46f) + +## [v2.0.0](https://github.com/inspect-js/hasOwn/compare/v1.0.1...v2.0.0) - 2023-10-19 + +### Commits + +- revamped implementation, tests, readme [`72bf8b3`](https://github.com/inspect-js/hasOwn/commit/72bf8b338e77a638f0a290c63ffaed18339c36b4) +- [meta] revamp package.json [`079775f`](https://github.com/inspect-js/hasOwn/commit/079775fb1ec72c1c6334069593617a0be3847458) +- Only apps should have lockfiles [`6640e23`](https://github.com/inspect-js/hasOwn/commit/6640e233d1bb8b65260880f90787637db157d215) + +## v1.0.1 - 2023-10-10 + +### Commits + +- Initial commit [`8dbfde6`](https://github.com/inspect-js/hasOwn/commit/8dbfde6e8fb0ebb076fab38d138f2984eb340a62) diff --git a/project starter code/node_modules/hasown/LICENSE b/project starter code/node_modules/hasown/LICENSE new file mode 100644 index 00000000..03149290 --- /dev/null +++ b/project starter code/node_modules/hasown/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Jordan Harband and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/project starter code/node_modules/hasown/README.md b/project starter code/node_modules/hasown/README.md new file mode 100644 index 00000000..f759b8a8 --- /dev/null +++ b/project starter code/node_modules/hasown/README.md @@ -0,0 +1,40 @@ +# hasown [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +A robust, ES3 compatible, "has own property" predicate. + +## Example + +```js +const assert = require('assert'); +const hasOwn = require('hasown'); + +assert.equal(hasOwn({}, 'toString'), false); +assert.equal(hasOwn([], 'length'), true); +assert.equal(hasOwn({ a: 42 }, 'a'), true); +``` + +## Tests +Simply clone the repo, `npm install`, and run `npm test` + +[package-url]: https://npmjs.org/package/hasown +[npm-version-svg]: https://versionbadg.es/inspect-js/hasown.svg +[deps-svg]: https://david-dm.org/inspect-js/hasOwn.svg +[deps-url]: https://david-dm.org/inspect-js/hasOwn +[dev-deps-svg]: https://david-dm.org/inspect-js/hasOwn/dev-status.svg +[dev-deps-url]: https://david-dm.org/inspect-js/hasOwn#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/hasown.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/hasown.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/hasown.svg +[downloads-url]: https://npm-stat.com/charts.html?package=hasown +[codecov-image]: https://codecov.io/gh/inspect-js/hasOwn/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/hasOwn/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/hasOwn +[actions-url]: https://github.com/inspect-js/hasOwn/actions diff --git a/project starter code/node_modules/hasown/index.d.ts b/project starter code/node_modules/hasown/index.d.ts new file mode 100644 index 00000000..aafdf3b2 --- /dev/null +++ b/project starter code/node_modules/hasown/index.d.ts @@ -0,0 +1,3 @@ +declare function hasOwn(o: O, p: K): o is O & Record; + +export = hasOwn; diff --git a/project starter code/node_modules/hasown/index.js b/project starter code/node_modules/hasown/index.js new file mode 100644 index 00000000..34e60591 --- /dev/null +++ b/project starter code/node_modules/hasown/index.js @@ -0,0 +1,8 @@ +'use strict'; + +var call = Function.prototype.call; +var $hasOwn = Object.prototype.hasOwnProperty; +var bind = require('function-bind'); + +/** @type {import('.')} */ +module.exports = bind.call(call, $hasOwn); diff --git a/project starter code/node_modules/hasown/package.json b/project starter code/node_modules/hasown/package.json new file mode 100644 index 00000000..8502e13d --- /dev/null +++ b/project starter code/node_modules/hasown/package.json @@ -0,0 +1,92 @@ +{ + "name": "hasown", + "version": "2.0.2", + "description": "A robust, ES3 compatible, \"has own property\" predicate.", + "main": "index.js", + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "types": "index.d.ts", + "sideEffects": false, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "npm run tsc", + "pretest": "npm run lint", + "tsc": "tsc -p .", + "posttsc": "attw -P", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/hasOwn.git" + }, + "keywords": [ + "has", + "hasOwnProperty", + "hasOwn", + "has-own", + "own", + "has", + "property", + "in", + "javascript", + "ecmascript" + ], + "author": "Jordan Harband ", + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/hasOwn/issues" + }, + "homepage": "https://github.com/inspect-js/hasOwn#readme", + "dependencies": { + "function-bind": "^1.1.2" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.15.1", + "@ljharb/eslint-config": "^21.1.0", + "@ljharb/tsconfig": "^0.2.0", + "@types/function-bind": "^1.1.10", + "@types/mock-property": "^1.0.2", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "in-publish": "^2.0.1", + "mock-property": "^1.0.3", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.5", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "testling": { + "files": "test/index.js" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "test" + ] + } +} diff --git a/project starter code/node_modules/hasown/tsconfig.json b/project starter code/node_modules/hasown/tsconfig.json new file mode 100644 index 00000000..0930c565 --- /dev/null +++ b/project starter code/node_modules/hasown/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "@ljharb/tsconfig", + "exclude": [ + "coverage", + ], +} diff --git a/project starter code/node_modules/ignore-by-default/LICENSE b/project starter code/node_modules/ignore-by-default/LICENSE new file mode 100644 index 00000000..ee1e3678 --- /dev/null +++ b/project starter code/node_modules/ignore-by-default/LICENSE @@ -0,0 +1,14 @@ +ISC License (ISC) +Copyright (c) 2016, Mark Wubben + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE. diff --git a/project starter code/node_modules/ignore-by-default/README.md b/project starter code/node_modules/ignore-by-default/README.md new file mode 100644 index 00000000..ee771911 --- /dev/null +++ b/project starter code/node_modules/ignore-by-default/README.md @@ -0,0 +1,26 @@ +# ignore-by-default + +This is a package aimed at Node.js development tools. It provides a list of +directories that should probably be ignored by such tools, e.g. when watching +for file changes. + +It's used by [AVA](https://www.npmjs.com/package/ava) and +[nodemon](https://www.npmjs.com/package/nodemon). + +[Please contribute!](./CONTRIBUTING.md) + +## Installation + +``` +npm install --save ignore-by-default +``` + +## Usage + +The `ignore-by-default` module exports a `directories()` function, which will +return an array of directory names. These are the ones you should ignore. + +```js +// ['.git', '.sass_cache', …] +var ignoredDirectories = require('ignore-by-default').directories() +``` diff --git a/project starter code/node_modules/ignore-by-default/index.js b/project starter code/node_modules/ignore-by-default/index.js new file mode 100644 index 00000000..c65857da --- /dev/null +++ b/project starter code/node_modules/ignore-by-default/index.js @@ -0,0 +1,12 @@ +'use strict' + +exports.directories = function () { + return [ + '.git', // Git repository files, see + '.nyc_output', // Temporary directory where nyc stores coverage data, see + '.sass-cache', // Cache folder for node-sass, see + 'bower_components', // Where Bower packages are installed, see + 'coverage', // Standard output directory for code coverage reports, see + 'node_modules' // Where Node modules are installed, see + ] +} diff --git a/project starter code/node_modules/ignore-by-default/package.json b/project starter code/node_modules/ignore-by-default/package.json new file mode 100644 index 00000000..38e0d2b4 --- /dev/null +++ b/project starter code/node_modules/ignore-by-default/package.json @@ -0,0 +1,34 @@ +{ + "name": "ignore-by-default", + "version": "1.0.1", + "description": "A list of directories you should ignore by default", + "main": "index.js", + "files": [ + "index.js" + ], + "scripts": { + "test": "standard && node test.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/novemberborn/ignore-by-default.git" + }, + "keywords": [ + "ignore", + "chokidar", + "watcher", + "exclude", + "glob", + "pattern" + ], + "author": "Mark Wubben (https://novemberborn.net/)", + "license": "ISC", + "bugs": { + "url": "https://github.com/novemberborn/ignore-by-default/issues" + }, + "homepage": "https://github.com/novemberborn/ignore-by-default#readme", + "devDependencies": { + "figures": "^1.4.0", + "standard": "^6.0.4" + } +} diff --git a/project starter code/node_modules/is-binary-path/index.d.ts b/project starter code/node_modules/is-binary-path/index.d.ts new file mode 100644 index 00000000..19dcd432 --- /dev/null +++ b/project starter code/node_modules/is-binary-path/index.d.ts @@ -0,0 +1,17 @@ +/** +Check if a file path is a binary file. + +@example +``` +import isBinaryPath = require('is-binary-path'); + +isBinaryPath('source/unicorn.png'); +//=> true + +isBinaryPath('source/unicorn.txt'); +//=> false +``` +*/ +declare function isBinaryPath(filePath: string): boolean; + +export = isBinaryPath; diff --git a/project starter code/node_modules/is-binary-path/index.js b/project starter code/node_modules/is-binary-path/index.js new file mode 100644 index 00000000..ef7548c8 --- /dev/null +++ b/project starter code/node_modules/is-binary-path/index.js @@ -0,0 +1,7 @@ +'use strict'; +const path = require('path'); +const binaryExtensions = require('binary-extensions'); + +const extensions = new Set(binaryExtensions); + +module.exports = filePath => extensions.has(path.extname(filePath).slice(1).toLowerCase()); diff --git a/project starter code/node_modules/is-binary-path/license b/project starter code/node_modules/is-binary-path/license new file mode 100644 index 00000000..401b1c73 --- /dev/null +++ b/project starter code/node_modules/is-binary-path/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2019 Sindre Sorhus (https://sindresorhus.com), Paul Miller (https://paulmillr.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/project starter code/node_modules/is-binary-path/package.json b/project starter code/node_modules/is-binary-path/package.json new file mode 100644 index 00000000..a8d005ae --- /dev/null +++ b/project starter code/node_modules/is-binary-path/package.json @@ -0,0 +1,40 @@ +{ + "name": "is-binary-path", + "version": "2.1.0", + "description": "Check if a file path is a binary file", + "license": "MIT", + "repository": "sindresorhus/is-binary-path", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "binary", + "extensions", + "extension", + "file", + "path", + "check", + "detect", + "is" + ], + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/project starter code/node_modules/is-binary-path/readme.md b/project starter code/node_modules/is-binary-path/readme.md new file mode 100644 index 00000000..b4ab0251 --- /dev/null +++ b/project starter code/node_modules/is-binary-path/readme.md @@ -0,0 +1,34 @@ +# is-binary-path [![Build Status](https://travis-ci.org/sindresorhus/is-binary-path.svg?branch=master)](https://travis-ci.org/sindresorhus/is-binary-path) + +> Check if a file path is a binary file + + +## Install + +``` +$ npm install is-binary-path +``` + + +## Usage + +```js +const isBinaryPath = require('is-binary-path'); + +isBinaryPath('source/unicorn.png'); +//=> true + +isBinaryPath('source/unicorn.txt'); +//=> false +``` + + +## Related + +- [binary-extensions](https://github.com/sindresorhus/binary-extensions) - List of binary file extensions +- [is-text-path](https://github.com/sindresorhus/is-text-path) - Check if a filepath is a text file + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com), [Paul Miller](https://paulmillr.com) diff --git a/project starter code/node_modules/is-extglob/LICENSE b/project starter code/node_modules/is-extglob/LICENSE new file mode 100644 index 00000000..842218cf --- /dev/null +++ b/project starter code/node_modules/is-extglob/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2016, Jon Schlinkert + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/project starter code/node_modules/is-extglob/README.md b/project starter code/node_modules/is-extglob/README.md new file mode 100644 index 00000000..0416af5c --- /dev/null +++ b/project starter code/node_modules/is-extglob/README.md @@ -0,0 +1,107 @@ +# is-extglob [![NPM version](https://img.shields.io/npm/v/is-extglob.svg?style=flat)](https://www.npmjs.com/package/is-extglob) [![NPM downloads](https://img.shields.io/npm/dm/is-extglob.svg?style=flat)](https://npmjs.org/package/is-extglob) [![Build Status](https://img.shields.io/travis/jonschlinkert/is-extglob.svg?style=flat)](https://travis-ci.org/jonschlinkert/is-extglob) + +> Returns true if a string has an extglob. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save is-extglob +``` + +## Usage + +```js +var isExtglob = require('is-extglob'); +``` + +**True** + +```js +isExtglob('?(abc)'); +isExtglob('@(abc)'); +isExtglob('!(abc)'); +isExtglob('*(abc)'); +isExtglob('+(abc)'); +``` + +**False** + +Escaped extglobs: + +```js +isExtglob('\\?(abc)'); +isExtglob('\\@(abc)'); +isExtglob('\\!(abc)'); +isExtglob('\\*(abc)'); +isExtglob('\\+(abc)'); +``` + +Everything else... + +```js +isExtglob('foo.js'); +isExtglob('!foo.js'); +isExtglob('*.js'); +isExtglob('**/abc.js'); +isExtglob('abc/*.js'); +isExtglob('abc/(aaa|bbb).js'); +isExtglob('abc/[a-z].js'); +isExtglob('abc/{a,b}.js'); +isExtglob('abc/?.js'); +isExtglob('abc.js'); +isExtglob('abc/def/ghi.js'); +``` + +## History + +**v2.0** + +Adds support for escaping. Escaped exglobs no longer return true. + +## About + +### Related projects + +* [has-glob](https://www.npmjs.com/package/has-glob): Returns `true` if an array has a glob pattern. | [homepage](https://github.com/jonschlinkert/has-glob "Returns `true` if an array has a glob pattern.") +* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet") +* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/jonschlinkert/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Building docs + +_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_ + +To generate the readme and API documentation with [verb](https://github.com/verbose/verb): + +```sh +$ npm install -g verb verb-generate-readme && verb +``` + +### Running tests + +Install dev dependencies: + +```sh +$ npm install -d && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +### License + +Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT license](https://github.com/jonschlinkert/is-extglob/blob/master/LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.31, on October 12, 2016._ \ No newline at end of file diff --git a/project starter code/node_modules/is-extglob/index.js b/project starter code/node_modules/is-extglob/index.js new file mode 100644 index 00000000..c1d986fc --- /dev/null +++ b/project starter code/node_modules/is-extglob/index.js @@ -0,0 +1,20 @@ +/*! + * is-extglob + * + * Copyright (c) 2014-2016, Jon Schlinkert. + * Licensed under the MIT License. + */ + +module.exports = function isExtglob(str) { + if (typeof str !== 'string' || str === '') { + return false; + } + + var match; + while ((match = /(\\).|([@?!+*]\(.*\))/g.exec(str))) { + if (match[2]) return true; + str = str.slice(match.index + match[0].length); + } + + return false; +}; diff --git a/project starter code/node_modules/is-extglob/package.json b/project starter code/node_modules/is-extglob/package.json new file mode 100644 index 00000000..7a908369 --- /dev/null +++ b/project starter code/node_modules/is-extglob/package.json @@ -0,0 +1,69 @@ +{ + "name": "is-extglob", + "description": "Returns true if a string has an extglob.", + "version": "2.1.1", + "homepage": "https://github.com/jonschlinkert/is-extglob", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "repository": "jonschlinkert/is-extglob", + "bugs": { + "url": "https://github.com/jonschlinkert/is-extglob/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "devDependencies": { + "gulp-format-md": "^0.1.10", + "mocha": "^3.0.2" + }, + "keywords": [ + "bash", + "braces", + "check", + "exec", + "expression", + "extglob", + "glob", + "globbing", + "globstar", + "is", + "match", + "matches", + "pattern", + "regex", + "regular", + "string", + "test" + ], + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "has-glob", + "is-glob", + "micromatch" + ] + }, + "reflinks": [ + "verb", + "verb-generate-readme" + ], + "lint": { + "reflinks": true + } + } +} diff --git a/project starter code/node_modules/is-glob/LICENSE b/project starter code/node_modules/is-glob/LICENSE new file mode 100644 index 00000000..3f2eca18 --- /dev/null +++ b/project starter code/node_modules/is-glob/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/project starter code/node_modules/is-glob/README.md b/project starter code/node_modules/is-glob/README.md new file mode 100644 index 00000000..740724b2 --- /dev/null +++ b/project starter code/node_modules/is-glob/README.md @@ -0,0 +1,206 @@ +# is-glob [![NPM version](https://img.shields.io/npm/v/is-glob.svg?style=flat)](https://www.npmjs.com/package/is-glob) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-glob.svg?style=flat)](https://npmjs.org/package/is-glob) [![NPM total downloads](https://img.shields.io/npm/dt/is-glob.svg?style=flat)](https://npmjs.org/package/is-glob) [![Build Status](https://img.shields.io/github/workflow/status/micromatch/is-glob/dev)](https://github.com/micromatch/is-glob/actions) + +> Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save is-glob +``` + +You might also be interested in [is-valid-glob](https://github.com/jonschlinkert/is-valid-glob) and [has-glob](https://github.com/jonschlinkert/has-glob). + +## Usage + +```js +var isGlob = require('is-glob'); +``` + +### Default behavior + +**True** + +Patterns that have glob characters or regex patterns will return `true`: + +```js +isGlob('!foo.js'); +isGlob('*.js'); +isGlob('**/abc.js'); +isGlob('abc/*.js'); +isGlob('abc/(aaa|bbb).js'); +isGlob('abc/[a-z].js'); +isGlob('abc/{a,b}.js'); +//=> true +``` + +Extglobs + +```js +isGlob('abc/@(a).js'); +isGlob('abc/!(a).js'); +isGlob('abc/+(a).js'); +isGlob('abc/*(a).js'); +isGlob('abc/?(a).js'); +//=> true +``` + +**False** + +Escaped globs or extglobs return `false`: + +```js +isGlob('abc/\\@(a).js'); +isGlob('abc/\\!(a).js'); +isGlob('abc/\\+(a).js'); +isGlob('abc/\\*(a).js'); +isGlob('abc/\\?(a).js'); +isGlob('\\!foo.js'); +isGlob('\\*.js'); +isGlob('\\*\\*/abc.js'); +isGlob('abc/\\*.js'); +isGlob('abc/\\(aaa|bbb).js'); +isGlob('abc/\\[a-z].js'); +isGlob('abc/\\{a,b}.js'); +//=> false +``` + +Patterns that do not have glob patterns return `false`: + +```js +isGlob('abc.js'); +isGlob('abc/def/ghi.js'); +isGlob('foo.js'); +isGlob('abc/@.js'); +isGlob('abc/+.js'); +isGlob('abc/?.js'); +isGlob(); +isGlob(null); +//=> false +``` + +Arrays are also `false` (If you want to check if an array has a glob pattern, use [has-glob](https://github.com/jonschlinkert/has-glob)): + +```js +isGlob(['**/*.js']); +isGlob(['foo.js']); +//=> false +``` + +### Option strict + +When `options.strict === false` the behavior is less strict in determining if a pattern is a glob. Meaning that +some patterns that would return `false` may return `true`. This is done so that matching libraries like [micromatch](https://github.com/micromatch/micromatch) have a chance at determining if the pattern is a glob or not. + +**True** + +Patterns that have glob characters or regex patterns will return `true`: + +```js +isGlob('!foo.js', {strict: false}); +isGlob('*.js', {strict: false}); +isGlob('**/abc.js', {strict: false}); +isGlob('abc/*.js', {strict: false}); +isGlob('abc/(aaa|bbb).js', {strict: false}); +isGlob('abc/[a-z].js', {strict: false}); +isGlob('abc/{a,b}.js', {strict: false}); +//=> true +``` + +Extglobs + +```js +isGlob('abc/@(a).js', {strict: false}); +isGlob('abc/!(a).js', {strict: false}); +isGlob('abc/+(a).js', {strict: false}); +isGlob('abc/*(a).js', {strict: false}); +isGlob('abc/?(a).js', {strict: false}); +//=> true +``` + +**False** + +Escaped globs or extglobs return `false`: + +```js +isGlob('\\!foo.js', {strict: false}); +isGlob('\\*.js', {strict: false}); +isGlob('\\*\\*/abc.js', {strict: false}); +isGlob('abc/\\*.js', {strict: false}); +isGlob('abc/\\(aaa|bbb).js', {strict: false}); +isGlob('abc/\\[a-z].js', {strict: false}); +isGlob('abc/\\{a,b}.js', {strict: false}); +//=> false +``` + +## About + +
+Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
+ +
+Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
+ +
+Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
+ +### Related projects + +You might also be interested in these projects: + +* [assemble](https://www.npmjs.com/package/assemble): Get the rocks out of your socks! Assemble makes you fast at creating web projects… [more](https://github.com/assemble/assemble) | [homepage](https://github.com/assemble/assemble "Get the rocks out of your socks! Assemble makes you fast at creating web projects. Assemble is used by thousands of projects for rapid prototyping, creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, building websit") +* [base](https://www.npmjs.com/package/base): Framework for rapidly creating high quality, server-side node.js applications, using plugins like building blocks | [homepage](https://github.com/node-base/base "Framework for rapidly creating high quality, server-side node.js applications, using plugins like building blocks") +* [update](https://www.npmjs.com/package/update): Be scalable! Update is a new, open source developer framework and CLI for automating updates… [more](https://github.com/update/update) | [homepage](https://github.com/update/update "Be scalable! Update is a new, open source developer framework and CLI for automating updates of any kind in code projects.") +* [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://github.com/verbose/verb) | [homepage](https://github.com/verbose/verb "Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 47 | [jonschlinkert](https://github.com/jonschlinkert) | +| 5 | [doowb](https://github.com/doowb) | +| 1 | [phated](https://github.com/phated) | +| 1 | [danhper](https://github.com/danhper) | +| 1 | [paulmillr](https://github.com/paulmillr) | + +### Author + +**Jon Schlinkert** + +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) + +### License + +Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on March 27, 2019._ \ No newline at end of file diff --git a/project starter code/node_modules/is-glob/index.js b/project starter code/node_modules/is-glob/index.js new file mode 100644 index 00000000..620f563e --- /dev/null +++ b/project starter code/node_modules/is-glob/index.js @@ -0,0 +1,150 @@ +/*! + * is-glob + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +var isExtglob = require('is-extglob'); +var chars = { '{': '}', '(': ')', '[': ']'}; +var strictCheck = function(str) { + if (str[0] === '!') { + return true; + } + var index = 0; + var pipeIndex = -2; + var closeSquareIndex = -2; + var closeCurlyIndex = -2; + var closeParenIndex = -2; + var backSlashIndex = -2; + while (index < str.length) { + if (str[index] === '*') { + return true; + } + + if (str[index + 1] === '?' && /[\].+)]/.test(str[index])) { + return true; + } + + if (closeSquareIndex !== -1 && str[index] === '[' && str[index + 1] !== ']') { + if (closeSquareIndex < index) { + closeSquareIndex = str.indexOf(']', index); + } + if (closeSquareIndex > index) { + if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { + return true; + } + backSlashIndex = str.indexOf('\\', index); + if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) { + return true; + } + } + } + + if (closeCurlyIndex !== -1 && str[index] === '{' && str[index + 1] !== '}') { + closeCurlyIndex = str.indexOf('}', index); + if (closeCurlyIndex > index) { + backSlashIndex = str.indexOf('\\', index); + if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) { + return true; + } + } + } + + if (closeParenIndex !== -1 && str[index] === '(' && str[index + 1] === '?' && /[:!=]/.test(str[index + 2]) && str[index + 3] !== ')') { + closeParenIndex = str.indexOf(')', index); + if (closeParenIndex > index) { + backSlashIndex = str.indexOf('\\', index); + if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { + return true; + } + } + } + + if (pipeIndex !== -1 && str[index] === '(' && str[index + 1] !== '|') { + if (pipeIndex < index) { + pipeIndex = str.indexOf('|', index); + } + if (pipeIndex !== -1 && str[pipeIndex + 1] !== ')') { + closeParenIndex = str.indexOf(')', pipeIndex); + if (closeParenIndex > pipeIndex) { + backSlashIndex = str.indexOf('\\', pipeIndex); + if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) { + return true; + } + } + } + } + + if (str[index] === '\\') { + var open = str[index + 1]; + index += 2; + var close = chars[open]; + + if (close) { + var n = str.indexOf(close, index); + if (n !== -1) { + index = n + 1; + } + } + + if (str[index] === '!') { + return true; + } + } else { + index++; + } + } + return false; +}; + +var relaxedCheck = function(str) { + if (str[0] === '!') { + return true; + } + var index = 0; + while (index < str.length) { + if (/[*?{}()[\]]/.test(str[index])) { + return true; + } + + if (str[index] === '\\') { + var open = str[index + 1]; + index += 2; + var close = chars[open]; + + if (close) { + var n = str.indexOf(close, index); + if (n !== -1) { + index = n + 1; + } + } + + if (str[index] === '!') { + return true; + } + } else { + index++; + } + } + return false; +}; + +module.exports = function isGlob(str, options) { + if (typeof str !== 'string' || str === '') { + return false; + } + + if (isExtglob(str)) { + return true; + } + + var check = strictCheck; + + // optionally relax check + if (options && options.strict === false) { + check = relaxedCheck; + } + + return check(str); +}; diff --git a/project starter code/node_modules/is-glob/package.json b/project starter code/node_modules/is-glob/package.json new file mode 100644 index 00000000..858af037 --- /dev/null +++ b/project starter code/node_modules/is-glob/package.json @@ -0,0 +1,81 @@ +{ + "name": "is-glob", + "description": "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a better user experience.", + "version": "4.0.3", + "homepage": "https://github.com/micromatch/is-glob", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "Brian Woodward (https://twitter.com/doowb)", + "Daniel Perez (https://tuvistavie.com)", + "Jon Schlinkert (http://twitter.com/jonschlinkert)" + ], + "repository": "micromatch/is-glob", + "bugs": { + "url": "https://github.com/micromatch/is-glob/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha && node benchmark.js" + }, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "devDependencies": { + "gulp-format-md": "^0.1.10", + "mocha": "^3.0.2" + }, + "keywords": [ + "bash", + "braces", + "check", + "exec", + "expression", + "extglob", + "glob", + "globbing", + "globstar", + "is", + "match", + "matches", + "pattern", + "regex", + "regular", + "string", + "test" + ], + "verb": { + "layout": "default", + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "assemble", + "base", + "update", + "verb" + ] + }, + "reflinks": [ + "assemble", + "bach", + "base", + "composer", + "gulp", + "has-glob", + "is-valid-glob", + "micromatch", + "npm", + "scaffold", + "verb", + "vinyl" + ] + } +} diff --git a/project starter code/node_modules/is-number/LICENSE b/project starter code/node_modules/is-number/LICENSE new file mode 100644 index 00000000..9af4a67d --- /dev/null +++ b/project starter code/node_modules/is-number/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-present, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/project starter code/node_modules/is-number/README.md b/project starter code/node_modules/is-number/README.md new file mode 100644 index 00000000..eb8149e8 --- /dev/null +++ b/project starter code/node_modules/is-number/README.md @@ -0,0 +1,187 @@ +# is-number [![NPM version](https://img.shields.io/npm/v/is-number.svg?style=flat)](https://www.npmjs.com/package/is-number) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-number.svg?style=flat)](https://npmjs.org/package/is-number) [![NPM total downloads](https://img.shields.io/npm/dt/is-number.svg?style=flat)](https://npmjs.org/package/is-number) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-number.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-number) + +> Returns true if the value is a finite number. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save is-number +``` + +## Why is this needed? + +In JavaScript, it's not always as straightforward as it should be to reliably check if a value is a number. It's common for devs to use `+`, `-`, or `Number()` to cast a string value to a number (for example, when values are returned from user input, regex matches, parsers, etc). But there are many non-intuitive edge cases that yield unexpected results: + +```js +console.log(+[]); //=> 0 +console.log(+''); //=> 0 +console.log(+' '); //=> 0 +console.log(typeof NaN); //=> 'number' +``` + +This library offers a performant way to smooth out edge cases like these. + +## Usage + +```js +const isNumber = require('is-number'); +``` + +See the [tests](./test.js) for more examples. + +### true + +```js +isNumber(5e3); // true +isNumber(0xff); // true +isNumber(-1.1); // true +isNumber(0); // true +isNumber(1); // true +isNumber(1.1); // true +isNumber(10); // true +isNumber(10.10); // true +isNumber(100); // true +isNumber('-1.1'); // true +isNumber('0'); // true +isNumber('012'); // true +isNumber('0xff'); // true +isNumber('1'); // true +isNumber('1.1'); // true +isNumber('10'); // true +isNumber('10.10'); // true +isNumber('100'); // true +isNumber('5e3'); // true +isNumber(parseInt('012')); // true +isNumber(parseFloat('012')); // true +``` + +### False + +Everything else is false, as you would expect: + +```js +isNumber(Infinity); // false +isNumber(NaN); // false +isNumber(null); // false +isNumber(undefined); // false +isNumber(''); // false +isNumber(' '); // false +isNumber('foo'); // false +isNumber([1]); // false +isNumber([]); // false +isNumber(function () {}); // false +isNumber({}); // false +``` + +## Release history + +### 7.0.0 + +* Refactor. Now uses `.isFinite` if it exists. +* Performance is about the same as v6.0 when the value is a string or number. But it's now 3x-4x faster when the value is not a string or number. + +### 6.0.0 + +* Optimizations, thanks to @benaadams. + +### 5.0.0 + +**Breaking changes** + +* removed support for `instanceof Number` and `instanceof String` + +## Benchmarks + +As with all benchmarks, take these with a grain of salt. See the [benchmarks](./benchmark/index.js) for more detail. + +``` +# all +v7.0 x 413,222 ops/sec ±2.02% (86 runs sampled) +v6.0 x 111,061 ops/sec ±1.29% (85 runs sampled) +parseFloat x 317,596 ops/sec ±1.36% (86 runs sampled) +fastest is 'v7.0' + +# string +v7.0 x 3,054,496 ops/sec ±1.05% (89 runs sampled) +v6.0 x 2,957,781 ops/sec ±0.98% (88 runs sampled) +parseFloat x 3,071,060 ops/sec ±1.13% (88 runs sampled) +fastest is 'parseFloat,v7.0' + +# number +v7.0 x 3,146,895 ops/sec ±0.89% (89 runs sampled) +v6.0 x 3,214,038 ops/sec ±1.07% (89 runs sampled) +parseFloat x 3,077,588 ops/sec ±1.07% (87 runs sampled) +fastest is 'v6.0' +``` + +## About + +
+Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
+ +
+Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
+ +
+Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
+ +### Related projects + +You might also be interested in these projects: + +* [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object "Returns true if an object was created by the `Object` constructor.") +* [is-primitive](https://www.npmjs.com/package/is-primitive): Returns `true` if the value is a primitive. | [homepage](https://github.com/jonschlinkert/is-primitive "Returns `true` if the value is a primitive. ") +* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.") +* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 49 | [jonschlinkert](https://github.com/jonschlinkert) | +| 5 | [charlike-old](https://github.com/charlike-old) | +| 1 | [benaadams](https://github.com/benaadams) | +| 1 | [realityking](https://github.com/realityking) | + +### Author + +**Jon Schlinkert** + +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on June 15, 2018._ \ No newline at end of file diff --git a/project starter code/node_modules/is-number/index.js b/project starter code/node_modules/is-number/index.js new file mode 100644 index 00000000..27f19b75 --- /dev/null +++ b/project starter code/node_modules/is-number/index.js @@ -0,0 +1,18 @@ +/*! + * is-number + * + * Copyright (c) 2014-present, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +module.exports = function(num) { + if (typeof num === 'number') { + return num - num === 0; + } + if (typeof num === 'string' && num.trim() !== '') { + return Number.isFinite ? Number.isFinite(+num) : isFinite(+num); + } + return false; +}; diff --git a/project starter code/node_modules/is-number/package.json b/project starter code/node_modules/is-number/package.json new file mode 100644 index 00000000..37150726 --- /dev/null +++ b/project starter code/node_modules/is-number/package.json @@ -0,0 +1,82 @@ +{ + "name": "is-number", + "description": "Returns true if a number or string value is a finite number. Useful for regex matches, parsing, user input, etc.", + "version": "7.0.0", + "homepage": "https://github.com/jonschlinkert/is-number", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "Jon Schlinkert (http://twitter.com/jonschlinkert)", + "Olsten Larck (https://i.am.charlike.online)", + "Rouven Weßling (www.rouvenwessling.de)" + ], + "repository": "jonschlinkert/is-number", + "bugs": { + "url": "https://github.com/jonschlinkert/is-number/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.12.0" + }, + "scripts": { + "test": "mocha" + }, + "devDependencies": { + "ansi": "^0.3.1", + "benchmark": "^2.1.4", + "gulp-format-md": "^1.0.0", + "mocha": "^3.5.3" + }, + "keywords": [ + "cast", + "check", + "coerce", + "coercion", + "finite", + "integer", + "is", + "isnan", + "is-nan", + "is-num", + "is-number", + "isnumber", + "isfinite", + "istype", + "kind", + "math", + "nan", + "num", + "number", + "numeric", + "parseFloat", + "parseInt", + "test", + "type", + "typeof", + "value" + ], + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "related": { + "list": [ + "is-plain-object", + "is-primitive", + "isobject", + "kind-of" + ] + }, + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + } + } +} diff --git a/project starter code/node_modules/isomorphic-fetch/.editorconfig b/project starter code/node_modules/isomorphic-fetch/.editorconfig new file mode 100644 index 00000000..7bfa0f2d --- /dev/null +++ b/project starter code/node_modules/isomorphic-fetch/.editorconfig @@ -0,0 +1,12 @@ +root=true + +[*] +end_of_line = lf +insert_final_newline = true + +[*.js] +indent_style = tab + +[*.json] +indent_style = space +indent_size = 2 diff --git a/project starter code/node_modules/isomorphic-fetch/.jshintrc b/project starter code/node_modules/isomorphic-fetch/.jshintrc new file mode 100644 index 00000000..3686db75 --- /dev/null +++ b/project starter code/node_modules/isomorphic-fetch/.jshintrc @@ -0,0 +1,5 @@ +{ + "node": true, + "browser": true, + "predef": ["describe", "it", "before"] +} diff --git a/project starter code/node_modules/isomorphic-fetch/.travis.yml b/project starter code/node_modules/isomorphic-fetch/.travis.yml new file mode 100644 index 00000000..6024a563 --- /dev/null +++ b/project starter code/node_modules/isomorphic-fetch/.travis.yml @@ -0,0 +1,4 @@ +sudo: false +language: node_js +node_js: + - 14 diff --git a/project starter code/node_modules/isomorphic-fetch/LICENSE b/project starter code/node_modules/isomorphic-fetch/LICENSE new file mode 100644 index 00000000..2385aa96 --- /dev/null +++ b/project starter code/node_modules/isomorphic-fetch/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Matt Andrews + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/project starter code/node_modules/isomorphic-fetch/README.md b/project starter code/node_modules/isomorphic-fetch/README.md new file mode 100644 index 00000000..8f7d690b --- /dev/null +++ b/project starter code/node_modules/isomorphic-fetch/README.md @@ -0,0 +1,57 @@ +isomorphic-fetch [![Build Status](https://travis-ci.org/matthew-andrews/isomorphic-fetch.svg?branch=master)](https://travis-ci.org/matthew-andrews/isomorphic-fetch) +================ + +Fetch for node and Browserify. Built on top of [GitHub's WHATWG Fetch polyfill](https://github.com/github/fetch). + +## Warnings + +- This adds `fetch` as a global so that its API is consistent between client and server. + +For [ease-of-maintenance and backward-compatibility reasons][why polyfill], this library will always be a polyfill. As a "safe" alternative, which does not modify the global, consider [fetch-ponyfill][]. + +[why polyfill]: https://github.com/matthew-andrews/isomorphic-fetch/issues/31#issuecomment-149668361 +[fetch-ponyfill]: https://github.com/qubyte/fetch-ponyfill + +## Why Use Isomorphic Fetch + +The Fetch API is currently [not implemented consistently](http://caniuse.com/#search=fetch) across browsers. This module will enable you to use `fetch` in your Node code in a cross-browser compliant fashion. The Fetch API is part of the Web platform API defined by the standards bodies WHATWG and W3C. + +## Installation + +### NPM + +```sh +npm install --save isomorphic-fetch +``` + +### Bower + +```sh +bower install --save isomorphic-fetch +``` + +## Usage + +```js +require('isomorphic-fetch'); + +fetch('//offline-news-api.herokuapp.com/stories') + .then(function(response) { + if (response.status >= 400) { + throw new Error("Bad response from server"); + } + return response.json(); + }) + .then(function(stories) { + console.log(stories); + }); +``` + +## License + +All open source code released by FT Labs is licenced under the MIT licence. Based on [the fine work by](https://github.com/github/fetch/pull/31) **[jxck](https://github.com/Jxck)**. + +## Alternatives + +- [cross-fetch](https://github.com/lquixada/cross-fetch#why-not-isomorphic-fetch) +- Using [node-fetch](https://github.com/node-fetch/node-fetch) and the [Fetch polyfill](https://github.com/github/fetch) directly (or from [polyfill.io](https://polyfill.io), or relying on [the browser's implementation of the Fetch API](https://caniuse.com/fetch)). diff --git a/project starter code/node_modules/isomorphic-fetch/bower.json b/project starter code/node_modules/isomorphic-fetch/bower.json new file mode 100644 index 00000000..599b3e52 --- /dev/null +++ b/project starter code/node_modules/isomorphic-fetch/bower.json @@ -0,0 +1,7 @@ +{ + "name": "isomorphic-fetch", + "main": ["fetch-bower.js"], + "dependencies": { + "fetch": "github/fetch#^3.4.1" + } +} diff --git a/project starter code/node_modules/isomorphic-fetch/fetch-bower.js b/project starter code/node_modules/isomorphic-fetch/fetch-bower.js new file mode 100644 index 00000000..557a2fe4 --- /dev/null +++ b/project starter code/node_modules/isomorphic-fetch/fetch-bower.js @@ -0,0 +1 @@ +module.exports = require('fetch'); diff --git a/project starter code/node_modules/isomorphic-fetch/fetch-npm-browserify.js b/project starter code/node_modules/isomorphic-fetch/fetch-npm-browserify.js new file mode 100644 index 00000000..7f16e231 --- /dev/null +++ b/project starter code/node_modules/isomorphic-fetch/fetch-npm-browserify.js @@ -0,0 +1,6 @@ +// the whatwg-fetch polyfill installs the fetch() function +// on the global object (window or self) +// +// Return that as the export for use in Webpack, Browserify etc. +require('whatwg-fetch'); +module.exports = self.fetch.bind(self); diff --git a/project starter code/node_modules/isomorphic-fetch/fetch-npm-node.js b/project starter code/node_modules/isomorphic-fetch/fetch-npm-node.js new file mode 100644 index 00000000..bbd3dd1d --- /dev/null +++ b/project starter code/node_modules/isomorphic-fetch/fetch-npm-node.js @@ -0,0 +1,16 @@ +"use strict"; + +var realFetch = require('node-fetch'); +module.exports = function(url, options) { + if (/^\/\//.test(url)) { + url = 'https:' + url; + } + return realFetch.call(this, url, options); +}; + +if (!global.fetch) { + global.fetch = module.exports; + global.Response = realFetch.Response; + global.Headers = realFetch.Headers; + global.Request = realFetch.Request; +} diff --git a/project starter code/node_modules/isomorphic-fetch/package.json b/project starter code/node_modules/isomorphic-fetch/package.json new file mode 100644 index 00000000..bb3215f2 --- /dev/null +++ b/project starter code/node_modules/isomorphic-fetch/package.json @@ -0,0 +1,32 @@ +{ + "name": "isomorphic-fetch", + "version": "3.0.0", + "description": "Isomorphic WHATWG Fetch API, for Node & Browserify", + "browser": "fetch-npm-browserify.js", + "main": "fetch-npm-node.js", + "scripts": { + "files": "find . -name '*.js' ! -path './node_modules/*' ! -path './bower_components/*'", + "test": "jshint `npm run -s files` && lintspaces -i js-comments -e .editorconfig `npm run -s files` && mocha" + }, + "repository": { + "type": "git", + "url": "https://github.com/matthew-andrews/isomorphic-fetch.git" + }, + "author": "Matt Andrews ", + "license": "MIT", + "bugs": { + "url": "https://github.com/matthew-andrews/isomorphic-fetch/issues" + }, + "homepage": "https://github.com/matthew-andrews/isomorphic-fetch/issues", + "dependencies": { + "node-fetch": "^2.6.1", + "whatwg-fetch": "^3.4.1" + }, + "devDependencies": { + "chai": "^4.2.0", + "jshint": "^2.5.11", + "lintspaces-cli": "^0.7.1", + "mocha": "^8.1.3", + "nock": "^13.0.4" + } +} diff --git a/project starter code/node_modules/isomorphic-fetch/test/api.test.js b/project starter code/node_modules/isomorphic-fetch/test/api.test.js new file mode 100644 index 00000000..5a34803e --- /dev/null +++ b/project starter code/node_modules/isomorphic-fetch/test/api.test.js @@ -0,0 +1,50 @@ +/*global fetch*/ +"use strict"; + +require('../fetch-npm-node'); +var expect = require('chai').expect; +var nock = require('nock'); +var good = 'hello world. 你好世界。'; +var bad = 'good bye cruel world. 再见残酷的世界。'; + +function responseToText(response) { + if (response.status >= 400) throw new Error("Bad server response"); + return response.text(); +} + +describe('fetch', function() { + + before(function() { + nock('https://mattandre.ws') + .get('/succeed.txt') + .reply(200, good); + nock('https://mattandre.ws') + .get('/fail.txt') + .reply(404, bad); + }); + + it('should be defined', function() { + expect(fetch).to.be.a('function'); + }); + + it('should facilitate the making of requests', function(done) { + fetch('//mattandre.ws/succeed.txt') + .then(responseToText) + .then(function(data) { + expect(data).to.equal(good); + done(); + }) + .catch(done); + }); + + it('should do the right thing with bad requests', function(done) { + fetch('//mattandre.ws/fail.txt') + .then(responseToText) + .catch(function(err) { + expect(err.toString()).to.equal("Error: Bad server response"); + done(); + }) + .catch(done); + }); + +}); diff --git a/project starter code/node_modules/jimp/CHANGELOG.md b/project starter code/node_modules/jimp/CHANGELOG.md deleted file mode 100644 index b719b4af..00000000 --- a/project starter code/node_modules/jimp/CHANGELOG.md +++ /dev/null @@ -1,113 +0,0 @@ -# v0.15.0 (Fri Aug 07 2020) - -#### 🚀 Enhancement - -- Remove 'browser' field from main jimp package's package.json. [#918](https://github.com/oliver-moran/jimp/pull/918) ([@Gustavo6046](https://github.com/Gustavo6046)) - -#### Authors: 1 - -- Gustavo Ramos Rehermann ([@Gustavo6046](https://github.com/Gustavo6046)) - ---- - -# v0.14.0 (Mon Jun 29 2020) - -#### 🚀 Enhancement - -- include Addition (Add) blending mode + Officially drop support for Node 8 [#904](https://github.com/oliver-moran/jimp/pull/904) ([@GlitchyPSIX](https://github.com/GlitchyPSIX)) - -#### Authors: 1 - -- GlitchyPSI ([@GlitchyPSIX](https://github.com/GlitchyPSIX)) - ---- - -# v0.13.0 (Fri Jun 05 2020) - -#### 🚀 Enhancement - -- Add single frame encoder for type-gif [#899](https://github.com/oliver-moran/jimp/pull/899) ([@jeffbseeking](https://github.com/jeffbseeking) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Jeff Bonnes ([@jeffbseeking](https://github.com/jeffbseeking)) - ---- - -# v0.11.0 (Fri May 15 2020) - -#### 🚀 Enhancement - -- Removed Core-JS as a dependency. [#882](https://github.com/oliver-moran/jimp/pull/882) ([@EricRabil](https://github.com/EricRabil)) - -#### Authors: 1 - -- Eric Rabil ([@EricRabil](https://github.com/EricRabil)) - ---- - -# v0.10.2 (Tue Apr 14 2020) - -#### 🐛 Bug Fix - -- Rewrite handling EXIF orientation — add tests, make it plugin-independent [#875](https://github.com/oliver-moran/jimp/pull/875) ([@skalee](https://github.com/skalee)) - -#### Authors: 1 - -- Sebastian Skałacki ([@skalee](https://github.com/skalee)) - ---- - -# v0.10.0 (Mon Mar 30 2020) - -#### 🚀 Enhancement - -- Properly split constructor and instance types [#867](https://github.com/oliver-moran/jimp/pull/867) ([@forivall](https://github.com/forivall)) - -#### Authors: 1 - -- Emily Marigold Klassen ([@forivall](https://github.com/forivall)) - ---- - -# v0.9.7 (Fri Mar 27 2020) - -#### 🐛 Bug Fix - -- Added missing plugins to the types [#863](https://github.com/oliver-moran/jimp/pull/863) ([@crutchcorn](https://github.com/crutchcorn)) - -#### Authors: 1 - -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) - ---- - -# v0.9.6 (Wed Mar 18 2020) - -#### 🐛 Bug Fix - -- upgrade auto [#860](https://github.com/oliver-moran/jimp/pull/860) ([@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### 🏠 Internal - -- Fix TypeScript error on 'next' [#858](https://github.com/oliver-moran/jimp/pull/858) ([@crutchcorn](https://github.com/crutchcorn)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) - ---- - -# v0.9.3 (Tue Nov 26 2019) - -#### 🐛 Bug Fix - -- `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` - - Fix regeneratorRuntime errors [#815](https://github.com/oliver-moran/jimp/pull/815) ([@crutchcorn](https://github.com/crutchcorn) [@hipstersmoothie](https://github.com/hipstersmoothie)) - -#### Authors: 2 - -- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) -- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) \ No newline at end of file diff --git a/project starter code/node_modules/jimp/README.md b/project starter code/node_modules/jimp/README.md index 720c7ed3..c05199e3 100644 --- a/project starter code/node_modules/jimp/README.md +++ b/project starter code/node_modules/jimp/README.md @@ -26,31 +26,31 @@ Supported types: Example usage (Promise will never resolve if callback is passed): ```js -var Jimp = require('jimp'); +var Jimp = require("jimp"); // open a file called "lenna.png" -Jimp.read('lenna.png', (err, lenna) => { +Jimp.read("lenna.png", (err, lenna) => { if (err) throw err; lenna .resize(256, 256) // resize .quality(60) // set JPEG quality .greyscale() // set greyscale - .write('lena-small-bw.jpg'); // save + .write("lena-small-bw.jpg"); // save }); ``` Using promises: ```js -Jimp.read('lenna.png') - .then(lenna => { +Jimp.read("lenna.png") + .then((lenna) => { return lenna .resize(256, 256) // resize .quality(60) // set JPEG quality .greyscale() // set greyscale - .write('lena-small-bw.jpg'); // save + .write("lena-small-bw.jpg"); // save }) - .catch(err => { + .catch((err) => { console.error(err); }); ``` @@ -60,7 +60,7 @@ Jimp.read('lenna.png') If you're using this library with TypeScript the method of importing slightly differs from JavaScript. Instead of using require, you must import it with ES6 default import scheme ```ts -import Jimp from 'jimp'; +import Jimp from "jimp"; ``` This requires setting the `allowSyntheticDefaultImports` compiler option to `true` in your `tsconfig` @@ -74,22 +74,7 @@ This requires setting the `allowSyntheticDefaultImports` compiler option to `tru If you're using a web bundles (webpack, rollup, parcel) you can benefit from using the `module` build of jimp. Using the module build will allow your bundler to understand your code better and exclude things you aren't using. ```js -import Jimp from 'jimp/es'; -``` - -### WebPack - -If you're using webpack you can set `process.browser` to true and your build of jimp will exclude certain parts, making it load faster. - -```js -{ - plugins: [ - new webpack.DefinePlugin({ - 'process.browser': 'true' - }), - ... - ], -} +import Jimp from "jimp/es"; ``` ## Basic usage @@ -97,35 +82,35 @@ If you're using webpack you can set `process.browser` to true and your build of The static `Jimp.read` method takes the path to a file, URL, dimensions, a Jimp instance or a buffer and returns a Promise: ```js -Jimp.read('./path/to/image.jpg') - .then(image => { +Jimp.read("./path/to/image.jpg") + .then((image) => { // Do stuff with the image. }) - .catch(err => { + .catch((err) => { // Handle an exception. }); -Jimp.read('http://www.example.com/path/to/lenna.jpg') - .then(image => { +Jimp.read("http://www.example.com/path/to/lenna.jpg") + .then((image) => { // Do stuff with the image. }) - .catch(err => { + .catch((err) => { // Handle an exception. }); Jimp.read(jimpInstance) - .then(image => { + .then((image) => { // Do stuff with the image. }) - .catch(err => { + .catch((err) => { // Handle an exception. }); Jimp.read(buffer) - .then(image => { + .then((image) => { // Do stuff with the image. }) - .catch(err => { + .catch((err) => { // Handle an exception. }); ``` @@ -146,7 +131,7 @@ Jimp.read({ }); ``` -Jimp uses [phin](https://github.com/ethanent/phin) as it's HTTP client. Phin uses [`http.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/http.html#http_http_request_options_callback) or [`https.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/https.html#https_https_request_options_callback) methods for making HTTP requests. Phin parses a `url` with the `url.parse(...)` method and passes it with all the other parameters as an `options` to the [`http.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/http.html#http_http_request_options_callback) or [`https.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/https.html#https_https_request_options_callback) methods. +Jimp uses [phin](https://github.com/ethanent/phin) as its HTTP client. Phin uses [`http.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/http.html#http_http_request_options_callback) or [`https.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/https.html#https_https_request_options_callback) methods for making HTTP requests. Phin parses a `url` with the `url.parse(...)` method and passes it with all the other parameters as an `options` to the [`http.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/http.html#http_http_request_options_callback) or [`https.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/https.html#https_https_request_options_callback) methods. Briefly speaking, you can pass any options from [`http.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/http.html#http_http_request_options_callback), [`https.request(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/https.html#https_https_request_options_callback) or even [`tls.connect(options[, callback])`](https://nodejs.org/dist/latest-v8.x/docs/api/tls.html#tls_tls_connect_options_callback). @@ -162,9 +147,9 @@ To define a custom constructor provide a name for it, a function to call to dete ```js Jimp.appendConstructorOption( - 'Name of Option', - args => arg.hasSomeCustomThing, - function(resolve, reject, args) { + "Name of Option", + (args) => arg.hasSomeCustomThing, + function (resolve, reject, args) { this.bitmap = customParser(args); resolve(); } @@ -176,25 +161,25 @@ If you don't want to handle parsing the bitmap. For example if you want to do so Parse bitmap takes the raw image data in a Buffer, a path (optional), and a node style callback. ```js -Jimp.appendConstructorOption('Custom Url', options => options.url, function( - resolve, - reject, - options -) { - phin(options, (err, res) => { - if (err) { - return reject(err); - } - - this.parseBitmap(res.body, options.url, err => { +Jimp.appendConstructorOption( + "Custom Url", + (options) => options.url, + function (resolve, reject, options) { + phin(options, (err, res) => { if (err) { return reject(err); } - resolve(); + this.parseBitmap(res.body, options.url, (err) => { + if (err) { + return reject(err); + } + + resolve(); + }); }); - }); -}); + } +); ``` ### Methods @@ -226,7 +211,7 @@ image.convolute( kernel ); // applies a convolution kernel matrix to the /* Flip and rotate */ image.flip( horz, vert ); // flip the image horizontally or vertically image.mirror( horz, vert ); // an alias for flip -image.rotate( deg[, mode] ); // rotate the image clockwise by a number of degrees. Optionally, a resize mode can be passed. If `false` is passed as the second parameter, the image width and height will not be resized. +image.rotate( deg[, mode] ); // rotate the image counter-clockwise by a number of degrees. Optionally, a resize mode can be passed. If `false` is passed as the second parameter, the image width and height will not be resized. /* Colour */ image.brightness( val ); // adjust the brighness by a value -1 to +1 @@ -358,7 +343,7 @@ Jimp.BLEND_EXCLUSION; image.composite(srcImage, 100, 0, { mode: Jimp.BLEND_MULTIPLY, opacitySource: 0.5, - opacityDest: 0.9 + opacityDest: 0.9, }); ``` @@ -367,7 +352,7 @@ image.composite(srcImage, 100, 0, { Jimp supports basic typography using BMFont format (.fnt) even ones in different languages! Just find a bitmap font that is suitable [bitmap fonts](https://en.wikipedia.org/wiki/Bitmap_fonts): ```js -Jimp.loadFont(pathOrURL).then(font => { +Jimp.loadFont(pathOrURL).then((font) => { // load font from .fnt file image.print(font, x, y, message); // print a message on an image. message can be a any type image.print(font, x, y, message, maxWidth); // print a message on an image with text wrapped at maxWidth @@ -377,15 +362,15 @@ Jimp.loadFont(pathOrURL).then(font => { Alignment modes are supported by replacing the `str` argument with an object containing `text`, `alignmentX` and `alignmentY`. `alignmentX` defaults to `Jimp.HORIZONTAL_ALIGN_LEFT` and `alignmentY` defaults to `Jimp.VERTICAL_ALIGN_TOP`. ```js -Jimp.loadFont(pathOrURL).then(font => { +Jimp.loadFont(pathOrURL).then((font) => { image.print( font, x, y, { - text: 'Hello world!', + text: "Hello world!", alignmentX: Jimp.HORIZONTAL_ALIGN_CENTER, - alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE + alignmentY: Jimp.VERTICAL_ALIGN_MIDDLE, }, maxWidth, maxHeight @@ -419,8 +404,8 @@ Jimp.FONT_SANS_128_WHITE; // Open Sans, 128px, white These can be used as follows: ```js -Jimp.loadFont(Jimp.FONT_SANS_32_BLACK).then(font => { - image.print(font, 10, 10, 'Hello world!'); +Jimp.loadFont(Jimp.FONT_SANS_32_BLACK).then((font) => { + image.print(font, 10, 10, "Hello world!"); }); ``` @@ -429,8 +414,12 @@ Jimp.loadFont(Jimp.FONT_SANS_32_BLACK).then(font => { If you need to do calculations on where to place your text jimp provides two methods that measure how wide and how tall a piece of text will be. You can use these methods to lay out multiple pieces of text in relation to each other ```js -Jimp.measureText(Jimp.FONT_SANS_32_BLACK, 'Some string'); // width of text -Jimp.measureTextHeight(Jimp.FONT_SANS_32_BLACK, 'Some string', 100); // height of text +Jimp.measureText(await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK), "Some string"); // width of text +Jimp.measureTextHeight( + await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK), + "Some string", + 100 +); // height of text ``` #### Staggering Text @@ -438,15 +427,15 @@ Jimp.measureTextHeight(Jimp.FONT_SANS_32_BLACK, 'Some string', 100); // height o If you need to stagger text position along the x or y-axis the print method also returns the final coordinates as an argument to the callback. ```js -Jimp.loadFont(Jimp.FONT_SANS_32_BLACK).then(font => { +Jimp.loadFont(Jimp.FONT_SANS_32_BLACK).then((font) => { image.print( font, 10, 10, - 'Hello world that wraps!', + "Hello world that wraps!", 50, (err, image, { x, y }) => { - image.print(font, x, y + 20, 'More text on another line', 50); + image.print(font, x, y + 20, "More text on another line", 50); } ); }); @@ -456,7 +445,7 @@ Online tools are also available to convert TTF fonts to BMFont format. They can :star: [Littera](http://kvazars.com/littera/) -:star: [Hiero](https://github.com/libgdx/libgdx/wiki/Hiero) +:star: [Hiero](https://libgdx.com/wiki/tools/hiero) ## Writing to files and buffers @@ -472,9 +461,9 @@ image.writeAsync(path); // Returns Promise The original extension for an image (or "png") can accessed as using `image.getExtension()`. The following will save an image using its original format: ```js -var file = 'new_name.' + image.getExtension(); +var file = "new_name." + image.getExtension(); //or -var file = 'new_name'; // with no extension +var file = "new_name"; // with no extension image.write(file); ``` @@ -542,9 +531,9 @@ Jimp supports advanced colour manipulation using a single method as follows: ```js image.color([ - { apply: 'hue', params: [-90] }, - { apply: 'lighten', params: [50] }, - { apply: 'xor', params: ['#06D'] } + { apply: "hue", params: [-90] }, + { apply: "lighten", params: [50] }, + { apply: "xor", params: ["#06D"] }, ]); ``` @@ -575,7 +564,11 @@ Sum neighbor pixels weighted by the kernel matrix. You can find a nice explanati Implement emboss effect: ```js -image.convolute([[-2, -1, 0], [-1, 1, 1], [0, 1, 2]]); +image.convolute([ + [-2, -1, 0], + [-1, 1, 1], + [0, 1, 2], +]); ``` ### Low-level manipulation @@ -599,7 +592,7 @@ image.scan(x, y, w, h, f); // scan a given region of the bitmap and call the fun Example usage: ```js -image.scan(0, 0, image.bitmap.width, image.bitmap.height, function(x, y, idx) { +image.scan(0, 0, image.bitmap.width, image.bitmap.height, function (x, y, idx) { // x, y is the position of this pixel on the image // idx is the position start position of this rgba tuple in the bitmap Buffer // this is the image @@ -617,7 +610,7 @@ image.scan(0, 0, image.bitmap.width, image.bitmap.height, function(x, y, idx) { If you need to do something with the image at the end of the scan: ```js -image.scan(0, 0, image.bitmap.width, image.bitmap.height, function(x, y, idx) { +image.scan(0, 0, image.bitmap.width, image.bitmap.height, function (x, y, idx) { // do your stuff.. if (x == image.bitmap.width - 1 && y == image.bitmap.height - 1) { @@ -693,7 +686,7 @@ new Jimp(256, 256, 0xff0000ff, (err, image) => { Or you can use a css color format: ```js -new Jimp(256, 256, '#FF00FF', (err, image) => { +new Jimp(256, 256, "#FF00FF", (err, image) => { // this image is 256 x 256, every pixel is set to #FF00FF }); ``` @@ -766,21 +759,18 @@ Jimp.compareHashes(hash1, hash2); // same result as above Most instance methods can be chained together, for example as follows: ```js -Jimp.read('lenna.png').then(image => { - image - .greyscale() - .scale(0.5) - .write('lena-half-bw.png'); +Jimp.read("lenna.png").then((image) => { + image.greyscale().scale(0.5).write("lena-half-bw.png"); }); ``` Alternatively, methods can be passed Node-style callbacks: ```js -Jimp.read('lenna.png').then(image => { +Jimp.read("lenna.png").then((image) => { image.greyscale((err, image) => { image.scale(0.5, (err, image) => { - image.write('lena-half-bw.png'); + image.write("lena-half-bw.png"); }); }); }); diff --git a/project starter code/node_modules/jimp/browser/.editorconfig b/project starter code/node_modules/jimp/browser/.editorconfig deleted file mode 100644 index f394cdbf..00000000 --- a/project starter code/node_modules/jimp/browser/.editorconfig +++ /dev/null @@ -1,2 +0,0 @@ -# Exclude this directory -root = true \ No newline at end of file diff --git a/project starter code/node_modules/jimp/browser/README.md b/project starter code/node_modules/jimp/browser/README.md index c2537ea4..9cc92c47 100644 --- a/project starter code/node_modules/jimp/browser/README.md +++ b/project starter code/node_modules/jimp/browser/README.md @@ -7,22 +7,25 @@ Example usage: ```html ``` -See the [main documentation](https://github.com/oliver-moran/jimp) for the full API documenatinon. +See the [main documentation](https://github.com/jimp-dev/jimp) for the full API documenatinon. ## WebWorkers @@ -31,28 +34,28 @@ For better performance, it recommended that Jimp methods are run on a separate t ```js // index.html -var worker = new Worker('jimp-worker.js'); -worker.onmessage = function(e) { +var worker = new Worker("jimp-worker.js"); +worker.onmessage = function (e) { // append a new img element using the base 64 image - var img = document.createElement('img'); - img.setAttribute('src', e.data); + var img = document.createElement("img"); + img.setAttribute("src", e.data); document.body.appendChild(img); }; -worker.postMessage('lenna.png'); // message the worker thread +worker.postMessage("lenna.png"); // message the worker thread ``` ```js // jimp-worker.js -importScripts('jimp.min.js'); +importScripts("jimp.min.js"); -self.addEventListener('message', function(e) { - Jimp.read(e.data).then(function(lenna) { +self.addEventListener("message", function (e) { + Jimp.read(e.data).then(function (lenna) { lenna .resize(256, 256) // resize .quality(60) // set JPEG quality .greyscale() // set greyscale - .getBase64(Jimp.MIME_JPEG, function(err, src) { + .getBase64(Jimp.MIME_JPEG, function (err, src) { self.postMessage(src); // message the main thread }); }); diff --git a/project starter code/node_modules/jimp/browser/examples/example1.html b/project starter code/node_modules/jimp/browser/examples/example1.html index e454f454..ed0b301b 100644 --- a/project starter code/node_modules/jimp/browser/examples/example1.html +++ b/project starter code/node_modules/jimp/browser/examples/example1.html @@ -1,24 +1,25 @@ - - Jimp browser example 1 - - - -

Demonstrates loading a local file using Jimp on the main thread

- - - - + + Jimp browser example 1 + + +

Demonstrates loading a local file using Jimp on the main thread

+ + + diff --git a/project starter code/node_modules/jimp/browser/examples/example2.html b/project starter code/node_modules/jimp/browser/examples/example2.html index 53f7ae30..b2448a09 100644 --- a/project starter code/node_modules/jimp/browser/examples/example2.html +++ b/project starter code/node_modules/jimp/browser/examples/example2.html @@ -1,20 +1,20 @@ - - Jimp browser example 2 - - - -

Demonstrates loading a relative file using Jimp on a WebWorker thread

- - - + + Jimp browser example 2 + + +

+ Demonstrates loading a relative file using Jimp on a WebWorker thread +

+ + diff --git a/project starter code/node_modules/jimp/browser/examples/example3.html b/project starter code/node_modules/jimp/browser/examples/example3.html index 0018e1e1..eec88c48 100644 --- a/project starter code/node_modules/jimp/browser/examples/example3.html +++ b/project starter code/node_modules/jimp/browser/examples/example3.html @@ -1,35 +1,31 @@ - - Jimp browser example 3 - - - -

Demonstrates loading a local file using Jimp on a WebWorker thread

-

- - - + function readFileAndProcess(readfile) { + var reader = new FileReader(); + reader.addEventListener("load", function () { + var worker = new Worker("jimp-worker.js"); + worker.onmessage = function (e) { + var img = document.createElement("img"); + img.setAttribute("src", e.data); + document.body.appendChild(img); + }; + worker.postMessage(this.result); + }); + reader.readAsArrayBuffer(readfile); + } + } + + diff --git a/project starter code/node_modules/jimp/browser/examples/example4.html b/project starter code/node_modules/jimp/browser/examples/example4.html index c3967d4a..d9f922e5 100644 --- a/project starter code/node_modules/jimp/browser/examples/example4.html +++ b/project starter code/node_modules/jimp/browser/examples/example4.html @@ -1,57 +1,74 @@ - - Jimp browser example 4 - - - -

Demonstrates how to write a text over an image

- - - - -
-
-
-
-
-
- - + + Jimp browser example 4 + + +

Demonstrates how to write a text over an image

+ + + + +
+ +
+ +
+
+
+
+ + diff --git a/project starter code/node_modules/jimp/browser/examples/jimp-worker.js b/project starter code/node_modules/jimp/browser/examples/jimp-worker.js index 90ccfe09..bf3dd37f 100644 --- a/project starter code/node_modules/jimp/browser/examples/jimp-worker.js +++ b/project starter code/node_modules/jimp/browser/examples/jimp-worker.js @@ -1,10 +1,10 @@ /* eslint-env worker */ /* global Jimp */ -importScripts('../lib/jimp.min.js'); +importScripts("../lib/jimp.js"); -self.addEventListener('message', e => { - Jimp.read(e.data).then(lenna => { +self.addEventListener("message", (e) => { + Jimp.read(e.data).then((lenna) => { lenna .resize(256, Jimp.AUTO) // resize .quality(60) // set JPEG quality diff --git a/project starter code/node_modules/jimp/browser/examples/test.html b/project starter code/node_modules/jimp/browser/examples/test.html index f65a8ab4..d5bfd24f 100644 --- a/project starter code/node_modules/jimp/browser/examples/test.html +++ b/project starter code/node_modules/jimp/browser/examples/test.html @@ -1,43 +1,49 @@ - - Jimp browser example 1 - - - - - - + - - - \ No newline at end of file + }); + + + diff --git a/project starter code/node_modules/jimp/browser/lib/jimp.js b/project starter code/node_modules/jimp/browser/lib/jimp.js index 0c714a3f..e8ebe6ec 100644 --- a/project starter code/node_modules/jimp/browser/lib/jimp.js +++ b/project starter code/node_modules/jimp/browser/lib/jimp.js @@ -1,47974 +1,3 @@ -/* -Jimp v0.16.1 -https://github.com/oliver-moran/jimp -Ported for the Web by Phil Seaton -MIT License - -Copyright (c) 2018 Oliver Moran - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ -if ((typeof(window)=='undefined' || !window) && (typeof(self)!='undefined')) var window = self; -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.jimp = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i= toBase) { - numberMap[newlen++] = parseInt(divide / toBase, 10); - divide = divide % toBase; - } else if (newlen > 0) { - numberMap[newlen++] = 0; - } - } - length = newlen; - result = this.dstAlphabet.slice(divide, divide + 1).concat(result); - } while (newlen !== 0); - - return result; -}; - -/** - * Valid number with source alphabet - * - * @param {number} number - * - * @returns {boolean} - */ -Converter.prototype.isValid = function(number) { - var i = 0; - for (; i < number.length; ++i) { - if (this.srcAlphabet.indexOf(number[i]) === -1) { - return false; - } - } - return true; -}; - -module.exports = Converter; -},{}],25:[function(require,module,exports){ -(function (global){ -'use strict'; - -var objectAssign = require('object-assign'); - -// compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js -// original notice: - -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -function compare(a, b) { - if (a === b) { - return 0; - } - - var x = a.length; - var y = b.length; - - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; - break; - } - } - - if (x < y) { - return -1; - } - if (y < x) { - return 1; - } - return 0; -} -function isBuffer(b) { - if (global.Buffer && typeof global.Buffer.isBuffer === 'function') { - return global.Buffer.isBuffer(b); - } - return !!(b != null && b._isBuffer); -} - -// based on node assert, original notice: -// NB: The URL to the CommonJS spec is kept just for tradition. -// node-assert has evolved a lot since then, both in API and behavior. - -// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 -// -// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! -// -// Originally from narwhal.js (http://narwhaljs.org) -// Copyright (c) 2009 Thomas Robinson <280north.com> -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the 'Software'), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -var util = require('util/'); -var hasOwn = Object.prototype.hasOwnProperty; -var pSlice = Array.prototype.slice; -var functionsHaveNames = (function () { - return function foo() {}.name === 'foo'; -}()); -function pToString (obj) { - return Object.prototype.toString.call(obj); -} -function isView(arrbuf) { - if (isBuffer(arrbuf)) { - return false; - } - if (typeof global.ArrayBuffer !== 'function') { - return false; - } - if (typeof ArrayBuffer.isView === 'function') { - return ArrayBuffer.isView(arrbuf); - } - if (!arrbuf) { - return false; - } - if (arrbuf instanceof DataView) { - return true; - } - if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) { - return true; - } - return false; -} -// 1. The assert module provides functions that throw -// AssertionError's when particular conditions are not met. The -// assert module must conform to the following interface. - -var assert = module.exports = ok; - -// 2. The AssertionError is defined in assert. -// new assert.AssertionError({ message: message, -// actual: actual, -// expected: expected }) - -var regex = /\s*function\s+([^\(\s]*)\s*/; -// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js -function getName(func) { - if (!util.isFunction(func)) { - return; - } - if (functionsHaveNames) { - return func.name; - } - var str = func.toString(); - var match = str.match(regex); - return match && match[1]; -} -assert.AssertionError = function AssertionError(options) { - this.name = 'AssertionError'; - this.actual = options.actual; - this.expected = options.expected; - this.operator = options.operator; - if (options.message) { - this.message = options.message; - this.generatedMessage = false; - } else { - this.message = getMessage(this); - this.generatedMessage = true; - } - var stackStartFunction = options.stackStartFunction || fail; - if (Error.captureStackTrace) { - Error.captureStackTrace(this, stackStartFunction); - } else { - // non v8 browsers so we can have a stacktrace - var err = new Error(); - if (err.stack) { - var out = err.stack; - - // try to strip useless frames - var fn_name = getName(stackStartFunction); - var idx = out.indexOf('\n' + fn_name); - if (idx >= 0) { - // once we have located the function frame - // we need to strip out everything before it (and its line) - var next_line = out.indexOf('\n', idx + 1); - out = out.substring(next_line + 1); - } - - this.stack = out; - } - } -}; - -// assert.AssertionError instanceof Error -util.inherits(assert.AssertionError, Error); - -function truncate(s, n) { - if (typeof s === 'string') { - return s.length < n ? s : s.slice(0, n); - } else { - return s; - } -} -function inspect(something) { - if (functionsHaveNames || !util.isFunction(something)) { - return util.inspect(something); - } - var rawname = getName(something); - var name = rawname ? ': ' + rawname : ''; - return '[Function' + name + ']'; -} -function getMessage(self) { - return truncate(inspect(self.actual), 128) + ' ' + - self.operator + ' ' + - truncate(inspect(self.expected), 128); -} - -// At present only the three keys mentioned above are used and -// understood by the spec. Implementations or sub modules can pass -// other keys to the AssertionError's constructor - they will be -// ignored. - -// 3. All of the following functions must throw an AssertionError -// when a corresponding condition is not met, with a message that -// may be undefined if not provided. All assertion methods provide -// both the actual and expected values to the assertion error for -// display purposes. - -function fail(actual, expected, message, operator, stackStartFunction) { - throw new assert.AssertionError({ - message: message, - actual: actual, - expected: expected, - operator: operator, - stackStartFunction: stackStartFunction - }); -} - -// EXTENSION! allows for well behaved errors defined elsewhere. -assert.fail = fail; - -// 4. Pure assertion tests whether a value is truthy, as determined -// by !!guard. -// assert.ok(guard, message_opt); -// This statement is equivalent to assert.equal(true, !!guard, -// message_opt);. To test strictly for the value true, use -// assert.strictEqual(true, guard, message_opt);. - -function ok(value, message) { - if (!value) fail(value, true, message, '==', assert.ok); -} -assert.ok = ok; - -// 5. The equality assertion tests shallow, coercive equality with -// ==. -// assert.equal(actual, expected, message_opt); - -assert.equal = function equal(actual, expected, message) { - if (actual != expected) fail(actual, expected, message, '==', assert.equal); -}; - -// 6. The non-equality assertion tests for whether two objects are not equal -// with != assert.notEqual(actual, expected, message_opt); - -assert.notEqual = function notEqual(actual, expected, message) { - if (actual == expected) { - fail(actual, expected, message, '!=', assert.notEqual); - } -}; - -// 7. The equivalence assertion tests a deep equality relation. -// assert.deepEqual(actual, expected, message_opt); - -assert.deepEqual = function deepEqual(actual, expected, message) { - if (!_deepEqual(actual, expected, false)) { - fail(actual, expected, message, 'deepEqual', assert.deepEqual); - } -}; - -assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { - if (!_deepEqual(actual, expected, true)) { - fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual); - } -}; - -function _deepEqual(actual, expected, strict, memos) { - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - } else if (isBuffer(actual) && isBuffer(expected)) { - return compare(actual, expected) === 0; - - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (util.isDate(actual) && util.isDate(expected)) { - return actual.getTime() === expected.getTime(); - - // 7.3 If the expected value is a RegExp object, the actual value is - // equivalent if it is also a RegExp object with the same source and - // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). - } else if (util.isRegExp(actual) && util.isRegExp(expected)) { - return actual.source === expected.source && - actual.global === expected.global && - actual.multiline === expected.multiline && - actual.lastIndex === expected.lastIndex && - actual.ignoreCase === expected.ignoreCase; - - // 7.4. Other pairs that do not both pass typeof value == 'object', - // equivalence is determined by ==. - } else if ((actual === null || typeof actual !== 'object') && - (expected === null || typeof expected !== 'object')) { - return strict ? actual === expected : actual == expected; - - // If both values are instances of typed arrays, wrap their underlying - // ArrayBuffers in a Buffer each to increase performance - // This optimization requires the arrays to have the same type as checked by - // Object.prototype.toString (aka pToString). Never perform binary - // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their - // bit patterns are not identical. - } else if (isView(actual) && isView(expected) && - pToString(actual) === pToString(expected) && - !(actual instanceof Float32Array || - actual instanceof Float64Array)) { - return compare(new Uint8Array(actual.buffer), - new Uint8Array(expected.buffer)) === 0; - - // 7.5 For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical 'prototype' property. Note: this - // accounts for both named and indexed properties on Arrays. - } else if (isBuffer(actual) !== isBuffer(expected)) { - return false; - } else { - memos = memos || {actual: [], expected: []}; - - var actualIndex = memos.actual.indexOf(actual); - if (actualIndex !== -1) { - if (actualIndex === memos.expected.indexOf(expected)) { - return true; - } - } - - memos.actual.push(actual); - memos.expected.push(expected); - - return objEquiv(actual, expected, strict, memos); - } -} - -function isArguments(object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; -} - -function objEquiv(a, b, strict, actualVisitedObjects) { - if (a === null || a === undefined || b === null || b === undefined) - return false; - // if one is a primitive, the other must be same - if (util.isPrimitive(a) || util.isPrimitive(b)) - return a === b; - if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) - return false; - var aIsArgs = isArguments(a); - var bIsArgs = isArguments(b); - if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) - return false; - if (aIsArgs) { - a = pSlice.call(a); - b = pSlice.call(b); - return _deepEqual(a, b, strict); - } - var ka = objectKeys(a); - var kb = objectKeys(b); - var key, i; - // having the same number of owned properties (keys incorporates - // hasOwnProperty) - if (ka.length !== kb.length) - return false; - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] !== kb[i]) - return false; - } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects)) - return false; - } - return true; -} - -// 8. The non-equivalence assertion tests for any deep inequality. -// assert.notDeepEqual(actual, expected, message_opt); - -assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (_deepEqual(actual, expected, false)) { - fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); - } -}; - -assert.notDeepStrictEqual = notDeepStrictEqual; -function notDeepStrictEqual(actual, expected, message) { - if (_deepEqual(actual, expected, true)) { - fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual); - } -} - - -// 9. The strict equality assertion tests strict equality, as determined by ===. -// assert.strictEqual(actual, expected, message_opt); - -assert.strictEqual = function strictEqual(actual, expected, message) { - if (actual !== expected) { - fail(actual, expected, message, '===', assert.strictEqual); - } -}; - -// 10. The strict non-equality assertion tests for strict inequality, as -// determined by !==. assert.notStrictEqual(actual, expected, message_opt); - -assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (actual === expected) { - fail(actual, expected, message, '!==', assert.notStrictEqual); - } -}; - -function expectedException(actual, expected) { - if (!actual || !expected) { - return false; - } - - if (Object.prototype.toString.call(expected) == '[object RegExp]') { - return expected.test(actual); - } - - try { - if (actual instanceof expected) { - return true; - } - } catch (e) { - // Ignore. The instanceof check doesn't work for arrow functions. - } - - if (Error.isPrototypeOf(expected)) { - return false; - } - - return expected.call({}, actual) === true; -} - -function _tryBlock(block) { - var error; - try { - block(); - } catch (e) { - error = e; - } - return error; -} - -function _throws(shouldThrow, block, expected, message) { - var actual; - - if (typeof block !== 'function') { - throw new TypeError('"block" argument must be a function'); - } - - if (typeof expected === 'string') { - message = expected; - expected = null; - } - - actual = _tryBlock(block); - - message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + - (message ? ' ' + message : '.'); - - if (shouldThrow && !actual) { - fail(actual, expected, 'Missing expected exception' + message); - } - - var userProvidedMessage = typeof message === 'string'; - var isUnwantedException = !shouldThrow && util.isError(actual); - var isUnexpectedException = !shouldThrow && actual && !expected; - - if ((isUnwantedException && - userProvidedMessage && - expectedException(actual, expected)) || - isUnexpectedException) { - fail(actual, expected, 'Got unwanted exception' + message); - } - - if ((shouldThrow && actual && expected && - !expectedException(actual, expected)) || (!shouldThrow && actual)) { - throw actual; - } -} - -// 11. Expected to throw an error: -// assert.throws(block, Error_opt, message_opt); - -assert.throws = function(block, /*optional*/error, /*optional*/message) { - _throws(true, block, error, message); -}; - -// EXTENSION! This is annoying to write outside this module. -assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { - _throws(false, block, error, message); -}; - -assert.ifError = function(err) { if (err) throw err; }; - -// Expose a strict only variant of assert -function strict(value, message) { - if (!value) fail(value, true, message, '==', strict); -} -assert.strict = objectAssign(strict, assert, { - equal: assert.strictEqual, - deepEqual: assert.deepStrictEqual, - notEqual: assert.notStrictEqual, - notDeepEqual: assert.notDeepStrictEqual -}); -assert.strict.strict = assert.strict; - -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - if (hasOwn.call(obj, key)) keys.push(key); - } - return keys; -}; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"object-assign":84,"util/":28}],26:[function(require,module,exports){ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } -} - -},{}],27:[function(require,module,exports){ -module.exports = function isBuffer(arg) { - return arg && typeof arg === 'object' - && typeof arg.copy === 'function' - && typeof arg.fill === 'function' - && typeof arg.readUInt8 === 'function'; -} -},{}],28:[function(require,module,exports){ -(function (process,global){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var formatRegExp = /%[sdj%]/g; -exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(' '); - } - - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x) { - if (x === '%%') return '%'; - if (i >= len) return x; - switch (x) { - case '%s': return String(args[i++]); - case '%d': return Number(args[i++]); - case '%j': - try { - return JSON.stringify(args[i++]); - } catch (_) { - return '[Circular]'; - } - default: - return x; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += ' ' + x; - } else { - str += ' ' + inspect(x); - } - } - return str; -}; - - -// Mark that a method should not be used. -// Returns a modified function which warns once by default. -// If --no-deprecation is set, then it is a no-op. -exports.deprecate = function(fn, msg) { - // Allow for deprecating things in the process of starting up. - if (isUndefined(global.process)) { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } - - if (process.noDeprecation === true) { - return fn; - } - - var warned = false; - function deprecated() { - if (!warned) { - if (process.throwDeprecation) { - throw new Error(msg); - } else if (process.traceDeprecation) { - console.trace(msg); - } else { - console.error(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - - return deprecated; -}; - - -var debugs = {}; -var debugEnviron; -exports.debuglog = function(set) { - if (isUndefined(debugEnviron)) - debugEnviron = process.env.NODE_DEBUG || ''; - set = set.toUpperCase(); - if (!debugs[set]) { - if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error('%s %d: %s', set, pid, msg); - }; - } else { - debugs[set] = function() {}; - } - } - return debugs[set]; -}; - - -/** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Object} opts Optional options object that alters the output. - */ -/* legacy: obj, showHidden, depth, colors*/ -function inspect(obj, opts) { - // default options - var ctx = { - seen: [], - stylize: stylizeNoColor - }; - // legacy... - if (arguments.length >= 3) ctx.depth = arguments[2]; - if (arguments.length >= 4) ctx.colors = arguments[3]; - if (isBoolean(opts)) { - // legacy... - ctx.showHidden = opts; - } else if (opts) { - // got an "options" object - exports._extend(ctx, opts); - } - // set default options - if (isUndefined(ctx.showHidden)) ctx.showHidden = false; - if (isUndefined(ctx.depth)) ctx.depth = 2; - if (isUndefined(ctx.colors)) ctx.colors = false; - if (isUndefined(ctx.customInspect)) ctx.customInspect = true; - if (ctx.colors) ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); -} -exports.inspect = inspect; - - -// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics -inspect.colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - 'blue' : [34, 39], - 'cyan' : [36, 39], - 'green' : [32, 39], - 'magenta' : [35, 39], - 'red' : [31, 39], - 'yellow' : [33, 39] -}; - -// Don't use 'blue' not visible on cmd.exe -inspect.styles = { - 'special': 'cyan', - 'number': 'yellow', - 'boolean': 'yellow', - 'undefined': 'grey', - 'null': 'bold', - 'string': 'green', - 'date': 'magenta', - // "name": intentionally not styling - 'regexp': 'red' -}; - - -function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - - if (style) { - return '\u001b[' + inspect.colors[style][0] + 'm' + str + - '\u001b[' + inspect.colors[style][1] + 'm'; - } else { - return str; - } -} - - -function stylizeNoColor(str, styleType) { - return str; -} - - -function arrayToHash(array) { - var hash = {}; - - array.forEach(function(val, idx) { - hash[val] = true; - }); - - return hash; -} - - -function formatValue(ctx, value, recurseTimes) { - // Provide a hook for user-specified inspect functions. - // Check that value is an object with an inspect function on it - if (ctx.customInspect && - value && - isFunction(value.inspect) && - // Filter out the util module, it's inspect function is special - value.inspect !== exports.inspect && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; - } - - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } - - // Look up the keys of the object. - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); - - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); - } - - // IE doesn't make error fields non-enumerable - // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx - if (isError(value) - && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { - return formatError(value); - } - - // Some type of object without properties can be shortcutted. - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ': ' + value.name : ''; - return ctx.stylize('[Function' + name + ']', 'special'); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), 'date'); - } - if (isError(value)) { - return formatError(value); - } - } - - var base = '', array = false, braces = ['{', '}']; - - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = ['[', ']']; - } - - // Make functions say that they are functions - if (isFunction(value)) { - var n = value.name ? ': ' + value.name : ''; - base = ' [Function' + n + ']'; - } - - // Make RegExps say that they are RegExps - if (isRegExp(value)) { - base = ' ' + RegExp.prototype.toString.call(value); - } - - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + Date.prototype.toUTCString.call(value); - } - - // Make error with message first say the error - if (isError(value)) { - base = ' ' + formatError(value); - } - - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } - - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } else { - return ctx.stylize('[Object]', 'special'); - } - } - - ctx.seen.push(value); - - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); - } - - ctx.seen.pop(); - - return reduceToSingleString(output, base, braces); -} - - -function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize('undefined', 'undefined'); - if (isString(value)) { - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); - } - if (isNumber(value)) - return ctx.stylize('' + value, 'number'); - if (isBoolean(value)) - return ctx.stylize('' + value, 'boolean'); - // For some reason typeof null is "object", so special case here. - if (isNull(value)) - return ctx.stylize('null', 'null'); -} - - -function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; -} - - -function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - String(i), true)); - } else { - output.push(''); - } - } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - key, true)); - } - }); - return output; -} - - -function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize('[Getter/Setter]', 'special'); - } else { - str = ctx.stylize('[Getter]', 'special'); - } - } else { - if (desc.set) { - str = ctx.stylize('[Setter]', 'special'); - } - } - if (!hasOwnProperty(visibleKeys, key)) { - name = '[' + key + ']'; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf('\n') > -1) { - if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').substr(2); - } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); - } - } - } else { - str = ctx.stylize('[Circular]', 'special'); - } - } - if (isUndefined(name)) { - if (array && key.match(/^\d+$/)) { - return str; - } - name = JSON.stringify('' + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); - name = ctx.stylize(name, 'name'); - } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); - } - } - - return name + ': ' + str; -} - - -function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf('\n') >= 0) numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; - }, 0); - - if (length > 60) { - return braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; - } - - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; -} - - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return isObject(e) && - (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -exports.isBuffer = require('./support/isBuffer'); - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - - -function pad(n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); -} - - -var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', - 'Oct', 'Nov', 'Dec']; - -// 26 Feb 16:19:34 -function timestamp() { - var d = new Date(); - var time = [pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds())].join(':'); - return [d.getDate(), months[d.getMonth()], time].join(' '); -} - - -// log is just a thin wrapper to console.log that prepends a timestamp -exports.log = function() { - console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); -}; - - -/** - * Inherit the prototype methods from one constructor into another. - * - * The Function.prototype.inherits from lang.js rewritten as a standalone - * function (not on Function.prototype). NOTE: If this file is to be loaded - * during bootstrapping this function needs to be rewritten using some native - * functions as prototype setup using normal JavaScript does not work as - * expected during bootstrapping (see mirror.js in r114903). - * - * @param {function} ctor Constructor function which needs to inherit the - * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. - */ -exports.inherits = require('inherits'); - -exports._extend = function(origin, add) { - // Don't do anything if add isn't an object - if (!add || !isObject(add)) return origin; - - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; - } - return origin; -}; - -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":27,"_process":133,"inherits":26}],29:[function(require,module,exports){ -'use strict' - -exports.byteLength = byteLength -exports.toByteArray = toByteArray -exports.fromByteArray = fromByteArray - -var lookup = [] -var revLookup = [] -var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array - -var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' -for (var i = 0, len = code.length; i < len; ++i) { - lookup[i] = code[i] - revLookup[code.charCodeAt(i)] = i -} - -// Support decoding URL-safe base64 strings, as Node.js does. -// See: https://en.wikipedia.org/wiki/Base64#URL_applications -revLookup['-'.charCodeAt(0)] = 62 -revLookup['_'.charCodeAt(0)] = 63 - -function getLens (b64) { - var len = b64.length - - if (len % 4 > 0) { - throw new Error('Invalid string. Length must be a multiple of 4') - } - - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('=') - if (validLen === -1) validLen = len - - var placeHoldersLen = validLen === len - ? 0 - : 4 - (validLen % 4) - - return [validLen, placeHoldersLen] -} - -// base64 is 4/3 + up to two characters of the original data -function byteLength (b64) { - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function _byteLength (b64, validLen, placeHoldersLen) { - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function toByteArray (b64) { - var tmp - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) - - var curByte = 0 - - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 - ? validLen - 4 - : validLen - - var i - for (i = 0; i < len; i += 4) { - tmp = - (revLookup[b64.charCodeAt(i)] << 18) | - (revLookup[b64.charCodeAt(i + 1)] << 12) | - (revLookup[b64.charCodeAt(i + 2)] << 6) | - revLookup[b64.charCodeAt(i + 3)] - arr[curByte++] = (tmp >> 16) & 0xFF - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 2) { - tmp = - (revLookup[b64.charCodeAt(i)] << 2) | - (revLookup[b64.charCodeAt(i + 1)] >> 4) - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 1) { - tmp = - (revLookup[b64.charCodeAt(i)] << 10) | - (revLookup[b64.charCodeAt(i + 1)] << 4) | - (revLookup[b64.charCodeAt(i + 2)] >> 2) - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - return arr -} - -function tripletToBase64 (num) { - return lookup[num >> 18 & 0x3F] + - lookup[num >> 12 & 0x3F] + - lookup[num >> 6 & 0x3F] + - lookup[num & 0x3F] -} - -function encodeChunk (uint8, start, end) { - var tmp - var output = [] - for (var i = start; i < end; i += 3) { - tmp = - ((uint8[i] << 16) & 0xFF0000) + - ((uint8[i + 1] << 8) & 0xFF00) + - (uint8[i + 2] & 0xFF) - output.push(tripletToBase64(tmp)) - } - return output.join('') -} - -function fromByteArray (uint8) { - var tmp - var len = uint8.length - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - var parts = [] - var maxChunkLength = 16383 // must be multiple of 3 - - // go through the array every three bytes, we'll deal with trailing stuff later - for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { - parts.push(encodeChunk( - uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) - )) - } - - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1] - parts.push( - lookup[tmp >> 2] + - lookup[(tmp << 4) & 0x3F] + - '==' - ) - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1] - parts.push( - lookup[tmp >> 10] + - lookup[(tmp >> 4) & 0x3F] + - lookup[(tmp << 2) & 0x3F] + - '=' - ) - } - - return parts.join('') -} - -},{}],30:[function(require,module,exports){ -/** - * @author shaozilee - * - * support 1bit 4bit 8bit 24bit decode - * encode with 24bit - * - */ - -var encode = require('./lib/encoder'), - decode = require('./lib/decoder'); - -module.exports = { - encode: encode, - decode: decode -}; - -},{"./lib/decoder":31,"./lib/encoder":32}],31:[function(require,module,exports){ -(function (Buffer){ -/** - * @author shaozilee - * - * Bmp format decoder,support 1bit 4bit 8bit 24bit bmp - * - */ - -function BmpDecoder(buffer,is_with_alpha) { - this.pos = 0; - this.buffer = buffer; - this.is_with_alpha = !!is_with_alpha; - this.bottom_up = true; - this.flag = this.buffer.toString("utf-8", 0, this.pos += 2); - if (this.flag != "BM") throw new Error("Invalid BMP File"); - this.parseHeader(); - this.parseRGBA(); -} - -BmpDecoder.prototype.parseHeader = function() { - this.fileSize = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.reserved = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.offset = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.headerSize = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.width = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.height = this.buffer.readInt32LE(this.pos); - this.pos += 4; - this.planes = this.buffer.readUInt16LE(this.pos); - this.pos += 2; - this.bitPP = this.buffer.readUInt16LE(this.pos); - this.pos += 2; - this.compress = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.rawSize = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.hr = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.vr = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.colors = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - this.importantColors = this.buffer.readUInt32LE(this.pos); - this.pos += 4; - - if(this.bitPP === 16 && this.is_with_alpha){ - this.bitPP = 15 - } - if (this.bitPP < 15) { - var len = this.colors === 0 ? 1 << this.bitPP : this.colors; - this.palette = new Array(len); - for (var i = 0; i < len; i++) { - var blue = this.buffer.readUInt8(this.pos++); - var green = this.buffer.readUInt8(this.pos++); - var red = this.buffer.readUInt8(this.pos++); - var quad = this.buffer.readUInt8(this.pos++); - this.palette[i] = { - red: red, - green: green, - blue: blue, - quad: quad - }; - } - } - if(this.height < 0) { - this.height *= -1; - this.bottom_up = false; - } - -} - -BmpDecoder.prototype.parseRGBA = function() { - var bitn = "bit" + this.bitPP; - var len = this.width * this.height * 4; - this.data = new Buffer(len); - this[bitn](); -}; - -BmpDecoder.prototype.bit1 = function() { - var xlen = Math.ceil(this.width / 8); - var mode = xlen%4; - var y = this.height >= 0 ? this.height - 1 : -this.height - for (var y = this.height - 1; y >= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y - for (var x = 0; x < xlen; x++) { - var b = this.buffer.readUInt8(this.pos++); - var location = line * this.width * 4 + x*8*4; - for (var i = 0; i < 8; i++) { - if(x*8+i>(7-i))&0x1)]; - - this.data[location+i*4] = 0; - this.data[location+i*4 + 1] = rgb.blue; - this.data[location+i*4 + 2] = rgb.green; - this.data[location+i*4 + 3] = rgb.red; - - }else{ - break; - } - } - } - - if (mode != 0){ - this.pos+=(4 - mode); - } - } -}; - -BmpDecoder.prototype.bit4 = function() { - //RLE-4 - if(this.compress == 2){ - this.data.fill(0xff); - - var location = 0; - var lines = this.bottom_up?this.height-1:0; - var low_nibble = false;//for all count of pixel - - while(location>4); - } - - if ((i & 1) && (i+1 < b)){ - c = this.buffer.readUInt8(this.pos++); - } - - low_nibble = !low_nibble; - } - - if ((((b+1) >> 1) & 1 ) == 1){ - this.pos++ - } - } - - }else{//encoded mode - for (var i = 0; i < a; i++) { - if (low_nibble) { - setPixelData.call(this, (b & 0x0f)); - } else { - setPixelData.call(this, (b & 0xf0)>>4); - } - low_nibble = !low_nibble; - } - } - - } - - - - - function setPixelData(rgbIndex){ - var rgb = this.palette[rgbIndex]; - this.data[location] = 0; - this.data[location + 1] = rgb.blue; - this.data[location + 2] = rgb.green; - this.data[location + 3] = rgb.red; - location+=4; - } - }else{ - - var xlen = Math.ceil(this.width/2); - var mode = xlen%4; - for (var y = this.height - 1; y >= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y - for (var x = 0; x < xlen; x++) { - var b = this.buffer.readUInt8(this.pos++); - var location = line * this.width * 4 + x*2*4; - - var before = b>>4; - var after = b&0x0F; - - var rgb = this.palette[before]; - this.data[location] = 0; - this.data[location + 1] = rgb.blue; - this.data[location + 2] = rgb.green; - this.data[location + 3] = rgb.red; - - - if(x*2+1>=this.width)break; - - rgb = this.palette[after]; - - this.data[location+4] = 0; - this.data[location+4 + 1] = rgb.blue; - this.data[location+4 + 2] = rgb.green; - this.data[location+4 + 3] = rgb.red; - - } - - if (mode != 0){ - this.pos+=(4 - mode); - } - } - - } - -}; - -BmpDecoder.prototype.bit8 = function() { - //RLE-8 - if(this.compress == 1){ - this.data.fill(0xff); - - var location = 0; - var lines = this.bottom_up?this.height-1:0; - - while(location= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y - for (var x = 0; x < this.width; x++) { - var b = this.buffer.readUInt8(this.pos++); - var location = line * this.width * 4 + x * 4; - if (b < this.palette.length) { - var rgb = this.palette[b]; - - this.data[location] = 0; - this.data[location + 1] = rgb.blue; - this.data[location + 2] = rgb.green; - this.data[location + 3] = rgb.red; - - } else { - this.data[location] = 0; - this.data[location + 1] = 0xFF; - this.data[location + 2] = 0xFF; - this.data[location + 3] = 0xFF; - } - } - if (mode != 0) { - this.pos += (4 - mode); - } - } - } -}; - -BmpDecoder.prototype.bit15 = function() { - var dif_w =this.width % 3; - var _11111 = parseInt("11111", 2),_1_5 = _11111; - for (var y = this.height - 1; y >= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y - for (var x = 0; x < this.width; x++) { - - var B = this.buffer.readUInt16LE(this.pos); - this.pos+=2; - var blue = (B & _1_5) / _1_5 * 255 | 0; - var green = (B >> 5 & _1_5 ) / _1_5 * 255 | 0; - var red = (B >> 10 & _1_5) / _1_5 * 255 | 0; - var alpha = (B>>15)?0xFF:0x00; - - var location = line * this.width * 4 + x * 4; - - this.data[location] = alpha; - this.data[location + 1] = blue; - this.data[location + 2] = green; - this.data[location + 3] = red; - } - //skip extra bytes - this.pos += dif_w; - } -}; - -BmpDecoder.prototype.bit16 = function() { - var dif_w =(this.width % 2)*2; - //default xrgb555 - this.maskRed = 0x7C00; - this.maskGreen = 0x3E0; - this.maskBlue =0x1F; - this.mask0 = 0; - - if(this.compress == 3){ - this.maskRed = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - this.maskGreen = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - this.maskBlue = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - this.mask0 = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - } - - - var ns=[0,0,0]; - for (var i=0;i<16;i++){ - if ((this.maskRed>>i)&0x01) ns[0]++; - if ((this.maskGreen>>i)&0x01) ns[1]++; - if ((this.maskBlue>>i)&0x01) ns[2]++; - } - ns[1]+=ns[0]; ns[2]+=ns[1]; ns[0]=8-ns[0]; ns[1]-=8; ns[2]-=8; - - for (var y = this.height - 1; y >= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y; - for (var x = 0; x < this.width; x++) { - - var B = this.buffer.readUInt16LE(this.pos); - this.pos+=2; - - var blue = (B&this.maskBlue)<>ns[1]; - var red = (B&this.maskRed)>>ns[2]; - - var location = line * this.width * 4 + x * 4; - - this.data[location] = 0; - this.data[location + 1] = blue; - this.data[location + 2] = green; - this.data[location + 3] = red; - } - //skip extra bytes - this.pos += dif_w; - } -}; - -BmpDecoder.prototype.bit24 = function() { - for (var y = this.height - 1; y >= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y - for (var x = 0; x < this.width; x++) { - //Little Endian rgb - var blue = this.buffer.readUInt8(this.pos++); - var green = this.buffer.readUInt8(this.pos++); - var red = this.buffer.readUInt8(this.pos++); - var location = line * this.width * 4 + x * 4; - this.data[location] = 0; - this.data[location + 1] = blue; - this.data[location + 2] = green; - this.data[location + 3] = red; - } - //skip extra bytes - this.pos += (this.width % 4); - } - -}; - -/** - * add 32bit decode func - * @author soubok - */ -BmpDecoder.prototype.bit32 = function() { - //BI_BITFIELDS - if(this.compress == 3){ - this.maskRed = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - this.maskGreen = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - this.maskBlue = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - this.mask0 = this.buffer.readUInt32LE(this.pos); - this.pos+=4; - for (var y = this.height - 1; y >= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y; - for (var x = 0; x < this.width; x++) { - //Little Endian rgba - var alpha = this.buffer.readUInt8(this.pos++); - var blue = this.buffer.readUInt8(this.pos++); - var green = this.buffer.readUInt8(this.pos++); - var red = this.buffer.readUInt8(this.pos++); - var location = line * this.width * 4 + x * 4; - this.data[location] = alpha; - this.data[location + 1] = blue; - this.data[location + 2] = green; - this.data[location + 3] = red; - } - } - - }else{ - for (var y = this.height - 1; y >= 0; y--) { - var line = this.bottom_up ? y : this.height - 1 - y; - for (var x = 0; x < this.width; x++) { - //Little Endian argb - var blue = this.buffer.readUInt8(this.pos++); - var green = this.buffer.readUInt8(this.pos++); - var red = this.buffer.readUInt8(this.pos++); - var alpha = this.buffer.readUInt8(this.pos++); - var location = line * this.width * 4 + x * 4; - this.data[location] = alpha; - this.data[location + 1] = blue; - this.data[location + 2] = green; - this.data[location + 3] = red; - } - } - - } - - - - -}; - -BmpDecoder.prototype.getData = function() { - return this.data; -}; - -module.exports = function(bmpData) { - var decoder = new BmpDecoder(bmpData); - return decoder; -}; - -}).call(this,require("buffer").Buffer) -},{"buffer":48}],32:[function(require,module,exports){ -(function (Buffer){ -/** - * @author shaozilee - * - * BMP format encoder,encode 24bit BMP - * Not support quality compression - * - */ - -function BmpEncoder(imgData){ - this.buffer = imgData.data; - this.width = imgData.width; - this.height = imgData.height; - this.extraBytes = this.width%4; - this.rgbSize = this.height*(3*this.width+this.extraBytes); - this.headerInfoSize = 40; - - this.data = []; - /******************header***********************/ - this.flag = "BM"; - this.reserved = 0; - this.offset = 54; - this.fileSize = this.rgbSize+this.offset; - this.planes = 1; - this.bitPP = 24; - this.compress = 0; - this.hr = 0; - this.vr = 0; - this.colors = 0; - this.importantColors = 0; -} - -BmpEncoder.prototype.encode = function() { - var tempBuffer = new Buffer(this.offset+this.rgbSize); - this.pos = 0; - tempBuffer.write(this.flag,this.pos,2);this.pos+=2; - tempBuffer.writeUInt32LE(this.fileSize,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.reserved,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.offset,this.pos);this.pos+=4; - - tempBuffer.writeUInt32LE(this.headerInfoSize,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.width,this.pos);this.pos+=4; - tempBuffer.writeInt32LE(-this.height,this.pos);this.pos+=4; - tempBuffer.writeUInt16LE(this.planes,this.pos);this.pos+=2; - tempBuffer.writeUInt16LE(this.bitPP,this.pos);this.pos+=2; - tempBuffer.writeUInt32LE(this.compress,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.rgbSize,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.hr,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.vr,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.colors,this.pos);this.pos+=4; - tempBuffer.writeUInt32LE(this.importantColors,this.pos);this.pos+=4; - - var i=0; - var rowBytes = 3*this.width+this.extraBytes; - - for (var y = 0; y 0){ - var fillOffset = this.pos+y*rowBytes+this.width*3; - tempBuffer.fill(0,fillOffset,fillOffset+this.extraBytes); - } - } - - return tempBuffer; -}; - -module.exports = function(imgData, quality) { - if (typeof quality === 'undefined') quality = 100; - var encoder = new BmpEncoder(imgData); - var data = encoder.encode(); - return { - data: data, - width: imgData.width, - height: imgData.height - }; -}; - -}).call(this,require("buffer").Buffer) -},{"buffer":48}],33:[function(require,module,exports){ - -},{}],34:[function(require,module,exports){ -(function (process,Buffer){ -'use strict'; -/* eslint camelcase: "off" */ - -var assert = require('assert'); - -var Zstream = require('pako/lib/zlib/zstream'); -var zlib_deflate = require('pako/lib/zlib/deflate.js'); -var zlib_inflate = require('pako/lib/zlib/inflate.js'); -var constants = require('pako/lib/zlib/constants'); - -for (var key in constants) { - exports[key] = constants[key]; -} - -// zlib modes -exports.NONE = 0; -exports.DEFLATE = 1; -exports.INFLATE = 2; -exports.GZIP = 3; -exports.GUNZIP = 4; -exports.DEFLATERAW = 5; -exports.INFLATERAW = 6; -exports.UNZIP = 7; - -var GZIP_HEADER_ID1 = 0x1f; -var GZIP_HEADER_ID2 = 0x8b; - -/** - * Emulate Node's zlib C++ layer for use by the JS layer in index.js - */ -function Zlib(mode) { - if (typeof mode !== 'number' || mode < exports.DEFLATE || mode > exports.UNZIP) { - throw new TypeError('Bad argument'); - } - - this.dictionary = null; - this.err = 0; - this.flush = 0; - this.init_done = false; - this.level = 0; - this.memLevel = 0; - this.mode = mode; - this.strategy = 0; - this.windowBits = 0; - this.write_in_progress = false; - this.pending_close = false; - this.gzip_id_bytes_read = 0; -} - -Zlib.prototype.close = function () { - if (this.write_in_progress) { - this.pending_close = true; - return; - } - - this.pending_close = false; - - assert(this.init_done, 'close before init'); - assert(this.mode <= exports.UNZIP); - - if (this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW) { - zlib_deflate.deflateEnd(this.strm); - } else if (this.mode === exports.INFLATE || this.mode === exports.GUNZIP || this.mode === exports.INFLATERAW || this.mode === exports.UNZIP) { - zlib_inflate.inflateEnd(this.strm); - } - - this.mode = exports.NONE; - - this.dictionary = null; -}; - -Zlib.prototype.write = function (flush, input, in_off, in_len, out, out_off, out_len) { - return this._write(true, flush, input, in_off, in_len, out, out_off, out_len); -}; - -Zlib.prototype.writeSync = function (flush, input, in_off, in_len, out, out_off, out_len) { - return this._write(false, flush, input, in_off, in_len, out, out_off, out_len); -}; - -Zlib.prototype._write = function (async, flush, input, in_off, in_len, out, out_off, out_len) { - assert.equal(arguments.length, 8); - - assert(this.init_done, 'write before init'); - assert(this.mode !== exports.NONE, 'already finalized'); - assert.equal(false, this.write_in_progress, 'write already in progress'); - assert.equal(false, this.pending_close, 'close is pending'); - - this.write_in_progress = true; - - assert.equal(false, flush === undefined, 'must provide flush value'); - - this.write_in_progress = true; - - if (flush !== exports.Z_NO_FLUSH && flush !== exports.Z_PARTIAL_FLUSH && flush !== exports.Z_SYNC_FLUSH && flush !== exports.Z_FULL_FLUSH && flush !== exports.Z_FINISH && flush !== exports.Z_BLOCK) { - throw new Error('Invalid flush value'); - } - - if (input == null) { - input = Buffer.alloc(0); - in_len = 0; - in_off = 0; - } - - this.strm.avail_in = in_len; - this.strm.input = input; - this.strm.next_in = in_off; - this.strm.avail_out = out_len; - this.strm.output = out; - this.strm.next_out = out_off; - this.flush = flush; - - if (!async) { - // sync version - this._process(); - - if (this._checkError()) { - return this._afterSync(); - } - return; - } - - // async version - var self = this; - process.nextTick(function () { - self._process(); - self._after(); - }); - - return this; -}; - -Zlib.prototype._afterSync = function () { - var avail_out = this.strm.avail_out; - var avail_in = this.strm.avail_in; - - this.write_in_progress = false; - - return [avail_in, avail_out]; -}; - -Zlib.prototype._process = function () { - var next_expected_header_byte = null; - - // If the avail_out is left at 0, then it means that it ran out - // of room. If there was avail_out left over, then it means - // that all of the input was consumed. - switch (this.mode) { - case exports.DEFLATE: - case exports.GZIP: - case exports.DEFLATERAW: - this.err = zlib_deflate.deflate(this.strm, this.flush); - break; - case exports.UNZIP: - if (this.strm.avail_in > 0) { - next_expected_header_byte = this.strm.next_in; - } - - switch (this.gzip_id_bytes_read) { - case 0: - if (next_expected_header_byte === null) { - break; - } - - if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID1) { - this.gzip_id_bytes_read = 1; - next_expected_header_byte++; - - if (this.strm.avail_in === 1) { - // The only available byte was already read. - break; - } - } else { - this.mode = exports.INFLATE; - break; - } - - // fallthrough - case 1: - if (next_expected_header_byte === null) { - break; - } - - if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID2) { - this.gzip_id_bytes_read = 2; - this.mode = exports.GUNZIP; - } else { - // There is no actual difference between INFLATE and INFLATERAW - // (after initialization). - this.mode = exports.INFLATE; - } - - break; - default: - throw new Error('invalid number of gzip magic number bytes read'); - } - - // fallthrough - case exports.INFLATE: - case exports.GUNZIP: - case exports.INFLATERAW: - this.err = zlib_inflate.inflate(this.strm, this.flush - - // If data was encoded with dictionary - );if (this.err === exports.Z_NEED_DICT && this.dictionary) { - // Load it - this.err = zlib_inflate.inflateSetDictionary(this.strm, this.dictionary); - if (this.err === exports.Z_OK) { - // And try to decode again - this.err = zlib_inflate.inflate(this.strm, this.flush); - } else if (this.err === exports.Z_DATA_ERROR) { - // Both inflateSetDictionary() and inflate() return Z_DATA_ERROR. - // Make it possible for After() to tell a bad dictionary from bad - // input. - this.err = exports.Z_NEED_DICT; - } - } - while (this.strm.avail_in > 0 && this.mode === exports.GUNZIP && this.err === exports.Z_STREAM_END && this.strm.next_in[0] !== 0x00) { - // Bytes remain in input buffer. Perhaps this is another compressed - // member in the same archive, or just trailing garbage. - // Trailing zero bytes are okay, though, since they are frequently - // used for padding. - - this.reset(); - this.err = zlib_inflate.inflate(this.strm, this.flush); - } - break; - default: - throw new Error('Unknown mode ' + this.mode); - } -}; - -Zlib.prototype._checkError = function () { - // Acceptable error states depend on the type of zlib stream. - switch (this.err) { - case exports.Z_OK: - case exports.Z_BUF_ERROR: - if (this.strm.avail_out !== 0 && this.flush === exports.Z_FINISH) { - this._error('unexpected end of file'); - return false; - } - break; - case exports.Z_STREAM_END: - // normal statuses, not fatal - break; - case exports.Z_NEED_DICT: - if (this.dictionary == null) { - this._error('Missing dictionary'); - } else { - this._error('Bad dictionary'); - } - return false; - default: - // something else. - this._error('Zlib error'); - return false; - } - - return true; -}; - -Zlib.prototype._after = function () { - if (!this._checkError()) { - return; - } - - var avail_out = this.strm.avail_out; - var avail_in = this.strm.avail_in; - - this.write_in_progress = false; - - // call the write() cb - this.callback(avail_in, avail_out); - - if (this.pending_close) { - this.close(); - } -}; - -Zlib.prototype._error = function (message) { - if (this.strm.msg) { - message = this.strm.msg; - } - this.onerror(message, this.err - - // no hope of rescue. - );this.write_in_progress = false; - if (this.pending_close) { - this.close(); - } -}; - -Zlib.prototype.init = function (windowBits, level, memLevel, strategy, dictionary) { - assert(arguments.length === 4 || arguments.length === 5, 'init(windowBits, level, memLevel, strategy, [dictionary])'); - - assert(windowBits >= 8 && windowBits <= 15, 'invalid windowBits'); - assert(level >= -1 && level <= 9, 'invalid compression level'); - - assert(memLevel >= 1 && memLevel <= 9, 'invalid memlevel'); - - assert(strategy === exports.Z_FILTERED || strategy === exports.Z_HUFFMAN_ONLY || strategy === exports.Z_RLE || strategy === exports.Z_FIXED || strategy === exports.Z_DEFAULT_STRATEGY, 'invalid strategy'); - - this._init(level, windowBits, memLevel, strategy, dictionary); - this._setDictionary(); -}; - -Zlib.prototype.params = function () { - throw new Error('deflateParams Not supported'); -}; - -Zlib.prototype.reset = function () { - this._reset(); - this._setDictionary(); -}; - -Zlib.prototype._init = function (level, windowBits, memLevel, strategy, dictionary) { - this.level = level; - this.windowBits = windowBits; - this.memLevel = memLevel; - this.strategy = strategy; - - this.flush = exports.Z_NO_FLUSH; - - this.err = exports.Z_OK; - - if (this.mode === exports.GZIP || this.mode === exports.GUNZIP) { - this.windowBits += 16; - } - - if (this.mode === exports.UNZIP) { - this.windowBits += 32; - } - - if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW) { - this.windowBits = -1 * this.windowBits; - } - - this.strm = new Zstream(); - - switch (this.mode) { - case exports.DEFLATE: - case exports.GZIP: - case exports.DEFLATERAW: - this.err = zlib_deflate.deflateInit2(this.strm, this.level, exports.Z_DEFLATED, this.windowBits, this.memLevel, this.strategy); - break; - case exports.INFLATE: - case exports.GUNZIP: - case exports.INFLATERAW: - case exports.UNZIP: - this.err = zlib_inflate.inflateInit2(this.strm, this.windowBits); - break; - default: - throw new Error('Unknown mode ' + this.mode); - } - - if (this.err !== exports.Z_OK) { - this._error('Init error'); - } - - this.dictionary = dictionary; - - this.write_in_progress = false; - this.init_done = true; -}; - -Zlib.prototype._setDictionary = function () { - if (this.dictionary == null) { - return; - } - - this.err = exports.Z_OK; - - switch (this.mode) { - case exports.DEFLATE: - case exports.DEFLATERAW: - this.err = zlib_deflate.deflateSetDictionary(this.strm, this.dictionary); - break; - default: - break; - } - - if (this.err !== exports.Z_OK) { - this._error('Failed to set dictionary'); - } -}; - -Zlib.prototype._reset = function () { - this.err = exports.Z_OK; - - switch (this.mode) { - case exports.DEFLATE: - case exports.DEFLATERAW: - case exports.GZIP: - this.err = zlib_deflate.deflateReset(this.strm); - break; - case exports.INFLATE: - case exports.INFLATERAW: - case exports.GUNZIP: - this.err = zlib_inflate.inflateReset(this.strm); - break; - default: - break; - } - - if (this.err !== exports.Z_OK) { - this._error('Failed to reset stream'); - } -}; - -exports.Zlib = Zlib; -}).call(this,require('_process'),require("buffer").Buffer) -},{"_process":133,"assert":25,"buffer":48,"pako/lib/zlib/constants":38,"pako/lib/zlib/deflate.js":40,"pako/lib/zlib/inflate.js":42,"pako/lib/zlib/zstream":46}],35:[function(require,module,exports){ -(function (process){ -'use strict'; - -var Buffer = require('buffer').Buffer; -var Transform = require('stream').Transform; -var binding = require('./binding'); -var util = require('util'); -var assert = require('assert').ok; -var kMaxLength = require('buffer').kMaxLength; -var kRangeErrorMessage = 'Cannot create final Buffer. It would be larger ' + 'than 0x' + kMaxLength.toString(16) + ' bytes'; - -// zlib doesn't provide these, so kludge them in following the same -// const naming scheme zlib uses. -binding.Z_MIN_WINDOWBITS = 8; -binding.Z_MAX_WINDOWBITS = 15; -binding.Z_DEFAULT_WINDOWBITS = 15; - -// fewer than 64 bytes per chunk is stupid. -// technically it could work with as few as 8, but even 64 bytes -// is absurdly low. Usually a MB or more is best. -binding.Z_MIN_CHUNK = 64; -binding.Z_MAX_CHUNK = Infinity; -binding.Z_DEFAULT_CHUNK = 16 * 1024; - -binding.Z_MIN_MEMLEVEL = 1; -binding.Z_MAX_MEMLEVEL = 9; -binding.Z_DEFAULT_MEMLEVEL = 8; - -binding.Z_MIN_LEVEL = -1; -binding.Z_MAX_LEVEL = 9; -binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION; - -// expose all the zlib constants -var bkeys = Object.keys(binding); -for (var bk = 0; bk < bkeys.length; bk++) { - var bkey = bkeys[bk]; - if (bkey.match(/^Z/)) { - Object.defineProperty(exports, bkey, { - enumerable: true, value: binding[bkey], writable: false - }); - } -} - -// translation table for return codes. -var codes = { - Z_OK: binding.Z_OK, - Z_STREAM_END: binding.Z_STREAM_END, - Z_NEED_DICT: binding.Z_NEED_DICT, - Z_ERRNO: binding.Z_ERRNO, - Z_STREAM_ERROR: binding.Z_STREAM_ERROR, - Z_DATA_ERROR: binding.Z_DATA_ERROR, - Z_MEM_ERROR: binding.Z_MEM_ERROR, - Z_BUF_ERROR: binding.Z_BUF_ERROR, - Z_VERSION_ERROR: binding.Z_VERSION_ERROR -}; - -var ckeys = Object.keys(codes); -for (var ck = 0; ck < ckeys.length; ck++) { - var ckey = ckeys[ck]; - codes[codes[ckey]] = ckey; -} - -Object.defineProperty(exports, 'codes', { - enumerable: true, value: Object.freeze(codes), writable: false -}); - -exports.Deflate = Deflate; -exports.Inflate = Inflate; -exports.Gzip = Gzip; -exports.Gunzip = Gunzip; -exports.DeflateRaw = DeflateRaw; -exports.InflateRaw = InflateRaw; -exports.Unzip = Unzip; - -exports.createDeflate = function (o) { - return new Deflate(o); -}; - -exports.createInflate = function (o) { - return new Inflate(o); -}; - -exports.createDeflateRaw = function (o) { - return new DeflateRaw(o); -}; - -exports.createInflateRaw = function (o) { - return new InflateRaw(o); -}; - -exports.createGzip = function (o) { - return new Gzip(o); -}; - -exports.createGunzip = function (o) { - return new Gunzip(o); -}; - -exports.createUnzip = function (o) { - return new Unzip(o); -}; - -// Convenience methods. -// compress/decompress a string or buffer in one step. -exports.deflate = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Deflate(opts), buffer, callback); -}; - -exports.deflateSync = function (buffer, opts) { - return zlibBufferSync(new Deflate(opts), buffer); -}; - -exports.gzip = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Gzip(opts), buffer, callback); -}; - -exports.gzipSync = function (buffer, opts) { - return zlibBufferSync(new Gzip(opts), buffer); -}; - -exports.deflateRaw = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new DeflateRaw(opts), buffer, callback); -}; - -exports.deflateRawSync = function (buffer, opts) { - return zlibBufferSync(new DeflateRaw(opts), buffer); -}; - -exports.unzip = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Unzip(opts), buffer, callback); -}; - -exports.unzipSync = function (buffer, opts) { - return zlibBufferSync(new Unzip(opts), buffer); -}; - -exports.inflate = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Inflate(opts), buffer, callback); -}; - -exports.inflateSync = function (buffer, opts) { - return zlibBufferSync(new Inflate(opts), buffer); -}; - -exports.gunzip = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Gunzip(opts), buffer, callback); -}; - -exports.gunzipSync = function (buffer, opts) { - return zlibBufferSync(new Gunzip(opts), buffer); -}; - -exports.inflateRaw = function (buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new InflateRaw(opts), buffer, callback); -}; - -exports.inflateRawSync = function (buffer, opts) { - return zlibBufferSync(new InflateRaw(opts), buffer); -}; - -function zlibBuffer(engine, buffer, callback) { - var buffers = []; - var nread = 0; - - engine.on('error', onError); - engine.on('end', onEnd); - - engine.end(buffer); - flow(); - - function flow() { - var chunk; - while (null !== (chunk = engine.read())) { - buffers.push(chunk); - nread += chunk.length; - } - engine.once('readable', flow); - } - - function onError(err) { - engine.removeListener('end', onEnd); - engine.removeListener('readable', flow); - callback(err); - } - - function onEnd() { - var buf; - var err = null; - - if (nread >= kMaxLength) { - err = new RangeError(kRangeErrorMessage); - } else { - buf = Buffer.concat(buffers, nread); - } - - buffers = []; - engine.close(); - callback(err, buf); - } -} - -function zlibBufferSync(engine, buffer) { - if (typeof buffer === 'string') buffer = Buffer.from(buffer); - - if (!Buffer.isBuffer(buffer)) throw new TypeError('Not a string or buffer'); - - var flushFlag = engine._finishFlushFlag; - - return engine._processChunk(buffer, flushFlag); -} - -// generic zlib -// minimal 2-byte header -function Deflate(opts) { - if (!(this instanceof Deflate)) return new Deflate(opts); - Zlib.call(this, opts, binding.DEFLATE); -} - -function Inflate(opts) { - if (!(this instanceof Inflate)) return new Inflate(opts); - Zlib.call(this, opts, binding.INFLATE); -} - -// gzip - bigger header, same deflate compression -function Gzip(opts) { - if (!(this instanceof Gzip)) return new Gzip(opts); - Zlib.call(this, opts, binding.GZIP); -} - -function Gunzip(opts) { - if (!(this instanceof Gunzip)) return new Gunzip(opts); - Zlib.call(this, opts, binding.GUNZIP); -} - -// raw - no header -function DeflateRaw(opts) { - if (!(this instanceof DeflateRaw)) return new DeflateRaw(opts); - Zlib.call(this, opts, binding.DEFLATERAW); -} - -function InflateRaw(opts) { - if (!(this instanceof InflateRaw)) return new InflateRaw(opts); - Zlib.call(this, opts, binding.INFLATERAW); -} - -// auto-detect header. -function Unzip(opts) { - if (!(this instanceof Unzip)) return new Unzip(opts); - Zlib.call(this, opts, binding.UNZIP); -} - -function isValidFlushFlag(flag) { - return flag === binding.Z_NO_FLUSH || flag === binding.Z_PARTIAL_FLUSH || flag === binding.Z_SYNC_FLUSH || flag === binding.Z_FULL_FLUSH || flag === binding.Z_FINISH || flag === binding.Z_BLOCK; -} - -// the Zlib class they all inherit from -// This thing manages the queue of requests, and returns -// true or false if there is anything in the queue when -// you call the .write() method. - -function Zlib(opts, mode) { - var _this = this; - - this._opts = opts = opts || {}; - this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK; - - Transform.call(this, opts); - - if (opts.flush && !isValidFlushFlag(opts.flush)) { - throw new Error('Invalid flush flag: ' + opts.flush); - } - if (opts.finishFlush && !isValidFlushFlag(opts.finishFlush)) { - throw new Error('Invalid flush flag: ' + opts.finishFlush); - } - - this._flushFlag = opts.flush || binding.Z_NO_FLUSH; - this._finishFlushFlag = typeof opts.finishFlush !== 'undefined' ? opts.finishFlush : binding.Z_FINISH; - - if (opts.chunkSize) { - if (opts.chunkSize < exports.Z_MIN_CHUNK || opts.chunkSize > exports.Z_MAX_CHUNK) { - throw new Error('Invalid chunk size: ' + opts.chunkSize); - } - } - - if (opts.windowBits) { - if (opts.windowBits < exports.Z_MIN_WINDOWBITS || opts.windowBits > exports.Z_MAX_WINDOWBITS) { - throw new Error('Invalid windowBits: ' + opts.windowBits); - } - } - - if (opts.level) { - if (opts.level < exports.Z_MIN_LEVEL || opts.level > exports.Z_MAX_LEVEL) { - throw new Error('Invalid compression level: ' + opts.level); - } - } - - if (opts.memLevel) { - if (opts.memLevel < exports.Z_MIN_MEMLEVEL || opts.memLevel > exports.Z_MAX_MEMLEVEL) { - throw new Error('Invalid memLevel: ' + opts.memLevel); - } - } - - if (opts.strategy) { - if (opts.strategy != exports.Z_FILTERED && opts.strategy != exports.Z_HUFFMAN_ONLY && opts.strategy != exports.Z_RLE && opts.strategy != exports.Z_FIXED && opts.strategy != exports.Z_DEFAULT_STRATEGY) { - throw new Error('Invalid strategy: ' + opts.strategy); - } - } - - if (opts.dictionary) { - if (!Buffer.isBuffer(opts.dictionary)) { - throw new Error('Invalid dictionary: it should be a Buffer instance'); - } - } - - this._handle = new binding.Zlib(mode); - - var self = this; - this._hadError = false; - this._handle.onerror = function (message, errno) { - // there is no way to cleanly recover. - // continuing only obscures problems. - _close(self); - self._hadError = true; - - var error = new Error(message); - error.errno = errno; - error.code = exports.codes[errno]; - self.emit('error', error); - }; - - var level = exports.Z_DEFAULT_COMPRESSION; - if (typeof opts.level === 'number') level = opts.level; - - var strategy = exports.Z_DEFAULT_STRATEGY; - if (typeof opts.strategy === 'number') strategy = opts.strategy; - - this._handle.init(opts.windowBits || exports.Z_DEFAULT_WINDOWBITS, level, opts.memLevel || exports.Z_DEFAULT_MEMLEVEL, strategy, opts.dictionary); - - this._buffer = Buffer.allocUnsafe(this._chunkSize); - this._offset = 0; - this._level = level; - this._strategy = strategy; - - this.once('end', this.close); - - Object.defineProperty(this, '_closed', { - get: function () { - return !_this._handle; - }, - configurable: true, - enumerable: true - }); -} - -util.inherits(Zlib, Transform); - -Zlib.prototype.params = function (level, strategy, callback) { - if (level < exports.Z_MIN_LEVEL || level > exports.Z_MAX_LEVEL) { - throw new RangeError('Invalid compression level: ' + level); - } - if (strategy != exports.Z_FILTERED && strategy != exports.Z_HUFFMAN_ONLY && strategy != exports.Z_RLE && strategy != exports.Z_FIXED && strategy != exports.Z_DEFAULT_STRATEGY) { - throw new TypeError('Invalid strategy: ' + strategy); - } - - if (this._level !== level || this._strategy !== strategy) { - var self = this; - this.flush(binding.Z_SYNC_FLUSH, function () { - assert(self._handle, 'zlib binding closed'); - self._handle.params(level, strategy); - if (!self._hadError) { - self._level = level; - self._strategy = strategy; - if (callback) callback(); - } - }); - } else { - process.nextTick(callback); - } -}; - -Zlib.prototype.reset = function () { - assert(this._handle, 'zlib binding closed'); - return this._handle.reset(); -}; - -// This is the _flush function called by the transform class, -// internally, when the last chunk has been written. -Zlib.prototype._flush = function (callback) { - this._transform(Buffer.alloc(0), '', callback); -}; - -Zlib.prototype.flush = function (kind, callback) { - var _this2 = this; - - var ws = this._writableState; - - if (typeof kind === 'function' || kind === undefined && !callback) { - callback = kind; - kind = binding.Z_FULL_FLUSH; - } - - if (ws.ended) { - if (callback) process.nextTick(callback); - } else if (ws.ending) { - if (callback) this.once('end', callback); - } else if (ws.needDrain) { - if (callback) { - this.once('drain', function () { - return _this2.flush(kind, callback); - }); - } - } else { - this._flushFlag = kind; - this.write(Buffer.alloc(0), '', callback); - } -}; - -Zlib.prototype.close = function (callback) { - _close(this, callback); - process.nextTick(emitCloseNT, this); -}; - -function _close(engine, callback) { - if (callback) process.nextTick(callback); - - // Caller may invoke .close after a zlib error (which will null _handle). - if (!engine._handle) return; - - engine._handle.close(); - engine._handle = null; -} - -function emitCloseNT(self) { - self.emit('close'); -} - -Zlib.prototype._transform = function (chunk, encoding, cb) { - var flushFlag; - var ws = this._writableState; - var ending = ws.ending || ws.ended; - var last = ending && (!chunk || ws.length === chunk.length); - - if (chunk !== null && !Buffer.isBuffer(chunk)) return cb(new Error('invalid input')); - - if (!this._handle) return cb(new Error('zlib binding closed')); - - // If it's the last chunk, or a final flush, we use the Z_FINISH flush flag - // (or whatever flag was provided using opts.finishFlush). - // If it's explicitly flushing at some other time, then we use - // Z_FULL_FLUSH. Otherwise, use Z_NO_FLUSH for maximum compression - // goodness. - if (last) flushFlag = this._finishFlushFlag;else { - flushFlag = this._flushFlag; - // once we've flushed the last of the queue, stop flushing and - // go back to the normal behavior. - if (chunk.length >= ws.length) { - this._flushFlag = this._opts.flush || binding.Z_NO_FLUSH; - } - } - - this._processChunk(chunk, flushFlag, cb); -}; - -Zlib.prototype._processChunk = function (chunk, flushFlag, cb) { - var availInBefore = chunk && chunk.length; - var availOutBefore = this._chunkSize - this._offset; - var inOff = 0; - - var self = this; - - var async = typeof cb === 'function'; - - if (!async) { - var buffers = []; - var nread = 0; - - var error; - this.on('error', function (er) { - error = er; - }); - - assert(this._handle, 'zlib binding closed'); - do { - var res = this._handle.writeSync(flushFlag, chunk, // in - inOff, // in_off - availInBefore, // in_len - this._buffer, // out - this._offset, //out_off - availOutBefore); // out_len - } while (!this._hadError && callback(res[0], res[1])); - - if (this._hadError) { - throw error; - } - - if (nread >= kMaxLength) { - _close(this); - throw new RangeError(kRangeErrorMessage); - } - - var buf = Buffer.concat(buffers, nread); - _close(this); - - return buf; - } - - assert(this._handle, 'zlib binding closed'); - var req = this._handle.write(flushFlag, chunk, // in - inOff, // in_off - availInBefore, // in_len - this._buffer, // out - this._offset, //out_off - availOutBefore); // out_len - - req.buffer = chunk; - req.callback = callback; - - function callback(availInAfter, availOutAfter) { - // When the callback is used in an async write, the callback's - // context is the `req` object that was created. The req object - // is === this._handle, and that's why it's important to null - // out the values after they are done being used. `this._handle` - // can stay in memory longer than the callback and buffer are needed. - if (this) { - this.buffer = null; - this.callback = null; - } - - if (self._hadError) return; - - var have = availOutBefore - availOutAfter; - assert(have >= 0, 'have should not go down'); - - if (have > 0) { - var out = self._buffer.slice(self._offset, self._offset + have); - self._offset += have; - // serve some output to the consumer. - if (async) { - self.push(out); - } else { - buffers.push(out); - nread += out.length; - } - } - - // exhausted the output buffer, or used all the input create a new one. - if (availOutAfter === 0 || self._offset >= self._chunkSize) { - availOutBefore = self._chunkSize; - self._offset = 0; - self._buffer = Buffer.allocUnsafe(self._chunkSize); - } - - if (availOutAfter === 0) { - // Not actually done. Need to reprocess. - // Also, update the availInBefore to the availInAfter value, - // so that if we have to hit it a third (fourth, etc.) time, - // it'll have the correct byte counts. - inOff += availInBefore - availInAfter; - availInBefore = availInAfter; - - if (!async) return true; - - var newReq = self._handle.write(flushFlag, chunk, inOff, availInBefore, self._buffer, self._offset, self._chunkSize); - newReq.callback = callback; // this same function - newReq.buffer = chunk; - return; - } - - if (!async) return false; - - // finished with the chunk. - cb(); - } -}; - -util.inherits(Deflate, Zlib); -util.inherits(Inflate, Zlib); -util.inherits(Gzip, Zlib); -util.inherits(Gunzip, Zlib); -util.inherits(DeflateRaw, Zlib); -util.inherits(InflateRaw, Zlib); -util.inherits(Unzip, Zlib); -}).call(this,require('_process')) -},{"./binding":34,"_process":133,"assert":25,"buffer":48,"stream":155,"util":186}],36:[function(require,module,exports){ -'use strict'; - - -var TYPED_OK = (typeof Uint8Array !== 'undefined') && - (typeof Uint16Array !== 'undefined') && - (typeof Int32Array !== 'undefined'); - -function _has(obj, key) { - return Object.prototype.hasOwnProperty.call(obj, key); -} - -exports.assign = function (obj /*from1, from2, from3, ...*/) { - var sources = Array.prototype.slice.call(arguments, 1); - while (sources.length) { - var source = sources.shift(); - if (!source) { continue; } - - if (typeof source !== 'object') { - throw new TypeError(source + 'must be non-object'); - } - - for (var p in source) { - if (_has(source, p)) { - obj[p] = source[p]; - } - } - } - - return obj; -}; - - -// reduce buffer size, avoiding mem copy -exports.shrinkBuf = function (buf, size) { - if (buf.length === size) { return buf; } - if (buf.subarray) { return buf.subarray(0, size); } - buf.length = size; - return buf; -}; - - -var fnTyped = { - arraySet: function (dest, src, src_offs, len, dest_offs) { - if (src.subarray && dest.subarray) { - dest.set(src.subarray(src_offs, src_offs + len), dest_offs); - return; - } - // Fallback to ordinary array - for (var i = 0; i < len; i++) { - dest[dest_offs + i] = src[src_offs + i]; - } - }, - // Join array of chunks to single array. - flattenChunks: function (chunks) { - var i, l, len, pos, chunk, result; - - // calculate data length - len = 0; - for (i = 0, l = chunks.length; i < l; i++) { - len += chunks[i].length; - } - - // join chunks - result = new Uint8Array(len); - pos = 0; - for (i = 0, l = chunks.length; i < l; i++) { - chunk = chunks[i]; - result.set(chunk, pos); - pos += chunk.length; - } - - return result; - } -}; - -var fnUntyped = { - arraySet: function (dest, src, src_offs, len, dest_offs) { - for (var i = 0; i < len; i++) { - dest[dest_offs + i] = src[src_offs + i]; - } - }, - // Join array of chunks to single array. - flattenChunks: function (chunks) { - return [].concat.apply([], chunks); - } -}; - - -// Enable/Disable typed arrays use, for testing -// -exports.setTyped = function (on) { - if (on) { - exports.Buf8 = Uint8Array; - exports.Buf16 = Uint16Array; - exports.Buf32 = Int32Array; - exports.assign(exports, fnTyped); - } else { - exports.Buf8 = Array; - exports.Buf16 = Array; - exports.Buf32 = Array; - exports.assign(exports, fnUntyped); - } -}; - -exports.setTyped(TYPED_OK); - -},{}],37:[function(require,module,exports){ -'use strict'; - -// Note: adler32 takes 12% for level 0 and 2% for level 6. -// It isn't worth it to make additional optimizations as in original. -// Small size is preferable. - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -function adler32(adler, buf, len, pos) { - var s1 = (adler & 0xffff) |0, - s2 = ((adler >>> 16) & 0xffff) |0, - n = 0; - - while (len !== 0) { - // Set limit ~ twice less than 5552, to keep - // s2 in 31-bits, because we force signed ints. - // in other case %= will fail. - n = len > 2000 ? 2000 : len; - len -= n; - - do { - s1 = (s1 + buf[pos++]) |0; - s2 = (s2 + s1) |0; - } while (--n); - - s1 %= 65521; - s2 %= 65521; - } - - return (s1 | (s2 << 16)) |0; -} - - -module.exports = adler32; - -},{}],38:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -module.exports = { - - /* Allowed flush values; see deflate() and inflate() below for details */ - Z_NO_FLUSH: 0, - Z_PARTIAL_FLUSH: 1, - Z_SYNC_FLUSH: 2, - Z_FULL_FLUSH: 3, - Z_FINISH: 4, - Z_BLOCK: 5, - Z_TREES: 6, - - /* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ - Z_OK: 0, - Z_STREAM_END: 1, - Z_NEED_DICT: 2, - Z_ERRNO: -1, - Z_STREAM_ERROR: -2, - Z_DATA_ERROR: -3, - //Z_MEM_ERROR: -4, - Z_BUF_ERROR: -5, - //Z_VERSION_ERROR: -6, - - /* compression levels */ - Z_NO_COMPRESSION: 0, - Z_BEST_SPEED: 1, - Z_BEST_COMPRESSION: 9, - Z_DEFAULT_COMPRESSION: -1, - - - Z_FILTERED: 1, - Z_HUFFMAN_ONLY: 2, - Z_RLE: 3, - Z_FIXED: 4, - Z_DEFAULT_STRATEGY: 0, - - /* Possible values of the data_type field (though see inflate()) */ - Z_BINARY: 0, - Z_TEXT: 1, - //Z_ASCII: 1, // = Z_TEXT (deprecated) - Z_UNKNOWN: 2, - - /* The deflate compression method */ - Z_DEFLATED: 8 - //Z_NULL: null // Use -1 or null inline, depending on var type -}; - -},{}],39:[function(require,module,exports){ -'use strict'; - -// Note: we can't get significant speed boost here. -// So write code to minimize size - no pregenerated tables -// and array tools dependencies. - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -// Use ordinary array, since untyped makes no boost here -function makeTable() { - var c, table = []; - - for (var n = 0; n < 256; n++) { - c = n; - for (var k = 0; k < 8; k++) { - c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); - } - table[n] = c; - } - - return table; -} - -// Create table on load. Just 255 signed longs. Not a problem. -var crcTable = makeTable(); - - -function crc32(crc, buf, len, pos) { - var t = crcTable, - end = pos + len; - - crc ^= -1; - - for (var i = pos; i < end; i++) { - crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; - } - - return (crc ^ (-1)); // >>> 0; -} - - -module.exports = crc32; - -},{}],40:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -var utils = require('../utils/common'); -var trees = require('./trees'); -var adler32 = require('./adler32'); -var crc32 = require('./crc32'); -var msg = require('./messages'); - -/* Public constants ==========================================================*/ -/* ===========================================================================*/ - - -/* Allowed flush values; see deflate() and inflate() below for details */ -var Z_NO_FLUSH = 0; -var Z_PARTIAL_FLUSH = 1; -//var Z_SYNC_FLUSH = 2; -var Z_FULL_FLUSH = 3; -var Z_FINISH = 4; -var Z_BLOCK = 5; -//var Z_TREES = 6; - - -/* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ -var Z_OK = 0; -var Z_STREAM_END = 1; -//var Z_NEED_DICT = 2; -//var Z_ERRNO = -1; -var Z_STREAM_ERROR = -2; -var Z_DATA_ERROR = -3; -//var Z_MEM_ERROR = -4; -var Z_BUF_ERROR = -5; -//var Z_VERSION_ERROR = -6; - - -/* compression levels */ -//var Z_NO_COMPRESSION = 0; -//var Z_BEST_SPEED = 1; -//var Z_BEST_COMPRESSION = 9; -var Z_DEFAULT_COMPRESSION = -1; - - -var Z_FILTERED = 1; -var Z_HUFFMAN_ONLY = 2; -var Z_RLE = 3; -var Z_FIXED = 4; -var Z_DEFAULT_STRATEGY = 0; - -/* Possible values of the data_type field (though see inflate()) */ -//var Z_BINARY = 0; -//var Z_TEXT = 1; -//var Z_ASCII = 1; // = Z_TEXT -var Z_UNKNOWN = 2; - - -/* The deflate compression method */ -var Z_DEFLATED = 8; - -/*============================================================================*/ - - -var MAX_MEM_LEVEL = 9; -/* Maximum value for memLevel in deflateInit2 */ -var MAX_WBITS = 15; -/* 32K LZ77 window */ -var DEF_MEM_LEVEL = 8; - - -var LENGTH_CODES = 29; -/* number of length codes, not counting the special END_BLOCK code */ -var LITERALS = 256; -/* number of literal bytes 0..255 */ -var L_CODES = LITERALS + 1 + LENGTH_CODES; -/* number of Literal or Length codes, including the END_BLOCK code */ -var D_CODES = 30; -/* number of distance codes */ -var BL_CODES = 19; -/* number of codes used to transfer the bit lengths */ -var HEAP_SIZE = 2 * L_CODES + 1; -/* maximum heap size */ -var MAX_BITS = 15; -/* All codes must not exceed MAX_BITS bits */ - -var MIN_MATCH = 3; -var MAX_MATCH = 258; -var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1); - -var PRESET_DICT = 0x20; - -var INIT_STATE = 42; -var EXTRA_STATE = 69; -var NAME_STATE = 73; -var COMMENT_STATE = 91; -var HCRC_STATE = 103; -var BUSY_STATE = 113; -var FINISH_STATE = 666; - -var BS_NEED_MORE = 1; /* block not completed, need more input or more output */ -var BS_BLOCK_DONE = 2; /* block flush performed */ -var BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */ -var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */ - -var OS_CODE = 0x03; // Unix :) . Don't detect, use this default. - -function err(strm, errorCode) { - strm.msg = msg[errorCode]; - return errorCode; -} - -function rank(f) { - return ((f) << 1) - ((f) > 4 ? 9 : 0); -} - -function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } - - -/* ========================================================================= - * Flush as much pending output as possible. All deflate() output goes - * through this function so some applications may wish to modify it - * to avoid allocating a large strm->output buffer and copying into it. - * (See also read_buf()). - */ -function flush_pending(strm) { - var s = strm.state; - - //_tr_flush_bits(s); - var len = s.pending; - if (len > strm.avail_out) { - len = strm.avail_out; - } - if (len === 0) { return; } - - utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out); - strm.next_out += len; - s.pending_out += len; - strm.total_out += len; - strm.avail_out -= len; - s.pending -= len; - if (s.pending === 0) { - s.pending_out = 0; - } -} - - -function flush_block_only(s, last) { - trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last); - s.block_start = s.strstart; - flush_pending(s.strm); -} - - -function put_byte(s, b) { - s.pending_buf[s.pending++] = b; -} - - -/* ========================================================================= - * Put a short in the pending buffer. The 16-bit value is put in MSB order. - * IN assertion: the stream state is correct and there is enough room in - * pending_buf. - */ -function putShortMSB(s, b) { -// put_byte(s, (Byte)(b >> 8)); -// put_byte(s, (Byte)(b & 0xff)); - s.pending_buf[s.pending++] = (b >>> 8) & 0xff; - s.pending_buf[s.pending++] = b & 0xff; -} - - -/* =========================================================================== - * Read a new buffer from the current input stream, update the adler32 - * and total number of bytes read. All deflate() input goes through - * this function so some applications may wish to modify it to avoid - * allocating a large strm->input buffer and copying from it. - * (See also flush_pending()). - */ -function read_buf(strm, buf, start, size) { - var len = strm.avail_in; - - if (len > size) { len = size; } - if (len === 0) { return 0; } - - strm.avail_in -= len; - - // zmemcpy(buf, strm->next_in, len); - utils.arraySet(buf, strm.input, strm.next_in, len, start); - if (strm.state.wrap === 1) { - strm.adler = adler32(strm.adler, buf, len, start); - } - - else if (strm.state.wrap === 2) { - strm.adler = crc32(strm.adler, buf, len, start); - } - - strm.next_in += len; - strm.total_in += len; - - return len; -} - - -/* =========================================================================== - * Set match_start to the longest match starting at the given string and - * return its length. Matches shorter or equal to prev_length are discarded, - * in which case the result is equal to prev_length and match_start is - * garbage. - * IN assertions: cur_match is the head of the hash chain for the current - * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 - * OUT assertion: the match length is not greater than s->lookahead. - */ -function longest_match(s, cur_match) { - var chain_length = s.max_chain_length; /* max hash chain length */ - var scan = s.strstart; /* current string */ - var match; /* matched string */ - var len; /* length of current match */ - var best_len = s.prev_length; /* best match length so far */ - var nice_match = s.nice_match; /* stop if match long enough */ - var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ? - s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/; - - var _win = s.window; // shortcut - - var wmask = s.w_mask; - var prev = s.prev; - - /* Stop when cur_match becomes <= limit. To simplify the code, - * we prevent matches with the string of window index 0. - */ - - var strend = s.strstart + MAX_MATCH; - var scan_end1 = _win[scan + best_len - 1]; - var scan_end = _win[scan + best_len]; - - /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. - * It is easy to get rid of this optimization if necessary. - */ - // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - - /* Do not waste too much time if we already have a good match: */ - if (s.prev_length >= s.good_match) { - chain_length >>= 2; - } - /* Do not look for matches beyond the end of the input. This is necessary - * to make deflate deterministic. - */ - if (nice_match > s.lookahead) { nice_match = s.lookahead; } - - // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); - - do { - // Assert(cur_match < s->strstart, "no future"); - match = cur_match; - - /* Skip to next match if the match length cannot increase - * or if the match length is less than 2. Note that the checks below - * for insufficient lookahead only occur occasionally for performance - * reasons. Therefore uninitialized memory will be accessed, and - * conditional jumps will be made that depend on those values. - * However the length of the match is limited to the lookahead, so - * the output of deflate is not affected by the uninitialized values. - */ - - if (_win[match + best_len] !== scan_end || - _win[match + best_len - 1] !== scan_end1 || - _win[match] !== _win[scan] || - _win[++match] !== _win[scan + 1]) { - continue; - } - - /* The check at best_len-1 can be removed because it will be made - * again later. (This heuristic is not always a win.) - * It is not necessary to compare scan[2] and match[2] since they - * are always equal when the other bytes match, given that - * the hash keys are equal and that HASH_BITS >= 8. - */ - scan += 2; - match++; - // Assert(*scan == *match, "match[2]?"); - - /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. - */ - do { - /*jshint noempty:false*/ - } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - scan < strend); - - // Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - - len = MAX_MATCH - (strend - scan); - scan = strend - MAX_MATCH; - - if (len > best_len) { - s.match_start = cur_match; - best_len = len; - if (len >= nice_match) { - break; - } - scan_end1 = _win[scan + best_len - 1]; - scan_end = _win[scan + best_len]; - } - } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0); - - if (best_len <= s.lookahead) { - return best_len; - } - return s.lookahead; -} - - -/* =========================================================================== - * Fill the window when the lookahead becomes insufficient. - * Updates strstart and lookahead. - * - * IN assertion: lookahead < MIN_LOOKAHEAD - * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD - * At least one byte has been read, or avail_in == 0; reads are - * performed for at least two bytes (required for the zip translate_eol - * option -- not supported here). - */ -function fill_window(s) { - var _w_size = s.w_size; - var p, n, m, more, str; - - //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); - - do { - more = s.window_size - s.lookahead - s.strstart; - - // JS ints have 32 bit, block below not needed - /* Deal with !@#$% 64K limit: */ - //if (sizeof(int) <= 2) { - // if (more == 0 && s->strstart == 0 && s->lookahead == 0) { - // more = wsize; - // - // } else if (more == (unsigned)(-1)) { - // /* Very unlikely, but possible on 16 bit machine if - // * strstart == 0 && lookahead == 1 (input done a byte at time) - // */ - // more--; - // } - //} - - - /* If the window is almost full and there is insufficient lookahead, - * move the upper half to the lower one to make room in the upper half. - */ - if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { - - utils.arraySet(s.window, s.window, _w_size, _w_size, 0); - s.match_start -= _w_size; - s.strstart -= _w_size; - /* we now have strstart >= MAX_DIST */ - s.block_start -= _w_size; - - /* Slide the hash table (could be avoided with 32 bit values - at the expense of memory usage). We slide even when level == 0 - to keep the hash table consistent if we switch back to level > 0 - later. (Using level 0 permanently is not an optimal usage of - zlib, so we don't care about this pathological case.) - */ - - n = s.hash_size; - p = n; - do { - m = s.head[--p]; - s.head[p] = (m >= _w_size ? m - _w_size : 0); - } while (--n); - - n = _w_size; - p = n; - do { - m = s.prev[--p]; - s.prev[p] = (m >= _w_size ? m - _w_size : 0); - /* If n is not on any hash chain, prev[n] is garbage but - * its value will never be used. - */ - } while (--n); - - more += _w_size; - } - if (s.strm.avail_in === 0) { - break; - } - - /* If there was no sliding: - * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && - * more == window_size - lookahead - strstart - * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) - * => more >= window_size - 2*WSIZE + 2 - * In the BIG_MEM or MMAP case (not yet supported), - * window_size == input_size + MIN_LOOKAHEAD && - * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. - * Otherwise, window_size == 2*WSIZE so more >= 2. - * If there was sliding, more >= WSIZE. So in all cases, more >= 2. - */ - //Assert(more >= 2, "more < 2"); - n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more); - s.lookahead += n; - - /* Initialize the hash value now that we have some input: */ - if (s.lookahead + s.insert >= MIN_MATCH) { - str = s.strstart - s.insert; - s.ins_h = s.window[str]; - - /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask; -//#if MIN_MATCH != 3 -// Call update_hash() MIN_MATCH-3 more times -//#endif - while (s.insert) { - /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; - - s.prev[str & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = str; - str++; - s.insert--; - if (s.lookahead + s.insert < MIN_MATCH) { - break; - } - } - } - /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, - * but this is not important since only literal bytes will be emitted. - */ - - } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); - - /* If the WIN_INIT bytes after the end of the current data have never been - * written, then zero those bytes in order to avoid memory check reports of - * the use of uninitialized (or uninitialised as Julian writes) bytes by - * the longest match routines. Update the high water mark for the next - * time through here. WIN_INIT is set to MAX_MATCH since the longest match - * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. - */ -// if (s.high_water < s.window_size) { -// var curr = s.strstart + s.lookahead; -// var init = 0; -// -// if (s.high_water < curr) { -// /* Previous high water mark below current data -- zero WIN_INIT -// * bytes or up to end of window, whichever is less. -// */ -// init = s.window_size - curr; -// if (init > WIN_INIT) -// init = WIN_INIT; -// zmemzero(s->window + curr, (unsigned)init); -// s->high_water = curr + init; -// } -// else if (s->high_water < (ulg)curr + WIN_INIT) { -// /* High water mark at or above current data, but below current data -// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up -// * to end of window, whichever is less. -// */ -// init = (ulg)curr + WIN_INIT - s->high_water; -// if (init > s->window_size - s->high_water) -// init = s->window_size - s->high_water; -// zmemzero(s->window + s->high_water, (unsigned)init); -// s->high_water += init; -// } -// } -// -// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, -// "not enough room for search"); -} - -/* =========================================================================== - * Copy without compression as much as possible from the input stream, return - * the current block state. - * This function does not insert new strings in the dictionary since - * uncompressible data is probably not useful. This function is used - * only for the level=0 compression option. - * NOTE: this function should be optimized to avoid extra copying from - * window to pending_buf. - */ -function deflate_stored(s, flush) { - /* Stored blocks are limited to 0xffff bytes, pending_buf is limited - * to pending_buf_size, and each stored block has a 5 byte header: - */ - var max_block_size = 0xffff; - - if (max_block_size > s.pending_buf_size - 5) { - max_block_size = s.pending_buf_size - 5; - } - - /* Copy as much as possible from input to output: */ - for (;;) { - /* Fill the window as much as possible: */ - if (s.lookahead <= 1) { - - //Assert(s->strstart < s->w_size+MAX_DIST(s) || - // s->block_start >= (long)s->w_size, "slide too late"); -// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) || -// s.block_start >= s.w_size)) { -// throw new Error("slide too late"); -// } - - fill_window(s); - if (s.lookahead === 0 && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - - if (s.lookahead === 0) { - break; - } - /* flush the current block */ - } - //Assert(s->block_start >= 0L, "block gone"); -// if (s.block_start < 0) throw new Error("block gone"); - - s.strstart += s.lookahead; - s.lookahead = 0; - - /* Emit a stored block if pending_buf will be full: */ - var max_start = s.block_start + max_block_size; - - if (s.strstart === 0 || s.strstart >= max_start) { - /* strstart == 0 is possible when wraparound on 16-bit machine */ - s.lookahead = s.strstart - max_start; - s.strstart = max_start; - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - - - } - /* Flush if we may have to slide, otherwise block_start may become - * negative and the data will be gone: - */ - if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - - s.insert = 0; - - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - - if (s.strstart > s.block_start) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - - return BS_NEED_MORE; -} - -/* =========================================================================== - * Compress as much as possible from the input stream, return the current - * block state. - * This function does not perform lazy evaluation of matches and inserts - * new strings in the dictionary only for unmatched strings or for short - * matches. It is used only for the fast compression options. - */ -function deflate_fast(s, flush) { - var hash_head; /* head of the hash chain */ - var bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s.lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { - break; /* flush the current block */ - } - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - hash_head = 0/*NIL*/; - if (s.lookahead >= MIN_MATCH) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - - /* Find the longest match, discarding those <= prev_length. - * At this point we have always match_length < MIN_MATCH - */ - if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - s.match_length = longest_match(s, hash_head); - /* longest_match() sets match_start */ - } - if (s.match_length >= MIN_MATCH) { - // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only - - /*** _tr_tally_dist(s, s.strstart - s.match_start, - s.match_length - MIN_MATCH, bflush); ***/ - bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH); - - s.lookahead -= s.match_length; - - /* Insert new strings in the hash table only if the match length - * is not too large. This saves time but degrades compression. - */ - if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) { - s.match_length--; /* string at strstart already in table */ - do { - s.strstart++; - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - /* strstart never exceeds WSIZE-MAX_MATCH, so there are - * always MIN_MATCH bytes ahead. - */ - } while (--s.match_length !== 0); - s.strstart++; - } else - { - s.strstart += s.match_length; - s.match_length = 0; - s.ins_h = s.window[s.strstart]; - /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask; - -//#if MIN_MATCH != 3 -// Call UPDATE_HASH() MIN_MATCH-3 more times -//#endif - /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not - * matter since it will be recomputed at next deflate call. - */ - } - } else { - /* No match, output a literal byte */ - //Tracevv((stderr,"%c", s.window[s.strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - - s.lookahead--; - s.strstart++; - } - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1); - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; -} - -/* =========================================================================== - * Same as above, but achieves better compression. We use a lazy - * evaluation for matches: a match is finally adopted only if there is - * no better match at the next window position. - */ -function deflate_slow(s, flush) { - var hash_head; /* head of hash chain */ - var bflush; /* set if current block must be flushed */ - - var max_insert; - - /* Process the input block. */ - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s.lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { break; } /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - hash_head = 0/*NIL*/; - if (s.lookahead >= MIN_MATCH) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - - /* Find the longest match, discarding those <= prev_length. - */ - s.prev_length = s.match_length; - s.prev_match = s.match_start; - s.match_length = MIN_MATCH - 1; - - if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match && - s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - s.match_length = longest_match(s, hash_head); - /* longest_match() sets match_start */ - - if (s.match_length <= 5 && - (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) { - - /* If prev_match is also MIN_MATCH, match_start is garbage - * but we will ignore the current match anyway. - */ - s.match_length = MIN_MATCH - 1; - } - } - /* If there was a match at the previous step and the current - * match is not better, output the previous match: - */ - if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { - max_insert = s.strstart + s.lookahead - MIN_MATCH; - /* Do not insert strings in hash table beyond this. */ - - //check_match(s, s.strstart-1, s.prev_match, s.prev_length); - - /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match, - s.prev_length - MIN_MATCH, bflush);***/ - bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH); - /* Insert in hash table all strings up to the end of the match. - * strstart-1 and strstart are already inserted. If there is not - * enough lookahead, the last two strings are not inserted in - * the hash table. - */ - s.lookahead -= s.prev_length - 1; - s.prev_length -= 2; - do { - if (++s.strstart <= max_insert) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - } while (--s.prev_length !== 0); - s.match_available = 0; - s.match_length = MIN_MATCH - 1; - s.strstart++; - - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - - } else if (s.match_available) { - /* If there was no match at the previous position, output a - * single literal. If there was a match but the current match - * is longer, truncate the previous match to a single literal. - */ - //Tracevv((stderr,"%c", s->window[s->strstart-1])); - /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); - - if (bflush) { - /*** FLUSH_BLOCK_ONLY(s, 0) ***/ - flush_block_only(s, false); - /***/ - } - s.strstart++; - s.lookahead--; - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } else { - /* There is no previous match to compare with, wait for - * the next step to decide. - */ - s.match_available = 1; - s.strstart++; - s.lookahead--; - } - } - //Assert (flush != Z_NO_FLUSH, "no flush?"); - if (s.match_available) { - //Tracevv((stderr,"%c", s->window[s->strstart-1])); - /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); - - s.match_available = 0; - } - s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - - return BS_BLOCK_DONE; -} - - -/* =========================================================================== - * For Z_RLE, simply look for runs of bytes, generate matches only of distance - * one. Do not maintain a hash table. (It will be regenerated if this run of - * deflate switches away from Z_RLE.) - */ -function deflate_rle(s, flush) { - var bflush; /* set if current block must be flushed */ - var prev; /* byte at distance one to match */ - var scan, strend; /* scan goes up to strend for length of run */ - - var _win = s.window; - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the longest run, plus one for the unrolled loop. - */ - if (s.lookahead <= MAX_MATCH) { - fill_window(s); - if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { break; } /* flush the current block */ - } - - /* See how many times the previous byte repeats */ - s.match_length = 0; - if (s.lookahead >= MIN_MATCH && s.strstart > 0) { - scan = s.strstart - 1; - prev = _win[scan]; - if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) { - strend = s.strstart + MAX_MATCH; - do { - /*jshint noempty:false*/ - } while (prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - scan < strend); - s.match_length = MAX_MATCH - (strend - scan); - if (s.match_length > s.lookahead) { - s.match_length = s.lookahead; - } - } - //Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); - } - - /* Emit match if have run of MIN_MATCH or longer, else emit literal */ - if (s.match_length >= MIN_MATCH) { - //check_match(s, s.strstart, s.strstart - 1, s.match_length); - - /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/ - bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH); - - s.lookahead -= s.match_length; - s.strstart += s.match_length; - s.match_length = 0; - } else { - /* No match, output a literal byte */ - //Tracevv((stderr,"%c", s->window[s->strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - - s.lookahead--; - s.strstart++; - } - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = 0; - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; -} - -/* =========================================================================== - * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. - * (It will be regenerated if this run of deflate switches away from Huffman.) - */ -function deflate_huff(s, flush) { - var bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we have a literal to write. */ - if (s.lookahead === 0) { - fill_window(s); - if (s.lookahead === 0) { - if (flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - break; /* flush the current block */ - } - } - - /* Output a literal byte */ - s.match_length = 0; - //Tracevv((stderr,"%c", s->window[s->strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - s.lookahead--; - s.strstart++; - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = 0; - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; -} - -/* Values for max_lazy_match, good_match and max_chain_length, depending on - * the desired pack level (0..9). The values given below have been tuned to - * exclude worst case performance for pathological files. Better values may be - * found for specific files. - */ -function Config(good_length, max_lazy, nice_length, max_chain, func) { - this.good_length = good_length; - this.max_lazy = max_lazy; - this.nice_length = nice_length; - this.max_chain = max_chain; - this.func = func; -} - -var configuration_table; - -configuration_table = [ - /* good lazy nice chain */ - new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */ - new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */ - new Config(4, 5, 16, 8, deflate_fast), /* 2 */ - new Config(4, 6, 32, 32, deflate_fast), /* 3 */ - - new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */ - new Config(8, 16, 32, 32, deflate_slow), /* 5 */ - new Config(8, 16, 128, 128, deflate_slow), /* 6 */ - new Config(8, 32, 128, 256, deflate_slow), /* 7 */ - new Config(32, 128, 258, 1024, deflate_slow), /* 8 */ - new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */ -]; - - -/* =========================================================================== - * Initialize the "longest match" routines for a new zlib stream - */ -function lm_init(s) { - s.window_size = 2 * s.w_size; - - /*** CLEAR_HASH(s); ***/ - zero(s.head); // Fill with NIL (= 0); - - /* Set the default configuration parameters: - */ - s.max_lazy_match = configuration_table[s.level].max_lazy; - s.good_match = configuration_table[s.level].good_length; - s.nice_match = configuration_table[s.level].nice_length; - s.max_chain_length = configuration_table[s.level].max_chain; - - s.strstart = 0; - s.block_start = 0; - s.lookahead = 0; - s.insert = 0; - s.match_length = s.prev_length = MIN_MATCH - 1; - s.match_available = 0; - s.ins_h = 0; -} - - -function DeflateState() { - this.strm = null; /* pointer back to this zlib stream */ - this.status = 0; /* as the name implies */ - this.pending_buf = null; /* output still pending */ - this.pending_buf_size = 0; /* size of pending_buf */ - this.pending_out = 0; /* next pending byte to output to the stream */ - this.pending = 0; /* nb of bytes in the pending buffer */ - this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ - this.gzhead = null; /* gzip header information to write */ - this.gzindex = 0; /* where in extra, name, or comment */ - this.method = Z_DEFLATED; /* can only be DEFLATED */ - this.last_flush = -1; /* value of flush param for previous deflate call */ - - this.w_size = 0; /* LZ77 window size (32K by default) */ - this.w_bits = 0; /* log2(w_size) (8..16) */ - this.w_mask = 0; /* w_size - 1 */ - - this.window = null; - /* Sliding window. Input bytes are read into the second half of the window, - * and move to the first half later to keep a dictionary of at least wSize - * bytes. With this organization, matches are limited to a distance of - * wSize-MAX_MATCH bytes, but this ensures that IO is always - * performed with a length multiple of the block size. - */ - - this.window_size = 0; - /* Actual size of window: 2*wSize, except when the user input buffer - * is directly used as sliding window. - */ - - this.prev = null; - /* Link to older string with same hash index. To limit the size of this - * array to 64K, this link is maintained only for the last 32K strings. - * An index in this array is thus a window index modulo 32K. - */ - - this.head = null; /* Heads of the hash chains or NIL. */ - - this.ins_h = 0; /* hash index of string to be inserted */ - this.hash_size = 0; /* number of elements in hash table */ - this.hash_bits = 0; /* log2(hash_size) */ - this.hash_mask = 0; /* hash_size-1 */ - - this.hash_shift = 0; - /* Number of bits by which ins_h must be shifted at each input - * step. It must be such that after MIN_MATCH steps, the oldest - * byte no longer takes part in the hash key, that is: - * hash_shift * MIN_MATCH >= hash_bits - */ - - this.block_start = 0; - /* Window position at the beginning of the current output block. Gets - * negative when the window is moved backwards. - */ - - this.match_length = 0; /* length of best match */ - this.prev_match = 0; /* previous match */ - this.match_available = 0; /* set if previous match exists */ - this.strstart = 0; /* start of string to insert */ - this.match_start = 0; /* start of matching string */ - this.lookahead = 0; /* number of valid bytes ahead in window */ - - this.prev_length = 0; - /* Length of the best match at previous step. Matches not greater than this - * are discarded. This is used in the lazy match evaluation. - */ - - this.max_chain_length = 0; - /* To speed up deflation, hash chains are never searched beyond this - * length. A higher limit improves compression ratio but degrades the - * speed. - */ - - this.max_lazy_match = 0; - /* Attempt to find a better match only when the current match is strictly - * smaller than this value. This mechanism is used only for compression - * levels >= 4. - */ - // That's alias to max_lazy_match, don't use directly - //this.max_insert_length = 0; - /* Insert new strings in the hash table only if the match length is not - * greater than this length. This saves time but degrades compression. - * max_insert_length is used only for compression levels <= 3. - */ - - this.level = 0; /* compression level (1..9) */ - this.strategy = 0; /* favor or force Huffman coding*/ - - this.good_match = 0; - /* Use a faster search when the previous match is longer than this */ - - this.nice_match = 0; /* Stop searching when current match exceeds this */ - - /* used by trees.c: */ - - /* Didn't use ct_data typedef below to suppress compiler warning */ - - // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ - // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ - // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ - - // Use flat array of DOUBLE size, with interleaved fata, - // because JS does not support effective - this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2); - this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2); - this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2); - zero(this.dyn_ltree); - zero(this.dyn_dtree); - zero(this.bl_tree); - - this.l_desc = null; /* desc. for literal tree */ - this.d_desc = null; /* desc. for distance tree */ - this.bl_desc = null; /* desc. for bit length tree */ - - //ush bl_count[MAX_BITS+1]; - this.bl_count = new utils.Buf16(MAX_BITS + 1); - /* number of codes at each bit length for an optimal tree */ - - //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ - this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */ - zero(this.heap); - - this.heap_len = 0; /* number of elements in the heap */ - this.heap_max = 0; /* element of largest frequency */ - /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. - * The same heap array is used to build all trees. - */ - - this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1]; - zero(this.depth); - /* Depth of each subtree used as tie breaker for trees of equal frequency - */ - - this.l_buf = 0; /* buffer index for literals or lengths */ - - this.lit_bufsize = 0; - /* Size of match buffer for literals/lengths. There are 4 reasons for - * limiting lit_bufsize to 64K: - * - frequencies can be kept in 16 bit counters - * - if compression is not successful for the first block, all input - * data is still in the window so we can still emit a stored block even - * when input comes from standard input. (This can also be done for - * all blocks if lit_bufsize is not greater than 32K.) - * - if compression is not successful for a file smaller than 64K, we can - * even emit a stored file instead of a stored block (saving 5 bytes). - * This is applicable only for zip (not gzip or zlib). - * - creating new Huffman trees less frequently may not provide fast - * adaptation to changes in the input data statistics. (Take for - * example a binary file with poorly compressible code followed by - * a highly compressible string table.) Smaller buffer sizes give - * fast adaptation but have of course the overhead of transmitting - * trees more frequently. - * - I can't count above 4 - */ - - this.last_lit = 0; /* running index in l_buf */ - - this.d_buf = 0; - /* Buffer index for distances. To simplify the code, d_buf and l_buf have - * the same number of elements. To use different lengths, an extra flag - * array would be necessary. - */ - - this.opt_len = 0; /* bit length of current block with optimal trees */ - this.static_len = 0; /* bit length of current block with static trees */ - this.matches = 0; /* number of string matches in current block */ - this.insert = 0; /* bytes at end of window left to insert */ - - - this.bi_buf = 0; - /* Output buffer. bits are inserted starting at the bottom (least - * significant bits). - */ - this.bi_valid = 0; - /* Number of valid bits in bi_buf. All bits above the last valid bit - * are always zero. - */ - - // Used for window memory init. We safely ignore it for JS. That makes - // sense only for pointers and memory check tools. - //this.high_water = 0; - /* High water mark offset in window for initialized bytes -- bytes above - * this are set to zero in order to avoid memory check warnings when - * longest match routines access bytes past the input. This is then - * updated to the new high water mark. - */ -} - - -function deflateResetKeep(strm) { - var s; - - if (!strm || !strm.state) { - return err(strm, Z_STREAM_ERROR); - } - - strm.total_in = strm.total_out = 0; - strm.data_type = Z_UNKNOWN; - - s = strm.state; - s.pending = 0; - s.pending_out = 0; - - if (s.wrap < 0) { - s.wrap = -s.wrap; - /* was made negative by deflate(..., Z_FINISH); */ - } - s.status = (s.wrap ? INIT_STATE : BUSY_STATE); - strm.adler = (s.wrap === 2) ? - 0 // crc32(0, Z_NULL, 0) - : - 1; // adler32(0, Z_NULL, 0) - s.last_flush = Z_NO_FLUSH; - trees._tr_init(s); - return Z_OK; -} - - -function deflateReset(strm) { - var ret = deflateResetKeep(strm); - if (ret === Z_OK) { - lm_init(strm.state); - } - return ret; -} - - -function deflateSetHeader(strm, head) { - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; } - strm.state.gzhead = head; - return Z_OK; -} - - -function deflateInit2(strm, level, method, windowBits, memLevel, strategy) { - if (!strm) { // === Z_NULL - return Z_STREAM_ERROR; - } - var wrap = 1; - - if (level === Z_DEFAULT_COMPRESSION) { - level = 6; - } - - if (windowBits < 0) { /* suppress zlib wrapper */ - wrap = 0; - windowBits = -windowBits; - } - - else if (windowBits > 15) { - wrap = 2; /* write gzip wrapper instead */ - windowBits -= 16; - } - - - if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || - windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || - strategy < 0 || strategy > Z_FIXED) { - return err(strm, Z_STREAM_ERROR); - } - - - if (windowBits === 8) { - windowBits = 9; - } - /* until 256-byte window bug fixed */ - - var s = new DeflateState(); - - strm.state = s; - s.strm = strm; - - s.wrap = wrap; - s.gzhead = null; - s.w_bits = windowBits; - s.w_size = 1 << s.w_bits; - s.w_mask = s.w_size - 1; - - s.hash_bits = memLevel + 7; - s.hash_size = 1 << s.hash_bits; - s.hash_mask = s.hash_size - 1; - s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH); - - s.window = new utils.Buf8(s.w_size * 2); - s.head = new utils.Buf16(s.hash_size); - s.prev = new utils.Buf16(s.w_size); - - // Don't need mem init magic for JS. - //s.high_water = 0; /* nothing written to s->window yet */ - - s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ - - s.pending_buf_size = s.lit_bufsize * 4; - - //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); - //s->pending_buf = (uchf *) overlay; - s.pending_buf = new utils.Buf8(s.pending_buf_size); - - // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`) - //s->d_buf = overlay + s->lit_bufsize/sizeof(ush); - s.d_buf = 1 * s.lit_bufsize; - - //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; - s.l_buf = (1 + 2) * s.lit_bufsize; - - s.level = level; - s.strategy = strategy; - s.method = method; - - return deflateReset(strm); -} - -function deflateInit(strm, level) { - return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); -} - - -function deflate(strm, flush) { - var old_flush, s; - var beg, val; // for gzip header write only - - if (!strm || !strm.state || - flush > Z_BLOCK || flush < 0) { - return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR; - } - - s = strm.state; - - if (!strm.output || - (!strm.input && strm.avail_in !== 0) || - (s.status === FINISH_STATE && flush !== Z_FINISH)) { - return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR); - } - - s.strm = strm; /* just in case */ - old_flush = s.last_flush; - s.last_flush = flush; - - /* Write the header */ - if (s.status === INIT_STATE) { - - if (s.wrap === 2) { // GZIP header - strm.adler = 0; //crc32(0L, Z_NULL, 0); - put_byte(s, 31); - put_byte(s, 139); - put_byte(s, 8); - if (!s.gzhead) { // s->gzhead == Z_NULL - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, s.level === 9 ? 2 : - (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? - 4 : 0)); - put_byte(s, OS_CODE); - s.status = BUSY_STATE; - } - else { - put_byte(s, (s.gzhead.text ? 1 : 0) + - (s.gzhead.hcrc ? 2 : 0) + - (!s.gzhead.extra ? 0 : 4) + - (!s.gzhead.name ? 0 : 8) + - (!s.gzhead.comment ? 0 : 16) - ); - put_byte(s, s.gzhead.time & 0xff); - put_byte(s, (s.gzhead.time >> 8) & 0xff); - put_byte(s, (s.gzhead.time >> 16) & 0xff); - put_byte(s, (s.gzhead.time >> 24) & 0xff); - put_byte(s, s.level === 9 ? 2 : - (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? - 4 : 0)); - put_byte(s, s.gzhead.os & 0xff); - if (s.gzhead.extra && s.gzhead.extra.length) { - put_byte(s, s.gzhead.extra.length & 0xff); - put_byte(s, (s.gzhead.extra.length >> 8) & 0xff); - } - if (s.gzhead.hcrc) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0); - } - s.gzindex = 0; - s.status = EXTRA_STATE; - } - } - else // DEFLATE header - { - var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8; - var level_flags = -1; - - if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) { - level_flags = 0; - } else if (s.level < 6) { - level_flags = 1; - } else if (s.level === 6) { - level_flags = 2; - } else { - level_flags = 3; - } - header |= (level_flags << 6); - if (s.strstart !== 0) { header |= PRESET_DICT; } - header += 31 - (header % 31); - - s.status = BUSY_STATE; - putShortMSB(s, header); - - /* Save the adler32 of the preset dictionary: */ - if (s.strstart !== 0) { - putShortMSB(s, strm.adler >>> 16); - putShortMSB(s, strm.adler & 0xffff); - } - strm.adler = 1; // adler32(0L, Z_NULL, 0); - } - } - -//#ifdef GZIP - if (s.status === EXTRA_STATE) { - if (s.gzhead.extra/* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - - while (s.gzindex < (s.gzhead.extra.length & 0xffff)) { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - break; - } - } - put_byte(s, s.gzhead.extra[s.gzindex] & 0xff); - s.gzindex++; - } - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (s.gzindex === s.gzhead.extra.length) { - s.gzindex = 0; - s.status = NAME_STATE; - } - } - else { - s.status = NAME_STATE; - } - } - if (s.status === NAME_STATE) { - if (s.gzhead.name/* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - //int val; - - do { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - val = 1; - break; - } - } - // JS specific: little magic to add zero terminator to end of string - if (s.gzindex < s.gzhead.name.length) { - val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff; - } else { - val = 0; - } - put_byte(s, val); - } while (val !== 0); - - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (val === 0) { - s.gzindex = 0; - s.status = COMMENT_STATE; - } - } - else { - s.status = COMMENT_STATE; - } - } - if (s.status === COMMENT_STATE) { - if (s.gzhead.comment/* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - //int val; - - do { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - val = 1; - break; - } - } - // JS specific: little magic to add zero terminator to end of string - if (s.gzindex < s.gzhead.comment.length) { - val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff; - } else { - val = 0; - } - put_byte(s, val); - } while (val !== 0); - - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (val === 0) { - s.status = HCRC_STATE; - } - } - else { - s.status = HCRC_STATE; - } - } - if (s.status === HCRC_STATE) { - if (s.gzhead.hcrc) { - if (s.pending + 2 > s.pending_buf_size) { - flush_pending(strm); - } - if (s.pending + 2 <= s.pending_buf_size) { - put_byte(s, strm.adler & 0xff); - put_byte(s, (strm.adler >> 8) & 0xff); - strm.adler = 0; //crc32(0L, Z_NULL, 0); - s.status = BUSY_STATE; - } - } - else { - s.status = BUSY_STATE; - } - } -//#endif - - /* Flush as much pending output as possible */ - if (s.pending !== 0) { - flush_pending(strm); - if (strm.avail_out === 0) { - /* Since avail_out is 0, deflate will be called again with - * more output space, but possibly with both pending and - * avail_in equal to zero. There won't be anything to do, - * but this is not an error situation so make sure we - * return OK instead of BUF_ERROR at next call of deflate: - */ - s.last_flush = -1; - return Z_OK; - } - - /* Make sure there is something to do and avoid duplicate consecutive - * flushes. For repeated and useless calls with Z_FINISH, we keep - * returning Z_STREAM_END instead of Z_BUF_ERROR. - */ - } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && - flush !== Z_FINISH) { - return err(strm, Z_BUF_ERROR); - } - - /* User must not provide more input after the first FINISH: */ - if (s.status === FINISH_STATE && strm.avail_in !== 0) { - return err(strm, Z_BUF_ERROR); - } - - /* Start a new block or continue the current one. - */ - if (strm.avail_in !== 0 || s.lookahead !== 0 || - (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) { - var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) : - (s.strategy === Z_RLE ? deflate_rle(s, flush) : - configuration_table[s.level].func(s, flush)); - - if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) { - s.status = FINISH_STATE; - } - if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) { - if (strm.avail_out === 0) { - s.last_flush = -1; - /* avoid BUF_ERROR next call, see above */ - } - return Z_OK; - /* If flush != Z_NO_FLUSH && avail_out == 0, the next call - * of deflate should use the same flush parameter to make sure - * that the flush is complete. So we don't have to output an - * empty block here, this will be done at next call. This also - * ensures that for a very small output buffer, we emit at most - * one empty block. - */ - } - if (bstate === BS_BLOCK_DONE) { - if (flush === Z_PARTIAL_FLUSH) { - trees._tr_align(s); - } - else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ - - trees._tr_stored_block(s, 0, 0, false); - /* For a full flush, this empty block will be recognized - * as a special marker by inflate_sync(). - */ - if (flush === Z_FULL_FLUSH) { - /*** CLEAR_HASH(s); ***/ /* forget history */ - zero(s.head); // Fill with NIL (= 0); - - if (s.lookahead === 0) { - s.strstart = 0; - s.block_start = 0; - s.insert = 0; - } - } - } - flush_pending(strm); - if (strm.avail_out === 0) { - s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */ - return Z_OK; - } - } - } - //Assert(strm->avail_out > 0, "bug2"); - //if (strm.avail_out <= 0) { throw new Error("bug2");} - - if (flush !== Z_FINISH) { return Z_OK; } - if (s.wrap <= 0) { return Z_STREAM_END; } - - /* Write the trailer */ - if (s.wrap === 2) { - put_byte(s, strm.adler & 0xff); - put_byte(s, (strm.adler >> 8) & 0xff); - put_byte(s, (strm.adler >> 16) & 0xff); - put_byte(s, (strm.adler >> 24) & 0xff); - put_byte(s, strm.total_in & 0xff); - put_byte(s, (strm.total_in >> 8) & 0xff); - put_byte(s, (strm.total_in >> 16) & 0xff); - put_byte(s, (strm.total_in >> 24) & 0xff); - } - else - { - putShortMSB(s, strm.adler >>> 16); - putShortMSB(s, strm.adler & 0xffff); - } - - flush_pending(strm); - /* If avail_out is zero, the application will call deflate again - * to flush the rest. - */ - if (s.wrap > 0) { s.wrap = -s.wrap; } - /* write the trailer only once! */ - return s.pending !== 0 ? Z_OK : Z_STREAM_END; -} - -function deflateEnd(strm) { - var status; - - if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { - return Z_STREAM_ERROR; - } - - status = strm.state.status; - if (status !== INIT_STATE && - status !== EXTRA_STATE && - status !== NAME_STATE && - status !== COMMENT_STATE && - status !== HCRC_STATE && - status !== BUSY_STATE && - status !== FINISH_STATE - ) { - return err(strm, Z_STREAM_ERROR); - } - - strm.state = null; - - return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK; -} - - -/* ========================================================================= - * Initializes the compression dictionary from the given byte - * sequence without producing any compressed output. - */ -function deflateSetDictionary(strm, dictionary) { - var dictLength = dictionary.length; - - var s; - var str, n; - var wrap; - var avail; - var next; - var input; - var tmpDict; - - if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { - return Z_STREAM_ERROR; - } - - s = strm.state; - wrap = s.wrap; - - if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) { - return Z_STREAM_ERROR; - } - - /* when using zlib wrappers, compute Adler-32 for provided dictionary */ - if (wrap === 1) { - /* adler32(strm->adler, dictionary, dictLength); */ - strm.adler = adler32(strm.adler, dictionary, dictLength, 0); - } - - s.wrap = 0; /* avoid computing Adler-32 in read_buf */ - - /* if dictionary would fill window, just replace the history */ - if (dictLength >= s.w_size) { - if (wrap === 0) { /* already empty otherwise */ - /*** CLEAR_HASH(s); ***/ - zero(s.head); // Fill with NIL (= 0); - s.strstart = 0; - s.block_start = 0; - s.insert = 0; - } - /* use the tail */ - // dictionary = dictionary.slice(dictLength - s.w_size); - tmpDict = new utils.Buf8(s.w_size); - utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0); - dictionary = tmpDict; - dictLength = s.w_size; - } - /* insert dictionary into window and hash */ - avail = strm.avail_in; - next = strm.next_in; - input = strm.input; - strm.avail_in = dictLength; - strm.next_in = 0; - strm.input = dictionary; - fill_window(s); - while (s.lookahead >= MIN_MATCH) { - str = s.strstart; - n = s.lookahead - (MIN_MATCH - 1); - do { - /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; - - s.prev[str & s.w_mask] = s.head[s.ins_h]; - - s.head[s.ins_h] = str; - str++; - } while (--n); - s.strstart = str; - s.lookahead = MIN_MATCH - 1; - fill_window(s); - } - s.strstart += s.lookahead; - s.block_start = s.strstart; - s.insert = s.lookahead; - s.lookahead = 0; - s.match_length = s.prev_length = MIN_MATCH - 1; - s.match_available = 0; - strm.next_in = next; - strm.input = input; - strm.avail_in = avail; - s.wrap = wrap; - return Z_OK; -} - - -exports.deflateInit = deflateInit; -exports.deflateInit2 = deflateInit2; -exports.deflateReset = deflateReset; -exports.deflateResetKeep = deflateResetKeep; -exports.deflateSetHeader = deflateSetHeader; -exports.deflate = deflate; -exports.deflateEnd = deflateEnd; -exports.deflateSetDictionary = deflateSetDictionary; -exports.deflateInfo = 'pako deflate (from Nodeca project)'; - -/* Not implemented -exports.deflateBound = deflateBound; -exports.deflateCopy = deflateCopy; -exports.deflateParams = deflateParams; -exports.deflatePending = deflatePending; -exports.deflatePrime = deflatePrime; -exports.deflateTune = deflateTune; -*/ - -},{"../utils/common":36,"./adler32":37,"./crc32":39,"./messages":44,"./trees":45}],41:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -// See state defs from inflate.js -var BAD = 30; /* got a data error -- remain here until reset */ -var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ - -/* - Decode literal, length, and distance codes and write out the resulting - literal and match bytes until either not enough input or output is - available, an end-of-block is encountered, or a data error is encountered. - When large enough input and output buffers are supplied to inflate(), for - example, a 16K input buffer and a 64K output buffer, more than 95% of the - inflate execution time is spent in this routine. - - Entry assumptions: - - state.mode === LEN - strm.avail_in >= 6 - strm.avail_out >= 258 - start >= strm.avail_out - state.bits < 8 - - On return, state.mode is one of: - - LEN -- ran out of enough output space or enough available input - TYPE -- reached end of block code, inflate() to interpret next block - BAD -- error in block data - - Notes: - - - The maximum input bits used by a length/distance pair is 15 bits for the - length code, 5 bits for the length extra, 15 bits for the distance code, - and 13 bits for the distance extra. This totals 48 bits, or six bytes. - Therefore if strm.avail_in >= 6, then there is enough input to avoid - checking for available input while decoding. - - - The maximum bytes that a single length/distance pair can output is 258 - bytes, which is the maximum length that can be coded. inflate_fast() - requires strm.avail_out >= 258 for each loop to avoid checking for - output space. - */ -module.exports = function inflate_fast(strm, start) { - var state; - var _in; /* local strm.input */ - var last; /* have enough input while in < last */ - var _out; /* local strm.output */ - var beg; /* inflate()'s initial strm.output */ - var end; /* while out < end, enough space available */ -//#ifdef INFLATE_STRICT - var dmax; /* maximum distance from zlib header */ -//#endif - var wsize; /* window size or zero if not using window */ - var whave; /* valid bytes in the window */ - var wnext; /* window write index */ - // Use `s_window` instead `window`, avoid conflict with instrumentation tools - var s_window; /* allocated sliding window, if wsize != 0 */ - var hold; /* local strm.hold */ - var bits; /* local strm.bits */ - var lcode; /* local strm.lencode */ - var dcode; /* local strm.distcode */ - var lmask; /* mask for first level of length codes */ - var dmask; /* mask for first level of distance codes */ - var here; /* retrieved table entry */ - var op; /* code bits, operation, extra bits, or */ - /* window position, window bytes to copy */ - var len; /* match length, unused bytes */ - var dist; /* match distance */ - var from; /* where to copy match from */ - var from_source; - - - var input, output; // JS specific, because we have no pointers - - /* copy state to local variables */ - state = strm.state; - //here = state.here; - _in = strm.next_in; - input = strm.input; - last = _in + (strm.avail_in - 5); - _out = strm.next_out; - output = strm.output; - beg = _out - (start - strm.avail_out); - end = _out + (strm.avail_out - 257); -//#ifdef INFLATE_STRICT - dmax = state.dmax; -//#endif - wsize = state.wsize; - whave = state.whave; - wnext = state.wnext; - s_window = state.window; - hold = state.hold; - bits = state.bits; - lcode = state.lencode; - dcode = state.distcode; - lmask = (1 << state.lenbits) - 1; - dmask = (1 << state.distbits) - 1; - - - /* decode literals and length/distances until end-of-block or not enough - input data or output space */ - - top: - do { - if (bits < 15) { - hold += input[_in++] << bits; - bits += 8; - hold += input[_in++] << bits; - bits += 8; - } - - here = lcode[hold & lmask]; - - dolen: - for (;;) { // Goto emulation - op = here >>> 24/*here.bits*/; - hold >>>= op; - bits -= op; - op = (here >>> 16) & 0xff/*here.op*/; - if (op === 0) { /* literal */ - //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - // "inflate: literal '%c'\n" : - // "inflate: literal 0x%02x\n", here.val)); - output[_out++] = here & 0xffff/*here.val*/; - } - else if (op & 16) { /* length base */ - len = here & 0xffff/*here.val*/; - op &= 15; /* number of extra bits */ - if (op) { - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - } - len += hold & ((1 << op) - 1); - hold >>>= op; - bits -= op; - } - //Tracevv((stderr, "inflate: length %u\n", len)); - if (bits < 15) { - hold += input[_in++] << bits; - bits += 8; - hold += input[_in++] << bits; - bits += 8; - } - here = dcode[hold & dmask]; - - dodist: - for (;;) { // goto emulation - op = here >>> 24/*here.bits*/; - hold >>>= op; - bits -= op; - op = (here >>> 16) & 0xff/*here.op*/; - - if (op & 16) { /* distance base */ - dist = here & 0xffff/*here.val*/; - op &= 15; /* number of extra bits */ - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - } - } - dist += hold & ((1 << op) - 1); -//#ifdef INFLATE_STRICT - if (dist > dmax) { - strm.msg = 'invalid distance too far back'; - state.mode = BAD; - break top; - } -//#endif - hold >>>= op; - bits -= op; - //Tracevv((stderr, "inflate: distance %u\n", dist)); - op = _out - beg; /* max distance in output */ - if (dist > op) { /* see if copy from window */ - op = dist - op; /* distance back in window */ - if (op > whave) { - if (state.sane) { - strm.msg = 'invalid distance too far back'; - state.mode = BAD; - break top; - } - -// (!) This block is disabled in zlib defaults, -// don't enable it for binary compatibility -//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR -// if (len <= op - whave) { -// do { -// output[_out++] = 0; -// } while (--len); -// continue top; -// } -// len -= op - whave; -// do { -// output[_out++] = 0; -// } while (--op > whave); -// if (op === 0) { -// from = _out - dist; -// do { -// output[_out++] = output[from++]; -// } while (--len); -// continue top; -// } -//#endif - } - from = 0; // window index - from_source = s_window; - if (wnext === 0) { /* very common case */ - from += wsize - op; - if (op < len) { /* some from window */ - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; /* rest from output */ - from_source = output; - } - } - else if (wnext < op) { /* wrap around window */ - from += wsize + wnext - op; - op -= wnext; - if (op < len) { /* some from end of window */ - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = 0; - if (wnext < len) { /* some from start of window */ - op = wnext; - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; /* rest from output */ - from_source = output; - } - } - } - else { /* contiguous in window */ - from += wnext - op; - if (op < len) { /* some from window */ - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; /* rest from output */ - from_source = output; - } - } - while (len > 2) { - output[_out++] = from_source[from++]; - output[_out++] = from_source[from++]; - output[_out++] = from_source[from++]; - len -= 3; - } - if (len) { - output[_out++] = from_source[from++]; - if (len > 1) { - output[_out++] = from_source[from++]; - } - } - } - else { - from = _out - dist; /* copy direct from output */ - do { /* minimum length is three */ - output[_out++] = output[from++]; - output[_out++] = output[from++]; - output[_out++] = output[from++]; - len -= 3; - } while (len > 2); - if (len) { - output[_out++] = output[from++]; - if (len > 1) { - output[_out++] = output[from++]; - } - } - } - } - else if ((op & 64) === 0) { /* 2nd level distance code */ - here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; - continue dodist; - } - else { - strm.msg = 'invalid distance code'; - state.mode = BAD; - break top; - } - - break; // need to emulate goto via "continue" - } - } - else if ((op & 64) === 0) { /* 2nd level length code */ - here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; - continue dolen; - } - else if (op & 32) { /* end-of-block */ - //Tracevv((stderr, "inflate: end of block\n")); - state.mode = TYPE; - break top; - } - else { - strm.msg = 'invalid literal/length code'; - state.mode = BAD; - break top; - } - - break; // need to emulate goto via "continue" - } - } while (_in < last && _out < end); - - /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ - len = bits >> 3; - _in -= len; - bits -= len << 3; - hold &= (1 << bits) - 1; - - /* update state and return */ - strm.next_in = _in; - strm.next_out = _out; - strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last)); - strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end)); - state.hold = hold; - state.bits = bits; - return; -}; - -},{}],42:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -var utils = require('../utils/common'); -var adler32 = require('./adler32'); -var crc32 = require('./crc32'); -var inflate_fast = require('./inffast'); -var inflate_table = require('./inftrees'); - -var CODES = 0; -var LENS = 1; -var DISTS = 2; - -/* Public constants ==========================================================*/ -/* ===========================================================================*/ - - -/* Allowed flush values; see deflate() and inflate() below for details */ -//var Z_NO_FLUSH = 0; -//var Z_PARTIAL_FLUSH = 1; -//var Z_SYNC_FLUSH = 2; -//var Z_FULL_FLUSH = 3; -var Z_FINISH = 4; -var Z_BLOCK = 5; -var Z_TREES = 6; - - -/* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ -var Z_OK = 0; -var Z_STREAM_END = 1; -var Z_NEED_DICT = 2; -//var Z_ERRNO = -1; -var Z_STREAM_ERROR = -2; -var Z_DATA_ERROR = -3; -var Z_MEM_ERROR = -4; -var Z_BUF_ERROR = -5; -//var Z_VERSION_ERROR = -6; - -/* The deflate compression method */ -var Z_DEFLATED = 8; - - -/* STATES ====================================================================*/ -/* ===========================================================================*/ - - -var HEAD = 1; /* i: waiting for magic header */ -var FLAGS = 2; /* i: waiting for method and flags (gzip) */ -var TIME = 3; /* i: waiting for modification time (gzip) */ -var OS = 4; /* i: waiting for extra flags and operating system (gzip) */ -var EXLEN = 5; /* i: waiting for extra length (gzip) */ -var EXTRA = 6; /* i: waiting for extra bytes (gzip) */ -var NAME = 7; /* i: waiting for end of file name (gzip) */ -var COMMENT = 8; /* i: waiting for end of comment (gzip) */ -var HCRC = 9; /* i: waiting for header crc (gzip) */ -var DICTID = 10; /* i: waiting for dictionary check value */ -var DICT = 11; /* waiting for inflateSetDictionary() call */ -var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ -var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */ -var STORED = 14; /* i: waiting for stored size (length and complement) */ -var COPY_ = 15; /* i/o: same as COPY below, but only first time in */ -var COPY = 16; /* i/o: waiting for input or output to copy stored block */ -var TABLE = 17; /* i: waiting for dynamic block table lengths */ -var LENLENS = 18; /* i: waiting for code length code lengths */ -var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */ -var LEN_ = 20; /* i: same as LEN below, but only first time in */ -var LEN = 21; /* i: waiting for length/lit/eob code */ -var LENEXT = 22; /* i: waiting for length extra bits */ -var DIST = 23; /* i: waiting for distance code */ -var DISTEXT = 24; /* i: waiting for distance extra bits */ -var MATCH = 25; /* o: waiting for output space to copy string */ -var LIT = 26; /* o: waiting for output space to write literal */ -var CHECK = 27; /* i: waiting for 32-bit check value */ -var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */ -var DONE = 29; /* finished check, done -- remain here until reset */ -var BAD = 30; /* got a data error -- remain here until reset */ -var MEM = 31; /* got an inflate() memory error -- remain here until reset */ -var SYNC = 32; /* looking for synchronization bytes to restart inflate() */ - -/* ===========================================================================*/ - - - -var ENOUGH_LENS = 852; -var ENOUGH_DISTS = 592; -//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); - -var MAX_WBITS = 15; -/* 32K LZ77 window */ -var DEF_WBITS = MAX_WBITS; - - -function zswap32(q) { - return (((q >>> 24) & 0xff) + - ((q >>> 8) & 0xff00) + - ((q & 0xff00) << 8) + - ((q & 0xff) << 24)); -} - - -function InflateState() { - this.mode = 0; /* current inflate mode */ - this.last = false; /* true if processing last block */ - this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ - this.havedict = false; /* true if dictionary provided */ - this.flags = 0; /* gzip header method and flags (0 if zlib) */ - this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */ - this.check = 0; /* protected copy of check value */ - this.total = 0; /* protected copy of output count */ - // TODO: may be {} - this.head = null; /* where to save gzip header information */ - - /* sliding window */ - this.wbits = 0; /* log base 2 of requested window size */ - this.wsize = 0; /* window size or zero if not using window */ - this.whave = 0; /* valid bytes in the window */ - this.wnext = 0; /* window write index */ - this.window = null; /* allocated sliding window, if needed */ - - /* bit accumulator */ - this.hold = 0; /* input bit accumulator */ - this.bits = 0; /* number of bits in "in" */ - - /* for string and stored block copying */ - this.length = 0; /* literal or length of data to copy */ - this.offset = 0; /* distance back to copy string from */ - - /* for table and code decoding */ - this.extra = 0; /* extra bits needed */ - - /* fixed and dynamic code tables */ - this.lencode = null; /* starting table for length/literal codes */ - this.distcode = null; /* starting table for distance codes */ - this.lenbits = 0; /* index bits for lencode */ - this.distbits = 0; /* index bits for distcode */ - - /* dynamic table building */ - this.ncode = 0; /* number of code length code lengths */ - this.nlen = 0; /* number of length code lengths */ - this.ndist = 0; /* number of distance code lengths */ - this.have = 0; /* number of code lengths in lens[] */ - this.next = null; /* next available space in codes[] */ - - this.lens = new utils.Buf16(320); /* temporary storage for code lengths */ - this.work = new utils.Buf16(288); /* work area for code table building */ - - /* - because we don't have pointers in js, we use lencode and distcode directly - as buffers so we don't need codes - */ - //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */ - this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */ - this.distdyn = null; /* dynamic table for distance codes (JS specific) */ - this.sane = 0; /* if false, allow invalid distance too far */ - this.back = 0; /* bits back of last unprocessed length/lit */ - this.was = 0; /* initial length of match */ -} - -function inflateResetKeep(strm) { - var state; - - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - state = strm.state; - strm.total_in = strm.total_out = state.total = 0; - strm.msg = ''; /*Z_NULL*/ - if (state.wrap) { /* to support ill-conceived Java test suite */ - strm.adler = state.wrap & 1; - } - state.mode = HEAD; - state.last = 0; - state.havedict = 0; - state.dmax = 32768; - state.head = null/*Z_NULL*/; - state.hold = 0; - state.bits = 0; - //state.lencode = state.distcode = state.next = state.codes; - state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS); - state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS); - - state.sane = 1; - state.back = -1; - //Tracev((stderr, "inflate: reset\n")); - return Z_OK; -} - -function inflateReset(strm) { - var state; - - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - state = strm.state; - state.wsize = 0; - state.whave = 0; - state.wnext = 0; - return inflateResetKeep(strm); - -} - -function inflateReset2(strm, windowBits) { - var wrap; - var state; - - /* get the state */ - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - state = strm.state; - - /* extract wrap request from windowBits parameter */ - if (windowBits < 0) { - wrap = 0; - windowBits = -windowBits; - } - else { - wrap = (windowBits >> 4) + 1; - if (windowBits < 48) { - windowBits &= 15; - } - } - - /* set number of window bits, free window if different */ - if (windowBits && (windowBits < 8 || windowBits > 15)) { - return Z_STREAM_ERROR; - } - if (state.window !== null && state.wbits !== windowBits) { - state.window = null; - } - - /* update state and reset the rest of it */ - state.wrap = wrap; - state.wbits = windowBits; - return inflateReset(strm); -} - -function inflateInit2(strm, windowBits) { - var ret; - var state; - - if (!strm) { return Z_STREAM_ERROR; } - //strm.msg = Z_NULL; /* in case we return an error */ - - state = new InflateState(); - - //if (state === Z_NULL) return Z_MEM_ERROR; - //Tracev((stderr, "inflate: allocated\n")); - strm.state = state; - state.window = null/*Z_NULL*/; - ret = inflateReset2(strm, windowBits); - if (ret !== Z_OK) { - strm.state = null/*Z_NULL*/; - } - return ret; -} - -function inflateInit(strm) { - return inflateInit2(strm, DEF_WBITS); -} - - -/* - Return state with length and distance decoding tables and index sizes set to - fixed code decoding. Normally this returns fixed tables from inffixed.h. - If BUILDFIXED is defined, then instead this routine builds the tables the - first time it's called, and returns those tables the first time and - thereafter. This reduces the size of the code by about 2K bytes, in - exchange for a little execution time. However, BUILDFIXED should not be - used for threaded applications, since the rewriting of the tables and virgin - may not be thread-safe. - */ -var virgin = true; - -var lenfix, distfix; // We have no pointers in JS, so keep tables separate - -function fixedtables(state) { - /* build fixed huffman tables if first call (may not be thread safe) */ - if (virgin) { - var sym; - - lenfix = new utils.Buf32(512); - distfix = new utils.Buf32(32); - - /* literal/length table */ - sym = 0; - while (sym < 144) { state.lens[sym++] = 8; } - while (sym < 256) { state.lens[sym++] = 9; } - while (sym < 280) { state.lens[sym++] = 7; } - while (sym < 288) { state.lens[sym++] = 8; } - - inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 }); - - /* distance table */ - sym = 0; - while (sym < 32) { state.lens[sym++] = 5; } - - inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 }); - - /* do this just once */ - virgin = false; - } - - state.lencode = lenfix; - state.lenbits = 9; - state.distcode = distfix; - state.distbits = 5; -} - - -/* - Update the window with the last wsize (normally 32K) bytes written before - returning. If window does not exist yet, create it. This is only called - when a window is already in use, or when output has been written during this - inflate call, but the end of the deflate stream has not been reached yet. - It is also called to create a window for dictionary data when a dictionary - is loaded. - - Providing output buffers larger than 32K to inflate() should provide a speed - advantage, since only the last 32K of output is copied to the sliding window - upon return from inflate(), and since all distances after the first 32K of - output will fall in the output data, making match copies simpler and faster. - The advantage may be dependent on the size of the processor's data caches. - */ -function updatewindow(strm, src, end, copy) { - var dist; - var state = strm.state; - - /* if it hasn't been done already, allocate space for the window */ - if (state.window === null) { - state.wsize = 1 << state.wbits; - state.wnext = 0; - state.whave = 0; - - state.window = new utils.Buf8(state.wsize); - } - - /* copy state->wsize or less output bytes into the circular window */ - if (copy >= state.wsize) { - utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0); - state.wnext = 0; - state.whave = state.wsize; - } - else { - dist = state.wsize - state.wnext; - if (dist > copy) { - dist = copy; - } - //zmemcpy(state->window + state->wnext, end - copy, dist); - utils.arraySet(state.window, src, end - copy, dist, state.wnext); - copy -= dist; - if (copy) { - //zmemcpy(state->window, end - copy, copy); - utils.arraySet(state.window, src, end - copy, copy, 0); - state.wnext = copy; - state.whave = state.wsize; - } - else { - state.wnext += dist; - if (state.wnext === state.wsize) { state.wnext = 0; } - if (state.whave < state.wsize) { state.whave += dist; } - } - } - return 0; -} - -function inflate(strm, flush) { - var state; - var input, output; // input/output buffers - var next; /* next input INDEX */ - var put; /* next output INDEX */ - var have, left; /* available input and output */ - var hold; /* bit buffer */ - var bits; /* bits in bit buffer */ - var _in, _out; /* save starting available input and output */ - var copy; /* number of stored or match bytes to copy */ - var from; /* where to copy match bytes from */ - var from_source; - var here = 0; /* current decoding table entry */ - var here_bits, here_op, here_val; // paked "here" denormalized (JS specific) - //var last; /* parent table entry */ - var last_bits, last_op, last_val; // paked "last" denormalized (JS specific) - var len; /* length to copy for repeats, bits to drop */ - var ret; /* return code */ - var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */ - var opts; - - var n; // temporary var for NEED_BITS - - var order = /* permutation of code lengths */ - [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]; - - - if (!strm || !strm.state || !strm.output || - (!strm.input && strm.avail_in !== 0)) { - return Z_STREAM_ERROR; - } - - state = strm.state; - if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */ - - - //--- LOAD() --- - put = strm.next_out; - output = strm.output; - left = strm.avail_out; - next = strm.next_in; - input = strm.input; - have = strm.avail_in; - hold = state.hold; - bits = state.bits; - //--- - - _in = have; - _out = left; - ret = Z_OK; - - inf_leave: // goto emulation - for (;;) { - switch (state.mode) { - case HEAD: - if (state.wrap === 0) { - state.mode = TYPEDO; - break; - } - //=== NEEDBITS(16); - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */ - state.check = 0/*crc32(0L, Z_NULL, 0)*/; - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = FLAGS; - break; - } - state.flags = 0; /* expect zlib header */ - if (state.head) { - state.head.done = false; - } - if (!(state.wrap & 1) || /* check if zlib header allowed */ - (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) { - strm.msg = 'incorrect header check'; - state.mode = BAD; - break; - } - if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) { - strm.msg = 'unknown compression method'; - state.mode = BAD; - break; - } - //--- DROPBITS(4) ---// - hold >>>= 4; - bits -= 4; - //---// - len = (hold & 0x0f)/*BITS(4)*/ + 8; - if (state.wbits === 0) { - state.wbits = len; - } - else if (len > state.wbits) { - strm.msg = 'invalid window size'; - state.mode = BAD; - break; - } - state.dmax = 1 << len; - //Tracev((stderr, "inflate: zlib header ok\n")); - strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; - state.mode = hold & 0x200 ? DICTID : TYPE; - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - break; - case FLAGS: - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.flags = hold; - if ((state.flags & 0xff) !== Z_DEFLATED) { - strm.msg = 'unknown compression method'; - state.mode = BAD; - break; - } - if (state.flags & 0xe000) { - strm.msg = 'unknown header flags set'; - state.mode = BAD; - break; - } - if (state.head) { - state.head.text = ((hold >> 8) & 1); - } - if (state.flags & 0x0200) { - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = TIME; - /* falls through */ - case TIME: - //=== NEEDBITS(32); */ - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (state.head) { - state.head.time = hold; - } - if (state.flags & 0x0200) { - //=== CRC4(state.check, hold) - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - hbuf[2] = (hold >>> 16) & 0xff; - hbuf[3] = (hold >>> 24) & 0xff; - state.check = crc32(state.check, hbuf, 4, 0); - //=== - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = OS; - /* falls through */ - case OS: - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (state.head) { - state.head.xflags = (hold & 0xff); - state.head.os = (hold >> 8); - } - if (state.flags & 0x0200) { - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = EXLEN; - /* falls through */ - case EXLEN: - if (state.flags & 0x0400) { - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.length = hold; - if (state.head) { - state.head.extra_len = hold; - } - if (state.flags & 0x0200) { - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - } - else if (state.head) { - state.head.extra = null/*Z_NULL*/; - } - state.mode = EXTRA; - /* falls through */ - case EXTRA: - if (state.flags & 0x0400) { - copy = state.length; - if (copy > have) { copy = have; } - if (copy) { - if (state.head) { - len = state.head.extra_len - state.length; - if (!state.head.extra) { - // Use untyped array for more convenient processing later - state.head.extra = new Array(state.head.extra_len); - } - utils.arraySet( - state.head.extra, - input, - next, - // extra field is limited to 65536 bytes - // - no need for additional size check - copy, - /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ - len - ); - //zmemcpy(state.head.extra + len, next, - // len + copy > state.head.extra_max ? - // state.head.extra_max - len : copy); - } - if (state.flags & 0x0200) { - state.check = crc32(state.check, input, copy, next); - } - have -= copy; - next += copy; - state.length -= copy; - } - if (state.length) { break inf_leave; } - } - state.length = 0; - state.mode = NAME; - /* falls through */ - case NAME: - if (state.flags & 0x0800) { - if (have === 0) { break inf_leave; } - copy = 0; - do { - // TODO: 2 or 1 bytes? - len = input[next + copy++]; - /* use constant limit because in js we should not preallocate memory */ - if (state.head && len && - (state.length < 65536 /*state.head.name_max*/)) { - state.head.name += String.fromCharCode(len); - } - } while (len && copy < have); - - if (state.flags & 0x0200) { - state.check = crc32(state.check, input, copy, next); - } - have -= copy; - next += copy; - if (len) { break inf_leave; } - } - else if (state.head) { - state.head.name = null; - } - state.length = 0; - state.mode = COMMENT; - /* falls through */ - case COMMENT: - if (state.flags & 0x1000) { - if (have === 0) { break inf_leave; } - copy = 0; - do { - len = input[next + copy++]; - /* use constant limit because in js we should not preallocate memory */ - if (state.head && len && - (state.length < 65536 /*state.head.comm_max*/)) { - state.head.comment += String.fromCharCode(len); - } - } while (len && copy < have); - if (state.flags & 0x0200) { - state.check = crc32(state.check, input, copy, next); - } - have -= copy; - next += copy; - if (len) { break inf_leave; } - } - else if (state.head) { - state.head.comment = null; - } - state.mode = HCRC; - /* falls through */ - case HCRC: - if (state.flags & 0x0200) { - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (hold !== (state.check & 0xffff)) { - strm.msg = 'header crc mismatch'; - state.mode = BAD; - break; - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - } - if (state.head) { - state.head.hcrc = ((state.flags >> 9) & 1); - state.head.done = true; - } - strm.adler = state.check = 0; - state.mode = TYPE; - break; - case DICTID: - //=== NEEDBITS(32); */ - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - strm.adler = state.check = zswap32(hold); - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = DICT; - /* falls through */ - case DICT: - if (state.havedict === 0) { - //--- RESTORE() --- - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - //--- - return Z_NEED_DICT; - } - strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; - state.mode = TYPE; - /* falls through */ - case TYPE: - if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; } - /* falls through */ - case TYPEDO: - if (state.last) { - //--- BYTEBITS() ---// - hold >>>= bits & 7; - bits -= bits & 7; - //---// - state.mode = CHECK; - break; - } - //=== NEEDBITS(3); */ - while (bits < 3) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.last = (hold & 0x01)/*BITS(1)*/; - //--- DROPBITS(1) ---// - hold >>>= 1; - bits -= 1; - //---// - - switch ((hold & 0x03)/*BITS(2)*/) { - case 0: /* stored block */ - //Tracev((stderr, "inflate: stored block%s\n", - // state.last ? " (last)" : "")); - state.mode = STORED; - break; - case 1: /* fixed block */ - fixedtables(state); - //Tracev((stderr, "inflate: fixed codes block%s\n", - // state.last ? " (last)" : "")); - state.mode = LEN_; /* decode codes */ - if (flush === Z_TREES) { - //--- DROPBITS(2) ---// - hold >>>= 2; - bits -= 2; - //---// - break inf_leave; - } - break; - case 2: /* dynamic block */ - //Tracev((stderr, "inflate: dynamic codes block%s\n", - // state.last ? " (last)" : "")); - state.mode = TABLE; - break; - case 3: - strm.msg = 'invalid block type'; - state.mode = BAD; - } - //--- DROPBITS(2) ---// - hold >>>= 2; - bits -= 2; - //---// - break; - case STORED: - //--- BYTEBITS() ---// /* go to byte boundary */ - hold >>>= bits & 7; - bits -= bits & 7; - //---// - //=== NEEDBITS(32); */ - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) { - strm.msg = 'invalid stored block lengths'; - state.mode = BAD; - break; - } - state.length = hold & 0xffff; - //Tracev((stderr, "inflate: stored length %u\n", - // state.length)); - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = COPY_; - if (flush === Z_TREES) { break inf_leave; } - /* falls through */ - case COPY_: - state.mode = COPY; - /* falls through */ - case COPY: - copy = state.length; - if (copy) { - if (copy > have) { copy = have; } - if (copy > left) { copy = left; } - if (copy === 0) { break inf_leave; } - //--- zmemcpy(put, next, copy); --- - utils.arraySet(output, input, next, copy, put); - //---// - have -= copy; - next += copy; - left -= copy; - put += copy; - state.length -= copy; - break; - } - //Tracev((stderr, "inflate: stored end\n")); - state.mode = TYPE; - break; - case TABLE: - //=== NEEDBITS(14); */ - while (bits < 14) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257; - //--- DROPBITS(5) ---// - hold >>>= 5; - bits -= 5; - //---// - state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1; - //--- DROPBITS(5) ---// - hold >>>= 5; - bits -= 5; - //---// - state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4; - //--- DROPBITS(4) ---// - hold >>>= 4; - bits -= 4; - //---// -//#ifndef PKZIP_BUG_WORKAROUND - if (state.nlen > 286 || state.ndist > 30) { - strm.msg = 'too many length or distance symbols'; - state.mode = BAD; - break; - } -//#endif - //Tracev((stderr, "inflate: table sizes ok\n")); - state.have = 0; - state.mode = LENLENS; - /* falls through */ - case LENLENS: - while (state.have < state.ncode) { - //=== NEEDBITS(3); - while (bits < 3) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.lens[order[state.have++]] = (hold & 0x07);//BITS(3); - //--- DROPBITS(3) ---// - hold >>>= 3; - bits -= 3; - //---// - } - while (state.have < 19) { - state.lens[order[state.have++]] = 0; - } - // We have separate tables & no pointers. 2 commented lines below not needed. - //state.next = state.codes; - //state.lencode = state.next; - // Switch to use dynamic table - state.lencode = state.lendyn; - state.lenbits = 7; - - opts = { bits: state.lenbits }; - ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts); - state.lenbits = opts.bits; - - if (ret) { - strm.msg = 'invalid code lengths set'; - state.mode = BAD; - break; - } - //Tracev((stderr, "inflate: code lengths ok\n")); - state.have = 0; - state.mode = CODELENS; - /* falls through */ - case CODELENS: - while (state.have < state.nlen + state.ndist) { - for (;;) { - here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/ - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((here_bits) <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - if (here_val < 16) { - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - state.lens[state.have++] = here_val; - } - else { - if (here_val === 16) { - //=== NEEDBITS(here.bits + 2); - n = here_bits + 2; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - if (state.have === 0) { - strm.msg = 'invalid bit length repeat'; - state.mode = BAD; - break; - } - len = state.lens[state.have - 1]; - copy = 3 + (hold & 0x03);//BITS(2); - //--- DROPBITS(2) ---// - hold >>>= 2; - bits -= 2; - //---// - } - else if (here_val === 17) { - //=== NEEDBITS(here.bits + 3); - n = here_bits + 3; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - len = 0; - copy = 3 + (hold & 0x07);//BITS(3); - //--- DROPBITS(3) ---// - hold >>>= 3; - bits -= 3; - //---// - } - else { - //=== NEEDBITS(here.bits + 7); - n = here_bits + 7; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - len = 0; - copy = 11 + (hold & 0x7f);//BITS(7); - //--- DROPBITS(7) ---// - hold >>>= 7; - bits -= 7; - //---// - } - if (state.have + copy > state.nlen + state.ndist) { - strm.msg = 'invalid bit length repeat'; - state.mode = BAD; - break; - } - while (copy--) { - state.lens[state.have++] = len; - } - } - } - - /* handle error breaks in while */ - if (state.mode === BAD) { break; } - - /* check for end-of-block code (better have one) */ - if (state.lens[256] === 0) { - strm.msg = 'invalid code -- missing end-of-block'; - state.mode = BAD; - break; - } - - /* build code tables -- note: do not change the lenbits or distbits - values here (9 and 6) without reading the comments in inftrees.h - concerning the ENOUGH constants, which depend on those values */ - state.lenbits = 9; - - opts = { bits: state.lenbits }; - ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); - // We have separate tables & no pointers. 2 commented lines below not needed. - // state.next_index = opts.table_index; - state.lenbits = opts.bits; - // state.lencode = state.next; - - if (ret) { - strm.msg = 'invalid literal/lengths set'; - state.mode = BAD; - break; - } - - state.distbits = 6; - //state.distcode.copy(state.codes); - // Switch to use dynamic table - state.distcode = state.distdyn; - opts = { bits: state.distbits }; - ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); - // We have separate tables & no pointers. 2 commented lines below not needed. - // state.next_index = opts.table_index; - state.distbits = opts.bits; - // state.distcode = state.next; - - if (ret) { - strm.msg = 'invalid distances set'; - state.mode = BAD; - break; - } - //Tracev((stderr, 'inflate: codes ok\n')); - state.mode = LEN_; - if (flush === Z_TREES) { break inf_leave; } - /* falls through */ - case LEN_: - state.mode = LEN; - /* falls through */ - case LEN: - if (have >= 6 && left >= 258) { - //--- RESTORE() --- - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - //--- - inflate_fast(strm, _out); - //--- LOAD() --- - put = strm.next_out; - output = strm.output; - left = strm.avail_out; - next = strm.next_in; - input = strm.input; - have = strm.avail_in; - hold = state.hold; - bits = state.bits; - //--- - - if (state.mode === TYPE) { - state.back = -1; - } - break; - } - state.back = 0; - for (;;) { - here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/ - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if (here_bits <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - if (here_op && (here_op & 0xf0) === 0) { - last_bits = here_bits; - last_op = here_op; - last_val = here_val; - for (;;) { - here = state.lencode[last_val + - ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((last_bits + here_bits) <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - //--- DROPBITS(last.bits) ---// - hold >>>= last_bits; - bits -= last_bits; - //---// - state.back += last_bits; - } - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - state.back += here_bits; - state.length = here_val; - if (here_op === 0) { - //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - // "inflate: literal '%c'\n" : - // "inflate: literal 0x%02x\n", here.val)); - state.mode = LIT; - break; - } - if (here_op & 32) { - //Tracevv((stderr, "inflate: end of block\n")); - state.back = -1; - state.mode = TYPE; - break; - } - if (here_op & 64) { - strm.msg = 'invalid literal/length code'; - state.mode = BAD; - break; - } - state.extra = here_op & 15; - state.mode = LENEXT; - /* falls through */ - case LENEXT: - if (state.extra) { - //=== NEEDBITS(state.extra); - n = state.extra; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; - //--- DROPBITS(state.extra) ---// - hold >>>= state.extra; - bits -= state.extra; - //---// - state.back += state.extra; - } - //Tracevv((stderr, "inflate: length %u\n", state.length)); - state.was = state.length; - state.mode = DIST; - /* falls through */ - case DIST: - for (;;) { - here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/ - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((here_bits) <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - if ((here_op & 0xf0) === 0) { - last_bits = here_bits; - last_op = here_op; - last_val = here_val; - for (;;) { - here = state.distcode[last_val + - ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((last_bits + here_bits) <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - //--- DROPBITS(last.bits) ---// - hold >>>= last_bits; - bits -= last_bits; - //---// - state.back += last_bits; - } - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - state.back += here_bits; - if (here_op & 64) { - strm.msg = 'invalid distance code'; - state.mode = BAD; - break; - } - state.offset = here_val; - state.extra = (here_op) & 15; - state.mode = DISTEXT; - /* falls through */ - case DISTEXT: - if (state.extra) { - //=== NEEDBITS(state.extra); - n = state.extra; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; - //--- DROPBITS(state.extra) ---// - hold >>>= state.extra; - bits -= state.extra; - //---// - state.back += state.extra; - } -//#ifdef INFLATE_STRICT - if (state.offset > state.dmax) { - strm.msg = 'invalid distance too far back'; - state.mode = BAD; - break; - } -//#endif - //Tracevv((stderr, "inflate: distance %u\n", state.offset)); - state.mode = MATCH; - /* falls through */ - case MATCH: - if (left === 0) { break inf_leave; } - copy = _out - left; - if (state.offset > copy) { /* copy from window */ - copy = state.offset - copy; - if (copy > state.whave) { - if (state.sane) { - strm.msg = 'invalid distance too far back'; - state.mode = BAD; - break; - } -// (!) This block is disabled in zlib defaults, -// don't enable it for binary compatibility -//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR -// Trace((stderr, "inflate.c too far\n")); -// copy -= state.whave; -// if (copy > state.length) { copy = state.length; } -// if (copy > left) { copy = left; } -// left -= copy; -// state.length -= copy; -// do { -// output[put++] = 0; -// } while (--copy); -// if (state.length === 0) { state.mode = LEN; } -// break; -//#endif - } - if (copy > state.wnext) { - copy -= state.wnext; - from = state.wsize - copy; - } - else { - from = state.wnext - copy; - } - if (copy > state.length) { copy = state.length; } - from_source = state.window; - } - else { /* copy from output */ - from_source = output; - from = put - state.offset; - copy = state.length; - } - if (copy > left) { copy = left; } - left -= copy; - state.length -= copy; - do { - output[put++] = from_source[from++]; - } while (--copy); - if (state.length === 0) { state.mode = LEN; } - break; - case LIT: - if (left === 0) { break inf_leave; } - output[put++] = state.length; - left--; - state.mode = LEN; - break; - case CHECK: - if (state.wrap) { - //=== NEEDBITS(32); - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - // Use '|' instead of '+' to make sure that result is signed - hold |= input[next++] << bits; - bits += 8; - } - //===// - _out -= left; - strm.total_out += _out; - state.total += _out; - if (_out) { - strm.adler = state.check = - /*UPDATE(state.check, put - _out, _out);*/ - (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out)); - - } - _out = left; - // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too - if ((state.flags ? hold : zswap32(hold)) !== state.check) { - strm.msg = 'incorrect data check'; - state.mode = BAD; - break; - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - //Tracev((stderr, "inflate: check matches trailer\n")); - } - state.mode = LENGTH; - /* falls through */ - case LENGTH: - if (state.wrap && state.flags) { - //=== NEEDBITS(32); - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (hold !== (state.total & 0xffffffff)) { - strm.msg = 'incorrect length check'; - state.mode = BAD; - break; - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - //Tracev((stderr, "inflate: length matches trailer\n")); - } - state.mode = DONE; - /* falls through */ - case DONE: - ret = Z_STREAM_END; - break inf_leave; - case BAD: - ret = Z_DATA_ERROR; - break inf_leave; - case MEM: - return Z_MEM_ERROR; - case SYNC: - /* falls through */ - default: - return Z_STREAM_ERROR; - } - } - - // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave" - - /* - Return from inflate(), updating the total counts and the check value. - If there was no progress during the inflate() call, return a buffer - error. Call updatewindow() to create and/or update the window state. - Note: a memory error from inflate() is non-recoverable. - */ - - //--- RESTORE() --- - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - //--- - - if (state.wsize || (_out !== strm.avail_out && state.mode < BAD && - (state.mode < CHECK || flush !== Z_FINISH))) { - if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { - state.mode = MEM; - return Z_MEM_ERROR; - } - } - _in -= strm.avail_in; - _out -= strm.avail_out; - strm.total_in += _in; - strm.total_out += _out; - state.total += _out; - if (state.wrap && _out) { - strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ - (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out)); - } - strm.data_type = state.bits + (state.last ? 64 : 0) + - (state.mode === TYPE ? 128 : 0) + - (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); - if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) { - ret = Z_BUF_ERROR; - } - return ret; -} - -function inflateEnd(strm) { - - if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) { - return Z_STREAM_ERROR; - } - - var state = strm.state; - if (state.window) { - state.window = null; - } - strm.state = null; - return Z_OK; -} - -function inflateGetHeader(strm, head) { - var state; - - /* check state */ - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - state = strm.state; - if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; } - - /* save header structure */ - state.head = head; - head.done = false; - return Z_OK; -} - -function inflateSetDictionary(strm, dictionary) { - var dictLength = dictionary.length; - - var state; - var dictid; - var ret; - - /* check state */ - if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; } - state = strm.state; - - if (state.wrap !== 0 && state.mode !== DICT) { - return Z_STREAM_ERROR; - } - - /* check for correct dictionary identifier */ - if (state.mode === DICT) { - dictid = 1; /* adler32(0, null, 0)*/ - /* dictid = adler32(dictid, dictionary, dictLength); */ - dictid = adler32(dictid, dictionary, dictLength, 0); - if (dictid !== state.check) { - return Z_DATA_ERROR; - } - } - /* copy dictionary to window using updatewindow(), which will amend the - existing dictionary if appropriate */ - ret = updatewindow(strm, dictionary, dictLength, dictLength); - if (ret) { - state.mode = MEM; - return Z_MEM_ERROR; - } - state.havedict = 1; - // Tracev((stderr, "inflate: dictionary set\n")); - return Z_OK; -} - -exports.inflateReset = inflateReset; -exports.inflateReset2 = inflateReset2; -exports.inflateResetKeep = inflateResetKeep; -exports.inflateInit = inflateInit; -exports.inflateInit2 = inflateInit2; -exports.inflate = inflate; -exports.inflateEnd = inflateEnd; -exports.inflateGetHeader = inflateGetHeader; -exports.inflateSetDictionary = inflateSetDictionary; -exports.inflateInfo = 'pako inflate (from Nodeca project)'; - -/* Not implemented -exports.inflateCopy = inflateCopy; -exports.inflateGetDictionary = inflateGetDictionary; -exports.inflateMark = inflateMark; -exports.inflatePrime = inflatePrime; -exports.inflateSync = inflateSync; -exports.inflateSyncPoint = inflateSyncPoint; -exports.inflateUndermine = inflateUndermine; -*/ - -},{"../utils/common":36,"./adler32":37,"./crc32":39,"./inffast":41,"./inftrees":43}],43:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -var utils = require('../utils/common'); - -var MAXBITS = 15; -var ENOUGH_LENS = 852; -var ENOUGH_DISTS = 592; -//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); - -var CODES = 0; -var LENS = 1; -var DISTS = 2; - -var lbase = [ /* Length codes 257..285 base */ - 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, - 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 -]; - -var lext = [ /* Length codes 257..285 extra */ - 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78 -]; - -var dbase = [ /* Distance codes 0..29 base */ - 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, - 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, - 8193, 12289, 16385, 24577, 0, 0 -]; - -var dext = [ /* Distance codes 0..29 extra */ - 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, - 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, - 28, 28, 29, 29, 64, 64 -]; - -module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) -{ - var bits = opts.bits; - //here = opts.here; /* table entry for duplication */ - - var len = 0; /* a code's length in bits */ - var sym = 0; /* index of code symbols */ - var min = 0, max = 0; /* minimum and maximum code lengths */ - var root = 0; /* number of index bits for root table */ - var curr = 0; /* number of index bits for current table */ - var drop = 0; /* code bits to drop for sub-table */ - var left = 0; /* number of prefix codes available */ - var used = 0; /* code entries in table used */ - var huff = 0; /* Huffman code */ - var incr; /* for incrementing code, index */ - var fill; /* index for replicating entries */ - var low; /* low bits for current root entry */ - var mask; /* mask for low root bits */ - var next; /* next available space in table */ - var base = null; /* base value table to use */ - var base_index = 0; -// var shoextra; /* extra bits table to use */ - var end; /* use base and extra for symbol > end */ - var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */ - var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */ - var extra = null; - var extra_index = 0; - - var here_bits, here_op, here_val; - - /* - Process a set of code lengths to create a canonical Huffman code. The - code lengths are lens[0..codes-1]. Each length corresponds to the - symbols 0..codes-1. The Huffman code is generated by first sorting the - symbols by length from short to long, and retaining the symbol order - for codes with equal lengths. Then the code starts with all zero bits - for the first code of the shortest length, and the codes are integer - increments for the same length, and zeros are appended as the length - increases. For the deflate format, these bits are stored backwards - from their more natural integer increment ordering, and so when the - decoding tables are built in the large loop below, the integer codes - are incremented backwards. - - This routine assumes, but does not check, that all of the entries in - lens[] are in the range 0..MAXBITS. The caller must assure this. - 1..MAXBITS is interpreted as that code length. zero means that that - symbol does not occur in this code. - - The codes are sorted by computing a count of codes for each length, - creating from that a table of starting indices for each length in the - sorted table, and then entering the symbols in order in the sorted - table. The sorted table is work[], with that space being provided by - the caller. - - The length counts are used for other purposes as well, i.e. finding - the minimum and maximum length codes, determining if there are any - codes at all, checking for a valid set of lengths, and looking ahead - at length counts to determine sub-table sizes when building the - decoding tables. - */ - - /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ - for (len = 0; len <= MAXBITS; len++) { - count[len] = 0; - } - for (sym = 0; sym < codes; sym++) { - count[lens[lens_index + sym]]++; - } - - /* bound code lengths, force root to be within code lengths */ - root = bits; - for (max = MAXBITS; max >= 1; max--) { - if (count[max] !== 0) { break; } - } - if (root > max) { - root = max; - } - if (max === 0) { /* no symbols to code at all */ - //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */ - //table.bits[opts.table_index] = 1; //here.bits = (var char)1; - //table.val[opts.table_index++] = 0; //here.val = (var short)0; - table[table_index++] = (1 << 24) | (64 << 16) | 0; - - - //table.op[opts.table_index] = 64; - //table.bits[opts.table_index] = 1; - //table.val[opts.table_index++] = 0; - table[table_index++] = (1 << 24) | (64 << 16) | 0; - - opts.bits = 1; - return 0; /* no symbols, but wait for decoding to report error */ - } - for (min = 1; min < max; min++) { - if (count[min] !== 0) { break; } - } - if (root < min) { - root = min; - } - - /* check for an over-subscribed or incomplete set of lengths */ - left = 1; - for (len = 1; len <= MAXBITS; len++) { - left <<= 1; - left -= count[len]; - if (left < 0) { - return -1; - } /* over-subscribed */ - } - if (left > 0 && (type === CODES || max !== 1)) { - return -1; /* incomplete set */ - } - - /* generate offsets into symbol table for each length for sorting */ - offs[1] = 0; - for (len = 1; len < MAXBITS; len++) { - offs[len + 1] = offs[len] + count[len]; - } - - /* sort symbols by length, by symbol order within each length */ - for (sym = 0; sym < codes; sym++) { - if (lens[lens_index + sym] !== 0) { - work[offs[lens[lens_index + sym]]++] = sym; - } - } - - /* - Create and fill in decoding tables. In this loop, the table being - filled is at next and has curr index bits. The code being used is huff - with length len. That code is converted to an index by dropping drop - bits off of the bottom. For codes where len is less than drop + curr, - those top drop + curr - len bits are incremented through all values to - fill the table with replicated entries. - - root is the number of index bits for the root table. When len exceeds - root, sub-tables are created pointed to by the root entry with an index - of the low root bits of huff. This is saved in low to check for when a - new sub-table should be started. drop is zero when the root table is - being filled, and drop is root when sub-tables are being filled. - - When a new sub-table is needed, it is necessary to look ahead in the - code lengths to determine what size sub-table is needed. The length - counts are used for this, and so count[] is decremented as codes are - entered in the tables. - - used keeps track of how many table entries have been allocated from the - provided *table space. It is checked for LENS and DIST tables against - the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in - the initial root table size constants. See the comments in inftrees.h - for more information. - - sym increments through all symbols, and the loop terminates when - all codes of length max, i.e. all codes, have been processed. This - routine permits incomplete codes, so another loop after this one fills - in the rest of the decoding tables with invalid code markers. - */ - - /* set up for code type */ - // poor man optimization - use if-else instead of switch, - // to avoid deopts in old v8 - if (type === CODES) { - base = extra = work; /* dummy value--not used */ - end = 19; - - } else if (type === LENS) { - base = lbase; - base_index -= 257; - extra = lext; - extra_index -= 257; - end = 256; - - } else { /* DISTS */ - base = dbase; - extra = dext; - end = -1; - } - - /* initialize opts for loop */ - huff = 0; /* starting code */ - sym = 0; /* starting code symbol */ - len = min; /* starting code length */ - next = table_index; /* current table to fill in */ - curr = root; /* current table index bits */ - drop = 0; /* current bits to drop from code for index */ - low = -1; /* trigger new sub-table when len > root */ - used = 1 << root; /* use root table entries */ - mask = used - 1; /* mask for comparing low */ - - /* check available table space */ - if ((type === LENS && used > ENOUGH_LENS) || - (type === DISTS && used > ENOUGH_DISTS)) { - return 1; - } - - /* process all codes and make table entries */ - for (;;) { - /* create table entry */ - here_bits = len - drop; - if (work[sym] < end) { - here_op = 0; - here_val = work[sym]; - } - else if (work[sym] > end) { - here_op = extra[extra_index + work[sym]]; - here_val = base[base_index + work[sym]]; - } - else { - here_op = 32 + 64; /* end of block */ - here_val = 0; - } - - /* replicate for those indices with low len bits equal to huff */ - incr = 1 << (len - drop); - fill = 1 << curr; - min = fill; /* save offset to next table */ - do { - fill -= incr; - table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0; - } while (fill !== 0); - - /* backwards increment the len-bit code huff */ - incr = 1 << (len - 1); - while (huff & incr) { - incr >>= 1; - } - if (incr !== 0) { - huff &= incr - 1; - huff += incr; - } else { - huff = 0; - } - - /* go to next symbol, update count, len */ - sym++; - if (--count[len] === 0) { - if (len === max) { break; } - len = lens[lens_index + work[sym]]; - } - - /* create new sub-table if needed */ - if (len > root && (huff & mask) !== low) { - /* if first time, transition to sub-tables */ - if (drop === 0) { - drop = root; - } - - /* increment past last table */ - next += min; /* here min is 1 << curr */ - - /* determine length of next table */ - curr = len - drop; - left = 1 << curr; - while (curr + drop < max) { - left -= count[curr + drop]; - if (left <= 0) { break; } - curr++; - left <<= 1; - } - - /* check for enough space */ - used += 1 << curr; - if ((type === LENS && used > ENOUGH_LENS) || - (type === DISTS && used > ENOUGH_DISTS)) { - return 1; - } - - /* point entry in root table to sub-table */ - low = huff & mask; - /*table.op[low] = curr; - table.bits[low] = root; - table.val[low] = next - opts.table_index;*/ - table[low] = (root << 24) | (curr << 16) | (next - table_index) |0; - } - } - - /* fill in remaining table entry if code is incomplete (guaranteed to have - at most one remaining entry, since if the code is incomplete, the - maximum code length that was allowed to get this far is one bit) */ - if (huff !== 0) { - //table.op[next + huff] = 64; /* invalid code marker */ - //table.bits[next + huff] = len - drop; - //table.val[next + huff] = 0; - table[next + huff] = ((len - drop) << 24) | (64 << 16) |0; - } - - /* set return parameters */ - //opts.table_index += used; - opts.bits = root; - return 0; -}; - -},{"../utils/common":36}],44:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -module.exports = { - 2: 'need dictionary', /* Z_NEED_DICT 2 */ - 1: 'stream end', /* Z_STREAM_END 1 */ - 0: '', /* Z_OK 0 */ - '-1': 'file error', /* Z_ERRNO (-1) */ - '-2': 'stream error', /* Z_STREAM_ERROR (-2) */ - '-3': 'data error', /* Z_DATA_ERROR (-3) */ - '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */ - '-5': 'buffer error', /* Z_BUF_ERROR (-5) */ - '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ -}; - -},{}],45:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -/* eslint-disable space-unary-ops */ - -var utils = require('../utils/common'); - -/* Public constants ==========================================================*/ -/* ===========================================================================*/ - - -//var Z_FILTERED = 1; -//var Z_HUFFMAN_ONLY = 2; -//var Z_RLE = 3; -var Z_FIXED = 4; -//var Z_DEFAULT_STRATEGY = 0; - -/* Possible values of the data_type field (though see inflate()) */ -var Z_BINARY = 0; -var Z_TEXT = 1; -//var Z_ASCII = 1; // = Z_TEXT -var Z_UNKNOWN = 2; - -/*============================================================================*/ - - -function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } - -// From zutil.h - -var STORED_BLOCK = 0; -var STATIC_TREES = 1; -var DYN_TREES = 2; -/* The three kinds of block type */ - -var MIN_MATCH = 3; -var MAX_MATCH = 258; -/* The minimum and maximum match lengths */ - -// From deflate.h -/* =========================================================================== - * Internal compression state. - */ - -var LENGTH_CODES = 29; -/* number of length codes, not counting the special END_BLOCK code */ - -var LITERALS = 256; -/* number of literal bytes 0..255 */ - -var L_CODES = LITERALS + 1 + LENGTH_CODES; -/* number of Literal or Length codes, including the END_BLOCK code */ - -var D_CODES = 30; -/* number of distance codes */ - -var BL_CODES = 19; -/* number of codes used to transfer the bit lengths */ - -var HEAP_SIZE = 2 * L_CODES + 1; -/* maximum heap size */ - -var MAX_BITS = 15; -/* All codes must not exceed MAX_BITS bits */ - -var Buf_size = 16; -/* size of bit buffer in bi_buf */ - - -/* =========================================================================== - * Constants - */ - -var MAX_BL_BITS = 7; -/* Bit length codes must not exceed MAX_BL_BITS bits */ - -var END_BLOCK = 256; -/* end of block literal code */ - -var REP_3_6 = 16; -/* repeat previous bit length 3-6 times (2 bits of repeat count) */ - -var REPZ_3_10 = 17; -/* repeat a zero length 3-10 times (3 bits of repeat count) */ - -var REPZ_11_138 = 18; -/* repeat a zero length 11-138 times (7 bits of repeat count) */ - -/* eslint-disable comma-spacing,array-bracket-spacing */ -var extra_lbits = /* extra bits for each length code */ - [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]; - -var extra_dbits = /* extra bits for each distance code */ - [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]; - -var extra_blbits = /* extra bits for each bit length code */ - [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]; - -var bl_order = - [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]; -/* eslint-enable comma-spacing,array-bracket-spacing */ - -/* The lengths of the bit length codes are sent in order of decreasing - * probability, to avoid transmitting the lengths for unused bit length codes. - */ - -/* =========================================================================== - * Local data. These are initialized only once. - */ - -// We pre-fill arrays with 0 to avoid uninitialized gaps - -var DIST_CODE_LEN = 512; /* see definition of array dist_code below */ - -// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1 -var static_ltree = new Array((L_CODES + 2) * 2); -zero(static_ltree); -/* The static literal tree. Since the bit lengths are imposed, there is no - * need for the L_CODES extra codes used during heap construction. However - * The codes 286 and 287 are needed to build a canonical tree (see _tr_init - * below). - */ - -var static_dtree = new Array(D_CODES * 2); -zero(static_dtree); -/* The static distance tree. (Actually a trivial tree since all codes use - * 5 bits.) - */ - -var _dist_code = new Array(DIST_CODE_LEN); -zero(_dist_code); -/* Distance codes. The first 256 values correspond to the distances - * 3 .. 258, the last 256 values correspond to the top 8 bits of - * the 15 bit distances. - */ - -var _length_code = new Array(MAX_MATCH - MIN_MATCH + 1); -zero(_length_code); -/* length code for each normalized match length (0 == MIN_MATCH) */ - -var base_length = new Array(LENGTH_CODES); -zero(base_length); -/* First normalized length for each code (0 = MIN_MATCH) */ - -var base_dist = new Array(D_CODES); -zero(base_dist); -/* First normalized distance for each code (0 = distance of 1) */ - - -function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) { - - this.static_tree = static_tree; /* static tree or NULL */ - this.extra_bits = extra_bits; /* extra bits for each code or NULL */ - this.extra_base = extra_base; /* base index for extra_bits */ - this.elems = elems; /* max number of elements in the tree */ - this.max_length = max_length; /* max bit length for the codes */ - - // show if `static_tree` has data or dummy - needed for monomorphic objects - this.has_stree = static_tree && static_tree.length; -} - - -var static_l_desc; -var static_d_desc; -var static_bl_desc; - - -function TreeDesc(dyn_tree, stat_desc) { - this.dyn_tree = dyn_tree; /* the dynamic tree */ - this.max_code = 0; /* largest code with non zero frequency */ - this.stat_desc = stat_desc; /* the corresponding static tree */ -} - - - -function d_code(dist) { - return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; -} - - -/* =========================================================================== - * Output a short LSB first on the stream. - * IN assertion: there is enough room in pendingBuf. - */ -function put_short(s, w) { -// put_byte(s, (uch)((w) & 0xff)); -// put_byte(s, (uch)((ush)(w) >> 8)); - s.pending_buf[s.pending++] = (w) & 0xff; - s.pending_buf[s.pending++] = (w >>> 8) & 0xff; -} - - -/* =========================================================================== - * Send a value on a given number of bits. - * IN assertion: length <= 16 and value fits in length bits. - */ -function send_bits(s, value, length) { - if (s.bi_valid > (Buf_size - length)) { - s.bi_buf |= (value << s.bi_valid) & 0xffff; - put_short(s, s.bi_buf); - s.bi_buf = value >> (Buf_size - s.bi_valid); - s.bi_valid += length - Buf_size; - } else { - s.bi_buf |= (value << s.bi_valid) & 0xffff; - s.bi_valid += length; - } -} - - -function send_code(s, c, tree) { - send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/); -} - - -/* =========================================================================== - * Reverse the first len bits of a code, using straightforward code (a faster - * method would use a table) - * IN assertion: 1 <= len <= 15 - */ -function bi_reverse(code, len) { - var res = 0; - do { - res |= code & 1; - code >>>= 1; - res <<= 1; - } while (--len > 0); - return res >>> 1; -} - - -/* =========================================================================== - * Flush the bit buffer, keeping at most 7 bits in it. - */ -function bi_flush(s) { - if (s.bi_valid === 16) { - put_short(s, s.bi_buf); - s.bi_buf = 0; - s.bi_valid = 0; - - } else if (s.bi_valid >= 8) { - s.pending_buf[s.pending++] = s.bi_buf & 0xff; - s.bi_buf >>= 8; - s.bi_valid -= 8; - } -} - - -/* =========================================================================== - * Compute the optimal bit lengths for a tree and update the total bit length - * for the current block. - * IN assertion: the fields freq and dad are set, heap[heap_max] and - * above are the tree nodes sorted by increasing frequency. - * OUT assertions: the field len is set to the optimal bit length, the - * array bl_count contains the frequencies for each bit length. - * The length opt_len is updated; static_len is also updated if stree is - * not null. - */ -function gen_bitlen(s, desc) -// deflate_state *s; -// tree_desc *desc; /* the tree descriptor */ -{ - var tree = desc.dyn_tree; - var max_code = desc.max_code; - var stree = desc.stat_desc.static_tree; - var has_stree = desc.stat_desc.has_stree; - var extra = desc.stat_desc.extra_bits; - var base = desc.stat_desc.extra_base; - var max_length = desc.stat_desc.max_length; - var h; /* heap index */ - var n, m; /* iterate over the tree elements */ - var bits; /* bit length */ - var xbits; /* extra bits */ - var f; /* frequency */ - var overflow = 0; /* number of elements with bit length too large */ - - for (bits = 0; bits <= MAX_BITS; bits++) { - s.bl_count[bits] = 0; - } - - /* In a first pass, compute the optimal bit lengths (which may - * overflow in the case of the bit length tree). - */ - tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */ - - for (h = s.heap_max + 1; h < HEAP_SIZE; h++) { - n = s.heap[h]; - bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1; - if (bits > max_length) { - bits = max_length; - overflow++; - } - tree[n * 2 + 1]/*.Len*/ = bits; - /* We overwrite tree[n].Dad which is no longer needed */ - - if (n > max_code) { continue; } /* not a leaf node */ - - s.bl_count[bits]++; - xbits = 0; - if (n >= base) { - xbits = extra[n - base]; - } - f = tree[n * 2]/*.Freq*/; - s.opt_len += f * (bits + xbits); - if (has_stree) { - s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits); - } - } - if (overflow === 0) { return; } - - // Trace((stderr,"\nbit length overflow\n")); - /* This happens for example on obj2 and pic of the Calgary corpus */ - - /* Find the first bit length which could increase: */ - do { - bits = max_length - 1; - while (s.bl_count[bits] === 0) { bits--; } - s.bl_count[bits]--; /* move one leaf down the tree */ - s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */ - s.bl_count[max_length]--; - /* The brother of the overflow item also moves one step up, - * but this does not affect bl_count[max_length] - */ - overflow -= 2; - } while (overflow > 0); - - /* Now recompute all bit lengths, scanning in increasing frequency. - * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all - * lengths instead of fixing only the wrong ones. This idea is taken - * from 'ar' written by Haruhiko Okumura.) - */ - for (bits = max_length; bits !== 0; bits--) { - n = s.bl_count[bits]; - while (n !== 0) { - m = s.heap[--h]; - if (m > max_code) { continue; } - if (tree[m * 2 + 1]/*.Len*/ !== bits) { - // Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); - s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/; - tree[m * 2 + 1]/*.Len*/ = bits; - } - n--; - } - } -} - - -/* =========================================================================== - * Generate the codes for a given tree and bit counts (which need not be - * optimal). - * IN assertion: the array bl_count contains the bit length statistics for - * the given tree and the field len is set for all tree elements. - * OUT assertion: the field code is set for all tree elements of non - * zero code length. - */ -function gen_codes(tree, max_code, bl_count) -// ct_data *tree; /* the tree to decorate */ -// int max_code; /* largest code with non zero frequency */ -// ushf *bl_count; /* number of codes at each bit length */ -{ - var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */ - var code = 0; /* running code value */ - var bits; /* bit index */ - var n; /* code index */ - - /* The distribution counts are first used to generate the code values - * without bit reversal. - */ - for (bits = 1; bits <= MAX_BITS; bits++) { - next_code[bits] = code = (code + bl_count[bits - 1]) << 1; - } - /* Check that the bit counts in bl_count are consistent. The last code - * must be all ones. - */ - //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */ - length = 0; - for (code = 0; code < LENGTH_CODES - 1; code++) { - base_length[code] = length; - for (n = 0; n < (1 << extra_lbits[code]); n++) { - _length_code[length++] = code; - } - } - //Assert (length == 256, "tr_static_init: length != 256"); - /* Note that the length 255 (match length 258) can be represented - * in two different ways: code 284 + 5 bits or code 285, so we - * overwrite length_code[255] to use the best encoding: - */ - _length_code[length - 1] = code; - - /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ - dist = 0; - for (code = 0; code < 16; code++) { - base_dist[code] = dist; - for (n = 0; n < (1 << extra_dbits[code]); n++) { - _dist_code[dist++] = code; - } - } - //Assert (dist == 256, "tr_static_init: dist != 256"); - dist >>= 7; /* from now on, all distances are divided by 128 */ - for (; code < D_CODES; code++) { - base_dist[code] = dist << 7; - for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) { - _dist_code[256 + dist++] = code; - } - } - //Assert (dist == 256, "tr_static_init: 256+dist != 512"); - - /* Construct the codes of the static literal tree */ - for (bits = 0; bits <= MAX_BITS; bits++) { - bl_count[bits] = 0; - } - - n = 0; - while (n <= 143) { - static_ltree[n * 2 + 1]/*.Len*/ = 8; - n++; - bl_count[8]++; - } - while (n <= 255) { - static_ltree[n * 2 + 1]/*.Len*/ = 9; - n++; - bl_count[9]++; - } - while (n <= 279) { - static_ltree[n * 2 + 1]/*.Len*/ = 7; - n++; - bl_count[7]++; - } - while (n <= 287) { - static_ltree[n * 2 + 1]/*.Len*/ = 8; - n++; - bl_count[8]++; - } - /* Codes 286 and 287 do not exist, but we must include them in the - * tree construction to get a canonical Huffman tree (longest code - * all ones) - */ - gen_codes(static_ltree, L_CODES + 1, bl_count); - - /* The static distance tree is trivial: */ - for (n = 0; n < D_CODES; n++) { - static_dtree[n * 2 + 1]/*.Len*/ = 5; - static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5); - } - - // Now data ready and we can init static trees - static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS); - static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS); - static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS); - - //static_init_done = true; -} - - -/* =========================================================================== - * Initialize a new block. - */ -function init_block(s) { - var n; /* iterates over tree elements */ - - /* Initialize the trees. */ - for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; } - for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; } - for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; } - - s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1; - s.opt_len = s.static_len = 0; - s.last_lit = s.matches = 0; -} - - -/* =========================================================================== - * Flush the bit buffer and align the output on a byte boundary - */ -function bi_windup(s) -{ - if (s.bi_valid > 8) { - put_short(s, s.bi_buf); - } else if (s.bi_valid > 0) { - //put_byte(s, (Byte)s->bi_buf); - s.pending_buf[s.pending++] = s.bi_buf; - } - s.bi_buf = 0; - s.bi_valid = 0; -} - -/* =========================================================================== - * Copy a stored block, storing first the length and its - * one's complement if requested. - */ -function copy_block(s, buf, len, header) -//DeflateState *s; -//charf *buf; /* the input data */ -//unsigned len; /* its length */ -//int header; /* true if block header must be written */ -{ - bi_windup(s); /* align on byte boundary */ - - if (header) { - put_short(s, len); - put_short(s, ~len); - } -// while (len--) { -// put_byte(s, *buf++); -// } - utils.arraySet(s.pending_buf, s.window, buf, len, s.pending); - s.pending += len; -} - -/* =========================================================================== - * Compares to subtrees, using the tree depth as tie breaker when - * the subtrees have equal frequency. This minimizes the worst case length. - */ -function smaller(tree, n, m, depth) { - var _n2 = n * 2; - var _m2 = m * 2; - return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ || - (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m])); -} - -/* =========================================================================== - * Restore the heap property by moving down the tree starting at node k, - * exchanging a node with the smallest of its two sons if necessary, stopping - * when the heap property is re-established (each father smaller than its - * two sons). - */ -function pqdownheap(s, tree, k) -// deflate_state *s; -// ct_data *tree; /* the tree to restore */ -// int k; /* node to move down */ -{ - var v = s.heap[k]; - var j = k << 1; /* left son of k */ - while (j <= s.heap_len) { - /* Set j to the smallest of the two sons: */ - if (j < s.heap_len && - smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) { - j++; - } - /* Exit if v is smaller than both sons */ - if (smaller(tree, v, s.heap[j], s.depth)) { break; } - - /* Exchange v with the smallest son */ - s.heap[k] = s.heap[j]; - k = j; - - /* And continue down the tree, setting j to the left son of k */ - j <<= 1; - } - s.heap[k] = v; -} - - -// inlined manually -// var SMALLEST = 1; - -/* =========================================================================== - * Send the block data compressed using the given Huffman trees - */ -function compress_block(s, ltree, dtree) -// deflate_state *s; -// const ct_data *ltree; /* literal tree */ -// const ct_data *dtree; /* distance tree */ -{ - var dist; /* distance of matched string */ - var lc; /* match length or unmatched char (if dist == 0) */ - var lx = 0; /* running index in l_buf */ - var code; /* the code to send */ - var extra; /* number of extra bits to send */ - - if (s.last_lit !== 0) { - do { - dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]); - lc = s.pending_buf[s.l_buf + lx]; - lx++; - - if (dist === 0) { - send_code(s, lc, ltree); /* send a literal byte */ - //Tracecv(isgraph(lc), (stderr," '%c' ", lc)); - } else { - /* Here, lc is the match length - MIN_MATCH */ - code = _length_code[lc]; - send_code(s, code + LITERALS + 1, ltree); /* send the length code */ - extra = extra_lbits[code]; - if (extra !== 0) { - lc -= base_length[code]; - send_bits(s, lc, extra); /* send the extra length bits */ - } - dist--; /* dist is now the match distance - 1 */ - code = d_code(dist); - //Assert (code < D_CODES, "bad d_code"); - - send_code(s, code, dtree); /* send the distance code */ - extra = extra_dbits[code]; - if (extra !== 0) { - dist -= base_dist[code]; - send_bits(s, dist, extra); /* send the extra distance bits */ - } - } /* literal or match pair ? */ - - /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ - //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, - // "pendingBuf overflow"); - - } while (lx < s.last_lit); - } - - send_code(s, END_BLOCK, ltree); -} - - -/* =========================================================================== - * Construct one Huffman tree and assigns the code bit strings and lengths. - * Update the total bit length for the current block. - * IN assertion: the field freq is set for all tree elements. - * OUT assertions: the fields len and code are set to the optimal bit length - * and corresponding code. The length opt_len is updated; static_len is - * also updated if stree is not null. The field max_code is set. - */ -function build_tree(s, desc) -// deflate_state *s; -// tree_desc *desc; /* the tree descriptor */ -{ - var tree = desc.dyn_tree; - var stree = desc.stat_desc.static_tree; - var has_stree = desc.stat_desc.has_stree; - var elems = desc.stat_desc.elems; - var n, m; /* iterate over heap elements */ - var max_code = -1; /* largest code with non zero frequency */ - var node; /* new node being created */ - - /* Construct the initial heap, with least frequent element in - * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. - * heap[0] is not used. - */ - s.heap_len = 0; - s.heap_max = HEAP_SIZE; - - for (n = 0; n < elems; n++) { - if (tree[n * 2]/*.Freq*/ !== 0) { - s.heap[++s.heap_len] = max_code = n; - s.depth[n] = 0; - - } else { - tree[n * 2 + 1]/*.Len*/ = 0; - } - } - - /* The pkzip format requires that at least one distance code exists, - * and that at least one bit should be sent even if there is only one - * possible code. So to avoid special checks later on we force at least - * two codes of non zero frequency. - */ - while (s.heap_len < 2) { - node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0); - tree[node * 2]/*.Freq*/ = 1; - s.depth[node] = 0; - s.opt_len--; - - if (has_stree) { - s.static_len -= stree[node * 2 + 1]/*.Len*/; - } - /* node is 0 or 1 so it does not have extra bits */ - } - desc.max_code = max_code; - - /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, - * establish sub-heaps of increasing lengths: - */ - for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); } - - /* Construct the Huffman tree by repeatedly combining the least two - * frequent nodes. - */ - node = elems; /* next internal node of the tree */ - do { - //pqremove(s, tree, n); /* n = node of least frequency */ - /*** pqremove ***/ - n = s.heap[1/*SMALLEST*/]; - s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--]; - pqdownheap(s, tree, 1/*SMALLEST*/); - /***/ - - m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */ - - s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */ - s.heap[--s.heap_max] = m; - - /* Create a new node father of n and m */ - tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/; - s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1; - tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node; - - /* and insert the new node in the heap */ - s.heap[1/*SMALLEST*/] = node++; - pqdownheap(s, tree, 1/*SMALLEST*/); - - } while (s.heap_len >= 2); - - s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/]; - - /* At this point, the fields freq and dad are set. We can now - * generate the bit lengths. - */ - gen_bitlen(s, desc); - - /* The field len is now set, we can generate the bit codes */ - gen_codes(tree, max_code, s.bl_count); -} - - -/* =========================================================================== - * Scan a literal or distance tree to determine the frequencies of the codes - * in the bit length tree. - */ -function scan_tree(s, tree, max_code) -// deflate_state *s; -// ct_data *tree; /* the tree to be scanned */ -// int max_code; /* and its largest code of non zero frequency */ -{ - var n; /* iterates over all tree elements */ - var prevlen = -1; /* last emitted length */ - var curlen; /* length of current code */ - - var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ - - var count = 0; /* repeat count of the current code */ - var max_count = 7; /* max repeat count */ - var min_count = 4; /* min repeat count */ - - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } - tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */ - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; - - if (++count < max_count && curlen === nextlen) { - continue; - - } else if (count < min_count) { - s.bl_tree[curlen * 2]/*.Freq*/ += count; - - } else if (curlen !== 0) { - - if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; } - s.bl_tree[REP_3_6 * 2]/*.Freq*/++; - - } else if (count <= 10) { - s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++; - - } else { - s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++; - } - - count = 0; - prevlen = curlen; - - if (nextlen === 0) { - max_count = 138; - min_count = 3; - - } else if (curlen === nextlen) { - max_count = 6; - min_count = 3; - - } else { - max_count = 7; - min_count = 4; - } - } -} - - -/* =========================================================================== - * Send a literal or distance tree in compressed form, using the codes in - * bl_tree. - */ -function send_tree(s, tree, max_code) -// deflate_state *s; -// ct_data *tree; /* the tree to be scanned */ -// int max_code; /* and its largest code of non zero frequency */ -{ - var n; /* iterates over all tree elements */ - var prevlen = -1; /* last emitted length */ - var curlen; /* length of current code */ - - var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ - - var count = 0; /* repeat count of the current code */ - var max_count = 7; /* max repeat count */ - var min_count = 4; /* min repeat count */ - - /* tree[max_code+1].Len = -1; */ /* guard already set */ - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; - - if (++count < max_count && curlen === nextlen) { - continue; - - } else if (count < min_count) { - do { send_code(s, curlen, s.bl_tree); } while (--count !== 0); - - } else if (curlen !== 0) { - if (curlen !== prevlen) { - send_code(s, curlen, s.bl_tree); - count--; - } - //Assert(count >= 3 && count <= 6, " 3_6?"); - send_code(s, REP_3_6, s.bl_tree); - send_bits(s, count - 3, 2); - - } else if (count <= 10) { - send_code(s, REPZ_3_10, s.bl_tree); - send_bits(s, count - 3, 3); - - } else { - send_code(s, REPZ_11_138, s.bl_tree); - send_bits(s, count - 11, 7); - } - - count = 0; - prevlen = curlen; - if (nextlen === 0) { - max_count = 138; - min_count = 3; - - } else if (curlen === nextlen) { - max_count = 6; - min_count = 3; - - } else { - max_count = 7; - min_count = 4; - } - } -} - - -/* =========================================================================== - * Construct the Huffman tree for the bit lengths and return the index in - * bl_order of the last bit length code to send. - */ -function build_bl_tree(s) { - var max_blindex; /* index of last bit length code of non zero freq */ - - /* Determine the bit length frequencies for literal and distance trees */ - scan_tree(s, s.dyn_ltree, s.l_desc.max_code); - scan_tree(s, s.dyn_dtree, s.d_desc.max_code); - - /* Build the bit length tree: */ - build_tree(s, s.bl_desc); - /* opt_len now includes the length of the tree representations, except - * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. - */ - - /* Determine the number of bit length codes to send. The pkzip format - * requires that at least 4 bit length codes be sent. (appnote.txt says - * 3 but the actual value used is 4.) - */ - for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) { - if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) { - break; - } - } - /* Update opt_len to include the bit length tree and counts */ - s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; - //Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", - // s->opt_len, s->static_len)); - - return max_blindex; -} - - -/* =========================================================================== - * Send the header for a block using dynamic Huffman trees: the counts, the - * lengths of the bit length codes, the literal tree and the distance tree. - * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. - */ -function send_all_trees(s, lcodes, dcodes, blcodes) -// deflate_state *s; -// int lcodes, dcodes, blcodes; /* number of codes for each tree */ -{ - var rank; /* index in bl_order */ - - //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); - //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, - // "too many codes"); - //Tracev((stderr, "\nbl counts: ")); - send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */ - send_bits(s, dcodes - 1, 5); - send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */ - for (rank = 0; rank < blcodes; rank++) { - //Tracev((stderr, "\nbl code %2d ", bl_order[rank])); - send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3); - } - //Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); - - send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */ - //Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); - - send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */ - //Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); -} - - -/* =========================================================================== - * Check if the data type is TEXT or BINARY, using the following algorithm: - * - TEXT if the two conditions below are satisfied: - * a) There are no non-portable control characters belonging to the - * "black list" (0..6, 14..25, 28..31). - * b) There is at least one printable character belonging to the - * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). - * - BINARY otherwise. - * - The following partially-portable control characters form a - * "gray list" that is ignored in this detection algorithm: - * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). - * IN assertion: the fields Freq of dyn_ltree are set. - */ -function detect_data_type(s) { - /* black_mask is the bit mask of black-listed bytes - * set bits 0..6, 14..25, and 28..31 - * 0xf3ffc07f = binary 11110011111111111100000001111111 - */ - var black_mask = 0xf3ffc07f; - var n; - - /* Check for non-textual ("black-listed") bytes. */ - for (n = 0; n <= 31; n++, black_mask >>>= 1) { - if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) { - return Z_BINARY; - } - } - - /* Check for textual ("white-listed") bytes. */ - if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 || - s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) { - return Z_TEXT; - } - for (n = 32; n < LITERALS; n++) { - if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) { - return Z_TEXT; - } - } - - /* There are no "black-listed" or "white-listed" bytes: - * this stream either is empty or has tolerated ("gray-listed") bytes only. - */ - return Z_BINARY; -} - - -var static_init_done = false; - -/* =========================================================================== - * Initialize the tree data structures for a new zlib stream. - */ -function _tr_init(s) -{ - - if (!static_init_done) { - tr_static_init(); - static_init_done = true; - } - - s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); - s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); - s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); - - s.bi_buf = 0; - s.bi_valid = 0; - - /* Initialize the first block of the first file: */ - init_block(s); -} - - -/* =========================================================================== - * Send a stored block - */ -function _tr_stored_block(s, buf, stored_len, last) -//DeflateState *s; -//charf *buf; /* input block */ -//ulg stored_len; /* length of input block */ -//int last; /* one if this is the last block for a file */ -{ - send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */ - copy_block(s, buf, stored_len, true); /* with header */ -} - - -/* =========================================================================== - * Send one empty static block to give enough lookahead for inflate. - * This takes 10 bits, of which 7 may remain in the bit buffer. - */ -function _tr_align(s) { - send_bits(s, STATIC_TREES << 1, 3); - send_code(s, END_BLOCK, static_ltree); - bi_flush(s); -} - - -/* =========================================================================== - * Determine the best encoding for the current block: dynamic trees, static - * trees or store, and output the encoded block to the zip file. - */ -function _tr_flush_block(s, buf, stored_len, last) -//DeflateState *s; -//charf *buf; /* input block, or NULL if too old */ -//ulg stored_len; /* length of input block */ -//int last; /* one if this is the last block for a file */ -{ - var opt_lenb, static_lenb; /* opt_len and static_len in bytes */ - var max_blindex = 0; /* index of last bit length code of non zero freq */ - - /* Build the Huffman trees unless a stored block is forced */ - if (s.level > 0) { - - /* Check if the file is binary or text */ - if (s.strm.data_type === Z_UNKNOWN) { - s.strm.data_type = detect_data_type(s); - } - - /* Construct the literal and distance trees */ - build_tree(s, s.l_desc); - // Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, - // s->static_len)); - - build_tree(s, s.d_desc); - // Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, - // s->static_len)); - /* At this point, opt_len and static_len are the total bit lengths of - * the compressed block data, excluding the tree representations. - */ - - /* Build the bit length tree for the above two trees, and get the index - * in bl_order of the last bit length code to send. - */ - max_blindex = build_bl_tree(s); - - /* Determine the best encoding. Compute the block lengths in bytes. */ - opt_lenb = (s.opt_len + 3 + 7) >>> 3; - static_lenb = (s.static_len + 3 + 7) >>> 3; - - // Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", - // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, - // s->last_lit)); - - if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; } - - } else { - // Assert(buf != (char*)0, "lost buf"); - opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ - } - - if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) { - /* 4: two words for the lengths */ - - /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. - * Otherwise we can't have processed more than WSIZE input bytes since - * the last block flush, because compression would have been - * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to - * transform a block into a stored block. - */ - _tr_stored_block(s, buf, stored_len, last); - - } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) { - - send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3); - compress_block(s, static_ltree, static_dtree); - - } else { - send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3); - send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1); - compress_block(s, s.dyn_ltree, s.dyn_dtree); - } - // Assert (s->compressed_len == s->bits_sent, "bad compressed size"); - /* The above check is made mod 2^32, for files larger than 512 MB - * and uLong implemented on 32 bits. - */ - init_block(s); - - if (last) { - bi_windup(s); - } - // Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, - // s->compressed_len-7*last)); -} - -/* =========================================================================== - * Save the match info and tally the frequency counts. Return true if - * the current block must be flushed. - */ -function _tr_tally(s, dist, lc) -// deflate_state *s; -// unsigned dist; /* distance of matched string */ -// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ -{ - //var out_length, in_length, dcode; - - s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff; - s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff; - - s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff; - s.last_lit++; - - if (dist === 0) { - /* lc is the unmatched char */ - s.dyn_ltree[lc * 2]/*.Freq*/++; - } else { - s.matches++; - /* Here, lc is the match length - MIN_MATCH */ - dist--; /* dist = match distance - 1 */ - //Assert((ush)dist < (ush)MAX_DIST(s) && - // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && - // (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); - - s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++; - s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++; - } - -// (!) This block is disabled in zlib defaults, -// don't enable it for binary compatibility - -//#ifdef TRUNCATE_BLOCK -// /* Try to guess if it is profitable to stop the current block here */ -// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) { -// /* Compute an upper bound for the compressed length */ -// out_length = s.last_lit*8; -// in_length = s.strstart - s.block_start; -// -// for (dcode = 0; dcode < D_CODES; dcode++) { -// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]); -// } -// out_length >>>= 3; -// //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", -// // s->last_lit, in_length, out_length, -// // 100L - out_length*100L/in_length)); -// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) { -// return true; -// } -// } -//#endif - - return (s.last_lit === s.lit_bufsize - 1); - /* We avoid equality with lit_bufsize because of wraparound at 64K - * on 16 bit machines and because stored blocks are restricted to - * 64K-1 bytes. - */ -} - -exports._tr_init = _tr_init; -exports._tr_stored_block = _tr_stored_block; -exports._tr_flush_block = _tr_flush_block; -exports._tr_tally = _tr_tally; -exports._tr_align = _tr_align; - -},{"../utils/common":36}],46:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -function ZStream() { - /* next input byte */ - this.input = null; // JS specific, because we have no pointers - this.next_in = 0; - /* number of bytes available at input */ - this.avail_in = 0; - /* total number of input bytes read so far */ - this.total_in = 0; - /* next output byte should be put there */ - this.output = null; // JS specific, because we have no pointers - this.next_out = 0; - /* remaining free space at output */ - this.avail_out = 0; - /* total number of bytes output so far */ - this.total_out = 0; - /* last error message, NULL if no error */ - this.msg = ''/*Z_NULL*/; - /* not visible by applications */ - this.state = null; - /* best guess about the data type: binary or text */ - this.data_type = 2/*Z_UNKNOWN*/; - /* adler32 value of the uncompressed data */ - this.adler = 0; -} - -module.exports = ZStream; - -},{}],47:[function(require,module,exports){ -arguments[4][33][0].apply(exports,arguments) -},{"dup":33}],48:[function(require,module,exports){ -(function (Buffer){ -/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -/* eslint-disable no-proto */ - -'use strict' - -var base64 = require('base64-js') -var ieee754 = require('ieee754') -var customInspectSymbol = - (typeof Symbol === 'function' && typeof Symbol.for === 'function') - ? Symbol.for('nodejs.util.inspect.custom') - : null - -exports.Buffer = Buffer -exports.SlowBuffer = SlowBuffer -exports.INSPECT_MAX_BYTES = 50 - -var K_MAX_LENGTH = 0x7fffffff -exports.kMaxLength = K_MAX_LENGTH - -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Print warning and recommend using `buffer` v4.x which has an Object - * implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * We report that the browser does not support typed arrays if the are not subclassable - * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` - * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support - * for __proto__ and has a buggy typed array implementation. - */ -Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport() - -if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && - typeof console.error === 'function') { - console.error( - 'This browser lacks typed array (Uint8Array) support which is required by ' + - '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.' - ) -} - -function typedArraySupport () { - // Can typed array instances can be augmented? - try { - var arr = new Uint8Array(1) - var proto = { foo: function () { return 42 } } - Object.setPrototypeOf(proto, Uint8Array.prototype) - Object.setPrototypeOf(arr, proto) - return arr.foo() === 42 - } catch (e) { - return false - } -} - -Object.defineProperty(Buffer.prototype, 'parent', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.buffer - } -}) - -Object.defineProperty(Buffer.prototype, 'offset', { - enumerable: true, - get: function () { - if (!Buffer.isBuffer(this)) return undefined - return this.byteOffset - } -}) - -function createBuffer (length) { - if (length > K_MAX_LENGTH) { - throw new RangeError('The value "' + length + '" is invalid for option "size"') - } - // Return an augmented `Uint8Array` instance - var buf = new Uint8Array(length) - Object.setPrototypeOf(buf, Buffer.prototype) - return buf -} - -/** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ - -function Buffer (arg, encodingOrOffset, length) { - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') { - throw new TypeError( - 'The "string" argument must be of type string. Received type number' - ) - } - return allocUnsafe(arg) - } - return from(arg, encodingOrOffset, length) -} - -// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 -if (typeof Symbol !== 'undefined' && Symbol.species != null && - Buffer[Symbol.species] === Buffer) { - Object.defineProperty(Buffer, Symbol.species, { - value: null, - configurable: true, - enumerable: false, - writable: false - }) -} - -Buffer.poolSize = 8192 // not used by this implementation - -function from (value, encodingOrOffset, length) { - if (typeof value === 'string') { - return fromString(value, encodingOrOffset) - } - - if (ArrayBuffer.isView(value)) { - return fromArrayLike(value) - } - - if (value == null) { - throw new TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) - } - - if (isInstance(value, ArrayBuffer) || - (value && isInstance(value.buffer, ArrayBuffer))) { - return fromArrayBuffer(value, encodingOrOffset, length) - } - - if (typeof value === 'number') { - throw new TypeError( - 'The "value" argument must not be of type number. Received type number' - ) - } - - var valueOf = value.valueOf && value.valueOf() - if (valueOf != null && valueOf !== value) { - return Buffer.from(valueOf, encodingOrOffset, length) - } - - var b = fromObject(value) - if (b) return b - - if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && - typeof value[Symbol.toPrimitive] === 'function') { - return Buffer.from( - value[Symbol.toPrimitive]('string'), encodingOrOffset, length - ) - } - - throw new TypeError( - 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + - 'or Array-like Object. Received type ' + (typeof value) - ) -} - -/** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ -Buffer.from = function (value, encodingOrOffset, length) { - return from(value, encodingOrOffset, length) -} - -// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: -// https://github.com/feross/buffer/pull/148 -Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype) -Object.setPrototypeOf(Buffer, Uint8Array) - -function assertSize (size) { - if (typeof size !== 'number') { - throw new TypeError('"size" argument must be of type number') - } else if (size < 0) { - throw new RangeError('The value "' + size + '" is invalid for option "size"') - } -} - -function alloc (size, fill, encoding) { - assertSize(size) - if (size <= 0) { - return createBuffer(size) - } - if (fill !== undefined) { - // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpretted as a start offset. - return typeof encoding === 'string' - ? createBuffer(size).fill(fill, encoding) - : createBuffer(size).fill(fill) - } - return createBuffer(size) -} - -/** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ -Buffer.alloc = function (size, fill, encoding) { - return alloc(size, fill, encoding) -} - -function allocUnsafe (size) { - assertSize(size) - return createBuffer(size < 0 ? 0 : checked(size) | 0) -} - -/** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ -Buffer.allocUnsafe = function (size) { - return allocUnsafe(size) -} -/** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ -Buffer.allocUnsafeSlow = function (size) { - return allocUnsafe(size) -} - -function fromString (string, encoding) { - if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8' - } - - if (!Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - - var length = byteLength(string, encoding) | 0 - var buf = createBuffer(length) - - var actual = buf.write(string, encoding) - - if (actual !== length) { - // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - buf = buf.slice(0, actual) - } - - return buf -} - -function fromArrayLike (array) { - var length = array.length < 0 ? 0 : checked(array.length) | 0 - var buf = createBuffer(length) - for (var i = 0; i < length; i += 1) { - buf[i] = array[i] & 255 - } - return buf -} - -function fromArrayBuffer (array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('"offset" is outside of buffer bounds') - } - - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('"length" is outside of buffer bounds') - } - - var buf - if (byteOffset === undefined && length === undefined) { - buf = new Uint8Array(array) - } else if (length === undefined) { - buf = new Uint8Array(array, byteOffset) - } else { - buf = new Uint8Array(array, byteOffset, length) - } - - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(buf, Buffer.prototype) - - return buf -} - -function fromObject (obj) { - if (Buffer.isBuffer(obj)) { - var len = checked(obj.length) | 0 - var buf = createBuffer(len) - - if (buf.length === 0) { - return buf - } - - obj.copy(buf, 0, 0, len) - return buf - } - - if (obj.length !== undefined) { - if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { - return createBuffer(0) - } - return fromArrayLike(obj) - } - - if (obj.type === 'Buffer' && Array.isArray(obj.data)) { - return fromArrayLike(obj.data) - } -} - -function checked (length) { - // Note: cannot use `length < K_MAX_LENGTH` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= K_MAX_LENGTH) { - throw new RangeError('Attempt to allocate Buffer larger than maximum ' + - 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes') - } - return length | 0 -} - -function SlowBuffer (length) { - if (+length != length) { // eslint-disable-line eqeqeq - length = 0 - } - return Buffer.alloc(+length) -} - -Buffer.isBuffer = function isBuffer (b) { - return b != null && b._isBuffer === true && - b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false -} - -Buffer.compare = function compare (a, b) { - if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) - if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - throw new TypeError( - 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' - ) - } - - if (a === b) return 0 - - var x = a.length - var y = b.length - - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i] - y = b[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -Buffer.isEncoding = function isEncoding (encoding) { - switch (String(encoding).toLowerCase()) { - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true - default: - return false - } -} - -Buffer.concat = function concat (list, length) { - if (!Array.isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - - if (list.length === 0) { - return Buffer.alloc(0) - } - - var i - if (length === undefined) { - length = 0 - for (i = 0; i < list.length; ++i) { - length += list[i].length - } - } - - var buffer = Buffer.allocUnsafe(length) - var pos = 0 - for (i = 0; i < list.length; ++i) { - var buf = list[i] - if (isInstance(buf, Uint8Array)) { - buf = Buffer.from(buf) - } - if (!Buffer.isBuffer(buf)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - buf.copy(buffer, pos) - pos += buf.length - } - return buffer -} - -function byteLength (string, encoding) { - if (Buffer.isBuffer(string)) { - return string.length - } - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { - return string.byteLength - } - if (typeof string !== 'string') { - throw new TypeError( - 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + - 'Received type ' + typeof string - ) - } - - var len = string.length - var mustMatch = (arguments.length > 2 && arguments[2] === true) - if (!mustMatch && len === 0) return 0 - - // Use a for loop to avoid recursion - var loweredCase = false - for (;;) { - switch (encoding) { - case 'ascii': - case 'latin1': - case 'binary': - return len - case 'utf8': - case 'utf-8': - return utf8ToBytes(string).length - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2 - case 'hex': - return len >>> 1 - case 'base64': - return base64ToBytes(string).length - default: - if (loweredCase) { - return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 - } - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} -Buffer.byteLength = byteLength - -function slowToString (encoding, start, end) { - var loweredCase = false - - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. - - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (start === undefined || start < 0) { - start = 0 - } - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) { - return '' - } - - if (end === undefined || end > this.length) { - end = this.length - } - - if (end <= 0) { - return '' - } - - // Force coersion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0 - start >>>= 0 - - if (end <= start) { - return '' - } - - if (!encoding) encoding = 'utf8' - - while (true) { - switch (encoding) { - case 'hex': - return hexSlice(this, start, end) - - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end) - - case 'ascii': - return asciiSlice(this, start, end) - - case 'latin1': - case 'binary': - return latin1Slice(this, start, end) - - case 'base64': - return base64Slice(this, start, end) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = (encoding + '').toLowerCase() - loweredCase = true - } - } -} - -// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) -// to detect a Buffer instance. It's not possible to use `instanceof Buffer` -// reliably in a browserify context because there could be multiple different -// copies of the 'buffer' package in use. This method works even for Buffer -// instances that were created from another copy of the `buffer` package. -// See: https://github.com/feross/buffer/issues/154 -Buffer.prototype._isBuffer = true - -function swap (b, n, m) { - var i = b[n] - b[n] = b[m] - b[m] = i -} - -Buffer.prototype.swap16 = function swap16 () { - var len = this.length - if (len % 2 !== 0) { - throw new RangeError('Buffer size must be a multiple of 16-bits') - } - for (var i = 0; i < len; i += 2) { - swap(this, i, i + 1) - } - return this -} - -Buffer.prototype.swap32 = function swap32 () { - var len = this.length - if (len % 4 !== 0) { - throw new RangeError('Buffer size must be a multiple of 32-bits') - } - for (var i = 0; i < len; i += 4) { - swap(this, i, i + 3) - swap(this, i + 1, i + 2) - } - return this -} - -Buffer.prototype.swap64 = function swap64 () { - var len = this.length - if (len % 8 !== 0) { - throw new RangeError('Buffer size must be a multiple of 64-bits') - } - for (var i = 0; i < len; i += 8) { - swap(this, i, i + 7) - swap(this, i + 1, i + 6) - swap(this, i + 2, i + 5) - swap(this, i + 3, i + 4) - } - return this -} - -Buffer.prototype.toString = function toString () { - var length = this.length - if (length === 0) return '' - if (arguments.length === 0) return utf8Slice(this, 0, length) - return slowToString.apply(this, arguments) -} - -Buffer.prototype.toLocaleString = Buffer.prototype.toString - -Buffer.prototype.equals = function equals (b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') - if (this === b) return true - return Buffer.compare(this, b) === 0 -} - -Buffer.prototype.inspect = function inspect () { - var str = '' - var max = exports.INSPECT_MAX_BYTES - str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() - if (this.length > max) str += ' ... ' - return '' -} -if (customInspectSymbol) { - Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect -} - -Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) { - target = Buffer.from(target, target.offset, target.byteLength) - } - if (!Buffer.isBuffer(target)) { - throw new TypeError( - 'The "target" argument must be one of type Buffer or Uint8Array. ' + - 'Received type ' + (typeof target) - ) - } - - if (start === undefined) { - start = 0 - } - if (end === undefined) { - end = target ? target.length : 0 - } - if (thisStart === undefined) { - thisStart = 0 - } - if (thisEnd === undefined) { - thisEnd = this.length - } - - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError('out of range index') - } - - if (thisStart >= thisEnd && start >= end) { - return 0 - } - if (thisStart >= thisEnd) { - return -1 - } - if (start >= end) { - return 1 - } - - start >>>= 0 - end >>>= 0 - thisStart >>>= 0 - thisEnd >>>= 0 - - if (this === target) return 0 - - var x = thisEnd - thisStart - var y = end - start - var len = Math.min(x, y) - - var thisCopy = this.slice(thisStart, thisEnd) - var targetCopy = target.slice(start, end) - - for (var i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i] - y = targetCopy[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, -// OR the last index of `val` in `buffer` at offset <= `byteOffset`. -// -// Arguments: -// - buffer - a Buffer to search -// - val - a string, Buffer, or number -// - byteOffset - an index into `buffer`; will be clamped to an int32 -// - encoding - an optional encoding, relevant is val is a string -// - dir - true for indexOf, false for lastIndexOf -function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (buffer.length === 0) return -1 - - // Normalize byteOffset - if (typeof byteOffset === 'string') { - encoding = byteOffset - byteOffset = 0 - } else if (byteOffset > 0x7fffffff) { - byteOffset = 0x7fffffff - } else if (byteOffset < -0x80000000) { - byteOffset = -0x80000000 - } - byteOffset = +byteOffset // Coerce to Number. - if (numberIsNaN(byteOffset)) { - // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : (buffer.length - 1) - } - - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset - if (byteOffset >= buffer.length) { - if (dir) return -1 - else byteOffset = buffer.length - 1 - } else if (byteOffset < 0) { - if (dir) byteOffset = 0 - else return -1 - } - - // Normalize val - if (typeof val === 'string') { - val = Buffer.from(val, encoding) - } - - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (val.length === 0) { - return -1 - } - return arrayIndexOf(buffer, val, byteOffset, encoding, dir) - } else if (typeof val === 'number') { - val = val & 0xFF // Search for a byte value [0-255] - if (typeof Uint8Array.prototype.indexOf === 'function') { - if (dir) { - return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) - } else { - return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) - } - } - return arrayIndexOf(buffer, [val], byteOffset, encoding, dir) - } - - throw new TypeError('val must be string, number or Buffer') -} - -function arrayIndexOf (arr, val, byteOffset, encoding, dir) { - var indexSize = 1 - var arrLength = arr.length - var valLength = val.length - - if (encoding !== undefined) { - encoding = String(encoding).toLowerCase() - if (encoding === 'ucs2' || encoding === 'ucs-2' || - encoding === 'utf16le' || encoding === 'utf-16le') { - if (arr.length < 2 || val.length < 2) { - return -1 - } - indexSize = 2 - arrLength /= 2 - valLength /= 2 - byteOffset /= 2 - } - } - - function read (buf, i) { - if (indexSize === 1) { - return buf[i] - } else { - return buf.readUInt16BE(i * indexSize) - } - } - - var i - if (dir) { - var foundIndex = -1 - for (i = byteOffset; i < arrLength; i++) { - if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize - } else { - if (foundIndex !== -1) i -= i - foundIndex - foundIndex = -1 - } - } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength - for (i = byteOffset; i >= 0; i--) { - var found = true - for (var j = 0; j < valLength; j++) { - if (read(arr, i + j) !== read(val, j)) { - found = false - break - } - } - if (found) return i - } - } - - return -1 -} - -Buffer.prototype.includes = function includes (val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1 -} - -Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true) -} - -Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false) -} - -function hexWrite (buf, string, offset, length) { - offset = Number(offset) || 0 - var remaining = buf.length - offset - if (!length) { - length = remaining - } else { - length = Number(length) - if (length > remaining) { - length = remaining - } - } - - var strLen = string.length - - if (length > strLen / 2) { - length = strLen / 2 - } - for (var i = 0; i < length; ++i) { - var parsed = parseInt(string.substr(i * 2, 2), 16) - if (numberIsNaN(parsed)) return i - buf[offset + i] = parsed - } - return i -} - -function utf8Write (buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) -} - -function asciiWrite (buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length) -} - -function latin1Write (buf, string, offset, length) { - return asciiWrite(buf, string, offset, length) -} - -function base64Write (buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length) -} - -function ucs2Write (buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) -} - -Buffer.prototype.write = function write (string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8' - length = this.length - offset = 0 - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset - length = this.length - offset = 0 - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset >>> 0 - if (isFinite(length)) { - length = length >>> 0 - if (encoding === undefined) encoding = 'utf8' - } else { - encoding = length - length = undefined - } - } else { - throw new Error( - 'Buffer.write(string, encoding, offset[, length]) is no longer supported' - ) - } - - var remaining = this.length - offset - if (length === undefined || length > remaining) length = remaining - - if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { - throw new RangeError('Attempt to write outside buffer bounds') - } - - if (!encoding) encoding = 'utf8' - - var loweredCase = false - for (;;) { - switch (encoding) { - case 'hex': - return hexWrite(this, string, offset, length) - - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length) - - case 'ascii': - return asciiWrite(this, string, offset, length) - - case 'latin1': - case 'binary': - return latin1Write(this, string, offset, length) - - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} - -Buffer.prototype.toJSON = function toJSON () { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - } -} - -function base64Slice (buf, start, end) { - if (start === 0 && end === buf.length) { - return base64.fromByteArray(buf) - } else { - return base64.fromByteArray(buf.slice(start, end)) - } -} - -function utf8Slice (buf, start, end) { - end = Math.min(buf.length, end) - var res = [] - - var i = start - while (i < end) { - var firstByte = buf[i] - var codePoint = null - var bytesPerSequence = (firstByte > 0xEF) ? 4 - : (firstByte > 0xDF) ? 3 - : (firstByte > 0xBF) ? 2 - : 1 - - if (i + bytesPerSequence <= end) { - var secondByte, thirdByte, fourthByte, tempCodePoint - - switch (bytesPerSequence) { - case 1: - if (firstByte < 0x80) { - codePoint = firstByte - } - break - case 2: - secondByte = buf[i + 1] - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) - if (tempCodePoint > 0x7F) { - codePoint = tempCodePoint - } - } - break - case 3: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { - codePoint = tempCodePoint - } - } - break - case 4: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - fourthByte = buf[i + 3] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { - codePoint = tempCodePoint - } - } - } - } - - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD - bytesPerSequence = 1 - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000 - res.push(codePoint >>> 10 & 0x3FF | 0xD800) - codePoint = 0xDC00 | codePoint & 0x3FF - } - - res.push(codePoint) - i += bytesPerSequence - } - - return decodeCodePointsArray(res) -} - -// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -var MAX_ARGUMENTS_LENGTH = 0x1000 - -function decodeCodePointsArray (codePoints) { - var len = codePoints.length - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - } - - // Decode in chunks to avoid "call stack size exceeded". - var res = '' - var i = 0 - while (i < len) { - res += String.fromCharCode.apply( - String, - codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) - ) - } - return res -} - -function asciiSlice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i] & 0x7F) - } - return ret -} - -function latin1Slice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i]) - } - return ret -} - -function hexSlice (buf, start, end) { - var len = buf.length - - if (!start || start < 0) start = 0 - if (!end || end < 0 || end > len) end = len - - var out = '' - for (var i = start; i < end; ++i) { - out += hexSliceLookupTable[buf[i]] - } - return out -} - -function utf16leSlice (buf, start, end) { - var bytes = buf.slice(start, end) - var res = '' - for (var i = 0; i < bytes.length; i += 2) { - res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256)) - } - return res -} - -Buffer.prototype.slice = function slice (start, end) { - var len = this.length - start = ~~start - end = end === undefined ? len : ~~end - - if (start < 0) { - start += len - if (start < 0) start = 0 - } else if (start > len) { - start = len - } - - if (end < 0) { - end += len - if (end < 0) end = 0 - } else if (end > len) { - end = len - } - - if (end < start) end = start - - var newBuf = this.subarray(start, end) - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(newBuf, Buffer.prototype) - - return newBuf -} - -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ -function checkOffset (offset, ext, length) { - if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') -} - -Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - - return val -} - -Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - checkOffset(offset, byteLength, this.length) - } - - var val = this[offset + --byteLength] - var mul = 1 - while (byteLength > 0 && (mul *= 0x100)) { - val += this[offset + --byteLength] * mul - } - - return val -} - -Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 1, this.length) - return this[offset] -} - -Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return this[offset] | (this[offset + 1] << 8) -} - -Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - return (this[offset] << 8) | this[offset + 1] -} - -Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return ((this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16)) + - (this[offset + 3] * 0x1000000) -} - -Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] * 0x1000000) + - ((this[offset + 1] << 16) | - (this[offset + 2] << 8) | - this[offset + 3]) -} - -Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var i = byteLength - var mul = 1 - var val = this[offset + --i] - while (i > 0 && (mul *= 0x100)) { - val += this[offset + --i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 1, this.length) - if (!(this[offset] & 0x80)) return (this[offset]) - return ((0xff - this[offset] + 1) * -1) -} - -Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset] | (this[offset + 1] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset + 1] | (this[offset] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16) | - (this[offset + 3] << 24) -} - -Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] << 24) | - (this[offset + 1] << 16) | - (this[offset + 2] << 8) | - (this[offset + 3]) -} - -Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, true, 23, 4) -} - -Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, false, 23, 4) -} - -Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, true, 52, 8) -} - -Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { - offset = offset >>> 0 - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, false, 52, 8) -} - -function checkInt (buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') - if (offset + ext > buf.length) throw new RangeError('Index out of range') -} - -Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var mul = 1 - var i = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - byteLength = byteLength >>> 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var i = byteLength - 1 - var mul = 1 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - return offset + 2 -} - -Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - return offset + 2 -} - -Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - this[offset + 3] = (value >>> 24) - this[offset + 2] = (value >>> 16) - this[offset + 1] = (value >>> 8) - this[offset] = (value & 0xff) - return offset + 4 -} - -Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - return offset + 4 -} - -Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - var limit = Math.pow(2, (8 * byteLength) - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = 0 - var mul = 1 - var sub = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - var limit = Math.pow(2, (8 * byteLength) - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = byteLength - 1 - var mul = 1 - var sub = 0 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) - if (value < 0) value = 0xff + value + 1 - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - return offset + 2 -} - -Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - return offset + 2 -} - -Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - this[offset + 2] = (value >>> 16) - this[offset + 3] = (value >>> 24) - return offset + 4 -} - -Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (value < 0) value = 0xffffffff + value + 1 - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - return offset + 4 -} - -function checkIEEE754 (buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range') - if (offset < 0) throw new RangeError('Index out of range') -} - -function writeFloat (buf, value, offset, littleEndian, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) - } - ieee754.write(buf, value, offset, littleEndian, 23, 4) - return offset + 4 -} - -Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert) -} - -function writeDouble (buf, value, offset, littleEndian, noAssert) { - value = +value - offset = offset >>> 0 - if (!noAssert) { - checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) - } - ieee754.write(buf, value, offset, littleEndian, 52, 8) - return offset + 8 -} - -Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert) -} - -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy (target, targetStart, start, end) { - if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') - if (!start) start = 0 - if (!end && end !== 0) end = this.length - if (targetStart >= target.length) targetStart = target.length - if (!targetStart) targetStart = 0 - if (end > 0 && end < start) end = start - - // Copy 0 bytes; we're done - if (end === start) return 0 - if (target.length === 0 || this.length === 0) return 0 - - // Fatal error conditions - if (targetStart < 0) { - throw new RangeError('targetStart out of bounds') - } - if (start < 0 || start >= this.length) throw new RangeError('Index out of range') - if (end < 0) throw new RangeError('sourceEnd out of bounds') - - // Are we oob? - if (end > this.length) end = this.length - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start - } - - var len = end - start - - if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { - // Use built-in when available, missing from IE11 - this.copyWithin(targetStart, start, end) - } else if (this === target && start < targetStart && targetStart < end) { - // descending copy from end - for (var i = len - 1; i >= 0; --i) { - target[i + targetStart] = this[i + start] - } - } else { - Uint8Array.prototype.set.call( - target, - this.subarray(start, end), - targetStart - ) - } - - return len -} - -// Usage: -// buffer.fill(number[, offset[, end]]) -// buffer.fill(buffer[, offset[, end]]) -// buffer.fill(string[, offset[, end]][, encoding]) -Buffer.prototype.fill = function fill (val, start, end, encoding) { - // Handle string cases: - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start - start = 0 - end = this.length - } else if (typeof end === 'string') { - encoding = end - end = this.length - } - if (encoding !== undefined && typeof encoding !== 'string') { - throw new TypeError('encoding must be a string') - } - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - if (val.length === 1) { - var code = val.charCodeAt(0) - if ((encoding === 'utf8' && code < 128) || - encoding === 'latin1') { - // Fast path: If `val` fits into a single byte, use that numeric value. - val = code - } - } - } else if (typeof val === 'number') { - val = val & 255 - } else if (typeof val === 'boolean') { - val = Number(val) - } - - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) { - throw new RangeError('Out of range index') - } - - if (end <= start) { - return this - } - - start = start >>> 0 - end = end === undefined ? this.length : end >>> 0 - - if (!val) val = 0 - - var i - if (typeof val === 'number') { - for (i = start; i < end; ++i) { - this[i] = val - } - } else { - var bytes = Buffer.isBuffer(val) - ? val - : Buffer.from(val, encoding) - var len = bytes.length - if (len === 0) { - throw new TypeError('The value "' + val + - '" is invalid for argument "value"') - } - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len] - } - } - - return this -} - -// HELPER FUNCTIONS -// ================ - -var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g - -function base64clean (str) { - // Node takes equal signs as end of the Base64 encoding - str = str.split('=')[0] - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = str.trim().replace(INVALID_BASE64_RE, '') - // Node converts strings with length < 2 to '' - if (str.length < 2) return '' - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while (str.length % 4 !== 0) { - str = str + '=' - } - return str -} - -function utf8ToBytes (string, units) { - units = units || Infinity - var codePoint - var length = string.length - var leadSurrogate = null - var bytes = [] - - for (var i = 0; i < length; ++i) { - codePoint = string.charCodeAt(i) - - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } - - // valid lead - leadSurrogate = codePoint - - continue - } - - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - leadSurrogate = codePoint - continue - } - - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 - } else if (leadSurrogate) { - // valid bmp char, but last char was a lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - } - - leadSurrogate = null - - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break - bytes.push(codePoint) - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break - bytes.push( - codePoint >> 0x6 | 0xC0, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break - bytes.push( - codePoint >> 0xC | 0xE0, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break - bytes.push( - codePoint >> 0x12 | 0xF0, - codePoint >> 0xC & 0x3F | 0x80, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else { - throw new Error('Invalid code point') - } - } - - return bytes -} - -function asciiToBytes (str) { - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - // Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF) - } - return byteArray -} - -function utf16leToBytes (str, units) { - var c, hi, lo - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) break - - c = str.charCodeAt(i) - hi = c >> 8 - lo = c % 256 - byteArray.push(lo) - byteArray.push(hi) - } - - return byteArray -} - -function base64ToBytes (str) { - return base64.toByteArray(base64clean(str)) -} - -function blitBuffer (src, dst, offset, length) { - for (var i = 0; i < length; ++i) { - if ((i + offset >= dst.length) || (i >= src.length)) break - dst[i + offset] = src[i] - } - return i -} - -// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass -// the `instanceof` check but they should be treated as of that type. -// See: https://github.com/feross/buffer/issues/166 -function isInstance (obj, type) { - return obj instanceof type || - (obj != null && obj.constructor != null && obj.constructor.name != null && - obj.constructor.name === type.name) -} -function numberIsNaN (obj) { - // For IE11 support - return obj !== obj // eslint-disable-line no-self-compare -} - -// Create lookup table for `toString('hex')` -// See: https://github.com/feross/buffer/issues/219 -var hexSliceLookupTable = (function () { - var alphabet = '0123456789abcdef' - var table = new Array(256) - for (var i = 0; i < 16; ++i) { - var i16 = i * 16 - for (var j = 0; j < 16; ++j) { - table[i16 + j] = alphabet[i] + alphabet[j] - } - } - return table -})() - -}).call(this,require("buffer").Buffer) -},{"base64-js":29,"buffer":48,"ieee754":73}],49:[function(require,module,exports){ -var Buffer = require('buffer').Buffer; // for use with browserify - -module.exports = function (a, b) { - if (!Buffer.isBuffer(a)) return undefined; - if (!Buffer.isBuffer(b)) return undefined; - if (typeof a.equals === 'function') return a.equals(b); - if (a.length !== b.length) return false; - - for (var i = 0; i < a.length; i++) { - if (a[i] !== b[i]) return false; - } - - return true; -}; - -},{"buffer":48}],50:[function(require,module,exports){ -module.exports = { - "100": "Continue", - "101": "Switching Protocols", - "102": "Processing", - "200": "OK", - "201": "Created", - "202": "Accepted", - "203": "Non-Authoritative Information", - "204": "No Content", - "205": "Reset Content", - "206": "Partial Content", - "207": "Multi-Status", - "208": "Already Reported", - "226": "IM Used", - "300": "Multiple Choices", - "301": "Moved Permanently", - "302": "Found", - "303": "See Other", - "304": "Not Modified", - "305": "Use Proxy", - "307": "Temporary Redirect", - "308": "Permanent Redirect", - "400": "Bad Request", - "401": "Unauthorized", - "402": "Payment Required", - "403": "Forbidden", - "404": "Not Found", - "405": "Method Not Allowed", - "406": "Not Acceptable", - "407": "Proxy Authentication Required", - "408": "Request Timeout", - "409": "Conflict", - "410": "Gone", - "411": "Length Required", - "412": "Precondition Failed", - "413": "Payload Too Large", - "414": "URI Too Long", - "415": "Unsupported Media Type", - "416": "Range Not Satisfiable", - "417": "Expectation Failed", - "418": "I'm a teapot", - "421": "Misdirected Request", - "422": "Unprocessable Entity", - "423": "Locked", - "424": "Failed Dependency", - "425": "Unordered Collection", - "426": "Upgrade Required", - "428": "Precondition Required", - "429": "Too Many Requests", - "431": "Request Header Fields Too Large", - "451": "Unavailable For Legal Reasons", - "500": "Internal Server Error", - "501": "Not Implemented", - "502": "Bad Gateway", - "503": "Service Unavailable", - "504": "Gateway Timeout", - "505": "HTTP Version Not Supported", - "506": "Variant Also Negotiates", - "507": "Insufficient Storage", - "508": "Loop Detected", - "509": "Bandwidth Limit Exceeded", - "510": "Not Extended", - "511": "Network Authentication Required" -} - -},{}],51:[function(require,module,exports){ -(function (Buffer){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. - -function isArray(arg) { - if (Array.isArray) { - return Array.isArray(arg); - } - return objectToString(arg) === '[object Array]'; -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -exports.isBuffer = Buffer.isBuffer; - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - -}).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":76}],52:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var objectCreate = Object.create || objectCreatePolyfill -var objectKeys = Object.keys || objectKeysPolyfill -var bind = Function.prototype.bind || functionBindPolyfill - -function EventEmitter() { - if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) { - this._events = objectCreate(null); - this._eventsCount = 0; - } - - this._maxListeners = this._maxListeners || undefined; -} -module.exports = EventEmitter; - -// Backwards-compat with node 0.10.x -EventEmitter.EventEmitter = EventEmitter; - -EventEmitter.prototype._events = undefined; -EventEmitter.prototype._maxListeners = undefined; - -// By default EventEmitters will print a warning if more than 10 listeners are -// added to it. This is a useful default which helps finding memory leaks. -var defaultMaxListeners = 10; - -var hasDefineProperty; -try { - var o = {}; - if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 }); - hasDefineProperty = o.x === 0; -} catch (err) { hasDefineProperty = false } -if (hasDefineProperty) { - Object.defineProperty(EventEmitter, 'defaultMaxListeners', { - enumerable: true, - get: function() { - return defaultMaxListeners; - }, - set: function(arg) { - // check whether the input is a positive number (whose value is zero or - // greater and not a NaN). - if (typeof arg !== 'number' || arg < 0 || arg !== arg) - throw new TypeError('"defaultMaxListeners" must be a positive number'); - defaultMaxListeners = arg; - } - }); -} else { - EventEmitter.defaultMaxListeners = defaultMaxListeners; -} - -// Obviously not all Emitters should be limited to 10. This function allows -// that to be increased. Set to zero for unlimited. -EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { - if (typeof n !== 'number' || n < 0 || isNaN(n)) - throw new TypeError('"n" argument must be a positive number'); - this._maxListeners = n; - return this; -}; - -function $getMaxListeners(that) { - if (that._maxListeners === undefined) - return EventEmitter.defaultMaxListeners; - return that._maxListeners; -} - -EventEmitter.prototype.getMaxListeners = function getMaxListeners() { - return $getMaxListeners(this); -}; - -// These standalone emit* functions are used to optimize calling of event -// handlers for fast cases because emit() itself often has a variable number of -// arguments and can be deoptimized because of that. These functions always have -// the same number of arguments and thus do not get deoptimized, so the code -// inside them can execute faster. -function emitNone(handler, isFn, self) { - if (isFn) - handler.call(self); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self); - } -} -function emitOne(handler, isFn, self, arg1) { - if (isFn) - handler.call(self, arg1); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1); - } -} -function emitTwo(handler, isFn, self, arg1, arg2) { - if (isFn) - handler.call(self, arg1, arg2); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1, arg2); - } -} -function emitThree(handler, isFn, self, arg1, arg2, arg3) { - if (isFn) - handler.call(self, arg1, arg2, arg3); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].call(self, arg1, arg2, arg3); - } -} - -function emitMany(handler, isFn, self, args) { - if (isFn) - handler.apply(self, args); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for (var i = 0; i < len; ++i) - listeners[i].apply(self, args); - } -} - -EventEmitter.prototype.emit = function emit(type) { - var er, handler, len, args, i, events; - var doError = (type === 'error'); - - events = this._events; - if (events) - doError = (doError && events.error == null); - else if (!doError) - return false; - - // If there is no 'error' event listener then throw. - if (doError) { - if (arguments.length > 1) - er = arguments[1]; - if (er instanceof Error) { - throw er; // Unhandled 'error' event - } else { - // At least give some kind of context to the user - var err = new Error('Unhandled "error" event. (' + er + ')'); - err.context = er; - throw err; - } - return false; - } - - handler = events[type]; - - if (!handler) - return false; - - var isFn = typeof handler === 'function'; - len = arguments.length; - switch (len) { - // fast cases - case 1: - emitNone(handler, isFn, this); - break; - case 2: - emitOne(handler, isFn, this, arguments[1]); - break; - case 3: - emitTwo(handler, isFn, this, arguments[1], arguments[2]); - break; - case 4: - emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]); - break; - // slower - default: - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - emitMany(handler, isFn, this, args); - } - - return true; -}; - -function _addListener(target, type, listener, prepend) { - var m; - var events; - var existing; - - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - - events = target._events; - if (!events) { - events = target._events = objectCreate(null); - target._eventsCount = 0; - } else { - // To avoid recursion in the case that type === "newListener"! Before - // adding it to the listeners, first emit "newListener". - if (events.newListener) { - target.emit('newListener', type, - listener.listener ? listener.listener : listener); - - // Re-assign `events` because a newListener handler could have caused the - // this._events to be assigned to a new object - events = target._events; - } - existing = events[type]; - } - - if (!existing) { - // Optimize the case of one listener. Don't need the extra array object. - existing = events[type] = listener; - ++target._eventsCount; - } else { - if (typeof existing === 'function') { - // Adding the second element, need to change to array. - existing = events[type] = - prepend ? [listener, existing] : [existing, listener]; - } else { - // If we've already got an array, just append. - if (prepend) { - existing.unshift(listener); - } else { - existing.push(listener); - } - } - - // Check for listener leak - if (!existing.warned) { - m = $getMaxListeners(target); - if (m && m > 0 && existing.length > m) { - existing.warned = true; - var w = new Error('Possible EventEmitter memory leak detected. ' + - existing.length + ' "' + String(type) + '" listeners ' + - 'added. Use emitter.setMaxListeners() to ' + - 'increase limit.'); - w.name = 'MaxListenersExceededWarning'; - w.emitter = target; - w.type = type; - w.count = existing.length; - if (typeof console === 'object' && console.warn) { - console.warn('%s: %s', w.name, w.message); - } - } - } - } - - return target; -} - -EventEmitter.prototype.addListener = function addListener(type, listener) { - return _addListener(this, type, listener, false); -}; - -EventEmitter.prototype.on = EventEmitter.prototype.addListener; - -EventEmitter.prototype.prependListener = - function prependListener(type, listener) { - return _addListener(this, type, listener, true); - }; - -function onceWrapper() { - if (!this.fired) { - this.target.removeListener(this.type, this.wrapFn); - this.fired = true; - switch (arguments.length) { - case 0: - return this.listener.call(this.target); - case 1: - return this.listener.call(this.target, arguments[0]); - case 2: - return this.listener.call(this.target, arguments[0], arguments[1]); - case 3: - return this.listener.call(this.target, arguments[0], arguments[1], - arguments[2]); - default: - var args = new Array(arguments.length); - for (var i = 0; i < args.length; ++i) - args[i] = arguments[i]; - this.listener.apply(this.target, args); - } - } -} - -function _onceWrap(target, type, listener) { - var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; - var wrapped = bind.call(onceWrapper, state); - wrapped.listener = listener; - state.wrapFn = wrapped; - return wrapped; -} - -EventEmitter.prototype.once = function once(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - this.on(type, _onceWrap(this, type, listener)); - return this; -}; - -EventEmitter.prototype.prependOnceListener = - function prependOnceListener(type, listener) { - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - this.prependListener(type, _onceWrap(this, type, listener)); - return this; - }; - -// Emits a 'removeListener' event if and only if the listener was removed. -EventEmitter.prototype.removeListener = - function removeListener(type, listener) { - var list, events, position, i, originalListener; - - if (typeof listener !== 'function') - throw new TypeError('"listener" argument must be a function'); - - events = this._events; - if (!events) - return this; - - list = events[type]; - if (!list) - return this; - - if (list === listener || list.listener === listener) { - if (--this._eventsCount === 0) - this._events = objectCreate(null); - else { - delete events[type]; - if (events.removeListener) - this.emit('removeListener', type, list.listener || listener); - } - } else if (typeof list !== 'function') { - position = -1; - - for (i = list.length - 1; i >= 0; i--) { - if (list[i] === listener || list[i].listener === listener) { - originalListener = list[i].listener; - position = i; - break; - } - } - - if (position < 0) - return this; - - if (position === 0) - list.shift(); - else - spliceOne(list, position); - - if (list.length === 1) - events[type] = list[0]; - - if (events.removeListener) - this.emit('removeListener', type, originalListener || listener); - } - - return this; - }; - -EventEmitter.prototype.removeAllListeners = - function removeAllListeners(type) { - var listeners, events, i; - - events = this._events; - if (!events) - return this; - - // not listening for removeListener, no need to emit - if (!events.removeListener) { - if (arguments.length === 0) { - this._events = objectCreate(null); - this._eventsCount = 0; - } else if (events[type]) { - if (--this._eventsCount === 0) - this._events = objectCreate(null); - else - delete events[type]; - } - return this; - } - - // emit removeListener for all listeners on all events - if (arguments.length === 0) { - var keys = objectKeys(events); - var key; - for (i = 0; i < keys.length; ++i) { - key = keys[i]; - if (key === 'removeListener') continue; - this.removeAllListeners(key); - } - this.removeAllListeners('removeListener'); - this._events = objectCreate(null); - this._eventsCount = 0; - return this; - } - - listeners = events[type]; - - if (typeof listeners === 'function') { - this.removeListener(type, listeners); - } else if (listeners) { - // LIFO order - for (i = listeners.length - 1; i >= 0; i--) { - this.removeListener(type, listeners[i]); - } - } - - return this; - }; - -function _listeners(target, type, unwrap) { - var events = target._events; - - if (!events) - return []; - - var evlistener = events[type]; - if (!evlistener) - return []; - - if (typeof evlistener === 'function') - return unwrap ? [evlistener.listener || evlistener] : [evlistener]; - - return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); -} - -EventEmitter.prototype.listeners = function listeners(type) { - return _listeners(this, type, true); -}; - -EventEmitter.prototype.rawListeners = function rawListeners(type) { - return _listeners(this, type, false); -}; - -EventEmitter.listenerCount = function(emitter, type) { - if (typeof emitter.listenerCount === 'function') { - return emitter.listenerCount(type); - } else { - return listenerCount.call(emitter, type); - } -}; - -EventEmitter.prototype.listenerCount = listenerCount; -function listenerCount(type) { - var events = this._events; - - if (events) { - var evlistener = events[type]; - - if (typeof evlistener === 'function') { - return 1; - } else if (evlistener) { - return evlistener.length; - } - } - - return 0; -} - -EventEmitter.prototype.eventNames = function eventNames() { - return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : []; -}; - -// About 1.5x faster than the two-arg version of Array#splice(). -function spliceOne(list, index) { - for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) - list[i] = list[k]; - list.pop(); -} - -function arrayClone(arr, n) { - var copy = new Array(n); - for (var i = 0; i < n; ++i) - copy[i] = arr[i]; - return copy; -} - -function unwrapListeners(arr) { - var ret = new Array(arr.length); - for (var i = 0; i < ret.length; ++i) { - ret[i] = arr[i].listener || arr[i]; - } - return ret; -} - -function objectCreatePolyfill(proto) { - var F = function() {}; - F.prototype = proto; - return new F; -} -function objectKeysPolyfill(obj) { - var keys = []; - for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) { - keys.push(k); - } - return k; -} -function functionBindPolyfill(context) { - var fn = this; - return function () { - return fn.apply(context, arguments); - }; -} - -},{}],53:[function(require,module,exports){ -var Parser = require('./lib/parser'); - -function getGlobal() { - return (1,eval)('this'); -} - -module.exports = { - create: function(buffer, global) { - global = global || getGlobal(); - if(buffer instanceof global.ArrayBuffer) { - var DOMBufferStream = require('./lib/dom-bufferstream'); - return new Parser(new DOMBufferStream(buffer, 0, buffer.byteLength, true, global)); - } else { - var NodeBufferStream = require('./lib/bufferstream'); - return new Parser(new NodeBufferStream(buffer, 0, buffer.length, true)); - } - } -}; - -},{"./lib/bufferstream":54,"./lib/dom-bufferstream":56,"./lib/parser":60}],54:[function(require,module,exports){ -function BufferStream(buffer, offset, length, bigEndian) { - this.buffer = buffer; - this.offset = offset || 0; - length = typeof length === 'number' ? length : buffer.length; - this.endPosition = this.offset + length; - this.setBigEndian(bigEndian); -} - -BufferStream.prototype = { - setBigEndian: function(bigEndian) { - this.bigEndian = !!bigEndian; - }, - nextUInt8: function() { - var value = this.buffer.readUInt8(this.offset); - this.offset += 1; - return value; - }, - nextInt8: function() { - var value = this.buffer.readInt8(this.offset); - this.offset += 1; - return value; - }, - nextUInt16: function() { - var value = this.bigEndian ? this.buffer.readUInt16BE(this.offset) : this.buffer.readUInt16LE(this.offset); - this.offset += 2; - return value; - }, - nextUInt32: function() { - var value = this.bigEndian ? this.buffer.readUInt32BE(this.offset) : this.buffer.readUInt32LE(this.offset); - this.offset += 4; - return value; - }, - nextInt16: function() { - var value = this.bigEndian ? this.buffer.readInt16BE(this.offset) : this.buffer.readInt16LE(this.offset); - this.offset += 2; - return value; - }, - nextInt32: function() { - var value = this.bigEndian ? this.buffer.readInt32BE(this.offset) : this.buffer.readInt32LE(this.offset); - this.offset += 4; - return value; - }, - nextFloat: function() { - var value = this.bigEndian ? this.buffer.readFloatBE(this.offset) : this.buffer.readFloatLE(this.offset); - this.offset += 4; - return value; - }, - nextDouble: function() { - var value = this.bigEndian ? this.buffer.readDoubleBE(this.offset) : this.buffer.readDoubleLE(this.offset); - this.offset += 8; - return value; - }, - nextBuffer: function(length) { - var value = this.buffer.slice(this.offset, this.offset + length); - this.offset += length; - return value; - }, - remainingLength: function() { - return this.endPosition - this.offset; - }, - nextString: function(length) { - var value = this.buffer.toString('utf8', this.offset, this.offset + length); - this.offset += length; - return value; - }, - mark: function() { - var self = this; - return { - openWithOffset: function(offset) { - offset = (offset || 0) + this.offset; - return new BufferStream(self.buffer, offset, self.endPosition - offset, self.bigEndian); - }, - offset: this.offset - }; - }, - offsetFrom: function(marker) { - return this.offset - marker.offset; - }, - skip: function(amount) { - this.offset += amount; - }, - branch: function(offset, length) { - length = typeof length === 'number' ? length : this.endPosition - (this.offset + offset); - return new BufferStream(this.buffer, this.offset + offset, length, this.bigEndian); - } -}; - -module.exports = BufferStream; - -},{}],55:[function(require,module,exports){ -function parseNumber(s) { - return parseInt(s, 10); -} - -//in seconds -var hours = 3600; -var minutes = 60; - -//take date (year, month, day) and time (hour, minutes, seconds) digits in UTC -//and return a timestamp in seconds -function parseDateTimeParts(dateParts, timeParts) { - dateParts = dateParts.map(parseNumber); - timeParts = timeParts.map(parseNumber); - var year = dateParts[0]; - var month = dateParts[1] - 1; - var day = dateParts[2]; - var hours = timeParts[0]; - var minutes = timeParts[1]; - var seconds = timeParts[2]; - var date = Date.UTC(year, month, day, hours, minutes, seconds, 0); - var timestamp = date / 1000; - return timestamp; -} - -//parse date with "2004-09-04T23:39:06-08:00" format, -//one of the formats supported by ISO 8601, and -//convert to utc timestamp in seconds -function parseDateWithTimezoneFormat(dateTimeStr) { - - var dateParts = dateTimeStr.substr(0, 10).split('-'); - var timeParts = dateTimeStr.substr(11, 8).split(':'); - var timezoneStr = dateTimeStr.substr(19, 6); - var timezoneParts = timezoneStr.split(':').map(parseNumber); - var timezoneOffset = (timezoneParts[0] * hours) + - (timezoneParts[1] * minutes); - - var timestamp = parseDateTimeParts(dateParts, timeParts); - //minus because the timezoneOffset describes - //how much the described time is ahead of UTC - timestamp -= timezoneOffset; - - if(typeof timestamp === 'number' && !isNaN(timestamp)) { - return timestamp; - } -} - -//parse date with "YYYY:MM:DD hh:mm:ss" format, convert to utc timestamp in seconds -function parseDateWithSpecFormat(dateTimeStr) { - var parts = dateTimeStr.split(' '), - dateParts = parts[0].split(':'), - timeParts = parts[1].split(':'); - - var timestamp = parseDateTimeParts(dateParts, timeParts); - - if(typeof timestamp === 'number' && !isNaN(timestamp)) { - return timestamp; - } -} - -function parseExifDate(dateTimeStr) { - //some easy checks to determine two common date formats - - //is the date in the standard "YYYY:MM:DD hh:mm:ss" format? - var isSpecFormat = dateTimeStr.length === 19 && - dateTimeStr.charAt(4) === ':'; - //is the date in the non-standard format, - //"2004-09-04T23:39:06-08:00" to include a timezone? - var isTimezoneFormat = dateTimeStr.length === 25 && - dateTimeStr.charAt(10) === 'T'; - var timestamp; - - if(isTimezoneFormat) { - return parseDateWithTimezoneFormat(dateTimeStr); - } - else if(isSpecFormat) { - return parseDateWithSpecFormat(dateTimeStr); - } -} - -module.exports = { - parseDateWithSpecFormat: parseDateWithSpecFormat, - parseDateWithTimezoneFormat: parseDateWithTimezoneFormat, - parseExifDate: parseExifDate -}; - -},{}],56:[function(require,module,exports){ -/*jslint browser: true, devel: true, bitwise: false, debug: true, eqeq: false, es5: true, evil: false, forin: false, newcap: false, nomen: true, plusplus: true, regexp: false, unparam: false, sloppy: true, stupid: false, sub: false, todo: true, vars: true, white: true */ - -function DOMBufferStream(arrayBuffer, offset, length, bigEndian, global, parentOffset) { - this.global = global; - offset = offset || 0; - length = length || (arrayBuffer.byteLength - offset); - this.arrayBuffer = arrayBuffer.slice(offset, offset + length); - this.view = new global.DataView(this.arrayBuffer, 0, this.arrayBuffer.byteLength); - this.setBigEndian(bigEndian); - this.offset = 0; - this.parentOffset = (parentOffset || 0) + offset; -} - -DOMBufferStream.prototype = { - setBigEndian: function(bigEndian) { - this.littleEndian = !bigEndian; - }, - nextUInt8: function() { - var value = this.view.getUint8(this.offset); - this.offset += 1; - return value; - }, - nextInt8: function() { - var value = this.view.getInt8(this.offset); - this.offset += 1; - return value; - }, - nextUInt16: function() { - var value = this.view.getUint16(this.offset, this.littleEndian); - this.offset += 2; - return value; - }, - nextUInt32: function() { - var value = this.view.getUint32(this.offset, this.littleEndian); - this.offset += 4; - return value; - }, - nextInt16: function() { - var value = this.view.getInt16(this.offset, this.littleEndian); - this.offset += 2; - return value; - }, - nextInt32: function() { - var value = this.view.getInt32(this.offset, this.littleEndian); - this.offset += 4; - return value; - }, - nextFloat: function() { - var value = this.view.getFloat32(this.offset, this.littleEndian); - this.offset += 4; - return value; - }, - nextDouble: function() { - var value = this.view.getFloat64(this.offset, this.littleEndian); - this.offset += 8; - return value; - }, - nextBuffer: function(length) { - //this won't work in IE10 - var value = this.arrayBuffer.slice(this.offset, this.offset + length); - this.offset += length; - return value; - }, - remainingLength: function() { - return this.arrayBuffer.byteLength - this.offset; - }, - nextString: function(length) { - var value = this.arrayBuffer.slice(this.offset, this.offset + length); - value = String.fromCharCode.apply(null, new this.global.Uint8Array(value)); - this.offset += length; - return value; - }, - mark: function() { - var self = this; - return { - openWithOffset: function(offset) { - offset = (offset || 0) + this.offset; - return new DOMBufferStream(self.arrayBuffer, offset, self.arrayBuffer.byteLength - offset, !self.littleEndian, self.global, self.parentOffset); - }, - offset: this.offset, - getParentOffset: function() { - return self.parentOffset; - } - }; - }, - offsetFrom: function(marker) { - return this.parentOffset + this.offset - (marker.offset + marker.getParentOffset()); - }, - skip: function(amount) { - this.offset += amount; - }, - branch: function(offset, length) { - length = typeof length === 'number' ? length : this.arrayBuffer.byteLength - (this.offset + offset); - return new DOMBufferStream(this.arrayBuffer, this.offset + offset, length, !this.littleEndian, this.global, this.parentOffset); - } -}; - -module.exports = DOMBufferStream; - -},{}],57:[function(require,module,exports){ -module.exports = { - exif : { - 0x0001 : "InteropIndex", - 0x0002 : "InteropVersion", - 0x000B : "ProcessingSoftware", - 0x00FE : "SubfileType", - 0x00FF : "OldSubfileType", - 0x0100 : "ImageWidth", - 0x0101 : "ImageHeight", - 0x0102 : "BitsPerSample", - 0x0103 : "Compression", - 0x0106 : "PhotometricInterpretation", - 0x0107 : "Thresholding", - 0x0108 : "CellWidth", - 0x0109 : "CellLength", - 0x010A : "FillOrder", - 0x010D : "DocumentName", - 0x010E : "ImageDescription", - 0x010F : "Make", - 0x0110 : "Model", - 0x0111 : "StripOffsets", - 0x0112 : "Orientation", - 0x0115 : "SamplesPerPixel", - 0x0116 : "RowsPerStrip", - 0x0117 : "StripByteCounts", - 0x0118 : "MinSampleValue", - 0x0119 : "MaxSampleValue", - 0x011A : "XResolution", - 0x011B : "YResolution", - 0x011C : "PlanarConfiguration", - 0x011D : "PageName", - 0x011E : "XPosition", - 0x011F : "YPosition", - 0x0120 : "FreeOffsets", - 0x0121 : "FreeByteCounts", - 0x0122 : "GrayResponseUnit", - 0x0123 : "GrayResponseCurve", - 0x0124 : "T4Options", - 0x0125 : "T6Options", - 0x0128 : "ResolutionUnit", - 0x0129 : "PageNumber", - 0x012C : "ColorResponseUnit", - 0x012D : "TransferFunction", - 0x0131 : "Software", - 0x0132 : "ModifyDate", - 0x013B : "Artist", - 0x013C : "HostComputer", - 0x013D : "Predictor", - 0x013E : "WhitePoint", - 0x013F : "PrimaryChromaticities", - 0x0140 : "ColorMap", - 0x0141 : "HalftoneHints", - 0x0142 : "TileWidth", - 0x0143 : "TileLength", - 0x0144 : "TileOffsets", - 0x0145 : "TileByteCounts", - 0x0146 : "BadFaxLines", - 0x0147 : "CleanFaxData", - 0x0148 : "ConsecutiveBadFaxLines", - 0x014A : "SubIFD", - 0x014C : "InkSet", - 0x014D : "InkNames", - 0x014E : "NumberofInks", - 0x0150 : "DotRange", - 0x0151 : "TargetPrinter", - 0x0152 : "ExtraSamples", - 0x0153 : "SampleFormat", - 0x0154 : "SMinSampleValue", - 0x0155 : "SMaxSampleValue", - 0x0156 : "TransferRange", - 0x0157 : "ClipPath", - 0x0158 : "XClipPathUnits", - 0x0159 : "YClipPathUnits", - 0x015A : "Indexed", - 0x015B : "JPEGTables", - 0x015F : "OPIProxy", - 0x0190 : "GlobalParametersIFD", - 0x0191 : "ProfileType", - 0x0192 : "FaxProfile", - 0x0193 : "CodingMethods", - 0x0194 : "VersionYear", - 0x0195 : "ModeNumber", - 0x01B1 : "Decode", - 0x01B2 : "DefaultImageColor", - 0x01B3 : "T82Options", - 0x01B5 : "JPEGTables", - 0x0200 : "JPEGProc", - 0x0201 : "ThumbnailOffset", - 0x0202 : "ThumbnailLength", - 0x0203 : "JPEGRestartInterval", - 0x0205 : "JPEGLosslessPredictors", - 0x0206 : "JPEGPointTransforms", - 0x0207 : "JPEGQTables", - 0x0208 : "JPEGDCTables", - 0x0209 : "JPEGACTables", - 0x0211 : "YCbCrCoefficients", - 0x0212 : "YCbCrSubSampling", - 0x0213 : "YCbCrPositioning", - 0x0214 : "ReferenceBlackWhite", - 0x022F : "StripRowCounts", - 0x02BC : "ApplicationNotes", - 0x03E7 : "USPTOMiscellaneous", - 0x1000 : "RelatedImageFileFormat", - 0x1001 : "RelatedImageWidth", - 0x1002 : "RelatedImageHeight", - 0x4746 : "Rating", - 0x4747 : "XP_DIP_XML", - 0x4748 : "StitchInfo", - 0x4749 : "RatingPercent", - 0x800D : "ImageID", - 0x80A3 : "WangTag1", - 0x80A4 : "WangAnnotation", - 0x80A5 : "WangTag3", - 0x80A6 : "WangTag4", - 0x80E3 : "Matteing", - 0x80E4 : "DataType", - 0x80E5 : "ImageDepth", - 0x80E6 : "TileDepth", - 0x827D : "Model2", - 0x828D : "CFARepeatPatternDim", - 0x828E : "CFAPattern2", - 0x828F : "BatteryLevel", - 0x8290 : "KodakIFD", - 0x8298 : "Copyright", - 0x829A : "ExposureTime", - 0x829D : "FNumber", - 0x82A5 : "MDFileTag", - 0x82A6 : "MDScalePixel", - 0x82A7 : "MDColorTable", - 0x82A8 : "MDLabName", - 0x82A9 : "MDSampleInfo", - 0x82AA : "MDPrepDate", - 0x82AB : "MDPrepTime", - 0x82AC : "MDFileUnits", - 0x830E : "PixelScale", - 0x8335 : "AdventScale", - 0x8336 : "AdventRevision", - 0x835C : "UIC1Tag", - 0x835D : "UIC2Tag", - 0x835E : "UIC3Tag", - 0x835F : "UIC4Tag", - 0x83BB : "IPTC-NAA", - 0x847E : "IntergraphPacketData", - 0x847F : "IntergraphFlagRegisters", - 0x8480 : "IntergraphMatrix", - 0x8481 : "INGRReserved", - 0x8482 : "ModelTiePoint", - 0x84E0 : "Site", - 0x84E1 : "ColorSequence", - 0x84E2 : "IT8Header", - 0x84E3 : "RasterPadding", - 0x84E4 : "BitsPerRunLength", - 0x84E5 : "BitsPerExtendedRunLength", - 0x84E6 : "ColorTable", - 0x84E7 : "ImageColorIndicator", - 0x84E8 : "BackgroundColorIndicator", - 0x84E9 : "ImageColorValue", - 0x84EA : "BackgroundColorValue", - 0x84EB : "PixelIntensityRange", - 0x84EC : "TransparencyIndicator", - 0x84ED : "ColorCharacterization", - 0x84EE : "HCUsage", - 0x84EF : "TrapIndicator", - 0x84F0 : "CMYKEquivalent", - 0x8546 : "SEMInfo", - 0x8568 : "AFCP_IPTC", - 0x85B8 : "PixelMagicJBIGOptions", - 0x85D8 : "ModelTransform", - 0x8602 : "WB_GRGBLevels", - 0x8606 : "LeafData", - 0x8649 : "PhotoshopSettings", - 0x8769 : "ExifOffset", - 0x8773 : "ICC_Profile", - 0x877F : "TIFF_FXExtensions", - 0x8780 : "MultiProfiles", - 0x8781 : "SharedData", - 0x8782 : "T88Options", - 0x87AC : "ImageLayer", - 0x87AF : "GeoTiffDirectory", - 0x87B0 : "GeoTiffDoubleParams", - 0x87B1 : "GeoTiffAsciiParams", - 0x8822 : "ExposureProgram", - 0x8824 : "SpectralSensitivity", - 0x8825 : "GPSInfo", - 0x8827 : "ISO", - 0x8828 : "Opto-ElectricConvFactor", - 0x8829 : "Interlace", - 0x882A : "TimeZoneOffset", - 0x882B : "SelfTimerMode", - 0x8830 : "SensitivityType", - 0x8831 : "StandardOutputSensitivity", - 0x8832 : "RecommendedExposureIndex", - 0x8833 : "ISOSpeed", - 0x8834 : "ISOSpeedLatitudeyyy", - 0x8835 : "ISOSpeedLatitudezzz", - 0x885C : "FaxRecvParams", - 0x885D : "FaxSubAddress", - 0x885E : "FaxRecvTime", - 0x888A : "LeafSubIFD", - 0x9000 : "ExifVersion", - 0x9003 : "DateTimeOriginal", - 0x9004 : "CreateDate", - 0x9101 : "ComponentsConfiguration", - 0x9102 : "CompressedBitsPerPixel", - 0x9201 : "ShutterSpeedValue", - 0x9202 : "ApertureValue", - 0x9203 : "BrightnessValue", - 0x9204 : "ExposureCompensation", - 0x9205 : "MaxApertureValue", - 0x9206 : "SubjectDistance", - 0x9207 : "MeteringMode", - 0x9208 : "LightSource", - 0x9209 : "Flash", - 0x920A : "FocalLength", - 0x920B : "FlashEnergy", - 0x920C : "SpatialFrequencyResponse", - 0x920D : "Noise", - 0x920E : "FocalPlaneXResolution", - 0x920F : "FocalPlaneYResolution", - 0x9210 : "FocalPlaneResolutionUnit", - 0x9211 : "ImageNumber", - 0x9212 : "SecurityClassification", - 0x9213 : "ImageHistory", - 0x9214 : "SubjectArea", - 0x9215 : "ExposureIndex", - 0x9216 : "TIFF-EPStandardID", - 0x9217 : "SensingMethod", - 0x923A : "CIP3DataFile", - 0x923B : "CIP3Sheet", - 0x923C : "CIP3Side", - 0x923F : "StoNits", - 0x927C : "MakerNote", - 0x9286 : "UserComment", - 0x9290 : "SubSecTime", - 0x9291 : "SubSecTimeOriginal", - 0x9292 : "SubSecTimeDigitized", - 0x932F : "MSDocumentText", - 0x9330 : "MSPropertySetStorage", - 0x9331 : "MSDocumentTextPosition", - 0x935C : "ImageSourceData", - 0x9C9B : "XPTitle", - 0x9C9C : "XPComment", - 0x9C9D : "XPAuthor", - 0x9C9E : "XPKeywords", - 0x9C9F : "XPSubject", - 0xA000 : "FlashpixVersion", - 0xA001 : "ColorSpace", - 0xA002 : "ExifImageWidth", - 0xA003 : "ExifImageHeight", - 0xA004 : "RelatedSoundFile", - 0xA005 : "InteropOffset", - 0xA20B : "FlashEnergy", - 0xA20C : "SpatialFrequencyResponse", - 0xA20D : "Noise", - 0xA20E : "FocalPlaneXResolution", - 0xA20F : "FocalPlaneYResolution", - 0xA210 : "FocalPlaneResolutionUnit", - 0xA211 : "ImageNumber", - 0xA212 : "SecurityClassification", - 0xA213 : "ImageHistory", - 0xA214 : "SubjectLocation", - 0xA215 : "ExposureIndex", - 0xA216 : "TIFF-EPStandardID", - 0xA217 : "SensingMethod", - 0xA300 : "FileSource", - 0xA301 : "SceneType", - 0xA302 : "CFAPattern", - 0xA401 : "CustomRendered", - 0xA402 : "ExposureMode", - 0xA403 : "WhiteBalance", - 0xA404 : "DigitalZoomRatio", - 0xA405 : "FocalLengthIn35mmFormat", - 0xA406 : "SceneCaptureType", - 0xA407 : "GainControl", - 0xA408 : "Contrast", - 0xA409 : "Saturation", - 0xA40A : "Sharpness", - 0xA40B : "DeviceSettingDescription", - 0xA40C : "SubjectDistanceRange", - 0xA420 : "ImageUniqueID", - 0xA430 : "OwnerName", - 0xA431 : "SerialNumber", - 0xA432 : "LensInfo", - 0xA433 : "LensMake", - 0xA434 : "LensModel", - 0xA435 : "LensSerialNumber", - 0xA480 : "GDALMetadata", - 0xA481 : "GDALNoData", - 0xA500 : "Gamma", - 0xAFC0 : "ExpandSoftware", - 0xAFC1 : "ExpandLens", - 0xAFC2 : "ExpandFilm", - 0xAFC3 : "ExpandFilterLens", - 0xAFC4 : "ExpandScanner", - 0xAFC5 : "ExpandFlashLamp", - 0xBC01 : "PixelFormat", - 0xBC02 : "Transformation", - 0xBC03 : "Uncompressed", - 0xBC04 : "ImageType", - 0xBC80 : "ImageWidth", - 0xBC81 : "ImageHeight", - 0xBC82 : "WidthResolution", - 0xBC83 : "HeightResolution", - 0xBCC0 : "ImageOffset", - 0xBCC1 : "ImageByteCount", - 0xBCC2 : "AlphaOffset", - 0xBCC3 : "AlphaByteCount", - 0xBCC4 : "ImageDataDiscard", - 0xBCC5 : "AlphaDataDiscard", - 0xC427 : "OceScanjobDesc", - 0xC428 : "OceApplicationSelector", - 0xC429 : "OceIDNumber", - 0xC42A : "OceImageLogic", - 0xC44F : "Annotations", - 0xC4A5 : "PrintIM", - 0xC580 : "USPTOOriginalContentType", - 0xC612 : "DNGVersion", - 0xC613 : "DNGBackwardVersion", - 0xC614 : "UniqueCameraModel", - 0xC615 : "LocalizedCameraModel", - 0xC616 : "CFAPlaneColor", - 0xC617 : "CFALayout", - 0xC618 : "LinearizationTable", - 0xC619 : "BlackLevelRepeatDim", - 0xC61A : "BlackLevel", - 0xC61B : "BlackLevelDeltaH", - 0xC61C : "BlackLevelDeltaV", - 0xC61D : "WhiteLevel", - 0xC61E : "DefaultScale", - 0xC61F : "DefaultCropOrigin", - 0xC620 : "DefaultCropSize", - 0xC621 : "ColorMatrix1", - 0xC622 : "ColorMatrix2", - 0xC623 : "CameraCalibration1", - 0xC624 : "CameraCalibration2", - 0xC625 : "ReductionMatrix1", - 0xC626 : "ReductionMatrix2", - 0xC627 : "AnalogBalance", - 0xC628 : "AsShotNeutral", - 0xC629 : "AsShotWhiteXY", - 0xC62A : "BaselineExposure", - 0xC62B : "BaselineNoise", - 0xC62C : "BaselineSharpness", - 0xC62D : "BayerGreenSplit", - 0xC62E : "LinearResponseLimit", - 0xC62F : "CameraSerialNumber", - 0xC630 : "DNGLensInfo", - 0xC631 : "ChromaBlurRadius", - 0xC632 : "AntiAliasStrength", - 0xC633 : "ShadowScale", - 0xC634 : "DNGPrivateData", - 0xC635 : "MakerNoteSafety", - 0xC640 : "RawImageSegmentation", - 0xC65A : "CalibrationIlluminant1", - 0xC65B : "CalibrationIlluminant2", - 0xC65C : "BestQualityScale", - 0xC65D : "RawDataUniqueID", - 0xC660 : "AliasLayerMetadata", - 0xC68B : "OriginalRawFileName", - 0xC68C : "OriginalRawFileData", - 0xC68D : "ActiveArea", - 0xC68E : "MaskedAreas", - 0xC68F : "AsShotICCProfile", - 0xC690 : "AsShotPreProfileMatrix", - 0xC691 : "CurrentICCProfile", - 0xC692 : "CurrentPreProfileMatrix", - 0xC6BF : "ColorimetricReference", - 0xC6D2 : "PanasonicTitle", - 0xC6D3 : "PanasonicTitle2", - 0xC6F3 : "CameraCalibrationSig", - 0xC6F4 : "ProfileCalibrationSig", - 0xC6F5 : "ProfileIFD", - 0xC6F6 : "AsShotProfileName", - 0xC6F7 : "NoiseReductionApplied", - 0xC6F8 : "ProfileName", - 0xC6F9 : "ProfileHueSatMapDims", - 0xC6FA : "ProfileHueSatMapData1", - 0xC6FB : "ProfileHueSatMapData2", - 0xC6FC : "ProfileToneCurve", - 0xC6FD : "ProfileEmbedPolicy", - 0xC6FE : "ProfileCopyright", - 0xC714 : "ForwardMatrix1", - 0xC715 : "ForwardMatrix2", - 0xC716 : "PreviewApplicationName", - 0xC717 : "PreviewApplicationVersion", - 0xC718 : "PreviewSettingsName", - 0xC719 : "PreviewSettingsDigest", - 0xC71A : "PreviewColorSpace", - 0xC71B : "PreviewDateTime", - 0xC71C : "RawImageDigest", - 0xC71D : "OriginalRawFileDigest", - 0xC71E : "SubTileBlockSize", - 0xC71F : "RowInterleaveFactor", - 0xC725 : "ProfileLookTableDims", - 0xC726 : "ProfileLookTableData", - 0xC740 : "OpcodeList1", - 0xC741 : "OpcodeList2", - 0xC74E : "OpcodeList3", - 0xC761 : "NoiseProfile", - 0xC763 : "TimeCodes", - 0xC764 : "FrameRate", - 0xC772 : "TStop", - 0xC789 : "ReelName", - 0xC791 : "OriginalDefaultFinalSize", - 0xC792 : "OriginalBestQualitySize", - 0xC793 : "OriginalDefaultCropSize", - 0xC7A1 : "CameraLabel", - 0xC7A3 : "ProfileHueSatMapEncoding", - 0xC7A4 : "ProfileLookTableEncoding", - 0xC7A5 : "BaselineExposureOffset", - 0xC7A6 : "DefaultBlackRender", - 0xC7A7 : "NewRawImageDigest", - 0xC7A8 : "RawToPreviewGain", - 0xC7B5 : "DefaultUserCrop", - 0xEA1C : "Padding", - 0xEA1D : "OffsetSchema", - 0xFDE8 : "OwnerName", - 0xFDE9 : "SerialNumber", - 0xFDEA : "Lens", - 0xFE00 : "KDC_IFD", - 0xFE4C : "RawFile", - 0xFE4D : "Converter", - 0xFE4E : "WhiteBalance", - 0xFE51 : "Exposure", - 0xFE52 : "Shadows", - 0xFE53 : "Brightness", - 0xFE54 : "Contrast", - 0xFE55 : "Saturation", - 0xFE56 : "Sharpness", - 0xFE57 : "Smoothness", - 0xFE58 : "MoireFilter" - - }, - gps : { - 0x0000 : 'GPSVersionID', - 0x0001 : 'GPSLatitudeRef', - 0x0002 : 'GPSLatitude', - 0x0003 : 'GPSLongitudeRef', - 0x0004 : 'GPSLongitude', - 0x0005 : 'GPSAltitudeRef', - 0x0006 : 'GPSAltitude', - 0x0007 : 'GPSTimeStamp', - 0x0008 : 'GPSSatellites', - 0x0009 : 'GPSStatus', - 0x000A : 'GPSMeasureMode', - 0x000B : 'GPSDOP', - 0x000C : 'GPSSpeedRef', - 0x000D : 'GPSSpeed', - 0x000E : 'GPSTrackRef', - 0x000F : 'GPSTrack', - 0x0010 : 'GPSImgDirectionRef', - 0x0011 : 'GPSImgDirection', - 0x0012 : 'GPSMapDatum', - 0x0013 : 'GPSDestLatitudeRef', - 0x0014 : 'GPSDestLatitude', - 0x0015 : 'GPSDestLongitudeRef', - 0x0016 : 'GPSDestLongitude', - 0x0017 : 'GPSDestBearingRef', - 0x0018 : 'GPSDestBearing', - 0x0019 : 'GPSDestDistanceRef', - 0x001A : 'GPSDestDistance', - 0x001B : 'GPSProcessingMethod', - 0x001C : 'GPSAreaInformation', - 0x001D : 'GPSDateStamp', - 0x001E : 'GPSDifferential', - 0x001F : 'GPSHPositioningError' - } -}; -},{}],58:[function(require,module,exports){ -/*jslint browser: true, devel: true, bitwise: false, debug: true, eqeq: false, es5: true, evil: false, forin: false, newcap: false, nomen: true, plusplus: true, regexp: false, unparam: false, sloppy: true, stupid: false, sub: false, todo: true, vars: true, white: true */ - -function readExifValue(format, stream) { - switch(format) { - case 1: return stream.nextUInt8(); - case 3: return stream.nextUInt16(); - case 4: return stream.nextUInt32(); - case 5: return [stream.nextUInt32(), stream.nextUInt32()]; - case 6: return stream.nextInt8(); - case 8: return stream.nextUInt16(); - case 9: return stream.nextUInt32(); - case 10: return [stream.nextInt32(), stream.nextInt32()]; - case 11: return stream.nextFloat(); - case 12: return stream.nextDouble(); - default: throw new Error('Invalid format while decoding: ' + format); - } -} - -function getBytesPerComponent(format) { - switch(format) { - case 1: - case 2: - case 6: - case 7: - return 1; - case 3: - case 8: - return 2; - case 4: - case 9: - case 11: - return 4; - case 5: - case 10: - case 12: - return 8; - default: - return 0; - } -} - -function readExifTag(tiffMarker, stream) { - var tagType = stream.nextUInt16(), - format = stream.nextUInt16(), - bytesPerComponent = getBytesPerComponent(format), - components = stream.nextUInt32(), - valueBytes = bytesPerComponent * components, - values, - value, - c; - - /* if the value is bigger then 4 bytes, the value is in the data section of the IFD - and the value present in the tag is the offset starting from the tiff header. So we replace the stream - with a stream that is located at the given offset in the data section. s*/ - if(valueBytes > 4) { - stream = tiffMarker.openWithOffset(stream.nextUInt32()); - } - //we don't want to read strings as arrays - if(format === 2) { - values = stream.nextString(components); - //cut off \0 characters - var lastNull = values.indexOf('\0'); - if(lastNull !== -1) { - values = values.substr(0, lastNull); - } - } - else if(format === 7) { - values = stream.nextBuffer(components); - } - else if(format !== 0) { - values = []; - for(c = 0; c < components; ++c) { - values.push(readExifValue(format, stream)); - } - } - //since our stream is a stateful object, we need to skip remaining bytes - //so our offset stays correct - if(valueBytes < 4) { - stream.skip(4 - valueBytes); - } - - return [tagType, values, format]; -} - -function readIFDSection(tiffMarker, stream, iterator) { - var numberOfEntries = stream.nextUInt16(), tag, i; - for(i = 0; i < numberOfEntries; ++i) { - tag = readExifTag(tiffMarker, stream); - iterator(tag[0], tag[1], tag[2]); - } -} - -function readHeader(stream) { - var exifHeader = stream.nextString(6); - if(exifHeader !== 'Exif\0\0') { - throw new Error('Invalid EXIF header'); - } - - var tiffMarker = stream.mark(); - var tiffHeader = stream.nextUInt16(); - if(tiffHeader === 0x4949) { - stream.setBigEndian(false); - } else if(tiffHeader === 0x4D4D) { - stream.setBigEndian(true); - } else { - throw new Error('Invalid TIFF header'); - } - if(stream.nextUInt16() !== 0x002A) { - throw new Error('Invalid TIFF data'); - } - return tiffMarker; -} - -module.exports = { - IFD0: 1, - IFD1: 2, - GPSIFD: 3, - SubIFD: 4, - InteropIFD: 5, - parseTags: function(stream, iterator) { - var tiffMarker; - try { - tiffMarker = readHeader(stream); - } catch(e) { - return false; //ignore APP1 sections with invalid headers - } - var subIfdOffset, gpsOffset, interopOffset; - var ifd0Stream = tiffMarker.openWithOffset(stream.nextUInt32()), - IFD0 = this.IFD0; - readIFDSection(tiffMarker, ifd0Stream, function(tagType, value, format) { - switch(tagType) { - case 0x8825: gpsOffset = value[0]; break; - case 0x8769: subIfdOffset = value[0]; break; - default: iterator(IFD0, tagType, value, format); break; - } - }); - var ifd1Offset = ifd0Stream.nextUInt32(); - if(ifd1Offset !== 0) { - var ifd1Stream = tiffMarker.openWithOffset(ifd1Offset); - readIFDSection(tiffMarker, ifd1Stream, iterator.bind(null, this.IFD1)); - } - - if(gpsOffset) { - var gpsStream = tiffMarker.openWithOffset(gpsOffset); - readIFDSection(tiffMarker, gpsStream, iterator.bind(null, this.GPSIFD)); - } - - if(subIfdOffset) { - var subIfdStream = tiffMarker.openWithOffset(subIfdOffset), InteropIFD = this.InteropIFD; - readIFDSection(tiffMarker, subIfdStream, function(tagType, value, format) { - if(tagType === 0xA005) { - interopOffset = value[0]; - } else { - iterator(InteropIFD, tagType, value, format); - } - }); - } - - if(interopOffset) { - var interopStream = tiffMarker.openWithOffset(interopOffset); - readIFDSection(tiffMarker, interopStream, iterator.bind(null, this.InteropIFD)); - } - return true; - } -}; -},{}],59:[function(require,module,exports){ -/*jslint browser: true, devel: true, bitwise: false, debug: true, eqeq: false, es5: true, evil: false, forin: false, newcap: false, nomen: true, plusplus: true, regexp: false, unparam: false, sloppy: true, stupid: false, sub: false, todo: true, vars: true, white: true */ - -module.exports = { - parseSections: function(stream, iterator) { - var len, markerType; - stream.setBigEndian(true); - //stop reading the stream at the SOS (Start of Stream) marker, - //because its length is not stored in the header so we can't - //know where to jump to. The only marker after that is just EOI (End Of Image) anyway - while(stream.remainingLength() > 0 && markerType !== 0xDA) { - if(stream.nextUInt8() !== 0xFF) { - throw new Error('Invalid JPEG section offset'); - } - markerType = stream.nextUInt8(); - //don't read size from markers that have no datas - if((markerType >= 0xD0 && markerType <= 0xD9) || markerType === 0xDA) { - len = 0; - } else { - len = stream.nextUInt16() - 2; - } - iterator(markerType, stream.branch(0, len)); - stream.skip(len); - } - }, - //stream should be located after SOF section size and in big endian mode, like passed to parseSections iterator - getSizeFromSOFSection: function(stream) { - stream.skip(1); - return { - height: stream.nextUInt16(), - width: stream.nextUInt16() - }; - }, - getSectionName: function(markerType) { - var name, index; - switch(markerType) { - case 0xD8: name = 'SOI'; break; - case 0xC4: name = 'DHT'; break; - case 0xDB: name = 'DQT'; break; - case 0xDD: name = 'DRI'; break; - case 0xDA: name = 'SOS'; break; - case 0xFE: name = 'COM'; break; - case 0xD9: name = 'EOI'; break; - default: - if(markerType >= 0xE0 && markerType <= 0xEF) { - name = 'APP'; - index = markerType - 0xE0; - } - else if(markerType >= 0xC0 && markerType <= 0xCF && markerType !== 0xC4 && markerType !== 0xC8 && markerType !== 0xCC) { - name = 'SOF'; - index = markerType - 0xC0; - } - else if(markerType >= 0xD0 && markerType <= 0xD7) { - name = 'RST'; - index = markerType - 0xD0; - } - break; - } - var nameStruct = { - name: name - }; - if(typeof index === 'number') { - nameStruct.index = index; - } - return nameStruct; - } -}; -},{}],60:[function(require,module,exports){ -/*jslint browser: true, devel: true, bitwise: false, debug: true, eqeq: false, es5: true, evil: false, forin: false, newcap: false, nomen: true, plusplus: true, regexp: false, unparam: false, sloppy: true, stupid: false, sub: false, todo: true, vars: true, white: true */ - -var jpeg = require('./jpeg'), - exif = require('./exif'), - simplify = require('./simplify'); - -function ExifResult(startMarker, tags, imageSize, thumbnailOffset, thumbnailLength, thumbnailType, app1Offset) { - this.startMarker = startMarker; - this.tags = tags; - this.imageSize = imageSize; - this.thumbnailOffset = thumbnailOffset; - this.thumbnailLength = thumbnailLength; - this.thumbnailType = thumbnailType; - this.app1Offset = app1Offset; -} - -ExifResult.prototype = { - hasThumbnail: function(mime) { - if(!this.thumbnailOffset || !this.thumbnailLength) { - return false; - } - if(typeof mime !== 'string') { - return true; - } - if(mime.toLowerCase().trim() === 'image/jpeg') { - return this.thumbnailType === 6; - } - if(mime.toLowerCase().trim() === 'image/tiff') { - return this.thumbnailType === 1; - } - return false; - }, - getThumbnailOffset: function() { - return this.app1Offset + 6 + this.thumbnailOffset; - }, - getThumbnailLength: function() { - return this.thumbnailLength; - }, - getThumbnailBuffer: function() { - return this._getThumbnailStream().nextBuffer(this.thumbnailLength); - }, - _getThumbnailStream: function() { - return this.startMarker.openWithOffset(this.getThumbnailOffset()); - }, - getImageSize: function() { - return this.imageSize; - }, - getThumbnailSize: function() { - var stream = this._getThumbnailStream(), size; - jpeg.parseSections(stream, function(sectionType, sectionStream) { - if(jpeg.getSectionName(sectionType).name === 'SOF') { - size = jpeg.getSizeFromSOFSection(sectionStream); - } - }); - return size; - } -}; - -function Parser(stream) { - this.stream = stream; - this.flags = { - readBinaryTags: false, - resolveTagNames: true, - simplifyValues: true, - imageSize: true, - hidePointers: true, - returnTags: true - }; -} - -Parser.prototype = { - enableBinaryFields: function(enable) { - this.flags.readBinaryTags = !!enable; - return this; - }, - enablePointers: function(enable) { - this.flags.hidePointers = !enable; - return this; - }, - enableTagNames: function(enable) { - this.flags.resolveTagNames = !!enable; - return this; - }, - enableImageSize: function(enable) { - this.flags.imageSize = !!enable; - return this; - }, - enableReturnTags: function(enable) { - this.flags.returnTags = !!enable; - return this; - }, - enableSimpleValues: function(enable) { - this.flags.simplifyValues = !!enable; - return this; - }, - parse: function() { - var start = this.stream.mark(), - stream = start.openWithOffset(0), - flags = this.flags, - tags, - imageSize, - thumbnailOffset, - thumbnailLength, - thumbnailType, - app1Offset, - tagNames, - getTagValue, setTagValue; - if(flags.resolveTagNames) { - tagNames = require('./exif-tags'); - } - if(flags.resolveTagNames) { - tags = {}; - getTagValue = function(t) { - return tags[t.name]; - }; - setTagValue = function(t, value) { - tags[t.name] = value; - }; - } else { - tags = []; - getTagValue = function(t) { - var i; - for(i = 0; i < tags.length; ++i) { - if(tags[i].type === t.type && tags[i].section === t.section) { - return tags.value; - } - } - }; - setTagValue = function(t, value) { - var i; - for(i = 0; i < tags.length; ++i) { - if(tags[i].type === t.type && tags[i].section === t.section) { - tags.value = value; - return; - } - } - }; - } - - jpeg.parseSections(stream, function(sectionType, sectionStream) { - var validExifHeaders, sectionOffset = sectionStream.offsetFrom(start); - if(sectionType === 0xE1) { - validExifHeaders = exif.parseTags(sectionStream, function(ifdSection, tagType, value, format) { - //ignore binary fields if disabled - if(!flags.readBinaryTags && format === 7) { - return; - } - - if(tagType === 0x0201) { - thumbnailOffset = value[0]; - if(flags.hidePointers) {return;} - } else if(tagType === 0x0202) { - thumbnailLength = value[0]; - if(flags.hidePointers) {return;} - } else if(tagType === 0x0103) { - thumbnailType = value[0]; - if(flags.hidePointers) {return;} - } - //if flag is set to not store tags, return here after storing pointers - if(!flags.returnTags) { - return; - } - - if(flags.simplifyValues) { - value = simplify.simplifyValue(value, format); - } - if(flags.resolveTagNames) { - var sectionTagNames = ifdSection === exif.GPSIFD ? tagNames.gps : tagNames.exif; - var name = sectionTagNames[tagType]; - if(!name) { - name = tagNames.exif[tagType]; - } - if (!tags.hasOwnProperty(name)) { - tags[name] = value; - } - } else { - tags.push({ - section: ifdSection, - type: tagType, - value: value - }); - } - }); - if(validExifHeaders) { - app1Offset = sectionOffset; - } - } - else if(flags.imageSize && jpeg.getSectionName(sectionType).name === 'SOF') { - imageSize = jpeg.getSizeFromSOFSection(sectionStream); - } - }); - - if(flags.simplifyValues) { - simplify.castDegreeValues(getTagValue, setTagValue); - simplify.castDateValues(getTagValue, setTagValue); - } - - return new ExifResult(start, tags, imageSize, thumbnailOffset, thumbnailLength, thumbnailType, app1Offset); - } -}; - - - -module.exports = Parser; - -},{"./exif":58,"./exif-tags":57,"./jpeg":59,"./simplify":61}],61:[function(require,module,exports){ -var exif = require('./exif'); -var date = require('./date'); - -var degreeTags = [{ - section: exif.GPSIFD, - type: 0x0002, - name: 'GPSLatitude', - refType: 0x0001, - refName: 'GPSLatitudeRef', - posVal: 'N' -}, -{ - section: exif.GPSIFD, - type: 0x0004, - name: 'GPSLongitude', - refType: 0x0003, - refName: 'GPSLongitudeRef', - posVal: 'E' -}]; -var dateTags = [{ - section: exif.SubIFD, - type: 0x0132, - name: 'ModifyDate' -}, -{ - section: exif.SubIFD, - type: 0x9003, - name: 'DateTimeOriginal' -}, -{ - section: exif.SubIFD, - type: 0x9004, - name: 'CreateDate' -}, -{ - section: exif.SubIFD, - type: 0x0132, - name : 'ModifyDate', -}]; - -module.exports = { - castDegreeValues: function(getTagValue, setTagValue) { - degreeTags.forEach(function(t) { - var degreeVal = getTagValue(t); - if(degreeVal) { - var degreeRef = getTagValue({section: t.section, type: t.refType, name: t.refName}); - var degreeNumRef = degreeRef === t.posVal ? 1 : -1; - var degree = (degreeVal[0] + (degreeVal[1] / 60) + (degreeVal[2] / 3600)) * degreeNumRef; - setTagValue(t, degree); - } - }); - }, - castDateValues: function(getTagValue, setTagValue) { - dateTags.forEach(function(t) { - var dateStrVal = getTagValue(t); - if(dateStrVal) { - //some easy checks to determine two common date formats - var timestamp = date.parseExifDate(dateStrVal); - if(typeof timestamp !== 'undefined') { - setTagValue(t, timestamp); - } - } - }); - }, - simplifyValue: function(values, format) { - if(Array.isArray(values)) { - values = values.map(function(value) { - if(format === 10 || format === 5) { - return value[0] / value[1]; - } - return value; - }); - if(values.length === 1) { - values = values[0]; - } - } - return values; - } -}; - -},{"./date":55,"./exif":58}],62:[function(require,module,exports){ -'use strict'; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - -var toBytes = function toBytes(s) { - return (0, _toConsumableArray2["default"])(s).map(function (c) { - return c.charCodeAt(0); - }); -}; - -var xpiZipFilename = toBytes('META-INF/mozilla.rsa'); -var oxmlContentTypes = toBytes('[Content_Types].xml'); -var oxmlRels = toBytes('_rels/.rels'); - -module.exports = function (input) { - var buf = input instanceof Uint8Array ? input : new Uint8Array(input); - - if (!(buf && buf.length > 1)) { - return null; - } - - var check = function check(header, options) { - options = Object.assign({ - offset: 0 - }, options); - - for (var i = 0; i < header.length; i++) { - // If a bitmask is set - if (options.mask) { - // If header doesn't equal `buf` with bits masked off - if (header[i] !== (options.mask[i] & buf[i + options.offset])) { - return false; - } - } else if (header[i] !== buf[i + options.offset]) { - return false; - } - } - - return true; - }; - - var checkString = function checkString(header, options) { - return check(toBytes(header), options); - }; - - if (check([0xFF, 0xD8, 0xFF])) { - return { - ext: 'jpg', - mime: 'image/jpeg' - }; - } - - if (check([0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A])) { - return { - ext: 'png', - mime: 'image/png' - }; - } - - if (check([0x47, 0x49, 0x46])) { - return { - ext: 'gif', - mime: 'image/gif' - }; - } - - if (check([0x57, 0x45, 0x42, 0x50], { - offset: 8 - })) { - return { - ext: 'webp', - mime: 'image/webp' - }; - } - - if (check([0x46, 0x4C, 0x49, 0x46])) { - return { - ext: 'flif', - mime: 'image/flif' - }; - } // Needs to be before `tif` check - - - if ((check([0x49, 0x49, 0x2A, 0x0]) || check([0x4D, 0x4D, 0x0, 0x2A])) && check([0x43, 0x52], { - offset: 8 - })) { - return { - ext: 'cr2', - mime: 'image/x-canon-cr2' - }; - } - - if (check([0x49, 0x49, 0x2A, 0x0]) || check([0x4D, 0x4D, 0x0, 0x2A])) { - return { - ext: 'tif', - mime: 'image/tiff' - }; - } - - if (check([0x42, 0x4D])) { - return { - ext: 'bmp', - mime: 'image/bmp' - }; - } - - if (check([0x49, 0x49, 0xBC])) { - return { - ext: 'jxr', - mime: 'image/vnd.ms-photo' - }; - } - - if (check([0x38, 0x42, 0x50, 0x53])) { - return { - ext: 'psd', - mime: 'image/vnd.adobe.photoshop' - }; - } // Zip-based file formats - // Need to be before the `zip` check - - - if (check([0x50, 0x4B, 0x3, 0x4])) { - if (check([0x6D, 0x69, 0x6D, 0x65, 0x74, 0x79, 0x70, 0x65, 0x61, 0x70, 0x70, 0x6C, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x2F, 0x65, 0x70, 0x75, 0x62, 0x2B, 0x7A, 0x69, 0x70], { - offset: 30 - })) { - return { - ext: 'epub', - mime: 'application/epub+zip' - }; - } // Assumes signed `.xpi` from addons.mozilla.org - - - if (check(xpiZipFilename, { - offset: 30 - })) { - return { - ext: 'xpi', - mime: 'application/x-xpinstall' - }; - } - - if (checkString('mimetypeapplication/vnd.oasis.opendocument.text', { - offset: 30 - })) { - return { - ext: 'odt', - mime: 'application/vnd.oasis.opendocument.text' - }; - } - - if (checkString('mimetypeapplication/vnd.oasis.opendocument.spreadsheet', { - offset: 30 - })) { - return { - ext: 'ods', - mime: 'application/vnd.oasis.opendocument.spreadsheet' - }; - } - - if (checkString('mimetypeapplication/vnd.oasis.opendocument.presentation', { - offset: 30 - })) { - return { - ext: 'odp', - mime: 'application/vnd.oasis.opendocument.presentation' - }; - } // The docx, xlsx and pptx file types extend the Office Open XML file format: - // https://en.wikipedia.org/wiki/Office_Open_XML_file_formats - // We look for: - // - one entry named '[Content_Types].xml' or '_rels/.rels', - // - one entry indicating specific type of file. - // MS Office, OpenOffice and LibreOffice may put the parts in different order, so the check should not rely on it. - - - var findNextZipHeaderIndex = function findNextZipHeaderIndex(arr) { - var startAt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; - return arr.findIndex(function (el, i, arr) { - return i >= startAt && arr[i] === 0x50 && arr[i + 1] === 0x4B && arr[i + 2] === 0x3 && arr[i + 3] === 0x4; - }); - }; - - var zipHeaderIndex = 0; // The first zip header was already found at index 0 - - var oxmlFound = false; - var type = null; - - do { - var offset = zipHeaderIndex + 30; - - if (!oxmlFound) { - oxmlFound = check(oxmlContentTypes, { - offset: offset - }) || check(oxmlRels, { - offset: offset - }); - } - - if (!type) { - if (checkString('word/', { - offset: offset - })) { - type = { - ext: 'docx', - mime: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' - }; - } else if (checkString('ppt/', { - offset: offset - })) { - type = { - ext: 'pptx', - mime: 'application/vnd.openxmlformats-officedocument.presentationml.presentation' - }; - } else if (checkString('xl/', { - offset: offset - })) { - type = { - ext: 'xlsx', - mime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' - }; - } - } - - if (oxmlFound && type) { - return type; - } - - zipHeaderIndex = findNextZipHeaderIndex(buf, offset); - } while (zipHeaderIndex >= 0); // No more zip parts available in the buffer, but maybe we are almost certain about the type? - - - if (type) { - return type; - } - } - - if (check([0x50, 0x4B]) && (buf[2] === 0x3 || buf[2] === 0x5 || buf[2] === 0x7) && (buf[3] === 0x4 || buf[3] === 0x6 || buf[3] === 0x8)) { - return { - ext: 'zip', - mime: 'application/zip' - }; - } - - if (check([0x75, 0x73, 0x74, 0x61, 0x72], { - offset: 257 - })) { - return { - ext: 'tar', - mime: 'application/x-tar' - }; - } - - if (check([0x52, 0x61, 0x72, 0x21, 0x1A, 0x7]) && (buf[6] === 0x0 || buf[6] === 0x1)) { - return { - ext: 'rar', - mime: 'application/x-rar-compressed' - }; - } - - if (check([0x1F, 0x8B, 0x8])) { - return { - ext: 'gz', - mime: 'application/gzip' - }; - } - - if (check([0x42, 0x5A, 0x68])) { - return { - ext: 'bz2', - mime: 'application/x-bzip2' - }; - } - - if (check([0x37, 0x7A, 0xBC, 0xAF, 0x27, 0x1C])) { - return { - ext: '7z', - mime: 'application/x-7z-compressed' - }; - } - - if (check([0x78, 0x01])) { - return { - ext: 'dmg', - mime: 'application/x-apple-diskimage' - }; - } - - if (check([0x33, 0x67, 0x70, 0x35]) || // 3gp5 - check([0x0, 0x0, 0x0]) && check([0x66, 0x74, 0x79, 0x70], { - offset: 4 - }) && (check([0x6D, 0x70, 0x34, 0x31], { - offset: 8 - }) || // MP41 - check([0x6D, 0x70, 0x34, 0x32], { - offset: 8 - }) || // MP42 - check([0x69, 0x73, 0x6F, 0x6D], { - offset: 8 - }) || // ISOM - check([0x69, 0x73, 0x6F, 0x32], { - offset: 8 - }) || // ISO2 - check([0x6D, 0x6D, 0x70, 0x34], { - offset: 8 - }) || // MMP4 - check([0x4D, 0x34, 0x56], { - offset: 8 - }) || // M4V - check([0x64, 0x61, 0x73, 0x68], { - offset: 8 - }) // DASH - )) { - return { - ext: 'mp4', - mime: 'video/mp4' - }; - } - - if (check([0x4D, 0x54, 0x68, 0x64])) { - return { - ext: 'mid', - mime: 'audio/midi' - }; - } // https://github.com/threatstack/libmagic/blob/master/magic/Magdir/matroska - - - if (check([0x1A, 0x45, 0xDF, 0xA3])) { - var sliced = buf.subarray(4, 4 + 4096); - var idPos = sliced.findIndex(function (el, i, arr) { - return arr[i] === 0x42 && arr[i + 1] === 0x82; - }); - - if (idPos !== -1) { - var docTypePos = idPos + 3; - - var findDocType = function findDocType(type) { - return (0, _toConsumableArray2["default"])(type).every(function (c, i) { - return sliced[docTypePos + i] === c.charCodeAt(0); - }); - }; - - if (findDocType('matroska')) { - return { - ext: 'mkv', - mime: 'video/x-matroska' - }; - } - - if (findDocType('webm')) { - return { - ext: 'webm', - mime: 'video/webm' - }; - } - } - } - - if (check([0x0, 0x0, 0x0, 0x14, 0x66, 0x74, 0x79, 0x70, 0x71, 0x74, 0x20, 0x20]) || check([0x66, 0x72, 0x65, 0x65], { - offset: 4 - }) || check([0x66, 0x74, 0x79, 0x70, 0x71, 0x74, 0x20, 0x20], { - offset: 4 - }) || check([0x6D, 0x64, 0x61, 0x74], { - offset: 4 - }) || // MJPEG - check([0x77, 0x69, 0x64, 0x65], { - offset: 4 - })) { - return { - ext: 'mov', - mime: 'video/quicktime' - }; - } // RIFF file format which might be AVI, WAV, QCP, etc - - - if (check([0x52, 0x49, 0x46, 0x46])) { - if (check([0x41, 0x56, 0x49], { - offset: 8 - })) { - return { - ext: 'avi', - mime: 'video/vnd.avi' - }; - } - - if (check([0x57, 0x41, 0x56, 0x45], { - offset: 8 - })) { - return { - ext: 'wav', - mime: 'audio/vnd.wave' - }; - } // QLCM, QCP file - - - if (check([0x51, 0x4C, 0x43, 0x4D], { - offset: 8 - })) { - return { - ext: 'qcp', - mime: 'audio/qcelp' - }; - } - } - - if (check([0x30, 0x26, 0xB2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xA6, 0xD9])) { - return { - ext: 'wmv', - mime: 'video/x-ms-wmv' - }; - } - - if (check([0x0, 0x0, 0x1, 0xBA]) || check([0x0, 0x0, 0x1, 0xB3])) { - return { - ext: 'mpg', - mime: 'video/mpeg' - }; - } - - if (check([0x66, 0x74, 0x79, 0x70, 0x33, 0x67], { - offset: 4 - })) { - return { - ext: '3gp', - mime: 'video/3gpp' - }; - } // Check for MPEG header at different starting offsets - - - for (var start = 0; start < 2 && start < buf.length - 16; start++) { - if (check([0x49, 0x44, 0x33], { - offset: start - }) || // ID3 header - check([0xFF, 0xE2], { - offset: start, - mask: [0xFF, 0xE2] - }) // MPEG 1 or 2 Layer 3 header - ) { - return { - ext: 'mp3', - mime: 'audio/mpeg' - }; - } - - if (check([0xFF, 0xE4], { - offset: start, - mask: [0xFF, 0xE4] - }) // MPEG 1 or 2 Layer 2 header - ) { - return { - ext: 'mp2', - mime: 'audio/mpeg' - }; - } - - if (check([0xFF, 0xF8], { - offset: start, - mask: [0xFF, 0xFC] - }) // MPEG 2 layer 0 using ADTS - ) { - return { - ext: 'mp2', - mime: 'audio/mpeg' - }; - } - - if (check([0xFF, 0xF0], { - offset: start, - mask: [0xFF, 0xFC] - }) // MPEG 4 layer 0 using ADTS - ) { - return { - ext: 'mp4', - mime: 'audio/mpeg' - }; - } - } - - if (check([0x66, 0x74, 0x79, 0x70, 0x4D, 0x34, 0x41], { - offset: 4 - }) || check([0x4D, 0x34, 0x41, 0x20])) { - return { - // MPEG-4 layer 3 (audio) - ext: 'm4a', - mime: 'audio/mp4' // RFC 4337 - - }; - } // Needs to be before `ogg` check - - - if (check([0x4F, 0x70, 0x75, 0x73, 0x48, 0x65, 0x61, 0x64], { - offset: 28 - })) { - return { - ext: 'opus', - mime: 'audio/opus' - }; - } // If 'OggS' in first bytes, then OGG container - - - if (check([0x4F, 0x67, 0x67, 0x53])) { - // This is a OGG container - // If ' theora' in header. - if (check([0x80, 0x74, 0x68, 0x65, 0x6F, 0x72, 0x61], { - offset: 28 - })) { - return { - ext: 'ogv', - mime: 'video/ogg' - }; - } // If '\x01video' in header. - - - if (check([0x01, 0x76, 0x69, 0x64, 0x65, 0x6F, 0x00], { - offset: 28 - })) { - return { - ext: 'ogm', - mime: 'video/ogg' - }; - } // If ' FLAC' in header https://xiph.org/flac/faq.html - - - if (check([0x7F, 0x46, 0x4C, 0x41, 0x43], { - offset: 28 - })) { - return { - ext: 'oga', - mime: 'audio/ogg' - }; - } // 'Speex ' in header https://en.wikipedia.org/wiki/Speex - - - if (check([0x53, 0x70, 0x65, 0x65, 0x78, 0x20, 0x20], { - offset: 28 - })) { - return { - ext: 'spx', - mime: 'audio/ogg' - }; - } // If '\x01vorbis' in header - - - if (check([0x01, 0x76, 0x6F, 0x72, 0x62, 0x69, 0x73], { - offset: 28 - })) { - return { - ext: 'ogg', - mime: 'audio/ogg' - }; - } // Default OGG container https://www.iana.org/assignments/media-types/application/ogg - - - return { - ext: 'ogx', - mime: 'application/ogg' - }; - } - - if (check([0x66, 0x4C, 0x61, 0x43])) { - return { - ext: 'flac', - mime: 'audio/x-flac' - }; - } - - if (check([0x4D, 0x41, 0x43, 0x20])) { - // 'MAC ' - return { - ext: 'ape', - mime: 'audio/ape' - }; - } - - if (check([0x77, 0x76, 0x70, 0x6B])) { - // 'wvpk' - return { - ext: 'wv', - mime: 'audio/wavpack' - }; - } - - if (check([0x23, 0x21, 0x41, 0x4D, 0x52, 0x0A])) { - return { - ext: 'amr', - mime: 'audio/amr' - }; - } - - if (check([0x25, 0x50, 0x44, 0x46])) { - return { - ext: 'pdf', - mime: 'application/pdf' - }; - } - - if (check([0x4D, 0x5A])) { - return { - ext: 'exe', - mime: 'application/x-msdownload' - }; - } - - if ((buf[0] === 0x43 || buf[0] === 0x46) && check([0x57, 0x53], { - offset: 1 - })) { - return { - ext: 'swf', - mime: 'application/x-shockwave-flash' - }; - } - - if (check([0x7B, 0x5C, 0x72, 0x74, 0x66])) { - return { - ext: 'rtf', - mime: 'application/rtf' - }; - } - - if (check([0x00, 0x61, 0x73, 0x6D])) { - return { - ext: 'wasm', - mime: 'application/wasm' - }; - } - - if (check([0x77, 0x4F, 0x46, 0x46]) && (check([0x00, 0x01, 0x00, 0x00], { - offset: 4 - }) || check([0x4F, 0x54, 0x54, 0x4F], { - offset: 4 - }))) { - return { - ext: 'woff', - mime: 'font/woff' - }; - } - - if (check([0x77, 0x4F, 0x46, 0x32]) && (check([0x00, 0x01, 0x00, 0x00], { - offset: 4 - }) || check([0x4F, 0x54, 0x54, 0x4F], { - offset: 4 - }))) { - return { - ext: 'woff2', - mime: 'font/woff2' - }; - } - - if (check([0x4C, 0x50], { - offset: 34 - }) && (check([0x00, 0x00, 0x01], { - offset: 8 - }) || check([0x01, 0x00, 0x02], { - offset: 8 - }) || check([0x02, 0x00, 0x02], { - offset: 8 - }))) { - return { - ext: 'eot', - mime: 'application/vnd.ms-fontobject' - }; - } - - if (check([0x00, 0x01, 0x00, 0x00, 0x00])) { - return { - ext: 'ttf', - mime: 'font/ttf' - }; - } - - if (check([0x4F, 0x54, 0x54, 0x4F, 0x00])) { - return { - ext: 'otf', - mime: 'font/otf' - }; - } - - if (check([0x00, 0x00, 0x01, 0x00])) { - return { - ext: 'ico', - mime: 'image/x-icon' - }; - } - - if (check([0x00, 0x00, 0x02, 0x00])) { - return { - ext: 'cur', - mime: 'image/x-icon' - }; - } - - if (check([0x46, 0x4C, 0x56, 0x01])) { - return { - ext: 'flv', - mime: 'video/x-flv' - }; - } - - if (check([0x25, 0x21])) { - return { - ext: 'ps', - mime: 'application/postscript' - }; - } - - if (check([0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00])) { - return { - ext: 'xz', - mime: 'application/x-xz' - }; - } - - if (check([0x53, 0x51, 0x4C, 0x69])) { - return { - ext: 'sqlite', - mime: 'application/x-sqlite3' - }; - } - - if (check([0x4E, 0x45, 0x53, 0x1A])) { - return { - ext: 'nes', - mime: 'application/x-nintendo-nes-rom' - }; - } - - if (check([0x43, 0x72, 0x32, 0x34])) { - return { - ext: 'crx', - mime: 'application/x-google-chrome-extension' - }; - } - - if (check([0x4D, 0x53, 0x43, 0x46]) || check([0x49, 0x53, 0x63, 0x28])) { - return { - ext: 'cab', - mime: 'application/vnd.ms-cab-compressed' - }; - } // Needs to be before `ar` check - - - if (check([0x21, 0x3C, 0x61, 0x72, 0x63, 0x68, 0x3E, 0x0A, 0x64, 0x65, 0x62, 0x69, 0x61, 0x6E, 0x2D, 0x62, 0x69, 0x6E, 0x61, 0x72, 0x79])) { - return { - ext: 'deb', - mime: 'application/x-deb' - }; - } - - if (check([0x21, 0x3C, 0x61, 0x72, 0x63, 0x68, 0x3E])) { - return { - ext: 'ar', - mime: 'application/x-unix-archive' - }; - } - - if (check([0xED, 0xAB, 0xEE, 0xDB])) { - return { - ext: 'rpm', - mime: 'application/x-rpm' - }; - } - - if (check([0x1F, 0xA0]) || check([0x1F, 0x9D])) { - return { - ext: 'Z', - mime: 'application/x-compress' - }; - } - - if (check([0x4C, 0x5A, 0x49, 0x50])) { - return { - ext: 'lz', - mime: 'application/x-lzip' - }; - } - - if (check([0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1])) { - return { - ext: 'msi', - mime: 'application/x-msi' - }; - } - - if (check([0x06, 0x0E, 0x2B, 0x34, 0x02, 0x05, 0x01, 0x01, 0x0D, 0x01, 0x02, 0x01, 0x01, 0x02])) { - return { - ext: 'mxf', - mime: 'application/mxf' - }; - } - - if (check([0x47], { - offset: 4 - }) && (check([0x47], { - offset: 192 - }) || check([0x47], { - offset: 196 - }))) { - return { - ext: 'mts', - mime: 'video/mp2t' - }; - } - - if (check([0x42, 0x4C, 0x45, 0x4E, 0x44, 0x45, 0x52])) { - return { - ext: 'blend', - mime: 'application/x-blender' - }; - } - - if (check([0x42, 0x50, 0x47, 0xFB])) { - return { - ext: 'bpg', - mime: 'image/bpg' - }; - } - - if (check([0x00, 0x00, 0x00, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A])) { - // JPEG-2000 family - if (check([0x6A, 0x70, 0x32, 0x20], { - offset: 20 - })) { - return { - ext: 'jp2', - mime: 'image/jp2' - }; - } - - if (check([0x6A, 0x70, 0x78, 0x20], { - offset: 20 - })) { - return { - ext: 'jpx', - mime: 'image/jpx' - }; - } - - if (check([0x6A, 0x70, 0x6D, 0x20], { - offset: 20 - })) { - return { - ext: 'jpm', - mime: 'image/jpm' - }; - } - - if (check([0x6D, 0x6A, 0x70, 0x32], { - offset: 20 - })) { - return { - ext: 'mj2', - mime: 'image/mj2' - }; - } - } - - if (check([0x46, 0x4F, 0x52, 0x4D, 0x00])) { - return { - ext: 'aif', - mime: 'audio/aiff' - }; - } - - if (checkString('= 3) { - receiver = thisArg; - } - - if (toStr.call(list) === '[object Array]') { - forEachArray(list, iterator, receiver); - } else if (typeof list === 'string') { - forEachString(list, iterator, receiver); - } else { - forEachObject(list, iterator, receiver); - } -}; - -module.exports = forEach; - -},{"is-callable":77}],64:[function(require,module,exports){ -// (c) Dean McNamee , 2013. -// -// https://github.com/deanm/omggif -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -// -// omggif is a JavaScript implementation of a GIF 89a encoder and decoder, -// including animation and compression. It does not rely on any specific -// underlying system, so should run in the browser, Node, or Plask. - -"use strict"; - -function GifWriter(buf, width, height, gopts) { - var p = 0; - - var gopts = gopts === undefined ? { } : gopts; - var loop_count = gopts.loop === undefined ? null : gopts.loop; - var global_palette = gopts.palette === undefined ? null : gopts.palette; - - if (width <= 0 || height <= 0 || width > 65535 || height > 65535) - throw new Error("Width/Height invalid."); - - function check_palette_and_num_colors(palette) { - var num_colors = palette.length; - if (num_colors < 2 || num_colors > 256 || num_colors & (num_colors-1)) { - throw new Error( - "Invalid code/color length, must be power of 2 and 2 .. 256."); - } - return num_colors; - } - - // - Header. - buf[p++] = 0x47; buf[p++] = 0x49; buf[p++] = 0x46; // GIF - buf[p++] = 0x38; buf[p++] = 0x39; buf[p++] = 0x61; // 89a - - // Handling of Global Color Table (palette) and background index. - var gp_num_colors_pow2 = 0; - var background = 0; - if (global_palette !== null) { - var gp_num_colors = check_palette_and_num_colors(global_palette); - while (gp_num_colors >>= 1) ++gp_num_colors_pow2; - gp_num_colors = 1 << gp_num_colors_pow2; - --gp_num_colors_pow2; - if (gopts.background !== undefined) { - background = gopts.background; - if (background >= gp_num_colors) - throw new Error("Background index out of range."); - // The GIF spec states that a background index of 0 should be ignored, so - // this is probably a mistake and you really want to set it to another - // slot in the palette. But actually in the end most browsers, etc end - // up ignoring this almost completely (including for dispose background). - if (background === 0) - throw new Error("Background index explicitly passed as 0."); - } - } - - // - Logical Screen Descriptor. - // NOTE(deanm): w/h apparently ignored by implementations, but set anyway. - buf[p++] = width & 0xff; buf[p++] = width >> 8 & 0xff; - buf[p++] = height & 0xff; buf[p++] = height >> 8 & 0xff; - // NOTE: Indicates 0-bpp original color resolution (unused?). - buf[p++] = (global_palette !== null ? 0x80 : 0) | // Global Color Table Flag. - gp_num_colors_pow2; // NOTE: No sort flag (unused?). - buf[p++] = background; // Background Color Index. - buf[p++] = 0; // Pixel aspect ratio (unused?). - - // - Global Color Table - if (global_palette !== null) { - for (var i = 0, il = global_palette.length; i < il; ++i) { - var rgb = global_palette[i]; - buf[p++] = rgb >> 16 & 0xff; - buf[p++] = rgb >> 8 & 0xff; - buf[p++] = rgb & 0xff; - } - } - - if (loop_count !== null) { // Netscape block for looping. - if (loop_count < 0 || loop_count > 65535) - throw new Error("Loop count invalid.") - // Extension code, label, and length. - buf[p++] = 0x21; buf[p++] = 0xff; buf[p++] = 0x0b; - // NETSCAPE2.0 - buf[p++] = 0x4e; buf[p++] = 0x45; buf[p++] = 0x54; buf[p++] = 0x53; - buf[p++] = 0x43; buf[p++] = 0x41; buf[p++] = 0x50; buf[p++] = 0x45; - buf[p++] = 0x32; buf[p++] = 0x2e; buf[p++] = 0x30; - // Sub-block - buf[p++] = 0x03; buf[p++] = 0x01; - buf[p++] = loop_count & 0xff; buf[p++] = loop_count >> 8 & 0xff; - buf[p++] = 0x00; // Terminator. - } - - - var ended = false; - - this.addFrame = function(x, y, w, h, indexed_pixels, opts) { - if (ended === true) { --p; ended = false; } // Un-end. - - opts = opts === undefined ? { } : opts; - - // TODO(deanm): Bounds check x, y. Do they need to be within the virtual - // canvas width/height, I imagine? - if (x < 0 || y < 0 || x > 65535 || y > 65535) - throw new Error("x/y invalid.") - - if (w <= 0 || h <= 0 || w > 65535 || h > 65535) - throw new Error("Width/Height invalid.") - - if (indexed_pixels.length < w * h) - throw new Error("Not enough pixels for the frame size."); - - var using_local_palette = true; - var palette = opts.palette; - if (palette === undefined || palette === null) { - using_local_palette = false; - palette = global_palette; - } - - if (palette === undefined || palette === null) - throw new Error("Must supply either a local or global palette."); - - var num_colors = check_palette_and_num_colors(palette); - - // Compute the min_code_size (power of 2), destroying num_colors. - var min_code_size = 0; - while (num_colors >>= 1) ++min_code_size; - num_colors = 1 << min_code_size; // Now we can easily get it back. - - var delay = opts.delay === undefined ? 0 : opts.delay; - - // From the spec: - // 0 - No disposal specified. The decoder is - // not required to take any action. - // 1 - Do not dispose. The graphic is to be left - // in place. - // 2 - Restore to background color. The area used by the - // graphic must be restored to the background color. - // 3 - Restore to previous. The decoder is required to - // restore the area overwritten by the graphic with - // what was there prior to rendering the graphic. - // 4-7 - To be defined. - // NOTE(deanm): Dispose background doesn't really work, apparently most - // browsers ignore the background palette index and clear to transparency. - var disposal = opts.disposal === undefined ? 0 : opts.disposal; - if (disposal < 0 || disposal > 3) // 4-7 is reserved. - throw new Error("Disposal out of range."); - - var use_transparency = false; - var transparent_index = 0; - if (opts.transparent !== undefined && opts.transparent !== null) { - use_transparency = true; - transparent_index = opts.transparent; - if (transparent_index < 0 || transparent_index >= num_colors) - throw new Error("Transparent color index."); - } - - if (disposal !== 0 || use_transparency || delay !== 0) { - // - Graphics Control Extension - buf[p++] = 0x21; buf[p++] = 0xf9; // Extension / Label. - buf[p++] = 4; // Byte size. - - buf[p++] = disposal << 2 | (use_transparency === true ? 1 : 0); - buf[p++] = delay & 0xff; buf[p++] = delay >> 8 & 0xff; - buf[p++] = transparent_index; // Transparent color index. - buf[p++] = 0; // Block Terminator. - } - - // - Image Descriptor - buf[p++] = 0x2c; // Image Seperator. - buf[p++] = x & 0xff; buf[p++] = x >> 8 & 0xff; // Left. - buf[p++] = y & 0xff; buf[p++] = y >> 8 & 0xff; // Top. - buf[p++] = w & 0xff; buf[p++] = w >> 8 & 0xff; - buf[p++] = h & 0xff; buf[p++] = h >> 8 & 0xff; - // NOTE: No sort flag (unused?). - // TODO(deanm): Support interlace. - buf[p++] = using_local_palette === true ? (0x80 | (min_code_size-1)) : 0; - - // - Local Color Table - if (using_local_palette === true) { - for (var i = 0, il = palette.length; i < il; ++i) { - var rgb = palette[i]; - buf[p++] = rgb >> 16 & 0xff; - buf[p++] = rgb >> 8 & 0xff; - buf[p++] = rgb & 0xff; - } - } - - p = GifWriterOutputLZWCodeStream( - buf, p, min_code_size < 2 ? 2 : min_code_size, indexed_pixels); - - return p; - }; - - this.end = function() { - if (ended === false) { - buf[p++] = 0x3b; // Trailer. - ended = true; - } - return p; - }; - - this.getOutputBuffer = function() { return buf; }; - this.setOutputBuffer = function(v) { buf = v; }; - this.getOutputBufferPosition = function() { return p; }; - this.setOutputBufferPosition = function(v) { p = v; }; -} - -// Main compression routine, palette indexes -> LZW code stream. -// |index_stream| must have at least one entry. -function GifWriterOutputLZWCodeStream(buf, p, min_code_size, index_stream) { - buf[p++] = min_code_size; - var cur_subblock = p++; // Pointing at the length field. - - var clear_code = 1 << min_code_size; - var code_mask = clear_code - 1; - var eoi_code = clear_code + 1; - var next_code = eoi_code + 1; - - var cur_code_size = min_code_size + 1; // Number of bits per code. - var cur_shift = 0; - // We have at most 12-bit codes, so we should have to hold a max of 19 - // bits here (and then we would write out). - var cur = 0; - - function emit_bytes_to_buffer(bit_block_size) { - while (cur_shift >= bit_block_size) { - buf[p++] = cur & 0xff; - cur >>= 8; cur_shift -= 8; - if (p === cur_subblock + 256) { // Finished a subblock. - buf[cur_subblock] = 255; - cur_subblock = p++; - } - } - } - - function emit_code(c) { - cur |= c << cur_shift; - cur_shift += cur_code_size; - emit_bytes_to_buffer(8); - } - - // I am not an expert on the topic, and I don't want to write a thesis. - // However, it is good to outline here the basic algorithm and the few data - // structures and optimizations here that make this implementation fast. - // The basic idea behind LZW is to build a table of previously seen runs - // addressed by a short id (herein called output code). All data is - // referenced by a code, which represents one or more values from the - // original input stream. All input bytes can be referenced as the same - // value as an output code. So if you didn't want any compression, you - // could more or less just output the original bytes as codes (there are - // some details to this, but it is the idea). In order to achieve - // compression, values greater then the input range (codes can be up to - // 12-bit while input only 8-bit) represent a sequence of previously seen - // inputs. The decompressor is able to build the same mapping while - // decoding, so there is always a shared common knowledge between the - // encoding and decoder, which is also important for "timing" aspects like - // how to handle variable bit width code encoding. - // - // One obvious but very important consequence of the table system is there - // is always a unique id (at most 12-bits) to map the runs. 'A' might be - // 4, then 'AA' might be 10, 'AAA' 11, 'AAAA' 12, etc. This relationship - // can be used for an effecient lookup strategy for the code mapping. We - // need to know if a run has been seen before, and be able to map that run - // to the output code. Since we start with known unique ids (input bytes), - // and then from those build more unique ids (table entries), we can - // continue this chain (almost like a linked list) to always have small - // integer values that represent the current byte chains in the encoder. - // This means instead of tracking the input bytes (AAAABCD) to know our - // current state, we can track the table entry for AAAABC (it is guaranteed - // to exist by the nature of the algorithm) and the next character D. - // Therefor the tuple of (table_entry, byte) is guaranteed to also be - // unique. This allows us to create a simple lookup key for mapping input - // sequences to codes (table indices) without having to store or search - // any of the code sequences. So if 'AAAA' has a table entry of 12, the - // tuple of ('AAAA', K) for any input byte K will be unique, and can be our - // key. This leads to a integer value at most 20-bits, which can always - // fit in an SMI value and be used as a fast sparse array / object key. - - // Output code for the current contents of the index buffer. - var ib_code = index_stream[0] & code_mask; // Load first input index. - var code_table = { }; // Key'd on our 20-bit "tuple". - - emit_code(clear_code); // Spec says first code should be a clear code. - - // First index already loaded, process the rest of the stream. - for (var i = 1, il = index_stream.length; i < il; ++i) { - var k = index_stream[i] & code_mask; - var cur_key = ib_code << 8 | k; // (prev, k) unique tuple. - var cur_code = code_table[cur_key]; // buffer + k. - - // Check if we have to create a new code table entry. - if (cur_code === undefined) { // We don't have buffer + k. - // Emit index buffer (without k). - // This is an inline version of emit_code, because this is the core - // writing routine of the compressor (and V8 cannot inline emit_code - // because it is a closure here in a different context). Additionally - // we can call emit_byte_to_buffer less often, because we can have - // 30-bits (from our 31-bit signed SMI), and we know our codes will only - // be 12-bits, so can safely have 18-bits there without overflow. - // emit_code(ib_code); - cur |= ib_code << cur_shift; - cur_shift += cur_code_size; - while (cur_shift >= 8) { - buf[p++] = cur & 0xff; - cur >>= 8; cur_shift -= 8; - if (p === cur_subblock + 256) { // Finished a subblock. - buf[cur_subblock] = 255; - cur_subblock = p++; - } - } - - if (next_code === 4096) { // Table full, need a clear. - emit_code(clear_code); - next_code = eoi_code + 1; - cur_code_size = min_code_size + 1; - code_table = { }; - } else { // Table not full, insert a new entry. - // Increase our variable bit code sizes if necessary. This is a bit - // tricky as it is based on "timing" between the encoding and - // decoder. From the encoders perspective this should happen after - // we've already emitted the index buffer and are about to create the - // first table entry that would overflow our current code bit size. - if (next_code >= (1 << cur_code_size)) ++cur_code_size; - code_table[cur_key] = next_code++; // Insert into code table. - } - - ib_code = k; // Index buffer to single input k. - } else { - ib_code = cur_code; // Index buffer to sequence in code table. - } - } - - emit_code(ib_code); // There will still be something in the index buffer. - emit_code(eoi_code); // End Of Information. - - // Flush / finalize the sub-blocks stream to the buffer. - emit_bytes_to_buffer(1); - - // Finish the sub-blocks, writing out any unfinished lengths and - // terminating with a sub-block of length 0. If we have already started - // but not yet used a sub-block it can just become the terminator. - if (cur_subblock + 1 === p) { // Started but unused. - buf[cur_subblock] = 0; - } else { // Started and used, write length and additional terminator block. - buf[cur_subblock] = p - cur_subblock - 1; - buf[p++] = 0; - } - return p; -} - -function GifReader(buf) { - var p = 0; - - // - Header (GIF87a or GIF89a). - if (buf[p++] !== 0x47 || buf[p++] !== 0x49 || buf[p++] !== 0x46 || - buf[p++] !== 0x38 || (buf[p++]+1 & 0xfd) !== 0x38 || buf[p++] !== 0x61) { - throw new Error("Invalid GIF 87a/89a header."); - } - - // - Logical Screen Descriptor. - var width = buf[p++] | buf[p++] << 8; - var height = buf[p++] | buf[p++] << 8; - var pf0 = buf[p++]; // . - var global_palette_flag = pf0 >> 7; - var num_global_colors_pow2 = pf0 & 0x7; - var num_global_colors = 1 << (num_global_colors_pow2 + 1); - var background = buf[p++]; - buf[p++]; // Pixel aspect ratio (unused?). - - var global_palette_offset = null; - var global_palette_size = null; - - if (global_palette_flag) { - global_palette_offset = p; - global_palette_size = num_global_colors; - p += num_global_colors * 3; // Seek past palette. - } - - var no_eof = true; - - var frames = [ ]; - - var delay = 0; - var transparent_index = null; - var disposal = 0; // 0 - No disposal specified. - var loop_count = null; - - this.width = width; - this.height = height; - - while (no_eof && p < buf.length) { - switch (buf[p++]) { - case 0x21: // Graphics Control Extension Block - switch (buf[p++]) { - case 0xff: // Application specific block - // Try if it's a Netscape block (with animation loop counter). - if (buf[p ] !== 0x0b || // 21 FF already read, check block size. - // NETSCAPE2.0 - buf[p+1 ] == 0x4e && buf[p+2 ] == 0x45 && buf[p+3 ] == 0x54 && - buf[p+4 ] == 0x53 && buf[p+5 ] == 0x43 && buf[p+6 ] == 0x41 && - buf[p+7 ] == 0x50 && buf[p+8 ] == 0x45 && buf[p+9 ] == 0x32 && - buf[p+10] == 0x2e && buf[p+11] == 0x30 && - // Sub-block - buf[p+12] == 0x03 && buf[p+13] == 0x01 && buf[p+16] == 0) { - p += 14; - loop_count = buf[p++] | buf[p++] << 8; - p++; // Skip terminator. - } else { // We don't know what it is, just try to get past it. - p += 12; - while (true) { // Seek through subblocks. - var block_size = buf[p++]; - // Bad block size (ex: undefined from an out of bounds read). - if (!(block_size >= 0)) throw Error("Invalid block size"); - if (block_size === 0) break; // 0 size is terminator - p += block_size; - } - } - break; - - case 0xf9: // Graphics Control Extension - if (buf[p++] !== 0x4 || buf[p+4] !== 0) - throw new Error("Invalid graphics extension block."); - var pf1 = buf[p++]; - delay = buf[p++] | buf[p++] << 8; - transparent_index = buf[p++]; - if ((pf1 & 1) === 0) transparent_index = null; - disposal = pf1 >> 2 & 0x7; - p++; // Skip terminator. - break; - - case 0xfe: // Comment Extension. - while (true) { // Seek through subblocks. - var block_size = buf[p++]; - // Bad block size (ex: undefined from an out of bounds read). - if (!(block_size >= 0)) throw Error("Invalid block size"); - if (block_size === 0) break; // 0 size is terminator - // console.log(buf.slice(p, p+block_size).toString('ascii')); - p += block_size; - } - break; - - default: - throw new Error( - "Unknown graphic control label: 0x" + buf[p-1].toString(16)); - } - break; - - case 0x2c: // Image Descriptor. - var x = buf[p++] | buf[p++] << 8; - var y = buf[p++] | buf[p++] << 8; - var w = buf[p++] | buf[p++] << 8; - var h = buf[p++] | buf[p++] << 8; - var pf2 = buf[p++]; - var local_palette_flag = pf2 >> 7; - var interlace_flag = pf2 >> 6 & 1; - var num_local_colors_pow2 = pf2 & 0x7; - var num_local_colors = 1 << (num_local_colors_pow2 + 1); - var palette_offset = global_palette_offset; - var palette_size = global_palette_size; - var has_local_palette = false; - if (local_palette_flag) { - var has_local_palette = true; - palette_offset = p; // Override with local palette. - palette_size = num_local_colors; - p += num_local_colors * 3; // Seek past palette. - } - - var data_offset = p; - - p++; // codesize - while (true) { - var block_size = buf[p++]; - // Bad block size (ex: undefined from an out of bounds read). - if (!(block_size >= 0)) throw Error("Invalid block size"); - if (block_size === 0) break; // 0 size is terminator - p += block_size; - } - - frames.push({x: x, y: y, width: w, height: h, - has_local_palette: has_local_palette, - palette_offset: palette_offset, - palette_size: palette_size, - data_offset: data_offset, - data_length: p - data_offset, - transparent_index: transparent_index, - interlaced: !!interlace_flag, - delay: delay, - disposal: disposal}); - break; - - case 0x3b: // Trailer Marker (end of file). - no_eof = false; - break; - - default: - throw new Error("Unknown gif block: 0x" + buf[p-1].toString(16)); - break; - } - } - - this.numFrames = function() { - return frames.length; - }; - - this.loopCount = function() { - return loop_count; - }; - - this.frameInfo = function(frame_num) { - if (frame_num < 0 || frame_num >= frames.length) - throw new Error("Frame index out of range."); - return frames[frame_num]; - } - - this.decodeAndBlitFrameBGRA = function(frame_num, pixels) { - var frame = this.frameInfo(frame_num); - var num_pixels = frame.width * frame.height; - var index_stream = new Uint8Array(num_pixels); // At most 8-bit indices. - GifReaderLZWOutputIndexStream( - buf, frame.data_offset, index_stream, num_pixels); - var palette_offset = frame.palette_offset; - - // NOTE(deanm): It seems to be much faster to compare index to 256 than - // to === null. Not sure why, but CompareStub_EQ_STRICT shows up high in - // the profile, not sure if it's related to using a Uint8Array. - var trans = frame.transparent_index; - if (trans === null) trans = 256; - - // We are possibly just blitting to a portion of the entire frame. - // That is a subrect within the framerect, so the additional pixels - // must be skipped over after we finished a scanline. - var framewidth = frame.width; - var framestride = width - framewidth; - var xleft = framewidth; // Number of subrect pixels left in scanline. - - // Output indicies of the top left and bottom right corners of the subrect. - var opbeg = ((frame.y * width) + frame.x) * 4; - var opend = ((frame.y + frame.height) * width + frame.x) * 4; - var op = opbeg; - - var scanstride = framestride * 4; - - // Use scanstride to skip past the rows when interlacing. This is skipping - // 7 rows for the first two passes, then 3 then 1. - if (frame.interlaced === true) { - scanstride += width * 4 * 7; // Pass 1. - } - - var interlaceskip = 8; // Tracking the row interval in the current pass. - - for (var i = 0, il = index_stream.length; i < il; ++i) { - var index = index_stream[i]; - - if (xleft === 0) { // Beginning of new scan line - op += scanstride; - xleft = framewidth; - if (op >= opend) { // Catch the wrap to switch passes when interlacing. - scanstride = framestride * 4 + width * 4 * (interlaceskip-1); - // interlaceskip / 2 * 4 is interlaceskip << 1. - op = opbeg + (framewidth + framestride) * (interlaceskip << 1); - interlaceskip >>= 1; - } - } - - if (index === trans) { - op += 4; - } else { - var r = buf[palette_offset + index * 3]; - var g = buf[palette_offset + index * 3 + 1]; - var b = buf[palette_offset + index * 3 + 2]; - pixels[op++] = b; - pixels[op++] = g; - pixels[op++] = r; - pixels[op++] = 255; - } - --xleft; - } - }; - - // I will go to copy and paste hell one day... - this.decodeAndBlitFrameRGBA = function(frame_num, pixels) { - var frame = this.frameInfo(frame_num); - var num_pixels = frame.width * frame.height; - var index_stream = new Uint8Array(num_pixels); // At most 8-bit indices. - GifReaderLZWOutputIndexStream( - buf, frame.data_offset, index_stream, num_pixels); - var palette_offset = frame.palette_offset; - - // NOTE(deanm): It seems to be much faster to compare index to 256 than - // to === null. Not sure why, but CompareStub_EQ_STRICT shows up high in - // the profile, not sure if it's related to using a Uint8Array. - var trans = frame.transparent_index; - if (trans === null) trans = 256; - - // We are possibly just blitting to a portion of the entire frame. - // That is a subrect within the framerect, so the additional pixels - // must be skipped over after we finished a scanline. - var framewidth = frame.width; - var framestride = width - framewidth; - var xleft = framewidth; // Number of subrect pixels left in scanline. - - // Output indicies of the top left and bottom right corners of the subrect. - var opbeg = ((frame.y * width) + frame.x) * 4; - var opend = ((frame.y + frame.height) * width + frame.x) * 4; - var op = opbeg; - - var scanstride = framestride * 4; - - // Use scanstride to skip past the rows when interlacing. This is skipping - // 7 rows for the first two passes, then 3 then 1. - if (frame.interlaced === true) { - scanstride += width * 4 * 7; // Pass 1. - } - - var interlaceskip = 8; // Tracking the row interval in the current pass. - - for (var i = 0, il = index_stream.length; i < il; ++i) { - var index = index_stream[i]; - - if (xleft === 0) { // Beginning of new scan line - op += scanstride; - xleft = framewidth; - if (op >= opend) { // Catch the wrap to switch passes when interlacing. - scanstride = framestride * 4 + width * 4 * (interlaceskip-1); - // interlaceskip / 2 * 4 is interlaceskip << 1. - op = opbeg + (framewidth + framestride) * (interlaceskip << 1); - interlaceskip >>= 1; - } - } - - if (index === trans) { - op += 4; - } else { - var r = buf[palette_offset + index * 3]; - var g = buf[palette_offset + index * 3 + 1]; - var b = buf[palette_offset + index * 3 + 2]; - pixels[op++] = r; - pixels[op++] = g; - pixels[op++] = b; - pixels[op++] = 255; - } - --xleft; - } - }; -} - -function GifReaderLZWOutputIndexStream(code_stream, p, output, output_length) { - var min_code_size = code_stream[p++]; - - var clear_code = 1 << min_code_size; - var eoi_code = clear_code + 1; - var next_code = eoi_code + 1; - - var cur_code_size = min_code_size + 1; // Number of bits per code. - // NOTE: This shares the same name as the encoder, but has a different - // meaning here. Here this masks each code coming from the code stream. - var code_mask = (1 << cur_code_size) - 1; - var cur_shift = 0; - var cur = 0; - - var op = 0; // Output pointer. - - var subblock_size = code_stream[p++]; - - // TODO(deanm): Would using a TypedArray be any faster? At least it would - // solve the fast mode / backing store uncertainty. - // var code_table = Array(4096); - var code_table = new Int32Array(4096); // Can be signed, we only use 20 bits. - - var prev_code = null; // Track code-1. - - while (true) { - // Read up to two bytes, making sure we always 12-bits for max sized code. - while (cur_shift < 16) { - if (subblock_size === 0) break; // No more data to be read. - - cur |= code_stream[p++] << cur_shift; - cur_shift += 8; - - if (subblock_size === 1) { // Never let it get to 0 to hold logic above. - subblock_size = code_stream[p++]; // Next subblock. - } else { - --subblock_size; - } - } - - // TODO(deanm): We should never really get here, we should have received - // and EOI. - if (cur_shift < cur_code_size) - break; - - var code = cur & code_mask; - cur >>= cur_code_size; - cur_shift -= cur_code_size; - - // TODO(deanm): Maybe should check that the first code was a clear code, - // at least this is what you're supposed to do. But actually our encoder - // now doesn't emit a clear code first anyway. - if (code === clear_code) { - // We don't actually have to clear the table. This could be a good idea - // for greater error checking, but we don't really do any anyway. We - // will just track it with next_code and overwrite old entries. - - next_code = eoi_code + 1; - cur_code_size = min_code_size + 1; - code_mask = (1 << cur_code_size) - 1; - - // Don't update prev_code ? - prev_code = null; - continue; - } else if (code === eoi_code) { - break; - } - - // We have a similar situation as the decoder, where we want to store - // variable length entries (code table entries), but we want to do in a - // faster manner than an array of arrays. The code below stores sort of a - // linked list within the code table, and then "chases" through it to - // construct the dictionary entries. When a new entry is created, just the - // last byte is stored, and the rest (prefix) of the entry is only - // referenced by its table entry. Then the code chases through the - // prefixes until it reaches a single byte code. We have to chase twice, - // first to compute the length, and then to actually copy the data to the - // output (backwards, since we know the length). The alternative would be - // storing something in an intermediate stack, but that doesn't make any - // more sense. I implemented an approach where it also stored the length - // in the code table, although it's a bit tricky because you run out of - // bits (12 + 12 + 8), but I didn't measure much improvements (the table - // entries are generally not the long). Even when I created benchmarks for - // very long table entries the complexity did not seem worth it. - // The code table stores the prefix entry in 12 bits and then the suffix - // byte in 8 bits, so each entry is 20 bits. - - var chase_code = code < next_code ? code : prev_code; - - // Chase what we will output, either {CODE} or {CODE-1}. - var chase_length = 0; - var chase = chase_code; - while (chase > clear_code) { - chase = code_table[chase] >> 8; - ++chase_length; - } - - var k = chase; - - var op_end = op + chase_length + (chase_code !== code ? 1 : 0); - if (op_end > output_length) { - console.log("Warning, gif stream longer than expected."); - return; - } - - // Already have the first byte from the chase, might as well write it fast. - output[op++] = k; - - op += chase_length; - var b = op; // Track pointer, writing backwards. - - if (chase_code !== code) // The case of emitting {CODE-1} + k. - output[op++] = k; - - chase = chase_code; - while (chase_length--) { - chase = code_table[chase]; - output[--b] = chase & 0xff; // Write backwards. - chase >>= 8; // Pull down to the prefix code. - } - - if (prev_code !== null && next_code < 4096) { - code_table[next_code++] = prev_code << 8 | k; - // TODO(deanm): Figure out this clearing vs code growth logic better. I - // have an feeling that it should just happen somewhere else, for now it - // is awkward between when we grow past the max and then hit a clear code. - // For now just check if we hit the max 12-bits (then a clear code should - // follow, also of course encoded in 12-bits). - if (next_code >= code_mask+1 && cur_code_size < 12) { - ++cur_code_size; - code_mask = code_mask << 1 | 1; - } - } - - prev_code = code; - } - - if (op !== output_length) { - console.log("Warning, gif stream shorter than expected."); - } - - return output; -} - -// CommonJS. -try { exports.GifWriter = GifWriter; exports.GifReader = GifReader } catch(e) {} - -},{}],65:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -/** @class BitmapImage */ - -class BitmapImage { - - /** - * BitmapImage is a class that hold an RGBA (red, green, blue, alpha) representation of an image. It's shape is borrowed from the Jimp package to make it easy to transfer GIF image frames into Jimp and Jimp images into GIF image frames. Each instance has a `bitmap` property having the following properties: - * - * Property | Description - * --- | --- - * bitmap.width | width of image in pixels - * bitmap.height | height of image in pixels - * bitmap.data | a Buffer whose every four bytes represents a pixel, each sequential byte of a pixel corresponding to the red, green, blue, and alpha values of the pixel - * - * Its constructor supports the following signatures: - * - * * new BitmapImage(bitmap: { width: number, height: number, data: Buffer }) - * * new BitmapImage(bitmapImage: BitmapImage) - * * new BitmapImage(width: number, height: number, buffer: Buffer) - * * new BitmapImage(width: number, height: number, backgroundRGBA?: number) - * - * When a `BitmapImage` is provided, the constructed `BitmapImage` is a deep clone of the provided one, so that each image's pixel data can subsequently be modified without affecting each other. - * - * `backgroundRGBA` is an optional parameter representing a pixel as a single number. In hex, the number is as follows: 0xRRGGBBAA, where RR is the red byte, GG the green byte, BB, the blue byte, and AA the alpha value. An AA of 0x00 is considered transparent, and all non-zero AA values are treated as opaque. - */ - - constructor(...args) { - // don't confirm the number of args, because a subclass may have - // additional args and pass them all to the superclass - if (args.length === 0) { - throw new Error("constructor requires parameters"); - } - const firstArg = args[0]; - if (firstArg !== null && typeof firstArg === 'object') { - if (firstArg instanceof BitmapImage) { - // copy a provided BitmapImage - const sourceBitmap = firstArg.bitmap; - this.bitmap = { - width: sourceBitmap.width, - height: sourceBitmap.height, - data: new Buffer(sourceBitmap.width * sourceBitmap.height * 4) - }; - sourceBitmap.data.copy(this.bitmap.data); - } - else if (firstArg.width && firstArg.height && firstArg.data) { - // share a provided bitmap - this.bitmap = firstArg; - } - else { - throw new Error("unrecognized constructor parameters"); - } - } - else if (typeof firstArg === 'number' && typeof args[1] === 'number') - { - const width = firstArg; - const height = args[1]; - const thirdArg = args[2]; - this.bitmap = { width, height }; - - if (Buffer.isBuffer(thirdArg)) { - this.bitmap.data = thirdArg; - } - else { - this.bitmap.data = new Buffer(width * height * 4); - if (typeof thirdArg === 'number') { - this.fillRGBA(thirdArg); - } - } - } - else { - throw new Error("unrecognized constructor parameters"); - } - } - - /** - * Copy a square portion of this image into another image. - * - * @param {BitmapImage} toImage Image into which to copy the square - * @param {number} toX x-coord in toImage of upper-left corner of receiving square - * @param {number} toY y-coord in toImage of upper-left corner of receiving square - * @param {number} fromX x-coord in this image of upper-left corner of source square - * @param {number} fromY y-coord in this image of upper-left corner of source square - * @return {BitmapImage} The present image to allow for chaining. - */ - - blit(toImage, toX, toY, fromX, fromY, fromWidth, fromHeight) { - if (fromX + fromWidth > this.bitmap.width) { - throw new Error("copy exceeds width of source bitmap"); - } - if (toX + fromWidth > toImage.bitmap.width) { - throw new Error("copy exceeds width of target bitmap"); - } - if (fromY + fromHeight > this.bitmap.height) { - throw new Error("copy exceeds height of source bitmap"); - } - if (toY + fromHeight > toImage.bitmap.height) { - throw new Erro("copy exceeds height of target bitmap"); - } - - const sourceBuf = this.bitmap.data; - const targetBuf = toImage.bitmap.data; - const sourceByteWidth = this.bitmap.width * 4; - const targetByteWidth = toImage.bitmap.width * 4; - const copyByteWidth = fromWidth * 4; - let si = fromY * sourceByteWidth + fromX * 4; - let ti = toY * targetByteWidth + toX * 4; - - while (--fromHeight >= 0) { - sourceBuf.copy(targetBuf, ti, si, si + copyByteWidth); - si += sourceByteWidth; - ti += targetByteWidth; - } - return this; - } - - /** - * Fills the image with a single color. - * - * @param {number} rgba Color with which to fill image, expressed as a singlenumber in the form 0xRRGGBBAA, where AA is 0x00 for transparent and any other value for opaque. - * @return {BitmapImage} The present image to allow for chaining. - */ - - fillRGBA(rgba) { - const buf = this.bitmap.data; - const bufByteWidth = this.bitmap.height * 4; - - let bi = 0; - while (bi < bufByteWidth) { - buf.writeUInt32BE(rgba, bi); - bi += 4; - } - while (bi < buf.length) { - buf.copy(buf, bi, 0, bufByteWidth); - bi += bufByteWidth; - } - return this; - } - - /** - * Gets the RGBA number of the pixel at the given coordinate in the form 0xRRGGBBAA, where AA is the alpha value, with alpha 0x00 encoding to transparency in GIFs. - * - * @param {number} x x-coord of pixel - * @param {number} y y-coord of pixel - * @return {number} RGBA of pixel in 0xRRGGBBAA form - */ - - getRGBA(x, y) { - const bi = (y * this.bitmap.width + x) * 4; - return this.bitmap.data.readUInt32BE(bi); - } - - /** - * Gets a set of all RGBA colors found within the image. - * - * @return {Set} Set of all RGBA colors that the image contains. - */ - - getRGBASet() { - const rgbaSet = new Set(); - const buf = this.bitmap.data; - for (let bi = 0; bi < buf.length; bi += 4) { - rgbaSet.add(buf.readUInt32BE(bi, true)); - } - return rgbaSet; - } - - /** - * Converts the image to greyscale using inferred Adobe metrics. - * - * @return {BitmapImage} The present image to allow for chaining. - */ - - greyscale() { - const buf = this.bitmap.data; - this.scan(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => { - const grey = Math.round( - 0.299 * buf[idx] + - 0.587 * buf[idx + 1] + - 0.114 * buf[idx + 2] - ); - buf[idx] = grey; - buf[idx + 1] = grey; - buf[idx + 2] = grey; - }); - return this; - } - - /** - * Reframes the image as if placing a frame around the original image and replacing the original image with the newly framed image. When the new frame is strictly within the boundaries of the original image, this method crops the image. When any of the new boundaries exceed those of the original image, the `fillRGBA` must be provided to indicate the color with which to fill the extra space added to the image. - * - * @param {number} xOffset The x-coord offset of the upper-left pixel of the desired image relative to the present image. - * @param {number} yOffset The y-coord offset of the upper-left pixel of the desired image relative to the present image. - * @param {number} width The width of the new image after reframing - * @param {number} height The height of the new image after reframing - * @param {number} fillRGBA The color with which to fill space added to the image as a result of the reframing, in 0xRRGGBBAA format, where AA is 0x00 to indicate transparent and a non-zero value to indicate opaque. This parameter is only required when the reframing exceeds the original boundaries (i.e. does not simply perform a crop). - * @return {BitmapImage} The present image to allow for chaining. - */ - - reframe(xOffset, yOffset, width, height, fillRGBA) { - const cropX = (xOffset < 0 ? 0 : xOffset); - const cropY = (yOffset < 0 ? 0 : yOffset); - const cropWidth = (width + cropX > this.bitmap.width ? - this.bitmap.width - cropX : width); - const cropHeight = (height + cropY > this.bitmap.height ? - this.bitmap.height - cropY : height); - const newX = (xOffset < 0 ? -xOffset : 0); - const newY = (yOffset < 0 ? -yOffset : 0); - - let image; - if (fillRGBA === undefined) { - if (cropX !== xOffset || cropY != yOffset || - cropWidth !== width || cropHeight !== height) - { - throw new GifError(`fillRGBA required for this reframing`); - } - image = new BitmapImage(width, height); - } - else { - image = new BitmapImage(width, height, fillRGBA); - } - this.blit(image, newX, newY, cropX, cropY, cropWidth, cropHeight); - this.bitmap = image.bitmap; - return this; - } - - /** - * Scales the image size up by an integer factor. Each pixel of the original image becomes a square of the same color in the new image having a size of `factor` x `factor` pixels. - * - * @param {number} factor The factor by which to scale up the image. Must be an integer >= 1. - * @return {BitmapImage} The present image to allow for chaining. - */ - - scale(factor) { - if (factor === 1) { - return; - } - if (!Number.isInteger(factor) || factor < 1) { - throw new Error("the scale must be an integer >= 1"); - } - const sourceWidth = this.bitmap.width; - const sourceHeight = this.bitmap.height; - const destByteWidth = sourceWidth * factor * 4; - const sourceBuf = this.bitmap.data; - const destBuf = new Buffer(sourceHeight * destByteWidth * factor); - let sourceIndex = 0; - let priorDestRowIndex; - let destIndex = 0; - for (let y = 0; y < sourceHeight; ++y) { - priorDestRowIndex = destIndex; - for (let x = 0; x < sourceWidth; ++x) { - const color = sourceBuf.readUInt32BE(sourceIndex, true); - for (let cx = 0; cx < factor; ++cx) { - destBuf.writeUInt32BE(color, destIndex); - destIndex += 4; - } - sourceIndex += 4; - } - for (let cy = 1; cy < factor; ++cy) { - destBuf.copy(destBuf, destIndex, priorDestRowIndex, destIndex); - destIndex += destByteWidth; - priorDestRowIndex += destByteWidth; - } - } - this.bitmap = { - width: sourceWidth * factor, - height: sourceHeight * factor, - data: destBuf - }; - return this; - } - - /** - * Scans all coordinates of the image, handing each in turn to the provided handler function. - * - * @param {function} scanHandler A function(x: number, y: number, bi: number) to be called for each pixel of the image with that pixel's x-coord, y-coord, and index into the `data` buffer. The function accesses the pixel at this coordinate by accessing the `this.data` at index `bi`. - * @see scanAllIndexes - */ - - scanAllCoords(scanHandler) { - const width = this.bitmap.width; - const bufferLength = this.bitmap.data.length; - let x = 0; - let y = 0; - - for (let bi = 0; bi < bufferLength; bi += 4) { - scanHandler(x, y, bi); - if (++x === width) { - x = 0; - ++y; - } - } - } - - /** - * Scans all pixels of the image, handing the index of each in turn to the provided handler function. Runs a bit faster than `scanAllCoords()`, should the handler not need pixel coordinates. - * - * @param {function} scanHandler A function(bi: number) to be called for each pixel of the image with that pixel's index into the `data` buffer. The pixels is found at index 'bi' within `this.data`. - * @see scanAllCoords - */ - - scanAllIndexes(scanHandler) { - const bufferLength = this.bitmap.data.length; - for (let bi = 0; bi < bufferLength; bi += 4) { - scanHandler(bi); - } - } -} - -module.exports = BitmapImage; - -}).call(this,require("buffer").Buffer) -},{"buffer":48}],66:[function(require,module,exports){ -'use strict'; - -/** @class Gif */ - -class Gif { - - // width - width of GIF in pixels - // height - height of GIF in pixels - // loops - 0 = unending; (n > 0) = iterate n times - // usesTransparency - whether any frames have transparent pixels - // colorScope - scope of color tables in GIF - // frames - array of frames - // buffer - GIF-formatted data - - /** - * Gif is a class representing an encoded GIF. It is intended to be a read-only representation of a byte-encoded GIF. Only encoders and decoders should be creating instances of this class. - * - * Property | Description - * --- | --- - * width | width of the GIF at its widest - * height | height of the GIF at its highest - * loops | the number of times the GIF should loop before stopping; 0 => loop indefinately - * usesTransparency | boolean indicating whether at least one frame contains at least one transparent pixel - * colorScope | the scope of the color tables as encoded within the GIF; either Gif.GlobalColorsOnly (== 1) or Gif.LocalColorsOnly (== 2). - * frames | a array of GifFrame instances, one for each frame of the GIF - * buffer | a Buffer holding the encoding's byte data - * - * Its constructor should only ever be called by the GIF encoder or decoder. - * - * @param {Buffer} buffer A Buffer containing the encoded bytes - * @param {GifFrame[]} frames Array of frames found in the encoding - * @param {object} spec Properties of the encoding as listed above - */ - - constructor(buffer, frames, spec) { - this.width = spec.width; - this.height = spec.height; - this.loops = spec.loops; - this.usesTransparency = spec.usesTransparency; - this.colorScope = spec.colorScope; - this.frames = frames; - this.buffer = buffer; - } -} - -Gif.GlobalColorsPreferred = 0; -Gif.GlobalColorsOnly = 1; -Gif.LocalColorsOnly = 2; - -/** @class GifError */ - -class GifError extends Error { - - /** - * GifError is a class representing a GIF-related error - * - * @param {string|Error} messageOrError - */ - - constructor(messageOrError) { - super(messageOrError); - if (messageOrError instanceof Error) { - this.stack = 'Gif' + messageOrError.stack; - } - } -} - -exports.Gif = Gif; -exports.GifError = GifError; - -},{}],67:[function(require,module,exports){ -(function (process,Buffer){ -'use strict'; - -const Omggif = require('omggif'); -const { Gif, GifError } = require('./gif'); -let GifUtil; // allow circular dependency with GifUtil -process.nextTick(() => { - GifUtil = require('./gifutil'); -}); - -const { GifFrame } = require('./gifframe'); - -const PER_GIF_OVERHEAD = 200; // these are guesses at upper limits -const PER_FRAME_OVERHEAD = 100; - -// Note: I experimented with accepting a global color table when encoding and returning the global color table when decoding. Doing this properly greatly increased the complexity of the code and the amount of clock cycles required. The main issue is that each frame can specify any color of the global color table to be transparent within the frame, while this GIF library strives to hide GIF formatting details from its clients. E.g. it's possible to have 256 colors in the global color table and different transparencies in each frame, requiring clients to either provide per-frame transparency indexes, or for arcane reasons that won't be apparent to client developers, encode some GIFs with local color tables that previously decoded with global tables. - -/** @class GifCodec */ - -class GifCodec -{ - // _transparentRGBA - RGB given to transparent pixels (alpha=0) on decode; defaults to null indicating 0x000000, which is fastest - - /** - * GifCodec is a class that both encodes and decodes GIFs. It implements both the `encode()` method expected of an encoder and the `decode()` method expected of a decoder, and it wraps the `omggif` GIF encoder/decoder package. GifCodec serves as this library's default encoder and decoder, but it's possible to wrap other GIF encoders and decoders for use by `gifwrap` as well. GifCodec will not encode GIFs with interlacing. - * - * Instances of this class are stateless and can be shared across multiple encodings and decodings. - * - * Its constructor takes one option argument: - * - * @param {object} options Optionally takes an objection whose only possible property is `transparentRGB`. Images are internally represented in RGBA format, where A is the alpha value of a pixel. When `transparentRGB` is provided, this RGB value (excluding alpha) is assigned to transparent pixels, which are also given alpha value 0x00. (All opaque pixels are given alpha value 0xFF). The RGB color of transparent pixels shouldn't matter for most applications. Defaults to 0x000000. - */ - - constructor(options = {}) { - this._transparentRGB = null; // 0x000000 - if (typeof options.transparentRGB === 'number' && - options.transparentRGB !== 0) - { - this._transparentRGBA = options.transparentRGB * 256; - } - this._testInitialBufferSize = 0; // assume no buffer scaling test - } - - /** - * Decodes a GIF from a Buffer to yield an instance of Gif. Transparent pixels of the GIF are given alpha values of 0x00, and opaque pixels are given alpha values of 0xFF. The RGB values of transparent pixels default to 0x000000 but can be overridden by the constructor's `transparentRGB` option. - * - * @param {Buffer} buffer Bytes of an encoded GIF to decode. - * @return {Promise} A Promise that resolves to an instance of the Gif class, representing the encoded GIF. - * @throws {GifError} Error upon encountered an encoding-related problem with a GIF, so that the caller can distinguish between software errors and problems with GIFs. - */ - - decodeGif(buffer) { - try { - let reader; - try { - reader = new Omggif.GifReader(buffer); - } - catch (err) { - throw new GifError(err); - } - const frameCount = reader.numFrames(); - const frames = []; - const spec = { - width: reader.width, - height: reader.height, - loops: reader.loopCount() - }; - - spec.usesTransparency = false; - for (let i = 0; i < frameCount; ++i) { - const frameInfo = - this._decodeFrame(reader, i, spec.usesTransparency); - frames.push(frameInfo.frame); - if (frameInfo.usesTransparency) { - spec.usesTransparency = true; - } - } - return Promise.resolve(new Gif(buffer, frames, spec)); - } - catch (err) { - return Promise.reject(err); - } - } - - /** - * Encodes a GIF from provided frames. Each pixel having an alpha value of 0x00 renders as transparent within the encoding, while all pixels of non-zero alpha value render as opaque. - * - * @param {GifFrame[]} frames Array of frames to encode - * @param {object} spec An optional object that may provide values for `loops` and `colorScope`, as defined for the Gif class. However, `colorSpace` may also take the value Gif.GlobalColorsPreferred (== 0) to indicate that the encoder should attempt to create only a global color table. `loop` defaults to 0, looping indefinitely, and `colorScope` defaults to Gif.GlobalColorsPreferred. - * @return {Promise} A Promise that resolves to an instance of the Gif class, representing the encoded GIF. - * @throws {GifError} Error upon encountered an encoding-related problem with a GIF, so that the caller can distinguish between software errors and problems with GIFs. - */ - - encodeGif(frames, spec = {}) { - try { - if (frames === null || frames.length === 0) { - throw new GifError("there are no frames"); - } - const dims = GifUtil.getMaxDimensions(frames); - - spec = Object.assign({}, spec); // don't munge caller's spec - spec.width = dims.maxWidth; - spec.height = dims.maxHeight; - spec.loops = spec.loops || 0; - spec.colorScope = spec.colorScope || Gif.GlobalColorsPreferred; - - return Promise.resolve(this._encodeGif(frames, spec)); - } - catch (err) { - return Promise.reject(err); - } - } - - _decodeFrame(reader, frameIndex, alreadyUsedTransparency) { - let info, buffer; - try { - info = reader.frameInfo(frameIndex); - buffer = new Buffer(reader.width * reader.height * 4); - reader.decodeAndBlitFrameRGBA(frameIndex, buffer); - if (info.width !== reader.width || info.height !== reader.height) { - if (info.y) { - // skip unused rows - buffer = buffer.slice(info.y * reader.width * 4); - } - if (reader.width > info.width) { - // skip scanstride - for (let ii = 0; ii < info.height; ++ii) { - buffer.copy(buffer, ii * info.width * 4, - (info.x + ii * reader.width) * 4, - (info.x + ii * reader.width) * 4 + info.width * 4); - } - } - // trim buffer to size - buffer = buffer.slice(0, info.width * info.height * 4); - } - } - catch (err) { - throw new GifError(err); - } - - let usesTransparency = false; - if (this._transparentRGBA === null) { - if (!alreadyUsedTransparency) { - for (let i = 3; i < buffer.length; i += 4) { - if (buffer[i] === 0) { - usesTransparency = true; - i = buffer.length; - } - } - } - } - else { - for (let i = 3; i < buffer.length; i += 4) { - if (buffer[i] === 0) { - buffer.writeUInt32BE(this._transparentRGBA, i - 3); - usesTransparency = true; // GIF might encode unused index - } - } - } - - const frame = new GifFrame(info.width, info.height, buffer, { - xOffset: info.x, - yOffset: info.y, - disposalMethod: info.disposal, - interlaced: info.interlaced, - delayCentisecs: info.delay - }); - return { frame, usesTransparency }; - } - - _encodeGif(frames, spec) { - let colorInfo; - if (spec.colorScope === Gif.LocalColorsOnly) { - colorInfo = GifUtil.getColorInfo(frames, 0); - } - else { - colorInfo = GifUtil.getColorInfo(frames, 256); - if (!colorInfo.colors) { // if global palette impossible - if (spec.colorScope === Gif.GlobalColorsOnly) { - throw new GifError( - "Too many color indexes for global color table"); - } - spec.colorScope = Gif.LocalColorsOnly - } - } - spec.usesTransparency = colorInfo.usesTransparency; - - const localPalettes = colorInfo.palettes; - if (spec.colorScope === Gif.LocalColorsOnly) { - const localSizeEst = 2000; //this._getSizeEstimateLocal(localPalettes, frames); - return _encodeLocal(frames, spec, localSizeEst, localPalettes); - } - - const globalSizeEst = 2000; //this._getSizeEstimateGlobal(colorInfo, frames); - return _encodeGlobal(frames, spec, globalSizeEst, colorInfo); - } - - _getSizeEstimateGlobal(globalPalette, frames) { - if (this._testInitialBufferSize > 0) { - return this._testInitialBufferSize; - } - let sizeEst = PER_GIF_OVERHEAD + 3*256 /* max palette size*/; - const pixelBitWidth = _getPixelBitWidth(globalPalette); - frames.forEach(frame => { - sizeEst += _getFrameSizeEst(frame, pixelBitWidth); - }); - return sizeEst; // should be the upper limit - } - - _getSizeEstimateLocal(palettes, frames) { - if (this._testInitialBufferSize > 0) { - return this._testInitialBufferSize; - } - let sizeEst = PER_GIF_OVERHEAD; - for (let i = 0; i < frames.length; ++i ) { - const palette = palettes[i]; - const pixelBitWidth = _getPixelBitWidth(palette); - sizeEst += _getFrameSizeEst(frames[i], pixelBitWidth); - } - return sizeEst; // should be the upper limit - } -} -exports.GifCodec = GifCodec; - -function _colorLookupLinear(colors, color) { - const index = colors.indexOf(color); - return (index === -1 ? null : index); -} - -function _colorLookupBinary(colors, color) { - // adapted from https://stackoverflow.com/a/10264318/650894 - var lo = 0, hi = colors.length - 1, mid; - while (lo <= hi) { - mid = Math.floor((lo + hi)/2); - if (colors[mid] > color) - hi = mid - 1; - else if (colors[mid] < color) - lo = mid + 1; - else - return mid; - } - return null; -} - -function _encodeGlobal(frames, spec, bufferSizeEst, globalPalette) { - // would be inefficient for frames to lookup colors in extended palette - const extendedGlobalPalette = { - colors: globalPalette.colors.slice(), - usesTransparency: globalPalette.usesTransparency - }; - _extendPaletteToPowerOf2(extendedGlobalPalette); - const options = { - palette: extendedGlobalPalette.colors, - loop: spec.loops - }; - let buffer = new Buffer(bufferSizeEst); - let gifWriter; - try { - gifWriter = new Omggif.GifWriter(buffer, spec.width, spec.height, - options); - } - catch (err) { - throw new GifError(err); - } - for (let i = 0; i < frames.length; ++i) { - buffer = _writeFrame(gifWriter, i, frames[i], globalPalette, false); - } - return new Gif(buffer.slice(0, gifWriter.end()), frames, spec); -} - -function _encodeLocal(frames, spec, bufferSizeEst, localPalettes) { - const options = { - loop: spec.loops - }; - let buffer = new Buffer(bufferSizeEst); - let gifWriter; - try { - gifWriter = new Omggif.GifWriter(buffer, spec.width, spec.height, - options); - } - catch (err) { - throw new GifError(err); - } - for (let i = 0; i < frames.length; ++i) { - buffer = _writeFrame(gifWriter, i, frames[i], localPalettes[i], true); - } - return new Gif(buffer.slice(0, gifWriter.end()), frames, spec); -} - -function _extendPaletteToPowerOf2(palette) { - const colors = palette.colors; - if (palette.usesTransparency) { - colors.push(0); - } - const colorCount = colors.length; - let powerOf2 = 2; - while (colorCount > powerOf2) { - powerOf2 <<= 1; - } - colors.length = powerOf2; - colors.fill(0, colorCount); -} - -function _getFrameSizeEst(frame, pixelBitWidth) { - let byteLength = frame.bitmap.width * frame.bitmap.height; - byteLength = Math.ceil(byteLength * pixelBitWidth / 8); - byteLength += Math.ceil(byteLength / 255); // add block size bytes - // assume maximum palete size because it might get extended for power of 2 - return (PER_FRAME_OVERHEAD + byteLength + 3 * 256 /* largest palette */); -} - -function _getIndexedImage(frameIndex, frame, palette) { - const colors = palette.colors; - const colorToIndexFunc = (colors.length <= 8 ? // guess at the break-even - _colorLookupLinear : _colorLookupBinary); - const colorBuffer = frame.bitmap.data; - const indexBuffer = new Buffer(colorBuffer.length/4); - let transparentIndex = colors.length; - let i = 0, j = 0; - - while (i < colorBuffer.length) { - if (colorBuffer[i + 3] !== 0) { - const color = (colorBuffer.readUInt32BE(i, true) >> 8) & 0xFFFFFF; - // caller guarantees that the color will be in the palette - indexBuffer[j] = colorToIndexFunc(colors, color); - } - else { - indexBuffer[j] = transparentIndex; - } - i += 4; // skip alpha - ++j; - } - - if (palette.usesTransparency) { - if (transparentIndex === 256) { - throw new GifError(`Frame ${frameIndex} already has 256 colors` + - `and so can't use transparency`); - } - } - else { - transparentIndex = null; - } - - return { buffer: indexBuffer, transparentIndex }; -} - -function _getPixelBitWidth(palette) { - let indexCount = palette.indexCount; - let pixelBitWidth = 0; - --indexCount; // start at maximum index - while (indexCount) { - ++pixelBitWidth; - indexCount >>= 1; - } - return (pixelBitWidth > 0 ? pixelBitWidth : 1); -} - -function _writeFrame(gifWriter, frameIndex, frame, palette, isLocalPalette) { - if (frame.interlaced) { - throw new GifError("writing interlaced GIFs is not supported"); - } - const frameInfo = _getIndexedImage(frameIndex, frame, palette); - const options = { - delay: frame.delayCentisecs, - disposal: frame.disposalMethod, - transparent: frameInfo.transparentIndex - }; - if (isLocalPalette) { - _extendPaletteToPowerOf2(palette); // ok 'cause palette never used again - options.palette = palette.colors; - } - try { - let buffer = gifWriter.getOutputBuffer(); - let startOfFrame = gifWriter.getOutputBufferPosition(); - let endOfFrame; - let tryAgain = true; - - while (tryAgain) { - endOfFrame = gifWriter.addFrame(frame.xOffset, frame.yOffset, - frame.bitmap.width, frame.bitmap.height, frameInfo.buffer, options); - tryAgain = false; - if (endOfFrame >= buffer.length - 1) { - const biggerBuffer = new Buffer(buffer.length * 1.5); - buffer.copy(biggerBuffer); - gifWriter.setOutputBuffer(biggerBuffer); - gifWriter.setOutputBufferPosition(startOfFrame); - buffer = biggerBuffer; - tryAgain = true; - } - } - return buffer; - } - catch (err) { - throw new GifError(err); - } -} - -}).call(this,require('_process'),require("buffer").Buffer) -},{"./gif":66,"./gifframe":68,"./gifutil":69,"_process":133,"buffer":48,"omggif":64}],68:[function(require,module,exports){ -'use strict'; - -const BitmapImage = require('./bitmapimage'); -const { GifError } = require('./gif'); - -/** @class GifFrame */ - -class GifFrame extends BitmapImage { - - // xOffset - x offset of bitmap on GIF (defaults to 0) - // yOffset - y offset of bitmap on GIF (defaults to 0) - // disposalMethod - pixel disposal method when handling partial images - // delayCentisecs - duration of frame in hundredths of a second - // interlaced - whether the image is interlaced (defaults to false) - - /** - * GifFrame is a class representing an image frame of a GIF. GIFs contain one or more instances of GifFrame. - * - * Property | Description - * --- | --- - * xOffset | x-coord of position within GIF at which to render the image (defaults to 0) - * yOffset | y-coord of position within GIF at which to render the image (defaults to 0) - * disposalMethod | GIF disposal method; only relevant when the frames aren't all the same size (defaults to 2, disposing to background color) - * delayCentisecs | duration of the frame in hundreths of a second - * interlaced | boolean indicating whether the frame renders interlaced - * - * Its constructor supports the following signatures: - * - * * new GifFrame(bitmap: {width: number, height: number, data: Buffer}, options?) - * * new GifFrame(bitmapImage: BitmapImage, options?) - * * new GifFrame(width: number, height: number, buffer: Buffer, options?) - * * new GifFrame(width: number, height: number, backgroundRGBA?: number, options?) - * * new GifFrame(frame: GifFrame) - * - * See the base class BitmapImage for a discussion of all parameters but `options` and `frame`. `options` is an optional argument providing initial values for the above-listed GifFrame properties. Each property within option is itself optional. - * - * Provide a `frame` to the constructor to create a clone of the provided frame. The new frame includes a copy of the provided frame's pixel data so that each can subsequently be modified without affecting each other. - */ - - constructor(...args) { - super(...args); - if (args[0] instanceof GifFrame) { - // copy a provided GifFrame - const source = args[0]; - this.xOffset = source.xOffset; - this.yOffset = source.yOffset; - this.disposalMethod = source.disposalMethod; - this.delayCentisecs = source.delayCentisecs; - this.interlaced = source.interlaced; - } - else { - const lastArg = args[args.length - 1]; - let options = {}; - if (typeof lastArg === 'object' && !(lastArg instanceof BitmapImage)) { - options = lastArg; - } - this.xOffset = options.xOffset || 0; - this.yOffset = options.yOffset || 0; - this.disposalMethod = (options.disposalMethod !== undefined ? - options.disposalMethod : GifFrame.DisposeToBackgroundColor); - this.delayCentisecs = options.delayCentisecs || 8; - this.interlaced = options.interlaced || false; - } - } - - /** - * Get a summary of the colors found within the frame. The return value is an object of the following form: - * - * Property | Description - * --- | --- - * colors | An array of all the opaque colors found within the frame. Each color is given as an RGB number of the form 0xRRGGBB. The array is sorted by increasing number. Will be an empty array when the image is completely transparent. - * usesTransparency | boolean indicating whether there are any transparent pixels within the frame. A pixel is considered transparent if its alpha value is 0x00. - * indexCount | The number of color indexes required to represent this palette of colors. It is equal to the number of opaque colors plus one if the image includes transparency. - * - * @return {object} An object representing a color palette as described above. - */ - - getPalette() { - // returns with colors sorted low to high - const colorSet = new Set(); - const buf = this.bitmap.data; - let i = 0; - let usesTransparency = false; - while (i < buf.length) { - if (buf[i + 3] === 0) { - usesTransparency = true; - } - else { - // can eliminate the bitshift by starting one byte prior - const color = (buf.readUInt32BE(i, true) >> 8) & 0xFFFFFF; - colorSet.add(color); - } - i += 4; // skip alpha - } - const colors = new Array(colorSet.size); - const iter = colorSet.values(); - for (i = 0; i < colors.length; ++i) { - colors[i] = iter.next().value; - } - colors.sort((a, b) => (a - b)); - let indexCount = colors.length; - if (usesTransparency) { - ++indexCount; - } - return { colors, usesTransparency, indexCount }; - } -} - -GifFrame.DisposeToAnything = 0; -GifFrame.DisposeNothing = 1; -GifFrame.DisposeToBackgroundColor = 2; -GifFrame.DisposeToPrevious = 3; - -exports.GifFrame = GifFrame; - -},{"./bitmapimage":65,"./gif":66}],69:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -/** @namespace GifUtil */ - -const fs = require('fs'); -const ImageQ = require('image-q'); - -const BitmapImage = require('./bitmapimage'); -const { GifFrame } = require('./gifframe'); -const { GifError } = require('./gif'); -const { GifCodec } = require('./gifcodec'); - -const INVALID_SUFFIXES = ['.jpg', '.jpeg', '.png', '.bmp']; - -const defaultCodec = new GifCodec(); - -/** - * cloneFrames() clones provided frames. It's a utility method for cloning an entire array of frames at once. - * - * @function cloneFrames - * @memberof GifUtil - * @param {GifFrame[]} frames An array of GifFrame instances to clone - * @return {GifFrame[]} An array of GifFrame clones of the provided frames. - */ - -exports.cloneFrames = function (frames) { - let clones = []; - frames.forEach(frame => { - - clones.push(new GifFrame(frame)); - }); - return clones; -} - -/** - * getColorInfo() gets information about the colors used in the provided frames. The method is able to return an array of all colors found across all frames. - * - * `maxGlobalIndex` controls whether the computation short-circuits to avoid doing work that the caller doesn't need. The method only returns `colors` and `indexCount` for the colors across all frames when the number of indexes required to store the colors and transparency in a GIF (which is the value of `indexCount`) is less than or equal to `maxGlobalIndex`. Such short-circuiting is useful when the caller just needs to determine whether any frame includes transparency. - * - * @function getColorInfo - * @memberof GifUtil - * @param {GifFrame[]} frames Frames to examine for color and transparency. - * @param {number} maxGlobalIndex Maximum number of color indexes (including one for transparency) allowed among the returned compilation of colors. `colors` and `indexCount` are not returned if the number of color indexes required to accommodate all frames exceeds this number. Returns `colors` and `indexCount` by default. - * @returns {object} Object containing at least `palettes` and `usesTransparency`. `palettes` is an array of all the palettes returned by GifFrame#getPalette(). `usesTransparency` indicates whether at least one frame uses transparency. If `maxGlobalIndex` is not exceeded, the object also contains `colors`, an array of all colors (RGB) found across all palettes, sorted by increasing value, and `indexCount` indicating the number of indexes required to store the colors and the transparency in a GIF. - * @throws {GifError} When any frame requires more than 256 color indexes. - */ - -exports.getColorInfo = function (frames, maxGlobalIndex) { - let usesTransparency = false; - const palettes = []; - for (let i = 0; i < frames.length; ++i) { - let palette = frames[i].getPalette(); - if (palette.usesTransparency) { - usesTransparency = true; - } - if (palette.indexCount > 256) { - throw new GifError(`Frame ${i} uses more than 256 color indexes`); - } - palettes.push(palette); - } - if (maxGlobalIndex === 0) { - return { usesTransparency, palettes }; - } - - const globalColorSet = new Set(); - palettes.forEach(palette => { - - palette.colors.forEach(color => { - - globalColorSet.add(color); - }); - }); - let indexCount = globalColorSet.size; - if (usesTransparency) { - // odd that GIF requires a color table entry at transparent index - ++indexCount; - } - if (maxGlobalIndex && indexCount > maxGlobalIndex) { - return { usesTransparency, palettes }; - } - - const colors = new Array(globalColorSet.size); - const iter = globalColorSet.values(); - for (let i = 0; i < colors.length; ++i) { - colors[i] = iter.next().value; - } - colors.sort((a, b) => (a - b)); - return { colors, indexCount, usesTransparency, palettes }; -}; - -/** - * copyAsJimp() returns a Jimp that contains a copy of the provided bitmap image (which may be either a BitmapImage or a GifFrame). Modifying the Jimp does not affect the provided bitmap image. This method serves as a macro for simplifying working with Jimp. - * - * @function copyAsJimp - * @memberof GifUtil - * @param {object} Reference to the Jimp package, keeping this library from being dependent on Jimp. - * @param {bitmapImageToCopy} Instance of BitmapImage (may be a GifUtil) with which to source the Jimp. - * @return {object} An new instance of Jimp containing a copy of the image in bitmapImageToCopy. - */ - -exports.copyAsJimp = function (jimp, bitmapImageToCopy) { - return exports.shareAsJimp(jimp, new BitmapImage(bitmapImageToCopy)); -}; - -/** - * getMaxDimensions() returns the pixel width and height required to accommodate all of the provided frames, according to the offsets and dimensions of each frame. - * - * @function getMaxDimensions - * @memberof GifUtil - * @param {GifFrame[]} frames Frames to measure for their aggregate maximum dimensions. - * @return {object} An object of the form {maxWidth, maxHeight} indicating the maximum width and height required to accommodate all frames. - */ - -exports.getMaxDimensions = function (frames) { - let maxWidth = 0, maxHeight = 0; - frames.forEach(frame => { - const width = frame.xOffset + frame.bitmap.width; - if (width > maxWidth) { - maxWidth = width; - } - const height = frame.yOffset + frame.bitmap.height; - if (height > maxHeight) { - maxHeight = height; - } - }); - return { maxWidth, maxHeight }; -}; - -/** - * Quantizes colors so that there are at most a given number of color indexes (including transparency) across all provided images. Uses an algorithm by Anthony Dekker. - * - * The method treats different RGBA combinations as different colors, so if the frame has multiple alpha values or multiple RGB values for an alpha value, the caller may first want to normalize them by converting all transparent pixels to the same RGBA values. - * - * The method may increase the number of colors if there are fewer than the provided maximum. - * - * @function quantizeDekker - * @memberof GifUtil - * @param {BitmapImage|BitmapImage[]} imageOrImages Image or array of images (such as GifFrame instances) to be color-quantized. Quantizing across multiple images ensures color consistency from frame to frame. - * @param {number} maxColorIndexes The maximum number of color indexes that will exist in the palette after completing quantization. Defaults to 256. - * @param {object} dither (optional) An object configuring the dithering to apply. The properties are as followings, imported from the [`image-q` package](https://github.com/ibezkrovnyi/image-quantization) without explanation: { `ditherAlgorithm`: One of 'FloydSteinberg', 'FalseFloydSteinberg', 'Stucki', 'Atkinson', 'Jarvis', 'Burkes', 'Sierra', 'TwoSierra', 'SierraLite'; `minimumColorDistanceToDither`: (optional) A number defaulting to 0; `serpentine`: (optional) A boolean defaulting to true; `calculateErrorLikeGIMP`: (optional) A boolean defaulting to false. } - */ - -exports.quantizeDekker = function (imageOrImages, maxColorIndexes, dither) { - maxColorIndexes = maxColorIndexes || 256; - _quantize(imageOrImages, 'NeuQuantFloat', maxColorIndexes, 0, dither); -} - -/** - * Quantizes colors so that there are at most a given number of color indexes (including transparency) across all provided images. Uses an algorithm by Leon Sorokin. This quantization method differs from the other two by likely never increasing the number of colors, should there be fewer than the provided maximum. - * - * The method treats different RGBA combinations as different colors, so if the frame has multiple alpha values or multiple RGB values for an alpha value, the caller may first want to normalize them by converting all transparent pixels to the same RGBA values. - * - * @function quantizeSorokin - * @memberof GifUtil - * @param {BitmapImage|BitmapImage[]} imageOrImages Image or array of images (such as GifFrame instances) to be color-quantized. Quantizing across multiple images ensures color consistency from frame to frame. - * @param {number} maxColorIndexes The maximum number of color indexes that will exist in the palette after completing quantization. Defaults to 256. - * @param {string} histogram (optional) Histogram method: 'top-pop' for global top-population, 'min-pop' for minimum-population threshhold within subregions. Defaults to 'min-pop'. - * @param {object} dither (optional) An object configuring the dithering to apply, as explained for `quantizeDekker()`. - */ - -exports.quantizeSorokin = function (imageOrImages, maxColorIndexes, histogram, dither) { - maxColorIndexes = maxColorIndexes || 256; - histogram = histogram || 'min-pop'; - let histogramID; - switch (histogram) { - case 'min-pop': - histogramID = 2; - break; - - case 'top-pop': - histogramID = 1; - break - - default: - throw new Error(`Invalid quantizeSorokin histogram '${histogram}'`); - } - _quantize(imageOrImages, 'RGBQuant', maxColorIndexes, histogramID, dither); -} - -/** - * Quantizes colors so that there are at most a given number of color indexes (including transparency) across all provided images. Uses an algorithm by Xiaolin Wu. - * - * The method treats different RGBA combinations as different colors, so if the frame has multiple alpha values or multiple RGB values for an alpha value, the caller may first want to normalize them by converting all transparent pixels to the same RGBA values. - * - * The method may increase the number of colors if there are fewer than the provided maximum. - * - * @function quantizeWu - * @memberof GifUtil - * @param {BitmapImage|BitmapImage[]} imageOrImages Image or array of images (such as GifFrame instances) to be color-quantized. Quantizing across multiple images ensures color consistency from frame to frame. - * @param {number} maxColorIndexes The maximum number of color indexes that will exist in the palette after completing quantization. Defaults to 256. - * @param {number} significantBits (optional) This is the number of significant high bits in each RGB color channel. Takes integer values from 1 through 8. Higher values correspond to higher quality. Defaults to 5. - * @param {object} dither (optional) An object configuring the dithering to apply, as explained for `quantizeDekker()`. - */ - -exports.quantizeWu = function (imageOrImages, maxColorIndexes, significantBits, dither) { - maxColorIndexes = maxColorIndexes || 256; - significantBits = significantBits || 5; - if (significantBits < 1 || significantBits > 8) { - throw new Error("Invalid quantization quality"); - } - _quantize(imageOrImages, 'WuQuant', maxColorIndexes, significantBits, dither); -} - -/** - * read() decodes an encoded GIF, whether provided as a filename or as a byte buffer. - * - * @function read - * @memberof GifUtil - * @param {string|Buffer} source Source to decode. When a string, it's the GIF filename to load and parse. When a Buffer, it's an encoded GIF to parse. - * @param {object} decoder An optional GIF decoder object implementing the `decode` method of class GifCodec. When provided, the method decodes the GIF using this decoder. When not provided, the method uses GifCodec. - * @return {Promise} A Promise that resolves to an instance of the Gif class, representing the decoded GIF. - */ - -exports.read = function (source, decoder) { - decoder = decoder || defaultCodec; - if (Buffer.isBuffer(source)) { - return decoder.decodeGif(source); - } - return _readBinary(source) - .then(buffer => { - - return decoder.decodeGif(buffer); - }); -}; - -/** - * shareAsJimp() returns a Jimp that shares a bitmap with the provided bitmap image (which may be either a BitmapImage or a GifFrame). Modifying the image in either the Jimp or the BitmapImage affects the other objects. This method serves as a macro for simplifying working with Jimp. - * - * @function shareAsJimp - * @memberof GifUtil - * @param {object} Reference to the Jimp package, keeping this library from being dependent on Jimp. - * @param {bitmapImageToShare} Instance of BitmapImage (may be a GifUtil) with which to source the Jimp. - * @return {object} An new instance of Jimp that shares the image in bitmapImageToShare. - */ - -exports.shareAsJimp = function (jimp, bitmapImageToShare) { - const jimpImage = new jimp(bitmapImageToShare.bitmap.width, - bitmapImageToShare.bitmap.height, 0); - jimpImage.bitmap.data = bitmapImageToShare.bitmap.data; - return jimpImage; -}; - -/** - * write() encodes a GIF and saves it as a file. - * - * @function write - * @memberof GifUtil - * @param {string} path Filename to write GIF out as. Will overwrite an existing file. - * @param {GifFrame[]} frames Array of frames to be written into GIF. - * @param {object} spec An optional object that may provide values for `loops` and `colorScope`, as defined for the Gif class. However, `colorSpace` may also take the value Gif.GlobalColorsPreferred (== 0) to indicate that the encoder should attempt to create only a global color table. `loop` defaults to 0, looping indefinitely, and `colorScope` defaults to Gif.GlobalColorsPreferred. - * @param {object} encoder An optional GIF encoder object implementing the `encode` method of class GifCodec. When provided, the method encodes the GIF using this encoder. When not provided, the method uses GifCodec. - * @return {Promise} A Promise that resolves to an instance of the Gif class, representing the encoded GIF. - */ - -exports.write = function (path, frames, spec, encoder) { - encoder = encoder || defaultCodec; - const matches = path.match(/\.[a-zA-Z]+$/); // prevent accidents - if (matches !== null && - INVALID_SUFFIXES.includes(matches[0].toLowerCase())) - { - throw new Error(`GIF '${path}' has an unexpected suffix`); - } - - return encoder.encodeGif(frames, spec) - .then(gif => { - - return _writeBinary(path, gif.buffer) - .then(() => { - - return gif; - }); - }); -}; - -function _quantize(imageOrImages, method, maxColorIndexes, modifier, dither) { - const images = Array.isArray(imageOrImages) ? imageOrImages : [imageOrImages]; - const ditherAlgs = [ - 'FloydSteinberg', - 'FalseFloydSteinberg', - 'Stucki', - 'Atkinson', - 'Jarvis', - 'Burkes', - 'Sierra', - 'TwoSierra', - 'SierraLite' - ]; - - if (dither) { - if (ditherAlgs.indexOf(dither.ditherAlgorithm) < 0) { - throw new Error(`Invalid ditherAlgorithm '${dither.ditherAlgorithm}'`); - } - if (dither.serpentine === undefined) { - dither.serpentine = true; - } - if (dither.minimumColorDistanceToDither === undefined) { - dither.minimumColorDistanceToDither = 0; - } - if (dither.calculateErrorLikeGIMP === undefined) { - dither.calculateErrorLikeGIMP = false; - } - } - - const distCalculator = new ImageQ.distance.Euclidean(); - const quantizer = new ImageQ.palette[method](distCalculator, maxColorIndexes, modifier); - let imageMaker; - if (dither) { - imageMaker = new ImageQ.image.ErrorDiffusionArray( - distCalculator, - ImageQ.image.ErrorDiffusionArrayKernel[dither.ditherAlgorithm], - dither.serpentine, - dither.minimumColorDistanceToDither, - dither.calculateErrorLikeGIMP - ); - } - else { - imageMaker = new ImageQ.image.NearestColor(distCalculator); - } - - const inputContainers = []; - images.forEach(image => { - - const imageBuf = image.bitmap.data; - const inputBuf = new ArrayBuffer(imageBuf.length); - const inputArray = new Uint32Array(inputBuf); - for (let bi = 0, ai = 0; bi < imageBuf.length; bi += 4, ++ai) { - inputArray[ai] = imageBuf.readUInt32LE(bi, true); - } - const inputContainer = ImageQ.utils.PointContainer.fromUint32Array( - inputArray, image.bitmap.width, image.bitmap.height); - quantizer.sample(inputContainer); - inputContainers.push(inputContainer); - }); - - const limitedPalette = quantizer.quantize(); - - for (let i = 0; i < images.length; ++i) { - const imageBuf = images[i].bitmap.data; - const outputContainer = imageMaker.quantize(inputContainers[i], limitedPalette); - const outputArray = outputContainer.toUint32Array(); - for (let bi = 0, ai = 0; bi < imageBuf.length; bi += 4, ++ai) { - imageBuf.writeUInt32LE(outputArray[ai], bi); - } - } -} - -function _readBinary(path) { - // TBD: add support for URLs - return new Promise((resolve, reject) => { - - fs.readFile(path, (err, buffer) => { - - if (err) { - return reject(err); - } - return resolve(buffer); - }); - }); -} - -function _writeBinary(path, buffer) { - // TBD: add support for URLs - return new Promise((resolve, reject) => { - - fs.writeFile(path, buffer, err => { - - if (err) { - return reject(err); - } - return resolve(); - }); - }); -} - -}).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":76,"./bitmapimage":65,"./gif":66,"./gifcodec":67,"./gifframe":68,"fs":47,"image-q":74}],70:[function(require,module,exports){ -'use strict'; - -const BitmapImage = require('./bitmapimage'); -const { Gif, GifError } = require('./gif'); -const { GifCodec } = require('./gifcodec'); -const { GifFrame } = require('./gifframe'); -const GifUtil = require('./gifutil'); - -module.exports = { - BitmapImage, - Gif, - GifCodec, - GifFrame, - GifUtil, - GifError -}; - -},{"./bitmapimage":65,"./gif":66,"./gifcodec":67,"./gifframe":68,"./gifutil":69}],71:[function(require,module,exports){ -(function (global){ -var win; - -if (typeof window !== "undefined") { - win = window; -} else if (typeof global !== "undefined") { - win = global; -} else if (typeof self !== "undefined"){ - win = self; -} else { - win = {}; -} - -module.exports = win; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],72:[function(require,module,exports){ -var http = require('http') -var url = require('url') - -var https = module.exports - -for (var key in http) { - if (http.hasOwnProperty(key)) https[key] = http[key] -} - -https.request = function (params, cb) { - params = validateParams(params) - return http.request.call(this, params, cb) -} - -https.get = function (params, cb) { - params = validateParams(params) - return http.get.call(this, params, cb) -} - -function validateParams (params) { - if (typeof params === 'string') { - params = url.parse(params) - } - if (!params.protocol) { - params.protocol = 'https:' - } - if (params.protocol !== 'https:') { - throw new Error('Protocol "' + params.protocol + '" not supported. Expected "https:"') - } - return params -} - -},{"http":156,"url":180}],73:[function(require,module,exports){ -exports.read = function (buffer, offset, isLE, mLen, nBytes) { - var e, m - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var nBits = -7 - var i = isLE ? (nBytes - 1) : 0 - var d = isLE ? -1 : 1 - var s = buffer[offset + i] - - i += d - - e = s & ((1 << (-nBits)) - 1) - s >>= (-nBits) - nBits += eLen - for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} - - m = e & ((1 << (-nBits)) - 1) - e >>= (-nBits) - nBits += mLen - for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} - - if (e === 0) { - e = 1 - eBias - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity) - } else { - m = m + Math.pow(2, mLen) - e = e - eBias - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen) -} - -exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) - var i = isLE ? 0 : (nBytes - 1) - var d = isLE ? 1 : -1 - var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 - - value = Math.abs(value) - - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0 - e = eMax - } else { - e = Math.floor(Math.log(value) / Math.LN2) - if (value * (c = Math.pow(2, -e)) < 1) { - e-- - c *= 2 - } - if (e + eBias >= 1) { - value += rt / c - } else { - value += rt * Math.pow(2, 1 - eBias) - } - if (value * c >= 2) { - e++ - c /= 2 - } - - if (e + eBias >= eMax) { - m = 0 - e = eMax - } else if (e + eBias >= 1) { - m = ((value * c) - 1) * Math.pow(2, mLen) - e = e + eBias - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) - e = 0 - } - } - - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} - - e = (e << mLen) | m - eLen += mLen - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} - - buffer[offset + i - d] |= s * 128 -} - -},{}],74:[function(require,module,exports){ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define("iq", [], factory); - else if(typeof exports === 'object') - exports["iq"] = factory(); - else - root["iq"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; -/******/ -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.loaded = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * iq.ts - Image Quantization Library - */ - var constants = __webpack_require__(1); - exports.constants = constants; - var conversion = __webpack_require__(3); - exports.conversion = conversion; - var distance = __webpack_require__(12); - exports.distance = distance; - var palette = __webpack_require__(20); - exports.palette = palette; - var image = __webpack_require__(30); - exports.image = image; - var quality = __webpack_require__(35); - exports.quality = quality; - var utils = __webpack_require__(37); - exports.utils = utils; - - -/***/ }, -/* 1 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * constants.ts - part of Image Quantization Library - */ - var bt709 = __webpack_require__(2); - exports.bt709 = bt709; - - -/***/ }, -/* 2 */ -/***/ function(module, exports) { - - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * constants.ts - part of Image Quantization Library - */ - "use strict"; - /** - * sRGB (based on ITU-R Recommendation BT.709) - * http://en.wikipedia.org/wiki/SRGB - */ - var Y; - (function (Y) { - Y[Y["RED"] = 0.2126] = "RED"; - Y[Y["GREEN"] = 0.7152] = "GREEN"; - Y[Y["BLUE"] = 0.0722] = "BLUE"; - Y[Y["WHITE"] = 1] = "WHITE"; - })(Y || (Y = {})); - exports.Y = Y; - var x; - (function (x) { - x[x["RED"] = 0.64] = "RED"; - x[x["GREEN"] = 0.3] = "GREEN"; - x[x["BLUE"] = 0.15] = "BLUE"; - x[x["WHITE"] = 0.3127] = "WHITE"; - })(x || (x = {})); - exports.x = x; - var y; - (function (y) { - y[y["RED"] = 0.33] = "RED"; - y[y["GREEN"] = 0.6] = "GREEN"; - y[y["BLUE"] = 0.06] = "BLUE"; - y[y["WHITE"] = 0.329] = "WHITE"; - })(y || (y = {})); - exports.y = y; - - -/***/ }, -/* 3 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * iq.ts - Image Quantization Library - */ - var rgb2xyz_1 = __webpack_require__(4); - exports.rgb2xyz = rgb2xyz_1.rgb2xyz; - var rgb2hsl_1 = __webpack_require__(5); - exports.rgb2hsl = rgb2hsl_1.rgb2hsl; - var rgb2lab_1 = __webpack_require__(7); - exports.rgb2lab = rgb2lab_1.rgb2lab; - var lab2xyz_1 = __webpack_require__(9); - exports.lab2xyz = lab2xyz_1.lab2xyz; - var lab2rgb_1 = __webpack_require__(10); - exports.lab2rgb = lab2rgb_1.lab2rgb; - var xyz2lab_1 = __webpack_require__(8); - exports.xyz2lab = xyz2lab_1.xyz2lab; - var xyz2rgb_1 = __webpack_require__(11); - exports.xyz2rgb = xyz2rgb_1.xyz2rgb; - - -/***/ }, -/* 4 */ -/***/ function(module, exports) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * rgb2xyz.ts - part of Image Quantization Library - */ - function correctGamma(n) { - return n > 0.04045 ? Math.pow((n + 0.055) / 1.055, 2.4) : n / 12.92; - } - function rgb2xyz(r, g, b) { - // gamma correction, see https://en.wikipedia.org/wiki/SRGB#The_reverse_transformation - r = correctGamma(r / 255); - g = correctGamma(g / 255); - b = correctGamma(b / 255); - // Observer. = 2°, Illuminant = D65 - return { - x: r * 0.4124 + g * 0.3576 + b * 0.1805, - y: r * 0.2126 + g * 0.7152 + b * 0.0722, - z: r * 0.0193 + g * 0.1192 + b * 0.9505 - }; - } - exports.rgb2xyz = rgb2xyz; - - -/***/ }, -/* 5 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * rgb2hsl.ts - part of Image Quantization Library - */ - var arithmetic_1 = __webpack_require__(6); - /** - * Calculate HSL from RGB - * Hue is in degrees [0..360] - * Lightness: [0..1] - * Saturation: [0..1] - * http://web.archive.org/web/20060914040436/http://local.wasp.uwa.edu.au/~pbourke/colour/hsl/ - */ - function rgb2hsl(r, g, b) { - var min = arithmetic_1.min3(r, g, b), max = arithmetic_1.max3(r, g, b), delta = max - min, l = (min + max) / 510; - var s = 0; - if (l > 0 && l < 1) - s = delta / (l < 0.5 ? (max + min) : (510 - max - min)); - var h = 0; - if (delta > 0) { - if (max === r) { - h = (g - b) / delta; - } - else if (max === g) { - h = (2 + (b - r) / delta); - } - else { - h = (4 + (r - g) / delta); - } - h *= 60; - if (h < 0) - h += 360; - } - return { h: h, s: s, l: l }; - } - exports.rgb2hsl = rgb2hsl; - - -/***/ }, -/* 6 */ -/***/ function(module, exports) { - - "use strict"; - function degrees2radians(n) { - return n * (Math.PI / 180); - } - exports.degrees2radians = degrees2radians; - function max3(a, b, c) { - var m = a; - (m < b) && (m = b); - (m < c) && (m = c); - return m; - } - exports.max3 = max3; - function min3(a, b, c) { - var m = a; - (m > b) && (m = b); - (m > c) && (m = c); - return m; - } - exports.min3 = min3; - function intInRange(value, low, high) { - if (value > high) - value = high; - if (value < low) - value = low; - return value | 0; - } - exports.intInRange = intInRange; - function inRange0to255Rounded(n) { - n = Math.round(n); - if (n > 255) - n = 255; - else if (n < 0) - n = 0; - return n; - } - exports.inRange0to255Rounded = inRange0to255Rounded; - function inRange0to255(n) { - if (n > 255) - n = 255; - else if (n < 0) - n = 0; - return n; - } - exports.inRange0to255 = inRange0to255; - function stableSort(arrayToSort, callback) { - var type = typeof arrayToSort[0]; - var sorted; - if (type === "number" || type === "string") { - var ord_1 = Object.create(null); - for (var i = 0, l = arrayToSort.length; i < l; i++) { - var val = arrayToSort[i]; - if (ord_1[val] || ord_1[val] === 0) - continue; - ord_1[val] = i; - } - sorted = arrayToSort.sort(function (a, b) { - return callback(a, b) || ord_1[a] - ord_1[b]; - }); - } - else { - var ord2_1 = arrayToSort.slice(0); - sorted = arrayToSort.sort(function (a, b) { - return callback(a, b) || ord2_1.indexOf(a) - ord2_1.indexOf(b); - }); - } - return sorted; - } - exports.stableSort = stableSort; - - -/***/ }, -/* 7 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * rgb2lab.ts - part of Image Quantization Library - */ - var rgb2xyz_1 = __webpack_require__(4); - var xyz2lab_1 = __webpack_require__(8); - function rgb2lab(r, g, b) { - var xyz = rgb2xyz_1.rgb2xyz(r, g, b); - return xyz2lab_1.xyz2lab(xyz.x, xyz.y, xyz.z); - } - exports.rgb2lab = rgb2lab; - - -/***/ }, -/* 8 */ -/***/ function(module, exports) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * xyz2lab.ts - part of Image Quantization Library - */ - var refX = 0.95047, //ref_X = 95.047 Observer= 2°, Illuminant= D65 - refY = 1.00000, //ref_Y = 100.000 - refZ = 1.08883; //ref_Z = 108.883 - function pivot(n) { - return n > 0.008856 ? Math.pow(n, 1 / 3) : (7.787 * n + 16 / 116); - } - function xyz2lab(x, y, z) { - x = pivot(x / refX); - y = pivot(y / refY); - z = pivot(z / refZ); - if ((116 * y) - 16 < 0) - throw new Error("xxx"); - return { - L: Math.max(0, (116 * y) - 16), - a: 500 * (x - y), - b: 200 * (y - z) - }; - } - exports.xyz2lab = xyz2lab; - - -/***/ }, -/* 9 */ -/***/ function(module, exports) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * lab2xyz.ts - part of Image Quantization Library - */ - var refX = 0.95047, //ref_X = 95.047 Observer= 2°, Illuminant = D65 - refY = 1.00000, //ref_Y = 100.000 - refZ = 1.08883; //ref_Z = 108.883 - function pivot(n) { - return n > 0.206893034 ? Math.pow(n, 3) : (n - 16 / 116) / 7.787; - } - function lab2xyz(L, a, b) { - var y = (L + 16) / 116, x = a / 500 + y, z = y - b / 200; - return { - x: refX * pivot(x), - y: refY * pivot(y), - z: refZ * pivot(z) - }; - } - exports.lab2xyz = lab2xyz; - - -/***/ }, -/* 10 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * lab2rgb.ts - part of Image Quantization Library - */ - var lab2xyz_1 = __webpack_require__(9); - var xyz2rgb_1 = __webpack_require__(11); - function lab2rgb(L, a, b) { - var xyz = lab2xyz_1.lab2xyz(L, a, b); - return xyz2rgb_1.xyz2rgb(xyz.x, xyz.y, xyz.z); - } - exports.lab2rgb = lab2rgb; - - -/***/ }, -/* 11 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * xyz2rgb.ts - part of Image Quantization Library - */ - var arithmetic_1 = __webpack_require__(6); - // gamma correction, see https://en.wikipedia.org/wiki/SRGB#The_reverse_transformation - function correctGamma(n) { - return n > 0.0031308 ? 1.055 * Math.pow(n, 1 / 2.4) - 0.055 : 12.92 * n; - } - function xyz2rgb(x, y, z) { - // Observer. = 2°, Illuminant = D65 - var r = correctGamma(x * 3.2406 + y * -1.5372 + z * -0.4986), g = correctGamma(x * -0.9689 + y * 1.8758 + z * 0.0415), b = correctGamma(x * 0.0557 + y * -0.2040 + z * 1.0570); - return { - r: arithmetic_1.inRange0to255Rounded(r * 255), - g: arithmetic_1.inRange0to255Rounded(g * 255), - b: arithmetic_1.inRange0to255Rounded(b * 255) - }; - } - exports.xyz2rgb = xyz2rgb; - - -/***/ }, -/* 12 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * iq.ts - Image Quantization Library - */ - var abstractDistanceCalculator_1 = __webpack_require__(13); - exports.AbstractDistanceCalculator = abstractDistanceCalculator_1.AbstractDistanceCalculator; - var cie94_1 = __webpack_require__(14); - exports.CIE94Textiles = cie94_1.CIE94Textiles; - exports.CIE94GraphicArts = cie94_1.CIE94GraphicArts; - var ciede2000_1 = __webpack_require__(15); - exports.CIEDE2000 = ciede2000_1.CIEDE2000; - var cmetric_1 = __webpack_require__(16); - exports.CMETRIC = cmetric_1.CMETRIC; - var euclidean_1 = __webpack_require__(17); - exports.AbstractEuclidean = euclidean_1.AbstractEuclidean; - exports.Euclidean = euclidean_1.Euclidean; - exports.EuclideanRgbQuantWOAlpha = euclidean_1.EuclideanRgbQuantWOAlpha; - exports.EuclideanRgbQuantWithAlpha = euclidean_1.EuclideanRgbQuantWithAlpha; - var manhattan_1 = __webpack_require__(18); - exports.AbstractManhattan = manhattan_1.AbstractManhattan; - exports.Manhattan = manhattan_1.Manhattan; - exports.ManhattanSRGB = manhattan_1.ManhattanSRGB; - exports.ManhattanNommyde = manhattan_1.ManhattanNommyde; - var pngQuant_1 = __webpack_require__(19); - exports.PNGQUANT = pngQuant_1.PNGQUANT; - - -/***/ }, -/* 13 */ -/***/ function(module, exports) { - - "use strict"; - var AbstractDistanceCalculator = (function () { - function AbstractDistanceCalculator() { - this._setDefaults(); - // set default maximal color component deltas (255 - 0 = 255) - this.setWhitePoint(255, 255, 255, 255); - } - AbstractDistanceCalculator.prototype.setWhitePoint = function (r, g, b, a) { - this._whitePoint = { - r: (r > 0) ? 255 / r : 0, - g: (g > 0) ? 255 / g : 0, - b: (b > 0) ? 255 / b : 0, - a: (a > 0) ? 255 / a : 0 - }; - this._maxDistance = this.calculateRaw(r, g, b, a, 0, 0, 0, 0); - }; - AbstractDistanceCalculator.prototype.calculateNormalized = function (colorA, colorB) { - return this.calculateRaw(colorA.r, colorA.g, colorA.b, colorA.a, colorB.r, colorB.g, colorB.b, colorB.a) / this._maxDistance; - }; - AbstractDistanceCalculator.prototype._setDefaults = function () { - }; - return AbstractDistanceCalculator; - }()); - exports.AbstractDistanceCalculator = AbstractDistanceCalculator; - - -/***/ }, -/* 14 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * cie94.ts - part of Image Quantization Library - */ - var abstractDistanceCalculator_1 = __webpack_require__(13); - var rgb2lab_1 = __webpack_require__(7); - var arithmetic_1 = __webpack_require__(6); - /** - * CIE94 method of delta-e - * http://en.wikipedia.org/wiki/Color_difference#CIE94 - */ - var AbstractCIE94 = (function (_super) { - __extends(AbstractCIE94, _super); - function AbstractCIE94() { - _super.apply(this, arguments); - } - AbstractCIE94.prototype.calculateRaw = function (r1, g1, b1, a1, r2, g2, b2, a2) { - var lab1 = rgb2lab_1.rgb2lab(arithmetic_1.inRange0to255(r1 * this._whitePoint.r), arithmetic_1.inRange0to255(g1 * this._whitePoint.g), arithmetic_1.inRange0to255(b1 * this._whitePoint.b)), lab2 = rgb2lab_1.rgb2lab(arithmetic_1.inRange0to255(r2 * this._whitePoint.r), arithmetic_1.inRange0to255(g2 * this._whitePoint.g), arithmetic_1.inRange0to255(b2 * this._whitePoint.b)); - var dL = lab1.L - lab2.L, dA = lab1.a - lab2.a, dB = lab1.b - lab2.b, c1 = Math.sqrt(lab1.a * lab1.a + lab1.b * lab1.b), c2 = Math.sqrt(lab2.a * lab2.a + lab2.b * lab2.b), dC = c1 - c2; - var deltaH = dA * dA + dB * dB - dC * dC; - deltaH = deltaH < 0 ? 0 : Math.sqrt(deltaH); - var dAlpha = (a2 - a1) * this._whitePoint.a * this._kA; - // TODO: add alpha channel support - return Math.sqrt(Math.pow(dL / this._Kl, 2) + - Math.pow(dC / (1.0 + this._K1 * c1), 2) + - Math.pow(deltaH / (1.0 + this._K2 * c1), 2) + - Math.pow(dAlpha, 2)); - }; - return AbstractCIE94; - }(abstractDistanceCalculator_1.AbstractDistanceCalculator)); - exports.AbstractCIE94 = AbstractCIE94; - var CIE94Textiles = (function (_super) { - __extends(CIE94Textiles, _super); - function CIE94Textiles() { - _super.apply(this, arguments); - } - CIE94Textiles.prototype._setDefaults = function () { - this._Kl = 2.0; - this._K1 = 0.048; - this._K2 = 0.014; - this._kA = 0.25 * 50 / 255; - }; - return CIE94Textiles; - }(AbstractCIE94)); - exports.CIE94Textiles = CIE94Textiles; - var CIE94GraphicArts = (function (_super) { - __extends(CIE94GraphicArts, _super); - function CIE94GraphicArts() { - _super.apply(this, arguments); - } - CIE94GraphicArts.prototype._setDefaults = function () { - this._Kl = 1.0; - this._K1 = 0.045; - this._K2 = 0.015; - this._kA = 0.25 * 100 / 255; - }; - return CIE94GraphicArts; - }(AbstractCIE94)); - exports.CIE94GraphicArts = CIE94GraphicArts; - - -/***/ }, -/* 15 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * ciede2000.ts - part of Image Quantization Library - */ - var abstractDistanceCalculator_1 = __webpack_require__(13); - var rgb2lab_1 = __webpack_require__(7); - var arithmetic_1 = __webpack_require__(6); - /** - * CIEDE2000 algorithm - Adapted from Sharma et al's MATLAB implementation at - * http://www.ece.rochester.edu/~gsharma/ciede2000/ - */ - var CIEDE2000 = (function (_super) { - __extends(CIEDE2000, _super); - function CIEDE2000() { - _super.apply(this, arguments); - } - CIEDE2000.prototype.calculateRaw = function (r1, g1, b1, a1, r2, g2, b2, a2) { - var lab1 = rgb2lab_1.rgb2lab(arithmetic_1.inRange0to255(r1 * this._whitePoint.r), arithmetic_1.inRange0to255(g1 * this._whitePoint.g), arithmetic_1.inRange0to255(b1 * this._whitePoint.b)), lab2 = rgb2lab_1.rgb2lab(arithmetic_1.inRange0to255(r2 * this._whitePoint.r), arithmetic_1.inRange0to255(g2 * this._whitePoint.g), arithmetic_1.inRange0to255(b2 * this._whitePoint.b)), dA = (a2 - a1) * this._whitePoint.a * CIEDE2000._kA, dE2 = this.calculateRawInLab(lab1, lab2); - return Math.sqrt(dE2 + dA * dA); - }; - CIEDE2000.prototype.calculateRawInLab = function (Lab1, Lab2) { - // Get L,a,b values for color 1 - var L1 = Lab1.L, a1 = Lab1.a, b1 = Lab1.b; - // Get L,a,b values for color 2 - var L2 = Lab2.L, a2 = Lab2.a, b2 = Lab2.b; - // Calculate Cprime1, Cprime2, Cabbar - var C1 = Math.sqrt(a1 * a1 + b1 * b1), C2 = Math.sqrt(a2 * a2 + b2 * b2), pow_a_C1_C2_to_7 = Math.pow((C1 + C2) / 2.0, 7.0), G = 0.5 * (1.0 - Math.sqrt(pow_a_C1_C2_to_7 / (pow_a_C1_C2_to_7 + CIEDE2000._pow25to7))), //25^7 - a1p = (1.0 + G) * a1, a2p = (1.0 + G) * a2, C1p = Math.sqrt(a1p * a1p + b1 * b1), C2p = Math.sqrt(a2p * a2p + b2 * b2), C1pC2p = C1p * C2p, - // Angles in Degree. - h1p = CIEDE2000._calculatehp(b1, a1p), h2p = CIEDE2000._calculatehp(b2, a2p), h_bar = Math.abs(h1p - h2p), dLp = L2 - L1, dCp = C2p - C1p, dHp = CIEDE2000._calculate_dHp(C1pC2p, h_bar, h2p, h1p), ahp = CIEDE2000._calculate_ahp(C1pC2p, h_bar, h1p, h2p), T = CIEDE2000._calculateT(ahp), aCp = (C1p + C2p) / 2.0, aLp_minus_50_square = Math.pow((L1 + L2) / 2.0 - 50.0, 2.0), S_L = 1.0 + (.015 * aLp_minus_50_square) / Math.sqrt(20.0 + aLp_minus_50_square), S_C = 1.0 + .045 * aCp, S_H = 1.0 + .015 * T * aCp, R_T = CIEDE2000._calculateRT(ahp, aCp), dLpSL = dLp / S_L, // S_L * kL, where kL is 1.0 - dCpSC = dCp / S_C, // S_C * kC, where kC is 1.0 - dHpSH = dHp / S_H; // S_H * kH, where kH is 1.0 - return Math.pow(dLpSL, 2) + Math.pow(dCpSC, 2) + Math.pow(dHpSH, 2) + R_T * dCpSC * dHpSH; - }; - CIEDE2000._calculatehp = function (b, ap) { - var hp = Math.atan2(b, ap); - if (hp >= 0) - return hp; - return hp + CIEDE2000._deg360InRad; - }; - CIEDE2000._calculateRT = function (ahp, aCp) { - var aCp_to_7 = Math.pow(aCp, 7.0), R_C = 2.0 * Math.sqrt(aCp_to_7 / (aCp_to_7 + CIEDE2000._pow25to7)), // 25^7 - delta_theta = CIEDE2000._deg30InRad * Math.exp(-Math.pow((ahp - CIEDE2000._deg275InRad) / CIEDE2000._deg25InRad, 2.0)); - return -Math.sin(2.0 * delta_theta) * R_C; - }; - CIEDE2000._calculateT = function (ahp) { - return 1.0 - .17 * Math.cos(ahp - CIEDE2000._deg30InRad) + .24 * Math.cos(ahp * 2.0) + .32 * Math.cos(ahp * 3.0 + CIEDE2000._deg6InRad) - .2 * Math.cos(ahp * 4.0 - CIEDE2000._deg63InRad); - }; - CIEDE2000._calculate_ahp = function (C1pC2p, h_bar, h1p, h2p) { - var hpSum = h1p + h2p; - if (C1pC2p == 0) - return hpSum; - if (h_bar <= CIEDE2000._deg180InRad) - return hpSum / 2.0; - if (hpSum < CIEDE2000._deg360InRad) - return (hpSum + CIEDE2000._deg360InRad) / 2.0; - return (hpSum - CIEDE2000._deg360InRad) / 2.0; - }; - CIEDE2000._calculate_dHp = function (C1pC2p, h_bar, h2p, h1p) { - var dhp; - if (C1pC2p == 0) { - dhp = 0; - } - else if (h_bar <= CIEDE2000._deg180InRad) { - dhp = h2p - h1p; - } - else if (h2p <= h1p) { - dhp = h2p - h1p + CIEDE2000._deg360InRad; - } - else { - dhp = h2p - h1p - CIEDE2000._deg360InRad; - } - return 2.0 * Math.sqrt(C1pC2p) * Math.sin(dhp / 2.0); - }; - /** - * Weight in distance: 0.25 - * Max DeltaE: 100 - * Max DeltaA: 255 - */ - CIEDE2000._kA = 0.25 * 100 / 255; - CIEDE2000._pow25to7 = Math.pow(25, 7); - CIEDE2000._deg360InRad = arithmetic_1.degrees2radians(360); - CIEDE2000._deg180InRad = arithmetic_1.degrees2radians(180); - CIEDE2000._deg30InRad = arithmetic_1.degrees2radians(30); - CIEDE2000._deg6InRad = arithmetic_1.degrees2radians(6); - CIEDE2000._deg63InRad = arithmetic_1.degrees2radians(63); - CIEDE2000._deg275InRad = arithmetic_1.degrees2radians(275); - CIEDE2000._deg25InRad = arithmetic_1.degrees2radians(25); - return CIEDE2000; - }(abstractDistanceCalculator_1.AbstractDistanceCalculator)); - exports.CIEDE2000 = CIEDE2000; - - -/***/ }, -/* 16 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * cmetric.ts - part of Image Quantization Library - */ - var abstractDistanceCalculator_1 = __webpack_require__(13); - /** - * TODO: Name it: http://www.compuphase.com/cmetric.htm - */ - var CMETRIC = (function (_super) { - __extends(CMETRIC, _super); - function CMETRIC() { - _super.apply(this, arguments); - } - CMETRIC.prototype.calculateRaw = function (r1, g1, b1, a1, r2, g2, b2, a2) { - var rmean = (r1 + r2) / 2 * this._whitePoint.r, r = (r1 - r2) * this._whitePoint.r, g = (g1 - g2) * this._whitePoint.g, b = (b1 - b2) * this._whitePoint.b, dE = ((((512 + rmean) * r * r) >> 8) + 4 * g * g + (((767 - rmean) * b * b) >> 8)), dA = (a2 - a1) * this._whitePoint.a; - return Math.sqrt(dE + dA * dA); - }; - return CMETRIC; - }(abstractDistanceCalculator_1.AbstractDistanceCalculator)); - exports.CMETRIC = CMETRIC; - - -/***/ }, -/* 17 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * euclidean.ts - part of Image Quantization Library - */ - var abstractDistanceCalculator_1 = __webpack_require__(13); - var bt709_1 = __webpack_require__(2); - /** - * Euclidean color distance - */ - var AbstractEuclidean = (function (_super) { - __extends(AbstractEuclidean, _super); - function AbstractEuclidean() { - _super.apply(this, arguments); - } - AbstractEuclidean.prototype.calculateRaw = function (r1, g1, b1, a1, r2, g2, b2, a2) { - var dR = r2 - r1, dG = g2 - g1, dB = b2 - b1, dA = a2 - a1; - return Math.sqrt(this._kR * dR * dR + this._kG * dG * dG + this._kB * dB * dB + this._kA * dA * dA); - }; - return AbstractEuclidean; - }(abstractDistanceCalculator_1.AbstractDistanceCalculator)); - exports.AbstractEuclidean = AbstractEuclidean; - var Euclidean = (function (_super) { - __extends(Euclidean, _super); - function Euclidean() { - _super.apply(this, arguments); - } - Euclidean.prototype._setDefaults = function () { - this._kR = 1; - this._kG = 1; - this._kB = 1; - this._kA = 1; - }; - return Euclidean; - }(AbstractEuclidean)); - exports.Euclidean = Euclidean; - /** - * Euclidean color distance (RgbQuant modification w Alpha) - */ - var EuclideanRgbQuantWithAlpha = (function (_super) { - __extends(EuclideanRgbQuantWithAlpha, _super); - function EuclideanRgbQuantWithAlpha() { - _super.apply(this, arguments); - } - EuclideanRgbQuantWithAlpha.prototype._setDefaults = function () { - this._kR = bt709_1.Y.RED; - this._kG = bt709_1.Y.GREEN; - this._kB = bt709_1.Y.BLUE; - // TODO: what is the best coefficient below? - this._kA = 1; - }; - return EuclideanRgbQuantWithAlpha; - }(AbstractEuclidean)); - exports.EuclideanRgbQuantWithAlpha = EuclideanRgbQuantWithAlpha; - /** - * Euclidean color distance (RgbQuant modification w/o Alpha) - */ - var EuclideanRgbQuantWOAlpha = (function (_super) { - __extends(EuclideanRgbQuantWOAlpha, _super); - function EuclideanRgbQuantWOAlpha() { - _super.apply(this, arguments); - } - EuclideanRgbQuantWOAlpha.prototype._setDefaults = function () { - this._kR = bt709_1.Y.RED; - this._kG = bt709_1.Y.GREEN; - this._kB = bt709_1.Y.BLUE; - this._kA = 0; - }; - return EuclideanRgbQuantWOAlpha; - }(AbstractEuclidean)); - exports.EuclideanRgbQuantWOAlpha = EuclideanRgbQuantWOAlpha; - - -/***/ }, -/* 18 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * manhattanNeuQuant.ts - part of Image Quantization Library - */ - var abstractDistanceCalculator_1 = __webpack_require__(13); - var bt709_1 = __webpack_require__(2); - /** - * Manhattan distance (NeuQuant modification) - w/o sRGB coefficients - */ - var AbstractManhattan = (function (_super) { - __extends(AbstractManhattan, _super); - function AbstractManhattan() { - _super.apply(this, arguments); - } - AbstractManhattan.prototype.calculateRaw = function (r1, g1, b1, a1, r2, g2, b2, a2) { - var dR = r2 - r1, dG = g2 - g1, dB = b2 - b1, dA = a2 - a1; - if (dR < 0) - dR = 0 - dR; - if (dG < 0) - dG = 0 - dG; - if (dB < 0) - dB = 0 - dB; - if (dA < 0) - dA = 0 - dA; - return this._kR * dR + this._kG * dG + this._kB * dB + this._kA * dA; - }; - return AbstractManhattan; - }(abstractDistanceCalculator_1.AbstractDistanceCalculator)); - exports.AbstractManhattan = AbstractManhattan; - var Manhattan = (function (_super) { - __extends(Manhattan, _super); - function Manhattan() { - _super.apply(this, arguments); - } - Manhattan.prototype._setDefaults = function () { - this._kR = 1; - this._kG = 1; - this._kB = 1; - this._kA = 1; - }; - return Manhattan; - }(AbstractManhattan)); - exports.Manhattan = Manhattan; - /** - * Manhattan distance (Nommyde modification) - * https://github.com/igor-bezkrovny/image-quantization/issues/4#issuecomment-235155320 - */ - var ManhattanNommyde = (function (_super) { - __extends(ManhattanNommyde, _super); - function ManhattanNommyde() { - _super.apply(this, arguments); - } - ManhattanNommyde.prototype._setDefaults = function () { - this._kR = 0.4984; - this._kG = 0.8625; - this._kB = 0.2979; - // TODO: what is the best coefficient below? - this._kA = 1; - }; - return ManhattanNommyde; - }(AbstractManhattan)); - exports.ManhattanNommyde = ManhattanNommyde; - /** - * Manhattan distance (sRGB coefficients) - */ - var ManhattanSRGB = (function (_super) { - __extends(ManhattanSRGB, _super); - function ManhattanSRGB() { - _super.apply(this, arguments); - } - ManhattanSRGB.prototype._setDefaults = function () { - this._kR = bt709_1.Y.RED; - this._kG = bt709_1.Y.GREEN; - this._kB = bt709_1.Y.BLUE; - // TODO: what is the best coefficient below? - this._kA = 1; - }; - return ManhattanSRGB; - }(AbstractManhattan)); - exports.ManhattanSRGB = ManhattanSRGB; - - -/***/ }, -/* 19 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * pngQuant.ts - part of Image Quantization Library - */ - var abstractDistanceCalculator_1 = __webpack_require__(13); - /** - * TODO: check quality of this distance equation - * TODO: ask author for usage rights - * taken from: - * {@link http://stackoverflow.com/questions/4754506/color-similarity-distance-in-rgba-color-space/8796867#8796867} - * {@link https://github.com/pornel/pngquant/blob/cc39b47799a7ff2ef17b529f9415ff6e6b213b8f/lib/pam.h#L148} - */ - var PNGQUANT = (function (_super) { - __extends(PNGQUANT, _super); - function PNGQUANT() { - _super.apply(this, arguments); - } - /** - * Author's comments - * px_b.rgb = px.rgb + 0*(1-px.a) // blend px on black - * px_b.a = px.a + 1*(1-px.a) - * px_w.rgb = px.rgb + 1*(1-px.a) // blend px on white - * px_w.a = px.a + 1*(1-px.a) - - * px_b.rgb = px.rgb // difference same as in opaque RGB - * px_b.a = 1 - * px_w.rgb = px.rgb - px.a // difference simplifies to formula below - * px_w.a = 1 - - * (px.rgb - px.a) - (py.rgb - py.a) - * (px.rgb - py.rgb) + (py.a - px.a) - * - */ - PNGQUANT.prototype.calculateRaw = function (r1, g1, b1, a1, r2, g2, b2, a2) { - var alphas = (a2 - a1) * this._whitePoint.a; - return this._colordifference_ch(r1 * this._whitePoint.r, r2 * this._whitePoint.r, alphas) + - this._colordifference_ch(g1 * this._whitePoint.g, g2 * this._whitePoint.g, alphas) + - this._colordifference_ch(b1 * this._whitePoint.b, b2 * this._whitePoint.b, alphas); - }; - PNGQUANT.prototype._colordifference_ch = function (x, y, alphas) { - // maximum of channel blended on white, and blended on black - // premultiplied alpha and backgrounds 0/1 shorten the formula - var black = x - y, white = black + alphas; - return black * black + white * white; - }; - return PNGQUANT; - }(abstractDistanceCalculator_1.AbstractDistanceCalculator)); - exports.PNGQUANT = PNGQUANT; - - -/***/ }, -/* 20 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var neuquant_1 = __webpack_require__(21); - exports.NeuQuant = neuquant_1.NeuQuant; - var neuquantFloat_1 = __webpack_require__(25); - exports.NeuQuantFloat = neuquantFloat_1.NeuQuantFloat; - var rgbquant_1 = __webpack_require__(26); - exports.RGBQuant = rgbquant_1.RGBQuant; - var colorHistogram_1 = __webpack_require__(27); - exports.ColorHistogram = colorHistogram_1.ColorHistogram; - var wuQuant_1 = __webpack_require__(29); - exports.WuQuant = wuQuant_1.WuQuant; - exports.WuColorCube = wuQuant_1.WuColorCube; - - -/***/ }, -/* 21 */ -/***/ function(module, exports, __webpack_require__) { - - /* - * NeuQuant Neural-Net Quantization Algorithm - * ------------------------------------------ - * - * Copyright (c) 1994 Anthony Dekker - * - * NEUQUANT Neural-Net quantization algorithm by Anthony Dekker, 1994. See - * "Kohonen neural networks for optimal colour quantization" in "Network: - * Computation in Neural Systems" Vol. 5 (1994) pp 351-367. for a discussion of - * the algorithm. - * - * Any party obtaining a copy of these files from the author, directly or - * indirectly, is granted, free of charge, a full and unrestricted irrevocable, - * world-wide, paid up, royalty-free, nonexclusive right and license to deal in - * this software and documentation files (the "Software"), including without - * limitation the rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit persons who - * receive copies from any such party to do so, with the only requirement being - * that this copyright notice remain intact. - */ - "use strict"; - /** - * @preserve TypeScript port: - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * neuquant.ts - part of Image Quantization Library - */ - var palette_1 = __webpack_require__(22); - var point_1 = __webpack_require__(24); - // bias for colour values - var networkBiasShift = 3; - var Neuron = (function () { - function Neuron(defaultValue) { - this.r = this.g = this.b = this.a = defaultValue; - } - /** - * There is a fix in original NEUQUANT by Anthony Dekker (http://members.ozemail.com.au/~dekker/NEUQUANT.HTML) - * @example - * r = Math.min(255, (neuron.r + (1 << (networkBiasShift - 1))) >> networkBiasShift); - */ - Neuron.prototype.toPoint = function () { - return point_1.Point.createByRGBA(this.r >> networkBiasShift, this.g >> networkBiasShift, this.b >> networkBiasShift, this.a >> networkBiasShift); - }; - Neuron.prototype.subtract = function (r, g, b, a) { - this.r -= r | 0; - this.g -= g | 0; - this.b -= b | 0; - this.a -= a | 0; - }; - return Neuron; - }()); - var NeuQuant = (function () { - function NeuQuant(colorDistanceCalculator, colors) { - if (colors === void 0) { colors = 256; } - this._distance = colorDistanceCalculator; - this._pointArray = []; - this._sampleFactor = 1; - this._networkSize = colors; - this._distance.setWhitePoint(255 << networkBiasShift, 255 << networkBiasShift, 255 << networkBiasShift, 255 << networkBiasShift); - } - NeuQuant.prototype.sample = function (pointBuffer) { - this._pointArray = this._pointArray.concat(pointBuffer.getPointArray()); - }; - NeuQuant.prototype.quantize = function () { - this._init(); - this._learn(); - return this._buildPalette(); - }; - NeuQuant.prototype._init = function () { - this._freq = []; - this._bias = []; - this._radPower = []; - this._network = []; - for (var i = 0; i < this._networkSize; i++) { - this._network[i] = new Neuron((i << (networkBiasShift + 8)) / this._networkSize | 0); - // 1/this._networkSize - this._freq[i] = NeuQuant._initialBias / this._networkSize | 0; - this._bias[i] = 0; - } - }; - /** - * Main Learning Loop - */ - NeuQuant.prototype._learn = function () { - var sampleFactor = this._sampleFactor; - var pointsNumber = this._pointArray.length; - if (pointsNumber < NeuQuant._minpicturebytes) - sampleFactor = 1; - var alphadec = 30 + (sampleFactor - 1) / 3 | 0, pointsToSample = pointsNumber / sampleFactor | 0; - var delta = pointsToSample / NeuQuant._nCycles | 0, alpha = NeuQuant._initAlpha, radius = (this._networkSize >> 3) * NeuQuant._radiusBias; - var rad = radius >> NeuQuant._radiusBiasShift; - if (rad <= 1) - rad = 0; - for (var i = 0; i < rad; i++) { - this._radPower[i] = alpha * (((rad * rad - i * i) * NeuQuant._radBias) / (rad * rad)) >>> 0; - } - var step; - if (pointsNumber < NeuQuant._minpicturebytes) { - step = 1; - } - else if (pointsNumber % NeuQuant._prime1 != 0) { - step = NeuQuant._prime1; - } - else if ((pointsNumber % NeuQuant._prime2) != 0) { - step = NeuQuant._prime2; - } - else if ((pointsNumber % NeuQuant._prime3) != 0) { - step = NeuQuant._prime3; - } - else { - step = NeuQuant._prime4; - } - for (var i = 0, pointIndex = 0; i < pointsToSample;) { - var point = this._pointArray[pointIndex], b = point.b << networkBiasShift, g = point.g << networkBiasShift, r = point.r << networkBiasShift, a = point.a << networkBiasShift, neuronIndex = this._contest(b, g, r, a); - this._alterSingle(alpha, neuronIndex, b, g, r, a); - if (rad !== 0) - this._alterNeighbour(rad, neuronIndex, b, g, r, a); - /* alter neighbours */ - pointIndex += step; - if (pointIndex >= pointsNumber) - pointIndex -= pointsNumber; - i++; - if (delta === 0) - delta = 1; - if (i % delta === 0) { - alpha -= (alpha / alphadec) | 0; - radius -= (radius / NeuQuant._radiusDecrease) | 0; - rad = radius >> NeuQuant._radiusBiasShift; - if (rad <= 1) - rad = 0; - for (var j = 0; j < rad; j++) - this._radPower[j] = alpha * (((rad * rad - j * j) * NeuQuant._radBias) / (rad * rad)) >>> 0; - } - } - }; - NeuQuant.prototype._buildPalette = function () { - var palette = new palette_1.Palette(); - this._network.forEach(function (neuron) { - palette.add(neuron.toPoint()); - }); - palette.sort(); - return palette; - }; - /** - * Move adjacent neurons by precomputed alpha*(1-((i-j)^2/[r]^2)) in radpower[|i-j|] - */ - NeuQuant.prototype._alterNeighbour = function (rad, i, b, g, r, al) { - var lo = i - rad; - if (lo < -1) - lo = -1; - var hi = i + rad; - if (hi > this._networkSize) - hi = this._networkSize; - var j = i + 1, k = i - 1, m = 1; - while (j < hi || k > lo) { - var a = this._radPower[m++] / NeuQuant._alphaRadBias; - if (j < hi) { - var p = this._network[j++]; - p.subtract(a * (p.r - r), a * (p.g - g), a * (p.b - b), a * (p.a - al)); - } - if (k > lo) { - var p = this._network[k--]; - p.subtract(a * (p.r - r), a * (p.g - g), a * (p.b - b), a * (p.a - al)); - } - } - }; - /** - * Move neuron i towards biased (b,g,r) by factor alpha - */ - NeuQuant.prototype._alterSingle = function (alpha, i, b, g, r, a) { - alpha /= NeuQuant._initAlpha; - /* alter hit neuron */ - var n = this._network[i]; - n.subtract(alpha * (n.r - r), alpha * (n.g - g), alpha * (n.b - b), alpha * (n.a - a)); - }; - /** - * Search for biased BGR values - * description: - * finds closest neuron (min dist) and updates freq - * finds best neuron (min dist-bias) and returns position - * for frequently chosen neurons, freq[i] is high and bias[i] is negative - * bias[i] = _gamma*((1/this._networkSize)-freq[i]) - * - * Original distance equation: - * dist = abs(dR) + abs(dG) + abs(dB) - */ - NeuQuant.prototype._contest = function (b, g, r, a) { - var multiplier = (255 * 4) << networkBiasShift; - var bestd = ~(1 << 31), bestbiasd = bestd, bestpos = -1, bestbiaspos = bestpos; - for (var i = 0; i < this._networkSize; i++) { - var n = this._network[i], dist = this._distance.calculateNormalized(n, { r: r, g: g, b: b, a: a }) * multiplier | 0; - if (dist < bestd) { - bestd = dist; - bestpos = i; - } - var biasdist = dist - ((this._bias[i]) >> (NeuQuant._initialBiasShift - networkBiasShift)); - if (biasdist < bestbiasd) { - bestbiasd = biasdist; - bestbiaspos = i; - } - var betafreq = (this._freq[i] >> NeuQuant._betaShift); - this._freq[i] -= betafreq; - this._bias[i] += (betafreq << NeuQuant._gammaShift); - } - this._freq[bestpos] += NeuQuant._beta; - this._bias[bestpos] -= NeuQuant._betaGamma; - return bestbiaspos; - }; - /* - four primes near 500 - assume no image has a length so large - that it is divisible by all four primes - */ - NeuQuant._prime1 = 499; - NeuQuant._prime2 = 491; - NeuQuant._prime3 = 487; - NeuQuant._prime4 = 503; - NeuQuant._minpicturebytes = NeuQuant._prime4; - // no. of learning cycles - NeuQuant._nCycles = 100; - // defs for freq and bias - NeuQuant._initialBiasShift = 16; - // bias for fractions - NeuQuant._initialBias = (1 << NeuQuant._initialBiasShift); - NeuQuant._gammaShift = 10; - // gamma = 1024 - // TODO: why gamma is never used? - //private static _gamma : number = (1 << NeuQuant._gammaShift); - NeuQuant._betaShift = 10; - NeuQuant._beta = (NeuQuant._initialBias >> NeuQuant._betaShift); - // beta = 1/1024 - NeuQuant._betaGamma = (NeuQuant._initialBias << (NeuQuant._gammaShift - NeuQuant._betaShift)); - /* - * for 256 cols, radius starts - */ - NeuQuant._radiusBiasShift = 6; - // at 32.0 biased by 6 bits - NeuQuant._radiusBias = 1 << NeuQuant._radiusBiasShift; - // and decreases by a factor of 1/30 each cycle - NeuQuant._radiusDecrease = 30; - /* defs for decreasing alpha factor */ - // alpha starts at 1.0 - NeuQuant._alphaBiasShift = 10; - // biased by 10 bits - NeuQuant._initAlpha = (1 << NeuQuant._alphaBiasShift); - /* radBias and alphaRadBias used for radpower calculation */ - NeuQuant._radBiasShift = 8; - NeuQuant._radBias = 1 << NeuQuant._radBiasShift; - NeuQuant._alphaRadBiasShift = NeuQuant._alphaBiasShift + NeuQuant._radBiasShift; - NeuQuant._alphaRadBias = 1 << NeuQuant._alphaRadBiasShift; - return NeuQuant; - }()); - exports.NeuQuant = NeuQuant; - - -/***/ }, -/* 22 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * palette.ts - part of Image Quantization Library - */ - "use strict"; - var pointContainer_1 = __webpack_require__(23); - var rgb2hsl_1 = __webpack_require__(5); - // TODO: make paletteArray via pointBuffer, so, export will be available via pointBuffer.exportXXX - var hueGroups = 10; - function hueGroup(hue, segmentsNumber) { - var maxHue = 360, seg = maxHue / segmentsNumber, half = seg / 2; - for (var i = 1, mid = seg - half; i < segmentsNumber; i++, mid += seg) { - if (hue >= mid && hue < mid + seg) - return i; - } - return 0; - } - exports.hueGroup = hueGroup; - var Palette = (function () { - function Palette() { - this._pointArray = []; - this._i32idx = {}; - this._pointContainer = new pointContainer_1.PointContainer(); - this._pointContainer.setHeight(1); - this._pointArray = this._pointContainer.getPointArray(); - } - Palette.prototype.add = function (color) { - this._pointArray.push(color); - this._pointContainer.setWidth(this._pointArray.length); - }; - Palette.prototype.has = function (color) { - for (var i = this._pointArray.length - 1; i >= 0; i--) { - if (color.uint32 === this._pointArray[i].uint32) - return true; - } - return false; - }; - // TOTRY: use HUSL - http://boronine.com/husl/ http://www.husl-colors.org/ https://github.com/husl-colors/husl - Palette.prototype.getNearestColor = function (colorDistanceCalculator, color) { - return this._pointArray[this.getNearestIndex(colorDistanceCalculator, color) | 0]; - }; - Palette.prototype.getPointContainer = function () { - return this._pointContainer; - }; - // TOTRY: use HUSL - http://boronine.com/husl/ - /* - public nearestIndexByUint32(i32) { - var idx : number = this._nearestPointFromCache("" + i32); - if (idx >= 0) return idx; - - var min = 1000, - rgb = [ - (i32 & 0xff), - (i32 >>> 8) & 0xff, - (i32 >>> 16) & 0xff, - (i32 >>> 24) & 0xff - ], - len = this._pointArray.length; - - idx = 0; - for (var i = 0; i < len; i++) { - var dist = Utils.distEuclidean(rgb, this._pointArray[i].rgba); - - if (dist < min) { - min = dist; - idx = i; - } - } - - this._i32idx[i32] = idx; - return idx; - } - */ - Palette.prototype._nearestPointFromCache = function (key) { - return typeof this._i32idx[key] === "number" ? this._i32idx[key] : -1; - }; - Palette.prototype.getNearestIndex = function (colorDistanceCalculator, point) { - var idx = this._nearestPointFromCache("" + point.uint32); - if (idx >= 0) - return idx; - var minimalDistance = Number.MAX_VALUE; - idx = 0; - for (var i = 0, l = this._pointArray.length; i < l; i++) { - var p = this._pointArray[i], distance = colorDistanceCalculator.calculateRaw(point.r, point.g, point.b, point.a, p.r, p.g, p.b, p.a); - if (distance < minimalDistance) { - minimalDistance = distance; - idx = i; - } - } - this._i32idx[point.uint32] = idx; - return idx; - }; - /* - public reduce(histogram : ColorHistogram, colors : number) { - if (this._pointArray.length > colors) { - var idxi32 = histogram.getImportanceSortedColorsIDXI32(); - - // quantize histogram to existing palette - var keep = [], uniqueColors = 0, idx, pruned = false; - - for (var i = 0, len = idxi32.length; i < len; i++) { - // palette length reached, unset all remaining colors (sparse palette) - if (uniqueColors >= colors) { - this.prunePal(keep); - pruned = true; - break; - } else { - idx = this.nearestIndexByUint32(idxi32[i]); - if (keep.indexOf(idx) < 0) { - keep.push(idx); - uniqueColors++; - } - } - } - - if (!pruned) { - this.prunePal(keep); - } - } - } - - // TODO: check usage, not tested! - public prunePal(keep : number[]) { - var colors = this._pointArray.length; - for (var colorIndex = colors - 1; colorIndex >= 0; colorIndex--) { - if (keep.indexOf(colorIndex) < 0) { - - if(colorIndex + 1 < colors) { - this._pointArray[ colorIndex ] = this._pointArray [ colors - 1 ]; - } - --colors; - //this._pointArray[colorIndex] = null; - } - } - console.log("colors pruned: " + (this._pointArray.length - colors)); - this._pointArray.length = colors; - this._i32idx = {}; - } - */ - // TODO: group very low lum and very high lum colors - // TODO: pass custom sort order - // TODO: sort criteria function should be placed to HueStats class - Palette.prototype.sort = function () { - this._i32idx = {}; - this._pointArray.sort(function (a, b) { - var hslA = rgb2hsl_1.rgb2hsl(a.r, a.g, a.b), hslB = rgb2hsl_1.rgb2hsl(b.r, b.g, b.b); - // sort all grays + whites together - var hueA = (a.r === a.g && a.g === a.b) ? 0 : 1 + hueGroup(hslA.h, hueGroups), hueB = (b.r === b.g && b.g === b.b) ? 0 : 1 + hueGroup(hslB.h, hueGroups); - /* - var hueA = (a.r === a.g && a.g === a.b) ? 0 : 1 + Utils.hueGroup(hslA.h, hueGroups); - var hueB = (b.r === b.g && b.g === b.b) ? 0 : 1 + Utils.hueGroup(hslB.h, hueGroups); - */ - var hueDiff = hueB - hueA; - if (hueDiff) - return -hueDiff; - /* - var lumDiff = Utils.lumGroup(+hslB.l.toFixed(2)) - Utils.lumGroup(+hslA.l.toFixed(2)); - if (lumDiff) return -lumDiff; - */ - var lA = a.getLuminosity(true), lB = b.getLuminosity(true); - if (lB - lA !== 0) - return lB - lA; - var satDiff = ((hslB.s * 100) | 0) - ((hslA.s * 100) | 0); - if (satDiff) - return -satDiff; - return 0; - }); - }; - return Palette; - }()); - exports.Palette = Palette; - - -/***/ }, -/* 23 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * pointContainer.ts - part of Image Quantization Library - */ - var point_1 = __webpack_require__(24); - /** - * v8 optimizations done. - * fromXXX methods are static to move out polymorphic code from class instance itself. - */ - var PointContainer = (function () { - function PointContainer() { - this._width = 0; - this._height = 0; - this._pointArray = []; - } - PointContainer.prototype.getWidth = function () { - return this._width; - }; - PointContainer.prototype.getHeight = function () { - return this._height; - }; - PointContainer.prototype.setWidth = function (width) { - this._width = width; - }; - PointContainer.prototype.setHeight = function (height) { - this._height = height; - }; - PointContainer.prototype.getPointArray = function () { - return this._pointArray; - }; - PointContainer.prototype.clone = function () { - var clone = new PointContainer(); - clone._width = this._width; - clone._height = this._height; - for (var i = 0, l = this._pointArray.length; i < l; i++) { - clone._pointArray[i] = point_1.Point.createByUint32(this._pointArray[i].uint32 | 0); // "| 0" is added for v8 optimization - } - return clone; - }; - PointContainer.prototype.toUint32Array = function () { - var l = this._pointArray.length, uint32Array = new Uint32Array(l); - for (var i = 0; i < l; i++) { - uint32Array[i] = this._pointArray[i].uint32; - } - return uint32Array; - }; - PointContainer.prototype.toUint8Array = function () { - return new Uint8Array(this.toUint32Array().buffer); - }; - PointContainer.fromHTMLImageElement = function (img) { - var width = img.naturalWidth, height = img.naturalHeight; - var canvas = document.createElement("canvas"); - canvas.width = width; - canvas.height = height; - var ctx = canvas.getContext("2d"); - ctx.drawImage(img, 0, 0, width, height, 0, 0, width, height); - return PointContainer.fromHTMLCanvasElement(canvas); - }; - PointContainer.fromHTMLCanvasElement = function (canvas) { - var width = canvas.width, height = canvas.height; - var ctx = canvas.getContext("2d"), imgData = ctx.getImageData(0, 0, width, height); - return PointContainer.fromImageData(imgData); - }; - PointContainer.fromNodeCanvas = function (canvas) { - return PointContainer.fromHTMLCanvasElement(canvas); - }; - PointContainer.fromImageData = function (imageData) { - var width = imageData.width, height = imageData.height; - return PointContainer.fromCanvasPixelArray(imageData.data, width, height); - /* - var buf8; - if (Utils.typeOf(imageData.data) == "CanvasPixelArray") - buf8 = new Uint8Array(imageData.data); - else - buf8 = imageData.data; - - this.fromUint32Array(new Uint32Array(buf8.buffer), width, height); - */ - }; - PointContainer.fromArray = function (byteArray, width, height) { - var uint8array = new Uint8Array(byteArray); - return PointContainer.fromUint8Array(uint8array, width, height); - }; - PointContainer.fromCanvasPixelArray = function (data, width, height) { - return PointContainer.fromArray(data, width, height); - }; - PointContainer.fromUint8Array = function (uint8array, width, height) { - return PointContainer.fromUint32Array(new Uint32Array(uint8array.buffer), width, height); - }; - PointContainer.fromUint32Array = function (uint32array, width, height) { - var container = new PointContainer(); - container._width = width; - container._height = height; - for (var i = 0, l = uint32array.length; i < l; i++) { - container._pointArray[i] = point_1.Point.createByUint32(uint32array[i] | 0); // "| 0" is added for v8 optimization - } - return container; - }; - return PointContainer; - }()); - exports.PointContainer = PointContainer; - - -/***/ }, -/* 24 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * point.ts - part of Image Quantization Library - */ - var bt709_1 = __webpack_require__(2); - /** - * v8 optimized class - * 1) "constructor" should have initialization with worst types - * 2) "set" should have |0 / >>> 0 - */ - var Point = (function () { - function Point() { - this.uint32 = -1 >>> 0; - this.r = this.g = this.b = this.a = 0; - this.rgba = new Array(4); - /*[ this.r , this.g , this.b , this.a ]*/ - this.rgba[0] = 0; - this.rgba[1] = 0; - this.rgba[2] = 0; - this.rgba[3] = 0; - /* - this.Lab = { - L : 0.0, - a : 0.0, - b : 0.0 - }; - */ - } - Point.createByQuadruplet = function (quadruplet) { - var point = new Point(); - point.r = quadruplet[0] | 0; - point.g = quadruplet[1] | 0; - point.b = quadruplet[2] | 0; - point.a = quadruplet[3] | 0; - point._loadUINT32(); - point._loadQuadruplet(); - //point._loadLab(); - return point; - }; - Point.createByRGBA = function (red, green, blue, alpha) { - var point = new Point(); - point.r = red | 0; - point.g = green | 0; - point.b = blue | 0; - point.a = alpha | 0; - point._loadUINT32(); - point._loadQuadruplet(); - //point._loadLab(); - return point; - }; - Point.createByUint32 = function (uint32) { - var point = new Point(); - point.uint32 = uint32 >>> 0; - point._loadRGBA(); - point._loadQuadruplet(); - //point._loadLab(); - return point; - }; - Point.prototype.from = function (point) { - this.r = point.r; - this.g = point.g; - this.b = point.b; - this.a = point.a; - this.uint32 = point.uint32; - this.rgba[0] = point.r; - this.rgba[1] = point.g; - this.rgba[2] = point.b; - this.rgba[3] = point.a; - /* - this.Lab.L = point.Lab.L; - this.Lab.a = point.Lab.a; - this.Lab.b = point.Lab.b; - */ - }; - /* - * TODO: - Luminance from RGB: - - Luminance (standard for certain colour spaces): (0.2126*R + 0.7152*G + 0.0722*B) [1] - Luminance (perceived option 1): (0.299*R + 0.587*G + 0.114*B) [2] - Luminance (perceived option 2, slower to calculate): sqrt( 0.241*R^2 + 0.691*G^2 + 0.068*B^2 ) ? sqrt( 0.299*R^2 + 0.587*G^2 + 0.114*B^2 ) (thanks to @MatthewHerbst) [http://alienryderflex.com/hsp.html] - */ - Point.prototype.getLuminosity = function (useAlphaChannel) { - var r = this.r, g = this.g, b = this.b; - if (useAlphaChannel) { - r = Math.min(255, 255 - this.a + this.a * r / 255); - g = Math.min(255, 255 - this.a + this.a * g / 255); - b = Math.min(255, 255 - this.a + this.a * b / 255); - } - //var luma = this.r * Point._RED_COEFFICIENT + this.g * Point._GREEN_COEFFICIENT + this.b * Point._BLUE_COEFFICIENT; - /* - if(useAlphaChannel) { - luma = (luma * (255 - this.a)) / 255; - } - */ - return r * bt709_1.Y.RED + g * bt709_1.Y.GREEN + b * bt709_1.Y.BLUE; - }; - Point.prototype._loadUINT32 = function () { - this.uint32 = (this.a << 24 | this.b << 16 | this.g << 8 | this.r) >>> 0; - }; - Point.prototype._loadRGBA = function () { - this.r = this.uint32 & 0xff; - this.g = (this.uint32 >>> 8) & 0xff; - this.b = (this.uint32 >>> 16) & 0xff; - this.a = (this.uint32 >>> 24) & 0xff; - }; - Point.prototype._loadQuadruplet = function () { - this.rgba[0] = this.r; - this.rgba[1] = this.g; - this.rgba[2] = this.b; - this.rgba[3] = this.a; - /* - var xyz = rgb2xyz(this.r, this.g, this.b); - var lab = xyz2lab(xyz.x, xyz.y, xyz.z); - this.lab.l = lab.l; - this.lab.a = lab.a; - this.lab.b = lab.b; - */ - }; - return Point; - }()); - exports.Point = Point; - - -/***/ }, -/* 25 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /* - * NeuQuantFloat Neural-Net Quantization Algorithm - * ------------------------------------------ - * - * Copyright (c) 1994 Anthony Dekker - * - * NEUQUANT Neural-Net quantization algorithm by Anthony Dekker, 1994. See - * "Kohonen neural networks for optimal colour quantization" in "Network: - * Computation in Neural Systems" Vol. 5 (1994) pp 351-367. for a discussion of - * the algorithm. - * - * Any party obtaining a copy of these files from the author, directly or - * indirectly, is granted, free of charge, a full and unrestricted irrevocable, - * world-wide, paid up, royalty-free, nonexclusive right and license to deal in - * this software and documentation files (the "Software"), including without - * limitation the rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit persons who - * receive copies from any such party to do so, with the only requirement being - * that this copyright notice remain intact. - */ - /** - * @preserve TypeScript port: - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * neuquant.ts - part of Image Quantization Library - */ - var palette_1 = __webpack_require__(22); - var point_1 = __webpack_require__(24); - // bias for colour values - var networkBiasShift = 3; - var NeuronFloat = (function () { - function NeuronFloat(defaultValue) { - this.r = this.g = this.b = this.a = defaultValue; - } - /** - * There is a fix in original NEUQUANT by Anthony Dekker (http://members.ozemail.com.au/~dekker/NEUQUANT.HTML) - * @example - * r = Math.min(255, (neuron.r + (1 << (networkBiasShift - 1))) >> networkBiasShift); - */ - NeuronFloat.prototype.toPoint = function () { - return point_1.Point.createByRGBA(this.r >> networkBiasShift, this.g >> networkBiasShift, this.b >> networkBiasShift, this.a >> networkBiasShift); - }; - NeuronFloat.prototype.subtract = function (r, g, b, a) { - this.r -= r; - this.g -= g; - this.b -= b; - this.a -= a; - }; - return NeuronFloat; - }()); - var NeuQuantFloat = (function () { - function NeuQuantFloat(colorDistanceCalculator, colors) { - if (colors === void 0) { colors = 256; } - this._distance = colorDistanceCalculator; - this._pointArray = []; - this._sampleFactor = 1; - this._networkSize = colors; - this._distance.setWhitePoint(255 << networkBiasShift, 255 << networkBiasShift, 255 << networkBiasShift, 255 << networkBiasShift); - } - NeuQuantFloat.prototype.sample = function (pointBuffer) { - this._pointArray = this._pointArray.concat(pointBuffer.getPointArray()); - }; - NeuQuantFloat.prototype.quantize = function () { - this._init(); - this._learn(); - return this._buildPalette(); - }; - NeuQuantFloat.prototype._init = function () { - this._freq = []; - this._bias = []; - this._radPower = []; - this._network = []; - for (var i = 0; i < this._networkSize; i++) { - this._network[i] = new NeuronFloat((i << (networkBiasShift + 8)) / this._networkSize); - // 1/this._networkSize - this._freq[i] = NeuQuantFloat._initialBias / this._networkSize; - this._bias[i] = 0; - } - }; - /** - * Main Learning Loop - */ - NeuQuantFloat.prototype._learn = function () { - var sampleFactor = this._sampleFactor; - var pointsNumber = this._pointArray.length; - if (pointsNumber < NeuQuantFloat._minpicturebytes) - sampleFactor = 1; - var alphadec = 30 + (sampleFactor - 1) / 3, pointsToSample = pointsNumber / sampleFactor; - var delta = pointsToSample / NeuQuantFloat._nCycles | 0, alpha = NeuQuantFloat._initAlpha, radius = (this._networkSize >> 3) * NeuQuantFloat._radiusBias; - var rad = radius >> NeuQuantFloat._radiusBiasShift; - if (rad <= 1) - rad = 0; - for (var i = 0; i < rad; i++) { - this._radPower[i] = alpha * (((rad * rad - i * i) * NeuQuantFloat._radBias) / (rad * rad)); - } - var step; - if (pointsNumber < NeuQuantFloat._minpicturebytes) { - step = 1; - } - else if (pointsNumber % NeuQuantFloat._prime1 != 0) { - step = NeuQuantFloat._prime1; - } - else if ((pointsNumber % NeuQuantFloat._prime2) != 0) { - step = NeuQuantFloat._prime2; - } - else if ((pointsNumber % NeuQuantFloat._prime3) != 0) { - step = NeuQuantFloat._prime3; - } - else { - step = NeuQuantFloat._prime4; - } - for (var i = 0, pointIndex = 0; i < pointsToSample;) { - var point = this._pointArray[pointIndex], b = point.b << networkBiasShift, g = point.g << networkBiasShift, r = point.r << networkBiasShift, a = point.a << networkBiasShift, neuronIndex = this._contest(b, g, r, a); - this._alterSingle(alpha, neuronIndex, b, g, r, a); - if (rad != 0) - this._alterNeighbour(rad, neuronIndex, b, g, r, a); - /* alter neighbours */ - pointIndex += step; - if (pointIndex >= pointsNumber) - pointIndex -= pointsNumber; - i++; - if (delta == 0) - delta = 1; - if (i % delta == 0) { - alpha -= (alpha / alphadec); - radius -= (radius / NeuQuantFloat._radiusDecrease); - rad = radius >> NeuQuantFloat._radiusBiasShift; - if (rad <= 1) - rad = 0; - for (var j = 0; j < rad; j++) - this._radPower[j] = alpha * (((rad * rad - j * j) * NeuQuantFloat._radBias) / (rad * rad)); - } - } - }; - NeuQuantFloat.prototype._buildPalette = function () { - var palette = new palette_1.Palette(); - this._network.forEach(function (neuron) { - palette.add(neuron.toPoint()); - }); - palette.sort(); - return palette; - }; - /** - * Move adjacent neurons by precomputed alpha*(1-((i-j)^2/[r]^2)) in radpower[|i-j|] - */ - NeuQuantFloat.prototype._alterNeighbour = function (rad, i, b, g, r, al) { - var lo = i - rad; - if (lo < -1) - lo = -1; - var hi = i + rad; - if (hi > this._networkSize) - hi = this._networkSize; - var j = i + 1, k = i - 1, m = 1; - while (j < hi || k > lo) { - var a = this._radPower[m++] / NeuQuantFloat._alphaRadBias; - if (j < hi) { - var p = this._network[j++]; - p.subtract(a * (p.r - r), a * (p.g - g), a * (p.b - b), a * (p.a - al)); - } - if (k > lo) { - var p = this._network[k--]; - p.subtract(a * (p.r - r), a * (p.g - g), a * (p.b - b), a * (p.a - al)); - } - } - }; - /** - * Move neuron i towards biased (b,g,r) by factor alpha - */ - NeuQuantFloat.prototype._alterSingle = function (alpha, i, b, g, r, a) { - alpha /= NeuQuantFloat._initAlpha; - /* alter hit neuron */ - var n = this._network[i]; - n.subtract(alpha * (n.r - r), alpha * (n.g - g), alpha * (n.b - b), alpha * (n.a - a)); - }; - /** - * Search for biased BGR values - * description: - * finds closest neuron (min dist) and updates freq - * finds best neuron (min dist-bias) and returns position - * for frequently chosen neurons, freq[i] is high and bias[i] is negative - * bias[i] = _gamma*((1/this._networkSize)-freq[i]) - * - * Original distance equation: - * dist = abs(dR) + abs(dG) + abs(dB) - */ - NeuQuantFloat.prototype._contest = function (b, g, r, al) { - var multiplier = (255 * 4) << networkBiasShift; - var bestd = ~(1 << 31), bestbiasd = bestd, bestpos = -1, bestbiaspos = bestpos; - for (var i = 0; i < this._networkSize; i++) { - var n = this._network[i], dist = this._distance.calculateNormalized(n, { r: r, g: g, b: b, a: al }) * multiplier; - if (dist < bestd) { - bestd = dist; - bestpos = i; - } - var biasdist = dist - ((this._bias[i]) >> (NeuQuantFloat._initialBiasShift - networkBiasShift)); - if (biasdist < bestbiasd) { - bestbiasd = biasdist; - bestbiaspos = i; - } - var betafreq = (this._freq[i] >> NeuQuantFloat._betaShift); - this._freq[i] -= betafreq; - this._bias[i] += (betafreq << NeuQuantFloat._gammaShift); - } - this._freq[bestpos] += NeuQuantFloat._beta; - this._bias[bestpos] -= NeuQuantFloat._betaGamma; - return bestbiaspos; - }; - /* - four primes near 500 - assume no image has a length so large - that it is divisible by all four primes - */ - NeuQuantFloat._prime1 = 499; - NeuQuantFloat._prime2 = 491; - NeuQuantFloat._prime3 = 487; - NeuQuantFloat._prime4 = 503; - NeuQuantFloat._minpicturebytes = NeuQuantFloat._prime4; - // no. of learning cycles - NeuQuantFloat._nCycles = 100; - // defs for freq and bias - NeuQuantFloat._initialBiasShift = 16; - // bias for fractions - NeuQuantFloat._initialBias = (1 << NeuQuantFloat._initialBiasShift); - NeuQuantFloat._gammaShift = 10; - // gamma = 1024 - // TODO: why gamma is never used? - //private static _gamma : number = (1 << NeuQuantFloat._gammaShift); - NeuQuantFloat._betaShift = 10; - NeuQuantFloat._beta = (NeuQuantFloat._initialBias >> NeuQuantFloat._betaShift); - // beta = 1/1024 - NeuQuantFloat._betaGamma = (NeuQuantFloat._initialBias << (NeuQuantFloat._gammaShift - NeuQuantFloat._betaShift)); - /* - * for 256 cols, radius starts - */ - NeuQuantFloat._radiusBiasShift = 6; - // at 32.0 biased by 6 bits - NeuQuantFloat._radiusBias = 1 << NeuQuantFloat._radiusBiasShift; - // and decreases by a factor of 1/30 each cycle - NeuQuantFloat._radiusDecrease = 30; - /* defs for decreasing alpha factor */ - // alpha starts at 1.0 - NeuQuantFloat._alphaBiasShift = 10; - // biased by 10 bits - NeuQuantFloat._initAlpha = (1 << NeuQuantFloat._alphaBiasShift); - /* radBias and alphaRadBias used for radpower calculation */ - NeuQuantFloat._radBiasShift = 8; - NeuQuantFloat._radBias = 1 << NeuQuantFloat._radBiasShift; - NeuQuantFloat._alphaRadBiasShift = NeuQuantFloat._alphaBiasShift + NeuQuantFloat._radBiasShift; - NeuQuantFloat._alphaRadBias = 1 << NeuQuantFloat._alphaRadBiasShift; - return NeuQuantFloat; - }()); - exports.NeuQuantFloat = NeuQuantFloat; - - -/***/ }, -/* 26 */ -/***/ function(module, exports, __webpack_require__) { - - /* - * Copyright (c) 2015, Leon Sorokin - * All rights reserved. (MIT Licensed) - * - * RgbQuant.js - an image quantization lib - */ - "use strict"; - /** - * @preserve TypeScript port: - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * rgbquant.ts - part of Image Quantization Library - */ - var palette_1 = __webpack_require__(22); - var point_1 = __webpack_require__(24); - var colorHistogram_1 = __webpack_require__(27); - var arithmetic_1 = __webpack_require__(6); - var RemovedColor = (function () { - function RemovedColor(index, color, distance) { - this.index = index; - this.color = color; - this.distance = distance; - } - return RemovedColor; - }()); - // TODO: make input/output image and input/output palettes with instances of class Point only! - var RGBQuant = (function () { - function RGBQuant(colorDistanceCalculator, colors, method) { - if (colors === void 0) { colors = 256; } - if (method === void 0) { method = 2; } - this._distance = colorDistanceCalculator; - // desired final palette size - this._colors = colors; - // histogram to accumulate - this._histogram = new colorHistogram_1.ColorHistogram(method, colors); - this._initialDistance = 0.01; - this._distanceIncrement = 0.005; - } - // gathers histogram info - RGBQuant.prototype.sample = function (image) { - /* - var pointArray = image.getPointArray(), max = [0, 0, 0, 0], min = [255, 255, 255, 255]; - - for (var i = 0, l = pointArray.length; i < l; i++) { - var color = pointArray[i]; - for (var componentIndex = 0; componentIndex < 4; componentIndex++) { - if (max[componentIndex] < color.rgba[componentIndex]) max[componentIndex] = color.rgba[componentIndex]; - if (min[componentIndex] > color.rgba[componentIndex]) min[componentIndex] = color.rgba[componentIndex]; - } - } - var rd = max[0] - min[0], gd = max[1] - min[1], bd = max[2] - min[2], ad = max[3] - min[3]; - this._distance.setWhitePoint(rd, gd, bd, ad); - - this._initialDistance = (Math.sqrt(rd * rd + gd * gd + bd * bd + ad * ad) / Math.sqrt(255 * 255 + 255 * 255 + 255 * 255)) * 0.01; - */ - this._histogram.sample(image); - }; - // reduces histogram to palette, remaps & memoizes reduced colors - RGBQuant.prototype.quantize = function () { - var idxi32 = this._histogram.getImportanceSortedColorsIDXI32(); - if (idxi32.length === 0) { - throw new Error("No colors in image"); - } - var palette = this._buildPalette(idxi32); - palette.sort(); - return palette; - }; - // reduces similar colors from an importance-sorted Uint32 rgba array - RGBQuant.prototype._buildPalette = function (idxi32) { - // reduce histogram to create initial palette - // build full rgb palette - var palette = new palette_1.Palette(), colorArray = palette.getPointContainer().getPointArray(), usageArray = new Array(idxi32.length); - for (var i = 0; i < idxi32.length; i++) { - colorArray.push(point_1.Point.createByUint32(idxi32[i])); - usageArray[i] = 1; - } - var len = colorArray.length, memDist = []; - var palLen = len, thold = this._initialDistance; - // palette already at or below desired length - while (palLen > this._colors) { - memDist.length = 0; - // iterate palette - for (var i = 0; i < len; i++) { - if (usageArray[i] === 0) - continue; - var pxi = colorArray[i]; - //if (!pxi) continue; - for (var j = i + 1; j < len; j++) { - if (usageArray[j] === 0) - continue; - var pxj = colorArray[j]; - //if (!pxj) continue; - var dist = this._distance.calculateNormalized(pxi, pxj); - if (dist < thold) { - // store index,rgb,dist - memDist.push(new RemovedColor(j, pxj, dist)); - usageArray[j] = 0; - palLen--; - } - } - } - // palette reduction pass - // console.log("palette length: " + palLen); - // if palette is still much larger than target, increment by larger initDist - thold += (palLen > this._colors * 3) ? this._initialDistance : this._distanceIncrement; - } - // if palette is over-reduced, re-add removed colors with largest distances from last round - if (palLen < this._colors) { - // sort descending - arithmetic_1.stableSort(memDist, function (a, b) { - return b.distance - a.distance; - }); - var k = 0; - while (palLen < this._colors && k < memDist.length) { - var removedColor = memDist[k]; - // re-inject rgb into final palette - usageArray[removedColor.index] = 1; - palLen++; - k++; - } - } - var colors = colorArray.length; - for (var colorIndex = colors - 1; colorIndex >= 0; colorIndex--) { - if (usageArray[colorIndex] === 0) { - if (colorIndex !== colors - 1) { - colorArray[colorIndex] = colorArray[colors - 1]; - } - --colors; - } - } - colorArray.length = colors; - return palette; - }; - return RGBQuant; - }()); - exports.RGBQuant = RGBQuant; - - -/***/ }, -/* 27 */ -/***/ function(module, exports, __webpack_require__) { - - /* - * Copyright (c) 2015, Leon Sorokin - * All rights reserved. (MIT Licensed) - * - * ColorHistogram.js - an image quantization lib - */ - "use strict"; - /** - * @preserve TypeScript port: - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * colorHistogram.ts - part of Image Quantization Library - */ - var hueStatistics_1 = __webpack_require__(28); - var arithmetic_1 = __webpack_require__(6); - var ColorHistogram = (function () { - function ColorHistogram(method, colors) { - // 1 = by global population, 2 = subregion population threshold - this._method = method; - // if > 0, enables hues stats and min-color retention per group - this._minHueCols = colors << 2; //opts.minHueCols || 0; - // # of highest-frequency colors to start with for palette reduction - this._initColors = colors << 2; - // HueStatistics instance - this._hueStats = new hueStatistics_1.HueStatistics(ColorHistogram._hueGroups, this._minHueCols); - this._histogram = Object.create(null); - } - ColorHistogram.prototype.sample = function (pointBuffer) { - switch (this._method) { - case 1: - this._colorStats1D(pointBuffer); - break; - case 2: - this._colorStats2D(pointBuffer); - break; - } - }; - ColorHistogram.prototype.getImportanceSortedColorsIDXI32 = function () { - var _this = this; - // TODO: fix typing issue in stableSort func - var sorted = arithmetic_1.stableSort(Object.keys(this._histogram), function (a, b) { return _this._histogram[b] - _this._histogram[a]; }); - if (sorted.length === 0) { - return []; - } - var idxi32; - switch (this._method) { - case 1: - var initialColorsLimit = Math.min(sorted.length, this._initColors), last = sorted[initialColorsLimit - 1], freq = this._histogram[last]; - idxi32 = sorted.slice(0, initialColorsLimit); - // add any cut off colors with same freq as last - var pos = initialColorsLimit, len = sorted.length; - while (pos < len && this._histogram[sorted[pos]] == freq) - idxi32.push(sorted[pos++]); - // inject min huegroup colors - this._hueStats.injectIntoArray(idxi32); - break; - case 2: - idxi32 = sorted; - break; - default: - // TODO: rethink errors - throw new Error("Incorrect method"); - } - // int32-ify values - return idxi32.map(function (v) { - return +v; - }); - }; - // global top-population - ColorHistogram.prototype._colorStats1D = function (pointBuffer) { - var histG = this._histogram, pointArray = pointBuffer.getPointArray(), len = pointArray.length; - for (var i = 0; i < len; i++) { - var col = pointArray[i].uint32; - // collect hue stats - this._hueStats.check(col); - if (col in histG) - histG[col]++; - else - histG[col] = 1; - } - }; - // population threshold within subregions - // FIXME: this can over-reduce (few/no colors same?), need a way to keep - // important colors that dont ever reach local thresholds (gradients?) - ColorHistogram.prototype._colorStats2D = function (pointBuffer) { - var _this = this; - var width = pointBuffer.getWidth(), height = pointBuffer.getHeight(), pointArray = pointBuffer.getPointArray(); - var boxW = ColorHistogram._boxSize[0], boxH = ColorHistogram._boxSize[1], area = boxW * boxH, boxes = this._makeBoxes(width, height, boxW, boxH), histG = this._histogram; - boxes.forEach(function (box) { - var effc = Math.round((box.w * box.h) / area) * ColorHistogram._boxPixels; - if (effc < 2) - effc = 2; - var histL = {}; - _this._iterateBox(box, width, function (i) { - var col = pointArray[i].uint32; - // collect hue stats - _this._hueStats.check(col); - if (col in histG) - histG[col]++; - else if (col in histL) { - if (++histL[col] >= effc) - histG[col] = histL[col]; - } - else - histL[col] = 1; - }); - }); - // inject min huegroup colors - this._hueStats.injectIntoDictionary(histG); - }; - // iterates @bbox within a parent rect of width @wid; calls @fn, passing index within parent - ColorHistogram.prototype._iterateBox = function (bbox, wid, fn) { - var b = bbox, i0 = b.y * wid + b.x, i1 = (b.y + b.h - 1) * wid + (b.x + b.w - 1), incr = wid - b.w + 1; - var cnt = 0, i = i0; - do { - fn.call(this, i); - i += (++cnt % b.w == 0) ? incr : 1; - } while (i <= i1); - }; - /** - * partitions a rectangle of width x height into - * array of boxes stepX x stepY (or less) - */ - ColorHistogram.prototype._makeBoxes = function (width, height, stepX, stepY) { - var wrem = width % stepX, hrem = height % stepY, xend = width - wrem, yend = height - hrem, boxesArray = []; - for (var y = 0; y < height; y += stepY) - for (var x = 0; x < width; x += stepX) - boxesArray.push({ x: x, y: y, w: (x == xend ? wrem : stepX), h: (y == yend ? hrem : stepY) }); - return boxesArray; - }; - ColorHistogram._boxSize = [64, 64]; - ColorHistogram._boxPixels = 2; - ColorHistogram._hueGroups = 10; - return ColorHistogram; - }()); - exports.ColorHistogram = ColorHistogram; - - -/***/ }, -/* 28 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * hueStatistics.ts - part of Image Quantization Library - */ - var rgb2hsl_1 = __webpack_require__(5); - var palette_1 = __webpack_require__(22); - var HueGroup = (function () { - function HueGroup() { - this.num = 0; - this.cols = []; - } - return HueGroup; - }()); - var HueStatistics = (function () { - function HueStatistics(numGroups, minCols) { - this._numGroups = numGroups; - this._minCols = minCols; - this._stats = []; - for (var i = 0; i <= numGroups; i++) { - this._stats[i] = new HueGroup(); - } - this._groupsFull = 0; - } - HueStatistics.prototype.check = function (i32) { - if (this._groupsFull == this._numGroups + 1) { - this.check = function () { - }; - } - var r = (i32 & 0xff), g = (i32 >>> 8) & 0xff, b = (i32 >>> 16) & 0xff, hg = (r == g && g == b) ? 0 : 1 + palette_1.hueGroup(rgb2hsl_1.rgb2hsl(r, g, b).h, this._numGroups), gr = this._stats[hg], min = this._minCols; - gr.num++; - if (gr.num > min) - return; - if (gr.num == min) - this._groupsFull++; - if (gr.num <= min) - this._stats[hg].cols.push(i32); - }; - HueStatistics.prototype.injectIntoDictionary = function (histG) { - for (var i = 0; i <= this._numGroups; i++) { - if (this._stats[i].num <= this._minCols) { - this._stats[i].cols.forEach(function (col) { - if (!histG[col]) - histG[col] = 1; - else - histG[col]++; - }); - } - } - }; - HueStatistics.prototype.injectIntoArray = function (histG) { - for (var i = 0; i <= this._numGroups; i++) { - if (this._stats[i].num <= this._minCols) { - this._stats[i].cols.forEach(function (col) { - if (histG.indexOf(col) == -1) - histG.push(col); - }); - } - } - }; - return HueStatistics; - }()); - exports.HueStatistics = HueStatistics; - - -/***/ }, -/* 29 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * wuQuant.ts - part of Image Quantization Library - */ - var palette_1 = __webpack_require__(22); - var point_1 = __webpack_require__(24); - function createArray1D(dimension1) { - var a = []; - for (var k = 0; k < dimension1; k++) { - a[k] = 0; - } - return a; - } - function createArray4D(dimension1, dimension2, dimension3, dimension4) { - var a = new Array(dimension1); - for (var i = 0; i < dimension1; i++) { - a[i] = new Array(dimension2); - for (var j = 0; j < dimension2; j++) { - a[i][j] = new Array(dimension3); - for (var k = 0; k < dimension3; k++) { - a[i][j][k] = new Array(dimension4); - for (var l = 0; l < dimension4; l++) { - a[i][j][k][l] = 0; - } - } - } - } - return a; - } - function createArray3D(dimension1, dimension2, dimension3) { - var a = new Array(dimension1); - for (var i = 0; i < dimension1; i++) { - a[i] = new Array(dimension2); - for (var j = 0; j < dimension2; j++) { - a[i][j] = new Array(dimension3); - for (var k = 0; k < dimension3; k++) { - a[i][j][k] = 0; - } - } - } - return a; - } - function fillArray3D(a, dimension1, dimension2, dimension3, value) { - for (var i = 0; i < dimension1; i++) { - a[i] = []; - for (var j = 0; j < dimension2; j++) { - a[i][j] = []; - for (var k = 0; k < dimension3; k++) { - a[i][j][k] = value; - } - } - } - } - function fillArray1D(a, dimension1, value) { - for (var i = 0; i < dimension1; i++) { - a[i] = value; - } - } - var WuColorCube = (function () { - function WuColorCube() { - } - return WuColorCube; - }()); - exports.WuColorCube = WuColorCube; - var WuQuant = (function () { - function WuQuant(colorDistanceCalculator, colors, significantBitsPerChannel) { - if (colors === void 0) { colors = 256; } - if (significantBitsPerChannel === void 0) { significantBitsPerChannel = 5; } - this._distance = colorDistanceCalculator; - this._setQuality(significantBitsPerChannel); - this._initialize(colors); - } - WuQuant.prototype.sample = function (image) { - var pointArray = image.getPointArray(); - for (var i = 0, l = pointArray.length; i < l; i++) { - this._addColor(pointArray[i]); - } - this._pixels = this._pixels.concat(pointArray); - }; - WuQuant.prototype.quantize = function () { - this._preparePalette(); - var palette = new palette_1.Palette(); - // generates palette - for (var paletteIndex = 0; paletteIndex < this._colors; paletteIndex++) { - if (this._sums[paletteIndex] > 0) { - var sum = this._sums[paletteIndex], r = this._reds[paletteIndex] / sum, g = this._greens[paletteIndex] / sum, b = this._blues[paletteIndex] / sum, a = this._alphas[paletteIndex] / sum; - var color = point_1.Point.createByRGBA(r | 0, g | 0, b | 0, a | 0); - palette.add(color); - } - } - palette.sort(); - return palette; - }; - WuQuant.prototype._preparePalette = function () { - // preprocess the colors - this._calculateMoments(); - var next = 0, volumeVariance = createArray1D(this._colors); - // processes the cubes - for (var cubeIndex = 1; cubeIndex < this._colors; ++cubeIndex) { - // if cut is possible; make it - if (this._cut(this._cubes[next], this._cubes[cubeIndex])) { - volumeVariance[next] = this._cubes[next].volume > 1 ? this._calculateVariance(this._cubes[next]) : 0.0; - volumeVariance[cubeIndex] = this._cubes[cubeIndex].volume > 1 ? this._calculateVariance(this._cubes[cubeIndex]) : 0.0; - } - else { - // the cut was not possible, revert the index - volumeVariance[next] = 0.0; - cubeIndex--; - } - next = 0; - var temp = volumeVariance[0]; - for (var index = 1; index <= cubeIndex; ++index) { - if (volumeVariance[index] > temp) { - temp = volumeVariance[index]; - next = index; - } - } - if (temp <= 0.0) { - this._colors = cubeIndex + 1; - break; - } - } - var lookupRed = [], lookupGreen = [], lookupBlue = [], lookupAlpha = []; - // precalculates lookup tables - for (var k = 0; k < this._colors; ++k) { - var weight = WuQuant._volume(this._cubes[k], this._weights); - if (weight > 0) { - lookupRed[k] = (WuQuant._volume(this._cubes[k], this._momentsRed) / weight) | 0; - lookupGreen[k] = (WuQuant._volume(this._cubes[k], this._momentsGreen) / weight) | 0; - lookupBlue[k] = (WuQuant._volume(this._cubes[k], this._momentsBlue) / weight) | 0; - lookupAlpha[k] = (WuQuant._volume(this._cubes[k], this._momentsAlpha) / weight) | 0; - } - else { - lookupRed[k] = 0; - lookupGreen[k] = 0; - lookupBlue[k] = 0; - lookupAlpha[k] = 0; - } - } - this._reds = createArray1D(this._colors + 1); - this._greens = createArray1D(this._colors + 1); - this._blues = createArray1D(this._colors + 1); - this._alphas = createArray1D(this._colors + 1); - this._sums = createArray1D(this._colors + 1); - // scans and adds colors - for (var index = 0, l = this._pixels.length; index < l; index++) { - var color = this._pixels[index]; - var match = -1; - var bestMatch = match, bestDistance = Number.MAX_VALUE; - for (var lookup = 0; lookup < this._colors; lookup++) { - var foundRed = lookupRed[lookup], foundGreen = lookupGreen[lookup], foundBlue = lookupBlue[lookup], foundAlpha = lookupAlpha[lookup]; - var distance = this._distance.calculateRaw(foundRed, foundGreen, foundBlue, foundAlpha, color.r, color.g, color.b, color.a); - //var distance = this._distance.calculateRaw(Utils.Point.createByRGBA(foundRed, foundGreen, foundBlue, foundAlpha), color); - //deltaRed = color.r - foundRed, - //deltaGreen = color.g - foundGreen, - //deltaBlue = color.b - foundBlue, - //deltaAlpha = color.a - foundAlpha, - //distance = deltaRed * deltaRed + deltaGreen * deltaGreen + deltaBlue * deltaBlue + deltaAlpha * deltaAlpha; - if (distance < bestDistance) { - bestDistance = distance; - bestMatch = lookup; - } - } - this._reds[bestMatch] += color.r; - this._greens[bestMatch] += color.g; - this._blues[bestMatch] += color.b; - this._alphas[bestMatch] += color.a; - this._sums[bestMatch]++; - } - }; - WuQuant.prototype._addColor = function (color) { - var bitsToRemove = 8 - this._significantBitsPerChannel, indexRed = (color.r >> bitsToRemove) + 1, indexGreen = (color.g >> bitsToRemove) + 1, indexBlue = (color.b >> bitsToRemove) + 1, indexAlpha = (color.a >> bitsToRemove) + 1; - //if(color.a > 10) { - this._weights[indexAlpha][indexRed][indexGreen][indexBlue]++; - this._momentsRed[indexAlpha][indexRed][indexGreen][indexBlue] += color.r; - this._momentsGreen[indexAlpha][indexRed][indexGreen][indexBlue] += color.g; - this._momentsBlue[indexAlpha][indexRed][indexGreen][indexBlue] += color.b; - this._momentsAlpha[indexAlpha][indexRed][indexGreen][indexBlue] += color.a; - this._moments[indexAlpha][indexRed][indexGreen][indexBlue] += this._table[color.r] + this._table[color.g] + this._table[color.b] + this._table[color.a]; - // } - }; - /** - * Converts the histogram to a series of _moments. - */ - WuQuant.prototype._calculateMoments = function () { - var area = [], areaRed = [], areaGreen = [], areaBlue = [], areaAlpha = [], area2 = []; - var xarea = createArray3D(this._sideSize, this._sideSize, this._sideSize), xareaRed = createArray3D(this._sideSize, this._sideSize, this._sideSize), xareaGreen = createArray3D(this._sideSize, this._sideSize, this._sideSize), xareaBlue = createArray3D(this._sideSize, this._sideSize, this._sideSize), xareaAlpha = createArray3D(this._sideSize, this._sideSize, this._sideSize), xarea2 = createArray3D(this._sideSize, this._sideSize, this._sideSize); - for (var alphaIndex = 1; alphaIndex <= this._alphaMaxSideIndex; ++alphaIndex) { - fillArray3D(xarea, this._sideSize, this._sideSize, this._sideSize, 0); - fillArray3D(xareaRed, this._sideSize, this._sideSize, this._sideSize, 0); - fillArray3D(xareaGreen, this._sideSize, this._sideSize, this._sideSize, 0); - fillArray3D(xareaBlue, this._sideSize, this._sideSize, this._sideSize, 0); - fillArray3D(xareaAlpha, this._sideSize, this._sideSize, this._sideSize, 0); - fillArray3D(xarea2, this._sideSize, this._sideSize, this._sideSize, 0); - for (var redIndex = 1; redIndex <= this._maxSideIndex; ++redIndex) { - fillArray1D(area, this._sideSize, 0); - fillArray1D(areaRed, this._sideSize, 0); - fillArray1D(areaGreen, this._sideSize, 0); - fillArray1D(areaBlue, this._sideSize, 0); - fillArray1D(areaAlpha, this._sideSize, 0); - fillArray1D(area2, this._sideSize, 0); - for (var greenIndex = 1; greenIndex <= this._maxSideIndex; ++greenIndex) { - var line = 0, lineRed = 0, lineGreen = 0, lineBlue = 0, lineAlpha = 0, line2 = 0.0; - for (var blueIndex = 1; blueIndex <= this._maxSideIndex; ++blueIndex) { - line += this._weights[alphaIndex][redIndex][greenIndex][blueIndex]; - lineRed += this._momentsRed[alphaIndex][redIndex][greenIndex][blueIndex]; - lineGreen += this._momentsGreen[alphaIndex][redIndex][greenIndex][blueIndex]; - lineBlue += this._momentsBlue[alphaIndex][redIndex][greenIndex][blueIndex]; - lineAlpha += this._momentsAlpha[alphaIndex][redIndex][greenIndex][blueIndex]; - line2 += this._moments[alphaIndex][redIndex][greenIndex][blueIndex]; - area[blueIndex] += line; - areaRed[blueIndex] += lineRed; - areaGreen[blueIndex] += lineGreen; - areaBlue[blueIndex] += lineBlue; - areaAlpha[blueIndex] += lineAlpha; - area2[blueIndex] += line2; - xarea[redIndex][greenIndex][blueIndex] = xarea[redIndex - 1][greenIndex][blueIndex] + area[blueIndex]; - xareaRed[redIndex][greenIndex][blueIndex] = xareaRed[redIndex - 1][greenIndex][blueIndex] + areaRed[blueIndex]; - xareaGreen[redIndex][greenIndex][blueIndex] = xareaGreen[redIndex - 1][greenIndex][blueIndex] + areaGreen[blueIndex]; - xareaBlue[redIndex][greenIndex][blueIndex] = xareaBlue[redIndex - 1][greenIndex][blueIndex] + areaBlue[blueIndex]; - xareaAlpha[redIndex][greenIndex][blueIndex] = xareaAlpha[redIndex - 1][greenIndex][blueIndex] + areaAlpha[blueIndex]; - xarea2[redIndex][greenIndex][blueIndex] = xarea2[redIndex - 1][greenIndex][blueIndex] + area2[blueIndex]; - this._weights[alphaIndex][redIndex][greenIndex][blueIndex] = this._weights[alphaIndex - 1][redIndex][greenIndex][blueIndex] + xarea[redIndex][greenIndex][blueIndex]; - this._momentsRed[alphaIndex][redIndex][greenIndex][blueIndex] = this._momentsRed[alphaIndex - 1][redIndex][greenIndex][blueIndex] + xareaRed[redIndex][greenIndex][blueIndex]; - this._momentsGreen[alphaIndex][redIndex][greenIndex][blueIndex] = this._momentsGreen[alphaIndex - 1][redIndex][greenIndex][blueIndex] + xareaGreen[redIndex][greenIndex][blueIndex]; - this._momentsBlue[alphaIndex][redIndex][greenIndex][blueIndex] = this._momentsBlue[alphaIndex - 1][redIndex][greenIndex][blueIndex] + xareaBlue[redIndex][greenIndex][blueIndex]; - this._momentsAlpha[alphaIndex][redIndex][greenIndex][blueIndex] = this._momentsAlpha[alphaIndex - 1][redIndex][greenIndex][blueIndex] + xareaAlpha[redIndex][greenIndex][blueIndex]; - this._moments[alphaIndex][redIndex][greenIndex][blueIndex] = this._moments[alphaIndex - 1][redIndex][greenIndex][blueIndex] + xarea2[redIndex][greenIndex][blueIndex]; - } - } - } - } - }; - /** - * Computes the volume of the cube in a specific moment. - */ - WuQuant._volumeFloat = function (cube, moment) { - return (moment[cube.alphaMaximum][cube.redMaximum][cube.greenMaximum][cube.blueMaximum] - - moment[cube.alphaMaximum][cube.redMaximum][cube.greenMinimum][cube.blueMaximum] - - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMaximum][cube.blueMaximum] + - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][cube.blueMaximum] - - moment[cube.alphaMinimum][cube.redMaximum][cube.greenMaximum][cube.blueMaximum] + - moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][cube.blueMaximum] + - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][cube.blueMaximum] - - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMaximum]) - - (moment[cube.alphaMaximum][cube.redMaximum][cube.greenMaximum][cube.blueMinimum] - - moment[cube.alphaMinimum][cube.redMaximum][cube.greenMaximum][cube.blueMinimum] - - moment[cube.alphaMaximum][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] + - moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] - - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] + - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] + - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum] - - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum]); - }; - /** - * Computes the volume of the cube in a specific moment. - */ - WuQuant._volume = function (cube, moment) { - return WuQuant._volumeFloat(cube, moment) | 0; - }; - /** - * Splits the cube in given position][and color direction. - */ - WuQuant._top = function (cube, direction, position, moment) { - var result; - switch (direction) { - case WuQuant.alpha: - result = (moment[position][cube.redMaximum][cube.greenMaximum][cube.blueMaximum] - - moment[position][cube.redMaximum][cube.greenMinimum][cube.blueMaximum] - - moment[position][cube.redMinimum][cube.greenMaximum][cube.blueMaximum] + - moment[position][cube.redMinimum][cube.greenMinimum][cube.blueMaximum]) - - (moment[position][cube.redMaximum][cube.greenMaximum][cube.blueMinimum] - - moment[position][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] - - moment[position][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] + - moment[position][cube.redMinimum][cube.greenMinimum][cube.blueMinimum]); - break; - case WuQuant.red: - result = (moment[cube.alphaMaximum][position][cube.greenMaximum][cube.blueMaximum] - - moment[cube.alphaMaximum][position][cube.greenMinimum][cube.blueMaximum] - - moment[cube.alphaMinimum][position][cube.greenMaximum][cube.blueMaximum] + - moment[cube.alphaMinimum][position][cube.greenMinimum][cube.blueMaximum]) - - (moment[cube.alphaMaximum][position][cube.greenMaximum][cube.blueMinimum] - - moment[cube.alphaMaximum][position][cube.greenMinimum][cube.blueMinimum] - - moment[cube.alphaMinimum][position][cube.greenMaximum][cube.blueMinimum] + - moment[cube.alphaMinimum][position][cube.greenMinimum][cube.blueMinimum]); - break; - case WuQuant.green: - result = (moment[cube.alphaMaximum][cube.redMaximum][position][cube.blueMaximum] - - moment[cube.alphaMaximum][cube.redMinimum][position][cube.blueMaximum] - - moment[cube.alphaMinimum][cube.redMaximum][position][cube.blueMaximum] + - moment[cube.alphaMinimum][cube.redMinimum][position][cube.blueMaximum]) - - (moment[cube.alphaMaximum][cube.redMaximum][position][cube.blueMinimum] - - moment[cube.alphaMaximum][cube.redMinimum][position][cube.blueMinimum] - - moment[cube.alphaMinimum][cube.redMaximum][position][cube.blueMinimum] + - moment[cube.alphaMinimum][cube.redMinimum][position][cube.blueMinimum]); - break; - case WuQuant.blue: - result = (moment[cube.alphaMaximum][cube.redMaximum][cube.greenMaximum][position] - - moment[cube.alphaMaximum][cube.redMaximum][cube.greenMinimum][position] - - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMaximum][position] + - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][position]) - - (moment[cube.alphaMinimum][cube.redMaximum][cube.greenMaximum][position] - - moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][position] - - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][position] + - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][position]); - break; - default: - throw new Error("impossible"); - } - return result | 0; - }; - /** - * Splits the cube in a given color direction at its minimum. - */ - WuQuant._bottom = function (cube, direction, moment) { - switch (direction) { - case WuQuant.alpha: - return (-moment[cube.alphaMinimum][cube.redMaximum][cube.greenMaximum][cube.blueMaximum] + - moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][cube.blueMaximum] + - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][cube.blueMaximum] - - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMaximum]) - - (-moment[cube.alphaMinimum][cube.redMaximum][cube.greenMaximum][cube.blueMinimum] + - moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] + - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] - - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum]); - case WuQuant.red: - return (-moment[cube.alphaMaximum][cube.redMinimum][cube.greenMaximum][cube.blueMaximum] + - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][cube.blueMaximum] + - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][cube.blueMaximum] - - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMaximum]) - - (-moment[cube.alphaMaximum][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] + - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum] + - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] - - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum]); - case WuQuant.green: - return (-moment[cube.alphaMaximum][cube.redMaximum][cube.greenMinimum][cube.blueMaximum] + - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][cube.blueMaximum] + - moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][cube.blueMaximum] - - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMaximum]) - - (-moment[cube.alphaMaximum][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] + - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum] + - moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] - - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum]); - case WuQuant.blue: - return (-moment[cube.alphaMaximum][cube.redMaximum][cube.greenMaximum][cube.blueMinimum] + - moment[cube.alphaMaximum][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] + - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] - - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum]) - - (-moment[cube.alphaMinimum][cube.redMaximum][cube.greenMaximum][cube.blueMinimum] + - moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] + - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] - - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum]); - default: - // TODO: why here is return 0, and in this._top there is no default at all (now it is throw error)? - return 0; - } - }; - /** - * Calculates statistical variance for a given cube. - */ - WuQuant.prototype._calculateVariance = function (cube) { - var volumeRed = WuQuant._volume(cube, this._momentsRed), volumeGreen = WuQuant._volume(cube, this._momentsGreen), volumeBlue = WuQuant._volume(cube, this._momentsBlue), volumeAlpha = WuQuant._volume(cube, this._momentsAlpha), volumeMoment = WuQuant._volumeFloat(cube, this._moments), volumeWeight = WuQuant._volume(cube, this._weights), distance = volumeRed * volumeRed + volumeGreen * volumeGreen + volumeBlue * volumeBlue + volumeAlpha * volumeAlpha; - return volumeMoment - (distance / volumeWeight); - }; - /** - * Finds the optimal (maximal) position for the cut. - */ - WuQuant.prototype._maximize = function (cube, direction, first, last, wholeRed, wholeGreen, wholeBlue, wholeAlpha, wholeWeight) { - var bottomRed = WuQuant._bottom(cube, direction, this._momentsRed) | 0, bottomGreen = WuQuant._bottom(cube, direction, this._momentsGreen) | 0, bottomBlue = WuQuant._bottom(cube, direction, this._momentsBlue) | 0, bottomAlpha = WuQuant._bottom(cube, direction, this._momentsAlpha) | 0, bottomWeight = WuQuant._bottom(cube, direction, this._weights) | 0; - var result = 0.0, cutPosition = -1; - for (var position = first; position < last; ++position) { - // determines the cube cut at a certain position - var halfRed = bottomRed + WuQuant._top(cube, direction, position, this._momentsRed), halfGreen = bottomGreen + WuQuant._top(cube, direction, position, this._momentsGreen), halfBlue = bottomBlue + WuQuant._top(cube, direction, position, this._momentsBlue), halfAlpha = bottomAlpha + WuQuant._top(cube, direction, position, this._momentsAlpha), halfWeight = bottomWeight + WuQuant._top(cube, direction, position, this._weights); - // the cube cannot be cut at bottom (this would lead to empty cube) - if (halfWeight != 0) { - var halfDistance = halfRed * halfRed + halfGreen * halfGreen + halfBlue * halfBlue + halfAlpha * halfAlpha, temp = halfDistance / halfWeight; - halfRed = wholeRed - halfRed; - halfGreen = wholeGreen - halfGreen; - halfBlue = wholeBlue - halfBlue; - halfAlpha = wholeAlpha - halfAlpha; - halfWeight = wholeWeight - halfWeight; - if (halfWeight != 0) { - halfDistance = halfRed * halfRed + halfGreen * halfGreen + halfBlue * halfBlue + halfAlpha * halfAlpha; - temp += halfDistance / halfWeight; - if (temp > result) { - result = temp; - cutPosition = position; - } - } - } - } - return { max: result, position: cutPosition }; - }; - // Cuts a cube with another one. - WuQuant.prototype._cut = function (first, second) { - var direction; - var wholeRed = WuQuant._volume(first, this._momentsRed), wholeGreen = WuQuant._volume(first, this._momentsGreen), wholeBlue = WuQuant._volume(first, this._momentsBlue), wholeAlpha = WuQuant._volume(first, this._momentsAlpha), wholeWeight = WuQuant._volume(first, this._weights), red = this._maximize(first, WuQuant.red, first.redMinimum + 1, first.redMaximum, wholeRed, wholeGreen, wholeBlue, wholeAlpha, wholeWeight), green = this._maximize(first, WuQuant.green, first.greenMinimum + 1, first.greenMaximum, wholeRed, wholeGreen, wholeBlue, wholeAlpha, wholeWeight), blue = this._maximize(first, WuQuant.blue, first.blueMinimum + 1, first.blueMaximum, wholeRed, wholeGreen, wholeBlue, wholeAlpha, wholeWeight), alpha = this._maximize(first, WuQuant.alpha, first.alphaMinimum + 1, first.alphaMaximum, wholeRed, wholeGreen, wholeBlue, wholeAlpha, wholeWeight); - if (alpha.max >= red.max && alpha.max >= green.max && alpha.max >= blue.max) { - direction = WuQuant.alpha; - // cannot split empty cube - if (alpha.position < 0) - return false; - } - else { - if (red.max >= alpha.max && red.max >= green.max && red.max >= blue.max) { - direction = WuQuant.red; - } - else if (green.max >= alpha.max && green.max >= red.max && green.max >= blue.max) { - direction = WuQuant.green; - } - else { - direction = WuQuant.blue; - } - } - second.redMaximum = first.redMaximum; - second.greenMaximum = first.greenMaximum; - second.blueMaximum = first.blueMaximum; - second.alphaMaximum = first.alphaMaximum; - // cuts in a certain direction - switch (direction) { - case WuQuant.red: - second.redMinimum = first.redMaximum = red.position; - second.greenMinimum = first.greenMinimum; - second.blueMinimum = first.blueMinimum; - second.alphaMinimum = first.alphaMinimum; - break; - case WuQuant.green: - second.greenMinimum = first.greenMaximum = green.position; - second.redMinimum = first.redMinimum; - second.blueMinimum = first.blueMinimum; - second.alphaMinimum = first.alphaMinimum; - break; - case WuQuant.blue: - second.blueMinimum = first.blueMaximum = blue.position; - second.redMinimum = first.redMinimum; - second.greenMinimum = first.greenMinimum; - second.alphaMinimum = first.alphaMinimum; - break; - case WuQuant.alpha: - second.alphaMinimum = first.alphaMaximum = alpha.position; - second.blueMinimum = first.blueMinimum; - second.redMinimum = first.redMinimum; - second.greenMinimum = first.greenMinimum; - break; - } - // determines the volumes after cut - first.volume = (first.redMaximum - first.redMinimum) * (first.greenMaximum - first.greenMinimum) * (first.blueMaximum - first.blueMinimum) * (first.alphaMaximum - first.alphaMinimum); - second.volume = (second.redMaximum - second.redMinimum) * (second.greenMaximum - second.greenMinimum) * (second.blueMaximum - second.blueMinimum) * (second.alphaMaximum - second.alphaMinimum); - // the cut was successful - return true; - }; - WuQuant.prototype._initialize = function (colors) { - this._colors = colors; - // creates all the _cubes - this._cubes = []; - // initializes all the _cubes - for (var cubeIndex = 0; cubeIndex < colors; cubeIndex++) { - this._cubes[cubeIndex] = new WuColorCube(); - } - // resets the reference minimums - this._cubes[0].redMinimum = 0; - this._cubes[0].greenMinimum = 0; - this._cubes[0].blueMinimum = 0; - this._cubes[0].alphaMinimum = 0; - // resets the reference maximums - this._cubes[0].redMaximum = this._maxSideIndex; - this._cubes[0].greenMaximum = this._maxSideIndex; - this._cubes[0].blueMaximum = this._maxSideIndex; - this._cubes[0].alphaMaximum = this._alphaMaxSideIndex; - this._weights = createArray4D(this._alphaSideSize, this._sideSize, this._sideSize, this._sideSize); - this._momentsRed = createArray4D(this._alphaSideSize, this._sideSize, this._sideSize, this._sideSize); - this._momentsGreen = createArray4D(this._alphaSideSize, this._sideSize, this._sideSize, this._sideSize); - this._momentsBlue = createArray4D(this._alphaSideSize, this._sideSize, this._sideSize, this._sideSize); - this._momentsAlpha = createArray4D(this._alphaSideSize, this._sideSize, this._sideSize, this._sideSize); - this._moments = createArray4D(this._alphaSideSize, this._sideSize, this._sideSize, this._sideSize); - this._table = []; - for (var tableIndex = 0; tableIndex < 256; ++tableIndex) { - this._table[tableIndex] = tableIndex * tableIndex; - } - this._pixels = []; - }; - WuQuant.prototype._setQuality = function (significantBitsPerChannel) { - if (significantBitsPerChannel === void 0) { significantBitsPerChannel = 5; } - this._significantBitsPerChannel = significantBitsPerChannel; - this._maxSideIndex = 1 << this._significantBitsPerChannel; - this._alphaMaxSideIndex = this._maxSideIndex; - this._sideSize = this._maxSideIndex + 1; - this._alphaSideSize = this._alphaMaxSideIndex + 1; - }; - WuQuant.alpha = 3; - WuQuant.red = 2; - WuQuant.green = 1; - WuQuant.blue = 0; - return WuQuant; - }()); - exports.WuQuant = WuQuant; - - -/***/ }, -/* 30 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var nearestColor_1 = __webpack_require__(31); - exports.NearestColor = nearestColor_1.NearestColor; - var array_1 = __webpack_require__(32); - exports.ErrorDiffusionArray = array_1.ErrorDiffusionArray; - exports.ErrorDiffusionArrayKernel = array_1.ErrorDiffusionArrayKernel; - var riemersma_1 = __webpack_require__(33); - exports.ErrorDiffusionRiemersma = riemersma_1.ErrorDiffusionRiemersma; - - -/***/ }, -/* 31 */ -/***/ function(module, exports) { - - "use strict"; - var NearestColor = (function () { - function NearestColor(colorDistanceCalculator) { - this._distance = colorDistanceCalculator; - } - NearestColor.prototype.quantize = function (pointBuffer, palette) { - var pointArray = pointBuffer.getPointArray(), width = pointBuffer.getWidth(), height = pointBuffer.getHeight(); - for (var y = 0; y < height; y++) { - for (var x = 0, idx = y * width; x < width; x++, idx++) { - // Image pixel - var point = pointArray[idx]; - // Reduced pixel - point.from(palette.getNearestColor(this._distance, point)); - } - } - return pointBuffer; - }; - return NearestColor; - }()); - exports.NearestColor = NearestColor; - - -/***/ }, -/* 32 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var point_1 = __webpack_require__(24); - var arithmetic_1 = __webpack_require__(6); - // TODO: is it the best name for this enum "kernel"? - (function (ErrorDiffusionArrayKernel) { - ErrorDiffusionArrayKernel[ErrorDiffusionArrayKernel["FloydSteinberg"] = 0] = "FloydSteinberg"; - ErrorDiffusionArrayKernel[ErrorDiffusionArrayKernel["FalseFloydSteinberg"] = 1] = "FalseFloydSteinberg"; - ErrorDiffusionArrayKernel[ErrorDiffusionArrayKernel["Stucki"] = 2] = "Stucki"; - ErrorDiffusionArrayKernel[ErrorDiffusionArrayKernel["Atkinson"] = 3] = "Atkinson"; - ErrorDiffusionArrayKernel[ErrorDiffusionArrayKernel["Jarvis"] = 4] = "Jarvis"; - ErrorDiffusionArrayKernel[ErrorDiffusionArrayKernel["Burkes"] = 5] = "Burkes"; - ErrorDiffusionArrayKernel[ErrorDiffusionArrayKernel["Sierra"] = 6] = "Sierra"; - ErrorDiffusionArrayKernel[ErrorDiffusionArrayKernel["TwoSierra"] = 7] = "TwoSierra"; - ErrorDiffusionArrayKernel[ErrorDiffusionArrayKernel["SierraLite"] = 8] = "SierraLite"; - })(exports.ErrorDiffusionArrayKernel || (exports.ErrorDiffusionArrayKernel = {})); - var ErrorDiffusionArrayKernel = exports.ErrorDiffusionArrayKernel; - // http://www.tannerhelland.com/4660/dithering-eleven-algorithms-source-code/ - var ErrorDiffusionArray = (function () { - function ErrorDiffusionArray(colorDistanceCalculator, kernel, serpentine, minimumColorDistanceToDither, calculateErrorLikeGIMP) { - if (serpentine === void 0) { serpentine = true; } - if (minimumColorDistanceToDither === void 0) { minimumColorDistanceToDither = 0; } - if (calculateErrorLikeGIMP === void 0) { calculateErrorLikeGIMP = false; } - this._setKernel(kernel); - this._distance = colorDistanceCalculator; - this._minColorDistance = minimumColorDistanceToDither; - this._serpentine = serpentine; - this._calculateErrorLikeGIMP = calculateErrorLikeGIMP; - } - // adapted from http://jsbin.com/iXofIji/2/edit by PAEz - // fixed version. it doesn't use image pixels as error storage, also it doesn't have 0.3 + 0.3 + 0.3 + 0.3 = 0 error - ErrorDiffusionArray.prototype.quantize = function (pointBuffer, palette) { - var pointArray = pointBuffer.getPointArray(), originalPoint = new point_1.Point(), width = pointBuffer.getWidth(), height = pointBuffer.getHeight(), errorLines = []; - var dir = 1, maxErrorLines = 1; - // initial error lines (number is taken from dithering kernel) - for (var i = 0; i < this._kernel.length; i++) { - var kernelErrorLines = this._kernel[i][2] + 1; - if (maxErrorLines < kernelErrorLines) - maxErrorLines = kernelErrorLines; - } - for (var i = 0; i < maxErrorLines; i++) { - this._fillErrorLine(errorLines[i] = [], width); - } - for (var y = 0; y < height; y++) { - // always serpentine - if (this._serpentine) - dir = dir * -1; - var lni = y * width, xStart = dir == 1 ? 0 : width - 1, xEnd = dir == 1 ? width : -1; - // cyclic shift with erasing - this._fillErrorLine(errorLines[0], width); - // TODO: why it is needed to cast types here? - errorLines.push(errorLines.shift()); - var errorLine = errorLines[0]; - for (var x = xStart, idx = lni + xStart; x !== xEnd; x += dir, idx += dir) { - // Image pixel - var point = pointArray[idx], - //originalPoint = new Utils.Point(), - error = errorLine[x]; - originalPoint.from(point); - var correctedPoint = point_1.Point.createByRGBA(arithmetic_1.inRange0to255Rounded(point.r + error[0]), arithmetic_1.inRange0to255Rounded(point.g + error[1]), arithmetic_1.inRange0to255Rounded(point.b + error[2]), arithmetic_1.inRange0to255Rounded(point.a + error[3])); - // Reduced pixel - var palettePoint = palette.getNearestColor(this._distance, correctedPoint); - point.from(palettePoint); - // dithering strength - if (this._minColorDistance) { - var dist = this._distance.calculateNormalized(point, palettePoint); - if (dist < this._minColorDistance) - continue; - } - // Component distance - var er = void 0, eg = void 0, eb = void 0, ea = void 0; - if (this._calculateErrorLikeGIMP) { - er = correctedPoint.r - palettePoint.r; - eg = correctedPoint.g - palettePoint.g; - eb = correctedPoint.b - palettePoint.b; - ea = correctedPoint.a - palettePoint.a; - } - else { - er = originalPoint.r - palettePoint.r; - eg = originalPoint.g - palettePoint.g; - eb = originalPoint.b - palettePoint.b; - ea = originalPoint.a - palettePoint.a; - } - var dStart = dir == 1 ? 0 : this._kernel.length - 1, dEnd = dir == 1 ? this._kernel.length : -1; - for (var i = dStart; i !== dEnd; i += dir) { - var x1 = this._kernel[i][1] * dir, y1 = this._kernel[i][2]; - if (x1 + x >= 0 && x1 + x < width && y1 + y >= 0 && y1 + y < height) { - var d = this._kernel[i][0], e = errorLines[y1][x1 + x]; - e[0] = e[0] + er * d; - e[1] = e[1] + eg * d; - e[2] = e[2] + eb * d; - e[3] = e[3] + ea * d; - } - } - } - } - return pointBuffer; - }; - ErrorDiffusionArray.prototype._fillErrorLine = function (errorLine, width) { - // shrink - if (errorLine.length > width) { - errorLine.length = width; - } - // reuse existing arrays - var l = errorLine.length; - for (var i = 0; i < l; i++) { - var error = errorLine[i]; - error[0] = error[1] = error[2] = error[3] = 0; - } - // create missing arrays - for (var i = l; i < width; i++) { - errorLine[i] = [0.0, 0.0, 0.0, 0.0]; - } - }; - ErrorDiffusionArray.prototype._setKernel = function (kernel) { - switch (kernel) { - case ErrorDiffusionArrayKernel.FloydSteinberg: - this._kernel = [ - [7 / 16, 1, 0], - [3 / 16, -1, 1], - [5 / 16, 0, 1], - [1 / 16, 1, 1] - ]; - break; - case ErrorDiffusionArrayKernel.FalseFloydSteinberg: - this._kernel = [ - [3 / 8, 1, 0], - [3 / 8, 0, 1], - [2 / 8, 1, 1] - ]; - break; - case ErrorDiffusionArrayKernel.Stucki: - this._kernel = [ - [8 / 42, 1, 0], - [4 / 42, 2, 0], - [2 / 42, -2, 1], - [4 / 42, -1, 1], - [8 / 42, 0, 1], - [4 / 42, 1, 1], - [2 / 42, 2, 1], - [1 / 42, -2, 2], - [2 / 42, -1, 2], - [4 / 42, 0, 2], - [2 / 42, 1, 2], - [1 / 42, 2, 2] - ]; - break; - case ErrorDiffusionArrayKernel.Atkinson: - this._kernel = [ - [1 / 8, 1, 0], - [1 / 8, 2, 0], - [1 / 8, -1, 1], - [1 / 8, 0, 1], - [1 / 8, 1, 1], - [1 / 8, 0, 2] - ]; - break; - case ErrorDiffusionArrayKernel.Jarvis: - this._kernel = [ - [7 / 48, 1, 0], - [5 / 48, 2, 0], - [3 / 48, -2, 1], - [5 / 48, -1, 1], - [7 / 48, 0, 1], - [5 / 48, 1, 1], - [3 / 48, 2, 1], - [1 / 48, -2, 2], - [3 / 48, -1, 2], - [5 / 48, 0, 2], - [3 / 48, 1, 2], - [1 / 48, 2, 2] - ]; - break; - case ErrorDiffusionArrayKernel.Burkes: - this._kernel = [ - [8 / 32, 1, 0], - [4 / 32, 2, 0], - [2 / 32, -2, 1], - [4 / 32, -1, 1], - [8 / 32, 0, 1], - [4 / 32, 1, 1], - [2 / 32, 2, 1], - ]; - break; - case ErrorDiffusionArrayKernel.Sierra: - this._kernel = [ - [5 / 32, 1, 0], - [3 / 32, 2, 0], - [2 / 32, -2, 1], - [4 / 32, -1, 1], - [5 / 32, 0, 1], - [4 / 32, 1, 1], - [2 / 32, 2, 1], - [2 / 32, -1, 2], - [3 / 32, 0, 2], - [2 / 32, 1, 2] - ]; - break; - case ErrorDiffusionArrayKernel.TwoSierra: - this._kernel = [ - [4 / 16, 1, 0], - [3 / 16, 2, 0], - [1 / 16, -2, 1], - [2 / 16, -1, 1], - [3 / 16, 0, 1], - [2 / 16, 1, 1], - [1 / 16, 2, 1] - ]; - break; - case ErrorDiffusionArrayKernel.SierraLite: - this._kernel = [ - [2 / 4, 1, 0], - [1 / 4, -1, 1], - [1 / 4, 0, 1] - ]; - break; - default: - throw new Error("ErrorDiffusionArray: unknown kernel = " + kernel); - } - }; - return ErrorDiffusionArray; - }()); - exports.ErrorDiffusionArray = ErrorDiffusionArray; - - -/***/ }, -/* 33 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var hilbertCurve_1 = __webpack_require__(34); - var point_1 = __webpack_require__(24); - var arithmetic_1 = __webpack_require__(6); - var ErrorDiffusionRiemersma = (function () { - function ErrorDiffusionRiemersma(colorDistanceCalculator, errorQueueSize, errorPropagation) { - if (errorQueueSize === void 0) { errorQueueSize = 16; } - if (errorPropagation === void 0) { errorPropagation = 1; } - this._distance = colorDistanceCalculator; - this._errorPropagation = errorPropagation; - this._errorQueueSize = errorQueueSize; - this._max = this._errorQueueSize; - this._createWeights(); - } - ErrorDiffusionRiemersma.prototype.quantize = function (pointBuffer, palette) { - var _this = this; - var curve = new hilbertCurve_1.HilbertCurveBase(), pointArray = pointBuffer.getPointArray(), width = pointBuffer.getWidth(), height = pointBuffer.getHeight(), errorQueue = []; - var head = 0; - for (var i = 0; i < this._errorQueueSize; i++) { - errorQueue[i] = { r: 0, g: 0, b: 0, a: 0 }; - } - curve.walk(width, height, function (x, y) { - var p = pointArray[x + y * width]; - var r = p.r, g = p.g, b = p.b, a = p.a; - for (var i = 0; i < _this._errorQueueSize; i++) { - var weight = _this._weights[i], e = errorQueue[(i + head) % _this._errorQueueSize]; - r += e.r * weight; - g += e.g * weight; - b += e.b * weight; - a += e.a * weight; - } - var correctedPoint = point_1.Point.createByRGBA(arithmetic_1.inRange0to255Rounded(r), arithmetic_1.inRange0to255Rounded(g), arithmetic_1.inRange0to255Rounded(b), arithmetic_1.inRange0to255Rounded(a)); - var quantizedPoint = palette.getNearestColor(_this._distance, correctedPoint); - // update head and calculate tail - head = (head + 1) % _this._errorQueueSize; - var tail = (head + _this._errorQueueSize - 1) % _this._errorQueueSize; - // update error with new value - errorQueue[tail].r = p.r - quantizedPoint.r; - errorQueue[tail].g = p.g - quantizedPoint.g; - errorQueue[tail].b = p.b - quantizedPoint.b; - errorQueue[tail].a = p.a - quantizedPoint.a; - // update point - p.from(quantizedPoint); - }); - return pointBuffer; - }; - ErrorDiffusionRiemersma.prototype._createWeights = function () { - this._weights = []; - var multiplier = Math.exp(Math.log(this._max) / (this._errorQueueSize - 1)); - for (var i = 0, next = 1; i < this._errorQueueSize; i++) { - this._weights[i] = (((next + 0.5) | 0) / this._max) * this._errorPropagation; - next *= multiplier; - } - }; - return ErrorDiffusionRiemersma; - }()); - exports.ErrorDiffusionRiemersma = ErrorDiffusionRiemersma; - - -/***/ }, -/* 34 */ -/***/ function(module, exports) { - - "use strict"; - var Direction; - (function (Direction) { - Direction[Direction["NONE"] = 0] = "NONE"; - Direction[Direction["UP"] = 1] = "UP"; - Direction[Direction["LEFT"] = 2] = "LEFT"; - Direction[Direction["RIGHT"] = 3] = "RIGHT"; - Direction[Direction["DOWN"] = 4] = "DOWN"; - })(Direction || (Direction = {})); - // Check code against double-entrance into walk (walk=> callback => walk) - var HilbertCurveBase = (function () { - function HilbertCurveBase() { - } - HilbertCurveBase.prototype.walk = function (width, height, visitorCallback) { - this._x = 0; - this._y = 0; - this._d = 0; - this._width = width; - this._height = height; - this._callback = visitorCallback; - var maxBound = Math.max(width, height); - this._level = (Math.log(maxBound) / Math.log(2) + 1) | 0; - this._walkHilbert(Direction.UP); - this._visit(Direction.NONE); - }; - HilbertCurveBase.prototype._walkHilbert = function (direction) { - if (this._level < 1) - return; - this._level--; - switch (direction) { - case Direction.LEFT: - this._walkHilbert(Direction.UP); - this._visit(Direction.RIGHT); - this._walkHilbert(Direction.LEFT); - this._visit(Direction.DOWN); - this._walkHilbert(Direction.LEFT); - this._visit(Direction.LEFT); - this._walkHilbert(Direction.DOWN); - break; - case Direction.RIGHT: - this._walkHilbert(Direction.DOWN); - this._visit(Direction.LEFT); - this._walkHilbert(Direction.RIGHT); - this._visit(Direction.UP); - this._walkHilbert(Direction.RIGHT); - this._visit(Direction.RIGHT); - this._walkHilbert(Direction.UP); - break; - case Direction.UP: - this._walkHilbert(Direction.LEFT); - this._visit(Direction.DOWN); - this._walkHilbert(Direction.UP); - this._visit(Direction.RIGHT); - this._walkHilbert(Direction.UP); - this._visit(Direction.UP); - this._walkHilbert(Direction.RIGHT); - break; - case Direction.DOWN: - this._walkHilbert(Direction.RIGHT); - this._visit(Direction.UP); - this._walkHilbert(Direction.DOWN); - this._visit(Direction.LEFT); - this._walkHilbert(Direction.DOWN); - this._visit(Direction.DOWN); - this._walkHilbert(Direction.LEFT); - break; - default: - break; - } - this._level++; - }; - HilbertCurveBase.prototype._visit = function (direction) { - if (this._x >= 0 && this._x < this._width && this._y >= 0 && this._y < this._height) { - this._callback(this._x, this._y, this._d); - this._d++; - } - switch (direction) { - case Direction.LEFT: - this._x--; - break; - case Direction.RIGHT: - this._x++; - break; - case Direction.UP: - this._y--; - break; - case Direction.DOWN: - this._y++; - break; - } - }; - return HilbertCurveBase; - }()); - exports.HilbertCurveBase = HilbertCurveBase; - - -/***/ }, -/* 35 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * iq.ts - Image Quantization Library - */ - var ssim_1 = __webpack_require__(36); - exports.SSIM = ssim_1.SSIM; - - -/***/ }, -/* 36 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - var bt709_1 = __webpack_require__(2); - // based on https://github.com/rhys-e/structural-similarity - // http://en.wikipedia.org/wiki/Structural_similarity - var K1 = 0.01, K2 = 0.03; - var SSIM = (function () { - function SSIM() { - } - SSIM.prototype.compare = function (image1, image2) { - if (image1.getHeight() !== image2.getHeight() || image1.getWidth() !== image2.getWidth()) { - throw new Error("Images have different sizes!"); - } - var bitsPerComponent = 8, L = (1 << bitsPerComponent) - 1, c1 = Math.pow((K1 * L), 2), c2 = Math.pow((K2 * L), 2); - var numWindows = 0, mssim = 0.0; - //calculate ssim for each window - this._iterate(image1, image2, function (lumaValues1, lumaValues2, averageLumaValue1, averageLumaValue2) { - //calculate variance and covariance - var sigxy = 0.0, sigsqx = 0.0, sigsqy = 0.0; - for (var i = 0; i < lumaValues1.length; i++) { - sigsqx += Math.pow((lumaValues1[i] - averageLumaValue1), 2); - sigsqy += Math.pow((lumaValues2[i] - averageLumaValue2), 2); - sigxy += (lumaValues1[i] - averageLumaValue1) * (lumaValues2[i] - averageLumaValue2); - } - var numPixelsInWin = lumaValues1.length - 1; - sigsqx /= numPixelsInWin; - sigsqy /= numPixelsInWin; - sigxy /= numPixelsInWin; - //perform ssim calculation on window - var numerator = (2 * averageLumaValue1 * averageLumaValue2 + c1) * (2 * sigxy + c2), denominator = (Math.pow(averageLumaValue1, 2) + Math.pow(averageLumaValue2, 2) + c1) * (sigsqx + sigsqy + c2), ssim = numerator / denominator; - mssim += ssim; - numWindows++; - }); - return mssim / numWindows; - }; - SSIM.prototype._iterate = function (image1, image2, callback) { - var windowSize = 8, width = image1.getWidth(), height = image1.getHeight(); - for (var y = 0; y < height; y += windowSize) { - for (var x = 0; x < width; x += windowSize) { - // avoid out-of-width/height - var windowWidth = Math.min(windowSize, width - x), windowHeight = Math.min(windowSize, height - y); - var lumaValues1 = this._calculateLumaValuesForWindow(image1, x, y, windowWidth, windowHeight), lumaValues2 = this._calculateLumaValuesForWindow(image2, x, y, windowWidth, windowHeight), averageLuma1 = this._calculateAverageLuma(lumaValues1), averageLuma2 = this._calculateAverageLuma(lumaValues2); - callback(lumaValues1, lumaValues2, averageLuma1, averageLuma2); - } - } - }; - SSIM.prototype._calculateLumaValuesForWindow = function (image, x, y, width, height) { - var pointArray = image.getPointArray(), lumaValues = []; - var counter = 0; - for (var j = y; j < y + height; j++) { - var offset = j * image.getWidth(); - for (var i = x; i < x + width; i++) { - var point = pointArray[offset + i]; - lumaValues[counter] = point.r * bt709_1.Y.RED + point.g * bt709_1.Y.GREEN + point.b * bt709_1.Y.BLUE; - counter++; - } - } - return lumaValues; - }; - SSIM.prototype._calculateAverageLuma = function (lumaValues) { - var sumLuma = 0.0; - for (var i = 0; i < lumaValues.length; i++) { - sumLuma += lumaValues[i]; - } - return sumLuma / lumaValues.length; - }; - return SSIM; - }()); - exports.SSIM = SSIM; - - -/***/ }, -/* 37 */ -/***/ function(module, exports, __webpack_require__) { - - "use strict"; - /** - * @preserve - * Copyright 2015-2016 Igor Bezkrovnyi - * All rights reserved. (MIT Licensed) - * - * iq.ts - Image Quantization Library - */ - var arithmetic = __webpack_require__(6); - exports.arithmetic = arithmetic; - var hueStatistics_1 = __webpack_require__(28); - exports.HueStatistics = hueStatistics_1.HueStatistics; - var palette_1 = __webpack_require__(22); - exports.Palette = palette_1.Palette; - var point_1 = __webpack_require__(24); - exports.Point = point_1.Point; - var pointContainer_1 = __webpack_require__(23); - exports.PointContainer = pointContainer_1.PointContainer; - - -/***/ } -/******/ ]) -}); -; - -},{}],75:[function(require,module,exports){ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }) - } - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } - } -} - -},{}],76:[function(require,module,exports){ -/*! - * Determine if an object is a Buffer - * - * @author Feross Aboukhadijeh - * @license MIT - */ - -// The _isBuffer check is for Safari 5-7 support, because it's missing -// Object.prototype.constructor. Remove this eventually -module.exports = function (obj) { - return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) -} - -function isBuffer (obj) { - return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) -} - -// For Node v0.10 support. Remove this eventually. -function isSlowBuffer (obj) { - return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) -} - -},{}],77:[function(require,module,exports){ -'use strict'; - -var fnToStr = Function.prototype.toString; - -var constructorRegex = /^\s*class\b/; -var isES6ClassFn = function isES6ClassFunction(value) { - try { - var fnStr = fnToStr.call(value); - return constructorRegex.test(fnStr); - } catch (e) { - return false; // not a function - } -}; - -var tryFunctionObject = function tryFunctionToStr(value) { - try { - if (isES6ClassFn(value)) { return false; } - fnToStr.call(value); - return true; - } catch (e) { - return false; - } -}; -var toStr = Object.prototype.toString; -var fnClass = '[object Function]'; -var genClass = '[object GeneratorFunction]'; -var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; - -module.exports = function isCallable(value) { - if (!value) { return false; } - if (typeof value !== 'function' && typeof value !== 'object') { return false; } - if (typeof value === 'function' && !value.prototype) { return true; } - if (hasToStringTag) { return tryFunctionObject(value); } - if (isES6ClassFn(value)) { return false; } - var strClass = toStr.call(value); - return strClass === fnClass || strClass === genClass; -}; - -},{}],78:[function(require,module,exports){ -module.exports = isFunction - -var toString = Object.prototype.toString - -function isFunction (fn) { - var string = toString.call(fn) - return string === '[object Function]' || - (typeof fn === 'function' && string !== '[object RegExp]') || - (typeof window !== 'undefined' && - // IE8 and below - (fn === window.setTimeout || - fn === window.alert || - fn === window.confirm || - fn === window.prompt)) -}; - -},{}],79:[function(require,module,exports){ -var toString = {}.toString; - -module.exports = Array.isArray || function (arr) { - return toString.call(arr) == '[object Array]'; -}; - -},{}],80:[function(require,module,exports){ -var encode = require('./lib/encoder'), - decode = require('./lib/decoder'); - -module.exports = { - encode: encode, - decode: decode -}; - -},{"./lib/decoder":81,"./lib/encoder":82}],81:[function(require,module,exports){ -(function (Buffer){ -/* -*- tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- / -/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ -/* - Copyright 2011 notmasteryet - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -// - The JPEG specification can be found in the ITU CCITT Recommendation T.81 -// (www.w3.org/Graphics/JPEG/itu-t81.pdf) -// - The JFIF specification can be found in the JPEG File Interchange Format -// (www.w3.org/Graphics/JPEG/jfif3.pdf) -// - The Adobe Application-Specific JPEG markers in the Supporting the DCT Filters -// in PostScript Level 2, Technical Note #5116 -// (partners.adobe.com/public/developer/en/ps/sdk/5116.DCT_Filter.pdf) - -var JpegImage = (function jpegImage() { - "use strict"; - var dctZigZag = new Int32Array([ - 0, - 1, 8, - 16, 9, 2, - 3, 10, 17, 24, - 32, 25, 18, 11, 4, - 5, 12, 19, 26, 33, 40, - 48, 41, 34, 27, 20, 13, 6, - 7, 14, 21, 28, 35, 42, 49, 56, - 57, 50, 43, 36, 29, 22, 15, - 23, 30, 37, 44, 51, 58, - 59, 52, 45, 38, 31, - 39, 46, 53, 60, - 61, 54, 47, - 55, 62, - 63 - ]); - - var dctCos1 = 4017 // cos(pi/16) - var dctSin1 = 799 // sin(pi/16) - var dctCos3 = 3406 // cos(3*pi/16) - var dctSin3 = 2276 // sin(3*pi/16) - var dctCos6 = 1567 // cos(6*pi/16) - var dctSin6 = 3784 // sin(6*pi/16) - var dctSqrt2 = 5793 // sqrt(2) - var dctSqrt1d2 = 2896 // sqrt(2) / 2 - - function constructor() { - } - - function buildHuffmanTable(codeLengths, values) { - var k = 0, code = [], i, j, length = 16; - while (length > 0 && !codeLengths[length - 1]) - length--; - code.push({children: [], index: 0}); - var p = code[0], q; - for (i = 0; i < length; i++) { - for (j = 0; j < codeLengths[i]; j++) { - p = code.pop(); - p.children[p.index] = values[k]; - while (p.index > 0) { - if (code.length === 0) - throw new Error('Could not recreate Huffman Table'); - p = code.pop(); - } - p.index++; - code.push(p); - while (code.length <= i) { - code.push(q = {children: [], index: 0}); - p.children[p.index] = q.children; - p = q; - } - k++; - } - if (i + 1 < length) { - // p here points to last code - code.push(q = {children: [], index: 0}); - p.children[p.index] = q.children; - p = q; - } - } - return code[0].children; - } - - function decodeScan(data, offset, - frame, components, resetInterval, - spectralStart, spectralEnd, - successivePrev, successive, opts) { - var precision = frame.precision; - var samplesPerLine = frame.samplesPerLine; - var scanLines = frame.scanLines; - var mcusPerLine = frame.mcusPerLine; - var progressive = frame.progressive; - var maxH = frame.maxH, maxV = frame.maxV; - - var startOffset = offset, bitsData = 0, bitsCount = 0; - function readBit() { - if (bitsCount > 0) { - bitsCount--; - return (bitsData >> bitsCount) & 1; - } - bitsData = data[offset++]; - if (bitsData == 0xFF) { - var nextByte = data[offset++]; - if (nextByte) { - throw new Error("unexpected marker: " + ((bitsData << 8) | nextByte).toString(16)); - } - // unstuff 0 - } - bitsCount = 7; - return bitsData >>> 7; - } - function decodeHuffman(tree) { - var node = tree, bit; - while ((bit = readBit()) !== null) { - node = node[bit]; - if (typeof node === 'number') - return node; - if (typeof node !== 'object') - throw new Error("invalid huffman sequence"); - } - return null; - } - function receive(length) { - var n = 0; - while (length > 0) { - var bit = readBit(); - if (bit === null) return; - n = (n << 1) | bit; - length--; - } - return n; - } - function receiveAndExtend(length) { - var n = receive(length); - if (n >= 1 << (length - 1)) - return n; - return n + (-1 << length) + 1; - } - function decodeBaseline(component, zz) { - var t = decodeHuffman(component.huffmanTableDC); - var diff = t === 0 ? 0 : receiveAndExtend(t); - zz[0]= (component.pred += diff); - var k = 1; - while (k < 64) { - var rs = decodeHuffman(component.huffmanTableAC); - var s = rs & 15, r = rs >> 4; - if (s === 0) { - if (r < 15) - break; - k += 16; - continue; - } - k += r; - var z = dctZigZag[k]; - zz[z] = receiveAndExtend(s); - k++; - } - } - function decodeDCFirst(component, zz) { - var t = decodeHuffman(component.huffmanTableDC); - var diff = t === 0 ? 0 : (receiveAndExtend(t) << successive); - zz[0] = (component.pred += diff); - } - function decodeDCSuccessive(component, zz) { - zz[0] |= readBit() << successive; - } - var eobrun = 0; - function decodeACFirst(component, zz) { - if (eobrun > 0) { - eobrun--; - return; - } - var k = spectralStart, e = spectralEnd; - while (k <= e) { - var rs = decodeHuffman(component.huffmanTableAC); - var s = rs & 15, r = rs >> 4; - if (s === 0) { - if (r < 15) { - eobrun = receive(r) + (1 << r) - 1; - break; - } - k += 16; - continue; - } - k += r; - var z = dctZigZag[k]; - zz[z] = receiveAndExtend(s) * (1 << successive); - k++; - } - } - var successiveACState = 0, successiveACNextValue; - function decodeACSuccessive(component, zz) { - var k = spectralStart, e = spectralEnd, r = 0; - while (k <= e) { - var z = dctZigZag[k]; - var direction = zz[z] < 0 ? -1 : 1; - switch (successiveACState) { - case 0: // initial state - var rs = decodeHuffman(component.huffmanTableAC); - var s = rs & 15, r = rs >> 4; - if (s === 0) { - if (r < 15) { - eobrun = receive(r) + (1 << r); - successiveACState = 4; - } else { - r = 16; - successiveACState = 1; - } - } else { - if (s !== 1) - throw new Error("invalid ACn encoding"); - successiveACNextValue = receiveAndExtend(s); - successiveACState = r ? 2 : 3; - } - continue; - case 1: // skipping r zero items - case 2: - if (zz[z]) - zz[z] += (readBit() << successive) * direction; - else { - r--; - if (r === 0) - successiveACState = successiveACState == 2 ? 3 : 0; - } - break; - case 3: // set value for a zero item - if (zz[z]) - zz[z] += (readBit() << successive) * direction; - else { - zz[z] = successiveACNextValue << successive; - successiveACState = 0; - } - break; - case 4: // eob - if (zz[z]) - zz[z] += (readBit() << successive) * direction; - break; - } - k++; - } - if (successiveACState === 4) { - eobrun--; - if (eobrun === 0) - successiveACState = 0; - } - } - function decodeMcu(component, decode, mcu, row, col) { - var mcuRow = (mcu / mcusPerLine) | 0; - var mcuCol = mcu % mcusPerLine; - var blockRow = mcuRow * component.v + row; - var blockCol = mcuCol * component.h + col; - // If the block is missing and we're in tolerant mode, just skip it. - if (component.blocks[blockRow] === undefined && opts.tolerantDecoding) - return; - decode(component, component.blocks[blockRow][blockCol]); - } - function decodeBlock(component, decode, mcu) { - var blockRow = (mcu / component.blocksPerLine) | 0; - var blockCol = mcu % component.blocksPerLine; - // If the block is missing and we're in tolerant mode, just skip it. - if (component.blocks[blockRow] === undefined && opts.tolerantDecoding) - return; - decode(component, component.blocks[blockRow][blockCol]); - } - - var componentsLength = components.length; - var component, i, j, k, n; - var decodeFn; - if (progressive) { - if (spectralStart === 0) - decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive; - else - decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive; - } else { - decodeFn = decodeBaseline; - } - - var mcu = 0, marker; - var mcuExpected; - if (componentsLength == 1) { - mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn; - } else { - mcuExpected = mcusPerLine * frame.mcusPerColumn; - } - if (!resetInterval) resetInterval = mcuExpected; - - var h, v; - while (mcu < mcuExpected) { - // reset interval stuff - for (i = 0; i < componentsLength; i++) - components[i].pred = 0; - eobrun = 0; - - if (componentsLength == 1) { - component = components[0]; - for (n = 0; n < resetInterval; n++) { - decodeBlock(component, decodeFn, mcu); - mcu++; - } - } else { - for (n = 0; n < resetInterval; n++) { - for (i = 0; i < componentsLength; i++) { - component = components[i]; - h = component.h; - v = component.v; - for (j = 0; j < v; j++) { - for (k = 0; k < h; k++) { - decodeMcu(component, decodeFn, mcu, j, k); - } - } - } - mcu++; - - // If we've reached our expected MCU's, stop decoding - if (mcu === mcuExpected) break; - } - } - - if (mcu === mcuExpected) { - // Skip trailing bytes at the end of the scan - until we reach the next marker - do { - if (data[offset] === 0xFF) { - if (data[offset + 1] !== 0x00) { - break; - } - } - offset += 1; - } while (offset < data.length - 2); - } - - // find marker - bitsCount = 0; - marker = (data[offset] << 8) | data[offset + 1]; - if (marker < 0xFF00) { - throw new Error("marker was not found"); - } - - if (marker >= 0xFFD0 && marker <= 0xFFD7) { // RSTx - offset += 2; - } - else - break; - } - - return offset - startOffset; - } - - function buildComponentData(frame, component) { - var lines = []; - var blocksPerLine = component.blocksPerLine; - var blocksPerColumn = component.blocksPerColumn; - var samplesPerLine = blocksPerLine << 3; - // Only 1 used per invocation of this function and garbage collected after invocation, so no need to account for its memory footprint. - var R = new Int32Array(64), r = new Uint8Array(64); - - // A port of poppler's IDCT method which in turn is taken from: - // Christoph Loeffler, Adriaan Ligtenberg, George S. Moschytz, - // "Practical Fast 1-D DCT Algorithms with 11 Multiplications", - // IEEE Intl. Conf. on Acoustics, Speech & Signal Processing, 1989, - // 988-991. - function quantizeAndInverse(zz, dataOut, dataIn) { - var qt = component.quantizationTable; - var v0, v1, v2, v3, v4, v5, v6, v7, t; - var p = dataIn; - var i; - - // dequant - for (i = 0; i < 64; i++) - p[i] = zz[i] * qt[i]; - - // inverse DCT on rows - for (i = 0; i < 8; ++i) { - var row = 8 * i; - - // check for all-zero AC coefficients - if (p[1 + row] == 0 && p[2 + row] == 0 && p[3 + row] == 0 && - p[4 + row] == 0 && p[5 + row] == 0 && p[6 + row] == 0 && - p[7 + row] == 0) { - t = (dctSqrt2 * p[0 + row] + 512) >> 10; - p[0 + row] = t; - p[1 + row] = t; - p[2 + row] = t; - p[3 + row] = t; - p[4 + row] = t; - p[5 + row] = t; - p[6 + row] = t; - p[7 + row] = t; - continue; - } - - // stage 4 - v0 = (dctSqrt2 * p[0 + row] + 128) >> 8; - v1 = (dctSqrt2 * p[4 + row] + 128) >> 8; - v2 = p[2 + row]; - v3 = p[6 + row]; - v4 = (dctSqrt1d2 * (p[1 + row] - p[7 + row]) + 128) >> 8; - v7 = (dctSqrt1d2 * (p[1 + row] + p[7 + row]) + 128) >> 8; - v5 = p[3 + row] << 4; - v6 = p[5 + row] << 4; - - // stage 3 - t = (v0 - v1+ 1) >> 1; - v0 = (v0 + v1 + 1) >> 1; - v1 = t; - t = (v2 * dctSin6 + v3 * dctCos6 + 128) >> 8; - v2 = (v2 * dctCos6 - v3 * dctSin6 + 128) >> 8; - v3 = t; - t = (v4 - v6 + 1) >> 1; - v4 = (v4 + v6 + 1) >> 1; - v6 = t; - t = (v7 + v5 + 1) >> 1; - v5 = (v7 - v5 + 1) >> 1; - v7 = t; - - // stage 2 - t = (v0 - v3 + 1) >> 1; - v0 = (v0 + v3 + 1) >> 1; - v3 = t; - t = (v1 - v2 + 1) >> 1; - v1 = (v1 + v2 + 1) >> 1; - v2 = t; - t = (v4 * dctSin3 + v7 * dctCos3 + 2048) >> 12; - v4 = (v4 * dctCos3 - v7 * dctSin3 + 2048) >> 12; - v7 = t; - t = (v5 * dctSin1 + v6 * dctCos1 + 2048) >> 12; - v5 = (v5 * dctCos1 - v6 * dctSin1 + 2048) >> 12; - v6 = t; - - // stage 1 - p[0 + row] = v0 + v7; - p[7 + row] = v0 - v7; - p[1 + row] = v1 + v6; - p[6 + row] = v1 - v6; - p[2 + row] = v2 + v5; - p[5 + row] = v2 - v5; - p[3 + row] = v3 + v4; - p[4 + row] = v3 - v4; - } - - // inverse DCT on columns - for (i = 0; i < 8; ++i) { - var col = i; - - // check for all-zero AC coefficients - if (p[1*8 + col] == 0 && p[2*8 + col] == 0 && p[3*8 + col] == 0 && - p[4*8 + col] == 0 && p[5*8 + col] == 0 && p[6*8 + col] == 0 && - p[7*8 + col] == 0) { - t = (dctSqrt2 * dataIn[i+0] + 8192) >> 14; - p[0*8 + col] = t; - p[1*8 + col] = t; - p[2*8 + col] = t; - p[3*8 + col] = t; - p[4*8 + col] = t; - p[5*8 + col] = t; - p[6*8 + col] = t; - p[7*8 + col] = t; - continue; - } - - // stage 4 - v0 = (dctSqrt2 * p[0*8 + col] + 2048) >> 12; - v1 = (dctSqrt2 * p[4*8 + col] + 2048) >> 12; - v2 = p[2*8 + col]; - v3 = p[6*8 + col]; - v4 = (dctSqrt1d2 * (p[1*8 + col] - p[7*8 + col]) + 2048) >> 12; - v7 = (dctSqrt1d2 * (p[1*8 + col] + p[7*8 + col]) + 2048) >> 12; - v5 = p[3*8 + col]; - v6 = p[5*8 + col]; - - // stage 3 - t = (v0 - v1 + 1) >> 1; - v0 = (v0 + v1 + 1) >> 1; - v1 = t; - t = (v2 * dctSin6 + v3 * dctCos6 + 2048) >> 12; - v2 = (v2 * dctCos6 - v3 * dctSin6 + 2048) >> 12; - v3 = t; - t = (v4 - v6 + 1) >> 1; - v4 = (v4 + v6 + 1) >> 1; - v6 = t; - t = (v7 + v5 + 1) >> 1; - v5 = (v7 - v5 + 1) >> 1; - v7 = t; - - // stage 2 - t = (v0 - v3 + 1) >> 1; - v0 = (v0 + v3 + 1) >> 1; - v3 = t; - t = (v1 - v2 + 1) >> 1; - v1 = (v1 + v2 + 1) >> 1; - v2 = t; - t = (v4 * dctSin3 + v7 * dctCos3 + 2048) >> 12; - v4 = (v4 * dctCos3 - v7 * dctSin3 + 2048) >> 12; - v7 = t; - t = (v5 * dctSin1 + v6 * dctCos1 + 2048) >> 12; - v5 = (v5 * dctCos1 - v6 * dctSin1 + 2048) >> 12; - v6 = t; - - // stage 1 - p[0*8 + col] = v0 + v7; - p[7*8 + col] = v0 - v7; - p[1*8 + col] = v1 + v6; - p[6*8 + col] = v1 - v6; - p[2*8 + col] = v2 + v5; - p[5*8 + col] = v2 - v5; - p[3*8 + col] = v3 + v4; - p[4*8 + col] = v3 - v4; - } - - // convert to 8-bit integers - for (i = 0; i < 64; ++i) { - var sample = 128 + ((p[i] + 8) >> 4); - dataOut[i] = sample < 0 ? 0 : sample > 0xFF ? 0xFF : sample; - } - } - - requestMemoryAllocation(samplesPerLine * blocksPerColumn * 8); - - var i, j; - for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) { - var scanLine = blockRow << 3; - for (i = 0; i < 8; i++) - lines.push(new Uint8Array(samplesPerLine)); - for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) { - quantizeAndInverse(component.blocks[blockRow][blockCol], r, R); - - var offset = 0, sample = blockCol << 3; - for (j = 0; j < 8; j++) { - var line = lines[scanLine + j]; - for (i = 0; i < 8; i++) - line[sample + i] = r[offset++]; - } - } - } - return lines; - } - - function clampTo8bit(a) { - return a < 0 ? 0 : a > 255 ? 255 : a; - } - - constructor.prototype = { - load: function load(path) { - var xhr = new XMLHttpRequest(); - xhr.open("GET", path, true); - xhr.responseType = "arraybuffer"; - xhr.onload = (function() { - // TODO catch parse error - var data = new Uint8Array(xhr.response || xhr.mozResponseArrayBuffer); - this.parse(data); - if (this.onload) - this.onload(); - }).bind(this); - xhr.send(null); - }, - parse: function parse(data) { - var maxResolutionInPixels = this.opts.maxResolutionInMP * 1000 * 1000; - var offset = 0, length = data.length; - function readUint16() { - var value = (data[offset] << 8) | data[offset + 1]; - offset += 2; - return value; - } - function readDataBlock() { - var length = readUint16(); - var array = data.subarray(offset, offset + length - 2); - offset += array.length; - return array; - } - function prepareComponents(frame) { - // According to the JPEG standard, the sampling factor must be between 1 and 4 - // See https://github.com/libjpeg-turbo/libjpeg-turbo/blob/9abeff46d87bd201a952e276f3e4339556a403a3/libjpeg.txt#L1138-L1146 - var maxH = 1, maxV = 1; - var component, componentId; - for (componentId in frame.components) { - if (frame.components.hasOwnProperty(componentId)) { - component = frame.components[componentId]; - if (maxH < component.h) maxH = component.h; - if (maxV < component.v) maxV = component.v; - } - } - var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / maxH); - var mcusPerColumn = Math.ceil(frame.scanLines / 8 / maxV); - for (componentId in frame.components) { - if (frame.components.hasOwnProperty(componentId)) { - component = frame.components[componentId]; - var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / maxH); - var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / maxV); - var blocksPerLineForMcu = mcusPerLine * component.h; - var blocksPerColumnForMcu = mcusPerColumn * component.v; - var blocksToAllocate = blocksPerColumnForMcu * blocksPerLineForMcu; - var blocks = []; - - // Each block is a Int32Array of length 64 (4 x 64 = 256 bytes) - requestMemoryAllocation(blocksToAllocate * 256); - - for (var i = 0; i < blocksPerColumnForMcu; i++) { - var row = []; - for (var j = 0; j < blocksPerLineForMcu; j++) - row.push(new Int32Array(64)); - blocks.push(row); - } - component.blocksPerLine = blocksPerLine; - component.blocksPerColumn = blocksPerColumn; - component.blocks = blocks; - } - } - frame.maxH = maxH; - frame.maxV = maxV; - frame.mcusPerLine = mcusPerLine; - frame.mcusPerColumn = mcusPerColumn; - } - var jfif = null; - var adobe = null; - var pixels = null; - var frame, resetInterval; - var quantizationTables = [], frames = []; - var huffmanTablesAC = [], huffmanTablesDC = []; - var fileMarker = readUint16(); - var malformedDataOffset = -1; - this.comments = []; - if (fileMarker != 0xFFD8) { // SOI (Start of Image) - throw new Error("SOI not found"); - } - - fileMarker = readUint16(); - while (fileMarker != 0xFFD9) { // EOI (End of image) - var i, j, l; - switch(fileMarker) { - case 0xFF00: break; - case 0xFFE0: // APP0 (Application Specific) - case 0xFFE1: // APP1 - case 0xFFE2: // APP2 - case 0xFFE3: // APP3 - case 0xFFE4: // APP4 - case 0xFFE5: // APP5 - case 0xFFE6: // APP6 - case 0xFFE7: // APP7 - case 0xFFE8: // APP8 - case 0xFFE9: // APP9 - case 0xFFEA: // APP10 - case 0xFFEB: // APP11 - case 0xFFEC: // APP12 - case 0xFFED: // APP13 - case 0xFFEE: // APP14 - case 0xFFEF: // APP15 - case 0xFFFE: // COM (Comment) - var appData = readDataBlock(); - - if (fileMarker === 0xFFFE) { - var comment = String.fromCharCode.apply(null, appData); - this.comments.push(comment); - } - - if (fileMarker === 0xFFE0) { - if (appData[0] === 0x4A && appData[1] === 0x46 && appData[2] === 0x49 && - appData[3] === 0x46 && appData[4] === 0) { // 'JFIF\x00' - jfif = { - version: { major: appData[5], minor: appData[6] }, - densityUnits: appData[7], - xDensity: (appData[8] << 8) | appData[9], - yDensity: (appData[10] << 8) | appData[11], - thumbWidth: appData[12], - thumbHeight: appData[13], - thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13]) - }; - } - } - // TODO APP1 - Exif - if (fileMarker === 0xFFE1) { - if (appData[0] === 0x45 && - appData[1] === 0x78 && - appData[2] === 0x69 && - appData[3] === 0x66 && - appData[4] === 0) { // 'EXIF\x00' - this.exifBuffer = appData.subarray(5, appData.length); - } - } - - if (fileMarker === 0xFFEE) { - if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6F && - appData[3] === 0x62 && appData[4] === 0x65 && appData[5] === 0) { // 'Adobe\x00' - adobe = { - version: appData[6], - flags0: (appData[7] << 8) | appData[8], - flags1: (appData[9] << 8) | appData[10], - transformCode: appData[11] - }; - } - } - break; - - case 0xFFDB: // DQT (Define Quantization Tables) - var quantizationTablesLength = readUint16(); - var quantizationTablesEnd = quantizationTablesLength + offset - 2; - while (offset < quantizationTablesEnd) { - var quantizationTableSpec = data[offset++]; - requestMemoryAllocation(64 * 4); - var tableData = new Int32Array(64); - if ((quantizationTableSpec >> 4) === 0) { // 8 bit values - for (j = 0; j < 64; j++) { - var z = dctZigZag[j]; - tableData[z] = data[offset++]; - } - } else if ((quantizationTableSpec >> 4) === 1) { //16 bit - for (j = 0; j < 64; j++) { - var z = dctZigZag[j]; - tableData[z] = readUint16(); - } - } else - throw new Error("DQT: invalid table spec"); - quantizationTables[quantizationTableSpec & 15] = tableData; - } - break; - - case 0xFFC0: // SOF0 (Start of Frame, Baseline DCT) - case 0xFFC1: // SOF1 (Start of Frame, Extended DCT) - case 0xFFC2: // SOF2 (Start of Frame, Progressive DCT) - readUint16(); // skip data length - frame = {}; - frame.extended = (fileMarker === 0xFFC1); - frame.progressive = (fileMarker === 0xFFC2); - frame.precision = data[offset++]; - frame.scanLines = readUint16(); - frame.samplesPerLine = readUint16(); - frame.components = {}; - frame.componentsOrder = []; - - var pixelsInFrame = frame.scanLines * frame.samplesPerLine; - if (pixelsInFrame > maxResolutionInPixels) { - var exceededAmount = Math.ceil((pixelsInFrame - maxResolutionInPixels) / 1e6); - throw new Error(`maxResolutionInMP limit exceeded by ${exceededAmount}MP`); - } - - var componentsCount = data[offset++], componentId; - var maxH = 0, maxV = 0; - for (i = 0; i < componentsCount; i++) { - componentId = data[offset]; - var h = data[offset + 1] >> 4; - var v = data[offset + 1] & 15; - var qId = data[offset + 2]; - - if ( h <= 0 || v <= 0 ) { - throw new Error('Invalid sampling factor, expected values above 0'); - } - - frame.componentsOrder.push(componentId); - frame.components[componentId] = { - h: h, - v: v, - quantizationIdx: qId - }; - offset += 3; - } - prepareComponents(frame); - frames.push(frame); - break; - - case 0xFFC4: // DHT (Define Huffman Tables) - var huffmanLength = readUint16(); - for (i = 2; i < huffmanLength;) { - var huffmanTableSpec = data[offset++]; - var codeLengths = new Uint8Array(16); - var codeLengthSum = 0; - for (j = 0; j < 16; j++, offset++) { - codeLengthSum += (codeLengths[j] = data[offset]); - } - requestMemoryAllocation(16 + codeLengthSum); - var huffmanValues = new Uint8Array(codeLengthSum); - for (j = 0; j < codeLengthSum; j++, offset++) - huffmanValues[j] = data[offset]; - i += 17 + codeLengthSum; - - ((huffmanTableSpec >> 4) === 0 ? - huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = - buildHuffmanTable(codeLengths, huffmanValues); - } - break; - - case 0xFFDD: // DRI (Define Restart Interval) - readUint16(); // skip data length - resetInterval = readUint16(); - break; - - case 0xFFDC: // Number of Lines marker - readUint16() // skip data length - readUint16() // Ignore this data since it represents the image height - break; - - case 0xFFDA: // SOS (Start of Scan) - var scanLength = readUint16(); - var selectorsCount = data[offset++]; - var components = [], component; - for (i = 0; i < selectorsCount; i++) { - component = frame.components[data[offset++]]; - var tableSpec = data[offset++]; - component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4]; - component.huffmanTableAC = huffmanTablesAC[tableSpec & 15]; - components.push(component); - } - var spectralStart = data[offset++]; - var spectralEnd = data[offset++]; - var successiveApproximation = data[offset++]; - var processed = decodeScan(data, offset, - frame, components, resetInterval, - spectralStart, spectralEnd, - successiveApproximation >> 4, successiveApproximation & 15, this.opts); - offset += processed; - break; - - case 0xFFFF: // Fill bytes - if (data[offset] !== 0xFF) { // Avoid skipping a valid marker. - offset--; - } - break; - default: - if (data[offset - 3] == 0xFF && - data[offset - 2] >= 0xC0 && data[offset - 2] <= 0xFE) { - // could be incorrect encoding -- last 0xFF byte of the previous - // block was eaten by the encoder - offset -= 3; - break; - } - else if (fileMarker === 0xE0 || fileMarker == 0xE1) { - // Recover from malformed APP1 markers popular in some phone models. - // See https://github.com/eugeneware/jpeg-js/issues/82 - if (malformedDataOffset !== -1) { - throw new Error(`first unknown JPEG marker at offset ${malformedDataOffset.toString(16)}, second unknown JPEG marker ${fileMarker.toString(16)} at offset ${(offset - 1).toString(16)}`); - } - malformedDataOffset = offset - 1; - const nextOffset = readUint16(); - if (data[offset + nextOffset - 2] === 0xFF) { - offset += nextOffset - 2; - break; - } - } - throw new Error("unknown JPEG marker " + fileMarker.toString(16)); - } - fileMarker = readUint16(); - } - if (frames.length != 1) - throw new Error("only single frame JPEGs supported"); - - // set each frame's components quantization table - for (var i = 0; i < frames.length; i++) { - var cp = frames[i].components; - for (var j in cp) { - cp[j].quantizationTable = quantizationTables[cp[j].quantizationIdx]; - delete cp[j].quantizationIdx; - } - } - - this.width = frame.samplesPerLine; - this.height = frame.scanLines; - this.jfif = jfif; - this.adobe = adobe; - this.components = []; - for (var i = 0; i < frame.componentsOrder.length; i++) { - var component = frame.components[frame.componentsOrder[i]]; - this.components.push({ - lines: buildComponentData(frame, component), - scaleX: component.h / frame.maxH, - scaleY: component.v / frame.maxV - }); - } - }, - getData: function getData(width, height) { - var scaleX = this.width / width, scaleY = this.height / height; - - var component1, component2, component3, component4; - var component1Line, component2Line, component3Line, component4Line; - var x, y; - var offset = 0; - var Y, Cb, Cr, K, C, M, Ye, R, G, B; - var colorTransform; - var dataLength = width * height * this.components.length; - requestMemoryAllocation(dataLength); - var data = new Uint8Array(dataLength); - switch (this.components.length) { - case 1: - component1 = this.components[0]; - for (y = 0; y < height; y++) { - component1Line = component1.lines[0 | (y * component1.scaleY * scaleY)]; - for (x = 0; x < width; x++) { - Y = component1Line[0 | (x * component1.scaleX * scaleX)]; - - data[offset++] = Y; - } - } - break; - case 2: - // PDF might compress two component data in custom colorspace - component1 = this.components[0]; - component2 = this.components[1]; - for (y = 0; y < height; y++) { - component1Line = component1.lines[0 | (y * component1.scaleY * scaleY)]; - component2Line = component2.lines[0 | (y * component2.scaleY * scaleY)]; - for (x = 0; x < width; x++) { - Y = component1Line[0 | (x * component1.scaleX * scaleX)]; - data[offset++] = Y; - Y = component2Line[0 | (x * component2.scaleX * scaleX)]; - data[offset++] = Y; - } - } - break; - case 3: - // The default transform for three components is true - colorTransform = true; - // The adobe transform marker overrides any previous setting - if (this.adobe && this.adobe.transformCode) - colorTransform = true; - else if (typeof this.opts.colorTransform !== 'undefined') - colorTransform = !!this.opts.colorTransform; - - component1 = this.components[0]; - component2 = this.components[1]; - component3 = this.components[2]; - for (y = 0; y < height; y++) { - component1Line = component1.lines[0 | (y * component1.scaleY * scaleY)]; - component2Line = component2.lines[0 | (y * component2.scaleY * scaleY)]; - component3Line = component3.lines[0 | (y * component3.scaleY * scaleY)]; - for (x = 0; x < width; x++) { - if (!colorTransform) { - R = component1Line[0 | (x * component1.scaleX * scaleX)]; - G = component2Line[0 | (x * component2.scaleX * scaleX)]; - B = component3Line[0 | (x * component3.scaleX * scaleX)]; - } else { - Y = component1Line[0 | (x * component1.scaleX * scaleX)]; - Cb = component2Line[0 | (x * component2.scaleX * scaleX)]; - Cr = component3Line[0 | (x * component3.scaleX * scaleX)]; - - R = clampTo8bit(Y + 1.402 * (Cr - 128)); - G = clampTo8bit(Y - 0.3441363 * (Cb - 128) - 0.71413636 * (Cr - 128)); - B = clampTo8bit(Y + 1.772 * (Cb - 128)); - } - - data[offset++] = R; - data[offset++] = G; - data[offset++] = B; - } - } - break; - case 4: - if (!this.adobe) - throw new Error('Unsupported color mode (4 components)'); - // The default transform for four components is false - colorTransform = false; - // The adobe transform marker overrides any previous setting - if (this.adobe && this.adobe.transformCode) - colorTransform = true; - else if (typeof this.opts.colorTransform !== 'undefined') - colorTransform = !!this.opts.colorTransform; - - component1 = this.components[0]; - component2 = this.components[1]; - component3 = this.components[2]; - component4 = this.components[3]; - for (y = 0; y < height; y++) { - component1Line = component1.lines[0 | (y * component1.scaleY * scaleY)]; - component2Line = component2.lines[0 | (y * component2.scaleY * scaleY)]; - component3Line = component3.lines[0 | (y * component3.scaleY * scaleY)]; - component4Line = component4.lines[0 | (y * component4.scaleY * scaleY)]; - for (x = 0; x < width; x++) { - if (!colorTransform) { - C = component1Line[0 | (x * component1.scaleX * scaleX)]; - M = component2Line[0 | (x * component2.scaleX * scaleX)]; - Ye = component3Line[0 | (x * component3.scaleX * scaleX)]; - K = component4Line[0 | (x * component4.scaleX * scaleX)]; - } else { - Y = component1Line[0 | (x * component1.scaleX * scaleX)]; - Cb = component2Line[0 | (x * component2.scaleX * scaleX)]; - Cr = component3Line[0 | (x * component3.scaleX * scaleX)]; - K = component4Line[0 | (x * component4.scaleX * scaleX)]; - - C = 255 - clampTo8bit(Y + 1.402 * (Cr - 128)); - M = 255 - clampTo8bit(Y - 0.3441363 * (Cb - 128) - 0.71413636 * (Cr - 128)); - Ye = 255 - clampTo8bit(Y + 1.772 * (Cb - 128)); - } - data[offset++] = 255-C; - data[offset++] = 255-M; - data[offset++] = 255-Ye; - data[offset++] = 255-K; - } - } - break; - default: - throw new Error('Unsupported color mode'); - } - return data; - }, - copyToImageData: function copyToImageData(imageData, formatAsRGBA) { - var width = imageData.width, height = imageData.height; - var imageDataArray = imageData.data; - var data = this.getData(width, height); - var i = 0, j = 0, x, y; - var Y, K, C, M, R, G, B; - switch (this.components.length) { - case 1: - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - Y = data[i++]; - - imageDataArray[j++] = Y; - imageDataArray[j++] = Y; - imageDataArray[j++] = Y; - if (formatAsRGBA) { - imageDataArray[j++] = 255; - } - } - } - break; - case 3: - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - R = data[i++]; - G = data[i++]; - B = data[i++]; - - imageDataArray[j++] = R; - imageDataArray[j++] = G; - imageDataArray[j++] = B; - if (formatAsRGBA) { - imageDataArray[j++] = 255; - } - } - } - break; - case 4: - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - C = data[i++]; - M = data[i++]; - Y = data[i++]; - K = data[i++]; - - R = 255 - clampTo8bit(C * (1 - K / 255) + K); - G = 255 - clampTo8bit(M * (1 - K / 255) + K); - B = 255 - clampTo8bit(Y * (1 - K / 255) + K); - - imageDataArray[j++] = R; - imageDataArray[j++] = G; - imageDataArray[j++] = B; - if (formatAsRGBA) { - imageDataArray[j++] = 255; - } - } - } - break; - default: - throw new Error('Unsupported color mode'); - } - } - }; - - - // We cap the amount of memory used by jpeg-js to avoid unexpected OOMs from untrusted content. - var totalBytesAllocated = 0; - var maxMemoryUsageBytes = 0; - function requestMemoryAllocation(increaseAmount = 0) { - var totalMemoryImpactBytes = totalBytesAllocated + increaseAmount; - if (totalMemoryImpactBytes > maxMemoryUsageBytes) { - var exceededAmount = Math.ceil((totalMemoryImpactBytes - maxMemoryUsageBytes) / 1024 / 1024); - throw new Error(`maxMemoryUsageInMB limit exceeded by at least ${exceededAmount}MB`); - } - - totalBytesAllocated = totalMemoryImpactBytes; - } - - constructor.resetMaxMemoryUsage = function (maxMemoryUsageBytes_) { - totalBytesAllocated = 0; - maxMemoryUsageBytes = maxMemoryUsageBytes_; - }; - - constructor.getBytesAllocated = function () { - return totalBytesAllocated; - }; - - constructor.requestMemoryAllocation = requestMemoryAllocation; - - return constructor; -})(); - -if (typeof module !== 'undefined') { - module.exports = decode; -} else if (typeof window !== 'undefined') { - window['jpeg-js'] = window['jpeg-js'] || {}; - window['jpeg-js'].decode = decode; -} - -function decode(jpegData, userOpts = {}) { - var defaultOpts = { - // "undefined" means "Choose whether to transform colors based on the image’s color model." - colorTransform: undefined, - useTArray: false, - formatAsRGBA: true, - tolerantDecoding: true, - maxResolutionInMP: 100, // Don't decode more than 100 megapixels - maxMemoryUsageInMB: 512, // Don't decode if memory footprint is more than 512MB - }; - - var opts = {...defaultOpts, ...userOpts}; - var arr = new Uint8Array(jpegData); - var decoder = new JpegImage(); - decoder.opts = opts; - // If this constructor ever supports async decoding this will need to be done differently. - // Until then, treating as singleton limit is fine. - JpegImage.resetMaxMemoryUsage(opts.maxMemoryUsageInMB * 1024 * 1024); - decoder.parse(arr); - - var channels = (opts.formatAsRGBA) ? 4 : 3; - var bytesNeeded = decoder.width * decoder.height * channels; - try { - JpegImage.requestMemoryAllocation(bytesNeeded); - var image = { - width: decoder.width, - height: decoder.height, - exifBuffer: decoder.exifBuffer, - data: opts.useTArray ? - new Uint8Array(bytesNeeded) : - Buffer.alloc(bytesNeeded) - }; - if(decoder.comments.length > 0) { - image["comments"] = decoder.comments; - } - } catch (err) { - if (err instanceof RangeError) { - throw new Error("Could not allocate enough memory for the image. " + - "Required: " + bytesNeeded); - } - - if (err instanceof ReferenceError) { - if (err.message === "Buffer is not defined") { - throw new Error("Buffer is not globally defined in this environment. " + - "Consider setting useTArray to true"); - } - } - throw err; - } - - decoder.copyToImageData(image, opts.formatAsRGBA); - - return image; -} - -}).call(this,require("buffer").Buffer) -},{"buffer":48}],82:[function(require,module,exports){ -(function (Buffer){ -/* - Copyright (c) 2008, Adobe Systems Incorporated - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of Adobe Systems Incorporated nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -/* -JPEG encoder ported to JavaScript and optimized by Andreas Ritter, www.bytestrom.eu, 11/2009 - -Basic GUI blocking jpeg encoder -*/ - -var btoa = btoa || function(buf) { - return Buffer.from(buf).toString('base64'); -}; - -function JPEGEncoder(quality) { - var self = this; - var fround = Math.round; - var ffloor = Math.floor; - var YTable = new Array(64); - var UVTable = new Array(64); - var fdtbl_Y = new Array(64); - var fdtbl_UV = new Array(64); - var YDC_HT; - var UVDC_HT; - var YAC_HT; - var UVAC_HT; - - var bitcode = new Array(65535); - var category = new Array(65535); - var outputfDCTQuant = new Array(64); - var DU = new Array(64); - var byteout = []; - var bytenew = 0; - var bytepos = 7; - - var YDU = new Array(64); - var UDU = new Array(64); - var VDU = new Array(64); - var clt = new Array(256); - var RGB_YUV_TABLE = new Array(2048); - var currentQuality; - - var ZigZag = [ - 0, 1, 5, 6,14,15,27,28, - 2, 4, 7,13,16,26,29,42, - 3, 8,12,17,25,30,41,43, - 9,11,18,24,31,40,44,53, - 10,19,23,32,39,45,52,54, - 20,22,33,38,46,51,55,60, - 21,34,37,47,50,56,59,61, - 35,36,48,49,57,58,62,63 - ]; - - var std_dc_luminance_nrcodes = [0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0]; - var std_dc_luminance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; - var std_ac_luminance_nrcodes = [0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,0x7d]; - var std_ac_luminance_values = [ - 0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12, - 0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07, - 0x22,0x71,0x14,0x32,0x81,0x91,0xa1,0x08, - 0x23,0x42,0xb1,0xc1,0x15,0x52,0xd1,0xf0, - 0x24,0x33,0x62,0x72,0x82,0x09,0x0a,0x16, - 0x17,0x18,0x19,0x1a,0x25,0x26,0x27,0x28, - 0x29,0x2a,0x34,0x35,0x36,0x37,0x38,0x39, - 0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49, - 0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59, - 0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69, - 0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79, - 0x7a,0x83,0x84,0x85,0x86,0x87,0x88,0x89, - 0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98, - 0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7, - 0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6, - 0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5, - 0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4, - 0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe1,0xe2, - 0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea, - 0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, - 0xf9,0xfa - ]; - - var std_dc_chrominance_nrcodes = [0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0]; - var std_dc_chrominance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; - var std_ac_chrominance_nrcodes = [0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,0x77]; - var std_ac_chrominance_values = [ - 0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21, - 0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71, - 0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91, - 0xa1,0xb1,0xc1,0x09,0x23,0x33,0x52,0xf0, - 0x15,0x62,0x72,0xd1,0x0a,0x16,0x24,0x34, - 0xe1,0x25,0xf1,0x17,0x18,0x19,0x1a,0x26, - 0x27,0x28,0x29,0x2a,0x35,0x36,0x37,0x38, - 0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48, - 0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58, - 0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68, - 0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78, - 0x79,0x7a,0x82,0x83,0x84,0x85,0x86,0x87, - 0x88,0x89,0x8a,0x92,0x93,0x94,0x95,0x96, - 0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5, - 0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4, - 0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3, - 0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2, - 0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda, - 0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9, - 0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, - 0xf9,0xfa - ]; - - function initQuantTables(sf){ - var YQT = [ - 16, 11, 10, 16, 24, 40, 51, 61, - 12, 12, 14, 19, 26, 58, 60, 55, - 14, 13, 16, 24, 40, 57, 69, 56, - 14, 17, 22, 29, 51, 87, 80, 62, - 18, 22, 37, 56, 68,109,103, 77, - 24, 35, 55, 64, 81,104,113, 92, - 49, 64, 78, 87,103,121,120,101, - 72, 92, 95, 98,112,100,103, 99 - ]; - - for (var i = 0; i < 64; i++) { - var t = ffloor((YQT[i]*sf+50)/100); - if (t < 1) { - t = 1; - } else if (t > 255) { - t = 255; - } - YTable[ZigZag[i]] = t; - } - var UVQT = [ - 17, 18, 24, 47, 99, 99, 99, 99, - 18, 21, 26, 66, 99, 99, 99, 99, - 24, 26, 56, 99, 99, 99, 99, 99, - 47, 66, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99 - ]; - for (var j = 0; j < 64; j++) { - var u = ffloor((UVQT[j]*sf+50)/100); - if (u < 1) { - u = 1; - } else if (u > 255) { - u = 255; - } - UVTable[ZigZag[j]] = u; - } - var aasf = [ - 1.0, 1.387039845, 1.306562965, 1.175875602, - 1.0, 0.785694958, 0.541196100, 0.275899379 - ]; - var k = 0; - for (var row = 0; row < 8; row++) - { - for (var col = 0; col < 8; col++) - { - fdtbl_Y[k] = (1.0 / (YTable [ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); - fdtbl_UV[k] = (1.0 / (UVTable[ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); - k++; - } - } - } - - function computeHuffmanTbl(nrcodes, std_table){ - var codevalue = 0; - var pos_in_table = 0; - var HT = new Array(); - for (var k = 1; k <= 16; k++) { - for (var j = 1; j <= nrcodes[k]; j++) { - HT[std_table[pos_in_table]] = []; - HT[std_table[pos_in_table]][0] = codevalue; - HT[std_table[pos_in_table]][1] = k; - pos_in_table++; - codevalue++; - } - codevalue*=2; - } - return HT; - } - - function initHuffmanTbl() - { - YDC_HT = computeHuffmanTbl(std_dc_luminance_nrcodes,std_dc_luminance_values); - UVDC_HT = computeHuffmanTbl(std_dc_chrominance_nrcodes,std_dc_chrominance_values); - YAC_HT = computeHuffmanTbl(std_ac_luminance_nrcodes,std_ac_luminance_values); - UVAC_HT = computeHuffmanTbl(std_ac_chrominance_nrcodes,std_ac_chrominance_values); - } - - function initCategoryNumber() - { - var nrlower = 1; - var nrupper = 2; - for (var cat = 1; cat <= 15; cat++) { - //Positive numbers - for (var nr = nrlower; nr>0] = 38470 * i; - RGB_YUV_TABLE[(i+ 512)>>0] = 7471 * i + 0x8000; - RGB_YUV_TABLE[(i+ 768)>>0] = -11059 * i; - RGB_YUV_TABLE[(i+1024)>>0] = -21709 * i; - RGB_YUV_TABLE[(i+1280)>>0] = 32768 * i + 0x807FFF; - RGB_YUV_TABLE[(i+1536)>>0] = -27439 * i; - RGB_YUV_TABLE[(i+1792)>>0] = - 5329 * i; - } - } - - // IO functions - function writeBits(bs) - { - var value = bs[0]; - var posval = bs[1]-1; - while ( posval >= 0 ) { - if (value & (1 << posval) ) { - bytenew |= (1 << bytepos); - } - posval--; - bytepos--; - if (bytepos < 0) { - if (bytenew == 0xFF) { - writeByte(0xFF); - writeByte(0); - } - else { - writeByte(bytenew); - } - bytepos=7; - bytenew=0; - } - } - } - - function writeByte(value) - { - //byteout.push(clt[value]); // write char directly instead of converting later - byteout.push(value); - } - - function writeWord(value) - { - writeByte((value>>8)&0xFF); - writeByte((value )&0xFF); - } - - // DCT & quantization core - function fDCTQuant(data, fdtbl) - { - var d0, d1, d2, d3, d4, d5, d6, d7; - /* Pass 1: process rows. */ - var dataOff=0; - var i; - var I8 = 8; - var I64 = 64; - for (i=0; i 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0); - //outputfDCTQuant[i] = fround(fDCTQuant); - - } - return outputfDCTQuant; - } - - function writeAPP0() - { - writeWord(0xFFE0); // marker - writeWord(16); // length - writeByte(0x4A); // J - writeByte(0x46); // F - writeByte(0x49); // I - writeByte(0x46); // F - writeByte(0); // = "JFIF",'\0' - writeByte(1); // versionhi - writeByte(1); // versionlo - writeByte(0); // xyunits - writeWord(1); // xdensity - writeWord(1); // ydensity - writeByte(0); // thumbnwidth - writeByte(0); // thumbnheight - } - - function writeAPP1(exifBuffer) { - if (!exifBuffer) return; - - writeWord(0xFFE1); // APP1 marker - - if (exifBuffer[0] === 0x45 && - exifBuffer[1] === 0x78 && - exifBuffer[2] === 0x69 && - exifBuffer[3] === 0x66) { - // Buffer already starts with EXIF, just use it directly - writeWord(exifBuffer.length + 2); // length is buffer + length itself! - } else { - // Buffer doesn't start with EXIF, write it for them - writeWord(exifBuffer.length + 5 + 2); // length is buffer + EXIF\0 + length itself! - writeByte(0x45); // E - writeByte(0x78); // X - writeByte(0x69); // I - writeByte(0x66); // F - writeByte(0); // = "EXIF",'\0' - } - - for (var i = 0; i < exifBuffer.length; i++) { - writeByte(exifBuffer[i]); - } - } - - function writeSOF0(width, height) - { - writeWord(0xFFC0); // marker - writeWord(17); // length, truecolor YUV JPG - writeByte(8); // precision - writeWord(height); - writeWord(width); - writeByte(3); // nrofcomponents - writeByte(1); // IdY - writeByte(0x11); // HVY - writeByte(0); // QTY - writeByte(2); // IdU - writeByte(0x11); // HVU - writeByte(1); // QTU - writeByte(3); // IdV - writeByte(0x11); // HVV - writeByte(1); // QTV - } - - function writeDQT() - { - writeWord(0xFFDB); // marker - writeWord(132); // length - writeByte(0); - for (var i=0; i<64; i++) { - writeByte(YTable[i]); - } - writeByte(1); - for (var j=0; j<64; j++) { - writeByte(UVTable[j]); - } - } - - function writeDHT() - { - writeWord(0xFFC4); // marker - writeWord(0x01A2); // length - - writeByte(0); // HTYDCinfo - for (var i=0; i<16; i++) { - writeByte(std_dc_luminance_nrcodes[i+1]); - } - for (var j=0; j<=11; j++) { - writeByte(std_dc_luminance_values[j]); - } - - writeByte(0x10); // HTYACinfo - for (var k=0; k<16; k++) { - writeByte(std_ac_luminance_nrcodes[k+1]); - } - for (var l=0; l<=161; l++) { - writeByte(std_ac_luminance_values[l]); - } - - writeByte(1); // HTUDCinfo - for (var m=0; m<16; m++) { - writeByte(std_dc_chrominance_nrcodes[m+1]); - } - for (var n=0; n<=11; n++) { - writeByte(std_dc_chrominance_values[n]); - } - - writeByte(0x11); // HTUACinfo - for (var o=0; o<16; o++) { - writeByte(std_ac_chrominance_nrcodes[o+1]); - } - for (var p=0; p<=161; p++) { - writeByte(std_ac_chrominance_values[p]); - } - } - - function writeCOM(comments) - { - if (typeof comments === "undefined" || comments.constructor !== Array) return; - comments.forEach(e => { - if (typeof e !== "string") return; - writeWord(0xFFFE); // marker - var l = e.length; - writeWord(l + 2); // length itself as well - var i; - for (i = 0; i < l; i++) - writeByte(e.charCodeAt(i)); - }); - } - - function writeSOS() - { - writeWord(0xFFDA); // marker - writeWord(12); // length - writeByte(3); // nrofcomponents - writeByte(1); // IdY - writeByte(0); // HTY - writeByte(2); // IdU - writeByte(0x11); // HTU - writeByte(3); // IdV - writeByte(0x11); // HTV - writeByte(0); // Ss - writeByte(0x3f); // Se - writeByte(0); // Bf - } - - function processDU(CDU, fdtbl, DC, HTDC, HTAC){ - var EOB = HTAC[0x00]; - var M16zeroes = HTAC[0xF0]; - var pos; - var I16 = 16; - var I63 = 63; - var I64 = 64; - var DU_DCT = fDCTQuant(CDU, fdtbl); - //ZigZag reorder - for (var j=0;j0)&&(DU[end0pos]==0); end0pos--) {}; - //end0pos = first element in reverse order !=0 - if ( end0pos == 0) { - writeBits(EOB); - return DC; - } - var i = 1; - var lng; - while ( i <= end0pos ) { - var startpos = i; - for (; (DU[i]==0) && (i<=end0pos); ++i) {} - var nrzeroes = i-startpos; - if ( nrzeroes >= I16 ) { - lng = nrzeroes>>4; - for (var nrmarker=1; nrmarker <= lng; ++nrmarker) - writeBits(M16zeroes); - nrzeroes = nrzeroes&0xF; - } - pos = 32767+DU[i]; - writeBits(HTAC[(nrzeroes<<4)+category[pos]]); - writeBits(bitcode[pos]); - i++; - } - if ( end0pos != I63 ) { - writeBits(EOB); - } - return DC; - } - - function initCharLookupTable(){ - var sfcc = String.fromCharCode; - for(var i=0; i < 256; i++){ ///// ACHTUNG // 255 - clt[i] = sfcc(i); - } - } - - this.encode = function(image,quality) // image data object - { - var time_start = new Date().getTime(); - - if(quality) setQuality(quality); - - // Initialize bit writer - byteout = new Array(); - bytenew=0; - bytepos=7; - - // Add JPEG headers - writeWord(0xFFD8); // SOI - writeAPP0(); - writeCOM(image.comments); - writeAPP1(image.exifBuffer); - writeDQT(); - writeSOF0(image.width,image.height); - writeDHT(); - writeSOS(); - - - // Encode 8x8 macroblocks - var DCY=0; - var DCU=0; - var DCV=0; - - bytenew=0; - bytepos=7; - - - this.encode.displayName = "_encode_"; - - var imageData = image.data; - var width = image.width; - var height = image.height; - - var quadWidth = width*4; - var tripleWidth = width*3; - - var x, y = 0; - var r, g, b; - var start,p, col,row,pos; - while(y < height){ - x = 0; - while(x < quadWidth){ - start = quadWidth * y + x; - p = start; - col = -1; - row = 0; - - for(pos=0; pos < 64; pos++){ - row = pos >> 3;// /8 - col = ( pos & 7 ) * 4; // %8 - p = start + ( row * quadWidth ) + col; - - if(y+row >= height){ // padding bottom - p-= (quadWidth*(y+1+row-height)); - } - - if(x+col >= quadWidth){ // padding right - p-= ((x+col) - quadWidth +4) - } - - r = imageData[ p++ ]; - g = imageData[ p++ ]; - b = imageData[ p++ ]; - - - /* // calculate YUV values dynamically - YDU[pos]=((( 0.29900)*r+( 0.58700)*g+( 0.11400)*b))-128; //-0x80 - UDU[pos]=(((-0.16874)*r+(-0.33126)*g+( 0.50000)*b)); - VDU[pos]=((( 0.50000)*r+(-0.41869)*g+(-0.08131)*b)); - */ - - // use lookup table (slightly faster) - YDU[pos] = ((RGB_YUV_TABLE[r] + RGB_YUV_TABLE[(g + 256)>>0] + RGB_YUV_TABLE[(b + 512)>>0]) >> 16)-128; - UDU[pos] = ((RGB_YUV_TABLE[(r + 768)>>0] + RGB_YUV_TABLE[(g + 1024)>>0] + RGB_YUV_TABLE[(b + 1280)>>0]) >> 16)-128; - VDU[pos] = ((RGB_YUV_TABLE[(r + 1280)>>0] + RGB_YUV_TABLE[(g + 1536)>>0] + RGB_YUV_TABLE[(b + 1792)>>0]) >> 16)-128; - - } - - DCY = processDU(YDU, fdtbl_Y, DCY, YDC_HT, YAC_HT); - DCU = processDU(UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT); - DCV = processDU(VDU, fdtbl_UV, DCV, UVDC_HT, UVAC_HT); - x+=32; - } - y+=8; - } - - - //////////////////////////////////////////////////////////////// - - // Do the bit alignment of the EOI marker - if ( bytepos >= 0 ) { - var fillbits = []; - fillbits[1] = bytepos+1; - fillbits[0] = (1<<(bytepos+1))-1; - writeBits(fillbits); - } - - writeWord(0xFFD9); //EOI - - if (typeof module === 'undefined') return new Uint8Array(byteout); - return Buffer.from(byteout); - - var jpegDataUri = 'data:image/jpeg;base64,' + btoa(byteout.join('')); - - byteout = []; - - // benchmarking - var duration = new Date().getTime() - time_start; - //console.log('Encoding time: '+ duration + 'ms'); - // - - return jpegDataUri - } - - function setQuality(quality){ - if (quality <= 0) { - quality = 1; - } - if (quality > 100) { - quality = 100; - } - - if(currentQuality == quality) return // don't recalc if unchanged - - var sf = 0; - if (quality < 50) { - sf = Math.floor(5000 / quality); - } else { - sf = Math.floor(200 - quality*2); - } - - initQuantTables(sf); - currentQuality = quality; - //console.log('Quality set to: '+quality +'%'); - } - - function init(){ - var time_start = new Date().getTime(); - if(!quality) quality = 50; - // Create tables - initCharLookupTable() - initHuffmanTbl(); - initCategoryNumber(); - initRGBYUVTable(); - - setQuality(quality); - var duration = new Date().getTime() - time_start; - //console.log('Initialization '+ duration + 'ms'); - } - - init(); - -}; - -if (typeof module !== 'undefined') { - module.exports = encode; -} else if (typeof window !== 'undefined') { - window['jpeg-js'] = window['jpeg-js'] || {}; - window['jpeg-js'].encode = encode; -} - -function encode(imgData, qu) { - if (typeof qu === 'undefined') qu = 50; - var encoder = new JPEGEncoder(qu); - var data = encoder.encode(imgData, qu); - return { - data: data, - width: imgData.width, - height: imgData.height, - }; -} - -// helper function to get the imageData of an existing image on the current page. -function getImageDataFromImage(idOrElement){ - var theImg = (typeof(idOrElement)=='string')? document.getElementById(idOrElement):idOrElement; - var cvs = document.createElement('canvas'); - cvs.width = theImg.width; - cvs.height = theImg.height; - var ctx = cvs.getContext("2d"); - ctx.drawImage(theImg,0,0); - - return (ctx.getImageData(0, 0, cvs.width, cvs.height)); -} - -}).call(this,require("buffer").Buffer) -},{"buffer":48}],83:[function(require,module,exports){ -(function (process){ -var path = require('path'); -var fs = require('fs'); -var _0777 = parseInt('0777', 8); - -module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; - -function mkdirP (p, opts, f, made) { - if (typeof opts === 'function') { - f = opts; - opts = {}; - } - else if (!opts || typeof opts !== 'object') { - opts = { mode: opts }; - } - - var mode = opts.mode; - var xfs = opts.fs || fs; - - if (mode === undefined) { - mode = _0777 & (~process.umask()); - } - if (!made) made = null; - - var cb = f || function () {}; - p = path.resolve(p); - - xfs.mkdir(p, mode, function (er) { - if (!er) { - made = made || p; - return cb(null, made); - } - switch (er.code) { - case 'ENOENT': - mkdirP(path.dirname(p), opts, function (er, made) { - if (er) cb(er, made); - else mkdirP(p, opts, cb, made); - }); - break; - - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - xfs.stat(p, function (er2, stat) { - // if the stat fails, then that's super weird. - // let the original error be the failure reason. - if (er2 || !stat.isDirectory()) cb(er, made) - else cb(null, made); - }); - break; - } - }); -} - -mkdirP.sync = function sync (p, opts, made) { - if (!opts || typeof opts !== 'object') { - opts = { mode: opts }; - } - - var mode = opts.mode; - var xfs = opts.fs || fs; - - if (mode === undefined) { - mode = _0777 & (~process.umask()); - } - if (!made) made = null; - - p = path.resolve(p); - - try { - xfs.mkdirSync(p, mode); - made = made || p; - } - catch (err0) { - switch (err0.code) { - case 'ENOENT' : - made = sync(path.dirname(p), opts, made); - sync(p, opts, made); - break; - - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - var stat; - try { - stat = xfs.statSync(p); - } - catch (err1) { - throw err0; - } - if (!stat.isDirectory()) throw err0; - break; - } - } - - return made; -}; - -}).call(this,require('_process')) -},{"_process":133,"fs":47,"path":107}],84:[function(require,module,exports){ -/* -object-assign -(c) Sindre Sorhus -@license MIT -*/ - -'use strict'; -/* eslint-disable no-unused-vars */ -var getOwnPropertySymbols = Object.getOwnPropertySymbols; -var hasOwnProperty = Object.prototype.hasOwnProperty; -var propIsEnumerable = Object.prototype.propertyIsEnumerable; - -function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } - - return Object(val); -} - -function shouldUseNative() { - try { - if (!Object.assign) { - return false; - } - - // Detect buggy property enumeration order in older V8 versions. - - // https://bugs.chromium.org/p/v8/issues/detail?id=4118 - var test1 = new String('abc'); // eslint-disable-line no-new-wrappers - test1[5] = 'de'; - if (Object.getOwnPropertyNames(test1)[0] === '5') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test2 = {}; - for (var i = 0; i < 10; i++) { - test2['_' + String.fromCharCode(i)] = i; - } - var order2 = Object.getOwnPropertyNames(test2).map(function (n) { - return test2[n]; - }); - if (order2.join('') !== '0123456789') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test3 = {}; - 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { - test3[letter] = letter; - }); - if (Object.keys(Object.assign({}, test3)).join('') !== - 'abcdefghijklmnopqrst') { - return false; - } - - return true; - } catch (err) { - // We don't expect any of the above to throw, but better to be safe. - return false; - } -} - -module.exports = shouldUseNative() ? Object.assign : function (target, source) { - var from; - var to = toObject(target); - var symbols; - - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]); - - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } - - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } - - return to; -}; - -},{}],85:[function(require,module,exports){ -arguments[4][64][0].apply(exports,arguments) -},{"dup":64}],86:[function(require,module,exports){ -// Top level file is just a mixin of submodules & constants -'use strict'; - -var assign = require('./lib/utils/common').assign; - -var deflate = require('./lib/deflate'); -var inflate = require('./lib/inflate'); -var constants = require('./lib/zlib/constants'); - -var pako = {}; - -assign(pako, deflate, inflate, constants); - -module.exports = pako; - -},{"./lib/deflate":87,"./lib/inflate":88,"./lib/utils/common":89,"./lib/zlib/constants":92}],87:[function(require,module,exports){ -'use strict'; - - -var zlib_deflate = require('./zlib/deflate'); -var utils = require('./utils/common'); -var strings = require('./utils/strings'); -var msg = require('./zlib/messages'); -var ZStream = require('./zlib/zstream'); - -var toString = Object.prototype.toString; - -/* Public constants ==========================================================*/ -/* ===========================================================================*/ - -var Z_NO_FLUSH = 0; -var Z_FINISH = 4; - -var Z_OK = 0; -var Z_STREAM_END = 1; -var Z_SYNC_FLUSH = 2; - -var Z_DEFAULT_COMPRESSION = -1; - -var Z_DEFAULT_STRATEGY = 0; - -var Z_DEFLATED = 8; - -/* ===========================================================================*/ - - -/** - * class Deflate - * - * Generic JS-style wrapper for zlib calls. If you don't need - * streaming behaviour - use more simple functions: [[deflate]], - * [[deflateRaw]] and [[gzip]]. - **/ - -/* internal - * Deflate.chunks -> Array - * - * Chunks of output data, if [[Deflate#onData]] not overridden. - **/ - -/** - * Deflate.result -> Uint8Array|Array - * - * Compressed result, generated by default [[Deflate#onData]] - * and [[Deflate#onEnd]] handlers. Filled after you push last chunk - * (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you - * push a chunk with explicit flush (call [[Deflate#push]] with - * `Z_SYNC_FLUSH` param). - **/ - -/** - * Deflate.err -> Number - * - * Error code after deflate finished. 0 (Z_OK) on success. - * You will not need it in real life, because deflate errors - * are possible only on wrong options or bad `onData` / `onEnd` - * custom handlers. - **/ - -/** - * Deflate.msg -> String - * - * Error message, if [[Deflate.err]] != 0 - **/ - - -/** - * new Deflate(options) - * - options (Object): zlib deflate options. - * - * Creates new deflator instance with specified params. Throws exception - * on bad params. Supported options: - * - * - `level` - * - `windowBits` - * - `memLevel` - * - `strategy` - * - `dictionary` - * - * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) - * for more information on these. - * - * Additional options, for internal needs: - * - * - `chunkSize` - size of generated data chunks (16K by default) - * - `raw` (Boolean) - do raw deflate - * - `gzip` (Boolean) - create gzip wrapper - * - `to` (String) - if equal to 'string', then result will be "binary string" - * (each char code [0..255]) - * - `header` (Object) - custom header for gzip - * - `text` (Boolean) - true if compressed data believed to be text - * - `time` (Number) - modification time, unix timestamp - * - `os` (Number) - operation system code - * - `extra` (Array) - array of bytes with extra data (max 65536) - * - `name` (String) - file name (binary string) - * - `comment` (String) - comment (binary string) - * - `hcrc` (Boolean) - true if header crc should be added - * - * ##### Example: - * - * ```javascript - * var pako = require('pako') - * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) - * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); - * - * var deflate = new pako.Deflate({ level: 3}); - * - * deflate.push(chunk1, false); - * deflate.push(chunk2, true); // true -> last chunk - * - * if (deflate.err) { throw new Error(deflate.err); } - * - * console.log(deflate.result); - * ``` - **/ -function Deflate(options) { - if (!(this instanceof Deflate)) return new Deflate(options); - - this.options = utils.assign({ - level: Z_DEFAULT_COMPRESSION, - method: Z_DEFLATED, - chunkSize: 16384, - windowBits: 15, - memLevel: 8, - strategy: Z_DEFAULT_STRATEGY, - to: '' - }, options || {}); - - var opt = this.options; - - if (opt.raw && (opt.windowBits > 0)) { - opt.windowBits = -opt.windowBits; - } - - else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) { - opt.windowBits += 16; - } - - this.err = 0; // error code, if happens (0 = Z_OK) - this.msg = ''; // error message - this.ended = false; // used to avoid multiple onEnd() calls - this.chunks = []; // chunks of compressed data - - this.strm = new ZStream(); - this.strm.avail_out = 0; - - var status = zlib_deflate.deflateInit2( - this.strm, - opt.level, - opt.method, - opt.windowBits, - opt.memLevel, - opt.strategy - ); - - if (status !== Z_OK) { - throw new Error(msg[status]); - } - - if (opt.header) { - zlib_deflate.deflateSetHeader(this.strm, opt.header); - } - - if (opt.dictionary) { - var dict; - // Convert data if needed - if (typeof opt.dictionary === 'string') { - // If we need to compress text, change encoding to utf8. - dict = strings.string2buf(opt.dictionary); - } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') { - dict = new Uint8Array(opt.dictionary); - } else { - dict = opt.dictionary; - } - - status = zlib_deflate.deflateSetDictionary(this.strm, dict); - - if (status !== Z_OK) { - throw new Error(msg[status]); - } - - this._dict_set = true; - } -} - -/** - * Deflate#push(data[, mode]) -> Boolean - * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be - * converted to utf8 byte sequence. - * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. - * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH. - * - * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with - * new compressed chunks. Returns `true` on success. The last data block must have - * mode Z_FINISH (or `true`). That will flush internal pending buffers and call - * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you - * can use mode Z_SYNC_FLUSH, keeping the compression context. - * - * On fail call [[Deflate#onEnd]] with error code and return false. - * - * We strongly recommend to use `Uint8Array` on input for best speed (output - * array format is detected automatically). Also, don't skip last param and always - * use the same type in your code (boolean or number). That will improve JS speed. - * - * For regular `Array`-s make sure all elements are [0..255]. - * - * ##### Example - * - * ```javascript - * push(chunk, false); // push one of data chunks - * ... - * push(chunk, true); // push last chunk - * ``` - **/ -Deflate.prototype.push = function (data, mode) { - var strm = this.strm; - var chunkSize = this.options.chunkSize; - var status, _mode; - - if (this.ended) { return false; } - - _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH); - - // Convert data if needed - if (typeof data === 'string') { - // If we need to compress text, change encoding to utf8. - strm.input = strings.string2buf(data); - } else if (toString.call(data) === '[object ArrayBuffer]') { - strm.input = new Uint8Array(data); - } else { - strm.input = data; - } - - strm.next_in = 0; - strm.avail_in = strm.input.length; - - do { - if (strm.avail_out === 0) { - strm.output = new utils.Buf8(chunkSize); - strm.next_out = 0; - strm.avail_out = chunkSize; - } - status = zlib_deflate.deflate(strm, _mode); /* no bad return value */ - - if (status !== Z_STREAM_END && status !== Z_OK) { - this.onEnd(status); - this.ended = true; - return false; - } - if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) { - if (this.options.to === 'string') { - this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out))); - } else { - this.onData(utils.shrinkBuf(strm.output, strm.next_out)); - } - } - } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END); - - // Finalize on the last chunk. - if (_mode === Z_FINISH) { - status = zlib_deflate.deflateEnd(this.strm); - this.onEnd(status); - this.ended = true; - return status === Z_OK; - } - - // callback interim results if Z_SYNC_FLUSH. - if (_mode === Z_SYNC_FLUSH) { - this.onEnd(Z_OK); - strm.avail_out = 0; - return true; - } - - return true; -}; - - -/** - * Deflate#onData(chunk) -> Void - * - chunk (Uint8Array|Array|String): output data. Type of array depends - * on js engine support. When string output requested, each chunk - * will be string. - * - * By default, stores data blocks in `chunks[]` property and glue - * those in `onEnd`. Override this handler, if you need another behaviour. - **/ -Deflate.prototype.onData = function (chunk) { - this.chunks.push(chunk); -}; - - -/** - * Deflate#onEnd(status) -> Void - * - status (Number): deflate status. 0 (Z_OK) on success, - * other if not. - * - * Called once after you tell deflate that the input stream is - * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH) - * or if an error happened. By default - join collected chunks, - * free memory and fill `results` / `err` properties. - **/ -Deflate.prototype.onEnd = function (status) { - // On success - join - if (status === Z_OK) { - if (this.options.to === 'string') { - this.result = this.chunks.join(''); - } else { - this.result = utils.flattenChunks(this.chunks); - } - } - this.chunks = []; - this.err = status; - this.msg = this.strm.msg; -}; - - -/** - * deflate(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to compress. - * - options (Object): zlib deflate options. - * - * Compress `data` with deflate algorithm and `options`. - * - * Supported options are: - * - * - level - * - windowBits - * - memLevel - * - strategy - * - dictionary - * - * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) - * for more information on these. - * - * Sugar (options): - * - * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify - * negative windowBits implicitly. - * - `to` (String) - if equal to 'string', then result will be "binary string" - * (each char code [0..255]) - * - * ##### Example: - * - * ```javascript - * var pako = require('pako') - * , data = Uint8Array([1,2,3,4,5,6,7,8,9]); - * - * console.log(pako.deflate(data)); - * ``` - **/ -function deflate(input, options) { - var deflator = new Deflate(options); - - deflator.push(input, true); - - // That will never happens, if you don't cheat with options :) - if (deflator.err) { throw deflator.msg || msg[deflator.err]; } - - return deflator.result; -} - - -/** - * deflateRaw(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to compress. - * - options (Object): zlib deflate options. - * - * The same as [[deflate]], but creates raw data, without wrapper - * (header and adler32 crc). - **/ -function deflateRaw(input, options) { - options = options || {}; - options.raw = true; - return deflate(input, options); -} - - -/** - * gzip(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to compress. - * - options (Object): zlib deflate options. - * - * The same as [[deflate]], but create gzip wrapper instead of - * deflate one. - **/ -function gzip(input, options) { - options = options || {}; - options.gzip = true; - return deflate(input, options); -} - - -exports.Deflate = Deflate; -exports.deflate = deflate; -exports.deflateRaw = deflateRaw; -exports.gzip = gzip; - -},{"./utils/common":89,"./utils/strings":90,"./zlib/deflate":94,"./zlib/messages":99,"./zlib/zstream":101}],88:[function(require,module,exports){ -'use strict'; - - -var zlib_inflate = require('./zlib/inflate'); -var utils = require('./utils/common'); -var strings = require('./utils/strings'); -var c = require('./zlib/constants'); -var msg = require('./zlib/messages'); -var ZStream = require('./zlib/zstream'); -var GZheader = require('./zlib/gzheader'); - -var toString = Object.prototype.toString; - -/** - * class Inflate - * - * Generic JS-style wrapper for zlib calls. If you don't need - * streaming behaviour - use more simple functions: [[inflate]] - * and [[inflateRaw]]. - **/ - -/* internal - * inflate.chunks -> Array - * - * Chunks of output data, if [[Inflate#onData]] not overridden. - **/ - -/** - * Inflate.result -> Uint8Array|Array|String - * - * Uncompressed result, generated by default [[Inflate#onData]] - * and [[Inflate#onEnd]] handlers. Filled after you push last chunk - * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you - * push a chunk with explicit flush (call [[Inflate#push]] with - * `Z_SYNC_FLUSH` param). - **/ - -/** - * Inflate.err -> Number - * - * Error code after inflate finished. 0 (Z_OK) on success. - * Should be checked if broken data possible. - **/ - -/** - * Inflate.msg -> String - * - * Error message, if [[Inflate.err]] != 0 - **/ - - -/** - * new Inflate(options) - * - options (Object): zlib inflate options. - * - * Creates new inflator instance with specified params. Throws exception - * on bad params. Supported options: - * - * - `windowBits` - * - `dictionary` - * - * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) - * for more information on these. - * - * Additional options, for internal needs: - * - * - `chunkSize` - size of generated data chunks (16K by default) - * - `raw` (Boolean) - do raw inflate - * - `to` (String) - if equal to 'string', then result will be converted - * from utf8 to utf16 (javascript) string. When string output requested, - * chunk length can differ from `chunkSize`, depending on content. - * - * By default, when no options set, autodetect deflate/gzip data format via - * wrapper header. - * - * ##### Example: - * - * ```javascript - * var pako = require('pako') - * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) - * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); - * - * var inflate = new pako.Inflate({ level: 3}); - * - * inflate.push(chunk1, false); - * inflate.push(chunk2, true); // true -> last chunk - * - * if (inflate.err) { throw new Error(inflate.err); } - * - * console.log(inflate.result); - * ``` - **/ -function Inflate(options) { - if (!(this instanceof Inflate)) return new Inflate(options); - - this.options = utils.assign({ - chunkSize: 16384, - windowBits: 0, - to: '' - }, options || {}); - - var opt = this.options; - - // Force window size for `raw` data, if not set directly, - // because we have no header for autodetect. - if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) { - opt.windowBits = -opt.windowBits; - if (opt.windowBits === 0) { opt.windowBits = -15; } - } - - // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate - if ((opt.windowBits >= 0) && (opt.windowBits < 16) && - !(options && options.windowBits)) { - opt.windowBits += 32; - } - - // Gzip header has no info about windows size, we can do autodetect only - // for deflate. So, if window size not set, force it to max when gzip possible - if ((opt.windowBits > 15) && (opt.windowBits < 48)) { - // bit 3 (16) -> gzipped data - // bit 4 (32) -> autodetect gzip/deflate - if ((opt.windowBits & 15) === 0) { - opt.windowBits |= 15; - } - } - - this.err = 0; // error code, if happens (0 = Z_OK) - this.msg = ''; // error message - this.ended = false; // used to avoid multiple onEnd() calls - this.chunks = []; // chunks of compressed data - - this.strm = new ZStream(); - this.strm.avail_out = 0; - - var status = zlib_inflate.inflateInit2( - this.strm, - opt.windowBits - ); - - if (status !== c.Z_OK) { - throw new Error(msg[status]); - } - - this.header = new GZheader(); - - zlib_inflate.inflateGetHeader(this.strm, this.header); -} - -/** - * Inflate#push(data[, mode]) -> Boolean - * - data (Uint8Array|Array|ArrayBuffer|String): input data - * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. - * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH. - * - * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with - * new output chunks. Returns `true` on success. The last data block must have - * mode Z_FINISH (or `true`). That will flush internal pending buffers and call - * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you - * can use mode Z_SYNC_FLUSH, keeping the decompression context. - * - * On fail call [[Inflate#onEnd]] with error code and return false. - * - * We strongly recommend to use `Uint8Array` on input for best speed (output - * format is detected automatically). Also, don't skip last param and always - * use the same type in your code (boolean or number). That will improve JS speed. - * - * For regular `Array`-s make sure all elements are [0..255]. - * - * ##### Example - * - * ```javascript - * push(chunk, false); // push one of data chunks - * ... - * push(chunk, true); // push last chunk - * ``` - **/ -Inflate.prototype.push = function (data, mode) { - var strm = this.strm; - var chunkSize = this.options.chunkSize; - var dictionary = this.options.dictionary; - var status, _mode; - var next_out_utf8, tail, utf8str; - var dict; - - // Flag to properly process Z_BUF_ERROR on testing inflate call - // when we check that all output data was flushed. - var allowBufError = false; - - if (this.ended) { return false; } - _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH); - - // Convert data if needed - if (typeof data === 'string') { - // Only binary strings can be decompressed on practice - strm.input = strings.binstring2buf(data); - } else if (toString.call(data) === '[object ArrayBuffer]') { - strm.input = new Uint8Array(data); - } else { - strm.input = data; - } - - strm.next_in = 0; - strm.avail_in = strm.input.length; - - do { - if (strm.avail_out === 0) { - strm.output = new utils.Buf8(chunkSize); - strm.next_out = 0; - strm.avail_out = chunkSize; - } - - status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */ - - if (status === c.Z_NEED_DICT && dictionary) { - // Convert data if needed - if (typeof dictionary === 'string') { - dict = strings.string2buf(dictionary); - } else if (toString.call(dictionary) === '[object ArrayBuffer]') { - dict = new Uint8Array(dictionary); - } else { - dict = dictionary; - } - - status = zlib_inflate.inflateSetDictionary(this.strm, dict); - - } - - if (status === c.Z_BUF_ERROR && allowBufError === true) { - status = c.Z_OK; - allowBufError = false; - } - - if (status !== c.Z_STREAM_END && status !== c.Z_OK) { - this.onEnd(status); - this.ended = true; - return false; - } - - if (strm.next_out) { - if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) { - - if (this.options.to === 'string') { - - next_out_utf8 = strings.utf8border(strm.output, strm.next_out); - - tail = strm.next_out - next_out_utf8; - utf8str = strings.buf2string(strm.output, next_out_utf8); - - // move tail - strm.next_out = tail; - strm.avail_out = chunkSize - tail; - if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); } - - this.onData(utf8str); - - } else { - this.onData(utils.shrinkBuf(strm.output, strm.next_out)); - } - } - } - - // When no more input data, we should check that internal inflate buffers - // are flushed. The only way to do it when avail_out = 0 - run one more - // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR. - // Here we set flag to process this error properly. - // - // NOTE. Deflate does not return error in this case and does not needs such - // logic. - if (strm.avail_in === 0 && strm.avail_out === 0) { - allowBufError = true; - } - - } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END); - - if (status === c.Z_STREAM_END) { - _mode = c.Z_FINISH; - } - - // Finalize on the last chunk. - if (_mode === c.Z_FINISH) { - status = zlib_inflate.inflateEnd(this.strm); - this.onEnd(status); - this.ended = true; - return status === c.Z_OK; - } - - // callback interim results if Z_SYNC_FLUSH. - if (_mode === c.Z_SYNC_FLUSH) { - this.onEnd(c.Z_OK); - strm.avail_out = 0; - return true; - } - - return true; -}; - - -/** - * Inflate#onData(chunk) -> Void - * - chunk (Uint8Array|Array|String): output data. Type of array depends - * on js engine support. When string output requested, each chunk - * will be string. - * - * By default, stores data blocks in `chunks[]` property and glue - * those in `onEnd`. Override this handler, if you need another behaviour. - **/ -Inflate.prototype.onData = function (chunk) { - this.chunks.push(chunk); -}; - - -/** - * Inflate#onEnd(status) -> Void - * - status (Number): inflate status. 0 (Z_OK) on success, - * other if not. - * - * Called either after you tell inflate that the input stream is - * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH) - * or if an error happened. By default - join collected chunks, - * free memory and fill `results` / `err` properties. - **/ -Inflate.prototype.onEnd = function (status) { - // On success - join - if (status === c.Z_OK) { - if (this.options.to === 'string') { - // Glue & convert here, until we teach pako to send - // utf8 aligned strings to onData - this.result = this.chunks.join(''); - } else { - this.result = utils.flattenChunks(this.chunks); - } - } - this.chunks = []; - this.err = status; - this.msg = this.strm.msg; -}; - - -/** - * inflate(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to decompress. - * - options (Object): zlib inflate options. - * - * Decompress `data` with inflate/ungzip and `options`. Autodetect - * format via wrapper header by default. That's why we don't provide - * separate `ungzip` method. - * - * Supported options are: - * - * - windowBits - * - * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) - * for more information. - * - * Sugar (options): - * - * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify - * negative windowBits implicitly. - * - `to` (String) - if equal to 'string', then result will be converted - * from utf8 to utf16 (javascript) string. When string output requested, - * chunk length can differ from `chunkSize`, depending on content. - * - * - * ##### Example: - * - * ```javascript - * var pako = require('pako') - * , input = pako.deflate([1,2,3,4,5,6,7,8,9]) - * , output; - * - * try { - * output = pako.inflate(input); - * } catch (err) - * console.log(err); - * } - * ``` - **/ -function inflate(input, options) { - var inflator = new Inflate(options); - - inflator.push(input, true); - - // That will never happens, if you don't cheat with options :) - if (inflator.err) { throw inflator.msg || msg[inflator.err]; } - - return inflator.result; -} - - -/** - * inflateRaw(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to decompress. - * - options (Object): zlib inflate options. - * - * The same as [[inflate]], but creates raw data, without wrapper - * (header and adler32 crc). - **/ -function inflateRaw(input, options) { - options = options || {}; - options.raw = true; - return inflate(input, options); -} - - -/** - * ungzip(data[, options]) -> Uint8Array|Array|String - * - data (Uint8Array|Array|String): input data to decompress. - * - options (Object): zlib inflate options. - * - * Just shortcut to [[inflate]], because it autodetects format - * by header.content. Done for convenience. - **/ - - -exports.Inflate = Inflate; -exports.inflate = inflate; -exports.inflateRaw = inflateRaw; -exports.ungzip = inflate; - -},{"./utils/common":89,"./utils/strings":90,"./zlib/constants":92,"./zlib/gzheader":95,"./zlib/inflate":97,"./zlib/messages":99,"./zlib/zstream":101}],89:[function(require,module,exports){ -arguments[4][36][0].apply(exports,arguments) -},{"dup":36}],90:[function(require,module,exports){ -// String encode/decode helpers -'use strict'; - - -var utils = require('./common'); - - -// Quick check if we can use fast array to bin string conversion -// -// - apply(Array) can fail on Android 2.2 -// - apply(Uint8Array) can fail on iOS 5.1 Safari -// -var STR_APPLY_OK = true; -var STR_APPLY_UIA_OK = true; - -try { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; } -try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; } - - -// Table with utf8 lengths (calculated by first byte of sequence) -// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, -// because max possible codepoint is 0x10ffff -var _utf8len = new utils.Buf8(256); -for (var q = 0; q < 256; q++) { - _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1); -} -_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start - - -// convert string to array (typed, when possible) -exports.string2buf = function (str) { - var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; - - // count binary size - for (m_pos = 0; m_pos < str_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { - c2 = str.charCodeAt(m_pos + 1); - if ((c2 & 0xfc00) === 0xdc00) { - c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); - m_pos++; - } - } - buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; - } - - // allocate buffer - buf = new utils.Buf8(buf_len); - - // convert - for (i = 0, m_pos = 0; i < buf_len; m_pos++) { - c = str.charCodeAt(m_pos); - if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) { - c2 = str.charCodeAt(m_pos + 1); - if ((c2 & 0xfc00) === 0xdc00) { - c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); - m_pos++; - } - } - if (c < 0x80) { - /* one byte */ - buf[i++] = c; - } else if (c < 0x800) { - /* two bytes */ - buf[i++] = 0xC0 | (c >>> 6); - buf[i++] = 0x80 | (c & 0x3f); - } else if (c < 0x10000) { - /* three bytes */ - buf[i++] = 0xE0 | (c >>> 12); - buf[i++] = 0x80 | (c >>> 6 & 0x3f); - buf[i++] = 0x80 | (c & 0x3f); - } else { - /* four bytes */ - buf[i++] = 0xf0 | (c >>> 18); - buf[i++] = 0x80 | (c >>> 12 & 0x3f); - buf[i++] = 0x80 | (c >>> 6 & 0x3f); - buf[i++] = 0x80 | (c & 0x3f); - } - } - - return buf; -}; - -// Helper (used in 2 places) -function buf2binstring(buf, len) { - // use fallback for big arrays to avoid stack overflow - if (len < 65537) { - if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) { - return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len)); - } - } - - var result = ''; - for (var i = 0; i < len; i++) { - result += String.fromCharCode(buf[i]); - } - return result; -} - - -// Convert byte array to binary string -exports.buf2binstring = function (buf) { - return buf2binstring(buf, buf.length); -}; - - -// Convert binary string (typed, when possible) -exports.binstring2buf = function (str) { - var buf = new utils.Buf8(str.length); - for (var i = 0, len = buf.length; i < len; i++) { - buf[i] = str.charCodeAt(i); - } - return buf; -}; - - -// convert array to string -exports.buf2string = function (buf, max) { - var i, out, c, c_len; - var len = max || buf.length; - - // Reserve max possible length (2 words per char) - // NB: by unknown reasons, Array is significantly faster for - // String.fromCharCode.apply than Uint16Array. - var utf16buf = new Array(len * 2); - - for (out = 0, i = 0; i < len;) { - c = buf[i++]; - // quick process ascii - if (c < 0x80) { utf16buf[out++] = c; continue; } - - c_len = _utf8len[c]; - // skip 5 & 6 byte codes - if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; } - - // apply mask on first byte - c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; - // join the rest - while (c_len > 1 && i < len) { - c = (c << 6) | (buf[i++] & 0x3f); - c_len--; - } - - // terminated by end of string? - if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } - - if (c < 0x10000) { - utf16buf[out++] = c; - } else { - c -= 0x10000; - utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); - utf16buf[out++] = 0xdc00 | (c & 0x3ff); - } - } - - return buf2binstring(utf16buf, out); -}; - - -// Calculate max possible position in utf8 buffer, -// that will not break sequence. If that's not possible -// - (very small limits) return max size as is. -// -// buf[] - utf8 bytes array -// max - length limit (mandatory); -exports.utf8border = function (buf, max) { - var pos; - - max = max || buf.length; - if (max > buf.length) { max = buf.length; } - - // go back from last position, until start of sequence found - pos = max - 1; - while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } - - // Very small and broken sequence, - // return max, because we should return something anyway. - if (pos < 0) { return max; } - - // If we came to start of buffer - that means buffer is too small, - // return max too. - if (pos === 0) { return max; } - - return (pos + _utf8len[buf[pos]] > max) ? pos : max; -}; - -},{"./common":89}],91:[function(require,module,exports){ -arguments[4][37][0].apply(exports,arguments) -},{"dup":37}],92:[function(require,module,exports){ -arguments[4][38][0].apply(exports,arguments) -},{"dup":38}],93:[function(require,module,exports){ -arguments[4][39][0].apply(exports,arguments) -},{"dup":39}],94:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -var utils = require('../utils/common'); -var trees = require('./trees'); -var adler32 = require('./adler32'); -var crc32 = require('./crc32'); -var msg = require('./messages'); - -/* Public constants ==========================================================*/ -/* ===========================================================================*/ - - -/* Allowed flush values; see deflate() and inflate() below for details */ -var Z_NO_FLUSH = 0; -var Z_PARTIAL_FLUSH = 1; -//var Z_SYNC_FLUSH = 2; -var Z_FULL_FLUSH = 3; -var Z_FINISH = 4; -var Z_BLOCK = 5; -//var Z_TREES = 6; - - -/* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ -var Z_OK = 0; -var Z_STREAM_END = 1; -//var Z_NEED_DICT = 2; -//var Z_ERRNO = -1; -var Z_STREAM_ERROR = -2; -var Z_DATA_ERROR = -3; -//var Z_MEM_ERROR = -4; -var Z_BUF_ERROR = -5; -//var Z_VERSION_ERROR = -6; - - -/* compression levels */ -//var Z_NO_COMPRESSION = 0; -//var Z_BEST_SPEED = 1; -//var Z_BEST_COMPRESSION = 9; -var Z_DEFAULT_COMPRESSION = -1; - - -var Z_FILTERED = 1; -var Z_HUFFMAN_ONLY = 2; -var Z_RLE = 3; -var Z_FIXED = 4; -var Z_DEFAULT_STRATEGY = 0; - -/* Possible values of the data_type field (though see inflate()) */ -//var Z_BINARY = 0; -//var Z_TEXT = 1; -//var Z_ASCII = 1; // = Z_TEXT -var Z_UNKNOWN = 2; - - -/* The deflate compression method */ -var Z_DEFLATED = 8; - -/*============================================================================*/ - - -var MAX_MEM_LEVEL = 9; -/* Maximum value for memLevel in deflateInit2 */ -var MAX_WBITS = 15; -/* 32K LZ77 window */ -var DEF_MEM_LEVEL = 8; - - -var LENGTH_CODES = 29; -/* number of length codes, not counting the special END_BLOCK code */ -var LITERALS = 256; -/* number of literal bytes 0..255 */ -var L_CODES = LITERALS + 1 + LENGTH_CODES; -/* number of Literal or Length codes, including the END_BLOCK code */ -var D_CODES = 30; -/* number of distance codes */ -var BL_CODES = 19; -/* number of codes used to transfer the bit lengths */ -var HEAP_SIZE = 2 * L_CODES + 1; -/* maximum heap size */ -var MAX_BITS = 15; -/* All codes must not exceed MAX_BITS bits */ - -var MIN_MATCH = 3; -var MAX_MATCH = 258; -var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1); - -var PRESET_DICT = 0x20; - -var INIT_STATE = 42; -var EXTRA_STATE = 69; -var NAME_STATE = 73; -var COMMENT_STATE = 91; -var HCRC_STATE = 103; -var BUSY_STATE = 113; -var FINISH_STATE = 666; - -var BS_NEED_MORE = 1; /* block not completed, need more input or more output */ -var BS_BLOCK_DONE = 2; /* block flush performed */ -var BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */ -var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */ - -var OS_CODE = 0x03; // Unix :) . Don't detect, use this default. - -function err(strm, errorCode) { - strm.msg = msg[errorCode]; - return errorCode; -} - -function rank(f) { - return ((f) << 1) - ((f) > 4 ? 9 : 0); -} - -function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } - - -/* ========================================================================= - * Flush as much pending output as possible. All deflate() output goes - * through this function so some applications may wish to modify it - * to avoid allocating a large strm->output buffer and copying into it. - * (See also read_buf()). - */ -function flush_pending(strm) { - var s = strm.state; - - //_tr_flush_bits(s); - var len = s.pending; - if (len > strm.avail_out) { - len = strm.avail_out; - } - if (len === 0) { return; } - - utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out); - strm.next_out += len; - s.pending_out += len; - strm.total_out += len; - strm.avail_out -= len; - s.pending -= len; - if (s.pending === 0) { - s.pending_out = 0; - } -} - - -function flush_block_only(s, last) { - trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last); - s.block_start = s.strstart; - flush_pending(s.strm); -} - - -function put_byte(s, b) { - s.pending_buf[s.pending++] = b; -} - - -/* ========================================================================= - * Put a short in the pending buffer. The 16-bit value is put in MSB order. - * IN assertion: the stream state is correct and there is enough room in - * pending_buf. - */ -function putShortMSB(s, b) { -// put_byte(s, (Byte)(b >> 8)); -// put_byte(s, (Byte)(b & 0xff)); - s.pending_buf[s.pending++] = (b >>> 8) & 0xff; - s.pending_buf[s.pending++] = b & 0xff; -} - - -/* =========================================================================== - * Read a new buffer from the current input stream, update the adler32 - * and total number of bytes read. All deflate() input goes through - * this function so some applications may wish to modify it to avoid - * allocating a large strm->input buffer and copying from it. - * (See also flush_pending()). - */ -function read_buf(strm, buf, start, size) { - var len = strm.avail_in; - - if (len > size) { len = size; } - if (len === 0) { return 0; } - - strm.avail_in -= len; - - // zmemcpy(buf, strm->next_in, len); - utils.arraySet(buf, strm.input, strm.next_in, len, start); - if (strm.state.wrap === 1) { - strm.adler = adler32(strm.adler, buf, len, start); - } - - else if (strm.state.wrap === 2) { - strm.adler = crc32(strm.adler, buf, len, start); - } - - strm.next_in += len; - strm.total_in += len; - - return len; -} - - -/* =========================================================================== - * Set match_start to the longest match starting at the given string and - * return its length. Matches shorter or equal to prev_length are discarded, - * in which case the result is equal to prev_length and match_start is - * garbage. - * IN assertions: cur_match is the head of the hash chain for the current - * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 - * OUT assertion: the match length is not greater than s->lookahead. - */ -function longest_match(s, cur_match) { - var chain_length = s.max_chain_length; /* max hash chain length */ - var scan = s.strstart; /* current string */ - var match; /* matched string */ - var len; /* length of current match */ - var best_len = s.prev_length; /* best match length so far */ - var nice_match = s.nice_match; /* stop if match long enough */ - var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ? - s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/; - - var _win = s.window; // shortcut - - var wmask = s.w_mask; - var prev = s.prev; - - /* Stop when cur_match becomes <= limit. To simplify the code, - * we prevent matches with the string of window index 0. - */ - - var strend = s.strstart + MAX_MATCH; - var scan_end1 = _win[scan + best_len - 1]; - var scan_end = _win[scan + best_len]; - - /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. - * It is easy to get rid of this optimization if necessary. - */ - // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - - /* Do not waste too much time if we already have a good match: */ - if (s.prev_length >= s.good_match) { - chain_length >>= 2; - } - /* Do not look for matches beyond the end of the input. This is necessary - * to make deflate deterministic. - */ - if (nice_match > s.lookahead) { nice_match = s.lookahead; } - - // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); - - do { - // Assert(cur_match < s->strstart, "no future"); - match = cur_match; - - /* Skip to next match if the match length cannot increase - * or if the match length is less than 2. Note that the checks below - * for insufficient lookahead only occur occasionally for performance - * reasons. Therefore uninitialized memory will be accessed, and - * conditional jumps will be made that depend on those values. - * However the length of the match is limited to the lookahead, so - * the output of deflate is not affected by the uninitialized values. - */ - - if (_win[match + best_len] !== scan_end || - _win[match + best_len - 1] !== scan_end1 || - _win[match] !== _win[scan] || - _win[++match] !== _win[scan + 1]) { - continue; - } - - /* The check at best_len-1 can be removed because it will be made - * again later. (This heuristic is not always a win.) - * It is not necessary to compare scan[2] and match[2] since they - * are always equal when the other bytes match, given that - * the hash keys are equal and that HASH_BITS >= 8. - */ - scan += 2; - match++; - // Assert(*scan == *match, "match[2]?"); - - /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. - */ - do { - /*jshint noempty:false*/ - } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - scan < strend); - - // Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - - len = MAX_MATCH - (strend - scan); - scan = strend - MAX_MATCH; - - if (len > best_len) { - s.match_start = cur_match; - best_len = len; - if (len >= nice_match) { - break; - } - scan_end1 = _win[scan + best_len - 1]; - scan_end = _win[scan + best_len]; - } - } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0); - - if (best_len <= s.lookahead) { - return best_len; - } - return s.lookahead; -} - - -/* =========================================================================== - * Fill the window when the lookahead becomes insufficient. - * Updates strstart and lookahead. - * - * IN assertion: lookahead < MIN_LOOKAHEAD - * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD - * At least one byte has been read, or avail_in == 0; reads are - * performed for at least two bytes (required for the zip translate_eol - * option -- not supported here). - */ -function fill_window(s) { - var _w_size = s.w_size; - var p, n, m, more, str; - - //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); - - do { - more = s.window_size - s.lookahead - s.strstart; - - // JS ints have 32 bit, block below not needed - /* Deal with !@#$% 64K limit: */ - //if (sizeof(int) <= 2) { - // if (more == 0 && s->strstart == 0 && s->lookahead == 0) { - // more = wsize; - // - // } else if (more == (unsigned)(-1)) { - // /* Very unlikely, but possible on 16 bit machine if - // * strstart == 0 && lookahead == 1 (input done a byte at time) - // */ - // more--; - // } - //} - - - /* If the window is almost full and there is insufficient lookahead, - * move the upper half to the lower one to make room in the upper half. - */ - if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { - - utils.arraySet(s.window, s.window, _w_size, _w_size, 0); - s.match_start -= _w_size; - s.strstart -= _w_size; - /* we now have strstart >= MAX_DIST */ - s.block_start -= _w_size; - - /* Slide the hash table (could be avoided with 32 bit values - at the expense of memory usage). We slide even when level == 0 - to keep the hash table consistent if we switch back to level > 0 - later. (Using level 0 permanently is not an optimal usage of - zlib, so we don't care about this pathological case.) - */ - - n = s.hash_size; - p = n; - do { - m = s.head[--p]; - s.head[p] = (m >= _w_size ? m - _w_size : 0); - } while (--n); - - n = _w_size; - p = n; - do { - m = s.prev[--p]; - s.prev[p] = (m >= _w_size ? m - _w_size : 0); - /* If n is not on any hash chain, prev[n] is garbage but - * its value will never be used. - */ - } while (--n); - - more += _w_size; - } - if (s.strm.avail_in === 0) { - break; - } - - /* If there was no sliding: - * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && - * more == window_size - lookahead - strstart - * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) - * => more >= window_size - 2*WSIZE + 2 - * In the BIG_MEM or MMAP case (not yet supported), - * window_size == input_size + MIN_LOOKAHEAD && - * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. - * Otherwise, window_size == 2*WSIZE so more >= 2. - * If there was sliding, more >= WSIZE. So in all cases, more >= 2. - */ - //Assert(more >= 2, "more < 2"); - n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more); - s.lookahead += n; - - /* Initialize the hash value now that we have some input: */ - if (s.lookahead + s.insert >= MIN_MATCH) { - str = s.strstart - s.insert; - s.ins_h = s.window[str]; - - /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask; -//#if MIN_MATCH != 3 -// Call update_hash() MIN_MATCH-3 more times -//#endif - while (s.insert) { - /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; - - s.prev[str & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = str; - str++; - s.insert--; - if (s.lookahead + s.insert < MIN_MATCH) { - break; - } - } - } - /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, - * but this is not important since only literal bytes will be emitted. - */ - - } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); - - /* If the WIN_INIT bytes after the end of the current data have never been - * written, then zero those bytes in order to avoid memory check reports of - * the use of uninitialized (or uninitialised as Julian writes) bytes by - * the longest match routines. Update the high water mark for the next - * time through here. WIN_INIT is set to MAX_MATCH since the longest match - * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. - */ -// if (s.high_water < s.window_size) { -// var curr = s.strstart + s.lookahead; -// var init = 0; -// -// if (s.high_water < curr) { -// /* Previous high water mark below current data -- zero WIN_INIT -// * bytes or up to end of window, whichever is less. -// */ -// init = s.window_size - curr; -// if (init > WIN_INIT) -// init = WIN_INIT; -// zmemzero(s->window + curr, (unsigned)init); -// s->high_water = curr + init; -// } -// else if (s->high_water < (ulg)curr + WIN_INIT) { -// /* High water mark at or above current data, but below current data -// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up -// * to end of window, whichever is less. -// */ -// init = (ulg)curr + WIN_INIT - s->high_water; -// if (init > s->window_size - s->high_water) -// init = s->window_size - s->high_water; -// zmemzero(s->window + s->high_water, (unsigned)init); -// s->high_water += init; -// } -// } -// -// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, -// "not enough room for search"); -} - -/* =========================================================================== - * Copy without compression as much as possible from the input stream, return - * the current block state. - * This function does not insert new strings in the dictionary since - * uncompressible data is probably not useful. This function is used - * only for the level=0 compression option. - * NOTE: this function should be optimized to avoid extra copying from - * window to pending_buf. - */ -function deflate_stored(s, flush) { - /* Stored blocks are limited to 0xffff bytes, pending_buf is limited - * to pending_buf_size, and each stored block has a 5 byte header: - */ - var max_block_size = 0xffff; - - if (max_block_size > s.pending_buf_size - 5) { - max_block_size = s.pending_buf_size - 5; - } - - /* Copy as much as possible from input to output: */ - for (;;) { - /* Fill the window as much as possible: */ - if (s.lookahead <= 1) { - - //Assert(s->strstart < s->w_size+MAX_DIST(s) || - // s->block_start >= (long)s->w_size, "slide too late"); -// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) || -// s.block_start >= s.w_size)) { -// throw new Error("slide too late"); -// } - - fill_window(s); - if (s.lookahead === 0 && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - - if (s.lookahead === 0) { - break; - } - /* flush the current block */ - } - //Assert(s->block_start >= 0L, "block gone"); -// if (s.block_start < 0) throw new Error("block gone"); - - s.strstart += s.lookahead; - s.lookahead = 0; - - /* Emit a stored block if pending_buf will be full: */ - var max_start = s.block_start + max_block_size; - - if (s.strstart === 0 || s.strstart >= max_start) { - /* strstart == 0 is possible when wraparound on 16-bit machine */ - s.lookahead = s.strstart - max_start; - s.strstart = max_start; - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - - - } - /* Flush if we may have to slide, otherwise block_start may become - * negative and the data will be gone: - */ - if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - - s.insert = 0; - - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - - if (s.strstart > s.block_start) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - - return BS_NEED_MORE; -} - -/* =========================================================================== - * Compress as much as possible from the input stream, return the current - * block state. - * This function does not perform lazy evaluation of matches and inserts - * new strings in the dictionary only for unmatched strings or for short - * matches. It is used only for the fast compression options. - */ -function deflate_fast(s, flush) { - var hash_head; /* head of the hash chain */ - var bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s.lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { - break; /* flush the current block */ - } - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - hash_head = 0/*NIL*/; - if (s.lookahead >= MIN_MATCH) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - - /* Find the longest match, discarding those <= prev_length. - * At this point we have always match_length < MIN_MATCH - */ - if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - s.match_length = longest_match(s, hash_head); - /* longest_match() sets match_start */ - } - if (s.match_length >= MIN_MATCH) { - // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only - - /*** _tr_tally_dist(s, s.strstart - s.match_start, - s.match_length - MIN_MATCH, bflush); ***/ - bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH); - - s.lookahead -= s.match_length; - - /* Insert new strings in the hash table only if the match length - * is not too large. This saves time but degrades compression. - */ - if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) { - s.match_length--; /* string at strstart already in table */ - do { - s.strstart++; - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - /* strstart never exceeds WSIZE-MAX_MATCH, so there are - * always MIN_MATCH bytes ahead. - */ - } while (--s.match_length !== 0); - s.strstart++; - } else - { - s.strstart += s.match_length; - s.match_length = 0; - s.ins_h = s.window[s.strstart]; - /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask; - -//#if MIN_MATCH != 3 -// Call UPDATE_HASH() MIN_MATCH-3 more times -//#endif - /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not - * matter since it will be recomputed at next deflate call. - */ - } - } else { - /* No match, output a literal byte */ - //Tracevv((stderr,"%c", s.window[s.strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - - s.lookahead--; - s.strstart++; - } - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1); - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; -} - -/* =========================================================================== - * Same as above, but achieves better compression. We use a lazy - * evaluation for matches: a match is finally adopted only if there is - * no better match at the next window position. - */ -function deflate_slow(s, flush) { - var hash_head; /* head of hash chain */ - var bflush; /* set if current block must be flushed */ - - var max_insert; - - /* Process the input block. */ - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s.lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { break; } /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - hash_head = 0/*NIL*/; - if (s.lookahead >= MIN_MATCH) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - - /* Find the longest match, discarding those <= prev_length. - */ - s.prev_length = s.match_length; - s.prev_match = s.match_start; - s.match_length = MIN_MATCH - 1; - - if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match && - s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - s.match_length = longest_match(s, hash_head); - /* longest_match() sets match_start */ - - if (s.match_length <= 5 && - (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) { - - /* If prev_match is also MIN_MATCH, match_start is garbage - * but we will ignore the current match anyway. - */ - s.match_length = MIN_MATCH - 1; - } - } - /* If there was a match at the previous step and the current - * match is not better, output the previous match: - */ - if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { - max_insert = s.strstart + s.lookahead - MIN_MATCH; - /* Do not insert strings in hash table beyond this. */ - - //check_match(s, s.strstart-1, s.prev_match, s.prev_length); - - /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match, - s.prev_length - MIN_MATCH, bflush);***/ - bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH); - /* Insert in hash table all strings up to the end of the match. - * strstart-1 and strstart are already inserted. If there is not - * enough lookahead, the last two strings are not inserted in - * the hash table. - */ - s.lookahead -= s.prev_length - 1; - s.prev_length -= 2; - do { - if (++s.strstart <= max_insert) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - } while (--s.prev_length !== 0); - s.match_available = 0; - s.match_length = MIN_MATCH - 1; - s.strstart++; - - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - - } else if (s.match_available) { - /* If there was no match at the previous position, output a - * single literal. If there was a match but the current match - * is longer, truncate the previous match to a single literal. - */ - //Tracevv((stderr,"%c", s->window[s->strstart-1])); - /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); - - if (bflush) { - /*** FLUSH_BLOCK_ONLY(s, 0) ***/ - flush_block_only(s, false); - /***/ - } - s.strstart++; - s.lookahead--; - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } else { - /* There is no previous match to compare with, wait for - * the next step to decide. - */ - s.match_available = 1; - s.strstart++; - s.lookahead--; - } - } - //Assert (flush != Z_NO_FLUSH, "no flush?"); - if (s.match_available) { - //Tracevv((stderr,"%c", s->window[s->strstart-1])); - /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); - - s.match_available = 0; - } - s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - - return BS_BLOCK_DONE; -} - - -/* =========================================================================== - * For Z_RLE, simply look for runs of bytes, generate matches only of distance - * one. Do not maintain a hash table. (It will be regenerated if this run of - * deflate switches away from Z_RLE.) - */ -function deflate_rle(s, flush) { - var bflush; /* set if current block must be flushed */ - var prev; /* byte at distance one to match */ - var scan, strend; /* scan goes up to strend for length of run */ - - var _win = s.window; - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the longest run, plus one for the unrolled loop. - */ - if (s.lookahead <= MAX_MATCH) { - fill_window(s); - if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { break; } /* flush the current block */ - } - - /* See how many times the previous byte repeats */ - s.match_length = 0; - if (s.lookahead >= MIN_MATCH && s.strstart > 0) { - scan = s.strstart - 1; - prev = _win[scan]; - if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) { - strend = s.strstart + MAX_MATCH; - do { - /*jshint noempty:false*/ - } while (prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - scan < strend); - s.match_length = MAX_MATCH - (strend - scan); - if (s.match_length > s.lookahead) { - s.match_length = s.lookahead; - } - } - //Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); - } - - /* Emit match if have run of MIN_MATCH or longer, else emit literal */ - if (s.match_length >= MIN_MATCH) { - //check_match(s, s.strstart, s.strstart - 1, s.match_length); - - /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/ - bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH); - - s.lookahead -= s.match_length; - s.strstart += s.match_length; - s.match_length = 0; - } else { - /* No match, output a literal byte */ - //Tracevv((stderr,"%c", s->window[s->strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - - s.lookahead--; - s.strstart++; - } - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = 0; - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; -} - -/* =========================================================================== - * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. - * (It will be regenerated if this run of deflate switches away from Huffman.) - */ -function deflate_huff(s, flush) { - var bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we have a literal to write. */ - if (s.lookahead === 0) { - fill_window(s); - if (s.lookahead === 0) { - if (flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - break; /* flush the current block */ - } - } - - /* Output a literal byte */ - s.match_length = 0; - //Tracevv((stderr,"%c", s->window[s->strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - s.lookahead--; - s.strstart++; - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = 0; - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; -} - -/* Values for max_lazy_match, good_match and max_chain_length, depending on - * the desired pack level (0..9). The values given below have been tuned to - * exclude worst case performance for pathological files. Better values may be - * found for specific files. - */ -function Config(good_length, max_lazy, nice_length, max_chain, func) { - this.good_length = good_length; - this.max_lazy = max_lazy; - this.nice_length = nice_length; - this.max_chain = max_chain; - this.func = func; -} - -var configuration_table; - -configuration_table = [ - /* good lazy nice chain */ - new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */ - new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */ - new Config(4, 5, 16, 8, deflate_fast), /* 2 */ - new Config(4, 6, 32, 32, deflate_fast), /* 3 */ - - new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */ - new Config(8, 16, 32, 32, deflate_slow), /* 5 */ - new Config(8, 16, 128, 128, deflate_slow), /* 6 */ - new Config(8, 32, 128, 256, deflate_slow), /* 7 */ - new Config(32, 128, 258, 1024, deflate_slow), /* 8 */ - new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */ -]; - - -/* =========================================================================== - * Initialize the "longest match" routines for a new zlib stream - */ -function lm_init(s) { - s.window_size = 2 * s.w_size; - - /*** CLEAR_HASH(s); ***/ - zero(s.head); // Fill with NIL (= 0); - - /* Set the default configuration parameters: - */ - s.max_lazy_match = configuration_table[s.level].max_lazy; - s.good_match = configuration_table[s.level].good_length; - s.nice_match = configuration_table[s.level].nice_length; - s.max_chain_length = configuration_table[s.level].max_chain; - - s.strstart = 0; - s.block_start = 0; - s.lookahead = 0; - s.insert = 0; - s.match_length = s.prev_length = MIN_MATCH - 1; - s.match_available = 0; - s.ins_h = 0; -} - - -function DeflateState() { - this.strm = null; /* pointer back to this zlib stream */ - this.status = 0; /* as the name implies */ - this.pending_buf = null; /* output still pending */ - this.pending_buf_size = 0; /* size of pending_buf */ - this.pending_out = 0; /* next pending byte to output to the stream */ - this.pending = 0; /* nb of bytes in the pending buffer */ - this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ - this.gzhead = null; /* gzip header information to write */ - this.gzindex = 0; /* where in extra, name, or comment */ - this.method = Z_DEFLATED; /* can only be DEFLATED */ - this.last_flush = -1; /* value of flush param for previous deflate call */ - - this.w_size = 0; /* LZ77 window size (32K by default) */ - this.w_bits = 0; /* log2(w_size) (8..16) */ - this.w_mask = 0; /* w_size - 1 */ - - this.window = null; - /* Sliding window. Input bytes are read into the second half of the window, - * and move to the first half later to keep a dictionary of at least wSize - * bytes. With this organization, matches are limited to a distance of - * wSize-MAX_MATCH bytes, but this ensures that IO is always - * performed with a length multiple of the block size. - */ - - this.window_size = 0; - /* Actual size of window: 2*wSize, except when the user input buffer - * is directly used as sliding window. - */ - - this.prev = null; - /* Link to older string with same hash index. To limit the size of this - * array to 64K, this link is maintained only for the last 32K strings. - * An index in this array is thus a window index modulo 32K. - */ - - this.head = null; /* Heads of the hash chains or NIL. */ - - this.ins_h = 0; /* hash index of string to be inserted */ - this.hash_size = 0; /* number of elements in hash table */ - this.hash_bits = 0; /* log2(hash_size) */ - this.hash_mask = 0; /* hash_size-1 */ - - this.hash_shift = 0; - /* Number of bits by which ins_h must be shifted at each input - * step. It must be such that after MIN_MATCH steps, the oldest - * byte no longer takes part in the hash key, that is: - * hash_shift * MIN_MATCH >= hash_bits - */ - - this.block_start = 0; - /* Window position at the beginning of the current output block. Gets - * negative when the window is moved backwards. - */ - - this.match_length = 0; /* length of best match */ - this.prev_match = 0; /* previous match */ - this.match_available = 0; /* set if previous match exists */ - this.strstart = 0; /* start of string to insert */ - this.match_start = 0; /* start of matching string */ - this.lookahead = 0; /* number of valid bytes ahead in window */ - - this.prev_length = 0; - /* Length of the best match at previous step. Matches not greater than this - * are discarded. This is used in the lazy match evaluation. - */ - - this.max_chain_length = 0; - /* To speed up deflation, hash chains are never searched beyond this - * length. A higher limit improves compression ratio but degrades the - * speed. - */ - - this.max_lazy_match = 0; - /* Attempt to find a better match only when the current match is strictly - * smaller than this value. This mechanism is used only for compression - * levels >= 4. - */ - // That's alias to max_lazy_match, don't use directly - //this.max_insert_length = 0; - /* Insert new strings in the hash table only if the match length is not - * greater than this length. This saves time but degrades compression. - * max_insert_length is used only for compression levels <= 3. - */ - - this.level = 0; /* compression level (1..9) */ - this.strategy = 0; /* favor or force Huffman coding*/ - - this.good_match = 0; - /* Use a faster search when the previous match is longer than this */ - - this.nice_match = 0; /* Stop searching when current match exceeds this */ - - /* used by trees.c: */ - - /* Didn't use ct_data typedef below to suppress compiler warning */ - - // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ - // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ - // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ - - // Use flat array of DOUBLE size, with interleaved fata, - // because JS does not support effective - this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2); - this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2); - this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2); - zero(this.dyn_ltree); - zero(this.dyn_dtree); - zero(this.bl_tree); - - this.l_desc = null; /* desc. for literal tree */ - this.d_desc = null; /* desc. for distance tree */ - this.bl_desc = null; /* desc. for bit length tree */ - - //ush bl_count[MAX_BITS+1]; - this.bl_count = new utils.Buf16(MAX_BITS + 1); - /* number of codes at each bit length for an optimal tree */ - - //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ - this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */ - zero(this.heap); - - this.heap_len = 0; /* number of elements in the heap */ - this.heap_max = 0; /* element of largest frequency */ - /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. - * The same heap array is used to build all trees. - */ - - this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1]; - zero(this.depth); - /* Depth of each subtree used as tie breaker for trees of equal frequency - */ - - this.l_buf = 0; /* buffer index for literals or lengths */ - - this.lit_bufsize = 0; - /* Size of match buffer for literals/lengths. There are 4 reasons for - * limiting lit_bufsize to 64K: - * - frequencies can be kept in 16 bit counters - * - if compression is not successful for the first block, all input - * data is still in the window so we can still emit a stored block even - * when input comes from standard input. (This can also be done for - * all blocks if lit_bufsize is not greater than 32K.) - * - if compression is not successful for a file smaller than 64K, we can - * even emit a stored file instead of a stored block (saving 5 bytes). - * This is applicable only for zip (not gzip or zlib). - * - creating new Huffman trees less frequently may not provide fast - * adaptation to changes in the input data statistics. (Take for - * example a binary file with poorly compressible code followed by - * a highly compressible string table.) Smaller buffer sizes give - * fast adaptation but have of course the overhead of transmitting - * trees more frequently. - * - I can't count above 4 - */ - - this.last_lit = 0; /* running index in l_buf */ - - this.d_buf = 0; - /* Buffer index for distances. To simplify the code, d_buf and l_buf have - * the same number of elements. To use different lengths, an extra flag - * array would be necessary. - */ - - this.opt_len = 0; /* bit length of current block with optimal trees */ - this.static_len = 0; /* bit length of current block with static trees */ - this.matches = 0; /* number of string matches in current block */ - this.insert = 0; /* bytes at end of window left to insert */ - - - this.bi_buf = 0; - /* Output buffer. bits are inserted starting at the bottom (least - * significant bits). - */ - this.bi_valid = 0; - /* Number of valid bits in bi_buf. All bits above the last valid bit - * are always zero. - */ - - // Used for window memory init. We safely ignore it for JS. That makes - // sense only for pointers and memory check tools. - //this.high_water = 0; - /* High water mark offset in window for initialized bytes -- bytes above - * this are set to zero in order to avoid memory check warnings when - * longest match routines access bytes past the input. This is then - * updated to the new high water mark. - */ -} - - -function deflateResetKeep(strm) { - var s; - - if (!strm || !strm.state) { - return err(strm, Z_STREAM_ERROR); - } - - strm.total_in = strm.total_out = 0; - strm.data_type = Z_UNKNOWN; - - s = strm.state; - s.pending = 0; - s.pending_out = 0; - - if (s.wrap < 0) { - s.wrap = -s.wrap; - /* was made negative by deflate(..., Z_FINISH); */ - } - s.status = (s.wrap ? INIT_STATE : BUSY_STATE); - strm.adler = (s.wrap === 2) ? - 0 // crc32(0, Z_NULL, 0) - : - 1; // adler32(0, Z_NULL, 0) - s.last_flush = Z_NO_FLUSH; - trees._tr_init(s); - return Z_OK; -} - - -function deflateReset(strm) { - var ret = deflateResetKeep(strm); - if (ret === Z_OK) { - lm_init(strm.state); - } - return ret; -} - - -function deflateSetHeader(strm, head) { - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; } - strm.state.gzhead = head; - return Z_OK; -} - - -function deflateInit2(strm, level, method, windowBits, memLevel, strategy) { - if (!strm) { // === Z_NULL - return Z_STREAM_ERROR; - } - var wrap = 1; - - if (level === Z_DEFAULT_COMPRESSION) { - level = 6; - } - - if (windowBits < 0) { /* suppress zlib wrapper */ - wrap = 0; - windowBits = -windowBits; - } - - else if (windowBits > 15) { - wrap = 2; /* write gzip wrapper instead */ - windowBits -= 16; - } - - - if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || - windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || - strategy < 0 || strategy > Z_FIXED) { - return err(strm, Z_STREAM_ERROR); - } - - - if (windowBits === 8) { - windowBits = 9; - } - /* until 256-byte window bug fixed */ - - var s = new DeflateState(); - - strm.state = s; - s.strm = strm; - - s.wrap = wrap; - s.gzhead = null; - s.w_bits = windowBits; - s.w_size = 1 << s.w_bits; - s.w_mask = s.w_size - 1; - - s.hash_bits = memLevel + 7; - s.hash_size = 1 << s.hash_bits; - s.hash_mask = s.hash_size - 1; - s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH); - - s.window = new utils.Buf8(s.w_size * 2); - s.head = new utils.Buf16(s.hash_size); - s.prev = new utils.Buf16(s.w_size); - - // Don't need mem init magic for JS. - //s.high_water = 0; /* nothing written to s->window yet */ - - s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ - - s.pending_buf_size = s.lit_bufsize * 4; - - //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); - //s->pending_buf = (uchf *) overlay; - s.pending_buf = new utils.Buf8(s.pending_buf_size); - - // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`) - //s->d_buf = overlay + s->lit_bufsize/sizeof(ush); - s.d_buf = 1 * s.lit_bufsize; - - //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; - s.l_buf = (1 + 2) * s.lit_bufsize; - - s.level = level; - s.strategy = strategy; - s.method = method; - - return deflateReset(strm); -} - -function deflateInit(strm, level) { - return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); -} - - -function deflate(strm, flush) { - var old_flush, s; - var beg, val; // for gzip header write only - - if (!strm || !strm.state || - flush > Z_BLOCK || flush < 0) { - return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR; - } - - s = strm.state; - - if (!strm.output || - (!strm.input && strm.avail_in !== 0) || - (s.status === FINISH_STATE && flush !== Z_FINISH)) { - return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR); - } - - s.strm = strm; /* just in case */ - old_flush = s.last_flush; - s.last_flush = flush; - - /* Write the header */ - if (s.status === INIT_STATE) { - - if (s.wrap === 2) { // GZIP header - strm.adler = 0; //crc32(0L, Z_NULL, 0); - put_byte(s, 31); - put_byte(s, 139); - put_byte(s, 8); - if (!s.gzhead) { // s->gzhead == Z_NULL - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, s.level === 9 ? 2 : - (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? - 4 : 0)); - put_byte(s, OS_CODE); - s.status = BUSY_STATE; - } - else { - put_byte(s, (s.gzhead.text ? 1 : 0) + - (s.gzhead.hcrc ? 2 : 0) + - (!s.gzhead.extra ? 0 : 4) + - (!s.gzhead.name ? 0 : 8) + - (!s.gzhead.comment ? 0 : 16) - ); - put_byte(s, s.gzhead.time & 0xff); - put_byte(s, (s.gzhead.time >> 8) & 0xff); - put_byte(s, (s.gzhead.time >> 16) & 0xff); - put_byte(s, (s.gzhead.time >> 24) & 0xff); - put_byte(s, s.level === 9 ? 2 : - (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? - 4 : 0)); - put_byte(s, s.gzhead.os & 0xff); - if (s.gzhead.extra && s.gzhead.extra.length) { - put_byte(s, s.gzhead.extra.length & 0xff); - put_byte(s, (s.gzhead.extra.length >> 8) & 0xff); - } - if (s.gzhead.hcrc) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0); - } - s.gzindex = 0; - s.status = EXTRA_STATE; - } - } - else // DEFLATE header - { - var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8; - var level_flags = -1; - - if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) { - level_flags = 0; - } else if (s.level < 6) { - level_flags = 1; - } else if (s.level === 6) { - level_flags = 2; - } else { - level_flags = 3; - } - header |= (level_flags << 6); - if (s.strstart !== 0) { header |= PRESET_DICT; } - header += 31 - (header % 31); - - s.status = BUSY_STATE; - putShortMSB(s, header); - - /* Save the adler32 of the preset dictionary: */ - if (s.strstart !== 0) { - putShortMSB(s, strm.adler >>> 16); - putShortMSB(s, strm.adler & 0xffff); - } - strm.adler = 1; // adler32(0L, Z_NULL, 0); - } - } - -//#ifdef GZIP - if (s.status === EXTRA_STATE) { - if (s.gzhead.extra/* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - - while (s.gzindex < (s.gzhead.extra.length & 0xffff)) { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - break; - } - } - put_byte(s, s.gzhead.extra[s.gzindex] & 0xff); - s.gzindex++; - } - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (s.gzindex === s.gzhead.extra.length) { - s.gzindex = 0; - s.status = NAME_STATE; - } - } - else { - s.status = NAME_STATE; - } - } - if (s.status === NAME_STATE) { - if (s.gzhead.name/* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - //int val; - - do { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - val = 1; - break; - } - } - // JS specific: little magic to add zero terminator to end of string - if (s.gzindex < s.gzhead.name.length) { - val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff; - } else { - val = 0; - } - put_byte(s, val); - } while (val !== 0); - - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (val === 0) { - s.gzindex = 0; - s.status = COMMENT_STATE; - } - } - else { - s.status = COMMENT_STATE; - } - } - if (s.status === COMMENT_STATE) { - if (s.gzhead.comment/* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - //int val; - - do { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - val = 1; - break; - } - } - // JS specific: little magic to add zero terminator to end of string - if (s.gzindex < s.gzhead.comment.length) { - val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff; - } else { - val = 0; - } - put_byte(s, val); - } while (val !== 0); - - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (val === 0) { - s.status = HCRC_STATE; - } - } - else { - s.status = HCRC_STATE; - } - } - if (s.status === HCRC_STATE) { - if (s.gzhead.hcrc) { - if (s.pending + 2 > s.pending_buf_size) { - flush_pending(strm); - } - if (s.pending + 2 <= s.pending_buf_size) { - put_byte(s, strm.adler & 0xff); - put_byte(s, (strm.adler >> 8) & 0xff); - strm.adler = 0; //crc32(0L, Z_NULL, 0); - s.status = BUSY_STATE; - } - } - else { - s.status = BUSY_STATE; - } - } -//#endif - - /* Flush as much pending output as possible */ - if (s.pending !== 0) { - flush_pending(strm); - if (strm.avail_out === 0) { - /* Since avail_out is 0, deflate will be called again with - * more output space, but possibly with both pending and - * avail_in equal to zero. There won't be anything to do, - * but this is not an error situation so make sure we - * return OK instead of BUF_ERROR at next call of deflate: - */ - s.last_flush = -1; - return Z_OK; - } - - /* Make sure there is something to do and avoid duplicate consecutive - * flushes. For repeated and useless calls with Z_FINISH, we keep - * returning Z_STREAM_END instead of Z_BUF_ERROR. - */ - } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && - flush !== Z_FINISH) { - return err(strm, Z_BUF_ERROR); - } - - /* User must not provide more input after the first FINISH: */ - if (s.status === FINISH_STATE && strm.avail_in !== 0) { - return err(strm, Z_BUF_ERROR); - } - - /* Start a new block or continue the current one. - */ - if (strm.avail_in !== 0 || s.lookahead !== 0 || - (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) { - var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) : - (s.strategy === Z_RLE ? deflate_rle(s, flush) : - configuration_table[s.level].func(s, flush)); - - if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) { - s.status = FINISH_STATE; - } - if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) { - if (strm.avail_out === 0) { - s.last_flush = -1; - /* avoid BUF_ERROR next call, see above */ - } - return Z_OK; - /* If flush != Z_NO_FLUSH && avail_out == 0, the next call - * of deflate should use the same flush parameter to make sure - * that the flush is complete. So we don't have to output an - * empty block here, this will be done at next call. This also - * ensures that for a very small output buffer, we emit at most - * one empty block. - */ - } - if (bstate === BS_BLOCK_DONE) { - if (flush === Z_PARTIAL_FLUSH) { - trees._tr_align(s); - } - else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ - - trees._tr_stored_block(s, 0, 0, false); - /* For a full flush, this empty block will be recognized - * as a special marker by inflate_sync(). - */ - if (flush === Z_FULL_FLUSH) { - /*** CLEAR_HASH(s); ***/ /* forget history */ - zero(s.head); // Fill with NIL (= 0); - - if (s.lookahead === 0) { - s.strstart = 0; - s.block_start = 0; - s.insert = 0; - } - } - } - flush_pending(strm); - if (strm.avail_out === 0) { - s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */ - return Z_OK; - } - } - } - //Assert(strm->avail_out > 0, "bug2"); - //if (strm.avail_out <= 0) { throw new Error("bug2");} - - if (flush !== Z_FINISH) { return Z_OK; } - if (s.wrap <= 0) { return Z_STREAM_END; } - - /* Write the trailer */ - if (s.wrap === 2) { - put_byte(s, strm.adler & 0xff); - put_byte(s, (strm.adler >> 8) & 0xff); - put_byte(s, (strm.adler >> 16) & 0xff); - put_byte(s, (strm.adler >> 24) & 0xff); - put_byte(s, strm.total_in & 0xff); - put_byte(s, (strm.total_in >> 8) & 0xff); - put_byte(s, (strm.total_in >> 16) & 0xff); - put_byte(s, (strm.total_in >> 24) & 0xff); - } - else - { - putShortMSB(s, strm.adler >>> 16); - putShortMSB(s, strm.adler & 0xffff); - } - - flush_pending(strm); - /* If avail_out is zero, the application will call deflate again - * to flush the rest. - */ - if (s.wrap > 0) { s.wrap = -s.wrap; } - /* write the trailer only once! */ - return s.pending !== 0 ? Z_OK : Z_STREAM_END; -} - -function deflateEnd(strm) { - var status; - - if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { - return Z_STREAM_ERROR; - } - - status = strm.state.status; - if (status !== INIT_STATE && - status !== EXTRA_STATE && - status !== NAME_STATE && - status !== COMMENT_STATE && - status !== HCRC_STATE && - status !== BUSY_STATE && - status !== FINISH_STATE - ) { - return err(strm, Z_STREAM_ERROR); - } - - strm.state = null; - - return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK; -} - - -/* ========================================================================= - * Initializes the compression dictionary from the given byte - * sequence without producing any compressed output. - */ -function deflateSetDictionary(strm, dictionary) { - var dictLength = dictionary.length; - - var s; - var str, n; - var wrap; - var avail; - var next; - var input; - var tmpDict; - - if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { - return Z_STREAM_ERROR; - } - - s = strm.state; - wrap = s.wrap; - - if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) { - return Z_STREAM_ERROR; - } - - /* when using zlib wrappers, compute Adler-32 for provided dictionary */ - if (wrap === 1) { - /* adler32(strm->adler, dictionary, dictLength); */ - strm.adler = adler32(strm.adler, dictionary, dictLength, 0); - } - - s.wrap = 0; /* avoid computing Adler-32 in read_buf */ - - /* if dictionary would fill window, just replace the history */ - if (dictLength >= s.w_size) { - if (wrap === 0) { /* already empty otherwise */ - /*** CLEAR_HASH(s); ***/ - zero(s.head); // Fill with NIL (= 0); - s.strstart = 0; - s.block_start = 0; - s.insert = 0; - } - /* use the tail */ - // dictionary = dictionary.slice(dictLength - s.w_size); - tmpDict = new utils.Buf8(s.w_size); - utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0); - dictionary = tmpDict; - dictLength = s.w_size; - } - /* insert dictionary into window and hash */ - avail = strm.avail_in; - next = strm.next_in; - input = strm.input; - strm.avail_in = dictLength; - strm.next_in = 0; - strm.input = dictionary; - fill_window(s); - while (s.lookahead >= MIN_MATCH) { - str = s.strstart; - n = s.lookahead - (MIN_MATCH - 1); - do { - /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; - - s.prev[str & s.w_mask] = s.head[s.ins_h]; - - s.head[s.ins_h] = str; - str++; - } while (--n); - s.strstart = str; - s.lookahead = MIN_MATCH - 1; - fill_window(s); - } - s.strstart += s.lookahead; - s.block_start = s.strstart; - s.insert = s.lookahead; - s.lookahead = 0; - s.match_length = s.prev_length = MIN_MATCH - 1; - s.match_available = 0; - strm.next_in = next; - strm.input = input; - strm.avail_in = avail; - s.wrap = wrap; - return Z_OK; -} - - -exports.deflateInit = deflateInit; -exports.deflateInit2 = deflateInit2; -exports.deflateReset = deflateReset; -exports.deflateResetKeep = deflateResetKeep; -exports.deflateSetHeader = deflateSetHeader; -exports.deflate = deflate; -exports.deflateEnd = deflateEnd; -exports.deflateSetDictionary = deflateSetDictionary; -exports.deflateInfo = 'pako deflate (from Nodeca project)'; - -/* Not implemented -exports.deflateBound = deflateBound; -exports.deflateCopy = deflateCopy; -exports.deflateParams = deflateParams; -exports.deflatePending = deflatePending; -exports.deflatePrime = deflatePrime; -exports.deflateTune = deflateTune; -*/ - -},{"../utils/common":89,"./adler32":91,"./crc32":93,"./messages":99,"./trees":100}],95:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -function GZheader() { - /* true if compressed data believed to be text */ - this.text = 0; - /* modification time */ - this.time = 0; - /* extra flags (not used when writing a gzip file) */ - this.xflags = 0; - /* operating system */ - this.os = 0; - /* pointer to extra field or Z_NULL if none */ - this.extra = null; - /* extra field length (valid if extra != Z_NULL) */ - this.extra_len = 0; // Actually, we don't need it in JS, - // but leave for few code modifications - - // - // Setup limits is not necessary because in js we should not preallocate memory - // for inflate use constant limit in 65536 bytes - // - - /* space at extra (only when reading header) */ - // this.extra_max = 0; - /* pointer to zero-terminated file name or Z_NULL */ - this.name = ''; - /* space at name (only when reading header) */ - // this.name_max = 0; - /* pointer to zero-terminated comment or Z_NULL */ - this.comment = ''; - /* space at comment (only when reading header) */ - // this.comm_max = 0; - /* true if there was or will be a header crc */ - this.hcrc = 0; - /* true when done reading gzip header (not used when writing a gzip file) */ - this.done = false; -} - -module.exports = GZheader; - -},{}],96:[function(require,module,exports){ -arguments[4][41][0].apply(exports,arguments) -},{"dup":41}],97:[function(require,module,exports){ -arguments[4][42][0].apply(exports,arguments) -},{"../utils/common":89,"./adler32":91,"./crc32":93,"./inffast":96,"./inftrees":98,"dup":42}],98:[function(require,module,exports){ -arguments[4][43][0].apply(exports,arguments) -},{"../utils/common":89,"dup":43}],99:[function(require,module,exports){ -arguments[4][44][0].apply(exports,arguments) -},{"dup":44}],100:[function(require,module,exports){ -'use strict'; - -// (C) 1995-2013 Jean-loup Gailly and Mark Adler -// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin -// -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// 3. This notice may not be removed or altered from any source distribution. - -var utils = require('../utils/common'); - -/* Public constants ==========================================================*/ -/* ===========================================================================*/ - - -//var Z_FILTERED = 1; -//var Z_HUFFMAN_ONLY = 2; -//var Z_RLE = 3; -var Z_FIXED = 4; -//var Z_DEFAULT_STRATEGY = 0; - -/* Possible values of the data_type field (though see inflate()) */ -var Z_BINARY = 0; -var Z_TEXT = 1; -//var Z_ASCII = 1; // = Z_TEXT -var Z_UNKNOWN = 2; - -/*============================================================================*/ - - -function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } - -// From zutil.h - -var STORED_BLOCK = 0; -var STATIC_TREES = 1; -var DYN_TREES = 2; -/* The three kinds of block type */ - -var MIN_MATCH = 3; -var MAX_MATCH = 258; -/* The minimum and maximum match lengths */ - -// From deflate.h -/* =========================================================================== - * Internal compression state. - */ - -var LENGTH_CODES = 29; -/* number of length codes, not counting the special END_BLOCK code */ - -var LITERALS = 256; -/* number of literal bytes 0..255 */ - -var L_CODES = LITERALS + 1 + LENGTH_CODES; -/* number of Literal or Length codes, including the END_BLOCK code */ - -var D_CODES = 30; -/* number of distance codes */ - -var BL_CODES = 19; -/* number of codes used to transfer the bit lengths */ - -var HEAP_SIZE = 2 * L_CODES + 1; -/* maximum heap size */ - -var MAX_BITS = 15; -/* All codes must not exceed MAX_BITS bits */ - -var Buf_size = 16; -/* size of bit buffer in bi_buf */ - - -/* =========================================================================== - * Constants - */ - -var MAX_BL_BITS = 7; -/* Bit length codes must not exceed MAX_BL_BITS bits */ - -var END_BLOCK = 256; -/* end of block literal code */ - -var REP_3_6 = 16; -/* repeat previous bit length 3-6 times (2 bits of repeat count) */ - -var REPZ_3_10 = 17; -/* repeat a zero length 3-10 times (3 bits of repeat count) */ - -var REPZ_11_138 = 18; -/* repeat a zero length 11-138 times (7 bits of repeat count) */ - -/* eslint-disable comma-spacing,array-bracket-spacing */ -var extra_lbits = /* extra bits for each length code */ - [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]; - -var extra_dbits = /* extra bits for each distance code */ - [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]; - -var extra_blbits = /* extra bits for each bit length code */ - [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]; - -var bl_order = - [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]; -/* eslint-enable comma-spacing,array-bracket-spacing */ - -/* The lengths of the bit length codes are sent in order of decreasing - * probability, to avoid transmitting the lengths for unused bit length codes. - */ - -/* =========================================================================== - * Local data. These are initialized only once. - */ - -// We pre-fill arrays with 0 to avoid uninitialized gaps - -var DIST_CODE_LEN = 512; /* see definition of array dist_code below */ - -// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1 -var static_ltree = new Array((L_CODES + 2) * 2); -zero(static_ltree); -/* The static literal tree. Since the bit lengths are imposed, there is no - * need for the L_CODES extra codes used during heap construction. However - * The codes 286 and 287 are needed to build a canonical tree (see _tr_init - * below). - */ - -var static_dtree = new Array(D_CODES * 2); -zero(static_dtree); -/* The static distance tree. (Actually a trivial tree since all codes use - * 5 bits.) - */ - -var _dist_code = new Array(DIST_CODE_LEN); -zero(_dist_code); -/* Distance codes. The first 256 values correspond to the distances - * 3 .. 258, the last 256 values correspond to the top 8 bits of - * the 15 bit distances. - */ - -var _length_code = new Array(MAX_MATCH - MIN_MATCH + 1); -zero(_length_code); -/* length code for each normalized match length (0 == MIN_MATCH) */ - -var base_length = new Array(LENGTH_CODES); -zero(base_length); -/* First normalized length for each code (0 = MIN_MATCH) */ - -var base_dist = new Array(D_CODES); -zero(base_dist); -/* First normalized distance for each code (0 = distance of 1) */ - - -function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) { - - this.static_tree = static_tree; /* static tree or NULL */ - this.extra_bits = extra_bits; /* extra bits for each code or NULL */ - this.extra_base = extra_base; /* base index for extra_bits */ - this.elems = elems; /* max number of elements in the tree */ - this.max_length = max_length; /* max bit length for the codes */ - - // show if `static_tree` has data or dummy - needed for monomorphic objects - this.has_stree = static_tree && static_tree.length; -} - - -var static_l_desc; -var static_d_desc; -var static_bl_desc; - - -function TreeDesc(dyn_tree, stat_desc) { - this.dyn_tree = dyn_tree; /* the dynamic tree */ - this.max_code = 0; /* largest code with non zero frequency */ - this.stat_desc = stat_desc; /* the corresponding static tree */ -} - - - -function d_code(dist) { - return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; -} - - -/* =========================================================================== - * Output a short LSB first on the stream. - * IN assertion: there is enough room in pendingBuf. - */ -function put_short(s, w) { -// put_byte(s, (uch)((w) & 0xff)); -// put_byte(s, (uch)((ush)(w) >> 8)); - s.pending_buf[s.pending++] = (w) & 0xff; - s.pending_buf[s.pending++] = (w >>> 8) & 0xff; -} - - -/* =========================================================================== - * Send a value on a given number of bits. - * IN assertion: length <= 16 and value fits in length bits. - */ -function send_bits(s, value, length) { - if (s.bi_valid > (Buf_size - length)) { - s.bi_buf |= (value << s.bi_valid) & 0xffff; - put_short(s, s.bi_buf); - s.bi_buf = value >> (Buf_size - s.bi_valid); - s.bi_valid += length - Buf_size; - } else { - s.bi_buf |= (value << s.bi_valid) & 0xffff; - s.bi_valid += length; - } -} - - -function send_code(s, c, tree) { - send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/); -} - - -/* =========================================================================== - * Reverse the first len bits of a code, using straightforward code (a faster - * method would use a table) - * IN assertion: 1 <= len <= 15 - */ -function bi_reverse(code, len) { - var res = 0; - do { - res |= code & 1; - code >>>= 1; - res <<= 1; - } while (--len > 0); - return res >>> 1; -} - - -/* =========================================================================== - * Flush the bit buffer, keeping at most 7 bits in it. - */ -function bi_flush(s) { - if (s.bi_valid === 16) { - put_short(s, s.bi_buf); - s.bi_buf = 0; - s.bi_valid = 0; - - } else if (s.bi_valid >= 8) { - s.pending_buf[s.pending++] = s.bi_buf & 0xff; - s.bi_buf >>= 8; - s.bi_valid -= 8; - } -} - - -/* =========================================================================== - * Compute the optimal bit lengths for a tree and update the total bit length - * for the current block. - * IN assertion: the fields freq and dad are set, heap[heap_max] and - * above are the tree nodes sorted by increasing frequency. - * OUT assertions: the field len is set to the optimal bit length, the - * array bl_count contains the frequencies for each bit length. - * The length opt_len is updated; static_len is also updated if stree is - * not null. - */ -function gen_bitlen(s, desc) -// deflate_state *s; -// tree_desc *desc; /* the tree descriptor */ -{ - var tree = desc.dyn_tree; - var max_code = desc.max_code; - var stree = desc.stat_desc.static_tree; - var has_stree = desc.stat_desc.has_stree; - var extra = desc.stat_desc.extra_bits; - var base = desc.stat_desc.extra_base; - var max_length = desc.stat_desc.max_length; - var h; /* heap index */ - var n, m; /* iterate over the tree elements */ - var bits; /* bit length */ - var xbits; /* extra bits */ - var f; /* frequency */ - var overflow = 0; /* number of elements with bit length too large */ - - for (bits = 0; bits <= MAX_BITS; bits++) { - s.bl_count[bits] = 0; - } - - /* In a first pass, compute the optimal bit lengths (which may - * overflow in the case of the bit length tree). - */ - tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */ - - for (h = s.heap_max + 1; h < HEAP_SIZE; h++) { - n = s.heap[h]; - bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1; - if (bits > max_length) { - bits = max_length; - overflow++; - } - tree[n * 2 + 1]/*.Len*/ = bits; - /* We overwrite tree[n].Dad which is no longer needed */ - - if (n > max_code) { continue; } /* not a leaf node */ - - s.bl_count[bits]++; - xbits = 0; - if (n >= base) { - xbits = extra[n - base]; - } - f = tree[n * 2]/*.Freq*/; - s.opt_len += f * (bits + xbits); - if (has_stree) { - s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits); - } - } - if (overflow === 0) { return; } - - // Trace((stderr,"\nbit length overflow\n")); - /* This happens for example on obj2 and pic of the Calgary corpus */ - - /* Find the first bit length which could increase: */ - do { - bits = max_length - 1; - while (s.bl_count[bits] === 0) { bits--; } - s.bl_count[bits]--; /* move one leaf down the tree */ - s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */ - s.bl_count[max_length]--; - /* The brother of the overflow item also moves one step up, - * but this does not affect bl_count[max_length] - */ - overflow -= 2; - } while (overflow > 0); - - /* Now recompute all bit lengths, scanning in increasing frequency. - * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all - * lengths instead of fixing only the wrong ones. This idea is taken - * from 'ar' written by Haruhiko Okumura.) - */ - for (bits = max_length; bits !== 0; bits--) { - n = s.bl_count[bits]; - while (n !== 0) { - m = s.heap[--h]; - if (m > max_code) { continue; } - if (tree[m * 2 + 1]/*.Len*/ !== bits) { - // Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); - s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/; - tree[m * 2 + 1]/*.Len*/ = bits; - } - n--; - } - } -} - - -/* =========================================================================== - * Generate the codes for a given tree and bit counts (which need not be - * optimal). - * IN assertion: the array bl_count contains the bit length statistics for - * the given tree and the field len is set for all tree elements. - * OUT assertion: the field code is set for all tree elements of non - * zero code length. - */ -function gen_codes(tree, max_code, bl_count) -// ct_data *tree; /* the tree to decorate */ -// int max_code; /* largest code with non zero frequency */ -// ushf *bl_count; /* number of codes at each bit length */ -{ - var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */ - var code = 0; /* running code value */ - var bits; /* bit index */ - var n; /* code index */ - - /* The distribution counts are first used to generate the code values - * without bit reversal. - */ - for (bits = 1; bits <= MAX_BITS; bits++) { - next_code[bits] = code = (code + bl_count[bits - 1]) << 1; - } - /* Check that the bit counts in bl_count are consistent. The last code - * must be all ones. - */ - //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */ - length = 0; - for (code = 0; code < LENGTH_CODES - 1; code++) { - base_length[code] = length; - for (n = 0; n < (1 << extra_lbits[code]); n++) { - _length_code[length++] = code; - } - } - //Assert (length == 256, "tr_static_init: length != 256"); - /* Note that the length 255 (match length 258) can be represented - * in two different ways: code 284 + 5 bits or code 285, so we - * overwrite length_code[255] to use the best encoding: - */ - _length_code[length - 1] = code; - - /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ - dist = 0; - for (code = 0; code < 16; code++) { - base_dist[code] = dist; - for (n = 0; n < (1 << extra_dbits[code]); n++) { - _dist_code[dist++] = code; - } - } - //Assert (dist == 256, "tr_static_init: dist != 256"); - dist >>= 7; /* from now on, all distances are divided by 128 */ - for (; code < D_CODES; code++) { - base_dist[code] = dist << 7; - for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) { - _dist_code[256 + dist++] = code; - } - } - //Assert (dist == 256, "tr_static_init: 256+dist != 512"); - - /* Construct the codes of the static literal tree */ - for (bits = 0; bits <= MAX_BITS; bits++) { - bl_count[bits] = 0; - } - - n = 0; - while (n <= 143) { - static_ltree[n * 2 + 1]/*.Len*/ = 8; - n++; - bl_count[8]++; - } - while (n <= 255) { - static_ltree[n * 2 + 1]/*.Len*/ = 9; - n++; - bl_count[9]++; - } - while (n <= 279) { - static_ltree[n * 2 + 1]/*.Len*/ = 7; - n++; - bl_count[7]++; - } - while (n <= 287) { - static_ltree[n * 2 + 1]/*.Len*/ = 8; - n++; - bl_count[8]++; - } - /* Codes 286 and 287 do not exist, but we must include them in the - * tree construction to get a canonical Huffman tree (longest code - * all ones) - */ - gen_codes(static_ltree, L_CODES + 1, bl_count); - - /* The static distance tree is trivial: */ - for (n = 0; n < D_CODES; n++) { - static_dtree[n * 2 + 1]/*.Len*/ = 5; - static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5); - } - - // Now data ready and we can init static trees - static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS); - static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS); - static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS); - - //static_init_done = true; -} - - -/* =========================================================================== - * Initialize a new block. - */ -function init_block(s) { - var n; /* iterates over tree elements */ - - /* Initialize the trees. */ - for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; } - for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; } - for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; } - - s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1; - s.opt_len = s.static_len = 0; - s.last_lit = s.matches = 0; -} - - -/* =========================================================================== - * Flush the bit buffer and align the output on a byte boundary - */ -function bi_windup(s) -{ - if (s.bi_valid > 8) { - put_short(s, s.bi_buf); - } else if (s.bi_valid > 0) { - //put_byte(s, (Byte)s->bi_buf); - s.pending_buf[s.pending++] = s.bi_buf; - } - s.bi_buf = 0; - s.bi_valid = 0; -} - -/* =========================================================================== - * Copy a stored block, storing first the length and its - * one's complement if requested. - */ -function copy_block(s, buf, len, header) -//DeflateState *s; -//charf *buf; /* the input data */ -//unsigned len; /* its length */ -//int header; /* true if block header must be written */ -{ - bi_windup(s); /* align on byte boundary */ - - if (header) { - put_short(s, len); - put_short(s, ~len); - } -// while (len--) { -// put_byte(s, *buf++); -// } - utils.arraySet(s.pending_buf, s.window, buf, len, s.pending); - s.pending += len; -} - -/* =========================================================================== - * Compares to subtrees, using the tree depth as tie breaker when - * the subtrees have equal frequency. This minimizes the worst case length. - */ -function smaller(tree, n, m, depth) { - var _n2 = n * 2; - var _m2 = m * 2; - return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ || - (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m])); -} - -/* =========================================================================== - * Restore the heap property by moving down the tree starting at node k, - * exchanging a node with the smallest of its two sons if necessary, stopping - * when the heap property is re-established (each father smaller than its - * two sons). - */ -function pqdownheap(s, tree, k) -// deflate_state *s; -// ct_data *tree; /* the tree to restore */ -// int k; /* node to move down */ -{ - var v = s.heap[k]; - var j = k << 1; /* left son of k */ - while (j <= s.heap_len) { - /* Set j to the smallest of the two sons: */ - if (j < s.heap_len && - smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) { - j++; - } - /* Exit if v is smaller than both sons */ - if (smaller(tree, v, s.heap[j], s.depth)) { break; } - - /* Exchange v with the smallest son */ - s.heap[k] = s.heap[j]; - k = j; - - /* And continue down the tree, setting j to the left son of k */ - j <<= 1; - } - s.heap[k] = v; -} - - -// inlined manually -// var SMALLEST = 1; - -/* =========================================================================== - * Send the block data compressed using the given Huffman trees - */ -function compress_block(s, ltree, dtree) -// deflate_state *s; -// const ct_data *ltree; /* literal tree */ -// const ct_data *dtree; /* distance tree */ -{ - var dist; /* distance of matched string */ - var lc; /* match length or unmatched char (if dist == 0) */ - var lx = 0; /* running index in l_buf */ - var code; /* the code to send */ - var extra; /* number of extra bits to send */ - - if (s.last_lit !== 0) { - do { - dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]); - lc = s.pending_buf[s.l_buf + lx]; - lx++; - - if (dist === 0) { - send_code(s, lc, ltree); /* send a literal byte */ - //Tracecv(isgraph(lc), (stderr," '%c' ", lc)); - } else { - /* Here, lc is the match length - MIN_MATCH */ - code = _length_code[lc]; - send_code(s, code + LITERALS + 1, ltree); /* send the length code */ - extra = extra_lbits[code]; - if (extra !== 0) { - lc -= base_length[code]; - send_bits(s, lc, extra); /* send the extra length bits */ - } - dist--; /* dist is now the match distance - 1 */ - code = d_code(dist); - //Assert (code < D_CODES, "bad d_code"); - - send_code(s, code, dtree); /* send the distance code */ - extra = extra_dbits[code]; - if (extra !== 0) { - dist -= base_dist[code]; - send_bits(s, dist, extra); /* send the extra distance bits */ - } - } /* literal or match pair ? */ - - /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ - //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, - // "pendingBuf overflow"); - - } while (lx < s.last_lit); - } - - send_code(s, END_BLOCK, ltree); -} - - -/* =========================================================================== - * Construct one Huffman tree and assigns the code bit strings and lengths. - * Update the total bit length for the current block. - * IN assertion: the field freq is set for all tree elements. - * OUT assertions: the fields len and code are set to the optimal bit length - * and corresponding code. The length opt_len is updated; static_len is - * also updated if stree is not null. The field max_code is set. - */ -function build_tree(s, desc) -// deflate_state *s; -// tree_desc *desc; /* the tree descriptor */ -{ - var tree = desc.dyn_tree; - var stree = desc.stat_desc.static_tree; - var has_stree = desc.stat_desc.has_stree; - var elems = desc.stat_desc.elems; - var n, m; /* iterate over heap elements */ - var max_code = -1; /* largest code with non zero frequency */ - var node; /* new node being created */ - - /* Construct the initial heap, with least frequent element in - * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. - * heap[0] is not used. - */ - s.heap_len = 0; - s.heap_max = HEAP_SIZE; - - for (n = 0; n < elems; n++) { - if (tree[n * 2]/*.Freq*/ !== 0) { - s.heap[++s.heap_len] = max_code = n; - s.depth[n] = 0; - - } else { - tree[n * 2 + 1]/*.Len*/ = 0; - } - } - - /* The pkzip format requires that at least one distance code exists, - * and that at least one bit should be sent even if there is only one - * possible code. So to avoid special checks later on we force at least - * two codes of non zero frequency. - */ - while (s.heap_len < 2) { - node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0); - tree[node * 2]/*.Freq*/ = 1; - s.depth[node] = 0; - s.opt_len--; - - if (has_stree) { - s.static_len -= stree[node * 2 + 1]/*.Len*/; - } - /* node is 0 or 1 so it does not have extra bits */ - } - desc.max_code = max_code; - - /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, - * establish sub-heaps of increasing lengths: - */ - for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); } - - /* Construct the Huffman tree by repeatedly combining the least two - * frequent nodes. - */ - node = elems; /* next internal node of the tree */ - do { - //pqremove(s, tree, n); /* n = node of least frequency */ - /*** pqremove ***/ - n = s.heap[1/*SMALLEST*/]; - s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--]; - pqdownheap(s, tree, 1/*SMALLEST*/); - /***/ - - m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */ - - s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */ - s.heap[--s.heap_max] = m; - - /* Create a new node father of n and m */ - tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/; - s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1; - tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node; - - /* and insert the new node in the heap */ - s.heap[1/*SMALLEST*/] = node++; - pqdownheap(s, tree, 1/*SMALLEST*/); - - } while (s.heap_len >= 2); - - s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/]; - - /* At this point, the fields freq and dad are set. We can now - * generate the bit lengths. - */ - gen_bitlen(s, desc); - - /* The field len is now set, we can generate the bit codes */ - gen_codes(tree, max_code, s.bl_count); -} - - -/* =========================================================================== - * Scan a literal or distance tree to determine the frequencies of the codes - * in the bit length tree. - */ -function scan_tree(s, tree, max_code) -// deflate_state *s; -// ct_data *tree; /* the tree to be scanned */ -// int max_code; /* and its largest code of non zero frequency */ -{ - var n; /* iterates over all tree elements */ - var prevlen = -1; /* last emitted length */ - var curlen; /* length of current code */ - - var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ - - var count = 0; /* repeat count of the current code */ - var max_count = 7; /* max repeat count */ - var min_count = 4; /* min repeat count */ - - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } - tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */ - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; - - if (++count < max_count && curlen === nextlen) { - continue; - - } else if (count < min_count) { - s.bl_tree[curlen * 2]/*.Freq*/ += count; - - } else if (curlen !== 0) { - - if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; } - s.bl_tree[REP_3_6 * 2]/*.Freq*/++; - - } else if (count <= 10) { - s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++; - - } else { - s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++; - } - - count = 0; - prevlen = curlen; - - if (nextlen === 0) { - max_count = 138; - min_count = 3; - - } else if (curlen === nextlen) { - max_count = 6; - min_count = 3; - - } else { - max_count = 7; - min_count = 4; - } - } -} - - -/* =========================================================================== - * Send a literal or distance tree in compressed form, using the codes in - * bl_tree. - */ -function send_tree(s, tree, max_code) -// deflate_state *s; -// ct_data *tree; /* the tree to be scanned */ -// int max_code; /* and its largest code of non zero frequency */ -{ - var n; /* iterates over all tree elements */ - var prevlen = -1; /* last emitted length */ - var curlen; /* length of current code */ - - var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ - - var count = 0; /* repeat count of the current code */ - var max_count = 7; /* max repeat count */ - var min_count = 4; /* min repeat count */ - - /* tree[max_code+1].Len = -1; */ /* guard already set */ - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; - - if (++count < max_count && curlen === nextlen) { - continue; - - } else if (count < min_count) { - do { send_code(s, curlen, s.bl_tree); } while (--count !== 0); - - } else if (curlen !== 0) { - if (curlen !== prevlen) { - send_code(s, curlen, s.bl_tree); - count--; - } - //Assert(count >= 3 && count <= 6, " 3_6?"); - send_code(s, REP_3_6, s.bl_tree); - send_bits(s, count - 3, 2); - - } else if (count <= 10) { - send_code(s, REPZ_3_10, s.bl_tree); - send_bits(s, count - 3, 3); - - } else { - send_code(s, REPZ_11_138, s.bl_tree); - send_bits(s, count - 11, 7); - } - - count = 0; - prevlen = curlen; - if (nextlen === 0) { - max_count = 138; - min_count = 3; - - } else if (curlen === nextlen) { - max_count = 6; - min_count = 3; - - } else { - max_count = 7; - min_count = 4; - } - } -} - - -/* =========================================================================== - * Construct the Huffman tree for the bit lengths and return the index in - * bl_order of the last bit length code to send. - */ -function build_bl_tree(s) { - var max_blindex; /* index of last bit length code of non zero freq */ - - /* Determine the bit length frequencies for literal and distance trees */ - scan_tree(s, s.dyn_ltree, s.l_desc.max_code); - scan_tree(s, s.dyn_dtree, s.d_desc.max_code); - - /* Build the bit length tree: */ - build_tree(s, s.bl_desc); - /* opt_len now includes the length of the tree representations, except - * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. - */ - - /* Determine the number of bit length codes to send. The pkzip format - * requires that at least 4 bit length codes be sent. (appnote.txt says - * 3 but the actual value used is 4.) - */ - for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) { - if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) { - break; - } - } - /* Update opt_len to include the bit length tree and counts */ - s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; - //Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", - // s->opt_len, s->static_len)); - - return max_blindex; -} - - -/* =========================================================================== - * Send the header for a block using dynamic Huffman trees: the counts, the - * lengths of the bit length codes, the literal tree and the distance tree. - * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. - */ -function send_all_trees(s, lcodes, dcodes, blcodes) -// deflate_state *s; -// int lcodes, dcodes, blcodes; /* number of codes for each tree */ -{ - var rank; /* index in bl_order */ - - //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); - //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, - // "too many codes"); - //Tracev((stderr, "\nbl counts: ")); - send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */ - send_bits(s, dcodes - 1, 5); - send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */ - for (rank = 0; rank < blcodes; rank++) { - //Tracev((stderr, "\nbl code %2d ", bl_order[rank])); - send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3); - } - //Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); - - send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */ - //Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); - - send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */ - //Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); -} - - -/* =========================================================================== - * Check if the data type is TEXT or BINARY, using the following algorithm: - * - TEXT if the two conditions below are satisfied: - * a) There are no non-portable control characters belonging to the - * "black list" (0..6, 14..25, 28..31). - * b) There is at least one printable character belonging to the - * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). - * - BINARY otherwise. - * - The following partially-portable control characters form a - * "gray list" that is ignored in this detection algorithm: - * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). - * IN assertion: the fields Freq of dyn_ltree are set. - */ -function detect_data_type(s) { - /* black_mask is the bit mask of black-listed bytes - * set bits 0..6, 14..25, and 28..31 - * 0xf3ffc07f = binary 11110011111111111100000001111111 - */ - var black_mask = 0xf3ffc07f; - var n; - - /* Check for non-textual ("black-listed") bytes. */ - for (n = 0; n <= 31; n++, black_mask >>>= 1) { - if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) { - return Z_BINARY; - } - } - - /* Check for textual ("white-listed") bytes. */ - if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 || - s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) { - return Z_TEXT; - } - for (n = 32; n < LITERALS; n++) { - if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) { - return Z_TEXT; - } - } - - /* There are no "black-listed" or "white-listed" bytes: - * this stream either is empty or has tolerated ("gray-listed") bytes only. - */ - return Z_BINARY; -} - - -var static_init_done = false; - -/* =========================================================================== - * Initialize the tree data structures for a new zlib stream. - */ -function _tr_init(s) -{ - - if (!static_init_done) { - tr_static_init(); - static_init_done = true; - } - - s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); - s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); - s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); - - s.bi_buf = 0; - s.bi_valid = 0; - - /* Initialize the first block of the first file: */ - init_block(s); -} - - -/* =========================================================================== - * Send a stored block - */ -function _tr_stored_block(s, buf, stored_len, last) -//DeflateState *s; -//charf *buf; /* input block */ -//ulg stored_len; /* length of input block */ -//int last; /* one if this is the last block for a file */ -{ - send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */ - copy_block(s, buf, stored_len, true); /* with header */ -} - - -/* =========================================================================== - * Send one empty static block to give enough lookahead for inflate. - * This takes 10 bits, of which 7 may remain in the bit buffer. - */ -function _tr_align(s) { - send_bits(s, STATIC_TREES << 1, 3); - send_code(s, END_BLOCK, static_ltree); - bi_flush(s); -} - - -/* =========================================================================== - * Determine the best encoding for the current block: dynamic trees, static - * trees or store, and output the encoded block to the zip file. - */ -function _tr_flush_block(s, buf, stored_len, last) -//DeflateState *s; -//charf *buf; /* input block, or NULL if too old */ -//ulg stored_len; /* length of input block */ -//int last; /* one if this is the last block for a file */ -{ - var opt_lenb, static_lenb; /* opt_len and static_len in bytes */ - var max_blindex = 0; /* index of last bit length code of non zero freq */ - - /* Build the Huffman trees unless a stored block is forced */ - if (s.level > 0) { - - /* Check if the file is binary or text */ - if (s.strm.data_type === Z_UNKNOWN) { - s.strm.data_type = detect_data_type(s); - } - - /* Construct the literal and distance trees */ - build_tree(s, s.l_desc); - // Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, - // s->static_len)); - - build_tree(s, s.d_desc); - // Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, - // s->static_len)); - /* At this point, opt_len and static_len are the total bit lengths of - * the compressed block data, excluding the tree representations. - */ - - /* Build the bit length tree for the above two trees, and get the index - * in bl_order of the last bit length code to send. - */ - max_blindex = build_bl_tree(s); - - /* Determine the best encoding. Compute the block lengths in bytes. */ - opt_lenb = (s.opt_len + 3 + 7) >>> 3; - static_lenb = (s.static_len + 3 + 7) >>> 3; - - // Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", - // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, - // s->last_lit)); - - if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; } - - } else { - // Assert(buf != (char*)0, "lost buf"); - opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ - } - - if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) { - /* 4: two words for the lengths */ - - /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. - * Otherwise we can't have processed more than WSIZE input bytes since - * the last block flush, because compression would have been - * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to - * transform a block into a stored block. - */ - _tr_stored_block(s, buf, stored_len, last); - - } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) { - - send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3); - compress_block(s, static_ltree, static_dtree); - - } else { - send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3); - send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1); - compress_block(s, s.dyn_ltree, s.dyn_dtree); - } - // Assert (s->compressed_len == s->bits_sent, "bad compressed size"); - /* The above check is made mod 2^32, for files larger than 512 MB - * and uLong implemented on 32 bits. - */ - init_block(s); - - if (last) { - bi_windup(s); - } - // Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, - // s->compressed_len-7*last)); -} - -/* =========================================================================== - * Save the match info and tally the frequency counts. Return true if - * the current block must be flushed. - */ -function _tr_tally(s, dist, lc) -// deflate_state *s; -// unsigned dist; /* distance of matched string */ -// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ -{ - //var out_length, in_length, dcode; - - s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff; - s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff; - - s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff; - s.last_lit++; - - if (dist === 0) { - /* lc is the unmatched char */ - s.dyn_ltree[lc * 2]/*.Freq*/++; - } else { - s.matches++; - /* Here, lc is the match length - MIN_MATCH */ - dist--; /* dist = match distance - 1 */ - //Assert((ush)dist < (ush)MAX_DIST(s) && - // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && - // (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); - - s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++; - s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++; - } - -// (!) This block is disabled in zlib defaults, -// don't enable it for binary compatibility - -//#ifdef TRUNCATE_BLOCK -// /* Try to guess if it is profitable to stop the current block here */ -// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) { -// /* Compute an upper bound for the compressed length */ -// out_length = s.last_lit*8; -// in_length = s.strstart - s.block_start; -// -// for (dcode = 0; dcode < D_CODES; dcode++) { -// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]); -// } -// out_length >>>= 3; -// //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", -// // s->last_lit, in_length, out_length, -// // 100L - out_length*100L/in_length)); -// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) { -// return true; -// } -// } -//#endif - - return (s.last_lit === s.lit_bufsize - 1); - /* We avoid equality with lit_bufsize because of wraparound at 64K - * on 16 bit machines and because stored blocks are restricted to - * 64K-1 bytes. - */ -} - -exports._tr_init = _tr_init; -exports._tr_stored_block = _tr_stored_block; -exports._tr_flush_block = _tr_flush_block; -exports._tr_tally = _tr_tally; -exports._tr_align = _tr_align; - -},{"../utils/common":89}],101:[function(require,module,exports){ -arguments[4][46][0].apply(exports,arguments) -},{"dup":46}],102:[function(require,module,exports){ -module.exports = function parseBMFontAscii(data) { - if (!data) - throw new Error('no data provided') - data = data.toString().trim() - - var output = { - pages: [], - chars: [], - kernings: [] - } - - var lines = data.split(/\r\n?|\n/g) - - if (lines.length === 0) - throw new Error('no data in BMFont file') - - for (var i = 0; i < lines.length; i++) { - var lineData = splitLine(lines[i], i) - if (!lineData) //skip empty lines - continue - - if (lineData.key === 'page') { - if (typeof lineData.data.id !== 'number') - throw new Error('malformed file at line ' + i + ' -- needs page id=N') - if (typeof lineData.data.file !== 'string') - throw new Error('malformed file at line ' + i + ' -- needs page file="path"') - output.pages[lineData.data.id] = lineData.data.file - } else if (lineData.key === 'chars' || lineData.key === 'kernings') { - //... do nothing for these two ... - } else if (lineData.key === 'char') { - output.chars.push(lineData.data) - } else if (lineData.key === 'kerning') { - output.kernings.push(lineData.data) - } else { - output[lineData.key] = lineData.data - } - } - - return output -} - -function splitLine(line, idx) { - line = line.replace(/\t+/g, ' ').trim() - if (!line) - return null - - var space = line.indexOf(' ') - if (space === -1) - throw new Error("no named row at line " + idx) - - var key = line.substring(0, space) - - line = line.substring(space + 1) - //clear "letter" field as it is non-standard and - //requires additional complexity to parse " / = symbols - line = line.replace(/letter=[\'\"]\S+[\'\"]/gi, '') - line = line.split("=") - line = line.map(function(str) { - return str.trim().match((/(".*?"|[^"\s]+)+(?=\s*|\s*$)/g)) - }) - - var data = [] - for (var i = 0; i < line.length; i++) { - var dt = line[i] - if (i === 0) { - data.push({ - key: dt[0], - data: "" - }) - } else if (i === line.length - 1) { - data[data.length - 1].data = parseData(dt[0]) - } else { - data[data.length - 1].data = parseData(dt[0]) - data.push({ - key: dt[1], - data: "" - }) - } - } - - var out = { - key: key, - data: {} - } - - data.forEach(function(v) { - out.data[v.key] = v.data; - }) - - return out -} - -function parseData(data) { - if (!data || data.length === 0) - return "" - - if (data.indexOf('"') === 0 || data.indexOf("'") === 0) - return data.substring(1, data.length - 1) - if (data.indexOf(',') !== -1) - return parseIntList(data) - return parseInt(data, 10) -} - -function parseIntList(data) { - return data.split(',').map(function(val) { - return parseInt(val, 10) - }) -} -},{}],103:[function(require,module,exports){ -var HEADER = [66, 77, 70] - -module.exports = function readBMFontBinary(buf) { - if (buf.length < 6) - throw new Error('invalid buffer length for BMFont') - - var header = HEADER.every(function(byte, i) { - return buf.readUInt8(i) === byte - }) - - if (!header) - throw new Error('BMFont missing BMF byte header') - - var i = 3 - var vers = buf.readUInt8(i++) - if (vers > 3) - throw new Error('Only supports BMFont Binary v3 (BMFont App v1.10)') - - var target = { kernings: [], chars: [] } - for (var b=0; b<5; b++) - i += readBlock(target, buf, i) - return target -} - -function readBlock(target, buf, i) { - if (i > buf.length-1) - return 0 - - var blockID = buf.readUInt8(i++) - var blockSize = buf.readInt32LE(i) - i += 4 - - switch(blockID) { - case 1: - target.info = readInfo(buf, i) - break - case 2: - target.common = readCommon(buf, i) - break - case 3: - target.pages = readPages(buf, i, blockSize) - break - case 4: - target.chars = readChars(buf, i, blockSize) - break - case 5: - target.kernings = readKernings(buf, i, blockSize) - break - } - return 5 + blockSize -} - -function readInfo(buf, i) { - var info = {} - info.size = buf.readInt16LE(i) - - var bitField = buf.readUInt8(i+2) - info.smooth = (bitField >> 7) & 1 - info.unicode = (bitField >> 6) & 1 - info.italic = (bitField >> 5) & 1 - info.bold = (bitField >> 4) & 1 - - //fixedHeight is only mentioned in binary spec - if ((bitField >> 3) & 1) - info.fixedHeight = 1 - - info.charset = buf.readUInt8(i+3) || '' - info.stretchH = buf.readUInt16LE(i+4) - info.aa = buf.readUInt8(i+6) - info.padding = [ - buf.readInt8(i+7), - buf.readInt8(i+8), - buf.readInt8(i+9), - buf.readInt8(i+10) - ] - info.spacing = [ - buf.readInt8(i+11), - buf.readInt8(i+12) - ] - info.outline = buf.readUInt8(i+13) - info.face = readStringNT(buf, i+14) - return info -} - -function readCommon(buf, i) { - var common = {} - common.lineHeight = buf.readUInt16LE(i) - common.base = buf.readUInt16LE(i+2) - common.scaleW = buf.readUInt16LE(i+4) - common.scaleH = buf.readUInt16LE(i+6) - common.pages = buf.readUInt16LE(i+8) - var bitField = buf.readUInt8(i+10) - common.packed = 0 - common.alphaChnl = buf.readUInt8(i+11) - common.redChnl = buf.readUInt8(i+12) - common.greenChnl = buf.readUInt8(i+13) - common.blueChnl = buf.readUInt8(i+14) - return common -} - -function readPages(buf, i, size) { - var pages = [] - var text = readNameNT(buf, i) - var len = text.length+1 - var count = size / len - for (var c=0; c element') - var pages = pageRoot.getElementsByTagName('page') - for (var i=0; i 0 - var up = 0; - for (var i = parts.length - 1; i >= 0; i--) { - var last = parts[i]; - if (last === '.') { - parts.splice(i, 1); - } else if (last === '..') { - parts.splice(i, 1); - up++; - } else if (up) { - parts.splice(i, 1); - up--; - } - } - - // if the path is allowed to go above the root, restore leading ..s - if (allowAboveRoot) { - for (; up--; up) { - parts.unshift('..'); - } - } - - return parts; -} - -// path.resolve([from ...], to) -// posix version -exports.resolve = function() { - var resolvedPath = '', - resolvedAbsolute = false; - - for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { - var path = (i >= 0) ? arguments[i] : process.cwd(); - - // Skip empty and invalid entries - if (typeof path !== 'string') { - throw new TypeError('Arguments to path.resolve must be strings'); - } else if (!path) { - continue; - } - - resolvedPath = path + '/' + resolvedPath; - resolvedAbsolute = path.charAt(0) === '/'; - } - - // At this point the path should be resolved to a full absolute path, but - // handle relative paths to be safe (might happen when process.cwd() fails) - - // Normalize the path - resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { - return !!p; - }), !resolvedAbsolute).join('/'); - - return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; -}; - -// path.normalize(path) -// posix version -exports.normalize = function(path) { - var isAbsolute = exports.isAbsolute(path), - trailingSlash = substr(path, -1) === '/'; - - // Normalize the path - path = normalizeArray(filter(path.split('/'), function(p) { - return !!p; - }), !isAbsolute).join('/'); - - if (!path && !isAbsolute) { - path = '.'; - } - if (path && trailingSlash) { - path += '/'; - } - - return (isAbsolute ? '/' : '') + path; -}; - -// posix version -exports.isAbsolute = function(path) { - return path.charAt(0) === '/'; -}; - -// posix version -exports.join = function() { - var paths = Array.prototype.slice.call(arguments, 0); - return exports.normalize(filter(paths, function(p, index) { - if (typeof p !== 'string') { - throw new TypeError('Arguments to path.join must be strings'); - } - return p; - }).join('/')); -}; - - -// path.relative(from, to) -// posix version -exports.relative = function(from, to) { - from = exports.resolve(from).substr(1); - to = exports.resolve(to).substr(1); - - function trim(arr) { - var start = 0; - for (; start < arr.length; start++) { - if (arr[start] !== '') break; - } - - var end = arr.length - 1; - for (; end >= 0; end--) { - if (arr[end] !== '') break; - } - - if (start > end) return []; - return arr.slice(start, end - start + 1); - } - - var fromParts = trim(from.split('/')); - var toParts = trim(to.split('/')); - - var length = Math.min(fromParts.length, toParts.length); - var samePartsLength = length; - for (var i = 0; i < length; i++) { - if (fromParts[i] !== toParts[i]) { - samePartsLength = i; - break; - } - } - - var outputParts = []; - for (var i = samePartsLength; i < fromParts.length; i++) { - outputParts.push('..'); - } - - outputParts = outputParts.concat(toParts.slice(samePartsLength)); - - return outputParts.join('/'); -}; - -exports.sep = '/'; -exports.delimiter = ':'; - -exports.dirname = function (path) { - if (typeof path !== 'string') path = path + ''; - if (path.length === 0) return '.'; - var code = path.charCodeAt(0); - var hasRoot = code === 47 /*/*/; - var end = -1; - var matchedSlash = true; - for (var i = path.length - 1; i >= 1; --i) { - code = path.charCodeAt(i); - if (code === 47 /*/*/) { - if (!matchedSlash) { - end = i; - break; - } - } else { - // We saw the first non-path separator - matchedSlash = false; - } - } - - if (end === -1) return hasRoot ? '/' : '.'; - if (hasRoot && end === 1) { - // return '//'; - // Backwards-compat fix: - return '/'; - } - return path.slice(0, end); -}; - -function basename(path) { - if (typeof path !== 'string') path = path + ''; - - var start = 0; - var end = -1; - var matchedSlash = true; - var i; - - for (i = path.length - 1; i >= 0; --i) { - if (path.charCodeAt(i) === 47 /*/*/) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - start = i + 1; - break; - } - } else if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // path component - matchedSlash = false; - end = i + 1; - } - } - - if (end === -1) return ''; - return path.slice(start, end); -} - -// Uses a mixed approach for backwards-compatibility, as ext behavior changed -// in new Node.js versions, so only basename() above is backported here -exports.basename = function (path, ext) { - var f = basename(path); - if (ext && f.substr(-1 * ext.length) === ext) { - f = f.substr(0, f.length - ext.length); - } - return f; -}; - -exports.extname = function (path) { - if (typeof path !== 'string') path = path + ''; - var startDot = -1; - var startPart = 0; - var end = -1; - var matchedSlash = true; - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - var preDotState = 0; - for (var i = path.length - 1; i >= 0; --i) { - var code = path.charCodeAt(i); - if (code === 47 /*/*/) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === 46 /*.*/) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) - startDot = i; - else if (preDotState !== 1) - preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - - if (startDot === -1 || end === -1 || - // We saw a non-dot character immediately before the dot - preDotState === 0 || - // The (right-most) trimmed path component is exactly '..' - preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { - return ''; - } - return path.slice(startDot, end); -}; - -function filter (xs, f) { - if (xs.filter) return xs.filter(f); - var res = []; - for (var i = 0; i < xs.length; i++) { - if (f(xs[i], i, xs)) res.push(xs[i]); - } - return res; -} - -// String.prototype.substr - negative index don't work in IE8 -var substr = 'ab'.substr(-1) === 'b' - ? function (str, start, len) { return str.substr(start, len) } - : function (str, start, len) { - if (start < 0) start = str.length + start; - return str.substr(start, len); - } -; - -}).call(this,require('_process')) -},{"_process":133}],108:[function(require,module,exports){ -(function (Buffer){ -'use strict';var _typeof=typeof Symbol==='function'&&typeof Symbol.iterator==='symbol'?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==='function'&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj};var http=require('http');var https=require('https');var url=require('url');var qs=require('querystring');var zlib=require('zlib');var util=require('util');var phin=function phin(opts,cb){if(typeof opts!=='string'){if(!opts.hasOwnProperty('url')){throw new Error('Missing url option from options for request method.')}}var addr=(typeof opts==='undefined'?'undefined':_typeof(opts))==='object'?url.parse(opts.url):url.parse(opts);var options={'hostname':addr.hostname,'port':addr.port||(addr.protocol.toLowerCase()==='http:'?80:443),'path':addr.path,'method':'GET','headers':{},'auth':addr.auth||null,'parse':'none','stream':false};if((typeof opts==='undefined'?'undefined':_typeof(opts))==='object'){options=Object.assign(options,opts)}options.port=Number(options.port);if(options.hasOwnProperty('timeout'))delete options.timeout;if(options.compressed===true){options.headers['accept-encoding']='gzip, deflate'}if(opts.hasOwnProperty('form')){if(_typeof(opts.form)!=='object'){throw new Error('phin \'form\' option must be of type Object if present.')}var formDataString=qs.stringify(opts.form);options.headers['Content-Type']='application/x-www-form-urlencoded';options.headers['Content-Length']=Buffer.byteLength(formDataString);opts.data=formDataString}var req=void 0;var resHandler=function resHandler(res){var stream=res;if(options.compressed===true){if(res.headers['content-encoding']==='gzip'){stream=res.pipe(zlib.createGunzip())}else if(res.headers['content-encoding']==='deflate'){stream=res.pipe(zlib.createInflate())}}if(options.stream===true){res.stream=stream;cb(null,res)}else{res.body=new Buffer([]);stream.on('data',function(chunk){res.body=Buffer.concat([res.body,chunk])});stream.on('end',function(){if(cb){if(options.parse==='json'){try{res.body=JSON.parse(res.body.toString())}catch(err){cb('Invalid JSON received.',res);return}}cb(null,res)}})}};switch(addr.protocol.toLowerCase()){case'http:':req=http.request(options,resHandler);break;case'https:':req=https.request(options,resHandler);break;default:if(cb){cb(new Error('Invalid / unknown URL protocol. Expected HTTP or HTTPS.'),null)}return;}if(typeof opts.timeout==='number'){req.setTimeout(opts.timeout,function(){req.abort();cb(new Error('Timeout has been reached.'),null);cb=null})}req.on('error',function(err){if(cb){cb(err,null)}});if(opts.hasOwnProperty('data')){var postData=opts.data;if(!(opts.data instanceof Buffer)&&_typeof(opts.data)==='object'){var contentType=options.headers['content-type']||options.headers['Content-Type'];if(contentType==='application/x-www-form-urlencoded'){postData=qs.stringify(opts.data)}else{try{postData=JSON.stringify(opts.data)}catch(err){cb(new Error('Couldn\'t stringify object. (Likely due to a circular reference.)'),null)}}}req.write(postData)}req.end()};phin.promisified=function(opts,http){return new Promise(function(resolve,reject){phin(opts,function(err,res){if(err){reject(err)}else{resolve(res)}},http)})};if(util.promisify){phin[util.promisify.custom]=phin.promisified}module.exports=phin; - -}).call(this,require("buffer").Buffer) -},{"buffer":48,"http":156,"https":72,"querystring":137,"url":180,"util":186,"zlib":35}],109:[function(require,module,exports){ -'use strict'; - -module.exports = pixelmatch; - -function pixelmatch(img1, img2, output, width, height, options) { - - if (!options) options = {}; - - var threshold = options.threshold === undefined ? 0.1 : options.threshold; - - // maximum acceptable square distance between two colors; - // 35215 is the maximum possible value for the YIQ difference metric - var maxDelta = 35215 * threshold * threshold, - diff = 0; - - // compare each pixel of one image against the other one - for (var y = 0; y < height; y++) { - for (var x = 0; x < width; x++) { - - var pos = (y * width + x) * 4; - - // squared YUV distance between colors at this pixel position - var delta = colorDelta(img1, img2, pos, pos); - - // the color difference is above the threshold - if (delta > maxDelta) { - // check it's a real rendering difference or just anti-aliasing - if (!options.includeAA && (antialiased(img1, x, y, width, height, img2) || - antialiased(img2, x, y, width, height, img1))) { - // one of the pixels is anti-aliasing; draw as yellow and do not count as difference - if (output) drawPixel(output, pos, 255, 255, 0); - - } else { - // found substantial difference not caused by anti-aliasing; draw it as red - if (output) drawPixel(output, pos, 255, 0, 0); - diff++; - } - - } else if (output) { - // pixels are similar; draw background as grayscale image blended with white - var val = blend(grayPixel(img1, pos), 0.1); - drawPixel(output, pos, val, val, val); - } - } - } - - // return the number of different pixels - return diff; -} - -// check if a pixel is likely a part of anti-aliasing; -// based on "Anti-aliased Pixel and Intensity Slope Detector" paper by V. Vysniauskas, 2009 - -function antialiased(img, x1, y1, width, height, img2) { - var x0 = Math.max(x1 - 1, 0), - y0 = Math.max(y1 - 1, 0), - x2 = Math.min(x1 + 1, width - 1), - y2 = Math.min(y1 + 1, height - 1), - pos = (y1 * width + x1) * 4, - zeroes = 0, - positives = 0, - negatives = 0, - min = 0, - max = 0, - minX, minY, maxX, maxY; - - // go through 8 adjacent pixels - for (var x = x0; x <= x2; x++) { - for (var y = y0; y <= y2; y++) { - if (x === x1 && y === y1) continue; - - // brightness delta between the center pixel and adjacent one - var delta = colorDelta(img, img, pos, (y * width + x) * 4, true); - - // count the number of equal, darker and brighter adjacent pixels - if (delta === 0) zeroes++; - else if (delta < 0) negatives++; - else if (delta > 0) positives++; - - // if found more than 2 equal siblings, it's definitely not anti-aliasing - if (zeroes > 2) return false; - - if (!img2) continue; - - // remember the darkest pixel - if (delta < min) { - min = delta; - minX = x; - minY = y; - } - // remember the brightest pixel - if (delta > max) { - max = delta; - maxX = x; - maxY = y; - } - } - } - - if (!img2) return true; - - // if there are no both darker and brighter pixels among siblings, it's not anti-aliasing - if (negatives === 0 || positives === 0) return false; - - // if either the darkest or the brightest pixel has more than 2 equal siblings in both images - // (definitely not anti-aliased), this pixel is anti-aliased - return (!antialiased(img, minX, minY, width, height) && !antialiased(img2, minX, minY, width, height)) || - (!antialiased(img, maxX, maxY, width, height) && !antialiased(img2, maxX, maxY, width, height)); -} - -// calculate color difference according to the paper "Measuring perceived color difference -// using YIQ NTSC transmission color space in mobile applications" by Y. Kotsarenko and F. Ramos - -function colorDelta(img1, img2, k, m, yOnly) { - var a1 = img1[k + 3] / 255, - a2 = img2[m + 3] / 255, - - r1 = blend(img1[k + 0], a1), - g1 = blend(img1[k + 1], a1), - b1 = blend(img1[k + 2], a1), - - r2 = blend(img2[m + 0], a2), - g2 = blend(img2[m + 1], a2), - b2 = blend(img2[m + 2], a2), - - y = rgb2y(r1, g1, b1) - rgb2y(r2, g2, b2); - - if (yOnly) return y; // brightness difference only - - var i = rgb2i(r1, g1, b1) - rgb2i(r2, g2, b2), - q = rgb2q(r1, g1, b1) - rgb2q(r2, g2, b2); - - return 0.5053 * y * y + 0.299 * i * i + 0.1957 * q * q; -} - -function rgb2y(r, g, b) { return r * 0.29889531 + g * 0.58662247 + b * 0.11448223; } -function rgb2i(r, g, b) { return r * 0.59597799 - g * 0.27417610 - b * 0.32180189; } -function rgb2q(r, g, b) { return r * 0.21147017 - g * 0.52261711 + b * 0.31114694; } - -// blend semi-transparent color with white -function blend(c, a) { - return 255 + (c - 255) * a; -} - -function drawPixel(output, pos, r, g, b) { - output[pos + 0] = r; - output[pos + 1] = g; - output[pos + 2] = b; - output[pos + 3] = 255; -} - -function grayPixel(img, i) { - var a = img[i + 3] / 255, - r = blend(img[i + 0], a), - g = blend(img[i + 1], a), - b = blend(img[i + 2], a); - return rgb2y(r, g, b); -} - -},{}],110:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var interlaceUtils = require('./interlace'); - -var pixelBppMap = { - 1: { // L - 0: 0, - 1: 0, - 2: 0, - 3: 0xff - }, - 2: { // LA - 0: 0, - 1: 0, - 2: 0, - 3: 1 - }, - 3: { // RGB - 0: 0, - 1: 1, - 2: 2, - 3: 0xff - }, - 4: { // RGBA - 0: 0, - 1: 1, - 2: 2, - 3: 3 - } -}; - -function bitRetriever(data, depth) { - - var leftOver = []; - var i = 0; - - function split() { - if (i === data.length) { - throw new Error('Ran out of data'); - } - var byte = data[i]; - i++; - var byte8, byte7, byte6, byte5, byte4, byte3, byte2, byte1; - switch (depth) { - default: - throw new Error('unrecognised depth'); - case 16: - byte2 = data[i]; - i++; - leftOver.push(((byte << 8) + byte2)); - break; - case 4: - byte2 = byte & 0x0f; - byte1 = byte >> 4; - leftOver.push(byte1, byte2); - break; - case 2: - byte4 = byte & 3; - byte3 = byte >> 2 & 3; - byte2 = byte >> 4 & 3; - byte1 = byte >> 6 & 3; - leftOver.push(byte1, byte2, byte3, byte4); - break; - case 1: - byte8 = byte & 1; - byte7 = byte >> 1 & 1; - byte6 = byte >> 2 & 1; - byte5 = byte >> 3 & 1; - byte4 = byte >> 4 & 1; - byte3 = byte >> 5 & 1; - byte2 = byte >> 6 & 1; - byte1 = byte >> 7 & 1; - leftOver.push(byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8); - break; - } - } - - return { - get: function(count) { - while (leftOver.length < count) { - split(); - } - var returner = leftOver.slice(0, count); - leftOver = leftOver.slice(count); - return returner; - }, - resetAfterLine: function() { - leftOver.length = 0; - }, - end: function() { - if (i !== data.length) { - throw new Error('extra data found'); - } - } - }; -} - -function mapImage8Bit(image, pxData, getPxPos, bpp, data, rawPos) { // eslint-disable-line max-params - var imageWidth = image.width; - var imageHeight = image.height; - var imagePass = image.index; - for (var y = 0; y < imageHeight; y++) { - for (var x = 0; x < imageWidth; x++) { - var pxPos = getPxPos(x, y, imagePass); - - for (var i = 0; i < 4; i++) { - var idx = pixelBppMap[bpp][i]; - if (idx === 0xff) { - pxData[pxPos + i] = 0xff; - } else { - var dataPos = idx + rawPos; - if (dataPos === data.length) { - throw new Error('Ran out of data'); - } - pxData[pxPos + i] = data[dataPos]; - } - } - rawPos += bpp; //eslint-disable-line no-param-reassign - } - } - return rawPos; -} - -function mapImageCustomBit(image, pxData, getPxPos, bpp, bits, maxBit) { // eslint-disable-line max-params - var imageWidth = image.width; - var imageHeight = image.height; - var imagePass = image.index; - for (var y = 0; y < imageHeight; y++) { - for (var x = 0; x < imageWidth; x++) { - var pixelData = bits.get(bpp); - var pxPos = getPxPos(x, y, imagePass); - - for (var i = 0; i < 4; i++) { - var idx = pixelBppMap[bpp][i]; - pxData[pxPos + i] = idx !== 0xff ? pixelData[idx] : maxBit; - } - } - bits.resetAfterLine(); - } -} - -exports.dataToBitMap = function(data, bitmapInfo) { - - var width = bitmapInfo.width; - var height = bitmapInfo.height; - var depth = bitmapInfo.depth; - var bpp = bitmapInfo.bpp; - var interlace = bitmapInfo.interlace; - - if (depth !== 8) { - var bits = bitRetriever(data, depth); - } - var pxData; - if (depth <= 8) { - pxData = new Buffer(width * height * 4); - } - else { - pxData = new Uint16Array(width * height * 4); - } - var maxBit = Math.pow(2, depth) - 1; - var rawPos = 0; - var images; - var getPxPos; - - if (interlace) { - images = interlaceUtils.getImagePasses(width, height); - getPxPos = interlaceUtils.getInterlaceIterator(width, height); - } - else { - var nonInterlacedPxPos = 0; - getPxPos = function() { - var returner = nonInterlacedPxPos; - nonInterlacedPxPos += 4; - return returner; - }; - images = [{ width: width, height: height }]; - } - - for (var imageIndex = 0; imageIndex < images.length; imageIndex++) { - if (depth === 8) { - rawPos = mapImage8Bit(images[imageIndex], pxData, getPxPos, bpp, data, rawPos); - } - else { - mapImageCustomBit(images[imageIndex], pxData, getPxPos, bpp, bits, maxBit); - } - } - if (depth === 8) { - if (rawPos !== data.length) { - throw new Error('extra data found'); - } - } - else { - bits.end(); - } - - return pxData; -}; - -}).call(this,require("buffer").Buffer) -},{"./interlace":120,"buffer":48}],111:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var constants = require('./constants'); - -module.exports = function(dataIn, width, height, options) { - var outHasAlpha = [constants.COLORTYPE_COLOR_ALPHA, constants.COLORTYPE_ALPHA].indexOf(options.colorType) !== -1; - if (options.colorType === options.inputColorType) { - var bigEndian = (function() { - var buffer = new ArrayBuffer(2); - new DataView(buffer).setInt16(0, 256, true /* littleEndian */); - // Int16Array uses the platform's endianness. - return new Int16Array(buffer)[0] !== 256; - })(); - // If no need to convert to grayscale and alpha is present/absent in both, take a fast route - if (options.bitDepth === 8 || (options.bitDepth === 16 && bigEndian)){ - return dataIn; - } - } - - // map to a UInt16 array if data is 16bit, fix endianness below - var data = options.bitDepth !== 16 ? dataIn : new Uint16Array(dataIn.buffer); - - var maxValue = 255; - var inBpp = constants.COLORTYPE_TO_BPP_MAP[options.inputColorType]; - if (inBpp == 4 && !options.inputHasAlpha) inBpp = 3; - var outBpp = constants.COLORTYPE_TO_BPP_MAP[options.colorType]; - if (options.bitDepth === 16) { - maxValue = 65535; - outBpp *= 2; - } - var outData = new Buffer(width * height * outBpp); - - var inIndex = 0; - var outIndex = 0; - - var bgColor = options.bgColor || {}; - if (bgColor.red === undefined) { - bgColor.red = maxValue; - } - if (bgColor.green === undefined) { - bgColor.green = maxValue; - } - if (bgColor.blue === undefined) { - bgColor.blue = maxValue; - } - - function getRGBA(data, inIndex) { - var red, green, blue, alpha = maxValue; - switch (options.inputColorType) { - case constants.COLORTYPE_COLOR_ALPHA: - alpha = data[inIndex + 3]; - red = data[inIndex]; - green = data[inIndex+1]; - blue = data[inIndex+2]; - break; - case constants.COLORTYPE_COLOR: - red = data[inIndex]; - green = data[inIndex+1]; - blue = data[inIndex+2]; - break; - case constants.COLORTYPE_ALPHA: - alpha = data[inIndex + 1]; - red = data[inIndex]; - green = red; - blue = red; - break; - case constants.COLORTYPE_GRAYSCALE: - red = data[inIndex]; - green = red; - blue = red; - break; - default: - throw new Error('input color type:' + options.inputColorType + ' is not supported at present'); - } - - if (options.inputHasAlpha) { - if (!outHasAlpha) { - alpha /= maxValue; - red = Math.min(Math.max(Math.round((1 - alpha) * bgColor.red + alpha * red), 0), maxValue); - green = Math.min(Math.max(Math.round((1 - alpha) * bgColor.green + alpha * green), 0), maxValue); - blue = Math.min(Math.max(Math.round((1 - alpha) * bgColor.blue + alpha * blue), 0), maxValue); - } - } - return {red: red, green: green, blue: blue, alpha: alpha}; - } - - for (var y = 0; y < height; y++) { - for (var x = 0; x < width; x++) { - var rgba = getRGBA(data, inIndex); - - switch (options.colorType) { - case constants.COLORTYPE_COLOR_ALPHA: - case constants.COLORTYPE_COLOR: - if (options.bitDepth === 8) { - outData[outIndex] = rgba.red; - outData[outIndex + 1] = rgba.green; - outData[outIndex + 2] = rgba.blue; - if (outHasAlpha) { - outData[outIndex + 3] = rgba.alpha; - } - } else { - outData.writeUInt16BE(rgba.red, outIndex); - outData.writeUInt16BE(rgba.green, outIndex + 2); - outData.writeUInt16BE(rgba.blue, outIndex + 4); - if (outHasAlpha) { - outData.writeUInt16BE(rgba.alpha, outIndex + 6); - } - } - break; - case constants.COLORTYPE_ALPHA: - case constants.COLORTYPE_GRAYSCALE: - // Convert to grayscale and alpha - var grayscale = (rgba.red + rgba.green + rgba.blue) / 3; - if (options.bitDepth === 8) { - outData[outIndex] = grayscale; - if (outHasAlpha) { - outData[outIndex + 1] = rgba.alpha; - } - } else { - outData.writeUInt16BE(grayscale, outIndex); - if (outHasAlpha) { - outData.writeUInt16BE(rgba.alpha, outIndex + 2); - } - } - break; - } - - inIndex += inBpp; - outIndex += outBpp; - } - } - - return outData; -}; - -}).call(this,require("buffer").Buffer) -},{"./constants":113,"buffer":48}],112:[function(require,module,exports){ -(function (process,Buffer){ -'use strict'; - - -var util = require('util'); -var Stream = require('stream'); - - -var ChunkStream = module.exports = function() { - Stream.call(this); - - this._buffers = []; - this._buffered = 0; - - this._reads = []; - this._paused = false; - - this._encoding = 'utf8'; - this.writable = true; -}; -util.inherits(ChunkStream, Stream); - - -ChunkStream.prototype.read = function(length, callback) { - - this._reads.push({ - length: Math.abs(length), // if length < 0 then at most this length - allowLess: length < 0, - func: callback - }); - - process.nextTick(function() { - this._process(); - - // its paused and there is not enought data then ask for more - if (this._paused && this._reads.length > 0) { - this._paused = false; - - this.emit('drain'); - } - }.bind(this)); -}; - -ChunkStream.prototype.write = function(data, encoding) { - - if (!this.writable) { - this.emit('error', new Error('Stream not writable')); - return false; - } - - var dataBuffer; - if (Buffer.isBuffer(data)) { - dataBuffer = data; - } - else { - dataBuffer = new Buffer(data, encoding || this._encoding); - } - - this._buffers.push(dataBuffer); - this._buffered += dataBuffer.length; - - this._process(); - - // ok if there are no more read requests - if (this._reads && this._reads.length === 0) { - this._paused = true; - } - - return this.writable && !this._paused; -}; - -ChunkStream.prototype.end = function(data, encoding) { - - if (data) { - this.write(data, encoding); - } - - this.writable = false; - - // already destroyed - if (!this._buffers) { - return; - } - - // enqueue or handle end - if (this._buffers.length === 0) { - this._end(); - } - else { - this._buffers.push(null); - this._process(); - } -}; - -ChunkStream.prototype.destroySoon = ChunkStream.prototype.end; - -ChunkStream.prototype._end = function() { - - if (this._reads.length > 0) { - this.emit('error', - new Error('There are some read requests waiting on finished stream') - ); - } - - this.destroy(); -}; - -ChunkStream.prototype.destroy = function() { - - if (!this._buffers) { - return; - } - - this.writable = false; - this._reads = null; - this._buffers = null; - - this.emit('close'); -}; - -ChunkStream.prototype._processReadAllowingLess = function(read) { - // ok there is any data so that we can satisfy this request - this._reads.shift(); // == read - - // first we need to peek into first buffer - var smallerBuf = this._buffers[0]; - - // ok there is more data than we need - if (smallerBuf.length > read.length) { - - this._buffered -= read.length; - this._buffers[0] = smallerBuf.slice(read.length); - - read.func.call(this, smallerBuf.slice(0, read.length)); - - } - else { - // ok this is less than maximum length so use it all - this._buffered -= smallerBuf.length; - this._buffers.shift(); // == smallerBuf - - read.func.call(this, smallerBuf); - } -}; - -ChunkStream.prototype._processRead = function(read) { - this._reads.shift(); // == read - - var pos = 0; - var count = 0; - var data = new Buffer(read.length); - - // create buffer for all data - while (pos < read.length) { - - var buf = this._buffers[count++]; - var len = Math.min(buf.length, read.length - pos); - - buf.copy(data, pos, 0, len); - pos += len; - - // last buffer wasn't used all so just slice it and leave - if (len !== buf.length) { - this._buffers[--count] = buf.slice(len); - } - } - - // remove all used buffers - if (count > 0) { - this._buffers.splice(0, count); - } - - this._buffered -= read.length; - - read.func.call(this, data); -}; - -ChunkStream.prototype._process = function() { - - try { - // as long as there is any data and read requests - while (this._buffered > 0 && this._reads && this._reads.length > 0) { - - var read = this._reads[0]; - - // read any data (but no more than length) - if (read.allowLess) { - this._processReadAllowingLess(read); - - } - else if (this._buffered >= read.length) { - // ok we can meet some expectations - - this._processRead(read); - } - else { - // not enought data to satisfy first request in queue - // so we need to wait for more - break; - } - } - - if (this._buffers && this._buffers.length > 0 && this._buffers[0] === null) { - this._end(); - } - } - catch (ex) { - this.emit('error', ex); - } -}; - -}).call(this,require('_process'),require("buffer").Buffer) -},{"_process":133,"buffer":48,"stream":155,"util":186}],113:[function(require,module,exports){ -'use strict'; - - -module.exports = { - - PNG_SIGNATURE: [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a], - - TYPE_IHDR: 0x49484452, - TYPE_IEND: 0x49454e44, - TYPE_IDAT: 0x49444154, - TYPE_PLTE: 0x504c5445, - TYPE_tRNS: 0x74524e53, // eslint-disable-line camelcase - TYPE_gAMA: 0x67414d41, // eslint-disable-line camelcase - - // color-type bits - COLORTYPE_GRAYSCALE: 0, - COLORTYPE_PALETTE: 1, - COLORTYPE_COLOR: 2, - COLORTYPE_ALPHA: 4, // e.g. grayscale and alpha - - // color-type combinations - COLORTYPE_PALETTE_COLOR: 3, - COLORTYPE_COLOR_ALPHA: 6, - - COLORTYPE_TO_BPP_MAP: { - 0: 1, - 2: 3, - 3: 1, - 4: 2, - 6: 4 - }, - - GAMMA_DIVISION: 100000 -}; - -},{}],114:[function(require,module,exports){ -'use strict'; - -var crcTable = []; - -(function() { - for (var i = 0; i < 256; i++) { - var currentCrc = i; - for (var j = 0; j < 8; j++) { - if (currentCrc & 1) { - currentCrc = 0xedb88320 ^ (currentCrc >>> 1); - } - else { - currentCrc = currentCrc >>> 1; - } - } - crcTable[i] = currentCrc; - } -}()); - -var CrcCalculator = module.exports = function() { - this._crc = -1; -}; - -CrcCalculator.prototype.write = function(data) { - - for (var i = 0; i < data.length; i++) { - this._crc = crcTable[(this._crc ^ data[i]) & 0xff] ^ (this._crc >>> 8); - } - return true; -}; - -CrcCalculator.prototype.crc32 = function() { - return this._crc ^ -1; -}; - - -CrcCalculator.crc32 = function(buf) { - - var crc = -1; - for (var i = 0; i < buf.length; i++) { - crc = crcTable[(crc ^ buf[i]) & 0xff] ^ (crc >>> 8); - } - return crc ^ -1; -}; - -},{}],115:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var paethPredictor = require('./paeth-predictor'); - -function filterNone(pxData, pxPos, byteWidth, rawData, rawPos) { - - for (var x = 0; x < byteWidth; x++) { - rawData[rawPos + x] = pxData[pxPos + x]; - } -} - -function filterSumNone(pxData, pxPos, byteWidth) { - - var sum = 0; - var length = pxPos + byteWidth; - - for (var i = pxPos; i < length; i++) { - sum += Math.abs(pxData[i]); - } - return sum; -} - -function filterSub(pxData, pxPos, byteWidth, rawData, rawPos, bpp) { - - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var val = pxData[pxPos + x] - left; - - rawData[rawPos + x] = val; - } -} - -function filterSumSub(pxData, pxPos, byteWidth, bpp) { - - var sum = 0; - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var val = pxData[pxPos + x] - left; - - sum += Math.abs(val); - } - - return sum; -} - -function filterUp(pxData, pxPos, byteWidth, rawData, rawPos) { - - for (var x = 0; x < byteWidth; x++) { - - var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; - var val = pxData[pxPos + x] - up; - - rawData[rawPos + x] = val; - } -} - -function filterSumUp(pxData, pxPos, byteWidth) { - - var sum = 0; - var length = pxPos + byteWidth; - for (var x = pxPos; x < length; x++) { - - var up = pxPos > 0 ? pxData[x - byteWidth] : 0; - var val = pxData[x] - up; - - sum += Math.abs(val); - } - - return sum; -} - -function filterAvg(pxData, pxPos, byteWidth, rawData, rawPos, bpp) { - - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; - var val = pxData[pxPos + x] - ((left + up) >> 1); - - rawData[rawPos + x] = val; - } -} - -function filterSumAvg(pxData, pxPos, byteWidth, bpp) { - - var sum = 0; - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; - var val = pxData[pxPos + x] - ((left + up) >> 1); - - sum += Math.abs(val); - } - - return sum; -} - -function filterPaeth(pxData, pxPos, byteWidth, rawData, rawPos, bpp) { - - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; - var upleft = pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0; - var val = pxData[pxPos + x] - paethPredictor(left, up, upleft); - - rawData[rawPos + x] = val; - } -} - -function filterSumPaeth(pxData, pxPos, byteWidth, bpp) { - var sum = 0; - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; - var upleft = pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0; - var val = pxData[pxPos + x] - paethPredictor(left, up, upleft); - - sum += Math.abs(val); - } - - return sum; -} - -var filters = { - 0: filterNone, - 1: filterSub, - 2: filterUp, - 3: filterAvg, - 4: filterPaeth -}; - -var filterSums = { - 0: filterSumNone, - 1: filterSumSub, - 2: filterSumUp, - 3: filterSumAvg, - 4: filterSumPaeth -}; - -module.exports = function(pxData, width, height, options, bpp) { - - var filterTypes; - if (!('filterType' in options) || options.filterType === -1) { - filterTypes = [0, 1, 2, 3, 4]; - } - else if (typeof options.filterType === 'number') { - filterTypes = [options.filterType]; - } - else { - throw new Error('unrecognised filter types'); - } - - if (options.bitDepth === 16) bpp *= 2; - var byteWidth = width * bpp; - var rawPos = 0; - var pxPos = 0; - var rawData = new Buffer((byteWidth + 1) * height); - - var sel = filterTypes[0]; - - for (var y = 0; y < height; y++) { - - if (filterTypes.length > 1) { - // find best filter for this line (with lowest sum of values) - var min = Infinity; - - for (var i = 0; i < filterTypes.length; i++) { - var sum = filterSums[filterTypes[i]](pxData, pxPos, byteWidth, bpp); - if (sum < min) { - sel = filterTypes[i]; - min = sum; - } - } - } - - rawData[rawPos] = sel; - rawPos++; - filters[sel](pxData, pxPos, byteWidth, rawData, rawPos, bpp); - rawPos += byteWidth; - pxPos += byteWidth; - } - return rawData; -}; - -}).call(this,require("buffer").Buffer) -},{"./paeth-predictor":124,"buffer":48}],116:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var util = require('util'); -var ChunkStream = require('./chunkstream'); -var Filter = require('./filter-parse'); - - -var FilterAsync = module.exports = function(bitmapInfo) { - ChunkStream.call(this); - - var buffers = []; - var that = this; - this._filter = new Filter(bitmapInfo, { - read: this.read.bind(this), - write: function(buffer) { - buffers.push(buffer); - }, - complete: function() { - that.emit('complete', Buffer.concat(buffers)); - } - }); - - this._filter.start(); -}; -util.inherits(FilterAsync, ChunkStream); - -}).call(this,require("buffer").Buffer) -},{"./chunkstream":112,"./filter-parse":118,"buffer":48,"util":186}],117:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var SyncReader = require('./sync-reader'); -var Filter = require('./filter-parse'); - - -exports.process = function(inBuffer, bitmapInfo) { - - var outBuffers = []; - var reader = new SyncReader(inBuffer); - var filter = new Filter(bitmapInfo, { - read: reader.read.bind(reader), - write: function(bufferPart) { - outBuffers.push(bufferPart); - }, - complete: function() { - } - }); - - filter.start(); - reader.process(); - - return Buffer.concat(outBuffers); -}; -}).call(this,require("buffer").Buffer) -},{"./filter-parse":118,"./sync-reader":131,"buffer":48}],118:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var interlaceUtils = require('./interlace'); -var paethPredictor = require('./paeth-predictor'); - -function getByteWidth(width, bpp, depth) { - var byteWidth = width * bpp; - if (depth !== 8) { - byteWidth = Math.ceil(byteWidth / (8 / depth)); - } - return byteWidth; -} - -var Filter = module.exports = function(bitmapInfo, dependencies) { - - var width = bitmapInfo.width; - var height = bitmapInfo.height; - var interlace = bitmapInfo.interlace; - var bpp = bitmapInfo.bpp; - var depth = bitmapInfo.depth; - - this.read = dependencies.read; - this.write = dependencies.write; - this.complete = dependencies.complete; - - this._imageIndex = 0; - this._images = []; - if (interlace) { - var passes = interlaceUtils.getImagePasses(width, height); - for (var i = 0; i < passes.length; i++) { - this._images.push({ - byteWidth: getByteWidth(passes[i].width, bpp, depth), - height: passes[i].height, - lineIndex: 0 - }); - } - } - else { - this._images.push({ - byteWidth: getByteWidth(width, bpp, depth), - height: height, - lineIndex: 0 - }); - } - - // when filtering the line we look at the pixel to the left - // the spec also says it is done on a byte level regardless of the number of pixels - // so if the depth is byte compatible (8 or 16) we subtract the bpp in order to compare back - // a pixel rather than just a different byte part. However if we are sub byte, we ignore. - if (depth === 8) { - this._xComparison = bpp; - } - else if (depth === 16) { - this._xComparison = bpp * 2; - } - else { - this._xComparison = 1; - } -}; - -Filter.prototype.start = function() { - this.read(this._images[this._imageIndex].byteWidth + 1, this._reverseFilterLine.bind(this)); -}; - -Filter.prototype._unFilterType1 = function(rawData, unfilteredLine, byteWidth) { - - var xComparison = this._xComparison; - var xBiggerThan = xComparison - 1; - - for (var x = 0; x < byteWidth; x++) { - var rawByte = rawData[1 + x]; - var f1Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; - unfilteredLine[x] = rawByte + f1Left; - } -}; - -Filter.prototype._unFilterType2 = function(rawData, unfilteredLine, byteWidth) { - - var lastLine = this._lastLine; - - for (var x = 0; x < byteWidth; x++) { - var rawByte = rawData[1 + x]; - var f2Up = lastLine ? lastLine[x] : 0; - unfilteredLine[x] = rawByte + f2Up; - } -}; - -Filter.prototype._unFilterType3 = function(rawData, unfilteredLine, byteWidth) { - - var xComparison = this._xComparison; - var xBiggerThan = xComparison - 1; - var lastLine = this._lastLine; - - for (var x = 0; x < byteWidth; x++) { - var rawByte = rawData[1 + x]; - var f3Up = lastLine ? lastLine[x] : 0; - var f3Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; - var f3Add = Math.floor((f3Left + f3Up) / 2); - unfilteredLine[x] = rawByte + f3Add; - } -}; - -Filter.prototype._unFilterType4 = function(rawData, unfilteredLine, byteWidth) { - - var xComparison = this._xComparison; - var xBiggerThan = xComparison - 1; - var lastLine = this._lastLine; - - for (var x = 0; x < byteWidth; x++) { - var rawByte = rawData[1 + x]; - var f4Up = lastLine ? lastLine[x] : 0; - var f4Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; - var f4UpLeft = x > xBiggerThan && lastLine ? lastLine[x - xComparison] : 0; - var f4Add = paethPredictor(f4Left, f4Up, f4UpLeft); - unfilteredLine[x] = rawByte + f4Add; - } -}; - -Filter.prototype._reverseFilterLine = function(rawData) { - - var filter = rawData[0]; - var unfilteredLine; - var currentImage = this._images[this._imageIndex]; - var byteWidth = currentImage.byteWidth; - - if (filter === 0) { - unfilteredLine = rawData.slice(1, byteWidth + 1); - } - else { - - unfilteredLine = new Buffer(byteWidth); - - switch (filter) { - case 1: - this._unFilterType1(rawData, unfilteredLine, byteWidth); - break; - case 2: - this._unFilterType2(rawData, unfilteredLine, byteWidth); - break; - case 3: - this._unFilterType3(rawData, unfilteredLine, byteWidth); - break; - case 4: - this._unFilterType4(rawData, unfilteredLine, byteWidth); - break; - default: - throw new Error('Unrecognised filter type - ' + filter); - } - } - - this.write(unfilteredLine); - - currentImage.lineIndex++; - if (currentImage.lineIndex >= currentImage.height) { - this._lastLine = null; - this._imageIndex++; - currentImage = this._images[this._imageIndex]; - } - else { - this._lastLine = unfilteredLine; - } - - if (currentImage) { - // read, using the byte width that may be from the new current image - this.read(currentImage.byteWidth + 1, this._reverseFilterLine.bind(this)); - } - else { - this._lastLine = null; - this.complete(); - } -}; - -}).call(this,require("buffer").Buffer) -},{"./interlace":120,"./paeth-predictor":124,"buffer":48}],119:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -function dePalette(indata, outdata, width, height, palette) { - var pxPos = 0; - // use values from palette - for (var y = 0; y < height; y++) { - for (var x = 0; x < width; x++) { - var color = palette[indata[pxPos]]; - - if (!color) { - throw new Error('index ' + indata[pxPos] + ' not in palette'); - } - - for (var i = 0; i < 4; i++) { - outdata[pxPos + i] = color[i]; - } - pxPos += 4; - } - } -} - -function replaceTransparentColor(indata, outdata, width, height, transColor) { - var pxPos = 0; - for (var y = 0; y < height; y++) { - for (var x = 0; x < width; x++) { - var makeTrans = false; - - if (transColor.length === 1) { - if (transColor[0] === indata[pxPos]) { - makeTrans = true; - } - } - else if (transColor[0] === indata[pxPos] && transColor[1] === indata[pxPos + 1] && transColor[2] === indata[pxPos + 2]) { - makeTrans = true; - } - if (makeTrans) { - for (var i = 0; i < 4; i++) { - outdata[pxPos + i] = 0; - } - } - pxPos += 4; - } - } -} - -function scaleDepth(indata, outdata, width, height, depth) { - var maxOutSample = 255; - var maxInSample = Math.pow(2, depth) - 1; - var pxPos = 0; - - for (var y = 0; y < height; y++) { - for (var x = 0; x < width; x++) { - for (var i = 0; i < 4; i++) { - outdata[pxPos + i] = Math.floor((indata[pxPos + i] * maxOutSample) / maxInSample + 0.5); - } - pxPos += 4; - } - } -} - -module.exports = function(indata, imageData) { - - var depth = imageData.depth; - var width = imageData.width; - var height = imageData.height; - var colorType = imageData.colorType; - var transColor = imageData.transColor; - var palette = imageData.palette; - - var outdata = indata; // only different for 16 bits - - if (colorType === 3) { // paletted - dePalette(indata, outdata, width, height, palette); - } - else { - if (transColor) { - replaceTransparentColor(indata, outdata, width, height, transColor); - } - // if it needs scaling - if (depth !== 8) { - // if we need to change the buffer size - if (depth === 16) { - outdata = new Buffer(width * height * 4); - } - scaleDepth(indata, outdata, width, height, depth); - } - } - return outdata; -}; - -}).call(this,require("buffer").Buffer) -},{"buffer":48}],120:[function(require,module,exports){ -'use strict'; - -// Adam 7 -// 0 1 2 3 4 5 6 7 -// 0 x 6 4 6 x 6 4 6 -// 1 7 7 7 7 7 7 7 7 -// 2 5 6 5 6 5 6 5 6 -// 3 7 7 7 7 7 7 7 7 -// 4 3 6 4 6 3 6 4 6 -// 5 7 7 7 7 7 7 7 7 -// 6 5 6 5 6 5 6 5 6 -// 7 7 7 7 7 7 7 7 7 - - -var imagePasses = [ - { // pass 1 - 1px - x: [0], - y: [0] - }, - { // pass 2 - 1px - x: [4], - y: [0] - }, - { // pass 3 - 2px - x: [0, 4], - y: [4] - }, - { // pass 4 - 4px - x: [2, 6], - y: [0, 4] - }, - { // pass 5 - 8px - x: [0, 2, 4, 6], - y: [2, 6] - }, - { // pass 6 - 16px - x: [1, 3, 5, 7], - y: [0, 2, 4, 6] - }, - { // pass 7 - 32px - x: [0, 1, 2, 3, 4, 5, 6, 7], - y: [1, 3, 5, 7] - } -]; - -exports.getImagePasses = function(width, height) { - var images = []; - var xLeftOver = width % 8; - var yLeftOver = height % 8; - var xRepeats = (width - xLeftOver) / 8; - var yRepeats = (height - yLeftOver) / 8; - for (var i = 0; i < imagePasses.length; i++) { - var pass = imagePasses[i]; - var passWidth = xRepeats * pass.x.length; - var passHeight = yRepeats * pass.y.length; - for (var j = 0; j < pass.x.length; j++) { - if (pass.x[j] < xLeftOver) { - passWidth++; - } - else { - break; - } - } - for (j = 0; j < pass.y.length; j++) { - if (pass.y[j] < yLeftOver) { - passHeight++; - } - else { - break; - } - } - if (passWidth > 0 && passHeight > 0) { - images.push({ width: passWidth, height: passHeight, index: i }); - } - } - return images; -}; - -exports.getInterlaceIterator = function(width) { - return function(x, y, pass) { - var outerXLeftOver = x % imagePasses[pass].x.length; - var outerX = (((x - outerXLeftOver) / imagePasses[pass].x.length) * 8) + imagePasses[pass].x[outerXLeftOver]; - var outerYLeftOver = y % imagePasses[pass].y.length; - var outerY = (((y - outerYLeftOver) / imagePasses[pass].y.length) * 8) + imagePasses[pass].y[outerYLeftOver]; - return (outerX * 4) + (outerY * width * 4); - }; -}; -},{}],121:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var util = require('util'); -var Stream = require('stream'); -var constants = require('./constants'); -var Packer = require('./packer'); - -var PackerAsync = module.exports = function(opt) { - Stream.call(this); - - var options = opt || {}; - - this._packer = new Packer(options); - this._deflate = this._packer.createDeflate(); - - this.readable = true; -}; -util.inherits(PackerAsync, Stream); - - -PackerAsync.prototype.pack = function(data, width, height, gamma) { - // Signature - this.emit('data', new Buffer(constants.PNG_SIGNATURE)); - this.emit('data', this._packer.packIHDR(width, height)); - - if (gamma) { - this.emit('data', this._packer.packGAMA(gamma)); - } - - var filteredData = this._packer.filterData(data, width, height); - - // compress it - this._deflate.on('error', this.emit.bind(this, 'error')); - - this._deflate.on('data', function(compressedData) { - this.emit('data', this._packer.packIDAT(compressedData)); - }.bind(this)); - - this._deflate.on('end', function() { - this.emit('data', this._packer.packIEND()); - this.emit('end'); - }.bind(this)); - - this._deflate.end(filteredData); -}; - -}).call(this,require("buffer").Buffer) -},{"./constants":113,"./packer":123,"buffer":48,"stream":155,"util":186}],122:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var hasSyncZlib = true; -var zlib = require('zlib'); -if (!zlib.deflateSync) { - hasSyncZlib = false; -} -var constants = require('./constants'); -var Packer = require('./packer'); - -module.exports = function(metaData, opt) { - - if (!hasSyncZlib) { - throw new Error('To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0'); - } - - var options = opt || {}; - - var packer = new Packer(options); - - var chunks = []; - - // Signature - chunks.push(new Buffer(constants.PNG_SIGNATURE)); - - // Header - chunks.push(packer.packIHDR(metaData.width, metaData.height)); - - if (metaData.gamma) { - chunks.push(packer.packGAMA(metaData.gamma)); - } - - var filteredData = packer.filterData(metaData.data, metaData.width, metaData.height); - - // compress it - var compressedData = zlib.deflateSync(filteredData, packer.getDeflateOptions()); - filteredData = null; - - if (!compressedData || !compressedData.length) { - throw new Error('bad png - invalid compressed data response'); - } - chunks.push(packer.packIDAT(compressedData)); - - // End - chunks.push(packer.packIEND()); - - return Buffer.concat(chunks); -}; - -}).call(this,require("buffer").Buffer) -},{"./constants":113,"./packer":123,"buffer":48,"zlib":35}],123:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var constants = require('./constants'); -var CrcStream = require('./crc'); -var bitPacker = require('./bitpacker'); -var filter = require('./filter-pack'); -var zlib = require('zlib'); - -var Packer = module.exports = function(options) { - this._options = options; - - options.deflateChunkSize = options.deflateChunkSize || 32 * 1024; - options.deflateLevel = options.deflateLevel != null ? options.deflateLevel : 9; - options.deflateStrategy = options.deflateStrategy != null ? options.deflateStrategy : 3; - options.inputHasAlpha = options.inputHasAlpha != null ? options.inputHasAlpha : true; - options.deflateFactory = options.deflateFactory || zlib.createDeflate; - options.bitDepth = options.bitDepth || 8; - // This is outputColorType - options.colorType = (typeof options.colorType === 'number') ? options.colorType : constants.COLORTYPE_COLOR_ALPHA; - options.inputColorType = (typeof options.inputColorType === 'number') ? options.inputColorType : constants.COLORTYPE_COLOR_ALPHA; - - if ([ - constants.COLORTYPE_GRAYSCALE, - constants.COLORTYPE_COLOR, - constants.COLORTYPE_COLOR_ALPHA, - constants.COLORTYPE_ALPHA - ].indexOf(options.colorType) === -1) { - throw new Error('option color type:' + options.colorType + ' is not supported at present'); - } - if ([ - constants.COLORTYPE_GRAYSCALE, - constants.COLORTYPE_COLOR, - constants.COLORTYPE_COLOR_ALPHA, - constants.COLORTYPE_ALPHA - ].indexOf(options.inputColorType) === -1) { - throw new Error('option input color type:' + options.inputColorType + ' is not supported at present'); - } - if (options.bitDepth !== 8 && options.bitDepth !== 16) { - throw new Error('option bit depth:' + options.bitDepth + ' is not supported at present'); - } -}; - -Packer.prototype.getDeflateOptions = function() { - return { - chunkSize: this._options.deflateChunkSize, - level: this._options.deflateLevel, - strategy: this._options.deflateStrategy - }; -}; - -Packer.prototype.createDeflate = function() { - return this._options.deflateFactory(this.getDeflateOptions()); -}; - -Packer.prototype.filterData = function(data, width, height) { - // convert to correct format for filtering (e.g. right bpp and bit depth) - var packedData = bitPacker(data, width, height, this._options); - - // filter pixel data - var bpp = constants.COLORTYPE_TO_BPP_MAP[this._options.colorType]; - var filteredData = filter(packedData, width, height, this._options, bpp); - return filteredData; -}; - -Packer.prototype._packChunk = function(type, data) { - - var len = (data ? data.length : 0); - var buf = new Buffer(len + 12); - - buf.writeUInt32BE(len, 0); - buf.writeUInt32BE(type, 4); - - if (data) { - data.copy(buf, 8); - } - - buf.writeInt32BE(CrcStream.crc32(buf.slice(4, buf.length - 4)), buf.length - 4); - return buf; -}; - -Packer.prototype.packGAMA = function(gamma) { - var buf = new Buffer(4); - buf.writeUInt32BE(Math.floor(gamma * constants.GAMMA_DIVISION), 0); - return this._packChunk(constants.TYPE_gAMA, buf); -}; - -Packer.prototype.packIHDR = function(width, height) { - - var buf = new Buffer(13); - buf.writeUInt32BE(width, 0); - buf.writeUInt32BE(height, 4); - buf[8] = this._options.bitDepth; // Bit depth - buf[9] = this._options.colorType; // colorType - buf[10] = 0; // compression - buf[11] = 0; // filter - buf[12] = 0; // interlace - - return this._packChunk(constants.TYPE_IHDR, buf); -}; - -Packer.prototype.packIDAT = function(data) { - return this._packChunk(constants.TYPE_IDAT, data); -}; - -Packer.prototype.packIEND = function() { - return this._packChunk(constants.TYPE_IEND, null); -}; - -}).call(this,require("buffer").Buffer) -},{"./bitpacker":111,"./constants":113,"./crc":114,"./filter-pack":115,"buffer":48,"zlib":35}],124:[function(require,module,exports){ -'use strict'; - -module.exports = function paethPredictor(left, above, upLeft) { - - var paeth = left + above - upLeft; - var pLeft = Math.abs(paeth - left); - var pAbove = Math.abs(paeth - above); - var pUpLeft = Math.abs(paeth - upLeft); - - if (pLeft <= pAbove && pLeft <= pUpLeft) { - return left; - } - if (pAbove <= pUpLeft) { - return above; - } - return upLeft; -}; -},{}],125:[function(require,module,exports){ -'use strict'; - -var util = require('util'); -var zlib = require('zlib'); -var ChunkStream = require('./chunkstream'); -var FilterAsync = require('./filter-parse-async'); -var Parser = require('./parser'); -var bitmapper = require('./bitmapper'); -var formatNormaliser = require('./format-normaliser'); - -var ParserAsync = module.exports = function(options) { - ChunkStream.call(this); - - this._parser = new Parser(options, { - read: this.read.bind(this), - error: this._handleError.bind(this), - metadata: this._handleMetaData.bind(this), - gamma: this.emit.bind(this, 'gamma'), - palette: this._handlePalette.bind(this), - transColor: this._handleTransColor.bind(this), - finished: this._finished.bind(this), - inflateData: this._inflateData.bind(this) - }); - this._options = options; - this.writable = true; - - this._parser.start(); -}; -util.inherits(ParserAsync, ChunkStream); - - -ParserAsync.prototype._handleError = function(err) { - - this.emit('error', err); - - this.writable = false; - - this.destroy(); - - if (this._inflate && this._inflate.destroy) { - this._inflate.destroy(); - } - - if (this._filter) { - this._filter.destroy(); - // For backward compatibility with Node 7 and below. - // Suppress errors due to _inflate calling write() even after - // it's destroy()'ed. - this._filter.on('error', function() {}); - } - - this.errord = true; -}; - -ParserAsync.prototype._inflateData = function(data) { - if (!this._inflate) { - if (this._bitmapInfo.interlace) { - this._inflate = zlib.createInflate(); - - this._inflate.on('error', this.emit.bind(this, 'error')); - this._filter.on('complete', this._complete.bind(this)); - - this._inflate.pipe(this._filter); - } else { - var rowSize = ((this._bitmapInfo.width * this._bitmapInfo.bpp * this._bitmapInfo.depth + 7) >> 3) + 1; - var imageSize = rowSize * this._bitmapInfo.height; - var chunkSize = Math.max(imageSize, zlib.Z_MIN_CHUNK); - - this._inflate = zlib.createInflate({ chunkSize: chunkSize }); - var leftToInflate = imageSize; - - var emitError = this.emit.bind(this, 'error'); - this._inflate.on('error', function(err) { - if (!leftToInflate) { - return; - } - - emitError(err); - }); - this._filter.on('complete', this._complete.bind(this)); - - var filterWrite = this._filter.write.bind(this._filter); - this._inflate.on('data', function(chunk) { - if (!leftToInflate) { - return; - } - - if (chunk.length > leftToInflate) { - chunk = chunk.slice(0, leftToInflate); - } - - leftToInflate -= chunk.length; - - filterWrite(chunk); - }); - - this._inflate.on('end', this._filter.end.bind(this._filter)); - } - } - this._inflate.write(data); -}; - -ParserAsync.prototype._handleMetaData = function(metaData) { - - this.emit('metadata', metaData); - - this._bitmapInfo = Object.create(metaData); - - this._filter = new FilterAsync(this._bitmapInfo); -}; - -ParserAsync.prototype._handleTransColor = function(transColor) { - this._bitmapInfo.transColor = transColor; -}; - -ParserAsync.prototype._handlePalette = function(palette) { - this._bitmapInfo.palette = palette; -}; - - -ParserAsync.prototype._finished = function() { - if (this.errord) { - return; - } - - if (!this._inflate) { - this.emit('error', 'No Inflate block'); - } - else { - // no more data to inflate - this._inflate.end(); - } - this.destroySoon(); -}; - -ParserAsync.prototype._complete = function(filteredData) { - - if (this.errord) { - return; - } - - try { - var bitmapData = bitmapper.dataToBitMap(filteredData, this._bitmapInfo); - - var normalisedBitmapData = formatNormaliser(bitmapData, this._bitmapInfo); - bitmapData = null; - } - catch (ex) { - this._handleError(ex); - return; - } - - this.emit('parsed', normalisedBitmapData); -}; - -},{"./bitmapper":110,"./chunkstream":112,"./filter-parse-async":116,"./format-normaliser":119,"./parser":127,"util":186,"zlib":35}],126:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var hasSyncZlib = true; -var zlib = require('zlib'); -var inflateSync = require('./sync-inflate'); -if (!zlib.deflateSync) { - hasSyncZlib = false; -} -var SyncReader = require('./sync-reader'); -var FilterSync = require('./filter-parse-sync'); -var Parser = require('./parser'); -var bitmapper = require('./bitmapper'); -var formatNormaliser = require('./format-normaliser'); - - -module.exports = function(buffer, options) { - - if (!hasSyncZlib) { - throw new Error('To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0'); - } - - var err; - function handleError(_err_) { - err = _err_; - } - - var metaData; - function handleMetaData(_metaData_) { - metaData = _metaData_; - } - - function handleTransColor(transColor) { - metaData.transColor = transColor; - } - - function handlePalette(palette) { - metaData.palette = palette; - } - - var gamma; - function handleGamma(_gamma_) { - gamma = _gamma_; - } - - var inflateDataList = []; - function handleInflateData(inflatedData) { - inflateDataList.push(inflatedData); - } - - var reader = new SyncReader(buffer); - - var parser = new Parser(options, { - read: reader.read.bind(reader), - error: handleError, - metadata: handleMetaData, - gamma: handleGamma, - palette: handlePalette, - transColor: handleTransColor, - inflateData: handleInflateData - }); - - parser.start(); - reader.process(); - - if (err) { - throw err; - } - - //join together the inflate datas - var inflateData = Buffer.concat(inflateDataList); - inflateDataList.length = 0; - - var inflatedData; - if (metaData.interlace) { - inflatedData = zlib.inflateSync(inflateData); - } else { - var rowSize = ((metaData.width * metaData.bpp * metaData.depth + 7) >> 3) + 1; - var imageSize = rowSize * metaData.height; - inflatedData = inflateSync(inflateData, { chunkSize: imageSize, maxLength: imageSize }); - } - inflateData = null; - - if (!inflatedData || !inflatedData.length) { - throw new Error('bad png - invalid inflate data response'); - } - - var unfilteredData = FilterSync.process(inflatedData, metaData); - inflateData = null; - - var bitmapData = bitmapper.dataToBitMap(unfilteredData, metaData); - unfilteredData = null; - - var normalisedBitmapData = formatNormaliser(bitmapData, metaData); - - metaData.data = normalisedBitmapData; - metaData.gamma = gamma || 0; - - return metaData; -}; - -}).call(this,require("buffer").Buffer) -},{"./bitmapper":110,"./filter-parse-sync":117,"./format-normaliser":119,"./parser":127,"./sync-inflate":130,"./sync-reader":131,"buffer":48,"zlib":35}],127:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var constants = require('./constants'); -var CrcCalculator = require('./crc'); - - -var Parser = module.exports = function(options, dependencies) { - - this._options = options; - options.checkCRC = options.checkCRC !== false; - - this._hasIHDR = false; - this._hasIEND = false; - - // input flags/metadata - this._palette = []; - this._colorType = 0; - - this._chunks = {}; - this._chunks[constants.TYPE_IHDR] = this._handleIHDR.bind(this); - this._chunks[constants.TYPE_IEND] = this._handleIEND.bind(this); - this._chunks[constants.TYPE_IDAT] = this._handleIDAT.bind(this); - this._chunks[constants.TYPE_PLTE] = this._handlePLTE.bind(this); - this._chunks[constants.TYPE_tRNS] = this._handleTRNS.bind(this); - this._chunks[constants.TYPE_gAMA] = this._handleGAMA.bind(this); - - this.read = dependencies.read; - this.error = dependencies.error; - this.metadata = dependencies.metadata; - this.gamma = dependencies.gamma; - this.transColor = dependencies.transColor; - this.palette = dependencies.palette; - this.parsed = dependencies.parsed; - this.inflateData = dependencies.inflateData; - this.finished = dependencies.finished; -}; - -Parser.prototype.start = function() { - this.read(constants.PNG_SIGNATURE.length, - this._parseSignature.bind(this) - ); -}; - -Parser.prototype._parseSignature = function(data) { - - var signature = constants.PNG_SIGNATURE; - - for (var i = 0; i < signature.length; i++) { - if (data[i] !== signature[i]) { - this.error(new Error('Invalid file signature')); - return; - } - } - this.read(8, this._parseChunkBegin.bind(this)); -}; - -Parser.prototype._parseChunkBegin = function(data) { - - // chunk content length - var length = data.readUInt32BE(0); - - // chunk type - var type = data.readUInt32BE(4); - var name = ''; - for (var i = 4; i < 8; i++) { - name += String.fromCharCode(data[i]); - } - - //console.log('chunk ', name, length); - - // chunk flags - var ancillary = Boolean(data[4] & 0x20); // or critical -// priv = Boolean(data[5] & 0x20), // or public -// safeToCopy = Boolean(data[7] & 0x20); // or unsafe - - if (!this._hasIHDR && type !== constants.TYPE_IHDR) { - this.error(new Error('Expected IHDR on beggining')); - return; - } - - this._crc = new CrcCalculator(); - this._crc.write(new Buffer(name)); - - if (this._chunks[type]) { - return this._chunks[type](length); - } - - if (!ancillary) { - this.error(new Error('Unsupported critical chunk type ' + name)); - return; - } - - this.read(length + 4, this._skipChunk.bind(this)); -}; - -Parser.prototype._skipChunk = function(/*data*/) { - this.read(8, this._parseChunkBegin.bind(this)); -}; - -Parser.prototype._handleChunkEnd = function() { - this.read(4, this._parseChunkEnd.bind(this)); -}; - -Parser.prototype._parseChunkEnd = function(data) { - - var fileCrc = data.readInt32BE(0); - var calcCrc = this._crc.crc32(); - - // check CRC - if (this._options.checkCRC && calcCrc !== fileCrc) { - this.error(new Error('Crc error - ' + fileCrc + ' - ' + calcCrc)); - return; - } - - if (!this._hasIEND) { - this.read(8, this._parseChunkBegin.bind(this)); - } -}; - -Parser.prototype._handleIHDR = function(length) { - this.read(length, this._parseIHDR.bind(this)); -}; -Parser.prototype._parseIHDR = function(data) { - - this._crc.write(data); - - var width = data.readUInt32BE(0); - var height = data.readUInt32BE(4); - var depth = data[8]; - var colorType = data[9]; // bits: 1 palette, 2 color, 4 alpha - var compr = data[10]; - var filter = data[11]; - var interlace = data[12]; - - // console.log(' width', width, 'height', height, - // 'depth', depth, 'colorType', colorType, - // 'compr', compr, 'filter', filter, 'interlace', interlace - // ); - - if (depth !== 8 && depth !== 4 && depth !== 2 && depth !== 1 && depth !== 16) { - this.error(new Error('Unsupported bit depth ' + depth)); - return; - } - if (!(colorType in constants.COLORTYPE_TO_BPP_MAP)) { - this.error(new Error('Unsupported color type')); - return; - } - if (compr !== 0) { - this.error(new Error('Unsupported compression method')); - return; - } - if (filter !== 0) { - this.error(new Error('Unsupported filter method')); - return; - } - if (interlace !== 0 && interlace !== 1) { - this.error(new Error('Unsupported interlace method')); - return; - } - - this._colorType = colorType; - - var bpp = constants.COLORTYPE_TO_BPP_MAP[this._colorType]; - - this._hasIHDR = true; - - this.metadata({ - width: width, - height: height, - depth: depth, - interlace: Boolean(interlace), - palette: Boolean(colorType & constants.COLORTYPE_PALETTE), - color: Boolean(colorType & constants.COLORTYPE_COLOR), - alpha: Boolean(colorType & constants.COLORTYPE_ALPHA), - bpp: bpp, - colorType: colorType - }); - - this._handleChunkEnd(); -}; - - -Parser.prototype._handlePLTE = function(length) { - this.read(length, this._parsePLTE.bind(this)); -}; -Parser.prototype._parsePLTE = function(data) { - - this._crc.write(data); - - var entries = Math.floor(data.length / 3); - // console.log('Palette:', entries); - - for (var i = 0; i < entries; i++) { - this._palette.push([ - data[i * 3], - data[i * 3 + 1], - data[i * 3 + 2], - 0xff - ]); - } - - this.palette(this._palette); - - this._handleChunkEnd(); -}; - -Parser.prototype._handleTRNS = function(length) { - this.read(length, this._parseTRNS.bind(this)); -}; -Parser.prototype._parseTRNS = function(data) { - - this._crc.write(data); - - // palette - if (this._colorType === constants.COLORTYPE_PALETTE_COLOR) { - if (this._palette.length === 0) { - this.error(new Error('Transparency chunk must be after palette')); - return; - } - if (data.length > this._palette.length) { - this.error(new Error('More transparent colors than palette size')); - return; - } - for (var i = 0; i < data.length; i++) { - this._palette[i][3] = data[i]; - } - this.palette(this._palette); - } - - // for colorType 0 (grayscale) and 2 (rgb) - // there might be one gray/color defined as transparent - if (this._colorType === constants.COLORTYPE_GRAYSCALE) { - // grey, 2 bytes - this.transColor([data.readUInt16BE(0)]); - } - if (this._colorType === constants.COLORTYPE_COLOR) { - this.transColor([data.readUInt16BE(0), data.readUInt16BE(2), data.readUInt16BE(4)]); - } - - this._handleChunkEnd(); -}; - -Parser.prototype._handleGAMA = function(length) { - this.read(length, this._parseGAMA.bind(this)); -}; -Parser.prototype._parseGAMA = function(data) { - - this._crc.write(data); - this.gamma(data.readUInt32BE(0) / constants.GAMMA_DIVISION); - - this._handleChunkEnd(); -}; - -Parser.prototype._handleIDAT = function(length) { - this.read(-length, this._parseIDAT.bind(this, length)); -}; -Parser.prototype._parseIDAT = function(length, data) { - - this._crc.write(data); - - if (this._colorType === constants.COLORTYPE_PALETTE_COLOR && this._palette.length === 0) { - throw new Error('Expected palette not found'); - } - - this.inflateData(data); - var leftOverLength = length - data.length; - - if (leftOverLength > 0) { - this._handleIDAT(leftOverLength); - } - else { - this._handleChunkEnd(); - } -}; - -Parser.prototype._handleIEND = function(length) { - this.read(length, this._parseIEND.bind(this)); -}; -Parser.prototype._parseIEND = function(data) { - - this._crc.write(data); - - this._hasIEND = true; - this._handleChunkEnd(); - - if (this.finished) { - this.finished(); - } -}; - -}).call(this,require("buffer").Buffer) -},{"./constants":113,"./crc":114,"buffer":48}],128:[function(require,module,exports){ -'use strict'; - - -var parse = require('./parser-sync'); -var pack = require('./packer-sync'); - - -exports.read = function(buffer, options) { - - return parse(buffer, options || {}); -}; - -exports.write = function(png, options) { - - return pack(png, options); -}; - -},{"./packer-sync":122,"./parser-sync":126}],129:[function(require,module,exports){ -(function (process,Buffer){ -'use strict'; - -var util = require('util'); -var Stream = require('stream'); -var Parser = require('./parser-async'); -var Packer = require('./packer-async'); -var PNGSync = require('./png-sync'); - - -var PNG = exports.PNG = function(options) { - Stream.call(this); - - options = options || {}; // eslint-disable-line no-param-reassign - - // coerce pixel dimensions to integers (also coerces undefined -> 0): - this.width = options.width | 0; - this.height = options.height | 0; - - this.data = this.width > 0 && this.height > 0 ? - new Buffer(4 * this.width * this.height) : null; - - if (options.fill && this.data) { - this.data.fill(0); - } - - this.gamma = 0; - this.readable = this.writable = true; - - this._parser = new Parser(options); - - this._parser.on('error', this.emit.bind(this, 'error')); - this._parser.on('close', this._handleClose.bind(this)); - this._parser.on('metadata', this._metadata.bind(this)); - this._parser.on('gamma', this._gamma.bind(this)); - this._parser.on('parsed', function(data) { - this.data = data; - this.emit('parsed', data); - }.bind(this)); - - this._packer = new Packer(options); - this._packer.on('data', this.emit.bind(this, 'data')); - this._packer.on('end', this.emit.bind(this, 'end')); - this._parser.on('close', this._handleClose.bind(this)); - this._packer.on('error', this.emit.bind(this, 'error')); - -}; -util.inherits(PNG, Stream); - -PNG.sync = PNGSync; - -PNG.prototype.pack = function() { - - if (!this.data || !this.data.length) { - this.emit('error', 'No data provided'); - return this; - } - - process.nextTick(function() { - this._packer.pack(this.data, this.width, this.height, this.gamma); - }.bind(this)); - - return this; -}; - - -PNG.prototype.parse = function(data, callback) { - - if (callback) { - var onParsed, onError; - - onParsed = function(parsedData) { - this.removeListener('error', onError); - - this.data = parsedData; - callback(null, this); - }.bind(this); - - onError = function(err) { - this.removeListener('parsed', onParsed); - - callback(err, null); - }.bind(this); - - this.once('parsed', onParsed); - this.once('error', onError); - } - - this.end(data); - return this; -}; - -PNG.prototype.write = function(data) { - this._parser.write(data); - return true; -}; - -PNG.prototype.end = function(data) { - this._parser.end(data); -}; - -PNG.prototype._metadata = function(metadata) { - this.width = metadata.width; - this.height = metadata.height; - - this.emit('metadata', metadata); -}; - -PNG.prototype._gamma = function(gamma) { - this.gamma = gamma; -}; - -PNG.prototype._handleClose = function() { - if (!this._parser.writable && !this._packer.readable) { - this.emit('close'); - } -}; - - -PNG.bitblt = function(src, dst, srcX, srcY, width, height, deltaX, deltaY) { // eslint-disable-line max-params - // coerce pixel dimensions to integers (also coerces undefined -> 0): - /* eslint-disable no-param-reassign */ - srcX |= 0; - srcY |= 0; - width |= 0; - height |= 0; - deltaX |= 0; - deltaY |= 0; - /* eslint-enable no-param-reassign */ - - if (srcX > src.width || srcY > src.height || srcX + width > src.width || srcY + height > src.height) { - throw new Error('bitblt reading outside image'); - } - - if (deltaX > dst.width || deltaY > dst.height || deltaX + width > dst.width || deltaY + height > dst.height) { - throw new Error('bitblt writing outside image'); - } - - for (var y = 0; y < height; y++) { - src.data.copy(dst.data, - ((deltaY + y) * dst.width + deltaX) << 2, - ((srcY + y) * src.width + srcX) << 2, - ((srcY + y) * src.width + srcX + width) << 2 - ); - } -}; - - -PNG.prototype.bitblt = function(dst, srcX, srcY, width, height, deltaX, deltaY) { // eslint-disable-line max-params - - PNG.bitblt(this, dst, srcX, srcY, width, height, deltaX, deltaY); - return this; -}; - -PNG.adjustGamma = function(src) { - if (src.gamma) { - for (var y = 0; y < src.height; y++) { - for (var x = 0; x < src.width; x++) { - var idx = (src.width * y + x) << 2; - - for (var i = 0; i < 3; i++) { - var sample = src.data[idx + i] / 255; - sample = Math.pow(sample, 1 / 2.2 / src.gamma); - src.data[idx + i] = Math.round(sample * 255); - } - } - } - src.gamma = 0; - } -}; - -PNG.prototype.adjustGamma = function() { - PNG.adjustGamma(this); -}; - -}).call(this,require('_process'),require("buffer").Buffer) -},{"./packer-async":121,"./parser-async":125,"./png-sync":128,"_process":133,"buffer":48,"stream":155,"util":186}],130:[function(require,module,exports){ -(function (process,Buffer){ -'use strict'; - -var assert = require('assert').ok; -var zlib = require('zlib'); -var util = require('util'); - -var kMaxLength = require('buffer').kMaxLength; - -function Inflate(opts) { - if (!(this instanceof Inflate)) { - return new Inflate(opts); - } - - if (opts && opts.chunkSize < zlib.Z_MIN_CHUNK) { - opts.chunkSize = zlib.Z_MIN_CHUNK; - } - - zlib.Inflate.call(this, opts); - - // Node 8 --> 9 compatibility check - this._offset = this._offset === undefined ? this._outOffset : this._offset; - this._buffer = this._buffer || this._outBuffer; - - if (opts && opts.maxLength != null) { - this._maxLength = opts.maxLength; - } -} - -function createInflate(opts) { - return new Inflate(opts); -} - -function _close(engine, callback) { - if (callback) { - process.nextTick(callback); - } - - // Caller may invoke .close after a zlib error (which will null _handle). - if (!engine._handle) { - return; - } - - engine._handle.close(); - engine._handle = null; -} - -Inflate.prototype._processChunk = function(chunk, flushFlag, asyncCb) { - if (typeof asyncCb === 'function') { - return zlib.Inflate._processChunk.call(this, chunk, flushFlag, asyncCb); - } - - var self = this; - - var availInBefore = chunk && chunk.length; - var availOutBefore = this._chunkSize - this._offset; - var leftToInflate = this._maxLength; - var inOff = 0; - - var buffers = []; - var nread = 0; - - var error; - this.on('error', function(err) { - error = err; - }); - - function handleChunk(availInAfter, availOutAfter) { - if (self._hadError) { - return; - } - - var have = availOutBefore - availOutAfter; - assert(have >= 0, 'have should not go down'); - - if (have > 0) { - var out = self._buffer.slice(self._offset, self._offset + have); - self._offset += have; - - if (out.length > leftToInflate) { - out = out.slice(0, leftToInflate); - } - - buffers.push(out); - nread += out.length; - leftToInflate -= out.length; - - if (leftToInflate === 0) { - return false; - } - } - - if (availOutAfter === 0 || self._offset >= self._chunkSize) { - availOutBefore = self._chunkSize; - self._offset = 0; - self._buffer = Buffer.allocUnsafe(self._chunkSize); - } - - if (availOutAfter === 0) { - inOff += (availInBefore - availInAfter); - availInBefore = availInAfter; - - return true; - } - - return false; - } - - assert(this._handle, 'zlib binding closed'); - do { - var res = this._handle.writeSync(flushFlag, - chunk, // in - inOff, // in_off - availInBefore, // in_len - this._buffer, // out - this._offset, //out_off - availOutBefore); // out_len - // Node 8 --> 9 compatibility check - res = res || this._writeState; - } while (!this._hadError && handleChunk(res[0], res[1])); - - if (this._hadError) { - throw error; - } - - if (nread >= kMaxLength) { - _close(this); - throw new RangeError('Cannot create final Buffer. It would be larger than 0x' + kMaxLength.toString(16) + ' bytes'); - } - - var buf = Buffer.concat(buffers, nread); - _close(this); - - return buf; -}; - -util.inherits(Inflate, zlib.Inflate); - -function zlibBufferSync(engine, buffer) { - if (typeof buffer === 'string') { - buffer = Buffer.from(buffer); - } - if (!(buffer instanceof Buffer)) { - throw new TypeError('Not a string or buffer'); - } - - var flushFlag = engine._finishFlushFlag; - if (flushFlag == null) { - flushFlag = zlib.Z_FINISH; - } - - return engine._processChunk(buffer, flushFlag); -} - -function inflateSync(buffer, opts) { - return zlibBufferSync(new Inflate(opts), buffer); -} - -module.exports = exports = inflateSync; -exports.Inflate = Inflate; -exports.createInflate = createInflate; -exports.inflateSync = inflateSync; - -}).call(this,require('_process'),require("buffer").Buffer) -},{"_process":133,"assert":25,"buffer":48,"util":186,"zlib":35}],131:[function(require,module,exports){ -'use strict'; - -var SyncReader = module.exports = function(buffer) { - - this._buffer = buffer; - this._reads = []; -}; - -SyncReader.prototype.read = function(length, callback) { - - this._reads.push({ - length: Math.abs(length), // if length < 0 then at most this length - allowLess: length < 0, - func: callback - }); -}; - -SyncReader.prototype.process = function() { - - // as long as there is any data and read requests - while (this._reads.length > 0 && this._buffer.length) { - - var read = this._reads[0]; - - if (this._buffer.length && (this._buffer.length >= read.length || read.allowLess)) { - - // ok there is any data so that we can satisfy this request - this._reads.shift(); // == read - - var buf = this._buffer; - - this._buffer = buf.slice(read.length); - - read.func.call(this, buf.slice(0, read.length)); - - } - else { - break; - } - - } - - if (this._reads.length > 0) { - return new Error('There are some read requests waitng on finished stream'); - } - - if (this._buffer.length > 0) { - return new Error('unrecognised content at end of stream'); - } - -}; - -},{}],132:[function(require,module,exports){ -(function (process){ -'use strict'; - -if (typeof process === 'undefined' || - !process.version || - process.version.indexOf('v0.') === 0 || - process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { - module.exports = { nextTick: nextTick }; -} else { - module.exports = process -} - -function nextTick(fn, arg1, arg2, arg3) { - if (typeof fn !== 'function') { - throw new TypeError('"callback" argument must be a function'); - } - var len = arguments.length; - var args, i; - switch (len) { - case 0: - case 1: - return process.nextTick(fn); - case 2: - return process.nextTick(function afterTickOne() { - fn.call(null, arg1); - }); - case 3: - return process.nextTick(function afterTickTwo() { - fn.call(null, arg1, arg2); - }); - case 4: - return process.nextTick(function afterTickThree() { - fn.call(null, arg1, arg2, arg3); - }); - default: - args = new Array(len - 1); - i = 0; - while (i < args.length) { - args[i++] = arguments[i]; - } - return process.nextTick(function afterTick() { - fn.apply(null, args); - }); - } -} - - -}).call(this,require('_process')) -},{"_process":133}],133:[function(require,module,exports){ -// shim for using process in browser -var process = module.exports = {}; - -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. - -var cachedSetTimeout; -var cachedClearTimeout; - -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); -} -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - - -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - - -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; - -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} - -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; - -process.listeners = function (name) { return [] } - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; - -},{}],134:[function(require,module,exports){ -(function (global){ -/*! https://mths.be/punycode v1.4.1 by @mathias */ -;(function(root) { - - /** Detect free variables */ - var freeExports = typeof exports == 'object' && exports && - !exports.nodeType && exports; - var freeModule = typeof module == 'object' && module && - !module.nodeType && module; - var freeGlobal = typeof global == 'object' && global; - if ( - freeGlobal.global === freeGlobal || - freeGlobal.window === freeGlobal || - freeGlobal.self === freeGlobal - ) { - root = freeGlobal; - } - - /** - * The `punycode` object. - * @name punycode - * @type Object - */ - var punycode, - - /** Highest positive signed 32-bit float value */ - maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 - - /** Bootstring parameters */ - base = 36, - tMin = 1, - tMax = 26, - skew = 38, - damp = 700, - initialBias = 72, - initialN = 128, // 0x80 - delimiter = '-', // '\x2D' - - /** Regular expressions */ - regexPunycode = /^xn--/, - regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars - regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators - - /** Error messages */ - errors = { - 'overflow': 'Overflow: input needs wider integers to process', - 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', - 'invalid-input': 'Invalid input' - }, - - /** Convenience shortcuts */ - baseMinusTMin = base - tMin, - floor = Math.floor, - stringFromCharCode = String.fromCharCode, - - /** Temporary variable */ - key; - - /*--------------------------------------------------------------------------*/ - - /** - * A generic error utility function. - * @private - * @param {String} type The error type. - * @returns {Error} Throws a `RangeError` with the applicable error message. - */ - function error(type) { - throw new RangeError(errors[type]); - } - - /** - * A generic `Array#map` utility function. - * @private - * @param {Array} array The array to iterate over. - * @param {Function} callback The function that gets called for every array - * item. - * @returns {Array} A new array of values returned by the callback function. - */ - function map(array, fn) { - var length = array.length; - var result = []; - while (length--) { - result[length] = fn(array[length]); - } - return result; - } - - /** - * A simple `Array#map`-like wrapper to work with domain name strings or email - * addresses. - * @private - * @param {String} domain The domain name or email address. - * @param {Function} callback The function that gets called for every - * character. - * @returns {Array} A new string of characters returned by the callback - * function. - */ - function mapDomain(string, fn) { - var parts = string.split('@'); - var result = ''; - if (parts.length > 1) { - // In email addresses, only the domain name should be punycoded. Leave - // the local part (i.e. everything up to `@`) intact. - result = parts[0] + '@'; - string = parts[1]; - } - // Avoid `split(regex)` for IE8 compatibility. See #17. - string = string.replace(regexSeparators, '\x2E'); - var labels = string.split('.'); - var encoded = map(labels, fn).join('.'); - return result + encoded; - } - - /** - * Creates an array containing the numeric code points of each Unicode - * character in the string. While JavaScript uses UCS-2 internally, - * this function will convert a pair of surrogate halves (each of which - * UCS-2 exposes as separate characters) into a single code point, - * matching UTF-16. - * @see `punycode.ucs2.encode` - * @see - * @memberOf punycode.ucs2 - * @name decode - * @param {String} string The Unicode input string (UCS-2). - * @returns {Array} The new array of code points. - */ - function ucs2decode(string) { - var output = [], - counter = 0, - length = string.length, - value, - extra; - while (counter < length) { - value = string.charCodeAt(counter++); - if (value >= 0xD800 && value <= 0xDBFF && counter < length) { - // high surrogate, and there is a next character - extra = string.charCodeAt(counter++); - if ((extra & 0xFC00) == 0xDC00) { // low surrogate - output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); - } else { - // unmatched surrogate; only append this code unit, in case the next - // code unit is the high surrogate of a surrogate pair - output.push(value); - counter--; - } - } else { - output.push(value); - } - } - return output; - } - - /** - * Creates a string based on an array of numeric code points. - * @see `punycode.ucs2.decode` - * @memberOf punycode.ucs2 - * @name encode - * @param {Array} codePoints The array of numeric code points. - * @returns {String} The new Unicode string (UCS-2). - */ - function ucs2encode(array) { - return map(array, function(value) { - var output = ''; - if (value > 0xFFFF) { - value -= 0x10000; - output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); - value = 0xDC00 | value & 0x3FF; - } - output += stringFromCharCode(value); - return output; - }).join(''); - } - - /** - * Converts a basic code point into a digit/integer. - * @see `digitToBasic()` - * @private - * @param {Number} codePoint The basic numeric code point value. - * @returns {Number} The numeric value of a basic code point (for use in - * representing integers) in the range `0` to `base - 1`, or `base` if - * the code point does not represent a value. - */ - function basicToDigit(codePoint) { - if (codePoint - 48 < 10) { - return codePoint - 22; - } - if (codePoint - 65 < 26) { - return codePoint - 65; - } - if (codePoint - 97 < 26) { - return codePoint - 97; - } - return base; - } - - /** - * Converts a digit/integer into a basic code point. - * @see `basicToDigit()` - * @private - * @param {Number} digit The numeric value of a basic code point. - * @returns {Number} The basic code point whose value (when used for - * representing integers) is `digit`, which needs to be in the range - * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is - * used; else, the lowercase form is used. The behavior is undefined - * if `flag` is non-zero and `digit` has no uppercase form. - */ - function digitToBasic(digit, flag) { - // 0..25 map to ASCII a..z or A..Z - // 26..35 map to ASCII 0..9 - return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); - } - - /** - * Bias adaptation function as per section 3.4 of RFC 3492. - * https://tools.ietf.org/html/rfc3492#section-3.4 - * @private - */ - function adapt(delta, numPoints, firstTime) { - var k = 0; - delta = firstTime ? floor(delta / damp) : delta >> 1; - delta += floor(delta / numPoints); - for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { - delta = floor(delta / baseMinusTMin); - } - return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); - } - - /** - * Converts a Punycode string of ASCII-only symbols to a string of Unicode - * symbols. - * @memberOf punycode - * @param {String} input The Punycode string of ASCII-only symbols. - * @returns {String} The resulting string of Unicode symbols. - */ - function decode(input) { - // Don't use UCS-2 - var output = [], - inputLength = input.length, - out, - i = 0, - n = initialN, - bias = initialBias, - basic, - j, - index, - oldi, - w, - k, - digit, - t, - /** Cached calculation results */ - baseMinusT; - - // Handle the basic code points: let `basic` be the number of input code - // points before the last delimiter, or `0` if there is none, then copy - // the first basic code points to the output. - - basic = input.lastIndexOf(delimiter); - if (basic < 0) { - basic = 0; - } - - for (j = 0; j < basic; ++j) { - // if it's not a basic code point - if (input.charCodeAt(j) >= 0x80) { - error('not-basic'); - } - output.push(input.charCodeAt(j)); - } - - // Main decoding loop: start just after the last delimiter if any basic code - // points were copied; start at the beginning otherwise. - - for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { - - // `index` is the index of the next character to be consumed. - // Decode a generalized variable-length integer into `delta`, - // which gets added to `i`. The overflow checking is easier - // if we increase `i` as we go, then subtract off its starting - // value at the end to obtain `delta`. - for (oldi = i, w = 1, k = base; /* no condition */; k += base) { - - if (index >= inputLength) { - error('invalid-input'); - } - - digit = basicToDigit(input.charCodeAt(index++)); - - if (digit >= base || digit > floor((maxInt - i) / w)) { - error('overflow'); - } - - i += digit * w; - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - - if (digit < t) { - break; - } - - baseMinusT = base - t; - if (w > floor(maxInt / baseMinusT)) { - error('overflow'); - } - - w *= baseMinusT; - - } - - out = output.length + 1; - bias = adapt(i - oldi, out, oldi == 0); - - // `i` was supposed to wrap around from `out` to `0`, - // incrementing `n` each time, so we'll fix that now: - if (floor(i / out) > maxInt - n) { - error('overflow'); - } - - n += floor(i / out); - i %= out; - - // Insert `n` at position `i` of the output - output.splice(i++, 0, n); - - } - - return ucs2encode(output); - } - - /** - * Converts a string of Unicode symbols (e.g. a domain name label) to a - * Punycode string of ASCII-only symbols. - * @memberOf punycode - * @param {String} input The string of Unicode symbols. - * @returns {String} The resulting Punycode string of ASCII-only symbols. - */ - function encode(input) { - var n, - delta, - handledCPCount, - basicLength, - bias, - j, - m, - q, - k, - t, - currentValue, - output = [], - /** `inputLength` will hold the number of code points in `input`. */ - inputLength, - /** Cached calculation results */ - handledCPCountPlusOne, - baseMinusT, - qMinusT; - - // Convert the input in UCS-2 to Unicode - input = ucs2decode(input); - - // Cache the length - inputLength = input.length; - - // Initialize the state - n = initialN; - delta = 0; - bias = initialBias; - - // Handle the basic code points - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue < 0x80) { - output.push(stringFromCharCode(currentValue)); - } - } - - handledCPCount = basicLength = output.length; - - // `handledCPCount` is the number of code points that have been handled; - // `basicLength` is the number of basic code points. - - // Finish the basic string - if it is not empty - with a delimiter - if (basicLength) { - output.push(delimiter); - } - - // Main encoding loop: - while (handledCPCount < inputLength) { - - // All non-basic code points < n have been handled already. Find the next - // larger one: - for (m = maxInt, j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue >= n && currentValue < m) { - m = currentValue; - } - } - - // Increase `delta` enough to advance the decoder's state to , - // but guard against overflow - handledCPCountPlusOne = handledCPCount + 1; - if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { - error('overflow'); - } - - delta += (m - n) * handledCPCountPlusOne; - n = m; - - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - - if (currentValue < n && ++delta > maxInt) { - error('overflow'); - } - - if (currentValue == n) { - // Represent delta as a generalized variable-length integer - for (q = delta, k = base; /* no condition */; k += base) { - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - if (q < t) { - break; - } - qMinusT = q - t; - baseMinusT = base - t; - output.push( - stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) - ); - q = floor(qMinusT / baseMinusT); - } - - output.push(stringFromCharCode(digitToBasic(q, 0))); - bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); - delta = 0; - ++handledCPCount; - } - } - - ++delta; - ++n; - - } - return output.join(''); - } - - /** - * Converts a Punycode string representing a domain name or an email address - * to Unicode. Only the Punycoded parts of the input will be converted, i.e. - * it doesn't matter if you call it on a string that has already been - * converted to Unicode. - * @memberOf punycode - * @param {String} input The Punycoded domain name or email address to - * convert to Unicode. - * @returns {String} The Unicode representation of the given Punycode - * string. - */ - function toUnicode(input) { - return mapDomain(input, function(string) { - return regexPunycode.test(string) - ? decode(string.slice(4).toLowerCase()) - : string; - }); - } - - /** - * Converts a Unicode string representing a domain name or an email address to - * Punycode. Only the non-ASCII parts of the domain name will be converted, - * i.e. it doesn't matter if you call it with a domain that's already in - * ASCII. - * @memberOf punycode - * @param {String} input The domain name or email address to convert, as a - * Unicode string. - * @returns {String} The Punycode representation of the given domain name or - * email address. - */ - function toASCII(input) { - return mapDomain(input, function(string) { - return regexNonASCII.test(string) - ? 'xn--' + encode(string) - : string; - }); - } - - /*--------------------------------------------------------------------------*/ - - /** Define the public API */ - punycode = { - /** - * A string representing the current Punycode.js version number. - * @memberOf punycode - * @type String - */ - 'version': '1.4.1', - /** - * An object of methods to convert from JavaScript's internal character - * representation (UCS-2) to Unicode code points, and back. - * @see - * @memberOf punycode - * @type Object - */ - 'ucs2': { - 'decode': ucs2decode, - 'encode': ucs2encode - }, - 'decode': decode, - 'encode': encode, - 'toASCII': toASCII, - 'toUnicode': toUnicode - }; - - /** Expose `punycode` */ - // Some AMD build optimizers, like r.js, check for specific condition patterns - // like the following: - if ( - typeof define == 'function' && - typeof define.amd == 'object' && - define.amd - ) { - define('punycode', function() { - return punycode; - }); - } else if (freeExports && freeModule) { - if (module.exports == freeExports) { - // in Node.js, io.js, or RingoJS v0.8.0+ - freeModule.exports = punycode; - } else { - // in Narwhal or RingoJS v0.7.0- - for (key in punycode) { - punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); - } - } - } else { - // in Rhino or a web browser - root.punycode = punycode; - } - -}(this)); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],135:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -'use strict'; - -// If obj.hasOwnProperty has been overridden, then calling -// obj.hasOwnProperty(prop) will break. -// See: https://github.com/joyent/node/issues/1707 -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} - -module.exports = function(qs, sep, eq, options) { - sep = sep || '&'; - eq = eq || '='; - var obj = {}; - - if (typeof qs !== 'string' || qs.length === 0) { - return obj; - } - - var regexp = /\+/g; - qs = qs.split(sep); - - var maxKeys = 1000; - if (options && typeof options.maxKeys === 'number') { - maxKeys = options.maxKeys; - } - - var len = qs.length; - // maxKeys <= 0 means that we should not limit keys count - if (maxKeys > 0 && len > maxKeys) { - len = maxKeys; - } - - for (var i = 0; i < len; ++i) { - var x = qs[i].replace(regexp, '%20'), - idx = x.indexOf(eq), - kstr, vstr, k, v; - - if (idx >= 0) { - kstr = x.substr(0, idx); - vstr = x.substr(idx + 1); - } else { - kstr = x; - vstr = ''; - } - - k = decodeURIComponent(kstr); - v = decodeURIComponent(vstr); - - if (!hasOwnProperty(obj, k)) { - obj[k] = v; - } else if (isArray(obj[k])) { - obj[k].push(v); - } else { - obj[k] = [obj[k], v]; - } - } - - return obj; -}; - -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; - -},{}],136:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -'use strict'; - -var stringifyPrimitive = function(v) { - switch (typeof v) { - case 'string': - return v; - - case 'boolean': - return v ? 'true' : 'false'; - - case 'number': - return isFinite(v) ? v : ''; - - default: - return ''; - } -}; - -module.exports = function(obj, sep, eq, name) { - sep = sep || '&'; - eq = eq || '='; - if (obj === null) { - obj = undefined; - } - - if (typeof obj === 'object') { - return map(objectKeys(obj), function(k) { - var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; - if (isArray(obj[k])) { - return map(obj[k], function(v) { - return ks + encodeURIComponent(stringifyPrimitive(v)); - }).join(sep); - } else { - return ks + encodeURIComponent(stringifyPrimitive(obj[k])); - } - }).join(sep); - - } - - if (!name) return ''; - return encodeURIComponent(stringifyPrimitive(name)) + eq + - encodeURIComponent(stringifyPrimitive(obj)); -}; - -var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; -}; - -function map (xs, f) { - if (xs.map) return xs.map(f); - var res = []; - for (var i = 0; i < xs.length; i++) { - res.push(f(xs[i], i)); - } - return res; -} - -var objectKeys = Object.keys || function (obj) { - var res = []; - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); - } - return res; -}; - -},{}],137:[function(require,module,exports){ -'use strict'; - -exports.decode = exports.parse = require('./decode'); -exports.encode = exports.stringify = require('./encode'); - -},{"./decode":135,"./encode":136}],138:[function(require,module,exports){ -module.exports = require('./lib/_stream_duplex.js'); - -},{"./lib/_stream_duplex.js":139}],139:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototypal inheritance, this class -// prototypally inherits from Readable, and then parasitically from -// Writable. - -'use strict'; - -/**/ - -var pna = require('process-nextick-args'); -/**/ - -/**/ -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - keys.push(key); - }return keys; -}; -/**/ - -module.exports = Duplex; - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -var Readable = require('./_stream_readable'); -var Writable = require('./_stream_writable'); - -util.inherits(Duplex, Readable); - -{ - // avoid scope creep, the keys array can then be collected - var keys = objectKeys(Writable.prototype); - for (var v = 0; v < keys.length; v++) { - var method = keys[v]; - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; - } -} - -function Duplex(options) { - if (!(this instanceof Duplex)) return new Duplex(options); - - Readable.call(this, options); - Writable.call(this, options); - - if (options && options.readable === false) this.readable = false; - - if (options && options.writable === false) this.writable = false; - - this.allowHalfOpen = true; - if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; - - this.once('end', onend); -} - -Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function () { - return this._writableState.highWaterMark; - } -}); - -// the no-half-open enforcer -function onend() { - // if we allow half-open state, or if the writable side ended, - // then we're ok. - if (this.allowHalfOpen || this._writableState.ended) return; - - // no more data can be written. - // But allow more writes to happen in this tick. - pna.nextTick(onEndNT, this); -} - -function onEndNT(self) { - self.end(); -} - -Object.defineProperty(Duplex.prototype, 'destroyed', { - get: function () { - if (this._readableState === undefined || this._writableState === undefined) { - return false; - } - return this._readableState.destroyed && this._writableState.destroyed; - }, - set: function (value) { - // we ignore the value if the stream - // has not been initialized yet - if (this._readableState === undefined || this._writableState === undefined) { - return; - } - - // backward compatibility, the user is explicitly - // managing destroyed - this._readableState.destroyed = value; - this._writableState.destroyed = value; - } -}); - -Duplex.prototype._destroy = function (err, cb) { - this.push(null); - this.end(); - - pna.nextTick(cb, err); -}; -},{"./_stream_readable":141,"./_stream_writable":143,"core-util-is":51,"inherits":75,"process-nextick-args":132}],140:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// a passthrough stream. -// basically just the most minimal sort of Transform stream. -// Every written chunk gets output as-is. - -'use strict'; - -module.exports = PassThrough; - -var Transform = require('./_stream_transform'); - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -util.inherits(PassThrough, Transform); - -function PassThrough(options) { - if (!(this instanceof PassThrough)) return new PassThrough(options); - - Transform.call(this, options); -} - -PassThrough.prototype._transform = function (chunk, encoding, cb) { - cb(null, chunk); -}; -},{"./_stream_transform":142,"core-util-is":51,"inherits":75}],141:[function(require,module,exports){ -(function (process,global){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -'use strict'; - -/**/ - -var pna = require('process-nextick-args'); -/**/ - -module.exports = Readable; - -/**/ -var isArray = require('isarray'); -/**/ - -/**/ -var Duplex; -/**/ - -Readable.ReadableState = ReadableState; - -/**/ -var EE = require('events').EventEmitter; - -var EElistenerCount = function (emitter, type) { - return emitter.listeners(type).length; -}; -/**/ - -/**/ -var Stream = require('./internal/streams/stream'); -/**/ - -/**/ - -var Buffer = require('safe-buffer').Buffer; -var OurUint8Array = global.Uint8Array || function () {}; -function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); -} -function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; -} - -/**/ - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -/**/ -var debugUtil = require('util'); -var debug = void 0; -if (debugUtil && debugUtil.debuglog) { - debug = debugUtil.debuglog('stream'); -} else { - debug = function () {}; -} -/**/ - -var BufferList = require('./internal/streams/BufferList'); -var destroyImpl = require('./internal/streams/destroy'); -var StringDecoder; - -util.inherits(Readable, Stream); - -var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; - -function prependListener(emitter, event, fn) { - // Sadly this is not cacheable as some libraries bundle their own - // event emitter implementation with them. - if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); - - // This is a hack to make sure that our error handler is attached before any - // userland ones. NEVER DO THIS. This is here only because this code needs - // to continue to work with older versions of Node.js that do not include - // the prependListener() method. The goal is to eventually remove this hack. - if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; -} - -function ReadableState(options, stream) { - Duplex = Duplex || require('./_stream_duplex'); - - options = options || {}; - - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. - var isDuplex = stream instanceof Duplex; - - // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - this.objectMode = !!options.objectMode; - - if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; - - // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - var hwm = options.highWaterMark; - var readableHwm = options.readableHighWaterMark; - var defaultHwm = this.objectMode ? 16 : 16 * 1024; - - if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm; - - // cast to ints. - this.highWaterMark = Math.floor(this.highWaterMark); - - // A linked list is used to store data chunks instead of an array because the - // linked list can remove elements from the beginning faster than - // array.shift() - this.buffer = new BufferList(); - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; - - // a flag to be able to tell if the event 'readable'/'data' is emitted - // immediately, or on a later tick. We set this to true at first, because - // any actions that shouldn't happen until "later" should generally also - // not happen before the first read call. - this.sync = true; - - // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - this.resumeScheduled = false; - - // has it been destroyed - this.destroyed = false; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // the number of writers that are awaiting a drain event in .pipe()s - this.awaitDrain = 0; - - // if true, a maybeReadMore has been scheduled - this.readingMore = false; - - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } -} - -function Readable(options) { - Duplex = Duplex || require('./_stream_duplex'); - - if (!(this instanceof Readable)) return new Readable(options); - - this._readableState = new ReadableState(options, this); - - // legacy - this.readable = true; - - if (options) { - if (typeof options.read === 'function') this._read = options.read; - - if (typeof options.destroy === 'function') this._destroy = options.destroy; - } - - Stream.call(this); -} - -Object.defineProperty(Readable.prototype, 'destroyed', { - get: function () { - if (this._readableState === undefined) { - return false; - } - return this._readableState.destroyed; - }, - set: function (value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._readableState) { - return; - } - - // backward compatibility, the user is explicitly - // managing destroyed - this._readableState.destroyed = value; - } -}); - -Readable.prototype.destroy = destroyImpl.destroy; -Readable.prototype._undestroy = destroyImpl.undestroy; -Readable.prototype._destroy = function (err, cb) { - this.push(null); - cb(err); -}; - -// Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. -Readable.prototype.push = function (chunk, encoding) { - var state = this._readableState; - var skipChunkCheck; - - if (!state.objectMode) { - if (typeof chunk === 'string') { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = Buffer.from(chunk, encoding); - encoding = ''; - } - skipChunkCheck = true; - } - } else { - skipChunkCheck = true; - } - - return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); -}; - -// Unshift should *always* be something directly out of read() -Readable.prototype.unshift = function (chunk) { - return readableAddChunk(this, chunk, null, true, false); -}; - -function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { - var state = stream._readableState; - if (chunk === null) { - state.reading = false; - onEofChunk(stream, state); - } else { - var er; - if (!skipChunkCheck) er = chunkInvalid(state, chunk); - if (er) { - stream.emit('error', er); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { - chunk = _uint8ArrayToBuffer(chunk); - } - - if (addToFront) { - if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true); - } else if (state.ended) { - stream.emit('error', new Error('stream.push() after EOF')); - } else { - state.reading = false; - if (state.decoder && !encoding) { - chunk = state.decoder.write(chunk); - if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); - } else { - addChunk(stream, state, chunk, false); - } - } - } else if (!addToFront) { - state.reading = false; - } - } - - return needMoreData(state); -} - -function addChunk(stream, state, chunk, addToFront) { - if (state.flowing && state.length === 0 && !state.sync) { - stream.emit('data', chunk); - stream.read(0); - } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); - - if (state.needReadable) emitReadable(stream); - } - maybeReadMore(stream, state); -} - -function chunkInvalid(state, chunk) { - var er; - if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { - er = new TypeError('Invalid non-string/buffer chunk'); - } - return er; -} - -// if it's past the high water mark, we can push in some more. -// Also, if we have no data yet, we can stand some -// more bytes. This is to work around cases where hwm=0, -// such as the repl. Also, if the push() triggered a -// readable event, and the user called read(largeNumber) such that -// needReadable was set, then we ought to push more, so that another -// 'readable' event will be triggered. -function needMoreData(state) { - return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); -} - -Readable.prototype.isPaused = function () { - return this._readableState.flowing === false; -}; - -// backwards compatibility. -Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this._readableState.decoder = new StringDecoder(enc); - this._readableState.encoding = enc; - return this; -}; - -// Don't raise the hwm > 8MB -var MAX_HWM = 0x800000; -function computeNewHighWaterMark(n) { - if (n >= MAX_HWM) { - n = MAX_HWM; - } else { - // Get the next highest power of 2 to prevent increasing hwm excessively in - // tiny amounts - n--; - n |= n >>> 1; - n |= n >>> 2; - n |= n >>> 4; - n |= n >>> 8; - n |= n >>> 16; - n++; - } - return n; -} - -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function howMuchToRead(n, state) { - if (n <= 0 || state.length === 0 && state.ended) return 0; - if (state.objectMode) return 1; - if (n !== n) { - // Only flow one buffer at a time - if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; - } - // If we're asking for more than the current hwm, then raise the hwm. - if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); - if (n <= state.length) return n; - // Don't have enough - if (!state.ended) { - state.needReadable = true; - return 0; - } - return state.length; -} - -// you can override either this method, or the async _read(n) below. -Readable.prototype.read = function (n) { - debug('read', n); - n = parseInt(n, 10); - var state = this._readableState; - var nOrig = n; - - if (n !== 0) state.emittedReadable = false; - - // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); - return null; - } - - n = howMuchToRead(n, state); - - // if we've ended, and we're now clear, then finish it up. - if (n === 0 && state.ended) { - if (state.length === 0) endReadable(this); - return null; - } - - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - - // if we need a readable event, then we need to do some reading. - var doRead = state.needReadable; - debug('need readable', doRead); - - // if we currently have less than the highWaterMark, then also read some - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug('length less than watermark', doRead); - } - - // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - if (state.ended || state.reading) { - doRead = false; - debug('reading or ended', doRead); - } else if (doRead) { - debug('do read'); - state.reading = true; - state.sync = true; - // if the length is currently zero, then we *need* a readable event. - if (state.length === 0) state.needReadable = true; - // call internal read method - this._read(state.highWaterMark); - state.sync = false; - // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - if (!state.reading) n = howMuchToRead(nOrig, state); - } - - var ret; - if (n > 0) ret = fromList(n, state);else ret = null; - - if (ret === null) { - state.needReadable = true; - n = 0; - } else { - state.length -= n; - } - - if (state.length === 0) { - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (!state.ended) state.needReadable = true; - - // If we tried to read() past the EOF, then emit end on the next tick. - if (nOrig !== n && state.ended) endReadable(this); - } - - if (ret !== null) this.emit('data', ret); - - return ret; -}; - -function onEofChunk(stream, state) { - if (state.ended) return; - if (state.decoder) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - state.ended = true; - - // emit 'readable' now to make sure it gets picked up. - emitReadable(stream); -} - -// Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. -function emitReadable(stream) { - var state = stream._readableState; - state.needReadable = false; - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream); - } -} - -function emitReadable_(stream) { - debug('emit readable'); - stream.emit('readable'); - flow(stream); -} - -// at this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. -function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - pna.nextTick(maybeReadMore_, stream, state); - } -} - -function maybeReadMore_(stream, state) { - var len = state.length; - while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { - debug('maybeReadMore read 0'); - stream.read(0); - if (len === state.length) - // didn't get any data, stop spinning. - break;else len = state.length; - } - state.readingMore = false; -} - -// abstract method. to be overridden in specific implementation classes. -// call cb(er, data) where data is <= n in length. -// for virtual (non-string, non-buffer) streams, "length" is somewhat -// arbitrary, and perhaps not very meaningful. -Readable.prototype._read = function (n) { - this.emit('error', new Error('_read() is not implemented')); -}; - -Readable.prototype.pipe = function (dest, pipeOpts) { - var src = this; - var state = this._readableState; - - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [state.pipes, dest]; - break; - default: - state.pipes.push(dest); - break; - } - state.pipesCount += 1; - debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); - - var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; - - var endFn = doEnd ? onend : unpipe; - if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn); - - dest.on('unpipe', onunpipe); - function onunpipe(readable, unpipeInfo) { - debug('onunpipe'); - if (readable === src) { - if (unpipeInfo && unpipeInfo.hasUnpiped === false) { - unpipeInfo.hasUnpiped = true; - cleanup(); - } - } - } - - function onend() { - debug('onend'); - dest.end(); - } - - // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); - - var cleanedUp = false; - function cleanup() { - debug('cleanup'); - // cleanup event handlers once the pipe is broken - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', unpipe); - src.removeListener('data', ondata); - - cleanedUp = true; - - // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); - } - - // If the user pushes more data while we're writing to dest then we'll end up - // in ondata again. However, we only want to increase awaitDrain once because - // dest will only emit one 'drain' event for the multiple writes. - // => Introduce a guard on increasing awaitDrain. - var increasedAwaitDrain = false; - src.on('data', ondata); - function ondata(chunk) { - debug('ondata'); - increasedAwaitDrain = false; - var ret = dest.write(chunk); - if (false === ret && !increasedAwaitDrain) { - // If the user unpiped during `dest.write()`, it is possible - // to get stuck in a permanently paused state if that write - // also returned false. - // => Check whether `dest` is still a piping destination. - if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { - debug('false write response, pause', src._readableState.awaitDrain); - src._readableState.awaitDrain++; - increasedAwaitDrain = true; - } - src.pause(); - } - } - - // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - function onerror(er) { - debug('onerror', er); - unpipe(); - dest.removeListener('error', onerror); - if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); - } - - // Make sure our error handler is attached before userland ones. - prependListener(dest, 'error', onerror); - - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - dest.once('close', onclose); - function onfinish() { - debug('onfinish'); - dest.removeListener('close', onclose); - unpipe(); - } - dest.once('finish', onfinish); - - function unpipe() { - debug('unpipe'); - src.unpipe(dest); - } - - // tell the dest that it's being piped to - dest.emit('pipe', src); - - // start the flow if it hasn't been started already. - if (!state.flowing) { - debug('pipe resume'); - src.resume(); - } - - return dest; -}; - -function pipeOnDrain(src) { - return function () { - var state = src._readableState; - debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) state.awaitDrain--; - if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { - state.flowing = true; - flow(src); - } - }; -} - -Readable.prototype.unpipe = function (dest) { - var state = this._readableState; - var unpipeInfo = { hasUnpiped: false }; - - // if we're not piping anywhere, then do nothing. - if (state.pipesCount === 0) return this; - - // just one destination. most common case. - if (state.pipesCount === 1) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) return this; - - if (!dest) dest = state.pipes; - - // got a match. - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) dest.emit('unpipe', this, unpipeInfo); - return this; - } - - // slow case. multiple pipe destinations. - - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - - for (var i = 0; i < len; i++) { - dests[i].emit('unpipe', this, unpipeInfo); - }return this; - } - - // try to find the right one. - var index = indexOf(state.pipes, dest); - if (index === -1) return this; - - state.pipes.splice(index, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) state.pipes = state.pipes[0]; - - dest.emit('unpipe', this, unpipeInfo); - - return this; -}; - -// set up data events if they are asked for -// Ensure readable listeners eventually get something -Readable.prototype.on = function (ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - - if (ev === 'data') { - // Start flowing on next tick if stream isn't explicitly paused - if (this._readableState.flowing !== false) this.resume(); - } else if (ev === 'readable') { - var state = this._readableState; - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true; - state.emittedReadable = false; - if (!state.reading) { - pna.nextTick(nReadingNextTick, this); - } else if (state.length) { - emitReadable(this); - } - } - } - - return res; -}; -Readable.prototype.addListener = Readable.prototype.on; - -function nReadingNextTick(self) { - debug('readable nexttick read 0'); - self.read(0); -} - -// pause() and resume() are remnants of the legacy readable stream API -// If the user uses them, then switch into old mode. -Readable.prototype.resume = function () { - var state = this._readableState; - if (!state.flowing) { - debug('resume'); - state.flowing = true; - resume(this, state); - } - return this; -}; - -function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - pna.nextTick(resume_, stream, state); - } -} - -function resume_(stream, state) { - if (!state.reading) { - debug('resume read 0'); - stream.read(0); - } - - state.resumeScheduled = false; - state.awaitDrain = 0; - stream.emit('resume'); - flow(stream); - if (state.flowing && !state.reading) stream.read(0); -} - -Readable.prototype.pause = function () { - debug('call pause flowing=%j', this._readableState.flowing); - if (false !== this._readableState.flowing) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); - } - return this; -}; - -function flow(stream) { - var state = stream._readableState; - debug('flow', state.flowing); - while (state.flowing && stream.read() !== null) {} -} - -// wrap an old-style stream as the async data source. -// This is *not* part of the readable stream interface. -// It is an ugly unfortunate mess of history. -Readable.prototype.wrap = function (stream) { - var _this = this; - - var state = this._readableState; - var paused = false; - - stream.on('end', function () { - debug('wrapped end'); - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) _this.push(chunk); - } - - _this.push(null); - }); - - stream.on('data', function (chunk) { - debug('wrapped data'); - if (state.decoder) chunk = state.decoder.write(chunk); - - // don't skip over falsy values in objectMode - if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; - - var ret = _this.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); - - // proxy all the other methods. - // important when wrapping filters and duplexes. - for (var i in stream) { - if (this[i] === undefined && typeof stream[i] === 'function') { - this[i] = function (method) { - return function () { - return stream[method].apply(stream, arguments); - }; - }(i); - } - } - - // proxy certain important events. - for (var n = 0; n < kProxyEvents.length; n++) { - stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); - } - - // when we try to consume some more bytes, simply unpause the - // underlying stream. - this._read = function (n) { - debug('wrapped _read', n); - if (paused) { - paused = false; - stream.resume(); - } - }; - - return this; -}; - -Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function () { - return this._readableState.highWaterMark; - } -}); - -// exposed for testing purposes only. -Readable._fromList = fromList; - -// Pluck off n bytes from an array of buffers. -// Length is the combined lengths of all the buffers in the list. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function fromList(n, state) { - // nothing buffered - if (state.length === 0) return null; - - var ret; - if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { - // read it all, truncate the list - if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length); - state.buffer.clear(); - } else { - // read part of list - ret = fromListPartial(n, state.buffer, state.decoder); - } - - return ret; -} - -// Extracts only enough buffered data to satisfy the amount requested. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function fromListPartial(n, list, hasStrings) { - var ret; - if (n < list.head.data.length) { - // slice is the same for buffers and strings - ret = list.head.data.slice(0, n); - list.head.data = list.head.data.slice(n); - } else if (n === list.head.data.length) { - // first chunk is a perfect match - ret = list.shift(); - } else { - // result spans more than one buffer - ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); - } - return ret; -} - -// Copies a specified amount of characters from the list of buffered data -// chunks. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function copyFromBufferString(n, list) { - var p = list.head; - var c = 1; - var ret = p.data; - n -= ret.length; - while (p = p.next) { - var str = p.data; - var nb = n > str.length ? str.length : n; - if (nb === str.length) ret += str;else ret += str.slice(0, n); - n -= nb; - if (n === 0) { - if (nb === str.length) { - ++c; - if (p.next) list.head = p.next;else list.head = list.tail = null; - } else { - list.head = p; - p.data = str.slice(nb); - } - break; - } - ++c; - } - list.length -= c; - return ret; -} - -// Copies a specified amount of bytes from the list of buffered data chunks. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function copyFromBuffer(n, list) { - var ret = Buffer.allocUnsafe(n); - var p = list.head; - var c = 1; - p.data.copy(ret); - n -= p.data.length; - while (p = p.next) { - var buf = p.data; - var nb = n > buf.length ? buf.length : n; - buf.copy(ret, ret.length - n, 0, nb); - n -= nb; - if (n === 0) { - if (nb === buf.length) { - ++c; - if (p.next) list.head = p.next;else list.head = list.tail = null; - } else { - list.head = p; - p.data = buf.slice(nb); - } - break; - } - ++c; - } - list.length -= c; - return ret; -} - -function endReadable(stream) { - var state = stream._readableState; - - // If we get here before consuming all the bytes, then that is a - // bug in node. Should never happen. - if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); - - if (!state.endEmitted) { - state.ended = true; - pna.nextTick(endReadableNT, state, stream); - } -} - -function endReadableNT(state, stream) { - // Check that we didn't get one last unshift. - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - } -} - -function indexOf(xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) return i; - } - return -1; -} -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./_stream_duplex":139,"./internal/streams/BufferList":144,"./internal/streams/destroy":145,"./internal/streams/stream":146,"_process":133,"core-util-is":51,"events":52,"inherits":75,"isarray":79,"process-nextick-args":132,"safe-buffer":147,"string_decoder/":148,"util":33}],142:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// a transform stream is a readable/writable stream where you do -// something with the data. Sometimes it's called a "filter", -// but that's not a great name for it, since that implies a thing where -// some bits pass through, and others are simply ignored. (That would -// be a valid example of a transform, of course.) -// -// While the output is causally related to the input, it's not a -// necessarily symmetric or synchronous transformation. For example, -// a zlib stream might take multiple plain-text writes(), and then -// emit a single compressed chunk some time in the future. -// -// Here's how this works: -// -// The Transform stream has all the aspects of the readable and writable -// stream classes. When you write(chunk), that calls _write(chunk,cb) -// internally, and returns false if there's a lot of pending writes -// buffered up. When you call read(), that calls _read(n) until -// there's enough pending readable data buffered up. -// -// In a transform stream, the written data is placed in a buffer. When -// _read(n) is called, it transforms the queued up data, calling the -// buffered _write cb's as it consumes chunks. If consuming a single -// written chunk would result in multiple output chunks, then the first -// outputted bit calls the readcb, and subsequent chunks just go into -// the read buffer, and will cause it to emit 'readable' if necessary. -// -// This way, back-pressure is actually determined by the reading side, -// since _read has to be called to start processing a new chunk. However, -// a pathological inflate type of transform can cause excessive buffering -// here. For example, imagine a stream where every byte of input is -// interpreted as an integer from 0-255, and then results in that many -// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in -// 1kb of data being output. In this case, you could write a very small -// amount of input, and end up with a very large amount of output. In -// such a pathological inflating mechanism, there'd be no way to tell -// the system to stop doing the transform. A single 4MB write could -// cause the system to run out of memory. -// -// However, even in such a pathological case, only a single written chunk -// would be consumed, and then the rest would wait (un-transformed) until -// the results of the previous transformed chunk were consumed. - -'use strict'; - -module.exports = Transform; - -var Duplex = require('./_stream_duplex'); - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -util.inherits(Transform, Duplex); - -function afterTransform(er, data) { - var ts = this._transformState; - ts.transforming = false; - - var cb = ts.writecb; - - if (!cb) { - return this.emit('error', new Error('write callback called multiple times')); - } - - ts.writechunk = null; - ts.writecb = null; - - if (data != null) // single equals check for both `null` and `undefined` - this.push(data); - - cb(er); - - var rs = this._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - this._read(rs.highWaterMark); - } -} - -function Transform(options) { - if (!(this instanceof Transform)) return new Transform(options); - - Duplex.call(this, options); - - this._transformState = { - afterTransform: afterTransform.bind(this), - needTransform: false, - transforming: false, - writecb: null, - writechunk: null, - writeencoding: null - }; - - // start out asking for a readable event once data is transformed. - this._readableState.needReadable = true; - - // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false; - - if (options) { - if (typeof options.transform === 'function') this._transform = options.transform; - - if (typeof options.flush === 'function') this._flush = options.flush; - } - - // When the writable side finishes, then flush out anything remaining. - this.on('prefinish', prefinish); -} - -function prefinish() { - var _this = this; - - if (typeof this._flush === 'function') { - this._flush(function (er, data) { - done(_this, er, data); - }); - } else { - done(this, null, null); - } -} - -Transform.prototype.push = function (chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); -}; - -// This is the part where you do stuff! -// override this function in implementation classes. -// 'chunk' is an input chunk. -// -// Call `push(newChunk)` to pass along transformed output -// to the readable side. You may call 'push' zero or more times. -// -// Call `cb(err)` when you are done with this chunk. If you pass -// an error, then that'll put the hurt on the whole operation. If you -// never call cb(), then you'll never get another chunk. -Transform.prototype._transform = function (chunk, encoding, cb) { - throw new Error('_transform() is not implemented'); -}; - -Transform.prototype._write = function (chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); - } -}; - -// Doesn't matter what the args are here. -// _transform does all the work. -// That we got here means that the readable side wants more data. -Transform.prototype._read = function (n) { - var ts = this._transformState; - - if (ts.writechunk !== null && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - } -}; - -Transform.prototype._destroy = function (err, cb) { - var _this2 = this; - - Duplex.prototype._destroy.call(this, err, function (err2) { - cb(err2); - _this2.emit('close'); - }); -}; - -function done(stream, er, data) { - if (er) return stream.emit('error', er); - - if (data != null) // single equals check for both `null` and `undefined` - stream.push(data); - - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0'); - - if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming'); - - return stream.push(null); -} -},{"./_stream_duplex":139,"core-util-is":51,"inherits":75}],143:[function(require,module,exports){ -(function (process,global,setImmediate){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// A bit simpler than readable streams. -// Implement an async ._write(chunk, encoding, cb), and it'll handle all -// the drain event emission and buffering. - -'use strict'; - -/**/ - -var pna = require('process-nextick-args'); -/**/ - -module.exports = Writable; - -/* */ -function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; - this.next = null; -} - -// It seems a linked list but it is not -// there will be only 2 of these for each stream -function CorkedRequest(state) { - var _this = this; - - this.next = null; - this.entry = null; - this.finish = function () { - onCorkedFinish(_this, state); - }; -} -/* */ - -/**/ -var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick; -/**/ - -/**/ -var Duplex; -/**/ - -Writable.WritableState = WritableState; - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -/**/ -var internalUtil = { - deprecate: require('util-deprecate') -}; -/**/ - -/**/ -var Stream = require('./internal/streams/stream'); -/**/ - -/**/ - -var Buffer = require('safe-buffer').Buffer; -var OurUint8Array = global.Uint8Array || function () {}; -function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); -} -function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; -} - -/**/ - -var destroyImpl = require('./internal/streams/destroy'); - -util.inherits(Writable, Stream); - -function nop() {} - -function WritableState(options, stream) { - Duplex = Duplex || require('./_stream_duplex'); - - options = options || {}; - - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. - var isDuplex = stream instanceof Duplex; - - // object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!options.objectMode; - - if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; - - // the point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write() - var hwm = options.highWaterMark; - var writableHwm = options.writableHighWaterMark; - var defaultHwm = this.objectMode ? 16 : 16 * 1024; - - if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm; - - // cast to ints. - this.highWaterMark = Math.floor(this.highWaterMark); - - // if _final has been called - this.finalCalled = false; - - // drain event flag. - this.needDrain = false; - // at the start of calling end() - this.ending = false; - // when end() has been called, and returned - this.ended = false; - // when 'finish' is emitted - this.finished = false; - - // has it been destroyed - this.destroyed = false; - - // should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - this.length = 0; - - // a flag to see when we're in the middle of a write. - this.writing = false; - - // when true all writes will be buffered until .uncork() call - this.corked = 0; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // a flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - this.bufferProcessing = false; - - // the callback that's passed to _write(chunk,cb) - this.onwrite = function (er) { - onwrite(stream, er); - }; - - // the callback that the user supplies to write(chunk,encoding,cb) - this.writecb = null; - - // the amount that is being written when _write is called. - this.writelen = 0; - - this.bufferedRequest = null; - this.lastBufferedRequest = null; - - // number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted - this.pendingcb = 0; - - // emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams - this.prefinished = false; - - // True if the error was already emitted and should not be thrown again - this.errorEmitted = false; - - // count buffered requests - this.bufferedRequestCount = 0; - - // allocate the first CorkedRequest, there is always - // one allocated and free to use, and we maintain at most two - this.corkedRequestsFree = new CorkedRequest(this); -} - -WritableState.prototype.getBuffer = function getBuffer() { - var current = this.bufferedRequest; - var out = []; - while (current) { - out.push(current); - current = current.next; - } - return out; -}; - -(function () { - try { - Object.defineProperty(WritableState.prototype, 'buffer', { - get: internalUtil.deprecate(function () { - return this.getBuffer(); - }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') - }); - } catch (_) {} -})(); - -// Test _writableState for inheritance to account for Duplex streams, -// whose prototype chain only points to Readable. -var realHasInstance; -if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { - realHasInstance = Function.prototype[Symbol.hasInstance]; - Object.defineProperty(Writable, Symbol.hasInstance, { - value: function (object) { - if (realHasInstance.call(this, object)) return true; - if (this !== Writable) return false; - - return object && object._writableState instanceof WritableState; - } - }); -} else { - realHasInstance = function (object) { - return object instanceof this; - }; -} - -function Writable(options) { - Duplex = Duplex || require('./_stream_duplex'); - - // Writable ctor is applied to Duplexes, too. - // `realHasInstance` is necessary because using plain `instanceof` - // would return false, as no `_writableState` property is attached. - - // Trying to use the custom `instanceof` for Writable here will also break the - // Node.js LazyTransform implementation, which has a non-trivial getter for - // `_writableState` that would lead to infinite recursion. - if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) { - return new Writable(options); - } - - this._writableState = new WritableState(options, this); - - // legacy. - this.writable = true; - - if (options) { - if (typeof options.write === 'function') this._write = options.write; - - if (typeof options.writev === 'function') this._writev = options.writev; - - if (typeof options.destroy === 'function') this._destroy = options.destroy; - - if (typeof options.final === 'function') this._final = options.final; - } - - Stream.call(this); -} - -// Otherwise people can pipe Writable streams, which is just wrong. -Writable.prototype.pipe = function () { - this.emit('error', new Error('Cannot pipe, not readable')); -}; - -function writeAfterEnd(stream, cb) { - var er = new Error('write after end'); - // TODO: defer error events consistently everywhere, not just the cb - stream.emit('error', er); - pna.nextTick(cb, er); -} - -// Checks that a user-supplied chunk is valid, especially for the particular -// mode the stream is in. Currently this means that `null` is never accepted -// and undefined/non-string values are only allowed in object mode. -function validChunk(stream, state, chunk, cb) { - var valid = true; - var er = false; - - if (chunk === null) { - er = new TypeError('May not write null values to stream'); - } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { - er = new TypeError('Invalid non-string/buffer chunk'); - } - if (er) { - stream.emit('error', er); - pna.nextTick(cb, er); - valid = false; - } - return valid; -} - -Writable.prototype.write = function (chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - var isBuf = !state.objectMode && _isUint8Array(chunk); - - if (isBuf && !Buffer.isBuffer(chunk)) { - chunk = _uint8ArrayToBuffer(chunk); - } - - if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; - - if (typeof cb !== 'function') cb = nop; - - if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); - } - - return ret; -}; - -Writable.prototype.cork = function () { - var state = this._writableState; - - state.corked++; -}; - -Writable.prototype.uncork = function () { - var state = this._writableState; - - if (state.corked) { - state.corked--; - - if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); - } -}; - -Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { - // node::ParseEncoding() requires lower case. - if (typeof encoding === 'string') encoding = encoding.toLowerCase(); - if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); - this._writableState.defaultEncoding = encoding; - return this; -}; - -function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { - chunk = Buffer.from(chunk, encoding); - } - return chunk; -} - -Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function () { - return this._writableState.highWaterMark; - } -}); - -// if we're already writing something, then just put this -// in the queue, and wait our turn. Otherwise, call _write -// If we return false, then we need a drain event, so set that flag. -function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { - if (!isBuf) { - var newChunk = decodeChunk(state, chunk, encoding); - if (chunk !== newChunk) { - isBuf = true; - encoding = 'buffer'; - chunk = newChunk; - } - } - var len = state.objectMode ? 1 : chunk.length; - - state.length += len; - - var ret = state.length < state.highWaterMark; - // we must ensure that previous needDrain will not be reset to false. - if (!ret) state.needDrain = true; - - if (state.writing || state.corked) { - var last = state.lastBufferedRequest; - state.lastBufferedRequest = { - chunk: chunk, - encoding: encoding, - isBuf: isBuf, - callback: cb, - next: null - }; - if (last) { - last.next = state.lastBufferedRequest; - } else { - state.bufferedRequest = state.lastBufferedRequest; - } - state.bufferedRequestCount += 1; - } else { - doWrite(stream, state, false, len, chunk, encoding, cb); - } - - return ret; -} - -function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); - state.sync = false; -} - -function onwriteError(stream, state, sync, er, cb) { - --state.pendingcb; - - if (sync) { - // defer the callback if we are being called synchronously - // to avoid piling up things on the stack - pna.nextTick(cb, er); - // this can emit finish, and it will always happen - // after error - pna.nextTick(finishMaybe, stream, state); - stream._writableState.errorEmitted = true; - stream.emit('error', er); - } else { - // the caller expect this to happen before if - // it is async - cb(er); - stream._writableState.errorEmitted = true; - stream.emit('error', er); - // this can emit finish, but finish must - // always follow error - finishMaybe(stream, state); - } -} - -function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; -} - -function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - - onwriteStateUpdate(state); - - if (er) onwriteError(stream, state, sync, er, cb);else { - // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(state); - - if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { - clearBuffer(stream, state); - } - - if (sync) { - /**/ - asyncWrite(afterWrite, stream, state, finished, cb); - /**/ - } else { - afterWrite(stream, state, finished, cb); - } - } -} - -function afterWrite(stream, state, finished, cb) { - if (!finished) onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); -} - -// Must force callback to be called on nextTick, so that we don't -// emit 'drain' before the write() consumer gets the 'false' return -// value, and has a chance to attach a 'drain' listener. -function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit('drain'); - } -} - -// if there's something in the buffer waiting, then process it -function clearBuffer(stream, state) { - state.bufferProcessing = true; - var entry = state.bufferedRequest; - - if (stream._writev && entry && entry.next) { - // Fast case, write everything using _writev() - var l = state.bufferedRequestCount; - var buffer = new Array(l); - var holder = state.corkedRequestsFree; - holder.entry = entry; - - var count = 0; - var allBuffers = true; - while (entry) { - buffer[count] = entry; - if (!entry.isBuf) allBuffers = false; - entry = entry.next; - count += 1; - } - buffer.allBuffers = allBuffers; - - doWrite(stream, state, true, state.length, buffer, '', holder.finish); - - // doWrite is almost always async, defer these to save a bit of time - // as the hot path ends with doWrite - state.pendingcb++; - state.lastBufferedRequest = null; - if (holder.next) { - state.corkedRequestsFree = holder.next; - holder.next = null; - } else { - state.corkedRequestsFree = new CorkedRequest(state); - } - state.bufferedRequestCount = 0; - } else { - // Slow case, write chunks one-by-one - while (entry) { - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - - doWrite(stream, state, false, len, chunk, encoding, cb); - entry = entry.next; - state.bufferedRequestCount--; - // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. - if (state.writing) { - break; - } - } - - if (entry === null) state.lastBufferedRequest = null; - } - - state.bufferedRequest = entry; - state.bufferProcessing = false; -} - -Writable.prototype._write = function (chunk, encoding, cb) { - cb(new Error('_write() is not implemented')); -}; - -Writable.prototype._writev = null; - -Writable.prototype.end = function (chunk, encoding, cb) { - var state = this._writableState; - - if (typeof chunk === 'function') { - cb = chunk; - chunk = null; - encoding = null; - } else if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); - - // .end() fully uncorks - if (state.corked) { - state.corked = 1; - this.uncork(); - } - - // ignore unnecessary end() calls. - if (!state.ending && !state.finished) endWritable(this, state, cb); -}; - -function needFinish(state) { - return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; -} -function callFinal(stream, state) { - stream._final(function (err) { - state.pendingcb--; - if (err) { - stream.emit('error', err); - } - state.prefinished = true; - stream.emit('prefinish'); - finishMaybe(stream, state); - }); -} -function prefinish(stream, state) { - if (!state.prefinished && !state.finalCalled) { - if (typeof stream._final === 'function') { - state.pendingcb++; - state.finalCalled = true; - pna.nextTick(callFinal, stream, state); - } else { - state.prefinished = true; - stream.emit('prefinish'); - } - } -} - -function finishMaybe(stream, state) { - var need = needFinish(state); - if (need) { - prefinish(stream, state); - if (state.pendingcb === 0) { - state.finished = true; - stream.emit('finish'); - } - } - return need; -} - -function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) pna.nextTick(cb);else stream.once('finish', cb); - } - state.ended = true; - stream.writable = false; -} - -function onCorkedFinish(corkReq, state, err) { - var entry = corkReq.entry; - corkReq.entry = null; - while (entry) { - var cb = entry.callback; - state.pendingcb--; - cb(err); - entry = entry.next; - } - if (state.corkedRequestsFree) { - state.corkedRequestsFree.next = corkReq; - } else { - state.corkedRequestsFree = corkReq; - } -} - -Object.defineProperty(Writable.prototype, 'destroyed', { - get: function () { - if (this._writableState === undefined) { - return false; - } - return this._writableState.destroyed; - }, - set: function (value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._writableState) { - return; - } - - // backward compatibility, the user is explicitly - // managing destroyed - this._writableState.destroyed = value; - } -}); - -Writable.prototype.destroy = destroyImpl.destroy; -Writable.prototype._undestroy = destroyImpl.undestroy; -Writable.prototype._destroy = function (err, cb) { - this.end(); - cb(err); -}; -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate) -},{"./_stream_duplex":139,"./internal/streams/destroy":145,"./internal/streams/stream":146,"_process":133,"core-util-is":51,"inherits":75,"process-nextick-args":132,"safe-buffer":147,"timers":176,"util-deprecate":183}],144:[function(require,module,exports){ -'use strict'; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var Buffer = require('safe-buffer').Buffer; -var util = require('util'); - -function copyBuffer(src, target, offset) { - src.copy(target, offset); -} - -module.exports = function () { - function BufferList() { - _classCallCheck(this, BufferList); - - this.head = null; - this.tail = null; - this.length = 0; - } - - BufferList.prototype.push = function push(v) { - var entry = { data: v, next: null }; - if (this.length > 0) this.tail.next = entry;else this.head = entry; - this.tail = entry; - ++this.length; - }; - - BufferList.prototype.unshift = function unshift(v) { - var entry = { data: v, next: this.head }; - if (this.length === 0) this.tail = entry; - this.head = entry; - ++this.length; - }; - - BufferList.prototype.shift = function shift() { - if (this.length === 0) return; - var ret = this.head.data; - if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; - --this.length; - return ret; - }; - - BufferList.prototype.clear = function clear() { - this.head = this.tail = null; - this.length = 0; - }; - - BufferList.prototype.join = function join(s) { - if (this.length === 0) return ''; - var p = this.head; - var ret = '' + p.data; - while (p = p.next) { - ret += s + p.data; - }return ret; - }; - - BufferList.prototype.concat = function concat(n) { - if (this.length === 0) return Buffer.alloc(0); - if (this.length === 1) return this.head.data; - var ret = Buffer.allocUnsafe(n >>> 0); - var p = this.head; - var i = 0; - while (p) { - copyBuffer(p.data, ret, i); - i += p.data.length; - p = p.next; - } - return ret; - }; - - return BufferList; -}(); - -if (util && util.inspect && util.inspect.custom) { - module.exports.prototype[util.inspect.custom] = function () { - var obj = util.inspect({ length: this.length }); - return this.constructor.name + ' ' + obj; - }; -} -},{"safe-buffer":147,"util":33}],145:[function(require,module,exports){ -'use strict'; - -/**/ - -var pna = require('process-nextick-args'); -/**/ - -// undocumented cb() API, needed for core, not for public API -function destroy(err, cb) { - var _this = this; - - var readableDestroyed = this._readableState && this._readableState.destroyed; - var writableDestroyed = this._writableState && this._writableState.destroyed; - - if (readableDestroyed || writableDestroyed) { - if (cb) { - cb(err); - } else if (err && (!this._writableState || !this._writableState.errorEmitted)) { - pna.nextTick(emitErrorNT, this, err); - } - return this; - } - - // we set destroyed to true before firing error callbacks in order - // to make it re-entrance safe in case destroy() is called within callbacks - - if (this._readableState) { - this._readableState.destroyed = true; - } - - // if this is a duplex stream mark the writable part as destroyed as well - if (this._writableState) { - this._writableState.destroyed = true; - } - - this._destroy(err || null, function (err) { - if (!cb && err) { - pna.nextTick(emitErrorNT, _this, err); - if (_this._writableState) { - _this._writableState.errorEmitted = true; - } - } else if (cb) { - cb(err); - } - }); - - return this; -} - -function undestroy() { - if (this._readableState) { - this._readableState.destroyed = false; - this._readableState.reading = false; - this._readableState.ended = false; - this._readableState.endEmitted = false; - } - - if (this._writableState) { - this._writableState.destroyed = false; - this._writableState.ended = false; - this._writableState.ending = false; - this._writableState.finished = false; - this._writableState.errorEmitted = false; - } -} - -function emitErrorNT(self, err) { - self.emit('error', err); -} - -module.exports = { - destroy: destroy, - undestroy: undestroy -}; -},{"process-nextick-args":132}],146:[function(require,module,exports){ -module.exports = require('events').EventEmitter; - -},{"events":52}],147:[function(require,module,exports){ -/* eslint-disable node/no-deprecated-api */ -var buffer = require('buffer') -var Buffer = buffer.Buffer - -// alternative to using Object.keys for old browsers -function copyProps (src, dst) { - for (var key in src) { - dst[key] = src[key] - } -} -if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { - module.exports = buffer -} else { - // Copy properties from require('buffer') - copyProps(buffer, exports) - exports.Buffer = SafeBuffer -} - -function SafeBuffer (arg, encodingOrOffset, length) { - return Buffer(arg, encodingOrOffset, length) -} - -// Copy static methods from Buffer -copyProps(Buffer, SafeBuffer) - -SafeBuffer.from = function (arg, encodingOrOffset, length) { - if (typeof arg === 'number') { - throw new TypeError('Argument must not be a number') - } - return Buffer(arg, encodingOrOffset, length) -} - -SafeBuffer.alloc = function (size, fill, encoding) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - var buf = Buffer(size) - if (fill !== undefined) { - if (typeof encoding === 'string') { - buf.fill(fill, encoding) - } else { - buf.fill(fill) - } - } else { - buf.fill(0) - } - return buf -} - -SafeBuffer.allocUnsafe = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return Buffer(size) -} - -SafeBuffer.allocUnsafeSlow = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return buffer.SlowBuffer(size) -} - -},{"buffer":48}],148:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -'use strict'; - -/**/ - -var Buffer = require('safe-buffer').Buffer; -/**/ - -var isEncoding = Buffer.isEncoding || function (encoding) { - encoding = '' + encoding; - switch (encoding && encoding.toLowerCase()) { - case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': - return true; - default: - return false; - } -}; - -function _normalizeEncoding(enc) { - if (!enc) return 'utf8'; - var retried; - while (true) { - switch (enc) { - case 'utf8': - case 'utf-8': - return 'utf8'; - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return 'utf16le'; - case 'latin1': - case 'binary': - return 'latin1'; - case 'base64': - case 'ascii': - case 'hex': - return enc; - default: - if (retried) return; // undefined - enc = ('' + enc).toLowerCase(); - retried = true; - } - } -}; - -// Do not cache `Buffer.isEncoding` when checking encoding names as some -// modules monkey-patch it to support additional encodings -function normalizeEncoding(enc) { - var nenc = _normalizeEncoding(enc); - if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); - return nenc || enc; -} - -// StringDecoder provides an interface for efficiently splitting a series of -// buffers into a series of JS strings without breaking apart multi-byte -// characters. -exports.StringDecoder = StringDecoder; -function StringDecoder(encoding) { - this.encoding = normalizeEncoding(encoding); - var nb; - switch (this.encoding) { - case 'utf16le': - this.text = utf16Text; - this.end = utf16End; - nb = 4; - break; - case 'utf8': - this.fillLast = utf8FillLast; - nb = 4; - break; - case 'base64': - this.text = base64Text; - this.end = base64End; - nb = 3; - break; - default: - this.write = simpleWrite; - this.end = simpleEnd; - return; - } - this.lastNeed = 0; - this.lastTotal = 0; - this.lastChar = Buffer.allocUnsafe(nb); -} - -StringDecoder.prototype.write = function (buf) { - if (buf.length === 0) return ''; - var r; - var i; - if (this.lastNeed) { - r = this.fillLast(buf); - if (r === undefined) return ''; - i = this.lastNeed; - this.lastNeed = 0; - } else { - i = 0; - } - if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); - return r || ''; -}; - -StringDecoder.prototype.end = utf8End; - -// Returns only complete characters in a Buffer -StringDecoder.prototype.text = utf8Text; - -// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer -StringDecoder.prototype.fillLast = function (buf) { - if (this.lastNeed <= buf.length) { - buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); - this.lastNeed -= buf.length; -}; - -// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a -// continuation byte. If an invalid byte is detected, -2 is returned. -function utf8CheckByte(byte) { - if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; - return byte >> 6 === 0x02 ? -1 : -2; -} - -// Checks at most 3 bytes at the end of a Buffer in order to detect an -// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) -// needed to complete the UTF-8 character (if applicable) are returned. -function utf8CheckIncomplete(self, buf, i) { - var j = buf.length - 1; - if (j < i) return 0; - var nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self.lastNeed = nb - 1; - return nb; - } - if (--j < i || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self.lastNeed = nb - 2; - return nb; - } - if (--j < i || nb === -2) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) { - if (nb === 2) nb = 0;else self.lastNeed = nb - 3; - } - return nb; - } - return 0; -} - -// Validates as many continuation bytes for a multi-byte UTF-8 character as -// needed or are available. If we see a non-continuation byte where we expect -// one, we "replace" the validated continuation bytes we've seen so far with -// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding -// behavior. The continuation byte check is included three times in the case -// where all of the continuation bytes for a character exist in the same buffer. -// It is also done this way as a slight performance increase instead of using a -// loop. -function utf8CheckExtraBytes(self, buf, p) { - if ((buf[0] & 0xC0) !== 0x80) { - self.lastNeed = 0; - return '\ufffd'; - } - if (self.lastNeed > 1 && buf.length > 1) { - if ((buf[1] & 0xC0) !== 0x80) { - self.lastNeed = 1; - return '\ufffd'; - } - if (self.lastNeed > 2 && buf.length > 2) { - if ((buf[2] & 0xC0) !== 0x80) { - self.lastNeed = 2; - return '\ufffd'; - } - } - } -} - -// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. -function utf8FillLast(buf) { - var p = this.lastTotal - this.lastNeed; - var r = utf8CheckExtraBytes(this, buf, p); - if (r !== undefined) return r; - if (this.lastNeed <= buf.length) { - buf.copy(this.lastChar, p, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf.copy(this.lastChar, p, 0, buf.length); - this.lastNeed -= buf.length; -} - -// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a -// partial character, the character's bytes are buffered until the required -// number of bytes are available. -function utf8Text(buf, i) { - var total = utf8CheckIncomplete(this, buf, i); - if (!this.lastNeed) return buf.toString('utf8', i); - this.lastTotal = total; - var end = buf.length - (total - this.lastNeed); - buf.copy(this.lastChar, 0, end); - return buf.toString('utf8', i, end); -} - -// For UTF-8, a replacement character is added when ending on a partial -// character. -function utf8End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + '\ufffd'; - return r; -} - -// UTF-16LE typically needs two bytes per character, but even if we have an even -// number of bytes available, we need to check if we end on a leading/high -// surrogate. In that case, we need to wait for the next two bytes in order to -// decode the last character properly. -function utf16Text(buf, i) { - if ((buf.length - i) % 2 === 0) { - var r = buf.toString('utf16le', i); - if (r) { - var c = r.charCodeAt(r.length - 1); - if (c >= 0xD800 && c <= 0xDBFF) { - this.lastNeed = 2; - this.lastTotal = 4; - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - return r.slice(0, -1); - } - } - return r; - } - this.lastNeed = 1; - this.lastTotal = 2; - this.lastChar[0] = buf[buf.length - 1]; - return buf.toString('utf16le', i, buf.length - 1); -} - -// For UTF-16LE we do not explicitly append special replacement characters if we -// end on a partial character, we simply let v8 handle that. -function utf16End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) { - var end = this.lastTotal - this.lastNeed; - return r + this.lastChar.toString('utf16le', 0, end); - } - return r; -} - -function base64Text(buf, i) { - var n = (buf.length - i) % 3; - if (n === 0) return buf.toString('base64', i); - this.lastNeed = 3 - n; - this.lastTotal = 3; - if (n === 1) { - this.lastChar[0] = buf[buf.length - 1]; - } else { - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - } - return buf.toString('base64', i, buf.length - n); -} - -function base64End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); - return r; -} - -// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) -function simpleWrite(buf) { - return buf.toString(this.encoding); -} - -function simpleEnd(buf) { - return buf && buf.length ? this.write(buf) : ''; -} -},{"safe-buffer":147}],149:[function(require,module,exports){ -module.exports = require('./readable').PassThrough - -},{"./readable":150}],150:[function(require,module,exports){ -exports = module.exports = require('./lib/_stream_readable.js'); -exports.Stream = exports; -exports.Readable = exports; -exports.Writable = require('./lib/_stream_writable.js'); -exports.Duplex = require('./lib/_stream_duplex.js'); -exports.Transform = require('./lib/_stream_transform.js'); -exports.PassThrough = require('./lib/_stream_passthrough.js'); - -},{"./lib/_stream_duplex.js":139,"./lib/_stream_passthrough.js":140,"./lib/_stream_readable.js":141,"./lib/_stream_transform.js":142,"./lib/_stream_writable.js":143}],151:[function(require,module,exports){ -module.exports = require('./readable').Transform - -},{"./readable":150}],152:[function(require,module,exports){ -module.exports = require('./lib/_stream_writable.js'); - -},{"./lib/_stream_writable.js":143}],153:[function(require,module,exports){ -/** - * Copyright (c) 2014-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -var runtime = (function (exports) { - "use strict"; - - var Op = Object.prototype; - var hasOwn = Op.hasOwnProperty; - var undefined; // More compressible than void 0. - var $Symbol = typeof Symbol === "function" ? Symbol : {}; - var iteratorSymbol = $Symbol.iterator || "@@iterator"; - var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; - var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; - - function wrap(innerFn, outerFn, self, tryLocsList) { - // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. - var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; - var generator = Object.create(protoGenerator.prototype); - var context = new Context(tryLocsList || []); - - // The ._invoke method unifies the implementations of the .next, - // .throw, and .return methods. - generator._invoke = makeInvokeMethod(innerFn, self, context); - - return generator; - } - exports.wrap = wrap; - - // Try/catch helper to minimize deoptimizations. Returns a completion - // record like context.tryEntries[i].completion. This interface could - // have been (and was previously) designed to take a closure to be - // invoked without arguments, but in all the cases we care about we - // already have an existing method we want to call, so there's no need - // to create a new function object. We can even get away with assuming - // the method takes exactly one argument, since that happens to be true - // in every case, so we don't have to touch the arguments object. The - // only additional allocation required is the completion record, which - // has a stable shape and so hopefully should be cheap to allocate. - function tryCatch(fn, obj, arg) { - try { - return { type: "normal", arg: fn.call(obj, arg) }; - } catch (err) { - return { type: "throw", arg: err }; - } - } - - var GenStateSuspendedStart = "suspendedStart"; - var GenStateSuspendedYield = "suspendedYield"; - var GenStateExecuting = "executing"; - var GenStateCompleted = "completed"; - - // Returning this object from the innerFn has the same effect as - // breaking out of the dispatch switch statement. - var ContinueSentinel = {}; - - // Dummy constructor functions that we use as the .constructor and - // .constructor.prototype properties for functions that return Generator - // objects. For full spec compliance, you may wish to configure your - // minifier not to mangle the names of these two functions. - function Generator() {} - function GeneratorFunction() {} - function GeneratorFunctionPrototype() {} - - // This is a polyfill for %IteratorPrototype% for environments that - // don't natively support it. - var IteratorPrototype = {}; - IteratorPrototype[iteratorSymbol] = function () { - return this; - }; - - var getProto = Object.getPrototypeOf; - var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); - if (NativeIteratorPrototype && - NativeIteratorPrototype !== Op && - hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { - // This environment has a native %IteratorPrototype%; use it instead - // of the polyfill. - IteratorPrototype = NativeIteratorPrototype; - } - - var Gp = GeneratorFunctionPrototype.prototype = - Generator.prototype = Object.create(IteratorPrototype); - GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; - GeneratorFunctionPrototype.constructor = GeneratorFunction; - GeneratorFunctionPrototype[toStringTagSymbol] = - GeneratorFunction.displayName = "GeneratorFunction"; - - // Helper for defining the .next, .throw, and .return methods of the - // Iterator interface in terms of a single ._invoke method. - function defineIteratorMethods(prototype) { - ["next", "throw", "return"].forEach(function(method) { - prototype[method] = function(arg) { - return this._invoke(method, arg); - }; - }); - } - - exports.isGeneratorFunction = function(genFun) { - var ctor = typeof genFun === "function" && genFun.constructor; - return ctor - ? ctor === GeneratorFunction || - // For the native GeneratorFunction constructor, the best we can - // do is to check its .name property. - (ctor.displayName || ctor.name) === "GeneratorFunction" - : false; - }; - - exports.mark = function(genFun) { - if (Object.setPrototypeOf) { - Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); - } else { - genFun.__proto__ = GeneratorFunctionPrototype; - if (!(toStringTagSymbol in genFun)) { - genFun[toStringTagSymbol] = "GeneratorFunction"; - } - } - genFun.prototype = Object.create(Gp); - return genFun; - }; - - // Within the body of any async function, `await x` is transformed to - // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test - // `hasOwn.call(value, "__await")` to determine if the yielded value is - // meant to be awaited. - exports.awrap = function(arg) { - return { __await: arg }; - }; - - function AsyncIterator(generator) { - function invoke(method, arg, resolve, reject) { - var record = tryCatch(generator[method], generator, arg); - if (record.type === "throw") { - reject(record.arg); - } else { - var result = record.arg; - var value = result.value; - if (value && - typeof value === "object" && - hasOwn.call(value, "__await")) { - return Promise.resolve(value.__await).then(function(value) { - invoke("next", value, resolve, reject); - }, function(err) { - invoke("throw", err, resolve, reject); - }); - } - - return Promise.resolve(value).then(function(unwrapped) { - // When a yielded Promise is resolved, its final value becomes - // the .value of the Promise<{value,done}> result for the - // current iteration. - result.value = unwrapped; - resolve(result); - }, function(error) { - // If a rejected Promise was yielded, throw the rejection back - // into the async generator function so it can be handled there. - return invoke("throw", error, resolve, reject); - }); - } - } - - var previousPromise; - - function enqueue(method, arg) { - function callInvokeWithMethodAndArg() { - return new Promise(function(resolve, reject) { - invoke(method, arg, resolve, reject); - }); - } - - return previousPromise = - // If enqueue has been called before, then we want to wait until - // all previous Promises have been resolved before calling invoke, - // so that results are always delivered in the correct order. If - // enqueue has not been called before, then it is important to - // call invoke immediately, without waiting on a callback to fire, - // so that the async generator function has the opportunity to do - // any necessary setup in a predictable way. This predictability - // is why the Promise constructor synchronously invokes its - // executor callback, and why async functions synchronously - // execute code before the first await. Since we implement simple - // async functions in terms of async generators, it is especially - // important to get this right, even though it requires care. - previousPromise ? previousPromise.then( - callInvokeWithMethodAndArg, - // Avoid propagating failures to Promises returned by later - // invocations of the iterator. - callInvokeWithMethodAndArg - ) : callInvokeWithMethodAndArg(); - } - - // Define the unified helper method that is used to implement .next, - // .throw, and .return (see defineIteratorMethods). - this._invoke = enqueue; - } - - defineIteratorMethods(AsyncIterator.prototype); - AsyncIterator.prototype[asyncIteratorSymbol] = function () { - return this; - }; - exports.AsyncIterator = AsyncIterator; - - // Note that simple async functions are implemented on top of - // AsyncIterator objects; they just return a Promise for the value of - // the final result produced by the iterator. - exports.async = function(innerFn, outerFn, self, tryLocsList) { - var iter = new AsyncIterator( - wrap(innerFn, outerFn, self, tryLocsList) - ); - - return exports.isGeneratorFunction(outerFn) - ? iter // If outerFn is a generator, return the full iterator. - : iter.next().then(function(result) { - return result.done ? result.value : iter.next(); - }); - }; - - function makeInvokeMethod(innerFn, self, context) { - var state = GenStateSuspendedStart; - - return function invoke(method, arg) { - if (state === GenStateExecuting) { - throw new Error("Generator is already running"); - } - - if (state === GenStateCompleted) { - if (method === "throw") { - throw arg; - } - - // Be forgiving, per 25.3.3.3.3 of the spec: - // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume - return doneResult(); - } - - context.method = method; - context.arg = arg; - - while (true) { - var delegate = context.delegate; - if (delegate) { - var delegateResult = maybeInvokeDelegate(delegate, context); - if (delegateResult) { - if (delegateResult === ContinueSentinel) continue; - return delegateResult; - } - } - - if (context.method === "next") { - // Setting context._sent for legacy support of Babel's - // function.sent implementation. - context.sent = context._sent = context.arg; - - } else if (context.method === "throw") { - if (state === GenStateSuspendedStart) { - state = GenStateCompleted; - throw context.arg; - } - - context.dispatchException(context.arg); - - } else if (context.method === "return") { - context.abrupt("return", context.arg); - } - - state = GenStateExecuting; - - var record = tryCatch(innerFn, self, context); - if (record.type === "normal") { - // If an exception is thrown from innerFn, we leave state === - // GenStateExecuting and loop back for another invocation. - state = context.done - ? GenStateCompleted - : GenStateSuspendedYield; - - if (record.arg === ContinueSentinel) { - continue; - } - - return { - value: record.arg, - done: context.done - }; - - } else if (record.type === "throw") { - state = GenStateCompleted; - // Dispatch the exception by looping back around to the - // context.dispatchException(context.arg) call above. - context.method = "throw"; - context.arg = record.arg; - } - } - }; - } - - // Call delegate.iterator[context.method](context.arg) and handle the - // result, either by returning a { value, done } result from the - // delegate iterator, or by modifying context.method and context.arg, - // setting context.delegate to null, and returning the ContinueSentinel. - function maybeInvokeDelegate(delegate, context) { - var method = delegate.iterator[context.method]; - if (method === undefined) { - // A .throw or .return when the delegate iterator has no .throw - // method always terminates the yield* loop. - context.delegate = null; - - if (context.method === "throw") { - // Note: ["return"] must be used for ES3 parsing compatibility. - if (delegate.iterator["return"]) { - // If the delegate iterator has a return method, give it a - // chance to clean up. - context.method = "return"; - context.arg = undefined; - maybeInvokeDelegate(delegate, context); - - if (context.method === "throw") { - // If maybeInvokeDelegate(context) changed context.method from - // "return" to "throw", let that override the TypeError below. - return ContinueSentinel; - } - } - - context.method = "throw"; - context.arg = new TypeError( - "The iterator does not provide a 'throw' method"); - } - - return ContinueSentinel; - } - - var record = tryCatch(method, delegate.iterator, context.arg); - - if (record.type === "throw") { - context.method = "throw"; - context.arg = record.arg; - context.delegate = null; - return ContinueSentinel; - } - - var info = record.arg; - - if (! info) { - context.method = "throw"; - context.arg = new TypeError("iterator result is not an object"); - context.delegate = null; - return ContinueSentinel; - } - - if (info.done) { - // Assign the result of the finished delegate to the temporary - // variable specified by delegate.resultName (see delegateYield). - context[delegate.resultName] = info.value; - - // Resume execution at the desired location (see delegateYield). - context.next = delegate.nextLoc; - - // If context.method was "throw" but the delegate handled the - // exception, let the outer generator proceed normally. If - // context.method was "next", forget context.arg since it has been - // "consumed" by the delegate iterator. If context.method was - // "return", allow the original .return call to continue in the - // outer generator. - if (context.method !== "return") { - context.method = "next"; - context.arg = undefined; - } - - } else { - // Re-yield the result returned by the delegate method. - return info; - } - - // The delegate iterator is finished, so forget it and continue with - // the outer generator. - context.delegate = null; - return ContinueSentinel; - } - - // Define Generator.prototype.{next,throw,return} in terms of the - // unified ._invoke helper method. - defineIteratorMethods(Gp); - - Gp[toStringTagSymbol] = "Generator"; - - // A Generator should always return itself as the iterator object when the - // @@iterator function is called on it. Some browsers' implementations of the - // iterator prototype chain incorrectly implement this, causing the Generator - // object to not be returned from this call. This ensures that doesn't happen. - // See https://github.com/facebook/regenerator/issues/274 for more details. - Gp[iteratorSymbol] = function() { - return this; - }; - - Gp.toString = function() { - return "[object Generator]"; - }; - - function pushTryEntry(locs) { - var entry = { tryLoc: locs[0] }; - - if (1 in locs) { - entry.catchLoc = locs[1]; - } - - if (2 in locs) { - entry.finallyLoc = locs[2]; - entry.afterLoc = locs[3]; - } - - this.tryEntries.push(entry); - } - - function resetTryEntry(entry) { - var record = entry.completion || {}; - record.type = "normal"; - delete record.arg; - entry.completion = record; - } - - function Context(tryLocsList) { - // The root entry object (effectively a try statement without a catch - // or a finally block) gives us a place to store values thrown from - // locations where there is no enclosing try statement. - this.tryEntries = [{ tryLoc: "root" }]; - tryLocsList.forEach(pushTryEntry, this); - this.reset(true); - } - - exports.keys = function(object) { - var keys = []; - for (var key in object) { - keys.push(key); - } - keys.reverse(); - - // Rather than returning an object with a next method, we keep - // things simple and return the next function itself. - return function next() { - while (keys.length) { - var key = keys.pop(); - if (key in object) { - next.value = key; - next.done = false; - return next; - } - } - - // To avoid creating an additional object, we just hang the .value - // and .done properties off the next function object itself. This - // also ensures that the minifier will not anonymize the function. - next.done = true; - return next; - }; - }; - - function values(iterable) { - if (iterable) { - var iteratorMethod = iterable[iteratorSymbol]; - if (iteratorMethod) { - return iteratorMethod.call(iterable); - } - - if (typeof iterable.next === "function") { - return iterable; - } - - if (!isNaN(iterable.length)) { - var i = -1, next = function next() { - while (++i < iterable.length) { - if (hasOwn.call(iterable, i)) { - next.value = iterable[i]; - next.done = false; - return next; - } - } - - next.value = undefined; - next.done = true; - - return next; - }; - - return next.next = next; - } - } - - // Return an iterator with no values. - return { next: doneResult }; - } - exports.values = values; - - function doneResult() { - return { value: undefined, done: true }; - } - - Context.prototype = { - constructor: Context, - - reset: function(skipTempReset) { - this.prev = 0; - this.next = 0; - // Resetting context._sent for legacy support of Babel's - // function.sent implementation. - this.sent = this._sent = undefined; - this.done = false; - this.delegate = null; - - this.method = "next"; - this.arg = undefined; - - this.tryEntries.forEach(resetTryEntry); - - if (!skipTempReset) { - for (var name in this) { - // Not sure about the optimal order of these conditions: - if (name.charAt(0) === "t" && - hasOwn.call(this, name) && - !isNaN(+name.slice(1))) { - this[name] = undefined; - } - } - } - }, - - stop: function() { - this.done = true; - - var rootEntry = this.tryEntries[0]; - var rootRecord = rootEntry.completion; - if (rootRecord.type === "throw") { - throw rootRecord.arg; - } - - return this.rval; - }, - - dispatchException: function(exception) { - if (this.done) { - throw exception; - } - - var context = this; - function handle(loc, caught) { - record.type = "throw"; - record.arg = exception; - context.next = loc; - - if (caught) { - // If the dispatched exception was caught by a catch block, - // then let that catch block handle the exception normally. - context.method = "next"; - context.arg = undefined; - } - - return !! caught; - } - - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - var record = entry.completion; - - if (entry.tryLoc === "root") { - // Exception thrown outside of any try block that could handle - // it, so set the completion value of the entire function to - // throw the exception. - return handle("end"); - } - - if (entry.tryLoc <= this.prev) { - var hasCatch = hasOwn.call(entry, "catchLoc"); - var hasFinally = hasOwn.call(entry, "finallyLoc"); - - if (hasCatch && hasFinally) { - if (this.prev < entry.catchLoc) { - return handle(entry.catchLoc, true); - } else if (this.prev < entry.finallyLoc) { - return handle(entry.finallyLoc); - } - - } else if (hasCatch) { - if (this.prev < entry.catchLoc) { - return handle(entry.catchLoc, true); - } - - } else if (hasFinally) { - if (this.prev < entry.finallyLoc) { - return handle(entry.finallyLoc); - } - - } else { - throw new Error("try statement without catch or finally"); - } - } - } - }, - - abrupt: function(type, arg) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc <= this.prev && - hasOwn.call(entry, "finallyLoc") && - this.prev < entry.finallyLoc) { - var finallyEntry = entry; - break; - } - } - - if (finallyEntry && - (type === "break" || - type === "continue") && - finallyEntry.tryLoc <= arg && - arg <= finallyEntry.finallyLoc) { - // Ignore the finally entry if control is not jumping to a - // location outside the try/catch block. - finallyEntry = null; - } - - var record = finallyEntry ? finallyEntry.completion : {}; - record.type = type; - record.arg = arg; - - if (finallyEntry) { - this.method = "next"; - this.next = finallyEntry.finallyLoc; - return ContinueSentinel; - } - - return this.complete(record); - }, - - complete: function(record, afterLoc) { - if (record.type === "throw") { - throw record.arg; - } - - if (record.type === "break" || - record.type === "continue") { - this.next = record.arg; - } else if (record.type === "return") { - this.rval = this.arg = record.arg; - this.method = "return"; - this.next = "end"; - } else if (record.type === "normal" && afterLoc) { - this.next = afterLoc; - } - - return ContinueSentinel; - }, - - finish: function(finallyLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.finallyLoc === finallyLoc) { - this.complete(entry.completion, entry.afterLoc); - resetTryEntry(entry); - return ContinueSentinel; - } - } - }, - - "catch": function(tryLoc) { - for (var i = this.tryEntries.length - 1; i >= 0; --i) { - var entry = this.tryEntries[i]; - if (entry.tryLoc === tryLoc) { - var record = entry.completion; - if (record.type === "throw") { - var thrown = record.arg; - resetTryEntry(entry); - } - return thrown; - } - } - - // The context.catch method must only be called with a location - // argument that corresponds to a known catch block. - throw new Error("illegal catch attempt"); - }, - - delegateYield: function(iterable, resultName, nextLoc) { - this.delegate = { - iterator: values(iterable), - resultName: resultName, - nextLoc: nextLoc - }; - - if (this.method === "next") { - // Deliberately forget the last sent value so that we don't - // accidentally pass it on to the delegate. - this.arg = undefined; - } - - return ContinueSentinel; - } - }; - - // Regardless of whether this script is executing as a CommonJS module - // or not, return the runtime object so that we can declare the variable - // regeneratorRuntime in the outer scope, which allows this module to be - // injected easily by `bin/regenerator --include-runtime script.js`. - return exports; - -}( - // If this script is executing as a CommonJS module, use module.exports - // as the regeneratorRuntime namespace. Otherwise create a new empty - // object. Either way, the resulting object will be used to initialize - // the regeneratorRuntime variable at the top of this file. - typeof module === "object" ? module.exports : {} -)); - -try { - regeneratorRuntime = runtime; -} catch (accidentalStrictMode) { - // This module should not be running in strict mode, so the above - // assignment should always work unless something is misconfigured. Just - // in case runtime.js accidentally runs in strict mode, we can escape - // strict mode using a global Function call. This could conceivably fail - // if a Content Security Policy forbids using Function, but in that case - // the proper solution is to fix the accidental strict mode problem. If - // you've misconfigured your bundler to force strict mode and applied a - // CSP to forbid Function, and you're not willing to fix either of those - // problems, please detail your unique predicament in a GitHub issue. - Function("r", "regeneratorRuntime = r")(runtime); -} - -},{}],154:[function(require,module,exports){ -/* eslint-disable node/no-deprecated-api */ -var buffer = require('buffer') -var Buffer = buffer.Buffer - -// alternative to using Object.keys for old browsers -function copyProps (src, dst) { - for (var key in src) { - dst[key] = src[key] - } -} -if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { - module.exports = buffer -} else { - // Copy properties from require('buffer') - copyProps(buffer, exports) - exports.Buffer = SafeBuffer -} - -function SafeBuffer (arg, encodingOrOffset, length) { - return Buffer(arg, encodingOrOffset, length) -} - -SafeBuffer.prototype = Object.create(Buffer.prototype) - -// Copy static methods from Buffer -copyProps(Buffer, SafeBuffer) - -SafeBuffer.from = function (arg, encodingOrOffset, length) { - if (typeof arg === 'number') { - throw new TypeError('Argument must not be a number') - } - return Buffer(arg, encodingOrOffset, length) -} - -SafeBuffer.alloc = function (size, fill, encoding) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - var buf = Buffer(size) - if (fill !== undefined) { - if (typeof encoding === 'string') { - buf.fill(fill, encoding) - } else { - buf.fill(fill) - } - } else { - buf.fill(0) - } - return buf -} - -SafeBuffer.allocUnsafe = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return Buffer(size) -} - -SafeBuffer.allocUnsafeSlow = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return buffer.SlowBuffer(size) -} - -},{"buffer":48}],155:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -module.exports = Stream; - -var EE = require('events').EventEmitter; -var inherits = require('inherits'); - -inherits(Stream, EE); -Stream.Readable = require('readable-stream/readable.js'); -Stream.Writable = require('readable-stream/writable.js'); -Stream.Duplex = require('readable-stream/duplex.js'); -Stream.Transform = require('readable-stream/transform.js'); -Stream.PassThrough = require('readable-stream/passthrough.js'); - -// Backwards-compat with node 0.4.x -Stream.Stream = Stream; - - - -// old-style streams. Note that the pipe method (the only relevant -// part of this class) is overridden in the Readable class. - -function Stream() { - EE.call(this); -} - -Stream.prototype.pipe = function(dest, options) { - var source = this; - - function ondata(chunk) { - if (dest.writable) { - if (false === dest.write(chunk) && source.pause) { - source.pause(); - } - } - } - - source.on('data', ondata); - - function ondrain() { - if (source.readable && source.resume) { - source.resume(); - } - } - - dest.on('drain', ondrain); - - // If the 'end' option is not supplied, dest.end() will be called when - // source gets the 'end' or 'close' events. Only dest.end() once. - if (!dest._isStdio && (!options || options.end !== false)) { - source.on('end', onend); - source.on('close', onclose); - } - - var didOnEnd = false; - function onend() { - if (didOnEnd) return; - didOnEnd = true; - - dest.end(); - } - - - function onclose() { - if (didOnEnd) return; - didOnEnd = true; - - if (typeof dest.destroy === 'function') dest.destroy(); - } - - // don't leave dangling pipes when there are errors. - function onerror(er) { - cleanup(); - if (EE.listenerCount(this, 'error') === 0) { - throw er; // Unhandled stream error in pipe. - } - } - - source.on('error', onerror); - dest.on('error', onerror); - - // remove all the event listeners that were added. - function cleanup() { - source.removeListener('data', ondata); - dest.removeListener('drain', ondrain); - - source.removeListener('end', onend); - source.removeListener('close', onclose); - - source.removeListener('error', onerror); - dest.removeListener('error', onerror); - - source.removeListener('end', cleanup); - source.removeListener('close', cleanup); - - dest.removeListener('close', cleanup); - } - - source.on('end', cleanup); - source.on('close', cleanup); - - dest.on('close', cleanup); - - dest.emit('pipe', source); - - // Allow for unix-like usage: A.pipe(B).pipe(C) - return dest; -}; - -},{"events":52,"inherits":75,"readable-stream/duplex.js":138,"readable-stream/passthrough.js":149,"readable-stream/readable.js":150,"readable-stream/transform.js":151,"readable-stream/writable.js":152}],156:[function(require,module,exports){ -(function (global){ -var ClientRequest = require('./lib/request') -var response = require('./lib/response') -var extend = require('xtend') -var statusCodes = require('builtin-status-codes') -var url = require('url') - -var http = exports - -http.request = function (opts, cb) { - if (typeof opts === 'string') - opts = url.parse(opts) - else - opts = extend(opts) - - // Normally, the page is loaded from http or https, so not specifying a protocol - // will result in a (valid) protocol-relative url. However, this won't work if - // the protocol is something else, like 'file:' - var defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : '' - - var protocol = opts.protocol || defaultProtocol - var host = opts.hostname || opts.host - var port = opts.port - var path = opts.path || '/' - - // Necessary for IPv6 addresses - if (host && host.indexOf(':') !== -1) - host = '[' + host + ']' - - // This may be a relative url. The browser should always be able to interpret it correctly. - opts.url = (host ? (protocol + '//' + host) : '') + (port ? ':' + port : '') + path - opts.method = (opts.method || 'GET').toUpperCase() - opts.headers = opts.headers || {} - - // Also valid opts.auth, opts.mode - - var req = new ClientRequest(opts) - if (cb) - req.on('response', cb) - return req -} - -http.get = function get (opts, cb) { - var req = http.request(opts, cb) - req.end() - return req -} - -http.ClientRequest = ClientRequest -http.IncomingMessage = response.IncomingMessage - -http.Agent = function () {} -http.Agent.defaultMaxSockets = 4 - -http.globalAgent = new http.Agent() - -http.STATUS_CODES = statusCodes - -http.METHODS = [ - 'CHECKOUT', - 'CONNECT', - 'COPY', - 'DELETE', - 'GET', - 'HEAD', - 'LOCK', - 'M-SEARCH', - 'MERGE', - 'MKACTIVITY', - 'MKCOL', - 'MOVE', - 'NOTIFY', - 'OPTIONS', - 'PATCH', - 'POST', - 'PROPFIND', - 'PROPPATCH', - 'PURGE', - 'PUT', - 'REPORT', - 'SEARCH', - 'SUBSCRIBE', - 'TRACE', - 'UNLOCK', - 'UNSUBSCRIBE' -] -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./lib/request":158,"./lib/response":159,"builtin-status-codes":50,"url":180,"xtend":189}],157:[function(require,module,exports){ -(function (global){ -exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream) - -exports.writableStream = isFunction(global.WritableStream) - -exports.abortController = isFunction(global.AbortController) - -// The xhr request to example.com may violate some restrictive CSP configurations, -// so if we're running in a browser that supports `fetch`, avoid calling getXHR() -// and assume support for certain features below. -var xhr -function getXHR () { - // Cache the xhr value - if (xhr !== undefined) return xhr - - if (global.XMLHttpRequest) { - xhr = new global.XMLHttpRequest() - // If XDomainRequest is available (ie only, where xhr might not work - // cross domain), use the page location. Otherwise use example.com - // Note: this doesn't actually make an http request. - try { - xhr.open('GET', global.XDomainRequest ? '/' : 'https://example.com') - } catch(e) { - xhr = null - } - } else { - // Service workers don't have XHR - xhr = null - } - return xhr -} - -function checkTypeSupport (type) { - var xhr = getXHR() - if (!xhr) return false - try { - xhr.responseType = type - return xhr.responseType === type - } catch (e) {} - return false -} - -// If fetch is supported, then arraybuffer will be supported too. Skip calling -// checkTypeSupport(), since that calls getXHR(). -exports.arraybuffer = exports.fetch || checkTypeSupport('arraybuffer') - -// These next two tests unavoidably show warnings in Chrome. Since fetch will always -// be used if it's available, just return false for these to avoid the warnings. -exports.msstream = !exports.fetch && checkTypeSupport('ms-stream') -exports.mozchunkedarraybuffer = !exports.fetch && checkTypeSupport('moz-chunked-arraybuffer') - -// If fetch is supported, then overrideMimeType will be supported too. Skip calling -// getXHR(). -exports.overrideMimeType = exports.fetch || (getXHR() ? isFunction(getXHR().overrideMimeType) : false) - -function isFunction (value) { - return typeof value === 'function' -} - -xhr = null // Help gc - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],158:[function(require,module,exports){ -(function (process,global,Buffer){ -var capability = require('./capability') -var inherits = require('inherits') -var response = require('./response') -var stream = require('readable-stream') - -var IncomingMessage = response.IncomingMessage -var rStates = response.readyStates - -function decideMode (preferBinary, useFetch) { - if (capability.fetch && useFetch) { - return 'fetch' - } else if (capability.mozchunkedarraybuffer) { - return 'moz-chunked-arraybuffer' - } else if (capability.msstream) { - return 'ms-stream' - } else if (capability.arraybuffer && preferBinary) { - return 'arraybuffer' - } else { - return 'text' - } -} - -var ClientRequest = module.exports = function (opts) { - var self = this - stream.Writable.call(self) - - self._opts = opts - self._body = [] - self._headers = {} - if (opts.auth) - self.setHeader('Authorization', 'Basic ' + Buffer.from(opts.auth).toString('base64')) - Object.keys(opts.headers).forEach(function (name) { - self.setHeader(name, opts.headers[name]) - }) - - var preferBinary - var useFetch = true - if (opts.mode === 'disable-fetch' || ('requestTimeout' in opts && !capability.abortController)) { - // If the use of XHR should be preferred. Not typically needed. - useFetch = false - preferBinary = true - } else if (opts.mode === 'prefer-streaming') { - // If streaming is a high priority but binary compatibility and - // the accuracy of the 'content-type' header aren't - preferBinary = false - } else if (opts.mode === 'allow-wrong-content-type') { - // If streaming is more important than preserving the 'content-type' header - preferBinary = !capability.overrideMimeType - } else if (!opts.mode || opts.mode === 'default' || opts.mode === 'prefer-fast') { - // Use binary if text streaming may corrupt data or the content-type header, or for speed - preferBinary = true - } else { - throw new Error('Invalid value for opts.mode') - } - self._mode = decideMode(preferBinary, useFetch) - self._fetchTimer = null - - self.on('finish', function () { - self._onFinish() - }) -} - -inherits(ClientRequest, stream.Writable) - -ClientRequest.prototype.setHeader = function (name, value) { - var self = this - var lowerName = name.toLowerCase() - // This check is not necessary, but it prevents warnings from browsers about setting unsafe - // headers. To be honest I'm not entirely sure hiding these warnings is a good thing, but - // http-browserify did it, so I will too. - if (unsafeHeaders.indexOf(lowerName) !== -1) - return - - self._headers[lowerName] = { - name: name, - value: value - } -} - -ClientRequest.prototype.getHeader = function (name) { - var header = this._headers[name.toLowerCase()] - if (header) - return header.value - return null -} - -ClientRequest.prototype.removeHeader = function (name) { - var self = this - delete self._headers[name.toLowerCase()] -} - -ClientRequest.prototype._onFinish = function () { - var self = this - - if (self._destroyed) - return - var opts = self._opts - - var headersObj = self._headers - var body = null - if (opts.method !== 'GET' && opts.method !== 'HEAD') { - body = new Blob(self._body, { - type: (headersObj['content-type'] || {}).value || '' - }); - } - - // create flattened list of headers - var headersList = [] - Object.keys(headersObj).forEach(function (keyName) { - var name = headersObj[keyName].name - var value = headersObj[keyName].value - if (Array.isArray(value)) { - value.forEach(function (v) { - headersList.push([name, v]) - }) - } else { - headersList.push([name, value]) - } - }) - - if (self._mode === 'fetch') { - var signal = null - var fetchTimer = null - if (capability.abortController) { - var controller = new AbortController() - signal = controller.signal - self._fetchAbortController = controller - - if ('requestTimeout' in opts && opts.requestTimeout !== 0) { - self._fetchTimer = global.setTimeout(function () { - self.emit('requestTimeout') - if (self._fetchAbortController) - self._fetchAbortController.abort() - }, opts.requestTimeout) - } - } - - global.fetch(self._opts.url, { - method: self._opts.method, - headers: headersList, - body: body || undefined, - mode: 'cors', - credentials: opts.withCredentials ? 'include' : 'same-origin', - signal: signal - }).then(function (response) { - self._fetchResponse = response - self._connect() - }, function (reason) { - global.clearTimeout(self._fetchTimer) - if (!self._destroyed) - self.emit('error', reason) - }) - } else { - var xhr = self._xhr = new global.XMLHttpRequest() - try { - xhr.open(self._opts.method, self._opts.url, true) - } catch (err) { - process.nextTick(function () { - self.emit('error', err) - }) - return - } - - // Can't set responseType on really old browsers - if ('responseType' in xhr) - xhr.responseType = self._mode - - if ('withCredentials' in xhr) - xhr.withCredentials = !!opts.withCredentials - - if (self._mode === 'text' && 'overrideMimeType' in xhr) - xhr.overrideMimeType('text/plain; charset=x-user-defined') - - if ('requestTimeout' in opts) { - xhr.timeout = opts.requestTimeout - xhr.ontimeout = function () { - self.emit('requestTimeout') - } - } - - headersList.forEach(function (header) { - xhr.setRequestHeader(header[0], header[1]) - }) - - self._response = null - xhr.onreadystatechange = function () { - switch (xhr.readyState) { - case rStates.LOADING: - case rStates.DONE: - self._onXHRProgress() - break - } - } - // Necessary for streaming in Firefox, since xhr.response is ONLY defined - // in onprogress, not in onreadystatechange with xhr.readyState = 3 - if (self._mode === 'moz-chunked-arraybuffer') { - xhr.onprogress = function () { - self._onXHRProgress() - } - } - - xhr.onerror = function () { - if (self._destroyed) - return - self.emit('error', new Error('XHR error')) - } - - try { - xhr.send(body) - } catch (err) { - process.nextTick(function () { - self.emit('error', err) - }) - return - } - } -} - -/** - * Checks if xhr.status is readable and non-zero, indicating no error. - * Even though the spec says it should be available in readyState 3, - * accessing it throws an exception in IE8 - */ -function statusValid (xhr) { - try { - var status = xhr.status - return (status !== null && status !== 0) - } catch (e) { - return false - } -} - -ClientRequest.prototype._onXHRProgress = function () { - var self = this - - if (!statusValid(self._xhr) || self._destroyed) - return - - if (!self._response) - self._connect() - - self._response._onXHRProgress() -} - -ClientRequest.prototype._connect = function () { - var self = this - - if (self._destroyed) - return - - self._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode, self._fetchTimer) - self._response.on('error', function(err) { - self.emit('error', err) - }) - - self.emit('response', self._response) -} - -ClientRequest.prototype._write = function (chunk, encoding, cb) { - var self = this - - self._body.push(chunk) - cb() -} - -ClientRequest.prototype.abort = ClientRequest.prototype.destroy = function () { - var self = this - self._destroyed = true - global.clearTimeout(self._fetchTimer) - if (self._response) - self._response._destroyed = true - if (self._xhr) - self._xhr.abort() - else if (self._fetchAbortController) - self._fetchAbortController.abort() -} - -ClientRequest.prototype.end = function (data, encoding, cb) { - var self = this - if (typeof data === 'function') { - cb = data - data = undefined - } - - stream.Writable.prototype.end.call(self, data, encoding, cb) -} - -ClientRequest.prototype.flushHeaders = function () {} -ClientRequest.prototype.setTimeout = function () {} -ClientRequest.prototype.setNoDelay = function () {} -ClientRequest.prototype.setSocketKeepAlive = function () {} - -// Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method -var unsafeHeaders = [ - 'accept-charset', - 'accept-encoding', - 'access-control-request-headers', - 'access-control-request-method', - 'connection', - 'content-length', - 'cookie', - 'cookie2', - 'date', - 'dnt', - 'expect', - 'host', - 'keep-alive', - 'origin', - 'referer', - 'te', - 'trailer', - 'transfer-encoding', - 'upgrade', - 'via' -] - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"./capability":157,"./response":159,"_process":133,"buffer":48,"inherits":75,"readable-stream":174}],159:[function(require,module,exports){ -(function (process,global,Buffer){ -var capability = require('./capability') -var inherits = require('inherits') -var stream = require('readable-stream') - -var rStates = exports.readyStates = { - UNSENT: 0, - OPENED: 1, - HEADERS_RECEIVED: 2, - LOADING: 3, - DONE: 4 -} - -var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode, fetchTimer) { - var self = this - stream.Readable.call(self) - - self._mode = mode - self.headers = {} - self.rawHeaders = [] - self.trailers = {} - self.rawTrailers = [] - - // Fake the 'close' event, but only once 'end' fires - self.on('end', function () { - // The nextTick is necessary to prevent the 'request' module from causing an infinite loop - process.nextTick(function () { - self.emit('close') - }) - }) - - if (mode === 'fetch') { - self._fetchResponse = response - - self.url = response.url - self.statusCode = response.status - self.statusMessage = response.statusText - - response.headers.forEach(function (header, key){ - self.headers[key.toLowerCase()] = header - self.rawHeaders.push(key, header) - }) - - if (capability.writableStream) { - var writable = new WritableStream({ - write: function (chunk) { - return new Promise(function (resolve, reject) { - if (self._destroyed) { - reject() - } else if(self.push(Buffer.from(chunk))) { - resolve() - } else { - self._resumeFetch = resolve - } - }) - }, - close: function () { - global.clearTimeout(fetchTimer) - if (!self._destroyed) - self.push(null) - }, - abort: function (err) { - if (!self._destroyed) - self.emit('error', err) - } - }) - - try { - response.body.pipeTo(writable).catch(function (err) { - global.clearTimeout(fetchTimer) - if (!self._destroyed) - self.emit('error', err) - }) - return - } catch (e) {} // pipeTo method isn't defined. Can't find a better way to feature test this - } - // fallback for when writableStream or pipeTo aren't available - var reader = response.body.getReader() - function read () { - reader.read().then(function (result) { - if (self._destroyed) - return - if (result.done) { - global.clearTimeout(fetchTimer) - self.push(null) - return - } - self.push(Buffer.from(result.value)) - read() - }).catch(function (err) { - global.clearTimeout(fetchTimer) - if (!self._destroyed) - self.emit('error', err) - }) - } - read() - } else { - self._xhr = xhr - self._pos = 0 - - self.url = xhr.responseURL - self.statusCode = xhr.status - self.statusMessage = xhr.statusText - var headers = xhr.getAllResponseHeaders().split(/\r?\n/) - headers.forEach(function (header) { - var matches = header.match(/^([^:]+):\s*(.*)/) - if (matches) { - var key = matches[1].toLowerCase() - if (key === 'set-cookie') { - if (self.headers[key] === undefined) { - self.headers[key] = [] - } - self.headers[key].push(matches[2]) - } else if (self.headers[key] !== undefined) { - self.headers[key] += ', ' + matches[2] - } else { - self.headers[key] = matches[2] - } - self.rawHeaders.push(matches[1], matches[2]) - } - }) - - self._charset = 'x-user-defined' - if (!capability.overrideMimeType) { - var mimeType = self.rawHeaders['mime-type'] - if (mimeType) { - var charsetMatch = mimeType.match(/;\s*charset=([^;])(;|$)/) - if (charsetMatch) { - self._charset = charsetMatch[1].toLowerCase() - } - } - if (!self._charset) - self._charset = 'utf-8' // best guess - } - } -} - -inherits(IncomingMessage, stream.Readable) - -IncomingMessage.prototype._read = function () { - var self = this - - var resolve = self._resumeFetch - if (resolve) { - self._resumeFetch = null - resolve() - } -} - -IncomingMessage.prototype._onXHRProgress = function () { - var self = this - - var xhr = self._xhr - - var response = null - switch (self._mode) { - case 'text': - response = xhr.responseText - if (response.length > self._pos) { - var newData = response.substr(self._pos) - if (self._charset === 'x-user-defined') { - var buffer = Buffer.alloc(newData.length) - for (var i = 0; i < newData.length; i++) - buffer[i] = newData.charCodeAt(i) & 0xff - - self.push(buffer) - } else { - self.push(newData, self._charset) - } - self._pos = response.length - } - break - case 'arraybuffer': - if (xhr.readyState !== rStates.DONE || !xhr.response) - break - response = xhr.response - self.push(Buffer.from(new Uint8Array(response))) - break - case 'moz-chunked-arraybuffer': // take whole - response = xhr.response - if (xhr.readyState !== rStates.LOADING || !response) - break - self.push(Buffer.from(new Uint8Array(response))) - break - case 'ms-stream': - response = xhr.response - if (xhr.readyState !== rStates.LOADING) - break - var reader = new global.MSStreamReader() - reader.onprogress = function () { - if (reader.result.byteLength > self._pos) { - self.push(Buffer.from(new Uint8Array(reader.result.slice(self._pos)))) - self._pos = reader.result.byteLength - } - } - reader.onload = function () { - self.push(null) - } - // reader.onerror = ??? // TODO: this - reader.readAsArrayBuffer(response) - break - } - - // The ms-stream case handles end separately in reader.onload() - if (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') { - self.push(null) - } -} - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer) -},{"./capability":157,"_process":133,"buffer":48,"inherits":75,"readable-stream":174}],160:[function(require,module,exports){ -'use strict'; - -function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } - -var codes = {}; - -function createErrorType(code, message, Base) { - if (!Base) { - Base = Error; - } - - function getMessage(arg1, arg2, arg3) { - if (typeof message === 'string') { - return message; - } else { - return message(arg1, arg2, arg3); - } - } - - var NodeError = - /*#__PURE__*/ - function (_Base) { - _inheritsLoose(NodeError, _Base); - - function NodeError(arg1, arg2, arg3) { - return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; - } - - return NodeError; - }(Base); - - NodeError.prototype.name = Base.name; - NodeError.prototype.code = code; - codes[code] = NodeError; -} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js - - -function oneOf(expected, thing) { - if (Array.isArray(expected)) { - var len = expected.length; - expected = expected.map(function (i) { - return String(i); - }); - - if (len > 2) { - return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1]; - } else if (len === 2) { - return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); - } else { - return "of ".concat(thing, " ").concat(expected[0]); - } - } else { - return "of ".concat(thing, " ").concat(String(expected)); - } -} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith - - -function startsWith(str, search, pos) { - return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; -} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith - - -function endsWith(str, search, this_len) { - if (this_len === undefined || this_len > str.length) { - this_len = str.length; - } - - return str.substring(this_len - search.length, this_len) === search; -} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes - - -function includes(str, search, start) { - if (typeof start !== 'number') { - start = 0; - } - - if (start + search.length > str.length) { - return false; - } else { - return str.indexOf(search, start) !== -1; - } -} - -createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { - return 'The value "' + value + '" is invalid for option "' + name + '"'; -}, TypeError); -createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { - // determiner: 'must be' or 'must not be' - var determiner; - - if (typeof expected === 'string' && startsWith(expected, 'not ')) { - determiner = 'must not be'; - expected = expected.replace(/^not /, ''); - } else { - determiner = 'must be'; - } - - var msg; - - if (endsWith(name, ' argument')) { - // For cases like 'first argument' - msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); - } else { - var type = includes(name, '.') ? 'property' : 'argument'; - msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); - } - - msg += ". Received type ".concat(typeof actual); - return msg; -}, TypeError); -createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); -createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { - return 'The ' + name + ' method is not implemented'; -}); -createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); -createErrorType('ERR_STREAM_DESTROYED', function (name) { - return 'Cannot call ' + name + ' after a stream was destroyed'; -}); -createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); -createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); -createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); -createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); -createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { - return 'Unknown encoding: ' + arg; -}, TypeError); -createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); -module.exports.codes = codes; - -},{}],161:[function(require,module,exports){ -(function (process){ -'use strict' - -var experimentalWarnings = new Set(); - -function emitExperimentalWarning(feature) { - if (experimentalWarnings.has(feature)) return; - var msg = feature + ' is an experimental feature. This feature could ' + - 'change at any time'; - experimentalWarnings.add(feature); - process.emitWarning(msg, 'ExperimentalWarning'); -} - -function noop() {} - -module.exports.emitExperimentalWarning = process.emitWarning - ? emitExperimentalWarning - : noop; - -}).call(this,require('_process')) -},{"_process":133}],162:[function(require,module,exports){ -(function (process){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototypal inheritance, this class -// prototypally inherits from Readable, and then parasitically from -// Writable. -'use strict'; -/**/ - -var objectKeys = Object.keys || function (obj) { - var keys = []; - - for (var key in obj) { - keys.push(key); - } - - return keys; -}; -/**/ - - -module.exports = Duplex; - -var Readable = require('./_stream_readable'); - -var Writable = require('./_stream_writable'); - -require('inherits')(Duplex, Readable); - -{ - // Allow the keys array to be GC'ed. - var keys = objectKeys(Writable.prototype); - - for (var v = 0; v < keys.length; v++) { - var method = keys[v]; - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; - } -} - -function Duplex(options) { - if (!(this instanceof Duplex)) return new Duplex(options); - Readable.call(this, options); - Writable.call(this, options); - this.allowHalfOpen = true; - - if (options) { - if (options.readable === false) this.readable = false; - if (options.writable === false) this.writable = false; - - if (options.allowHalfOpen === false) { - this.allowHalfOpen = false; - this.once('end', onend); - } - } -} - -Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.highWaterMark; - } -}); -Object.defineProperty(Duplex.prototype, 'writableBuffer', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState && this._writableState.getBuffer(); - } -}); -Object.defineProperty(Duplex.prototype, 'writableLength', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.length; - } -}); // the no-half-open enforcer - -function onend() { - // If the writable side ended, then we're ok. - if (this._writableState.ended) return; // no more data can be written. - // But allow more writes to happen in this tick. - - process.nextTick(onEndNT, this); -} - -function onEndNT(self) { - self.end(); -} - -Object.defineProperty(Duplex.prototype, 'destroyed', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - if (this._readableState === undefined || this._writableState === undefined) { - return false; - } - - return this._readableState.destroyed && this._writableState.destroyed; - }, - set: function set(value) { - // we ignore the value if the stream - // has not been initialized yet - if (this._readableState === undefined || this._writableState === undefined) { - return; - } // backward compatibility, the user is explicitly - // managing destroyed - - - this._readableState.destroyed = value; - this._writableState.destroyed = value; - } -}); -}).call(this,require('_process')) -},{"./_stream_readable":164,"./_stream_writable":166,"_process":133,"inherits":75}],163:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. -// a passthrough stream. -// basically just the most minimal sort of Transform stream. -// Every written chunk gets output as-is. -'use strict'; - -module.exports = PassThrough; - -var Transform = require('./_stream_transform'); - -require('inherits')(PassThrough, Transform); - -function PassThrough(options) { - if (!(this instanceof PassThrough)) return new PassThrough(options); - Transform.call(this, options); -} - -PassThrough.prototype._transform = function (chunk, encoding, cb) { - cb(null, chunk); -}; -},{"./_stream_transform":165,"inherits":75}],164:[function(require,module,exports){ -(function (process,global){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. -'use strict'; - -module.exports = Readable; -/**/ - -var Duplex; -/**/ - -Readable.ReadableState = ReadableState; -/**/ - -var EE = require('events').EventEmitter; - -var EElistenerCount = function EElistenerCount(emitter, type) { - return emitter.listeners(type).length; -}; -/**/ - -/**/ - - -var Stream = require('./internal/streams/stream'); -/**/ - - -var Buffer = require('buffer').Buffer; - -var OurUint8Array = global.Uint8Array || function () {}; - -function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); -} - -function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; -} -/**/ - - -var debugUtil = require('util'); - -var debug; - -if (debugUtil && debugUtil.debuglog) { - debug = debugUtil.debuglog('stream'); -} else { - debug = function debug() {}; -} -/**/ - - -var BufferList = require('./internal/streams/buffer_list'); - -var destroyImpl = require('./internal/streams/destroy'); - -var _require = require('./internal/streams/state'), - getHighWaterMark = _require.getHighWaterMark; - -var _require$codes = require('../errors').codes, - ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, - ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; - -var _require2 = require('../experimentalWarning'), - emitExperimentalWarning = _require2.emitExperimentalWarning; // Lazy loaded to improve the startup performance. - - -var StringDecoder; -var createReadableStreamAsyncIterator; - -require('inherits')(Readable, Stream); - -var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; - -function prependListener(emitter, event, fn) { - // Sadly this is not cacheable as some libraries bundle their own - // event emitter implementation with them. - if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any - // userland ones. NEVER DO THIS. This is here only because this code needs - // to continue to work with older versions of Node.js that do not include - // the prependListener() method. The goal is to eventually remove this hack. - - if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; -} - -function ReadableState(options, stream, isDuplex) { - Duplex = Duplex || require('./_stream_duplex'); - options = options || {}; // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. - - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - - this.objectMode = !!options.objectMode; - if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - - this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the - // linked list can remove elements from the beginning faster than - // array.shift() - - this.buffer = new BufferList(); - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted - // immediately, or on a later tick. We set this to true at first, because - // any actions that shouldn't happen until "later" should generally also - // not happen before the first read call. - - this.sync = true; // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - this.resumeScheduled = false; - this.paused = true; // Should close be emitted on destroy. Defaults to true. - - this.emitClose = options.emitClose !== false; // has it been destroyed - - this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - - this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s - - this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled - - this.readingMore = false; - this.decoder = null; - this.encoding = null; - - if (options.encoding) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } -} - -function Readable(options) { - Duplex = Duplex || require('./_stream_duplex'); - if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside - // the ReadableState constructor, at least with V8 6.5 - - var isDuplex = this instanceof Duplex; - this._readableState = new ReadableState(options, this, isDuplex); // legacy - - this.readable = true; - - if (options) { - if (typeof options.read === 'function') this._read = options.read; - if (typeof options.destroy === 'function') this._destroy = options.destroy; - } - - Stream.call(this); -} - -Object.defineProperty(Readable.prototype, 'destroyed', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - if (this._readableState === undefined) { - return false; - } - - return this._readableState.destroyed; - }, - set: function set(value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._readableState) { - return; - } // backward compatibility, the user is explicitly - // managing destroyed - - - this._readableState.destroyed = value; - } -}); -Readable.prototype.destroy = destroyImpl.destroy; -Readable.prototype._undestroy = destroyImpl.undestroy; - -Readable.prototype._destroy = function (err, cb) { - cb(err); -}; // Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. - - -Readable.prototype.push = function (chunk, encoding) { - var state = this._readableState; - var skipChunkCheck; - - if (!state.objectMode) { - if (typeof chunk === 'string') { - encoding = encoding || state.defaultEncoding; - - if (encoding !== state.encoding) { - chunk = Buffer.from(chunk, encoding); - encoding = ''; - } - - skipChunkCheck = true; - } - } else { - skipChunkCheck = true; - } - - return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); -}; // Unshift should *always* be something directly out of read() - - -Readable.prototype.unshift = function (chunk) { - return readableAddChunk(this, chunk, null, true, false); -}; - -function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { - debug('readableAddChunk', chunk); - var state = stream._readableState; - - if (chunk === null) { - state.reading = false; - onEofChunk(stream, state); - } else { - var er; - if (!skipChunkCheck) er = chunkInvalid(state, chunk); - - if (er) { - stream.emit('error', er); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { - chunk = _uint8ArrayToBuffer(chunk); - } - - if (addToFront) { - if (state.endEmitted) stream.emit('error', new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true); - } else if (state.ended) { - stream.emit('error', new ERR_STREAM_PUSH_AFTER_EOF()); - } else if (state.destroyed) { - return false; - } else { - state.reading = false; - - if (state.decoder && !encoding) { - chunk = state.decoder.write(chunk); - if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); - } else { - addChunk(stream, state, chunk, false); - } - } - } else if (!addToFront) { - state.reading = false; - maybeReadMore(stream, state); - } - } // We can push more data if we are below the highWaterMark. - // Also, if we have no data yet, we can stand some more bytes. - // This is to work around cases where hwm=0, such as the repl. - - - return !state.ended && (state.length < state.highWaterMark || state.length === 0); -} - -function addChunk(stream, state, chunk, addToFront) { - if (state.flowing && state.length === 0 && !state.sync) { - state.awaitDrain = 0; - stream.emit('data', chunk); - } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); - if (state.needReadable) emitReadable(stream); - } - - maybeReadMore(stream, state); -} - -function chunkInvalid(state, chunk) { - var er; - - if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { - er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk); - } - - return er; -} - -Readable.prototype.isPaused = function () { - return this._readableState.flowing === false; -}; // backwards compatibility. - - -Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this._readableState.decoder = new StringDecoder(enc); // if setEncoding(null), decoder.encoding equals utf8 - - this._readableState.encoding = this._readableState.decoder.encoding; - return this; -}; // Don't raise the hwm > 8MB - - -var MAX_HWM = 0x800000; - -function computeNewHighWaterMark(n) { - if (n >= MAX_HWM) { - n = MAX_HWM; - } else { - // Get the next highest power of 2 to prevent increasing hwm excessively in - // tiny amounts - n--; - n |= n >>> 1; - n |= n >>> 2; - n |= n >>> 4; - n |= n >>> 8; - n |= n >>> 16; - n++; - } - - return n; -} // This function is designed to be inlinable, so please take care when making -// changes to the function body. - - -function howMuchToRead(n, state) { - if (n <= 0 || state.length === 0 && state.ended) return 0; - if (state.objectMode) return 1; - - if (n !== n) { - // Only flow one buffer at a time - if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; - } // If we're asking for more than the current hwm, then raise the hwm. - - - if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); - if (n <= state.length) return n; // Don't have enough - - if (!state.ended) { - state.needReadable = true; - return 0; - } - - return state.length; -} // you can override either this method, or the async _read(n) below. - - -Readable.prototype.read = function (n) { - debug('read', n); - n = parseInt(n, 10); - var state = this._readableState; - var nOrig = n; - if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - - if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); - return null; - } - - n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up. - - if (n === 0 && state.ended) { - if (state.length === 0) endReadable(this); - return null; - } // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - // if we need a readable event, then we need to do some reading. - - - var doRead = state.needReadable; - debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some - - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug('length less than watermark', doRead); - } // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - - - if (state.ended || state.reading) { - doRead = false; - debug('reading or ended', doRead); - } else if (doRead) { - debug('do read'); - state.reading = true; - state.sync = true; // if the length is currently zero, then we *need* a readable event. - - if (state.length === 0) state.needReadable = true; // call internal read method - - this._read(state.highWaterMark); - - state.sync = false; // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - - if (!state.reading) n = howMuchToRead(nOrig, state); - } - - var ret; - if (n > 0) ret = fromList(n, state);else ret = null; - - if (ret === null) { - state.needReadable = true; - n = 0; - } else { - state.length -= n; - state.awaitDrain = 0; - } - - if (state.length === 0) { - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick. - - if (nOrig !== n && state.ended) endReadable(this); - } - - if (ret !== null) this.emit('data', ret); - return ret; -}; - -function onEofChunk(stream, state) { - if (state.ended) return; - - if (state.decoder) { - var chunk = state.decoder.end(); - - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - - state.ended = true; - - if (state.sync) { - // if we are sync, wait until next tick to emit the data. - // Otherwise we risk emitting data in the flow() - // the readable code triggers during a read() call - emitReadable(stream); - } else { - // emit 'readable' now to make sure it gets picked up. - state.needReadable = false; - - if (!state.emittedReadable) { - state.emittedReadable = true; - emitReadable_(stream); - } - } -} // Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. - - -function emitReadable(stream) { - var state = stream._readableState; - state.needReadable = false; - - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - process.nextTick(emitReadable_, stream); - } -} - -function emitReadable_(stream) { - var state = stream._readableState; - debug('emitReadable_', state.destroyed, state.length, state.ended); - - if (!state.destroyed && (state.length || state.ended)) { - stream.emit('readable'); - } // The stream needs another readable event if - // 1. It is not flowing, as the flow mechanism will take - // care of it. - // 2. It is not ended. - // 3. It is below the highWaterMark, so we can schedule - // another readable later. - - - state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; - flow(stream); -} // at this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. - - -function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - process.nextTick(maybeReadMore_, stream, state); - } -} - -function maybeReadMore_(stream, state) { - // Attempt to read more data if we should. - // - // The conditions for reading more data are (one of): - // - Not enough data buffered (state.length < state.highWaterMark). The loop - // is responsible for filling the buffer with enough data if such data - // is available. If highWaterMark is 0 and we are not in the flowing mode - // we should _not_ attempt to buffer any extra data. We'll get more data - // when the stream consumer calls read() instead. - // - No data in the buffer, and the stream is in flowing mode. In this mode - // the loop below is responsible for ensuring read() is called. Failing to - // call read here would abort the flow and there's no other mechanism for - // continuing the flow if the stream consumer has just subscribed to the - // 'data' event. - // - // In addition to the above conditions to keep reading data, the following - // conditions prevent the data from being read: - // - The stream has ended (state.ended). - // - There is already a pending 'read' operation (state.reading). This is a - // case where the the stream has called the implementation defined _read() - // method, but they are processing the call asynchronously and have _not_ - // called push() with new data. In this case we skip performing more - // read()s. The execution ends in this method again after the _read() ends - // up calling push() with more data. - while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { - var len = state.length; - debug('maybeReadMore read 0'); - stream.read(0); - if (len === state.length) // didn't get any data, stop spinning. - break; - } - - state.readingMore = false; -} // abstract method. to be overridden in specific implementation classes. -// call cb(er, data) where data is <= n in length. -// for virtual (non-string, non-buffer) streams, "length" is somewhat -// arbitrary, and perhaps not very meaningful. - - -Readable.prototype._read = function (n) { - this.emit('error', new ERR_METHOD_NOT_IMPLEMENTED('_read()')); -}; - -Readable.prototype.pipe = function (dest, pipeOpts) { - var src = this; - var state = this._readableState; - - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - - case 1: - state.pipes = [state.pipes, dest]; - break; - - default: - state.pipes.push(dest); - break; - } - - state.pipesCount += 1; - debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); - var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; - var endFn = doEnd ? onend : unpipe; - if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn); - dest.on('unpipe', onunpipe); - - function onunpipe(readable, unpipeInfo) { - debug('onunpipe'); - - if (readable === src) { - if (unpipeInfo && unpipeInfo.hasUnpiped === false) { - unpipeInfo.hasUnpiped = true; - cleanup(); - } - } - } - - function onend() { - debug('onend'); - dest.end(); - } // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - - - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); - var cleanedUp = false; - - function cleanup() { - debug('cleanup'); // cleanup event handlers once the pipe is broken - - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', unpipe); - src.removeListener('data', ondata); - cleanedUp = true; // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - - if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); - } - - src.on('data', ondata); - - function ondata(chunk) { - debug('ondata'); - var ret = dest.write(chunk); - debug('dest.write', ret); - - if (ret === false) { - // If the user unpiped during `dest.write()`, it is possible - // to get stuck in a permanently paused state if that write - // also returned false. - // => Check whether `dest` is still a piping destination. - if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { - debug('false write response, pause', state.awaitDrain); - state.awaitDrain++; - } - - src.pause(); - } - } // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - - - function onerror(er) { - debug('onerror', er); - unpipe(); - dest.removeListener('error', onerror); - if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); - } // Make sure our error handler is attached before userland ones. - - - prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once. - - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - - dest.once('close', onclose); - - function onfinish() { - debug('onfinish'); - dest.removeListener('close', onclose); - unpipe(); - } - - dest.once('finish', onfinish); - - function unpipe() { - debug('unpipe'); - src.unpipe(dest); - } // tell the dest that it's being piped to - - - dest.emit('pipe', src); // start the flow if it hasn't been started already. - - if (!state.flowing) { - debug('pipe resume'); - src.resume(); - } - - return dest; -}; - -function pipeOnDrain(src) { - return function pipeOnDrainFunctionResult() { - var state = src._readableState; - debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) state.awaitDrain--; - - if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { - state.flowing = true; - flow(src); - } - }; -} - -Readable.prototype.unpipe = function (dest) { - var state = this._readableState; - var unpipeInfo = { - hasUnpiped: false - }; // if we're not piping anywhere, then do nothing. - - if (state.pipesCount === 0) return this; // just one destination. most common case. - - if (state.pipesCount === 1) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) return this; - if (!dest) dest = state.pipes; // got a match. - - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) dest.emit('unpipe', this, unpipeInfo); - return this; - } // slow case. multiple pipe destinations. - - - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - - for (var i = 0; i < len; i++) { - dests[i].emit('unpipe', this, { - hasUnpiped: false - }); - } - - return this; - } // try to find the right one. - - - var index = indexOf(state.pipes, dest); - if (index === -1) return this; - state.pipes.splice(index, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) state.pipes = state.pipes[0]; - dest.emit('unpipe', this, unpipeInfo); - return this; -}; // set up data events if they are asked for -// Ensure readable listeners eventually get something - - -Readable.prototype.on = function (ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - var state = this._readableState; - - if (ev === 'data') { - // update readableListening so that resume() may be a no-op - // a few lines down. This is needed to support once('readable'). - state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused - - if (state.flowing !== false) this.resume(); - } else if (ev === 'readable') { - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true; - state.flowing = false; - state.emittedReadable = false; - debug('on readable', state.length, state.reading); - - if (state.length) { - emitReadable(this); - } else if (!state.reading) { - process.nextTick(nReadingNextTick, this); - } - } - } - - return res; -}; - -Readable.prototype.addListener = Readable.prototype.on; - -Readable.prototype.removeListener = function (ev, fn) { - var res = Stream.prototype.removeListener.call(this, ev, fn); - - if (ev === 'readable') { - // We need to check if there is someone still listening to - // readable and reset the state. However this needs to happen - // after readable has been emitted but before I/O (nextTick) to - // support once('readable', fn) cycles. This means that calling - // resume within the same tick will have no - // effect. - process.nextTick(updateReadableListening, this); - } - - return res; -}; - -Readable.prototype.removeAllListeners = function (ev) { - var res = Stream.prototype.removeAllListeners.apply(this, arguments); - - if (ev === 'readable' || ev === undefined) { - // We need to check if there is someone still listening to - // readable and reset the state. However this needs to happen - // after readable has been emitted but before I/O (nextTick) to - // support once('readable', fn) cycles. This means that calling - // resume within the same tick will have no - // effect. - process.nextTick(updateReadableListening, this); - } - - return res; -}; - -function updateReadableListening(self) { - var state = self._readableState; - state.readableListening = self.listenerCount('readable') > 0; - - if (state.resumeScheduled && !state.paused) { - // flowing needs to be set to true now, otherwise - // the upcoming resume will not flow. - state.flowing = true; // crude way to check if we should resume - } else if (self.listenerCount('data') > 0) { - self.resume(); - } -} - -function nReadingNextTick(self) { - debug('readable nexttick read 0'); - self.read(0); -} // pause() and resume() are remnants of the legacy readable stream API -// If the user uses them, then switch into old mode. - - -Readable.prototype.resume = function () { - var state = this._readableState; - - if (!state.flowing) { - debug('resume'); // we flow only if there is no one listening - // for readable, but we still have to call - // resume() - - state.flowing = !state.readableListening; - resume(this, state); - } - - state.paused = false; - return this; -}; - -function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - process.nextTick(resume_, stream, state); - } -} - -function resume_(stream, state) { - debug('resume', state.reading); - - if (!state.reading) { - stream.read(0); - } - - state.resumeScheduled = false; - stream.emit('resume'); - flow(stream); - if (state.flowing && !state.reading) stream.read(0); -} - -Readable.prototype.pause = function () { - debug('call pause flowing=%j', this._readableState.flowing); - - if (this._readableState.flowing !== false) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); - } - - this._readableState.paused = true; - return this; -}; - -function flow(stream) { - var state = stream._readableState; - debug('flow', state.flowing); - - while (state.flowing && stream.read() !== null) { - ; - } -} // wrap an old-style stream as the async data source. -// This is *not* part of the readable stream interface. -// It is an ugly unfortunate mess of history. - - -Readable.prototype.wrap = function (stream) { - var _this = this; - - var state = this._readableState; - var paused = false; - stream.on('end', function () { - debug('wrapped end'); - - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) _this.push(chunk); - } - - _this.push(null); - }); - stream.on('data', function (chunk) { - debug('wrapped data'); - if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode - - if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; - - var ret = _this.push(chunk); - - if (!ret) { - paused = true; - stream.pause(); - } - }); // proxy all the other methods. - // important when wrapping filters and duplexes. - - for (var i in stream) { - if (this[i] === undefined && typeof stream[i] === 'function') { - this[i] = function methodWrap(method) { - return function methodWrapReturnFunction() { - return stream[method].apply(stream, arguments); - }; - }(i); - } - } // proxy certain important events. - - - for (var n = 0; n < kProxyEvents.length; n++) { - stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); - } // when we try to consume some more bytes, simply unpause the - // underlying stream. - - - this._read = function (n) { - debug('wrapped _read', n); - - if (paused) { - paused = false; - stream.resume(); - } - }; - - return this; -}; - -if (typeof Symbol === 'function') { - Readable.prototype[Symbol.asyncIterator] = function () { - emitExperimentalWarning('Readable[Symbol.asyncIterator]'); - - if (createReadableStreamAsyncIterator === undefined) { - createReadableStreamAsyncIterator = require('./internal/streams/async_iterator'); - } - - return createReadableStreamAsyncIterator(this); - }; -} - -Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState.highWaterMark; - } -}); -Object.defineProperty(Readable.prototype, 'readableBuffer', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState && this._readableState.buffer; - } -}); -Object.defineProperty(Readable.prototype, 'readableFlowing', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState.flowing; - }, - set: function set(state) { - if (this._readableState) { - this._readableState.flowing = state; - } - } -}); // exposed for testing purposes only. - -Readable._fromList = fromList; -Object.defineProperty(Readable.prototype, 'readableLength', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState.length; - } -}); // Pluck off n bytes from an array of buffers. -// Length is the combined lengths of all the buffers in the list. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. - -function fromList(n, state) { - // nothing buffered - if (state.length === 0) return null; - var ret; - if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { - // read it all, truncate the list - if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length); - state.buffer.clear(); - } else { - // read part of list - ret = state.buffer.consume(n, state.decoder); - } - return ret; -} - -function endReadable(stream) { - var state = stream._readableState; - debug('endReadable', state.endEmitted); - - if (!state.endEmitted) { - state.ended = true; - process.nextTick(endReadableNT, state, stream); - } -} - -function endReadableNT(state, stream) { - debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift. - - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - } -} - -function indexOf(xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) return i; - } - - return -1; -} -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../errors":160,"../experimentalWarning":161,"./_stream_duplex":162,"./internal/streams/async_iterator":167,"./internal/streams/buffer_list":168,"./internal/streams/destroy":169,"./internal/streams/state":172,"./internal/streams/stream":173,"_process":133,"buffer":48,"events":52,"inherits":75,"string_decoder/":175,"util":33}],165:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. -// a transform stream is a readable/writable stream where you do -// something with the data. Sometimes it's called a "filter", -// but that's not a great name for it, since that implies a thing where -// some bits pass through, and others are simply ignored. (That would -// be a valid example of a transform, of course.) -// -// While the output is causally related to the input, it's not a -// necessarily symmetric or synchronous transformation. For example, -// a zlib stream might take multiple plain-text writes(), and then -// emit a single compressed chunk some time in the future. -// -// Here's how this works: -// -// The Transform stream has all the aspects of the readable and writable -// stream classes. When you write(chunk), that calls _write(chunk,cb) -// internally, and returns false if there's a lot of pending writes -// buffered up. When you call read(), that calls _read(n) until -// there's enough pending readable data buffered up. -// -// In a transform stream, the written data is placed in a buffer. When -// _read(n) is called, it transforms the queued up data, calling the -// buffered _write cb's as it consumes chunks. If consuming a single -// written chunk would result in multiple output chunks, then the first -// outputted bit calls the readcb, and subsequent chunks just go into -// the read buffer, and will cause it to emit 'readable' if necessary. -// -// This way, back-pressure is actually determined by the reading side, -// since _read has to be called to start processing a new chunk. However, -// a pathological inflate type of transform can cause excessive buffering -// here. For example, imagine a stream where every byte of input is -// interpreted as an integer from 0-255, and then results in that many -// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in -// 1kb of data being output. In this case, you could write a very small -// amount of input, and end up with a very large amount of output. In -// such a pathological inflating mechanism, there'd be no way to tell -// the system to stop doing the transform. A single 4MB write could -// cause the system to run out of memory. -// -// However, even in such a pathological case, only a single written chunk -// would be consumed, and then the rest would wait (un-transformed) until -// the results of the previous transformed chunk were consumed. -'use strict'; - -module.exports = Transform; - -var _require$codes = require('../errors').codes, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, - ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, - ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; - -var Duplex = require('./_stream_duplex'); - -require('inherits')(Transform, Duplex); - -function afterTransform(er, data) { - var ts = this._transformState; - ts.transforming = false; - var cb = ts.writecb; - - if (cb === null) { - return this.emit('error', new ERR_MULTIPLE_CALLBACK()); - } - - ts.writechunk = null; - ts.writecb = null; - if (data != null) // single equals check for both `null` and `undefined` - this.push(data); - cb(er); - var rs = this._readableState; - rs.reading = false; - - if (rs.needReadable || rs.length < rs.highWaterMark) { - this._read(rs.highWaterMark); - } -} - -function Transform(options) { - if (!(this instanceof Transform)) return new Transform(options); - Duplex.call(this, options); - this._transformState = { - afterTransform: afterTransform.bind(this), - needTransform: false, - transforming: false, - writecb: null, - writechunk: null, - writeencoding: null - }; // start out asking for a readable event once data is transformed. - - this._readableState.needReadable = true; // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - - this._readableState.sync = false; - - if (options) { - if (typeof options.transform === 'function') this._transform = options.transform; - if (typeof options.flush === 'function') this._flush = options.flush; - } // When the writable side finishes, then flush out anything remaining. - - - this.on('prefinish', prefinish); -} - -function prefinish() { - var _this = this; - - if (typeof this._flush === 'function' && !this._readableState.destroyed) { - this._flush(function (er, data) { - done(_this, er, data); - }); - } else { - done(this, null, null); - } -} - -Transform.prototype.push = function (chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); -}; // This is the part where you do stuff! -// override this function in implementation classes. -// 'chunk' is an input chunk. -// -// Call `push(newChunk)` to pass along transformed output -// to the readable side. You may call 'push' zero or more times. -// -// Call `cb(err)` when you are done with this chunk. If you pass -// an error, then that'll put the hurt on the whole operation. If you -// never call cb(), then you'll never get another chunk. - - -Transform.prototype._transform = function (chunk, encoding, cb) { - cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()')); -}; - -Transform.prototype._write = function (chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); - } -}; // Doesn't matter what the args are here. -// _transform does all the work. -// That we got here means that the readable side wants more data. - - -Transform.prototype._read = function (n) { - var ts = this._transformState; - - if (ts.writechunk !== null && !ts.transforming) { - ts.transforming = true; - - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - } -}; - -Transform.prototype._destroy = function (err, cb) { - Duplex.prototype._destroy.call(this, err, function (err2) { - cb(err2); - }); -}; - -function done(stream, er, data) { - if (er) return stream.emit('error', er); - if (data != null) // single equals check for both `null` and `undefined` - stream.push(data); // TODO(BridgeAR): Write a test for these two error cases - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - - if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0(); - if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); - return stream.push(null); -} -},{"../errors":160,"./_stream_duplex":162,"inherits":75}],166:[function(require,module,exports){ -(function (process,global){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. -// A bit simpler than readable streams. -// Implement an async ._write(chunk, encoding, cb), and it'll handle all -// the drain event emission and buffering. -'use strict'; - -module.exports = Writable; -/* */ - -function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; - this.next = null; -} // It seems a linked list but it is not -// there will be only 2 of these for each stream - - -function CorkedRequest(state) { - var _this = this; - - this.next = null; - this.entry = null; - - this.finish = function () { - onCorkedFinish(_this, state); - }; -} -/* */ - -/**/ - - -var Duplex; -/**/ - -Writable.WritableState = WritableState; -/**/ - -var internalUtil = { - deprecate: require('util-deprecate') -}; -/**/ - -/**/ - -var Stream = require('./internal/streams/stream'); -/**/ - - -var Buffer = require('buffer').Buffer; - -var OurUint8Array = global.Uint8Array || function () {}; - -function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); -} - -function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; -} - -var destroyImpl = require('./internal/streams/destroy'); - -var _require = require('./internal/streams/state'), - getHighWaterMark = _require.getHighWaterMark; - -var _require$codes = require('../errors').codes, - ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, - ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, - ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, - ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, - ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, - ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; - -require('inherits')(Writable, Stream); - -function nop() {} - -function WritableState(options, stream, isDuplex) { - Duplex = Duplex || require('./_stream_duplex'); - options = options || {}; // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream, - // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. - - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream - // contains buffers or objects. - - this.objectMode = !!options.objectMode; - if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write() - - this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called - - this.finalCalled = false; // drain event flag. - - this.needDrain = false; // at the start of calling end() - - this.ending = false; // when end() has been called, and returned - - this.ended = false; // when 'finish' is emitted - - this.finished = false; // has it been destroyed - - this.destroyed = false; // should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - - this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - - this.length = 0; // a flag to see when we're in the middle of a write. - - this.writing = false; // when true all writes will be buffered until .uncork() call - - this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - - this.sync = true; // a flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - - this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb) - - this.onwrite = function (er) { - onwrite(stream, er); - }; // the callback that the user supplies to write(chunk,encoding,cb) - - - this.writecb = null; // the amount that is being written when _write is called. - - this.writelen = 0; - this.bufferedRequest = null; - this.lastBufferedRequest = null; // number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted - - this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams - - this.prefinished = false; // True if the error was already emitted and should not be thrown again - - this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true. - - this.emitClose = options.emitClose !== false; // count buffered requests - - this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always - // one allocated and free to use, and we maintain at most two - - this.corkedRequestsFree = new CorkedRequest(this); -} - -WritableState.prototype.getBuffer = function getBuffer() { - var current = this.bufferedRequest; - var out = []; - - while (current) { - out.push(current); - current = current.next; - } - - return out; -}; - -(function () { - try { - Object.defineProperty(WritableState.prototype, 'buffer', { - get: internalUtil.deprecate(function writableStateBufferGetter() { - return this.getBuffer(); - }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') - }); - } catch (_) {} -})(); // Test _writableState for inheritance to account for Duplex streams, -// whose prototype chain only points to Readable. - - -var realHasInstance; - -if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { - realHasInstance = Function.prototype[Symbol.hasInstance]; - Object.defineProperty(Writable, Symbol.hasInstance, { - value: function value(object) { - if (realHasInstance.call(this, object)) return true; - if (this !== Writable) return false; - return object && object._writableState instanceof WritableState; - } - }); -} else { - realHasInstance = function realHasInstance(object) { - return object instanceof this; - }; -} - -function Writable(options) { - Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too. - // `realHasInstance` is necessary because using plain `instanceof` - // would return false, as no `_writableState` property is attached. - // Trying to use the custom `instanceof` for Writable here will also break the - // Node.js LazyTransform implementation, which has a non-trivial getter for - // `_writableState` that would lead to infinite recursion. - // Checking for a Stream.Duplex instance is faster here instead of inside - // the WritableState constructor, at least with V8 6.5 - - var isDuplex = this instanceof Duplex; - if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); - this._writableState = new WritableState(options, this, isDuplex); // legacy. - - this.writable = true; - - if (options) { - if (typeof options.write === 'function') this._write = options.write; - if (typeof options.writev === 'function') this._writev = options.writev; - if (typeof options.destroy === 'function') this._destroy = options.destroy; - if (typeof options.final === 'function') this._final = options.final; - } - - Stream.call(this); -} // Otherwise people can pipe Writable streams, which is just wrong. - - -Writable.prototype.pipe = function () { - this.emit('error', new ERR_STREAM_CANNOT_PIPE()); -}; - -function writeAfterEnd(stream, cb) { - var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb - - stream.emit('error', er); - process.nextTick(cb, er); -} // Checks that a user-supplied chunk is valid, especially for the particular -// mode the stream is in. Currently this means that `null` is never accepted -// and undefined/non-string values are only allowed in object mode. - - -function validChunk(stream, state, chunk, cb) { - var er; - - if (chunk === null) { - er = new ERR_STREAM_NULL_VALUES(); - } else if (typeof chunk !== 'string' && !state.objectMode) { - er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk); - } - - if (er) { - stream.emit('error', er); - process.nextTick(cb, er); - return false; - } - - return true; -} - -Writable.prototype.write = function (chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - - var isBuf = !state.objectMode && _isUint8Array(chunk); - - if (isBuf && !Buffer.isBuffer(chunk)) { - chunk = _uint8ArrayToBuffer(chunk); - } - - if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; - if (typeof cb !== 'function') cb = nop; - if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); - } - return ret; -}; - -Writable.prototype.cork = function () { - this._writableState.corked++; -}; - -Writable.prototype.uncork = function () { - var state = this._writableState; - - if (state.corked) { - state.corked--; - if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); - } -}; - -Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { - // node::ParseEncoding() requires lower case. - if (typeof encoding === 'string') encoding = encoding.toLowerCase(); - if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding); - this._writableState.defaultEncoding = encoding; - return this; -}; - -Object.defineProperty(Writable.prototype, 'writableBuffer', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState && this._writableState.getBuffer(); - } -}); - -function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { - chunk = Buffer.from(chunk, encoding); - } - - return chunk; -} - -Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.highWaterMark; - } -}); // if we're already writing something, then just put this -// in the queue, and wait our turn. Otherwise, call _write -// If we return false, then we need a drain event, so set that flag. - -function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { - if (!isBuf) { - var newChunk = decodeChunk(state, chunk, encoding); - - if (chunk !== newChunk) { - isBuf = true; - encoding = 'buffer'; - chunk = newChunk; - } - } - - var len = state.objectMode ? 1 : chunk.length; - state.length += len; - var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false. - - if (!ret) state.needDrain = true; - - if (state.writing || state.corked) { - var last = state.lastBufferedRequest; - state.lastBufferedRequest = { - chunk: chunk, - encoding: encoding, - isBuf: isBuf, - callback: cb, - next: null - }; - - if (last) { - last.next = state.lastBufferedRequest; - } else { - state.bufferedRequest = state.lastBufferedRequest; - } - - state.bufferedRequestCount += 1; - } else { - doWrite(stream, state, false, len, chunk, encoding, cb); - } - - return ret; -} - -function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); - state.sync = false; -} - -function onwriteError(stream, state, sync, er, cb) { - --state.pendingcb; - - if (sync) { - // defer the callback if we are being called synchronously - // to avoid piling up things on the stack - process.nextTick(cb, er); // this can emit finish, and it will always happen - // after error - - process.nextTick(finishMaybe, stream, state); - stream._writableState.errorEmitted = true; - stream.emit('error', er); - } else { - // the caller expect this to happen before if - // it is async - cb(er); - stream._writableState.errorEmitted = true; - stream.emit('error', er); // this can emit finish, but finish must - // always follow error - - finishMaybe(stream, state); - } -} - -function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; -} - -function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); - onwriteStateUpdate(state); - if (er) onwriteError(stream, state, sync, er, cb);else { - // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(state) || stream.destroyed; - - if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { - clearBuffer(stream, state); - } - - if (sync) { - process.nextTick(afterWrite, stream, state, finished, cb); - } else { - afterWrite(stream, state, finished, cb); - } - } -} - -function afterWrite(stream, state, finished, cb) { - if (!finished) onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); -} // Must force callback to be called on nextTick, so that we don't -// emit 'drain' before the write() consumer gets the 'false' return -// value, and has a chance to attach a 'drain' listener. - - -function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit('drain'); - } -} // if there's something in the buffer waiting, then process it - - -function clearBuffer(stream, state) { - state.bufferProcessing = true; - var entry = state.bufferedRequest; - - if (stream._writev && entry && entry.next) { - // Fast case, write everything using _writev() - var l = state.bufferedRequestCount; - var buffer = new Array(l); - var holder = state.corkedRequestsFree; - holder.entry = entry; - var count = 0; - var allBuffers = true; - - while (entry) { - buffer[count] = entry; - if (!entry.isBuf) allBuffers = false; - entry = entry.next; - count += 1; - } - - buffer.allBuffers = allBuffers; - doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time - // as the hot path ends with doWrite - - state.pendingcb++; - state.lastBufferedRequest = null; - - if (holder.next) { - state.corkedRequestsFree = holder.next; - holder.next = null; - } else { - state.corkedRequestsFree = new CorkedRequest(state); - } - - state.bufferedRequestCount = 0; - } else { - // Slow case, write chunks one-by-one - while (entry) { - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - doWrite(stream, state, false, len, chunk, encoding, cb); - entry = entry.next; - state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. - - if (state.writing) { - break; - } - } - - if (entry === null) state.lastBufferedRequest = null; - } - - state.bufferedRequest = entry; - state.bufferProcessing = false; -} - -Writable.prototype._write = function (chunk, encoding, cb) { - cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); -}; - -Writable.prototype._writev = null; - -Writable.prototype.end = function (chunk, encoding, cb) { - var state = this._writableState; - - if (typeof chunk === 'function') { - cb = chunk; - chunk = null; - encoding = null; - } else if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks - - if (state.corked) { - state.corked = 1; - this.uncork(); - } // ignore unnecessary end() calls. - - - if (!state.ending) endWritable(this, state, cb); - return this; -}; - -Object.defineProperty(Writable.prototype, 'writableLength', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.length; - } -}); - -function needFinish(state) { - return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; -} - -function callFinal(stream, state) { - stream._final(function (err) { - state.pendingcb--; - - if (err) { - stream.emit('error', err); - } - - state.prefinished = true; - stream.emit('prefinish'); - finishMaybe(stream, state); - }); -} - -function prefinish(stream, state) { - if (!state.prefinished && !state.finalCalled) { - if (typeof stream._final === 'function' && !state.destroyed) { - state.pendingcb++; - state.finalCalled = true; - process.nextTick(callFinal, stream, state); - } else { - state.prefinished = true; - stream.emit('prefinish'); - } - } -} - -function finishMaybe(stream, state) { - var need = needFinish(state); - - if (need) { - prefinish(stream, state); - - if (state.pendingcb === 0) { - state.finished = true; - stream.emit('finish'); - } - } - - return need; -} - -function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - - if (cb) { - if (state.finished) process.nextTick(cb);else stream.once('finish', cb); - } - - state.ended = true; - stream.writable = false; -} - -function onCorkedFinish(corkReq, state, err) { - var entry = corkReq.entry; - corkReq.entry = null; - - while (entry) { - var cb = entry.callback; - state.pendingcb--; - cb(err); - entry = entry.next; - } // reuse the free corkReq. - - - state.corkedRequestsFree.next = corkReq; -} - -Object.defineProperty(Writable.prototype, 'destroyed', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - if (this._writableState === undefined) { - return false; - } - - return this._writableState.destroyed; - }, - set: function set(value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._writableState) { - return; - } // backward compatibility, the user is explicitly - // managing destroyed - - - this._writableState.destroyed = value; - } -}); -Writable.prototype.destroy = destroyImpl.destroy; -Writable.prototype._undestroy = destroyImpl.undestroy; - -Writable.prototype._destroy = function (err, cb) { - cb(err); -}; -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../errors":160,"./_stream_duplex":162,"./internal/streams/destroy":169,"./internal/streams/state":172,"./internal/streams/stream":173,"_process":133,"buffer":48,"inherits":75,"util-deprecate":183}],167:[function(require,module,exports){ -(function (process){ -'use strict'; - -var _Object$setPrototypeO; - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -var finished = require('./end-of-stream'); - -var kLastResolve = Symbol('lastResolve'); -var kLastReject = Symbol('lastReject'); -var kError = Symbol('error'); -var kEnded = Symbol('ended'); -var kLastPromise = Symbol('lastPromise'); -var kHandlePromise = Symbol('handlePromise'); -var kStream = Symbol('stream'); - -function createIterResult(value, done) { - return { - value: value, - done: done - }; -} - -function readAndResolve(iter) { - var resolve = iter[kLastResolve]; - - if (resolve !== null) { - var data = iter[kStream].read(); // we defer if data is null - // we can be expecting either 'end' or - // 'error' - - if (data !== null) { - iter[kLastPromise] = null; - iter[kLastResolve] = null; - iter[kLastReject] = null; - resolve(createIterResult(data, false)); - } - } -} - -function onReadable(iter) { - // we wait for the next tick, because it might - // emit an error with process.nextTick - process.nextTick(readAndResolve, iter); -} - -function wrapForNext(lastPromise, iter) { - return function (resolve, reject) { - lastPromise.then(function () { - if (iter[kEnded]) { - resolve(createIterResult(undefined, true)); - return; - } - - iter[kHandlePromise](resolve, reject); - }, reject); - }; -} - -var AsyncIteratorPrototype = Object.getPrototypeOf(function () {}); -var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { - get stream() { - return this[kStream]; - }, - - next: function next() { - var _this = this; - - // if we have detected an error in the meanwhile - // reject straight away - var error = this[kError]; - - if (error !== null) { - return Promise.reject(error); - } - - if (this[kEnded]) { - return Promise.resolve(createIterResult(undefined, true)); - } - - if (this[kStream].destroyed) { - // We need to defer via nextTick because if .destroy(err) is - // called, the error will be emitted via nextTick, and - // we cannot guarantee that there is no error lingering around - // waiting to be emitted. - return new Promise(function (resolve, reject) { - process.nextTick(function () { - if (_this[kError]) { - reject(_this[kError]); - } else { - resolve(createIterResult(undefined, true)); - } - }); - }); - } // if we have multiple next() calls - // we will wait for the previous Promise to finish - // this logic is optimized to support for await loops, - // where next() is only called once at a time - - - var lastPromise = this[kLastPromise]; - var promise; - - if (lastPromise) { - promise = new Promise(wrapForNext(lastPromise, this)); - } else { - // fast path needed to support multiple this.push() - // without triggering the next() queue - var data = this[kStream].read(); - - if (data !== null) { - return Promise.resolve(createIterResult(data, false)); - } - - promise = new Promise(this[kHandlePromise]); - } - - this[kLastPromise] = promise; - return promise; - } -}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () { - return this; -}), _defineProperty(_Object$setPrototypeO, "return", function _return() { - var _this2 = this; - - // destroy(err, cb) is a private API - // we can guarantee we have that here, because we control the - // Readable class this is attached to - return new Promise(function (resolve, reject) { - _this2[kStream].destroy(null, function (err) { - if (err) { - reject(err); - return; - } - - resolve(createIterResult(undefined, true)); - }); - }); -}), _Object$setPrototypeO), AsyncIteratorPrototype); - -var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { - var _Object$create; - - var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { - value: stream, - writable: true - }), _defineProperty(_Object$create, kLastResolve, { - value: null, - writable: true - }), _defineProperty(_Object$create, kLastReject, { - value: null, - writable: true - }), _defineProperty(_Object$create, kError, { - value: null, - writable: true - }), _defineProperty(_Object$create, kEnded, { - value: stream._readableState.endEmitted, - writable: true - }), _defineProperty(_Object$create, kHandlePromise, { - value: function value(resolve, reject) { - var data = iterator[kStream].read(); - - if (data) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve(createIterResult(data, false)); - } else { - iterator[kLastResolve] = resolve; - iterator[kLastReject] = reject; - } - }, - writable: true - }), _Object$create)); - iterator[kLastPromise] = null; - finished(stream, function (err) { - if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { - var reject = iterator[kLastReject]; // reject if we are waiting for data in the Promise - // returned by next() and store the error - - if (reject !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - reject(err); - } - - iterator[kError] = err; - return; - } - - var resolve = iterator[kLastResolve]; - - if (resolve !== null) { - iterator[kLastPromise] = null; - iterator[kLastResolve] = null; - iterator[kLastReject] = null; - resolve(createIterResult(undefined, true)); - } - - iterator[kEnded] = true; - }); - stream.on('readable', onReadable.bind(null, iterator)); - return iterator; -}; - -module.exports = createReadableStreamAsyncIterator; -}).call(this,require('_process')) -},{"./end-of-stream":170,"_process":133}],168:[function(require,module,exports){ -'use strict'; - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -var _require = require('buffer'), - Buffer = _require.Buffer; - -var _require2 = require('util'), - inspect = _require2.inspect; - -var custom = inspect && inspect.custom || 'inspect'; - -function copyBuffer(src, target, offset) { - Buffer.prototype.copy.call(src, target, offset); -} - -module.exports = -/*#__PURE__*/ -function () { - function BufferList() { - this.head = null; - this.tail = null; - this.length = 0; - } - - var _proto = BufferList.prototype; - - _proto.push = function push(v) { - var entry = { - data: v, - next: null - }; - if (this.length > 0) this.tail.next = entry;else this.head = entry; - this.tail = entry; - ++this.length; - }; - - _proto.unshift = function unshift(v) { - var entry = { - data: v, - next: this.head - }; - if (this.length === 0) this.tail = entry; - this.head = entry; - ++this.length; - }; - - _proto.shift = function shift() { - if (this.length === 0) return; - var ret = this.head.data; - if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; - --this.length; - return ret; - }; - - _proto.clear = function clear() { - this.head = this.tail = null; - this.length = 0; - }; - - _proto.join = function join(s) { - if (this.length === 0) return ''; - var p = this.head; - var ret = '' + p.data; - - while (p = p.next) { - ret += s + p.data; - } - - return ret; - }; - - _proto.concat = function concat(n) { - if (this.length === 0) return Buffer.alloc(0); - var ret = Buffer.allocUnsafe(n >>> 0); - var p = this.head; - var i = 0; - - while (p) { - copyBuffer(p.data, ret, i); - i += p.data.length; - p = p.next; - } - - return ret; - } // Consumes a specified amount of bytes or characters from the buffered data. - ; - - _proto.consume = function consume(n, hasStrings) { - var ret; - - if (n < this.head.data.length) { - // `slice` is the same for buffers and strings. - ret = this.head.data.slice(0, n); - this.head.data = this.head.data.slice(n); - } else if (n === this.head.data.length) { - // First chunk is a perfect match. - ret = this.shift(); - } else { - // Result spans more than one buffer. - ret = hasStrings ? this._getString(n) : this._getBuffer(n); - } - - return ret; - }; - - _proto.first = function first() { - return this.head.data; - } // Consumes a specified amount of characters from the buffered data. - ; - - _proto._getString = function _getString(n) { - var p = this.head; - var c = 1; - var ret = p.data; - n -= ret.length; - - while (p = p.next) { - var str = p.data; - var nb = n > str.length ? str.length : n; - if (nb === str.length) ret += str;else ret += str.slice(0, n); - n -= nb; - - if (n === 0) { - if (nb === str.length) { - ++c; - if (p.next) this.head = p.next;else this.head = this.tail = null; - } else { - this.head = p; - p.data = str.slice(nb); - } - - break; - } - - ++c; - } - - this.length -= c; - return ret; - } // Consumes a specified amount of bytes from the buffered data. - ; - - _proto._getBuffer = function _getBuffer(n) { - var ret = Buffer.allocUnsafe(n); - var p = this.head; - var c = 1; - p.data.copy(ret); - n -= p.data.length; - - while (p = p.next) { - var buf = p.data; - var nb = n > buf.length ? buf.length : n; - buf.copy(ret, ret.length - n, 0, nb); - n -= nb; - - if (n === 0) { - if (nb === buf.length) { - ++c; - if (p.next) this.head = p.next;else this.head = this.tail = null; - } else { - this.head = p; - p.data = buf.slice(nb); - } - - break; - } - - ++c; - } - - this.length -= c; - return ret; - } // Make sure the linked list only shows the minimal necessary information. - ; - - _proto[custom] = function (_, options) { - return inspect(this, _objectSpread({}, options, { - // Only inspect one level. - depth: 0, - // It should not recurse. - customInspect: false - })); - }; - - return BufferList; -}(); -},{"buffer":48,"util":33}],169:[function(require,module,exports){ -(function (process){ -'use strict'; // undocumented cb() API, needed for core, not for public API - -function destroy(err, cb) { - var _this = this; - - var readableDestroyed = this._readableState && this._readableState.destroyed; - var writableDestroyed = this._writableState && this._writableState.destroyed; - - if (readableDestroyed || writableDestroyed) { - if (cb) { - cb(err); - } else if (err && (!this._writableState || !this._writableState.errorEmitted)) { - process.nextTick(emitErrorNT, this, err); - } - - return this; - } // we set destroyed to true before firing error callbacks in order - // to make it re-entrance safe in case destroy() is called within callbacks - - - if (this._readableState) { - this._readableState.destroyed = true; - } // if this is a duplex stream mark the writable part as destroyed as well - - - if (this._writableState) { - this._writableState.destroyed = true; - } - - this._destroy(err || null, function (err) { - if (!cb && err) { - process.nextTick(emitErrorAndCloseNT, _this, err); - - if (_this._writableState) { - _this._writableState.errorEmitted = true; - } - } else if (cb) { - process.nextTick(emitCloseNT, _this); - cb(err); - } else { - process.nextTick(emitCloseNT, _this); - } - }); - - return this; -} - -function emitErrorAndCloseNT(self, err) { - emitErrorNT(self, err); - emitCloseNT(self); -} - -function emitCloseNT(self) { - if (self._writableState && !self._writableState.emitClose) return; - if (self._readableState && !self._readableState.emitClose) return; - self.emit('close'); -} - -function undestroy() { - if (this._readableState) { - this._readableState.destroyed = false; - this._readableState.reading = false; - this._readableState.ended = false; - this._readableState.endEmitted = false; - } - - if (this._writableState) { - this._writableState.destroyed = false; - this._writableState.ended = false; - this._writableState.ending = false; - this._writableState.finalCalled = false; - this._writableState.prefinished = false; - this._writableState.finished = false; - this._writableState.errorEmitted = false; - } -} - -function emitErrorNT(self, err) { - self.emit('error', err); -} - -module.exports = { - destroy: destroy, - undestroy: undestroy -}; -}).call(this,require('_process')) -},{"_process":133}],170:[function(require,module,exports){ -// Ported from https://github.com/mafintosh/end-of-stream with -// permission from the author, Mathias Buus (@mafintosh). -'use strict'; - -var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE; - -function once(callback) { - var called = false; - return function () { - if (called) return; - called = true; - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - callback.apply(this, args); - }; -} - -function noop() {} - -function isRequest(stream) { - return stream.setHeader && typeof stream.abort === 'function'; -} - -function eos(stream, opts, callback) { - if (typeof opts === 'function') return eos(stream, null, opts); - if (!opts) opts = {}; - callback = once(callback || noop); - var readable = opts.readable || opts.readable !== false && stream.readable; - var writable = opts.writable || opts.writable !== false && stream.writable; - - var onlegacyfinish = function onlegacyfinish() { - if (!stream.writable) onfinish(); - }; - - var writableEnded = stream._writableState && stream._writableState.finished; - - var onfinish = function onfinish() { - writable = false; - writableEnded = true; - if (!readable) callback.call(stream); - }; - - var readableEnded = stream._readableState && stream._readableState.endEmitted; - - var onend = function onend() { - readable = false; - readableEnded = true; - if (!writable) callback.call(stream); - }; - - var onerror = function onerror(err) { - callback.call(stream, err); - }; - - var onclose = function onclose() { - var err; - - if (readable && !readableEnded) { - if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); - } - - if (writable && !writableEnded) { - if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); - return callback.call(stream, err); - } - }; - - var onrequest = function onrequest() { - stream.req.on('finish', onfinish); - }; - - if (isRequest(stream)) { - stream.on('complete', onfinish); - stream.on('abort', onclose); - if (stream.req) onrequest();else stream.on('request', onrequest); - } else if (writable && !stream._writableState) { - // legacy streams - stream.on('end', onlegacyfinish); - stream.on('close', onlegacyfinish); - } - - stream.on('end', onend); - stream.on('finish', onfinish); - if (opts.error !== false) stream.on('error', onerror); - stream.on('close', onclose); - return function () { - stream.removeListener('complete', onfinish); - stream.removeListener('abort', onclose); - stream.removeListener('request', onrequest); - if (stream.req) stream.req.removeListener('finish', onfinish); - stream.removeListener('end', onlegacyfinish); - stream.removeListener('close', onlegacyfinish); - stream.removeListener('finish', onfinish); - stream.removeListener('end', onend); - stream.removeListener('error', onerror); - stream.removeListener('close', onclose); - }; -} - -module.exports = eos; -},{"../../../errors":160}],171:[function(require,module,exports){ -// Ported from https://github.com/mafintosh/pump with -// permission from the author, Mathias Buus (@mafintosh). -'use strict'; - -var eos; - -function once(callback) { - var called = false; - return function () { - if (called) return; - called = true; - callback.apply(void 0, arguments); - }; -} - -var _require$codes = require('../../../errors').codes, - ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, - ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; - -function noop(err) { - // Rethrow the error if it exists to avoid swallowing it - if (err) throw err; -} - -function isRequest(stream) { - return stream.setHeader && typeof stream.abort === 'function'; -} - -function destroyer(stream, reading, writing, callback) { - callback = once(callback); - var closed = false; - stream.on('close', function () { - closed = true; - }); - if (eos === undefined) eos = require('./end-of-stream'); - eos(stream, { - readable: reading, - writable: writing - }, function (err) { - if (err) return callback(err); - closed = true; - callback(); - }); - var destroyed = false; - return function (err) { - if (closed) return; - if (destroyed) return; - destroyed = true; // request.destroy just do .end - .abort is what we want - - if (isRequest(stream)) return stream.abort(); - if (typeof stream.destroy === 'function') return stream.destroy(); - callback(err || new ERR_STREAM_DESTROYED('pipe')); - }; -} - -function call(fn) { - fn(); -} - -function pipe(from, to) { - return from.pipe(to); -} - -function popCallback(streams) { - if (!streams.length) return noop; - if (typeof streams[streams.length - 1] !== 'function') return noop; - return streams.pop(); -} - -function pipeline() { - for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { - streams[_key] = arguments[_key]; - } - - var callback = popCallback(streams); - if (Array.isArray(streams[0])) streams = streams[0]; - - if (streams.length < 2) { - throw new ERR_MISSING_ARGS('streams'); - } - - var error; - var destroys = streams.map(function (stream, i) { - var reading = i < streams.length - 1; - var writing = i > 0; - return destroyer(stream, reading, writing, function (err) { - if (!error) error = err; - if (err) destroys.forEach(call); - if (reading) return; - destroys.forEach(call); - callback(error); - }); - }); - return streams.reduce(pipe); -} - -module.exports = pipeline; -},{"../../../errors":160,"./end-of-stream":170}],172:[function(require,module,exports){ -'use strict'; - -var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE; - -function highWaterMarkFrom(options, isDuplex, duplexKey) { - return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; -} - -function getHighWaterMark(state, options, duplexKey, isDuplex) { - var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); - - if (hwm != null) { - if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { - var name = isDuplex ? duplexKey : 'highWaterMark'; - throw new ERR_INVALID_OPT_VALUE(name, hwm); - } - - return Math.floor(hwm); - } // Default value - - - return state.objectMode ? 16 : 16 * 1024; -} - -module.exports = { - getHighWaterMark: getHighWaterMark -}; -},{"../../../errors":160}],173:[function(require,module,exports){ -arguments[4][146][0].apply(exports,arguments) -},{"dup":146,"events":52}],174:[function(require,module,exports){ -exports = module.exports = require('./lib/_stream_readable.js'); -exports.Stream = exports; -exports.Readable = exports; -exports.Writable = require('./lib/_stream_writable.js'); -exports.Duplex = require('./lib/_stream_duplex.js'); -exports.Transform = require('./lib/_stream_transform.js'); -exports.PassThrough = require('./lib/_stream_passthrough.js'); -exports.finished = require('./lib/internal/streams/end-of-stream.js'); -exports.pipeline = require('./lib/internal/streams/pipeline.js'); - -},{"./lib/_stream_duplex.js":162,"./lib/_stream_passthrough.js":163,"./lib/_stream_readable.js":164,"./lib/_stream_transform.js":165,"./lib/_stream_writable.js":166,"./lib/internal/streams/end-of-stream.js":170,"./lib/internal/streams/pipeline.js":171}],175:[function(require,module,exports){ -arguments[4][148][0].apply(exports,arguments) -},{"dup":148,"safe-buffer":154}],176:[function(require,module,exports){ -(function (setImmediate,clearImmediate){ -var nextTick = require('process/browser.js').nextTick; -var apply = Function.prototype.apply; -var slice = Array.prototype.slice; -var immediateIds = {}; -var nextImmediateId = 0; - -// DOM APIs, for completeness - -exports.setTimeout = function() { - return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); -}; -exports.setInterval = function() { - return new Timeout(apply.call(setInterval, window, arguments), clearInterval); -}; -exports.clearTimeout = -exports.clearInterval = function(timeout) { timeout.close(); }; - -function Timeout(id, clearFn) { - this._id = id; - this._clearFn = clearFn; -} -Timeout.prototype.unref = Timeout.prototype.ref = function() {}; -Timeout.prototype.close = function() { - this._clearFn.call(window, this._id); -}; - -// Does not start the time, just sets up the members needed. -exports.enroll = function(item, msecs) { - clearTimeout(item._idleTimeoutId); - item._idleTimeout = msecs; -}; - -exports.unenroll = function(item) { - clearTimeout(item._idleTimeoutId); - item._idleTimeout = -1; -}; - -exports._unrefActive = exports.active = function(item) { - clearTimeout(item._idleTimeoutId); - - var msecs = item._idleTimeout; - if (msecs >= 0) { - item._idleTimeoutId = setTimeout(function onTimeout() { - if (item._onTimeout) - item._onTimeout(); - }, msecs); - } -}; - -// That's not how node.js implements it but the exposed api is the same. -exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) { - var id = nextImmediateId++; - var args = arguments.length < 2 ? false : slice.call(arguments, 1); - - immediateIds[id] = true; - - nextTick(function onNextTick() { - if (immediateIds[id]) { - // fn.call() is faster so we optimize for the common use-case - // @see http://jsperf.com/call-apply-segu - if (args) { - fn.apply(null, args); - } else { - fn.call(null); - } - // Prevent ids from leaking - exports.clearImmediate(id); - } - }); - - return id; -}; - -exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { - delete immediateIds[id]; -}; -}).call(this,require("timers").setImmediate,require("timers").clearImmediate) -},{"process/browser.js":133,"timers":176}],177:[function(require,module,exports){ -(function (process){ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - -exports.clone = clone; -exports.addLast = addLast; -exports.addFirst = addFirst; -exports.removeLast = removeLast; -exports.removeFirst = removeFirst; -exports.insert = insert; -exports.removeAt = removeAt; -exports.replaceAt = replaceAt; -exports.getIn = getIn; -exports.set = set; -exports.setIn = setIn; -exports.update = update; -exports.updateIn = updateIn; -exports.merge = merge; -exports.mergeDeep = mergeDeep; -exports.mergeIn = mergeIn; -exports.omit = omit; -exports.addDefaults = addDefaults; - - -/*! - * Timm - * - * Immutability helpers with fast reads and acceptable writes. - * - * @copyright Guillermo Grau Panea 2016 - * @license MIT - */ - -var INVALID_ARGS = 'INVALID_ARGS'; - -// =============================================== -// ### Helpers -// =============================================== - - -function throwStr(msg) { - throw new Error(msg); -} - -function getKeysAndSymbols(obj) { - var keys = Object.keys(obj); - if (Object.getOwnPropertySymbols) { - return keys.concat(Object.getOwnPropertySymbols(obj)); - } - return keys; -} - -var hasOwnProperty = {}.hasOwnProperty; - -function clone(obj) { - if (Array.isArray(obj)) return obj.slice(); - var keys = getKeysAndSymbols(obj); - var out = {}; - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - out[key] = obj[key]; - } - return out; -} - -function doMerge(fAddDefaults, fDeep, first) { - var out = first; - !(out != null) && throwStr(process.env.NODE_ENV !== 'production' ? 'At least one object should be provided to merge()' : INVALID_ARGS); - var fChanged = false; - - for (var _len = arguments.length, rest = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { - rest[_key - 3] = arguments[_key]; - } - - for (var idx = 0; idx < rest.length; idx++) { - var obj = rest[idx]; - if (obj == null) continue; - var keys = getKeysAndSymbols(obj); - if (!keys.length) continue; - for (var j = 0; j <= keys.length; j++) { - var key = keys[j]; - if (fAddDefaults && out[key] !== undefined) continue; - var nextVal = obj[key]; - if (fDeep && isObject(out[key]) && isObject(nextVal)) { - nextVal = doMerge(fAddDefaults, fDeep, out[key], nextVal); - } - if (nextVal === undefined || nextVal === out[key]) continue; - if (!fChanged) { - fChanged = true; - out = clone(out); - } - out[key] = nextVal; - } - } - return out; -} - -function isObject(o) { - var type = typeof o === 'undefined' ? 'undefined' : _typeof(o); - return o != null && type === 'object'; -} - -// _deepFreeze = (obj) -> -// Object.freeze obj -// for key in Object.getOwnPropertyNames obj -// val = obj[key] -// if isObject(val) and not Object.isFrozen val -// _deepFreeze val -// obj - -// =============================================== -// -- ### Arrays -// =============================================== - -// -- #### addLast() -// -- Returns a new array with an appended item or items. -// -- -// -- Usage: `addLast(array: Array, val: Array|T): Array` -// -- -// -- ```js -// -- arr = ['a', 'b'] -// -- arr2 = addLast(arr, 'c') -// -- // ['a', 'b', 'c'] -// -- arr2 === arr -// -- // false -// -- arr3 = addLast(arr, ['c', 'd']) -// -- // ['a', 'b', 'c', 'd'] -// -- ``` -// `array.concat(val)` also handles the scalar case, -// but is apparently very slow -function addLast(array, val) { - if (Array.isArray(val)) return array.concat(val); - return array.concat([val]); -} - -// -- #### addFirst() -// -- Returns a new array with a prepended item or items. -// -- -// -- Usage: `addFirst(array: Array, val: Array|T): Array` -// -- -// -- ```js -// -- arr = ['a', 'b'] -// -- arr2 = addFirst(arr, 'c') -// -- // ['c', 'a', 'b'] -// -- arr2 === arr -// -- // false -// -- arr3 = addFirst(arr, ['c', 'd']) -// -- // ['c', 'd', 'a', 'b'] -// -- ``` -function addFirst(array, val) { - if (Array.isArray(val)) return val.concat(array); - return [val].concat(array); -} - -// -- #### removeLast() -// -- Returns a new array removing the last item. -// -- -// -- Usage: `removeLast(array: Array): Array` -// -- -// -- ```js -// -- arr = ['a', 'b'] -// -- arr2 = removeLast(arr) -// -- // ['a'] -// -- arr2 === arr -// -- // false -// -- -// -- // The same array is returned if there are no changes: -// -- arr3 = [] -// -- removeLast(arr3) === arr3 -// -- // true -// -- ``` -function removeLast(array) { - if (!array.length) return array; - return array.slice(0, array.length - 1); -} - -// -- #### removeFirst() -// -- Returns a new array removing the first item. -// -- -// -- Usage: `removeFirst(array: Array): Array` -// -- -// -- ```js -// -- arr = ['a', 'b'] -// -- arr2 = removeFirst(arr) -// -- // ['b'] -// -- arr2 === arr -// -- // false -// -- -// -- // The same array is returned if there are no changes: -// -- arr3 = [] -// -- removeFirst(arr3) === arr3 -// -- // true -// -- ``` -function removeFirst(array) { - if (!array.length) return array; - return array.slice(1); -} - -// -- #### insert() -// -- Returns a new array obtained by inserting an item or items -// -- at a specified index. -// -- -// -- Usage: `insert(array: Array, idx: number, val: Array|T): Array` -// -- -// -- ```js -// -- arr = ['a', 'b', 'c'] -// -- arr2 = insert(arr, 1, 'd') -// -- // ['a', 'd', 'b', 'c'] -// -- arr2 === arr -// -- // false -// -- insert(arr, 1, ['d', 'e']) -// -- // ['a', 'd', 'e', 'b', 'c'] -// -- ``` -function insert(array, idx, val) { - return array.slice(0, idx).concat(Array.isArray(val) ? val : [val]).concat(array.slice(idx)); -} - -// -- #### removeAt() -// -- Returns a new array obtained by removing an item at -// -- a specified index. -// -- -// -- Usage: `removeAt(array: Array, idx: number): Array` -// -- -// -- ```js -// -- arr = ['a', 'b', 'c'] -// -- arr2 = removeAt(arr, 1) -// -- // ['a', 'c'] -// -- arr2 === arr -// -- // false -// -- -// -- // The same array is returned if there are no changes: -// -- removeAt(arr, 4) === arr -// -- // true -// -- ``` -function removeAt(array, idx) { - if (idx >= array.length || idx < 0) return array; - return array.slice(0, idx).concat(array.slice(idx + 1)); -} - -// -- #### replaceAt() -// -- Returns a new array obtained by replacing an item at -// -- a specified index. If the provided item is the same as -// -- (*referentially equal to*) the previous item at that position, -// -- the original array is returned. -// -- -// -- Usage: `replaceAt(array: Array, idx: number, newItem: T): Array` -// -- -// -- ```js -// -- arr = ['a', 'b', 'c'] -// -- arr2 = replaceAt(arr, 1, 'd') -// -- // ['a', 'd', 'c'] -// -- arr2 === arr -// -- // false -// -- -// -- // The same object is returned if there are no changes: -// -- replaceAt(arr, 1, 'b') === arr -// -- // true -// -- ``` -function replaceAt(array, idx, newItem) { - if (array[idx] === newItem) return array; - var len = array.length; - var result = Array(len); - for (var i = 0; i < len; i++) { - result[i] = array[i]; - } - result[idx] = newItem; - return result; -} - -// =============================================== -// -- ### Collections (objects and arrays) -// =============================================== -// -- The following types are used throughout this section -// -- ```js -// -- type ArrayOrObject = Array|Object; -// -- type Key = number|string; -// -- ``` - -// -- #### getIn() -// -- Returns a value from an object at a given path. Works with -// -- nested arrays and objects. If the path does not exist, it returns -// -- `undefined`. -// -- -// -- Usage: `getIn(obj: ?ArrayOrObject, path: Array): any` -// -- -// -- ```js -// -- obj = { a: 1, b: 2, d: { d1: 3, d2: 4 }, e: ['a', 'b', 'c'] } -// -- getIn(obj, ['d', 'd1']) -// -- // 3 -// -- getIn(obj, ['e', 1]) -// -- // 'b' -// -- ``` -function getIn(obj, path) { - !Array.isArray(path) && throwStr(process.env.NODE_ENV !== 'production' ? 'A path array should be provided when calling getIn()' : INVALID_ARGS); - if (obj == null) return undefined; - var ptr = obj; - for (var i = 0; i < path.length; i++) { - var key = path[i]; - ptr = ptr != null ? ptr[key] : undefined; - if (ptr === undefined) return ptr; - } - return ptr; -} - -// -- #### set() -// -- Returns a new object with a modified attribute. -// -- If the provided value is the same as (*referentially equal to*) -// -- the previous value, the original object is returned. -// -- -// -- Usage: `set(obj: ?T, key: Key, val: any): T` -// -- -// -- ```js -// -- obj = { a: 1, b: 2, c: 3 } -// -- obj2 = set(obj, 'b', 5) -// -- // { a: 1, b: 5, c: 3 } -// -- obj2 === obj -// -- // false -// -- -// -- // The same object is returned if there are no changes: -// -- set(obj, 'b', 2) === obj -// -- // true -// -- ``` -function set(obj, key, val) { - var fallback = typeof key === 'number' ? [] : {}; - var finalObj = obj == null ? fallback : obj; - if (finalObj[key] === val) return finalObj; - var obj2 = clone(finalObj); - obj2[key] = val; - return obj2; -} - -// -- #### setIn() -// -- Returns a new object with a modified **nested** attribute. -// -- -// -- Notes: -// -- -// -- * If the provided value is the same as (*referentially equal to*) -// -- the previous value, the original object is returned. -// -- * If the path does not exist, it will be created before setting -// -- the new value. -// -- -// -- Usage: `setIn(obj: T, path: Array, val: any): T` -// -- -// -- ```js -// -- obj = { a: 1, b: 2, d: { d1: 3, d2: 4 }, e: { e1: 'foo', e2: 'bar' } } -// -- obj2 = setIn(obj, ['d', 'd1'], 4) -// -- // { a: 1, b: 2, d: { d1: 4, d2: 4 }, e: { e1: 'foo', e2: 'bar' } } -// -- obj2 === obj -// -- // false -// -- obj2.d === obj.d -// -- // false -// -- obj2.e === obj.e -// -- // true -// -- -// -- // The same object is returned if there are no changes: -// -- obj3 = setIn(obj, ['d', 'd1'], 3) -// -- // { a: 1, b: 2, d: { d1: 3, d2: 4 }, e: { e1: 'foo', e2: 'bar' } } -// -- obj3 === obj -// -- // true -// -- obj3.d === obj.d -// -- // true -// -- obj3.e === obj.e -// -- // true -// -- -// -- // ... unknown paths create intermediate keys. Numeric segments are treated as array indices: -// -- setIn({ a: 3 }, ['unknown', 0, 'path'], 4) -// -- // { a: 3, unknown: [{ path: 4 }] } -// -- ``` -function doSetIn(obj, path, val, idx) { - var newValue = void 0; - var key = path[idx]; - if (idx === path.length - 1) { - newValue = val; - } else { - var nestedObj = isObject(obj) && isObject(obj[key]) ? obj[key] : typeof path[idx + 1] === 'number' ? [] : {}; - newValue = doSetIn(nestedObj, path, val, idx + 1); - } - return set(obj, key, newValue); -} - -function setIn(obj, path, val) { - if (!path.length) return val; - return doSetIn(obj, path, val, 0); -} - -// -- #### update() -// -- Returns a new object with a modified attribute, -// -- calculated via a user-provided callback based on the current value. -// -- If the calculated value is the same as (*referentially equal to*) -// -- the previous value, the original object is returned. -// -- -// -- Usage: `update(obj: T, key: Key, -// -- fnUpdate: (prevValue: any) => any): T` -// -- -// -- ```js -// -- obj = { a: 1, b: 2, c: 3 } -// -- obj2 = update(obj, 'b', (val) => val + 1) -// -- // { a: 1, b: 3, c: 3 } -// -- obj2 === obj -// -- // false -// -- -// -- // The same object is returned if there are no changes: -// -- update(obj, 'b', (val) => val) === obj -// -- // true -// -- ``` -function update(obj, key, fnUpdate) { - var prevVal = obj == null ? undefined : obj[key]; - var nextVal = fnUpdate(prevVal); - return set(obj, key, nextVal); -} - -// -- #### updateIn() -// -- Returns a new object with a modified **nested** attribute, -// -- calculated via a user-provided callback based on the current value. -// -- If the calculated value is the same as (*referentially equal to*) -// -- the previous value, the original object is returned. -// -- -// -- Usage: `updateIn(obj: T, path: Array, -// -- fnUpdate: (prevValue: any) => any): T` -// -- -// -- ```js -// -- obj = { a: 1, d: { d1: 3, d2: 4 } } -// -- obj2 = updateIn(obj, ['d', 'd1'], (val) => val + 1) -// -- // { a: 1, d: { d1: 4, d2: 4 } } -// -- obj2 === obj -// -- // false -// -- -// -- // The same object is returned if there are no changes: -// -- obj3 = updateIn(obj, ['d', 'd1'], (val) => val) -// -- // { a: 1, d: { d1: 3, d2: 4 } } -// -- obj3 === obj -// -- // true -// -- ``` -function updateIn(obj, path, fnUpdate) { - var prevVal = getIn(obj, path); - var nextVal = fnUpdate(prevVal); - return setIn(obj, path, nextVal); -} - -// -- #### merge() -// -- Returns a new object built as follows: the overlapping keys from the -// -- second one overwrite the corresponding entries from the first one. -// -- Similar to `Object.assign()`, but immutable. -// -- -// -- Usage: -// -- -// -- * `merge(obj1: Object, obj2: ?Object): Object` -// -- * `merge(obj1: Object, ...objects: Array): Object` -// -- -// -- The unmodified `obj1` is returned if `obj2` does not *provide something -// -- new to* `obj1`, i.e. if either of the following -// -- conditions are true: -// -- -// -- * `obj2` is `null` or `undefined` -// -- * `obj2` is an object, but it is empty -// -- * All attributes of `obj2` are `undefined` -// -- * All attributes of `obj2` are referentially equal to the -// -- corresponding attributes of `obj1` -// -- -// -- Note that `undefined` attributes in `obj2` do not modify the -// -- corresponding attributes in `obj1`. -// -- -// -- ```js -// -- obj1 = { a: 1, b: 2, c: 3 } -// -- obj2 = { c: 4, d: 5 } -// -- obj3 = merge(obj1, obj2) -// -- // { a: 1, b: 2, c: 4, d: 5 } -// -- obj3 === obj1 -// -- // false -// -- -// -- // The same object is returned if there are no changes: -// -- merge(obj1, { c: 3 }) === obj1 -// -- // true -// -- ``` -function merge(a, b, c, d, e, f) { - for (var _len2 = arguments.length, rest = Array(_len2 > 6 ? _len2 - 6 : 0), _key2 = 6; _key2 < _len2; _key2++) { - rest[_key2 - 6] = arguments[_key2]; - } - - return rest.length ? doMerge.call.apply(doMerge, [null, false, false, a, b, c, d, e, f].concat(rest)) : doMerge(false, false, a, b, c, d, e, f); -} - -// -- #### mergeDeep() -// -- Returns a new object built as follows: the overlapping keys from the -// -- second one overwrite the corresponding entries from the first one. -// -- If both the first and second entries are objects they are merged recursively. -// -- Similar to `Object.assign()`, but immutable, and deeply merging. -// -- -// -- Usage: -// -- -// -- * `mergeDeep(obj1: Object, obj2: ?Object): Object` -// -- * `mergeDeep(obj1: Object, ...objects: Array): Object` -// -- -// -- The unmodified `obj1` is returned if `obj2` does not *provide something -// -- new to* `obj1`, i.e. if either of the following -// -- conditions are true: -// -- -// -- * `obj2` is `null` or `undefined` -// -- * `obj2` is an object, but it is empty -// -- * All attributes of `obj2` are `undefined` -// -- * All attributes of `obj2` are referentially equal to the -// -- corresponding attributes of `obj1` -// -- -// -- Note that `undefined` attributes in `obj2` do not modify the -// -- corresponding attributes in `obj1`. -// -- -// -- ```js -// -- obj1 = { a: 1, b: 2, c: { a: 1 } } -// -- obj2 = { b: 3, c: { b: 2 } } -// -- obj3 = mergeDeep(obj1, obj2) -// -- // { a: 1, b: 3, c: { a: 1, b: 2 } } -// -- obj3 === obj1 -// -- // false -// -- -// -- // The same object is returned if there are no changes: -// -- mergeDeep(obj1, { c: { a: 1 } }) === obj1 -// -- // true -// -- ``` -function mergeDeep(a, b, c, d, e, f) { - for (var _len3 = arguments.length, rest = Array(_len3 > 6 ? _len3 - 6 : 0), _key3 = 6; _key3 < _len3; _key3++) { - rest[_key3 - 6] = arguments[_key3]; - } - - return rest.length ? doMerge.call.apply(doMerge, [null, false, true, a, b, c, d, e, f].concat(rest)) : doMerge(false, true, a, b, c, d, e, f); -} - -// -- #### mergeIn() -// -- Similar to `merge()`, but merging the value at a given nested path. -// -- Note that the returned type is the same as that of the first argument. -// -- -// -- Usage: -// -- -// -- * `mergeIn(obj1: T, path: Array, obj2: ?Object): T` -// -- * `mergeIn(obj1: T, path: Array, -// -- ...objects: Array): T` -// -- -// -- ```js -// -- obj1 = { a: 1, d: { b: { d1: 3, d2: 4 } } } -// -- obj2 = { d3: 5 } -// -- obj3 = mergeIn(obj1, ['d', 'b'], obj2) -// -- // { a: 1, d: { b: { d1: 3, d2: 4, d3: 5 } } } -// -- obj3 === obj1 -// -- // false -// -- -// -- // The same object is returned if there are no changes: -// -- mergeIn(obj1, ['d', 'b'], { d2: 4 }) === obj1 -// -- // true -// -- ``` -function mergeIn(a, path, b, c, d, e, f) { - var prevVal = getIn(a, path); - if (prevVal == null) prevVal = {}; - var nextVal = void 0; - - for (var _len4 = arguments.length, rest = Array(_len4 > 7 ? _len4 - 7 : 0), _key4 = 7; _key4 < _len4; _key4++) { - rest[_key4 - 7] = arguments[_key4]; - } - - if (rest.length) { - nextVal = doMerge.call.apply(doMerge, [null, false, false, prevVal, b, c, d, e, f].concat(rest)); - } else { - nextVal = doMerge(false, false, prevVal, b, c, d, e, f); - } - return setIn(a, path, nextVal); -} - -// -- #### omit() -// -- Returns an object excluding one or several attributes. -// -- -// -- Usage: `omit(obj: Object, attrs: Array|string): Object` -// -// -- ```js -// -- obj = { a: 1, b: 2, c: 3, d: 4 } -// -- omit(obj, 'a') -// -- // { b: 2, c: 3, d: 4 } -// -- omit(obj, ['b', 'c']) -// -- // { a: 1, d: 4 } -// -- -// -- // The same object is returned if there are no changes: -// -- omit(obj, 'z') === obj1 -// -- // true -// -- ``` -function omit(obj, attrs) { - var omitList = Array.isArray(attrs) ? attrs : [attrs]; - var fDoSomething = false; - for (var i = 0; i < omitList.length; i++) { - if (hasOwnProperty.call(obj, omitList[i])) { - fDoSomething = true; - break; - } - } - if (!fDoSomething) return obj; - var out = {}; - var keys = getKeysAndSymbols(obj); - for (var _i = 0; _i < keys.length; _i++) { - var key = keys[_i]; - if (omitList.indexOf(key) >= 0) continue; - out[key] = obj[key]; - } - return out; -} - -// -- #### addDefaults() -// -- Returns a new object built as follows: `undefined` keys in the first one -// -- are filled in with the corresponding values from the second one -// -- (even if they are `null`). -// -- -// -- Usage: -// -- -// -- * `addDefaults(obj: Object, defaults: Object): Object` -// -- * `addDefaults(obj: Object, ...defaultObjects: Array): Object` -// -- -// -- ```js -// -- obj1 = { a: 1, b: 2, c: 3 } -// -- obj2 = { c: 4, d: 5, e: null } -// -- obj3 = addDefaults(obj1, obj2) -// -- // { a: 1, b: 2, c: 3, d: 5, e: null } -// -- obj3 === obj1 -// -- // false -// -- -// -- // The same object is returned if there are no changes: -// -- addDefaults(obj1, { c: 4 }) === obj1 -// -- // true -// -- ``` -function addDefaults(a, b, c, d, e, f) { - for (var _len5 = arguments.length, rest = Array(_len5 > 6 ? _len5 - 6 : 0), _key5 = 6; _key5 < _len5; _key5++) { - rest[_key5 - 6] = arguments[_key5]; - } - - return rest.length ? doMerge.call.apply(doMerge, [null, true, false, a, b, c, d, e, f].concat(rest)) : doMerge(true, false, a, b, c, d, e, f); -} - -// =============================================== -// ### Public API -// =============================================== -var timm = { - clone: clone, - addLast: addLast, - addFirst: addFirst, - removeLast: removeLast, - removeFirst: removeFirst, - insert: insert, - removeAt: removeAt, - replaceAt: replaceAt, - - getIn: getIn, - // eslint-disable-next-line object-shorthand - set: set, // so that flow doesn't complain - setIn: setIn, - update: update, - updateIn: updateIn, - merge: merge, - mergeDeep: mergeDeep, - mergeIn: mergeIn, - omit: omit, - addDefaults: addDefaults -}; - -exports.default = timm; - -}).call(this,require('_process')) -},{"_process":133}],178:[function(require,module,exports){ -// TinyColor v1.4.1 -// https://github.com/bgrins/TinyColor -// Brian Grinstead, MIT License - -(function(Math) { - -var trimLeft = /^\s+/, - trimRight = /\s+$/, - tinyCounter = 0, - mathRound = Math.round, - mathMin = Math.min, - mathMax = Math.max, - mathRandom = Math.random; - -function tinycolor (color, opts) { - - color = (color) ? color : ''; - opts = opts || { }; - - // If input is already a tinycolor, return itself - if (color instanceof tinycolor) { - return color; - } - // If we are called as a function, call using new instead - if (!(this instanceof tinycolor)) { - return new tinycolor(color, opts); - } - - var rgb = inputToRGB(color); - this._originalInput = color, - this._r = rgb.r, - this._g = rgb.g, - this._b = rgb.b, - this._a = rgb.a, - this._roundA = mathRound(100*this._a) / 100, - this._format = opts.format || rgb.format; - this._gradientType = opts.gradientType; - - // Don't let the range of [0,255] come back in [0,1]. - // Potentially lose a little bit of precision here, but will fix issues where - // .5 gets interpreted as half of the total, instead of half of 1 - // If it was supposed to be 128, this was already taken care of by `inputToRgb` - if (this._r < 1) { this._r = mathRound(this._r); } - if (this._g < 1) { this._g = mathRound(this._g); } - if (this._b < 1) { this._b = mathRound(this._b); } - - this._ok = rgb.ok; - this._tc_id = tinyCounter++; -} - -tinycolor.prototype = { - isDark: function() { - return this.getBrightness() < 128; - }, - isLight: function() { - return !this.isDark(); - }, - isValid: function() { - return this._ok; - }, - getOriginalInput: function() { - return this._originalInput; - }, - getFormat: function() { - return this._format; - }, - getAlpha: function() { - return this._a; - }, - getBrightness: function() { - //http://www.w3.org/TR/AERT#color-contrast - var rgb = this.toRgb(); - return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000; - }, - getLuminance: function() { - //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef - var rgb = this.toRgb(); - var RsRGB, GsRGB, BsRGB, R, G, B; - RsRGB = rgb.r/255; - GsRGB = rgb.g/255; - BsRGB = rgb.b/255; - - if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);} - if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);} - if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);} - return (0.2126 * R) + (0.7152 * G) + (0.0722 * B); - }, - setAlpha: function(value) { - this._a = boundAlpha(value); - this._roundA = mathRound(100*this._a) / 100; - return this; - }, - toHsv: function() { - var hsv = rgbToHsv(this._r, this._g, this._b); - return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a }; - }, - toHsvString: function() { - var hsv = rgbToHsv(this._r, this._g, this._b); - var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100); - return (this._a == 1) ? - "hsv(" + h + ", " + s + "%, " + v + "%)" : - "hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")"; - }, - toHsl: function() { - var hsl = rgbToHsl(this._r, this._g, this._b); - return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a }; - }, - toHslString: function() { - var hsl = rgbToHsl(this._r, this._g, this._b); - var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100); - return (this._a == 1) ? - "hsl(" + h + ", " + s + "%, " + l + "%)" : - "hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")"; - }, - toHex: function(allow3Char) { - return rgbToHex(this._r, this._g, this._b, allow3Char); - }, - toHexString: function(allow3Char) { - return '#' + this.toHex(allow3Char); - }, - toHex8: function(allow4Char) { - return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char); - }, - toHex8String: function(allow4Char) { - return '#' + this.toHex8(allow4Char); - }, - toRgb: function() { - return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a }; - }, - toRgbString: function() { - return (this._a == 1) ? - "rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" : - "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")"; - }, - toPercentageRgb: function() { - return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a }; - }, - toPercentageRgbString: function() { - return (this._a == 1) ? - "rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" : - "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")"; - }, - toName: function() { - if (this._a === 0) { - return "transparent"; - } - - if (this._a < 1) { - return false; - } - - return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false; - }, - toFilter: function(secondColor) { - var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a); - var secondHex8String = hex8String; - var gradientType = this._gradientType ? "GradientType = 1, " : ""; - - if (secondColor) { - var s = tinycolor(secondColor); - secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a); - } - - return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")"; - }, - toString: function(format) { - var formatSet = !!format; - format = format || this._format; - - var formattedString = false; - var hasAlpha = this._a < 1 && this._a >= 0; - var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name"); - - if (needsAlphaFormat) { - // Special case for "transparent", all other non-alpha formats - // will return rgba when there is transparency. - if (format === "name" && this._a === 0) { - return this.toName(); - } - return this.toRgbString(); - } - if (format === "rgb") { - formattedString = this.toRgbString(); - } - if (format === "prgb") { - formattedString = this.toPercentageRgbString(); - } - if (format === "hex" || format === "hex6") { - formattedString = this.toHexString(); - } - if (format === "hex3") { - formattedString = this.toHexString(true); - } - if (format === "hex4") { - formattedString = this.toHex8String(true); - } - if (format === "hex8") { - formattedString = this.toHex8String(); - } - if (format === "name") { - formattedString = this.toName(); - } - if (format === "hsl") { - formattedString = this.toHslString(); - } - if (format === "hsv") { - formattedString = this.toHsvString(); - } - - return formattedString || this.toHexString(); - }, - clone: function() { - return tinycolor(this.toString()); - }, - - _applyModification: function(fn, args) { - var color = fn.apply(null, [this].concat([].slice.call(args))); - this._r = color._r; - this._g = color._g; - this._b = color._b; - this.setAlpha(color._a); - return this; - }, - lighten: function() { - return this._applyModification(lighten, arguments); - }, - brighten: function() { - return this._applyModification(brighten, arguments); - }, - darken: function() { - return this._applyModification(darken, arguments); - }, - desaturate: function() { - return this._applyModification(desaturate, arguments); - }, - saturate: function() { - return this._applyModification(saturate, arguments); - }, - greyscale: function() { - return this._applyModification(greyscale, arguments); - }, - spin: function() { - return this._applyModification(spin, arguments); - }, - - _applyCombination: function(fn, args) { - return fn.apply(null, [this].concat([].slice.call(args))); - }, - analogous: function() { - return this._applyCombination(analogous, arguments); - }, - complement: function() { - return this._applyCombination(complement, arguments); - }, - monochromatic: function() { - return this._applyCombination(monochromatic, arguments); - }, - splitcomplement: function() { - return this._applyCombination(splitcomplement, arguments); - }, - triad: function() { - return this._applyCombination(triad, arguments); - }, - tetrad: function() { - return this._applyCombination(tetrad, arguments); - } -}; - -// If input is an object, force 1 into "1.0" to handle ratios properly -// String input requires "1.0" as input, so 1 will be treated as 1 -tinycolor.fromRatio = function(color, opts) { - if (typeof color == "object") { - var newColor = {}; - for (var i in color) { - if (color.hasOwnProperty(i)) { - if (i === "a") { - newColor[i] = color[i]; - } - else { - newColor[i] = convertToPercentage(color[i]); - } - } - } - color = newColor; - } - - return tinycolor(color, opts); -}; - -// Given a string or object, convert that input to RGB -// Possible string inputs: -// -// "red" -// "#f00" or "f00" -// "#ff0000" or "ff0000" -// "#ff000000" or "ff000000" -// "rgb 255 0 0" or "rgb (255, 0, 0)" -// "rgb 1.0 0 0" or "rgb (1, 0, 0)" -// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" -// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" -// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" -// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" -// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" -// -function inputToRGB(color) { - - var rgb = { r: 0, g: 0, b: 0 }; - var a = 1; - var s = null; - var v = null; - var l = null; - var ok = false; - var format = false; - - if (typeof color == "string") { - color = stringInputToObject(color); - } - - if (typeof color == "object") { - if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { - rgb = rgbToRgb(color.r, color.g, color.b); - ok = true; - format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; - } - else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { - s = convertToPercentage(color.s); - v = convertToPercentage(color.v); - rgb = hsvToRgb(color.h, s, v); - ok = true; - format = "hsv"; - } - else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { - s = convertToPercentage(color.s); - l = convertToPercentage(color.l); - rgb = hslToRgb(color.h, s, l); - ok = true; - format = "hsl"; - } - - if (color.hasOwnProperty("a")) { - a = color.a; - } - } - - a = boundAlpha(a); - - return { - ok: ok, - format: color.format || format, - r: mathMin(255, mathMax(rgb.r, 0)), - g: mathMin(255, mathMax(rgb.g, 0)), - b: mathMin(255, mathMax(rgb.b, 0)), - a: a - }; -} - - -// Conversion Functions -// -------------------- - -// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: -// - -// `rgbToRgb` -// Handle bounds / percentage checking to conform to CSS color spec -// -// *Assumes:* r, g, b in [0, 255] or [0, 1] -// *Returns:* { r, g, b } in [0, 255] -function rgbToRgb(r, g, b){ - return { - r: bound01(r, 255) * 255, - g: bound01(g, 255) * 255, - b: bound01(b, 255) * 255 - }; -} - -// `rgbToHsl` -// Converts an RGB color value to HSL. -// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] -// *Returns:* { h, s, l } in [0,1] -function rgbToHsl(r, g, b) { - - r = bound01(r, 255); - g = bound01(g, 255); - b = bound01(b, 255); - - var max = mathMax(r, g, b), min = mathMin(r, g, b); - var h, s, l = (max + min) / 2; - - if(max == min) { - h = s = 0; // achromatic - } - else { - var d = max - min; - s = l > 0.5 ? d / (2 - max - min) : d / (max + min); - switch(max) { - case r: h = (g - b) / d + (g < b ? 6 : 0); break; - case g: h = (b - r) / d + 2; break; - case b: h = (r - g) / d + 4; break; - } - - h /= 6; - } - - return { h: h, s: s, l: l }; -} - -// `hslToRgb` -// Converts an HSL color value to RGB. -// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] -// *Returns:* { r, g, b } in the set [0, 255] -function hslToRgb(h, s, l) { - var r, g, b; - - h = bound01(h, 360); - s = bound01(s, 100); - l = bound01(l, 100); - - function hue2rgb(p, q, t) { - if(t < 0) t += 1; - if(t > 1) t -= 1; - if(t < 1/6) return p + (q - p) * 6 * t; - if(t < 1/2) return q; - if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; - return p; - } - - if(s === 0) { - r = g = b = l; // achromatic - } - else { - var q = l < 0.5 ? l * (1 + s) : l + s - l * s; - var p = 2 * l - q; - r = hue2rgb(p, q, h + 1/3); - g = hue2rgb(p, q, h); - b = hue2rgb(p, q, h - 1/3); - } - - return { r: r * 255, g: g * 255, b: b * 255 }; -} - -// `rgbToHsv` -// Converts an RGB color value to HSV -// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] -// *Returns:* { h, s, v } in [0,1] -function rgbToHsv(r, g, b) { - - r = bound01(r, 255); - g = bound01(g, 255); - b = bound01(b, 255); - - var max = mathMax(r, g, b), min = mathMin(r, g, b); - var h, s, v = max; - - var d = max - min; - s = max === 0 ? 0 : d / max; - - if(max == min) { - h = 0; // achromatic - } - else { - switch(max) { - case r: h = (g - b) / d + (g < b ? 6 : 0); break; - case g: h = (b - r) / d + 2; break; - case b: h = (r - g) / d + 4; break; - } - h /= 6; - } - return { h: h, s: s, v: v }; -} - -// `hsvToRgb` -// Converts an HSV color value to RGB. -// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] -// *Returns:* { r, g, b } in the set [0, 255] - function hsvToRgb(h, s, v) { - - h = bound01(h, 360) * 6; - s = bound01(s, 100); - v = bound01(v, 100); - - var i = Math.floor(h), - f = h - i, - p = v * (1 - s), - q = v * (1 - f * s), - t = v * (1 - (1 - f) * s), - mod = i % 6, - r = [v, q, p, p, t, v][mod], - g = [t, v, v, q, p, p][mod], - b = [p, p, t, v, v, q][mod]; - - return { r: r * 255, g: g * 255, b: b * 255 }; -} - -// `rgbToHex` -// Converts an RGB color to hex -// Assumes r, g, and b are contained in the set [0, 255] -// Returns a 3 or 6 character hex -function rgbToHex(r, g, b, allow3Char) { - - var hex = [ - pad2(mathRound(r).toString(16)), - pad2(mathRound(g).toString(16)), - pad2(mathRound(b).toString(16)) - ]; - - // Return a 3 character hex if possible - if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) { - return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); - } - - return hex.join(""); -} - -// `rgbaToHex` -// Converts an RGBA color plus alpha transparency to hex -// Assumes r, g, b are contained in the set [0, 255] and -// a in [0, 1]. Returns a 4 or 8 character rgba hex -function rgbaToHex(r, g, b, a, allow4Char) { - - var hex = [ - pad2(mathRound(r).toString(16)), - pad2(mathRound(g).toString(16)), - pad2(mathRound(b).toString(16)), - pad2(convertDecimalToHex(a)) - ]; - - // Return a 4 character hex if possible - if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) { - return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0); - } - - return hex.join(""); -} - -// `rgbaToArgbHex` -// Converts an RGBA color to an ARGB Hex8 string -// Rarely used, but required for "toFilter()" -function rgbaToArgbHex(r, g, b, a) { - - var hex = [ - pad2(convertDecimalToHex(a)), - pad2(mathRound(r).toString(16)), - pad2(mathRound(g).toString(16)), - pad2(mathRound(b).toString(16)) - ]; - - return hex.join(""); -} - -// `equals` -// Can be called with any tinycolor input -tinycolor.equals = function (color1, color2) { - if (!color1 || !color2) { return false; } - return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); -}; - -tinycolor.random = function() { - return tinycolor.fromRatio({ - r: mathRandom(), - g: mathRandom(), - b: mathRandom() - }); -}; - - -// Modification Functions -// ---------------------- -// Thanks to less.js for some of the basics here -// - -function desaturate(color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); - var hsl = tinycolor(color).toHsl(); - hsl.s -= amount / 100; - hsl.s = clamp01(hsl.s); - return tinycolor(hsl); -} - -function saturate(color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); - var hsl = tinycolor(color).toHsl(); - hsl.s += amount / 100; - hsl.s = clamp01(hsl.s); - return tinycolor(hsl); -} - -function greyscale(color) { - return tinycolor(color).desaturate(100); -} - -function lighten (color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); - var hsl = tinycolor(color).toHsl(); - hsl.l += amount / 100; - hsl.l = clamp01(hsl.l); - return tinycolor(hsl); -} - -function brighten(color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); - var rgb = tinycolor(color).toRgb(); - rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100)))); - rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100)))); - rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100)))); - return tinycolor(rgb); -} - -function darken (color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); - var hsl = tinycolor(color).toHsl(); - hsl.l -= amount / 100; - hsl.l = clamp01(hsl.l); - return tinycolor(hsl); -} - -// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. -// Values outside of this range will be wrapped into this range. -function spin(color, amount) { - var hsl = tinycolor(color).toHsl(); - var hue = (hsl.h + amount) % 360; - hsl.h = hue < 0 ? 360 + hue : hue; - return tinycolor(hsl); -} - -// Combination Functions -// --------------------- -// Thanks to jQuery xColor for some of the ideas behind these -// - -function complement(color) { - var hsl = tinycolor(color).toHsl(); - hsl.h = (hsl.h + 180) % 360; - return tinycolor(hsl); -} - -function triad(color) { - var hsl = tinycolor(color).toHsl(); - var h = hsl.h; - return [ - tinycolor(color), - tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }), - tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l }) - ]; -} - -function tetrad(color) { - var hsl = tinycolor(color).toHsl(); - var h = hsl.h; - return [ - tinycolor(color), - tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }), - tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }), - tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l }) - ]; -} - -function splitcomplement(color) { - var hsl = tinycolor(color).toHsl(); - var h = hsl.h; - return [ - tinycolor(color), - tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}), - tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l}) - ]; -} - -function analogous(color, results, slices) { - results = results || 6; - slices = slices || 30; - - var hsl = tinycolor(color).toHsl(); - var part = 360 / slices; - var ret = [tinycolor(color)]; - - for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) { - hsl.h = (hsl.h + part) % 360; - ret.push(tinycolor(hsl)); - } - return ret; -} - -function monochromatic(color, results) { - results = results || 6; - var hsv = tinycolor(color).toHsv(); - var h = hsv.h, s = hsv.s, v = hsv.v; - var ret = []; - var modification = 1 / results; - - while (results--) { - ret.push(tinycolor({ h: h, s: s, v: v})); - v = (v + modification) % 1; - } - - return ret; -} - -// Utility Functions -// --------------------- - -tinycolor.mix = function(color1, color2, amount) { - amount = (amount === 0) ? 0 : (amount || 50); - - var rgb1 = tinycolor(color1).toRgb(); - var rgb2 = tinycolor(color2).toRgb(); - - var p = amount / 100; - - var rgba = { - r: ((rgb2.r - rgb1.r) * p) + rgb1.r, - g: ((rgb2.g - rgb1.g) * p) + rgb1.g, - b: ((rgb2.b - rgb1.b) * p) + rgb1.b, - a: ((rgb2.a - rgb1.a) * p) + rgb1.a - }; - - return tinycolor(rgba); -}; - - -// Readability Functions -// --------------------- -// false -// tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false -tinycolor.isReadable = function(color1, color2, wcag2) { - var readability = tinycolor.readability(color1, color2); - var wcag2Parms, out; - - out = false; - - wcag2Parms = validateWCAG2Parms(wcag2); - switch (wcag2Parms.level + wcag2Parms.size) { - case "AAsmall": - case "AAAlarge": - out = readability >= 4.5; - break; - case "AAlarge": - out = readability >= 3; - break; - case "AAAsmall": - out = readability >= 7; - break; - } - return out; - -}; - -// `mostReadable` -// Given a base color and a list of possible foreground or background -// colors for that base, returns the most readable color. -// Optionally returns Black or White if the most readable color is unreadable. -// *Example* -// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" -// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" -// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3" -// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff" -tinycolor.mostReadable = function(baseColor, colorList, args) { - var bestColor = null; - var bestScore = 0; - var readability; - var includeFallbackColors, level, size ; - args = args || {}; - includeFallbackColors = args.includeFallbackColors ; - level = args.level; - size = args.size; - - for (var i= 0; i < colorList.length ; i++) { - readability = tinycolor.readability(baseColor, colorList[i]); - if (readability > bestScore) { - bestScore = readability; - bestColor = tinycolor(colorList[i]); - } - } - - if (tinycolor.isReadable(baseColor, bestColor, {"level":level,"size":size}) || !includeFallbackColors) { - return bestColor; - } - else { - args.includeFallbackColors=false; - return tinycolor.mostReadable(baseColor,["#fff", "#000"],args); - } -}; - - -// Big List of Colors -// ------------------ -// -var names = tinycolor.names = { - aliceblue: "f0f8ff", - antiquewhite: "faebd7", - aqua: "0ff", - aquamarine: "7fffd4", - azure: "f0ffff", - beige: "f5f5dc", - bisque: "ffe4c4", - black: "000", - blanchedalmond: "ffebcd", - blue: "00f", - blueviolet: "8a2be2", - brown: "a52a2a", - burlywood: "deb887", - burntsienna: "ea7e5d", - cadetblue: "5f9ea0", - chartreuse: "7fff00", - chocolate: "d2691e", - coral: "ff7f50", - cornflowerblue: "6495ed", - cornsilk: "fff8dc", - crimson: "dc143c", - cyan: "0ff", - darkblue: "00008b", - darkcyan: "008b8b", - darkgoldenrod: "b8860b", - darkgray: "a9a9a9", - darkgreen: "006400", - darkgrey: "a9a9a9", - darkkhaki: "bdb76b", - darkmagenta: "8b008b", - darkolivegreen: "556b2f", - darkorange: "ff8c00", - darkorchid: "9932cc", - darkred: "8b0000", - darksalmon: "e9967a", - darkseagreen: "8fbc8f", - darkslateblue: "483d8b", - darkslategray: "2f4f4f", - darkslategrey: "2f4f4f", - darkturquoise: "00ced1", - darkviolet: "9400d3", - deeppink: "ff1493", - deepskyblue: "00bfff", - dimgray: "696969", - dimgrey: "696969", - dodgerblue: "1e90ff", - firebrick: "b22222", - floralwhite: "fffaf0", - forestgreen: "228b22", - fuchsia: "f0f", - gainsboro: "dcdcdc", - ghostwhite: "f8f8ff", - gold: "ffd700", - goldenrod: "daa520", - gray: "808080", - green: "008000", - greenyellow: "adff2f", - grey: "808080", - honeydew: "f0fff0", - hotpink: "ff69b4", - indianred: "cd5c5c", - indigo: "4b0082", - ivory: "fffff0", - khaki: "f0e68c", - lavender: "e6e6fa", - lavenderblush: "fff0f5", - lawngreen: "7cfc00", - lemonchiffon: "fffacd", - lightblue: "add8e6", - lightcoral: "f08080", - lightcyan: "e0ffff", - lightgoldenrodyellow: "fafad2", - lightgray: "d3d3d3", - lightgreen: "90ee90", - lightgrey: "d3d3d3", - lightpink: "ffb6c1", - lightsalmon: "ffa07a", - lightseagreen: "20b2aa", - lightskyblue: "87cefa", - lightslategray: "789", - lightslategrey: "789", - lightsteelblue: "b0c4de", - lightyellow: "ffffe0", - lime: "0f0", - limegreen: "32cd32", - linen: "faf0e6", - magenta: "f0f", - maroon: "800000", - mediumaquamarine: "66cdaa", - mediumblue: "0000cd", - mediumorchid: "ba55d3", - mediumpurple: "9370db", - mediumseagreen: "3cb371", - mediumslateblue: "7b68ee", - mediumspringgreen: "00fa9a", - mediumturquoise: "48d1cc", - mediumvioletred: "c71585", - midnightblue: "191970", - mintcream: "f5fffa", - mistyrose: "ffe4e1", - moccasin: "ffe4b5", - navajowhite: "ffdead", - navy: "000080", - oldlace: "fdf5e6", - olive: "808000", - olivedrab: "6b8e23", - orange: "ffa500", - orangered: "ff4500", - orchid: "da70d6", - palegoldenrod: "eee8aa", - palegreen: "98fb98", - paleturquoise: "afeeee", - palevioletred: "db7093", - papayawhip: "ffefd5", - peachpuff: "ffdab9", - peru: "cd853f", - pink: "ffc0cb", - plum: "dda0dd", - powderblue: "b0e0e6", - purple: "800080", - rebeccapurple: "663399", - red: "f00", - rosybrown: "bc8f8f", - royalblue: "4169e1", - saddlebrown: "8b4513", - salmon: "fa8072", - sandybrown: "f4a460", - seagreen: "2e8b57", - seashell: "fff5ee", - sienna: "a0522d", - silver: "c0c0c0", - skyblue: "87ceeb", - slateblue: "6a5acd", - slategray: "708090", - slategrey: "708090", - snow: "fffafa", - springgreen: "00ff7f", - steelblue: "4682b4", - tan: "d2b48c", - teal: "008080", - thistle: "d8bfd8", - tomato: "ff6347", - turquoise: "40e0d0", - violet: "ee82ee", - wheat: "f5deb3", - white: "fff", - whitesmoke: "f5f5f5", - yellow: "ff0", - yellowgreen: "9acd32" -}; - -// Make it easy to access colors via `hexNames[hex]` -var hexNames = tinycolor.hexNames = flip(names); - - -// Utilities -// --------- - -// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }` -function flip(o) { - var flipped = { }; - for (var i in o) { - if (o.hasOwnProperty(i)) { - flipped[o[i]] = i; - } - } - return flipped; -} - -// Return a valid alpha value [0,1] with all invalid values being set to 1 -function boundAlpha(a) { - a = parseFloat(a); - - if (isNaN(a) || a < 0 || a > 1) { - a = 1; - } - - return a; -} - -// Take input from [0, n] and return it as [0, 1] -function bound01(n, max) { - if (isOnePointZero(n)) { n = "100%"; } - - var processPercent = isPercentage(n); - n = mathMin(max, mathMax(0, parseFloat(n))); - - // Automatically convert percentage into number - if (processPercent) { - n = parseInt(n * max, 10) / 100; - } - - // Handle floating point rounding errors - if ((Math.abs(n - max) < 0.000001)) { - return 1; - } - - // Convert into [0, 1] range if it isn't already - return (n % max) / parseFloat(max); -} - -// Force a number between 0 and 1 -function clamp01(val) { - return mathMin(1, mathMax(0, val)); -} - -// Parse a base-16 hex value into a base-10 integer -function parseIntFromHex(val) { - return parseInt(val, 16); -} - -// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 -// -function isOnePointZero(n) { - return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1; -} - -// Check to see if string passed in is a percentage -function isPercentage(n) { - return typeof n === "string" && n.indexOf('%') != -1; -} - -// Force a hex value to have 2 characters -function pad2(c) { - return c.length == 1 ? '0' + c : '' + c; -} - -// Replace a decimal with it's percentage value -function convertToPercentage(n) { - if (n <= 1) { - n = (n * 100) + "%"; - } - - return n; -} - -// Converts a decimal to a hex value -function convertDecimalToHex(d) { - return Math.round(parseFloat(d) * 255).toString(16); -} -// Converts a hex value to a decimal -function convertHexToDecimal(h) { - return (parseIntFromHex(h) / 255); -} - -var matchers = (function() { - - // - var CSS_INTEGER = "[-\\+]?\\d+%?"; - - // - var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; - - // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome. - var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; - - // Actual matching. - // Parentheses and commas are optional, but not required. - // Whitespace can take the place of commas or opening paren - var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; - var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; - - return { - CSS_UNIT: new RegExp(CSS_UNIT), - rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), - rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), - hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), - hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), - hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), - hsva: new RegExp("hsva" + PERMISSIVE_MATCH4), - hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, - hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, - hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, - hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ - }; -})(); - -// `isValidCSSUnit` -// Take in a single string / number and check to see if it looks like a CSS unit -// (see `matchers` above for definition). -function isValidCSSUnit(color) { - return !!matchers.CSS_UNIT.exec(color); -} - -// `stringInputToObject` -// Permissive string parsing. Take in a number of formats, and output an object -// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` -function stringInputToObject(color) { - - color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase(); - var named = false; - if (names[color]) { - color = names[color]; - named = true; - } - else if (color == 'transparent') { - return { r: 0, g: 0, b: 0, a: 0, format: "name" }; - } - - // Try to match string input using regular expressions. - // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] - // Just return an object and let the conversion functions handle that. - // This way the result will be the same whether the tinycolor is initialized with string or object. - var match; - if ((match = matchers.rgb.exec(color))) { - return { r: match[1], g: match[2], b: match[3] }; - } - if ((match = matchers.rgba.exec(color))) { - return { r: match[1], g: match[2], b: match[3], a: match[4] }; - } - if ((match = matchers.hsl.exec(color))) { - return { h: match[1], s: match[2], l: match[3] }; - } - if ((match = matchers.hsla.exec(color))) { - return { h: match[1], s: match[2], l: match[3], a: match[4] }; - } - if ((match = matchers.hsv.exec(color))) { - return { h: match[1], s: match[2], v: match[3] }; - } - if ((match = matchers.hsva.exec(color))) { - return { h: match[1], s: match[2], v: match[3], a: match[4] }; - } - if ((match = matchers.hex8.exec(color))) { - return { - r: parseIntFromHex(match[1]), - g: parseIntFromHex(match[2]), - b: parseIntFromHex(match[3]), - a: convertHexToDecimal(match[4]), - format: named ? "name" : "hex8" - }; - } - if ((match = matchers.hex6.exec(color))) { - return { - r: parseIntFromHex(match[1]), - g: parseIntFromHex(match[2]), - b: parseIntFromHex(match[3]), - format: named ? "name" : "hex" - }; - } - if ((match = matchers.hex4.exec(color))) { - return { - r: parseIntFromHex(match[1] + '' + match[1]), - g: parseIntFromHex(match[2] + '' + match[2]), - b: parseIntFromHex(match[3] + '' + match[3]), - a: convertHexToDecimal(match[4] + '' + match[4]), - format: named ? "name" : "hex8" - }; - } - if ((match = matchers.hex3.exec(color))) { - return { - r: parseIntFromHex(match[1] + '' + match[1]), - g: parseIntFromHex(match[2] + '' + match[2]), - b: parseIntFromHex(match[3] + '' + match[3]), - format: named ? "name" : "hex" - }; - } - - return false; -} - -function validateWCAG2Parms(parms) { - // return valid WCAG2 parms for isReadable. - // If input parms are invalid, return {"level":"AA", "size":"small"} - var level, size; - parms = parms || {"level":"AA", "size":"small"}; - level = (parms.level || "AA").toUpperCase(); - size = (parms.size || "small").toLowerCase(); - if (level !== "AA" && level !== "AAA") { - level = "AA"; - } - if (size !== "small" && size !== "large") { - size = "small"; - } - return {"level":level, "size":size}; -} - -// Node: Export function -if (typeof module !== "undefined" && module.exports) { - module.exports = tinycolor; -} -// AMD/requirejs: Define the module -else if (typeof define === 'function' && define.amd) { - define(function () {return tinycolor;}); -} -// Browser: Expose to window -else { - window.tinycolor = tinycolor; -} - -})(Math); - -},{}],179:[function(require,module,exports){ - -exports = module.exports = trim; - -function trim(str){ - return str.replace(/^\s*|\s*$/g, ''); -} - -exports.left = function(str){ - return str.replace(/^\s*/, ''); -}; - -exports.right = function(str){ - return str.replace(/\s*$/, ''); -}; - -},{}],180:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -'use strict'; - -var punycode = require('punycode'); -var util = require('./util'); - -exports.parse = urlParse; -exports.resolve = urlResolve; -exports.resolveObject = urlResolveObject; -exports.format = urlFormat; - -exports.Url = Url; - -function Url() { - this.protocol = null; - this.slashes = null; - this.auth = null; - this.host = null; - this.port = null; - this.hostname = null; - this.hash = null; - this.search = null; - this.query = null; - this.pathname = null; - this.path = null; - this.href = null; -} - -// Reference: RFC 3986, RFC 1808, RFC 2396 - -// define these here so at least they only have to be -// compiled once on the first module load. -var protocolPattern = /^([a-z0-9.+-]+:)/i, - portPattern = /:[0-9]*$/, - - // Special case for a simple path URL - simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, - - // RFC 2396: characters reserved for delimiting URLs. - // We actually just auto-escape these. - delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], - - // RFC 2396: characters not allowed for various reasons. - unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), - - // Allowed by RFCs, but cause of XSS attacks. Always escape these. - autoEscape = ['\''].concat(unwise), - // Characters that are never ever allowed in a hostname. - // Note that any invalid chars are also handled, but these - // are the ones that are *expected* to be seen, so we fast-path - // them. - nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), - hostEndingChars = ['/', '?', '#'], - hostnameMaxLen = 255, - hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, - hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, - // protocols that can allow "unsafe" and "unwise" chars. - unsafeProtocol = { - 'javascript': true, - 'javascript:': true - }, - // protocols that never have a hostname. - hostlessProtocol = { - 'javascript': true, - 'javascript:': true - }, - // protocols that always contain a // bit. - slashedProtocol = { - 'http': true, - 'https': true, - 'ftp': true, - 'gopher': true, - 'file': true, - 'http:': true, - 'https:': true, - 'ftp:': true, - 'gopher:': true, - 'file:': true - }, - querystring = require('querystring'); - -function urlParse(url, parseQueryString, slashesDenoteHost) { - if (url && util.isObject(url) && url instanceof Url) return url; - - var u = new Url; - u.parse(url, parseQueryString, slashesDenoteHost); - return u; -} - -Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { - if (!util.isString(url)) { - throw new TypeError("Parameter 'url' must be a string, not " + typeof url); - } - - // Copy chrome, IE, opera backslash-handling behavior. - // Back slashes before the query string get converted to forward slashes - // See: https://code.google.com/p/chromium/issues/detail?id=25916 - var queryIndex = url.indexOf('?'), - splitter = - (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#', - uSplit = url.split(splitter), - slashRegex = /\\/g; - uSplit[0] = uSplit[0].replace(slashRegex, '/'); - url = uSplit.join(splitter); - - var rest = url; - - // trim before proceeding. - // This is to support parse stuff like " http://foo.com \n" - rest = rest.trim(); - - if (!slashesDenoteHost && url.split('#').length === 1) { - // Try fast path regexp - var simplePath = simplePathPattern.exec(rest); - if (simplePath) { - this.path = rest; - this.href = rest; - this.pathname = simplePath[1]; - if (simplePath[2]) { - this.search = simplePath[2]; - if (parseQueryString) { - this.query = querystring.parse(this.search.substr(1)); - } else { - this.query = this.search.substr(1); - } - } else if (parseQueryString) { - this.search = ''; - this.query = {}; - } - return this; - } - } - - var proto = protocolPattern.exec(rest); - if (proto) { - proto = proto[0]; - var lowerProto = proto.toLowerCase(); - this.protocol = lowerProto; - rest = rest.substr(proto.length); - } - - // figure out if it's got a host - // user@server is *always* interpreted as a hostname, and url - // resolution will treat //foo/bar as host=foo,path=bar because that's - // how the browser resolves relative URLs. - if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { - var slashes = rest.substr(0, 2) === '//'; - if (slashes && !(proto && hostlessProtocol[proto])) { - rest = rest.substr(2); - this.slashes = true; - } - } - - if (!hostlessProtocol[proto] && - (slashes || (proto && !slashedProtocol[proto]))) { - - // there's a hostname. - // the first instance of /, ?, ;, or # ends the host. - // - // If there is an @ in the hostname, then non-host chars *are* allowed - // to the left of the last @ sign, unless some host-ending character - // comes *before* the @-sign. - // URLs are obnoxious. - // - // ex: - // http://a@b@c/ => user:a@b host:c - // http://a@b?@c => user:a host:c path:/?@c - - // v0.12 TODO(isaacs): This is not quite how Chrome does things. - // Review our test case against browsers more comprehensively. - - // find the first instance of any hostEndingChars - var hostEnd = -1; - for (var i = 0; i < hostEndingChars.length; i++) { - var hec = rest.indexOf(hostEndingChars[i]); - if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) - hostEnd = hec; - } - - // at this point, either we have an explicit point where the - // auth portion cannot go past, or the last @ char is the decider. - var auth, atSign; - if (hostEnd === -1) { - // atSign can be anywhere. - atSign = rest.lastIndexOf('@'); - } else { - // atSign must be in auth portion. - // http://a@b/c@d => host:b auth:a path:/c@d - atSign = rest.lastIndexOf('@', hostEnd); - } - - // Now we have a portion which is definitely the auth. - // Pull that off. - if (atSign !== -1) { - auth = rest.slice(0, atSign); - rest = rest.slice(atSign + 1); - this.auth = decodeURIComponent(auth); - } - - // the host is the remaining to the left of the first non-host char - hostEnd = -1; - for (var i = 0; i < nonHostChars.length; i++) { - var hec = rest.indexOf(nonHostChars[i]); - if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) - hostEnd = hec; - } - // if we still have not hit it, then the entire thing is a host. - if (hostEnd === -1) - hostEnd = rest.length; - - this.host = rest.slice(0, hostEnd); - rest = rest.slice(hostEnd); - - // pull out port. - this.parseHost(); - - // we've indicated that there is a hostname, - // so even if it's empty, it has to be present. - this.hostname = this.hostname || ''; - - // if hostname begins with [ and ends with ] - // assume that it's an IPv6 address. - var ipv6Hostname = this.hostname[0] === '[' && - this.hostname[this.hostname.length - 1] === ']'; - - // validate a little. - if (!ipv6Hostname) { - var hostparts = this.hostname.split(/\./); - for (var i = 0, l = hostparts.length; i < l; i++) { - var part = hostparts[i]; - if (!part) continue; - if (!part.match(hostnamePartPattern)) { - var newpart = ''; - for (var j = 0, k = part.length; j < k; j++) { - if (part.charCodeAt(j) > 127) { - // we replace non-ASCII char with a temporary placeholder - // we need this to make sure size of hostname is not - // broken by replacing non-ASCII by nothing - newpart += 'x'; - } else { - newpart += part[j]; - } - } - // we test again with ASCII char only - if (!newpart.match(hostnamePartPattern)) { - var validParts = hostparts.slice(0, i); - var notHost = hostparts.slice(i + 1); - var bit = part.match(hostnamePartStart); - if (bit) { - validParts.push(bit[1]); - notHost.unshift(bit[2]); - } - if (notHost.length) { - rest = '/' + notHost.join('.') + rest; - } - this.hostname = validParts.join('.'); - break; - } - } - } - } - - if (this.hostname.length > hostnameMaxLen) { - this.hostname = ''; - } else { - // hostnames are always lower case. - this.hostname = this.hostname.toLowerCase(); - } - - if (!ipv6Hostname) { - // IDNA Support: Returns a punycoded representation of "domain". - // It only converts parts of the domain name that - // have non-ASCII characters, i.e. it doesn't matter if - // you call it with a domain that already is ASCII-only. - this.hostname = punycode.toASCII(this.hostname); - } - - var p = this.port ? ':' + this.port : ''; - var h = this.hostname || ''; - this.host = h + p; - this.href += this.host; - - // strip [ and ] from the hostname - // the host field still retains them, though - if (ipv6Hostname) { - this.hostname = this.hostname.substr(1, this.hostname.length - 2); - if (rest[0] !== '/') { - rest = '/' + rest; - } - } - } - - // now rest is set to the post-host stuff. - // chop off any delim chars. - if (!unsafeProtocol[lowerProto]) { - - // First, make 100% sure that any "autoEscape" chars get - // escaped, even if encodeURIComponent doesn't think they - // need to be. - for (var i = 0, l = autoEscape.length; i < l; i++) { - var ae = autoEscape[i]; - if (rest.indexOf(ae) === -1) - continue; - var esc = encodeURIComponent(ae); - if (esc === ae) { - esc = escape(ae); - } - rest = rest.split(ae).join(esc); - } - } - - - // chop off from the tail first. - var hash = rest.indexOf('#'); - if (hash !== -1) { - // got a fragment string. - this.hash = rest.substr(hash); - rest = rest.slice(0, hash); - } - var qm = rest.indexOf('?'); - if (qm !== -1) { - this.search = rest.substr(qm); - this.query = rest.substr(qm + 1); - if (parseQueryString) { - this.query = querystring.parse(this.query); - } - rest = rest.slice(0, qm); - } else if (parseQueryString) { - // no query string, but parseQueryString still requested - this.search = ''; - this.query = {}; - } - if (rest) this.pathname = rest; - if (slashedProtocol[lowerProto] && - this.hostname && !this.pathname) { - this.pathname = '/'; - } - - //to support http.request - if (this.pathname || this.search) { - var p = this.pathname || ''; - var s = this.search || ''; - this.path = p + s; - } - - // finally, reconstruct the href based on what has been validated. - this.href = this.format(); - return this; -}; - -// format a parsed object into a url string -function urlFormat(obj) { - // ensure it's an object, and not a string url. - // If it's an obj, this is a no-op. - // this way, you can call url_format() on strings - // to clean up potentially wonky urls. - if (util.isString(obj)) obj = urlParse(obj); - if (!(obj instanceof Url)) return Url.prototype.format.call(obj); - return obj.format(); -} - -Url.prototype.format = function() { - var auth = this.auth || ''; - if (auth) { - auth = encodeURIComponent(auth); - auth = auth.replace(/%3A/i, ':'); - auth += '@'; - } - - var protocol = this.protocol || '', - pathname = this.pathname || '', - hash = this.hash || '', - host = false, - query = ''; - - if (this.host) { - host = auth + this.host; - } else if (this.hostname) { - host = auth + (this.hostname.indexOf(':') === -1 ? - this.hostname : - '[' + this.hostname + ']'); - if (this.port) { - host += ':' + this.port; - } - } - - if (this.query && - util.isObject(this.query) && - Object.keys(this.query).length) { - query = querystring.stringify(this.query); - } - - var search = this.search || (query && ('?' + query)) || ''; - - if (protocol && protocol.substr(-1) !== ':') protocol += ':'; - - // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. - // unless they had them to begin with. - if (this.slashes || - (!protocol || slashedProtocol[protocol]) && host !== false) { - host = '//' + (host || ''); - if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname; - } else if (!host) { - host = ''; - } - - if (hash && hash.charAt(0) !== '#') hash = '#' + hash; - if (search && search.charAt(0) !== '?') search = '?' + search; - - pathname = pathname.replace(/[?#]/g, function(match) { - return encodeURIComponent(match); - }); - search = search.replace('#', '%23'); - - return protocol + host + pathname + search + hash; -}; - -function urlResolve(source, relative) { - return urlParse(source, false, true).resolve(relative); -} - -Url.prototype.resolve = function(relative) { - return this.resolveObject(urlParse(relative, false, true)).format(); -}; - -function urlResolveObject(source, relative) { - if (!source) return relative; - return urlParse(source, false, true).resolveObject(relative); -} - -Url.prototype.resolveObject = function(relative) { - if (util.isString(relative)) { - var rel = new Url(); - rel.parse(relative, false, true); - relative = rel; - } - - var result = new Url(); - var tkeys = Object.keys(this); - for (var tk = 0; tk < tkeys.length; tk++) { - var tkey = tkeys[tk]; - result[tkey] = this[tkey]; - } - - // hash is always overridden, no matter what. - // even href="" will remove it. - result.hash = relative.hash; - - // if the relative url is empty, then there's nothing left to do here. - if (relative.href === '') { - result.href = result.format(); - return result; - } - - // hrefs like //foo/bar always cut to the protocol. - if (relative.slashes && !relative.protocol) { - // take everything except the protocol from relative - var rkeys = Object.keys(relative); - for (var rk = 0; rk < rkeys.length; rk++) { - var rkey = rkeys[rk]; - if (rkey !== 'protocol') - result[rkey] = relative[rkey]; - } - - //urlParse appends trailing / to urls like http://www.example.com - if (slashedProtocol[result.protocol] && - result.hostname && !result.pathname) { - result.path = result.pathname = '/'; - } - - result.href = result.format(); - return result; - } - - if (relative.protocol && relative.protocol !== result.protocol) { - // if it's a known url protocol, then changing - // the protocol does weird things - // first, if it's not file:, then we MUST have a host, - // and if there was a path - // to begin with, then we MUST have a path. - // if it is file:, then the host is dropped, - // because that's known to be hostless. - // anything else is assumed to be absolute. - if (!slashedProtocol[relative.protocol]) { - var keys = Object.keys(relative); - for (var v = 0; v < keys.length; v++) { - var k = keys[v]; - result[k] = relative[k]; - } - result.href = result.format(); - return result; - } - - result.protocol = relative.protocol; - if (!relative.host && !hostlessProtocol[relative.protocol]) { - var relPath = (relative.pathname || '').split('/'); - while (relPath.length && !(relative.host = relPath.shift())); - if (!relative.host) relative.host = ''; - if (!relative.hostname) relative.hostname = ''; - if (relPath[0] !== '') relPath.unshift(''); - if (relPath.length < 2) relPath.unshift(''); - result.pathname = relPath.join('/'); - } else { - result.pathname = relative.pathname; - } - result.search = relative.search; - result.query = relative.query; - result.host = relative.host || ''; - result.auth = relative.auth; - result.hostname = relative.hostname || relative.host; - result.port = relative.port; - // to support http.request - if (result.pathname || result.search) { - var p = result.pathname || ''; - var s = result.search || ''; - result.path = p + s; - } - result.slashes = result.slashes || relative.slashes; - result.href = result.format(); - return result; - } - - var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), - isRelAbs = ( - relative.host || - relative.pathname && relative.pathname.charAt(0) === '/' - ), - mustEndAbs = (isRelAbs || isSourceAbs || - (result.host && relative.pathname)), - removeAllDots = mustEndAbs, - srcPath = result.pathname && result.pathname.split('/') || [], - relPath = relative.pathname && relative.pathname.split('/') || [], - psychotic = result.protocol && !slashedProtocol[result.protocol]; - - // if the url is a non-slashed url, then relative - // links like ../.. should be able - // to crawl up to the hostname, as well. This is strange. - // result.protocol has already been set by now. - // Later on, put the first path part into the host field. - if (psychotic) { - result.hostname = ''; - result.port = null; - if (result.host) { - if (srcPath[0] === '') srcPath[0] = result.host; - else srcPath.unshift(result.host); - } - result.host = ''; - if (relative.protocol) { - relative.hostname = null; - relative.port = null; - if (relative.host) { - if (relPath[0] === '') relPath[0] = relative.host; - else relPath.unshift(relative.host); - } - relative.host = null; - } - mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); - } - - if (isRelAbs) { - // it's absolute. - result.host = (relative.host || relative.host === '') ? - relative.host : result.host; - result.hostname = (relative.hostname || relative.hostname === '') ? - relative.hostname : result.hostname; - result.search = relative.search; - result.query = relative.query; - srcPath = relPath; - // fall through to the dot-handling below. - } else if (relPath.length) { - // it's relative - // throw away the existing file, and take the new path instead. - if (!srcPath) srcPath = []; - srcPath.pop(); - srcPath = srcPath.concat(relPath); - result.search = relative.search; - result.query = relative.query; - } else if (!util.isNullOrUndefined(relative.search)) { - // just pull out the search. - // like href='?foo'. - // Put this after the other two cases because it simplifies the booleans - if (psychotic) { - result.hostname = result.host = srcPath.shift(); - //occationaly the auth can get stuck only in host - //this especially happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') - var authInHost = result.host && result.host.indexOf('@') > 0 ? - result.host.split('@') : false; - if (authInHost) { - result.auth = authInHost.shift(); - result.host = result.hostname = authInHost.shift(); - } - } - result.search = relative.search; - result.query = relative.query; - //to support http.request - if (!util.isNull(result.pathname) || !util.isNull(result.search)) { - result.path = (result.pathname ? result.pathname : '') + - (result.search ? result.search : ''); - } - result.href = result.format(); - return result; - } - - if (!srcPath.length) { - // no path at all. easy. - // we've already handled the other stuff above. - result.pathname = null; - //to support http.request - if (result.search) { - result.path = '/' + result.search; - } else { - result.path = null; - } - result.href = result.format(); - return result; - } - - // if a url ENDs in . or .., then it must get a trailing slash. - // however, if it ends in anything else non-slashy, - // then it must NOT get a trailing slash. - var last = srcPath.slice(-1)[0]; - var hasTrailingSlash = ( - (result.host || relative.host || srcPath.length > 1) && - (last === '.' || last === '..') || last === ''); - - // strip single dots, resolve double dots to parent dir - // if the path tries to go above the root, `up` ends up > 0 - var up = 0; - for (var i = srcPath.length; i >= 0; i--) { - last = srcPath[i]; - if (last === '.') { - srcPath.splice(i, 1); - } else if (last === '..') { - srcPath.splice(i, 1); - up++; - } else if (up) { - srcPath.splice(i, 1); - up--; - } - } - - // if the path is allowed to go above the root, restore leading ..s - if (!mustEndAbs && !removeAllDots) { - for (; up--; up) { - srcPath.unshift('..'); - } - } - - if (mustEndAbs && srcPath[0] !== '' && - (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { - srcPath.unshift(''); - } - - if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { - srcPath.push(''); - } - - var isAbsolute = srcPath[0] === '' || - (srcPath[0] && srcPath[0].charAt(0) === '/'); - - // put the host back - if (psychotic) { - result.hostname = result.host = isAbsolute ? '' : - srcPath.length ? srcPath.shift() : ''; - //occationaly the auth can get stuck only in host - //this especially happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') - var authInHost = result.host && result.host.indexOf('@') > 0 ? - result.host.split('@') : false; - if (authInHost) { - result.auth = authInHost.shift(); - result.host = result.hostname = authInHost.shift(); - } - } - - mustEndAbs = mustEndAbs || (result.host && srcPath.length); - - if (mustEndAbs && !isAbsolute) { - srcPath.unshift(''); - } - - if (!srcPath.length) { - result.pathname = null; - result.path = null; - } else { - result.pathname = srcPath.join('/'); - } - - //to support request.http - if (!util.isNull(result.pathname) || !util.isNull(result.search)) { - result.path = (result.pathname ? result.pathname : '') + - (result.search ? result.search : ''); - } - result.auth = relative.auth || result.auth; - result.slashes = result.slashes || relative.slashes; - result.href = result.format(); - return result; -}; - -Url.prototype.parseHost = function() { - var host = this.host; - var port = portPattern.exec(host); - if (port) { - port = port[0]; - if (port !== ':') { - this.port = port.substr(1); - } - host = host.substr(0, host.length - port.length); - } - if (host) this.hostname = host; -}; - -},{"./util":181,"punycode":134,"querystring":137}],181:[function(require,module,exports){ -'use strict'; - -module.exports = { - isString: function(arg) { - return typeof(arg) === 'string'; - }, - isObject: function(arg) { - return typeof(arg) === 'object' && arg !== null; - }, - isNull: function(arg) { - return arg === null; - }, - isNullOrUndefined: function(arg) { - return arg == null; - } -}; - -},{}],182:[function(require,module,exports){ -(function (process){ - - - - -;(function(){ -var UTIF = {}; - -// Make available for import by `require()` -if (typeof module == "object") {module.exports = UTIF;} -else {self.UTIF = UTIF;} - -var pako; -if (typeof require == "function") {pako = require("pako");} -else {pako = self.pako;} - -function log() { if (typeof process=="undefined" || process.env.NODE_ENV=="development") console.log.apply(console, arguments); } - -(function(UTIF, pako){ - -// Following lines add a JPEG decoder to UTIF.JpegDecoder -(function(){var V="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(g){return typeof g}:function(g){return g&&"function"===typeof Symbol&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g},D=function(){function g(g){this.message="JPEG error: "+g}g.prototype=Error();g.prototype.name="JpegError";return g.constructor=g}(),P=function(){function g(g,D){this.message=g;this.g=D}g.prototype=Error();g.prototype.name="DNLMarkerError";return g.constructor=g}();(function(){function g(){this.M= -null;this.B=-1}function W(a,d){for(var f=0,e=[],b,B,k=16;0>x&1;z=a[d++];if(255=== -z){var c=a[d++];if(c){if(220===c&&g){d+=2;var b=a[d++]<<8|a[d++];if(0>>7}function q(a){for(;;){a=a[n()];if("number"===typeof a)return a;if("object"!==("undefined"===typeof a?"undefined":V(a)))throw new D("invalid huffman sequence");}}function h(a){for(var c=0;0= -1<d;){var h=q(a.o),k=h&15;h>>=4;if(0===k){if(15>h)break;d+=16}else d+=h,a.a[b+J[d]]=c(k),d++}}function w(a,d){var b=q(a.D);b=0===b?0:c(b)<>=4;if(0===f){if(15>e){A=h(e)+(1<a.a[f]? --1:1;switch(E){case 0:e=q(a.o);f=e&15;e>>=4;if(0===f)15>e?(A=h(e)+(1<=y)throw new D("marker was not found"); -if(65488<=y&&65495>=y)d+=2;else break}(y=N(a,d))&&y.f&&((0,_util.warn)("decodeScan - unexpected Scan data, current marker is: "+y.f),d=y.offset);return d-v}function Y(a,d){for(var f=d.c,e=d.l,b=new Int16Array(64),B=0;Bh;h+=8){var c=q[l+h];var C=q[l+h+1];var w=q[l+h+2];var p=q[l+h+3];var m=q[l+h+4];var t=q[l+h+5];var g=q[l+h+6];var u=q[l+h+7];c*=n[h];if(0===(C| -w|p|m|t|g|u))c=5793*c+512>>10,r[h]=c,r[h+1]=c,r[h+2]=c,r[h+3]=c,r[h+4]=c,r[h+5]=c,r[h+6]=c,r[h+7]=c;else{C*=n[h+1];w*=n[h+2];p*=n[h+3];m*=n[h+4];t*=n[h+5];g*=n[h+6];u*=n[h+7];var v=5793*c+128>>8;var z=5793*m+128>>8;var x=w;var A=g;m=2896*(C-u)+128>>8;u=2896*(C+u)+128>>8;p<<=4;t<<=4;v=v+z+1>>1;z=v-z;c=3784*x+1567*A+128>>8;x=1567*x-3784*A+128>>8;A=c;m=m+t+1>>1;t=m-t;u=u+p+1>>1;p=u-p;v=v+A+1>>1;A=v-A;z=z+x+1>>1;x=z-x;c=2276*m+3406*u+2048>>12;m=3406*m-2276*u+2048>>12;u=c;c=799*p+4017*t+2048>>12;p=4017* -p-799*t+2048>>12;t=c;r[h]=v+u;r[h+7]=v-u;r[h+1]=z+t;r[h+6]=z-t;r[h+2]=x+p;r[h+5]=x-p;r[h+3]=A+m;r[h+4]=A-m}}for(n=0;8>n;++n)c=r[n],C=r[n+8],w=r[n+16],p=r[n+24],m=r[n+32],t=r[n+40],g=r[n+48],u=r[n+56],0===(C|w|p|m|t|g|u)?(c=5793*c+8192>>14,c=-2040>c?0:2024<=c?255:c+2056>>4,q[l+n]=c,q[l+n+8]=c,q[l+n+16]=c,q[l+n+24]=c,q[l+n+32]=c,q[l+n+40]=c,q[l+n+48]=c,q[l+n+56]=c):(v=5793*c+2048>>12,z=5793*m+2048>>12,x=w,A=g,m=2896*(C-u)+2048>>12,u=2896*(C+u)+2048>>12,v=(v+z+1>>1)+4112,z=v-z,c=3784*x+1567*A+2048>> -12,x=1567*x-3784*A+2048>>12,A=c,m=m+t+1>>1,t=m-t,u=u+p+1>>1,p=u-p,v=v+A+1>>1,A=v-A,z=z+x+1>>1,x=z-x,c=2276*m+3406*u+2048>>12,m=3406*m-2276*u+2048>>12,u=c,c=799*p+4017*t+2048>>12,p=4017*p-799*t+2048>>12,t=c,c=v+u,u=v-u,C=z+t,g=z-t,w=x+p,t=x-p,p=A+m,m=A-m,c=16>c?0:4080<=c?255:c>>4,C=16>C?0:4080<=C?255:C>>4,w=16>w?0:4080<=w?255:w>>4,p=16>p?0:4080<=p?255:p>>4,m=16>m?0:4080<=m?255:m>>4,t=16>t?0:4080<=t?255:t>>4,g=16>g?0:4080<=g?255:g>>4,u=16>u?0:4080<=u?255:u>>4,q[l+n]=c,q[l+n+8]=C,q[l+n+16]=w,q[l+n+24]= -p,q[l+n+32]=m,q[l+n+40]=t,q[l+n+48]=g,q[l+n+56]=u)}return d.a}function N(a,d){var f=2=e)return null;var b=a[d]<<8|a[d+1];if(65472<=b&&65534>=b)return{f:null,F:b,offset:d};for(var B=a[f]<<8|a[f+1];!(65472<=B&&65534>=B);){if(++f>=e)return null;B=a[f]<<8|a[f+1]}return{f:b.toString(16),F:B,offset:f}}var J=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56, -57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]);g.prototype={parse:function(a){function d(){var d=a[k]<<8|a[k+1];k+=2;return d}function f(){var b=d();b=k+b-2;var c=N(a,b,k);c&&c.f&&((0,_util.warn)("readDataBlock - incorrect length, current marker is: "+c.f),b=c.offset);b=a.subarray(k,b);k+=b.length;return b}function e(a){for(var b=Math.ceil(a.v/8/a.s),c=Math.ceil(a.g/8/a.u),d=0;d>4)for(c=0;64>c;c++)g=J[c],p[g]=a[k++];else if(1===w>>4)for(c=0;64>c;c++)g=J[c],p[g]=d();else throw new D("DQT - invalid table spec");b[w&15]=p}break;case 65472:case 65473:case 65474:if(m)throw new D("Only single frame JPEGs supported");d();var m={};m.X=65473===h;m.S=65474===h;m.precision=a[k++];h=d();m.g= -B||h;m.v=d();m.b=[];m.C={};c=a[k++];for(h=p=w=0;h>4;var H=a[k+1]&15;wc;c++,k++)t+=p[c]=a[k];H=new Uint8Array(t);for(c=0;c>4?q:n)[w&15]=W(p,H)}break;case 65501:d();var u=d();break;case 65498:c=1===++r&&!B;d();w=a[k++];g=[];for(h=0;h>4];v.o=n[p&15];g.push(v)}h=a[k++];w=a[k++];p=a[k++];try{var z=X(a,k,m,g,u,h,w,p>>4,p&15,c);k+=z}catch(x){if(x instanceof P)return(0,_util.warn)('Attempting to re-parse JPEG image using "scanLines" parameter found in DNL marker (0xFFDC) segment.'),this.parse(a,{N:x.g});throw x;}break;case 65500:k+=4;break;case 65535:255!==a[k]&&k--;break;default:if(255===a[k-3]&&192<=a[k-2]&&254>=a[k-2])k-=3;else if((c=N(a,k-2))&&c.f)(0,_util.warn)("JpegImage.parse - unexpected data, current marker is: "+ -c.f),k=c.offset;else throw new D("unknown marker "+h.toString(16));}h=d()}this.width=m.v;this.height=m.g;this.A=l;this.b=[];for(h=0;h>8)+e[f+1];return r},w:function(){return this.A?!!this.A.W:3===this.i?0===this.B?!1:!0:1===this.B?!0:!1},I:function(a){for(var d,f,e,b=0,g=a.length;b>>3)]; if(bcnt==null) bcnt = img["t325"]; - var bytes = new Uint8Array(img.height*(bipl>>>3)), bilen = 0; - - if(img["t322"]!=null) // tiled - { - var tw = img["t322"][0], th = img["t323"][0]; - var tx = Math.floor((img.width + tw - 1) / tw); - var ty = Math.floor((img.height + th - 1) / th); - var tbuff = new Uint8Array(Math.ceil(tw*th*bipp/8)|0); - for(var y=0; y>>8); } - else if(bps==12) for(var i=0; i>>4); tgt[toff++] = ((out[i]<<4)|(out[i+1]>>>8))&255; tgt[toff++] = out[i+1]&255; } - else throw new Error("unsupported bit depth "+bps); - } - else - { - var parser = new UTIF.JpegDecoder(); parser.parse(buff); - var decoded = parser.getData(parser.width, parser.height); - for (var i=0; i 1); - } - - if(!isTiled) - { - if(data[off]==255 && data[off+1]==SOI) return { jpegOffset: off }; - if(jpgIchgFmt!=null) - { - if(data[off+jifoff]==255 && data[off+jifoff+1]==SOI) joff = off+jifoff; - else log("JPEGInterchangeFormat does not point to SOI"); - - if(jpgIchgFmtLen==null) log("JPEGInterchangeFormatLength field is missing"); - else if(jifoff >= soff || (jifoff+jiflen) <= soff) log("JPEGInterchangeFormatLength field value is invalid"); - - if(joff != null) return { jpegOffset: joff }; - } - } - - if(ycbcrss!=null) { ssx = ycbcrss[0]; ssy = ycbcrss[1]; } - - if(jpgIchgFmt!=null) - if(jpgIchgFmtLen!=null) - if(jiflen >= 2 && (jifoff+jiflen) <= soff) - { - if(data[off+jifoff+jiflen-2]==255 && data[off+jifoff+jiflen-1]==SOI) tables = new Uint8Array(jiflen-2); - else tables = new Uint8Array(jiflen); - - for(i=0; i offset to first strip or tile"); - - if(tables == null) - { - var ooff = 0, out = []; - out[ooff++] = 255; out[ooff++] = SOI; - - var qtables = img["t519"]; - if(qtables==null) throw new Error("JPEGQTables tag is missing"); - for(i=0; i>> 8); out[ooff++] = nc & 255; - out[ooff++] = (i | (k << 4)); - for(j=0; j<16; j++) out[ooff++] = data[off+htables[i]+j]; - for(j=0; j>> 8) & 255; out[ooff++] = img.height & 255; - out[ooff++] = (img.width >>> 8) & 255; out[ooff++] = img.width & 255; - out[ooff++] = spp; - if(spp==1) { out[ooff++] = 1; out[ooff++] = 17; out[ooff++] = 0; } - else for(i=0; i<3; i++) - { - out[ooff++] = i + 1; - out[ooff++] = (i != 0) ? 17 : (((ssx & 15) << 4) | (ssy & 15)); - out[ooff++] = i; - } - - if(jpgresint!=null && jpgresint[0]!=0) - { - out[ooff++] = 255; out[ooff++] = DRI; out[ooff++] = 0; out[ooff++] = 4; - out[ooff++] = (jpgresint[0] >>> 8) & 255; - out[ooff++] = jpgresint[0] & 255; - } - - tables = new Uint8Array(out); - } - - var sofpos = -1; - i = 0; - while(i < (tables.length - 1)) { - if(tables[i]==255 && tables[i+1]==SOF0) { sofpos = i; break; } - i++; - } - - if(sofpos == -1) - { - var tmptab = new Uint8Array(tables.length + 10 + 3*spp); - tmptab.set(tables); - var tmpoff = tables.length; - sofpos = tables.length; - tables = tmptab; - - tables[tmpoff++] = 255; tables[tmpoff++] = SOF0; - tables[tmpoff++] = 0; tables[tmpoff++] = 8 + 3*spp; tables[tmpoff++] = 8; - tables[tmpoff++] = (img.height >>> 8) & 255; tables[tmpoff++] = img.height & 255; - tables[tmpoff++] = (img.width >>> 8) & 255; tables[tmpoff++] = img.width & 255; - tables[tmpoff++] = spp; - if(spp==1) { tables[tmpoff++] = 1; tables[tmpoff++] = 17; tables[tmpoff++] = 0; } - else for(i=0; i<3; i++) - { - tables[tmpoff++] = i + 1; - tables[tmpoff++] = (i != 0) ? 17 : (((ssx & 15) << 4) | (ssy & 15)); - tables[tmpoff++] = i; - } - } - - if(data[soff]==255 && data[soff+1]==SOS) - { - var soslen = (data[soff+2]<<8) | data[soff+3]; - sosMarker = new Uint8Array(soslen+2); - sosMarker[0] = data[soff]; sosMarker[1] = data[soff+1]; sosMarker[2] = data[soff+2]; sosMarker[3] = data[soff+3]; - for(i=0; i<(soslen-2); i++) sosMarker[i+4] = data[soff+i+4]; - } - else - { - sosMarker = new Uint8Array(2 + 6 + 2*spp); - var sosoff = 0; - sosMarker[sosoff++] = 255; sosMarker[sosoff++] = SOS; - sosMarker[sosoff++] = 0; sosMarker[sosoff++] = 6 + 2*spp; sosMarker[sosoff++] = spp; - if(spp==1) { sosMarker[sosoff++] = 1; sosMarker[sosoff++] = 0; } - else for(i=0; i<3; i++) - { - sosMarker[sosoff++] = i+1; sosMarker[sosoff++] = (i << 4) | i; - } - sosMarker[sosoff++] = 0; sosMarker[sosoff++] = 63; sosMarker[sosoff++] = 0; - } - - return { jpegOffset: off, tables: tables, sosMarker: sosMarker, sofPosition: sofpos }; -} - -UTIF.decode._decodeOldJPEG = function(img, data, off, len, tgt, toff) -{ - var i, dlen, tlen, buff, buffoff; - var jpegData = UTIF.decode._decodeOldJPEGInit(img, data, off, len); - - if(jpegData.jpegOffset!=null) - { - dlen = off+len-jpegData.jpegOffset; - buff = new Uint8Array(dlen); - for(i=0; i>> 8) & 255; buff[jpegData.sofPosition+6] = img.height & 255; - buff[jpegData.sofPosition+7] = (img.width >>> 8) & 255; buff[jpegData.sofPosition+8] = img.width & 255; - - if(data[off]!=255 || data[off+1]!=SOS) - { - buff.set(jpegData.sosMarker, bufoff); - bufoff += sosMarker.length; - } - for(i=0; i=0 && n<128) for(var i=0; i< n+1; i++) { ta[toff]=sa[off]; toff++; off++; } - if(n>=-127 && n<0) { for(var i=0; i<-n+1; i++) { ta[toff]=sa[off]; toff++; } off++; } - } -} - -UTIF.decode._decodeThunder = function(data, off, len, tgt, toff) -{ - var d2 = [ 0, 1, 0, -1 ], d3 = [ 0, 1, 2, 3, 0, -3, -2, -1 ]; - var lim = off+len, qoff = toff*2, px = 0; - while(off>>6), n = (b&63); off++; - if(msk==3) { px=(n&15); tgt[qoff>>>1] |= (px<<(4*(1-qoff&1))); qoff++; } - if(msk==0) for(var i=0; i>>1] |= (px<<(4*(1-qoff&1))); qoff++; } - if(msk==2) for(var i=0; i<2; i++) { var d=(n>>>(3*(1-i)))&7; if(d!=4) { px+=d3[d]; tgt[qoff>>>1] |= (px<<(4*(1-qoff&1))); qoff++; } } - if(msk==1) for(var i=0; i<3; i++) { var d=(n>>>(2*(2-i)))&3; if(d!=2) { px+=d2[d]; tgt[qoff>>>1] |= (px<<(4*(1-qoff&1))); qoff++; } } - } -} - -UTIF.decode._dmap = { "1":0,"011":1,"000011":2,"0000011":3, "010":-1,"000010":-2,"0000010":-3 }; -UTIF.decode._lens = ( function() -{ - var addKeys = function(lens, arr, i0, inc) { for(var i=0; i>>3)>>3]>>>(7-(boff&7)))&1; - if(fo==2) bit = (data[boff>>>3]>>>( (boff&7)))&1; - boff++; wrd+=bit; - if(mode=="H") - { - if(U._lens[clr][wrd]!=null) - { - var dl=U._lens[clr][wrd]; wrd=""; len+=dl; - if(dl<64) { U._addNtimes(line,len,clr); a0+=len; clr=1-clr; len=0; toRead--; if(toRead==0) mode=""; } - } - } - else - { - if(wrd=="0001") { wrd=""; U._addNtimes(line,b2-a0,clr); a0=b2; } - if(wrd=="001" ) { wrd=""; mode="H"; toRead=2; } - if(U._dmap[wrd]!=null) { a1 = b1+U._dmap[wrd]; U._addNtimes(line, a1-a0, clr); a0=a1; wrd=""; clr=1-clr; } - } - if(line.length==w && mode=="") - { - U._writeBits(line, tgt, toff*8+y*bipl); - clr=0; y++; a0=0; - pline=U._makeDiff(line); line=[]; - } - //if(wrd.length>150) { log(wrd); break; throw "e"; } - } -} - -UTIF.decode._findDiff = function(line, x, clr) { for(var i=0; i=x && line[i+1]==clr) return line[i]; } - -UTIF.decode._makeDiff = function(line) -{ - var out = []; if(line[0]==1) out.push(0,1); - for(var i=1; i>>3)>>3]>>>(7-(boff&7)))&1; - if(fo==2) bit = (data[boff>>>3]>>>( (boff&7)))&1; - boff++; wrd+=bit; - - if(is1D) - { - if(U._lens[clr][wrd]!=null) - { - var dl=U._lens[clr][wrd]; wrd=""; len+=dl; - if(dl<64) { U._addNtimes(line,len,clr); clr=1-clr; len=0; } - } - } - else - { - if(mode=="H") - { - if(U._lens[clr][wrd]!=null) - { - var dl=U._lens[clr][wrd]; wrd=""; len+=dl; - if(dl<64) { U._addNtimes(line,len,clr); a0+=len; clr=1-clr; len=0; toRead--; if(toRead==0) mode=""; } - } - } - else - { - if(wrd=="0001") { wrd=""; U._addNtimes(line,b2-a0,clr); a0=b2; } - if(wrd=="001" ) { wrd=""; mode="H"; toRead=2; } - if(U._dmap[wrd]!=null) { a1 = b1+U._dmap[wrd]; U._addNtimes(line, a1-a0, clr); a0=a1; wrd=""; clr=1-clr; } - } - } - if(wrd.endsWith("000000000001")) // needed for some files - { - if(y>=0) U._writeBits(line, tgt, toff*8+y*bipl); - if(fo==1) is1D = ((data[boff>>>3]>>>(7-(boff&7)))&1)==1; - if(fo==2) is1D = ((data[boff>>>3]>>>( (boff&7)))&1)==1; - boff++; - if(U._decodeG3.allow2D==null) U._decodeG3.allow2D=is1D; - if(!U._decodeG3.allow2D) { is1D = true; boff--; } - //log("EOL",y, "next 1D:", is1D); - wrd=""; clr=0; y++; a0=0; - pline=U._makeDiff(line); line=[]; - } - } - if(line.length==w) U._writeBits(line, tgt, toff*8+y*bipl); -} - -UTIF.decode._addNtimes = function(arr, n, val) { for(var i=0; i>>3] |= (bits[i]<<(7-((boff+i)&7))); -} - -UTIF.decode._decodeLZW = function(data, off, tgt, toff) -{ - if(UTIF.decode._lzwTab==null) - { - var tb=new Uint32Array(0xffff), tn=new Uint16Array(0xffff), chr=new Uint8Array(2e6); - for(var i=0; i<256; i++) { chr[i<<2]=i; tb[i]=i<<2; tn[i]=1; } - UTIF.decode._lzwTab = [tb,tn,chr]; - } - var copy = UTIF.decode._copyData; - var tab = UTIF.decode._lzwTab[0], tln=UTIF.decode._lzwTab[1], chr=UTIF.decode._lzwTab[2], totl = 258, chrl = 258<<2; - var bits = 9, boff = off<<3; // offset in bits - - var ClearCode = 256, EoiCode = 257; - var v = 0, Code = 0, OldCode = 0; - while(true) - { - v = (data[boff>>>3]<<16) | (data[(boff+8)>>>3]<<8) | data[(boff+16)>>>3]; - Code = ( v>>(24-(boff&7)-bits) ) & ((1<>>3]<<16) | (data[(boff+8)>>>3]<<8) | data[(boff+16)>>>3]; - Code = ( v>>(24-(boff&7)-bits) ) & ((1<=totl) { tab[totl] = chrl; chr[tab[totl]] = cd[0]; tln[totl]=1; chrl=(chrl+1+3)&~0x03; totl++; } - else - { - tab[totl] = chrl; - var nit = tab[OldCode], nil = tln[OldCode]; - copy(chr,nit,chr,chrl,nil); - chr[chrl+nil]=chr[cd]; nil++; - tln[totl]=nil; totl++; - - chrl=(chrl+nil+3)&~0x03; - } - if(totl+1==(1<=totl) { tab[totl] = chrl; tln[totl]=0; totl++; } - else - { - tab[totl] = chrl; - var nit = tab[OldCode], nil = tln[OldCode]; - copy(chr,nit,chr,chrl,nil); - chr[chrl+nil]=chr[chrl]; nil++; - tln[totl]=nil; totl++; - - copy(chr,chrl,tgt,toff,nil); toff += nil; - chrl=(chrl+nil+3)&~0x03; - } - if(totl+1==(1<>>----------------"); - for(var i=0; i4) { bin.writeUint(data, offset, eoff); toff=eoff; } - - if(type==2) { bin.writeASCII(data, toff, val); } - if(type==3) { for(var i=0; i4) { dlen += (dlen&1); eoff += dlen; } - offset += 4; - } - return [offset, eoff]; -} - -UTIF.toRGBA8 = function(out) -{ - var w = out.width, h = out.height, area = w*h, qarea = area*4, data = out.data; - var img = new Uint8Array(area*4); - // 0: WhiteIsZero, 1: BlackIsZero, 2: RGB, 3: Palette color, 4: Transparency mask, 5: CMYK - var intp = out["t262"][0], bps = (out["t258"]?Math.min(32,out["t258"][0]):1), isLE = out.isLE ? 1 : 0; - //log("interpretation: ", intp, "bps", bps, out); - if(false) {} - else if(intp==0) - { - var bpl = Math.ceil(bps*w/8); - for(var y=0; y>3)])>>(7- (i&7)))& 1; img[qi]=img[qi+1]=img[qi+2]=( 1-px)*255; img[qi+3]=255; } - if(bps== 4) for(var i=0; i>1)])>>(4-4*(i&1)))&15; img[qi]=img[qi+1]=img[qi+2]=(15-px)* 17; img[qi+3]=255; } - if(bps== 8) for(var i=0; i>3)])>>(7- (i&7)))&1; img[qi]=img[qi+1]=img[qi+2]=(px)*255; img[qi+3]=255; } - if(bps== 2) for(var i=0; i>2)])>>(6-2*(i&3)))&3; img[qi]=img[qi+1]=img[qi+2]=(px)* 85; img[qi+3]=255; } - if(bps== 8) for(var i=0; i0) for(var i=0; i>8); img[qi+1]=(map[256+mi]>>8); img[qi+2]=(map[512+mi]>>8); img[qi+3]=255; } - } - else if(intp==5) - { - var smpls = out["t258"]?out["t258"].length : 4; - var gotAlpha = smpls>4 ? 1 : 0; - for(var i=0; i> 8)&255; buff[p+1] = n&255; }, - writeUint : function(buff, p, n) { buff[p] = (n>>24)&255; buff[p+1] = (n>>16)&255; buff[p+2] = (n>>8)&255; buff[p+3] = (n>>0)&255; }, - writeASCII : function(buff, p, s) { for(var i = 0; i < s.length; i++) buff[p+i] = s.charCodeAt(i); }, - writeDouble: function(buff, p, n) - { - UTIF._binBE.fl64[0] = n; - for (var i = 0; i < 8; i++) buff[p + i] = UTIF._binBE.ui8[7 - i]; - } -} -UTIF._binBE.ui8 = new Uint8Array (8); -UTIF._binBE.i16 = new Int16Array (UTIF._binBE.ui8.buffer); -UTIF._binBE.i32 = new Int32Array (UTIF._binBE.ui8.buffer); -UTIF._binBE.ui32 = new Uint32Array (UTIF._binBE.ui8.buffer); -UTIF._binBE.fl32 = new Float32Array(UTIF._binBE.ui8.buffer); -UTIF._binBE.fl64 = new Float64Array(UTIF._binBE.ui8.buffer); - -UTIF._binLE = -{ - nextZero : UTIF._binBE.nextZero, - readUshort : function(buff, p) { return (buff[p+1]<< 8) | buff[p]; }, - readShort : function(buff, p) { var a=UTIF._binBE.ui8; a[0]=buff[p+0]; a[1]=buff[p+1]; return UTIF._binBE. i16[0]; }, - readInt : function(buff, p) { var a=UTIF._binBE.ui8; a[0]=buff[p+0]; a[1]=buff[p+1]; a[2]=buff[p+2]; a[3]=buff[p+3]; return UTIF._binBE. i32[0]; }, - readUint : function(buff, p) { var a=UTIF._binBE.ui8; a[0]=buff[p+0]; a[1]=buff[p+1]; a[2]=buff[p+2]; a[3]=buff[p+3]; return UTIF._binBE.ui32[0]; }, - readASCII : UTIF._binBE.readASCII, - readFloat : function(buff, p) { var a=UTIF._binBE.ui8; for(var i=0;i<4;i++) a[i]=buff[p+ i]; return UTIF._binBE.fl32[0]; }, - readDouble : function(buff, p) { var a=UTIF._binBE.ui8; for(var i=0;i<8;i++) a[i]=buff[p+ i]; return UTIF._binBE.fl64[0]; } -} -UTIF._copyTile = function(tb, tw, th, b, w, h, xoff, yoff) -{ - //log("copyTile", tw, th, w, h, xoff, yoff); - var xlim = Math.min(tw, w-xoff); - var ylim = Math.min(th, h-yoff); - for(var y=0; y 0 ) { - timeoutTimer = setTimeout(function(){ - if (aborted) return - aborted = true//IE9 may still call readystatechange - xhr.abort("timeout") - var e = new Error("XMLHttpRequest timeout") - e.code = "ETIMEDOUT" - errorFunc(e) - }, options.timeout ) - } - - if (xhr.setRequestHeader) { - for(key in headers){ - if(headers.hasOwnProperty(key)){ - xhr.setRequestHeader(key, headers[key]) - } - } - } else if (options.headers && !isEmpty(options.headers)) { - throw new Error("Headers cannot be set on an XDomainRequest object") - } - - if ("responseType" in options) { - xhr.responseType = options.responseType - } - - if ("beforeSend" in options && - typeof options.beforeSend === "function" - ) { - options.beforeSend(xhr) - } - - // Microsoft Edge browser sends "undefined" when send is called with undefined value. - // XMLHttpRequest spec says to pass null as body to indicate no body - // See https://github.com/naugtur/xhr/issues/100. - xhr.send(body || null) - - return xhr - - -} - -function getXml(xhr) { - // xhr.responseXML will throw Exception "InvalidStateError" or "DOMException" - // See https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseXML. - try { - if (xhr.responseType === "document") { - return xhr.responseXML - } - var firefoxBugTakenEffect = xhr.responseXML && xhr.responseXML.documentElement.nodeName === "parsererror" - if (xhr.responseType === "" && !firefoxBugTakenEffect) { - return xhr.responseXML - } - } catch (e) {} - - return null -} - -function noop() {} - -},{"global/window":71,"is-function":78,"parse-headers":106,"xtend":189}],188:[function(require,module,exports){ -module.exports = (function xmlparser() { - //common browsers - if (typeof self.DOMParser !== 'undefined') { - return function(str) { - var parser = new self.DOMParser() - return parser.parseFromString(str, 'application/xml') - } - } - - //IE8 fallback - if (typeof self.ActiveXObject !== 'undefined' - && new self.ActiveXObject('Microsoft.XMLDOM')) { - return function(str) { - var xmlDoc = new self.ActiveXObject("Microsoft.XMLDOM") - xmlDoc.async = "false" - xmlDoc.loadXML(str) - return xmlDoc - } - } - - //last resort fallback - return function(str) { - var div = document.createElement('div') - div.innerHTML = str - return div - } -})() - -},{}],189:[function(require,module,exports){ -module.exports = extend - -var hasOwnProperty = Object.prototype.hasOwnProperty; - -function extend() { - var target = {} - - for (var i = 0; i < arguments.length; i++) { - var source = arguments[i] - - for (var key in source) { - if (hasOwnProperty.call(source, key)) { - target[key] = source[key] - } - } - } - - return target -} - -},{}],190:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.srcOver = srcOver; -exports.dstOver = dstOver; -exports.multiply = multiply; -exports.add = add; -exports.screen = screen; -exports.overlay = overlay; -exports.darken = darken; -exports.lighten = lighten; -exports.hardLight = hardLight; -exports.difference = difference; -exports.exclusion = exclusion; - -function srcOver(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a; - var g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a; - var b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function dstOver(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a; - var g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a; - var b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function multiply(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function add(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra + dra) / a; - var g = (sga + dga) / a; - var b = (sba + dba) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function screen(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra * dst.a + dra * src.a - sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (sga * dst.a + dga * src.a - sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (sba * dst.a + dba * src.a - sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function overlay(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (2 * dra <= dst.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a; - var g = (2 * dga <= dst.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a; - var b = (2 * dba <= dst.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function darken(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (Math.min(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (Math.min(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (Math.min(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function lighten(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (Math.max(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (Math.max(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (Math.max(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function hardLight(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (2 * sra <= src.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a; - var g = (2 * sga <= src.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a; - var b = (2 * sba <= src.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function difference(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a; - var g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a; - var b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -function exclusion(src, dst) { - var ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - src.a *= ops; - var a = dst.a + src.a - dst.a * src.a; - var sra = src.r * src.a; - var sga = src.g * src.a; - var sba = src.b * src.a; - var dra = dst.r * dst.a; - var dga = dst.g * dst.a; - var dba = dst.b * dst.a; - var r = (sra * dst.a + dra * src.a - 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a; - var g = (sga * dst.a + dga * src.a - 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a; - var b = (sba * dst.a + dba * src.a - 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a; - return { - r: r, - g: g, - b: b, - a: a - }; -} - -},{}],191:[function(require,module,exports){ -"use strict"; - -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = composite; - -var _utils = require("@jimp/utils"); - -var constants = _interopRequireWildcard(require("../constants")); - -var compositeModes = _interopRequireWildcard(require("./composite-modes")); - -/** - * Composites a source image over to this image respecting alpha channels - * @param {Jimp} src the source Jimp instance - * @param {number} x the x position to blit the image - * @param {number} y the y position to blit the image - * @param {object} options determine what mode to use - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -function composite(src, x, y) { - var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; - var cb = arguments.length > 4 ? arguments[4] : undefined; - - if (typeof options === 'function') { - cb = options; - options = {}; - } - - if (!(src instanceof this.constructor)) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } - - var _options = options, - mode = _options.mode, - opacitySource = _options.opacitySource, - opacityDest = _options.opacityDest; - - if (!mode) { - mode = constants.BLEND_SOURCE_OVER; - } - - if (typeof opacitySource !== 'number' || opacitySource < 0 || opacitySource > 1) { - opacitySource = 1.0; - } - - if (typeof opacityDest !== 'number' || opacityDest < 0 || opacityDest > 1) { - opacityDest = 1.0; - } - - var blendmode = compositeModes[mode]; // round input - - x = Math.round(x); - y = Math.round(y); - var baseImage = this; - - if (opacityDest !== 1.0) { - baseImage.opacity(opacityDest); - } - - src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) { - var dstIdx = baseImage.getPixelIndex(x + sx, y + sy, constants.EDGE_CROP); - var blended = blendmode({ - r: this.bitmap.data[idx + 0] / 255, - g: this.bitmap.data[idx + 1] / 255, - b: this.bitmap.data[idx + 2] / 255, - a: this.bitmap.data[idx + 3] / 255 - }, { - r: baseImage.bitmap.data[dstIdx + 0] / 255, - g: baseImage.bitmap.data[dstIdx + 1] / 255, - b: baseImage.bitmap.data[dstIdx + 2] / 255, - a: baseImage.bitmap.data[dstIdx + 3] / 255 - }, opacitySource); - baseImage.bitmap.data[dstIdx + 0] = this.constructor.limit255(blended.r * 255); - baseImage.bitmap.data[dstIdx + 1] = this.constructor.limit255(blended.g * 255); - baseImage.bitmap.data[dstIdx + 2] = this.constructor.limit255(blended.b * 255); - baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(blended.a * 255); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; -} - -module.exports = exports.default; - -},{"../constants":192,"./composite-modes":190,"@babel/runtime/helpers/interopRequireWildcard":12,"@jimp/utils":235}],192:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.EDGE_CROP = exports.EDGE_WRAP = exports.EDGE_EXTEND = exports.BLEND_EXCLUSION = exports.BLEND_DIFFERENCE = exports.BLEND_HARDLIGHT = exports.BLEND_LIGHTEN = exports.BLEND_DARKEN = exports.BLEND_OVERLAY = exports.BLEND_SCREEN = exports.BLEND_ADD = exports.BLEND_MULTIPLY = exports.BLEND_DESTINATION_OVER = exports.BLEND_SOURCE_OVER = exports.VERTICAL_ALIGN_BOTTOM = exports.VERTICAL_ALIGN_MIDDLE = exports.VERTICAL_ALIGN_TOP = exports.HORIZONTAL_ALIGN_RIGHT = exports.HORIZONTAL_ALIGN_CENTER = exports.HORIZONTAL_ALIGN_LEFT = exports.AUTO = void 0; -// used to auto resizing etc. -var AUTO = -1; // Align modes for cover, contain, bit masks - -exports.AUTO = AUTO; -var HORIZONTAL_ALIGN_LEFT = 1; -exports.HORIZONTAL_ALIGN_LEFT = HORIZONTAL_ALIGN_LEFT; -var HORIZONTAL_ALIGN_CENTER = 2; -exports.HORIZONTAL_ALIGN_CENTER = HORIZONTAL_ALIGN_CENTER; -var HORIZONTAL_ALIGN_RIGHT = 4; -exports.HORIZONTAL_ALIGN_RIGHT = HORIZONTAL_ALIGN_RIGHT; -var VERTICAL_ALIGN_TOP = 8; -exports.VERTICAL_ALIGN_TOP = VERTICAL_ALIGN_TOP; -var VERTICAL_ALIGN_MIDDLE = 16; -exports.VERTICAL_ALIGN_MIDDLE = VERTICAL_ALIGN_MIDDLE; -var VERTICAL_ALIGN_BOTTOM = 32; // blend modes - -exports.VERTICAL_ALIGN_BOTTOM = VERTICAL_ALIGN_BOTTOM; -var BLEND_SOURCE_OVER = 'srcOver'; -exports.BLEND_SOURCE_OVER = BLEND_SOURCE_OVER; -var BLEND_DESTINATION_OVER = 'dstOver'; -exports.BLEND_DESTINATION_OVER = BLEND_DESTINATION_OVER; -var BLEND_MULTIPLY = 'multiply'; -exports.BLEND_MULTIPLY = BLEND_MULTIPLY; -var BLEND_ADD = 'add'; -exports.BLEND_ADD = BLEND_ADD; -var BLEND_SCREEN = 'screen'; -exports.BLEND_SCREEN = BLEND_SCREEN; -var BLEND_OVERLAY = 'overlay'; -exports.BLEND_OVERLAY = BLEND_OVERLAY; -var BLEND_DARKEN = 'darken'; -exports.BLEND_DARKEN = BLEND_DARKEN; -var BLEND_LIGHTEN = 'lighten'; -exports.BLEND_LIGHTEN = BLEND_LIGHTEN; -var BLEND_HARDLIGHT = 'hardLight'; -exports.BLEND_HARDLIGHT = BLEND_HARDLIGHT; -var BLEND_DIFFERENCE = 'difference'; -exports.BLEND_DIFFERENCE = BLEND_DIFFERENCE; -var BLEND_EXCLUSION = 'exclusion'; // Edge Handling - -exports.BLEND_EXCLUSION = BLEND_EXCLUSION; -var EDGE_EXTEND = 1; -exports.EDGE_EXTEND = EDGE_EXTEND; -var EDGE_WRAP = 2; -exports.EDGE_WRAP = EDGE_WRAP; -var EDGE_CROP = 3; -exports.EDGE_CROP = EDGE_CROP; - -},{}],193:[function(require,module,exports){ -(function (Buffer){ -"use strict"; - -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.addConstants = addConstants; -exports.addJimpMethods = addJimpMethods; -exports.jimpEvMethod = jimpEvMethod; -exports.jimpEvChange = jimpEvChange; -Object.defineProperty(exports, "addType", { - enumerable: true, - get: function get() { - return MIME.addType; - } -}); -exports["default"] = void 0; - -var _construct2 = _interopRequireDefault(require("@babel/runtime/helpers/construct")); - -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); - -var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); - -var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); - -var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); - -var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); - -var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")); - -var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _fs = _interopRequireDefault(require("fs")); - -var _path = _interopRequireDefault(require("path")); - -var _events = _interopRequireDefault(require("events")); - -var _utils = require("@jimp/utils"); - -var _anyBase = _interopRequireDefault(require("any-base")); - -var _mkdirp = _interopRequireDefault(require("mkdirp")); - -var _pixelmatch = _interopRequireDefault(require("pixelmatch")); - -var _tinycolor = _interopRequireDefault(require("tinycolor2")); - -var _phash = _interopRequireDefault(require("./modules/phash")); - -var _request = _interopRequireDefault(require("./request")); - -var _composite = _interopRequireDefault(require("./composite")); - -var _promisify = _interopRequireDefault(require("./utils/promisify")); - -var MIME = _interopRequireWildcard(require("./utils/mime")); - -var _imageBitmap = require("./utils/image-bitmap"); - -var constants = _interopRequireWildcard(require("./constants")); - -var alphabet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_'; // an array storing the maximum string length of hashes at various bases -// 0 and 1 do not exist as possible hash lengths - -var maxHashLength = [NaN, NaN]; - -for (var i = 2; i < 65; i++) { - var maxHash = (0, _anyBase["default"])(_anyBase["default"].BIN, alphabet.slice(0, i))(new Array(64 + 1).join('1')); - maxHashLength.push(maxHash.length); -} // no operation - - -function noop() {} // error checking methods - - -function isArrayBuffer(test) { - return Object.prototype.toString.call(test).toLowerCase().indexOf('arraybuffer') > -1; -} // Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion, -// But this function is not useful when running in node directly - - -function bufferFromArrayBuffer(arrayBuffer) { - var buffer = Buffer.alloc(arrayBuffer.byteLength); - var view = new Uint8Array(arrayBuffer); - - for (var _i = 0; _i < buffer.length; ++_i) { - buffer[_i] = view[_i]; - } - - return buffer; -} - -function loadFromURL(options, cb) { - (0, _request["default"])(options, function (err, response, data) { - if (err) { - return cb(err); - } - - if ('headers' in response && 'location' in response.headers) { - options.url = response.headers.location; - return loadFromURL(options, cb); - } - - if ((0, _typeof2["default"])(data) === 'object' && Buffer.isBuffer(data)) { - return cb(null, data); - } - - var msg = 'Could not load Buffer from <' + options.url + '> ' + '(HTTP: ' + response.statusCode + ')'; - return new Error(msg); - }); -} - -function loadBufferFromPath(src, cb) { - if (_fs["default"] && typeof _fs["default"].readFile === 'function' && !src.match(/^(http|ftp)s?:\/\/./)) { - _fs["default"].readFile(src, cb); - } else { - loadFromURL({ - url: src - }, cb); - } -} - -function isRawRGBAData(obj) { - return obj && (0, _typeof2["default"])(obj) === 'object' && typeof obj.width === 'number' && typeof obj.height === 'number' && (Buffer.isBuffer(obj.data) || obj.data instanceof Uint8Array || typeof Uint8ClampedArray === 'function' && obj.data instanceof Uint8ClampedArray) && (obj.data.length === obj.width * obj.height * 4 || obj.data.length === obj.width * obj.height * 3); -} - -function makeRGBABufferFromRGB(buffer) { - if (buffer.length % 3 !== 0) { - throw new Error('Buffer length is incorrect'); - } - - var rgbaBuffer = Buffer.allocUnsafe(buffer.length / 3 * 4); - var j = 0; - - for (var _i2 = 0; _i2 < buffer.length; _i2++) { - rgbaBuffer[j] = buffer[_i2]; - - if ((_i2 + 1) % 3 === 0) { - rgbaBuffer[++j] = 255; - } - - j++; - } - - return rgbaBuffer; -} - -var emptyBitmap = { - data: null, - width: null, - height: null -}; -/** - * Jimp constructor (from a file) - * @param path a path to the image - * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap - */ - -/** - * Jimp constructor (from a url with options) - * @param options { url, otherOptions} - * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap - */ - -/** - * Jimp constructor (from another Jimp image or raw image data) - * @param image a Jimp image to clone - * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap - */ - -/** - * Jimp constructor (from a Buffer) - * @param data a Buffer containing the image data - * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap - */ - -/** - * Jimp constructor (to generate a new image) - * @param w the width of the image - * @param h the height of the image - * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap - */ - -/** - * Jimp constructor (to generate a new image) - * @param w the width of the image - * @param h the height of the image - * @param background color to fill the image with - * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap - */ - -var Jimp = -/*#__PURE__*/ -function (_EventEmitter) { - (0, _inherits2["default"])(Jimp, _EventEmitter); - - // An object representing a bitmap in memory, comprising: - // - data: a buffer of the bitmap data - // - width: the width of the image in pixels - // - height: the height of the image in pixels - // Default colour to use for new pixels - // Default MIME is PNG - // Exif data for the image - // Whether Transparency supporting formats will be exported as RGB or RGBA - function Jimp() { - var _this; - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - (0, _classCallCheck2["default"])(this, Jimp); - _this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(Jimp).call(this)); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "bitmap", emptyBitmap); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_background", 0x00000000); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_originalMime", Jimp.MIME_PNG); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_exif", null); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_rgba", true); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "writeAsync", function (path) { - return (0, _promisify["default"])(_this.write, (0, _assertThisInitialized2["default"])(_this), path); - }); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBase64Async", function (mime) { - return (0, _promisify["default"])(_this.getBase64, (0, _assertThisInitialized2["default"])(_this), mime); - }); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBuffer", _imageBitmap.getBuffer); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getBufferAsync", _imageBitmap.getBufferAsync); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getPixelColour", _this.getPixelColor); - (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setPixelColour", _this.setPixelColor); - var jimpInstance = (0, _assertThisInitialized2["default"])(_this); - var cb = noop; - - if (isArrayBuffer(args[0])) { - args[0] = bufferFromArrayBuffer(args[0]); - } - - function finish() { - for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - args[_key2] = arguments[_key2]; - } - - var err = args[0]; - var evData = err || {}; - evData.methodName = 'constructor'; - setTimeout(function () { - var _cb; - - // run on next tick. - if (err && cb === noop) { - jimpInstance.emitError('constructor', err); - } else if (!err) { - jimpInstance.emitMulti('constructor', 'initialized'); - } - - (_cb = cb).call.apply(_cb, [jimpInstance].concat(args)); - }, 1); - } - - if (typeof args[0] === 'number' && typeof args[1] === 'number' || parseInt(args[0], 10) && parseInt(args[1], 10)) { - // create a new image - var w = parseInt(args[0], 10); - var h = parseInt(args[1], 10); - cb = args[2]; // with a hex color - - if (typeof args[2] === 'number') { - _this._background = args[2]; - cb = args[3]; - } // with a css color - - - if (typeof args[2] === 'string') { - _this._background = Jimp.cssColorToHex(args[2]); - cb = args[3]; - } - - if (typeof cb === 'undefined') { - cb = noop; - } - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); - } - - _this.bitmap = { - data: Buffer.alloc(w * h * 4), - width: w, - height: h - }; - - for (var _i3 = 0; _i3 < _this.bitmap.data.length; _i3 += 4) { - _this.bitmap.data.writeUInt32BE(_this._background, _i3); - } - - finish(null, (0, _assertThisInitialized2["default"])(_this)); - } else if ((0, _typeof2["default"])(args[0]) === 'object' && args[0].url) { - cb = args[1] || noop; - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); - } - - loadFromURL(args[0], function (err, data) { - if (err) { - return _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), err, finish); - } - - _this.parseBitmap(data, args[0].url, finish); - }); - } else if (args[0] instanceof Jimp) { - // clone an existing Jimp - var original = args[0]; - cb = args[1]; - - if (typeof cb === 'undefined') { - cb = noop; - } - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); - } - - _this.bitmap = { - data: Buffer.from(original.bitmap.data), - width: original.bitmap.width, - height: original.bitmap.height - }; - _this._quality = original._quality; - _this._deflateLevel = original._deflateLevel; - _this._deflateStrategy = original._deflateStrategy; - _this._filterType = original._filterType; - _this._rgba = original._rgba; - _this._background = original._background; - _this._originalMime = original._originalMime; - finish(null, (0, _assertThisInitialized2["default"])(_this)); - } else if (isRawRGBAData(args[0])) { - var imageData = args[0]; - cb = args[1] || noop; - var isRGBA = imageData.width * imageData.height * 4 === imageData.data.length; - var buffer = isRGBA ? Buffer.from(imageData.data) : makeRGBABufferFromRGB(imageData.data); - _this.bitmap = { - data: buffer, - width: imageData.width, - height: imageData.height - }; - finish(null, (0, _assertThisInitialized2["default"])(_this)); - } else if (typeof args[0] === 'string') { - // read from a path - var path = args[0]; - cb = args[1]; - - if (typeof cb === 'undefined') { - cb = noop; - } - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); - } - - loadBufferFromPath(path, function (err, data) { - if (err) { - return _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), err, finish); - } - - _this.parseBitmap(data, path, finish); - }); - } else if ((0, _typeof2["default"])(args[0]) === 'object' && Buffer.isBuffer(args[0])) { - // read from a buffer - var data = args[0]; - cb = args[1]; - - if (typeof cb !== 'function') { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'cb must be a function', finish)); - } - - _this.parseBitmap(data, null, finish); - } else { - // Allow client libs to add new ways to build a Jimp object. - // Extra constructors must be added by `Jimp.appendConstructorOption()` - cb = args[args.length - 1]; - - if (typeof cb !== 'function') { - // TODO: try to solve the args after cb problem. - cb = args[args.length - 2]; - - if (typeof cb !== 'function') { - cb = noop; - } - } - - var extraConstructor = Jimp.__extraConstructors.find(function (c) { - return c.test.apply(c, args); - }); - - if (extraConstructor) { - new Promise(function (resolve, reject) { - var _extraConstructor$run; - - return (_extraConstructor$run = extraConstructor.run).call.apply(_extraConstructor$run, [(0, _assertThisInitialized2["default"])(_this), resolve, reject].concat(args)); - }).then(function () { - return finish(null, (0, _assertThisInitialized2["default"])(_this)); - })["catch"](finish); - } else { - return (0, _possibleConstructorReturn2["default"])(_this, _utils.throwError.call((0, _assertThisInitialized2["default"])(_this), 'No matching constructor overloading was found. ' + 'Please see the docs for how to call the Jimp constructor.', finish)); - } - } - - return _this; - } - /** - * Parse a bitmap with the loaded image types. - * - * @param {Buffer} data raw image data - * @param {string} path optional path to file - * @param {function(Error, Jimp)} finish (optional) a callback for when complete - * @memberof Jimp - */ - - - (0, _createClass2["default"])(Jimp, [{ - key: "parseBitmap", - value: function parseBitmap(data, path, finish) { - _imageBitmap.parseBitmap.call(this, data, null, finish); - } - /** - * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA) - * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - - }, { - key: "rgba", - value: function rgba(bool, cb) { - if (typeof bool !== 'boolean') { - return _utils.throwError.call(this, 'bool must be a boolean, true for RGBA or false for RGB', cb); - } - - this._rgba = bool; - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - /** - * Emit for multiple listeners - * @param {string} methodName name of the method to emit an error for - * @param {string} eventName name of the eventName to emit an error for - * @param {object} data to emit - */ - - }, { - key: "emitMulti", - value: function emitMulti(methodName, eventName) { - var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - data = Object.assign(data, { - methodName: methodName, - eventName: eventName - }); - this.emit('any', data); - - if (methodName) { - this.emit(methodName, data); - } - - this.emit(eventName, data); - } - }, { - key: "emitError", - value: function emitError(methodName, err) { - this.emitMulti(methodName, 'error', err); - } - /** - * Get the current height of the image - * @return {number} height of the image - */ - - }, { - key: "getHeight", - value: function getHeight() { - return this.bitmap.height; - } - /** - * Get the current width of the image - * @return {number} width of the image - */ - - }, { - key: "getWidth", - value: function getWidth() { - return this.bitmap.width; - } - /** - * Nicely format Jimp object when sent to the console e.g. console.log(image) - * @returns {string} pretty printed - */ - - }, { - key: "inspect", - value: function inspect() { - return ''; - } - /** - * Nicely format Jimp object when converted to a string - * @returns {string} pretty printed - */ - - }, { - key: "toString", - value: function toString() { - return '[object Jimp]'; - } - /** - * Returns the original MIME of the image (default: "image/png") - * @returns {string} the MIME - */ - - }, { - key: "getMIME", - value: function getMIME() { - var mime = this._originalMime || Jimp.MIME_PNG; - return mime; - } - /** - * Returns the appropriate file extension for the original MIME of the image (default: "png") - * @returns {string} the file extension - */ - - }, { - key: "getExtension", - value: function getExtension() { - var mime = this.getMIME(); - return MIME.getExtension(mime); - } - /** - * Writes the image to a file - * @param {string} path a path to the destination file - * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk - * @returns {Jimp} this for chaining of methods - */ - - }, { - key: "write", - value: function write(path, cb) { - var _this2 = this; - - if (!_fs["default"] || !_fs["default"].createWriteStream) { - throw new Error('Cant access the filesystem. You can use the getBase64 method.'); - } - - if (typeof path !== 'string') { - return _utils.throwError.call(this, 'path must be a string', cb); - } - - if (typeof cb === 'undefined') { - cb = noop; - } - - if (typeof cb !== 'function') { - return _utils.throwError.call(this, 'cb must be a function', cb); - } - - var mime = MIME.getType(path) || this.getMIME(); - - var pathObj = _path["default"].parse(path); - - if (pathObj.dir) { - _mkdirp["default"].sync(pathObj.dir); - } - - this.getBuffer(mime, function (err, buffer) { - if (err) { - return _utils.throwError.call(_this2, err, cb); - } - - var stream = _fs["default"].createWriteStream(path); - - stream.on('open', function () { - stream.write(buffer); - stream.end(); - }).on('error', function (err) { - return _utils.throwError.call(_this2, err, cb); - }); - stream.on('finish', function () { - cb.call(_this2, null, _this2); - }); - }); - return this; - } - }, { - key: "getBase64", - - /** - * Converts the image to a base 64 string - * @param {string} mime the mime type of the image data to be created - * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument - * @returns {Jimp} this for chaining of methods - */ - value: function getBase64(mime, cb) { - if (mime === Jimp.AUTO) { - // allow auto MIME detection - mime = this.getMIME(); - } - - if (typeof mime !== 'string') { - return _utils.throwError.call(this, 'mime must be a string', cb); - } - - if (typeof cb !== 'function') { - return _utils.throwError.call(this, 'cb must be a function', cb); - } - - this.getBuffer(mime, function (err, data) { - if (err) { - return _utils.throwError.call(this, err, cb); - } - - var src = 'data:' + mime + ';base64,' + data.toString('base64'); - cb.call(this, null, src); - }); - return this; - } - }, { - key: "hash", - - /** - * Generates a perceptual hash of the image . And pads the string. Can configure base. - * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {string} a string representing the hash - */ - value: function hash(base, cb) { - base = base || 64; - - if (typeof base === 'function') { - cb = base; - base = 64; - } - - if (typeof base !== 'number') { - return _utils.throwError.call(this, 'base must be a number', cb); - } - - if (base < 2 || base > 64) { - return _utils.throwError.call(this, 'base must be a number between 2 and 64', cb); - } - - var hash = this.pHash(); - hash = (0, _anyBase["default"])(_anyBase["default"].BIN, alphabet.slice(0, base))(hash); - - while (hash.length < maxHashLength[base]) { - hash = '0' + hash; // pad out with leading zeros - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, hash); - } - - return hash; - } - /** - * Calculates the perceptual hash - * @returns {number} the perceptual hash - */ - - }, { - key: "pHash", - value: function pHash() { - var pHash = new _phash["default"](); - return pHash.getHash(this); - } - /** - * Calculates the hamming distance of the current image and a hash based on their perceptual hash - * @param {hash} compareHash hash to compare to - * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical - */ - - }, { - key: "distanceFromHash", - value: function distanceFromHash(compareHash) { - var pHash = new _phash["default"](); - var currentHash = pHash.getHash(this); - return pHash.distance(currentHash, compareHash); - } - /** - * Converts the image to a buffer - * @param {string} mime the mime type of the image buffer to be created - * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument - * @returns {Jimp} this for chaining of methods - */ - - }, { - key: "getPixelIndex", - - /** - * Returns the offset of a pixel in the bitmap buffer - * @param {number} x the x coordinate - * @param {number} y the y coordinate - * @param {string} edgeHandling (optional) define how to sum pixels from outside the border - * @param {number} cb (optional) a callback for when complete - * @returns {number} the index of the pixel or -1 if not found - */ - value: function getPixelIndex(x, y, edgeHandling, cb) { - var xi; - var yi; - - if (typeof edgeHandling === 'function' && typeof cb === 'undefined') { - cb = edgeHandling; - edgeHandling = null; - } - - if (!edgeHandling) { - edgeHandling = Jimp.EDGE_EXTEND; - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } // round input - - - x = Math.round(x); - y = Math.round(y); - xi = x; - yi = y; - - if (edgeHandling === Jimp.EDGE_EXTEND) { - if (x < 0) xi = 0; - if (x >= this.bitmap.width) xi = this.bitmap.width - 1; - if (y < 0) yi = 0; - if (y >= this.bitmap.height) yi = this.bitmap.height - 1; - } - - if (edgeHandling === Jimp.EDGE_WRAP) { - if (x < 0) { - xi = this.bitmap.width + x; - } - - if (x >= this.bitmap.width) { - xi = x % this.bitmap.width; - } - - if (y < 0) { - xi = this.bitmap.height + y; - } - - if (y >= this.bitmap.height) { - yi = y % this.bitmap.height; - } - } - - var i = this.bitmap.width * yi + xi << 2; // if out of bounds index is -1 - - if (xi < 0 || xi >= this.bitmap.width) { - i = -1; - } - - if (yi < 0 || yi >= this.bitmap.height) { - i = -1; - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, i); - } - - return i; - } - /** - * Returns the hex colour value of a pixel - * @param {number} x the x coordinate - * @param {number} y the y coordinate - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {number} the color of the pixel - */ - - }, { - key: "getPixelColor", - value: function getPixelColor(x, y, cb) { - if (typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'x and y must be numbers', cb); // round input - - x = Math.round(x); - y = Math.round(y); - var idx = this.getPixelIndex(x, y); - var hex = this.bitmap.data.readUInt32BE(idx); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, hex); - } - - return hex; - } - }, { - key: "setPixelColor", - - /** - * Returns the hex colour value of a pixel - * @param {number} hex color to set - * @param {number} x the x coordinate - * @param {number} y the y coordinate - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {number} the index of the pixel or -1 if not found - */ - value: function setPixelColor(hex, x, y, cb) { - if (typeof hex !== 'number' || typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'hex, x and y must be numbers', cb); // round input - - x = Math.round(x); - y = Math.round(y); - var idx = this.getPixelIndex(x, y); - this.bitmap.data.writeUInt32BE(hex, idx); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }, { - key: "hasAlpha", - - /** - * Determine if the image contains opaque pixels. - * @return {boolean} hasAlpha whether the image contains opaque pixels - */ - value: function hasAlpha() { - for (var yIndex = 0; yIndex < this.bitmap.height; yIndex++) { - for (var xIndex = 0; xIndex < this.bitmap.width; xIndex++) { - var idx = this.bitmap.width * yIndex + xIndex << 2; - var alpha = this.bitmap.data[idx + 3]; - - if (alpha !== 0xff) { - return true; - } - } - } - - return false; - } - /** - * Iterate scan through a region of the bitmap - * @param {number} x the x coordinate to begin the scan at - * @param {number} y the y coordinate to begin the scan at - * @param w the width of the scan region - * @param h the height of the scan region - * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>} - */ - - }, { - key: "scanIterator", - value: function scanIterator(x, y, w, h) { - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers'); - } - - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers'); - } - - return (0, _utils.scanIterator)(this, x, y, w, h); - } - }]); - return Jimp; -}(_events["default"]); - -function addConstants(constants) { - var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp; - Object.entries(constants).forEach(function (_ref) { - var _ref2 = (0, _slicedToArray2["default"])(_ref, 2), - name = _ref2[0], - value = _ref2[1]; - - jimpInstance[name] = value; - }); -} - -function addJimpMethods(methods) { - var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp; - Object.entries(methods).forEach(function (_ref3) { - var _ref4 = (0, _slicedToArray2["default"])(_ref3, 2), - name = _ref4[0], - value = _ref4[1]; - - jimpInstance.prototype[name] = value; - }); -} - -addConstants(constants); -addJimpMethods({ - composite: _composite["default"] -}); -Jimp.__extraConstructors = []; -/** - * Allow client libs to add new ways to build a Jimp object. - * @param {string} name identify the extra constructor. - * @param {function} test a function that returns true when it accepts the arguments passed to the main constructor. - * @param {function} run where the magic happens. - */ - -Jimp.appendConstructorOption = function (name, test, run) { - Jimp.__extraConstructors.push({ - name: name, - test: test, - run: run - }); -}; -/** - * Read an image from a file or a Buffer. Takes the same args as the constructor - * @returns {Promise} a promise - */ - - -Jimp.read = function () { - for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { - args[_key3] = arguments[_key3]; - } - - return new Promise(function (resolve, reject) { - (0, _construct2["default"])(Jimp, args.concat([function (err, image) { - if (err) reject(err);else resolve(image); - }])); - }); -}; - -Jimp.create = Jimp.read; -/** - * A static helper method that converts RGBA values to a single integer value - * @param {number} r the red value (0-255) - * @param {number} g the green value (0-255) - * @param {number} b the blue value (0-255) - * @param {number} a the alpha value (0-255) - * @param {function(Error, Jimp)} cb (optional) A callback for when complete - * @returns {number} an single integer colour value - */ - -Jimp.rgbaToInt = function (r, g, b, a, cb) { - if (typeof r !== 'number' || typeof g !== 'number' || typeof b !== 'number' || typeof a !== 'number') { - return _utils.throwError.call(this, 'r, g, b and a must be numbers', cb); - } - - if (r < 0 || r > 255) { - return _utils.throwError.call(this, 'r must be between 0 and 255', cb); - } - - if (g < 0 || g > 255) { - _utils.throwError.call(this, 'g must be between 0 and 255', cb); - } - - if (b < 0 || b > 255) { - return _utils.throwError.call(this, 'b must be between 0 and 255', cb); - } - - if (a < 0 || a > 255) { - return _utils.throwError.call(this, 'a must be between 0 and 255', cb); - } - - r = Math.round(r); - b = Math.round(b); - g = Math.round(g); - a = Math.round(a); - var i = r * Math.pow(256, 3) + g * Math.pow(256, 2) + b * Math.pow(256, 1) + a * Math.pow(256, 0); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, i); - } - - return i; -}; -/** - * A static helper method that converts RGBA values to a single integer value - * @param {number} i a single integer value representing an RGBA colour (e.g. 0xFF0000FF for red) - * @param {function(Error, Jimp)} cb (optional) A callback for when complete - * @returns {object} an object with the properties r, g, b and a representing RGBA values - */ - - -Jimp.intToRGBA = function (i, cb) { - if (typeof i !== 'number') { - return _utils.throwError.call(this, 'i must be a number', cb); - } - - var rgba = {}; - rgba.r = Math.floor(i / Math.pow(256, 3)); - rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2)); - rgba.b = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) / Math.pow(256, 1)); - rgba.a = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2) - rgba.b * Math.pow(256, 1)) / Math.pow(256, 0)); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, rgba); - } - - return rgba; -}; -/** - * Converts a css color (Hex, 8-digit (RGBA) Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, Named) to a hex number - * @param {string} cssColor a number - * @returns {number} a hex number representing a color - */ - - -Jimp.cssColorToHex = function (cssColor) { - cssColor = cssColor || 0; // 0, null, undefined, NaN - - if (typeof cssColor === 'number') return Number(cssColor); - return parseInt((0, _tinycolor["default"])(cssColor).toHex8(), 16); -}; -/** - * Limits a number to between 0 or 255 - * @param {number} n a number - * @returns {number} the number limited to between 0 or 255 - */ - - -Jimp.limit255 = function (n) { - n = Math.max(n, 0); - n = Math.min(n, 255); - return n; -}; -/** - * Diffs two images and returns - * @param {Jimp} img1 a Jimp image to compare - * @param {Jimp} img2 a Jimp image to compare - * @param {number} threshold (optional) a number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1) - * @returns {object} an object { percent: percent similar, diff: a Jimp image highlighting differences } - */ - - -Jimp.diff = function (img1, img2) { - var threshold = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.1; - if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp)) return _utils.throwError.call(this, 'img1 and img2 must be an Jimp images'); - var bmp1 = img1.bitmap; - var bmp2 = img2.bitmap; - - if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) { - if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) { - // img1 is bigger - img1 = img1.cloneQuiet().resize(bmp2.width, bmp2.height); - } else { - // img2 is bigger (or they are the same in area) - img2 = img2.cloneQuiet().resize(bmp1.width, bmp1.height); - } - } - - if (typeof threshold !== 'number' || threshold < 0 || threshold > 1) { - return _utils.throwError.call(this, 'threshold must be a number between 0 and 1'); - } - - var diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff); - var numDiffPixels = (0, _pixelmatch["default"])(bmp1.data, bmp2.data, diff.bitmap.data, diff.bitmap.width, diff.bitmap.height, { - threshold: threshold - }); - return { - percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height), - image: diff - }; -}; -/** - * Calculates the hamming distance of two images based on their perceptual hash - * @param {Jimp} img1 a Jimp image to compare - * @param {Jimp} img2 a Jimp image to compare - * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical - */ - - -Jimp.distance = function (img1, img2) { - var phash = new _phash["default"](); - var hash1 = phash.getHash(img1); - var hash2 = phash.getHash(img2); - return phash.distance(hash1, hash2); -}; -/** - * Calculates the hamming distance of two images based on their perceptual hash - * @param {hash} hash1 a pHash - * @param {hash} hash2 a pHash - * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical - */ - - -Jimp.compareHashes = function (hash1, hash2) { - var phash = new _phash["default"](); - return phash.distance(hash1, hash2); -}; -/** - * Compute color difference - * 0 means no difference, 1 means maximum difference. - * @param {number} rgba1: first color to compare. - * @param {number} rgba2: second color to compare. - * Both parameters must be an color object {r:val, g:val, b:val, a:val} - * Where `a` is optional and `val` is an integer between 0 and 255. - * @returns {number} float between 0 and 1. - */ - - -Jimp.colorDiff = function (rgba1, rgba2) { - var pow = function pow(n) { - return Math.pow(n, 2); - }; - - var max = Math.max; - var maxVal = 255 * 255 * 3; - - if (rgba1.a !== 0 && !rgba1.a) { - rgba1.a = 255; - } - - if (rgba2.a !== 0 && !rgba2.a) { - rgba2.a = 255; - } - - return (max(pow(rgba1.r - rgba2.r), pow(rgba1.r - rgba2.r - rgba1.a + rgba2.a)) + max(pow(rgba1.g - rgba2.g), pow(rgba1.g - rgba2.g - rgba1.a + rgba2.a)) + max(pow(rgba1.b - rgba2.b), pow(rgba1.b - rgba2.b - rgba1.a + rgba2.a))) / maxVal; -}; -/** - * Helper to create Jimp methods that emit events before and after its execution. - * @param {string} methodName The name to be appended to Jimp prototype. - * @param {string} evName The event name to be called. - * It will be prefixed by `before-` and emitted when on method call. - * It will be appended by `ed` and emitted after the method run. - * @param {function} method A function implementing the method itself. - * It will also create a quiet version that will not emit events, to not - * mess the user code with many `changed` event calls. You can call with - * `methodName + "Quiet"`. - * - * The emitted event comes with a object parameter to the listener with the - * `methodName` as one attribute. - */ - - -function jimpEvMethod(methodName, evName, method) { - var evNameBefore = 'before-' + evName; - var evNameAfter = evName.replace(/e$/, '') + 'ed'; - - Jimp.prototype[methodName] = function () { - var wrappedCb; - - for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { - args[_key4] = arguments[_key4]; - } - - var cb = args[method.length - 1]; - var jimpInstance = this; - - if (typeof cb === 'function') { - wrappedCb = function wrappedCb() { - for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { - args[_key5] = arguments[_key5]; - } - - var err = args[0], - data = args[1]; - - if (err) { - jimpInstance.emitError(methodName, err); - } else { - jimpInstance.emitMulti(methodName, evNameAfter, (0, _defineProperty2["default"])({}, methodName, data)); - } - - cb.apply(this, args); - }; - - args[args.length - 1] = wrappedCb; - } else { - wrappedCb = false; - } - - this.emitMulti(methodName, evNameBefore); - var result; - - try { - result = method.apply(this, args); - - if (!wrappedCb) { - this.emitMulti(methodName, evNameAfter, (0, _defineProperty2["default"])({}, methodName, result)); - } - } catch (error) { - error.methodName = methodName; - this.emitError(methodName, error); - } - - return result; - }; - - Jimp.prototype[methodName + 'Quiet'] = method; -} -/** - * Creates a new image that is a clone of this one. - * @param {function(Error, Jimp)} cb (optional) A callback for when complete - * @returns the new image - */ - - -jimpEvMethod('clone', 'clone', function (cb) { - var clone = new Jimp(this); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(clone, null, clone); - } - - return clone; -}); -/** - * Simplify jimpEvMethod call for the common `change` evName. - * @param {string} methodName name of the method - * @param {function} method to watch changes for - */ - -function jimpEvChange(methodName, method) { - jimpEvMethod(methodName, 'change', method); -} -/** - * Sets the type of the image (RGB or RGBA) when saving as PNG format (default is RGBA) - * @param b A Boolean, true to use RGBA or false to use RGB - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - - -jimpEvChange('background', function (hex, cb) { - if (typeof hex !== 'number') { - return _utils.throwError.call(this, 'hex must be a hexadecimal rgba value', cb); - } - - this._background = hex; - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; -}); -/** - * Scans through a region of the bitmap, calling a function for each pixel. - * @param {number} x the x coordinate to begin the scan at - * @param {number} y the y coordinate to begin the scan at - * @param w the width of the scan region - * @param h the height of the scan region - * @param f a function to call on even pixel; the (x, y) position of the pixel - * and the index of the pixel in the bitmap buffer are passed to the function - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - -jimpEvChange('scan', function (x, y, w, h, f, cb) { - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } - - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } - - if (typeof f !== 'function') { - return _utils.throwError.call(this, 'f must be a function', cb); - } - - var result = (0, _utils.scan)(this, x, y, w, h, f); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, result); - } - - return result; -}); - -if ("BROWSER" === 'BROWSER') { - // For use in a web browser or web worker - - /* global self */ - var gl; - - if (typeof window !== 'undefined' && (typeof window === "undefined" ? "undefined" : (0, _typeof2["default"])(window)) === 'object') { - gl = window; - } - - if (typeof self !== 'undefined' && (typeof self === "undefined" ? "undefined" : (0, _typeof2["default"])(self)) === 'object') { - gl = self; - } - - gl.Jimp = Jimp; - gl.Buffer = Buffer; -} - -var _default = Jimp; -exports["default"] = _default; - -}).call(this,require("buffer").Buffer) -},{"./composite":191,"./constants":192,"./modules/phash":194,"./request":195,"./utils/image-bitmap":196,"./utils/mime":197,"./utils/promisify":198,"@babel/runtime/helpers/assertThisInitialized":3,"@babel/runtime/helpers/classCallCheck":4,"@babel/runtime/helpers/construct":5,"@babel/runtime/helpers/createClass":6,"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/getPrototypeOf":9,"@babel/runtime/helpers/inherits":10,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/interopRequireWildcard":12,"@babel/runtime/helpers/possibleConstructorReturn":17,"@babel/runtime/helpers/slicedToArray":19,"@babel/runtime/helpers/typeof":21,"@jimp/utils":235,"any-base":23,"buffer":48,"events":52,"fs":47,"mkdirp":83,"path":107,"pixelmatch":109,"tinycolor2":178}],194:[function(require,module,exports){ -"use strict"; - -/* -Copyright (c) 2011 Elliot Shepherd - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ -// https://code.google.com/p/ironchef-team21/source/browse/ironchef_team21/src/ImagePHash.java - -/* - * pHash-like image hash. - * Author: Elliot Shepherd (elliot@jarofworms.com - * Based On: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html - */ -function ImagePHash(size, smallerSize) { - this.size = this.size || size; - this.smallerSize = this.smallerSize || smallerSize; - initCoefficients(this.size); -} - -ImagePHash.prototype.size = 32; -ImagePHash.prototype.smallerSize = 8; - -ImagePHash.prototype.distance = function (s1, s2) { - var counter = 0; - - for (var k = 0; k < s1.length; k++) { - if (s1[k] !== s2[k]) { - counter++; - } - } - - return counter / s1.length; -}; // Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on. - - -ImagePHash.prototype.getHash = function (img) { - /* 1. Reduce size. - * Like Average Hash, pHash starts with a small image. - * However, the image is larger than 8x8; 32x32 is a good size. - * This is really done to simplify the DCT computation and not - * because it is needed to reduce the high frequencies. - */ - img = img.clone().resize(this.size, this.size); - /* 2. Reduce color. - * The image is reduced to a grayscale just to further simplify - * the number of computations. - */ - - img.grayscale(); - var vals = []; - - for (var x = 0; x < img.bitmap.width; x++) { - vals[x] = []; - - for (var y = 0; y < img.bitmap.height; y++) { - vals[x][y] = intToRGBA(img.getPixelColor(x, y)).b; - } - } - /* 3. Compute the DCT. - * The DCT separates the image into a collection of frequencies - * and scalars. While JPEG uses an 8x8 DCT, this algorithm uses - * a 32x32 DCT. - */ - - - var dctVals = applyDCT(vals, this.size); - /* 4. Reduce the DCT. - * This is the magic step. While the DCT is 32x32, just keep the - * top-left 8x8. Those represent the lowest frequencies in the - * picture. - */ - - /* 5. Compute the average value. - * Like the Average Hash, compute the mean DCT value (using only - * the 8x8 DCT low-frequency values and excluding the first term - * since the DC coefficient can be significantly different from - * the other values and will throw off the average). - */ - - var total = 0; - - for (var _x = 0; _x < this.smallerSize; _x++) { - for (var _y = 0; _y < this.smallerSize; _y++) { - total += dctVals[_x][_y]; - } - } - - var avg = total / (this.smallerSize * this.smallerSize); - /* 6. Further reduce the DCT. - * This is the magic step. Set the 64 hash bits to 0 or 1 - * depending on whether each of the 64 DCT values is above or - * below the average value. The result doesn't tell us the - * actual low frequencies; it just tells us the very-rough - * relative scale of the frequencies to the mean. The result - * will not vary as long as the overall structure of the image - * remains the same; this can survive gamma and color histogram - * adjustments without a problem. - */ - - var hash = ''; - - for (var _x2 = 0; _x2 < this.smallerSize; _x2++) { - for (var _y2 = 0; _y2 < this.smallerSize; _y2++) { - hash += dctVals[_x2][_y2] > avg ? '1' : '0'; - } - } - - return hash; -}; // DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java - - -function intToRGBA(i) { - var rgba = {}; - rgba.r = Math.floor(i / Math.pow(256, 3)); - rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2)); - rgba.b = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) / Math.pow(256, 1)); - rgba.a = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2) - rgba.b * Math.pow(256, 1)) / Math.pow(256, 0)); - return rgba; -} - -var c = []; - -function initCoefficients(size) { - for (var i = 1; i < size; i++) { - c[i] = 1; - } - - c[0] = 1 / Math.sqrt(2.0); -} - -function applyDCT(f, size) { - var N = size; - var F = []; - - for (var u = 0; u < N; u++) { - F[u] = []; - - for (var v = 0; v < N; v++) { - var sum = 0; - - for (var i = 0; i < N; i++) { - for (var j = 0; j < N; j++) { - sum += Math.cos((2 * i + 1) / (2.0 * N) * u * Math.PI) * Math.cos((2 * j + 1) / (2.0 * N) * v * Math.PI) * f[i][j]; - } - } - - sum *= c[u] * c[v] / 4; - F[u][v] = sum; - } - } - - return F; -} - -module.exports = ImagePHash; - -},{}],195:[function(require,module,exports){ -(function (process,Buffer){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -/* global XMLHttpRequest */ -if (process.browser || "BROWSER" === 'BROWSER' || typeof process.versions.electron !== 'undefined' && process.type === 'renderer' && typeof XMLHttpRequest === 'function') { - // If we run into a browser or the electron renderer process, - // use XHR method instead of Request node module. - module.exports = function (options, cb) { - var xhr = new XMLHttpRequest(); - xhr.open('GET', options.url, true); - xhr.responseType = 'arraybuffer'; - xhr.addEventListener('load', function () { - if (xhr.status < 400) { - try { - var data = Buffer.from(this.response); - cb(null, xhr, data); - } catch (error) { - return cb(new Error('Response is not a buffer for url ' + options.url + '. Error: ' + error.message)); - } - } else { - cb(new Error('HTTP Status ' + xhr.status + ' for url ' + options.url)); - } - }); - xhr.addEventListener('error', function (e) { - cb(e); - }); - xhr.send(); - }; -} else { - module.exports = function (_ref, cb) { - var options = (0, _extends2["default"])({}, _ref); - - var p = require('phin'); - - p(_objectSpread({ - compression: true - }, options), function (err, res) { - if (err === null) { - cb(null, res, res.body); - } else { - cb(err); - } - }); - }; -} - -}).call(this,require('_process'),require("buffer").Buffer) -},{"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/extends":8,"@babel/runtime/helpers/interopRequireDefault":11,"_process":133,"buffer":48,"phin":108}],196:[function(require,module,exports){ -(function (Buffer){ -"use strict"; - -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.parseBitmap = parseBitmap; -exports.getBuffer = getBuffer; -exports.getBufferAsync = getBufferAsync; - -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); - -var _fileType = _interopRequireDefault(require("file-type")); - -var _exifParser = _interopRequireDefault(require("exif-parser")); - -var _utils = require("@jimp/utils"); - -var constants = _interopRequireWildcard(require("../constants")); - -var MIME = _interopRequireWildcard(require("./mime")); - -var _promisify = _interopRequireDefault(require("./promisify")); - -function getMIMEFromBuffer(buffer, path) { - var fileTypeFromBuffer = (0, _fileType["default"])(buffer); - - if (fileTypeFromBuffer) { - // If fileType returns something for buffer, then return the mime given - return fileTypeFromBuffer.mime; - } - - if (path) { - // If a path is supplied, and fileType yields no results, then retry with MIME - // Path can be either a file path or a url - return MIME.getType(path); - } - - return null; -} -/* - * Obtains image orientation from EXIF metadata. - * - * @param img {Jimp} a Jimp image object - * @returns {number} a number 1-8 representing EXIF orientation, - * in particular 1 if orientation tag is missing - */ - - -function getExifOrientation(img) { - return img._exif && img._exif.tags && img._exif.tags.Orientation || 1; -} -/** - * Returns a function which translates EXIF-rotated coordinates into - * non-rotated ones. - * - * Transformation reference: http://sylvana.net/jpegcrop/exif_orientation.html. - * - * @param img {Jimp} a Jimp image object - * @returns {function} transformation function for transformBitmap(). - */ - - -function getExifOrientationTransformation(img) { - var w = img.getWidth(); - var h = img.getHeight(); - - switch (getExifOrientation(img)) { - case 1: - // Horizontal (normal) - // does not need to be supported here - return null; - - case 2: - // Mirror horizontal - return function (x, y) { - return [w - x - 1, y]; - }; - - case 3: - // Rotate 180 - return function (x, y) { - return [w - x - 1, h - y - 1]; - }; - - case 4: - // Mirror vertical - return function (x, y) { - return [x, h - y - 1]; - }; - - case 5: - // Mirror horizontal and rotate 270 CW - return function (x, y) { - return [y, x]; - }; - - case 6: - // Rotate 90 CW - return function (x, y) { - return [y, h - x - 1]; - }; - - case 7: - // Mirror horizontal and rotate 90 CW - return function (x, y) { - return [w - y - 1, h - x - 1]; - }; - - case 8: - // Rotate 270 CW - return function (x, y) { - return [w - y - 1, x]; - }; - - default: - return null; - } -} -/* - * Transforms bitmap in place (moves pixels around) according to given - * transformation function. - * - * @param img {Jimp} a Jimp image object, which bitmap is supposed to - * be transformed - * @param width {number} bitmap width after the transformation - * @param height {number} bitmap height after the transformation - * @param transformation {function} transformation function which defines pixel - * mapping between new and source bitmap. It takes a pair of coordinates - * in the target, and returns a respective pair of coordinates in - * the source bitmap, i.e. has following form: - * `function(new_x, new_y) { return [src_x, src_y] }`. - */ - - -function transformBitmap(img, width, height, transformation) { - // Underscore-prefixed values are related to the source bitmap - // Their counterparts with no prefix are related to the target bitmap - var _data = img.bitmap.data; - var _width = img.bitmap.width; - var data = Buffer.alloc(_data.length); - - for (var x = 0; x < width; x++) { - for (var y = 0; y < height; y++) { - var _transformation = transformation(x, y), - _transformation2 = (0, _slicedToArray2["default"])(_transformation, 2), - _x = _transformation2[0], - _y = _transformation2[1]; - - var idx = width * y + x << 2; - - var _idx = _width * _y + _x << 2; - - var pixel = _data.readUInt32BE(_idx); - - data.writeUInt32BE(pixel, idx); - } - } - - img.bitmap.data = data; - img.bitmap.width = width; - img.bitmap.height = height; -} -/* - * Automagically rotates an image based on its EXIF data (if present). - * @param img {Jimp} a Jimp image object - */ - - -function exifRotate(img) { - if (getExifOrientation(img) < 2) return; - var transformation = getExifOrientationTransformation(img); - var swapDimensions = getExifOrientation(img) > 4; - var newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width; - var newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height; - transformBitmap(img, newWidth, newHeight, transformation); -} // parses a bitmap from the constructor to the JIMP bitmap property - - -function parseBitmap(data, path, cb) { - var mime = getMIMEFromBuffer(data, path); - - if (typeof mime !== 'string') { - return cb(new Error('Could not find MIME for Buffer <' + path + '>')); - } - - this._originalMime = mime.toLowerCase(); - - try { - var _mime = this.getMIME(); - - if (this.constructor.decoders[_mime]) { - this.bitmap = this.constructor.decoders[_mime](data); - } else { - return _utils.throwError.call(this, 'Unsupported MIME type: ' + _mime, cb); - } - } catch (error) { - return cb.call(this, error, this); - } - - try { - this._exif = _exifParser["default"].create(data).parse(); - exifRotate(this); // EXIF data - } catch (error) { - /* meh */ - } - - cb.call(this, null, this); - return this; -} - -function compositeBitmapOverBackground(Jimp, image) { - return new Jimp(image.bitmap.width, image.bitmap.height, image._background).composite(image, 0, 0).bitmap; -} -/** - * Converts the image to a buffer - * @param {string} mime the mime type of the image buffer to be created - * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument - * @returns {Jimp} this for chaining of methods - */ - - -function getBuffer(mime, cb) { - if (mime === constants.AUTO) { - // allow auto MIME detection - mime = this.getMIME(); - } - - if (typeof mime !== 'string') { - return _utils.throwError.call(this, 'mime must be a string', cb); - } - - if (typeof cb !== 'function') { - return _utils.throwError.call(this, 'cb must be a function', cb); - } - - mime = mime.toLowerCase(); - - if (this._rgba && this.constructor.hasAlpha[mime]) { - this.bitmap.data = Buffer.from(this.bitmap.data); - } else { - // when format doesn't support alpha - // composite onto a new image so that the background shows through alpha channels - this.bitmap.data = compositeBitmapOverBackground(this.constructor, this).data; - } - - if (this.constructor.encoders[mime]) { - var buffer = this.constructor.encoders[mime](this); - cb.call(this, null, buffer); - } else { - cb.call(this, 'Unsupported MIME type: ' + mime); - } - - return this; -} - -function getBufferAsync(mime) { - return (0, _promisify["default"])(getBuffer, this, mime); -} - -}).call(this,require("buffer").Buffer) -},{"../constants":192,"./mime":197,"./promisify":198,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/interopRequireWildcard":12,"@babel/runtime/helpers/slicedToArray":19,"@jimp/utils":235,"buffer":48,"exif-parser":53,"file-type":62}],197:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getExtension = exports.getType = exports.addType = void 0; -var mimeTypes = {}; - -var findType = function findType(extension) { - return Object.entries(mimeTypes).find(function (type) { - return type[1].includes(extension); - }) || []; -}; - -var addType = function addType(mime, extensions) { - mimeTypes[mime] = extensions; -}; -/** - * Lookup a mime type based on extension - * @param {string} path path to find extension for - * @returns {string} mime found mime type - */ - - -exports.addType = addType; - -var getType = function getType(path) { - var pathParts = path.split('/').slice(-1); - var extension = pathParts[pathParts.length - 1].split('.').pop(); - var type = findType(extension); - return type[0]; -}; -/** - * Return file extension associated with a mime type - * @param {string} type mime type to look up - * @returns {string} extension file extension - */ - - -exports.getType = getType; - -var getExtension = function getExtension(type) { - return (mimeTypes[type.toLowerCase()] || [])[0]; -}; - -exports.getExtension = getExtension; - -},{}],198:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var promisify = function promisify(fun, ctx) { - for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { - args[_key - 2] = arguments[_key]; - } - - return new Promise(function (resolve, reject) { - args.push(function (err, data) { - if (err) { - reject(err); - } - - resolve(data); - }); - fun.bind(ctx).apply(void 0, args); - }); -}; - -var _default = promisify; -exports["default"] = _default; -module.exports = exports.default; - -},{}],199:[function(require,module,exports){ -"use strict"; - -var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = configure; - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); - -var _core = _interopRequireWildcard(require("@jimp/core")); - -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - -function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } - -function configure(configuration) { - var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _core["default"]; - var jimpConfig = { - hasAlpha: {}, - encoders: {}, - decoders: {}, - "class": {}, - constants: {} - }; - - function addToConfig(newConfig) { - Object.entries(newConfig).forEach(function (_ref) { - var _ref2 = (0, _slicedToArray2["default"])(_ref, 2), - key = _ref2[0], - value = _ref2[1]; - - jimpConfig[key] = _objectSpread({}, jimpConfig[key], {}, value); - }); - } - - function addImageType(typeModule) { - var type = typeModule(); - - if (Array.isArray(type.mime)) { - _core.addType.apply(void 0, (0, _toConsumableArray2["default"])(type.mime)); - } else { - Object.entries(type.mime).forEach(function (mimeType) { - return _core.addType.apply(void 0, (0, _toConsumableArray2["default"])(mimeType)); - }); - } - - delete type.mime; - addToConfig(type); - } - - function addPlugin(pluginModule) { - var plugin = pluginModule(_core.jimpEvChange) || {}; - - if (!plugin["class"] && !plugin.constants) { - // Default to class function - addToConfig({ - "class": plugin - }); - } else { - addToConfig(plugin); - } - } - - if (configuration.types) { - configuration.types.forEach(addImageType); - jimpInstance.decoders = _objectSpread({}, jimpInstance.decoders, {}, jimpConfig.decoders); - jimpInstance.encoders = _objectSpread({}, jimpInstance.encoders, {}, jimpConfig.encoders); - jimpInstance.hasAlpha = _objectSpread({}, jimpInstance.hasAlpha, {}, jimpConfig.hasAlpha); - } - - if (configuration.plugins) { - configuration.plugins.forEach(addPlugin); - } - - (0, _core.addJimpMethods)(jimpConfig["class"], jimpInstance); - (0, _core.addConstants)(jimpConfig.constants, jimpInstance); - return _core["default"]; -} - -module.exports = exports.default; - -},{"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/interopRequireWildcard":12,"@babel/runtime/helpers/slicedToArray":19,"@babel/runtime/helpers/toConsumableArray":20,"@jimp/core":193}],200:[function(require,module,exports){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _custom = _interopRequireDefault(require("@jimp/custom")); - -var _types = _interopRequireDefault(require("@jimp/types")); - -var _plugins = _interopRequireDefault(require("@jimp/plugins")); - -var _default = (0, _custom["default"])({ - types: [_types["default"]], - plugins: [_plugins["default"]] -}); - -exports["default"] = _default; -module.exports = exports.default; - -},{"@babel/runtime/helpers/interopRequireDefault":11,"@jimp/custom":199,"@jimp/plugins":228,"@jimp/types":234}],201:[function(require,module,exports){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _utils = require("@jimp/utils"); - -var _default = function _default() { - return { - /** - * Blits a source image on to this image - * @param {Jimp} src the source Jimp instance - * @param {number} x the x position to blit the image - * @param {number} y the y position to blit the image - * @param {number} srcx (optional) the x position from which to crop the source image - * @param {number} srcy (optional) the y position from which to crop the source image - * @param {number} srcw (optional) the width to which to crop the source image - * @param {number} srch (optional) the height to which to crop the source image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - blit: function blit(src, x, y, srcx, srcy, srcw, srch, cb) { - if (!(src instanceof this.constructor)) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } - - if (typeof srcx === 'function') { - cb = srcx; - srcx = 0; - srcy = 0; - srcw = src.bitmap.width; - srch = src.bitmap.height; - } else if ((0, _typeof2["default"])(srcx) === (0, _typeof2["default"])(srcy) && (0, _typeof2["default"])(srcy) === (0, _typeof2["default"])(srcw) && (0, _typeof2["default"])(srcw) === (0, _typeof2["default"])(srch)) { - srcx = srcx || 0; - srcy = srcy || 0; - srcw = srcw || src.bitmap.width; - srch = srch || src.bitmap.height; - } else { - return _utils.throwError.call(this, 'srcx, srcy, srcw, srch must be numbers', cb); - } // round input - - - x = Math.round(x); - y = Math.round(y); // round input - - srcx = Math.round(srcx); - srcy = Math.round(srcy); - srcw = Math.round(srcw); - srch = Math.round(srch); - var maxWidth = this.bitmap.width; - var maxHeight = this.bitmap.height; - var baseImage = this; - src.scanQuiet(srcx, srcy, srcw, srch, function (sx, sy, idx) { - var xOffset = x + sx - srcx; - var yOffset = y + sy - srcy; - - if (xOffset >= 0 && yOffset >= 0 && maxWidth - xOffset > 0 && maxHeight - yOffset > 0) { - var dstIdx = baseImage.getPixelIndex(xOffset, yOffset); - var _src = { - r: this.bitmap.data[idx], - g: this.bitmap.data[idx + 1], - b: this.bitmap.data[idx + 2], - a: this.bitmap.data[idx + 3] - }; - var dst = { - r: baseImage.bitmap.data[dstIdx], - g: baseImage.bitmap.data[dstIdx + 1], - b: baseImage.bitmap.data[dstIdx + 2], - a: baseImage.bitmap.data[dstIdx + 3] - }; - baseImage.bitmap.data[dstIdx] = (_src.a * (_src.r - dst.r) - dst.r + 255 >> 8) + dst.r; - baseImage.bitmap.data[dstIdx + 1] = (_src.a * (_src.g - dst.g) - dst.g + 255 >> 8) + dst.g; - baseImage.bitmap.data[dstIdx + 2] = (_src.a * (_src.b - dst.b) - dst.b + 255 >> 8) + dst.b; - baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(dst.a + _src.a); - } - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/typeof":21,"@jimp/utils":235}],202:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.shgTable = exports.mulTable = void 0; -var mulTable = [1, 57, 41, 21, 203, 34, 97, 73, 227, 91, 149, 62, 105, 45, 39, 137, 241, 107, 3, 173, 39, 71, 65, 238, 219, 101, 187, 87, 81, 151, 141, 133, 249, 117, 221, 209, 197, 187, 177, 169, 5, 153, 73, 139, 133, 127, 243, 233, 223, 107, 103, 99, 191, 23, 177, 171, 165, 159, 77, 149, 9, 139, 135, 131, 253, 245, 119, 231, 224, 109, 211, 103, 25, 195, 189, 23, 45, 175, 171, 83, 81, 79, 155, 151, 147, 9, 141, 137, 67, 131, 129, 251, 123, 30, 235, 115, 113, 221, 217, 53, 13, 51, 50, 49, 193, 189, 185, 91, 179, 175, 43, 169, 83, 163, 5, 79, 155, 19, 75, 147, 145, 143, 35, 69, 17, 67, 33, 65, 255, 251, 247, 243, 239, 59, 29, 229, 113, 111, 219, 27, 213, 105, 207, 51, 201, 199, 49, 193, 191, 47, 93, 183, 181, 179, 11, 87, 43, 85, 167, 165, 163, 161, 159, 157, 155, 77, 19, 75, 37, 73, 145, 143, 141, 35, 138, 137, 135, 67, 33, 131, 129, 255, 63, 250, 247, 61, 121, 239, 237, 117, 29, 229, 227, 225, 111, 55, 109, 216, 213, 211, 209, 207, 205, 203, 201, 199, 197, 195, 193, 48, 190, 47, 93, 185, 183, 181, 179, 178, 176, 175, 173, 171, 85, 21, 167, 165, 41, 163, 161, 5, 79, 157, 78, 154, 153, 19, 75, 149, 74, 147, 73, 144, 143, 71, 141, 140, 139, 137, 17, 135, 134, 133, 66, 131, 65, 129, 1]; -exports.mulTable = mulTable; -var shgTable = [0, 9, 10, 10, 14, 12, 14, 14, 16, 15, 16, 15, 16, 15, 15, 17, 18, 17, 12, 18, 16, 17, 17, 19, 19, 18, 19, 18, 18, 19, 19, 19, 20, 19, 20, 20, 20, 20, 20, 20, 15, 20, 19, 20, 20, 20, 21, 21, 21, 20, 20, 20, 21, 18, 21, 21, 21, 21, 20, 21, 17, 21, 21, 21, 22, 22, 21, 22, 22, 21, 22, 21, 19, 22, 22, 19, 20, 22, 22, 21, 21, 21, 22, 22, 22, 18, 22, 22, 21, 22, 22, 23, 22, 20, 23, 22, 22, 23, 23, 21, 19, 21, 21, 21, 23, 23, 23, 22, 23, 23, 21, 23, 22, 23, 18, 22, 23, 20, 22, 23, 23, 23, 21, 22, 20, 22, 21, 22, 24, 24, 24, 24, 24, 22, 21, 24, 23, 23, 24, 21, 24, 23, 24, 22, 24, 24, 22, 24, 24, 22, 23, 24, 24, 24, 20, 23, 22, 23, 24, 24, 24, 24, 24, 24, 24, 23, 21, 23, 22, 23, 24, 24, 24, 22, 24, 24, 24, 23, 22, 24, 24, 25, 23, 25, 25, 23, 24, 25, 25, 24, 22, 25, 25, 25, 24, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 23, 25, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 22, 25, 25, 23, 25, 25, 20, 24, 25, 24, 25, 25, 22, 24, 25, 24, 25, 24, 25, 25, 24, 25, 25, 25, 25, 22, 25, 25, 25, 24, 25, 24, 25, 18]; -exports.shgTable = shgTable; - -},{}],203:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -var _blurTables = require("./blur-tables"); - -/* - Superfast Blur (0.5) - http://www.quasimondo.com/BoxBlurForCanvas/FastBlur.js - - Copyright (c) 2011 Mario Klingemann - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation - files (the "Software"), to deal in the Software without - restriction, including without limitation the rights to use, - copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following - conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - OTHER DEALINGS IN THE SOFTWARE. -*/ -var _default = function _default() { - return { - /** - * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker - * @param {number} r the pixel radius of the blur - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - blur: function blur(r, cb) { - if (typeof r !== 'number') return _utils.throwError.call(this, 'r must be a number', cb); - if (r < 1) return _utils.throwError.call(this, 'r must be greater than 0', cb); - var rsum; - var gsum; - var bsum; - var asum; - var x; - var y; - var i; - var p; - var p1; - var p2; - var yp; - var yi; - var yw; - var pa; - var wm = this.bitmap.width - 1; - var hm = this.bitmap.height - 1; // const wh = this.bitmap.width * this.bitmap.height; - - var rad1 = r + 1; - var mulSum = _blurTables.mulTable[r]; - var shgSum = _blurTables.shgTable[r]; - var red = []; - var green = []; - var blue = []; - var alpha = []; - var vmin = []; - var vmax = []; - var iterations = 2; - - while (iterations-- > 0) { - yi = 0; - yw = 0; - - for (y = 0; y < this.bitmap.height; y++) { - rsum = this.bitmap.data[yw] * rad1; - gsum = this.bitmap.data[yw + 1] * rad1; - bsum = this.bitmap.data[yw + 2] * rad1; - asum = this.bitmap.data[yw + 3] * rad1; - - for (i = 1; i <= r; i++) { - p = yw + ((i > wm ? wm : i) << 2); - rsum += this.bitmap.data[p++]; - gsum += this.bitmap.data[p++]; - bsum += this.bitmap.data[p++]; - asum += this.bitmap.data[p]; - } - - for (x = 0; x < this.bitmap.width; x++) { - red[yi] = rsum; - green[yi] = gsum; - blue[yi] = bsum; - alpha[yi] = asum; - - if (y === 0) { - vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2; - vmax[x] = (p = x - r) > 0 ? p << 2 : 0; - } - - p1 = yw + vmin[x]; - p2 = yw + vmax[x]; - rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; - gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; - bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++]; - asum += this.bitmap.data[p1] - this.bitmap.data[p2]; - yi++; - } - - yw += this.bitmap.width << 2; - } - - for (x = 0; x < this.bitmap.width; x++) { - yp = x; - rsum = red[yp] * rad1; - gsum = green[yp] * rad1; - bsum = blue[yp] * rad1; - asum = alpha[yp] * rad1; - - for (i = 1; i <= r; i++) { - yp += i > hm ? 0 : this.bitmap.width; - rsum += red[yp]; - gsum += green[yp]; - bsum += blue[yp]; - asum += alpha[yp]; - } - - yi = x << 2; - - for (y = 0; y < this.bitmap.height; y++) { - pa = asum * mulSum >>> shgSum; - this.bitmap.data[yi + 3] = pa; // normalize alpha - - if (pa > 255) { - this.bitmap.data[yi + 3] = 255; - } - - if (pa > 0) { - pa = 255 / pa; - this.bitmap.data[yi] = (rsum * mulSum >>> shgSum) * pa; - this.bitmap.data[yi + 1] = (gsum * mulSum >>> shgSum) * pa; - this.bitmap.data[yi + 2] = (bsum * mulSum >>> shgSum) * pa; - } else { - this.bitmap.data[yi + 2] = 0; - this.bitmap.data[yi + 1] = 0; - this.bitmap.data[yi] = 0; - } - - if (x === 0) { - vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width; - vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0; - } - - p1 = x + vmin[y]; - p2 = x + vmax[y]; - rsum += red[p1] - red[p2]; - gsum += green[p1] - green[p2]; - bsum += blue[p1] - blue[p2]; - asum += alpha[p1] - alpha[p2]; - yi += this.bitmap.width << 2; - } - } - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"./blur-tables":202,"@jimp/utils":235}],204:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Creates a circle out of an image. - * @param {function(Error, Jimp)} options (optional) radius, x, y - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - circle: function circle() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var cb = arguments.length > 1 ? arguments[1] : undefined; - - if (typeof options === 'function') { - cb = options; - options = {}; - } - - var radius = options.radius || (this.bitmap.width > this.bitmap.height ? this.bitmap.height : this.bitmap.width) / 2; - var center = { - x: typeof options.x === 'number' ? options.x : this.bitmap.width / 2, - y: typeof options.y === 'number' ? options.y : this.bitmap.height / 2 - }; - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var curR = Math.sqrt(Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2)); - - if (radius - curR <= 0.0) { - this.bitmap.data[idx + 3] = 0; - } else if (radius - curR < 1.0) { - this.bitmap.data[idx + 3] = 255 * (radius - curR); - } - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],205:[function(require,module,exports){ -(function (Buffer){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - -var _tinycolor = _interopRequireDefault(require("tinycolor2")); - -var _utils = require("@jimp/utils"); - -function applyKernel(im, kernel, x, y) { - var value = [0, 0, 0]; - var size = (kernel.length - 1) / 2; - - for (var kx = 0; kx < kernel.length; kx += 1) { - for (var ky = 0; ky < kernel[kx].length; ky += 1) { - var idx = im.getPixelIndex(x + kx - size, y + ky - size); - value[0] += im.bitmap.data[idx] * kernel[kx][ky]; - value[1] += im.bitmap.data[idx + 1] * kernel[kx][ky]; - value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky]; - } - } - - return value; -} - -var isDef = function isDef(v) { - return typeof v !== 'undefined' && v !== null; -}; - -function greyscale(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var grey = parseInt(0.2126 * this.bitmap.data[idx] + 0.7152 * this.bitmap.data[idx + 1] + 0.0722 * this.bitmap.data[idx + 2], 10); - this.bitmap.data[idx] = grey; - this.bitmap.data[idx + 1] = grey; - this.bitmap.data[idx + 2] = grey; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; -} - -function mix(clr, clr2) { - var p = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50; - return { - r: (clr2.r - clr.r) * (p / 100) + clr.r, - g: (clr2.g - clr.g) * (p / 100) + clr.g, - b: (clr2.b - clr.b) * (p / 100) + clr.b - }; -} - -function colorFn(actions, cb) { - var _this = this; - - if (!actions || !Array.isArray(actions)) { - return _utils.throwError.call(this, 'actions must be an array', cb); - } - - actions = actions.map(function (action) { - if (action.apply === 'xor' || action.apply === 'mix') { - action.params[0] = (0, _tinycolor["default"])(action.params[0]).toRgb(); - } - - return action; - }); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var clr = { - r: _this.bitmap.data[idx], - g: _this.bitmap.data[idx + 1], - b: _this.bitmap.data[idx + 2] - }; - - var colorModifier = function colorModifier(i, amount) { - return _this.constructor.limit255(clr[i] + amount); - }; - - actions.forEach(function (action) { - if (action.apply === 'mix') { - clr = mix(clr, action.params[0], action.params[1]); - } else if (action.apply === 'tint') { - clr = mix(clr, { - r: 255, - g: 255, - b: 255 - }, action.params[0]); - } else if (action.apply === 'shade') { - clr = mix(clr, { - r: 0, - g: 0, - b: 0 - }, action.params[0]); - } else if (action.apply === 'xor') { - clr = { - r: clr.r ^ action.params[0].r, - g: clr.g ^ action.params[0].g, - b: clr.b ^ action.params[0].b - }; - } else if (action.apply === 'red') { - clr.r = colorModifier('r', action.params[0]); - } else if (action.apply === 'green') { - clr.g = colorModifier('g', action.params[0]); - } else if (action.apply === 'blue') { - clr.b = colorModifier('b', action.params[0]); - } else { - var _clr; - - if (action.apply === 'hue') { - action.apply = 'spin'; - } - - clr = (0, _tinycolor["default"])(clr); - - if (!clr[action.apply]) { - return _utils.throwError.call(_this, 'action ' + action.apply + ' not supported', cb); - } - - clr = (_clr = clr)[action.apply].apply(_clr, (0, _toConsumableArray2["default"])(action.params)).toRgb(); - } - }); - _this.bitmap.data[idx] = clr.r; - _this.bitmap.data[idx + 1] = clr.g; - _this.bitmap.data[idx + 2] = clr.b; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; -} - -var _default = function _default() { - return { - /** - * Adjusts the brightness of the image - * @param {number} val the amount to adjust the brightness, a number between -1 and +1 - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - brightness: function brightness(val, cb) { - if (typeof val !== 'number') { - return _utils.throwError.call(this, 'val must be numbers', cb); - } - - if (val < -1 || val > +1) { - return _utils.throwError.call(this, 'val must be a number between -1 and +1', cb); - } - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - if (val < 0.0) { - this.bitmap.data[idx] = this.bitmap.data[idx] * (1 + val); - this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] * (1 + val); - this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] * (1 + val); - } else { - this.bitmap.data[idx] = this.bitmap.data[idx] + (255 - this.bitmap.data[idx]) * val; - this.bitmap.data[idx + 1] = this.bitmap.data[idx + 1] + (255 - this.bitmap.data[idx + 1]) * val; - this.bitmap.data[idx + 2] = this.bitmap.data[idx + 2] + (255 - this.bitmap.data[idx + 2]) * val; - } - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Adjusts the contrast of the image - * @param {number} val the amount to adjust the contrast, a number between -1 and +1 - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - contrast: function contrast(val, cb) { - if (typeof val !== 'number') { - return _utils.throwError.call(this, 'val must be numbers', cb); - } - - if (val < -1 || val > +1) { - return _utils.throwError.call(this, 'val must be a number between -1 and +1', cb); - } - - var factor = (val + 1) / (1 - val); - - function adjust(value) { - value = Math.floor(factor * (value - 127) + 127); - return value < 0 ? 0 : value > 255 ? 255 : value; - } - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data[idx] = adjust(this.bitmap.data[idx]); - this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]); - this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Apply a posterize effect - * @param {number} n the amount to adjust the contrast, minimum threshold is two - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - posterize: function posterize(n, cb) { - if (typeof n !== 'number') { - return _utils.throwError.call(this, 'n must be numbers', cb); - } - - if (n < 2) { - n = 2; - } // minimum of 2 levels - - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data[idx] = Math.floor(this.bitmap.data[idx] / 255 * (n - 1)) / (n - 1) * 255; - this.bitmap.data[idx + 1] = Math.floor(this.bitmap.data[idx + 1] / 255 * (n - 1)) / (n - 1) * 255; - this.bitmap.data[idx + 2] = Math.floor(this.bitmap.data[idx + 2] / 255 * (n - 1)) / (n - 1) * 255; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Removes colour from the image using ITU Rec 709 luminance values - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - greyscale: greyscale, - // Alias of greyscale for our American friends - grayscale: greyscale, - - /** - * Multiplies the opacity of each pixel by a factor between 0 and 1 - * @param {number} f A number, the factor by which to multiply the opacity of each pixel - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - opacity: function opacity(f, cb) { - if (typeof f !== 'number') return _utils.throwError.call(this, 'f must be a number', cb); - if (f < 0 || f > 1) return _utils.throwError.call(this, 'f must be a number from 0 to 1', cb); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var v = this.bitmap.data[idx + 3] * f; - this.bitmap.data[idx + 3] = v; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Applies a sepia tone to the image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - sepia: function sepia(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var red = this.bitmap.data[idx]; - var green = this.bitmap.data[idx + 1]; - var blue = this.bitmap.data[idx + 2]; - red = red * 0.393 + green * 0.769 + blue * 0.189; - green = red * 0.349 + green * 0.686 + blue * 0.168; - blue = red * 0.272 + green * 0.534 + blue * 0.131; - this.bitmap.data[idx] = red < 255 ? red : 255; - this.bitmap.data[idx + 1] = green < 255 ? green : 255; - this.bitmap.data[idx + 2] = blue < 255 ? blue : 255; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Fades each pixel by a factor between 0 and 1 - * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - fade: function fade(f, cb) { - if (typeof f !== 'number') { - return _utils.throwError.call(this, 'f must be a number', cb); - } - - if (f < 0 || f > 1) { - return _utils.throwError.call(this, 'f must be a number from 0 to 1', cb); - } // this method is an alternative to opacity (which may be deprecated) - - - this.opacity(1 - f); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Adds each element of the image to its local neighbors, weighted by the kernel - * @param {array} kernel a matrix to weight the neighbors sum - * @param {string} edgeHandling (optional) define how to sum pixels from outside the border - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - convolution: function convolution(kernel, edgeHandling, cb) { - if (typeof edgeHandling === 'function' && typeof cb === 'undefined') { - cb = edgeHandling; - edgeHandling = null; - } - - if (!edgeHandling) { - edgeHandling = this.constructor.EDGE_EXTEND; - } - - var newData = Buffer.from(this.bitmap.data); - var kRows = kernel.length; - var kCols = kernel[0].length; - var rowEnd = Math.floor(kRows / 2); - var colEnd = Math.floor(kCols / 2); - var rowIni = -rowEnd; - var colIni = -colEnd; - var weight; - var rSum; - var gSum; - var bSum; - var ri; - var gi; - var bi; - var xi; - var yi; - var idxi; - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - bSum = 0; - gSum = 0; - rSum = 0; - - for (var row = rowIni; row <= rowEnd; row++) { - for (var col = colIni; col <= colEnd; col++) { - xi = x + col; - yi = y + row; - weight = kernel[row + rowEnd][col + colEnd]; - idxi = this.getPixelIndex(xi, yi, edgeHandling); - - if (idxi === -1) { - bi = 0; - gi = 0; - ri = 0; - } else { - ri = this.bitmap.data[idxi + 0]; - gi = this.bitmap.data[idxi + 1]; - bi = this.bitmap.data[idxi + 2]; - } - - rSum += weight * ri; - gSum += weight * gi; - bSum += weight * bi; - } - } - - if (rSum < 0) { - rSum = 0; - } - - if (gSum < 0) { - gSum = 0; - } - - if (bSum < 0) { - bSum = 0; - } - - if (rSum > 255) { - rSum = 255; - } - - if (gSum > 255) { - gSum = 255; - } - - if (bSum > 255) { - bSum = 255; - } - - newData[idx + 0] = rSum; - newData[idx + 1] = gSum; - newData[idx + 2] = bSum; - }); - this.bitmap.data = newData; - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Set the alpha channel on every pixel to fully opaque - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - opaque: function opaque(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data[idx + 3] = 255; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Pixelates the image or a region - * @param {number} size the size of the pixels - * @param {number} x (optional) the x position of the region to pixelate - * @param {number} y (optional) the y position of the region to pixelate - * @param {number} w (optional) the width of the region to pixelate - * @param {number} h (optional) the height of the region to pixelate - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - pixelate: function pixelate(size, x, y, w, h, cb) { - if (typeof x === 'function') { - cb = x; - h = null; - w = null; - y = null; - x = null; - } else { - if (typeof size !== 'number') { - return _utils.throwError.call(this, 'size must be a number', cb); - } - - if (isDef(x) && typeof x !== 'number') { - return _utils.throwError.call(this, 'x must be a number', cb); - } - - if (isDef(y) && typeof y !== 'number') { - return _utils.throwError.call(this, 'y must be a number', cb); - } - - if (isDef(w) && typeof w !== 'number') { - return _utils.throwError.call(this, 'w must be a number', cb); - } - - if (isDef(h) && typeof h !== 'number') { - return _utils.throwError.call(this, 'h must be a number', cb); - } - } - - var kernel = [[1 / 16, 2 / 16, 1 / 16], [2 / 16, 4 / 16, 2 / 16], [1 / 16, 2 / 16, 1 / 16]]; - x = x || 0; - y = y || 0; - w = isDef(w) ? w : this.bitmap.width - x; - h = isDef(h) ? h : this.bitmap.height - y; - var source = this.cloneQuiet(); - this.scanQuiet(x, y, w, h, function (xx, yx, idx) { - xx = size * Math.floor(xx / size); - yx = size * Math.floor(yx / size); - var value = applyKernel(source, kernel, xx, yx); - this.bitmap.data[idx] = value[0]; - this.bitmap.data[idx + 1] = value[1]; - this.bitmap.data[idx + 2] = value[2]; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Applies a convolution kernel to the image or a region - * @param {array} kernel the convolution kernel - * @param {number} x (optional) the x position of the region to apply convolution to - * @param {number} y (optional) the y position of the region to apply convolution to - * @param {number} w (optional) the width of the region to apply convolution to - * @param {number} h (optional) the height of the region to apply convolution to - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - convolute: function convolute(kernel, x, y, w, h, cb) { - if (!Array.isArray(kernel)) return _utils.throwError.call(this, 'the kernel must be an array', cb); - - if (typeof x === 'function') { - cb = x; - x = null; - y = null; - w = null; - h = null; - } else { - if (isDef(x) && typeof x !== 'number') { - return _utils.throwError.call(this, 'x must be a number', cb); - } - - if (isDef(y) && typeof y !== 'number') { - return _utils.throwError.call(this, 'y must be a number', cb); - } - - if (isDef(w) && typeof w !== 'number') { - return _utils.throwError.call(this, 'w must be a number', cb); - } - - if (isDef(h) && typeof h !== 'number') { - return _utils.throwError.call(this, 'h must be a number', cb); - } - } - - var ksize = (kernel.length - 1) / 2; - x = isDef(x) ? x : ksize; - y = isDef(y) ? y : ksize; - w = isDef(w) ? w : this.bitmap.width - x; - h = isDef(h) ? h : this.bitmap.height - y; - var source = this.cloneQuiet(); - this.scanQuiet(x, y, w, h, function (xx, yx, idx) { - var value = applyKernel(source, kernel, xx, yx); - this.bitmap.data[idx] = this.constructor.limit255(value[0]); - this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]); - this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Apply multiple color modification rules - * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] } - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp }this for chaining of methods - */ - color: colorFn, - colour: colorFn - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -}).call(this,require("buffer").Buffer) -},{"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/toConsumableArray":20,"@jimp/utils":235,"buffer":48,"tinycolor2":178}],206:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed. - * @param {number} w the width to resize the image to - * @param {number} h the height to resize the image to - * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - contain: function contain(w, h, alignBits, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } // permit any sort of optional parameters combination - - - if (typeof alignBits === 'string') { - if (typeof mode === 'function' && typeof cb === 'undefined') cb = mode; - mode = alignBits; - alignBits = null; - } - - if (typeof alignBits === 'function') { - if (typeof cb === 'undefined') cb = alignBits; - mode = null; - alignBits = null; - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE; - var hbits = alignBits & (1 << 3) - 1; - var vbits = alignBits >> 3; // check if more flags than one is in the bit sets - - if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) { - return _utils.throwError.call(this, 'only use one flag per alignment direction', cb); - } - - var alignH = hbits >> 1; // 0, 1, 2 - - var alignV = vbits >> 1; // 0, 1, 2 - - var f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width; - var c = this.cloneQuiet().scale(f, mode); - this.resize(w, h, mode); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data.writeUInt32BE(this._background, idx); - }); - this.blit(c, (this.bitmap.width - c.bitmap.width) / 2 * alignH, (this.bitmap.height - c.bitmap.height) / 2 * alignV); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],207:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped. - * @param {number} w the width to resize the image to - * @param {number} h the height to resize the image to - * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - cover: function cover(w, h, alignBits, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } - - if (alignBits && typeof alignBits === 'function' && typeof cb === 'undefined') { - cb = alignBits; - alignBits = null; - mode = null; - } else if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE; - var hbits = alignBits & (1 << 3) - 1; - var vbits = alignBits >> 3; // check if more flags than one is in the bit sets - - if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) return _utils.throwError.call(this, 'only use one flag per alignment direction', cb); - var alignH = hbits >> 1; // 0, 1, 2 - - var alignV = vbits >> 1; // 0, 1, 2 - - var f = w / h > this.bitmap.width / this.bitmap.height ? w / this.bitmap.width : h / this.bitmap.height; - this.scale(f, mode); - this.crop((this.bitmap.width - w) / 2 * alignH, (this.bitmap.height - h) / 2 * alignV, w, h); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],208:[function(require,module,exports){ -(function (Buffer){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = pluginCrop; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _utils = require("@jimp/utils"); - -/* eslint-disable no-labels */ -function pluginCrop(event) { - /** - * Crops the image at a given point to a give size - * @param {number} x the x coordinate to crop form - * @param {number} y the y coordinate to crop form - * @param w the width of the crop region - * @param h the height of the crop region - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - event('crop', function (x, y, w, h, cb) { - if (typeof x !== 'number' || typeof y !== 'number') return _utils.throwError.call(this, 'x and y must be numbers', cb); - if (typeof w !== 'number' || typeof h !== 'number') return _utils.throwError.call(this, 'w and h must be numbers', cb); // round input - - x = Math.round(x); - y = Math.round(y); - w = Math.round(w); - h = Math.round(h); - - if (x === 0 && w === this.bitmap.width) { - // shortcut - var start = w * y + x << 2; - var end = start + h * w << 2; - this.bitmap.data = this.bitmap.data.slice(start, end); - } else { - var bitmap = Buffer.allocUnsafe(w * h * 4); - var offset = 0; - this.scanQuiet(x, y, w, h, function (x, y, idx) { - var data = this.bitmap.data.readUInt32BE(idx, true); - bitmap.writeUInt32BE(data, offset, true); - offset += 4; - }); - this.bitmap.data = bitmap; - } - - this.bitmap.width = w; - this.bitmap.height = h; - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }); - return { - "class": { - /** - * Autocrop same color borders from this image - * @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%) - * @param {boolean} cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true) - * @param {function(Error, Jimp)} cb (optional): a callback for when complete (default: no callback) - * @returns {Jimp} this for chaining of methods - */ - autocrop: function autocrop() { - var w = this.bitmap.width; - var h = this.bitmap.height; - var minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image - - var cb; // callback - - var leaveBorder = 0; // Amount of pixels in border to leave - - var tolerance = 0.0002; // percent of color difference tolerance (default value) - - var cropOnlyFrames = true; // flag to force cropping only if the image has a real "frame" - // i.e. all 4 sides have some border (default value) - - var cropSymmetric = false; // flag to force cropping top be symmetric. - // i.e. north and south / east and west are cropped by the same value - - var ignoreSides = { - north: false, - south: false, - east: false, - west: false - }; // parse arguments - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - for (var a = 0, len = args.length; a < len; a++) { - if (typeof args[a] === 'number') { - // tolerance value passed - tolerance = args[a]; - } - - if (typeof args[a] === 'boolean') { - // cropOnlyFrames value passed - cropOnlyFrames = args[a]; - } - - if (typeof args[a] === 'function') { - // callback value passed - cb = args[a]; - } - - if ((0, _typeof2["default"])(args[a]) === 'object') { - // config object passed - var config = args[a]; - - if (typeof config.tolerance !== 'undefined') { - tolerance = config.tolerance; - } - - if (typeof config.cropOnlyFrames !== 'undefined') { - cropOnlyFrames = config.cropOnlyFrames; - } - - if (typeof config.cropSymmetric !== 'undefined') { - cropSymmetric = config.cropSymmetric; - } - - if (typeof config.leaveBorder !== 'undefined') { - leaveBorder = config.leaveBorder; - } - - if (typeof config.ignoreSides !== 'undefined') { - ignoreSides = config.ignoreSides; - } - } - } - /** - * All borders must be of the same color as the top left pixel, to be cropped. - * It should be possible to crop borders each with a different color, - * but since there are many ways for corners to intersect, it would - * introduce unnecessary complexity to the algorithm. - */ - // scan each side for same color borders - - - var colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color - - var rgba1 = this.constructor.intToRGBA(colorTarget); // for north and east sides - - var northPixelsToCrop = 0; - var eastPixelsToCrop = 0; - var southPixelsToCrop = 0; - var westPixelsToCrop = 0; // north side (scan rows from north to south) - - colorTarget = this.getPixelColor(0, 0); - - if (!ignoreSides.north) { - north: for (var y = 0; y < h - minPixelsPerSide; y++) { - for (var x = 0; x < w; x++) { - var colorXY = this.getPixelColor(x, y); - var rgba2 = this.constructor.intToRGBA(colorXY); - - if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) { - // this pixel is too distant from the first one: abort this side scan - break north; - } - } // this row contains all pixels with the same color: increment this side pixels to crop - - - northPixelsToCrop++; - } - } // east side (scan columns from east to west) - - - colorTarget = this.getPixelColor(w, 0); - - if (!ignoreSides.east) { - east: for (var _x = 0; _x < w - minPixelsPerSide; _x++) { - for (var _y = 0 + northPixelsToCrop; _y < h; _y++) { - var _colorXY = this.getPixelColor(_x, _y); - - var _rgba = this.constructor.intToRGBA(_colorXY); - - if (this.constructor.colorDiff(rgba1, _rgba) > tolerance) { - // this pixel is too distant from the first one: abort this side scan - break east; - } - } // this column contains all pixels with the same color: increment this side pixels to crop - - - eastPixelsToCrop++; - } - } // south side (scan rows from south to north) - - - colorTarget = this.getPixelColor(0, h); - - if (!ignoreSides.south) { - south: for (var _y2 = h - 1; _y2 >= northPixelsToCrop + minPixelsPerSide; _y2--) { - for (var _x2 = w - eastPixelsToCrop - 1; _x2 >= 0; _x2--) { - var _colorXY2 = this.getPixelColor(_x2, _y2); - - var _rgba2 = this.constructor.intToRGBA(_colorXY2); - - if (this.constructor.colorDiff(rgba1, _rgba2) > tolerance) { - // this pixel is too distant from the first one: abort this side scan - break south; - } - } // this row contains all pixels with the same color: increment this side pixels to crop - - - southPixelsToCrop++; - } - } // west side (scan columns from west to east) - - - colorTarget = this.getPixelColor(w, h); - - if (!ignoreSides.west) { - west: for (var _x3 = w - 1; _x3 >= 0 + eastPixelsToCrop + minPixelsPerSide; _x3--) { - for (var _y3 = h - 1; _y3 >= 0 + northPixelsToCrop; _y3--) { - var _colorXY3 = this.getPixelColor(_x3, _y3); - - var _rgba3 = this.constructor.intToRGBA(_colorXY3); - - if (this.constructor.colorDiff(rgba1, _rgba3) > tolerance) { - // this pixel is too distant from the first one: abort this side scan - break west; - } - } // this column contains all pixels with the same color: increment this side pixels to crop - - - westPixelsToCrop++; - } - } // decide if a crop is needed - - - var doCrop = false; // apply leaveBorder - - westPixelsToCrop -= leaveBorder; - eastPixelsToCrop -= leaveBorder; - northPixelsToCrop -= leaveBorder; - southPixelsToCrop -= leaveBorder; - - if (cropSymmetric) { - var horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop); - var vertical = Math.min(northPixelsToCrop, southPixelsToCrop); - westPixelsToCrop = horizontal; - eastPixelsToCrop = horizontal; - northPixelsToCrop = vertical; - southPixelsToCrop = vertical; - } // make sure that crops are >= 0 - - - westPixelsToCrop = westPixelsToCrop >= 0 ? westPixelsToCrop : 0; - eastPixelsToCrop = eastPixelsToCrop >= 0 ? eastPixelsToCrop : 0; - northPixelsToCrop = northPixelsToCrop >= 0 ? northPixelsToCrop : 0; - southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0; // safety checks - - var widthOfRemainingPixels = w - (westPixelsToCrop + eastPixelsToCrop); - var heightOfRemainingPixels = h - (southPixelsToCrop + northPixelsToCrop); - - if (cropOnlyFrames) { - // crop image if all sides should be cropped - doCrop = eastPixelsToCrop !== 0 && northPixelsToCrop !== 0 && westPixelsToCrop !== 0 && southPixelsToCrop !== 0; - } else { - // crop image if at least one side should be cropped - doCrop = eastPixelsToCrop !== 0 || northPixelsToCrop !== 0 || westPixelsToCrop !== 0 || southPixelsToCrop !== 0; - } - - if (doCrop) { - // do the real crop - this.crop(eastPixelsToCrop, northPixelsToCrop, widthOfRemainingPixels, heightOfRemainingPixels); - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - } - }; -} - -module.exports = exports.default; - -}).call(this,require("buffer").Buffer) -},{"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/typeof":21,"@jimp/utils":235,"buffer":48}],209:[function(require,module,exports){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _utils = require("@jimp/utils"); - -/** - * Displaces the image based on the provided displacement map - * @param {object} map the source Jimp instance - * @param {number} offset the maximum displacement value - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - displace: function displace(map, offset, cb) { - if ((0, _typeof2["default"])(map) !== 'object' || map.constructor !== this.constructor) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof offset !== 'number') { - return _utils.throwError.call(this, 'factor must be a number', cb); - } - - var source = this.cloneQuiet(); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var displacement = map.bitmap.data[idx] / 256 * offset; - displacement = Math.round(displacement); - var ids = this.getPixelIndex(x + displacement, y); - this.bitmap.data[ids] = source.bitmap.data[idx]; - this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1]; - this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2]; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/typeof":21,"@jimp/utils":235}],210:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Apply a ordered dithering effect - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -function dither(cb) { - var rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6]; - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var thresholdId = ((y & 3) << 2) + x % 4; - var dither = rgb565Matrix[thresholdId]; - this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff); - this.bitmap.data[idx + 1] = Math.min(this.bitmap.data[idx + 1] + dither, 0xff); - this.bitmap.data[idx + 2] = Math.min(this.bitmap.data[idx + 2] + dither, 0xff); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; -} - -var _default = function _default() { - return { - dither565: dither, - dither16: dither - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],211:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Creates a circle out of an image. - * @param {object} options (optional) r: radius of effect - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - fisheye: function fisheye() { - var _this = this; - - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { - r: 2.5 - }; - var cb = arguments.length > 1 ? arguments[1] : undefined; - - if (typeof options === 'function') { - cb = options; - options = { - r: 2.5 - }; - } - - var source = this.cloneQuiet(); - var _source$bitmap = source.bitmap, - width = _source$bitmap.width, - height = _source$bitmap.height; - source.scanQuiet(0, 0, width, height, function (x, y) { - var hx = x / width; - var hy = y / height; - var r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2)); - var rn = 2 * Math.pow(r, options.r); - var cosA = (hx - 0.5) / r; - var sinA = (hy - 0.5) / r; - var newX = Math.round((rn * cosA + 0.5) * width); - var newY = Math.round((rn * sinA + 0.5) * height); - var color = source.getPixelColor(newX, newY); - - _this.setPixelColor(color, x, y); - }); - /* Set center pixel color, otherwise it will be transparent */ - - this.setPixelColor(source.getPixelColor(width / 2, height / 2), width / 2, height / 2); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],212:[function(require,module,exports){ -(function (Buffer){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Flip the image horizontally - * @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally - * @param {boolean} vertical a Boolean, if true the image will be flipped vertically - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -function flipFn(horizontal, vertical, cb) { - if (typeof horizontal !== 'boolean' || typeof vertical !== 'boolean') return _utils.throwError.call(this, 'horizontal and vertical must be Booleans', cb); - var bitmap = Buffer.alloc(this.bitmap.data.length); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var _x = horizontal ? this.bitmap.width - 1 - x : x; - - var _y = vertical ? this.bitmap.height - 1 - y : y; - - var _idx = this.bitmap.width * _y + _x << 2; - - var data = this.bitmap.data.readUInt32BE(idx); - bitmap.writeUInt32BE(data, _idx); - }); - this.bitmap.data = Buffer.from(bitmap); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; -} - -var _default = function _default() { - return { - flip: flipFn, - mirror: flipFn - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -}).call(this,require("buffer").Buffer) -},{"@jimp/utils":235,"buffer":48}],213:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Applies a true Gaussian blur to the image (warning: this is VERY slow) - * @param {number} r the pixel radius of the blur - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - gaussian: function gaussian(r, cb) { - // http://blog.ivank.net/fastest-gaussian-blur.html - if (typeof r !== 'number') { - return _utils.throwError.call(this, 'r must be a number', cb); - } - - if (r < 1) { - return _utils.throwError.call(this, 'r must be greater than 0', cb); - } - - var rs = Math.ceil(r * 2.57); // significant radius - - var range = rs * 2 + 1; - var rr2 = r * r * 2; - var rr2pi = rr2 * Math.PI; - var weights = []; - - for (var y = 0; y < range; y++) { - weights[y] = []; - - for (var x = 0; x < range; x++) { - var dsq = Math.pow(x - rs, 2) + Math.pow(y - rs, 2); - weights[y][x] = Math.exp(-dsq / rr2) / rr2pi; - } - } - - for (var _y = 0; _y < this.bitmap.height; _y++) { - for (var _x = 0; _x < this.bitmap.width; _x++) { - var red = 0; - var green = 0; - var blue = 0; - var alpha = 0; - var wsum = 0; - - for (var iy = 0; iy < range; iy++) { - for (var ix = 0; ix < range; ix++) { - var x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + _x - rs)); - var y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + _y - rs)); - var weight = weights[iy][ix]; - - var _idx = y1 * this.bitmap.width + x1 << 2; - - red += this.bitmap.data[_idx] * weight; - green += this.bitmap.data[_idx + 1] * weight; - blue += this.bitmap.data[_idx + 2] * weight; - alpha += this.bitmap.data[_idx + 3] * weight; - wsum += weight; - } - - var idx = _y * this.bitmap.width + _x << 2; - this.bitmap.data[idx] = Math.round(red / wsum); - this.bitmap.data[idx + 1] = Math.round(green / wsum); - this.bitmap.data[idx + 2] = Math.round(blue / wsum); - this.bitmap.data[idx + 3] = Math.round(alpha / wsum); - } - } - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],214:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Inverts the image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - invert: function invert(cb) { - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data[idx] = 255 - this.bitmap.data[idx]; - this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1]; - this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2]; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],215:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent. - * @param {Jimp} src the source Jimp instance - * @param {number} x the horizontal position to blit the image - * @param {number} y the vertical position to blit the image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - mask: function mask(src) { - var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; - var y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; - var cb = arguments.length > 3 ? arguments[3] : undefined; - - if (!(src instanceof this.constructor)) { - return _utils.throwError.call(this, 'The source must be a Jimp image', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number') { - return _utils.throwError.call(this, 'x and y must be numbers', cb); - } // round input - - - x = Math.round(x); - y = Math.round(y); - var w = this.bitmap.width; - var h = this.bitmap.height; - var baseImage = this; - src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) { - var destX = x + sx; - var destY = y + sy; - - if (destX >= 0 && destY >= 0 && destX < w && destY < h) { - var dstIdx = baseImage.getPixelIndex(destX, destY); - var data = this.bitmap.data; - var avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3; - baseImage.bitmap.data[dstIdx + 3] *= avg / 255; - } - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],216:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Get an image's histogram - * @return {object} An object with an array of color occurrence counts for each channel (r,g,b) - */ -function histogram() { - var histogram = { - r: new Array(256).fill(0), - g: new Array(256).fill(0), - b: new Array(256).fill(0) - }; - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, index) { - histogram.r[this.bitmap.data[index + 0]]++; - histogram.g[this.bitmap.data[index + 1]]++; - histogram.b[this.bitmap.data[index + 2]]++; - }); - return histogram; -} -/** - * Normalize values - * @param {integer} value Pixel channel value. - * @param {integer} min Minimum value for channel - * @param {integer} max Maximum value for channel - * @return {integer} normalized values - */ - - -var _normalize = function normalize(value, min, max) { - return (value - min) * 255 / (max - min); -}; - -var getBounds = function getBounds(histogramChannel) { - return [histogramChannel.findIndex(function (value) { - return value > 0; - }), 255 - histogramChannel.slice().reverse().findIndex(function (value) { - return value > 0; - })]; -}; -/** - * Normalizes the image - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - - -var _default = function _default() { - return { - normalize: function normalize(cb) { - var h = histogram.call(this); // store bounds (minimum and maximum values) - - var bounds = { - r: getBounds(h.r), - g: getBounds(h.g), - b: getBounds(h.b) - }; // apply value transformations - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var r = this.bitmap.data[idx + 0]; - var g = this.bitmap.data[idx + 1]; - var b = this.bitmap.data[idx + 2]; - this.bitmap.data[idx + 0] = _normalize(r, bounds.r[0], bounds.r[1]); - this.bitmap.data[idx + 1] = _normalize(g, bounds.g[0], bounds.g[1]); - this.bitmap.data[idx + 2] = _normalize(b, bounds.b[0], bounds.b[1]); - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],217:[function(require,module,exports){ -(function (__dirname){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - -var _path = _interopRequireDefault(require("path")); - -var _loadBmfont = _interopRequireDefault(require("load-bmfont")); - -var _utils = require("@jimp/utils"); - -var _measureText = require("./measure-text"); - -function xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) { - if (alignment === constants.HORIZONTAL_ALIGN_LEFT) { - return 0; - } - - if (alignment === constants.HORIZONTAL_ALIGN_CENTER) { - return (maxWidth - (0, _measureText.measureText)(font, line)) / 2; - } - - return maxWidth - (0, _measureText.measureText)(font, line); -} - -function drawCharacter(image, font, x, y, _char) { - if (_char.width > 0 && _char.height > 0) { - var characterPage = font.pages[_char.page]; - image.blit(characterPage, x + _char.xoffset, y + _char.yoffset, _char.x, _char.y, _char.width, _char.height); - } - - return image; -} - -function printText(font, x, y, text, defaultCharWidth) { - for (var i = 0; i < text.length; i++) { - var _char2 = void 0; - - if (font.chars[text[i]]) { - _char2 = text[i]; - } else if (/\s/.test(text[i])) { - _char2 = ''; - } else { - _char2 = '?'; - } - - var fontChar = font.chars[_char2] || {}; - var fontKerning = font.kernings[_char2]; - drawCharacter(this, font, x, y, fontChar || {}); - var kerning = fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0; - x += kerning + (fontChar.xadvance || defaultCharWidth); - } -} - -function splitLines(font, text, maxWidth) { - var words = text.split(' '); - var lines = []; - var currentLine = []; - var longestLine = 0; - words.forEach(function (word) { - var line = [].concat((0, _toConsumableArray2["default"])(currentLine), [word]).join(' '); - var length = (0, _measureText.measureText)(font, line); - - if (length <= maxWidth) { - if (length > longestLine) { - longestLine = length; - } - - currentLine.push(word); - } else { - lines.push(currentLine); - currentLine = [word]; - } - }); - lines.push(currentLine); - return { - lines: lines, - longestLine: longestLine - }; -} - -function loadPages(Jimp, dir, pages) { - var newPages = pages.map(function (page) { - return Jimp.read(dir + '/' + page); - }); - return Promise.all(newPages); -} - -var dir = "browser/lib/" || "".concat(__dirname, "/../"); - -var _default = function _default() { - return { - constants: { - measureText: _measureText.measureText, - measureTextHeight: _measureText.measureTextHeight, - FONT_SANS_8_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt'), - FONT_SANS_10_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt'), - FONT_SANS_12_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt'), - FONT_SANS_14_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt'), - FONT_SANS_16_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt'), - FONT_SANS_32_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt'), - FONT_SANS_64_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt'), - FONT_SANS_128_BLACK: _path["default"].join(dir, 'fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt'), - FONT_SANS_8_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt'), - FONT_SANS_16_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt'), - FONT_SANS_32_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt'), - FONT_SANS_64_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt'), - FONT_SANS_128_WHITE: _path["default"].join(dir, 'fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt'), - - /** - * Loads a bitmap font from a file - * @param {string} file the file path of a .fnt file - * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded - * @returns {Promise} a promise - */ - loadFont: function loadFont(file, cb) { - var _this = this; - - if (typeof file !== 'string') return _utils.throwError.call(this, 'file must be a string', cb); - return new Promise(function (resolve, reject) { - cb = cb || function (err, font) { - if (err) reject(err);else resolve(font); - }; - - (0, _loadBmfont["default"])(file, function (err, font) { - var chars = {}; - var kernings = {}; - - if (err) { - return _utils.throwError.call(_this, err, cb); - } - - for (var i = 0; i < font.chars.length; i++) { - chars[String.fromCharCode(font.chars[i].id)] = font.chars[i]; - } - - for (var _i = 0; _i < font.kernings.length; _i++) { - var firstString = String.fromCharCode(font.kernings[_i].first); - kernings[firstString] = kernings[firstString] || {}; - kernings[firstString][String.fromCharCode(font.kernings[_i].second)] = font.kernings[_i].amount; - } - - loadPages(_this, _path["default"].dirname(file), font.pages).then(function (pages) { - cb(null, { - chars: chars, - kernings: kernings, - pages: pages, - common: font.common, - info: font.info - }); - }); - }); - }); - } - }, - "class": { - /** - * Draws a text on a image on a given boundary - * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command - * @param {number} x the x position to start drawing the text - * @param {number} y the y position to start drawing the text - * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`) - * @param {number} maxWidth (optional) the boundary width to draw in - * @param {number} maxHeight (optional) the boundary height to draw in - * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written - * @returns {Jimp} this for chaining of methods - */ - print: function print(font, x, y, text, maxWidth, maxHeight, cb) { - var _this2 = this; - - if (typeof maxWidth === 'function' && typeof cb === 'undefined') { - cb = maxWidth; - maxWidth = Infinity; - } - - if (typeof maxWidth === 'undefined') { - maxWidth = Infinity; - } - - if (typeof maxHeight === 'function' && typeof cb === 'undefined') { - cb = maxHeight; - maxHeight = Infinity; - } - - if (typeof maxHeight === 'undefined') { - maxHeight = Infinity; - } - - if ((0, _typeof2["default"])(font) !== 'object') { - return _utils.throwError.call(this, 'font must be a Jimp loadFont', cb); - } - - if (typeof x !== 'number' || typeof y !== 'number' || typeof maxWidth !== 'number') { - return _utils.throwError.call(this, 'x, y and maxWidth must be numbers', cb); - } - - if (typeof maxWidth !== 'number') { - return _utils.throwError.call(this, 'maxWidth must be a number', cb); - } - - if (typeof maxHeight !== 'number') { - return _utils.throwError.call(this, 'maxHeight must be a number', cb); - } - - var alignmentX; - var alignmentY; - - if ((0, _typeof2["default"])(text) === 'object' && text.text !== null && text.text !== undefined) { - alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT; - alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP; - var _text = text; - text = _text.text; - } else { - alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT; - alignmentY = this.constructor.VERTICAL_ALIGN_TOP; - text = text.toString(); - } - - if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM) { - y += maxHeight - (0, _measureText.measureTextHeight)(font, text, maxWidth); - } else if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE) { - y += maxHeight / 2 - (0, _measureText.measureTextHeight)(font, text, maxWidth) / 2; - } - - var defaultCharWidth = Object.entries(font.chars)[0][1].xadvance; - - var _splitLines = splitLines(font, text, maxWidth), - lines = _splitLines.lines, - longestLine = _splitLines.longestLine; - - lines.forEach(function (line) { - var lineString = line.join(' '); - var alignmentWidth = xOffsetBasedOnAlignment(_this2.constructor, font, lineString, maxWidth, alignmentX); - printText.call(_this2, font, x + alignmentWidth, y, lineString, defaultCharWidth); - y += font.common.lineHeight; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this, { - x: x + longestLine, - y: y - }); - } - - return this; - } - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -}).call(this,"/../../node_modules/@jimp/plugin-print/dist") -},{"./measure-text":218,"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/toConsumableArray":20,"@babel/runtime/helpers/typeof":21,"@jimp/utils":235,"load-bmfont":219,"path":107}],218:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.measureText = measureText; -exports.measureTextHeight = measureTextHeight; - -function measureText(font, text) { - var x = 0; - - for (var i = 0; i < text.length; i++) { - if (font.chars[text[i]]) { - var kerning = font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]] ? font.kernings[text[i]][text[i + 1]] : 0; - x += (font.chars[text[i]].xadvance || 0) + kerning; - } - } - - return x; -} - -function measureTextHeight(font, text, maxWidth) { - var words = text.split(' '); - var line = ''; - var textTotalHeight = font.common.lineHeight; - - for (var n = 0; n < words.length; n++) { - var testLine = line + words[n] + ' '; - var testWidth = measureText(font, testLine); - - if (testWidth > maxWidth && n > 0) { - textTotalHeight += font.common.lineHeight; - line = words[n] + ' '; - } else { - line = testLine; - } - } - - return textTotalHeight; -} - -},{}],219:[function(require,module,exports){ -(function (Buffer){ -var xhr = require('xhr') -var noop = function(){} -var parseASCII = require('parse-bmfont-ascii') -var parseXML = require('parse-bmfont-xml') -var readBinary = require('parse-bmfont-binary') -var isBinaryFormat = require('./lib/is-binary') -var xtend = require('xtend') - -var xml2 = (function hasXML2() { - return self.XMLHttpRequest && "withCredentials" in new XMLHttpRequest -})() - -module.exports = function(opt, cb) { - cb = typeof cb === 'function' ? cb : noop - - if (typeof opt === 'string') - opt = { uri: opt } - else if (!opt) - opt = {} - - var expectBinary = opt.binary - if (expectBinary) - opt = getBinaryOpts(opt) - - xhr(opt, function(err, res, body) { - if (err) - return cb(err) - if (!/^2/.test(res.statusCode)) - return cb(new Error('http status code: '+res.statusCode)) - if (!body) - return cb(new Error('no body result')) - - var binary = false - - //if the response type is an array buffer, - //we need to convert it into a regular Buffer object - if (isArrayBuffer(body)) { - var array = new Uint8Array(body) - body = new Buffer(array, 'binary') - } - - //now check the string/Buffer response - //and see if it has a binary BMF header - if (isBinaryFormat(body)) { - binary = true - //if we have a string, turn it into a Buffer - if (typeof body === 'string') - body = new Buffer(body, 'binary') - } - - //we are not parsing a binary format, just ASCII/XML/etc - if (!binary) { - //might still be a buffer if responseType is 'arraybuffer' - if (Buffer.isBuffer(body)) - body = body.toString(opt.encoding) - body = body.trim() - } - - var result - try { - var type = res.headers['content-type'] - if (binary) - result = readBinary(body) - else if (/json/.test(type) || body.charAt(0) === '{') - result = JSON.parse(body) - else if (/xml/.test(type) || body.charAt(0) === '<') - result = parseXML(body) - else - result = parseASCII(body) - } catch (e) { - cb(new Error('error parsing font '+e.message)) - cb = noop - } - cb(null, result) - }) -} - -function isArrayBuffer(arr) { - var str = Object.prototype.toString - return str.call(arr) === '[object ArrayBuffer]' -} - -function getBinaryOpts(opt) { - //IE10+ and other modern browsers support array buffers - if (xml2) - return xtend(opt, { responseType: 'arraybuffer' }) - - if (typeof self.XMLHttpRequest === 'undefined') - throw new Error('your browser does not support XHR loading') - - //IE9 and XML1 browsers could still use an override - var req = new self.XMLHttpRequest() - req.overrideMimeType('text/plain; charset=x-user-defined') - return xtend({ - xhr: req - }, opt) -} - -}).call(this,require("buffer").Buffer) -},{"./lib/is-binary":220,"buffer":48,"parse-bmfont-ascii":102,"parse-bmfont-binary":103,"parse-bmfont-xml":104,"xhr":187,"xtend":189}],220:[function(require,module,exports){ -(function (Buffer){ -var equal = require('buffer-equal') -var HEADER = new Buffer([66, 77, 70, 3]) - -module.exports = function(buf) { - if (typeof buf === 'string') - return buf.substring(0, 3) === 'BMF' - return buf.length > 4 && equal(buf.slice(0, 4), HEADER) -} -}).call(this,require("buffer").Buffer) -},{"buffer":48,"buffer-equal":49}],221:[function(require,module,exports){ -(function (Buffer){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -var _resize = _interopRequireDefault(require("./modules/resize")); - -var _resize2 = _interopRequireDefault(require("./modules/resize2")); - -var _default = function _default() { - return { - constants: { - RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor', - RESIZE_BILINEAR: 'bilinearInterpolation', - RESIZE_BICUBIC: 'bicubicInterpolation', - RESIZE_HERMITE: 'hermiteInterpolation', - RESIZE_BEZIER: 'bezierInterpolation' - }, - "class": { - /** - * Resizes the image to a set width and height using a 2-pass bilinear algorithm - * @param {number} w the width to resize the image to (or Jimp.AUTO) - * @param {number} h the height to resize the image to (or Jimp.AUTO) - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - resize: function resize(w, h, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - if (w === this.constructor.AUTO && h === this.constructor.AUTO) { - return _utils.throwError.call(this, 'w and h cannot both be set to auto', cb); - } - - if (w === this.constructor.AUTO) { - w = this.bitmap.width * (h / this.bitmap.height); - } - - if (h === this.constructor.AUTO) { - h = this.bitmap.height * (w / this.bitmap.width); - } - - if (w < 0 || h < 0) { - return _utils.throwError.call(this, 'w and h must be positive numbers', cb); - } // round inputs - - - w = Math.round(w); - h = Math.round(h); - - if (typeof _resize2["default"][mode] === 'function') { - var dst = { - data: Buffer.alloc(w * h * 4), - width: w, - height: h - }; - - _resize2["default"][mode](this.bitmap, dst); - - this.bitmap = dst; - } else { - var image = this; - var resize = new _resize["default"](this.bitmap.width, this.bitmap.height, w, h, true, true, function (buffer) { - image.bitmap.data = Buffer.from(buffer); - image.bitmap.width = w; - image.bitmap.height = h; - }); - resize.resize(this.bitmap.data); - } - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -}).call(this,require("buffer").Buffer) -},{"./modules/resize":222,"./modules/resize2":223,"@babel/runtime/helpers/interopRequireDefault":11,"@jimp/utils":235,"buffer":48}],222:[function(require,module,exports){ -"use strict"; - -// JavaScript Image Resizer (c) 2012 - Grant Galitz -// Released to public domain 29 July 2013: https://github.com/grantgalitz/JS-Image-Resizer/issues/4 -function Resize(widthOriginal, heightOriginal, targetWidth, targetHeight, blendAlpha, interpolationPass, resizeCallback) { - this.widthOriginal = Math.abs(Math.floor(widthOriginal) || 0); - this.heightOriginal = Math.abs(Math.floor(heightOriginal) || 0); - this.targetWidth = Math.abs(Math.floor(targetWidth) || 0); - this.targetHeight = Math.abs(Math.floor(targetHeight) || 0); - this.colorChannels = blendAlpha ? 4 : 3; - this.interpolationPass = Boolean(interpolationPass); - this.resizeCallback = typeof resizeCallback === 'function' ? resizeCallback : function () {}; - this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels; - this.originalWidthMultipliedByChannels = this.widthOriginal * this.colorChannels; - this.originalHeightMultipliedByChannels = this.heightOriginal * this.colorChannels; - this.widthPassResultSize = this.targetWidthMultipliedByChannels * this.heightOriginal; - this.finalResultSize = this.targetWidthMultipliedByChannels * this.targetHeight; - this.initialize(); -} - -Resize.prototype.initialize = function () { - // Perform some checks: - if (this.widthOriginal > 0 && this.heightOriginal > 0 && this.targetWidth > 0 && this.targetHeight > 0) { - this.configurePasses(); - } else { - throw new Error('Invalid settings specified for the resizer.'); - } -}; - -Resize.prototype.configurePasses = function () { - if (this.widthOriginal === this.targetWidth) { - // Bypass the width resizer pass: - this.resizeWidth = this.bypassResizer; - } else { - // Setup the width resizer pass: - this.ratioWeightWidthPass = this.widthOriginal / this.targetWidth; - - if (this.ratioWeightWidthPass < 1 && this.interpolationPass) { - this.initializeFirstPassBuffers(true); - this.resizeWidth = this.colorChannels === 4 ? this.resizeWidthInterpolatedRGBA : this.resizeWidthInterpolatedRGB; - } else { - this.initializeFirstPassBuffers(false); - this.resizeWidth = this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB; - } - } - - if (this.heightOriginal === this.targetHeight) { - // Bypass the height resizer pass: - this.resizeHeight = this.bypassResizer; - } else { - // Setup the height resizer pass: - this.ratioWeightHeightPass = this.heightOriginal / this.targetHeight; - - if (this.ratioWeightHeightPass < 1 && this.interpolationPass) { - this.initializeSecondPassBuffers(true); - this.resizeHeight = this.resizeHeightInterpolated; - } else { - this.initializeSecondPassBuffers(false); - this.resizeHeight = this.colorChannels === 4 ? this.resizeHeightRGBA : this.resizeHeightRGB; - } - } -}; - -Resize.prototype._resizeWidthInterpolatedRGBChannels = function (buffer, fourthChannel) { - var channelsNum = fourthChannel ? 4 : 3; - var ratioWeight = this.ratioWeightWidthPass; - var outputBuffer = this.widthBuffer; - var weight = 0; - var finalOffset = 0; - var pixelOffset = 0; - var firstWeight = 0; - var secondWeight = 0; - var targetPosition; // Handle for only one interpolation input being valid for start calculation: - - for (targetPosition = 0; weight < 1 / 3; targetPosition += channelsNum, weight += ratioWeight) { - for (finalOffset = targetPosition, pixelOffset = 0; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) { - outputBuffer[finalOffset] = buffer[pixelOffset]; - outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1]; - outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2]; - if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3]; - } - } // Adjust for overshoot of the last pass's counter: - - - weight -= 1 / 3; - var interpolationWidthSourceReadStop; - - for (interpolationWidthSourceReadStop = this.widthOriginal - 1; weight < interpolationWidthSourceReadStop; targetPosition += channelsNum, weight += ratioWeight) { - // Calculate weightings: - secondWeight = weight % 1; - firstWeight = 1 - secondWeight; // Interpolate: - - for (finalOffset = targetPosition, pixelOffset = Math.floor(weight) * channelsNum; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) { - outputBuffer[finalOffset + 0] = buffer[pixelOffset + 0] * firstWeight + buffer[pixelOffset + channelsNum + 0] * secondWeight; - outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1] * firstWeight + buffer[pixelOffset + channelsNum + 1] * secondWeight; - outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2] * firstWeight + buffer[pixelOffset + channelsNum + 2] * secondWeight; - if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3] * firstWeight + buffer[pixelOffset + channelsNum + 3] * secondWeight; - } - } // Handle for only one interpolation input being valid for end calculation: - - - for (interpolationWidthSourceReadStop = this.originalWidthMultipliedByChannels - channelsNum; targetPosition < this.targetWidthMultipliedByChannels; targetPosition += channelsNum) { - for (finalOffset = targetPosition, pixelOffset = interpolationWidthSourceReadStop; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) { - outputBuffer[finalOffset] = buffer[pixelOffset]; - outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1]; - outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2]; - if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3]; - } - } - - return outputBuffer; -}; - -Resize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) { - var channelsNum = fourthChannel ? 4 : 3; - var ratioWeight = this.ratioWeightWidthPass; - var ratioWeightDivisor = 1 / ratioWeight; - var nextLineOffsetOriginalWidth = this.originalWidthMultipliedByChannels - channelsNum + 1; - var nextLineOffsetTargetWidth = this.targetWidthMultipliedByChannels - channelsNum + 1; - var output = this.outputWidthWorkBench; - var outputBuffer = this.widthBuffer; - var trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount; - var weight = 0; - var amountToNext = 0; - var actualPosition = 0; - var currentPosition = 0; - var line = 0; - var pixelOffset = 0; - var outputOffset = 0; - var multiplier = 1; - var r = 0; - var g = 0; - var b = 0; - var a = 0; - - do { - for (line = 0; line < this.originalHeightMultipliedByChannels;) { - output[line++] = 0; - output[line++] = 0; - output[line++] = 0; - - if (fourthChannel) { - output[line++] = 0; - trustworthyColorsCount[line / channelsNum - 1] = 0; - } - } - - weight = ratioWeight; - - do { - amountToNext = 1 + actualPosition - currentPosition; - multiplier = Math.min(weight, amountToNext); - - for (line = 0, pixelOffset = actualPosition; line < this.originalHeightMultipliedByChannels; pixelOffset += nextLineOffsetOriginalWidth) { - r = buffer[pixelOffset]; - g = buffer[++pixelOffset]; - b = buffer[++pixelOffset]; - a = fourthChannel ? buffer[++pixelOffset] : 255; // Ignore RGB values if pixel is completely transparent - - output[line++] += (a ? r : 0) * multiplier; - output[line++] += (a ? g : 0) * multiplier; - output[line++] += (a ? b : 0) * multiplier; - - if (fourthChannel) { - output[line++] += a * multiplier; - trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0; - } - } - - if (weight >= amountToNext) { - actualPosition += channelsNum; - currentPosition = actualPosition; - weight -= amountToNext; - } else { - currentPosition += weight; - break; - } - } while (weight > 0 && actualPosition < this.originalWidthMultipliedByChannels); - - for (line = 0, pixelOffset = outputOffset; line < this.originalHeightMultipliedByChannels; pixelOffset += nextLineOffsetTargetWidth) { - weight = fourthChannel ? trustworthyColorsCount[line / channelsNum] : 1; - multiplier = fourthChannel ? weight ? 1 / weight : 0 : ratioWeightDivisor; - outputBuffer[pixelOffset] = output[line++] * multiplier; - outputBuffer[++pixelOffset] = output[line++] * multiplier; - outputBuffer[++pixelOffset] = output[line++] * multiplier; - if (fourthChannel) outputBuffer[++pixelOffset] = output[line++] * ratioWeightDivisor; - } - - outputOffset += channelsNum; - } while (outputOffset < this.targetWidthMultipliedByChannels); - - return outputBuffer; -}; - -Resize.prototype._resizeHeightRGBChannels = function (buffer, fourthChannel) { - var ratioWeight = this.ratioWeightHeightPass; - var ratioWeightDivisor = 1 / ratioWeight; - var output = this.outputHeightWorkBench; - var outputBuffer = this.heightBuffer; - var trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount; - var weight = 0; - var amountToNext = 0; - var actualPosition = 0; - var currentPosition = 0; - var pixelOffset = 0; - var outputOffset = 0; - var caret = 0; - var multiplier = 1; - var r = 0; - var g = 0; - var b = 0; - var a = 0; - - do { - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { - output[pixelOffset++] = 0; - output[pixelOffset++] = 0; - output[pixelOffset++] = 0; - - if (fourthChannel) { - output[pixelOffset++] = 0; - trustworthyColorsCount[pixelOffset / 4 - 1] = 0; - } - } - - weight = ratioWeight; - - do { - amountToNext = 1 + actualPosition - currentPosition; - multiplier = Math.min(weight, amountToNext); - caret = actualPosition; - - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { - r = buffer[caret++]; - g = buffer[caret++]; - b = buffer[caret++]; - a = fourthChannel ? buffer[caret++] : 255; // Ignore RGB values if pixel is completely transparent - - output[pixelOffset++] += (a ? r : 0) * multiplier; - output[pixelOffset++] += (a ? g : 0) * multiplier; - output[pixelOffset++] += (a ? b : 0) * multiplier; - - if (fourthChannel) { - output[pixelOffset++] += a * multiplier; - trustworthyColorsCount[pixelOffset / 4 - 1] += a ? multiplier : 0; - } - } - - if (weight >= amountToNext) { - actualPosition = caret; - currentPosition = actualPosition; - weight -= amountToNext; - } else { - currentPosition += weight; - break; - } - } while (weight > 0 && actualPosition < this.widthPassResultSize); - - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { - weight = fourthChannel ? trustworthyColorsCount[pixelOffset / 4] : 1; - multiplier = fourthChannel ? weight ? 1 / weight : 0 : ratioWeightDivisor; - outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier); - outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier); - outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier); - - if (fourthChannel) { - outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * ratioWeightDivisor); - } - } - } while (outputOffset < this.finalResultSize); - - return outputBuffer; -}; - -Resize.prototype.resizeWidthInterpolatedRGB = function (buffer) { - return this._resizeWidthInterpolatedRGBChannels(buffer, false); -}; - -Resize.prototype.resizeWidthInterpolatedRGBA = function (buffer) { - return this._resizeWidthInterpolatedRGBChannels(buffer, true); -}; - -Resize.prototype.resizeWidthRGB = function (buffer) { - return this._resizeWidthRGBChannels(buffer, false); -}; - -Resize.prototype.resizeWidthRGBA = function (buffer) { - return this._resizeWidthRGBChannels(buffer, true); -}; - -Resize.prototype.resizeHeightInterpolated = function (buffer) { - var ratioWeight = this.ratioWeightHeightPass; - var outputBuffer = this.heightBuffer; - var weight = 0; - var finalOffset = 0; - var pixelOffset = 0; - var pixelOffsetAccumulated = 0; - var pixelOffsetAccumulated2 = 0; - var firstWeight = 0; - var secondWeight = 0; - var interpolationHeightSourceReadStop; // Handle for only one interpolation input being valid for start calculation: - - for (; weight < 1 / 3; weight += ratioWeight) { - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) { - outputBuffer[finalOffset++] = Math.round(buffer[pixelOffset++]); - } - } // Adjust for overshoot of the last pass's counter: - - - weight -= 1 / 3; - - for (interpolationHeightSourceReadStop = this.heightOriginal - 1; weight < interpolationHeightSourceReadStop; weight += ratioWeight) { - // Calculate weightings: - secondWeight = weight % 1; - firstWeight = 1 - secondWeight; // Interpolate: - - pixelOffsetAccumulated = Math.floor(weight) * this.targetWidthMultipliedByChannels; - pixelOffsetAccumulated2 = pixelOffsetAccumulated + this.targetWidthMultipliedByChannels; - - for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels; ++pixelOffset) { - outputBuffer[finalOffset++] = Math.round(buffer[pixelOffsetAccumulated++] * firstWeight + buffer[pixelOffsetAccumulated2++] * secondWeight); - } - } // Handle for only one interpolation input being valid for end calculation: - - - while (finalOffset < this.finalResultSize) { - for (pixelOffset = 0, pixelOffsetAccumulated = interpolationHeightSourceReadStop * this.targetWidthMultipliedByChannels; pixelOffset < this.targetWidthMultipliedByChannels; ++pixelOffset) { - outputBuffer[finalOffset++] = Math.round(buffer[pixelOffsetAccumulated++]); - } - } - - return outputBuffer; -}; - -Resize.prototype.resizeHeightRGB = function (buffer) { - return this._resizeHeightRGBChannels(buffer, false); -}; - -Resize.prototype.resizeHeightRGBA = function (buffer) { - return this._resizeHeightRGBChannels(buffer, true); -}; - -Resize.prototype.resize = function (buffer) { - this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer))); -}; - -Resize.prototype.bypassResizer = function (buffer) { - // Just return the buffer passed: - return buffer; -}; - -Resize.prototype.initializeFirstPassBuffers = function (BILINEARAlgo) { - // Initialize the internal width pass buffers: - this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize); - - if (!BILINEARAlgo) { - this.outputWidthWorkBench = this.generateFloatBuffer(this.originalHeightMultipliedByChannels); - - if (this.colorChannels > 3) { - this.outputWidthWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(this.heightOriginal); - } - } -}; - -Resize.prototype.initializeSecondPassBuffers = function (BILINEARAlgo) { - // Initialize the internal height pass buffers: - this.heightBuffer = this.generateUint8Buffer(this.finalResultSize); - - if (!BILINEARAlgo) { - this.outputHeightWorkBench = this.generateFloatBuffer(this.targetWidthMultipliedByChannels); - - if (this.colorChannels > 3) { - this.outputHeightWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(this.targetWidth); - } - } -}; - -Resize.prototype.generateFloatBuffer = function (bufferLength) { - // Generate a float32 typed array buffer: - try { - return new Float32Array(bufferLength); - } catch (error) { - return []; - } -}; - -Resize.prototype.generateFloat64Buffer = function (bufferLength) { - // Generate a float64 typed array buffer: - try { - return new Float64Array(bufferLength); - } catch (error) { - return []; - } -}; - -Resize.prototype.generateUint8Buffer = function (bufferLength) { - // Generate a uint8 typed array buffer: - try { - return new Uint8Array(bufferLength); - } catch (error) { - return []; - } -}; - -module.exports = Resize; - -},{}],223:[function(require,module,exports){ -(function (Buffer){ -"use strict"; - -/** - * Copyright (c) 2015 Guyon Roche - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions:

- * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -module.exports = { - nearestNeighbor: function nearestNeighbor(src, dst) { - var wSrc = src.width; - var hSrc = src.height; - var wDst = dst.width; - var hDst = dst.height; - var bufSrc = src.data; - var bufDst = dst.data; - - for (var i = 0; i < hDst; i++) { - for (var j = 0; j < wDst; j++) { - var posDst = (i * wDst + j) * 4; - var iSrc = Math.floor(i * hSrc / hDst); - var jSrc = Math.floor(j * wSrc / wDst); - var posSrc = (iSrc * wSrc + jSrc) * 4; - bufDst[posDst++] = bufSrc[posSrc++]; - bufDst[posDst++] = bufSrc[posSrc++]; - bufDst[posDst++] = bufSrc[posSrc++]; - bufDst[posDst++] = bufSrc[posSrc++]; - } - } - }, - bilinearInterpolation: function bilinearInterpolation(src, dst) { - var wSrc = src.width; - var hSrc = src.height; - var wDst = dst.width; - var hDst = dst.height; - var bufSrc = src.data; - var bufDst = dst.data; - - var interpolate = function interpolate(k, kMin, vMin, kMax, vMax) { - // special case - k is integer - if (kMin === kMax) { - return vMin; - } - - return Math.round((k - kMin) * vMax + (kMax - k) * vMin); - }; - - var assign = function assign(pos, offset, x, xMin, xMax, y, yMin, yMax) { - var posMin = (yMin * wSrc + xMin) * 4 + offset; - var posMax = (yMin * wSrc + xMax) * 4 + offset; - var vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]); // special case, y is integer - - if (yMax === yMin) { - bufDst[pos + offset] = vMin; - } else { - posMin = (yMax * wSrc + xMin) * 4 + offset; - posMax = (yMax * wSrc + xMax) * 4 + offset; - var vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]); - bufDst[pos + offset] = interpolate(y, yMin, vMin, yMax, vMax); - } - }; - - for (var i = 0; i < hDst; i++) { - for (var j = 0; j < wDst; j++) { - var posDst = (i * wDst + j) * 4; // x & y in src coordinates - - var x = j * wSrc / wDst; - var xMin = Math.floor(x); - var xMax = Math.min(Math.ceil(x), wSrc - 1); - var y = i * hSrc / hDst; - var yMin = Math.floor(y); - var yMax = Math.min(Math.ceil(y), hSrc - 1); - assign(posDst, 0, x, xMin, xMax, y, yMin, yMax); - assign(posDst, 1, x, xMin, xMax, y, yMin, yMax); - assign(posDst, 2, x, xMin, xMax, y, yMin, yMax); - assign(posDst, 3, x, xMin, xMax, y, yMin, yMax); - } - } - }, - _interpolate2D: function _interpolate2D(src, dst, options, interpolate) { - var bufSrc = src.data; - var bufDst = dst.data; - var wSrc = src.width; - var hSrc = src.height; - var wDst = dst.width; - var hDst = dst.height; // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares - - var wM = Math.max(1, Math.floor(wSrc / wDst)); - var wDst2 = wDst * wM; - var hM = Math.max(1, Math.floor(hSrc / hDst)); - var hDst2 = hDst * hM; // =========================================================== - // Pass 1 - interpolate rows - // buf1 has width of dst2 and height of src - - var buf1 = Buffer.alloc(wDst2 * hSrc * 4); - - for (var i = 0; i < hSrc; i++) { - for (var j = 0; j < wDst2; j++) { - // i in src coords, j in dst coords - // calculate x in src coords - // this interpolation requires 4 sample points and the two inner ones must be real - // the outer points can be fudged for the edges. - // therefore (wSrc-1)/wDst2 - var x = j * (wSrc - 1) / wDst2; - var xPos = Math.floor(x); - var t = x - xPos; - var srcPos = (i * wSrc + xPos) * 4; - var buf1Pos = (i * wDst2 + j) * 4; - - for (var k = 0; k < 4; k++) { - var kPos = srcPos + k; - var x0 = xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4]; - var x1 = bufSrc[kPos]; - var x2 = bufSrc[kPos + 4]; - var x3 = xPos < wSrc - 2 ? bufSrc[kPos + 8] : 2 * bufSrc[kPos + 4] - bufSrc[kPos]; - buf1[buf1Pos + k] = interpolate(x0, x1, x2, x3, t); - } - } - } // this._writeFile(wDst2, hSrc, buf1, "out/buf1.jpg"); - // =========================================================== - // Pass 2 - interpolate columns - // buf2 has width and height of dst2 - - - var buf2 = Buffer.alloc(wDst2 * hDst2 * 4); - - for (var _i = 0; _i < hDst2; _i++) { - for (var _j = 0; _j < wDst2; _j++) { - // i&j in dst2 coords - // calculate y in buf1 coords - // this interpolation requires 4 sample points and the two inner ones must be real - // the outer points can be fudged for the edges. - // therefore (hSrc-1)/hDst2 - var y = _i * (hSrc - 1) / hDst2; - var yPos = Math.floor(y); - - var _t = y - yPos; - - var _buf1Pos = (yPos * wDst2 + _j) * 4; - - var buf2Pos = (_i * wDst2 + _j) * 4; - - for (var _k = 0; _k < 4; _k++) { - var _kPos = _buf1Pos + _k; - - var y0 = yPos > 0 ? buf1[_kPos - wDst2 * 4] : 2 * buf1[_kPos] - buf1[_kPos + wDst2 * 4]; - var y1 = buf1[_kPos]; - var y2 = buf1[_kPos + wDst2 * 4]; - var y3 = yPos < hSrc - 2 ? buf1[_kPos + wDst2 * 8] : 2 * buf1[_kPos + wDst2 * 4] - buf1[_kPos]; - buf2[buf2Pos + _k] = interpolate(y0, y1, y2, y3, _t); - } - } - } // this._writeFile(wDst2, hDst2, buf2, "out/buf2.jpg"); - // =========================================================== - // Pass 3 - scale to dst - - - var m = wM * hM; - - if (m > 1) { - for (var _i2 = 0; _i2 < hDst; _i2++) { - for (var _j2 = 0; _j2 < wDst; _j2++) { - // i&j in dst bounded coords - var r = 0; - var g = 0; - var b = 0; - var a = 0; - var realColors = 0; - - for (var _y = 0; _y < hM; _y++) { - var _yPos = _i2 * hM + _y; - - for (var _x = 0; _x < wM; _x++) { - var _xPos = _j2 * wM + _x; - - var xyPos = (_yPos * wDst2 + _xPos) * 4; - var pixelAlpha = buf2[xyPos + 3]; - - if (pixelAlpha) { - r += buf2[xyPos]; - g += buf2[xyPos + 1]; - b += buf2[xyPos + 2]; - realColors++; - } - - a += pixelAlpha; - } - } - - var pos = (_i2 * wDst + _j2) * 4; - bufDst[pos] = realColors ? Math.round(r / realColors) : 0; - bufDst[pos + 1] = realColors ? Math.round(g / realColors) : 0; - bufDst[pos + 2] = realColors ? Math.round(b / realColors) : 0; - bufDst[pos + 3] = Math.round(a / m); - } - } - } else { - // replace dst buffer with buf2 - dst.data = buf2; - } - }, - bicubicInterpolation: function bicubicInterpolation(src, dst, options) { - var interpolateCubic = function interpolateCubic(x0, x1, x2, x3, t) { - var a0 = x3 - x2 - x0 + x1; - var a1 = x0 - x1 - a0; - var a2 = x2 - x0; - var a3 = x1; - return Math.max(0, Math.min(255, a0 * (t * t * t) + a1 * (t * t) + a2 * t + a3)); - }; - - return this._interpolate2D(src, dst, options, interpolateCubic); - }, - hermiteInterpolation: function hermiteInterpolation(src, dst, options) { - var interpolateHermite = function interpolateHermite(x0, x1, x2, x3, t) { - var c0 = x1; - var c1 = 0.5 * (x2 - x0); - var c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3; - var c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2); - return Math.max(0, Math.min(255, Math.round(((c3 * t + c2) * t + c1) * t + c0))); - }; - - return this._interpolate2D(src, dst, options, interpolateHermite); - }, - bezierInterpolation: function bezierInterpolation(src, dst, options) { - // between 2 points y(n), y(n+1), use next points out, y(n-1), y(n+2) - // to predict control points (a & b) to be placed at n+0.5 - // ya(n) = y(n) + (y(n+1)-y(n-1))/4 - // yb(n) = y(n+1) - (y(n+2)-y(n))/4 - // then use std bezier to interpolate [n,n+1) - // y(n+t) = y(n)*(1-t)^3 + 3 * ya(n)*(1-t)^2*t + 3 * yb(n)*(1-t)*t^2 + y(n+1)*t^3 - // note the 3* factor for the two control points - // for edge cases, can choose: - // y(-1) = y(0) - 2*(y(1)-y(0)) - // y(w) = y(w-1) + 2*(y(w-1)-y(w-2)) - // but can go with y(-1) = y(0) and y(w) = y(w-1) - var interpolateBezier = function interpolateBezier(x0, x1, x2, x3, t) { - // x1, x2 are the knots, use x0 and x3 to calculate control points - var cp1 = x1 + (x2 - x0) / 4; - var cp2 = x2 - (x3 - x1) / 4; - var nt = 1 - t; - var c0 = x1 * nt * nt * nt; - var c1 = 3 * cp1 * nt * nt * t; - var c2 = 3 * cp2 * nt * t * t; - var c3 = x2 * t * t * t; - return Math.max(0, Math.min(255, Math.round(c0 + c1 + c2 + c3))); - }; - - return this._interpolate2D(src, dst, options, interpolateBezier); - } -}; - -}).call(this,require("buffer").Buffer) -},{"buffer":48}],224:[function(require,module,exports){ -(function (Buffer){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Rotates an image clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object. - * @param {number} deg the number of degrees to rotate the image by - * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed - */ -function advancedRotate(deg, mode) { - deg %= 360; - var rad = deg * Math.PI / 180; - var cosine = Math.cos(rad); - var sine = Math.sin(rad); // the final width and height will change if resize == true - - var w = this.bitmap.width; - var h = this.bitmap.height; - - if (mode === true || typeof mode === 'string') { - // resize the image to it maximum dimension and blit the existing image - // onto the center so that when it is rotated the image is kept in bounds - // http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle - // Plus 1 border pixel to ensure to show all rotated result for some cases. - w = Math.ceil(Math.abs(this.bitmap.width * cosine) + Math.abs(this.bitmap.height * sine)) + 1; - h = Math.ceil(Math.abs(this.bitmap.width * sine) + Math.abs(this.bitmap.height * cosine)) + 1; // Ensure destination to have even size to a better result. - - if (w % 2 !== 0) { - w++; - } - - if (h % 2 !== 0) { - h++; - } - - var c = this.cloneQuiet(); - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - this.bitmap.data.writeUInt32BE(this._background, idx); - }); - var max = Math.max(w, h, this.bitmap.width, this.bitmap.height); - this.resize(max, max, mode); - this.blit(c, this.bitmap.width / 2 - c.bitmap.width / 2, this.bitmap.height / 2 - c.bitmap.height / 2); - } - - var bW = this.bitmap.width; - var bH = this.bitmap.height; - var dstBuffer = Buffer.alloc(this.bitmap.data.length); - - function createTranslationFunction(deltaX, deltaY) { - return function (x, y) { - return { - x: x + deltaX, - y: y + deltaY - }; - }; - } - - var translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2)); - var translate2Screen = createTranslationFunction(bW / 2 + 0.5, bH / 2 + 0.5); - - for (var y = 1; y <= bH; y++) { - for (var x = 1; x <= bW; x++) { - var cartesian = translate2Cartesian(x, y); - var source = translate2Screen(cosine * cartesian.x - sine * cartesian.y, cosine * cartesian.y + sine * cartesian.x); - var dstIdx = bW * (y - 1) + x - 1 << 2; - - if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) { - var srcIdx = (bW * (source.y | 0) + source.x | 0) << 2; - var pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx); - dstBuffer.writeUInt32BE(pixelRGBA, dstIdx); - } else { - // reset off-image pixels - dstBuffer.writeUInt32BE(this._background, dstIdx); - } - } - } - - this.bitmap.data = dstBuffer; - - if (mode === true || typeof mode === 'string') { - // now crop the image to the final size - var _x = bW / 2 - w / 2; - - var _y = bH / 2 - h / 2; - - this.crop(_x, _y, w, h); - } -} - -var _default = function _default() { - return { - /** - * Rotates the image clockwise by a number of degrees. By default the width and height of the image will be resized appropriately. - * @param {number} deg the number of degrees to rotate the image by - * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - rotate: function rotate(deg, mode, cb) { - // enable overloading - if (typeof mode === 'undefined' || mode === null) { - // e.g. image.resize(120); - // e.g. image.resize(120, null, cb); - // e.g. image.resize(120, undefined, cb); - mode = true; - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - // e.g. image.resize(120, cb); - cb = mode; - mode = true; - } - - if (typeof deg !== 'number') { - return _utils.throwError.call(this, 'deg must be a number', cb); - } - - if (typeof mode !== 'boolean' && typeof mode !== 'string') { - return _utils.throwError.call(this, 'mode must be a boolean or a string', cb); - } - - advancedRotate.call(this, deg, mode, cb); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -}).call(this,require("buffer").Buffer) -},{"@jimp/utils":235,"buffer":48}],225:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -var _default = function _default() { - return { - /** - * Uniformly scales the image by a factor. - * @param {number} f the factor to scale the image by - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - scale: function scale(f, mode, cb) { - if (typeof f !== 'number') { - return _utils.throwError.call(this, 'f must be a number', cb); - } - - if (f < 0) { - return _utils.throwError.call(this, 'f must be a positive number', cb); - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - var w = this.bitmap.width * f; - var h = this.bitmap.height * f; - this.resize(w, h, mode); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Scale the image to the largest size that fits inside the rectangle that has the given width and height. - * @param {number} w the width to resize the image to - * @param {number} h the height to resize the image to - * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER) - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - scaleToFit: function scaleToFit(w, h, mode, cb) { - if (typeof w !== 'number' || typeof h !== 'number') { - return _utils.throwError.call(this, 'w and h must be numbers', cb); - } - - if (typeof mode === 'function' && typeof cb === 'undefined') { - cb = mode; - mode = null; - } - - var f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width; - this.scale(f, mode); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],226:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Creates a circle out of an image. - * @param {function(Error, Jimp)} options (optional) - * opacity - opacity of the shadow between 0 and 1 - * size,- of the shadow - * blur - how blurry the shadow is - * x- x position of shadow - * y - y position of shadow - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ -var _default = function _default() { - return { - shadow: function shadow() { - var _this = this; - - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var cb = arguments.length > 1 ? arguments[1] : undefined; - - if (typeof options === 'function') { - cb = options; - options = {}; - } - - var _options = options, - _options$opacity = _options.opacity, - opacity = _options$opacity === void 0 ? 0.7 : _options$opacity, - _options$size = _options.size, - size = _options$size === void 0 ? 1.1 : _options$size, - _options$x = _options.x, - x = _options$x === void 0 ? -25 : _options$x, - _options$y = _options.y, - y = _options$y === void 0 ? 25 : _options$y, - _options$blur = _options.blur, - blur = _options$blur === void 0 ? 5 : _options$blur; // clone the image - - var orig = this.clone(); - var shadow = this.clone(); // turn all it's pixels black - - shadow.scan(0, 0, shadow.bitmap.width, shadow.bitmap.height, function (x, y, idx) { - shadow.bitmap.data[idx] = 0x00; - shadow.bitmap.data[idx + 1] = 0x00; - shadow.bitmap.data[idx + 2] = 0x00; // up the opacity a little, - - shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(shadow.bitmap.data[idx + 3] * opacity); - _this.bitmap.data[idx] = 0x00; - _this.bitmap.data[idx + 1] = 0x00; - _this.bitmap.data[idx + 2] = 0x00; - _this.bitmap.data[idx + 3] = 0x00; - }); // enlarge it. This creates a "shadow". - - shadow.resize(shadow.bitmap.width * size, shadow.bitmap.height * size).blur(blur); // Then blit the "shadow" onto the background and the image on top of that. - - this.composite(shadow, x, y); - this.composite(orig, 0, 0); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],227:[function(require,module,exports){ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _utils = require("@jimp/utils"); - -/** - * Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default - * @param {number} options object - * max: A number auto limited between 0 - 255 - * replace: (optional) A number auto limited between 0 - 255 (default 255) - * autoGreyscale: (optional) A boolean whether to apply greyscale beforehand (default true) - * @param {number} cb (optional) a callback for when complete - * @return {this} this for chaining of methods - */ -var _default = function _default() { - return { - threshold: function threshold(_ref, cb) { - var _this = this; - - var max = _ref.max, - _ref$replace = _ref.replace, - replace = _ref$replace === void 0 ? 255 : _ref$replace, - _ref$autoGreyscale = _ref.autoGreyscale, - autoGreyscale = _ref$autoGreyscale === void 0 ? true : _ref$autoGreyscale; - - if (typeof max !== 'number') { - return _utils.throwError.call(this, 'max must be a number', cb); - } - - if (typeof replace !== 'number') { - return _utils.throwError.call(this, 'replace must be a number', cb); - } - - if (typeof autoGreyscale !== 'boolean') { - return _utils.throwError.call(this, 'autoGreyscale must be a boolean', cb); - } - - max = this.constructor.limit255(max); - replace = this.constructor.limit255(replace); - - if (autoGreyscale) { - this.greyscale(); - } - - this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) { - var grey = _this.bitmap.data[idx] < max ? _this.bitmap.data[idx] : replace; - _this.bitmap.data[idx] = grey; - _this.bitmap.data[idx + 1] = grey; - _this.bitmap.data[idx + 2] = grey; - }); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@jimp/utils":235}],228:[function(require,module,exports){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); - -var _timm = require("timm"); - -var _pluginBlit = _interopRequireDefault(require("@jimp/plugin-blit")); - -var _pluginBlur = _interopRequireDefault(require("@jimp/plugin-blur")); - -var _pluginCircle = _interopRequireDefault(require("@jimp/plugin-circle")); - -var _pluginColor = _interopRequireDefault(require("@jimp/plugin-color")); - -var _pluginContain = _interopRequireDefault(require("@jimp/plugin-contain")); - -var _pluginCover = _interopRequireDefault(require("@jimp/plugin-cover")); - -var _pluginCrop = _interopRequireDefault(require("@jimp/plugin-crop")); - -var _pluginDisplace = _interopRequireDefault(require("@jimp/plugin-displace")); - -var _pluginDither = _interopRequireDefault(require("@jimp/plugin-dither")); - -var _pluginFisheye = _interopRequireDefault(require("@jimp/plugin-fisheye")); - -var _pluginFlip = _interopRequireDefault(require("@jimp/plugin-flip")); - -var _pluginGaussian = _interopRequireDefault(require("@jimp/plugin-gaussian")); - -var _pluginInvert = _interopRequireDefault(require("@jimp/plugin-invert")); - -var _pluginMask = _interopRequireDefault(require("@jimp/plugin-mask")); - -var _pluginNormalize = _interopRequireDefault(require("@jimp/plugin-normalize")); - -var _pluginPrint = _interopRequireDefault(require("@jimp/plugin-print")); - -var _pluginResize = _interopRequireDefault(require("@jimp/plugin-resize")); - -var _pluginRotate = _interopRequireDefault(require("@jimp/plugin-rotate")); - -var _pluginScale = _interopRequireDefault(require("@jimp/plugin-scale")); - -var _pluginShadow = _interopRequireDefault(require("@jimp/plugin-shadow")); - -var _pluginThreshold = _interopRequireDefault(require("@jimp/plugin-threshold")); - -var plugins = [_pluginBlit["default"], _pluginBlur["default"], _pluginCircle["default"], _pluginColor["default"], _pluginContain["default"], _pluginCover["default"], _pluginCrop["default"], _pluginDisplace["default"], _pluginDither["default"], _pluginFisheye["default"], _pluginFlip["default"], _pluginGaussian["default"], _pluginInvert["default"], _pluginMask["default"], _pluginNormalize["default"], _pluginPrint["default"], _pluginResize["default"], _pluginRotate["default"], _pluginScale["default"], _pluginShadow["default"], _pluginThreshold["default"]]; - -var _default = function _default(jimpEvChange) { - var initializedPlugins = plugins.map(function (pluginModule) { - var plugin = pluginModule(jimpEvChange) || {}; - - if (!plugin["class"] && !plugin.constants) { - // Default to class function - plugin = { - "class": plugin - }; - } - - return plugin; - }); - return _timm.mergeDeep.apply(void 0, (0, _toConsumableArray2["default"])(initializedPlugins)); -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/helpers/toConsumableArray":20,"@jimp/plugin-blit":201,"@jimp/plugin-blur":203,"@jimp/plugin-circle":204,"@jimp/plugin-color":205,"@jimp/plugin-contain":206,"@jimp/plugin-cover":207,"@jimp/plugin-crop":208,"@jimp/plugin-displace":209,"@jimp/plugin-dither":210,"@jimp/plugin-fisheye":211,"@jimp/plugin-flip":212,"@jimp/plugin-gaussian":213,"@jimp/plugin-invert":214,"@jimp/plugin-mask":215,"@jimp/plugin-normalize":216,"@jimp/plugin-print":217,"@jimp/plugin-resize":221,"@jimp/plugin-rotate":224,"@jimp/plugin-scale":225,"@jimp/plugin-shadow":226,"@jimp/plugin-threshold":227,"timm":177}],229:[function(require,module,exports){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _bmpJs = _interopRequireDefault(require("bmp-js")); - -var _utils = require("@jimp/utils"); - -var MIME_TYPE = 'image/bmp'; -var MIME_TYPE_SECOND = 'image/x-ms-bmp'; - -function toAGBR(image) { - return (0, _utils.scan)(image, 0, 0, image.bitmap.width, image.bitmap.height, function (x, y, index) { - var red = this.bitmap.data[index + 0]; - var green = this.bitmap.data[index + 1]; - var blue = this.bitmap.data[index + 2]; - var alpha = this.bitmap.data[index + 3]; - this.bitmap.data[index + 0] = alpha; - this.bitmap.data[index + 1] = blue; - this.bitmap.data[index + 2] = green; - this.bitmap.data[index + 3] = red; - }).bitmap; -} - -function fromAGBR(bitmap) { - return (0, _utils.scan)({ - bitmap: bitmap - }, 0, 0, bitmap.width, bitmap.height, function (x, y, index) { - var alpha = this.bitmap.data[index + 0]; - var blue = this.bitmap.data[index + 1]; - var green = this.bitmap.data[index + 2]; - var red = this.bitmap.data[index + 3]; - this.bitmap.data[index + 0] = red; - this.bitmap.data[index + 1] = green; - this.bitmap.data[index + 2] = blue; - this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff; - }).bitmap; -} - -var decode = function decode(data) { - return fromAGBR(_bmpJs["default"].decode(data)); -}; - -var encode = function encode(image) { - return _bmpJs["default"].encode(toAGBR(image)).data; -}; - -var _default = function _default() { - var _decoders, _encoders; - - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['bmp']), - constants: { - MIME_BMP: MIME_TYPE, - MIME_X_MS_BMP: MIME_TYPE_SECOND - }, - decoders: (_decoders = {}, (0, _defineProperty2["default"])(_decoders, MIME_TYPE, decode), (0, _defineProperty2["default"])(_decoders, MIME_TYPE_SECOND, decode), _decoders), - encoders: (_encoders = {}, (0, _defineProperty2["default"])(_encoders, MIME_TYPE, encode), (0, _defineProperty2["default"])(_encoders, MIME_TYPE_SECOND, encode), _encoders) - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/interopRequireDefault":11,"@jimp/utils":235,"bmp-js":30}],230:[function(require,module,exports){ -(function (Buffer){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _omggif = _interopRequireDefault(require("omggif")); - -var _gifwrap = require("gifwrap"); - -var MIME_TYPE = 'image/gif'; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['gif']), - constants: { - MIME_GIF: MIME_TYPE - }, - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var gifObj = new _omggif["default"].GifReader(data); - var gifData = Buffer.alloc(gifObj.width * gifObj.height * 4); - gifObj.decodeAndBlitFrameRGBA(0, gifData); - return { - data: gifData, - width: gifObj.width, - height: gifObj.height - }; - }), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var bitmap = new _gifwrap.BitmapImage(data.bitmap); - - _gifwrap.GifUtil.quantizeDekker(bitmap, 256); - - var newFrame = new _gifwrap.GifFrame(bitmap); - var gifCodec = new _gifwrap.GifCodec(); - return gifCodec.encodeGif([newFrame], {}).then(function (newGif) { - return newGif.buffer; - }); - }) - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -}).call(this,require("buffer").Buffer) -},{"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/interopRequireDefault":11,"buffer":48,"gifwrap":70,"omggif":85}],231:[function(require,module,exports){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _jpegJs = _interopRequireDefault(require("jpeg-js")); - -var _utils = require("@jimp/utils"); - -var MIME_TYPE = 'image/jpeg'; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['jpeg', 'jpg', 'jpe']), - constants: { - MIME_JPEG: MIME_TYPE - }, - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, _jpegJs["default"].decode), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (image) { - return _jpegJs["default"].encode(image.bitmap, image._quality).data; - }), - "class": { - // The quality to be used when saving JPEG images - _quality: 100, - - /** - * Sets the quality of the image when saving as JPEG format (default is 100) - * @param {number} n The quality to use 0-100 - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - quality: function quality(n, cb) { - if (typeof n !== 'number') { - return _utils.throwError.call(this, 'n must be a number', cb); - } - - if (n < 0 || n > 100) { - return _utils.throwError.call(this, 'n must be a number 0 - 100', cb); - } - - this._quality = Math.round(n); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/interopRequireDefault":11,"@jimp/utils":235,"jpeg-js":80}],232:[function(require,module,exports){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _pngjs = require("pngjs"); - -var _utils = require("@jimp/utils"); - -var MIME_TYPE = 'image/png'; // PNG filter types - -var PNG_FILTER_AUTO = -1; -var PNG_FILTER_NONE = 0; -var PNG_FILTER_SUB = 1; -var PNG_FILTER_UP = 2; -var PNG_FILTER_AVERAGE = 3; -var PNG_FILTER_PATH = 4; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['png']), - constants: { - MIME_PNG: MIME_TYPE, - PNG_FILTER_AUTO: PNG_FILTER_AUTO, - PNG_FILTER_NONE: PNG_FILTER_NONE, - PNG_FILTER_SUB: PNG_FILTER_SUB, - PNG_FILTER_UP: PNG_FILTER_UP, - PNG_FILTER_AVERAGE: PNG_FILTER_AVERAGE, - PNG_FILTER_PATH: PNG_FILTER_PATH - }, - hasAlpha: (0, _defineProperty2["default"])({}, MIME_TYPE, true), - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, _pngjs.PNG.sync.read), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var png = new _pngjs.PNG({ - width: data.bitmap.width, - height: data.bitmap.height - }); - png.data = data.bitmap.data; - return _pngjs.PNG.sync.write(png, { - width: data.bitmap.width, - height: data.bitmap.height, - deflateLevel: data._deflateLevel, - deflateStrategy: data._deflateStrategy, - filterType: data._filterType, - colorType: typeof data._colorType === 'number' ? data._colorType : data._rgba ? 6 : 2, - inputHasAlpha: data._rgba - }); - }), - "class": { - _deflateLevel: 9, - _deflateStrategy: 3, - _filterType: PNG_FILTER_AUTO, - _colorType: null, - - /** - * Sets the deflate level used when saving as PNG format (default is 9) - * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - deflateLevel: function deflateLevel(l, cb) { - if (typeof l !== 'number') { - return _utils.throwError.call(this, 'l must be a number', cb); - } - - if (l < 0 || l > 9) { - return _utils.throwError.call(this, 'l must be a number 0 - 9', cb); - } - - this._deflateLevel = Math.round(l); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Sets the deflate strategy used when saving as PNG format (default is 3) - * @param {number} s Deflate strategy to use 0-3. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - deflateStrategy: function deflateStrategy(s, cb) { - if (typeof s !== 'number') { - return _utils.throwError.call(this, 's must be a number', cb); - } - - if (s < 0 || s > 3) { - return _utils.throwError.call(this, 's must be a number 0 - 3', cb); - } - - this._deflateStrategy = Math.round(s); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Sets the filter type used when saving as PNG format (default is automatic filters) - * @param {number} f The quality to use -1-4. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - filterType: function filterType(f, cb) { - if (typeof f !== 'number') { - return _utils.throwError.call(this, 'n must be a number', cb); - } - - if (f < -1 || f > 4) { - return _utils.throwError.call(this, 'n must be -1 (auto) or a number 0 - 4', cb); - } - - this._filterType = Math.round(f); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - }, - - /** - * Sets the color type used when saving as PNG format - * @param {number} s color type to use 0, 2, 4, 6. - * @param {function(Error, Jimp)} cb (optional) a callback for when complete - * @returns {Jimp} this for chaining of methods - */ - colorType: function colorType(s, cb) { - if (typeof s !== 'number') { - return _utils.throwError.call(this, 's must be a number', cb); - } - - if (s !== 0 && s !== 2 && s !== 4 && s !== 6) { - return _utils.throwError.call(this, 's must be a number 0, 2, 4, 6.', cb); - } - - this._colorType = Math.round(s); - - if ((0, _utils.isNodePattern)(cb)) { - cb.call(this, null, this); - } - - return this; - } - } - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/interopRequireDefault":11,"@jimp/utils":235,"pngjs":129}],233:[function(require,module,exports){ -(function (Buffer){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); - -var _utif = _interopRequireDefault(require("utif")); - -var MIME_TYPE = 'image/tiff'; - -var _default = function _default() { - return { - mime: (0, _defineProperty2["default"])({}, MIME_TYPE, ['tiff', 'tif']), - constants: { - MIME_TIFF: MIME_TYPE - }, - decoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (data) { - var ifds = _utif["default"].decode(data); - - var page = ifds[0]; - - _utif["default"].decodeImages(data, ifds); - - var rgba = _utif["default"].toRGBA8(page); - - return { - data: Buffer.from(rgba), - width: page.t256[0], - height: page.t257[0] - }; - }), - encoders: (0, _defineProperty2["default"])({}, MIME_TYPE, function (image) { - var tiff = _utif["default"].encodeImage(image.bitmap.data, image.bitmap.width, image.bitmap.height); - - return Buffer.from(tiff); - }) - }; -}; - -exports["default"] = _default; -module.exports = exports.default; - -}).call(this,require("buffer").Buffer) -},{"@babel/runtime/helpers/defineProperty":7,"@babel/runtime/helpers/interopRequireDefault":11,"buffer":48,"utif":182}],234:[function(require,module,exports){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports["default"] = void 0; - -var _timm = require("timm"); - -var _jpeg = _interopRequireDefault(require("@jimp/jpeg")); - -var _png = _interopRequireDefault(require("@jimp/png")); - -var _bmp = _interopRequireDefault(require("@jimp/bmp")); - -var _tiff = _interopRequireDefault(require("@jimp/tiff")); - -var _gif = _interopRequireDefault(require("@jimp/gif")); - -var _default = function _default() { - return (0, _timm.mergeDeep)((0, _jpeg["default"])(), (0, _png["default"])(), (0, _bmp["default"])(), (0, _tiff["default"])(), (0, _gif["default"])()); -}; - -exports["default"] = _default; -module.exports = exports.default; - -},{"@babel/runtime/helpers/interopRequireDefault":11,"@jimp/bmp":229,"@jimp/gif":230,"@jimp/jpeg":231,"@jimp/png":232,"@jimp/tiff":233,"timm":177}],235:[function(require,module,exports){ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isNodePattern = isNodePattern; -exports.throwError = throwError; -exports.scan = scan; -exports.scanIterator = scanIterator; - -var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); - -var _marked = -/*#__PURE__*/ -_regenerator["default"].mark(scanIterator); - -function isNodePattern(cb) { - if (typeof cb === 'undefined') { - return false; - } - - if (typeof cb !== 'function') { - throw new TypeError('Callback must be a function'); - } - - return true; -} - -function throwError(error, cb) { - if (typeof error === 'string') { - error = new Error(error); - } - - if (typeof cb === 'function') { - return cb.call(this, error); - } - - throw error; -} - -function scan(image, x, y, w, h, f) { - // round input - x = Math.round(x); - y = Math.round(y); - w = Math.round(w); - h = Math.round(h); - - for (var _y = y; _y < y + h; _y++) { - for (var _x = x; _x < x + w; _x++) { - var idx = image.bitmap.width * _y + _x << 2; - f.call(image, _x, _y, idx); - } - } - - return image; -} - -function scanIterator(image, x, y, w, h) { - var _y, _x, idx; - - return _regenerator["default"].wrap(function scanIterator$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - // round input - x = Math.round(x); - y = Math.round(y); - w = Math.round(w); - h = Math.round(h); - _y = y; - - case 5: - if (!(_y < y + h)) { - _context.next = 17; - break; - } - - _x = x; - - case 7: - if (!(_x < x + w)) { - _context.next = 14; - break; - } - - idx = image.bitmap.width * _y + _x << 2; - _context.next = 11; - return { - x: _x, - y: _y, - idx: idx, - image: image - }; - - case 11: - _x++; - _context.next = 7; - break; - - case 14: - _y++; - _context.next = 5; - break; - - case 17: - case "end": - return _context.stop(); - } - } - }, _marked); -} - -},{"@babel/runtime/helpers/interopRequireDefault":11,"@babel/runtime/regenerator":22}]},{},[200])(200) -}); +/*! For license information please see jimp.js.LICENSE.txt */ +(()=>{var __webpack_modules__={236:(t,e,r)=>{var i=r(4618);function n(t,e){var r=new i(t,e);return function(t){return r.convert(t)}}n.BIN="01",n.OCT="01234567",n.DEC="0123456789",n.HEX="0123456789abcdef",t.exports=n},4618:t=>{"use strict";function e(t,e){if(!(t&&e&&t.length&&e.length))throw new Error("Bad alphabet");this.srcAlphabet=t,this.dstAlphabet=e}e.prototype.convert=function(t){var e,r,i,n={},a=this.srcAlphabet.length,o=this.dstAlphabet.length,s=t.length,h="string"==typeof t?"":[];if(!this.isValid(t))throw new Error('Number "'+t+'" contains of non-alphabetic digits ('+this.srcAlphabet+")");if(this.srcAlphabet===this.dstAlphabet)return t;for(e=0;e=o?(n[i++]=parseInt(r/o,10),r%=o):i>0&&(n[i++]=0);s=i,h=this.dstAlphabet.slice(r,r+1).concat(h)}while(0!==i);return h},e.prototype.isValid=function(t){for(var e=0;e{"use strict";e.byteLength=function(t){var e=h(t),r=e[0],i=e[1];return 3*(r+i)/4-i},e.toByteArray=function(t){var e,r,a=h(t),o=a[0],s=a[1],l=new n(function(t,e,r){return 3*(e+r)/4-r}(0,o,s)),f=0,u=s>0?o-4:o;for(r=0;r>16&255,l[f++]=e>>8&255,l[f++]=255&e;return 2===s&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,l[f++]=255&e),1===s&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,l[f++]=e>>8&255,l[f++]=255&e),l},e.fromByteArray=function(t){for(var e,i=t.length,n=i%3,a=[],o=16383,s=0,h=i-n;sh?h:s+o));return 1===n?(e=t[i-1],a.push(r[e>>2]+r[e<<4&63]+"==")):2===n&&(e=(t[i-2]<<8)+t[i-1],a.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),a.join("")};for(var r=[],i=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,s=a.length;o0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,i){for(var n,a,o=[],s=e;s>18&63]+r[a>>12&63]+r[a>>6&63]+r[63&a]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},486:(t,e,r)=>{var i=r(5433),n=r(1651);t.exports={encode:i,decode:n}},1651:(t,e,r)=>{var i=r(8834).lW;function n(t,e){if(this.pos=0,this.buffer=t,this.is_with_alpha=!!e,this.bottom_up=!0,this.flag=this.buffer.toString("utf-8",0,this.pos+=2),"BM"!=this.flag)throw new Error("Invalid BMP File");this.parseHeader(),this.parseRGBA()}n.prototype.parseHeader=function(){if(this.fileSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.reserved=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.offset=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.headerSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.width=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.height=this.buffer.readInt32LE(this.pos),this.pos+=4,this.planes=this.buffer.readUInt16LE(this.pos),this.pos+=2,this.bitPP=this.buffer.readUInt16LE(this.pos),this.pos+=2,this.compress=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.rawSize=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.hr=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.vr=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.colors=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.importantColors=this.buffer.readUInt32LE(this.pos),this.pos+=4,16===this.bitPP&&this.is_with_alpha&&(this.bitPP=15),this.bitPP<15){var t=0===this.colors?1<=0?this.height-1:-this.height;for(r=this.height-1;r>=0;r--){for(var i=this.bottom_up?r:this.height-1-r,n=0;n>7-s&1];this.data[o+4*s]=0,this.data[o+4*s+1]=h.blue,this.data[o+4*s+2]=h.green,this.data[o+4*s+3]=h.red}0!=e&&(this.pos+=4-e)}},n.prototype.bit4=function(){if(2==this.compress){this.data.fill(255);for(var t=0,e=this.bottom_up?this.height-1:0,r=!1;t>4),1&h&&h+1>1&1)&&this.pos++}}else for(h=0;h>4),r=!r}function l(e){var r=this.palette[e];this.data[t]=0,this.data[t+1]=r.blue,this.data[t+2]=r.green,this.data[t+3]=r.red,t+=4}}else{var f=Math.ceil(this.width/2),u=f%4;for(o=this.height-1;o>=0;o--){var c=this.bottom_up?o:this.height-1-o;for(a=0;a>4,p=15&n,m=this.palette[d];if(this.data[t]=0,this.data[t+1]=m.blue,this.data[t+2]=m.green,this.data[t+3]=m.red,2*a+1>=this.width)break;m=this.palette[p],this.data[t+4]=0,this.data[t+4+1]=m.blue,this.data[t+4+2]=m.green,this.data[t+4+3]=m.red}0!=u&&(this.pos+=4-u)}}},n.prototype.bit8=function(){if(1==this.compress){this.data.fill(255);for(var t=0,e=this.bottom_up?this.height-1:0;t=0;a--){var f=this.bottom_up?a:this.height-1-a;for(n=0;n=0;r--){for(var i=this.bottom_up?r:this.height-1-r,n=0;n>5&e)/e*255|0,h=(a>>10&e)/e*255|0,l=a>>15?255:0,f=i*this.width*4+4*n;this.data[f]=l,this.data[f+1]=o,this.data[f+2]=s,this.data[f+3]=h}this.pos+=t}},n.prototype.bit16=function(){var t=this.width%2*2;this.maskRed=31744,this.maskGreen=992,this.maskBlue=31,this.mask0=0,3==this.compress&&(this.maskRed=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.maskGreen=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.maskBlue=this.buffer.readUInt32LE(this.pos),this.pos+=4,this.mask0=this.buffer.readUInt32LE(this.pos),this.pos+=4);for(var e=[0,0,0],r=0;r<16;r++)this.maskRed>>r&1&&e[0]++,this.maskGreen>>r&1&&e[1]++,this.maskBlue>>r&1&&e[2]++;e[1]+=e[0],e[2]+=e[1],e[0]=8-e[0],e[1]-=8,e[2]-=8;for(var i=this.height-1;i>=0;i--){for(var n=this.bottom_up?i:this.height-1-i,a=0;a>e[1],l=(o&this.maskRed)>>e[2],f=n*this.width*4+4*a;this.data[f]=0,this.data[f+1]=s,this.data[f+2]=h,this.data[f+3]=l}this.pos+=t}},n.prototype.bit24=function(){for(var t=this.height-1;t>=0;t--){for(var e=this.bottom_up?t:this.height-1-t,r=0;r=0;t--)for(var e=this.bottom_up?t:this.height-1-t,r=0;r=0;t--)for(e=this.bottom_up?t:this.height-1-t,r=0;r{var i=r(8834).lW;function n(t){this.buffer=t.data,this.width=t.width,this.height=t.height,this.extraBytes=this.width%4,this.rgbSize=this.height*(3*this.width+this.extraBytes),this.headerInfoSize=40,this.data=[],this.flag="BM",this.reserved=0,this.offset=54,this.fileSize=this.rgbSize+this.offset,this.planes=1,this.bitPP=24,this.compress=0,this.hr=0,this.vr=0,this.colors=0,this.importantColors=0}n.prototype.encode=function(){var t=new i(this.offset+this.rgbSize);this.pos=0,t.write(this.flag,this.pos,2),this.pos+=2,t.writeUInt32LE(this.fileSize,this.pos),this.pos+=4,t.writeUInt32LE(this.reserved,this.pos),this.pos+=4,t.writeUInt32LE(this.offset,this.pos),this.pos+=4,t.writeUInt32LE(this.headerInfoSize,this.pos),this.pos+=4,t.writeUInt32LE(this.width,this.pos),this.pos+=4,t.writeInt32LE(-this.height,this.pos),this.pos+=4,t.writeUInt16LE(this.planes,this.pos),this.pos+=2,t.writeUInt16LE(this.bitPP,this.pos),this.pos+=2,t.writeUInt32LE(this.compress,this.pos),this.pos+=4,t.writeUInt32LE(this.rgbSize,this.pos),this.pos+=4,t.writeUInt32LE(this.hr,this.pos),this.pos+=4,t.writeUInt32LE(this.vr,this.pos),this.pos+=4,t.writeUInt32LE(this.colors,this.pos),this.pos+=4,t.writeUInt32LE(this.importantColors,this.pos),this.pos+=4;for(var e=0,r=3*this.width+this.extraBytes,n=0;n0){var s=this.pos+n*r+3*this.width;t.fill(0,s,s+this.extraBytes)}}return t},t.exports=function(t,e){return void 0===e&&(e=100),{data:new n(t).encode(),width:t.width,height:t.height}}},5137:(t,e,r)=>{var i=r(8834).lW;t.exports=function(t,e){if(i.isBuffer(t)&&i.isBuffer(e)){if("function"==typeof t.equals)return t.equals(e);if(t.length!==e.length)return!1;for(var r=0;r{"use strict";var i=r(5766),n=r(4181);e.lW=s,e.h2=50;var a=2147483647;function o(t){if(t>a)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=s.prototype,e}function s(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return f(t)}return h(t,e,r)}function h(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|d(t,e),i=o(r),n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}(t,e);if(ArrayBuffer.isView(t))return u(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(F(t,ArrayBuffer)||t&&F(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|t}function d(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||F(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return D(t).length;default:if(n)return i?-1:z(t).length;e=(""+e).toLowerCase(),n=!0}}function p(t,e,r){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return B(this,e,r);case"utf8":case"utf-8":return S(this,e,r);case"ascii":return A(this,e,r);case"latin1":case"binary":return I(this,e,r);case"base64":return k(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function m(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function g(t,e,r,i,n){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),j(r=+r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=s.from(e,i)),s.isBuffer(e))return 0===e.length?-1:b(t,e,r,i,n);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,i,n){var a,o=1,s=t.length,h=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;o=2,s/=2,h/=2,r/=2}function l(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(n){var f=-1;for(a=r;as&&(r=s-h),a=r;a>=0;a--){for(var u=!0,c=0;cn&&(i=n):i=n;var a=e.length;i>a/2&&(i=a/2);for(var o=0;o>8,n=r%256,a.push(n),a.push(i);return a}(e,t.length-r),t,r,i)}function k(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function S(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n239?4:l>223?3:l>191?2:1;if(n+u<=r)switch(u){case 1:l<128&&(f=l);break;case 2:128==(192&(a=t[n+1]))&&(h=(31&l)<<6|63&a)>127&&(f=h);break;case 3:a=t[n+1],o=t[n+2],128==(192&a)&&128==(192&o)&&(h=(15&l)<<12|(63&a)<<6|63&o)>2047&&(h<55296||h>57343)&&(f=h);break;case 4:a=t[n+1],o=t[n+2],s=t[n+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(h=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&h<1114112&&(f=h)}null===f?(f=65533,u=1):f>65535&&(f-=65536,i.push(f>>>10&1023|55296),f=56320|1023&f),i.push(f),n+=u}return function(t){var e=t.length;if(e<=M)return String.fromCharCode.apply(String,t);for(var r="",i=0;ir&&(t+=" ... "),""},s.prototype.compare=function(t,e,r,i,n){if(F(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;for(var a=(n>>>=0)-(i>>>=0),o=(r>>>=0)-(e>>>=0),h=Math.min(a,o),l=this.slice(i,n),f=t.slice(e,r),u=0;u>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}var n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return _(this,t,e,r);case"utf8":case"utf-8":return y(this,t,e,r);case"ascii":return w(this,t,e,r);case"latin1":case"binary":return v(this,t,e,r);case"base64":return x(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var M=4096;function A(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;nn)&&(r=n);for(var a="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function P(t,e,r,i,n,a){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}function O(t,e,r,i,n,a){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(t,e,r,i,a){return e=+e,r>>>=0,a||O(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function C(t,e,r,i,a){return e=+e,r>>>=0,a||O(t,0,r,8),n.write(t,e,r,i,52,8),r+8}s.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||R(t,e,this.length);for(var i=this[t],n=1,a=0;++a>>=0,e>>>=0,r||R(t,e,this.length);for(var i=this[t+--e],n=1;e>0&&(n*=256);)i+=this[t+--e]*n;return i},s.prototype.readUInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);for(var i=this[t],n=1,a=0;++a=(n*=128)&&(i-=Math.pow(2,8*e)),i},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||R(t,e,this.length);for(var i=e,n=1,a=this[t+--i];i>0&&(n*=256);)a+=this[t+--i]*n;return a>=(n*=128)&&(a-=Math.pow(2,8*e)),a},s.prototype.readInt8=function(t,e){return t>>>=0,e||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||R(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){t>>>=0,e||R(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return t>>>=0,e||R(t,4,this.length),n.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||R(t,4,this.length),n.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||R(t,8,this.length),n.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||R(t,8,this.length),n.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,i){t=+t,e>>>=0,r>>>=0,i||P(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,a=0;for(this[e]=255&t;++a>>=0,r>>>=0,i||P(this,t,e,r,Math.pow(2,8*r)-1,0);var n=r-1,a=1;for(this[e+n]=255&t;--n>=0&&(a*=256);)this[e+n]=t/a&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);P(this,t,e,r,n-1,-n)}var a=0,o=1,s=0;for(this[e]=255&t;++a>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);P(this,t,e,r,n-1,-n)}var a=r-1,o=1,s=0;for(this[e+a]=255&t;--a>=0&&(o*=256);)t<0&&0===s&&0!==this[e+a+1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeFloatLE=function(t,e,r){return L(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return L(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return C(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return C(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,i){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e=0;--a)t[a+e]=this[a+r];else Uint8Array.prototype.set.call(t,this.subarray(r,i),e);return n},s.prototype.fill=function(t,e,r,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!s.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===t.length){var n=t.charCodeAt(0);("utf8"===i&&n<128||"latin1"===i)&&(t=n)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(a=e;a55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(o+1===i){(e-=3)>-1&&a.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&a.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&a.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function D(t){return i.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(U,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function N(t,e,r,i){for(var n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function F(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function j(t){return t!=t}},4181:(t,e)=>{e.read=function(t,e,r,i,n){var a,o,s=8*n-i-1,h=(1<>1,f=-7,u=r?n-1:0,c=r?-1:1,d=t[e+u];for(u+=c,a=d&(1<<-f)-1,d>>=-f,f+=s;f>0;a=256*a+t[e+u],u+=c,f-=8);for(o=a&(1<<-f)-1,a>>=-f,f+=i;f>0;o=256*o+t[e+u],u+=c,f-=8);if(0===a)a=1-l;else{if(a===h)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,i),a-=l}return(d?-1:1)*o*Math.pow(2,a-i)},e.write=function(t,e,r,i,n,a){var o,s,h,l=8*a-n-1,f=(1<>1,c=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:a-1,p=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-o))<1&&(o--,h*=2),(e+=o+u>=1?c/h:c*Math.pow(2,1-u))*h>=2&&(o++,h/=2),o+u>=f?(s=0,o=f):o+u>=1?(s=(e*h-1)*Math.pow(2,n),o+=u):(s=e*Math.pow(2,u-1)*Math.pow(2,n),o=0));n>=8;t[r+d]=255&s,d+=p,s/=256,n-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,l-=8);t[r+d-p]|=128*m}},2699:t=>{"use strict";var e,r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};e=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var n=Number.isNaN||function(t){return t!=t};function a(){a.init.call(this)}t.exports=a,t.exports.once=function(t,e){return new Promise((function(r,i){function n(r){t.removeListener(e,a),i(r)}function a(){"function"==typeof t.removeListener&&t.removeListener("error",n),r([].slice.call(arguments))}m(t,e,a,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&m(t,"error",e,{once:!0})}(t,n)}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var o=10;function s(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function h(t){return void 0===t._maxListeners?a.defaultMaxListeners:t._maxListeners}function l(t,e,r,i){var n,a,o,l;if(s(r),void 0===(a=t._events)?(a=t._events=Object.create(null),t._eventsCount=0):(void 0!==a.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),a=t._events),o=a[e]),void 0===o)o=a[e]=r,++t._eventsCount;else if("function"==typeof o?o=a[e]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=h(t))>0&&o.length>n&&!o.warned){o.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=t,f.type=e,f.count=o.length,l=f,console&&console.warn&&console.warn(l)}return t}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=f.bind(i);return n.listener=r,i.wrapFn=n,n}function c(t,e,r){var i=t._events;if(void 0===i)return[];var n=i[e];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(t){for(var e=new Array(t.length),r=0;r0&&(o=e[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var h=a[t];if(void 0===h)return!1;if("function"==typeof h)i(h,this,e);else{var l=h.length,f=p(h,l);for(r=0;r=0;a--)if(r[a]===e||r[a].listener===e){o=r[a].listener,n=a;break}if(n<0)return this;0===n?r.shift():function(t,e){for(;e+1=0;i--)this.removeListener(t,e[i]);return this},a.prototype.listeners=function(t){return c(this,t,!0)},a.prototype.rawListeners=function(t){return c(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):d.call(t,e)},a.prototype.listenerCount=d,a.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},6551:(t,e,r)=>{var i=r(453);t.exports={create:function(t,e){if(t instanceof(e=e||(0,eval)("this")).ArrayBuffer){var n=r(909);return new i(new n(t,0,t.byteLength,!0,e))}var a=r(3684);return new i(new a(t,0,t.length,!0))}}},3684:t=>{function e(t,e,r,i){this.buffer=t,this.offset=e||0,r="number"==typeof r?r:t.length,this.endPosition=this.offset+r,this.setBigEndian(i)}e.prototype={setBigEndian:function(t){this.bigEndian=!!t},nextUInt8:function(){var t=this.buffer.readUInt8(this.offset);return this.offset+=1,t},nextInt8:function(){var t=this.buffer.readInt8(this.offset);return this.offset+=1,t},nextUInt16:function(){var t=this.bigEndian?this.buffer.readUInt16BE(this.offset):this.buffer.readUInt16LE(this.offset);return this.offset+=2,t},nextUInt32:function(){var t=this.bigEndian?this.buffer.readUInt32BE(this.offset):this.buffer.readUInt32LE(this.offset);return this.offset+=4,t},nextInt16:function(){var t=this.bigEndian?this.buffer.readInt16BE(this.offset):this.buffer.readInt16LE(this.offset);return this.offset+=2,t},nextInt32:function(){var t=this.bigEndian?this.buffer.readInt32BE(this.offset):this.buffer.readInt32LE(this.offset);return this.offset+=4,t},nextFloat:function(){var t=this.bigEndian?this.buffer.readFloatBE(this.offset):this.buffer.readFloatLE(this.offset);return this.offset+=4,t},nextDouble:function(){var t=this.bigEndian?this.buffer.readDoubleBE(this.offset):this.buffer.readDoubleLE(this.offset);return this.offset+=8,t},nextBuffer:function(t){var e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e},remainingLength:function(){return this.endPosition-this.offset},nextString:function(t){var e=this.buffer.toString("utf8",this.offset,this.offset+t);return this.offset+=t,e},mark:function(){var t=this;return{openWithOffset:function(r){return r=(r||0)+this.offset,new e(t.buffer,r,t.endPosition-r,t.bigEndian)},offset:this.offset}},offsetFrom:function(t){return this.offset-t.offset},skip:function(t){this.offset+=t},branch:function(t,r){return r="number"==typeof r?r:this.endPosition-(this.offset+t),new e(this.buffer,this.offset+t,r,this.bigEndian)}},t.exports=e},565:t=>{function e(t){return parseInt(t,10)}var r=3600,i=60;function n(t,r){t=t.map(e),r=r.map(e);var i=t[0],n=t[1]-1,a=t[2],o=r[0],s=r[1],h=r[2];return Date.UTC(i,n,a,o,s,h,0)/1e3}function a(t){var a=t.substr(0,10).split("-"),o=t.substr(11,8).split(":"),s=t.substr(19,6).split(":").map(e),h=s[0]*r+s[1]*i,l=n(a,o);if("number"==typeof(l-=h)&&!isNaN(l))return l}function o(t){var e=t.split(" "),r=n(e[0].split(":"),e[1].split(":"));if("number"==typeof r&&!isNaN(r))return r}t.exports={parseDateWithSpecFormat:o,parseDateWithTimezoneFormat:a,parseExifDate:function(t){var e=19===t.length&&":"===t.charAt(4);return 25===t.length&&"T"===t.charAt(10)?a(t):e?o(t):void 0}}},909:t=>{function e(t,e,r,i,n,a){this.global=n,e=e||0,r=r||t.byteLength-e,this.arrayBuffer=t.slice(e,e+r),this.view=new n.DataView(this.arrayBuffer,0,this.arrayBuffer.byteLength),this.setBigEndian(i),this.offset=0,this.parentOffset=(a||0)+e}e.prototype={setBigEndian:function(t){this.littleEndian=!t},nextUInt8:function(){var t=this.view.getUint8(this.offset);return this.offset+=1,t},nextInt8:function(){var t=this.view.getInt8(this.offset);return this.offset+=1,t},nextUInt16:function(){var t=this.view.getUint16(this.offset,this.littleEndian);return this.offset+=2,t},nextUInt32:function(){var t=this.view.getUint32(this.offset,this.littleEndian);return this.offset+=4,t},nextInt16:function(){var t=this.view.getInt16(this.offset,this.littleEndian);return this.offset+=2,t},nextInt32:function(){var t=this.view.getInt32(this.offset,this.littleEndian);return this.offset+=4,t},nextFloat:function(){var t=this.view.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t},nextDouble:function(){var t=this.view.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t},nextBuffer:function(t){var e=this.arrayBuffer.slice(this.offset,this.offset+t);return this.offset+=t,e},remainingLength:function(){return this.arrayBuffer.byteLength-this.offset},nextString:function(t){var e=this.arrayBuffer.slice(this.offset,this.offset+t);return e=String.fromCharCode.apply(null,new this.global.Uint8Array(e)),this.offset+=t,e},mark:function(){var t=this;return{openWithOffset:function(r){return r=(r||0)+this.offset,new e(t.arrayBuffer,r,t.arrayBuffer.byteLength-r,!t.littleEndian,t.global,t.parentOffset)},offset:this.offset,getParentOffset:function(){return t.parentOffset}}},offsetFrom:function(t){return this.parentOffset+this.offset-(t.offset+t.getParentOffset())},skip:function(t){this.offset+=t},branch:function(t,r){return r="number"==typeof r?r:this.arrayBuffer.byteLength-(this.offset+t),new e(this.arrayBuffer,this.offset+t,r,!this.littleEndian,this.global,this.parentOffset)}},t.exports=e},3332:t=>{t.exports={exif:{1:"InteropIndex",2:"InteropVersion",11:"ProcessingSoftware",254:"SubfileType",255:"OldSubfileType",256:"ImageWidth",257:"ImageHeight",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",263:"Thresholding",264:"CellWidth",265:"CellLength",266:"FillOrder",269:"DocumentName",270:"ImageDescription",271:"Make",272:"Model",273:"StripOffsets",274:"Orientation",277:"SamplesPerPixel",278:"RowsPerStrip",279:"StripByteCounts",280:"MinSampleValue",281:"MaxSampleValue",282:"XResolution",283:"YResolution",284:"PlanarConfiguration",285:"PageName",286:"XPosition",287:"YPosition",288:"FreeOffsets",289:"FreeByteCounts",290:"GrayResponseUnit",291:"GrayResponseCurve",292:"T4Options",293:"T6Options",296:"ResolutionUnit",297:"PageNumber",300:"ColorResponseUnit",301:"TransferFunction",305:"Software",306:"ModifyDate",315:"Artist",316:"HostComputer",317:"Predictor",318:"WhitePoint",319:"PrimaryChromaticities",320:"ColorMap",321:"HalftoneHints",322:"TileWidth",323:"TileLength",324:"TileOffsets",325:"TileByteCounts",326:"BadFaxLines",327:"CleanFaxData",328:"ConsecutiveBadFaxLines",330:"SubIFD",332:"InkSet",333:"InkNames",334:"NumberofInks",336:"DotRange",337:"TargetPrinter",338:"ExtraSamples",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",342:"TransferRange",343:"ClipPath",344:"XClipPathUnits",345:"YClipPathUnits",346:"Indexed",347:"JPEGTables",351:"OPIProxy",400:"GlobalParametersIFD",401:"ProfileType",402:"FaxProfile",403:"CodingMethods",404:"VersionYear",405:"ModeNumber",433:"Decode",434:"DefaultImageColor",435:"T82Options",437:"JPEGTables",512:"JPEGProc",513:"ThumbnailOffset",514:"ThumbnailLength",515:"JPEGRestartInterval",517:"JPEGLosslessPredictors",518:"JPEGPointTransforms",519:"JPEGQTables",520:"JPEGDCTables",521:"JPEGACTables",529:"YCbCrCoefficients",530:"YCbCrSubSampling",531:"YCbCrPositioning",532:"ReferenceBlackWhite",559:"StripRowCounts",700:"ApplicationNotes",999:"USPTOMiscellaneous",4096:"RelatedImageFileFormat",4097:"RelatedImageWidth",4098:"RelatedImageHeight",18246:"Rating",18247:"XP_DIP_XML",18248:"StitchInfo",18249:"RatingPercent",32781:"ImageID",32931:"WangTag1",32932:"WangAnnotation",32933:"WangTag3",32934:"WangTag4",32995:"Matteing",32996:"DataType",32997:"ImageDepth",32998:"TileDepth",33405:"Model2",33421:"CFARepeatPatternDim",33422:"CFAPattern2",33423:"BatteryLevel",33424:"KodakIFD",33432:"Copyright",33434:"ExposureTime",33437:"FNumber",33445:"MDFileTag",33446:"MDScalePixel",33447:"MDColorTable",33448:"MDLabName",33449:"MDSampleInfo",33450:"MDPrepDate",33451:"MDPrepTime",33452:"MDFileUnits",33550:"PixelScale",33589:"AdventScale",33590:"AdventRevision",33628:"UIC1Tag",33629:"UIC2Tag",33630:"UIC3Tag",33631:"UIC4Tag",33723:"IPTC-NAA",33918:"IntergraphPacketData",33919:"IntergraphFlagRegisters",33920:"IntergraphMatrix",33921:"INGRReserved",33922:"ModelTiePoint",34016:"Site",34017:"ColorSequence",34018:"IT8Header",34019:"RasterPadding",34020:"BitsPerRunLength",34021:"BitsPerExtendedRunLength",34022:"ColorTable",34023:"ImageColorIndicator",34024:"BackgroundColorIndicator",34025:"ImageColorValue",34026:"BackgroundColorValue",34027:"PixelIntensityRange",34028:"TransparencyIndicator",34029:"ColorCharacterization",34030:"HCUsage",34031:"TrapIndicator",34032:"CMYKEquivalent",34118:"SEMInfo",34152:"AFCP_IPTC",34232:"PixelMagicJBIGOptions",34264:"ModelTransform",34306:"WB_GRGBLevels",34310:"LeafData",34377:"PhotoshopSettings",34665:"ExifOffset",34675:"ICC_Profile",34687:"TIFF_FXExtensions",34688:"MultiProfiles",34689:"SharedData",34690:"T88Options",34732:"ImageLayer",34735:"GeoTiffDirectory",34736:"GeoTiffDoubleParams",34737:"GeoTiffAsciiParams",34850:"ExposureProgram",34852:"SpectralSensitivity",34853:"GPSInfo",34855:"ISO",34856:"Opto-ElectricConvFactor",34857:"Interlace",34858:"TimeZoneOffset",34859:"SelfTimerMode",34864:"SensitivityType",34865:"StandardOutputSensitivity",34866:"RecommendedExposureIndex",34867:"ISOSpeed",34868:"ISOSpeedLatitudeyyy",34869:"ISOSpeedLatitudezzz",34908:"FaxRecvParams",34909:"FaxSubAddress",34910:"FaxRecvTime",34954:"LeafSubIFD",36864:"ExifVersion",36867:"DateTimeOriginal",36868:"CreateDate",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureCompensation",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37386:"FocalLength",37387:"FlashEnergy",37388:"SpatialFrequencyResponse",37389:"Noise",37390:"FocalPlaneXResolution",37391:"FocalPlaneYResolution",37392:"FocalPlaneResolutionUnit",37393:"ImageNumber",37394:"SecurityClassification",37395:"ImageHistory",37396:"SubjectArea",37397:"ExposureIndex",37398:"TIFF-EPStandardID",37399:"SensingMethod",37434:"CIP3DataFile",37435:"CIP3Sheet",37436:"CIP3Side",37439:"StoNits",37500:"MakerNote",37510:"UserComment",37520:"SubSecTime",37521:"SubSecTimeOriginal",37522:"SubSecTimeDigitized",37679:"MSDocumentText",37680:"MSPropertySetStorage",37681:"MSDocumentTextPosition",37724:"ImageSourceData",40091:"XPTitle",40092:"XPComment",40093:"XPAuthor",40094:"XPKeywords",40095:"XPSubject",40960:"FlashpixVersion",40961:"ColorSpace",40962:"ExifImageWidth",40963:"ExifImageHeight",40964:"RelatedSoundFile",40965:"InteropOffset",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41485:"Noise",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41489:"ImageNumber",41490:"SecurityClassification",41491:"ImageHistory",41492:"SubjectLocation",41493:"ExposureIndex",41494:"TIFF-EPStandardID",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRatio",41989:"FocalLengthIn35mmFormat",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",42016:"ImageUniqueID",42032:"OwnerName",42033:"SerialNumber",42034:"LensInfo",42035:"LensMake",42036:"LensModel",42037:"LensSerialNumber",42112:"GDALMetadata",42113:"GDALNoData",42240:"Gamma",44992:"ExpandSoftware",44993:"ExpandLens",44994:"ExpandFilm",44995:"ExpandFilterLens",44996:"ExpandScanner",44997:"ExpandFlashLamp",48129:"PixelFormat",48130:"Transformation",48131:"Uncompressed",48132:"ImageType",48256:"ImageWidth",48257:"ImageHeight",48258:"WidthResolution",48259:"HeightResolution",48320:"ImageOffset",48321:"ImageByteCount",48322:"AlphaOffset",48323:"AlphaByteCount",48324:"ImageDataDiscard",48325:"AlphaDataDiscard",50215:"OceScanjobDesc",50216:"OceApplicationSelector",50217:"OceIDNumber",50218:"OceImageLogic",50255:"Annotations",50341:"PrintIM",50560:"USPTOOriginalContentType",50706:"DNGVersion",50707:"DNGBackwardVersion",50708:"UniqueCameraModel",50709:"LocalizedCameraModel",50710:"CFAPlaneColor",50711:"CFALayout",50712:"LinearizationTable",50713:"BlackLevelRepeatDim",50714:"BlackLevel",50715:"BlackLevelDeltaH",50716:"BlackLevelDeltaV",50717:"WhiteLevel",50718:"DefaultScale",50719:"DefaultCropOrigin",50720:"DefaultCropSize",50721:"ColorMatrix1",50722:"ColorMatrix2",50723:"CameraCalibration1",50724:"CameraCalibration2",50725:"ReductionMatrix1",50726:"ReductionMatrix2",50727:"AnalogBalance",50728:"AsShotNeutral",50729:"AsShotWhiteXY",50730:"BaselineExposure",50731:"BaselineNoise",50732:"BaselineSharpness",50733:"BayerGreenSplit",50734:"LinearResponseLimit",50735:"CameraSerialNumber",50736:"DNGLensInfo",50737:"ChromaBlurRadius",50738:"AntiAliasStrength",50739:"ShadowScale",50740:"DNGPrivateData",50741:"MakerNoteSafety",50752:"RawImageSegmentation",50778:"CalibrationIlluminant1",50779:"CalibrationIlluminant2",50780:"BestQualityScale",50781:"RawDataUniqueID",50784:"AliasLayerMetadata",50827:"OriginalRawFileName",50828:"OriginalRawFileData",50829:"ActiveArea",50830:"MaskedAreas",50831:"AsShotICCProfile",50832:"AsShotPreProfileMatrix",50833:"CurrentICCProfile",50834:"CurrentPreProfileMatrix",50879:"ColorimetricReference",50898:"PanasonicTitle",50899:"PanasonicTitle2",50931:"CameraCalibrationSig",50932:"ProfileCalibrationSig",50933:"ProfileIFD",50934:"AsShotProfileName",50935:"NoiseReductionApplied",50936:"ProfileName",50937:"ProfileHueSatMapDims",50938:"ProfileHueSatMapData1",50939:"ProfileHueSatMapData2",50940:"ProfileToneCurve",50941:"ProfileEmbedPolicy",50942:"ProfileCopyright",50964:"ForwardMatrix1",50965:"ForwardMatrix2",50966:"PreviewApplicationName",50967:"PreviewApplicationVersion",50968:"PreviewSettingsName",50969:"PreviewSettingsDigest",50970:"PreviewColorSpace",50971:"PreviewDateTime",50972:"RawImageDigest",50973:"OriginalRawFileDigest",50974:"SubTileBlockSize",50975:"RowInterleaveFactor",50981:"ProfileLookTableDims",50982:"ProfileLookTableData",51008:"OpcodeList1",51009:"OpcodeList2",51022:"OpcodeList3",51041:"NoiseProfile",51043:"TimeCodes",51044:"FrameRate",51058:"TStop",51081:"ReelName",51089:"OriginalDefaultFinalSize",51090:"OriginalBestQualitySize",51091:"OriginalDefaultCropSize",51105:"CameraLabel",51107:"ProfileHueSatMapEncoding",51108:"ProfileLookTableEncoding",51109:"BaselineExposureOffset",51110:"DefaultBlackRender",51111:"NewRawImageDigest",51112:"RawToPreviewGain",51125:"DefaultUserCrop",59932:"Padding",59933:"OffsetSchema",65e3:"OwnerName",65001:"SerialNumber",65002:"Lens",65024:"KDC_IFD",65100:"RawFile",65101:"Converter",65102:"WhiteBalance",65105:"Exposure",65106:"Shadows",65107:"Brightness",65108:"Contrast",65109:"Saturation",65110:"Sharpness",65111:"Smoothness",65112:"MoireFilter"},gps:{0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential",31:"GPSHPositioningError"}}},592:t=>{function e(t,e){switch(t){case 1:return e.nextUInt8();case 3:case 8:return e.nextUInt16();case 4:case 9:return e.nextUInt32();case 5:return[e.nextUInt32(),e.nextUInt32()];case 6:return e.nextInt8();case 10:return[e.nextInt32(),e.nextInt32()];case 11:return e.nextFloat();case 12:return e.nextDouble();default:throw new Error("Invalid format while decoding: "+t)}}function r(t,r){var i,n,a=r.nextUInt16(),o=r.nextUInt16(),s=function(t){switch(t){case 1:case 2:case 6:case 7:return 1;case 3:case 8:return 2;case 4:case 9:case 11:return 4;case 5:case 10:case 12:return 8;default:return 0}}(o),h=r.nextUInt32(),l=s*h;if(l>4&&(r=t.openWithOffset(r.nextUInt32())),2===o){var f=(i=r.nextString(h)).indexOf("\0");-1!==f&&(i=i.substr(0,f))}else if(7===o)i=r.nextBuffer(h);else if(0!==o)for(i=[],n=0;n{t.exports={parseSections:function(t,e){var r,i;for(t.setBigEndian(!0);t.remainingLength()>0&&218!==i;){if(255!==t.nextUInt8())throw new Error("Invalid JPEG section offset");r=(i=t.nextUInt8())>=208&&i<=217||218===i?0:t.nextUInt16()-2,e(i,t.branch(0,r)),t.skip(r)}},getSizeFromSOFSection:function(t){return t.skip(1),{height:t.nextUInt16(),width:t.nextUInt16()}},getSectionName:function(t){var e,r;switch(t){case 216:e="SOI";break;case 196:e="DHT";break;case 219:e="DQT";break;case 221:e="DRI";break;case 218:e="SOS";break;case 254:e="COM";break;case 217:e="EOI";break;default:t>=224&&t<=239?(e="APP",r=t-224):t>=192&&t<=207&&196!==t&&200!==t&&204!==t?(e="SOF",r=t-192):t>=208&&t<=215&&(e="RST",r=t-208)}var i={name:e};return"number"==typeof r&&(i.index=r),i}}},453:(t,e,r)=>{var i=r(656),n=r(592),a=r(3814);function o(t,e,r,i,n,a,o){this.startMarker=t,this.tags=e,this.imageSize=r,this.thumbnailOffset=i,this.thumbnailLength=n,this.thumbnailType=a,this.app1Offset=o}function s(t){this.stream=t,this.flags={readBinaryTags:!1,resolveTagNames:!0,simplifyValues:!0,imageSize:!0,hidePointers:!0,returnTags:!0}}o.prototype={hasThumbnail:function(t){return!(!this.thumbnailOffset||!this.thumbnailLength||"string"==typeof t&&("image/jpeg"===t.toLowerCase().trim()?6!==this.thumbnailType:"image/tiff"!==t.toLowerCase().trim()||1!==this.thumbnailType))},getThumbnailOffset:function(){return this.app1Offset+6+this.thumbnailOffset},getThumbnailLength:function(){return this.thumbnailLength},getThumbnailBuffer:function(){return this._getThumbnailStream().nextBuffer(this.thumbnailLength)},_getThumbnailStream:function(){return this.startMarker.openWithOffset(this.getThumbnailOffset())},getImageSize:function(){return this.imageSize},getThumbnailSize:function(){var t,e=this._getThumbnailStream();return i.parseSections(e,(function(e,r){"SOF"===i.getSectionName(e).name&&(t=i.getSizeFromSOFSection(r))})),t}},s.prototype={enableBinaryFields:function(t){return this.flags.readBinaryTags=!!t,this},enablePointers:function(t){return this.flags.hidePointers=!t,this},enableTagNames:function(t){return this.flags.resolveTagNames=!!t,this},enableImageSize:function(t){return this.flags.imageSize=!!t,this},enableReturnTags:function(t){return this.flags.returnTags=!!t,this},enableSimpleValues:function(t){return this.flags.simplifyValues=!!t,this},parse:function(){var t,e,s,h,l,f,u,c,d,p=this.stream.mark(),m=p.openWithOffset(0),g=this.flags;return g.resolveTagNames&&(u=r(3332)),g.resolveTagNames?(t={},c=function(e){return t[e.name]},d=function(e,r){t[e.name]=r}):(t=[],c=function(e){var r;for(r=0;r{var i=r(592),n=r(565),a=[{section:i.GPSIFD,type:2,name:"GPSLatitude",refType:1,refName:"GPSLatitudeRef",posVal:"N"},{section:i.GPSIFD,type:4,name:"GPSLongitude",refType:3,refName:"GPSLongitudeRef",posVal:"E"}],o=[{section:i.SubIFD,type:306,name:"ModifyDate"},{section:i.SubIFD,type:36867,name:"DateTimeOriginal"},{section:i.SubIFD,type:36868,name:"CreateDate"},{section:i.SubIFD,type:306,name:"ModifyDate"}];t.exports={castDegreeValues:function(t,e){a.forEach((function(r){var i=t(r);if(i){var n=t({section:r.section,type:r.refType,name:r.refName})===r.posVal?1:-1,a=(i[0]+i[1]/60+i[2]/3600)*n;e(r,a)}}))},castDateValues:function(t,e){o.forEach((function(r){var i=t(r);if(i){var a=n.parseExifDate(i);void 0!==a&&e(r,a)}}))},simplifyValue:function(t,e){return Array.isArray(t)&&1===(t=t.map((function(t){return 10===e||5===e?t[0]/t[1]:t}))).length&&(t=t[0]),t}}},8789:(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";var Buffer=__webpack_require__(8834).lW;const Token=__webpack_require__(5010),strtok3=__webpack_require__(7378),{stringToBytes,tarHeaderChecksumMatches,uint32SyncSafeToken}=__webpack_require__(7044),supported=__webpack_require__(4078),minimumBytes=4100;async function fromStream(t){const e=await strtok3.fromStream(t);try{return await fromTokenizer(e)}finally{await e.close()}}async function fromBuffer(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer||Buffer.isBuffer(t)))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`Buffer\` or \`ArrayBuffer\`, got \`${typeof t}\``);const e=t instanceof Buffer?t:Buffer.from(t);if(e&&e.length>1)return fromTokenizer(strtok3.fromBuffer(e))}function _check(t,e,r){r={offset:0,...r};for(const[i,n]of e.entries())if(r.mask){if(n!==(r.mask[i]&t[i+r.offset]))return!1}else if(n!==t[i+r.offset])return!1;return!0}async function fromTokenizer(t){try{return _fromTokenizer(t)}catch(t){if(!(t instanceof strtok3.EndOfStreamError))throw t}}async function _fromTokenizer(t){let e=Buffer.alloc(minimumBytes);const r=(t,r)=>_check(e,t,r),i=(t,e)=>r(stringToBytes(t),e);if(t.fileInfo.size||(t.fileInfo.size=Number.MAX_SAFE_INTEGER),await t.peekBuffer(e,{length:12,mayBeLess:!0}),r([66,77]))return{ext:"bmp",mime:"image/bmp"};if(r([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(r([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(r([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(r([37,33]))return await t.peekBuffer(e,{length:24,mayBeLess:!0}),i("PS-Adobe-",{offset:2})&&i(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(r([31,160])||r([31,157]))return{ext:"Z",mime:"application/x-compress"};if(r([255,216,255]))return{ext:"jpg",mime:"image/jpeg"};if(r([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(r([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(r([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(i("ID3")){await t.ignore(6);const n=await t.readToken(uint32SyncSafeToken);return t.position+n>t.fileInfo.size?{ext:"mp3",mime:"audio/mpeg"}:(await t.ignore(n),fromTokenizer(t))}if(i("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((67===e[0]||70===e[0])&&r([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(r([71,73,70]))return{ext:"gif",mime:"image/gif"};if(i("FLIF"))return{ext:"flif",mime:"image/flif"};if(i("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(i("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(i("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(i("FORM"))return{ext:"aif",mime:"audio/aiff"};if(i("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(r([80,75,3,4])){try{for(;t.position+30=0?o:e.length)}else await t.ignore(a.compressedSize)}}catch(s){if(!(s instanceof strtok3.EndOfStreamError))throw s}return{ext:"zip",mime:"application/zip"}}if(i("OggS")){await t.ignore(28);const h=Buffer.alloc(8);return await t.readBuffer(h),_check(h,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/opus"}:_check(h,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:_check(h,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:_check(h,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:_check(h,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:_check(h,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(r([80,75])&&(3===e[2]||5===e[2]||7===e[2])&&(4===e[3]||6===e[3]||8===e[3]))return{ext:"zip",mime:"application/zip"};if(i("ftyp",{offset:4})&&0!=(96&e[8])){const l=e.toString("binary",8,12).replace("\0"," ").trim();switch(l){case"avif":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return l.startsWith("3g")?l.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(i("MThd"))return{ext:"mid",mime:"audio/midi"};if(i("wOFF")&&(r([0,1,0,0],{offset:4})||i("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(i("wOF2")&&(r([0,1,0,0],{offset:4})||i("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(r([212,195,178,161])||r([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(i("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(i("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(i("fLaC"))return{ext:"flac",mime:"audio/x-flac"};if(r([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(i("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(i("%PDF")){await t.ignore(1350);const f=10485760,u=Buffer.alloc(Math.min(f,t.fileInfo.size));return await t.readBuffer(u,{mayBeLess:!0}),u.includes(Buffer.from("AIPrivateData"))?{ext:"ai",mime:"application/postscript"}:{ext:"pdf",mime:"application/pdf"}}if(r([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(r([73,73,42,0]))return i("CR",{offset:8})?{ext:"cr2",mime:"image/x-canon-cr2"}:r([28,0,254,0],{offset:8})||r([31,0,11,0],{offset:8})?{ext:"nef",mime:"image/x-nikon-nef"}:r([8,0,0,0],{offset:4})&&(r([45,0,254,0],{offset:8})||r([39,0,254,0],{offset:8}))?{ext:"dng",mime:"image/x-adobe-dng"}:(e=Buffer.alloc(24),await t.peekBuffer(e),(r([16,251,134,1],{offset:4})||r([8,0,0,0],{offset:4}))&&r([0,254,0,4,0,1,0,0,0,1,0,0,0,3,1],{offset:9})?{ext:"arw",mime:"image/x-sony-arw"}:{ext:"tif",mime:"image/tiff"});if(r([77,77,0,42]))return{ext:"tif",mime:"image/tiff"};if(i("MAC "))return{ext:"ape",mime:"audio/ape"};if(r([26,69,223,163])){async function c(){const e=await t.peekNumber(Token.UINT8);let r=128,i=0;for(;0==(e&r)&&0!==r;)++i,r>>=1;const n=Buffer.alloc(i+1);return await t.readBuffer(n),n}async function d(){const t=await c(),e=await c();e[0]^=128>>e.length-1;const r=Math.min(6,e.length);return{id:t.readUIntBE(0,t.length),len:e.readUIntBE(e.length-r,r)}}async function p(e,r){for(;r>0;){const e=await d();if(17026===e.id)return t.readToken(new Token.StringType(e.len,"utf-8"));await t.ignore(e.len),--r}}const m=await d();switch(await p(0,m.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/x-matroska"};default:return}}if(r([82,73,70,70])){if(r([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(r([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/vnd.wave"};if(r([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(i("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(r([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(i("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(i("MSCF")||i("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(r([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(r([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(r([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(r([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(i("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(i("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(r([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(i("IMPM"))return{ext:"it",mime:"audio/x-it"};if(i("-lh0-",{offset:2})||i("-lh1-",{offset:2})||i("-lh2-",{offset:2})||i("-lh3-",{offset:2})||i("-lh4-",{offset:2})||i("-lh5-",{offset:2})||i("-lh6-",{offset:2})||i("-lh7-",{offset:2})||i("-lzs-",{offset:2})||i("-lz4-",{offset:2})||i("-lz5-",{offset:2})||i("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(r([0,0,1,186])){if(r([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(r([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(i("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(r([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(i(""))return await t.ignore(8),"debian-binary"===await t.readToken(new Token.StringType(13,"ascii"))?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(r([137,80,78,71,13,10,26,10])){async function g(){return{length:await t.readToken(Token.INT32_BE),type:await t.readToken(new Token.StringType(4,"binary"))}}await t.ignore(8);do{const b=await g();if(b.length<0)return;switch(b.type){case"IDAT":return{ext:"png",mime:"image/png"};case"acTL":return{ext:"apng",mime:"image/apng"};default:await t.ignore(b.length+4)}}while(t.position+8=16){const x=e.readUInt32LE(12);if(x>12&&e.length>=x+16)try{const E=e.slice(16,x+16).toString();if(JSON.parse(E).files)return{ext:"asar",mime:"application/x-asar"}}catch(k){}}if(r([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(i("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(r([71],{offset:4})&&(r([71],{offset:192})||r([71],{offset:196})))return{ext:"mts",mime:"video/mp2t"};if(r([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(r([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(r([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(r([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(r([76,80],{offset:34})&&(r([0,0,1],{offset:8})||r([1,0,2],{offset:8})||r([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(r([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(await t.peekBuffer(e,{length:Math.min(512,t.fileInfo.size),mayBeLess:!0}),tarHeaderChecksumMatches(e))return{ext:"tar",mime:"application/x-tar"};if(r([255,254,255,14,83,0,107,0,101,0,116,0,99,0,104,0,85,0,112,0,32,0,77,0,111,0,100,0,101,0,108,0]))return{ext:"skp",mime:"application/vnd.sketchup.skp"};if(i("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"};if(e.length>=2&&r([255,224],{offset:0,mask:[255,224]})){if(r([16],{offset:1,mask:[22]}))return r([8],{offset:1,mask:[8]}),{ext:"aac",mime:"audio/aac"};if(r([2],{offset:1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(r([4],{offset:1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(r([6],{offset:1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}const stream=readableStream=>new Promise(((resolve,reject)=>{const stream=eval("require")("stream");readableStream.on("error",reject),readableStream.once("readable",(async()=>{const t=new stream.PassThrough;let e;e=stream.pipeline?stream.pipeline(readableStream,t,(()=>{})):readableStream.pipe(t);const r=readableStream.read(minimumBytes)||readableStream.read()||Buffer.alloc(0);try{const e=await fromBuffer(r);t.fileType=e}catch(t){reject(t)}resolve(e)}))})),fileType={fromStream,fromTokenizer,fromBuffer,stream};Object.defineProperty(fileType,"extensions",{get:()=>new Set(supported.extensions)}),Object.defineProperty(fileType,"mimeTypes",{get:()=>new Set(supported.mimeTypes)}),module.exports=fileType},5025:(t,e,r)=>{"use strict";const i=r(3569),n=r(8789),a={fromFile:async function(t){const e=await i.fromFile(t);try{return await n.fromTokenizer(e)}finally{await e.close()}}};Object.assign(a,n),Object.defineProperty(a,"extensions",{get:()=>n.extensions}),Object.defineProperty(a,"mimeTypes",{get:()=>n.mimeTypes}),t.exports=a},4078:t=>{"use strict";t.exports={extensions:["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","ai","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf"],mimeTypes:["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/x-apache-arrow","video/mp4","audio/midi","video/x-matroska","video/webm","video/quicktime","video/vnd.avi","audio/vnd.wave","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","audio/opus","video/ogg","audio/ogg","application/ogg","audio/x-flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd"]}},7044:(t,e)=>{"use strict";e.stringToBytes=t=>[...t].map((t=>t.charCodeAt(0))),e.tarHeaderChecksumMatches=(t,e=0)=>{const r=parseInt(t.toString("utf8",148,154).replace(/\0.*$/,"").trim(),8);if(isNaN(r))return!1;let i=256;for(let r=e;r127&t[e+3]|t[e+2]<<7|t[e+1]<<14|t[e]<<21,len:4}},3243:(t,e,r)=>{"use strict";var i=r(9680),n=Object.prototype.toString,a=Object.prototype.hasOwnProperty,o=function(t,e,r){for(var i=0,n=t.length;i=3&&(a=r),"[object Array]"===n.call(t)?o(t,e,a):"string"==typeof t?s(t,e,a):h(t,e,a)}},2855:(t,e)=>{"use strict";function r(t,e,r,i){for(var n=t[e++],a=1<>=h,f-=h,g!==a){if(g===o)break;for(var b=ga;)y=p[y]>>8,++_;var w=y;if(c+_+(b!==g?1:0)>i)return void console.log("Warning, gif stream longer than expected.");r[c++]=w;var v=c+=_;for(b!==g&&(r[c++]=w),y=b;_--;)y=p[y],r[--v]=255&y,y>>=8;null!==m&&s<4096&&(p[s++]=m<<8|w,s>=l+1&&h<12&&(++h,l=l<<1|1)),m=g}else s=o+1,l=(1<<(h=n+1))-1,m=null}return c!==i&&console.log("Warning, gif stream shorter than expected."),r}try{e.GifWriter=function(t,e,r,i){var n=0,a=void 0===(i=void 0===i?{}:i).loop?null:i.loop,o=void 0===i.palette?null:i.palette;if(e<=0||r<=0||e>65535||r>65535)throw new Error("Width/Height invalid.");function s(t){var e=t.length;if(e<2||e>256||e&e-1)throw new Error("Invalid code/color length, must be power of 2 and 2 .. 256.");return e}t[n++]=71,t[n++]=73,t[n++]=70,t[n++]=56,t[n++]=57,t[n++]=97;var h=0,l=0;if(null!==o){for(var f=s(o);f>>=1;)++h;if(f=1<=f)throw new Error("Background index out of range.");if(0===l)throw new Error("Background index explicitly passed as 0.")}}if(t[n++]=255&e,t[n++]=e>>8&255,t[n++]=255&r,t[n++]=r>>8&255,t[n++]=(null!==o?128:0)|h,t[n++]=l,t[n++]=0,null!==o)for(var u=0,c=o.length;u>16&255,t[n++]=d>>8&255,t[n++]=255&d}if(null!==a){if(a<0||a>65535)throw new Error("Loop count invalid.");t[n++]=33,t[n++]=255,t[n++]=11,t[n++]=78,t[n++]=69,t[n++]=84,t[n++]=83,t[n++]=67,t[n++]=65,t[n++]=80,t[n++]=69,t[n++]=50,t[n++]=46,t[n++]=48,t[n++]=3,t[n++]=1,t[n++]=255&a,t[n++]=a>>8&255,t[n++]=0}var p=!1;this.addFrame=function(e,r,i,a,h,l){if(!0===p&&(--n,p=!1),l=void 0===l?{}:l,e<0||r<0||e>65535||r>65535)throw new Error("x/y invalid.");if(i<=0||a<=0||i>65535||a>65535)throw new Error("Width/Height invalid.");if(h.length>=1;)++d;c=1<3)throw new Error("Disposal out of range.");var b=!1,_=0;if(void 0!==l.transparent&&null!==l.transparent&&(b=!0,(_=l.transparent)<0||_>=c))throw new Error("Transparent color index.");if((0!==g||b||0!==m)&&(t[n++]=33,t[n++]=249,t[n++]=4,t[n++]=g<<2|(!0===b?1:0),t[n++]=255&m,t[n++]=m>>8&255,t[n++]=_,t[n++]=0),t[n++]=44,t[n++]=255&e,t[n++]=e>>8&255,t[n++]=255&r,t[n++]=r>>8&255,t[n++]=255&i,t[n++]=i>>8&255,t[n++]=255&a,t[n++]=a>>8&255,t[n++]=!0===f?128|d-1:0,!0===f)for(var y=0,w=u.length;y>16&255,t[n++]=v>>8&255,t[n++]=255&v}return n=function(t,e,r,i){t[e++]=r;var n=e++,a=1<=r;)t[e++]=255&u,u>>=8,f-=8,e===n+256&&(t[n]=255,n=e++)}function d(t){u|=t<=8;)t[e++]=255&u,u>>=8,f-=8,e===n+256&&(t[n]=255,n=e++);4096===h?(d(a),h=s+1,l=r+1,m={}):(h>=1<>7,s=1<<1+(7&a);t[e++],t[e++];var h=null,l=null;o&&(h=e,l=s,e+=3*s);var f=!0,u=[],c=0,d=null,p=0,m=null;for(this.width=i,this.height=n;f&&e=0))throw Error("Invalid block size");if(0===I)break;e+=I}break;case 249:if(4!==t[e++]||0!==t[e+4])throw new Error("Invalid graphics extension block.");var g=t[e++];c=t[e++]|t[e++]<<8,d=t[e++],0==(1&g)&&(d=null),p=g>>2&7,e++;break;case 254:for(;;){if(!((I=t[e++])>=0))throw Error("Invalid block size");if(0===I)break;e+=I}break;default:throw new Error("Unknown graphic control label: 0x"+t[e-1].toString(16))}break;case 44:var b=t[e++]|t[e++]<<8,_=t[e++]|t[e++]<<8,y=t[e++]|t[e++]<<8,w=t[e++]|t[e++]<<8,v=t[e++],x=v>>6&1,E=1<<1+(7&v),k=h,S=l,M=!1;v>>7&&(M=!0,k=e,S=E,e+=3*E);var A=e;for(e++;;){var I;if(!((I=t[e++])>=0))throw Error("Invalid block size");if(0===I)break;e+=I}u.push({x:b,y:_,width:y,height:w,has_local_palette:M,palette_offset:k,palette_size:S,data_offset:A,data_length:e-A,transparent_index:d,interlaced:!!x,delay:c,disposal:p});break;case 59:f=!1;break;default:throw new Error("Unknown gif block: 0x"+t[e-1].toString(16))}this.numFrames=function(){return u.length},this.loopCount=function(){return m},this.frameInfo=function(t){if(t<0||t>=u.length)throw new Error("Frame index out of range.");return u[t]},this.decodeAndBlitFrameBGRA=function(e,n){var a=this.frameInfo(e),o=a.width*a.height,s=new Uint8Array(o);r(t,a.data_offset,s,o);var h=a.palette_offset,l=a.transparent_index;null===l&&(l=256);var f=a.width,u=i-f,c=f,d=4*(a.y*i+a.x),p=4*((a.y+a.height)*i+a.x),m=d,g=4*u;!0===a.interlaced&&(g+=4*i*7);for(var b=8,_=0,y=s.length;_=p&&(g=4*u+4*i*(b-1),m=d+(f+u)*(b<<1),b>>=1)),w===l)m+=4;else{var v=t[h+3*w],x=t[h+3*w+1],E=t[h+3*w+2];n[m++]=E,n[m++]=x,n[m++]=v,n[m++]=255}--c}},this.decodeAndBlitFrameRGBA=function(e,n){var a=this.frameInfo(e),o=a.width*a.height,s=new Uint8Array(o);r(t,a.data_offset,s,o);var h=a.palette_offset,l=a.transparent_index;null===l&&(l=256);var f=a.width,u=i-f,c=f,d=4*(a.y*i+a.x),p=4*((a.y+a.height)*i+a.x),m=d,g=4*u;!0===a.interlaced&&(g+=4*i*7);for(var b=8,_=0,y=s.length;_=p&&(g=4*u+4*i*(b-1),m=d+(f+u)*(b<<1),b>>=1)),w===l)m+=4;else{var v=t[h+3*w],x=t[h+3*w+1],E=t[h+3*w+2];n[m++]=v,n[m++]=x,n[m++]=E,n[m++]=255}--c}}}}catch(t){}},7604:(t,e,r)=>{"use strict";var i=r(8834).lW;class n{constructor(...t){if(0===t.length)throw new Error("constructor requires parameters");const e=t[0];if(null!==e&&"object"==typeof e)if(e instanceof n){const t=e.bitmap;this.bitmap={width:t.width,height:t.height,data:new i(t.width*t.height*4)},t.data.copy(this.bitmap.data)}else{if(!(e.width&&e.height&&e.data))throw new Error("unrecognized constructor parameters");this.bitmap=e}else{if("number"!=typeof e||"number"!=typeof t[1])throw new Error("unrecognized constructor parameters");{const r=e,n=t[1],a=t[2];this.bitmap={width:r,height:n},i.isBuffer(a)?this.bitmap.data=a:(this.bitmap.data=new i(r*n*4),"number"==typeof a&&this.fillRGBA(a))}}}blit(t,e,r,i,n,a,o){if(i+a>this.bitmap.width)throw new Error("copy exceeds width of source bitmap");if(e+a>t.bitmap.width)throw new Error("copy exceeds width of target bitmap");if(n+o>this.bitmap.height)throw new Error("copy exceeds height of source bitmap");if(r+o>t.bitmap.height)throw new Erro("copy exceeds height of target bitmap");const s=this.bitmap.data,h=t.bitmap.data,l=4*this.bitmap.width,f=4*t.bitmap.width,u=4*a;let c=n*l+4*i,d=r*f+4*e;for(;--o>=0;)s.copy(h,d,c,c+u),c+=l,d+=f;return this}fillRGBA(t){const e=this.bitmap.data,r=4*this.bitmap.height;let i=0;for(;i{const n=Math.round(.299*t[i]+.587*t[i+1]+.114*t[i+2]);t[i]=n,t[i+1]=n,t[i+2]=n})),this}reframe(t,e,r,i,a){const o=t<0?0:t,s=e<0?0:e,h=r+o>this.bitmap.width?this.bitmap.width-o:r,l=i+s>this.bitmap.height?this.bitmap.height-s:i,f=t<0?-t:0,u=e<0?-e:0;let c;if(void 0===a){if(o!==t||s!=e||h!==r||l!==i)throw new GifError("fillRGBA required for this reframing");c=new n(r,i)}else c=new n(r,i,a);return this.blit(c,f,u,o,s,h,l),this.bitmap=c.bitmap,this}scale(t){if(1===t)return;if(!Number.isInteger(t)||t<1)throw new Error("the scale must be an integer >= 1");const e=this.bitmap.width,r=this.bitmap.height,n=e*t*4,a=this.bitmap.data,o=new i(r*n*t);let s,h=0,l=0;for(let i=0;i{"use strict";class r{constructor(t,e,r){this.width=r.width,this.height=r.height,this.loops=r.loops,this.usesTransparency=r.usesTransparency,this.colorScope=r.colorScope,this.frames=e,this.buffer=t}}r.GlobalColorsPreferred=0,r.GlobalColorsOnly=1,r.LocalColorsOnly=2;class i extends Error{constructor(t){super(t),t instanceof Error&&(this.stack="Gif"+t.stack)}}e.Gif=r,e.GifError=i},6512:(t,e,r)=>{"use strict";var i=r(8834).lW;const n=r(2855),{Gif:a,GifError:o}=r(4364);function s(){const t=r(4602);return s=function(){return t},t}const{GifFrame:h}=r(5585),l=100;function f(t,e){const r=t.indexOf(e);return-1===r?null:r}function u(t,e){for(var r,i=0,n=t.length-1;i<=n;)if(t[r=Math.floor((i+n)/2)]>e)n=r-1;else{if(!(t[r]i;)i<<=1;e.length=i,e.fill(0,r)}function d(t,e){let r=t.bitmap.width*t.bitmap.height;return r=Math.ceil(r*e/8),r+=Math.ceil(r/255),l+r+768}function p(t){let e=t.indexCount,r=0;for(--e;e;)++r,e>>=1;return r>0?r:1}function m(t,e,r,n,a){if(r.interlaced)throw new o("writing interlaced GIFs is not supported");const s=function(t,e,r){const n=r.colors,a=n.length<=8?f:u,s=e.bitmap.data,h=new i(s.length/4);let l=n.length,c=0,d=0;for(;c>8&16777215;h[d]=a(n,t)}else h[d]=l;c+=4,++d}if(r.usesTransparency){if(256===l)throw new o(`Frame ${t} already has 256 colorsand so can't use transparency`)}else l=null;return{buffer:h,transparentIndex:l}}(e,r,n),h={delay:r.delayCentisecs,disposal:r.disposalMethod,transparent:s.transparentIndex};a&&(c(n),h.palette=n.colors);try{let e,n=t.getOutputBuffer(),a=t.getOutputBufferPosition(),o=!0;for(;o;)if(e=t.addFrame(r.xOffset,r.yOffset,r.bitmap.width,r.bitmap.height,s.buffer,h),o=!1,e>=n.length-1){const e=new i(1.5*n.length);n.copy(e),t.setOutputBuffer(e),t.setOutputBufferPosition(a),n=e,o=!0}return n}catch(t){throw new o(t)}}e.GifCodec=class{constructor(t={}){this._transparentRGB=null,"number"==typeof t.transparentRGB&&0!==t.transparentRGB&&(this._transparentRGBA=256*t.transparentRGB),this._testInitialBufferSize=0}decodeGif(t){try{let e;try{e=new n.GifReader(t)}catch(t){throw new o(t)}const r=e.numFrames(),i=[],s={width:e.width,height:e.height,loops:e.loopCount(),usesTransparency:!1};for(let t=0;tn.width)for(let e=0;e0)return this._testInitialBufferSize;let r=968;const i=p(t);return e.forEach((t=>{r+=d(t,i)})),r}_getSizeEstimateLocal(t,e){if(this._testInitialBufferSize>0)return this._testInitialBufferSize;let r=200;for(let i=0;i{"use strict";const i=r(7604),{GifError:n}=r(4364);class a extends i{constructor(...t){if(super(...t),t[0]instanceof a){const e=t[0];this.xOffset=e.xOffset,this.yOffset=e.yOffset,this.disposalMethod=e.disposalMethod,this.delayCentisecs=e.delayCentisecs,this.interlaced=e.interlaced}else{const e=t[t.length-1];let r={};"object"!=typeof e||e instanceof i||(r=e),this.xOffset=r.xOffset||0,this.yOffset=r.yOffset||0,this.disposalMethod=void 0!==r.disposalMethod?r.disposalMethod:a.DisposeToBackgroundColor,this.delayCentisecs=r.delayCentisecs||8,this.interlaced=r.interlaced||!1}}getPalette(){const t=new Set,e=this.bitmap.data;let r=0,i=!1;for(;r>8&16777215;t.add(i)}r+=4}const n=new Array(t.size),a=t.values();for(r=0;rt-e));let o=n.length;return i&&++o,{colors:n,usesTransparency:i,indexCount:o}}}a.DisposeToAnything=0,a.DisposeNothing=1,a.DisposeToBackgroundColor=2,a.DisposeToPrevious=3,e.GifFrame=a},4602:(t,e,r)=>{"use strict";var i=r(8834).lW;const n=r(8522),a=r(2460),o=r(7604),{GifFrame:s}=r(5585),{GifError:h}=r(4364),{GifCodec:l}=r(6512),f=[".jpg",".jpeg",".png",".bmp"],u=new l;function c(t,e,r,i,n){const o=Array.isArray(t)?t:[t];if(n){if(["FloydSteinberg","FalseFloydSteinberg","Stucki","Atkinson","Jarvis","Burkes","Sierra","TwoSierra","SierraLite"].indexOf(n.ditherAlgorithm)<0)throw new Error(`Invalid ditherAlgorithm '${n.ditherAlgorithm}'`);void 0===n.serpentine&&(n.serpentine=!0),void 0===n.minimumColorDistanceToDither&&(n.minimumColorDistanceToDither=0),void 0===n.calculateErrorLikeGIMP&&(n.calculateErrorLikeGIMP=!1)}const s=new a.distance.Euclidean,h=new a.palette[e](s,r,i);let l;l=n?new a.image.ErrorDiffusionArray(s,a.image.ErrorDiffusionArrayKernel[n.ditherAlgorithm],n.serpentine,n.minimumColorDistanceToDither,n.calculateErrorLikeGIMP):new a.image.NearestColor(s);const f=[];o.forEach((t=>{const e=t.bitmap.data,r=new ArrayBuffer(e.length),i=new Uint32Array(r);for(let t=0,r=0;t{e.push(new s(t))})),e},e.getColorInfo=function(t,e){let r=!1;const i=[];for(let e=0;e256)throw new h(`Frame ${e} uses more than 256 color indexes`);i.push(n)}if(0===e)return{usesTransparency:r,palettes:i};const n=new Set;i.forEach((t=>{t.colors.forEach((t=>{n.add(t)}))}));let a=n.size;if(r&&++a,e&&a>e)return{usesTransparency:r,palettes:i};const o=new Array(n.size),s=n.values();for(let t=0;tt-e)),{colors:o,indexCount:a,usesTransparency:r,palettes:i}},e.copyAsJimp=function(t,r){return e.shareAsJimp(t,new o(r))},e.getMaxDimensions=function(t){let e=0,r=0;return t.forEach((t=>{const i=t.xOffset+t.bitmap.width;i>e&&(e=i);const n=t.yOffset+t.bitmap.height;n>r&&(r=n)})),{maxWidth:e,maxHeight:r}},e.quantizeDekker=function(t,e,r){c(t,"NeuQuantFloat",e=e||256,0,r)},e.quantizeSorokin=function(t,e,r,i){let n;switch(e=e||256,r=r||"min-pop"){case"min-pop":n=2;break;case"top-pop":n=1;break;default:throw new Error(`Invalid quantizeSorokin histogram '${r}'`)}c(t,"RGBQuant",e,n,i)},e.quantizeWu=function(t,e,r,i){if(e=e||256,(r=r||5)<1||r>8)throw new Error("Invalid quantization quality");c(t,"WuQuant",e,r,i)},e.read=function(t,e){return e=e||u,i.isBuffer(t)?e.decodeGif(t):(r=t,new Promise(((t,e)=>{n.readFile(r,((r,i)=>r?e(r):t(i)))}))).then((t=>e.decodeGif(t)));var r},e.shareAsJimp=function(t,e){const r=new t(e.bitmap.width,e.bitmap.height,0);return r.bitmap.data=e.bitmap.data,r},e.write=function(t,e,r,i){i=i||u;const a=t.match(/\.[a-zA-Z]+$/);if(null!==a&&f.includes(a[0].toLowerCase()))throw new Error(`GIF '${t}' has an unexpected suffix`);return i.encodeGif(e,r).then((e=>function(t,e){return new Promise(((r,i)=>{n.writeFile(t,e,(t=>t?i(t):r()))}))}(t,e.buffer).then((()=>e))))}},9455:(t,e,r)=>{"use strict";const i=r(7604),{Gif:n,GifError:a}=r(4364),{GifCodec:o}=r(6512),{GifFrame:s}=r(5585),h=r(4602);t.exports={BitmapImage:i,Gif:n,GifCodec:o,GifFrame:s,GifUtil:h,GifError:a}},5048:(t,e,r)=>{var i;i="undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self?self:{},t.exports=i},2333:(t,e)=>{e.read=function(t,e,r,i,n){var a,o,s=8*n-i-1,h=(1<>1,f=-7,u=r?n-1:0,c=r?-1:1,d=t[e+u];for(u+=c,a=d&(1<<-f)-1,d>>=-f,f+=s;f>0;a=256*a+t[e+u],u+=c,f-=8);for(o=a&(1<<-f)-1,a>>=-f,f+=i;f>0;o=256*o+t[e+u],u+=c,f-=8);if(0===a)a=1-l;else{if(a===h)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,i),a-=l}return(d?-1:1)*o*Math.pow(2,a-i)},e.write=function(t,e,r,i,n,a){var o,s,h,l=8*a-n-1,f=(1<>1,c=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:a-1,p=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-o))<1&&(o--,h*=2),(e+=o+u>=1?c/h:c*Math.pow(2,1-u))*h>=2&&(o++,h/=2),o+u>=f?(s=0,o=f):o+u>=1?(s=(e*h-1)*Math.pow(2,n),o+=u):(s=e*Math.pow(2,u-1)*Math.pow(2,n),o=0));n>=8;t[r+d]=255&s,d+=p,s/=256,n-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,l-=8);t[r+d-p]|=128*m}},9680:t=>{"use strict";var e=Function.prototype.toString,r=/^\s*class\b/,i=function(t){try{var i=e.call(t);return r.test(i)}catch(t){return!1}},n=Object.prototype.toString,a="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if("function"==typeof t&&!t.prototype)return!0;if(a)return function(t){try{return!i(t)&&(e.call(t),!0)}catch(t){return!1}}(t);if(i(t))return!1;var r=n.call(t);return"[object Function]"===r||"[object GeneratorFunction]"===r}},9748:t=>{t.exports=function(t){var r=e.call(t);return"[object Function]"===r||"function"==typeof t&&"[object RegExp]"!==r||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)};var e=Object.prototype.toString},9307:(t,e,r)=>{r(6168),t.exports=self.fetch.bind(self)},2691:(t,e,r)=>{var i=r(706),n=r(770);t.exports={encode:i,decode:n}},770:(t,e,r)=>{var i=r(8834).lW,n=function(){"use strict";var t=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),e=4017,r=799,i=3406,n=2276,a=1567,o=3784,s=5793,h=2896;function l(){}function f(t,e){for(var r,i,n=0,a=[],o=16;o>0&&!t[o-1];)o--;a.push({children:[],index:0});var s,h=a[0];for(r=0;r0;){if(0===a.length)throw new Error("Could not recreate Huffman Table");h=a.pop()}for(h.index++,a.push(h);a.length<=r;)a.push(s={children:[],index:0}),h.children[h.index]=s.children,h=s;n++}r+10)return m--,p>>m&1;if(255==(p=e[r++])){var t=e[r++];if(t)throw new Error("unexpected marker: "+(p<<8|t).toString(16))}return m=7,p>>>7}function b(t){for(var e,r=t;null!==(e=g());){if("number"==typeof(r=r[e]))return r;if("object"!=typeof r)throw new Error("invalid huffman sequence")}return null}function _(t){for(var e=0;t>0;){var r=g();if(null===r)return;e=e<<1|r,t--}return e}function y(t){var e=_(t);return e>=1<0)v--;else for(var i=o,n=s;i<=n;){var a=b(e.huffmanTableAC),h=15&a,f=a>>4;if(0!==h)r[t[i+=f]]=y(h)*(1<>4,0===c)a<15?(v=_(a)+(1<>4;if(0!==s)r[t[a+=h]]=y(s),a++;else{if(h<15)break;a+=16}}};var P,O,L,C,U=0;for(O=1==R?n[0].blocksPerLine*n[0].blocksPerColumn:u*i.mcusPerColumn,a||(a=O);U=65488&&P<=65495))break;r+=2}return r-d}function c(t,l){var f,u,c=[],d=l.blocksPerLine,p=l.blocksPerColumn,m=d<<3,b=new Int32Array(64),_=new Uint8Array(64);function y(t,f,u){var c,d,p,m,g,b,_,y,w,v,x=l.quantizationTable,E=u;for(v=0;v<64;v++)E[v]=t[v]*x[v];for(v=0;v<8;++v){var k=8*v;0!=E[1+k]||0!=E[2+k]||0!=E[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[0+S]=c+y,E[56+S]=c-y,E[8+S]=d+_,E[48+S]=d-_,E[16+S]=p+b,E[40+S]=p-b,E[24+S]=m+g,E[32+S]=m-g):(w=s*u[v+0]+8192>>14,E[0+S]=w,E[8+S]=w,E[16+S]=w,E[24+S]=w,E[32+S]=w,E[40+S]=w,E[48+S]=w,E[56+S]=w)}for(v=0;v<64;++v){var M=128+(E[v]+8>>4);f[v]=M<0?0:M>255?255:M}}g(m*p*8);for(var w=0;w255?255:t}l.prototype={load:function(t){var e=new XMLHttpRequest;e.open("GET",t,!0),e.responseType="arraybuffer",e.onload=function(){var t=new Uint8Array(e.response||e.mozResponseArrayBuffer);this.parse(t),this.onload&&this.onload()}.bind(this),e.send(null)},parse:function(e){var r=1e3*this.opts.maxResolutionInMP*1e3,i=0;function n(){var t=e[i]<<8|e[i+1];return i+=2,t}function a(t){var e,r,i=1,n=1;for(r in t.components)t.components.hasOwnProperty(r)&&(i<(e=t.components[r]).h&&(i=e.h),n>4==0)for(V=0;V<64;V++)M[t[V]]=e[i++];else{if(S>>4!=1)throw new Error("DQT: invalid table spec");for(V=0;V<64;V++)M[t[V]]=n()}m[15&S]=M}break;case 65472:case 65473:case 65474:n(),(o={}).extended=65473===w,o.progressive=65474===w,o.precision=e[i++],o.scanLines=n(),o.samplesPerLine=n(),o.components={},o.componentsOrder=[];var A=o.scanLines*o.samplesPerLine;if(A>r){var I=Math.ceil((A-r)/1e6);throw new Error(`maxResolutionInMP limit exceeded by ${I}MP`)}var B,T=e[i++];for(Z=0;Z>4,P=15&e[i+1],O=e[i+2];if(R<=0||P<=0)throw new Error("Invalid sampling factor, expected values above 0");o.componentsOrder.push(B),o.components[B]={h:R,v:P,quantizationIdx:O},i+=3}a(o),b.push(o);break;case 65476:var L=n();for(Z=2;Z>4==0?y:_)[15&C]=f(U,D)}break;case 65501:n(),s=n();break;case 65500:n(),n();break;case 65498:n();var N=e[i++],F=[];for(Z=0;Z>4],X.huffmanTableAC=_[15&j],F.push(X)}var G=e[i++],H=e[i++],W=e[i++],q=u(e,i,o,F,s,G,H,W>>4,15&W,this.opts);i+=q;break;case 65535:255!==e[i]&&i--;break;default:if(255==e[i-3]&&e[i-2]>=192&&e[i-2]<=254){i-=3;break}if(224===w||225==w){if(-1!==v)throw new Error(`first unknown JPEG marker at offset ${v.toString(16)}, second unknown JPEG marker ${w.toString(16)} at offset ${(i-1).toString(16)}`);v=i-1;const t=n();if(255===e[i+t-2]){i+=t-2;break}}throw new Error("unknown JPEG marker "+w.toString(16))}w=n()}if(1!=b.length)throw new Error("only single frame JPEGs supported");for(var Z=0;Zm){var r=Math.ceil((e-m)/1024/1024);throw new Error(`maxMemoryUsageInMB limit exceeded by at least ${r}MB`)}p=e}return l.resetMaxMemoryUsage=function(t){p=0,m=t},l.getBytesAllocated=function(){return p},l.requestMemoryAllocation=g,l}();t.exports=function(t,e={}){var r={colorTransform:void 0,useTArray:!1,formatAsRGBA:!0,tolerantDecoding:!0,maxResolutionInMP:100,maxMemoryUsageInMB:512,...e},a=new Uint8Array(t),o=new n;o.opts=r,n.resetMaxMemoryUsage(1024*r.maxMemoryUsageInMB*1024),o.parse(a);var s=r.formatAsRGBA?4:3,h=o.width*o.height*s;try{n.requestMemoryAllocation(h);var l={width:o.width,height:o.height,exifBuffer:o.exifBuffer,data:r.useTArray?new Uint8Array(h):i.alloc(h)};o.comments.length>0&&(l.comments=o.comments)}catch(t){if(t instanceof RangeError)throw new Error("Could not allocate enough memory for the image. Required: "+h);if(t instanceof ReferenceError&&"Buffer is not defined"===t.message)throw new Error("Buffer is not globally defined in this environment. Consider setting useTArray to true");throw t}return o.copyToImageData(l,r.formatAsRGBA),l}},706:(t,e,r)=>{var i=r(8834).lW;function n(t){Math.round;var e,r,n,a,o,s=Math.floor,h=new Array(64),l=new Array(64),f=new Array(64),u=new Array(64),c=new Array(65535),d=new Array(65535),p=new Array(64),m=new Array(64),g=[],b=0,_=7,y=new Array(64),w=new Array(64),v=new Array(64),x=new Array(256),E=new Array(2048),k=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],S=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],M=[0,1,2,3,4,5,6,7,8,9,10,11],A=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],I=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],B=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],T=[0,1,2,3,4,5,6,7,8,9,10,11],R=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],P=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function O(t,e){for(var r=0,i=0,n=new Array,a=1;a<=16;a++){for(var o=1;o<=t[a];o++)n[e[i]]=[],n[e[i]][0]=r,n[e[i]][1]=a,i++,r++;r*=2}return n}function L(t){for(var e=t[0],r=t[1]-1;r>=0;)e&1<>8&255),C(255&t)}function z(t,e,r,i,n){for(var a,o=n[0],s=n[240],h=function(t,e){var r,i,n,a,o,s,h,l,f,u,c=0;for(f=0;f<8;++f){r=t[c],i=t[c+1],n=t[c+2],a=t[c+3],o=t[c+4],s=t[c+5],h=t[c+6];var d=r+(l=t[c+7]),m=r-l,g=i+h,b=i-h,_=n+s,y=n-s,w=a+o,v=a-o,x=d+w,E=d-w,k=g+_,S=g-_;t[c]=x+k,t[c+4]=x-k;var M=.707106781*(S+E);t[c+2]=E+M,t[c+6]=E-M;var A=.382683433*((x=v+y)-(S=b+m)),I=.5411961*x+A,B=1.306562965*S+A,T=.707106781*(k=y+b),R=m+T,P=m-T;t[c+5]=P+I,t[c+3]=P-I,t[c+1]=R+B,t[c+7]=R-B,c+=8}for(c=0,f=0;f<8;++f){r=t[c],i=t[c+8],n=t[c+16],a=t[c+24],o=t[c+32],s=t[c+40],h=t[c+48];var O=r+(l=t[c+56]),L=r-l,C=i+h,U=i-h,z=n+s,D=n-s,N=a+o,F=a-o,j=O+N,G=O-N,H=C+z,W=C-z;t[c]=j+H,t[c+32]=j-H;var q=.707106781*(W+G);t[c+16]=G+q,t[c+48]=G-q;var Z=.382683433*((j=F+D)-(W=U+L)),Y=.5411961*j+Z,V=1.306562965*W+Z,X=.707106781*(H=D+U),J=L+X,Q=L-X;t[c+40]=Q+Y,t[c+24]=Q-Y,t[c+8]=J+V,t[c+56]=J-V,c++}for(f=0;f<64;++f)u=t[f]*e[f],p[f]=u>0?u+.5|0:u-.5|0;return p}(t,e),l=0;l<64;++l)m[k[l]]=h[l];var f=m[0]-r;r=m[0],0==f?L(i[0]):(L(i[d[a=32767+f]]),L(c[a]));for(var u=63;u>0&&0==m[u];u--);if(0==u)return L(o),r;for(var g,b=1;b<=u;){for(var _=b;0==m[b]&&b<=u;++b);var y=b-_;if(y>=16){g=y>>4;for(var w=1;w<=g;++w)L(s);y&=15}a=32767+m[b],L(n[(y<<4)+d[a]]),L(c[a]),b++}return 63!=u&&L(o),r}function D(t){t<=0&&(t=1),t>100&&(t=100),o!=t&&(function(t){for(var e=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],r=0;r<64;r++){var i=s((e[r]*t+50)/100);i<1?i=1:i>255&&(i=255),h[k[r]]=i}for(var n=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],a=0;a<64;a++){var o=s((n[a]*t+50)/100);o<1?o=1:o>255&&(o=255),l[k[a]]=o}for(var c=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],d=0,p=0;p<8;p++)for(var m=0;m<8;m++)f[d]=1/(h[k[d]]*c[p]*c[m]*8),u[d]=1/(l[k[d]]*c[p]*c[m]*8),d++}(t<50?Math.floor(5e3/t):Math.floor(200-2*t)),o=t)}this.encode=function(t,o){var s;(new Date).getTime(),o&&D(o),g=new Array,b=0,_=7,U(65496),U(65504),U(16),C(74),C(70),C(73),C(70),C(0),C(1),C(1),C(0),U(1),U(1),C(0),C(0),void 0!==(s=t.comments)&&s.constructor===Array&&s.forEach((t=>{if("string"==typeof t){U(65534);var e,r=t.length;for(U(r+2),e=0;e>3)*Y+(j=4*(7&H)),V+G>=Z&&(F-=Y*(V+1+G-Z)),m+j>=Y&&(F-=m+j-Y+4),x=W[F++],k=W[F++],O=W[F++],y[H]=(E[x]+E[k+256>>0]+E[O+512>>0]>>16)-128,w[H]=(E[x+768>>0]+E[k+1024>>0]+E[O+1280>>0]>>16)-128,v[H]=(E[x+1280>>0]+E[k+1536>>0]+E[O+1792>>0]>>16)-128;c=z(y,f,c,e,n),d=z(w,u,d,r,a),p=z(v,u,p,r,a),m+=32}V+=8}if(_>=0){var X=[];X[1]=_+1,X[0]=(1<<_+1)-1,L(X)}return U(65497),i.from(g)},(new Date).getTime(),t||(t=50),function(){for(var t=String.fromCharCode,e=0;e<256;e++)x[e]=t(e)}(),e=O(S,M),r=O(B,T),n=O(A,I),a=O(R,P),function(){for(var t=1,e=2,r=1;r<=15;r++){for(var i=t;i>0]=38470*t,E[t+512>>0]=7471*t+32768,E[t+768>>0]=-11059*t,E[t+1024>>0]=-21709*t,E[t+1280>>0]=32768*t+8421375,E[t+1536>>0]=-27439*t,E[t+1792>>0]=-5329*t}(),D(t),(new Date).getTime()}t.exports=function(t,e){return void 0===e&&(e=50),{data:new n(e).encode(t,e),width:t.width,height:t.height}}},8058:(t,e,r)=>{var i=r(8834).lW,n=r(6290),a=function(){},o=r(4398),s=r(5947),h=r(8438),l=r(5565),f=r(1960),u=self.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest;t.exports=function(t,e){e="function"==typeof e?e:a,"string"==typeof t?t={uri:t}:t||(t={}),t.binary&&(t=function(t){if(u)return f(t,{responseType:"arraybuffer"});if(void 0===self.XMLHttpRequest)throw new Error("your browser does not support XHR loading");var e=new self.XMLHttpRequest;return e.overrideMimeType("text/plain; charset=x-user-defined"),f({xhr:e},t)}(t)),n(t,(function(r,n,f){if(r)return e(r);if(!/^2/.test(n.statusCode))return e(new Error("http status code: "+n.statusCode));if(!f)return e(new Error("no body result"));var u,c,d=!1;if(u=f,"[object ArrayBuffer]"===Object.prototype.toString.call(u)){var p=new Uint8Array(f);f=i.from(p,"binary")}l(f)&&(d=!0,"string"==typeof f&&(f=i.from(f,"binary"))),d||(i.isBuffer(f)&&(f=f.toString(t.encoding)),f=f.trim());try{var m=n.headers["content-type"];c=d?h(f):/json/.test(m)||"{"===f.charAt(0)?JSON.parse(f):/xml/.test(m)||"<"===f.charAt(0)?s(f):o(f)}catch(t){e(new Error("error parsing font "+t.message)),e=a}e(null,c)}))}},5565:(t,e,r)=>{var i=r(8834).lW,n=r(5137),a=i.from([66,77,70,3]);t.exports=function(t){return"string"==typeof t?"BMF"===t.substring(0,3):t.length>4&&n(t.slice(0,4),a)}},63:(t,e)=>{"use strict";function r(t,e,r,i){for(var n=t[e++],a=1<>=h,f-=h,g!==a){if(g===o)break;for(var b=ga;)y=p[y]>>8,++_;var w=y;if(c+_+(b!==g?1:0)>i)return void console.log("Warning, gif stream longer than expected.");r[c++]=w;var v=c+=_;for(b!==g&&(r[c++]=w),y=b;_--;)y=p[y],r[--v]=255&y,y>>=8;null!==m&&s<4096&&(p[s++]=m<<8|w,s>=l+1&&h<12&&(++h,l=l<<1|1)),m=g}else s=o+1,l=(1<<(h=n+1))-1,m=null}return c!==i&&console.log("Warning, gif stream shorter than expected."),r}try{e.N=function(t){var e=0;if(71!==t[e++]||73!==t[e++]||70!==t[e++]||56!==t[e++]||56!=(t[e++]+1&253)||97!==t[e++])throw new Error("Invalid GIF 87a/89a header.");var i=t[e++]|t[e++]<<8,n=t[e++]|t[e++]<<8,a=t[e++],o=a>>7,s=1<<1+(7&a);t[e++],t[e++];var h=null,l=null;o&&(h=e,l=s,e+=3*s);var f=!0,u=[],c=0,d=null,p=0,m=null;for(this.width=i,this.height=n;f&&e=0))throw Error("Invalid block size");if(0===I)break;e+=I}break;case 249:if(4!==t[e++]||0!==t[e+4])throw new Error("Invalid graphics extension block.");var g=t[e++];c=t[e++]|t[e++]<<8,d=t[e++],0==(1&g)&&(d=null),p=g>>2&7,e++;break;case 254:for(;;){if(!((I=t[e++])>=0))throw Error("Invalid block size");if(0===I)break;e+=I}break;default:throw new Error("Unknown graphic control label: 0x"+t[e-1].toString(16))}break;case 44:var b=t[e++]|t[e++]<<8,_=t[e++]|t[e++]<<8,y=t[e++]|t[e++]<<8,w=t[e++]|t[e++]<<8,v=t[e++],x=v>>6&1,E=1<<1+(7&v),k=h,S=l,M=!1;v>>7&&(M=!0,k=e,S=E,e+=3*E);var A=e;for(e++;;){var I;if(!((I=t[e++])>=0))throw Error("Invalid block size");if(0===I)break;e+=I}u.push({x:b,y:_,width:y,height:w,has_local_palette:M,palette_offset:k,palette_size:S,data_offset:A,data_length:e-A,transparent_index:d,interlaced:!!x,delay:c,disposal:p});break;case 59:f=!1;break;default:throw new Error("Unknown gif block: 0x"+t[e-1].toString(16))}this.numFrames=function(){return u.length},this.loopCount=function(){return m},this.frameInfo=function(t){if(t<0||t>=u.length)throw new Error("Frame index out of range.");return u[t]},this.decodeAndBlitFrameBGRA=function(e,n){var a=this.frameInfo(e),o=a.width*a.height,s=new Uint8Array(o);r(t,a.data_offset,s,o);var h=a.palette_offset,l=a.transparent_index;null===l&&(l=256);var f=a.width,u=i-f,c=f,d=4*(a.y*i+a.x),p=4*((a.y+a.height)*i+a.x),m=d,g=4*u;!0===a.interlaced&&(g+=4*i*7);for(var b=8,_=0,y=s.length;_=p&&(g=4*u+4*i*(b-1),m=d+(f+u)*(b<<1),b>>=1)),w===l)m+=4;else{var v=t[h+3*w],x=t[h+3*w+1],E=t[h+3*w+2];n[m++]=E,n[m++]=x,n[m++]=v,n[m++]=255}--c}},this.decodeAndBlitFrameRGBA=function(e,n){var a=this.frameInfo(e),o=a.width*a.height,s=new Uint8Array(o);r(t,a.data_offset,s,o);var h=a.palette_offset,l=a.transparent_index;null===l&&(l=256);var f=a.width,u=i-f,c=f,d=4*(a.y*i+a.x),p=4*((a.y+a.height)*i+a.x),m=d,g=4*u;!0===a.interlaced&&(g+=4*i*7);for(var b=8,_=0,y=s.length;_=p&&(g=4*u+4*i*(b-1),m=d+(f+u)*(b<<1),b>>=1)),w===l)m+=4;else{var v=t[h+3*w],x=t[h+3*w+1],E=t[h+3*w+2];n[m++]=v,n[m++]=x,n[m++]=E,n[m++]=255}--c}}}}catch(t){}},2845:(t,e,r)=>{"use strict";var i={};(0,r(9761).assign)(i,r(9880),r(1380),r(1271)),t.exports=i},9880:(t,e,r)=>{"use strict";var i=r(5789),n=r(9761),a=r(7944),o=r(2950),s=r(744),h=Object.prototype.toString,l=0,f=-1,u=0,c=8;function d(t){if(!(this instanceof d))return new d(t);this.options=n.assign({level:f,method:c,chunkSize:16384,windowBits:15,memLevel:8,strategy:u,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new s,this.strm.avail_out=0;var r=i.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==l)throw new Error(o[r]);if(e.header&&i.deflateSetHeader(this.strm,e.header),e.dictionary){var p;if(p="string"==typeof e.dictionary?a.string2buf(e.dictionary):"[object ArrayBuffer]"===h.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,(r=i.deflateSetDictionary(this.strm,p))!==l)throw new Error(o[r]);this._dict_set=!0}}function p(t,e){var r=new d(e);if(r.push(t,!0),r.err)throw r.msg||o[r.err];return r.result}d.prototype.push=function(t,e){var r,o,s=this.strm,f=this.options.chunkSize;if(this.ended)return!1;o=e===~~e?e:!0===e?4:0,"string"==typeof t?s.input=a.string2buf(t):"[object ArrayBuffer]"===h.call(t)?s.input=new Uint8Array(t):s.input=t,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new n.Buf8(f),s.next_out=0,s.avail_out=f),1!==(r=i.deflate(s,o))&&r!==l)return this.onEnd(r),this.ended=!0,!1;0!==s.avail_out&&(0!==s.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(a.buf2binstring(n.shrinkBuf(s.output,s.next_out))):this.onData(n.shrinkBuf(s.output,s.next_out)))}while((s.avail_in>0||0===s.avail_out)&&1!==r);return 4===o?(r=i.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===l):2!==o||(this.onEnd(l),s.avail_out=0,!0)},d.prototype.onData=function(t){this.chunks.push(t)},d.prototype.onEnd=function(t){t===l&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Deflate=d,e.deflate=p,e.deflateRaw=function(t,e){return(e=e||{}).raw=!0,p(t,e)},e.gzip=function(t,e){return(e=e||{}).gzip=!0,p(t,e)}},1380:(t,e,r)=>{"use strict";var i=r(5020),n=r(9761),a=r(7944),o=r(1271),s=r(2950),h=r(744),l=r(7357),f=Object.prototype.toString;function u(t){if(!(this instanceof u))return new u(t);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var r=i.inflateInit2(this.strm,e.windowBits);if(r!==o.Z_OK)throw new Error(s[r]);if(this.header=new l,i.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=a.string2buf(e.dictionary):"[object ArrayBuffer]"===f.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=i.inflateSetDictionary(this.strm,e.dictionary))!==o.Z_OK))throw new Error(s[r])}function c(t,e){var r=new u(e);if(r.push(t,!0),r.err)throw r.msg||s[r.err];return r.result}u.prototype.push=function(t,e){var r,s,h,l,u,c=this.strm,d=this.options.chunkSize,p=this.options.dictionary,m=!1;if(this.ended)return!1;s=e===~~e?e:!0===e?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof t?c.input=a.binstring2buf(t):"[object ArrayBuffer]"===f.call(t)?c.input=new Uint8Array(t):c.input=t,c.next_in=0,c.avail_in=c.input.length;do{if(0===c.avail_out&&(c.output=new n.Buf8(d),c.next_out=0,c.avail_out=d),(r=i.inflate(c,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&p&&(r=i.inflateSetDictionary(this.strm,p)),r===o.Z_BUF_ERROR&&!0===m&&(r=o.Z_OK,m=!1),r!==o.Z_STREAM_END&&r!==o.Z_OK)return this.onEnd(r),this.ended=!0,!1;c.next_out&&(0!==c.avail_out&&r!==o.Z_STREAM_END&&(0!==c.avail_in||s!==o.Z_FINISH&&s!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(h=a.utf8border(c.output,c.next_out),l=c.next_out-h,u=a.buf2string(c.output,h),c.next_out=l,c.avail_out=d-l,l&&n.arraySet(c.output,c.output,h,l,0),this.onData(u)):this.onData(n.shrinkBuf(c.output,c.next_out)))),0===c.avail_in&&0===c.avail_out&&(m=!0)}while((c.avail_in>0||0===c.avail_out)&&r!==o.Z_STREAM_END);return r===o.Z_STREAM_END&&(s=o.Z_FINISH),s===o.Z_FINISH?(r=i.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===o.Z_OK):s!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),c.avail_out=0,!0)},u.prototype.onData=function(t){this.chunks.push(t)},u.prototype.onEnd=function(t){t===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Inflate=u,e.inflate=c,e.inflateRaw=function(t,e){return(e=e||{}).raw=!0,c(t,e)},e.ungzip=c},9761:(t,e)=>{"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var n in r)i(r,n)&&(t[n]=r[n])}}return t},e.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var n={arraySet:function(t,e,r,i,n){if(e.subarray&&t.subarray)t.set(e.subarray(r,r+i),n);else for(var a=0;a{"use strict";var i=r(9761),n=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch(t){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){a=!1}for(var o=new i.Buf8(256),s=0;s<256;s++)o[s]=s>=252?6:s>=248?5:s>=240?4:s>=224?3:s>=192?2:1;function h(t,e){if(e<65534&&(t.subarray&&a||!t.subarray&&n))return String.fromCharCode.apply(null,i.shrinkBuf(t,e));for(var r="",o=0;o>>6,e[o++]=128|63&r):r<65536?(e[o++]=224|r>>>12,e[o++]=128|r>>>6&63,e[o++]=128|63&r):(e[o++]=240|r>>>18,e[o++]=128|r>>>12&63,e[o++]=128|r>>>6&63,e[o++]=128|63&r);return e},e.buf2binstring=function(t){return h(t,t.length)},e.binstring2buf=function(t){for(var e=new i.Buf8(t.length),r=0,n=e.length;r4)l[i++]=65533,r+=a-1;else{for(n&=2===a?31:3===a?15:7;a>1&&r1?l[i++]=65533:n<65536?l[i++]=n:(n-=65536,l[i++]=55296|n>>10&1023,l[i++]=56320|1023&n)}return h(l,i)},e.utf8border=function(t,e){var r;for((e=e||t.length)>t.length&&(e=t.length),r=e-1;r>=0&&128==(192&t[r]);)r--;return r<0||0===r?e:r+o[t[r]]>e?r:e}},5562:t=>{"use strict";t.exports=function(t,e,r,i){for(var n=65535&t|0,a=t>>>16&65535|0,o=0;0!==r;){r-=o=r>2e3?2e3:r;do{a=a+(n=n+e[i++]|0)|0}while(--o);n%=65521,a%=65521}return n|a<<16|0}},1271:t=>{"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},4299:t=>{"use strict";var e=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();t.exports=function(t,r,i,n){var a=e,o=n+i;t^=-1;for(var s=n;s>>8^a[255&(t^r[s])];return-1^t}},5789:(t,e,r)=>{"use strict";var i,n=r(9761),a=r(9564),o=r(5562),s=r(4299),h=r(2950),l=0,f=4,u=0,c=-2,d=-1,p=1,m=4,g=2,b=8,_=9,y=286,w=30,v=19,x=2*y+1,E=15,k=3,S=258,M=S+k+1,A=42,I=103,B=113,T=666,R=1,P=2,O=3,L=4;function C(t,e){return t.msg=h[e],e}function U(t){return(t<<1)-(t>4?9:0)}function z(t){for(var e=t.length;--e>=0;)t[e]=0}function D(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(n.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))}function N(t,e){a._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,D(t.strm)}function F(t,e){t.pending_buf[t.pending++]=e}function j(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function G(t,e){var r,i,n=t.max_chain_length,a=t.strstart,o=t.prev_length,s=t.nice_match,h=t.strstart>t.w_size-M?t.strstart-(t.w_size-M):0,l=t.window,f=t.w_mask,u=t.prev,c=t.strstart+S,d=l[a+o-1],p=l[a+o];t.prev_length>=t.good_match&&(n>>=2),s>t.lookahead&&(s=t.lookahead);do{if(l[(r=e)+o]===p&&l[r+o-1]===d&&l[r]===l[a]&&l[++r]===l[a+1]){a+=2,r++;do{}while(l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&ao){if(t.match_start=e,o=i,i>=s)break;d=l[a+o-1],p=l[a+o]}}}while((e=u[e&f])>h&&0!=--n);return o<=t.lookahead?o:t.lookahead}function H(t){var e,r,i,a,h,l,f,u,c,d,p=t.w_size;do{if(a=t.window_size-t.lookahead-t.strstart,t.strstart>=p+(p-M)){n.arraySet(t.window,t.window,p,p,0),t.match_start-=p,t.strstart-=p,t.block_start-=p,e=r=t.hash_size;do{i=t.head[--e],t.head[e]=i>=p?i-p:0}while(--r);e=r=p;do{i=t.prev[--e],t.prev[e]=i>=p?i-p:0}while(--r);a+=p}if(0===t.strm.avail_in)break;if(l=t.strm,f=t.window,u=t.strstart+t.lookahead,c=a,d=void 0,(d=l.avail_in)>c&&(d=c),r=0===d?0:(l.avail_in-=d,n.arraySet(f,l.input,l.next_in,d,u),1===l.state.wrap?l.adler=o(l.adler,f,d,u):2===l.state.wrap&&(l.adler=s(l.adler,f,d,u)),l.next_in+=d,l.total_in+=d,d),t.lookahead+=r,t.lookahead+t.insert>=k)for(h=t.strstart-t.insert,t.ins_h=t.window[h],t.ins_h=(t.ins_h<=k&&(t.ins_h=(t.ins_h<=k)if(i=a._tr_tally(t,t.strstart-t.match_start,t.match_length-k),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=k){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<=k&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=k-1)),t.prev_length>=k&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-k,i=a._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-k),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=(t.ins_h<15&&(s=2,i-=16),a<1||a>_||r!==b||i<8||i>15||e<0||e>9||o<0||o>m)return C(t,c);8===i&&(i=9);var h=new Y;return t.state=h,h.strm=t,h.wrap=s,h.gzhead=null,h.w_bits=i,h.w_size=1<t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(H(t),0===t.lookahead&&e===l)return R;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+r;if((0===t.strstart||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,N(t,!1),0===t.strm.avail_out))return R;if(t.strstart-t.block_start>=t.w_size-M&&(N(t,!1),0===t.strm.avail_out))return R}return t.insert=0,e===f?(N(t,!0),0===t.strm.avail_out?O:L):(t.strstart>t.block_start&&(N(t,!1),t.strm.avail_out),R)})),new Z(4,4,8,4,W),new Z(4,5,16,8,W),new Z(4,6,32,32,W),new Z(4,4,16,16,q),new Z(8,16,32,32,q),new Z(8,16,128,128,q),new Z(8,32,128,256,q),new Z(32,128,258,1024,q),new Z(32,258,258,4096,q)],e.deflateInit=function(t,e){return J(t,e,b,15,8,0)},e.deflateInit2=J,e.deflateReset=X,e.deflateResetKeep=V,e.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?c:(t.state.gzhead=e,u):c},e.deflate=function(t,e){var r,n,o,h;if(!t||!t.state||e>5||e<0)return t?C(t,c):c;if(n=t.state,!t.output||!t.input&&0!==t.avail_in||n.status===T&&e!==f)return C(t,0===t.avail_out?-5:c);if(n.strm=t,r=n.last_flush,n.last_flush=e,n.status===A)if(2===n.wrap)t.adler=0,F(n,31),F(n,139),F(n,8),n.gzhead?(F(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),F(n,255&n.gzhead.time),F(n,n.gzhead.time>>8&255),F(n,n.gzhead.time>>16&255),F(n,n.gzhead.time>>24&255),F(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),F(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(F(n,255&n.gzhead.extra.length),F(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=s(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(F(n,0),F(n,0),F(n,0),F(n,0),F(n,0),F(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),F(n,3),n.status=B);else{var d=b+(n.w_bits-8<<4)<<8;d|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(d|=32),d+=31-d%31,n.status=B,j(n,d),0!==n.strstart&&(j(n,t.adler>>>16),j(n,65535&t.adler)),t.adler=1}if(69===n.status)if(n.gzhead.extra){for(o=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>o&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),D(t),o=n.pending,n.pending!==n.pending_buf_size));)F(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),D(t),o=n.pending,n.pending===n.pending_buf_size)){h=1;break}h=n.gzindexo&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),0===h&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),D(t),o=n.pending,n.pending===n.pending_buf_size)){h=1;break}h=n.gzindexo&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),0===h&&(n.status=I)}else n.status=I;if(n.status===I&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&D(t),n.pending+2<=n.pending_buf_size&&(F(n,255&t.adler),F(n,t.adler>>8&255),t.adler=0,n.status=B)):n.status=B),0!==n.pending){if(D(t),0===t.avail_out)return n.last_flush=-1,u}else if(0===t.avail_in&&U(e)<=U(r)&&e!==f)return C(t,-5);if(n.status===T&&0!==t.avail_in)return C(t,-5);if(0!==t.avail_in||0!==n.lookahead||e!==l&&n.status!==T){var p=2===n.strategy?function(t,e){for(var r;;){if(0===t.lookahead&&(H(t),0===t.lookahead)){if(e===l)return R;break}if(t.match_length=0,r=a._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(N(t,!1),0===t.strm.avail_out))return R}return t.insert=0,e===f?(N(t,!0),0===t.strm.avail_out?O:L):t.last_lit&&(N(t,!1),0===t.strm.avail_out)?R:P}(n,e):3===n.strategy?function(t,e){for(var r,i,n,o,s=t.window;;){if(t.lookahead<=S){if(H(t),t.lookahead<=S&&e===l)return R;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=k&&t.strstart>0&&(i=s[n=t.strstart-1])===s[++n]&&i===s[++n]&&i===s[++n]){o=t.strstart+S;do{}while(i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&nt.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=k?(r=a._tr_tally(t,1,t.match_length-k),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=a._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(N(t,!1),0===t.strm.avail_out))return R}return t.insert=0,e===f?(N(t,!0),0===t.strm.avail_out?O:L):t.last_lit&&(N(t,!1),0===t.strm.avail_out)?R:P}(n,e):i[n.level].func(n,e);if(p!==O&&p!==L||(n.status=T),p===R||p===O)return 0===t.avail_out&&(n.last_flush=-1),u;if(p===P&&(1===e?a._tr_align(n):5!==e&&(a._tr_stored_block(n,0,0,!1),3===e&&(z(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),D(t),0===t.avail_out))return n.last_flush=-1,u}return e!==f?u:n.wrap<=0?1:(2===n.wrap?(F(n,255&t.adler),F(n,t.adler>>8&255),F(n,t.adler>>16&255),F(n,t.adler>>24&255),F(n,255&t.total_in),F(n,t.total_in>>8&255),F(n,t.total_in>>16&255),F(n,t.total_in>>24&255)):(j(n,t.adler>>>16),j(n,65535&t.adler)),D(t),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?u:1)},e.deflateEnd=function(t){var e;return t&&t.state?(e=t.state.status)!==A&&69!==e&&73!==e&&91!==e&&e!==I&&e!==B&&e!==T?C(t,c):(t.state=null,e===B?C(t,-3):u):c},e.deflateSetDictionary=function(t,e){var r,i,a,s,h,l,f,d,p=e.length;if(!t||!t.state)return c;if(2===(s=(r=t.state).wrap)||1===s&&r.status!==A||r.lookahead)return c;for(1===s&&(t.adler=o(t.adler,e,p,0)),r.wrap=0,p>=r.w_size&&(0===s&&(z(r.head),r.strstart=0,r.block_start=0,r.insert=0),d=new n.Buf8(r.w_size),n.arraySet(d,e,p-r.w_size,r.w_size,0),e=d,p=r.w_size),h=t.avail_in,l=t.next_in,f=t.input,t.avail_in=p,t.next_in=0,t.input=e,H(r);r.lookahead>=k;){i=r.strstart,a=r.lookahead-(k-1);do{r.ins_h=(r.ins_h<{"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},4980:t=>{"use strict";t.exports=function(t,e){var r,i,n,a,o,s,h,l,f,u,c,d,p,m,g,b,_,y,w,v,x,E,k,S,M;r=t.state,i=t.next_in,S=t.input,n=i+(t.avail_in-5),a=t.next_out,M=t.output,o=a-(e-t.avail_out),s=a+(t.avail_out-257),h=r.dmax,l=r.wsize,f=r.whave,u=r.wnext,c=r.window,d=r.hold,p=r.bits,m=r.lencode,g=r.distcode,b=(1<>>=w=y>>>24,p-=w,0==(w=y>>>16&255))M[a++]=65535&y;else{if(!(16&w)){if(0==(64&w)){y=m[(65535&y)+(d&(1<>>=w,p-=w),p<15&&(d+=S[i++]<>>=w=y>>>24,p-=w,!(16&(w=y>>>16&255))){if(0==(64&w)){y=g[(65535&y)+(d&(1<h){t.msg="invalid distance too far back",r.mode=30;break t}if(d>>>=w,p-=w,x>(w=a-o)){if((w=x-w)>f&&r.sane){t.msg="invalid distance too far back",r.mode=30;break t}if(E=0,k=c,0===u){if(E+=l-w,w2;)M[a++]=k[E++],M[a++]=k[E++],M[a++]=k[E++],v-=3;v&&(M[a++]=k[E++],v>1&&(M[a++]=k[E++]))}else{E=a-x;do{M[a++]=M[E++],M[a++]=M[E++],M[a++]=M[E++],v-=3}while(v>2);v&&(M[a++]=M[E++],v>1&&(M[a++]=M[E++]))}break}}break}}while(i>3,d&=(1<<(p-=v<<3))-1,t.next_in=i,t.next_out=a,t.avail_in=i{"use strict";var i=r(9761),n=r(5562),a=r(4299),o=r(4980),s=r(881),h=1,l=2,f=0,u=-2,c=1,d=12,p=30,m=852,g=592;function b(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function _(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function y(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=c,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new i.Buf32(m),e.distcode=e.distdyn=new i.Buf32(g),e.sane=1,e.back=-1,f):u}function w(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,y(t)):u}function v(t,e){var r,i;return t&&t.state?(i=t.state,e<0?(r=0,e=-e):(r=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?u:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,w(t))):u}function x(t,e){var r,i;return t?(i=new _,t.state=i,i.window=null,(r=v(t,e))!==f&&(t.state=null),r):u}var E,k,S=!0;function M(t){if(S){var e;for(E=new i.Buf32(512),k=new i.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(s(h,t.lens,0,288,E,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;s(l,t.lens,0,32,k,0,t.work,{bits:5}),S=!1}t.lencode=E,t.lenbits=9,t.distcode=k,t.distbits=5}function A(t,e,r,n){var a,o=t.state;return null===o.window&&(o.wsize=1<=o.wsize?(i.arraySet(o.window,e,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((a=o.wsize-o.wnext)>n&&(a=n),i.arraySet(o.window,e,r-n,a,o.wnext),(n-=a)?(i.arraySet(o.window,e,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,r.check=a(r.check,G,2,0),x=0,E=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&x)<<8)+(x>>8))%31){t.msg="incorrect header check",r.mode=p;break}if(8!=(15&x)){t.msg="unknown compression method",r.mode=p;break}if(E-=4,z=8+(15&(x>>>=4)),0===r.wbits)r.wbits=z;else if(z>r.wbits){t.msg="invalid window size",r.mode=p;break}r.dmax=1<>8&1),512&r.flags&&(G[0]=255&x,G[1]=x>>>8&255,r.check=a(r.check,G,2,0)),x=0,E=0,r.mode=3;case 3:for(;E<32;){if(0===w)break t;w--,x+=m[_++]<>>8&255,G[2]=x>>>16&255,G[3]=x>>>24&255,r.check=a(r.check,G,4,0)),x=0,E=0,r.mode=4;case 4:for(;E<16;){if(0===w)break t;w--,x+=m[_++]<>8),512&r.flags&&(G[0]=255&x,G[1]=x>>>8&255,r.check=a(r.check,G,2,0)),x=0,E=0,r.mode=5;case 5:if(1024&r.flags){for(;E<16;){if(0===w)break t;w--,x+=m[_++]<>>8&255,r.check=a(r.check,G,2,0)),x=0,E=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((I=r.length)>w&&(I=w),I&&(r.head&&(z=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),i.arraySet(r.head.extra,m,_,I,z)),512&r.flags&&(r.check=a(r.check,m,I,_)),w-=I,_+=I,r.length-=I),r.length))break t;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===w)break t;I=0;do{z=m[_+I++],r.head&&z&&r.length<65536&&(r.head.name+=String.fromCharCode(z))}while(z&&I>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=d;break;case 10:for(;E<32;){if(0===w)break t;w--,x+=m[_++]<>>=7&E,E-=7&E,r.mode=27;break}for(;E<3;){if(0===w)break t;w--,x+=m[_++]<>>=1)){case 0:r.mode=14;break;case 1:if(M(r),r.mode=20,6===e){x>>>=2,E-=2;break t}break;case 2:r.mode=17;break;case 3:t.msg="invalid block type",r.mode=p}x>>>=2,E-=2;break;case 14:for(x>>>=7&E,E-=7&E;E<32;){if(0===w)break t;w--,x+=m[_++]<>>16^65535)){t.msg="invalid stored block lengths",r.mode=p;break}if(r.length=65535&x,x=0,E=0,r.mode=15,6===e)break t;case 15:r.mode=16;case 16:if(I=r.length){if(I>w&&(I=w),I>v&&(I=v),0===I)break t;i.arraySet(g,m,_,I,y),w-=I,_+=I,v-=I,y+=I,r.length-=I;break}r.mode=d;break;case 17:for(;E<14;){if(0===w)break t;w--,x+=m[_++]<>>=5,E-=5,r.ndist=1+(31&x),x>>>=5,E-=5,r.ncode=4+(15&x),x>>>=4,E-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=p;break}r.have=0,r.mode=18;case 18:for(;r.have>>=3,E-=3}for(;r.have<19;)r.lens[H[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,N={bits:r.lenbits},D=s(0,r.lens,0,19,r.lencode,0,r.work,N),r.lenbits=N.bits,D){t.msg="invalid code lengths set",r.mode=p;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,O=65535&j,!((R=j>>>24)<=E);){if(0===w)break t;w--,x+=m[_++]<>>=R,E-=R,r.lens[r.have++]=O;else{if(16===O){for(F=R+2;E>>=R,E-=R,0===r.have){t.msg="invalid bit length repeat",r.mode=p;break}z=r.lens[r.have-1],I=3+(3&x),x>>>=2,E-=2}else if(17===O){for(F=R+3;E>>=R)),x>>>=3,E-=3}else{for(F=R+7;E>>=R)),x>>>=7,E-=7}if(r.have+I>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=p;break}for(;I--;)r.lens[r.have++]=z}}if(r.mode===p)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=p;break}if(r.lenbits=9,N={bits:r.lenbits},D=s(h,r.lens,0,r.nlen,r.lencode,0,r.work,N),r.lenbits=N.bits,D){t.msg="invalid literal/lengths set",r.mode=p;break}if(r.distbits=6,r.distcode=r.distdyn,N={bits:r.distbits},D=s(l,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,N),r.distbits=N.bits,D){t.msg="invalid distances set",r.mode=p;break}if(r.mode=20,6===e)break t;case 20:r.mode=21;case 21:if(w>=6&&v>=258){t.next_out=y,t.avail_out=v,t.next_in=_,t.avail_in=w,r.hold=x,r.bits=E,o(t,S),y=t.next_out,g=t.output,v=t.avail_out,_=t.next_in,m=t.input,w=t.avail_in,x=r.hold,E=r.bits,r.mode===d&&(r.back=-1);break}for(r.back=0;P=(j=r.lencode[x&(1<>>16&255,O=65535&j,!((R=j>>>24)<=E);){if(0===w)break t;w--,x+=m[_++]<>L)])>>>16&255,O=65535&j,!(L+(R=j>>>24)<=E);){if(0===w)break t;w--,x+=m[_++]<>>=L,E-=L,r.back+=L}if(x>>>=R,E-=R,r.back+=R,r.length=O,0===P){r.mode=26;break}if(32&P){r.back=-1,r.mode=d;break}if(64&P){t.msg="invalid literal/length code",r.mode=p;break}r.extra=15&P,r.mode=22;case 22:if(r.extra){for(F=r.extra;E>>=r.extra,E-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;P=(j=r.distcode[x&(1<>>16&255,O=65535&j,!((R=j>>>24)<=E);){if(0===w)break t;w--,x+=m[_++]<>L)])>>>16&255,O=65535&j,!(L+(R=j>>>24)<=E);){if(0===w)break t;w--,x+=m[_++]<>>=L,E-=L,r.back+=L}if(x>>>=R,E-=R,r.back+=R,64&P){t.msg="invalid distance code",r.mode=p;break}r.offset=O,r.extra=15&P,r.mode=24;case 24:if(r.extra){for(F=r.extra;E>>=r.extra,E-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=p;break}r.mode=25;case 25:if(0===v)break t;if(I=S-v,r.offset>I){if((I=r.offset-I)>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=p;break}I>r.wnext?(I-=r.wnext,B=r.wsize-I):B=r.wnext-I,I>r.length&&(I=r.length),T=r.window}else T=g,B=y-r.offset,I=r.length;I>v&&(I=v),v-=I,r.length-=I;do{g[y++]=T[B++]}while(--I);0===r.length&&(r.mode=21);break;case 26:if(0===v)break t;g[y++]=r.length,v--,r.mode=21;break;case 27:if(r.wrap){for(;E<32;){if(0===w)break t;w--,x|=m[_++]<{"use strict";var i=r(9761),n=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],o=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],s=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(t,e,r,h,l,f,u,c){var d,p,m,g,b,_,y,w,v,x=c.bits,E=0,k=0,S=0,M=0,A=0,I=0,B=0,T=0,R=0,P=0,O=null,L=0,C=new i.Buf16(16),U=new i.Buf16(16),z=null,D=0;for(E=0;E<=15;E++)C[E]=0;for(k=0;k=1&&0===C[M];M--);if(A>M&&(A=M),0===M)return l[f++]=20971520,l[f++]=20971520,c.bits=1,0;for(S=1;S0&&(0===t||1!==M))return-1;for(U[1]=0,E=1;E<15;E++)U[E+1]=U[E]+C[E];for(k=0;k852||2===t&&R>592)return 1;for(;;){y=E-B,u[k]<_?(w=0,v=u[k]):u[k]>_?(w=z[D+u[k]],v=O[L+u[k]]):(w=96,v=0),d=1<>B)+(p-=d)]=y<<24|w<<16|v|0}while(0!==p);for(d=1<>=1;if(0!==d?(P&=d-1,P+=d):P=0,k++,0==--C[E]){if(E===M)break;E=e[r+u[k]]}if(E>A&&(P&g)!==m){for(0===B&&(B=A),b+=S,T=1<<(I=E-B);I+B852||2===t&&R>592)return 1;l[m=P&g]=A<<24|I<<16|b-f|0}}return 0!==P&&(l[b+P]=E-B<<24|64<<16|0),c.bits=A,0}},2950:t=>{"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},9564:(t,e,r)=>{"use strict";var i=r(9761);function n(t){for(var e=t.length;--e>=0;)t[e]=0}var a=0,o=256,s=o+1+29,h=30,l=19,f=2*s+1,u=15,c=16,d=256,p=16,m=17,g=18,b=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],_=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],y=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],w=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],v=new Array(2*(s+2));n(v);var x=new Array(2*h);n(x);var E=new Array(512);n(E);var k=new Array(256);n(k);var S=new Array(29);n(S);var M,A,I,B=new Array(h);function T(t,e,r,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}function R(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function P(t){return t<256?E[t]:E[256+(t>>>7)]}function O(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function L(t,e,r){t.bi_valid>c-r?(t.bi_buf|=e<>c-t.bi_valid,t.bi_valid+=r-c):(t.bi_buf|=e<>>=1,r<<=1}while(--e>0);return r>>>1}function z(t,e,r){var i,n,a=new Array(u+1),o=0;for(i=1;i<=u;i++)a[i]=o=o+r[i-1]<<1;for(n=0;n<=e;n++){var s=t[2*n+1];0!==s&&(t[2*n]=U(a[s]++,s))}}function D(t){var e;for(e=0;e8?O(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function F(t,e,r,i){var n=2*e,a=2*r;return t[n]>1;r>=1;r--)j(t,a,r);n=h;do{r=t.heap[1],t.heap[1]=t.heap[t.heap_len--],j(t,a,1),i=t.heap[1],t.heap[--t.heap_max]=r,t.heap[--t.heap_max]=i,a[2*n]=a[2*r]+a[2*i],t.depth[n]=(t.depth[r]>=t.depth[i]?t.depth[r]:t.depth[i])+1,a[2*r+1]=a[2*i+1]=n,t.heap[1]=n++,j(t,a,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var r,i,n,a,o,s,h=e.dyn_tree,l=e.max_code,c=e.stat_desc.static_tree,d=e.stat_desc.has_stree,p=e.stat_desc.extra_bits,m=e.stat_desc.extra_base,g=e.stat_desc.max_length,b=0;for(a=0;a<=u;a++)t.bl_count[a]=0;for(h[2*t.heap[t.heap_max]+1]=0,r=t.heap_max+1;rg&&(a=g,b++),h[2*i+1]=a,i>l||(t.bl_count[a]++,o=0,i>=m&&(o=p[i-m]),s=h[2*i],t.opt_len+=s*(a+o),d&&(t.static_len+=s*(c[2*i+1]+o)));if(0!==b){do{for(a=g-1;0===t.bl_count[a];)a--;t.bl_count[a]--,t.bl_count[a+1]+=2,t.bl_count[g]--,b-=2}while(b>0);for(a=g;0!==a;a--)for(i=t.bl_count[a];0!==i;)(n=t.heap[--r])>l||(h[2*n+1]!==a&&(t.opt_len+=(a-h[2*n+1])*h[2*n],h[2*n+1]=a),i--)}}(t,e),z(a,l,t.bl_count)}function W(t,e,r){var i,n,a=-1,o=e[1],s=0,h=7,l=4;for(0===o&&(h=138,l=3),e[2*(r+1)+1]=65535,i=0;i<=r;i++)n=o,o=e[2*(i+1)+1],++s>=7;i0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e=3&&0===t.bl_tree[2*w[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),n=t.opt_len+3+7>>>3,(a=t.static_len+3+7>>>3)<=n&&(n=a)):n=a=r+5,r+4<=n&&-1!==e?Y(t,e,r,i):4===t.strategy||a===n?(L(t,2+(i?1:0),3),G(t,v,x)):(L(t,4+(i?1:0),3),function(t,e,r,i){var n;for(L(t,e-257,5),L(t,r-1,5),L(t,i-4,4),n=0;n>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&r,t.last_lit++,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(k[r]+o+1)]++,t.dyn_dtree[2*P(e)]++),t.last_lit===t.lit_bufsize-1},e._tr_align=function(t){L(t,2,3),C(t,d,v),function(t){16===t.bi_valid?(O(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},744:t=>{"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},4398:t=>{function e(t,e){if(!(t=t.replace(/\t+/g," ").trim()))return null;var i=t.indexOf(" ");if(-1===i)throw new Error("no named row at line "+e);var n=t.substring(0,i);t=(t=(t=(t=t.substring(i+1)).replace(/letter=[\'\"]\S+[\'\"]/gi,"")).split("=")).map((function(t){return t.trim().match(/(".*?"|[^"\s]+)+(?=\s*|\s*$)/g)}));for(var a=[],o=0;o{var e=[66,77,70];function r(t,e,r){if(r>e.length-1)return 0;var n=e.readUInt8(r++),a=e.readInt32LE(r);switch(r+=4,n){case 1:t.info=function(t,e){var r={};r.size=t.readInt16LE(e);var n=t.readUInt8(e+2);return r.smooth=n>>7&1,r.unicode=n>>6&1,r.italic=n>>5&1,r.bold=n>>4&1,n>>3&1&&(r.fixedHeight=1),r.charset=t.readUInt8(e+3)||"",r.stretchH=t.readUInt16LE(e+4),r.aa=t.readUInt8(e+6),r.padding=[t.readInt8(e+7),t.readInt8(e+8),t.readInt8(e+9),t.readInt8(e+10)],r.spacing=[t.readInt8(e+11),t.readInt8(e+12)],r.outline=t.readUInt8(e+13),r.face=function(t,e){return i(t,e).toString("utf8")}(t,e+14),r}(e,r);break;case 2:t.common=function(t,e){var r={};return r.lineHeight=t.readUInt16LE(e),r.base=t.readUInt16LE(e+2),r.scaleW=t.readUInt16LE(e+4),r.scaleH=t.readUInt16LE(e+6),r.pages=t.readUInt16LE(e+8),t.readUInt8(e+10),r.packed=0,r.alphaChnl=t.readUInt8(e+11),r.redChnl=t.readUInt8(e+12),r.greenChnl=t.readUInt8(e+13),r.blueChnl=t.readUInt8(e+14),r}(e,r);break;case 3:t.pages=function(t,e,r){for(var n=[],a=i(t,e),o=a.length+1,s=r/o,h=0;h3)throw new Error("Only supports BMFont Binary v3 (BMFont App v1.10)");for(var a={kernings:[],chars:[]},o=0;o<5;o++)n+=r(a,t,n);return a}},5947:(t,e,r)=>{var i=r(403),n=r(1596),a={scaleh:"scaleH",scalew:"scaleW",stretchh:"stretchH",lineheight:"lineHeight",alphachnl:"alphaChnl",redchnl:"redChnl",greenchnl:"greenChnl",bluechnl:"blueChnl"};function o(t){var e=function(t){for(var e=[],r=0;r element");for(var s=a.getElementsByTagName("page"),h=0;h{var e="chasrset";t.exports=function(t){for(var r in e in t&&(t.charset=t[e],delete t[e]),t)"face"!==r&&"charset"!==r&&(t[r]="padding"===r||"spacing"===r?t[r].split(",").map((function(t){return parseInt(t,10)})):parseInt(t[r],10));return t}},4655:(t,e,r)=>{var i=r(311),n=r(3243);t.exports=function(t){if(!t)return{};var e={};return n(i(t).split("\n"),(function(t){var r,n=t.indexOf(":"),a=i(t.slice(0,n)).toLowerCase(),o=i(t.slice(n+1));void 0===e[a]?e[a]=o:(r=e[a],"[object Array]"===Object.prototype.toString.call(r)?e[a].push(o):e[a]=[e[a],o])})),e}},1023:(t,e,r)=>{"use strict";var i=r(4406);function n(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function a(t,e){for(var r,i="",n=0,a=-1,o=0,s=0;s<=t.length;++s){if(s2){var h=i.lastIndexOf("/");if(h!==i.length-1){-1===h?(i="",n=0):n=(i=i.slice(0,h)).length-1-i.lastIndexOf("/"),a=s,o=0;continue}}else if(2===i.length||1===i.length){i="",n=0,a=s,o=0;continue}e&&(i.length>0?i+="/..":i="..",n=2)}else i.length>0?i+="/"+t.slice(a+1,s):i=t.slice(a+1,s),n=s-a-1;a=s,o=0}else 46===r&&-1!==o?++o:o=-1}return i}var o={resolve:function(){for(var t,e="",r=!1,o=arguments.length-1;o>=-1&&!r;o--){var s;o>=0?s=arguments[o]:(void 0===t&&(t=i.cwd()),s=t),n(s),0!==s.length&&(e=s+"/"+e,r=47===s.charCodeAt(0))}return e=a(e,!r),r?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(t){if(n(t),0===t.length)return".";var e=47===t.charCodeAt(0),r=47===t.charCodeAt(t.length-1);return 0!==(t=a(t,!e)).length||e||(t="."),t.length>0&&r&&(t+="/"),e?"/"+t:t},isAbsolute:function(t){return n(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,e=0;e0&&(void 0===t?t=r:t+="/"+r)}return void 0===t?".":o.normalize(t)},relative:function(t,e){if(n(t),n(e),t===e)return"";if((t=o.resolve(t))===(e=o.resolve(e)))return"";for(var r=1;rl){if(47===e.charCodeAt(s+u))return e.slice(s+u+1);if(0===u)return e.slice(s+u)}else a>l&&(47===t.charCodeAt(r+u)?f=u:0===u&&(f=0));break}var c=t.charCodeAt(r+u);if(c!==e.charCodeAt(s+u))break;47===c&&(f=u)}var d="";for(u=r+f+1;u<=i;++u)u!==i&&47!==t.charCodeAt(u)||(0===d.length?d+="..":d+="/..");return d.length>0?d+e.slice(s+f):(s+=f,47===e.charCodeAt(s)&&++s,e.slice(s))},_makeLong:function(t){return t},dirname:function(t){if(n(t),0===t.length)return".";for(var e=t.charCodeAt(0),r=47===e,i=-1,a=!0,o=t.length-1;o>=1;--o)if(47===(e=t.charCodeAt(o))){if(!a){i=o;break}}else a=!1;return-1===i?r?"/":".":r&&1===i?"//":t.slice(0,i)},basename:function(t,e){if(void 0!==e&&"string"!=typeof e)throw new TypeError('"ext" argument must be a string');n(t);var r,i=0,a=-1,o=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";var s=e.length-1,h=-1;for(r=t.length-1;r>=0;--r){var l=t.charCodeAt(r);if(47===l){if(!o){i=r+1;break}}else-1===h&&(o=!1,h=r+1),s>=0&&(l===e.charCodeAt(s)?-1==--s&&(a=r):(s=-1,a=h))}return i===a?a=h:-1===a&&(a=t.length),t.slice(i,a)}for(r=t.length-1;r>=0;--r)if(47===t.charCodeAt(r)){if(!o){i=r+1;break}}else-1===a&&(o=!1,a=r+1);return-1===a?"":t.slice(i,a)},extname:function(t){n(t);for(var e=-1,r=0,i=-1,a=!0,o=0,s=t.length-1;s>=0;--s){var h=t.charCodeAt(s);if(47!==h)-1===i&&(a=!1,i=s+1),46===h?-1===e?e=s:1!==o&&(o=1):-1!==e&&(o=-1);else if(!a){r=s+1;break}}return-1===e||-1===i||0===o||1===o&&e===i-1&&e===r+1?"":t.slice(e,i)},format:function(t){if(null===t||"object"!=typeof t)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return function(t,e){var r=e.dir||e.root,i=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+i:r+"/"+i:i}(0,t)},parse:function(t){n(t);var e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;var r,i=t.charCodeAt(0),a=47===i;a?(e.root="/",r=1):r=0;for(var o=-1,s=0,h=-1,l=!0,f=t.length-1,u=0;f>=r;--f)if(47!==(i=t.charCodeAt(f)))-1===h&&(l=!1,h=f+1),46===i?-1===o?o=f:1!==u&&(u=1):-1!==o&&(u=-1);else if(!l){s=f+1;break}return-1===o||-1===h||0===u||1===u&&o===h-1&&o===s+1?-1!==h&&(e.base=e.name=0===s&&a?t.slice(1,h):t.slice(s,h)):(0===s&&a?(e.name=t.slice(1,o),e.base=t.slice(1,h)):(e.name=t.slice(s,o),e.base=t.slice(s,h)),e.ext=t.slice(o,h)),s>0?e.dir=t.slice(0,s-1):a&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};o.posix=o,t.exports=o},482:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Deferred=void 0,e.Deferred=class{constructor(){this.resolve=()=>null,this.reject=()=>null,this.promise=new Promise(((t,e)=>{this.reject=e,this.resolve=t}))}}},5567:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EndOfStreamError=e.defaultMessages=void 0,e.defaultMessages="End-Of-Stream";class r extends Error{constructor(){super(e.defaultMessages)}}e.EndOfStreamError=r},4514:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.StreamReader=e.EndOfStreamError=void 0;const i=r(5567),n=r(482);var a=r(5567);Object.defineProperty(e,"EndOfStreamError",{enumerable:!0,get:function(){return a.EndOfStreamError}}),e.StreamReader=class{constructor(t){if(this.s=t,this.deferred=null,this.endOfStream=!1,this.peekQueue=[],!t.read||!t.once)throw new Error("Expected an instance of stream.Readable");this.s.once("end",(()=>this.reject(new i.EndOfStreamError))),this.s.once("error",(t=>this.reject(t))),this.s.once("close",(()=>this.reject(new Error("Stream closed"))))}async peek(t,e,r){const i=await this.read(t,e,r);return this.peekQueue.push(t.subarray(e,e+i)),i}async read(t,e,r){if(0===r)return 0;if(0===this.peekQueue.length&&this.endOfStream)throw new i.EndOfStreamError;let n=r,a=0;for(;this.peekQueue.length>0&&n>0;){const r=this.peekQueue.pop();if(!r)throw new Error("peekData should be defined");const i=Math.min(r.length,n);t.set(r.subarray(0,i),e+a),a+=i,n-=i,i0&&!this.endOfStream;){const r=Math.min(n,1048576),i=await this.readFromStream(t,e+a,r);if(a+=i,i{this.readDeferred(i)})),i.deferred.promise}}readDeferred(t){const e=this.s.read(t.length);e?(t.buffer.set(e,t.offset),t.deferred.resolve(e.length),this.deferred=null):this.s.once("readable",(()=>{this.readDeferred(t)}))}reject(t){this.endOfStream=!0,this.deferred&&(this.deferred.reject(t),this.deferred=null)}}},4644:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.StreamReader=e.EndOfStreamError=void 0;var i=r(5567);Object.defineProperty(e,"EndOfStreamError",{enumerable:!0,get:function(){return i.EndOfStreamError}});var n=r(4514);Object.defineProperty(e,"StreamReader",{enumerable:!0,get:function(){return n.StreamReader}})},1294:t=>{"use strict";function e(t,i,n,a,o,s){for(var h,l,f,u,c=Math.max(i-1,0),d=Math.max(n-1,0),p=Math.min(i+1,a-1),m=Math.min(n+1,o-1),g=4*(n*a+i),b=0,_=0,y=0,w=0,v=0,x=c;x<=p;x++)for(var E=d;E<=m;E++)if(x!==i||E!==n){var k=r(t,t,g,4*(E*a+x),!0);if(0===k?b++:k<0?y++:k>0&&_++,b>2)return!1;s&&(kv&&(v=k,f=x,u=E))}return!s||0!==y&&0!==_&&(!e(t,h,l,a,o)&&!e(s,h,l,a,o)||!e(t,f,u,a,o)&&!e(s,f,u,a,o))}function r(t,e,r,s,h){var l=t[r+3]/255,f=e[s+3]/255,u=o(t[r+0],l),c=o(t[r+1],l),d=o(t[r+2],l),p=o(e[s+0],f),m=o(e[s+1],f),g=o(e[s+2],f),b=i(u,c,d)-i(p,m,g);if(h)return b;var _=n(u,c,d)-n(p,m,g),y=a(u,c,d)-a(p,m,g);return.5053*b*b+.299*_*_+.1957*y*y}function i(t,e,r){return.29889531*t+.58662247*e+.11448223*r}function n(t,e,r){return.59597799*t-.2741761*e-.32180189*r}function a(t,e,r){return.21147017*t-.52261711*e+.31114694*r}function o(t,e){return 255+(t-255)*e}function s(t,e,r,i,n){t[e+0]=r,t[e+1]=i,t[e+2]=n,t[e+3]=255}t.exports=function(t,n,a,h,l,f){f||(f={});for(var u=void 0===f.threshold?.1:f.threshold,c=35215*u*u,d=0,p=0;pc)f.includeAA||!e(t,m,p,h,l,n)&&!e(n,m,p,h,l,t)?(a&&s(a,g,255,0,0),d++):a&&s(a,g,255,255,0);else if(a){var b=o((void 0,void 0,void 0,void 0,w=(_=t)[(y=g)+3]/255,i(o(_[y+0],w),o(_[y+1],w),o(_[y+2],w))),.1);s(a,g,b,b,b)}}var _,y,w;return d}},9902:(t,e,r)=>{t.exports=function t(e,r,i){function n(o,s){if(!r[o]){if(!e[o]){if(a)return a(o,!0);var h=new Error("Cannot find module '"+o+"'");throw h.code="MODULE_NOT_FOUND",h}var l=r[o]={exports:{}};e[o][0].call(l.exports,(function(t){return n(e[o][1][t]||t)}),l,l.exports,t,e,r,i)}return r[o].exports}for(var a=void 0,o=0;o=e.length)throw new Error("Ran out of data");let n=e[i];t[r]=n,t[r+1]=n,t[r+2]=n,t[r+3]=e[i+1]},function(t,e,r,i){if(i+2>=e.length)throw new Error("Ran out of data");t[r]=e[i],t[r+1]=e[i+1],t[r+2]=e[i+2],t[r+3]=255},function(t,e,r,i){if(i+3>=e.length)throw new Error("Ran out of data");t[r]=e[i],t[r+1]=e[i+1],t[r+2]=e[i+2],t[r+3]=e[i+3]}],a=[function(){},function(t,e,r,i){let n=e[0];t[r]=n,t[r+1]=n,t[r+2]=n,t[r+3]=i},function(t,e,r){let i=e[0];t[r]=i,t[r+1]=i,t[r+2]=i,t[r+3]=e[1]},function(t,e,r,i){t[r]=e[0],t[r+1]=e[1],t[r+2]=e[2],t[r+3]=i},function(t,e,r){t[r]=e[0],t[r+1]=e[1],t[r+2]=e[2],t[r+3]=e[3]}];function o(t,e,r,i,a,o){let s=t.width,h=t.height,l=t.index;for(let t=0;t>4,r.push(u,f);break;case 2:h=3&c,l=c>>2&3,f=c>>4&3,u=c>>6&3,r.push(u,f,l,h);break;case 1:n=1&c,a=c>>1&1,o=c>>2&1,s=c>>3&1,h=c>>4&1,l=c>>5&1,f=c>>6&1,u=c>>7&1,r.push(u,f,l,h,s,o,a,n)}}return{get:function(t){for(;r.length0&&(this._paused=!1,this.emit("drain"))}.bind(this))},o.prototype.write=function(t,e){if(!this.writable)return this.emit("error",new Error("Stream not writable")),!1;let r;return r=i.isBuffer(t)?t:i.from(t,e||this._encoding),this._buffers.push(r),this._buffered+=r.length,this._process(),this._reads&&0===this._reads.length&&(this._paused=!0),this.writable&&!this._paused},o.prototype.end=function(t,e){t&&this.write(t,e),this.writable=!1,this._buffers&&(0===this._buffers.length?this._end():(this._buffers.push(null),this._process()))},o.prototype.destroySoon=o.prototype.end,o.prototype._end=function(){this._reads.length>0&&this.emit("error",new Error("Unexpected end of input")),this.destroy()},o.prototype.destroy=function(){this._buffers&&(this.writable=!1,this._reads=null,this._buffers=null,this.emit("close"))},o.prototype._processReadAllowingLess=function(t){this._reads.shift();let e=this._buffers[0];e.length>t.length?(this._buffered-=t.length,this._buffers[0]=e.slice(t.length),t.func.call(this,e.slice(0,t.length))):(this._buffered-=e.length,this._buffers.shift(),t.func.call(this,e))},o.prototype._processRead=function(t){this._reads.shift();let e=0,r=0,n=i.alloc(t.length);for(;e0&&this._buffers.splice(0,r),this._buffered-=t.length,t.func.call(this,n)},o.prototype._process=function(){try{for(;this._buffered>0&&this._reads&&this._reads.length>0;){let t=this._reads[0];if(t.allowLess)this._processReadAllowingLess(t);else{if(!(this._buffered>=t.length))break;this._processRead(t)}}this._buffers&&!this.writable&&this._end()}catch(t){this.emit("error",t)}}}).call(this)}).call(this,t("_process"),t("buffer").Buffer)},{_process:60,buffer:33,stream:61,util:81}],4:[function(t,e,r){"use strict";e.exports={PNG_SIGNATURE:[137,80,78,71,13,10,26,10],TYPE_IHDR:1229472850,TYPE_IEND:1229278788,TYPE_IDAT:1229209940,TYPE_PLTE:1347179589,TYPE_tRNS:1951551059,TYPE_gAMA:1732332865,COLORTYPE_GRAYSCALE:0,COLORTYPE_PALETTE:1,COLORTYPE_COLOR:2,COLORTYPE_ALPHA:4,COLORTYPE_PALETTE_COLOR:3,COLORTYPE_COLOR_ALPHA:6,COLORTYPE_TO_BPP_MAP:{0:1,2:3,3:1,4:2,6:4},GAMMA_DIVISION:1e5}},{}],5:[function(t,e,r){"use strict";let i=[];!function(){for(let t=0;t<256;t++){let e=t;for(let t=0;t<8;t++)1&e?e=3988292384^e>>>1:e>>>=1;i[t]=e}}();let n=e.exports=function(){this._crc=-1};n.prototype.write=function(t){for(let e=0;e>>8;return!0},n.prototype.crc32=function(){return-1^this._crc},n.crc32=function(t){let e=-1;for(let r=0;r>>8;return-1^e}},{}],6:[function(t,e,r){(function(r){(function(){"use strict";let i=t("./paeth-predictor");let n={0:function(t,e,r,i,n){for(let a=0;a=a?t[e+o-a]:0,s=t[e+o]-r;i[n+o]=s}},2:function(t,e,r,i,n){for(let a=0;a0?t[e+a-r]:0,s=t[e+a]-o;i[n+a]=s}},3:function(t,e,r,i,n,a){for(let o=0;o=a?t[e+o-a]:0,h=e>0?t[e+o-r]:0,l=t[e+o]-(s+h>>1);i[n+o]=l}},4:function(t,e,r,n,a,o){for(let s=0;s=o?t[e+s-o]:0,l=e>0?t[e+s-r]:0,f=e>0&&s>=o?t[e+s-(r+o)]:0,u=t[e+s]-i(h,l,f);n[a+s]=u}}},a={0:function(t,e,r){let i=0,n=e+r;for(let r=e;r=i?t[e+a-i]:0,o=t[e+a]-r;n+=Math.abs(o)}return n},2:function(t,e,r){let i=0,n=e+r;for(let a=e;a0?t[a-r]:0,o=t[a]-n;i+=Math.abs(o)}return i},3:function(t,e,r,i){let n=0;for(let a=0;a=i?t[e+a-i]:0,s=e>0?t[e+a-r]:0,h=t[e+a]-(o+s>>1);n+=Math.abs(h)}return n},4:function(t,e,r,n){let a=0;for(let o=0;o=n?t[e+o-n]:0,h=e>0?t[e+o-r]:0,l=e>0&&o>=n?t[e+o-(r+n)]:0,f=t[e+o]-i(s,h,l);a+=Math.abs(f)}return a}};e.exports=function(t,e,i,o,s){let h;if("filterType"in o&&-1!==o.filterType){if("number"!=typeof o.filterType)throw new Error("unrecognised filter types");h=[o.filterType]}else h=[0,1,2,3,4];16===o.bitDepth&&(s*=2);let l=e*s,f=0,u=0,c=r.alloc((l+1)*i),d=h[0];for(let e=0;e1){let e=1/0;for(let r=0;rn?e[a-i]:0;e[a]=r+o}},o.prototype._unFilterType2=function(t,e,r){let i=this._lastLine;for(let n=0;nn?e[o-i]:0,l=Math.floor((h+s)/2);e[o]=r+l}},o.prototype._unFilterType4=function(t,e,r){let i=this._xComparison,a=i-1,o=this._lastLine;for(let s=0;sa?e[s-i]:0,f=s>a&&o?o[s-i]:0,u=n(l,h,f);e[s]=r+u}},o.prototype._reverseFilterLine=function(t){let e,i=t[0],n=this._images[this._imageIndex],a=n.byteWidth;if(0===i)e=t.slice(1,a+1);else switch(e=r.alloc(a),i){case 1:this._unFilterType1(t,e,a);break;case 2:this._unFilterType2(t,e,a);break;case 3:this._unFilterType3(t,e,a);break;case 4:this._unFilterType4(t,e,a);break;default:throw new Error("Unrecognised filter type - "+i)}this.write(e),n.lineIndex++,n.lineIndex>=n.height?(this._lastLine=null,this._imageIndex++,n=this._images[this._imageIndex]):this._lastLine=e,n?this.read(n.byteWidth+1,this._reverseFilterLine.bind(this)):(this._lastLine=null,this.complete())}}).call(this)}).call(this,t("buffer").Buffer)},{"./interlace":11,"./paeth-predictor":15,buffer:33}],10:[function(t,e,r){(function(t){(function(){"use strict";e.exports=function(e,r,i=!1){let n=r.depth,a=r.width,o=r.height,s=r.colorType,h=r.transColor,l=r.palette,f=e;return 3===s?function(t,e,r,i,n){let a=0;for(let o=0;o0&&l>0&&r.push({width:h,height:l,index:t})}return r},r.getInterlaceIterator=function(t){return function(e,r,n){let a=e%i[n].x.length,o=(e-a)/i[n].x.length*8+i[n].x[a],s=r%i[n].y.length;return 4*o+((r-s)/i[n].y.length*8+i[n].y[s])*t*4}}},{}],12:[function(t,e,r){(function(r){(function(){"use strict";let i=t("util"),n=t("stream"),a=t("./constants"),o=t("./packer"),s=e.exports=function(t){n.call(this);let e=t||{};this._packer=new o(e),this._deflate=this._packer.createDeflate(),this.readable=!0};i.inherits(s,n),s.prototype.pack=function(t,e,i,n){this.emit("data",r.from(a.PNG_SIGNATURE)),this.emit("data",this._packer.packIHDR(e,i)),n&&this.emit("data",this._packer.packGAMA(n));let o=this._packer.filterData(t,e,i);this._deflate.on("error",this.emit.bind(this,"error")),this._deflate.on("data",function(t){this.emit("data",this._packer.packIDAT(t))}.bind(this)),this._deflate.on("end",function(){this.emit("data",this._packer.packIEND()),this.emit("end")}.bind(this)),this._deflate.end(o)}}).call(this)}).call(this,t("buffer").Buffer)},{"./constants":4,"./packer":14,buffer:33,stream:61,util:81}],13:[function(t,e,r){(function(r){(function(){"use strict";let i=!0,n=t("zlib");n.deflateSync||(i=!1);let a=t("./constants"),o=t("./packer");e.exports=function(t,e){if(!i)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let s=new o(e||{}),h=[];h.push(r.from(a.PNG_SIGNATURE)),h.push(s.packIHDR(t.width,t.height)),t.gamma&&h.push(s.packGAMA(t.gamma));let l=s.filterData(t.data,t.width,t.height),f=n.deflateSync(l,s.getDeflateOptions());if(l=null,!f||!f.length)throw new Error("bad png - invalid compressed data response");return h.push(s.packIDAT(f)),h.push(s.packIEND()),r.concat(h)}}).call(this)}).call(this,t("buffer").Buffer)},{"./constants":4,"./packer":14,buffer:33,zlib:32}],14:[function(t,e,r){(function(r){(function(){"use strict";let i=t("./constants"),n=t("./crc"),a=t("./bitpacker"),o=t("./filter-pack"),s=t("zlib"),h=e.exports=function(t){if(this._options=t,t.deflateChunkSize=t.deflateChunkSize||32768,t.deflateLevel=null!=t.deflateLevel?t.deflateLevel:9,t.deflateStrategy=null!=t.deflateStrategy?t.deflateStrategy:3,t.inputHasAlpha=null==t.inputHasAlpha||t.inputHasAlpha,t.deflateFactory=t.deflateFactory||s.createDeflate,t.bitDepth=t.bitDepth||8,t.colorType="number"==typeof t.colorType?t.colorType:i.COLORTYPE_COLOR_ALPHA,t.inputColorType="number"==typeof t.inputColorType?t.inputColorType:i.COLORTYPE_COLOR_ALPHA,-1===[i.COLORTYPE_GRAYSCALE,i.COLORTYPE_COLOR,i.COLORTYPE_COLOR_ALPHA,i.COLORTYPE_ALPHA].indexOf(t.colorType))throw new Error("option color type:"+t.colorType+" is not supported at present");if(-1===[i.COLORTYPE_GRAYSCALE,i.COLORTYPE_COLOR,i.COLORTYPE_COLOR_ALPHA,i.COLORTYPE_ALPHA].indexOf(t.inputColorType))throw new Error("option input color type:"+t.inputColorType+" is not supported at present");if(8!==t.bitDepth&&16!==t.bitDepth)throw new Error("option bit depth:"+t.bitDepth+" is not supported at present")};h.prototype.getDeflateOptions=function(){return{chunkSize:this._options.deflateChunkSize,level:this._options.deflateLevel,strategy:this._options.deflateStrategy}},h.prototype.createDeflate=function(){return this._options.deflateFactory(this.getDeflateOptions())},h.prototype.filterData=function(t,e,r){let n=a(t,e,r,this._options),s=i.COLORTYPE_TO_BPP_MAP[this._options.colorType];return o(n,e,r,this._options,s)},h.prototype._packChunk=function(t,e){let i=e?e.length:0,a=r.alloc(i+12);return a.writeUInt32BE(i,0),a.writeUInt32BE(t,4),e&&e.copy(a,8),a.writeInt32BE(n.crc32(a.slice(4,a.length-4)),a.length-4),a},h.prototype.packGAMA=function(t){let e=r.alloc(4);return e.writeUInt32BE(Math.floor(t*i.GAMMA_DIVISION),0),this._packChunk(i.TYPE_gAMA,e)},h.prototype.packIHDR=function(t,e){let n=r.alloc(13);return n.writeUInt32BE(t,0),n.writeUInt32BE(e,4),n[8]=this._options.bitDepth,n[9]=this._options.colorType,n[10]=0,n[11]=0,n[12]=0,this._packChunk(i.TYPE_IHDR,n)},h.prototype.packIDAT=function(t){return this._packChunk(i.TYPE_IDAT,t)},h.prototype.packIEND=function(){return this._packChunk(i.TYPE_IEND,null)}}).call(this)}).call(this,t("buffer").Buffer)},{"./bitpacker":2,"./constants":4,"./crc":5,"./filter-pack":6,buffer:33,zlib:32}],15:[function(t,e,r){"use strict";e.exports=function(t,e,r){let i=t+e-r,n=Math.abs(i-t),a=Math.abs(i-e),o=Math.abs(i-r);return n<=a&&n<=o?t:a<=o?e:r}},{}],16:[function(t,e,r){"use strict";let i=t("util"),n=t("zlib"),a=t("./chunkstream"),o=t("./filter-parse-async"),s=t("./parser"),h=t("./bitmapper"),l=t("./format-normaliser"),f=e.exports=function(t){a.call(this),this._parser=new s(t,{read:this.read.bind(this),error:this._handleError.bind(this),metadata:this._handleMetaData.bind(this),gamma:this.emit.bind(this,"gamma"),palette:this._handlePalette.bind(this),transColor:this._handleTransColor.bind(this),finished:this._finished.bind(this),inflateData:this._inflateData.bind(this),simpleTransparency:this._simpleTransparency.bind(this),headersFinished:this._headersFinished.bind(this)}),this._options=t,this.writable=!0,this._parser.start()};i.inherits(f,a),f.prototype._handleError=function(t){this.emit("error",t),this.writable=!1,this.destroy(),this._inflate&&this._inflate.destroy&&this._inflate.destroy(),this._filter&&(this._filter.destroy(),this._filter.on("error",(function(){}))),this.errord=!0},f.prototype._inflateData=function(t){if(!this._inflate)if(this._bitmapInfo.interlace)this._inflate=n.createInflate(),this._inflate.on("error",this.emit.bind(this,"error")),this._filter.on("complete",this._complete.bind(this)),this._inflate.pipe(this._filter);else{let t=(1+(this._bitmapInfo.width*this._bitmapInfo.bpp*this._bitmapInfo.depth+7>>3))*this._bitmapInfo.height,e=Math.max(t,n.Z_MIN_CHUNK);this._inflate=n.createInflate({chunkSize:e});let r=t,i=this.emit.bind(this,"error");this._inflate.on("error",(function(t){r&&i(t)})),this._filter.on("complete",this._complete.bind(this));let a=this._filter.write.bind(this._filter);this._inflate.on("data",(function(t){r&&(t.length>r&&(t=t.slice(0,r)),r-=t.length,a(t))})),this._inflate.on("end",this._filter.end.bind(this._filter))}this._inflate.write(t)},f.prototype._handleMetaData=function(t){this._metaData=t,this._bitmapInfo=Object.create(t),this._filter=new o(this._bitmapInfo)},f.prototype._handleTransColor=function(t){this._bitmapInfo.transColor=t},f.prototype._handlePalette=function(t){this._bitmapInfo.palette=t},f.prototype._simpleTransparency=function(){this._metaData.alpha=!0},f.prototype._headersFinished=function(){this.emit("metadata",this._metaData)},f.prototype._finished=function(){this.errord||(this._inflate?this._inflate.end():this.emit("error","No Inflate block"))},f.prototype._complete=function(t){if(this.errord)return;let e;try{let r=h.dataToBitMap(t,this._bitmapInfo);e=l(r,this._bitmapInfo,this._options.skipRescale),r=null}catch(t){return void this._handleError(t)}this.emit("parsed",e)}},{"./bitmapper":1,"./chunkstream":3,"./filter-parse-async":7,"./format-normaliser":10,"./parser":18,util:81,zlib:32}],17:[function(t,e,r){(function(r){(function(){"use strict";let i=!0,n=t("zlib"),a=t("./sync-inflate");n.deflateSync||(i=!1);let o=t("./sync-reader"),s=t("./filter-parse-sync"),h=t("./parser"),l=t("./bitmapper"),f=t("./format-normaliser");e.exports=function(t,e){if(!i)throw new Error("To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0");let u,c,d;let p=[];let m=new o(t);if(new h(e,{read:m.read.bind(m),error:function(t){u=t},metadata:function(t){c=t},gamma:function(t){d=t},palette:function(t){c.palette=t},transColor:function(t){c.transColor=t},inflateData:function(t){p.push(t)},simpleTransparency:function(){c.alpha=!0}}).start(),m.process(),u)throw u;let g,b=r.concat(p);if(p.length=0,c.interlace)g=n.inflateSync(b);else{let t=(1+(c.width*c.bpp*c.depth+7>>3))*c.height;g=a(b,{chunkSize:t,maxLength:t})}if(b=null,!g||!g.length)throw new Error("bad png - invalid inflate data response");let _=s.process(g,c);b=null;let y=l.dataToBitMap(_,c);_=null;let w=f(y,c,e.skipRescale);return c.data=w,c.gamma=d||0,c}}).call(this)}).call(this,t("buffer").Buffer)},{"./bitmapper":1,"./filter-parse-sync":8,"./format-normaliser":10,"./parser":18,"./sync-inflate":21,"./sync-reader":22,buffer:33,zlib:32}],18:[function(t,e,r){(function(r){(function(){"use strict";let i=t("./constants"),n=t("./crc"),a=e.exports=function(t,e){this._options=t,t.checkCRC=!1!==t.checkCRC,this._hasIHDR=!1,this._hasIEND=!1,this._emittedHeadersFinished=!1,this._palette=[],this._colorType=0,this._chunks={},this._chunks[i.TYPE_IHDR]=this._handleIHDR.bind(this),this._chunks[i.TYPE_IEND]=this._handleIEND.bind(this),this._chunks[i.TYPE_IDAT]=this._handleIDAT.bind(this),this._chunks[i.TYPE_PLTE]=this._handlePLTE.bind(this),this._chunks[i.TYPE_tRNS]=this._handleTRNS.bind(this),this._chunks[i.TYPE_gAMA]=this._handleGAMA.bind(this),this.read=e.read,this.error=e.error,this.metadata=e.metadata,this.gamma=e.gamma,this.transColor=e.transColor,this.palette=e.palette,this.parsed=e.parsed,this.inflateData=e.inflateData,this.finished=e.finished,this.simpleTransparency=e.simpleTransparency,this.headersFinished=e.headersFinished||function(){}};a.prototype.start=function(){this.read(i.PNG_SIGNATURE.length,this._parseSignature.bind(this))},a.prototype._parseSignature=function(t){let e=i.PNG_SIGNATURE;for(let r=0;rthis._palette.length)return void this.error(new Error("More transparent colors than palette size"));for(let e=0;e0?this._handleIDAT(r):this._handleChunkEnd()},a.prototype._handleIEND=function(t){this.read(t,this._parseIEND.bind(this))},a.prototype._parseIEND=function(t){this._crc.write(t),this._hasIEND=!0,this._handleChunkEnd(),this.finished&&this.finished()}}).call(this)}).call(this,t("buffer").Buffer)},{"./constants":4,"./crc":5,buffer:33}],19:[function(t,e,r){"use strict";let i=t("./parser-sync"),n=t("./packer-sync");r.read=function(t,e){return i(t,e||{})},r.write=function(t,e){return n(t,e)}},{"./packer-sync":13,"./parser-sync":17}],20:[function(t,e,r){(function(e,i){(function(){"use strict";let n=t("util"),a=t("stream"),o=t("./parser-async"),s=t("./packer-async"),h=t("./png-sync"),l=r.PNG=function(t){a.call(this),t=t||{},this.width=0|t.width,this.height=0|t.height,this.data=this.width>0&&this.height>0?i.alloc(4*this.width*this.height):null,t.fill&&this.data&&this.data.fill(0),this.gamma=0,this.readable=this.writable=!0,this._parser=new o(t),this._parser.on("error",this.emit.bind(this,"error")),this._parser.on("close",this._handleClose.bind(this)),this._parser.on("metadata",this._metadata.bind(this)),this._parser.on("gamma",this._gamma.bind(this)),this._parser.on("parsed",function(t){this.data=t,this.emit("parsed",t)}.bind(this)),this._packer=new s(t),this._packer.on("data",this.emit.bind(this,"data")),this._packer.on("end",this.emit.bind(this,"end")),this._parser.on("close",this._handleClose.bind(this)),this._packer.on("error",this.emit.bind(this,"error"))};n.inherits(l,a),l.sync=h,l.prototype.pack=function(){return this.data&&this.data.length?(e.nextTick(function(){this._packer.pack(this.data,this.width,this.height,this.gamma)}.bind(this)),this):(this.emit("error","No data provided"),this)},l.prototype.parse=function(t,e){if(e){let t,r;t=function(t){this.removeListener("error",r),this.data=t,e(null,this)}.bind(this),r=function(r){this.removeListener("parsed",t),e(r,null)}.bind(this),this.once("parsed",t),this.once("error",r)}return this.end(t),this},l.prototype.write=function(t){return this._parser.write(t),!0},l.prototype.end=function(t){this._parser.end(t)},l.prototype._metadata=function(t){this.width=t.width,this.height=t.height,this.emit("metadata",t)},l.prototype._gamma=function(t){this.gamma=t},l.prototype._handleClose=function(){this._parser.writable||this._packer.readable||this.emit("close")},l.bitblt=function(t,e,r,i,n,a,o,s){if(i|=0,n|=0,a|=0,o|=0,s|=0,(r|=0)>t.width||i>t.height||r+n>t.width||i+a>t.height)throw new Error("bitblt reading outside image");if(o>e.width||s>e.height||o+n>e.width||s+a>e.height)throw new Error("bitblt writing outside image");for(let h=0;h=0,"have should not go down"),r>0){let t=l._buffer.slice(l._offset,l._offset+r);if(l._offset+=r,t.length>d&&(t=t.slice(0,d)),m.push(t),g+=t.length,d-=t.length,0===d)return!1}return(0===e||l._offset>=l._chunkSize)&&(c=l._chunkSize,l._offset=0,l._buffer=n.allocUnsafe(l._chunkSize)),0===e&&(p+=u-t,u=t,!0)}this.on("error",(function(t){i=t})),a(this._handle,"zlib binding closed");do{s=this._handle.writeSync(e,t,p,u,this._buffer,this._offset,c),s=s||this._writeState}while(!this._hadError&&b(s[0],s[1]));if(this._hadError)throw i;if(g>=h)throw f(this),new RangeError("Cannot create final Buffer. It would be larger than 0x"+h.toString(16)+" bytes");let _=n.concat(m,g);return f(this),_},s.inherits(l,o.Inflate),e.exports=r=u,r.Inflate=l,r.createInflate=function(t){return new l(t)},r.inflateSync=u}).call(this)}).call(this,t("_process"),t("buffer").Buffer)},{_process:60,assert:23,buffer:33,util:81,zlib:32}],22:[function(t,e,r){"use strict";let i=e.exports=function(t){this._buffer=t,this._reads=[]};i.prototype.read=function(t,e){this._reads.push({length:Math.abs(t),allowLess:t<0,func:e})},i.prototype.process=function(){for(;this._reads.length>0&&this._buffer.length;){let t=this._reads[0];if(!this._buffer.length||!(this._buffer.length>=t.length||t.allowLess))break;{this._reads.shift();let e=this._buffer;this._buffer=e.slice(t.length),t.func.call(this,e.slice(0,t.length))}}if(this._reads.length>0)throw new Error("There are some read requests waitng on finished stream");if(this._buffer.length>0)throw new Error("unrecognised content at end of stream")}},{}],23:[function(t,e,i){(function(r){(function(){"use strict";function i(t,e){if(t===e)return 0;for(var r=t.length,i=e.length,n=0,a=Math.min(r,i);n=0;l--)if(f[l]!==u[l])return!1;for(l=f.length-1;l>=0;l--)if(!_(t[h=f[l]],e[h],r,i))return!1;return!0}(t,e,r,o))}return r?t===e:t==e}function y(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function w(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function v(t,e,r,i){var n;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(i=r,r=null),n=function(t){var e;try{t()}catch(t){e=t}return e}(e),i=(r&&r.name?" ("+r.name+").":".")+(i?" "+i:"."),t&&!n&&g(n,r,"Missing expected exception"+i);var o="string"==typeof i,s=!t&&n&&!r;if((!t&&a.isError(n)&&o&&w(n,r)||s)&&g(n,r,"Got unwanted exception"+i),t&&n&&r&&!w(n,r)||!t&&n)throw n}u.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return p(m(t.actual),128)+" "+t.operator+" "+p(m(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||g;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var i=r.stack,n=d(e),a=i.indexOf("\n"+n);if(a>=0){var o=i.indexOf("\n",a+1);i=i.substring(o+1)}this.stack=i}}},a.inherits(u.AssertionError,Error),u.fail=g,u.ok=b,u.equal=function(t,e,r){t!=e&&g(t,e,r,"==",u.equal)},u.notEqual=function(t,e,r){t==e&&g(t,e,r,"!=",u.notEqual)},u.deepEqual=function(t,e,r){_(t,e,!1)||g(t,e,r,"deepEqual",u.deepEqual)},u.deepStrictEqual=function(t,e,r){_(t,e,!0)||g(t,e,r,"deepStrictEqual",u.deepStrictEqual)},u.notDeepEqual=function(t,e,r){_(t,e,!1)&&g(t,e,r,"notDeepEqual",u.notDeepEqual)},u.notDeepStrictEqual=function t(e,r,i){_(e,r,!0)&&g(e,r,i,"notDeepStrictEqual",t)},u.strictEqual=function(t,e,r){t!==e&&g(t,e,r,"===",u.strictEqual)},u.notStrictEqual=function(t,e,r){t===e&&g(t,e,r,"!==",u.notStrictEqual)},u.throws=function(t,e,r){v(!0,t,e,r)},u.doesNotThrow=function(t,e,r){v(!1,t,e,r)},u.ifError=function(t){if(t)throw t};var x=Object.keys||function(t){var e=[];for(var r in t)o.call(t,r)&&e.push(r);return e}}).call(this)}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":26}],24:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],25:[function(t,e,r){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],26:[function(t,e,i){(function(e,r){(function(){var n=/%[sdj%]/g;i.format=function(t){if(!b(t)){for(var e=[],r=0;r=a)return t;switch(t){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(t){return"[Circular]"}default:return t}})),h=i[r];r=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),p(e)?r.showHidden=e:e&&i._extend(r,e),_(r.showHidden)&&(r.showHidden=!1),_(r.depth)&&(r.depth=2),_(r.colors)&&(r.colors=!1),_(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=h),f(r,t,r.depth)}function h(t,e){var r=s.styles[e];return r?"["+s.colors[r][0]+"m"+t+"["+s.colors[r][1]+"m":t}function l(t,e){return t}function f(t,e,r){if(t.customInspect&&e&&E(e.inspect)&&e.inspect!==i.inspect&&(!e.constructor||e.constructor.prototype!==e)){var n=e.inspect(r,t);return b(n)||(n=f(t,n,r)),n}var a=function(t,e){if(_(e))return t.stylize("undefined","undefined");if(b(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return g(e)?t.stylize(""+e,"number"):p(e)?t.stylize(""+e,"boolean"):m(e)?t.stylize("null","null"):void 0}(t,e);if(a)return a;var o=Object.keys(e),s=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),x(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return u(e);if(0===o.length){if(E(e)){var h=e.name?": "+e.name:"";return t.stylize("[Function"+h+"]","special")}if(y(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(v(e))return t.stylize(Date.prototype.toString.call(e),"date");if(x(e))return u(e)}var l,w="",k=!1,S=["{","}"];return d(e)&&(k=!0,S=["[","]"]),E(e)&&(w=" [Function"+(e.name?": "+e.name:"")+"]"),y(e)&&(w=" "+RegExp.prototype.toString.call(e)),v(e)&&(w=" "+Date.prototype.toUTCString.call(e)),x(e)&&(w=" "+u(e)),0!==o.length||k&&0!=e.length?r<0?y(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),l=k?function(t,e,r,i,n){for(var a=[],o=0,s=e.length;o60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}(l,w,S)):S[0]+w+S[1]}function u(t){return"["+Error.prototype.toString.call(t)+"]"}function c(t,e,r,i,n,a){var o,s,h;if((h=Object.getOwnPropertyDescriptor(e,n)||{value:e[n]}).get?s=h.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):h.set&&(s=t.stylize("[Setter]","special")),A(i,n)||(o="["+n+"]"),s||(t.seen.indexOf(h.value)<0?(s=m(r)?f(t,h.value,null):f(t,h.value,r-1)).indexOf("\n")>-1&&(s=a?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),_(o)){if(a&&n.match(/^\d+$/))return s;(o=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+s}function d(t){return Array.isArray(t)}function p(t){return"boolean"==typeof t}function m(t){return null===t}function g(t){return"number"==typeof t}function b(t){return"string"==typeof t}function _(t){return void 0===t}function y(t){return w(t)&&"[object RegExp]"===k(t)}function w(t){return"object"==typeof t&&null!==t}function v(t){return w(t)&&"[object Date]"===k(t)}function x(t){return w(t)&&("[object Error]"===k(t)||t instanceof Error)}function E(t){return"function"==typeof t}function k(t){return Object.prototype.toString.call(t)}function S(t){return t<10?"0"+t.toString(10):t.toString(10)}i.debuglog=function(t){if(_(a)&&(a=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!o[t])if(new RegExp("\\b"+t+"\\b","i").test(a)){var r=e.pid;o[t]=function(){var e=i.format.apply(i,arguments);console.error("%s %d: %s",t,r,e)}}else o[t]=function(){};return o[t]},i.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},i.isArray=d,i.isBoolean=p,i.isNull=m,i.isNullOrUndefined=function(t){return null==t},i.isNumber=g,i.isString=b,i.isSymbol=function(t){return"symbol"==typeof t},i.isUndefined=_,i.isRegExp=y,i.isObject=w,i.isDate=v,i.isError=x,i.isFunction=E,i.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},i.isBuffer=t("./support/isBuffer");var M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function A(t,e){return Object.prototype.hasOwnProperty.call(t,e)}i.log=function(){var t,e;console.log("%s - %s",(t=new Date,e=[S(t.getHours()),S(t.getMinutes()),S(t.getSeconds())].join(":"),[t.getDate(),M[t.getMonth()],e].join(" ")),i.format.apply(i,arguments))},i.inherits=t("inherits"),i._extend=function(t,e){if(!e||!w(e))return t;for(var r=Object.keys(e),i=r.length;i--;)t[r[i]]=e[r[i]];return t}}).call(this)}).call(this,t("_process"),void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":25,_process:60,inherits:24}],27:[function(t,e,i){(function(r){(function(){"use strict";var i=t("array-filter");e.exports=function(){return i(["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],(function(t){return"function"==typeof r[t]}))}}).call(this)}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"array-filter":28}],28:[function(t,e,r){e.exports=function(t,e,r){if(t.filter)return t.filter(e,r);if(null==t)throw new TypeError;if("function"!=typeof e)throw new TypeError;for(var n=[],a=0;a0?o-4:o;for(r=0;r>16&255,h[f++]=e>>8&255,h[f++]=255&e;return 2===s&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,h[f++]=255&e),1===s&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,h[f++]=e>>8&255,h[f++]=255&e),h},r.fromByteArray=function(t){for(var e,r=t.length,n=r%3,a=[],o=16383,s=0,h=r-n;sh?h:s+o));return 1===n?(e=t[r-1],a.push(i[e>>2]+i[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],a.push(i[e>>10]+i[e>>4&63]+i[e<<2&63]+"=")),a.join("")};for(var i=[],n=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,h=o.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function f(t,e,r){for(var n,a=[],o=e;o>18&63]+i[s>>12&63]+i[s>>6&63]+i[63&s]);var s;return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},{}],30:[function(t,e,r){},{}],31:[function(t,e,r){(function(e,i){(function(){"use strict";var n=t("assert"),a=t("pako/lib/zlib/zstream"),o=t("pako/lib/zlib/deflate.js"),s=t("pako/lib/zlib/inflate.js"),h=t("pako/lib/zlib/constants");for(var l in h)r[l]=h[l];r.NONE=0,r.DEFLATE=1,r.INFLATE=2,r.GZIP=3,r.GUNZIP=4,r.DEFLATERAW=5,r.INFLATERAW=6,r.UNZIP=7;function f(t){if("number"!=typeof t||tr.UNZIP)throw new TypeError("Bad argument");this.dictionary=null,this.err=0,this.flush=0,this.init_done=!1,this.level=0,this.memLevel=0,this.mode=t,this.strategy=0,this.windowBits=0,this.write_in_progress=!1,this.pending_close=!1,this.gzip_id_bytes_read=0}f.prototype.close=function(){this.write_in_progress?this.pending_close=!0:(this.pending_close=!1,n(this.init_done,"close before init"),n(this.mode<=r.UNZIP),this.mode===r.DEFLATE||this.mode===r.GZIP||this.mode===r.DEFLATERAW?o.deflateEnd(this.strm):this.mode!==r.INFLATE&&this.mode!==r.GUNZIP&&this.mode!==r.INFLATERAW&&this.mode!==r.UNZIP||s.inflateEnd(this.strm),this.mode=r.NONE,this.dictionary=null)},f.prototype.write=function(t,e,r,i,n,a,o){return this._write(!0,t,e,r,i,n,a,o)},f.prototype.writeSync=function(t,e,r,i,n,a,o){return this._write(!1,t,e,r,i,n,a,o)},f.prototype._write=function(t,a,o,s,h,l,f,u){if(n.equal(arguments.length,8),n(this.init_done,"write before init"),n(this.mode!==r.NONE,"already finalized"),n.equal(!1,this.write_in_progress,"write already in progress"),n.equal(!1,this.pending_close,"close is pending"),this.write_in_progress=!0,n.equal(!1,void 0===a,"must provide flush value"),this.write_in_progress=!0,a!==r.Z_NO_FLUSH&&a!==r.Z_PARTIAL_FLUSH&&a!==r.Z_SYNC_FLUSH&&a!==r.Z_FULL_FLUSH&&a!==r.Z_FINISH&&a!==r.Z_BLOCK)throw new Error("Invalid flush value");if(null==o&&(o=i.alloc(0),h=0,s=0),this.strm.avail_in=h,this.strm.input=o,this.strm.next_in=s,this.strm.avail_out=u,this.strm.output=l,this.strm.next_out=f,this.flush=a,!t)return this._process(),this._checkError()?this._afterSync():void 0;var c=this;return e.nextTick((function(){c._process(),c._after()})),this},f.prototype._afterSync=function(){var t=this.strm.avail_out,e=this.strm.avail_in;return this.write_in_progress=!1,[e,t]},f.prototype._process=function(){var t=null;switch(this.mode){case r.DEFLATE:case r.GZIP:case r.DEFLATERAW:this.err=o.deflate(this.strm,this.flush);break;case r.UNZIP:switch(this.strm.avail_in>0&&(t=this.strm.next_in),this.gzip_id_bytes_read){case 0:if(null===t)break;if(31!==this.strm.input[t]){this.mode=r.INFLATE;break}if(this.gzip_id_bytes_read=1,t++,1===this.strm.avail_in)break;case 1:if(null===t)break;139===this.strm.input[t]?(this.gzip_id_bytes_read=2,this.mode=r.GUNZIP):this.mode=r.INFLATE;break;default:throw new Error("invalid number of gzip magic number bytes read")}case r.INFLATE:case r.GUNZIP:case r.INFLATERAW:for(this.err=s.inflate(this.strm,this.flush),this.err===r.Z_NEED_DICT&&this.dictionary&&(this.err=s.inflateSetDictionary(this.strm,this.dictionary),this.err===r.Z_OK?this.err=s.inflate(this.strm,this.flush):this.err===r.Z_DATA_ERROR&&(this.err=r.Z_NEED_DICT));this.strm.avail_in>0&&this.mode===r.GUNZIP&&this.err===r.Z_STREAM_END&&0!==this.strm.next_in[0];)this.reset(),this.err=s.inflate(this.strm,this.flush);break;default:throw new Error("Unknown mode "+this.mode)}},f.prototype._checkError=function(){switch(this.err){case r.Z_OK:case r.Z_BUF_ERROR:if(0!==this.strm.avail_out&&this.flush===r.Z_FINISH)return this._error("unexpected end of file"),!1;break;case r.Z_STREAM_END:break;case r.Z_NEED_DICT:return null==this.dictionary?this._error("Missing dictionary"):this._error("Bad dictionary"),!1;default:return this._error("Zlib error"),!1}return!0},f.prototype._after=function(){if(this._checkError()){var t=this.strm.avail_out,e=this.strm.avail_in;this.write_in_progress=!1,this.callback(e,t),this.pending_close&&this.close()}},f.prototype._error=function(t){this.strm.msg&&(t=this.strm.msg),this.onerror(t,this.err),this.write_in_progress=!1,this.pending_close&&this.close()},f.prototype.init=function(t,e,i,a,o){n(4===arguments.length||5===arguments.length,"init(windowBits, level, memLevel, strategy, [dictionary])"),n(t>=8&&t<=15,"invalid windowBits"),n(e>=-1&&e<=9,"invalid compression level"),n(i>=1&&i<=9,"invalid memlevel"),n(a===r.Z_FILTERED||a===r.Z_HUFFMAN_ONLY||a===r.Z_RLE||a===r.Z_FIXED||a===r.Z_DEFAULT_STRATEGY,"invalid strategy"),this._init(e,t,i,a,o),this._setDictionary()},f.prototype.params=function(){throw new Error("deflateParams Not supported")},f.prototype.reset=function(){this._reset(),this._setDictionary()},f.prototype._init=function(t,e,i,n,h){switch(this.level=t,this.windowBits=e,this.memLevel=i,this.strategy=n,this.flush=r.Z_NO_FLUSH,this.err=r.Z_OK,this.mode!==r.GZIP&&this.mode!==r.GUNZIP||(this.windowBits+=16),this.mode===r.UNZIP&&(this.windowBits+=32),this.mode!==r.DEFLATERAW&&this.mode!==r.INFLATERAW||(this.windowBits=-1*this.windowBits),this.strm=new a,this.mode){case r.DEFLATE:case r.GZIP:case r.DEFLATERAW:this.err=o.deflateInit2(this.strm,this.level,r.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case r.INFLATE:case r.GUNZIP:case r.INFLATERAW:case r.UNZIP:this.err=s.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}this.err!==r.Z_OK&&this._error("Init error"),this.dictionary=h,this.write_in_progress=!1,this.init_done=!0},f.prototype._setDictionary=function(){if(null!=this.dictionary){switch(this.err=r.Z_OK,this.mode){case r.DEFLATE:case r.DEFLATERAW:this.err=o.deflateSetDictionary(this.strm,this.dictionary)}this.err!==r.Z_OK&&this._error("Failed to set dictionary")}},f.prototype._reset=function(){switch(this.err=r.Z_OK,this.mode){case r.DEFLATE:case r.DEFLATERAW:case r.GZIP:this.err=o.deflateReset(this.strm);break;case r.INFLATE:case r.INFLATERAW:case r.GUNZIP:this.err=s.inflateReset(this.strm)}this.err!==r.Z_OK&&this._error("Failed to reset stream")},r.Zlib=f}).call(this)}).call(this,t("_process"),t("buffer").Buffer)},{_process:60,assert:23,buffer:33,"pako/lib/zlib/constants":51,"pako/lib/zlib/deflate.js":53,"pako/lib/zlib/inflate.js":55,"pako/lib/zlib/zstream":59}],32:[function(t,e,r){(function(e){(function(){"use strict";var i=t("buffer").Buffer,n=t("stream").Transform,a=t("./binding"),o=t("util"),s=t("assert").ok,h=t("buffer").kMaxLength,l="Cannot create final Buffer. It would be larger than 0x"+h.toString(16)+" bytes";a.Z_MIN_WINDOWBITS=8,a.Z_MAX_WINDOWBITS=15,a.Z_DEFAULT_WINDOWBITS=15,a.Z_MIN_CHUNK=64,a.Z_MAX_CHUNK=1/0,a.Z_DEFAULT_CHUNK=16384,a.Z_MIN_MEMLEVEL=1,a.Z_MAX_MEMLEVEL=9,a.Z_DEFAULT_MEMLEVEL=8,a.Z_MIN_LEVEL=-1,a.Z_MAX_LEVEL=9,a.Z_DEFAULT_LEVEL=a.Z_DEFAULT_COMPRESSION;for(var f=Object.keys(a),u=0;u=h?o=new RangeError(l):e=i.concat(n,a),n=[],t.close(),r(o,e)}t.on("error",(function(e){t.removeListener("end",s),t.removeListener("readable",o),r(e)})),t.on("end",s),t.end(e),o()}function _(t,e){if("string"==typeof e&&(e=i.from(e)),!i.isBuffer(e))throw new TypeError("Not a string or buffer");var r=t._finishFlushFlag;return t._processChunk(e,r)}function y(t){if(!(this instanceof y))return new y(t);A.call(this,t,a.DEFLATE)}function w(t){if(!(this instanceof w))return new w(t);A.call(this,t,a.INFLATE)}function v(t){if(!(this instanceof v))return new v(t);A.call(this,t,a.GZIP)}function x(t){if(!(this instanceof x))return new x(t);A.call(this,t,a.GUNZIP)}function E(t){if(!(this instanceof E))return new E(t);A.call(this,t,a.DEFLATERAW)}function k(t){if(!(this instanceof k))return new k(t);A.call(this,t,a.INFLATERAW)}function S(t){if(!(this instanceof S))return new S(t);A.call(this,t,a.UNZIP)}function M(t){return t===a.Z_NO_FLUSH||t===a.Z_PARTIAL_FLUSH||t===a.Z_SYNC_FLUSH||t===a.Z_FULL_FLUSH||t===a.Z_FINISH||t===a.Z_BLOCK}function A(t,e){var o=this;if(this._opts=t=t||{},this._chunkSize=t.chunkSize||r.Z_DEFAULT_CHUNK,n.call(this,t),t.flush&&!M(t.flush))throw new Error("Invalid flush flag: "+t.flush);if(t.finishFlush&&!M(t.finishFlush))throw new Error("Invalid flush flag: "+t.finishFlush);if(this._flushFlag=t.flush||a.Z_NO_FLUSH,this._finishFlushFlag=void 0!==t.finishFlush?t.finishFlush:a.Z_FINISH,t.chunkSize&&(t.chunkSizer.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+t.chunkSize);if(t.windowBits&&(t.windowBitsr.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+t.windowBits);if(t.level&&(t.levelr.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+t.level);if(t.memLevel&&(t.memLevelr.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+t.memLevel);if(t.strategy&&t.strategy!=r.Z_FILTERED&&t.strategy!=r.Z_HUFFMAN_ONLY&&t.strategy!=r.Z_RLE&&t.strategy!=r.Z_FIXED&&t.strategy!=r.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+t.strategy);if(t.dictionary&&!i.isBuffer(t.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._handle=new a.Zlib(e);var s=this;this._hadError=!1,this._handle.onerror=function(t,e){I(s),s._hadError=!0;var i=new Error(t);i.errno=e,i.code=r.codes[e],s.emit("error",i)};var h=r.Z_DEFAULT_COMPRESSION;"number"==typeof t.level&&(h=t.level);var l=r.Z_DEFAULT_STRATEGY;"number"==typeof t.strategy&&(l=t.strategy),this._handle.init(t.windowBits||r.Z_DEFAULT_WINDOWBITS,h,t.memLevel||r.Z_DEFAULT_MEMLEVEL,l,t.dictionary),this._buffer=i.allocUnsafe(this._chunkSize),this._offset=0,this._level=h,this._strategy=l,this.once("end",this.close),Object.defineProperty(this,"_closed",{get:function(){return!o._handle},configurable:!0,enumerable:!0})}function I(t,r){r&&e.nextTick(r),t._handle&&(t._handle.close(),t._handle=null)}function B(t){t.emit("close")}Object.defineProperty(r,"codes",{enumerable:!0,value:Object.freeze(d),writable:!1}),r.Deflate=y,r.Inflate=w,r.Gzip=v,r.Gunzip=x,r.DeflateRaw=E,r.InflateRaw=k,r.Unzip=S,r.createDeflate=function(t){return new y(t)},r.createInflate=function(t){return new w(t)},r.createDeflateRaw=function(t){return new E(t)},r.createInflateRaw=function(t){return new k(t)},r.createGzip=function(t){return new v(t)},r.createGunzip=function(t){return new x(t)},r.createUnzip=function(t){return new S(t)},r.deflate=function(t,e,r){return"function"==typeof e&&(r=e,e={}),b(new y(e),t,r)},r.deflateSync=function(t,e){return _(new y(e),t)},r.gzip=function(t,e,r){return"function"==typeof e&&(r=e,e={}),b(new v(e),t,r)},r.gzipSync=function(t,e){return _(new v(e),t)},r.deflateRaw=function(t,e,r){return"function"==typeof e&&(r=e,e={}),b(new E(e),t,r)},r.deflateRawSync=function(t,e){return _(new E(e),t)},r.unzip=function(t,e,r){return"function"==typeof e&&(r=e,e={}),b(new S(e),t,r)},r.unzipSync=function(t,e){return _(new S(e),t)},r.inflate=function(t,e,r){return"function"==typeof e&&(r=e,e={}),b(new w(e),t,r)},r.inflateSync=function(t,e){return _(new w(e),t)},r.gunzip=function(t,e,r){return"function"==typeof e&&(r=e,e={}),b(new x(e),t,r)},r.gunzipSync=function(t,e){return _(new x(e),t)},r.inflateRaw=function(t,e,r){return"function"==typeof e&&(r=e,e={}),b(new k(e),t,r)},r.inflateRawSync=function(t,e){return _(new k(e),t)},o.inherits(A,n),A.prototype.params=function(t,i,n){if(tr.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+t);if(i!=r.Z_FILTERED&&i!=r.Z_HUFFMAN_ONLY&&i!=r.Z_RLE&&i!=r.Z_FIXED&&i!=r.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+i);if(this._level!==t||this._strategy!==i){var o=this;this.flush(a.Z_SYNC_FLUSH,(function(){s(o._handle,"zlib binding closed"),o._handle.params(t,i),o._hadError||(o._level=t,o._strategy=i,n&&n())}))}else e.nextTick(n)},A.prototype.reset=function(){return s(this._handle,"zlib binding closed"),this._handle.reset()},A.prototype._flush=function(t){this._transform(i.alloc(0),"",t)},A.prototype.flush=function(t,r){var n=this,o=this._writableState;("function"==typeof t||void 0===t&&!r)&&(r=t,t=a.Z_FULL_FLUSH),o.ended?r&&e.nextTick(r):o.ending?r&&this.once("end",r):o.needDrain?r&&this.once("drain",(function(){return n.flush(t,r)})):(this._flushFlag=t,this.write(i.alloc(0),"",r))},A.prototype.close=function(t){I(this,t),e.nextTick(B,this)},A.prototype._transform=function(t,e,r){var n,o=this._writableState,s=(o.ending||o.ended)&&(!t||o.length===t.length);return null===t||i.isBuffer(t)?this._handle?(s?n=this._finishFlushFlag:(n=this._flushFlag,t.length>=o.length&&(this._flushFlag=this._opts.flush||a.Z_NO_FLUSH)),void this._processChunk(t,n,r)):r(new Error("zlib binding closed")):r(new Error("invalid input"))},A.prototype._processChunk=function(t,e,r){var n=t&&t.length,a=this._chunkSize-this._offset,o=0,f=this,u="function"==typeof r;if(!u){var c,d=[],p=0;this.on("error",(function(t){c=t})),s(this._handle,"zlib binding closed");do{var m=this._handle.writeSync(e,t,o,n,this._buffer,this._offset,a)}while(!this._hadError&&_(m[0],m[1]));if(this._hadError)throw c;if(p>=h)throw I(this),new RangeError(l);var g=i.concat(d,p);return I(this),g}s(this._handle,"zlib binding closed");var b=this._handle.write(e,t,o,n,this._buffer,this._offset,a);function _(h,l){if(this&&(this.buffer=null,this.callback=null),!f._hadError){var c=a-l;if(s(c>=0,"have should not go down"),c>0){var m=f._buffer.slice(f._offset,f._offset+c);f._offset+=c,u?f.push(m):(d.push(m),p+=m.length)}if((0===l||f._offset>=f._chunkSize)&&(a=f._chunkSize,f._offset=0,f._buffer=i.allocUnsafe(f._chunkSize)),0===l){if(o+=n-h,n=h,!u)return!0;var g=f._handle.write(e,t,o,n,f._buffer,f._offset,f._chunkSize);return g.callback=_,void(g.buffer=t)}if(!u)return!1;r()}}b.buffer=t,b.callback=_},o.inherits(y,A),o.inherits(w,A),o.inherits(v,A),o.inherits(x,A),o.inherits(E,A),o.inherits(k,A),o.inherits(S,A)}).call(this)}).call(this,t("_process"))},{"./binding":31,_process:60,assert:23,buffer:33,stream:61,util:81}],33:[function(t,e,r){(function(e){(function(){"use strict";var e=t("base64-js"),i=t("ieee754");r.Buffer=o,r.SlowBuffer=function(t){return+t!=t&&(t=0),o.alloc(+t)},r.INSPECT_MAX_BYTES=50;var n=2147483647;function a(t){if(t>n)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=o.prototype,e}function o(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return l(t)}return s(t,e,r)}function s(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!o.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|c(t,e),i=a(r),n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}(t,e);if(ArrayBuffer.isView(t))return f(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(N(t,ArrayBuffer)||t&&N(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return 0|t}function c(t,e){if(o.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||N(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return U(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(t).length;default:if(n)return i?-1:U(t).length;e=(""+e).toLowerCase(),n=!0}}function d(t,e,r){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,r);case"utf8":case"utf-8":return k(this,e,r);case"ascii":return M(this,e,r);case"latin1":case"binary":return A(this,e,r);case"base64":return E(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function p(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function m(t,e,r,i,n){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),F(r=+r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=o.from(e,i)),o.isBuffer(e))return 0===e.length?-1:g(t,e,r,i,n);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):g(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function g(t,e,r,i,n){var a,o=1,s=t.length,h=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;o=2,s/=2,h/=2,r/=2}function l(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(n){var f=-1;for(a=r;as&&(r=s-h),a=r;a>=0;a--){for(var u=!0,c=0;cn&&(i=n):i=n;var a=e.length;i>a/2&&(i=a/2);for(var o=0;o>8,n=r%256,a.push(n),a.push(i);return a}(e,t.length-r),t,r,i)}function E(t,r,i){return 0===r&&i===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,i))}function k(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n239?4:l>223?3:l>191?2:1;if(n+u<=r)switch(u){case 1:l<128&&(f=l);break;case 2:128==(192&(a=t[n+1]))&&(h=(31&l)<<6|63&a)>127&&(f=h);break;case 3:a=t[n+1],o=t[n+2],128==(192&a)&&128==(192&o)&&(h=(15&l)<<12|(63&a)<<6|63&o)>2047&&(h<55296||h>57343)&&(f=h);break;case 4:a=t[n+1],o=t[n+2],s=t[n+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(h=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&h<1114112&&(f=h)}null===f?(f=65533,u=1):f>65535&&(f-=65536,i.push(f>>>10&1023|55296),f=56320|1023&f),i.push(f),n+=u}return function(t){var e=t.length;if(e<=S)return String.fromCharCode.apply(String,t);for(var r="",i=0;ie&&(t+=" ... "),""},o.prototype.compare=function(t,e,r,i,n){if(N(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;for(var a=(n>>>=0)-(i>>>=0),s=(r>>>=0)-(e>>>=0),h=Math.min(a,s),l=this.slice(i,n),f=t.slice(e,r),u=0;u>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}var n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var a=!1;;)switch(i){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return _(this,t,e,r);case"ascii":return y(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return v(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),a=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var S=4096;function M(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;nn)&&(r=n);for(var a="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,r,i,n,a){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}function P(t,e,r,i,n,a){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function O(t,e,r,n,a){return e=+e,r>>>=0,a||P(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function L(t,e,r,n,a){return e=+e,r>>>=0,a||P(t,0,r,8),i.write(t,e,r,n,52,8),r+8}o.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||T(t,e,this.length);for(var i=this[t],n=1,a=0;++a>>=0,e>>>=0,r||T(t,e,this.length);for(var i=this[t+--e],n=1;e>0&&(n*=256);)i+=this[t+--e]*n;return i},o.prototype.readUInt8=function(t,e){return t>>>=0,e||T(t,1,this.length),this[t]},o.prototype.readUInt16LE=function(t,e){return t>>>=0,e||T(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUInt16BE=function(t,e){return t>>>=0,e||T(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUInt32LE=function(t,e){return t>>>=0,e||T(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUInt32BE=function(t,e){return t>>>=0,e||T(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||T(t,e,this.length);for(var i=this[t],n=1,a=0;++a=(n*=128)&&(i-=Math.pow(2,8*e)),i},o.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||T(t,e,this.length);for(var i=e,n=1,a=this[t+--i];i>0&&(n*=256);)a+=this[t+--i]*n;return a>=(n*=128)&&(a-=Math.pow(2,8*e)),a},o.prototype.readInt8=function(t,e){return t>>>=0,e||T(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){t>>>=0,e||T(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(t,e){t>>>=0,e||T(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(t,e){return t>>>=0,e||T(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return t>>>=0,e||T(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return t>>>=0,e||T(t,4,this.length),i.read(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return t>>>=0,e||T(t,4,this.length),i.read(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return t>>>=0,e||T(t,8,this.length),i.read(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return t>>>=0,e||T(t,8,this.length),i.read(this,t,!1,52,8)},o.prototype.writeUIntLE=function(t,e,r,i){t=+t,e>>>=0,r>>>=0,i||R(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,a=0;for(this[e]=255&t;++a>>=0,r>>>=0,i||R(this,t,e,r,Math.pow(2,8*r)-1,0);var n=r-1,a=1;for(this[e+n]=255&t;--n>=0&&(a*=256);)this[e+n]=t/a&255;return e+r},o.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,1,255,0),this[e]=255&t,e+1},o.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},o.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);R(this,t,e,r,n-1,-n)}var a=0,o=1,s=0;for(this[e]=255&t;++a>0)-s&255;return e+r},o.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e>>>=0,!i){var n=Math.pow(2,8*r-1);R(this,t,e,r,n-1,-n)}var a=r-1,o=1,s=0;for(this[e+a]=255&t;--a>=0&&(o*=256);)t<0&&0===s&&0!==this[e+a+1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+r},o.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},o.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||R(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeFloatLE=function(t,e,r){return O(this,t,e,!0,r)},o.prototype.writeFloatBE=function(t,e,r){return O(this,t,e,!1,r)},o.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},o.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},o.prototype.copy=function(t,e,r,i){if(!o.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e=0;--a)t[a+e]=this[a+r];else Uint8Array.prototype.set.call(t,this.subarray(r,i),e);return n},o.prototype.fill=function(t,e,r,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!o.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===t.length){var n=t.charCodeAt(0);("utf8"===i&&n<128||"latin1"===i)&&(t=n)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(a=e;a55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(o+1===i){(e-=3)>-1&&a.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&a.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&a.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function z(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(C,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function D(t,e,r,i){for(var n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function N(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function F(t){return t!=t}}).call(this)}).call(this,t("buffer").Buffer)},{"base64-js":29,buffer:33,ieee754:44}],34:[function(t,e,r){"use strict";var i,n=TypeError,a=Object.getOwnPropertyDescriptor;if(a)try{a({},"")}catch(t){a=null}var o=function(){throw new n},s=a?function(){try{return o}catch(t){try{return a(arguments,"callee").get}catch(t){return o}}}():o,h=t("has-symbols")(),l=Object.getPrototypeOf||function(t){return t.__proto__},f=i,u=i,c=i,d=i,p="undefined"==typeof Uint8Array?i:l(Uint8Array),m={"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?i:ArrayBuffer,"%ArrayBufferPrototype%":"undefined"==typeof ArrayBuffer?i:ArrayBuffer.prototype,"%ArrayIteratorPrototype%":h?l([][Symbol.iterator]()):i,"%ArrayPrototype%":Array.prototype,"%ArrayProto_entries%":Array.prototype.entries,"%ArrayProto_forEach%":Array.prototype.forEach,"%ArrayProto_keys%":Array.prototype.keys,"%ArrayProto_values%":Array.prototype.values,"%AsyncFromSyncIteratorPrototype%":i,"%AsyncFunction%":u,"%AsyncFunctionPrototype%":i,"%AsyncGenerator%":i,"%AsyncGeneratorFunction%":c,"%AsyncGeneratorPrototype%":i,"%AsyncIteratorPrototype%":d&&h&&Symbol.asyncIterator?d[Symbol.asyncIterator]():i,"%Atomics%":"undefined"==typeof Atomics?i:Atomics,"%Boolean%":Boolean,"%BooleanPrototype%":Boolean.prototype,"%DataView%":"undefined"==typeof DataView?i:DataView,"%DataViewPrototype%":"undefined"==typeof DataView?i:DataView.prototype,"%Date%":Date,"%DatePrototype%":Date.prototype,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%ErrorPrototype%":Error.prototype,"%eval%":eval,"%EvalError%":EvalError,"%EvalErrorPrototype%":EvalError.prototype,"%Float32Array%":"undefined"==typeof Float32Array?i:Float32Array,"%Float32ArrayPrototype%":"undefined"==typeof Float32Array?i:Float32Array.prototype,"%Float64Array%":"undefined"==typeof Float64Array?i:Float64Array,"%Float64ArrayPrototype%":"undefined"==typeof Float64Array?i:Float64Array.prototype,"%Function%":Function,"%FunctionPrototype%":Function.prototype,"%Generator%":i,"%GeneratorFunction%":f,"%GeneratorPrototype%":i,"%Int8Array%":"undefined"==typeof Int8Array?i:Int8Array,"%Int8ArrayPrototype%":"undefined"==typeof Int8Array?i:Int8Array.prototype,"%Int16Array%":"undefined"==typeof Int16Array?i:Int16Array,"%Int16ArrayPrototype%":"undefined"==typeof Int16Array?i:Int8Array.prototype,"%Int32Array%":"undefined"==typeof Int32Array?i:Int32Array,"%Int32ArrayPrototype%":"undefined"==typeof Int32Array?i:Int32Array.prototype,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":h?l(l([][Symbol.iterator]())):i,"%JSON%":"object"==typeof JSON?JSON:i,"%JSONParse%":"object"==typeof JSON?JSON.parse:i,"%Map%":"undefined"==typeof Map?i:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&h?l((new Map)[Symbol.iterator]()):i,"%MapPrototype%":"undefined"==typeof Map?i:Map.prototype,"%Math%":Math,"%Number%":Number,"%NumberPrototype%":Number.prototype,"%Object%":Object,"%ObjectPrototype%":Object.prototype,"%ObjProto_toString%":Object.prototype.toString,"%ObjProto_valueOf%":Object.prototype.valueOf,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?i:Promise,"%PromisePrototype%":"undefined"==typeof Promise?i:Promise.prototype,"%PromiseProto_then%":"undefined"==typeof Promise?i:Promise.prototype.then,"%Promise_all%":"undefined"==typeof Promise?i:Promise.all,"%Promise_reject%":"undefined"==typeof Promise?i:Promise.reject,"%Promise_resolve%":"undefined"==typeof Promise?i:Promise.resolve,"%Proxy%":"undefined"==typeof Proxy?i:Proxy,"%RangeError%":RangeError,"%RangeErrorPrototype%":RangeError.prototype,"%ReferenceError%":ReferenceError,"%ReferenceErrorPrototype%":ReferenceError.prototype,"%Reflect%":"undefined"==typeof Reflect?i:Reflect,"%RegExp%":RegExp,"%RegExpPrototype%":RegExp.prototype,"%Set%":"undefined"==typeof Set?i:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&h?l((new Set)[Symbol.iterator]()):i,"%SetPrototype%":"undefined"==typeof Set?i:Set.prototype,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?i:SharedArrayBuffer,"%SharedArrayBufferPrototype%":"undefined"==typeof SharedArrayBuffer?i:SharedArrayBuffer.prototype,"%String%":String,"%StringIteratorPrototype%":h?l(""[Symbol.iterator]()):i,"%StringPrototype%":String.prototype,"%Symbol%":h?Symbol:i,"%SymbolPrototype%":h?Symbol.prototype:i,"%SyntaxError%":SyntaxError,"%SyntaxErrorPrototype%":SyntaxError.prototype,"%ThrowTypeError%":s,"%TypedArray%":p,"%TypedArrayPrototype%":p?p.prototype:i,"%TypeError%":n,"%TypeErrorPrototype%":n.prototype,"%Uint8Array%":"undefined"==typeof Uint8Array?i:Uint8Array,"%Uint8ArrayPrototype%":"undefined"==typeof Uint8Array?i:Uint8Array.prototype,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?i:Uint8ClampedArray,"%Uint8ClampedArrayPrototype%":"undefined"==typeof Uint8ClampedArray?i:Uint8ClampedArray.prototype,"%Uint16Array%":"undefined"==typeof Uint16Array?i:Uint16Array,"%Uint16ArrayPrototype%":"undefined"==typeof Uint16Array?i:Uint16Array.prototype,"%Uint32Array%":"undefined"==typeof Uint32Array?i:Uint32Array,"%Uint32ArrayPrototype%":"undefined"==typeof Uint32Array?i:Uint32Array.prototype,"%URIError%":URIError,"%URIErrorPrototype%":URIError.prototype,"%WeakMap%":"undefined"==typeof WeakMap?i:WeakMap,"%WeakMapPrototype%":"undefined"==typeof WeakMap?i:WeakMap.prototype,"%WeakSet%":"undefined"==typeof WeakSet?i:WeakSet,"%WeakSetPrototype%":"undefined"==typeof WeakSet?i:WeakSet.prototype},g=t("function-bind").call(Function.call,String.prototype.replace),b=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,_=/\\(\\)?/g,y=function(t){var e=[];return g(t,b,(function(t,r,i,n){e[e.length]=i?g(n,_,"$1"):r||t})),e},w=function(t,e){if(!(t in m))throw new SyntaxError("intrinsic "+t+" does not exist!");if(void 0===m[t]&&!e)throw new n("intrinsic "+t+" exists, but is not available. Please file an issue!");return m[t]};e.exports=function(t,e){if("string"!=typeof t||0===t.length)throw new TypeError("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof e)throw new TypeError('"allowMissing" argument must be a boolean');for(var r=y(t),i=w("%"+(r.length>0?r[0]:"")+"%",e),o=1;o=r.length){var s=a(i,r[o]);if(!e&&!(r[o]in i))throw new n("base intrinsic for "+t+" exists, but the property is not available.");i=s?s.get||s.value:i[r[o]]}else i=i[r[o]];return i}},{"function-bind":41,"has-symbols":42}],35:[function(t,e,r){"use strict";var i=t("function-bind"),n=t("../GetIntrinsic")("%Function%"),a=n.apply,o=n.call;e.exports=function(){return i.apply(o,arguments)},e.exports.apply=function(){return i.apply(a,arguments)}},{"../GetIntrinsic":34,"function-bind":41}],36:[function(t,e,r){"use strict";var i=t("../GetIntrinsic"),n=t("./callBind"),a=n(i("String.prototype.indexOf"));e.exports=function(t,e){var r=i(t,!!e);return"function"==typeof r&&a(t,".prototype.")?n(r):r}},{"../GetIntrinsic":34,"./callBind":35}],37:[function(t,e,r){"use strict";var i=t("../GetIntrinsic")("%Object.getOwnPropertyDescriptor%");if(i)try{i([],"length")}catch(t){i=null}e.exports=i},{"../GetIntrinsic":34}],38:[function(t,e,r){"use strict";var i,n="object"==typeof Reflect?Reflect:null,a=n&&"function"==typeof n.apply?n.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};i=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(t,e){return new Promise((function(r,i){function n(){void 0!==a&&t.removeListener("error",a),r([].slice.call(arguments))}var a;"error"!==e&&(a=function(r){t.removeListener(e,n),i(r)},t.once("error",a)),t.once(e,n)}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var h=10;function l(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function f(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function u(t,e,r,i){var n,a,o,s;if(l(r),void 0===(a=t._events)?(a=t._events=Object.create(null),t._eventsCount=0):(void 0!==a.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),a=t._events),o=a[e]),void 0===o)o=a[e]=r,++t._eventsCount;else if("function"==typeof o?o=a[e]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=f(t))>0&&o.length>n&&!o.warned){o.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=t,h.type=e,h.count=o.length,s=h,console&&console.warn&&console.warn(s)}return t}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=c.bind(i);return n.listener=r,i.wrapFn=n,n}function p(t,e,r){var i=t._events;if(void 0===i)return[];var n=i[e];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(t){for(var e=new Array(t.length),r=0;r0&&(o=e[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var h=n[t];if(void 0===h)return!1;if("function"==typeof h)a(h,this,e);else{var l=h.length,f=g(h,l);for(r=0;r=0;a--)if(r[a]===e||r[a].listener===e){o=r[a].listener,n=a;break}if(n<0)return this;0===n?r.shift():function(t,e){for(;e+1=0;i--)this.removeListener(t,e[i]);return this},s.prototype.listeners=function(t){return p(this,t,!0)},s.prototype.rawListeners=function(t){return p(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):m.call(t,e)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},{}],39:[function(t,e,r){var i=Object.prototype.hasOwnProperty,n=Object.prototype.toString;e.exports=function(t,e,r){if("[object Function]"!==n.call(e))throw new TypeError("iterator must be a function");var a=t.length;if(a===+a)for(var o=0;o>1,f=-7,u=r?n-1:0,c=r?-1:1,d=t[e+u];for(u+=c,a=d&(1<<-f)-1,d>>=-f,f+=s;f>0;a=256*a+t[e+u],u+=c,f-=8);for(o=a&(1<<-f)-1,a>>=-f,f+=i;f>0;o=256*o+t[e+u],u+=c,f-=8);if(0===a)a=1-l;else{if(a===h)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,i),a-=l}return(d?-1:1)*o*Math.pow(2,a-i)},r.write=function(t,e,r,i,n,a){var o,s,h,l=8*a-n-1,f=(1<>1,c=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:a-1,p=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-o))<1&&(o--,h*=2),(e+=o+u>=1?c/h:c*Math.pow(2,1-u))*h>=2&&(o++,h/=2),o+u>=f?(s=0,o=f):o+u>=1?(s=(e*h-1)*Math.pow(2,n),o+=u):(s=e*Math.pow(2,u-1)*Math.pow(2,n),o=0));n>=8;t[r+d]=255&s,d+=p,s/=256,n-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,l-=8);t[r+d-p]|=128*m}},{}],45:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},{}],46:[function(t,e,r){"use strict";var i="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,n=Object.prototype.toString,a=function(t){return!(i&&t&&"object"==typeof t&&Symbol.toStringTag in t)&&"[object Arguments]"===n.call(t)},o=function(t){return!!a(t)||null!==t&&"object"==typeof t&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==n.call(t)&&"[object Function]"===n.call(t.callee)},s=function(){return a(arguments)}();a.isLegacyArguments=o,e.exports=s?a:o},{}],47:[function(t,e,r){"use strict";var i=Object.prototype.toString,n=Function.prototype.toString,a=/^\s*(?:function)?\*/,o="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,s=Object.getPrototypeOf,h=function(){if(!o)return!1;try{return Function("return function*() {}")()}catch(t){}}(),l=h?s(h):{};e.exports=function(t){return"function"==typeof t&&(!!a.test(n.call(t))||(o?s(t)===l:"[object GeneratorFunction]"===i.call(t)))}},{}],48:[function(t,e,i){(function(r){(function(){"use strict";var i=t("foreach"),n=t("available-typed-arrays"),a=t("es-abstract/helpers/callBound"),o=a("Object.prototype.toString"),s=t("has-symbols")()&&"symbol"==typeof Symbol.toStringTag,h=n(),l=a("Array.prototype.indexOf",!0)||function(t,e){for(var r=0;r-1}return!!c&&function(t){var e=!1;return i(u,(function(r,i){if(!e)try{e=r.call(t)===i}catch(t){}})),e}(t)}}).call(this)}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"available-typed-arrays":27,"es-abstract/helpers/callBound":36,"es-abstract/helpers/getOwnPropertyDescriptor":37,foreach:39,"has-symbols":42}],49:[function(t,e,r){"use strict";var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}r.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var i in r)n(r,i)&&(t[i]=r[i])}}return t},r.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var a={arraySet:function(t,e,r,i,n){if(e.subarray&&t.subarray)t.set(e.subarray(r,r+i),n);else for(var a=0;a>>16&65535|0,o=0;0!==r;){r-=o=r>2e3?2e3:r;do{a=a+(n=n+e[i++]|0)|0}while(--o);n%=65521,a%=65521}return n|a<<16|0}},{}],51:[function(t,e,r){"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],52:[function(t,e,r){"use strict";var i=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();e.exports=function(t,e,r,n){var a=i,o=n+r;t^=-1;for(var s=n;s>>8^a[255&(t^e[s])];return-1^t}},{}],53:[function(t,e,r){"use strict";var i,n=t("../utils/common"),a=t("./trees"),o=t("./adler32"),s=t("./crc32"),h=t("./messages"),l=0,f=1,u=3,c=4,d=5,p=0,m=1,g=-2,b=-3,_=-5,y=-1,w=1,v=2,x=3,E=4,k=0,S=2,M=8,A=9,I=15,B=8,T=286,R=30,P=19,O=2*T+1,L=15,C=3,U=258,z=U+C+1,D=32,N=42,F=69,j=73,G=91,H=103,W=113,q=666,Z=1,Y=2,V=3,X=4,J=3;function Q(t,e){return t.msg=h[e],e}function K(t){return(t<<1)-(t>4?9:0)}function $(t){for(var e=t.length;--e>=0;)t[e]=0}function tt(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(n.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))}function et(t,e){a._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,tt(t.strm)}function rt(t,e){t.pending_buf[t.pending++]=e}function it(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function nt(t,e){var r,i,n=t.max_chain_length,a=t.strstart,o=t.prev_length,s=t.nice_match,h=t.strstart>t.w_size-z?t.strstart-(t.w_size-z):0,l=t.window,f=t.w_mask,u=t.prev,c=t.strstart+U,d=l[a+o-1],p=l[a+o];t.prev_length>=t.good_match&&(n>>=2),s>t.lookahead&&(s=t.lookahead);do{if(l[(r=e)+o]===p&&l[r+o-1]===d&&l[r]===l[a]&&l[++r]===l[a+1]){a+=2,r++;do{}while(l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&l[++a]===l[++r]&&ao){if(t.match_start=e,o=i,i>=s)break;d=l[a+o-1],p=l[a+o]}}}while((e=u[e&f])>h&&0!=--n);return o<=t.lookahead?o:t.lookahead}function at(t){var e,r,i,a,h,l,f,u,c,d,p=t.w_size;do{if(a=t.window_size-t.lookahead-t.strstart,t.strstart>=p+(p-z)){n.arraySet(t.window,t.window,p,p,0),t.match_start-=p,t.strstart-=p,t.block_start-=p,e=r=t.hash_size;do{i=t.head[--e],t.head[e]=i>=p?i-p:0}while(--r);e=r=p;do{i=t.prev[--e],t.prev[e]=i>=p?i-p:0}while(--r);a+=p}if(0===t.strm.avail_in)break;if(l=t.strm,f=t.window,u=t.strstart+t.lookahead,c=a,d=void 0,(d=l.avail_in)>c&&(d=c),r=0===d?0:(l.avail_in-=d,n.arraySet(f,l.input,l.next_in,d,u),1===l.state.wrap?l.adler=o(l.adler,f,d,u):2===l.state.wrap&&(l.adler=s(l.adler,f,d,u)),l.next_in+=d,l.total_in+=d,d),t.lookahead+=r,t.lookahead+t.insert>=C)for(h=t.strstart-t.insert,t.ins_h=t.window[h],t.ins_h=(t.ins_h<=C&&(t.ins_h=(t.ins_h<=C)if(i=a._tr_tally(t,t.strstart-t.match_start,t.match_length-C),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=C){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<=C&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=C-1)),t.prev_length>=C&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-C,i=a._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-C),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=(t.ins_h<15&&(s=2,i-=16),a<1||a>A||r!==M||i<8||i>15||e<0||e>9||o<0||o>E)return Q(t,g);8===i&&(i=9);var h=new lt;return t.state=h,h.strm=t,h.wrap=s,h.gzhead=null,h.w_bits=i,h.w_size=1<t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(at(t),0===t.lookahead&&e===l)return Z;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+r;if((0===t.strstart||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,et(t,!1),0===t.strm.avail_out))return Z;if(t.strstart-t.block_start>=t.w_size-z&&(et(t,!1),0===t.strm.avail_out))return Z}return t.insert=0,e===c?(et(t,!0),0===t.strm.avail_out?V:X):(t.strstart>t.block_start&&(et(t,!1),t.strm.avail_out),Z)})),new ht(4,4,8,4,ot),new ht(4,5,16,8,ot),new ht(4,6,32,32,ot),new ht(4,4,16,16,st),new ht(8,16,32,32,st),new ht(8,16,128,128,st),new ht(8,32,128,256,st),new ht(32,128,258,1024,st),new ht(32,258,258,4096,st)],r.deflateInit=function(t,e){return ct(t,e,M,I,B,k)},r.deflateInit2=ct,r.deflateReset=ut,r.deflateResetKeep=ft,r.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?g:(t.state.gzhead=e,p):g},r.deflate=function(t,e){var r,n,o,h;if(!t||!t.state||e>d||e<0)return t?Q(t,g):g;if(n=t.state,!t.output||!t.input&&0!==t.avail_in||n.status===q&&e!==c)return Q(t,0===t.avail_out?_:g);if(n.strm=t,r=n.last_flush,n.last_flush=e,n.status===N)if(2===n.wrap)t.adler=0,rt(n,31),rt(n,139),rt(n,8),n.gzhead?(rt(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),rt(n,255&n.gzhead.time),rt(n,n.gzhead.time>>8&255),rt(n,n.gzhead.time>>16&255),rt(n,n.gzhead.time>>24&255),rt(n,9===n.level?2:n.strategy>=v||n.level<2?4:0),rt(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(rt(n,255&n.gzhead.extra.length),rt(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=s(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=F):(rt(n,0),rt(n,0),rt(n,0),rt(n,0),rt(n,0),rt(n,9===n.level?2:n.strategy>=v||n.level<2?4:0),rt(n,J),n.status=W);else{var b=M+(n.w_bits-8<<4)<<8;b|=(n.strategy>=v||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(b|=D),b+=31-b%31,n.status=W,it(n,b),0!==n.strstart&&(it(n,t.adler>>>16),it(n,65535&t.adler)),t.adler=1}if(n.status===F)if(n.gzhead.extra){for(o=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>o&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),tt(t),o=n.pending,n.pending!==n.pending_buf_size));)rt(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=j)}else n.status=j;if(n.status===j)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),tt(t),o=n.pending,n.pending===n.pending_buf_size)){h=1;break}h=n.gzindexo&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),0===h&&(n.gzindex=0,n.status=G)}else n.status=G;if(n.status===G)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),tt(t),o=n.pending,n.pending===n.pending_buf_size)){h=1;break}h=n.gzindexo&&(t.adler=s(t.adler,n.pending_buf,n.pending-o,o)),0===h&&(n.status=H)}else n.status=H;if(n.status===H&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&tt(t),n.pending+2<=n.pending_buf_size&&(rt(n,255&t.adler),rt(n,t.adler>>8&255),t.adler=0,n.status=W)):n.status=W),0!==n.pending){if(tt(t),0===t.avail_out)return n.last_flush=-1,p}else if(0===t.avail_in&&K(e)<=K(r)&&e!==c)return Q(t,_);if(n.status===q&&0!==t.avail_in)return Q(t,_);if(0!==t.avail_in||0!==n.lookahead||e!==l&&n.status!==q){var y=n.strategy===v?function(t,e){for(var r;;){if(0===t.lookahead&&(at(t),0===t.lookahead)){if(e===l)return Z;break}if(t.match_length=0,r=a._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(et(t,!1),0===t.strm.avail_out))return Z}return t.insert=0,e===c?(et(t,!0),0===t.strm.avail_out?V:X):t.last_lit&&(et(t,!1),0===t.strm.avail_out)?Z:Y}(n,e):n.strategy===x?function(t,e){for(var r,i,n,o,s=t.window;;){if(t.lookahead<=U){if(at(t),t.lookahead<=U&&e===l)return Z;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=C&&t.strstart>0&&(i=s[n=t.strstart-1])===s[++n]&&i===s[++n]&&i===s[++n]){o=t.strstart+U;do{}while(i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&i===s[++n]&&nt.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=C?(r=a._tr_tally(t,1,t.match_length-C),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=a._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(et(t,!1),0===t.strm.avail_out))return Z}return t.insert=0,e===c?(et(t,!0),0===t.strm.avail_out?V:X):t.last_lit&&(et(t,!1),0===t.strm.avail_out)?Z:Y}(n,e):i[n.level].func(n,e);if(y!==V&&y!==X||(n.status=q),y===Z||y===V)return 0===t.avail_out&&(n.last_flush=-1),p;if(y===Y&&(e===f?a._tr_align(n):e!==d&&(a._tr_stored_block(n,0,0,!1),e===u&&($(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),tt(t),0===t.avail_out))return n.last_flush=-1,p}return e!==c?p:n.wrap<=0?m:(2===n.wrap?(rt(n,255&t.adler),rt(n,t.adler>>8&255),rt(n,t.adler>>16&255),rt(n,t.adler>>24&255),rt(n,255&t.total_in),rt(n,t.total_in>>8&255),rt(n,t.total_in>>16&255),rt(n,t.total_in>>24&255)):(it(n,t.adler>>>16),it(n,65535&t.adler)),tt(t),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?p:m)},r.deflateEnd=function(t){var e;return t&&t.state?(e=t.state.status)!==N&&e!==F&&e!==j&&e!==G&&e!==H&&e!==W&&e!==q?Q(t,g):(t.state=null,e===W?Q(t,b):p):g},r.deflateSetDictionary=function(t,e){var r,i,a,s,h,l,f,u,c=e.length;if(!t||!t.state)return g;if(2===(s=(r=t.state).wrap)||1===s&&r.status!==N||r.lookahead)return g;for(1===s&&(t.adler=o(t.adler,e,c,0)),r.wrap=0,c>=r.w_size&&(0===s&&($(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new n.Buf8(r.w_size),n.arraySet(u,e,c-r.w_size,r.w_size,0),e=u,c=r.w_size),h=t.avail_in,l=t.next_in,f=t.input,t.avail_in=c,t.next_in=0,t.input=e,at(r);r.lookahead>=C;){i=r.strstart,a=r.lookahead-(C-1);do{r.ins_h=(r.ins_h<>>=w=y>>>24,p-=w,0==(w=y>>>16&255))M[a++]=65535&y;else{if(!(16&w)){if(0==(64&w)){y=m[(65535&y)+(d&(1<>>=w,p-=w),p<15&&(d+=S[i++]<>>=w=y>>>24,p-=w,!(16&(w=y>>>16&255))){if(0==(64&w)){y=g[(65535&y)+(d&(1<h){t.msg="invalid distance too far back",r.mode=30;break t}if(d>>>=w,p-=w,x>(w=a-o)){if((w=x-w)>f&&r.sane){t.msg="invalid distance too far back",r.mode=30;break t}if(E=0,k=c,0===u){if(E+=l-w,w2;)M[a++]=k[E++],M[a++]=k[E++],M[a++]=k[E++],v-=3;v&&(M[a++]=k[E++],v>1&&(M[a++]=k[E++]))}else{E=a-x;do{M[a++]=M[E++],M[a++]=M[E++],M[a++]=M[E++],v-=3}while(v>2);v&&(M[a++]=M[E++],v>1&&(M[a++]=M[E++]))}break}}break}}while(i>3,d&=(1<<(p-=v<<3))-1,t.next_in=i,t.next_out=a,t.avail_in=i>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function it(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function nt(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=x,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new i.Buf32($),e.distcode=e.distdyn=new i.Buf32(tt),e.sane=1,e.back=-1,p):b}function at(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,nt(t)):b}function ot(t,e){var r,i;return t&&t.state?(i=t.state,e<0?(r=0,e=-e):(r=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?b:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,at(t))):b}function st(t,e){var r,i;return t?(i=new it,t.state=i,i.window=null,(r=ot(t,e))!==p&&(t.state=null),r):b}var ht,lt,ft=!0;function ut(t){if(ft){var e;for(ht=new i.Buf32(512),lt=new i.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(s(l,t.lens,0,288,ht,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;s(f,t.lens,0,32,lt,0,t.work,{bits:5}),ft=!1}t.lencode=ht,t.lenbits=9,t.distcode=lt,t.distbits=5}function ct(t,e,r,n){var a,o=t.state;return null===o.window&&(o.wsize=1<=o.wsize?(i.arraySet(o.window,e,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((a=o.wsize-o.wnext)>n&&(a=n),i.arraySet(o.window,e,r-n,a,o.wnext),(n-=a)?(i.arraySet(o.window,e,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,r.check=a(r.check,Mt,2,0),ot=0,st=0,r.mode=E;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&ot)<<8)+(ot>>8))%31){t.msg="incorrect header check",r.mode=Q;break}if((15&ot)!==v){t.msg="unknown compression method",r.mode=Q;break}if(st-=4,vt=8+(15&(ot>>>=4)),0===r.wbits)r.wbits=vt;else if(vt>r.wbits){t.msg="invalid window size",r.mode=Q;break}r.dmax=1<>8&1),512&r.flags&&(Mt[0]=255&ot,Mt[1]=ot>>>8&255,r.check=a(r.check,Mt,2,0)),ot=0,st=0,r.mode=k;case k:for(;st<32;){if(0===nt)break t;nt--,ot+=$[et++]<>>8&255,Mt[2]=ot>>>16&255,Mt[3]=ot>>>24&255,r.check=a(r.check,Mt,4,0)),ot=0,st=0,r.mode=S;case S:for(;st<16;){if(0===nt)break t;nt--,ot+=$[et++]<>8),512&r.flags&&(Mt[0]=255&ot,Mt[1]=ot>>>8&255,r.check=a(r.check,Mt,2,0)),ot=0,st=0,r.mode=M;case M:if(1024&r.flags){for(;st<16;){if(0===nt)break t;nt--,ot+=$[et++]<>>8&255,r.check=a(r.check,Mt,2,0)),ot=0,st=0}else r.head&&(r.head.extra=null);r.mode=A;case A:if(1024&r.flags&&((ft=r.length)>nt&&(ft=nt),ft&&(r.head&&(vt=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),i.arraySet(r.head.extra,$,et,ft,vt)),512&r.flags&&(r.check=a(r.check,$,ft,et)),nt-=ft,et+=ft,r.length-=ft),r.length))break t;r.length=0,r.mode=I;case I:if(2048&r.flags){if(0===nt)break t;ft=0;do{vt=$[et+ft++],r.head&&vt&&r.length<65536&&(r.head.name+=String.fromCharCode(vt))}while(vt&&ft>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=O;break;case R:for(;st<32;){if(0===nt)break t;nt--,ot+=$[et++]<>>=7&st,st-=7&st,r.mode=V;break}for(;st<3;){if(0===nt)break t;nt--,ot+=$[et++]<>>=1)){case 0:r.mode=C;break;case 1:if(ut(r),r.mode=j,e===d){ot>>>=2,st-=2;break t}break;case 2:r.mode=D;break;case 3:t.msg="invalid block type",r.mode=Q}ot>>>=2,st-=2;break;case C:for(ot>>>=7&st,st-=7&st;st<32;){if(0===nt)break t;nt--,ot+=$[et++]<>>16^65535)){t.msg="invalid stored block lengths",r.mode=Q;break}if(r.length=65535&ot,ot=0,st=0,r.mode=U,e===d)break t;case U:r.mode=z;case z:if(ft=r.length){if(ft>nt&&(ft=nt),ft>at&&(ft=at),0===ft)break t;i.arraySet(tt,$,et,ft,it),nt-=ft,et+=ft,at-=ft,it+=ft,r.length-=ft;break}r.mode=O;break;case D:for(;st<14;){if(0===nt)break t;nt--,ot+=$[et++]<>>=5,st-=5,r.ndist=1+(31&ot),ot>>>=5,st-=5,r.ncode=4+(15&ot),ot>>>=4,st-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=Q;break}r.have=0,r.mode=N;case N:for(;r.have>>=3,st-=3}for(;r.have<19;)r.lens[At[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,Et={bits:r.lenbits},xt=s(h,r.lens,0,19,r.lencode,0,r.work,Et),r.lenbits=Et.bits,xt){t.msg="invalid code lengths set",r.mode=Q;break}r.have=0,r.mode=F;case F:for(;r.have>>16&255,bt=65535&St,!((mt=St>>>24)<=st);){if(0===nt)break t;nt--,ot+=$[et++]<>>=mt,st-=mt,r.lens[r.have++]=bt;else{if(16===bt){for(kt=mt+2;st>>=mt,st-=mt,0===r.have){t.msg="invalid bit length repeat",r.mode=Q;break}vt=r.lens[r.have-1],ft=3+(3&ot),ot>>>=2,st-=2}else if(17===bt){for(kt=mt+3;st>>=mt)),ot>>>=3,st-=3}else{for(kt=mt+7;st>>=mt)),ot>>>=7,st-=7}if(r.have+ft>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=Q;break}for(;ft--;)r.lens[r.have++]=vt}}if(r.mode===Q)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=Q;break}if(r.lenbits=9,Et={bits:r.lenbits},xt=s(l,r.lens,0,r.nlen,r.lencode,0,r.work,Et),r.lenbits=Et.bits,xt){t.msg="invalid literal/lengths set",r.mode=Q;break}if(r.distbits=6,r.distcode=r.distdyn,Et={bits:r.distbits},xt=s(f,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,Et),r.distbits=Et.bits,xt){t.msg="invalid distances set",r.mode=Q;break}if(r.mode=j,e===d)break t;case j:r.mode=G;case G:if(nt>=6&&at>=258){t.next_out=it,t.avail_out=at,t.next_in=et,t.avail_in=nt,r.hold=ot,r.bits=st,o(t,lt),it=t.next_out,tt=t.output,at=t.avail_out,et=t.next_in,$=t.input,nt=t.avail_in,ot=r.hold,st=r.bits,r.mode===O&&(r.back=-1);break}for(r.back=0;gt=(St=r.lencode[ot&(1<>>16&255,bt=65535&St,!((mt=St>>>24)<=st);){if(0===nt)break t;nt--,ot+=$[et++]<>_t)])>>>16&255,bt=65535&St,!(_t+(mt=St>>>24)<=st);){if(0===nt)break t;nt--,ot+=$[et++]<>>=_t,st-=_t,r.back+=_t}if(ot>>>=mt,st-=mt,r.back+=mt,r.length=bt,0===gt){r.mode=Y;break}if(32>){r.back=-1,r.mode=O;break}if(64>){t.msg="invalid literal/length code",r.mode=Q;break}r.extra=15>,r.mode=H;case H:if(r.extra){for(kt=r.extra;st>>=r.extra,st-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=W;case W:for(;gt=(St=r.distcode[ot&(1<>>16&255,bt=65535&St,!((mt=St>>>24)<=st);){if(0===nt)break t;nt--,ot+=$[et++]<>_t)])>>>16&255,bt=65535&St,!(_t+(mt=St>>>24)<=st);){if(0===nt)break t;nt--,ot+=$[et++]<>>=_t,st-=_t,r.back+=_t}if(ot>>>=mt,st-=mt,r.back+=mt,64>){t.msg="invalid distance code",r.mode=Q;break}r.offset=bt,r.extra=15>,r.mode=q;case q:if(r.extra){for(kt=r.extra;st>>=r.extra,st-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=Q;break}r.mode=Z;case Z:if(0===at)break t;if(ft=lt-at,r.offset>ft){if((ft=r.offset-ft)>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=Q;break}ft>r.wnext?(ft-=r.wnext,dt=r.wsize-ft):dt=r.wnext-ft,ft>r.length&&(ft=r.length),pt=r.window}else pt=tt,dt=it-r.offset,ft=r.length;ft>at&&(ft=at),at-=ft,r.length-=ft;do{tt[it++]=pt[dt++]}while(--ft);0===r.length&&(r.mode=G);break;case Y:if(0===at)break t;tt[it++]=r.length,at--,r.mode=G;break;case V:if(r.wrap){for(;st<32;){if(0===nt)break t;nt--,ot|=$[et++]<=1&&0===U[A];A--);if(I>A&&(I=A),0===A)return f[u++]=20971520,f[u++]=20971520,d.bits=1,0;for(M=1;M0&&(0===t||1!==A))return-1;for(z[1]=0,k=1;k852||2===t&&P>592)return 1;for(;;){w=k-T,c[S]y?(v=D[N+c[S]],x=L[C+c[S]]):(v=96,x=0),p=1<>T)+(m-=p)]=w<<24|v<<16|x|0}while(0!==m);for(p=1<>=1;if(0!==p?(O&=p-1,O+=p):O=0,S++,0==--U[k]){if(k===A)break;k=e[r+c[S]]}if(k>I&&(O&b)!==g){for(0===T&&(T=I),_+=M,R=1<<(B=k-T);B+T852||2===t&&P>592)return 1;f[g=O&b]=I<<24|B<<16|_-u|0}}return 0!==O&&(f[_+O]=k-T<<24|64<<16|0),d.bits=I,0}},{"../utils/common":49}],57:[function(t,e,r){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],58:[function(t,e,r){"use strict";var i=t("../utils/common"),n=4,a=0,o=1,s=2;function h(t){for(var e=t.length;--e>=0;)t[e]=0}var l=0,f=1,u=2,c=29,d=256,p=d+1+c,m=30,g=19,b=2*p+1,_=15,y=16,w=7,v=256,x=16,E=17,k=18,S=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],M=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],A=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],I=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],B=new Array(2*(p+2));h(B);var T=new Array(2*m);h(T);var R=new Array(512);h(R);var P=new Array(256);h(P);var O=new Array(c);h(O);var L,C,U,z=new Array(m);function D(t,e,r,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}function N(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function F(t){return t<256?R[t]:R[256+(t>>>7)]}function j(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function G(t,e,r){t.bi_valid>y-r?(t.bi_buf|=e<>y-t.bi_valid,t.bi_valid+=r-y):(t.bi_buf|=e<>>=1,r<<=1}while(--e>0);return r>>>1}function q(t,e,r){var i,n,a=new Array(_+1),o=0;for(i=1;i<=_;i++)a[i]=o=o+r[i-1]<<1;for(n=0;n<=e;n++){var s=t[2*n+1];0!==s&&(t[2*n]=W(a[s]++,s))}}function Z(t){var e;for(e=0;e8?j(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function V(t,e,r,i){var n=2*e,a=2*r;return t[n]>1;r>=1;r--)X(t,a,r);n=h;do{r=t.heap[1],t.heap[1]=t.heap[t.heap_len--],X(t,a,1),i=t.heap[1],t.heap[--t.heap_max]=r,t.heap[--t.heap_max]=i,a[2*n]=a[2*r]+a[2*i],t.depth[n]=(t.depth[r]>=t.depth[i]?t.depth[r]:t.depth[i])+1,a[2*r+1]=a[2*i+1]=n,t.heap[1]=n++,X(t,a,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var r,i,n,a,o,s,h=e.dyn_tree,l=e.max_code,f=e.stat_desc.static_tree,u=e.stat_desc.has_stree,c=e.stat_desc.extra_bits,d=e.stat_desc.extra_base,p=e.stat_desc.max_length,m=0;for(a=0;a<=_;a++)t.bl_count[a]=0;for(h[2*t.heap[t.heap_max]+1]=0,r=t.heap_max+1;rp&&(a=p,m++),h[2*i+1]=a,i>l||(t.bl_count[a]++,o=0,i>=d&&(o=c[i-d]),s=h[2*i],t.opt_len+=s*(a+o),u&&(t.static_len+=s*(f[2*i+1]+o)));if(0!==m){do{for(a=p-1;0===t.bl_count[a];)a--;t.bl_count[a]--,t.bl_count[a+1]+=2,t.bl_count[p]--,m-=2}while(m>0);for(a=p;0!==a;a--)for(i=t.bl_count[a];0!==i;)(n=t.heap[--r])>l||(h[2*n+1]!==a&&(t.opt_len+=(a-h[2*n+1])*h[2*n],h[2*n+1]=a),i--)}}(t,e),q(a,l,t.bl_count)}function K(t,e,r){var i,n,a=-1,o=e[1],s=0,h=7,l=4;for(0===o&&(h=138,l=3),e[2*(r+1)+1]=65535,i=0;i<=r;i++)n=o,o=e[2*(i+1)+1],++s>=7;i0?(t.strm.data_type===s&&(t.strm.data_type=function(t){var e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return a;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return o;for(e=32;e=3&&0===t.bl_tree[2*I[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),h=t.opt_len+3+7>>>3,(l=t.static_len+3+7>>>3)<=h&&(h=l)):h=l=r+5,r+4<=h&&-1!==e?et(t,e,r,i):t.strategy===n||l===h?(G(t,(f<<1)+(i?1:0),3),J(t,B,T)):(G(t,(u<<1)+(i?1:0),3),function(t,e,r,i){var n;for(G(t,e-257,5),G(t,r-1,5),G(t,i-4,4),n=0;n>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&r,t.last_lit++,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(P[r]+d+1)]++,t.dyn_dtree[2*F(e)]++),t.last_lit===t.lit_bufsize-1},r._tr_align=function(t){G(t,f<<1,3),H(t,v,B),function(t){16===t.bi_valid?(j(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},{"../utils/common":49}],59:[function(t,e,r){"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],60:[function(t,e,r){var i,n,a=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function h(t){if(i===setTimeout)return setTimeout(t,0);if((i===o||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(e){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:o}catch(t){i=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var l,f=[],u=!1,c=-1;function d(){u&&l&&(u=!1,l.length?f=l.concat(f):c=-1,f.length&&p())}function p(){if(!u){var t=h(d);u=!0;for(var e=f.length;e;){for(l=f,f=[];++c1)for(var r=1;r2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}n("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(t,e,r){var i,n,o,s;if("string"==typeof e&&(o="not ",e.substr(!s||s<0?0:+s,o.length)===o)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))n="The ".concat(t," ").concat(i," ").concat(a(e,"type"));else{var h=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";n='The "'.concat(t,'" ').concat(h," ").concat(i," ").concat(a(e,"type"))}return n+". Received type ".concat(typeof r)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.codes=i},{}],63:[function(t,e,r){(function(r){(function(){"use strict";var i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};e.exports=l;var n=t("./_stream_readable"),a=t("./_stream_writable");t("inherits")(l,n);for(var o=i(a.prototype),s=0;s0)if("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===s.prototype||(e=function(t){return s.from(t)}(e)),i)o.endEmitted?x(t,new v):A(t,o,e,!0);else if(o.ended)x(t,new y);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?A(t,o,e,!1):P(t,o)):A(t,o,e,!1)}else i||(o.reading=!1,P(t,o));return!o.ended&&(o.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=I?t=I:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function T(t){var e=t._readableState;l("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(l("emitReadable",e.flowing),e.emittedReadable=!0,r.nextTick(R,t))}function R(t){var e=t._readableState;l("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,z(t)}function P(t,e){e.readingMore||(e.readingMore=!0,r.nextTick(O,t,e))}function O(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function C(t){l("readable nexttick read 0"),t.read(0)}function U(t,e){l("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),z(t),e.flowing&&!e.reading&&t.read(0)}function z(t){var e=t._readableState;for(l("flow",e.flowing);e.flowing&&null!==t.read(););}function D(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function N(t){var e=t._readableState;l("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,r.nextTick(F,e,t))}function F(t,e){if(l("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function j(t,e){for(var r=0,i=t.length;r=e.highWaterMark:e.length>0)||e.ended))return l("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?N(this):T(this),null;if(0===(t=B(t,e))&&e.ended)return 0===e.length&&N(this),null;var i,n=e.needReadable;return l("need readable",n),(0===e.length||e.length-t0?D(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&N(this)),null!==i&&this.emit("data",i),i},S.prototype._read=function(t){x(this,new w("_read()"))},S.prototype.pipe=function(t,e){var i=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=t;break;case 1:n.pipes=[n.pipes,t];break;default:n.pipes.push(t)}n.pipesCount+=1,l("pipe count=%d opts=%j",n.pipesCount,e);var o=e&&!1===e.end||t===r.stdout||t===r.stderr?g:h;function s(e,r){l("onunpipe"),e===i&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,l("cleanup"),t.removeListener("close",p),t.removeListener("finish",m),t.removeListener("drain",f),t.removeListener("error",d),t.removeListener("unpipe",s),i.removeListener("end",h),i.removeListener("end",g),i.removeListener("data",c),u=!0,!n.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function h(){l("onend"),t.end()}n.endEmitted?r.nextTick(o):i.once("end",o),t.on("unpipe",s);var f=function(t){return function(){var e=t._readableState;l("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,z(t))}}(i);t.on("drain",f);var u=!1;function c(e){l("ondata");var r=t.write(e);l("dest.write",r),!1===r&&((1===n.pipesCount&&n.pipes===t||n.pipesCount>1&&-1!==j(n.pipes,t))&&!u&&(l("false write response, pause",n.awaitDrain),n.awaitDrain++),i.pause())}function d(e){l("onerror",e),g(),t.removeListener("error",d),0===a(t,"error")&&x(t,e)}function p(){t.removeListener("finish",m),g()}function m(){l("onfinish"),t.removeListener("close",p),g()}function g(){l("unpipe"),i.unpipe(t)}return i.on("data",c),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",d),t.once("close",p),t.once("finish",m),t.emit("pipe",i),n.flowing||(l("pipe resume"),i.resume()),t},S.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var a=0;a0,!1!==n.flowing&&this.resume()):"readable"===t&&(n.endEmitted||n.readableListening||(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,l("on readable",n.length,n.reading),n.length?T(this):n.reading||r.nextTick(C,this))),i},S.prototype.addListener=S.prototype.on,S.prototype.removeListener=function(t,e){var i=o.prototype.removeListener.call(this,t,e);return"readable"===t&&r.nextTick(L,this),i},S.prototype.removeAllListeners=function(t){var e=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||r.nextTick(L,this),e},S.prototype.resume=function(){var t=this._readableState;return t.flowing||(l("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,r.nextTick(U,t,e))}(this,t)),t.paused=!1,this},S.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(l("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},S.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",(function(){if(l("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(n){l("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n||(r.objectMode||n&&n.length)&&(e.push(n)||(i=!0,t.pause()))})),t)void 0===this[n]&&"function"==typeof t[n]&&(this[n]=function(e){return function(){return t[e].apply(t,arguments)}}(n));for(var a=0;a-1))throw new v(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(S.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),S.prototype._write=function(t,e,r){r(new m("_write()"))},S.prototype._writev=null,S.prototype.end=function(t,e,i){var n=this._writableState;return"function"==typeof t?(i=t,t=null,e=null):"function"==typeof e&&(i=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||function(t,e,i){e.ending=!0,P(t,e),i&&(e.finished?r.nextTick(i):t.once("finish",i)),e.ended=!0,t.writable=!1}(this,n,i),this},Object.defineProperty(S.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(S.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),S.prototype.destroy=u.destroy,S.prototype._undestroy=u.undestroy,S.prototype._destroy=function(t,e){e(t)}}).call(this)}).call(this,t("_process"),void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":62,"./_stream_duplex":63,"./internal/streams/destroy":70,"./internal/streams/state":74,"./internal/streams/stream":75,_process:60,buffer:33,inherits:45,"util-deprecate":78}],68:[function(t,e,r){(function(r){(function(){"use strict";var i;function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var a=t("./end-of-stream"),o=Symbol("lastResolve"),s=Symbol("lastReject"),h=Symbol("error"),l=Symbol("ended"),f=Symbol("lastPromise"),u=Symbol("handlePromise"),c=Symbol("stream");function d(t,e){return{value:t,done:e}}function p(t){var e=t[o];if(null!==e){var r=t[c].read();null!==r&&(t[f]=null,t[o]=null,t[s]=null,e(d(r,!1)))}}function m(t){r.nextTick(p,t)}var g=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((n(i={get stream(){return this[c]},next:function(){var t=this,e=this[h];if(null!==e)return Promise.reject(e);if(this[l])return Promise.resolve(d(void 0,!0));if(this[c].destroyed)return new Promise((function(e,i){r.nextTick((function(){t[h]?i(t[h]):e(d(void 0,!0))}))}));var i,n=this[f];if(n)i=new Promise(function(t,e){return function(r,i){t.then((function(){e[l]?r(d(void 0,!0)):e[u](r,i)}),i)}}(n,this));else{var a=this[c].read();if(null!==a)return Promise.resolve(d(a,!1));i=new Promise(this[u])}return this[f]=i,i}},Symbol.asyncIterator,(function(){return this})),n(i,"return",(function(){var t=this;return new Promise((function(e,r){t[c].destroy(null,(function(t){t?r(t):e(d(void 0,!0))}))}))})),i),g);e.exports=function(t){var e,r=Object.create(b,(n(e={},c,{value:t,writable:!0}),n(e,o,{value:null,writable:!0}),n(e,s,{value:null,writable:!0}),n(e,h,{value:null,writable:!0}),n(e,l,{value:t._readableState.endEmitted,writable:!0}),n(e,u,{value:function(t,e){var i=r[c].read();i?(r[f]=null,r[o]=null,r[s]=null,t(d(i,!1))):(r[o]=t,r[s]=e)},writable:!0}),e));return r[f]=null,a(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=r[s];return null!==e&&(r[f]=null,r[o]=null,r[s]=null,e(t)),void(r[h]=t)}var i=r[o];null!==i&&(r[f]=null,r[o]=null,r[s]=null,i(d(void 0,!0))),r[l]=!0})),t.on("readable",m.bind(null,r)),r}}).call(this)}).call(this,t("_process"))},{"./end-of-stream":71,_process:60}],69:[function(t,e,r){"use strict";function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function a(t,e){for(var r=0;r0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return o.alloc(0);for(var e=o.allocUnsafe(t>>>0),r=this.head,i=0;r;)n=r.data,a=e,s=i,o.prototype.copy.call(n,a,s),i+=r.data.length,r=r.next;var n,a,s;return e}},{key:"consume",value:function(t,e){var r;return tn.length?n.length:t;if(a===n.length?i+=n:i+=n.slice(0,t),0==(t-=a)){a===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(a));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=o.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,a=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,a),0==(t-=a)){a===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(a));break}++i}return this.length-=i,e}},{key:h,value:function(t,e){return s(this,function(t){for(var e=1;e0,(function(t){f||(f=t),t&&c.forEach(h),a||(c.forEach(h),u(f))}))}));return r.reduce(l)}},{"../../../errors":62,"./end-of-stream":71}],74:[function(t,e,r){"use strict";var i=t("../../../errors").codes.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(t,e,r,n){var a=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,n,r);if(null!=a){if(!isFinite(a)||Math.floor(a)!==a||a<0)throw new i(n?r:"highWaterMark",a);return Math.floor(a)}return t.objectMode?16:16384}}},{"../../../errors":62}],75:[function(t,e,r){e.exports=t("events").EventEmitter},{events:38}],76:[function(t,e,r){"use strict";var i=t("safe-buffer").Buffer,n=i.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function a(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(i.isEncoding===n||!n(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=h,this.end=l,e=4;break;case"utf8":this.fillLast=s,e=4;break;case"base64":this.text=f,this.end=u,e=3;break;default:return this.write=c,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(e)}function o(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function h(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function l(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function f(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function u(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function c(t){return t.toString(this.encoding)}function d(t){return t&&t.length?this.write(t):""}r.StringDecoder=a,a.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0?(n>0&&(t.lastNeed=n-1),n):--i=0?(n>0&&(t.lastNeed=n-2),n):--i=0?(n>0&&(2===n?n=0:t.lastNeed=n-3),n):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},a.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},{"safe-buffer":77}],77:[function(t,e,r){var i=t("buffer"),n=i.Buffer;function a(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=i:(a(i,r),r.Buffer=o),o.prototype=Object.create(n.prototype),a(n,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i.SlowBuffer(t)}},{buffer:33}],78:[function(t,e,i){(function(t){(function(){function r(e){try{if(!t.localStorage)return!1}catch(t){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=function(t,e){if(r("noDeprecation"))return t;var i=!1;return function(){if(!i){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),i=!0}return t.apply(this,arguments)}}}).call(this)}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],79:[function(t,e,r){arguments[4][25][0].apply(r,arguments)},{dup:25}],80:[function(t,e,r){"use strict";var i=t("is-arguments"),n=t("is-generator-function"),a=t("which-typed-array"),o=t("is-typed-array");function s(t){return t.call.bind(t)}var h="undefined"!=typeof BigInt,l="undefined"!=typeof Symbol,f=s(Object.prototype.toString),u=s(Number.prototype.valueOf),c=s(String.prototype.valueOf),d=s(Boolean.prototype.valueOf);if(h)var p=s(BigInt.prototype.valueOf);if(l)var m=s(Symbol.prototype.valueOf);function g(t,e){if("object"!=typeof t)return!1;try{return e(t),!0}catch(t){return!1}}function b(t){return"[object Map]"===f(t)}function _(t){return"[object Set]"===f(t)}function y(t){return"[object WeakMap]"===f(t)}function w(t){return"[object WeakSet]"===f(t)}function v(t){return"[object ArrayBuffer]"===f(t)}function x(t){return"undefined"!=typeof ArrayBuffer&&(v.working?v(t):t instanceof ArrayBuffer)}function E(t){return"[object DataView]"===f(t)}function k(t){return"undefined"!=typeof DataView&&(E.working?E(t):t instanceof DataView)}function S(t){return"[object SharedArrayBuffer]"===f(t)}function M(t){return"undefined"!=typeof SharedArrayBuffer&&(S.working?S(t):t instanceof SharedArrayBuffer)}function A(t){return g(t,u)}function I(t){return g(t,c)}function B(t){return g(t,d)}function T(t){return h&&g(t,p)}function R(t){return l&&g(t,m)}r.isArgumentsObject=i,r.isGeneratorFunction=n,r.isTypedArray=o,r.isPromise=function(t){return"undefined"!=typeof Promise&&t instanceof Promise||null!==t&&"object"==typeof t&&"function"==typeof t.then&&"function"==typeof t.catch},r.isArrayBufferView=function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):o(t)||k(t)},r.isUint8Array=function(t){return"Uint8Array"===a(t)},r.isUint8ClampedArray=function(t){return"Uint8ClampedArray"===a(t)},r.isUint16Array=function(t){return"Uint16Array"===a(t)},r.isUint32Array=function(t){return"Uint32Array"===a(t)},r.isInt8Array=function(t){return"Int8Array"===a(t)},r.isInt16Array=function(t){return"Int16Array"===a(t)},r.isInt32Array=function(t){return"Int32Array"===a(t)},r.isFloat32Array=function(t){return"Float32Array"===a(t)},r.isFloat64Array=function(t){return"Float64Array"===a(t)},r.isBigInt64Array=function(t){return"BigInt64Array"===a(t)},r.isBigUint64Array=function(t){return"BigUint64Array"===a(t)},b.working="undefined"!=typeof Map&&b(new Map),r.isMap=function(t){return"undefined"!=typeof Map&&(b.working?b(t):t instanceof Map)},_.working="undefined"!=typeof Set&&_(new Set),r.isSet=function(t){return"undefined"!=typeof Set&&(_.working?_(t):t instanceof Set)},y.working="undefined"!=typeof WeakMap&&y(new WeakMap),r.isWeakMap=function(t){return"undefined"!=typeof WeakMap&&(y.working?y(t):t instanceof WeakMap)},w.working="undefined"!=typeof WeakSet&&w(new WeakSet),r.isWeakSet=function(t){return w(t)},v.working="undefined"!=typeof ArrayBuffer&&v(new ArrayBuffer),r.isArrayBuffer=x,E.working="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView&&E(new DataView(new ArrayBuffer(1),0,1)),r.isDataView=k,S.working="undefined"!=typeof SharedArrayBuffer&&S(new SharedArrayBuffer),r.isSharedArrayBuffer=M,r.isAsyncFunction=function(t){return"[object AsyncFunction]"===f(t)},r.isMapIterator=function(t){return"[object Map Iterator]"===f(t)},r.isSetIterator=function(t){return"[object Set Iterator]"===f(t)},r.isGeneratorObject=function(t){return"[object Generator]"===f(t)},r.isWebAssemblyCompiledModule=function(t){return"[object WebAssembly.Module]"===f(t)},r.isNumberObject=A,r.isStringObject=I,r.isBooleanObject=B,r.isBigIntObject=T,r.isSymbolObject=R,r.isBoxedPrimitive=function(t){return A(t)||I(t)||B(t)||T(t)||R(t)},r.isAnyArrayBuffer=function(t){return"undefined"!=typeof Uint8Array&&(x(t)||M(t))},["isProxy","isExternal","isModuleNamespaceObject"].forEach((function(t){Object.defineProperty(r,t,{enumerable:!1,value:function(){throw new Error(t+" is not supported in userland")}})}))},{"is-arguments":46,"is-generator-function":47,"is-typed-array":48,"which-typed-array":82}],81:[function(t,e,r){(function(e){(function(){var i=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},i=0;i=a)return t;switch(t){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(t){return"[Circular]"}default:return t}})),s=i[r];r=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),m(e)?i.showHidden=e:e&&r._extend(i,e),y(i.showHidden)&&(i.showHidden=!1),y(i.depth)&&(i.depth=2),y(i.colors)&&(i.colors=!1),y(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=l),u(i,t,i.depth)}function l(t,e){var r=h.styles[e];return r?"["+h.colors[r][0]+"m"+t+"["+h.colors[r][1]+"m":t}function f(t,e){return t}function u(t,e,i){if(t.customInspect&&e&&k(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var n=e.inspect(i,t);return _(n)||(n=u(t,n,i)),n}var a=function(t,e){if(y(e))return t.stylize("undefined","undefined");if(_(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}return b(e)?t.stylize(""+e,"number"):m(e)?t.stylize(""+e,"boolean"):g(e)?t.stylize("null","null"):void 0}(t,e);if(a)return a;var o=Object.keys(e),s=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),E(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return c(e);if(0===o.length){if(k(e)){var h=e.name?": "+e.name:"";return t.stylize("[Function"+h+"]","special")}if(w(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(x(e))return t.stylize(Date.prototype.toString.call(e),"date");if(E(e))return c(e)}var l,f="",v=!1,S=["{","}"];return p(e)&&(v=!0,S=["[","]"]),k(e)&&(f=" [Function"+(e.name?": "+e.name:"")+"]"),w(e)&&(f=" "+RegExp.prototype.toString.call(e)),x(e)&&(f=" "+Date.prototype.toUTCString.call(e)),E(e)&&(f=" "+c(e)),0!==o.length||v&&0!=e.length?i<0?w(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),l=v?function(t,e,r,i,n){for(var a=[],o=0,s=e.length;o60?r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}(l,f,S)):S[0]+f+S[1]}function c(t){return"["+Error.prototype.toString.call(t)+"]"}function d(t,e,r,i,n,a){var o,s,h;if((h=Object.getOwnPropertyDescriptor(e,n)||{value:e[n]}).get?s=h.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):h.set&&(s=t.stylize("[Setter]","special")),I(i,n)||(o="["+n+"]"),s||(t.seen.indexOf(h.value)<0?(s=g(r)?u(t,h.value,null):u(t,h.value,r-1)).indexOf("\n")>-1&&(s=a?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),y(o)){if(a&&n.match(/^\d+$/))return s;(o=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+s}function p(t){return Array.isArray(t)}function m(t){return"boolean"==typeof t}function g(t){return null===t}function b(t){return"number"==typeof t}function _(t){return"string"==typeof t}function y(t){return void 0===t}function w(t){return v(t)&&"[object RegExp]"===S(t)}function v(t){return"object"==typeof t&&null!==t}function x(t){return v(t)&&"[object Date]"===S(t)}function E(t){return v(t)&&("[object Error]"===S(t)||t instanceof Error)}function k(t){return"function"==typeof t}function S(t){return Object.prototype.toString.call(t)}function M(t){return t<10?"0"+t.toString(10):t.toString(10)}r.debuglog=function(t){if(t=t.toUpperCase(),!a[t])if(o.test(t)){var i=e.pid;a[t]=function(){var e=r.format.apply(r,arguments);console.error("%s %d: %s",t,i,e)}}else a[t]=function(){};return a[t]},r.inspect=h,h.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},h.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},r.types=t("./support/types"),r.isArray=p,r.isBoolean=m,r.isNull=g,r.isNullOrUndefined=function(t){return null==t},r.isNumber=b,r.isString=_,r.isSymbol=function(t){return"symbol"==typeof t},r.isUndefined=y,r.isRegExp=w,r.types.isRegExp=w,r.isObject=v,r.isDate=x,r.types.isDate=x,r.isError=E,r.types.isNativeError=E,r.isFunction=k,r.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},r.isBuffer=t("./support/isBuffer");var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function I(t,e){return Object.prototype.hasOwnProperty.call(t,e)}r.log=function(){var t,e;console.log("%s - %s",(t=new Date,e=[M(t.getHours()),M(t.getMinutes()),M(t.getSeconds())].join(":"),[t.getDate(),A[t.getMonth()],e].join(" ")),r.format.apply(r,arguments))},r.inherits=t("inherits"),r._extend=function(t,e){if(!e||!v(e))return t;for(var r=Object.keys(e),i=r.length;i--;)t[r[i]]=e[r[i]];return t};var B="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function T(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}r.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(B&&t[B]){var e;if("function"!=typeof(e=t[B]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,B,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,r,i=new Promise((function(t,i){e=t,r=i})),n=[],a=0;a{var e=t.exports={};e.nextTick=function(){var t="undefined"!=typeof window&&window.setImmediate,e="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(t)return function(t){return window.setImmediate(t)};if(e){var r=[];return window.addEventListener("message",(function(t){var e=t.source;e!==window&&null!==e||"process-tick"!==t.data||(t.stopPropagation(),r.length>0&&r.shift()())}),!0),function(t){r.push(t),window.postMessage("process-tick","*")}}return function(t){setTimeout(t,0)}}(),e.title="browser",e.browser=!0,e.env={},e.argv=[],e.binding=function(t){throw new Error("process.binding is not supported")},e.cwd=function(){return"/"},e.chdir=function(t){throw new Error("process.chdir is not supported")}},6197:(t,e,r)=>{"use strict";var i=r(8834).lW;Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractTokenizer=void 0;const n=r(4644);e.AbstractTokenizer=class{constructor(t){this.position=0,this.numBuffer=new Uint8Array(8),this.fileInfo=t||{}}async readToken(t,e=this.position){const r=i.alloc(t.len);if(await this.readBuffer(r,{position:e})e)return this.position+=e,e}return this.position+=t,t}async close(){}normalizeOptions(t,e){if(e&&void 0!==e.position&&e.position{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BufferTokenizer=void 0;const i=r(4644),n=r(6197);class a extends n.AbstractTokenizer{constructor(t,e){super(e),this.uint8Array=t,this.fileInfo.size=this.fileInfo.size?this.fileInfo.size:t.length}async readBuffer(t,e){if(e&&e.position){if(e.position{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.fromFile=e.FileTokenizer=void 0;const i=r(6197),n=r(4644),a=r(5187);class o extends i.AbstractTokenizer{constructor(t,e){super(e),this.fd=t}async readBuffer(t,e){const r=this.normalizeOptions(t,e);this.position=r.position;const i=await a.read(this.fd,t,r.offset,r.length,r.position);if(this.position+=i.bytesRead,i.bytesRead{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.readFile=e.writeFileSync=e.writeFile=e.read=e.open=e.close=e.stat=e.createReadStream=e.pathExists=void 0;const i=r(6777);e.pathExists=i.existsSync,e.createReadStream=i.createReadStream,e.stat=async function(t){return new Promise(((e,r)=>{i.stat(t,((t,i)=>{t?r(t):e(i)}))}))},e.close=async function(t){return new Promise(((e,r)=>{i.close(t,(t=>{t?r(t):e()}))}))},e.open=async function(t,e){return new Promise(((r,n)=>{i.open(t,e,((t,e)=>{t?n(t):r(e)}))}))},e.read=async function(t,e,r,n,a){return new Promise(((o,s)=>{i.read(t,e,r,n,a,((t,e,r)=>{t?s(t):o({bytesRead:e,buffer:r})}))}))},e.writeFile=async function(t,e){return new Promise(((r,n)=>{i.writeFile(t,e,(t=>{t?n(t):r()}))}))},e.writeFileSync=function(t,e){i.writeFileSync(t,e)},e.readFile=async function(t){return new Promise(((e,r)=>{i.readFile(t,((t,i)=>{t?r(t):e(i)}))}))}},8286:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ReadStreamTokenizer=void 0;const i=r(6197),n=r(4644);class a extends i.AbstractTokenizer{constructor(t,e){super(e),this.streamReader=new n.StreamReader(t)}async getFileInfo(){return this.fileInfo}async readBuffer(t,e){const r=this.normalizeOptions(t,e),i=r.position-this.position;if(i>0)return await this.ignore(i),this.readBuffer(t,e);if(i<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(0===r.length)return 0;const a=await this.streamReader.read(t,r.offset,r.length);if(this.position+=a,(!e||!e.mayBeLess)&&a0){const n=new Uint8Array(r.length+e);return i=await this.peekBuffer(n,{mayBeLess:r.mayBeLess}),t.set(n.subarray(e),r.offset),i-e}if(e<0)throw new Error("Cannot peek from a negative offset in a stream")}if(r.length>0){try{i=await this.streamReader.peek(t,r.offset,r.length)}catch(t){if(e&&e.mayBeLess&&t instanceof n.EndOfStreamError)return 0;throw t}if(!r.mayBeLess&&i{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.fromBuffer=e.fromStream=e.EndOfStreamError=void 0;const i=r(8286),n=r(932);var a=r(4644);Object.defineProperty(e,"EndOfStreamError",{enumerable:!0,get:function(){return a.EndOfStreamError}}),e.fromStream=function(t,e){return e=e||{},new i.ReadStreamTokenizer(t,e)},e.fromBuffer=function(t,e){return new n.BufferTokenizer(t,e)}},3569:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.fromStream=e.fromBuffer=e.EndOfStreamError=e.fromFile=void 0;const i=r(5187),n=r(7378);var a=r(9425);Object.defineProperty(e,"fromFile",{enumerable:!0,get:function(){return a.fromFile}});var o=r(7378);Object.defineProperty(e,"EndOfStreamError",{enumerable:!0,get:function(){return o.EndOfStreamError}}),Object.defineProperty(e,"fromBuffer",{enumerable:!0,get:function(){return o.fromBuffer}}),e.fromStream=async function(t,e){if(e=e||{},t.path){const r=await i.stat(t.path);e.path=t.path,e.size=r.size}return n.fromStream(t,e)}},643:(t,e)=>{"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.Ee=function(t,e,r,i,n,a){for(var o=arguments.length,h=Array(o>6?o-6:0),l=6;l3?u-3:0),d=3;d{"use strict";var i=r(8834).lW;Object.defineProperty(e,"__esModule",{value:!0}),e.AnsiStringType=e.StringType=e.BufferType=e.Uint8ArrayType=e.IgnoreType=e.Float80_LE=e.Float80_BE=e.Float64_LE=e.Float64_BE=e.Float32_LE=e.Float32_BE=e.Float16_LE=e.Float16_BE=e.INT64_BE=e.UINT64_BE=e.INT64_LE=e.UINT64_LE=e.INT32_LE=e.INT32_BE=e.INT24_BE=e.INT24_LE=e.INT16_LE=e.INT16_BE=e.INT8=e.UINT32_BE=e.UINT32_LE=e.UINT24_BE=e.UINT24_LE=e.UINT16_BE=e.UINT16_LE=e.UINT8=void 0;const n=r(2333);function a(t){return new DataView(t.buffer,t.byteOffset)}e.UINT8={len:1,get:(t,e)=>a(t).getUint8(e),put:(t,e,r)=>(a(t).setUint8(e,r),e+1)},e.UINT16_LE={len:2,get:(t,e)=>a(t).getUint16(e,!0),put:(t,e,r)=>(a(t).setUint16(e,r,!0),e+2)},e.UINT16_BE={len:2,get:(t,e)=>a(t).getUint16(e),put:(t,e,r)=>(a(t).setUint16(e,r),e+2)},e.UINT24_LE={len:3,get(t,e){const r=a(t);return r.getUint8(e)+(r.getUint16(e+1,!0)<<8)},put(t,e,r){const i=a(t);return i.setUint8(e,255&r),i.setUint16(e+1,r>>8,!0),e+3}},e.UINT24_BE={len:3,get(t,e){const r=a(t);return(r.getUint16(e)<<8)+r.getUint8(e+2)},put(t,e,r){const i=a(t);return i.setUint16(e,r>>8),i.setUint8(e+2,255&r),e+3}},e.UINT32_LE={len:4,get:(t,e)=>a(t).getUint32(e,!0),put:(t,e,r)=>(a(t).setUint32(e,r,!0),e+4)},e.UINT32_BE={len:4,get:(t,e)=>a(t).getUint32(e),put:(t,e,r)=>(a(t).setUint32(e,r),e+4)},e.INT8={len:1,get:(t,e)=>a(t).getInt8(e),put:(t,e,r)=>(a(t).setInt8(e,r),e+1)},e.INT16_BE={len:2,get:(t,e)=>a(t).getInt16(e),put:(t,e,r)=>(a(t).setInt16(e,r),e+2)},e.INT16_LE={len:2,get:(t,e)=>a(t).getInt16(e,!0),put:(t,e,r)=>(a(t).setInt16(e,r,!0),e+2)},e.INT24_LE={len:3,get(t,r){const i=e.UINT24_LE.get(t,r);return i>8388607?i-16777216:i},put(t,e,r){const i=a(t);return i.setUint8(e,255&r),i.setUint16(e+1,r>>8,!0),e+3}},e.INT24_BE={len:3,get(t,r){const i=e.UINT24_BE.get(t,r);return i>8388607?i-16777216:i},put(t,e,r){const i=a(t);return i.setUint16(e,r>>8),i.setUint8(e+2,255&r),e+3}},e.INT32_BE={len:4,get:(t,e)=>a(t).getInt32(e),put:(t,e,r)=>(a(t).setInt32(e,r),e+4)},e.INT32_LE={len:4,get:(t,e)=>a(t).getInt32(e,!0),put:(t,e,r)=>(a(t).setInt32(e,r,!0),e+4)},e.UINT64_LE={len:8,get:(t,e)=>a(t).getBigUint64(e,!0),put:(t,e,r)=>(a(t).setBigUint64(e,r,!0),e+8)},e.INT64_LE={len:8,get:(t,e)=>a(t).getBigInt64(e,!0),put:(t,e,r)=>(a(t).setBigInt64(e,r,!0),e+8)},e.UINT64_BE={len:8,get:(t,e)=>a(t).getBigUint64(e),put:(t,e,r)=>(a(t).setBigUint64(e,r),e+8)},e.INT64_BE={len:8,get:(t,e)=>a(t).getBigInt64(e),put:(t,e,r)=>(a(t).setBigInt64(e,r),e+8)},e.Float16_BE={len:2,get(t,e){return n.read(t,e,!1,10,this.len)},put(t,e,r){return n.write(t,r,e,!1,10,this.len),e+this.len}},e.Float16_LE={len:2,get(t,e){return n.read(t,e,!0,10,this.len)},put(t,e,r){return n.write(t,r,e,!0,10,this.len),e+this.len}},e.Float32_BE={len:4,get:(t,e)=>a(t).getFloat32(e),put:(t,e,r)=>(a(t).setFloat32(e,r),e+4)},e.Float32_LE={len:4,get:(t,e)=>a(t).getFloat32(e,!0),put:(t,e,r)=>(a(t).setFloat32(e,r,!0),e+4)},e.Float64_BE={len:8,get:(t,e)=>a(t).getFloat64(e),put:(t,e,r)=>(a(t).setFloat64(e,r),e+8)},e.Float64_LE={len:8,get:(t,e)=>a(t).getFloat64(e,!0),put:(t,e,r)=>(a(t).setFloat64(e,r,!0),e+8)},e.Float80_BE={len:10,get(t,e){return n.read(t,e,!1,63,this.len)},put(t,e,r){return n.write(t,r,e,!1,63,this.len),e+this.len}},e.Float80_LE={len:10,get(t,e){return n.read(t,e,!0,63,this.len)},put(t,e,r){return n.write(t,r,e,!0,63,this.len),e+this.len}},e.IgnoreType=class{constructor(t){this.len=t}get(t,e){}},e.Uint8ArrayType=class{constructor(t){this.len=t}get(t,e){return t.subarray(e,e+this.len)}},e.BufferType=class{constructor(t){this.len=t}get(t,e){return i.from(t.subarray(e,e+this.len))}},e.StringType=class{constructor(t,e){this.len=t,this.encoding=e}get(t,e){return i.from(t).toString(this.encoding,e,e+this.len)}};class o{constructor(t){this.len=t}static decode(t,e,r){let i="";for(let n=e;n>10),56320+(1023&t)))}static singleByteDecoder(t){if(o.inRange(t,0,127))return t;const e=o.windows1252[t-128];if(null===e)throw Error("invaliding encoding");return e}get(t,e=0){return o.decode(t,e,e+this.len)}}e.AnsiStringType=o,o.windows1252=[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]},311:(t,e)=>{(e=t.exports=function(t){return t.replace(/^\s*|\s*$/g,"")}).left=function(t){return t.replace(/^\s*/,"")},e.right=function(t){return t.replace(/\s*$/,"")}},9299:(t,e,r)=>{var i=r(4406);!function(){var e={};function n(){void 0===i&&console.log.apply(console,arguments)}t.exports=e,function(t,e){var r,i,a,o,s,h,l,f,u,c,d,p,m,g,b;!function(){"use strict";var e=function(){function t(t){this.message="JPEG error: "+t}return t.prototype=new Error,t.prototype.name="JpegError",t.constructor=t,t}(),r=function(){var t=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),r=4017,n=799,a=3406,o=2276,s=1567,h=3784,l=5793,f=2896;function u(t){null==t&&(t={}),null==t.w&&(t.w=-1),this.V=t.n,this.N=t.w}function c(t,e){for(var r,i,n,a=0,o=[],s=16;s>0&&!t[s-1];)s--;o.push({children:[],index:0});var h=o[0];for(r=0;r0;)h=o.pop();for(h.index++,o.push(h);o.length<=r;)o.push(n={children:[],index:0}),h.children[h.index]=n.children,h=n;a++}r+10)return T--,B>>T&1;if(255===(B=r[n++])){var t=r[n++];if(t){if(220===t&&c){var o=i(r,n+=2);if(n+=2,o>0&&o!==a.s)throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data",o)}else if(217===t){if(c){var s=8*O;if(s>0&&s>>7}function U(t){for(var r=t;;){switch(typeof(r=r[C()])){case"number":return r;case"object":continue}throw new e("invalid huffman sequence")}}function z(t){for(var e=0;t>0;)e=e<<1|C(),t--;return e}function D(t){if(1===t)return 1===C()?1:-1;var e=z(t);return e>=1<0)R--;else for(var i=h,n=l;i<=n;){var a=U(e.i),o=15&a,s=a>>4;if(0!==o){var f=t[i+=s];e.D[r+f]=D(o)*(1<>4,0==(n=15&a))f<15?(R=z(f)+(1<>4;if(0!==s){var l=t[a+=h];e.D[r+l]=D(s),a++}else{if(h<15)break;a+=16}}},E=1===j?o[0].P*o[0].c:M*a.R;L<=E;){var G=s?Math.min(E-L,s):E;if(G>0){for(g=0;g=65488&&x.M<=65495))break;n+=2}return n-I}function m(t,i,u){var c,d,p,m,g,b,_,y,w,v,x,E,k,S,M,A,I,B=t.$,T=t.D;if(!B)throw new e("missing required Quantization Table.");for(var R=0;R<64;R+=8)w=T[i+R],v=T[i+R+1],x=T[i+R+2],E=T[i+R+3],k=T[i+R+4],S=T[i+R+5],M=T[i+R+6],A=T[i+R+7],w*=B[R],0!=(v|x|E|k|S|M|A)?(v*=B[R+1],x*=B[R+2],E*=B[R+3],k*=B[R+4],S*=B[R+5],M*=B[R+6],A*=B[R+7],d=(c=(c=l*w+128>>8)+(d=l*k+128>>8)+1>>1)-d,I=(p=x)*h+(m=M)*s+128>>8,p=p*s-m*h+128>>8,_=(g=(g=f*(v-A)+128>>8)+(_=S<<4)+1>>1)-_,b=(y=(y=f*(v+A)+128>>8)+(b=E<<4)+1>>1)-b,m=(c=c+(m=I)+1>>1)-m,p=(d=d+p+1>>1)-p,I=g*o+y*a+2048>>12,g=g*a-y*o+2048>>12,y=I,I=b*n+_*r+2048>>12,b=b*r-_*n+2048>>12,_=I,u[R]=c+y,u[R+7]=c-y,u[R+1]=d+_,u[R+6]=d-_,u[R+2]=p+b,u[R+5]=p-b,u[R+3]=m+g,u[R+4]=m-g):(I=l*w+512>>10,u[R]=I,u[R+1]=I,u[R+2]=I,u[R+3]=I,u[R+4]=I,u[R+5]=I,u[R+6]=I,u[R+7]=I);for(var P=0;P<8;++P)w=u[P],0!=((v=u[P+8])|(x=u[P+16])|(E=u[P+24])|(k=u[P+32])|(S=u[P+40])|(M=u[P+48])|(A=u[P+56]))?(d=(c=4112+((c=l*w+2048>>12)+(d=l*k+2048>>12)+1>>1))-d,I=(p=x)*h+(m=M)*s+2048>>12,p=p*s-m*h+2048>>12,m=I,_=(g=(g=f*(v-A)+2048>>12)+(_=S)+1>>1)-_,b=(y=(y=f*(v+A)+2048>>12)+(b=E)+1>>1)-b,I=g*o+y*a+2048>>12,g=g*a-y*o+2048>>12,y=I,I=b*n+_*r+2048>>12,b=b*r-_*n+2048>>12,(w=(c=c+m+1>>1)+y)<16?w=0:w>=4080?w=255:w>>=4,(v=(d=d+p+1>>1)+(_=I))<16?v=0:v>=4080?v=255:v>>=4,(x=(p=d-p)+b)<16?x=0:x>=4080?x=255:x>>=4,(E=(m=c-m)+g)<16?E=0:E>=4080?E=255:E>>=4,(k=m-g)<16?k=0:k>=4080?k=255:k>>=4,(S=p-b)<16?S=0:S>=4080?S=255:S>>=4,(M=d-_)<16?M=0:M>=4080?M=255:M>>=4,(A=c-y)<16?A=0:A>=4080?A=255:A>>=4,T[i+P]=w,T[i+P+8]=v,T[i+P+16]=x,T[i+P+24]=E,T[i+P+32]=k,T[i+P+40]=S,T[i+P+48]=M,T[i+P+56]=A):(I=(I=l*w+8192>>14)<-2040?0:I>=2024?255:I+2056>>4,T[i+P]=I,T[i+P+8]=I,T[i+P+16]=I,T[i+P+24]=I,T[i+P+32]=I,T[i+P+40]=I,T[i+P+48]=I,T[i+P+56]=I)}function g(t,e){for(var r=e.P,i=e.c,n=new Int16Array(64),a=0;a=n)return null;var o=i(t,e);if(o>=65472&&o<=65534)return{u:null,M:o,offset:e};for(var s=i(t,a);!(s>=65472&&s<=65534);){if(++a>=n)return null;s=i(t,a)}return{u:o.toString(16),M:s,offset:a}}return u.prototype={parse(r,n){null==n&&(n={});var a,o,s=n.F,h=0,l=null,f=null,u=0;function d(){var t=i(r,h),e=(h+=2)+t-2,n=b(r,e,h);n&&n.u&&(e=n.offset);var a=r.subarray(h,e);return h+=a.length,a}function m(t){for(var e=Math.ceil(t.o/8/t.X),r=Math.ceil(t.s/8/t.B),i=0;i>4==0)for(E=0;E<64;E++)I[t[E]]=r[h++];else{if(A>>4!=1)throw new e("DQT - invalid table spec");for(E=0;E<64;E++)I[t[E]]=i(r,h),h+=2}_[15&A]=I}break;case 65472:case 65473:case 65474:if(a)throw new e("Only single frame JPEGs supported");h+=2,(a={}).G=65473===v,a.Z=65474===v,a.precision=r[h++];var B,T=i(r,h),R=0,P=0;h+=2,a.s=s||T,a.o=i(r,h),h+=2,a.W=[],a._={};var O=r[h++];for(x=0;x>4,C=15&r[h+1];R>4==0?w:y)[15&D]=c(N,j)}break;case 65501:o=i(r,h+=2),h+=2;break;case 65498:var G,H=1==++u&&!s;h+=2;var W=r[h++],q=[];for(x=0;x>4],G.i=y[15&V],q.push(G)}var X=r[h++],J=r[h++],Q=r[h++];try{var K=p(r,h,a,q,o,X,J,Q>>4,15&Q,H);h+=K}catch(t){if(t instanceof DNLMarkerError)return this.parse(r,{F:t.s});if(t instanceof EOIMarkerError)break t;throw t}break;case 65500:h+=4;break;case 65535:255!==r[h]&&h--;break;default:var $=b(r,h-2,h-3);if($&&$.u){h=$.offset;break}if(h>=r.length-1)break t;throw new e("JpegImage.parse - unknown marker: "+v.toString(16))}v=i(r,h),h+=2}for(this.width=a.o,this.height=a.s,this.g=l,this.b=f,this.W=[],x=0;x>8)+E[u+1];return w},get f(){return this.b?!!this.b.a:3===this.p?0!==this.N&&(82!==this.W[0].index||71!==this.W[1].index||66!==this.W[2].index):1===this.N},z:function(t){for(var e,r,i,n=0,a=t.length;n4)throw new e("Unsupported color mode");var o=this.Y(r,i,a);if(1===this.p&&n){for(var s=o.length,h=new Uint8ClampedArray(3*s),l=0,f=0;f3&&(r.t258=r.t258.slice(0,3)),s=r.t258?Math.min(32,r.t258[0])*r.t258.length:r.t277?r.t277[0]:1,1==h&&null!=r.t279&&r.t278&&32803==r.t262[0]&&(s=Math.round(8*r.t279[0]/(r.width*r.t278[0]))),r.t50885&&4==r.t50885[0]&&(s=3*r.t258[0]);var f=8*Math.ceil(r.width*s/8),u=r.t273;(null==u||r.t322)&&(u=r.t324);var c=r.t279;1==h&&1==u.length&&(c=[r.height*(f>>>3)]),(null==c||r.t322)&&(c=r.t325);var d=new Uint8Array(r.height*(f>>>3)),p=0;if(null!=r.t322){var m=r.t322[0],g=r.t323[0],b=Math.floor((r.width+m-1)/m),_=Math.floor((r.height+g-1)/g),y=new Uint8Array(0|Math.ceil(m*g*s/8));console.log("====",b,_);for(var w=0;w<_;w++)for(var v=0;v>>3,y=r.t278?r.t278[0]:r.height,w=Math.ceil(g*b*r.width/8);if(16==g&&!r.isLE&&null==r.t33422)for(var v=0;v>>8&255}else if(3==b)for(c=3;c>>3]>>>7-(7&e)&1;return t[1]++,r}function s(t,r){if(null==e){e={};for(var i=0;i>>=1;return t}function l(t,e){return t>>e}function f(t,e,r,i,n,a){e[r]=l(l(11*t[n]-4*t[n+a]+t[n+a+a]+4,3)+t[i],1),e[r+a]=l(l(5*t[n]+4*t[n+a]-t[n+a+a]+4,3)-t[i],1)}function u(t,e,r,i,n,a){var o=t[n-a]-t[n+a],s=t[n],h=t[i];e[r]=l(l(o+4,3)+s+h,1),e[r+a]=l(l(4-o,3)+s-h,1)}function c(t,e,r,i,n,a){e[r]=l(l(5*t[n]+4*t[n-a]-t[n-a-a]+4,3)+t[i],1),e[r+a]=l(l(11*t[n]-4*t[n-a]+t[n-a-a]+4,3)-t[i],1)}function d(t){return i[t=t<0?0:t>4095?4095:t]>>>2}return function(e,n,o,l,p){l=new Uint16Array(l.buffer);var m,g,b,_,y,w,v,x,E=Date.now(),k=t._binBE,S=n+o;for(n+=4;n>>1)*(g>>>1));for(x=new Int16Array((m>>>1)*(g>>>1)),r=new Int16Array(1024),R=0;R<1024;R++){var P=R-512,O=Math.abs(P),L=Math.floor(768*O*O*O/16581375)+O;r[R]=Math.sign(P)*L}for(i=new Uint16Array(4096),R=0;R<4096;R++){var C=R,U=65535*(Math.pow(113,C/4095)-1)/112;i[R]=Math.min(U,65535)}}var z=v[y],D=h(m,1+a[b]),N=h(g,1+a[b]);if(0==b)for(var F=0;F>>1)+j]=e[G]<<8|e[G+1]}else{var H=[e,8*n],W=[],q=0,Z=D*N,Y=[0,0],V=0;for(A=0;q0;)W[q++]=A,V--;var X=(b-1)%3,J=1!=X?D:0,Q=0!=X?N:0;for(F=0;F>>1)+J,$=F*D;for(j=0;j>>1,et=2*D,rt=2*N;for(F=0;F>14-2*ht&3;var lt=ot[st];if(0!=lt)for(F=0;F>>1)*(m>>>1)+(j>>>1)],gt=ut[G]-2048,bt=ct[G]-2048,_t=dt[G]-2048,yt=(gt<<1)+mt,wt=(bt<<1)+mt,vt=mt+_t,xt=mt-_t;l[pt]=d(yt),l[pt+1]=d(vt),l[pt+m]=d(xt),l[pt+m+1]=d(wt)}}n+=4*T}else if(16388==I)n+=4*T;else if(8192!=B&&8448!=B&&9216!=B)throw I.toString(16)}}console.log(Date.now()-E)}}(),t.decode._decodeLogLuv32=function(t,e,r,i,n,a){for(var o=t.width,s=4*o,h=0,l=new Uint8Array(s);h>>11,p=15&u>>>22,m=15&u>>>26,g=0;g<4&&128<>3))>>>(7&b)&127)<2047&&(y[x]=2047),b+=7);for(x=0;x<16;x++,A+=2)U=y[x]<<1,t.decode._putsF(a,(I*s+A)*l,U<<16-l);A-=1&A?1:31}}}else for(var x=0;x>>4,a[o+x+1]=E<<4|S>>>4,a[o+x+2]=S<<4|k>>>4}else{h+=8;var M,A,I,B=[i,0,0,0],T=new Uint16Array(32770),R=[3857,3856,3599,3342,3085,2828,2571,2314,2057,1800,1543,1286,1029,772,771,768,514,513],P=0,O=t.decode._ljpeg_diff;for(T[0]=15,M=x=0;x<18;x++)for(var L=32768>>>(R[x]>>>8),C=0;C1&&(R=Math.floor(T/(P-1))),68==y&&32==w&&R>0&&(d=x.readShort(b,562));var O=[0,0],L=p(h[c]),C=[n,0,0,0];for(S=0;S>>4),0)<<1)<>>1)&1<>>3;t[i]|=r>>>16,t[i+1]|=r>>>8,t[i+2]|=r},t.decode._getbithuff=function(e,r,i,n){t.decode._get_byte;var a,o=r[0],s=r[1],h=r[2],l=r[3];if(0==i||h<0)return 0;for(;!l&&h>>32-i,n?(h-=n[a+1]>>>8,a=255&n[a+1]):h-=i,h<0)throw"e";return r[0]=o,r[1]=s,r[2]=h,r[3]=l,a},t.decode._make_decoder=function(t){var e,r,i,n,a,o=[];for(e=16;0!=e&&!t[e];e--);var s=17;for(o[0]=e,i=r=1;r<=e;r++)for(n=0;n>>8;else for(u=0;u>>8,a[o+(u<<1)+1]=255&m[u];else if(14==p||12==p){var b=16-p;for(u=0;u1),!d){if(255==e[r]&&e[r+1]==f)return{jpegOffset:r};if(null!=p&&(255==e[r+m]&&e[r+m+1]==f?u=r+m:n("JPEGInterchangeFormat does not point to SOI"),null==g?n("JPEGInterchangeFormatLength field is missing"):(m>=c||m+b<=c)&&n("JPEGInterchangeFormatLength field value is invalid"),null!=u))return{jpegOffset:u}}if(null!=y&&(w=y[0],v=y[1]),null!=p&&null!=g)if(b>=2&&m+b<=c){for(a=255==e[r+m+b-2]&&e[r+m+b-1]==f?new Uint8Array(b-2):new Uint8Array(b),s=0;s offset to first strip or tile");if(null==a){var k=0,S=[];S[k++]=255,S[k++]=f;var M=t.t519;if(null==M)throw new Error("JPEGQTables tag is missing");for(s=0;s>>8,S[k++]=255&I,S[k++]=s|l<<4,h=0;h<16;h++)S[k++]=e[r+A[s]+h];for(h=0;h>>8&255,S[k++]=255&t.height,S[k++]=t.width>>>8&255,S[k++]=255&t.width,S[k++]=x,1==x)S[k++]=1,S[k++]=17,S[k++]=0;else for(s=0;s<3;s++)S[k++]=s+1,S[k++]=0!=s?17:(15&w)<<4|15&v,S[k++]=s;null!=E&&0!=E[0]&&(S[k++]=255,S[k++]=221,S[k++]=0,S[k++]=4,S[k++]=E[0]>>>8&255,S[k++]=255&E[0]),a=new Uint8Array(S)}var B=-1;for(s=0;s>>8&255,a[R++]=255&t.height,a[R++]=t.width>>>8&255,a[R++]=255&t.width,a[R++]=x,1==x)a[R++]=1,a[R++]=17,a[R++]=0;else for(s=0;s<3;s++)a[R++]=s+1,a[R++]=0!=s?17:(15&w)<<4|15&v,a[R++]=s}if(255==e[c]&&218==e[c+1]){var P=e[c+2]<<8|e[c+3];for((o=new Uint8Array(P+2))[0]=e[c],o[1]=e[c+1],o[2]=e[c+2],o[3]=e[c+3],s=0;s>>8&255,l[u.sofPosition+6]=255&e.height,l[u.sofPosition+7]=e.width>>>8&255,l[u.sofPosition+8]=255&e.width,255==r[i]&&r[i+1]==SOS||(l.set(u.sosMarker,f),f+=sosMarker.length),p=0;p=0&&h<128)for(var l=0;l=-127&&h<0){for(l=0;l<1-h;l++)o[n]=a[e],n++;e++}}return n},t.decode._decodeThunder=function(t,e,r,i,n){for(var a=[0,1,0,-1],o=[0,1,2,3,0,-3,-2,-1],s=e+r,h=2*n,l=0;e>>6,c=63&f;if(e++,3==u&&(l=15&c,i[h>>>1]|=l<<4*(1-h&1),h++),0==u)for(var d=0;d>>1]|=l<<4*(1-h&1),h++;if(2==u)for(d=0;d<2;d++)4!=(p=c>>>3*(1-d)&7)&&(l+=o[p],i[h>>>1]|=l<<4*(1-h&1),h++);if(1==u)for(d=0;d<3;d++){var p;2!=(p=c>>>2*(2-d)&3)&&(l+=a[p],i[h>>>1]|=l<<4*(1-h&1),h++)}}},t.decode._dmap={1:0,"011":1,"000011":2,"0000011":3,"010":-1,"000010":-2,"0000010":-3},t.decode._lens=function(){var t=function(t,e,r,i){for(var n=0;n>>3>>3]>>>7-(7&l)&1),2==s&&(k=e[l>>>3]>>>(7&l)&1),l++,u+=k,"H"==v){if(null!=h._lens[y][u]){var S=h._lens[y][u];u="",f+=S,S<64&&(h._addNtimes(c,f,y),m+=f,y=1-y,f=0,0==--x&&(v=""))}}else"0001"==u&&(u="",h._addNtimes(c,_-m,y),m=_),"001"==u&&(u="",v="H",x=2),null!=h._dmap[u]&&(g=b+h._dmap[u],h._addNtimes(c,g-m,y),m=g,u="",y=1-y);c.length==o&&""==v&&(h._writeBits(c,n,8*a+w*E),y=0,w++,m=0,d=h._makeDiff(c),c=[])}},t.decode._findDiff=function(t,e,r){for(var i=0;i=e&&t[i+1]==r)return t[i]},t.decode._makeDiff=function(t){var e=[];1==t[0]&&e.push(0,1);for(var r=1;r>>3>>3]>>>7-(7&l)&1),2==s&&(g=e[l>>>3]>>>(7&l)&1),l++,u+=g,null!=(f=h._lens[d][u])&&(h._addNtimes(c,f,d),u="",f<64&&(d=1-d),c.length==o&&(h._writeBits(c,n,8*a+p*m),c=[],p++,d=0,0!=(7&l)&&(l+=8-(7&l)),f>=64&&(l+=8)))}},t.decode._decodeG3=function(e,r,i,n,a,o,s,h){for(var l=t.decode,f=r<<3,u=0,c="",d=[],p=[],m=0;m>>3>>3]>>>7-(7&f)&1),2==s&&(M=e[f>>>3]>>>(7&f)&1),f++,c+=M,k){if(null!=l._lens[w][c]){var A=l._lens[w][c];c="",u+=A,A<64&&(l._addNtimes(d,u,w),w=1-w,u=0)}}else"H"==x?null!=l._lens[w][c]&&(A=l._lens[w][c],c="",u+=A,A<64&&(l._addNtimes(d,u,w),g+=u,w=1-w,u=0,0==--E&&(x=""))):("0001"==c&&(c="",l._addNtimes(d,y-g,w),g=y),"001"==c&&(c="",x="H",E=2),null!=l._dmap[c]&&(b=_+l._dmap[c],l._addNtimes(d,b-g,w),g=b,c="",w=1-w));c.endsWith("000000000001")&&(v>=0&&l._writeBits(d,n,8*a+v*S),h&&(1==s&&(k=1==(e[f>>>3]>>>7-(7&f)&1)),2==s&&(k=1==(e[f>>>3]>>>(7&f)&1)),f++),c="",w=0,v++,g=0,p=l._makeDiff(d),d=[])}d.length==o&&l._writeBits(d,n,8*a+v*S)},t.decode._addNtimes=function(t,e,r){for(var i=0;i>>3]|=t[i]<<7-(r+i&7)},t.decode._decodeLZW=t.decode._decodeLZW=(s=0,h=0,l=0,f=0,u=function(){var t=r>>>3,e=(i[t]<<16|i[t+1]<<8|i[t+2])>>>24-(7&r)-h&(1<>>----------------");for(var f=0;f4&&(e.writeUint(i,n,h),g=h),1==c||7==c)for(var b=0;b4&&(h+=m+=1&m),n+=4}}return[n,h]},t.toRGBA8=function(t,e){var r=t.width,i=t.height,a=r*i,o=4*a,s=t.data,h=new Uint8Array(4*a),l=t.t262?t.t262[0]:2,f=t.t258?Math.min(32,t.t258[0]):1;if(null==t.t262&&1==f&&(l=0),0==l)for(var u=Math.ceil(f*r/8),c=0;c>3)]>>7-(7&m)&1;h[g]=h[g+1]=h[g+2]=255*(1-b),h[g+3]=255}if(4==f)for(m=0;m>1)]>>4-4*(1&m)&15,h[g]=h[g+1]=h[g+2]=17*(15-b),h[g+3]=255;if(8==f)for(m=0;m>3)]>>7-(7&m)&1,h[g]=h[g+1]=h[g+2]=255*b,h[g+3]=255;if(2==f)for(m=0;m>2)]>>6-2*(3&m)&3,h[g]=h[g+1]=h[g+2]=85*b,h[g+3]=255;if(8==f)for(m=0;m>>3)]>>>7-(7&S)&1;else if(2==f)M=s[A+(S>>>2)]>>>6-2*(3&S)&3;else if(4==f)M=s[A+(S>>>1)]>>>4-4*(1&S)&15;else{if(8!=f)throw f;M=s[A+S*_]}h[g]=E[M]>>8,h[g+1]=E[k+M]>>8,h[g+2]=E[k+k+M]>>8,h[g+3]=255}}else if(5==l){var I=(_=t.t258?t.t258.length:4)>4?1:0;for(m=0;m>>1))+(1&z)];var D=s[B+2]-128,N=s[B+3]-128,F=P+((N>>2)+(N>>3)+(N>>5)),j=P-((D>>2)+(D>>4)+(D>>5))-((N>>1)+(N>>3)+(N>>4)+(N>>5)),G=P+(D+(D>>1)+(D>>2)+(D>>6));h[g]=Math.max(0,Math.min(255,F)),h[g+1]=Math.max(0,Math.min(255,j)),h[g+2]=Math.max(0,Math.min(255,G)),h[g+3]=255}}}else if(32845==l){function H(t){return t<.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055}for(c=0;cn&&(n=h,a=s)}}t.decodeImage(e,a,r);var l=t.toRGBA8(a),f=a.width,u=a.height,c=document.createElement("canvas");c.width=f,c.height=u;var d=c.getContext("2d"),p=new ImageData(new Uint8ClampedArray(l.buffer),f,u);return d.putImageData(p,0,0),c.toDataURL()},t._binBE={nextZero:function(t,e){for(;0!=t[e];)e++;return e},readUshort:function(t,e){return t[e]<<8|t[e+1]},readShort:function(e,r){var i=t._binBE.ui8;return i[0]=e[r+1],i[1]=e[r+0],t._binBE.i16[0]},readInt:function(e,r){var i=t._binBE.ui8;return i[0]=e[r+3],i[1]=e[r+2],i[2]=e[r+1],i[3]=e[r+0],t._binBE.i32[0]},readUint:function(e,r){var i=t._binBE.ui8;return i[0]=e[r+3],i[1]=e[r+2],i[2]=e[r+1],i[3]=e[r+0],t._binBE.ui32[0]},readASCII:function(t,e,r){for(var i="",n=0;n>8&255,t[e+1]=255&r},writeInt:function(e,r,i){var n=t._binBE.ui8;t._binBE.i32[0]=i,e[r+3]=n[0],e[r+2]=n[1],e[r+1]=n[2],e[r+0]=n[3]},writeUint:function(t,e,r){t[e]=r>>24&255,t[e+1]=r>>16&255,t[e+2]=r>>8&255,t[e+3]=r>>0&255},writeASCII:function(t,e,r){for(var i=0;i>8&255},writeInt:function(e,r,i){var n=t._binBE.ui8;t._binBE.i32[0]=i,e[r+0]=n[0],e[r+1]=n[1],e[r+2]=n[2],e[r+3]=n[3]},writeUint:function(t,e,r){t[e]=r>>>0&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24&255},writeASCII:t._binBE.writeASCII},t._copyTile=function(t,e,r,i,n,a,o,s){for(var h=Math.min(e,n-o),l=Math.min(r,a-s),f=0;f>--l&1)];h[o]=u}}function a(t,e,r,i){if(255!=t[e+3])return 0;if(0==r)return e;for(var n=0;n<2;n++){0==t[e+n]&&(t[e+n]=t.length,t.push(0,0,i,255));var o=a(t,t[e+n],r-1,i+1);if(0!=o)return o}return 0}function o(t){for(var e=t.b,r=t.a;e<25&&t.e>>8),r=r<<8|i,e+=8}if(e<0)throw"e";t.b=e,t.a=r}function s(t,e){return e.b>(e.b-=t)&65535>>16-t}function h(t,e){var r=t[0],i=0,n=255;e.b<16&&o(e);var a=e.a>>e.b-8&255;for(n=r[(i=t[1][a])+3],e.b-=r[i+2];255==n;)n=r[(i=r[i+(e.a>>--e.b&1)])+3];return n}function l(t,e){return t<32768>>16-e&&(t+=1-(1<>>1);else if(6==e)g=t[p]+(m-t[p-o]>>>1);else{if(7!=e)throw e;g=m+t[p]>>>1}t[d]+=g}}}return function(a){if(t=a,e=0,65496!=i())throw"e";for(var o=[],s=0,l=0,f=[],p=[],m=[],g=0,b=0,_=0;;){var y=i();if(65535!=y){var w=i();if(65475==y){l=r(),b=i(),_=i(),g=r();for(var v=0;v>4,15&E]}}else if(65476==y)for(var k=e+w-2;e>>4],f[S[0]]=S.slice(1)}s=r(),e+=2;break}e+=w-2}}else e--}var M=new(l>8?Uint16Array:Uint8Array)(b*_*g),A={b:0,a:0,c:8==s,e,data:t,d:t.length};if(A.c)!function(r,i,n,a,o){for(var s=t.length-e,l=0;lB&&(B=N),(D=R[1])>T&&(T=D),I.push(N*D)}if(1!=B||1!=T){var P=[],O=0;for(v=0;v>>6),i=0;i<3;i++)for(var n=0;n<41;n++)e[i][n]=[r,1];return e}function _(t,e){var r=0,i=8-t.a;if(t.j,t.a,e){if(e>=i)do{r<<=i,e-=i,r|=t[t.j]&(1<=8);e&&(r<<=e,i-=e,r|=t[t.j]>>>i&(1<c&&u>>2,s)return void(b[p]=d);h=e.t*e.c[t.g+x-w]+e.c[t.g+v-x]}else d=x>v&&x>E||x>>2:k+S>>>1,h=e.t*e.c[t.g+x-v]+e.c[t.g+v-k];l=M(h);var A=function(t){for(var e=-1,r=0;!r;e++)r=t[t.j]>>>7-t.a&1,t.a++,t.a&=7,t.a||t.j++;return e}(r);if(A>>1):g>>>1,o[l][0]+=M(g),o[l][1]==t.f&&(o[l][0]>>>=1,o[l][1]>>>=1),o[l][1]++,d=h<0?d-g:d+g,t.i&&(d<0?d+=e.w:d>t.g&&(d-=e.w)),b[p]=d>=0?Math.min(d,t.g):0}function w(t,e,r){for(var i=t[0].length,n=e;n<=r;n++)t[n][0]=t[n-1][1],t[n][i-1]=t[n-1][i-2]}function v(t){w(t,o,u),w(t,e,i),w(t,p,g)}function x(t,e,r,n,a,o,s,h,l,f,u,d,p){for(var m=0,g=1,b=ai;g8&&(y(t,e,r,n,a,g,h[l]),y(t,e,r,n,o,g,h[l]),g+=2);v(n)}function E(t,n,a,c,d,b){x(t,n,a,c,e,o,d,b,0,0,1,0,8),x(t,n,a,c,s,p,d,b,1,0,1,0,8),x(t,n,a,c,r,h,d,b,2,1,0,3,0),x(t,n,a,c,l,m,d,b,0,0,0,3,2),x(t,n,a,c,i,f,d,b,1,0,0,3,2),x(t,n,a,c,u,g,d,b,2,1,0,3,0)}function k(t,r,i,n,a,s){var h=s.length,l=t.l;a+1==t.s&&(l=t.e-a*t.l);for(var f=6*t.e*n+a*t.l,u=0;u<6;u++){for(var c=0;c>>1):2==m?p+(u>>>1):o+u;var g=t.h?(2*c/3&2147483646|c%3&1)+(c%3>>>1):c>>>1;r[f+c]=i[d][g+1]}f+=t.e}}t._decompressRAF=function(o,s){var h=function(e){var r=t._binBE.readUshort,i={b:r(e,0),i:e[2],C:e[3],u:e[4],q:r(e,5),k:r(e,7),e:r(e,9),l:r(e,11),s:e[13],d:r(e,14)};if(18771!=i.b||i.i>1||i.q<6||i.q%6||i.e<768||i.e%24||768!=i.l||i.k=i.l||i.s>16||i.s!=i.k/i.l||i.s!=Math.ceil(i.e/i.l)||i.d!=i.q/6||12!=i.u&&14!=i.u&&16!=i.u||16!=i.C&&0!=i.C)throw"Invalid data";if(0==i.i)throw"Not implemented. We need this file!";return i.h=16==i.C,i.m=0|(i.h?2*i.l/3:i.l>>>1),i.A=i.m+2,i.f=64,i.g=(1<{"use strict";r.r(e),r.d(e,{DOMException:()=>v,Headers:()=>f,Request:()=>b,Response:()=>y,fetch:()=>x});var i="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==i&&i,n={searchParams:"URLSearchParams"in i,iterable:"Symbol"in i&&"iterator"in Symbol,blob:"FileReader"in i&&"Blob"in i&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in i,arrayBuffer:"ArrayBuffer"in i};if(n.arrayBuffer)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],o=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function s(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function h(t){return"string"!=typeof t&&(t=String(t)),t}function l(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n.iterable&&(e[Symbol.iterator]=function(){return e}),e}function f(t){this.map={},t instanceof f?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function u(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function c(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function d(t){var e=new FileReader,r=c(e);return e.readAsArrayBuffer(t),r}function p(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:n.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:n.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:n.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():n.arrayBuffer&&n.blob&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=p(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):n.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||o(t))?this._bodyArrayBuffer=p(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n.blob&&(this.blob=function(){var t=u(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?u(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer)):this.blob().then(d)}),this.text=function(){var t,e,r,i=u(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,r=c(e=new FileReader),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),i=0;i-1?i:r),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(n),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var a=/([?&])_=[^&]*/;a.test(this.url)?this.url=this.url.replace(a,"$1_="+(new Date).getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}function _(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(n))}})),e}function y(t,e){if(!(this instanceof y))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===e.statusText?"":""+e.statusText,this.headers=new f(e.headers),this.url=e.url||"",this._initBody(t)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},m.call(b.prototype),m.call(y.prototype),y.prototype.clone=function(){return new y(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},y.error=function(){var t=new y(null,{status:0,statusText:""});return t.type="error",t};var w=[301,302,303,307,308];y.redirect=function(t,e){if(-1===w.indexOf(e))throw new RangeError("Invalid status code");return new y(null,{status:e,headers:{location:t}})};var v=i.DOMException;try{new v}catch(t){(v=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack}).prototype=Object.create(Error.prototype),v.prototype.constructor=v}function x(t,e){return new Promise((function(r,a){var o=new b(t,e);if(o.signal&&o.signal.aborted)return a(new v("Aborted","AbortError"));var s=new XMLHttpRequest;function l(){s.abort()}s.onload=function(){var t,e,i={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new f,t.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t})).forEach((function(t){var r=t.split(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();e.append(i,n)}})),e)};i.url="responseURL"in s?s.responseURL:i.headers.get("X-Request-URL");var n="response"in s?s.response:s.responseText;setTimeout((function(){r(new y(n,i))}),0)},s.onerror=function(){setTimeout((function(){a(new TypeError("Network request failed"))}),0)},s.ontimeout=function(){setTimeout((function(){a(new TypeError("Network request failed"))}),0)},s.onabort=function(){setTimeout((function(){a(new v("Aborted","AbortError"))}),0)},s.open(o.method,function(t){try{return""===t&&i.location.href?i.location.href:t}catch(e){return t}}(o.url),!0),"include"===o.credentials?s.withCredentials=!0:"omit"===o.credentials&&(s.withCredentials=!1),"responseType"in s&&(n.blob?s.responseType="blob":n.arrayBuffer&&o.headers.get("Content-Type")&&-1!==o.headers.get("Content-Type").indexOf("application/octet-stream")&&(s.responseType="arraybuffer")),!e||"object"!=typeof e.headers||e.headers instanceof f?o.headers.forEach((function(t,e){s.setRequestHeader(e,t)})):Object.getOwnPropertyNames(e.headers).forEach((function(t){s.setRequestHeader(t,h(e.headers[t]))})),o.signal&&(o.signal.addEventListener("abort",l),s.onreadystatechange=function(){4===s.readyState&&o.signal.removeEventListener("abort",l)}),s.send(void 0===o._bodyInit?null:o._bodyInit)}))}x.polyfill=!0,i.fetch||(i.fetch=x,i.Headers=f,i.Request=b,i.Response=y)},6290:(t,e,r)=>{"use strict";var i=r(5048),n=r(9748),a=r(4655),o=r(1960);function s(t,e,r){var i=t;return n(e)?(r=e,"string"==typeof t&&(i={uri:t})):i=o(e,{uri:t}),i.callback=r,i}function h(t,e,r){return l(e=s(t,e,r))}function l(t){if(void 0===t.callback)throw new Error("callback argument missing");var e=!1,r=function(r,i,n){e||(e=!0,t.callback(r,i,n))};function i(){var t=void 0;if(t=f.response?f.response:f.responseText||function(t){try{if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;if(""===t.responseType&&!e)return t.responseXML}catch(t){}return null}(f),b)try{t=JSON.parse(t)}catch(t){}return t}function n(t){return clearTimeout(u),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,r(t,_)}function o(){if(!l){var e;clearTimeout(u),e=t.useXDR&&void 0===f.status?200:1223===f.status?204:f.status;var n=_,o=null;return 0!==e?(n={body:i(),statusCode:e,method:d,headers:{},url:c,rawRequest:f},f.getAllResponseHeaders&&(n.headers=a(f.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),r(o,n,n.body)}}var s,l,f=t.xhr||null;f||(f=t.cors||t.useXDR?new h.XDomainRequest:new h.XMLHttpRequest);var u,c=f.url=t.uri||t.url,d=f.method=t.method||"GET",p=t.body||t.data,m=f.headers=t.headers||{},g=!!t.sync,b=!1,_={body:void 0,headers:{},statusCode:0,method:d,url:c,rawRequest:f};if("json"in t&&!1!==t.json&&(b=!0,m.accept||m.Accept||(m.Accept="application/json"),"GET"!==d&&"HEAD"!==d&&(m["content-type"]||m["Content-Type"]||(m["Content-Type"]="application/json"),p=JSON.stringify(!0===t.json?p:t.json))),f.onreadystatechange=function(){4===f.readyState&&setTimeout(o,0)},f.onload=o,f.onerror=n,f.onprogress=function(){},f.onabort=function(){l=!0},f.ontimeout=n,f.open(d,c,!g,t.username,t.password),g||(f.withCredentials=!!t.withCredentials),!g&&t.timeout>0&&(u=setTimeout((function(){if(!l){l=!0,f.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",n(t)}}),t.timeout)),f.setRequestHeader)for(s in m)m.hasOwnProperty(s)&&f.setRequestHeader(s,m[s]);else if(t.headers&&!function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(f.responseType=t.responseType),"beforeSend"in t&&"function"==typeof t.beforeSend&&t.beforeSend(f),f.send(p||null),f}t.exports=h,t.exports.default=h,h.XMLHttpRequest=i.XMLHttpRequest||function(){},h.XDomainRequest="withCredentials"in new h.XMLHttpRequest?h.XMLHttpRequest:i.XDomainRequest,function(t,e){for(var r=0;r{t.exports=void 0!==self.DOMParser?function(t){return(new self.DOMParser).parseFromString(t,"application/xml")}:void 0!==self.ActiveXObject&&new self.ActiveXObject("Microsoft.XMLDOM")?function(t){var e=new self.ActiveXObject("Microsoft.XMLDOM");return e.async="false",e.loadXML(t),e}:function(t){var e=document.createElement("div");return e.innerHTML=t,e}},1960:t=>{t.exports=function(){for(var t={},r=0;r{},6777:()=>{},5546:()=>{},2460:(t,e,r)=>{var i=r(4406),n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,h=(t,e)=>{for(var r in e)n(t,r,{get:e[r],enumerable:!0})},l=(t=>(e,r)=>t&&t.get(e)||(r=((t,e,r,i)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let r of o(e))s.call(t,r)||n(t,r,{get:()=>e[r],enumerable:!(i=a(e,r))||i.enumerable});return t})(n({},"__esModule",{value:!0}),e),t&&t.set(e,r),r))("undefined"!=typeof WeakMap?new WeakMap:0),f=(t,e,r)=>(((t,e,r)=>{e in t?n(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r})(t,"symbol"!=typeof e?e+"":e,r),r),u={};h(u,{applyPalette:()=>te,applyPaletteSync:()=>$t,buildPalette:()=>Kt,buildPaletteSync:()=>Qt,constants:()=>c,conversion:()=>b,distance:()=>H,image:()=>Ct,palette:()=>ot,quality:()=>Wt,utils:()=>ct});var c={};h(c,{bt709:()=>d});var d={};h(d,{Y:()=>p,x:()=>m,y:()=>g});var p=(t=>(t[t.RED=.2126]="RED",t[t.GREEN=.7152]="GREEN",t[t.BLUE=.0722]="BLUE",t[t.WHITE=1]="WHITE",t))(p||{}),m=(t=>(t[t.RED=.64]="RED",t[t.GREEN=.3]="GREEN",t[t.BLUE=.15]="BLUE",t[t.WHITE=.3127]="WHITE",t))(m||{}),g=(t=>(t[t.RED=.33]="RED",t[t.GREEN=.6]="GREEN",t[t.BLUE=.06]="BLUE",t[t.WHITE=.329]="WHITE",t))(g||{}),b={};function _(t){return t>.04045?((t+.055)/1.055)**2.4:t/12.92}function y(t,e,r){return{x:.4124*(t=_(t/255))+.3576*(e=_(e/255))+.1805*(r=_(r/255)),y:.2126*t+.7152*e+.0722*r,z:.0193*t+.1192*e+.9505*r}}h(b,{lab2rgb:()=>G,lab2xyz:()=>N,rgb2hsl:()=>I,rgb2lab:()=>L,rgb2xyz:()=>y,xyz2lab:()=>O,xyz2rgb:()=>j});var w={};function v(t){return t*(Math.PI/180)}function x(t,e,r){let i=t;return ie&&(i=e),i>r&&(i=r),i}function k(t,e,r){return t>r&&(t=r),t255?t=255:t<0&&(t=0),t}function M(t){return t>255?t=255:t<0&&(t=0),t}function A(t,e){const r=typeof t[0];let i;if("number"===r||"string"===r){const r=Object.create(null);for(let e=0,i=t.length;ee(t,i)||r[t]-r[i]))}else{const r=t.slice(0);i=t.sort(((t,i)=>e(t,i)||r.indexOf(t)-r.indexOf(i)))}return i}function I(t,e,r){const i=E(t,e,r),n=x(t,e,r),a=n-i,o=(i+n)/510;let s=0;o>0&&o<1&&(s=a/(o<.5?n+i:510-n-i));let h=0;return a>0&&(h=n===t?(e-r)/a:n===e?2+(r-t)/a:4+(t-e)/a,h*=60,h<0&&(h+=360)),{h,s,l:o}}h(w,{degrees2radians:()=>v,inRange0to255:()=>M,inRange0to255Rounded:()=>S,intInRange:()=>k,max3:()=>x,min3:()=>E,stableSort:()=>A});var B=.95047,T=1,R=1.08883;function P(t){return t>.008856?t**(1/3):7.787*t+16/116}function O(t,e,r){if(t=P(t/B),e=P(e/T),r=P(r/R),116*e-16<0)throw new Error("xxx");return{L:Math.max(0,116*e-16),a:500*(t-e),b:200*(e-r)}}function L(t,e,r){const i=y(t,e,r);return O(i.x,i.y,i.z)}var C=.95047,U=1,z=1.08883;function D(t){return t>.206893034?t**3:(t-16/116)/7.787}function N(t,e,r){const i=(t+16)/116,n=i-r/200;return{x:C*D(e/500+i),y:U*D(i),z:z*D(n)}}function F(t){return t>.0031308?1.055*t**(1/2.4)-.055:12.92*t}function j(t,e,r){const i=F(3.2406*t+-1.5372*e+-.4986*r),n=F(-.9689*t+1.8758*e+.0415*r),a=F(.0557*t+-.204*e+1.057*r);return{r:S(255*i),g:S(255*n),b:S(255*a)}}function G(t,e,r){const i=N(t,e,r);return j(i.x,i.y,i.z)}var H={};h(H,{AbstractDistanceCalculator:()=>W,AbstractEuclidean:()=>Q,AbstractManhattan:()=>et,CIE94GraphicArts:()=>Y,CIE94Textiles:()=>Z,CIEDE2000:()=>X,CMetric:()=>J,Euclidean:()=>K,EuclideanBT709:()=>$,EuclideanBT709NoAlpha:()=>tt,Manhattan:()=>rt,ManhattanBT709:()=>nt,ManhattanNommyde:()=>it,PNGQuant:()=>at});var W=class{constructor(){f(this,"_maxDistance"),f(this,"_whitePoint"),this._setDefaults(),this.setWhitePoint(255,255,255,255)}setWhitePoint(t,e,r,i){this._whitePoint={r:t>0?255/t:0,g:e>0?255/e:0,b:r>0?255/r:0,a:i>0?255/i:0},this._maxDistance=this.calculateRaw(t,e,r,i,0,0,0,0)}calculateNormalized(t,e){return this.calculateRaw(t.r,t.g,t.b,t.a,e.r,e.g,e.b,e.a)/this._maxDistance}},q=class extends W{calculateRaw(t,e,r,i,n,a,o,s){const h=L(M(t*this._whitePoint.r),M(e*this._whitePoint.g),M(r*this._whitePoint.b)),l=L(M(n*this._whitePoint.r),M(a*this._whitePoint.g),M(o*this._whitePoint.b)),f=h.L-l.L,u=h.a-l.a,c=h.b-l.b,d=Math.sqrt(h.a*h.a+h.b*h.b),p=d-Math.sqrt(l.a*l.a+l.b*l.b);let m=u*u+c*c-p*p;m=m<0?0:Math.sqrt(m);const g=(s-i)*this._whitePoint.a*this._kA;return Math.sqrt((f/this._Kl)**2+(p/(1+this._K1*d))**2+(m/(1+this._K2*d))**2+g**2)}},Z=class extends q{_setDefaults(){this._Kl=2,this._K1=.048,this._K2=.014,this._kA=12.5/255}},Y=class extends q{_setDefaults(){this._Kl=1,this._K1=.045,this._K2=.015,this._kA=25/255}},V=class extends W{_setDefaults(){}static _calculatehp(t,e){const r=Math.atan2(t,e);return r>=0?r:r+V._deg360InRad}static _calculateRT(t,e){const r=e**7,i=2*Math.sqrt(r/(r+V._pow25to7)),n=V._deg30InRad*Math.exp(-(((t-V._deg275InRad)/V._deg25InRad)**2));return-Math.sin(2*n)*i}static _calculateT(t){return 1-.17*Math.cos(t-V._deg30InRad)+.24*Math.cos(2*t)+.32*Math.cos(3*t+V._deg6InRad)-.2*Math.cos(4*t-V._deg63InRad)}static _calculate_ahp(t,e,r,i){const n=r+i;return 0===t?n:e<=V._deg180InRad?n/2:n>8)+4*f*f+((767-h)*u*u>>8),d=(s-i)*this._whitePoint.a;return Math.sqrt(c+d*d)}_setDefaults(){}},Q=class extends W{calculateRaw(t,e,r,i,n,a,o,s){const h=n-t,l=a-e,f=o-r,u=s-i;return Math.sqrt(this._kR*h*h+this._kG*l*l+this._kB*f*f+this._kA*u*u)}},K=class extends Q{_setDefaults(){this._kR=1,this._kG=1,this._kB=1,this._kA=1}},$=class extends Q{_setDefaults(){this._kR=.2126,this._kG=.7152,this._kB=.0722,this._kA=1}},tt=class extends Q{_setDefaults(){this._kR=.2126,this._kG=.7152,this._kB=.0722,this._kA=0}},et=class extends W{calculateRaw(t,e,r,i,n,a,o,s){let h=n-t,l=a-e,f=o-r,u=s-i;return h<0&&(h=0-h),l<0&&(l=0-l),f<0&&(f=0-f),u<0&&(u=0-u),this._kR*h+this._kG*l+this._kB*f+this._kA*u}},rt=class extends et{_setDefaults(){this._kR=1,this._kG=1,this._kB=1,this._kA=1}},it=class extends et{_setDefaults(){this._kR=.4984,this._kG=.8625,this._kB=.2979,this._kA=1}},nt=class extends et{_setDefaults(){this._kR=.2126,this._kG=.7152,this._kB=.0722,this._kA=1}},at=class extends W{calculateRaw(t,e,r,i,n,a,o,s){const h=(s-i)*this._whitePoint.a;return this._colordifferenceCh(t*this._whitePoint.r,n*this._whitePoint.r,h)+this._colordifferenceCh(e*this._whitePoint.g,a*this._whitePoint.g,h)+this._colordifferenceCh(r*this._whitePoint.b,o*this._whitePoint.b,h)}_colordifferenceCh(t,e,r){const i=t-e,n=i+r;return i*i+n*n}_setDefaults(){}},ot={};h(ot,{AbstractPaletteQuantizer:()=>st,ColorHistogram:()=>kt,NeuQuant:()=>yt,NeuQuantFloat:()=>xt,RGBQuant:()=>Mt,WuColorCube:()=>Pt,WuQuant:()=>Lt});var st=class{quantizeSync(){for(const t of this.quantize())if(t.palette)return t.palette;throw new Error("unreachable")}},ht=class{constructor(){f(this,"r"),f(this,"g"),f(this,"b"),f(this,"a"),f(this,"uint32"),f(this,"rgba"),this.uint32=-1>>>0,this.r=this.g=this.b=this.a=0,this.rgba=new Array(4),this.rgba[0]=0,this.rgba[1]=0,this.rgba[2]=0,this.rgba[3]=0}static createByQuadruplet(t){const e=new ht;return e.r=0|t[0],e.g=0|t[1],e.b=0|t[2],e.a=0|t[3],e._loadUINT32(),e._loadQuadruplet(),e}static createByRGBA(t,e,r,i){const n=new ht;return n.r=0|t,n.g=0|e,n.b=0|r,n.a=0|i,n._loadUINT32(),n._loadQuadruplet(),n}static createByUint32(t){const e=new ht;return e.uint32=t>>>0,e._loadRGBA(),e._loadQuadruplet(),e}from(t){this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this.uint32=t.uint32,this.rgba[0]=t.r,this.rgba[1]=t.g,this.rgba[2]=t.b,this.rgba[3]=t.a}getLuminosity(t){let e=this.r,r=this.g,i=this.b;return t&&(e=Math.min(255,255-this.a+this.a*e/255),r=Math.min(255,255-this.a+this.a*r/255),i=Math.min(255,255-this.a+this.a*i/255)),.2126*e+.7152*r+.0722*i}_loadUINT32(){this.uint32=(this.a<<24|this.b<<16|this.g<<8|this.r)>>>0}_loadRGBA(){this.r=255&this.uint32,this.g=this.uint32>>>8&255,this.b=this.uint32>>>16&255,this.a=this.uint32>>>24&255}_loadQuadruplet(){this.rgba[0]=this.r,this.rgba[1]=this.g,this.rgba[2]=this.b,this.rgba[3]=this.a}},lt=class{constructor(){f(this,"_pointArray"),f(this,"_width"),f(this,"_height"),this._width=0,this._height=0,this._pointArray=[]}getWidth(){return this._width}getHeight(){return this._height}setWidth(t){this._width=t}setHeight(t){this._height=t}getPointArray(){return this._pointArray}clone(){const t=new lt;t._width=this._width,t._height=this._height;for(let e=0,r=this._pointArray.length;e=n&&t=0;e--)if(t.uint32===this._pointArray[e].uint32)return!0;return!1}getNearestColor(t,e){return this._pointArray[0|this._getNearestIndex(t,e)]}getPointContainer(){return this._pointContainer}_nearestPointFromCache(t){return"number"==typeof this._i32idx[t]?this._i32idx[t]:-1}_getNearestIndex(t,e){let r=this._nearestPointFromCache(""+e.uint32);if(r>=0)return r;let i=Number.MAX_VALUE;r=0;for(let n=0,a=this._pointArray.length;n{const r=I(t.r,t.g,t.b),i=I(e.r,e.g,e.b),n=t.r===t.g&&t.g===t.b?0:1+ft(r.h,10),a=(e.r===e.g&&e.g===e.b?0:1+ft(i.h,10))-n;if(a)return-a;const o=t.getLuminosity(!0),s=e.getLuminosity(!0);if(s-o!=0)return s-o;const h=(100*i.s|0)-(100*r.s|0);return h?-h:0}))}},ct={};h(ct,{HueStatistics:()=>pt,Palette:()=>ut,Point:()=>ht,PointContainer:()=>lt,ProgressTracker:()=>gt,arithmetic:()=>w});var dt=class{constructor(){f(this,"num",0),f(this,"cols",[])}},pt=class{constructor(t,e){f(this,"_numGroups"),f(this,"_minCols"),f(this,"_stats"),f(this,"_groupsFull"),this._numGroups=t,this._minCols=e,this._stats=[];for(let e=0;e<=t;e++)this._stats[e]=new dt;this._groupsFull=0}check(t){this._groupsFull===this._numGroups+1&&(this.check=()=>{});const e=255&t,r=t>>>8&255,i=t>>>16&255,n=e===r&&r===i?0:1+ft(I(e,r,i).h,this._numGroups),a=this._stats[n],o=this._minCols;a.num++,a.num>o||(a.num===o&&this._groupsFull++,a.num<=o&&this._stats[n].cols.push(t))}injectIntoDictionary(t){for(let e=0;e<=this._numGroups;e++)this._stats[e].num<=this._minCols&&this._stats[e].cols.forEach((e=>{t[e]?t[e]++:t[e]=1}))}injectIntoArray(t){for(let e=0;e<=this._numGroups;e++)this._stats[e].num<=this._minCols&&this._stats[e].cols.forEach((e=>{-1===t.indexOf(e)&&t.push(e)}))}},mt=class{constructor(t,e){f(this,"progress"),f(this,"_step"),f(this,"_range"),f(this,"_last"),f(this,"_progressRange"),this._range=t,this._progressRange=e,this._step=Math.max(1,this._range/(mt.steps+1)|0),this._last=-this._step,this.progress=0}shouldNotify(t){return t-this._last>=this._step&&(this._last=t,this.progress=Math.min(this._progressRange*this._last/this._range,this._progressRange),!0)}},gt=mt;f(gt,"steps",100);var bt=class{constructor(t){f(this,"r"),f(this,"g"),f(this,"b"),f(this,"a"),this.r=this.g=this.b=this.a=t}toPoint(){return ht.createByRGBA(this.r>>3,this.g>>3,this.b>>3,this.a>>3)}subtract(t,e,r,i){this.r-=0|t,this.g-=0|e,this.b-=0|r,this.a-=0|i}},_t=class extends st{constructor(t,e=256){super(),f(this,"_pointArray"),f(this,"_networkSize"),f(this,"_network"),f(this,"_sampleFactor"),f(this,"_radPower"),f(this,"_freq"),f(this,"_bias"),f(this,"_distance"),this._distance=t,this._pointArray=[],this._sampleFactor=1,this._networkSize=e,this._distance.setWhitePoint(2040,2040,2040,2040)}sample(t){this._pointArray=this._pointArray.concat(t.getPointArray())}*quantize(){this._init(),yield*this._learn(),yield{palette:this._buildPalette(),progress:100}}_init(){this._freq=[],this._bias=[],this._radPower=[],this._network=[];for(let t=0;t>3)*_t._radiusBias,h=s>>_t._radiusBiasShift;h<=1&&(h=0);for(let t=0;t>>0;n=e<_t._minpicturebytes?1:e%_t._prime1!=0?_t._prime1:e%_t._prime2!=0?_t._prime2:e%_t._prime3!=0?_t._prime3:_t._prime4;const l=new gt(i,99);for(let t=0,f=0;t=e&&(f-=e),t++,0===a&&(a=1),t%a==0){o-=o/r|0,s-=s/_t._radiusDecrease|0,h=s>>_t._radiusBiasShift,h<=1&&(h=0);for(let t=0;t>>0}}}_buildPalette(){const t=new ut;return this._network.forEach((e=>{t.add(e.toPoint())})),t.sort(),t}_alterNeighbour(t,e,r,i,n,a){let o=e-t;o<-1&&(o=-1);let s=e+t;s>this._networkSize&&(s=this._networkSize);let h=e+1,l=e-1,f=1;for(;ho;){const t=this._radPower[f++]/_t._alphaRadBias;if(ho){const e=this._network[l--];e.subtract(t*(e.r-n),t*(e.g-i),t*(e.b-r),t*(e.a-a))}}}_alterSingle(t,e,r,i,n,a){t/=_t._initAlpha;const o=this._network[e];o.subtract(t*(o.r-n),t*(o.g-i),t*(o.b-r),t*(o.a-a))}_contest(t,e,r,i){let n=~(1<<31),a=n,o=-1,s=o;for(let h=0;h>_t._initialBiasShift-3);u>_t._betaShift;this._freq[h]-=c,this._bias[h]+=c<<_t._gammaShift}return this._freq[o]+=_t._beta,this._bias[o]-=_t._betaGamma,s}},yt=_t;f(yt,"_prime1",499),f(yt,"_prime2",491),f(yt,"_prime3",487),f(yt,"_prime4",503),f(yt,"_minpicturebytes",_t._prime4),f(yt,"_nCycles",100),f(yt,"_initialBiasShift",16),f(yt,"_initialBias",1<<_t._initialBiasShift),f(yt,"_gammaShift",10),f(yt,"_betaShift",10),f(yt,"_beta",_t._initialBias>>_t._betaShift),f(yt,"_betaGamma",_t._initialBias<<_t._gammaShift-_t._betaShift),f(yt,"_radiusBiasShift",6),f(yt,"_radiusBias",1<<_t._radiusBiasShift),f(yt,"_radiusDecrease",30),f(yt,"_alphaBiasShift",10),f(yt,"_initAlpha",1<<_t._alphaBiasShift),f(yt,"_radBiasShift",8),f(yt,"_radBias",1<<_t._radBiasShift),f(yt,"_alphaRadBiasShift",_t._alphaBiasShift+_t._radBiasShift),f(yt,"_alphaRadBias",1<<_t._alphaRadBiasShift);var wt=class{constructor(t){f(this,"r"),f(this,"g"),f(this,"b"),f(this,"a"),this.r=this.g=this.b=this.a=t}toPoint(){return ht.createByRGBA(this.r>>3,this.g>>3,this.b>>3,this.a>>3)}subtract(t,e,r,i){this.r-=t,this.g-=e,this.b-=r,this.a-=i}},vt=class extends st{constructor(t,e=256){super(),f(this,"_pointArray"),f(this,"_networkSize"),f(this,"_network"),f(this,"_sampleFactor"),f(this,"_radPower"),f(this,"_freq"),f(this,"_bias"),f(this,"_distance"),this._distance=t,this._pointArray=[],this._sampleFactor=1,this._networkSize=e,this._distance.setWhitePoint(2040,2040,2040,2040)}sample(t){this._pointArray=this._pointArray.concat(t.getPointArray())}*quantize(){this._init(),yield*this._learn(),yield{palette:this._buildPalette(),progress:100}}_init(){this._freq=[],this._bias=[],this._radPower=[],this._network=[];for(let t=0;t>3)*vt._radiusBias,h=s>>vt._radiusBiasShift;h<=1&&(h=0);for(let t=0;t=e&&(f-=e),t++,0===a&&(a=1),t%a==0){o-=o/r,s-=s/vt._radiusDecrease,h=s>>vt._radiusBiasShift,h<=1&&(h=0);for(let t=0;t{t.add(e.toPoint())})),t.sort(),t}_alterNeighbour(t,e,r,i,n,a){let o=e-t;o<-1&&(o=-1);let s=e+t;s>this._networkSize&&(s=this._networkSize);let h=e+1,l=e-1,f=1;for(;ho;){const t=this._radPower[f++]/vt._alphaRadBias;if(ho){const e=this._network[l--];e.subtract(t*(e.r-n),t*(e.g-i),t*(e.b-r),t*(e.a-a))}}}_alterSingle(t,e,r,i,n,a){t/=vt._initAlpha;const o=this._network[e];o.subtract(t*(o.r-n),t*(o.g-i),t*(o.b-r),t*(o.a-a))}_contest(t,e,r,i){let n=~(1<<31),a=n,o=-1,s=o;for(let h=0;h>vt._initialBiasShift-3);u>vt._betaShift;this._freq[h]-=c,this._bias[h]+=c<>vt._betaShift),f(xt,"_betaGamma",vt._initialBias<this._histogram[e]-this._histogram[t]));if(0===t.length)return[];let e;switch(this._method){case 1:const r=Math.min(t.length,this._initColors),i=t[r-1],n=this._histogram[i];e=t.slice(0,r);let a=r;const o=t.length;for(;a+t))}_colorStats1D(t){const e=this._histogram,r=t.getPointArray(),i=r.length;for(let t=0;t{let r=Math.round(t.w*t.h/o)*Et._boxPixels;r<2&&(r=2);const n={};this._iterateBox(t,e,(t=>{const e=i[t].uint32;this._hueStats.check(e),e in h?h[e]++:e in n?++n[e]>=r&&(h[e]=n[e]):n[e]=1}))})),this._hueStats.injectIntoDictionary(h)}_iterateBox(t,e,r){const i=t,n=i.y*e+i.x,a=(i.y+i.h-1)*e+(i.x+i.w-1),o=e-i.w+1;let s=0,h=n;do{r.call(this,h),h+=++s%i.w==0?o:1}while(h<=a)}_makeBoxes(t,e,r,i){const n=t%r,a=e%i,o=t-n,s=e-a,h=[];for(let l=0;lthis._colors;){a.length=0;for(let t=0;t3*this._colors?this._initialDistance:this._distanceIncrement}if(oe.distance-t.distance));let t=0;for(;o=0;t--)0===i[t]&&(t!==l-1&&(r[t]=r[l-1]),--l);r.length=l,e.sort(),yield{palette:e,progress:100}}};function At(t){const e=[];for(let r=0;r0){const r=this._sums[e],i=this._reds[e]/r,n=this._greens[e]/r,a=this._blues[e]/r,o=this._alphas[e]/r,s=ht.createByRGBA(0|i,0|n,0|a,0|o);t.add(s)}t.sort(),yield{palette:t,progress:100}}*_preparePalette(){yield*this._calculateMoments();let t=0;const e=At(this._colors);for(let r=1;r1?this._calculateVariance(this._cubes[t]):0,e[r]=this._cubes[r].volume>1?this._calculateVariance(this._cubes[r]):0):(e[t]=0,r--),t=0;let i=e[0];for(let n=1;n<=r;++n)e[n]>i&&(i=e[n],t=n);if(i<=0){this._colors=r+1;break}}const r=[],i=[],n=[],a=[];for(let t=0;t0?(r[t]=Ot._volume(this._cubes[t],this._momentsRed)/e|0,i[t]=Ot._volume(this._cubes[t],this._momentsGreen)/e|0,n[t]=Ot._volume(this._cubes[t],this._momentsBlue)/e|0,a[t]=Ot._volume(this._cubes[t],this._momentsAlpha)/e|0):(r[t]=0,i[t]=0,n[t]=0,a[t]=0)}this._reds=At(this._colors+1),this._greens=At(this._colors+1),this._blues=At(this._colors+1),this._alphas=At(this._colors+1),this._sums=At(this._colors+1);for(let t=0,e=this._pixels.length;t>e),i=1+(t.g>>e),n=1+(t.b>>e),a=1+(t.a>>e);this._weights[a][r][i][n]++,this._momentsRed[a][r][i][n]+=t.r,this._momentsGreen[a][r][i][n]+=t.g,this._momentsBlue[a][r][i][n]+=t.b,this._momentsAlpha[a][r][i][n]+=t.a,this._moments[a][r][i][n]+=this._table[t.r]+this._table[t.g]+this._table[t.b]+this._table[t.a]}*_calculateMoments(){const t=[],e=[],r=[],i=[],n=[],a=[],o=Bt(this._sideSize,this._sideSize,this._sideSize),s=Bt(this._sideSize,this._sideSize,this._sideSize),h=Bt(this._sideSize,this._sideSize,this._sideSize),l=Bt(this._sideSize,this._sideSize,this._sideSize),f=Bt(this._sideSize,this._sideSize,this._sideSize),u=Bt(this._sideSize,this._sideSize,this._sideSize);let c=0;const d=new gt(this._alphaMaxSideIndex*this._maxSideIndex,99);for(let p=1;p<=this._alphaMaxSideIndex;++p){Tt(o,this._sideSize,this._sideSize,this._sideSize,0),Tt(s,this._sideSize,this._sideSize,this._sideSize,0),Tt(h,this._sideSize,this._sideSize,this._sideSize,0),Tt(l,this._sideSize,this._sideSize,this._sideSize,0),Tt(f,this._sideSize,this._sideSize,this._sideSize,0),Tt(u,this._sideSize,this._sideSize,this._sideSize,0);for(let m=1;m<=this._maxSideIndex;++m,++c){d.shouldNotify(c)&&(yield{progress:d.progress}),Rt(t,this._sideSize,0),Rt(e,this._sideSize,0),Rt(r,this._sideSize,0),Rt(i,this._sideSize,0),Rt(n,this._sideSize,0),Rt(a,this._sideSize,0);for(let c=1;c<=this._maxSideIndex;++c){let d=0,g=0,b=0,_=0,y=0,w=0;for(let v=1;v<=this._maxSideIndex;++v)d+=this._weights[p][m][c][v],g+=this._momentsRed[p][m][c][v],b+=this._momentsGreen[p][m][c][v],_+=this._momentsBlue[p][m][c][v],y+=this._momentsAlpha[p][m][c][v],w+=this._moments[p][m][c][v],t[v]+=d,e[v]+=g,r[v]+=b,i[v]+=_,n[v]+=y,a[v]+=w,o[m][c][v]=o[m-1][c][v]+t[v],s[m][c][v]=s[m-1][c][v]+e[v],h[m][c][v]=h[m-1][c][v]+r[v],l[m][c][v]=l[m-1][c][v]+i[v],f[m][c][v]=f[m-1][c][v]+n[v],u[m][c][v]=u[m-1][c][v]+a[v],this._weights[p][m][c][v]=this._weights[p-1][m][c][v]+o[m][c][v],this._momentsRed[p][m][c][v]=this._momentsRed[p-1][m][c][v]+s[m][c][v],this._momentsGreen[p][m][c][v]=this._momentsGreen[p-1][m][c][v]+h[m][c][v],this._momentsBlue[p][m][c][v]=this._momentsBlue[p-1][m][c][v]+l[m][c][v],this._momentsAlpha[p][m][c][v]=this._momentsAlpha[p-1][m][c][v]+f[m][c][v],this._moments[p][m][c][v]=this._moments[p-1][m][c][v]+u[m][c][v]}}}}static _volumeFloat(t,e){return e[t.alphaMaximum][t.redMaximum][t.greenMaximum][t.blueMaximum]-e[t.alphaMaximum][t.redMaximum][t.greenMinimum][t.blueMaximum]-e[t.alphaMaximum][t.redMinimum][t.greenMaximum][t.blueMaximum]+e[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMaximum]-e[t.alphaMinimum][t.redMaximum][t.greenMaximum][t.blueMaximum]+e[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMaximum]+e[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMaximum]-e[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMaximum]-(e[t.alphaMaximum][t.redMaximum][t.greenMaximum][t.blueMinimum]-e[t.alphaMinimum][t.redMaximum][t.greenMaximum][t.blueMinimum]-e[t.alphaMaximum][t.redMaximum][t.greenMinimum][t.blueMinimum]+e[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMinimum]-e[t.alphaMaximum][t.redMinimum][t.greenMaximum][t.blueMinimum]+e[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMinimum]+e[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMinimum]-e[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMinimum])}static _volume(t,e){return 0|Ot._volumeFloat(t,e)}static _top(t,e,r,i){let n;switch(e){case Ot._alpha:n=i[r][t.redMaximum][t.greenMaximum][t.blueMaximum]-i[r][t.redMaximum][t.greenMinimum][t.blueMaximum]-i[r][t.redMinimum][t.greenMaximum][t.blueMaximum]+i[r][t.redMinimum][t.greenMinimum][t.blueMaximum]-(i[r][t.redMaximum][t.greenMaximum][t.blueMinimum]-i[r][t.redMaximum][t.greenMinimum][t.blueMinimum]-i[r][t.redMinimum][t.greenMaximum][t.blueMinimum]+i[r][t.redMinimum][t.greenMinimum][t.blueMinimum]);break;case Ot._red:n=i[t.alphaMaximum][r][t.greenMaximum][t.blueMaximum]-i[t.alphaMaximum][r][t.greenMinimum][t.blueMaximum]-i[t.alphaMinimum][r][t.greenMaximum][t.blueMaximum]+i[t.alphaMinimum][r][t.greenMinimum][t.blueMaximum]-(i[t.alphaMaximum][r][t.greenMaximum][t.blueMinimum]-i[t.alphaMaximum][r][t.greenMinimum][t.blueMinimum]-i[t.alphaMinimum][r][t.greenMaximum][t.blueMinimum]+i[t.alphaMinimum][r][t.greenMinimum][t.blueMinimum]);break;case Ot._green:n=i[t.alphaMaximum][t.redMaximum][r][t.blueMaximum]-i[t.alphaMaximum][t.redMinimum][r][t.blueMaximum]-i[t.alphaMinimum][t.redMaximum][r][t.blueMaximum]+i[t.alphaMinimum][t.redMinimum][r][t.blueMaximum]-(i[t.alphaMaximum][t.redMaximum][r][t.blueMinimum]-i[t.alphaMaximum][t.redMinimum][r][t.blueMinimum]-i[t.alphaMinimum][t.redMaximum][r][t.blueMinimum]+i[t.alphaMinimum][t.redMinimum][r][t.blueMinimum]);break;case Ot._blue:n=i[t.alphaMaximum][t.redMaximum][t.greenMaximum][r]-i[t.alphaMaximum][t.redMaximum][t.greenMinimum][r]-i[t.alphaMaximum][t.redMinimum][t.greenMaximum][r]+i[t.alphaMaximum][t.redMinimum][t.greenMinimum][r]-(i[t.alphaMinimum][t.redMaximum][t.greenMaximum][r]-i[t.alphaMinimum][t.redMaximum][t.greenMinimum][r]-i[t.alphaMinimum][t.redMinimum][t.greenMaximum][r]+i[t.alphaMinimum][t.redMinimum][t.greenMinimum][r]);break;default:throw new Error("impossible")}return 0|n}static _bottom(t,e,r){switch(e){case Ot._alpha:return-r[t.alphaMinimum][t.redMaximum][t.greenMaximum][t.blueMaximum]+r[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMaximum]+r[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMaximum]-r[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMaximum]-(-r[t.alphaMinimum][t.redMaximum][t.greenMaximum][t.blueMinimum]+r[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMinimum]+r[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMinimum]-r[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMinimum]);case Ot._red:return-r[t.alphaMaximum][t.redMinimum][t.greenMaximum][t.blueMaximum]+r[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMaximum]+r[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMaximum]-r[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMaximum]-(-r[t.alphaMaximum][t.redMinimum][t.greenMaximum][t.blueMinimum]+r[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMinimum]+r[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMinimum]-r[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMinimum]);case Ot._green:return-r[t.alphaMaximum][t.redMaximum][t.greenMinimum][t.blueMaximum]+r[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMaximum]+r[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMaximum]-r[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMaximum]-(-r[t.alphaMaximum][t.redMaximum][t.greenMinimum][t.blueMinimum]+r[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMinimum]+r[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMinimum]-r[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMinimum]);case Ot._blue:return-r[t.alphaMaximum][t.redMaximum][t.greenMaximum][t.blueMinimum]+r[t.alphaMaximum][t.redMaximum][t.greenMinimum][t.blueMinimum]+r[t.alphaMaximum][t.redMinimum][t.greenMaximum][t.blueMinimum]-r[t.alphaMaximum][t.redMinimum][t.greenMinimum][t.blueMinimum]-(-r[t.alphaMinimum][t.redMaximum][t.greenMaximum][t.blueMinimum]+r[t.alphaMinimum][t.redMaximum][t.greenMinimum][t.blueMinimum]+r[t.alphaMinimum][t.redMinimum][t.greenMaximum][t.blueMinimum]-r[t.alphaMinimum][t.redMinimum][t.greenMinimum][t.blueMinimum]);default:return 0}}_calculateVariance(t){const e=Ot._volume(t,this._momentsRed),r=Ot._volume(t,this._momentsGreen),i=Ot._volume(t,this._momentsBlue),n=Ot._volume(t,this._momentsAlpha);return Ot._volumeFloat(t,this._moments)-(e*e+r*r+i*i+n*n)/Ot._volume(t,this._weights)}_maximize(t,e,r,i,n,a,o,s,h){const l=0|Ot._bottom(t,e,this._momentsRed),f=0|Ot._bottom(t,e,this._momentsGreen),u=0|Ot._bottom(t,e,this._momentsBlue),c=0|Ot._bottom(t,e,this._momentsAlpha),d=0|Ot._bottom(t,e,this._weights);let p=0,m=-1;for(let g=r;gp&&(p=e,m=g))}}return{max:p,position:m}}_cut(t,e){let r;const i=Ot._volume(t,this._momentsRed),n=Ot._volume(t,this._momentsGreen),a=Ot._volume(t,this._momentsBlue),o=Ot._volume(t,this._momentsAlpha),s=Ot._volume(t,this._weights),h=this._maximize(t,Ot._red,t.redMinimum+1,t.redMaximum,i,n,a,o,s),l=this._maximize(t,Ot._green,t.greenMinimum+1,t.greenMaximum,i,n,a,o,s),f=this._maximize(t,Ot._blue,t.blueMinimum+1,t.blueMaximum,i,n,a,o,s),u=this._maximize(t,Ot._alpha,t.alphaMinimum+1,t.alphaMaximum,i,n,a,o,s);if(u.max>=h.max&&u.max>=l.max&&u.max>=f.max){if(r=Ot._alpha,u.position<0)return!1}else r=h.max>=u.max&&h.max>=l.max&&h.max>=f.max?Ot._red:l.max>=u.max&&l.max>=h.max&&l.max>=f.max?Ot._green:Ot._blue;switch(e.redMaximum=t.redMaximum,e.greenMaximum=t.greenMaximum,e.blueMaximum=t.blueMaximum,e.alphaMaximum=t.alphaMaximum,r){case Ot._red:e.redMinimum=t.redMaximum=h.position,e.greenMinimum=t.greenMinimum,e.blueMinimum=t.blueMinimum,e.alphaMinimum=t.alphaMinimum;break;case Ot._green:e.greenMinimum=t.greenMaximum=l.position,e.redMinimum=t.redMinimum,e.blueMinimum=t.blueMinimum,e.alphaMinimum=t.alphaMinimum;break;case Ot._blue:e.blueMinimum=t.blueMaximum=f.position,e.redMinimum=t.redMinimum,e.greenMinimum=t.greenMinimum,e.alphaMinimum=t.alphaMinimum;break;case Ot._alpha:e.alphaMinimum=t.alphaMaximum=u.position,e.blueMinimum=t.blueMinimum,e.redMinimum=t.redMinimum,e.greenMinimum=t.greenMinimum}return t.volume=(t.redMaximum-t.redMinimum)*(t.greenMaximum-t.greenMinimum)*(t.blueMaximum-t.blueMinimum)*(t.alphaMaximum-t.alphaMinimum),e.volume=(e.redMaximum-e.redMinimum)*(e.greenMaximum-e.greenMinimum)*(e.blueMaximum-e.blueMinimum)*(e.alphaMaximum-e.alphaMinimum),!0}_initialize(t){this._colors=t,this._cubes=[];for(let e=0;eUt,ErrorDiffusionArray:()=>Nt,ErrorDiffusionArrayKernel:()=>Dt,ErrorDiffusionRiemersma:()=>Ht,NearestColor:()=>zt});var Ut=class{quantizeSync(t,e){for(const r of this.quantize(t,e))if(r.pointContainer)return r.pointContainer;throw new Error("unreachable")}},zt=class extends Ut{constructor(t){super(),f(this,"_distance"),this._distance=t}*quantize(t,e){const r=t.getPointArray(),i=t.getWidth(),n=t.getHeight(),a=new gt(n,99);for(let t=0;t(t[t.FloydSteinberg=0]="FloydSteinberg",t[t.FalseFloydSteinberg=1]="FalseFloydSteinberg",t[t.Stucki=2]="Stucki",t[t.Atkinson=3]="Atkinson",t[t.Jarvis=4]="Jarvis",t[t.Burkes=5]="Burkes",t[t.Sierra=6]="Sierra",t[t.TwoSierra=7]="TwoSierra",t[t.SierraLite=8]="SierraLite",t))(Dt||{}),Nt=class extends Ut{constructor(t,e,r=!0,i=0,n=!1){super(),f(this,"_minColorDistance"),f(this,"_serpentine"),f(this,"_kernel"),f(this,"_calculateErrorLikeGIMP"),f(this,"_distance"),this._setKernel(e),this._distance=t,this._minColorDistance=i,this._serpentine=r,this._calculateErrorLikeGIMP=n}*quantize(t,e){const r=t.getPointArray(),i=new ht,n=t.getWidth(),a=t.getHeight(),o=[];let s=1,h=1;for(const t of this._kernel){const e=t[2]+1;h=0&&r+l=0&&i+te&&(t.length=e);const r=t.length;for(let e=0;e=0&&t.x=0&&t.y{const s=r[t+n*i];let{r:h,g:l,b:f,a:u}=s;for(let t=0;tYt});var qt=.01,Zt=.03;function Yt(t,e){if(t.getHeight()!==e.getHeight()||t.getWidth()!==e.getWidth())throw new Error("Images have different sizes!");const r=(255*qt)**2,i=(255*Zt)**2;let n=0,a=0;return function(t,e,r){const i=t.getWidth(),n=t.getHeight();for(let a=0;a{let h=0,l=0,f=0;for(let r=0;ri.nextTick(t):t=>setTimeout(t,0);function Qt(t,{colorDistanceFormula:e,paletteQuantization:r,colors:i}={}){const n=ie(ee(e),r,i);return t.forEach((t=>n.sample(t))),n.quantizeSync()}async function Kt(t,{colorDistanceFormula:e,paletteQuantization:r,colors:i,onProgress:n}={}){return new Promise(((a,o)=>{const s=ie(ee(e),r,i);let h;t.forEach((t=>s.sample(t)));const l=s.quantize(),f=()=>{try{const t=l.next();t.done?a(h):(t.value.palette&&(h=t.value.palette),n&&n(t.value.progress),Jt(f))}catch(t){o(t)}};Jt(f)}))}function $t(t,e,{colorDistanceFormula:r,imageQuantization:i}={}){return re(ee(r),i).quantizeSync(t,e)}async function te(t,e,{colorDistanceFormula:r,imageQuantization:i,onProgress:n}={}){return new Promise(((a,o)=>{let s;const h=re(ee(r),i).quantize(t,e),l=()=>{try{const t=h.next();t.done?a(s):(t.value.pointContainer&&(s=t.value.pointContainer),n&&n(t.value.progress),Jt(l))}catch(t){o(t)}};Jt(l)}))}function ee(t="euclidean-bt709"){switch(t){case"cie94-graphic-arts":return new Y;case"cie94-textiles":return new Z;case"ciede2000":return new X;case"color-metric":return new J;case"euclidean":return new K;case"euclidean-bt709":return new $;case"euclidean-bt709-noalpha":return new tt;case"manhattan":return new rt;case"manhattan-bt709":return new nt;case"manhattan-nommyde":return new it;case"pngquant":return new at;default:throw new Error(`Unknown colorDistanceFormula ${t}`)}}function re(t,e="floyd-steinberg"){switch(e){case"nearest":return new zt(t);case"riemersma":return new Ht(t);case"floyd-steinberg":return new Nt(t,0);case"false-floyd-steinberg":return new Nt(t,1);case"stucki":return new Nt(t,2);case"atkinson":return new Nt(t,3);case"jarvis":return new Nt(t,4);case"burkes":return new Nt(t,5);case"sierra":return new Nt(t,6);case"two-sierra":return new Nt(t,7);case"sierra-lite":return new Nt(t,8);default:throw new Error(`Unknown imageQuantization ${e}`)}}function ie(t,e="wuquant",r=256){switch(e){case"neuquant":return new yt(t,r);case"rgbquant":return new Mt(t,r);case"wuquant":return new Lt(t,r);case"neuquant-float":return new xt(t,r);default:throw new Error(`Unknown paletteQuantization ${e}`)}}t.exports=l(u)}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var r=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t](r,r.exports,__webpack_require__),r.exports}__webpack_require__.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return __webpack_require__.d(e,{a:e}),e},__webpack_require__.d=(t,e)=>{for(var r in e)__webpack_require__.o(e,r)&&!__webpack_require__.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),__webpack_require__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),__webpack_require__.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var __webpack_exports__={};(()=>{"use strict";var t={};__webpack_require__.r(t),__webpack_require__.d(t,{AUTO:()=>et,BLEND_ADD:()=>ut,BLEND_DARKEN:()=>pt,BLEND_DESTINATION_OVER:()=>lt,BLEND_DIFFERENCE:()=>bt,BLEND_EXCLUSION:()=>_t,BLEND_HARDLIGHT:()=>gt,BLEND_LIGHTEN:()=>mt,BLEND_MULTIPLY:()=>ft,BLEND_OVERLAY:()=>dt,BLEND_SCREEN:()=>ct,BLEND_SOURCE_OVER:()=>ht,EDGE_CROP:()=>vt,EDGE_EXTEND:()=>yt,EDGE_WRAP:()=>wt,HORIZONTAL_ALIGN_CENTER:()=>it,HORIZONTAL_ALIGN_LEFT:()=>rt,HORIZONTAL_ALIGN_RIGHT:()=>nt,VERTICAL_ALIGN_BOTTOM:()=>st,VERTICAL_ALIGN_MIDDLE:()=>ot,VERTICAL_ALIGN_TOP:()=>at});var e={};__webpack_require__.r(e),__webpack_require__.d(e,{add:()=>St,darken:()=>It,difference:()=>Rt,dstOver:()=>Et,exclusion:()=>Pt,hardLight:()=>Tt,lighten:()=>Bt,multiply:()=>kt,overlay:()=>At,screen:()=>Mt,srcOver:()=>xt});var r=__webpack_require__(5546),i=__webpack_require__.n(r),n=__webpack_require__(1023),a=__webpack_require__.n(n),o=__webpack_require__(2699),s=__webpack_require__.n(o);function h(t){if(void 0===t)return!1;if("function"!=typeof t)throw new TypeError("Callback must be a function");return!0}function l(t,e){if("string"==typeof t&&(t=new Error(t)),"function"==typeof e)return e.call(this,t);throw t}function f(t,e,r,i,n,a){e=Math.round(e),r=Math.round(r),i=Math.round(i),n=Math.round(n);for(let o=r;o1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}if(t=D(t,360),e=D(e,100),r=D(r,100),0===e)i=n=a=r;else{var s=r<.5?r*(1+e):r+e-r*e,h=2*r-s;i=o(h,s,t+1/3),n=o(h,s,t),a=o(h,s,t-1/3)}return{r:255*i,g:255*n,b:255*a}}(t.h,o,h),l=!0,f="hsl"),t.hasOwnProperty("a")&&(a=t.a)),a=z(a),{ok:l,format:t.format||f,r:Math.min(255,Math.max(n.r,0)),g:Math.min(255,Math.max(n.g,0)),b:Math.min(255,Math.max(n.b,0)),a}}(t);this._originalInput=t,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||r.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=r.ok}function y(t,e,r){t=D(t,255),e=D(e,255),r=D(r,255);var i,n,a=Math.max(t,e,r),o=Math.min(t,e,r),s=(a+o)/2;if(a==o)i=n=0;else{var h=a-o;switch(n=s>.5?h/(2-a-o):h/(a+o),a){case t:i=(e-r)/h+(e>1)+720)%360;--e;)i.h=(i.h+n)%360,a.push(_(i));return a}function L(t,e){e=e||6;for(var r=_(t).toHsv(),i=r.h,n=r.s,a=r.v,o=[],s=1/e;e--;)o.push(_({h:i,s:n,v:a})),a=(a+s)%1;return o}_.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,e,r,i=this.toRgb();return t=i.r/255,e=i.g/255,r=i.b/255,.2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.0722*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))},setAlpha:function(t){return this._a=z(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=w(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=w(this._r,this._g,this._b),e=Math.round(360*t.h),r=Math.round(100*t.s),i=Math.round(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+i+"%)":"hsva("+e+", "+r+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var t=y(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=y(this._r,this._g,this._b),e=Math.round(360*t.h),r=Math.round(100*t.s),i=Math.round(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+i+"%)":"hsla("+e+", "+r+"%, "+i+"%, "+this._roundA+")"},toHex:function(t){return v(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,r,i,n){var a=[j(Math.round(t).toString(16)),j(Math.round(e).toString(16)),j(Math.round(r).toString(16)),j(H(i))];return n&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*D(this._r,255))+"%",g:Math.round(100*D(this._g,255))+"%",b:Math.round(100*D(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*D(this._r,255))+"%, "+Math.round(100*D(this._g,255))+"%, "+Math.round(100*D(this._b,255))+"%)":"rgba("+Math.round(100*D(this._r,255))+"%, "+Math.round(100*D(this._g,255))+"%, "+Math.round(100*D(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(U[v(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+x(this._r,this._g,this._b,this._a),r=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var n=_(t);r="#"+x(n._r,n._g,n._b,n._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,i=this._a<1&&this._a>=0;return e||!i||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return _(this.toString())},_applyModification:function(t,e){var r=t.apply(null,[this].concat([].slice.call(e)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(M,arguments)},brighten:function(){return this._applyModification(A,arguments)},darken:function(){return this._applyModification(I,arguments)},desaturate:function(){return this._applyModification(E,arguments)},saturate:function(){return this._applyModification(k,arguments)},greyscale:function(){return this._applyModification(S,arguments)},spin:function(){return this._applyModification(B,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(O,arguments)},complement:function(){return this._applyCombination(T,arguments)},monochromatic:function(){return this._applyCombination(L,arguments)},splitcomplement:function(){return this._applyCombination(P,arguments)},triad:function(){return this._applyCombination(R,[3])},tetrad:function(){return this._applyCombination(R,[4])}},_.fromRatio=function(t,e){if("object"==m(t)){var r={};for(var i in t)t.hasOwnProperty(i)&&(r[i]="a"===i?t[i]:G(t[i]));t=r}return _(t,e)},_.equals=function(t,e){return!(!t||!e)&&_(t).toRgbString()==_(e).toRgbString()},_.random=function(){return _.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},_.mix=function(t,e,r){r=0===r?0:r||50;var i=_(t).toRgb(),n=_(e).toRgb(),a=r/100;return _({r:(n.r-i.r)*a+i.r,g:(n.g-i.g)*a+i.g,b:(n.b-i.b)*a+i.b,a:(n.a-i.a)*a+i.a})},_.readability=function(t,e){var r=_(t),i=_(e);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)},_.isReadable=function(t,e,r){var i,n,a,o,s,h=_.readability(t,e);switch(n=!1,(a=r,"AA"!==(o=((a=a||{level:"AA",size:"small"}).level||"AA").toUpperCase())&&"AAA"!==o&&(o="AA"),"small"!==(s=(a.size||"small").toLowerCase())&&"large"!==s&&(s="small"),i={level:o,size:s}).level+i.size){case"AAsmall":case"AAAlarge":n=h>=4.5;break;case"AAlarge":n=h>=3;break;case"AAAsmall":n=h>=7}return n},_.mostReadable=function(t,e,r){var i,n,a,o,s=null,h=0;n=(r=r||{}).includeFallbackColors,a=r.level,o=r.size;for(var l=0;lh&&(h=i,s=_(e[l]));return _.isReadable(t,s,{level:a,size:o})||!n?s:(r.includeFallbackColors=!1,_.mostReadable(t,["#fff","#000"],r))};var C=_.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},U=_.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(C);function z(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function D(t,e){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var r=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=Math.min(e,Math.max(0,parseFloat(t))),r&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function N(t){return Math.min(1,Math.max(0,t))}function F(t){return parseInt(t,16)}function j(t){return 1==t.length?"0"+t:""+t}function G(t){return t<=1&&(t=100*t+"%"),t}function H(t){return Math.round(255*parseFloat(t)).toString(16)}function W(t){return F(t)/255}var q,Z,Y,V=(Z="[\\s|\\(]+("+(q="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+q+")[,|\\s]+("+q+")\\s*\\)?",Y="[\\s|\\(]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")[,|\\s]+("+q+")\\s*\\)?",{CSS_UNIT:new RegExp(q),rgb:new RegExp("rgb"+Z),rgba:new RegExp("rgba"+Y),hsl:new RegExp("hsl"+Z),hsla:new RegExp("hsla"+Y),hsv:new RegExp("hsv"+Z),hsva:new RegExp("hsva"+Y),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function X(t){return!!V.CSS_UNIT.exec(t)}function J(t,e){this.size=this.size||t,this.smallerSize=this.smallerSize||e,function(t){for(let e=1;e>>=8),i=255&(t>>>=8);return{r:255&(t>>>=8),g:i,b:r,a:e}}J.prototype.size=32,J.prototype.smallerSize=8,J.prototype.distance=function(t,e){let r=0;for(let i=0;in?"1":"0";return a};const K=[],$=J;__webpack_require__(9307);const tt=(t,e)=>{let{url:r,...i}=t;fetch(r,i).then((t=>{if(t.ok)return t.arrayBuffer().catch((t=>{throw new Error(`Response is not a buffer for url ${r}. Error: ${t.message}`)}));throw new Error(`HTTP Status ${t.status} for url ${r}`)})).then((t=>e(null,t))).catch((t=>e(t)))},et=-1,rt=1,it=2,nt=4,at=8,ot=16,st=32,ht="srcOver",lt="dstOver",ft="multiply",ut="add",ct="screen",dt="overlay",pt="darken",mt="lighten",gt="hardLight",bt="difference",_t="exclusion",yt=1,wt=2,vt=3;function xt(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.a*=r;const i=e.a+t.a-e.a*t.a;return{r:(t.r*t.a+e.r*e.a*(1-t.a))/i,g:(t.g*t.a+e.g*e.a*(1-t.a))/i,b:(t.b*t.a+e.b*e.a*(1-t.a))/i,a:i}}function Et(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.a*=r;const i=e.a+t.a-e.a*t.a;return{r:(e.r*e.a+t.r*t.a*(1-e.a))/i,g:(e.g*e.a+t.g*t.a*(1-e.a))/i,b:(e.b*e.a+t.b*t.a*(1-e.a))/i,a:i}}function kt(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.a*=r;const i=e.a+t.a-e.a*t.a,n=t.r*t.a,a=t.g*t.a,o=t.b*t.a,s=e.r*e.a,h=e.g*e.a,l=e.b*e.a;return{r:(n*s+n*(1-e.a)+s*(1-t.a))/i,g:(a*h+a*(1-e.a)+h*(1-t.a))/i,b:(o*l+o*(1-e.a)+l*(1-t.a))/i,a:i}}function St(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.a*=r;const i=e.a+t.a-e.a*t.a,n=t.r*t.a,a=t.g*t.a,o=t.b*t.a;return{r:(n+e.r*e.a)/i,g:(a+e.g*e.a)/i,b:(o+e.b*e.a)/i,a:i}}function Mt(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.a*=r;const i=e.a+t.a-e.a*t.a,n=t.r*t.a,a=t.g*t.a,o=t.b*t.a,s=e.r*e.a,h=e.g*e.a,l=e.b*e.a;return{r:(n*e.a+s*t.a-n*s+n*(1-e.a)+s*(1-t.a))/i,g:(a*e.a+h*t.a-a*h+a*(1-e.a)+h*(1-t.a))/i,b:(o*e.a+l*t.a-o*l+o*(1-e.a)+l*(1-t.a))/i,a:i}}function At(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.a*=r;const i=e.a+t.a-e.a*t.a,n=t.r*t.a,a=t.g*t.a,o=t.b*t.a,s=e.r*e.a,h=e.g*e.a,l=e.b*e.a;return{r:(2*s<=e.a?2*n*s+n*(1-e.a)+s*(1-t.a):n*(1+e.a)+s*(1+t.a)-2*s*n-e.a*t.a)/i,g:(2*h<=e.a?2*a*h+a*(1-e.a)+h*(1-t.a):a*(1+e.a)+h*(1+t.a)-2*h*a-e.a*t.a)/i,b:(2*l<=e.a?2*o*l+o*(1-e.a)+l*(1-t.a):o*(1+e.a)+l*(1+t.a)-2*l*o-e.a*t.a)/i,a:i}}function It(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.a*=r;const i=e.a+t.a-e.a*t.a,n=t.r*t.a,a=t.g*t.a,o=t.b*t.a,s=e.r*e.a,h=e.g*e.a,l=e.b*e.a;return{r:(Math.min(n*e.a,s*t.a)+n*(1-e.a)+s*(1-t.a))/i,g:(Math.min(a*e.a,h*t.a)+a*(1-e.a)+h*(1-t.a))/i,b:(Math.min(o*e.a,l*t.a)+o*(1-e.a)+l*(1-t.a))/i,a:i}}function Bt(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.a*=r;const i=e.a+t.a-e.a*t.a,n=t.r*t.a,a=t.g*t.a,o=t.b*t.a,s=e.r*e.a,h=e.g*e.a,l=e.b*e.a;return{r:(Math.max(n*e.a,s*t.a)+n*(1-e.a)+s*(1-t.a))/i,g:(Math.max(a*e.a,h*t.a)+a*(1-e.a)+h*(1-t.a))/i,b:(Math.max(o*e.a,l*t.a)+o*(1-e.a)+l*(1-t.a))/i,a:i}}function Tt(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.a*=r;const i=e.a+t.a-e.a*t.a,n=t.r*t.a,a=t.g*t.a,o=t.b*t.a,s=e.r*e.a,h=e.g*e.a,l=e.b*e.a;return{r:(2*n<=t.a?2*n*s+n*(1-e.a)+s*(1-t.a):n*(1+e.a)+s*(1+t.a)-2*s*n-e.a*t.a)/i,g:(2*a<=t.a?2*a*h+a*(1-e.a)+h*(1-t.a):a*(1+e.a)+h*(1+t.a)-2*h*a-e.a*t.a)/i,b:(2*o<=t.a?2*o*l+o*(1-e.a)+l*(1-t.a):o*(1+e.a)+l*(1+t.a)-2*l*o-e.a*t.a)/i,a:i}}function Rt(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.a*=r;const i=e.a+t.a-e.a*t.a,n=t.r*t.a,a=t.g*t.a,o=t.b*t.a,s=e.r*e.a,h=e.g*e.a,l=e.b*e.a;return{r:(n+s-2*Math.min(n*e.a,s*t.a))/i,g:(a+h-2*Math.min(a*e.a,h*t.a))/i,b:(o+l-2*Math.min(o*e.a,l*t.a))/i,a:i}}function Pt(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;t.a*=r;const i=e.a+t.a-e.a*t.a,n=t.r*t.a,a=t.g*t.a,o=t.b*t.a,s=e.r*e.a,h=e.g*e.a,l=e.b*e.a;return{r:(n*e.a+s*t.a-2*n*s+n*(1-e.a)+s*(1-t.a))/i,g:(a*e.a+h*t.a-2*a*h+a*(1-e.a)+h*(1-t.a))/i,b:(o*e.a+l*t.a-2*o*l+o*(1-e.a)+l*(1-t.a))/i,a:i}}const Ot=function(t,e){for(var r=arguments.length,i=new Array(r>2?r-2:0),n=2;n{i.push(((t,e)=>{t&&n(t),r(e)})),t.bind(e)(...i)}))},Lt={},Ct=(t,e)=>{Lt[t]=e},Ut=t=>{const e=t.split("/").slice(-1);var r;return(r=e[e.length-1].split(".").pop(),Object.entries(Lt).find((t=>t[1].includes(r)))||[])[0]};var zt=__webpack_require__(5025),Dt=__webpack_require__.n(zt),Nt=__webpack_require__(6551),Ft=__webpack_require__.n(Nt),jt=__webpack_require__(8834).lW;function Gt(t){return t._exif&&t._exif.tags&&t._exif.tags.Orientation||1}async function Ht(t,e,r){const i=await async function(t,e){const r=await Dt().fromBuffer(t);return r?r.mime:e?Ut(e):null}(t,e);if("string"!=typeof i)return r(new Error("Could not find MIME for Buffer <"+e+">"));this._originalMime=i.toLowerCase();try{const e=this.getMIME();if(!this.constructor.decoders[e])return l.call(this,"Unsupported MIME type: "+e,r);this.bitmap=this.constructor.decoders[e](t)}catch(t){return r.call(this,t,this)}try{this._exif=Ft().create(t).parse(),function(t){if(Gt(t)<2)return;const e=function(t){const e=t.getWidth(),r=t.getHeight();switch(Gt(t)){case 1:default:return null;case 2:return function(t,r){return[e-t-1,r]};case 3:return function(t,i){return[e-t-1,r-i-1]};case 4:return function(t,e){return[t,r-e-1]};case 5:return function(t,e){return[e,t]};case 6:return function(t,e){return[e,r-t-1]};case 7:return function(t,i){return[e-i-1,r-t-1]};case 8:return function(t,r){return[e-r-1,t]}}}(t),r=Gt(t)>4;!function(t,e,r,i){const n=t.bitmap.data,a=t.bitmap.width,o=jt.alloc(n.length);for(let t=0;t{e.call(this,null,t)})):e.call(this,null,r)}return this}function qt(t){return Ot(Wt,this,t)}var Zt=__webpack_require__(8834).lW;function Yt(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}const Vt="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",Xt=[NaN,NaN];for(let t=2;t<65;t++){const e=c()(c().BIN,Vt.slice(0,t))(new Array(65).join("1"));Xt.push(e.length)}function Jt(){}function Qt(t){return Object.prototype.toString.call(t).toLowerCase().indexOf("arraybuffer")>-1}function Kt(t){const e=Zt.alloc(t.byteLength),r=new Uint8Array(t);for(let t=0;tr?e(r):"object"==typeof i&&Zt.isBuffer(i)?e(null,i):"object"==typeof i&&Qt(i)?e(null,Kt(i)):new Error(`Could not load Buffer from <${t.url}>`)))}const te={data:null,width:null,height:null};class ee extends(s()){constructor(){for(var t=arguments.length,e=new Array(t),r=0;rOt(this.write,this,t))),Yt(this,"getBase64Async",(t=>Ot(this.getBase64,this,t))),Yt(this,"getBuffer",Wt),Yt(this,"getBufferAsync",qt),Yt(this,"getPixelColour",this.getPixelColor),Yt(this,"setPixelColour",this.setPixelColor);const n=this;let a=Jt;function o(){for(var t=arguments.length,e=new Array(t),r=0;r{i&&a===Jt?n.emitError("constructor",i):i||n.emitMulti("constructor","initialized"),a.call(n,...e)}),1)}if(Qt(e[0])&&(e[0]=Kt(e[0])),"number"==typeof e[0]&&"number"==typeof e[1]||parseInt(e[0],10)&&parseInt(e[1],10)){const t=parseInt(e[0],10),r=parseInt(e[1],10);if(a=e[2],"number"==typeof e[2]&&(this._background=e[2],a=e[3]),"string"==typeof e[2]&&(this._background=ee.cssColorToHex(e[2]),a=e[3]),void 0===a&&(a=Jt),"function"!=typeof a)return l.call(this,"cb must be a function",o);this.bitmap={data:Zt.alloc(t*r*4),width:t,height:r};for(let t=0;t{if(t)return l.call(this,t,o);this.parseBitmap(r,e[0].url,o)}))}else if(e[0]instanceof ee){const[t]=e;if(a=e[1],void 0===a&&(a=Jt),"function"!=typeof a)return l.call(this,"cb must be a function",o);this.bitmap={data:Zt.from(t.bitmap.data),width:t.bitmap.width,height:t.bitmap.height},this._quality=t._quality,this._deflateLevel=t._deflateLevel,this._deflateStrategy=t._deflateStrategy,this._filterType=t._filterType,this._rgba=t._rgba,this._background=t._background,this._originalMime=t._originalMime,o(null,this)}else if((s=e[0])&&"object"==typeof s&&"number"==typeof s.width&&"number"==typeof s.height&&(Zt.isBuffer(s.data)||s.data instanceof Uint8Array||"function"==typeof Uint8ClampedArray&&s.data instanceof Uint8ClampedArray)&&(s.data.length===s.width*s.height*4||s.data.length===s.width*s.height*3)){const[t]=e;a=e[1]||Jt;const r=t.width*t.height*4===t.data.length?Zt.from(t.data):function(t){if(t.length%3!=0)throw new Error("Buffer length is incorrect");const e=Zt.allocUnsafe(t.length/3*4);let r=0;for(let i=0;i{if(e)return l.call(this,e,o);this.parseBitmap(r,t,o)}))}else if("object"==typeof e[0]&&Zt.isBuffer(e[0])){const t=e[0];if(a=e[1],"function"!=typeof a)return l.call(this,"cb must be a function",o);this.parseBitmap(t,null,o)}else{a=e[e.length-1],"function"!=typeof a&&(a=e[e.length-2],"function"!=typeof a&&(a=Jt));const t=ee.__extraConstructors.find((t=>t.test(...e)));if(!t)return l.call(this,"No matching constructor overloading was found. Please see the docs for how to call the Jimp constructor.",o);new Promise(((r,i)=>{t.run.call(this,r,i,...e)})).then((()=>o(null,this))).catch(o)}var s}parseBitmap(t,e,r){Ht.call(this,t,null,r)}rgba(t,e){return"boolean"!=typeof t?l.call(this,"bool must be a boolean, true for RGBA or false for RGB",e):(this._rgba=t,h(e)&&e.call(this,null,this),this)}emitMulti(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r=Object.assign(r,{methodName:t,eventName:e}),this.emit("any",r),t&&this.emit(t,r),this.emit(e,r)}emitError(t,e){this.emitMulti(t,"error",e)}getHeight(){return this.bitmap.height}getWidth(){return this.bitmap.width}inspect(){return""}toString(){return"[object Jimp]"}getMIME(){return this._originalMime||ee.MIME_PNG}getExtension(){const t=this.getMIME();return(Lt[t.toLowerCase()]||[])[0]}write(t,e){if(!i()||!i().createWriteStream)throw new Error("Cant access the filesystem. You can use the getBase64 method.");if("string"!=typeof t)return l.call(this,"path must be a string",e);if(void 0===e&&(e=Jt),"function"!=typeof e)return l.call(this,"cb must be a function",e);const r=Ut(t)||this.getMIME(),n=a().parse(t);return n.dir&&i().mkdirSync(n.dir,{recursive:!0}),this.getBuffer(r,((r,n)=>{if(r)return l.call(this,r,e);const a=i().createWriteStream(t);a.on("open",(()=>{a.write(n),a.end()})).on("error",(t=>l.call(this,t,e))),a.on("finish",(()=>{e.call(this,null,this)}))})),this}getBase64(t,e){return t===ee.AUTO&&(t=this.getMIME()),"string"!=typeof t?l.call(this,"mime must be a string",e):"function"!=typeof e?l.call(this,"cb must be a function",e):(this.getBuffer(t,(function(r,i){if(r)return l.call(this,r,e);const n="data:"+t+";base64,"+i.toString("base64");e.call(this,null,n)})),this)}hash(t,e){if("function"==typeof(t=t||64)&&(e=t,t=64),"number"!=typeof t)return l.call(this,"base must be a number",e);if(t<2||t>64)return l.call(this,"base must be a number between 2 and 64",e);let r=this.pHash();for(r=c()(c().BIN,Vt.slice(0,t))(r);r.length=this.bitmap.width&&(n=this.bitmap.width-1),e<0&&(a=0),e>=this.bitmap.height&&(a=this.bitmap.height-1)),r===ee.EDGE_WRAP&&(t<0&&(n=this.bitmap.width+t),t>=this.bitmap.width&&(n=t%this.bitmap.width),e<0&&(a=this.bitmap.height+e),e>=this.bitmap.height&&(a=e%this.bitmap.height));let o=this.bitmap.width*a+n<<2;return(n<0||n>=this.bitmap.width)&&(o=-1),(a<0||a>=this.bitmap.height)&&(o=-1),h(i)&&i.call(this,null,o),o}getPixelColor(t,e,r){if("number"!=typeof t||"number"!=typeof e)return l.call(this,"x and y must be numbers",r);const i=this.getPixelIndex(t,e),n=this.bitmap.data.readUInt32BE(i);return h(r)&&r.call(this,null,n),n}setPixelColor(t,e,r,i){if("number"!=typeof t||"number"!=typeof e||"number"!=typeof r)return l.call(this,"hex, x and y must be numbers",i);const n=this.getPixelIndex(e,r);return this.bitmap.data.writeUInt32BE(t,n),h(i)&&i.call(this,null,this),this}hasAlpha(){const{width:t,height:e,data:r}=this.bitmap,i=t*e<<2;for(let t=3;t1&&void 0!==arguments[1]?arguments[1]:ee;Object.entries(t).forEach((t=>{let[r,i]=t;e[r]=i}))}function ie(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ee;Object.entries(t).forEach((t=>{let[r,i]=t;e.prototype[r]=i}))}function ne(t,e,r){const i="before-"+e,n=e.replace(/e$/,"")+"ed";ee.prototype[t]=function(){let e;for(var a=arguments.length,o=new Array(a),s=0;s3&&void 0!==arguments[3]?arguments[3]:{},a=arguments.length>4?arguments[4]:void 0;if("function"==typeof n&&(a=n,n={}),!(t instanceof this.constructor))return l.call(this,"The source must be a Jimp image",a);if("number"!=typeof r||"number"!=typeof i)return l.call(this,"x and y must be numbers",a);let{mode:o,opacitySource:s,opacityDest:f}=n;o||(o=ht),("number"!=typeof s||s<0||s>1)&&(s=1),("number"!=typeof f||f<0||f>1)&&(f=1);const u=e[o];r=Math.round(r),i=Math.round(i);const c=this;return 1!==f&&c.opacity(f),t.scanQuiet(0,0,t.bitmap.width,t.bitmap.height,(function(t,e,n){const a=c.getPixelIndex(r+t,i+e,vt);if(-1===a)return;const o=u({r:this.bitmap.data[n+0]/255,g:this.bitmap.data[n+1]/255,b:this.bitmap.data[n+2]/255,a:this.bitmap.data[n+3]/255},{r:c.bitmap.data[a+0]/255,g:c.bitmap.data[a+1]/255,b:c.bitmap.data[a+2]/255,a:c.bitmap.data[a+3]/255},s);c.bitmap.data[a+0]=this.constructor.limit255(255*o.r),c.bitmap.data[a+1]=this.constructor.limit255(255*o.g),c.bitmap.data[a+2]=this.constructor.limit255(255*o.b),c.bitmap.data[a+3]=this.constructor.limit255(255*o.a)})),h(a)&&a.call(this,null,this),this}}),ee.__extraConstructors=[],ee.appendConstructorOption=function(t,e,r){ee.__extraConstructors.push({name:t,test:e,run:r})},ee.read=function(){for(var t=arguments.length,e=new Array(t),r=0;r{new ee(...e,((e,i)=>{e?r(e):t(i)}))}))},ee.create=ee.read,ee.rgbaToInt=function(t,e,r,i,n){if("number"!=typeof t||"number"!=typeof e||"number"!=typeof r||"number"!=typeof i)return l.call(this,"r, g, b and a must be numbers",n);if(t<0||t>255)return l.call(this,"r must be between 0 and 255",n);if((e<0||e>255)&&l.call(this,"g must be between 0 and 255",n),r<0||r>255)return l.call(this,"b must be between 0 and 255",n);if(i<0||i>255)return l.call(this,"a must be between 0 and 255",n);let a=255&t;return a<<=8,a|=255&e,a<<=8,a|=255&r,a<<=8,a|=255&i,a>>>=0,h(n)&&n.call(this,null,a),a},ee.intToRGBA=function(t,e){if("number"!=typeof t)return l.call(this,"i must be a number",e);const r={};return r.r=Math.floor(t/Math.pow(256,3)),r.g=Math.floor((t-r.r*Math.pow(256,3))/Math.pow(256,2)),r.b=Math.floor((t-r.r*Math.pow(256,3)-r.g*Math.pow(256,2))/Math.pow(256,1)),r.a=Math.floor((t-r.r*Math.pow(256,3)-r.g*Math.pow(256,2)-r.b*Math.pow(256,1))/Math.pow(256,0)),h(e)&&e.call(this,null,r),r},ee.cssColorToHex=function(t){return"number"==typeof(t=t||0)?Number(t):parseInt(_(t).toHex8(),16)},ee.limit255=function(t){return t=Math.max(t,0),Math.min(t,255)},ee.diff=function(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1;if(!(t instanceof ee&&e instanceof ee))return l.call(this,"img1 and img2 must be an Jimp images");const i=t.bitmap,n=e.bitmap;if(i.width===n.width&&i.height===n.height||(i.width*i.height>n.width*n.height?t=t.cloneQuiet().resize(n.width,n.height):e=e.cloneQuiet().resize(i.width,i.height)),"number"!=typeof r||r<0||r>1)return l.call(this,"threshold must be a number between 0 and 1");const a=new ee(i.width,i.height,4294967295);return{percent:p()(i.data,n.data,a.bitmap.data,a.bitmap.width,a.bitmap.height,{threshold:r})/(a.bitmap.width*a.bitmap.height),image:a}},ee.distance=function(t,e){const r=new $,i=r.getHash(t),n=r.getHash(e);return r.distance(i,n)},ee.compareHashes=function(t,e){return(new $).distance(t,e)},ee.colorDiff=function(t,e){const r=t=>Math.pow(t,2),{max:i}=Math;return 0===t.a||t.a||(t.a=255),0===e.a||e.a||(e.a=255),(i(r(t.r-e.r),r(t.r-e.r-t.a+e.a))+i(r(t.g-e.g),r(t.g-e.g-t.a+e.a))+i(r(t.b-e.b),r(t.b-e.b-t.a+e.a)))/195075},ne("clone","clone",(function(t){const e=new ee(this);return h(t)&&t.call(e,null,e),e})),ae("background",(function(t,e){return"number"!=typeof t?l.call(this,"hex must be a hexadecimal rgba value",e):(this._background=t,h(e)&&e.call(this,null,this),this)})),ae("scan",(function(t,e,r,i,n,a){if("number"!=typeof t||"number"!=typeof e)return l.call(this,"x and y must be numbers",a);if("number"!=typeof r||"number"!=typeof i)return l.call(this,"w and h must be numbers",a);if("function"!=typeof n)return l.call(this,"f must be a function",a);const o=f(this,t,e,r,i,n);return h(a)&&a.call(this,null,o),o}));{let t;"undefined"!=typeof window&&"object"==typeof window&&(t=window),"undefined"!=typeof self&&"object"==typeof self&&(t=self),t.Jimp=ee,t.Buffer=Zt}const oe=ee;var se=__webpack_require__(643),he=__webpack_require__(2691),le=__webpack_require__.n(he);const fe="image/jpeg",ue=()=>({mime:{[fe]:["jpeg","jpg","jpe"]},constants:{MIME_JPEG:fe},decoders:{[fe]:le().decode},encoders:{[fe]:t=>le().encode(t.bitmap,t._quality).data},class:{_quality:100,quality(t,e){return"number"!=typeof t?l.call(this,"n must be a number",e):t<0||t>100?l.call(this,"n must be a number 0 - 100",e):(this._quality=Math.round(t),h(e)&&e.call(this,null,this),this)}}});var ce=__webpack_require__(9902);const de="image/png",pe=()=>({mime:{[de]:["png"]},constants:{MIME_PNG:de,PNG_FILTER_AUTO:-1,PNG_FILTER_NONE:0,PNG_FILTER_SUB:1,PNG_FILTER_UP:2,PNG_FILTER_AVERAGE:3,PNG_FILTER_PATH:4},hasAlpha:{[de]:!0},decoders:{[de]:ce.PNG.sync.read},encoders:{[de](t){const e=new ce.PNG({width:t.bitmap.width,height:t.bitmap.height});return e.data=t.bitmap.data,ce.PNG.sync.write(e,{deflateLevel:t._deflateLevel,deflateStrategy:t._deflateStrategy,filterType:t._filterType,colorType:"number"==typeof t._colorType?t._colorType:t._rgba?6:2,inputHasAlpha:t._rgba})}},class:{_deflateLevel:9,_deflateStrategy:3,_filterType:-1,_colorType:null,deflateLevel(t,e){return"number"!=typeof t?l.call(this,"l must be a number",e):t<0||t>9?l.call(this,"l must be a number 0 - 9",e):(this._deflateLevel=Math.round(t),h(e)&&e.call(this,null,this),this)},deflateStrategy(t,e){return"number"!=typeof t?l.call(this,"s must be a number",e):t<0||t>3?l.call(this,"s must be a number 0 - 3",e):(this._deflateStrategy=Math.round(t),h(e)&&e.call(this,null,this),this)},filterType(t,e){return"number"!=typeof t?l.call(this,"n must be a number",e):t<-1||t>4?l.call(this,"n must be -1 (auto) or a number 0 - 4",e):(this._filterType=Math.round(t),h(e)&&e.call(this,null,this),this)},colorType(t,e){return"number"!=typeof t?l.call(this,"s must be a number",e):0!==t&&2!==t&&4!==t&&6!==t?l.call(this,"s must be a number 0, 2, 4, 6.",e):(this._colorType=Math.round(t),h(e)&&e.call(this,null,this),this)}}});var me=__webpack_require__(486),ge=__webpack_require__.n(me);const be="image/bmp",_e="image/x-ms-bmp",ye=t=>{return f({bitmap:e=ge().decode(t)},0,0,e.width,e.height,(function(t,r,i){const n=this.bitmap.data[i+0],a=this.bitmap.data[i+1],o=this.bitmap.data[i+2],s=this.bitmap.data[i+3];this.bitmap.data[i+0]=s,this.bitmap.data[i+1]=o,this.bitmap.data[i+2]=a,this.bitmap.data[i+3]=e.is_with_alpha?n:255})).bitmap;var e},we=t=>ge().encode(function(t){return f(t,0,0,t.bitmap.width,t.bitmap.height,(function(t,e,r){const i=this.bitmap.data[r+0],n=this.bitmap.data[r+1],a=this.bitmap.data[r+2],o=this.bitmap.data[r+3];this.bitmap.data[r+0]=o,this.bitmap.data[r+1]=a,this.bitmap.data[r+2]=n,this.bitmap.data[r+3]=i})).bitmap}(t)).data;var ve=__webpack_require__(9299),xe=__webpack_require__.n(ve),Ee=__webpack_require__(8834).lW;const ke="image/tiff";var Se=__webpack_require__(63),Me=__webpack_require__(9455),Ae=__webpack_require__(8834).lW;const Ie="image/gif",Be=[1,57,41,21,203,34,97,73,227,91,149,62,105,45,39,137,241,107,3,173,39,71,65,238,219,101,187,87,81,151,141,133,249,117,221,209,197,187,177,169,5,153,73,139,133,127,243,233,223,107,103,99,191,23,177,171,165,159,77,149,9,139,135,131,253,245,119,231,224,109,211,103,25,195,189,23,45,175,171,83,81,79,155,151,147,9,141,137,67,131,129,251,123,30,235,115,113,221,217,53,13,51,50,49,193,189,185,91,179,175,43,169,83,163,5,79,155,19,75,147,145,143,35,69,17,67,33,65,255,251,247,243,239,59,29,229,113,111,219,27,213,105,207,51,201,199,49,193,191,47,93,183,181,179,11,87,43,85,167,165,163,161,159,157,155,77,19,75,37,73,145,143,141,35,138,137,135,67,33,131,129,255,63,250,247,61,121,239,237,117,29,229,227,225,111,55,109,216,213,211,209,207,205,203,201,199,197,195,193,48,190,47,93,185,183,181,179,178,176,175,173,171,85,21,167,165,41,163,161,5,79,157,78,154,153,19,75,149,74,147,73,144,143,71,141,140,139,137,17,135,134,133,66,131,65,129,1],Te=[0,9,10,10,14,12,14,14,16,15,16,15,16,15,15,17,18,17,12,18,16,17,17,19,19,18,19,18,18,19,19,19,20,19,20,20,20,20,20,20,15,20,19,20,20,20,21,21,21,20,20,20,21,18,21,21,21,21,20,21,17,21,21,21,22,22,21,22,22,21,22,21,19,22,22,19,20,22,22,21,21,21,22,22,22,18,22,22,21,22,22,23,22,20,23,22,22,23,23,21,19,21,21,21,23,23,23,22,23,23,21,23,22,23,18,22,23,20,22,23,23,23,21,22,20,22,21,22,24,24,24,24,24,22,21,24,23,23,24,21,24,23,24,22,24,24,22,24,24,22,23,24,24,24,20,23,22,23,24,24,24,24,24,24,24,23,21,23,22,23,24,24,24,22,24,24,24,23,22,24,24,25,23,25,25,23,24,25,25,24,22,25,25,25,24,23,24,25,25,25,25,25,25,25,25,25,25,25,25,23,25,23,24,25,25,25,25,25,25,25,25,25,24,22,25,25,23,25,25,20,24,25,24,25,25,22,24,25,24,25,24,25,25,24,25,25,25,25,22,25,25,25,24,25,24,25,18];var Re=__webpack_require__(8834).lW;function Pe(t,e,r,i){const n=[0,0,0],a=(e.length-1)/2;for(let o=0;onull!=t;function Le(t){return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,e,r){const i=parseInt(.2126*this.bitmap.data[r]+.7152*this.bitmap.data[r+1]+.0722*this.bitmap.data[r+2],10);this.bitmap.data[r]=i,this.bitmap.data[r+1]=i,this.bitmap.data[r+2]=i})),h(t)&&t.call(this,null,this),this}function Ce(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50;return{r:(e.r-t.r)*(r/100)+t.r,g:(e.g-t.g)*(r/100)+t.g,b:(e.b-t.b)*(r/100)+t.b}}function Ue(t,e){return t&&Array.isArray(t)?(t=t.map((t=>("xor"!==t.apply&&"mix"!==t.apply||(t.params[0]=_(t.params[0]).toRgb()),t))),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,((r,i,n)=>{let a={r:this.bitmap.data[n],g:this.bitmap.data[n+1],b:this.bitmap.data[n+2]};const o=(t,e)=>this.constructor.limit255(a[t]+e);t.forEach((t=>{if("mix"===t.apply)a=Ce(a,t.params[0],t.params[1]);else if("tint"===t.apply)a=Ce(a,{r:255,g:255,b:255},t.params[0]);else if("shade"===t.apply)a=Ce(a,{r:0,g:0,b:0},t.params[0]);else if("xor"===t.apply)a={r:a.r^t.params[0].r,g:a.g^t.params[0].g,b:a.b^t.params[0].b};else if("red"===t.apply)a.r=o("r",t.params[0]);else if("green"===t.apply)a.g=o("g",t.params[0]);else if("blue"===t.apply)a.b=o("b",t.params[0]);else{if("hue"===t.apply&&(t.apply="spin"),a=_(a),!a[t.apply])return l.call(this,"action "+t.apply+" not supported",e);a=a[t.apply](...t.params).toRgb()}})),this.bitmap.data[n]=a.r,this.bitmap.data[n+1]=a.g,this.bitmap.data[n+2]=a.b})),h(e)&&e.call(this,null,this),this):l.call(this,"actions must be an array",e)}Object.freeze({LIGHTEN:"lighten",BRIGHTEN:"brighten",DARKEN:"darken",DESATURATE:"desaturate",SATURATE:"saturate",GREYSCALE:"greyscale",SPIN:"spin",HUE:"hue",MIX:"mix",TINT:"tint",SHADE:"shade",XOR:"xor",RED:"red",GREEN:"green",BLUE:"blue"});var ze=__webpack_require__(8834).lW;function De(t){const e=[1,9,3,11,13,5,15,7,4,12,2,10,16,8,14,6];return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,r,i){const n=e[((3&r)<<2)+t%4];this.bitmap.data[i]=Math.min(this.bitmap.data[i]+n,255),this.bitmap.data[i+1]=Math.min(this.bitmap.data[i+1]+n,255),this.bitmap.data[i+2]=Math.min(this.bitmap.data[i+2]+n,255)})),h(t)&&t.call(this,null,this),this}var Ne=__webpack_require__(8834).lW;function Fe(t,e,r){if("boolean"!=typeof t||"boolean"!=typeof e)return l.call(this,"horizontal and vertical must be Booleans",r);const i=Ne.alloc(this.bitmap.data.length);return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(r,n,a){const o=t?this.bitmap.width-1-r:r,s=e?this.bitmap.height-1-n:n,h=this.bitmap.width*s+o<<2,l=this.bitmap.data.readUInt32BE(a);i.writeUInt32BE(l,h)})),this.bitmap.data=Ne.from(i),h(r)&&r.call(this,null,this),this}function je(){const t={r:new Array(256).fill(0),g:new Array(256).fill(0),b:new Array(256).fill(0)};return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,r,i){t.r[this.bitmap.data[i+0]]++,t.g[this.bitmap.data[i+1]]++,t.b[this.bitmap.data[i+2]]++})),t}const Ge=function(t,e,r){return 255*(t-e)/(r-e)},He=function(t){return[t.findIndex((t=>t>0)),255-t.slice().reverse().findIndex((t=>t>0))]};var We=__webpack_require__(8058),qe=__webpack_require__.n(We);function Ze(t,e){let r=0;for(let i=0;i{const i=[...a,e].join(" "),s=Ze(t,i);s<=r&&!e.includes("\n")?(s>o&&(o=s),a.push(e)):(n.push(a),a=[e.replace("\n","")])})),n.push(a),{lines:n,longestLine:o}}function Ve(t,e,r){const{lines:i}=Ye(t,e,r);return i.length*t.common.lineHeight}function Xe(t,e,r,i,n){if(n.width>0&&n.height>0){const a=e.pages[n.page];t.blit(a,r+n.xoffset,i+n.yoffset,n.x,n.y,n.width,n.height)}return t}function Je(t,e,r,i,n){for(let a=0;a0&&this.heightOriginal>0&&this.targetWidth>0&&this.targetHeight>0))throw new Error("Invalid settings specified for the resizer.");this.configurePasses()},Ke.prototype.configurePasses=function(){this.widthOriginal===this.targetWidth?this.resizeWidth=this.bypassResizer:(this.ratioWeightWidthPass=this.widthOriginal/this.targetWidth,this.ratioWeightWidthPass<1&&this.interpolationPass?(this.initializeFirstPassBuffers(!0),this.resizeWidth=4===this.colorChannels?this.resizeWidthInterpolatedRGBA:this.resizeWidthInterpolatedRGB):(this.initializeFirstPassBuffers(!1),this.resizeWidth=4===this.colorChannels?this.resizeWidthRGBA:this.resizeWidthRGB)),this.heightOriginal===this.targetHeight?this.resizeHeight=this.bypassResizer:(this.ratioWeightHeightPass=this.heightOriginal/this.targetHeight,this.ratioWeightHeightPass<1&&this.interpolationPass?(this.initializeSecondPassBuffers(!0),this.resizeHeight=this.resizeHeightInterpolated):(this.initializeSecondPassBuffers(!1),this.resizeHeight=4===this.colorChannels?this.resizeHeightRGBA:this.resizeHeightRGB))},Ke.prototype._resizeWidthInterpolatedRGBChannels=function(t,e){const r=e?4:3,i=this.ratioWeightWidthPass,n=this.widthBuffer;let a,o,s=0,h=0,l=0,f=0,u=0;for(a=0;s<1/3;a+=r,s+=i)for(h=a,l=0;h=u)){d+=f;break}c+=r,d=c,f-=u}while(f>0&&c=h)){f+=s;break}l=d,f=l,s-=h}while(s>0&&l3&&(this.outputWidthWorkBenchOpaquePixelsCount=this.generateFloat64Buffer(this.heightOriginal)))},Ke.prototype.initializeSecondPassBuffers=function(t){this.heightBuffer=this.generateUint8Buffer(this.finalResultSize),t||(this.outputHeightWorkBench=this.generateFloatBuffer(this.targetWidthMultipliedByChannels),this.colorChannels>3&&(this.outputHeightWorkBenchOpaquePixelsCount=this.generateFloat64Buffer(this.targetWidth)))},Ke.prototype.generateFloatBuffer=function(t){try{return new Float32Array(t)}catch(t){return[]}},Ke.prototype.generateFloat64Buffer=function(t){try{return new Float64Array(t)}catch(t){return[]}},Ke.prototype.generateUint8Buffer=function(t){try{return new Uint8Array(t)}catch(t){return[]}};const $e=Ke;var tr=__webpack_require__(8834).lW;const er={nearestNeighbor(t,e){const r=t.width,i=t.height,n=e.width,a=e.height,o=t.data,s=e.data;for(let t=0;t0?n[e-4]:2*n[e]-n[e+4],f=n[e],u=n[e+4],c=a0?p[e-4*u]:2*p[e]-p[e+4*u],l=p[e],f=p[e+4*u],c=n1)for(let t=0;t=0&&a.x=0&&a.y({blit(t,e,r,i,n,a,o,s){if(!(t instanceof this.constructor))return l.call(this,"The source must be a Jimp image",s);if("number"!=typeof e||"number"!=typeof r)return l.call(this,"x and y must be numbers",s);if("function"==typeof i)s=i,i=0,n=0,a=t.bitmap.width,o=t.bitmap.height;else{if(typeof i!=typeof n||typeof n!=typeof a||typeof a!=typeof o)return l.call(this,"srcx, srcy, srcw, srch must be numbers",s);i=i||0,n=n||0,a=a||t.bitmap.width,o=o||t.bitmap.height}e=Math.round(e),r=Math.round(r),i=Math.round(i),n=Math.round(n),a=Math.round(a),o=Math.round(o);const f=this.bitmap.width,u=this.bitmap.height,c=this;return t.scanQuiet(i,n,a,o,(function(t,a,o){const s=e+t-i,h=r+a-n;if(s>=0&&h>=0&&f-s>0&&u-h>0){const t=c.getPixelIndex(s,h),e={r:this.bitmap.data[o],g:this.bitmap.data[o+1],b:this.bitmap.data[o+2],a:this.bitmap.data[o+3]},r={r:c.bitmap.data[t],g:c.bitmap.data[t+1],b:c.bitmap.data[t+2],a:c.bitmap.data[t+3]};c.bitmap.data[t]=(e.a*(e.r-r.r)-r.r+255>>8)+r.r,c.bitmap.data[t+1]=(e.a*(e.g-r.g)-r.g+255>>8)+r.g,c.bitmap.data[t+2]=(e.a*(e.b-r.b)-r.b+255>>8)+r.b,c.bitmap.data[t+3]=this.constructor.limit255(r.a+e.a)}})),h(s)&&s.call(this,null,this),this}}),()=>({blur(t,e){if("number"!=typeof t)return l.call(this,"r must be a number",e);if(t<1)return l.call(this,"r must be greater than 0",e);let r,i,n,a,o,s,f,u,c,d,p,m,g,b;const _=this.bitmap.width-1,y=this.bitmap.height-1,w=t+1,v=Be[t],x=Te[t],E=[],k=[],S=[],M=[],A=[],I=[];let B=2;for(;B-- >0;){for(m=0,g=0,s=0;s_?_:f)<<2),r+=this.bitmap.data[u++],i+=this.bitmap.data[u++],n+=this.bitmap.data[u++],a+=this.bitmap.data[u];for(o=0;o0?u<<2:0),c=g+A[o],d=g+I[o],r+=this.bitmap.data[c++]-this.bitmap.data[d++],i+=this.bitmap.data[c++]-this.bitmap.data[d++],n+=this.bitmap.data[c++]-this.bitmap.data[d++],a+=this.bitmap.data[c]-this.bitmap.data[d],m++;g+=this.bitmap.width<<2}for(o=0;oy?0:this.bitmap.width,r+=E[p],i+=k[p],n+=S[p],a+=M[p];for(m=o<<2,s=0;s>>x,this.bitmap.data[m+3]=b,b>255&&(this.bitmap.data[m+3]=255),b>0?(b=255/b,this.bitmap.data[m]=(r*v>>>x)*b,this.bitmap.data[m+1]=(i*v>>>x)*b,this.bitmap.data[m+2]=(n*v>>>x)*b):(this.bitmap.data[m+2]=0,this.bitmap.data[m+1]=0,this.bitmap.data[m]=0),0===o&&(A[s]=((u=s+w)0?u*this.bitmap.width:0),c=o+A[s],d=o+I[s],r+=E[c]-E[d],i+=k[c]-k[d],n+=S[c]-S[d],a+=M[c]-M[d],m+=this.bitmap.width<<2}}return h(e)&&e.call(this,null,this),this}}),()=>({circle(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(e=t,t={});const r=t.radius||(this.bitmap.width>this.bitmap.height?this.bitmap.height:this.bitmap.width)/2,i="number"==typeof t.x?t.x:this.bitmap.width/2,n="number"==typeof t.y?t.y:this.bitmap.height/2;return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,e,a){const o=Math.sqrt(Math.pow(t-i,2)+Math.pow(e-n,2));r-o<=0?this.bitmap.data[a+3]=0:r-o<1&&(this.bitmap.data[a+3]=255*(r-o))})),h(e)&&e.call(this,null,this),this}}),()=>({brightness(t,e){return"number"!=typeof t?l.call(this,"val must be numbers",e):t<-1||t>1?l.call(this,"val must be a number between -1 and +1",e):(this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,r,i){t<0?(this.bitmap.data[i]*=1+t,this.bitmap.data[i+1]*=1+t,this.bitmap.data[i+2]*=1+t):(this.bitmap.data[i]+=(255-this.bitmap.data[i])*t,this.bitmap.data[i+1]+=(255-this.bitmap.data[i+1])*t,this.bitmap.data[i+2]+=(255-this.bitmap.data[i+2])*t)})),h(e)&&e.call(this,null,this),this)},contrast(t,e){if("number"!=typeof t)return l.call(this,"val must be numbers",e);if(t<-1||t>1)return l.call(this,"val must be a number between -1 and +1",e);const r=(t+1)/(1-t);function i(t){return(t=Math.floor(r*(t-127)+127))<0?0:t>255?255:t}return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,e,r){this.bitmap.data[r]=i(this.bitmap.data[r]),this.bitmap.data[r+1]=i(this.bitmap.data[r+1]),this.bitmap.data[r+2]=i(this.bitmap.data[r+2])})),h(e)&&e.call(this,null,this),this},posterize(t,e){return"number"!=typeof t?l.call(this,"n must be numbers",e):(t<2&&(t=2),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,r,i){this.bitmap.data[i]=Math.floor(this.bitmap.data[i]/255*(t-1))/(t-1)*255,this.bitmap.data[i+1]=Math.floor(this.bitmap.data[i+1]/255*(t-1))/(t-1)*255,this.bitmap.data[i+2]=Math.floor(this.bitmap.data[i+2]/255*(t-1))/(t-1)*255})),h(e)&&e.call(this,null,this),this)},greyscale:Le,grayscale:Le,opacity(t,e){return"number"!=typeof t?l.call(this,"f must be a number",e):t<0||t>1?l.call(this,"f must be a number from 0 to 1",e):(this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(e,r,i){const n=this.bitmap.data[i+3]*t;this.bitmap.data[i+3]=n})),h(e)&&e.call(this,null,this),this)},sepia(t){return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,e,r){let i=this.bitmap.data[r],n=this.bitmap.data[r+1],a=this.bitmap.data[r+2];i=.393*i+.769*n+.189*a,n=.349*i+.686*n+.168*a,a=.272*i+.534*n+.131*a,this.bitmap.data[r]=i<255?i:255,this.bitmap.data[r+1]=n<255?n:255,this.bitmap.data[r+2]=a<255?a:255})),h(t)&&t.call(this,null,this),this},fade(t,e){return"number"!=typeof t?l.call(this,"f must be a number",e):t<0||t>1?l.call(this,"f must be a number from 0 to 1",e):(this.opacity(1-t),h(e)&&e.call(this,null,this),this)},convolution(t,e,r){"function"==typeof e&&void 0===r&&(r=e,e=null),e||(e=this.constructor.EDGE_EXTEND);const i=Re.from(this.bitmap.data),n=t.length,a=t[0].length,o=Math.floor(n/2),s=Math.floor(a/2),l=-o,f=-s;let u,c,d,p,m,g,b,_,y,w;return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(r,n,a){p=0,d=0,c=0;for(let i=l;i<=o;i++)for(let a=f;a<=s;a++)_=r+a,y=n+i,u=t[i+o][a+s],w=this.getPixelIndex(_,y,e),-1===w?(b=0,g=0,m=0):(m=this.bitmap.data[w+0],g=this.bitmap.data[w+1],b=this.bitmap.data[w+2]),c+=u*m,d+=u*g,p+=u*b;c<0&&(c=0),d<0&&(d=0),p<0&&(p=0),c>255&&(c=255),d>255&&(d=255),p>255&&(p=255),i[a+0]=c,i[a+1]=d,i[a+2]=p})),this.bitmap.data=i,h(r)&&r.call(this,null,this),this},opaque(t){return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,e,r){this.bitmap.data[r+3]=255})),h(t)&&t.call(this,null,this),this},pixelate(t,e,r,i,n,a){if("function"==typeof e)a=e,n=null,i=null,r=null,e=null;else{if("number"!=typeof t)return l.call(this,"size must be a number",a);if(Oe(e)&&"number"!=typeof e)return l.call(this,"x must be a number",a);if(Oe(r)&&"number"!=typeof r)return l.call(this,"y must be a number",a);if(Oe(i)&&"number"!=typeof i)return l.call(this,"w must be a number",a);if(Oe(n)&&"number"!=typeof n)return l.call(this,"h must be a number",a)}const o=[[1/16,2/16,1/16],[2/16,.25,2/16],[1/16,2/16,1/16]];e=e||0,r=r||0,i=Oe(i)?i:this.bitmap.width-e,n=Oe(n)?n:this.bitmap.height-r;const s=this.cloneQuiet();return this.scanQuiet(e,r,i,n,(function(e,r,i){e=t*Math.floor(e/t),r=t*Math.floor(r/t);const n=Pe(s,o,e,r);this.bitmap.data[i]=n[0],this.bitmap.data[i+1]=n[1],this.bitmap.data[i+2]=n[2]})),h(a)&&a.call(this,null,this),this},convolute(t,e,r,i,n,a){if(!Array.isArray(t))return l.call(this,"the kernel must be an array",a);if("function"==typeof e)a=e,e=null,r=null,i=null,n=null;else{if(Oe(e)&&"number"!=typeof e)return l.call(this,"x must be a number",a);if(Oe(r)&&"number"!=typeof r)return l.call(this,"y must be a number",a);if(Oe(i)&&"number"!=typeof i)return l.call(this,"w must be a number",a);if(Oe(n)&&"number"!=typeof n)return l.call(this,"h must be a number",a)}e=Oe(e)?e:0,r=Oe(r)?r:0,i=Oe(i)?i:this.bitmap.width-e,n=Oe(n)?n:this.bitmap.height-r;const o=this.cloneQuiet();return this.scanQuiet(e,r,i,n,(function(e,r,i){const n=Pe(o,t,e,r);this.bitmap.data[i]=this.constructor.limit255(n[0]),this.bitmap.data[i+1]=this.constructor.limit255(n[1]),this.bitmap.data[i+2]=this.constructor.limit255(n[2])})),h(a)&&a.call(this,null,this),this},color:Ue,colour:Ue}),()=>({contain(t,e,r,i,n){if("number"!=typeof t||"number"!=typeof e)return l.call(this,"w and h must be numbers",n);"string"==typeof r&&("function"==typeof i&&void 0===n&&(n=i),i=r,r=null),"function"==typeof r&&(void 0===n&&(n=r),i=null,r=null),"function"==typeof i&&void 0===n&&(n=i,i=null);const a=7&(r=r||this.constructor.HORIZONTAL_ALIGN_CENTER|this.constructor.VERTICAL_ALIGN_MIDDLE),o=r>>3;if((0===a||a&a-1)&&(0===o||o&o-1))return l.call(this,"only use one flag per alignment direction",n);const s=a>>1,f=o>>1,u=t/e>this.bitmap.width/this.bitmap.height?e/this.bitmap.height:t/this.bitmap.width,c=this.cloneQuiet().scale(u,i);return this.resize(t,e,i),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,e,r){this.bitmap.data.writeUInt32BE(this._background,r)})),this.blit(c,(this.bitmap.width-c.bitmap.width)/2*s,(this.bitmap.height-c.bitmap.height)/2*f),h(n)&&n.call(this,null,this),this}}),()=>({cover(t,e,r,i,n){if("number"!=typeof t||"number"!=typeof e)return l.call(this,"w and h must be numbers",n);r&&"function"==typeof r&&void 0===n?(n=r,r=null,i=null):"function"==typeof i&&void 0===n&&(n=i,i=null);const a=7&(r=r||this.constructor.HORIZONTAL_ALIGN_CENTER|this.constructor.VERTICAL_ALIGN_MIDDLE),o=r>>3;if((0===a||a&a-1)&&(0===o||o&o-1))return l.call(this,"only use one flag per alignment direction",n);const s=a>>1,f=o>>1,u=t/e>this.bitmap.width/this.bitmap.height?t/this.bitmap.width:e/this.bitmap.height;return this.scale(u,i),this.crop((this.bitmap.width-t)/2*s,(this.bitmap.height-e)/2*f,t,e),h(n)&&n.call(this,null,this),this}}),function(t){return t("crop",(function(t,e,r,i,n){if("number"!=typeof t||"number"!=typeof e)return l.call(this,"x and y must be numbers",n);if("number"!=typeof r||"number"!=typeof i)return l.call(this,"w and h must be numbers",n);if(t=Math.round(t),e=Math.round(e),r=Math.round(r),i=Math.round(i),0===t&&r===this.bitmap.width){const n=r*e+t<<2,a=n+(i*r<<2);this.bitmap.data=this.bitmap.data.slice(n,a)}else{const n=ze.allocUnsafe(r*i*4);let a=0;this.scanQuiet(t,e,r,i,(function(t,e,r){const i=this.bitmap.data.readUInt32BE(r,!0);n.writeUInt32BE(i,a,!0),a+=4})),this.bitmap.data=n}return this.bitmap.width=r,this.bitmap.height=i,h(n)&&n.call(this,null,this),this})),{class:{autocrop(){const t=this.bitmap.width,e=this.bitmap.height;let r,i=0,n=2e-4,a=!0,o=!1,s={north:!1,south:!1,east:!1,west:!1};for(var l=arguments.length,f=new Array(l),u=0;un)break t}p++}if(c=this.getPixelColor(t,0),!s.west)t:for(let r=0;rn)break t}b++}if(c=this.getPixelColor(0,e),!s.south)t:for(let r=e-1;r>=p+1;r--){for(let e=t-m-1;e>=0;e--){const t=this.getPixelColor(e,r),i=this.constructor.intToRGBA(t);if(this.constructor.colorDiff(d,i)>n)break t}g++}if(c=this.getPixelColor(t,e),!s.east)t:for(let r=t-1;r>=0+b+1;r--){for(let t=e-1;t>=0+p;t--){const e=this.getPixelColor(r,t),i=this.constructor.intToRGBA(e);if(this.constructor.colorDiff(d,i)>n)break t}m++}let _=!1;if(b-=i,m-=i,p-=i,g-=i,o){const t=Math.min(m,b),e=Math.min(p,g);b=t,m=t,p=e,g=e}b=b>=0?b:0,m=m>=0?m:0,p=p>=0?p:0,g=g>=0?g:0;const y=t-(b+m),w=e-(g+p);return _=a?0!==m&&0!==p&&0!==b&&0!==g:0!==m||0!==p||0!==b||0!==g,_&&this.crop(b,p,y,w),h(r)&&r.call(this,null,this),this}}}},()=>({displace(t,e,r){if("object"!=typeof t||t.constructor!==this.constructor)return l.call(this,"The source must be a Jimp image",r);if("number"!=typeof e)return l.call(this,"factor must be a number",r);const i=this.cloneQuiet();return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(r,n,a){let o=t.bitmap.data[a]/256*e;o=Math.round(o);const s=this.getPixelIndex(r+o,n);this.bitmap.data[s]=i.bitmap.data[a],this.bitmap.data[s+1]=i.bitmap.data[a+1],this.bitmap.data[s+2]=i.bitmap.data[a+2]})),h(r)&&r.call(this,null,this),this}}),()=>({dither565:De,dither16:De}),()=>({fisheye(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{r:2.5},e=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(e=t,t={r:2.5});const r=this.cloneQuiet(),{width:i,height:n}=r.bitmap;return r.scanQuiet(0,0,i,n,((e,a)=>{const o=e/i,s=a/n,h=Math.sqrt(Math.pow(o-.5,2)+Math.pow(s-.5,2)),l=2*Math.pow(h,t.r),f=(o-.5)/h,u=(s-.5)/h,c=Math.round((l*f+.5)*i),d=Math.round((l*u+.5)*n),p=r.getPixelColor(c,d);this.setPixelColor(p,e,a)})),this.setPixelColor(r.getPixelColor(i/2,n/2),i/2,n/2),h(e)&&e.call(this,null,this),this}}),()=>({flip:Fe,mirror:Fe}),()=>({gaussian(t,e){if("number"!=typeof t)return l.call(this,"r must be a number",e);if(t<1)return l.call(this,"r must be greater than 0",e);const r=Math.ceil(2.57*t),i=2*r+1,n=t*t*2,a=n*Math.PI,o=[];for(let t=0;t({invert(t){return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,e,r){this.bitmap.data[r]=255-this.bitmap.data[r],this.bitmap.data[r+1]=255-this.bitmap.data[r+1],this.bitmap.data[r+2]=255-this.bitmap.data[r+2]})),h(t)&&t.call(this,null,this),this}}),()=>({mask(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3?arguments[3]:void 0;if(!(t instanceof this.constructor))return l.call(this,"The source must be a Jimp image",i);if("number"!=typeof e||"number"!=typeof r)return l.call(this,"x and y must be numbers",i);e=Math.round(e),r=Math.round(r);const n=this.bitmap.width,a=this.bitmap.height,o=this;return t.scanQuiet(0,0,t.bitmap.width,t.bitmap.height,(function(t,i,s){const h=e+t,l=r+i;if(h>=0&&l>=0&&h({normalize(t){const e=je.call(this),r={r:He(e.r),g:He(e.g),b:He(e.b)};return this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,(function(t,e,i){const n=this.bitmap.data[i+0],a=this.bitmap.data[i+1],o=this.bitmap.data[i+2];this.bitmap.data[i+0]=Ge(n,r.r[0],r.r[1]),this.bitmap.data[i+1]=Ge(a,r.g[0],r.g[1]),this.bitmap.data[i+2]=Ge(o,r.b[0],r.b[1])})),h(t)&&t.call(this,null,this),this}}),()=>({constants:{measureText:Ze,measureTextHeight:Ve,FONT_SANS_8_BLACK:a().join(Qe,"fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt"),FONT_SANS_10_BLACK:a().join(Qe,"fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt"),FONT_SANS_12_BLACK:a().join(Qe,"fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt"),FONT_SANS_14_BLACK:a().join(Qe,"fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt"),FONT_SANS_16_BLACK:a().join(Qe,"fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt"),FONT_SANS_32_BLACK:a().join(Qe,"fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt"),FONT_SANS_64_BLACK:a().join(Qe,"fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt"),FONT_SANS_128_BLACK:a().join(Qe,"fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt"),FONT_SANS_8_WHITE:a().join(Qe,"fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt"),FONT_SANS_16_WHITE:a().join(Qe,"fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt"),FONT_SANS_32_WHITE:a().join(Qe,"fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt"),FONT_SANS_64_WHITE:a().join(Qe,"fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt"),FONT_SANS_128_WHITE:a().join(Qe,"fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt"),loadFont(t,e){return"string"!=typeof t?l.call(this,"file must be a string",e):new Promise(((r,i)=>{e=e||function(t,e){t?i(t):r(e)},qe()(t,((r,i)=>{const n={},o={};if(r)return l.call(this,r,e);for(let t=0;tt.read(e+"/"+r)));return Promise.all(i)})(this,a().dirname(t),i.pages).then((t=>{e(null,{chars:n,kernings:o,pages:t,common:i.common,info:i.info})}))}))}))}},class:{print(t,e,r,i,n,a,o){if("function"==typeof n&&void 0===o&&(o=n,n=1/0),void 0===n&&(n=1/0),"function"==typeof a&&void 0===o&&(o=a,a=1/0),void 0===a&&(a=1/0),"object"!=typeof t)return l.call(this,"font must be a Jimp loadFont",o);if("number"!=typeof e||"number"!=typeof r||"number"!=typeof n)return l.call(this,"x, y and maxWidth must be numbers",o);if("number"!=typeof n)return l.call(this,"maxWidth must be a number",o);if("number"!=typeof a)return l.call(this,"maxHeight must be a number",o);let s,f;"object"==typeof i&&null!==i.text&&void 0!==i.text?(s=i.alignmentX||this.constructor.HORIZONTAL_ALIGN_LEFT,f=i.alignmentY||this.constructor.VERTICAL_ALIGN_TOP,({text:i}=i)):(s=this.constructor.HORIZONTAL_ALIGN_LEFT,f=this.constructor.VERTICAL_ALIGN_TOP,i=i.toString()),a!==1/0&&f===this.constructor.VERTICAL_ALIGN_BOTTOM?r+=a-Ve(t,i,n):a!==1/0&&f===this.constructor.VERTICAL_ALIGN_MIDDLE&&(r+=a/2-Ve(t,i,n)/2);const u=Object.entries(t.chars)[0][1].xadvance,{lines:c,longestLine:d}=Ye(t,i,n);return c.forEach((i=>{const a=i.join(" "),o=function(t,e,r,i,n){return n===t.HORIZONTAL_ALIGN_LEFT?0:n===t.HORIZONTAL_ALIGN_CENTER?(i-Ze(e,r))/2:i-Ze(e,r)}(this.constructor,t,a,n,s);Je.call(this,t,e+o,r,a,u),r+=t.common.lineHeight})),h(o)&&o.call(this,null,this,{x:e+d,y:r}),this}}}),()=>({constants:{RESIZE_NEAREST_NEIGHBOR:"nearestNeighbor",RESIZE_BILINEAR:"bilinearInterpolation",RESIZE_BICUBIC:"bicubicInterpolation",RESIZE_HERMITE:"hermiteInterpolation",RESIZE_BEZIER:"bezierInterpolation"},class:{resize(t,e,r,i){if("number"!=typeof t||"number"!=typeof e)return l.call(this,"w and h must be numbers",i);if("function"==typeof r&&void 0===i&&(i=r,r=null),t===this.constructor.AUTO&&e===this.constructor.AUTO)return l.call(this,"w and h cannot both be set to auto",i);if(t===this.constructor.AUTO&&(t=this.bitmap.width*(e/this.bitmap.height)),e===this.constructor.AUTO&&(e=this.bitmap.height*(t/this.bitmap.width)),t<0||e<0)return l.call(this,"w and h must be positive numbers",i);if(t=Math.round(t)||1,e=Math.round(e)||1,"function"==typeof rr[r]){const i={data:ir.alloc(t*e*4),width:t,height:e};rr[r](this.bitmap,i),this.bitmap=i}else{const r=this;new $e(this.bitmap.width,this.bitmap.height,t,e,!0,!0,(i=>{r.bitmap.data=ir.from(i),r.bitmap.width=t,r.bitmap.height=e})).resize(this.bitmap.data)}return h(i)&&i.call(this,null,this),this}}}),()=>({rotate(t,e,r){return null==e&&(e=!0),"function"==typeof e&&void 0===r&&(r=e,e=!0),"number"!=typeof t?l.call(this,"deg must be a number",r):"boolean"!=typeof e&&"string"!=typeof e?l.call(this,"mode must be a boolean or a string",r):(t%90!=0||!e&&this.bitmap.width!==this.bitmap.height&&t%180!=0?or.call(this,t,e,r):ar.call(this,t),h(r)&&r.call(this,null,this),this)}}),()=>({scale(t,e,r){if("number"!=typeof t)return l.call(this,"f must be a number",r);if(t<0)return l.call(this,"f must be a positive number",r);"function"==typeof e&&void 0===r&&(r=e,e=null);const i=this.bitmap.width*t,n=this.bitmap.height*t;return this.resize(i,n,e),h(r)&&r.call(this,null,this),this},scaleToFit(t,e,r,i){if("number"!=typeof t||"number"!=typeof e)return l.call(this,"w and h must be numbers",i);"function"==typeof r&&void 0===i&&(i=r,r=null);const n=t/e>this.bitmap.width/this.bitmap.height?e/this.bitmap.height:t/this.bitmap.width;return this.scale(n,r),h(i)&&i.call(this,null,this),this}}),()=>({shadow(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;"function"==typeof t&&(e=t,t={});const{opacity:r=.7,size:i=1.1,x:n=-25,y:a=25,blur:o=5}=t,s=this.clone(),l=this.clone();return l.scan(0,0,l.bitmap.width,l.bitmap.height,((t,e,i)=>{l.bitmap.data[i]=0,l.bitmap.data[i+1]=0,l.bitmap.data[i+2]=0,l.bitmap.data[i+3]=l.constructor.limit255(l.bitmap.data[i+3]*r),this.bitmap.data[i]=0,this.bitmap.data[i+1]=0,this.bitmap.data[i+2]=0,this.bitmap.data[i+3]=0})),l.resize(l.bitmap.width*i,l.bitmap.height*i).blur(o),this.composite(l,n,a),this.composite(s,0,0),h(e)&&e.call(this,null,this),this}}),()=>({threshold(t,e){let{max:r,replace:i=255,autoGreyscale:n=!0}=t;return"number"!=typeof r?l.call(this,"max must be a number",e):"number"!=typeof i?l.call(this,"replace must be a number",e):"boolean"!=typeof n?l.call(this,"autoGreyscale must be a boolean",e):(r=this.constructor.limit255(r),i=this.constructor.limit255(i),n&&this.greyscale(),this.scanQuiet(0,0,this.bitmap.width,this.bitmap.height,((t,e,n)=>{const a=this.bitmap.data[n]1&&void 0!==arguments[1]?arguments[1]:oe;const r={hasAlpha:{},encoders:{},decoders:{},class:{},constants:{}};function i(t){Object.entries(t).forEach((t=>{let[e,i]=t;r[e]={...r[e],...i}}))}t.types&&(t.types.forEach((function(t){const e=t();Array.isArray(e.mime)?Ct(...e.mime):Object.entries(e.mime).forEach((t=>Ct(...t))),delete e.mime,i(e)})),e.decoders={...e.decoders,...r.decoders},e.encoders={...e.encoders,...r.encoders},e.hasAlpha={...e.hasAlpha,...r.hasAlpha}),t.plugins&&t.plugins.forEach((function(t){const e=t(ae)||{};e.class||e.constants?i(e):i({class:e})})),ie(r.class,e),re(r.constants,e)}({types:[()=>(0,se.Ee)(ue(),pe(),{mime:{[be]:["bmp"]},constants:{MIME_BMP:be,MIME_X_MS_BMP:_e},decoders:{[be]:ye,[_e]:ye},encoders:{[be]:we,[_e]:we}},{mime:{[ke]:["tiff","tif"]},constants:{MIME_TIFF:ke},decoders:{[ke]:t=>{const e=xe().decode(t),r=e[0];e.forEach((e=>{xe().decodeImage(t,e)}));const i=xe().toRGBA8(r);return{data:Ee.from(i),width:r.t256[0],height:r.t257[0]}}},encoders:{[ke]:t=>{const e=xe().encodeImage(t.bitmap.data,t.bitmap.width,t.bitmap.height);return Ee.from(e)}}},{mime:{[Ie]:["gif"]},constants:{MIME_GIF:Ie},decoders:{[Ie]:t=>{const e=new Se.N(t),r=Ae.alloc(e.width*e.height*4);return e.decodeAndBlitFrameRGBA(0,r),{data:r,width:e.width,height:e.height}}},encoders:{[Ie]:t=>{const e=new Me.BitmapImage(t.bitmap);Me.GifUtil.quantizeDekker(e,256);const r=new Me.GifFrame(e);return(new Me.GifCodec).encodeGif([r],{}).then((t=>t.buffer))}}})],plugins:[t=>{const e=sr.map((e=>{let r=e(t)||{};return r.class||r.constants||(r={class:r}),r}));return(0,se.Ee)(...e)}]})})()})(); +//# sourceMappingURL=jimp.js.map \ No newline at end of file diff --git a/project starter code/node_modules/jimp/browser/lib/jimp.js.LICENSE.txt b/project starter code/node_modules/jimp/browser/lib/jimp.js.LICENSE.txt new file mode 100644 index 00000000..b0ed320f --- /dev/null +++ b/project starter code/node_modules/jimp/browser/lib/jimp.js.LICENSE.txt @@ -0,0 +1,277 @@ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ + +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ + +/*! + * Timm + * + * Immutability helpers with fast reads and acceptable writes. + * + * @copyright Guillermo Grau Panea 2016 + * @license MIT + */ + +/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ + +/*! safe-buffer. MIT License. Feross Aboukhadijeh */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * cie94.ts - part of Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * ciede2000.ts - part of Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * cmetric.ts - part of Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * common.ts - part of Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * constants.ts - part of Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * ditherErrorDiffusionArray.ts - part of Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * euclidean.ts - part of Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * helper.ts - part of Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * hueStatistics.ts - part of Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * iq.ts - Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * lab2rgb.ts - part of Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * lab2xyz.ts - part of Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * manhattanNeuQuant.ts - part of Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * nearestColor.ts - part of Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * palette.ts - part of Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * pngQuant.ts - part of Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * point.ts - part of Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * pointContainer.ts - part of Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * rgb2hsl.ts - part of Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * rgb2lab.ts - part of Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * rgb2xyz.ts - part of Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * ssim.ts - part of Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * wuQuant.ts - part of Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * xyz2lab.ts - part of Image Quantization Library + */ + +/** + * @preserve + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * xyz2rgb.ts - part of Image Quantization Library + */ + +/** + * @preserve + * MIT License + * + * Copyright 2015-2018 Igor Bezkrovnyi + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * riemersma.ts - part of Image Quantization Library + */ + +/** + * @preserve TypeScript port: + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * colorHistogram.ts - part of Image Quantization Library + */ + +/** + * @preserve TypeScript port: + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * neuquant.ts - part of Image Quantization Library + */ + +/** + * @preserve TypeScript port: + * Copyright 2015-2018 Igor Bezkrovnyi + * All rights reserved. (MIT Licensed) + * + * rgbquant.ts - part of Image Quantization Library + */ diff --git a/project starter code/node_modules/jimp/browser/lib/jimp.js.map b/project starter code/node_modules/jimp/browser/lib/jimp.js.map new file mode 100644 index 00000000..b88b007a --- /dev/null +++ b/project starter code/node_modules/jimp/browser/lib/jimp.js.map @@ -0,0 +1 @@ +{"version":3,"file":"jimp.js","mappings":";6CAAA,IAAIA,EAAY,EAAQ,MAUxB,SAASC,EAAQC,EAAaC,GAC1B,IAAIC,EAAY,IAAIJ,EAAUE,EAAaC,GAQ3C,OAAO,SAAUE,GACb,OAAOD,EAAUE,QAAQD,EAC7B,CACJ,CAEAJ,EAAQM,IAAM,KACdN,EAAQO,IAAM,WACdP,EAAQQ,IAAM,aACdR,EAAQS,IAAM,mBAEdC,EAAOC,QAAUX,yBCpBjB,SAASD,EAAUE,EAAaC,GAC5B,KAAKD,GAAgBC,GAAgBD,EAAYW,QAAWV,EAAYU,QACpE,MAAM,IAAIC,MAAM,gBAEpBC,KAAKb,YAAcA,EACnBa,KAAKZ,YAAcA,CACvB,CASAH,EAAUgB,UAAUV,QAAU,SAASD,GACnC,IAAIY,EAAGC,EAAQC,EACfC,EAAY,CAAC,EACbC,EAAWN,KAAKb,YAAYW,OAC5BS,EAASP,KAAKZ,YAAYU,OAC1BA,EAASR,EAAOQ,OAChBU,EAA2B,iBAAXlB,EAAsB,GAAK,GAE3C,IAAKU,KAAKS,QAAQnB,GACd,MAAM,IAAIS,MAAM,WAAaT,EAAS,wCAA0CU,KAAKb,YAAc,KAGvG,GAAIa,KAAKb,cAAgBa,KAAKZ,YAC1B,OAAOE,EAGX,IAAKY,EAAI,EAAGA,EAAIJ,EAAQI,IACpBG,EAAUH,GAAKF,KAAKb,YAAYuB,QAAQpB,EAAOY,IAEnD,EAAG,CAGC,IAFAC,EAAS,EACTC,EAAS,EACJF,EAAI,EAAGA,EAAIJ,EAAQI,KACpBC,EAASA,EAASG,EAAWD,EAAUH,KACzBK,GACVF,EAAUD,KAAYO,SAASR,EAASI,EAAQ,I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EAAS,iBACT,GAAS,qBACT,IAAS,cACT,IAAS,iBACT,IAAS,aACT,IAAS,cACT,IAAS,gBACT,IAAS,cACT,IAAS,4BACT,IAAS,eACT,IAAS,YACT,IAAS,aACT,IAAS,YACT,IAAS,eACT,IAAS,mBACT,IAAS,OACT,IAAS,QACT,IAAS,eACT,IAAS,cACT,IAAS,kBACT,IAAS,eACT,IAAS,kBACT,IAAS,iBACT,IAAS,iBACT,IAAS,cACT,IAAS,cACT,IAAS,sBACT,IAAS,WACT,IAAS,YACT,IAAS,YACT,IAAS,cACT,IAAS,iBACT,IAAS,mBACT,IAAS,oBACT,IAAS,YACT,IAAS,YACT,IAAS,iBACT,IAAS,aACT,IAAS,oBACT,IAAS,mBACT,IAAS,WACT,IAAS,aACT,IAAS,SACT,IAAS,eACT,IAAS,YACT,IAAS,aACT,IAAS,wBACT,IAAS,WACT,IAAS,gBACT,IAAS,YACT,IAAS,aACT,IAAS,cACT,IAAS,iBACT,IAAS,cACT,IAAS,eACT,IAAS,yBACT,IAAS,SACT,IAAS,SACT,IAAS,WACT,IAAS,eACT,IAAS,WACT,IAAS,gBACT,IAAS,eACT,IAAS,eACT,IAAS,kBACT,IAAS,kBACT,IAAS,gBACT,IAAS,WACT,IAAS,iBACT,IAAS,iBACT,IAAS,UACT,IAAS,aACT,IAAS,WACT,IAAS,sBACT,IAAS,cACT,IAAS,aACT,IAAS,gBACT,IAAS,cACT,IAAS,aACT,IAAS,SACT,IAAS,oBACT,IAAS,aACT,IAAS,aACT,IAAS,WACT,IAAS,kBACT,IAAS,kBACT,IAAS,sBACT,IAAS,yBACT,IAAS,sBACT,IAAS,cACT,IAAS,eACT,IAAS,eACT,IAAS,oBACT,IAAS,mBACT,IAAS,mBACT,IAAS,sBACT,IAAS,iBACT,IAAS,mBACT,IAAS,qBACT,KAAS,yBACT,KAAS,oBACT,KAAS,qBACT,MAAS,SACT,MAAS,aACT,MAAS,aACT,MAAS,gBACT,MAAS,UACT,MAAS,WACT,MAAS,iBACT,MAAS,WACT,MAAS,WACT,MAAS,WACT,MAAS,WACT,MAAS,aACT,MAAS,YACT,MAAS,SACT,MAAS,sBACT,MAAS,cACT,MAAS,eACT,MAAS,WACT,MAAS,YACT,MAAS,eACT,MAAS,UACT,MAAS,YACT,MAAS,eACT,MAAS,eACT,MAAS,YACT,MAAS,eACT,MAAS,aACT,MAAS,aACT,MAAS,cACT,MAAS,aACT,MAAS,cACT,MAAS,iBACT,MAAS,UACT,MAAS,UACT,MAAS,UACT,MAAS,UACT,MAAS,WACT,MAAS,uBACT,MAAS,0BACT,MAAS,mBACT,MAAS,eACT,MAAS,gBACT,MAAS,OACT,MAAS,gBACT,MAAS,YACT,MAAS,gBACT,MAAS,mBACT,MAAS,2BACT,MAAS,aACT,MAAS,sBACT,MAAS,2BACT,MAAS,kBACT,MAAS,uBACT,MAAS,sBACT,MAAS,wBACT,MAAS,wBACT,MAAS,UACT,MAAS,gBACT,MAAS,iBACT,MAAS,UACT,MAAS,YACT,MAAS,wBACT,MAAS,iBACT,MAAS,gBACT,MAAS,WACT,MAAS,oBACT,MAAS,aACT,MAAS,cACT,MAAS,oBACT,MAAS,gBACT,MAAS,aACT,MAAS,aACT,MAAS,aACT,MAAS,mBACT,MAAS,sBACT,MAAS,qBACT,MAAS,kBACT,MAAS,sBACT,MAAS,UACT,MAAS,MACT,MAAS,0BACT,MAAS,YACT,MAAS,iBACT,MAAS,gBACT,MAAS,kBACT,MAAS,4BACT,MAAS,2BACT,MAAS,WACT,MAAS,sBACT,MAAS,sBACT,MAAS,gBACT,MAAS,gBACT,MAAS,cACT,MAAS,aACT,MAAS,cACT,MAAS,mBACT,MAAS,aACT,MAAS,0BACT,MAAS,yBACT,MAAS,oBACT,MAAS,gBACT,MAAS,kBACT,MAAS,uBACT,MAAS,mBACT,MAAS,kBACT,MAAS,eACT,MAAS,cACT,MAAS,QACT,MAAS,cACT,MAAS,cACT,MAAS,2BACT,MAAS,QACT,MAAS,wBACT,MAAS,wBACT,MAAS,2BACT,MAAS,cACT,MAAS,yBACT,MAAS,eACT,MAAS,cACT,MAAS,gBACT,MAAS,oBACT,MAAS,gBACT,MAAS,eACT,MAAS,YACT,MAAS,WACT,MAAS,UACT,MAAS,YACT,MAAS,cACT,MAAS,aACT,MAAS,qBACT,MAAS,sBACT,MAAS,iBACT,MAAS,uBACT,MAAS,yBACT,MAAS,kBACT,MAAS,UACT,MAAS,YACT,MAAS,WACT,MAAS,aACT,MAAS,YACT,MAAS,kBACT,MAAS,aACT,MAAS,iBACT,MAAS,kBACT,MAAS,mBACT,MAAS,gBACT,MAAS,cACT,MAAS,2BACT,MAAS,QACT,MAAS,wBACT,MAAS,wBACT,MAAS,2BACT,MAAS,cACT,MAAS,yBACT,MAAS,eACT,MAAS,kBACT,MAAS,gBACT,MAAS,oBACT,MAAS,gBACT,MAAS,aACT,MAAS,YACT,MAAS,aACT,MAAS,iBACT,MAAS,eACT,MAAS,eACT,MAAS,mBACT,MAAS,0BACT,MAAS,mBACT,MAAS,cACT,MAAS,WACT,MAAS,aACT,MAAS,YACT,MAAS,2BACT,MAAS,uBACT,MAAS,gBACT,MAAS,YACT,MAAS,eACT,MAAS,WACT,MAAS,WACT,MAAS,YACT,MAAS,mBACT,MAAS,eACT,MAAS,aACT,MAAS,QACT,MAAS,iBACT,MAAS,aACT,MAAS,aACT,MAAS,mBACT,MAAS,gBACT,MAAS,kBACT,MAAS,cACT,MAAS,iBACT,MAAS,eACT,MAAS,YACT,MAAS,aACT,MAAS,cACT,MAAS,kBACT,MAAS,mBACT,MAAS,cACT,MAAS,iBACT,MAAS,cACT,MAAS,iBACT,MAAS,mBACT,MAAS,mBACT,MAAS,iBACT,MAAS,yBACT,MAAS,cACT,MAAS,gBACT,MAAS,cACT,MAAS,UACT,MAAS,2BACT,MAAS,aACT,MAAS,qBACT,MAAS,oBACT,MAAS,uBACT,MAAS,gBACT,MAAS,YACT,MAAS,qBACT,MAAS,sBACT,MAAS,aACT,MAAS,mBACT,MAAS,mBACT,MAAS,aACT,MAAS,eACT,MAAS,oBACT,MAAS,kBACT,MAAS,eACT,MAAS,eACT,MAAS,qBACT,MAAS,qBACT,MAAS,mBACT,MAAS,mBACT,MAAS,gBACT,MAAS,gBACT,MAAS,gBACT,MAAS,mBACT,MAAS,gBACT,MAAS,oBACT,MAAS,kBACT,MAAS,sBACT,MAAS,qBACT,MAAS,cACT,MAAS,mBACT,MAAS,oBACT,MAAS,cACT,MAAS,iBACT,MAAS,kBACT,MAAS,uBACT,MAAS,yBACT,MAAS,yBACT,MAAS,mBACT,MAAS,kBACT,MAAS,qBACT,MAAS,sBACT,MAAS,sBACT,MAAS,aACT,MAAS,cACT,MAAS,mBACT,MAAS,yBACT,MAAS,oBACT,MAAS,0BACT,MAAS,wBACT,MAAS,iBACT,MAAS,kBACT,MAAS,uBACT,MAAS,wBACT,MAAS,aACT,MAAS,oBACT,MAAS,wBACT,MAAS,cACT,MAAS,uBACT,MAAS,wBACT,MAAS,wBACT,MAAS,mBACT,MAAS,qBACT,MAAS,mBACT,MAAS,iBACT,MAAS,iBACT,MAAS,yBACT,MAAS,4BACT,MAAS,sBACT,MAAS,wBACT,MAAS,oBACT,MAAS,kBACT,MAAS,iBACT,MAAS,wBACT,MAAS,mBACT,MAAS,sBACT,MAAS,uBACT,MAAS,uBACT,MAAS,cACT,MAAS,cACT,MAAS,cACT,MAAS,eACT,MAAS,YACT,MAAS,YACT,MAAS,QACT,MAAS,WACT,MAAS,2BACT,MAAS,0BACT,MAAS,0BACT,MAAS,cACT,MAAS,2BACT,MAAS,2BACT,MAAS,yBACT,MAAS,qBACT,MAAS,oBACT,MAAS,mBACT,MAAS,kBACT,MAAS,UACT,MAAS,eACT,KAAS,YACT,MAAS,eACT,MAAS,OACT,MAAS,UACT,MAAS,UACT,MAAS,YACT,MAAS,eACT,MAAS,WACT,MAAS,UACT,MAAS,aACT,MAAS,WACT,MAAS,aACT,MAAS,YACT,MAAS,aACT,MAAS,eAGVC,IAAM,CACL,EAAS,eACT,E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MACA,MACA,MACA,MACA,MACA,OACA,OACA,MACA,MACA,MACA,MACA,OACA,MACA,MACA,MACA,OACA,OACA,QACA,MACA,MACA,MACA,MACA,MACA,KACA,KACA,SACA,MACA,MACA,MACA,MACA,MACA,KACA,MACA,IACA,KACA,MACA,MACA,MACA,QACA,MACA,OACA,OACA,OACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,OACA,OACA,MACA,MACA,MACA,KACA,MACA,MACA,MACA,OACA,MACA,MACA,QACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,QACA,MACA,MACA,MACA,KACA,MACA,KACA,KACA,MACA,OACA,MACA,MACA,MACA,OACA,MACA,MACA,MACA,MACA,MACA,OAEDC,UAAW,CACV,aACA,YACA,YACA,aACA,aACA,cACA,oBACA,oBACA,aACA,YACA,qBACA,4BACA,yBACA,uBACA,0BACA,0CACA,iDACA,kDACA,0EACA,4EACA,oEACA,kBACA,oBACA,+BACA,mBACA,sBACA,8BACA,gCACA,6BACA,YACA,aACA,mBACA,aACA,kBACA,gBACA,iBACA,cACA,iBACA,iBACA,yBACA,aACA,aACA,aACA,YACA,aACA,YACA,YACA,kBACA,eACA,YACA,gBACA,YACA,kBACA,2BACA,gCACA,kBACA,mBACA,YACA,aACA,gCACA,WACA,WACA,eACA,cACA,yBACA,kBACA,mBACA,wBACA,iCACA,wCACA,oCACA,oBACA,6BACA,oBACA,yBACA,qBACA,oBACA,oBACA,kBACA,aACA,wBACA,YACA,YACA,YACA,YACA,YACA,aACA,kBACA,iCACA,aACA,sBACA,aACA,sBACA,aACA,YACA,oBACA,mBACA,gBACA,aACA,oBACA,+BACA,cACA,4BACA,4BACA,cACA,yBACA,cACA,aACA,sBACA,mBACA,oBACA,oBACA,wBACA,uBACA,cACA,cACA,2BACA,YACA,aACA,cACA,aACA,aACA,aACA,+BACA,aACA,+BACA,4BACA,qBACA,YACA,8BACA,YACA,YACA,g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,EAAOx5H,uBAAuB,EAAGy5H,GAC1B,CACLhlJ,KAAMglJ,EACNnmJ,MAAOkmJ,EAAOlmJ,MACdC,OAAQimJ,EAAOjmJ,OAChB,GAGLsrI,SAAU,CACR,CAAC,IAAYpqI,IACX,MAAM2rB,EAAS,IAAI,GAAAH,YAAYxrB,EAAK2rB,QACpC,GAAAuE,QAAA,eAAuBvE,EAAQ,KAC/B,MAAMs5H,EAAW,IAAI,GAAA90H,SAASxE,GAE9B,OADiB,IAAI,GAAAmG,UACLS,UAAU,CAAC0yH,GAAW,CAAC,GAAGntH,MAAKotH,GACtCA,EAAOlnJ,QACd,M4BvBN09I,QAAS,CjBgBK7N,IACd,MAAMsX,EAAqBzJ,GAAQxjI,KAAIosI,IACrC,IAAIC,EAASD,EAAazW,IAAiB,CAAC,EAO5C,OANK0W,EAAO7U,OAAU6U,EAAO7uF,YAE3B6uF,EAAS,CACP7U,MAAO6U,IAGJA,CAAM,IAEf,OAAO,YAAaY,EACrB","sources":["webpack://jimp/../../node_modules/any-base/index.js","webpack://jimp/../../node_modules/any-base/src/converter.js","webpack://jimp/../../node_modules/base64-js/index.js","webpack://jimp/../../node_modules/bmp-js/index.js","webpack://jimp/../../node_modules/bmp-js/lib/decoder.js","webpack://jimp/../../node_modules/bmp-js/lib/encoder.js","webpack://jimp/../../node_modules/buffer-equal/index.js","webpack://jimp/../../node_modules/buffer/index.js","webpack://jimp/../../node_modules/buffer/node_modules/ieee754/index.js","webpack://jimp/../../node_modules/events/events.js","webpack://jimp/../../node_modules/exif-parser/index.js","webpack://jimp/../../node_modules/exif-parser/lib/bufferstream.js","webpack://jimp/../../node_modules/exif-parser/lib/date.js","webpack://jimp/../../node_modules/exif-parser/lib/dom-bufferstream.js","webpack://jimp/../../node_modules/exif-parser/lib/exif-tags.js","webpack://jimp/../../node_modules/exif-parser/lib/exif.js","webpack://jimp/../../node_modules/exif-parser/lib/jpeg.js","webpack://jimp/../../node_modules/exif-parser/lib/parser.js","webpack://jimp/../../node_modules/exif-parser/lib/simplify.js","webpack://jimp/../../node_modules/file-type/core.js","webpack://jimp/../../node_modules/file-type/index.js","webpack://jimp/../../node_modules/file-type/supported.js","webpack://jimp/../../node_modules/file-type/util.js","webpack://jimp/../../node_modules/for-each/index.js","webpack://jimp/../../node_modules/gifwrap/node_modules/omggif/omggif.js","webpack://jimp/../../node_modules/gifwrap/src/bitmapimage.js","webpack://jimp/../../node_modules/gifwrap/src/gif.js","webpack://jimp/../../node_modules/gifwrap/src/gifcodec.js","webpack://jimp/../../node_modules/gifwrap/src/gifframe.js","webpack://jimp/../../node_modules/gifwrap/src/gifutil.js","webpack://jimp/../../node_modules/gifwrap/src/index.js","webpack://jimp/../../node_modules/global/window.js","webpack://jimp/../../node_modules/ieee754/index.js","webpack://jimp/../../node_modules/is-callable/index.js","webpack://jimp/../../node_modules/is-function/index.js","webpack://jimp/../../node_modules/isomorphic-fetch/fetch-npm-browserify.js","webpack://jimp/../../node_modules/jpeg-js/index.js","webpack://jimp/../../node_modules/jpeg-js/lib/decoder.js","webpack://jimp/../../node_modules/jpeg-js/lib/encoder.js","webpack://jimp/../../node_modules/load-bmfont/browser.js","webpack://jimp/../../node_modules/load-bmfont/lib/is-binary.js","webpack://jimp/../../node_modules/omggif/omggif.js","webpack://jimp/../../node_modules/pako/index.js","webpack://jimp/../../node_modules/pako/lib/deflate.js","webpack://jimp/../../node_modules/pako/lib/inflate.js","webpack://jimp/../../node_modules/pako/lib/utils/common.js","webpack://jimp/../../node_modules/pako/lib/utils/strings.js","webpack://jimp/../../node_modules/pako/lib/zlib/adler32.js","webpack://jimp/../../node_modules/pako/lib/zlib/constants.js","webpack://jimp/../../node_modules/pako/lib/zlib/crc32.js","webpack://jimp/../../node_modules/pako/lib/zlib/deflate.js","webpack://jimp/../../node_modules/pako/lib/zlib/gzheader.js","webpack://jimp/../../node_modules/pako/lib/zlib/inffast.js","webpack://jimp/../../node_modules/pako/lib/zlib/inflate.js","webpack://jimp/../../node_modules/pako/lib/zlib/inftrees.js","webpack://jimp/../../node_modules/pako/lib/zlib/messages.js","webpack://jimp/../../node_modules/pako/lib/zlib/trees.js","webpack://jimp/../../node_modules/pako/lib/zlib/zstream.js","webpack://jimp/../../node_modules/parse-bmfont-ascii/index.js","webpack://jimp/../../node_modules/parse-bmfont-binary/index.js","webpack://jimp/../../node_modules/parse-bmfont-xml/lib/browser.js","webpack://jimp/../../node_modules/parse-bmfont-xml/lib/parse-attribs.js","webpack://jimp/../../node_modules/parse-headers/parse-headers.js","webpack://jimp/../../node_modules/path-browserify/index.js","webpack://jimp/../../node_modules/peek-readable/lib/Deferred.js","webpack://jimp/../../node_modules/peek-readable/lib/EndOfFileStream.js","webpack://jimp/../../node_modules/peek-readable/lib/StreamReader.js","webpack://jimp/../../node_modules/peek-readable/lib/index.js","webpack://jimp/../../node_modules/pixelmatch/index.js","webpack://jimp/../../node_modules/pngjs/browser.js","webpack://jimp/../../node_modules/process/browser.js","webpack://jimp/../../node_modules/strtok3/lib/AbstractTokenizer.js","webpack://jimp/../../node_modules/strtok3/lib/BufferTokenizer.js","webpack://jimp/../../node_modules/strtok3/lib/FileTokenizer.js","webpack://jimp/../../node_modules/strtok3/lib/FsPromise.js","webpack://jimp/../../node_modules/strtok3/lib/ReadStreamTokenizer.js","webpack://jimp/../../node_modules/strtok3/lib/core.js","webpack://jimp/../../node_modules/strtok3/lib/index.js","webpack://jimp/../../node_modules/timm/lib/timm.js","webpack://jimp/../../node_modules/token-types/lib/index.js","webpack://jimp/../../node_modules/trim/index.js","webpack://jimp/../../node_modules/utif2/UTIF.js","webpack://jimp/../../node_modules/whatwg-fetch/fetch.js","webpack://jimp/../../node_modules/xhr/index.js","webpack://jimp/../../node_modules/xml-parse-from-string/index.js","webpack://jimp/../../node_modules/xtend/immutable.js","webpack://jimp/../../node_modules/image-q/dist/cjs/image-q.cjs","webpack://jimp/webpack/bootstrap","webpack://jimp/webpack/runtime/compat get default export","webpack://jimp/webpack/runtime/define property getters","webpack://jimp/webpack/runtime/global","webpack://jimp/webpack/runtime/hasOwnProperty shorthand","webpack://jimp/webpack/runtime/make namespace object","webpack://jimp/../utils/es/index.js","webpack://jimp/../../node_modules/tinycolor2/esm/tinycolor.js","webpack://jimp/../core/es/modules/phash.js","webpack://jimp/../core/es/request.js","webpack://jimp/../core/es/constants.js","webpack://jimp/../core/es/composite/composite-modes.js","webpack://jimp/../core/es/utils/promisify.js","webpack://jimp/../core/es/utils/mime.js","webpack://jimp/../core/es/utils/image-bitmap.js","webpack://jimp/../core/es/index.js","webpack://jimp/../core/es/composite/index.js","webpack://jimp/../type-jpeg/es/index.js","webpack://jimp/../type-png/es/index.js","webpack://jimp/../type-bmp/es/index.js","webpack://jimp/../type-tiff/es/index.js","webpack://jimp/../type-gif/es/index.js","webpack://jimp/../plugin-blur/es/blur-tables.js","webpack://jimp/../plugin-color/es/index.js","webpack://jimp/../plugin-dither/es/index.js","webpack://jimp/../plugin-flip/es/index.js","webpack://jimp/../plugin-normalize/es/index.js","webpack://jimp/../plugin-print/es/measure-text.js","webpack://jimp/../plugin-print/es/index.js","webpack://jimp/../plugin-resize/es/modules/resize.js","webpack://jimp/../plugin-resize/es/modules/resize2.js","webpack://jimp/../plugin-rotate/es/index.js","webpack://jimp/../plugins/es/index.js","webpack://jimp/../plugin-blit/es/index.js","webpack://jimp/../plugin-blur/es/index.js","webpack://jimp/../plugin-circle/es/index.js","webpack://jimp/../plugin-contain/es/index.js","webpack://jimp/../plugin-cover/es/index.js","webpack://jimp/../plugin-crop/es/index.js","webpack://jimp/../plugin-displace/es/index.js","webpack://jimp/../plugin-fisheye/es/index.js","webpack://jimp/../plugin-gaussian/es/index.js","webpack://jimp/../plugin-invert/es/index.js","webpack://jimp/../plugin-mask/es/index.js","webpack://jimp/../plugin-resize/es/index.js","webpack://jimp/../plugin-scale/es/index.js","webpack://jimp/../plugin-shadow/es/index.js","webpack://jimp/../plugin-threshold/es/index.js","webpack://jimp/../custom/es/index.js","webpack://jimp/./src/index.js","webpack://jimp/../types/es/index.js"],"sourcesContent":["var Converter = require('./src/converter');\n\n/**\n * Function get source and destination alphabet and return convert function\n *\n * @param {string|Array} srcAlphabet\n * @param {string|Array} dstAlphabet\n *\n * @returns {function(number|Array)}\n */\nfunction anyBase(srcAlphabet, dstAlphabet) {\n var converter = new Converter(srcAlphabet, dstAlphabet);\n /**\n * Convert function\n *\n * @param {string|Array} number\n *\n * @return {string|Array} number\n */\n return function (number) {\n return converter.convert(number);\n }\n};\n\nanyBase.BIN = '01';\nanyBase.OCT = '01234567';\nanyBase.DEC = '0123456789';\nanyBase.HEX = '0123456789abcdef';\n\nmodule.exports = anyBase;","'use strict';\n\n/**\n * Converter\n *\n * @param {string|Array} srcAlphabet\n * @param {string|Array} dstAlphabet\n * @constructor\n */\nfunction Converter(srcAlphabet, dstAlphabet) {\n if (!srcAlphabet || !dstAlphabet || !srcAlphabet.length || !dstAlphabet.length) {\n throw new Error('Bad alphabet');\n }\n this.srcAlphabet = srcAlphabet;\n this.dstAlphabet = dstAlphabet;\n}\n\n/**\n * Convert number from source alphabet to destination alphabet\n *\n * @param {string|Array} number - number represented as a string or array of points\n *\n * @returns {string|Array}\n */\nConverter.prototype.convert = function(number) {\n var i, divide, newlen,\n numberMap = {},\n fromBase = this.srcAlphabet.length,\n toBase = this.dstAlphabet.length,\n length = number.length,\n result = typeof number === 'string' ? '' : [];\n\n if (!this.isValid(number)) {\n throw new Error('Number \"' + number + '\" contains of non-alphabetic digits (' + this.srcAlphabet + ')');\n }\n\n if (this.srcAlphabet === this.dstAlphabet) {\n return number;\n }\n\n for (i = 0; i < length; i++) {\n numberMap[i] = this.srcAlphabet.indexOf(number[i]);\n }\n do {\n divide = 0;\n newlen = 0;\n for (i = 0; i < length; i++) {\n divide = divide * fromBase + numberMap[i];\n if (divide >= toBase) {\n numberMap[newlen++] = parseInt(divide / toBase, 10);\n divide = divide % toBase;\n } else if (newlen > 0) {\n numberMap[newlen++] = 0;\n }\n }\n length = newlen;\n result = this.dstAlphabet.slice(divide, divide + 1).concat(result);\n } while (newlen !== 0);\n\n return result;\n};\n\n/**\n * Valid number with source alphabet\n *\n * @param {number} number\n *\n * @returns {boolean}\n */\nConverter.prototype.isValid = function(number) {\n var i = 0;\n for (; i < number.length; ++i) {\n if (this.srcAlphabet.indexOf(number[i]) === -1) {\n return false;\n }\n }\n return true;\n};\n\nmodule.exports = Converter;","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(\n uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)\n ))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/**\n * @author shaozilee\n *\n * support 1bit 4bit 8bit 24bit decode\n * encode with 24bit\n * \n */\n\nvar encode = require('./lib/encoder'),\n decode = require('./lib/decoder');\n\nmodule.exports = {\n encode: encode,\n decode: decode\n};\n","/**\n * @author shaozilee\n *\n * Bmp format decoder,support 1bit 4bit 8bit 24bit bmp\n *\n */\n\nfunction BmpDecoder(buffer,is_with_alpha) {\n this.pos = 0;\n this.buffer = buffer;\n this.is_with_alpha = !!is_with_alpha;\n this.bottom_up = true;\n this.flag = this.buffer.toString(\"utf-8\", 0, this.pos += 2);\n if (this.flag != \"BM\") throw new Error(\"Invalid BMP File\");\n this.parseHeader();\n this.parseRGBA();\n}\n\nBmpDecoder.prototype.parseHeader = function() {\n this.fileSize = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.reserved = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.offset = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.headerSize = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.width = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.height = this.buffer.readInt32LE(this.pos);\n this.pos += 4;\n this.planes = this.buffer.readUInt16LE(this.pos);\n this.pos += 2;\n this.bitPP = this.buffer.readUInt16LE(this.pos);\n this.pos += 2;\n this.compress = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.rawSize = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.hr = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.vr = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.colors = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.importantColors = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n\n if(this.bitPP === 16 && this.is_with_alpha){\n this.bitPP = 15\n }\n if (this.bitPP < 15) {\n var len = this.colors === 0 ? 1 << this.bitPP : this.colors;\n this.palette = new Array(len);\n for (var i = 0; i < len; i++) {\n var blue = this.buffer.readUInt8(this.pos++);\n var green = this.buffer.readUInt8(this.pos++);\n var red = this.buffer.readUInt8(this.pos++);\n var quad = this.buffer.readUInt8(this.pos++);\n this.palette[i] = {\n red: red,\n green: green,\n blue: blue,\n quad: quad\n };\n }\n }\n if(this.height < 0) {\n this.height *= -1;\n this.bottom_up = false;\n }\n\n}\n\nBmpDecoder.prototype.parseRGBA = function() {\n var bitn = \"bit\" + this.bitPP;\n var len = this.width * this.height * 4;\n this.data = new Buffer(len);\n this[bitn]();\n};\n\nBmpDecoder.prototype.bit1 = function() {\n var xlen = Math.ceil(this.width / 8);\n var mode = xlen%4;\n var y = this.height >= 0 ? this.height - 1 : -this.height\n for (var y = this.height - 1; y >= 0; y--) {\n var line = this.bottom_up ? y : this.height - 1 - y\n for (var x = 0; x < xlen; x++) {\n var b = this.buffer.readUInt8(this.pos++);\n var location = line * this.width * 4 + x*8*4;\n for (var i = 0; i < 8; i++) {\n if(x*8+i>(7-i))&0x1)];\n\n this.data[location+i*4] = 0;\n this.data[location+i*4 + 1] = rgb.blue;\n this.data[location+i*4 + 2] = rgb.green;\n this.data[location+i*4 + 3] = rgb.red;\n\n }else{\n break;\n }\n }\n }\n\n if (mode != 0){\n this.pos+=(4 - mode);\n }\n }\n};\n\nBmpDecoder.prototype.bit4 = function() {\n //RLE-4\n if(this.compress == 2){\n this.data.fill(0xff);\n\n var location = 0;\n var lines = this.bottom_up?this.height-1:0;\n var low_nibble = false;//for all count of pixel\n\n while(location>4);\n }\n\n if ((i & 1) && (i+1 < b)){\n c = this.buffer.readUInt8(this.pos++);\n }\n\n low_nibble = !low_nibble;\n }\n\n if ((((b+1) >> 1) & 1 ) == 1){\n this.pos++\n }\n }\n\n }else{//encoded mode\n for (var i = 0; i < a; i++) {\n if (low_nibble) {\n setPixelData.call(this, (b & 0x0f));\n } else {\n setPixelData.call(this, (b & 0xf0)>>4);\n }\n low_nibble = !low_nibble;\n }\n }\n\n }\n\n\n\n\n function setPixelData(rgbIndex){\n var rgb = this.palette[rgbIndex];\n this.data[location] = 0;\n this.data[location + 1] = rgb.blue;\n this.data[location + 2] = rgb.green;\n this.data[location + 3] = rgb.red;\n location+=4;\n }\n }else{\n\n var xlen = Math.ceil(this.width/2);\n var mode = xlen%4;\n for (var y = this.height - 1; y >= 0; y--) {\n var line = this.bottom_up ? y : this.height - 1 - y\n for (var x = 0; x < xlen; x++) {\n var b = this.buffer.readUInt8(this.pos++);\n var location = line * this.width * 4 + x*2*4;\n\n var before = b>>4;\n var after = b&0x0F;\n\n var rgb = this.palette[before];\n this.data[location] = 0;\n this.data[location + 1] = rgb.blue;\n this.data[location + 2] = rgb.green;\n this.data[location + 3] = rgb.red;\n\n\n if(x*2+1>=this.width)break;\n\n rgb = this.palette[after];\n\n this.data[location+4] = 0;\n this.data[location+4 + 1] = rgb.blue;\n this.data[location+4 + 2] = rgb.green;\n this.data[location+4 + 3] = rgb.red;\n\n }\n\n if (mode != 0){\n this.pos+=(4 - mode);\n }\n }\n\n }\n\n};\n\nBmpDecoder.prototype.bit8 = function() {\n //RLE-8\n if(this.compress == 1){\n this.data.fill(0xff);\n\n var location = 0;\n var lines = this.bottom_up?this.height-1:0;\n\n while(location= 0; y--) {\n var line = this.bottom_up ? y : this.height - 1 - y\n for (var x = 0; x < this.width; x++) {\n var b = this.buffer.readUInt8(this.pos++);\n var location = line * this.width * 4 + x * 4;\n if (b < this.palette.length) {\n var rgb = this.palette[b];\n\n this.data[location] = 0;\n this.data[location + 1] = rgb.blue;\n this.data[location + 2] = rgb.green;\n this.data[location + 3] = rgb.red;\n\n } else {\n this.data[location] = 0;\n this.data[location + 1] = 0xFF;\n this.data[location + 2] = 0xFF;\n this.data[location + 3] = 0xFF;\n }\n }\n if (mode != 0) {\n this.pos += (4 - mode);\n }\n }\n }\n};\n\nBmpDecoder.prototype.bit15 = function() {\n var dif_w =this.width % 3;\n var _11111 = parseInt(\"11111\", 2),_1_5 = _11111;\n for (var y = this.height - 1; y >= 0; y--) {\n var line = this.bottom_up ? y : this.height - 1 - y\n for (var x = 0; x < this.width; x++) {\n\n var B = this.buffer.readUInt16LE(this.pos);\n this.pos+=2;\n var blue = (B & _1_5) / _1_5 * 255 | 0;\n var green = (B >> 5 & _1_5 ) / _1_5 * 255 | 0;\n var red = (B >> 10 & _1_5) / _1_5 * 255 | 0;\n var alpha = (B>>15)?0xFF:0x00;\n\n var location = line * this.width * 4 + x * 4;\n\n this.data[location] = alpha;\n this.data[location + 1] = blue;\n this.data[location + 2] = green;\n this.data[location + 3] = red;\n }\n //skip extra bytes\n this.pos += dif_w;\n }\n};\n\nBmpDecoder.prototype.bit16 = function() {\n var dif_w =(this.width % 2)*2;\n //default xrgb555\n this.maskRed = 0x7C00;\n this.maskGreen = 0x3E0;\n this.maskBlue =0x1F;\n this.mask0 = 0;\n\n if(this.compress == 3){\n this.maskRed = this.buffer.readUInt32LE(this.pos);\n this.pos+=4;\n this.maskGreen = this.buffer.readUInt32LE(this.pos);\n this.pos+=4;\n this.maskBlue = this.buffer.readUInt32LE(this.pos);\n this.pos+=4;\n this.mask0 = this.buffer.readUInt32LE(this.pos);\n this.pos+=4;\n }\n\n\n var ns=[0,0,0];\n for (var i=0;i<16;i++){\n if ((this.maskRed>>i)&0x01) ns[0]++;\n if ((this.maskGreen>>i)&0x01) ns[1]++;\n if ((this.maskBlue>>i)&0x01) ns[2]++;\n }\n ns[1]+=ns[0]; ns[2]+=ns[1];\tns[0]=8-ns[0]; ns[1]-=8; ns[2]-=8;\n\n for (var y = this.height - 1; y >= 0; y--) {\n var line = this.bottom_up ? y : this.height - 1 - y;\n for (var x = 0; x < this.width; x++) {\n\n var B = this.buffer.readUInt16LE(this.pos);\n this.pos+=2;\n\n var blue = (B&this.maskBlue)<>ns[1];\n var red = (B&this.maskRed)>>ns[2];\n\n var location = line * this.width * 4 + x * 4;\n\n this.data[location] = 0;\n this.data[location + 1] = blue;\n this.data[location + 2] = green;\n this.data[location + 3] = red;\n }\n //skip extra bytes\n this.pos += dif_w;\n }\n};\n\nBmpDecoder.prototype.bit24 = function() {\n for (var y = this.height - 1; y >= 0; y--) {\n var line = this.bottom_up ? y : this.height - 1 - y\n for (var x = 0; x < this.width; x++) {\n //Little Endian rgb\n var blue = this.buffer.readUInt8(this.pos++);\n var green = this.buffer.readUInt8(this.pos++);\n var red = this.buffer.readUInt8(this.pos++);\n var location = line * this.width * 4 + x * 4;\n this.data[location] = 0;\n this.data[location + 1] = blue;\n this.data[location + 2] = green;\n this.data[location + 3] = red;\n }\n //skip extra bytes\n this.pos += (this.width % 4);\n }\n\n};\n\n/**\n * add 32bit decode func\n * @author soubok\n */\nBmpDecoder.prototype.bit32 = function() {\n //BI_BITFIELDS\n if(this.compress == 3){\n this.maskRed = this.buffer.readUInt32LE(this.pos);\n this.pos+=4;\n this.maskGreen = this.buffer.readUInt32LE(this.pos);\n this.pos+=4;\n this.maskBlue = this.buffer.readUInt32LE(this.pos);\n this.pos+=4;\n this.mask0 = this.buffer.readUInt32LE(this.pos);\n this.pos+=4;\n for (var y = this.height - 1; y >= 0; y--) {\n var line = this.bottom_up ? y : this.height - 1 - y;\n for (var x = 0; x < this.width; x++) {\n //Little Endian rgba\n var alpha = this.buffer.readUInt8(this.pos++);\n var blue = this.buffer.readUInt8(this.pos++);\n var green = this.buffer.readUInt8(this.pos++);\n var red = this.buffer.readUInt8(this.pos++);\n var location = line * this.width * 4 + x * 4;\n this.data[location] = alpha;\n this.data[location + 1] = blue;\n this.data[location + 2] = green;\n this.data[location + 3] = red;\n }\n }\n\n }else{\n for (var y = this.height - 1; y >= 0; y--) {\n var line = this.bottom_up ? y : this.height - 1 - y;\n for (var x = 0; x < this.width; x++) {\n //Little Endian argb\n var blue = this.buffer.readUInt8(this.pos++);\n var green = this.buffer.readUInt8(this.pos++);\n var red = this.buffer.readUInt8(this.pos++);\n var alpha = this.buffer.readUInt8(this.pos++);\n var location = line * this.width * 4 + x * 4;\n this.data[location] = alpha;\n this.data[location + 1] = blue;\n this.data[location + 2] = green;\n this.data[location + 3] = red;\n }\n }\n\n }\n\n\n\n\n};\n\nBmpDecoder.prototype.getData = function() {\n return this.data;\n};\n\nmodule.exports = function(bmpData) {\n var decoder = new BmpDecoder(bmpData);\n return decoder;\n};\n","/**\n * @author shaozilee\n *\n * BMP format encoder,encode 24bit BMP\n * Not support quality compression\n *\n */\n\nfunction BmpEncoder(imgData){\n\tthis.buffer = imgData.data;\n\tthis.width = imgData.width;\n\tthis.height = imgData.height;\n\tthis.extraBytes = this.width%4;\n\tthis.rgbSize = this.height*(3*this.width+this.extraBytes);\n\tthis.headerInfoSize = 40;\n\n\tthis.data = [];\n\t/******************header***********************/\n\tthis.flag = \"BM\";\n\tthis.reserved = 0;\n\tthis.offset = 54;\n\tthis.fileSize = this.rgbSize+this.offset;\n\tthis.planes = 1;\n\tthis.bitPP = 24;\n\tthis.compress = 0;\n\tthis.hr = 0;\n\tthis.vr = 0;\n\tthis.colors = 0;\n\tthis.importantColors = 0;\n}\n\nBmpEncoder.prototype.encode = function() {\n\tvar tempBuffer = new Buffer(this.offset+this.rgbSize);\n\tthis.pos = 0;\n\ttempBuffer.write(this.flag,this.pos,2);this.pos+=2;\n\ttempBuffer.writeUInt32LE(this.fileSize,this.pos);this.pos+=4;\n\ttempBuffer.writeUInt32LE(this.reserved,this.pos);this.pos+=4;\n\ttempBuffer.writeUInt32LE(this.offset,this.pos);this.pos+=4;\n\n\ttempBuffer.writeUInt32LE(this.headerInfoSize,this.pos);this.pos+=4;\n\ttempBuffer.writeUInt32LE(this.width,this.pos);this.pos+=4;\n\ttempBuffer.writeInt32LE(-this.height,this.pos);this.pos+=4;\n\ttempBuffer.writeUInt16LE(this.planes,this.pos);this.pos+=2;\n\ttempBuffer.writeUInt16LE(this.bitPP,this.pos);this.pos+=2;\n\ttempBuffer.writeUInt32LE(this.compress,this.pos);this.pos+=4;\n\ttempBuffer.writeUInt32LE(this.rgbSize,this.pos);this.pos+=4;\n\ttempBuffer.writeUInt32LE(this.hr,this.pos);this.pos+=4;\n\ttempBuffer.writeUInt32LE(this.vr,this.pos);this.pos+=4;\n\ttempBuffer.writeUInt32LE(this.colors,this.pos);this.pos+=4;\n\ttempBuffer.writeUInt32LE(this.importantColors,this.pos);this.pos+=4;\n\n\tvar i=0;\n\tvar rowBytes = 3*this.width+this.extraBytes;\n\n\tfor (var y = 0; y 0){\n\t\t\tvar fillOffset = this.pos+y*rowBytes+this.width*3;\n\t\t\ttempBuffer.fill(0,fillOffset,fillOffset+this.extraBytes);\n\t\t}\n\t}\n\n\treturn tempBuffer;\n};\n\nmodule.exports = function(imgData, quality) {\n if (typeof quality === 'undefined') quality = 100;\n \tvar encoder = new BmpEncoder(imgData);\n\tvar data = encoder.encode();\n return {\n data: data,\n width: imgData.width,\n height: imgData.height\n };\n};\n","var Buffer = require('buffer').Buffer; // for use with browserify\n\nmodule.exports = function (a, b) {\n if (!Buffer.isBuffer(a)) return undefined;\n if (!Buffer.isBuffer(b)) return undefined;\n if (typeof a.equals === 'function') return a.equals(b);\n if (a.length !== b.length) return false;\n \n for (var i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n \n return true;\n};\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\nvar K_MAX_LENGTH = 0x7fffffff\nexports.kMaxLength = K_MAX_LENGTH\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\nBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport()\n\nif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n )\n}\n\nfunction typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n}\n\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n})\n\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n})\n\nfunction createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n var buf = new Uint8Array(length)\n buf.__proto__ = Buffer.prototype\n return buf\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}\n\n// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\nif (typeof Symbol !== 'undefined' && Symbol.species != null &&\n Buffer[Symbol.species] === Buffer) {\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true,\n enumerable: false,\n writable: false\n })\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nfunction from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayLike(value)\n }\n\n if (value == null) {\n throw TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n var valueOf = value.valueOf && value.valueOf()\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n var b = fromObject(value)\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(\n value[Symbol.toPrimitive]('string'), encodingOrOffset, length\n )\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n}\n\n// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n// https://github.com/feross/buffer/pull/148\nBuffer.prototype.__proto__ = Uint8Array.prototype\nBuffer.__proto__ = Uint8Array\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n}\n\nfunction alloc (size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n}\n\nfunction allocUnsafe (size) {\n assertSize(size)\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n var length = byteLength(string, encoding) | 0\n var buf = createBuffer(length)\n\n var actual = buf.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual)\n }\n\n return buf\n}\n\nfunction fromArrayLike (array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n var buf = createBuffer(length)\n for (var i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255\n }\n return buf\n}\n\nfunction fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n var buf\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array)\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset)\n } else {\n buf = new Uint8Array(array, byteOffset, length)\n }\n\n // Return an augmented `Uint8Array` instance\n buf.__proto__ = Buffer.prototype\n return buf\n}\n\nfunction fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n var buf = createBuffer(len)\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len)\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n}\n\nfunction checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n}\n\nBuffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (isInstance(buf, Uint8Array)) {\n buf = Buffer.from(buf)\n }\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n var len = string.length\n var mustMatch = (arguments.length > 2 && arguments[2] === true)\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n// reliably in a browserify context because there could be multiple different\n// copies of the 'buffer' package in use. This method works even for Buffer\n// instances that were created from another copy of the `buffer` package.\n// See: https://github.com/feross/buffer/issues/154\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()\n if (this.length > max) str += ' ... '\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength)\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n var strLen = string.length\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0\n if (isFinite(length)) {\n length = length >>> 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf = this.subarray(start, end)\n // Return an augmented `Uint8Array` instance\n newBuf.__proto__ = Buffer.prototype\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n var limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n var limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end)\n } else if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (var i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding)\n var len = bytes.length\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0]\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n// the `instanceof` check but they should be treated as of that type.\n// See: https://github.com/feross/buffer/issues/166\nfunction isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n}\nfunction numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n}\n","exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar R = typeof Reflect === 'object' ? Reflect : null\nvar ReflectApply = R && typeof R.apply === 'function'\n ? R.apply\n : function ReflectApply(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n }\n\nvar ReflectOwnKeys\nif (R && typeof R.ownKeys === 'function') {\n ReflectOwnKeys = R.ownKeys\n} else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target)\n .concat(Object.getOwnPropertySymbols(target));\n };\n} else {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target);\n };\n}\n\nfunction ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n}\n\nvar NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {\n return value !== value;\n}\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\nmodule.exports.once = once;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nfunction checkListener(listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n}\n\nObject.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + arg + '.');\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {\n throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + n + '.');\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction _getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n};\n\nEventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = (type === 'error');\n\n var events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node's output if this results in an unhandled exception.\n throw er; // Unhandled 'error' event\n }\n // At least give some kind of context to the user\n var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));\n err.context = er;\n throw err; // Unhandled 'error' event\n }\n\n var handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n checkListener(listener);\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we've already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n var w = new Error('Possible EventEmitter memory leak detected. ' +\n existing.length + ' ' + String(type) + ' listeners ' +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n checkListener(listener);\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (events === undefined)\n return [];\n\n var evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events !== undefined) {\n var evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\nfunction once(emitter, name) {\n return new Promise(function (resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name, resolver);\n reject(err);\n }\n\n function resolver() {\n if (typeof emitter.removeListener === 'function') {\n emitter.removeListener('error', errorListener);\n }\n resolve([].slice.call(arguments));\n };\n\n eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });\n if (name !== 'error') {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n}\n\nfunction addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === 'function') {\n eventTargetAgnosticAddListener(emitter, 'error', handler, flags);\n }\n}\n\nfunction eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === 'function') {\n if (flags.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === 'function') {\n // EventTarget does not have `error` event semantics like Node\n // EventEmitters, we do not listen for `error` events here.\n emitter.addEventListener(name, function wrapListener(arg) {\n // IE does not have builtin `{ once: true }` support so we\n // have to do it manually.\n if (flags.once) {\n emitter.removeEventListener(name, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError('The \"emitter\" argument must be of type EventEmitter. Received type ' + typeof emitter);\n }\n}\n","var Parser = require('./lib/parser');\n\nfunction getGlobal() {\n\treturn (1,eval)('this');\n}\n\nmodule.exports = {\n\tcreate: function(buffer, global) {\n\t\tglobal = global || getGlobal();\n\t\tif(buffer instanceof global.ArrayBuffer) {\n\t\t\tvar DOMBufferStream = require('./lib/dom-bufferstream');\n\t\t\treturn new Parser(new DOMBufferStream(buffer, 0, buffer.byteLength, true, global));\n\t\t} else {\n\t\t\tvar NodeBufferStream = require('./lib/bufferstream');\n\t\t\treturn new Parser(new NodeBufferStream(buffer, 0, buffer.length, true));\n\t\t}\n\t}\n};\n","function BufferStream(buffer, offset, length, bigEndian) {\n\tthis.buffer = buffer;\n\tthis.offset = offset || 0;\n\tlength = typeof length === 'number' ? length : buffer.length;\n\tthis.endPosition = this.offset + length;\n\tthis.setBigEndian(bigEndian);\n}\n\nBufferStream.prototype = {\n\tsetBigEndian: function(bigEndian) {\n\t\tthis.bigEndian = !!bigEndian;\n\t},\n\tnextUInt8: function() {\n\t\tvar value = this.buffer.readUInt8(this.offset);\n\t\tthis.offset += 1;\n\t\treturn value;\n\t},\n\tnextInt8: function() {\n\t\tvar value = this.buffer.readInt8(this.offset);\n\t\tthis.offset += 1;\n\t\treturn value;\n\t},\n\tnextUInt16: function() {\n\t\tvar value = this.bigEndian ? this.buffer.readUInt16BE(this.offset) : this.buffer.readUInt16LE(this.offset);\n\t\tthis.offset += 2;\n\t\treturn value;\n\t},\n\tnextUInt32: function() {\n\t\tvar value = this.bigEndian ? this.buffer.readUInt32BE(this.offset) : this.buffer.readUInt32LE(this.offset);\n\t\tthis.offset += 4;\n\t\treturn value;\n\t},\n\tnextInt16: function() {\n\t\tvar value = this.bigEndian ? this.buffer.readInt16BE(this.offset) : this.buffer.readInt16LE(this.offset);\n\t\tthis.offset += 2;\n\t\treturn value;\n\t},\n\tnextInt32: function() {\n\t\tvar value = this.bigEndian ? this.buffer.readInt32BE(this.offset) : this.buffer.readInt32LE(this.offset);\n\t\tthis.offset += 4;\n\t\treturn value;\n\t},\n\tnextFloat: function() {\n\t\tvar value = this.bigEndian ? this.buffer.readFloatBE(this.offset) : this.buffer.readFloatLE(this.offset);\n\t\tthis.offset += 4;\n\t\treturn value;\n\t},\n\tnextDouble: function() {\n\t\tvar value = this.bigEndian ? this.buffer.readDoubleBE(this.offset) : this.buffer.readDoubleLE(this.offset);\n\t\tthis.offset += 8;\n\t\treturn value;\n\t},\n\tnextBuffer: function(length) {\n\t\tvar value = this.buffer.slice(this.offset, this.offset + length);\n\t\tthis.offset += length;\n\t\treturn value;\n\t},\n\tremainingLength: function() {\n\t\treturn this.endPosition - this.offset;\n\t},\n\tnextString: function(length) {\n\t\tvar value = this.buffer.toString('utf8', this.offset, this.offset + length);\n\t\tthis.offset += length;\n\t\treturn value;\n\t},\n\tmark: function() {\n\t\tvar self = this;\n\t\treturn {\n\t\t\topenWithOffset: function(offset) {\n\t\t\t\toffset = (offset || 0) + this.offset;\n\t\t\t\treturn new BufferStream(self.buffer, offset, self.endPosition - offset, self.bigEndian);\n\t\t\t},\n\t\t\toffset: this.offset\n\t\t};\n\t},\n\toffsetFrom: function(marker) {\n\t\treturn this.offset - marker.offset;\n\t},\n\tskip: function(amount) {\n\t\tthis.offset += amount;\n\t},\n\tbranch: function(offset, length) {\n\t\tlength = typeof length === 'number' ? length : this.endPosition - (this.offset + offset);\n\t\treturn new BufferStream(this.buffer, this.offset + offset, length, this.bigEndian);\n\t}\n};\n\nmodule.exports = BufferStream;\n","function parseNumber(s) {\n\treturn parseInt(s, 10);\n}\n\n//in seconds\nvar hours = 3600;\nvar minutes = 60;\n\n//take date (year, month, day) and time (hour, minutes, seconds) digits in UTC\n//and return a timestamp in seconds\nfunction parseDateTimeParts(dateParts, timeParts) {\n\tdateParts = dateParts.map(parseNumber);\n\ttimeParts = timeParts.map(parseNumber);\n\tvar year = dateParts[0];\n\tvar month = dateParts[1] - 1;\n\tvar day = dateParts[2];\n\tvar hours = timeParts[0];\n\tvar minutes = timeParts[1];\n\tvar seconds = timeParts[2];\n\tvar date = Date.UTC(year, month, day, hours, minutes, seconds, 0);\n\tvar timestamp = date / 1000;\n\treturn timestamp;\n}\n\n//parse date with \"2004-09-04T23:39:06-08:00\" format,\n//one of the formats supported by ISO 8601, and\n//convert to utc timestamp in seconds\nfunction parseDateWithTimezoneFormat(dateTimeStr) {\n\n\tvar dateParts = dateTimeStr.substr(0, 10).split('-');\n\tvar timeParts = dateTimeStr.substr(11, 8).split(':');\n\tvar timezoneStr = dateTimeStr.substr(19, 6);\n\tvar timezoneParts = timezoneStr.split(':').map(parseNumber);\n\tvar timezoneOffset = (timezoneParts[0] * hours) +\n\t\t(timezoneParts[1] * minutes);\n\n\tvar timestamp = parseDateTimeParts(dateParts, timeParts);\n\t//minus because the timezoneOffset describes\n\t//how much the described time is ahead of UTC\n\ttimestamp -= timezoneOffset;\n\n\tif(typeof timestamp === 'number' && !isNaN(timestamp)) {\n\t\treturn timestamp;\n\t}\n}\n\n//parse date with \"YYYY:MM:DD hh:mm:ss\" format, convert to utc timestamp in seconds\nfunction parseDateWithSpecFormat(dateTimeStr) {\n\tvar parts = dateTimeStr.split(' '),\n\t\tdateParts = parts[0].split(':'),\n\t\ttimeParts = parts[1].split(':');\n\n\tvar timestamp = parseDateTimeParts(dateParts, timeParts);\n\n\tif(typeof timestamp === 'number' && !isNaN(timestamp)) {\n\t\treturn timestamp;\n\t}\n}\n\nfunction parseExifDate(dateTimeStr) {\n\t//some easy checks to determine two common date formats\n\n\t//is the date in the standard \"YYYY:MM:DD hh:mm:ss\" format?\n\tvar isSpecFormat = dateTimeStr.length === 19 &&\n\t\tdateTimeStr.charAt(4) === ':';\n\t//is the date in the non-standard format,\n\t//\"2004-09-04T23:39:06-08:00\" to include a timezone?\n\tvar isTimezoneFormat = dateTimeStr.length === 25 &&\n\t\tdateTimeStr.charAt(10) === 'T';\n\tvar timestamp;\n\n\tif(isTimezoneFormat) {\n\t\treturn parseDateWithTimezoneFormat(dateTimeStr);\n\t}\n\telse if(isSpecFormat) {\n\t\treturn parseDateWithSpecFormat(dateTimeStr);\n\t}\n}\n\nmodule.exports = {\n\tparseDateWithSpecFormat: parseDateWithSpecFormat,\n\tparseDateWithTimezoneFormat: parseDateWithTimezoneFormat,\n\tparseExifDate: parseExifDate\n};\n","/*jslint browser: true, devel: true, bitwise: false, debug: true, eqeq: false, es5: true, evil: false, forin: false, newcap: false, nomen: true, plusplus: true, regexp: false, unparam: false, sloppy: true, stupid: false, sub: false, todo: true, vars: true, white: true */\n\nfunction DOMBufferStream(arrayBuffer, offset, length, bigEndian, global, parentOffset) {\n\tthis.global = global;\n\toffset = offset || 0;\n\tlength = length || (arrayBuffer.byteLength - offset);\n\tthis.arrayBuffer = arrayBuffer.slice(offset, offset + length);\n\tthis.view = new global.DataView(this.arrayBuffer, 0, this.arrayBuffer.byteLength);\n\tthis.setBigEndian(bigEndian);\n\tthis.offset = 0;\n\tthis.parentOffset = (parentOffset || 0) + offset;\n}\n\nDOMBufferStream.prototype = {\n\tsetBigEndian: function(bigEndian) {\n\t\tthis.littleEndian = !bigEndian;\n\t},\n\tnextUInt8: function() {\n\t\tvar value = this.view.getUint8(this.offset);\n\t\tthis.offset += 1;\n\t\treturn value;\n\t},\n\tnextInt8: function() {\n\t\tvar value = this.view.getInt8(this.offset);\n\t\tthis.offset += 1;\n\t\treturn value;\n\t},\n\tnextUInt16: function() {\n\t\tvar value = this.view.getUint16(this.offset, this.littleEndian);\n\t\tthis.offset += 2;\n\t\treturn value;\n\t},\n\tnextUInt32: function() {\n\t\tvar value = this.view.getUint32(this.offset, this.littleEndian);\n\t\tthis.offset += 4;\n\t\treturn value;\n\t},\n\tnextInt16: function() {\n\t\tvar value = this.view.getInt16(this.offset, this.littleEndian);\n\t\tthis.offset += 2;\n\t\treturn value;\n\t},\n\tnextInt32: function() {\n\t\tvar value = this.view.getInt32(this.offset, this.littleEndian);\n\t\tthis.offset += 4;\n\t\treturn value;\n\t},\n\tnextFloat: function() {\n\t\tvar value = this.view.getFloat32(this.offset, this.littleEndian);\n\t\tthis.offset += 4;\n\t\treturn value;\n\t},\n\tnextDouble: function() {\n\t\tvar value = this.view.getFloat64(this.offset, this.littleEndian);\n\t\tthis.offset += 8;\n\t\treturn value;\n\t},\n\tnextBuffer: function(length) {\n\t\t//this won't work in IE10\n\t\tvar value = this.arrayBuffer.slice(this.offset, this.offset + length);\n\t\tthis.offset += length;\n\t\treturn value;\n\t},\n\tremainingLength: function() {\n\t\treturn this.arrayBuffer.byteLength - this.offset;\n\t},\n\tnextString: function(length) {\n\t\tvar value = this.arrayBuffer.slice(this.offset, this.offset + length);\n\t\tvalue = String.fromCharCode.apply(null, new this.global.Uint8Array(value));\n\t\tthis.offset += length;\n\t\treturn value;\n\t},\n\tmark: function() {\n\t\tvar self = this;\n\t\treturn {\n\t\t\topenWithOffset: function(offset) {\n\t\t\t\toffset = (offset || 0) + this.offset;\n\t\t\t\treturn new DOMBufferStream(self.arrayBuffer, offset, self.arrayBuffer.byteLength - offset, !self.littleEndian, self.global, self.parentOffset);\n\t\t\t},\n\t\t\toffset: this.offset,\n\t\t\tgetParentOffset: function() {\n\t\t\t\treturn self.parentOffset;\n\t\t\t}\n\t\t};\n\t},\n\toffsetFrom: function(marker) {\n\t\treturn this.parentOffset + this.offset - (marker.offset + marker.getParentOffset());\n\t},\n\tskip: function(amount) {\n\t\tthis.offset += amount;\n\t},\n\tbranch: function(offset, length) {\n\t\tlength = typeof length === 'number' ? length : this.arrayBuffer.byteLength - (this.offset + offset);\n\t\treturn new DOMBufferStream(this.arrayBuffer, this.offset + offset, length, !this.littleEndian, this.global, this.parentOffset);\n\t}\n};\n\nmodule.exports = DOMBufferStream;\n","module.exports = {\n\texif : {\n\t\t0x0001 : \"InteropIndex\",\n\t\t0x0002 : \"InteropVersion\",\n\t\t0x000B : \"ProcessingSoftware\",\n\t\t0x00FE : \"SubfileType\",\n\t\t0x00FF : \"OldSubfileType\",\n\t\t0x0100 : \"ImageWidth\",\n\t\t0x0101 : \"ImageHeight\",\n\t\t0x0102 : \"BitsPerSample\",\n\t\t0x0103 : \"Compression\",\n\t\t0x0106 : \"PhotometricInterpretation\",\n\t\t0x0107 : \"Thresholding\",\n\t\t0x0108 : \"CellWidth\",\n\t\t0x0109 : \"CellLength\",\n\t\t0x010A : \"FillOrder\",\n\t\t0x010D : \"DocumentName\",\n\t\t0x010E : \"ImageDescription\",\n\t\t0x010F : \"Make\",\n\t\t0x0110 : \"Model\",\n\t\t0x0111 : \"StripOffsets\",\n\t\t0x0112 : \"Orientation\",\n\t\t0x0115 : \"SamplesPerPixel\",\n\t\t0x0116 : \"RowsPerStrip\",\n\t\t0x0117 : \"StripByteCounts\",\n\t\t0x0118 : \"MinSampleValue\",\n\t\t0x0119 : \"MaxSampleValue\",\n\t\t0x011A : \"XResolution\",\n\t\t0x011B : \"YResolution\",\n\t\t0x011C : \"PlanarConfiguration\",\n\t\t0x011D : \"PageName\",\n\t\t0x011E : \"XPosition\",\n\t\t0x011F : \"YPosition\",\n\t\t0x0120 : \"FreeOffsets\",\n\t\t0x0121 : \"FreeByteCounts\",\n\t\t0x0122 : \"GrayResponseUnit\",\n\t\t0x0123 : \"GrayResponseCurve\",\n\t\t0x0124 : \"T4Options\",\n\t\t0x0125 : \"T6Options\",\n\t\t0x0128 : \"ResolutionUnit\",\n\t\t0x0129 : \"PageNumber\",\n\t\t0x012C : \"ColorResponseUnit\",\n\t\t0x012D : \"TransferFunction\",\n\t\t0x0131 : \"Software\",\n\t\t0x0132 : \"ModifyDate\",\n\t\t0x013B : \"Artist\",\n\t\t0x013C : \"HostComputer\",\n\t\t0x013D : \"Predictor\",\n\t\t0x013E : \"WhitePoint\",\n\t\t0x013F : \"PrimaryChromaticities\",\n\t\t0x0140 : \"ColorMap\",\n\t\t0x0141 : \"HalftoneHints\",\n\t\t0x0142 : \"TileWidth\",\n\t\t0x0143 : \"TileLength\",\n\t\t0x0144 : \"TileOffsets\",\n\t\t0x0145 : \"TileByteCounts\",\n\t\t0x0146 : \"BadFaxLines\",\n\t\t0x0147 : \"CleanFaxData\",\n\t\t0x0148 : \"ConsecutiveBadFaxLines\",\n\t\t0x014A : \"SubIFD\",\n\t\t0x014C : \"InkSet\",\n\t\t0x014D : \"InkNames\",\n\t\t0x014E : \"NumberofInks\",\n\t\t0x0150 : \"DotRange\",\n\t\t0x0151 : \"TargetPrinter\",\n\t\t0x0152 : \"ExtraSamples\",\n\t\t0x0153 : \"SampleFormat\",\n\t\t0x0154 : \"SMinSampleValue\",\n\t\t0x0155 : \"SMaxSampleValue\",\n\t\t0x0156 : \"TransferRange\",\n\t\t0x0157 : \"ClipPath\",\n\t\t0x0158 : \"XClipPathUnits\",\n\t\t0x0159 : \"YClipPathUnits\",\n\t\t0x015A : \"Indexed\",\n\t\t0x015B : \"JPEGTables\",\n\t\t0x015F : \"OPIProxy\",\n\t\t0x0190 : \"GlobalParametersIFD\",\n\t\t0x0191 : \"ProfileType\",\n\t\t0x0192 : \"FaxProfile\",\n\t\t0x0193 : \"CodingMethods\",\n\t\t0x0194 : \"VersionYear\",\n\t\t0x0195 : \"ModeNumber\",\n\t\t0x01B1 : \"Decode\",\n\t\t0x01B2 : \"DefaultImageColor\",\n\t\t0x01B3 : \"T82Options\",\n\t\t0x01B5 : \"JPEGTables\",\n\t\t0x0200 : \"JPEGProc\",\n\t\t0x0201 : \"ThumbnailOffset\",\n\t\t0x0202 : \"ThumbnailLength\",\n\t\t0x0203 : \"JPEGRestartInterval\",\n\t\t0x0205 : \"JPEGLosslessPredictors\",\n\t\t0x0206 : \"JPEGPointTransforms\",\n\t\t0x0207 : \"JPEGQTables\",\n\t\t0x0208 : \"JPEGDCTables\",\n\t\t0x0209 : \"JPEGACTables\",\n\t\t0x0211 : \"YCbCrCoefficients\",\n\t\t0x0212 : \"YCbCrSubSampling\",\n\t\t0x0213 : \"YCbCrPositioning\",\n\t\t0x0214 : \"ReferenceBlackWhite\",\n\t\t0x022F : \"StripRowCounts\",\n\t\t0x02BC : \"ApplicationNotes\",\n\t\t0x03E7 : \"USPTOMiscellaneous\",\n\t\t0x1000 : \"RelatedImageFileFormat\",\n\t\t0x1001 : \"RelatedImageWidth\",\n\t\t0x1002 : \"RelatedImageHeight\",\n\t\t0x4746 : \"Rating\",\n\t\t0x4747 : \"XP_DIP_XML\",\n\t\t0x4748 : \"StitchInfo\",\n\t\t0x4749 : \"RatingPercent\",\n\t\t0x800D : \"ImageID\",\n\t\t0x80A3 : \"WangTag1\",\n\t\t0x80A4 : \"WangAnnotation\",\n\t\t0x80A5 : \"WangTag3\",\n\t\t0x80A6 : \"WangTag4\",\n\t\t0x80E3 : \"Matteing\",\n\t\t0x80E4 : \"DataType\",\n\t\t0x80E5 : \"ImageDepth\",\n\t\t0x80E6 : \"TileDepth\",\n\t\t0x827D : \"Model2\",\n\t\t0x828D : \"CFARepeatPatternDim\",\n\t\t0x828E : \"CFAPattern2\",\n\t\t0x828F : \"BatteryLevel\",\n\t\t0x8290 : \"KodakIFD\",\n\t\t0x8298 : \"Copyright\",\n\t\t0x829A : \"ExposureTime\",\n\t\t0x829D : \"FNumber\",\n\t\t0x82A5 : \"MDFileTag\",\n\t\t0x82A6 : \"MDScalePixel\",\n\t\t0x82A7 : \"MDColorTable\",\n\t\t0x82A8 : \"MDLabName\",\n\t\t0x82A9 : \"MDSampleInfo\",\n\t\t0x82AA : \"MDPrepDate\",\n\t\t0x82AB : \"MDPrepTime\",\n\t\t0x82AC : \"MDFileUnits\",\n\t\t0x830E : \"PixelScale\",\n\t\t0x8335 : \"AdventScale\",\n\t\t0x8336 : \"AdventRevision\",\n\t\t0x835C : \"UIC1Tag\",\n\t\t0x835D : \"UIC2Tag\",\n\t\t0x835E : \"UIC3Tag\",\n\t\t0x835F : \"UIC4Tag\",\n\t\t0x83BB : \"IPTC-NAA\",\n\t\t0x847E : \"IntergraphPacketData\",\n\t\t0x847F : \"IntergraphFlagRegisters\",\n\t\t0x8480 : \"IntergraphMatrix\",\n\t\t0x8481 : \"INGRReserved\",\n\t\t0x8482 : \"ModelTiePoint\",\n\t\t0x84E0 : \"Site\",\n\t\t0x84E1 : \"ColorSequence\",\n\t\t0x84E2 : \"IT8Header\",\n\t\t0x84E3 : \"RasterPadding\",\n\t\t0x84E4 : \"BitsPerRunLength\",\n\t\t0x84E5 : \"BitsPerExtendedRunLength\",\n\t\t0x84E6 : \"ColorTable\",\n\t\t0x84E7 : \"ImageColorIndicator\",\n\t\t0x84E8 : \"BackgroundColorIndicator\",\n\t\t0x84E9 : \"ImageColorValue\",\n\t\t0x84EA : \"BackgroundColorValue\",\n\t\t0x84EB : \"PixelIntensityRange\",\n\t\t0x84EC : \"TransparencyIndicator\",\n\t\t0x84ED : \"ColorCharacterization\",\n\t\t0x84EE : \"HCUsage\",\n\t\t0x84EF : \"TrapIndicator\",\n\t\t0x84F0 : \"CMYKEquivalent\",\n\t\t0x8546 : \"SEMInfo\",\n\t\t0x8568 : \"AFCP_IPTC\",\n\t\t0x85B8 : \"PixelMagicJBIGOptions\",\n\t\t0x85D8 : \"ModelTransform\",\n\t\t0x8602 : \"WB_GRGBLevels\",\n\t\t0x8606 : \"LeafData\",\n\t\t0x8649 : \"PhotoshopSettings\",\n\t\t0x8769 : \"ExifOffset\",\n\t\t0x8773 : \"ICC_Profile\",\n\t\t0x877F : \"TIFF_FXExtensions\",\n\t\t0x8780 : \"MultiProfiles\",\n\t\t0x8781 : \"SharedData\",\n\t\t0x8782 : \"T88Options\",\n\t\t0x87AC : \"ImageLayer\",\n\t\t0x87AF : \"GeoTiffDirectory\",\n\t\t0x87B0 : \"GeoTiffDoubleParams\",\n\t\t0x87B1 : \"GeoTiffAsciiParams\",\n\t\t0x8822 : \"ExposureProgram\",\n\t\t0x8824 : \"SpectralSensitivity\",\n\t\t0x8825 : \"GPSInfo\",\n\t\t0x8827 : \"ISO\",\n\t\t0x8828 : \"Opto-ElectricConvFactor\",\n\t\t0x8829 : \"Interlace\",\n\t\t0x882A : \"TimeZoneOffset\",\n\t\t0x882B : \"SelfTimerMode\",\n\t\t0x8830 : \"SensitivityType\",\n\t\t0x8831 : \"StandardOutputSensitivity\",\n\t\t0x8832 : \"RecommendedExposureIndex\",\n\t\t0x8833 : \"ISOSpeed\",\n\t\t0x8834 : \"ISOSpeedLatitudeyyy\",\n\t\t0x8835 : \"ISOSpeedLatitudezzz\",\n\t\t0x885C : \"FaxRecvParams\",\n\t\t0x885D : \"FaxSubAddress\",\n\t\t0x885E : \"FaxRecvTime\",\n\t\t0x888A : \"LeafSubIFD\",\n\t\t0x9000 : \"ExifVersion\",\n\t\t0x9003 : \"DateTimeOriginal\",\n\t\t0x9004 : \"CreateDate\",\n\t\t0x9101 : \"ComponentsConfiguration\",\n\t\t0x9102 : \"CompressedBitsPerPixel\",\n\t\t0x9201 : \"ShutterSpeedValue\",\n\t\t0x9202 : \"ApertureValue\",\n\t\t0x9203 : \"BrightnessValue\",\n\t\t0x9204 : \"ExposureCompensation\",\n\t\t0x9205 : \"MaxApertureValue\",\n\t\t0x9206 : \"SubjectDistance\",\n\t\t0x9207 : \"MeteringMode\",\n\t\t0x9208 : \"LightSource\",\n\t\t0x9209 : \"Flash\",\n\t\t0x920A : \"FocalLength\",\n\t\t0x920B : \"FlashEnergy\",\n\t\t0x920C : \"SpatialFrequencyResponse\",\n\t\t0x920D : \"Noise\",\n\t\t0x920E : \"FocalPlaneXResolution\",\n\t\t0x920F : \"FocalPlaneYResolution\",\n\t\t0x9210 : \"FocalPlaneResolutionUnit\",\n\t\t0x9211 : \"ImageNumber\",\n\t\t0x9212 : \"SecurityClassification\",\n\t\t0x9213 : \"ImageHistory\",\n\t\t0x9214 : \"SubjectArea\",\n\t\t0x9215 : \"ExposureIndex\",\n\t\t0x9216 : \"TIFF-EPStandardID\",\n\t\t0x9217 : \"SensingMethod\",\n\t\t0x923A : \"CIP3DataFile\",\n\t\t0x923B : \"CIP3Sheet\",\n\t\t0x923C : \"CIP3Side\",\n\t\t0x923F : \"StoNits\",\n\t\t0x927C : \"MakerNote\",\n\t\t0x9286 : \"UserComment\",\n\t\t0x9290 : \"SubSecTime\",\n\t\t0x9291 : \"SubSecTimeOriginal\",\n\t\t0x9292 : \"SubSecTimeDigitized\",\n\t\t0x932F : \"MSDocumentText\",\n\t\t0x9330 : \"MSPropertySetStorage\",\n\t\t0x9331 : \"MSDocumentTextPosition\",\n\t\t0x935C : \"ImageSourceData\",\n\t\t0x9C9B : \"XPTitle\",\n\t\t0x9C9C : \"XPComment\",\n\t\t0x9C9D : \"XPAuthor\",\n\t\t0x9C9E : \"XPKeywords\",\n\t\t0x9C9F : \"XPSubject\",\n\t\t0xA000 : \"FlashpixVersion\",\n\t\t0xA001 : \"ColorSpace\",\n\t\t0xA002 : \"ExifImageWidth\",\n\t\t0xA003 : \"ExifImageHeight\",\n\t\t0xA004 : \"RelatedSoundFile\",\n\t\t0xA005 : \"InteropOffset\",\n\t\t0xA20B : \"FlashEnergy\",\n\t\t0xA20C : \"SpatialFrequencyResponse\",\n\t\t0xA20D : \"Noise\",\n\t\t0xA20E : \"FocalPlaneXResolution\",\n\t\t0xA20F : \"FocalPlaneYResolution\",\n\t\t0xA210 : \"FocalPlaneResolutionUnit\",\n\t\t0xA211 : \"ImageNumber\",\n\t\t0xA212 : \"SecurityClassification\",\n\t\t0xA213 : \"ImageHistory\",\n\t\t0xA214 : \"SubjectLocation\",\n\t\t0xA215 : \"ExposureIndex\",\n\t\t0xA216 : \"TIFF-EPStandardID\",\n\t\t0xA217 : \"SensingMethod\",\n\t\t0xA300 : \"FileSource\",\n\t\t0xA301 : \"SceneType\",\n\t\t0xA302 : \"CFAPattern\",\n\t\t0xA401 : \"CustomRendered\",\n\t\t0xA402 : \"ExposureMode\",\n\t\t0xA403 : \"WhiteBalance\",\n\t\t0xA404 : \"DigitalZoomRatio\",\n\t\t0xA405 : \"FocalLengthIn35mmFormat\",\n\t\t0xA406 : \"SceneCaptureType\",\n\t\t0xA407 : \"GainControl\",\n\t\t0xA408 : \"Contrast\",\n\t\t0xA409 : \"Saturation\",\n\t\t0xA40A : \"Sharpness\",\n\t\t0xA40B : \"DeviceSettingDescription\",\n\t\t0xA40C : \"SubjectDistanceRange\",\n\t\t0xA420 : \"ImageUniqueID\",\n\t\t0xA430 : \"OwnerName\",\n\t\t0xA431 : \"SerialNumber\",\n\t\t0xA432 : \"LensInfo\",\n\t\t0xA433 : \"LensMake\",\n\t\t0xA434 : \"LensModel\",\n\t\t0xA435 : \"LensSerialNumber\",\n\t\t0xA480 : \"GDALMetadata\",\n\t\t0xA481 : \"GDALNoData\",\n\t\t0xA500 : \"Gamma\",\n\t\t0xAFC0 : \"ExpandSoftware\",\n\t\t0xAFC1 : \"ExpandLens\",\n\t\t0xAFC2 : \"ExpandFilm\",\n\t\t0xAFC3 : \"ExpandFilterLens\",\n\t\t0xAFC4 : \"ExpandScanner\",\n\t\t0xAFC5 : \"ExpandFlashLamp\",\n\t\t0xBC01 : \"PixelFormat\",\n\t\t0xBC02 : \"Transformation\",\n\t\t0xBC03 : \"Uncompressed\",\n\t\t0xBC04 : \"ImageType\",\n\t\t0xBC80 : \"ImageWidth\",\n\t\t0xBC81 : \"ImageHeight\",\n\t\t0xBC82 : \"WidthResolution\",\n\t\t0xBC83 : \"HeightResolution\",\n\t\t0xBCC0 : \"ImageOffset\",\n\t\t0xBCC1 : \"ImageByteCount\",\n\t\t0xBCC2 : \"AlphaOffset\",\n\t\t0xBCC3 : \"AlphaByteCount\",\n\t\t0xBCC4 : \"ImageDataDiscard\",\n\t\t0xBCC5 : \"AlphaDataDiscard\",\n\t\t0xC427 : \"OceScanjobDesc\",\n\t\t0xC428 : \"OceApplicationSelector\",\n\t\t0xC429 : \"OceIDNumber\",\n\t\t0xC42A : \"OceImageLogic\",\n\t\t0xC44F : \"Annotations\",\n\t\t0xC4A5 : \"PrintIM\",\n\t\t0xC580 : \"USPTOOriginalContentType\",\n\t\t0xC612 : \"DNGVersion\",\n\t\t0xC613 : \"DNGBackwardVersion\",\n\t\t0xC614 : \"UniqueCameraModel\",\n\t\t0xC615 : \"LocalizedCameraModel\",\n\t\t0xC616 : \"CFAPlaneColor\",\n\t\t0xC617 : \"CFALayout\",\n\t\t0xC618 : \"LinearizationTable\",\n\t\t0xC619 : \"BlackLevelRepeatDim\",\n\t\t0xC61A : \"BlackLevel\",\n\t\t0xC61B : \"BlackLevelDeltaH\",\n\t\t0xC61C : \"BlackLevelDeltaV\",\n\t\t0xC61D : \"WhiteLevel\",\n\t\t0xC61E : \"DefaultScale\",\n\t\t0xC61F : \"DefaultCropOrigin\",\n\t\t0xC620 : \"DefaultCropSize\",\n\t\t0xC621 : \"ColorMatrix1\",\n\t\t0xC622 : \"ColorMatrix2\",\n\t\t0xC623 : \"CameraCalibration1\",\n\t\t0xC624 : \"CameraCalibration2\",\n\t\t0xC625 : \"ReductionMatrix1\",\n\t\t0xC626 : \"ReductionMatrix2\",\n\t\t0xC627 : \"AnalogBalance\",\n\t\t0xC628 : \"AsShotNeutral\",\n\t\t0xC629 : \"AsShotWhiteXY\",\n\t\t0xC62A : \"BaselineExposure\",\n\t\t0xC62B : \"BaselineNoise\",\n\t\t0xC62C : \"BaselineSharpness\",\n\t\t0xC62D : \"BayerGreenSplit\",\n\t\t0xC62E : \"LinearResponseLimit\",\n\t\t0xC62F : \"CameraSerialNumber\",\n\t\t0xC630 : \"DNGLensInfo\",\n\t\t0xC631 : \"ChromaBlurRadius\",\n\t\t0xC632 : \"AntiAliasStrength\",\n\t\t0xC633 : \"ShadowScale\",\n\t\t0xC634 : \"DNGPrivateData\",\n\t\t0xC635 : \"MakerNoteSafety\",\n\t\t0xC640 : \"RawImageSegmentation\",\n\t\t0xC65A : \"CalibrationIlluminant1\",\n\t\t0xC65B : \"CalibrationIlluminant2\",\n\t\t0xC65C : \"BestQualityScale\",\n\t\t0xC65D : \"RawDataUniqueID\",\n\t\t0xC660 : \"AliasLayerMetadata\",\n\t\t0xC68B : \"OriginalRawFileName\",\n\t\t0xC68C : \"OriginalRawFileData\",\n\t\t0xC68D : \"ActiveArea\",\n\t\t0xC68E : \"MaskedAreas\",\n\t\t0xC68F : \"AsShotICCProfile\",\n\t\t0xC690 : \"AsShotPreProfileMatrix\",\n\t\t0xC691 : \"CurrentICCProfile\",\n\t\t0xC692 : \"CurrentPreProfileMatrix\",\n\t\t0xC6BF : \"ColorimetricReference\",\n\t\t0xC6D2 : \"PanasonicTitle\",\n\t\t0xC6D3 : \"PanasonicTitle2\",\n\t\t0xC6F3 : \"CameraCalibrationSig\",\n\t\t0xC6F4 : \"ProfileCalibrationSig\",\n\t\t0xC6F5 : \"ProfileIFD\",\n\t\t0xC6F6 : \"AsShotProfileName\",\n\t\t0xC6F7 : \"NoiseReductionApplied\",\n\t\t0xC6F8 : \"ProfileName\",\n\t\t0xC6F9 : \"ProfileHueSatMapDims\",\n\t\t0xC6FA : \"ProfileHueSatMapData1\",\n\t\t0xC6FB : \"ProfileHueSatMapData2\",\n\t\t0xC6FC : \"ProfileToneCurve\",\n\t\t0xC6FD : \"ProfileEmbedPolicy\",\n\t\t0xC6FE : \"ProfileCopyright\",\n\t\t0xC714 : \"ForwardMatrix1\",\n\t\t0xC715 : \"ForwardMatrix2\",\n\t\t0xC716 : \"PreviewApplicationName\",\n\t\t0xC717 : \"PreviewApplicationVersion\",\n\t\t0xC718 : \"PreviewSettingsName\",\n\t\t0xC719 : \"PreviewSettingsDigest\",\n\t\t0xC71A : \"PreviewColorSpace\",\n\t\t0xC71B : \"PreviewDateTime\",\n\t\t0xC71C : \"RawImageDigest\",\n\t\t0xC71D : \"OriginalRawFileDigest\",\n\t\t0xC71E : \"SubTileBlockSize\",\n\t\t0xC71F : \"RowInterleaveFactor\",\n\t\t0xC725 : \"ProfileLookTableDims\",\n\t\t0xC726 : \"ProfileLookTableData\",\n\t\t0xC740 : \"OpcodeList1\",\n\t\t0xC741 : \"OpcodeList2\",\n\t\t0xC74E : \"OpcodeList3\",\n\t\t0xC761 : \"NoiseProfile\",\n\t\t0xC763 : \"TimeCodes\",\n\t\t0xC764 : \"FrameRate\",\n\t\t0xC772 : \"TStop\",\n\t\t0xC789 : \"ReelName\",\n\t\t0xC791 : \"OriginalDefaultFinalSize\",\n\t\t0xC792 : \"OriginalBestQualitySize\",\n\t\t0xC793 : \"OriginalDefaultCropSize\",\n\t\t0xC7A1 : \"CameraLabel\",\n\t\t0xC7A3 : \"ProfileHueSatMapEncoding\",\n\t\t0xC7A4 : \"ProfileLookTableEncoding\",\n\t\t0xC7A5 : \"BaselineExposureOffset\",\n\t\t0xC7A6 : \"DefaultBlackRender\",\n\t\t0xC7A7 : \"NewRawImageDigest\",\n\t\t0xC7A8 : \"RawToPreviewGain\",\n\t\t0xC7B5 : \"DefaultUserCrop\",\n\t\t0xEA1C : \"Padding\",\n\t\t0xEA1D : \"OffsetSchema\",\n\t\t0xFDE8 : \"OwnerName\",\n\t\t0xFDE9 : \"SerialNumber\",\n\t\t0xFDEA : \"Lens\",\n\t\t0xFE00 : \"KDC_IFD\",\n\t\t0xFE4C : \"RawFile\",\n\t\t0xFE4D : \"Converter\",\n\t\t0xFE4E : \"WhiteBalance\",\n\t\t0xFE51 : \"Exposure\",\n\t\t0xFE52 : \"Shadows\",\n\t\t0xFE53 : \"Brightness\",\n\t\t0xFE54 : \"Contrast\",\n\t\t0xFE55 : \"Saturation\",\n\t\t0xFE56 : \"Sharpness\",\n\t\t0xFE57 : \"Smoothness\",\n\t\t0xFE58 : \"MoireFilter\"\n\t\t\n\t},\n\tgps : {\t\n\t\t0x0000 : 'GPSVersionID',\n\t\t0x0001 : 'GPSLatitudeRef',\n\t\t0x0002 : 'GPSLatitude',\n\t\t0x0003 : 'GPSLongitudeRef',\n\t\t0x0004 : 'GPSLongitude',\n\t\t0x0005 : 'GPSAltitudeRef',\n\t\t0x0006 : 'GPSAltitude',\n\t\t0x0007 : 'GPSTimeStamp',\n\t\t0x0008 : 'GPSSatellites',\n\t\t0x0009 : 'GPSStatus',\n\t\t0x000A : 'GPSMeasureMode',\n\t\t0x000B : 'GPSDOP',\n\t\t0x000C : 'GPSSpeedRef',\n\t\t0x000D : 'GPSSpeed',\n\t\t0x000E : 'GPSTrackRef',\n\t\t0x000F : 'GPSTrack',\n\t\t0x0010 : 'GPSImgDirectionRef',\n\t\t0x0011 : 'GPSImgDirection',\n\t\t0x0012 : 'GPSMapDatum',\n\t\t0x0013 : 'GPSDestLatitudeRef',\n\t\t0x0014 : 'GPSDestLatitude',\n\t\t0x0015 : 'GPSDestLongitudeRef',\n\t\t0x0016 : 'GPSDestLongitude',\n\t\t0x0017 : 'GPSDestBearingRef',\n\t\t0x0018 : 'GPSDestBearing',\n\t\t0x0019 : 'GPSDestDistanceRef',\n\t\t0x001A : 'GPSDestDistance',\n\t\t0x001B : 'GPSProcessingMethod',\n\t\t0x001C : 'GPSAreaInformation',\n\t\t0x001D : 'GPSDateStamp',\n\t\t0x001E : 'GPSDifferential',\n\t\t0x001F : 'GPSHPositioningError'\n\t}\n};","/*jslint browser: true, devel: true, bitwise: false, debug: true, eqeq: false, es5: true, evil: false, forin: false, newcap: false, nomen: true, plusplus: true, regexp: false, unparam: false, sloppy: true, stupid: false, sub: false, todo: true, vars: true, white: true */\n\nfunction readExifValue(format, stream) {\n\tswitch(format) {\n\t\tcase 1: return stream.nextUInt8();\n\t\tcase 3: return stream.nextUInt16();\n\t\tcase 4: return stream.nextUInt32();\n\t\tcase 5: return [stream.nextUInt32(), stream.nextUInt32()];\n\t\tcase 6: return stream.nextInt8();\n\t\tcase 8: return stream.nextUInt16();\n\t\tcase 9: return stream.nextUInt32();\n\t\tcase 10: return [stream.nextInt32(), stream.nextInt32()];\n\t\tcase 11: return stream.nextFloat();\n\t\tcase 12: return stream.nextDouble();\n\t\tdefault: throw new Error('Invalid format while decoding: ' + format);\n\t}\n}\n\nfunction getBytesPerComponent(format) {\n\tswitch(format) {\n\t\tcase 1:\n\t\tcase 2:\n\t\tcase 6:\n\t\tcase 7:\n\t\t\treturn 1;\n\t\tcase 3:\n\t\tcase 8:\n\t\t\treturn 2;\n\t\tcase 4:\n\t\tcase 9:\n\t\tcase 11:\n\t\t\treturn 4;\n\t\tcase 5:\n\t\tcase 10:\n\t\tcase 12:\n\t\t\treturn 8;\n\t\tdefault:\n\t\t\treturn 0;\n\t}\n}\n\nfunction readExifTag(tiffMarker, stream) {\n\tvar tagType = stream.nextUInt16(),\n\t\tformat = stream.nextUInt16(),\n\t\tbytesPerComponent = getBytesPerComponent(format),\n\t\tcomponents = stream.nextUInt32(),\n\t\tvalueBytes = bytesPerComponent * components,\n\t\tvalues,\n\t\tvalue,\n\t\tc;\n\n\t/* if the value is bigger then 4 bytes, the value is in the data section of the IFD\n\tand the value present in the tag is the offset starting from the tiff header. So we replace the stream\n\twith a stream that is located at the given offset in the data section. s*/\n\tif(valueBytes > 4) {\n\t\tstream = tiffMarker.openWithOffset(stream.nextUInt32());\n\t}\n\t//we don't want to read strings as arrays\n\tif(format === 2) {\n\t\tvalues = stream.nextString(components);\n\t\t//cut off \\0 characters\n\t\tvar lastNull = values.indexOf('\\0');\n\t\tif(lastNull !== -1) {\n\t\t\tvalues = values.substr(0, lastNull);\n\t\t}\n\t}\n\telse if(format === 7) {\n\t\tvalues = stream.nextBuffer(components);\n\t}\n\telse if(format !== 0) {\n\t\tvalues = [];\n\t\tfor(c = 0; c < components; ++c) {\n\t\t\tvalues.push(readExifValue(format, stream));\n\t\t}\n\t}\n\t//since our stream is a stateful object, we need to skip remaining bytes\n\t//so our offset stays correct\n\tif(valueBytes < 4) {\n\t\tstream.skip(4 - valueBytes);\n\t}\n\n\treturn [tagType, values, format];\n}\n\nfunction readIFDSection(tiffMarker, stream, iterator) {\n\tvar numberOfEntries = stream.nextUInt16(), tag, i;\n\tfor(i = 0; i < numberOfEntries; ++i) {\n\t\ttag = readExifTag(tiffMarker, stream);\n\t\titerator(tag[0], tag[1], tag[2]);\n\t}\n}\n\nfunction readHeader(stream) {\n\tvar exifHeader = stream.nextString(6);\n\tif(exifHeader !== 'Exif\\0\\0') {\n\t\tthrow new Error('Invalid EXIF header');\n\t}\n\n\tvar tiffMarker = stream.mark();\n\tvar tiffHeader = stream.nextUInt16();\n\tif(tiffHeader === 0x4949) {\n\t\tstream.setBigEndian(false);\n\t} else if(tiffHeader === 0x4D4D) {\n\t\tstream.setBigEndian(true);\n\t} else {\n\t\tthrow new Error('Invalid TIFF header');\n\t}\n\tif(stream.nextUInt16() !== 0x002A) {\n\t\tthrow new Error('Invalid TIFF data');\n\t}\n\treturn tiffMarker;\n}\n\nmodule.exports = {\n\tIFD0: 1,\n\tIFD1: 2,\n\tGPSIFD: 3,\n\tSubIFD: 4,\n\tInteropIFD: 5,\n\tparseTags: function(stream, iterator) {\n\t\tvar tiffMarker;\n\t\ttry {\n\t\t\ttiffMarker = readHeader(stream);\n\t\t} catch(e) {\n\t\t\treturn false;\t//ignore APP1 sections with invalid headers\n\t\t}\n\t\tvar subIfdOffset, gpsOffset, interopOffset;\n\t\tvar ifd0Stream = tiffMarker.openWithOffset(stream.nextUInt32()),\n\t\t\tIFD0 = this.IFD0;\n\t\treadIFDSection(tiffMarker, ifd0Stream, function(tagType, value, format) {\n\t\t\tswitch(tagType) {\n\t\t\t\tcase 0x8825: gpsOffset = value[0]; break;\n\t\t\t\tcase 0x8769: subIfdOffset = value[0]; break;\n\t\t\t\tdefault: iterator(IFD0, tagType, value, format); break;\n\t\t\t}\n\t\t});\n\t\tvar ifd1Offset = ifd0Stream.nextUInt32();\n\t\tif(ifd1Offset !== 0) {\n\t\t\tvar ifd1Stream = tiffMarker.openWithOffset(ifd1Offset);\n\t\t\treadIFDSection(tiffMarker, ifd1Stream, iterator.bind(null, this.IFD1));\n\t\t}\n\n\t\tif(gpsOffset) {\n\t\t\tvar gpsStream = tiffMarker.openWithOffset(gpsOffset);\n\t\t\treadIFDSection(tiffMarker, gpsStream, iterator.bind(null, this.GPSIFD));\n\t\t}\n\n\t\tif(subIfdOffset) {\n\t\t\tvar subIfdStream = tiffMarker.openWithOffset(subIfdOffset), InteropIFD = this.InteropIFD;\n\t\t\treadIFDSection(tiffMarker, subIfdStream, function(tagType, value, format) {\n\t\t\t\tif(tagType === 0xA005) {\n\t\t\t\t\tinteropOffset = value[0];\n\t\t\t\t} else {\n\t\t\t\t\titerator(InteropIFD, tagType, value, format);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tif(interopOffset) {\n\t\t\tvar interopStream = tiffMarker.openWithOffset(interopOffset);\n\t\t\treadIFDSection(tiffMarker, interopStream, iterator.bind(null, this.InteropIFD));\n\t\t}\n\t\treturn true;\n\t}\n};","/*jslint browser: true, devel: true, bitwise: false, debug: true, eqeq: false, es5: true, evil: false, forin: false, newcap: false, nomen: true, plusplus: true, regexp: false, unparam: false, sloppy: true, stupid: false, sub: false, todo: true, vars: true, white: true */\n\nmodule.exports = {\n\tparseSections: function(stream, iterator) {\n\t\tvar len, markerType;\n\t\tstream.setBigEndian(true);\n\t\t//stop reading the stream at the SOS (Start of Stream) marker,\n\t\t//because its length is not stored in the header so we can't\n\t\t//know where to jump to. The only marker after that is just EOI (End Of Image) anyway\n\t\twhile(stream.remainingLength() > 0 && markerType !== 0xDA) {\n\t\t\tif(stream.nextUInt8() !== 0xFF) {\n\t\t\t\tthrow new Error('Invalid JPEG section offset');\n\t\t\t}\n\t\t\tmarkerType = stream.nextUInt8();\n\t\t\t//don't read size from markers that have no datas\n\t\t\tif((markerType >= 0xD0 && markerType <= 0xD9) || markerType === 0xDA) {\n\t\t\t\tlen = 0;\n\t\t\t} else {\n\t\t\t\tlen = stream.nextUInt16() - 2;\n\t\t\t}\n\t\t\titerator(markerType, stream.branch(0, len));\n\t\t\tstream.skip(len);\n\t\t}\n\t},\n\t//stream should be located after SOF section size and in big endian mode, like passed to parseSections iterator\n\tgetSizeFromSOFSection: function(stream) {\n\t\tstream.skip(1);\n\t\treturn {\n\t\t\theight: stream.nextUInt16(),\n\t\t\twidth: stream.nextUInt16()\n\t\t};\n\t},\n\tgetSectionName: function(markerType) {\n\t\tvar name, index;\n\t\tswitch(markerType) {\n\t\t\tcase 0xD8: name = 'SOI'; break;\n\t\t\tcase 0xC4: name = 'DHT'; break;\n\t\t\tcase 0xDB: name = 'DQT'; break;\n\t\t\tcase 0xDD: name = 'DRI'; break;\n\t\t\tcase 0xDA: name = 'SOS'; break;\n\t\t\tcase 0xFE: name = 'COM'; break;\n\t\t\tcase 0xD9: name = 'EOI'; break;\n\t\t\tdefault:\n\t\t\t\tif(markerType >= 0xE0 && markerType <= 0xEF) {\n\t\t\t\t\tname = 'APP';\n\t\t\t\t\tindex = markerType - 0xE0;\n\t\t\t\t}\n\t\t\t\telse if(markerType >= 0xC0 && markerType <= 0xCF && markerType !== 0xC4 && markerType !== 0xC8 && markerType !== 0xCC) {\n\t\t\t\t\tname = 'SOF';\n\t\t\t\t\tindex = markerType - 0xC0;\n\t\t\t\t}\n\t\t\t\telse if(markerType >= 0xD0 && markerType <= 0xD7) {\n\t\t\t\t\tname = 'RST';\n\t\t\t\t\tindex = markerType - 0xD0;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t\tvar nameStruct = {\n\t\t\tname: name\n\t\t};\n\t\tif(typeof index === 'number') {\n\t\t\tnameStruct.index = index;\n\t\t}\n\t\treturn nameStruct;\n\t}\n};","/*jslint browser: true, devel: true, bitwise: false, debug: true, eqeq: false, es5: true, evil: false, forin: false, newcap: false, nomen: true, plusplus: true, regexp: false, unparam: false, sloppy: true, stupid: false, sub: false, todo: true, vars: true, white: true */\n\nvar jpeg = require('./jpeg'),\n\texif = require('./exif'),\n\tsimplify = require('./simplify');\n\nfunction ExifResult(startMarker, tags, imageSize, thumbnailOffset, thumbnailLength, thumbnailType, app1Offset) {\n\tthis.startMarker = startMarker;\n\tthis.tags = tags;\n\tthis.imageSize = imageSize;\n\tthis.thumbnailOffset = thumbnailOffset;\n\tthis.thumbnailLength = thumbnailLength;\n\tthis.thumbnailType = thumbnailType;\n\tthis.app1Offset = app1Offset;\n}\n\nExifResult.prototype = {\n\thasThumbnail: function(mime) {\n\t\tif(!this.thumbnailOffset || !this.thumbnailLength) {\n\t\t\treturn false;\n\t\t}\n\t\tif(typeof mime !== 'string') {\n\t\t\treturn true;\n\t\t}\n\t\tif(mime.toLowerCase().trim() === 'image/jpeg') {\n\t\t\treturn this.thumbnailType === 6;\n\t\t}\n\t\tif(mime.toLowerCase().trim() === 'image/tiff') {\n\t\t\treturn this.thumbnailType === 1;\n\t\t}\n\t\treturn false;\n\t},\n\tgetThumbnailOffset: function() {\n\t\treturn this.app1Offset + 6 + this.thumbnailOffset;\n\t},\n\tgetThumbnailLength: function() {\n\t\treturn this.thumbnailLength;\n\t},\n\tgetThumbnailBuffer: function() {\n\t\treturn this._getThumbnailStream().nextBuffer(this.thumbnailLength);\n\t},\n\t_getThumbnailStream: function() {\n\t\treturn this.startMarker.openWithOffset(this.getThumbnailOffset());\n\t},\n\tgetImageSize: function() {\n\t\treturn this.imageSize;\n\t},\n\tgetThumbnailSize: function() {\n\t\tvar stream = this._getThumbnailStream(), size;\n\t\tjpeg.parseSections(stream, function(sectionType, sectionStream) {\n\t\t\tif(jpeg.getSectionName(sectionType).name === 'SOF') {\n\t\t\t\tsize = jpeg.getSizeFromSOFSection(sectionStream);\n\t\t\t}\n\t\t});\n\t\treturn size;\n\t}\n};\n\nfunction Parser(stream) {\n\tthis.stream = stream;\n\tthis.flags = {\n\t\treadBinaryTags: false,\n\t\tresolveTagNames: true,\n\t\tsimplifyValues: true,\n\t\timageSize: true,\n\t\thidePointers: true,\n\t\treturnTags: true\n\t};\n}\n\nParser.prototype = {\n\tenableBinaryFields: function(enable) {\n\t\tthis.flags.readBinaryTags = !!enable;\n\t\treturn this;\n\t},\n\tenablePointers: function(enable) {\n\t\tthis.flags.hidePointers = !enable;\n\t\treturn this;\n\t},\n\tenableTagNames: function(enable) {\n\t\tthis.flags.resolveTagNames = !!enable;\n\t\treturn this;\n\t},\n\tenableImageSize: function(enable) {\n\t\tthis.flags.imageSize = !!enable;\n\t\treturn this;\n\t},\n\tenableReturnTags: function(enable) {\n\t\tthis.flags.returnTags = !!enable;\n\t\treturn this;\n\t},\n\tenableSimpleValues: function(enable) {\n\t\tthis.flags.simplifyValues = !!enable;\n\t\treturn this;\n\t},\n\tparse: function() {\n\t\tvar start = this.stream.mark(),\n\t\t\tstream = start.openWithOffset(0),\n\t\t\tflags = this.flags,\n\t\t\ttags,\n\t\t\timageSize,\n\t\t\tthumbnailOffset,\n\t\t\tthumbnailLength,\n\t\t\tthumbnailType,\n\t\t\tapp1Offset,\n\t\t\ttagNames,\n\t\t\tgetTagValue, setTagValue;\n\t\tif(flags.resolveTagNames) {\n\t\t\ttagNames = require('./exif-tags');\n\t\t}\n\t\tif(flags.resolveTagNames) {\n\t\t\ttags = {};\n\t\t\tgetTagValue = function(t) {\n\t\t\t\treturn tags[t.name];\n\t\t\t};\n\t\t\tsetTagValue = function(t, value) {\n\t\t\t\ttags[t.name] = value;\n\t\t\t};\n\t\t} else {\n\t\t\ttags = [];\n\t\t\tgetTagValue = function(t) {\n\t\t\t\tvar i;\n\t\t\t\tfor(i = 0; i < tags.length; ++i) {\n\t\t\t\t\tif(tags[i].type === t.type && tags[i].section === t.section) {\n\t\t\t\t\t\treturn tags.value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t\tsetTagValue = function(t, value) {\n\t\t\t\tvar i;\n\t\t\t\tfor(i = 0; i < tags.length; ++i) {\n\t\t\t\t\tif(tags[i].type === t.type && tags[i].section === t.section) {\n\t\t\t\t\t\ttags.value = value;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\tjpeg.parseSections(stream, function(sectionType, sectionStream) {\n\t\t\tvar validExifHeaders, sectionOffset = sectionStream.offsetFrom(start);\n\t\t\tif(sectionType === 0xE1) {\n\t\t\t\tvalidExifHeaders = exif.parseTags(sectionStream, function(ifdSection, tagType, value, format) {\n\t\t\t\t\t//ignore binary fields if disabled\n\t\t\t\t\tif(!flags.readBinaryTags && format === 7) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(tagType === 0x0201) {\n\t\t\t\t\t\tthumbnailOffset = value[0];\n\t\t\t\t\t\tif(flags.hidePointers) {return;}\n\t\t\t\t\t} else if(tagType === 0x0202) {\n\t\t\t\t\t\tthumbnailLength = value[0];\n\t\t\t\t\t\tif(flags.hidePointers) {return;}\n\t\t\t\t\t} else if(tagType === 0x0103) {\n\t\t\t\t\t\tthumbnailType = value[0];\n\t\t\t\t\t\tif(flags.hidePointers) {return;}\n\t\t\t\t\t}\n\t\t\t\t\t//if flag is set to not store tags, return here after storing pointers\n\t\t\t\t\tif(!flags.returnTags) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(flags.simplifyValues) {\n\t\t\t\t\t\tvalue = simplify.simplifyValue(value, format);\n\t\t\t\t\t}\n\t\t\t\t\tif(flags.resolveTagNames) {\n\t\t\t\t\t\tvar sectionTagNames = ifdSection === exif.GPSIFD ? tagNames.gps : tagNames.exif;\n\t\t\t\t\t\tvar name = sectionTagNames[tagType];\n\t\t\t\t\t\tif(!name) {\n\t\t\t\t\t\t\tname = tagNames.exif[tagType];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!tags.hasOwnProperty(name)) {\n\t\t\t\t\t\t\ttags[name] = value;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttags.push({\n\t\t\t\t\t\t\tsection: ifdSection,\n\t\t\t\t\t\t\ttype: tagType,\n\t\t\t\t\t\t\tvalue: value\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tif(validExifHeaders) {\n\t\t\t\t\tapp1Offset = sectionOffset;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if(flags.imageSize && jpeg.getSectionName(sectionType).name === 'SOF') {\n\t\t\t\timageSize = jpeg.getSizeFromSOFSection(sectionStream);\n\t\t\t}\n\t\t});\n\n\t\tif(flags.simplifyValues) {\n\t\t\tsimplify.castDegreeValues(getTagValue, setTagValue);\n\t\t\tsimplify.castDateValues(getTagValue, setTagValue);\n\t\t}\n\n\t\treturn new ExifResult(start, tags, imageSize, thumbnailOffset, thumbnailLength, thumbnailType, app1Offset);\n\t}\n};\n\n\n\nmodule.exports = Parser;\n","var exif = require('./exif');\nvar date = require('./date');\n\nvar degreeTags = [{\n\tsection: exif.GPSIFD,\n\ttype: 0x0002,\n\tname: 'GPSLatitude',\n\trefType: 0x0001,\n\trefName: 'GPSLatitudeRef',\n\tposVal: 'N'\n},\n{\n\tsection: exif.GPSIFD,\n\ttype: 0x0004,\n\tname: 'GPSLongitude',\n\trefType: 0x0003,\n\trefName: 'GPSLongitudeRef',\n\tposVal: 'E'\n}];\nvar dateTags = [{\n\tsection: exif.SubIFD,\n\ttype: 0x0132,\n\tname: 'ModifyDate'\n},\n{\n\tsection: exif.SubIFD,\n\ttype: 0x9003,\n\tname: 'DateTimeOriginal'\n},\n{\n\tsection: exif.SubIFD,\n\ttype: 0x9004,\n\tname: 'CreateDate'\n},\n{\n\tsection: exif.SubIFD,\n\ttype: 0x0132,\n\tname : 'ModifyDate',\n}];\n\nmodule.exports = {\n\tcastDegreeValues: function(getTagValue, setTagValue) {\n\t\tdegreeTags.forEach(function(t) {\n\t\t\tvar degreeVal = getTagValue(t);\n\t\t\tif(degreeVal) {\n\t\t\t\tvar degreeRef = getTagValue({section: t.section, type: t.refType, name: t.refName});\n\t\t\t\tvar degreeNumRef = degreeRef === t.posVal ? 1 : -1;\n\t\t\t\tvar degree = (degreeVal[0] + (degreeVal[1] / 60) + (degreeVal[2] / 3600)) * degreeNumRef;\n\t\t\t\tsetTagValue(t, degree);\n\t\t\t}\n\t\t});\n\t},\n\tcastDateValues: function(getTagValue, setTagValue) {\n\t\tdateTags.forEach(function(t) {\n\t\t\tvar dateStrVal = getTagValue(t);\n\t\t\tif(dateStrVal) {\n\t\t\t\t//some easy checks to determine two common date formats\n\t\t\t\tvar timestamp = date.parseExifDate(dateStrVal);\n\t\t\t\tif(typeof timestamp !== 'undefined') {\n\t\t\t\t\tsetTagValue(t, timestamp);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t},\n\tsimplifyValue: function(values, format) {\n\t\tif(Array.isArray(values)) {\n\t\t\tvalues = values.map(function(value) {\n\t\t\t\tif(format === 10 || format === 5) {\n\t\t\t\t\treturn value[0] / value[1];\n\t\t\t\t}\n\t\t\t\treturn value;\n\t\t\t});\n\t\t\tif(values.length === 1) {\n\t\t\t\tvalues = values[0];\n\t\t\t}\n\t\t}\n\t\treturn values;\n\t}\n};\n","'use strict';\nconst Token = require('token-types');\nconst strtok3 = require('strtok3/lib/core');\nconst {\n\tstringToBytes,\n\ttarHeaderChecksumMatches,\n\tuint32SyncSafeToken\n} = require('./util');\nconst supported = require('./supported');\n\nconst minimumBytes = 4100; // A fair amount of file-types are detectable within this range\n\nasync function fromStream(stream) {\n\tconst tokenizer = await strtok3.fromStream(stream);\n\ttry {\n\t\treturn await fromTokenizer(tokenizer);\n\t} finally {\n\t\tawait tokenizer.close();\n\t}\n}\n\nasync function fromBuffer(input) {\n\tif (!(input instanceof Uint8Array || input instanceof ArrayBuffer || Buffer.isBuffer(input))) {\n\t\tthrow new TypeError(`Expected the \\`input\\` argument to be of type \\`Uint8Array\\` or \\`Buffer\\` or \\`ArrayBuffer\\`, got \\`${typeof input}\\``);\n\t}\n\n\tconst buffer = input instanceof Buffer ? input : Buffer.from(input);\n\n\tif (!(buffer && buffer.length > 1)) {\n\t\treturn;\n\t}\n\n\tconst tokenizer = strtok3.fromBuffer(buffer);\n\treturn fromTokenizer(tokenizer);\n}\n\nfunction _check(buffer, headers, options) {\n\toptions = {\n\t\toffset: 0,\n\t\t...options\n\t};\n\n\tfor (const [index, header] of headers.entries()) {\n\t\t// If a bitmask is set\n\t\tif (options.mask) {\n\t\t\t// If header doesn't equal `buf` with bits masked off\n\t\t\tif (header !== (options.mask[index] & buffer[index + options.offset])) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} else if (header !== buffer[index + options.offset]) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\nasync function fromTokenizer(tokenizer) {\n\ttry {\n\t\treturn _fromTokenizer(tokenizer);\n\t} catch (error) {\n\t\tif (!(error instanceof strtok3.EndOfStreamError)) {\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n\nasync function _fromTokenizer(tokenizer) {\n\tlet buffer = Buffer.alloc(minimumBytes);\n\tconst bytesRead = 12;\n\tconst check = (header, options) => _check(buffer, header, options);\n\tconst checkString = (header, options) => check(stringToBytes(header), options);\n\n\t// Keep reading until EOF if the file size is unknown.\n\tif (!tokenizer.fileInfo.size) {\n\t\ttokenizer.fileInfo.size = Number.MAX_SAFE_INTEGER;\n\t}\n\n\tawait tokenizer.peekBuffer(buffer, {length: bytesRead, mayBeLess: true});\n\n\t// -- 2-byte signatures --\n\n\tif (check([0x42, 0x4D])) {\n\t\treturn {\n\t\t\text: 'bmp',\n\t\t\tmime: 'image/bmp'\n\t\t};\n\t}\n\n\tif (check([0x0B, 0x77])) {\n\t\treturn {\n\t\t\text: 'ac3',\n\t\t\tmime: 'audio/vnd.dolby.dd-raw'\n\t\t};\n\t}\n\n\tif (check([0x78, 0x01])) {\n\t\treturn {\n\t\t\text: 'dmg',\n\t\t\tmime: 'application/x-apple-diskimage'\n\t\t};\n\t}\n\n\tif (check([0x4D, 0x5A])) {\n\t\treturn {\n\t\t\text: 'exe',\n\t\t\tmime: 'application/x-msdownload'\n\t\t};\n\t}\n\n\tif (check([0x25, 0x21])) {\n\t\tawait tokenizer.peekBuffer(buffer, {length: 24, mayBeLess: true});\n\n\t\tif (checkString('PS-Adobe-', {offset: 2}) &&\n\t\t\tcheckString(' EPSF-', {offset: 14})) {\n\t\t\treturn {\n\t\t\t\text: 'eps',\n\t\t\t\tmime: 'application/eps'\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\text: 'ps',\n\t\t\tmime: 'application/postscript'\n\t\t};\n\t}\n\n\tif (\n\t\tcheck([0x1F, 0xA0]) ||\n\t\tcheck([0x1F, 0x9D])\n\t) {\n\t\treturn {\n\t\t\text: 'Z',\n\t\t\tmime: 'application/x-compress'\n\t\t};\n\t}\n\n\t// -- 3-byte signatures --\n\n\tif (check([0xFF, 0xD8, 0xFF])) {\n\t\treturn {\n\t\t\text: 'jpg',\n\t\t\tmime: 'image/jpeg'\n\t\t};\n\t}\n\n\tif (check([0x49, 0x49, 0xBC])) {\n\t\treturn {\n\t\t\text: 'jxr',\n\t\t\tmime: 'image/vnd.ms-photo'\n\t\t};\n\t}\n\n\tif (check([0x1F, 0x8B, 0x8])) {\n\t\treturn {\n\t\t\text: 'gz',\n\t\t\tmime: 'application/gzip'\n\t\t};\n\t}\n\n\tif (check([0x42, 0x5A, 0x68])) {\n\t\treturn {\n\t\t\text: 'bz2',\n\t\t\tmime: 'application/x-bzip2'\n\t\t};\n\t}\n\n\tif (checkString('ID3')) {\n\t\tawait tokenizer.ignore(6); // Skip ID3 header until the header size\n\t\tconst id3HeaderLen = await tokenizer.readToken(uint32SyncSafeToken);\n\t\tif (tokenizer.position + id3HeaderLen > tokenizer.fileInfo.size) {\n\t\t\t// Guess file type based on ID3 header for backward compatibility\n\t\t\treturn {\n\t\t\t\text: 'mp3',\n\t\t\t\tmime: 'audio/mpeg'\n\t\t\t};\n\t\t}\n\n\t\tawait tokenizer.ignore(id3HeaderLen);\n\t\treturn fromTokenizer(tokenizer); // Skip ID3 header, recursion\n\t}\n\n\t// Musepack, SV7\n\tif (checkString('MP+')) {\n\t\treturn {\n\t\t\text: 'mpc',\n\t\t\tmime: 'audio/x-musepack'\n\t\t};\n\t}\n\n\tif (\n\t\t(buffer[0] === 0x43 || buffer[0] === 0x46) &&\n\t\tcheck([0x57, 0x53], {offset: 1})\n\t) {\n\t\treturn {\n\t\t\text: 'swf',\n\t\t\tmime: 'application/x-shockwave-flash'\n\t\t};\n\t}\n\n\t// -- 4-byte signatures --\n\n\tif (check([0x47, 0x49, 0x46])) {\n\t\treturn {\n\t\t\text: 'gif',\n\t\t\tmime: 'image/gif'\n\t\t};\n\t}\n\n\tif (checkString('FLIF')) {\n\t\treturn {\n\t\t\text: 'flif',\n\t\t\tmime: 'image/flif'\n\t\t};\n\t}\n\n\tif (checkString('8BPS')) {\n\t\treturn {\n\t\t\text: 'psd',\n\t\t\tmime: 'image/vnd.adobe.photoshop'\n\t\t};\n\t}\n\n\tif (checkString('WEBP', {offset: 8})) {\n\t\treturn {\n\t\t\text: 'webp',\n\t\t\tmime: 'image/webp'\n\t\t};\n\t}\n\n\t// Musepack, SV8\n\tif (checkString('MPCK')) {\n\t\treturn {\n\t\t\text: 'mpc',\n\t\t\tmime: 'audio/x-musepack'\n\t\t};\n\t}\n\n\tif (checkString('FORM')) {\n\t\treturn {\n\t\t\text: 'aif',\n\t\t\tmime: 'audio/aiff'\n\t\t};\n\t}\n\n\tif (checkString('icns', {offset: 0})) {\n\t\treturn {\n\t\t\text: 'icns',\n\t\t\tmime: 'image/icns'\n\t\t};\n\t}\n\n\t// Zip-based file formats\n\t// Need to be before the `zip` check\n\tif (check([0x50, 0x4B, 0x3, 0x4])) { // Local file header signature\n\t\ttry {\n\t\t\twhile (tokenizer.position + 30 < tokenizer.fileInfo.size) {\n\t\t\t\tawait tokenizer.readBuffer(buffer, {length: 30});\n\n\t\t\t\t// https://en.wikipedia.org/wiki/Zip_(file_format)#File_headers\n\t\t\t\tconst zipHeader = {\n\t\t\t\t\tcompressedSize: buffer.readUInt32LE(18),\n\t\t\t\t\tuncompressedSize: buffer.readUInt32LE(22),\n\t\t\t\t\tfilenameLength: buffer.readUInt16LE(26),\n\t\t\t\t\textraFieldLength: buffer.readUInt16LE(28)\n\t\t\t\t};\n\n\t\t\t\tzipHeader.filename = await tokenizer.readToken(new Token.StringType(zipHeader.filenameLength, 'utf-8'));\n\t\t\t\tawait tokenizer.ignore(zipHeader.extraFieldLength);\n\n\t\t\t\t// Assumes signed `.xpi` from addons.mozilla.org\n\t\t\t\tif (zipHeader.filename === 'META-INF/mozilla.rsa') {\n\t\t\t\t\treturn {\n\t\t\t\t\t\text: 'xpi',\n\t\t\t\t\t\tmime: 'application/x-xpinstall'\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tif (zipHeader.filename.endsWith('.rels') || zipHeader.filename.endsWith('.xml')) {\n\t\t\t\t\tconst type = zipHeader.filename.split('/')[0];\n\t\t\t\t\tswitch (type) {\n\t\t\t\t\t\tcase '_rels':\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'word':\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\text: 'docx',\n\t\t\t\t\t\t\t\tmime: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\tcase 'ppt':\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\text: 'pptx',\n\t\t\t\t\t\t\t\tmime: 'application/vnd.openxmlformats-officedocument.presentationml.presentation'\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\tcase 'xl':\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\text: 'xlsx',\n\t\t\t\t\t\t\t\tmime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (zipHeader.filename.startsWith('xl/')) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\text: 'xlsx',\n\t\t\t\t\t\tmime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tif (zipHeader.filename.startsWith('3D/') && zipHeader.filename.endsWith('.model')) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\text: '3mf',\n\t\t\t\t\t\tmime: 'model/3mf'\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\t// The docx, xlsx and pptx file types extend the Office Open XML file format:\n\t\t\t\t// https://en.wikipedia.org/wiki/Office_Open_XML_file_formats\n\t\t\t\t// We look for:\n\t\t\t\t// - one entry named '[Content_Types].xml' or '_rels/.rels',\n\t\t\t\t// - one entry indicating specific type of file.\n\t\t\t\t// MS Office, OpenOffice and LibreOffice may put the parts in different order, so the check should not rely on it.\n\t\t\t\tif (zipHeader.filename === 'mimetype' && zipHeader.compressedSize === zipHeader.uncompressedSize) {\n\t\t\t\t\tconst mimeType = await tokenizer.readToken(new Token.StringType(zipHeader.compressedSize, 'utf-8'));\n\n\t\t\t\t\tswitch (mimeType) {\n\t\t\t\t\t\tcase 'application/epub+zip':\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\text: 'epub',\n\t\t\t\t\t\t\t\tmime: 'application/epub+zip'\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\tcase 'application/vnd.oasis.opendocument.text':\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\text: 'odt',\n\t\t\t\t\t\t\t\tmime: 'application/vnd.oasis.opendocument.text'\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\tcase 'application/vnd.oasis.opendocument.spreadsheet':\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\text: 'ods',\n\t\t\t\t\t\t\t\tmime: 'application/vnd.oasis.opendocument.spreadsheet'\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\tcase 'application/vnd.oasis.opendocument.presentation':\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\text: 'odp',\n\t\t\t\t\t\t\t\tmime: 'application/vnd.oasis.opendocument.presentation'\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Try to find next header manually when current one is corrupted\n\t\t\t\tif (zipHeader.compressedSize === 0) {\n\t\t\t\t\tlet nextHeaderIndex = -1;\n\n\t\t\t\t\twhile (nextHeaderIndex < 0 && (tokenizer.position < tokenizer.fileInfo.size)) {\n\t\t\t\t\t\tawait tokenizer.peekBuffer(buffer, {mayBeLess: true});\n\n\t\t\t\t\t\tnextHeaderIndex = buffer.indexOf('504B0304', 0, 'hex');\n\t\t\t\t\t\t// Move position to the next header if found, skip the whole buffer otherwise\n\t\t\t\t\t\tawait tokenizer.ignore(nextHeaderIndex >= 0 ? nextHeaderIndex : buffer.length);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tawait tokenizer.ignore(zipHeader.compressedSize);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (!(error instanceof strtok3.EndOfStreamError)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\text: 'zip',\n\t\t\tmime: 'application/zip'\n\t\t};\n\t}\n\n\tif (checkString('OggS')) {\n\t\t// This is an OGG container\n\t\tawait tokenizer.ignore(28);\n\t\tconst type = Buffer.alloc(8);\n\t\tawait tokenizer.readBuffer(type);\n\n\t\t// Needs to be before `ogg` check\n\t\tif (_check(type, [0x4F, 0x70, 0x75, 0x73, 0x48, 0x65, 0x61, 0x64])) {\n\t\t\treturn {\n\t\t\t\text: 'opus',\n\t\t\t\tmime: 'audio/opus'\n\t\t\t};\n\t\t}\n\n\t\t// If ' theora' in header.\n\t\tif (_check(type, [0x80, 0x74, 0x68, 0x65, 0x6F, 0x72, 0x61])) {\n\t\t\treturn {\n\t\t\t\text: 'ogv',\n\t\t\t\tmime: 'video/ogg'\n\t\t\t};\n\t\t}\n\n\t\t// If '\\x01video' in header.\n\t\tif (_check(type, [0x01, 0x76, 0x69, 0x64, 0x65, 0x6F, 0x00])) {\n\t\t\treturn {\n\t\t\t\text: 'ogm',\n\t\t\t\tmime: 'video/ogg'\n\t\t\t};\n\t\t}\n\n\t\t// If ' FLAC' in header https://xiph.org/flac/faq.html\n\t\tif (_check(type, [0x7F, 0x46, 0x4C, 0x41, 0x43])) {\n\t\t\treturn {\n\t\t\t\text: 'oga',\n\t\t\t\tmime: 'audio/ogg'\n\t\t\t};\n\t\t}\n\n\t\t// 'Speex ' in header https://en.wikipedia.org/wiki/Speex\n\t\tif (_check(type, [0x53, 0x70, 0x65, 0x65, 0x78, 0x20, 0x20])) {\n\t\t\treturn {\n\t\t\t\text: 'spx',\n\t\t\t\tmime: 'audio/ogg'\n\t\t\t};\n\t\t}\n\n\t\t// If '\\x01vorbis' in header\n\t\tif (_check(type, [0x01, 0x76, 0x6F, 0x72, 0x62, 0x69, 0x73])) {\n\t\t\treturn {\n\t\t\t\text: 'ogg',\n\t\t\t\tmime: 'audio/ogg'\n\t\t\t};\n\t\t}\n\n\t\t// Default OGG container https://www.iana.org/assignments/media-types/application/ogg\n\t\treturn {\n\t\t\text: 'ogx',\n\t\t\tmime: 'application/ogg'\n\t\t};\n\t}\n\n\tif (\n\t\tcheck([0x50, 0x4B]) &&\n\t\t(buffer[2] === 0x3 || buffer[2] === 0x5 || buffer[2] === 0x7) &&\n\t\t(buffer[3] === 0x4 || buffer[3] === 0x6 || buffer[3] === 0x8)\n\t) {\n\t\treturn {\n\t\t\text: 'zip',\n\t\t\tmime: 'application/zip'\n\t\t};\n\t}\n\n\t//\n\n\t// File Type Box (https://en.wikipedia.org/wiki/ISO_base_media_file_format)\n\t// It's not required to be first, but it's recommended to be. Almost all ISO base media files start with `ftyp` box.\n\t// `ftyp` box must contain a brand major identifier, which must consist of ISO 8859-1 printable characters.\n\t// Here we check for 8859-1 printable characters (for simplicity, it's a mask which also catches one non-printable character).\n\tif (\n\t\tcheckString('ftyp', {offset: 4}) &&\n\t\t(buffer[8] & 0x60) !== 0x00 // Brand major, first character ASCII?\n\t) {\n\t\t// They all can have MIME `video/mp4` except `application/mp4` special-case which is hard to detect.\n\t\t// For some cases, we're specific, everything else falls to `video/mp4` with `mp4` extension.\n\t\tconst brandMajor = buffer.toString('binary', 8, 12).replace('\\0', ' ').trim();\n\t\tswitch (brandMajor) {\n\t\t\tcase 'avif':\n\t\t\t\treturn {ext: 'avif', mime: 'image/avif'};\n\t\t\tcase 'mif1':\n\t\t\t\treturn {ext: 'heic', mime: 'image/heif'};\n\t\t\tcase 'msf1':\n\t\t\t\treturn {ext: 'heic', mime: 'image/heif-sequence'};\n\t\t\tcase 'heic':\n\t\t\tcase 'heix':\n\t\t\t\treturn {ext: 'heic', mime: 'image/heic'};\n\t\t\tcase 'hevc':\n\t\t\tcase 'hevx':\n\t\t\t\treturn {ext: 'heic', mime: 'image/heic-sequence'};\n\t\t\tcase 'qt':\n\t\t\t\treturn {ext: 'mov', mime: 'video/quicktime'};\n\t\t\tcase 'M4V':\n\t\t\tcase 'M4VH':\n\t\t\tcase 'M4VP':\n\t\t\t\treturn {ext: 'm4v', mime: 'video/x-m4v'};\n\t\t\tcase 'M4P':\n\t\t\t\treturn {ext: 'm4p', mime: 'video/mp4'};\n\t\t\tcase 'M4B':\n\t\t\t\treturn {ext: 'm4b', mime: 'audio/mp4'};\n\t\t\tcase 'M4A':\n\t\t\t\treturn {ext: 'm4a', mime: 'audio/x-m4a'};\n\t\t\tcase 'F4V':\n\t\t\t\treturn {ext: 'f4v', mime: 'video/mp4'};\n\t\t\tcase 'F4P':\n\t\t\t\treturn {ext: 'f4p', mime: 'video/mp4'};\n\t\t\tcase 'F4A':\n\t\t\t\treturn {ext: 'f4a', mime: 'audio/mp4'};\n\t\t\tcase 'F4B':\n\t\t\t\treturn {ext: 'f4b', mime: 'audio/mp4'};\n\t\t\tcase 'crx':\n\t\t\t\treturn {ext: 'cr3', mime: 'image/x-canon-cr3'};\n\t\t\tdefault:\n\t\t\t\tif (brandMajor.startsWith('3g')) {\n\t\t\t\t\tif (brandMajor.startsWith('3g2')) {\n\t\t\t\t\t\treturn {ext: '3g2', mime: 'video/3gpp2'};\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {ext: '3gp', mime: 'video/3gpp'};\n\t\t\t\t}\n\n\t\t\t\treturn {ext: 'mp4', mime: 'video/mp4'};\n\t\t}\n\t}\n\n\tif (checkString('MThd')) {\n\t\treturn {\n\t\t\text: 'mid',\n\t\t\tmime: 'audio/midi'\n\t\t};\n\t}\n\n\tif (\n\t\tcheckString('wOFF') &&\n\t\t(\n\t\t\tcheck([0x00, 0x01, 0x00, 0x00], {offset: 4}) ||\n\t\t\tcheckString('OTTO', {offset: 4})\n\t\t)\n\t) {\n\t\treturn {\n\t\t\text: 'woff',\n\t\t\tmime: 'font/woff'\n\t\t};\n\t}\n\n\tif (\n\t\tcheckString('wOF2') &&\n\t\t(\n\t\t\tcheck([0x00, 0x01, 0x00, 0x00], {offset: 4}) ||\n\t\t\tcheckString('OTTO', {offset: 4})\n\t\t)\n\t) {\n\t\treturn {\n\t\t\text: 'woff2',\n\t\t\tmime: 'font/woff2'\n\t\t};\n\t}\n\n\tif (check([0xD4, 0xC3, 0xB2, 0xA1]) || check([0xA1, 0xB2, 0xC3, 0xD4])) {\n\t\treturn {\n\t\t\text: 'pcap',\n\t\t\tmime: 'application/vnd.tcpdump.pcap'\n\t\t};\n\t}\n\n\t// Sony DSD Stream File (DSF)\n\tif (checkString('DSD ')) {\n\t\treturn {\n\t\t\text: 'dsf',\n\t\t\tmime: 'audio/x-dsf' // Non-standard\n\t\t};\n\t}\n\n\tif (checkString('LZIP')) {\n\t\treturn {\n\t\t\text: 'lz',\n\t\t\tmime: 'application/x-lzip'\n\t\t};\n\t}\n\n\tif (checkString('fLaC')) {\n\t\treturn {\n\t\t\text: 'flac',\n\t\t\tmime: 'audio/x-flac'\n\t\t};\n\t}\n\n\tif (check([0x42, 0x50, 0x47, 0xFB])) {\n\t\treturn {\n\t\t\text: 'bpg',\n\t\t\tmime: 'image/bpg'\n\t\t};\n\t}\n\n\tif (checkString('wvpk')) {\n\t\treturn {\n\t\t\text: 'wv',\n\t\t\tmime: 'audio/wavpack'\n\t\t};\n\t}\n\n\tif (checkString('%PDF')) {\n\t\tawait tokenizer.ignore(1350);\n\t\tconst maxBufferSize = 10 * 1024 * 1024;\n\t\tconst buffer = Buffer.alloc(Math.min(maxBufferSize, tokenizer.fileInfo.size));\n\t\tawait tokenizer.readBuffer(buffer, {mayBeLess: true});\n\n\t\t// Check if this is an Adobe Illustrator file\n\t\tif (buffer.includes(Buffer.from('AIPrivateData'))) {\n\t\t\treturn {\n\t\t\t\text: 'ai',\n\t\t\t\tmime: 'application/postscript'\n\t\t\t};\n\t\t}\n\n\t\t// Assume this is just a normal PDF\n\t\treturn {\n\t\t\text: 'pdf',\n\t\t\tmime: 'application/pdf'\n\t\t};\n\t}\n\n\tif (check([0x00, 0x61, 0x73, 0x6D])) {\n\t\treturn {\n\t\t\text: 'wasm',\n\t\t\tmime: 'application/wasm'\n\t\t};\n\t}\n\n\t// TIFF, little-endian type\n\tif (check([0x49, 0x49, 0x2A, 0x0])) {\n\t\tif (checkString('CR', {offset: 8})) {\n\t\t\treturn {\n\t\t\t\text: 'cr2',\n\t\t\t\tmime: 'image/x-canon-cr2'\n\t\t\t};\n\t\t}\n\n\t\tif (check([0x1C, 0x00, 0xFE, 0x00], {offset: 8}) || check([0x1F, 0x00, 0x0B, 0x00], {offset: 8})) {\n\t\t\treturn {\n\t\t\t\text: 'nef',\n\t\t\t\tmime: 'image/x-nikon-nef'\n\t\t\t};\n\t\t}\n\n\t\tif (\n\t\t\tcheck([0x08, 0x00, 0x00, 0x00], {offset: 4}) &&\n\t\t\t(check([0x2D, 0x00, 0xFE, 0x00], {offset: 8}) ||\n\t\t\t\tcheck([0x27, 0x00, 0xFE, 0x00], {offset: 8}))\n\t\t) {\n\t\t\treturn {\n\t\t\t\text: 'dng',\n\t\t\t\tmime: 'image/x-adobe-dng'\n\t\t\t};\n\t\t}\n\n\t\tbuffer = Buffer.alloc(24);\n\t\tawait tokenizer.peekBuffer(buffer);\n\t\tif (\n\t\t\t(check([0x10, 0xFB, 0x86, 0x01], {offset: 4}) || check([0x08, 0x00, 0x00, 0x00], {offset: 4})) &&\n\t\t\t// This pattern differentiates ARW from other TIFF-ish file types:\n\t\t\tcheck([0x00, 0xFE, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x01], {offset: 9})\n\t\t) {\n\t\t\treturn {\n\t\t\t\text: 'arw',\n\t\t\t\tmime: 'image/x-sony-arw'\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\text: 'tif',\n\t\t\tmime: 'image/tiff'\n\t\t};\n\t}\n\n\t// TIFF, big-endian type\n\tif (check([0x4D, 0x4D, 0x0, 0x2A])) {\n\t\treturn {\n\t\t\text: 'tif',\n\t\t\tmime: 'image/tiff'\n\t\t};\n\t}\n\n\tif (checkString('MAC ')) {\n\t\treturn {\n\t\t\text: 'ape',\n\t\t\tmime: 'audio/ape'\n\t\t};\n\t}\n\n\t// https://github.com/threatstack/libmagic/blob/master/magic/Magdir/matroska\n\tif (check([0x1A, 0x45, 0xDF, 0xA3])) { // Root element: EBML\n\t\tasync function readField() {\n\t\t\tconst msb = await tokenizer.peekNumber(Token.UINT8);\n\t\t\tlet mask = 0x80;\n\t\t\tlet ic = 0; // 0 = A, 1 = B, 2 = C, 3 = D\n\n\t\t\twhile ((msb & mask) === 0 && mask !== 0) {\n\t\t\t\t++ic;\n\t\t\t\tmask >>= 1;\n\t\t\t}\n\n\t\t\tconst id = Buffer.alloc(ic + 1);\n\t\t\tawait tokenizer.readBuffer(id);\n\t\t\treturn id;\n\t\t}\n\n\t\tasync function readElement() {\n\t\t\tconst id = await readField();\n\t\t\tconst lenField = await readField();\n\t\t\tlenField[0] ^= 0x80 >> (lenField.length - 1);\n\t\t\tconst nrLen = Math.min(6, lenField.length); // JavaScript can max read 6 bytes integer\n\t\t\treturn {\n\t\t\t\tid: id.readUIntBE(0, id.length),\n\t\t\t\tlen: lenField.readUIntBE(lenField.length - nrLen, nrLen)\n\t\t\t};\n\t\t}\n\n\t\tasync function readChildren(level, children) {\n\t\t\twhile (children > 0) {\n\t\t\t\tconst e = await readElement();\n\t\t\t\tif (e.id === 0x4282) {\n\t\t\t\t\treturn tokenizer.readToken(new Token.StringType(e.len, 'utf-8')); // Return DocType\n\t\t\t\t}\n\n\t\t\t\tawait tokenizer.ignore(e.len); // ignore payload\n\t\t\t\t--children;\n\t\t\t}\n\t\t}\n\n\t\tconst re = await readElement();\n\t\tconst docType = await readChildren(1, re.len);\n\n\t\tswitch (docType) {\n\t\t\tcase 'webm':\n\t\t\t\treturn {\n\t\t\t\t\text: 'webm',\n\t\t\t\t\tmime: 'video/webm'\n\t\t\t\t};\n\n\t\t\tcase 'matroska':\n\t\t\t\treturn {\n\t\t\t\t\text: 'mkv',\n\t\t\t\t\tmime: 'video/x-matroska'\n\t\t\t\t};\n\n\t\t\tdefault:\n\t\t\t\treturn;\n\t\t}\n\t}\n\n\t// RIFF file format which might be AVI, WAV, QCP, etc\n\tif (check([0x52, 0x49, 0x46, 0x46])) {\n\t\tif (check([0x41, 0x56, 0x49], {offset: 8})) {\n\t\t\treturn {\n\t\t\t\text: 'avi',\n\t\t\t\tmime: 'video/vnd.avi'\n\t\t\t};\n\t\t}\n\n\t\tif (check([0x57, 0x41, 0x56, 0x45], {offset: 8})) {\n\t\t\treturn {\n\t\t\t\text: 'wav',\n\t\t\t\tmime: 'audio/vnd.wave'\n\t\t\t};\n\t\t}\n\n\t\t// QLCM, QCP file\n\t\tif (check([0x51, 0x4C, 0x43, 0x4D], {offset: 8})) {\n\t\t\treturn {\n\t\t\t\text: 'qcp',\n\t\t\t\tmime: 'audio/qcelp'\n\t\t\t};\n\t\t}\n\t}\n\n\tif (checkString('SQLi')) {\n\t\treturn {\n\t\t\text: 'sqlite',\n\t\t\tmime: 'application/x-sqlite3'\n\t\t};\n\t}\n\n\tif (check([0x4E, 0x45, 0x53, 0x1A])) {\n\t\treturn {\n\t\t\text: 'nes',\n\t\t\tmime: 'application/x-nintendo-nes-rom'\n\t\t};\n\t}\n\n\tif (checkString('Cr24')) {\n\t\treturn {\n\t\t\text: 'crx',\n\t\t\tmime: 'application/x-google-chrome-extension'\n\t\t};\n\t}\n\n\tif (\n\t\tcheckString('MSCF') ||\n\t\tcheckString('ISc(')\n\t) {\n\t\treturn {\n\t\t\text: 'cab',\n\t\t\tmime: 'application/vnd.ms-cab-compressed'\n\t\t};\n\t}\n\n\tif (check([0xED, 0xAB, 0xEE, 0xDB])) {\n\t\treturn {\n\t\t\text: 'rpm',\n\t\t\tmime: 'application/x-rpm'\n\t\t};\n\t}\n\n\tif (check([0xC5, 0xD0, 0xD3, 0xC6])) {\n\t\treturn {\n\t\t\text: 'eps',\n\t\t\tmime: 'application/eps'\n\t\t};\n\t}\n\n\tif (check([0x28, 0xB5, 0x2F, 0xFD])) {\n\t\treturn {\n\t\t\text: 'zst',\n\t\t\tmime: 'application/zstd'\n\t\t};\n\t}\n\n\t// -- 5-byte signatures --\n\n\tif (check([0x4F, 0x54, 0x54, 0x4F, 0x00])) {\n\t\treturn {\n\t\t\text: 'otf',\n\t\t\tmime: 'font/otf'\n\t\t};\n\t}\n\n\tif (checkString('#!AMR')) {\n\t\treturn {\n\t\t\text: 'amr',\n\t\t\tmime: 'audio/amr'\n\t\t};\n\t}\n\n\tif (checkString('{\\\\rtf')) {\n\t\treturn {\n\t\t\text: 'rtf',\n\t\t\tmime: 'application/rtf'\n\t\t};\n\t}\n\n\tif (check([0x46, 0x4C, 0x56, 0x01])) {\n\t\treturn {\n\t\t\text: 'flv',\n\t\t\tmime: 'video/x-flv'\n\t\t};\n\t}\n\n\tif (checkString('IMPM')) {\n\t\treturn {\n\t\t\text: 'it',\n\t\t\tmime: 'audio/x-it'\n\t\t};\n\t}\n\n\tif (\n\t\tcheckString('-lh0-', {offset: 2}) ||\n\t\tcheckString('-lh1-', {offset: 2}) ||\n\t\tcheckString('-lh2-', {offset: 2}) ||\n\t\tcheckString('-lh3-', {offset: 2}) ||\n\t\tcheckString('-lh4-', {offset: 2}) ||\n\t\tcheckString('-lh5-', {offset: 2}) ||\n\t\tcheckString('-lh6-', {offset: 2}) ||\n\t\tcheckString('-lh7-', {offset: 2}) ||\n\t\tcheckString('-lzs-', {offset: 2}) ||\n\t\tcheckString('-lz4-', {offset: 2}) ||\n\t\tcheckString('-lz5-', {offset: 2}) ||\n\t\tcheckString('-lhd-', {offset: 2})\n\t) {\n\t\treturn {\n\t\t\text: 'lzh',\n\t\t\tmime: 'application/x-lzh-compressed'\n\t\t};\n\t}\n\n\t// MPEG program stream (PS or MPEG-PS)\n\tif (check([0x00, 0x00, 0x01, 0xBA])) {\n\t\t// MPEG-PS, MPEG-1 Part 1\n\t\tif (check([0x21], {offset: 4, mask: [0xF1]})) {\n\t\t\treturn {\n\t\t\t\text: 'mpg', // May also be .ps, .mpeg\n\t\t\t\tmime: 'video/MP1S'\n\t\t\t};\n\t\t}\n\n\t\t// MPEG-PS, MPEG-2 Part 1\n\t\tif (check([0x44], {offset: 4, mask: [0xC4]})) {\n\t\t\treturn {\n\t\t\t\text: 'mpg', // May also be .mpg, .m2p, .vob or .sub\n\t\t\t\tmime: 'video/MP2P'\n\t\t\t};\n\t\t}\n\t}\n\n\tif (checkString('ITSF')) {\n\t\treturn {\n\t\t\text: 'chm',\n\t\t\tmime: 'application/vnd.ms-htmlhelp'\n\t\t};\n\t}\n\n\t// -- 6-byte signatures --\n\n\tif (check([0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00])) {\n\t\treturn {\n\t\t\text: 'xz',\n\t\t\tmime: 'application/x-xz'\n\t\t};\n\t}\n\n\tif (checkString('')) {\n\t\tawait tokenizer.ignore(8);\n\t\tconst str = await tokenizer.readToken(new Token.StringType(13, 'ascii'));\n\t\tif (str === 'debian-binary') {\n\t\t\treturn {\n\t\t\t\text: 'deb',\n\t\t\t\tmime: 'application/x-deb'\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\text: 'ar',\n\t\t\tmime: 'application/x-unix-archive'\n\t\t};\n\t}\n\n\t// -- 8-byte signatures --\n\n\tif (check([0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A])) {\n\t\t// APNG format (https://wiki.mozilla.org/APNG_Specification)\n\t\t// 1. Find the first IDAT (image data) chunk (49 44 41 54)\n\t\t// 2. Check if there is an \"acTL\" chunk before the IDAT one (61 63 54 4C)\n\n\t\t// Offset calculated as follows:\n\t\t// - 8 bytes: PNG signature\n\t\t// - 4 (length) + 4 (chunk type) + 13 (chunk data) + 4 (CRC): IHDR chunk\n\n\t\tawait tokenizer.ignore(8); // ignore PNG signature\n\n\t\tasync function readChunkHeader() {\n\t\t\treturn {\n\t\t\t\tlength: await tokenizer.readToken(Token.INT32_BE),\n\t\t\t\ttype: await tokenizer.readToken(new Token.StringType(4, 'binary'))\n\t\t\t};\n\t\t}\n\n\t\tdo {\n\t\t\tconst chunk = await readChunkHeader();\n\t\t\tif (chunk.length < 0) {\n\t\t\t\treturn; // Invalid chunk length\n\t\t\t}\n\n\t\t\tswitch (chunk.type) {\n\t\t\t\tcase 'IDAT':\n\t\t\t\t\treturn {\n\t\t\t\t\t\text: 'png',\n\t\t\t\t\t\tmime: 'image/png'\n\t\t\t\t\t};\n\t\t\t\tcase 'acTL':\n\t\t\t\t\treturn {\n\t\t\t\t\t\text: 'apng',\n\t\t\t\t\t\tmime: 'image/apng'\n\t\t\t\t\t};\n\t\t\t\tdefault:\n\t\t\t\t\tawait tokenizer.ignore(chunk.length + 4); // Ignore chunk-data + CRC\n\t\t\t}\n\t\t} while (tokenizer.position + 8 < tokenizer.fileInfo.size);\n\n\t\treturn {\n\t\t\text: 'png',\n\t\t\tmime: 'image/png'\n\t\t};\n\t}\n\n\tif (check([0x41, 0x52, 0x52, 0x4F, 0x57, 0x31, 0x00, 0x00])) {\n\t\treturn {\n\t\t\text: 'arrow',\n\t\t\tmime: 'application/x-apache-arrow'\n\t\t};\n\t}\n\n\tif (check([0x67, 0x6C, 0x54, 0x46, 0x02, 0x00, 0x00, 0x00])) {\n\t\treturn {\n\t\t\text: 'glb',\n\t\t\tmime: 'model/gltf-binary'\n\t\t};\n\t}\n\n\t// `mov` format variants\n\tif (\n\t\tcheck([0x66, 0x72, 0x65, 0x65], {offset: 4}) || // `free`\n\t\tcheck([0x6D, 0x64, 0x61, 0x74], {offset: 4}) || // `mdat` MJPEG\n\t\tcheck([0x6D, 0x6F, 0x6F, 0x76], {offset: 4}) || // `moov`\n\t\tcheck([0x77, 0x69, 0x64, 0x65], {offset: 4}) // `wide`\n\t) {\n\t\treturn {\n\t\t\text: 'mov',\n\t\t\tmime: 'video/quicktime'\n\t\t};\n\t}\n\n\t// -- 9-byte signatures --\n\n\tif (check([0x49, 0x49, 0x52, 0x4F, 0x08, 0x00, 0x00, 0x00, 0x18])) {\n\t\treturn {\n\t\t\text: 'orf',\n\t\t\tmime: 'image/x-olympus-orf'\n\t\t};\n\t}\n\n\tif (checkString('gimp xcf ')) {\n\t\treturn {\n\t\t\text: 'xcf',\n\t\t\tmime: 'image/x-xcf'\n\t\t};\n\t}\n\n\t// -- 12-byte signatures --\n\n\tif (check([0x49, 0x49, 0x55, 0x00, 0x18, 0x00, 0x00, 0x00, 0x88, 0xE7, 0x74, 0xD8])) {\n\t\treturn {\n\t\t\text: 'rw2',\n\t\t\tmime: 'image/x-panasonic-rw2'\n\t\t};\n\t}\n\n\t// ASF_Header_Object first 80 bytes\n\tif (check([0x30, 0x26, 0xB2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xA6, 0xD9])) {\n\t\tasync function readHeader() {\n\t\t\tconst guid = Buffer.alloc(16);\n\t\t\tawait tokenizer.readBuffer(guid);\n\t\t\treturn {\n\t\t\t\tid: guid,\n\t\t\t\tsize: Number(await tokenizer.readToken(Token.UINT64_LE))\n\t\t\t};\n\t\t}\n\n\t\tawait tokenizer.ignore(30);\n\t\t// Search for header should be in first 1KB of file.\n\t\twhile (tokenizer.position + 24 < tokenizer.fileInfo.size) {\n\t\t\tconst header = await readHeader();\n\t\t\tlet payload = header.size - 24;\n\t\t\tif (_check(header.id, [0x91, 0x07, 0xDC, 0xB7, 0xB7, 0xA9, 0xCF, 0x11, 0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65])) {\n\t\t\t\t// Sync on Stream-Properties-Object (B7DC0791-A9B7-11CF-8EE6-00C00C205365)\n\t\t\t\tconst typeId = Buffer.alloc(16);\n\t\t\t\tpayload -= await tokenizer.readBuffer(typeId);\n\n\t\t\t\tif (_check(typeId, [0x40, 0x9E, 0x69, 0xF8, 0x4D, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B])) {\n\t\t\t\t\t// Found audio:\n\t\t\t\t\treturn {\n\t\t\t\t\t\text: 'asf',\n\t\t\t\t\t\tmime: 'audio/x-ms-asf'\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tif (_check(typeId, [0xC0, 0xEF, 0x19, 0xBC, 0x4D, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B])) {\n\t\t\t\t\t// Found video:\n\t\t\t\t\treturn {\n\t\t\t\t\t\text: 'asf',\n\t\t\t\t\t\tmime: 'video/x-ms-asf'\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tawait tokenizer.ignore(payload);\n\t\t}\n\n\t\t// Default to ASF generic extension\n\t\treturn {\n\t\t\text: 'asf',\n\t\t\tmime: 'application/vnd.ms-asf'\n\t\t};\n\t}\n\n\tif (check([0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A])) {\n\t\treturn {\n\t\t\text: 'ktx',\n\t\t\tmime: 'image/ktx'\n\t\t};\n\t}\n\n\tif ((check([0x7E, 0x10, 0x04]) || check([0x7E, 0x18, 0x04])) && check([0x30, 0x4D, 0x49, 0x45], {offset: 4})) {\n\t\treturn {\n\t\t\text: 'mie',\n\t\t\tmime: 'application/x-mie'\n\t\t};\n\t}\n\n\tif (check([0x27, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], {offset: 2})) {\n\t\treturn {\n\t\t\text: 'shp',\n\t\t\tmime: 'application/x-esri-shape'\n\t\t};\n\t}\n\n\tif (check([0x00, 0x00, 0x00, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A])) {\n\t\t// JPEG-2000 family\n\n\t\tawait tokenizer.ignore(20);\n\t\tconst type = await tokenizer.readToken(new Token.StringType(4, 'ascii'));\n\t\tswitch (type) {\n\t\t\tcase 'jp2 ':\n\t\t\t\treturn {\n\t\t\t\t\text: 'jp2',\n\t\t\t\t\tmime: 'image/jp2'\n\t\t\t\t};\n\t\t\tcase 'jpx ':\n\t\t\t\treturn {\n\t\t\t\t\text: 'jpx',\n\t\t\t\t\tmime: 'image/jpx'\n\t\t\t\t};\n\t\t\tcase 'jpm ':\n\t\t\t\treturn {\n\t\t\t\t\text: 'jpm',\n\t\t\t\t\tmime: 'image/jpm'\n\t\t\t\t};\n\t\t\tcase 'mjp2':\n\t\t\t\treturn {\n\t\t\t\t\text: 'mj2',\n\t\t\t\t\tmime: 'image/mj2'\n\t\t\t\t};\n\t\t\tdefault:\n\t\t\t\treturn;\n\t\t}\n\t}\n\n\tif (\n\t\tcheck([0xFF, 0x0A]) ||\n\t\tcheck([0x00, 0x00, 0x00, 0x0C, 0x4A, 0x58, 0x4C, 0x20, 0x0D, 0x0A, 0x87, 0x0A])\n\t) {\n\t\treturn {\n\t\t\text: 'jxl',\n\t\t\tmime: 'image/jxl'\n\t\t};\n\t}\n\n\t// -- Unsafe signatures --\n\n\tif (\n\t\tcheck([0x0, 0x0, 0x1, 0xBA]) ||\n\t\tcheck([0x0, 0x0, 0x1, 0xB3])\n\t) {\n\t\treturn {\n\t\t\text: 'mpg',\n\t\t\tmime: 'video/mpeg'\n\t\t};\n\t}\n\n\tif (check([0x00, 0x01, 0x00, 0x00, 0x00])) {\n\t\treturn {\n\t\t\text: 'ttf',\n\t\t\tmime: 'font/ttf'\n\t\t};\n\t}\n\n\tif (check([0x00, 0x00, 0x01, 0x00])) {\n\t\treturn {\n\t\t\text: 'ico',\n\t\t\tmime: 'image/x-icon'\n\t\t};\n\t}\n\n\tif (check([0x00, 0x00, 0x02, 0x00])) {\n\t\treturn {\n\t\t\text: 'cur',\n\t\t\tmime: 'image/x-icon'\n\t\t};\n\t}\n\n\tif (check([0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1])) {\n\t\t// Detected Microsoft Compound File Binary File (MS-CFB) Format.\n\t\treturn {\n\t\t\text: 'cfb',\n\t\t\tmime: 'application/x-cfb'\n\t\t};\n\t}\n\n\t// Increase sample size from 12 to 256.\n\tawait tokenizer.peekBuffer(buffer, {length: Math.min(256, tokenizer.fileInfo.size), mayBeLess: true});\n\n\t// -- 15-byte signatures --\n\n\tif (checkString('BEGIN:')) {\n\t\tif (checkString('VCARD', {offset: 6})) {\n\t\t\treturn {\n\t\t\t\text: 'vcf',\n\t\t\t\tmime: 'text/vcard'\n\t\t\t};\n\t\t}\n\n\t\tif (checkString('VCALENDAR', {offset: 6})) {\n\t\t\treturn {\n\t\t\t\text: 'ics',\n\t\t\t\tmime: 'text/calendar'\n\t\t\t};\n\t\t}\n\t}\n\n\t// `raf` is here just to keep all the raw image detectors together.\n\tif (checkString('FUJIFILMCCD-RAW')) {\n\t\treturn {\n\t\t\text: 'raf',\n\t\t\tmime: 'image/x-fujifilm-raf'\n\t\t};\n\t}\n\n\tif (checkString('Extended Module:')) {\n\t\treturn {\n\t\t\text: 'xm',\n\t\t\tmime: 'audio/x-xm'\n\t\t};\n\t}\n\n\tif (checkString('Creative Voice File')) {\n\t\treturn {\n\t\t\text: 'voc',\n\t\t\tmime: 'audio/x-voc'\n\t\t};\n\t}\n\n\tif (check([0x04, 0x00, 0x00, 0x00]) && buffer.length >= 16) { // Rough & quick check Pickle/ASAR\n\t\tconst jsonSize = buffer.readUInt32LE(12);\n\t\tif (jsonSize > 12 && buffer.length >= jsonSize + 16) {\n\t\t\ttry {\n\t\t\t\tconst header = buffer.slice(16, jsonSize + 16).toString();\n\t\t\t\tconst json = JSON.parse(header);\n\t\t\t\t// Check if Pickle is ASAR\n\t\t\t\tif (json.files) { // Final check, assuring Pickle/ASAR format\n\t\t\t\t\treturn {\n\t\t\t\t\t\text: 'asar',\n\t\t\t\t\t\tmime: 'application/x-asar'\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} catch (_) {\n\t\t\t}\n\t\t}\n\t}\n\n\tif (check([0x06, 0x0E, 0x2B, 0x34, 0x02, 0x05, 0x01, 0x01, 0x0D, 0x01, 0x02, 0x01, 0x01, 0x02])) {\n\t\treturn {\n\t\t\text: 'mxf',\n\t\t\tmime: 'application/mxf'\n\t\t};\n\t}\n\n\tif (checkString('SCRM', {offset: 44})) {\n\t\treturn {\n\t\t\text: 's3m',\n\t\t\tmime: 'audio/x-s3m'\n\t\t};\n\t}\n\n\tif (check([0x47], {offset: 4}) && (check([0x47], {offset: 192}) || check([0x47], {offset: 196}))) {\n\t\treturn {\n\t\t\text: 'mts',\n\t\t\tmime: 'video/mp2t'\n\t\t};\n\t}\n\n\tif (check([0x42, 0x4F, 0x4F, 0x4B, 0x4D, 0x4F, 0x42, 0x49], {offset: 60})) {\n\t\treturn {\n\t\t\text: 'mobi',\n\t\t\tmime: 'application/x-mobipocket-ebook'\n\t\t};\n\t}\n\n\tif (check([0x44, 0x49, 0x43, 0x4D], {offset: 128})) {\n\t\treturn {\n\t\t\text: 'dcm',\n\t\t\tmime: 'application/dicom'\n\t\t};\n\t}\n\n\tif (check([0x4C, 0x00, 0x00, 0x00, 0x01, 0x14, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46])) {\n\t\treturn {\n\t\t\text: 'lnk',\n\t\t\tmime: 'application/x.ms.shortcut' // Invented by us\n\t\t};\n\t}\n\n\tif (check([0x62, 0x6F, 0x6F, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x6D, 0x61, 0x72, 0x6B, 0x00, 0x00, 0x00, 0x00])) {\n\t\treturn {\n\t\t\text: 'alias',\n\t\t\tmime: 'application/x.apple.alias' // Invented by us\n\t\t};\n\t}\n\n\tif (\n\t\tcheck([0x4C, 0x50], {offset: 34}) &&\n\t\t(\n\t\t\tcheck([0x00, 0x00, 0x01], {offset: 8}) ||\n\t\t\tcheck([0x01, 0x00, 0x02], {offset: 8}) ||\n\t\t\tcheck([0x02, 0x00, 0x02], {offset: 8})\n\t\t)\n\t) {\n\t\treturn {\n\t\t\text: 'eot',\n\t\t\tmime: 'application/vnd.ms-fontobject'\n\t\t};\n\t}\n\n\tif (check([0x06, 0x06, 0xED, 0xF5, 0xD8, 0x1D, 0x46, 0xE5, 0xBD, 0x31, 0xEF, 0xE7, 0xFE, 0x74, 0xB7, 0x1D])) {\n\t\treturn {\n\t\t\text: 'indd',\n\t\t\tmime: 'application/x-indesign'\n\t\t};\n\t}\n\n\t// Increase sample size from 256 to 512\n\tawait tokenizer.peekBuffer(buffer, {length: Math.min(512, tokenizer.fileInfo.size), mayBeLess: true});\n\n\t// Requires a buffer size of 512 bytes\n\tif (tarHeaderChecksumMatches(buffer)) {\n\t\treturn {\n\t\t\text: 'tar',\n\t\t\tmime: 'application/x-tar'\n\t\t};\n\t}\n\n\tif (check([0xFF, 0xFE, 0xFF, 0x0E, 0x53, 0x00, 0x6B, 0x00, 0x65, 0x00, 0x74, 0x00, 0x63, 0x00, 0x68, 0x00, 0x55, 0x00, 0x70, 0x00, 0x20, 0x00, 0x4D, 0x00, 0x6F, 0x00, 0x64, 0x00, 0x65, 0x00, 0x6C, 0x00])) {\n\t\treturn {\n\t\t\text: 'skp',\n\t\t\tmime: 'application/vnd.sketchup.skp'\n\t\t};\n\t}\n\n\tif (checkString('-----BEGIN PGP MESSAGE-----')) {\n\t\treturn {\n\t\t\text: 'pgp',\n\t\t\tmime: 'application/pgp-encrypted'\n\t\t};\n\t}\n\n\t// Check MPEG 1 or 2 Layer 3 header, or 'layer 0' for ADTS (MPEG sync-word 0xFFE)\n\tif (buffer.length >= 2 && check([0xFF, 0xE0], {offset: 0, mask: [0xFF, 0xE0]})) {\n\t\tif (check([0x10], {offset: 1, mask: [0x16]})) {\n\t\t\t// Check for (ADTS) MPEG-2\n\t\t\tif (check([0x08], {offset: 1, mask: [0x08]})) {\n\t\t\t\treturn {\n\t\t\t\t\text: 'aac',\n\t\t\t\t\tmime: 'audio/aac'\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// Must be (ADTS) MPEG-4\n\t\t\treturn {\n\t\t\t\text: 'aac',\n\t\t\t\tmime: 'audio/aac'\n\t\t\t};\n\t\t}\n\n\t\t// MPEG 1 or 2 Layer 3 header\n\t\t// Check for MPEG layer 3\n\t\tif (check([0x02], {offset: 1, mask: [0x06]})) {\n\t\t\treturn {\n\t\t\t\text: 'mp3',\n\t\t\t\tmime: 'audio/mpeg'\n\t\t\t};\n\t\t}\n\n\t\t// Check for MPEG layer 2\n\t\tif (check([0x04], {offset: 1, mask: [0x06]})) {\n\t\t\treturn {\n\t\t\t\text: 'mp2',\n\t\t\t\tmime: 'audio/mpeg'\n\t\t\t};\n\t\t}\n\n\t\t// Check for MPEG layer 1\n\t\tif (check([0x06], {offset: 1, mask: [0x06]})) {\n\t\t\treturn {\n\t\t\t\text: 'mp1',\n\t\t\t\tmime: 'audio/mpeg'\n\t\t\t};\n\t\t}\n\t}\n}\n\nconst stream = readableStream => new Promise((resolve, reject) => {\n\t// Using `eval` to work around issues when bundling with Webpack\n\tconst stream = eval('require')('stream'); // eslint-disable-line no-eval\n\n\treadableStream.on('error', reject);\n\treadableStream.once('readable', async () => {\n\t\t// Set up output stream\n\t\tconst pass = new stream.PassThrough();\n\t\tlet outputStream;\n\t\tif (stream.pipeline) {\n\t\t\toutputStream = stream.pipeline(readableStream, pass, () => {\n\t\t\t});\n\t\t} else {\n\t\t\toutputStream = readableStream.pipe(pass);\n\t\t}\n\n\t\t// Read the input stream and detect the filetype\n\t\tconst chunk = readableStream.read(minimumBytes) || readableStream.read() || Buffer.alloc(0);\n\t\ttry {\n\t\t\tconst fileType = await fromBuffer(chunk);\n\t\t\tpass.fileType = fileType;\n\t\t} catch (error) {\n\t\t\treject(error);\n\t\t}\n\n\t\tresolve(outputStream);\n\t});\n});\n\nconst fileType = {\n\tfromStream,\n\tfromTokenizer,\n\tfromBuffer,\n\tstream\n};\n\nObject.defineProperty(fileType, 'extensions', {\n\tget() {\n\t\treturn new Set(supported.extensions);\n\t}\n});\n\nObject.defineProperty(fileType, 'mimeTypes', {\n\tget() {\n\t\treturn new Set(supported.mimeTypes);\n\t}\n});\n\nmodule.exports = fileType;\n","'use strict';\nconst strtok3 = require('strtok3');\nconst core = require('./core');\n\nasync function fromFile(path) {\n\tconst tokenizer = await strtok3.fromFile(path);\n\ttry {\n\t\treturn await core.fromTokenizer(tokenizer);\n\t} finally {\n\t\tawait tokenizer.close();\n\t}\n}\n\nconst fileType = {\n\tfromFile\n};\n\nObject.assign(fileType, core);\n\nObject.defineProperty(fileType, 'extensions', {\n\tget() {\n\t\treturn core.extensions;\n\t}\n});\n\nObject.defineProperty(fileType, 'mimeTypes', {\n\tget() {\n\t\treturn core.mimeTypes;\n\t}\n});\n\nmodule.exports = fileType;\n","'use strict';\n\nmodule.exports = {\n\textensions: [\n\t\t'jpg',\n\t\t'png',\n\t\t'apng',\n\t\t'gif',\n\t\t'webp',\n\t\t'flif',\n\t\t'xcf',\n\t\t'cr2',\n\t\t'cr3',\n\t\t'orf',\n\t\t'arw',\n\t\t'dng',\n\t\t'nef',\n\t\t'rw2',\n\t\t'raf',\n\t\t'tif',\n\t\t'bmp',\n\t\t'icns',\n\t\t'jxr',\n\t\t'psd',\n\t\t'indd',\n\t\t'zip',\n\t\t'tar',\n\t\t'rar',\n\t\t'gz',\n\t\t'bz2',\n\t\t'7z',\n\t\t'dmg',\n\t\t'mp4',\n\t\t'mid',\n\t\t'mkv',\n\t\t'webm',\n\t\t'mov',\n\t\t'avi',\n\t\t'mpg',\n\t\t'mp2',\n\t\t'mp3',\n\t\t'm4a',\n\t\t'oga',\n\t\t'ogg',\n\t\t'ogv',\n\t\t'opus',\n\t\t'flac',\n\t\t'wav',\n\t\t'spx',\n\t\t'amr',\n\t\t'pdf',\n\t\t'epub',\n\t\t'exe',\n\t\t'swf',\n\t\t'rtf',\n\t\t'wasm',\n\t\t'woff',\n\t\t'woff2',\n\t\t'eot',\n\t\t'ttf',\n\t\t'otf',\n\t\t'ico',\n\t\t'flv',\n\t\t'ps',\n\t\t'xz',\n\t\t'sqlite',\n\t\t'nes',\n\t\t'crx',\n\t\t'xpi',\n\t\t'cab',\n\t\t'deb',\n\t\t'ar',\n\t\t'rpm',\n\t\t'Z',\n\t\t'lz',\n\t\t'cfb',\n\t\t'mxf',\n\t\t'mts',\n\t\t'blend',\n\t\t'bpg',\n\t\t'docx',\n\t\t'pptx',\n\t\t'xlsx',\n\t\t'3gp',\n\t\t'3g2',\n\t\t'jp2',\n\t\t'jpm',\n\t\t'jpx',\n\t\t'mj2',\n\t\t'aif',\n\t\t'qcp',\n\t\t'odt',\n\t\t'ods',\n\t\t'odp',\n\t\t'xml',\n\t\t'mobi',\n\t\t'heic',\n\t\t'cur',\n\t\t'ktx',\n\t\t'ape',\n\t\t'wv',\n\t\t'dcm',\n\t\t'ics',\n\t\t'glb',\n\t\t'pcap',\n\t\t'dsf',\n\t\t'lnk',\n\t\t'alias',\n\t\t'voc',\n\t\t'ac3',\n\t\t'm4v',\n\t\t'm4p',\n\t\t'm4b',\n\t\t'f4v',\n\t\t'f4p',\n\t\t'f4b',\n\t\t'f4a',\n\t\t'mie',\n\t\t'asf',\n\t\t'ogm',\n\t\t'ogx',\n\t\t'mpc',\n\t\t'arrow',\n\t\t'shp',\n\t\t'aac',\n\t\t'mp1',\n\t\t'it',\n\t\t's3m',\n\t\t'xm',\n\t\t'ai',\n\t\t'skp',\n\t\t'avif',\n\t\t'eps',\n\t\t'lzh',\n\t\t'pgp',\n\t\t'asar',\n\t\t'stl',\n\t\t'chm',\n\t\t'3mf',\n\t\t'zst',\n\t\t'jxl',\n\t\t'vcf'\n\t],\n\tmimeTypes: [\n\t\t'image/jpeg',\n\t\t'image/png',\n\t\t'image/gif',\n\t\t'image/webp',\n\t\t'image/flif',\n\t\t'image/x-xcf',\n\t\t'image/x-canon-cr2',\n\t\t'image/x-canon-cr3',\n\t\t'image/tiff',\n\t\t'image/bmp',\n\t\t'image/vnd.ms-photo',\n\t\t'image/vnd.adobe.photoshop',\n\t\t'application/x-indesign',\n\t\t'application/epub+zip',\n\t\t'application/x-xpinstall',\n\t\t'application/vnd.oasis.opendocument.text',\n\t\t'application/vnd.oasis.opendocument.spreadsheet',\n\t\t'application/vnd.oasis.opendocument.presentation',\n\t\t'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n\t\t'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n\t\t'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n\t\t'application/zip',\n\t\t'application/x-tar',\n\t\t'application/x-rar-compressed',\n\t\t'application/gzip',\n\t\t'application/x-bzip2',\n\t\t'application/x-7z-compressed',\n\t\t'application/x-apple-diskimage',\n\t\t'application/x-apache-arrow',\n\t\t'video/mp4',\n\t\t'audio/midi',\n\t\t'video/x-matroska',\n\t\t'video/webm',\n\t\t'video/quicktime',\n\t\t'video/vnd.avi',\n\t\t'audio/vnd.wave',\n\t\t'audio/qcelp',\n\t\t'audio/x-ms-asf',\n\t\t'video/x-ms-asf',\n\t\t'application/vnd.ms-asf',\n\t\t'video/mpeg',\n\t\t'video/3gpp',\n\t\t'audio/mpeg',\n\t\t'audio/mp4', // RFC 4337\n\t\t'audio/opus',\n\t\t'video/ogg',\n\t\t'audio/ogg',\n\t\t'application/ogg',\n\t\t'audio/x-flac',\n\t\t'audio/ape',\n\t\t'audio/wavpack',\n\t\t'audio/amr',\n\t\t'application/pdf',\n\t\t'application/x-msdownload',\n\t\t'application/x-shockwave-flash',\n\t\t'application/rtf',\n\t\t'application/wasm',\n\t\t'font/woff',\n\t\t'font/woff2',\n\t\t'application/vnd.ms-fontobject',\n\t\t'font/ttf',\n\t\t'font/otf',\n\t\t'image/x-icon',\n\t\t'video/x-flv',\n\t\t'application/postscript',\n\t\t'application/eps',\n\t\t'application/x-xz',\n\t\t'application/x-sqlite3',\n\t\t'application/x-nintendo-nes-rom',\n\t\t'application/x-google-chrome-extension',\n\t\t'application/vnd.ms-cab-compressed',\n\t\t'application/x-deb',\n\t\t'application/x-unix-archive',\n\t\t'application/x-rpm',\n\t\t'application/x-compress',\n\t\t'application/x-lzip',\n\t\t'application/x-cfb',\n\t\t'application/x-mie',\n\t\t'application/mxf',\n\t\t'video/mp2t',\n\t\t'application/x-blender',\n\t\t'image/bpg',\n\t\t'image/jp2',\n\t\t'image/jpx',\n\t\t'image/jpm',\n\t\t'image/mj2',\n\t\t'audio/aiff',\n\t\t'application/xml',\n\t\t'application/x-mobipocket-ebook',\n\t\t'image/heif',\n\t\t'image/heif-sequence',\n\t\t'image/heic',\n\t\t'image/heic-sequence',\n\t\t'image/icns',\n\t\t'image/ktx',\n\t\t'application/dicom',\n\t\t'audio/x-musepack',\n\t\t'text/calendar',\n\t\t'text/vcard',\n\t\t'model/gltf-binary',\n\t\t'application/vnd.tcpdump.pcap',\n\t\t'audio/x-dsf', // Non-standard\n\t\t'application/x.ms.shortcut', // Invented by us\n\t\t'application/x.apple.alias', // Invented by us\n\t\t'audio/x-voc',\n\t\t'audio/vnd.dolby.dd-raw',\n\t\t'audio/x-m4a',\n\t\t'image/apng',\n\t\t'image/x-olympus-orf',\n\t\t'image/x-sony-arw',\n\t\t'image/x-adobe-dng',\n\t\t'image/x-nikon-nef',\n\t\t'image/x-panasonic-rw2',\n\t\t'image/x-fujifilm-raf',\n\t\t'video/x-m4v',\n\t\t'video/3gpp2',\n\t\t'application/x-esri-shape',\n\t\t'audio/aac',\n\t\t'audio/x-it',\n\t\t'audio/x-s3m',\n\t\t'audio/x-xm',\n\t\t'video/MP1S',\n\t\t'video/MP2P',\n\t\t'application/vnd.sketchup.skp',\n\t\t'image/avif',\n\t\t'application/x-lzh-compressed',\n\t\t'application/pgp-encrypted',\n\t\t'application/x-asar',\n\t\t'model/stl',\n\t\t'application/vnd.ms-htmlhelp',\n\t\t'model/3mf',\n\t\t'image/jxl',\n\t\t'application/zstd'\n\t]\n};\n","'use strict';\n\nexports.stringToBytes = string => [...string].map(character => character.charCodeAt(0));\n\n/**\nChecks whether the TAR checksum is valid.\n\n@param {Buffer} buffer - The TAR header `[offset ... offset + 512]`.\n@param {number} offset - TAR header offset.\n@returns {boolean} `true` if the TAR checksum is valid, otherwise `false`.\n*/\nexports.tarHeaderChecksumMatches = (buffer, offset = 0) => {\n\tconst readSum = parseInt(buffer.toString('utf8', 148, 154).replace(/\\0.*$/, '').trim(), 8); // Read sum in header\n\tif (isNaN(readSum)) {\n\t\treturn false;\n\t}\n\n\tlet sum = 8 * 0x20; // Initialize signed bit sum\n\n\tfor (let i = offset; i < offset + 148; i++) {\n\t\tsum += buffer[i];\n\t}\n\n\tfor (let i = offset + 156; i < offset + 512; i++) {\n\t\tsum += buffer[i];\n\t}\n\n\treturn readSum === sum;\n};\n\n/**\nID3 UINT32 sync-safe tokenizer token.\n28 bits (representing up to 256MB) integer, the msb is 0 to avoid \"false syncsignals\".\n*/\nexports.uint32SyncSafeToken = {\n\tget: (buffer, offset) => {\n\t\treturn (buffer[offset + 3] & 0x7F) | ((buffer[offset + 2]) << 7) | ((buffer[offset + 1]) << 14) | ((buffer[offset]) << 21);\n\t},\n\tlen: 4\n};\n","'use strict';\n\nvar isCallable = require('is-callable');\n\nvar toStr = Object.prototype.toString;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nvar forEachArray = function forEachArray(array, iterator, receiver) {\n for (var i = 0, len = array.length; i < len; i++) {\n if (hasOwnProperty.call(array, i)) {\n if (receiver == null) {\n iterator(array[i], i, array);\n } else {\n iterator.call(receiver, array[i], i, array);\n }\n }\n }\n};\n\nvar forEachString = function forEachString(string, iterator, receiver) {\n for (var i = 0, len = string.length; i < len; i++) {\n // no such thing as a sparse string.\n if (receiver == null) {\n iterator(string.charAt(i), i, string);\n } else {\n iterator.call(receiver, string.charAt(i), i, string);\n }\n }\n};\n\nvar forEachObject = function forEachObject(object, iterator, receiver) {\n for (var k in object) {\n if (hasOwnProperty.call(object, k)) {\n if (receiver == null) {\n iterator(object[k], k, object);\n } else {\n iterator.call(receiver, object[k], k, object);\n }\n }\n }\n};\n\nvar forEach = function forEach(list, iterator, thisArg) {\n if (!isCallable(iterator)) {\n throw new TypeError('iterator must be a function');\n }\n\n var receiver;\n if (arguments.length >= 3) {\n receiver = thisArg;\n }\n\n if (toStr.call(list) === '[object Array]') {\n forEachArray(list, iterator, receiver);\n } else if (typeof list === 'string') {\n forEachString(list, iterator, receiver);\n } else {\n forEachObject(list, iterator, receiver);\n }\n};\n\nmodule.exports = forEach;\n","// (c) Dean McNamee , 2013.\n//\n// https://github.com/deanm/omggif\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to\n// deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n// sell copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n// IN THE SOFTWARE.\n//\n// omggif is a JavaScript implementation of a GIF 89a encoder and decoder,\n// including animation and compression. It does not rely on any specific\n// underlying system, so should run in the browser, Node, or Plask.\n\n\"use strict\";\n\nfunction GifWriter(buf, width, height, gopts) {\n var p = 0;\n\n var gopts = gopts === undefined ? { } : gopts;\n var loop_count = gopts.loop === undefined ? null : gopts.loop;\n var global_palette = gopts.palette === undefined ? null : gopts.palette;\n\n if (width <= 0 || height <= 0 || width > 65535 || height > 65535)\n throw new Error(\"Width/Height invalid.\");\n\n function check_palette_and_num_colors(palette) {\n var num_colors = palette.length;\n if (num_colors < 2 || num_colors > 256 || num_colors & (num_colors-1)) {\n throw new Error(\n \"Invalid code/color length, must be power of 2 and 2 .. 256.\");\n }\n return num_colors;\n }\n\n // - Header.\n buf[p++] = 0x47; buf[p++] = 0x49; buf[p++] = 0x46; // GIF\n buf[p++] = 0x38; buf[p++] = 0x39; buf[p++] = 0x61; // 89a\n\n // Handling of Global Color Table (palette) and background index.\n var gp_num_colors_pow2 = 0;\n var background = 0;\n if (global_palette !== null) {\n var gp_num_colors = check_palette_and_num_colors(global_palette);\n while (gp_num_colors >>= 1) ++gp_num_colors_pow2;\n gp_num_colors = 1 << gp_num_colors_pow2;\n --gp_num_colors_pow2;\n if (gopts.background !== undefined) {\n background = gopts.background;\n if (background >= gp_num_colors)\n throw new Error(\"Background index out of range.\");\n // The GIF spec states that a background index of 0 should be ignored, so\n // this is probably a mistake and you really want to set it to another\n // slot in the palette. But actually in the end most browsers, etc end\n // up ignoring this almost completely (including for dispose background).\n if (background === 0)\n throw new Error(\"Background index explicitly passed as 0.\");\n }\n }\n\n // - Logical Screen Descriptor.\n // NOTE(deanm): w/h apparently ignored by implementations, but set anyway.\n buf[p++] = width & 0xff; buf[p++] = width >> 8 & 0xff;\n buf[p++] = height & 0xff; buf[p++] = height >> 8 & 0xff;\n // NOTE: Indicates 0-bpp original color resolution (unused?).\n buf[p++] = (global_palette !== null ? 0x80 : 0) | // Global Color Table Flag.\n gp_num_colors_pow2; // NOTE: No sort flag (unused?).\n buf[p++] = background; // Background Color Index.\n buf[p++] = 0; // Pixel aspect ratio (unused?).\n\n // - Global Color Table\n if (global_palette !== null) {\n for (var i = 0, il = global_palette.length; i < il; ++i) {\n var rgb = global_palette[i];\n buf[p++] = rgb >> 16 & 0xff;\n buf[p++] = rgb >> 8 & 0xff;\n buf[p++] = rgb & 0xff;\n }\n }\n\n if (loop_count !== null) { // Netscape block for looping.\n if (loop_count < 0 || loop_count > 65535)\n throw new Error(\"Loop count invalid.\")\n // Extension code, label, and length.\n buf[p++] = 0x21; buf[p++] = 0xff; buf[p++] = 0x0b;\n // NETSCAPE2.0\n buf[p++] = 0x4e; buf[p++] = 0x45; buf[p++] = 0x54; buf[p++] = 0x53;\n buf[p++] = 0x43; buf[p++] = 0x41; buf[p++] = 0x50; buf[p++] = 0x45;\n buf[p++] = 0x32; buf[p++] = 0x2e; buf[p++] = 0x30;\n // Sub-block\n buf[p++] = 0x03; buf[p++] = 0x01;\n buf[p++] = loop_count & 0xff; buf[p++] = loop_count >> 8 & 0xff;\n buf[p++] = 0x00; // Terminator.\n }\n\n\n var ended = false;\n\n this.addFrame = function(x, y, w, h, indexed_pixels, opts) {\n if (ended === true) { --p; ended = false; } // Un-end.\n\n opts = opts === undefined ? { } : opts;\n\n // TODO(deanm): Bounds check x, y. Do they need to be within the virtual\n // canvas width/height, I imagine?\n if (x < 0 || y < 0 || x > 65535 || y > 65535)\n throw new Error(\"x/y invalid.\")\n\n if (w <= 0 || h <= 0 || w > 65535 || h > 65535)\n throw new Error(\"Width/Height invalid.\")\n\n if (indexed_pixels.length < w * h)\n throw new Error(\"Not enough pixels for the frame size.\");\n\n var using_local_palette = true;\n var palette = opts.palette;\n if (palette === undefined || palette === null) {\n using_local_palette = false;\n palette = global_palette;\n }\n\n if (palette === undefined || palette === null)\n throw new Error(\"Must supply either a local or global palette.\");\n\n var num_colors = check_palette_and_num_colors(palette);\n\n // Compute the min_code_size (power of 2), destroying num_colors.\n var min_code_size = 0;\n while (num_colors >>= 1) ++min_code_size;\n num_colors = 1 << min_code_size; // Now we can easily get it back.\n\n var delay = opts.delay === undefined ? 0 : opts.delay;\n\n // From the spec:\n // 0 - No disposal specified. The decoder is\n // not required to take any action.\n // 1 - Do not dispose. The graphic is to be left\n // in place.\n // 2 - Restore to background color. The area used by the\n // graphic must be restored to the background color.\n // 3 - Restore to previous. The decoder is required to\n // restore the area overwritten by the graphic with\n // what was there prior to rendering the graphic.\n // 4-7 - To be defined.\n // NOTE(deanm): Dispose background doesn't really work, apparently most\n // browsers ignore the background palette index and clear to transparency.\n var disposal = opts.disposal === undefined ? 0 : opts.disposal;\n if (disposal < 0 || disposal > 3) // 4-7 is reserved.\n throw new Error(\"Disposal out of range.\");\n\n var use_transparency = false;\n var transparent_index = 0;\n if (opts.transparent !== undefined && opts.transparent !== null) {\n use_transparency = true;\n transparent_index = opts.transparent;\n if (transparent_index < 0 || transparent_index >= num_colors)\n throw new Error(\"Transparent color index.\");\n }\n\n if (disposal !== 0 || use_transparency || delay !== 0) {\n // - Graphics Control Extension\n buf[p++] = 0x21; buf[p++] = 0xf9; // Extension / Label.\n buf[p++] = 4; // Byte size.\n\n buf[p++] = disposal << 2 | (use_transparency === true ? 1 : 0);\n buf[p++] = delay & 0xff; buf[p++] = delay >> 8 & 0xff;\n buf[p++] = transparent_index; // Transparent color index.\n buf[p++] = 0; // Block Terminator.\n }\n\n // - Image Descriptor\n buf[p++] = 0x2c; // Image Seperator.\n buf[p++] = x & 0xff; buf[p++] = x >> 8 & 0xff; // Left.\n buf[p++] = y & 0xff; buf[p++] = y >> 8 & 0xff; // Top.\n buf[p++] = w & 0xff; buf[p++] = w >> 8 & 0xff;\n buf[p++] = h & 0xff; buf[p++] = h >> 8 & 0xff;\n // NOTE: No sort flag (unused?).\n // TODO(deanm): Support interlace.\n buf[p++] = using_local_palette === true ? (0x80 | (min_code_size-1)) : 0;\n\n // - Local Color Table\n if (using_local_palette === true) {\n for (var i = 0, il = palette.length; i < il; ++i) {\n var rgb = palette[i];\n buf[p++] = rgb >> 16 & 0xff;\n buf[p++] = rgb >> 8 & 0xff;\n buf[p++] = rgb & 0xff;\n }\n }\n\n p = GifWriterOutputLZWCodeStream(\n buf, p, min_code_size < 2 ? 2 : min_code_size, indexed_pixels);\n\n return p;\n };\n\n this.end = function() {\n if (ended === false) {\n buf[p++] = 0x3b; // Trailer.\n ended = true;\n }\n return p;\n };\n\n this.getOutputBuffer = function() { return buf; };\n this.setOutputBuffer = function(v) { buf = v; };\n this.getOutputBufferPosition = function() { return p; };\n this.setOutputBufferPosition = function(v) { p = v; };\n}\n\n// Main compression routine, palette indexes -> LZW code stream.\n// |index_stream| must have at least one entry.\nfunction GifWriterOutputLZWCodeStream(buf, p, min_code_size, index_stream) {\n buf[p++] = min_code_size;\n var cur_subblock = p++; // Pointing at the length field.\n\n var clear_code = 1 << min_code_size;\n var code_mask = clear_code - 1;\n var eoi_code = clear_code + 1;\n var next_code = eoi_code + 1;\n\n var cur_code_size = min_code_size + 1; // Number of bits per code.\n var cur_shift = 0;\n // We have at most 12-bit codes, so we should have to hold a max of 19\n // bits here (and then we would write out).\n var cur = 0;\n\n function emit_bytes_to_buffer(bit_block_size) {\n while (cur_shift >= bit_block_size) {\n buf[p++] = cur & 0xff;\n cur >>= 8; cur_shift -= 8;\n if (p === cur_subblock + 256) { // Finished a subblock.\n buf[cur_subblock] = 255;\n cur_subblock = p++;\n }\n }\n }\n\n function emit_code(c) {\n cur |= c << cur_shift;\n cur_shift += cur_code_size;\n emit_bytes_to_buffer(8);\n }\n\n // I am not an expert on the topic, and I don't want to write a thesis.\n // However, it is good to outline here the basic algorithm and the few data\n // structures and optimizations here that make this implementation fast.\n // The basic idea behind LZW is to build a table of previously seen runs\n // addressed by a short id (herein called output code). All data is\n // referenced by a code, which represents one or more values from the\n // original input stream. All input bytes can be referenced as the same\n // value as an output code. So if you didn't want any compression, you\n // could more or less just output the original bytes as codes (there are\n // some details to this, but it is the idea). In order to achieve\n // compression, values greater then the input range (codes can be up to\n // 12-bit while input only 8-bit) represent a sequence of previously seen\n // inputs. The decompressor is able to build the same mapping while\n // decoding, so there is always a shared common knowledge between the\n // encoding and decoder, which is also important for \"timing\" aspects like\n // how to handle variable bit width code encoding.\n //\n // One obvious but very important consequence of the table system is there\n // is always a unique id (at most 12-bits) to map the runs. 'A' might be\n // 4, then 'AA' might be 10, 'AAA' 11, 'AAAA' 12, etc. This relationship\n // can be used for an effecient lookup strategy for the code mapping. We\n // need to know if a run has been seen before, and be able to map that run\n // to the output code. Since we start with known unique ids (input bytes),\n // and then from those build more unique ids (table entries), we can\n // continue this chain (almost like a linked list) to always have small\n // integer values that represent the current byte chains in the encoder.\n // This means instead of tracking the input bytes (AAAABCD) to know our\n // current state, we can track the table entry for AAAABC (it is guaranteed\n // to exist by the nature of the algorithm) and the next character D.\n // Therefor the tuple of (table_entry, byte) is guaranteed to also be\n // unique. This allows us to create a simple lookup key for mapping input\n // sequences to codes (table indices) without having to store or search\n // any of the code sequences. So if 'AAAA' has a table entry of 12, the\n // tuple of ('AAAA', K) for any input byte K will be unique, and can be our\n // key. This leads to a integer value at most 20-bits, which can always\n // fit in an SMI value and be used as a fast sparse array / object key.\n\n // Output code for the current contents of the index buffer.\n var ib_code = index_stream[0] & code_mask; // Load first input index.\n var code_table = { }; // Key'd on our 20-bit \"tuple\".\n\n emit_code(clear_code); // Spec says first code should be a clear code.\n\n // First index already loaded, process the rest of the stream.\n for (var i = 1, il = index_stream.length; i < il; ++i) {\n var k = index_stream[i] & code_mask;\n var cur_key = ib_code << 8 | k; // (prev, k) unique tuple.\n var cur_code = code_table[cur_key]; // buffer + k.\n\n // Check if we have to create a new code table entry.\n if (cur_code === undefined) { // We don't have buffer + k.\n // Emit index buffer (without k).\n // This is an inline version of emit_code, because this is the core\n // writing routine of the compressor (and V8 cannot inline emit_code\n // because it is a closure here in a different context). Additionally\n // we can call emit_byte_to_buffer less often, because we can have\n // 30-bits (from our 31-bit signed SMI), and we know our codes will only\n // be 12-bits, so can safely have 18-bits there without overflow.\n // emit_code(ib_code);\n cur |= ib_code << cur_shift;\n cur_shift += cur_code_size;\n while (cur_shift >= 8) {\n buf[p++] = cur & 0xff;\n cur >>= 8; cur_shift -= 8;\n if (p === cur_subblock + 256) { // Finished a subblock.\n buf[cur_subblock] = 255;\n cur_subblock = p++;\n }\n }\n\n if (next_code === 4096) { // Table full, need a clear.\n emit_code(clear_code);\n next_code = eoi_code + 1;\n cur_code_size = min_code_size + 1;\n code_table = { };\n } else { // Table not full, insert a new entry.\n // Increase our variable bit code sizes if necessary. This is a bit\n // tricky as it is based on \"timing\" between the encoding and\n // decoder. From the encoders perspective this should happen after\n // we've already emitted the index buffer and are about to create the\n // first table entry that would overflow our current code bit size.\n if (next_code >= (1 << cur_code_size)) ++cur_code_size;\n code_table[cur_key] = next_code++; // Insert into code table.\n }\n\n ib_code = k; // Index buffer to single input k.\n } else {\n ib_code = cur_code; // Index buffer to sequence in code table.\n }\n }\n\n emit_code(ib_code); // There will still be something in the index buffer.\n emit_code(eoi_code); // End Of Information.\n\n // Flush / finalize the sub-blocks stream to the buffer.\n emit_bytes_to_buffer(1);\n\n // Finish the sub-blocks, writing out any unfinished lengths and\n // terminating with a sub-block of length 0. If we have already started\n // but not yet used a sub-block it can just become the terminator.\n if (cur_subblock + 1 === p) { // Started but unused.\n buf[cur_subblock] = 0;\n } else { // Started and used, write length and additional terminator block.\n buf[cur_subblock] = p - cur_subblock - 1;\n buf[p++] = 0;\n }\n return p;\n}\n\nfunction GifReader(buf) {\n var p = 0;\n\n // - Header (GIF87a or GIF89a).\n if (buf[p++] !== 0x47 || buf[p++] !== 0x49 || buf[p++] !== 0x46 ||\n buf[p++] !== 0x38 || (buf[p++]+1 & 0xfd) !== 0x38 || buf[p++] !== 0x61) {\n throw new Error(\"Invalid GIF 87a/89a header.\");\n }\n\n // - Logical Screen Descriptor.\n var width = buf[p++] | buf[p++] << 8;\n var height = buf[p++] | buf[p++] << 8;\n var pf0 = buf[p++]; // .\n var global_palette_flag = pf0 >> 7;\n var num_global_colors_pow2 = pf0 & 0x7;\n var num_global_colors = 1 << (num_global_colors_pow2 + 1);\n var background = buf[p++];\n buf[p++]; // Pixel aspect ratio (unused?).\n\n var global_palette_offset = null;\n var global_palette_size = null;\n\n if (global_palette_flag) {\n global_palette_offset = p;\n global_palette_size = num_global_colors;\n p += num_global_colors * 3; // Seek past palette.\n }\n\n var no_eof = true;\n\n var frames = [ ];\n\n var delay = 0;\n var transparent_index = null;\n var disposal = 0; // 0 - No disposal specified.\n var loop_count = null;\n\n this.width = width;\n this.height = height;\n\n while (no_eof && p < buf.length) {\n switch (buf[p++]) {\n case 0x21: // Graphics Control Extension Block\n switch (buf[p++]) {\n case 0xff: // Application specific block\n // Try if it's a Netscape block (with animation loop counter).\n if (buf[p ] !== 0x0b || // 21 FF already read, check block size.\n // NETSCAPE2.0\n buf[p+1 ] == 0x4e && buf[p+2 ] == 0x45 && buf[p+3 ] == 0x54 &&\n buf[p+4 ] == 0x53 && buf[p+5 ] == 0x43 && buf[p+6 ] == 0x41 &&\n buf[p+7 ] == 0x50 && buf[p+8 ] == 0x45 && buf[p+9 ] == 0x32 &&\n buf[p+10] == 0x2e && buf[p+11] == 0x30 &&\n // Sub-block\n buf[p+12] == 0x03 && buf[p+13] == 0x01 && buf[p+16] == 0) {\n p += 14;\n loop_count = buf[p++] | buf[p++] << 8;\n p++; // Skip terminator.\n } else { // We don't know what it is, just try to get past it.\n p += 12;\n while (true) { // Seek through subblocks.\n var block_size = buf[p++];\n // Bad block size (ex: undefined from an out of bounds read).\n if (!(block_size >= 0)) throw Error(\"Invalid block size\");\n if (block_size === 0) break; // 0 size is terminator\n p += block_size;\n }\n }\n break;\n\n case 0xf9: // Graphics Control Extension\n if (buf[p++] !== 0x4 || buf[p+4] !== 0)\n throw new Error(\"Invalid graphics extension block.\");\n var pf1 = buf[p++];\n delay = buf[p++] | buf[p++] << 8;\n transparent_index = buf[p++];\n if ((pf1 & 1) === 0) transparent_index = null;\n disposal = pf1 >> 2 & 0x7;\n p++; // Skip terminator.\n break;\n\n case 0xfe: // Comment Extension.\n while (true) { // Seek through subblocks.\n var block_size = buf[p++];\n // Bad block size (ex: undefined from an out of bounds read).\n if (!(block_size >= 0)) throw Error(\"Invalid block size\");\n if (block_size === 0) break; // 0 size is terminator\n // console.log(buf.slice(p, p+block_size).toString('ascii'));\n p += block_size;\n }\n break;\n\n default:\n throw new Error(\n \"Unknown graphic control label: 0x\" + buf[p-1].toString(16));\n }\n break;\n\n case 0x2c: // Image Descriptor.\n var x = buf[p++] | buf[p++] << 8;\n var y = buf[p++] | buf[p++] << 8;\n var w = buf[p++] | buf[p++] << 8;\n var h = buf[p++] | buf[p++] << 8;\n var pf2 = buf[p++];\n var local_palette_flag = pf2 >> 7;\n var interlace_flag = pf2 >> 6 & 1;\n var num_local_colors_pow2 = pf2 & 0x7;\n var num_local_colors = 1 << (num_local_colors_pow2 + 1);\n var palette_offset = global_palette_offset;\n var palette_size = global_palette_size;\n var has_local_palette = false;\n if (local_palette_flag) {\n var has_local_palette = true;\n palette_offset = p; // Override with local palette.\n palette_size = num_local_colors;\n p += num_local_colors * 3; // Seek past palette.\n }\n\n var data_offset = p;\n\n p++; // codesize\n while (true) {\n var block_size = buf[p++];\n // Bad block size (ex: undefined from an out of bounds read).\n if (!(block_size >= 0)) throw Error(\"Invalid block size\");\n if (block_size === 0) break; // 0 size is terminator\n p += block_size;\n }\n\n frames.push({x: x, y: y, width: w, height: h,\n has_local_palette: has_local_palette,\n palette_offset: palette_offset,\n palette_size: palette_size,\n data_offset: data_offset,\n data_length: p - data_offset,\n transparent_index: transparent_index,\n interlaced: !!interlace_flag,\n delay: delay,\n disposal: disposal});\n break;\n\n case 0x3b: // Trailer Marker (end of file).\n no_eof = false;\n break;\n\n default:\n throw new Error(\"Unknown gif block: 0x\" + buf[p-1].toString(16));\n break;\n }\n }\n\n this.numFrames = function() {\n return frames.length;\n };\n\n this.loopCount = function() {\n return loop_count;\n };\n\n this.frameInfo = function(frame_num) {\n if (frame_num < 0 || frame_num >= frames.length)\n throw new Error(\"Frame index out of range.\");\n return frames[frame_num];\n }\n\n this.decodeAndBlitFrameBGRA = function(frame_num, pixels) {\n var frame = this.frameInfo(frame_num);\n var num_pixels = frame.width * frame.height;\n var index_stream = new Uint8Array(num_pixels); // At most 8-bit indices.\n GifReaderLZWOutputIndexStream(\n buf, frame.data_offset, index_stream, num_pixels);\n var palette_offset = frame.palette_offset;\n\n // NOTE(deanm): It seems to be much faster to compare index to 256 than\n // to === null. Not sure why, but CompareStub_EQ_STRICT shows up high in\n // the profile, not sure if it's related to using a Uint8Array.\n var trans = frame.transparent_index;\n if (trans === null) trans = 256;\n\n // We are possibly just blitting to a portion of the entire frame.\n // That is a subrect within the framerect, so the additional pixels\n // must be skipped over after we finished a scanline.\n var framewidth = frame.width;\n var framestride = width - framewidth;\n var xleft = framewidth; // Number of subrect pixels left in scanline.\n\n // Output indicies of the top left and bottom right corners of the subrect.\n var opbeg = ((frame.y * width) + frame.x) * 4;\n var opend = ((frame.y + frame.height) * width + frame.x) * 4;\n var op = opbeg;\n\n var scanstride = framestride * 4;\n\n // Use scanstride to skip past the rows when interlacing. This is skipping\n // 7 rows for the first two passes, then 3 then 1.\n if (frame.interlaced === true) {\n scanstride += width * 4 * 7; // Pass 1.\n }\n\n var interlaceskip = 8; // Tracking the row interval in the current pass.\n\n for (var i = 0, il = index_stream.length; i < il; ++i) {\n var index = index_stream[i];\n\n if (xleft === 0) { // Beginning of new scan line\n op += scanstride;\n xleft = framewidth;\n if (op >= opend) { // Catch the wrap to switch passes when interlacing.\n scanstride = framestride * 4 + width * 4 * (interlaceskip-1);\n // interlaceskip / 2 * 4 is interlaceskip << 1.\n op = opbeg + (framewidth + framestride) * (interlaceskip << 1);\n interlaceskip >>= 1;\n }\n }\n\n if (index === trans) {\n op += 4;\n } else {\n var r = buf[palette_offset + index * 3];\n var g = buf[palette_offset + index * 3 + 1];\n var b = buf[palette_offset + index * 3 + 2];\n pixels[op++] = b;\n pixels[op++] = g;\n pixels[op++] = r;\n pixels[op++] = 255;\n }\n --xleft;\n }\n };\n\n // I will go to copy and paste hell one day...\n this.decodeAndBlitFrameRGBA = function(frame_num, pixels) {\n var frame = this.frameInfo(frame_num);\n var num_pixels = frame.width * frame.height;\n var index_stream = new Uint8Array(num_pixels); // At most 8-bit indices.\n GifReaderLZWOutputIndexStream(\n buf, frame.data_offset, index_stream, num_pixels);\n var palette_offset = frame.palette_offset;\n\n // NOTE(deanm): It seems to be much faster to compare index to 256 than\n // to === null. Not sure why, but CompareStub_EQ_STRICT shows up high in\n // the profile, not sure if it's related to using a Uint8Array.\n var trans = frame.transparent_index;\n if (trans === null) trans = 256;\n\n // We are possibly just blitting to a portion of the entire frame.\n // That is a subrect within the framerect, so the additional pixels\n // must be skipped over after we finished a scanline.\n var framewidth = frame.width;\n var framestride = width - framewidth;\n var xleft = framewidth; // Number of subrect pixels left in scanline.\n\n // Output indicies of the top left and bottom right corners of the subrect.\n var opbeg = ((frame.y * width) + frame.x) * 4;\n var opend = ((frame.y + frame.height) * width + frame.x) * 4;\n var op = opbeg;\n\n var scanstride = framestride * 4;\n\n // Use scanstride to skip past the rows when interlacing. This is skipping\n // 7 rows for the first two passes, then 3 then 1.\n if (frame.interlaced === true) {\n scanstride += width * 4 * 7; // Pass 1.\n }\n\n var interlaceskip = 8; // Tracking the row interval in the current pass.\n\n for (var i = 0, il = index_stream.length; i < il; ++i) {\n var index = index_stream[i];\n\n if (xleft === 0) { // Beginning of new scan line\n op += scanstride;\n xleft = framewidth;\n if (op >= opend) { // Catch the wrap to switch passes when interlacing.\n scanstride = framestride * 4 + width * 4 * (interlaceskip-1);\n // interlaceskip / 2 * 4 is interlaceskip << 1.\n op = opbeg + (framewidth + framestride) * (interlaceskip << 1);\n interlaceskip >>= 1;\n }\n }\n\n if (index === trans) {\n op += 4;\n } else {\n var r = buf[palette_offset + index * 3];\n var g = buf[palette_offset + index * 3 + 1];\n var b = buf[palette_offset + index * 3 + 2];\n pixels[op++] = r;\n pixels[op++] = g;\n pixels[op++] = b;\n pixels[op++] = 255;\n }\n --xleft;\n }\n };\n}\n\nfunction GifReaderLZWOutputIndexStream(code_stream, p, output, output_length) {\n var min_code_size = code_stream[p++];\n\n var clear_code = 1 << min_code_size;\n var eoi_code = clear_code + 1;\n var next_code = eoi_code + 1;\n\n var cur_code_size = min_code_size + 1; // Number of bits per code.\n // NOTE: This shares the same name as the encoder, but has a different\n // meaning here. Here this masks each code coming from the code stream.\n var code_mask = (1 << cur_code_size) - 1;\n var cur_shift = 0;\n var cur = 0;\n\n var op = 0; // Output pointer.\n\n var subblock_size = code_stream[p++];\n\n // TODO(deanm): Would using a TypedArray be any faster? At least it would\n // solve the fast mode / backing store uncertainty.\n // var code_table = Array(4096);\n var code_table = new Int32Array(4096); // Can be signed, we only use 20 bits.\n\n var prev_code = null; // Track code-1.\n\n while (true) {\n // Read up to two bytes, making sure we always 12-bits for max sized code.\n while (cur_shift < 16) {\n if (subblock_size === 0) break; // No more data to be read.\n\n cur |= code_stream[p++] << cur_shift;\n cur_shift += 8;\n\n if (subblock_size === 1) { // Never let it get to 0 to hold logic above.\n subblock_size = code_stream[p++]; // Next subblock.\n } else {\n --subblock_size;\n }\n }\n\n // TODO(deanm): We should never really get here, we should have received\n // and EOI.\n if (cur_shift < cur_code_size)\n break;\n\n var code = cur & code_mask;\n cur >>= cur_code_size;\n cur_shift -= cur_code_size;\n\n // TODO(deanm): Maybe should check that the first code was a clear code,\n // at least this is what you're supposed to do. But actually our encoder\n // now doesn't emit a clear code first anyway.\n if (code === clear_code) {\n // We don't actually have to clear the table. This could be a good idea\n // for greater error checking, but we don't really do any anyway. We\n // will just track it with next_code and overwrite old entries.\n\n next_code = eoi_code + 1;\n cur_code_size = min_code_size + 1;\n code_mask = (1 << cur_code_size) - 1;\n\n // Don't update prev_code ?\n prev_code = null;\n continue;\n } else if (code === eoi_code) {\n break;\n }\n\n // We have a similar situation as the decoder, where we want to store\n // variable length entries (code table entries), but we want to do in a\n // faster manner than an array of arrays. The code below stores sort of a\n // linked list within the code table, and then \"chases\" through it to\n // construct the dictionary entries. When a new entry is created, just the\n // last byte is stored, and the rest (prefix) of the entry is only\n // referenced by its table entry. Then the code chases through the\n // prefixes until it reaches a single byte code. We have to chase twice,\n // first to compute the length, and then to actually copy the data to the\n // output (backwards, since we know the length). The alternative would be\n // storing something in an intermediate stack, but that doesn't make any\n // more sense. I implemented an approach where it also stored the length\n // in the code table, although it's a bit tricky because you run out of\n // bits (12 + 12 + 8), but I didn't measure much improvements (the table\n // entries are generally not the long). Even when I created benchmarks for\n // very long table entries the complexity did not seem worth it.\n // The code table stores the prefix entry in 12 bits and then the suffix\n // byte in 8 bits, so each entry is 20 bits.\n\n var chase_code = code < next_code ? code : prev_code;\n\n // Chase what we will output, either {CODE} or {CODE-1}.\n var chase_length = 0;\n var chase = chase_code;\n while (chase > clear_code) {\n chase = code_table[chase] >> 8;\n ++chase_length;\n }\n\n var k = chase;\n\n var op_end = op + chase_length + (chase_code !== code ? 1 : 0);\n if (op_end > output_length) {\n console.log(\"Warning, gif stream longer than expected.\");\n return;\n }\n\n // Already have the first byte from the chase, might as well write it fast.\n output[op++] = k;\n\n op += chase_length;\n var b = op; // Track pointer, writing backwards.\n\n if (chase_code !== code) // The case of emitting {CODE-1} + k.\n output[op++] = k;\n\n chase = chase_code;\n while (chase_length--) {\n chase = code_table[chase];\n output[--b] = chase & 0xff; // Write backwards.\n chase >>= 8; // Pull down to the prefix code.\n }\n\n if (prev_code !== null && next_code < 4096) {\n code_table[next_code++] = prev_code << 8 | k;\n // TODO(deanm): Figure out this clearing vs code growth logic better. I\n // have an feeling that it should just happen somewhere else, for now it\n // is awkward between when we grow past the max and then hit a clear code.\n // For now just check if we hit the max 12-bits (then a clear code should\n // follow, also of course encoded in 12-bits).\n if (next_code >= code_mask+1 && cur_code_size < 12) {\n ++cur_code_size;\n code_mask = code_mask << 1 | 1;\n }\n }\n\n prev_code = code;\n }\n\n if (op !== output_length) {\n console.log(\"Warning, gif stream shorter than expected.\");\n }\n\n return output;\n}\n\n// CommonJS.\ntry { exports.GifWriter = GifWriter; exports.GifReader = GifReader } catch(e) {}\n","'use strict';\n\n/** @class BitmapImage */\n\nclass BitmapImage {\n\n /**\n * BitmapImage is a class that hold an RGBA (red, green, blue, alpha) representation of an image. It's shape is borrowed from the Jimp package to make it easy to transfer GIF image frames into Jimp and Jimp images into GIF image frames. Each instance has a `bitmap` property having the following properties:\n * \n * Property | Description\n * --- | ---\n * bitmap.width | width of image in pixels\n * bitmap.height | height of image in pixels\n * bitmap.data | a Buffer whose every four bytes represents a pixel, each sequential byte of a pixel corresponding to the red, green, blue, and alpha values of the pixel\n *\n * Its constructor supports the following signatures:\n *\n * * new BitmapImage(bitmap: { width: number, height: number, data: Buffer })\n * * new BitmapImage(bitmapImage: BitmapImage)\n * * new BitmapImage(width: number, height: number, buffer: Buffer)\n * * new BitmapImage(width: number, height: number, backgroundRGBA?: number)\n * \n * When a `BitmapImage` is provided, the constructed `BitmapImage` is a deep clone of the provided one, so that each image's pixel data can subsequently be modified without affecting each other.\n *\n * `backgroundRGBA` is an optional parameter representing a pixel as a single number. In hex, the number is as follows: 0xRRGGBBAA, where RR is the red byte, GG the green byte, BB, the blue byte, and AA the alpha value. An AA of 0x00 is considered transparent, and all non-zero AA values are treated as opaque.\n */\n\n constructor(...args) {\n // don't confirm the number of args, because a subclass may have\n // additional args and pass them all to the superclass\n if (args.length === 0) {\n throw new Error(\"constructor requires parameters\");\n }\n const firstArg = args[0];\n if (firstArg !== null && typeof firstArg === 'object') {\n if (firstArg instanceof BitmapImage) {\n // copy a provided BitmapImage\n const sourceBitmap = firstArg.bitmap;\n this.bitmap = {\n width: sourceBitmap.width,\n height: sourceBitmap.height,\n data: new Buffer(sourceBitmap.width * sourceBitmap.height * 4)\n };\n sourceBitmap.data.copy(this.bitmap.data);\n }\n else if (firstArg.width && firstArg.height && firstArg.data) {\n // share a provided bitmap\n this.bitmap = firstArg;\n }\n else {\n throw new Error(\"unrecognized constructor parameters\");\n }\n }\n else if (typeof firstArg === 'number' && typeof args[1] === 'number')\n {\n const width = firstArg;\n const height = args[1];\n const thirdArg = args[2];\n this.bitmap = { width, height };\n\n if (Buffer.isBuffer(thirdArg)) {\n this.bitmap.data = thirdArg;\n }\n else {\n this.bitmap.data = new Buffer(width * height * 4);\n if (typeof thirdArg === 'number') {\n this.fillRGBA(thirdArg);\n }\n }\n }\n else {\n throw new Error(\"unrecognized constructor parameters\");\n }\n }\n\n /**\n * Copy a square portion of this image into another image. \n * \n * @param {BitmapImage} toImage Image into which to copy the square\n * @param {number} toX x-coord in toImage of upper-left corner of receiving square\n * @param {number} toY y-coord in toImage of upper-left corner of receiving square\n * @param {number} fromX x-coord in this image of upper-left corner of source square\n * @param {number} fromY y-coord in this image of upper-left corner of source square\n * @return {BitmapImage} The present image to allow for chaining.\n */\n\n blit(toImage, toX, toY, fromX, fromY, fromWidth, fromHeight) {\n if (fromX + fromWidth > this.bitmap.width) {\n throw new Error(\"copy exceeds width of source bitmap\");\n }\n if (toX + fromWidth > toImage.bitmap.width) {\n throw new Error(\"copy exceeds width of target bitmap\");\n }\n if (fromY + fromHeight > this.bitmap.height) {\n throw new Error(\"copy exceeds height of source bitmap\");\n }\n if (toY + fromHeight > toImage.bitmap.height) {\n throw new Erro(\"copy exceeds height of target bitmap\");\n }\n \n const sourceBuf = this.bitmap.data;\n const targetBuf = toImage.bitmap.data;\n const sourceByteWidth = this.bitmap.width * 4;\n const targetByteWidth = toImage.bitmap.width * 4;\n const copyByteWidth = fromWidth * 4;\n let si = fromY * sourceByteWidth + fromX * 4;\n let ti = toY * targetByteWidth + toX * 4;\n\n while (--fromHeight >= 0) {\n sourceBuf.copy(targetBuf, ti, si, si + copyByteWidth);\n si += sourceByteWidth;\n ti += targetByteWidth;\n }\n return this;\n }\n\n /**\n * Fills the image with a single color.\n * \n * @param {number} rgba Color with which to fill image, expressed as a singlenumber in the form 0xRRGGBBAA, where AA is 0x00 for transparent and any other value for opaque.\n * @return {BitmapImage} The present image to allow for chaining.\n */\n\n fillRGBA(rgba) {\n const buf = this.bitmap.data;\n const bufByteWidth = this.bitmap.height * 4;\n \n let bi = 0;\n while (bi < bufByteWidth) {\n buf.writeUInt32BE(rgba, bi);\n bi += 4;\n }\n while (bi < buf.length) {\n buf.copy(buf, bi, 0, bufByteWidth);\n bi += bufByteWidth;\n }\n return this;\n }\n\n /**\n * Gets the RGBA number of the pixel at the given coordinate in the form 0xRRGGBBAA, where AA is the alpha value, with alpha 0x00 encoding to transparency in GIFs.\n * \n * @param {number} x x-coord of pixel\n * @param {number} y y-coord of pixel\n * @return {number} RGBA of pixel in 0xRRGGBBAA form\n */\n\n getRGBA(x, y) {\n const bi = (y * this.bitmap.width + x) * 4;\n return this.bitmap.data.readUInt32BE(bi);\n }\n\n /**\n * Gets a set of all RGBA colors found within the image.\n * \n * @return {Set} Set of all RGBA colors that the image contains.\n */\n\n getRGBASet() {\n const rgbaSet = new Set();\n const buf = this.bitmap.data;\n for (let bi = 0; bi < buf.length; bi += 4) {\n rgbaSet.add(buf.readUInt32BE(bi, true));\n }\n return rgbaSet;\n }\n\n /**\n * Converts the image to greyscale using inferred Adobe metrics.\n * \n * @return {BitmapImage} The present image to allow for chaining.\n */\n\n greyscale() {\n const buf = this.bitmap.data;\n this.scan(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n const grey = Math.round(\n 0.299 * buf[idx] +\n 0.587 * buf[idx + 1] +\n 0.114 * buf[idx + 2]\n );\n buf[idx] = grey;\n buf[idx + 1] = grey;\n buf[idx + 2] = grey;\n });\n return this;\n }\n\n /**\n * Reframes the image as if placing a frame around the original image and replacing the original image with the newly framed image. When the new frame is strictly within the boundaries of the original image, this method crops the image. When any of the new boundaries exceed those of the original image, the `fillRGBA` must be provided to indicate the color with which to fill the extra space added to the image.\n * \n * @param {number} xOffset The x-coord offset of the upper-left pixel of the desired image relative to the present image.\n * @param {number} yOffset The y-coord offset of the upper-left pixel of the desired image relative to the present image.\n * @param {number} width The width of the new image after reframing\n * @param {number} height The height of the new image after reframing\n * @param {number} fillRGBA The color with which to fill space added to the image as a result of the reframing, in 0xRRGGBBAA format, where AA is 0x00 to indicate transparent and a non-zero value to indicate opaque. This parameter is only required when the reframing exceeds the original boundaries (i.e. does not simply perform a crop).\n * @return {BitmapImage} The present image to allow for chaining.\n */\n\n reframe(xOffset, yOffset, width, height, fillRGBA) {\n const cropX = (xOffset < 0 ? 0 : xOffset);\n const cropY = (yOffset < 0 ? 0 : yOffset);\n const cropWidth = (width + cropX > this.bitmap.width ?\n this.bitmap.width - cropX : width);\n const cropHeight = (height + cropY > this.bitmap.height ?\n this.bitmap.height - cropY : height);\n const newX = (xOffset < 0 ? -xOffset : 0);\n const newY = (yOffset < 0 ? -yOffset : 0);\n\n let image;\n if (fillRGBA === undefined) {\n if (cropX !== xOffset || cropY != yOffset ||\n cropWidth !== width || cropHeight !== height)\n {\n throw new GifError(`fillRGBA required for this reframing`);\n }\n image = new BitmapImage(width, height);\n }\n else {\n image = new BitmapImage(width, height, fillRGBA);\n }\n this.blit(image, newX, newY, cropX, cropY, cropWidth, cropHeight);\n this.bitmap = image.bitmap;\n return this;\n }\n\n /**\n * Scales the image size up by an integer factor. Each pixel of the original image becomes a square of the same color in the new image having a size of `factor` x `factor` pixels.\n * \n * @param {number} factor The factor by which to scale up the image. Must be an integer >= 1.\n * @return {BitmapImage} The present image to allow for chaining.\n */\n\n scale(factor) {\n if (factor === 1) {\n return;\n }\n if (!Number.isInteger(factor) || factor < 1) {\n throw new Error(\"the scale must be an integer >= 1\");\n }\n const sourceWidth = this.bitmap.width;\n const sourceHeight = this.bitmap.height;\n const destByteWidth = sourceWidth * factor * 4;\n const sourceBuf = this.bitmap.data;\n const destBuf = new Buffer(sourceHeight * destByteWidth * factor);\n let sourceIndex = 0;\n let priorDestRowIndex;\n let destIndex = 0;\n for (let y = 0; y < sourceHeight; ++y) {\n priorDestRowIndex = destIndex;\n for (let x = 0; x < sourceWidth; ++x) {\n const color = sourceBuf.readUInt32BE(sourceIndex, true);\n for (let cx = 0; cx < factor; ++cx) {\n destBuf.writeUInt32BE(color, destIndex);\n destIndex += 4;\n }\n sourceIndex += 4;\n }\n for (let cy = 1; cy < factor; ++cy) {\n destBuf.copy(destBuf, destIndex, priorDestRowIndex, destIndex);\n destIndex += destByteWidth;\n priorDestRowIndex += destByteWidth;\n }\n }\n this.bitmap = {\n width: sourceWidth * factor,\n height: sourceHeight * factor,\n data: destBuf\n };\n return this;\n }\n\n /**\n * Scans all coordinates of the image, handing each in turn to the provided handler function.\n *\n * @param {function} scanHandler A function(x: number, y: number, bi: number) to be called for each pixel of the image with that pixel's x-coord, y-coord, and index into the `data` buffer. The function accesses the pixel at this coordinate by accessing the `this.data` at index `bi`.\n * @see scanAllIndexes\n */\n\n scanAllCoords(scanHandler) {\n const width = this.bitmap.width;\n const bufferLength = this.bitmap.data.length;\n let x = 0;\n let y = 0;\n\n for (let bi = 0; bi < bufferLength; bi += 4) {\n scanHandler(x, y, bi);\n if (++x === width) {\n x = 0;\n ++y;\n }\n }\n }\n\n /**\n * Scans all pixels of the image, handing the index of each in turn to the provided handler function. Runs a bit faster than `scanAllCoords()`, should the handler not need pixel coordinates.\n *\n * @param {function} scanHandler A function(bi: number) to be called for each pixel of the image with that pixel's index into the `data` buffer. The pixels is found at index 'bi' within `this.data`.\n * @see scanAllCoords\n */\n\n scanAllIndexes(scanHandler) {\n const bufferLength = this.bitmap.data.length;\n for (let bi = 0; bi < bufferLength; bi += 4) {\n scanHandler(bi);\n }\n }\n}\n\nmodule.exports = BitmapImage;\n","'use strict';\n\n/** @class Gif */\n\nclass Gif {\n\n // width - width of GIF in pixels\n // height - height of GIF in pixels\n // loops - 0 = unending; (n > 0) = iterate n times\n // usesTransparency - whether any frames have transparent pixels\n // colorScope - scope of color tables in GIF\n // frames - array of frames\n // buffer - GIF-formatted data\n\n /**\n * Gif is a class representing an encoded GIF. It is intended to be a read-only representation of a byte-encoded GIF. Only encoders and decoders should be creating instances of this class.\n * \n * Property | Description\n * --- | ---\n * width | width of the GIF at its widest\n * height | height of the GIF at its highest\n * loops | the number of times the GIF should loop before stopping; 0 => loop indefinitely\n * usesTransparency | boolean indicating whether at least one frame contains at least one transparent pixel\n * colorScope | the scope of the color tables as encoded within the GIF; either Gif.GlobalColorsOnly (== 1) or Gif.LocalColorsOnly (== 2).\n * frames | a array of GifFrame instances, one for each frame of the GIF\n * buffer | a Buffer holding the encoding's byte data\n * \n * Its constructor should only ever be called by the GIF encoder or decoder.\n *\n * @param {Buffer} buffer A Buffer containing the encoded bytes\n * @param {GifFrame[]} frames Array of frames found in the encoding\n * @param {object} spec Properties of the encoding as listed above\n */\n\n constructor(buffer, frames, spec) {\n this.width = spec.width;\n this.height = spec.height;\n this.loops = spec.loops;\n this.usesTransparency = spec.usesTransparency;\n this.colorScope = spec.colorScope;\n this.frames = frames;\n this.buffer = buffer;\n }\n}\n\nGif.GlobalColorsPreferred = 0;\nGif.GlobalColorsOnly = 1;\nGif.LocalColorsOnly = 2;\n\n/** @class GifError */\n\nclass GifError extends Error {\n\n /**\n * GifError is a class representing a GIF-related error\n * \n * @param {string|Error} messageOrError\n */\n\n constructor(messageOrError) {\n super(messageOrError);\n if (messageOrError instanceof Error) {\n this.stack = 'Gif' + messageOrError.stack;\n }\n }\n}\n\nexports.Gif = Gif;\nexports.GifError = GifError;\n","'use strict';\n\nconst Omggif = require('omggif');\nconst { Gif, GifError } = require('./gif');\n\n// allow circular dependency with GifUtil\nfunction GifUtil() {\n const data = require('./gifutil');\n\n GifUtil = function () {\n return data;\n };\n\n return data;\n}\n\nconst { GifFrame } = require('./gifframe');\n\nconst PER_GIF_OVERHEAD = 200; // these are guesses at upper limits\nconst PER_FRAME_OVERHEAD = 100;\n\n// Note: I experimented with accepting a global color table when encoding and returning the global color table when decoding. Doing this properly greatly increased the complexity of the code and the amount of clock cycles required. The main issue is that each frame can specify any color of the global color table to be transparent within the frame, while this GIF library strives to hide GIF formatting details from its clients. E.g. it's possible to have 256 colors in the global color table and different transparencies in each frame, requiring clients to either provide per-frame transparency indexes, or for arcane reasons that won't be apparent to client developers, encode some GIFs with local color tables that previously decoded with global tables.\n\n/** @class GifCodec */\n\nclass GifCodec\n{\n // _transparentRGBA - RGB given to transparent pixels (alpha=0) on decode; defaults to null indicating 0x000000, which is fastest\n\n /**\n * GifCodec is a class that both encodes and decodes GIFs. It implements both the `encode()` method expected of an encoder and the `decode()` method expected of a decoder, and it wraps the `omggif` GIF encoder/decoder package. GifCodec serves as this library's default encoder and decoder, but it's possible to wrap other GIF encoders and decoders for use by `gifwrap` as well. GifCodec will not encode GIFs with interlacing.\n * \n * Instances of this class are stateless and can be shared across multiple encodings and decodings.\n * \n * Its constructor takes one option argument:\n * \n * @param {object} options Optionally takes an objection whose only possible property is `transparentRGB`. Images are internally represented in RGBA format, where A is the alpha value of a pixel. When `transparentRGB` is provided, this RGB value (excluding alpha) is assigned to transparent pixels, which are also given alpha value 0x00. (All opaque pixels are given alpha value 0xFF). The RGB color of transparent pixels shouldn't matter for most applications. Defaults to 0x000000.\n */\n\n constructor(options = {}) {\n this._transparentRGB = null; // 0x000000\n if (typeof options.transparentRGB === 'number' &&\n options.transparentRGB !== 0)\n {\n this._transparentRGBA = options.transparentRGB * 256;\n }\n this._testInitialBufferSize = 0; // assume no buffer scaling test\n }\n\n /**\n * Decodes a GIF from a Buffer to yield an instance of Gif. Transparent pixels of the GIF are given alpha values of 0x00, and opaque pixels are given alpha values of 0xFF. The RGB values of transparent pixels default to 0x000000 but can be overridden by the constructor's `transparentRGB` option.\n * \n * @param {Buffer} buffer Bytes of an encoded GIF to decode.\n * @return {Promise} A Promise that resolves to an instance of the Gif class, representing the encoded GIF.\n * @throws {GifError} Error upon encountered an encoding-related problem with a GIF, so that the caller can distinguish between software errors and problems with GIFs.\n */\n\n decodeGif(buffer) {\n try {\n let reader;\n try {\n reader = new Omggif.GifReader(buffer);\n }\n catch (err) {\n throw new GifError(err);\n }\n const frameCount = reader.numFrames();\n const frames = [];\n const spec = {\n width: reader.width,\n height: reader.height,\n loops: reader.loopCount()\n };\n\n spec.usesTransparency = false;\n for (let i = 0; i < frameCount; ++i) {\n const frameInfo =\n this._decodeFrame(reader, i, spec.usesTransparency);\n frames.push(frameInfo.frame);\n if (frameInfo.usesTransparency) {\n spec.usesTransparency = true;\n }\n }\n return Promise.resolve(new Gif(buffer, frames, spec));\n }\n catch (err) {\n return Promise.reject(err);\n }\n }\n\n /**\n * Encodes a GIF from provided frames. Each pixel having an alpha value of 0x00 renders as transparent within the encoding, while all pixels of non-zero alpha value render as opaque.\n * \n * @param {GifFrame[]} frames Array of frames to encode\n * @param {object} spec An optional object that may provide values for `loops` and `colorScope`, as defined for the Gif class. However, `colorSpace` may also take the value Gif.GlobalColorsPreferred (== 0) to indicate that the encoder should attempt to create only a global color table. `loop` defaults to 0, looping indefinitely. Set `loop` to null to disable looping, playing only once. `colorScope` defaults to Gif.GlobalColorsPreferred.\n * @return {Promise} A Promise that resolves to an instance of the Gif class, representing the encoded GIF.\n * @throws {GifError} Error upon encountered an encoding-related problem with a GIF, so that the caller can distinguish between software errors and problems with GIFs.\n */\n\n encodeGif(frames, spec = {}) {\n try {\n if (frames === null || frames.length === 0) {\n throw new GifError(\"there are no frames\");\n }\n const dims = GifUtil().getMaxDimensions(frames);\n\n spec = Object.assign({}, spec); // don't munge caller's spec\n spec.width = dims.maxWidth;\n spec.height = dims.maxHeight;\n if (spec.loops === undefined) {\n spec.loops = 0;\n }\n spec.colorScope = spec.colorScope || Gif.GlobalColorsPreferred;\n\n return Promise.resolve(this._encodeGif(frames, spec));\n }\n catch (err) {\n return Promise.reject(err);\n }\n }\n\n _decodeFrame(reader, frameIndex, alreadyUsedTransparency) {\n let info, buffer;\n try {\n info = reader.frameInfo(frameIndex);\n buffer = new Buffer(reader.width * reader.height * 4);\n reader.decodeAndBlitFrameRGBA(frameIndex, buffer);\n if (info.width !== reader.width || info.height !== reader.height) {\n if (info.y) {\n // skip unused rows\n buffer = buffer.slice(info.y * reader.width * 4);\n }\n if (reader.width > info.width) {\n // skip scanstride\n for (let ii = 0; ii < info.height; ++ii) {\n buffer.copy(buffer, ii * info.width * 4,\n (info.x + ii * reader.width) * 4,\n (info.x + ii * reader.width) * 4 + info.width * 4);\n }\n }\n // trim buffer to size\n buffer = buffer.slice(0, info.width * info.height * 4);\n }\n }\n catch (err) {\n throw new GifError(err);\n }\n\n let usesTransparency = false;\n if (this._transparentRGBA === null) {\n if (!alreadyUsedTransparency) {\n for (let i = 3; i < buffer.length; i += 4) {\n if (buffer[i] === 0) {\n usesTransparency = true;\n i = buffer.length;\n }\n }\n }\n }\n else {\n for (let i = 3; i < buffer.length; i += 4) {\n if (buffer[i] === 0) {\n buffer.writeUInt32BE(this._transparentRGBA, i - 3);\n usesTransparency = true; // GIF might encode unused index\n }\n }\n }\n\n const frame = new GifFrame(info.width, info.height, buffer, {\n xOffset: info.x,\n yOffset: info.y,\n disposalMethod: info.disposal,\n interlaced: info.interlaced,\n delayCentisecs: info.delay\n });\n return { frame, usesTransparency };\n }\n\n _encodeGif(frames, spec) {\n let colorInfo;\n if (spec.colorScope === Gif.LocalColorsOnly) {\n colorInfo = GifUtil().getColorInfo(frames, 0);\n }\n else {\n colorInfo = GifUtil().getColorInfo(frames, 256);\n if (!colorInfo.colors) { // if global palette impossible\n if (spec.colorScope === Gif.GlobalColorsOnly) {\n throw new GifError(\n \"Too many color indexes for global color table\");\n }\n spec.colorScope = Gif.LocalColorsOnly\n }\n }\n spec.usesTransparency = colorInfo.usesTransparency;\n\n const localPalettes = colorInfo.palettes;\n if (spec.colorScope === Gif.LocalColorsOnly) {\n const localSizeEst = 2000; //this._getSizeEstimateLocal(localPalettes, frames);\n return _encodeLocal(frames, spec, localSizeEst, localPalettes);\n }\n\n const globalSizeEst = 2000; //this._getSizeEstimateGlobal(colorInfo, frames);\n return _encodeGlobal(frames, spec, globalSizeEst, colorInfo);\n }\n\n _getSizeEstimateGlobal(globalPalette, frames) {\n if (this._testInitialBufferSize > 0) {\n return this._testInitialBufferSize;\n }\n let sizeEst = PER_GIF_OVERHEAD + 3*256 /* max palette size*/;\n const pixelBitWidth = _getPixelBitWidth(globalPalette);\n frames.forEach(frame => {\n sizeEst += _getFrameSizeEst(frame, pixelBitWidth);\n });\n return sizeEst; // should be the upper limit\n }\n\n _getSizeEstimateLocal(palettes, frames) {\n if (this._testInitialBufferSize > 0) {\n return this._testInitialBufferSize;\n }\n let sizeEst = PER_GIF_OVERHEAD;\n for (let i = 0; i < frames.length; ++i ) {\n const palette = palettes[i];\n const pixelBitWidth = _getPixelBitWidth(palette);\n sizeEst += _getFrameSizeEst(frames[i], pixelBitWidth);\n }\n return sizeEst; // should be the upper limit\n }\n}\nexports.GifCodec = GifCodec;\n\nfunction _colorLookupLinear(colors, color) {\n const index = colors.indexOf(color);\n return (index === -1 ? null : index);\n}\n\nfunction _colorLookupBinary(colors, color) {\n // adapted from https://stackoverflow.com/a/10264318/650894\n var lo = 0, hi = colors.length - 1, mid;\n while (lo <= hi) {\n mid = Math.floor((lo + hi)/2);\n if (colors[mid] > color)\n hi = mid - 1;\n else if (colors[mid] < color)\n lo = mid + 1;\n else\n return mid;\n }\n return null;\n}\n\nfunction _encodeGlobal(frames, spec, bufferSizeEst, globalPalette) {\n // would be inefficient for frames to lookup colors in extended palette \n const extendedGlobalPalette = {\n colors: globalPalette.colors.slice(),\n usesTransparency: globalPalette.usesTransparency\n };\n _extendPaletteToPowerOf2(extendedGlobalPalette);\n const options = {\n palette: extendedGlobalPalette.colors,\n loop: spec.loops\n };\n let buffer = new Buffer(bufferSizeEst);\n let gifWriter;\n try {\n gifWriter = new Omggif.GifWriter(buffer, spec.width, spec.height,\n options);\n }\n catch (err) {\n throw new GifError(err);\n }\n for (let i = 0; i < frames.length; ++i) {\n buffer = _writeFrame(gifWriter, i, frames[i], globalPalette, false);\n }\n return new Gif(buffer.slice(0, gifWriter.end()), frames, spec);\n}\n\nfunction _encodeLocal(frames, spec, bufferSizeEst, localPalettes) {\n const options = {\n loop: spec.loops\n };\n let buffer = new Buffer(bufferSizeEst);\n let gifWriter;\n try {\n gifWriter = new Omggif.GifWriter(buffer, spec.width, spec.height,\n options);\n } \n catch (err) {\n throw new GifError(err);\n }\n for (let i = 0; i < frames.length; ++i) {\n buffer = _writeFrame(gifWriter, i, frames[i], localPalettes[i], true);\n }\n return new Gif(buffer.slice(0, gifWriter.end()), frames, spec);\n}\n\nfunction _extendPaletteToPowerOf2(palette) {\n const colors = palette.colors;\n if (palette.usesTransparency) {\n colors.push(0);\n }\n const colorCount = colors.length;\n let powerOf2 = 2;\n while (colorCount > powerOf2) {\n powerOf2 <<= 1;\n }\n colors.length = powerOf2;\n colors.fill(0, colorCount);\n}\n\nfunction _getFrameSizeEst(frame, pixelBitWidth) {\n let byteLength = frame.bitmap.width * frame.bitmap.height;\n byteLength = Math.ceil(byteLength * pixelBitWidth / 8);\n byteLength += Math.ceil(byteLength / 255); // add block size bytes\n // assume maximum palete size because it might get extended for power of 2\n return (PER_FRAME_OVERHEAD + byteLength + 3 * 256 /* largest palette */);\n}\n\nfunction _getIndexedImage(frameIndex, frame, palette) {\n const colors = palette.colors;\n const colorToIndexFunc = (colors.length <= 8 ? // guess at the break-even\n _colorLookupLinear : _colorLookupBinary);\n const colorBuffer = frame.bitmap.data;\n const indexBuffer = new Buffer(colorBuffer.length/4);\n let transparentIndex = colors.length;\n let i = 0, j = 0;\n\n while (i < colorBuffer.length) {\n if (colorBuffer[i + 3] !== 0) {\n const color = (colorBuffer.readUInt32BE(i, true) >> 8) & 0xFFFFFF;\n // caller guarantees that the color will be in the palette\n indexBuffer[j] = colorToIndexFunc(colors, color);\n }\n else {\n indexBuffer[j] = transparentIndex;\n }\n i += 4; // skip alpha\n ++j;\n }\n\n if (palette.usesTransparency) {\n if (transparentIndex === 256) {\n throw new GifError(`Frame ${frameIndex} already has 256 colors` +\n `and so can't use transparency`);\n }\n }\n else {\n transparentIndex = null;\n }\n\n return { buffer: indexBuffer, transparentIndex };\n}\n\nfunction _getPixelBitWidth(palette) {\n let indexCount = palette.indexCount;\n let pixelBitWidth = 0;\n --indexCount; // start at maximum index\n while (indexCount) {\n ++pixelBitWidth;\n indexCount >>= 1;\n }\n return (pixelBitWidth > 0 ? pixelBitWidth : 1);\n}\n\nfunction _writeFrame(gifWriter, frameIndex, frame, palette, isLocalPalette) {\n if (frame.interlaced) {\n throw new GifError(\"writing interlaced GIFs is not supported\");\n }\n const frameInfo = _getIndexedImage(frameIndex, frame, palette);\n const options = {\n delay: frame.delayCentisecs,\n disposal: frame.disposalMethod,\n transparent: frameInfo.transparentIndex\n };\n if (isLocalPalette) {\n _extendPaletteToPowerOf2(palette); // ok 'cause palette never used again\n options.palette = palette.colors;\n }\n try {\n let buffer = gifWriter.getOutputBuffer();\n let startOfFrame = gifWriter.getOutputBufferPosition();\n let endOfFrame;\n let tryAgain = true;\n\n while (tryAgain) {\n endOfFrame = gifWriter.addFrame(frame.xOffset, frame.yOffset,\n frame.bitmap.width, frame.bitmap.height, frameInfo.buffer, options);\n tryAgain = false;\n if (endOfFrame >= buffer.length - 1) {\n const biggerBuffer = new Buffer(buffer.length * 1.5);\n buffer.copy(biggerBuffer);\n gifWriter.setOutputBuffer(biggerBuffer);\n gifWriter.setOutputBufferPosition(startOfFrame);\n buffer = biggerBuffer;\n tryAgain = true;\n }\n }\n return buffer;\n }\n catch (err) {\n throw new GifError(err);\n }\n}\n","'use strict';\n\nconst BitmapImage = require('./bitmapimage');\nconst { GifError } = require('./gif');\n\n/** @class GifFrame */\n\nclass GifFrame extends BitmapImage {\n\n // xOffset - x offset of bitmap on GIF (defaults to 0)\n // yOffset - y offset of bitmap on GIF (defaults to 0)\n // disposalMethod - pixel disposal method when handling partial images\n // delayCentisecs - duration of frame in hundredths of a second\n // interlaced - whether the image is interlaced (defaults to false)\n\n /**\n * GifFrame is a class representing an image frame of a GIF. GIFs contain one or more instances of GifFrame.\n * \n * Property | Description\n * --- | ---\n * xOffset | x-coord of position within GIF at which to render the image (defaults to 0)\n * yOffset | y-coord of position within GIF at which to render the image (defaults to 0)\n * disposalMethod | GIF disposal method; only relevant when the frames aren't all the same size (defaults to 2, disposing to background color)\n * delayCentisecs | duration of the frame in hundreths of a second\n * interlaced | boolean indicating whether the frame renders interlaced\n * \n * Its constructor supports the following signatures:\n * \n * * new GifFrame(bitmap: {width: number, height: number, data: Buffer}, options?)\n * * new GifFrame(bitmapImage: BitmapImage, options?)\n * * new GifFrame(width: number, height: number, buffer: Buffer, options?)\n * * new GifFrame(width: number, height: number, backgroundRGBA?: number, options?)\n * * new GifFrame(frame: GifFrame)\n * \n * See the base class BitmapImage for a discussion of all parameters but `options` and `frame`. `options` is an optional argument providing initial values for the above-listed GifFrame properties. Each property within option is itself optional.\n * \n * Provide a `frame` to the constructor to create a clone of the provided frame. The new frame includes a copy of the provided frame's pixel data so that each can subsequently be modified without affecting each other.\n */\n\n constructor(...args) {\n super(...args);\n if (args[0] instanceof GifFrame) {\n // copy a provided GifFrame\n const source = args[0];\n this.xOffset = source.xOffset;\n this.yOffset = source.yOffset;\n this.disposalMethod = source.disposalMethod;\n this.delayCentisecs = source.delayCentisecs;\n this.interlaced = source.interlaced;\n }\n else {\n const lastArg = args[args.length - 1];\n let options = {};\n if (typeof lastArg === 'object' && !(lastArg instanceof BitmapImage)) {\n options = lastArg;\n }\n this.xOffset = options.xOffset || 0;\n this.yOffset = options.yOffset || 0;\n this.disposalMethod = (options.disposalMethod !== undefined ?\n options.disposalMethod : GifFrame.DisposeToBackgroundColor);\n this.delayCentisecs = options.delayCentisecs || 8;\n this.interlaced = options.interlaced || false;\n }\n }\n\n /**\n * Get a summary of the colors found within the frame. The return value is an object of the following form:\n * \n * Property | Description\n * --- | ---\n * colors | An array of all the opaque colors found within the frame. Each color is given as an RGB number of the form 0xRRGGBB. The array is sorted by increasing number. Will be an empty array when the image is completely transparent.\n * usesTransparency | boolean indicating whether there are any transparent pixels within the frame. A pixel is considered transparent if its alpha value is 0x00.\n * indexCount | The number of color indexes required to represent this palette of colors. It is equal to the number of opaque colors plus one if the image includes transparency.\n * \n * @return {object} An object representing a color palette as described above.\n */\n\n getPalette() {\n // returns with colors sorted low to high\n const colorSet = new Set();\n const buf = this.bitmap.data;\n let i = 0;\n let usesTransparency = false;\n while (i < buf.length) {\n if (buf[i + 3] === 0) {\n usesTransparency = true;\n }\n else {\n // can eliminate the bitshift by starting one byte prior\n const color = (buf.readUInt32BE(i, true) >> 8) & 0xFFFFFF;\n colorSet.add(color);\n }\n i += 4; // skip alpha\n }\n const colors = new Array(colorSet.size);\n const iter = colorSet.values();\n for (i = 0; i < colors.length; ++i) {\n colors[i] = iter.next().value;\n }\n colors.sort((a, b) => (a - b));\n let indexCount = colors.length;\n if (usesTransparency) {\n ++indexCount;\n }\n return { colors, usesTransparency, indexCount };\n }\n}\n\nGifFrame.DisposeToAnything = 0;\nGifFrame.DisposeNothing = 1;\nGifFrame.DisposeToBackgroundColor = 2;\nGifFrame.DisposeToPrevious = 3;\n\nexports.GifFrame = GifFrame;\n","'use strict';\n\n/** @namespace GifUtil */\n\nconst fs = require('fs');\nconst ImageQ = require('image-q');\n\nconst BitmapImage = require('./bitmapimage');\nconst { GifFrame } = require('./gifframe');\nconst { GifError } = require('./gif');\nconst { GifCodec } = require('./gifcodec');\n\nconst INVALID_SUFFIXES = ['.jpg', '.jpeg', '.png', '.bmp'];\n\nconst defaultCodec = new GifCodec();\n\n/**\n * cloneFrames() clones provided frames. It's a utility method for cloning an entire array of frames at once.\n * \n * @function cloneFrames\n * @memberof GifUtil\n * @param {GifFrame[]} frames An array of GifFrame instances to clone\n * @return {GifFrame[]} An array of GifFrame clones of the provided frames.\n */\n\nexports.cloneFrames = function (frames) {\n let clones = [];\n frames.forEach(frame => {\n\n clones.push(new GifFrame(frame));\n });\n return clones;\n}\n\n/**\n * getColorInfo() gets information about the colors used in the provided frames. The method is able to return an array of all colors found across all frames.\n * \n * `maxGlobalIndex` controls whether the computation short-circuits to avoid doing work that the caller doesn't need. The method only returns `colors` and `indexCount` for the colors across all frames when the number of indexes required to store the colors and transparency in a GIF (which is the value of `indexCount`) is less than or equal to `maxGlobalIndex`. Such short-circuiting is useful when the caller just needs to determine whether any frame includes transparency.\n * \n * @function getColorInfo\n * @memberof GifUtil\n * @param {GifFrame[]} frames Frames to examine for color and transparency.\n * @param {number} maxGlobalIndex Maximum number of color indexes (including one for transparency) allowed among the returned compilation of colors. `colors` and `indexCount` are not returned if the number of color indexes required to accommodate all frames exceeds this number. Returns `colors` and `indexCount` by default.\n * @returns {object} Object containing at least `palettes` and `usesTransparency`. `palettes` is an array of all the palettes returned by GifFrame#getPalette(). `usesTransparency` indicates whether at least one frame uses transparency. If `maxGlobalIndex` is not exceeded, the object also contains `colors`, an array of all colors (RGB) found across all palettes, sorted by increasing value, and `indexCount` indicating the number of indexes required to store the colors and the transparency in a GIF.\n * @throws {GifError} When any frame requires more than 256 color indexes.\n */\n\nexports.getColorInfo = function (frames, maxGlobalIndex) {\n let usesTransparency = false;\n const palettes = [];\n for (let i = 0; i < frames.length; ++i) {\n let palette = frames[i].getPalette();\n if (palette.usesTransparency) {\n usesTransparency = true;\n }\n if (palette.indexCount > 256) {\n throw new GifError(`Frame ${i} uses more than 256 color indexes`);\n }\n palettes.push(palette);\n }\n if (maxGlobalIndex === 0) {\n return { usesTransparency, palettes };\n }\n\n const globalColorSet = new Set();\n palettes.forEach(palette => {\n\n palette.colors.forEach(color => {\n\n globalColorSet.add(color);\n });\n });\n let indexCount = globalColorSet.size;\n if (usesTransparency) {\n // odd that GIF requires a color table entry at transparent index\n ++indexCount;\n }\n if (maxGlobalIndex && indexCount > maxGlobalIndex) {\n return { usesTransparency, palettes };\n }\n \n const colors = new Array(globalColorSet.size);\n const iter = globalColorSet.values();\n for (let i = 0; i < colors.length; ++i) {\n colors[i] = iter.next().value;\n }\n colors.sort((a, b) => (a - b));\n return { colors, indexCount, usesTransparency, palettes };\n};\n\n/**\n * copyAsJimp() returns a Jimp that contains a copy of the provided bitmap image (which may be either a BitmapImage or a GifFrame). Modifying the Jimp does not affect the provided bitmap image. This method serves as a macro for simplifying working with Jimp.\n *\n * @function copyAsJimp\n * @memberof GifUtil\n * @param {object} Reference to the Jimp package, keeping this library from being dependent on Jimp.\n * @param {bitmapImageToCopy} Instance of BitmapImage (may be a GifUtil) with which to source the Jimp.\n * @return {object} An new instance of Jimp containing a copy of the image in bitmapImageToCopy.\n */\n \nexports.copyAsJimp = function (jimp, bitmapImageToCopy) {\n return exports.shareAsJimp(jimp, new BitmapImage(bitmapImageToCopy));\n};\n\n/**\n * getMaxDimensions() returns the pixel width and height required to accommodate all of the provided frames, according to the offsets and dimensions of each frame.\n * \n * @function getMaxDimensions\n * @memberof GifUtil\n * @param {GifFrame[]} frames Frames to measure for their aggregate maximum dimensions.\n * @return {object} An object of the form {maxWidth, maxHeight} indicating the maximum width and height required to accommodate all frames.\n */\n\nexports.getMaxDimensions = function (frames) {\n let maxWidth = 0, maxHeight = 0;\n frames.forEach(frame => {\n const width = frame.xOffset + frame.bitmap.width;\n if (width > maxWidth) {\n maxWidth = width;\n }\n const height = frame.yOffset + frame.bitmap.height;\n if (height > maxHeight) {\n maxHeight = height;\n }\n });\n return { maxWidth, maxHeight };\n};\n\n/**\n * Quantizes colors so that there are at most a given number of color indexes (including transparency) across all provided images. Uses an algorithm by Anthony Dekker.\n * \n * The method treats different RGBA combinations as different colors, so if the frame has multiple alpha values or multiple RGB values for an alpha value, the caller may first want to normalize them by converting all transparent pixels to the same RGBA values.\n * \n * The method may increase the number of colors if there are fewer than the provided maximum.\n * \n * @function quantizeDekker\n * @memberof GifUtil\n * @param {BitmapImage|BitmapImage[]} imageOrImages Image or array of images (such as GifFrame instances) to be color-quantized. Quantizing across multiple images ensures color consistency from frame to frame.\n * @param {number} maxColorIndexes The maximum number of color indexes that will exist in the palette after completing quantization. Defaults to 256.\n * @param {object} dither (optional) An object configuring the dithering to apply. The properties are as followings, imported from the [`image-q` package](https://github.com/ibezkrovnyi/image-quantization) without explanation: { `ditherAlgorithm`: One of 'FloydSteinberg', 'FalseFloydSteinberg', 'Stucki', 'Atkinson', 'Jarvis', 'Burkes', 'Sierra', 'TwoSierra', 'SierraLite'; `minimumColorDistanceToDither`: (optional) A number defaulting to 0; `serpentine`: (optional) A boolean defaulting to true; `calculateErrorLikeGIMP`: (optional) A boolean defaulting to false. }\n */\n\nexports.quantizeDekker = function (imageOrImages, maxColorIndexes, dither) {\n maxColorIndexes = maxColorIndexes || 256;\n _quantize(imageOrImages, 'NeuQuantFloat', maxColorIndexes, 0, dither);\n}\n\n/**\n * Quantizes colors so that there are at most a given number of color indexes (including transparency) across all provided images. Uses an algorithm by Leon Sorokin. This quantization method differs from the other two by likely never increasing the number of colors, should there be fewer than the provided maximum.\n * \n * The method treats different RGBA combinations as different colors, so if the frame has multiple alpha values or multiple RGB values for an alpha value, the caller may first want to normalize them by converting all transparent pixels to the same RGBA values.\n * \n * @function quantizeSorokin\n * @memberof GifUtil\n * @param {BitmapImage|BitmapImage[]} imageOrImages Image or array of images (such as GifFrame instances) to be color-quantized. Quantizing across multiple images ensures color consistency from frame to frame.\n * @param {number} maxColorIndexes The maximum number of color indexes that will exist in the palette after completing quantization. Defaults to 256.\n * @param {string} histogram (optional) Histogram method: 'top-pop' for global top-population, 'min-pop' for minimum-population threshhold within subregions. Defaults to 'min-pop'.\n * @param {object} dither (optional) An object configuring the dithering to apply, as explained for `quantizeDekker()`.\n */\n\nexports.quantizeSorokin = function (imageOrImages, maxColorIndexes, histogram, dither) {\n maxColorIndexes = maxColorIndexes || 256;\n histogram = histogram || 'min-pop';\n let histogramID;\n switch (histogram) {\n case 'min-pop':\n histogramID = 2;\n break;\n\n case 'top-pop':\n histogramID = 1;\n break\n\n default:\n throw new Error(`Invalid quantizeSorokin histogram '${histogram}'`);\n }\n _quantize(imageOrImages, 'RGBQuant', maxColorIndexes, histogramID, dither);\n}\n\n/**\n * Quantizes colors so that there are at most a given number of color indexes (including transparency) across all provided images. Uses an algorithm by Xiaolin Wu.\n * \n * The method treats different RGBA combinations as different colors, so if the frame has multiple alpha values or multiple RGB values for an alpha value, the caller may first want to normalize them by converting all transparent pixels to the same RGBA values.\n * \n * The method may increase the number of colors if there are fewer than the provided maximum.\n * \n * @function quantizeWu\n * @memberof GifUtil\n * @param {BitmapImage|BitmapImage[]} imageOrImages Image or array of images (such as GifFrame instances) to be color-quantized. Quantizing across multiple images ensures color consistency from frame to frame.\n * @param {number} maxColorIndexes The maximum number of color indexes that will exist in the palette after completing quantization. Defaults to 256.\n * @param {number} significantBits (optional) This is the number of significant high bits in each RGB color channel. Takes integer values from 1 through 8. Higher values correspond to higher quality. Defaults to 5.\n * @param {object} dither (optional) An object configuring the dithering to apply, as explained for `quantizeDekker()`.\n */\n\nexports.quantizeWu = function (imageOrImages, maxColorIndexes, significantBits, dither) {\n maxColorIndexes = maxColorIndexes || 256;\n significantBits = significantBits || 5;\n if (significantBits < 1 || significantBits > 8) {\n throw new Error(\"Invalid quantization quality\");\n }\n _quantize(imageOrImages, 'WuQuant', maxColorIndexes, significantBits, dither);\n}\n\n/**\n * read() decodes an encoded GIF, whether provided as a filename or as a byte buffer.\n * \n * @function read\n * @memberof GifUtil\n * @param {string|Buffer} source Source to decode. When a string, it's the GIF filename to load and parse. When a Buffer, it's an encoded GIF to parse.\n * @param {object} decoder An optional GIF decoder object implementing the `decode` method of class GifCodec. When provided, the method decodes the GIF using this decoder. When not provided, the method uses GifCodec.\n * @return {Promise} A Promise that resolves to an instance of the Gif class, representing the decoded GIF.\n */\n\nexports.read = function (source, decoder) {\n decoder = decoder || defaultCodec;\n if (Buffer.isBuffer(source)) {\n return decoder.decodeGif(source);\n }\n return _readBinary(source)\n .then(buffer => {\n\n return decoder.decodeGif(buffer);\n });\n};\n\n/**\n * shareAsJimp() returns a Jimp that shares a bitmap with the provided bitmap image (which may be either a BitmapImage or a GifFrame). Modifying the image in either the Jimp or the BitmapImage affects the other objects. This method serves as a macro for simplifying working with Jimp.\n *\n * @function shareAsJimp\n * @memberof GifUtil\n * @param {object} Reference to the Jimp package, keeping this library from being dependent on Jimp.\n * @param {bitmapImageToShare} Instance of BitmapImage (may be a GifUtil) with which to source the Jimp.\n * @return {object} An new instance of Jimp that shares the image in bitmapImageToShare.\n */\n \nexports.shareAsJimp = function (jimp, bitmapImageToShare) {\n const jimpImage = new jimp(bitmapImageToShare.bitmap.width,\n bitmapImageToShare.bitmap.height, 0);\n jimpImage.bitmap.data = bitmapImageToShare.bitmap.data;\n return jimpImage;\n};\n\n/**\n * write() encodes a GIF and saves it as a file.\n * \n * @function write\n * @memberof GifUtil\n * @param {string} path Filename to write GIF out as. Will overwrite an existing file.\n * @param {GifFrame[]} frames Array of frames to be written into GIF.\n * @param {object} spec An optional object that may provide values for `loops` and `colorScope`, as defined for the Gif class. However, `colorSpace` may also take the value Gif.GlobalColorsPreferred (== 0) to indicate that the encoder should attempt to create only a global color table. `loop` defaults to 0, looping indefinitely, and `colorScope` defaults to Gif.GlobalColorsPreferred.\n * @param {object} encoder An optional GIF encoder object implementing the `encode` method of class GifCodec. When provided, the method encodes the GIF using this encoder. When not provided, the method uses GifCodec.\n * @return {Promise} A Promise that resolves to an instance of the Gif class, representing the encoded GIF.\n */\n\nexports.write = function (path, frames, spec, encoder) {\n encoder = encoder || defaultCodec;\n const matches = path.match(/\\.[a-zA-Z]+$/); // prevent accidents\n if (matches !== null &&\n INVALID_SUFFIXES.includes(matches[0].toLowerCase()))\n {\n throw new Error(`GIF '${path}' has an unexpected suffix`);\n }\n\n return encoder.encodeGif(frames, spec)\n .then(gif => {\n\n return _writeBinary(path, gif.buffer)\n .then(() => {\n\n return gif;\n });\n });\n};\n\nfunction _quantize(imageOrImages, method, maxColorIndexes, modifier, dither) {\n const images = Array.isArray(imageOrImages) ? imageOrImages : [imageOrImages];\n const ditherAlgs = [\n 'FloydSteinberg',\n 'FalseFloydSteinberg',\n 'Stucki',\n 'Atkinson',\n 'Jarvis',\n 'Burkes',\n 'Sierra',\n 'TwoSierra',\n 'SierraLite'\n ];\n\n if (dither) {\n if (ditherAlgs.indexOf(dither.ditherAlgorithm) < 0) {\n throw new Error(`Invalid ditherAlgorithm '${dither.ditherAlgorithm}'`);\n }\n if (dither.serpentine === undefined) {\n dither.serpentine = true;\n }\n if (dither.minimumColorDistanceToDither === undefined) {\n dither.minimumColorDistanceToDither = 0;\n }\n if (dither.calculateErrorLikeGIMP === undefined) {\n dither.calculateErrorLikeGIMP = false;\n }\n }\n\n const distCalculator = new ImageQ.distance.Euclidean();\n const quantizer = new ImageQ.palette[method](distCalculator, maxColorIndexes, modifier);\n let imageMaker;\n if (dither) {\n imageMaker = new ImageQ.image.ErrorDiffusionArray(\n distCalculator,\n ImageQ.image.ErrorDiffusionArrayKernel[dither.ditherAlgorithm],\n dither.serpentine,\n dither.minimumColorDistanceToDither,\n dither.calculateErrorLikeGIMP\n );\n }\n else {\n imageMaker = new ImageQ.image.NearestColor(distCalculator);\n }\n\n const inputContainers = [];\n images.forEach(image => {\n\n const imageBuf = image.bitmap.data;\n const inputBuf = new ArrayBuffer(imageBuf.length);\n const inputArray = new Uint32Array(inputBuf);\n for (let bi = 0, ai = 0; bi < imageBuf.length; bi += 4, ++ai) {\n inputArray[ai] = imageBuf.readUInt32LE(bi, true);\n }\n const inputContainer = ImageQ.utils.PointContainer.fromUint32Array(\n inputArray, image.bitmap.width, image.bitmap.height);\n quantizer.sample(inputContainer);\n inputContainers.push(inputContainer);\n });\n \n const limitedPalette = quantizer.quantizeSync();\n\n for (let i = 0; i < images.length; ++i) {\n const imageBuf = images[i].bitmap.data;\n const outputContainer = imageMaker.quantizeSync(inputContainers[i], limitedPalette);\n const outputArray = outputContainer.toUint32Array();\n for (let bi = 0, ai = 0; bi < imageBuf.length; bi += 4, ++ai) {\n imageBuf.writeUInt32LE(outputArray[ai], bi);\n }\n }\n}\n\nfunction _readBinary(path) {\n // TBD: add support for URLs\n return new Promise((resolve, reject) => {\n\n fs.readFile(path, (err, buffer) => {\n\n if (err) {\n return reject(err);\n }\n return resolve(buffer);\n });\n });\n}\n\nfunction _writeBinary(path, buffer) {\n // TBD: add support for URLs\n return new Promise((resolve, reject) => {\n\n fs.writeFile(path, buffer, err => {\n \n if (err) {\n return reject(err);\n }\n return resolve();\n });\n });\n}\n","'use strict';\n\nconst BitmapImage = require('./bitmapimage');\nconst { Gif, GifError } = require('./gif');\nconst { GifCodec } = require('./gifcodec');\nconst { GifFrame } = require('./gifframe');\nconst GifUtil = require('./gifutil');\n\nmodule.exports = {\n BitmapImage,\n Gif,\n GifCodec,\n GifFrame,\n GifUtil,\n GifError\n};\n","var win;\n\nif (typeof window !== \"undefined\") {\n win = window;\n} else if (typeof global !== \"undefined\") {\n win = global;\n} else if (typeof self !== \"undefined\"){\n win = self;\n} else {\n win = {};\n}\n\nmodule.exports = win;\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","'use strict';\n\nvar fnToStr = Function.prototype.toString;\n\nvar constructorRegex = /^\\s*class\\b/;\nvar isES6ClassFn = function isES6ClassFunction(value) {\n\ttry {\n\t\tvar fnStr = fnToStr.call(value);\n\t\treturn constructorRegex.test(fnStr);\n\t} catch (e) {\n\t\treturn false; // not a function\n\t}\n};\n\nvar tryFunctionObject = function tryFunctionToStr(value) {\n\ttry {\n\t\tif (isES6ClassFn(value)) { return false; }\n\t\tfnToStr.call(value);\n\t\treturn true;\n\t} catch (e) {\n\t\treturn false;\n\t}\n};\nvar toStr = Object.prototype.toString;\nvar fnClass = '[object Function]';\nvar genClass = '[object GeneratorFunction]';\nvar hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';\n\nmodule.exports = function isCallable(value) {\n\tif (!value) { return false; }\n\tif (typeof value !== 'function' && typeof value !== 'object') { return false; }\n\tif (typeof value === 'function' && !value.prototype) { return true; }\n\tif (hasToStringTag) { return tryFunctionObject(value); }\n\tif (isES6ClassFn(value)) { return false; }\n\tvar strClass = toStr.call(value);\n\treturn strClass === fnClass || strClass === genClass;\n};\n","module.exports = isFunction\n\nvar toString = Object.prototype.toString\n\nfunction isFunction (fn) {\n var string = toString.call(fn)\n return string === '[object Function]' ||\n (typeof fn === 'function' && string !== '[object RegExp]') ||\n (typeof window !== 'undefined' &&\n // IE8 and below\n (fn === window.setTimeout ||\n fn === window.alert ||\n fn === window.confirm ||\n fn === window.prompt))\n};\n","// the whatwg-fetch polyfill installs the fetch() function\n// on the global object (window or self)\n//\n// Return that as the export for use in Webpack, Browserify etc.\nrequire('whatwg-fetch');\nmodule.exports = self.fetch.bind(self);\n","var encode = require('./lib/encoder'),\n decode = require('./lib/decoder');\n\nmodule.exports = {\n encode: encode,\n decode: decode\n};\n","/* -*- tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /\n/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */\n/*\n Copyright 2011 notmasteryet\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*/\n\n// - The JPEG specification can be found in the ITU CCITT Recommendation T.81\n// (www.w3.org/Graphics/JPEG/itu-t81.pdf)\n// - The JFIF specification can be found in the JPEG File Interchange Format\n// (www.w3.org/Graphics/JPEG/jfif3.pdf)\n// - The Adobe Application-Specific JPEG markers in the Supporting the DCT Filters\n// in PostScript Level 2, Technical Note #5116\n// (partners.adobe.com/public/developer/en/ps/sdk/5116.DCT_Filter.pdf)\n\nvar JpegImage = (function jpegImage() {\n \"use strict\";\n var dctZigZag = new Int32Array([\n 0,\n 1, 8,\n 16, 9, 2,\n 3, 10, 17, 24,\n 32, 25, 18, 11, 4,\n 5, 12, 19, 26, 33, 40,\n 48, 41, 34, 27, 20, 13, 6,\n 7, 14, 21, 28, 35, 42, 49, 56,\n 57, 50, 43, 36, 29, 22, 15,\n 23, 30, 37, 44, 51, 58,\n 59, 52, 45, 38, 31,\n 39, 46, 53, 60,\n 61, 54, 47,\n 55, 62,\n 63\n ]);\n\n var dctCos1 = 4017 // cos(pi/16)\n var dctSin1 = 799 // sin(pi/16)\n var dctCos3 = 3406 // cos(3*pi/16)\n var dctSin3 = 2276 // sin(3*pi/16)\n var dctCos6 = 1567 // cos(6*pi/16)\n var dctSin6 = 3784 // sin(6*pi/16)\n var dctSqrt2 = 5793 // sqrt(2)\n var dctSqrt1d2 = 2896 // sqrt(2) / 2\n\n function constructor() {\n }\n\n function buildHuffmanTable(codeLengths, values) {\n var k = 0, code = [], i, j, length = 16;\n while (length > 0 && !codeLengths[length - 1])\n length--;\n code.push({children: [], index: 0});\n var p = code[0], q;\n for (i = 0; i < length; i++) {\n for (j = 0; j < codeLengths[i]; j++) {\n p = code.pop();\n p.children[p.index] = values[k];\n while (p.index > 0) {\n if (code.length === 0)\n throw new Error('Could not recreate Huffman Table');\n p = code.pop();\n }\n p.index++;\n code.push(p);\n while (code.length <= i) {\n code.push(q = {children: [], index: 0});\n p.children[p.index] = q.children;\n p = q;\n }\n k++;\n }\n if (i + 1 < length) {\n // p here points to last code\n code.push(q = {children: [], index: 0});\n p.children[p.index] = q.children;\n p = q;\n }\n }\n return code[0].children;\n }\n\n function decodeScan(data, offset,\n frame, components, resetInterval,\n spectralStart, spectralEnd,\n successivePrev, successive, opts) {\n var precision = frame.precision;\n var samplesPerLine = frame.samplesPerLine;\n var scanLines = frame.scanLines;\n var mcusPerLine = frame.mcusPerLine;\n var progressive = frame.progressive;\n var maxH = frame.maxH, maxV = frame.maxV;\n\n var startOffset = offset, bitsData = 0, bitsCount = 0;\n function readBit() {\n if (bitsCount > 0) {\n bitsCount--;\n return (bitsData >> bitsCount) & 1;\n }\n bitsData = data[offset++];\n if (bitsData == 0xFF) {\n var nextByte = data[offset++];\n if (nextByte) {\n throw new Error(\"unexpected marker: \" + ((bitsData << 8) | nextByte).toString(16));\n }\n // unstuff 0\n }\n bitsCount = 7;\n return bitsData >>> 7;\n }\n function decodeHuffman(tree) {\n var node = tree, bit;\n while ((bit = readBit()) !== null) {\n node = node[bit];\n if (typeof node === 'number')\n return node;\n if (typeof node !== 'object')\n throw new Error(\"invalid huffman sequence\");\n }\n return null;\n }\n function receive(length) {\n var n = 0;\n while (length > 0) {\n var bit = readBit();\n if (bit === null) return;\n n = (n << 1) | bit;\n length--;\n }\n return n;\n }\n function receiveAndExtend(length) {\n var n = receive(length);\n if (n >= 1 << (length - 1))\n return n;\n return n + (-1 << length) + 1;\n }\n function decodeBaseline(component, zz) {\n var t = decodeHuffman(component.huffmanTableDC);\n var diff = t === 0 ? 0 : receiveAndExtend(t);\n zz[0]= (component.pred += diff);\n var k = 1;\n while (k < 64) {\n var rs = decodeHuffman(component.huffmanTableAC);\n var s = rs & 15, r = rs >> 4;\n if (s === 0) {\n if (r < 15)\n break;\n k += 16;\n continue;\n }\n k += r;\n var z = dctZigZag[k];\n zz[z] = receiveAndExtend(s);\n k++;\n }\n }\n function decodeDCFirst(component, zz) {\n var t = decodeHuffman(component.huffmanTableDC);\n var diff = t === 0 ? 0 : (receiveAndExtend(t) << successive);\n zz[0] = (component.pred += diff);\n }\n function decodeDCSuccessive(component, zz) {\n zz[0] |= readBit() << successive;\n }\n var eobrun = 0;\n function decodeACFirst(component, zz) {\n if (eobrun > 0) {\n eobrun--;\n return;\n }\n var k = spectralStart, e = spectralEnd;\n while (k <= e) {\n var rs = decodeHuffman(component.huffmanTableAC);\n var s = rs & 15, r = rs >> 4;\n if (s === 0) {\n if (r < 15) {\n eobrun = receive(r) + (1 << r) - 1;\n break;\n }\n k += 16;\n continue;\n }\n k += r;\n var z = dctZigZag[k];\n zz[z] = receiveAndExtend(s) * (1 << successive);\n k++;\n }\n }\n var successiveACState = 0, successiveACNextValue;\n function decodeACSuccessive(component, zz) {\n var k = spectralStart, e = spectralEnd, r = 0;\n while (k <= e) {\n var z = dctZigZag[k];\n var direction = zz[z] < 0 ? -1 : 1;\n switch (successiveACState) {\n case 0: // initial state\n var rs = decodeHuffman(component.huffmanTableAC);\n var s = rs & 15, r = rs >> 4;\n if (s === 0) {\n if (r < 15) {\n eobrun = receive(r) + (1 << r);\n successiveACState = 4;\n } else {\n r = 16;\n successiveACState = 1;\n }\n } else {\n if (s !== 1)\n throw new Error(\"invalid ACn encoding\");\n successiveACNextValue = receiveAndExtend(s);\n successiveACState = r ? 2 : 3;\n }\n continue;\n case 1: // skipping r zero items\n case 2:\n if (zz[z])\n zz[z] += (readBit() << successive) * direction;\n else {\n r--;\n if (r === 0)\n successiveACState = successiveACState == 2 ? 3 : 0;\n }\n break;\n case 3: // set value for a zero item\n if (zz[z])\n zz[z] += (readBit() << successive) * direction;\n else {\n zz[z] = successiveACNextValue << successive;\n successiveACState = 0;\n }\n break;\n case 4: // eob\n if (zz[z])\n zz[z] += (readBit() << successive) * direction;\n break;\n }\n k++;\n }\n if (successiveACState === 4) {\n eobrun--;\n if (eobrun === 0)\n successiveACState = 0;\n }\n }\n function decodeMcu(component, decode, mcu, row, col) {\n var mcuRow = (mcu / mcusPerLine) | 0;\n var mcuCol = mcu % mcusPerLine;\n var blockRow = mcuRow * component.v + row;\n var blockCol = mcuCol * component.h + col;\n // If the block is missing and we're in tolerant mode, just skip it.\n if (component.blocks[blockRow] === undefined && opts.tolerantDecoding)\n return;\n decode(component, component.blocks[blockRow][blockCol]);\n }\n function decodeBlock(component, decode, mcu) {\n var blockRow = (mcu / component.blocksPerLine) | 0;\n var blockCol = mcu % component.blocksPerLine;\n // If the block is missing and we're in tolerant mode, just skip it.\n if (component.blocks[blockRow] === undefined && opts.tolerantDecoding)\n return;\n decode(component, component.blocks[blockRow][blockCol]);\n }\n\n var componentsLength = components.length;\n var component, i, j, k, n;\n var decodeFn;\n if (progressive) {\n if (spectralStart === 0)\n decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;\n else\n decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;\n } else {\n decodeFn = decodeBaseline;\n }\n\n var mcu = 0, marker;\n var mcuExpected;\n if (componentsLength == 1) {\n mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;\n } else {\n mcuExpected = mcusPerLine * frame.mcusPerColumn;\n }\n if (!resetInterval) resetInterval = mcuExpected;\n\n var h, v;\n while (mcu < mcuExpected) {\n // reset interval stuff\n for (i = 0; i < componentsLength; i++)\n components[i].pred = 0;\n eobrun = 0;\n\n if (componentsLength == 1) {\n component = components[0];\n for (n = 0; n < resetInterval; n++) {\n decodeBlock(component, decodeFn, mcu);\n mcu++;\n }\n } else {\n for (n = 0; n < resetInterval; n++) {\n for (i = 0; i < componentsLength; i++) {\n component = components[i];\n h = component.h;\n v = component.v;\n for (j = 0; j < v; j++) {\n for (k = 0; k < h; k++) {\n decodeMcu(component, decodeFn, mcu, j, k);\n }\n }\n }\n mcu++;\n\n // If we've reached our expected MCU's, stop decoding\n if (mcu === mcuExpected) break;\n }\n }\n\n if (mcu === mcuExpected) {\n // Skip trailing bytes at the end of the scan - until we reach the next marker\n do {\n if (data[offset] === 0xFF) {\n if (data[offset + 1] !== 0x00) {\n break;\n }\n }\n offset += 1;\n } while (offset < data.length - 2);\n }\n\n // find marker\n bitsCount = 0;\n marker = (data[offset] << 8) | data[offset + 1];\n if (marker < 0xFF00) {\n throw new Error(\"marker was not found\");\n }\n\n if (marker >= 0xFFD0 && marker <= 0xFFD7) { // RSTx\n offset += 2;\n }\n else\n break;\n }\n\n return offset - startOffset;\n }\n\n function buildComponentData(frame, component) {\n var lines = [];\n var blocksPerLine = component.blocksPerLine;\n var blocksPerColumn = component.blocksPerColumn;\n var samplesPerLine = blocksPerLine << 3;\n // Only 1 used per invocation of this function and garbage collected after invocation, so no need to account for its memory footprint.\n var R = new Int32Array(64), r = new Uint8Array(64);\n\n // A port of poppler's IDCT method which in turn is taken from:\n // Christoph Loeffler, Adriaan Ligtenberg, George S. Moschytz,\n // \"Practical Fast 1-D DCT Algorithms with 11 Multiplications\",\n // IEEE Intl. Conf. on Acoustics, Speech & Signal Processing, 1989,\n // 988-991.\n function quantizeAndInverse(zz, dataOut, dataIn) {\n var qt = component.quantizationTable;\n var v0, v1, v2, v3, v4, v5, v6, v7, t;\n var p = dataIn;\n var i;\n\n // dequant\n for (i = 0; i < 64; i++)\n p[i] = zz[i] * qt[i];\n\n // inverse DCT on rows\n for (i = 0; i < 8; ++i) {\n var row = 8 * i;\n\n // check for all-zero AC coefficients\n if (p[1 + row] == 0 && p[2 + row] == 0 && p[3 + row] == 0 &&\n p[4 + row] == 0 && p[5 + row] == 0 && p[6 + row] == 0 &&\n p[7 + row] == 0) {\n t = (dctSqrt2 * p[0 + row] + 512) >> 10;\n p[0 + row] = t;\n p[1 + row] = t;\n p[2 + row] = t;\n p[3 + row] = t;\n p[4 + row] = t;\n p[5 + row] = t;\n p[6 + row] = t;\n p[7 + row] = t;\n continue;\n }\n\n // stage 4\n v0 = (dctSqrt2 * p[0 + row] + 128) >> 8;\n v1 = (dctSqrt2 * p[4 + row] + 128) >> 8;\n v2 = p[2 + row];\n v3 = p[6 + row];\n v4 = (dctSqrt1d2 * (p[1 + row] - p[7 + row]) + 128) >> 8;\n v7 = (dctSqrt1d2 * (p[1 + row] + p[7 + row]) + 128) >> 8;\n v5 = p[3 + row] << 4;\n v6 = p[5 + row] << 4;\n\n // stage 3\n t = (v0 - v1+ 1) >> 1;\n v0 = (v0 + v1 + 1) >> 1;\n v1 = t;\n t = (v2 * dctSin6 + v3 * dctCos6 + 128) >> 8;\n v2 = (v2 * dctCos6 - v3 * dctSin6 + 128) >> 8;\n v3 = t;\n t = (v4 - v6 + 1) >> 1;\n v4 = (v4 + v6 + 1) >> 1;\n v6 = t;\n t = (v7 + v5 + 1) >> 1;\n v5 = (v7 - v5 + 1) >> 1;\n v7 = t;\n\n // stage 2\n t = (v0 - v3 + 1) >> 1;\n v0 = (v0 + v3 + 1) >> 1;\n v3 = t;\n t = (v1 - v2 + 1) >> 1;\n v1 = (v1 + v2 + 1) >> 1;\n v2 = t;\n t = (v4 * dctSin3 + v7 * dctCos3 + 2048) >> 12;\n v4 = (v4 * dctCos3 - v7 * dctSin3 + 2048) >> 12;\n v7 = t;\n t = (v5 * dctSin1 + v6 * dctCos1 + 2048) >> 12;\n v5 = (v5 * dctCos1 - v6 * dctSin1 + 2048) >> 12;\n v6 = t;\n\n // stage 1\n p[0 + row] = v0 + v7;\n p[7 + row] = v0 - v7;\n p[1 + row] = v1 + v6;\n p[6 + row] = v1 - v6;\n p[2 + row] = v2 + v5;\n p[5 + row] = v2 - v5;\n p[3 + row] = v3 + v4;\n p[4 + row] = v3 - v4;\n }\n\n // inverse DCT on columns\n for (i = 0; i < 8; ++i) {\n var col = i;\n\n // check for all-zero AC coefficients\n if (p[1*8 + col] == 0 && p[2*8 + col] == 0 && p[3*8 + col] == 0 &&\n p[4*8 + col] == 0 && p[5*8 + col] == 0 && p[6*8 + col] == 0 &&\n p[7*8 + col] == 0) {\n t = (dctSqrt2 * dataIn[i+0] + 8192) >> 14;\n p[0*8 + col] = t;\n p[1*8 + col] = t;\n p[2*8 + col] = t;\n p[3*8 + col] = t;\n p[4*8 + col] = t;\n p[5*8 + col] = t;\n p[6*8 + col] = t;\n p[7*8 + col] = t;\n continue;\n }\n\n // stage 4\n v0 = (dctSqrt2 * p[0*8 + col] + 2048) >> 12;\n v1 = (dctSqrt2 * p[4*8 + col] + 2048) >> 12;\n v2 = p[2*8 + col];\n v3 = p[6*8 + col];\n v4 = (dctSqrt1d2 * (p[1*8 + col] - p[7*8 + col]) + 2048) >> 12;\n v7 = (dctSqrt1d2 * (p[1*8 + col] + p[7*8 + col]) + 2048) >> 12;\n v5 = p[3*8 + col];\n v6 = p[5*8 + col];\n\n // stage 3\n t = (v0 - v1 + 1) >> 1;\n v0 = (v0 + v1 + 1) >> 1;\n v1 = t;\n t = (v2 * dctSin6 + v3 * dctCos6 + 2048) >> 12;\n v2 = (v2 * dctCos6 - v3 * dctSin6 + 2048) >> 12;\n v3 = t;\n t = (v4 - v6 + 1) >> 1;\n v4 = (v4 + v6 + 1) >> 1;\n v6 = t;\n t = (v7 + v5 + 1) >> 1;\n v5 = (v7 - v5 + 1) >> 1;\n v7 = t;\n\n // stage 2\n t = (v0 - v3 + 1) >> 1;\n v0 = (v0 + v3 + 1) >> 1;\n v3 = t;\n t = (v1 - v2 + 1) >> 1;\n v1 = (v1 + v2 + 1) >> 1;\n v2 = t;\n t = (v4 * dctSin3 + v7 * dctCos3 + 2048) >> 12;\n v4 = (v4 * dctCos3 - v7 * dctSin3 + 2048) >> 12;\n v7 = t;\n t = (v5 * dctSin1 + v6 * dctCos1 + 2048) >> 12;\n v5 = (v5 * dctCos1 - v6 * dctSin1 + 2048) >> 12;\n v6 = t;\n\n // stage 1\n p[0*8 + col] = v0 + v7;\n p[7*8 + col] = v0 - v7;\n p[1*8 + col] = v1 + v6;\n p[6*8 + col] = v1 - v6;\n p[2*8 + col] = v2 + v5;\n p[5*8 + col] = v2 - v5;\n p[3*8 + col] = v3 + v4;\n p[4*8 + col] = v3 - v4;\n }\n\n // convert to 8-bit integers\n for (i = 0; i < 64; ++i) {\n var sample = 128 + ((p[i] + 8) >> 4);\n dataOut[i] = sample < 0 ? 0 : sample > 0xFF ? 0xFF : sample;\n }\n }\n\n requestMemoryAllocation(samplesPerLine * blocksPerColumn * 8);\n\n var i, j;\n for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) {\n var scanLine = blockRow << 3;\n for (i = 0; i < 8; i++)\n lines.push(new Uint8Array(samplesPerLine));\n for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {\n quantizeAndInverse(component.blocks[blockRow][blockCol], r, R);\n\n var offset = 0, sample = blockCol << 3;\n for (j = 0; j < 8; j++) {\n var line = lines[scanLine + j];\n for (i = 0; i < 8; i++)\n line[sample + i] = r[offset++];\n }\n }\n }\n return lines;\n }\n\n function clampTo8bit(a) {\n return a < 0 ? 0 : a > 255 ? 255 : a;\n }\n\n constructor.prototype = {\n load: function load(path) {\n var xhr = new XMLHttpRequest();\n xhr.open(\"GET\", path, true);\n xhr.responseType = \"arraybuffer\";\n xhr.onload = (function() {\n // TODO catch parse error\n var data = new Uint8Array(xhr.response || xhr.mozResponseArrayBuffer);\n this.parse(data);\n if (this.onload)\n this.onload();\n }).bind(this);\n xhr.send(null);\n },\n parse: function parse(data) {\n var maxResolutionInPixels = this.opts.maxResolutionInMP * 1000 * 1000;\n var offset = 0, length = data.length;\n function readUint16() {\n var value = (data[offset] << 8) | data[offset + 1];\n offset += 2;\n return value;\n }\n function readDataBlock() {\n var length = readUint16();\n var array = data.subarray(offset, offset + length - 2);\n offset += array.length;\n return array;\n }\n function prepareComponents(frame) {\n // According to the JPEG standard, the sampling factor must be between 1 and 4\n // See https://github.com/libjpeg-turbo/libjpeg-turbo/blob/9abeff46d87bd201a952e276f3e4339556a403a3/libjpeg.txt#L1138-L1146\n var maxH = 1, maxV = 1;\n var component, componentId;\n for (componentId in frame.components) {\n if (frame.components.hasOwnProperty(componentId)) {\n component = frame.components[componentId];\n if (maxH < component.h) maxH = component.h;\n if (maxV < component.v) maxV = component.v;\n }\n }\n var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / maxH);\n var mcusPerColumn = Math.ceil(frame.scanLines / 8 / maxV);\n for (componentId in frame.components) {\n if (frame.components.hasOwnProperty(componentId)) {\n component = frame.components[componentId];\n var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / maxH);\n var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / maxV);\n var blocksPerLineForMcu = mcusPerLine * component.h;\n var blocksPerColumnForMcu = mcusPerColumn * component.v;\n var blocksToAllocate = blocksPerColumnForMcu * blocksPerLineForMcu;\n var blocks = [];\n\n // Each block is a Int32Array of length 64 (4 x 64 = 256 bytes)\n requestMemoryAllocation(blocksToAllocate * 256);\n\n for (var i = 0; i < blocksPerColumnForMcu; i++) {\n var row = [];\n for (var j = 0; j < blocksPerLineForMcu; j++)\n row.push(new Int32Array(64));\n blocks.push(row);\n }\n component.blocksPerLine = blocksPerLine;\n component.blocksPerColumn = blocksPerColumn;\n component.blocks = blocks;\n }\n }\n frame.maxH = maxH;\n frame.maxV = maxV;\n frame.mcusPerLine = mcusPerLine;\n frame.mcusPerColumn = mcusPerColumn;\n }\n var jfif = null;\n var adobe = null;\n var pixels = null;\n var frame, resetInterval;\n var quantizationTables = [], frames = [];\n var huffmanTablesAC = [], huffmanTablesDC = [];\n var fileMarker = readUint16();\n var malformedDataOffset = -1;\n this.comments = [];\n if (fileMarker != 0xFFD8) { // SOI (Start of Image)\n throw new Error(\"SOI not found\");\n }\n\n fileMarker = readUint16();\n while (fileMarker != 0xFFD9) { // EOI (End of image)\n var i, j, l;\n switch(fileMarker) {\n case 0xFF00: break;\n case 0xFFE0: // APP0 (Application Specific)\n case 0xFFE1: // APP1\n case 0xFFE2: // APP2\n case 0xFFE3: // APP3\n case 0xFFE4: // APP4\n case 0xFFE5: // APP5\n case 0xFFE6: // APP6\n case 0xFFE7: // APP7\n case 0xFFE8: // APP8\n case 0xFFE9: // APP9\n case 0xFFEA: // APP10\n case 0xFFEB: // APP11\n case 0xFFEC: // APP12\n case 0xFFED: // APP13\n case 0xFFEE: // APP14\n case 0xFFEF: // APP15\n case 0xFFFE: // COM (Comment)\n var appData = readDataBlock();\n\n if (fileMarker === 0xFFFE) {\n var comment = String.fromCharCode.apply(null, appData);\n this.comments.push(comment);\n }\n\n if (fileMarker === 0xFFE0) {\n if (appData[0] === 0x4A && appData[1] === 0x46 && appData[2] === 0x49 &&\n appData[3] === 0x46 && appData[4] === 0) { // 'JFIF\\x00'\n jfif = {\n version: { major: appData[5], minor: appData[6] },\n densityUnits: appData[7],\n xDensity: (appData[8] << 8) | appData[9],\n yDensity: (appData[10] << 8) | appData[11],\n thumbWidth: appData[12],\n thumbHeight: appData[13],\n thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])\n };\n }\n }\n // TODO APP1 - Exif\n if (fileMarker === 0xFFE1) {\n if (appData[0] === 0x45 &&\n appData[1] === 0x78 &&\n appData[2] === 0x69 &&\n appData[3] === 0x66 &&\n appData[4] === 0) { // 'EXIF\\x00'\n this.exifBuffer = appData.subarray(5, appData.length);\n }\n }\n\n if (fileMarker === 0xFFEE) {\n if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6F &&\n appData[3] === 0x62 && appData[4] === 0x65 && appData[5] === 0) { // 'Adobe\\x00'\n adobe = {\n version: appData[6],\n flags0: (appData[7] << 8) | appData[8],\n flags1: (appData[9] << 8) | appData[10],\n transformCode: appData[11]\n };\n }\n }\n break;\n\n case 0xFFDB: // DQT (Define Quantization Tables)\n var quantizationTablesLength = readUint16();\n var quantizationTablesEnd = quantizationTablesLength + offset - 2;\n while (offset < quantizationTablesEnd) {\n var quantizationTableSpec = data[offset++];\n requestMemoryAllocation(64 * 4);\n var tableData = new Int32Array(64);\n if ((quantizationTableSpec >> 4) === 0) { // 8 bit values\n for (j = 0; j < 64; j++) {\n var z = dctZigZag[j];\n tableData[z] = data[offset++];\n }\n } else if ((quantizationTableSpec >> 4) === 1) { //16 bit\n for (j = 0; j < 64; j++) {\n var z = dctZigZag[j];\n tableData[z] = readUint16();\n }\n } else\n throw new Error(\"DQT: invalid table spec\");\n quantizationTables[quantizationTableSpec & 15] = tableData;\n }\n break;\n\n case 0xFFC0: // SOF0 (Start of Frame, Baseline DCT)\n case 0xFFC1: // SOF1 (Start of Frame, Extended DCT)\n case 0xFFC2: // SOF2 (Start of Frame, Progressive DCT)\n readUint16(); // skip data length\n frame = {};\n frame.extended = (fileMarker === 0xFFC1);\n frame.progressive = (fileMarker === 0xFFC2);\n frame.precision = data[offset++];\n frame.scanLines = readUint16();\n frame.samplesPerLine = readUint16();\n frame.components = {};\n frame.componentsOrder = [];\n\n var pixelsInFrame = frame.scanLines * frame.samplesPerLine;\n if (pixelsInFrame > maxResolutionInPixels) {\n var exceededAmount = Math.ceil((pixelsInFrame - maxResolutionInPixels) / 1e6);\n throw new Error(`maxResolutionInMP limit exceeded by ${exceededAmount}MP`);\n }\n\n var componentsCount = data[offset++], componentId;\n var maxH = 0, maxV = 0;\n for (i = 0; i < componentsCount; i++) {\n componentId = data[offset];\n var h = data[offset + 1] >> 4;\n var v = data[offset + 1] & 15;\n var qId = data[offset + 2];\n\n if ( h <= 0 || v <= 0 ) {\n throw new Error('Invalid sampling factor, expected values above 0');\n }\n\n frame.componentsOrder.push(componentId);\n frame.components[componentId] = {\n h: h,\n v: v,\n quantizationIdx: qId\n };\n offset += 3;\n }\n prepareComponents(frame);\n frames.push(frame);\n break;\n\n case 0xFFC4: // DHT (Define Huffman Tables)\n var huffmanLength = readUint16();\n for (i = 2; i < huffmanLength;) {\n var huffmanTableSpec = data[offset++];\n var codeLengths = new Uint8Array(16);\n var codeLengthSum = 0;\n for (j = 0; j < 16; j++, offset++) {\n codeLengthSum += (codeLengths[j] = data[offset]);\n }\n requestMemoryAllocation(16 + codeLengthSum);\n var huffmanValues = new Uint8Array(codeLengthSum);\n for (j = 0; j < codeLengthSum; j++, offset++)\n huffmanValues[j] = data[offset];\n i += 17 + codeLengthSum;\n\n ((huffmanTableSpec >> 4) === 0 ?\n huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] =\n buildHuffmanTable(codeLengths, huffmanValues);\n }\n break;\n\n case 0xFFDD: // DRI (Define Restart Interval)\n readUint16(); // skip data length\n resetInterval = readUint16();\n break;\n\n case 0xFFDC: // Number of Lines marker\n readUint16() // skip data length\n readUint16() // Ignore this data since it represents the image height\n break;\n \n case 0xFFDA: // SOS (Start of Scan)\n var scanLength = readUint16();\n var selectorsCount = data[offset++];\n var components = [], component;\n for (i = 0; i < selectorsCount; i++) {\n component = frame.components[data[offset++]];\n var tableSpec = data[offset++];\n component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];\n component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];\n components.push(component);\n }\n var spectralStart = data[offset++];\n var spectralEnd = data[offset++];\n var successiveApproximation = data[offset++];\n var processed = decodeScan(data, offset,\n frame, components, resetInterval,\n spectralStart, spectralEnd,\n successiveApproximation >> 4, successiveApproximation & 15, this.opts);\n offset += processed;\n break;\n\n case 0xFFFF: // Fill bytes\n if (data[offset] !== 0xFF) { // Avoid skipping a valid marker.\n offset--;\n }\n break;\n default:\n if (data[offset - 3] == 0xFF &&\n data[offset - 2] >= 0xC0 && data[offset - 2] <= 0xFE) {\n // could be incorrect encoding -- last 0xFF byte of the previous\n // block was eaten by the encoder\n offset -= 3;\n break;\n }\n else if (fileMarker === 0xE0 || fileMarker == 0xE1) {\n // Recover from malformed APP1 markers popular in some phone models.\n // See https://github.com/eugeneware/jpeg-js/issues/82\n if (malformedDataOffset !== -1) {\n throw new Error(`first unknown JPEG marker at offset ${malformedDataOffset.toString(16)}, second unknown JPEG marker ${fileMarker.toString(16)} at offset ${(offset - 1).toString(16)}`);\n }\n malformedDataOffset = offset - 1;\n const nextOffset = readUint16();\n if (data[offset + nextOffset - 2] === 0xFF) {\n offset += nextOffset - 2;\n break;\n }\n }\n throw new Error(\"unknown JPEG marker \" + fileMarker.toString(16));\n }\n fileMarker = readUint16();\n }\n if (frames.length != 1)\n throw new Error(\"only single frame JPEGs supported\");\n\n // set each frame's components quantization table\n for (var i = 0; i < frames.length; i++) {\n var cp = frames[i].components;\n for (var j in cp) {\n cp[j].quantizationTable = quantizationTables[cp[j].quantizationIdx];\n delete cp[j].quantizationIdx;\n }\n }\n\n this.width = frame.samplesPerLine;\n this.height = frame.scanLines;\n this.jfif = jfif;\n this.adobe = adobe;\n this.components = [];\n for (var i = 0; i < frame.componentsOrder.length; i++) {\n var component = frame.components[frame.componentsOrder[i]];\n this.components.push({\n lines: buildComponentData(frame, component),\n scaleX: component.h / frame.maxH,\n scaleY: component.v / frame.maxV\n });\n }\n },\n getData: function getData(width, height) {\n var scaleX = this.width / width, scaleY = this.height / height;\n\n var component1, component2, component3, component4;\n var component1Line, component2Line, component3Line, component4Line;\n var x, y;\n var offset = 0;\n var Y, Cb, Cr, K, C, M, Ye, R, G, B;\n var colorTransform;\n var dataLength = width * height * this.components.length;\n requestMemoryAllocation(dataLength);\n var data = new Uint8Array(dataLength);\n switch (this.components.length) {\n case 1:\n component1 = this.components[0];\n for (y = 0; y < height; y++) {\n component1Line = component1.lines[0 | (y * component1.scaleY * scaleY)];\n for (x = 0; x < width; x++) {\n Y = component1Line[0 | (x * component1.scaleX * scaleX)];\n\n data[offset++] = Y;\n }\n }\n break;\n case 2:\n // PDF might compress two component data in custom colorspace\n component1 = this.components[0];\n component2 = this.components[1];\n for (y = 0; y < height; y++) {\n component1Line = component1.lines[0 | (y * component1.scaleY * scaleY)];\n component2Line = component2.lines[0 | (y * component2.scaleY * scaleY)];\n for (x = 0; x < width; x++) {\n Y = component1Line[0 | (x * component1.scaleX * scaleX)];\n data[offset++] = Y;\n Y = component2Line[0 | (x * component2.scaleX * scaleX)];\n data[offset++] = Y;\n }\n }\n break;\n case 3:\n // The default transform for three components is true\n colorTransform = true;\n // The adobe transform marker overrides any previous setting\n if (this.adobe && this.adobe.transformCode)\n colorTransform = true;\n else if (typeof this.opts.colorTransform !== 'undefined')\n colorTransform = !!this.opts.colorTransform;\n\n component1 = this.components[0];\n component2 = this.components[1];\n component3 = this.components[2];\n for (y = 0; y < height; y++) {\n component1Line = component1.lines[0 | (y * component1.scaleY * scaleY)];\n component2Line = component2.lines[0 | (y * component2.scaleY * scaleY)];\n component3Line = component3.lines[0 | (y * component3.scaleY * scaleY)];\n for (x = 0; x < width; x++) {\n if (!colorTransform) {\n R = component1Line[0 | (x * component1.scaleX * scaleX)];\n G = component2Line[0 | (x * component2.scaleX * scaleX)];\n B = component3Line[0 | (x * component3.scaleX * scaleX)];\n } else {\n Y = component1Line[0 | (x * component1.scaleX * scaleX)];\n Cb = component2Line[0 | (x * component2.scaleX * scaleX)];\n Cr = component3Line[0 | (x * component3.scaleX * scaleX)];\n\n R = clampTo8bit(Y + 1.402 * (Cr - 128));\n G = clampTo8bit(Y - 0.3441363 * (Cb - 128) - 0.71413636 * (Cr - 128));\n B = clampTo8bit(Y + 1.772 * (Cb - 128));\n }\n\n data[offset++] = R;\n data[offset++] = G;\n data[offset++] = B;\n }\n }\n break;\n case 4:\n if (!this.adobe)\n throw new Error('Unsupported color mode (4 components)');\n // The default transform for four components is false\n colorTransform = false;\n // The adobe transform marker overrides any previous setting\n if (this.adobe && this.adobe.transformCode)\n colorTransform = true;\n else if (typeof this.opts.colorTransform !== 'undefined')\n colorTransform = !!this.opts.colorTransform;\n\n component1 = this.components[0];\n component2 = this.components[1];\n component3 = this.components[2];\n component4 = this.components[3];\n for (y = 0; y < height; y++) {\n component1Line = component1.lines[0 | (y * component1.scaleY * scaleY)];\n component2Line = component2.lines[0 | (y * component2.scaleY * scaleY)];\n component3Line = component3.lines[0 | (y * component3.scaleY * scaleY)];\n component4Line = component4.lines[0 | (y * component4.scaleY * scaleY)];\n for (x = 0; x < width; x++) {\n if (!colorTransform) {\n C = component1Line[0 | (x * component1.scaleX * scaleX)];\n M = component2Line[0 | (x * component2.scaleX * scaleX)];\n Ye = component3Line[0 | (x * component3.scaleX * scaleX)];\n K = component4Line[0 | (x * component4.scaleX * scaleX)];\n } else {\n Y = component1Line[0 | (x * component1.scaleX * scaleX)];\n Cb = component2Line[0 | (x * component2.scaleX * scaleX)];\n Cr = component3Line[0 | (x * component3.scaleX * scaleX)];\n K = component4Line[0 | (x * component4.scaleX * scaleX)];\n\n C = 255 - clampTo8bit(Y + 1.402 * (Cr - 128));\n M = 255 - clampTo8bit(Y - 0.3441363 * (Cb - 128) - 0.71413636 * (Cr - 128));\n Ye = 255 - clampTo8bit(Y + 1.772 * (Cb - 128));\n }\n data[offset++] = 255-C;\n data[offset++] = 255-M;\n data[offset++] = 255-Ye;\n data[offset++] = 255-K;\n }\n }\n break;\n default:\n throw new Error('Unsupported color mode');\n }\n return data;\n },\n copyToImageData: function copyToImageData(imageData, formatAsRGBA) {\n var width = imageData.width, height = imageData.height;\n var imageDataArray = imageData.data;\n var data = this.getData(width, height);\n var i = 0, j = 0, x, y;\n var Y, K, C, M, R, G, B;\n switch (this.components.length) {\n case 1:\n for (y = 0; y < height; y++) {\n for (x = 0; x < width; x++) {\n Y = data[i++];\n\n imageDataArray[j++] = Y;\n imageDataArray[j++] = Y;\n imageDataArray[j++] = Y;\n if (formatAsRGBA) {\n imageDataArray[j++] = 255;\n }\n }\n }\n break;\n case 3:\n for (y = 0; y < height; y++) {\n for (x = 0; x < width; x++) {\n R = data[i++];\n G = data[i++];\n B = data[i++];\n\n imageDataArray[j++] = R;\n imageDataArray[j++] = G;\n imageDataArray[j++] = B;\n if (formatAsRGBA) {\n imageDataArray[j++] = 255;\n }\n }\n }\n break;\n case 4:\n for (y = 0; y < height; y++) {\n for (x = 0; x < width; x++) {\n C = data[i++];\n M = data[i++];\n Y = data[i++];\n K = data[i++];\n\n R = 255 - clampTo8bit(C * (1 - K / 255) + K);\n G = 255 - clampTo8bit(M * (1 - K / 255) + K);\n B = 255 - clampTo8bit(Y * (1 - K / 255) + K);\n\n imageDataArray[j++] = R;\n imageDataArray[j++] = G;\n imageDataArray[j++] = B;\n if (formatAsRGBA) {\n imageDataArray[j++] = 255;\n }\n }\n }\n break;\n default:\n throw new Error('Unsupported color mode');\n }\n }\n };\n\n\n // We cap the amount of memory used by jpeg-js to avoid unexpected OOMs from untrusted content.\n var totalBytesAllocated = 0;\n var maxMemoryUsageBytes = 0;\n function requestMemoryAllocation(increaseAmount = 0) {\n var totalMemoryImpactBytes = totalBytesAllocated + increaseAmount;\n if (totalMemoryImpactBytes > maxMemoryUsageBytes) {\n var exceededAmount = Math.ceil((totalMemoryImpactBytes - maxMemoryUsageBytes) / 1024 / 1024);\n throw new Error(`maxMemoryUsageInMB limit exceeded by at least ${exceededAmount}MB`);\n }\n\n totalBytesAllocated = totalMemoryImpactBytes;\n }\n\n constructor.resetMaxMemoryUsage = function (maxMemoryUsageBytes_) {\n totalBytesAllocated = 0;\n maxMemoryUsageBytes = maxMemoryUsageBytes_;\n };\n\n constructor.getBytesAllocated = function () {\n return totalBytesAllocated;\n };\n\n constructor.requestMemoryAllocation = requestMemoryAllocation;\n\n return constructor;\n})();\n\nif (typeof module !== 'undefined') {\n\tmodule.exports = decode;\n} else if (typeof window !== 'undefined') {\n\twindow['jpeg-js'] = window['jpeg-js'] || {};\n\twindow['jpeg-js'].decode = decode;\n}\n\nfunction decode(jpegData, userOpts = {}) {\n var defaultOpts = {\n // \"undefined\" means \"Choose whether to transform colors based on the image’s color model.\"\n colorTransform: undefined,\n useTArray: false,\n formatAsRGBA: true,\n tolerantDecoding: true,\n maxResolutionInMP: 100, // Don't decode more than 100 megapixels\n maxMemoryUsageInMB: 512, // Don't decode if memory footprint is more than 512MB\n };\n\n var opts = {...defaultOpts, ...userOpts};\n var arr = new Uint8Array(jpegData);\n var decoder = new JpegImage();\n decoder.opts = opts;\n // If this constructor ever supports async decoding this will need to be done differently.\n // Until then, treating as singleton limit is fine.\n JpegImage.resetMaxMemoryUsage(opts.maxMemoryUsageInMB * 1024 * 1024);\n decoder.parse(arr);\n\n var channels = (opts.formatAsRGBA) ? 4 : 3;\n var bytesNeeded = decoder.width * decoder.height * channels;\n try {\n JpegImage.requestMemoryAllocation(bytesNeeded);\n var image = {\n width: decoder.width,\n height: decoder.height,\n exifBuffer: decoder.exifBuffer,\n data: opts.useTArray ?\n new Uint8Array(bytesNeeded) :\n Buffer.alloc(bytesNeeded)\n };\n if(decoder.comments.length > 0) {\n image[\"comments\"] = decoder.comments;\n }\n } catch (err) {\n if (err instanceof RangeError) {\n throw new Error(\"Could not allocate enough memory for the image. \" +\n \"Required: \" + bytesNeeded);\n } \n \n if (err instanceof ReferenceError) {\n if (err.message === \"Buffer is not defined\") {\n throw new Error(\"Buffer is not globally defined in this environment. \" +\n \"Consider setting useTArray to true\");\n }\n }\n throw err;\n }\n\n decoder.copyToImageData(image, opts.formatAsRGBA);\n\n return image;\n}\n","/*\n Copyright (c) 2008, Adobe Systems Incorporated\n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without \n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright notice, \n this list of conditions and the following disclaimer.\n \n * Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the \n documentation and/or other materials provided with the distribution.\n \n * Neither the name of Adobe Systems Incorporated nor the names of its \n contributors may be used to endorse or promote products derived from \n this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\n IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR \n CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\n/*\nJPEG encoder ported to JavaScript and optimized by Andreas Ritter, www.bytestrom.eu, 11/2009\n\nBasic GUI blocking jpeg encoder\n*/\n\nvar btoa = btoa || function(buf) {\n return Buffer.from(buf).toString('base64');\n};\n\nfunction JPEGEncoder(quality) {\n var self = this;\n\tvar fround = Math.round;\n\tvar ffloor = Math.floor;\n\tvar YTable = new Array(64);\n\tvar UVTable = new Array(64);\n\tvar fdtbl_Y = new Array(64);\n\tvar fdtbl_UV = new Array(64);\n\tvar YDC_HT;\n\tvar UVDC_HT;\n\tvar YAC_HT;\n\tvar UVAC_HT;\n\t\n\tvar bitcode = new Array(65535);\n\tvar category = new Array(65535);\n\tvar outputfDCTQuant = new Array(64);\n\tvar DU = new Array(64);\n\tvar byteout = [];\n\tvar bytenew = 0;\n\tvar bytepos = 7;\n\t\n\tvar YDU = new Array(64);\n\tvar UDU = new Array(64);\n\tvar VDU = new Array(64);\n\tvar clt = new Array(256);\n\tvar RGB_YUV_TABLE = new Array(2048);\n\tvar currentQuality;\n\t\n\tvar ZigZag = [\n\t\t\t 0, 1, 5, 6,14,15,27,28,\n\t\t\t 2, 4, 7,13,16,26,29,42,\n\t\t\t 3, 8,12,17,25,30,41,43,\n\t\t\t 9,11,18,24,31,40,44,53,\n\t\t\t10,19,23,32,39,45,52,54,\n\t\t\t20,22,33,38,46,51,55,60,\n\t\t\t21,34,37,47,50,56,59,61,\n\t\t\t35,36,48,49,57,58,62,63\n\t\t];\n\t\n\tvar std_dc_luminance_nrcodes = [0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0];\n\tvar std_dc_luminance_values = [0,1,2,3,4,5,6,7,8,9,10,11];\n\tvar std_ac_luminance_nrcodes = [0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,0x7d];\n\tvar std_ac_luminance_values = [\n\t\t\t0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12,\n\t\t\t0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07,\n\t\t\t0x22,0x71,0x14,0x32,0x81,0x91,0xa1,0x08,\n\t\t\t0x23,0x42,0xb1,0xc1,0x15,0x52,0xd1,0xf0,\n\t\t\t0x24,0x33,0x62,0x72,0x82,0x09,0x0a,0x16,\n\t\t\t0x17,0x18,0x19,0x1a,0x25,0x26,0x27,0x28,\n\t\t\t0x29,0x2a,0x34,0x35,0x36,0x37,0x38,0x39,\n\t\t\t0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49,\n\t\t\t0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59,\n\t\t\t0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69,\n\t\t\t0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79,\n\t\t\t0x7a,0x83,0x84,0x85,0x86,0x87,0x88,0x89,\n\t\t\t0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98,\n\t\t\t0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,\n\t\t\t0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6,\n\t\t\t0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5,\n\t\t\t0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4,\n\t\t\t0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe1,0xe2,\n\t\t\t0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,\n\t\t\t0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,\n\t\t\t0xf9,0xfa\n\t\t];\n\t\n\tvar std_dc_chrominance_nrcodes = [0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0];\n\tvar std_dc_chrominance_values = [0,1,2,3,4,5,6,7,8,9,10,11];\n\tvar std_ac_chrominance_nrcodes = [0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,0x77];\n\tvar std_ac_chrominance_values = [\n\t\t\t0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21,\n\t\t\t0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71,\n\t\t\t0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91,\n\t\t\t0xa1,0xb1,0xc1,0x09,0x23,0x33,0x52,0xf0,\n\t\t\t0x15,0x62,0x72,0xd1,0x0a,0x16,0x24,0x34,\n\t\t\t0xe1,0x25,0xf1,0x17,0x18,0x19,0x1a,0x26,\n\t\t\t0x27,0x28,0x29,0x2a,0x35,0x36,0x37,0x38,\n\t\t\t0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48,\n\t\t\t0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58,\n\t\t\t0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68,\n\t\t\t0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78,\n\t\t\t0x79,0x7a,0x82,0x83,0x84,0x85,0x86,0x87,\n\t\t\t0x88,0x89,0x8a,0x92,0x93,0x94,0x95,0x96,\n\t\t\t0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5,\n\t\t\t0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,\n\t\t\t0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3,\n\t\t\t0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2,\n\t\t\t0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,\n\t\t\t0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,\n\t\t\t0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,\n\t\t\t0xf9,0xfa\n\t\t];\n\t\n\tfunction initQuantTables(sf){\n\t\t\tvar YQT = [\n\t\t\t\t16, 11, 10, 16, 24, 40, 51, 61,\n\t\t\t\t12, 12, 14, 19, 26, 58, 60, 55,\n\t\t\t\t14, 13, 16, 24, 40, 57, 69, 56,\n\t\t\t\t14, 17, 22, 29, 51, 87, 80, 62,\n\t\t\t\t18, 22, 37, 56, 68,109,103, 77,\n\t\t\t\t24, 35, 55, 64, 81,104,113, 92,\n\t\t\t\t49, 64, 78, 87,103,121,120,101,\n\t\t\t\t72, 92, 95, 98,112,100,103, 99\n\t\t\t];\n\t\t\t\n\t\t\tfor (var i = 0; i < 64; i++) {\n\t\t\t\tvar t = ffloor((YQT[i]*sf+50)/100);\n\t\t\t\tif (t < 1) {\n\t\t\t\t\tt = 1;\n\t\t\t\t} else if (t > 255) {\n\t\t\t\t\tt = 255;\n\t\t\t\t}\n\t\t\t\tYTable[ZigZag[i]] = t;\n\t\t\t}\n\t\t\tvar UVQT = [\n\t\t\t\t17, 18, 24, 47, 99, 99, 99, 99,\n\t\t\t\t18, 21, 26, 66, 99, 99, 99, 99,\n\t\t\t\t24, 26, 56, 99, 99, 99, 99, 99,\n\t\t\t\t47, 66, 99, 99, 99, 99, 99, 99,\n\t\t\t\t99, 99, 99, 99, 99, 99, 99, 99,\n\t\t\t\t99, 99, 99, 99, 99, 99, 99, 99,\n\t\t\t\t99, 99, 99, 99, 99, 99, 99, 99,\n\t\t\t\t99, 99, 99, 99, 99, 99, 99, 99\n\t\t\t];\n\t\t\tfor (var j = 0; j < 64; j++) {\n\t\t\t\tvar u = ffloor((UVQT[j]*sf+50)/100);\n\t\t\t\tif (u < 1) {\n\t\t\t\t\tu = 1;\n\t\t\t\t} else if (u > 255) {\n\t\t\t\t\tu = 255;\n\t\t\t\t}\n\t\t\t\tUVTable[ZigZag[j]] = u;\n\t\t\t}\n\t\t\tvar aasf = [\n\t\t\t\t1.0, 1.387039845, 1.306562965, 1.175875602,\n\t\t\t\t1.0, 0.785694958, 0.541196100, 0.275899379\n\t\t\t];\n\t\t\tvar k = 0;\n\t\t\tfor (var row = 0; row < 8; row++)\n\t\t\t{\n\t\t\t\tfor (var col = 0; col < 8; col++)\n\t\t\t\t{\n\t\t\t\t\tfdtbl_Y[k] = (1.0 / (YTable [ZigZag[k]] * aasf[row] * aasf[col] * 8.0));\n\t\t\t\t\tfdtbl_UV[k] = (1.0 / (UVTable[ZigZag[k]] * aasf[row] * aasf[col] * 8.0));\n\t\t\t\t\tk++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tfunction computeHuffmanTbl(nrcodes, std_table){\n\t\t\tvar codevalue = 0;\n\t\t\tvar pos_in_table = 0;\n\t\t\tvar HT = new Array();\n\t\t\tfor (var k = 1; k <= 16; k++) {\n\t\t\t\tfor (var j = 1; j <= nrcodes[k]; j++) {\n\t\t\t\t\tHT[std_table[pos_in_table]] = [];\n\t\t\t\t\tHT[std_table[pos_in_table]][0] = codevalue;\n\t\t\t\t\tHT[std_table[pos_in_table]][1] = k;\n\t\t\t\t\tpos_in_table++;\n\t\t\t\t\tcodevalue++;\n\t\t\t\t}\n\t\t\t\tcodevalue*=2;\n\t\t\t}\n\t\t\treturn HT;\n\t\t}\n\t\t\n\t\tfunction initHuffmanTbl()\n\t\t{\n\t\t\tYDC_HT = computeHuffmanTbl(std_dc_luminance_nrcodes,std_dc_luminance_values);\n\t\t\tUVDC_HT = computeHuffmanTbl(std_dc_chrominance_nrcodes,std_dc_chrominance_values);\n\t\t\tYAC_HT = computeHuffmanTbl(std_ac_luminance_nrcodes,std_ac_luminance_values);\n\t\t\tUVAC_HT = computeHuffmanTbl(std_ac_chrominance_nrcodes,std_ac_chrominance_values);\n\t\t}\n\t\n\t\tfunction initCategoryNumber()\n\t\t{\n\t\t\tvar nrlower = 1;\n\t\t\tvar nrupper = 2;\n\t\t\tfor (var cat = 1; cat <= 15; cat++) {\n\t\t\t\t//Positive numbers\n\t\t\t\tfor (var nr = nrlower; nr>0] \t= 38470 * i;\n\t\t\t\tRGB_YUV_TABLE[(i+ 512)>>0] \t= 7471 * i + 0x8000;\n\t\t\t\tRGB_YUV_TABLE[(i+ 768)>>0] \t= -11059 * i;\n\t\t\t\tRGB_YUV_TABLE[(i+1024)>>0] \t= -21709 * i;\n\t\t\t\tRGB_YUV_TABLE[(i+1280)>>0] \t= 32768 * i + 0x807FFF;\n\t\t\t\tRGB_YUV_TABLE[(i+1536)>>0] \t= -27439 * i;\n\t\t\t\tRGB_YUV_TABLE[(i+1792)>>0] \t= - 5329 * i;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// IO functions\n\t\tfunction writeBits(bs)\n\t\t{\n\t\t\tvar value = bs[0];\n\t\t\tvar posval = bs[1]-1;\n\t\t\twhile ( posval >= 0 ) {\n\t\t\t\tif (value & (1 << posval) ) {\n\t\t\t\t\tbytenew |= (1 << bytepos);\n\t\t\t\t}\n\t\t\t\tposval--;\n\t\t\t\tbytepos--;\n\t\t\t\tif (bytepos < 0) {\n\t\t\t\t\tif (bytenew == 0xFF) {\n\t\t\t\t\t\twriteByte(0xFF);\n\t\t\t\t\t\twriteByte(0);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\twriteByte(bytenew);\n\t\t\t\t\t}\n\t\t\t\t\tbytepos=7;\n\t\t\t\t\tbytenew=0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\tfunction writeByte(value)\n\t\t{\n\t\t\t//byteout.push(clt[value]); // write char directly instead of converting later\n byteout.push(value);\n\t\t}\n\t\n\t\tfunction writeWord(value)\n\t\t{\n\t\t\twriteByte((value>>8)&0xFF);\n\t\t\twriteByte((value )&0xFF);\n\t\t}\n\t\t\n\t\t// DCT & quantization core\n\t\tfunction fDCTQuant(data, fdtbl)\n\t\t{\n\t\t\tvar d0, d1, d2, d3, d4, d5, d6, d7;\n\t\t\t/* Pass 1: process rows. */\n\t\t\tvar dataOff=0;\n\t\t\tvar i;\n\t\t\tvar I8 = 8;\n\t\t\tvar I64 = 64;\n\t\t\tfor (i=0; i 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0);\n\t\t\t\t//outputfDCTQuant[i] = fround(fDCTQuant);\n\n\t\t\t}\n\t\t\treturn outputfDCTQuant;\n\t\t}\n\t\t\n\t\tfunction writeAPP0()\n\t\t{\n\t\t\twriteWord(0xFFE0); // marker\n\t\t\twriteWord(16); // length\n\t\t\twriteByte(0x4A); // J\n\t\t\twriteByte(0x46); // F\n\t\t\twriteByte(0x49); // I\n\t\t\twriteByte(0x46); // F\n\t\t\twriteByte(0); // = \"JFIF\",'\\0'\n\t\t\twriteByte(1); // versionhi\n\t\t\twriteByte(1); // versionlo\n\t\t\twriteByte(0); // xyunits\n\t\t\twriteWord(1); // xdensity\n\t\t\twriteWord(1); // ydensity\n\t\t\twriteByte(0); // thumbnwidth\n\t\t\twriteByte(0); // thumbnheight\n\t\t}\n\n\t\tfunction writeAPP1(exifBuffer) {\n\t\t\tif (!exifBuffer) return;\n\n\t\t\twriteWord(0xFFE1); // APP1 marker\n\n\t\t\tif (exifBuffer[0] === 0x45 &&\n\t\t\t\t\texifBuffer[1] === 0x78 &&\n\t\t\t\t\texifBuffer[2] === 0x69 &&\n\t\t\t\t\texifBuffer[3] === 0x66) {\n\t\t\t\t// Buffer already starts with EXIF, just use it directly\n\t\t\t\twriteWord(exifBuffer.length + 2); // length is buffer + length itself!\n\t\t\t} else {\n\t\t\t\t// Buffer doesn't start with EXIF, write it for them\n\t\t\t\twriteWord(exifBuffer.length + 5 + 2); // length is buffer + EXIF\\0 + length itself!\n\t\t\t\twriteByte(0x45); // E\n\t\t\t\twriteByte(0x78); // X\n\t\t\t\twriteByte(0x69); // I\n\t\t\t\twriteByte(0x66); // F\n\t\t\t\twriteByte(0); // = \"EXIF\",'\\0'\n\t\t\t}\n\n\t\t\tfor (var i = 0; i < exifBuffer.length; i++) {\n\t\t\t\twriteByte(exifBuffer[i]);\n\t\t\t}\n\t\t}\n\n\t\tfunction writeSOF0(width, height)\n\t\t{\n\t\t\twriteWord(0xFFC0); // marker\n\t\t\twriteWord(17); // length, truecolor YUV JPG\n\t\t\twriteByte(8); // precision\n\t\t\twriteWord(height);\n\t\t\twriteWord(width);\n\t\t\twriteByte(3); // nrofcomponents\n\t\t\twriteByte(1); // IdY\n\t\t\twriteByte(0x11); // HVY\n\t\t\twriteByte(0); // QTY\n\t\t\twriteByte(2); // IdU\n\t\t\twriteByte(0x11); // HVU\n\t\t\twriteByte(1); // QTU\n\t\t\twriteByte(3); // IdV\n\t\t\twriteByte(0x11); // HVV\n\t\t\twriteByte(1); // QTV\n\t\t}\n\t\n\t\tfunction writeDQT()\n\t\t{\n\t\t\twriteWord(0xFFDB); // marker\n\t\t\twriteWord(132);\t // length\n\t\t\twriteByte(0);\n\t\t\tfor (var i=0; i<64; i++) {\n\t\t\t\twriteByte(YTable[i]);\n\t\t\t}\n\t\t\twriteByte(1);\n\t\t\tfor (var j=0; j<64; j++) {\n\t\t\t\twriteByte(UVTable[j]);\n\t\t\t}\n\t\t}\n\t\n\t\tfunction writeDHT()\n\t\t{\n\t\t\twriteWord(0xFFC4); // marker\n\t\t\twriteWord(0x01A2); // length\n\t\n\t\t\twriteByte(0); // HTYDCinfo\n\t\t\tfor (var i=0; i<16; i++) {\n\t\t\t\twriteByte(std_dc_luminance_nrcodes[i+1]);\n\t\t\t}\n\t\t\tfor (var j=0; j<=11; j++) {\n\t\t\t\twriteByte(std_dc_luminance_values[j]);\n\t\t\t}\n\t\n\t\t\twriteByte(0x10); // HTYACinfo\n\t\t\tfor (var k=0; k<16; k++) {\n\t\t\t\twriteByte(std_ac_luminance_nrcodes[k+1]);\n\t\t\t}\n\t\t\tfor (var l=0; l<=161; l++) {\n\t\t\t\twriteByte(std_ac_luminance_values[l]);\n\t\t\t}\n\t\n\t\t\twriteByte(1); // HTUDCinfo\n\t\t\tfor (var m=0; m<16; m++) {\n\t\t\t\twriteByte(std_dc_chrominance_nrcodes[m+1]);\n\t\t\t}\n\t\t\tfor (var n=0; n<=11; n++) {\n\t\t\t\twriteByte(std_dc_chrominance_values[n]);\n\t\t\t}\n\t\n\t\t\twriteByte(0x11); // HTUACinfo\n\t\t\tfor (var o=0; o<16; o++) {\n\t\t\t\twriteByte(std_ac_chrominance_nrcodes[o+1]);\n\t\t\t}\n\t\t\tfor (var p=0; p<=161; p++) {\n\t\t\t\twriteByte(std_ac_chrominance_values[p]);\n\t\t\t}\n\t\t}\n\t\t\n\t\tfunction writeCOM(comments)\n\t\t{\n\t\t\tif (typeof comments === \"undefined\" || comments.constructor !== Array) return;\n\t\t\tcomments.forEach(e => {\n\t\t\t\tif (typeof e !== \"string\") return;\n\t\t\t\twriteWord(0xFFFE); // marker\n\t\t\t\tvar l = e.length;\n\t\t\t\twriteWord(l + 2); // length itself as well\n\t\t\t\tvar i;\n\t\t\t\tfor (i = 0; i < l; i++)\n\t\t\t\t\twriteByte(e.charCodeAt(i));\n\t\t\t});\n\t\t}\n\t\n\t\tfunction writeSOS()\n\t\t{\n\t\t\twriteWord(0xFFDA); // marker\n\t\t\twriteWord(12); // length\n\t\t\twriteByte(3); // nrofcomponents\n\t\t\twriteByte(1); // IdY\n\t\t\twriteByte(0); // HTY\n\t\t\twriteByte(2); // IdU\n\t\t\twriteByte(0x11); // HTU\n\t\t\twriteByte(3); // IdV\n\t\t\twriteByte(0x11); // HTV\n\t\t\twriteByte(0); // Ss\n\t\t\twriteByte(0x3f); // Se\n\t\t\twriteByte(0); // Bf\n\t\t}\n\t\t\n\t\tfunction processDU(CDU, fdtbl, DC, HTDC, HTAC){\n\t\t\tvar EOB = HTAC[0x00];\n\t\t\tvar M16zeroes = HTAC[0xF0];\n\t\t\tvar pos;\n\t\t\tvar I16 = 16;\n\t\t\tvar I63 = 63;\n\t\t\tvar I64 = 64;\n\t\t\tvar DU_DCT = fDCTQuant(CDU, fdtbl);\n\t\t\t//ZigZag reorder\n\t\t\tfor (var j=0;j0)&&(DU[end0pos]==0); end0pos--) {};\n\t\t\t//end0pos = first element in reverse order !=0\n\t\t\tif ( end0pos == 0) {\n\t\t\t\twriteBits(EOB);\n\t\t\t\treturn DC;\n\t\t\t}\n\t\t\tvar i = 1;\n\t\t\tvar lng;\n\t\t\twhile ( i <= end0pos ) {\n\t\t\t\tvar startpos = i;\n\t\t\t\tfor (; (DU[i]==0) && (i<=end0pos); ++i) {}\n\t\t\t\tvar nrzeroes = i-startpos;\n\t\t\t\tif ( nrzeroes >= I16 ) {\n\t\t\t\t\tlng = nrzeroes>>4;\n\t\t\t\t\tfor (var nrmarker=1; nrmarker <= lng; ++nrmarker)\n\t\t\t\t\t\twriteBits(M16zeroes);\n\t\t\t\t\tnrzeroes = nrzeroes&0xF;\n\t\t\t\t}\n\t\t\t\tpos = 32767+DU[i];\n\t\t\t\twriteBits(HTAC[(nrzeroes<<4)+category[pos]]);\n\t\t\t\twriteBits(bitcode[pos]);\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tif ( end0pos != I63 ) {\n\t\t\t\twriteBits(EOB);\n\t\t\t}\n\t\t\treturn DC;\n\t\t}\n\n\t\tfunction initCharLookupTable(){\n\t\t\tvar sfcc = String.fromCharCode;\n\t\t\tfor(var i=0; i < 256; i++){ ///// ACHTUNG // 255\n\t\t\t\tclt[i] = sfcc(i);\n\t\t\t}\n\t\t}\n\t\t\n\t\tthis.encode = function(image,quality) // image data object\n\t\t{\n\t\t\tvar time_start = new Date().getTime();\n\t\t\t\n\t\t\tif(quality) setQuality(quality);\n\t\t\t\n\t\t\t// Initialize bit writer\n\t\t\tbyteout = new Array();\n\t\t\tbytenew=0;\n\t\t\tbytepos=7;\n\t\n\t\t\t// Add JPEG headers\n\t\t\twriteWord(0xFFD8); // SOI\n\t\t\twriteAPP0();\n\t\t\twriteCOM(image.comments);\n\t\t\twriteAPP1(image.exifBuffer);\n\t\t\twriteDQT();\n\t\t\twriteSOF0(image.width,image.height);\n\t\t\twriteDHT();\n\t\t\twriteSOS();\n\n\t\n\t\t\t// Encode 8x8 macroblocks\n\t\t\tvar DCY=0;\n\t\t\tvar DCU=0;\n\t\t\tvar DCV=0;\n\t\t\t\n\t\t\tbytenew=0;\n\t\t\tbytepos=7;\n\t\t\t\n\t\t\t\n\t\t\tthis.encode.displayName = \"_encode_\";\n\n\t\t\tvar imageData = image.data;\n\t\t\tvar width = image.width;\n\t\t\tvar height = image.height;\n\n\t\t\tvar quadWidth = width*4;\n\t\t\tvar tripleWidth = width*3;\n\t\t\t\n\t\t\tvar x, y = 0;\n\t\t\tvar r, g, b;\n\t\t\tvar start,p, col,row,pos;\n\t\t\twhile(y < height){\n\t\t\t\tx = 0;\n\t\t\t\twhile(x < quadWidth){\n\t\t\t\tstart = quadWidth * y + x;\n\t\t\t\tp = start;\n\t\t\t\tcol = -1;\n\t\t\t\trow = 0;\n\t\t\t\t\n\t\t\t\tfor(pos=0; pos < 64; pos++){\n\t\t\t\t\trow = pos >> 3;// /8\n\t\t\t\t\tcol = ( pos & 7 ) * 4; // %8\n\t\t\t\t\tp = start + ( row * quadWidth ) + col;\t\t\n\t\t\t\t\t\n\t\t\t\t\tif(y+row >= height){ // padding bottom\n\t\t\t\t\t\tp-= (quadWidth*(y+1+row-height));\n\t\t\t\t\t}\n\n\t\t\t\t\tif(x+col >= quadWidth){ // padding right\t\n\t\t\t\t\t\tp-= ((x+col) - quadWidth +4)\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tr = imageData[ p++ ];\n\t\t\t\t\tg = imageData[ p++ ];\n\t\t\t\t\tb = imageData[ p++ ];\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t/* // calculate YUV values dynamically\n\t\t\t\t\tYDU[pos]=((( 0.29900)*r+( 0.58700)*g+( 0.11400)*b))-128; //-0x80\n\t\t\t\t\tUDU[pos]=(((-0.16874)*r+(-0.33126)*g+( 0.50000)*b));\n\t\t\t\t\tVDU[pos]=((( 0.50000)*r+(-0.41869)*g+(-0.08131)*b));\n\t\t\t\t\t*/\n\t\t\t\t\t\n\t\t\t\t\t// use lookup table (slightly faster)\n\t\t\t\t\tYDU[pos] = ((RGB_YUV_TABLE[r] + RGB_YUV_TABLE[(g + 256)>>0] + RGB_YUV_TABLE[(b + 512)>>0]) >> 16)-128;\n\t\t\t\t\tUDU[pos] = ((RGB_YUV_TABLE[(r + 768)>>0] + RGB_YUV_TABLE[(g + 1024)>>0] + RGB_YUV_TABLE[(b + 1280)>>0]) >> 16)-128;\n\t\t\t\t\tVDU[pos] = ((RGB_YUV_TABLE[(r + 1280)>>0] + RGB_YUV_TABLE[(g + 1536)>>0] + RGB_YUV_TABLE[(b + 1792)>>0]) >> 16)-128;\n\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tDCY = processDU(YDU, fdtbl_Y, DCY, YDC_HT, YAC_HT);\n\t\t\t\tDCU = processDU(UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT);\n\t\t\t\tDCV = processDU(VDU, fdtbl_UV, DCV, UVDC_HT, UVAC_HT);\n\t\t\t\tx+=32;\n\t\t\t\t}\n\t\t\t\ty+=8;\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t////////////////////////////////////////////////////////////////\n\t\n\t\t\t// Do the bit alignment of the EOI marker\n\t\t\tif ( bytepos >= 0 ) {\n\t\t\t\tvar fillbits = [];\n\t\t\t\tfillbits[1] = bytepos+1;\n\t\t\t\tfillbits[0] = (1<<(bytepos+1))-1;\n\t\t\t\twriteBits(fillbits);\n\t\t\t}\n\t\n\t\t\twriteWord(0xFFD9); //EOI\n\n\t\t\tif (typeof module === 'undefined') return new Uint8Array(byteout);\n return Buffer.from(byteout);\n\n\t\t\tvar jpegDataUri = 'data:image/jpeg;base64,' + btoa(byteout.join(''));\n\t\t\t\n\t\t\tbyteout = [];\n\t\t\t\n\t\t\t// benchmarking\n\t\t\tvar duration = new Date().getTime() - time_start;\n \t\t//console.log('Encoding time: '+ duration + 'ms');\n \t\t//\n\t\t\t\n\t\t\treturn jpegDataUri\t\t\t\n\t}\n\t\n\tfunction setQuality(quality){\n\t\tif (quality <= 0) {\n\t\t\tquality = 1;\n\t\t}\n\t\tif (quality > 100) {\n\t\t\tquality = 100;\n\t\t}\n\t\t\n\t\tif(currentQuality == quality) return // don't recalc if unchanged\n\t\t\n\t\tvar sf = 0;\n\t\tif (quality < 50) {\n\t\t\tsf = Math.floor(5000 / quality);\n\t\t} else {\n\t\t\tsf = Math.floor(200 - quality*2);\n\t\t}\n\t\t\n\t\tinitQuantTables(sf);\n\t\tcurrentQuality = quality;\n\t\t//console.log('Quality set to: '+quality +'%');\n\t}\n\t\n\tfunction init(){\n\t\tvar time_start = new Date().getTime();\n\t\tif(!quality) quality = 50;\n\t\t// Create tables\n\t\tinitCharLookupTable()\n\t\tinitHuffmanTbl();\n\t\tinitCategoryNumber();\n\t\tinitRGBYUVTable();\n\t\t\n\t\tsetQuality(quality);\n\t\tvar duration = new Date().getTime() - time_start;\n \t//console.log('Initialization '+ duration + 'ms');\n\t}\n\t\n\tinit();\n\t\n};\n\nif (typeof module !== 'undefined') {\n\tmodule.exports = encode;\n} else if (typeof window !== 'undefined') {\n\twindow['jpeg-js'] = window['jpeg-js'] || {};\n\twindow['jpeg-js'].encode = encode;\n}\n\nfunction encode(imgData, qu) {\n if (typeof qu === 'undefined') qu = 50;\n var encoder = new JPEGEncoder(qu);\n\tvar data = encoder.encode(imgData, qu);\n return {\n data: data,\n width: imgData.width,\n height: imgData.height,\n };\n}\n\n// helper function to get the imageData of an existing image on the current page.\nfunction getImageDataFromImage(idOrElement){\n\tvar theImg = (typeof(idOrElement)=='string')? document.getElementById(idOrElement):idOrElement;\n\tvar cvs = document.createElement('canvas');\n\tcvs.width = theImg.width;\n\tcvs.height = theImg.height;\n\tvar ctx = cvs.getContext(\"2d\");\n\tctx.drawImage(theImg,0,0);\n\t\n\treturn (ctx.getImageData(0, 0, cvs.width, cvs.height));\n}\n","var xhr = require('xhr')\nvar noop = function(){}\nvar parseASCII = require('parse-bmfont-ascii')\nvar parseXML = require('parse-bmfont-xml')\nvar readBinary = require('parse-bmfont-binary')\nvar isBinaryFormat = require('./lib/is-binary')\nvar xtend = require('xtend')\n\nvar xml2 = (function hasXML2() {\n return self.XMLHttpRequest && \"withCredentials\" in new XMLHttpRequest\n})()\n\nmodule.exports = function(opt, cb) {\n cb = typeof cb === 'function' ? cb : noop\n\n if (typeof opt === 'string')\n opt = { uri: opt }\n else if (!opt)\n opt = {}\n\n var expectBinary = opt.binary\n if (expectBinary)\n opt = getBinaryOpts(opt)\n\n xhr(opt, function(err, res, body) {\n if (err)\n return cb(err)\n if (!/^2/.test(res.statusCode))\n return cb(new Error('http status code: '+res.statusCode))\n if (!body)\n return cb(new Error('no body result'))\n\n var binary = false \n\n //if the response type is an array buffer,\n //we need to convert it into a regular Buffer object\n if (isArrayBuffer(body)) {\n var array = new Uint8Array(body)\n body = Buffer.from(array, 'binary')\n }\n\n //now check the string/Buffer response\n //and see if it has a binary BMF header\n if (isBinaryFormat(body)) {\n binary = true\n //if we have a string, turn it into a Buffer\n if (typeof body === 'string') \n body = Buffer.from(body, 'binary')\n } \n\n //we are not parsing a binary format, just ASCII/XML/etc\n if (!binary) {\n //might still be a buffer if responseType is 'arraybuffer'\n if (Buffer.isBuffer(body))\n body = body.toString(opt.encoding)\n body = body.trim()\n }\n\n var result\n try {\n var type = res.headers['content-type']\n if (binary)\n result = readBinary(body)\n else if (/json/.test(type) || body.charAt(0) === '{')\n result = JSON.parse(body)\n else if (/xml/.test(type) || body.charAt(0) === '<')\n result = parseXML(body)\n else\n result = parseASCII(body)\n } catch (e) {\n cb(new Error('error parsing font '+e.message))\n cb = noop\n }\n cb(null, result)\n })\n}\n\nfunction isArrayBuffer(arr) {\n var str = Object.prototype.toString\n return str.call(arr) === '[object ArrayBuffer]'\n}\n\nfunction getBinaryOpts(opt) {\n //IE10+ and other modern browsers support array buffers\n if (xml2)\n return xtend(opt, { responseType: 'arraybuffer' })\n \n if (typeof self.XMLHttpRequest === 'undefined')\n throw new Error('your browser does not support XHR loading')\n\n //IE9 and XML1 browsers could still use an override\n var req = new self.XMLHttpRequest()\n req.overrideMimeType('text/plain; charset=x-user-defined')\n return xtend({\n xhr: req\n }, opt)\n}\n","var equal = require('buffer-equal')\nvar HEADER = Buffer.from([66, 77, 70, 3])\n\nmodule.exports = function(buf) {\n if (typeof buf === 'string')\n return buf.substring(0, 3) === 'BMF'\n return buf.length > 4 && equal(buf.slice(0, 4), HEADER)\n}","// (c) Dean McNamee , 2013.\n//\n// https://github.com/deanm/omggif\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to\n// deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n// sell copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n// IN THE SOFTWARE.\n//\n// omggif is a JavaScript implementation of a GIF 89a encoder and decoder,\n// including animation and compression. It does not rely on any specific\n// underlying system, so should run in the browser, Node, or Plask.\n\n\"use strict\";\n\nfunction GifWriter(buf, width, height, gopts) {\n var p = 0;\n\n var gopts = gopts === undefined ? { } : gopts;\n var loop_count = gopts.loop === undefined ? null : gopts.loop;\n var global_palette = gopts.palette === undefined ? null : gopts.palette;\n\n if (width <= 0 || height <= 0 || width > 65535 || height > 65535)\n throw new Error(\"Width/Height invalid.\");\n\n function check_palette_and_num_colors(palette) {\n var num_colors = palette.length;\n if (num_colors < 2 || num_colors > 256 || num_colors & (num_colors-1)) {\n throw new Error(\n \"Invalid code/color length, must be power of 2 and 2 .. 256.\");\n }\n return num_colors;\n }\n\n // - Header.\n buf[p++] = 0x47; buf[p++] = 0x49; buf[p++] = 0x46; // GIF\n buf[p++] = 0x38; buf[p++] = 0x39; buf[p++] = 0x61; // 89a\n\n // Handling of Global Color Table (palette) and background index.\n var gp_num_colors_pow2 = 0;\n var background = 0;\n if (global_palette !== null) {\n var gp_num_colors = check_palette_and_num_colors(global_palette);\n while (gp_num_colors >>= 1) ++gp_num_colors_pow2;\n gp_num_colors = 1 << gp_num_colors_pow2;\n --gp_num_colors_pow2;\n if (gopts.background !== undefined) {\n background = gopts.background;\n if (background >= gp_num_colors)\n throw new Error(\"Background index out of range.\");\n // The GIF spec states that a background index of 0 should be ignored, so\n // this is probably a mistake and you really want to set it to another\n // slot in the palette. But actually in the end most browsers, etc end\n // up ignoring this almost completely (including for dispose background).\n if (background === 0)\n throw new Error(\"Background index explicitly passed as 0.\");\n }\n }\n\n // - Logical Screen Descriptor.\n // NOTE(deanm): w/h apparently ignored by implementations, but set anyway.\n buf[p++] = width & 0xff; buf[p++] = width >> 8 & 0xff;\n buf[p++] = height & 0xff; buf[p++] = height >> 8 & 0xff;\n // NOTE: Indicates 0-bpp original color resolution (unused?).\n buf[p++] = (global_palette !== null ? 0x80 : 0) | // Global Color Table Flag.\n gp_num_colors_pow2; // NOTE: No sort flag (unused?).\n buf[p++] = background; // Background Color Index.\n buf[p++] = 0; // Pixel aspect ratio (unused?).\n\n // - Global Color Table\n if (global_palette !== null) {\n for (var i = 0, il = global_palette.length; i < il; ++i) {\n var rgb = global_palette[i];\n buf[p++] = rgb >> 16 & 0xff;\n buf[p++] = rgb >> 8 & 0xff;\n buf[p++] = rgb & 0xff;\n }\n }\n\n if (loop_count !== null) { // Netscape block for looping.\n if (loop_count < 0 || loop_count > 65535)\n throw new Error(\"Loop count invalid.\")\n // Extension code, label, and length.\n buf[p++] = 0x21; buf[p++] = 0xff; buf[p++] = 0x0b;\n // NETSCAPE2.0\n buf[p++] = 0x4e; buf[p++] = 0x45; buf[p++] = 0x54; buf[p++] = 0x53;\n buf[p++] = 0x43; buf[p++] = 0x41; buf[p++] = 0x50; buf[p++] = 0x45;\n buf[p++] = 0x32; buf[p++] = 0x2e; buf[p++] = 0x30;\n // Sub-block\n buf[p++] = 0x03; buf[p++] = 0x01;\n buf[p++] = loop_count & 0xff; buf[p++] = loop_count >> 8 & 0xff;\n buf[p++] = 0x00; // Terminator.\n }\n\n\n var ended = false;\n\n this.addFrame = function(x, y, w, h, indexed_pixels, opts) {\n if (ended === true) { --p; ended = false; } // Un-end.\n\n opts = opts === undefined ? { } : opts;\n\n // TODO(deanm): Bounds check x, y. Do they need to be within the virtual\n // canvas width/height, I imagine?\n if (x < 0 || y < 0 || x > 65535 || y > 65535)\n throw new Error(\"x/y invalid.\")\n\n if (w <= 0 || h <= 0 || w > 65535 || h > 65535)\n throw new Error(\"Width/Height invalid.\")\n\n if (indexed_pixels.length < w * h)\n throw new Error(\"Not enough pixels for the frame size.\");\n\n var using_local_palette = true;\n var palette = opts.palette;\n if (palette === undefined || palette === null) {\n using_local_palette = false;\n palette = global_palette;\n }\n\n if (palette === undefined || palette === null)\n throw new Error(\"Must supply either a local or global palette.\");\n\n var num_colors = check_palette_and_num_colors(palette);\n\n // Compute the min_code_size (power of 2), destroying num_colors.\n var min_code_size = 0;\n while (num_colors >>= 1) ++min_code_size;\n num_colors = 1 << min_code_size; // Now we can easily get it back.\n\n var delay = opts.delay === undefined ? 0 : opts.delay;\n\n // From the spec:\n // 0 - No disposal specified. The decoder is\n // not required to take any action.\n // 1 - Do not dispose. The graphic is to be left\n // in place.\n // 2 - Restore to background color. The area used by the\n // graphic must be restored to the background color.\n // 3 - Restore to previous. The decoder is required to\n // restore the area overwritten by the graphic with\n // what was there prior to rendering the graphic.\n // 4-7 - To be defined.\n // NOTE(deanm): Dispose background doesn't really work, apparently most\n // browsers ignore the background palette index and clear to transparency.\n var disposal = opts.disposal === undefined ? 0 : opts.disposal;\n if (disposal < 0 || disposal > 3) // 4-7 is reserved.\n throw new Error(\"Disposal out of range.\");\n\n var use_transparency = false;\n var transparent_index = 0;\n if (opts.transparent !== undefined && opts.transparent !== null) {\n use_transparency = true;\n transparent_index = opts.transparent;\n if (transparent_index < 0 || transparent_index >= num_colors)\n throw new Error(\"Transparent color index.\");\n }\n\n if (disposal !== 0 || use_transparency || delay !== 0) {\n // - Graphics Control Extension\n buf[p++] = 0x21; buf[p++] = 0xf9; // Extension / Label.\n buf[p++] = 4; // Byte size.\n\n buf[p++] = disposal << 2 | (use_transparency === true ? 1 : 0);\n buf[p++] = delay & 0xff; buf[p++] = delay >> 8 & 0xff;\n buf[p++] = transparent_index; // Transparent color index.\n buf[p++] = 0; // Block Terminator.\n }\n\n // - Image Descriptor\n buf[p++] = 0x2c; // Image Seperator.\n buf[p++] = x & 0xff; buf[p++] = x >> 8 & 0xff; // Left.\n buf[p++] = y & 0xff; buf[p++] = y >> 8 & 0xff; // Top.\n buf[p++] = w & 0xff; buf[p++] = w >> 8 & 0xff;\n buf[p++] = h & 0xff; buf[p++] = h >> 8 & 0xff;\n // NOTE: No sort flag (unused?).\n // TODO(deanm): Support interlace.\n buf[p++] = using_local_palette === true ? (0x80 | (min_code_size-1)) : 0;\n\n // - Local Color Table\n if (using_local_palette === true) {\n for (var i = 0, il = palette.length; i < il; ++i) {\n var rgb = palette[i];\n buf[p++] = rgb >> 16 & 0xff;\n buf[p++] = rgb >> 8 & 0xff;\n buf[p++] = rgb & 0xff;\n }\n }\n\n p = GifWriterOutputLZWCodeStream(\n buf, p, min_code_size < 2 ? 2 : min_code_size, indexed_pixels);\n\n return p;\n };\n\n this.end = function() {\n if (ended === false) {\n buf[p++] = 0x3b; // Trailer.\n ended = true;\n }\n return p;\n };\n\n this.getOutputBuffer = function() { return buf; };\n this.setOutputBuffer = function(v) { buf = v; };\n this.getOutputBufferPosition = function() { return p; };\n this.setOutputBufferPosition = function(v) { p = v; };\n}\n\n// Main compression routine, palette indexes -> LZW code stream.\n// |index_stream| must have at least one entry.\nfunction GifWriterOutputLZWCodeStream(buf, p, min_code_size, index_stream) {\n buf[p++] = min_code_size;\n var cur_subblock = p++; // Pointing at the length field.\n\n var clear_code = 1 << min_code_size;\n var code_mask = clear_code - 1;\n var eoi_code = clear_code + 1;\n var next_code = eoi_code + 1;\n\n var cur_code_size = min_code_size + 1; // Number of bits per code.\n var cur_shift = 0;\n // We have at most 12-bit codes, so we should have to hold a max of 19\n // bits here (and then we would write out).\n var cur = 0;\n\n function emit_bytes_to_buffer(bit_block_size) {\n while (cur_shift >= bit_block_size) {\n buf[p++] = cur & 0xff;\n cur >>= 8; cur_shift -= 8;\n if (p === cur_subblock + 256) { // Finished a subblock.\n buf[cur_subblock] = 255;\n cur_subblock = p++;\n }\n }\n }\n\n function emit_code(c) {\n cur |= c << cur_shift;\n cur_shift += cur_code_size;\n emit_bytes_to_buffer(8);\n }\n\n // I am not an expert on the topic, and I don't want to write a thesis.\n // However, it is good to outline here the basic algorithm and the few data\n // structures and optimizations here that make this implementation fast.\n // The basic idea behind LZW is to build a table of previously seen runs\n // addressed by a short id (herein called output code). All data is\n // referenced by a code, which represents one or more values from the\n // original input stream. All input bytes can be referenced as the same\n // value as an output code. So if you didn't want any compression, you\n // could more or less just output the original bytes as codes (there are\n // some details to this, but it is the idea). In order to achieve\n // compression, values greater then the input range (codes can be up to\n // 12-bit while input only 8-bit) represent a sequence of previously seen\n // inputs. The decompressor is able to build the same mapping while\n // decoding, so there is always a shared common knowledge between the\n // encoding and decoder, which is also important for \"timing\" aspects like\n // how to handle variable bit width code encoding.\n //\n // One obvious but very important consequence of the table system is there\n // is always a unique id (at most 12-bits) to map the runs. 'A' might be\n // 4, then 'AA' might be 10, 'AAA' 11, 'AAAA' 12, etc. This relationship\n // can be used for an effecient lookup strategy for the code mapping. We\n // need to know if a run has been seen before, and be able to map that run\n // to the output code. Since we start with known unique ids (input bytes),\n // and then from those build more unique ids (table entries), we can\n // continue this chain (almost like a linked list) to always have small\n // integer values that represent the current byte chains in the encoder.\n // This means instead of tracking the input bytes (AAAABCD) to know our\n // current state, we can track the table entry for AAAABC (it is guaranteed\n // to exist by the nature of the algorithm) and the next character D.\n // Therefor the tuple of (table_entry, byte) is guaranteed to also be\n // unique. This allows us to create a simple lookup key for mapping input\n // sequences to codes (table indices) without having to store or search\n // any of the code sequences. So if 'AAAA' has a table entry of 12, the\n // tuple of ('AAAA', K) for any input byte K will be unique, and can be our\n // key. This leads to a integer value at most 20-bits, which can always\n // fit in an SMI value and be used as a fast sparse array / object key.\n\n // Output code for the current contents of the index buffer.\n var ib_code = index_stream[0] & code_mask; // Load first input index.\n var code_table = { }; // Key'd on our 20-bit \"tuple\".\n\n emit_code(clear_code); // Spec says first code should be a clear code.\n\n // First index already loaded, process the rest of the stream.\n for (var i = 1, il = index_stream.length; i < il; ++i) {\n var k = index_stream[i] & code_mask;\n var cur_key = ib_code << 8 | k; // (prev, k) unique tuple.\n var cur_code = code_table[cur_key]; // buffer + k.\n\n // Check if we have to create a new code table entry.\n if (cur_code === undefined) { // We don't have buffer + k.\n // Emit index buffer (without k).\n // This is an inline version of emit_code, because this is the core\n // writing routine of the compressor (and V8 cannot inline emit_code\n // because it is a closure here in a different context). Additionally\n // we can call emit_byte_to_buffer less often, because we can have\n // 30-bits (from our 31-bit signed SMI), and we know our codes will only\n // be 12-bits, so can safely have 18-bits there without overflow.\n // emit_code(ib_code);\n cur |= ib_code << cur_shift;\n cur_shift += cur_code_size;\n while (cur_shift >= 8) {\n buf[p++] = cur & 0xff;\n cur >>= 8; cur_shift -= 8;\n if (p === cur_subblock + 256) { // Finished a subblock.\n buf[cur_subblock] = 255;\n cur_subblock = p++;\n }\n }\n\n if (next_code === 4096) { // Table full, need a clear.\n emit_code(clear_code);\n next_code = eoi_code + 1;\n cur_code_size = min_code_size + 1;\n code_table = { };\n } else { // Table not full, insert a new entry.\n // Increase our variable bit code sizes if necessary. This is a bit\n // tricky as it is based on \"timing\" between the encoding and\n // decoder. From the encoders perspective this should happen after\n // we've already emitted the index buffer and are about to create the\n // first table entry that would overflow our current code bit size.\n if (next_code >= (1 << cur_code_size)) ++cur_code_size;\n code_table[cur_key] = next_code++; // Insert into code table.\n }\n\n ib_code = k; // Index buffer to single input k.\n } else {\n ib_code = cur_code; // Index buffer to sequence in code table.\n }\n }\n\n emit_code(ib_code); // There will still be something in the index buffer.\n emit_code(eoi_code); // End Of Information.\n\n // Flush / finalize the sub-blocks stream to the buffer.\n emit_bytes_to_buffer(1);\n\n // Finish the sub-blocks, writing out any unfinished lengths and\n // terminating with a sub-block of length 0. If we have already started\n // but not yet used a sub-block it can just become the terminator.\n if (cur_subblock + 1 === p) { // Started but unused.\n buf[cur_subblock] = 0;\n } else { // Started and used, write length and additional terminator block.\n buf[cur_subblock] = p - cur_subblock - 1;\n buf[p++] = 0;\n }\n return p;\n}\n\nfunction GifReader(buf) {\n var p = 0;\n\n // - Header (GIF87a or GIF89a).\n if (buf[p++] !== 0x47 || buf[p++] !== 0x49 || buf[p++] !== 0x46 ||\n buf[p++] !== 0x38 || (buf[p++]+1 & 0xfd) !== 0x38 || buf[p++] !== 0x61) {\n throw new Error(\"Invalid GIF 87a/89a header.\");\n }\n\n // - Logical Screen Descriptor.\n var width = buf[p++] | buf[p++] << 8;\n var height = buf[p++] | buf[p++] << 8;\n var pf0 = buf[p++]; // .\n var global_palette_flag = pf0 >> 7;\n var num_global_colors_pow2 = pf0 & 0x7;\n var num_global_colors = 1 << (num_global_colors_pow2 + 1);\n var background = buf[p++];\n buf[p++]; // Pixel aspect ratio (unused?).\n\n var global_palette_offset = null;\n var global_palette_size = null;\n\n if (global_palette_flag) {\n global_palette_offset = p;\n global_palette_size = num_global_colors;\n p += num_global_colors * 3; // Seek past palette.\n }\n\n var no_eof = true;\n\n var frames = [ ];\n\n var delay = 0;\n var transparent_index = null;\n var disposal = 0; // 0 - No disposal specified.\n var loop_count = null;\n\n this.width = width;\n this.height = height;\n\n while (no_eof && p < buf.length) {\n switch (buf[p++]) {\n case 0x21: // Graphics Control Extension Block\n switch (buf[p++]) {\n case 0xff: // Application specific block\n // Try if it's a Netscape block (with animation loop counter).\n if (buf[p ] !== 0x0b || // 21 FF already read, check block size.\n // NETSCAPE2.0\n buf[p+1 ] == 0x4e && buf[p+2 ] == 0x45 && buf[p+3 ] == 0x54 &&\n buf[p+4 ] == 0x53 && buf[p+5 ] == 0x43 && buf[p+6 ] == 0x41 &&\n buf[p+7 ] == 0x50 && buf[p+8 ] == 0x45 && buf[p+9 ] == 0x32 &&\n buf[p+10] == 0x2e && buf[p+11] == 0x30 &&\n // Sub-block\n buf[p+12] == 0x03 && buf[p+13] == 0x01 && buf[p+16] == 0) {\n p += 14;\n loop_count = buf[p++] | buf[p++] << 8;\n p++; // Skip terminator.\n } else { // We don't know what it is, just try to get past it.\n p += 12;\n while (true) { // Seek through subblocks.\n var block_size = buf[p++];\n // Bad block size (ex: undefined from an out of bounds read).\n if (!(block_size >= 0)) throw Error(\"Invalid block size\");\n if (block_size === 0) break; // 0 size is terminator\n p += block_size;\n }\n }\n break;\n\n case 0xf9: // Graphics Control Extension\n if (buf[p++] !== 0x4 || buf[p+4] !== 0)\n throw new Error(\"Invalid graphics extension block.\");\n var pf1 = buf[p++];\n delay = buf[p++] | buf[p++] << 8;\n transparent_index = buf[p++];\n if ((pf1 & 1) === 0) transparent_index = null;\n disposal = pf1 >> 2 & 0x7;\n p++; // Skip terminator.\n break;\n\n case 0xfe: // Comment Extension.\n while (true) { // Seek through subblocks.\n var block_size = buf[p++];\n // Bad block size (ex: undefined from an out of bounds read).\n if (!(block_size >= 0)) throw Error(\"Invalid block size\");\n if (block_size === 0) break; // 0 size is terminator\n // console.log(buf.slice(p, p+block_size).toString('ascii'));\n p += block_size;\n }\n break;\n\n default:\n throw new Error(\n \"Unknown graphic control label: 0x\" + buf[p-1].toString(16));\n }\n break;\n\n case 0x2c: // Image Descriptor.\n var x = buf[p++] | buf[p++] << 8;\n var y = buf[p++] | buf[p++] << 8;\n var w = buf[p++] | buf[p++] << 8;\n var h = buf[p++] | buf[p++] << 8;\n var pf2 = buf[p++];\n var local_palette_flag = pf2 >> 7;\n var interlace_flag = pf2 >> 6 & 1;\n var num_local_colors_pow2 = pf2 & 0x7;\n var num_local_colors = 1 << (num_local_colors_pow2 + 1);\n var palette_offset = global_palette_offset;\n var palette_size = global_palette_size;\n var has_local_palette = false;\n if (local_palette_flag) {\n var has_local_palette = true;\n palette_offset = p; // Override with local palette.\n palette_size = num_local_colors;\n p += num_local_colors * 3; // Seek past palette.\n }\n\n var data_offset = p;\n\n p++; // codesize\n while (true) {\n var block_size = buf[p++];\n // Bad block size (ex: undefined from an out of bounds read).\n if (!(block_size >= 0)) throw Error(\"Invalid block size\");\n if (block_size === 0) break; // 0 size is terminator\n p += block_size;\n }\n\n frames.push({x: x, y: y, width: w, height: h,\n has_local_palette: has_local_palette,\n palette_offset: palette_offset,\n palette_size: palette_size,\n data_offset: data_offset,\n data_length: p - data_offset,\n transparent_index: transparent_index,\n interlaced: !!interlace_flag,\n delay: delay,\n disposal: disposal});\n break;\n\n case 0x3b: // Trailer Marker (end of file).\n no_eof = false;\n break;\n\n default:\n throw new Error(\"Unknown gif block: 0x\" + buf[p-1].toString(16));\n break;\n }\n }\n\n this.numFrames = function() {\n return frames.length;\n };\n\n this.loopCount = function() {\n return loop_count;\n };\n\n this.frameInfo = function(frame_num) {\n if (frame_num < 0 || frame_num >= frames.length)\n throw new Error(\"Frame index out of range.\");\n return frames[frame_num];\n }\n\n this.decodeAndBlitFrameBGRA = function(frame_num, pixels) {\n var frame = this.frameInfo(frame_num);\n var num_pixels = frame.width * frame.height;\n var index_stream = new Uint8Array(num_pixels); // At most 8-bit indices.\n GifReaderLZWOutputIndexStream(\n buf, frame.data_offset, index_stream, num_pixels);\n var palette_offset = frame.palette_offset;\n\n // NOTE(deanm): It seems to be much faster to compare index to 256 than\n // to === null. Not sure why, but CompareStub_EQ_STRICT shows up high in\n // the profile, not sure if it's related to using a Uint8Array.\n var trans = frame.transparent_index;\n if (trans === null) trans = 256;\n\n // We are possibly just blitting to a portion of the entire frame.\n // That is a subrect within the framerect, so the additional pixels\n // must be skipped over after we finished a scanline.\n var framewidth = frame.width;\n var framestride = width - framewidth;\n var xleft = framewidth; // Number of subrect pixels left in scanline.\n\n // Output indicies of the top left and bottom right corners of the subrect.\n var opbeg = ((frame.y * width) + frame.x) * 4;\n var opend = ((frame.y + frame.height) * width + frame.x) * 4;\n var op = opbeg;\n\n var scanstride = framestride * 4;\n\n // Use scanstride to skip past the rows when interlacing. This is skipping\n // 7 rows for the first two passes, then 3 then 1.\n if (frame.interlaced === true) {\n scanstride += width * 4 * 7; // Pass 1.\n }\n\n var interlaceskip = 8; // Tracking the row interval in the current pass.\n\n for (var i = 0, il = index_stream.length; i < il; ++i) {\n var index = index_stream[i];\n\n if (xleft === 0) { // Beginning of new scan line\n op += scanstride;\n xleft = framewidth;\n if (op >= opend) { // Catch the wrap to switch passes when interlacing.\n scanstride = framestride * 4 + width * 4 * (interlaceskip-1);\n // interlaceskip / 2 * 4 is interlaceskip << 1.\n op = opbeg + (framewidth + framestride) * (interlaceskip << 1);\n interlaceskip >>= 1;\n }\n }\n\n if (index === trans) {\n op += 4;\n } else {\n var r = buf[palette_offset + index * 3];\n var g = buf[palette_offset + index * 3 + 1];\n var b = buf[palette_offset + index * 3 + 2];\n pixels[op++] = b;\n pixels[op++] = g;\n pixels[op++] = r;\n pixels[op++] = 255;\n }\n --xleft;\n }\n };\n\n // I will go to copy and paste hell one day...\n this.decodeAndBlitFrameRGBA = function(frame_num, pixels) {\n var frame = this.frameInfo(frame_num);\n var num_pixels = frame.width * frame.height;\n var index_stream = new Uint8Array(num_pixels); // At most 8-bit indices.\n GifReaderLZWOutputIndexStream(\n buf, frame.data_offset, index_stream, num_pixels);\n var palette_offset = frame.palette_offset;\n\n // NOTE(deanm): It seems to be much faster to compare index to 256 than\n // to === null. Not sure why, but CompareStub_EQ_STRICT shows up high in\n // the profile, not sure if it's related to using a Uint8Array.\n var trans = frame.transparent_index;\n if (trans === null) trans = 256;\n\n // We are possibly just blitting to a portion of the entire frame.\n // That is a subrect within the framerect, so the additional pixels\n // must be skipped over after we finished a scanline.\n var framewidth = frame.width;\n var framestride = width - framewidth;\n var xleft = framewidth; // Number of subrect pixels left in scanline.\n\n // Output indicies of the top left and bottom right corners of the subrect.\n var opbeg = ((frame.y * width) + frame.x) * 4;\n var opend = ((frame.y + frame.height) * width + frame.x) * 4;\n var op = opbeg;\n\n var scanstride = framestride * 4;\n\n // Use scanstride to skip past the rows when interlacing. This is skipping\n // 7 rows for the first two passes, then 3 then 1.\n if (frame.interlaced === true) {\n scanstride += width * 4 * 7; // Pass 1.\n }\n\n var interlaceskip = 8; // Tracking the row interval in the current pass.\n\n for (var i = 0, il = index_stream.length; i < il; ++i) {\n var index = index_stream[i];\n\n if (xleft === 0) { // Beginning of new scan line\n op += scanstride;\n xleft = framewidth;\n if (op >= opend) { // Catch the wrap to switch passes when interlacing.\n scanstride = framestride * 4 + width * 4 * (interlaceskip-1);\n // interlaceskip / 2 * 4 is interlaceskip << 1.\n op = opbeg + (framewidth + framestride) * (interlaceskip << 1);\n interlaceskip >>= 1;\n }\n }\n\n if (index === trans) {\n op += 4;\n } else {\n var r = buf[palette_offset + index * 3];\n var g = buf[palette_offset + index * 3 + 1];\n var b = buf[palette_offset + index * 3 + 2];\n pixels[op++] = r;\n pixels[op++] = g;\n pixels[op++] = b;\n pixels[op++] = 255;\n }\n --xleft;\n }\n };\n}\n\nfunction GifReaderLZWOutputIndexStream(code_stream, p, output, output_length) {\n var min_code_size = code_stream[p++];\n\n var clear_code = 1 << min_code_size;\n var eoi_code = clear_code + 1;\n var next_code = eoi_code + 1;\n\n var cur_code_size = min_code_size + 1; // Number of bits per code.\n // NOTE: This shares the same name as the encoder, but has a different\n // meaning here. Here this masks each code coming from the code stream.\n var code_mask = (1 << cur_code_size) - 1;\n var cur_shift = 0;\n var cur = 0;\n\n var op = 0; // Output pointer.\n\n var subblock_size = code_stream[p++];\n\n // TODO(deanm): Would using a TypedArray be any faster? At least it would\n // solve the fast mode / backing store uncertainty.\n // var code_table = Array(4096);\n var code_table = new Int32Array(4096); // Can be signed, we only use 20 bits.\n\n var prev_code = null; // Track code-1.\n\n while (true) {\n // Read up to two bytes, making sure we always 12-bits for max sized code.\n while (cur_shift < 16) {\n if (subblock_size === 0) break; // No more data to be read.\n\n cur |= code_stream[p++] << cur_shift;\n cur_shift += 8;\n\n if (subblock_size === 1) { // Never let it get to 0 to hold logic above.\n subblock_size = code_stream[p++]; // Next subblock.\n } else {\n --subblock_size;\n }\n }\n\n // TODO(deanm): We should never really get here, we should have received\n // and EOI.\n if (cur_shift < cur_code_size)\n break;\n\n var code = cur & code_mask;\n cur >>= cur_code_size;\n cur_shift -= cur_code_size;\n\n // TODO(deanm): Maybe should check that the first code was a clear code,\n // at least this is what you're supposed to do. But actually our encoder\n // now doesn't emit a clear code first anyway.\n if (code === clear_code) {\n // We don't actually have to clear the table. This could be a good idea\n // for greater error checking, but we don't really do any anyway. We\n // will just track it with next_code and overwrite old entries.\n\n next_code = eoi_code + 1;\n cur_code_size = min_code_size + 1;\n code_mask = (1 << cur_code_size) - 1;\n\n // Don't update prev_code ?\n prev_code = null;\n continue;\n } else if (code === eoi_code) {\n break;\n }\n\n // We have a similar situation as the decoder, where we want to store\n // variable length entries (code table entries), but we want to do in a\n // faster manner than an array of arrays. The code below stores sort of a\n // linked list within the code table, and then \"chases\" through it to\n // construct the dictionary entries. When a new entry is created, just the\n // last byte is stored, and the rest (prefix) of the entry is only\n // referenced by its table entry. Then the code chases through the\n // prefixes until it reaches a single byte code. We have to chase twice,\n // first to compute the length, and then to actually copy the data to the\n // output (backwards, since we know the length). The alternative would be\n // storing something in an intermediate stack, but that doesn't make any\n // more sense. I implemented an approach where it also stored the length\n // in the code table, although it's a bit tricky because you run out of\n // bits (12 + 12 + 8), but I didn't measure much improvements (the table\n // entries are generally not the long). Even when I created benchmarks for\n // very long table entries the complexity did not seem worth it.\n // The code table stores the prefix entry in 12 bits and then the suffix\n // byte in 8 bits, so each entry is 20 bits.\n\n var chase_code = code < next_code ? code : prev_code;\n\n // Chase what we will output, either {CODE} or {CODE-1}.\n var chase_length = 0;\n var chase = chase_code;\n while (chase > clear_code) {\n chase = code_table[chase] >> 8;\n ++chase_length;\n }\n\n var k = chase;\n\n var op_end = op + chase_length + (chase_code !== code ? 1 : 0);\n if (op_end > output_length) {\n console.log(\"Warning, gif stream longer than expected.\");\n return;\n }\n\n // Already have the first byte from the chase, might as well write it fast.\n output[op++] = k;\n\n op += chase_length;\n var b = op; // Track pointer, writing backwards.\n\n if (chase_code !== code) // The case of emitting {CODE-1} + k.\n output[op++] = k;\n\n chase = chase_code;\n while (chase_length--) {\n chase = code_table[chase];\n output[--b] = chase & 0xff; // Write backwards.\n chase >>= 8; // Pull down to the prefix code.\n }\n\n if (prev_code !== null && next_code < 4096) {\n code_table[next_code++] = prev_code << 8 | k;\n // TODO(deanm): Figure out this clearing vs code growth logic better. I\n // have an feeling that it should just happen somewhere else, for now it\n // is awkward between when we grow past the max and then hit a clear code.\n // For now just check if we hit the max 12-bits (then a clear code should\n // follow, also of course encoded in 12-bits).\n if (next_code >= code_mask+1 && cur_code_size < 12) {\n ++cur_code_size;\n code_mask = code_mask << 1 | 1;\n }\n }\n\n prev_code = code;\n }\n\n if (op !== output_length) {\n console.log(\"Warning, gif stream shorter than expected.\");\n }\n\n return output;\n}\n\n// CommonJS.\ntry { exports.GifWriter = GifWriter; exports.GifReader = GifReader } catch(e) {}\n","// Top level file is just a mixin of submodules & constants\n'use strict';\n\nvar assign = require('./lib/utils/common').assign;\n\nvar deflate = require('./lib/deflate');\nvar inflate = require('./lib/inflate');\nvar constants = require('./lib/zlib/constants');\n\nvar pako = {};\n\nassign(pako, deflate, inflate, constants);\n\nmodule.exports = pako;\n","'use strict';\n\n\nvar zlib_deflate = require('./zlib/deflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\n\nvar toString = Object.prototype.toString;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\nvar Z_NO_FLUSH = 0;\nvar Z_FINISH = 4;\n\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_SYNC_FLUSH = 2;\n\nvar Z_DEFAULT_COMPRESSION = -1;\n\nvar Z_DEFAULT_STRATEGY = 0;\n\nvar Z_DEFLATED = 8;\n\n/* ===========================================================================*/\n\n\n/**\n * class Deflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[deflate]],\n * [[deflateRaw]] and [[gzip]].\n **/\n\n/* internal\n * Deflate.chunks -> Array\n *\n * Chunks of output data, if [[Deflate#onData]] not overridden.\n **/\n\n/**\n * Deflate.result -> Uint8Array|Array\n *\n * Compressed result, generated by default [[Deflate#onData]]\n * and [[Deflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Deflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Deflate.err -> Number\n *\n * Error code after deflate finished. 0 (Z_OK) on success.\n * You will not need it in real life, because deflate errors\n * are possible only on wrong options or bad `onData` / `onEnd`\n * custom handlers.\n **/\n\n/**\n * Deflate.msg -> String\n *\n * Error message, if [[Deflate.err]] != 0\n **/\n\n\n/**\n * new Deflate(options)\n * - options (Object): zlib deflate options.\n *\n * Creates new deflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `level`\n * - `windowBits`\n * - `memLevel`\n * - `strategy`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw deflate\n * - `gzip` (Boolean) - create gzip wrapper\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n * - `header` (Object) - custom header for gzip\n * - `text` (Boolean) - true if compressed data believed to be text\n * - `time` (Number) - modification time, unix timestamp\n * - `os` (Number) - operation system code\n * - `extra` (Array) - array of bytes with extra data (max 65536)\n * - `name` (String) - file name (binary string)\n * - `comment` (String) - comment (binary string)\n * - `hcrc` (Boolean) - true if header crc should be added\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var deflate = new pako.Deflate({ level: 3});\n *\n * deflate.push(chunk1, false);\n * deflate.push(chunk2, true); // true -> last chunk\n *\n * if (deflate.err) { throw new Error(deflate.err); }\n *\n * console.log(deflate.result);\n * ```\n **/\nfunction Deflate(options) {\n if (!(this instanceof Deflate)) return new Deflate(options);\n\n this.options = utils.assign({\n level: Z_DEFAULT_COMPRESSION,\n method: Z_DEFLATED,\n chunkSize: 16384,\n windowBits: 15,\n memLevel: 8,\n strategy: Z_DEFAULT_STRATEGY,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n if (opt.raw && (opt.windowBits > 0)) {\n opt.windowBits = -opt.windowBits;\n }\n\n else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) {\n opt.windowBits += 16;\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_deflate.deflateInit2(\n this.strm,\n opt.level,\n opt.method,\n opt.windowBits,\n opt.memLevel,\n opt.strategy\n );\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n if (opt.header) {\n zlib_deflate.deflateSetHeader(this.strm, opt.header);\n }\n\n if (opt.dictionary) {\n var dict;\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n // If we need to compress text, change encoding to utf8.\n dict = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n dict = new Uint8Array(opt.dictionary);\n } else {\n dict = opt.dictionary;\n }\n\n status = zlib_deflate.deflateSetDictionary(this.strm, dict);\n\n if (status !== Z_OK) {\n throw new Error(msg[status]);\n }\n\n this._dict_set = true;\n }\n}\n\n/**\n * Deflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be\n * converted to utf8 byte sequence.\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with\n * new compressed chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the compression context.\n *\n * On fail call [[Deflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * array format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nDeflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var status, _mode;\n\n if (this.ended) { return false; }\n\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // If we need to compress text, change encoding to utf8.\n strm.input = strings.string2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n status = zlib_deflate.deflate(strm, _mode); /* no bad return value */\n\n if (status !== Z_STREAM_END && status !== Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {\n if (this.options.to === 'string') {\n this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END);\n\n // Finalize on the last chunk.\n if (_mode === Z_FINISH) {\n status = zlib_deflate.deflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === Z_SYNC_FLUSH) {\n this.onEnd(Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Deflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nDeflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Deflate#onEnd(status) -> Void\n * - status (Number): deflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called once after you tell deflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nDeflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * deflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * Compress `data` with deflate algorithm and `options`.\n *\n * Supported options are:\n *\n * - level\n * - windowBits\n * - memLevel\n * - strategy\n * - dictionary\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be \"binary string\"\n * (each char code [0..255])\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , data = Uint8Array([1,2,3,4,5,6,7,8,9]);\n *\n * console.log(pako.deflate(data));\n * ```\n **/\nfunction deflate(input, options) {\n var deflator = new Deflate(options);\n\n deflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (deflator.err) { throw deflator.msg || msg[deflator.err]; }\n\n return deflator.result;\n}\n\n\n/**\n * deflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction deflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return deflate(input, options);\n}\n\n\n/**\n * gzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to compress.\n * - options (Object): zlib deflate options.\n *\n * The same as [[deflate]], but create gzip wrapper instead of\n * deflate one.\n **/\nfunction gzip(input, options) {\n options = options || {};\n options.gzip = true;\n return deflate(input, options);\n}\n\n\nexports.Deflate = Deflate;\nexports.deflate = deflate;\nexports.deflateRaw = deflateRaw;\nexports.gzip = gzip;\n","'use strict';\n\n\nvar zlib_inflate = require('./zlib/inflate');\nvar utils = require('./utils/common');\nvar strings = require('./utils/strings');\nvar c = require('./zlib/constants');\nvar msg = require('./zlib/messages');\nvar ZStream = require('./zlib/zstream');\nvar GZheader = require('./zlib/gzheader');\n\nvar toString = Object.prototype.toString;\n\n/**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n/* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n/**\n * Inflate.result -> Uint8Array|Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Inflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n/**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n\n/**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true); // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\nfunction Inflate(options) {\n if (!(this instanceof Inflate)) return new Inflate(options);\n\n this.options = utils.assign({\n chunkSize: 16384,\n windowBits: 0,\n to: ''\n }, options || {});\n\n var opt = this.options;\n\n // Force window size for `raw` data, if not set directly,\n // because we have no header for autodetect.\n if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) {\n opt.windowBits = -opt.windowBits;\n if (opt.windowBits === 0) { opt.windowBits = -15; }\n }\n\n // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n if ((opt.windowBits >= 0) && (opt.windowBits < 16) &&\n !(options && options.windowBits)) {\n opt.windowBits += 32;\n }\n\n // Gzip header has no info about windows size, we can do autodetect only\n // for deflate. So, if window size not set, force it to max when gzip possible\n if ((opt.windowBits > 15) && (opt.windowBits < 48)) {\n // bit 3 (16) -> gzipped data\n // bit 4 (32) -> autodetect gzip/deflate\n if ((opt.windowBits & 15) === 0) {\n opt.windowBits |= 15;\n }\n }\n\n this.err = 0; // error code, if happens (0 = Z_OK)\n this.msg = ''; // error message\n this.ended = false; // used to avoid multiple onEnd() calls\n this.chunks = []; // chunks of compressed data\n\n this.strm = new ZStream();\n this.strm.avail_out = 0;\n\n var status = zlib_inflate.inflateInit2(\n this.strm,\n opt.windowBits\n );\n\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n\n this.header = new GZheader();\n\n zlib_inflate.inflateGetHeader(this.strm, this.header);\n\n // Setup dictionary\n if (opt.dictionary) {\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n opt.dictionary = strings.string2buf(opt.dictionary);\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n opt.dictionary = new Uint8Array(opt.dictionary);\n }\n if (opt.raw) { //In raw mode we need to set the dictionary early\n status = zlib_inflate.inflateSetDictionary(this.strm, opt.dictionary);\n if (status !== c.Z_OK) {\n throw new Error(msg[status]);\n }\n }\n }\n}\n\n/**\n * Inflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the decompression context.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\nInflate.prototype.push = function (data, mode) {\n var strm = this.strm;\n var chunkSize = this.options.chunkSize;\n var dictionary = this.options.dictionary;\n var status, _mode;\n var next_out_utf8, tail, utf8str;\n\n // Flag to properly process Z_BUF_ERROR on testing inflate call\n // when we check that all output data was flushed.\n var allowBufError = false;\n\n if (this.ended) { return false; }\n _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH);\n\n // Convert data if needed\n if (typeof data === 'string') {\n // Only binary strings can be decompressed on practice\n strm.input = strings.binstring2buf(data);\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data);\n } else {\n strm.input = data;\n }\n\n strm.next_in = 0;\n strm.avail_in = strm.input.length;\n\n do {\n if (strm.avail_out === 0) {\n strm.output = new utils.Buf8(chunkSize);\n strm.next_out = 0;\n strm.avail_out = chunkSize;\n }\n\n status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */\n\n if (status === c.Z_NEED_DICT && dictionary) {\n status = zlib_inflate.inflateSetDictionary(this.strm, dictionary);\n }\n\n if (status === c.Z_BUF_ERROR && allowBufError === true) {\n status = c.Z_OK;\n allowBufError = false;\n }\n\n if (status !== c.Z_STREAM_END && status !== c.Z_OK) {\n this.onEnd(status);\n this.ended = true;\n return false;\n }\n\n if (strm.next_out) {\n if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) {\n\n if (this.options.to === 'string') {\n\n next_out_utf8 = strings.utf8border(strm.output, strm.next_out);\n\n tail = strm.next_out - next_out_utf8;\n utf8str = strings.buf2string(strm.output, next_out_utf8);\n\n // move tail\n strm.next_out = tail;\n strm.avail_out = chunkSize - tail;\n if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); }\n\n this.onData(utf8str);\n\n } else {\n this.onData(utils.shrinkBuf(strm.output, strm.next_out));\n }\n }\n }\n\n // When no more input data, we should check that internal inflate buffers\n // are flushed. The only way to do it when avail_out = 0 - run one more\n // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.\n // Here we set flag to process this error properly.\n //\n // NOTE. Deflate does not return error in this case and does not needs such\n // logic.\n if (strm.avail_in === 0 && strm.avail_out === 0) {\n allowBufError = true;\n }\n\n } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== c.Z_STREAM_END);\n\n if (status === c.Z_STREAM_END) {\n _mode = c.Z_FINISH;\n }\n\n // Finalize on the last chunk.\n if (_mode === c.Z_FINISH) {\n status = zlib_inflate.inflateEnd(this.strm);\n this.onEnd(status);\n this.ended = true;\n return status === c.Z_OK;\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === c.Z_SYNC_FLUSH) {\n this.onEnd(c.Z_OK);\n strm.avail_out = 0;\n return true;\n }\n\n return true;\n};\n\n\n/**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\nInflate.prototype.onData = function (chunk) {\n this.chunks.push(chunk);\n};\n\n\n/**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\nInflate.prototype.onEnd = function (status) {\n // On success - join\n if (status === c.Z_OK) {\n if (this.options.to === 'string') {\n // Glue & convert here, until we teach pako to send\n // utf8 aligned strings to onData\n this.result = this.chunks.join('');\n } else {\n this.result = utils.flattenChunks(this.chunks);\n }\n }\n this.chunks = [];\n this.err = status;\n this.msg = this.strm.msg;\n};\n\n\n/**\n * inflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , input = pako.deflate([1,2,3,4,5,6,7,8,9])\n * , output;\n *\n * try {\n * output = pako.inflate(input);\n * } catch (err)\n * console.log(err);\n * }\n * ```\n **/\nfunction inflate(input, options) {\n var inflator = new Inflate(options);\n\n inflator.push(input, true);\n\n // That will never happens, if you don't cheat with options :)\n if (inflator.err) { throw inflator.msg || msg[inflator.err]; }\n\n return inflator.result;\n}\n\n\n/**\n * inflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nfunction inflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return inflate(input, options);\n}\n\n\n/**\n * ungzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\n\n\nexports.Inflate = Inflate;\nexports.inflate = inflate;\nexports.inflateRaw = inflateRaw;\nexports.ungzip = inflate;\n","'use strict';\n\n\nvar TYPED_OK = (typeof Uint8Array !== 'undefined') &&\n (typeof Uint16Array !== 'undefined') &&\n (typeof Int32Array !== 'undefined');\n\nfunction _has(obj, key) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nexports.assign = function (obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1);\n while (sources.length) {\n var source = sources.shift();\n if (!source) { continue; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object');\n }\n\n for (var p in source) {\n if (_has(source, p)) {\n obj[p] = source[p];\n }\n }\n }\n\n return obj;\n};\n\n\n// reduce buffer size, avoiding mem copy\nexports.shrinkBuf = function (buf, size) {\n if (buf.length === size) { return buf; }\n if (buf.subarray) { return buf.subarray(0, size); }\n buf.length = size;\n return buf;\n};\n\n\nvar fnTyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n if (src.subarray && dest.subarray) {\n dest.set(src.subarray(src_offs, src_offs + len), dest_offs);\n return;\n }\n // Fallback to ordinary array\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n var i, l, len, pos, chunk, result;\n\n // calculate data length\n len = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length;\n }\n\n // join chunks\n result = new Uint8Array(len);\n pos = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n chunk = chunks[i];\n result.set(chunk, pos);\n pos += chunk.length;\n }\n\n return result;\n }\n};\n\nvar fnUntyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n return [].concat.apply([], chunks);\n }\n};\n\n\n// Enable/Disable typed arrays use, for testing\n//\nexports.setTyped = function (on) {\n if (on) {\n exports.Buf8 = Uint8Array;\n exports.Buf16 = Uint16Array;\n exports.Buf32 = Int32Array;\n exports.assign(exports, fnTyped);\n } else {\n exports.Buf8 = Array;\n exports.Buf16 = Array;\n exports.Buf32 = Array;\n exports.assign(exports, fnUntyped);\n }\n};\n\nexports.setTyped(TYPED_OK);\n","// String encode/decode helpers\n'use strict';\n\n\nvar utils = require('./common');\n\n\n// Quick check if we can use fast array to bin string conversion\n//\n// - apply(Array) can fail on Android 2.2\n// - apply(Uint8Array) can fail on iOS 5.1 Safari\n//\nvar STR_APPLY_OK = true;\nvar STR_APPLY_UIA_OK = true;\n\ntry { String.fromCharCode.apply(null, [ 0 ]); } catch (__) { STR_APPLY_OK = false; }\ntry { String.fromCharCode.apply(null, new Uint8Array(1)); } catch (__) { STR_APPLY_UIA_OK = false; }\n\n\n// Table with utf8 lengths (calculated by first byte of sequence)\n// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n// because max possible codepoint is 0x10ffff\nvar _utf8len = new utils.Buf8(256);\nfor (var q = 0; q < 256; q++) {\n _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);\n}\n_utf8len[254] = _utf8len[254] = 1; // Invalid sequence start\n\n\n// convert string to array (typed, when possible)\nexports.string2buf = function (str) {\n var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4;\n }\n\n // allocate buffer\n buf = new utils.Buf8(buf_len);\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos);\n if ((c & 0xfc00) === 0xd800 && (m_pos + 1 < str_len)) {\n c2 = str.charCodeAt(m_pos + 1);\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00);\n m_pos++;\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c;\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xC0 | (c >>> 6);\n buf[i++] = 0x80 | (c & 0x3f);\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xE0 | (c >>> 12);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | (c >>> 18);\n buf[i++] = 0x80 | (c >>> 12 & 0x3f);\n buf[i++] = 0x80 | (c >>> 6 & 0x3f);\n buf[i++] = 0x80 | (c & 0x3f);\n }\n }\n\n return buf;\n};\n\n// Helper (used in 2 places)\nfunction buf2binstring(buf, len) {\n // On Chrome, the arguments in a function call that are allowed is `65534`.\n // If the length of the buffer is smaller than that, we can use this optimization,\n // otherwise we will take a slower path.\n if (len < 65534) {\n if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) {\n return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));\n }\n }\n\n var result = '';\n for (var i = 0; i < len; i++) {\n result += String.fromCharCode(buf[i]);\n }\n return result;\n}\n\n\n// Convert byte array to binary string\nexports.buf2binstring = function (buf) {\n return buf2binstring(buf, buf.length);\n};\n\n\n// Convert binary string (typed, when possible)\nexports.binstring2buf = function (str) {\n var buf = new utils.Buf8(str.length);\n for (var i = 0, len = buf.length; i < len; i++) {\n buf[i] = str.charCodeAt(i);\n }\n return buf;\n};\n\n\n// convert array to string\nexports.buf2string = function (buf, max) {\n var i, out, c, c_len;\n var len = max || buf.length;\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n var utf16buf = new Array(len * 2);\n\n for (out = 0, i = 0; i < len;) {\n c = buf[i++];\n // quick process ascii\n if (c < 0x80) { utf16buf[out++] = c; continue; }\n\n c_len = _utf8len[c];\n // skip 5 & 6 byte codes\n if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len - 1; continue; }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07;\n // join the rest\n while (c_len > 1 && i < len) {\n c = (c << 6) | (buf[i++] & 0x3f);\n c_len--;\n }\n\n // terminated by end of string?\n if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; }\n\n if (c < 0x10000) {\n utf16buf[out++] = c;\n } else {\n c -= 0x10000;\n utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff);\n utf16buf[out++] = 0xdc00 | (c & 0x3ff);\n }\n }\n\n return buf2binstring(utf16buf, out);\n};\n\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max - length limit (mandatory);\nexports.utf8border = function (buf, max) {\n var pos;\n\n max = max || buf.length;\n if (max > buf.length) { max = buf.length; }\n\n // go back from last position, until start of sequence found\n pos = max - 1;\n while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; }\n\n // Very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) { return max; }\n\n // If we came to start of buffer - that means buffer is too small,\n // return max too.\n if (pos === 0) { return max; }\n\n return (pos + _utf8len[buf[pos]] > max) ? pos : max;\n};\n","'use strict';\n\n// Note: adler32 takes 12% for level 0 and 2% for level 6.\n// It isn't worth it to make additional optimizations as in original.\n// Small size is preferable.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction adler32(adler, buf, len, pos) {\n var s1 = (adler & 0xffff) |0,\n s2 = ((adler >>> 16) & 0xffff) |0,\n n = 0;\n\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len;\n len -= n;\n\n do {\n s1 = (s1 + buf[pos++]) |0;\n s2 = (s2 + s1) |0;\n } while (--n);\n\n s1 %= 65521;\n s2 %= 65521;\n }\n\n return (s1 | (s2 << 16)) |0;\n}\n\n\nmodule.exports = adler32;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n\n /* Allowed flush values; see deflate() and inflate() below for details */\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n\n /* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n //Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n //Z_VERSION_ERROR: -6,\n\n /* compression levels */\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n\n\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n\n /* Possible values of the data_type field (though see inflate()) */\n Z_BINARY: 0,\n Z_TEXT: 1,\n //Z_ASCII: 1, // = Z_TEXT (deprecated)\n Z_UNKNOWN: 2,\n\n /* The deflate compression method */\n Z_DEFLATED: 8\n //Z_NULL: null // Use -1 or null inline, depending on var type\n};\n","'use strict';\n\n// Note: we can't get significant speed boost here.\n// So write code to minimize size - no pregenerated tables\n// and array tools dependencies.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// Use ordinary array, since untyped makes no boost here\nfunction makeTable() {\n var c, table = [];\n\n for (var n = 0; n < 256; n++) {\n c = n;\n for (var k = 0; k < 8; k++) {\n c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n table[n] = c;\n }\n\n return table;\n}\n\n// Create table on load. Just 255 signed longs. Not a problem.\nvar crcTable = makeTable();\n\n\nfunction crc32(crc, buf, len, pos) {\n var t = crcTable,\n end = pos + len;\n\n crc ^= -1;\n\n for (var i = pos; i < end; i++) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n}\n\n\nmodule.exports = crc32;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar trees = require('./trees');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar msg = require('./messages');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\nvar Z_NO_FLUSH = 0;\nvar Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\nvar Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\n//var Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\n//var Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\n//var Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n\n/* compression levels */\n//var Z_NO_COMPRESSION = 0;\n//var Z_BEST_SPEED = 1;\n//var Z_BEST_COMPRESSION = 9;\nvar Z_DEFAULT_COMPRESSION = -1;\n\n\nvar Z_FILTERED = 1;\nvar Z_HUFFMAN_ONLY = 2;\nvar Z_RLE = 3;\nvar Z_FIXED = 4;\nvar Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\n//var Z_BINARY = 0;\n//var Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n/*============================================================================*/\n\n\nvar MAX_MEM_LEVEL = 9;\n/* Maximum value for memLevel in deflateInit2 */\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_MEM_LEVEL = 8;\n\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\nvar D_CODES = 30;\n/* number of distance codes */\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\nvar MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);\n\nvar PRESET_DICT = 0x20;\n\nvar INIT_STATE = 42;\nvar EXTRA_STATE = 69;\nvar NAME_STATE = 73;\nvar COMMENT_STATE = 91;\nvar HCRC_STATE = 103;\nvar BUSY_STATE = 113;\nvar FINISH_STATE = 666;\n\nvar BS_NEED_MORE = 1; /* block not completed, need more input or more output */\nvar BS_BLOCK_DONE = 2; /* block flush performed */\nvar BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */\nvar BS_FINISH_DONE = 4; /* finish done, accept no more input or output */\n\nvar OS_CODE = 0x03; // Unix :) . Don't detect, use this default.\n\nfunction err(strm, errorCode) {\n strm.msg = msg[errorCode];\n return errorCode;\n}\n\nfunction rank(f) {\n return ((f) << 1) - ((f) > 4 ? 9 : 0);\n}\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n\n/* =========================================================================\n * Flush as much pending output as possible. All deflate() output goes\n * through this function so some applications may wish to modify it\n * to avoid allocating a large strm->output buffer and copying into it.\n * (See also read_buf()).\n */\nfunction flush_pending(strm) {\n var s = strm.state;\n\n //_tr_flush_bits(s);\n var len = s.pending;\n if (len > strm.avail_out) {\n len = strm.avail_out;\n }\n if (len === 0) { return; }\n\n utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);\n strm.next_out += len;\n s.pending_out += len;\n strm.total_out += len;\n strm.avail_out -= len;\n s.pending -= len;\n if (s.pending === 0) {\n s.pending_out = 0;\n }\n}\n\n\nfunction flush_block_only(s, last) {\n trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);\n s.block_start = s.strstart;\n flush_pending(s.strm);\n}\n\n\nfunction put_byte(s, b) {\n s.pending_buf[s.pending++] = b;\n}\n\n\n/* =========================================================================\n * Put a short in the pending buffer. The 16-bit value is put in MSB order.\n * IN assertion: the stream state is correct and there is enough room in\n * pending_buf.\n */\nfunction putShortMSB(s, b) {\n// put_byte(s, (Byte)(b >> 8));\n// put_byte(s, (Byte)(b & 0xff));\n s.pending_buf[s.pending++] = (b >>> 8) & 0xff;\n s.pending_buf[s.pending++] = b & 0xff;\n}\n\n\n/* ===========================================================================\n * Read a new buffer from the current input stream, update the adler32\n * and total number of bytes read. All deflate() input goes through\n * this function so some applications may wish to modify it to avoid\n * allocating a large strm->input buffer and copying from it.\n * (See also flush_pending()).\n */\nfunction read_buf(strm, buf, start, size) {\n var len = strm.avail_in;\n\n if (len > size) { len = size; }\n if (len === 0) { return 0; }\n\n strm.avail_in -= len;\n\n // zmemcpy(buf, strm->next_in, len);\n utils.arraySet(buf, strm.input, strm.next_in, len, start);\n if (strm.state.wrap === 1) {\n strm.adler = adler32(strm.adler, buf, len, start);\n }\n\n else if (strm.state.wrap === 2) {\n strm.adler = crc32(strm.adler, buf, len, start);\n }\n\n strm.next_in += len;\n strm.total_in += len;\n\n return len;\n}\n\n\n/* ===========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n * OUT assertion: the match length is not greater than s->lookahead.\n */\nfunction longest_match(s, cur_match) {\n var chain_length = s.max_chain_length; /* max hash chain length */\n var scan = s.strstart; /* current string */\n var match; /* matched string */\n var len; /* length of current match */\n var best_len = s.prev_length; /* best match length so far */\n var nice_match = s.nice_match; /* stop if match long enough */\n var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?\n s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;\n\n var _win = s.window; // shortcut\n\n var wmask = s.w_mask;\n var prev = s.prev;\n\n /* Stop when cur_match becomes <= limit. To simplify the code,\n * we prevent matches with the string of window index 0.\n */\n\n var strend = s.strstart + MAX_MATCH;\n var scan_end1 = _win[scan + best_len - 1];\n var scan_end = _win[scan + best_len];\n\n /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\n * It is easy to get rid of this optimization if necessary.\n */\n // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\n\n /* Do not waste too much time if we already have a good match: */\n if (s.prev_length >= s.good_match) {\n chain_length >>= 2;\n }\n /* Do not look for matches beyond the end of the input. This is necessary\n * to make deflate deterministic.\n */\n if (nice_match > s.lookahead) { nice_match = s.lookahead; }\n\n // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\n\n do {\n // Assert(cur_match < s->strstart, \"no future\");\n match = cur_match;\n\n /* Skip to next match if the match length cannot increase\n * or if the match length is less than 2. Note that the checks below\n * for insufficient lookahead only occur occasionally for performance\n * reasons. Therefore uninitialized memory will be accessed, and\n * conditional jumps will be made that depend on those values.\n * However the length of the match is limited to the lookahead, so\n * the output of deflate is not affected by the uninitialized values.\n */\n\n if (_win[match + best_len] !== scan_end ||\n _win[match + best_len - 1] !== scan_end1 ||\n _win[match] !== _win[scan] ||\n _win[++match] !== _win[scan + 1]) {\n continue;\n }\n\n /* The check at best_len-1 can be removed because it will be made\n * again later. (This heuristic is not always a win.)\n * It is not necessary to compare scan[2] and match[2] since they\n * are always equal when the other bytes match, given that\n * the hash keys are equal and that HASH_BITS >= 8.\n */\n scan += 2;\n match++;\n // Assert(*scan == *match, \"match[2]?\");\n\n /* We check for insufficient lookahead only every 8th comparison;\n * the 256th check will be made at strstart+258.\n */\n do {\n /*jshint noempty:false*/\n } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n scan < strend);\n\n // Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n\n len = MAX_MATCH - (strend - scan);\n scan = strend - MAX_MATCH;\n\n if (len > best_len) {\n s.match_start = cur_match;\n best_len = len;\n if (len >= nice_match) {\n break;\n }\n scan_end1 = _win[scan + best_len - 1];\n scan_end = _win[scan + best_len];\n }\n } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n\n if (best_len <= s.lookahead) {\n return best_len;\n }\n return s.lookahead;\n}\n\n\n/* ===========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead.\n *\n * IN assertion: lookahead < MIN_LOOKAHEAD\n * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n * At least one byte has been read, or avail_in == 0; reads are\n * performed for at least two bytes (required for the zip translate_eol\n * option -- not supported here).\n */\nfunction fill_window(s) {\n var _w_size = s.w_size;\n var p, n, m, more, str;\n\n //Assert(s->lookahead < MIN_LOOKAHEAD, \"already enough lookahead\");\n\n do {\n more = s.window_size - s.lookahead - s.strstart;\n\n // JS ints have 32 bit, block below not needed\n /* Deal with !@#$% 64K limit: */\n //if (sizeof(int) <= 2) {\n // if (more == 0 && s->strstart == 0 && s->lookahead == 0) {\n // more = wsize;\n //\n // } else if (more == (unsigned)(-1)) {\n // /* Very unlikely, but possible on 16 bit machine if\n // * strstart == 0 && lookahead == 1 (input done a byte at time)\n // */\n // more--;\n // }\n //}\n\n\n /* If the window is almost full and there is insufficient lookahead,\n * move the upper half to the lower one to make room in the upper half.\n */\n if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n\n utils.arraySet(s.window, s.window, _w_size, _w_size, 0);\n s.match_start -= _w_size;\n s.strstart -= _w_size;\n /* we now have strstart >= MAX_DIST */\n s.block_start -= _w_size;\n\n /* Slide the hash table (could be avoided with 32 bit values\n at the expense of memory usage). We slide even when level == 0\n to keep the hash table consistent if we switch back to level > 0\n later. (Using level 0 permanently is not an optimal usage of\n zlib, so we don't care about this pathological case.)\n */\n\n n = s.hash_size;\n p = n;\n do {\n m = s.head[--p];\n s.head[p] = (m >= _w_size ? m - _w_size : 0);\n } while (--n);\n\n n = _w_size;\n p = n;\n do {\n m = s.prev[--p];\n s.prev[p] = (m >= _w_size ? m - _w_size : 0);\n /* If n is not on any hash chain, prev[n] is garbage but\n * its value will never be used.\n */\n } while (--n);\n\n more += _w_size;\n }\n if (s.strm.avail_in === 0) {\n break;\n }\n\n /* If there was no sliding:\n * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n * more == window_size - lookahead - strstart\n * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n * => more >= window_size - 2*WSIZE + 2\n * In the BIG_MEM or MMAP case (not yet supported),\n * window_size == input_size + MIN_LOOKAHEAD &&\n * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n * Otherwise, window_size == 2*WSIZE so more >= 2.\n * If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n */\n //Assert(more >= 2, \"more < 2\");\n n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);\n s.lookahead += n;\n\n /* Initialize the hash value now that we have some input: */\n if (s.lookahead + s.insert >= MIN_MATCH) {\n str = s.strstart - s.insert;\n s.ins_h = s.window[str];\n\n /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;\n//#if MIN_MATCH != 3\n// Call update_hash() MIN_MATCH-3 more times\n//#endif\n while (s.insert) {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = str;\n str++;\n s.insert--;\n if (s.lookahead + s.insert < MIN_MATCH) {\n break;\n }\n }\n }\n /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,\n * but this is not important since only literal bytes will be emitted.\n */\n\n } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n\n /* If the WIN_INIT bytes after the end of the current data have never been\n * written, then zero those bytes in order to avoid memory check reports of\n * the use of uninitialized (or uninitialised as Julian writes) bytes by\n * the longest match routines. Update the high water mark for the next\n * time through here. WIN_INIT is set to MAX_MATCH since the longest match\n * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.\n */\n// if (s.high_water < s.window_size) {\n// var curr = s.strstart + s.lookahead;\n// var init = 0;\n//\n// if (s.high_water < curr) {\n// /* Previous high water mark below current data -- zero WIN_INIT\n// * bytes or up to end of window, whichever is less.\n// */\n// init = s.window_size - curr;\n// if (init > WIN_INIT)\n// init = WIN_INIT;\n// zmemzero(s->window + curr, (unsigned)init);\n// s->high_water = curr + init;\n// }\n// else if (s->high_water < (ulg)curr + WIN_INIT) {\n// /* High water mark at or above current data, but below current data\n// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up\n// * to end of window, whichever is less.\n// */\n// init = (ulg)curr + WIN_INIT - s->high_water;\n// if (init > s->window_size - s->high_water)\n// init = s->window_size - s->high_water;\n// zmemzero(s->window + s->high_water, (unsigned)init);\n// s->high_water += init;\n// }\n// }\n//\n// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,\n// \"not enough room for search\");\n}\n\n/* ===========================================================================\n * Copy without compression as much as possible from the input stream, return\n * the current block state.\n * This function does not insert new strings in the dictionary since\n * uncompressible data is probably not useful. This function is used\n * only for the level=0 compression option.\n * NOTE: this function should be optimized to avoid extra copying from\n * window to pending_buf.\n */\nfunction deflate_stored(s, flush) {\n /* Stored blocks are limited to 0xffff bytes, pending_buf is limited\n * to pending_buf_size, and each stored block has a 5 byte header:\n */\n var max_block_size = 0xffff;\n\n if (max_block_size > s.pending_buf_size - 5) {\n max_block_size = s.pending_buf_size - 5;\n }\n\n /* Copy as much as possible from input to output: */\n for (;;) {\n /* Fill the window as much as possible: */\n if (s.lookahead <= 1) {\n\n //Assert(s->strstart < s->w_size+MAX_DIST(s) ||\n // s->block_start >= (long)s->w_size, \"slide too late\");\n// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||\n// s.block_start >= s.w_size)) {\n// throw new Error(\"slide too late\");\n// }\n\n fill_window(s);\n if (s.lookahead === 0 && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n\n if (s.lookahead === 0) {\n break;\n }\n /* flush the current block */\n }\n //Assert(s->block_start >= 0L, \"block gone\");\n// if (s.block_start < 0) throw new Error(\"block gone\");\n\n s.strstart += s.lookahead;\n s.lookahead = 0;\n\n /* Emit a stored block if pending_buf will be full: */\n var max_start = s.block_start + max_block_size;\n\n if (s.strstart === 0 || s.strstart >= max_start) {\n /* strstart == 0 is possible when wraparound on 16-bit machine */\n s.lookahead = s.strstart - max_start;\n s.strstart = max_start;\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n\n\n }\n /* Flush if we may have to slide, otherwise block_start may become\n * negative and the data will be gone:\n */\n if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n\n s.insert = 0;\n\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n\n if (s.strstart > s.block_start) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_NEED_MORE;\n}\n\n/* ===========================================================================\n * Compress as much as possible from the input stream, return the current\n * block state.\n * This function does not perform lazy evaluation of matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\nfunction deflate_fast(s, flush) {\n var hash_head; /* head of the hash chain */\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) {\n break; /* flush the current block */\n }\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n * At this point we have always match_length < MIN_MATCH\n */\n if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n }\n if (s.match_length >= MIN_MATCH) {\n // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only\n\n /*** _tr_tally_dist(s, s.strstart - s.match_start,\n s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n\n /* Insert new strings in the hash table only if the match length\n * is not too large. This saves time but degrades compression.\n */\n if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {\n s.match_length--; /* string at strstart already in table */\n do {\n s.strstart++;\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n * always MIN_MATCH bytes ahead.\n */\n } while (--s.match_length !== 0);\n s.strstart++;\n } else\n {\n s.strstart += s.match_length;\n s.match_length = 0;\n s.ins_h = s.window[s.strstart];\n /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;\n\n//#if MIN_MATCH != 3\n// Call UPDATE_HASH() MIN_MATCH-3 more times\n//#endif\n /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not\n * matter since it will be recomputed at next deflate call.\n */\n }\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s.window[s.strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\nfunction deflate_slow(s, flush) {\n var hash_head; /* head of hash chain */\n var bflush; /* set if current block must be flushed */\n\n var max_insert;\n\n /* Process the input block. */\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n */\n s.prev_length = s.match_length;\n s.prev_match = s.match_start;\n s.match_length = MIN_MATCH - 1;\n\n if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&\n s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n\n if (s.match_length <= 5 &&\n (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {\n\n /* If prev_match is also MIN_MATCH, match_start is garbage\n * but we will ignore the current match anyway.\n */\n s.match_length = MIN_MATCH - 1;\n }\n }\n /* If there was a match at the previous step and the current\n * match is not better, output the previous match:\n */\n if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\n max_insert = s.strstart + s.lookahead - MIN_MATCH;\n /* Do not insert strings in hash table beyond this. */\n\n //check_match(s, s.strstart-1, s.prev_match, s.prev_length);\n\n /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,\n s.prev_length - MIN_MATCH, bflush);***/\n bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);\n /* Insert in hash table all strings up to the end of the match.\n * strstart-1 and strstart are already inserted. If there is not\n * enough lookahead, the last two strings are not inserted in\n * the hash table.\n */\n s.lookahead -= s.prev_length - 1;\n s.prev_length -= 2;\n do {\n if (++s.strstart <= max_insert) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n } while (--s.prev_length !== 0);\n s.match_available = 0;\n s.match_length = MIN_MATCH - 1;\n s.strstart++;\n\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n } else if (s.match_available) {\n /* If there was no match at the previous position, output a\n * single literal. If there was a match but the current match\n * is longer, truncate the previous match to a single literal.\n */\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n if (bflush) {\n /*** FLUSH_BLOCK_ONLY(s, 0) ***/\n flush_block_only(s, false);\n /***/\n }\n s.strstart++;\n s.lookahead--;\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n } else {\n /* There is no previous match to compare with, wait for\n * the next step to decide.\n */\n s.match_available = 1;\n s.strstart++;\n s.lookahead--;\n }\n }\n //Assert (flush != Z_NO_FLUSH, \"no flush?\");\n if (s.match_available) {\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n s.match_available = 0;\n }\n s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_BLOCK_DONE;\n}\n\n\n/* ===========================================================================\n * For Z_RLE, simply look for runs of bytes, generate matches only of distance\n * one. Do not maintain a hash table. (It will be regenerated if this run of\n * deflate switches away from Z_RLE.)\n */\nfunction deflate_rle(s, flush) {\n var bflush; /* set if current block must be flushed */\n var prev; /* byte at distance one to match */\n var scan, strend; /* scan goes up to strend for length of run */\n\n var _win = s.window;\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the longest run, plus one for the unrolled loop.\n */\n if (s.lookahead <= MAX_MATCH) {\n fill_window(s);\n if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* See how many times the previous byte repeats */\n s.match_length = 0;\n if (s.lookahead >= MIN_MATCH && s.strstart > 0) {\n scan = s.strstart - 1;\n prev = _win[scan];\n if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n strend = s.strstart + MAX_MATCH;\n do {\n /*jshint noempty:false*/\n } while (prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n scan < strend);\n s.match_length = MAX_MATCH - (strend - scan);\n if (s.match_length > s.lookahead) {\n s.match_length = s.lookahead;\n }\n }\n //Assert(scan <= s->window+(uInt)(s->window_size-1), \"wild scan\");\n }\n\n /* Emit match if have run of MIN_MATCH or longer, else emit literal */\n if (s.match_length >= MIN_MATCH) {\n //check_match(s, s.strstart, s.strstart - 1, s.match_length);\n\n /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n s.strstart += s.match_length;\n s.match_length = 0;\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.\n * (It will be regenerated if this run of deflate switches away from Huffman.)\n */\nfunction deflate_huff(s, flush) {\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we have a literal to write. */\n if (s.lookahead === 0) {\n fill_window(s);\n if (s.lookahead === 0) {\n if (flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n break; /* flush the current block */\n }\n }\n\n /* Output a literal byte */\n s.match_length = 0;\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n s.lookahead--;\n s.strstart++;\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\nfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\n this.good_length = good_length;\n this.max_lazy = max_lazy;\n this.nice_length = nice_length;\n this.max_chain = max_chain;\n this.func = func;\n}\n\nvar configuration_table;\n\nconfiguration_table = [\n /* good lazy nice chain */\n new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */\n new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */\n new Config(4, 5, 16, 8, deflate_fast), /* 2 */\n new Config(4, 6, 32, 32, deflate_fast), /* 3 */\n\n new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */\n new Config(8, 16, 32, 32, deflate_slow), /* 5 */\n new Config(8, 16, 128, 128, deflate_slow), /* 6 */\n new Config(8, 32, 128, 256, deflate_slow), /* 7 */\n new Config(32, 128, 258, 1024, deflate_slow), /* 8 */\n new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */\n];\n\n\n/* ===========================================================================\n * Initialize the \"longest match\" routines for a new zlib stream\n */\nfunction lm_init(s) {\n s.window_size = 2 * s.w_size;\n\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n\n /* Set the default configuration parameters:\n */\n s.max_lazy_match = configuration_table[s.level].max_lazy;\n s.good_match = configuration_table[s.level].good_length;\n s.nice_match = configuration_table[s.level].nice_length;\n s.max_chain_length = configuration_table[s.level].max_chain;\n\n s.strstart = 0;\n s.block_start = 0;\n s.lookahead = 0;\n s.insert = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n s.ins_h = 0;\n}\n\n\nfunction DeflateState() {\n this.strm = null; /* pointer back to this zlib stream */\n this.status = 0; /* as the name implies */\n this.pending_buf = null; /* output still pending */\n this.pending_buf_size = 0; /* size of pending_buf */\n this.pending_out = 0; /* next pending byte to output to the stream */\n this.pending = 0; /* nb of bytes in the pending buffer */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.gzhead = null; /* gzip header information to write */\n this.gzindex = 0; /* where in extra, name, or comment */\n this.method = Z_DEFLATED; /* can only be DEFLATED */\n this.last_flush = -1; /* value of flush param for previous deflate call */\n\n this.w_size = 0; /* LZ77 window size (32K by default) */\n this.w_bits = 0; /* log2(w_size) (8..16) */\n this.w_mask = 0; /* w_size - 1 */\n\n this.window = null;\n /* Sliding window. Input bytes are read into the second half of the window,\n * and move to the first half later to keep a dictionary of at least wSize\n * bytes. With this organization, matches are limited to a distance of\n * wSize-MAX_MATCH bytes, but this ensures that IO is always\n * performed with a length multiple of the block size.\n */\n\n this.window_size = 0;\n /* Actual size of window: 2*wSize, except when the user input buffer\n * is directly used as sliding window.\n */\n\n this.prev = null;\n /* Link to older string with same hash index. To limit the size of this\n * array to 64K, this link is maintained only for the last 32K strings.\n * An index in this array is thus a window index modulo 32K.\n */\n\n this.head = null; /* Heads of the hash chains or NIL. */\n\n this.ins_h = 0; /* hash index of string to be inserted */\n this.hash_size = 0; /* number of elements in hash table */\n this.hash_bits = 0; /* log2(hash_size) */\n this.hash_mask = 0; /* hash_size-1 */\n\n this.hash_shift = 0;\n /* Number of bits by which ins_h must be shifted at each input\n * step. It must be such that after MIN_MATCH steps, the oldest\n * byte no longer takes part in the hash key, that is:\n * hash_shift * MIN_MATCH >= hash_bits\n */\n\n this.block_start = 0;\n /* Window position at the beginning of the current output block. Gets\n * negative when the window is moved backwards.\n */\n\n this.match_length = 0; /* length of best match */\n this.prev_match = 0; /* previous match */\n this.match_available = 0; /* set if previous match exists */\n this.strstart = 0; /* start of string to insert */\n this.match_start = 0; /* start of matching string */\n this.lookahead = 0; /* number of valid bytes ahead in window */\n\n this.prev_length = 0;\n /* Length of the best match at previous step. Matches not greater than this\n * are discarded. This is used in the lazy match evaluation.\n */\n\n this.max_chain_length = 0;\n /* To speed up deflation, hash chains are never searched beyond this\n * length. A higher limit improves compression ratio but degrades the\n * speed.\n */\n\n this.max_lazy_match = 0;\n /* Attempt to find a better match only when the current match is strictly\n * smaller than this value. This mechanism is used only for compression\n * levels >= 4.\n */\n // That's alias to max_lazy_match, don't use directly\n //this.max_insert_length = 0;\n /* Insert new strings in the hash table only if the match length is not\n * greater than this length. This saves time but degrades compression.\n * max_insert_length is used only for compression levels <= 3.\n */\n\n this.level = 0; /* compression level (1..9) */\n this.strategy = 0; /* favor or force Huffman coding*/\n\n this.good_match = 0;\n /* Use a faster search when the previous match is longer than this */\n\n this.nice_match = 0; /* Stop searching when current match exceeds this */\n\n /* used by trees.c: */\n\n /* Didn't use ct_data typedef below to suppress compiler warning */\n\n // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */\n // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */\n // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */\n\n // Use flat array of DOUBLE size, with interleaved fata,\n // because JS does not support effective\n this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2);\n this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2);\n this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2);\n zero(this.dyn_ltree);\n zero(this.dyn_dtree);\n zero(this.bl_tree);\n\n this.l_desc = null; /* desc. for literal tree */\n this.d_desc = null; /* desc. for distance tree */\n this.bl_desc = null; /* desc. for bit length tree */\n\n //ush bl_count[MAX_BITS+1];\n this.bl_count = new utils.Buf16(MAX_BITS + 1);\n /* number of codes at each bit length for an optimal tree */\n\n //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */\n this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */\n zero(this.heap);\n\n this.heap_len = 0; /* number of elements in the heap */\n this.heap_max = 0; /* element of largest frequency */\n /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n * The same heap array is used to build all trees.\n */\n\n this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1];\n zero(this.depth);\n /* Depth of each subtree used as tie breaker for trees of equal frequency\n */\n\n this.l_buf = 0; /* buffer index for literals or lengths */\n\n this.lit_bufsize = 0;\n /* Size of match buffer for literals/lengths. There are 4 reasons for\n * limiting lit_bufsize to 64K:\n * - frequencies can be kept in 16 bit counters\n * - if compression is not successful for the first block, all input\n * data is still in the window so we can still emit a stored block even\n * when input comes from standard input. (This can also be done for\n * all blocks if lit_bufsize is not greater than 32K.)\n * - if compression is not successful for a file smaller than 64K, we can\n * even emit a stored file instead of a stored block (saving 5 bytes).\n * This is applicable only for zip (not gzip or zlib).\n * - creating new Huffman trees less frequently may not provide fast\n * adaptation to changes in the input data statistics. (Take for\n * example a binary file with poorly compressible code followed by\n * a highly compressible string table.) Smaller buffer sizes give\n * fast adaptation but have of course the overhead of transmitting\n * trees more frequently.\n * - I can't count above 4\n */\n\n this.last_lit = 0; /* running index in l_buf */\n\n this.d_buf = 0;\n /* Buffer index for distances. To simplify the code, d_buf and l_buf have\n * the same number of elements. To use different lengths, an extra flag\n * array would be necessary.\n */\n\n this.opt_len = 0; /* bit length of current block with optimal trees */\n this.static_len = 0; /* bit length of current block with static trees */\n this.matches = 0; /* number of string matches in current block */\n this.insert = 0; /* bytes at end of window left to insert */\n\n\n this.bi_buf = 0;\n /* Output buffer. bits are inserted starting at the bottom (least\n * significant bits).\n */\n this.bi_valid = 0;\n /* Number of valid bits in bi_buf. All bits above the last valid bit\n * are always zero.\n */\n\n // Used for window memory init. We safely ignore it for JS. That makes\n // sense only for pointers and memory check tools.\n //this.high_water = 0;\n /* High water mark offset in window for initialized bytes -- bytes above\n * this are set to zero in order to avoid memory check warnings when\n * longest match routines access bytes past the input. This is then\n * updated to the new high water mark.\n */\n}\n\n\nfunction deflateResetKeep(strm) {\n var s;\n\n if (!strm || !strm.state) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.total_in = strm.total_out = 0;\n strm.data_type = Z_UNKNOWN;\n\n s = strm.state;\n s.pending = 0;\n s.pending_out = 0;\n\n if (s.wrap < 0) {\n s.wrap = -s.wrap;\n /* was made negative by deflate(..., Z_FINISH); */\n }\n s.status = (s.wrap ? INIT_STATE : BUSY_STATE);\n strm.adler = (s.wrap === 2) ?\n 0 // crc32(0, Z_NULL, 0)\n :\n 1; // adler32(0, Z_NULL, 0)\n s.last_flush = Z_NO_FLUSH;\n trees._tr_init(s);\n return Z_OK;\n}\n\n\nfunction deflateReset(strm) {\n var ret = deflateResetKeep(strm);\n if (ret === Z_OK) {\n lm_init(strm.state);\n }\n return ret;\n}\n\n\nfunction deflateSetHeader(strm, head) {\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }\n strm.state.gzhead = head;\n return Z_OK;\n}\n\n\nfunction deflateInit2(strm, level, method, windowBits, memLevel, strategy) {\n if (!strm) { // === Z_NULL\n return Z_STREAM_ERROR;\n }\n var wrap = 1;\n\n if (level === Z_DEFAULT_COMPRESSION) {\n level = 6;\n }\n\n if (windowBits < 0) { /* suppress zlib wrapper */\n wrap = 0;\n windowBits = -windowBits;\n }\n\n else if (windowBits > 15) {\n wrap = 2; /* write gzip wrapper instead */\n windowBits -= 16;\n }\n\n\n if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||\n windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||\n strategy < 0 || strategy > Z_FIXED) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n\n if (windowBits === 8) {\n windowBits = 9;\n }\n /* until 256-byte window bug fixed */\n\n var s = new DeflateState();\n\n strm.state = s;\n s.strm = strm;\n\n s.wrap = wrap;\n s.gzhead = null;\n s.w_bits = windowBits;\n s.w_size = 1 << s.w_bits;\n s.w_mask = s.w_size - 1;\n\n s.hash_bits = memLevel + 7;\n s.hash_size = 1 << s.hash_bits;\n s.hash_mask = s.hash_size - 1;\n s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);\n\n s.window = new utils.Buf8(s.w_size * 2);\n s.head = new utils.Buf16(s.hash_size);\n s.prev = new utils.Buf16(s.w_size);\n\n // Don't need mem init magic for JS.\n //s.high_water = 0; /* nothing written to s->window yet */\n\n s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */\n\n s.pending_buf_size = s.lit_bufsize * 4;\n\n //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);\n //s->pending_buf = (uchf *) overlay;\n s.pending_buf = new utils.Buf8(s.pending_buf_size);\n\n // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)\n //s->d_buf = overlay + s->lit_bufsize/sizeof(ush);\n s.d_buf = 1 * s.lit_bufsize;\n\n //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;\n s.l_buf = (1 + 2) * s.lit_bufsize;\n\n s.level = level;\n s.strategy = strategy;\n s.method = method;\n\n return deflateReset(strm);\n}\n\nfunction deflateInit(strm, level) {\n return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);\n}\n\n\nfunction deflate(strm, flush) {\n var old_flush, s;\n var beg, val; // for gzip header write only\n\n if (!strm || !strm.state ||\n flush > Z_BLOCK || flush < 0) {\n return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;\n }\n\n s = strm.state;\n\n if (!strm.output ||\n (!strm.input && strm.avail_in !== 0) ||\n (s.status === FINISH_STATE && flush !== Z_FINISH)) {\n return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);\n }\n\n s.strm = strm; /* just in case */\n old_flush = s.last_flush;\n s.last_flush = flush;\n\n /* Write the header */\n if (s.status === INIT_STATE) {\n\n if (s.wrap === 2) { // GZIP header\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n put_byte(s, 31);\n put_byte(s, 139);\n put_byte(s, 8);\n if (!s.gzhead) { // s->gzhead == Z_NULL\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, OS_CODE);\n s.status = BUSY_STATE;\n }\n else {\n put_byte(s, (s.gzhead.text ? 1 : 0) +\n (s.gzhead.hcrc ? 2 : 0) +\n (!s.gzhead.extra ? 0 : 4) +\n (!s.gzhead.name ? 0 : 8) +\n (!s.gzhead.comment ? 0 : 16)\n );\n put_byte(s, s.gzhead.time & 0xff);\n put_byte(s, (s.gzhead.time >> 8) & 0xff);\n put_byte(s, (s.gzhead.time >> 16) & 0xff);\n put_byte(s, (s.gzhead.time >> 24) & 0xff);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, s.gzhead.os & 0xff);\n if (s.gzhead.extra && s.gzhead.extra.length) {\n put_byte(s, s.gzhead.extra.length & 0xff);\n put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);\n }\n if (s.gzhead.hcrc) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);\n }\n s.gzindex = 0;\n s.status = EXTRA_STATE;\n }\n }\n else // DEFLATE header\n {\n var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;\n var level_flags = -1;\n\n if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {\n level_flags = 0;\n } else if (s.level < 6) {\n level_flags = 1;\n } else if (s.level === 6) {\n level_flags = 2;\n } else {\n level_flags = 3;\n }\n header |= (level_flags << 6);\n if (s.strstart !== 0) { header |= PRESET_DICT; }\n header += 31 - (header % 31);\n\n s.status = BUSY_STATE;\n putShortMSB(s, header);\n\n /* Save the adler32 of the preset dictionary: */\n if (s.strstart !== 0) {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n strm.adler = 1; // adler32(0L, Z_NULL, 0);\n }\n }\n\n//#ifdef GZIP\n if (s.status === EXTRA_STATE) {\n if (s.gzhead.extra/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n\n while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n break;\n }\n }\n put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);\n s.gzindex++;\n }\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (s.gzindex === s.gzhead.extra.length) {\n s.gzindex = 0;\n s.status = NAME_STATE;\n }\n }\n else {\n s.status = NAME_STATE;\n }\n }\n if (s.status === NAME_STATE) {\n if (s.gzhead.name/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.name.length) {\n val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.gzindex = 0;\n s.status = COMMENT_STATE;\n }\n }\n else {\n s.status = COMMENT_STATE;\n }\n }\n if (s.status === COMMENT_STATE) {\n if (s.gzhead.comment/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.comment.length) {\n val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.status = HCRC_STATE;\n }\n }\n else {\n s.status = HCRC_STATE;\n }\n }\n if (s.status === HCRC_STATE) {\n if (s.gzhead.hcrc) {\n if (s.pending + 2 > s.pending_buf_size) {\n flush_pending(strm);\n }\n if (s.pending + 2 <= s.pending_buf_size) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n s.status = BUSY_STATE;\n }\n }\n else {\n s.status = BUSY_STATE;\n }\n }\n//#endif\n\n /* Flush as much pending output as possible */\n if (s.pending !== 0) {\n flush_pending(strm);\n if (strm.avail_out === 0) {\n /* Since avail_out is 0, deflate will be called again with\n * more output space, but possibly with both pending and\n * avail_in equal to zero. There won't be anything to do,\n * but this is not an error situation so make sure we\n * return OK instead of BUF_ERROR at next call of deflate:\n */\n s.last_flush = -1;\n return Z_OK;\n }\n\n /* Make sure there is something to do and avoid duplicate consecutive\n * flushes. For repeated and useless calls with Z_FINISH, we keep\n * returning Z_STREAM_END instead of Z_BUF_ERROR.\n */\n } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&\n flush !== Z_FINISH) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* User must not provide more input after the first FINISH: */\n if (s.status === FINISH_STATE && strm.avail_in !== 0) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* Start a new block or continue the current one.\n */\n if (strm.avail_in !== 0 || s.lookahead !== 0 ||\n (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {\n var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :\n (s.strategy === Z_RLE ? deflate_rle(s, flush) :\n configuration_table[s.level].func(s, flush));\n\n if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {\n s.status = FINISH_STATE;\n }\n if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n if (strm.avail_out === 0) {\n s.last_flush = -1;\n /* avoid BUF_ERROR next call, see above */\n }\n return Z_OK;\n /* If flush != Z_NO_FLUSH && avail_out == 0, the next call\n * of deflate should use the same flush parameter to make sure\n * that the flush is complete. So we don't have to output an\n * empty block here, this will be done at next call. This also\n * ensures that for a very small output buffer, we emit at most\n * one empty block.\n */\n }\n if (bstate === BS_BLOCK_DONE) {\n if (flush === Z_PARTIAL_FLUSH) {\n trees._tr_align(s);\n }\n else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */\n\n trees._tr_stored_block(s, 0, 0, false);\n /* For a full flush, this empty block will be recognized\n * as a special marker by inflate_sync().\n */\n if (flush === Z_FULL_FLUSH) {\n /*** CLEAR_HASH(s); ***/ /* forget history */\n zero(s.head); // Fill with NIL (= 0);\n\n if (s.lookahead === 0) {\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n }\n }\n flush_pending(strm);\n if (strm.avail_out === 0) {\n s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */\n return Z_OK;\n }\n }\n }\n //Assert(strm->avail_out > 0, \"bug2\");\n //if (strm.avail_out <= 0) { throw new Error(\"bug2\");}\n\n if (flush !== Z_FINISH) { return Z_OK; }\n if (s.wrap <= 0) { return Z_STREAM_END; }\n\n /* Write the trailer */\n if (s.wrap === 2) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n put_byte(s, (strm.adler >> 16) & 0xff);\n put_byte(s, (strm.adler >> 24) & 0xff);\n put_byte(s, strm.total_in & 0xff);\n put_byte(s, (strm.total_in >> 8) & 0xff);\n put_byte(s, (strm.total_in >> 16) & 0xff);\n put_byte(s, (strm.total_in >> 24) & 0xff);\n }\n else\n {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n\n flush_pending(strm);\n /* If avail_out is zero, the application will call deflate again\n * to flush the rest.\n */\n if (s.wrap > 0) { s.wrap = -s.wrap; }\n /* write the trailer only once! */\n return s.pending !== 0 ? Z_OK : Z_STREAM_END;\n}\n\nfunction deflateEnd(strm) {\n var status;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n status = strm.state.status;\n if (status !== INIT_STATE &&\n status !== EXTRA_STATE &&\n status !== NAME_STATE &&\n status !== COMMENT_STATE &&\n status !== HCRC_STATE &&\n status !== BUSY_STATE &&\n status !== FINISH_STATE\n ) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.state = null;\n\n return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;\n}\n\n\n/* =========================================================================\n * Initializes the compression dictionary from the given byte\n * sequence without producing any compressed output.\n */\nfunction deflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var s;\n var str, n;\n var wrap;\n var avail;\n var next;\n var input;\n var tmpDict;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n s = strm.state;\n wrap = s.wrap;\n\n if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {\n return Z_STREAM_ERROR;\n }\n\n /* when using zlib wrappers, compute Adler-32 for provided dictionary */\n if (wrap === 1) {\n /* adler32(strm->adler, dictionary, dictLength); */\n strm.adler = adler32(strm.adler, dictionary, dictLength, 0);\n }\n\n s.wrap = 0; /* avoid computing Adler-32 in read_buf */\n\n /* if dictionary would fill window, just replace the history */\n if (dictLength >= s.w_size) {\n if (wrap === 0) { /* already empty otherwise */\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n /* use the tail */\n // dictionary = dictionary.slice(dictLength - s.w_size);\n tmpDict = new utils.Buf8(s.w_size);\n utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);\n dictionary = tmpDict;\n dictLength = s.w_size;\n }\n /* insert dictionary into window and hash */\n avail = strm.avail_in;\n next = strm.next_in;\n input = strm.input;\n strm.avail_in = dictLength;\n strm.next_in = 0;\n strm.input = dictionary;\n fill_window(s);\n while (s.lookahead >= MIN_MATCH) {\n str = s.strstart;\n n = s.lookahead - (MIN_MATCH - 1);\n do {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n\n s.head[s.ins_h] = str;\n str++;\n } while (--n);\n s.strstart = str;\n s.lookahead = MIN_MATCH - 1;\n fill_window(s);\n }\n s.strstart += s.lookahead;\n s.block_start = s.strstart;\n s.insert = s.lookahead;\n s.lookahead = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n strm.next_in = next;\n strm.input = input;\n strm.avail_in = avail;\n s.wrap = wrap;\n return Z_OK;\n}\n\n\nexports.deflateInit = deflateInit;\nexports.deflateInit2 = deflateInit2;\nexports.deflateReset = deflateReset;\nexports.deflateResetKeep = deflateResetKeep;\nexports.deflateSetHeader = deflateSetHeader;\nexports.deflate = deflate;\nexports.deflateEnd = deflateEnd;\nexports.deflateSetDictionary = deflateSetDictionary;\nexports.deflateInfo = 'pako deflate (from Nodeca project)';\n\n/* Not implemented\nexports.deflateBound = deflateBound;\nexports.deflateCopy = deflateCopy;\nexports.deflateParams = deflateParams;\nexports.deflatePending = deflatePending;\nexports.deflatePrime = deflatePrime;\nexports.deflateTune = deflateTune;\n*/\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction GZheader() {\n /* true if compressed data believed to be text */\n this.text = 0;\n /* modification time */\n this.time = 0;\n /* extra flags (not used when writing a gzip file) */\n this.xflags = 0;\n /* operating system */\n this.os = 0;\n /* pointer to extra field or Z_NULL if none */\n this.extra = null;\n /* extra field length (valid if extra != Z_NULL) */\n this.extra_len = 0; // Actually, we don't need it in JS,\n // but leave for few code modifications\n\n //\n // Setup limits is not necessary because in js we should not preallocate memory\n // for inflate use constant limit in 65536 bytes\n //\n\n /* space at extra (only when reading header) */\n // this.extra_max = 0;\n /* pointer to zero-terminated file name or Z_NULL */\n this.name = '';\n /* space at name (only when reading header) */\n // this.name_max = 0;\n /* pointer to zero-terminated comment or Z_NULL */\n this.comment = '';\n /* space at comment (only when reading header) */\n // this.comm_max = 0;\n /* true if there was or will be a header crc */\n this.hcrc = 0;\n /* true when done reading gzip header (not used when writing a gzip file) */\n this.done = false;\n}\n\nmodule.exports = GZheader;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// See state defs from inflate.js\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\n\n/*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\nmodule.exports = function inflate_fast(strm, start) {\n var state;\n var _in; /* local strm.input */\n var last; /* have enough input while in < last */\n var _out; /* local strm.output */\n var beg; /* inflate()'s initial strm.output */\n var end; /* while out < end, enough space available */\n//#ifdef INFLATE_STRICT\n var dmax; /* maximum distance from zlib header */\n//#endif\n var wsize; /* window size or zero if not using window */\n var whave; /* valid bytes in the window */\n var wnext; /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n var s_window; /* allocated sliding window, if wsize != 0 */\n var hold; /* local strm.hold */\n var bits; /* local strm.bits */\n var lcode; /* local strm.lencode */\n var dcode; /* local strm.distcode */\n var lmask; /* mask for first level of length codes */\n var dmask; /* mask for first level of distance codes */\n var here; /* retrieved table entry */\n var op; /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n var len; /* match length, unused bytes */\n var dist; /* match distance */\n var from; /* where to copy match from */\n var from_source;\n\n\n var input, output; // JS specific, because we have no pointers\n\n /* copy state to local variables */\n state = strm.state;\n //here = state.here;\n _in = strm.next_in;\n input = strm.input;\n last = _in + (strm.avail_in - 5);\n _out = strm.next_out;\n output = strm.output;\n beg = _out - (start - strm.avail_out);\n end = _out + (strm.avail_out - 257);\n//#ifdef INFLATE_STRICT\n dmax = state.dmax;\n//#endif\n wsize = state.wsize;\n whave = state.whave;\n wnext = state.wnext;\n s_window = state.window;\n hold = state.hold;\n bits = state.bits;\n lcode = state.lencode;\n dcode = state.distcode;\n lmask = (1 << state.lenbits) - 1;\n dmask = (1 << state.distbits) - 1;\n\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top:\n do {\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n\n here = lcode[hold & lmask];\n\n dolen:\n for (;;) { // Goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n if (op === 0) { /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n output[_out++] = here & 0xffff/*here.val*/;\n }\n else if (op & 16) { /* length base */\n len = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n len += hold & ((1 << op) - 1);\n hold >>>= op;\n bits -= op;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", len));\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = dcode[hold & dmask];\n\n dodist:\n for (;;) { // goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n\n if (op & 16) { /* distance base */\n dist = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n }\n dist += hold & ((1 << op) - 1);\n//#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n//#endif\n hold >>>= op;\n bits -= op;\n //Tracevv((stderr, \"inflate: distance %u\\n\", dist));\n op = _out - beg; /* max distance in output */\n if (dist > op) { /* see if copy from window */\n op = dist - op; /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// if (len <= op - whave) {\n// do {\n// output[_out++] = 0;\n// } while (--len);\n// continue top;\n// }\n// len -= op - whave;\n// do {\n// output[_out++] = 0;\n// } while (--op > whave);\n// if (op === 0) {\n// from = _out - dist;\n// do {\n// output[_out++] = output[from++];\n// } while (--len);\n// continue top;\n// }\n//#endif\n }\n from = 0; // window index\n from_source = s_window;\n if (wnext === 0) { /* very common case */\n from += wsize - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n else if (wnext < op) { /* wrap around window */\n from += wsize + wnext - op;\n op -= wnext;\n if (op < len) { /* some from end of window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = 0;\n if (wnext < len) { /* some from start of window */\n op = wnext;\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n }\n else { /* contiguous in window */\n from += wnext - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n len -= 3;\n }\n if (len) {\n output[_out++] = from_source[from++];\n if (len > 1) {\n output[_out++] = from_source[from++];\n }\n }\n }\n else {\n from = _out - dist; /* copy direct from output */\n do { /* minimum length is three */\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n len -= 3;\n } while (len > 2);\n if (len) {\n output[_out++] = output[from++];\n if (len > 1) {\n output[_out++] = output[from++];\n }\n }\n }\n }\n else if ((op & 64) === 0) { /* 2nd level distance code */\n here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dodist;\n }\n else {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n }\n else if ((op & 64) === 0) { /* 2nd level length code */\n here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dolen;\n }\n else if (op & 32) { /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.mode = TYPE;\n break top;\n }\n else {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end);\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3;\n _in -= len;\n bits -= len << 3;\n hold &= (1 << bits) - 1;\n\n /* update state and return */\n strm.next_in = _in;\n strm.next_out = _out;\n strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n state.hold = hold;\n state.bits = bits;\n return;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar inflate_fast = require('./inffast');\nvar inflate_table = require('./inftrees');\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\n//var Z_NO_FLUSH = 0;\n//var Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\n//var Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\nvar Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\nvar Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n\n/* STATES ====================================================================*/\n/* ===========================================================================*/\n\n\nvar HEAD = 1; /* i: waiting for magic header */\nvar FLAGS = 2; /* i: waiting for method and flags (gzip) */\nvar TIME = 3; /* i: waiting for modification time (gzip) */\nvar OS = 4; /* i: waiting for extra flags and operating system (gzip) */\nvar EXLEN = 5; /* i: waiting for extra length (gzip) */\nvar EXTRA = 6; /* i: waiting for extra bytes (gzip) */\nvar NAME = 7; /* i: waiting for end of file name (gzip) */\nvar COMMENT = 8; /* i: waiting for end of comment (gzip) */\nvar HCRC = 9; /* i: waiting for header crc (gzip) */\nvar DICTID = 10; /* i: waiting for dictionary check value */\nvar DICT = 11; /* waiting for inflateSetDictionary() call */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\nvar TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */\nvar STORED = 14; /* i: waiting for stored size (length and complement) */\nvar COPY_ = 15; /* i/o: same as COPY below, but only first time in */\nvar COPY = 16; /* i/o: waiting for input or output to copy stored block */\nvar TABLE = 17; /* i: waiting for dynamic block table lengths */\nvar LENLENS = 18; /* i: waiting for code length code lengths */\nvar CODELENS = 19; /* i: waiting for length/lit and distance code lengths */\nvar LEN_ = 20; /* i: same as LEN below, but only first time in */\nvar LEN = 21; /* i: waiting for length/lit/eob code */\nvar LENEXT = 22; /* i: waiting for length extra bits */\nvar DIST = 23; /* i: waiting for distance code */\nvar DISTEXT = 24; /* i: waiting for distance extra bits */\nvar MATCH = 25; /* o: waiting for output space to copy string */\nvar LIT = 26; /* o: waiting for output space to write literal */\nvar CHECK = 27; /* i: waiting for 32-bit check value */\nvar LENGTH = 28; /* i: waiting for 32-bit length (gzip) */\nvar DONE = 29; /* finished check, done -- remain here until reset */\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar MEM = 31; /* got an inflate() memory error -- remain here until reset */\nvar SYNC = 32; /* looking for synchronization bytes to restart inflate() */\n\n/* ===========================================================================*/\n\n\n\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_WBITS = MAX_WBITS;\n\n\nfunction zswap32(q) {\n return (((q >>> 24) & 0xff) +\n ((q >>> 8) & 0xff00) +\n ((q & 0xff00) << 8) +\n ((q & 0xff) << 24));\n}\n\n\nfunction InflateState() {\n this.mode = 0; /* current inflate mode */\n this.last = false; /* true if processing last block */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.havedict = false; /* true if dictionary provided */\n this.flags = 0; /* gzip header method and flags (0 if zlib) */\n this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0; /* protected copy of check value */\n this.total = 0; /* protected copy of output count */\n // TODO: may be {}\n this.head = null; /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0; /* log base 2 of requested window size */\n this.wsize = 0; /* window size or zero if not using window */\n this.whave = 0; /* valid bytes in the window */\n this.wnext = 0; /* window write index */\n this.window = null; /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0; /* input bit accumulator */\n this.bits = 0; /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0; /* literal or length of data to copy */\n this.offset = 0; /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0; /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null; /* starting table for length/literal codes */\n this.distcode = null; /* starting table for distance codes */\n this.lenbits = 0; /* index bits for lencode */\n this.distbits = 0; /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0; /* number of code length code lengths */\n this.nlen = 0; /* number of length code lengths */\n this.ndist = 0; /* number of distance code lengths */\n this.have = 0; /* number of code lengths in lens[] */\n this.next = null; /* next available space in codes[] */\n\n this.lens = new utils.Buf16(320); /* temporary storage for code lengths */\n this.work = new utils.Buf16(288); /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */\n this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null; /* dynamic table for distance codes (JS specific) */\n this.sane = 0; /* if false, allow invalid distance too far */\n this.back = 0; /* bits back of last unprocessed length/lit */\n this.was = 0; /* initial length of match */\n}\n\nfunction inflateResetKeep(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n strm.total_in = strm.total_out = state.total = 0;\n strm.msg = ''; /*Z_NULL*/\n if (state.wrap) { /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1;\n }\n state.mode = HEAD;\n state.last = 0;\n state.havedict = 0;\n state.dmax = 32768;\n state.head = null/*Z_NULL*/;\n state.hold = 0;\n state.bits = 0;\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);\n state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);\n\n state.sane = 1;\n state.back = -1;\n //Tracev((stderr, \"inflate: reset\\n\"));\n return Z_OK;\n}\n\nfunction inflateReset(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n state.wsize = 0;\n state.whave = 0;\n state.wnext = 0;\n return inflateResetKeep(strm);\n\n}\n\nfunction inflateReset2(strm, windowBits) {\n var wrap;\n var state;\n\n /* get the state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0;\n windowBits = -windowBits;\n }\n else {\n wrap = (windowBits >> 4) + 1;\n if (windowBits < 48) {\n windowBits &= 15;\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR;\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null;\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap;\n state.wbits = windowBits;\n return inflateReset(strm);\n}\n\nfunction inflateInit2(strm, windowBits) {\n var ret;\n var state;\n\n if (!strm) { return Z_STREAM_ERROR; }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n state = new InflateState();\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\\n\"));\n strm.state = state;\n state.window = null/*Z_NULL*/;\n ret = inflateReset2(strm, windowBits);\n if (ret !== Z_OK) {\n strm.state = null/*Z_NULL*/;\n }\n return ret;\n}\n\nfunction inflateInit(strm) {\n return inflateInit2(strm, DEF_WBITS);\n}\n\n\n/*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\nvar virgin = true;\n\nvar lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\nfunction fixedtables(state) {\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n var sym;\n\n lenfix = new utils.Buf32(512);\n distfix = new utils.Buf32(32);\n\n /* literal/length table */\n sym = 0;\n while (sym < 144) { state.lens[sym++] = 8; }\n while (sym < 256) { state.lens[sym++] = 9; }\n while (sym < 280) { state.lens[sym++] = 7; }\n while (sym < 288) { state.lens[sym++] = 8; }\n\n inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });\n\n /* distance table */\n sym = 0;\n while (sym < 32) { state.lens[sym++] = 5; }\n\n inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });\n\n /* do this just once */\n virgin = false;\n }\n\n state.lencode = lenfix;\n state.lenbits = 9;\n state.distcode = distfix;\n state.distbits = 5;\n}\n\n\n/*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\nfunction updatewindow(strm, src, end, copy) {\n var dist;\n var state = strm.state;\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits;\n state.wnext = 0;\n state.whave = 0;\n\n state.window = new utils.Buf8(state.wsize);\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);\n state.wnext = 0;\n state.whave = state.wsize;\n }\n else {\n dist = state.wsize - state.wnext;\n if (dist > copy) {\n dist = copy;\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n utils.arraySet(state.window, src, end - copy, dist, state.wnext);\n copy -= dist;\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n utils.arraySet(state.window, src, end - copy, copy, 0);\n state.wnext = copy;\n state.whave = state.wsize;\n }\n else {\n state.wnext += dist;\n if (state.wnext === state.wsize) { state.wnext = 0; }\n if (state.whave < state.wsize) { state.whave += dist; }\n }\n }\n return 0;\n}\n\nfunction inflate(strm, flush) {\n var state;\n var input, output; // input/output buffers\n var next; /* next input INDEX */\n var put; /* next output INDEX */\n var have, left; /* available input and output */\n var hold; /* bit buffer */\n var bits; /* bits in bit buffer */\n var _in, _out; /* save starting available input and output */\n var copy; /* number of stored or match bytes to copy */\n var from; /* where to copy match bytes from */\n var from_source;\n var here = 0; /* current decoding table entry */\n var here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n //var last; /* parent table entry */\n var last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n var len; /* length to copy for repeats, bits to drop */\n var ret; /* return code */\n var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */\n var opts;\n\n var n; // temporary var for NEED_BITS\n\n var order = /* permutation of code lengths */\n [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];\n\n\n if (!strm || !strm.state || !strm.output ||\n (!strm.input && strm.avail_in !== 0)) {\n return Z_STREAM_ERROR;\n }\n\n state = strm.state;\n if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */\n\n\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n _in = have;\n _out = left;\n ret = Z_OK;\n\n inf_leave: // goto emulation\n for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */\n state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = FLAGS;\n break;\n }\n state.flags = 0; /* expect zlib header */\n if (state.head) {\n state.head.done = false;\n }\n if (!(state.wrap & 1) || /* check if zlib header allowed */\n (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n strm.msg = 'incorrect header check';\n state.mode = BAD;\n break;\n }\n if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n len = (hold & 0x0f)/*BITS(4)*/ + 8;\n if (state.wbits === 0) {\n state.wbits = len;\n }\n else if (len > state.wbits) {\n strm.msg = 'invalid window size';\n state.mode = BAD;\n break;\n }\n state.dmax = 1 << len;\n //Tracev((stderr, \"inflate: zlib header ok\\n\"));\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = hold & 0x200 ? DICTID : TYPE;\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n break;\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.flags = hold;\n if ((state.flags & 0xff) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set';\n state.mode = BAD;\n break;\n }\n if (state.head) {\n state.head.text = ((hold >> 8) & 1);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = TIME;\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.time = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n hbuf[2] = (hold >>> 16) & 0xff;\n hbuf[3] = (hold >>> 24) & 0xff;\n state.check = crc32(state.check, hbuf, 4, 0);\n //===\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = OS;\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.xflags = (hold & 0xff);\n state.head.os = (hold >> 8);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = EXLEN;\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length = hold;\n if (state.head) {\n state.head.extra_len = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n else if (state.head) {\n state.head.extra = null/*Z_NULL*/;\n }\n state.mode = EXTRA;\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length;\n if (copy > have) { copy = have; }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length;\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Array(state.head.extra_len);\n }\n utils.arraySet(\n state.head.extra,\n input,\n next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n copy,\n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len\n );\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n state.length -= copy;\n }\n if (state.length) { break inf_leave; }\n }\n state.length = 0;\n state.mode = NAME;\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.name_max*/)) {\n state.head.name += String.fromCharCode(len);\n }\n } while (len && copy < have);\n\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.name = null;\n }\n state.length = 0;\n state.mode = COMMENT;\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.comm_max*/)) {\n state.head.comment += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.comment = null;\n }\n state.mode = HCRC;\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n if (state.head) {\n state.head.hcrc = ((state.flags >> 9) & 1);\n state.head.done = true;\n }\n strm.adler = state.check = 0;\n state.mode = TYPE;\n break;\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n strm.adler = state.check = zswap32(hold);\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = DICT;\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n return Z_NEED_DICT;\n }\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = TYPE;\n /* falls through */\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n state.mode = CHECK;\n break;\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.last = (hold & 0x01)/*BITS(1)*/;\n //--- DROPBITS(1) ---//\n hold >>>= 1;\n bits -= 1;\n //---//\n\n switch ((hold & 0x03)/*BITS(2)*/) {\n case 0: /* stored block */\n //Tracev((stderr, \"inflate: stored block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED;\n break;\n case 1: /* fixed block */\n fixedtables(state);\n //Tracev((stderr, \"inflate: fixed codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_; /* decode codes */\n if (flush === Z_TREES) {\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break inf_leave;\n }\n break;\n case 2: /* dynamic block */\n //Tracev((stderr, \"inflate: dynamic codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = 'invalid block type';\n state.mode = BAD;\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break;\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths';\n state.mode = BAD;\n break;\n }\n state.length = hold & 0xffff;\n //Tracev((stderr, \"inflate: stored length %u\\n\",\n // state.length));\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = COPY_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case COPY_:\n state.mode = COPY;\n /* falls through */\n case COPY:\n copy = state.length;\n if (copy) {\n if (copy > have) { copy = have; }\n if (copy > left) { copy = left; }\n if (copy === 0) { break inf_leave; }\n //--- zmemcpy(put, next, copy); ---\n utils.arraySet(output, input, next, copy, put);\n //---//\n have -= copy;\n next += copy;\n left -= copy;\n put += copy;\n state.length -= copy;\n break;\n }\n //Tracev((stderr, \"inflate: stored end\\n\"));\n state.mode = TYPE;\n break;\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n//#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracev((stderr, \"inflate: table sizes ok\\n\"));\n state.have = 0;\n state.mode = LENLENS;\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0;\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn;\n state.lenbits = 7;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n state.lenbits = opts.bits;\n\n if (ret) {\n strm.msg = 'invalid code lengths set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, \"inflate: code lengths ok\\n\"));\n state.have = 0;\n state.mode = CODELENS;\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.lens[state.have++] = here_val;\n }\n else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1];\n copy = 3 + (hold & 0x03);//BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n }\n else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 3 + (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 11 + (hold & 0x7f);//BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7;\n bits -= 7;\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n while (copy--) {\n state.lens[state.have++] = len;\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD) { break; }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block';\n state.mode = BAD;\n break;\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits;\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set';\n state.mode = BAD;\n break;\n }\n\n state.distbits = 6;\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn;\n opts = { bits: state.distbits };\n ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits;\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, 'inflate: codes ok\\n'));\n state.mode = LEN_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case LEN_:\n state.mode = LEN;\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n inflate_fast(strm, _out);\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n if (state.mode === TYPE) {\n state.back = -1;\n }\n break;\n }\n state.back = 0;\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if (here_bits <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.lencode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n state.length = here_val;\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.back = -1;\n state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break;\n }\n state.extra = here_op & 15;\n state.mode = LENEXT;\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", state.length));\n state.was = state.length;\n state.mode = DIST;\n /* falls through */\n case DIST:\n for (;;) {\n here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.distcode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n if (here_op & 64) {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break;\n }\n state.offset = here_val;\n state.extra = (here_op) & 15;\n state.mode = DISTEXT;\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n//#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracevv((stderr, \"inflate: distance %u\\n\", state.offset));\n state.mode = MATCH;\n /* falls through */\n case MATCH:\n if (left === 0) { break inf_leave; }\n copy = _out - left;\n if (state.offset > copy) { /* copy from window */\n copy = state.offset - copy;\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// Trace((stderr, \"inflate.c too far\\n\"));\n// copy -= state.whave;\n// if (copy > state.length) { copy = state.length; }\n// if (copy > left) { copy = left; }\n// left -= copy;\n// state.length -= copy;\n// do {\n// output[put++] = 0;\n// } while (--copy);\n// if (state.length === 0) { state.mode = LEN; }\n// break;\n//#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext;\n from = state.wsize - copy;\n }\n else {\n from = state.wnext - copy;\n }\n if (copy > state.length) { copy = state.length; }\n from_source = state.window;\n }\n else { /* copy from output */\n from_source = output;\n from = put - state.offset;\n copy = state.length;\n }\n if (copy > left) { copy = left; }\n left -= copy;\n state.length -= copy;\n do {\n output[put++] = from_source[from++];\n } while (--copy);\n if (state.length === 0) { state.mode = LEN; }\n break;\n case LIT:\n if (left === 0) { break inf_leave; }\n output[put++] = state.length;\n left--;\n state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits;\n bits += 8;\n }\n //===//\n _out -= left;\n strm.total_out += _out;\n state.total += _out;\n if (_out) {\n strm.adler = state.check =\n /*UPDATE(state.check, put - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));\n\n }\n _out = left;\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\\n\"));\n }\n state.mode = LENGTH;\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\\n\"));\n }\n state.mode = DONE;\n /* falls through */\n case DONE:\n ret = Z_STREAM_END;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR;\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR;\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n\n if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\n (state.mode < CHECK || flush !== Z_FINISH))) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n }\n _in -= strm.avail_in;\n _out -= strm.avail_out;\n strm.total_in += _in;\n strm.total_out += _out;\n state.total += _out;\n if (state.wrap && _out) {\n strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));\n }\n strm.data_type = state.bits + (state.last ? 64 : 0) +\n (state.mode === TYPE ? 128 : 0) +\n (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {\n ret = Z_BUF_ERROR;\n }\n return ret;\n}\n\nfunction inflateEnd(strm) {\n\n if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n return Z_STREAM_ERROR;\n }\n\n var state = strm.state;\n if (state.window) {\n state.window = null;\n }\n strm.state = null;\n return Z_OK;\n}\n\nfunction inflateGetHeader(strm, head) {\n var state;\n\n /* check state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; }\n\n /* save header structure */\n state.head = head;\n head.done = false;\n return Z_OK;\n}\n\nfunction inflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var state;\n var dictid;\n var ret;\n\n /* check state */\n if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR;\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1; /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32(dictid, dictionary, dictLength, 0);\n if (dictid !== state.check) {\n return Z_DATA_ERROR;\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength);\n if (ret) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n state.havedict = 1;\n // Tracev((stderr, \"inflate: dictionary set\\n\"));\n return Z_OK;\n}\n\nexports.inflateReset = inflateReset;\nexports.inflateReset2 = inflateReset2;\nexports.inflateResetKeep = inflateResetKeep;\nexports.inflateInit = inflateInit;\nexports.inflateInit2 = inflateInit2;\nexports.inflate = inflate;\nexports.inflateEnd = inflateEnd;\nexports.inflateGetHeader = inflateGetHeader;\nexports.inflateSetDictionary = inflateSetDictionary;\nexports.inflateInfo = 'pako inflate (from Nodeca project)';\n\n/* Not implemented\nexports.inflateCopy = inflateCopy;\nexports.inflateGetDictionary = inflateGetDictionary;\nexports.inflateMark = inflateMark;\nexports.inflatePrime = inflatePrime;\nexports.inflateSync = inflateSync;\nexports.inflateSyncPoint = inflateSyncPoint;\nexports.inflateUndermine = inflateUndermine;\n*/\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\n\nvar MAXBITS = 15;\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\nvar lbase = [ /* Length codes 257..285 base */\n 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n];\n\nvar lext = [ /* Length codes 257..285 extra */\n 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n];\n\nvar dbase = [ /* Distance codes 0..29 base */\n 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n 8193, 12289, 16385, 24577, 0, 0\n];\n\nvar dext = [ /* Distance codes 0..29 extra */\n 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n 28, 28, 29, 29, 64, 64\n];\n\nmodule.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)\n{\n var bits = opts.bits;\n //here = opts.here; /* table entry for duplication */\n\n var len = 0; /* a code's length in bits */\n var sym = 0; /* index of code symbols */\n var min = 0, max = 0; /* minimum and maximum code lengths */\n var root = 0; /* number of index bits for root table */\n var curr = 0; /* number of index bits for current table */\n var drop = 0; /* code bits to drop for sub-table */\n var left = 0; /* number of prefix codes available */\n var used = 0; /* code entries in table used */\n var huff = 0; /* Huffman code */\n var incr; /* for incrementing code, index */\n var fill; /* index for replicating entries */\n var low; /* low bits for current root entry */\n var mask; /* mask for low root bits */\n var next; /* next available space in table */\n var base = null; /* base value table to use */\n var base_index = 0;\n// var shoextra; /* extra bits table to use */\n var end; /* use base and extra for symbol > end */\n var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */\n var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */\n var extra = null;\n var extra_index = 0;\n\n var here_bits, here_op, here_val;\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0;\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++;\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits;\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) { break; }\n }\n if (root > max) {\n root = max;\n }\n if (max === 0) { /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n opts.bits = 1;\n return 0; /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) { break; }\n }\n if (root < min) {\n root = min;\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1;\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1;\n left -= count[len];\n if (left < 0) {\n return -1;\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES || max !== 1)) {\n return -1; /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0;\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len];\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym;\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES) {\n base = extra = work; /* dummy value--not used */\n end = 19;\n\n } else if (type === LENS) {\n base = lbase;\n base_index -= 257;\n extra = lext;\n extra_index -= 257;\n end = 256;\n\n } else { /* DISTS */\n base = dbase;\n extra = dext;\n end = -1;\n }\n\n /* initialize opts for loop */\n huff = 0; /* starting code */\n sym = 0; /* starting code symbol */\n len = min; /* starting code length */\n next = table_index; /* current table to fill in */\n curr = root; /* current table index bits */\n drop = 0; /* current bits to drop from code for index */\n low = -1; /* trigger new sub-table when len > root */\n used = 1 << root; /* use root table entries */\n mask = used - 1; /* mask for comparing low */\n\n /* check available table space */\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop;\n if (work[sym] < end) {\n here_op = 0;\n here_val = work[sym];\n }\n else if (work[sym] > end) {\n here_op = extra[extra_index + work[sym]];\n here_val = base[base_index + work[sym]];\n }\n else {\n here_op = 32 + 64; /* end of block */\n here_val = 0;\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << (len - drop);\n fill = 1 << curr;\n min = fill; /* save offset to next table */\n do {\n fill -= incr;\n table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n } while (fill !== 0);\n\n /* backwards increment the len-bit code huff */\n incr = 1 << (len - 1);\n while (huff & incr) {\n incr >>= 1;\n }\n if (incr !== 0) {\n huff &= incr - 1;\n huff += incr;\n } else {\n huff = 0;\n }\n\n /* go to next symbol, update count, len */\n sym++;\n if (--count[len] === 0) {\n if (len === max) { break; }\n len = lens[lens_index + work[sym]];\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root;\n }\n\n /* increment past last table */\n next += min; /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop;\n left = 1 << curr;\n while (curr + drop < max) {\n left -= count[curr + drop];\n if (left <= 0) { break; }\n curr++;\n left <<= 1;\n }\n\n /* check for enough space */\n used += 1 << curr;\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask;\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root;\n return 0;\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n 2: 'need dictionary', /* Z_NEED_DICT 2 */\n 1: 'stream end', /* Z_STREAM_END 1 */\n 0: '', /* Z_OK 0 */\n '-1': 'file error', /* Z_ERRNO (-1) */\n '-2': 'stream error', /* Z_STREAM_ERROR (-2) */\n '-3': 'data error', /* Z_DATA_ERROR (-3) */\n '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */\n '-5': 'buffer error', /* Z_BUF_ERROR (-5) */\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */\n};\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n/* eslint-disable space-unary-ops */\n\nvar utils = require('../utils/common');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n//var Z_FILTERED = 1;\n//var Z_HUFFMAN_ONLY = 2;\n//var Z_RLE = 3;\nvar Z_FIXED = 4;\n//var Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\nvar Z_BINARY = 0;\nvar Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n/*============================================================================*/\n\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n// From zutil.h\n\nvar STORED_BLOCK = 0;\nvar STATIC_TREES = 1;\nvar DYN_TREES = 2;\n/* The three kinds of block type */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\n/* The minimum and maximum match lengths */\n\n// From deflate.h\n/* ===========================================================================\n * Internal compression state.\n */\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\n\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\n\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\n\nvar D_CODES = 30;\n/* number of distance codes */\n\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\n\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\n\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar Buf_size = 16;\n/* size of bit buffer in bi_buf */\n\n\n/* ===========================================================================\n * Constants\n */\n\nvar MAX_BL_BITS = 7;\n/* Bit length codes must not exceed MAX_BL_BITS bits */\n\nvar END_BLOCK = 256;\n/* end of block literal code */\n\nvar REP_3_6 = 16;\n/* repeat previous bit length 3-6 times (2 bits of repeat count) */\n\nvar REPZ_3_10 = 17;\n/* repeat a zero length 3-10 times (3 bits of repeat count) */\n\nvar REPZ_11_138 = 18;\n/* repeat a zero length 11-138 times (7 bits of repeat count) */\n\n/* eslint-disable comma-spacing,array-bracket-spacing */\nvar extra_lbits = /* extra bits for each length code */\n [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];\n\nvar extra_dbits = /* extra bits for each distance code */\n [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];\n\nvar extra_blbits = /* extra bits for each bit length code */\n [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];\n\nvar bl_order =\n [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];\n/* eslint-enable comma-spacing,array-bracket-spacing */\n\n/* The lengths of the bit length codes are sent in order of decreasing\n * probability, to avoid transmitting the lengths for unused bit length codes.\n */\n\n/* ===========================================================================\n * Local data. These are initialized only once.\n */\n\n// We pre-fill arrays with 0 to avoid uninitialized gaps\n\nvar DIST_CODE_LEN = 512; /* see definition of array dist_code below */\n\n// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1\nvar static_ltree = new Array((L_CODES + 2) * 2);\nzero(static_ltree);\n/* The static literal tree. Since the bit lengths are imposed, there is no\n * need for the L_CODES extra codes used during heap construction. However\n * The codes 286 and 287 are needed to build a canonical tree (see _tr_init\n * below).\n */\n\nvar static_dtree = new Array(D_CODES * 2);\nzero(static_dtree);\n/* The static distance tree. (Actually a trivial tree since all codes use\n * 5 bits.)\n */\n\nvar _dist_code = new Array(DIST_CODE_LEN);\nzero(_dist_code);\n/* Distance codes. The first 256 values correspond to the distances\n * 3 .. 258, the last 256 values correspond to the top 8 bits of\n * the 15 bit distances.\n */\n\nvar _length_code = new Array(MAX_MATCH - MIN_MATCH + 1);\nzero(_length_code);\n/* length code for each normalized match length (0 == MIN_MATCH) */\n\nvar base_length = new Array(LENGTH_CODES);\nzero(base_length);\n/* First normalized length for each code (0 = MIN_MATCH) */\n\nvar base_dist = new Array(D_CODES);\nzero(base_dist);\n/* First normalized distance for each code (0 = distance of 1) */\n\n\nfunction StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n\n this.static_tree = static_tree; /* static tree or NULL */\n this.extra_bits = extra_bits; /* extra bits for each code or NULL */\n this.extra_base = extra_base; /* base index for extra_bits */\n this.elems = elems; /* max number of elements in the tree */\n this.max_length = max_length; /* max bit length for the codes */\n\n // show if `static_tree` has data or dummy - needed for monomorphic objects\n this.has_stree = static_tree && static_tree.length;\n}\n\n\nvar static_l_desc;\nvar static_d_desc;\nvar static_bl_desc;\n\n\nfunction TreeDesc(dyn_tree, stat_desc) {\n this.dyn_tree = dyn_tree; /* the dynamic tree */\n this.max_code = 0; /* largest code with non zero frequency */\n this.stat_desc = stat_desc; /* the corresponding static tree */\n}\n\n\n\nfunction d_code(dist) {\n return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n}\n\n\n/* ===========================================================================\n * Output a short LSB first on the stream.\n * IN assertion: there is enough room in pendingBuf.\n */\nfunction put_short(s, w) {\n// put_byte(s, (uch)((w) & 0xff));\n// put_byte(s, (uch)((ush)(w) >> 8));\n s.pending_buf[s.pending++] = (w) & 0xff;\n s.pending_buf[s.pending++] = (w >>> 8) & 0xff;\n}\n\n\n/* ===========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\nfunction send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}\n\n\nfunction send_code(s, c, tree) {\n send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);\n}\n\n\n/* ===========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\nfunction bi_reverse(code, len) {\n var res = 0;\n do {\n res |= code & 1;\n code >>>= 1;\n res <<= 1;\n } while (--len > 0);\n return res >>> 1;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer, keeping at most 7 bits in it.\n */\nfunction bi_flush(s) {\n if (s.bi_valid === 16) {\n put_short(s, s.bi_buf);\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n } else if (s.bi_valid >= 8) {\n s.pending_buf[s.pending++] = s.bi_buf & 0xff;\n s.bi_buf >>= 8;\n s.bi_valid -= 8;\n }\n}\n\n\n/* ===========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n * above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n * array bl_count contains the frequencies for each bit length.\n * The length opt_len is updated; static_len is also updated if stree is\n * not null.\n */\nfunction gen_bitlen(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var max_code = desc.max_code;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var extra = desc.stat_desc.extra_bits;\n var base = desc.stat_desc.extra_base;\n var max_length = desc.stat_desc.max_length;\n var h; /* heap index */\n var n, m; /* iterate over the tree elements */\n var bits; /* bit length */\n var xbits; /* extra bits */\n var f; /* frequency */\n var overflow = 0; /* number of elements with bit length too large */\n\n for (bits = 0; bits <= MAX_BITS; bits++) {\n s.bl_count[bits] = 0;\n }\n\n /* In a first pass, compute the optimal bit lengths (which may\n * overflow in the case of the bit length tree).\n */\n tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */\n\n for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {\n n = s.heap[h];\n bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;\n if (bits > max_length) {\n bits = max_length;\n overflow++;\n }\n tree[n * 2 + 1]/*.Len*/ = bits;\n /* We overwrite tree[n].Dad which is no longer needed */\n\n if (n > max_code) { continue; } /* not a leaf node */\n\n s.bl_count[bits]++;\n xbits = 0;\n if (n >= base) {\n xbits = extra[n - base];\n }\n f = tree[n * 2]/*.Freq*/;\n s.opt_len += f * (bits + xbits);\n if (has_stree) {\n s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);\n }\n }\n if (overflow === 0) { return; }\n\n // Trace((stderr,\"\\nbit length overflow\\n\"));\n /* This happens for example on obj2 and pic of the Calgary corpus */\n\n /* Find the first bit length which could increase: */\n do {\n bits = max_length - 1;\n while (s.bl_count[bits] === 0) { bits--; }\n s.bl_count[bits]--; /* move one leaf down the tree */\n s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */\n s.bl_count[max_length]--;\n /* The brother of the overflow item also moves one step up,\n * but this does not affect bl_count[max_length]\n */\n overflow -= 2;\n } while (overflow > 0);\n\n /* Now recompute all bit lengths, scanning in increasing frequency.\n * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n * lengths instead of fixing only the wrong ones. This idea is taken\n * from 'ar' written by Haruhiko Okumura.)\n */\n for (bits = max_length; bits !== 0; bits--) {\n n = s.bl_count[bits];\n while (n !== 0) {\n m = s.heap[--h];\n if (m > max_code) { continue; }\n if (tree[m * 2 + 1]/*.Len*/ !== bits) {\n // Trace((stderr,\"code %d bits %d->%d\\n\", m, tree[m].Len, bits));\n s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;\n tree[m * 2 + 1]/*.Len*/ = bits;\n }\n n--;\n }\n }\n}\n\n\n/* ===========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n * zero code length.\n */\nfunction gen_codes(tree, max_code, bl_count)\n// ct_data *tree; /* the tree to decorate */\n// int max_code; /* largest code with non zero frequency */\n// ushf *bl_count; /* number of codes at each bit length */\n{\n var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */\n var code = 0; /* running code value */\n var bits; /* bit index */\n var n; /* code index */\n\n /* The distribution counts are first used to generate the code values\n * without bit reversal.\n */\n for (bits = 1; bits <= MAX_BITS; bits++) {\n next_code[bits] = code = (code + bl_count[bits - 1]) << 1;\n }\n /* Check that the bit counts in bl_count are consistent. The last code\n * must be all ones.\n */\n //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */\n length = 0;\n for (code = 0; code < LENGTH_CODES - 1; code++) {\n base_length[code] = length;\n for (n = 0; n < (1 << extra_lbits[code]); n++) {\n _length_code[length++] = code;\n }\n }\n //Assert (length == 256, \"tr_static_init: length != 256\");\n /* Note that the length 255 (match length 258) can be represented\n * in two different ways: code 284 + 5 bits or code 285, so we\n * overwrite length_code[255] to use the best encoding:\n */\n _length_code[length - 1] = code;\n\n /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n dist = 0;\n for (code = 0; code < 16; code++) {\n base_dist[code] = dist;\n for (n = 0; n < (1 << extra_dbits[code]); n++) {\n _dist_code[dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: dist != 256\");\n dist >>= 7; /* from now on, all distances are divided by 128 */\n for (; code < D_CODES; code++) {\n base_dist[code] = dist << 7;\n for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {\n _dist_code[256 + dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: 256+dist != 512\");\n\n /* Construct the codes of the static literal tree */\n for (bits = 0; bits <= MAX_BITS; bits++) {\n bl_count[bits] = 0;\n }\n\n n = 0;\n while (n <= 143) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n while (n <= 255) {\n static_ltree[n * 2 + 1]/*.Len*/ = 9;\n n++;\n bl_count[9]++;\n }\n while (n <= 279) {\n static_ltree[n * 2 + 1]/*.Len*/ = 7;\n n++;\n bl_count[7]++;\n }\n while (n <= 287) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n /* Codes 286 and 287 do not exist, but we must include them in the\n * tree construction to get a canonical Huffman tree (longest code\n * all ones)\n */\n gen_codes(static_ltree, L_CODES + 1, bl_count);\n\n /* The static distance tree is trivial: */\n for (n = 0; n < D_CODES; n++) {\n static_dtree[n * 2 + 1]/*.Len*/ = 5;\n static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);\n }\n\n // Now data ready and we can init static trees\n static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);\n static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);\n static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);\n\n //static_init_done = true;\n}\n\n\n/* ===========================================================================\n * Initialize a new block.\n */\nfunction init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer and align the output on a byte boundary\n */\nfunction bi_windup(s)\n{\n if (s.bi_valid > 8) {\n put_short(s, s.bi_buf);\n } else if (s.bi_valid > 0) {\n //put_byte(s, (Byte)s->bi_buf);\n s.pending_buf[s.pending++] = s.bi_buf;\n }\n s.bi_buf = 0;\n s.bi_valid = 0;\n}\n\n/* ===========================================================================\n * Copy a stored block, storing first the length and its\n * one's complement if requested.\n */\nfunction copy_block(s, buf, len, header)\n//DeflateState *s;\n//charf *buf; /* the input data */\n//unsigned len; /* its length */\n//int header; /* true if block header must be written */\n{\n bi_windup(s); /* align on byte boundary */\n\n if (header) {\n put_short(s, len);\n put_short(s, ~len);\n }\n// while (len--) {\n// put_byte(s, *buf++);\n// }\n utils.arraySet(s.pending_buf, s.window, buf, len, s.pending);\n s.pending += len;\n}\n\n/* ===========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\nfunction smaller(tree, n, m, depth) {\n var _n2 = n * 2;\n var _m2 = m * 2;\n return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||\n (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));\n}\n\n/* ===========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\nfunction pqdownheap(s, tree, k)\n// deflate_state *s;\n// ct_data *tree; /* the tree to restore */\n// int k; /* node to move down */\n{\n var v = s.heap[k];\n var j = k << 1; /* left son of k */\n while (j <= s.heap_len) {\n /* Set j to the smallest of the two sons: */\n if (j < s.heap_len &&\n smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {\n j++;\n }\n /* Exit if v is smaller than both sons */\n if (smaller(tree, v, s.heap[j], s.depth)) { break; }\n\n /* Exchange v with the smallest son */\n s.heap[k] = s.heap[j];\n k = j;\n\n /* And continue down the tree, setting j to the left son of k */\n j <<= 1;\n }\n s.heap[k] = v;\n}\n\n\n// inlined manually\n// var SMALLEST = 1;\n\n/* ===========================================================================\n * Send the block data compressed using the given Huffman trees\n */\nfunction compress_block(s, ltree, dtree)\n// deflate_state *s;\n// const ct_data *ltree; /* literal tree */\n// const ct_data *dtree; /* distance tree */\n{\n var dist; /* distance of matched string */\n var lc; /* match length or unmatched char (if dist == 0) */\n var lx = 0; /* running index in l_buf */\n var code; /* the code to send */\n var extra; /* number of extra bits to send */\n\n if (s.last_lit !== 0) {\n do {\n dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]);\n lc = s.pending_buf[s.l_buf + lx];\n lx++;\n\n if (dist === 0) {\n send_code(s, lc, ltree); /* send a literal byte */\n //Tracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n } else {\n /* Here, lc is the match length - MIN_MATCH */\n code = _length_code[lc];\n send_code(s, code + LITERALS + 1, ltree); /* send the length code */\n extra = extra_lbits[code];\n if (extra !== 0) {\n lc -= base_length[code];\n send_bits(s, lc, extra); /* send the extra length bits */\n }\n dist--; /* dist is now the match distance - 1 */\n code = d_code(dist);\n //Assert (code < D_CODES, \"bad d_code\");\n\n send_code(s, code, dtree); /* send the distance code */\n extra = extra_dbits[code];\n if (extra !== 0) {\n dist -= base_dist[code];\n send_bits(s, dist, extra); /* send the extra distance bits */\n }\n } /* literal or match pair ? */\n\n /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */\n //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,\n // \"pendingBuf overflow\");\n\n } while (lx < s.last_lit);\n }\n\n send_code(s, END_BLOCK, ltree);\n}\n\n\n/* ===========================================================================\n * Construct one Huffman tree and assigns the code bit strings and lengths.\n * Update the total bit length for the current block.\n * IN assertion: the field freq is set for all tree elements.\n * OUT assertions: the fields len and code are set to the optimal bit length\n * and corresponding code. The length opt_len is updated; static_len is\n * also updated if stree is not null. The field max_code is set.\n */\nfunction build_tree(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var elems = desc.stat_desc.elems;\n var n, m; /* iterate over heap elements */\n var max_code = -1; /* largest code with non zero frequency */\n var node; /* new node being created */\n\n /* Construct the initial heap, with least frequent element in\n * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\n * heap[0] is not used.\n */\n s.heap_len = 0;\n s.heap_max = HEAP_SIZE;\n\n for (n = 0; n < elems; n++) {\n if (tree[n * 2]/*.Freq*/ !== 0) {\n s.heap[++s.heap_len] = max_code = n;\n s.depth[n] = 0;\n\n } else {\n tree[n * 2 + 1]/*.Len*/ = 0;\n }\n }\n\n /* The pkzip format requires that at least one distance code exists,\n * and that at least one bit should be sent even if there is only one\n * possible code. So to avoid special checks later on we force at least\n * two codes of non zero frequency.\n */\n while (s.heap_len < 2) {\n node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);\n tree[node * 2]/*.Freq*/ = 1;\n s.depth[node] = 0;\n s.opt_len--;\n\n if (has_stree) {\n s.static_len -= stree[node * 2 + 1]/*.Len*/;\n }\n /* node is 0 or 1 so it does not have extra bits */\n }\n desc.max_code = max_code;\n\n /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\n * establish sub-heaps of increasing lengths:\n */\n for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }\n\n /* Construct the Huffman tree by repeatedly combining the least two\n * frequent nodes.\n */\n node = elems; /* next internal node of the tree */\n do {\n //pqremove(s, tree, n); /* n = node of least frequency */\n /*** pqremove ***/\n n = s.heap[1/*SMALLEST*/];\n s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];\n pqdownheap(s, tree, 1/*SMALLEST*/);\n /***/\n\n m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */\n\n s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */\n s.heap[--s.heap_max] = m;\n\n /* Create a new node father of n and m */\n tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;\n s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;\n tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;\n\n /* and insert the new node in the heap */\n s.heap[1/*SMALLEST*/] = node++;\n pqdownheap(s, tree, 1/*SMALLEST*/);\n\n } while (s.heap_len >= 2);\n\n s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];\n\n /* At this point, the fields freq and dad are set. We can now\n * generate the bit lengths.\n */\n gen_bitlen(s, desc);\n\n /* The field len is now set, we can generate the bit codes */\n gen_codes(tree, max_code, s.bl_count);\n}\n\n\n/* ===========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree.\n */\nfunction scan_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n s.bl_tree[curlen * 2]/*.Freq*/ += count;\n\n } else if (curlen !== 0) {\n\n if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }\n s.bl_tree[REP_3_6 * 2]/*.Freq*/++;\n\n } else if (count <= 10) {\n s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;\n\n } else {\n s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;\n }\n\n count = 0;\n prevlen = curlen;\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\nfunction send_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n /* tree[max_code+1].Len = -1; */ /* guard already set */\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);\n\n } else if (curlen !== 0) {\n if (curlen !== prevlen) {\n send_code(s, curlen, s.bl_tree);\n count--;\n }\n //Assert(count >= 3 && count <= 6, \" 3_6?\");\n send_code(s, REP_3_6, s.bl_tree);\n send_bits(s, count - 3, 2);\n\n } else if (count <= 10) {\n send_code(s, REPZ_3_10, s.bl_tree);\n send_bits(s, count - 3, 3);\n\n } else {\n send_code(s, REPZ_11_138, s.bl_tree);\n send_bits(s, count - 11, 7);\n }\n\n count = 0;\n prevlen = curlen;\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\nfunction build_bl_tree(s) {\n var max_blindex; /* index of last bit length code of non zero freq */\n\n /* Determine the bit length frequencies for literal and distance trees */\n scan_tree(s, s.dyn_ltree, s.l_desc.max_code);\n scan_tree(s, s.dyn_dtree, s.d_desc.max_code);\n\n /* Build the bit length tree: */\n build_tree(s, s.bl_desc);\n /* opt_len now includes the length of the tree representations, except\n * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n */\n\n /* Determine the number of bit length codes to send. The pkzip format\n * requires that at least 4 bit length codes be sent. (appnote.txt says\n * 3 but the actual value used is 4.)\n */\n for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {\n if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {\n break;\n }\n }\n /* Update opt_len to include the bit length tree and counts */\n s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n //Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n // s->opt_len, s->static_len));\n\n return max_blindex;\n}\n\n\n/* ===========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\nfunction send_all_trees(s, lcodes, dcodes, blcodes)\n// deflate_state *s;\n// int lcodes, dcodes, blcodes; /* number of codes for each tree */\n{\n var rank; /* index in bl_order */\n\n //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n // \"too many codes\");\n //Tracev((stderr, \"\\nbl counts: \"));\n send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */\n send_bits(s, dcodes - 1, 5);\n send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */\n for (rank = 0; rank < blcodes; rank++) {\n //Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);\n }\n //Tracev((stderr, \"\\nbl tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */\n //Tracev((stderr, \"\\nlit tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */\n //Tracev((stderr, \"\\ndist tree: sent %ld\", s->bits_sent));\n}\n\n\n/* ===========================================================================\n * Check if the data type is TEXT or BINARY, using the following algorithm:\n * - TEXT if the two conditions below are satisfied:\n * a) There are no non-portable control characters belonging to the\n * \"black list\" (0..6, 14..25, 28..31).\n * b) There is at least one printable character belonging to the\n * \"white list\" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).\n * - BINARY otherwise.\n * - The following partially-portable control characters form a\n * \"gray list\" that is ignored in this detection algorithm:\n * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).\n * IN assertion: the fields Freq of dyn_ltree are set.\n */\nfunction detect_data_type(s) {\n /* black_mask is the bit mask of black-listed bytes\n * set bits 0..6, 14..25, and 28..31\n * 0xf3ffc07f = binary 11110011111111111100000001111111\n */\n var black_mask = 0xf3ffc07f;\n var n;\n\n /* Check for non-textual (\"black-listed\") bytes. */\n for (n = 0; n <= 31; n++, black_mask >>>= 1) {\n if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {\n return Z_BINARY;\n }\n }\n\n /* Check for textual (\"white-listed\") bytes. */\n if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||\n s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n for (n = 32; n < LITERALS; n++) {\n if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n }\n\n /* There are no \"black-listed\" or \"white-listed\" bytes:\n * this stream either is empty or has tolerated (\"gray-listed\") bytes only.\n */\n return Z_BINARY;\n}\n\n\nvar static_init_done = false;\n\n/* ===========================================================================\n * Initialize the tree data structures for a new zlib stream.\n */\nfunction _tr_init(s)\n{\n\n if (!static_init_done) {\n tr_static_init();\n static_init_done = true;\n }\n\n s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);\n s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);\n s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);\n\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n /* Initialize the first block of the first file: */\n init_block(s);\n}\n\n\n/* ===========================================================================\n * Send a stored block\n */\nfunction _tr_stored_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */\n copy_block(s, buf, stored_len, true); /* with header */\n}\n\n\n/* ===========================================================================\n * Send one empty static block to give enough lookahead for inflate.\n * This takes 10 bits, of which 7 may remain in the bit buffer.\n */\nfunction _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}\n\n\n/* ===========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and output the encoded block to the zip file.\n */\nfunction _tr_flush_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block, or NULL if too old */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n var opt_lenb, static_lenb; /* opt_len and static_len in bytes */\n var max_blindex = 0; /* index of last bit length code of non zero freq */\n\n /* Build the Huffman trees unless a stored block is forced */\n if (s.level > 0) {\n\n /* Check if the file is binary or text */\n if (s.strm.data_type === Z_UNKNOWN) {\n s.strm.data_type = detect_data_type(s);\n }\n\n /* Construct the literal and distance trees */\n build_tree(s, s.l_desc);\n // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n\n build_tree(s, s.d_desc);\n // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n /* At this point, opt_len and static_len are the total bit lengths of\n * the compressed block data, excluding the tree representations.\n */\n\n /* Build the bit length tree for the above two trees, and get the index\n * in bl_order of the last bit length code to send.\n */\n max_blindex = build_bl_tree(s);\n\n /* Determine the best encoding. Compute the block lengths in bytes. */\n opt_lenb = (s.opt_len + 3 + 7) >>> 3;\n static_lenb = (s.static_len + 3 + 7) >>> 3;\n\n // Tracev((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u \",\n // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,\n // s->last_lit));\n\n if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }\n\n } else {\n // Assert(buf != (char*)0, \"lost buf\");\n opt_lenb = static_lenb = stored_len + 5; /* force a stored block */\n }\n\n if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {\n /* 4: two words for the lengths */\n\n /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n * Otherwise we can't have processed more than WSIZE input bytes since\n * the last block flush, because compression would have been\n * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n * transform a block into a stored block.\n */\n _tr_stored_block(s, buf, stored_len, last);\n\n } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {\n\n send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);\n compress_block(s, static_ltree, static_dtree);\n\n } else {\n send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);\n send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);\n compress_block(s, s.dyn_ltree, s.dyn_dtree);\n }\n // Assert (s->compressed_len == s->bits_sent, \"bad compressed size\");\n /* The above check is made mod 2^32, for files larger than 512 MB\n * and uLong implemented on 32 bits.\n */\n init_block(s);\n\n if (last) {\n bi_windup(s);\n }\n // Tracev((stderr,\"\\ncomprlen %lu(%lu) \", s->compressed_len>>3,\n // s->compressed_len-7*last));\n}\n\n/* ===========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\nfunction _tr_tally(s, dist, lc)\n// deflate_state *s;\n// unsigned dist; /* distance of matched string */\n// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */\n{\n //var out_length, in_length, dcode;\n\n s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff;\n s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;\n\n s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;\n s.last_lit++;\n\n if (dist === 0) {\n /* lc is the unmatched char */\n s.dyn_ltree[lc * 2]/*.Freq*/++;\n } else {\n s.matches++;\n /* Here, lc is the match length - MIN_MATCH */\n dist--; /* dist = match distance - 1 */\n //Assert((ush)dist < (ush)MAX_DIST(s) &&\n // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n // (ush)d_code(dist) < (ush)D_CODES, \"_tr_tally: bad match\");\n\n s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++;\n s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n\n//#ifdef TRUNCATE_BLOCK\n// /* Try to guess if it is profitable to stop the current block here */\n// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {\n// /* Compute an upper bound for the compressed length */\n// out_length = s.last_lit*8;\n// in_length = s.strstart - s.block_start;\n//\n// for (dcode = 0; dcode < D_CODES; dcode++) {\n// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);\n// }\n// out_length >>>= 3;\n// //Tracev((stderr,\"\\nlast_lit %u, in %ld, out ~%ld(%ld%%) \",\n// // s->last_lit, in_length, out_length,\n// // 100L - out_length*100L/in_length));\n// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {\n// return true;\n// }\n// }\n//#endif\n\n return (s.last_lit === s.lit_bufsize - 1);\n /* We avoid equality with lit_bufsize because of wraparound at 64K\n * on 16 bit machines and because stored blocks are restricted to\n * 64K-1 bytes.\n */\n}\n\nexports._tr_init = _tr_init;\nexports._tr_stored_block = _tr_stored_block;\nexports._tr_flush_block = _tr_flush_block;\nexports._tr_tally = _tr_tally;\nexports._tr_align = _tr_align;\n","'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction ZStream() {\n /* next input byte */\n this.input = null; // JS specific, because we have no pointers\n this.next_in = 0;\n /* number of bytes available at input */\n this.avail_in = 0;\n /* total number of input bytes read so far */\n this.total_in = 0;\n /* next output byte should be put there */\n this.output = null; // JS specific, because we have no pointers\n this.next_out = 0;\n /* remaining free space at output */\n this.avail_out = 0;\n /* total number of bytes output so far */\n this.total_out = 0;\n /* last error message, NULL if no error */\n this.msg = ''/*Z_NULL*/;\n /* not visible by applications */\n this.state = null;\n /* best guess about the data type: binary or text */\n this.data_type = 2/*Z_UNKNOWN*/;\n /* adler32 value of the uncompressed data */\n this.adler = 0;\n}\n\nmodule.exports = ZStream;\n","module.exports = function parseBMFontAscii(data) {\n if (!data)\n throw new Error('no data provided')\n data = data.toString().trim()\n\n var output = {\n pages: [],\n chars: [],\n kernings: []\n }\n\n var lines = data.split(/\\r\\n?|\\n/g)\n\n if (lines.length === 0)\n throw new Error('no data in BMFont file')\n\n for (var i = 0; i < lines.length; i++) {\n var lineData = splitLine(lines[i], i)\n if (!lineData) //skip empty lines\n continue\n\n if (lineData.key === 'page') {\n if (typeof lineData.data.id !== 'number')\n throw new Error('malformed file at line ' + i + ' -- needs page id=N')\n if (typeof lineData.data.file !== 'string')\n throw new Error('malformed file at line ' + i + ' -- needs page file=\"path\"')\n output.pages[lineData.data.id] = lineData.data.file\n } else if (lineData.key === 'chars' || lineData.key === 'kernings') {\n //... do nothing for these two ...\n } else if (lineData.key === 'char') {\n output.chars.push(lineData.data)\n } else if (lineData.key === 'kerning') {\n output.kernings.push(lineData.data)\n } else {\n output[lineData.key] = lineData.data\n }\n }\n\n return output\n}\n\nfunction splitLine(line, idx) {\n line = line.replace(/\\t+/g, ' ').trim()\n if (!line)\n return null\n\n var space = line.indexOf(' ')\n if (space === -1) \n throw new Error(\"no named row at line \" + idx)\n\n var key = line.substring(0, space)\n\n line = line.substring(space + 1)\n //clear \"letter\" field as it is non-standard and\n //requires additional complexity to parse \" / = symbols\n line = line.replace(/letter=[\\'\\\"]\\S+[\\'\\\"]/gi, '') \n line = line.split(\"=\")\n line = line.map(function(str) {\n return str.trim().match((/(\".*?\"|[^\"\\s]+)+(?=\\s*|\\s*$)/g))\n })\n\n var data = []\n for (var i = 0; i < line.length; i++) {\n var dt = line[i]\n if (i === 0) {\n data.push({\n key: dt[0],\n data: \"\"\n })\n } else if (i === line.length - 1) {\n data[data.length - 1].data = parseData(dt[0])\n } else {\n data[data.length - 1].data = parseData(dt[0])\n data.push({\n key: dt[1],\n data: \"\"\n })\n }\n }\n\n var out = {\n key: key,\n data: {}\n }\n\n data.forEach(function(v) {\n out.data[v.key] = v.data;\n })\n\n return out\n}\n\nfunction parseData(data) {\n if (!data || data.length === 0)\n return \"\"\n\n if (data.indexOf('\"') === 0 || data.indexOf(\"'\") === 0)\n return data.substring(1, data.length - 1)\n if (data.indexOf(',') !== -1)\n return parseIntList(data)\n return parseInt(data, 10)\n}\n\nfunction parseIntList(data) {\n return data.split(',').map(function(val) {\n return parseInt(val, 10)\n })\n}","var HEADER = [66, 77, 70]\n\nmodule.exports = function readBMFontBinary(buf) {\n if (buf.length < 6)\n throw new Error('invalid buffer length for BMFont')\n\n var header = HEADER.every(function(byte, i) {\n return buf.readUInt8(i) === byte\n })\n\n if (!header)\n throw new Error('BMFont missing BMF byte header')\n\n var i = 3\n var vers = buf.readUInt8(i++)\n if (vers > 3)\n throw new Error('Only supports BMFont Binary v3 (BMFont App v1.10)')\n \n var target = { kernings: [], chars: [] }\n for (var b=0; b<5; b++)\n i += readBlock(target, buf, i)\n return target\n}\n\nfunction readBlock(target, buf, i) {\n if (i > buf.length-1)\n return 0\n\n var blockID = buf.readUInt8(i++)\n var blockSize = buf.readInt32LE(i)\n i += 4\n\n switch(blockID) {\n case 1: \n target.info = readInfo(buf, i)\n break\n case 2:\n target.common = readCommon(buf, i)\n break\n case 3:\n target.pages = readPages(buf, i, blockSize)\n break\n case 4:\n target.chars = readChars(buf, i, blockSize)\n break\n case 5:\n target.kernings = readKernings(buf, i, blockSize)\n break\n }\n return 5 + blockSize\n}\n\nfunction readInfo(buf, i) {\n var info = {}\n info.size = buf.readInt16LE(i)\n\n var bitField = buf.readUInt8(i+2)\n info.smooth = (bitField >> 7) & 1\n info.unicode = (bitField >> 6) & 1\n info.italic = (bitField >> 5) & 1\n info.bold = (bitField >> 4) & 1\n \n //fixedHeight is only mentioned in binary spec \n if ((bitField >> 3) & 1)\n info.fixedHeight = 1\n \n info.charset = buf.readUInt8(i+3) || ''\n info.stretchH = buf.readUInt16LE(i+4)\n info.aa = buf.readUInt8(i+6)\n info.padding = [\n buf.readInt8(i+7),\n buf.readInt8(i+8),\n buf.readInt8(i+9),\n buf.readInt8(i+10)\n ]\n info.spacing = [\n buf.readInt8(i+11),\n buf.readInt8(i+12)\n ]\n info.outline = buf.readUInt8(i+13)\n info.face = readStringNT(buf, i+14)\n return info\n}\n\nfunction readCommon(buf, i) {\n var common = {}\n common.lineHeight = buf.readUInt16LE(i)\n common.base = buf.readUInt16LE(i+2)\n common.scaleW = buf.readUInt16LE(i+4)\n common.scaleH = buf.readUInt16LE(i+6)\n common.pages = buf.readUInt16LE(i+8)\n var bitField = buf.readUInt8(i+10)\n common.packed = 0\n common.alphaChnl = buf.readUInt8(i+11)\n common.redChnl = buf.readUInt8(i+12)\n common.greenChnl = buf.readUInt8(i+13)\n common.blueChnl = buf.readUInt8(i+14)\n return common\n}\n\nfunction readPages(buf, i, size) {\n var pages = []\n var text = readNameNT(buf, i)\n var len = text.length+1\n var count = size / len\n for (var c=0; c element')\n var pages = pageRoot.getElementsByTagName('page')\n for (var i=0; i 2) {\n var lastSlashIndex = res.lastIndexOf('/');\n if (lastSlashIndex !== res.length - 1) {\n if (lastSlashIndex === -1) {\n res = '';\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf('/');\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n } else if (res.length === 2 || res.length === 1) {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n if (res.length > 0)\n res += '/..';\n else\n res = '..';\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0)\n res += '/' + path.slice(lastSlash + 1, i);\n else\n res = path.slice(lastSlash + 1, i);\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n } else if (code === 46 /*.*/ && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n\nfunction _format(sep, pathObject) {\n var dir = pathObject.dir || pathObject.root;\n var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');\n if (!dir) {\n return base;\n }\n if (dir === pathObject.root) {\n return dir + base;\n }\n return dir + sep + base;\n}\n\nvar posix = {\n // path.resolve([from ...], to)\n resolve: function resolve() {\n var resolvedPath = '';\n var resolvedAbsolute = false;\n var cwd;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path;\n if (i >= 0)\n path = arguments[i];\n else {\n if (cwd === undefined)\n cwd = process.cwd();\n path = cwd;\n }\n\n assertPath(path);\n\n // Skip empty entries\n if (path.length === 0) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/;\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);\n\n if (resolvedAbsolute) {\n if (resolvedPath.length > 0)\n return '/' + resolvedPath;\n else\n return '/';\n } else if (resolvedPath.length > 0) {\n return resolvedPath;\n } else {\n return '.';\n }\n },\n\n normalize: function normalize(path) {\n assertPath(path);\n\n if (path.length === 0) return '.';\n\n var isAbsolute = path.charCodeAt(0) === 47 /*/*/;\n var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;\n\n // Normalize the path\n path = normalizeStringPosix(path, !isAbsolute);\n\n if (path.length === 0 && !isAbsolute) path = '.';\n if (path.length > 0 && trailingSeparator) path += '/';\n\n if (isAbsolute) return '/' + path;\n return path;\n },\n\n isAbsolute: function isAbsolute(path) {\n assertPath(path);\n return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;\n },\n\n join: function join() {\n if (arguments.length === 0)\n return '.';\n var joined;\n for (var i = 0; i < arguments.length; ++i) {\n var arg = arguments[i];\n assertPath(arg);\n if (arg.length > 0) {\n if (joined === undefined)\n joined = arg;\n else\n joined += '/' + arg;\n }\n }\n if (joined === undefined)\n return '.';\n return posix.normalize(joined);\n },\n\n relative: function relative(from, to) {\n assertPath(from);\n assertPath(to);\n\n if (from === to) return '';\n\n from = posix.resolve(from);\n to = posix.resolve(to);\n\n if (from === to) return '';\n\n // Trim any leading backslashes\n var fromStart = 1;\n for (; fromStart < from.length; ++fromStart) {\n if (from.charCodeAt(fromStart) !== 47 /*/*/)\n break;\n }\n var fromEnd = from.length;\n var fromLen = fromEnd - fromStart;\n\n // Trim any leading backslashes\n var toStart = 1;\n for (; toStart < to.length; ++toStart) {\n if (to.charCodeAt(toStart) !== 47 /*/*/)\n break;\n }\n var toEnd = to.length;\n var toLen = toEnd - toStart;\n\n // Compare paths to find the longest common path from root\n var length = fromLen < toLen ? fromLen : toLen;\n var lastCommonSep = -1;\n var i = 0;\n for (; i <= length; ++i) {\n if (i === length) {\n if (toLen > length) {\n if (to.charCodeAt(toStart + i) === 47 /*/*/) {\n // We get here if `from` is the exact base path for `to`.\n // For example: from='/foo/bar'; to='/foo/bar/baz'\n return to.slice(toStart + i + 1);\n } else if (i === 0) {\n // We get here if `from` is the root\n // For example: from='/'; to='/foo'\n return to.slice(toStart + i);\n }\n } else if (fromLen > length) {\n if (from.charCodeAt(fromStart + i) === 47 /*/*/) {\n // We get here if `to` is the exact base path for `from`.\n // For example: from='/foo/bar/baz'; to='/foo/bar'\n lastCommonSep = i;\n } else if (i === 0) {\n // We get here if `to` is the root.\n // For example: from='/foo'; to='/'\n lastCommonSep = 0;\n }\n }\n break;\n }\n var fromCode = from.charCodeAt(fromStart + i);\n var toCode = to.charCodeAt(toStart + i);\n if (fromCode !== toCode)\n break;\n else if (fromCode === 47 /*/*/)\n lastCommonSep = i;\n }\n\n var out = '';\n // Generate the relative path based on the path difference between `to`\n // and `from`\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {\n if (out.length === 0)\n out += '..';\n else\n out += '/..';\n }\n }\n\n // Lastly, append the rest of the destination (`to`) path that comes after\n // the common path parts\n if (out.length > 0)\n return out + to.slice(toStart + lastCommonSep);\n else {\n toStart += lastCommonSep;\n if (to.charCodeAt(toStart) === 47 /*/*/)\n ++toStart;\n return to.slice(toStart);\n }\n },\n\n _makeLong: function _makeLong(path) {\n return path;\n },\n\n dirname: function dirname(path) {\n assertPath(path);\n if (path.length === 0) return '.';\n var code = path.charCodeAt(0);\n var hasRoot = code === 47 /*/*/;\n var end = -1;\n var matchedSlash = true;\n for (var i = path.length - 1; i >= 1; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n if (end === -1) return hasRoot ? '/' : '.';\n if (hasRoot && end === 1) return '//';\n return path.slice(0, end);\n },\n\n basename: function basename(path, ext) {\n if (ext !== undefined && typeof ext !== 'string') throw new TypeError('\"ext\" argument must be a string');\n assertPath(path);\n\n var start = 0;\n var end = -1;\n var matchedSlash = true;\n var i;\n\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {\n if (ext.length === path.length && ext === path) return '';\n var extIdx = ext.length - 1;\n var firstNonSlashEnd = -1;\n for (i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else {\n if (firstNonSlashEnd === -1) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0) {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx)) {\n if (--extIdx === -1) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n } else {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n\n if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length;\n return path.slice(start, end);\n } else {\n for (i = path.length - 1; i >= 0; --i) {\n if (path.charCodeAt(i) === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n return path.slice(start, end);\n }\n },\n\n extname: function extname(path) {\n assertPath(path);\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n for (var i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n return '';\n }\n return path.slice(startDot, end);\n },\n\n format: function format(pathObject) {\n if (pathObject === null || typeof pathObject !== 'object') {\n throw new TypeError('The \"pathObject\" argument must be of type Object. Received type ' + typeof pathObject);\n }\n return _format('/', pathObject);\n },\n\n parse: function parse(path) {\n assertPath(path);\n\n var ret = { root: '', dir: '', base: '', ext: '', name: '' };\n if (path.length === 0) return ret;\n var code = path.charCodeAt(0);\n var isAbsolute = code === 47 /*/*/;\n var start;\n if (isAbsolute) {\n ret.root = '/';\n start = 1;\n } else {\n start = 0;\n }\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n var i = path.length - 1;\n\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n\n // Get non-dir info\n for (; i >= start; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n if (end !== -1) {\n if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end);\n }\n } else {\n if (startPart === 0 && isAbsolute) {\n ret.name = path.slice(1, startDot);\n ret.base = path.slice(1, end);\n } else {\n ret.name = path.slice(startPart, startDot);\n ret.base = path.slice(startPart, end);\n }\n ret.ext = path.slice(startDot, end);\n }\n\n if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/';\n\n return ret;\n },\n\n sep: '/',\n delimiter: ':',\n win32: null,\n posix: null\n};\n\nposix.posix = posix;\n\nmodule.exports = posix;\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.Deferred = void 0;\r\nclass Deferred {\r\n constructor() {\r\n this.resolve = () => null;\r\n this.reject = () => null;\r\n this.promise = new Promise((resolve, reject) => {\r\n this.reject = reject;\r\n this.resolve = resolve;\r\n });\r\n }\r\n}\r\nexports.Deferred = Deferred;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.EndOfStreamError = exports.defaultMessages = void 0;\r\nexports.defaultMessages = 'End-Of-Stream';\r\n/**\r\n * Thrown on read operation of the end of file or stream has been reached\r\n */\r\nclass EndOfStreamError extends Error {\r\n constructor() {\r\n super(exports.defaultMessages);\r\n }\r\n}\r\nexports.EndOfStreamError = EndOfStreamError;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.StreamReader = exports.EndOfStreamError = void 0;\r\nconst EndOfFileStream_1 = require(\"./EndOfFileStream\");\r\nconst Deferred_1 = require(\"./Deferred\");\r\nvar EndOfFileStream_2 = require(\"./EndOfFileStream\");\r\nObject.defineProperty(exports, \"EndOfStreamError\", { enumerable: true, get: function () { return EndOfFileStream_2.EndOfStreamError; } });\r\nconst maxStreamReadSize = 1 * 1024 * 1024; // Maximum request length on read-stream operation\r\nclass StreamReader {\r\n constructor(s) {\r\n this.s = s;\r\n /**\r\n * Deferred used for postponed read request (as not data is yet available to read)\r\n */\r\n this.deferred = null;\r\n this.endOfStream = false;\r\n /**\r\n * Store peeked data\r\n * @type {Array}\r\n */\r\n this.peekQueue = [];\r\n if (!s.read || !s.once) {\r\n throw new Error('Expected an instance of stream.Readable');\r\n }\r\n this.s.once('end', () => this.reject(new EndOfFileStream_1.EndOfStreamError()));\r\n this.s.once('error', err => this.reject(err));\r\n this.s.once('close', () => this.reject(new Error('Stream closed')));\r\n }\r\n /**\r\n * Read ahead (peek) from stream. Subsequent read or peeks will return the same data\r\n * @param uint8Array - Uint8Array (or Buffer) to store data read from stream in\r\n * @param offset - Offset target\r\n * @param length - Number of bytes to read\r\n * @returns Number of bytes peeked\r\n */\r\n async peek(uint8Array, offset, length) {\r\n const bytesRead = await this.read(uint8Array, offset, length);\r\n this.peekQueue.push(uint8Array.subarray(offset, offset + bytesRead)); // Put read data back to peek buffer\r\n return bytesRead;\r\n }\r\n /**\r\n * Read chunk from stream\r\n * @param buffer - Target Uint8Array (or Buffer) to store data read from stream in\r\n * @param offset - Offset target\r\n * @param length - Number of bytes to read\r\n * @returns Number of bytes read\r\n */\r\n async read(buffer, offset, length) {\r\n if (length === 0) {\r\n return 0;\r\n }\r\n if (this.peekQueue.length === 0 && this.endOfStream) {\r\n throw new EndOfFileStream_1.EndOfStreamError();\r\n }\r\n let remaining = length;\r\n let bytesRead = 0;\r\n // consume peeked data first\r\n while (this.peekQueue.length > 0 && remaining > 0) {\r\n const peekData = this.peekQueue.pop(); // Front of queue\r\n if (!peekData)\r\n throw new Error('peekData should be defined');\r\n const lenCopy = Math.min(peekData.length, remaining);\r\n buffer.set(peekData.subarray(0, lenCopy), offset + bytesRead);\r\n bytesRead += lenCopy;\r\n remaining -= lenCopy;\r\n if (lenCopy < peekData.length) {\r\n // remainder back to queue\r\n this.peekQueue.push(peekData.subarray(lenCopy));\r\n }\r\n }\r\n // continue reading from stream if required\r\n while (remaining > 0 && !this.endOfStream) {\r\n const reqLen = Math.min(remaining, maxStreamReadSize);\r\n const chunkLen = await this.readFromStream(buffer, offset + bytesRead, reqLen);\r\n bytesRead += chunkLen;\r\n if (chunkLen < reqLen)\r\n break;\r\n remaining -= chunkLen;\r\n }\r\n return bytesRead;\r\n }\r\n /**\r\n * Read chunk from stream\r\n * @param buffer Target Uint8Array (or Buffer) to store data read from stream in\r\n * @param offset Offset target\r\n * @param length Number of bytes to read\r\n * @returns Number of bytes read\r\n */\r\n async readFromStream(buffer, offset, length) {\r\n const readBuffer = this.s.read(length);\r\n if (readBuffer) {\r\n buffer.set(readBuffer, offset);\r\n return readBuffer.length;\r\n }\r\n else {\r\n const request = {\r\n buffer,\r\n offset,\r\n length,\r\n deferred: new Deferred_1.Deferred()\r\n };\r\n this.deferred = request.deferred;\r\n this.s.once('readable', () => {\r\n this.readDeferred(request);\r\n });\r\n return request.deferred.promise;\r\n }\r\n }\r\n /**\r\n * Process deferred read request\r\n * @param request Deferred read request\r\n */\r\n readDeferred(request) {\r\n const readBuffer = this.s.read(request.length);\r\n if (readBuffer) {\r\n request.buffer.set(readBuffer, request.offset);\r\n request.deferred.resolve(readBuffer.length);\r\n this.deferred = null;\r\n }\r\n else {\r\n this.s.once('readable', () => {\r\n this.readDeferred(request);\r\n });\r\n }\r\n }\r\n reject(err) {\r\n this.endOfStream = true;\r\n if (this.deferred) {\r\n this.deferred.reject(err);\r\n this.deferred = null;\r\n }\r\n }\r\n}\r\nexports.StreamReader = StreamReader;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.StreamReader = exports.EndOfStreamError = void 0;\r\nvar EndOfFileStream_1 = require(\"./EndOfFileStream\");\r\nObject.defineProperty(exports, \"EndOfStreamError\", { enumerable: true, get: function () { return EndOfFileStream_1.EndOfStreamError; } });\r\nvar StreamReader_1 = require(\"./StreamReader\");\r\nObject.defineProperty(exports, \"StreamReader\", { enumerable: true, get: function () { return StreamReader_1.StreamReader; } });\r\n","'use strict';\n\nmodule.exports = pixelmatch;\n\nfunction pixelmatch(img1, img2, output, width, height, options) {\n\n if (!options) options = {};\n\n var threshold = options.threshold === undefined ? 0.1 : options.threshold;\n\n // maximum acceptable square distance between two colors;\n // 35215 is the maximum possible value for the YIQ difference metric\n var maxDelta = 35215 * threshold * threshold,\n diff = 0;\n\n // compare each pixel of one image against the other one\n for (var y = 0; y < height; y++) {\n for (var x = 0; x < width; x++) {\n\n var pos = (y * width + x) * 4;\n\n // squared YUV distance between colors at this pixel position\n var delta = colorDelta(img1, img2, pos, pos);\n\n // the color difference is above the threshold\n if (delta > maxDelta) {\n // check it's a real rendering difference or just anti-aliasing\n if (!options.includeAA && (antialiased(img1, x, y, width, height, img2) ||\n antialiased(img2, x, y, width, height, img1))) {\n // one of the pixels is anti-aliasing; draw as yellow and do not count as difference\n if (output) drawPixel(output, pos, 255, 255, 0);\n\n } else {\n // found substantial difference not caused by anti-aliasing; draw it as red\n if (output) drawPixel(output, pos, 255, 0, 0);\n diff++;\n }\n\n } else if (output) {\n // pixels are similar; draw background as grayscale image blended with white\n var val = blend(grayPixel(img1, pos), 0.1);\n drawPixel(output, pos, val, val, val);\n }\n }\n }\n\n // return the number of different pixels\n return diff;\n}\n\n// check if a pixel is likely a part of anti-aliasing;\n// based on \"Anti-aliased Pixel and Intensity Slope Detector\" paper by V. Vysniauskas, 2009\n\nfunction antialiased(img, x1, y1, width, height, img2) {\n var x0 = Math.max(x1 - 1, 0),\n y0 = Math.max(y1 - 1, 0),\n x2 = Math.min(x1 + 1, width - 1),\n y2 = Math.min(y1 + 1, height - 1),\n pos = (y1 * width + x1) * 4,\n zeroes = 0,\n positives = 0,\n negatives = 0,\n min = 0,\n max = 0,\n minX, minY, maxX, maxY;\n\n // go through 8 adjacent pixels\n for (var x = x0; x <= x2; x++) {\n for (var y = y0; y <= y2; y++) {\n if (x === x1 && y === y1) continue;\n\n // brightness delta between the center pixel and adjacent one\n var delta = colorDelta(img, img, pos, (y * width + x) * 4, true);\n\n // count the number of equal, darker and brighter adjacent pixels\n if (delta === 0) zeroes++;\n else if (delta < 0) negatives++;\n else if (delta > 0) positives++;\n\n // if found more than 2 equal siblings, it's definitely not anti-aliasing\n if (zeroes > 2) return false;\n\n if (!img2) continue;\n\n // remember the darkest pixel\n if (delta < min) {\n min = delta;\n minX = x;\n minY = y;\n }\n // remember the brightest pixel\n if (delta > max) {\n max = delta;\n maxX = x;\n maxY = y;\n }\n }\n }\n\n if (!img2) return true;\n\n // if there are no both darker and brighter pixels among siblings, it's not anti-aliasing\n if (negatives === 0 || positives === 0) return false;\n\n // if either the darkest or the brightest pixel has more than 2 equal siblings in both images\n // (definitely not anti-aliased), this pixel is anti-aliased\n return (!antialiased(img, minX, minY, width, height) && !antialiased(img2, minX, minY, width, height)) ||\n (!antialiased(img, maxX, maxY, width, height) && !antialiased(img2, maxX, maxY, width, height));\n}\n\n// calculate color difference according to the paper \"Measuring perceived color difference\n// using YIQ NTSC transmission color space in mobile applications\" by Y. Kotsarenko and F. Ramos\n\nfunction colorDelta(img1, img2, k, m, yOnly) {\n var a1 = img1[k + 3] / 255,\n a2 = img2[m + 3] / 255,\n\n r1 = blend(img1[k + 0], a1),\n g1 = blend(img1[k + 1], a1),\n b1 = blend(img1[k + 2], a1),\n\n r2 = blend(img2[m + 0], a2),\n g2 = blend(img2[m + 1], a2),\n b2 = blend(img2[m + 2], a2),\n\n y = rgb2y(r1, g1, b1) - rgb2y(r2, g2, b2);\n\n if (yOnly) return y; // brightness difference only\n\n var i = rgb2i(r1, g1, b1) - rgb2i(r2, g2, b2),\n q = rgb2q(r1, g1, b1) - rgb2q(r2, g2, b2);\n\n return 0.5053 * y * y + 0.299 * i * i + 0.1957 * q * q;\n}\n\nfunction rgb2y(r, g, b) { return r * 0.29889531 + g * 0.58662247 + b * 0.11448223; }\nfunction rgb2i(r, g, b) { return r * 0.59597799 - g * 0.27417610 - b * 0.32180189; }\nfunction rgb2q(r, g, b) { return r * 0.21147017 - g * 0.52261711 + b * 0.31114694; }\n\n// blend semi-transparent color with white\nfunction blend(c, a) {\n return 255 + (c - 255) * a;\n}\n\nfunction drawPixel(output, pos, r, g, b) {\n output[pos + 0] = r;\n output[pos + 1] = g;\n output[pos + 2] = b;\n output[pos + 3] = 255;\n}\n\nfunction grayPixel(img, i) {\n var a = img[i + 3] / 255,\n r = blend(img[i + 0], a),\n g = blend(img[i + 1], a),\n b = blend(img[i + 2], a);\n return rgb2y(r, g, b);\n}\n","(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.png = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o= data.length) {\n throw new Error(\"Ran out of data\");\n }\n\n let pixel = data[rawPos];\n pxData[pxPos] = pixel;\n pxData[pxPos + 1] = pixel;\n pxData[pxPos + 2] = pixel;\n pxData[pxPos + 3] = data[rawPos + 1];\n },\n\n // 3 - RGB\n // 0: 0, 1: 1, 2: 2, 3: 0xff\n function (pxData, data, pxPos, rawPos) {\n if (rawPos + 2 >= data.length) {\n throw new Error(\"Ran out of data\");\n }\n\n pxData[pxPos] = data[rawPos];\n pxData[pxPos + 1] = data[rawPos + 1];\n pxData[pxPos + 2] = data[rawPos + 2];\n pxData[pxPos + 3] = 0xff;\n },\n\n // 4 - RGBA\n // 0: 0, 1: 1, 2: 2, 3: 3\n function (pxData, data, pxPos, rawPos) {\n if (rawPos + 3 >= data.length) {\n throw new Error(\"Ran out of data\");\n }\n\n pxData[pxPos] = data[rawPos];\n pxData[pxPos + 1] = data[rawPos + 1];\n pxData[pxPos + 2] = data[rawPos + 2];\n pxData[pxPos + 3] = data[rawPos + 3];\n },\n];\n\nlet pixelBppCustomMapper = [\n // 0 - dummy entry\n function () {},\n\n // 1 - L\n // 0: 0, 1: 0, 2: 0, 3: 0xff\n function (pxData, pixelData, pxPos, maxBit) {\n let pixel = pixelData[0];\n pxData[pxPos] = pixel;\n pxData[pxPos + 1] = pixel;\n pxData[pxPos + 2] = pixel;\n pxData[pxPos + 3] = maxBit;\n },\n\n // 2 - LA\n // 0: 0, 1: 0, 2: 0, 3: 1\n function (pxData, pixelData, pxPos) {\n let pixel = pixelData[0];\n pxData[pxPos] = pixel;\n pxData[pxPos + 1] = pixel;\n pxData[pxPos + 2] = pixel;\n pxData[pxPos + 3] = pixelData[1];\n },\n\n // 3 - RGB\n // 0: 0, 1: 1, 2: 2, 3: 0xff\n function (pxData, pixelData, pxPos, maxBit) {\n pxData[pxPos] = pixelData[0];\n pxData[pxPos + 1] = pixelData[1];\n pxData[pxPos + 2] = pixelData[2];\n pxData[pxPos + 3] = maxBit;\n },\n\n // 4 - RGBA\n // 0: 0, 1: 1, 2: 2, 3: 3\n function (pxData, pixelData, pxPos) {\n pxData[pxPos] = pixelData[0];\n pxData[pxPos + 1] = pixelData[1];\n pxData[pxPos + 2] = pixelData[2];\n pxData[pxPos + 3] = pixelData[3];\n },\n];\n\nfunction bitRetriever(data, depth) {\n let leftOver = [];\n let i = 0;\n\n function split() {\n if (i === data.length) {\n throw new Error(\"Ran out of data\");\n }\n let byte = data[i];\n i++;\n let byte8, byte7, byte6, byte5, byte4, byte3, byte2, byte1;\n switch (depth) {\n default:\n throw new Error(\"unrecognised depth\");\n case 16:\n byte2 = data[i];\n i++;\n leftOver.push((byte << 8) + byte2);\n break;\n case 4:\n byte2 = byte & 0x0f;\n byte1 = byte >> 4;\n leftOver.push(byte1, byte2);\n break;\n case 2:\n byte4 = byte & 3;\n byte3 = (byte >> 2) & 3;\n byte2 = (byte >> 4) & 3;\n byte1 = (byte >> 6) & 3;\n leftOver.push(byte1, byte2, byte3, byte4);\n break;\n case 1:\n byte8 = byte & 1;\n byte7 = (byte >> 1) & 1;\n byte6 = (byte >> 2) & 1;\n byte5 = (byte >> 3) & 1;\n byte4 = (byte >> 4) & 1;\n byte3 = (byte >> 5) & 1;\n byte2 = (byte >> 6) & 1;\n byte1 = (byte >> 7) & 1;\n leftOver.push(byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8);\n break;\n }\n }\n\n return {\n get: function (count) {\n while (leftOver.length < count) {\n split();\n }\n let returner = leftOver.slice(0, count);\n leftOver = leftOver.slice(count);\n return returner;\n },\n resetAfterLine: function () {\n leftOver.length = 0;\n },\n end: function () {\n if (i !== data.length) {\n throw new Error(\"extra data found\");\n }\n },\n };\n}\n\nfunction mapImage8Bit(image, pxData, getPxPos, bpp, data, rawPos) {\n // eslint-disable-line max-params\n let imageWidth = image.width;\n let imageHeight = image.height;\n let imagePass = image.index;\n for (let y = 0; y < imageHeight; y++) {\n for (let x = 0; x < imageWidth; x++) {\n let pxPos = getPxPos(x, y, imagePass);\n pixelBppMapper[bpp](pxData, data, pxPos, rawPos);\n rawPos += bpp; //eslint-disable-line no-param-reassign\n }\n }\n return rawPos;\n}\n\nfunction mapImageCustomBit(image, pxData, getPxPos, bpp, bits, maxBit) {\n // eslint-disable-line max-params\n let imageWidth = image.width;\n let imageHeight = image.height;\n let imagePass = image.index;\n for (let y = 0; y < imageHeight; y++) {\n for (let x = 0; x < imageWidth; x++) {\n let pixelData = bits.get(bpp);\n let pxPos = getPxPos(x, y, imagePass);\n pixelBppCustomMapper[bpp](pxData, pixelData, pxPos, maxBit);\n }\n bits.resetAfterLine();\n }\n}\n\nexports.dataToBitMap = function (data, bitmapInfo) {\n let width = bitmapInfo.width;\n let height = bitmapInfo.height;\n let depth = bitmapInfo.depth;\n let bpp = bitmapInfo.bpp;\n let interlace = bitmapInfo.interlace;\n let bits;\n\n if (depth !== 8) {\n bits = bitRetriever(data, depth);\n }\n let pxData;\n if (depth <= 8) {\n pxData = Buffer.alloc(width * height * 4);\n } else {\n pxData = new Uint16Array(width * height * 4);\n }\n let maxBit = Math.pow(2, depth) - 1;\n let rawPos = 0;\n let images;\n let getPxPos;\n\n if (interlace) {\n images = interlaceUtils.getImagePasses(width, height);\n getPxPos = interlaceUtils.getInterlaceIterator(width, height);\n } else {\n let nonInterlacedPxPos = 0;\n getPxPos = function () {\n let returner = nonInterlacedPxPos;\n nonInterlacedPxPos += 4;\n return returner;\n };\n images = [{ width: width, height: height }];\n }\n\n for (let imageIndex = 0; imageIndex < images.length; imageIndex++) {\n if (depth === 8) {\n rawPos = mapImage8Bit(\n images[imageIndex],\n pxData,\n getPxPos,\n bpp,\n data,\n rawPos\n );\n } else {\n mapImageCustomBit(\n images[imageIndex],\n pxData,\n getPxPos,\n bpp,\n bits,\n maxBit\n );\n }\n }\n if (depth === 8) {\n if (rawPos !== data.length) {\n throw new Error(\"extra data found\");\n }\n } else {\n bits.end();\n }\n\n return pxData;\n};\n\n}).call(this)}).call(this,require(\"buffer\").Buffer)\n},{\"./interlace\":11,\"buffer\":33}],2:[function(require,module,exports){\n(function (Buffer){(function (){\n\"use strict\";\n\nlet constants = require(\"./constants\");\n\nmodule.exports = function (dataIn, width, height, options) {\n let outHasAlpha =\n [constants.COLORTYPE_COLOR_ALPHA, constants.COLORTYPE_ALPHA].indexOf(\n options.colorType\n ) !== -1;\n if (options.colorType === options.inputColorType) {\n let bigEndian = (function () {\n let buffer = new ArrayBuffer(2);\n new DataView(buffer).setInt16(0, 256, true /* littleEndian */);\n // Int16Array uses the platform's endianness.\n return new Int16Array(buffer)[0] !== 256;\n })();\n // If no need to convert to grayscale and alpha is present/absent in both, take a fast route\n if (options.bitDepth === 8 || (options.bitDepth === 16 && bigEndian)) {\n return dataIn;\n }\n }\n\n // map to a UInt16 array if data is 16bit, fix endianness below\n let data = options.bitDepth !== 16 ? dataIn : new Uint16Array(dataIn.buffer);\n\n let maxValue = 255;\n let inBpp = constants.COLORTYPE_TO_BPP_MAP[options.inputColorType];\n if (inBpp === 4 && !options.inputHasAlpha) {\n inBpp = 3;\n }\n let outBpp = constants.COLORTYPE_TO_BPP_MAP[options.colorType];\n if (options.bitDepth === 16) {\n maxValue = 65535;\n outBpp *= 2;\n }\n let outData = Buffer.alloc(width * height * outBpp);\n\n let inIndex = 0;\n let outIndex = 0;\n\n let bgColor = options.bgColor || {};\n if (bgColor.red === undefined) {\n bgColor.red = maxValue;\n }\n if (bgColor.green === undefined) {\n bgColor.green = maxValue;\n }\n if (bgColor.blue === undefined) {\n bgColor.blue = maxValue;\n }\n\n function getRGBA() {\n let red;\n let green;\n let blue;\n let alpha = maxValue;\n switch (options.inputColorType) {\n case constants.COLORTYPE_COLOR_ALPHA:\n alpha = data[inIndex + 3];\n red = data[inIndex];\n green = data[inIndex + 1];\n blue = data[inIndex + 2];\n break;\n case constants.COLORTYPE_COLOR:\n red = data[inIndex];\n green = data[inIndex + 1];\n blue = data[inIndex + 2];\n break;\n case constants.COLORTYPE_ALPHA:\n alpha = data[inIndex + 1];\n red = data[inIndex];\n green = red;\n blue = red;\n break;\n case constants.COLORTYPE_GRAYSCALE:\n red = data[inIndex];\n green = red;\n blue = red;\n break;\n default:\n throw new Error(\n \"input color type:\" +\n options.inputColorType +\n \" is not supported at present\"\n );\n }\n\n if (options.inputHasAlpha) {\n if (!outHasAlpha) {\n alpha /= maxValue;\n red = Math.min(\n Math.max(Math.round((1 - alpha) * bgColor.red + alpha * red), 0),\n maxValue\n );\n green = Math.min(\n Math.max(Math.round((1 - alpha) * bgColor.green + alpha * green), 0),\n maxValue\n );\n blue = Math.min(\n Math.max(Math.round((1 - alpha) * bgColor.blue + alpha * blue), 0),\n maxValue\n );\n }\n }\n return { red: red, green: green, blue: blue, alpha: alpha };\n }\n\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n let rgba = getRGBA(data, inIndex);\n\n switch (options.colorType) {\n case constants.COLORTYPE_COLOR_ALPHA:\n case constants.COLORTYPE_COLOR:\n if (options.bitDepth === 8) {\n outData[outIndex] = rgba.red;\n outData[outIndex + 1] = rgba.green;\n outData[outIndex + 2] = rgba.blue;\n if (outHasAlpha) {\n outData[outIndex + 3] = rgba.alpha;\n }\n } else {\n outData.writeUInt16BE(rgba.red, outIndex);\n outData.writeUInt16BE(rgba.green, outIndex + 2);\n outData.writeUInt16BE(rgba.blue, outIndex + 4);\n if (outHasAlpha) {\n outData.writeUInt16BE(rgba.alpha, outIndex + 6);\n }\n }\n break;\n case constants.COLORTYPE_ALPHA:\n case constants.COLORTYPE_GRAYSCALE: {\n // Convert to grayscale and alpha\n let grayscale = (rgba.red + rgba.green + rgba.blue) / 3;\n if (options.bitDepth === 8) {\n outData[outIndex] = grayscale;\n if (outHasAlpha) {\n outData[outIndex + 1] = rgba.alpha;\n }\n } else {\n outData.writeUInt16BE(grayscale, outIndex);\n if (outHasAlpha) {\n outData.writeUInt16BE(rgba.alpha, outIndex + 2);\n }\n }\n break;\n }\n default:\n throw new Error(\"unrecognised color Type \" + options.colorType);\n }\n\n inIndex += inBpp;\n outIndex += outBpp;\n }\n }\n\n return outData;\n};\n\n}).call(this)}).call(this,require(\"buffer\").Buffer)\n},{\"./constants\":4,\"buffer\":33}],3:[function(require,module,exports){\n(function (process,Buffer){(function (){\n\"use strict\";\n\nlet util = require(\"util\");\nlet Stream = require(\"stream\");\n\nlet ChunkStream = (module.exports = function () {\n Stream.call(this);\n\n this._buffers = [];\n this._buffered = 0;\n\n this._reads = [];\n this._paused = false;\n\n this._encoding = \"utf8\";\n this.writable = true;\n});\nutil.inherits(ChunkStream, Stream);\n\nChunkStream.prototype.read = function (length, callback) {\n this._reads.push({\n length: Math.abs(length), // if length < 0 then at most this length\n allowLess: length < 0,\n func: callback,\n });\n\n process.nextTick(\n function () {\n this._process();\n\n // its paused and there is not enought data then ask for more\n if (this._paused && this._reads && this._reads.length > 0) {\n this._paused = false;\n\n this.emit(\"drain\");\n }\n }.bind(this)\n );\n};\n\nChunkStream.prototype.write = function (data, encoding) {\n if (!this.writable) {\n this.emit(\"error\", new Error(\"Stream not writable\"));\n return false;\n }\n\n let dataBuffer;\n if (Buffer.isBuffer(data)) {\n dataBuffer = data;\n } else {\n dataBuffer = Buffer.from(data, encoding || this._encoding);\n }\n\n this._buffers.push(dataBuffer);\n this._buffered += dataBuffer.length;\n\n this._process();\n\n // ok if there are no more read requests\n if (this._reads && this._reads.length === 0) {\n this._paused = true;\n }\n\n return this.writable && !this._paused;\n};\n\nChunkStream.prototype.end = function (data, encoding) {\n if (data) {\n this.write(data, encoding);\n }\n\n this.writable = false;\n\n // already destroyed\n if (!this._buffers) {\n return;\n }\n\n // enqueue or handle end\n if (this._buffers.length === 0) {\n this._end();\n } else {\n this._buffers.push(null);\n this._process();\n }\n};\n\nChunkStream.prototype.destroySoon = ChunkStream.prototype.end;\n\nChunkStream.prototype._end = function () {\n if (this._reads.length > 0) {\n this.emit(\"error\", new Error(\"Unexpected end of input\"));\n }\n\n this.destroy();\n};\n\nChunkStream.prototype.destroy = function () {\n if (!this._buffers) {\n return;\n }\n\n this.writable = false;\n this._reads = null;\n this._buffers = null;\n\n this.emit(\"close\");\n};\n\nChunkStream.prototype._processReadAllowingLess = function (read) {\n // ok there is any data so that we can satisfy this request\n this._reads.shift(); // == read\n\n // first we need to peek into first buffer\n let smallerBuf = this._buffers[0];\n\n // ok there is more data than we need\n if (smallerBuf.length > read.length) {\n this._buffered -= read.length;\n this._buffers[0] = smallerBuf.slice(read.length);\n\n read.func.call(this, smallerBuf.slice(0, read.length));\n } else {\n // ok this is less than maximum length so use it all\n this._buffered -= smallerBuf.length;\n this._buffers.shift(); // == smallerBuf\n\n read.func.call(this, smallerBuf);\n }\n};\n\nChunkStream.prototype._processRead = function (read) {\n this._reads.shift(); // == read\n\n let pos = 0;\n let count = 0;\n let data = Buffer.alloc(read.length);\n\n // create buffer for all data\n while (pos < read.length) {\n let buf = this._buffers[count++];\n let len = Math.min(buf.length, read.length - pos);\n\n buf.copy(data, pos, 0, len);\n pos += len;\n\n // last buffer wasn't used all so just slice it and leave\n if (len !== buf.length) {\n this._buffers[--count] = buf.slice(len);\n }\n }\n\n // remove all used buffers\n if (count > 0) {\n this._buffers.splice(0, count);\n }\n\n this._buffered -= read.length;\n\n read.func.call(this, data);\n};\n\nChunkStream.prototype._process = function () {\n try {\n // as long as there is any data and read requests\n while (this._buffered > 0 && this._reads && this._reads.length > 0) {\n let read = this._reads[0];\n\n // read any data (but no more than length)\n if (read.allowLess) {\n this._processReadAllowingLess(read);\n } else if (this._buffered >= read.length) {\n // ok we can meet some expectations\n\n this._processRead(read);\n } else {\n // not enought data to satisfy first request in queue\n // so we need to wait for more\n break;\n }\n }\n\n if (this._buffers && !this.writable) {\n this._end();\n }\n } catch (ex) {\n this.emit(\"error\", ex);\n }\n};\n\n}).call(this)}).call(this,require('_process'),require(\"buffer\").Buffer)\n},{\"_process\":60,\"buffer\":33,\"stream\":61,\"util\":81}],4:[function(require,module,exports){\n\"use strict\";\n\nmodule.exports = {\n PNG_SIGNATURE: [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a],\n\n TYPE_IHDR: 0x49484452,\n TYPE_IEND: 0x49454e44,\n TYPE_IDAT: 0x49444154,\n TYPE_PLTE: 0x504c5445,\n TYPE_tRNS: 0x74524e53, // eslint-disable-line camelcase\n TYPE_gAMA: 0x67414d41, // eslint-disable-line camelcase\n\n // color-type bits\n COLORTYPE_GRAYSCALE: 0,\n COLORTYPE_PALETTE: 1,\n COLORTYPE_COLOR: 2,\n COLORTYPE_ALPHA: 4, // e.g. grayscale and alpha\n\n // color-type combinations\n COLORTYPE_PALETTE_COLOR: 3,\n COLORTYPE_COLOR_ALPHA: 6,\n\n COLORTYPE_TO_BPP_MAP: {\n 0: 1,\n 2: 3,\n 3: 1,\n 4: 2,\n 6: 4,\n },\n\n GAMMA_DIVISION: 100000,\n};\n\n},{}],5:[function(require,module,exports){\n\"use strict\";\n\nlet crcTable = [];\n\n(function () {\n for (let i = 0; i < 256; i++) {\n let currentCrc = i;\n for (let j = 0; j < 8; j++) {\n if (currentCrc & 1) {\n currentCrc = 0xedb88320 ^ (currentCrc >>> 1);\n } else {\n currentCrc = currentCrc >>> 1;\n }\n }\n crcTable[i] = currentCrc;\n }\n})();\n\nlet CrcCalculator = (module.exports = function () {\n this._crc = -1;\n});\n\nCrcCalculator.prototype.write = function (data) {\n for (let i = 0; i < data.length; i++) {\n this._crc = crcTable[(this._crc ^ data[i]) & 0xff] ^ (this._crc >>> 8);\n }\n return true;\n};\n\nCrcCalculator.prototype.crc32 = function () {\n return this._crc ^ -1;\n};\n\nCrcCalculator.crc32 = function (buf) {\n let crc = -1;\n for (let i = 0; i < buf.length; i++) {\n crc = crcTable[(crc ^ buf[i]) & 0xff] ^ (crc >>> 8);\n }\n return crc ^ -1;\n};\n\n},{}],6:[function(require,module,exports){\n(function (Buffer){(function (){\n\"use strict\";\n\nlet paethPredictor = require(\"./paeth-predictor\");\n\nfunction filterNone(pxData, pxPos, byteWidth, rawData, rawPos) {\n for (let x = 0; x < byteWidth; x++) {\n rawData[rawPos + x] = pxData[pxPos + x];\n }\n}\n\nfunction filterSumNone(pxData, pxPos, byteWidth) {\n let sum = 0;\n let length = pxPos + byteWidth;\n\n for (let i = pxPos; i < length; i++) {\n sum += Math.abs(pxData[i]);\n }\n return sum;\n}\n\nfunction filterSub(pxData, pxPos, byteWidth, rawData, rawPos, bpp) {\n for (let x = 0; x < byteWidth; x++) {\n let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;\n let val = pxData[pxPos + x] - left;\n\n rawData[rawPos + x] = val;\n }\n}\n\nfunction filterSumSub(pxData, pxPos, byteWidth, bpp) {\n let sum = 0;\n for (let x = 0; x < byteWidth; x++) {\n let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;\n let val = pxData[pxPos + x] - left;\n\n sum += Math.abs(val);\n }\n\n return sum;\n}\n\nfunction filterUp(pxData, pxPos, byteWidth, rawData, rawPos) {\n for (let x = 0; x < byteWidth; x++) {\n let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;\n let val = pxData[pxPos + x] - up;\n\n rawData[rawPos + x] = val;\n }\n}\n\nfunction filterSumUp(pxData, pxPos, byteWidth) {\n let sum = 0;\n let length = pxPos + byteWidth;\n for (let x = pxPos; x < length; x++) {\n let up = pxPos > 0 ? pxData[x - byteWidth] : 0;\n let val = pxData[x] - up;\n\n sum += Math.abs(val);\n }\n\n return sum;\n}\n\nfunction filterAvg(pxData, pxPos, byteWidth, rawData, rawPos, bpp) {\n for (let x = 0; x < byteWidth; x++) {\n let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;\n let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;\n let val = pxData[pxPos + x] - ((left + up) >> 1);\n\n rawData[rawPos + x] = val;\n }\n}\n\nfunction filterSumAvg(pxData, pxPos, byteWidth, bpp) {\n let sum = 0;\n for (let x = 0; x < byteWidth; x++) {\n let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;\n let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;\n let val = pxData[pxPos + x] - ((left + up) >> 1);\n\n sum += Math.abs(val);\n }\n\n return sum;\n}\n\nfunction filterPaeth(pxData, pxPos, byteWidth, rawData, rawPos, bpp) {\n for (let x = 0; x < byteWidth; x++) {\n let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;\n let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;\n let upleft =\n pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0;\n let val = pxData[pxPos + x] - paethPredictor(left, up, upleft);\n\n rawData[rawPos + x] = val;\n }\n}\n\nfunction filterSumPaeth(pxData, pxPos, byteWidth, bpp) {\n let sum = 0;\n for (let x = 0; x < byteWidth; x++) {\n let left = x >= bpp ? pxData[pxPos + x - bpp] : 0;\n let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0;\n let upleft =\n pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0;\n let val = pxData[pxPos + x] - paethPredictor(left, up, upleft);\n\n sum += Math.abs(val);\n }\n\n return sum;\n}\n\nlet filters = {\n 0: filterNone,\n 1: filterSub,\n 2: filterUp,\n 3: filterAvg,\n 4: filterPaeth,\n};\n\nlet filterSums = {\n 0: filterSumNone,\n 1: filterSumSub,\n 2: filterSumUp,\n 3: filterSumAvg,\n 4: filterSumPaeth,\n};\n\nmodule.exports = function (pxData, width, height, options, bpp) {\n let filterTypes;\n if (!(\"filterType\" in options) || options.filterType === -1) {\n filterTypes = [0, 1, 2, 3, 4];\n } else if (typeof options.filterType === \"number\") {\n filterTypes = [options.filterType];\n } else {\n throw new Error(\"unrecognised filter types\");\n }\n\n if (options.bitDepth === 16) {\n bpp *= 2;\n }\n let byteWidth = width * bpp;\n let rawPos = 0;\n let pxPos = 0;\n let rawData = Buffer.alloc((byteWidth + 1) * height);\n\n let sel = filterTypes[0];\n\n for (let y = 0; y < height; y++) {\n if (filterTypes.length > 1) {\n // find best filter for this line (with lowest sum of values)\n let min = Infinity;\n\n for (let i = 0; i < filterTypes.length; i++) {\n let sum = filterSums[filterTypes[i]](pxData, pxPos, byteWidth, bpp);\n if (sum < min) {\n sel = filterTypes[i];\n min = sum;\n }\n }\n }\n\n rawData[rawPos] = sel;\n rawPos++;\n filters[sel](pxData, pxPos, byteWidth, rawData, rawPos, bpp);\n rawPos += byteWidth;\n pxPos += byteWidth;\n }\n return rawData;\n};\n\n}).call(this)}).call(this,require(\"buffer\").Buffer)\n},{\"./paeth-predictor\":15,\"buffer\":33}],7:[function(require,module,exports){\n(function (Buffer){(function (){\n\"use strict\";\n\nlet util = require(\"util\");\nlet ChunkStream = require(\"./chunkstream\");\nlet Filter = require(\"./filter-parse\");\n\nlet FilterAsync = (module.exports = function (bitmapInfo) {\n ChunkStream.call(this);\n\n let buffers = [];\n let that = this;\n this._filter = new Filter(bitmapInfo, {\n read: this.read.bind(this),\n write: function (buffer) {\n buffers.push(buffer);\n },\n complete: function () {\n that.emit(\"complete\", Buffer.concat(buffers));\n },\n });\n\n this._filter.start();\n});\nutil.inherits(FilterAsync, ChunkStream);\n\n}).call(this)}).call(this,require(\"buffer\").Buffer)\n},{\"./chunkstream\":3,\"./filter-parse\":9,\"buffer\":33,\"util\":81}],8:[function(require,module,exports){\n(function (Buffer){(function (){\n\"use strict\";\n\nlet SyncReader = require(\"./sync-reader\");\nlet Filter = require(\"./filter-parse\");\n\nexports.process = function (inBuffer, bitmapInfo) {\n let outBuffers = [];\n let reader = new SyncReader(inBuffer);\n let filter = new Filter(bitmapInfo, {\n read: reader.read.bind(reader),\n write: function (bufferPart) {\n outBuffers.push(bufferPart);\n },\n complete: function () {},\n });\n\n filter.start();\n reader.process();\n\n return Buffer.concat(outBuffers);\n};\n\n}).call(this)}).call(this,require(\"buffer\").Buffer)\n},{\"./filter-parse\":9,\"./sync-reader\":22,\"buffer\":33}],9:[function(require,module,exports){\n(function (Buffer){(function (){\n\"use strict\";\n\nlet interlaceUtils = require(\"./interlace\");\nlet paethPredictor = require(\"./paeth-predictor\");\n\nfunction getByteWidth(width, bpp, depth) {\n let byteWidth = width * bpp;\n if (depth !== 8) {\n byteWidth = Math.ceil(byteWidth / (8 / depth));\n }\n return byteWidth;\n}\n\nlet Filter = (module.exports = function (bitmapInfo, dependencies) {\n let width = bitmapInfo.width;\n let height = bitmapInfo.height;\n let interlace = bitmapInfo.interlace;\n let bpp = bitmapInfo.bpp;\n let depth = bitmapInfo.depth;\n\n this.read = dependencies.read;\n this.write = dependencies.write;\n this.complete = dependencies.complete;\n\n this._imageIndex = 0;\n this._images = [];\n if (interlace) {\n let passes = interlaceUtils.getImagePasses(width, height);\n for (let i = 0; i < passes.length; i++) {\n this._images.push({\n byteWidth: getByteWidth(passes[i].width, bpp, depth),\n height: passes[i].height,\n lineIndex: 0,\n });\n }\n } else {\n this._images.push({\n byteWidth: getByteWidth(width, bpp, depth),\n height: height,\n lineIndex: 0,\n });\n }\n\n // when filtering the line we look at the pixel to the left\n // the spec also says it is done on a byte level regardless of the number of pixels\n // so if the depth is byte compatible (8 or 16) we subtract the bpp in order to compare back\n // a pixel rather than just a different byte part. However if we are sub byte, we ignore.\n if (depth === 8) {\n this._xComparison = bpp;\n } else if (depth === 16) {\n this._xComparison = bpp * 2;\n } else {\n this._xComparison = 1;\n }\n});\n\nFilter.prototype.start = function () {\n this.read(\n this._images[this._imageIndex].byteWidth + 1,\n this._reverseFilterLine.bind(this)\n );\n};\n\nFilter.prototype._unFilterType1 = function (\n rawData,\n unfilteredLine,\n byteWidth\n) {\n let xComparison = this._xComparison;\n let xBiggerThan = xComparison - 1;\n\n for (let x = 0; x < byteWidth; x++) {\n let rawByte = rawData[1 + x];\n let f1Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0;\n unfilteredLine[x] = rawByte + f1Left;\n }\n};\n\nFilter.prototype._unFilterType2 = function (\n rawData,\n unfilteredLine,\n byteWidth\n) {\n let lastLine = this._lastLine;\n\n for (let x = 0; x < byteWidth; x++) {\n let rawByte = rawData[1 + x];\n let f2Up = lastLine ? lastLine[x] : 0;\n unfilteredLine[x] = rawByte + f2Up;\n }\n};\n\nFilter.prototype._unFilterType3 = function (\n rawData,\n unfilteredLine,\n byteWidth\n) {\n let xComparison = this._xComparison;\n let xBiggerThan = xComparison - 1;\n let lastLine = this._lastLine;\n\n for (let x = 0; x < byteWidth; x++) {\n let rawByte = rawData[1 + x];\n let f3Up = lastLine ? lastLine[x] : 0;\n let f3Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0;\n let f3Add = Math.floor((f3Left + f3Up) / 2);\n unfilteredLine[x] = rawByte + f3Add;\n }\n};\n\nFilter.prototype._unFilterType4 = function (\n rawData,\n unfilteredLine,\n byteWidth\n) {\n let xComparison = this._xComparison;\n let xBiggerThan = xComparison - 1;\n let lastLine = this._lastLine;\n\n for (let x = 0; x < byteWidth; x++) {\n let rawByte = rawData[1 + x];\n let f4Up = lastLine ? lastLine[x] : 0;\n let f4Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0;\n let f4UpLeft = x > xBiggerThan && lastLine ? lastLine[x - xComparison] : 0;\n let f4Add = paethPredictor(f4Left, f4Up, f4UpLeft);\n unfilteredLine[x] = rawByte + f4Add;\n }\n};\n\nFilter.prototype._reverseFilterLine = function (rawData) {\n let filter = rawData[0];\n let unfilteredLine;\n let currentImage = this._images[this._imageIndex];\n let byteWidth = currentImage.byteWidth;\n\n if (filter === 0) {\n unfilteredLine = rawData.slice(1, byteWidth + 1);\n } else {\n unfilteredLine = Buffer.alloc(byteWidth);\n\n switch (filter) {\n case 1:\n this._unFilterType1(rawData, unfilteredLine, byteWidth);\n break;\n case 2:\n this._unFilterType2(rawData, unfilteredLine, byteWidth);\n break;\n case 3:\n this._unFilterType3(rawData, unfilteredLine, byteWidth);\n break;\n case 4:\n this._unFilterType4(rawData, unfilteredLine, byteWidth);\n break;\n default:\n throw new Error(\"Unrecognised filter type - \" + filter);\n }\n }\n\n this.write(unfilteredLine);\n\n currentImage.lineIndex++;\n if (currentImage.lineIndex >= currentImage.height) {\n this._lastLine = null;\n this._imageIndex++;\n currentImage = this._images[this._imageIndex];\n } else {\n this._lastLine = unfilteredLine;\n }\n\n if (currentImage) {\n // read, using the byte width that may be from the new current image\n this.read(currentImage.byteWidth + 1, this._reverseFilterLine.bind(this));\n } else {\n this._lastLine = null;\n this.complete();\n }\n};\n\n}).call(this)}).call(this,require(\"buffer\").Buffer)\n},{\"./interlace\":11,\"./paeth-predictor\":15,\"buffer\":33}],10:[function(require,module,exports){\n(function (Buffer){(function (){\n\"use strict\";\n\nfunction dePalette(indata, outdata, width, height, palette) {\n let pxPos = 0;\n // use values from palette\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n let color = palette[indata[pxPos]];\n\n if (!color) {\n throw new Error(\"index \" + indata[pxPos] + \" not in palette\");\n }\n\n for (let i = 0; i < 4; i++) {\n outdata[pxPos + i] = color[i];\n }\n pxPos += 4;\n }\n }\n}\n\nfunction replaceTransparentColor(indata, outdata, width, height, transColor) {\n let pxPos = 0;\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n let makeTrans = false;\n\n if (transColor.length === 1) {\n if (transColor[0] === indata[pxPos]) {\n makeTrans = true;\n }\n } else if (\n transColor[0] === indata[pxPos] &&\n transColor[1] === indata[pxPos + 1] &&\n transColor[2] === indata[pxPos + 2]\n ) {\n makeTrans = true;\n }\n if (makeTrans) {\n for (let i = 0; i < 4; i++) {\n outdata[pxPos + i] = 0;\n }\n }\n pxPos += 4;\n }\n }\n}\n\nfunction scaleDepth(indata, outdata, width, height, depth) {\n let maxOutSample = 255;\n let maxInSample = Math.pow(2, depth) - 1;\n let pxPos = 0;\n\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) {\n for (let i = 0; i < 4; i++) {\n outdata[pxPos + i] = Math.floor(\n (indata[pxPos + i] * maxOutSample) / maxInSample + 0.5\n );\n }\n pxPos += 4;\n }\n }\n}\n\nmodule.exports = function (indata, imageData, skipRescale = false) {\n let depth = imageData.depth;\n let width = imageData.width;\n let height = imageData.height;\n let colorType = imageData.colorType;\n let transColor = imageData.transColor;\n let palette = imageData.palette;\n\n let outdata = indata; // only different for 16 bits\n\n if (colorType === 3) {\n // paletted\n dePalette(indata, outdata, width, height, palette);\n } else {\n if (transColor) {\n replaceTransparentColor(indata, outdata, width, height, transColor);\n }\n // if it needs scaling\n if (depth !== 8 && !skipRescale) {\n // if we need to change the buffer size\n if (depth === 16) {\n outdata = Buffer.alloc(width * height * 4);\n }\n scaleDepth(indata, outdata, width, height, depth);\n }\n }\n return outdata;\n};\n\n}).call(this)}).call(this,require(\"buffer\").Buffer)\n},{\"buffer\":33}],11:[function(require,module,exports){\n\"use strict\";\n\n// Adam 7\n// 0 1 2 3 4 5 6 7\n// 0 x 6 4 6 x 6 4 6\n// 1 7 7 7 7 7 7 7 7\n// 2 5 6 5 6 5 6 5 6\n// 3 7 7 7 7 7 7 7 7\n// 4 3 6 4 6 3 6 4 6\n// 5 7 7 7 7 7 7 7 7\n// 6 5 6 5 6 5 6 5 6\n// 7 7 7 7 7 7 7 7 7\n\nlet imagePasses = [\n {\n // pass 1 - 1px\n x: [0],\n y: [0],\n },\n {\n // pass 2 - 1px\n x: [4],\n y: [0],\n },\n {\n // pass 3 - 2px\n x: [0, 4],\n y: [4],\n },\n {\n // pass 4 - 4px\n x: [2, 6],\n y: [0, 4],\n },\n {\n // pass 5 - 8px\n x: [0, 2, 4, 6],\n y: [2, 6],\n },\n {\n // pass 6 - 16px\n x: [1, 3, 5, 7],\n y: [0, 2, 4, 6],\n },\n {\n // pass 7 - 32px\n x: [0, 1, 2, 3, 4, 5, 6, 7],\n y: [1, 3, 5, 7],\n },\n];\n\nexports.getImagePasses = function (width, height) {\n let images = [];\n let xLeftOver = width % 8;\n let yLeftOver = height % 8;\n let xRepeats = (width - xLeftOver) / 8;\n let yRepeats = (height - yLeftOver) / 8;\n for (let i = 0; i < imagePasses.length; i++) {\n let pass = imagePasses[i];\n let passWidth = xRepeats * pass.x.length;\n let passHeight = yRepeats * pass.y.length;\n for (let j = 0; j < pass.x.length; j++) {\n if (pass.x[j] < xLeftOver) {\n passWidth++;\n } else {\n break;\n }\n }\n for (let j = 0; j < pass.y.length; j++) {\n if (pass.y[j] < yLeftOver) {\n passHeight++;\n } else {\n break;\n }\n }\n if (passWidth > 0 && passHeight > 0) {\n images.push({ width: passWidth, height: passHeight, index: i });\n }\n }\n return images;\n};\n\nexports.getInterlaceIterator = function (width) {\n return function (x, y, pass) {\n let outerXLeftOver = x % imagePasses[pass].x.length;\n let outerX =\n ((x - outerXLeftOver) / imagePasses[pass].x.length) * 8 +\n imagePasses[pass].x[outerXLeftOver];\n let outerYLeftOver = y % imagePasses[pass].y.length;\n let outerY =\n ((y - outerYLeftOver) / imagePasses[pass].y.length) * 8 +\n imagePasses[pass].y[outerYLeftOver];\n return outerX * 4 + outerY * width * 4;\n };\n};\n\n},{}],12:[function(require,module,exports){\n(function (Buffer){(function (){\n\"use strict\";\n\nlet util = require(\"util\");\nlet Stream = require(\"stream\");\nlet constants = require(\"./constants\");\nlet Packer = require(\"./packer\");\n\nlet PackerAsync = (module.exports = function (opt) {\n Stream.call(this);\n\n let options = opt || {};\n\n this._packer = new Packer(options);\n this._deflate = this._packer.createDeflate();\n\n this.readable = true;\n});\nutil.inherits(PackerAsync, Stream);\n\nPackerAsync.prototype.pack = function (data, width, height, gamma) {\n // Signature\n this.emit(\"data\", Buffer.from(constants.PNG_SIGNATURE));\n this.emit(\"data\", this._packer.packIHDR(width, height));\n\n if (gamma) {\n this.emit(\"data\", this._packer.packGAMA(gamma));\n }\n\n let filteredData = this._packer.filterData(data, width, height);\n\n // compress it\n this._deflate.on(\"error\", this.emit.bind(this, \"error\"));\n\n this._deflate.on(\n \"data\",\n function (compressedData) {\n this.emit(\"data\", this._packer.packIDAT(compressedData));\n }.bind(this)\n );\n\n this._deflate.on(\n \"end\",\n function () {\n this.emit(\"data\", this._packer.packIEND());\n this.emit(\"end\");\n }.bind(this)\n );\n\n this._deflate.end(filteredData);\n};\n\n}).call(this)}).call(this,require(\"buffer\").Buffer)\n},{\"./constants\":4,\"./packer\":14,\"buffer\":33,\"stream\":61,\"util\":81}],13:[function(require,module,exports){\n(function (Buffer){(function (){\n\"use strict\";\n\nlet hasSyncZlib = true;\nlet zlib = require(\"zlib\");\nif (!zlib.deflateSync) {\n hasSyncZlib = false;\n}\nlet constants = require(\"./constants\");\nlet Packer = require(\"./packer\");\n\nmodule.exports = function (metaData, opt) {\n if (!hasSyncZlib) {\n throw new Error(\n \"To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0\"\n );\n }\n\n let options = opt || {};\n\n let packer = new Packer(options);\n\n let chunks = [];\n\n // Signature\n chunks.push(Buffer.from(constants.PNG_SIGNATURE));\n\n // Header\n chunks.push(packer.packIHDR(metaData.width, metaData.height));\n\n if (metaData.gamma) {\n chunks.push(packer.packGAMA(metaData.gamma));\n }\n\n let filteredData = packer.filterData(\n metaData.data,\n metaData.width,\n metaData.height\n );\n\n // compress it\n let compressedData = zlib.deflateSync(\n filteredData,\n packer.getDeflateOptions()\n );\n filteredData = null;\n\n if (!compressedData || !compressedData.length) {\n throw new Error(\"bad png - invalid compressed data response\");\n }\n chunks.push(packer.packIDAT(compressedData));\n\n // End\n chunks.push(packer.packIEND());\n\n return Buffer.concat(chunks);\n};\n\n}).call(this)}).call(this,require(\"buffer\").Buffer)\n},{\"./constants\":4,\"./packer\":14,\"buffer\":33,\"zlib\":32}],14:[function(require,module,exports){\n(function (Buffer){(function (){\n\"use strict\";\n\nlet constants = require(\"./constants\");\nlet CrcStream = require(\"./crc\");\nlet bitPacker = require(\"./bitpacker\");\nlet filter = require(\"./filter-pack\");\nlet zlib = require(\"zlib\");\n\nlet Packer = (module.exports = function (options) {\n this._options = options;\n\n options.deflateChunkSize = options.deflateChunkSize || 32 * 1024;\n options.deflateLevel =\n options.deflateLevel != null ? options.deflateLevel : 9;\n options.deflateStrategy =\n options.deflateStrategy != null ? options.deflateStrategy : 3;\n options.inputHasAlpha =\n options.inputHasAlpha != null ? options.inputHasAlpha : true;\n options.deflateFactory = options.deflateFactory || zlib.createDeflate;\n options.bitDepth = options.bitDepth || 8;\n // This is outputColorType\n options.colorType =\n typeof options.colorType === \"number\"\n ? options.colorType\n : constants.COLORTYPE_COLOR_ALPHA;\n options.inputColorType =\n typeof options.inputColorType === \"number\"\n ? options.inputColorType\n : constants.COLORTYPE_COLOR_ALPHA;\n\n if (\n [\n constants.COLORTYPE_GRAYSCALE,\n constants.COLORTYPE_COLOR,\n constants.COLORTYPE_COLOR_ALPHA,\n constants.COLORTYPE_ALPHA,\n ].indexOf(options.colorType) === -1\n ) {\n throw new Error(\n \"option color type:\" + options.colorType + \" is not supported at present\"\n );\n }\n if (\n [\n constants.COLORTYPE_GRAYSCALE,\n constants.COLORTYPE_COLOR,\n constants.COLORTYPE_COLOR_ALPHA,\n constants.COLORTYPE_ALPHA,\n ].indexOf(options.inputColorType) === -1\n ) {\n throw new Error(\n \"option input color type:\" +\n options.inputColorType +\n \" is not supported at present\"\n );\n }\n if (options.bitDepth !== 8 && options.bitDepth !== 16) {\n throw new Error(\n \"option bit depth:\" + options.bitDepth + \" is not supported at present\"\n );\n }\n});\n\nPacker.prototype.getDeflateOptions = function () {\n return {\n chunkSize: this._options.deflateChunkSize,\n level: this._options.deflateLevel,\n strategy: this._options.deflateStrategy,\n };\n};\n\nPacker.prototype.createDeflate = function () {\n return this._options.deflateFactory(this.getDeflateOptions());\n};\n\nPacker.prototype.filterData = function (data, width, height) {\n // convert to correct format for filtering (e.g. right bpp and bit depth)\n let packedData = bitPacker(data, width, height, this._options);\n\n // filter pixel data\n let bpp = constants.COLORTYPE_TO_BPP_MAP[this._options.colorType];\n let filteredData = filter(packedData, width, height, this._options, bpp);\n return filteredData;\n};\n\nPacker.prototype._packChunk = function (type, data) {\n let len = data ? data.length : 0;\n let buf = Buffer.alloc(len + 12);\n\n buf.writeUInt32BE(len, 0);\n buf.writeUInt32BE(type, 4);\n\n if (data) {\n data.copy(buf, 8);\n }\n\n buf.writeInt32BE(\n CrcStream.crc32(buf.slice(4, buf.length - 4)),\n buf.length - 4\n );\n return buf;\n};\n\nPacker.prototype.packGAMA = function (gamma) {\n let buf = Buffer.alloc(4);\n buf.writeUInt32BE(Math.floor(gamma * constants.GAMMA_DIVISION), 0);\n return this._packChunk(constants.TYPE_gAMA, buf);\n};\n\nPacker.prototype.packIHDR = function (width, height) {\n let buf = Buffer.alloc(13);\n buf.writeUInt32BE(width, 0);\n buf.writeUInt32BE(height, 4);\n buf[8] = this._options.bitDepth; // Bit depth\n buf[9] = this._options.colorType; // colorType\n buf[10] = 0; // compression\n buf[11] = 0; // filter\n buf[12] = 0; // interlace\n\n return this._packChunk(constants.TYPE_IHDR, buf);\n};\n\nPacker.prototype.packIDAT = function (data) {\n return this._packChunk(constants.TYPE_IDAT, data);\n};\n\nPacker.prototype.packIEND = function () {\n return this._packChunk(constants.TYPE_IEND, null);\n};\n\n}).call(this)}).call(this,require(\"buffer\").Buffer)\n},{\"./bitpacker\":2,\"./constants\":4,\"./crc\":5,\"./filter-pack\":6,\"buffer\":33,\"zlib\":32}],15:[function(require,module,exports){\n\"use strict\";\n\nmodule.exports = function paethPredictor(left, above, upLeft) {\n let paeth = left + above - upLeft;\n let pLeft = Math.abs(paeth - left);\n let pAbove = Math.abs(paeth - above);\n let pUpLeft = Math.abs(paeth - upLeft);\n\n if (pLeft <= pAbove && pLeft <= pUpLeft) {\n return left;\n }\n if (pAbove <= pUpLeft) {\n return above;\n }\n return upLeft;\n};\n\n},{}],16:[function(require,module,exports){\n\"use strict\";\n\nlet util = require(\"util\");\nlet zlib = require(\"zlib\");\nlet ChunkStream = require(\"./chunkstream\");\nlet FilterAsync = require(\"./filter-parse-async\");\nlet Parser = require(\"./parser\");\nlet bitmapper = require(\"./bitmapper\");\nlet formatNormaliser = require(\"./format-normaliser\");\n\nlet ParserAsync = (module.exports = function (options) {\n ChunkStream.call(this);\n\n this._parser = new Parser(options, {\n read: this.read.bind(this),\n error: this._handleError.bind(this),\n metadata: this._handleMetaData.bind(this),\n gamma: this.emit.bind(this, \"gamma\"),\n palette: this._handlePalette.bind(this),\n transColor: this._handleTransColor.bind(this),\n finished: this._finished.bind(this),\n inflateData: this._inflateData.bind(this),\n simpleTransparency: this._simpleTransparency.bind(this),\n headersFinished: this._headersFinished.bind(this),\n });\n this._options = options;\n this.writable = true;\n\n this._parser.start();\n});\nutil.inherits(ParserAsync, ChunkStream);\n\nParserAsync.prototype._handleError = function (err) {\n this.emit(\"error\", err);\n\n this.writable = false;\n\n this.destroy();\n\n if (this._inflate && this._inflate.destroy) {\n this._inflate.destroy();\n }\n\n if (this._filter) {\n this._filter.destroy();\n // For backward compatibility with Node 7 and below.\n // Suppress errors due to _inflate calling write() even after\n // it's destroy()'ed.\n this._filter.on(\"error\", function () {});\n }\n\n this.errord = true;\n};\n\nParserAsync.prototype._inflateData = function (data) {\n if (!this._inflate) {\n if (this._bitmapInfo.interlace) {\n this._inflate = zlib.createInflate();\n\n this._inflate.on(\"error\", this.emit.bind(this, \"error\"));\n this._filter.on(\"complete\", this._complete.bind(this));\n\n this._inflate.pipe(this._filter);\n } else {\n let rowSize =\n ((this._bitmapInfo.width *\n this._bitmapInfo.bpp *\n this._bitmapInfo.depth +\n 7) >>\n 3) +\n 1;\n let imageSize = rowSize * this._bitmapInfo.height;\n let chunkSize = Math.max(imageSize, zlib.Z_MIN_CHUNK);\n\n this._inflate = zlib.createInflate({ chunkSize: chunkSize });\n let leftToInflate = imageSize;\n\n let emitError = this.emit.bind(this, \"error\");\n this._inflate.on(\"error\", function (err) {\n if (!leftToInflate) {\n return;\n }\n\n emitError(err);\n });\n this._filter.on(\"complete\", this._complete.bind(this));\n\n let filterWrite = this._filter.write.bind(this._filter);\n this._inflate.on(\"data\", function (chunk) {\n if (!leftToInflate) {\n return;\n }\n\n if (chunk.length > leftToInflate) {\n chunk = chunk.slice(0, leftToInflate);\n }\n\n leftToInflate -= chunk.length;\n\n filterWrite(chunk);\n });\n\n this._inflate.on(\"end\", this._filter.end.bind(this._filter));\n }\n }\n this._inflate.write(data);\n};\n\nParserAsync.prototype._handleMetaData = function (metaData) {\n this._metaData = metaData;\n this._bitmapInfo = Object.create(metaData);\n\n this._filter = new FilterAsync(this._bitmapInfo);\n};\n\nParserAsync.prototype._handleTransColor = function (transColor) {\n this._bitmapInfo.transColor = transColor;\n};\n\nParserAsync.prototype._handlePalette = function (palette) {\n this._bitmapInfo.palette = palette;\n};\n\nParserAsync.prototype._simpleTransparency = function () {\n this._metaData.alpha = true;\n};\n\nParserAsync.prototype._headersFinished = function () {\n // Up until this point, we don't know if we have a tRNS chunk (alpha)\n // so we can't emit metadata any earlier\n this.emit(\"metadata\", this._metaData);\n};\n\nParserAsync.prototype._finished = function () {\n if (this.errord) {\n return;\n }\n\n if (!this._inflate) {\n this.emit(\"error\", \"No Inflate block\");\n } else {\n // no more data to inflate\n this._inflate.end();\n }\n};\n\nParserAsync.prototype._complete = function (filteredData) {\n if (this.errord) {\n return;\n }\n\n let normalisedBitmapData;\n\n try {\n let bitmapData = bitmapper.dataToBitMap(filteredData, this._bitmapInfo);\n\n normalisedBitmapData = formatNormaliser(\n bitmapData,\n this._bitmapInfo,\n this._options.skipRescale\n );\n bitmapData = null;\n } catch (ex) {\n this._handleError(ex);\n return;\n }\n\n this.emit(\"parsed\", normalisedBitmapData);\n};\n\n},{\"./bitmapper\":1,\"./chunkstream\":3,\"./filter-parse-async\":7,\"./format-normaliser\":10,\"./parser\":18,\"util\":81,\"zlib\":32}],17:[function(require,module,exports){\n(function (Buffer){(function (){\n\"use strict\";\n\nlet hasSyncZlib = true;\nlet zlib = require(\"zlib\");\nlet inflateSync = require(\"./sync-inflate\");\nif (!zlib.deflateSync) {\n hasSyncZlib = false;\n}\nlet SyncReader = require(\"./sync-reader\");\nlet FilterSync = require(\"./filter-parse-sync\");\nlet Parser = require(\"./parser\");\nlet bitmapper = require(\"./bitmapper\");\nlet formatNormaliser = require(\"./format-normaliser\");\n\nmodule.exports = function (buffer, options) {\n if (!hasSyncZlib) {\n throw new Error(\n \"To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0\"\n );\n }\n\n let err;\n function handleError(_err_) {\n err = _err_;\n }\n\n let metaData;\n function handleMetaData(_metaData_) {\n metaData = _metaData_;\n }\n\n function handleTransColor(transColor) {\n metaData.transColor = transColor;\n }\n\n function handlePalette(palette) {\n metaData.palette = palette;\n }\n\n function handleSimpleTransparency() {\n metaData.alpha = true;\n }\n\n let gamma;\n function handleGamma(_gamma_) {\n gamma = _gamma_;\n }\n\n let inflateDataList = [];\n function handleInflateData(inflatedData) {\n inflateDataList.push(inflatedData);\n }\n\n let reader = new SyncReader(buffer);\n\n let parser = new Parser(options, {\n read: reader.read.bind(reader),\n error: handleError,\n metadata: handleMetaData,\n gamma: handleGamma,\n palette: handlePalette,\n transColor: handleTransColor,\n inflateData: handleInflateData,\n simpleTransparency: handleSimpleTransparency,\n });\n\n parser.start();\n reader.process();\n\n if (err) {\n throw err;\n }\n\n //join together the inflate datas\n let inflateData = Buffer.concat(inflateDataList);\n inflateDataList.length = 0;\n\n let inflatedData;\n if (metaData.interlace) {\n inflatedData = zlib.inflateSync(inflateData);\n } else {\n let rowSize =\n ((metaData.width * metaData.bpp * metaData.depth + 7) >> 3) + 1;\n let imageSize = rowSize * metaData.height;\n inflatedData = inflateSync(inflateData, {\n chunkSize: imageSize,\n maxLength: imageSize,\n });\n }\n inflateData = null;\n\n if (!inflatedData || !inflatedData.length) {\n throw new Error(\"bad png - invalid inflate data response\");\n }\n\n let unfilteredData = FilterSync.process(inflatedData, metaData);\n inflateData = null;\n\n let bitmapData = bitmapper.dataToBitMap(unfilteredData, metaData);\n unfilteredData = null;\n\n let normalisedBitmapData = formatNormaliser(\n bitmapData,\n metaData,\n options.skipRescale\n );\n\n metaData.data = normalisedBitmapData;\n metaData.gamma = gamma || 0;\n\n return metaData;\n};\n\n}).call(this)}).call(this,require(\"buffer\").Buffer)\n},{\"./bitmapper\":1,\"./filter-parse-sync\":8,\"./format-normaliser\":10,\"./parser\":18,\"./sync-inflate\":21,\"./sync-reader\":22,\"buffer\":33,\"zlib\":32}],18:[function(require,module,exports){\n(function (Buffer){(function (){\n\"use strict\";\n\nlet constants = require(\"./constants\");\nlet CrcCalculator = require(\"./crc\");\n\nlet Parser = (module.exports = function (options, dependencies) {\n this._options = options;\n options.checkCRC = options.checkCRC !== false;\n\n this._hasIHDR = false;\n this._hasIEND = false;\n this._emittedHeadersFinished = false;\n\n // input flags/metadata\n this._palette = [];\n this._colorType = 0;\n\n this._chunks = {};\n this._chunks[constants.TYPE_IHDR] = this._handleIHDR.bind(this);\n this._chunks[constants.TYPE_IEND] = this._handleIEND.bind(this);\n this._chunks[constants.TYPE_IDAT] = this._handleIDAT.bind(this);\n this._chunks[constants.TYPE_PLTE] = this._handlePLTE.bind(this);\n this._chunks[constants.TYPE_tRNS] = this._handleTRNS.bind(this);\n this._chunks[constants.TYPE_gAMA] = this._handleGAMA.bind(this);\n\n this.read = dependencies.read;\n this.error = dependencies.error;\n this.metadata = dependencies.metadata;\n this.gamma = dependencies.gamma;\n this.transColor = dependencies.transColor;\n this.palette = dependencies.palette;\n this.parsed = dependencies.parsed;\n this.inflateData = dependencies.inflateData;\n this.finished = dependencies.finished;\n this.simpleTransparency = dependencies.simpleTransparency;\n this.headersFinished = dependencies.headersFinished || function () {};\n});\n\nParser.prototype.start = function () {\n this.read(constants.PNG_SIGNATURE.length, this._parseSignature.bind(this));\n};\n\nParser.prototype._parseSignature = function (data) {\n let signature = constants.PNG_SIGNATURE;\n\n for (let i = 0; i < signature.length; i++) {\n if (data[i] !== signature[i]) {\n this.error(new Error(\"Invalid file signature\"));\n return;\n }\n }\n this.read(8, this._parseChunkBegin.bind(this));\n};\n\nParser.prototype._parseChunkBegin = function (data) {\n // chunk content length\n let length = data.readUInt32BE(0);\n\n // chunk type\n let type = data.readUInt32BE(4);\n let name = \"\";\n for (let i = 4; i < 8; i++) {\n name += String.fromCharCode(data[i]);\n }\n\n //console.log('chunk ', name, length);\n\n // chunk flags\n let ancillary = Boolean(data[4] & 0x20); // or critical\n // priv = Boolean(data[5] & 0x20), // or public\n // safeToCopy = Boolean(data[7] & 0x20); // or unsafe\n\n if (!this._hasIHDR && type !== constants.TYPE_IHDR) {\n this.error(new Error(\"Expected IHDR on beggining\"));\n return;\n }\n\n this._crc = new CrcCalculator();\n this._crc.write(Buffer.from(name));\n\n if (this._chunks[type]) {\n return this._chunks[type](length);\n }\n\n if (!ancillary) {\n this.error(new Error(\"Unsupported critical chunk type \" + name));\n return;\n }\n\n this.read(length + 4, this._skipChunk.bind(this));\n};\n\nParser.prototype._skipChunk = function (/*data*/) {\n this.read(8, this._parseChunkBegin.bind(this));\n};\n\nParser.prototype._handleChunkEnd = function () {\n this.read(4, this._parseChunkEnd.bind(this));\n};\n\nParser.prototype._parseChunkEnd = function (data) {\n let fileCrc = data.readInt32BE(0);\n let calcCrc = this._crc.crc32();\n\n // check CRC\n if (this._options.checkCRC && calcCrc !== fileCrc) {\n this.error(new Error(\"Crc error - \" + fileCrc + \" - \" + calcCrc));\n return;\n }\n\n if (!this._hasIEND) {\n this.read(8, this._parseChunkBegin.bind(this));\n }\n};\n\nParser.prototype._handleIHDR = function (length) {\n this.read(length, this._parseIHDR.bind(this));\n};\nParser.prototype._parseIHDR = function (data) {\n this._crc.write(data);\n\n let width = data.readUInt32BE(0);\n let height = data.readUInt32BE(4);\n let depth = data[8];\n let colorType = data[9]; // bits: 1 palette, 2 color, 4 alpha\n let compr = data[10];\n let filter = data[11];\n let interlace = data[12];\n\n // console.log(' width', width, 'height', height,\n // 'depth', depth, 'colorType', colorType,\n // 'compr', compr, 'filter', filter, 'interlace', interlace\n // );\n\n if (\n depth !== 8 &&\n depth !== 4 &&\n depth !== 2 &&\n depth !== 1 &&\n depth !== 16\n ) {\n this.error(new Error(\"Unsupported bit depth \" + depth));\n return;\n }\n if (!(colorType in constants.COLORTYPE_TO_BPP_MAP)) {\n this.error(new Error(\"Unsupported color type\"));\n return;\n }\n if (compr !== 0) {\n this.error(new Error(\"Unsupported compression method\"));\n return;\n }\n if (filter !== 0) {\n this.error(new Error(\"Unsupported filter method\"));\n return;\n }\n if (interlace !== 0 && interlace !== 1) {\n this.error(new Error(\"Unsupported interlace method\"));\n return;\n }\n\n this._colorType = colorType;\n\n let bpp = constants.COLORTYPE_TO_BPP_MAP[this._colorType];\n\n this._hasIHDR = true;\n\n this.metadata({\n width: width,\n height: height,\n depth: depth,\n interlace: Boolean(interlace),\n palette: Boolean(colorType & constants.COLORTYPE_PALETTE),\n color: Boolean(colorType & constants.COLORTYPE_COLOR),\n alpha: Boolean(colorType & constants.COLORTYPE_ALPHA),\n bpp: bpp,\n colorType: colorType,\n });\n\n this._handleChunkEnd();\n};\n\nParser.prototype._handlePLTE = function (length) {\n this.read(length, this._parsePLTE.bind(this));\n};\nParser.prototype._parsePLTE = function (data) {\n this._crc.write(data);\n\n let entries = Math.floor(data.length / 3);\n // console.log('Palette:', entries);\n\n for (let i = 0; i < entries; i++) {\n this._palette.push([data[i * 3], data[i * 3 + 1], data[i * 3 + 2], 0xff]);\n }\n\n this.palette(this._palette);\n\n this._handleChunkEnd();\n};\n\nParser.prototype._handleTRNS = function (length) {\n this.simpleTransparency();\n this.read(length, this._parseTRNS.bind(this));\n};\nParser.prototype._parseTRNS = function (data) {\n this._crc.write(data);\n\n // palette\n if (this._colorType === constants.COLORTYPE_PALETTE_COLOR) {\n if (this._palette.length === 0) {\n this.error(new Error(\"Transparency chunk must be after palette\"));\n return;\n }\n if (data.length > this._palette.length) {\n this.error(new Error(\"More transparent colors than palette size\"));\n return;\n }\n for (let i = 0; i < data.length; i++) {\n this._palette[i][3] = data[i];\n }\n this.palette(this._palette);\n }\n\n // for colorType 0 (grayscale) and 2 (rgb)\n // there might be one gray/color defined as transparent\n if (this._colorType === constants.COLORTYPE_GRAYSCALE) {\n // grey, 2 bytes\n this.transColor([data.readUInt16BE(0)]);\n }\n if (this._colorType === constants.COLORTYPE_COLOR) {\n this.transColor([\n data.readUInt16BE(0),\n data.readUInt16BE(2),\n data.readUInt16BE(4),\n ]);\n }\n\n this._handleChunkEnd();\n};\n\nParser.prototype._handleGAMA = function (length) {\n this.read(length, this._parseGAMA.bind(this));\n};\nParser.prototype._parseGAMA = function (data) {\n this._crc.write(data);\n this.gamma(data.readUInt32BE(0) / constants.GAMMA_DIVISION);\n\n this._handleChunkEnd();\n};\n\nParser.prototype._handleIDAT = function (length) {\n if (!this._emittedHeadersFinished) {\n this._emittedHeadersFinished = true;\n this.headersFinished();\n }\n this.read(-length, this._parseIDAT.bind(this, length));\n};\nParser.prototype._parseIDAT = function (length, data) {\n this._crc.write(data);\n\n if (\n this._colorType === constants.COLORTYPE_PALETTE_COLOR &&\n this._palette.length === 0\n ) {\n throw new Error(\"Expected palette not found\");\n }\n\n this.inflateData(data);\n let leftOverLength = length - data.length;\n\n if (leftOverLength > 0) {\n this._handleIDAT(leftOverLength);\n } else {\n this._handleChunkEnd();\n }\n};\n\nParser.prototype._handleIEND = function (length) {\n this.read(length, this._parseIEND.bind(this));\n};\nParser.prototype._parseIEND = function (data) {\n this._crc.write(data);\n\n this._hasIEND = true;\n this._handleChunkEnd();\n\n if (this.finished) {\n this.finished();\n }\n};\n\n}).call(this)}).call(this,require(\"buffer\").Buffer)\n},{\"./constants\":4,\"./crc\":5,\"buffer\":33}],19:[function(require,module,exports){\n\"use strict\";\n\nlet parse = require(\"./parser-sync\");\nlet pack = require(\"./packer-sync\");\n\nexports.read = function (buffer, options) {\n return parse(buffer, options || {});\n};\n\nexports.write = function (png, options) {\n return pack(png, options);\n};\n\n},{\"./packer-sync\":13,\"./parser-sync\":17}],20:[function(require,module,exports){\n(function (process,Buffer){(function (){\n\"use strict\";\n\nlet util = require(\"util\");\nlet Stream = require(\"stream\");\nlet Parser = require(\"./parser-async\");\nlet Packer = require(\"./packer-async\");\nlet PNGSync = require(\"./png-sync\");\n\nlet PNG = (exports.PNG = function (options) {\n Stream.call(this);\n\n options = options || {}; // eslint-disable-line no-param-reassign\n\n // coerce pixel dimensions to integers (also coerces undefined -> 0):\n this.width = options.width | 0;\n this.height = options.height | 0;\n\n this.data =\n this.width > 0 && this.height > 0\n ? Buffer.alloc(4 * this.width * this.height)\n : null;\n\n if (options.fill && this.data) {\n this.data.fill(0);\n }\n\n this.gamma = 0;\n this.readable = this.writable = true;\n\n this._parser = new Parser(options);\n\n this._parser.on(\"error\", this.emit.bind(this, \"error\"));\n this._parser.on(\"close\", this._handleClose.bind(this));\n this._parser.on(\"metadata\", this._metadata.bind(this));\n this._parser.on(\"gamma\", this._gamma.bind(this));\n this._parser.on(\n \"parsed\",\n function (data) {\n this.data = data;\n this.emit(\"parsed\", data);\n }.bind(this)\n );\n\n this._packer = new Packer(options);\n this._packer.on(\"data\", this.emit.bind(this, \"data\"));\n this._packer.on(\"end\", this.emit.bind(this, \"end\"));\n this._parser.on(\"close\", this._handleClose.bind(this));\n this._packer.on(\"error\", this.emit.bind(this, \"error\"));\n});\nutil.inherits(PNG, Stream);\n\nPNG.sync = PNGSync;\n\nPNG.prototype.pack = function () {\n if (!this.data || !this.data.length) {\n this.emit(\"error\", \"No data provided\");\n return this;\n }\n\n process.nextTick(\n function () {\n this._packer.pack(this.data, this.width, this.height, this.gamma);\n }.bind(this)\n );\n\n return this;\n};\n\nPNG.prototype.parse = function (data, callback) {\n if (callback) {\n let onParsed, onError;\n\n onParsed = function (parsedData) {\n this.removeListener(\"error\", onError);\n\n this.data = parsedData;\n callback(null, this);\n }.bind(this);\n\n onError = function (err) {\n this.removeListener(\"parsed\", onParsed);\n\n callback(err, null);\n }.bind(this);\n\n this.once(\"parsed\", onParsed);\n this.once(\"error\", onError);\n }\n\n this.end(data);\n return this;\n};\n\nPNG.prototype.write = function (data) {\n this._parser.write(data);\n return true;\n};\n\nPNG.prototype.end = function (data) {\n this._parser.end(data);\n};\n\nPNG.prototype._metadata = function (metadata) {\n this.width = metadata.width;\n this.height = metadata.height;\n\n this.emit(\"metadata\", metadata);\n};\n\nPNG.prototype._gamma = function (gamma) {\n this.gamma = gamma;\n};\n\nPNG.prototype._handleClose = function () {\n if (!this._parser.writable && !this._packer.readable) {\n this.emit(\"close\");\n }\n};\n\nPNG.bitblt = function (src, dst, srcX, srcY, width, height, deltaX, deltaY) {\n // eslint-disable-line max-params\n // coerce pixel dimensions to integers (also coerces undefined -> 0):\n /* eslint-disable no-param-reassign */\n srcX |= 0;\n srcY |= 0;\n width |= 0;\n height |= 0;\n deltaX |= 0;\n deltaY |= 0;\n /* eslint-enable no-param-reassign */\n\n if (\n srcX > src.width ||\n srcY > src.height ||\n srcX + width > src.width ||\n srcY + height > src.height\n ) {\n throw new Error(\"bitblt reading outside image\");\n }\n\n if (\n deltaX > dst.width ||\n deltaY > dst.height ||\n deltaX + width > dst.width ||\n deltaY + height > dst.height\n ) {\n throw new Error(\"bitblt writing outside image\");\n }\n\n for (let y = 0; y < height; y++) {\n src.data.copy(\n dst.data,\n ((deltaY + y) * dst.width + deltaX) << 2,\n ((srcY + y) * src.width + srcX) << 2,\n ((srcY + y) * src.width + srcX + width) << 2\n );\n }\n};\n\nPNG.prototype.bitblt = function (\n dst,\n srcX,\n srcY,\n width,\n height,\n deltaX,\n deltaY\n) {\n // eslint-disable-line max-params\n\n PNG.bitblt(this, dst, srcX, srcY, width, height, deltaX, deltaY);\n return this;\n};\n\nPNG.adjustGamma = function (src) {\n if (src.gamma) {\n for (let y = 0; y < src.height; y++) {\n for (let x = 0; x < src.width; x++) {\n let idx = (src.width * y + x) << 2;\n\n for (let i = 0; i < 3; i++) {\n let sample = src.data[idx + i] / 255;\n sample = Math.pow(sample, 1 / 2.2 / src.gamma);\n src.data[idx + i] = Math.round(sample * 255);\n }\n }\n }\n src.gamma = 0;\n }\n};\n\nPNG.prototype.adjustGamma = function () {\n PNG.adjustGamma(this);\n};\n\n}).call(this)}).call(this,require('_process'),require(\"buffer\").Buffer)\n},{\"./packer-async\":12,\"./parser-async\":16,\"./png-sync\":19,\"_process\":60,\"buffer\":33,\"stream\":61,\"util\":81}],21:[function(require,module,exports){\n(function (process,Buffer){(function (){\n\"use strict\";\n\nlet assert = require(\"assert\").ok;\nlet zlib = require(\"zlib\");\nlet util = require(\"util\");\n\nlet kMaxLength = require(\"buffer\").kMaxLength;\n\nfunction Inflate(opts) {\n if (!(this instanceof Inflate)) {\n return new Inflate(opts);\n }\n\n if (opts && opts.chunkSize < zlib.Z_MIN_CHUNK) {\n opts.chunkSize = zlib.Z_MIN_CHUNK;\n }\n\n zlib.Inflate.call(this, opts);\n\n // Node 8 --> 9 compatibility check\n this._offset = this._offset === undefined ? this._outOffset : this._offset;\n this._buffer = this._buffer || this._outBuffer;\n\n if (opts && opts.maxLength != null) {\n this._maxLength = opts.maxLength;\n }\n}\n\nfunction createInflate(opts) {\n return new Inflate(opts);\n}\n\nfunction _close(engine, callback) {\n if (callback) {\n process.nextTick(callback);\n }\n\n // Caller may invoke .close after a zlib error (which will null _handle).\n if (!engine._handle) {\n return;\n }\n\n engine._handle.close();\n engine._handle = null;\n}\n\nInflate.prototype._processChunk = function (chunk, flushFlag, asyncCb) {\n if (typeof asyncCb === \"function\") {\n return zlib.Inflate._processChunk.call(this, chunk, flushFlag, asyncCb);\n }\n\n let self = this;\n\n let availInBefore = chunk && chunk.length;\n let availOutBefore = this._chunkSize - this._offset;\n let leftToInflate = this._maxLength;\n let inOff = 0;\n\n let buffers = [];\n let nread = 0;\n\n let error;\n this.on(\"error\", function (err) {\n error = err;\n });\n\n function handleChunk(availInAfter, availOutAfter) {\n if (self._hadError) {\n return;\n }\n\n let have = availOutBefore - availOutAfter;\n assert(have >= 0, \"have should not go down\");\n\n if (have > 0) {\n let out = self._buffer.slice(self._offset, self._offset + have);\n self._offset += have;\n\n if (out.length > leftToInflate) {\n out = out.slice(0, leftToInflate);\n }\n\n buffers.push(out);\n nread += out.length;\n leftToInflate -= out.length;\n\n if (leftToInflate === 0) {\n return false;\n }\n }\n\n if (availOutAfter === 0 || self._offset >= self._chunkSize) {\n availOutBefore = self._chunkSize;\n self._offset = 0;\n self._buffer = Buffer.allocUnsafe(self._chunkSize);\n }\n\n if (availOutAfter === 0) {\n inOff += availInBefore - availInAfter;\n availInBefore = availInAfter;\n\n return true;\n }\n\n return false;\n }\n\n assert(this._handle, \"zlib binding closed\");\n let res;\n do {\n res = this._handle.writeSync(\n flushFlag,\n chunk, // in\n inOff, // in_off\n availInBefore, // in_len\n this._buffer, // out\n this._offset, //out_off\n availOutBefore\n ); // out_len\n // Node 8 --> 9 compatibility check\n res = res || this._writeState;\n } while (!this._hadError && handleChunk(res[0], res[1]));\n\n if (this._hadError) {\n throw error;\n }\n\n if (nread >= kMaxLength) {\n _close(this);\n throw new RangeError(\n \"Cannot create final Buffer. It would be larger than 0x\" +\n kMaxLength.toString(16) +\n \" bytes\"\n );\n }\n\n let buf = Buffer.concat(buffers, nread);\n _close(this);\n\n return buf;\n};\n\nutil.inherits(Inflate, zlib.Inflate);\n\nfunction zlibBufferSync(engine, buffer) {\n if (typeof buffer === \"string\") {\n buffer = Buffer.from(buffer);\n }\n if (!(buffer instanceof Buffer)) {\n throw new TypeError(\"Not a string or buffer\");\n }\n\n let flushFlag = engine._finishFlushFlag;\n if (flushFlag == null) {\n flushFlag = zlib.Z_FINISH;\n }\n\n return engine._processChunk(buffer, flushFlag);\n}\n\nfunction inflateSync(buffer, opts) {\n return zlibBufferSync(new Inflate(opts), buffer);\n}\n\nmodule.exports = exports = inflateSync;\nexports.Inflate = Inflate;\nexports.createInflate = createInflate;\nexports.inflateSync = inflateSync;\n\n}).call(this)}).call(this,require('_process'),require(\"buffer\").Buffer)\n},{\"_process\":60,\"assert\":23,\"buffer\":33,\"util\":81,\"zlib\":32}],22:[function(require,module,exports){\n\"use strict\";\n\nlet SyncReader = (module.exports = function (buffer) {\n this._buffer = buffer;\n this._reads = [];\n});\n\nSyncReader.prototype.read = function (length, callback) {\n this._reads.push({\n length: Math.abs(length), // if length < 0 then at most this length\n allowLess: length < 0,\n func: callback,\n });\n};\n\nSyncReader.prototype.process = function () {\n // as long as there is any data and read requests\n while (this._reads.length > 0 && this._buffer.length) {\n let read = this._reads[0];\n\n if (\n this._buffer.length &&\n (this._buffer.length >= read.length || read.allowLess)\n ) {\n // ok there is any data so that we can satisfy this request\n this._reads.shift(); // == read\n\n let buf = this._buffer;\n\n this._buffer = buf.slice(read.length);\n\n read.func.call(this, buf.slice(0, read.length));\n } else {\n break;\n }\n }\n\n if (this._reads.length > 0) {\n throw new Error(\"There are some read requests waitng on finished stream\");\n }\n\n if (this._buffer.length > 0) {\n throw new Error(\"unrecognised content at end of stream\");\n }\n};\n\n},{}],23:[function(require,module,exports){\n(function (global){(function (){\n'use strict';\n\n// compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js\n// original notice:\n\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\nfunction compare(a, b) {\n if (a === b) {\n return 0;\n }\n\n var x = a.length;\n var y = b.length;\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i];\n y = b[i];\n break;\n }\n }\n\n if (x < y) {\n return -1;\n }\n if (y < x) {\n return 1;\n }\n return 0;\n}\nfunction isBuffer(b) {\n if (global.Buffer && typeof global.Buffer.isBuffer === 'function') {\n return global.Buffer.isBuffer(b);\n }\n return !!(b != null && b._isBuffer);\n}\n\n// based on node assert, original notice:\n\n// http://wiki.commonjs.org/wiki/Unit_Testing/1.0\n//\n// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!\n//\n// Originally from narwhal.js (http://narwhaljs.org)\n// Copyright (c) 2009 Thomas Robinson <280north.com>\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the 'Software'), to\n// deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n// sell copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar util = require('util/');\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar pSlice = Array.prototype.slice;\nvar functionsHaveNames = (function () {\n return function foo() {}.name === 'foo';\n}());\nfunction pToString (obj) {\n return Object.prototype.toString.call(obj);\n}\nfunction isView(arrbuf) {\n if (isBuffer(arrbuf)) {\n return false;\n }\n if (typeof global.ArrayBuffer !== 'function') {\n return false;\n }\n if (typeof ArrayBuffer.isView === 'function') {\n return ArrayBuffer.isView(arrbuf);\n }\n if (!arrbuf) {\n return false;\n }\n if (arrbuf instanceof DataView) {\n return true;\n }\n if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) {\n return true;\n }\n return false;\n}\n// 1. The assert module provides functions that throw\n// AssertionError's when particular conditions are not met. The\n// assert module must conform to the following interface.\n\nvar assert = module.exports = ok;\n\n// 2. The AssertionError is defined in assert.\n// new assert.AssertionError({ message: message,\n// actual: actual,\n// expected: expected })\n\nvar regex = /\\s*function\\s+([^\\(\\s]*)\\s*/;\n// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js\nfunction getName(func) {\n if (!util.isFunction(func)) {\n return;\n }\n if (functionsHaveNames) {\n return func.name;\n }\n var str = func.toString();\n var match = str.match(regex);\n return match && match[1];\n}\nassert.AssertionError = function AssertionError(options) {\n this.name = 'AssertionError';\n this.actual = options.actual;\n this.expected = options.expected;\n this.operator = options.operator;\n if (options.message) {\n this.message = options.message;\n this.generatedMessage = false;\n } else {\n this.message = getMessage(this);\n this.generatedMessage = true;\n }\n var stackStartFunction = options.stackStartFunction || fail;\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, stackStartFunction);\n } else {\n // non v8 browsers so we can have a stacktrace\n var err = new Error();\n if (err.stack) {\n var out = err.stack;\n\n // try to strip useless frames\n var fn_name = getName(stackStartFunction);\n var idx = out.indexOf('\\n' + fn_name);\n if (idx >= 0) {\n // once we have located the function frame\n // we need to strip out everything before it (and its line)\n var next_line = out.indexOf('\\n', idx + 1);\n out = out.substring(next_line + 1);\n }\n\n this.stack = out;\n }\n }\n};\n\n// assert.AssertionError instanceof Error\nutil.inherits(assert.AssertionError, Error);\n\nfunction truncate(s, n) {\n if (typeof s === 'string') {\n return s.length < n ? s : s.slice(0, n);\n } else {\n return s;\n }\n}\nfunction inspect(something) {\n if (functionsHaveNames || !util.isFunction(something)) {\n return util.inspect(something);\n }\n var rawname = getName(something);\n var name = rawname ? ': ' + rawname : '';\n return '[Function' + name + ']';\n}\nfunction getMessage(self) {\n return truncate(inspect(self.actual), 128) + ' ' +\n self.operator + ' ' +\n truncate(inspect(self.expected), 128);\n}\n\n// At present only the three keys mentioned above are used and\n// understood by the spec. Implementations or sub modules can pass\n// other keys to the AssertionError's constructor - they will be\n// ignored.\n\n// 3. All of the following functions must throw an AssertionError\n// when a corresponding condition is not met, with a message that\n// may be undefined if not provided. All assertion methods provide\n// both the actual and expected values to the assertion error for\n// display purposes.\n\nfunction fail(actual, expected, message, operator, stackStartFunction) {\n throw new assert.AssertionError({\n message: message,\n actual: actual,\n expected: expected,\n operator: operator,\n stackStartFunction: stackStartFunction\n });\n}\n\n// EXTENSION! allows for well behaved errors defined elsewhere.\nassert.fail = fail;\n\n// 4. Pure assertion tests whether a value is truthy, as determined\n// by !!guard.\n// assert.ok(guard, message_opt);\n// This statement is equivalent to assert.equal(true, !!guard,\n// message_opt);. To test strictly for the value true, use\n// assert.strictEqual(true, guard, message_opt);.\n\nfunction ok(value, message) {\n if (!value) fail(value, true, message, '==', assert.ok);\n}\nassert.ok = ok;\n\n// 5. The equality assertion tests shallow, coercive equality with\n// ==.\n// assert.equal(actual, expected, message_opt);\n\nassert.equal = function equal(actual, expected, message) {\n if (actual != expected) fail(actual, expected, message, '==', assert.equal);\n};\n\n// 6. The non-equality assertion tests for whether two objects are not equal\n// with != assert.notEqual(actual, expected, message_opt);\n\nassert.notEqual = function notEqual(actual, expected, message) {\n if (actual == expected) {\n fail(actual, expected, message, '!=', assert.notEqual);\n }\n};\n\n// 7. The equivalence assertion tests a deep equality relation.\n// assert.deepEqual(actual, expected, message_opt);\n\nassert.deepEqual = function deepEqual(actual, expected, message) {\n if (!_deepEqual(actual, expected, false)) {\n fail(actual, expected, message, 'deepEqual', assert.deepEqual);\n }\n};\n\nassert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {\n if (!_deepEqual(actual, expected, true)) {\n fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual);\n }\n};\n\nfunction _deepEqual(actual, expected, strict, memos) {\n // 7.1. All identical values are equivalent, as determined by ===.\n if (actual === expected) {\n return true;\n } else if (isBuffer(actual) && isBuffer(expected)) {\n return compare(actual, expected) === 0;\n\n // 7.2. If the expected value is a Date object, the actual value is\n // equivalent if it is also a Date object that refers to the same time.\n } else if (util.isDate(actual) && util.isDate(expected)) {\n return actual.getTime() === expected.getTime();\n\n // 7.3 If the expected value is a RegExp object, the actual value is\n // equivalent if it is also a RegExp object with the same source and\n // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).\n } else if (util.isRegExp(actual) && util.isRegExp(expected)) {\n return actual.source === expected.source &&\n actual.global === expected.global &&\n actual.multiline === expected.multiline &&\n actual.lastIndex === expected.lastIndex &&\n actual.ignoreCase === expected.ignoreCase;\n\n // 7.4. Other pairs that do not both pass typeof value == 'object',\n // equivalence is determined by ==.\n } else if ((actual === null || typeof actual !== 'object') &&\n (expected === null || typeof expected !== 'object')) {\n return strict ? actual === expected : actual == expected;\n\n // If both values are instances of typed arrays, wrap their underlying\n // ArrayBuffers in a Buffer each to increase performance\n // This optimization requires the arrays to have the same type as checked by\n // Object.prototype.toString (aka pToString). Never perform binary\n // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their\n // bit patterns are not identical.\n } else if (isView(actual) && isView(expected) &&\n pToString(actual) === pToString(expected) &&\n !(actual instanceof Float32Array ||\n actual instanceof Float64Array)) {\n return compare(new Uint8Array(actual.buffer),\n new Uint8Array(expected.buffer)) === 0;\n\n // 7.5 For all other Object pairs, including Array objects, equivalence is\n // determined by having the same number of owned properties (as verified\n // with Object.prototype.hasOwnProperty.call), the same set of keys\n // (although not necessarily the same order), equivalent values for every\n // corresponding key, and an identical 'prototype' property. Note: this\n // accounts for both named and indexed properties on Arrays.\n } else if (isBuffer(actual) !== isBuffer(expected)) {\n return false;\n } else {\n memos = memos || {actual: [], expected: []};\n\n var actualIndex = memos.actual.indexOf(actual);\n if (actualIndex !== -1) {\n if (actualIndex === memos.expected.indexOf(expected)) {\n return true;\n }\n }\n\n memos.actual.push(actual);\n memos.expected.push(expected);\n\n return objEquiv(actual, expected, strict, memos);\n }\n}\n\nfunction isArguments(object) {\n return Object.prototype.toString.call(object) == '[object Arguments]';\n}\n\nfunction objEquiv(a, b, strict, actualVisitedObjects) {\n if (a === null || a === undefined || b === null || b === undefined)\n return false;\n // if one is a primitive, the other must be same\n if (util.isPrimitive(a) || util.isPrimitive(b))\n return a === b;\n if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))\n return false;\n var aIsArgs = isArguments(a);\n var bIsArgs = isArguments(b);\n if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))\n return false;\n if (aIsArgs) {\n a = pSlice.call(a);\n b = pSlice.call(b);\n return _deepEqual(a, b, strict);\n }\n var ka = objectKeys(a);\n var kb = objectKeys(b);\n var key, i;\n // having the same number of owned properties (keys incorporates\n // hasOwnProperty)\n if (ka.length !== kb.length)\n return false;\n //the same set of keys (although not necessarily the same order),\n ka.sort();\n kb.sort();\n //~~~cheap key test\n for (i = ka.length - 1; i >= 0; i--) {\n if (ka[i] !== kb[i])\n return false;\n }\n //equivalent values for every corresponding key, and\n //~~~possibly expensive deep test\n for (i = ka.length - 1; i >= 0; i--) {\n key = ka[i];\n if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects))\n return false;\n }\n return true;\n}\n\n// 8. The non-equivalence assertion tests for any deep inequality.\n// assert.notDeepEqual(actual, expected, message_opt);\n\nassert.notDeepEqual = function notDeepEqual(actual, expected, message) {\n if (_deepEqual(actual, expected, false)) {\n fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);\n }\n};\n\nassert.notDeepStrictEqual = notDeepStrictEqual;\nfunction notDeepStrictEqual(actual, expected, message) {\n if (_deepEqual(actual, expected, true)) {\n fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual);\n }\n}\n\n\n// 9. The strict equality assertion tests strict equality, as determined by ===.\n// assert.strictEqual(actual, expected, message_opt);\n\nassert.strictEqual = function strictEqual(actual, expected, message) {\n if (actual !== expected) {\n fail(actual, expected, message, '===', assert.strictEqual);\n }\n};\n\n// 10. The strict non-equality assertion tests for strict inequality, as\n// determined by !==. assert.notStrictEqual(actual, expected, message_opt);\n\nassert.notStrictEqual = function notStrictEqual(actual, expected, message) {\n if (actual === expected) {\n fail(actual, expected, message, '!==', assert.notStrictEqual);\n }\n};\n\nfunction expectedException(actual, expected) {\n if (!actual || !expected) {\n return false;\n }\n\n if (Object.prototype.toString.call(expected) == '[object RegExp]') {\n return expected.test(actual);\n }\n\n try {\n if (actual instanceof expected) {\n return true;\n }\n } catch (e) {\n // Ignore. The instanceof check doesn't work for arrow functions.\n }\n\n if (Error.isPrototypeOf(expected)) {\n return false;\n }\n\n return expected.call({}, actual) === true;\n}\n\nfunction _tryBlock(block) {\n var error;\n try {\n block();\n } catch (e) {\n error = e;\n }\n return error;\n}\n\nfunction _throws(shouldThrow, block, expected, message) {\n var actual;\n\n if (typeof block !== 'function') {\n throw new TypeError('\"block\" argument must be a function');\n }\n\n if (typeof expected === 'string') {\n message = expected;\n expected = null;\n }\n\n actual = _tryBlock(block);\n\n message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +\n (message ? ' ' + message : '.');\n\n if (shouldThrow && !actual) {\n fail(actual, expected, 'Missing expected exception' + message);\n }\n\n var userProvidedMessage = typeof message === 'string';\n var isUnwantedException = !shouldThrow && util.isError(actual);\n var isUnexpectedException = !shouldThrow && actual && !expected;\n\n if ((isUnwantedException &&\n userProvidedMessage &&\n expectedException(actual, expected)) ||\n isUnexpectedException) {\n fail(actual, expected, 'Got unwanted exception' + message);\n }\n\n if ((shouldThrow && actual && expected &&\n !expectedException(actual, expected)) || (!shouldThrow && actual)) {\n throw actual;\n }\n}\n\n// 11. Expected to throw an error:\n// assert.throws(block, Error_opt, message_opt);\n\nassert.throws = function(block, /*optional*/error, /*optional*/message) {\n _throws(true, block, error, message);\n};\n\n// EXTENSION! This is annoying to write outside this module.\nassert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {\n _throws(false, block, error, message);\n};\n\nassert.ifError = function(err) { if (err) throw err; };\n\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) {\n if (hasOwn.call(obj, key)) keys.push(key);\n }\n return keys;\n};\n\n}).call(this)}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"util/\":26}],24:[function(require,module,exports){\nif (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n}\n\n},{}],25:[function(require,module,exports){\nmodule.exports = function isBuffer(arg) {\n return arg && typeof arg === 'object'\n && typeof arg.copy === 'function'\n && typeof arg.fill === 'function'\n && typeof arg.readUInt8 === 'function';\n}\n},{}],26:[function(require,module,exports){\n(function (process,global){(function (){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n // Allow for deprecating things in the process of starting up.\n if (isUndefined(global.process)) {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n if (process.noDeprecation === true) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnviron;\nexports.debuglog = function(set) {\n if (isUndefined(debugEnviron))\n debugEnviron = process.env.NODE_DEBUG || '';\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (new RegExp('\\\\b' + set + '\\\\b', 'i').test(debugEnviron)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\n}).call(this)}).call(this,require('_process'),typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"./support/isBuffer\":25,\"_process\":60,\"inherits\":24}],27:[function(require,module,exports){\n(function (global){(function (){\n'use strict';\n\nvar filter = require('array-filter');\n\nmodule.exports = function availableTypedArrays() {\n\treturn filter([\n\t\t'BigInt64Array',\n\t\t'BigUint64Array',\n\t\t'Float32Array',\n\t\t'Float64Array',\n\t\t'Int16Array',\n\t\t'Int32Array',\n\t\t'Int8Array',\n\t\t'Uint16Array',\n\t\t'Uint32Array',\n\t\t'Uint8Array',\n\t\t'Uint8ClampedArray'\n\t], function (typedArray) {\n\t\treturn typeof global[typedArray] === 'function';\n\t});\n};\n\n}).call(this)}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"array-filter\":28}],28:[function(require,module,exports){\n\n/**\n * Array#filter.\n *\n * @param {Array} arr\n * @param {Function} fn\n * @param {Object=} self\n * @return {Array}\n * @throw TypeError\n */\n\nmodule.exports = function (arr, fn, self) {\n if (arr.filter) return arr.filter(fn, self);\n if (void 0 === arr || null === arr) throw new TypeError;\n if ('function' != typeof fn) throw new TypeError;\n var ret = [];\n for (var i = 0; i < arr.length; i++) {\n if (!hasOwn.call(arr, i)) continue;\n var val = arr[i];\n if (fn.call(self, val, i, arr)) ret.push(val);\n }\n return ret;\n};\n\nvar hasOwn = Object.prototype.hasOwnProperty;\n\n},{}],29:[function(require,module,exports){\n'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(\n uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)\n ))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n\n},{}],30:[function(require,module,exports){\n\n},{}],31:[function(require,module,exports){\n(function (process,Buffer){(function (){\n'use strict';\n/* eslint camelcase: \"off\" */\n\nvar assert = require('assert');\n\nvar Zstream = require('pako/lib/zlib/zstream');\nvar zlib_deflate = require('pako/lib/zlib/deflate.js');\nvar zlib_inflate = require('pako/lib/zlib/inflate.js');\nvar constants = require('pako/lib/zlib/constants');\n\nfor (var key in constants) {\n exports[key] = constants[key];\n}\n\n// zlib modes\nexports.NONE = 0;\nexports.DEFLATE = 1;\nexports.INFLATE = 2;\nexports.GZIP = 3;\nexports.GUNZIP = 4;\nexports.DEFLATERAW = 5;\nexports.INFLATERAW = 6;\nexports.UNZIP = 7;\n\nvar GZIP_HEADER_ID1 = 0x1f;\nvar GZIP_HEADER_ID2 = 0x8b;\n\n/**\n * Emulate Node's zlib C++ layer for use by the JS layer in index.js\n */\nfunction Zlib(mode) {\n if (typeof mode !== 'number' || mode < exports.DEFLATE || mode > exports.UNZIP) {\n throw new TypeError('Bad argument');\n }\n\n this.dictionary = null;\n this.err = 0;\n this.flush = 0;\n this.init_done = false;\n this.level = 0;\n this.memLevel = 0;\n this.mode = mode;\n this.strategy = 0;\n this.windowBits = 0;\n this.write_in_progress = false;\n this.pending_close = false;\n this.gzip_id_bytes_read = 0;\n}\n\nZlib.prototype.close = function () {\n if (this.write_in_progress) {\n this.pending_close = true;\n return;\n }\n\n this.pending_close = false;\n\n assert(this.init_done, 'close before init');\n assert(this.mode <= exports.UNZIP);\n\n if (this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW) {\n zlib_deflate.deflateEnd(this.strm);\n } else if (this.mode === exports.INFLATE || this.mode === exports.GUNZIP || this.mode === exports.INFLATERAW || this.mode === exports.UNZIP) {\n zlib_inflate.inflateEnd(this.strm);\n }\n\n this.mode = exports.NONE;\n\n this.dictionary = null;\n};\n\nZlib.prototype.write = function (flush, input, in_off, in_len, out, out_off, out_len) {\n return this._write(true, flush, input, in_off, in_len, out, out_off, out_len);\n};\n\nZlib.prototype.writeSync = function (flush, input, in_off, in_len, out, out_off, out_len) {\n return this._write(false, flush, input, in_off, in_len, out, out_off, out_len);\n};\n\nZlib.prototype._write = function (async, flush, input, in_off, in_len, out, out_off, out_len) {\n assert.equal(arguments.length, 8);\n\n assert(this.init_done, 'write before init');\n assert(this.mode !== exports.NONE, 'already finalized');\n assert.equal(false, this.write_in_progress, 'write already in progress');\n assert.equal(false, this.pending_close, 'close is pending');\n\n this.write_in_progress = true;\n\n assert.equal(false, flush === undefined, 'must provide flush value');\n\n this.write_in_progress = true;\n\n if (flush !== exports.Z_NO_FLUSH && flush !== exports.Z_PARTIAL_FLUSH && flush !== exports.Z_SYNC_FLUSH && flush !== exports.Z_FULL_FLUSH && flush !== exports.Z_FINISH && flush !== exports.Z_BLOCK) {\n throw new Error('Invalid flush value');\n }\n\n if (input == null) {\n input = Buffer.alloc(0);\n in_len = 0;\n in_off = 0;\n }\n\n this.strm.avail_in = in_len;\n this.strm.input = input;\n this.strm.next_in = in_off;\n this.strm.avail_out = out_len;\n this.strm.output = out;\n this.strm.next_out = out_off;\n this.flush = flush;\n\n if (!async) {\n // sync version\n this._process();\n\n if (this._checkError()) {\n return this._afterSync();\n }\n return;\n }\n\n // async version\n var self = this;\n process.nextTick(function () {\n self._process();\n self._after();\n });\n\n return this;\n};\n\nZlib.prototype._afterSync = function () {\n var avail_out = this.strm.avail_out;\n var avail_in = this.strm.avail_in;\n\n this.write_in_progress = false;\n\n return [avail_in, avail_out];\n};\n\nZlib.prototype._process = function () {\n var next_expected_header_byte = null;\n\n // If the avail_out is left at 0, then it means that it ran out\n // of room. If there was avail_out left over, then it means\n // that all of the input was consumed.\n switch (this.mode) {\n case exports.DEFLATE:\n case exports.GZIP:\n case exports.DEFLATERAW:\n this.err = zlib_deflate.deflate(this.strm, this.flush);\n break;\n case exports.UNZIP:\n if (this.strm.avail_in > 0) {\n next_expected_header_byte = this.strm.next_in;\n }\n\n switch (this.gzip_id_bytes_read) {\n case 0:\n if (next_expected_header_byte === null) {\n break;\n }\n\n if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID1) {\n this.gzip_id_bytes_read = 1;\n next_expected_header_byte++;\n\n if (this.strm.avail_in === 1) {\n // The only available byte was already read.\n break;\n }\n } else {\n this.mode = exports.INFLATE;\n break;\n }\n\n // fallthrough\n case 1:\n if (next_expected_header_byte === null) {\n break;\n }\n\n if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID2) {\n this.gzip_id_bytes_read = 2;\n this.mode = exports.GUNZIP;\n } else {\n // There is no actual difference between INFLATE and INFLATERAW\n // (after initialization).\n this.mode = exports.INFLATE;\n }\n\n break;\n default:\n throw new Error('invalid number of gzip magic number bytes read');\n }\n\n // fallthrough\n case exports.INFLATE:\n case exports.GUNZIP:\n case exports.INFLATERAW:\n this.err = zlib_inflate.inflate(this.strm, this.flush\n\n // If data was encoded with dictionary\n );if (this.err === exports.Z_NEED_DICT && this.dictionary) {\n // Load it\n this.err = zlib_inflate.inflateSetDictionary(this.strm, this.dictionary);\n if (this.err === exports.Z_OK) {\n // And try to decode again\n this.err = zlib_inflate.inflate(this.strm, this.flush);\n } else if (this.err === exports.Z_DATA_ERROR) {\n // Both inflateSetDictionary() and inflate() return Z_DATA_ERROR.\n // Make it possible for After() to tell a bad dictionary from bad\n // input.\n this.err = exports.Z_NEED_DICT;\n }\n }\n while (this.strm.avail_in > 0 && this.mode === exports.GUNZIP && this.err === exports.Z_STREAM_END && this.strm.next_in[0] !== 0x00) {\n // Bytes remain in input buffer. Perhaps this is another compressed\n // member in the same archive, or just trailing garbage.\n // Trailing zero bytes are okay, though, since they are frequently\n // used for padding.\n\n this.reset();\n this.err = zlib_inflate.inflate(this.strm, this.flush);\n }\n break;\n default:\n throw new Error('Unknown mode ' + this.mode);\n }\n};\n\nZlib.prototype._checkError = function () {\n // Acceptable error states depend on the type of zlib stream.\n switch (this.err) {\n case exports.Z_OK:\n case exports.Z_BUF_ERROR:\n if (this.strm.avail_out !== 0 && this.flush === exports.Z_FINISH) {\n this._error('unexpected end of file');\n return false;\n }\n break;\n case exports.Z_STREAM_END:\n // normal statuses, not fatal\n break;\n case exports.Z_NEED_DICT:\n if (this.dictionary == null) {\n this._error('Missing dictionary');\n } else {\n this._error('Bad dictionary');\n }\n return false;\n default:\n // something else.\n this._error('Zlib error');\n return false;\n }\n\n return true;\n};\n\nZlib.prototype._after = function () {\n if (!this._checkError()) {\n return;\n }\n\n var avail_out = this.strm.avail_out;\n var avail_in = this.strm.avail_in;\n\n this.write_in_progress = false;\n\n // call the write() cb\n this.callback(avail_in, avail_out);\n\n if (this.pending_close) {\n this.close();\n }\n};\n\nZlib.prototype._error = function (message) {\n if (this.strm.msg) {\n message = this.strm.msg;\n }\n this.onerror(message, this.err\n\n // no hope of rescue.\n );this.write_in_progress = false;\n if (this.pending_close) {\n this.close();\n }\n};\n\nZlib.prototype.init = function (windowBits, level, memLevel, strategy, dictionary) {\n assert(arguments.length === 4 || arguments.length === 5, 'init(windowBits, level, memLevel, strategy, [dictionary])');\n\n assert(windowBits >= 8 && windowBits <= 15, 'invalid windowBits');\n assert(level >= -1 && level <= 9, 'invalid compression level');\n\n assert(memLevel >= 1 && memLevel <= 9, 'invalid memlevel');\n\n assert(strategy === exports.Z_FILTERED || strategy === exports.Z_HUFFMAN_ONLY || strategy === exports.Z_RLE || strategy === exports.Z_FIXED || strategy === exports.Z_DEFAULT_STRATEGY, 'invalid strategy');\n\n this._init(level, windowBits, memLevel, strategy, dictionary);\n this._setDictionary();\n};\n\nZlib.prototype.params = function () {\n throw new Error('deflateParams Not supported');\n};\n\nZlib.prototype.reset = function () {\n this._reset();\n this._setDictionary();\n};\n\nZlib.prototype._init = function (level, windowBits, memLevel, strategy, dictionary) {\n this.level = level;\n this.windowBits = windowBits;\n this.memLevel = memLevel;\n this.strategy = strategy;\n\n this.flush = exports.Z_NO_FLUSH;\n\n this.err = exports.Z_OK;\n\n if (this.mode === exports.GZIP || this.mode === exports.GUNZIP) {\n this.windowBits += 16;\n }\n\n if (this.mode === exports.UNZIP) {\n this.windowBits += 32;\n }\n\n if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW) {\n this.windowBits = -1 * this.windowBits;\n }\n\n this.strm = new Zstream();\n\n switch (this.mode) {\n case exports.DEFLATE:\n case exports.GZIP:\n case exports.DEFLATERAW:\n this.err = zlib_deflate.deflateInit2(this.strm, this.level, exports.Z_DEFLATED, this.windowBits, this.memLevel, this.strategy);\n break;\n case exports.INFLATE:\n case exports.GUNZIP:\n case exports.INFLATERAW:\n case exports.UNZIP:\n this.err = zlib_inflate.inflateInit2(this.strm, this.windowBits);\n break;\n default:\n throw new Error('Unknown mode ' + this.mode);\n }\n\n if (this.err !== exports.Z_OK) {\n this._error('Init error');\n }\n\n this.dictionary = dictionary;\n\n this.write_in_progress = false;\n this.init_done = true;\n};\n\nZlib.prototype._setDictionary = function () {\n if (this.dictionary == null) {\n return;\n }\n\n this.err = exports.Z_OK;\n\n switch (this.mode) {\n case exports.DEFLATE:\n case exports.DEFLATERAW:\n this.err = zlib_deflate.deflateSetDictionary(this.strm, this.dictionary);\n break;\n default:\n break;\n }\n\n if (this.err !== exports.Z_OK) {\n this._error('Failed to set dictionary');\n }\n};\n\nZlib.prototype._reset = function () {\n this.err = exports.Z_OK;\n\n switch (this.mode) {\n case exports.DEFLATE:\n case exports.DEFLATERAW:\n case exports.GZIP:\n this.err = zlib_deflate.deflateReset(this.strm);\n break;\n case exports.INFLATE:\n case exports.INFLATERAW:\n case exports.GUNZIP:\n this.err = zlib_inflate.inflateReset(this.strm);\n break;\n default:\n break;\n }\n\n if (this.err !== exports.Z_OK) {\n this._error('Failed to reset stream');\n }\n};\n\nexports.Zlib = Zlib;\n}).call(this)}).call(this,require('_process'),require(\"buffer\").Buffer)\n},{\"_process\":60,\"assert\":23,\"buffer\":33,\"pako/lib/zlib/constants\":51,\"pako/lib/zlib/deflate.js\":53,\"pako/lib/zlib/inflate.js\":55,\"pako/lib/zlib/zstream\":59}],32:[function(require,module,exports){\n(function (process){(function (){\n'use strict';\n\nvar Buffer = require('buffer').Buffer;\nvar Transform = require('stream').Transform;\nvar binding = require('./binding');\nvar util = require('util');\nvar assert = require('assert').ok;\nvar kMaxLength = require('buffer').kMaxLength;\nvar kRangeErrorMessage = 'Cannot create final Buffer. It would be larger ' + 'than 0x' + kMaxLength.toString(16) + ' bytes';\n\n// zlib doesn't provide these, so kludge them in following the same\n// const naming scheme zlib uses.\nbinding.Z_MIN_WINDOWBITS = 8;\nbinding.Z_MAX_WINDOWBITS = 15;\nbinding.Z_DEFAULT_WINDOWBITS = 15;\n\n// fewer than 64 bytes per chunk is stupid.\n// technically it could work with as few as 8, but even 64 bytes\n// is absurdly low. Usually a MB or more is best.\nbinding.Z_MIN_CHUNK = 64;\nbinding.Z_MAX_CHUNK = Infinity;\nbinding.Z_DEFAULT_CHUNK = 16 * 1024;\n\nbinding.Z_MIN_MEMLEVEL = 1;\nbinding.Z_MAX_MEMLEVEL = 9;\nbinding.Z_DEFAULT_MEMLEVEL = 8;\n\nbinding.Z_MIN_LEVEL = -1;\nbinding.Z_MAX_LEVEL = 9;\nbinding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION;\n\n// expose all the zlib constants\nvar bkeys = Object.keys(binding);\nfor (var bk = 0; bk < bkeys.length; bk++) {\n var bkey = bkeys[bk];\n if (bkey.match(/^Z/)) {\n Object.defineProperty(exports, bkey, {\n enumerable: true, value: binding[bkey], writable: false\n });\n }\n}\n\n// translation table for return codes.\nvar codes = {\n Z_OK: binding.Z_OK,\n Z_STREAM_END: binding.Z_STREAM_END,\n Z_NEED_DICT: binding.Z_NEED_DICT,\n Z_ERRNO: binding.Z_ERRNO,\n Z_STREAM_ERROR: binding.Z_STREAM_ERROR,\n Z_DATA_ERROR: binding.Z_DATA_ERROR,\n Z_MEM_ERROR: binding.Z_MEM_ERROR,\n Z_BUF_ERROR: binding.Z_BUF_ERROR,\n Z_VERSION_ERROR: binding.Z_VERSION_ERROR\n};\n\nvar ckeys = Object.keys(codes);\nfor (var ck = 0; ck < ckeys.length; ck++) {\n var ckey = ckeys[ck];\n codes[codes[ckey]] = ckey;\n}\n\nObject.defineProperty(exports, 'codes', {\n enumerable: true, value: Object.freeze(codes), writable: false\n});\n\nexports.Deflate = Deflate;\nexports.Inflate = Inflate;\nexports.Gzip = Gzip;\nexports.Gunzip = Gunzip;\nexports.DeflateRaw = DeflateRaw;\nexports.InflateRaw = InflateRaw;\nexports.Unzip = Unzip;\n\nexports.createDeflate = function (o) {\n return new Deflate(o);\n};\n\nexports.createInflate = function (o) {\n return new Inflate(o);\n};\n\nexports.createDeflateRaw = function (o) {\n return new DeflateRaw(o);\n};\n\nexports.createInflateRaw = function (o) {\n return new InflateRaw(o);\n};\n\nexports.createGzip = function (o) {\n return new Gzip(o);\n};\n\nexports.createGunzip = function (o) {\n return new Gunzip(o);\n};\n\nexports.createUnzip = function (o) {\n return new Unzip(o);\n};\n\n// Convenience methods.\n// compress/decompress a string or buffer in one step.\nexports.deflate = function (buffer, opts, callback) {\n if (typeof opts === 'function') {\n callback = opts;\n opts = {};\n }\n return zlibBuffer(new Deflate(opts), buffer, callback);\n};\n\nexports.deflateSync = function (buffer, opts) {\n return zlibBufferSync(new Deflate(opts), buffer);\n};\n\nexports.gzip = function (buffer, opts, callback) {\n if (typeof opts === 'function') {\n callback = opts;\n opts = {};\n }\n return zlibBuffer(new Gzip(opts), buffer, callback);\n};\n\nexports.gzipSync = function (buffer, opts) {\n return zlibBufferSync(new Gzip(opts), buffer);\n};\n\nexports.deflateRaw = function (buffer, opts, callback) {\n if (typeof opts === 'function') {\n callback = opts;\n opts = {};\n }\n return zlibBuffer(new DeflateRaw(opts), buffer, callback);\n};\n\nexports.deflateRawSync = function (buffer, opts) {\n return zlibBufferSync(new DeflateRaw(opts), buffer);\n};\n\nexports.unzip = function (buffer, opts, callback) {\n if (typeof opts === 'function') {\n callback = opts;\n opts = {};\n }\n return zlibBuffer(new Unzip(opts), buffer, callback);\n};\n\nexports.unzipSync = function (buffer, opts) {\n return zlibBufferSync(new Unzip(opts), buffer);\n};\n\nexports.inflate = function (buffer, opts, callback) {\n if (typeof opts === 'function') {\n callback = opts;\n opts = {};\n }\n return zlibBuffer(new Inflate(opts), buffer, callback);\n};\n\nexports.inflateSync = function (buffer, opts) {\n return zlibBufferSync(new Inflate(opts), buffer);\n};\n\nexports.gunzip = function (buffer, opts, callback) {\n if (typeof opts === 'function') {\n callback = opts;\n opts = {};\n }\n return zlibBuffer(new Gunzip(opts), buffer, callback);\n};\n\nexports.gunzipSync = function (buffer, opts) {\n return zlibBufferSync(new Gunzip(opts), buffer);\n};\n\nexports.inflateRaw = function (buffer, opts, callback) {\n if (typeof opts === 'function') {\n callback = opts;\n opts = {};\n }\n return zlibBuffer(new InflateRaw(opts), buffer, callback);\n};\n\nexports.inflateRawSync = function (buffer, opts) {\n return zlibBufferSync(new InflateRaw(opts), buffer);\n};\n\nfunction zlibBuffer(engine, buffer, callback) {\n var buffers = [];\n var nread = 0;\n\n engine.on('error', onError);\n engine.on('end', onEnd);\n\n engine.end(buffer);\n flow();\n\n function flow() {\n var chunk;\n while (null !== (chunk = engine.read())) {\n buffers.push(chunk);\n nread += chunk.length;\n }\n engine.once('readable', flow);\n }\n\n function onError(err) {\n engine.removeListener('end', onEnd);\n engine.removeListener('readable', flow);\n callback(err);\n }\n\n function onEnd() {\n var buf;\n var err = null;\n\n if (nread >= kMaxLength) {\n err = new RangeError(kRangeErrorMessage);\n } else {\n buf = Buffer.concat(buffers, nread);\n }\n\n buffers = [];\n engine.close();\n callback(err, buf);\n }\n}\n\nfunction zlibBufferSync(engine, buffer) {\n if (typeof buffer === 'string') buffer = Buffer.from(buffer);\n\n if (!Buffer.isBuffer(buffer)) throw new TypeError('Not a string or buffer');\n\n var flushFlag = engine._finishFlushFlag;\n\n return engine._processChunk(buffer, flushFlag);\n}\n\n// generic zlib\n// minimal 2-byte header\nfunction Deflate(opts) {\n if (!(this instanceof Deflate)) return new Deflate(opts);\n Zlib.call(this, opts, binding.DEFLATE);\n}\n\nfunction Inflate(opts) {\n if (!(this instanceof Inflate)) return new Inflate(opts);\n Zlib.call(this, opts, binding.INFLATE);\n}\n\n// gzip - bigger header, same deflate compression\nfunction Gzip(opts) {\n if (!(this instanceof Gzip)) return new Gzip(opts);\n Zlib.call(this, opts, binding.GZIP);\n}\n\nfunction Gunzip(opts) {\n if (!(this instanceof Gunzip)) return new Gunzip(opts);\n Zlib.call(this, opts, binding.GUNZIP);\n}\n\n// raw - no header\nfunction DeflateRaw(opts) {\n if (!(this instanceof DeflateRaw)) return new DeflateRaw(opts);\n Zlib.call(this, opts, binding.DEFLATERAW);\n}\n\nfunction InflateRaw(opts) {\n if (!(this instanceof InflateRaw)) return new InflateRaw(opts);\n Zlib.call(this, opts, binding.INFLATERAW);\n}\n\n// auto-detect header.\nfunction Unzip(opts) {\n if (!(this instanceof Unzip)) return new Unzip(opts);\n Zlib.call(this, opts, binding.UNZIP);\n}\n\nfunction isValidFlushFlag(flag) {\n return flag === binding.Z_NO_FLUSH || flag === binding.Z_PARTIAL_FLUSH || flag === binding.Z_SYNC_FLUSH || flag === binding.Z_FULL_FLUSH || flag === binding.Z_FINISH || flag === binding.Z_BLOCK;\n}\n\n// the Zlib class they all inherit from\n// This thing manages the queue of requests, and returns\n// true or false if there is anything in the queue when\n// you call the .write() method.\n\nfunction Zlib(opts, mode) {\n var _this = this;\n\n this._opts = opts = opts || {};\n this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK;\n\n Transform.call(this, opts);\n\n if (opts.flush && !isValidFlushFlag(opts.flush)) {\n throw new Error('Invalid flush flag: ' + opts.flush);\n }\n if (opts.finishFlush && !isValidFlushFlag(opts.finishFlush)) {\n throw new Error('Invalid flush flag: ' + opts.finishFlush);\n }\n\n this._flushFlag = opts.flush || binding.Z_NO_FLUSH;\n this._finishFlushFlag = typeof opts.finishFlush !== 'undefined' ? opts.finishFlush : binding.Z_FINISH;\n\n if (opts.chunkSize) {\n if (opts.chunkSize < exports.Z_MIN_CHUNK || opts.chunkSize > exports.Z_MAX_CHUNK) {\n throw new Error('Invalid chunk size: ' + opts.chunkSize);\n }\n }\n\n if (opts.windowBits) {\n if (opts.windowBits < exports.Z_MIN_WINDOWBITS || opts.windowBits > exports.Z_MAX_WINDOWBITS) {\n throw new Error('Invalid windowBits: ' + opts.windowBits);\n }\n }\n\n if (opts.level) {\n if (opts.level < exports.Z_MIN_LEVEL || opts.level > exports.Z_MAX_LEVEL) {\n throw new Error('Invalid compression level: ' + opts.level);\n }\n }\n\n if (opts.memLevel) {\n if (opts.memLevel < exports.Z_MIN_MEMLEVEL || opts.memLevel > exports.Z_MAX_MEMLEVEL) {\n throw new Error('Invalid memLevel: ' + opts.memLevel);\n }\n }\n\n if (opts.strategy) {\n if (opts.strategy != exports.Z_FILTERED && opts.strategy != exports.Z_HUFFMAN_ONLY && opts.strategy != exports.Z_RLE && opts.strategy != exports.Z_FIXED && opts.strategy != exports.Z_DEFAULT_STRATEGY) {\n throw new Error('Invalid strategy: ' + opts.strategy);\n }\n }\n\n if (opts.dictionary) {\n if (!Buffer.isBuffer(opts.dictionary)) {\n throw new Error('Invalid dictionary: it should be a Buffer instance');\n }\n }\n\n this._handle = new binding.Zlib(mode);\n\n var self = this;\n this._hadError = false;\n this._handle.onerror = function (message, errno) {\n // there is no way to cleanly recover.\n // continuing only obscures problems.\n _close(self);\n self._hadError = true;\n\n var error = new Error(message);\n error.errno = errno;\n error.code = exports.codes[errno];\n self.emit('error', error);\n };\n\n var level = exports.Z_DEFAULT_COMPRESSION;\n if (typeof opts.level === 'number') level = opts.level;\n\n var strategy = exports.Z_DEFAULT_STRATEGY;\n if (typeof opts.strategy === 'number') strategy = opts.strategy;\n\n this._handle.init(opts.windowBits || exports.Z_DEFAULT_WINDOWBITS, level, opts.memLevel || exports.Z_DEFAULT_MEMLEVEL, strategy, opts.dictionary);\n\n this._buffer = Buffer.allocUnsafe(this._chunkSize);\n this._offset = 0;\n this._level = level;\n this._strategy = strategy;\n\n this.once('end', this.close);\n\n Object.defineProperty(this, '_closed', {\n get: function () {\n return !_this._handle;\n },\n configurable: true,\n enumerable: true\n });\n}\n\nutil.inherits(Zlib, Transform);\n\nZlib.prototype.params = function (level, strategy, callback) {\n if (level < exports.Z_MIN_LEVEL || level > exports.Z_MAX_LEVEL) {\n throw new RangeError('Invalid compression level: ' + level);\n }\n if (strategy != exports.Z_FILTERED && strategy != exports.Z_HUFFMAN_ONLY && strategy != exports.Z_RLE && strategy != exports.Z_FIXED && strategy != exports.Z_DEFAULT_STRATEGY) {\n throw new TypeError('Invalid strategy: ' + strategy);\n }\n\n if (this._level !== level || this._strategy !== strategy) {\n var self = this;\n this.flush(binding.Z_SYNC_FLUSH, function () {\n assert(self._handle, 'zlib binding closed');\n self._handle.params(level, strategy);\n if (!self._hadError) {\n self._level = level;\n self._strategy = strategy;\n if (callback) callback();\n }\n });\n } else {\n process.nextTick(callback);\n }\n};\n\nZlib.prototype.reset = function () {\n assert(this._handle, 'zlib binding closed');\n return this._handle.reset();\n};\n\n// This is the _flush function called by the transform class,\n// internally, when the last chunk has been written.\nZlib.prototype._flush = function (callback) {\n this._transform(Buffer.alloc(0), '', callback);\n};\n\nZlib.prototype.flush = function (kind, callback) {\n var _this2 = this;\n\n var ws = this._writableState;\n\n if (typeof kind === 'function' || kind === undefined && !callback) {\n callback = kind;\n kind = binding.Z_FULL_FLUSH;\n }\n\n if (ws.ended) {\n if (callback) process.nextTick(callback);\n } else if (ws.ending) {\n if (callback) this.once('end', callback);\n } else if (ws.needDrain) {\n if (callback) {\n this.once('drain', function () {\n return _this2.flush(kind, callback);\n });\n }\n } else {\n this._flushFlag = kind;\n this.write(Buffer.alloc(0), '', callback);\n }\n};\n\nZlib.prototype.close = function (callback) {\n _close(this, callback);\n process.nextTick(emitCloseNT, this);\n};\n\nfunction _close(engine, callback) {\n if (callback) process.nextTick(callback);\n\n // Caller may invoke .close after a zlib error (which will null _handle).\n if (!engine._handle) return;\n\n engine._handle.close();\n engine._handle = null;\n}\n\nfunction emitCloseNT(self) {\n self.emit('close');\n}\n\nZlib.prototype._transform = function (chunk, encoding, cb) {\n var flushFlag;\n var ws = this._writableState;\n var ending = ws.ending || ws.ended;\n var last = ending && (!chunk || ws.length === chunk.length);\n\n if (chunk !== null && !Buffer.isBuffer(chunk)) return cb(new Error('invalid input'));\n\n if (!this._handle) return cb(new Error('zlib binding closed'));\n\n // If it's the last chunk, or a final flush, we use the Z_FINISH flush flag\n // (or whatever flag was provided using opts.finishFlush).\n // If it's explicitly flushing at some other time, then we use\n // Z_FULL_FLUSH. Otherwise, use Z_NO_FLUSH for maximum compression\n // goodness.\n if (last) flushFlag = this._finishFlushFlag;else {\n flushFlag = this._flushFlag;\n // once we've flushed the last of the queue, stop flushing and\n // go back to the normal behavior.\n if (chunk.length >= ws.length) {\n this._flushFlag = this._opts.flush || binding.Z_NO_FLUSH;\n }\n }\n\n this._processChunk(chunk, flushFlag, cb);\n};\n\nZlib.prototype._processChunk = function (chunk, flushFlag, cb) {\n var availInBefore = chunk && chunk.length;\n var availOutBefore = this._chunkSize - this._offset;\n var inOff = 0;\n\n var self = this;\n\n var async = typeof cb === 'function';\n\n if (!async) {\n var buffers = [];\n var nread = 0;\n\n var error;\n this.on('error', function (er) {\n error = er;\n });\n\n assert(this._handle, 'zlib binding closed');\n do {\n var res = this._handle.writeSync(flushFlag, chunk, // in\n inOff, // in_off\n availInBefore, // in_len\n this._buffer, // out\n this._offset, //out_off\n availOutBefore); // out_len\n } while (!this._hadError && callback(res[0], res[1]));\n\n if (this._hadError) {\n throw error;\n }\n\n if (nread >= kMaxLength) {\n _close(this);\n throw new RangeError(kRangeErrorMessage);\n }\n\n var buf = Buffer.concat(buffers, nread);\n _close(this);\n\n return buf;\n }\n\n assert(this._handle, 'zlib binding closed');\n var req = this._handle.write(flushFlag, chunk, // in\n inOff, // in_off\n availInBefore, // in_len\n this._buffer, // out\n this._offset, //out_off\n availOutBefore); // out_len\n\n req.buffer = chunk;\n req.callback = callback;\n\n function callback(availInAfter, availOutAfter) {\n // When the callback is used in an async write, the callback's\n // context is the `req` object that was created. The req object\n // is === this._handle, and that's why it's important to null\n // out the values after they are done being used. `this._handle`\n // can stay in memory longer than the callback and buffer are needed.\n if (this) {\n this.buffer = null;\n this.callback = null;\n }\n\n if (self._hadError) return;\n\n var have = availOutBefore - availOutAfter;\n assert(have >= 0, 'have should not go down');\n\n if (have > 0) {\n var out = self._buffer.slice(self._offset, self._offset + have);\n self._offset += have;\n // serve some output to the consumer.\n if (async) {\n self.push(out);\n } else {\n buffers.push(out);\n nread += out.length;\n }\n }\n\n // exhausted the output buffer, or used all the input create a new one.\n if (availOutAfter === 0 || self._offset >= self._chunkSize) {\n availOutBefore = self._chunkSize;\n self._offset = 0;\n self._buffer = Buffer.allocUnsafe(self._chunkSize);\n }\n\n if (availOutAfter === 0) {\n // Not actually done. Need to reprocess.\n // Also, update the availInBefore to the availInAfter value,\n // so that if we have to hit it a third (fourth, etc.) time,\n // it'll have the correct byte counts.\n inOff += availInBefore - availInAfter;\n availInBefore = availInAfter;\n\n if (!async) return true;\n\n var newReq = self._handle.write(flushFlag, chunk, inOff, availInBefore, self._buffer, self._offset, self._chunkSize);\n newReq.callback = callback; // this same function\n newReq.buffer = chunk;\n return;\n }\n\n if (!async) return false;\n\n // finished with the chunk.\n cb();\n }\n};\n\nutil.inherits(Deflate, Zlib);\nutil.inherits(Inflate, Zlib);\nutil.inherits(Gzip, Zlib);\nutil.inherits(Gunzip, Zlib);\nutil.inherits(DeflateRaw, Zlib);\nutil.inherits(InflateRaw, Zlib);\nutil.inherits(Unzip, Zlib);\n}).call(this)}).call(this,require('_process'))\n},{\"./binding\":31,\"_process\":60,\"assert\":23,\"buffer\":33,\"stream\":61,\"util\":81}],33:[function(require,module,exports){\n(function (Buffer){(function (){\n/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\nvar K_MAX_LENGTH = 0x7fffffff\nexports.kMaxLength = K_MAX_LENGTH\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\nBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport()\n\nif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n )\n}\n\nfunction typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } }\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n}\n\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n})\n\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n})\n\nfunction createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n var buf = new Uint8Array(length)\n buf.__proto__ = Buffer.prototype\n return buf\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}\n\n// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\nif (typeof Symbol !== 'undefined' && Symbol.species != null &&\n Buffer[Symbol.species] === Buffer) {\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true,\n enumerable: false,\n writable: false\n })\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nfunction from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayLike(value)\n }\n\n if (value == null) {\n throw TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n var valueOf = value.valueOf && value.valueOf()\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n var b = fromObject(value)\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(\n value[Symbol.toPrimitive]('string'), encodingOrOffset, length\n )\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n}\n\n// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n// https://github.com/feross/buffer/pull/148\nBuffer.prototype.__proto__ = Uint8Array.prototype\nBuffer.__proto__ = Uint8Array\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n}\n\nfunction alloc (size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n}\n\nfunction allocUnsafe (size) {\n assertSize(size)\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n var length = byteLength(string, encoding) | 0\n var buf = createBuffer(length)\n\n var actual = buf.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual)\n }\n\n return buf\n}\n\nfunction fromArrayLike (array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n var buf = createBuffer(length)\n for (var i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255\n }\n return buf\n}\n\nfunction fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n var buf\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array)\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset)\n } else {\n buf = new Uint8Array(array, byteOffset, length)\n }\n\n // Return an augmented `Uint8Array` instance\n buf.__proto__ = Buffer.prototype\n return buf\n}\n\nfunction fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n var buf = createBuffer(len)\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len)\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n}\n\nfunction checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n}\n\nBuffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (isInstance(buf, Uint8Array)) {\n buf = Buffer.from(buf)\n }\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n var len = string.length\n var mustMatch = (arguments.length > 2 && arguments[2] === true)\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n// reliably in a browserify context because there could be multiple different\n// copies of the 'buffer' package in use. This method works even for Buffer\n// instances that were created from another copy of the `buffer` package.\n// See: https://github.com/feross/buffer/issues/154\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()\n if (this.length > max) str += ' ... '\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength)\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n var strLen = string.length\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0\n if (isFinite(length)) {\n length = length >>> 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf = this.subarray(start, end)\n // Return an augmented `Uint8Array` instance\n newBuf.__proto__ = Buffer.prototype\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n var limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n var limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end)\n } else if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (var i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding)\n var len = bytes.length\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0]\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n// the `instanceof` check but they should be treated as of that type.\n// See: https://github.com/feross/buffer/issues/166\nfunction isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n}\nfunction numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n}\n\n}).call(this)}).call(this,require(\"buffer\").Buffer)\n},{\"base64-js\":29,\"buffer\":33,\"ieee754\":44}],34:[function(require,module,exports){\n'use strict';\n\n/* globals\n\tAtomics,\n\tSharedArrayBuffer,\n*/\n\nvar undefined;\n\nvar $TypeError = TypeError;\n\nvar $gOPD = Object.getOwnPropertyDescriptor;\nif ($gOPD) {\n\ttry {\n\t\t$gOPD({}, '');\n\t} catch (e) {\n\t\t$gOPD = null; // this is IE 8, which has a broken gOPD\n\t}\n}\n\nvar throwTypeError = function () { throw new $TypeError(); };\nvar ThrowTypeError = $gOPD\n\t? (function () {\n\t\ttry {\n\t\t\t// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties\n\t\t\targuments.callee; // IE 8 does not throw here\n\t\t\treturn throwTypeError;\n\t\t} catch (calleeThrows) {\n\t\t\ttry {\n\t\t\t\t// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')\n\t\t\t\treturn $gOPD(arguments, 'callee').get;\n\t\t\t} catch (gOPDthrows) {\n\t\t\t\treturn throwTypeError;\n\t\t\t}\n\t\t}\n\t}())\n\t: throwTypeError;\n\nvar hasSymbols = require('has-symbols')();\n\nvar getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto\n\nvar generator; // = function * () {};\nvar generatorFunction = generator ? getProto(generator) : undefined;\nvar asyncFn; // async function() {};\nvar asyncFunction = asyncFn ? asyncFn.constructor : undefined;\nvar asyncGen; // async function * () {};\nvar asyncGenFunction = asyncGen ? getProto(asyncGen) : undefined;\nvar asyncGenIterator = asyncGen ? asyncGen() : undefined;\n\nvar TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);\n\nvar INTRINSICS = {\n\t'%Array%': Array,\n\t'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,\n\t'%ArrayBufferPrototype%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer.prototype,\n\t'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,\n\t'%ArrayPrototype%': Array.prototype,\n\t'%ArrayProto_entries%': Array.prototype.entries,\n\t'%ArrayProto_forEach%': Array.prototype.forEach,\n\t'%ArrayProto_keys%': Array.prototype.keys,\n\t'%ArrayProto_values%': Array.prototype.values,\n\t'%AsyncFromSyncIteratorPrototype%': undefined,\n\t'%AsyncFunction%': asyncFunction,\n\t'%AsyncFunctionPrototype%': asyncFunction ? asyncFunction.prototype : undefined,\n\t'%AsyncGenerator%': asyncGen ? getProto(asyncGenIterator) : undefined,\n\t'%AsyncGeneratorFunction%': asyncGenFunction,\n\t'%AsyncGeneratorPrototype%': asyncGenFunction ? asyncGenFunction.prototype : undefined,\n\t'%AsyncIteratorPrototype%': asyncGenIterator && hasSymbols && Symbol.asyncIterator ? asyncGenIterator[Symbol.asyncIterator]() : undefined,\n\t'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,\n\t'%Boolean%': Boolean,\n\t'%BooleanPrototype%': Boolean.prototype,\n\t'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,\n\t'%DataViewPrototype%': typeof DataView === 'undefined' ? undefined : DataView.prototype,\n\t'%Date%': Date,\n\t'%DatePrototype%': Date.prototype,\n\t'%decodeURI%': decodeURI,\n\t'%decodeURIComponent%': decodeURIComponent,\n\t'%encodeURI%': encodeURI,\n\t'%encodeURIComponent%': encodeURIComponent,\n\t'%Error%': Error,\n\t'%ErrorPrototype%': Error.prototype,\n\t'%eval%': eval, // eslint-disable-line no-eval\n\t'%EvalError%': EvalError,\n\t'%EvalErrorPrototype%': EvalError.prototype,\n\t'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,\n\t'%Float32ArrayPrototype%': typeof Float32Array === 'undefined' ? undefined : Float32Array.prototype,\n\t'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,\n\t'%Float64ArrayPrototype%': typeof Float64Array === 'undefined' ? undefined : Float64Array.prototype,\n\t'%Function%': Function,\n\t'%FunctionPrototype%': Function.prototype,\n\t'%Generator%': generator ? getProto(generator()) : undefined,\n\t'%GeneratorFunction%': generatorFunction,\n\t'%GeneratorPrototype%': generatorFunction ? generatorFunction.prototype : undefined,\n\t'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,\n\t'%Int8ArrayPrototype%': typeof Int8Array === 'undefined' ? undefined : Int8Array.prototype,\n\t'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,\n\t'%Int16ArrayPrototype%': typeof Int16Array === 'undefined' ? undefined : Int8Array.prototype,\n\t'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,\n\t'%Int32ArrayPrototype%': typeof Int32Array === 'undefined' ? undefined : Int32Array.prototype,\n\t'%isFinite%': isFinite,\n\t'%isNaN%': isNaN,\n\t'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,\n\t'%JSON%': typeof JSON === 'object' ? JSON : undefined,\n\t'%JSONParse%': typeof JSON === 'object' ? JSON.parse : undefined,\n\t'%Map%': typeof Map === 'undefined' ? undefined : Map,\n\t'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),\n\t'%MapPrototype%': typeof Map === 'undefined' ? undefined : Map.prototype,\n\t'%Math%': Math,\n\t'%Number%': Number,\n\t'%NumberPrototype%': Number.prototype,\n\t'%Object%': Object,\n\t'%ObjectPrototype%': Object.prototype,\n\t'%ObjProto_toString%': Object.prototype.toString,\n\t'%ObjProto_valueOf%': Object.prototype.valueOf,\n\t'%parseFloat%': parseFloat,\n\t'%parseInt%': parseInt,\n\t'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,\n\t'%PromisePrototype%': typeof Promise === 'undefined' ? undefined : Promise.prototype,\n\t'%PromiseProto_then%': typeof Promise === 'undefined' ? undefined : Promise.prototype.then,\n\t'%Promise_all%': typeof Promise === 'undefined' ? undefined : Promise.all,\n\t'%Promise_reject%': typeof Promise === 'undefined' ? undefined : Promise.reject,\n\t'%Promise_resolve%': typeof Promise === 'undefined' ? undefined : Promise.resolve,\n\t'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,\n\t'%RangeError%': RangeError,\n\t'%RangeErrorPrototype%': RangeError.prototype,\n\t'%ReferenceError%': ReferenceError,\n\t'%ReferenceErrorPrototype%': ReferenceError.prototype,\n\t'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,\n\t'%RegExp%': RegExp,\n\t'%RegExpPrototype%': RegExp.prototype,\n\t'%Set%': typeof Set === 'undefined' ? undefined : Set,\n\t'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),\n\t'%SetPrototype%': typeof Set === 'undefined' ? undefined : Set.prototype,\n\t'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,\n\t'%SharedArrayBufferPrototype%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer.prototype,\n\t'%String%': String,\n\t'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,\n\t'%StringPrototype%': String.prototype,\n\t'%Symbol%': hasSymbols ? Symbol : undefined,\n\t'%SymbolPrototype%': hasSymbols ? Symbol.prototype : undefined,\n\t'%SyntaxError%': SyntaxError,\n\t'%SyntaxErrorPrototype%': SyntaxError.prototype,\n\t'%ThrowTypeError%': ThrowTypeError,\n\t'%TypedArray%': TypedArray,\n\t'%TypedArrayPrototype%': TypedArray ? TypedArray.prototype : undefined,\n\t'%TypeError%': $TypeError,\n\t'%TypeErrorPrototype%': $TypeError.prototype,\n\t'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,\n\t'%Uint8ArrayPrototype%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array.prototype,\n\t'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,\n\t'%Uint8ClampedArrayPrototype%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray.prototype,\n\t'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,\n\t'%Uint16ArrayPrototype%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array.prototype,\n\t'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,\n\t'%Uint32ArrayPrototype%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array.prototype,\n\t'%URIError%': URIError,\n\t'%URIErrorPrototype%': URIError.prototype,\n\t'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,\n\t'%WeakMapPrototype%': typeof WeakMap === 'undefined' ? undefined : WeakMap.prototype,\n\t'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet,\n\t'%WeakSetPrototype%': typeof WeakSet === 'undefined' ? undefined : WeakSet.prototype\n};\n\nvar bind = require('function-bind');\nvar $replace = bind.call(Function.call, String.prototype.replace);\n\n/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */\nvar rePropName = /[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g;\nvar reEscapeChar = /\\\\(\\\\)?/g; /** Used to match backslashes in property paths. */\nvar stringToPath = function stringToPath(string) {\n\tvar result = [];\n\t$replace(string, rePropName, function (match, number, quote, subString) {\n\t\tresult[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : (number || match);\n\t});\n\treturn result;\n};\n/* end adaptation */\n\nvar getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {\n\tif (!(name in INTRINSICS)) {\n\t\tthrow new SyntaxError('intrinsic ' + name + ' does not exist!');\n\t}\n\n\t// istanbul ignore if // hopefully this is impossible to test :-)\n\tif (typeof INTRINSICS[name] === 'undefined' && !allowMissing) {\n\t\tthrow new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');\n\t}\n\n\treturn INTRINSICS[name];\n};\n\nmodule.exports = function GetIntrinsic(name, allowMissing) {\n\tif (typeof name !== 'string' || name.length === 0) {\n\t\tthrow new TypeError('intrinsic name must be a non-empty string');\n\t}\n\tif (arguments.length > 1 && typeof allowMissing !== 'boolean') {\n\t\tthrow new TypeError('\"allowMissing\" argument must be a boolean');\n\t}\n\n\tvar parts = stringToPath(name);\n\n\tvar value = getBaseIntrinsic('%' + (parts.length > 0 ? parts[0] : '') + '%', allowMissing);\n\tfor (var i = 1; i < parts.length; i += 1) {\n\t\tif (value != null) {\n\t\t\tif ($gOPD && (i + 1) >= parts.length) {\n\t\t\t\tvar desc = $gOPD(value, parts[i]);\n\t\t\t\tif (!allowMissing && !(parts[i] in value)) {\n\t\t\t\t\tthrow new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');\n\t\t\t\t}\n\t\t\t\tvalue = desc ? (desc.get || desc.value) : value[parts[i]];\n\t\t\t} else {\n\t\t\t\tvalue = value[parts[i]];\n\t\t\t}\n\t\t}\n\t}\n\treturn value;\n};\n\n},{\"function-bind\":41,\"has-symbols\":42}],35:[function(require,module,exports){\n'use strict';\n\nvar bind = require('function-bind');\n\nvar GetIntrinsic = require('../GetIntrinsic');\n\nvar $Function = GetIntrinsic('%Function%');\nvar $apply = $Function.apply;\nvar $call = $Function.call;\n\nmodule.exports = function callBind() {\n\treturn bind.apply($call, arguments);\n};\n\nmodule.exports.apply = function applyBind() {\n\treturn bind.apply($apply, arguments);\n};\n\n},{\"../GetIntrinsic\":34,\"function-bind\":41}],36:[function(require,module,exports){\n'use strict';\n\nvar GetIntrinsic = require('../GetIntrinsic');\n\nvar callBind = require('./callBind');\n\nvar $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));\n\nmodule.exports = function callBoundIntrinsic(name, allowMissing) {\n\tvar intrinsic = GetIntrinsic(name, !!allowMissing);\n\tif (typeof intrinsic === 'function' && $indexOf(name, '.prototype.')) {\n\t\treturn callBind(intrinsic);\n\t}\n\treturn intrinsic;\n};\n\n},{\"../GetIntrinsic\":34,\"./callBind\":35}],37:[function(require,module,exports){\n'use strict';\n\nvar GetIntrinsic = require('../GetIntrinsic');\n\nvar $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%');\nif ($gOPD) {\n\ttry {\n\t\t$gOPD([], 'length');\n\t} catch (e) {\n\t\t// IE 8 has a broken gOPD\n\t\t$gOPD = null;\n\t}\n}\n\nmodule.exports = $gOPD;\n\n},{\"../GetIntrinsic\":34}],38:[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar R = typeof Reflect === 'object' ? Reflect : null\nvar ReflectApply = R && typeof R.apply === 'function'\n ? R.apply\n : function ReflectApply(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n }\n\nvar ReflectOwnKeys\nif (R && typeof R.ownKeys === 'function') {\n ReflectOwnKeys = R.ownKeys\n} else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target)\n .concat(Object.getOwnPropertySymbols(target));\n };\n} else {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target);\n };\n}\n\nfunction ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n}\n\nvar NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {\n return value !== value;\n}\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\nmodule.exports.once = once;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nfunction checkListener(listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n}\n\nObject.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + arg + '.');\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {\n throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + n + '.');\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction _getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n};\n\nEventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = (type === 'error');\n\n var events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node's output if this results in an unhandled exception.\n throw er; // Unhandled 'error' event\n }\n // At least give some kind of context to the user\n var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));\n err.context = er;\n throw err; // Unhandled 'error' event\n }\n\n var handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n checkListener(listener);\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we've already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n var w = new Error('Possible EventEmitter memory leak detected. ' +\n existing.length + ' ' + String(type) + ' listeners ' +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n checkListener(listener);\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (events === undefined)\n return [];\n\n var evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events !== undefined) {\n var evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\nfunction once(emitter, name) {\n return new Promise(function (resolve, reject) {\n function eventListener() {\n if (errorListener !== undefined) {\n emitter.removeListener('error', errorListener);\n }\n resolve([].slice.call(arguments));\n };\n var errorListener;\n\n // Adding an error listener is not optional because\n // if an error is thrown on an event emitter we cannot\n // guarantee that the actual event we are waiting will\n // be fired. The result could be a silent way to create\n // memory or file descriptor leaks, which is something\n // we should avoid.\n if (name !== 'error') {\n errorListener = function errorListener(err) {\n emitter.removeListener(name, eventListener);\n reject(err);\n };\n\n emitter.once('error', errorListener);\n }\n\n emitter.once(name, eventListener);\n });\n}\n\n},{}],39:[function(require,module,exports){\n\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toString = Object.prototype.toString;\n\nmodule.exports = function forEach (obj, fn, ctx) {\n if (toString.call(fn) !== '[object Function]') {\n throw new TypeError('iterator must be a function');\n }\n var l = obj.length;\n if (l === +l) {\n for (var i = 0; i < l; i++) {\n fn.call(ctx, obj[i], i, obj);\n }\n } else {\n for (var k in obj) {\n if (hasOwn.call(obj, k)) {\n fn.call(ctx, obj[k], k, obj);\n }\n }\n }\n};\n\n\n},{}],40:[function(require,module,exports){\n'use strict';\n\n/* eslint no-invalid-this: 1 */\n\nvar ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';\nvar slice = Array.prototype.slice;\nvar toStr = Object.prototype.toString;\nvar funcType = '[object Function]';\n\nmodule.exports = function bind(that) {\n var target = this;\n if (typeof target !== 'function' || toStr.call(target) !== funcType) {\n throw new TypeError(ERROR_MESSAGE + target);\n }\n var args = slice.call(arguments, 1);\n\n var bound;\n var binder = function () {\n if (this instanceof bound) {\n var result = target.apply(\n this,\n args.concat(slice.call(arguments))\n );\n if (Object(result) === result) {\n return result;\n }\n return this;\n } else {\n return target.apply(\n that,\n args.concat(slice.call(arguments))\n );\n }\n };\n\n var boundLength = Math.max(0, target.length - args.length);\n var boundArgs = [];\n for (var i = 0; i < boundLength; i++) {\n boundArgs.push('$' + i);\n }\n\n bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);\n\n if (target.prototype) {\n var Empty = function Empty() {};\n Empty.prototype = target.prototype;\n bound.prototype = new Empty();\n Empty.prototype = null;\n }\n\n return bound;\n};\n\n},{}],41:[function(require,module,exports){\n'use strict';\n\nvar implementation = require('./implementation');\n\nmodule.exports = Function.prototype.bind || implementation;\n\n},{\"./implementation\":40}],42:[function(require,module,exports){\n(function (global){(function (){\n'use strict';\n\nvar origSymbol = global.Symbol;\nvar hasSymbolSham = require('./shams');\n\nmodule.exports = function hasNativeSymbols() {\n\tif (typeof origSymbol !== 'function') { return false; }\n\tif (typeof Symbol !== 'function') { return false; }\n\tif (typeof origSymbol('foo') !== 'symbol') { return false; }\n\tif (typeof Symbol('bar') !== 'symbol') { return false; }\n\n\treturn hasSymbolSham();\n};\n\n}).call(this)}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"./shams\":43}],43:[function(require,module,exports){\n'use strict';\n\n/* eslint complexity: [2, 18], max-statements: [2, 33] */\nmodule.exports = function hasSymbols() {\n\tif (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }\n\tif (typeof Symbol.iterator === 'symbol') { return true; }\n\n\tvar obj = {};\n\tvar sym = Symbol('test');\n\tvar symObj = Object(sym);\n\tif (typeof sym === 'string') { return false; }\n\n\tif (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }\n\tif (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }\n\n\t// temp disabled per https://github.com/ljharb/object.assign/issues/17\n\t// if (sym instanceof Symbol) { return false; }\n\t// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4\n\t// if (!(symObj instanceof Symbol)) { return false; }\n\n\t// if (typeof Symbol.prototype.toString !== 'function') { return false; }\n\t// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }\n\n\tvar symVal = 42;\n\tobj[sym] = symVal;\n\tfor (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax\n\tif (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }\n\n\tif (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }\n\n\tvar syms = Object.getOwnPropertySymbols(obj);\n\tif (syms.length !== 1 || syms[0] !== sym) { return false; }\n\n\tif (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }\n\n\tif (typeof Object.getOwnPropertyDescriptor === 'function') {\n\t\tvar descriptor = Object.getOwnPropertyDescriptor(obj, sym);\n\t\tif (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }\n\t}\n\n\treturn true;\n};\n\n},{}],44:[function(require,module,exports){\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n\n},{}],45:[function(require,module,exports){\nif (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n })\n }\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n }\n}\n\n},{}],46:[function(require,module,exports){\n'use strict';\n\nvar hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';\nvar toStr = Object.prototype.toString;\n\nvar isStandardArguments = function isArguments(value) {\n\tif (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) {\n\t\treturn false;\n\t}\n\treturn toStr.call(value) === '[object Arguments]';\n};\n\nvar isLegacyArguments = function isArguments(value) {\n\tif (isStandardArguments(value)) {\n\t\treturn true;\n\t}\n\treturn value !== null &&\n\t\ttypeof value === 'object' &&\n\t\ttypeof value.length === 'number' &&\n\t\tvalue.length >= 0 &&\n\t\ttoStr.call(value) !== '[object Array]' &&\n\t\ttoStr.call(value.callee) === '[object Function]';\n};\n\nvar supportsStandardArguments = (function () {\n\treturn isStandardArguments(arguments);\n}());\n\nisStandardArguments.isLegacyArguments = isLegacyArguments; // for tests\n\nmodule.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;\n\n},{}],47:[function(require,module,exports){\n'use strict';\n\nvar toStr = Object.prototype.toString;\nvar fnToStr = Function.prototype.toString;\nvar isFnRegex = /^\\s*(?:function)?\\*/;\nvar hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';\nvar getProto = Object.getPrototypeOf;\nvar getGeneratorFunc = function () { // eslint-disable-line consistent-return\n\tif (!hasToStringTag) {\n\t\treturn false;\n\t}\n\ttry {\n\t\treturn Function('return function*() {}')();\n\t} catch (e) {\n\t}\n};\nvar generatorFunc = getGeneratorFunc();\nvar GeneratorFunction = generatorFunc ? getProto(generatorFunc) : {};\n\nmodule.exports = function isGeneratorFunction(fn) {\n\tif (typeof fn !== 'function') {\n\t\treturn false;\n\t}\n\tif (isFnRegex.test(fnToStr.call(fn))) {\n\t\treturn true;\n\t}\n\tif (!hasToStringTag) {\n\t\tvar str = toStr.call(fn);\n\t\treturn str === '[object GeneratorFunction]';\n\t}\n\treturn getProto(fn) === GeneratorFunction;\n};\n\n},{}],48:[function(require,module,exports){\n(function (global){(function (){\n'use strict';\n\nvar forEach = require('foreach');\nvar availableTypedArrays = require('available-typed-arrays');\nvar callBound = require('es-abstract/helpers/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\nvar hasSymbols = require('has-symbols')();\nvar hasToStringTag = hasSymbols && typeof Symbol.toStringTag === 'symbol';\n\nvar typedArrays = availableTypedArrays();\n\nvar $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {\n\tfor (var i = 0; i < array.length; i += 1) {\n\t\tif (array[i] === value) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n};\nvar $slice = callBound('String.prototype.slice');\nvar toStrTags = {};\nvar gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor');\nvar getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');\nif (hasToStringTag && gOPD && getPrototypeOf) {\n\tforEach(typedArrays, function (typedArray) {\n\t\tvar arr = new global[typedArray]();\n\t\tif (!(Symbol.toStringTag in arr)) {\n\t\t\tthrow new EvalError('this engine has support for Symbol.toStringTag, but ' + typedArray + ' does not have the property! Please report this.');\n\t\t}\n\t\tvar proto = getPrototypeOf(arr);\n\t\tvar descriptor = gOPD(proto, Symbol.toStringTag);\n\t\tif (!descriptor) {\n\t\t\tvar superProto = getPrototypeOf(proto);\n\t\t\tdescriptor = gOPD(superProto, Symbol.toStringTag);\n\t\t}\n\t\ttoStrTags[typedArray] = descriptor.get;\n\t});\n}\n\nvar tryTypedArrays = function tryAllTypedArrays(value) {\n\tvar anyTrue = false;\n\tforEach(toStrTags, function (getter, typedArray) {\n\t\tif (!anyTrue) {\n\t\t\ttry {\n\t\t\t\tanyTrue = getter.call(value) === typedArray;\n\t\t\t} catch (e) { /**/ }\n\t\t}\n\t});\n\treturn anyTrue;\n};\n\nmodule.exports = function isTypedArray(value) {\n\tif (!value || typeof value !== 'object') { return false; }\n\tif (!hasToStringTag) {\n\t\tvar tag = $slice($toString(value), 8, -1);\n\t\treturn $indexOf(typedArrays, tag) > -1;\n\t}\n\tif (!gOPD) { return false; }\n\treturn tryTypedArrays(value);\n};\n\n}).call(this)}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"available-typed-arrays\":27,\"es-abstract/helpers/callBound\":36,\"es-abstract/helpers/getOwnPropertyDescriptor\":37,\"foreach\":39,\"has-symbols\":42}],49:[function(require,module,exports){\n'use strict';\n\n\nvar TYPED_OK = (typeof Uint8Array !== 'undefined') &&\n (typeof Uint16Array !== 'undefined') &&\n (typeof Int32Array !== 'undefined');\n\nfunction _has(obj, key) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nexports.assign = function (obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1);\n while (sources.length) {\n var source = sources.shift();\n if (!source) { continue; }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object');\n }\n\n for (var p in source) {\n if (_has(source, p)) {\n obj[p] = source[p];\n }\n }\n }\n\n return obj;\n};\n\n\n// reduce buffer size, avoiding mem copy\nexports.shrinkBuf = function (buf, size) {\n if (buf.length === size) { return buf; }\n if (buf.subarray) { return buf.subarray(0, size); }\n buf.length = size;\n return buf;\n};\n\n\nvar fnTyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n if (src.subarray && dest.subarray) {\n dest.set(src.subarray(src_offs, src_offs + len), dest_offs);\n return;\n }\n // Fallback to ordinary array\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n var i, l, len, pos, chunk, result;\n\n // calculate data length\n len = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length;\n }\n\n // join chunks\n result = new Uint8Array(len);\n pos = 0;\n for (i = 0, l = chunks.length; i < l; i++) {\n chunk = chunks[i];\n result.set(chunk, pos);\n pos += chunk.length;\n }\n\n return result;\n }\n};\n\nvar fnUntyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i];\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n return [].concat.apply([], chunks);\n }\n};\n\n\n// Enable/Disable typed arrays use, for testing\n//\nexports.setTyped = function (on) {\n if (on) {\n exports.Buf8 = Uint8Array;\n exports.Buf16 = Uint16Array;\n exports.Buf32 = Int32Array;\n exports.assign(exports, fnTyped);\n } else {\n exports.Buf8 = Array;\n exports.Buf16 = Array;\n exports.Buf32 = Array;\n exports.assign(exports, fnUntyped);\n }\n};\n\nexports.setTyped(TYPED_OK);\n\n},{}],50:[function(require,module,exports){\n'use strict';\n\n// Note: adler32 takes 12% for level 0 and 2% for level 6.\n// It isn't worth it to make additional optimizations as in original.\n// Small size is preferable.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction adler32(adler, buf, len, pos) {\n var s1 = (adler & 0xffff) |0,\n s2 = ((adler >>> 16) & 0xffff) |0,\n n = 0;\n\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len;\n len -= n;\n\n do {\n s1 = (s1 + buf[pos++]) |0;\n s2 = (s2 + s1) |0;\n } while (--n);\n\n s1 %= 65521;\n s2 %= 65521;\n }\n\n return (s1 | (s2 << 16)) |0;\n}\n\n\nmodule.exports = adler32;\n\n},{}],51:[function(require,module,exports){\n'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n\n /* Allowed flush values; see deflate() and inflate() below for details */\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_TREES: 6,\n\n /* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n //Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n //Z_VERSION_ERROR: -6,\n\n /* compression levels */\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n\n\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n\n /* Possible values of the data_type field (though see inflate()) */\n Z_BINARY: 0,\n Z_TEXT: 1,\n //Z_ASCII: 1, // = Z_TEXT (deprecated)\n Z_UNKNOWN: 2,\n\n /* The deflate compression method */\n Z_DEFLATED: 8\n //Z_NULL: null // Use -1 or null inline, depending on var type\n};\n\n},{}],52:[function(require,module,exports){\n'use strict';\n\n// Note: we can't get significant speed boost here.\n// So write code to minimize size - no pregenerated tables\n// and array tools dependencies.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// Use ordinary array, since untyped makes no boost here\nfunction makeTable() {\n var c, table = [];\n\n for (var n = 0; n < 256; n++) {\n c = n;\n for (var k = 0; k < 8; k++) {\n c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n table[n] = c;\n }\n\n return table;\n}\n\n// Create table on load. Just 255 signed longs. Not a problem.\nvar crcTable = makeTable();\n\n\nfunction crc32(crc, buf, len, pos) {\n var t = crcTable,\n end = pos + len;\n\n crc ^= -1;\n\n for (var i = pos; i < end; i++) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];\n }\n\n return (crc ^ (-1)); // >>> 0;\n}\n\n\nmodule.exports = crc32;\n\n},{}],53:[function(require,module,exports){\n'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar trees = require('./trees');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar msg = require('./messages');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\nvar Z_NO_FLUSH = 0;\nvar Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\nvar Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\n//var Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\n//var Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\n//var Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n\n/* compression levels */\n//var Z_NO_COMPRESSION = 0;\n//var Z_BEST_SPEED = 1;\n//var Z_BEST_COMPRESSION = 9;\nvar Z_DEFAULT_COMPRESSION = -1;\n\n\nvar Z_FILTERED = 1;\nvar Z_HUFFMAN_ONLY = 2;\nvar Z_RLE = 3;\nvar Z_FIXED = 4;\nvar Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\n//var Z_BINARY = 0;\n//var Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n/*============================================================================*/\n\n\nvar MAX_MEM_LEVEL = 9;\n/* Maximum value for memLevel in deflateInit2 */\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_MEM_LEVEL = 8;\n\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\nvar D_CODES = 30;\n/* number of distance codes */\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\nvar MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1);\n\nvar PRESET_DICT = 0x20;\n\nvar INIT_STATE = 42;\nvar EXTRA_STATE = 69;\nvar NAME_STATE = 73;\nvar COMMENT_STATE = 91;\nvar HCRC_STATE = 103;\nvar BUSY_STATE = 113;\nvar FINISH_STATE = 666;\n\nvar BS_NEED_MORE = 1; /* block not completed, need more input or more output */\nvar BS_BLOCK_DONE = 2; /* block flush performed */\nvar BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */\nvar BS_FINISH_DONE = 4; /* finish done, accept no more input or output */\n\nvar OS_CODE = 0x03; // Unix :) . Don't detect, use this default.\n\nfunction err(strm, errorCode) {\n strm.msg = msg[errorCode];\n return errorCode;\n}\n\nfunction rank(f) {\n return ((f) << 1) - ((f) > 4 ? 9 : 0);\n}\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n\n/* =========================================================================\n * Flush as much pending output as possible. All deflate() output goes\n * through this function so some applications may wish to modify it\n * to avoid allocating a large strm->output buffer and copying into it.\n * (See also read_buf()).\n */\nfunction flush_pending(strm) {\n var s = strm.state;\n\n //_tr_flush_bits(s);\n var len = s.pending;\n if (len > strm.avail_out) {\n len = strm.avail_out;\n }\n if (len === 0) { return; }\n\n utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);\n strm.next_out += len;\n s.pending_out += len;\n strm.total_out += len;\n strm.avail_out -= len;\n s.pending -= len;\n if (s.pending === 0) {\n s.pending_out = 0;\n }\n}\n\n\nfunction flush_block_only(s, last) {\n trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last);\n s.block_start = s.strstart;\n flush_pending(s.strm);\n}\n\n\nfunction put_byte(s, b) {\n s.pending_buf[s.pending++] = b;\n}\n\n\n/* =========================================================================\n * Put a short in the pending buffer. The 16-bit value is put in MSB order.\n * IN assertion: the stream state is correct and there is enough room in\n * pending_buf.\n */\nfunction putShortMSB(s, b) {\n// put_byte(s, (Byte)(b >> 8));\n// put_byte(s, (Byte)(b & 0xff));\n s.pending_buf[s.pending++] = (b >>> 8) & 0xff;\n s.pending_buf[s.pending++] = b & 0xff;\n}\n\n\n/* ===========================================================================\n * Read a new buffer from the current input stream, update the adler32\n * and total number of bytes read. All deflate() input goes through\n * this function so some applications may wish to modify it to avoid\n * allocating a large strm->input buffer and copying from it.\n * (See also flush_pending()).\n */\nfunction read_buf(strm, buf, start, size) {\n var len = strm.avail_in;\n\n if (len > size) { len = size; }\n if (len === 0) { return 0; }\n\n strm.avail_in -= len;\n\n // zmemcpy(buf, strm->next_in, len);\n utils.arraySet(buf, strm.input, strm.next_in, len, start);\n if (strm.state.wrap === 1) {\n strm.adler = adler32(strm.adler, buf, len, start);\n }\n\n else if (strm.state.wrap === 2) {\n strm.adler = crc32(strm.adler, buf, len, start);\n }\n\n strm.next_in += len;\n strm.total_in += len;\n\n return len;\n}\n\n\n/* ===========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n * OUT assertion: the match length is not greater than s->lookahead.\n */\nfunction longest_match(s, cur_match) {\n var chain_length = s.max_chain_length; /* max hash chain length */\n var scan = s.strstart; /* current string */\n var match; /* matched string */\n var len; /* length of current match */\n var best_len = s.prev_length; /* best match length so far */\n var nice_match = s.nice_match; /* stop if match long enough */\n var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ?\n s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/;\n\n var _win = s.window; // shortcut\n\n var wmask = s.w_mask;\n var prev = s.prev;\n\n /* Stop when cur_match becomes <= limit. To simplify the code,\n * we prevent matches with the string of window index 0.\n */\n\n var strend = s.strstart + MAX_MATCH;\n var scan_end1 = _win[scan + best_len - 1];\n var scan_end = _win[scan + best_len];\n\n /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.\n * It is easy to get rid of this optimization if necessary.\n */\n // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, \"Code too clever\");\n\n /* Do not waste too much time if we already have a good match: */\n if (s.prev_length >= s.good_match) {\n chain_length >>= 2;\n }\n /* Do not look for matches beyond the end of the input. This is necessary\n * to make deflate deterministic.\n */\n if (nice_match > s.lookahead) { nice_match = s.lookahead; }\n\n // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, \"need lookahead\");\n\n do {\n // Assert(cur_match < s->strstart, \"no future\");\n match = cur_match;\n\n /* Skip to next match if the match length cannot increase\n * or if the match length is less than 2. Note that the checks below\n * for insufficient lookahead only occur occasionally for performance\n * reasons. Therefore uninitialized memory will be accessed, and\n * conditional jumps will be made that depend on those values.\n * However the length of the match is limited to the lookahead, so\n * the output of deflate is not affected by the uninitialized values.\n */\n\n if (_win[match + best_len] !== scan_end ||\n _win[match + best_len - 1] !== scan_end1 ||\n _win[match] !== _win[scan] ||\n _win[++match] !== _win[scan + 1]) {\n continue;\n }\n\n /* The check at best_len-1 can be removed because it will be made\n * again later. (This heuristic is not always a win.)\n * It is not necessary to compare scan[2] and match[2] since they\n * are always equal when the other bytes match, given that\n * the hash keys are equal and that HASH_BITS >= 8.\n */\n scan += 2;\n match++;\n // Assert(*scan == *match, \"match[2]?\");\n\n /* We check for insufficient lookahead only every 8th comparison;\n * the 256th check will be made at strstart+258.\n */\n do {\n /*jshint noempty:false*/\n } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n _win[++scan] === _win[++match] && _win[++scan] === _win[++match] &&\n scan < strend);\n\n // Assert(scan <= s->window+(unsigned)(s->window_size-1), \"wild scan\");\n\n len = MAX_MATCH - (strend - scan);\n scan = strend - MAX_MATCH;\n\n if (len > best_len) {\n s.match_start = cur_match;\n best_len = len;\n if (len >= nice_match) {\n break;\n }\n scan_end1 = _win[scan + best_len - 1];\n scan_end = _win[scan + best_len];\n }\n } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0);\n\n if (best_len <= s.lookahead) {\n return best_len;\n }\n return s.lookahead;\n}\n\n\n/* ===========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead.\n *\n * IN assertion: lookahead < MIN_LOOKAHEAD\n * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD\n * At least one byte has been read, or avail_in == 0; reads are\n * performed for at least two bytes (required for the zip translate_eol\n * option -- not supported here).\n */\nfunction fill_window(s) {\n var _w_size = s.w_size;\n var p, n, m, more, str;\n\n //Assert(s->lookahead < MIN_LOOKAHEAD, \"already enough lookahead\");\n\n do {\n more = s.window_size - s.lookahead - s.strstart;\n\n // JS ints have 32 bit, block below not needed\n /* Deal with !@#$% 64K limit: */\n //if (sizeof(int) <= 2) {\n // if (more == 0 && s->strstart == 0 && s->lookahead == 0) {\n // more = wsize;\n //\n // } else if (more == (unsigned)(-1)) {\n // /* Very unlikely, but possible on 16 bit machine if\n // * strstart == 0 && lookahead == 1 (input done a byte at time)\n // */\n // more--;\n // }\n //}\n\n\n /* If the window is almost full and there is insufficient lookahead,\n * move the upper half to the lower one to make room in the upper half.\n */\n if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {\n\n utils.arraySet(s.window, s.window, _w_size, _w_size, 0);\n s.match_start -= _w_size;\n s.strstart -= _w_size;\n /* we now have strstart >= MAX_DIST */\n s.block_start -= _w_size;\n\n /* Slide the hash table (could be avoided with 32 bit values\n at the expense of memory usage). We slide even when level == 0\n to keep the hash table consistent if we switch back to level > 0\n later. (Using level 0 permanently is not an optimal usage of\n zlib, so we don't care about this pathological case.)\n */\n\n n = s.hash_size;\n p = n;\n do {\n m = s.head[--p];\n s.head[p] = (m >= _w_size ? m - _w_size : 0);\n } while (--n);\n\n n = _w_size;\n p = n;\n do {\n m = s.prev[--p];\n s.prev[p] = (m >= _w_size ? m - _w_size : 0);\n /* If n is not on any hash chain, prev[n] is garbage but\n * its value will never be used.\n */\n } while (--n);\n\n more += _w_size;\n }\n if (s.strm.avail_in === 0) {\n break;\n }\n\n /* If there was no sliding:\n * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&\n * more == window_size - lookahead - strstart\n * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)\n * => more >= window_size - 2*WSIZE + 2\n * In the BIG_MEM or MMAP case (not yet supported),\n * window_size == input_size + MIN_LOOKAHEAD &&\n * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.\n * Otherwise, window_size == 2*WSIZE so more >= 2.\n * If there was sliding, more >= WSIZE. So in all cases, more >= 2.\n */\n //Assert(more >= 2, \"more < 2\");\n n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more);\n s.lookahead += n;\n\n /* Initialize the hash value now that we have some input: */\n if (s.lookahead + s.insert >= MIN_MATCH) {\n str = s.strstart - s.insert;\n s.ins_h = s.window[str];\n\n /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask;\n//#if MIN_MATCH != 3\n// Call update_hash() MIN_MATCH-3 more times\n//#endif\n while (s.insert) {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = str;\n str++;\n s.insert--;\n if (s.lookahead + s.insert < MIN_MATCH) {\n break;\n }\n }\n }\n /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,\n * but this is not important since only literal bytes will be emitted.\n */\n\n } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0);\n\n /* If the WIN_INIT bytes after the end of the current data have never been\n * written, then zero those bytes in order to avoid memory check reports of\n * the use of uninitialized (or uninitialised as Julian writes) bytes by\n * the longest match routines. Update the high water mark for the next\n * time through here. WIN_INIT is set to MAX_MATCH since the longest match\n * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.\n */\n// if (s.high_water < s.window_size) {\n// var curr = s.strstart + s.lookahead;\n// var init = 0;\n//\n// if (s.high_water < curr) {\n// /* Previous high water mark below current data -- zero WIN_INIT\n// * bytes or up to end of window, whichever is less.\n// */\n// init = s.window_size - curr;\n// if (init > WIN_INIT)\n// init = WIN_INIT;\n// zmemzero(s->window + curr, (unsigned)init);\n// s->high_water = curr + init;\n// }\n// else if (s->high_water < (ulg)curr + WIN_INIT) {\n// /* High water mark at or above current data, but below current data\n// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up\n// * to end of window, whichever is less.\n// */\n// init = (ulg)curr + WIN_INIT - s->high_water;\n// if (init > s->window_size - s->high_water)\n// init = s->window_size - s->high_water;\n// zmemzero(s->window + s->high_water, (unsigned)init);\n// s->high_water += init;\n// }\n// }\n//\n// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,\n// \"not enough room for search\");\n}\n\n/* ===========================================================================\n * Copy without compression as much as possible from the input stream, return\n * the current block state.\n * This function does not insert new strings in the dictionary since\n * uncompressible data is probably not useful. This function is used\n * only for the level=0 compression option.\n * NOTE: this function should be optimized to avoid extra copying from\n * window to pending_buf.\n */\nfunction deflate_stored(s, flush) {\n /* Stored blocks are limited to 0xffff bytes, pending_buf is limited\n * to pending_buf_size, and each stored block has a 5 byte header:\n */\n var max_block_size = 0xffff;\n\n if (max_block_size > s.pending_buf_size - 5) {\n max_block_size = s.pending_buf_size - 5;\n }\n\n /* Copy as much as possible from input to output: */\n for (;;) {\n /* Fill the window as much as possible: */\n if (s.lookahead <= 1) {\n\n //Assert(s->strstart < s->w_size+MAX_DIST(s) ||\n // s->block_start >= (long)s->w_size, \"slide too late\");\n// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) ||\n// s.block_start >= s.w_size)) {\n// throw new Error(\"slide too late\");\n// }\n\n fill_window(s);\n if (s.lookahead === 0 && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n\n if (s.lookahead === 0) {\n break;\n }\n /* flush the current block */\n }\n //Assert(s->block_start >= 0L, \"block gone\");\n// if (s.block_start < 0) throw new Error(\"block gone\");\n\n s.strstart += s.lookahead;\n s.lookahead = 0;\n\n /* Emit a stored block if pending_buf will be full: */\n var max_start = s.block_start + max_block_size;\n\n if (s.strstart === 0 || s.strstart >= max_start) {\n /* strstart == 0 is possible when wraparound on 16-bit machine */\n s.lookahead = s.strstart - max_start;\n s.strstart = max_start;\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n\n\n }\n /* Flush if we may have to slide, otherwise block_start may become\n * negative and the data will be gone:\n */\n if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n\n s.insert = 0;\n\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n\n if (s.strstart > s.block_start) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_NEED_MORE;\n}\n\n/* ===========================================================================\n * Compress as much as possible from the input stream, return the current\n * block state.\n * This function does not perform lazy evaluation of matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\nfunction deflate_fast(s, flush) {\n var hash_head; /* head of the hash chain */\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) {\n break; /* flush the current block */\n }\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n * At this point we have always match_length < MIN_MATCH\n */\n if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n }\n if (s.match_length >= MIN_MATCH) {\n // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only\n\n /*** _tr_tally_dist(s, s.strstart - s.match_start,\n s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n\n /* Insert new strings in the hash table only if the match length\n * is not too large. This saves time but degrades compression.\n */\n if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) {\n s.match_length--; /* string at strstart already in table */\n do {\n s.strstart++;\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n * always MIN_MATCH bytes ahead.\n */\n } while (--s.match_length !== 0);\n s.strstart++;\n } else\n {\n s.strstart += s.match_length;\n s.match_length = 0;\n s.ins_h = s.window[s.strstart];\n /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask;\n\n//#if MIN_MATCH != 3\n// Call UPDATE_HASH() MIN_MATCH-3 more times\n//#endif\n /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not\n * matter since it will be recomputed at next deflate call.\n */\n }\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s.window[s.strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1);\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\nfunction deflate_slow(s, flush) {\n var hash_head; /* head of hash chain */\n var bflush; /* set if current block must be flushed */\n\n var max_insert;\n\n /* Process the input block. */\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n if (s.lookahead < MIN_LOOKAHEAD) {\n fill_window(s);\n if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n hash_head = 0/*NIL*/;\n if (s.lookahead >= MIN_MATCH) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n\n /* Find the longest match, discarding those <= prev_length.\n */\n s.prev_length = s.match_length;\n s.prev_match = s.match_start;\n s.match_length = MIN_MATCH - 1;\n\n if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match &&\n s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n s.match_length = longest_match(s, hash_head);\n /* longest_match() sets match_start */\n\n if (s.match_length <= 5 &&\n (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) {\n\n /* If prev_match is also MIN_MATCH, match_start is garbage\n * but we will ignore the current match anyway.\n */\n s.match_length = MIN_MATCH - 1;\n }\n }\n /* If there was a match at the previous step and the current\n * match is not better, output the previous match:\n */\n if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {\n max_insert = s.strstart + s.lookahead - MIN_MATCH;\n /* Do not insert strings in hash table beyond this. */\n\n //check_match(s, s.strstart-1, s.prev_match, s.prev_length);\n\n /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match,\n s.prev_length - MIN_MATCH, bflush);***/\n bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH);\n /* Insert in hash table all strings up to the end of the match.\n * strstart-1 and strstart are already inserted. If there is not\n * enough lookahead, the last two strings are not inserted in\n * the hash table.\n */\n s.lookahead -= s.prev_length - 1;\n s.prev_length -= 2;\n do {\n if (++s.strstart <= max_insert) {\n /*** INSERT_STRING(s, s.strstart, hash_head); ***/\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask;\n hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h];\n s.head[s.ins_h] = s.strstart;\n /***/\n }\n } while (--s.prev_length !== 0);\n s.match_available = 0;\n s.match_length = MIN_MATCH - 1;\n s.strstart++;\n\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n } else if (s.match_available) {\n /* If there was no match at the previous position, output a\n * single literal. If there was a match but the current match\n * is longer, truncate the previous match to a single literal.\n */\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n if (bflush) {\n /*** FLUSH_BLOCK_ONLY(s, 0) ***/\n flush_block_only(s, false);\n /***/\n }\n s.strstart++;\n s.lookahead--;\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n } else {\n /* There is no previous match to compare with, wait for\n * the next step to decide.\n */\n s.match_available = 1;\n s.strstart++;\n s.lookahead--;\n }\n }\n //Assert (flush != Z_NO_FLUSH, \"no flush?\");\n if (s.match_available) {\n //Tracevv((stderr,\"%c\", s->window[s->strstart-1]));\n /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]);\n\n s.match_available = 0;\n }\n s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n\n return BS_BLOCK_DONE;\n}\n\n\n/* ===========================================================================\n * For Z_RLE, simply look for runs of bytes, generate matches only of distance\n * one. Do not maintain a hash table. (It will be regenerated if this run of\n * deflate switches away from Z_RLE.)\n */\nfunction deflate_rle(s, flush) {\n var bflush; /* set if current block must be flushed */\n var prev; /* byte at distance one to match */\n var scan, strend; /* scan goes up to strend for length of run */\n\n var _win = s.window;\n\n for (;;) {\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the longest run, plus one for the unrolled loop.\n */\n if (s.lookahead <= MAX_MATCH) {\n fill_window(s);\n if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n if (s.lookahead === 0) { break; } /* flush the current block */\n }\n\n /* See how many times the previous byte repeats */\n s.match_length = 0;\n if (s.lookahead >= MIN_MATCH && s.strstart > 0) {\n scan = s.strstart - 1;\n prev = _win[scan];\n if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {\n strend = s.strstart + MAX_MATCH;\n do {\n /*jshint noempty:false*/\n } while (prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n prev === _win[++scan] && prev === _win[++scan] &&\n scan < strend);\n s.match_length = MAX_MATCH - (strend - scan);\n if (s.match_length > s.lookahead) {\n s.match_length = s.lookahead;\n }\n }\n //Assert(scan <= s->window+(uInt)(s->window_size-1), \"wild scan\");\n }\n\n /* Emit match if have run of MIN_MATCH or longer, else emit literal */\n if (s.match_length >= MIN_MATCH) {\n //check_match(s, s.strstart, s.strstart - 1, s.match_length);\n\n /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/\n bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH);\n\n s.lookahead -= s.match_length;\n s.strstart += s.match_length;\n s.match_length = 0;\n } else {\n /* No match, output a literal byte */\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n\n s.lookahead--;\n s.strstart++;\n }\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* ===========================================================================\n * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.\n * (It will be regenerated if this run of deflate switches away from Huffman.)\n */\nfunction deflate_huff(s, flush) {\n var bflush; /* set if current block must be flushed */\n\n for (;;) {\n /* Make sure that we have a literal to write. */\n if (s.lookahead === 0) {\n fill_window(s);\n if (s.lookahead === 0) {\n if (flush === Z_NO_FLUSH) {\n return BS_NEED_MORE;\n }\n break; /* flush the current block */\n }\n }\n\n /* Output a literal byte */\n s.match_length = 0;\n //Tracevv((stderr,\"%c\", s->window[s->strstart]));\n /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/\n bflush = trees._tr_tally(s, 0, s.window[s.strstart]);\n s.lookahead--;\n s.strstart++;\n if (bflush) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n }\n s.insert = 0;\n if (flush === Z_FINISH) {\n /*** FLUSH_BLOCK(s, 1); ***/\n flush_block_only(s, true);\n if (s.strm.avail_out === 0) {\n return BS_FINISH_STARTED;\n }\n /***/\n return BS_FINISH_DONE;\n }\n if (s.last_lit) {\n /*** FLUSH_BLOCK(s, 0); ***/\n flush_block_only(s, false);\n if (s.strm.avail_out === 0) {\n return BS_NEED_MORE;\n }\n /***/\n }\n return BS_BLOCK_DONE;\n}\n\n/* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\nfunction Config(good_length, max_lazy, nice_length, max_chain, func) {\n this.good_length = good_length;\n this.max_lazy = max_lazy;\n this.nice_length = nice_length;\n this.max_chain = max_chain;\n this.func = func;\n}\n\nvar configuration_table;\n\nconfiguration_table = [\n /* good lazy nice chain */\n new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */\n new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */\n new Config(4, 5, 16, 8, deflate_fast), /* 2 */\n new Config(4, 6, 32, 32, deflate_fast), /* 3 */\n\n new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */\n new Config(8, 16, 32, 32, deflate_slow), /* 5 */\n new Config(8, 16, 128, 128, deflate_slow), /* 6 */\n new Config(8, 32, 128, 256, deflate_slow), /* 7 */\n new Config(32, 128, 258, 1024, deflate_slow), /* 8 */\n new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */\n];\n\n\n/* ===========================================================================\n * Initialize the \"longest match\" routines for a new zlib stream\n */\nfunction lm_init(s) {\n s.window_size = 2 * s.w_size;\n\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n\n /* Set the default configuration parameters:\n */\n s.max_lazy_match = configuration_table[s.level].max_lazy;\n s.good_match = configuration_table[s.level].good_length;\n s.nice_match = configuration_table[s.level].nice_length;\n s.max_chain_length = configuration_table[s.level].max_chain;\n\n s.strstart = 0;\n s.block_start = 0;\n s.lookahead = 0;\n s.insert = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n s.ins_h = 0;\n}\n\n\nfunction DeflateState() {\n this.strm = null; /* pointer back to this zlib stream */\n this.status = 0; /* as the name implies */\n this.pending_buf = null; /* output still pending */\n this.pending_buf_size = 0; /* size of pending_buf */\n this.pending_out = 0; /* next pending byte to output to the stream */\n this.pending = 0; /* nb of bytes in the pending buffer */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.gzhead = null; /* gzip header information to write */\n this.gzindex = 0; /* where in extra, name, or comment */\n this.method = Z_DEFLATED; /* can only be DEFLATED */\n this.last_flush = -1; /* value of flush param for previous deflate call */\n\n this.w_size = 0; /* LZ77 window size (32K by default) */\n this.w_bits = 0; /* log2(w_size) (8..16) */\n this.w_mask = 0; /* w_size - 1 */\n\n this.window = null;\n /* Sliding window. Input bytes are read into the second half of the window,\n * and move to the first half later to keep a dictionary of at least wSize\n * bytes. With this organization, matches are limited to a distance of\n * wSize-MAX_MATCH bytes, but this ensures that IO is always\n * performed with a length multiple of the block size.\n */\n\n this.window_size = 0;\n /* Actual size of window: 2*wSize, except when the user input buffer\n * is directly used as sliding window.\n */\n\n this.prev = null;\n /* Link to older string with same hash index. To limit the size of this\n * array to 64K, this link is maintained only for the last 32K strings.\n * An index in this array is thus a window index modulo 32K.\n */\n\n this.head = null; /* Heads of the hash chains or NIL. */\n\n this.ins_h = 0; /* hash index of string to be inserted */\n this.hash_size = 0; /* number of elements in hash table */\n this.hash_bits = 0; /* log2(hash_size) */\n this.hash_mask = 0; /* hash_size-1 */\n\n this.hash_shift = 0;\n /* Number of bits by which ins_h must be shifted at each input\n * step. It must be such that after MIN_MATCH steps, the oldest\n * byte no longer takes part in the hash key, that is:\n * hash_shift * MIN_MATCH >= hash_bits\n */\n\n this.block_start = 0;\n /* Window position at the beginning of the current output block. Gets\n * negative when the window is moved backwards.\n */\n\n this.match_length = 0; /* length of best match */\n this.prev_match = 0; /* previous match */\n this.match_available = 0; /* set if previous match exists */\n this.strstart = 0; /* start of string to insert */\n this.match_start = 0; /* start of matching string */\n this.lookahead = 0; /* number of valid bytes ahead in window */\n\n this.prev_length = 0;\n /* Length of the best match at previous step. Matches not greater than this\n * are discarded. This is used in the lazy match evaluation.\n */\n\n this.max_chain_length = 0;\n /* To speed up deflation, hash chains are never searched beyond this\n * length. A higher limit improves compression ratio but degrades the\n * speed.\n */\n\n this.max_lazy_match = 0;\n /* Attempt to find a better match only when the current match is strictly\n * smaller than this value. This mechanism is used only for compression\n * levels >= 4.\n */\n // That's alias to max_lazy_match, don't use directly\n //this.max_insert_length = 0;\n /* Insert new strings in the hash table only if the match length is not\n * greater than this length. This saves time but degrades compression.\n * max_insert_length is used only for compression levels <= 3.\n */\n\n this.level = 0; /* compression level (1..9) */\n this.strategy = 0; /* favor or force Huffman coding*/\n\n this.good_match = 0;\n /* Use a faster search when the previous match is longer than this */\n\n this.nice_match = 0; /* Stop searching when current match exceeds this */\n\n /* used by trees.c: */\n\n /* Didn't use ct_data typedef below to suppress compiler warning */\n\n // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */\n // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */\n // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */\n\n // Use flat array of DOUBLE size, with interleaved fata,\n // because JS does not support effective\n this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2);\n this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2);\n this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2);\n zero(this.dyn_ltree);\n zero(this.dyn_dtree);\n zero(this.bl_tree);\n\n this.l_desc = null; /* desc. for literal tree */\n this.d_desc = null; /* desc. for distance tree */\n this.bl_desc = null; /* desc. for bit length tree */\n\n //ush bl_count[MAX_BITS+1];\n this.bl_count = new utils.Buf16(MAX_BITS + 1);\n /* number of codes at each bit length for an optimal tree */\n\n //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */\n this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */\n zero(this.heap);\n\n this.heap_len = 0; /* number of elements in the heap */\n this.heap_max = 0; /* element of largest frequency */\n /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.\n * The same heap array is used to build all trees.\n */\n\n this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1];\n zero(this.depth);\n /* Depth of each subtree used as tie breaker for trees of equal frequency\n */\n\n this.l_buf = 0; /* buffer index for literals or lengths */\n\n this.lit_bufsize = 0;\n /* Size of match buffer for literals/lengths. There are 4 reasons for\n * limiting lit_bufsize to 64K:\n * - frequencies can be kept in 16 bit counters\n * - if compression is not successful for the first block, all input\n * data is still in the window so we can still emit a stored block even\n * when input comes from standard input. (This can also be done for\n * all blocks if lit_bufsize is not greater than 32K.)\n * - if compression is not successful for a file smaller than 64K, we can\n * even emit a stored file instead of a stored block (saving 5 bytes).\n * This is applicable only for zip (not gzip or zlib).\n * - creating new Huffman trees less frequently may not provide fast\n * adaptation to changes in the input data statistics. (Take for\n * example a binary file with poorly compressible code followed by\n * a highly compressible string table.) Smaller buffer sizes give\n * fast adaptation but have of course the overhead of transmitting\n * trees more frequently.\n * - I can't count above 4\n */\n\n this.last_lit = 0; /* running index in l_buf */\n\n this.d_buf = 0;\n /* Buffer index for distances. To simplify the code, d_buf and l_buf have\n * the same number of elements. To use different lengths, an extra flag\n * array would be necessary.\n */\n\n this.opt_len = 0; /* bit length of current block with optimal trees */\n this.static_len = 0; /* bit length of current block with static trees */\n this.matches = 0; /* number of string matches in current block */\n this.insert = 0; /* bytes at end of window left to insert */\n\n\n this.bi_buf = 0;\n /* Output buffer. bits are inserted starting at the bottom (least\n * significant bits).\n */\n this.bi_valid = 0;\n /* Number of valid bits in bi_buf. All bits above the last valid bit\n * are always zero.\n */\n\n // Used for window memory init. We safely ignore it for JS. That makes\n // sense only for pointers and memory check tools.\n //this.high_water = 0;\n /* High water mark offset in window for initialized bytes -- bytes above\n * this are set to zero in order to avoid memory check warnings when\n * longest match routines access bytes past the input. This is then\n * updated to the new high water mark.\n */\n}\n\n\nfunction deflateResetKeep(strm) {\n var s;\n\n if (!strm || !strm.state) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.total_in = strm.total_out = 0;\n strm.data_type = Z_UNKNOWN;\n\n s = strm.state;\n s.pending = 0;\n s.pending_out = 0;\n\n if (s.wrap < 0) {\n s.wrap = -s.wrap;\n /* was made negative by deflate(..., Z_FINISH); */\n }\n s.status = (s.wrap ? INIT_STATE : BUSY_STATE);\n strm.adler = (s.wrap === 2) ?\n 0 // crc32(0, Z_NULL, 0)\n :\n 1; // adler32(0, Z_NULL, 0)\n s.last_flush = Z_NO_FLUSH;\n trees._tr_init(s);\n return Z_OK;\n}\n\n\nfunction deflateReset(strm) {\n var ret = deflateResetKeep(strm);\n if (ret === Z_OK) {\n lm_init(strm.state);\n }\n return ret;\n}\n\n\nfunction deflateSetHeader(strm, head) {\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; }\n strm.state.gzhead = head;\n return Z_OK;\n}\n\n\nfunction deflateInit2(strm, level, method, windowBits, memLevel, strategy) {\n if (!strm) { // === Z_NULL\n return Z_STREAM_ERROR;\n }\n var wrap = 1;\n\n if (level === Z_DEFAULT_COMPRESSION) {\n level = 6;\n }\n\n if (windowBits < 0) { /* suppress zlib wrapper */\n wrap = 0;\n windowBits = -windowBits;\n }\n\n else if (windowBits > 15) {\n wrap = 2; /* write gzip wrapper instead */\n windowBits -= 16;\n }\n\n\n if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED ||\n windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||\n strategy < 0 || strategy > Z_FIXED) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n\n if (windowBits === 8) {\n windowBits = 9;\n }\n /* until 256-byte window bug fixed */\n\n var s = new DeflateState();\n\n strm.state = s;\n s.strm = strm;\n\n s.wrap = wrap;\n s.gzhead = null;\n s.w_bits = windowBits;\n s.w_size = 1 << s.w_bits;\n s.w_mask = s.w_size - 1;\n\n s.hash_bits = memLevel + 7;\n s.hash_size = 1 << s.hash_bits;\n s.hash_mask = s.hash_size - 1;\n s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH);\n\n s.window = new utils.Buf8(s.w_size * 2);\n s.head = new utils.Buf16(s.hash_size);\n s.prev = new utils.Buf16(s.w_size);\n\n // Don't need mem init magic for JS.\n //s.high_water = 0; /* nothing written to s->window yet */\n\n s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */\n\n s.pending_buf_size = s.lit_bufsize * 4;\n\n //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);\n //s->pending_buf = (uchf *) overlay;\n s.pending_buf = new utils.Buf8(s.pending_buf_size);\n\n // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`)\n //s->d_buf = overlay + s->lit_bufsize/sizeof(ush);\n s.d_buf = 1 * s.lit_bufsize;\n\n //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;\n s.l_buf = (1 + 2) * s.lit_bufsize;\n\n s.level = level;\n s.strategy = strategy;\n s.method = method;\n\n return deflateReset(strm);\n}\n\nfunction deflateInit(strm, level) {\n return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);\n}\n\n\nfunction deflate(strm, flush) {\n var old_flush, s;\n var beg, val; // for gzip header write only\n\n if (!strm || !strm.state ||\n flush > Z_BLOCK || flush < 0) {\n return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;\n }\n\n s = strm.state;\n\n if (!strm.output ||\n (!strm.input && strm.avail_in !== 0) ||\n (s.status === FINISH_STATE && flush !== Z_FINISH)) {\n return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR);\n }\n\n s.strm = strm; /* just in case */\n old_flush = s.last_flush;\n s.last_flush = flush;\n\n /* Write the header */\n if (s.status === INIT_STATE) {\n\n if (s.wrap === 2) { // GZIP header\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n put_byte(s, 31);\n put_byte(s, 139);\n put_byte(s, 8);\n if (!s.gzhead) { // s->gzhead == Z_NULL\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, 0);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, OS_CODE);\n s.status = BUSY_STATE;\n }\n else {\n put_byte(s, (s.gzhead.text ? 1 : 0) +\n (s.gzhead.hcrc ? 2 : 0) +\n (!s.gzhead.extra ? 0 : 4) +\n (!s.gzhead.name ? 0 : 8) +\n (!s.gzhead.comment ? 0 : 16)\n );\n put_byte(s, s.gzhead.time & 0xff);\n put_byte(s, (s.gzhead.time >> 8) & 0xff);\n put_byte(s, (s.gzhead.time >> 16) & 0xff);\n put_byte(s, (s.gzhead.time >> 24) & 0xff);\n put_byte(s, s.level === 9 ? 2 :\n (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ?\n 4 : 0));\n put_byte(s, s.gzhead.os & 0xff);\n if (s.gzhead.extra && s.gzhead.extra.length) {\n put_byte(s, s.gzhead.extra.length & 0xff);\n put_byte(s, (s.gzhead.extra.length >> 8) & 0xff);\n }\n if (s.gzhead.hcrc) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0);\n }\n s.gzindex = 0;\n s.status = EXTRA_STATE;\n }\n }\n else // DEFLATE header\n {\n var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8;\n var level_flags = -1;\n\n if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) {\n level_flags = 0;\n } else if (s.level < 6) {\n level_flags = 1;\n } else if (s.level === 6) {\n level_flags = 2;\n } else {\n level_flags = 3;\n }\n header |= (level_flags << 6);\n if (s.strstart !== 0) { header |= PRESET_DICT; }\n header += 31 - (header % 31);\n\n s.status = BUSY_STATE;\n putShortMSB(s, header);\n\n /* Save the adler32 of the preset dictionary: */\n if (s.strstart !== 0) {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n strm.adler = 1; // adler32(0L, Z_NULL, 0);\n }\n }\n\n//#ifdef GZIP\n if (s.status === EXTRA_STATE) {\n if (s.gzhead.extra/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n\n while (s.gzindex < (s.gzhead.extra.length & 0xffff)) {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n break;\n }\n }\n put_byte(s, s.gzhead.extra[s.gzindex] & 0xff);\n s.gzindex++;\n }\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (s.gzindex === s.gzhead.extra.length) {\n s.gzindex = 0;\n s.status = NAME_STATE;\n }\n }\n else {\n s.status = NAME_STATE;\n }\n }\n if (s.status === NAME_STATE) {\n if (s.gzhead.name/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.name.length) {\n val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.gzindex = 0;\n s.status = COMMENT_STATE;\n }\n }\n else {\n s.status = COMMENT_STATE;\n }\n }\n if (s.status === COMMENT_STATE) {\n if (s.gzhead.comment/* != Z_NULL*/) {\n beg = s.pending; /* start of bytes to update crc */\n //int val;\n\n do {\n if (s.pending === s.pending_buf_size) {\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n flush_pending(strm);\n beg = s.pending;\n if (s.pending === s.pending_buf_size) {\n val = 1;\n break;\n }\n }\n // JS specific: little magic to add zero terminator to end of string\n if (s.gzindex < s.gzhead.comment.length) {\n val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff;\n } else {\n val = 0;\n }\n put_byte(s, val);\n } while (val !== 0);\n\n if (s.gzhead.hcrc && s.pending > beg) {\n strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);\n }\n if (val === 0) {\n s.status = HCRC_STATE;\n }\n }\n else {\n s.status = HCRC_STATE;\n }\n }\n if (s.status === HCRC_STATE) {\n if (s.gzhead.hcrc) {\n if (s.pending + 2 > s.pending_buf_size) {\n flush_pending(strm);\n }\n if (s.pending + 2 <= s.pending_buf_size) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n strm.adler = 0; //crc32(0L, Z_NULL, 0);\n s.status = BUSY_STATE;\n }\n }\n else {\n s.status = BUSY_STATE;\n }\n }\n//#endif\n\n /* Flush as much pending output as possible */\n if (s.pending !== 0) {\n flush_pending(strm);\n if (strm.avail_out === 0) {\n /* Since avail_out is 0, deflate will be called again with\n * more output space, but possibly with both pending and\n * avail_in equal to zero. There won't be anything to do,\n * but this is not an error situation so make sure we\n * return OK instead of BUF_ERROR at next call of deflate:\n */\n s.last_flush = -1;\n return Z_OK;\n }\n\n /* Make sure there is something to do and avoid duplicate consecutive\n * flushes. For repeated and useless calls with Z_FINISH, we keep\n * returning Z_STREAM_END instead of Z_BUF_ERROR.\n */\n } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) &&\n flush !== Z_FINISH) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* User must not provide more input after the first FINISH: */\n if (s.status === FINISH_STATE && strm.avail_in !== 0) {\n return err(strm, Z_BUF_ERROR);\n }\n\n /* Start a new block or continue the current one.\n */\n if (strm.avail_in !== 0 || s.lookahead !== 0 ||\n (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) {\n var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) :\n (s.strategy === Z_RLE ? deflate_rle(s, flush) :\n configuration_table[s.level].func(s, flush));\n\n if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) {\n s.status = FINISH_STATE;\n }\n if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) {\n if (strm.avail_out === 0) {\n s.last_flush = -1;\n /* avoid BUF_ERROR next call, see above */\n }\n return Z_OK;\n /* If flush != Z_NO_FLUSH && avail_out == 0, the next call\n * of deflate should use the same flush parameter to make sure\n * that the flush is complete. So we don't have to output an\n * empty block here, this will be done at next call. This also\n * ensures that for a very small output buffer, we emit at most\n * one empty block.\n */\n }\n if (bstate === BS_BLOCK_DONE) {\n if (flush === Z_PARTIAL_FLUSH) {\n trees._tr_align(s);\n }\n else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */\n\n trees._tr_stored_block(s, 0, 0, false);\n /* For a full flush, this empty block will be recognized\n * as a special marker by inflate_sync().\n */\n if (flush === Z_FULL_FLUSH) {\n /*** CLEAR_HASH(s); ***/ /* forget history */\n zero(s.head); // Fill with NIL (= 0);\n\n if (s.lookahead === 0) {\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n }\n }\n flush_pending(strm);\n if (strm.avail_out === 0) {\n s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */\n return Z_OK;\n }\n }\n }\n //Assert(strm->avail_out > 0, \"bug2\");\n //if (strm.avail_out <= 0) { throw new Error(\"bug2\");}\n\n if (flush !== Z_FINISH) { return Z_OK; }\n if (s.wrap <= 0) { return Z_STREAM_END; }\n\n /* Write the trailer */\n if (s.wrap === 2) {\n put_byte(s, strm.adler & 0xff);\n put_byte(s, (strm.adler >> 8) & 0xff);\n put_byte(s, (strm.adler >> 16) & 0xff);\n put_byte(s, (strm.adler >> 24) & 0xff);\n put_byte(s, strm.total_in & 0xff);\n put_byte(s, (strm.total_in >> 8) & 0xff);\n put_byte(s, (strm.total_in >> 16) & 0xff);\n put_byte(s, (strm.total_in >> 24) & 0xff);\n }\n else\n {\n putShortMSB(s, strm.adler >>> 16);\n putShortMSB(s, strm.adler & 0xffff);\n }\n\n flush_pending(strm);\n /* If avail_out is zero, the application will call deflate again\n * to flush the rest.\n */\n if (s.wrap > 0) { s.wrap = -s.wrap; }\n /* write the trailer only once! */\n return s.pending !== 0 ? Z_OK : Z_STREAM_END;\n}\n\nfunction deflateEnd(strm) {\n var status;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n status = strm.state.status;\n if (status !== INIT_STATE &&\n status !== EXTRA_STATE &&\n status !== NAME_STATE &&\n status !== COMMENT_STATE &&\n status !== HCRC_STATE &&\n status !== BUSY_STATE &&\n status !== FINISH_STATE\n ) {\n return err(strm, Z_STREAM_ERROR);\n }\n\n strm.state = null;\n\n return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK;\n}\n\n\n/* =========================================================================\n * Initializes the compression dictionary from the given byte\n * sequence without producing any compressed output.\n */\nfunction deflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var s;\n var str, n;\n var wrap;\n var avail;\n var next;\n var input;\n var tmpDict;\n\n if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) {\n return Z_STREAM_ERROR;\n }\n\n s = strm.state;\n wrap = s.wrap;\n\n if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) {\n return Z_STREAM_ERROR;\n }\n\n /* when using zlib wrappers, compute Adler-32 for provided dictionary */\n if (wrap === 1) {\n /* adler32(strm->adler, dictionary, dictLength); */\n strm.adler = adler32(strm.adler, dictionary, dictLength, 0);\n }\n\n s.wrap = 0; /* avoid computing Adler-32 in read_buf */\n\n /* if dictionary would fill window, just replace the history */\n if (dictLength >= s.w_size) {\n if (wrap === 0) { /* already empty otherwise */\n /*** CLEAR_HASH(s); ***/\n zero(s.head); // Fill with NIL (= 0);\n s.strstart = 0;\n s.block_start = 0;\n s.insert = 0;\n }\n /* use the tail */\n // dictionary = dictionary.slice(dictLength - s.w_size);\n tmpDict = new utils.Buf8(s.w_size);\n utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0);\n dictionary = tmpDict;\n dictLength = s.w_size;\n }\n /* insert dictionary into window and hash */\n avail = strm.avail_in;\n next = strm.next_in;\n input = strm.input;\n strm.avail_in = dictLength;\n strm.next_in = 0;\n strm.input = dictionary;\n fill_window(s);\n while (s.lookahead >= MIN_MATCH) {\n str = s.strstart;\n n = s.lookahead - (MIN_MATCH - 1);\n do {\n /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */\n s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask;\n\n s.prev[str & s.w_mask] = s.head[s.ins_h];\n\n s.head[s.ins_h] = str;\n str++;\n } while (--n);\n s.strstart = str;\n s.lookahead = MIN_MATCH - 1;\n fill_window(s);\n }\n s.strstart += s.lookahead;\n s.block_start = s.strstart;\n s.insert = s.lookahead;\n s.lookahead = 0;\n s.match_length = s.prev_length = MIN_MATCH - 1;\n s.match_available = 0;\n strm.next_in = next;\n strm.input = input;\n strm.avail_in = avail;\n s.wrap = wrap;\n return Z_OK;\n}\n\n\nexports.deflateInit = deflateInit;\nexports.deflateInit2 = deflateInit2;\nexports.deflateReset = deflateReset;\nexports.deflateResetKeep = deflateResetKeep;\nexports.deflateSetHeader = deflateSetHeader;\nexports.deflate = deflate;\nexports.deflateEnd = deflateEnd;\nexports.deflateSetDictionary = deflateSetDictionary;\nexports.deflateInfo = 'pako deflate (from Nodeca project)';\n\n/* Not implemented\nexports.deflateBound = deflateBound;\nexports.deflateCopy = deflateCopy;\nexports.deflateParams = deflateParams;\nexports.deflatePending = deflatePending;\nexports.deflatePrime = deflatePrime;\nexports.deflateTune = deflateTune;\n*/\n\n},{\"../utils/common\":49,\"./adler32\":50,\"./crc32\":52,\"./messages\":57,\"./trees\":58}],54:[function(require,module,exports){\n'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// See state defs from inflate.js\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\n\n/*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\nmodule.exports = function inflate_fast(strm, start) {\n var state;\n var _in; /* local strm.input */\n var last; /* have enough input while in < last */\n var _out; /* local strm.output */\n var beg; /* inflate()'s initial strm.output */\n var end; /* while out < end, enough space available */\n//#ifdef INFLATE_STRICT\n var dmax; /* maximum distance from zlib header */\n//#endif\n var wsize; /* window size or zero if not using window */\n var whave; /* valid bytes in the window */\n var wnext; /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n var s_window; /* allocated sliding window, if wsize != 0 */\n var hold; /* local strm.hold */\n var bits; /* local strm.bits */\n var lcode; /* local strm.lencode */\n var dcode; /* local strm.distcode */\n var lmask; /* mask for first level of length codes */\n var dmask; /* mask for first level of distance codes */\n var here; /* retrieved table entry */\n var op; /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n var len; /* match length, unused bytes */\n var dist; /* match distance */\n var from; /* where to copy match from */\n var from_source;\n\n\n var input, output; // JS specific, because we have no pointers\n\n /* copy state to local variables */\n state = strm.state;\n //here = state.here;\n _in = strm.next_in;\n input = strm.input;\n last = _in + (strm.avail_in - 5);\n _out = strm.next_out;\n output = strm.output;\n beg = _out - (start - strm.avail_out);\n end = _out + (strm.avail_out - 257);\n//#ifdef INFLATE_STRICT\n dmax = state.dmax;\n//#endif\n wsize = state.wsize;\n whave = state.whave;\n wnext = state.wnext;\n s_window = state.window;\n hold = state.hold;\n bits = state.bits;\n lcode = state.lencode;\n dcode = state.distcode;\n lmask = (1 << state.lenbits) - 1;\n dmask = (1 << state.distbits) - 1;\n\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top:\n do {\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n\n here = lcode[hold & lmask];\n\n dolen:\n for (;;) { // Goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n if (op === 0) { /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n output[_out++] = here & 0xffff/*here.val*/;\n }\n else if (op & 16) { /* length base */\n len = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n len += hold & ((1 << op) - 1);\n hold >>>= op;\n bits -= op;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", len));\n if (bits < 15) {\n hold += input[_in++] << bits;\n bits += 8;\n hold += input[_in++] << bits;\n bits += 8;\n }\n here = dcode[hold & dmask];\n\n dodist:\n for (;;) { // goto emulation\n op = here >>> 24/*here.bits*/;\n hold >>>= op;\n bits -= op;\n op = (here >>> 16) & 0xff/*here.op*/;\n\n if (op & 16) { /* distance base */\n dist = here & 0xffff/*here.val*/;\n op &= 15; /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n if (bits < op) {\n hold += input[_in++] << bits;\n bits += 8;\n }\n }\n dist += hold & ((1 << op) - 1);\n//#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n//#endif\n hold >>>= op;\n bits -= op;\n //Tracevv((stderr, \"inflate: distance %u\\n\", dist));\n op = _out - beg; /* max distance in output */\n if (dist > op) { /* see if copy from window */\n op = dist - op; /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break top;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// if (len <= op - whave) {\n// do {\n// output[_out++] = 0;\n// } while (--len);\n// continue top;\n// }\n// len -= op - whave;\n// do {\n// output[_out++] = 0;\n// } while (--op > whave);\n// if (op === 0) {\n// from = _out - dist;\n// do {\n// output[_out++] = output[from++];\n// } while (--len);\n// continue top;\n// }\n//#endif\n }\n from = 0; // window index\n from_source = s_window;\n if (wnext === 0) { /* very common case */\n from += wsize - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n else if (wnext < op) { /* wrap around window */\n from += wsize + wnext - op;\n op -= wnext;\n if (op < len) { /* some from end of window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = 0;\n if (wnext < len) { /* some from start of window */\n op = wnext;\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n }\n else { /* contiguous in window */\n from += wnext - op;\n if (op < len) { /* some from window */\n len -= op;\n do {\n output[_out++] = s_window[from++];\n } while (--op);\n from = _out - dist; /* rest from output */\n from_source = output;\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n output[_out++] = from_source[from++];\n len -= 3;\n }\n if (len) {\n output[_out++] = from_source[from++];\n if (len > 1) {\n output[_out++] = from_source[from++];\n }\n }\n }\n else {\n from = _out - dist; /* copy direct from output */\n do { /* minimum length is three */\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n output[_out++] = output[from++];\n len -= 3;\n } while (len > 2);\n if (len) {\n output[_out++] = output[from++];\n if (len > 1) {\n output[_out++] = output[from++];\n }\n }\n }\n }\n else if ((op & 64) === 0) { /* 2nd level distance code */\n here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dodist;\n }\n else {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n }\n else if ((op & 64) === 0) { /* 2nd level length code */\n here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];\n continue dolen;\n }\n else if (op & 32) { /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.mode = TYPE;\n break top;\n }\n else {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break top;\n }\n\n break; // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end);\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3;\n _in -= len;\n bits -= len << 3;\n hold &= (1 << bits) - 1;\n\n /* update state and return */\n strm.next_in = _in;\n strm.next_out = _out;\n strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));\n strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));\n state.hold = hold;\n state.bits = bits;\n return;\n};\n\n},{}],55:[function(require,module,exports){\n'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\nvar adler32 = require('./adler32');\nvar crc32 = require('./crc32');\nvar inflate_fast = require('./inffast');\nvar inflate_table = require('./inftrees');\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n/* Allowed flush values; see deflate() and inflate() below for details */\n//var Z_NO_FLUSH = 0;\n//var Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\n//var Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4;\nvar Z_BLOCK = 5;\nvar Z_TREES = 6;\n\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0;\nvar Z_STREAM_END = 1;\nvar Z_NEED_DICT = 2;\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2;\nvar Z_DATA_ERROR = -3;\nvar Z_MEM_ERROR = -4;\nvar Z_BUF_ERROR = -5;\n//var Z_VERSION_ERROR = -6;\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8;\n\n\n/* STATES ====================================================================*/\n/* ===========================================================================*/\n\n\nvar HEAD = 1; /* i: waiting for magic header */\nvar FLAGS = 2; /* i: waiting for method and flags (gzip) */\nvar TIME = 3; /* i: waiting for modification time (gzip) */\nvar OS = 4; /* i: waiting for extra flags and operating system (gzip) */\nvar EXLEN = 5; /* i: waiting for extra length (gzip) */\nvar EXTRA = 6; /* i: waiting for extra bytes (gzip) */\nvar NAME = 7; /* i: waiting for end of file name (gzip) */\nvar COMMENT = 8; /* i: waiting for end of comment (gzip) */\nvar HCRC = 9; /* i: waiting for header crc (gzip) */\nvar DICTID = 10; /* i: waiting for dictionary check value */\nvar DICT = 11; /* waiting for inflateSetDictionary() call */\nvar TYPE = 12; /* i: waiting for type bits, including last-flag bit */\nvar TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */\nvar STORED = 14; /* i: waiting for stored size (length and complement) */\nvar COPY_ = 15; /* i/o: same as COPY below, but only first time in */\nvar COPY = 16; /* i/o: waiting for input or output to copy stored block */\nvar TABLE = 17; /* i: waiting for dynamic block table lengths */\nvar LENLENS = 18; /* i: waiting for code length code lengths */\nvar CODELENS = 19; /* i: waiting for length/lit and distance code lengths */\nvar LEN_ = 20; /* i: same as LEN below, but only first time in */\nvar LEN = 21; /* i: waiting for length/lit/eob code */\nvar LENEXT = 22; /* i: waiting for length extra bits */\nvar DIST = 23; /* i: waiting for distance code */\nvar DISTEXT = 24; /* i: waiting for distance extra bits */\nvar MATCH = 25; /* o: waiting for output space to copy string */\nvar LIT = 26; /* o: waiting for output space to write literal */\nvar CHECK = 27; /* i: waiting for 32-bit check value */\nvar LENGTH = 28; /* i: waiting for 32-bit length (gzip) */\nvar DONE = 29; /* finished check, done -- remain here until reset */\nvar BAD = 30; /* got a data error -- remain here until reset */\nvar MEM = 31; /* got an inflate() memory error -- remain here until reset */\nvar SYNC = 32; /* looking for synchronization bytes to restart inflate() */\n\n/* ===========================================================================*/\n\n\n\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar MAX_WBITS = 15;\n/* 32K LZ77 window */\nvar DEF_WBITS = MAX_WBITS;\n\n\nfunction zswap32(q) {\n return (((q >>> 24) & 0xff) +\n ((q >>> 8) & 0xff00) +\n ((q & 0xff00) << 8) +\n ((q & 0xff) << 24));\n}\n\n\nfunction InflateState() {\n this.mode = 0; /* current inflate mode */\n this.last = false; /* true if processing last block */\n this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */\n this.havedict = false; /* true if dictionary provided */\n this.flags = 0; /* gzip header method and flags (0 if zlib) */\n this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0; /* protected copy of check value */\n this.total = 0; /* protected copy of output count */\n // TODO: may be {}\n this.head = null; /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0; /* log base 2 of requested window size */\n this.wsize = 0; /* window size or zero if not using window */\n this.whave = 0; /* valid bytes in the window */\n this.wnext = 0; /* window write index */\n this.window = null; /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0; /* input bit accumulator */\n this.bits = 0; /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0; /* literal or length of data to copy */\n this.offset = 0; /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0; /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null; /* starting table for length/literal codes */\n this.distcode = null; /* starting table for distance codes */\n this.lenbits = 0; /* index bits for lencode */\n this.distbits = 0; /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0; /* number of code length code lengths */\n this.nlen = 0; /* number of length code lengths */\n this.ndist = 0; /* number of distance code lengths */\n this.have = 0; /* number of code lengths in lens[] */\n this.next = null; /* next available space in codes[] */\n\n this.lens = new utils.Buf16(320); /* temporary storage for code lengths */\n this.work = new utils.Buf16(288); /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */\n this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null; /* dynamic table for distance codes (JS specific) */\n this.sane = 0; /* if false, allow invalid distance too far */\n this.back = 0; /* bits back of last unprocessed length/lit */\n this.was = 0; /* initial length of match */\n}\n\nfunction inflateResetKeep(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n strm.total_in = strm.total_out = state.total = 0;\n strm.msg = ''; /*Z_NULL*/\n if (state.wrap) { /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1;\n }\n state.mode = HEAD;\n state.last = 0;\n state.havedict = 0;\n state.dmax = 32768;\n state.head = null/*Z_NULL*/;\n state.hold = 0;\n state.bits = 0;\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);\n state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);\n\n state.sane = 1;\n state.back = -1;\n //Tracev((stderr, \"inflate: reset\\n\"));\n return Z_OK;\n}\n\nfunction inflateReset(strm) {\n var state;\n\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n state.wsize = 0;\n state.whave = 0;\n state.wnext = 0;\n return inflateResetKeep(strm);\n\n}\n\nfunction inflateReset2(strm, windowBits) {\n var wrap;\n var state;\n\n /* get the state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0;\n windowBits = -windowBits;\n }\n else {\n wrap = (windowBits >> 4) + 1;\n if (windowBits < 48) {\n windowBits &= 15;\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR;\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null;\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap;\n state.wbits = windowBits;\n return inflateReset(strm);\n}\n\nfunction inflateInit2(strm, windowBits) {\n var ret;\n var state;\n\n if (!strm) { return Z_STREAM_ERROR; }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n state = new InflateState();\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\\n\"));\n strm.state = state;\n state.window = null/*Z_NULL*/;\n ret = inflateReset2(strm, windowBits);\n if (ret !== Z_OK) {\n strm.state = null/*Z_NULL*/;\n }\n return ret;\n}\n\nfunction inflateInit(strm) {\n return inflateInit2(strm, DEF_WBITS);\n}\n\n\n/*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\nvar virgin = true;\n\nvar lenfix, distfix; // We have no pointers in JS, so keep tables separate\n\nfunction fixedtables(state) {\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n var sym;\n\n lenfix = new utils.Buf32(512);\n distfix = new utils.Buf32(32);\n\n /* literal/length table */\n sym = 0;\n while (sym < 144) { state.lens[sym++] = 8; }\n while (sym < 256) { state.lens[sym++] = 9; }\n while (sym < 280) { state.lens[sym++] = 7; }\n while (sym < 288) { state.lens[sym++] = 8; }\n\n inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });\n\n /* distance table */\n sym = 0;\n while (sym < 32) { state.lens[sym++] = 5; }\n\n inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });\n\n /* do this just once */\n virgin = false;\n }\n\n state.lencode = lenfix;\n state.lenbits = 9;\n state.distcode = distfix;\n state.distbits = 5;\n}\n\n\n/*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\nfunction updatewindow(strm, src, end, copy) {\n var dist;\n var state = strm.state;\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits;\n state.wnext = 0;\n state.whave = 0;\n\n state.window = new utils.Buf8(state.wsize);\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);\n state.wnext = 0;\n state.whave = state.wsize;\n }\n else {\n dist = state.wsize - state.wnext;\n if (dist > copy) {\n dist = copy;\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n utils.arraySet(state.window, src, end - copy, dist, state.wnext);\n copy -= dist;\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n utils.arraySet(state.window, src, end - copy, copy, 0);\n state.wnext = copy;\n state.whave = state.wsize;\n }\n else {\n state.wnext += dist;\n if (state.wnext === state.wsize) { state.wnext = 0; }\n if (state.whave < state.wsize) { state.whave += dist; }\n }\n }\n return 0;\n}\n\nfunction inflate(strm, flush) {\n var state;\n var input, output; // input/output buffers\n var next; /* next input INDEX */\n var put; /* next output INDEX */\n var have, left; /* available input and output */\n var hold; /* bit buffer */\n var bits; /* bits in bit buffer */\n var _in, _out; /* save starting available input and output */\n var copy; /* number of stored or match bytes to copy */\n var from; /* where to copy match bytes from */\n var from_source;\n var here = 0; /* current decoding table entry */\n var here_bits, here_op, here_val; // paked \"here\" denormalized (JS specific)\n //var last; /* parent table entry */\n var last_bits, last_op, last_val; // paked \"last\" denormalized (JS specific)\n var len; /* length to copy for repeats, bits to drop */\n var ret; /* return code */\n var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */\n var opts;\n\n var n; // temporary var for NEED_BITS\n\n var order = /* permutation of code lengths */\n [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];\n\n\n if (!strm || !strm.state || !strm.output ||\n (!strm.input && strm.avail_in !== 0)) {\n return Z_STREAM_ERROR;\n }\n\n state = strm.state;\n if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */\n\n\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n _in = have;\n _out = left;\n ret = Z_OK;\n\n inf_leave: // goto emulation\n for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO;\n break;\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */\n state.check = 0/*crc32(0L, Z_NULL, 0)*/;\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = FLAGS;\n break;\n }\n state.flags = 0; /* expect zlib header */\n if (state.head) {\n state.head.done = false;\n }\n if (!(state.wrap & 1) || /* check if zlib header allowed */\n (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {\n strm.msg = 'incorrect header check';\n state.mode = BAD;\n break;\n }\n if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n len = (hold & 0x0f)/*BITS(4)*/ + 8;\n if (state.wbits === 0) {\n state.wbits = len;\n }\n else if (len > state.wbits) {\n strm.msg = 'invalid window size';\n state.mode = BAD;\n break;\n }\n state.dmax = 1 << len;\n //Tracev((stderr, \"inflate: zlib header ok\\n\"));\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = hold & 0x200 ? DICTID : TYPE;\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n break;\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.flags = hold;\n if ((state.flags & 0xff) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method';\n state.mode = BAD;\n break;\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set';\n state.mode = BAD;\n break;\n }\n if (state.head) {\n state.head.text = ((hold >> 8) & 1);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = TIME;\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.time = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n hbuf[2] = (hold >>> 16) & 0xff;\n hbuf[3] = (hold >>> 24) & 0xff;\n state.check = crc32(state.check, hbuf, 4, 0);\n //===\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = OS;\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (state.head) {\n state.head.xflags = (hold & 0xff);\n state.head.os = (hold >> 8);\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = EXLEN;\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length = hold;\n if (state.head) {\n state.head.extra_len = hold;\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff;\n hbuf[1] = (hold >>> 8) & 0xff;\n state.check = crc32(state.check, hbuf, 2, 0);\n //===//\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n else if (state.head) {\n state.head.extra = null/*Z_NULL*/;\n }\n state.mode = EXTRA;\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length;\n if (copy > have) { copy = have; }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length;\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Array(state.head.extra_len);\n }\n utils.arraySet(\n state.head.extra,\n input,\n next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n copy,\n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len\n );\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n state.length -= copy;\n }\n if (state.length) { break inf_leave; }\n }\n state.length = 0;\n state.mode = NAME;\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.name_max*/)) {\n state.head.name += String.fromCharCode(len);\n }\n } while (len && copy < have);\n\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.name = null;\n }\n state.length = 0;\n state.mode = COMMENT;\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) { break inf_leave; }\n copy = 0;\n do {\n len = input[next + copy++];\n /* use constant limit because in js we should not preallocate memory */\n if (state.head && len &&\n (state.length < 65536 /*state.head.comm_max*/)) {\n state.head.comment += String.fromCharCode(len);\n }\n } while (len && copy < have);\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next);\n }\n have -= copy;\n next += copy;\n if (len) { break inf_leave; }\n }\n else if (state.head) {\n state.head.comment = null;\n }\n state.mode = HCRC;\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n }\n if (state.head) {\n state.head.hcrc = ((state.flags >> 9) & 1);\n state.head.done = true;\n }\n strm.adler = state.check = 0;\n state.mode = TYPE;\n break;\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n strm.adler = state.check = zswap32(hold);\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = DICT;\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n return Z_NEED_DICT;\n }\n strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;\n state.mode = TYPE;\n /* falls through */\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n state.mode = CHECK;\n break;\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.last = (hold & 0x01)/*BITS(1)*/;\n //--- DROPBITS(1) ---//\n hold >>>= 1;\n bits -= 1;\n //---//\n\n switch ((hold & 0x03)/*BITS(2)*/) {\n case 0: /* stored block */\n //Tracev((stderr, \"inflate: stored block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED;\n break;\n case 1: /* fixed block */\n fixedtables(state);\n //Tracev((stderr, \"inflate: fixed codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_; /* decode codes */\n if (flush === Z_TREES) {\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break inf_leave;\n }\n break;\n case 2: /* dynamic block */\n //Tracev((stderr, \"inflate: dynamic codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE;\n break;\n case 3:\n strm.msg = 'invalid block type';\n state.mode = BAD;\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n break;\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7;\n bits -= bits & 7;\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths';\n state.mode = BAD;\n break;\n }\n state.length = hold & 0xffff;\n //Tracev((stderr, \"inflate: stored length %u\\n\",\n // state.length));\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n state.mode = COPY_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case COPY_:\n state.mode = COPY;\n /* falls through */\n case COPY:\n copy = state.length;\n if (copy) {\n if (copy > have) { copy = have; }\n if (copy > left) { copy = left; }\n if (copy === 0) { break inf_leave; }\n //--- zmemcpy(put, next, copy); ---\n utils.arraySet(output, input, next, copy, put);\n //---//\n have -= copy;\n next += copy;\n left -= copy;\n put += copy;\n state.length -= copy;\n break;\n }\n //Tracev((stderr, \"inflate: stored end\\n\"));\n state.mode = TYPE;\n break;\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;\n //--- DROPBITS(5) ---//\n hold >>>= 5;\n bits -= 5;\n //---//\n state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;\n //--- DROPBITS(4) ---//\n hold >>>= 4;\n bits -= 4;\n //---//\n//#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracev((stderr, \"inflate: table sizes ok\\n\"));\n state.have = 0;\n state.mode = LENLENS;\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0;\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn;\n state.lenbits = 7;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);\n state.lenbits = opts.bits;\n\n if (ret) {\n strm.msg = 'invalid code lengths set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, \"inflate: code lengths ok\\n\"));\n state.have = 0;\n state.mode = CODELENS;\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.lens[state.have++] = here_val;\n }\n else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n len = state.lens[state.have - 1];\n copy = 3 + (hold & 0x03);//BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2;\n bits -= 2;\n //---//\n }\n else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 3 + (hold & 0x07);//BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3;\n bits -= 3;\n //---//\n }\n else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n len = 0;\n copy = 11 + (hold & 0x7f);//BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7;\n bits -= 7;\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat';\n state.mode = BAD;\n break;\n }\n while (copy--) {\n state.lens[state.have++] = len;\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD) { break; }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block';\n state.mode = BAD;\n break;\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9;\n\n opts = { bits: state.lenbits };\n ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits;\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set';\n state.mode = BAD;\n break;\n }\n\n state.distbits = 6;\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn;\n opts = { bits: state.distbits };\n ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits;\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set';\n state.mode = BAD;\n break;\n }\n //Tracev((stderr, 'inflate: codes ok\\n'));\n state.mode = LEN_;\n if (flush === Z_TREES) { break inf_leave; }\n /* falls through */\n case LEN_:\n state.mode = LEN;\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n inflate_fast(strm, _out);\n //--- LOAD() ---\n put = strm.next_out;\n output = strm.output;\n left = strm.avail_out;\n next = strm.next_in;\n input = strm.input;\n have = strm.avail_in;\n hold = state.hold;\n bits = state.bits;\n //---\n\n if (state.mode === TYPE) {\n state.back = -1;\n }\n break;\n }\n state.back = 0;\n for (;;) {\n here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if (here_bits <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.lencode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n state.length = here_val;\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n state.mode = LIT;\n break;\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.back = -1;\n state.mode = TYPE;\n break;\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code';\n state.mode = BAD;\n break;\n }\n state.extra = here_op & 15;\n state.mode = LENEXT;\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", state.length));\n state.was = state.length;\n state.mode = DIST;\n /* falls through */\n case DIST:\n for (;;) {\n here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits;\n last_op = here_op;\n last_val = here_val;\n for (;;) {\n here = state.distcode[last_val +\n ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];\n here_bits = here >>> 24;\n here_op = (here >>> 16) & 0xff;\n here_val = here & 0xffff;\n\n if ((last_bits + here_bits) <= bits) { break; }\n //--- PULLBYTE() ---//\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits;\n bits -= last_bits;\n //---//\n state.back += last_bits;\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits;\n bits -= here_bits;\n //---//\n state.back += here_bits;\n if (here_op & 64) {\n strm.msg = 'invalid distance code';\n state.mode = BAD;\n break;\n }\n state.offset = here_val;\n state.extra = (here_op) & 15;\n state.mode = DISTEXT;\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra;\n while (bits < n) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra;\n bits -= state.extra;\n //---//\n state.back += state.extra;\n }\n//#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n//#endif\n //Tracevv((stderr, \"inflate: distance %u\\n\", state.offset));\n state.mode = MATCH;\n /* falls through */\n case MATCH:\n if (left === 0) { break inf_leave; }\n copy = _out - left;\n if (state.offset > copy) { /* copy from window */\n copy = state.offset - copy;\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back';\n state.mode = BAD;\n break;\n }\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n// Trace((stderr, \"inflate.c too far\\n\"));\n// copy -= state.whave;\n// if (copy > state.length) { copy = state.length; }\n// if (copy > left) { copy = left; }\n// left -= copy;\n// state.length -= copy;\n// do {\n// output[put++] = 0;\n// } while (--copy);\n// if (state.length === 0) { state.mode = LEN; }\n// break;\n//#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext;\n from = state.wsize - copy;\n }\n else {\n from = state.wnext - copy;\n }\n if (copy > state.length) { copy = state.length; }\n from_source = state.window;\n }\n else { /* copy from output */\n from_source = output;\n from = put - state.offset;\n copy = state.length;\n }\n if (copy > left) { copy = left; }\n left -= copy;\n state.length -= copy;\n do {\n output[put++] = from_source[from++];\n } while (--copy);\n if (state.length === 0) { state.mode = LEN; }\n break;\n case LIT:\n if (left === 0) { break inf_leave; }\n output[put++] = state.length;\n left--;\n state.mode = LEN;\n break;\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits;\n bits += 8;\n }\n //===//\n _out -= left;\n strm.total_out += _out;\n state.total += _out;\n if (_out) {\n strm.adler = state.check =\n /*UPDATE(state.check, put - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));\n\n }\n _out = left;\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\\n\"));\n }\n state.mode = LENGTH;\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) { break inf_leave; }\n have--;\n hold += input[next++] << bits;\n bits += 8;\n }\n //===//\n if (hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check';\n state.mode = BAD;\n break;\n }\n //=== INITBITS();\n hold = 0;\n bits = 0;\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\\n\"));\n }\n state.mode = DONE;\n /* falls through */\n case DONE:\n ret = Z_STREAM_END;\n break inf_leave;\n case BAD:\n ret = Z_DATA_ERROR;\n break inf_leave;\n case MEM:\n return Z_MEM_ERROR;\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR;\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put;\n strm.avail_out = left;\n strm.next_in = next;\n strm.avail_in = have;\n state.hold = hold;\n state.bits = bits;\n //---\n\n if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&\n (state.mode < CHECK || flush !== Z_FINISH))) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n }\n _in -= strm.avail_in;\n _out -= strm.avail_out;\n strm.total_in += _in;\n strm.total_out += _out;\n state.total += _out;\n if (state.wrap && _out) {\n strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/\n (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));\n }\n strm.data_type = state.bits + (state.last ? 64 : 0) +\n (state.mode === TYPE ? 128 : 0) +\n (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);\n if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {\n ret = Z_BUF_ERROR;\n }\n return ret;\n}\n\nfunction inflateEnd(strm) {\n\n if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n return Z_STREAM_ERROR;\n }\n\n var state = strm.state;\n if (state.window) {\n state.window = null;\n }\n strm.state = null;\n return Z_OK;\n}\n\nfunction inflateGetHeader(strm, head) {\n var state;\n\n /* check state */\n if (!strm || !strm.state) { return Z_STREAM_ERROR; }\n state = strm.state;\n if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; }\n\n /* save header structure */\n state.head = head;\n head.done = false;\n return Z_OK;\n}\n\nfunction inflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length;\n\n var state;\n var dictid;\n var ret;\n\n /* check state */\n if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; }\n state = strm.state;\n\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR;\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1; /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32(dictid, dictionary, dictLength, 0);\n if (dictid !== state.check) {\n return Z_DATA_ERROR;\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength);\n if (ret) {\n state.mode = MEM;\n return Z_MEM_ERROR;\n }\n state.havedict = 1;\n // Tracev((stderr, \"inflate: dictionary set\\n\"));\n return Z_OK;\n}\n\nexports.inflateReset = inflateReset;\nexports.inflateReset2 = inflateReset2;\nexports.inflateResetKeep = inflateResetKeep;\nexports.inflateInit = inflateInit;\nexports.inflateInit2 = inflateInit2;\nexports.inflate = inflate;\nexports.inflateEnd = inflateEnd;\nexports.inflateGetHeader = inflateGetHeader;\nexports.inflateSetDictionary = inflateSetDictionary;\nexports.inflateInfo = 'pako inflate (from Nodeca project)';\n\n/* Not implemented\nexports.inflateCopy = inflateCopy;\nexports.inflateGetDictionary = inflateGetDictionary;\nexports.inflateMark = inflateMark;\nexports.inflatePrime = inflatePrime;\nexports.inflateSync = inflateSync;\nexports.inflateSyncPoint = inflateSyncPoint;\nexports.inflateUndermine = inflateUndermine;\n*/\n\n},{\"../utils/common\":49,\"./adler32\":50,\"./crc32\":52,\"./inffast\":54,\"./inftrees\":56}],56:[function(require,module,exports){\n'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\n\nvar MAXBITS = 15;\nvar ENOUGH_LENS = 852;\nvar ENOUGH_DISTS = 592;\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar CODES = 0;\nvar LENS = 1;\nvar DISTS = 2;\n\nvar lbase = [ /* Length codes 257..285 base */\n 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,\n 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0\n];\n\nvar lext = [ /* Length codes 257..285 extra */\n 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,\n 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78\n];\n\nvar dbase = [ /* Distance codes 0..29 base */\n 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,\n 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,\n 8193, 12289, 16385, 24577, 0, 0\n];\n\nvar dext = [ /* Distance codes 0..29 extra */\n 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,\n 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,\n 28, 28, 29, 29, 64, 64\n];\n\nmodule.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)\n{\n var bits = opts.bits;\n //here = opts.here; /* table entry for duplication */\n\n var len = 0; /* a code's length in bits */\n var sym = 0; /* index of code symbols */\n var min = 0, max = 0; /* minimum and maximum code lengths */\n var root = 0; /* number of index bits for root table */\n var curr = 0; /* number of index bits for current table */\n var drop = 0; /* code bits to drop for sub-table */\n var left = 0; /* number of prefix codes available */\n var used = 0; /* code entries in table used */\n var huff = 0; /* Huffman code */\n var incr; /* for incrementing code, index */\n var fill; /* index for replicating entries */\n var low; /* low bits for current root entry */\n var mask; /* mask for low root bits */\n var next; /* next available space in table */\n var base = null; /* base value table to use */\n var base_index = 0;\n// var shoextra; /* extra bits table to use */\n var end; /* use base and extra for symbol > end */\n var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */\n var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */\n var extra = null;\n var extra_index = 0;\n\n var here_bits, here_op, here_val;\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0;\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++;\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits;\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) { break; }\n }\n if (root > max) {\n root = max;\n }\n if (max === 0) { /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0;\n\n opts.bits = 1;\n return 0; /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) { break; }\n }\n if (root < min) {\n root = min;\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1;\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1;\n left -= count[len];\n if (left < 0) {\n return -1;\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES || max !== 1)) {\n return -1; /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0;\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len];\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym;\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES) {\n base = extra = work; /* dummy value--not used */\n end = 19;\n\n } else if (type === LENS) {\n base = lbase;\n base_index -= 257;\n extra = lext;\n extra_index -= 257;\n end = 256;\n\n } else { /* DISTS */\n base = dbase;\n extra = dext;\n end = -1;\n }\n\n /* initialize opts for loop */\n huff = 0; /* starting code */\n sym = 0; /* starting code symbol */\n len = min; /* starting code length */\n next = table_index; /* current table to fill in */\n curr = root; /* current table index bits */\n drop = 0; /* current bits to drop from code for index */\n low = -1; /* trigger new sub-table when len > root */\n used = 1 << root; /* use root table entries */\n mask = used - 1; /* mask for comparing low */\n\n /* check available table space */\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop;\n if (work[sym] < end) {\n here_op = 0;\n here_val = work[sym];\n }\n else if (work[sym] > end) {\n here_op = extra[extra_index + work[sym]];\n here_val = base[base_index + work[sym]];\n }\n else {\n here_op = 32 + 64; /* end of block */\n here_val = 0;\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << (len - drop);\n fill = 1 << curr;\n min = fill; /* save offset to next table */\n do {\n fill -= incr;\n table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;\n } while (fill !== 0);\n\n /* backwards increment the len-bit code huff */\n incr = 1 << (len - 1);\n while (huff & incr) {\n incr >>= 1;\n }\n if (incr !== 0) {\n huff &= incr - 1;\n huff += incr;\n } else {\n huff = 0;\n }\n\n /* go to next symbol, update count, len */\n sym++;\n if (--count[len] === 0) {\n if (len === max) { break; }\n len = lens[lens_index + work[sym]];\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root;\n }\n\n /* increment past last table */\n next += min; /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop;\n left = 1 << curr;\n while (curr + drop < max) {\n left -= count[curr + drop];\n if (left <= 0) { break; }\n curr++;\n left <<= 1;\n }\n\n /* check for enough space */\n used += 1 << curr;\n if ((type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)) {\n return 1;\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask;\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root;\n return 0;\n};\n\n},{\"../utils/common\":49}],57:[function(require,module,exports){\n'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nmodule.exports = {\n 2: 'need dictionary', /* Z_NEED_DICT 2 */\n 1: 'stream end', /* Z_STREAM_END 1 */\n 0: '', /* Z_OK 0 */\n '-1': 'file error', /* Z_ERRNO (-1) */\n '-2': 'stream error', /* Z_STREAM_ERROR (-2) */\n '-3': 'data error', /* Z_DATA_ERROR (-3) */\n '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */\n '-5': 'buffer error', /* Z_BUF_ERROR (-5) */\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */\n};\n\n},{}],58:[function(require,module,exports){\n'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nvar utils = require('../utils/common');\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n\n//var Z_FILTERED = 1;\n//var Z_HUFFMAN_ONLY = 2;\n//var Z_RLE = 3;\nvar Z_FIXED = 4;\n//var Z_DEFAULT_STRATEGY = 0;\n\n/* Possible values of the data_type field (though see inflate()) */\nvar Z_BINARY = 0;\nvar Z_TEXT = 1;\n//var Z_ASCII = 1; // = Z_TEXT\nvar Z_UNKNOWN = 2;\n\n/*============================================================================*/\n\n\nfunction zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } }\n\n// From zutil.h\n\nvar STORED_BLOCK = 0;\nvar STATIC_TREES = 1;\nvar DYN_TREES = 2;\n/* The three kinds of block type */\n\nvar MIN_MATCH = 3;\nvar MAX_MATCH = 258;\n/* The minimum and maximum match lengths */\n\n// From deflate.h\n/* ===========================================================================\n * Internal compression state.\n */\n\nvar LENGTH_CODES = 29;\n/* number of length codes, not counting the special END_BLOCK code */\n\nvar LITERALS = 256;\n/* number of literal bytes 0..255 */\n\nvar L_CODES = LITERALS + 1 + LENGTH_CODES;\n/* number of Literal or Length codes, including the END_BLOCK code */\n\nvar D_CODES = 30;\n/* number of distance codes */\n\nvar BL_CODES = 19;\n/* number of codes used to transfer the bit lengths */\n\nvar HEAP_SIZE = 2 * L_CODES + 1;\n/* maximum heap size */\n\nvar MAX_BITS = 15;\n/* All codes must not exceed MAX_BITS bits */\n\nvar Buf_size = 16;\n/* size of bit buffer in bi_buf */\n\n\n/* ===========================================================================\n * Constants\n */\n\nvar MAX_BL_BITS = 7;\n/* Bit length codes must not exceed MAX_BL_BITS bits */\n\nvar END_BLOCK = 256;\n/* end of block literal code */\n\nvar REP_3_6 = 16;\n/* repeat previous bit length 3-6 times (2 bits of repeat count) */\n\nvar REPZ_3_10 = 17;\n/* repeat a zero length 3-10 times (3 bits of repeat count) */\n\nvar REPZ_11_138 = 18;\n/* repeat a zero length 11-138 times (7 bits of repeat count) */\n\n/* eslint-disable comma-spacing,array-bracket-spacing */\nvar extra_lbits = /* extra bits for each length code */\n [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];\n\nvar extra_dbits = /* extra bits for each distance code */\n [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];\n\nvar extra_blbits = /* extra bits for each bit length code */\n [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];\n\nvar bl_order =\n [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];\n/* eslint-enable comma-spacing,array-bracket-spacing */\n\n/* The lengths of the bit length codes are sent in order of decreasing\n * probability, to avoid transmitting the lengths for unused bit length codes.\n */\n\n/* ===========================================================================\n * Local data. These are initialized only once.\n */\n\n// We pre-fill arrays with 0 to avoid uninitialized gaps\n\nvar DIST_CODE_LEN = 512; /* see definition of array dist_code below */\n\n// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1\nvar static_ltree = new Array((L_CODES + 2) * 2);\nzero(static_ltree);\n/* The static literal tree. Since the bit lengths are imposed, there is no\n * need for the L_CODES extra codes used during heap construction. However\n * The codes 286 and 287 are needed to build a canonical tree (see _tr_init\n * below).\n */\n\nvar static_dtree = new Array(D_CODES * 2);\nzero(static_dtree);\n/* The static distance tree. (Actually a trivial tree since all codes use\n * 5 bits.)\n */\n\nvar _dist_code = new Array(DIST_CODE_LEN);\nzero(_dist_code);\n/* Distance codes. The first 256 values correspond to the distances\n * 3 .. 258, the last 256 values correspond to the top 8 bits of\n * the 15 bit distances.\n */\n\nvar _length_code = new Array(MAX_MATCH - MIN_MATCH + 1);\nzero(_length_code);\n/* length code for each normalized match length (0 == MIN_MATCH) */\n\nvar base_length = new Array(LENGTH_CODES);\nzero(base_length);\n/* First normalized length for each code (0 = MIN_MATCH) */\n\nvar base_dist = new Array(D_CODES);\nzero(base_dist);\n/* First normalized distance for each code (0 = distance of 1) */\n\n\nfunction StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {\n\n this.static_tree = static_tree; /* static tree or NULL */\n this.extra_bits = extra_bits; /* extra bits for each code or NULL */\n this.extra_base = extra_base; /* base index for extra_bits */\n this.elems = elems; /* max number of elements in the tree */\n this.max_length = max_length; /* max bit length for the codes */\n\n // show if `static_tree` has data or dummy - needed for monomorphic objects\n this.has_stree = static_tree && static_tree.length;\n}\n\n\nvar static_l_desc;\nvar static_d_desc;\nvar static_bl_desc;\n\n\nfunction TreeDesc(dyn_tree, stat_desc) {\n this.dyn_tree = dyn_tree; /* the dynamic tree */\n this.max_code = 0; /* largest code with non zero frequency */\n this.stat_desc = stat_desc; /* the corresponding static tree */\n}\n\n\n\nfunction d_code(dist) {\n return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];\n}\n\n\n/* ===========================================================================\n * Output a short LSB first on the stream.\n * IN assertion: there is enough room in pendingBuf.\n */\nfunction put_short(s, w) {\n// put_byte(s, (uch)((w) & 0xff));\n// put_byte(s, (uch)((ush)(w) >> 8));\n s.pending_buf[s.pending++] = (w) & 0xff;\n s.pending_buf[s.pending++] = (w >>> 8) & 0xff;\n}\n\n\n/* ===========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\nfunction send_bits(s, value, length) {\n if (s.bi_valid > (Buf_size - length)) {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n put_short(s, s.bi_buf);\n s.bi_buf = value >> (Buf_size - s.bi_valid);\n s.bi_valid += length - Buf_size;\n } else {\n s.bi_buf |= (value << s.bi_valid) & 0xffff;\n s.bi_valid += length;\n }\n}\n\n\nfunction send_code(s, c, tree) {\n send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/);\n}\n\n\n/* ===========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\nfunction bi_reverse(code, len) {\n var res = 0;\n do {\n res |= code & 1;\n code >>>= 1;\n res <<= 1;\n } while (--len > 0);\n return res >>> 1;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer, keeping at most 7 bits in it.\n */\nfunction bi_flush(s) {\n if (s.bi_valid === 16) {\n put_short(s, s.bi_buf);\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n } else if (s.bi_valid >= 8) {\n s.pending_buf[s.pending++] = s.bi_buf & 0xff;\n s.bi_buf >>= 8;\n s.bi_valid -= 8;\n }\n}\n\n\n/* ===========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n * above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n * array bl_count contains the frequencies for each bit length.\n * The length opt_len is updated; static_len is also updated if stree is\n * not null.\n */\nfunction gen_bitlen(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var max_code = desc.max_code;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var extra = desc.stat_desc.extra_bits;\n var base = desc.stat_desc.extra_base;\n var max_length = desc.stat_desc.max_length;\n var h; /* heap index */\n var n, m; /* iterate over the tree elements */\n var bits; /* bit length */\n var xbits; /* extra bits */\n var f; /* frequency */\n var overflow = 0; /* number of elements with bit length too large */\n\n for (bits = 0; bits <= MAX_BITS; bits++) {\n s.bl_count[bits] = 0;\n }\n\n /* In a first pass, compute the optimal bit lengths (which may\n * overflow in the case of the bit length tree).\n */\n tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */\n\n for (h = s.heap_max + 1; h < HEAP_SIZE; h++) {\n n = s.heap[h];\n bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1;\n if (bits > max_length) {\n bits = max_length;\n overflow++;\n }\n tree[n * 2 + 1]/*.Len*/ = bits;\n /* We overwrite tree[n].Dad which is no longer needed */\n\n if (n > max_code) { continue; } /* not a leaf node */\n\n s.bl_count[bits]++;\n xbits = 0;\n if (n >= base) {\n xbits = extra[n - base];\n }\n f = tree[n * 2]/*.Freq*/;\n s.opt_len += f * (bits + xbits);\n if (has_stree) {\n s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits);\n }\n }\n if (overflow === 0) { return; }\n\n // Trace((stderr,\"\\nbit length overflow\\n\"));\n /* This happens for example on obj2 and pic of the Calgary corpus */\n\n /* Find the first bit length which could increase: */\n do {\n bits = max_length - 1;\n while (s.bl_count[bits] === 0) { bits--; }\n s.bl_count[bits]--; /* move one leaf down the tree */\n s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */\n s.bl_count[max_length]--;\n /* The brother of the overflow item also moves one step up,\n * but this does not affect bl_count[max_length]\n */\n overflow -= 2;\n } while (overflow > 0);\n\n /* Now recompute all bit lengths, scanning in increasing frequency.\n * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n * lengths instead of fixing only the wrong ones. This idea is taken\n * from 'ar' written by Haruhiko Okumura.)\n */\n for (bits = max_length; bits !== 0; bits--) {\n n = s.bl_count[bits];\n while (n !== 0) {\n m = s.heap[--h];\n if (m > max_code) { continue; }\n if (tree[m * 2 + 1]/*.Len*/ !== bits) {\n // Trace((stderr,\"code %d bits %d->%d\\n\", m, tree[m].Len, bits));\n s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/;\n tree[m * 2 + 1]/*.Len*/ = bits;\n }\n n--;\n }\n }\n}\n\n\n/* ===========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n * zero code length.\n */\nfunction gen_codes(tree, max_code, bl_count)\n// ct_data *tree; /* the tree to decorate */\n// int max_code; /* largest code with non zero frequency */\n// ushf *bl_count; /* number of codes at each bit length */\n{\n var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */\n var code = 0; /* running code value */\n var bits; /* bit index */\n var n; /* code index */\n\n /* The distribution counts are first used to generate the code values\n * without bit reversal.\n */\n for (bits = 1; bits <= MAX_BITS; bits++) {\n next_code[bits] = code = (code + bl_count[bits - 1]) << 1;\n }\n /* Check that the bit counts in bl_count are consistent. The last code\n * must be all ones.\n */\n //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */\n length = 0;\n for (code = 0; code < LENGTH_CODES - 1; code++) {\n base_length[code] = length;\n for (n = 0; n < (1 << extra_lbits[code]); n++) {\n _length_code[length++] = code;\n }\n }\n //Assert (length == 256, \"tr_static_init: length != 256\");\n /* Note that the length 255 (match length 258) can be represented\n * in two different ways: code 284 + 5 bits or code 285, so we\n * overwrite length_code[255] to use the best encoding:\n */\n _length_code[length - 1] = code;\n\n /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n dist = 0;\n for (code = 0; code < 16; code++) {\n base_dist[code] = dist;\n for (n = 0; n < (1 << extra_dbits[code]); n++) {\n _dist_code[dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: dist != 256\");\n dist >>= 7; /* from now on, all distances are divided by 128 */\n for (; code < D_CODES; code++) {\n base_dist[code] = dist << 7;\n for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) {\n _dist_code[256 + dist++] = code;\n }\n }\n //Assert (dist == 256, \"tr_static_init: 256+dist != 512\");\n\n /* Construct the codes of the static literal tree */\n for (bits = 0; bits <= MAX_BITS; bits++) {\n bl_count[bits] = 0;\n }\n\n n = 0;\n while (n <= 143) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n while (n <= 255) {\n static_ltree[n * 2 + 1]/*.Len*/ = 9;\n n++;\n bl_count[9]++;\n }\n while (n <= 279) {\n static_ltree[n * 2 + 1]/*.Len*/ = 7;\n n++;\n bl_count[7]++;\n }\n while (n <= 287) {\n static_ltree[n * 2 + 1]/*.Len*/ = 8;\n n++;\n bl_count[8]++;\n }\n /* Codes 286 and 287 do not exist, but we must include them in the\n * tree construction to get a canonical Huffman tree (longest code\n * all ones)\n */\n gen_codes(static_ltree, L_CODES + 1, bl_count);\n\n /* The static distance tree is trivial: */\n for (n = 0; n < D_CODES; n++) {\n static_dtree[n * 2 + 1]/*.Len*/ = 5;\n static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5);\n }\n\n // Now data ready and we can init static trees\n static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS);\n static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS);\n static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);\n\n //static_init_done = true;\n}\n\n\n/* ===========================================================================\n * Initialize a new block.\n */\nfunction init_block(s) {\n var n; /* iterates over tree elements */\n\n /* Initialize the trees. */\n for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; }\n for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; }\n\n s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1;\n s.opt_len = s.static_len = 0;\n s.last_lit = s.matches = 0;\n}\n\n\n/* ===========================================================================\n * Flush the bit buffer and align the output on a byte boundary\n */\nfunction bi_windup(s)\n{\n if (s.bi_valid > 8) {\n put_short(s, s.bi_buf);\n } else if (s.bi_valid > 0) {\n //put_byte(s, (Byte)s->bi_buf);\n s.pending_buf[s.pending++] = s.bi_buf;\n }\n s.bi_buf = 0;\n s.bi_valid = 0;\n}\n\n/* ===========================================================================\n * Copy a stored block, storing first the length and its\n * one's complement if requested.\n */\nfunction copy_block(s, buf, len, header)\n//DeflateState *s;\n//charf *buf; /* the input data */\n//unsigned len; /* its length */\n//int header; /* true if block header must be written */\n{\n bi_windup(s); /* align on byte boundary */\n\n if (header) {\n put_short(s, len);\n put_short(s, ~len);\n }\n// while (len--) {\n// put_byte(s, *buf++);\n// }\n utils.arraySet(s.pending_buf, s.window, buf, len, s.pending);\n s.pending += len;\n}\n\n/* ===========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\nfunction smaller(tree, n, m, depth) {\n var _n2 = n * 2;\n var _m2 = m * 2;\n return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||\n (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m]));\n}\n\n/* ===========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\nfunction pqdownheap(s, tree, k)\n// deflate_state *s;\n// ct_data *tree; /* the tree to restore */\n// int k; /* node to move down */\n{\n var v = s.heap[k];\n var j = k << 1; /* left son of k */\n while (j <= s.heap_len) {\n /* Set j to the smallest of the two sons: */\n if (j < s.heap_len &&\n smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) {\n j++;\n }\n /* Exit if v is smaller than both sons */\n if (smaller(tree, v, s.heap[j], s.depth)) { break; }\n\n /* Exchange v with the smallest son */\n s.heap[k] = s.heap[j];\n k = j;\n\n /* And continue down the tree, setting j to the left son of k */\n j <<= 1;\n }\n s.heap[k] = v;\n}\n\n\n// inlined manually\n// var SMALLEST = 1;\n\n/* ===========================================================================\n * Send the block data compressed using the given Huffman trees\n */\nfunction compress_block(s, ltree, dtree)\n// deflate_state *s;\n// const ct_data *ltree; /* literal tree */\n// const ct_data *dtree; /* distance tree */\n{\n var dist; /* distance of matched string */\n var lc; /* match length or unmatched char (if dist == 0) */\n var lx = 0; /* running index in l_buf */\n var code; /* the code to send */\n var extra; /* number of extra bits to send */\n\n if (s.last_lit !== 0) {\n do {\n dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]);\n lc = s.pending_buf[s.l_buf + lx];\n lx++;\n\n if (dist === 0) {\n send_code(s, lc, ltree); /* send a literal byte */\n //Tracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n } else {\n /* Here, lc is the match length - MIN_MATCH */\n code = _length_code[lc];\n send_code(s, code + LITERALS + 1, ltree); /* send the length code */\n extra = extra_lbits[code];\n if (extra !== 0) {\n lc -= base_length[code];\n send_bits(s, lc, extra); /* send the extra length bits */\n }\n dist--; /* dist is now the match distance - 1 */\n code = d_code(dist);\n //Assert (code < D_CODES, \"bad d_code\");\n\n send_code(s, code, dtree); /* send the distance code */\n extra = extra_dbits[code];\n if (extra !== 0) {\n dist -= base_dist[code];\n send_bits(s, dist, extra); /* send the extra distance bits */\n }\n } /* literal or match pair ? */\n\n /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */\n //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,\n // \"pendingBuf overflow\");\n\n } while (lx < s.last_lit);\n }\n\n send_code(s, END_BLOCK, ltree);\n}\n\n\n/* ===========================================================================\n * Construct one Huffman tree and assigns the code bit strings and lengths.\n * Update the total bit length for the current block.\n * IN assertion: the field freq is set for all tree elements.\n * OUT assertions: the fields len and code are set to the optimal bit length\n * and corresponding code. The length opt_len is updated; static_len is\n * also updated if stree is not null. The field max_code is set.\n */\nfunction build_tree(s, desc)\n// deflate_state *s;\n// tree_desc *desc; /* the tree descriptor */\n{\n var tree = desc.dyn_tree;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var elems = desc.stat_desc.elems;\n var n, m; /* iterate over heap elements */\n var max_code = -1; /* largest code with non zero frequency */\n var node; /* new node being created */\n\n /* Construct the initial heap, with least frequent element in\n * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].\n * heap[0] is not used.\n */\n s.heap_len = 0;\n s.heap_max = HEAP_SIZE;\n\n for (n = 0; n < elems; n++) {\n if (tree[n * 2]/*.Freq*/ !== 0) {\n s.heap[++s.heap_len] = max_code = n;\n s.depth[n] = 0;\n\n } else {\n tree[n * 2 + 1]/*.Len*/ = 0;\n }\n }\n\n /* The pkzip format requires that at least one distance code exists,\n * and that at least one bit should be sent even if there is only one\n * possible code. So to avoid special checks later on we force at least\n * two codes of non zero frequency.\n */\n while (s.heap_len < 2) {\n node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0);\n tree[node * 2]/*.Freq*/ = 1;\n s.depth[node] = 0;\n s.opt_len--;\n\n if (has_stree) {\n s.static_len -= stree[node * 2 + 1]/*.Len*/;\n }\n /* node is 0 or 1 so it does not have extra bits */\n }\n desc.max_code = max_code;\n\n /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,\n * establish sub-heaps of increasing lengths:\n */\n for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); }\n\n /* Construct the Huffman tree by repeatedly combining the least two\n * frequent nodes.\n */\n node = elems; /* next internal node of the tree */\n do {\n //pqremove(s, tree, n); /* n = node of least frequency */\n /*** pqremove ***/\n n = s.heap[1/*SMALLEST*/];\n s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--];\n pqdownheap(s, tree, 1/*SMALLEST*/);\n /***/\n\n m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */\n\n s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */\n s.heap[--s.heap_max] = m;\n\n /* Create a new node father of n and m */\n tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/;\n s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1;\n tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node;\n\n /* and insert the new node in the heap */\n s.heap[1/*SMALLEST*/] = node++;\n pqdownheap(s, tree, 1/*SMALLEST*/);\n\n } while (s.heap_len >= 2);\n\n s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/];\n\n /* At this point, the fields freq and dad are set. We can now\n * generate the bit lengths.\n */\n gen_bitlen(s, desc);\n\n /* The field len is now set, we can generate the bit codes */\n gen_codes(tree, max_code, s.bl_count);\n}\n\n\n/* ===========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree.\n */\nfunction scan_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n s.bl_tree[curlen * 2]/*.Freq*/ += count;\n\n } else if (curlen !== 0) {\n\n if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; }\n s.bl_tree[REP_3_6 * 2]/*.Freq*/++;\n\n } else if (count <= 10) {\n s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++;\n\n } else {\n s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++;\n }\n\n count = 0;\n prevlen = curlen;\n\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\nfunction send_tree(s, tree, max_code)\n// deflate_state *s;\n// ct_data *tree; /* the tree to be scanned */\n// int max_code; /* and its largest code of non zero frequency */\n{\n var n; /* iterates over all tree elements */\n var prevlen = -1; /* last emitted length */\n var curlen; /* length of current code */\n\n var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */\n\n var count = 0; /* repeat count of the current code */\n var max_count = 7; /* max repeat count */\n var min_count = 4; /* min repeat count */\n\n /* tree[max_code+1].Len = -1; */ /* guard already set */\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n }\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[(n + 1) * 2 + 1]/*.Len*/;\n\n if (++count < max_count && curlen === nextlen) {\n continue;\n\n } else if (count < min_count) {\n do { send_code(s, curlen, s.bl_tree); } while (--count !== 0);\n\n } else if (curlen !== 0) {\n if (curlen !== prevlen) {\n send_code(s, curlen, s.bl_tree);\n count--;\n }\n //Assert(count >= 3 && count <= 6, \" 3_6?\");\n send_code(s, REP_3_6, s.bl_tree);\n send_bits(s, count - 3, 2);\n\n } else if (count <= 10) {\n send_code(s, REPZ_3_10, s.bl_tree);\n send_bits(s, count - 3, 3);\n\n } else {\n send_code(s, REPZ_11_138, s.bl_tree);\n send_bits(s, count - 11, 7);\n }\n\n count = 0;\n prevlen = curlen;\n if (nextlen === 0) {\n max_count = 138;\n min_count = 3;\n\n } else if (curlen === nextlen) {\n max_count = 6;\n min_count = 3;\n\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n}\n\n\n/* ===========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\nfunction build_bl_tree(s) {\n var max_blindex; /* index of last bit length code of non zero freq */\n\n /* Determine the bit length frequencies for literal and distance trees */\n scan_tree(s, s.dyn_ltree, s.l_desc.max_code);\n scan_tree(s, s.dyn_dtree, s.d_desc.max_code);\n\n /* Build the bit length tree: */\n build_tree(s, s.bl_desc);\n /* opt_len now includes the length of the tree representations, except\n * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n */\n\n /* Determine the number of bit length codes to send. The pkzip format\n * requires that at least 4 bit length codes be sent. (appnote.txt says\n * 3 but the actual value used is 4.)\n */\n for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {\n if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) {\n break;\n }\n }\n /* Update opt_len to include the bit length tree and counts */\n s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n //Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n // s->opt_len, s->static_len));\n\n return max_blindex;\n}\n\n\n/* ===========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\nfunction send_all_trees(s, lcodes, dcodes, blcodes)\n// deflate_state *s;\n// int lcodes, dcodes, blcodes; /* number of codes for each tree */\n{\n var rank; /* index in bl_order */\n\n //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n // \"too many codes\");\n //Tracev((stderr, \"\\nbl counts: \"));\n send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */\n send_bits(s, dcodes - 1, 5);\n send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */\n for (rank = 0; rank < blcodes; rank++) {\n //Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3);\n }\n //Tracev((stderr, \"\\nbl tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */\n //Tracev((stderr, \"\\nlit tree: sent %ld\", s->bits_sent));\n\n send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */\n //Tracev((stderr, \"\\ndist tree: sent %ld\", s->bits_sent));\n}\n\n\n/* ===========================================================================\n * Check if the data type is TEXT or BINARY, using the following algorithm:\n * - TEXT if the two conditions below are satisfied:\n * a) There are no non-portable control characters belonging to the\n * \"black list\" (0..6, 14..25, 28..31).\n * b) There is at least one printable character belonging to the\n * \"white list\" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).\n * - BINARY otherwise.\n * - The following partially-portable control characters form a\n * \"gray list\" that is ignored in this detection algorithm:\n * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).\n * IN assertion: the fields Freq of dyn_ltree are set.\n */\nfunction detect_data_type(s) {\n /* black_mask is the bit mask of black-listed bytes\n * set bits 0..6, 14..25, and 28..31\n * 0xf3ffc07f = binary 11110011111111111100000001111111\n */\n var black_mask = 0xf3ffc07f;\n var n;\n\n /* Check for non-textual (\"black-listed\") bytes. */\n for (n = 0; n <= 31; n++, black_mask >>>= 1) {\n if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) {\n return Z_BINARY;\n }\n }\n\n /* Check for textual (\"white-listed\") bytes. */\n if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 ||\n s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n for (n = 32; n < LITERALS; n++) {\n if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) {\n return Z_TEXT;\n }\n }\n\n /* There are no \"black-listed\" or \"white-listed\" bytes:\n * this stream either is empty or has tolerated (\"gray-listed\") bytes only.\n */\n return Z_BINARY;\n}\n\n\nvar static_init_done = false;\n\n/* ===========================================================================\n * Initialize the tree data structures for a new zlib stream.\n */\nfunction _tr_init(s)\n{\n\n if (!static_init_done) {\n tr_static_init();\n static_init_done = true;\n }\n\n s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc);\n s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc);\n s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc);\n\n s.bi_buf = 0;\n s.bi_valid = 0;\n\n /* Initialize the first block of the first file: */\n init_block(s);\n}\n\n\n/* ===========================================================================\n * Send a stored block\n */\nfunction _tr_stored_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */\n copy_block(s, buf, stored_len, true); /* with header */\n}\n\n\n/* ===========================================================================\n * Send one empty static block to give enough lookahead for inflate.\n * This takes 10 bits, of which 7 may remain in the bit buffer.\n */\nfunction _tr_align(s) {\n send_bits(s, STATIC_TREES << 1, 3);\n send_code(s, END_BLOCK, static_ltree);\n bi_flush(s);\n}\n\n\n/* ===========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and output the encoded block to the zip file.\n */\nfunction _tr_flush_block(s, buf, stored_len, last)\n//DeflateState *s;\n//charf *buf; /* input block, or NULL if too old */\n//ulg stored_len; /* length of input block */\n//int last; /* one if this is the last block for a file */\n{\n var opt_lenb, static_lenb; /* opt_len and static_len in bytes */\n var max_blindex = 0; /* index of last bit length code of non zero freq */\n\n /* Build the Huffman trees unless a stored block is forced */\n if (s.level > 0) {\n\n /* Check if the file is binary or text */\n if (s.strm.data_type === Z_UNKNOWN) {\n s.strm.data_type = detect_data_type(s);\n }\n\n /* Construct the literal and distance trees */\n build_tree(s, s.l_desc);\n // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n\n build_tree(s, s.d_desc);\n // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\", s->opt_len,\n // s->static_len));\n /* At this point, opt_len and static_len are the total bit lengths of\n * the compressed block data, excluding the tree representations.\n */\n\n /* Build the bit length tree for the above two trees, and get the index\n * in bl_order of the last bit length code to send.\n */\n max_blindex = build_bl_tree(s);\n\n /* Determine the best encoding. Compute the block lengths in bytes. */\n opt_lenb = (s.opt_len + 3 + 7) >>> 3;\n static_lenb = (s.static_len + 3 + 7) >>> 3;\n\n // Tracev((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u \",\n // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,\n // s->last_lit));\n\n if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; }\n\n } else {\n // Assert(buf != (char*)0, \"lost buf\");\n opt_lenb = static_lenb = stored_len + 5; /* force a stored block */\n }\n\n if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) {\n /* 4: two words for the lengths */\n\n /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n * Otherwise we can't have processed more than WSIZE input bytes since\n * the last block flush, because compression would have been\n * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n * transform a block into a stored block.\n */\n _tr_stored_block(s, buf, stored_len, last);\n\n } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) {\n\n send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3);\n compress_block(s, static_ltree, static_dtree);\n\n } else {\n send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3);\n send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1);\n compress_block(s, s.dyn_ltree, s.dyn_dtree);\n }\n // Assert (s->compressed_len == s->bits_sent, \"bad compressed size\");\n /* The above check is made mod 2^32, for files larger than 512 MB\n * and uLong implemented on 32 bits.\n */\n init_block(s);\n\n if (last) {\n bi_windup(s);\n }\n // Tracev((stderr,\"\\ncomprlen %lu(%lu) \", s->compressed_len>>3,\n // s->compressed_len-7*last));\n}\n\n/* ===========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\nfunction _tr_tally(s, dist, lc)\n// deflate_state *s;\n// unsigned dist; /* distance of matched string */\n// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */\n{\n //var out_length, in_length, dcode;\n\n s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff;\n s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff;\n\n s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff;\n s.last_lit++;\n\n if (dist === 0) {\n /* lc is the unmatched char */\n s.dyn_ltree[lc * 2]/*.Freq*/++;\n } else {\n s.matches++;\n /* Here, lc is the match length - MIN_MATCH */\n dist--; /* dist = match distance - 1 */\n //Assert((ush)dist < (ush)MAX_DIST(s) &&\n // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n // (ush)d_code(dist) < (ush)D_CODES, \"_tr_tally: bad match\");\n\n s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++;\n s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++;\n }\n\n// (!) This block is disabled in zlib defaults,\n// don't enable it for binary compatibility\n\n//#ifdef TRUNCATE_BLOCK\n// /* Try to guess if it is profitable to stop the current block here */\n// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) {\n// /* Compute an upper bound for the compressed length */\n// out_length = s.last_lit*8;\n// in_length = s.strstart - s.block_start;\n//\n// for (dcode = 0; dcode < D_CODES; dcode++) {\n// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]);\n// }\n// out_length >>>= 3;\n// //Tracev((stderr,\"\\nlast_lit %u, in %ld, out ~%ld(%ld%%) \",\n// // s->last_lit, in_length, out_length,\n// // 100L - out_length*100L/in_length));\n// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) {\n// return true;\n// }\n// }\n//#endif\n\n return (s.last_lit === s.lit_bufsize - 1);\n /* We avoid equality with lit_bufsize because of wraparound at 64K\n * on 16 bit machines and because stored blocks are restricted to\n * 64K-1 bytes.\n */\n}\n\nexports._tr_init = _tr_init;\nexports._tr_stored_block = _tr_stored_block;\nexports._tr_flush_block = _tr_flush_block;\nexports._tr_tally = _tr_tally;\nexports._tr_align = _tr_align;\n\n},{\"../utils/common\":49}],59:[function(require,module,exports){\n'use strict';\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nfunction ZStream() {\n /* next input byte */\n this.input = null; // JS specific, because we have no pointers\n this.next_in = 0;\n /* number of bytes available at input */\n this.avail_in = 0;\n /* total number of input bytes read so far */\n this.total_in = 0;\n /* next output byte should be put there */\n this.output = null; // JS specific, because we have no pointers\n this.next_out = 0;\n /* remaining free space at output */\n this.avail_out = 0;\n /* total number of bytes output so far */\n this.total_out = 0;\n /* last error message, NULL if no error */\n this.msg = ''/*Z_NULL*/;\n /* not visible by applications */\n this.state = null;\n /* best guess about the data type: binary or text */\n this.data_type = 2/*Z_UNKNOWN*/;\n /* adler32 value of the uncompressed data */\n this.adler = 0;\n}\n\nmodule.exports = ZStream;\n\n},{}],60:[function(require,module,exports){\n// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n},{}],61:[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nmodule.exports = Stream;\n\nvar EE = require('events').EventEmitter;\nvar inherits = require('inherits');\n\ninherits(Stream, EE);\nStream.Readable = require('readable-stream/lib/_stream_readable.js');\nStream.Writable = require('readable-stream/lib/_stream_writable.js');\nStream.Duplex = require('readable-stream/lib/_stream_duplex.js');\nStream.Transform = require('readable-stream/lib/_stream_transform.js');\nStream.PassThrough = require('readable-stream/lib/_stream_passthrough.js');\nStream.finished = require('readable-stream/lib/internal/streams/end-of-stream.js')\nStream.pipeline = require('readable-stream/lib/internal/streams/pipeline.js')\n\n// Backwards-compat with node 0.4.x\nStream.Stream = Stream;\n\n\n\n// old-style streams. Note that the pipe method (the only relevant\n// part of this class) is overridden in the Readable class.\n\nfunction Stream() {\n EE.call(this);\n}\n\nStream.prototype.pipe = function(dest, options) {\n var source = this;\n\n function ondata(chunk) {\n if (dest.writable) {\n if (false === dest.write(chunk) && source.pause) {\n source.pause();\n }\n }\n }\n\n source.on('data', ondata);\n\n function ondrain() {\n if (source.readable && source.resume) {\n source.resume();\n }\n }\n\n dest.on('drain', ondrain);\n\n // If the 'end' option is not supplied, dest.end() will be called when\n // source gets the 'end' or 'close' events. Only dest.end() once.\n if (!dest._isStdio && (!options || options.end !== false)) {\n source.on('end', onend);\n source.on('close', onclose);\n }\n\n var didOnEnd = false;\n function onend() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n dest.end();\n }\n\n\n function onclose() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n if (typeof dest.destroy === 'function') dest.destroy();\n }\n\n // don't leave dangling pipes when there are errors.\n function onerror(er) {\n cleanup();\n if (EE.listenerCount(this, 'error') === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }\n\n source.on('error', onerror);\n dest.on('error', onerror);\n\n // remove all the event listeners that were added.\n function cleanup() {\n source.removeListener('data', ondata);\n dest.removeListener('drain', ondrain);\n\n source.removeListener('end', onend);\n source.removeListener('close', onclose);\n\n source.removeListener('error', onerror);\n dest.removeListener('error', onerror);\n\n source.removeListener('end', cleanup);\n source.removeListener('close', cleanup);\n\n dest.removeListener('close', cleanup);\n }\n\n source.on('end', cleanup);\n source.on('close', cleanup);\n\n dest.on('close', cleanup);\n\n dest.emit('pipe', source);\n\n // Allow for unix-like usage: A.pipe(B).pipe(C)\n return dest;\n};\n\n},{\"events\":38,\"inherits\":45,\"readable-stream/lib/_stream_duplex.js\":63,\"readable-stream/lib/_stream_passthrough.js\":64,\"readable-stream/lib/_stream_readable.js\":65,\"readable-stream/lib/_stream_transform.js\":66,\"readable-stream/lib/_stream_writable.js\":67,\"readable-stream/lib/internal/streams/end-of-stream.js\":71,\"readable-stream/lib/internal/streams/pipeline.js\":73}],62:[function(require,module,exports){\n'use strict';\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar codes = {};\n\nfunction createErrorType(code, message, Base) {\n if (!Base) {\n Base = Error;\n }\n\n function getMessage(arg1, arg2, arg3) {\n if (typeof message === 'string') {\n return message;\n } else {\n return message(arg1, arg2, arg3);\n }\n }\n\n var NodeError =\n /*#__PURE__*/\n function (_Base) {\n _inheritsLoose(NodeError, _Base);\n\n function NodeError(arg1, arg2, arg3) {\n return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;\n }\n\n return NodeError;\n }(Base);\n\n NodeError.prototype.name = Base.name;\n NodeError.prototype.code = code;\n codes[code] = NodeError;\n} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js\n\n\nfunction oneOf(expected, thing) {\n if (Array.isArray(expected)) {\n var len = expected.length;\n expected = expected.map(function (i) {\n return String(i);\n });\n\n if (len > 2) {\n return \"one of \".concat(thing, \" \").concat(expected.slice(0, len - 1).join(', '), \", or \") + expected[len - 1];\n } else if (len === 2) {\n return \"one of \".concat(thing, \" \").concat(expected[0], \" or \").concat(expected[1]);\n } else {\n return \"of \".concat(thing, \" \").concat(expected[0]);\n }\n } else {\n return \"of \".concat(thing, \" \").concat(String(expected));\n }\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith\n\n\nfunction startsWith(str, search, pos) {\n return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith\n\n\nfunction endsWith(str, search, this_len) {\n if (this_len === undefined || this_len > str.length) {\n this_len = str.length;\n }\n\n return str.substring(this_len - search.length, this_len) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes\n\n\nfunction includes(str, search, start) {\n if (typeof start !== 'number') {\n start = 0;\n }\n\n if (start + search.length > str.length) {\n return false;\n } else {\n return str.indexOf(search, start) !== -1;\n }\n}\n\ncreateErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {\n return 'The value \"' + value + '\" is invalid for option \"' + name + '\"';\n}, TypeError);\ncreateErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {\n // determiner: 'must be' or 'must not be'\n var determiner;\n\n if (typeof expected === 'string' && startsWith(expected, 'not ')) {\n determiner = 'must not be';\n expected = expected.replace(/^not /, '');\n } else {\n determiner = 'must be';\n }\n\n var msg;\n\n if (endsWith(name, ' argument')) {\n // For cases like 'first argument'\n msg = \"The \".concat(name, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n } else {\n var type = includes(name, '.') ? 'property' : 'argument';\n msg = \"The \\\"\".concat(name, \"\\\" \").concat(type, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n }\n\n msg += \". Received type \".concat(typeof actual);\n return msg;\n}, TypeError);\ncreateErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');\ncreateErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {\n return 'The ' + name + ' method is not implemented';\n});\ncreateErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');\ncreateErrorType('ERR_STREAM_DESTROYED', function (name) {\n return 'Cannot call ' + name + ' after a stream was destroyed';\n});\ncreateErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');\ncreateErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');\ncreateErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');\ncreateErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);\ncreateErrorType('ERR_UNKNOWN_ENCODING', function (arg) {\n return 'Unknown encoding: ' + arg;\n}, TypeError);\ncreateErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');\nmodule.exports.codes = codes;\n\n},{}],63:[function(require,module,exports){\n(function (process){(function (){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n'use strict';\n/**/\n\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n\n for (var key in obj) {\n keys.push(key);\n }\n\n return keys;\n};\n/**/\n\n\nmodule.exports = Duplex;\n\nvar Readable = require('./_stream_readable');\n\nvar Writable = require('./_stream_writable');\n\nrequire('inherits')(Duplex, Readable);\n\n{\n // Allow the keys array to be GC'ed.\n var keys = objectKeys(Writable.prototype);\n\n for (var v = 0; v < keys.length; v++) {\n var method = keys[v];\n if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];\n }\n}\n\nfunction Duplex(options) {\n if (!(this instanceof Duplex)) return new Duplex(options);\n Readable.call(this, options);\n Writable.call(this, options);\n this.allowHalfOpen = true;\n\n if (options) {\n if (options.readable === false) this.readable = false;\n if (options.writable === false) this.writable = false;\n\n if (options.allowHalfOpen === false) {\n this.allowHalfOpen = false;\n this.once('end', onend);\n }\n }\n}\n\nObject.defineProperty(Duplex.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n});\nObject.defineProperty(Duplex.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\nObject.defineProperty(Duplex.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n}); // the no-half-open enforcer\n\nfunction onend() {\n // If the writable side ended, then we're ok.\n if (this._writableState.ended) return; // no more data can be written.\n // But allow more writes to happen in this tick.\n\n process.nextTick(onEndNT, this);\n}\n\nfunction onEndNT(self) {\n self.end();\n}\n\nObject.defineProperty(Duplex.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined || this._writableState === undefined) {\n return false;\n }\n\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (this._readableState === undefined || this._writableState === undefined) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n});\n}).call(this)}).call(this,require('_process'))\n},{\"./_stream_readable\":65,\"./_stream_writable\":67,\"_process\":60,\"inherits\":45}],64:[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n'use strict';\n\nmodule.exports = PassThrough;\n\nvar Transform = require('./_stream_transform');\n\nrequire('inherits')(PassThrough, Transform);\n\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough)) return new PassThrough(options);\n Transform.call(this, options);\n}\n\nPassThrough.prototype._transform = function (chunk, encoding, cb) {\n cb(null, chunk);\n};\n},{\"./_stream_transform\":66,\"inherits\":45}],65:[function(require,module,exports){\n(function (process,global){(function (){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n'use strict';\n\nmodule.exports = Readable;\n/**/\n\nvar Duplex;\n/**/\n\nReadable.ReadableState = ReadableState;\n/**/\n\nvar EE = require('events').EventEmitter;\n\nvar EElistenerCount = function EElistenerCount(emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\n/**/\n\n\nvar Stream = require('./internal/streams/stream');\n/**/\n\n\nvar Buffer = require('buffer').Buffer;\n\nvar OurUint8Array = global.Uint8Array || function () {};\n\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\n\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n/**/\n\n\nvar debugUtil = require('util');\n\nvar debug;\n\nif (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog('stream');\n} else {\n debug = function debug() {};\n}\n/**/\n\n\nvar BufferList = require('./internal/streams/buffer_list');\n\nvar destroyImpl = require('./internal/streams/destroy');\n\nvar _require = require('./internal/streams/state'),\n getHighWaterMark = _require.getHighWaterMark;\n\nvar _require$codes = require('../errors').codes,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance.\n\n\nvar StringDecoder;\nvar createReadableStreamAsyncIterator;\nvar from;\n\nrequire('inherits')(Readable, Stream);\n\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\nvar kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];\n\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];\n}\n\nfunction ReadableState(options, stream, isDuplex) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {}; // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n\n this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift()\n\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn't happen until \"later\" should generally also\n // not happen before the first read call.\n\n this.sync = true; // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n this.paused = true; // Should close be emitted on destroy. Defaults to true.\n\n this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish')\n\n this.autoDestroy = !!options.autoDestroy; // has it been destroyed\n\n this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n\n this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s\n\n this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled\n\n this.readingMore = false;\n this.decoder = null;\n this.encoding = null;\n\n if (options.encoding) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nfunction Readable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside\n // the ReadableState constructor, at least with V8 6.5\n\n var isDuplex = this instanceof Duplex;\n this._readableState = new ReadableState(options, this, isDuplex); // legacy\n\n this.readable = true;\n\n if (options) {\n if (typeof options.read === 'function') this._read = options.read;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n }\n\n Stream.call(this);\n}\n\nObject.defineProperty(Readable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined) {\n return false;\n }\n\n return this._readableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._readableState) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._readableState.destroyed = value;\n }\n});\nReadable.prototype.destroy = destroyImpl.destroy;\nReadable.prototype._undestroy = destroyImpl.undestroy;\n\nReadable.prototype._destroy = function (err, cb) {\n cb(err);\n}; // Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\n\n\nReadable.prototype.push = function (chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n\n if (!state.objectMode) {\n if (typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding;\n\n if (encoding !== state.encoding) {\n chunk = Buffer.from(chunk, encoding);\n encoding = '';\n }\n\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n}; // Unshift should *always* be something directly out of read()\n\n\nReadable.prototype.unshift = function (chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n};\n\nfunction readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n debug('readableAddChunk', chunk);\n var state = stream._readableState;\n\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck) er = chunkInvalid(state, chunk);\n\n if (er) {\n errorOrDestroy(stream, er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (addToFront) {\n if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());\n } else if (state.destroyed) {\n return false;\n } else {\n state.reading = false;\n\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n maybeReadMore(stream, state);\n }\n } // We can push more data if we are below the highWaterMark.\n // Also, if we have no data yet, we can stand some more bytes.\n // This is to work around cases where hwm=0, such as the repl.\n\n\n return !state.ended && (state.length < state.highWaterMark || state.length === 0);\n}\n\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n state.awaitDrain = 0;\n stream.emit('data', chunk);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n if (state.needReadable) emitReadable(stream);\n }\n\n maybeReadMore(stream, state);\n}\n\nfunction chunkInvalid(state, chunk) {\n var er;\n\n if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk);\n }\n\n return er;\n}\n\nReadable.prototype.isPaused = function () {\n return this._readableState.flowing === false;\n}; // backwards compatibility.\n\n\nReadable.prototype.setEncoding = function (enc) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n var decoder = new StringDecoder(enc);\n this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8\n\n this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers:\n\n var p = this._readableState.buffer.head;\n var content = '';\n\n while (p !== null) {\n content += decoder.write(p.data);\n p = p.next;\n }\n\n this._readableState.buffer.clear();\n\n if (content !== '') this._readableState.buffer.push(content);\n this._readableState.length = content.length;\n return this;\n}; // Don't raise the hwm > 1GB\n\n\nvar MAX_HWM = 0x40000000;\n\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE.\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n\n return n;\n} // This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\n\nfunction howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.\n\n\nReadable.prototype.read = function (n) {\n debug('read', n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n\n if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up.\n\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this);\n return null;\n } // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n // if we need a readable event, then we need to do some reading.\n\n\n var doRead = state.needReadable;\n debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some\n\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n } // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n\n\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n } else if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true; // if the length is currently zero, then we *need* a readable event.\n\n if (state.length === 0) state.needReadable = true; // call internal read method\n\n this._read(state.highWaterMark);\n\n state.sync = false; // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n\n if (!state.reading) n = howMuchToRead(nOrig, state);\n }\n\n var ret;\n if (n > 0) ret = fromList(n, state);else ret = null;\n\n if (ret === null) {\n state.needReadable = state.length <= state.highWaterMark;\n n = 0;\n } else {\n state.length -= n;\n state.awaitDrain = 0;\n }\n\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick.\n\n if (nOrig !== n && state.ended) endReadable(this);\n }\n\n if (ret !== null) this.emit('data', ret);\n return ret;\n};\n\nfunction onEofChunk(stream, state) {\n debug('onEofChunk');\n if (state.ended) return;\n\n if (state.decoder) {\n var chunk = state.decoder.end();\n\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n\n state.ended = true;\n\n if (state.sync) {\n // if we are sync, wait until next tick to emit the data.\n // Otherwise we risk emitting data in the flow()\n // the readable code triggers during a read() call\n emitReadable(stream);\n } else {\n // emit 'readable' now to make sure it gets picked up.\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n state.emittedReadable = true;\n emitReadable_(stream);\n }\n }\n} // Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\n\n\nfunction emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}\n\nfunction emitReadable_(stream) {\n var state = stream._readableState;\n debug('emitReadable_', state.destroyed, state.length, state.ended);\n\n if (!state.destroyed && (state.length || state.ended)) {\n stream.emit('readable');\n state.emittedReadable = false;\n } // The stream needs another readable event if\n // 1. It is not flowing, as the flow mechanism will take\n // care of it.\n // 2. It is not ended.\n // 3. It is below the highWaterMark, so we can schedule\n // another readable later.\n\n\n state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;\n flow(stream);\n} // at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\n\n\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(maybeReadMore_, stream, state);\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n // Attempt to read more data if we should.\n //\n // The conditions for reading more data are (one of):\n // - Not enough data buffered (state.length < state.highWaterMark). The loop\n // is responsible for filling the buffer with enough data if such data\n // is available. If highWaterMark is 0 and we are not in the flowing mode\n // we should _not_ attempt to buffer any extra data. We'll get more data\n // when the stream consumer calls read() instead.\n // - No data in the buffer, and the stream is in flowing mode. In this mode\n // the loop below is responsible for ensuring read() is called. Failing to\n // call read here would abort the flow and there's no other mechanism for\n // continuing the flow if the stream consumer has just subscribed to the\n // 'data' event.\n //\n // In addition to the above conditions to keep reading data, the following\n // conditions prevent the data from being read:\n // - The stream has ended (state.ended).\n // - There is already a pending 'read' operation (state.reading). This is a\n // case where the the stream has called the implementation defined _read()\n // method, but they are processing the call asynchronously and have _not_\n // called push() with new data. In this case we skip performing more\n // read()s. The execution ends in this method again after the _read() ends\n // up calling push() with more data.\n while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {\n var len = state.length;\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length) // didn't get any data, stop spinning.\n break;\n }\n\n state.readingMore = false;\n} // abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\n\n\nReadable.prototype._read = function (n) {\n errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()'));\n};\n\nReadable.prototype.pipe = function (dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n\n default:\n state.pipes.push(dest);\n break;\n }\n\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn);\n dest.on('unpipe', onunpipe);\n\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe');\n\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n\n function onend() {\n debug('onend');\n dest.end();\n } // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n\n\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n var cleanedUp = false;\n\n function cleanup() {\n debug('cleanup'); // cleanup event handlers once the pipe is broken\n\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', unpipe);\n src.removeListener('data', ondata);\n cleanedUp = true; // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n }\n\n src.on('data', ondata);\n\n function ondata(chunk) {\n debug('ondata');\n var ret = dest.write(chunk);\n debug('dest.write', ret);\n\n if (ret === false) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug('false write response, pause', state.awaitDrain);\n state.awaitDrain++;\n }\n\n src.pause();\n }\n } // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n\n\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er);\n } // Make sure our error handler is attached before userland ones.\n\n\n prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once.\n\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n\n dest.once('close', onclose);\n\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n\n dest.once('finish', onfinish);\n\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n } // tell the dest that it's being piped to\n\n\n dest.emit('pipe', src); // start the flow if it hasn't been started already.\n\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function pipeOnDrainFunctionResult() {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain) state.awaitDrain--;\n\n if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\n\nReadable.prototype.unpipe = function (dest) {\n var state = this._readableState;\n var unpipeInfo = {\n hasUnpiped: false\n }; // if we're not piping anywhere, then do nothing.\n\n if (state.pipesCount === 0) return this; // just one destination. most common case.\n\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes) return this;\n if (!dest) dest = state.pipes; // got a match.\n\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest) dest.emit('unpipe', this, unpipeInfo);\n return this;\n } // slow case. multiple pipe destinations.\n\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n\n for (var i = 0; i < len; i++) {\n dests[i].emit('unpipe', this, {\n hasUnpiped: false\n });\n }\n\n return this;\n } // try to find the right one.\n\n\n var index = indexOf(state.pipes, dest);\n if (index === -1) return this;\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1) state.pipes = state.pipes[0];\n dest.emit('unpipe', this, unpipeInfo);\n return this;\n}; // set up data events if they are asked for\n// Ensure readable listeners eventually get something\n\n\nReadable.prototype.on = function (ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n var state = this._readableState;\n\n if (ev === 'data') {\n // update readableListening so that resume() may be a no-op\n // a few lines down. This is needed to support once('readable').\n state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused\n\n if (state.flowing !== false) this.resume();\n } else if (ev === 'readable') {\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.flowing = false;\n state.emittedReadable = false;\n debug('on readable', state.length, state.reading);\n\n if (state.length) {\n emitReadable(this);\n } else if (!state.reading) {\n process.nextTick(nReadingNextTick, this);\n }\n }\n }\n\n return res;\n};\n\nReadable.prototype.addListener = Readable.prototype.on;\n\nReadable.prototype.removeListener = function (ev, fn) {\n var res = Stream.prototype.removeListener.call(this, ev, fn);\n\n if (ev === 'readable') {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n\n return res;\n};\n\nReadable.prototype.removeAllListeners = function (ev) {\n var res = Stream.prototype.removeAllListeners.apply(this, arguments);\n\n if (ev === 'readable' || ev === undefined) {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n\n return res;\n};\n\nfunction updateReadableListening(self) {\n var state = self._readableState;\n state.readableListening = self.listenerCount('readable') > 0;\n\n if (state.resumeScheduled && !state.paused) {\n // flowing needs to be set to true now, otherwise\n // the upcoming resume will not flow.\n state.flowing = true; // crude way to check if we should resume\n } else if (self.listenerCount('data') > 0) {\n self.resume();\n }\n}\n\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n} // pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\n\n\nReadable.prototype.resume = function () {\n var state = this._readableState;\n\n if (!state.flowing) {\n debug('resume'); // we flow only if there is no one listening\n // for readable, but we still have to call\n // resume()\n\n state.flowing = !state.readableListening;\n resume(this, state);\n }\n\n state.paused = false;\n return this;\n};\n\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n process.nextTick(resume_, stream, state);\n }\n}\n\nfunction resume_(stream, state) {\n debug('resume', state.reading);\n\n if (!state.reading) {\n stream.read(0);\n }\n\n state.resumeScheduled = false;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading) stream.read(0);\n}\n\nReadable.prototype.pause = function () {\n debug('call pause flowing=%j', this._readableState.flowing);\n\n if (this._readableState.flowing !== false) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n\n this._readableState.paused = true;\n return this;\n};\n\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n\n while (state.flowing && stream.read() !== null) {\n ;\n }\n} // wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\n\n\nReadable.prototype.wrap = function (stream) {\n var _this = this;\n\n var state = this._readableState;\n var paused = false;\n stream.on('end', function () {\n debug('wrapped end');\n\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) _this.push(chunk);\n }\n\n _this.push(null);\n });\n stream.on('data', function (chunk) {\n debug('wrapped data');\n if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode\n\n if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n\n var ret = _this.push(chunk);\n\n if (!ret) {\n paused = true;\n stream.pause();\n }\n }); // proxy all the other methods.\n // important when wrapping filters and duplexes.\n\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = function methodWrap(method) {\n return function methodWrapReturnFunction() {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n } // proxy certain important events.\n\n\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n } // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n\n\n this._read = function (n) {\n debug('wrapped _read', n);\n\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return this;\n};\n\nif (typeof Symbol === 'function') {\n Readable.prototype[Symbol.asyncIterator] = function () {\n if (createReadableStreamAsyncIterator === undefined) {\n createReadableStreamAsyncIterator = require('./internal/streams/async_iterator');\n }\n\n return createReadableStreamAsyncIterator(this);\n };\n}\n\nObject.defineProperty(Readable.prototype, 'readableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.highWaterMark;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState && this._readableState.buffer;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableFlowing', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.flowing;\n },\n set: function set(state) {\n if (this._readableState) {\n this._readableState.flowing = state;\n }\n }\n}); // exposed for testing purposes only.\n\nReadable._fromList = fromList;\nObject.defineProperty(Readable.prototype, 'readableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.length;\n }\n}); // Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\nfunction fromList(n, state) {\n // nothing buffered\n if (state.length === 0) return null;\n var ret;\n if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {\n // read it all, truncate the list\n if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n // read part of list\n ret = state.buffer.consume(n, state.decoder);\n }\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState;\n debug('endReadable', state.endEmitted);\n\n if (!state.endEmitted) {\n state.ended = true;\n process.nextTick(endReadableNT, state, stream);\n }\n}\n\nfunction endReadableNT(state, stream) {\n debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift.\n\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the writable side is ready for autoDestroy as well\n var wState = stream._writableState;\n\n if (!wState || wState.autoDestroy && wState.finished) {\n stream.destroy();\n }\n }\n }\n}\n\nif (typeof Symbol === 'function') {\n Readable.from = function (iterable, opts) {\n if (from === undefined) {\n from = require('./internal/streams/from');\n }\n\n return from(Readable, iterable, opts);\n };\n}\n\nfunction indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n\n return -1;\n}\n}).call(this)}).call(this,require('_process'),typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"../errors\":62,\"./_stream_duplex\":63,\"./internal/streams/async_iterator\":68,\"./internal/streams/buffer_list\":69,\"./internal/streams/destroy\":70,\"./internal/streams/from\":72,\"./internal/streams/state\":74,\"./internal/streams/stream\":75,\"_process\":60,\"buffer\":33,\"events\":38,\"inherits\":45,\"string_decoder/\":76,\"util\":30}],66:[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n'use strict';\n\nmodule.exports = Transform;\n\nvar _require$codes = require('../errors').codes,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,\n ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;\n\nvar Duplex = require('./_stream_duplex');\n\nrequire('inherits')(Transform, Duplex);\n\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n var cb = ts.writecb;\n\n if (cb === null) {\n return this.emit('error', new ERR_MULTIPLE_CALLBACK());\n }\n\n ts.writechunk = null;\n ts.writecb = null;\n if (data != null) // single equals check for both `null` and `undefined`\n this.push(data);\n cb(er);\n var rs = this._readableState;\n rs.reading = false;\n\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\n\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n Duplex.call(this, options);\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n }; // start out asking for a readable event once data is transformed.\n\n this._readableState.needReadable = true; // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n\n this._readableState.sync = false;\n\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform;\n if (typeof options.flush === 'function') this._flush = options.flush;\n } // When the writable side finishes, then flush out anything remaining.\n\n\n this.on('prefinish', prefinish);\n}\n\nfunction prefinish() {\n var _this = this;\n\n if (typeof this._flush === 'function' && !this._readableState.destroyed) {\n this._flush(function (er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\n\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n}; // This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\n\n\nTransform.prototype._transform = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));\n};\n\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n}; // Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\n\n\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n\n if (ts.writechunk !== null && !ts.transforming) {\n ts.transforming = true;\n\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\nTransform.prototype._destroy = function (err, cb) {\n Duplex.prototype._destroy.call(this, err, function (err2) {\n cb(err2);\n });\n};\n\nfunction done(stream, er, data) {\n if (er) return stream.emit('error', er);\n if (data != null) // single equals check for both `null` and `undefined`\n stream.push(data); // TODO(BridgeAR): Write a test for these two error cases\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n\n if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();\n if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();\n return stream.push(null);\n}\n},{\"../errors\":62,\"./_stream_duplex\":63,\"inherits\":45}],67:[function(require,module,exports){\n(function (process,global){(function (){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n'use strict';\n\nmodule.exports = Writable;\n/* */\n\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n this.next = null;\n} // It seems a linked list but it is not\n// there will be only 2 of these for each stream\n\n\nfunction CorkedRequest(state) {\n var _this = this;\n\n this.next = null;\n this.entry = null;\n\n this.finish = function () {\n onCorkedFinish(_this, state);\n };\n}\n/* */\n\n/**/\n\n\nvar Duplex;\n/**/\n\nWritable.WritableState = WritableState;\n/**/\n\nvar internalUtil = {\n deprecate: require('util-deprecate')\n};\n/**/\n\n/**/\n\nvar Stream = require('./internal/streams/stream');\n/**/\n\n\nvar Buffer = require('buffer').Buffer;\n\nvar OurUint8Array = global.Uint8Array || function () {};\n\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\n\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\nvar destroyImpl = require('./internal/streams/destroy');\n\nvar _require = require('./internal/streams/state'),\n getHighWaterMark = _require.getHighWaterMark;\n\nvar _require$codes = require('../errors').codes,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,\n ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,\n ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,\n ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,\n ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;\n\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\n\nrequire('inherits')(Writable, Stream);\n\nfunction nop() {}\n\nfunction WritableState(options, stream, isDuplex) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {}; // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream,\n // e.g. options.readableObjectMode vs. options.writableObjectMode, etc.\n\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n\n this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called\n\n this.finalCalled = false; // drain event flag.\n\n this.needDrain = false; // at the start of calling end()\n\n this.ending = false; // when end() has been called, and returned\n\n this.ended = false; // when 'finish' is emitted\n\n this.finished = false; // has it been destroyed\n\n this.destroyed = false; // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n\n this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n\n this.length = 0; // a flag to see when we're in the middle of a write.\n\n this.writing = false; // when true all writes will be buffered until .uncork() call\n\n this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n\n this.sync = true; // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n\n this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb)\n\n this.onwrite = function (er) {\n onwrite(stream, er);\n }; // the callback that the user supplies to write(chunk,encoding,cb)\n\n\n this.writecb = null; // the amount that is being written when _write is called.\n\n this.writelen = 0;\n this.bufferedRequest = null;\n this.lastBufferedRequest = null; // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n\n this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n\n this.prefinished = false; // True if the error was already emitted and should not be thrown again\n\n this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true.\n\n this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end')\n\n this.autoDestroy = !!options.autoDestroy; // count buffered requests\n\n this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always\n // one allocated and free to use, and we maintain at most two\n\n this.corkedRequestsFree = new CorkedRequest(this);\n}\n\nWritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n\n while (current) {\n out.push(current);\n current = current.next;\n }\n\n return out;\n};\n\n(function () {\n try {\n Object.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function writableStateBufferGetter() {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')\n });\n } catch (_) {}\n})(); // Test _writableState for inheritance to account for Duplex streams,\n// whose prototype chain only points to Readable.\n\n\nvar realHasInstance;\n\nif (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function value(object) {\n if (realHasInstance.call(this, object)) return true;\n if (this !== Writable) return false;\n return object && object._writableState instanceof WritableState;\n }\n });\n} else {\n realHasInstance = function realHasInstance(object) {\n return object instanceof this;\n };\n}\n\nfunction Writable(options) {\n Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the WritableState constructor, at least with V8 6.5\n\n var isDuplex = this instanceof Duplex;\n if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);\n this._writableState = new WritableState(options, this, isDuplex); // legacy.\n\n this.writable = true;\n\n if (options) {\n if (typeof options.write === 'function') this._write = options.write;\n if (typeof options.writev === 'function') this._writev = options.writev;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n if (typeof options.final === 'function') this._final = options.final;\n }\n\n Stream.call(this);\n} // Otherwise people can pipe Writable streams, which is just wrong.\n\n\nWritable.prototype.pipe = function () {\n errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());\n};\n\nfunction writeAfterEnd(stream, cb) {\n var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb\n\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n} // Checks that a user-supplied chunk is valid, especially for the particular\n// mode the stream is in. Currently this means that `null` is never accepted\n// and undefined/non-string values are only allowed in object mode.\n\n\nfunction validChunk(stream, state, chunk, cb) {\n var er;\n\n if (chunk === null) {\n er = new ERR_STREAM_NULL_VALUES();\n } else if (typeof chunk !== 'string' && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);\n }\n\n if (er) {\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n return false;\n }\n\n return true;\n}\n\nWritable.prototype.write = function (chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n\n if (isBuf && !Buffer.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n if (typeof cb !== 'function') cb = nop;\n if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n return ret;\n};\n\nWritable.prototype.cork = function () {\n this._writableState.corked++;\n};\n\nWritable.prototype.uncork = function () {\n var state = this._writableState;\n\n if (state.corked) {\n state.corked--;\n if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n};\n\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\n\nObject.defineProperty(Writable.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding);\n }\n\n return chunk;\n}\n\nObject.defineProperty(Writable.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n}); // if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\n\nfunction writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = 'buffer';\n chunk = newChunk;\n }\n }\n\n var len = state.objectMode ? 1 : chunk.length;\n state.length += len;\n var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false.\n\n if (!ret) state.needDrain = true;\n\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk: chunk,\n encoding: encoding,\n isBuf: isBuf,\n callback: cb,\n next: null\n };\n\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n\n return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n\n if (sync) {\n // defer the callback if we are being called synchronously\n // to avoid piling up things on the stack\n process.nextTick(cb, er); // this can emit finish, and it will always happen\n // after error\n\n process.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n } else {\n // the caller expect this to happen before if\n // it is async\n cb(er);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er); // this can emit finish, but finish must\n // always follow error\n\n finishMaybe(stream, state);\n }\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK();\n onwriteStateUpdate(state);\n if (er) onwriteError(stream, state, sync, er, cb);else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state) || stream.destroyed;\n\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n\n if (sync) {\n process.nextTick(afterWrite, stream, state, finished, cb);\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n} // Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\n\n\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it\n\n\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n var count = 0;\n var allBuffers = true;\n\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf) allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n\n buffer.allBuffers = allBuffers;\n doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n\n state.pendingcb++;\n state.lastBufferedRequest = null;\n\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n\n state.bufferedRequestCount = 0;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n\n if (state.writing) {\n break;\n }\n }\n\n if (entry === null) state.lastBufferedRequest = null;\n }\n\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function (chunk, encoding, cb) {\n var state = this._writableState;\n\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks\n\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n } // ignore unnecessary end() calls.\n\n\n if (!state.ending) endWritable(this, state, cb);\n return this;\n};\n\nObject.defineProperty(Writable.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n});\n\nfunction needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\n\nfunction callFinal(stream, state) {\n stream._final(function (err) {\n state.pendingcb--;\n\n if (err) {\n errorOrDestroy(stream, err);\n }\n\n state.prefinished = true;\n stream.emit('prefinish');\n finishMaybe(stream, state);\n });\n}\n\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function' && !state.destroyed) {\n state.pendingcb++;\n state.finalCalled = true;\n process.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n }\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n\n if (need) {\n prefinish(stream, state);\n\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit('finish');\n\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the readable side is ready for autoDestroy as well\n var rState = stream._readableState;\n\n if (!rState || rState.autoDestroy && rState.endEmitted) {\n stream.destroy();\n }\n }\n }\n }\n\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n\n if (cb) {\n if (state.finished) process.nextTick(cb);else stream.once('finish', cb);\n }\n\n state.ended = true;\n stream.writable = false;\n}\n\nfunction onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n } // reuse the free corkReq.\n\n\n state.corkedRequestsFree.next = corkReq;\n}\n\nObject.defineProperty(Writable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._writableState === undefined) {\n return false;\n }\n\n return this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._writableState) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._writableState.destroyed = value;\n }\n});\nWritable.prototype.destroy = destroyImpl.destroy;\nWritable.prototype._undestroy = destroyImpl.undestroy;\n\nWritable.prototype._destroy = function (err, cb) {\n cb(err);\n};\n}).call(this)}).call(this,require('_process'),typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"../errors\":62,\"./_stream_duplex\":63,\"./internal/streams/destroy\":70,\"./internal/streams/state\":74,\"./internal/streams/stream\":75,\"_process\":60,\"buffer\":33,\"inherits\":45,\"util-deprecate\":78}],68:[function(require,module,exports){\n(function (process){(function (){\n'use strict';\n\nvar _Object$setPrototypeO;\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar finished = require('./end-of-stream');\n\nvar kLastResolve = Symbol('lastResolve');\nvar kLastReject = Symbol('lastReject');\nvar kError = Symbol('error');\nvar kEnded = Symbol('ended');\nvar kLastPromise = Symbol('lastPromise');\nvar kHandlePromise = Symbol('handlePromise');\nvar kStream = Symbol('stream');\n\nfunction createIterResult(value, done) {\n return {\n value: value,\n done: done\n };\n}\n\nfunction readAndResolve(iter) {\n var resolve = iter[kLastResolve];\n\n if (resolve !== null) {\n var data = iter[kStream].read(); // we defer if data is null\n // we can be expecting either 'end' or\n // 'error'\n\n if (data !== null) {\n iter[kLastPromise] = null;\n iter[kLastResolve] = null;\n iter[kLastReject] = null;\n resolve(createIterResult(data, false));\n }\n }\n}\n\nfunction onReadable(iter) {\n // we wait for the next tick, because it might\n // emit an error with process.nextTick\n process.nextTick(readAndResolve, iter);\n}\n\nfunction wrapForNext(lastPromise, iter) {\n return function (resolve, reject) {\n lastPromise.then(function () {\n if (iter[kEnded]) {\n resolve(createIterResult(undefined, true));\n return;\n }\n\n iter[kHandlePromise](resolve, reject);\n }, reject);\n };\n}\n\nvar AsyncIteratorPrototype = Object.getPrototypeOf(function () {});\nvar ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {\n get stream() {\n return this[kStream];\n },\n\n next: function next() {\n var _this = this;\n\n // if we have detected an error in the meanwhile\n // reject straight away\n var error = this[kError];\n\n if (error !== null) {\n return Promise.reject(error);\n }\n\n if (this[kEnded]) {\n return Promise.resolve(createIterResult(undefined, true));\n }\n\n if (this[kStream].destroyed) {\n // We need to defer via nextTick because if .destroy(err) is\n // called, the error will be emitted via nextTick, and\n // we cannot guarantee that there is no error lingering around\n // waiting to be emitted.\n return new Promise(function (resolve, reject) {\n process.nextTick(function () {\n if (_this[kError]) {\n reject(_this[kError]);\n } else {\n resolve(createIterResult(undefined, true));\n }\n });\n });\n } // if we have multiple next() calls\n // we will wait for the previous Promise to finish\n // this logic is optimized to support for await loops,\n // where next() is only called once at a time\n\n\n var lastPromise = this[kLastPromise];\n var promise;\n\n if (lastPromise) {\n promise = new Promise(wrapForNext(lastPromise, this));\n } else {\n // fast path needed to support multiple this.push()\n // without triggering the next() queue\n var data = this[kStream].read();\n\n if (data !== null) {\n return Promise.resolve(createIterResult(data, false));\n }\n\n promise = new Promise(this[kHandlePromise]);\n }\n\n this[kLastPromise] = promise;\n return promise;\n }\n}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () {\n return this;\n}), _defineProperty(_Object$setPrototypeO, \"return\", function _return() {\n var _this2 = this;\n\n // destroy(err, cb) is a private API\n // we can guarantee we have that here, because we control the\n // Readable class this is attached to\n return new Promise(function (resolve, reject) {\n _this2[kStream].destroy(null, function (err) {\n if (err) {\n reject(err);\n return;\n }\n\n resolve(createIterResult(undefined, true));\n });\n });\n}), _Object$setPrototypeO), AsyncIteratorPrototype);\n\nvar createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {\n var _Object$create;\n\n var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {\n value: stream,\n writable: true\n }), _defineProperty(_Object$create, kLastResolve, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kLastReject, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kError, {\n value: null,\n writable: true\n }), _defineProperty(_Object$create, kEnded, {\n value: stream._readableState.endEmitted,\n writable: true\n }), _defineProperty(_Object$create, kHandlePromise, {\n value: function value(resolve, reject) {\n var data = iterator[kStream].read();\n\n if (data) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(data, false));\n } else {\n iterator[kLastResolve] = resolve;\n iterator[kLastReject] = reject;\n }\n },\n writable: true\n }), _Object$create));\n iterator[kLastPromise] = null;\n finished(stream, function (err) {\n if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {\n var reject = iterator[kLastReject]; // reject if we are waiting for data in the Promise\n // returned by next() and store the error\n\n if (reject !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n reject(err);\n }\n\n iterator[kError] = err;\n return;\n }\n\n var resolve = iterator[kLastResolve];\n\n if (resolve !== null) {\n iterator[kLastPromise] = null;\n iterator[kLastResolve] = null;\n iterator[kLastReject] = null;\n resolve(createIterResult(undefined, true));\n }\n\n iterator[kEnded] = true;\n });\n stream.on('readable', onReadable.bind(null, iterator));\n return iterator;\n};\n\nmodule.exports = createReadableStreamAsyncIterator;\n}).call(this)}).call(this,require('_process'))\n},{\"./end-of-stream\":71,\"_process\":60}],69:[function(require,module,exports){\n'use strict';\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nvar _require = require('buffer'),\n Buffer = _require.Buffer;\n\nvar _require2 = require('util'),\n inspect = _require2.inspect;\n\nvar custom = inspect && inspect.custom || 'inspect';\n\nfunction copyBuffer(src, target, offset) {\n Buffer.prototype.copy.call(src, target, offset);\n}\n\nmodule.exports =\n/*#__PURE__*/\nfunction () {\n function BufferList() {\n _classCallCheck(this, BufferList);\n\n this.head = null;\n this.tail = null;\n this.length = 0;\n }\n\n _createClass(BufferList, [{\n key: \"push\",\n value: function push(v) {\n var entry = {\n data: v,\n next: null\n };\n if (this.length > 0) this.tail.next = entry;else this.head = entry;\n this.tail = entry;\n ++this.length;\n }\n }, {\n key: \"unshift\",\n value: function unshift(v) {\n var entry = {\n data: v,\n next: this.head\n };\n if (this.length === 0) this.tail = entry;\n this.head = entry;\n ++this.length;\n }\n }, {\n key: \"shift\",\n value: function shift() {\n if (this.length === 0) return;\n var ret = this.head.data;\n if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;\n --this.length;\n return ret;\n }\n }, {\n key: \"clear\",\n value: function clear() {\n this.head = this.tail = null;\n this.length = 0;\n }\n }, {\n key: \"join\",\n value: function join(s) {\n if (this.length === 0) return '';\n var p = this.head;\n var ret = '' + p.data;\n\n while (p = p.next) {\n ret += s + p.data;\n }\n\n return ret;\n }\n }, {\n key: \"concat\",\n value: function concat(n) {\n if (this.length === 0) return Buffer.alloc(0);\n var ret = Buffer.allocUnsafe(n >>> 0);\n var p = this.head;\n var i = 0;\n\n while (p) {\n copyBuffer(p.data, ret, i);\n i += p.data.length;\n p = p.next;\n }\n\n return ret;\n } // Consumes a specified amount of bytes or characters from the buffered data.\n\n }, {\n key: \"consume\",\n value: function consume(n, hasStrings) {\n var ret;\n\n if (n < this.head.data.length) {\n // `slice` is the same for buffers and strings.\n ret = this.head.data.slice(0, n);\n this.head.data = this.head.data.slice(n);\n } else if (n === this.head.data.length) {\n // First chunk is a perfect match.\n ret = this.shift();\n } else {\n // Result spans more than one buffer.\n ret = hasStrings ? this._getString(n) : this._getBuffer(n);\n }\n\n return ret;\n }\n }, {\n key: \"first\",\n value: function first() {\n return this.head.data;\n } // Consumes a specified amount of characters from the buffered data.\n\n }, {\n key: \"_getString\",\n value: function _getString(n) {\n var p = this.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;else ret += str.slice(0, n);\n n -= nb;\n\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) this.head = p.next;else this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = str.slice(nb);\n }\n\n break;\n }\n\n ++c;\n }\n\n this.length -= c;\n return ret;\n } // Consumes a specified amount of bytes from the buffered data.\n\n }, {\n key: \"_getBuffer\",\n value: function _getBuffer(n) {\n var ret = Buffer.allocUnsafe(n);\n var p = this.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n\n while (p = p.next) {\n var buf = p.data;\n var nb = n > buf.length ? buf.length : n;\n buf.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n\n if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) this.head = p.next;else this.head = this.tail = null;\n } else {\n this.head = p;\n p.data = buf.slice(nb);\n }\n\n break;\n }\n\n ++c;\n }\n\n this.length -= c;\n return ret;\n } // Make sure the linked list only shows the minimal necessary information.\n\n }, {\n key: custom,\n value: function value(_, options) {\n return inspect(this, _objectSpread({}, options, {\n // Only inspect one level.\n depth: 0,\n // It should not recurse.\n customInspect: false\n }));\n }\n }]);\n\n return BufferList;\n}();\n},{\"buffer\":33,\"util\":30}],70:[function(require,module,exports){\n(function (process){(function (){\n'use strict'; // undocumented cb() API, needed for core, not for public API\n\nfunction destroy(err, cb) {\n var _this = this;\n\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err) {\n if (!this._writableState) {\n process.nextTick(emitErrorNT, this, err);\n } else if (!this._writableState.errorEmitted) {\n this._writableState.errorEmitted = true;\n process.nextTick(emitErrorNT, this, err);\n }\n }\n\n return this;\n } // we set destroyed to true before firing error callbacks in order\n // to make it re-entrance safe in case destroy() is called within callbacks\n\n\n if (this._readableState) {\n this._readableState.destroyed = true;\n } // if this is a duplex stream mark the writable part as destroyed as well\n\n\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n\n this._destroy(err || null, function (err) {\n if (!cb && err) {\n if (!_this._writableState) {\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else if (!_this._writableState.errorEmitted) {\n _this._writableState.errorEmitted = true;\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n } else if (cb) {\n process.nextTick(emitCloseNT, _this);\n cb(err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n });\n\n return this;\n}\n\nfunction emitErrorAndCloseNT(self, err) {\n emitErrorNT(self, err);\n emitCloseNT(self);\n}\n\nfunction emitCloseNT(self) {\n if (self._writableState && !self._writableState.emitClose) return;\n if (self._readableState && !self._readableState.emitClose) return;\n self.emit('close');\n}\n\nfunction undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finalCalled = false;\n this._writableState.prefinished = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n}\n\nfunction emitErrorNT(self, err) {\n self.emit('error', err);\n}\n\nfunction errorOrDestroy(stream, err) {\n // We have tests that rely on errors being emitted\n // in the same tick, so changing this is semver major.\n // For now when you opt-in to autoDestroy we allow\n // the error to be emitted nextTick. In a future\n // semver major update we should change the default to this.\n var rState = stream._readableState;\n var wState = stream._writableState;\n if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);\n}\n\nmodule.exports = {\n destroy: destroy,\n undestroy: undestroy,\n errorOrDestroy: errorOrDestroy\n};\n}).call(this)}).call(this,require('_process'))\n},{\"_process\":60}],71:[function(require,module,exports){\n// Ported from https://github.com/mafintosh/end-of-stream with\n// permission from the author, Mathias Buus (@mafintosh).\n'use strict';\n\nvar ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE;\n\nfunction once(callback) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n callback.apply(this, args);\n };\n}\n\nfunction noop() {}\n\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\n\nfunction eos(stream, opts, callback) {\n if (typeof opts === 'function') return eos(stream, null, opts);\n if (!opts) opts = {};\n callback = once(callback || noop);\n var readable = opts.readable || opts.readable !== false && stream.readable;\n var writable = opts.writable || opts.writable !== false && stream.writable;\n\n var onlegacyfinish = function onlegacyfinish() {\n if (!stream.writable) onfinish();\n };\n\n var writableEnded = stream._writableState && stream._writableState.finished;\n\n var onfinish = function onfinish() {\n writable = false;\n writableEnded = true;\n if (!readable) callback.call(stream);\n };\n\n var readableEnded = stream._readableState && stream._readableState.endEmitted;\n\n var onend = function onend() {\n readable = false;\n readableEnded = true;\n if (!writable) callback.call(stream);\n };\n\n var onerror = function onerror(err) {\n callback.call(stream, err);\n };\n\n var onclose = function onclose() {\n var err;\n\n if (readable && !readableEnded) {\n if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n\n if (writable && !writableEnded) {\n if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n };\n\n var onrequest = function onrequest() {\n stream.req.on('finish', onfinish);\n };\n\n if (isRequest(stream)) {\n stream.on('complete', onfinish);\n stream.on('abort', onclose);\n if (stream.req) onrequest();else stream.on('request', onrequest);\n } else if (writable && !stream._writableState) {\n // legacy streams\n stream.on('end', onlegacyfinish);\n stream.on('close', onlegacyfinish);\n }\n\n stream.on('end', onend);\n stream.on('finish', onfinish);\n if (opts.error !== false) stream.on('error', onerror);\n stream.on('close', onclose);\n return function () {\n stream.removeListener('complete', onfinish);\n stream.removeListener('abort', onclose);\n stream.removeListener('request', onrequest);\n if (stream.req) stream.req.removeListener('finish', onfinish);\n stream.removeListener('end', onlegacyfinish);\n stream.removeListener('close', onlegacyfinish);\n stream.removeListener('finish', onfinish);\n stream.removeListener('end', onend);\n stream.removeListener('error', onerror);\n stream.removeListener('close', onclose);\n };\n}\n\nmodule.exports = eos;\n},{\"../../../errors\":62}],72:[function(require,module,exports){\nmodule.exports = function () {\n throw new Error('Readable.from is not available in the browser')\n};\n\n},{}],73:[function(require,module,exports){\n// Ported from https://github.com/mafintosh/pump with\n// permission from the author, Mathias Buus (@mafintosh).\n'use strict';\n\nvar eos;\n\nfunction once(callback) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n callback.apply(void 0, arguments);\n };\n}\n\nvar _require$codes = require('../../../errors').codes,\n ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,\n ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;\n\nfunction noop(err) {\n // Rethrow the error if it exists to avoid swallowing it\n if (err) throw err;\n}\n\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\n\nfunction destroyer(stream, reading, writing, callback) {\n callback = once(callback);\n var closed = false;\n stream.on('close', function () {\n closed = true;\n });\n if (eos === undefined) eos = require('./end-of-stream');\n eos(stream, {\n readable: reading,\n writable: writing\n }, function (err) {\n if (err) return callback(err);\n closed = true;\n callback();\n });\n var destroyed = false;\n return function (err) {\n if (closed) return;\n if (destroyed) return;\n destroyed = true; // request.destroy just do .end - .abort is what we want\n\n if (isRequest(stream)) return stream.abort();\n if (typeof stream.destroy === 'function') return stream.destroy();\n callback(err || new ERR_STREAM_DESTROYED('pipe'));\n };\n}\n\nfunction call(fn) {\n fn();\n}\n\nfunction pipe(from, to) {\n return from.pipe(to);\n}\n\nfunction popCallback(streams) {\n if (!streams.length) return noop;\n if (typeof streams[streams.length - 1] !== 'function') return noop;\n return streams.pop();\n}\n\nfunction pipeline() {\n for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {\n streams[_key] = arguments[_key];\n }\n\n var callback = popCallback(streams);\n if (Array.isArray(streams[0])) streams = streams[0];\n\n if (streams.length < 2) {\n throw new ERR_MISSING_ARGS('streams');\n }\n\n var error;\n var destroys = streams.map(function (stream, i) {\n var reading = i < streams.length - 1;\n var writing = i > 0;\n return destroyer(stream, reading, writing, function (err) {\n if (!error) error = err;\n if (err) destroys.forEach(call);\n if (reading) return;\n destroys.forEach(call);\n callback(error);\n });\n });\n return streams.reduce(pipe);\n}\n\nmodule.exports = pipeline;\n},{\"../../../errors\":62,\"./end-of-stream\":71}],74:[function(require,module,exports){\n'use strict';\n\nvar ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE;\n\nfunction highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;\n}\n\nfunction getHighWaterMark(state, options, duplexKey, isDuplex) {\n var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);\n\n if (hwm != null) {\n if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {\n var name = isDuplex ? duplexKey : 'highWaterMark';\n throw new ERR_INVALID_OPT_VALUE(name, hwm);\n }\n\n return Math.floor(hwm);\n } // Default value\n\n\n return state.objectMode ? 16 : 16 * 1024;\n}\n\nmodule.exports = {\n getHighWaterMark: getHighWaterMark\n};\n},{\"../../../errors\":62}],75:[function(require,module,exports){\nmodule.exports = require('events').EventEmitter;\n\n},{\"events\":38}],76:[function(require,module,exports){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n/**/\n\nvar Buffer = require('safe-buffer').Buffer;\n/**/\n\nvar isEncoding = Buffer.isEncoding || function (encoding) {\n encoding = '' + encoding;\n switch (encoding && encoding.toLowerCase()) {\n case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':\n return true;\n default:\n return false;\n }\n};\n\nfunction _normalizeEncoding(enc) {\n if (!enc) return 'utf8';\n var retried;\n while (true) {\n switch (enc) {\n case 'utf8':\n case 'utf-8':\n return 'utf8';\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return 'utf16le';\n case 'latin1':\n case 'binary':\n return 'latin1';\n case 'base64':\n case 'ascii':\n case 'hex':\n return enc;\n default:\n if (retried) return; // undefined\n enc = ('' + enc).toLowerCase();\n retried = true;\n }\n }\n};\n\n// Do not cache `Buffer.isEncoding` when checking encoding names as some\n// modules monkey-patch it to support additional encodings\nfunction normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n return nenc || enc;\n}\n\n// StringDecoder provides an interface for efficiently splitting a series of\n// buffers into a series of JS strings without breaking apart multi-byte\n// characters.\nexports.StringDecoder = StringDecoder;\nfunction StringDecoder(encoding) {\n this.encoding = normalizeEncoding(encoding);\n var nb;\n switch (this.encoding) {\n case 'utf16le':\n this.text = utf16Text;\n this.end = utf16End;\n nb = 4;\n break;\n case 'utf8':\n this.fillLast = utf8FillLast;\n nb = 4;\n break;\n case 'base64':\n this.text = base64Text;\n this.end = base64End;\n nb = 3;\n break;\n default:\n this.write = simpleWrite;\n this.end = simpleEnd;\n return;\n }\n this.lastNeed = 0;\n this.lastTotal = 0;\n this.lastChar = Buffer.allocUnsafe(nb);\n}\n\nStringDecoder.prototype.write = function (buf) {\n if (buf.length === 0) return '';\n var r;\n var i;\n if (this.lastNeed) {\n r = this.fillLast(buf);\n if (r === undefined) return '';\n i = this.lastNeed;\n this.lastNeed = 0;\n } else {\n i = 0;\n }\n if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);\n return r || '';\n};\n\nStringDecoder.prototype.end = utf8End;\n\n// Returns only complete characters in a Buffer\nStringDecoder.prototype.text = utf8Text;\n\n// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer\nStringDecoder.prototype.fillLast = function (buf) {\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);\n this.lastNeed -= buf.length;\n};\n\n// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a\n// continuation byte. If an invalid byte is detected, -2 is returned.\nfunction utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n}\n\n// Checks at most 3 bytes at the end of a Buffer in order to detect an\n// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)\n// needed to complete the UTF-8 character (if applicable) are returned.\nfunction utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}\n\n// Validates as many continuation bytes for a multi-byte UTF-8 character as\n// needed or are available. If we see a non-continuation byte where we expect\n// one, we \"replace\" the validated continuation bytes we've seen so far with\n// a single UTF-8 replacement character ('\\ufffd'), to match v8's UTF-8 decoding\n// behavior. The continuation byte check is included three times in the case\n// where all of the continuation bytes for a character exist in the same buffer.\n// It is also done this way as a slight performance increase instead of using a\n// loop.\nfunction utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n}\n\n// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.\nfunction utf8FillLast(buf) {\n var p = this.lastTotal - this.lastNeed;\n var r = utf8CheckExtraBytes(this, buf, p);\n if (r !== undefined) return r;\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, p, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, p, 0, buf.length);\n this.lastNeed -= buf.length;\n}\n\n// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a\n// partial character, the character's bytes are buffered until the required\n// number of bytes are available.\nfunction utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}\n\n// For UTF-8, a replacement character is added when ending on a partial\n// character.\nfunction utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd';\n return r;\n}\n\n// UTF-16LE typically needs two bytes per character, but even if we have an even\n// number of bytes available, we need to check if we end on a leading/high\n// surrogate. In that case, we need to wait for the next two bytes in order to\n// decode the last character properly.\nfunction utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n return r;\n }\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n}\n\n// For UTF-16LE we do not explicitly append special replacement characters if we\n// end on a partial character, we simply let v8 handle that.\nfunction utf16End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString('utf16le', 0, end);\n }\n return r;\n}\n\nfunction base64Text(buf, i) {\n var n = (buf.length - i) % 3;\n if (n === 0) return buf.toString('base64', i);\n this.lastNeed = 3 - n;\n this.lastTotal = 3;\n if (n === 1) {\n this.lastChar[0] = buf[buf.length - 1];\n } else {\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n }\n return buf.toString('base64', i, buf.length - n);\n}\n\nfunction base64End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);\n return r;\n}\n\n// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)\nfunction simpleWrite(buf) {\n return buf.toString(this.encoding);\n}\n\nfunction simpleEnd(buf) {\n return buf && buf.length ? this.write(buf) : '';\n}\n},{\"safe-buffer\":77}],77:[function(require,module,exports){\n/*! safe-buffer. MIT License. Feross Aboukhadijeh */\n/* eslint-disable node/no-deprecated-api */\nvar buffer = require('buffer')\nvar Buffer = buffer.Buffer\n\n// alternative to using Object.keys for old browsers\nfunction copyProps (src, dst) {\n for (var key in src) {\n dst[key] = src[key]\n }\n}\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer\n} else {\n // Copy properties from require('buffer')\n copyProps(buffer, exports)\n exports.Buffer = SafeBuffer\n}\n\nfunction SafeBuffer (arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.prototype = Object.create(Buffer.prototype)\n\n// Copy static methods from Buffer\ncopyProps(Buffer, SafeBuffer)\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === 'number') {\n throw new TypeError('Argument must not be a number')\n }\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n var buf = Buffer(size)\n if (fill !== undefined) {\n if (typeof encoding === 'string') {\n buf.fill(fill, encoding)\n } else {\n buf.fill(fill)\n }\n } else {\n buf.fill(0)\n }\n return buf\n}\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return Buffer(size)\n}\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return buffer.SlowBuffer(size)\n}\n\n},{\"buffer\":33}],78:[function(require,module,exports){\n(function (global){(function (){\n\n/**\n * Module exports.\n */\n\nmodule.exports = deprecate;\n\n/**\n * Mark that a method should not be used.\n * Returns a modified function which warns once by default.\n *\n * If `localStorage.noDeprecation = true` is set, then it is a no-op.\n *\n * If `localStorage.throwDeprecation = true` is set, then deprecated functions\n * will throw an Error when invoked.\n *\n * If `localStorage.traceDeprecation = true` is set, then deprecated functions\n * will invoke `console.trace()` instead of `console.error()`.\n *\n * @param {Function} fn - the function to deprecate\n * @param {String} msg - the string to print to the console when `fn` is invoked\n * @returns {Function} a new \"deprecated\" version of `fn`\n * @api public\n */\n\nfunction deprecate (fn, msg) {\n if (config('noDeprecation')) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (config('throwDeprecation')) {\n throw new Error(msg);\n } else if (config('traceDeprecation')) {\n console.trace(msg);\n } else {\n console.warn(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n}\n\n/**\n * Checks `localStorage` for boolean values for the given `name`.\n *\n * @param {String} name\n * @returns {Boolean}\n * @api private\n */\n\nfunction config (name) {\n // accessing global.localStorage can trigger a DOMException in sandboxed iframes\n try {\n if (!global.localStorage) return false;\n } catch (_) {\n return false;\n }\n var val = global.localStorage[name];\n if (null == val) return false;\n return String(val).toLowerCase() === 'true';\n}\n\n}).call(this)}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],79:[function(require,module,exports){\narguments[4][25][0].apply(exports,arguments)\n},{\"dup\":25}],80:[function(require,module,exports){\n// Currently in sync with Node.js lib/internal/util/types.js\n// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9\n\n'use strict';\n\nvar isArgumentsObject = require('is-arguments');\nvar isGeneratorFunction = require('is-generator-function');\nvar whichTypedArray = require('which-typed-array');\nvar isTypedArray = require('is-typed-array');\n\nfunction uncurryThis(f) {\n return f.call.bind(f);\n}\n\nvar BigIntSupported = typeof BigInt !== 'undefined';\nvar SymbolSupported = typeof Symbol !== 'undefined';\n\nvar ObjectToString = uncurryThis(Object.prototype.toString);\n\nvar numberValue = uncurryThis(Number.prototype.valueOf);\nvar stringValue = uncurryThis(String.prototype.valueOf);\nvar booleanValue = uncurryThis(Boolean.prototype.valueOf);\n\nif (BigIntSupported) {\n var bigIntValue = uncurryThis(BigInt.prototype.valueOf);\n}\n\nif (SymbolSupported) {\n var symbolValue = uncurryThis(Symbol.prototype.valueOf);\n}\n\nfunction checkBoxedPrimitive(value, prototypeValueOf) {\n if (typeof value !== 'object') {\n return false;\n }\n try {\n prototypeValueOf(value);\n return true;\n } catch(e) {\n return false;\n }\n}\n\nexports.isArgumentsObject = isArgumentsObject;\nexports.isGeneratorFunction = isGeneratorFunction;\nexports.isTypedArray = isTypedArray;\n\n// Taken from here and modified for better browser support\n// https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js\nfunction isPromise(input) {\n\treturn (\n\t\t(\n\t\t\ttypeof Promise !== 'undefined' &&\n\t\t\tinput instanceof Promise\n\t\t) ||\n\t\t(\n\t\t\tinput !== null &&\n\t\t\ttypeof input === 'object' &&\n\t\t\ttypeof input.then === 'function' &&\n\t\t\ttypeof input.catch === 'function'\n\t\t)\n\t);\n}\nexports.isPromise = isPromise;\n\nfunction isArrayBufferView(value) {\n if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {\n return ArrayBuffer.isView(value);\n }\n\n return (\n isTypedArray(value) ||\n isDataView(value)\n );\n}\nexports.isArrayBufferView = isArrayBufferView;\n\n\nfunction isUint8Array(value) {\n return whichTypedArray(value) === 'Uint8Array';\n}\nexports.isUint8Array = isUint8Array;\n\nfunction isUint8ClampedArray(value) {\n return whichTypedArray(value) === 'Uint8ClampedArray';\n}\nexports.isUint8ClampedArray = isUint8ClampedArray;\n\nfunction isUint16Array(value) {\n return whichTypedArray(value) === 'Uint16Array';\n}\nexports.isUint16Array = isUint16Array;\n\nfunction isUint32Array(value) {\n return whichTypedArray(value) === 'Uint32Array';\n}\nexports.isUint32Array = isUint32Array;\n\nfunction isInt8Array(value) {\n return whichTypedArray(value) === 'Int8Array';\n}\nexports.isInt8Array = isInt8Array;\n\nfunction isInt16Array(value) {\n return whichTypedArray(value) === 'Int16Array';\n}\nexports.isInt16Array = isInt16Array;\n\nfunction isInt32Array(value) {\n return whichTypedArray(value) === 'Int32Array';\n}\nexports.isInt32Array = isInt32Array;\n\nfunction isFloat32Array(value) {\n return whichTypedArray(value) === 'Float32Array';\n}\nexports.isFloat32Array = isFloat32Array;\n\nfunction isFloat64Array(value) {\n return whichTypedArray(value) === 'Float64Array';\n}\nexports.isFloat64Array = isFloat64Array;\n\nfunction isBigInt64Array(value) {\n return whichTypedArray(value) === 'BigInt64Array';\n}\nexports.isBigInt64Array = isBigInt64Array;\n\nfunction isBigUint64Array(value) {\n return whichTypedArray(value) === 'BigUint64Array';\n}\nexports.isBigUint64Array = isBigUint64Array;\n\nfunction isMapToString(value) {\n return ObjectToString(value) === '[object Map]';\n}\nisMapToString.working = (\n typeof Map !== 'undefined' &&\n isMapToString(new Map())\n);\n\nfunction isMap(value) {\n if (typeof Map === 'undefined') {\n return false;\n }\n\n return isMapToString.working\n ? isMapToString(value)\n : value instanceof Map;\n}\nexports.isMap = isMap;\n\nfunction isSetToString(value) {\n return ObjectToString(value) === '[object Set]';\n}\nisSetToString.working = (\n typeof Set !== 'undefined' &&\n isSetToString(new Set())\n);\nfunction isSet(value) {\n if (typeof Set === 'undefined') {\n return false;\n }\n\n return isSetToString.working\n ? isSetToString(value)\n : value instanceof Set;\n}\nexports.isSet = isSet;\n\nfunction isWeakMapToString(value) {\n return ObjectToString(value) === '[object WeakMap]';\n}\nisWeakMapToString.working = (\n typeof WeakMap !== 'undefined' &&\n isWeakMapToString(new WeakMap())\n);\nfunction isWeakMap(value) {\n if (typeof WeakMap === 'undefined') {\n return false;\n }\n\n return isWeakMapToString.working\n ? isWeakMapToString(value)\n : value instanceof WeakMap;\n}\nexports.isWeakMap = isWeakMap;\n\nfunction isWeakSetToString(value) {\n return ObjectToString(value) === '[object WeakSet]';\n}\nisWeakSetToString.working = (\n typeof WeakSet !== 'undefined' &&\n isWeakSetToString(new WeakSet())\n);\nfunction isWeakSet(value) {\n return isWeakSetToString(value);\n}\nexports.isWeakSet = isWeakSet;\n\nfunction isArrayBufferToString(value) {\n return ObjectToString(value) === '[object ArrayBuffer]';\n}\nisArrayBufferToString.working = (\n typeof ArrayBuffer !== 'undefined' &&\n isArrayBufferToString(new ArrayBuffer())\n);\nfunction isArrayBuffer(value) {\n if (typeof ArrayBuffer === 'undefined') {\n return false;\n }\n\n return isArrayBufferToString.working\n ? isArrayBufferToString(value)\n : value instanceof ArrayBuffer;\n}\nexports.isArrayBuffer = isArrayBuffer;\n\nfunction isDataViewToString(value) {\n return ObjectToString(value) === '[object DataView]';\n}\nisDataViewToString.working = (\n typeof ArrayBuffer !== 'undefined' &&\n typeof DataView !== 'undefined' &&\n isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1))\n);\nfunction isDataView(value) {\n if (typeof DataView === 'undefined') {\n return false;\n }\n\n return isDataViewToString.working\n ? isDataViewToString(value)\n : value instanceof DataView;\n}\nexports.isDataView = isDataView;\n\nfunction isSharedArrayBufferToString(value) {\n return ObjectToString(value) === '[object SharedArrayBuffer]';\n}\nisSharedArrayBufferToString.working = (\n typeof SharedArrayBuffer !== 'undefined' &&\n isSharedArrayBufferToString(new SharedArrayBuffer())\n);\nfunction isSharedArrayBuffer(value) {\n if (typeof SharedArrayBuffer === 'undefined') {\n return false;\n }\n\n return isSharedArrayBufferToString.working\n ? isSharedArrayBufferToString(value)\n : value instanceof SharedArrayBuffer;\n}\nexports.isSharedArrayBuffer = isSharedArrayBuffer;\n\nfunction isAsyncFunction(value) {\n return ObjectToString(value) === '[object AsyncFunction]';\n}\nexports.isAsyncFunction = isAsyncFunction;\n\nfunction isMapIterator(value) {\n return ObjectToString(value) === '[object Map Iterator]';\n}\nexports.isMapIterator = isMapIterator;\n\nfunction isSetIterator(value) {\n return ObjectToString(value) === '[object Set Iterator]';\n}\nexports.isSetIterator = isSetIterator;\n\nfunction isGeneratorObject(value) {\n return ObjectToString(value) === '[object Generator]';\n}\nexports.isGeneratorObject = isGeneratorObject;\n\nfunction isWebAssemblyCompiledModule(value) {\n return ObjectToString(value) === '[object WebAssembly.Module]';\n}\nexports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;\n\nfunction isNumberObject(value) {\n return checkBoxedPrimitive(value, numberValue);\n}\nexports.isNumberObject = isNumberObject;\n\nfunction isStringObject(value) {\n return checkBoxedPrimitive(value, stringValue);\n}\nexports.isStringObject = isStringObject;\n\nfunction isBooleanObject(value) {\n return checkBoxedPrimitive(value, booleanValue);\n}\nexports.isBooleanObject = isBooleanObject;\n\nfunction isBigIntObject(value) {\n return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);\n}\nexports.isBigIntObject = isBigIntObject;\n\nfunction isSymbolObject(value) {\n return SymbolSupported && checkBoxedPrimitive(value, symbolValue);\n}\nexports.isSymbolObject = isSymbolObject;\n\nfunction isBoxedPrimitive(value) {\n return (\n isNumberObject(value) ||\n isStringObject(value) ||\n isBooleanObject(value) ||\n isBigIntObject(value) ||\n isSymbolObject(value)\n );\n}\nexports.isBoxedPrimitive = isBoxedPrimitive;\n\nfunction isAnyArrayBuffer(value) {\n return typeof Uint8Array !== 'undefined' && (\n isArrayBuffer(value) ||\n isSharedArrayBuffer(value)\n );\n}\nexports.isAnyArrayBuffer = isAnyArrayBuffer;\n\n['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) {\n Object.defineProperty(exports, method, {\n enumerable: false,\n value: function() {\n throw new Error(method + ' is not supported in userland');\n }\n });\n});\n\n},{\"is-arguments\":46,\"is-generator-function\":47,\"is-typed-array\":48,\"which-typed-array\":82}],81:[function(require,module,exports){\n(function (process){(function (){\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||\n function getOwnPropertyDescriptors(obj) {\n var keys = Object.keys(obj);\n var descriptors = {};\n for (var i = 0; i < keys.length; i++) {\n descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);\n }\n return descriptors;\n };\n\nvar formatRegExp = /%[sdj%]/g;\nexports.format = function(f) {\n if (!isString(f)) {\n var objects = [];\n for (var i = 0; i < arguments.length; i++) {\n objects.push(inspect(arguments[i]));\n }\n return objects.join(' ');\n }\n\n var i = 1;\n var args = arguments;\n var len = args.length;\n var str = String(f).replace(formatRegExp, function(x) {\n if (x === '%%') return '%';\n if (i >= len) return x;\n switch (x) {\n case '%s': return String(args[i++]);\n case '%d': return Number(args[i++]);\n case '%j':\n try {\n return JSON.stringify(args[i++]);\n } catch (_) {\n return '[Circular]';\n }\n default:\n return x;\n }\n });\n for (var x = args[i]; i < len; x = args[++i]) {\n if (isNull(x) || !isObject(x)) {\n str += ' ' + x;\n } else {\n str += ' ' + inspect(x);\n }\n }\n return str;\n};\n\n\n// Mark that a method should not be used.\n// Returns a modified function which warns once by default.\n// If --no-deprecation is set, then it is a no-op.\nexports.deprecate = function(fn, msg) {\n if (typeof process !== 'undefined' && process.noDeprecation === true) {\n return fn;\n }\n\n // Allow for deprecating things in the process of starting up.\n if (typeof process === 'undefined') {\n return function() {\n return exports.deprecate(fn, msg).apply(this, arguments);\n };\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (process.throwDeprecation) {\n throw new Error(msg);\n } else if (process.traceDeprecation) {\n console.trace(msg);\n } else {\n console.error(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n};\n\n\nvar debugs = {};\nvar debugEnvRegex = /^$/;\n\nif (process.env.NODE_DEBUG) {\n var debugEnv = process.env.NODE_DEBUG;\n debugEnv = debugEnv.replace(/[|\\\\{}()[\\]^$+?.]/g, '\\\\$&')\n .replace(/\\*/g, '.*')\n .replace(/,/g, '$|^')\n .toUpperCase();\n debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i');\n}\nexports.debuglog = function(set) {\n set = set.toUpperCase();\n if (!debugs[set]) {\n if (debugEnvRegex.test(set)) {\n var pid = process.pid;\n debugs[set] = function() {\n var msg = exports.format.apply(exports, arguments);\n console.error('%s %d: %s', set, pid, msg);\n };\n } else {\n debugs[set] = function() {};\n }\n }\n return debugs[set];\n};\n\n\n/**\n * Echos the value of a value. Trys to print the value out\n * in the best way possible given the different types.\n *\n * @param {Object} obj The object to print out.\n * @param {Object} opts Optional options object that alters the output.\n */\n/* legacy: obj, showHidden, depth, colors*/\nfunction inspect(obj, opts) {\n // default options\n var ctx = {\n seen: [],\n stylize: stylizeNoColor\n };\n // legacy...\n if (arguments.length >= 3) ctx.depth = arguments[2];\n if (arguments.length >= 4) ctx.colors = arguments[3];\n if (isBoolean(opts)) {\n // legacy...\n ctx.showHidden = opts;\n } else if (opts) {\n // got an \"options\" object\n exports._extend(ctx, opts);\n }\n // set default options\n if (isUndefined(ctx.showHidden)) ctx.showHidden = false;\n if (isUndefined(ctx.depth)) ctx.depth = 2;\n if (isUndefined(ctx.colors)) ctx.colors = false;\n if (isUndefined(ctx.customInspect)) ctx.customInspect = true;\n if (ctx.colors) ctx.stylize = stylizeWithColor;\n return formatValue(ctx, obj, ctx.depth);\n}\nexports.inspect = inspect;\n\n\n// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics\ninspect.colors = {\n 'bold' : [1, 22],\n 'italic' : [3, 23],\n 'underline' : [4, 24],\n 'inverse' : [7, 27],\n 'white' : [37, 39],\n 'grey' : [90, 39],\n 'black' : [30, 39],\n 'blue' : [34, 39],\n 'cyan' : [36, 39],\n 'green' : [32, 39],\n 'magenta' : [35, 39],\n 'red' : [31, 39],\n 'yellow' : [33, 39]\n};\n\n// Don't use 'blue' not visible on cmd.exe\ninspect.styles = {\n 'special': 'cyan',\n 'number': 'yellow',\n 'boolean': 'yellow',\n 'undefined': 'grey',\n 'null': 'bold',\n 'string': 'green',\n 'date': 'magenta',\n // \"name\": intentionally not styling\n 'regexp': 'red'\n};\n\n\nfunction stylizeWithColor(str, styleType) {\n var style = inspect.styles[styleType];\n\n if (style) {\n return '\\u001b[' + inspect.colors[style][0] + 'm' + str +\n '\\u001b[' + inspect.colors[style][1] + 'm';\n } else {\n return str;\n }\n}\n\n\nfunction stylizeNoColor(str, styleType) {\n return str;\n}\n\n\nfunction arrayToHash(array) {\n var hash = {};\n\n array.forEach(function(val, idx) {\n hash[val] = true;\n });\n\n return hash;\n}\n\n\nfunction formatValue(ctx, value, recurseTimes) {\n // Provide a hook for user-specified inspect functions.\n // Check that value is an object with an inspect function on it\n if (ctx.customInspect &&\n value &&\n isFunction(value.inspect) &&\n // Filter out the util module, it's inspect function is special\n value.inspect !== exports.inspect &&\n // Also filter out any prototype objects using the circular check.\n !(value.constructor && value.constructor.prototype === value)) {\n var ret = value.inspect(recurseTimes, ctx);\n if (!isString(ret)) {\n ret = formatValue(ctx, ret, recurseTimes);\n }\n return ret;\n }\n\n // Primitive types cannot have properties\n var primitive = formatPrimitive(ctx, value);\n if (primitive) {\n return primitive;\n }\n\n // Look up the keys of the object.\n var keys = Object.keys(value);\n var visibleKeys = arrayToHash(keys);\n\n if (ctx.showHidden) {\n keys = Object.getOwnPropertyNames(value);\n }\n\n // IE doesn't make error fields non-enumerable\n // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx\n if (isError(value)\n && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {\n return formatError(value);\n }\n\n // Some type of object without properties can be shortcutted.\n if (keys.length === 0) {\n if (isFunction(value)) {\n var name = value.name ? ': ' + value.name : '';\n return ctx.stylize('[Function' + name + ']', 'special');\n }\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n }\n if (isDate(value)) {\n return ctx.stylize(Date.prototype.toString.call(value), 'date');\n }\n if (isError(value)) {\n return formatError(value);\n }\n }\n\n var base = '', array = false, braces = ['{', '}'];\n\n // Make Array say that they are Array\n if (isArray(value)) {\n array = true;\n braces = ['[', ']'];\n }\n\n // Make functions say that they are functions\n if (isFunction(value)) {\n var n = value.name ? ': ' + value.name : '';\n base = ' [Function' + n + ']';\n }\n\n // Make RegExps say that they are RegExps\n if (isRegExp(value)) {\n base = ' ' + RegExp.prototype.toString.call(value);\n }\n\n // Make dates with properties first say the date\n if (isDate(value)) {\n base = ' ' + Date.prototype.toUTCString.call(value);\n }\n\n // Make error with message first say the error\n if (isError(value)) {\n base = ' ' + formatError(value);\n }\n\n if (keys.length === 0 && (!array || value.length == 0)) {\n return braces[0] + base + braces[1];\n }\n\n if (recurseTimes < 0) {\n if (isRegExp(value)) {\n return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');\n } else {\n return ctx.stylize('[Object]', 'special');\n }\n }\n\n ctx.seen.push(value);\n\n var output;\n if (array) {\n output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);\n } else {\n output = keys.map(function(key) {\n return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);\n });\n }\n\n ctx.seen.pop();\n\n return reduceToSingleString(output, base, braces);\n}\n\n\nfunction formatPrimitive(ctx, value) {\n if (isUndefined(value))\n return ctx.stylize('undefined', 'undefined');\n if (isString(value)) {\n var simple = '\\'' + JSON.stringify(value).replace(/^\"|\"$/g, '')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"') + '\\'';\n return ctx.stylize(simple, 'string');\n }\n if (isNumber(value))\n return ctx.stylize('' + value, 'number');\n if (isBoolean(value))\n return ctx.stylize('' + value, 'boolean');\n // For some reason typeof null is \"object\", so special case here.\n if (isNull(value))\n return ctx.stylize('null', 'null');\n}\n\n\nfunction formatError(value) {\n return '[' + Error.prototype.toString.call(value) + ']';\n}\n\n\nfunction formatArray(ctx, value, recurseTimes, visibleKeys, keys) {\n var output = [];\n for (var i = 0, l = value.length; i < l; ++i) {\n if (hasOwnProperty(value, String(i))) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n String(i), true));\n } else {\n output.push('');\n }\n }\n keys.forEach(function(key) {\n if (!key.match(/^\\d+$/)) {\n output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,\n key, true));\n }\n });\n return output;\n}\n\n\nfunction formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {\n var name, str, desc;\n desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };\n if (desc.get) {\n if (desc.set) {\n str = ctx.stylize('[Getter/Setter]', 'special');\n } else {\n str = ctx.stylize('[Getter]', 'special');\n }\n } else {\n if (desc.set) {\n str = ctx.stylize('[Setter]', 'special');\n }\n }\n if (!hasOwnProperty(visibleKeys, key)) {\n name = '[' + key + ']';\n }\n if (!str) {\n if (ctx.seen.indexOf(desc.value) < 0) {\n if (isNull(recurseTimes)) {\n str = formatValue(ctx, desc.value, null);\n } else {\n str = formatValue(ctx, desc.value, recurseTimes - 1);\n }\n if (str.indexOf('\\n') > -1) {\n if (array) {\n str = str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n').substr(2);\n } else {\n str = '\\n' + str.split('\\n').map(function(line) {\n return ' ' + line;\n }).join('\\n');\n }\n }\n } else {\n str = ctx.stylize('[Circular]', 'special');\n }\n }\n if (isUndefined(name)) {\n if (array && key.match(/^\\d+$/)) {\n return str;\n }\n name = JSON.stringify('' + key);\n if (name.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)) {\n name = name.substr(1, name.length - 2);\n name = ctx.stylize(name, 'name');\n } else {\n name = name.replace(/'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\"')\n .replace(/(^\"|\"$)/g, \"'\");\n name = ctx.stylize(name, 'string');\n }\n }\n\n return name + ': ' + str;\n}\n\n\nfunction reduceToSingleString(output, base, braces) {\n var numLinesEst = 0;\n var length = output.reduce(function(prev, cur) {\n numLinesEst++;\n if (cur.indexOf('\\n') >= 0) numLinesEst++;\n return prev + cur.replace(/\\u001b\\[\\d\\d?m/g, '').length + 1;\n }, 0);\n\n if (length > 60) {\n return braces[0] +\n (base === '' ? '' : base + '\\n ') +\n ' ' +\n output.join(',\\n ') +\n ' ' +\n braces[1];\n }\n\n return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];\n}\n\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\nexports.types = require('./support/types');\n\nfunction isArray(ar) {\n return Array.isArray(ar);\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return isObject(re) && objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\nexports.types.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return isObject(d) && objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\nexports.types.isDate = isDate;\n\nfunction isError(e) {\n return isObject(e) &&\n (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\nexports.types.isNativeError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = require('./support/isBuffer');\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n\nfunction pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10);\n}\n\n\nvar months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',\n 'Oct', 'Nov', 'Dec'];\n\n// 26 Feb 16:19:34\nfunction timestamp() {\n var d = new Date();\n var time = [pad(d.getHours()),\n pad(d.getMinutes()),\n pad(d.getSeconds())].join(':');\n return [d.getDate(), months[d.getMonth()], time].join(' ');\n}\n\n\n// log is just a thin wrapper to console.log that prepends a timestamp\nexports.log = function() {\n console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));\n};\n\n\n/**\n * Inherit the prototype methods from one constructor into another.\n *\n * The Function.prototype.inherits from lang.js rewritten as a standalone\n * function (not on Function.prototype). NOTE: If this file is to be loaded\n * during bootstrapping this function needs to be rewritten using some native\n * functions as prototype setup using normal JavaScript does not work as\n * expected during bootstrapping (see mirror.js in r114903).\n *\n * @param {function} ctor Constructor function which needs to inherit the\n * prototype.\n * @param {function} superCtor Constructor function to inherit prototype from.\n */\nexports.inherits = require('inherits');\n\nexports._extend = function(origin, add) {\n // Don't do anything if add isn't an object\n if (!add || !isObject(add)) return origin;\n\n var keys = Object.keys(add);\n var i = keys.length;\n while (i--) {\n origin[keys[i]] = add[keys[i]];\n }\n return origin;\n};\n\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nvar kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;\n\nexports.promisify = function promisify(original) {\n if (typeof original !== 'function')\n throw new TypeError('The \"original\" argument must be of type Function');\n\n if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {\n var fn = original[kCustomPromisifiedSymbol];\n if (typeof fn !== 'function') {\n throw new TypeError('The \"util.promisify.custom\" argument must be of type Function');\n }\n Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return fn;\n }\n\n function fn() {\n var promiseResolve, promiseReject;\n var promise = new Promise(function (resolve, reject) {\n promiseResolve = resolve;\n promiseReject = reject;\n });\n\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n args.push(function (err, value) {\n if (err) {\n promiseReject(err);\n } else {\n promiseResolve(value);\n }\n });\n\n try {\n original.apply(this, args);\n } catch (err) {\n promiseReject(err);\n }\n\n return promise;\n }\n\n Object.setPrototypeOf(fn, Object.getPrototypeOf(original));\n\n if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {\n value: fn, enumerable: false, writable: false, configurable: true\n });\n return Object.defineProperties(\n fn,\n getOwnPropertyDescriptors(original)\n );\n}\n\nexports.promisify.custom = kCustomPromisifiedSymbol\n\nfunction callbackifyOnRejected(reason, cb) {\n // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).\n // Because `null` is a special error value in callbacks which means \"no error\n // occurred\", we error-wrap so the callback consumer can distinguish between\n // \"the promise rejected with null\" or \"the promise fulfilled with undefined\".\n if (!reason) {\n var newReason = new Error('Promise was rejected with a falsy value');\n newReason.reason = reason;\n reason = newReason;\n }\n return cb(reason);\n}\n\nfunction callbackify(original) {\n if (typeof original !== 'function') {\n throw new TypeError('The \"original\" argument must be of type Function');\n }\n\n // We DO NOT return the promise as it gives the user a false sense that\n // the promise is actually somehow related to the callback's execution\n // and that the callback throwing will reject the promise.\n function callbackified() {\n var args = [];\n for (var i = 0; i < arguments.length; i++) {\n args.push(arguments[i]);\n }\n\n var maybeCb = args.pop();\n if (typeof maybeCb !== 'function') {\n throw new TypeError('The last argument must be of type Function');\n }\n var self = this;\n var cb = function() {\n return maybeCb.apply(self, arguments);\n };\n // In true node style we process the callback on `nextTick` with all the\n // implications (stack, `uncaughtException`, `async_hooks`)\n original.apply(this, args)\n .then(function(ret) { process.nextTick(cb.bind(null, null, ret)) },\n function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)) });\n }\n\n Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));\n Object.defineProperties(callbackified,\n getOwnPropertyDescriptors(original));\n return callbackified;\n}\nexports.callbackify = callbackify;\n\n}).call(this)}).call(this,require('_process'))\n},{\"./support/isBuffer\":79,\"./support/types\":80,\"_process\":60,\"inherits\":45}],82:[function(require,module,exports){\n(function (global){(function (){\n'use strict';\n\nvar forEach = require('foreach');\nvar availableTypedArrays = require('available-typed-arrays');\nvar callBound = require('es-abstract/helpers/callBound');\n\nvar $toString = callBound('Object.prototype.toString');\nvar hasSymbols = require('has-symbols')();\nvar hasToStringTag = hasSymbols && typeof Symbol.toStringTag === 'symbol';\n\nvar typedArrays = availableTypedArrays();\n\nvar $slice = callBound('String.prototype.slice');\nvar toStrTags = {};\nvar gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor');\nvar getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');\nif (hasToStringTag && gOPD && getPrototypeOf) {\n\tforEach(typedArrays, function (typedArray) {\n\t\tif (typeof global[typedArray] === 'function') {\n\t\t\tvar arr = new global[typedArray]();\n\t\t\tif (!(Symbol.toStringTag in arr)) {\n\t\t\t\tthrow new EvalError('this engine has support for Symbol.toStringTag, but ' + typedArray + ' does not have the property! Please report this.');\n\t\t\t}\n\t\t\tvar proto = getPrototypeOf(arr);\n\t\t\tvar descriptor = gOPD(proto, Symbol.toStringTag);\n\t\t\tif (!descriptor) {\n\t\t\t\tvar superProto = getPrototypeOf(proto);\n\t\t\t\tdescriptor = gOPD(superProto, Symbol.toStringTag);\n\t\t\t}\n\t\t\ttoStrTags[typedArray] = descriptor.get;\n\t\t}\n\t});\n}\n\nvar tryTypedArrays = function tryAllTypedArrays(value) {\n\tvar foundName = false;\n\tforEach(toStrTags, function (getter, typedArray) {\n\t\tif (!foundName) {\n\t\t\ttry {\n\t\t\t\tvar name = getter.call(value);\n\t\t\t\tif (name === typedArray) {\n\t\t\t\t\tfoundName = name;\n\t\t\t\t}\n\t\t\t} catch (e) {}\n\t\t}\n\t});\n\treturn foundName;\n};\n\nvar isTypedArray = require('is-typed-array');\n\nmodule.exports = function whichTypedArray(value) {\n\tif (!isTypedArray(value)) { return false; }\n\tif (!hasToStringTag) { return $slice($toString(value), 8, -1); }\n\treturn tryTypedArrays(value);\n};\n\n}).call(this)}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{\"available-typed-arrays\":27,\"es-abstract/helpers/callBound\":36,\"es-abstract/helpers/getOwnPropertyDescriptor\":37,\"foreach\":39,\"has-symbols\":42,\"is-typed-array\":48}]},{},[20])(20)\n});","// shim for using process in browser\n\nvar process = module.exports = {};\n\nprocess.nextTick = (function () {\n var canSetImmediate = typeof window !== 'undefined'\n && window.setImmediate;\n var canPost = typeof window !== 'undefined'\n && window.postMessage && window.addEventListener\n ;\n\n if (canSetImmediate) {\n return function (f) { return window.setImmediate(f) };\n }\n\n if (canPost) {\n var queue = [];\n window.addEventListener('message', function (ev) {\n var source = ev.source;\n if ((source === window || source === null) && ev.data === 'process-tick') {\n ev.stopPropagation();\n if (queue.length > 0) {\n var fn = queue.shift();\n fn();\n }\n }\n }, true);\n\n return function nextTick(fn) {\n queue.push(fn);\n window.postMessage('process-tick', '*');\n };\n }\n\n return function nextTick(fn) {\n setTimeout(fn, 0);\n };\n})();\n\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n}\n\n// TODO(shtylman)\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.AbstractTokenizer = void 0;\r\nconst peek_readable_1 = require(\"peek-readable\");\r\n/**\r\n * Core tokenizer\r\n */\r\nclass AbstractTokenizer {\r\n constructor(fileInfo) {\r\n /**\r\n * Tokenizer-stream position\r\n */\r\n this.position = 0;\r\n this.numBuffer = new Uint8Array(8);\r\n this.fileInfo = fileInfo ? fileInfo : {};\r\n }\r\n /**\r\n * Read a token from the tokenizer-stream\r\n * @param token - The token to read\r\n * @param position - If provided, the desired position in the tokenizer-stream\r\n * @returns Promise with token data\r\n */\r\n async readToken(token, position = this.position) {\r\n const uint8Array = Buffer.alloc(token.len);\r\n const len = await this.readBuffer(uint8Array, { position });\r\n if (len < token.len)\r\n throw new peek_readable_1.EndOfStreamError();\r\n return token.get(uint8Array, 0);\r\n }\r\n /**\r\n * Peek a token from the tokenizer-stream.\r\n * @param token - Token to peek from the tokenizer-stream.\r\n * @param position - Offset where to begin reading within the file. If position is null, data will be read from the current file position.\r\n * @returns Promise with token data\r\n */\r\n async peekToken(token, position = this.position) {\r\n const uint8Array = Buffer.alloc(token.len);\r\n const len = await this.peekBuffer(uint8Array, { position });\r\n if (len < token.len)\r\n throw new peek_readable_1.EndOfStreamError();\r\n return token.get(uint8Array, 0);\r\n }\r\n /**\r\n * Read a numeric token from the stream\r\n * @param token - Numeric token\r\n * @returns Promise with number\r\n */\r\n async readNumber(token) {\r\n const len = await this.readBuffer(this.numBuffer, { length: token.len });\r\n if (len < token.len)\r\n throw new peek_readable_1.EndOfStreamError();\r\n return token.get(this.numBuffer, 0);\r\n }\r\n /**\r\n * Read a numeric token from the stream\r\n * @param token - Numeric token\r\n * @returns Promise with number\r\n */\r\n async peekNumber(token) {\r\n const len = await this.peekBuffer(this.numBuffer, { length: token.len });\r\n if (len < token.len)\r\n throw new peek_readable_1.EndOfStreamError();\r\n return token.get(this.numBuffer, 0);\r\n }\r\n /**\r\n * Ignore number of bytes, advances the pointer in under tokenizer-stream.\r\n * @param length - Number of bytes to ignore\r\n * @return resolves the number of bytes ignored, equals length if this available, otherwise the number of bytes available\r\n */\r\n async ignore(length) {\r\n if (this.fileInfo.size !== undefined) {\r\n const bytesLeft = this.fileInfo.size - this.position;\r\n if (length > bytesLeft) {\r\n this.position += bytesLeft;\r\n return bytesLeft;\r\n }\r\n }\r\n this.position += length;\r\n return length;\r\n }\r\n async close() {\r\n // empty\r\n }\r\n normalizeOptions(uint8Array, options) {\r\n if (options && options.position !== undefined && options.position < this.position) {\r\n throw new Error('`options.position` must be equal or greater than `tokenizer.position`');\r\n }\r\n if (options) {\r\n return {\r\n mayBeLess: options.mayBeLess === true,\r\n offset: options.offset ? options.offset : 0,\r\n length: options.length ? options.length : (uint8Array.length - (options.offset ? options.offset : 0)),\r\n position: options.position ? options.position : this.position\r\n };\r\n }\r\n return {\r\n mayBeLess: false,\r\n offset: 0,\r\n length: uint8Array.length,\r\n position: this.position\r\n };\r\n }\r\n}\r\nexports.AbstractTokenizer = AbstractTokenizer;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.BufferTokenizer = void 0;\r\nconst peek_readable_1 = require(\"peek-readable\");\r\nconst AbstractTokenizer_1 = require(\"./AbstractTokenizer\");\r\nclass BufferTokenizer extends AbstractTokenizer_1.AbstractTokenizer {\r\n /**\r\n * Construct BufferTokenizer\r\n * @param uint8Array - Uint8Array to tokenize\r\n * @param fileInfo - Pass additional file information to the tokenizer\r\n */\r\n constructor(uint8Array, fileInfo) {\r\n super(fileInfo);\r\n this.uint8Array = uint8Array;\r\n this.fileInfo.size = this.fileInfo.size ? this.fileInfo.size : uint8Array.length;\r\n }\r\n /**\r\n * Read buffer from tokenizer\r\n * @param uint8Array - Uint8Array to tokenize\r\n * @param options - Read behaviour options\r\n * @returns {Promise}\r\n */\r\n async readBuffer(uint8Array, options) {\r\n if (options && options.position) {\r\n if (options.position < this.position) {\r\n throw new Error('`options.position` must be equal or greater than `tokenizer.position`');\r\n }\r\n this.position = options.position;\r\n }\r\n const bytesRead = await this.peekBuffer(uint8Array, options);\r\n this.position += bytesRead;\r\n return bytesRead;\r\n }\r\n /**\r\n * Peek (read ahead) buffer from tokenizer\r\n * @param uint8Array\r\n * @param options - Read behaviour options\r\n * @returns {Promise}\r\n */\r\n async peekBuffer(uint8Array, options) {\r\n const normOptions = this.normalizeOptions(uint8Array, options);\r\n const bytes2read = Math.min(this.uint8Array.length - normOptions.position, normOptions.length);\r\n if ((!normOptions.mayBeLess) && bytes2read < normOptions.length) {\r\n throw new peek_readable_1.EndOfStreamError();\r\n }\r\n else {\r\n uint8Array.set(this.uint8Array.subarray(normOptions.position, normOptions.position + bytes2read), normOptions.offset);\r\n return bytes2read;\r\n }\r\n }\r\n async close() {\r\n // empty\r\n }\r\n}\r\nexports.BufferTokenizer = BufferTokenizer;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.fromFile = exports.FileTokenizer = void 0;\r\nconst AbstractTokenizer_1 = require(\"./AbstractTokenizer\");\r\nconst peek_readable_1 = require(\"peek-readable\");\r\nconst fs = require(\"./FsPromise\");\r\nclass FileTokenizer extends AbstractTokenizer_1.AbstractTokenizer {\r\n constructor(fd, fileInfo) {\r\n super(fileInfo);\r\n this.fd = fd;\r\n }\r\n /**\r\n * Read buffer from file\r\n * @param uint8Array - Uint8Array to write result to\r\n * @param options - Read behaviour options\r\n * @returns Promise number of bytes read\r\n */\r\n async readBuffer(uint8Array, options) {\r\n const normOptions = this.normalizeOptions(uint8Array, options);\r\n this.position = normOptions.position;\r\n const res = await fs.read(this.fd, uint8Array, normOptions.offset, normOptions.length, normOptions.position);\r\n this.position += res.bytesRead;\r\n if (res.bytesRead < normOptions.length && (!options || !options.mayBeLess)) {\r\n throw new peek_readable_1.EndOfStreamError();\r\n }\r\n return res.bytesRead;\r\n }\r\n /**\r\n * Peek buffer from file\r\n * @param uint8Array - Uint8Array (or Buffer) to write data to\r\n * @param options - Read behaviour options\r\n * @returns Promise number of bytes read\r\n */\r\n async peekBuffer(uint8Array, options) {\r\n const normOptions = this.normalizeOptions(uint8Array, options);\r\n const res = await fs.read(this.fd, uint8Array, normOptions.offset, normOptions.length, normOptions.position);\r\n if ((!normOptions.mayBeLess) && res.bytesRead < normOptions.length) {\r\n throw new peek_readable_1.EndOfStreamError();\r\n }\r\n return res.bytesRead;\r\n }\r\n async close() {\r\n return fs.close(this.fd);\r\n }\r\n}\r\nexports.FileTokenizer = FileTokenizer;\r\nasync function fromFile(sourceFilePath) {\r\n const stat = await fs.stat(sourceFilePath);\r\n if (!stat.isFile) {\r\n throw new Error(`File not a file: ${sourceFilePath}`);\r\n }\r\n const fd = await fs.open(sourceFilePath, 'r');\r\n return new FileTokenizer(fd, { path: sourceFilePath, size: stat.size });\r\n}\r\nexports.fromFile = fromFile;\r\n","\"use strict\";\r\n/**\r\n * Module convert fs functions to promise based functions\r\n */\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.readFile = exports.writeFileSync = exports.writeFile = exports.read = exports.open = exports.close = exports.stat = exports.createReadStream = exports.pathExists = void 0;\r\nconst fs = require(\"fs\");\r\nexports.pathExists = fs.existsSync;\r\nexports.createReadStream = fs.createReadStream;\r\nasync function stat(path) {\r\n return new Promise((resolve, reject) => {\r\n fs.stat(path, (err, stats) => {\r\n if (err)\r\n reject(err);\r\n else\r\n resolve(stats);\r\n });\r\n });\r\n}\r\nexports.stat = stat;\r\nasync function close(fd) {\r\n return new Promise((resolve, reject) => {\r\n fs.close(fd, err => {\r\n if (err)\r\n reject(err);\r\n else\r\n resolve();\r\n });\r\n });\r\n}\r\nexports.close = close;\r\nasync function open(path, mode) {\r\n return new Promise((resolve, reject) => {\r\n fs.open(path, mode, (err, fd) => {\r\n if (err)\r\n reject(err);\r\n else\r\n resolve(fd);\r\n });\r\n });\r\n}\r\nexports.open = open;\r\nasync function read(fd, buffer, offset, length, position) {\r\n return new Promise((resolve, reject) => {\r\n fs.read(fd, buffer, offset, length, position, (err, bytesRead, _buffer) => {\r\n if (err)\r\n reject(err);\r\n else\r\n resolve({ bytesRead, buffer: _buffer });\r\n });\r\n });\r\n}\r\nexports.read = read;\r\nasync function writeFile(path, data) {\r\n return new Promise((resolve, reject) => {\r\n fs.writeFile(path, data, err => {\r\n if (err)\r\n reject(err);\r\n else\r\n resolve();\r\n });\r\n });\r\n}\r\nexports.writeFile = writeFile;\r\nfunction writeFileSync(path, data) {\r\n fs.writeFileSync(path, data);\r\n}\r\nexports.writeFileSync = writeFileSync;\r\nasync function readFile(path) {\r\n return new Promise((resolve, reject) => {\r\n fs.readFile(path, (err, buffer) => {\r\n if (err)\r\n reject(err);\r\n else\r\n resolve(buffer);\r\n });\r\n });\r\n}\r\nexports.readFile = readFile;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.ReadStreamTokenizer = void 0;\r\nconst AbstractTokenizer_1 = require(\"./AbstractTokenizer\");\r\nconst peek_readable_1 = require(\"peek-readable\");\r\nconst maxBufferSize = 256000;\r\nclass ReadStreamTokenizer extends AbstractTokenizer_1.AbstractTokenizer {\r\n constructor(stream, fileInfo) {\r\n super(fileInfo);\r\n this.streamReader = new peek_readable_1.StreamReader(stream);\r\n }\r\n /**\r\n * Get file information, an HTTP-client may implement this doing a HEAD request\r\n * @return Promise with file information\r\n */\r\n async getFileInfo() {\r\n return this.fileInfo;\r\n }\r\n /**\r\n * Read buffer from tokenizer\r\n * @param uint8Array - Target Uint8Array to fill with data read from the tokenizer-stream\r\n * @param options - Read behaviour options\r\n * @returns Promise with number of bytes read\r\n */\r\n async readBuffer(uint8Array, options) {\r\n const normOptions = this.normalizeOptions(uint8Array, options);\r\n const skipBytes = normOptions.position - this.position;\r\n if (skipBytes > 0) {\r\n await this.ignore(skipBytes);\r\n return this.readBuffer(uint8Array, options);\r\n }\r\n else if (skipBytes < 0) {\r\n throw new Error('`options.position` must be equal or greater than `tokenizer.position`');\r\n }\r\n if (normOptions.length === 0) {\r\n return 0;\r\n }\r\n const bytesRead = await this.streamReader.read(uint8Array, normOptions.offset, normOptions.length);\r\n this.position += bytesRead;\r\n if ((!options || !options.mayBeLess) && bytesRead < normOptions.length) {\r\n throw new peek_readable_1.EndOfStreamError();\r\n }\r\n return bytesRead;\r\n }\r\n /**\r\n * Peek (read ahead) buffer from tokenizer\r\n * @param uint8Array - Uint8Array (or Buffer) to write data to\r\n * @param options - Read behaviour options\r\n * @returns Promise with number of bytes peeked\r\n */\r\n async peekBuffer(uint8Array, options) {\r\n const normOptions = this.normalizeOptions(uint8Array, options);\r\n let bytesRead = 0;\r\n if (normOptions.position) {\r\n const skipBytes = normOptions.position - this.position;\r\n if (skipBytes > 0) {\r\n const skipBuffer = new Uint8Array(normOptions.length + skipBytes);\r\n bytesRead = await this.peekBuffer(skipBuffer, { mayBeLess: normOptions.mayBeLess });\r\n uint8Array.set(skipBuffer.subarray(skipBytes), normOptions.offset);\r\n return bytesRead - skipBytes;\r\n }\r\n else if (skipBytes < 0) {\r\n throw new Error('Cannot peek from a negative offset in a stream');\r\n }\r\n }\r\n if (normOptions.length > 0) {\r\n try {\r\n bytesRead = await this.streamReader.peek(uint8Array, normOptions.offset, normOptions.length);\r\n }\r\n catch (err) {\r\n if (options && options.mayBeLess && err instanceof peek_readable_1.EndOfStreamError) {\r\n return 0;\r\n }\r\n throw err;\r\n }\r\n if ((!normOptions.mayBeLess) && bytesRead < normOptions.length) {\r\n throw new peek_readable_1.EndOfStreamError();\r\n }\r\n }\r\n return bytesRead;\r\n }\r\n async ignore(length) {\r\n // debug(`ignore ${this.position}...${this.position + length - 1}`);\r\n const bufSize = Math.min(maxBufferSize, length);\r\n const buf = new Uint8Array(bufSize);\r\n let totBytesRead = 0;\r\n while (totBytesRead < length) {\r\n const remaining = length - totBytesRead;\r\n const bytesRead = await this.readBuffer(buf, { length: Math.min(bufSize, remaining) });\r\n if (bytesRead < 0) {\r\n return bytesRead;\r\n }\r\n totBytesRead += bytesRead;\r\n }\r\n return totBytesRead;\r\n }\r\n}\r\nexports.ReadStreamTokenizer = ReadStreamTokenizer;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.fromBuffer = exports.fromStream = exports.EndOfStreamError = void 0;\r\nconst ReadStreamTokenizer_1 = require(\"./ReadStreamTokenizer\");\r\nconst BufferTokenizer_1 = require(\"./BufferTokenizer\");\r\nvar peek_readable_1 = require(\"peek-readable\");\r\nObject.defineProperty(exports, \"EndOfStreamError\", { enumerable: true, get: function () { return peek_readable_1.EndOfStreamError; } });\r\n/**\r\n * Construct ReadStreamTokenizer from given Stream.\r\n * Will set fileSize, if provided given Stream has set the .path property/\r\n * @param stream - Read from Node.js Stream.Readable\r\n * @param fileInfo - Pass the file information, like size and MIME-type of the corresponding stream.\r\n * @returns ReadStreamTokenizer\r\n */\r\nfunction fromStream(stream, fileInfo) {\r\n fileInfo = fileInfo ? fileInfo : {};\r\n return new ReadStreamTokenizer_1.ReadStreamTokenizer(stream, fileInfo);\r\n}\r\nexports.fromStream = fromStream;\r\n/**\r\n * Construct ReadStreamTokenizer from given Buffer.\r\n * @param uint8Array - Uint8Array to tokenize\r\n * @param fileInfo - Pass additional file information to the tokenizer\r\n * @returns BufferTokenizer\r\n */\r\nfunction fromBuffer(uint8Array, fileInfo) {\r\n return new BufferTokenizer_1.BufferTokenizer(uint8Array, fileInfo);\r\n}\r\nexports.fromBuffer = fromBuffer;\r\n","\"use strict\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.fromStream = exports.fromBuffer = exports.EndOfStreamError = exports.fromFile = void 0;\r\nconst fs = require(\"./FsPromise\");\r\nconst core = require(\"./core\");\r\nvar FileTokenizer_1 = require(\"./FileTokenizer\");\r\nObject.defineProperty(exports, \"fromFile\", { enumerable: true, get: function () { return FileTokenizer_1.fromFile; } });\r\nvar core_1 = require(\"./core\");\r\nObject.defineProperty(exports, \"EndOfStreamError\", { enumerable: true, get: function () { return core_1.EndOfStreamError; } });\r\nObject.defineProperty(exports, \"fromBuffer\", { enumerable: true, get: function () { return core_1.fromBuffer; } });\r\n/**\r\n * Construct ReadStreamTokenizer from given Stream.\r\n * Will set fileSize, if provided given Stream has set the .path property.\r\n * @param stream - Node.js Stream.Readable\r\n * @param fileInfo - Pass additional file information to the tokenizer\r\n * @returns Tokenizer\r\n */\r\nasync function fromStream(stream, fileInfo) {\r\n fileInfo = fileInfo ? fileInfo : {};\r\n if (stream.path) {\r\n const stat = await fs.stat(stream.path);\r\n fileInfo.path = stream.path;\r\n fileInfo.size = stat.size;\r\n }\r\n return core.fromStream(stream, fileInfo);\r\n}\r\nexports.fromStream = fromStream;\r\n","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nexports.clone = clone;\nexports.addLast = addLast;\nexports.addFirst = addFirst;\nexports.removeLast = removeLast;\nexports.removeFirst = removeFirst;\nexports.insert = insert;\nexports.removeAt = removeAt;\nexports.replaceAt = replaceAt;\nexports.getIn = getIn;\nexports.set = set;\nexports.setIn = setIn;\nexports.update = update;\nexports.updateIn = updateIn;\nexports.merge = merge;\nexports.mergeDeep = mergeDeep;\nexports.mergeIn = mergeIn;\nexports.omit = omit;\nexports.addDefaults = addDefaults;\n\n\n/*!\n * Timm\n *\n * Immutability helpers with fast reads and acceptable writes.\n *\n * @copyright Guillermo Grau Panea 2016\n * @license MIT\n */\n\nvar INVALID_ARGS = 'INVALID_ARGS';\n\n// ===============================================\n// ### Helpers\n// ===============================================\n\n\nfunction throwStr(msg) {\n throw new Error(msg);\n}\n\nfunction getKeysAndSymbols(obj) {\n var keys = Object.keys(obj);\n if (Object.getOwnPropertySymbols) {\n return keys.concat(Object.getOwnPropertySymbols(obj));\n }\n return keys;\n}\n\nvar hasOwnProperty = {}.hasOwnProperty;\n\nfunction clone(obj) {\n if (Array.isArray(obj)) return obj.slice();\n var keys = getKeysAndSymbols(obj);\n var out = {};\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n out[key] = obj[key];\n }\n return out;\n}\n\nfunction doMerge(fAddDefaults, fDeep, first) {\n var out = first;\n !(out != null) && throwStr(process.env.NODE_ENV !== 'production' ? 'At least one object should be provided to merge()' : INVALID_ARGS);\n var fChanged = false;\n\n for (var _len = arguments.length, rest = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {\n rest[_key - 3] = arguments[_key];\n }\n\n for (var idx = 0; idx < rest.length; idx++) {\n var obj = rest[idx];\n if (obj == null) continue;\n var keys = getKeysAndSymbols(obj);\n if (!keys.length) continue;\n for (var j = 0; j <= keys.length; j++) {\n var key = keys[j];\n if (fAddDefaults && out[key] !== undefined) continue;\n var nextVal = obj[key];\n if (fDeep && isObject(out[key]) && isObject(nextVal)) {\n nextVal = doMerge(fAddDefaults, fDeep, out[key], nextVal);\n }\n if (nextVal === undefined || nextVal === out[key]) continue;\n if (!fChanged) {\n fChanged = true;\n out = clone(out);\n }\n out[key] = nextVal;\n }\n }\n return out;\n}\n\nfunction isObject(o) {\n var type = typeof o === 'undefined' ? 'undefined' : _typeof(o);\n return o != null && type === 'object';\n}\n\n// _deepFreeze = (obj) ->\n// Object.freeze obj\n// for key in Object.getOwnPropertyNames obj\n// val = obj[key]\n// if isObject(val) and not Object.isFrozen val\n// _deepFreeze val\n// obj\n\n// ===============================================\n// -- ### Arrays\n// ===============================================\n\n// -- #### addLast()\n// -- Returns a new array with an appended item or items.\n// --\n// -- Usage: `addLast(array: Array, val: Array|T): Array`\n// --\n// -- ```js\n// -- arr = ['a', 'b']\n// -- arr2 = addLast(arr, 'c')\n// -- // ['a', 'b', 'c']\n// -- arr2 === arr\n// -- // false\n// -- arr3 = addLast(arr, ['c', 'd'])\n// -- // ['a', 'b', 'c', 'd']\n// -- ```\n// `array.concat(val)` also handles the scalar case,\n// but is apparently very slow\nfunction addLast(array, val) {\n if (Array.isArray(val)) return array.concat(val);\n return array.concat([val]);\n}\n\n// -- #### addFirst()\n// -- Returns a new array with a prepended item or items.\n// --\n// -- Usage: `addFirst(array: Array, val: Array|T): Array`\n// --\n// -- ```js\n// -- arr = ['a', 'b']\n// -- arr2 = addFirst(arr, 'c')\n// -- // ['c', 'a', 'b']\n// -- arr2 === arr\n// -- // false\n// -- arr3 = addFirst(arr, ['c', 'd'])\n// -- // ['c', 'd', 'a', 'b']\n// -- ```\nfunction addFirst(array, val) {\n if (Array.isArray(val)) return val.concat(array);\n return [val].concat(array);\n}\n\n// -- #### removeLast()\n// -- Returns a new array removing the last item.\n// --\n// -- Usage: `removeLast(array: Array): Array`\n// --\n// -- ```js\n// -- arr = ['a', 'b']\n// -- arr2 = removeLast(arr)\n// -- // ['a']\n// -- arr2 === arr\n// -- // false\n// --\n// -- // The same array is returned if there are no changes:\n// -- arr3 = []\n// -- removeLast(arr3) === arr3\n// -- // true\n// -- ```\nfunction removeLast(array) {\n if (!array.length) return array;\n return array.slice(0, array.length - 1);\n}\n\n// -- #### removeFirst()\n// -- Returns a new array removing the first item.\n// --\n// -- Usage: `removeFirst(array: Array): Array`\n// --\n// -- ```js\n// -- arr = ['a', 'b']\n// -- arr2 = removeFirst(arr)\n// -- // ['b']\n// -- arr2 === arr\n// -- // false\n// --\n// -- // The same array is returned if there are no changes:\n// -- arr3 = []\n// -- removeFirst(arr3) === arr3\n// -- // true\n// -- ```\nfunction removeFirst(array) {\n if (!array.length) return array;\n return array.slice(1);\n}\n\n// -- #### insert()\n// -- Returns a new array obtained by inserting an item or items\n// -- at a specified index.\n// --\n// -- Usage: `insert(array: Array, idx: number, val: Array|T): Array`\n// --\n// -- ```js\n// -- arr = ['a', 'b', 'c']\n// -- arr2 = insert(arr, 1, 'd')\n// -- // ['a', 'd', 'b', 'c']\n// -- arr2 === arr\n// -- // false\n// -- insert(arr, 1, ['d', 'e'])\n// -- // ['a', 'd', 'e', 'b', 'c']\n// -- ```\nfunction insert(array, idx, val) {\n return array.slice(0, idx).concat(Array.isArray(val) ? val : [val]).concat(array.slice(idx));\n}\n\n// -- #### removeAt()\n// -- Returns a new array obtained by removing an item at\n// -- a specified index.\n// --\n// -- Usage: `removeAt(array: Array, idx: number): Array`\n// --\n// -- ```js\n// -- arr = ['a', 'b', 'c']\n// -- arr2 = removeAt(arr, 1)\n// -- // ['a', 'c']\n// -- arr2 === arr\n// -- // false\n// --\n// -- // The same array is returned if there are no changes:\n// -- removeAt(arr, 4) === arr\n// -- // true\n// -- ```\nfunction removeAt(array, idx) {\n if (idx >= array.length || idx < 0) return array;\n return array.slice(0, idx).concat(array.slice(idx + 1));\n}\n\n// -- #### replaceAt()\n// -- Returns a new array obtained by replacing an item at\n// -- a specified index. If the provided item is the same as\n// -- (*referentially equal to*) the previous item at that position,\n// -- the original array is returned.\n// --\n// -- Usage: `replaceAt(array: Array, idx: number, newItem: T): Array`\n// --\n// -- ```js\n// -- arr = ['a', 'b', 'c']\n// -- arr2 = replaceAt(arr, 1, 'd')\n// -- // ['a', 'd', 'c']\n// -- arr2 === arr\n// -- // false\n// --\n// -- // The same object is returned if there are no changes:\n// -- replaceAt(arr, 1, 'b') === arr\n// -- // true\n// -- ```\nfunction replaceAt(array, idx, newItem) {\n if (array[idx] === newItem) return array;\n var len = array.length;\n var result = Array(len);\n for (var i = 0; i < len; i++) {\n result[i] = array[i];\n }\n result[idx] = newItem;\n return result;\n}\n\n// ===============================================\n// -- ### Collections (objects and arrays)\n// ===============================================\n// -- The following types are used throughout this section\n// -- ```js\n// -- type ArrayOrObject = Array|Object;\n// -- type Key = number|string;\n// -- ```\n\n// -- #### getIn()\n// -- Returns a value from an object at a given path. Works with\n// -- nested arrays and objects. If the path does not exist, it returns\n// -- `undefined`.\n// --\n// -- Usage: `getIn(obj: ?ArrayOrObject, path: Array): any`\n// --\n// -- ```js\n// -- obj = { a: 1, b: 2, d: { d1: 3, d2: 4 }, e: ['a', 'b', 'c'] }\n// -- getIn(obj, ['d', 'd1'])\n// -- // 3\n// -- getIn(obj, ['e', 1])\n// -- // 'b'\n// -- ```\nfunction getIn(obj, path) {\n !Array.isArray(path) && throwStr(process.env.NODE_ENV !== 'production' ? 'A path array should be provided when calling getIn()' : INVALID_ARGS);\n if (obj == null) return undefined;\n var ptr = obj;\n for (var i = 0; i < path.length; i++) {\n var key = path[i];\n ptr = ptr != null ? ptr[key] : undefined;\n if (ptr === undefined) return ptr;\n }\n return ptr;\n}\n\n// -- #### set()\n// -- Returns a new object with a modified attribute.\n// -- If the provided value is the same as (*referentially equal to*)\n// -- the previous value, the original object is returned.\n// --\n// -- Usage: `set(obj: ?T, key: Key, val: any): T`\n// --\n// -- ```js\n// -- obj = { a: 1, b: 2, c: 3 }\n// -- obj2 = set(obj, 'b', 5)\n// -- // { a: 1, b: 5, c: 3 }\n// -- obj2 === obj\n// -- // false\n// --\n// -- // The same object is returned if there are no changes:\n// -- set(obj, 'b', 2) === obj\n// -- // true\n// -- ```\nfunction set(obj, key, val) {\n var fallback = typeof key === 'number' ? [] : {};\n var finalObj = obj == null ? fallback : obj;\n if (finalObj[key] === val) return finalObj;\n var obj2 = clone(finalObj);\n obj2[key] = val;\n return obj2;\n}\n\n// -- #### setIn()\n// -- Returns a new object with a modified **nested** attribute.\n// --\n// -- Notes:\n// --\n// -- * If the provided value is the same as (*referentially equal to*)\n// -- the previous value, the original object is returned.\n// -- * If the path does not exist, it will be created before setting\n// -- the new value.\n// --\n// -- Usage: `setIn(obj: T, path: Array, val: any): T`\n// --\n// -- ```js\n// -- obj = { a: 1, b: 2, d: { d1: 3, d2: 4 }, e: { e1: 'foo', e2: 'bar' } }\n// -- obj2 = setIn(obj, ['d', 'd1'], 4)\n// -- // { a: 1, b: 2, d: { d1: 4, d2: 4 }, e: { e1: 'foo', e2: 'bar' } }\n// -- obj2 === obj\n// -- // false\n// -- obj2.d === obj.d\n// -- // false\n// -- obj2.e === obj.e\n// -- // true\n// --\n// -- // The same object is returned if there are no changes:\n// -- obj3 = setIn(obj, ['d', 'd1'], 3)\n// -- // { a: 1, b: 2, d: { d1: 3, d2: 4 }, e: { e1: 'foo', e2: 'bar' } }\n// -- obj3 === obj\n// -- // true\n// -- obj3.d === obj.d\n// -- // true\n// -- obj3.e === obj.e\n// -- // true\n// --\n// -- // ... unknown paths create intermediate keys. Numeric segments are treated as array indices:\n// -- setIn({ a: 3 }, ['unknown', 0, 'path'], 4)\n// -- // { a: 3, unknown: [{ path: 4 }] }\n// -- ```\nfunction doSetIn(obj, path, val, idx) {\n var newValue = void 0;\n var key = path[idx];\n if (idx === path.length - 1) {\n newValue = val;\n } else {\n var nestedObj = isObject(obj) && isObject(obj[key]) ? obj[key] : typeof path[idx + 1] === 'number' ? [] : {};\n newValue = doSetIn(nestedObj, path, val, idx + 1);\n }\n return set(obj, key, newValue);\n}\n\nfunction setIn(obj, path, val) {\n if (!path.length) return val;\n return doSetIn(obj, path, val, 0);\n}\n\n// -- #### update()\n// -- Returns a new object with a modified attribute,\n// -- calculated via a user-provided callback based on the current value.\n// -- If the calculated value is the same as (*referentially equal to*)\n// -- the previous value, the original object is returned.\n// --\n// -- Usage: `update(obj: T, key: Key,\n// -- fnUpdate: (prevValue: any) => any): T`\n// --\n// -- ```js\n// -- obj = { a: 1, b: 2, c: 3 }\n// -- obj2 = update(obj, 'b', (val) => val + 1)\n// -- // { a: 1, b: 3, c: 3 }\n// -- obj2 === obj\n// -- // false\n// --\n// -- // The same object is returned if there are no changes:\n// -- update(obj, 'b', (val) => val) === obj\n// -- // true\n// -- ```\nfunction update(obj, key, fnUpdate) {\n var prevVal = obj == null ? undefined : obj[key];\n var nextVal = fnUpdate(prevVal);\n return set(obj, key, nextVal);\n}\n\n// -- #### updateIn()\n// -- Returns a new object with a modified **nested** attribute,\n// -- calculated via a user-provided callback based on the current value.\n// -- If the calculated value is the same as (*referentially equal to*)\n// -- the previous value, the original object is returned.\n// --\n// -- Usage: `updateIn(obj: T, path: Array,\n// -- fnUpdate: (prevValue: any) => any): T`\n// --\n// -- ```js\n// -- obj = { a: 1, d: { d1: 3, d2: 4 } }\n// -- obj2 = updateIn(obj, ['d', 'd1'], (val) => val + 1)\n// -- // { a: 1, d: { d1: 4, d2: 4 } }\n// -- obj2 === obj\n// -- // false\n// --\n// -- // The same object is returned if there are no changes:\n// -- obj3 = updateIn(obj, ['d', 'd1'], (val) => val)\n// -- // { a: 1, d: { d1: 3, d2: 4 } }\n// -- obj3 === obj\n// -- // true\n// -- ```\nfunction updateIn(obj, path, fnUpdate) {\n var prevVal = getIn(obj, path);\n var nextVal = fnUpdate(prevVal);\n return setIn(obj, path, nextVal);\n}\n\n// -- #### merge()\n// -- Returns a new object built as follows: the overlapping keys from the\n// -- second one overwrite the corresponding entries from the first one.\n// -- Similar to `Object.assign()`, but immutable.\n// --\n// -- Usage:\n// --\n// -- * `merge(obj1: Object, obj2: ?Object): Object`\n// -- * `merge(obj1: Object, ...objects: Array): Object`\n// --\n// -- The unmodified `obj1` is returned if `obj2` does not *provide something\n// -- new to* `obj1`, i.e. if either of the following\n// -- conditions are true:\n// --\n// -- * `obj2` is `null` or `undefined`\n// -- * `obj2` is an object, but it is empty\n// -- * All attributes of `obj2` are `undefined`\n// -- * All attributes of `obj2` are referentially equal to the\n// -- corresponding attributes of `obj1`\n// --\n// -- Note that `undefined` attributes in `obj2` do not modify the\n// -- corresponding attributes in `obj1`.\n// --\n// -- ```js\n// -- obj1 = { a: 1, b: 2, c: 3 }\n// -- obj2 = { c: 4, d: 5 }\n// -- obj3 = merge(obj1, obj2)\n// -- // { a: 1, b: 2, c: 4, d: 5 }\n// -- obj3 === obj1\n// -- // false\n// --\n// -- // The same object is returned if there are no changes:\n// -- merge(obj1, { c: 3 }) === obj1\n// -- // true\n// -- ```\nfunction merge(a, b, c, d, e, f) {\n for (var _len2 = arguments.length, rest = Array(_len2 > 6 ? _len2 - 6 : 0), _key2 = 6; _key2 < _len2; _key2++) {\n rest[_key2 - 6] = arguments[_key2];\n }\n\n return rest.length ? doMerge.call.apply(doMerge, [null, false, false, a, b, c, d, e, f].concat(rest)) : doMerge(false, false, a, b, c, d, e, f);\n}\n\n// -- #### mergeDeep()\n// -- Returns a new object built as follows: the overlapping keys from the\n// -- second one overwrite the corresponding entries from the first one.\n// -- If both the first and second entries are objects they are merged recursively.\n// -- Similar to `Object.assign()`, but immutable, and deeply merging.\n// --\n// -- Usage:\n// --\n// -- * `mergeDeep(obj1: Object, obj2: ?Object): Object`\n// -- * `mergeDeep(obj1: Object, ...objects: Array): Object`\n// --\n// -- The unmodified `obj1` is returned if `obj2` does not *provide something\n// -- new to* `obj1`, i.e. if either of the following\n// -- conditions are true:\n// --\n// -- * `obj2` is `null` or `undefined`\n// -- * `obj2` is an object, but it is empty\n// -- * All attributes of `obj2` are `undefined`\n// -- * All attributes of `obj2` are referentially equal to the\n// -- corresponding attributes of `obj1`\n// --\n// -- Note that `undefined` attributes in `obj2` do not modify the\n// -- corresponding attributes in `obj1`.\n// --\n// -- ```js\n// -- obj1 = { a: 1, b: 2, c: { a: 1 } }\n// -- obj2 = { b: 3, c: { b: 2 } }\n// -- obj3 = mergeDeep(obj1, obj2)\n// -- // { a: 1, b: 3, c: { a: 1, b: 2 } }\n// -- obj3 === obj1\n// -- // false\n// --\n// -- // The same object is returned if there are no changes:\n// -- mergeDeep(obj1, { c: { a: 1 } }) === obj1\n// -- // true\n// -- ```\nfunction mergeDeep(a, b, c, d, e, f) {\n for (var _len3 = arguments.length, rest = Array(_len3 > 6 ? _len3 - 6 : 0), _key3 = 6; _key3 < _len3; _key3++) {\n rest[_key3 - 6] = arguments[_key3];\n }\n\n return rest.length ? doMerge.call.apply(doMerge, [null, false, true, a, b, c, d, e, f].concat(rest)) : doMerge(false, true, a, b, c, d, e, f);\n}\n\n// -- #### mergeIn()\n// -- Similar to `merge()`, but merging the value at a given nested path.\n// -- Note that the returned type is the same as that of the first argument.\n// --\n// -- Usage:\n// --\n// -- * `mergeIn(obj1: T, path: Array, obj2: ?Object): T`\n// -- * `mergeIn(obj1: T, path: Array,\n// -- ...objects: Array): T`\n// --\n// -- ```js\n// -- obj1 = { a: 1, d: { b: { d1: 3, d2: 4 } } }\n// -- obj2 = { d3: 5 }\n// -- obj3 = mergeIn(obj1, ['d', 'b'], obj2)\n// -- // { a: 1, d: { b: { d1: 3, d2: 4, d3: 5 } } }\n// -- obj3 === obj1\n// -- // false\n// --\n// -- // The same object is returned if there are no changes:\n// -- mergeIn(obj1, ['d', 'b'], { d2: 4 }) === obj1\n// -- // true\n// -- ```\nfunction mergeIn(a, path, b, c, d, e, f) {\n var prevVal = getIn(a, path);\n if (prevVal == null) prevVal = {};\n var nextVal = void 0;\n\n for (var _len4 = arguments.length, rest = Array(_len4 > 7 ? _len4 - 7 : 0), _key4 = 7; _key4 < _len4; _key4++) {\n rest[_key4 - 7] = arguments[_key4];\n }\n\n if (rest.length) {\n nextVal = doMerge.call.apply(doMerge, [null, false, false, prevVal, b, c, d, e, f].concat(rest));\n } else {\n nextVal = doMerge(false, false, prevVal, b, c, d, e, f);\n }\n return setIn(a, path, nextVal);\n}\n\n// -- #### omit()\n// -- Returns an object excluding one or several attributes.\n// --\n// -- Usage: `omit(obj: Object, attrs: Array|string): Object`\n//\n// -- ```js\n// -- obj = { a: 1, b: 2, c: 3, d: 4 }\n// -- omit(obj, 'a')\n// -- // { b: 2, c: 3, d: 4 }\n// -- omit(obj, ['b', 'c'])\n// -- // { a: 1, d: 4 }\n// --\n// -- // The same object is returned if there are no changes:\n// -- omit(obj, 'z') === obj1\n// -- // true\n// -- ```\nfunction omit(obj, attrs) {\n var omitList = Array.isArray(attrs) ? attrs : [attrs];\n var fDoSomething = false;\n for (var i = 0; i < omitList.length; i++) {\n if (hasOwnProperty.call(obj, omitList[i])) {\n fDoSomething = true;\n break;\n }\n }\n if (!fDoSomething) return obj;\n var out = {};\n var keys = getKeysAndSymbols(obj);\n for (var _i = 0; _i < keys.length; _i++) {\n var key = keys[_i];\n if (omitList.indexOf(key) >= 0) continue;\n out[key] = obj[key];\n }\n return out;\n}\n\n// -- #### addDefaults()\n// -- Returns a new object built as follows: `undefined` keys in the first one\n// -- are filled in with the corresponding values from the second one\n// -- (even if they are `null`).\n// --\n// -- Usage:\n// --\n// -- * `addDefaults(obj: Object, defaults: Object): Object`\n// -- * `addDefaults(obj: Object, ...defaultObjects: Array): Object`\n// --\n// -- ```js\n// -- obj1 = { a: 1, b: 2, c: 3 }\n// -- obj2 = { c: 4, d: 5, e: null }\n// -- obj3 = addDefaults(obj1, obj2)\n// -- // { a: 1, b: 2, c: 3, d: 5, e: null }\n// -- obj3 === obj1\n// -- // false\n// --\n// -- // The same object is returned if there are no changes:\n// -- addDefaults(obj1, { c: 4 }) === obj1\n// -- // true\n// -- ```\nfunction addDefaults(a, b, c, d, e, f) {\n for (var _len5 = arguments.length, rest = Array(_len5 > 6 ? _len5 - 6 : 0), _key5 = 6; _key5 < _len5; _key5++) {\n rest[_key5 - 6] = arguments[_key5];\n }\n\n return rest.length ? doMerge.call.apply(doMerge, [null, true, false, a, b, c, d, e, f].concat(rest)) : doMerge(true, false, a, b, c, d, e, f);\n}\n\n// ===============================================\n// ### Public API\n// ===============================================\nvar timm = {\n clone: clone,\n addLast: addLast,\n addFirst: addFirst,\n removeLast: removeLast,\n removeFirst: removeFirst,\n insert: insert,\n removeAt: removeAt,\n replaceAt: replaceAt,\n\n getIn: getIn,\n // eslint-disable-next-line object-shorthand\n set: set, // so that flow doesn't complain\n setIn: setIn,\n update: update,\n updateIn: updateIn,\n merge: merge,\n mergeDeep: mergeDeep,\n mergeIn: mergeIn,\n omit: omit,\n addDefaults: addDefaults\n};\n\nexports.default = timm;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AnsiStringType = exports.StringType = exports.BufferType = exports.Uint8ArrayType = exports.IgnoreType = exports.Float80_LE = exports.Float80_BE = exports.Float64_LE = exports.Float64_BE = exports.Float32_LE = exports.Float32_BE = exports.Float16_LE = exports.Float16_BE = exports.INT64_BE = exports.UINT64_BE = exports.INT64_LE = exports.UINT64_LE = exports.INT32_LE = exports.INT32_BE = exports.INT24_BE = exports.INT24_LE = exports.INT16_LE = exports.INT16_BE = exports.INT8 = exports.UINT32_BE = exports.UINT32_LE = exports.UINT24_BE = exports.UINT24_LE = exports.UINT16_BE = exports.UINT16_LE = exports.UINT8 = void 0;\nconst ieee754 = require(\"ieee754\");\n// Primitive types\nfunction dv(array) {\n return new DataView(array.buffer, array.byteOffset);\n}\n/**\n * 8-bit unsigned integer\n */\nexports.UINT8 = {\n len: 1,\n get(array, offset) {\n return dv(array).getUint8(offset);\n },\n put(array, offset, value) {\n dv(array).setUint8(offset, value);\n return offset + 1;\n }\n};\n/**\n * 16-bit unsigned integer, Little Endian byte order\n */\nexports.UINT16_LE = {\n len: 2,\n get(array, offset) {\n return dv(array).getUint16(offset, true);\n },\n put(array, offset, value) {\n dv(array).setUint16(offset, value, true);\n return offset + 2;\n }\n};\n/**\n * 16-bit unsigned integer, Big Endian byte order\n */\nexports.UINT16_BE = {\n len: 2,\n get(array, offset) {\n return dv(array).getUint16(offset);\n },\n put(array, offset, value) {\n dv(array).setUint16(offset, value);\n return offset + 2;\n }\n};\n/**\n * 24-bit unsigned integer, Little Endian byte order\n */\nexports.UINT24_LE = {\n len: 3,\n get(array, offset) {\n const dataView = dv(array);\n return dataView.getUint8(offset) + (dataView.getUint16(offset + 1, true) << 8);\n },\n put(array, offset, value) {\n const dataView = dv(array);\n dataView.setUint8(offset, value & 0xff);\n dataView.setUint16(offset + 1, value >> 8, true);\n return offset + 3;\n }\n};\n/**\n * 24-bit unsigned integer, Big Endian byte order\n */\nexports.UINT24_BE = {\n len: 3,\n get(array, offset) {\n const dataView = dv(array);\n return (dataView.getUint16(offset) << 8) + dataView.getUint8(offset + 2);\n },\n put(array, offset, value) {\n const dataView = dv(array);\n dataView.setUint16(offset, value >> 8);\n dataView.setUint8(offset + 2, value & 0xff);\n return offset + 3;\n }\n};\n/**\n * 32-bit unsigned integer, Little Endian byte order\n */\nexports.UINT32_LE = {\n len: 4,\n get(array, offset) {\n return dv(array).getUint32(offset, true);\n },\n put(array, offset, value) {\n dv(array).setUint32(offset, value, true);\n return offset + 4;\n }\n};\n/**\n * 32-bit unsigned integer, Big Endian byte order\n */\nexports.UINT32_BE = {\n len: 4,\n get(array, offset) {\n return dv(array).getUint32(offset);\n },\n put(array, offset, value) {\n dv(array).setUint32(offset, value);\n return offset + 4;\n }\n};\n/**\n * 8-bit signed integer\n */\nexports.INT8 = {\n len: 1,\n get(array, offset) {\n return dv(array).getInt8(offset);\n },\n put(array, offset, value) {\n dv(array).setInt8(offset, value);\n return offset + 1;\n }\n};\n/**\n * 16-bit signed integer, Big Endian byte order\n */\nexports.INT16_BE = {\n len: 2,\n get(array, offset) {\n return dv(array).getInt16(offset);\n },\n put(array, offset, value) {\n dv(array).setInt16(offset, value);\n return offset + 2;\n }\n};\n/**\n * 16-bit signed integer, Little Endian byte order\n */\nexports.INT16_LE = {\n len: 2,\n get(array, offset) {\n return dv(array).getInt16(offset, true);\n },\n put(array, offset, value) {\n dv(array).setInt16(offset, value, true);\n return offset + 2;\n }\n};\n/**\n * 24-bit signed integer, Little Endian byte order\n */\nexports.INT24_LE = {\n len: 3,\n get(array, offset) {\n const unsigned = exports.UINT24_LE.get(array, offset);\n return unsigned > 0x7fffff ? unsigned - 0x1000000 : unsigned;\n },\n put(array, offset, value) {\n const dataView = dv(array);\n dataView.setUint8(offset, value & 0xff);\n dataView.setUint16(offset + 1, value >> 8, true);\n return offset + 3;\n }\n};\n/**\n * 24-bit signed integer, Big Endian byte order\n */\nexports.INT24_BE = {\n len: 3,\n get(array, offset) {\n const unsigned = exports.UINT24_BE.get(array, offset);\n return unsigned > 0x7fffff ? unsigned - 0x1000000 : unsigned;\n },\n put(array, offset, value) {\n const dataView = dv(array);\n dataView.setUint16(offset, value >> 8);\n dataView.setUint8(offset + 2, value & 0xff);\n return offset + 3;\n }\n};\n/**\n * 32-bit signed integer, Big Endian byte order\n */\nexports.INT32_BE = {\n len: 4,\n get(array, offset) {\n return dv(array).getInt32(offset);\n },\n put(array, offset, value) {\n dv(array).setInt32(offset, value);\n return offset + 4;\n }\n};\n/**\n * 32-bit signed integer, Big Endian byte order\n */\nexports.INT32_LE = {\n len: 4,\n get(array, offset) {\n return dv(array).getInt32(offset, true);\n },\n put(array, offset, value) {\n dv(array).setInt32(offset, value, true);\n return offset + 4;\n }\n};\n/**\n * 64-bit unsigned integer, Little Endian byte order\n */\nexports.UINT64_LE = {\n len: 8,\n get(array, offset) {\n return dv(array).getBigUint64(offset, true);\n },\n put(array, offset, value) {\n dv(array).setBigUint64(offset, value, true);\n return offset + 8;\n }\n};\n/**\n * 64-bit signed integer, Little Endian byte order\n */\nexports.INT64_LE = {\n len: 8,\n get(array, offset) {\n return dv(array).getBigInt64(offset, true);\n },\n put(array, offset, value) {\n dv(array).setBigInt64(offset, value, true);\n return offset + 8;\n }\n};\n/**\n * 64-bit unsigned integer, Big Endian byte order\n */\nexports.UINT64_BE = {\n len: 8,\n get(array, offset) {\n return dv(array).getBigUint64(offset);\n },\n put(array, offset, value) {\n dv(array).setBigUint64(offset, value);\n return offset + 8;\n }\n};\n/**\n * 64-bit signed integer, Big Endian byte order\n */\nexports.INT64_BE = {\n len: 8,\n get(array, offset) {\n return dv(array).getBigInt64(offset);\n },\n put(array, offset, value) {\n dv(array).setBigInt64(offset, value);\n return offset + 8;\n }\n};\n/**\n * IEEE 754 16-bit (half precision) float, big endian\n */\nexports.Float16_BE = {\n len: 2,\n get(dataView, offset) {\n return ieee754.read(dataView, offset, false, 10, this.len);\n },\n put(dataView, offset, value) {\n ieee754.write(dataView, value, offset, false, 10, this.len);\n return offset + this.len;\n }\n};\n/**\n * IEEE 754 16-bit (half precision) float, little endian\n */\nexports.Float16_LE = {\n len: 2,\n get(array, offset) {\n return ieee754.read(array, offset, true, 10, this.len);\n },\n put(array, offset, value) {\n ieee754.write(array, value, offset, true, 10, this.len);\n return offset + this.len;\n }\n};\n/**\n * IEEE 754 32-bit (single precision) float, big endian\n */\nexports.Float32_BE = {\n len: 4,\n get(array, offset) {\n return dv(array).getFloat32(offset);\n },\n put(array, offset, value) {\n dv(array).setFloat32(offset, value);\n return offset + 4;\n }\n};\n/**\n * IEEE 754 32-bit (single precision) float, little endian\n */\nexports.Float32_LE = {\n len: 4,\n get(array, offset) {\n return dv(array).getFloat32(offset, true);\n },\n put(array, offset, value) {\n dv(array).setFloat32(offset, value, true);\n return offset + 4;\n }\n};\n/**\n * IEEE 754 64-bit (double precision) float, big endian\n */\nexports.Float64_BE = {\n len: 8,\n get(array, offset) {\n return dv(array).getFloat64(offset);\n },\n put(array, offset, value) {\n dv(array).setFloat64(offset, value);\n return offset + 8;\n }\n};\n/**\n * IEEE 754 64-bit (double precision) float, little endian\n */\nexports.Float64_LE = {\n len: 8,\n get(array, offset) {\n return dv(array).getFloat64(offset, true);\n },\n put(array, offset, value) {\n dv(array).setFloat64(offset, value, true);\n return offset + 8;\n }\n};\n/**\n * IEEE 754 80-bit (extended precision) float, big endian\n */\nexports.Float80_BE = {\n len: 10,\n get(array, offset) {\n return ieee754.read(array, offset, false, 63, this.len);\n },\n put(array, offset, value) {\n ieee754.write(array, value, offset, false, 63, this.len);\n return offset + this.len;\n }\n};\n/**\n * IEEE 754 80-bit (extended precision) float, little endian\n */\nexports.Float80_LE = {\n len: 10,\n get(array, offset) {\n return ieee754.read(array, offset, true, 63, this.len);\n },\n put(array, offset, value) {\n ieee754.write(array, value, offset, true, 63, this.len);\n return offset + this.len;\n }\n};\n/**\n * Ignore a given number of bytes\n */\nclass IgnoreType {\n /**\n * @param len number of bytes to ignore\n */\n constructor(len) {\n this.len = len;\n }\n // ToDo: don't read, but skip data\n get(array, off) {\n }\n}\nexports.IgnoreType = IgnoreType;\nclass Uint8ArrayType {\n constructor(len) {\n this.len = len;\n }\n get(array, offset) {\n return array.subarray(offset, offset + this.len);\n }\n}\nexports.Uint8ArrayType = Uint8ArrayType;\nclass BufferType {\n constructor(len) {\n this.len = len;\n }\n get(uint8Array, off) {\n return Buffer.from(uint8Array.subarray(off, off + this.len));\n }\n}\nexports.BufferType = BufferType;\n/**\n * Consume a fixed number of bytes from the stream and return a string with a specified encoding.\n */\nclass StringType {\n constructor(len, encoding) {\n this.len = len;\n this.encoding = encoding;\n }\n get(uint8Array, offset) {\n return Buffer.from(uint8Array).toString(this.encoding, offset, offset + this.len);\n }\n}\nexports.StringType = StringType;\n/**\n * ANSI Latin 1 String\n * Using windows-1252 / ISO 8859-1 decoding\n */\nclass AnsiStringType {\n constructor(len) {\n this.len = len;\n }\n static decode(buffer, offset, until) {\n let str = '';\n for (let i = offset; i < until; ++i) {\n str += AnsiStringType.codePointToString(AnsiStringType.singleByteDecoder(buffer[i]));\n }\n return str;\n }\n static inRange(a, min, max) {\n return min <= a && a <= max;\n }\n static codePointToString(cp) {\n if (cp <= 0xFFFF) {\n return String.fromCharCode(cp);\n }\n else {\n cp -= 0x10000;\n return String.fromCharCode((cp >> 10) + 0xD800, (cp & 0x3FF) + 0xDC00);\n }\n }\n static singleByteDecoder(bite) {\n if (AnsiStringType.inRange(bite, 0x00, 0x7F)) {\n return bite;\n }\n const codePoint = AnsiStringType.windows1252[bite - 0x80];\n if (codePoint === null) {\n throw Error('invaliding encoding');\n }\n return codePoint;\n }\n get(buffer, offset = 0) {\n return AnsiStringType.decode(buffer, offset, offset + this.len);\n }\n}\nexports.AnsiStringType = AnsiStringType;\nAnsiStringType.windows1252 = [8364, 129, 8218, 402, 8222, 8230, 8224, 8225, 710, 8240, 352,\n 8249, 338, 141, 381, 143, 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 732,\n 8482, 353, 8250, 339, 157, 382, 376, 160, 161, 162, 163, 164, 165, 166, 167, 168,\n 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184,\n 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,\n 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216,\n 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232,\n 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247,\n 248, 249, 250, 251, 252, 253, 254, 255];\n","\nexports = module.exports = trim;\n\nfunction trim(str){\n return str.replace(/^\\s*|\\s*$/g, '');\n}\n\nexports.left = function(str){\n return str.replace(/^\\s*/, '');\n};\n\nexports.right = function(str){\n return str.replace(/\\s*$/, '');\n};\n","\r\n\r\n\r\n\r\n;(function(){\r\n\tvar UTIF = {};\r\n\t\r\n\t// Make available for import by `require()`\r\n\tif (typeof module == \"object\") {module.exports = UTIF;}\r\n\telse {self.UTIF = UTIF;}\r\n\t\r\n\tvar pako = (typeof require === \"function\") ? require(\"pako\") : self.pako;\r\n\t\r\n\tfunction log() { if (typeof process==\"undefined\" || process.env.NODE_ENV==\"development\") console.log.apply(console, arguments); }\r\n\t\r\n\t(function(UTIF, pako){\r\n\t\t\r\n\t// Following lines add a JPEG decoder to UTIF.JpegDecoder\r\n\t(function(){\"use strict\";var W=function a1(){function W(p){this.message=\"JPEG error: \"+p}W.prototype=new Error;W.prototype.name=\"JpegError\";W.constructor=W;return W}(),ak=function ag(){var p=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),t=4017,ac=799,ah=3406,ao=2276,ar=1567,ai=3784,s=5793,ad=2896;function ak(Q){if(Q==null)Q={};if(Q.w==null)Q.w=-1;this.V=Q.n;this.N=Q.w}function a5(Q,h){var f=0,G=[],n,E,a=16,F;while(a>0&&!Q[a-1]){a--}G.push({children:[],index:0});var C=G[0];for(n=0;n0){C=G.pop()}C.index++;G.push(C);while(G.length<=n){G.push(F={children:[],index:0});C.children[C.index]=F.children;C=F}f++}if(n+10){V--;return J>>V&1}J=Q[h++];if(J===255){var I=Q[h++];if(I){if(I===220&&d){h+=2;var l=Z(Q,h);h+=2;if(l>0&&l!==f.s){throw new DNLMarkerError(\"Found DNL marker (0xFFDC) while parsing scan data\",l)}}else if(I===217){if(d){var M=q*8;\r\n\tif(M>0&&M>>7}function u(I){var l=I;while(!0){l=l[Y()];switch(typeof l){case\"number\":return l;case\"object\":continue}throw new W(\"invalid huffman sequence\")}}function m(I){var e=0;while(I>0){e=e<<1|Y();I--}return e}function j(I){if(I===1){return Y()===1?1:-1}var e=m(I);if(e>=1<>4;if(i===0){if(A<15){break}N+=16;continue}N+=A;var o=p[N];X.D[I+o]=j(i);N++}}function $(X,I){var l=u(X.J),M=l===0?0:j(l)<0){r--;return}var N=E,l=a;while(N<=l){var M=u(X.i),S=M&15,i=M>>4;if(S===0){if(i<15){r=m(i)+(1<>4;if(S===0){if(M<15){r=m(M)+(1<0){for(O=0;O0?\"unexpected\":\"excessive\";h=k.offset}if(k.M>=65488&&k.M<=65495){h+=2}else{break}}return h-z}function al(Q,h,f){var G=Q.$,n=Q.D,E,a,C,F,d,T,U,z,J,V,Y,u,m,j,v,$,b;if(!G){throw new W(\"missing required Quantization Table.\")}for(var r=0;r<64;r+=8){J=n[h+r];V=n[h+r+1];Y=n[h+r+2];u=n[h+r+3];m=n[h+r+4];j=n[h+r+5];v=n[h+r+6];$=n[h+r+7];J*=G[r];if((V|Y|u|m|j|v|$)===0){b=s*J+512>>10;f[r]=b;f[r+1]=b;f[r+2]=b;f[r+3]=b;f[r+4]=b;f[r+5]=b;f[r+6]=b;f[r+7]=b;continue}V*=G[r+1];Y*=G[r+2];u*=G[r+3];m*=G[r+4];j*=G[r+5];v*=G[r+6];$*=G[r+7];E=s*J+128>>8;a=s*m+128>>8;C=Y;F=v;d=ad*(V-$)+128>>8;z=ad*(V+$)+128>>8;\r\n\tT=u<<4;U=j<<4;E=E+a+1>>1;a=E-a;b=C*ai+F*ar+128>>8;C=C*ar-F*ai+128>>8;F=b;d=d+U+1>>1;U=d-U;z=z+T+1>>1;T=z-T;E=E+F+1>>1;F=E-F;a=a+C+1>>1;C=a-C;b=d*ao+z*ah+2048>>12;d=d*ah-z*ao+2048>>12;z=b;b=T*ac+U*t+2048>>12;T=T*t-U*ac+2048>>12;U=b;f[r]=E+z;f[r+7]=E-z;f[r+1]=a+U;f[r+6]=a-U;f[r+2]=C+T;f[r+5]=C-T;f[r+3]=F+d;f[r+4]=F-d}for(var P=0;P<8;++P){J=f[P];V=f[P+8];Y=f[P+16];u=f[P+24];m=f[P+32];j=f[P+40];v=f[P+48];$=f[P+56];if((V|Y|u|m|j|v|$)===0){b=s*J+8192>>14;if(b<-2040){b=0}else if(b>=2024){b=255}else{b=b+2056>>4}n[h+P]=b;n[h+P+8]=b;n[h+P+16]=b;n[h+P+24]=b;n[h+P+32]=b;n[h+P+40]=b;n[h+P+48]=b;n[h+P+56]=b;continue}E=s*J+2048>>12;a=s*m+2048>>12;C=Y;F=v;d=ad*(V-$)+2048>>12;z=ad*(V+$)+2048>>12;T=u;U=j;E=(E+a+1>>1)+4112;a=E-a;b=C*ai+F*ar+2048>>12;C=C*ar-F*ai+2048>>12;F=b;d=d+U+1>>1;U=d-U;z=z+T+1>>1;T=z-T;E=E+F+1>>1;F=E-F;a=a+C+1>>1;C=a-C;b=d*ao+z*ah+2048>>12;d=d*ah-z*ao+2048>>12;z=b;\r\n\tb=T*ac+U*t+2048>>12;T=T*t-U*ac+2048>>12;U=b;J=E+z;$=E-z;V=a+U;v=a-U;Y=C+T;j=C-T;u=F+d;m=F-d;if(J<16){J=0}else if(J>=4080){J=255}else{J>>=4}if(V<16){V=0}else if(V>=4080){V=255}else{V>>=4}if(Y<16){Y=0}else if(Y>=4080){Y=255}else{Y>>=4}if(u<16){u=0}else if(u>=4080){u=255}else{u>>=4}if(m<16){m=0}else if(m>=4080){m=255}else{m>>=4}if(j<16){j=0}else if(j>=4080){j=255}else{j>>=4}if(v<16){v=0}else if(v>=4080){v=255}else{v>>=4}if($<16){$=0}else if($>=4080){$=255}else{$>>=4}n[h+P]=J;\r\n\tn[h+P+8]=V;n[h+P+16]=Y;n[h+P+24]=u;n[h+P+32]=m;n[h+P+40]=j;n[h+P+48]=v;n[h+P+56]=$}}function a0(Q,h){var f=h.P,G=h.c,n=new Int16Array(64);for(var E=0;E=G){return null}var E=Z(Q,h);if(E>=65472&&E<=65534){return{u:null,M:E,offset:h}}var a=Z(Q,n);while(!(a>=65472&&a<=65534)){if(++n>=G){return null}a=Z(Q,n)}return{u:E.toString(16),M:a,offset:n}}ak.prototype={parse(Q,h){if(h==null)h={};\r\n\tvar f=h.F,E=0,a=null,C=null,F,d,T=0;function G(){var o=Z(Q,E);E+=2;var B=E+o-2,V=an(Q,B,E);if(V&&V.u){B=V.offset}var ab=Q.subarray(E,B);E+=ab.length;return ab}function n(F){var o=Math.ceil(F.o/8/F.X),B=Math.ceil(F.s/8/F.B);for(var Y=0;Y>4===0){for(u=0;u<64;u++){b=p[u];P[b]=Q[E++]}}else if(r>>4===1){for(u=0;u<64;u++){b=p[u];P[b]=Z(Q,E);E+=2}}else{throw new W(\"DQT - invalid table spec\")}U[r&15]=P}break;case 65472:case 65473:case 65474:if(F){throw new W(\"Only single frame JPEGs supported\")}E+=2;F={};F.G=V===65473;F.Z=V===65474;F.precision=Q[E++];var D=Z(Q,E),a4,q=0,H=0;E+=2;F.s=f||D;F.o=Z(Q,E);E+=2;F.W=[];F._={};var a8=Q[E++];for(Y=0;Y>4,y=Q[E+1]&15;if(q>4===0?J:z)[_&15]=a5(N,K)}break;case 65501:E+=2;d=Z(Q,E);E+=2;break;case 65498:var x=++T===1&&!f,R;E+=2;var k=Q[E++],g=[];for(Y=0;Y>4];R.i=z[a6&15];g.push(R)}var I=Q[E++],l=Q[E++],M=Q[E++];try{var S=a7(Q,E,F,g,d,I,l,M>>4,M&15,x);E+=S}catch(ex){if(ex instanceof DNLMarkerError){return this.parse(Q,{F:ex.s})}else if(ex instanceof EOIMarkerError){break markerLoop}throw ex}break;case 65500:E+=4;break;case 65535:if(Q[E]!==255){E--}break;default:var i=an(Q,E-2,E-3);if(i&&i.u){E=i.offset;break}if(E>=Q.length-1){break markerLoop}throw new W(\"JpegImage.parse - unknown marker: \"+V.toString(16))}V=Z(Q,E);E+=2}this.width=F.o;this.height=F.s;this.g=a;this.b=C;this.W=[];for(Y=0;Y>8)+P[J+1]}}}return v},get f(){if(this.b){return!!this.b.a}if(this.p===3){if(this.N===0){return!1}else if(this.W[0].index===82&&this.W[1].index===71&&this.W[2].index===66){return!1}return!0}if(this.N===1){return!0}return!1},z:function aj(Q){var h,f,G;\r\n\tfor(var n=0,E=Q.length;n4){throw new W(\"Unsupported color mode\")}var E=this.Y(h,f,n);if(this.p===1&&G){var a=E.length,C=new Uint8ClampedArray(a*3),F=0;for(var d=0;d>24}function Z(p,t){return p[t]<<8|p[t+1]}function am(p,t){return(p[t]<<24|p[t+1]<<16|p[t+2]<<8|p[t+3])>>>0}UTIF.JpegDecoder=ak}());\r\n\t\r\n\t//UTIF.JpegDecoder = PDFJS.JpegImage;\r\n\t\r\n\t\r\n\tUTIF.encodeImage = function(rgba, w, h, metadata)\r\n\t{\r\n\t\tvar idf = { \"t256\":[w], \"t257\":[h], \"t258\":[8,8,8,8], \"t259\":[1], \"t262\":[2], \"t273\":[1000], // strips offset\r\n\t\t\t\t\t\"t277\":[4], \"t278\":[h], /* rows per strip */ \"t279\":[w*h*4], // strip byte counts\r\n\t\t\t\t\t\"t282\":[[72,1]], \"t283\":[[72,1]], \"t284\":[1], \"t286\":[[0,1]], \"t287\":[[0,1]], \"t296\":[1], \"t305\": [\"Photopea (UTIF.js)\"], \"t338\":[1]\r\n\t\t\t};\r\n\t\tif (metadata) for (var i in metadata) idf[i] = metadata[i];\r\n\t\t\r\n\t\tvar prfx = new Uint8Array(UTIF.encode([idf]));\r\n\t\tvar img = new Uint8Array(rgba);\r\n\t\tvar data = new Uint8Array(1000+w*h*4);\r\n\t\tfor(var i=0; i probably not an image\r\n\t\timg.isLE = id==\"II\";\r\n\t\timg.width = img[\"t256\"][0]; //delete img[\"t256\"];\r\n\t\timg.height = img[\"t257\"][0]; //delete img[\"t257\"];\r\n\t\r\n\t\tvar cmpr = img[\"t259\"] ? img[\"t259\"][0] : 1; //delete img[\"t259\"];\r\n\t\tvar fo = img[\"t266\"] ? img[\"t266\"][0] : 1; //delete img[\"t266\"];\r\n\t\tif(img[\"t284\"] && img[\"t284\"][0]==2) log(\"PlanarConfiguration 2 should not be used!\");\r\n\t\tif(cmpr==7 && img[\"t258\"] && img[\"t258\"].length>3) img[\"t258\"]=img[\"t258\"].slice(0,3);\r\n\t\r\n\t\tvar bipp; // bits per pixel\r\n\t\tif(img[\"t258\"]) bipp = Math.min(32,img[\"t258\"][0])*img[\"t258\"].length;\r\n\t\telse bipp = (img[\"t277\"]?img[\"t277\"][0]:1); \r\n\t\t// Some .NEF files have t258==14, even though they use 16 bits per pixel\r\n\t\tif(cmpr==1 && img[\"t279\"]!=null && img[\"t278\"] && img[\"t262\"][0]==32803) {\r\n\t\t\tbipp = Math.round((img[\"t279\"][0]*8)/(img.width*img[\"t278\"][0]));\r\n\t\t}\r\n\t\tif(img[\"t50885\"] && img[\"t50885\"][0]==4) bipp = img[\"t258\"][0]*3; // RAW_CANON_40D_SRAW_V103.CR2\r\n\t\tvar bipl = Math.ceil(img.width*bipp/8)*8;\r\n\t\tvar soff = img[\"t273\"]; if(soff==null || img[\"t322\"]) soff = img[\"t324\"];\r\n\t\tvar bcnt = img[\"t279\"]; if(cmpr==1 && soff.length==1) bcnt = [img.height*(bipl>>>3)]; if(bcnt==null || img[\"t322\"]) bcnt = img[\"t325\"];\r\n\t\t//bcnt[0] = Math.min(bcnt[0], data.length); // Hasselblad, \"RAW_HASSELBLAD_H3D39II.3FR\"\r\n\t\tvar bytes = new Uint8Array(img.height*(bipl>>>3)), bilen = 0;\r\n\t\r\n\t\tif(img[\"t322\"]!=null) // tiled\r\n\t\t{\r\n\t\t\tvar tw = img[\"t322\"][0], th = img[\"t323\"][0];\r\n\t\t\tvar tx = Math.floor((img.width + tw - 1) / tw);\r\n\t\t\tvar ty = Math.floor((img.height + th - 1) / th);\r\n\t\t\tvar tbuff = new Uint8Array(Math.ceil(tw*th*bipp/8)|0);\r\n\t\t\tconsole.log(\"====\", tx,ty);\r\n\t\t\tfor(var y=0; y>>3, h = (img[\"t278\"] ? img[\"t278\"][0] : img.height), bpl = Math.ceil(bps*noc*img.width/8);\r\n\t\t\r\n\t\t// convert to Little Endian /*\r\n\t\tif(bps==16 && !img.isLE && img[\"t33422\"]==null) // not DNG\r\n\t\t\tfor(var y=0; y>>8)&255; \r\n\t\t\t\t}\r\n\t\t\t\telse if(noc==3) for(var j= 3; j>>3]>>>7-(P&7)&1;B[1]++;return D}function aj(B,P){if(x==null){x={};\r\n\tfor(var D=0;D>>1}return B}function c(B,P){return B>>P}function N(B,P,D,U,X,y){P[D]=c(c(11*B[X]-4*B[X+y]+B[X+y+y]+4,3)+B[U],1);\r\n\tP[D+y]=c(c(5*B[X]+4*B[X+y]-B[X+y+y]+4,3)-B[U],1)}function g(B,P,D,U,X,y){var n=B[X-y]-B[X+y],S=B[X],O=B[U];\r\n\tP[D]=c(c(n+4,3)+S+O,1);P[D+y]=c(c(-n+4,3)+S-O,1)}function L(B,P,D,U,X,y){P[D]=c(c(5*B[X]+4*B[X-y]-B[X-y-y]+4,3)+B[U],1);\r\n\tP[D+y]=c(c(11*B[X]-4*B[X-y]+B[X-y-y]+4,3)-B[U],1)}function t(B){B=B<0?0:B>4095?4095:B;B=H[B]>>>2;return B}function ab(B,P,D,U,X){U=new Uint16Array(U.buffer);\r\n\tvar y=Date.now(),n=UTIF._binBE,S=P+D,O,q,i,M,m,aA,T,a8,a0,am,au,a3,aw,ao,v,ax,p,k;P+=4;while(P>>1)*(i>>>1));k=new Int16Array((q>>>1)*(i>>>1));u=new Int16Array(1024);\r\n\tfor(var f=0;f<1024;f++){var aF=f-512,j=Math.abs(aF),O=Math.floor(768*j*j*j/(255*255*255))+j;u[f]=Math.sign(aF)*O}H=new Uint16Array(4096);\r\n\tvar al=(1<<16)-1;for(var f=0;f<4096;f++){var ad=f,az=al*(Math.pow(113,ad/4095)-1)/112;H[f]=Math.min(az,al)}}var Z=p[T],V=Q(q,1+d[M]),z=Q(i,1+d[M]);\r\n\tif(M==0){for(var b=0;b>>1)+G]=B[w]<<8|B[w+1]}}else{var aC=[B,P*8],aq=[],a5=0,ae=V*z,I=[0,0],s=0,E=0;\r\n\twhile(a50){aq[a5++]=E;s--}}var $=(M-1)%3,aE=$!=1?V:0,as=$!=0?z:0;\r\n\tfor(var b=0;b>>1)+aE,aa=b*V;for(var G=0;G>>1,an=V*2,at=z*2;\r\n\tfor(var b=0;b>14-r*2&3;var af=a6[aD];if(af!=0)for(var b=0;b>>1)*(q>>>1)+(G>>>1),R=a2[w],ak=ar[w]-2048,aB=ah[w]-2048,av=a1[w]-2048,a4=(ak<<1)+R,a9=(aB<<1)+R,ap=R+av,ag=R-av;\r\n\tU[J]=t(a4);U[J+1]=t(ap);U[J+q]=t(ag);U[J+q+1]=t(a9)}}P+=o*4}else if(C==16388){P+=o*4}else if(F==8192||F==8448||F==9216){}else throw C.toString(16)}}console.log(Date.now()-y)}return ab}()\r\n\t\r\n\tUTIF.decode._decodeLogLuv32 = function(img, data, off, len, tgt, toff) {\r\n\t\tvar w = img.width, qw=w*4;\r\n\t\tvar io = 0, out = new Uint8Array(qw);\r\n\t\t\r\n\t\twhile(io>> (tab[i] >>> 8);\r\n\t\t\t\tfor(var c=0; c>>4); tgt[toff+i+1]=(b0<<4)|(b2>>>4); tgt[toff+i+2]=(b2<<4)|(b1>>>4); }\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\tvar pix = new Uint16Array(16);\r\n\t\tvar row, col, val, max, min, imax, imin, sh, bit, i, dp;\r\n\t\t\r\n\t\tvar data = new Uint8Array(raw_width+1);\r\n\t\tfor (row=0; row < height; row++) {\r\n\t\t\t//fread (data, 1, raw_width, ifp);\r\n\t\t\tfor(var j=0; j>> 11);\r\n\t\t\t\timax = 0x0f & (val >>> 22);\r\n\t\t\t\timin = 0x0f & (val >>> 26);\r\n\t\t\t\tfor (sh=0; sh < 4 && 0x80 << sh <= max-min; sh++);\r\n\t\t\t\tfor (bit=30, i=0; i < 16; i++)\r\n\t\t\t\t\tif (i == imax) pix[i] = max;\r\n\t\t\t\t\telse if (i == imin) pix[i] = min;\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tpix[i] = ((bin.readUshort(data, dp+(bit >> 3)) >>> (bit & 7) & 0x7f) << sh) + min;\r\n\t\t\t\t\t\tif (pix[i] > 0x7ff) pix[i] = 0x7ff;\r\n\t\t\t\t\t\tbit += 7;\r\n\t\t\t\t\t}\r\n\t\t\t\tfor (i=0; i < 16; i++, col+=2) {\r\n\t\t\t\t\t//RAW(row,col) = curve[pix[i] << 1] >> 2;\r\n\t\t\t\t\tvar clr = pix[i]<<1; //clr = 0xffff;\r\n\t\t\t\t\tUTIF.decode._putsF(tgt, (row*raw_width+col)*tiff_bps, clr<<(16-tiff_bps));\r\n\t\t\t\t}\r\n\t\t\t\tcol -= col & 1 ? 1:31;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tUTIF.decode._decodeNikon = function(img,imgs, data, off, src_length, tgt, toff)\r\n\t{\r\n\t\tvar nikon_tree = [\r\n\t [ 0, 0,1,5,1,1,1,1,1,1,2,0,0,0,0,0,0,\t/* 12-bit lossy */\r\n\t\t5,4,3,6,2,7,1,0,8,9,11,10,12 ],\r\n\t [ 0, 0,1,5,1,1,1,1,1,1,2,0,0,0,0,0,0,\t/* 12-bit lossy after split */\r\n\t\t0x39,0x5a,0x38,0x27,0x16,5,4,3,2,1,0,11,12,12 ],\r\n\t [ 0, 0,1,4,2,3,1,2,0,0,0,0,0,0,0,0,0, /* 12-bit lossless */\r\n\t\t5,4,6,3,7,2,8,1,9,0,10,11,12 ],\r\n\t [ 0, 0,1,4,3,1,1,1,1,1,2,0,0,0,0,0,0,\t/* 14-bit lossy */\r\n\t\t5,6,4,7,8,3,9,2,1,0,10,11,12,13,14 ],\r\n\t [ 0, 0,1,5,1,1,1,1,1,1,1,2,0,0,0,0,0,\t/* 14-bit lossy after split */\r\n\t\t8,0x5c,0x4b,0x3a,0x29,7,6,5,4,3,2,1,0,13,14 ],\r\n\t [ 0, 0,1,4,2,2,3,1,2,0,0,0,0,0,0,0,0,\t/* 14-bit lossless */\r\n\t\t7,6,8,5,9,4,10,3,11,12,2,0,1,13,14 ] ];\r\n\t\t \r\n\t\tvar raw_width = img[\"t256\"][0], height=img[\"t257\"][0], tiff_bps=img[\"t258\"][0];\r\n\t\t\r\n\t\tvar tree = 0, split = 0;\r\n\t\tvar make_decoder = UTIF.decode._make_decoder;\r\n\t\tvar getbithuff = UTIF.decode._getbithuff;\r\n\t\t\r\n\t\tvar mn = imgs[0].exifIFD.makerNote, md = mn[\"t150\"]?mn[\"t150\"]:mn[\"t140\"], mdo=0; //console.log(mn,md);\r\n\t\t//console.log(md[0].toString(16), md[1].toString(16), tiff_bps);\r\n\t\tvar ver0 = md[mdo++], ver1 = md[mdo++];\r\n\t\tif (ver0 == 0x49 || ver1 == 0x58) mdo+=2110;\r\n\t\tif (ver0 == 0x46) tree = 2;\r\n\t\tif (tiff_bps == 14) tree += 3;\r\n\t\t\r\n\t\tvar vpred = [[0,0],[0,0]], bin=(img.isLE ? UTIF._binLE : UTIF._binBE);\r\n\t\tfor(var i=0; i<2; i++) for(var j=0; j<2; j++) { vpred[i][j] = bin.readShort(md,mdo); mdo+=2; } // not sure here ... [i][j] or [j][i]\r\n\t\t//console.log(vpred);\r\n\t\t\r\n\t\t\r\n\t\tvar max = 1 << tiff_bps & 0x7fff, step=0;\r\n\t\tvar csize = bin.readShort(md,mdo); mdo+=2;\r\n\t\tif (csize > 1) step = Math.floor(max / (csize-1));\r\n\t\tif (ver0 == 0x44 && ver1 == 0x20 && step > 0) split = bin.readShort(md,562);\r\n\t\t\r\n\t\t\r\n\t\tvar i;\r\n\t\tvar row, col;\r\n\t\tvar len, shl, diff;\r\n\t\tvar min_v = 0;\r\n\t\tvar hpred = [0,0];\r\n\t\tvar huff = make_decoder(nikon_tree[tree]);\r\n\t\t\r\n\t\t//var g_input_offset=0, bitbuf=0, vbits=0, reset=0;\r\n\t\tvar prm = [off,0,0,0];\r\n\t\t//console.log(split); split = 170;\r\n\t\t\r\n\t\tfor (min_v=row=0; row < height; row++) {\r\n\t\t\tif (split && row == split) {\r\n\t\t\t\t//free (huff);\r\n\t\t\t\thuff = make_decoder (nikon_tree[tree+1]);\r\n\t\t\t\t//max_v += (min_v = 16) << 1;\r\n\t\t\t}\r\n\t\t\tfor (col=0; col < raw_width; col++) {\r\n\t\t\t\ti = getbithuff(data,prm,huff[0],huff);\r\n\t\t\t\tlen = i & 15;\r\n\t\t\t\tshl = i >>> 4;\r\n\t\t\t\tdiff = (((getbithuff(data,prm,len-shl,0) << 1) + 1) << shl) >>> 1;\r\n\t\t\t\tif ((diff & (1 << (len-1))) == 0)\r\n\t\t\t\t\tdiff -= (1 << len) - (shl==0?1:0);\r\n\t\t\t\tif (col < 2) hpred[col] = vpred[row & 1][col] += diff;\r\n\t\t\t\telse hpred[col & 1] += diff;\r\n\t\t\t\t\r\n\t\t\t\tvar clr = Math.min(Math.max(hpred[col & 1],0),(1<>>3); dt[o]|=val>>>16; dt[o+1]|=val>>>8; dt[o+2]|=val; }\r\n\t\r\n\t\r\n\tUTIF.decode._getbithuff = function(data,prm,nbits, huff) {\r\n\t\tvar zero_after_ff = 0;\r\n\t\tvar get_byte = UTIF.decode._get_byte;\r\n\t\tvar c;\r\n\t \r\n\t\tvar off=prm[0], bitbuf=prm[1], vbits=prm[2], reset=prm[3];\r\n\t\r\n\t\t//if (nbits > 25) return 0;\r\n\t\t//if (nbits < 0) return bitbuf = vbits = reset = 0;\r\n\t\tif (nbits == 0 || vbits < 0) return 0; \r\n\t\twhile (!reset && vbits < nbits && (c = data[off++]) != -1 &&\r\n\t\t\t!(reset = zero_after_ff && c == 0xff && data[off++])) {\r\n\t\t\t//console.log(\"byte read into c\");\r\n\t\t\tbitbuf = (bitbuf << 8) + c;\r\n\t\t\tvbits += 8;\r\n\t\t} \r\n\t\tc = (bitbuf << (32-vbits)) >>> (32-nbits);\r\n\t\tif (huff) {\r\n\t\t\tvbits -= huff[c+1] >>> 8; //console.log(c, huff[c]>>8);\r\n\t\t\tc = huff[c+1]&255;\r\n\t\t} else\r\n\t\t\tvbits -= nbits;\r\n\t\tif (vbits < 0) throw \"e\";\r\n\t \r\n\t\tprm[0]=off; prm[1]=bitbuf; prm[2]=vbits; prm[3]=reset;\r\n\t \r\n\t\treturn c;\r\n\t}\r\n\t\r\n\tUTIF.decode._make_decoder = function(source) {\r\n\t\tvar max, len, h, i, j;\r\n\t\tvar huff = [];\r\n\t\r\n\t\tfor (max=16; max!=0 && !source[max]; max--);\r\n\t\tvar si=17;\r\n\t\t\r\n\t\thuff[0] = max;\r\n\t\tfor (h=len=1; len <= max; len++)\r\n\t\t\tfor (i=0; i < source[len]; i++, ++si)\r\n\t\t\t\tfor (j=0; j < 1 << (max-len); j++)\r\n\t\t\t\t\tif (h <= 1 << max)\r\n\t\t\t\t\t\thuff[h++] = (len << 8) | source[si];\r\n\t\treturn huff;\r\n\t}\r\n\t\r\n\tUTIF.decode._decodeNewJPEG = function(img, data, off, len, tgt, toff)\r\n\t{\r\n\t\tlen = Math.min(len, data.length-off);\r\n\t\tvar tables = img[\"t347\"], tlen = tables ? tables.length : 0, buff = new Uint8Array(tlen + len);\r\n\t\t\r\n\t\tif (tables) {\r\n\t\t\tvar SOI = 216, EOI = 217, boff = 0;\r\n\t\t\tfor (var i=0; i<(tlen-1); i++)\r\n\t\t\t{\r\n\t\t\t\t// Skip EOI marker from JPEGTables\r\n\t\t\t\tif (tables[i]==255 && tables[i+1]==EOI) break;\r\n\t\t\t\tbuff[boff++] = tables[i];\r\n\t\t\t}\r\n\t\r\n\t\t\t// Skip SOI marker from data\r\n\t\t\tvar byte1 = data[off], byte2 = data[off + 1];\r\n\t\t\tif (byte1!=255 || byte2!=SOI)\r\n\t\t\t{\r\n\t\t\t\tbuff[boff++] = byte1;\r\n\t\t\t\tbuff[boff++] = byte2;\r\n\t\t\t}\r\n\t\t\tfor (var i=2; i>>8); }\r\n\t\t\t\telse for(var i=0; i>>8); tgt[toff+(i<<1)+1] = (out[i]&255); }\r\n\t\t\t}\r\n\t\t\telse if(bps==14 || bps==12) { // 4 * 14 == 56 == 7 * 8\r\n\t\t\t\tvar rst = 16-bps;\r\n\t\t\t\tfor(var i=0; i 1);\r\n\t\t}\r\n\t\r\n\t\tif(!isTiled)\r\n\t\t{\r\n\t\t\tif(data[off]==255 && data[off+1]==SOI) return { jpegOffset: off };\r\n\t\t\tif(jpgIchgFmt!=null)\r\n\t\t\t{\r\n\t\t\t\tif(data[off+jifoff]==255 && data[off+jifoff+1]==SOI) joff = off+jifoff;\r\n\t\t\t\telse log(\"JPEGInterchangeFormat does not point to SOI\");\r\n\t\r\n\t\t\t\tif(jpgIchgFmtLen==null) log(\"JPEGInterchangeFormatLength field is missing\");\r\n\t\t\t\telse if(jifoff >= soff || (jifoff+jiflen) <= soff) log(\"JPEGInterchangeFormatLength field value is invalid\");\r\n\t\r\n\t\t\t\tif(joff != null) return { jpegOffset: joff };\r\n\t\t\t}\r\n\t\t}\r\n\t\r\n\t\tif(ycbcrss!=null) { ssx = ycbcrss[0]; ssy = ycbcrss[1]; }\r\n\t\r\n\t\tif(jpgIchgFmt!=null)\r\n\t\t\tif(jpgIchgFmtLen!=null)\r\n\t\t\t\tif(jiflen >= 2 && (jifoff+jiflen) <= soff)\r\n\t\t\t\t{\r\n\t\t\t\t\tif(data[off+jifoff+jiflen-2]==255 && data[off+jifoff+jiflen-1]==SOI) tables = new Uint8Array(jiflen-2);\r\n\t\t\t\t\telse tables = new Uint8Array(jiflen);\r\n\t\r\n\t\t\t\t\tfor(i=0; i offset to first strip or tile\");\r\n\t\r\n\t\tif(tables == null)\r\n\t\t{\r\n\t\t\tvar ooff = 0, out = [];\r\n\t\t\tout[ooff++] = 255; out[ooff++] = SOI;\r\n\t\r\n\t\t\tvar qtables = img[\"t519\"];\r\n\t\t\tif(qtables==null) throw new Error(\"JPEGQTables tag is missing\");\r\n\t\t\tfor(i=0; i>> 8); out[ooff++] = nc & 255;\r\n\t\t\t\t\tout[ooff++] = (i | (k << 4));\r\n\t\t\t\t\tfor(j=0; j<16; j++) out[ooff++] = data[off+htables[i]+j];\r\n\t\t\t\t\tfor(j=0; j>> 8) & 255; out[ooff++] = img.height & 255;\r\n\t\t\tout[ooff++] = (img.width >>> 8) & 255; out[ooff++] = img.width & 255;\r\n\t\t\tout[ooff++] = spp;\r\n\t\t\tif(spp==1) { out[ooff++] = 1; out[ooff++] = 17; out[ooff++] = 0; }\r\n\t\t\telse for(i=0; i<3; i++)\r\n\t\t\t{\r\n\t\t\t\tout[ooff++] = i + 1;\r\n\t\t\t\tout[ooff++] = (i != 0) ? 17 : (((ssx & 15) << 4) | (ssy & 15));\r\n\t\t\t\tout[ooff++] = i;\r\n\t\t\t}\r\n\t\r\n\t\t\tif(jpgresint!=null && jpgresint[0]!=0)\r\n\t\t\t{\r\n\t\t\t\tout[ooff++] = 255; out[ooff++] = DRI; out[ooff++] = 0; out[ooff++] = 4;\r\n\t\t\t\tout[ooff++] = (jpgresint[0] >>> 8) & 255;\r\n\t\t\t\tout[ooff++] = jpgresint[0] & 255;\r\n\t\t\t}\r\n\t\r\n\t\t\ttables = new Uint8Array(out);\r\n\t\t}\r\n\t\r\n\t\tvar sofpos = -1;\r\n\t\ti = 0;\r\n\t\twhile(i < (tables.length - 1)) {\r\n\t\t\tif(tables[i]==255 && tables[i+1]==SOF0) { sofpos = i; break; }\r\n\t\t\ti++;\r\n\t\t}\r\n\t\r\n\t\tif(sofpos == -1)\r\n\t\t{\r\n\t\t\tvar tmptab = new Uint8Array(tables.length + 10 + 3*spp);\r\n\t\t\ttmptab.set(tables);\r\n\t\t\tvar tmpoff = tables.length;\r\n\t\t\tsofpos = tables.length;\r\n\t\t\ttables = tmptab;\r\n\t\r\n\t\t\ttables[tmpoff++] = 255; tables[tmpoff++] = SOF0;\r\n\t\t\ttables[tmpoff++] = 0; tables[tmpoff++] = 8 + 3*spp; tables[tmpoff++] = 8;\r\n\t\t\ttables[tmpoff++] = (img.height >>> 8) & 255; tables[tmpoff++] = img.height & 255;\r\n\t\t\ttables[tmpoff++] = (img.width >>> 8) & 255; tables[tmpoff++] = img.width & 255;\r\n\t\t\ttables[tmpoff++] = spp;\r\n\t\t\tif(spp==1) { tables[tmpoff++] = 1; tables[tmpoff++] = 17; tables[tmpoff++] = 0; }\r\n\t\t\telse for(i=0; i<3; i++)\r\n\t\t\t{\r\n\t\t\t\ttables[tmpoff++] = i + 1;\r\n\t\t\t\ttables[tmpoff++] = (i != 0) ? 17 : (((ssx & 15) << 4) | (ssy & 15));\r\n\t\t\t\ttables[tmpoff++] = i;\r\n\t\t\t}\r\n\t\t}\r\n\t\r\n\t\tif(data[soff]==255 && data[soff+1]==SOS)\r\n\t\t{\r\n\t\t\tvar soslen = (data[soff+2]<<8) | data[soff+3];\r\n\t\t\tsosMarker = new Uint8Array(soslen+2);\r\n\t\t\tsosMarker[0] = data[soff]; sosMarker[1] = data[soff+1]; sosMarker[2] = data[soff+2]; sosMarker[3] = data[soff+3];\r\n\t\t\tfor(i=0; i<(soslen-2); i++) sosMarker[i+4] = data[soff+i+4];\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tsosMarker = new Uint8Array(2 + 6 + 2*spp);\r\n\t\t\tvar sosoff = 0;\r\n\t\t\tsosMarker[sosoff++] = 255; sosMarker[sosoff++] = SOS;\r\n\t\t\tsosMarker[sosoff++] = 0; sosMarker[sosoff++] = 6 + 2*spp; sosMarker[sosoff++] = spp;\r\n\t\t\tif(spp==1) { sosMarker[sosoff++] = 1; sosMarker[sosoff++] = 0; }\r\n\t\t\telse for(i=0; i<3; i++)\r\n\t\t\t{\r\n\t\t\t\tsosMarker[sosoff++] = i+1; sosMarker[sosoff++] = (i << 4) | i;\r\n\t\t\t}\r\n\t\t\tsosMarker[sosoff++] = 0; sosMarker[sosoff++] = 63; sosMarker[sosoff++] = 0;\r\n\t\t}\r\n\t\r\n\t\treturn { jpegOffset: off, tables: tables, sosMarker: sosMarker, sofPosition: sofpos };\r\n\t}\r\n\t\r\n\tUTIF.decode._decodeOldJPEG = function(img, data, off, len, tgt, toff)\r\n\t{\r\n\t\tvar i, dlen, tlen, buff, buffoff;\r\n\t\tvar jpegData = UTIF.decode._decodeOldJPEGInit(img, data, off, len);\r\n\t\r\n\t\tif(jpegData.jpegOffset!=null)\r\n\t\t{\r\n\t\t\tdlen = off+len-jpegData.jpegOffset;\r\n\t\t\tbuff = new Uint8Array(dlen);\r\n\t\t\tfor(i=0; i>> 8) & 255; buff[jpegData.sofPosition+6] = img.height & 255;\r\n\t\t\tbuff[jpegData.sofPosition+7] = (img.width >>> 8) & 255; buff[jpegData.sofPosition+8] = img.width & 255;\r\n\t\r\n\t\t\tif(data[off]!=255 || data[off+1]!=SOS)\r\n\t\t\t{\r\n\t\t\t\tbuff.set(jpegData.sosMarker, buffoff);\r\n\t\t\t\tbuffoff += sosMarker.length;\r\n\t\t\t}\r\n\t\t\tfor(i=0; i=0 && n<128) for(var i=0; i< n+1; i++) { ta[toff]=sa[off]; toff++; off++; }\r\n\t\t\tif(n>=-127 && n<0) { for(var i=0; i<-n+1; i++) { ta[toff]=sa[off]; toff++; } off++; }\r\n\t\t}\r\n\t\treturn toff;\r\n\t}\r\n\t\r\n\tUTIF.decode._decodeThunder = function(data, off, len, tgt, toff)\r\n\t{\r\n\t\tvar d2 = [ 0, 1, 0, -1 ], d3 = [ 0, 1, 2, 3, 0, -3, -2, -1 ];\r\n\t\tvar lim = off+len, qoff = toff*2, px = 0;\r\n\t\twhile(off>>6), n = (b&63); off++;\r\n\t\t\tif(msk==3) { px=(n&15); tgt[qoff>>>1] |= (px<<(4*(1-qoff&1))); qoff++; }\r\n\t\t\tif(msk==0) for(var i=0; i>>1] |= (px<<(4*(1-qoff&1))); qoff++; }\r\n\t\t\tif(msk==2) for(var i=0; i<2; i++) { var d=(n>>>(3*(1-i)))&7; if(d!=4) { px+=d3[d]; tgt[qoff>>>1] |= (px<<(4*(1-qoff&1))); qoff++; } }\r\n\t\t\tif(msk==1) for(var i=0; i<3; i++) { var d=(n>>>(2*(2-i)))&3; if(d!=2) { px+=d2[d]; tgt[qoff>>>1] |= (px<<(4*(1-qoff&1))); qoff++; } }\r\n\t\t}\r\n\t}\r\n\t\r\n\tUTIF.decode._dmap = { \"1\":0,\"011\":1,\"000011\":2,\"0000011\":3, \"010\":-1,\"000010\":-2,\"0000010\":-3 };\r\n\tUTIF.decode._lens = ( function()\r\n\t{\r\n\t\tvar addKeys = function(lens, arr, i0, inc) { for(var i=0; i>>3)>>3]>>>(7-(boff&7)))&1;\r\n\t\t\tif(fo==2) bit = (data[boff>>>3]>>>( (boff&7)))&1;\r\n\t\t\tboff++; wrd+=bit;\r\n\t\t\tif(mode==\"H\")\r\n\t\t\t{\r\n\t\t\t\tif(U._lens[clr][wrd]!=null)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar dl=U._lens[clr][wrd]; wrd=\"\"; len+=dl;\r\n\t\t\t\t\tif(dl<64) { U._addNtimes(line,len,clr); a0+=len; clr=1-clr; len=0; toRead--; if(toRead==0) mode=\"\"; }\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tif(wrd==\"0001\") { wrd=\"\"; U._addNtimes(line,b2-a0,clr); a0=b2; }\r\n\t\t\t\tif(wrd==\"001\" ) { wrd=\"\"; mode=\"H\"; toRead=2; }\r\n\t\t\t\tif(U._dmap[wrd]!=null) { a1 = b1+U._dmap[wrd]; U._addNtimes(line, a1-a0, clr); a0=a1; wrd=\"\"; clr=1-clr; }\r\n\t\t\t}\r\n\t\t\tif(line.length==w && mode==\"\")\r\n\t\t\t{\r\n\t\t\t\tU._writeBits(line, tgt, toff*8+y*bipl);\r\n\t\t\t\tclr=0; y++; a0=0;\r\n\t\t\t\tpline=U._makeDiff(line); line=[];\r\n\t\t\t}\r\n\t\t\t//if(wrd.length>150) { log(wrd); break; throw \"e\"; }\r\n\t\t}\r\n\t}\r\n\t\r\n\tUTIF.decode._findDiff = function(line, x, clr) { for(var i=0; i=x && line[i+1]==clr) return line[i]; }\r\n\t\r\n\tUTIF.decode._makeDiff = function(line)\r\n\t{\r\n\t\tvar out = []; if(line[0]==1) out.push(0,1);\r\n\t\tfor(var i=1; i>>3)>>3]>>>(7-(boff&7)))&1;\r\n\t\t\tif(fo==2) bit = (data[boff>>>3]>>>( (boff&7)))&1;\r\n\t\t\tboff++; wrd+=bit;\r\n\t\t\t\r\n\t\t\tlen = U._lens[clr][wrd];\r\n\t\t\tif(len!=null) {\r\n\t\t\t\tU._addNtimes(line,len,clr); wrd=\"\";\r\n\t\t\t\tif(len<64) clr = 1-clr; \r\n\t\t\t\tif(line.length==w) { U._writeBits(line, tgt, toff*8+y*bipl); line=[]; y++; clr=0; if((boff&7)!=0) boff+=8-(boff&7); if(len>=64) boff+=8; }\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t\r\n\tUTIF.decode._decodeG3 = function(data, off, slen, tgt, toff, w, fo, twoDim)\r\n\t{\r\n\t\tvar U = UTIF.decode, boff=off<<3, len=0, wrd=\"\";\r\n\t\tvar line=[], pline=[]; for(var i=0; i>>3)>>3]>>>(7-(boff&7)))&1;\r\n\t\t\tif(fo==2) bit = (data[boff>>>3]>>>( (boff&7)))&1;\r\n\t\t\tboff++; wrd+=bit;\r\n\t\r\n\t\t\tif(is1D)\r\n\t\t\t{\r\n\t\t\t\tif(U._lens[clr][wrd]!=null)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar dl=U._lens[clr][wrd]; wrd=\"\"; len+=dl;\r\n\t\t\t\t\tif(dl<64) { U._addNtimes(line,len,clr); clr=1-clr; len=0; }\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tif(mode==\"H\")\r\n\t\t\t\t{\r\n\t\t\t\t\tif(U._lens[clr][wrd]!=null)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tvar dl=U._lens[clr][wrd]; wrd=\"\"; len+=dl;\r\n\t\t\t\t\t\tif(dl<64) { U._addNtimes(line,len,clr); a0+=len; clr=1-clr; len=0; toRead--; if(toRead==0) mode=\"\"; }\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tif(wrd==\"0001\") { wrd=\"\"; U._addNtimes(line,b2-a0,clr); a0=b2; }\r\n\t\t\t\t\tif(wrd==\"001\" ) { wrd=\"\"; mode=\"H\"; toRead=2; }\r\n\t\t\t\t\tif(U._dmap[wrd]!=null) { a1 = b1+U._dmap[wrd]; U._addNtimes(line, a1-a0, clr); a0=a1; wrd=\"\"; clr=1-clr; }\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(wrd.endsWith(\"000000000001\")) // needed for some files\r\n\t\t\t{\r\n\t\t\t\tif(y>=0) U._writeBits(line, tgt, toff*8+y*bipl);\r\n\t\t\t\tif(twoDim) {\r\n\t\t\t\t\tif(fo==1) is1D = ((data[boff>>>3]>>>(7-(boff&7)))&1)==1;\r\n\t\t\t\t\tif(fo==2) is1D = ((data[boff>>>3]>>>( (boff&7)))&1)==1;\r\n\t\t\t\t\tboff++;\r\n\t\t\t\t}\r\n\t\t\t\t//log(\"EOL\",y, \"next 1D:\", is1D);\r\n\t\t\t\twrd=\"\"; clr=0; y++; a0=0;\r\n\t\t\t\tpline=U._makeDiff(line); line=[];\r\n\t\t\t}\r\n\t\t}\r\n\t\tif(line.length==w) U._writeBits(line, tgt, toff*8+y*bipl);\r\n\t}\r\n\t\r\n\tUTIF.decode._addNtimes = function(arr, n, val) { for(var i=0; i>>3] |= (bits[i]<<(7-((boff+i)&7)));\r\n\t}\r\n\t\r\n\tUTIF.decode._decodeLZW=UTIF.decode._decodeLZW=function(){var e,U,Z,u,K=0,V=0,g=0,N=0,O=function(){var S=e>>>3,A=U[S]<<16|U[S+1]<<8|U[S+2],j=A>>>24-(e&7)-V&(1<>>----------------\");\r\n\t\tfor(var i=0; i4) { bin.writeUint(data, offset, eoff); toff=eoff; }\r\n\t\r\n\t\t\tif (type== 1 || type==7) { for(var i=0; i4) { dlen += (dlen&1); eoff += dlen; }\r\n\t\t\toffset += 4;\r\n\t\t}\r\n\t\treturn [offset, eoff];\r\n\t}\r\n\t\r\n\tUTIF.toRGBA8 = function(out, scl)\r\n\t{\r\n\t\tvar w = out.width, h = out.height, area = w*h, qarea = area*4, data = out.data;\r\n\t\tvar img = new Uint8Array(area*4);\r\n\t\t//console.log(out);\r\n\t\t// 0: WhiteIsZero, 1: BlackIsZero, 2: RGB, 3: Palette color, 4: Transparency mask, 5: CMYK\r\n\t\tvar intp = (out[\"t262\"] ? out[\"t262\"][0]: 2), bps = (out[\"t258\"]?Math.min(32,out[\"t258\"][0]):1);\r\n\t\tif(out[\"t262\"]==null && bps==1) intp=0;\r\n\t\t//log(\"interpretation: \", intp, \"bps\", bps, out);\r\n\t\t\r\n\t\tif(false) {}\r\n\t\telse if(intp==0)\r\n\t\t{\r\n\t\t\tvar bpl = Math.ceil(bps*w/8);\r\n\t\t\tfor(var y=0; y>3)])>>(7- (i&7)))& 1; img[qi]=img[qi+1]=img[qi+2]=( 1-px)*255; img[qi+3]=255; }\r\n\t\t\t\tif(bps== 4) for(var i=0; i>1)])>>(4-4*(i&1)))&15; img[qi]=img[qi+1]=img[qi+2]=(15-px)* 17; img[qi+3]=255; }\r\n\t\t\t\tif(bps== 8) for(var i=0; i>3)])>>(7- (i&7)))&1; img[qi]=img[qi+1]=img[qi+2]=(px)*255; img[qi+3]=255; }\r\n\t\t\t\tif(bps== 2) for(var i=0; i>2)])>>(6-2*(i&3)))&3; img[qi]=img[qi+1]=img[qi+2]=(px)* 85; img[qi+3]=255; }\r\n\t\t\t\tif(bps== 8) for(var i=0; i>>3)]>>>(7-(x&7)))&1;\r\n\t\t\t\t\telse if(bps==2) mi=(data[dof+(x>>>2)]>>>(6-2*(x&3)))&3;\r\n\t\t\t\t\telse if(bps==4) mi=(data[dof+(x>>>1)]>>>(4-4*(x&1)))&15;\r\n\t\t\t\t\telse if(bps==8) mi= data[dof+x*smpls]; \r\n\t\t\t\t\telse throw bps;\r\n\t\t\t\t\timg[qi]=(map[mi]>>8); img[qi+1]=(map[cn+mi]>>8); img[qi+2]=(map[cn+cn+mi]>>8); img[qi+3]=255; \r\n\t\t\t\t}\r\n\t\t}\r\n\t\telse if(intp==5) \r\n\t\t{\r\n\t\t\tvar smpls = out[\"t258\"]?out[\"t258\"].length : 4;\r\n\t\t\tvar gotAlpha = smpls>4 ? 1 : 0;\r\n\t\t\tfor(var i=0; i>>1);\r\n\t\t\t\t\tvar Y = data[si+(j&1)], Cb=data[si+2]-128, Cr=data[si+3]-128;\r\n\t\t\t\t\t\r\n\t\t\t\t\tvar r = Y + ( (Cr >> 2) + (Cr >> 3) + (Cr >> 5) ) ;\r\n\t\t\t\t\tvar g = Y - ( (Cb >> 2) + (Cb >> 4) + (Cb >> 5)) - ( (Cr >> 1) + (Cr >> 3) + (Cr >> 4) + (Cr >> 5)) ;\r\n\t\t\t\t\tvar b = Y + ( Cb + (Cb >> 1) + (Cb >> 2) + (Cb >> 6)) ;\r\n\t\t\t\t\t\r\n\t\t\t\t\timg[qi ]=Math.max(0,Math.min(255,r));\r\n\t\t\t\t\timg[qi+1]=Math.max(0,Math.min(255,g));\r\n\t\t\t\t\timg[qi+2]=Math.max(0,Math.min(255,b));\r\n\t\t\t\t\timg[qi+3]=255;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if(intp==32845) {\r\n\t\t\t\r\n\t\t\tfunction gamma(x) { return x < 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1.0 / 2.4) - 0.055; }\r\n\t\t\t\r\n\t\t\tfor(var y=0; yma) { ma=ar; page=img; }\r\n\t\t}\r\n\t\tUTIF.decodeImage(buff, page, ifds);\r\n\t\tvar rgba = UTIF.toRGBA8(page), w=page.width, h=page.height;\r\n\t\t\r\n\t\tvar cnv = document.createElement(\"canvas\"); cnv.width=w; cnv.height=h;\r\n\t\tvar ctx = cnv.getContext(\"2d\");\r\n\t\tvar imgd = new ImageData(new Uint8ClampedArray(rgba.buffer),w,h);\r\n\t\tctx.putImageData(imgd,0,0);\r\n\t\treturn cnv.toDataURL();\r\n\t}\r\n\t\r\n\t\r\n\tUTIF._binBE =\r\n\t{\r\n\t\tnextZero : function(data, o) { while(data[o]!=0) o++; return o; },\r\n\t\treadUshort : function(buff, p) { return (buff[p]<< 8) | buff[p+1]; },\r\n\t\treadShort : function(buff, p) { var a=UTIF._binBE.ui8; a[0]=buff[p+1]; a[1]=buff[p+0]; return UTIF._binBE. i16[0]; },\r\n\t\treadInt : function(buff, p) { var a=UTIF._binBE.ui8; a[0]=buff[p+3]; a[1]=buff[p+2]; a[2]=buff[p+1]; a[3]=buff[p+0]; return UTIF._binBE. i32[0]; },\r\n\t\treadUint : function(buff, p) { var a=UTIF._binBE.ui8; a[0]=buff[p+3]; a[1]=buff[p+2]; a[2]=buff[p+1]; a[3]=buff[p+0]; return UTIF._binBE.ui32[0]; },\r\n\t\treadASCII : function(buff, p, l) { var s = \"\"; for(var i=0; i> 8)&255; buff[p+1] = n&255; },\r\n\t\twriteInt : function(buff, p, n) { var a=UTIF._binBE.ui8; UTIF._binBE.i32[0]=n; buff[p+3]=a[0]; buff[p+2]=a[1]; buff[p+1]=a[2]; buff[p+0]=a[3]; },\r\n\t\twriteUint : function(buff, p, n) { buff[p] = (n>>24)&255; buff[p+1] = (n>>16)&255; buff[p+2] = (n>>8)&255; buff[p+3] = (n>>0)&255; },\r\n\t\twriteASCII : function(buff, p, s) { for(var i = 0; i < s.length; i++) buff[p+i] = s.charCodeAt(i); },\r\n\t\twriteDouble: function(buff, p, n)\r\n\t\t{\r\n\t\t\tUTIF._binBE.fl64[0] = n;\r\n\t\t\tfor (var i = 0; i < 8; i++) buff[p + i] = UTIF._binBE.ui8[7 - i];\r\n\t\t}\r\n\t}\r\n\tUTIF._binBE.ui8 = new Uint8Array (8);\r\n\tUTIF._binBE.i16 = new Int16Array (UTIF._binBE.ui8.buffer);\r\n\tUTIF._binBE.i32 = new Int32Array (UTIF._binBE.ui8.buffer);\r\n\tUTIF._binBE.ui32 = new Uint32Array (UTIF._binBE.ui8.buffer);\r\n\tUTIF._binBE.fl32 = new Float32Array(UTIF._binBE.ui8.buffer);\r\n\tUTIF._binBE.fl64 = new Float64Array(UTIF._binBE.ui8.buffer);\r\n\t\r\n\tUTIF._binLE =\r\n\t{\r\n\t\tnextZero : UTIF._binBE.nextZero,\r\n\t\treadUshort : function(buff, p) { return (buff[p+1]<< 8) | buff[p]; },\r\n\t\treadShort : function(buff, p) { var a=UTIF._binBE.ui8; a[0]=buff[p+0]; a[1]=buff[p+1]; return UTIF._binBE. i16[0]; },\r\n\t\treadInt : function(buff, p) { var a=UTIF._binBE.ui8; a[0]=buff[p+0]; a[1]=buff[p+1]; a[2]=buff[p+2]; a[3]=buff[p+3]; return UTIF._binBE. i32[0]; },\r\n\t\treadUint : function(buff, p) { var a=UTIF._binBE.ui8; a[0]=buff[p+0]; a[1]=buff[p+1]; a[2]=buff[p+2]; a[3]=buff[p+3]; return UTIF._binBE.ui32[0]; },\r\n\t\treadASCII : UTIF._binBE.readASCII,\r\n\t\treadFloat : function(buff, p) { var a=UTIF._binBE.ui8; for(var i=0;i<4;i++) a[i]=buff[p+ i]; return UTIF._binBE.fl32[0]; },\r\n\t\treadDouble : function(buff, p) { var a=UTIF._binBE.ui8; for(var i=0;i<8;i++) a[i]=buff[p+ i]; return UTIF._binBE.fl64[0]; },\r\n\t\t\r\n\t\twriteUshort: function(buff, p, n) { buff[p] = (n)&255; buff[p+1] = (n>>8)&255; },\r\n\t\twriteInt : function(buff, p, n) { var a=UTIF._binBE.ui8; UTIF._binBE.i32[0]=n; buff[p+0]=a[0]; buff[p+1]=a[1]; buff[p+2]=a[2]; buff[p+3]=a[3]; },\r\n\t\twriteUint : function(buff, p, n) { buff[p] = (n>>>0)&255; buff[p+1] = (n>>>8)&255; buff[p+2] = (n>>>16)&255; buff[p+3] = (n>>>24)&255; },\r\n\t\twriteASCII : UTIF._binBE.writeASCII\r\n\t}\r\n\tUTIF._copyTile = function(tb, tw, th, b, w, h, xoff, yoff)\r\n\t{\r\n\t\t//log(\"copyTile\", tw, th, w, h, xoff, yoff);\r\n\t\tvar xlim = Math.min(tw, w-xoff);\r\n\t\tvar ylim = Math.min(th, h-yoff);\r\n\t\tfor(var y=0; y>--r&1;\r\n\tX=g[X+y]}w[t]=X}}function P(l,A,g,K){if(l[A+3]!=255)return 0;if(g==0)return A;for(var t=0;t<2;t++){if(l[A+t]==0){l[A+t]=l.length;\r\n\tl.push(0,0,K,255)}var F=P(l,l[A+t],g-1,K+1);if(F!=0)return F}return 0}function f(l){var A=l.b,g=l.a;\r\n\twhile(A<25&&l.e>>8;g=g<<8|K;A+=8}if(A<0)throw\"e\";l.b=A;l.a=g}function O(l,A){if(A.b>(A.b-=l)&65535>>16-l}function B(l,A){var g=l[0],K=0,t=255,F=0;if(A.b<16)f(A);var $=A.a>>A.b-8&255;\r\n\tK=l[1][$];t=g[K+3];A.b-=g[K+2];while(t==255){F=A.a>>--A.b&1;K=g[K+F];t=g[K+3]}return t}function D(l,A){if(l<32768>>16-A)l+=-(1<>4,q&15]}}else if(M==65476){var m=_+X-2;while(_>>4];t[i[0]]=i.slice(1)}g=u();_+=2;break}else{_+=X-2}}var T=K>8?Uint16Array:Uint8Array,Y=new T(w*r*L),d={b:0,a:0,c:g==8,e:_,data:o,d:o.length};\r\n\tif(d.c)b(Y,r*L,d,$[0],w);else{var v=[],Q=0,C=0;for(var y=0;yQ)Q=s;\r\n\tif(H>C)C=H;v.push(s*H)}if(Q!=1||C!=1){var E=[],c=0;for(var y=0;y>>1);else if(A==6)S=l[n]+(m-l[n-L]>>>1);else if(A==7)S=m+l[n]>>>1;else throw A;\r\n\tl[q]+=S}}}}return x}();\r\n\t\r\n\t\r\n\t(function(){var G=0,F=1,i=2,b=3,J=4,N=5,E=6,s=7,c=8,T=9,a3=10,f=11,q=12,M=13,m=14,x=15,L=16,$=17,p=18;\r\n\tfunction a5(t){var Z=UTIF._binBE.readUshort,u={b:Z(t,0),i:t[2],C:t[3],u:t[4],q:Z(t,5),k:Z(t,7),e:Z(t,9),l:Z(t,11),s:t[13],d:Z(t,14)};\r\n\tif(u.b!=18771||u.i>1||u.q<6||u.q%6||u.e<768||u.e%24||u.l!=768||u.k=u.l||u.s>16||u.s!=u.k/u.l||u.s!=Math.ceil(u.e/u.l)||u.d!=u.q/6||u.u!=12&&u.u!=14&&u.u!=16||u.C!=16&&u.C!=0){throw\"Invalid data\"}if(u.i==0){throw\"Not implemented. We need this file!\"}u.h=u.C==16;\r\n\tu.m=(u.h?u.l*2/3:u.l>>>1)|0;u.A=u.m+2;u.f=64;u.g=(1<>>6);for(var e=0;e<3;e++){for(var Q=0;\r\n\tQ<41;Q++){Z[e][Q]=[u,1]}}return Z}function a4(t){for(var Z=-1,u=0;!u;Z++){u=t[t.j]>>>7-t.a&1;t.a++;t.a&=7;\r\n\tif(!t.a)t.j++}return Z}function K(t,Z){var u=0,e=8-t.a,Q=t.j,V=t.a;if(Z){if(Z>=e){do{u<<=e;Z-=e;u|=t[t.j]&(1<=8)}if(Z){u<<=Z;e-=Z;u|=t[t.j]>>>e&(1<n&&C>>2;if(o){w[X]=h;return}l=Z.t*Z.c[t.g+Y-H]+Z.c[t.g+g-Y]}else{h=Y>g&&Y>P||Y>>2:A+v>>>1;\r\n\tl=Z.t*Z.c[t.g+Y-g]+Z.c[t.g+g-A]}R=y(l);var W=a4(u);if(W>>1):a>>>1;\r\n\tO[R][0]+=y(a);if(O[R][1]==t.f){O[R][0]>>>=1;O[R][1]>>>=1}O[R][1]++;h=l<0?h-a:h+a;if(t.i){if(h<0)h+=Z.w;\r\n\telse if(h>t.g)h-=Z.w}w[X]=h>=0?Math.min(h,t.g):0}function U(t,Z,u){var e=t[0].length;for(var Q=Z;Q<=u;\r\n\tQ++){t[Q][0]=t[Q-1][1];t[Q][e-1]=t[Q-1][e-2]}}function B(t){U(t,s,q);U(t,i,J);U(t,x,$)}function _(t,Z,u,e,Q,V,O,o,X,k,j,I,a){var l=0,R=1,w=QJ;\r\n\twhile(R8){r(t,Z,u,e,Q,R,o[X]);r(t,Z,u,e,V,R,o[X]);R+=2}}B(e)}function a8(t,Z,u,e,Q,V){_(t,Z,u,e,i,s,Q,V,0,0,1,0,8);\r\n\t_(t,Z,u,e,c,x,Q,V,1,0,1,0,8);_(t,Z,u,e,b,T,Q,V,2,1,0,3,0);_(t,Z,u,e,a3,L,Q,V,0,0,0,3,2);_(t,Z,u,e,J,f,Q,V,1,0,0,3,2);\r\n\t_(t,Z,u,e,q,$,Q,V,2,1,0,3,0)}function a9(t,Z,u,e,Q,V){var O=V.length,o=t.l;if(Q+1==t.s)o=t.e-Q*t.l;var X=6*t.e*e+Q*t.l;\r\n\tfor(var k=0;k<6;k++){for(var j=0;j>>1)}else if(I==2){a=x+(k>>>1)}else{a=s+k}var l=t.h?(j*2/3&2147483646|j%3&1)+(j%3>>>1):j>>>1;\r\n\tZ[X+j]=u[a][l+1]}X+=t.e}}UTIF._decompressRAF=function(t,Z){var u=a5(t),e=a7(t,u),Q=a2(u),V=new Int16Array(u.e*u.q);\r\n\tif(Z==null){Z=u.h?[[1,1,0,1,1,2],[1,1,2,1,1,0],[2,0,1,0,2,1],[1,1,2,1,1,0],[1,1,0,1,1,2],[0,2,1,2,0,1]]:[[0,1],[3,2]]}var O=[[G,b],[F,J],[N,f],[E,q],[M,L],[m,$]],o=[];\r\n\tfor(var X=0;X -1\n }\n}\n\nfunction normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name)\n }\n if (/[^a-z0-9\\-#$%&'*+.^_`|~!]/i.test(name) || name === '') {\n throw new TypeError('Invalid character in header field name: \"' + name + '\"')\n }\n return name.toLowerCase()\n}\n\nfunction normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value)\n }\n return value\n}\n\n// Build a destructive iterator for the value list\nfunction iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift()\n return {done: value === undefined, value: value}\n }\n }\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n }\n }\n\n return iterator\n}\n\nexport function Headers(headers) {\n this.map = {}\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value)\n }, this)\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1])\n }, this)\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name])\n }, this)\n }\n}\n\nHeaders.prototype.append = function(name, value) {\n name = normalizeName(name)\n value = normalizeValue(value)\n var oldValue = this.map[name]\n this.map[name] = oldValue ? oldValue + ', ' + value : value\n}\n\nHeaders.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)]\n}\n\nHeaders.prototype.get = function(name) {\n name = normalizeName(name)\n return this.has(name) ? this.map[name] : null\n}\n\nHeaders.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n}\n\nHeaders.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value)\n}\n\nHeaders.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this)\n }\n }\n}\n\nHeaders.prototype.keys = function() {\n var items = []\n this.forEach(function(value, name) {\n items.push(name)\n })\n return iteratorFor(items)\n}\n\nHeaders.prototype.values = function() {\n var items = []\n this.forEach(function(value) {\n items.push(value)\n })\n return iteratorFor(items)\n}\n\nHeaders.prototype.entries = function() {\n var items = []\n this.forEach(function(value, name) {\n items.push([name, value])\n })\n return iteratorFor(items)\n}\n\nif (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries\n}\n\nfunction consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true\n}\n\nfunction fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result)\n }\n reader.onerror = function() {\n reject(reader.error)\n }\n })\n}\n\nfunction readBlobAsArrayBuffer(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsArrayBuffer(blob)\n return promise\n}\n\nfunction readBlobAsText(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsText(blob)\n return promise\n}\n\nfunction readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf)\n var chars = new Array(view.length)\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i])\n }\n return chars.join('')\n}\n\nfunction bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength)\n view.set(new Uint8Array(buf))\n return view.buffer\n }\n}\n\nfunction Body() {\n this.bodyUsed = false\n\n this._initBody = function(body) {\n /*\n fetch-mock wraps the Response object in an ES6 Proxy to\n provide useful test harness features such as flush. However, on\n ES5 browsers without fetch or Proxy support pollyfills must be used;\n the proxy-pollyfill is unable to proxy an attribute unless it exists\n on the object before the Proxy is created. This change ensures\n Response.bodyUsed exists on the instance, while maintaining the\n semantic of setting Request.bodyUsed in the constructor before\n _initBody is called.\n */\n this.bodyUsed = this.bodyUsed\n this._bodyInit = body\n if (!body) {\n this._bodyText = ''\n } else if (typeof body === 'string') {\n this._bodyText = body\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString()\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer)\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer])\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body)\n } else {\n this._bodyText = body = Object.prototype.toString.call(body)\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8')\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type)\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')\n }\n }\n }\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n }\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n var isConsumed = consumed(this)\n if (isConsumed) {\n return isConsumed\n }\n if (ArrayBuffer.isView(this._bodyArrayBuffer)) {\n return Promise.resolve(\n this._bodyArrayBuffer.buffer.slice(\n this._bodyArrayBuffer.byteOffset,\n this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength\n )\n )\n } else {\n return Promise.resolve(this._bodyArrayBuffer)\n }\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n }\n }\n\n this.text = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n }\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n }\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n }\n\n return this\n}\n\n// HTTP methods whose capitalization should be normalized\nvar methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']\n\nfunction normalizeMethod(method) {\n var upcased = method.toUpperCase()\n return methods.indexOf(upcased) > -1 ? upcased : method\n}\n\nexport function Request(input, options) {\n if (!(this instanceof Request)) {\n throw new TypeError('Please use the \"new\" operator, this DOM object constructor cannot be called as a function.')\n }\n\n options = options || {}\n var body = options.body\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url\n this.credentials = input.credentials\n if (!options.headers) {\n this.headers = new Headers(input.headers)\n }\n this.method = input.method\n this.mode = input.mode\n this.signal = input.signal\n if (!body && input._bodyInit != null) {\n body = input._bodyInit\n input.bodyUsed = true\n }\n } else {\n this.url = String(input)\n }\n\n this.credentials = options.credentials || this.credentials || 'same-origin'\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers)\n }\n this.method = normalizeMethod(options.method || this.method || 'GET')\n this.mode = options.mode || this.mode || null\n this.signal = options.signal || this.signal\n this.referrer = null\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body)\n\n if (this.method === 'GET' || this.method === 'HEAD') {\n if (options.cache === 'no-store' || options.cache === 'no-cache') {\n // Search for a '_' parameter in the query string\n var reParamSearch = /([?&])_=[^&]*/\n if (reParamSearch.test(this.url)) {\n // If it already exists then set the value with the current time\n this.url = this.url.replace(reParamSearch, '$1_=' + new Date().getTime())\n } else {\n // Otherwise add a new '_' parameter to the end with the current time\n var reQueryString = /\\?/\n this.url += (reQueryString.test(this.url) ? '&' : '?') + '_=' + new Date().getTime()\n }\n }\n }\n}\n\nRequest.prototype.clone = function() {\n return new Request(this, {body: this._bodyInit})\n}\n\nfunction decode(body) {\n var form = new FormData()\n body\n .trim()\n .split('&')\n .forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=')\n var name = split.shift().replace(/\\+/g, ' ')\n var value = split.join('=').replace(/\\+/g, ' ')\n form.append(decodeURIComponent(name), decodeURIComponent(value))\n }\n })\n return form\n}\n\nfunction parseHeaders(rawHeaders) {\n var headers = new Headers()\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ')\n // Avoiding split via regex to work around a common IE11 bug with the core-js 3.6.0 regex polyfill\n // https://github.com/github/fetch/issues/748\n // https://github.com/zloirock/core-js/issues/751\n preProcessedHeaders\n .split('\\r')\n .map(function(header) {\n return header.indexOf('\\n') === 0 ? header.substr(1, header.length) : header\n })\n .forEach(function(line) {\n var parts = line.split(':')\n var key = parts.shift().trim()\n if (key) {\n var value = parts.join(':').trim()\n headers.append(key, value)\n }\n })\n return headers\n}\n\nBody.call(Request.prototype)\n\nexport function Response(bodyInit, options) {\n if (!(this instanceof Response)) {\n throw new TypeError('Please use the \"new\" operator, this DOM object constructor cannot be called as a function.')\n }\n if (!options) {\n options = {}\n }\n\n this.type = 'default'\n this.status = options.status === undefined ? 200 : options.status\n this.ok = this.status >= 200 && this.status < 300\n this.statusText = options.statusText === undefined ? '' : '' + options.statusText\n this.headers = new Headers(options.headers)\n this.url = options.url || ''\n this._initBody(bodyInit)\n}\n\nBody.call(Response.prototype)\n\nResponse.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n}\n\nResponse.error = function() {\n var response = new Response(null, {status: 0, statusText: ''})\n response.type = 'error'\n return response\n}\n\nvar redirectStatuses = [301, 302, 303, 307, 308]\n\nResponse.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n}\n\nexport var DOMException = global.DOMException\ntry {\n new DOMException()\n} catch (err) {\n DOMException = function(message, name) {\n this.message = message\n this.name = name\n var error = Error(message)\n this.stack = error.stack\n }\n DOMException.prototype = Object.create(Error.prototype)\n DOMException.prototype.constructor = DOMException\n}\n\nexport function fetch(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init)\n\n if (request.signal && request.signal.aborted) {\n return reject(new DOMException('Aborted', 'AbortError'))\n }\n\n var xhr = new XMLHttpRequest()\n\n function abortXhr() {\n xhr.abort()\n }\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n }\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL')\n var body = 'response' in xhr ? xhr.response : xhr.responseText\n setTimeout(function() {\n resolve(new Response(body, options))\n }, 0)\n }\n\n xhr.onerror = function() {\n setTimeout(function() {\n reject(new TypeError('Network request failed'))\n }, 0)\n }\n\n xhr.ontimeout = function() {\n setTimeout(function() {\n reject(new TypeError('Network request failed'))\n }, 0)\n }\n\n xhr.onabort = function() {\n setTimeout(function() {\n reject(new DOMException('Aborted', 'AbortError'))\n }, 0)\n }\n\n function fixUrl(url) {\n try {\n return url === '' && global.location.href ? global.location.href : url\n } catch (e) {\n return url\n }\n }\n\n xhr.open(request.method, fixUrl(request.url), true)\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false\n }\n\n if ('responseType' in xhr) {\n if (support.blob) {\n xhr.responseType = 'blob'\n } else if (\n support.arrayBuffer &&\n request.headers.get('Content-Type') &&\n request.headers.get('Content-Type').indexOf('application/octet-stream') !== -1\n ) {\n xhr.responseType = 'arraybuffer'\n }\n }\n\n if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers)) {\n Object.getOwnPropertyNames(init.headers).forEach(function(name) {\n xhr.setRequestHeader(name, normalizeValue(init.headers[name]))\n })\n } else {\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value)\n })\n }\n\n if (request.signal) {\n request.signal.addEventListener('abort', abortXhr)\n\n xhr.onreadystatechange = function() {\n // DONE (success or failure)\n if (xhr.readyState === 4) {\n request.signal.removeEventListener('abort', abortXhr)\n }\n }\n }\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)\n })\n}\n\nfetch.polyfill = true\n\nif (!global.fetch) {\n global.fetch = fetch\n global.Headers = Headers\n global.Request = Request\n global.Response = Response\n}\n","\"use strict\";\nvar window = require(\"global/window\")\nvar isFunction = require(\"is-function\")\nvar parseHeaders = require(\"parse-headers\")\nvar xtend = require(\"xtend\")\n\nmodule.exports = createXHR\n// Allow use of default import syntax in TypeScript\nmodule.exports.default = createXHR;\ncreateXHR.XMLHttpRequest = window.XMLHttpRequest || noop\ncreateXHR.XDomainRequest = \"withCredentials\" in (new createXHR.XMLHttpRequest()) ? createXHR.XMLHttpRequest : window.XDomainRequest\n\nforEachArray([\"get\", \"put\", \"post\", \"patch\", \"head\", \"delete\"], function(method) {\n createXHR[method === \"delete\" ? \"del\" : method] = function(uri, options, callback) {\n options = initParams(uri, options, callback)\n options.method = method.toUpperCase()\n return _createXHR(options)\n }\n})\n\nfunction forEachArray(array, iterator) {\n for (var i = 0; i < array.length; i++) {\n iterator(array[i])\n }\n}\n\nfunction isEmpty(obj){\n for(var i in obj){\n if(obj.hasOwnProperty(i)) return false\n }\n return true\n}\n\nfunction initParams(uri, options, callback) {\n var params = uri\n\n if (isFunction(options)) {\n callback = options\n if (typeof uri === \"string\") {\n params = {uri:uri}\n }\n } else {\n params = xtend(options, {uri: uri})\n }\n\n params.callback = callback\n return params\n}\n\nfunction createXHR(uri, options, callback) {\n options = initParams(uri, options, callback)\n return _createXHR(options)\n}\n\nfunction _createXHR(options) {\n if(typeof options.callback === \"undefined\"){\n throw new Error(\"callback argument missing\")\n }\n\n var called = false\n var callback = function cbOnce(err, response, body){\n if(!called){\n called = true\n options.callback(err, response, body)\n }\n }\n\n function readystatechange() {\n if (xhr.readyState === 4) {\n setTimeout(loadFunc, 0)\n }\n }\n\n function getBody() {\n // Chrome with requestType=blob throws errors arround when even testing access to responseText\n var body = undefined\n\n if (xhr.response) {\n body = xhr.response\n } else {\n body = xhr.responseText || getXml(xhr)\n }\n\n if (isJson) {\n try {\n body = JSON.parse(body)\n } catch (e) {}\n }\n\n return body\n }\n\n function errorFunc(evt) {\n clearTimeout(timeoutTimer)\n if(!(evt instanceof Error)){\n evt = new Error(\"\" + (evt || \"Unknown XMLHttpRequest Error\") )\n }\n evt.statusCode = 0\n return callback(evt, failureResponse)\n }\n\n // will load the data & process the response in a special response object\n function loadFunc() {\n if (aborted) return\n var status\n clearTimeout(timeoutTimer)\n if(options.useXDR && xhr.status===undefined) {\n //IE8 CORS GET successful response doesn't have a status field, but body is fine\n status = 200\n } else {\n status = (xhr.status === 1223 ? 204 : xhr.status)\n }\n var response = failureResponse\n var err = null\n\n if (status !== 0){\n response = {\n body: getBody(),\n statusCode: status,\n method: method,\n headers: {},\n url: uri,\n rawRequest: xhr\n }\n if(xhr.getAllResponseHeaders){ //remember xhr can in fact be XDR for CORS in IE\n response.headers = parseHeaders(xhr.getAllResponseHeaders())\n }\n } else {\n err = new Error(\"Internal XMLHttpRequest Error\")\n }\n return callback(err, response, response.body)\n }\n\n var xhr = options.xhr || null\n\n if (!xhr) {\n if (options.cors || options.useXDR) {\n xhr = new createXHR.XDomainRequest()\n }else{\n xhr = new createXHR.XMLHttpRequest()\n }\n }\n\n var key\n var aborted\n var uri = xhr.url = options.uri || options.url\n var method = xhr.method = options.method || \"GET\"\n var body = options.body || options.data\n var headers = xhr.headers = options.headers || {}\n var sync = !!options.sync\n var isJson = false\n var timeoutTimer\n var failureResponse = {\n body: undefined,\n headers: {},\n statusCode: 0,\n method: method,\n url: uri,\n rawRequest: xhr\n }\n\n if (\"json\" in options && options.json !== false) {\n isJson = true\n headers[\"accept\"] || headers[\"Accept\"] || (headers[\"Accept\"] = \"application/json\") //Don't override existing accept header declared by user\n if (method !== \"GET\" && method !== \"HEAD\") {\n headers[\"content-type\"] || headers[\"Content-Type\"] || (headers[\"Content-Type\"] = \"application/json\") //Don't override existing accept header declared by user\n body = JSON.stringify(options.json === true ? body : options.json)\n }\n }\n\n xhr.onreadystatechange = readystatechange\n xhr.onload = loadFunc\n xhr.onerror = errorFunc\n // IE9 must have onprogress be set to a unique function.\n xhr.onprogress = function () {\n // IE must die\n }\n xhr.onabort = function(){\n aborted = true;\n }\n xhr.ontimeout = errorFunc\n xhr.open(method, uri, !sync, options.username, options.password)\n //has to be after open\n if(!sync) {\n xhr.withCredentials = !!options.withCredentials\n }\n // Cannot set timeout with sync request\n // not setting timeout on the xhr object, because of old webkits etc. not handling that correctly\n // both npm's request and jquery 1.x use this kind of timeout, so this is being consistent\n if (!sync && options.timeout > 0 ) {\n timeoutTimer = setTimeout(function(){\n if (aborted) return\n aborted = true//IE9 may still call readystatechange\n xhr.abort(\"timeout\")\n var e = new Error(\"XMLHttpRequest timeout\")\n e.code = \"ETIMEDOUT\"\n errorFunc(e)\n }, options.timeout )\n }\n\n if (xhr.setRequestHeader) {\n for(key in headers){\n if(headers.hasOwnProperty(key)){\n xhr.setRequestHeader(key, headers[key])\n }\n }\n } else if (options.headers && !isEmpty(options.headers)) {\n throw new Error(\"Headers cannot be set on an XDomainRequest object\")\n }\n\n if (\"responseType\" in options) {\n xhr.responseType = options.responseType\n }\n\n if (\"beforeSend\" in options &&\n typeof options.beforeSend === \"function\"\n ) {\n options.beforeSend(xhr)\n }\n\n // Microsoft Edge browser sends \"undefined\" when send is called with undefined value.\n // XMLHttpRequest spec says to pass null as body to indicate no body\n // See https://github.com/naugtur/xhr/issues/100.\n xhr.send(body || null)\n\n return xhr\n\n\n}\n\nfunction getXml(xhr) {\n // xhr.responseXML will throw Exception \"InvalidStateError\" or \"DOMException\"\n // See https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseXML.\n try {\n if (xhr.responseType === \"document\") {\n return xhr.responseXML\n }\n var firefoxBugTakenEffect = xhr.responseXML && xhr.responseXML.documentElement.nodeName === \"parsererror\"\n if (xhr.responseType === \"\" && !firefoxBugTakenEffect) {\n return xhr.responseXML\n }\n } catch (e) {}\n\n return null\n}\n\nfunction noop() {}\n","module.exports = (function xmlparser() {\n //common browsers\n if (typeof self.DOMParser !== 'undefined') {\n return function(str) {\n var parser = new self.DOMParser()\n return parser.parseFromString(str, 'application/xml')\n }\n } \n\n //IE8 fallback\n if (typeof self.ActiveXObject !== 'undefined'\n && new self.ActiveXObject('Microsoft.XMLDOM')) {\n return function(str) {\n var xmlDoc = new self.ActiveXObject(\"Microsoft.XMLDOM\")\n xmlDoc.async = \"false\"\n xmlDoc.loadXML(str)\n return xmlDoc\n }\n }\n\n //last resort fallback\n return function(str) {\n var div = document.createElement('div')\n div.innerHTML = str\n return div\n }\n})()\n","module.exports = extend\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction extend() {\n var target = {}\n\n for (var i = 0; i < arguments.length; i++) {\n var source = arguments[i]\n\n for (var key in source) {\n if (hasOwnProperty.call(source, key)) {\n target[key] = source[key]\n }\n }\n }\n\n return target\n}\n","var __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __markAsModule = (target) => __defProp(target, \"__esModule\", { value: true });\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __reExport = (target, module2, copyDefault, desc) => {\n if (module2 && typeof module2 === \"object\" || typeof module2 === \"function\") {\n for (let key of __getOwnPropNames(module2))\n if (!__hasOwnProp.call(target, key) && (copyDefault || key !== \"default\"))\n __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });\n }\n return target;\n};\nvar __toCommonJS = /* @__PURE__ */ ((cache) => {\n return (module2, temp) => {\n return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);\n };\n})(typeof WeakMap !== \"undefined\" ? /* @__PURE__ */ new WeakMap() : 0);\nvar __publicField = (obj, key, value) => {\n __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n return value;\n};\n\n// src/index.ts\nvar src_exports = {};\n__export(src_exports, {\n applyPalette: () => applyPalette,\n applyPaletteSync: () => applyPaletteSync,\n buildPalette: () => buildPalette,\n buildPaletteSync: () => buildPaletteSync,\n constants: () => constants_exports,\n conversion: () => conversion_exports,\n distance: () => distance_exports,\n image: () => image_exports,\n palette: () => palette_exports,\n quality: () => quality_exports,\n utils: () => utils_exports\n});\n\n// src/constants/index.ts\nvar constants_exports = {};\n__export(constants_exports, {\n bt709: () => bt709_exports\n});\n\n// src/constants/bt709.ts\nvar bt709_exports = {};\n__export(bt709_exports, {\n Y: () => Y,\n x: () => x,\n y: () => y\n});\nvar Y = /* @__PURE__ */ ((Y2) => {\n Y2[Y2[\"RED\"] = 0.2126] = \"RED\";\n Y2[Y2[\"GREEN\"] = 0.7152] = \"GREEN\";\n Y2[Y2[\"BLUE\"] = 0.0722] = \"BLUE\";\n Y2[Y2[\"WHITE\"] = 1] = \"WHITE\";\n return Y2;\n})(Y || {});\nvar x = /* @__PURE__ */ ((x2) => {\n x2[x2[\"RED\"] = 0.64] = \"RED\";\n x2[x2[\"GREEN\"] = 0.3] = \"GREEN\";\n x2[x2[\"BLUE\"] = 0.15] = \"BLUE\";\n x2[x2[\"WHITE\"] = 0.3127] = \"WHITE\";\n return x2;\n})(x || {});\nvar y = /* @__PURE__ */ ((y2) => {\n y2[y2[\"RED\"] = 0.33] = \"RED\";\n y2[y2[\"GREEN\"] = 0.6] = \"GREEN\";\n y2[y2[\"BLUE\"] = 0.06] = \"BLUE\";\n y2[y2[\"WHITE\"] = 0.329] = \"WHITE\";\n return y2;\n})(y || {});\n\n// src/conversion/index.ts\nvar conversion_exports = {};\n__export(conversion_exports, {\n lab2rgb: () => lab2rgb,\n lab2xyz: () => lab2xyz,\n rgb2hsl: () => rgb2hsl,\n rgb2lab: () => rgb2lab,\n rgb2xyz: () => rgb2xyz,\n xyz2lab: () => xyz2lab,\n xyz2rgb: () => xyz2rgb\n});\n\n// src/conversion/rgb2xyz.ts\nfunction correctGamma(n) {\n return n > 0.04045 ? ((n + 0.055) / 1.055) ** 2.4 : n / 12.92;\n}\nfunction rgb2xyz(r, g, b) {\n r = correctGamma(r / 255);\n g = correctGamma(g / 255);\n b = correctGamma(b / 255);\n return {\n x: r * 0.4124 + g * 0.3576 + b * 0.1805,\n y: r * 0.2126 + g * 0.7152 + b * 0.0722,\n z: r * 0.0193 + g * 0.1192 + b * 0.9505\n };\n}\n\n// src/utils/arithmetic.ts\nvar arithmetic_exports = {};\n__export(arithmetic_exports, {\n degrees2radians: () => degrees2radians,\n inRange0to255: () => inRange0to255,\n inRange0to255Rounded: () => inRange0to255Rounded,\n intInRange: () => intInRange,\n max3: () => max3,\n min3: () => min3,\n stableSort: () => stableSort\n});\nfunction degrees2radians(n) {\n return n * (Math.PI / 180);\n}\nfunction max3(a, b, c) {\n let m = a;\n if (m < b)\n m = b;\n if (m < c)\n m = c;\n return m;\n}\nfunction min3(a, b, c) {\n let m = a;\n if (m > b)\n m = b;\n if (m > c)\n m = c;\n return m;\n}\nfunction intInRange(value, low, high) {\n if (value > high)\n value = high;\n if (value < low)\n value = low;\n return value | 0;\n}\nfunction inRange0to255Rounded(n) {\n n = Math.round(n);\n if (n > 255)\n n = 255;\n else if (n < 0)\n n = 0;\n return n;\n}\nfunction inRange0to255(n) {\n if (n > 255)\n n = 255;\n else if (n < 0)\n n = 0;\n return n;\n}\nfunction stableSort(arrayToSort, callback) {\n const type = typeof arrayToSort[0];\n let sorted;\n if (type === \"number\" || type === \"string\") {\n const ord = /* @__PURE__ */ Object.create(null);\n for (let i = 0, l = arrayToSort.length; i < l; i++) {\n const val = arrayToSort[i];\n if (ord[val] || ord[val] === 0)\n continue;\n ord[val] = i;\n }\n sorted = arrayToSort.sort((a, b) => callback(a, b) || ord[a] - ord[b]);\n } else {\n const ord2 = arrayToSort.slice(0);\n sorted = arrayToSort.sort((a, b) => callback(a, b) || ord2.indexOf(a) - ord2.indexOf(b));\n }\n return sorted;\n}\n\n// src/conversion/rgb2hsl.ts\nfunction rgb2hsl(r, g, b) {\n const min = min3(r, g, b);\n const max = max3(r, g, b);\n const delta = max - min;\n const l = (min + max) / 510;\n let s = 0;\n if (l > 0 && l < 1)\n s = delta / (l < 0.5 ? max + min : 510 - max - min);\n let h = 0;\n if (delta > 0) {\n if (max === r) {\n h = (g - b) / delta;\n } else if (max === g) {\n h = 2 + (b - r) / delta;\n } else {\n h = 4 + (r - g) / delta;\n }\n h *= 60;\n if (h < 0)\n h += 360;\n }\n return { h, s, l };\n}\n\n// src/conversion/xyz2lab.ts\nvar refX = 0.95047;\nvar refY = 1;\nvar refZ = 1.08883;\nfunction pivot(n) {\n return n > 8856e-6 ? n ** (1 / 3) : 7.787 * n + 16 / 116;\n}\nfunction xyz2lab(x2, y2, z) {\n x2 = pivot(x2 / refX);\n y2 = pivot(y2 / refY);\n z = pivot(z / refZ);\n if (116 * y2 - 16 < 0)\n throw new Error(\"xxx\");\n return {\n L: Math.max(0, 116 * y2 - 16),\n a: 500 * (x2 - y2),\n b: 200 * (y2 - z)\n };\n}\n\n// src/conversion/rgb2lab.ts\nfunction rgb2lab(r, g, b) {\n const xyz = rgb2xyz(r, g, b);\n return xyz2lab(xyz.x, xyz.y, xyz.z);\n}\n\n// src/conversion/lab2xyz.ts\nvar refX2 = 0.95047;\nvar refY2 = 1;\nvar refZ2 = 1.08883;\nfunction pivot2(n) {\n return n > 0.206893034 ? n ** 3 : (n - 16 / 116) / 7.787;\n}\nfunction lab2xyz(L, a, b) {\n const y2 = (L + 16) / 116;\n const x2 = a / 500 + y2;\n const z = y2 - b / 200;\n return {\n x: refX2 * pivot2(x2),\n y: refY2 * pivot2(y2),\n z: refZ2 * pivot2(z)\n };\n}\n\n// src/conversion/xyz2rgb.ts\nfunction correctGamma2(n) {\n return n > 31308e-7 ? 1.055 * n ** (1 / 2.4) - 0.055 : 12.92 * n;\n}\nfunction xyz2rgb(x2, y2, z) {\n const r = correctGamma2(x2 * 3.2406 + y2 * -1.5372 + z * -0.4986);\n const g = correctGamma2(x2 * -0.9689 + y2 * 1.8758 + z * 0.0415);\n const b = correctGamma2(x2 * 0.0557 + y2 * -0.204 + z * 1.057);\n return {\n r: inRange0to255Rounded(r * 255),\n g: inRange0to255Rounded(g * 255),\n b: inRange0to255Rounded(b * 255)\n };\n}\n\n// src/conversion/lab2rgb.ts\nfunction lab2rgb(L, a, b) {\n const xyz = lab2xyz(L, a, b);\n return xyz2rgb(xyz.x, xyz.y, xyz.z);\n}\n\n// src/distance/index.ts\nvar distance_exports = {};\n__export(distance_exports, {\n AbstractDistanceCalculator: () => AbstractDistanceCalculator,\n AbstractEuclidean: () => AbstractEuclidean,\n AbstractManhattan: () => AbstractManhattan,\n CIE94GraphicArts: () => CIE94GraphicArts,\n CIE94Textiles: () => CIE94Textiles,\n CIEDE2000: () => CIEDE2000,\n CMetric: () => CMetric,\n Euclidean: () => Euclidean,\n EuclideanBT709: () => EuclideanBT709,\n EuclideanBT709NoAlpha: () => EuclideanBT709NoAlpha,\n Manhattan: () => Manhattan,\n ManhattanBT709: () => ManhattanBT709,\n ManhattanNommyde: () => ManhattanNommyde,\n PNGQuant: () => PNGQuant\n});\n\n// src/distance/distanceCalculator.ts\nvar AbstractDistanceCalculator = class {\n constructor() {\n __publicField(this, \"_maxDistance\");\n __publicField(this, \"_whitePoint\");\n this._setDefaults();\n this.setWhitePoint(255, 255, 255, 255);\n }\n setWhitePoint(r, g, b, a) {\n this._whitePoint = {\n r: r > 0 ? 255 / r : 0,\n g: g > 0 ? 255 / g : 0,\n b: b > 0 ? 255 / b : 0,\n a: a > 0 ? 255 / a : 0\n };\n this._maxDistance = this.calculateRaw(r, g, b, a, 0, 0, 0, 0);\n }\n calculateNormalized(colorA, colorB) {\n return this.calculateRaw(colorA.r, colorA.g, colorA.b, colorA.a, colorB.r, colorB.g, colorB.b, colorB.a) / this._maxDistance;\n }\n};\n\n// src/distance/cie94.ts\nvar AbstractCIE94 = class extends AbstractDistanceCalculator {\n calculateRaw(r1, g1, b1, a1, r2, g2, b2, a2) {\n const lab1 = rgb2lab(inRange0to255(r1 * this._whitePoint.r), inRange0to255(g1 * this._whitePoint.g), inRange0to255(b1 * this._whitePoint.b));\n const lab2 = rgb2lab(inRange0to255(r2 * this._whitePoint.r), inRange0to255(g2 * this._whitePoint.g), inRange0to255(b2 * this._whitePoint.b));\n const dL = lab1.L - lab2.L;\n const dA = lab1.a - lab2.a;\n const dB = lab1.b - lab2.b;\n const c1 = Math.sqrt(lab1.a * lab1.a + lab1.b * lab1.b);\n const c2 = Math.sqrt(lab2.a * lab2.a + lab2.b * lab2.b);\n const dC = c1 - c2;\n let deltaH = dA * dA + dB * dB - dC * dC;\n deltaH = deltaH < 0 ? 0 : Math.sqrt(deltaH);\n const dAlpha = (a2 - a1) * this._whitePoint.a * this._kA;\n return Math.sqrt((dL / this._Kl) ** 2 + (dC / (1 + this._K1 * c1)) ** 2 + (deltaH / (1 + this._K2 * c1)) ** 2 + dAlpha ** 2);\n }\n};\nvar CIE94Textiles = class extends AbstractCIE94 {\n _setDefaults() {\n this._Kl = 2;\n this._K1 = 0.048;\n this._K2 = 0.014;\n this._kA = 0.25 * 50 / 255;\n }\n};\nvar CIE94GraphicArts = class extends AbstractCIE94 {\n _setDefaults() {\n this._Kl = 1;\n this._K1 = 0.045;\n this._K2 = 0.015;\n this._kA = 0.25 * 100 / 255;\n }\n};\n\n// src/distance/ciede2000.ts\nvar _CIEDE2000 = class extends AbstractDistanceCalculator {\n _setDefaults() {\n }\n static _calculatehp(b, ap) {\n const hp = Math.atan2(b, ap);\n if (hp >= 0)\n return hp;\n return hp + _CIEDE2000._deg360InRad;\n }\n static _calculateRT(ahp, aCp) {\n const aCp_to_7 = aCp ** 7;\n const R_C = 2 * Math.sqrt(aCp_to_7 / (aCp_to_7 + _CIEDE2000._pow25to7));\n const delta_theta = _CIEDE2000._deg30InRad * Math.exp(-(((ahp - _CIEDE2000._deg275InRad) / _CIEDE2000._deg25InRad) ** 2));\n return -Math.sin(2 * delta_theta) * R_C;\n }\n static _calculateT(ahp) {\n return 1 - 0.17 * Math.cos(ahp - _CIEDE2000._deg30InRad) + 0.24 * Math.cos(ahp * 2) + 0.32 * Math.cos(ahp * 3 + _CIEDE2000._deg6InRad) - 0.2 * Math.cos(ahp * 4 - _CIEDE2000._deg63InRad);\n }\n static _calculate_ahp(C1pC2p, h_bar, h1p, h2p) {\n const hpSum = h1p + h2p;\n if (C1pC2p === 0)\n return hpSum;\n if (h_bar <= _CIEDE2000._deg180InRad)\n return hpSum / 2;\n if (hpSum < _CIEDE2000._deg360InRad) {\n return (hpSum + _CIEDE2000._deg360InRad) / 2;\n }\n return (hpSum - _CIEDE2000._deg360InRad) / 2;\n }\n static _calculate_dHp(C1pC2p, h_bar, h2p, h1p) {\n let dhp;\n if (C1pC2p === 0) {\n dhp = 0;\n } else if (h_bar <= _CIEDE2000._deg180InRad) {\n dhp = h2p - h1p;\n } else if (h2p <= h1p) {\n dhp = h2p - h1p + _CIEDE2000._deg360InRad;\n } else {\n dhp = h2p - h1p - _CIEDE2000._deg360InRad;\n }\n return 2 * Math.sqrt(C1pC2p) * Math.sin(dhp / 2);\n }\n calculateRaw(r1, g1, b1, a1, r2, g2, b2, a2) {\n const lab1 = rgb2lab(inRange0to255(r1 * this._whitePoint.r), inRange0to255(g1 * this._whitePoint.g), inRange0to255(b1 * this._whitePoint.b));\n const lab2 = rgb2lab(inRange0to255(r2 * this._whitePoint.r), inRange0to255(g2 * this._whitePoint.g), inRange0to255(b2 * this._whitePoint.b));\n const dA = (a2 - a1) * this._whitePoint.a * _CIEDE2000._kA;\n const dE2 = this.calculateRawInLab(lab1, lab2);\n return Math.sqrt(dE2 + dA * dA);\n }\n calculateRawInLab(Lab1, Lab2) {\n const L1 = Lab1.L;\n const a1 = Lab1.a;\n const b1 = Lab1.b;\n const L2 = Lab2.L;\n const a2 = Lab2.a;\n const b2 = Lab2.b;\n const C1 = Math.sqrt(a1 * a1 + b1 * b1);\n const C2 = Math.sqrt(a2 * a2 + b2 * b2);\n const pow_a_C1_C2_to_7 = ((C1 + C2) / 2) ** 7;\n const G = 0.5 * (1 - Math.sqrt(pow_a_C1_C2_to_7 / (pow_a_C1_C2_to_7 + _CIEDE2000._pow25to7)));\n const a1p = (1 + G) * a1;\n const a2p = (1 + G) * a2;\n const C1p = Math.sqrt(a1p * a1p + b1 * b1);\n const C2p = Math.sqrt(a2p * a2p + b2 * b2);\n const C1pC2p = C1p * C2p;\n const h1p = _CIEDE2000._calculatehp(b1, a1p);\n const h2p = _CIEDE2000._calculatehp(b2, a2p);\n const h_bar = Math.abs(h1p - h2p);\n const dLp = L2 - L1;\n const dCp = C2p - C1p;\n const dHp = _CIEDE2000._calculate_dHp(C1pC2p, h_bar, h2p, h1p);\n const ahp = _CIEDE2000._calculate_ahp(C1pC2p, h_bar, h1p, h2p);\n const T = _CIEDE2000._calculateT(ahp);\n const aCp = (C1p + C2p) / 2;\n const aLp_minus_50_square = ((L1 + L2) / 2 - 50) ** 2;\n const S_L = 1 + 0.015 * aLp_minus_50_square / Math.sqrt(20 + aLp_minus_50_square);\n const S_C = 1 + 0.045 * aCp;\n const S_H = 1 + 0.015 * T * aCp;\n const R_T = _CIEDE2000._calculateRT(ahp, aCp);\n const dLpSL = dLp / S_L;\n const dCpSC = dCp / S_C;\n const dHpSH = dHp / S_H;\n return dLpSL ** 2 + dCpSC ** 2 + dHpSH ** 2 + R_T * dCpSC * dHpSH;\n }\n};\nvar CIEDE2000 = _CIEDE2000;\n__publicField(CIEDE2000, \"_kA\", 0.25 * 100 / 255);\n__publicField(CIEDE2000, \"_pow25to7\", 25 ** 7);\n__publicField(CIEDE2000, \"_deg360InRad\", degrees2radians(360));\n__publicField(CIEDE2000, \"_deg180InRad\", degrees2radians(180));\n__publicField(CIEDE2000, \"_deg30InRad\", degrees2radians(30));\n__publicField(CIEDE2000, \"_deg6InRad\", degrees2radians(6));\n__publicField(CIEDE2000, \"_deg63InRad\", degrees2radians(63));\n__publicField(CIEDE2000, \"_deg275InRad\", degrees2radians(275));\n__publicField(CIEDE2000, \"_deg25InRad\", degrees2radians(25));\n\n// src/distance/cmetric.ts\nvar CMetric = class extends AbstractDistanceCalculator {\n calculateRaw(r1, g1, b1, a1, r2, g2, b2, a2) {\n const rmean = (r1 + r2) / 2 * this._whitePoint.r;\n const r = (r1 - r2) * this._whitePoint.r;\n const g = (g1 - g2) * this._whitePoint.g;\n const b = (b1 - b2) * this._whitePoint.b;\n const dE = ((512 + rmean) * r * r >> 8) + 4 * g * g + ((767 - rmean) * b * b >> 8);\n const dA = (a2 - a1) * this._whitePoint.a;\n return Math.sqrt(dE + dA * dA);\n }\n _setDefaults() {\n }\n};\n\n// src/distance/euclidean.ts\nvar AbstractEuclidean = class extends AbstractDistanceCalculator {\n calculateRaw(r1, g1, b1, a1, r2, g2, b2, a2) {\n const dR = r2 - r1;\n const dG = g2 - g1;\n const dB = b2 - b1;\n const dA = a2 - a1;\n return Math.sqrt(this._kR * dR * dR + this._kG * dG * dG + this._kB * dB * dB + this._kA * dA * dA);\n }\n};\nvar Euclidean = class extends AbstractEuclidean {\n _setDefaults() {\n this._kR = 1;\n this._kG = 1;\n this._kB = 1;\n this._kA = 1;\n }\n};\nvar EuclideanBT709 = class extends AbstractEuclidean {\n _setDefaults() {\n this._kR = 0.2126 /* RED */;\n this._kG = 0.7152 /* GREEN */;\n this._kB = 0.0722 /* BLUE */;\n this._kA = 1;\n }\n};\nvar EuclideanBT709NoAlpha = class extends AbstractEuclidean {\n _setDefaults() {\n this._kR = 0.2126 /* RED */;\n this._kG = 0.7152 /* GREEN */;\n this._kB = 0.0722 /* BLUE */;\n this._kA = 0;\n }\n};\n\n// src/distance/manhattan.ts\nvar AbstractManhattan = class extends AbstractDistanceCalculator {\n calculateRaw(r1, g1, b1, a1, r2, g2, b2, a2) {\n let dR = r2 - r1;\n let dG = g2 - g1;\n let dB = b2 - b1;\n let dA = a2 - a1;\n if (dR < 0)\n dR = 0 - dR;\n if (dG < 0)\n dG = 0 - dG;\n if (dB < 0)\n dB = 0 - dB;\n if (dA < 0)\n dA = 0 - dA;\n return this._kR * dR + this._kG * dG + this._kB * dB + this._kA * dA;\n }\n};\nvar Manhattan = class extends AbstractManhattan {\n _setDefaults() {\n this._kR = 1;\n this._kG = 1;\n this._kB = 1;\n this._kA = 1;\n }\n};\nvar ManhattanNommyde = class extends AbstractManhattan {\n _setDefaults() {\n this._kR = 0.4984;\n this._kG = 0.8625;\n this._kB = 0.2979;\n this._kA = 1;\n }\n};\nvar ManhattanBT709 = class extends AbstractManhattan {\n _setDefaults() {\n this._kR = 0.2126 /* RED */;\n this._kG = 0.7152 /* GREEN */;\n this._kB = 0.0722 /* BLUE */;\n this._kA = 1;\n }\n};\n\n// src/distance/pngQuant.ts\nvar PNGQuant = class extends AbstractDistanceCalculator {\n calculateRaw(r1, g1, b1, a1, r2, g2, b2, a2) {\n const alphas = (a2 - a1) * this._whitePoint.a;\n return this._colordifferenceCh(r1 * this._whitePoint.r, r2 * this._whitePoint.r, alphas) + this._colordifferenceCh(g1 * this._whitePoint.g, g2 * this._whitePoint.g, alphas) + this._colordifferenceCh(b1 * this._whitePoint.b, b2 * this._whitePoint.b, alphas);\n }\n _colordifferenceCh(x2, y2, alphas) {\n const black = x2 - y2;\n const white = black + alphas;\n return black * black + white * white;\n }\n _setDefaults() {\n }\n};\n\n// src/palette/index.ts\nvar palette_exports = {};\n__export(palette_exports, {\n AbstractPaletteQuantizer: () => AbstractPaletteQuantizer,\n ColorHistogram: () => ColorHistogram,\n NeuQuant: () => NeuQuant,\n NeuQuantFloat: () => NeuQuantFloat,\n RGBQuant: () => RGBQuant,\n WuColorCube: () => WuColorCube,\n WuQuant: () => WuQuant\n});\n\n// src/palette/paletteQuantizer.ts\nvar AbstractPaletteQuantizer = class {\n quantizeSync() {\n for (const value of this.quantize()) {\n if (value.palette) {\n return value.palette;\n }\n }\n throw new Error(\"unreachable\");\n }\n};\n\n// src/utils/point.ts\nvar Point = class {\n constructor() {\n __publicField(this, \"r\");\n __publicField(this, \"g\");\n __publicField(this, \"b\");\n __publicField(this, \"a\");\n __publicField(this, \"uint32\");\n __publicField(this, \"rgba\");\n this.uint32 = -1 >>> 0;\n this.r = this.g = this.b = this.a = 0;\n this.rgba = new Array(4);\n this.rgba[0] = 0;\n this.rgba[1] = 0;\n this.rgba[2] = 0;\n this.rgba[3] = 0;\n }\n static createByQuadruplet(quadruplet) {\n const point = new Point();\n point.r = quadruplet[0] | 0;\n point.g = quadruplet[1] | 0;\n point.b = quadruplet[2] | 0;\n point.a = quadruplet[3] | 0;\n point._loadUINT32();\n point._loadQuadruplet();\n return point;\n }\n static createByRGBA(red, green, blue, alpha) {\n const point = new Point();\n point.r = red | 0;\n point.g = green | 0;\n point.b = blue | 0;\n point.a = alpha | 0;\n point._loadUINT32();\n point._loadQuadruplet();\n return point;\n }\n static createByUint32(uint32) {\n const point = new Point();\n point.uint32 = uint32 >>> 0;\n point._loadRGBA();\n point._loadQuadruplet();\n return point;\n }\n from(point) {\n this.r = point.r;\n this.g = point.g;\n this.b = point.b;\n this.a = point.a;\n this.uint32 = point.uint32;\n this.rgba[0] = point.r;\n this.rgba[1] = point.g;\n this.rgba[2] = point.b;\n this.rgba[3] = point.a;\n }\n getLuminosity(useAlphaChannel) {\n let r = this.r;\n let g = this.g;\n let b = this.b;\n if (useAlphaChannel) {\n r = Math.min(255, 255 - this.a + this.a * r / 255);\n g = Math.min(255, 255 - this.a + this.a * g / 255);\n b = Math.min(255, 255 - this.a + this.a * b / 255);\n }\n return r * 0.2126 /* RED */ + g * 0.7152 /* GREEN */ + b * 0.0722 /* BLUE */;\n }\n _loadUINT32() {\n this.uint32 = (this.a << 24 | this.b << 16 | this.g << 8 | this.r) >>> 0;\n }\n _loadRGBA() {\n this.r = this.uint32 & 255;\n this.g = this.uint32 >>> 8 & 255;\n this.b = this.uint32 >>> 16 & 255;\n this.a = this.uint32 >>> 24 & 255;\n }\n _loadQuadruplet() {\n this.rgba[0] = this.r;\n this.rgba[1] = this.g;\n this.rgba[2] = this.b;\n this.rgba[3] = this.a;\n }\n};\n\n// src/utils/pointContainer.ts\nvar PointContainer = class {\n constructor() {\n __publicField(this, \"_pointArray\");\n __publicField(this, \"_width\");\n __publicField(this, \"_height\");\n this._width = 0;\n this._height = 0;\n this._pointArray = [];\n }\n getWidth() {\n return this._width;\n }\n getHeight() {\n return this._height;\n }\n setWidth(width) {\n this._width = width;\n }\n setHeight(height) {\n this._height = height;\n }\n getPointArray() {\n return this._pointArray;\n }\n clone() {\n const clone = new PointContainer();\n clone._width = this._width;\n clone._height = this._height;\n for (let i = 0, l = this._pointArray.length; i < l; i++) {\n clone._pointArray[i] = Point.createByUint32(this._pointArray[i].uint32 | 0);\n }\n return clone;\n }\n toUint32Array() {\n const l = this._pointArray.length;\n const uint32Array = new Uint32Array(l);\n for (let i = 0; i < l; i++) {\n uint32Array[i] = this._pointArray[i].uint32;\n }\n return uint32Array;\n }\n toUint8Array() {\n return new Uint8Array(this.toUint32Array().buffer);\n }\n static fromHTMLImageElement(img) {\n const width = img.naturalWidth;\n const height = img.naturalHeight;\n const canvas = document.createElement(\"canvas\");\n canvas.width = width;\n canvas.height = height;\n const ctx = canvas.getContext(\"2d\");\n ctx.drawImage(img, 0, 0, width, height, 0, 0, width, height);\n return PointContainer.fromHTMLCanvasElement(canvas);\n }\n static fromHTMLCanvasElement(canvas) {\n const width = canvas.width;\n const height = canvas.height;\n const ctx = canvas.getContext(\"2d\");\n const imgData = ctx.getImageData(0, 0, width, height);\n return PointContainer.fromImageData(imgData);\n }\n static fromImageData(imageData) {\n const width = imageData.width;\n const height = imageData.height;\n return PointContainer.fromUint8Array(imageData.data, width, height);\n }\n static fromUint8Array(uint8Array, width, height) {\n switch (Object.prototype.toString.call(uint8Array)) {\n case \"[object Uint8ClampedArray]\":\n case \"[object Uint8Array]\":\n break;\n default:\n uint8Array = new Uint8Array(uint8Array);\n }\n const uint32Array = new Uint32Array(uint8Array.buffer);\n return PointContainer.fromUint32Array(uint32Array, width, height);\n }\n static fromUint32Array(uint32Array, width, height) {\n const container = new PointContainer();\n container._width = width;\n container._height = height;\n for (let i = 0, l = uint32Array.length; i < l; i++) {\n container._pointArray[i] = Point.createByUint32(uint32Array[i] | 0);\n }\n return container;\n }\n static fromBuffer(buffer, width, height) {\n const uint32Array = new Uint32Array(buffer.buffer, buffer.byteOffset, buffer.byteLength / Uint32Array.BYTES_PER_ELEMENT);\n return PointContainer.fromUint32Array(uint32Array, width, height);\n }\n};\n\n// src/utils/palette.ts\nvar hueGroups = 10;\nfunction hueGroup(hue, segmentsNumber) {\n const maxHue = 360;\n const seg = maxHue / segmentsNumber;\n const half = seg / 2;\n for (let i = 1, mid = seg - half; i < segmentsNumber; i++, mid += seg) {\n if (hue >= mid && hue < mid + seg)\n return i;\n }\n return 0;\n}\nvar Palette = class {\n constructor() {\n __publicField(this, \"_pointContainer\");\n __publicField(this, \"_pointArray\", []);\n __publicField(this, \"_i32idx\", {});\n this._pointContainer = new PointContainer();\n this._pointContainer.setHeight(1);\n this._pointArray = this._pointContainer.getPointArray();\n }\n add(color) {\n this._pointArray.push(color);\n this._pointContainer.setWidth(this._pointArray.length);\n }\n has(color) {\n for (let i = this._pointArray.length - 1; i >= 0; i--) {\n if (color.uint32 === this._pointArray[i].uint32)\n return true;\n }\n return false;\n }\n getNearestColor(colorDistanceCalculator, color) {\n return this._pointArray[this._getNearestIndex(colorDistanceCalculator, color) | 0];\n }\n getPointContainer() {\n return this._pointContainer;\n }\n _nearestPointFromCache(key) {\n return typeof this._i32idx[key] === \"number\" ? this._i32idx[key] : -1;\n }\n _getNearestIndex(colorDistanceCalculator, point) {\n let idx = this._nearestPointFromCache(\"\" + point.uint32);\n if (idx >= 0)\n return idx;\n let minimalDistance = Number.MAX_VALUE;\n idx = 0;\n for (let i = 0, l = this._pointArray.length; i < l; i++) {\n const p = this._pointArray[i];\n const distance = colorDistanceCalculator.calculateRaw(point.r, point.g, point.b, point.a, p.r, p.g, p.b, p.a);\n if (distance < minimalDistance) {\n minimalDistance = distance;\n idx = i;\n }\n }\n this._i32idx[point.uint32] = idx;\n return idx;\n }\n sort() {\n this._i32idx = {};\n this._pointArray.sort((a, b) => {\n const hslA = rgb2hsl(a.r, a.g, a.b);\n const hslB = rgb2hsl(b.r, b.g, b.b);\n const hueA = a.r === a.g && a.g === a.b ? 0 : 1 + hueGroup(hslA.h, hueGroups);\n const hueB = b.r === b.g && b.g === b.b ? 0 : 1 + hueGroup(hslB.h, hueGroups);\n const hueDiff = hueB - hueA;\n if (hueDiff)\n return -hueDiff;\n const lA = a.getLuminosity(true);\n const lB = b.getLuminosity(true);\n if (lB - lA !== 0)\n return lB - lA;\n const satDiff = (hslB.s * 100 | 0) - (hslA.s * 100 | 0);\n if (satDiff)\n return -satDiff;\n return 0;\n });\n }\n};\n\n// src/utils/index.ts\nvar utils_exports = {};\n__export(utils_exports, {\n HueStatistics: () => HueStatistics,\n Palette: () => Palette,\n Point: () => Point,\n PointContainer: () => PointContainer,\n ProgressTracker: () => ProgressTracker,\n arithmetic: () => arithmetic_exports\n});\n\n// src/utils/hueStatistics.ts\nvar HueGroup = class {\n constructor() {\n __publicField(this, \"num\", 0);\n __publicField(this, \"cols\", []);\n }\n};\nvar HueStatistics = class {\n constructor(numGroups, minCols) {\n __publicField(this, \"_numGroups\");\n __publicField(this, \"_minCols\");\n __publicField(this, \"_stats\");\n __publicField(this, \"_groupsFull\");\n this._numGroups = numGroups;\n this._minCols = minCols;\n this._stats = [];\n for (let i = 0; i <= numGroups; i++) {\n this._stats[i] = new HueGroup();\n }\n this._groupsFull = 0;\n }\n check(i32) {\n if (this._groupsFull === this._numGroups + 1) {\n this.check = () => {\n };\n }\n const r = i32 & 255;\n const g = i32 >>> 8 & 255;\n const b = i32 >>> 16 & 255;\n const hg = r === g && g === b ? 0 : 1 + hueGroup(rgb2hsl(r, g, b).h, this._numGroups);\n const gr = this._stats[hg];\n const min = this._minCols;\n gr.num++;\n if (gr.num > min) {\n return;\n }\n if (gr.num === min) {\n this._groupsFull++;\n }\n if (gr.num <= min) {\n this._stats[hg].cols.push(i32);\n }\n }\n injectIntoDictionary(histG) {\n for (let i = 0; i <= this._numGroups; i++) {\n if (this._stats[i].num <= this._minCols) {\n this._stats[i].cols.forEach((col) => {\n if (!histG[col]) {\n histG[col] = 1;\n } else {\n histG[col]++;\n }\n });\n }\n }\n }\n injectIntoArray(histG) {\n for (let i = 0; i <= this._numGroups; i++) {\n if (this._stats[i].num <= this._minCols) {\n this._stats[i].cols.forEach((col) => {\n if (histG.indexOf(col) === -1) {\n histG.push(col);\n }\n });\n }\n }\n }\n};\n\n// src/utils/progressTracker.ts\nvar _ProgressTracker = class {\n constructor(valueRange, progressRange) {\n __publicField(this, \"progress\");\n __publicField(this, \"_step\");\n __publicField(this, \"_range\");\n __publicField(this, \"_last\");\n __publicField(this, \"_progressRange\");\n this._range = valueRange;\n this._progressRange = progressRange;\n this._step = Math.max(1, this._range / (_ProgressTracker.steps + 1) | 0);\n this._last = -this._step;\n this.progress = 0;\n }\n shouldNotify(current) {\n if (current - this._last >= this._step) {\n this._last = current;\n this.progress = Math.min(this._progressRange * this._last / this._range, this._progressRange);\n return true;\n }\n return false;\n }\n};\nvar ProgressTracker = _ProgressTracker;\n__publicField(ProgressTracker, \"steps\", 100);\n\n// src/palette/neuquant/neuquant.ts\nvar networkBiasShift = 3;\nvar Neuron = class {\n constructor(defaultValue) {\n __publicField(this, \"r\");\n __publicField(this, \"g\");\n __publicField(this, \"b\");\n __publicField(this, \"a\");\n this.r = this.g = this.b = this.a = defaultValue;\n }\n toPoint() {\n return Point.createByRGBA(this.r >> networkBiasShift, this.g >> networkBiasShift, this.b >> networkBiasShift, this.a >> networkBiasShift);\n }\n subtract(r, g, b, a) {\n this.r -= r | 0;\n this.g -= g | 0;\n this.b -= b | 0;\n this.a -= a | 0;\n }\n};\nvar _NeuQuant = class extends AbstractPaletteQuantizer {\n constructor(colorDistanceCalculator, colors = 256) {\n super();\n __publicField(this, \"_pointArray\");\n __publicField(this, \"_networkSize\");\n __publicField(this, \"_network\");\n __publicField(this, \"_sampleFactor\");\n __publicField(this, \"_radPower\");\n __publicField(this, \"_freq\");\n __publicField(this, \"_bias\");\n __publicField(this, \"_distance\");\n this._distance = colorDistanceCalculator;\n this._pointArray = [];\n this._sampleFactor = 1;\n this._networkSize = colors;\n this._distance.setWhitePoint(255 << networkBiasShift, 255 << networkBiasShift, 255 << networkBiasShift, 255 << networkBiasShift);\n }\n sample(pointContainer) {\n this._pointArray = this._pointArray.concat(pointContainer.getPointArray());\n }\n *quantize() {\n this._init();\n yield* this._learn();\n yield {\n palette: this._buildPalette(),\n progress: 100\n };\n }\n _init() {\n this._freq = [];\n this._bias = [];\n this._radPower = [];\n this._network = [];\n for (let i = 0; i < this._networkSize; i++) {\n this._network[i] = new Neuron((i << networkBiasShift + 8) / this._networkSize | 0);\n this._freq[i] = _NeuQuant._initialBias / this._networkSize | 0;\n this._bias[i] = 0;\n }\n }\n *_learn() {\n let sampleFactor = this._sampleFactor;\n const pointsNumber = this._pointArray.length;\n if (pointsNumber < _NeuQuant._minpicturebytes)\n sampleFactor = 1;\n const alphadec = 30 + (sampleFactor - 1) / 3 | 0;\n const pointsToSample = pointsNumber / sampleFactor | 0;\n let delta = pointsToSample / _NeuQuant._nCycles | 0;\n let alpha = _NeuQuant._initAlpha;\n let radius = (this._networkSize >> 3) * _NeuQuant._radiusBias;\n let rad = radius >> _NeuQuant._radiusBiasShift;\n if (rad <= 1)\n rad = 0;\n for (let i = 0; i < rad; i++) {\n this._radPower[i] = alpha * ((rad * rad - i * i) * _NeuQuant._radBias / (rad * rad)) >>> 0;\n }\n let step;\n if (pointsNumber < _NeuQuant._minpicturebytes) {\n step = 1;\n } else if (pointsNumber % _NeuQuant._prime1 !== 0) {\n step = _NeuQuant._prime1;\n } else if (pointsNumber % _NeuQuant._prime2 !== 0) {\n step = _NeuQuant._prime2;\n } else if (pointsNumber % _NeuQuant._prime3 !== 0) {\n step = _NeuQuant._prime3;\n } else {\n step = _NeuQuant._prime4;\n }\n const tracker = new ProgressTracker(pointsToSample, 99);\n for (let i = 0, pointIndex = 0; i < pointsToSample; ) {\n if (tracker.shouldNotify(i)) {\n yield {\n progress: tracker.progress\n };\n }\n const point = this._pointArray[pointIndex];\n const b = point.b << networkBiasShift;\n const g = point.g << networkBiasShift;\n const r = point.r << networkBiasShift;\n const a = point.a << networkBiasShift;\n const neuronIndex = this._contest(b, g, r, a);\n this._alterSingle(alpha, neuronIndex, b, g, r, a);\n if (rad !== 0)\n this._alterNeighbour(rad, neuronIndex, b, g, r, a);\n pointIndex += step;\n if (pointIndex >= pointsNumber)\n pointIndex -= pointsNumber;\n i++;\n if (delta === 0)\n delta = 1;\n if (i % delta === 0) {\n alpha -= alpha / alphadec | 0;\n radius -= radius / _NeuQuant._radiusDecrease | 0;\n rad = radius >> _NeuQuant._radiusBiasShift;\n if (rad <= 1)\n rad = 0;\n for (let j = 0; j < rad; j++) {\n this._radPower[j] = alpha * ((rad * rad - j * j) * _NeuQuant._radBias / (rad * rad)) >>> 0;\n }\n }\n }\n }\n _buildPalette() {\n const palette = new Palette();\n this._network.forEach((neuron) => {\n palette.add(neuron.toPoint());\n });\n palette.sort();\n return palette;\n }\n _alterNeighbour(rad, i, b, g, r, al) {\n let lo = i - rad;\n if (lo < -1)\n lo = -1;\n let hi = i + rad;\n if (hi > this._networkSize)\n hi = this._networkSize;\n let j = i + 1;\n let k = i - 1;\n let m = 1;\n while (j < hi || k > lo) {\n const a = this._radPower[m++] / _NeuQuant._alphaRadBias;\n if (j < hi) {\n const p = this._network[j++];\n p.subtract(a * (p.r - r), a * (p.g - g), a * (p.b - b), a * (p.a - al));\n }\n if (k > lo) {\n const p = this._network[k--];\n p.subtract(a * (p.r - r), a * (p.g - g), a * (p.b - b), a * (p.a - al));\n }\n }\n }\n _alterSingle(alpha, i, b, g, r, a) {\n alpha /= _NeuQuant._initAlpha;\n const n = this._network[i];\n n.subtract(alpha * (n.r - r), alpha * (n.g - g), alpha * (n.b - b), alpha * (n.a - a));\n }\n _contest(b, g, r, a) {\n const multiplier = 255 * 4 << networkBiasShift;\n let bestd = ~(1 << 31);\n let bestbiasd = bestd;\n let bestpos = -1;\n let bestbiaspos = bestpos;\n for (let i = 0; i < this._networkSize; i++) {\n const n = this._network[i];\n const dist = this._distance.calculateNormalized(n, { r, g, b, a }) * multiplier | 0;\n if (dist < bestd) {\n bestd = dist;\n bestpos = i;\n }\n const biasdist = dist - (this._bias[i] >> _NeuQuant._initialBiasShift - networkBiasShift);\n if (biasdist < bestbiasd) {\n bestbiasd = biasdist;\n bestbiaspos = i;\n }\n const betafreq = this._freq[i] >> _NeuQuant._betaShift;\n this._freq[i] -= betafreq;\n this._bias[i] += betafreq << _NeuQuant._gammaShift;\n }\n this._freq[bestpos] += _NeuQuant._beta;\n this._bias[bestpos] -= _NeuQuant._betaGamma;\n return bestbiaspos;\n }\n};\nvar NeuQuant = _NeuQuant;\n__publicField(NeuQuant, \"_prime1\", 499);\n__publicField(NeuQuant, \"_prime2\", 491);\n__publicField(NeuQuant, \"_prime3\", 487);\n__publicField(NeuQuant, \"_prime4\", 503);\n__publicField(NeuQuant, \"_minpicturebytes\", _NeuQuant._prime4);\n__publicField(NeuQuant, \"_nCycles\", 100);\n__publicField(NeuQuant, \"_initialBiasShift\", 16);\n__publicField(NeuQuant, \"_initialBias\", 1 << _NeuQuant._initialBiasShift);\n__publicField(NeuQuant, \"_gammaShift\", 10);\n__publicField(NeuQuant, \"_betaShift\", 10);\n__publicField(NeuQuant, \"_beta\", _NeuQuant._initialBias >> _NeuQuant._betaShift);\n__publicField(NeuQuant, \"_betaGamma\", _NeuQuant._initialBias << _NeuQuant._gammaShift - _NeuQuant._betaShift);\n__publicField(NeuQuant, \"_radiusBiasShift\", 6);\n__publicField(NeuQuant, \"_radiusBias\", 1 << _NeuQuant._radiusBiasShift);\n__publicField(NeuQuant, \"_radiusDecrease\", 30);\n__publicField(NeuQuant, \"_alphaBiasShift\", 10);\n__publicField(NeuQuant, \"_initAlpha\", 1 << _NeuQuant._alphaBiasShift);\n__publicField(NeuQuant, \"_radBiasShift\", 8);\n__publicField(NeuQuant, \"_radBias\", 1 << _NeuQuant._radBiasShift);\n__publicField(NeuQuant, \"_alphaRadBiasShift\", _NeuQuant._alphaBiasShift + _NeuQuant._radBiasShift);\n__publicField(NeuQuant, \"_alphaRadBias\", 1 << _NeuQuant._alphaRadBiasShift);\n\n// src/palette/neuquant/neuquantFloat.ts\nvar networkBiasShift2 = 3;\nvar NeuronFloat = class {\n constructor(defaultValue) {\n __publicField(this, \"r\");\n __publicField(this, \"g\");\n __publicField(this, \"b\");\n __publicField(this, \"a\");\n this.r = this.g = this.b = this.a = defaultValue;\n }\n toPoint() {\n return Point.createByRGBA(this.r >> networkBiasShift2, this.g >> networkBiasShift2, this.b >> networkBiasShift2, this.a >> networkBiasShift2);\n }\n subtract(r, g, b, a) {\n this.r -= r;\n this.g -= g;\n this.b -= b;\n this.a -= a;\n }\n};\nvar _NeuQuantFloat = class extends AbstractPaletteQuantizer {\n constructor(colorDistanceCalculator, colors = 256) {\n super();\n __publicField(this, \"_pointArray\");\n __publicField(this, \"_networkSize\");\n __publicField(this, \"_network\");\n __publicField(this, \"_sampleFactor\");\n __publicField(this, \"_radPower\");\n __publicField(this, \"_freq\");\n __publicField(this, \"_bias\");\n __publicField(this, \"_distance\");\n this._distance = colorDistanceCalculator;\n this._pointArray = [];\n this._sampleFactor = 1;\n this._networkSize = colors;\n this._distance.setWhitePoint(255 << networkBiasShift2, 255 << networkBiasShift2, 255 << networkBiasShift2, 255 << networkBiasShift2);\n }\n sample(pointContainer) {\n this._pointArray = this._pointArray.concat(pointContainer.getPointArray());\n }\n *quantize() {\n this._init();\n yield* this._learn();\n yield {\n palette: this._buildPalette(),\n progress: 100\n };\n }\n _init() {\n this._freq = [];\n this._bias = [];\n this._radPower = [];\n this._network = [];\n for (let i = 0; i < this._networkSize; i++) {\n this._network[i] = new NeuronFloat((i << networkBiasShift2 + 8) / this._networkSize);\n this._freq[i] = _NeuQuantFloat._initialBias / this._networkSize;\n this._bias[i] = 0;\n }\n }\n *_learn() {\n let sampleFactor = this._sampleFactor;\n const pointsNumber = this._pointArray.length;\n if (pointsNumber < _NeuQuantFloat._minpicturebytes)\n sampleFactor = 1;\n const alphadec = 30 + (sampleFactor - 1) / 3;\n const pointsToSample = pointsNumber / sampleFactor;\n let delta = pointsToSample / _NeuQuantFloat._nCycles | 0;\n let alpha = _NeuQuantFloat._initAlpha;\n let radius = (this._networkSize >> 3) * _NeuQuantFloat._radiusBias;\n let rad = radius >> _NeuQuantFloat._radiusBiasShift;\n if (rad <= 1)\n rad = 0;\n for (let i = 0; i < rad; i++) {\n this._radPower[i] = alpha * ((rad * rad - i * i) * _NeuQuantFloat._radBias / (rad * rad));\n }\n let step;\n if (pointsNumber < _NeuQuantFloat._minpicturebytes) {\n step = 1;\n } else if (pointsNumber % _NeuQuantFloat._prime1 !== 0) {\n step = _NeuQuantFloat._prime1;\n } else if (pointsNumber % _NeuQuantFloat._prime2 !== 0) {\n step = _NeuQuantFloat._prime2;\n } else if (pointsNumber % _NeuQuantFloat._prime3 !== 0) {\n step = _NeuQuantFloat._prime3;\n } else {\n step = _NeuQuantFloat._prime4;\n }\n const tracker = new ProgressTracker(pointsToSample, 99);\n for (let i = 0, pointIndex = 0; i < pointsToSample; ) {\n if (tracker.shouldNotify(i)) {\n yield {\n progress: tracker.progress\n };\n }\n const point = this._pointArray[pointIndex];\n const b = point.b << networkBiasShift2;\n const g = point.g << networkBiasShift2;\n const r = point.r << networkBiasShift2;\n const a = point.a << networkBiasShift2;\n const neuronIndex = this._contest(b, g, r, a);\n this._alterSingle(alpha, neuronIndex, b, g, r, a);\n if (rad !== 0)\n this._alterNeighbour(rad, neuronIndex, b, g, r, a);\n pointIndex += step;\n if (pointIndex >= pointsNumber)\n pointIndex -= pointsNumber;\n i++;\n if (delta === 0)\n delta = 1;\n if (i % delta === 0) {\n alpha -= alpha / alphadec;\n radius -= radius / _NeuQuantFloat._radiusDecrease;\n rad = radius >> _NeuQuantFloat._radiusBiasShift;\n if (rad <= 1)\n rad = 0;\n for (let j = 0; j < rad; j++) {\n this._radPower[j] = alpha * ((rad * rad - j * j) * _NeuQuantFloat._radBias / (rad * rad));\n }\n }\n }\n }\n _buildPalette() {\n const palette = new Palette();\n this._network.forEach((neuron) => {\n palette.add(neuron.toPoint());\n });\n palette.sort();\n return palette;\n }\n _alterNeighbour(rad, i, b, g, r, al) {\n let lo = i - rad;\n if (lo < -1)\n lo = -1;\n let hi = i + rad;\n if (hi > this._networkSize)\n hi = this._networkSize;\n let j = i + 1;\n let k = i - 1;\n let m = 1;\n while (j < hi || k > lo) {\n const a = this._radPower[m++] / _NeuQuantFloat._alphaRadBias;\n if (j < hi) {\n const p = this._network[j++];\n p.subtract(a * (p.r - r), a * (p.g - g), a * (p.b - b), a * (p.a - al));\n }\n if (k > lo) {\n const p = this._network[k--];\n p.subtract(a * (p.r - r), a * (p.g - g), a * (p.b - b), a * (p.a - al));\n }\n }\n }\n _alterSingle(alpha, i, b, g, r, a) {\n alpha /= _NeuQuantFloat._initAlpha;\n const n = this._network[i];\n n.subtract(alpha * (n.r - r), alpha * (n.g - g), alpha * (n.b - b), alpha * (n.a - a));\n }\n _contest(b, g, r, al) {\n const multiplier = 255 * 4 << networkBiasShift2;\n let bestd = ~(1 << 31);\n let bestbiasd = bestd;\n let bestpos = -1;\n let bestbiaspos = bestpos;\n for (let i = 0; i < this._networkSize; i++) {\n const n = this._network[i];\n const dist = this._distance.calculateNormalized(n, { r, g, b, a: al }) * multiplier;\n if (dist < bestd) {\n bestd = dist;\n bestpos = i;\n }\n const biasdist = dist - (this._bias[i] >> _NeuQuantFloat._initialBiasShift - networkBiasShift2);\n if (biasdist < bestbiasd) {\n bestbiasd = biasdist;\n bestbiaspos = i;\n }\n const betafreq = this._freq[i] >> _NeuQuantFloat._betaShift;\n this._freq[i] -= betafreq;\n this._bias[i] += betafreq << _NeuQuantFloat._gammaShift;\n }\n this._freq[bestpos] += _NeuQuantFloat._beta;\n this._bias[bestpos] -= _NeuQuantFloat._betaGamma;\n return bestbiaspos;\n }\n};\nvar NeuQuantFloat = _NeuQuantFloat;\n__publicField(NeuQuantFloat, \"_prime1\", 499);\n__publicField(NeuQuantFloat, \"_prime2\", 491);\n__publicField(NeuQuantFloat, \"_prime3\", 487);\n__publicField(NeuQuantFloat, \"_prime4\", 503);\n__publicField(NeuQuantFloat, \"_minpicturebytes\", _NeuQuantFloat._prime4);\n__publicField(NeuQuantFloat, \"_nCycles\", 100);\n__publicField(NeuQuantFloat, \"_initialBiasShift\", 16);\n__publicField(NeuQuantFloat, \"_initialBias\", 1 << _NeuQuantFloat._initialBiasShift);\n__publicField(NeuQuantFloat, \"_gammaShift\", 10);\n__publicField(NeuQuantFloat, \"_betaShift\", 10);\n__publicField(NeuQuantFloat, \"_beta\", _NeuQuantFloat._initialBias >> _NeuQuantFloat._betaShift);\n__publicField(NeuQuantFloat, \"_betaGamma\", _NeuQuantFloat._initialBias << _NeuQuantFloat._gammaShift - _NeuQuantFloat._betaShift);\n__publicField(NeuQuantFloat, \"_radiusBiasShift\", 6);\n__publicField(NeuQuantFloat, \"_radiusBias\", 1 << _NeuQuantFloat._radiusBiasShift);\n__publicField(NeuQuantFloat, \"_radiusDecrease\", 30);\n__publicField(NeuQuantFloat, \"_alphaBiasShift\", 10);\n__publicField(NeuQuantFloat, \"_initAlpha\", 1 << _NeuQuantFloat._alphaBiasShift);\n__publicField(NeuQuantFloat, \"_radBiasShift\", 8);\n__publicField(NeuQuantFloat, \"_radBias\", 1 << _NeuQuantFloat._radBiasShift);\n__publicField(NeuQuantFloat, \"_alphaRadBiasShift\", _NeuQuantFloat._alphaBiasShift + _NeuQuantFloat._radBiasShift);\n__publicField(NeuQuantFloat, \"_alphaRadBias\", 1 << _NeuQuantFloat._alphaRadBiasShift);\n\n// src/palette/rgbquant/colorHistogram.ts\nvar _ColorHistogram = class {\n constructor(method, colors) {\n __publicField(this, \"_method\");\n __publicField(this, \"_hueStats\");\n __publicField(this, \"_histogram\");\n __publicField(this, \"_initColors\");\n __publicField(this, \"_minHueCols\");\n this._method = method;\n this._minHueCols = colors << 2;\n this._initColors = colors << 2;\n this._hueStats = new HueStatistics(_ColorHistogram._hueGroups, this._minHueCols);\n this._histogram = /* @__PURE__ */ Object.create(null);\n }\n sample(pointContainer) {\n switch (this._method) {\n case 1:\n this._colorStats1D(pointContainer);\n break;\n case 2:\n this._colorStats2D(pointContainer);\n break;\n }\n }\n getImportanceSortedColorsIDXI32() {\n const sorted = stableSort(Object.keys(this._histogram), (a, b) => this._histogram[b] - this._histogram[a]);\n if (sorted.length === 0) {\n return [];\n }\n let idxi32;\n switch (this._method) {\n case 1:\n const initialColorsLimit = Math.min(sorted.length, this._initColors);\n const last = sorted[initialColorsLimit - 1];\n const freq = this._histogram[last];\n idxi32 = sorted.slice(0, initialColorsLimit);\n let pos = initialColorsLimit;\n const len = sorted.length;\n while (pos < len && this._histogram[sorted[pos]] === freq) {\n idxi32.push(sorted[pos++]);\n }\n this._hueStats.injectIntoArray(idxi32);\n break;\n case 2:\n idxi32 = sorted;\n break;\n default:\n throw new Error(\"Incorrect method\");\n }\n return idxi32.map((v) => +v);\n }\n _colorStats1D(pointContainer) {\n const histG = this._histogram;\n const pointArray = pointContainer.getPointArray();\n const len = pointArray.length;\n for (let i = 0; i < len; i++) {\n const col = pointArray[i].uint32;\n this._hueStats.check(col);\n if (col in histG) {\n histG[col]++;\n } else {\n histG[col] = 1;\n }\n }\n }\n _colorStats2D(pointContainer) {\n const width = pointContainer.getWidth();\n const height = pointContainer.getHeight();\n const pointArray = pointContainer.getPointArray();\n const boxW = _ColorHistogram._boxSize[0];\n const boxH = _ColorHistogram._boxSize[1];\n const area = boxW * boxH;\n const boxes = this._makeBoxes(width, height, boxW, boxH);\n const histG = this._histogram;\n boxes.forEach((box) => {\n let effc = Math.round(box.w * box.h / area) * _ColorHistogram._boxPixels;\n if (effc < 2)\n effc = 2;\n const histL = {};\n this._iterateBox(box, width, (i) => {\n const col = pointArray[i].uint32;\n this._hueStats.check(col);\n if (col in histG) {\n histG[col]++;\n } else if (col in histL) {\n if (++histL[col] >= effc) {\n histG[col] = histL[col];\n }\n } else {\n histL[col] = 1;\n }\n });\n });\n this._hueStats.injectIntoDictionary(histG);\n }\n _iterateBox(bbox, wid, fn) {\n const b = bbox;\n const i0 = b.y * wid + b.x;\n const i1 = (b.y + b.h - 1) * wid + (b.x + b.w - 1);\n const incr = wid - b.w + 1;\n let cnt = 0;\n let i = i0;\n do {\n fn.call(this, i);\n i += ++cnt % b.w === 0 ? incr : 1;\n } while (i <= i1);\n }\n _makeBoxes(width, height, stepX, stepY) {\n const wrem = width % stepX;\n const hrem = height % stepY;\n const xend = width - wrem;\n const yend = height - hrem;\n const boxesArray = [];\n for (let y2 = 0; y2 < height; y2 += stepY) {\n for (let x2 = 0; x2 < width; x2 += stepX) {\n boxesArray.push({\n x: x2,\n y: y2,\n w: x2 === xend ? wrem : stepX,\n h: y2 === yend ? hrem : stepY\n });\n }\n }\n return boxesArray;\n }\n};\nvar ColorHistogram = _ColorHistogram;\n__publicField(ColorHistogram, \"_boxSize\", [64, 64]);\n__publicField(ColorHistogram, \"_boxPixels\", 2);\n__publicField(ColorHistogram, \"_hueGroups\", 10);\n\n// src/palette/rgbquant/rgbquant.ts\nvar RemovedColor = class {\n constructor(index, color, distance) {\n __publicField(this, \"index\");\n __publicField(this, \"color\");\n __publicField(this, \"distance\");\n this.index = index;\n this.color = color;\n this.distance = distance;\n }\n};\nvar RGBQuant = class extends AbstractPaletteQuantizer {\n constructor(colorDistanceCalculator, colors = 256, method = 2) {\n super();\n __publicField(this, \"_colors\");\n __publicField(this, \"_initialDistance\");\n __publicField(this, \"_distanceIncrement\");\n __publicField(this, \"_histogram\");\n __publicField(this, \"_distance\");\n this._distance = colorDistanceCalculator;\n this._colors = colors;\n this._histogram = new ColorHistogram(method, colors);\n this._initialDistance = 0.01;\n this._distanceIncrement = 5e-3;\n }\n sample(image) {\n this._histogram.sample(image);\n }\n *quantize() {\n const idxi32 = this._histogram.getImportanceSortedColorsIDXI32();\n if (idxi32.length === 0) {\n throw new Error(\"No colors in image\");\n }\n yield* this._buildPalette(idxi32);\n }\n *_buildPalette(idxi32) {\n const palette = new Palette();\n const colorArray = palette.getPointContainer().getPointArray();\n const usageArray = new Array(idxi32.length);\n for (let i = 0; i < idxi32.length; i++) {\n colorArray.push(Point.createByUint32(idxi32[i]));\n usageArray[i] = 1;\n }\n const len = colorArray.length;\n const memDist = [];\n let palLen = len;\n let thold = this._initialDistance;\n const tracker = new ProgressTracker(palLen - this._colors, 99);\n while (palLen > this._colors) {\n memDist.length = 0;\n for (let i = 0; i < len; i++) {\n if (tracker.shouldNotify(len - palLen)) {\n yield {\n progress: tracker.progress\n };\n }\n if (usageArray[i] === 0)\n continue;\n const pxi = colorArray[i];\n for (let j = i + 1; j < len; j++) {\n if (usageArray[j] === 0)\n continue;\n const pxj = colorArray[j];\n const dist = this._distance.calculateNormalized(pxi, pxj);\n if (dist < thold) {\n memDist.push(new RemovedColor(j, pxj, dist));\n usageArray[j] = 0;\n palLen--;\n }\n }\n }\n thold += palLen > this._colors * 3 ? this._initialDistance : this._distanceIncrement;\n }\n if (palLen < this._colors) {\n stableSort(memDist, (a, b) => b.distance - a.distance);\n let k = 0;\n while (palLen < this._colors && k < memDist.length) {\n const removedColor = memDist[k];\n usageArray[removedColor.index] = 1;\n palLen++;\n k++;\n }\n }\n let colors = colorArray.length;\n for (let colorIndex = colors - 1; colorIndex >= 0; colorIndex--) {\n if (usageArray[colorIndex] === 0) {\n if (colorIndex !== colors - 1) {\n colorArray[colorIndex] = colorArray[colors - 1];\n }\n --colors;\n }\n }\n colorArray.length = colors;\n palette.sort();\n yield {\n palette,\n progress: 100\n };\n }\n};\n\n// src/palette/wu/wuQuant.ts\nfunction createArray1D(dimension1) {\n const a = [];\n for (let k = 0; k < dimension1; k++) {\n a[k] = 0;\n }\n return a;\n}\nfunction createArray4D(dimension1, dimension2, dimension3, dimension4) {\n const a = new Array(dimension1);\n for (let i = 0; i < dimension1; i++) {\n a[i] = new Array(dimension2);\n for (let j = 0; j < dimension2; j++) {\n a[i][j] = new Array(dimension3);\n for (let k = 0; k < dimension3; k++) {\n a[i][j][k] = new Array(dimension4);\n for (let l = 0; l < dimension4; l++) {\n a[i][j][k][l] = 0;\n }\n }\n }\n }\n return a;\n}\nfunction createArray3D(dimension1, dimension2, dimension3) {\n const a = new Array(dimension1);\n for (let i = 0; i < dimension1; i++) {\n a[i] = new Array(dimension2);\n for (let j = 0; j < dimension2; j++) {\n a[i][j] = new Array(dimension3);\n for (let k = 0; k < dimension3; k++) {\n a[i][j][k] = 0;\n }\n }\n }\n return a;\n}\nfunction fillArray3D(a, dimension1, dimension2, dimension3, value) {\n for (let i = 0; i < dimension1; i++) {\n a[i] = [];\n for (let j = 0; j < dimension2; j++) {\n a[i][j] = [];\n for (let k = 0; k < dimension3; k++) {\n a[i][j][k] = value;\n }\n }\n }\n}\nfunction fillArray1D(a, dimension1, value) {\n for (let i = 0; i < dimension1; i++) {\n a[i] = value;\n }\n}\nvar WuColorCube = class {\n constructor() {\n __publicField(this, \"redMinimum\");\n __publicField(this, \"redMaximum\");\n __publicField(this, \"greenMinimum\");\n __publicField(this, \"greenMaximum\");\n __publicField(this, \"blueMinimum\");\n __publicField(this, \"blueMaximum\");\n __publicField(this, \"volume\");\n __publicField(this, \"alphaMinimum\");\n __publicField(this, \"alphaMaximum\");\n }\n};\nvar _WuQuant = class extends AbstractPaletteQuantizer {\n constructor(colorDistanceCalculator, colors = 256, significantBitsPerChannel = 5) {\n super();\n __publicField(this, \"_reds\");\n __publicField(this, \"_greens\");\n __publicField(this, \"_blues\");\n __publicField(this, \"_alphas\");\n __publicField(this, \"_sums\");\n __publicField(this, \"_weights\");\n __publicField(this, \"_momentsRed\");\n __publicField(this, \"_momentsGreen\");\n __publicField(this, \"_momentsBlue\");\n __publicField(this, \"_momentsAlpha\");\n __publicField(this, \"_moments\");\n __publicField(this, \"_table\");\n __publicField(this, \"_pixels\");\n __publicField(this, \"_cubes\");\n __publicField(this, \"_colors\");\n __publicField(this, \"_significantBitsPerChannel\");\n __publicField(this, \"_maxSideIndex\");\n __publicField(this, \"_alphaMaxSideIndex\");\n __publicField(this, \"_sideSize\");\n __publicField(this, \"_alphaSideSize\");\n __publicField(this, \"_distance\");\n this._distance = colorDistanceCalculator;\n this._setQuality(significantBitsPerChannel);\n this._initialize(colors);\n }\n sample(image) {\n const pointArray = image.getPointArray();\n for (let i = 0, l = pointArray.length; i < l; i++) {\n this._addColor(pointArray[i]);\n }\n this._pixels = this._pixels.concat(pointArray);\n }\n *quantize() {\n yield* this._preparePalette();\n const palette = new Palette();\n for (let paletteIndex = 0; paletteIndex < this._colors; paletteIndex++) {\n if (this._sums[paletteIndex] > 0) {\n const sum = this._sums[paletteIndex];\n const r = this._reds[paletteIndex] / sum;\n const g = this._greens[paletteIndex] / sum;\n const b = this._blues[paletteIndex] / sum;\n const a = this._alphas[paletteIndex] / sum;\n const color = Point.createByRGBA(r | 0, g | 0, b | 0, a | 0);\n palette.add(color);\n }\n }\n palette.sort();\n yield {\n palette,\n progress: 100\n };\n }\n *_preparePalette() {\n yield* this._calculateMoments();\n let next = 0;\n const volumeVariance = createArray1D(this._colors);\n for (let cubeIndex = 1; cubeIndex < this._colors; ++cubeIndex) {\n if (this._cut(this._cubes[next], this._cubes[cubeIndex])) {\n volumeVariance[next] = this._cubes[next].volume > 1 ? this._calculateVariance(this._cubes[next]) : 0;\n volumeVariance[cubeIndex] = this._cubes[cubeIndex].volume > 1 ? this._calculateVariance(this._cubes[cubeIndex]) : 0;\n } else {\n volumeVariance[next] = 0;\n cubeIndex--;\n }\n next = 0;\n let temp = volumeVariance[0];\n for (let index = 1; index <= cubeIndex; ++index) {\n if (volumeVariance[index] > temp) {\n temp = volumeVariance[index];\n next = index;\n }\n }\n if (temp <= 0) {\n this._colors = cubeIndex + 1;\n break;\n }\n }\n const lookupRed = [];\n const lookupGreen = [];\n const lookupBlue = [];\n const lookupAlpha = [];\n for (let k = 0; k < this._colors; ++k) {\n const weight = _WuQuant._volume(this._cubes[k], this._weights);\n if (weight > 0) {\n lookupRed[k] = _WuQuant._volume(this._cubes[k], this._momentsRed) / weight | 0;\n lookupGreen[k] = _WuQuant._volume(this._cubes[k], this._momentsGreen) / weight | 0;\n lookupBlue[k] = _WuQuant._volume(this._cubes[k], this._momentsBlue) / weight | 0;\n lookupAlpha[k] = _WuQuant._volume(this._cubes[k], this._momentsAlpha) / weight | 0;\n } else {\n lookupRed[k] = 0;\n lookupGreen[k] = 0;\n lookupBlue[k] = 0;\n lookupAlpha[k] = 0;\n }\n }\n this._reds = createArray1D(this._colors + 1);\n this._greens = createArray1D(this._colors + 1);\n this._blues = createArray1D(this._colors + 1);\n this._alphas = createArray1D(this._colors + 1);\n this._sums = createArray1D(this._colors + 1);\n for (let index = 0, l = this._pixels.length; index < l; index++) {\n const color = this._pixels[index];\n const match = -1;\n let bestMatch = match;\n let bestDistance = Number.MAX_VALUE;\n for (let lookup = 0; lookup < this._colors; lookup++) {\n const foundRed = lookupRed[lookup];\n const foundGreen = lookupGreen[lookup];\n const foundBlue = lookupBlue[lookup];\n const foundAlpha = lookupAlpha[lookup];\n const distance = this._distance.calculateRaw(foundRed, foundGreen, foundBlue, foundAlpha, color.r, color.g, color.b, color.a);\n if (distance < bestDistance) {\n bestDistance = distance;\n bestMatch = lookup;\n }\n }\n this._reds[bestMatch] += color.r;\n this._greens[bestMatch] += color.g;\n this._blues[bestMatch] += color.b;\n this._alphas[bestMatch] += color.a;\n this._sums[bestMatch]++;\n }\n }\n _addColor(color) {\n const bitsToRemove = 8 - this._significantBitsPerChannel;\n const indexRed = (color.r >> bitsToRemove) + 1;\n const indexGreen = (color.g >> bitsToRemove) + 1;\n const indexBlue = (color.b >> bitsToRemove) + 1;\n const indexAlpha = (color.a >> bitsToRemove) + 1;\n this._weights[indexAlpha][indexRed][indexGreen][indexBlue]++;\n this._momentsRed[indexAlpha][indexRed][indexGreen][indexBlue] += color.r;\n this._momentsGreen[indexAlpha][indexRed][indexGreen][indexBlue] += color.g;\n this._momentsBlue[indexAlpha][indexRed][indexGreen][indexBlue] += color.b;\n this._momentsAlpha[indexAlpha][indexRed][indexGreen][indexBlue] += color.a;\n this._moments[indexAlpha][indexRed][indexGreen][indexBlue] += this._table[color.r] + this._table[color.g] + this._table[color.b] + this._table[color.a];\n }\n *_calculateMoments() {\n const area = [];\n const areaRed = [];\n const areaGreen = [];\n const areaBlue = [];\n const areaAlpha = [];\n const area2 = [];\n const xarea = createArray3D(this._sideSize, this._sideSize, this._sideSize);\n const xareaRed = createArray3D(this._sideSize, this._sideSize, this._sideSize);\n const xareaGreen = createArray3D(this._sideSize, this._sideSize, this._sideSize);\n const xareaBlue = createArray3D(this._sideSize, this._sideSize, this._sideSize);\n const xareaAlpha = createArray3D(this._sideSize, this._sideSize, this._sideSize);\n const xarea2 = createArray3D(this._sideSize, this._sideSize, this._sideSize);\n let trackerProgress = 0;\n const tracker = new ProgressTracker(this._alphaMaxSideIndex * this._maxSideIndex, 99);\n for (let alphaIndex = 1; alphaIndex <= this._alphaMaxSideIndex; ++alphaIndex) {\n fillArray3D(xarea, this._sideSize, this._sideSize, this._sideSize, 0);\n fillArray3D(xareaRed, this._sideSize, this._sideSize, this._sideSize, 0);\n fillArray3D(xareaGreen, this._sideSize, this._sideSize, this._sideSize, 0);\n fillArray3D(xareaBlue, this._sideSize, this._sideSize, this._sideSize, 0);\n fillArray3D(xareaAlpha, this._sideSize, this._sideSize, this._sideSize, 0);\n fillArray3D(xarea2, this._sideSize, this._sideSize, this._sideSize, 0);\n for (let redIndex = 1; redIndex <= this._maxSideIndex; ++redIndex, ++trackerProgress) {\n if (tracker.shouldNotify(trackerProgress)) {\n yield {\n progress: tracker.progress\n };\n }\n fillArray1D(area, this._sideSize, 0);\n fillArray1D(areaRed, this._sideSize, 0);\n fillArray1D(areaGreen, this._sideSize, 0);\n fillArray1D(areaBlue, this._sideSize, 0);\n fillArray1D(areaAlpha, this._sideSize, 0);\n fillArray1D(area2, this._sideSize, 0);\n for (let greenIndex = 1; greenIndex <= this._maxSideIndex; ++greenIndex) {\n let line = 0;\n let lineRed = 0;\n let lineGreen = 0;\n let lineBlue = 0;\n let lineAlpha = 0;\n let line2 = 0;\n for (let blueIndex = 1; blueIndex <= this._maxSideIndex; ++blueIndex) {\n line += this._weights[alphaIndex][redIndex][greenIndex][blueIndex];\n lineRed += this._momentsRed[alphaIndex][redIndex][greenIndex][blueIndex];\n lineGreen += this._momentsGreen[alphaIndex][redIndex][greenIndex][blueIndex];\n lineBlue += this._momentsBlue[alphaIndex][redIndex][greenIndex][blueIndex];\n lineAlpha += this._momentsAlpha[alphaIndex][redIndex][greenIndex][blueIndex];\n line2 += this._moments[alphaIndex][redIndex][greenIndex][blueIndex];\n area[blueIndex] += line;\n areaRed[blueIndex] += lineRed;\n areaGreen[blueIndex] += lineGreen;\n areaBlue[blueIndex] += lineBlue;\n areaAlpha[blueIndex] += lineAlpha;\n area2[blueIndex] += line2;\n xarea[redIndex][greenIndex][blueIndex] = xarea[redIndex - 1][greenIndex][blueIndex] + area[blueIndex];\n xareaRed[redIndex][greenIndex][blueIndex] = xareaRed[redIndex - 1][greenIndex][blueIndex] + areaRed[blueIndex];\n xareaGreen[redIndex][greenIndex][blueIndex] = xareaGreen[redIndex - 1][greenIndex][blueIndex] + areaGreen[blueIndex];\n xareaBlue[redIndex][greenIndex][blueIndex] = xareaBlue[redIndex - 1][greenIndex][blueIndex] + areaBlue[blueIndex];\n xareaAlpha[redIndex][greenIndex][blueIndex] = xareaAlpha[redIndex - 1][greenIndex][blueIndex] + areaAlpha[blueIndex];\n xarea2[redIndex][greenIndex][blueIndex] = xarea2[redIndex - 1][greenIndex][blueIndex] + area2[blueIndex];\n this._weights[alphaIndex][redIndex][greenIndex][blueIndex] = this._weights[alphaIndex - 1][redIndex][greenIndex][blueIndex] + xarea[redIndex][greenIndex][blueIndex];\n this._momentsRed[alphaIndex][redIndex][greenIndex][blueIndex] = this._momentsRed[alphaIndex - 1][redIndex][greenIndex][blueIndex] + xareaRed[redIndex][greenIndex][blueIndex];\n this._momentsGreen[alphaIndex][redIndex][greenIndex][blueIndex] = this._momentsGreen[alphaIndex - 1][redIndex][greenIndex][blueIndex] + xareaGreen[redIndex][greenIndex][blueIndex];\n this._momentsBlue[alphaIndex][redIndex][greenIndex][blueIndex] = this._momentsBlue[alphaIndex - 1][redIndex][greenIndex][blueIndex] + xareaBlue[redIndex][greenIndex][blueIndex];\n this._momentsAlpha[alphaIndex][redIndex][greenIndex][blueIndex] = this._momentsAlpha[alphaIndex - 1][redIndex][greenIndex][blueIndex] + xareaAlpha[redIndex][greenIndex][blueIndex];\n this._moments[alphaIndex][redIndex][greenIndex][blueIndex] = this._moments[alphaIndex - 1][redIndex][greenIndex][blueIndex] + xarea2[redIndex][greenIndex][blueIndex];\n }\n }\n }\n }\n }\n static _volumeFloat(cube, moment) {\n return moment[cube.alphaMaximum][cube.redMaximum][cube.greenMaximum][cube.blueMaximum] - moment[cube.alphaMaximum][cube.redMaximum][cube.greenMinimum][cube.blueMaximum] - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMaximum][cube.blueMaximum] + moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][cube.blueMaximum] - moment[cube.alphaMinimum][cube.redMaximum][cube.greenMaximum][cube.blueMaximum] + moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][cube.blueMaximum] + moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][cube.blueMaximum] - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMaximum] - (moment[cube.alphaMaximum][cube.redMaximum][cube.greenMaximum][cube.blueMinimum] - moment[cube.alphaMinimum][cube.redMaximum][cube.greenMaximum][cube.blueMinimum] - moment[cube.alphaMaximum][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] + moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] + moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] + moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum] - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum]);\n }\n static _volume(cube, moment) {\n return _WuQuant._volumeFloat(cube, moment) | 0;\n }\n static _top(cube, direction, position, moment) {\n let result;\n switch (direction) {\n case _WuQuant._alpha:\n result = moment[position][cube.redMaximum][cube.greenMaximum][cube.blueMaximum] - moment[position][cube.redMaximum][cube.greenMinimum][cube.blueMaximum] - moment[position][cube.redMinimum][cube.greenMaximum][cube.blueMaximum] + moment[position][cube.redMinimum][cube.greenMinimum][cube.blueMaximum] - (moment[position][cube.redMaximum][cube.greenMaximum][cube.blueMinimum] - moment[position][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] - moment[position][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] + moment[position][cube.redMinimum][cube.greenMinimum][cube.blueMinimum]);\n break;\n case _WuQuant._red:\n result = moment[cube.alphaMaximum][position][cube.greenMaximum][cube.blueMaximum] - moment[cube.alphaMaximum][position][cube.greenMinimum][cube.blueMaximum] - moment[cube.alphaMinimum][position][cube.greenMaximum][cube.blueMaximum] + moment[cube.alphaMinimum][position][cube.greenMinimum][cube.blueMaximum] - (moment[cube.alphaMaximum][position][cube.greenMaximum][cube.blueMinimum] - moment[cube.alphaMaximum][position][cube.greenMinimum][cube.blueMinimum] - moment[cube.alphaMinimum][position][cube.greenMaximum][cube.blueMinimum] + moment[cube.alphaMinimum][position][cube.greenMinimum][cube.blueMinimum]);\n break;\n case _WuQuant._green:\n result = moment[cube.alphaMaximum][cube.redMaximum][position][cube.blueMaximum] - moment[cube.alphaMaximum][cube.redMinimum][position][cube.blueMaximum] - moment[cube.alphaMinimum][cube.redMaximum][position][cube.blueMaximum] + moment[cube.alphaMinimum][cube.redMinimum][position][cube.blueMaximum] - (moment[cube.alphaMaximum][cube.redMaximum][position][cube.blueMinimum] - moment[cube.alphaMaximum][cube.redMinimum][position][cube.blueMinimum] - moment[cube.alphaMinimum][cube.redMaximum][position][cube.blueMinimum] + moment[cube.alphaMinimum][cube.redMinimum][position][cube.blueMinimum]);\n break;\n case _WuQuant._blue:\n result = moment[cube.alphaMaximum][cube.redMaximum][cube.greenMaximum][position] - moment[cube.alphaMaximum][cube.redMaximum][cube.greenMinimum][position] - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMaximum][position] + moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][position] - (moment[cube.alphaMinimum][cube.redMaximum][cube.greenMaximum][position] - moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][position] - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][position] + moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][position]);\n break;\n default:\n throw new Error(\"impossible\");\n }\n return result | 0;\n }\n static _bottom(cube, direction, moment) {\n switch (direction) {\n case _WuQuant._alpha:\n return -moment[cube.alphaMinimum][cube.redMaximum][cube.greenMaximum][cube.blueMaximum] + moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][cube.blueMaximum] + moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][cube.blueMaximum] - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMaximum] - (-moment[cube.alphaMinimum][cube.redMaximum][cube.greenMaximum][cube.blueMinimum] + moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] + moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum]);\n case _WuQuant._red:\n return -moment[cube.alphaMaximum][cube.redMinimum][cube.greenMaximum][cube.blueMaximum] + moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][cube.blueMaximum] + moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][cube.blueMaximum] - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMaximum] - (-moment[cube.alphaMaximum][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] + moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum] + moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum]);\n case _WuQuant._green:\n return -moment[cube.alphaMaximum][cube.redMaximum][cube.greenMinimum][cube.blueMaximum] + moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][cube.blueMaximum] + moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][cube.blueMaximum] - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMaximum] - (-moment[cube.alphaMaximum][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] + moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum] + moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum]);\n case _WuQuant._blue:\n return -moment[cube.alphaMaximum][cube.redMaximum][cube.greenMaximum][cube.blueMinimum] + moment[cube.alphaMaximum][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] + moment[cube.alphaMaximum][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] - moment[cube.alphaMaximum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum] - (-moment[cube.alphaMinimum][cube.redMaximum][cube.greenMaximum][cube.blueMinimum] + moment[cube.alphaMinimum][cube.redMaximum][cube.greenMinimum][cube.blueMinimum] + moment[cube.alphaMinimum][cube.redMinimum][cube.greenMaximum][cube.blueMinimum] - moment[cube.alphaMinimum][cube.redMinimum][cube.greenMinimum][cube.blueMinimum]);\n default:\n return 0;\n }\n }\n _calculateVariance(cube) {\n const volumeRed = _WuQuant._volume(cube, this._momentsRed);\n const volumeGreen = _WuQuant._volume(cube, this._momentsGreen);\n const volumeBlue = _WuQuant._volume(cube, this._momentsBlue);\n const volumeAlpha = _WuQuant._volume(cube, this._momentsAlpha);\n const volumeMoment = _WuQuant._volumeFloat(cube, this._moments);\n const volumeWeight = _WuQuant._volume(cube, this._weights);\n const distance = volumeRed * volumeRed + volumeGreen * volumeGreen + volumeBlue * volumeBlue + volumeAlpha * volumeAlpha;\n return volumeMoment - distance / volumeWeight;\n }\n _maximize(cube, direction, first, last, wholeRed, wholeGreen, wholeBlue, wholeAlpha, wholeWeight) {\n const bottomRed = _WuQuant._bottom(cube, direction, this._momentsRed) | 0;\n const bottomGreen = _WuQuant._bottom(cube, direction, this._momentsGreen) | 0;\n const bottomBlue = _WuQuant._bottom(cube, direction, this._momentsBlue) | 0;\n const bottomAlpha = _WuQuant._bottom(cube, direction, this._momentsAlpha) | 0;\n const bottomWeight = _WuQuant._bottom(cube, direction, this._weights) | 0;\n let result = 0;\n let cutPosition = -1;\n for (let position = first; position < last; ++position) {\n let halfRed = bottomRed + _WuQuant._top(cube, direction, position, this._momentsRed);\n let halfGreen = bottomGreen + _WuQuant._top(cube, direction, position, this._momentsGreen);\n let halfBlue = bottomBlue + _WuQuant._top(cube, direction, position, this._momentsBlue);\n let halfAlpha = bottomAlpha + _WuQuant._top(cube, direction, position, this._momentsAlpha);\n let halfWeight = bottomWeight + _WuQuant._top(cube, direction, position, this._weights);\n if (halfWeight !== 0) {\n let halfDistance = halfRed * halfRed + halfGreen * halfGreen + halfBlue * halfBlue + halfAlpha * halfAlpha;\n let temp = halfDistance / halfWeight;\n halfRed = wholeRed - halfRed;\n halfGreen = wholeGreen - halfGreen;\n halfBlue = wholeBlue - halfBlue;\n halfAlpha = wholeAlpha - halfAlpha;\n halfWeight = wholeWeight - halfWeight;\n if (halfWeight !== 0) {\n halfDistance = halfRed * halfRed + halfGreen * halfGreen + halfBlue * halfBlue + halfAlpha * halfAlpha;\n temp += halfDistance / halfWeight;\n if (temp > result) {\n result = temp;\n cutPosition = position;\n }\n }\n }\n }\n return { max: result, position: cutPosition };\n }\n _cut(first, second) {\n let direction;\n const wholeRed = _WuQuant._volume(first, this._momentsRed);\n const wholeGreen = _WuQuant._volume(first, this._momentsGreen);\n const wholeBlue = _WuQuant._volume(first, this._momentsBlue);\n const wholeAlpha = _WuQuant._volume(first, this._momentsAlpha);\n const wholeWeight = _WuQuant._volume(first, this._weights);\n const red = this._maximize(first, _WuQuant._red, first.redMinimum + 1, first.redMaximum, wholeRed, wholeGreen, wholeBlue, wholeAlpha, wholeWeight);\n const green = this._maximize(first, _WuQuant._green, first.greenMinimum + 1, first.greenMaximum, wholeRed, wholeGreen, wholeBlue, wholeAlpha, wholeWeight);\n const blue = this._maximize(first, _WuQuant._blue, first.blueMinimum + 1, first.blueMaximum, wholeRed, wholeGreen, wholeBlue, wholeAlpha, wholeWeight);\n const alpha = this._maximize(first, _WuQuant._alpha, first.alphaMinimum + 1, first.alphaMaximum, wholeRed, wholeGreen, wholeBlue, wholeAlpha, wholeWeight);\n if (alpha.max >= red.max && alpha.max >= green.max && alpha.max >= blue.max) {\n direction = _WuQuant._alpha;\n if (alpha.position < 0)\n return false;\n } else if (red.max >= alpha.max && red.max >= green.max && red.max >= blue.max) {\n direction = _WuQuant._red;\n } else if (green.max >= alpha.max && green.max >= red.max && green.max >= blue.max) {\n direction = _WuQuant._green;\n } else {\n direction = _WuQuant._blue;\n }\n second.redMaximum = first.redMaximum;\n second.greenMaximum = first.greenMaximum;\n second.blueMaximum = first.blueMaximum;\n second.alphaMaximum = first.alphaMaximum;\n switch (direction) {\n case _WuQuant._red:\n second.redMinimum = first.redMaximum = red.position;\n second.greenMinimum = first.greenMinimum;\n second.blueMinimum = first.blueMinimum;\n second.alphaMinimum = first.alphaMinimum;\n break;\n case _WuQuant._green:\n second.greenMinimum = first.greenMaximum = green.position;\n second.redMinimum = first.redMinimum;\n second.blueMinimum = first.blueMinimum;\n second.alphaMinimum = first.alphaMinimum;\n break;\n case _WuQuant._blue:\n second.blueMinimum = first.blueMaximum = blue.position;\n second.redMinimum = first.redMinimum;\n second.greenMinimum = first.greenMinimum;\n second.alphaMinimum = first.alphaMinimum;\n break;\n case _WuQuant._alpha:\n second.alphaMinimum = first.alphaMaximum = alpha.position;\n second.blueMinimum = first.blueMinimum;\n second.redMinimum = first.redMinimum;\n second.greenMinimum = first.greenMinimum;\n break;\n }\n first.volume = (first.redMaximum - first.redMinimum) * (first.greenMaximum - first.greenMinimum) * (first.blueMaximum - first.blueMinimum) * (first.alphaMaximum - first.alphaMinimum);\n second.volume = (second.redMaximum - second.redMinimum) * (second.greenMaximum - second.greenMinimum) * (second.blueMaximum - second.blueMinimum) * (second.alphaMaximum - second.alphaMinimum);\n return true;\n }\n _initialize(colors) {\n this._colors = colors;\n this._cubes = [];\n for (let cubeIndex = 0; cubeIndex < colors; cubeIndex++) {\n this._cubes[cubeIndex] = new WuColorCube();\n }\n this._cubes[0].redMinimum = 0;\n this._cubes[0].greenMinimum = 0;\n this._cubes[0].blueMinimum = 0;\n this._cubes[0].alphaMinimum = 0;\n this._cubes[0].redMaximum = this._maxSideIndex;\n this._cubes[0].greenMaximum = this._maxSideIndex;\n this._cubes[0].blueMaximum = this._maxSideIndex;\n this._cubes[0].alphaMaximum = this._alphaMaxSideIndex;\n this._weights = createArray4D(this._alphaSideSize, this._sideSize, this._sideSize, this._sideSize);\n this._momentsRed = createArray4D(this._alphaSideSize, this._sideSize, this._sideSize, this._sideSize);\n this._momentsGreen = createArray4D(this._alphaSideSize, this._sideSize, this._sideSize, this._sideSize);\n this._momentsBlue = createArray4D(this._alphaSideSize, this._sideSize, this._sideSize, this._sideSize);\n this._momentsAlpha = createArray4D(this._alphaSideSize, this._sideSize, this._sideSize, this._sideSize);\n this._moments = createArray4D(this._alphaSideSize, this._sideSize, this._sideSize, this._sideSize);\n this._table = [];\n for (let tableIndex = 0; tableIndex < 256; ++tableIndex) {\n this._table[tableIndex] = tableIndex * tableIndex;\n }\n this._pixels = [];\n }\n _setQuality(significantBitsPerChannel = 5) {\n this._significantBitsPerChannel = significantBitsPerChannel;\n this._maxSideIndex = 1 << this._significantBitsPerChannel;\n this._alphaMaxSideIndex = this._maxSideIndex;\n this._sideSize = this._maxSideIndex + 1;\n this._alphaSideSize = this._alphaMaxSideIndex + 1;\n }\n};\nvar WuQuant = _WuQuant;\n__publicField(WuQuant, \"_alpha\", 3);\n__publicField(WuQuant, \"_red\", 2);\n__publicField(WuQuant, \"_green\", 1);\n__publicField(WuQuant, \"_blue\", 0);\n\n// src/image/index.ts\nvar image_exports = {};\n__export(image_exports, {\n AbstractImageQuantizer: () => AbstractImageQuantizer,\n ErrorDiffusionArray: () => ErrorDiffusionArray,\n ErrorDiffusionArrayKernel: () => ErrorDiffusionArrayKernel,\n ErrorDiffusionRiemersma: () => ErrorDiffusionRiemersma,\n NearestColor: () => NearestColor\n});\n\n// src/image/imageQuantizer.ts\nvar AbstractImageQuantizer = class {\n quantizeSync(pointContainer, palette) {\n for (const value of this.quantize(pointContainer, palette)) {\n if (value.pointContainer) {\n return value.pointContainer;\n }\n }\n throw new Error(\"unreachable\");\n }\n};\n\n// src/image/nearestColor.ts\nvar NearestColor = class extends AbstractImageQuantizer {\n constructor(colorDistanceCalculator) {\n super();\n __publicField(this, \"_distance\");\n this._distance = colorDistanceCalculator;\n }\n *quantize(pointContainer, palette) {\n const pointArray = pointContainer.getPointArray();\n const width = pointContainer.getWidth();\n const height = pointContainer.getHeight();\n const tracker = new ProgressTracker(height, 99);\n for (let y2 = 0; y2 < height; y2++) {\n if (tracker.shouldNotify(y2)) {\n yield {\n progress: tracker.progress\n };\n }\n for (let x2 = 0, idx = y2 * width; x2 < width; x2++, idx++) {\n const point = pointArray[idx];\n point.from(palette.getNearestColor(this._distance, point));\n }\n }\n yield {\n pointContainer,\n progress: 100\n };\n }\n};\n\n// src/image/array.ts\nvar ErrorDiffusionArrayKernel = /* @__PURE__ */ ((ErrorDiffusionArrayKernel2) => {\n ErrorDiffusionArrayKernel2[ErrorDiffusionArrayKernel2[\"FloydSteinberg\"] = 0] = \"FloydSteinberg\";\n ErrorDiffusionArrayKernel2[ErrorDiffusionArrayKernel2[\"FalseFloydSteinberg\"] = 1] = \"FalseFloydSteinberg\";\n ErrorDiffusionArrayKernel2[ErrorDiffusionArrayKernel2[\"Stucki\"] = 2] = \"Stucki\";\n ErrorDiffusionArrayKernel2[ErrorDiffusionArrayKernel2[\"Atkinson\"] = 3] = \"Atkinson\";\n ErrorDiffusionArrayKernel2[ErrorDiffusionArrayKernel2[\"Jarvis\"] = 4] = \"Jarvis\";\n ErrorDiffusionArrayKernel2[ErrorDiffusionArrayKernel2[\"Burkes\"] = 5] = \"Burkes\";\n ErrorDiffusionArrayKernel2[ErrorDiffusionArrayKernel2[\"Sierra\"] = 6] = \"Sierra\";\n ErrorDiffusionArrayKernel2[ErrorDiffusionArrayKernel2[\"TwoSierra\"] = 7] = \"TwoSierra\";\n ErrorDiffusionArrayKernel2[ErrorDiffusionArrayKernel2[\"SierraLite\"] = 8] = \"SierraLite\";\n return ErrorDiffusionArrayKernel2;\n})(ErrorDiffusionArrayKernel || {});\nvar ErrorDiffusionArray = class extends AbstractImageQuantizer {\n constructor(colorDistanceCalculator, kernel, serpentine = true, minimumColorDistanceToDither = 0, calculateErrorLikeGIMP = false) {\n super();\n __publicField(this, \"_minColorDistance\");\n __publicField(this, \"_serpentine\");\n __publicField(this, \"_kernel\");\n __publicField(this, \"_calculateErrorLikeGIMP\");\n __publicField(this, \"_distance\");\n this._setKernel(kernel);\n this._distance = colorDistanceCalculator;\n this._minColorDistance = minimumColorDistanceToDither;\n this._serpentine = serpentine;\n this._calculateErrorLikeGIMP = calculateErrorLikeGIMP;\n }\n *quantize(pointContainer, palette) {\n const pointArray = pointContainer.getPointArray();\n const originalPoint = new Point();\n const width = pointContainer.getWidth();\n const height = pointContainer.getHeight();\n const errorLines = [];\n let dir = 1;\n let maxErrorLines = 1;\n for (const kernel of this._kernel) {\n const kernelErrorLines = kernel[2] + 1;\n if (maxErrorLines < kernelErrorLines)\n maxErrorLines = kernelErrorLines;\n }\n for (let i = 0; i < maxErrorLines; i++) {\n this._fillErrorLine(errorLines[i] = [], width);\n }\n const tracker = new ProgressTracker(height, 99);\n for (let y2 = 0; y2 < height; y2++) {\n if (tracker.shouldNotify(y2)) {\n yield {\n progress: tracker.progress\n };\n }\n if (this._serpentine)\n dir *= -1;\n const lni = y2 * width;\n const xStart = dir === 1 ? 0 : width - 1;\n const xEnd = dir === 1 ? width : -1;\n this._fillErrorLine(errorLines[0], width);\n errorLines.push(errorLines.shift());\n const errorLine = errorLines[0];\n for (let x2 = xStart, idx = lni + xStart; x2 !== xEnd; x2 += dir, idx += dir) {\n const point = pointArray[idx];\n const error = errorLine[x2];\n originalPoint.from(point);\n const correctedPoint = Point.createByRGBA(inRange0to255Rounded(point.r + error[0]), inRange0to255Rounded(point.g + error[1]), inRange0to255Rounded(point.b + error[2]), inRange0to255Rounded(point.a + error[3]));\n const palettePoint = palette.getNearestColor(this._distance, correctedPoint);\n point.from(palettePoint);\n if (this._minColorDistance) {\n const dist = this._distance.calculateNormalized(originalPoint, palettePoint);\n if (dist < this._minColorDistance)\n continue;\n }\n let er;\n let eg;\n let eb;\n let ea;\n if (this._calculateErrorLikeGIMP) {\n er = correctedPoint.r - palettePoint.r;\n eg = correctedPoint.g - palettePoint.g;\n eb = correctedPoint.b - palettePoint.b;\n ea = correctedPoint.a - palettePoint.a;\n } else {\n er = originalPoint.r - palettePoint.r;\n eg = originalPoint.g - palettePoint.g;\n eb = originalPoint.b - palettePoint.b;\n ea = originalPoint.a - palettePoint.a;\n }\n const dStart = dir === 1 ? 0 : this._kernel.length - 1;\n const dEnd = dir === 1 ? this._kernel.length : -1;\n for (let i = dStart; i !== dEnd; i += dir) {\n const x1 = this._kernel[i][1] * dir;\n const y1 = this._kernel[i][2];\n if (x1 + x2 >= 0 && x1 + x2 < width && y1 + y2 >= 0 && y1 + y2 < height) {\n const d = this._kernel[i][0];\n const e = errorLines[y1][x1 + x2];\n e[0] += er * d;\n e[1] += eg * d;\n e[2] += eb * d;\n e[3] += ea * d;\n }\n }\n }\n }\n yield {\n pointContainer,\n progress: 100\n };\n }\n _fillErrorLine(errorLine, width) {\n if (errorLine.length > width) {\n errorLine.length = width;\n }\n const l = errorLine.length;\n for (let i = 0; i < l; i++) {\n const error = errorLine[i];\n error[0] = error[1] = error[2] = error[3] = 0;\n }\n for (let i = l; i < width; i++) {\n errorLine[i] = [0, 0, 0, 0];\n }\n }\n _setKernel(kernel) {\n switch (kernel) {\n case 0 /* FloydSteinberg */:\n this._kernel = [\n [7 / 16, 1, 0],\n [3 / 16, -1, 1],\n [5 / 16, 0, 1],\n [1 / 16, 1, 1]\n ];\n break;\n case 1 /* FalseFloydSteinberg */:\n this._kernel = [\n [3 / 8, 1, 0],\n [3 / 8, 0, 1],\n [2 / 8, 1, 1]\n ];\n break;\n case 2 /* Stucki */:\n this._kernel = [\n [8 / 42, 1, 0],\n [4 / 42, 2, 0],\n [2 / 42, -2, 1],\n [4 / 42, -1, 1],\n [8 / 42, 0, 1],\n [4 / 42, 1, 1],\n [2 / 42, 2, 1],\n [1 / 42, -2, 2],\n [2 / 42, -1, 2],\n [4 / 42, 0, 2],\n [2 / 42, 1, 2],\n [1 / 42, 2, 2]\n ];\n break;\n case 3 /* Atkinson */:\n this._kernel = [\n [1 / 8, 1, 0],\n [1 / 8, 2, 0],\n [1 / 8, -1, 1],\n [1 / 8, 0, 1],\n [1 / 8, 1, 1],\n [1 / 8, 0, 2]\n ];\n break;\n case 4 /* Jarvis */:\n this._kernel = [\n [7 / 48, 1, 0],\n [5 / 48, 2, 0],\n [3 / 48, -2, 1],\n [5 / 48, -1, 1],\n [7 / 48, 0, 1],\n [5 / 48, 1, 1],\n [3 / 48, 2, 1],\n [1 / 48, -2, 2],\n [3 / 48, -1, 2],\n [5 / 48, 0, 2],\n [3 / 48, 1, 2],\n [1 / 48, 2, 2]\n ];\n break;\n case 5 /* Burkes */:\n this._kernel = [\n [8 / 32, 1, 0],\n [4 / 32, 2, 0],\n [2 / 32, -2, 1],\n [4 / 32, -1, 1],\n [8 / 32, 0, 1],\n [4 / 32, 1, 1],\n [2 / 32, 2, 1]\n ];\n break;\n case 6 /* Sierra */:\n this._kernel = [\n [5 / 32, 1, 0],\n [3 / 32, 2, 0],\n [2 / 32, -2, 1],\n [4 / 32, -1, 1],\n [5 / 32, 0, 1],\n [4 / 32, 1, 1],\n [2 / 32, 2, 1],\n [2 / 32, -1, 2],\n [3 / 32, 0, 2],\n [2 / 32, 1, 2]\n ];\n break;\n case 7 /* TwoSierra */:\n this._kernel = [\n [4 / 16, 1, 0],\n [3 / 16, 2, 0],\n [1 / 16, -2, 1],\n [2 / 16, -1, 1],\n [3 / 16, 0, 1],\n [2 / 16, 1, 1],\n [1 / 16, 2, 1]\n ];\n break;\n case 8 /* SierraLite */:\n this._kernel = [\n [2 / 4, 1, 0],\n [1 / 4, -1, 1],\n [1 / 4, 0, 1]\n ];\n break;\n default:\n throw new Error(`ErrorDiffusionArray: unknown kernel = ${kernel}`);\n }\n }\n};\n\n// src/image/spaceFillingCurves/hilbertCurve.ts\nfunction* hilbertCurve(width, height, callback) {\n const maxBound = Math.max(width, height);\n const level = Math.floor(Math.log(maxBound) / Math.log(2) + 1);\n const tracker = new ProgressTracker(width * height, 99);\n const data = {\n width,\n height,\n level,\n callback,\n tracker,\n index: 0,\n x: 0,\n y: 0\n };\n yield* walkHilbert(data, 1 /* UP */);\n visit(data, 0 /* NONE */);\n}\nfunction* walkHilbert(data, direction) {\n if (data.level < 1)\n return;\n if (data.tracker.shouldNotify(data.index)) {\n yield { progress: data.tracker.progress };\n }\n data.level--;\n switch (direction) {\n case 2 /* LEFT */:\n yield* walkHilbert(data, 1 /* UP */);\n visit(data, 3 /* RIGHT */);\n yield* walkHilbert(data, 2 /* LEFT */);\n visit(data, 4 /* DOWN */);\n yield* walkHilbert(data, 2 /* LEFT */);\n visit(data, 2 /* LEFT */);\n yield* walkHilbert(data, 4 /* DOWN */);\n break;\n case 3 /* RIGHT */:\n yield* walkHilbert(data, 4 /* DOWN */);\n visit(data, 2 /* LEFT */);\n yield* walkHilbert(data, 3 /* RIGHT */);\n visit(data, 1 /* UP */);\n yield* walkHilbert(data, 3 /* RIGHT */);\n visit(data, 3 /* RIGHT */);\n yield* walkHilbert(data, 1 /* UP */);\n break;\n case 1 /* UP */:\n yield* walkHilbert(data, 2 /* LEFT */);\n visit(data, 4 /* DOWN */);\n yield* walkHilbert(data, 1 /* UP */);\n visit(data, 3 /* RIGHT */);\n yield* walkHilbert(data, 1 /* UP */);\n visit(data, 1 /* UP */);\n yield* walkHilbert(data, 3 /* RIGHT */);\n break;\n case 4 /* DOWN */:\n yield* walkHilbert(data, 3 /* RIGHT */);\n visit(data, 1 /* UP */);\n yield* walkHilbert(data, 4 /* DOWN */);\n visit(data, 2 /* LEFT */);\n yield* walkHilbert(data, 4 /* DOWN */);\n visit(data, 4 /* DOWN */);\n yield* walkHilbert(data, 2 /* LEFT */);\n break;\n default:\n break;\n }\n data.level++;\n}\nfunction visit(data, direction) {\n if (data.x >= 0 && data.x < data.width && data.y >= 0 && data.y < data.height) {\n data.callback(data.x, data.y);\n data.index++;\n }\n switch (direction) {\n case 2 /* LEFT */:\n data.x--;\n break;\n case 3 /* RIGHT */:\n data.x++;\n break;\n case 1 /* UP */:\n data.y--;\n break;\n case 4 /* DOWN */:\n data.y++;\n break;\n }\n}\n\n// src/image/riemersma.ts\nvar ErrorDiffusionRiemersma = class extends AbstractImageQuantizer {\n constructor(colorDistanceCalculator, errorQueueSize = 16, errorPropagation = 1) {\n super();\n __publicField(this, \"_distance\");\n __publicField(this, \"_weights\");\n __publicField(this, \"_errorQueueSize\");\n this._distance = colorDistanceCalculator;\n this._errorQueueSize = errorQueueSize;\n this._weights = ErrorDiffusionRiemersma._createWeights(errorPropagation, errorQueueSize);\n }\n *quantize(pointContainer, palette) {\n const pointArray = pointContainer.getPointArray();\n const width = pointContainer.getWidth();\n const height = pointContainer.getHeight();\n const errorQueue = [];\n let head = 0;\n for (let i = 0; i < this._errorQueueSize; i++) {\n errorQueue[i] = { r: 0, g: 0, b: 0, a: 0 };\n }\n yield* hilbertCurve(width, height, (x2, y2) => {\n const p = pointArray[x2 + y2 * width];\n let { r, g, b, a } = p;\n for (let i = 0; i < this._errorQueueSize; i++) {\n const weight = this._weights[i];\n const e = errorQueue[(i + head) % this._errorQueueSize];\n r += e.r * weight;\n g += e.g * weight;\n b += e.b * weight;\n a += e.a * weight;\n }\n const correctedPoint = Point.createByRGBA(inRange0to255Rounded(r), inRange0to255Rounded(g), inRange0to255Rounded(b), inRange0to255Rounded(a));\n const quantizedPoint = palette.getNearestColor(this._distance, correctedPoint);\n head = (head + 1) % this._errorQueueSize;\n const tail = (head + this._errorQueueSize - 1) % this._errorQueueSize;\n errorQueue[tail].r = p.r - quantizedPoint.r;\n errorQueue[tail].g = p.g - quantizedPoint.g;\n errorQueue[tail].b = p.b - quantizedPoint.b;\n errorQueue[tail].a = p.a - quantizedPoint.a;\n p.from(quantizedPoint);\n });\n yield {\n pointContainer,\n progress: 100\n };\n }\n static _createWeights(errorPropagation, errorQueueSize) {\n const weights = [];\n const multiplier = Math.exp(Math.log(errorQueueSize) / (errorQueueSize - 1));\n for (let i = 0, next = 1; i < errorQueueSize; i++) {\n weights[i] = (next + 0.5 | 0) / errorQueueSize * errorPropagation;\n next *= multiplier;\n }\n return weights;\n }\n};\n\n// src/quality/index.ts\nvar quality_exports = {};\n__export(quality_exports, {\n ssim: () => ssim\n});\n\n// src/quality/ssim.ts\nvar K1 = 0.01;\nvar K2 = 0.03;\nfunction ssim(image1, image2) {\n if (image1.getHeight() !== image2.getHeight() || image1.getWidth() !== image2.getWidth()) {\n throw new Error(\"Images have different sizes!\");\n }\n const bitsPerComponent = 8;\n const L = (1 << bitsPerComponent) - 1;\n const c1 = (K1 * L) ** 2;\n const c2 = (K2 * L) ** 2;\n let numWindows = 0;\n let mssim = 0;\n iterate(image1, image2, (lumaValues1, lumaValues2, averageLumaValue1, averageLumaValue2) => {\n let sigxy = 0;\n let sigsqx = 0;\n let sigsqy = 0;\n for (let i = 0; i < lumaValues1.length; i++) {\n sigsqx += (lumaValues1[i] - averageLumaValue1) ** 2;\n sigsqy += (lumaValues2[i] - averageLumaValue2) ** 2;\n sigxy += (lumaValues1[i] - averageLumaValue1) * (lumaValues2[i] - averageLumaValue2);\n }\n const numPixelsInWin = lumaValues1.length - 1;\n sigsqx /= numPixelsInWin;\n sigsqy /= numPixelsInWin;\n sigxy /= numPixelsInWin;\n const numerator = (2 * averageLumaValue1 * averageLumaValue2 + c1) * (2 * sigxy + c2);\n const denominator = (averageLumaValue1 ** 2 + averageLumaValue2 ** 2 + c1) * (sigsqx + sigsqy + c2);\n const ssim2 = numerator / denominator;\n mssim += ssim2;\n numWindows++;\n });\n return mssim / numWindows;\n}\nfunction iterate(image1, image2, callback) {\n const windowSize = 8;\n const width = image1.getWidth();\n const height = image1.getHeight();\n for (let y2 = 0; y2 < height; y2 += windowSize) {\n for (let x2 = 0; x2 < width; x2 += windowSize) {\n const windowWidth = Math.min(windowSize, width - x2);\n const windowHeight = Math.min(windowSize, height - y2);\n const lumaValues1 = calculateLumaValuesForWindow(image1, x2, y2, windowWidth, windowHeight);\n const lumaValues2 = calculateLumaValuesForWindow(image2, x2, y2, windowWidth, windowHeight);\n const averageLuma1 = calculateAverageLuma(lumaValues1);\n const averageLuma2 = calculateAverageLuma(lumaValues2);\n callback(lumaValues1, lumaValues2, averageLuma1, averageLuma2);\n }\n }\n}\nfunction calculateLumaValuesForWindow(image, x2, y2, width, height) {\n const pointArray = image.getPointArray();\n const lumaValues = [];\n let counter = 0;\n for (let j = y2; j < y2 + height; j++) {\n const offset = j * image.getWidth();\n for (let i = x2; i < x2 + width; i++) {\n const point = pointArray[offset + i];\n lumaValues[counter] = point.r * 0.2126 /* RED */ + point.g * 0.7152 /* GREEN */ + point.b * 0.0722 /* BLUE */;\n counter++;\n }\n }\n return lumaValues;\n}\nfunction calculateAverageLuma(lumaValues) {\n let sumLuma = 0;\n for (const luma of lumaValues) {\n sumLuma += luma;\n }\n return sumLuma / lumaValues.length;\n}\n\n// src/basicAPI.ts\nvar setImmediateImpl = typeof setImmediate === \"function\" ? setImmediate : typeof process !== \"undefined\" && typeof (process == null ? void 0 : process.nextTick) === \"function\" ? (callback) => process.nextTick(callback) : (callback) => setTimeout(callback, 0);\nfunction buildPaletteSync(images, {\n colorDistanceFormula,\n paletteQuantization,\n colors\n} = {}) {\n const distanceCalculator = colorDistanceFormulaToColorDistance(colorDistanceFormula);\n const paletteQuantizer = paletteQuantizationToPaletteQuantizer(distanceCalculator, paletteQuantization, colors);\n images.forEach((image) => paletteQuantizer.sample(image));\n return paletteQuantizer.quantizeSync();\n}\nasync function buildPalette(images, {\n colorDistanceFormula,\n paletteQuantization,\n colors,\n onProgress\n} = {}) {\n return new Promise((resolve, reject) => {\n const distanceCalculator = colorDistanceFormulaToColorDistance(colorDistanceFormula);\n const paletteQuantizer = paletteQuantizationToPaletteQuantizer(distanceCalculator, paletteQuantization, colors);\n images.forEach((image) => paletteQuantizer.sample(image));\n let palette;\n const iterator = paletteQuantizer.quantize();\n const next = () => {\n try {\n const result = iterator.next();\n if (result.done) {\n resolve(palette);\n } else {\n if (result.value.palette)\n palette = result.value.palette;\n if (onProgress)\n onProgress(result.value.progress);\n setImmediateImpl(next);\n }\n } catch (error) {\n reject(error);\n }\n };\n setImmediateImpl(next);\n });\n}\nfunction applyPaletteSync(image, palette, { colorDistanceFormula, imageQuantization } = {}) {\n const distanceCalculator = colorDistanceFormulaToColorDistance(colorDistanceFormula);\n const imageQuantizer = imageQuantizationToImageQuantizer(distanceCalculator, imageQuantization);\n return imageQuantizer.quantizeSync(image, palette);\n}\nasync function applyPalette(image, palette, {\n colorDistanceFormula,\n imageQuantization,\n onProgress\n} = {}) {\n return new Promise((resolve, reject) => {\n const distanceCalculator = colorDistanceFormulaToColorDistance(colorDistanceFormula);\n const imageQuantizer = imageQuantizationToImageQuantizer(distanceCalculator, imageQuantization);\n let outPointContainer;\n const iterator = imageQuantizer.quantize(image, palette);\n const next = () => {\n try {\n const result = iterator.next();\n if (result.done) {\n resolve(outPointContainer);\n } else {\n if (result.value.pointContainer) {\n outPointContainer = result.value.pointContainer;\n }\n if (onProgress)\n onProgress(result.value.progress);\n setImmediateImpl(next);\n }\n } catch (error) {\n reject(error);\n }\n };\n setImmediateImpl(next);\n });\n}\nfunction colorDistanceFormulaToColorDistance(colorDistanceFormula = \"euclidean-bt709\") {\n switch (colorDistanceFormula) {\n case \"cie94-graphic-arts\":\n return new CIE94GraphicArts();\n case \"cie94-textiles\":\n return new CIE94Textiles();\n case \"ciede2000\":\n return new CIEDE2000();\n case \"color-metric\":\n return new CMetric();\n case \"euclidean\":\n return new Euclidean();\n case \"euclidean-bt709\":\n return new EuclideanBT709();\n case \"euclidean-bt709-noalpha\":\n return new EuclideanBT709NoAlpha();\n case \"manhattan\":\n return new Manhattan();\n case \"manhattan-bt709\":\n return new ManhattanBT709();\n case \"manhattan-nommyde\":\n return new ManhattanNommyde();\n case \"pngquant\":\n return new PNGQuant();\n default:\n throw new Error(`Unknown colorDistanceFormula ${colorDistanceFormula}`);\n }\n}\nfunction imageQuantizationToImageQuantizer(distanceCalculator, imageQuantization = \"floyd-steinberg\") {\n switch (imageQuantization) {\n case \"nearest\":\n return new NearestColor(distanceCalculator);\n case \"riemersma\":\n return new ErrorDiffusionRiemersma(distanceCalculator);\n case \"floyd-steinberg\":\n return new ErrorDiffusionArray(distanceCalculator, 0 /* FloydSteinberg */);\n case \"false-floyd-steinberg\":\n return new ErrorDiffusionArray(distanceCalculator, 1 /* FalseFloydSteinberg */);\n case \"stucki\":\n return new ErrorDiffusionArray(distanceCalculator, 2 /* Stucki */);\n case \"atkinson\":\n return new ErrorDiffusionArray(distanceCalculator, 3 /* Atkinson */);\n case \"jarvis\":\n return new ErrorDiffusionArray(distanceCalculator, 4 /* Jarvis */);\n case \"burkes\":\n return new ErrorDiffusionArray(distanceCalculator, 5 /* Burkes */);\n case \"sierra\":\n return new ErrorDiffusionArray(distanceCalculator, 6 /* Sierra */);\n case \"two-sierra\":\n return new ErrorDiffusionArray(distanceCalculator, 7 /* TwoSierra */);\n case \"sierra-lite\":\n return new ErrorDiffusionArray(distanceCalculator, 8 /* SierraLite */);\n default:\n throw new Error(`Unknown imageQuantization ${imageQuantization}`);\n }\n}\nfunction paletteQuantizationToPaletteQuantizer(distanceCalculator, paletteQuantization = \"wuquant\", colors = 256) {\n switch (paletteQuantization) {\n case \"neuquant\":\n return new NeuQuant(distanceCalculator, colors);\n case \"rgbquant\":\n return new RGBQuant(distanceCalculator, colors);\n case \"wuquant\":\n return new WuQuant(distanceCalculator, colors);\n case \"neuquant-float\":\n return new NeuQuantFloat(distanceCalculator, colors);\n default:\n throw new Error(`Unknown paletteQuantization ${paletteQuantization}`);\n }\n}\nmodule.exports = __toCommonJS(src_exports);\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n applyPalette,\n applyPaletteSync,\n buildPalette,\n buildPaletteSync,\n constants,\n conversion,\n distance,\n image,\n palette,\n quality,\n utils\n});\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * cie94.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * ciede2000.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * cmetric.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * common.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * constants.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * ditherErrorDiffusionArray.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * euclidean.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * helper.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * hueStatistics.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * iq.ts - Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * lab2rgb.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * lab2xyz.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * manhattanNeuQuant.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * nearestColor.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * palette.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * pngQuant.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * point.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * pointContainer.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * rgb2hsl.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * rgb2lab.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * rgb2xyz.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * ssim.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * wuQuant.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * xyz2lab.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * xyz2rgb.ts - part of Image Quantization Library\n */\n/**\n * @preserve\n * MIT License\n *\n * Copyright 2015-2018 Igor Bezkrovnyi\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to\n * deal in the Software without restriction, including without limitation the\n * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n * sell copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n * IN THE SOFTWARE.\n *\n * riemersma.ts - part of Image Quantization Library\n */\n/**\n * @preserve TypeScript port:\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * colorHistogram.ts - part of Image Quantization Library\n */\n/**\n * @preserve TypeScript port:\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * neuquant.ts - part of Image Quantization Library\n */\n/**\n * @preserve TypeScript port:\n * Copyright 2015-2018 Igor Bezkrovnyi\n * All rights reserved. (MIT Licensed)\n *\n * rgbquant.ts - part of Image Quantization Library\n */\n//# sourceMappingURL=image-q.cjs.map\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export function isNodePattern(cb) {\n if (typeof cb === \"undefined\") {\n return false;\n }\n if (typeof cb !== \"function\") {\n throw new TypeError(\"Callback must be a function\");\n }\n return true;\n}\nexport function throwError(error, cb) {\n if (typeof error === \"string\") {\n error = new Error(error);\n }\n if (typeof cb === \"function\") {\n return cb.call(this, error);\n }\n throw error;\n}\nexport function scan(image, x, y, w, h, f) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = image.bitmap.width * _y + _x << 2;\n f.call(image, _x, _y, idx);\n }\n }\n return image;\n}\nexport function* scanIterator(image, x, y, w, h) {\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n for (let _y = y; _y < y + h; _y++) {\n for (let _x = x; _x < x + w; _x++) {\n const idx = image.bitmap.width * _y + _x << 2;\n yield {\n x: _x,\n y: _y,\n idx,\n image\n };\n }\n }\n}\n//# sourceMappingURL=index.js.map","// This file is autogenerated. It's used to publish ESM to npm.\nfunction _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}\n\n// https://github.com/bgrins/TinyColor\n// Brian Grinstead, MIT License\n\nvar trimLeft = /^\\s+/;\nvar trimRight = /\\s+$/;\nfunction tinycolor(color, opts) {\n color = color ? color : \"\";\n opts = opts || {};\n\n // If input is already a tinycolor, return itself\n if (color instanceof tinycolor) {\n return color;\n }\n // If we are called as a function, call using new instead\n if (!(this instanceof tinycolor)) {\n return new tinycolor(color, opts);\n }\n var rgb = inputToRGB(color);\n this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format;\n this._gradientType = opts.gradientType;\n\n // Don't let the range of [0,255] come back in [0,1].\n // Potentially lose a little bit of precision here, but will fix issues where\n // .5 gets interpreted as half of the total, instead of half of 1\n // If it was supposed to be 128, this was already taken care of by `inputToRgb`\n if (this._r < 1) this._r = Math.round(this._r);\n if (this._g < 1) this._g = Math.round(this._g);\n if (this._b < 1) this._b = Math.round(this._b);\n this._ok = rgb.ok;\n}\ntinycolor.prototype = {\n isDark: function isDark() {\n return this.getBrightness() < 128;\n },\n isLight: function isLight() {\n return !this.isDark();\n },\n isValid: function isValid() {\n return this._ok;\n },\n getOriginalInput: function getOriginalInput() {\n return this._originalInput;\n },\n getFormat: function getFormat() {\n return this._format;\n },\n getAlpha: function getAlpha() {\n return this._a;\n },\n getBrightness: function getBrightness() {\n //http://www.w3.org/TR/AERT#color-contrast\n var rgb = this.toRgb();\n return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;\n },\n getLuminance: function getLuminance() {\n //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef\n var rgb = this.toRgb();\n var RsRGB, GsRGB, BsRGB, R, G, B;\n RsRGB = rgb.r / 255;\n GsRGB = rgb.g / 255;\n BsRGB = rgb.b / 255;\n if (RsRGB <= 0.03928) R = RsRGB / 12.92;else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);\n if (GsRGB <= 0.03928) G = GsRGB / 12.92;else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);\n if (BsRGB <= 0.03928) B = BsRGB / 12.92;else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);\n return 0.2126 * R + 0.7152 * G + 0.0722 * B;\n },\n setAlpha: function setAlpha(value) {\n this._a = boundAlpha(value);\n this._roundA = Math.round(100 * this._a) / 100;\n return this;\n },\n toHsv: function toHsv() {\n var hsv = rgbToHsv(this._r, this._g, this._b);\n return {\n h: hsv.h * 360,\n s: hsv.s,\n v: hsv.v,\n a: this._a\n };\n },\n toHsvString: function toHsvString() {\n var hsv = rgbToHsv(this._r, this._g, this._b);\n var h = Math.round(hsv.h * 360),\n s = Math.round(hsv.s * 100),\n v = Math.round(hsv.v * 100);\n return this._a == 1 ? \"hsv(\" + h + \", \" + s + \"%, \" + v + \"%)\" : \"hsva(\" + h + \", \" + s + \"%, \" + v + \"%, \" + this._roundA + \")\";\n },\n toHsl: function toHsl() {\n var hsl = rgbToHsl(this._r, this._g, this._b);\n return {\n h: hsl.h * 360,\n s: hsl.s,\n l: hsl.l,\n a: this._a\n };\n },\n toHslString: function toHslString() {\n var hsl = rgbToHsl(this._r, this._g, this._b);\n var h = Math.round(hsl.h * 360),\n s = Math.round(hsl.s * 100),\n l = Math.round(hsl.l * 100);\n return this._a == 1 ? \"hsl(\" + h + \", \" + s + \"%, \" + l + \"%)\" : \"hsla(\" + h + \", \" + s + \"%, \" + l + \"%, \" + this._roundA + \")\";\n },\n toHex: function toHex(allow3Char) {\n return rgbToHex(this._r, this._g, this._b, allow3Char);\n },\n toHexString: function toHexString(allow3Char) {\n return \"#\" + this.toHex(allow3Char);\n },\n toHex8: function toHex8(allow4Char) {\n return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);\n },\n toHex8String: function toHex8String(allow4Char) {\n return \"#\" + this.toHex8(allow4Char);\n },\n toRgb: function toRgb() {\n return {\n r: Math.round(this._r),\n g: Math.round(this._g),\n b: Math.round(this._b),\n a: this._a\n };\n },\n toRgbString: function toRgbString() {\n return this._a == 1 ? \"rgb(\" + Math.round(this._r) + \", \" + Math.round(this._g) + \", \" + Math.round(this._b) + \")\" : \"rgba(\" + Math.round(this._r) + \", \" + Math.round(this._g) + \", \" + Math.round(this._b) + \", \" + this._roundA + \")\";\n },\n toPercentageRgb: function toPercentageRgb() {\n return {\n r: Math.round(bound01(this._r, 255) * 100) + \"%\",\n g: Math.round(bound01(this._g, 255) * 100) + \"%\",\n b: Math.round(bound01(this._b, 255) * 100) + \"%\",\n a: this._a\n };\n },\n toPercentageRgbString: function toPercentageRgbString() {\n return this._a == 1 ? \"rgb(\" + Math.round(bound01(this._r, 255) * 100) + \"%, \" + Math.round(bound01(this._g, 255) * 100) + \"%, \" + Math.round(bound01(this._b, 255) * 100) + \"%)\" : \"rgba(\" + Math.round(bound01(this._r, 255) * 100) + \"%, \" + Math.round(bound01(this._g, 255) * 100) + \"%, \" + Math.round(bound01(this._b, 255) * 100) + \"%, \" + this._roundA + \")\";\n },\n toName: function toName() {\n if (this._a === 0) {\n return \"transparent\";\n }\n if (this._a < 1) {\n return false;\n }\n return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;\n },\n toFilter: function toFilter(secondColor) {\n var hex8String = \"#\" + rgbaToArgbHex(this._r, this._g, this._b, this._a);\n var secondHex8String = hex8String;\n var gradientType = this._gradientType ? \"GradientType = 1, \" : \"\";\n if (secondColor) {\n var s = tinycolor(secondColor);\n secondHex8String = \"#\" + rgbaToArgbHex(s._r, s._g, s._b, s._a);\n }\n return \"progid:DXImageTransform.Microsoft.gradient(\" + gradientType + \"startColorstr=\" + hex8String + \",endColorstr=\" + secondHex8String + \")\";\n },\n toString: function toString(format) {\n var formatSet = !!format;\n format = format || this._format;\n var formattedString = false;\n var hasAlpha = this._a < 1 && this._a >= 0;\n var needsAlphaFormat = !formatSet && hasAlpha && (format === \"hex\" || format === \"hex6\" || format === \"hex3\" || format === \"hex4\" || format === \"hex8\" || format === \"name\");\n if (needsAlphaFormat) {\n // Special case for \"transparent\", all other non-alpha formats\n // will return rgba when there is transparency.\n if (format === \"name\" && this._a === 0) {\n return this.toName();\n }\n return this.toRgbString();\n }\n if (format === \"rgb\") {\n formattedString = this.toRgbString();\n }\n if (format === \"prgb\") {\n formattedString = this.toPercentageRgbString();\n }\n if (format === \"hex\" || format === \"hex6\") {\n formattedString = this.toHexString();\n }\n if (format === \"hex3\") {\n formattedString = this.toHexString(true);\n }\n if (format === \"hex4\") {\n formattedString = this.toHex8String(true);\n }\n if (format === \"hex8\") {\n formattedString = this.toHex8String();\n }\n if (format === \"name\") {\n formattedString = this.toName();\n }\n if (format === \"hsl\") {\n formattedString = this.toHslString();\n }\n if (format === \"hsv\") {\n formattedString = this.toHsvString();\n }\n return formattedString || this.toHexString();\n },\n clone: function clone() {\n return tinycolor(this.toString());\n },\n _applyModification: function _applyModification(fn, args) {\n var color = fn.apply(null, [this].concat([].slice.call(args)));\n this._r = color._r;\n this._g = color._g;\n this._b = color._b;\n this.setAlpha(color._a);\n return this;\n },\n lighten: function lighten() {\n return this._applyModification(_lighten, arguments);\n },\n brighten: function brighten() {\n return this._applyModification(_brighten, arguments);\n },\n darken: function darken() {\n return this._applyModification(_darken, arguments);\n },\n desaturate: function desaturate() {\n return this._applyModification(_desaturate, arguments);\n },\n saturate: function saturate() {\n return this._applyModification(_saturate, arguments);\n },\n greyscale: function greyscale() {\n return this._applyModification(_greyscale, arguments);\n },\n spin: function spin() {\n return this._applyModification(_spin, arguments);\n },\n _applyCombination: function _applyCombination(fn, args) {\n return fn.apply(null, [this].concat([].slice.call(args)));\n },\n analogous: function analogous() {\n return this._applyCombination(_analogous, arguments);\n },\n complement: function complement() {\n return this._applyCombination(_complement, arguments);\n },\n monochromatic: function monochromatic() {\n return this._applyCombination(_monochromatic, arguments);\n },\n splitcomplement: function splitcomplement() {\n return this._applyCombination(_splitcomplement, arguments);\n },\n // Disabled until https://github.com/bgrins/TinyColor/issues/254\n // polyad: function (number) {\n // return this._applyCombination(polyad, [number]);\n // },\n triad: function triad() {\n return this._applyCombination(polyad, [3]);\n },\n tetrad: function tetrad() {\n return this._applyCombination(polyad, [4]);\n }\n};\n\n// If input is an object, force 1 into \"1.0\" to handle ratios properly\n// String input requires \"1.0\" as input, so 1 will be treated as 1\ntinycolor.fromRatio = function (color, opts) {\n if (_typeof(color) == \"object\") {\n var newColor = {};\n for (var i in color) {\n if (color.hasOwnProperty(i)) {\n if (i === \"a\") {\n newColor[i] = color[i];\n } else {\n newColor[i] = convertToPercentage(color[i]);\n }\n }\n }\n color = newColor;\n }\n return tinycolor(color, opts);\n};\n\n// Given a string or object, convert that input to RGB\n// Possible string inputs:\n//\n// \"red\"\n// \"#f00\" or \"f00\"\n// \"#ff0000\" or \"ff0000\"\n// \"#ff000000\" or \"ff000000\"\n// \"rgb 255 0 0\" or \"rgb (255, 0, 0)\"\n// \"rgb 1.0 0 0\" or \"rgb (1, 0, 0)\"\n// \"rgba (255, 0, 0, 1)\" or \"rgba 255, 0, 0, 1\"\n// \"rgba (1.0, 0, 0, 1)\" or \"rgba 1.0, 0, 0, 1\"\n// \"hsl(0, 100%, 50%)\" or \"hsl 0 100% 50%\"\n// \"hsla(0, 100%, 50%, 1)\" or \"hsla 0 100% 50%, 1\"\n// \"hsv(0, 100%, 100%)\" or \"hsv 0 100% 100%\"\n//\nfunction inputToRGB(color) {\n var rgb = {\n r: 0,\n g: 0,\n b: 0\n };\n var a = 1;\n var s = null;\n var v = null;\n var l = null;\n var ok = false;\n var format = false;\n if (typeof color == \"string\") {\n color = stringInputToObject(color);\n }\n if (_typeof(color) == \"object\") {\n if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {\n rgb = rgbToRgb(color.r, color.g, color.b);\n ok = true;\n format = String(color.r).substr(-1) === \"%\" ? \"prgb\" : \"rgb\";\n } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {\n s = convertToPercentage(color.s);\n v = convertToPercentage(color.v);\n rgb = hsvToRgb(color.h, s, v);\n ok = true;\n format = \"hsv\";\n } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {\n s = convertToPercentage(color.s);\n l = convertToPercentage(color.l);\n rgb = hslToRgb(color.h, s, l);\n ok = true;\n format = \"hsl\";\n }\n if (color.hasOwnProperty(\"a\")) {\n a = color.a;\n }\n }\n a = boundAlpha(a);\n return {\n ok: ok,\n format: color.format || format,\n r: Math.min(255, Math.max(rgb.r, 0)),\n g: Math.min(255, Math.max(rgb.g, 0)),\n b: Math.min(255, Math.max(rgb.b, 0)),\n a: a\n };\n}\n\n// Conversion Functions\n// --------------------\n\n// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:\n// \n\n// `rgbToRgb`\n// Handle bounds / percentage checking to conform to CSS color spec\n// \n// *Assumes:* r, g, b in [0, 255] or [0, 1]\n// *Returns:* { r, g, b } in [0, 255]\nfunction rgbToRgb(r, g, b) {\n return {\n r: bound01(r, 255) * 255,\n g: bound01(g, 255) * 255,\n b: bound01(b, 255) * 255\n };\n}\n\n// `rgbToHsl`\n// Converts an RGB color value to HSL.\n// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]\n// *Returns:* { h, s, l } in [0,1]\nfunction rgbToHsl(r, g, b) {\n r = bound01(r, 255);\n g = bound01(g, 255);\n b = bound01(b, 255);\n var max = Math.max(r, g, b),\n min = Math.min(r, g, b);\n var h,\n s,\n l = (max + min) / 2;\n if (max == min) {\n h = s = 0; // achromatic\n } else {\n var d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n }\n h /= 6;\n }\n return {\n h: h,\n s: s,\n l: l\n };\n}\n\n// `hslToRgb`\n// Converts an HSL color value to RGB.\n// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]\n// *Returns:* { r, g, b } in the set [0, 255]\nfunction hslToRgb(h, s, l) {\n var r, g, b;\n h = bound01(h, 360);\n s = bound01(s, 100);\n l = bound01(l, 100);\n function hue2rgb(p, q, t) {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 1 / 2) return q;\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n }\n if (s === 0) {\n r = g = b = l; // achromatic\n } else {\n var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n var p = 2 * l - q;\n r = hue2rgb(p, q, h + 1 / 3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1 / 3);\n }\n return {\n r: r * 255,\n g: g * 255,\n b: b * 255\n };\n}\n\n// `rgbToHsv`\n// Converts an RGB color value to HSV\n// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]\n// *Returns:* { h, s, v } in [0,1]\nfunction rgbToHsv(r, g, b) {\n r = bound01(r, 255);\n g = bound01(g, 255);\n b = bound01(b, 255);\n var max = Math.max(r, g, b),\n min = Math.min(r, g, b);\n var h,\n s,\n v = max;\n var d = max - min;\n s = max === 0 ? 0 : d / max;\n if (max == min) {\n h = 0; // achromatic\n } else {\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n }\n h /= 6;\n }\n return {\n h: h,\n s: s,\n v: v\n };\n}\n\n// `hsvToRgb`\n// Converts an HSV color value to RGB.\n// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]\n// *Returns:* { r, g, b } in the set [0, 255]\nfunction hsvToRgb(h, s, v) {\n h = bound01(h, 360) * 6;\n s = bound01(s, 100);\n v = bound01(v, 100);\n var i = Math.floor(h),\n f = h - i,\n p = v * (1 - s),\n q = v * (1 - f * s),\n t = v * (1 - (1 - f) * s),\n mod = i % 6,\n r = [v, q, p, p, t, v][mod],\n g = [t, v, v, q, p, p][mod],\n b = [p, p, t, v, v, q][mod];\n return {\n r: r * 255,\n g: g * 255,\n b: b * 255\n };\n}\n\n// `rgbToHex`\n// Converts an RGB color to hex\n// Assumes r, g, and b are contained in the set [0, 255]\n// Returns a 3 or 6 character hex\nfunction rgbToHex(r, g, b, allow3Char) {\n var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];\n\n // Return a 3 character hex if possible\n if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n return hex.join(\"\");\n}\n\n// `rgbaToHex`\n// Converts an RGBA color plus alpha transparency to hex\n// Assumes r, g, b are contained in the set [0, 255] and\n// a in [0, 1]. Returns a 4 or 8 character rgba hex\nfunction rgbaToHex(r, g, b, a, allow4Char) {\n var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];\n\n // Return a 4 character hex if possible\n if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);\n }\n return hex.join(\"\");\n}\n\n// `rgbaToArgbHex`\n// Converts an RGBA color to an ARGB Hex8 string\n// Rarely used, but required for \"toFilter()\"\nfunction rgbaToArgbHex(r, g, b, a) {\n var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];\n return hex.join(\"\");\n}\n\n// `equals`\n// Can be called with any tinycolor input\ntinycolor.equals = function (color1, color2) {\n if (!color1 || !color2) return false;\n return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();\n};\ntinycolor.random = function () {\n return tinycolor.fromRatio({\n r: Math.random(),\n g: Math.random(),\n b: Math.random()\n });\n};\n\n// Modification Functions\n// ----------------------\n// Thanks to less.js for some of the basics here\n// \n\nfunction _desaturate(color, amount) {\n amount = amount === 0 ? 0 : amount || 10;\n var hsl = tinycolor(color).toHsl();\n hsl.s -= amount / 100;\n hsl.s = clamp01(hsl.s);\n return tinycolor(hsl);\n}\nfunction _saturate(color, amount) {\n amount = amount === 0 ? 0 : amount || 10;\n var hsl = tinycolor(color).toHsl();\n hsl.s += amount / 100;\n hsl.s = clamp01(hsl.s);\n return tinycolor(hsl);\n}\nfunction _greyscale(color) {\n return tinycolor(color).desaturate(100);\n}\nfunction _lighten(color, amount) {\n amount = amount === 0 ? 0 : amount || 10;\n var hsl = tinycolor(color).toHsl();\n hsl.l += amount / 100;\n hsl.l = clamp01(hsl.l);\n return tinycolor(hsl);\n}\nfunction _brighten(color, amount) {\n amount = amount === 0 ? 0 : amount || 10;\n var rgb = tinycolor(color).toRgb();\n rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));\n rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));\n rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));\n return tinycolor(rgb);\n}\nfunction _darken(color, amount) {\n amount = amount === 0 ? 0 : amount || 10;\n var hsl = tinycolor(color).toHsl();\n hsl.l -= amount / 100;\n hsl.l = clamp01(hsl.l);\n return tinycolor(hsl);\n}\n\n// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.\n// Values outside of this range will be wrapped into this range.\nfunction _spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (hsl.h + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n}\n\n// Combination Functions\n// ---------------------\n// Thanks to jQuery xColor for some of the ideas behind these\n// \n\nfunction _complement(color) {\n var hsl = tinycolor(color).toHsl();\n hsl.h = (hsl.h + 180) % 360;\n return tinycolor(hsl);\n}\nfunction polyad(color, number) {\n if (isNaN(number) || number <= 0) {\n throw new Error(\"Argument to polyad must be a positive number\");\n }\n var hsl = tinycolor(color).toHsl();\n var result = [tinycolor(color)];\n var step = 360 / number;\n for (var i = 1; i < number; i++) {\n result.push(tinycolor({\n h: (hsl.h + i * step) % 360,\n s: hsl.s,\n l: hsl.l\n }));\n }\n return result;\n}\nfunction _splitcomplement(color) {\n var hsl = tinycolor(color).toHsl();\n var h = hsl.h;\n return [tinycolor(color), tinycolor({\n h: (h + 72) % 360,\n s: hsl.s,\n l: hsl.l\n }), tinycolor({\n h: (h + 216) % 360,\n s: hsl.s,\n l: hsl.l\n })];\n}\nfunction _analogous(color, results, slices) {\n results = results || 6;\n slices = slices || 30;\n var hsl = tinycolor(color).toHsl();\n var part = 360 / slices;\n var ret = [tinycolor(color)];\n for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) {\n hsl.h = (hsl.h + part) % 360;\n ret.push(tinycolor(hsl));\n }\n return ret;\n}\nfunction _monochromatic(color, results) {\n results = results || 6;\n var hsv = tinycolor(color).toHsv();\n var h = hsv.h,\n s = hsv.s,\n v = hsv.v;\n var ret = [];\n var modification = 1 / results;\n while (results--) {\n ret.push(tinycolor({\n h: h,\n s: s,\n v: v\n }));\n v = (v + modification) % 1;\n }\n return ret;\n}\n\n// Utility Functions\n// ---------------------\n\ntinycolor.mix = function (color1, color2, amount) {\n amount = amount === 0 ? 0 : amount || 50;\n var rgb1 = tinycolor(color1).toRgb();\n var rgb2 = tinycolor(color2).toRgb();\n var p = amount / 100;\n var rgba = {\n r: (rgb2.r - rgb1.r) * p + rgb1.r,\n g: (rgb2.g - rgb1.g) * p + rgb1.g,\n b: (rgb2.b - rgb1.b) * p + rgb1.b,\n a: (rgb2.a - rgb1.a) * p + rgb1.a\n };\n return tinycolor(rgba);\n};\n\n// Readability Functions\n// ---------------------\n// false\n// tinycolor.isReadable(\"#000\", \"#111\",{level:\"AA\",size:\"large\"}) => false\ntinycolor.isReadable = function (color1, color2, wcag2) {\n var readability = tinycolor.readability(color1, color2);\n var wcag2Parms, out;\n out = false;\n wcag2Parms = validateWCAG2Parms(wcag2);\n switch (wcag2Parms.level + wcag2Parms.size) {\n case \"AAsmall\":\n case \"AAAlarge\":\n out = readability >= 4.5;\n break;\n case \"AAlarge\":\n out = readability >= 3;\n break;\n case \"AAAsmall\":\n out = readability >= 7;\n break;\n }\n return out;\n};\n\n// `mostReadable`\n// Given a base color and a list of possible foreground or background\n// colors for that base, returns the most readable color.\n// Optionally returns Black or White if the most readable color is unreadable.\n// *Example*\n// tinycolor.mostReadable(tinycolor.mostReadable(\"#123\", [\"#124\", \"#125\"],{includeFallbackColors:false}).toHexString(); // \"#112255\"\n// tinycolor.mostReadable(tinycolor.mostReadable(\"#123\", [\"#124\", \"#125\"],{includeFallbackColors:true}).toHexString(); // \"#ffffff\"\n// tinycolor.mostReadable(\"#a8015a\", [\"#faf3f3\"],{includeFallbackColors:true,level:\"AAA\",size:\"large\"}).toHexString(); // \"#faf3f3\"\n// tinycolor.mostReadable(\"#a8015a\", [\"#faf3f3\"],{includeFallbackColors:true,level:\"AAA\",size:\"small\"}).toHexString(); // \"#ffffff\"\ntinycolor.mostReadable = function (baseColor, colorList, args) {\n var bestColor = null;\n var bestScore = 0;\n var readability;\n var includeFallbackColors, level, size;\n args = args || {};\n includeFallbackColors = args.includeFallbackColors;\n level = args.level;\n size = args.size;\n for (var i = 0; i < colorList.length; i++) {\n readability = tinycolor.readability(baseColor, colorList[i]);\n if (readability > bestScore) {\n bestScore = readability;\n bestColor = tinycolor(colorList[i]);\n }\n }\n if (tinycolor.isReadable(baseColor, bestColor, {\n level: level,\n size: size\n }) || !includeFallbackColors) {\n return bestColor;\n } else {\n args.includeFallbackColors = false;\n return tinycolor.mostReadable(baseColor, [\"#fff\", \"#000\"], args);\n }\n};\n\n// Big List of Colors\n// ------------------\n// \nvar names = tinycolor.names = {\n aliceblue: \"f0f8ff\",\n antiquewhite: \"faebd7\",\n aqua: \"0ff\",\n aquamarine: \"7fffd4\",\n azure: \"f0ffff\",\n beige: \"f5f5dc\",\n bisque: \"ffe4c4\",\n black: \"000\",\n blanchedalmond: \"ffebcd\",\n blue: \"00f\",\n blueviolet: \"8a2be2\",\n brown: \"a52a2a\",\n burlywood: \"deb887\",\n burntsienna: \"ea7e5d\",\n cadetblue: \"5f9ea0\",\n chartreuse: \"7fff00\",\n chocolate: \"d2691e\",\n coral: \"ff7f50\",\n cornflowerblue: \"6495ed\",\n cornsilk: \"fff8dc\",\n crimson: \"dc143c\",\n cyan: \"0ff\",\n darkblue: \"00008b\",\n darkcyan: \"008b8b\",\n darkgoldenrod: \"b8860b\",\n darkgray: \"a9a9a9\",\n darkgreen: \"006400\",\n darkgrey: \"a9a9a9\",\n darkkhaki: \"bdb76b\",\n darkmagenta: \"8b008b\",\n darkolivegreen: \"556b2f\",\n darkorange: \"ff8c00\",\n darkorchid: \"9932cc\",\n darkred: \"8b0000\",\n darksalmon: \"e9967a\",\n darkseagreen: \"8fbc8f\",\n darkslateblue: \"483d8b\",\n darkslategray: \"2f4f4f\",\n darkslategrey: \"2f4f4f\",\n darkturquoise: \"00ced1\",\n darkviolet: \"9400d3\",\n deeppink: \"ff1493\",\n deepskyblue: \"00bfff\",\n dimgray: \"696969\",\n dimgrey: \"696969\",\n dodgerblue: \"1e90ff\",\n firebrick: \"b22222\",\n floralwhite: \"fffaf0\",\n forestgreen: \"228b22\",\n fuchsia: \"f0f\",\n gainsboro: \"dcdcdc\",\n ghostwhite: \"f8f8ff\",\n gold: \"ffd700\",\n goldenrod: \"daa520\",\n gray: \"808080\",\n green: \"008000\",\n greenyellow: \"adff2f\",\n grey: \"808080\",\n honeydew: \"f0fff0\",\n hotpink: \"ff69b4\",\n indianred: \"cd5c5c\",\n indigo: \"4b0082\",\n ivory: \"fffff0\",\n khaki: \"f0e68c\",\n lavender: \"e6e6fa\",\n lavenderblush: \"fff0f5\",\n lawngreen: \"7cfc00\",\n lemonchiffon: \"fffacd\",\n lightblue: \"add8e6\",\n lightcoral: \"f08080\",\n lightcyan: \"e0ffff\",\n lightgoldenrodyellow: \"fafad2\",\n lightgray: \"d3d3d3\",\n lightgreen: \"90ee90\",\n lightgrey: \"d3d3d3\",\n lightpink: \"ffb6c1\",\n lightsalmon: \"ffa07a\",\n lightseagreen: \"20b2aa\",\n lightskyblue: \"87cefa\",\n lightslategray: \"789\",\n lightslategrey: \"789\",\n lightsteelblue: \"b0c4de\",\n lightyellow: \"ffffe0\",\n lime: \"0f0\",\n limegreen: \"32cd32\",\n linen: \"faf0e6\",\n magenta: \"f0f\",\n maroon: \"800000\",\n mediumaquamarine: \"66cdaa\",\n mediumblue: \"0000cd\",\n mediumorchid: \"ba55d3\",\n mediumpurple: \"9370db\",\n mediumseagreen: \"3cb371\",\n mediumslateblue: \"7b68ee\",\n mediumspringgreen: \"00fa9a\",\n mediumturquoise: \"48d1cc\",\n mediumvioletred: \"c71585\",\n midnightblue: \"191970\",\n mintcream: \"f5fffa\",\n mistyrose: \"ffe4e1\",\n moccasin: \"ffe4b5\",\n navajowhite: \"ffdead\",\n navy: \"000080\",\n oldlace: \"fdf5e6\",\n olive: \"808000\",\n olivedrab: \"6b8e23\",\n orange: \"ffa500\",\n orangered: \"ff4500\",\n orchid: \"da70d6\",\n palegoldenrod: \"eee8aa\",\n palegreen: \"98fb98\",\n paleturquoise: \"afeeee\",\n palevioletred: \"db7093\",\n papayawhip: \"ffefd5\",\n peachpuff: \"ffdab9\",\n peru: \"cd853f\",\n pink: \"ffc0cb\",\n plum: \"dda0dd\",\n powderblue: \"b0e0e6\",\n purple: \"800080\",\n rebeccapurple: \"663399\",\n red: \"f00\",\n rosybrown: \"bc8f8f\",\n royalblue: \"4169e1\",\n saddlebrown: \"8b4513\",\n salmon: \"fa8072\",\n sandybrown: \"f4a460\",\n seagreen: \"2e8b57\",\n seashell: \"fff5ee\",\n sienna: \"a0522d\",\n silver: \"c0c0c0\",\n skyblue: \"87ceeb\",\n slateblue: \"6a5acd\",\n slategray: \"708090\",\n slategrey: \"708090\",\n snow: \"fffafa\",\n springgreen: \"00ff7f\",\n steelblue: \"4682b4\",\n tan: \"d2b48c\",\n teal: \"008080\",\n thistle: \"d8bfd8\",\n tomato: \"ff6347\",\n turquoise: \"40e0d0\",\n violet: \"ee82ee\",\n wheat: \"f5deb3\",\n white: \"fff\",\n whitesmoke: \"f5f5f5\",\n yellow: \"ff0\",\n yellowgreen: \"9acd32\"\n};\n\n// Make it easy to access colors via `hexNames[hex]`\nvar hexNames = tinycolor.hexNames = flip(names);\n\n// Utilities\n// ---------\n\n// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`\nfunction flip(o) {\n var flipped = {};\n for (var i in o) {\n if (o.hasOwnProperty(i)) {\n flipped[o[i]] = i;\n }\n }\n return flipped;\n}\n\n// Return a valid alpha value [0,1] with all invalid values being set to 1\nfunction boundAlpha(a) {\n a = parseFloat(a);\n if (isNaN(a) || a < 0 || a > 1) {\n a = 1;\n }\n return a;\n}\n\n// Take input from [0, n] and return it as [0, 1]\nfunction bound01(n, max) {\n if (isOnePointZero(n)) n = \"100%\";\n var processPercent = isPercentage(n);\n n = Math.min(max, Math.max(0, parseFloat(n)));\n\n // Automatically convert percentage into number\n if (processPercent) {\n n = parseInt(n * max, 10) / 100;\n }\n\n // Handle floating point rounding errors\n if (Math.abs(n - max) < 0.000001) {\n return 1;\n }\n\n // Convert into [0, 1] range if it isn't already\n return n % max / parseFloat(max);\n}\n\n// Force a number between 0 and 1\nfunction clamp01(val) {\n return Math.min(1, Math.max(0, val));\n}\n\n// Parse a base-16 hex value into a base-10 integer\nfunction parseIntFromHex(val) {\n return parseInt(val, 16);\n}\n\n// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1\n// \nfunction isOnePointZero(n) {\n return typeof n == \"string\" && n.indexOf(\".\") != -1 && parseFloat(n) === 1;\n}\n\n// Check to see if string passed in is a percentage\nfunction isPercentage(n) {\n return typeof n === \"string\" && n.indexOf(\"%\") != -1;\n}\n\n// Force a hex value to have 2 characters\nfunction pad2(c) {\n return c.length == 1 ? \"0\" + c : \"\" + c;\n}\n\n// Replace a decimal with it's percentage value\nfunction convertToPercentage(n) {\n if (n <= 1) {\n n = n * 100 + \"%\";\n }\n return n;\n}\n\n// Converts a decimal to a hex value\nfunction convertDecimalToHex(d) {\n return Math.round(parseFloat(d) * 255).toString(16);\n}\n// Converts a hex value to a decimal\nfunction convertHexToDecimal(h) {\n return parseIntFromHex(h) / 255;\n}\nvar matchers = function () {\n // \n var CSS_INTEGER = \"[-\\\\+]?\\\\d+%?\";\n\n // \n var CSS_NUMBER = \"[-\\\\+]?\\\\d*\\\\.\\\\d+%?\";\n\n // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.\n var CSS_UNIT = \"(?:\" + CSS_NUMBER + \")|(?:\" + CSS_INTEGER + \")\";\n\n // Actual matching.\n // Parentheses and commas are optional, but not required.\n // Whitespace can take the place of commas or opening paren\n var PERMISSIVE_MATCH3 = \"[\\\\s|\\\\(]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")\\\\s*\\\\)?\";\n var PERMISSIVE_MATCH4 = \"[\\\\s|\\\\(]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")[,|\\\\s]+(\" + CSS_UNIT + \")\\\\s*\\\\)?\";\n return {\n CSS_UNIT: new RegExp(CSS_UNIT),\n rgb: new RegExp(\"rgb\" + PERMISSIVE_MATCH3),\n rgba: new RegExp(\"rgba\" + PERMISSIVE_MATCH4),\n hsl: new RegExp(\"hsl\" + PERMISSIVE_MATCH3),\n hsla: new RegExp(\"hsla\" + PERMISSIVE_MATCH4),\n hsv: new RegExp(\"hsv\" + PERMISSIVE_MATCH3),\n hsva: new RegExp(\"hsva\" + PERMISSIVE_MATCH4),\n hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,\n hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,\n hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,\n hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/\n };\n}();\n\n// `isValidCSSUnit`\n// Take in a single string / number and check to see if it looks like a CSS unit\n// (see `matchers` above for definition).\nfunction isValidCSSUnit(color) {\n return !!matchers.CSS_UNIT.exec(color);\n}\n\n// `stringInputToObject`\n// Permissive string parsing. Take in a number of formats, and output an object\n// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`\nfunction stringInputToObject(color) {\n color = color.replace(trimLeft, \"\").replace(trimRight, \"\").toLowerCase();\n var named = false;\n if (names[color]) {\n color = names[color];\n named = true;\n } else if (color == \"transparent\") {\n return {\n r: 0,\n g: 0,\n b: 0,\n a: 0,\n format: \"name\"\n };\n }\n\n // Try to match string input using regular expressions.\n // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]\n // Just return an object and let the conversion functions handle that.\n // This way the result will be the same whether the tinycolor is initialized with string or object.\n var match;\n if (match = matchers.rgb.exec(color)) {\n return {\n r: match[1],\n g: match[2],\n b: match[3]\n };\n }\n if (match = matchers.rgba.exec(color)) {\n return {\n r: match[1],\n g: match[2],\n b: match[3],\n a: match[4]\n };\n }\n if (match = matchers.hsl.exec(color)) {\n return {\n h: match[1],\n s: match[2],\n l: match[3]\n };\n }\n if (match = matchers.hsla.exec(color)) {\n return {\n h: match[1],\n s: match[2],\n l: match[3],\n a: match[4]\n };\n }\n if (match = matchers.hsv.exec(color)) {\n return {\n h: match[1],\n s: match[2],\n v: match[3]\n };\n }\n if (match = matchers.hsva.exec(color)) {\n return {\n h: match[1],\n s: match[2],\n v: match[3],\n a: match[4]\n };\n }\n if (match = matchers.hex8.exec(color)) {\n return {\n r: parseIntFromHex(match[1]),\n g: parseIntFromHex(match[2]),\n b: parseIntFromHex(match[3]),\n a: convertHexToDecimal(match[4]),\n format: named ? \"name\" : \"hex8\"\n };\n }\n if (match = matchers.hex6.exec(color)) {\n return {\n r: parseIntFromHex(match[1]),\n g: parseIntFromHex(match[2]),\n b: parseIntFromHex(match[3]),\n format: named ? \"name\" : \"hex\"\n };\n }\n if (match = matchers.hex4.exec(color)) {\n return {\n r: parseIntFromHex(match[1] + \"\" + match[1]),\n g: parseIntFromHex(match[2] + \"\" + match[2]),\n b: parseIntFromHex(match[3] + \"\" + match[3]),\n a: convertHexToDecimal(match[4] + \"\" + match[4]),\n format: named ? \"name\" : \"hex8\"\n };\n }\n if (match = matchers.hex3.exec(color)) {\n return {\n r: parseIntFromHex(match[1] + \"\" + match[1]),\n g: parseIntFromHex(match[2] + \"\" + match[2]),\n b: parseIntFromHex(match[3] + \"\" + match[3]),\n format: named ? \"name\" : \"hex\"\n };\n }\n return false;\n}\nfunction validateWCAG2Parms(parms) {\n // return valid WCAG2 parms for isReadable.\n // If input parms are invalid, return {\"level\":\"AA\", \"size\":\"small\"}\n var level, size;\n parms = parms || {\n level: \"AA\",\n size: \"small\"\n };\n level = (parms.level || \"AA\").toUpperCase();\n size = (parms.size || \"small\").toLowerCase();\n if (level !== \"AA\" && level !== \"AAA\") {\n level = \"AA\";\n }\n if (size !== \"small\" && size !== \"large\") {\n size = \"small\";\n }\n return {\n level: level,\n size: size\n };\n}\n\nexport { tinycolor as default };\n","/*\nCopyright (c) 2011 Elliot Shepherd\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\nall copies 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\nTHE SOFTWARE.\n*/\n\n// https://code.google.com/p/ironchef-team21/source/browse/ironchef_team21/src/ImagePHash.java\n\n/*\n * pHash-like image hash.\n * Author: Elliot Shepherd (elliot@jarofworms.com\n * Based On: http://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html\n */\n\nfunction ImagePHash(size, smallerSize) {\n this.size = this.size || size;\n this.smallerSize = this.smallerSize || smallerSize;\n initCoefficients(this.size);\n}\nImagePHash.prototype.size = 32;\nImagePHash.prototype.smallerSize = 8;\nImagePHash.prototype.distance = function (s1, s2) {\n let counter = 0;\n for (let k = 0; k < s1.length; k++) {\n if (s1[k] !== s2[k]) {\n counter++;\n }\n }\n return counter / s1.length;\n};\n\n// Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on.\nImagePHash.prototype.getHash = function (img) {\n /* 1. Reduce size.\n * Like Average Hash, pHash starts with a small image.\n * However, the image is larger than 8x8; 32x32 is a good size.\n * This is really done to simplify the DCT computation and not\n * because it is needed to reduce the high frequencies.\n */\n img = img.clone().resize(this.size, this.size);\n\n /* 2. Reduce color.\n * The image is reduced to a grayscale just to further simplify\n * the number of computations.\n */\n img.grayscale();\n const vals = [];\n for (let x = 0; x < img.bitmap.width; x++) {\n vals[x] = [];\n for (let y = 0; y < img.bitmap.height; y++) {\n vals[x][y] = intToRGBA(img.getPixelColor(x, y)).b;\n }\n }\n\n /* 3. Compute the DCT.\n * The DCT separates the image into a collection of frequencies\n * and scalars. While JPEG uses an 8x8 DCT, this algorithm uses\n * a 32x32 DCT.\n */\n const dctVals = applyDCT(vals, this.size);\n\n /* 4. Reduce the DCT.\n * This is the magic step. While the DCT is 32x32, just keep the\n * top-left 8x8. Those represent the lowest frequencies in the\n * picture.\n */\n /* 5. Compute the average value.\n * Like the Average Hash, compute the mean DCT value (using only\n * the 8x8 DCT low-frequency values and excluding the first term\n * since the DC coefficient can be significantly different from\n * the other values and will throw off the average).\n */\n let total = 0;\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n total += dctVals[x][y];\n }\n }\n const avg = total / (this.smallerSize * this.smallerSize);\n\n /* 6. Further reduce the DCT.\n * This is the magic step. Set the 64 hash bits to 0 or 1\n * depending on whether each of the 64 DCT values is above or\n * below the average value. The result doesn't tell us the\n * actual low frequencies; it just tells us the very-rough\n * relative scale of the frequencies to the mean. The result\n * will not vary as long as the overall structure of the image\n * remains the same; this can survive gamma and color histogram\n * adjustments without a problem.\n */\n let hash = \"\";\n for (let x = 0; x < this.smallerSize; x++) {\n for (let y = 0; y < this.smallerSize; y++) {\n hash += dctVals[x][y] > avg ? \"1\" : \"0\";\n }\n }\n return hash;\n};\n\n// DCT function stolen from http://stackoverflow.com/questions/4240490/problems-with-dct-and-idct-algorithm-in-java\n\n/**\n Convert a 32-bit integer color value to an RGBA object.\n */\nfunction intToRGBA(i) {\n const a = i & 0xff;\n i >>>= 8;\n const b = i & 0xff;\n i >>>= 8;\n const g = i & 0xff;\n i >>>= 8;\n const r = i & 0xff;\n return {\n r,\n g,\n b,\n a\n };\n}\nconst c = [];\nfunction initCoefficients(size) {\n for (let i = 1; i < size; i++) {\n c[i] = 1;\n }\n c[0] = 1 / Math.sqrt(2.0);\n}\nfunction applyDCT(f, size) {\n const N = size;\n const F = [];\n for (let u = 0; u < N; u++) {\n F[u] = [];\n for (let v = 0; v < N; v++) {\n let sum = 0;\n for (let i = 0; i < N; i++) {\n for (let j = 0; j < N; j++) {\n sum += Math.cos((2 * i + 1) / (2.0 * N) * u * Math.PI) * Math.cos((2 * j + 1) / (2.0 * N) * v * Math.PI) * f[i][j];\n }\n }\n sum *= c[u] * c[v] / 4;\n F[u][v] = sum;\n }\n }\n return F;\n}\nexport default ImagePHash;\n//# sourceMappingURL=phash.js.map","import \"isomorphic-fetch\";\nexport default ((_ref, cb) => {\n let {\n url,\n ...options\n } = _ref;\n fetch(url, options).then(response => {\n if (response.ok) {\n return response.arrayBuffer().catch(error => {\n throw new Error(`Response is not a buffer for url ${url}. Error: ${error.message}`);\n });\n }\n throw new Error(`HTTP Status ${response.status} for url ${url}`);\n }).then(data => cb(null, data)).catch(error => cb(error));\n});\n//# sourceMappingURL=request.js.map","// used to auto resizing etc.\nexport const AUTO = -1;\n\n// Align modes for cover, contain, bit masks\nexport const HORIZONTAL_ALIGN_LEFT = 1;\nexport const HORIZONTAL_ALIGN_CENTER = 2;\nexport const HORIZONTAL_ALIGN_RIGHT = 4;\nexport const VERTICAL_ALIGN_TOP = 8;\nexport const VERTICAL_ALIGN_MIDDLE = 16;\nexport const VERTICAL_ALIGN_BOTTOM = 32;\n\n// blend modes\nexport const BLEND_SOURCE_OVER = \"srcOver\";\nexport const BLEND_DESTINATION_OVER = \"dstOver\";\nexport const BLEND_MULTIPLY = \"multiply\";\nexport const BLEND_ADD = \"add\";\nexport const BLEND_SCREEN = \"screen\";\nexport const BLEND_OVERLAY = \"overlay\";\nexport const BLEND_DARKEN = \"darken\";\nexport const BLEND_LIGHTEN = \"lighten\";\nexport const BLEND_HARDLIGHT = \"hardLight\";\nexport const BLEND_DIFFERENCE = \"difference\";\nexport const BLEND_EXCLUSION = \"exclusion\";\n\n// Edge Handling\nexport const EDGE_EXTEND = 1;\nexport const EDGE_WRAP = 2;\nexport const EDGE_CROP = 3;\n//# sourceMappingURL=constants.js.map","export function srcOver(src, dst) {\n let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n src.a *= ops;\n const a = dst.a + src.a - dst.a * src.a;\n const r = (src.r * src.a + dst.r * dst.a * (1 - src.a)) / a;\n const g = (src.g * src.a + dst.g * dst.a * (1 - src.a)) / a;\n const b = (src.b * src.a + dst.b * dst.a * (1 - src.a)) / a;\n return {\n r,\n g,\n b,\n a\n };\n}\nexport function dstOver(src, dst) {\n let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n src.a *= ops;\n const a = dst.a + src.a - dst.a * src.a;\n const r = (dst.r * dst.a + src.r * src.a * (1 - dst.a)) / a;\n const g = (dst.g * dst.a + src.g * src.a * (1 - dst.a)) / a;\n const b = (dst.b * dst.a + src.b * src.a * (1 - dst.a)) / a;\n return {\n r,\n g,\n b,\n a\n };\n}\nexport function multiply(src, dst) {\n let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n src.a *= ops;\n const a = dst.a + src.a - dst.a * src.a;\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n const r = (sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;\n const g = (sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;\n const b = (sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;\n return {\n r,\n g,\n b,\n a\n };\n}\nexport function add(src, dst) {\n let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n src.a *= ops;\n const a = dst.a + src.a - dst.a * src.a;\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n const r = (sra + dra) / a;\n const g = (sga + dga) / a;\n const b = (sba + dba) / a;\n return {\n r,\n g,\n b,\n a\n };\n}\nexport function screen(src, dst) {\n let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n src.a *= ops;\n const a = dst.a + src.a - dst.a * src.a;\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n const r = (sra * dst.a + dra * src.a - sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;\n const g = (sga * dst.a + dga * src.a - sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;\n const b = (sba * dst.a + dba * src.a - sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;\n return {\n r,\n g,\n b,\n a\n };\n}\nexport function overlay(src, dst) {\n let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n src.a *= ops;\n const a = dst.a + src.a - dst.a * src.a;\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n const r = (2 * dra <= dst.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a;\n const g = (2 * dga <= dst.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a;\n const b = (2 * dba <= dst.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a;\n return {\n r,\n g,\n b,\n a\n };\n}\nexport function darken(src, dst) {\n let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n src.a *= ops;\n const a = dst.a + src.a - dst.a * src.a;\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n const r = (Math.min(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a;\n const g = (Math.min(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a;\n const b = (Math.min(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a;\n return {\n r,\n g,\n b,\n a\n };\n}\nexport function lighten(src, dst) {\n let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n src.a *= ops;\n const a = dst.a + src.a - dst.a * src.a;\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n const r = (Math.max(sra * dst.a, dra * src.a) + sra * (1 - dst.a) + dra * (1 - src.a)) / a;\n const g = (Math.max(sga * dst.a, dga * src.a) + sga * (1 - dst.a) + dga * (1 - src.a)) / a;\n const b = (Math.max(sba * dst.a, dba * src.a) + sba * (1 - dst.a) + dba * (1 - src.a)) / a;\n return {\n r,\n g,\n b,\n a\n };\n}\nexport function hardLight(src, dst) {\n let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n src.a *= ops;\n const a = dst.a + src.a - dst.a * src.a;\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n const r = (2 * sra <= src.a ? 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a) : sra * (1 + dst.a) + dra * (1 + src.a) - 2 * dra * sra - dst.a * src.a) / a;\n const g = (2 * sga <= src.a ? 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a) : sga * (1 + dst.a) + dga * (1 + src.a) - 2 * dga * sga - dst.a * src.a) / a;\n const b = (2 * sba <= src.a ? 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a) : sba * (1 + dst.a) + dba * (1 + src.a) - 2 * dba * sba - dst.a * src.a) / a;\n return {\n r,\n g,\n b,\n a\n };\n}\nexport function difference(src, dst) {\n let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n src.a *= ops;\n const a = dst.a + src.a - dst.a * src.a;\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n const r = (sra + dra - 2 * Math.min(sra * dst.a, dra * src.a)) / a;\n const g = (sga + dga - 2 * Math.min(sga * dst.a, dga * src.a)) / a;\n const b = (sba + dba - 2 * Math.min(sba * dst.a, dba * src.a)) / a;\n return {\n r,\n g,\n b,\n a\n };\n}\nexport function exclusion(src, dst) {\n let ops = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n src.a *= ops;\n const a = dst.a + src.a - dst.a * src.a;\n const sra = src.r * src.a;\n const sga = src.g * src.a;\n const sba = src.b * src.a;\n const dra = dst.r * dst.a;\n const dga = dst.g * dst.a;\n const dba = dst.b * dst.a;\n const r = (sra * dst.a + dra * src.a - 2 * sra * dra + sra * (1 - dst.a) + dra * (1 - src.a)) / a;\n const g = (sga * dst.a + dga * src.a - 2 * sga * dga + sga * (1 - dst.a) + dga * (1 - src.a)) / a;\n const b = (sba * dst.a + dba * src.a - 2 * sba * dba + sba * (1 - dst.a) + dba * (1 - src.a)) / a;\n return {\n r,\n g,\n b,\n a\n };\n}\n//# sourceMappingURL=composite-modes.js.map","const promisify = function (fun, ctx) {\n for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n args[_key - 2] = arguments[_key];\n }\n return new Promise((resolve, reject) => {\n args.push((err, data) => {\n if (err) {\n reject(err);\n }\n resolve(data);\n });\n fun.bind(ctx)(...args);\n });\n};\nexport default promisify;\n//# sourceMappingURL=promisify.js.map","const mimeTypes = {};\nconst findType = extension => Object.entries(mimeTypes).find(type => type[1].includes(extension)) || [];\nexport const addType = (mime, extensions) => {\n mimeTypes[mime] = extensions;\n};\n\n/**\n * Lookup a mime type based on extension\n * @param {string} path path to find extension for\n * @returns {string} mime found mime type\n */\nexport const getType = path => {\n const pathParts = path.split(\"/\").slice(-1);\n const extension = pathParts[pathParts.length - 1].split(\".\").pop();\n const type = findType(extension);\n return type[0];\n};\n\n/**\n * Return file extension associated with a mime type\n * @param {string} type mime type to look up\n * @returns {string} extension file extension\n */\nexport const getExtension = type => (mimeTypes[type.toLowerCase()] || [])[0];\n//# sourceMappingURL=mime.js.map","import FileType from \"file-type\";\nimport EXIFParser from \"exif-parser\";\nimport { throwError } from \"@jimp/utils\";\nimport * as constants from \"../constants\";\nimport * as MIME from \"./mime\";\nimport promisify from \"./promisify\";\nasync function getMIMEFromBuffer(buffer, path) {\n const fileTypeFromBuffer = await FileType.fromBuffer(buffer);\n if (fileTypeFromBuffer) {\n // If fileType returns something for buffer, then return the mime given\n return fileTypeFromBuffer.mime;\n }\n if (path) {\n // If a path is supplied, and fileType yields no results, then retry with MIME\n // Path can be either a file path or a url\n return MIME.getType(path);\n }\n return null;\n}\n\n/*\n * Obtains image orientation from EXIF metadata.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {number} a number 1-8 representing EXIF orientation,\n * in particular 1 if orientation tag is missing\n */\nfunction getExifOrientation(img) {\n return img._exif && img._exif.tags && img._exif.tags.Orientation || 1;\n}\n\n/**\n * Returns a function which translates EXIF-rotated coordinates into\n * non-rotated ones.\n *\n * Transformation reference: http://sylvana.net/jpegcrop/exif_orientation.html.\n *\n * @param img {Jimp} a Jimp image object\n * @returns {function} transformation function for transformBitmap().\n */\nfunction getExifOrientationTransformation(img) {\n const w = img.getWidth();\n const h = img.getHeight();\n switch (getExifOrientation(img)) {\n case 1:\n // Horizontal (normal)\n // does not need to be supported here\n return null;\n case 2:\n // Mirror horizontal\n return function (x, y) {\n return [w - x - 1, y];\n };\n case 3:\n // Rotate 180\n return function (x, y) {\n return [w - x - 1, h - y - 1];\n };\n case 4:\n // Mirror vertical\n return function (x, y) {\n return [x, h - y - 1];\n };\n case 5:\n // Mirror horizontal and rotate 270 CW\n return function (x, y) {\n return [y, x];\n };\n case 6:\n // Rotate 90 CW\n return function (x, y) {\n return [y, h - x - 1];\n };\n case 7:\n // Mirror horizontal and rotate 90 CW\n return function (x, y) {\n return [w - y - 1, h - x - 1];\n };\n case 8:\n // Rotate 270 CW\n return function (x, y) {\n return [w - y - 1, x];\n };\n default:\n return null;\n }\n}\n\n/*\n * Transforms bitmap in place (moves pixels around) according to given\n * transformation function.\n *\n * @param img {Jimp} a Jimp image object, which bitmap is supposed to\n * be transformed\n * @param width {number} bitmap width after the transformation\n * @param height {number} bitmap height after the transformation\n * @param transformation {function} transformation function which defines pixel\n * mapping between new and source bitmap. It takes a pair of coordinates\n * in the target, and returns a respective pair of coordinates in\n * the source bitmap, i.e. has following form:\n * `function(new_x, new_y) { return [src_x, src_y] }`.\n */\nfunction transformBitmap(img, width, height, transformation) {\n // Underscore-prefixed values are related to the source bitmap\n // Their counterparts with no prefix are related to the target bitmap\n const _data = img.bitmap.data;\n const _width = img.bitmap.width;\n const data = Buffer.alloc(_data.length);\n for (let x = 0; x < width; x++) {\n for (let y = 0; y < height; y++) {\n const [_x, _y] = transformation(x, y);\n const idx = width * y + x << 2;\n const _idx = _width * _y + _x << 2;\n const pixel = _data.readUInt32BE(_idx);\n data.writeUInt32BE(pixel, idx);\n }\n }\n img.bitmap.data = data;\n img.bitmap.width = width;\n img.bitmap.height = height;\n}\n\n/*\n * Automagically rotates an image based on its EXIF data (if present).\n * @param img {Jimp} a Jimp image object\n */\nfunction exifRotate(img) {\n if (getExifOrientation(img) < 2) return;\n const transformation = getExifOrientationTransformation(img);\n const swapDimensions = getExifOrientation(img) > 4;\n const newWidth = swapDimensions ? img.bitmap.height : img.bitmap.width;\n const newHeight = swapDimensions ? img.bitmap.width : img.bitmap.height;\n transformBitmap(img, newWidth, newHeight, transformation);\n}\n\n// parses a bitmap from the constructor to the JIMP bitmap property\nexport async function parseBitmap(data, path, cb) {\n const mime = await getMIMEFromBuffer(data, path);\n if (typeof mime !== \"string\") {\n return cb(new Error(\"Could not find MIME for Buffer <\" + path + \">\"));\n }\n this._originalMime = mime.toLowerCase();\n try {\n const mime = this.getMIME();\n if (this.constructor.decoders[mime]) {\n this.bitmap = this.constructor.decoders[mime](data);\n } else {\n return throwError.call(this, \"Unsupported MIME type: \" + mime, cb);\n }\n } catch (error) {\n return cb.call(this, error, this);\n }\n try {\n this._exif = EXIFParser.create(data).parse();\n exifRotate(this); // EXIF data\n } catch (error) {\n /* meh */\n }\n cb.call(this, null, this);\n return this;\n}\nfunction compositeBitmapOverBackground(Jimp, image) {\n return new Jimp(image.bitmap.width, image.bitmap.height, image._background).composite(image, 0, 0).bitmap;\n}\n\n/**\n * Converts the image to a buffer\n * @param {(string|number)} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\nexport function getBuffer(mime, cb) {\n if (mime === constants.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n if (typeof mime !== \"string\") {\n return throwError.call(this, \"mime must be a string\", cb);\n }\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", cb);\n }\n mime = mime.toLowerCase();\n if (this._rgba && this.constructor.hasAlpha[mime]) {\n this.bitmap.data = Buffer.from(this.bitmap.data);\n } else {\n // when format doesn't support alpha\n // composite onto a new image so that the background shows through alpha channels\n this.bitmap.data = compositeBitmapOverBackground(this.constructor, this).data;\n }\n if (this.constructor.encoders[mime]) {\n const buffer = this.constructor.encoders[mime](this);\n // Typically, buffers return a string or map. However, the gif library \"gifwrap\" seemingly returns promises.\n if (buffer instanceof Promise) {\n // trigger the callback when the promise has been resolved\n buffer.then(buff => {\n cb.call(this, null, buff);\n });\n } else {\n cb.call(this, null, buffer);\n }\n } else {\n return throwError.call(this, \"Unsupported MIME type: \" + mime, cb);\n }\n return this;\n}\nexport function getBufferAsync(mime) {\n return promisify(getBuffer, this, mime);\n}\n//# sourceMappingURL=image-bitmap.js.map","function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport fs from \"fs\";\nimport Path from \"path\";\nimport EventEmitter from \"events\";\nimport { isNodePattern, throwError, scan, scanIterator } from \"@jimp/utils\";\nimport anyBase from \"any-base\";\nimport pixelMatch from \"pixelmatch\";\nimport tinyColor from \"tinycolor2\";\nimport ImagePHash from \"./modules/phash\";\nimport request from \"./request\";\nimport composite from \"./composite\";\nimport promisify from \"./utils/promisify\";\nimport * as MIME from \"./utils/mime\";\nimport { parseBitmap, getBuffer, getBufferAsync } from \"./utils/image-bitmap\";\nimport * as constants from \"./constants\";\nconst alphabet = \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_\";\n\n// an array storing the maximum string length of hashes at various bases\n// 0 and 1 do not exist as possible hash lengths\nconst maxHashLength = [NaN, NaN];\nfor (let i = 2; i < 65; i++) {\n const maxHash = anyBase(anyBase.BIN, alphabet.slice(0, i))(new Array(64 + 1).join(\"1\"));\n maxHashLength.push(maxHash.length);\n}\n\n// no operation\nfunction noop() {}\n\n// error checking methods\n\nfunction isArrayBuffer(test) {\n return Object.prototype.toString.call(test).toLowerCase().indexOf(\"arraybuffer\") > -1;\n}\n\n// Prepare a Buffer object from the arrayBuffer. Necessary in the browser > node conversion,\n// But this function is not useful when running in node directly\nfunction bufferFromArrayBuffer(arrayBuffer) {\n const buffer = Buffer.alloc(arrayBuffer.byteLength);\n const view = new Uint8Array(arrayBuffer);\n for (let i = 0; i < buffer.length; ++i) {\n buffer[i] = view[i];\n }\n return buffer;\n}\nfunction loadFromURL(options, cb) {\n request(options, (err, data) => {\n if (err) {\n return cb(err);\n }\n if (typeof data === \"object\" && Buffer.isBuffer(data)) {\n return cb(null, data);\n }\n if (typeof data === \"object\" && isArrayBuffer(data)) {\n return cb(null, bufferFromArrayBuffer(data));\n }\n return new Error(`Could not load Buffer from <${options.url}>`);\n });\n}\nfunction loadBufferFromPath(src, cb) {\n if (fs && typeof fs.readFile === \"function\" && !src.match(/^(http|ftp)s?:\\/\\/./)) {\n fs.readFile(src, cb);\n } else {\n loadFromURL({\n url: src\n }, cb);\n }\n}\nfunction isRawRGBAData(obj) {\n return obj && typeof obj === \"object\" && typeof obj.width === \"number\" && typeof obj.height === \"number\" && (Buffer.isBuffer(obj.data) || obj.data instanceof Uint8Array || typeof Uint8ClampedArray === \"function\" && obj.data instanceof Uint8ClampedArray) && (obj.data.length === obj.width * obj.height * 4 || obj.data.length === obj.width * obj.height * 3);\n}\nfunction makeRGBABufferFromRGB(buffer) {\n if (buffer.length % 3 !== 0) {\n throw new Error(\"Buffer length is incorrect\");\n }\n const rgbaBuffer = Buffer.allocUnsafe(buffer.length / 3 * 4);\n let j = 0;\n for (let i = 0; i < buffer.length; i++) {\n rgbaBuffer[j] = buffer[i];\n if ((i + 1) % 3 === 0) {\n rgbaBuffer[++j] = 255;\n }\n j++;\n }\n return rgbaBuffer;\n}\nconst emptyBitmap = {\n data: null,\n width: null,\n height: null\n};\n\n/**\n * Jimp constructor (from a file)\n * @param path a path to the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a url with options)\n * @param options { url, otherOptions}\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from another Jimp image or raw image data)\n * @param image a Jimp image to clone\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (from a Buffer)\n * @param data a Buffer containing the image data\n * @param {function(Error, Jimp)} cb a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\n/**\n * Jimp constructor (to generate a new image)\n * @param w the width of the image\n * @param h the height of the image\n * @param background color to fill the image with\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is parsed to a bitmap\n */\n\nclass Jimp extends EventEmitter {\n // An object representing a bitmap in memory, comprising:\n // - data: a buffer of the bitmap data\n // - width: the width of the image in pixels\n // - height: the height of the image in pixels\n\n // Default colour to use for new pixels\n\n // Default MIME is PNG\n\n // Exif data for the image\n\n // Whether Transparency supporting formats will be exported as RGB or RGBA\n\n constructor() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n super();\n _defineProperty(this, \"bitmap\", emptyBitmap);\n _defineProperty(this, \"_background\", 0x00000000);\n _defineProperty(this, \"_originalMime\", Jimp.MIME_PNG);\n _defineProperty(this, \"_exif\", null);\n _defineProperty(this, \"_rgba\", true);\n _defineProperty(this, \"writeAsync\", path => promisify(this.write, this, path));\n _defineProperty(this, \"getBase64Async\", mime => promisify(this.getBase64, this, mime));\n _defineProperty(this, \"getBuffer\", getBuffer);\n _defineProperty(this, \"getBufferAsync\", getBufferAsync);\n _defineProperty(this, \"getPixelColour\", this.getPixelColor);\n _defineProperty(this, \"setPixelColour\", this.setPixelColor);\n const jimpInstance = this;\n let cb = noop;\n if (isArrayBuffer(args[0])) {\n args[0] = bufferFromArrayBuffer(args[0]);\n }\n function finish() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n const [err] = args;\n const evData = err || {};\n evData.methodName = \"constructor\";\n setTimeout(() => {\n // run on next tick.\n if (err && cb === noop) {\n jimpInstance.emitError(\"constructor\", err);\n } else if (!err) {\n jimpInstance.emitMulti(\"constructor\", \"initialized\");\n }\n cb.call(jimpInstance, ...args);\n }, 1);\n }\n if (typeof args[0] === \"number\" && typeof args[1] === \"number\" || parseInt(args[0], 10) && parseInt(args[1], 10)) {\n // create a new image\n const w = parseInt(args[0], 10);\n const h = parseInt(args[1], 10);\n cb = args[2];\n\n // with a hex color\n if (typeof args[2] === \"number\") {\n this._background = args[2];\n cb = args[3];\n }\n\n // with a css color\n if (typeof args[2] === \"string\") {\n this._background = Jimp.cssColorToHex(args[2]);\n cb = args[3];\n }\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n this.bitmap = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h\n };\n for (let i = 0; i < this.bitmap.data.length; i += 4) {\n this.bitmap.data.writeUInt32BE(this._background, i);\n }\n finish(null, this);\n } else if (typeof args[0] === \"object\" && args[0].url) {\n cb = args[1] || noop;\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n loadFromURL(args[0], (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n this.parseBitmap(data, args[0].url, finish);\n });\n } else if (args[0] instanceof Jimp) {\n // clone an existing Jimp\n const [original] = args;\n cb = args[1];\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n this.bitmap = {\n data: Buffer.from(original.bitmap.data),\n width: original.bitmap.width,\n height: original.bitmap.height\n };\n this._quality = original._quality;\n this._deflateLevel = original._deflateLevel;\n this._deflateStrategy = original._deflateStrategy;\n this._filterType = original._filterType;\n this._rgba = original._rgba;\n this._background = original._background;\n this._originalMime = original._originalMime;\n finish(null, this);\n } else if (isRawRGBAData(args[0])) {\n const [imageData] = args;\n cb = args[1] || noop;\n const isRGBA = imageData.width * imageData.height * 4 === imageData.data.length;\n const buffer = isRGBA ? Buffer.from(imageData.data) : makeRGBABufferFromRGB(imageData.data);\n this.bitmap = {\n data: buffer,\n width: imageData.width,\n height: imageData.height\n };\n finish(null, this);\n } else if (typeof args[0] === \"string\") {\n // read from a path\n const path = args[0];\n cb = args[1];\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n loadBufferFromPath(path, (err, data) => {\n if (err) {\n return throwError.call(this, err, finish);\n }\n this.parseBitmap(data, path, finish);\n });\n } else if (typeof args[0] === \"object\" && Buffer.isBuffer(args[0])) {\n // read from a buffer\n const data = args[0];\n cb = args[1];\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", finish);\n }\n this.parseBitmap(data, null, finish);\n } else {\n // Allow client libs to add new ways to build a Jimp object.\n // Extra constructors must be added by `Jimp.appendConstructorOption()`\n cb = args[args.length - 1];\n if (typeof cb !== \"function\") {\n // TODO: try to solve the args after cb problem.\n cb = args[args.length - 2];\n if (typeof cb !== \"function\") {\n cb = noop;\n }\n }\n const extraConstructor = Jimp.__extraConstructors.find(c => c.test(...args));\n if (extraConstructor) {\n new Promise((resolve, reject) => {\n extraConstructor.run.call(this, resolve, reject, ...args);\n }).then(() => finish(null, this)).catch(finish);\n } else {\n return throwError.call(this, \"No matching constructor overloading was found. \" + \"Please see the docs for how to call the Jimp constructor.\", finish);\n }\n }\n }\n\n /**\n * Parse a bitmap with the loaded image types.\n *\n * @param {Buffer} data raw image data\n * @param {string} path optional path to file\n * @param {function(Error, Jimp)} finish (optional) a callback for when complete\n * @memberof Jimp\n */\n parseBitmap(data, path, finish) {\n parseBitmap.call(this, data, null, finish);\n }\n\n /**\n * Sets the type of the image (RGB or RGBA) when saving in a format that supports transparency (default is RGBA)\n * @param {boolean} bool A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rgba(bool, cb) {\n if (typeof bool !== \"boolean\") {\n return throwError.call(this, \"bool must be a boolean, true for RGBA or false for RGB\", cb);\n }\n this._rgba = bool;\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n }\n\n /**\n * Emit for multiple listeners\n * @param {string} methodName name of the method to emit an error for\n * @param {string} eventName name of the eventName to emit an error for\n * @param {object} data to emit\n */\n emitMulti(methodName, eventName) {\n let data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n data = Object.assign(data, {\n methodName,\n eventName\n });\n this.emit(\"any\", data);\n if (methodName) {\n this.emit(methodName, data);\n }\n this.emit(eventName, data);\n }\n emitError(methodName, err) {\n this.emitMulti(methodName, \"error\", err);\n }\n\n /**\n * Get the current height of the image\n * @return {number} height of the image\n */\n getHeight() {\n return this.bitmap.height;\n }\n\n /**\n * Get the current width of the image\n * @return {number} width of the image\n */\n getWidth() {\n return this.bitmap.width;\n }\n\n /**\n * Nicely format Jimp object when sent to the console e.g. console.log(image)\n * @returns {string} pretty printed\n */\n inspect() {\n return \"\";\n }\n\n /**\n * Nicely format Jimp object when converted to a string\n * @returns {string} pretty printed\n */\n toString() {\n return \"[object Jimp]\";\n }\n\n /**\n * Returns the original MIME of the image (default: \"image/png\")\n * @returns {string} the MIME\n */\n getMIME() {\n const mime = this._originalMime || Jimp.MIME_PNG;\n return mime;\n }\n\n /**\n * Returns the appropriate file extension for the original MIME of the image (default: \"png\")\n * @returns {string} the file extension\n */\n getExtension() {\n const mime = this.getMIME();\n return MIME.getExtension(mime);\n }\n\n /**\n * Writes the image to a file\n * @param {string} path a path to the destination file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the image is saved to disk\n * @returns {Jimp} this for chaining of methods\n */\n write(path, cb) {\n if (!fs || !fs.createWriteStream) {\n throw new Error(\"Cant access the filesystem. You can use the getBase64 method.\");\n }\n if (typeof path !== \"string\") {\n return throwError.call(this, \"path must be a string\", cb);\n }\n if (typeof cb === \"undefined\") {\n cb = noop;\n }\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", cb);\n }\n const mime = MIME.getType(path) || this.getMIME();\n const pathObj = Path.parse(path);\n if (pathObj.dir) {\n fs.mkdirSync(pathObj.dir, {\n recursive: true\n });\n }\n this.getBuffer(mime, (err, buffer) => {\n if (err) {\n return throwError.call(this, err, cb);\n }\n const stream = fs.createWriteStream(path);\n stream.on(\"open\", () => {\n stream.write(buffer);\n stream.end();\n }).on(\"error\", err => {\n return throwError.call(this, err, cb);\n });\n stream.on(\"finish\", () => {\n cb.call(this, null, this);\n });\n });\n return this;\n }\n /**\n * Converts the image to a base 64 string\n * @param {string} mime the mime type of the image data to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n getBase64(mime, cb) {\n if (mime === Jimp.AUTO) {\n // allow auto MIME detection\n mime = this.getMIME();\n }\n if (typeof mime !== \"string\") {\n return throwError.call(this, \"mime must be a string\", cb);\n }\n if (typeof cb !== \"function\") {\n return throwError.call(this, \"cb must be a function\", cb);\n }\n this.getBuffer(mime, function (err, data) {\n if (err) {\n return throwError.call(this, err, cb);\n }\n const src = \"data:\" + mime + \";base64,\" + data.toString(\"base64\");\n cb.call(this, null, src);\n });\n return this;\n }\n /**\n * Generates a perceptual hash of the image . And pads the string. Can configure base.\n * @param {number} base (optional) a number between 2 and 64 representing the base for the hash (e.g. 2 is binary, 10 is decimal, 16 is hex, 64 is base 64). Defaults to 64.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {string} a string representing the hash\n */\n hash(base, cb) {\n base = base || 64;\n if (typeof base === \"function\") {\n cb = base;\n base = 64;\n }\n if (typeof base !== \"number\") {\n return throwError.call(this, \"base must be a number\", cb);\n }\n if (base < 2 || base > 64) {\n return throwError.call(this, \"base must be a number between 2 and 64\", cb);\n }\n let hash = this.pHash();\n hash = anyBase(anyBase.BIN, alphabet.slice(0, base))(hash);\n while (hash.length < maxHashLength[base]) {\n hash = \"0\" + hash; // pad out with leading zeros\n }\n\n if (isNodePattern(cb)) {\n cb.call(this, null, hash);\n }\n return hash;\n }\n\n /**\n * Calculates the perceptual hash\n * @returns {number} the perceptual hash\n */\n pHash() {\n const pHash = new ImagePHash();\n return pHash.getHash(this);\n }\n\n /**\n * Calculates the hamming distance of the current image and a hash based on their perceptual hash\n * @param {hash} compareHash hash to compare to\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\n distanceFromHash(compareHash) {\n const pHash = new ImagePHash();\n const currentHash = pHash.getHash(this);\n return pHash.distance(currentHash, compareHash);\n }\n\n /**\n * Converts the image to a buffer\n * @param {string} mime the mime type of the image buffer to be created\n * @param {function(Error, Jimp)} cb a Node-style function to call with the buffer as the second argument\n * @returns {Jimp} this for chaining of methods\n */\n\n /**\n * Returns the offset of a pixel in the bitmap buffer\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {number} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {number} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n getPixelIndex(x, y, edgeHandling, cb) {\n let xi;\n let yi;\n if (typeof edgeHandling === \"function\" && typeof cb === \"undefined\") {\n cb = edgeHandling;\n edgeHandling = null;\n }\n if (!edgeHandling) {\n edgeHandling = Jimp.EDGE_EXTEND;\n }\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n xi = x;\n yi = y;\n if (edgeHandling === Jimp.EDGE_EXTEND) {\n if (x < 0) xi = 0;\n if (x >= this.bitmap.width) xi = this.bitmap.width - 1;\n if (y < 0) yi = 0;\n if (y >= this.bitmap.height) yi = this.bitmap.height - 1;\n }\n if (edgeHandling === Jimp.EDGE_WRAP) {\n if (x < 0) {\n xi = this.bitmap.width + x;\n }\n if (x >= this.bitmap.width) {\n xi = x % this.bitmap.width;\n }\n if (y < 0) {\n yi = this.bitmap.height + y;\n }\n if (y >= this.bitmap.height) {\n yi = y % this.bitmap.height;\n }\n }\n let i = this.bitmap.width * yi + xi << 2;\n\n // if out of bounds index is -1\n if (xi < 0 || xi >= this.bitmap.width) {\n i = -1;\n }\n if (yi < 0 || yi >= this.bitmap.height) {\n i = -1;\n }\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n return i;\n }\n\n /**\n * Returns the hex colour value of a pixel\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the color of the pixel\n */\n getPixelColor(x, y, cb) {\n if (typeof x !== \"number\" || typeof y !== \"number\") return throwError.call(this, \"x and y must be numbers\", cb);\n const idx = this.getPixelIndex(x, y);\n const hex = this.bitmap.data.readUInt32BE(idx);\n if (isNodePattern(cb)) {\n cb.call(this, null, hex);\n }\n return hex;\n }\n /**\n * Returns the hex colour value of a pixel\n * @param {number} hex color to set\n * @param {number} x the x coordinate\n * @param {number} y the y coordinate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {number} the index of the pixel or -1 if not found\n */\n setPixelColor(hex, x, y, cb) {\n if (typeof hex !== \"number\" || typeof x !== \"number\" || typeof y !== \"number\") return throwError.call(this, \"hex, x and y must be numbers\", cb);\n const idx = this.getPixelIndex(x, y);\n this.bitmap.data.writeUInt32BE(hex, idx);\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n }\n /**\n * Determine if the image contains opaque pixels.\n * @return {boolean} hasAlpha whether the image contains opaque pixels\n */\n hasAlpha() {\n const {\n width,\n height,\n data\n } = this.bitmap;\n const byteLen = width * height << 2;\n for (let idx = 3; idx < byteLen; idx += 4) {\n if (data[idx] !== 0xff) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Iterate scan through a region of the bitmap\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @returns {IterableIterator<{x: number, y: number, idx: number, image: Jimp}>}\n */\n scanIterator(x, y, w, h) {\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\");\n }\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\");\n }\n return scanIterator(this, x, y, w, h);\n }\n}\nexport function addConstants(constants) {\n let jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp;\n Object.entries(constants).forEach(_ref => {\n let [name, value] = _ref;\n jimpInstance[name] = value;\n });\n}\nexport function addJimpMethods(methods) {\n let jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp;\n Object.entries(methods).forEach(_ref2 => {\n let [name, value] = _ref2;\n jimpInstance.prototype[name] = value;\n });\n}\naddConstants(constants);\naddJimpMethods({\n composite\n});\nJimp.__extraConstructors = [];\n\n/**\n * Allow client libs to add new ways to build a Jimp object.\n * @param {string} name identify the extra constructor.\n * @param {function} test a function that returns true when it accepts the arguments passed to the main constructor.\n * @param {function} run where the magic happens.\n */\nJimp.appendConstructorOption = function (name, test, run) {\n Jimp.__extraConstructors.push({\n name,\n test,\n run\n });\n};\n\n/**\n * Read an image from a file or a Buffer. Takes the same args as the constructor\n * @returns {Promise} a promise\n */\nJimp.read = function () {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n return new Promise((resolve, reject) => {\n // eslint-disable-next-line no-new\n new Jimp(...args, (err, image) => {\n if (err) reject(err);else resolve(image);\n });\n });\n};\nJimp.create = Jimp.read;\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} r the red value (0-255)\n * @param {number} g the green value (0-255)\n * @param {number} b the blue value (0-255)\n * @param {number} a the alpha value (0-255)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {number} an single integer colour value\n */\nJimp.rgbaToInt = function (r, g, b, a, cb) {\n if (typeof r !== \"number\" || typeof g !== \"number\" || typeof b !== \"number\" || typeof a !== \"number\") {\n return throwError.call(this, \"r, g, b and a must be numbers\", cb);\n }\n if (r < 0 || r > 255) {\n return throwError.call(this, \"r must be between 0 and 255\", cb);\n }\n if (g < 0 || g > 255) {\n throwError.call(this, \"g must be between 0 and 255\", cb);\n }\n if (b < 0 || b > 255) {\n return throwError.call(this, \"b must be between 0 and 255\", cb);\n }\n if (a < 0 || a > 255) {\n return throwError.call(this, \"a must be between 0 and 255\", cb);\n }\n let i = r & 0xff;\n i <<= 8;\n i |= g & 0xff;\n i <<= 8;\n i |= b & 0xff;\n i <<= 8;\n i |= a & 0xff;\n\n // Ensure sign is correct\n i >>>= 0;\n if (isNodePattern(cb)) {\n cb.call(this, null, i);\n }\n return i;\n};\n\n/**\n * A static helper method that converts RGBA values to a single integer value\n * @param {number} i a single integer value representing an RGBA colour (e.g. 0xFF0000FF for red)\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns {object} an object with the properties r, g, b and a representing RGBA values\n */\nJimp.intToRGBA = function (i, cb) {\n if (typeof i !== \"number\") {\n return throwError.call(this, \"i must be a number\", cb);\n }\n const rgba = {};\n rgba.r = Math.floor(i / Math.pow(256, 3));\n rgba.g = Math.floor((i - rgba.r * Math.pow(256, 3)) / Math.pow(256, 2));\n rgba.b = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2)) / Math.pow(256, 1));\n rgba.a = Math.floor((i - rgba.r * Math.pow(256, 3) - rgba.g * Math.pow(256, 2) - rgba.b * Math.pow(256, 1)) / Math.pow(256, 0));\n if (isNodePattern(cb)) {\n cb.call(this, null, rgba);\n }\n return rgba;\n};\n\n/**\n * Converts a css color (Hex, 8-digit (RGBA) Hex, RGB, RGBA, HSL, HSLA, HSV, HSVA, Named) to a hex number\n * @param {string} cssColor a number\n * @returns {number} a hex number representing a color\n */\nJimp.cssColorToHex = function (cssColor) {\n cssColor = cssColor || 0; // 0, null, undefined, NaN\n\n if (typeof cssColor === \"number\") return Number(cssColor);\n return parseInt(tinyColor(cssColor).toHex8(), 16);\n};\n\n/**\n * Limits a number to between 0 or 255\n * @param {number} n a number\n * @returns {number} the number limited to between 0 or 255\n */\nJimp.limit255 = function (n) {\n n = Math.max(n, 0);\n n = Math.min(n, 255);\n return n;\n};\n\n/**\n * Diffs two images and returns\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @param {number} threshold (optional) a number, 0 to 1, the smaller the value the more sensitive the comparison (default: 0.1)\n * @returns {object} an object { percent: percent similar, diff: a Jimp image highlighting differences }\n */\nJimp.diff = function (img1, img2) {\n let threshold = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.1;\n if (!(img1 instanceof Jimp) || !(img2 instanceof Jimp)) return throwError.call(this, \"img1 and img2 must be an Jimp images\");\n const bmp1 = img1.bitmap;\n const bmp2 = img2.bitmap;\n if (bmp1.width !== bmp2.width || bmp1.height !== bmp2.height) {\n if (bmp1.width * bmp1.height > bmp2.width * bmp2.height) {\n // img1 is bigger\n img1 = img1.cloneQuiet().resize(bmp2.width, bmp2.height);\n } else {\n // img2 is bigger (or they are the same in area)\n img2 = img2.cloneQuiet().resize(bmp1.width, bmp1.height);\n }\n }\n if (typeof threshold !== \"number\" || threshold < 0 || threshold > 1) {\n return throwError.call(this, \"threshold must be a number between 0 and 1\");\n }\n const diff = new Jimp(bmp1.width, bmp1.height, 0xffffffff);\n const numDiffPixels = pixelMatch(bmp1.data, bmp2.data, diff.bitmap.data, diff.bitmap.width, diff.bitmap.height, {\n threshold\n });\n return {\n percent: numDiffPixels / (diff.bitmap.width * diff.bitmap.height),\n image: diff\n };\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {Jimp} img1 a Jimp image to compare\n * @param {Jimp} img2 a Jimp image to compare\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.distance = function (img1, img2) {\n const phash = new ImagePHash();\n const hash1 = phash.getHash(img1);\n const hash2 = phash.getHash(img2);\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Calculates the hamming distance of two images based on their perceptual hash\n * @param {hash} hash1 a pHash\n * @param {hash} hash2 a pHash\n * @returns {number} a number ranging from 0 to 1, 0 means they are believed to be identical\n */\nJimp.compareHashes = function (hash1, hash2) {\n const phash = new ImagePHash();\n return phash.distance(hash1, hash2);\n};\n\n/**\n * Compute color difference\n * 0 means no difference, 1 means maximum difference.\n * @param {number} rgba1: first color to compare.\n * @param {number} rgba2: second color to compare.\n * Both parameters must be an color object {r:val, g:val, b:val, a:val}\n * Where `a` is optional and `val` is an integer between 0 and 255.\n * @returns {number} float between 0 and 1.\n */\nJimp.colorDiff = function (rgba1, rgba2) {\n const pow = n => Math.pow(n, 2);\n const {\n max\n } = Math;\n const maxVal = 255 * 255 * 3;\n if (rgba1.a !== 0 && !rgba1.a) {\n rgba1.a = 255;\n }\n if (rgba2.a !== 0 && !rgba2.a) {\n rgba2.a = 255;\n }\n return (max(pow(rgba1.r - rgba2.r), pow(rgba1.r - rgba2.r - rgba1.a + rgba2.a)) + max(pow(rgba1.g - rgba2.g), pow(rgba1.g - rgba2.g - rgba1.a + rgba2.a)) + max(pow(rgba1.b - rgba2.b), pow(rgba1.b - rgba2.b - rgba1.a + rgba2.a))) / maxVal;\n};\n\n/**\n * Helper to create Jimp methods that emit events before and after its execution.\n * @param {string} methodName The name to be appended to Jimp prototype.\n * @param {string} evName The event name to be called.\n * It will be prefixed by `before-` and emitted when on method call.\n * It will be appended by `ed` and emitted after the method run.\n * @param {function} method A function implementing the method itself.\n * It will also create a quiet version that will not emit events, to not\n * mess the user code with many `changed` event calls. You can call with\n * `methodName + \"Quiet\"`.\n *\n * The emitted event comes with a object parameter to the listener with the\n * `methodName` as one attribute.\n */\nexport function jimpEvMethod(methodName, evName, method) {\n const evNameBefore = \"before-\" + evName;\n const evNameAfter = evName.replace(/e$/, \"\") + \"ed\";\n Jimp.prototype[methodName] = function () {\n let wrappedCb;\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n const cb = args[method.length - 1];\n const jimpInstance = this;\n if (typeof cb === \"function\") {\n wrappedCb = function () {\n for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n args[_key5] = arguments[_key5];\n }\n const [err, data] = args;\n if (err) {\n jimpInstance.emitError(methodName, err);\n } else {\n jimpInstance.emitMulti(methodName, evNameAfter, {\n [methodName]: data\n });\n }\n cb.apply(this, args);\n };\n args[args.length - 1] = wrappedCb;\n } else {\n wrappedCb = false;\n }\n this.emitMulti(methodName, evNameBefore);\n let result;\n try {\n result = method.apply(this, args);\n if (!wrappedCb) {\n this.emitMulti(methodName, evNameAfter, {\n [methodName]: result\n });\n }\n } catch (error) {\n error.methodName = methodName;\n this.emitError(methodName, error);\n }\n return result;\n };\n Jimp.prototype[methodName + \"Quiet\"] = method;\n}\n\n/**\n * Creates a new image that is a clone of this one.\n * @param {function(Error, Jimp)} cb (optional) A callback for when complete\n * @returns the new image\n */\njimpEvMethod(\"clone\", \"clone\", function (cb) {\n const clone = new Jimp(this);\n if (isNodePattern(cb)) {\n cb.call(clone, null, clone);\n }\n return clone;\n});\n\n/**\n * Simplify jimpEvMethod call for the common `change` evName.\n * @param {string} methodName name of the method\n * @param {function} method to watch changes for\n */\nexport function jimpEvChange(methodName, method) {\n jimpEvMethod(methodName, \"change\", method);\n}\n\n/**\n * Sets the type of the image (RGB or RGBA) when saving as PNG format (default is RGBA)\n * @param b A Boolean, true to use RGBA or false to use RGB\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange(\"background\", function (hex, cb) {\n if (typeof hex !== \"number\") {\n return throwError.call(this, \"hex must be a hexadecimal rgba value\", cb);\n }\n this._background = hex;\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n});\n\n/**\n * Scans through a region of the bitmap, calling a function for each pixel.\n * @param {number} x the x coordinate to begin the scan at\n * @param {number} y the y coordinate to begin the scan at\n * @param w the width of the scan region\n * @param h the height of the scan region\n * @param f a function to call on even pixel; the (x, y) position of the pixel\n * and the index of the pixel in the bitmap buffer are passed to the function\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\njimpEvChange(\"scan\", function (x, y, w, h, f, cb) {\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n if (typeof f !== \"function\") {\n return throwError.call(this, \"f must be a function\", cb);\n }\n const result = scan(this, x, y, w, h, f);\n if (isNodePattern(cb)) {\n cb.call(this, null, result);\n }\n return result;\n});\nif (process.env.ENVIRONMENT === \"BROWSER\") {\n // For use in a web browser or web worker\n /* global self */\n let gl;\n if (typeof window !== \"undefined\" && typeof window === \"object\") {\n gl = window;\n }\n if (typeof self !== \"undefined\" && typeof self === \"object\") {\n gl = self;\n }\n gl.Jimp = Jimp;\n gl.Buffer = Buffer;\n}\nexport { addType } from \"./utils/mime\";\nexport default Jimp;\n//# sourceMappingURL=index.js.map","import { isNodePattern, throwError } from \"@jimp/utils\";\nimport * as constants from \"../constants\";\nimport * as compositeModes from \"./composite-modes\";\n\n/**\n * Composites a source image over to this image respecting alpha channels\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {object} options determine what mode to use\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default function composite(src, x, y) {\n let options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n let cb = arguments.length > 4 ? arguments[4] : undefined;\n if (typeof options === \"function\") {\n cb = options;\n options = {};\n }\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n let {\n mode,\n opacitySource,\n opacityDest\n } = options;\n if (!mode) {\n mode = constants.BLEND_SOURCE_OVER;\n }\n if (typeof opacitySource !== \"number\" || opacitySource < 0 || opacitySource > 1) {\n opacitySource = 1.0;\n }\n if (typeof opacityDest !== \"number\" || opacityDest < 0 || opacityDest > 1) {\n opacityDest = 1.0;\n }\n\n // eslint-disable-next-line import/namespace\n const blendmode = compositeModes[mode];\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n const baseImage = this;\n if (opacityDest !== 1.0) {\n baseImage.opacity(opacityDest);\n }\n src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) {\n const dstIdx = baseImage.getPixelIndex(x + sx, y + sy, constants.EDGE_CROP);\n if (dstIdx === -1) {\n // Skip target pixels outside of dst\n return;\n }\n const blended = blendmode({\n r: this.bitmap.data[idx + 0] / 255,\n g: this.bitmap.data[idx + 1] / 255,\n b: this.bitmap.data[idx + 2] / 255,\n a: this.bitmap.data[idx + 3] / 255\n }, {\n r: baseImage.bitmap.data[dstIdx + 0] / 255,\n g: baseImage.bitmap.data[dstIdx + 1] / 255,\n b: baseImage.bitmap.data[dstIdx + 2] / 255,\n a: baseImage.bitmap.data[dstIdx + 3] / 255\n }, opacitySource);\n baseImage.bitmap.data[dstIdx + 0] = this.constructor.limit255(blended.r * 255);\n baseImage.bitmap.data[dstIdx + 1] = this.constructor.limit255(blended.g * 255);\n baseImage.bitmap.data[dstIdx + 2] = this.constructor.limit255(blended.b * 255);\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(blended.a * 255);\n });\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n}\n//# sourceMappingURL=index.js.map","import JPEG from \"jpeg-js\";\nimport { throwError, isNodePattern } from \"@jimp/utils\";\nconst MIME_TYPE = \"image/jpeg\";\nexport default (() => ({\n mime: {\n [MIME_TYPE]: [\"jpeg\", \"jpg\", \"jpe\"]\n },\n constants: {\n MIME_JPEG: MIME_TYPE\n },\n decoders: {\n [MIME_TYPE]: JPEG.decode\n },\n encoders: {\n [MIME_TYPE]: image => JPEG.encode(image.bitmap, image._quality).data\n },\n class: {\n // The quality to be used when saving JPEG images\n _quality: 100,\n /**\n * Sets the quality of the image when saving as JPEG format (default is 100)\n * @param {number} n The quality to use 0-100\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n quality(n, cb) {\n if (typeof n !== \"number\") {\n return throwError.call(this, \"n must be a number\", cb);\n }\n if (n < 0 || n > 100) {\n return throwError.call(this, \"n must be a number 0 - 100\", cb);\n }\n this._quality = Math.round(n);\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n }\n }\n}));\n//# sourceMappingURL=index.js.map","import { PNG } from \"pngjs\";\nimport { throwError, isNodePattern } from \"@jimp/utils\";\nconst MIME_TYPE = \"image/png\";\n\n// PNG filter types\nconst PNG_FILTER_AUTO = -1;\nconst PNG_FILTER_NONE = 0;\nconst PNG_FILTER_SUB = 1;\nconst PNG_FILTER_UP = 2;\nconst PNG_FILTER_AVERAGE = 3;\nconst PNG_FILTER_PATH = 4;\nexport default (() => ({\n mime: {\n [MIME_TYPE]: [\"png\"]\n },\n constants: {\n MIME_PNG: MIME_TYPE,\n PNG_FILTER_AUTO,\n PNG_FILTER_NONE,\n PNG_FILTER_SUB,\n PNG_FILTER_UP,\n PNG_FILTER_AVERAGE,\n PNG_FILTER_PATH\n },\n hasAlpha: {\n [MIME_TYPE]: true\n },\n decoders: {\n [MIME_TYPE]: PNG.sync.read\n },\n encoders: {\n [MIME_TYPE](data) {\n const png = new PNG({\n width: data.bitmap.width,\n height: data.bitmap.height\n });\n png.data = data.bitmap.data;\n return PNG.sync.write(png, {\n deflateLevel: data._deflateLevel,\n deflateStrategy: data._deflateStrategy,\n filterType: data._filterType,\n colorType: typeof data._colorType === \"number\" ? data._colorType : data._rgba ? 6 : 2,\n inputHasAlpha: data._rgba\n });\n }\n },\n class: {\n _deflateLevel: 9,\n _deflateStrategy: 3,\n _filterType: PNG_FILTER_AUTO,\n _colorType: null,\n /**\n * Sets the deflate level used when saving as PNG format (default is 9)\n * @param {number} l Deflate level to use 0-9. 0 is no compression. 9 (default) is maximum compression.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateLevel(l, cb) {\n if (typeof l !== \"number\") {\n return throwError.call(this, \"l must be a number\", cb);\n }\n if (l < 0 || l > 9) {\n return throwError.call(this, \"l must be a number 0 - 9\", cb);\n }\n this._deflateLevel = Math.round(l);\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n },\n /**\n * Sets the deflate strategy used when saving as PNG format (default is 3)\n * @param {number} s Deflate strategy to use 0-3.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n deflateStrategy(s, cb) {\n if (typeof s !== \"number\") {\n return throwError.call(this, \"s must be a number\", cb);\n }\n if (s < 0 || s > 3) {\n return throwError.call(this, \"s must be a number 0 - 3\", cb);\n }\n this._deflateStrategy = Math.round(s);\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n },\n /**\n * Sets the filter type used when saving as PNG format (default is automatic filters)\n * @param {number} f The quality to use -1-4.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n filterType(f, cb) {\n if (typeof f !== \"number\") {\n return throwError.call(this, \"n must be a number\", cb);\n }\n if (f < -1 || f > 4) {\n return throwError.call(this, \"n must be -1 (auto) or a number 0 - 4\", cb);\n }\n this._filterType = Math.round(f);\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n },\n /**\n * Sets the color type used when saving as PNG format\n * @param {number} s color type to use 0, 2, 4, 6.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n colorType(s, cb) {\n if (typeof s !== \"number\") {\n return throwError.call(this, \"s must be a number\", cb);\n }\n if (s !== 0 && s !== 2 && s !== 4 && s !== 6) {\n return throwError.call(this, \"s must be a number 0, 2, 4, 6.\", cb);\n }\n this._colorType = Math.round(s);\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n }\n }\n}));\n//# sourceMappingURL=index.js.map","import BMP from \"bmp-js\";\nimport { scan } from \"@jimp/utils\";\nconst MIME_TYPE = \"image/bmp\";\nconst MIME_TYPE_SECOND = \"image/x-ms-bmp\";\nfunction toAGBR(image) {\n return scan(image, 0, 0, image.bitmap.width, image.bitmap.height, function (x, y, index) {\n const red = this.bitmap.data[index + 0];\n const green = this.bitmap.data[index + 1];\n const blue = this.bitmap.data[index + 2];\n const alpha = this.bitmap.data[index + 3];\n this.bitmap.data[index + 0] = alpha;\n this.bitmap.data[index + 1] = blue;\n this.bitmap.data[index + 2] = green;\n this.bitmap.data[index + 3] = red;\n }).bitmap;\n}\nfunction fromAGBR(bitmap) {\n return scan({\n bitmap\n }, 0, 0, bitmap.width, bitmap.height, function (x, y, index) {\n const alpha = this.bitmap.data[index + 0];\n const blue = this.bitmap.data[index + 1];\n const green = this.bitmap.data[index + 2];\n const red = this.bitmap.data[index + 3];\n this.bitmap.data[index + 0] = red;\n this.bitmap.data[index + 1] = green;\n this.bitmap.data[index + 2] = blue;\n this.bitmap.data[index + 3] = bitmap.is_with_alpha ? alpha : 0xff;\n }).bitmap;\n}\nconst decode = data => fromAGBR(BMP.decode(data));\nconst encode = image => BMP.encode(toAGBR(image)).data;\nexport default (() => ({\n mime: {\n [MIME_TYPE]: [\"bmp\"]\n },\n constants: {\n MIME_BMP: MIME_TYPE,\n MIME_X_MS_BMP: MIME_TYPE_SECOND\n },\n decoders: {\n [MIME_TYPE]: decode,\n [MIME_TYPE_SECOND]: decode\n },\n encoders: {\n [MIME_TYPE]: encode,\n [MIME_TYPE_SECOND]: encode\n }\n}));\n//# sourceMappingURL=index.js.map","import utif from \"utif2\";\nconst MIME_TYPE = \"image/tiff\";\nexport default (() => ({\n mime: {\n [MIME_TYPE]: [\"tiff\", \"tif\"]\n },\n constants: {\n MIME_TIFF: MIME_TYPE\n },\n decoders: {\n [MIME_TYPE]: data => {\n const ifds = utif.decode(data);\n const page = ifds[0];\n ifds.forEach(ifd => {\n utif.decodeImage(data, ifd);\n });\n const rgba = utif.toRGBA8(page);\n return {\n data: Buffer.from(rgba),\n width: page.t256[0],\n height: page.t257[0]\n };\n }\n },\n encoders: {\n [MIME_TYPE]: image => {\n const tiff = utif.encodeImage(image.bitmap.data, image.bitmap.width, image.bitmap.height);\n return Buffer.from(tiff);\n }\n }\n}));\n//# sourceMappingURL=index.js.map","import GIF from \"omggif\";\nimport { GifUtil, GifFrame, BitmapImage, GifCodec } from \"gifwrap\";\nconst MIME_TYPE = \"image/gif\";\nexport default (() => ({\n mime: {\n [MIME_TYPE]: [\"gif\"]\n },\n constants: {\n MIME_GIF: MIME_TYPE\n },\n decoders: {\n [MIME_TYPE]: data => {\n const gifObj = new GIF.GifReader(data);\n const gifData = Buffer.alloc(gifObj.width * gifObj.height * 4);\n gifObj.decodeAndBlitFrameRGBA(0, gifData);\n return {\n data: gifData,\n width: gifObj.width,\n height: gifObj.height\n };\n }\n },\n encoders: {\n [MIME_TYPE]: data => {\n const bitmap = new BitmapImage(data.bitmap);\n GifUtil.quantizeDekker(bitmap, 256);\n const newFrame = new GifFrame(bitmap);\n const gifCodec = new GifCodec();\n return gifCodec.encodeGif([newFrame], {}).then(newGif => {\n return newGif.buffer;\n });\n }\n }\n}));\n//# sourceMappingURL=index.js.map","export const mulTable = [1, 57, 41, 21, 203, 34, 97, 73, 227, 91, 149, 62, 105, 45, 39, 137, 241, 107, 3, 173, 39, 71, 65, 238, 219, 101, 187, 87, 81, 151, 141, 133, 249, 117, 221, 209, 197, 187, 177, 169, 5, 153, 73, 139, 133, 127, 243, 233, 223, 107, 103, 99, 191, 23, 177, 171, 165, 159, 77, 149, 9, 139, 135, 131, 253, 245, 119, 231, 224, 109, 211, 103, 25, 195, 189, 23, 45, 175, 171, 83, 81, 79, 155, 151, 147, 9, 141, 137, 67, 131, 129, 251, 123, 30, 235, 115, 113, 221, 217, 53, 13, 51, 50, 49, 193, 189, 185, 91, 179, 175, 43, 169, 83, 163, 5, 79, 155, 19, 75, 147, 145, 143, 35, 69, 17, 67, 33, 65, 255, 251, 247, 243, 239, 59, 29, 229, 113, 111, 219, 27, 213, 105, 207, 51, 201, 199, 49, 193, 191, 47, 93, 183, 181, 179, 11, 87, 43, 85, 167, 165, 163, 161, 159, 157, 155, 77, 19, 75, 37, 73, 145, 143, 141, 35, 138, 137, 135, 67, 33, 131, 129, 255, 63, 250, 247, 61, 121, 239, 237, 117, 29, 229, 227, 225, 111, 55, 109, 216, 213, 211, 209, 207, 205, 203, 201, 199, 197, 195, 193, 48, 190, 47, 93, 185, 183, 181, 179, 178, 176, 175, 173, 171, 85, 21, 167, 165, 41, 163, 161, 5, 79, 157, 78, 154, 153, 19, 75, 149, 74, 147, 73, 144, 143, 71, 141, 140, 139, 137, 17, 135, 134, 133, 66, 131, 65, 129, 1];\nexport const shgTable = [0, 9, 10, 10, 14, 12, 14, 14, 16, 15, 16, 15, 16, 15, 15, 17, 18, 17, 12, 18, 16, 17, 17, 19, 19, 18, 19, 18, 18, 19, 19, 19, 20, 19, 20, 20, 20, 20, 20, 20, 15, 20, 19, 20, 20, 20, 21, 21, 21, 20, 20, 20, 21, 18, 21, 21, 21, 21, 20, 21, 17, 21, 21, 21, 22, 22, 21, 22, 22, 21, 22, 21, 19, 22, 22, 19, 20, 22, 22, 21, 21, 21, 22, 22, 22, 18, 22, 22, 21, 22, 22, 23, 22, 20, 23, 22, 22, 23, 23, 21, 19, 21, 21, 21, 23, 23, 23, 22, 23, 23, 21, 23, 22, 23, 18, 22, 23, 20, 22, 23, 23, 23, 21, 22, 20, 22, 21, 22, 24, 24, 24, 24, 24, 22, 21, 24, 23, 23, 24, 21, 24, 23, 24, 22, 24, 24, 22, 24, 24, 22, 23, 24, 24, 24, 20, 23, 22, 23, 24, 24, 24, 24, 24, 24, 24, 23, 21, 23, 22, 23, 24, 24, 24, 22, 24, 24, 24, 23, 22, 24, 24, 25, 23, 25, 25, 23, 24, 25, 25, 24, 22, 25, 25, 25, 24, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 23, 25, 23, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 22, 25, 25, 23, 25, 25, 20, 24, 25, 24, 25, 25, 22, 24, 25, 24, 25, 24, 25, 25, 24, 25, 25, 25, 25, 22, 25, 25, 25, 24, 25, 24, 25, 18];\n//# sourceMappingURL=blur-tables.js.map","import tinyColor from \"tinycolor2\";\nimport { throwError, isNodePattern } from \"@jimp/utils\";\nfunction applyKernel(im, kernel, x, y) {\n const value = [0, 0, 0];\n const size = (kernel.length - 1) / 2;\n for (let kx = 0; kx < kernel.length; kx += 1) {\n for (let ky = 0; ky < kernel[kx].length; ky += 1) {\n const idx = im.getPixelIndex(x + kx - size, y + ky - size);\n value[0] += im.bitmap.data[idx] * kernel[kx][ky];\n value[1] += im.bitmap.data[idx + 1] * kernel[kx][ky];\n value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky];\n }\n }\n return value;\n}\nconst isDef = v => typeof v !== \"undefined\" && v !== null;\nfunction greyscale(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {\n const grey = parseInt(0.2126 * this.bitmap.data[idx] + 0.7152 * this.bitmap.data[idx + 1] + 0.0722 * this.bitmap.data[idx + 2], 10);\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n });\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n}\nfunction mix(clr, clr2) {\n let p = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50;\n return {\n r: (clr2.r - clr.r) * (p / 100) + clr.r,\n g: (clr2.g - clr.g) * (p / 100) + clr.g,\n b: (clr2.b - clr.b) * (p / 100) + clr.b\n };\n}\nfunction colorFn(actions, cb) {\n if (!actions || !Array.isArray(actions)) {\n return throwError.call(this, \"actions must be an array\", cb);\n }\n actions = actions.map(action => {\n if (action.apply === \"xor\" || action.apply === \"mix\") {\n action.params[0] = tinyColor(action.params[0]).toRgb();\n }\n return action;\n });\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n let clr = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2]\n };\n const colorModifier = (i, amount) => this.constructor.limit255(clr[i] + amount);\n actions.forEach(action => {\n if (action.apply === \"mix\") {\n clr = mix(clr, action.params[0], action.params[1]);\n } else if (action.apply === \"tint\") {\n clr = mix(clr, {\n r: 255,\n g: 255,\n b: 255\n }, action.params[0]);\n } else if (action.apply === \"shade\") {\n clr = mix(clr, {\n r: 0,\n g: 0,\n b: 0\n }, action.params[0]);\n } else if (action.apply === \"xor\") {\n clr = {\n r: clr.r ^ action.params[0].r,\n g: clr.g ^ action.params[0].g,\n b: clr.b ^ action.params[0].b\n };\n } else if (action.apply === \"red\") {\n clr.r = colorModifier(\"r\", action.params[0]);\n } else if (action.apply === \"green\") {\n clr.g = colorModifier(\"g\", action.params[0]);\n } else if (action.apply === \"blue\") {\n clr.b = colorModifier(\"b\", action.params[0]);\n } else {\n if (action.apply === \"hue\") {\n action.apply = \"spin\";\n }\n clr = tinyColor(clr);\n if (!clr[action.apply]) {\n return throwError.call(this, \"action \" + action.apply + \" not supported\", cb);\n }\n clr = clr[action.apply](...action.params).toRgb();\n }\n });\n this.bitmap.data[idx] = clr.r;\n this.bitmap.data[idx + 1] = clr.g;\n this.bitmap.data[idx + 2] = clr.b;\n });\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n}\nexport const ColorActionName = Object.freeze({\n LIGHTEN: \"lighten\",\n BRIGHTEN: \"brighten\",\n DARKEN: \"darken\",\n DESATURATE: \"desaturate\",\n SATURATE: \"saturate\",\n GREYSCALE: \"greyscale\",\n SPIN: \"spin\",\n HUE: \"hue\",\n MIX: \"mix\",\n TINT: \"tint\",\n SHADE: \"shade\",\n XOR: \"xor\",\n RED: \"red\",\n GREEN: \"green\",\n BLUE: \"blue\"\n});\nexport default (() => ({\n /**\n * Adjusts the brightness of the image\n * @param {number} val the amount to adjust the brightness, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n brightness(val, cb) {\n if (typeof val !== \"number\") {\n return throwError.call(this, \"val must be numbers\", cb);\n }\n if (val < -1 || val > +1) {\n return throwError.call(this, \"val must be a number between -1 and +1\", cb);\n }\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {\n if (val < 0.0) {\n this.bitmap.data[idx] *= 1 + val;\n this.bitmap.data[idx + 1] *= 1 + val;\n this.bitmap.data[idx + 2] *= 1 + val;\n } else {\n this.bitmap.data[idx] += (255 - this.bitmap.data[idx]) * val;\n this.bitmap.data[idx + 1] += (255 - this.bitmap.data[idx + 1]) * val;\n this.bitmap.data[idx + 2] += (255 - this.bitmap.data[idx + 2]) * val;\n }\n });\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n },\n /**\n * Adjusts the contrast of the image\n * @param {number} val the amount to adjust the contrast, a number between -1 and +1\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n contrast(val, cb) {\n if (typeof val !== \"number\") {\n return throwError.call(this, \"val must be numbers\", cb);\n }\n if (val < -1 || val > +1) {\n return throwError.call(this, \"val must be a number between -1 and +1\", cb);\n }\n const factor = (val + 1) / (1 - val);\n function adjust(value) {\n value = Math.floor(factor * (value - 127) + 127);\n return value < 0 ? 0 : value > 255 ? 255 : value;\n }\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {\n this.bitmap.data[idx] = adjust(this.bitmap.data[idx]);\n this.bitmap.data[idx + 1] = adjust(this.bitmap.data[idx + 1]);\n this.bitmap.data[idx + 2] = adjust(this.bitmap.data[idx + 2]);\n });\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n },\n /**\n * Apply a posterize effect\n * @param {number} n the amount to adjust the contrast, minimum threshold is two\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n posterize(n, cb) {\n if (typeof n !== \"number\") {\n return throwError.call(this, \"n must be numbers\", cb);\n }\n if (n < 2) {\n n = 2;\n } // minimum of 2 levels\n\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {\n this.bitmap.data[idx] = Math.floor(this.bitmap.data[idx] / 255 * (n - 1)) / (n - 1) * 255;\n this.bitmap.data[idx + 1] = Math.floor(this.bitmap.data[idx + 1] / 255 * (n - 1)) / (n - 1) * 255;\n this.bitmap.data[idx + 2] = Math.floor(this.bitmap.data[idx + 2] / 255 * (n - 1)) / (n - 1) * 255;\n });\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n },\n /**\n * Removes colour from the image using ITU Rec 709 luminance values\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n greyscale,\n // Alias of greyscale for our American friends\n grayscale: greyscale,\n /**\n * Multiplies the opacity of each pixel by a factor between 0 and 1\n * @param {number} f A number, the factor by which to multiply the opacity of each pixel\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opacity(f, cb) {\n if (typeof f !== \"number\") return throwError.call(this, \"f must be a number\", cb);\n if (f < 0 || f > 1) return throwError.call(this, \"f must be a number from 0 to 1\", cb);\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {\n const v = this.bitmap.data[idx + 3] * f;\n this.bitmap.data[idx + 3] = v;\n });\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n },\n /**\n * Applies a sepia tone to the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n sepia(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {\n let red = this.bitmap.data[idx];\n let green = this.bitmap.data[idx + 1];\n let blue = this.bitmap.data[idx + 2];\n red = red * 0.393 + green * 0.769 + blue * 0.189;\n green = red * 0.349 + green * 0.686 + blue * 0.168;\n blue = red * 0.272 + green * 0.534 + blue * 0.131;\n this.bitmap.data[idx] = red < 255 ? red : 255;\n this.bitmap.data[idx + 1] = green < 255 ? green : 255;\n this.bitmap.data[idx + 2] = blue < 255 ? blue : 255;\n });\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n },\n /**\n * Fades each pixel by a factor between 0 and 1\n * @param {number} f A number from 0 to 1. 0 will haven no effect. 1 will turn the image completely transparent.\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n fade(f, cb) {\n if (typeof f !== \"number\") {\n return throwError.call(this, \"f must be a number\", cb);\n }\n if (f < 0 || f > 1) {\n return throwError.call(this, \"f must be a number from 0 to 1\", cb);\n }\n\n // this method is an alternative to opacity (which may be deprecated)\n this.opacity(1 - f);\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n },\n /**\n * Adds each element of the image to its local neighbors, weighted by the kernel\n * @param {array} kernel a matrix to weight the neighbors sum\n * @param {number} edgeHandling (optional) define how to sum pixels from outside the border\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n convolution(kernel, edgeHandling, cb) {\n if (typeof edgeHandling === \"function\" && typeof cb === \"undefined\") {\n cb = edgeHandling;\n edgeHandling = null;\n }\n if (!edgeHandling) {\n edgeHandling = this.constructor.EDGE_EXTEND;\n }\n const newData = Buffer.from(this.bitmap.data);\n const kRows = kernel.length;\n const kCols = kernel[0].length;\n const rowEnd = Math.floor(kRows / 2);\n const colEnd = Math.floor(kCols / 2);\n const rowIni = -rowEnd;\n const colIni = -colEnd;\n let weight;\n let rSum;\n let gSum;\n let bSum;\n let ri;\n let gi;\n let bi;\n let xi;\n let yi;\n let idxi;\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {\n bSum = 0;\n gSum = 0;\n rSum = 0;\n for (let row = rowIni; row <= rowEnd; row++) {\n for (let col = colIni; col <= colEnd; col++) {\n xi = x + col;\n yi = y + row;\n weight = kernel[row + rowEnd][col + colEnd];\n idxi = this.getPixelIndex(xi, yi, edgeHandling);\n if (idxi === -1) {\n bi = 0;\n gi = 0;\n ri = 0;\n } else {\n ri = this.bitmap.data[idxi + 0];\n gi = this.bitmap.data[idxi + 1];\n bi = this.bitmap.data[idxi + 2];\n }\n rSum += weight * ri;\n gSum += weight * gi;\n bSum += weight * bi;\n }\n }\n if (rSum < 0) {\n rSum = 0;\n }\n if (gSum < 0) {\n gSum = 0;\n }\n if (bSum < 0) {\n bSum = 0;\n }\n if (rSum > 255) {\n rSum = 255;\n }\n if (gSum > 255) {\n gSum = 255;\n }\n if (bSum > 255) {\n bSum = 255;\n }\n newData[idx + 0] = rSum;\n newData[idx + 1] = gSum;\n newData[idx + 2] = bSum;\n });\n this.bitmap.data = newData;\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n },\n /**\n * Set the alpha channel on every pixel to fully opaque\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n opaque(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {\n this.bitmap.data[idx + 3] = 255;\n });\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n },\n /**\n * Pixelates the image or a region\n * @param {number} size the size of the pixels\n * @param {number} x (optional) the x position of the region to pixelate\n * @param {number} y (optional) the y position of the region to pixelate\n * @param {number} w (optional) the width of the region to pixelate\n * @param {number} h (optional) the height of the region to pixelate\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n pixelate(size, x, y, w, h, cb) {\n if (typeof x === \"function\") {\n cb = x;\n h = null;\n w = null;\n y = null;\n x = null;\n } else {\n if (typeof size !== \"number\") {\n return throwError.call(this, \"size must be a number\", cb);\n }\n if (isDef(x) && typeof x !== \"number\") {\n return throwError.call(this, \"x must be a number\", cb);\n }\n if (isDef(y) && typeof y !== \"number\") {\n return throwError.call(this, \"y must be a number\", cb);\n }\n if (isDef(w) && typeof w !== \"number\") {\n return throwError.call(this, \"w must be a number\", cb);\n }\n if (isDef(h) && typeof h !== \"number\") {\n return throwError.call(this, \"h must be a number\", cb);\n }\n }\n const kernel = [[1 / 16, 2 / 16, 1 / 16], [2 / 16, 4 / 16, 2 / 16], [1 / 16, 2 / 16, 1 / 16]];\n x = x || 0;\n y = y || 0;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n const source = this.cloneQuiet();\n this.scanQuiet(x, y, w, h, function (xx, yx, idx) {\n xx = size * Math.floor(xx / size);\n yx = size * Math.floor(yx / size);\n const value = applyKernel(source, kernel, xx, yx);\n this.bitmap.data[idx] = value[0];\n this.bitmap.data[idx + 1] = value[1];\n this.bitmap.data[idx + 2] = value[2];\n });\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n },\n /**\n * Applies a convolution kernel to the image or a region\n * @param {array} kernel the convolution kernel\n * @param {number} x (optional) the x position of the region to apply convolution to\n * @param {number} y (optional) the y position of the region to apply convolution to\n * @param {number} w (optional) the width of the region to apply convolution to\n * @param {number} h (optional) the height of the region to apply convolution to\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n convolute(kernel, x, y, w, h, cb) {\n if (!Array.isArray(kernel)) return throwError.call(this, \"the kernel must be an array\", cb);\n if (typeof x === \"function\") {\n cb = x;\n x = null;\n y = null;\n w = null;\n h = null;\n } else {\n if (isDef(x) && typeof x !== \"number\") {\n return throwError.call(this, \"x must be a number\", cb);\n }\n if (isDef(y) && typeof y !== \"number\") {\n return throwError.call(this, \"y must be a number\", cb);\n }\n if (isDef(w) && typeof w !== \"number\") {\n return throwError.call(this, \"w must be a number\", cb);\n }\n if (isDef(h) && typeof h !== \"number\") {\n return throwError.call(this, \"h must be a number\", cb);\n }\n }\n x = isDef(x) ? x : 0;\n y = isDef(y) ? y : 0;\n w = isDef(w) ? w : this.bitmap.width - x;\n h = isDef(h) ? h : this.bitmap.height - y;\n const source = this.cloneQuiet();\n this.scanQuiet(x, y, w, h, function (xx, yx, idx) {\n const value = applyKernel(source, kernel, xx, yx);\n this.bitmap.data[idx] = this.constructor.limit255(value[0]);\n this.bitmap.data[idx + 1] = this.constructor.limit255(value[1]);\n this.bitmap.data[idx + 2] = this.constructor.limit255(value[2]);\n });\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n },\n /**\n * Apply multiple color modification rules\n * @param {array} actions list of color modification rules, in following format: { apply: '', params: [ ] }\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp }this for chaining of methods\n */\n color: colorFn,\n colour: colorFn\n}));\n//# sourceMappingURL=index.js.map","import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Apply a ordered dithering effect\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction dither(cb) {\n const rgb565Matrix = [1, 9, 3, 11, 13, 5, 15, 7, 4, 12, 2, 10, 16, 8, 14, 6];\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {\n const thresholdId = ((y & 3) << 2) + x % 4;\n const dither = rgb565Matrix[thresholdId];\n this.bitmap.data[idx] = Math.min(this.bitmap.data[idx] + dither, 0xff);\n this.bitmap.data[idx + 1] = Math.min(this.bitmap.data[idx + 1] + dither, 0xff);\n this.bitmap.data[idx + 2] = Math.min(this.bitmap.data[idx + 2] + dither, 0xff);\n });\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n}\nexport default (() => ({\n dither565: dither,\n dither16: dither\n}));\n//# sourceMappingURL=index.js.map","import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Flip the image horizontally\n * @param {boolean} horizontal a Boolean, if true the image will be flipped horizontally\n * @param {boolean} vertical a Boolean, if true the image will be flipped vertically\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nfunction flipFn(horizontal, vertical, cb) {\n if (typeof horizontal !== \"boolean\" || typeof vertical !== \"boolean\") return throwError.call(this, \"horizontal and vertical must be Booleans\", cb);\n const bitmap = Buffer.alloc(this.bitmap.data.length);\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {\n const _x = horizontal ? this.bitmap.width - 1 - x : x;\n const _y = vertical ? this.bitmap.height - 1 - y : y;\n const _idx = this.bitmap.width * _y + _x << 2;\n const data = this.bitmap.data.readUInt32BE(idx);\n bitmap.writeUInt32BE(data, _idx);\n });\n this.bitmap.data = Buffer.from(bitmap);\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n}\nexport default (() => ({\n flip: flipFn,\n mirror: flipFn\n}));\n//# sourceMappingURL=index.js.map","import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Get an image's histogram\n * @return {object} An object with an array of color occurrence counts for each channel (r,g,b)\n */\nfunction histogram() {\n const histogram = {\n r: new Array(256).fill(0),\n g: new Array(256).fill(0),\n b: new Array(256).fill(0)\n };\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, index) {\n histogram.r[this.bitmap.data[index + 0]]++;\n histogram.g[this.bitmap.data[index + 1]]++;\n histogram.b[this.bitmap.data[index + 2]]++;\n });\n return histogram;\n}\n\n/**\n * Normalize values\n * @param {integer} value Pixel channel value.\n * @param {integer} min Minimum value for channel\n * @param {integer} max Maximum value for channel\n * @return {integer} normalized values\n */\nconst normalize = function (value, min, max) {\n return (value - min) * 255 / (max - min);\n};\nconst getBounds = function (histogramChannel) {\n return [histogramChannel.findIndex(value => value > 0), 255 - histogramChannel.slice().reverse().findIndex(value => value > 0)];\n};\n\n/**\n * Normalizes the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default (() => ({\n normalize(cb) {\n const h = histogram.call(this);\n\n // store bounds (minimum and maximum values)\n const bounds = {\n r: getBounds(h.r),\n g: getBounds(h.g),\n b: getBounds(h.b)\n };\n\n // apply value transformations\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {\n const r = this.bitmap.data[idx + 0];\n const g = this.bitmap.data[idx + 1];\n const b = this.bitmap.data[idx + 2];\n this.bitmap.data[idx + 0] = normalize(r, bounds.r[0], bounds.r[1]);\n this.bitmap.data[idx + 1] = normalize(g, bounds.g[0], bounds.g[1]);\n this.bitmap.data[idx + 2] = normalize(b, bounds.b[0], bounds.b[1]);\n });\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n }\n}));\n//# sourceMappingURL=index.js.map","export function measureText(font, text) {\n let x = 0;\n for (let i = 0; i < text.length; i++) {\n if (font.chars[text[i]]) {\n const kerning = font.kernings[text[i]] && font.kernings[text[i]][text[i + 1]] ? font.kernings[text[i]][text[i + 1]] : 0;\n x += (font.chars[text[i]].xadvance || 0) + kerning;\n }\n }\n return x;\n}\nexport function splitLines(font, text, maxWidth) {\n const words = text.replace(/[\\r\\n]+/g, \" \\n\").split(\" \");\n const lines = [];\n let currentLine = [];\n let longestLine = 0;\n words.forEach(word => {\n const line = [...currentLine, word].join(\" \");\n const length = measureText(font, line);\n if (length <= maxWidth && !word.includes(\"\\n\")) {\n if (length > longestLine) {\n longestLine = length;\n }\n currentLine.push(word);\n } else {\n lines.push(currentLine);\n currentLine = [word.replace(\"\\n\", \"\")];\n }\n });\n lines.push(currentLine);\n return {\n lines,\n longestLine\n };\n}\nexport function measureTextHeight(font, text, maxWidth) {\n const {\n lines\n } = splitLines(font, text, maxWidth);\n return lines.length * font.common.lineHeight;\n}\n//# sourceMappingURL=measure-text.js.map","import Path from \"path\";\nimport bMFont from \"load-bmfont\";\nimport { isNodePattern, throwError } from \"@jimp/utils\";\nimport { measureText, measureTextHeight, splitLines } from \"./measure-text\";\nfunction xOffsetBasedOnAlignment(constants, font, line, maxWidth, alignment) {\n if (alignment === constants.HORIZONTAL_ALIGN_LEFT) {\n return 0;\n }\n if (alignment === constants.HORIZONTAL_ALIGN_CENTER) {\n return (maxWidth - measureText(font, line)) / 2;\n }\n return maxWidth - measureText(font, line);\n}\nfunction drawCharacter(image, font, x, y, char) {\n if (char.width > 0 && char.height > 0) {\n const characterPage = font.pages[char.page];\n image.blit(characterPage, x + char.xoffset, y + char.yoffset, char.x, char.y, char.width, char.height);\n }\n return image;\n}\nfunction printText(font, x, y, text, defaultCharWidth) {\n for (let i = 0; i < text.length; i++) {\n let char;\n if (font.chars[text[i]]) {\n char = text[i];\n } else if (/\\s/.test(text[i])) {\n char = \"\";\n } else {\n char = \"?\";\n }\n const fontChar = font.chars[char] || {};\n const fontKerning = font.kernings[char];\n drawCharacter(this, font, x, y, fontChar || {});\n const kerning = fontKerning && fontKerning[text[i + 1]] ? fontKerning[text[i + 1]] : 0;\n x += kerning + (fontChar.xadvance || defaultCharWidth);\n }\n}\nfunction loadPages(Jimp, dir, pages) {\n const newPages = pages.map(page => {\n return Jimp.read(dir + \"/\" + page);\n });\n return Promise.all(newPages);\n}\nconst dir = process.env.DIRNAME || `${__dirname}/../`;\nexport default (() => ({\n constants: {\n measureText,\n measureTextHeight,\n FONT_SANS_8_BLACK: Path.join(dir, \"fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt\"),\n FONT_SANS_10_BLACK: Path.join(dir, \"fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt\"),\n FONT_SANS_12_BLACK: Path.join(dir, \"fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt\"),\n FONT_SANS_14_BLACK: Path.join(dir, \"fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt\"),\n FONT_SANS_16_BLACK: Path.join(dir, \"fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt\"),\n FONT_SANS_32_BLACK: Path.join(dir, \"fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt\"),\n FONT_SANS_64_BLACK: Path.join(dir, \"fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt\"),\n FONT_SANS_128_BLACK: Path.join(dir, \"fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt\"),\n FONT_SANS_8_WHITE: Path.join(dir, \"fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt\"),\n FONT_SANS_16_WHITE: Path.join(dir, \"fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt\"),\n FONT_SANS_32_WHITE: Path.join(dir, \"fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt\"),\n FONT_SANS_64_WHITE: Path.join(dir, \"fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt\"),\n FONT_SANS_128_WHITE: Path.join(dir, \"fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt\"),\n /**\n * Loads a bitmap font from a file\n * @param {string} file the file path of a .fnt file\n * @param {function(Error, Jimp)} cb (optional) a function to call when the font is loaded\n * @returns {Promise} a promise\n */\n loadFont(file, cb) {\n if (typeof file !== \"string\") return throwError.call(this, \"file must be a string\", cb);\n return new Promise((resolve, reject) => {\n cb = cb || function (err, font) {\n if (err) reject(err);else resolve(font);\n };\n bMFont(file, (err, font) => {\n const chars = {};\n const kernings = {};\n if (err) {\n return throwError.call(this, err, cb);\n }\n for (let i = 0; i < font.chars.length; i++) {\n chars[String.fromCharCode(font.chars[i].id)] = font.chars[i];\n }\n for (let i = 0; i < font.kernings.length; i++) {\n const firstString = String.fromCharCode(font.kernings[i].first);\n kernings[firstString] = kernings[firstString] || {};\n kernings[firstString][String.fromCharCode(font.kernings[i].second)] = font.kernings[i].amount;\n }\n loadPages(this, Path.dirname(file), font.pages).then(pages => {\n cb(null, {\n chars,\n kernings,\n pages,\n common: font.common,\n info: font.info\n });\n });\n });\n });\n }\n },\n class: {\n /**\n * Draws a text on a image on a given boundary\n * @param {Jimp} font a bitmap font loaded from `Jimp.loadFont` command\n * @param {number} x the x position to start drawing the text\n * @param {number} y the y position to start drawing the text\n * @param {any} text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`)\n * @param {number} maxWidth (optional) the boundary width to draw in\n * @param {number} maxHeight (optional) the boundary height to draw in\n * @param {function(Error, Jimp)} cb (optional) a function to call when the text is written\n * @returns {Jimp} this for chaining of methods\n */\n print(font, x, y, text, maxWidth, maxHeight, cb) {\n if (typeof maxWidth === \"function\" && typeof cb === \"undefined\") {\n cb = maxWidth;\n maxWidth = Infinity;\n }\n if (typeof maxWidth === \"undefined\") {\n maxWidth = Infinity;\n }\n if (typeof maxHeight === \"function\" && typeof cb === \"undefined\") {\n cb = maxHeight;\n maxHeight = Infinity;\n }\n if (typeof maxHeight === \"undefined\") {\n maxHeight = Infinity;\n }\n if (typeof font !== \"object\") {\n return throwError.call(this, \"font must be a Jimp loadFont\", cb);\n }\n if (typeof x !== \"number\" || typeof y !== \"number\" || typeof maxWidth !== \"number\") {\n return throwError.call(this, \"x, y and maxWidth must be numbers\", cb);\n }\n if (typeof maxWidth !== \"number\") {\n return throwError.call(this, \"maxWidth must be a number\", cb);\n }\n if (typeof maxHeight !== \"number\") {\n return throwError.call(this, \"maxHeight must be a number\", cb);\n }\n let alignmentX;\n let alignmentY;\n if (typeof text === \"object\" && text.text !== null && text.text !== undefined) {\n alignmentX = text.alignmentX || this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = text.alignmentY || this.constructor.VERTICAL_ALIGN_TOP;\n ({\n text\n } = text);\n } else {\n alignmentX = this.constructor.HORIZONTAL_ALIGN_LEFT;\n alignmentY = this.constructor.VERTICAL_ALIGN_TOP;\n text = text.toString();\n }\n if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_BOTTOM) {\n y += maxHeight - measureTextHeight(font, text, maxWidth);\n } else if (maxHeight !== Infinity && alignmentY === this.constructor.VERTICAL_ALIGN_MIDDLE) {\n y += maxHeight / 2 - measureTextHeight(font, text, maxWidth) / 2;\n }\n const defaultCharWidth = Object.entries(font.chars)[0][1].xadvance;\n const {\n lines,\n longestLine\n } = splitLines(font, text, maxWidth);\n lines.forEach(line => {\n const lineString = line.join(\" \");\n const alignmentWidth = xOffsetBasedOnAlignment(this.constructor, font, lineString, maxWidth, alignmentX);\n printText.call(this, font, x + alignmentWidth, y, lineString, defaultCharWidth);\n y += font.common.lineHeight;\n });\n if (isNodePattern(cb)) {\n cb.call(this, null, this, {\n x: x + longestLine,\n y\n });\n }\n return this;\n }\n }\n}));\n//# sourceMappingURL=index.js.map","// JavaScript Image Resizer (c) 2012 - Grant Galitz\n// Released to public domain 29 July 2013: https://github.com/grantgalitz/JS-Image-Resizer/issues/4\n\nfunction Resize(widthOriginal, heightOriginal, targetWidth, targetHeight, blendAlpha, interpolationPass, resizeCallback) {\n this.widthOriginal = Math.abs(Math.floor(widthOriginal) || 0);\n this.heightOriginal = Math.abs(Math.floor(heightOriginal) || 0);\n this.targetWidth = Math.abs(Math.floor(targetWidth) || 0);\n this.targetHeight = Math.abs(Math.floor(targetHeight) || 0);\n this.colorChannels = blendAlpha ? 4 : 3;\n this.interpolationPass = Boolean(interpolationPass);\n this.resizeCallback = typeof resizeCallback === \"function\" ? resizeCallback : function () {};\n this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels;\n this.originalWidthMultipliedByChannels = this.widthOriginal * this.colorChannels;\n this.originalHeightMultipliedByChannels = this.heightOriginal * this.colorChannels;\n this.widthPassResultSize = this.targetWidthMultipliedByChannels * this.heightOriginal;\n this.finalResultSize = this.targetWidthMultipliedByChannels * this.targetHeight;\n this.initialize();\n}\nResize.prototype.initialize = function () {\n // Perform some checks:\n if (this.widthOriginal > 0 && this.heightOriginal > 0 && this.targetWidth > 0 && this.targetHeight > 0) {\n this.configurePasses();\n } else {\n throw new Error(\"Invalid settings specified for the resizer.\");\n }\n};\nResize.prototype.configurePasses = function () {\n if (this.widthOriginal === this.targetWidth) {\n // Bypass the width resizer pass:\n this.resizeWidth = this.bypassResizer;\n } else {\n // Setup the width resizer pass:\n this.ratioWeightWidthPass = this.widthOriginal / this.targetWidth;\n if (this.ratioWeightWidthPass < 1 && this.interpolationPass) {\n this.initializeFirstPassBuffers(true);\n this.resizeWidth = this.colorChannels === 4 ? this.resizeWidthInterpolatedRGBA : this.resizeWidthInterpolatedRGB;\n } else {\n this.initializeFirstPassBuffers(false);\n this.resizeWidth = this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB;\n }\n }\n if (this.heightOriginal === this.targetHeight) {\n // Bypass the height resizer pass:\n this.resizeHeight = this.bypassResizer;\n } else {\n // Setup the height resizer pass:\n this.ratioWeightHeightPass = this.heightOriginal / this.targetHeight;\n if (this.ratioWeightHeightPass < 1 && this.interpolationPass) {\n this.initializeSecondPassBuffers(true);\n this.resizeHeight = this.resizeHeightInterpolated;\n } else {\n this.initializeSecondPassBuffers(false);\n this.resizeHeight = this.colorChannels === 4 ? this.resizeHeightRGBA : this.resizeHeightRGB;\n }\n }\n};\nResize.prototype._resizeWidthInterpolatedRGBChannels = function (buffer, fourthChannel) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const outputBuffer = this.widthBuffer;\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let targetPosition;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (targetPosition = 0; weight < 1 / 3; targetPosition += channelsNum, weight += ratioWeight) {\n for (finalOffset = targetPosition, pixelOffset = 0; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n let interpolationWidthSourceReadStop;\n for (interpolationWidthSourceReadStop = this.widthOriginal - 1; weight < interpolationWidthSourceReadStop; targetPosition += channelsNum, weight += ratioWeight) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n for (finalOffset = targetPosition, pixelOffset = Math.floor(weight) * channelsNum; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) {\n outputBuffer[finalOffset + 0] = buffer[pixelOffset + 0] * firstWeight + buffer[pixelOffset + channelsNum + 0] * secondWeight;\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1] * firstWeight + buffer[pixelOffset + channelsNum + 1] * secondWeight;\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2] * firstWeight + buffer[pixelOffset + channelsNum + 2] * secondWeight;\n if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3] * firstWeight + buffer[pixelOffset + channelsNum + 3] * secondWeight;\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n for (interpolationWidthSourceReadStop = this.originalWidthMultipliedByChannels - channelsNum; targetPosition < this.targetWidthMultipliedByChannels; targetPosition += channelsNum) {\n for (finalOffset = targetPosition, pixelOffset = interpolationWidthSourceReadStop; finalOffset < this.widthPassResultSize; pixelOffset += this.originalWidthMultipliedByChannels, finalOffset += this.targetWidthMultipliedByChannels) {\n outputBuffer[finalOffset] = buffer[pixelOffset];\n outputBuffer[finalOffset + 1] = buffer[pixelOffset + 1];\n outputBuffer[finalOffset + 2] = buffer[pixelOffset + 2];\n if (fourthChannel) outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];\n }\n }\n return outputBuffer;\n};\nResize.prototype._resizeWidthRGBChannels = function (buffer, fourthChannel) {\n const channelsNum = fourthChannel ? 4 : 3;\n const ratioWeight = this.ratioWeightWidthPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const nextLineOffsetOriginalWidth = this.originalWidthMultipliedByChannels - channelsNum + 1;\n const nextLineOffsetTargetWidth = this.targetWidthMultipliedByChannels - channelsNum + 1;\n const output = this.outputWidthWorkBench;\n const outputBuffer = this.widthBuffer;\n const trustworthyColorsCount = this.outputWidthWorkBenchOpaquePixelsCount;\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let line = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n do {\n for (line = 0; line < this.originalHeightMultipliedByChannels;) {\n output[line++] = 0;\n output[line++] = 0;\n output[line++] = 0;\n if (fourthChannel) {\n output[line++] = 0;\n trustworthyColorsCount[line / channelsNum - 1] = 0;\n }\n }\n weight = ratioWeight;\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n for (line = 0, pixelOffset = actualPosition; line < this.originalHeightMultipliedByChannels; pixelOffset += nextLineOffsetOriginalWidth) {\n r = buffer[pixelOffset];\n g = buffer[++pixelOffset];\n b = buffer[++pixelOffset];\n a = fourthChannel ? buffer[++pixelOffset] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[line++] += (a ? r : 0) * multiplier;\n output[line++] += (a ? g : 0) * multiplier;\n output[line++] += (a ? b : 0) * multiplier;\n if (fourthChannel) {\n output[line++] += a * multiplier;\n trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0;\n }\n }\n if (weight >= amountToNext) {\n actualPosition += channelsNum;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (weight > 0 && actualPosition < this.originalWidthMultipliedByChannels);\n for (line = 0, pixelOffset = outputOffset; line < this.originalHeightMultipliedByChannels; pixelOffset += nextLineOffsetTargetWidth) {\n weight = fourthChannel ? trustworthyColorsCount[line / channelsNum] : 1;\n multiplier = fourthChannel ? weight ? 1 / weight : 0 : ratioWeightDivisor;\n outputBuffer[pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n outputBuffer[++pixelOffset] = output[line++] * multiplier;\n if (fourthChannel) outputBuffer[++pixelOffset] = output[line++] * ratioWeightDivisor;\n }\n outputOffset += channelsNum;\n } while (outputOffset < this.targetWidthMultipliedByChannels);\n return outputBuffer;\n};\nResize.prototype._resizeHeightRGBChannels = function (buffer, fourthChannel) {\n const ratioWeight = this.ratioWeightHeightPass;\n const ratioWeightDivisor = 1 / ratioWeight;\n const output = this.outputHeightWorkBench;\n const outputBuffer = this.heightBuffer;\n const trustworthyColorsCount = this.outputHeightWorkBenchOpaquePixelsCount;\n let weight = 0;\n let amountToNext = 0;\n let actualPosition = 0;\n let currentPosition = 0;\n let pixelOffset = 0;\n let outputOffset = 0;\n let caret = 0;\n let multiplier = 1;\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n do {\n for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) {\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n output[pixelOffset++] = 0;\n if (fourthChannel) {\n output[pixelOffset++] = 0;\n trustworthyColorsCount[pixelOffset / 4 - 1] = 0;\n }\n }\n weight = ratioWeight;\n do {\n amountToNext = 1 + actualPosition - currentPosition;\n multiplier = Math.min(weight, amountToNext);\n caret = actualPosition;\n for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) {\n r = buffer[caret++];\n g = buffer[caret++];\n b = buffer[caret++];\n a = fourthChannel ? buffer[caret++] : 255;\n // Ignore RGB values if pixel is completely transparent\n output[pixelOffset++] += (a ? r : 0) * multiplier;\n output[pixelOffset++] += (a ? g : 0) * multiplier;\n output[pixelOffset++] += (a ? b : 0) * multiplier;\n if (fourthChannel) {\n output[pixelOffset++] += a * multiplier;\n trustworthyColorsCount[pixelOffset / 4 - 1] += a ? multiplier : 0;\n }\n }\n if (weight >= amountToNext) {\n actualPosition = caret;\n currentPosition = actualPosition;\n weight -= amountToNext;\n } else {\n currentPosition += weight;\n break;\n }\n } while (weight > 0 && actualPosition < this.widthPassResultSize);\n for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) {\n weight = fourthChannel ? trustworthyColorsCount[pixelOffset / 4] : 1;\n multiplier = fourthChannel ? weight ? 1 / weight : 0 : ratioWeightDivisor;\n outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier);\n outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier);\n outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * multiplier);\n if (fourthChannel) {\n outputBuffer[outputOffset++] = Math.round(output[pixelOffset++] * ratioWeightDivisor);\n }\n }\n } while (outputOffset < this.finalResultSize);\n return outputBuffer;\n};\nResize.prototype.resizeWidthInterpolatedRGB = function (buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, false);\n};\nResize.prototype.resizeWidthInterpolatedRGBA = function (buffer) {\n return this._resizeWidthInterpolatedRGBChannels(buffer, true);\n};\nResize.prototype.resizeWidthRGB = function (buffer) {\n return this._resizeWidthRGBChannels(buffer, false);\n};\nResize.prototype.resizeWidthRGBA = function (buffer) {\n return this._resizeWidthRGBChannels(buffer, true);\n};\nResize.prototype.resizeHeightInterpolated = function (buffer) {\n const ratioWeight = this.ratioWeightHeightPass;\n const outputBuffer = this.heightBuffer;\n let weight = 0;\n let finalOffset = 0;\n let pixelOffset = 0;\n let pixelOffsetAccumulated = 0;\n let pixelOffsetAccumulated2 = 0;\n let firstWeight = 0;\n let secondWeight = 0;\n let interpolationHeightSourceReadStop;\n\n // Handle for only one interpolation input being valid for start calculation:\n for (; weight < 1 / 3; weight += ratioWeight) {\n for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels;) {\n outputBuffer[finalOffset++] = Math.round(buffer[pixelOffset++]);\n }\n }\n\n // Adjust for overshoot of the last pass's counter:\n weight -= 1 / 3;\n for (interpolationHeightSourceReadStop = this.heightOriginal - 1; weight < interpolationHeightSourceReadStop; weight += ratioWeight) {\n // Calculate weightings:\n secondWeight = weight % 1;\n firstWeight = 1 - secondWeight;\n // Interpolate:\n pixelOffsetAccumulated = Math.floor(weight) * this.targetWidthMultipliedByChannels;\n pixelOffsetAccumulated2 = pixelOffsetAccumulated + this.targetWidthMultipliedByChannels;\n for (pixelOffset = 0; pixelOffset < this.targetWidthMultipliedByChannels; ++pixelOffset) {\n outputBuffer[finalOffset++] = Math.round(buffer[pixelOffsetAccumulated++] * firstWeight + buffer[pixelOffsetAccumulated2++] * secondWeight);\n }\n }\n\n // Handle for only one interpolation input being valid for end calculation:\n while (finalOffset < this.finalResultSize) {\n for (pixelOffset = 0, pixelOffsetAccumulated = interpolationHeightSourceReadStop * this.targetWidthMultipliedByChannels; pixelOffset < this.targetWidthMultipliedByChannels; ++pixelOffset) {\n outputBuffer[finalOffset++] = Math.round(buffer[pixelOffsetAccumulated++]);\n }\n }\n return outputBuffer;\n};\nResize.prototype.resizeHeightRGB = function (buffer) {\n return this._resizeHeightRGBChannels(buffer, false);\n};\nResize.prototype.resizeHeightRGBA = function (buffer) {\n return this._resizeHeightRGBChannels(buffer, true);\n};\nResize.prototype.resize = function (buffer) {\n this.resizeCallback(this.resizeHeight(this.resizeWidth(buffer)));\n};\nResize.prototype.bypassResizer = function (buffer) {\n // Just return the buffer passed:\n return buffer;\n};\nResize.prototype.initializeFirstPassBuffers = function (BILINEARAlgo) {\n // Initialize the internal width pass buffers:\n this.widthBuffer = this.generateFloatBuffer(this.widthPassResultSize);\n if (!BILINEARAlgo) {\n this.outputWidthWorkBench = this.generateFloatBuffer(this.originalHeightMultipliedByChannels);\n if (this.colorChannels > 3) {\n this.outputWidthWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(this.heightOriginal);\n }\n }\n};\nResize.prototype.initializeSecondPassBuffers = function (BILINEARAlgo) {\n // Initialize the internal height pass buffers:\n this.heightBuffer = this.generateUint8Buffer(this.finalResultSize);\n if (!BILINEARAlgo) {\n this.outputHeightWorkBench = this.generateFloatBuffer(this.targetWidthMultipliedByChannels);\n if (this.colorChannels > 3) {\n this.outputHeightWorkBenchOpaquePixelsCount = this.generateFloat64Buffer(this.targetWidth);\n }\n }\n};\nResize.prototype.generateFloatBuffer = function (bufferLength) {\n // Generate a float32 typed array buffer:\n try {\n return new Float32Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\nResize.prototype.generateFloat64Buffer = function (bufferLength) {\n // Generate a float64 typed array buffer:\n try {\n return new Float64Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\nResize.prototype.generateUint8Buffer = function (bufferLength) {\n // Generate a uint8 typed array buffer:\n try {\n return new Uint8Array(bufferLength);\n } catch (error) {\n return [];\n }\n};\nexport default Resize;\n//# sourceMappingURL=resize.js.map","/**\n * Copyright (c) 2015 Guyon Roche\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:

\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\nconst operations = {\n nearestNeighbor(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n const wDst = dst.width;\n const hDst = dst.height;\n const bufSrc = src.data;\n const bufDst = dst.data;\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n let posDst = (i * wDst + j) * 4;\n const iSrc = Math.floor(i * hSrc / hDst);\n const jSrc = Math.floor(j * wSrc / wDst);\n let posSrc = (iSrc * wSrc + jSrc) * 4;\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n bufDst[posDst++] = bufSrc[posSrc++];\n }\n }\n },\n bilinearInterpolation(src, dst) {\n const wSrc = src.width;\n const hSrc = src.height;\n const wDst = dst.width;\n const hDst = dst.height;\n const bufSrc = src.data;\n const bufDst = dst.data;\n const interpolate = function (k, kMin, vMin, kMax, vMax) {\n // special case - k is integer\n if (kMin === kMax) {\n return vMin;\n }\n return Math.round((k - kMin) * vMax + (kMax - k) * vMin);\n };\n const assign = function (pos, offset, x, xMin, xMax, y, yMin, yMax) {\n let posMin = (yMin * wSrc + xMin) * 4 + offset;\n let posMax = (yMin * wSrc + xMax) * 4 + offset;\n const vMin = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n\n // special case, y is integer\n if (yMax === yMin) {\n bufDst[pos + offset] = vMin;\n } else {\n posMin = (yMax * wSrc + xMin) * 4 + offset;\n posMax = (yMax * wSrc + xMax) * 4 + offset;\n const vMax = interpolate(x, xMin, bufSrc[posMin], xMax, bufSrc[posMax]);\n bufDst[pos + offset] = interpolate(y, yMin, vMin, yMax, vMax);\n }\n };\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n const posDst = (i * wDst + j) * 4;\n // x & y in src coordinates\n const x = j * wSrc / wDst;\n const xMin = Math.floor(x);\n const xMax = Math.min(Math.ceil(x), wSrc - 1);\n const y = i * hSrc / hDst;\n const yMin = Math.floor(y);\n const yMax = Math.min(Math.ceil(y), hSrc - 1);\n assign(posDst, 0, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 1, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 2, x, xMin, xMax, y, yMin, yMax);\n assign(posDst, 3, x, xMin, xMax, y, yMin, yMax);\n }\n }\n },\n _interpolate2D(src, dst, options, interpolate) {\n const bufSrc = src.data;\n const bufDst = dst.data;\n const wSrc = src.width;\n const hSrc = src.height;\n const wDst = dst.width;\n const hDst = dst.height;\n\n // when dst smaller than src/2, interpolate first to a multiple between 0.5 and 1.0 src, then sum squares\n const wM = Math.max(1, Math.floor(wSrc / wDst));\n const wDst2 = wDst * wM;\n const hM = Math.max(1, Math.floor(hSrc / hDst));\n const hDst2 = hDst * hM;\n\n // ===========================================================\n // Pass 1 - interpolate rows\n // buf1 has width of dst2 and height of src\n const buf1 = Buffer.alloc(wDst2 * hSrc * 4);\n for (let i = 0; i < hSrc; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i in src coords, j in dst coords\n\n // calculate x in src coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (wSrc-1)/wDst2\n const x = j * (wSrc - 1) / wDst2;\n const xPos = Math.floor(x);\n const t = x - xPos;\n const srcPos = (i * wSrc + xPos) * 4;\n const buf1Pos = (i * wDst2 + j) * 4;\n for (let k = 0; k < 4; k++) {\n const kPos = srcPos + k;\n const x0 = xPos > 0 ? bufSrc[kPos - 4] : 2 * bufSrc[kPos] - bufSrc[kPos + 4];\n const x1 = bufSrc[kPos];\n const x2 = bufSrc[kPos + 4];\n const x3 = xPos < wSrc - 2 ? bufSrc[kPos + 8] : 2 * bufSrc[kPos + 4] - bufSrc[kPos];\n buf1[buf1Pos + k] = interpolate(x0, x1, x2, x3, t);\n }\n }\n }\n // this._writeFile(wDst2, hSrc, buf1, \"out/buf1.jpg\");\n\n // ===========================================================\n // Pass 2 - interpolate columns\n // buf2 has width and height of dst2\n const buf2 = Buffer.alloc(wDst2 * hDst2 * 4);\n for (let i = 0; i < hDst2; i++) {\n for (let j = 0; j < wDst2; j++) {\n // i&j in dst2 coords\n\n // calculate y in buf1 coords\n // this interpolation requires 4 sample points and the two inner ones must be real\n // the outer points can be fudged for the edges.\n // therefore (hSrc-1)/hDst2\n const y = i * (hSrc - 1) / hDst2;\n const yPos = Math.floor(y);\n const t = y - yPos;\n const buf1Pos = (yPos * wDst2 + j) * 4;\n const buf2Pos = (i * wDst2 + j) * 4;\n for (let k = 0; k < 4; k++) {\n const kPos = buf1Pos + k;\n const y0 = yPos > 0 ? buf1[kPos - wDst2 * 4] : 2 * buf1[kPos] - buf1[kPos + wDst2 * 4];\n const y1 = buf1[kPos];\n const y2 = buf1[kPos + wDst2 * 4];\n const y3 = yPos < hSrc - 2 ? buf1[kPos + wDst2 * 8] : 2 * buf1[kPos + wDst2 * 4] - buf1[kPos];\n buf2[buf2Pos + k] = interpolate(y0, y1, y2, y3, t);\n }\n }\n }\n // this._writeFile(wDst2, hDst2, buf2, \"out/buf2.jpg\");\n\n // ===========================================================\n // Pass 3 - scale to dst\n const m = wM * hM;\n if (m > 1) {\n for (let i = 0; i < hDst; i++) {\n for (let j = 0; j < wDst; j++) {\n // i&j in dst bounded coords\n let r = 0;\n let g = 0;\n let b = 0;\n let a = 0;\n let realColors = 0;\n for (let y = 0; y < hM; y++) {\n const yPos = i * hM + y;\n for (let x = 0; x < wM; x++) {\n const xPos = j * wM + x;\n const xyPos = (yPos * wDst2 + xPos) * 4;\n const pixelAlpha = buf2[xyPos + 3];\n if (pixelAlpha) {\n r += buf2[xyPos];\n g += buf2[xyPos + 1];\n b += buf2[xyPos + 2];\n realColors++;\n }\n a += pixelAlpha;\n }\n }\n const pos = (i * wDst + j) * 4;\n bufDst[pos] = realColors ? Math.round(r / realColors) : 0;\n bufDst[pos + 1] = realColors ? Math.round(g / realColors) : 0;\n bufDst[pos + 2] = realColors ? Math.round(b / realColors) : 0;\n bufDst[pos + 3] = Math.round(a / m);\n }\n }\n } else {\n // replace dst buffer with buf2\n dst.data = buf2;\n }\n },\n bicubicInterpolation(src, dst, options) {\n const interpolateCubic = function (x0, x1, x2, x3, t) {\n const a0 = x3 - x2 - x0 + x1;\n const a1 = x0 - x1 - a0;\n const a2 = x2 - x0;\n const a3 = x1;\n return Math.max(0, Math.min(255, a0 * (t * t * t) + a1 * (t * t) + a2 * t + a3));\n };\n return this._interpolate2D(src, dst, options, interpolateCubic);\n },\n hermiteInterpolation(src, dst, options) {\n const interpolateHermite = function (x0, x1, x2, x3, t) {\n const c0 = x1;\n const c1 = 0.5 * (x2 - x0);\n const c2 = x0 - 2.5 * x1 + 2 * x2 - 0.5 * x3;\n const c3 = 0.5 * (x3 - x0) + 1.5 * (x1 - x2);\n return Math.max(0, Math.min(255, Math.round(((c3 * t + c2) * t + c1) * t + c0)));\n };\n return this._interpolate2D(src, dst, options, interpolateHermite);\n },\n bezierInterpolation(src, dst, options) {\n // between 2 points y(n), y(n+1), use next points out, y(n-1), y(n+2)\n // to predict control points (a & b) to be placed at n+0.5\n // ya(n) = y(n) + (y(n+1)-y(n-1))/4\n // yb(n) = y(n+1) - (y(n+2)-y(n))/4\n // then use std bezier to interpolate [n,n+1)\n // y(n+t) = y(n)*(1-t)^3 + 3 * ya(n)*(1-t)^2*t + 3 * yb(n)*(1-t)*t^2 + y(n+1)*t^3\n // note the 3* factor for the two control points\n // for edge cases, can choose:\n // y(-1) = y(0) - 2*(y(1)-y(0))\n // y(w) = y(w-1) + 2*(y(w-1)-y(w-2))\n // but can go with y(-1) = y(0) and y(w) = y(w-1)\n const interpolateBezier = function (x0, x1, x2, x3, t) {\n // x1, x2 are the knots, use x0 and x3 to calculate control points\n const cp1 = x1 + (x2 - x0) / 4;\n const cp2 = x2 - (x3 - x1) / 4;\n const nt = 1 - t;\n const c0 = x1 * nt * nt * nt;\n const c1 = 3 * cp1 * nt * nt * t;\n const c2 = 3 * cp2 * nt * t * t;\n const c3 = x2 * t * t * t;\n return Math.max(0, Math.min(255, Math.round(c0 + c1 + c2 + c3)));\n };\n return this._interpolate2D(src, dst, options, interpolateBezier);\n }\n};\nexport default operations;\n//# sourceMappingURL=resize2.js.map","import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Rotates an image counter-clockwise by multiple of 90 degrees. NB: 'this' must be a Jimp object.\n *\n * This function is based on matrix rotation. Check this to get an initial idea how it works: https://stackoverflow.com/a/8664879/10561909\n *\n * @param {number} deg the number of degrees to rotate the image by, it should be a multiple of 90\n */\nfunction matrixRotate(deg) {\n if (Math.abs(deg) % 90 !== 0) {\n throw new Error(\"Unsupported matrix rotation degree\");\n }\n deg %= 360;\n if (Math.abs(deg) === 0) {\n // no rotation for 0, 360, -360, 720, -720, ...\n return;\n }\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n\n // decide which rotation angle to use\n let angle;\n switch (deg) {\n // 90 degree & -270 degree are same\n case 90:\n case -270:\n angle = 90;\n break;\n case 180:\n case -180:\n angle = 180;\n break;\n case 270:\n case -90:\n angle = -90;\n break;\n default:\n throw new Error(\"Unsupported matrix rotation degree\");\n }\n // After this switch block, angle will be 90, 180 or -90\n\n // calculate the new width and height\n const nW = angle === 180 ? w : h;\n const nH = angle === 180 ? h : w;\n const dstBuffer = Buffer.alloc(this.bitmap.data.length);\n\n // function to translate the x, y coordinate to the index of the pixel in the buffer\n function createIdxTranslationFunction(w, h) {\n return function (x, y) {\n return y * w + x << 2;\n };\n }\n const srcIdxFunction = createIdxTranslationFunction(w, h);\n const dstIdxFunction = createIdxTranslationFunction(nW, nH);\n for (let x = 0; x < w; x++) {\n for (let y = 0; y < h; y++) {\n const srcIdx = srcIdxFunction(x, y);\n const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);\n let dstIdx;\n switch (angle) {\n case 90:\n dstIdx = dstIdxFunction(y, w - x - 1);\n break;\n case -90:\n dstIdx = dstIdxFunction(h - y - 1, x);\n break;\n case 180:\n dstIdx = dstIdxFunction(w - x - 1, h - y - 1);\n break;\n default:\n throw new Error(\"Unsupported matrix rotation angle\");\n }\n dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);\n }\n }\n this.bitmap.data = dstBuffer;\n this.bitmap.width = nW;\n this.bitmap.height = nH;\n}\n\n/**\n * Rotates an image counter-clockwise by an arbitrary number of degrees. NB: 'this' must be a Jimp object.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n */\nfunction advancedRotate(deg, mode) {\n deg %= 360;\n const rad = deg * Math.PI / 180;\n const cosine = Math.cos(rad);\n const sine = Math.sin(rad);\n\n // the final width and height will change if resize == true\n let w = this.bitmap.width;\n let h = this.bitmap.height;\n if (mode === true || typeof mode === \"string\") {\n // resize the image to it maximum dimension and blit the existing image\n // onto the center so that when it is rotated the image is kept in bounds\n\n // http://stackoverflow.com/questions/3231176/how-to-get-size-of-a-rotated-rectangle\n // Plus 1 border pixel to ensure to show all rotated result for some cases.\n w = Math.ceil(Math.abs(this.bitmap.width * cosine) + Math.abs(this.bitmap.height * sine)) + 1;\n h = Math.ceil(Math.abs(this.bitmap.width * sine) + Math.abs(this.bitmap.height * cosine)) + 1;\n // Ensure destination to have even size to a better result.\n if (w % 2 !== 0) {\n w++;\n }\n if (h % 2 !== 0) {\n h++;\n }\n const c = this.cloneQuiet();\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n });\n const max = Math.max(w, h, this.bitmap.width, this.bitmap.height);\n this.resize(max, max, mode);\n this.blit(c, this.bitmap.width / 2 - c.bitmap.width / 2, this.bitmap.height / 2 - c.bitmap.height / 2);\n }\n const bW = this.bitmap.width;\n const bH = this.bitmap.height;\n const dstBuffer = Buffer.alloc(this.bitmap.data.length);\n function createTranslationFunction(deltaX, deltaY) {\n return function (x, y) {\n return {\n x: x + deltaX,\n y: y + deltaY\n };\n };\n }\n const translate2Cartesian = createTranslationFunction(-(bW / 2), -(bH / 2));\n const translate2Screen = createTranslationFunction(bW / 2 + 0.5, bH / 2 + 0.5);\n for (let y = 1; y <= bH; y++) {\n for (let x = 1; x <= bW; x++) {\n const cartesian = translate2Cartesian(x, y);\n const source = translate2Screen(cosine * cartesian.x - sine * cartesian.y, cosine * cartesian.y + sine * cartesian.x);\n const dstIdx = bW * (y - 1) + x - 1 << 2;\n if (source.x >= 0 && source.x < bW && source.y >= 0 && source.y < bH) {\n const srcIdx = (bW * (source.y | 0) + source.x | 0) << 2;\n const pixelRGBA = this.bitmap.data.readUInt32BE(srcIdx);\n dstBuffer.writeUInt32BE(pixelRGBA, dstIdx);\n } else {\n // reset off-image pixels\n dstBuffer.writeUInt32BE(this._background, dstIdx);\n }\n }\n }\n this.bitmap.data = dstBuffer;\n if (mode === true || typeof mode === \"string\") {\n // now crop the image to the final size\n const x = bW / 2 - w / 2;\n const y = bH / 2 - h / 2;\n this.crop(x, y, w, h);\n }\n}\nexport default (() => ({\n /**\n * Rotates the image counter-clockwise by a number of degrees. By default the width and height of the image will be resized appropriately.\n * @param {number} deg the number of degrees to rotate the image by\n * @param {string|boolean} mode (optional) resize mode or a boolean, if false then the width and height of the image will not be changed\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n rotate(deg, mode, cb) {\n // enable overloading\n if (typeof mode === \"undefined\" || mode === null) {\n // e.g. image.resize(120);\n // e.g. image.resize(120, null, cb);\n // e.g. image.resize(120, undefined, cb);\n mode = true;\n }\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n // e.g. image.resize(120, cb);\n cb = mode;\n mode = true;\n }\n if (typeof deg !== \"number\") {\n return throwError.call(this, \"deg must be a number\", cb);\n }\n if (typeof mode !== \"boolean\" && typeof mode !== \"string\") {\n return throwError.call(this, \"mode must be a boolean or a string\", cb);\n }\n\n // use matrixRotate if the angle is a multiple of 90 degrees (eg: 180 or -90) and resize is allowed or not needed.\n const matrixRotateAllowed = deg % 90 === 0 && (mode || this.bitmap.width === this.bitmap.height || deg % 180 === 0);\n if (matrixRotateAllowed) {\n matrixRotate.call(this, deg);\n } else {\n advancedRotate.call(this, deg, mode, cb);\n }\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n }\n}));\n//# sourceMappingURL=index.js.map","import { mergeDeep } from \"timm\";\nimport blit from \"@jimp/plugin-blit\";\nimport blur from \"@jimp/plugin-blur\";\nimport circle from \"@jimp/plugin-circle\";\nimport color from \"@jimp/plugin-color\";\nimport contain from \"@jimp/plugin-contain\";\nimport cover from \"@jimp/plugin-cover\";\nimport crop from \"@jimp/plugin-crop\";\nimport displace from \"@jimp/plugin-displace\";\nimport dither from \"@jimp/plugin-dither\";\nimport fisheye from \"@jimp/plugin-fisheye\";\nimport flip from \"@jimp/plugin-flip\";\nimport gaussian from \"@jimp/plugin-gaussian\";\nimport invert from \"@jimp/plugin-invert\";\nimport mask from \"@jimp/plugin-mask\";\nimport normalize from \"@jimp/plugin-normalize\";\nimport print from \"@jimp/plugin-print\";\nimport resize from \"@jimp/plugin-resize\";\nimport rotate from \"@jimp/plugin-rotate\";\nimport scale from \"@jimp/plugin-scale\";\nimport shadow from \"@jimp/plugin-shadow\";\nimport threshold from \"@jimp/plugin-threshold\";\nconst plugins = [blit, blur, circle, color, contain, cover, crop, displace, dither, fisheye, flip, gaussian, invert, mask, normalize, print, resize, rotate, scale, shadow, threshold];\nexport default (jimpEvChange => {\n const initializedPlugins = plugins.map(pluginModule => {\n let plugin = pluginModule(jimpEvChange) || {};\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n plugin = {\n class: plugin\n };\n }\n return plugin;\n });\n return mergeDeep(...initializedPlugins);\n});\n//# sourceMappingURL=index.js.map","import { throwError, isNodePattern } from \"@jimp/utils\";\nexport default (() => ({\n /**\n * Blits a source image on to this image\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the x position to blit the image\n * @param {number} y the y position to blit the image\n * @param {number} srcx (optional) the x position from which to crop the source image\n * @param {number} srcy (optional) the y position from which to crop the source image\n * @param {number} srcw (optional) the width to which to crop the source image\n * @param {number} srch (optional) the height to which to crop the source image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blit(src, x, y, srcx, srcy, srcw, srch, cb) {\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n if (typeof srcx === \"function\") {\n cb = srcx;\n srcx = 0;\n srcy = 0;\n srcw = src.bitmap.width;\n srch = src.bitmap.height;\n } else if (typeof srcx === typeof srcy && typeof srcy === typeof srcw && typeof srcw === typeof srch) {\n srcx = srcx || 0;\n srcy = srcy || 0;\n srcw = srcw || src.bitmap.width;\n srch = srch || src.bitmap.height;\n } else {\n return throwError.call(this, \"srcx, srcy, srcw, srch must be numbers\", cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n\n // round input\n srcx = Math.round(srcx);\n srcy = Math.round(srcy);\n srcw = Math.round(srcw);\n srch = Math.round(srch);\n const maxWidth = this.bitmap.width;\n const maxHeight = this.bitmap.height;\n const baseImage = this;\n src.scanQuiet(srcx, srcy, srcw, srch, function (sx, sy, idx) {\n const xOffset = x + sx - srcx;\n const yOffset = y + sy - srcy;\n if (xOffset >= 0 && yOffset >= 0 && maxWidth - xOffset > 0 && maxHeight - yOffset > 0) {\n const dstIdx = baseImage.getPixelIndex(xOffset, yOffset);\n const src = {\n r: this.bitmap.data[idx],\n g: this.bitmap.data[idx + 1],\n b: this.bitmap.data[idx + 2],\n a: this.bitmap.data[idx + 3]\n };\n const dst = {\n r: baseImage.bitmap.data[dstIdx],\n g: baseImage.bitmap.data[dstIdx + 1],\n b: baseImage.bitmap.data[dstIdx + 2],\n a: baseImage.bitmap.data[dstIdx + 3]\n };\n baseImage.bitmap.data[dstIdx] = (src.a * (src.r - dst.r) - dst.r + 255 >> 8) + dst.r;\n baseImage.bitmap.data[dstIdx + 1] = (src.a * (src.g - dst.g) - dst.g + 255 >> 8) + dst.g;\n baseImage.bitmap.data[dstIdx + 2] = (src.a * (src.b - dst.b) - dst.b + 255 >> 8) + dst.b;\n baseImage.bitmap.data[dstIdx + 3] = this.constructor.limit255(dst.a + src.a);\n }\n });\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n }\n}));\n//# sourceMappingURL=index.js.map","import { throwError, isNodePattern } from \"@jimp/utils\";\nimport { mulTable, shgTable } from \"./blur-tables\";\n\n/*\n Superfast Blur (0.5)\n http://www.quasimondo.com/BoxBlurForCanvas/FastBlur.js\n\n Copyright (c) 2011 Mario Klingemann\n\n Permission is hereby granted, free of charge, to any person\n obtaining a copy of this software and associated documentation\n files (the \"Software\"), to deal in the Software without\n restriction, including without limitation the rights to use,\n copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the\n Software is furnished to do so, subject to the following\n conditions:\n\n The above copyright notice and this permission notice shall be\n included in all copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\n OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n OTHER DEALINGS IN THE SOFTWARE.\n*/\n\nexport default (() => ({\n /**\n * A fast blur algorithm that produces similar effect to a Gaussian blur - but MUCH quicker\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n blur(r, cb) {\n if (typeof r !== \"number\") return throwError.call(this, \"r must be a number\", cb);\n if (r < 1) return throwError.call(this, \"r must be greater than 0\", cb);\n let rsum;\n let gsum;\n let bsum;\n let asum;\n let x;\n let y;\n let i;\n let p;\n let p1;\n let p2;\n let yp;\n let yi;\n let yw;\n let pa;\n const wm = this.bitmap.width - 1;\n const hm = this.bitmap.height - 1;\n // const wh = this.bitmap.width * this.bitmap.height;\n const rad1 = r + 1;\n const mulSum = mulTable[r];\n const shgSum = shgTable[r];\n const red = [];\n const green = [];\n const blue = [];\n const alpha = [];\n const vmin = [];\n const vmax = [];\n let iterations = 2;\n while (iterations-- > 0) {\n yi = 0;\n yw = 0;\n for (y = 0; y < this.bitmap.height; y++) {\n rsum = this.bitmap.data[yw] * rad1;\n gsum = this.bitmap.data[yw + 1] * rad1;\n bsum = this.bitmap.data[yw + 2] * rad1;\n asum = this.bitmap.data[yw + 3] * rad1;\n for (i = 1; i <= r; i++) {\n p = yw + ((i > wm ? wm : i) << 2);\n rsum += this.bitmap.data[p++];\n gsum += this.bitmap.data[p++];\n bsum += this.bitmap.data[p++];\n asum += this.bitmap.data[p];\n }\n for (x = 0; x < this.bitmap.width; x++) {\n red[yi] = rsum;\n green[yi] = gsum;\n blue[yi] = bsum;\n alpha[yi] = asum;\n if (y === 0) {\n vmin[x] = ((p = x + rad1) < wm ? p : wm) << 2;\n vmax[x] = (p = x - r) > 0 ? p << 2 : 0;\n }\n p1 = yw + vmin[x];\n p2 = yw + vmax[x];\n rsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n gsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n bsum += this.bitmap.data[p1++] - this.bitmap.data[p2++];\n asum += this.bitmap.data[p1] - this.bitmap.data[p2];\n yi++;\n }\n yw += this.bitmap.width << 2;\n }\n for (x = 0; x < this.bitmap.width; x++) {\n yp = x;\n rsum = red[yp] * rad1;\n gsum = green[yp] * rad1;\n bsum = blue[yp] * rad1;\n asum = alpha[yp] * rad1;\n for (i = 1; i <= r; i++) {\n yp += i > hm ? 0 : this.bitmap.width;\n rsum += red[yp];\n gsum += green[yp];\n bsum += blue[yp];\n asum += alpha[yp];\n }\n yi = x << 2;\n for (y = 0; y < this.bitmap.height; y++) {\n pa = asum * mulSum >>> shgSum;\n this.bitmap.data[yi + 3] = pa;\n\n // normalize alpha\n if (pa > 255) {\n this.bitmap.data[yi + 3] = 255;\n }\n if (pa > 0) {\n pa = 255 / pa;\n this.bitmap.data[yi] = (rsum * mulSum >>> shgSum) * pa;\n this.bitmap.data[yi + 1] = (gsum * mulSum >>> shgSum) * pa;\n this.bitmap.data[yi + 2] = (bsum * mulSum >>> shgSum) * pa;\n } else {\n this.bitmap.data[yi + 2] = 0;\n this.bitmap.data[yi + 1] = 0;\n this.bitmap.data[yi] = 0;\n }\n if (x === 0) {\n vmin[y] = ((p = y + rad1) < hm ? p : hm) * this.bitmap.width;\n vmax[y] = (p = y - r) > 0 ? p * this.bitmap.width : 0;\n }\n p1 = x + vmin[y];\n p2 = x + vmax[y];\n rsum += red[p1] - red[p2];\n gsum += green[p1] - green[p2];\n bsum += blue[p1] - blue[p2];\n asum += alpha[p1] - alpha[p2];\n yi += this.bitmap.width << 2;\n }\n }\n }\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n }\n}));\n//# sourceMappingURL=index.js.map","import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional) radius, x, y\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default (() => ({\n circle() {\n let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let cb = arguments.length > 1 ? arguments[1] : undefined;\n if (typeof options === \"function\") {\n cb = options;\n options = {};\n }\n const radius = options.radius || (this.bitmap.width > this.bitmap.height ? this.bitmap.height : this.bitmap.width) / 2;\n const center = {\n x: typeof options.x === \"number\" ? options.x : this.bitmap.width / 2,\n y: typeof options.y === \"number\" ? options.y : this.bitmap.height / 2\n };\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {\n const curR = Math.sqrt(Math.pow(x - center.x, 2) + Math.pow(y - center.y, 2));\n if (radius - curR <= 0.0) {\n this.bitmap.data[idx + 3] = 0;\n } else if (radius - curR < 1.0) {\n this.bitmap.data[idx + 3] = 255 * (radius - curR);\n }\n });\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n }\n}));\n//# sourceMappingURL=index.js.map","import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Scale the image to the given width and height keeping the aspect ratio. Some parts of the image may be letter boxed.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default (() => ({\n contain(w, h, alignBits, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n\n // permit any sort of optional parameters combination\n if (typeof alignBits === \"string\") {\n if (typeof mode === \"function\" && typeof cb === \"undefined\") cb = mode;\n mode = alignBits;\n alignBits = null;\n }\n if (typeof alignBits === \"function\") {\n if (typeof cb === \"undefined\") cb = alignBits;\n mode = null;\n alignBits = null;\n }\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & (1 << 3) - 1;\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) {\n return throwError.call(this, \"only use one flag per alignment direction\", cb);\n }\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width;\n const c = this.cloneQuiet().scale(f, mode);\n this.resize(w, h, mode);\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {\n this.bitmap.data.writeUInt32BE(this._background, idx);\n });\n this.blit(c, (this.bitmap.width - c.bitmap.width) / 2 * alignH, (this.bitmap.height - c.bitmap.height) / 2 * alignV);\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n }\n}));\n//# sourceMappingURL=index.js.map","import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Scale the image so the given width and height keeping the aspect ratio. Some parts of the image may be clipped.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {number} alignBits (optional) A bitmask for horizontal and vertical alignment\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default (() => ({\n cover(w, h, alignBits, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n if (alignBits && typeof alignBits === \"function\" && typeof cb === \"undefined\") {\n cb = alignBits;\n alignBits = null;\n mode = null;\n } else if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n alignBits = alignBits || this.constructor.HORIZONTAL_ALIGN_CENTER | this.constructor.VERTICAL_ALIGN_MIDDLE;\n const hbits = alignBits & (1 << 3) - 1;\n const vbits = alignBits >> 3;\n\n // check if more flags than one is in the bit sets\n if (!(hbits !== 0 && !(hbits & hbits - 1) || vbits !== 0 && !(vbits & vbits - 1))) return throwError.call(this, \"only use one flag per alignment direction\", cb);\n const alignH = hbits >> 1; // 0, 1, 2\n const alignV = vbits >> 1; // 0, 1, 2\n\n const f = w / h > this.bitmap.width / this.bitmap.height ? w / this.bitmap.width : h / this.bitmap.height;\n this.scale(f, mode);\n this.crop((this.bitmap.width - w) / 2 * alignH, (this.bitmap.height - h) / 2 * alignV, w, h);\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n }\n}));\n//# sourceMappingURL=index.js.map","/* eslint-disable no-labels */\n\nimport { throwError, isNodePattern } from \"@jimp/utils\";\nexport default function pluginCrop(event) {\n /**\n * Crops the image at a given point to a give size\n * @param {number} x the x coordinate to crop form\n * @param {number} y the y coordinate to crop form\n * @param w the width of the crop region\n * @param h the height of the crop region\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n event(\"crop\", function (x, y, w, h, cb) {\n if (typeof x !== \"number\" || typeof y !== \"number\") return throwError.call(this, \"x and y must be numbers\", cb);\n if (typeof w !== \"number\" || typeof h !== \"number\") return throwError.call(this, \"w and h must be numbers\", cb);\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n w = Math.round(w);\n h = Math.round(h);\n if (x === 0 && w === this.bitmap.width) {\n // shortcut\n const start = w * y + x << 2;\n const end = start + (h * w << 2);\n this.bitmap.data = this.bitmap.data.slice(start, end);\n } else {\n const bitmap = Buffer.allocUnsafe(w * h * 4);\n let offset = 0;\n this.scanQuiet(x, y, w, h, function (x, y, idx) {\n const data = this.bitmap.data.readUInt32BE(idx, true);\n bitmap.writeUInt32BE(data, offset, true);\n offset += 4;\n });\n this.bitmap.data = bitmap;\n }\n this.bitmap.width = w;\n this.bitmap.height = h;\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n });\n return {\n class: {\n /**\n * Autocrop same color borders from this image\n * @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%)\n * @param {boolean} cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true)\n * @param {function(Error, Jimp)} cb (optional): a callback for when complete (default: no callback)\n * @returns {Jimp} this for chaining of methods\n */\n autocrop() {\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const minPixelsPerSide = 1; // to avoid cropping completely the image, resulting in an invalid 0 sized image\n\n let cb; // callback\n let leaveBorder = 0; // Amount of pixels in border to leave\n let tolerance = 0.0002; // percent of color difference tolerance (default value)\n let cropOnlyFrames = true; // flag to force cropping only if the image has a real \"frame\"\n // i.e. all 4 sides have some border (default value)\n let cropSymmetric = false; // flag to force cropping top be symmetric.\n // i.e. north and south / east and west are cropped by the same value\n let ignoreSides = {\n north: false,\n south: false,\n east: false,\n west: false\n };\n\n // parse arguments\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n for (let a = 0, len = args.length; a < len; a++) {\n if (typeof args[a] === \"number\") {\n // tolerance value passed\n tolerance = args[a];\n }\n if (typeof args[a] === \"boolean\") {\n // cropOnlyFrames value passed\n cropOnlyFrames = args[a];\n }\n if (typeof args[a] === \"function\") {\n // callback value passed\n cb = args[a];\n }\n if (typeof args[a] === \"object\") {\n // config object passed\n const config = args[a];\n if (typeof config.tolerance !== \"undefined\") {\n ({\n tolerance\n } = config);\n }\n if (typeof config.cropOnlyFrames !== \"undefined\") {\n ({\n cropOnlyFrames\n } = config);\n }\n if (typeof config.cropSymmetric !== \"undefined\") {\n ({\n cropSymmetric\n } = config);\n }\n if (typeof config.leaveBorder !== \"undefined\") {\n ({\n leaveBorder\n } = config);\n }\n if (typeof config.ignoreSides !== \"undefined\") {\n ({\n ignoreSides\n } = config);\n }\n }\n }\n\n /**\n * All borders must be of the same color as the top left pixel, to be cropped.\n * It should be possible to crop borders each with a different color,\n * but since there are many ways for corners to intersect, it would\n * introduce unnecessary complexity to the algorithm.\n */\n\n // scan each side for same color borders\n let colorTarget = this.getPixelColor(0, 0); // top left pixel color is the target color\n const rgba1 = this.constructor.intToRGBA(colorTarget);\n\n // for north and east sides\n let northPixelsToCrop = 0;\n let eastPixelsToCrop = 0;\n let southPixelsToCrop = 0;\n let westPixelsToCrop = 0;\n\n // north side (scan rows from north to south)\n colorTarget = this.getPixelColor(0, 0);\n if (!ignoreSides.north) {\n north: for (let y = 0; y < h - minPixelsPerSide; y++) {\n for (let x = 0; x < w; x++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break north;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n northPixelsToCrop++;\n }\n }\n\n // west side (scan columns from west to east)\n colorTarget = this.getPixelColor(w, 0);\n if (!ignoreSides.west) {\n west: for (let x = 0; x < w - minPixelsPerSide; x++) {\n for (let y = 0 + northPixelsToCrop; y < h; y++) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break west;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n westPixelsToCrop++;\n }\n }\n\n // south side (scan rows from south to north)\n colorTarget = this.getPixelColor(0, h);\n if (!ignoreSides.south) {\n south: for (let y = h - 1; y >= northPixelsToCrop + minPixelsPerSide; y--) {\n for (let x = w - eastPixelsToCrop - 1; x >= 0; x--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break south;\n }\n }\n\n // this row contains all pixels with the same color: increment this side pixels to crop\n southPixelsToCrop++;\n }\n }\n\n // east side (scan columns from east to west)\n colorTarget = this.getPixelColor(w, h);\n if (!ignoreSides.east) {\n east: for (let x = w - 1; x >= 0 + westPixelsToCrop + minPixelsPerSide; x--) {\n for (let y = h - 1; y >= 0 + northPixelsToCrop; y--) {\n const colorXY = this.getPixelColor(x, y);\n const rgba2 = this.constructor.intToRGBA(colorXY);\n if (this.constructor.colorDiff(rgba1, rgba2) > tolerance) {\n // this pixel is too distant from the first one: abort this side scan\n break east;\n }\n }\n\n // this column contains all pixels with the same color: increment this side pixels to crop\n eastPixelsToCrop++;\n }\n }\n\n // decide if a crop is needed\n let doCrop = false;\n\n // apply leaveBorder\n westPixelsToCrop -= leaveBorder;\n eastPixelsToCrop -= leaveBorder;\n northPixelsToCrop -= leaveBorder;\n southPixelsToCrop -= leaveBorder;\n if (cropSymmetric) {\n const horizontal = Math.min(eastPixelsToCrop, westPixelsToCrop);\n const vertical = Math.min(northPixelsToCrop, southPixelsToCrop);\n westPixelsToCrop = horizontal;\n eastPixelsToCrop = horizontal;\n northPixelsToCrop = vertical;\n southPixelsToCrop = vertical;\n }\n\n // make sure that crops are >= 0\n westPixelsToCrop = westPixelsToCrop >= 0 ? westPixelsToCrop : 0;\n eastPixelsToCrop = eastPixelsToCrop >= 0 ? eastPixelsToCrop : 0;\n northPixelsToCrop = northPixelsToCrop >= 0 ? northPixelsToCrop : 0;\n southPixelsToCrop = southPixelsToCrop >= 0 ? southPixelsToCrop : 0;\n\n // safety checks\n const widthOfRemainingPixels = w - (westPixelsToCrop + eastPixelsToCrop);\n const heightOfRemainingPixels = h - (southPixelsToCrop + northPixelsToCrop);\n if (cropOnlyFrames) {\n // crop image if all sides should be cropped\n doCrop = eastPixelsToCrop !== 0 && northPixelsToCrop !== 0 && westPixelsToCrop !== 0 && southPixelsToCrop !== 0;\n } else {\n // crop image if at least one side should be cropped\n doCrop = eastPixelsToCrop !== 0 || northPixelsToCrop !== 0 || westPixelsToCrop !== 0 || southPixelsToCrop !== 0;\n }\n if (doCrop) {\n // do the real crop\n this.crop(westPixelsToCrop, northPixelsToCrop, widthOfRemainingPixels, heightOfRemainingPixels);\n }\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n }\n }\n };\n}\n//# sourceMappingURL=index.js.map","import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Displaces the image based on the provided displacement map\n * @param {object} map the source Jimp instance\n * @param {number} offset the maximum displacement value\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default (() => ({\n displace(map, offset, cb) {\n if (typeof map !== \"object\" || map.constructor !== this.constructor) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n if (typeof offset !== \"number\") {\n return throwError.call(this, \"factor must be a number\", cb);\n }\n const source = this.cloneQuiet();\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {\n let displacement = map.bitmap.data[idx] / 256 * offset;\n displacement = Math.round(displacement);\n const ids = this.getPixelIndex(x + displacement, y);\n this.bitmap.data[ids] = source.bitmap.data[idx];\n this.bitmap.data[ids + 1] = source.bitmap.data[idx + 1];\n this.bitmap.data[ids + 2] = source.bitmap.data[idx + 2];\n });\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n }\n}));\n//# sourceMappingURL=index.js.map","import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Creates a circle out of an image.\n * @param {object} options (optional) r: radius of effect\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default (() => ({\n fisheye() {\n let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {\n r: 2.5\n };\n let cb = arguments.length > 1 ? arguments[1] : undefined;\n if (typeof options === \"function\") {\n cb = options;\n options = {\n r: 2.5\n };\n }\n const source = this.cloneQuiet();\n const {\n width,\n height\n } = source.bitmap;\n source.scanQuiet(0, 0, width, height, (x, y) => {\n const hx = x / width;\n const hy = y / height;\n const r = Math.sqrt(Math.pow(hx - 0.5, 2) + Math.pow(hy - 0.5, 2));\n const rn = 2 * Math.pow(r, options.r);\n const cosA = (hx - 0.5) / r;\n const sinA = (hy - 0.5) / r;\n const newX = Math.round((rn * cosA + 0.5) * width);\n const newY = Math.round((rn * sinA + 0.5) * height);\n const color = source.getPixelColor(newX, newY);\n this.setPixelColor(color, x, y);\n });\n\n /* Set center pixel color, otherwise it will be transparent */\n this.setPixelColor(source.getPixelColor(width / 2, height / 2), width / 2, height / 2);\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n }\n}));\n//# sourceMappingURL=index.js.map","import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Applies a true Gaussian blur to the image (warning: this is VERY slow)\n * @param {number} r the pixel radius of the blur\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default (() => ({\n gaussian(r, cb) {\n // http://blog.ivank.net/fastest-gaussian-blur.html\n if (typeof r !== \"number\") {\n return throwError.call(this, \"r must be a number\", cb);\n }\n if (r < 1) {\n return throwError.call(this, \"r must be greater than 0\", cb);\n }\n const rs = Math.ceil(r * 2.57); // significant radius\n const range = rs * 2 + 1;\n const rr2 = r * r * 2;\n const rr2pi = rr2 * Math.PI;\n const weights = [];\n for (let y = 0; y < range; y++) {\n weights[y] = [];\n for (let x = 0; x < range; x++) {\n const dsq = (x - rs) ** 2 + (y - rs) ** 2;\n weights[y][x] = Math.exp(-dsq / rr2) / rr2pi;\n }\n }\n for (let y = 0; y < this.bitmap.height; y++) {\n for (let x = 0; x < this.bitmap.width; x++) {\n let red = 0;\n let green = 0;\n let blue = 0;\n let alpha = 0;\n let wsum = 0;\n for (let iy = 0; iy < range; iy++) {\n for (let ix = 0; ix < range; ix++) {\n const x1 = Math.min(this.bitmap.width - 1, Math.max(0, ix + x - rs));\n const y1 = Math.min(this.bitmap.height - 1, Math.max(0, iy + y - rs));\n const weight = weights[iy][ix];\n const idx = y1 * this.bitmap.width + x1 << 2;\n red += this.bitmap.data[idx] * weight;\n green += this.bitmap.data[idx + 1] * weight;\n blue += this.bitmap.data[idx + 2] * weight;\n alpha += this.bitmap.data[idx + 3] * weight;\n wsum += weight;\n }\n const idx = y * this.bitmap.width + x << 2;\n this.bitmap.data[idx] = Math.round(red / wsum);\n this.bitmap.data[idx + 1] = Math.round(green / wsum);\n this.bitmap.data[idx + 2] = Math.round(blue / wsum);\n this.bitmap.data[idx + 3] = Math.round(alpha / wsum);\n }\n }\n }\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n }\n}));\n//# sourceMappingURL=index.js.map","import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Inverts the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default (() => ({\n invert(cb) {\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {\n this.bitmap.data[idx] = 255 - this.bitmap.data[idx];\n this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1];\n this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2];\n });\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n }\n}));\n//# sourceMappingURL=index.js.map","import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Masks a source image on to this image using average pixel colour. A completely black pixel on the mask will turn a pixel in the image completely transparent.\n * @param {Jimp} src the source Jimp instance\n * @param {number} x the horizontal position to blit the image\n * @param {number} y the vertical position to blit the image\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default (() => ({\n mask(src) {\n let x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n let y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n let cb = arguments.length > 3 ? arguments[3] : undefined;\n if (!(src instanceof this.constructor)) {\n return throwError.call(this, \"The source must be a Jimp image\", cb);\n }\n if (typeof x !== \"number\" || typeof y !== \"number\") {\n return throwError.call(this, \"x and y must be numbers\", cb);\n }\n\n // round input\n x = Math.round(x);\n y = Math.round(y);\n const w = this.bitmap.width;\n const h = this.bitmap.height;\n const baseImage = this;\n src.scanQuiet(0, 0, src.bitmap.width, src.bitmap.height, function (sx, sy, idx) {\n const destX = x + sx;\n const destY = y + sy;\n if (destX >= 0 && destY >= 0 && destX < w && destY < h) {\n const dstIdx = baseImage.getPixelIndex(destX, destY);\n const {\n data\n } = this.bitmap;\n const avg = (data[idx + 0] + data[idx + 1] + data[idx + 2]) / 3;\n baseImage.bitmap.data[dstIdx + 3] *= avg / 255;\n }\n });\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n }\n}));\n//# sourceMappingURL=index.js.map","import { throwError, isNodePattern } from \"@jimp/utils\";\nimport Resize from \"./modules/resize\";\nimport Resize2 from \"./modules/resize2\";\nexport default (() => ({\n constants: {\n RESIZE_NEAREST_NEIGHBOR: \"nearestNeighbor\",\n RESIZE_BILINEAR: \"bilinearInterpolation\",\n RESIZE_BICUBIC: \"bicubicInterpolation\",\n RESIZE_HERMITE: \"hermiteInterpolation\",\n RESIZE_BEZIER: \"bezierInterpolation\"\n },\n class: {\n /**\n * Resizes the image to a set width and height using a 2-pass bilinear algorithm\n * @param {number} w the width to resize the image to (or Jimp.AUTO)\n * @param {number} h the height to resize the image to (or Jimp.AUTO)\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n resize(w, h, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n if (w === this.constructor.AUTO && h === this.constructor.AUTO) {\n return throwError.call(this, \"w and h cannot both be set to auto\", cb);\n }\n if (w === this.constructor.AUTO) {\n w = this.bitmap.width * (h / this.bitmap.height);\n }\n if (h === this.constructor.AUTO) {\n h = this.bitmap.height * (w / this.bitmap.width);\n }\n if (w < 0 || h < 0) {\n return throwError.call(this, \"w and h must be positive numbers\", cb);\n }\n\n // round inputs\n w = Math.round(w) || 1;\n h = Math.round(h) || 1;\n if (typeof Resize2[mode] === \"function\") {\n const dst = {\n data: Buffer.alloc(w * h * 4),\n width: w,\n height: h\n };\n Resize2[mode](this.bitmap, dst);\n this.bitmap = dst;\n } else {\n const image = this;\n const resize = new Resize(this.bitmap.width, this.bitmap.height, w, h, true, true, buffer => {\n image.bitmap.data = Buffer.from(buffer);\n image.bitmap.width = w;\n image.bitmap.height = h;\n });\n resize.resize(this.bitmap.data);\n }\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n }\n }\n}));\n//# sourceMappingURL=index.js.map","import { isNodePattern, throwError } from \"@jimp/utils\";\nexport default (() => ({\n /**\n * Uniformly scales the image by a factor.\n * @param {number} f the factor to scale the image by\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scale(f, mode, cb) {\n if (typeof f !== \"number\") {\n return throwError.call(this, \"f must be a number\", cb);\n }\n if (f < 0) {\n return throwError.call(this, \"f must be a positive number\", cb);\n }\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n const w = this.bitmap.width * f;\n const h = this.bitmap.height * f;\n this.resize(w, h, mode);\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n },\n /**\n * Scale the image to the largest size that fits inside the rectangle that has the given width and height.\n * @param {number} w the width to resize the image to\n * @param {number} h the height to resize the image to\n * @param {string} mode (optional) a scaling method (e.g. Jimp.RESIZE_BEZIER)\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\n scaleToFit(w, h, mode, cb) {\n if (typeof w !== \"number\" || typeof h !== \"number\") {\n return throwError.call(this, \"w and h must be numbers\", cb);\n }\n if (typeof mode === \"function\" && typeof cb === \"undefined\") {\n cb = mode;\n mode = null;\n }\n const f = w / h > this.bitmap.width / this.bitmap.height ? h / this.bitmap.height : w / this.bitmap.width;\n this.scale(f, mode);\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n }\n}));\n//# sourceMappingURL=index.js.map","import { isNodePattern } from \"@jimp/utils\";\n\n/**\n * Creates a circle out of an image.\n * @param {function(Error, Jimp)} options (optional)\n * opacity - opacity of the shadow between 0 and 1\n * size,- of the shadow\n * blur - how blurry the shadow is\n * x- x position of shadow\n * y - y position of shadow\n * @param {function(Error, Jimp)} cb (optional) a callback for when complete\n * @returns {Jimp} this for chaining of methods\n */\nexport default (() => ({\n shadow() {\n let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let cb = arguments.length > 1 ? arguments[1] : undefined;\n if (typeof options === \"function\") {\n cb = options;\n options = {};\n }\n const {\n opacity = 0.7,\n size = 1.1,\n x = -25,\n y = 25,\n blur = 5\n } = options;\n\n // clone the image\n const orig = this.clone();\n const shadow = this.clone();\n\n // turn all it's pixels black\n shadow.scan(0, 0, shadow.bitmap.width, shadow.bitmap.height, (x, y, idx) => {\n shadow.bitmap.data[idx] = 0x00;\n shadow.bitmap.data[idx + 1] = 0x00;\n shadow.bitmap.data[idx + 2] = 0x00;\n // up the opacity a little,\n shadow.bitmap.data[idx + 3] = shadow.constructor.limit255(shadow.bitmap.data[idx + 3] * opacity);\n this.bitmap.data[idx] = 0x00;\n this.bitmap.data[idx + 1] = 0x00;\n this.bitmap.data[idx + 2] = 0x00;\n this.bitmap.data[idx + 3] = 0x00;\n });\n\n // enlarge it. This creates a \"shadow\".\n shadow.resize(shadow.bitmap.width * size, shadow.bitmap.height * size).blur(blur);\n\n // Then blit the \"shadow\" onto the background and the image on top of that.\n this.composite(shadow, x, y);\n this.composite(orig, 0, 0);\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n }\n}));\n//# sourceMappingURL=index.js.map","import { isNodePattern, throwError } from \"@jimp/utils\";\n\n/**\n * Applies a minimum color threshold to a greyscale image. Converts image to greyscale by default\n * @param {number} options object\n * max: A number auto limited between 0 - 255\n * replace: (optional) A number auto limited between 0 - 255 (default 255)\n * autoGreyscale: (optional) A boolean whether to apply greyscale beforehand (default true)\n * @param {number} cb (optional) a callback for when complete\n * @return {this} this for chaining of methods\n */\nexport default (() => ({\n threshold(_ref, cb) {\n let {\n max,\n replace = 255,\n autoGreyscale = true\n } = _ref;\n if (typeof max !== \"number\") {\n return throwError.call(this, \"max must be a number\", cb);\n }\n if (typeof replace !== \"number\") {\n return throwError.call(this, \"replace must be a number\", cb);\n }\n if (typeof autoGreyscale !== \"boolean\") {\n return throwError.call(this, \"autoGreyscale must be a boolean\", cb);\n }\n max = this.constructor.limit255(max);\n replace = this.constructor.limit255(replace);\n if (autoGreyscale) {\n this.greyscale();\n }\n this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, (x, y, idx) => {\n const grey = this.bitmap.data[idx] < max ? this.bitmap.data[idx] : replace;\n this.bitmap.data[idx] = grey;\n this.bitmap.data[idx + 1] = grey;\n this.bitmap.data[idx + 2] = grey;\n });\n if (isNodePattern(cb)) {\n cb.call(this, null, this);\n }\n return this;\n }\n}));\n//# sourceMappingURL=index.js.map","import Jimp, { addType, addJimpMethods, addConstants, jimpEvChange } from \"@jimp/core\";\nexport default function configure(configuration) {\n let jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp;\n const jimpConfig = {\n hasAlpha: {},\n encoders: {},\n decoders: {},\n class: {},\n constants: {}\n };\n function addToConfig(newConfig) {\n Object.entries(newConfig).forEach(_ref => {\n let [key, value] = _ref;\n jimpConfig[key] = {\n ...jimpConfig[key],\n ...value\n };\n });\n }\n function addImageType(typeModule) {\n const type = typeModule();\n if (Array.isArray(type.mime)) {\n addType(...type.mime);\n } else {\n Object.entries(type.mime).forEach(mimeType => addType(...mimeType));\n }\n delete type.mime;\n addToConfig(type);\n }\n function addPlugin(pluginModule) {\n const plugin = pluginModule(jimpEvChange) || {};\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n addToConfig({\n class: plugin\n });\n } else {\n addToConfig(plugin);\n }\n }\n if (configuration.types) {\n configuration.types.forEach(addImageType);\n jimpInstance.decoders = {\n ...jimpInstance.decoders,\n ...jimpConfig.decoders\n };\n jimpInstance.encoders = {\n ...jimpInstance.encoders,\n ...jimpConfig.encoders\n };\n jimpInstance.hasAlpha = {\n ...jimpInstance.hasAlpha,\n ...jimpConfig.hasAlpha\n };\n }\n if (configuration.plugins) {\n configuration.plugins.forEach(addPlugin);\n }\n addJimpMethods(jimpConfig.class, jimpInstance);\n addConstants(jimpConfig.constants, jimpInstance);\n return Jimp;\n}\n//# sourceMappingURL=index.js.map","import configure from \"@jimp/custom\";\n\nimport types from \"@jimp/types\";\nimport plugins from \"@jimp/plugins\";\n\nexport default configure({\n types: [types],\n plugins: [plugins],\n});\n","import { mergeDeep } from \"timm\";\nimport jpeg from \"@jimp/jpeg\";\nimport png from \"@jimp/png\";\nimport bmp from \"@jimp/bmp\";\nimport tiff from \"@jimp/tiff\";\nimport gif from \"@jimp/gif\";\nexport default (() => mergeDeep(jpeg(), png(), bmp(), tiff(), gif()));\n//# sourceMappingURL=index.js.map"],"names":["Converter","anyBase","srcAlphabet","dstAlphabet","converter","number","convert","BIN","OCT","DEC","HEX","module","exports","length","Error","this","prototype","i","divide","newlen","numberMap","fromBase","toBase","result","isValid","indexOf","parseInt","slice","concat","byteLength","b64","lens","getLens","validLen","placeHoldersLen","toByteArray","tmp","arr","Arr","_byteLength","curByte","len","revLookup","charCodeAt","fromByteArray","uint8","extraBytes","parts","maxChunkLength","len2","push","encodeChunk","lookup","join","Uint8Array","Array","code","start","end","num","output","encode","decode","BmpDecoder","buffer","is_with_alpha","pos","bottom_up","flag","toString","parseHeader","parseRGBA","fileSize","readUInt32LE","reserved","offset","headerSize","width","height","readInt32LE","planes","readUInt16LE","bitPP","compress","rawSize","hr","vr","colors","importantColors","palette","blue","readUInt8","green","red","quad","bitn","data","Buffer","bit1","xlen","Math","ceil","mode","y","line","x","b","location","rgb","bit4","fill","lines","low_nibble","a","c","setPixelData","call","rgbIndex","before","after","bit8","bit15","dif_w","_1_5","B","alpha","bit16","maskRed","maskGreen","maskBlue","mask0","ns","bit24","bit32","getData","bmpData","BmpEncoder","imgData","rgbSize","headerInfoSize","tempBuffer","write","writeUInt32LE","writeInt32LE","writeUInt16LE","rowBytes","p","fillOffset","quality","isBuffer","equals","base64","ieee754","K_MAX_LENGTH","createBuffer","RangeError","buf","__proto__","arg","encodingOrOffset","TypeError","allocUnsafe","from","value","string","encoding","isEncoding","actual","fromString","ArrayBuffer","isView","fromArrayLike","isInstance","array","byteOffset","undefined","fromArrayBuffer","valueOf","obj","checked","copy","numberIsNaN","type","isArray","fromObject","Symbol","toPrimitive","assertSize","size","mustMatch","arguments","loweredCase","utf8ToBytes","base64ToBytes","toLowerCase","slowToString","hexSlice","utf8Slice","asciiSlice","latin1Slice","base64Slice","utf16leSlice","swap","n","m","bidirectionalIndexOf","val","dir","arrayIndexOf","lastIndexOf","indexSize","arrLength","valLength","String","read","readUInt16BE","foundIndex","found","j","hexWrite","Number","remaining","strLen","parsed","substr","utf8Write","blitBuffer","asciiWrite","str","byteArray","asciiToBytes","latin1Write","base64Write","ucs2Write","units","hi","lo","utf16leToBytes","min","res","secondByte","thirdByte","fourthByte","tempCodePoint","firstByte","codePoint","bytesPerSequence","codePoints","MAX_ARGUMENTS_LENGTH","fromCharCode","apply","decodeCodePointsArray","TYPED_ARRAY_SUPPORT","foo","e","typedArraySupport","console","error","Object","defineProperty","enumerable","get","species","configurable","writable","poolSize","alloc","allocUnsafeSlow","_isBuffer","compare","list","swap16","swap32","swap64","toLocaleString","inspect","max","replace","trim","target","thisStart","thisEnd","thisCopy","targetCopy","includes","isFinite","toJSON","_arr","ret","out","bytes","checkOffset","ext","checkInt","checkIEEE754","writeFloat","littleEndian","noAssert","writeDouble","newBuf","subarray","readUIntLE","mul","readUIntBE","readUInt32BE","readIntLE","pow","readIntBE","readInt8","readInt16LE","readInt16BE","readInt32BE","readFloatLE","readFloatBE","readDoubleLE","readDoubleBE","writeUIntLE","writeUIntBE","writeUInt8","writeUInt16BE","writeUInt32BE","writeIntLE","limit","sub","writeIntBE","writeInt8","writeInt16LE","writeInt16BE","writeInt32BE","writeFloatLE","writeFloatBE","writeDoubleLE","writeDoubleBE","targetStart","copyWithin","set","INVALID_BASE64_RE","Infinity","leadSurrogate","split","base64clean","src","dst","constructor","name","isLE","mLen","nBytes","eLen","eMax","eBias","nBits","d","s","NaN","rt","abs","isNaN","floor","log","LN2","ReflectOwnKeys","R","Reflect","ReflectApply","receiver","args","Function","ownKeys","getOwnPropertySymbols","getOwnPropertyNames","NumberIsNaN","EventEmitter","init","once","emitter","Promise","resolve","reject","errorListener","err","removeListener","resolver","eventTargetAgnosticAddListener","handler","flags","on","addErrorHandlerIfEventEmitter","_events","_eventsCount","_maxListeners","defaultMaxListeners","checkListener","listener","_getMaxListeners","that","_addListener","prepend","events","existing","warning","create","newListener","emit","unshift","warned","w","count","warn","onceWrapper","fired","wrapFn","_onceWrap","state","wrapped","bind","_listeners","unwrap","evlistener","unwrapListeners","arrayClone","listenerCount","addEventListener","wrapListener","removeEventListener","getPrototypeOf","setMaxListeners","getMaxListeners","doError","er","message","context","listeners","addListener","prependListener","prependOnceListener","position","originalListener","shift","index","pop","spliceOne","off","removeAllListeners","key","keys","rawListeners","eventNames","Parser","global","eval","DOMBufferStream","NodeBufferStream","BufferStream","bigEndian","endPosition","setBigEndian","nextUInt8","nextInt8","nextUInt16","nextUInt32","nextInt16","nextInt32","nextFloat","nextDouble","nextBuffer","remainingLength","nextString","mark","self","openWithOffset","offsetFrom","marker","skip","amount","branch","parseNumber","hours","minutes","parseDateTimeParts","dateParts","timeParts","map","year","month","day","seconds","Date","UTC","parseDateWithTimezoneFormat","dateTimeStr","timezoneParts","timezoneOffset","timestamp","parseDateWithSpecFormat","parseExifDate","isSpecFormat","charAt","arrayBuffer","parentOffset","view","DataView","getUint8","getInt8","getUint16","getUint32","getInt16","getInt32","getFloat32","getFloat64","getParentOffset","exif","gps","readExifValue","format","stream","readExifTag","tiffMarker","values","tagType","bytesPerComponent","getBytesPerComponent","components","valueBytes","lastNull","readIFDSection","iterator","tag","numberOfEntries","IFD0","IFD1","GPSIFD","SubIFD","InteropIFD","parseTags","subIfdOffset","gpsOffset","interopOffset","tiffHeader","readHeader","ifd0Stream","ifd1Offset","ifd1Stream","gpsStream","subIfdStream","interopStream","parseSections","markerType","getSizeFromSOFSection","getSectionName","nameStruct","jpeg","simplify","ExifResult","startMarker","tags","imageSize","thumbnailOffset","thumbnailLength","thumbnailType","app1Offset","readBinaryTags","resolveTagNames","simplifyValues","hidePointers","returnTags","hasThumbnail","mime","getThumbnailOffset","getThumbnailLength","getThumbnailBuffer","_getThumbnailStream","getImageSize","getThumbnailSize","sectionType","sectionStream","enableBinaryFields","enable","enablePointers","enableTagNames","enableImageSize","enableReturnTags","enableSimpleValues","parse","tagNames","getTagValue","setTagValue","t","section","sectionOffset","ifdSection","simplifyValue","hasOwnProperty","castDegreeValues","castDateValues","date","degreeTags","refType","refName","posVal","dateTags","forEach","degreeVal","degreeNumRef","degree","dateStrVal","Token","strtok3","supported","minimumBytes","async","fromStream","tokenizer","fromTokenizer","close","fromBuffer","input","_check","headers","options","header","entries","mask","_fromTokenizer","EndOfStreamError","check","checkString","stringToBytes","fileInfo","MAX_SAFE_INTEGER","peekBuffer","mayBeLess","ignore","id3HeaderLen","readToken","uint32SyncSafeToken","readBuffer","zipHeader","compressedSize","uncompressedSize","filenameLength","extraFieldLength","filename","StringType","endsWith","startsWith","nextHeaderIndex","brandMajor","maxBufferSize","readField","msb","peekNumber","UINT8","ic","id","readElement","lenField","nrLen","readChildren","level","children","re","readChunkHeader","INT32_BE","chunk","guid","UINT64_LE","payload","typeId","jsonSize","JSON","files","_","tarHeaderChecksumMatches","readableStream","pass","PassThrough","outputStream","pipeline","pipe","fileType","Set","extensions","mimeTypes","core","fromFile","path","assign","character","readSum","sum","isCallable","toStr","forEachArray","forEachString","forEachObject","object","k","thisArg","GifReaderLZWOutputIndexStream","code_stream","output_length","min_code_size","clear_code","eoi_code","next_code","cur_code_size","code_mask","cur_shift","cur","op","subblock_size","code_table","Int32Array","prev_code","chase_code","chase_length","chase","GifWriter","gopts","loop_count","loop","global_palette","check_palette_and_num_colors","num_colors","gp_num_colors_pow2","background","gp_num_colors","il","ended","addFrame","h","indexed_pixels","opts","using_local_palette","delay","disposal","use_transparency","transparent_index","transparent","index_stream","cur_subblock","emit_bytes_to_buffer","bit_block_size","emit_code","ib_code","cur_key","cur_code","GifWriterOutputLZWCodeStream","getOutputBuffer","setOutputBuffer","v","getOutputBufferPosition","setOutputBufferPosition","GifReader","pf0","global_palette_flag","num_global_colors","global_palette_offset","global_palette_size","no_eof","frames","block_size","pf1","pf2","interlace_flag","num_local_colors","palette_offset","palette_size","has_local_palette","data_offset","data_length","interlaced","numFrames","loopCount","frameInfo","frame_num","decodeAndBlitFrameBGRA","pixels","frame","num_pixels","trans","framewidth","framestride","xleft","opbeg","opend","scanstride","interlaceskip","r","g","decodeAndBlitFrameRGBA","BitmapImage","firstArg","sourceBitmap","bitmap","thirdArg","fillRGBA","blit","toImage","toX","toY","fromX","fromY","fromWidth","fromHeight","Erro","sourceBuf","targetBuf","sourceByteWidth","targetByteWidth","copyByteWidth","si","ti","rgba","bufByteWidth","bi","getRGBA","getRGBASet","rgbaSet","add","greyscale","scan","idx","grey","round","reframe","xOffset","yOffset","cropX","cropY","cropWidth","cropHeight","newX","newY","image","GifError","scale","factor","isInteger","sourceWidth","sourceHeight","destByteWidth","destBuf","priorDestRowIndex","sourceIndex","destIndex","color","cx","cy","scanAllCoords","scanHandler","bufferLength","scanAllIndexes","Gif","spec","loops","usesTransparency","colorScope","GlobalColorsPreferred","GlobalColorsOnly","LocalColorsOnly","messageOrError","super","stack","Omggif","GifUtil","GifFrame","PER_FRAME_OVERHEAD","_colorLookupLinear","_colorLookupBinary","mid","_extendPaletteToPowerOf2","colorCount","powerOf2","_getFrameSizeEst","pixelBitWidth","_getPixelBitWidth","indexCount","_writeFrame","gifWriter","frameIndex","isLocalPalette","colorToIndexFunc","colorBuffer","indexBuffer","transparentIndex","_getIndexedImage","delayCentisecs","disposalMethod","endOfFrame","startOfFrame","tryAgain","biggerBuffer","GifCodec","_transparentRGB","transparentRGB","_transparentRGBA","_testInitialBufferSize","decodeGif","reader","frameCount","_decodeFrame","encodeGif","dims","getMaxDimensions","maxWidth","maxHeight","_encodeGif","alreadyUsedTransparency","info","ii","colorInfo","getColorInfo","localPalettes","palettes","bufferSizeEst","_encodeLocal","globalPalette","extendedGlobalPalette","_encodeGlobal","_getSizeEstimateGlobal","sizeEst","PER_GIF_OVERHEAD","_getSizeEstimateLocal","source","lastArg","DisposeToBackgroundColor","getPalette","colorSet","iter","next","sort","DisposeToAnything","DisposeNothing","DisposeToPrevious","fs","ImageQ","INVALID_SUFFIXES","defaultCodec","_quantize","imageOrImages","method","maxColorIndexes","modifier","dither","images","ditherAlgorithm","serpentine","minimumColorDistanceToDither","calculateErrorLikeGIMP","distCalculator","distance","Euclidean","quantizer","imageMaker","ErrorDiffusionArray","ErrorDiffusionArrayKernel","NearestColor","inputContainers","imageBuf","inputBuf","inputArray","Uint32Array","ai","inputContainer","utils","PointContainer","fromUint32Array","sample","limitedPalette","quantizeSync","outputArray","toUint32Array","cloneFrames","clones","maxGlobalIndex","globalColorSet","copyAsJimp","jimp","bitmapImageToCopy","shareAsJimp","quantizeDekker","quantizeSorokin","histogram","histogramID","quantizeWu","significantBits","decoder","readFile","then","bitmapImageToShare","jimpImage","encoder","matches","match","gif","writeFile","_writeBinary","win","window","fnToStr","constructorRegex","isES6ClassFn","fnStr","test","hasToStringTag","toStringTag","tryFunctionObject","strClass","fn","setTimeout","alert","confirm","prompt","fetch","JpegImage","dctZigZag","dctCos1","dctSin1","dctCos3","dctSin3","dctCos6","dctSin6","dctSqrt2","dctSqrt1d2","buildHuffmanTable","codeLengths","q","decodeScan","resetInterval","spectralStart","spectralEnd","successivePrev","successive","precision","samplesPerLine","scanLines","mcusPerLine","progressive","startOffset","maxH","maxV","bitsData","bitsCount","readBit","nextByte","decodeHuffman","tree","bit","node","receive","receiveAndExtend","successiveACNextValue","eobrun","successiveACState","decodeMcu","component","mcu","row","col","mcuCol","blockRow","blockCol","blocks","tolerantDecoding","decodeBlock","blocksPerLine","decodeFn","componentsLength","zz","huffmanTableDC","diff","pred","rs","huffmanTableAC","z","direction","mcuExpected","blocksPerColumn","mcusPerColumn","buildComponentData","quantizeAndInverse","dataOut","dataIn","v0","v1","v2","v3","v4","v5","v6","v7","qt","quantizationTable","requestMemoryAllocation","scanLine","clampTo8bit","load","xhr","XMLHttpRequest","open","responseType","onload","response","mozResponseArrayBuffer","send","maxResolutionInPixels","maxResolutionInMP","readUint16","prepareComponents","componentId","blocksPerLineForMcu","blocksPerColumnForMcu","jfif","adobe","quantizationTables","huffmanTablesAC","huffmanTablesDC","fileMarker","malformedDataOffset","comments","appData","comment","version","major","minor","densityUnits","xDensity","yDensity","thumbWidth","thumbHeight","thumbData","exifBuffer","flags0","flags1","transformCode","quantizationTablesEnd","quantizationTableSpec","tableData","extended","componentsOrder","pixelsInFrame","exceededAmount","componentsCount","qId","quantizationIdx","huffmanLength","huffmanTableSpec","codeLengthSum","huffmanValues","selectorsCount","tableSpec","successiveApproximation","processed","nextOffset","cp","scaleX","scaleY","component1","component2","component3","component4","component1Line","component2Line","component3Line","component4Line","Y","Cb","Cr","K","C","M","Ye","G","colorTransform","dataLength","copyToImageData","imageData","formatAsRGBA","imageDataArray","totalBytesAllocated","maxMemoryUsageBytes","increaseAmount","totalMemoryImpactBytes","resetMaxMemoryUsage","maxMemoryUsageBytes_","getBytesAllocated","jpegData","userOpts","useTArray","maxMemoryUsageInMB","channels","bytesNeeded","ReferenceError","JPEGEncoder","YDC_HT","UVDC_HT","YAC_HT","UVAC_HT","currentQuality","ffloor","YTable","UVTable","fdtbl_Y","fdtbl_UV","bitcode","category","outputfDCTQuant","DU","byteout","bytenew","bytepos","YDU","UDU","VDU","clt","RGB_YUV_TABLE","ZigZag","std_dc_luminance_nrcodes","std_dc_luminance_values","std_ac_luminance_nrcodes","std_ac_luminance_values","std_dc_chrominance_nrcodes","std_dc_chrominance_values","std_ac_chrominance_nrcodes","std_ac_chrominance_values","computeHuffmanTbl","nrcodes","std_table","codevalue","pos_in_table","HT","writeBits","bs","posval","writeByte","writeWord","processDU","CDU","fdtbl","DC","HTDC","HTAC","EOB","M16zeroes","DU_DCT","d0","d1","d2","d3","d4","d5","d6","d7","fDCTQuant","dataOff","tmp0","tmp7","tmp1","tmp6","tmp2","tmp5","tmp3","tmp4","tmp10","tmp13","tmp11","tmp12","z1","z5","z2","z4","z3","z11","z13","tmp0p2","tmp7p2","tmp1p2","tmp6p2","tmp2p2","tmp5p2","tmp3p2","tmp4p2","tmp10p2","tmp13p2","tmp11p2","tmp12p2","z1p2","z5p2","z2p2","z4p2","z3p2","z11p2","z13p2","Diff","end0pos","lng","startpos","nrzeroes","nrmarker","setQuality","sf","YQT","UVQT","u","aasf","initQuantTables","getTime","l","writeAPP1","writeDQT","writeSOF0","o","writeDHT","DCY","DCU","DCV","displayName","quadWidth","fillbits","sfcc","initCharLookupTable","nrlower","nrupper","cat","nr","nrneg","initCategoryNumber","initRGBYUVTable","qu","noop","parseASCII","parseXML","readBinary","isBinaryFormat","xtend","xml2","opt","cb","uri","binary","req","overrideMimeType","getBinaryOpts","body","statusCode","equal","HEADER","substring","pako","zlib_deflate","strings","msg","ZStream","Z_OK","Z_DEFAULT_COMPRESSION","Z_DEFAULT_STRATEGY","Z_DEFLATED","Deflate","chunkSize","windowBits","memLevel","strategy","to","raw","gzip","chunks","strm","avail_out","status","deflateInit2","deflateSetHeader","dictionary","dict","string2buf","deflateSetDictionary","_dict_set","deflate","deflator","_mode","next_in","avail_in","Buf8","next_out","onEnd","onData","buf2binstring","shrinkBuf","deflateEnd","flattenChunks","deflateRaw","zlib_inflate","GZheader","Inflate","inflateInit2","inflateGetHeader","inflateSetDictionary","inflate","inflator","next_out_utf8","tail","utf8str","allowBufError","Z_FINISH","Z_NO_FLUSH","binstring2buf","Z_NEED_DICT","Z_BUF_ERROR","Z_STREAM_END","Z_SYNC_FLUSH","utf8border","buf2string","arraySet","inflateEnd","inflateRaw","ungzip","TYPED_OK","Uint16Array","_has","sources","fnTyped","dest","src_offs","dest_offs","fnUntyped","setTyped","Buf16","Buf32","STR_APPLY_OK","STR_APPLY_UIA_OK","__","_utf8len","c2","m_pos","str_len","buf_len","c_len","utf16buf","adler","s1","s2","Z_PARTIAL_FLUSH","Z_FULL_FLUSH","Z_BLOCK","Z_TREES","Z_ERRNO","Z_STREAM_ERROR","Z_DATA_ERROR","Z_NO_COMPRESSION","Z_BEST_SPEED","Z_BEST_COMPRESSION","Z_FILTERED","Z_HUFFMAN_ONLY","Z_RLE","Z_FIXED","Z_BINARY","Z_TEXT","Z_UNKNOWN","crcTable","table","makeTable","crc","configuration_table","trees","adler32","crc32","MAX_MEM_LEVEL","L_CODES","LITERALS","D_CODES","BL_CODES","HEAP_SIZE","MAX_BITS","MIN_MATCH","MAX_MATCH","MIN_LOOKAHEAD","INIT_STATE","HCRC_STATE","BUSY_STATE","FINISH_STATE","BS_NEED_MORE","BS_BLOCK_DONE","BS_FINISH_STARTED","BS_FINISH_DONE","errorCode","rank","f","zero","flush_pending","pending","pending_buf","pending_out","total_out","flush_block_only","last","_tr_flush_block","block_start","strstart","put_byte","putShortMSB","longest_match","cur_match","chain_length","max_chain_length","best_len","prev_length","nice_match","w_size","_win","wmask","w_mask","prev","strend","scan_end1","scan_end","good_match","lookahead","match_start","fill_window","more","_w_size","window_size","hash_size","head","wrap","total_in","insert","ins_h","hash_shift","hash_mask","deflate_fast","flush","hash_head","bflush","match_length","_tr_tally","max_lazy_match","last_lit","deflate_slow","max_insert","prev_match","match_available","Config","good_length","max_lazy","nice_length","max_chain","func","DeflateState","pending_buf_size","gzhead","gzindex","last_flush","w_bits","hash_bits","dyn_ltree","dyn_dtree","bl_tree","l_desc","d_desc","bl_desc","bl_count","heap","heap_len","heap_max","depth","l_buf","lit_bufsize","d_buf","opt_len","static_len","bi_buf","bi_valid","deflateResetKeep","data_type","_tr_init","deflateReset","max_block_size","max_start","deflateInit","old_flush","beg","text","hcrc","extra","time","os","bstate","deflate_huff","deflate_rle","_tr_align","_tr_stored_block","avail","tmpDict","dictLength","deflateInfo","xflags","extra_len","done","_in","_out","dmax","wsize","whave","wnext","s_window","hold","bits","lcode","dcode","lmask","dmask","here","dist","from_source","lencode","distcode","lenbits","distbits","top","dolen","dodist","sane","inflate_fast","inflate_table","LENS","DISTS","HEAD","TYPE","BAD","ENOUGH_LENS","ENOUGH_DISTS","zswap32","InflateState","havedict","total","wbits","ncode","nlen","ndist","have","work","lendyn","distdyn","back","was","inflateResetKeep","inflateReset","inflateReset2","lenfix","distfix","virgin","fixedtables","sym","updatewindow","inflateInit","put","left","here_bits","here_op","here_val","last_bits","last_op","last_val","hbuf","order","inf_leave","inflateInfo","lbase","lext","dbase","dext","lens_index","codes","table_index","incr","low","root","curr","drop","used","huff","base","base_index","MAXBITS","offs","extra_index","STORED_BLOCK","Buf_size","END_BLOCK","REP_3_6","REPZ_3_10","REPZ_11_138","extra_lbits","extra_dbits","extra_blbits","bl_order","static_ltree","static_dtree","_dist_code","_length_code","base_length","static_l_desc","static_d_desc","static_bl_desc","base_dist","StaticTreeDesc","static_tree","extra_bits","extra_base","elems","max_length","has_stree","TreeDesc","dyn_tree","stat_desc","max_code","d_code","put_short","send_bits","send_code","bi_reverse","gen_codes","init_block","bi_windup","smaller","_n2","_m2","pqdownheap","compress_block","ltree","dtree","lc","lx","build_tree","desc","stree","xbits","overflow","gen_bitlen","scan_tree","curlen","prevlen","nextlen","max_count","min_count","send_tree","static_init_done","stored_len","copy_block","LENGTH_CODES","tr_static_init","opt_lenb","static_lenb","max_blindex","black_mask","detect_data_type","build_bl_tree","lcodes","dcodes","blcodes","send_all_trees","STATIC_TREES","bi_flush","splitLine","space","dt","parseData","parseIntList","pages","chars","kernings","lineData","file","readBlock","blockID","blockSize","bitField","smooth","unicode","italic","bold","fixedHeight","charset","stretchH","aa","padding","spacing","outline","face","readNameNT","readStringNT","readInfo","common","lineHeight","scaleW","scaleH","packed","alphaChnl","redChnl","greenChnl","blueChnl","readCommon","readPages","char","xoffset","yoffset","xadvance","page","chnl","readChars","kern","first","second","readKernings","every","byte","parseAttributes","parseFromString","NAME_MAP","scaleh","scalew","stretchh","lineheight","alphachnl","redchnl","greenchnl","bluechnl","getAttribs","element","attribs","attributes","getAttribList","reduce","attrib","nodeName","nodeValue","xmlRoot","getElementsByTagName","pageRoot","getAttribute","childTag","child","GLYPH_DESIGNER_ERROR","assertPath","stringify","normalizeStringPosix","allowAboveRoot","lastSegmentLength","lastSlash","dots","lastSlashIndex","posix","cwd","resolvedPath","resolvedAbsolute","process","normalize","isAbsolute","trailingSeparator","joined","relative","fromStart","fromEnd","fromLen","toStart","toLen","lastCommonSep","fromCode","_makeLong","dirname","hasRoot","matchedSlash","basename","extIdx","firstNonSlashEnd","extname","startDot","startPart","preDotState","pathObject","sep","_format","delimiter","win32","Deferred","promise","defaultMessages","StreamReader","EndOfFileStream_1","Deferred_1","EndOfFileStream_2","deferred","endOfStream","peekQueue","uint8Array","bytesRead","peekData","lenCopy","reqLen","chunkLen","readFromStream","request","readDeferred","StreamReader_1","antialiased","img","x1","y1","img2","minX","minY","maxX","maxY","x0","y0","x2","y2","zeroes","positives","negatives","delta","colorDelta","img1","yOnly","a1","a2","r1","blend","g1","b1","r2","g2","b2","rgb2y","rgb2i","rgb2q","drawPixel","threshold","maxDelta","includeAA","require","interlaceUtils","pixelBppMapper","pxData","pxPos","rawPos","pixel","pixelBppCustomMapper","pixelData","maxBit","mapImage8Bit","getPxPos","bpp","imageWidth","imageHeight","imagePass","mapImageCustomBit","resetAfterLine","dataToBitMap","bitmapInfo","interlace","leftOver","byte8","byte7","byte6","byte5","byte4","byte3","byte2","byte1","returner","bitRetriever","getImagePasses","getInterlaceIterator","nonInterlacedPxPos","imageIndex","constants","outHasAlpha","COLORTYPE_COLOR_ALPHA","COLORTYPE_ALPHA","colorType","inputColorType","setInt16","Int16Array","bitDepth","maxValue","inBpp","COLORTYPE_TO_BPP_MAP","inputHasAlpha","outBpp","outData","inIndex","outIndex","bgColor","COLORTYPE_COLOR","COLORTYPE_GRAYSCALE","grayscale","util","Stream","ChunkStream","_buffers","_buffered","_reads","_paused","_encoding","inherits","callback","allowLess","nextTick","_process","dataBuffer","_end","destroySoon","destroy","_processReadAllowingLess","smallerBuf","_processRead","splice","ex","PNG_SIGNATURE","TYPE_IHDR","TYPE_IEND","TYPE_IDAT","TYPE_PLTE","TYPE_tRNS","TYPE_gAMA","COLORTYPE_PALETTE","COLORTYPE_PALETTE_COLOR","GAMMA_DIVISION","currentCrc","CrcCalculator","_crc","paethPredictor","filters","byteWidth","rawData","up","upleft","filterSums","filterTypes","filterType","sel","Filter","FilterAsync","buffers","_filter","complete","SyncReader","inBuffer","outBuffers","bufferPart","getByteWidth","dependencies","_imageIndex","_images","passes","lineIndex","_xComparison","_reverseFilterLine","_unFilterType1","unfilteredLine","xComparison","xBiggerThan","rawByte","f1Left","_unFilterType2","lastLine","_lastLine","f2Up","_unFilterType3","f3Up","f3Left","f3Add","_unFilterType4","f4Up","f4Left","f4UpLeft","f4Add","filter","currentImage","indata","skipRescale","transColor","outdata","dePalette","makeTrans","replaceTransparentColor","maxInSample","scaleDepth","imagePasses","xLeftOver","yLeftOver","xRepeats","yRepeats","passWidth","passHeight","outerXLeftOver","outerX","outerYLeftOver","Packer","PackerAsync","_packer","_deflate","createDeflate","readable","pack","gamma","packIHDR","packGAMA","filteredData","filterData","compressedData","packIDAT","packIEND","hasSyncZlib","zlib","deflateSync","metaData","packer","getDeflateOptions","CrcStream","bitPacker","_options","deflateChunkSize","deflateLevel","deflateStrategy","deflateFactory","packedData","_packChunk","above","upLeft","paeth","pLeft","pAbove","pUpLeft","bitmapper","formatNormaliser","ParserAsync","_parser","_handleError","metadata","_handleMetaData","_handlePalette","_handleTransColor","finished","_finished","inflateData","_inflateData","simpleTransparency","_simpleTransparency","headersFinished","_headersFinished","_inflate","errord","_bitmapInfo","createInflate","_complete","Z_MIN_CHUNK","leftToInflate","emitError","filterWrite","_metaData","normalisedBitmapData","bitmapData","inflateSync","FilterSync","inflateDataList","_err_","_metaData_","_gamma_","inflatedData","maxLength","unfilteredData","checkCRC","_hasIHDR","_hasIEND","_emittedHeadersFinished","_palette","_colorType","_chunks","_handleIHDR","_handleIEND","_handleIDAT","_handlePLTE","_handleTRNS","_handleGAMA","_parseSignature","signature","_parseChunkBegin","ancillary","Boolean","_skipChunk","_handleChunkEnd","_parseChunkEnd","fileCrc","calcCrc","_parseIHDR","compr","_parsePLTE","_parseTRNS","_parseGAMA","_parseIDAT","leftOverLength","_parseIEND","png","PNGSync","PNG","_handleClose","_metadata","_gamma","sync","onParsed","onError","parsedData","bitblt","srcX","srcY","deltaX","deltaY","adjustGamma","assert","ok","kMaxLength","_offset","_outOffset","_buffer","_outBuffer","_maxLength","_close","engine","_handle","flushFlag","_finishFlushFlag","_processChunk","zlibBufferSync","asyncCb","availInBefore","availOutBefore","_chunkSize","inOff","nread","handleChunk","availInAfter","availOutAfter","_hadError","writeSync","_writeState","hasOwn","pSlice","functionsHaveNames","pToString","arrbuf","regex","getName","isFunction","truncate","something","rawname","fail","expected","operator","stackStartFunction","AssertionError","_deepEqual","strict","memos","isDate","isRegExp","multiline","lastIndex","ignoreCase","Float32Array","Float64Array","actualIndex","actualVisitedObjects","isPrimitive","aIsArgs","isArguments","bIsArgs","ka","objectKeys","kb","objEquiv","expectedException","isPrototypeOf","_throws","shouldThrow","block","_tryBlock","userProvidedMessage","isUnexpectedException","isError","generatedMessage","getMessage","captureStackTrace","fn_name","next_line","notEqual","deepEqual","deepStrictEqual","notDeepEqual","notDeepStrictEqual","strictEqual","notStrictEqual","throws","doesNotThrow","ifError","ctor","superCtor","super_","TempCtor","formatRegExp","isString","objects","isNull","isObject","deprecate","isUndefined","noDeprecation","throwDeprecation","traceDeprecation","trace","debugEnviron","debugs","ctx","seen","stylize","stylizeNoColor","isBoolean","showHidden","_extend","customInspect","stylizeWithColor","formatValue","styleType","style","styles","recurseTimes","primitive","simple","isNumber","formatPrimitive","visibleKeys","hash","arrayToHash","formatError","RegExp","braces","toUTCString","formatProperty","formatArray","reduceToSingleString","getOwnPropertyDescriptor","ar","objectToString","pad","debuglog","env","NODE_DEBUG","toUpperCase","pid","isNullOrUndefined","isSymbol","months","prop","getHours","getMinutes","getSeconds","getDate","getMonth","origin","typedArray","Zstream","NONE","DEFLATE","INFLATE","GZIP","GUNZIP","DEFLATERAW","INFLATERAW","UNZIP","Zlib","init_done","write_in_progress","pending_close","gzip_id_bytes_read","in_off","in_len","out_off","out_len","_write","_checkError","_afterSync","_after","next_expected_header_byte","reset","_error","onerror","_init","_setDictionary","params","_reset","Transform","binding","kRangeErrorMessage","Z_MIN_WINDOWBITS","Z_MAX_WINDOWBITS","Z_DEFAULT_WINDOWBITS","Z_MAX_CHUNK","Z_DEFAULT_CHUNK","Z_MIN_MEMLEVEL","Z_MAX_MEMLEVEL","Z_DEFAULT_MEMLEVEL","Z_MIN_LEVEL","Z_MAX_LEVEL","Z_DEFAULT_LEVEL","bkeys","bk","bkey","Z_MEM_ERROR","Z_VERSION_ERROR","ckeys","ck","ckey","zlibBuffer","flow","Gzip","Gunzip","DeflateRaw","InflateRaw","Unzip","isValidFlushFlag","_this","_opts","finishFlush","_flushFlag","errno","_level","_strategy","emitCloseNT","freeze","createDeflateRaw","createInflateRaw","createGzip","createGunzip","createUnzip","gzipSync","deflateRawSync","unzip","unzipSync","gunzip","gunzipSync","inflateRawSync","_flush","_transform","kind","_this2","ws","_writableState","ending","needDrain","newReq","SlowBuffer","INSPECT_MAX_BYTES","$TypeError","$gOPD","throwTypeError","ThrowTypeError","calleeThrows","gOPDthrows","hasSymbols","getProto","generatorFunction","asyncFunction","asyncGenFunction","asyncGenIterator","TypedArray","INTRINSICS","asyncIterator","Atomics","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","EvalError","Int8Array","Map","parseFloat","all","Proxy","SharedArrayBuffer","SyntaxError","Uint8ClampedArray","URIError","WeakMap","WeakSet","$replace","rePropName","reEscapeChar","stringToPath","quote","subString","getBaseIntrinsic","allowMissing","$Function","GetIntrinsic","$apply","$call","callBind","$indexOf","intrinsic","eventListener","ERROR_MESSAGE","funcType","bound","boundLength","boundArgs","Empty","implementation","origSymbol","hasSymbolSham","symObj","syms","propertyIsEnumerable","descriptor","isStandardArguments","isLegacyArguments","callee","supportsStandardArguments","isFnRegex","generatorFunc","getGeneratorFunc","GeneratorFunction","availableTypedArrays","callBound","$toString","typedArrays","$slice","toStrTags","gOPD","proto","superProto","anyTrue","getter","tryTypedArrays","MAX_WBITS","DEF_MEM_LEVEL","PRESET_DICT","EXTRA_STATE","NAME_STATE","COMMENT_STATE","OS_CODE","CODES","FLAGS","TIME","OS","EXLEN","EXTRA","NAME","COMMENT","HCRC","DICTID","DICT","TYPEDO","STORED","COPY_","COPY","TABLE","LENLENS","CODELENS","LEN_","LEN","LENEXT","DIST","DISTEXT","MATCH","LIT","CHECK","LENGTH","DONE","MEM","DEF_WBITS","DYN_TREES","MAX_BL_BITS","cachedSetTimeout","cachedClearTimeout","defaultSetTimout","defaultClearTimeout","runTimeout","fun","clearTimeout","currentQueue","queue","draining","queueIndex","cleanUpNextTick","drainQueue","timeout","run","runClearTimeout","Item","title","browser","argv","versions","chdir","umask","EE","Readable","Writable","Duplex","ondata","pause","ondrain","resume","_isStdio","onend","onclose","didOnEnd","cleanup","createErrorType","Base","NodeError","_Base","arg1","arg2","arg3","superClass","subClass","oneOf","thing","determiner","search","this_len","allowHalfOpen","onEndNT","highWaterMark","getBuffer","_readableState","destroyed","ReadableState","EElistenerCount","OurUint8Array","debug","debugUtil","StringDecoder","createReadableStreamAsyncIterator","BufferList","destroyImpl","getHighWaterMark","_require$codes","ERR_INVALID_ARG_TYPE","ERR_STREAM_PUSH_AFTER_EOF","ERR_METHOD_NOT_IMPLEMENTED","ERR_STREAM_UNSHIFT_AFTER_END_EVENT","errorOrDestroy","kProxyEvents","isDuplex","objectMode","readableObjectMode","pipes","pipesCount","flowing","endEmitted","reading","needReadable","emittedReadable","readableListening","resumeScheduled","paused","emitClose","autoDestroy","defaultEncoding","awaitDrain","readingMore","_read","_destroy","readableAddChunk","addToFront","skipChunkCheck","emitReadable","emitReadable_","onEofChunk","chunkInvalid","_uint8ArrayToBuffer","addChunk","maybeReadMore","_undestroy","undestroy","isPaused","setEncoding","enc","content","clear","MAX_HWM","howMuchToRead","computeNewHighWaterMark","maybeReadMore_","updateReadableListening","nReadingNextTick","resume_","fromList","consume","endReadable","endReadableNT","wState","xs","nOrig","doRead","pipeOpts","endFn","stdout","stderr","unpipe","onunpipe","unpipeInfo","hasUnpiped","onfinish","cleanedUp","pipeOnDrain","event","dests","ev","_fromList","iterable","ERR_MULTIPLE_CALLBACK","ERR_TRANSFORM_ALREADY_TRANSFORMING","ERR_TRANSFORM_WITH_LENGTH_0","afterTransform","ts","_transformState","transforming","writecb","writechunk","needTransform","writeencoding","transform","prefinish","err2","CorkedRequest","entry","finish","corkReq","pendingcb","corkedRequestsFree","onCorkedFinish","WritableState","internalUtil","realHasInstance","ERR_STREAM_CANNOT_PIPE","ERR_STREAM_DESTROYED","ERR_STREAM_NULL_VALUES","ERR_STREAM_WRITE_AFTER_END","ERR_UNKNOWN_ENCODING","nop","writableObjectMode","finalCalled","noDecode","decodeStrings","writing","corked","bufferProcessing","onwrite","writelen","onwriteStateUpdate","finishMaybe","errorEmitted","onwriteError","needFinish","bufferedRequest","clearBuffer","afterWrite","lastBufferedRequest","prefinished","bufferedRequestCount","writev","_writev","final","_final","writeOrBuffer","isBuf","newChunk","decodeChunk","doWrite","onwriteDrain","holder","allBuffers","callFinal","need","rState","current","hasInstance","writeAfterEnd","validChunk","cork","uncork","setDefaultEncoding","endWritable","_Object$setPrototypeO","_defineProperty","kLastResolve","kLastReject","kError","kEnded","kLastPromise","kHandlePromise","kStream","createIterResult","readAndResolve","onReadable","AsyncIteratorPrototype","ReadableStreamAsyncIteratorPrototype","setPrototypeOf","lastPromise","wrapForNext","_Object$create","enumerableOnly","symbols","_defineProperties","props","custom","instance","Constructor","_classCallCheck","protoProps","hasStrings","_getString","_getBuffer","nb","getOwnPropertyDescriptors","defineProperties","_objectSpread","staticProps","emitErrorAndCloseNT","emitErrorNT","readableDestroyed","writableDestroyed","ERR_STREAM_PREMATURE_CLOSE","eos","called","_len","_key","onlegacyfinish","writableEnded","readableEnded","onrequest","setHeader","abort","isRequest","ERR_MISSING_ARGS","streams","popCallback","destroys","closed","destroyer","ERR_INVALID_OPT_VALUE","duplexKey","hwm","highWaterMarkFrom","nenc","retried","_normalizeEncoding","normalizeEncoding","utf16Text","utf16End","fillLast","utf8FillLast","base64Text","base64End","simpleWrite","simpleEnd","lastNeed","lastTotal","lastChar","utf8CheckByte","utf8CheckExtraBytes","utf8CheckIncomplete","copyProps","SafeBuffer","config","localStorage","isArgumentsObject","isGeneratorFunction","whichTypedArray","isTypedArray","uncurryThis","BigIntSupported","BigInt","SymbolSupported","ObjectToString","numberValue","stringValue","booleanValue","bigIntValue","symbolValue","checkBoxedPrimitive","prototypeValueOf","isMapToString","isSetToString","isWeakMapToString","isWeakSetToString","isArrayBufferToString","isArrayBuffer","working","isDataViewToString","isDataView","isSharedArrayBufferToString","isSharedArrayBuffer","isNumberObject","isStringObject","isBooleanObject","isBigIntObject","isSymbolObject","isPromise","catch","isArrayBufferView","isUint8Array","isUint8ClampedArray","isUint16Array","isUint32Array","isInt8Array","isInt16Array","isInt32Array","isFloat32Array","isFloat64Array","isBigInt64Array","isBigUint64Array","isMap","isSet","isWeakMap","isWeakSet","isAsyncFunction","isMapIterator","isSetIterator","isGeneratorObject","isWebAssemblyCompiledModule","isBoxedPrimitive","isAnyArrayBuffer","descriptors","debugEnvRegex","debugEnv","types","isNativeError","kCustomPromisifiedSymbol","callbackifyOnRejected","reason","newReason","promisify","original","promiseResolve","promiseReject","callbackify","callbackified","maybeCb","rej","foundName","canSetImmediate","setImmediate","canPost","postMessage","stopPropagation","AbstractTokenizer","peek_readable_1","numBuffer","token","bytesLeft","normalizeOptions","BufferTokenizer","AbstractTokenizer_1","normOptions","bytes2read","FileTokenizer","fd","sourceFilePath","stat","isFile","writeFileSync","createReadStream","pathExists","existsSync","stats","ReadStreamTokenizer","streamReader","skipBytes","skipBuffer","peek","bufSize","totBytesRead","ReadStreamTokenizer_1","BufferTokenizer_1","FileTokenizer_1","core_1","_typeof","_len3","rest","_key3","doMerge","INVALID_ARGS","throwStr","getKeysAndSymbols","clone","fAddDefaults","fDeep","fChanged","nextVal","AnsiStringType","BufferType","Uint8ArrayType","IgnoreType","Float80_LE","Float80_BE","Float64_LE","Float64_BE","Float32_LE","Float32_BE","Float16_LE","Float16_BE","INT64_BE","UINT64_BE","INT64_LE","INT32_LE","INT24_BE","INT24_LE","INT16_LE","INT16_BE","INT8","UINT32_BE","UINT32_LE","UINT24_BE","UINT24_LE","UINT16_BE","UINT16_LE","dv","setUint8","setUint16","dataView","setUint32","setInt8","unsigned","setInt32","getBigUint64","setBigUint64","getBigInt64","setBigInt64","setFloat32","setFloat64","static","until","codePointToString","singleByteDecoder","bite","inRange","windows1252","right","UTIF","U","Z","V","N","O","D","L","main","W","ak","ac","ah","ao","ad","Q","a5","E","F","P","a7","a8","X","T","J","I","DNLMarkerError","EOIMarkerError","H","A","S","an","al","$","a0","ab","af","ap","ae","markerLoop","a4","a6","forceRGB","isSourcePDF","JpegDecoder","encodeImage","idf","prfx","ifds","bin","_binBE","writeUshort","ifdo","writeUint","noffs","_writeIFD","_types","basic","buff","prm","parseMN","readASCII","_binLE","readUshort","readUint","cnt","typ","_readIFD","decodeImage","bipp","cmpr","fo","bipl","soff","bcnt","bilen","tw","th","tx","ty","tbuff","_decompress","_copyTile","rps","tgt","toff","_decodeG2","_decodeG3","_decodeG4","_decodeLZW","_decodeOldJPEG","_decodeNewJPEG","_decodeVC5","_decodeARW","_decodePackBits","_decodeThunder","_decodeNikon","_decodeLogLuv32","bps","noc","bpl","roff","ntoff","nv","aj","now","readShort","aF","sign","az","aC","aq","aE","as","ay","at","aD","aB","av","a9","ag","qw","io","oo","_ljpeg_diff","getbithuff","_getbithuff","inp","src_length","raw_width","tiff_bps","imax","imin","sh","dp","pix","clr","_putsF","b0","tab","ljpeg_diff","lim","imgs","nikon_tree","make_decoder","_make_decoder","mn","exifIFD","makerNote","md","mdo","ver0","ver1","vpred","shl","step","csize","hpred","bti","nbits","_get_byte","bitbuf","vbits","tables","tlen","boff","LosslessJpegDecode","olen","rst","parser","decoded","_decodeOldJPEGInit","sosMarker","SOI","joff","isTiled","jpgIchgFmt","jifoff","jpgIchgFmtLen","jiflen","soffTag","ycbcrss","ssx","ssy","spp","jpgresint","jpegOffset","ooff","qtables","htables","nc","sofpos","tmptab","tmpoff","soslen","sosoff","sofPosition","dlen","buffoff","SOS","EOI","sa","ta","qoff","px","msk","_dmap","_lens","addKeys","i0","inc","termW","termB","makeW","makeB","makeA","lensW","lensB","slen","wrd","pline","_makeDiff","toRead","_findDiff","dl","_addNtimes","_writeBits","twoDim","is1D","ifd","repeat","voff","o0","ri","readInt","readFloat","readDouble","oarr","subfd","subIFD","gpsiIFD","dngPrvt","fujiIFD","subsub","knum","eoff","ki","writeASCII","wr","writeInt","nu","de","toRGBA8","scl","area","qarea","intp","qi","smpls","ndt","cn","mi","dof","gotAlpha","UDOC","cmykToRgb","sX","sY","replaceIMG","document","sufs","suff","_xhrs","_imgs","_imgLoaded","ind","setAttribute","bufferToURI","vsns","ma","cnv","createElement","getContext","imgd","ImageData","putImageData","toDataURL","nextZero","ui8","i16","i32","ui32","fl32","fl64","tb","xoff","yoff","xlim","ylim","tof","sof","a3","_decompressRAF","log2","globalThis","support","searchParams","blob","Blob","formData","viewClasses","normalizeName","normalizeValue","iteratorFor","items","Headers","append","consumed","bodyUsed","fileReaderReady","readBlobAsArrayBuffer","FileReader","readAsArrayBuffer","bufferClone","Body","_initBody","_bodyInit","_bodyText","_bodyBlob","FormData","_bodyFormData","URLSearchParams","_bodyArrayBuffer","rejected","readAsText","readArrayBufferAsText","json","oldValue","has","methods","Request","upcased","url","credentials","signal","referrer","cache","reParamSearch","form","Response","bodyInit","statusText","redirectStatuses","redirect","DOMException","aborted","abortXhr","rawHeaders","getAllResponseHeaders","responseURL","responseText","ontimeout","onabort","href","fixUrl","withCredentials","setRequestHeader","onreadystatechange","readyState","polyfill","parseHeaders","initParams","createXHR","_createXHR","getBody","responseXML","firefoxBugTakenEffect","documentElement","getXml","isJson","errorFunc","evt","timeoutTimer","failureResponse","loadFunc","useXDR","rawRequest","cors","XDomainRequest","onprogress","username","password","isEmpty","beforeSend","DOMParser","ActiveXObject","xmlDoc","loadXML","div","innerHTML","__defProp","__getOwnPropDesc","__getOwnPropNames","__hasOwnProp","__export","__toCommonJS","module2","temp","copyDefault","__reExport","__publicField","__defNormalProp","src_exports","applyPalette","applyPaletteSync","buildPalette","buildPaletteSync","constants_exports","conversion","conversion_exports","distance_exports","image_exports","palette_exports","quality_exports","utils_exports","bt709","bt709_exports","Y2","correctGamma","rgb2xyz","lab2rgb","lab2xyz","rgb2hsl","rgb2lab","xyz2lab","xyz2rgb","arithmetic_exports","degrees2radians","PI","max3","min3","intInRange","high","inRange0to255Rounded","inRange0to255","stableSort","arrayToSort","sorted","ord","ord2","refX","refY","refZ","pivot","xyz","refX2","refY2","refZ2","pivot2","correctGamma2","AbstractDistanceCalculator","AbstractEuclidean","AbstractManhattan","CIE94GraphicArts","CIE94Textiles","CIEDE2000","CMetric","EuclideanBT709","EuclideanBT709NoAlpha","Manhattan","ManhattanBT709","ManhattanNommyde","PNGQuant","_setDefaults","setWhitePoint","_whitePoint","_maxDistance","calculateRaw","calculateNormalized","colorA","colorB","AbstractCIE94","lab1","lab2","dL","dA","dB","c1","sqrt","dC","deltaH","dAlpha","_kA","_Kl","_K1","_K2","_CIEDE2000","hp","atan2","_deg360InRad","ahp","aCp","aCp_to_7","R_C","_pow25to7","delta_theta","_deg30InRad","exp","_deg275InRad","_deg25InRad","sin","cos","_deg6InRad","_deg63InRad","C1pC2p","h_bar","h1p","h2p","hpSum","_deg180InRad","dhp","dE2","calculateRawInLab","Lab1","Lab2","L1","L2","pow_a_C1_C2_to_7","a1p","a2p","C1p","C2p","_calculatehp","dLp","dCp","dHp","_calculate_dHp","_calculate_ahp","aLp_minus_50_square","dCpSC","dHpSH","_calculateT","_calculateRT","rmean","dE","dR","dG","_kR","_kG","_kB","alphas","_colordifferenceCh","black","white","AbstractPaletteQuantizer","ColorHistogram","NeuQuant","NeuQuantFloat","RGBQuant","WuColorCube","WuQuant","quantize","Point","uint32","quadruplet","point","_loadUINT32","_loadQuadruplet","_loadRGBA","getLuminosity","useAlphaChannel","_width","_height","_pointArray","getWidth","getHeight","setWidth","setHeight","getPointArray","createByUint32","uint32Array","toUint8Array","naturalWidth","naturalHeight","canvas","drawImage","fromHTMLCanvasElement","getImageData","fromImageData","fromUint8Array","container","BYTES_PER_ELEMENT","hueGroup","hue","segmentsNumber","seg","Palette","_pointContainer","getNearestColor","colorDistanceCalculator","_getNearestIndex","getPointContainer","_nearestPointFromCache","_i32idx","minimalDistance","MAX_VALUE","hslA","hslB","hueA","hueDiff","lA","lB","satDiff","HueStatistics","ProgressTracker","arithmetic","HueGroup","numGroups","minCols","_numGroups","_minCols","_stats","_groupsFull","hg","gr","cols","injectIntoDictionary","histG","injectIntoArray","_ProgressTracker","valueRange","progressRange","_range","_progressRange","_step","steps","_last","progress","shouldNotify","Neuron","defaultValue","toPoint","createByRGBA","subtract","_NeuQuant","_distance","_sampleFactor","_networkSize","pointContainer","_learn","_buildPalette","_freq","_bias","_radPower","_network","networkBiasShift","_initialBias","sampleFactor","pointsNumber","_minpicturebytes","alphadec","pointsToSample","_nCycles","_initAlpha","radius","_radiusBias","rad","_radiusBiasShift","_radBias","_prime1","_prime2","_prime3","_prime4","tracker","pointIndex","neuronIndex","_contest","_alterSingle","_alterNeighbour","_radiusDecrease","neuron","_alphaRadBias","bestd","bestbiasd","bestpos","bestbiaspos","biasdist","_initialBiasShift","betafreq","_betaShift","_gammaShift","_beta","_betaGamma","_alphaBiasShift","_radBiasShift","_alphaRadBiasShift","NeuronFloat","_NeuQuantFloat","networkBiasShift2","_ColorHistogram","_method","_minHueCols","_initColors","_hueStats","_hueGroups","_histogram","_colorStats1D","_colorStats2D","getImportanceSortedColorsIDXI32","idxi32","initialColorsLimit","freq","pointArray","boxW","_boxSize","boxH","boxes","_makeBoxes","box","effc","_boxPixels","histL","_iterateBox","bbox","wid","i1","stepX","stepY","wrem","hrem","xend","yend","boxesArray","RemovedColor","_colors","_initialDistance","_distanceIncrement","colorArray","usageArray","memDist","palLen","thold","pxi","pxj","colorIndex","createArray1D","dimension1","createArray4D","dimension2","dimension3","dimension4","createArray3D","fillArray3D","fillArray1D","_WuQuant","significantBitsPerChannel","_setQuality","_initialize","_addColor","_pixels","_preparePalette","paletteIndex","_sums","_reds","_greens","_blues","_alphas","_calculateMoments","volumeVariance","cubeIndex","_cut","_cubes","volume","_calculateVariance","lookupRed","lookupGreen","lookupBlue","lookupAlpha","weight","_volume","_weights","_momentsRed","_momentsGreen","_momentsBlue","_momentsAlpha","bestMatch","bestDistance","foundRed","foundGreen","foundBlue","foundAlpha","bitsToRemove","_significantBitsPerChannel","indexRed","indexGreen","indexBlue","indexAlpha","_moments","_table","areaRed","areaGreen","areaBlue","areaAlpha","area2","xarea","_sideSize","xareaRed","xareaGreen","xareaBlue","xareaAlpha","xarea2","trackerProgress","_alphaMaxSideIndex","_maxSideIndex","alphaIndex","redIndex","greenIndex","lineRed","lineGreen","lineBlue","lineAlpha","line2","blueIndex","cube","moment","alphaMaximum","redMaximum","greenMaximum","blueMaximum","greenMinimum","redMinimum","alphaMinimum","blueMinimum","_volumeFloat","_alpha","_red","_green","_blue","volumeRed","volumeGreen","volumeBlue","volumeAlpha","_maximize","wholeRed","wholeGreen","wholeBlue","wholeAlpha","wholeWeight","bottomRed","_bottom","bottomGreen","bottomBlue","bottomAlpha","bottomWeight","cutPosition","halfRed","_top","halfGreen","halfBlue","halfAlpha","halfWeight","halfDistance","_alphaSideSize","tableIndex","AbstractImageQuantizer","ErrorDiffusionRiemersma","ErrorDiffusionArrayKernel2","kernel","_setKernel","_minColorDistance","_serpentine","_calculateErrorLikeGIMP","originalPoint","errorLines","maxErrorLines","_kernel","kernelErrorLines","_fillErrorLine","lni","xStart","xEnd","errorLine","correctedPoint","palettePoint","eg","eb","ea","dStart","dEnd","hilbertCurve","maxBound","walkHilbert","visit","errorQueueSize","errorPropagation","_errorQueueSize","_createWeights","errorQueue","quantizedPoint","weights","multiplier","ssim","K1","K2","image1","image2","numWindows","mssim","windowWidth","windowHeight","lumaValues1","calculateLumaValuesForWindow","lumaValues2","calculateAverageLuma","iterate","averageLumaValue1","averageLumaValue2","sigxy","sigsqx","sigsqy","numPixelsInWin","lumaValues","counter","sumLuma","luma","setImmediateImpl","colorDistanceFormula","paletteQuantization","paletteQuantizer","paletteQuantizationToPaletteQuantizer","colorDistanceFormulaToColorDistance","onProgress","imageQuantization","imageQuantizationToImageQuantizer","outPointContainer","distanceCalculator","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","__esModule","definition","isNodePattern","throwError","_y","_x","trimLeft","trimRight","tinycolor","named","names","matchers","exec","hsl","hsla","hsv","hsva","hex8","parseIntFromHex","convertHexToDecimal","hex6","hex4","hex3","stringInputToObject","isValidCSSUnit","bound01","convertToPercentage","mod","hsvToRgb","hue2rgb","hslToRgb","boundAlpha","inputToRGB","_originalInput","_r","_g","_b","_a","_roundA","_gradientType","gradientType","_ok","rgbToHsl","rgbToHsv","rgbToHex","allow3Char","hex","pad2","rgbaToArgbHex","convertDecimalToHex","_desaturate","toHsl","clamp01","_saturate","_greyscale","desaturate","_lighten","_brighten","toRgb","_darken","_spin","_complement","polyad","_splitcomplement","_analogous","results","slices","part","_monochromatic","toHsv","modification","isDark","getBrightness","isLight","getOriginalInput","getFormat","getAlpha","getLuminance","RsRGB","GsRGB","BsRGB","setAlpha","toHsvString","toHslString","toHex","toHexString","toHex8","allow4Char","rgbaToHex","toHex8String","toRgbString","toPercentageRgb","toPercentageRgbString","toName","hexNames","toFilter","secondColor","hex8String","secondHex8String","formatSet","formattedString","hasAlpha","_applyModification","lighten","brighten","darken","saturate","spin","_applyCombination","analogous","complement","monochromatic","splitcomplement","triad","tetrad","fromRatio","newColor","color1","color2","random","mix","rgb1","rgb2","readability","isReadable","wcag2","wcag2Parms","parms","mostReadable","baseColor","colorList","includeFallbackColors","bestColor","bestScore","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","blanchedalmond","blueviolet","brown","burlywood","burntsienna","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","whitesmoke","yellow","yellowgreen","flipped","flip","isOnePointZero","processPercent","isPercentage","CSS_UNIT","PERMISSIVE_MATCH3","PERMISSIVE_MATCH4","ImagePHash","smallerSize","initCoefficients","intToRGBA","getHash","resize","vals","getPixelColor","dctVals","applyDCT","avg","_ref","AUTO","HORIZONTAL_ALIGN_LEFT","HORIZONTAL_ALIGN_CENTER","HORIZONTAL_ALIGN_RIGHT","VERTICAL_ALIGN_TOP","VERTICAL_ALIGN_MIDDLE","VERTICAL_ALIGN_BOTTOM","BLEND_SOURCE_OVER","BLEND_DESTINATION_OVER","BLEND_MULTIPLY","BLEND_ADD","BLEND_SCREEN","BLEND_OVERLAY","BLEND_DARKEN","BLEND_LIGHTEN","BLEND_HARDLIGHT","BLEND_DIFFERENCE","BLEND_EXCLUSION","EDGE_EXTEND","EDGE_WRAP","EDGE_CROP","srcOver","ops","dstOver","multiply","sra","sga","sba","dra","dga","dba","screen","overlay","hardLight","difference","exclusion","addType","getType","pathParts","extension","find","getExifOrientation","_exif","Orientation","parseBitmap","fileTypeFromBuffer","getMIMEFromBuffer","_originalMime","getMIME","decoders","transformation","getExifOrientationTransformation","swapDimensions","_data","_idx","transformBitmap","exifRotate","_rgba","Jimp","_background","composite","compositeBitmapOverBackground","encoders","getBufferAsync","hint","prim","_toPrimitive","_toPropertyKey","alphabet","maxHashLength","maxHash","bufferFromArrayBuffer","loadFromURL","emptyBitmap","MIME_PNG","getBase64","setPixelColor","jimpInstance","_len2","_key2","methodName","emitMulti","cssColorToHex","_quality","_deflateLevel","_deflateStrategy","_filterType","rgbaBuffer","makeRGBABufferFromRGB","loadBufferFromPath","extraConstructor","__extraConstructors","bool","eventName","getExtension","pathObj","recursive","pHash","distanceFromHash","compareHash","currentHash","getPixelIndex","edgeHandling","xi","yi","byteLen","scanIterator","addConstants","addJimpMethods","_ref2","jimpEvMethod","evName","evNameBefore","evNameAfter","wrappedCb","_len4","_key4","_len5","_key5","jimpEvChange","opacitySource","opacityDest","blendmode","baseImage","opacity","scanQuiet","sx","sy","dstIdx","blended","limit255","appendConstructorOption","rgbaToInt","cssColor","bmp1","bmp2","cloneQuiet","percent","phash","hash1","hash2","compareHashes","colorDiff","rgba1","rgba2","gl","MIME_TYPE","MIME_JPEG","class","PNG_FILTER_AUTO","PNG_FILTER_NONE","PNG_FILTER_SUB","PNG_FILTER_UP","PNG_FILTER_AVERAGE","PNG_FILTER_PATH","MIME_TYPE_SECOND","fromAGBR","toAGBR","mulTable","shgTable","applyKernel","im","kx","ky","isDef","clr2","colorFn","actions","action","colorModifier","LIGHTEN","BRIGHTEN","DARKEN","DESATURATE","SATURATE","GREYSCALE","SPIN","HUE","MIX","TINT","SHADE","XOR","RED","GREEN","BLUE","rgb565Matrix","flipFn","horizontal","vertical","getBounds","histogramChannel","findIndex","reverse","measureText","font","kerning","splitLines","words","currentLine","longestLine","word","measureTextHeight","drawCharacter","characterPage","printText","defaultCharWidth","fontChar","fontKerning","Resize","widthOriginal","heightOriginal","targetWidth","targetHeight","blendAlpha","interpolationPass","resizeCallback","colorChannels","targetWidthMultipliedByChannels","originalWidthMultipliedByChannels","originalHeightMultipliedByChannels","widthPassResultSize","finalResultSize","initialize","configurePasses","resizeWidth","bypassResizer","ratioWeightWidthPass","initializeFirstPassBuffers","resizeWidthInterpolatedRGBA","resizeWidthInterpolatedRGB","resizeWidthRGBA","resizeWidthRGB","resizeHeight","ratioWeightHeightPass","initializeSecondPassBuffers","resizeHeightInterpolated","resizeHeightRGBA","resizeHeightRGB","_resizeWidthInterpolatedRGBChannels","fourthChannel","channelsNum","ratioWeight","outputBuffer","widthBuffer","targetPosition","interpolationWidthSourceReadStop","finalOffset","pixelOffset","firstWeight","secondWeight","_resizeWidthRGBChannels","ratioWeightDivisor","nextLineOffsetOriginalWidth","nextLineOffsetTargetWidth","outputWidthWorkBench","trustworthyColorsCount","outputWidthWorkBenchOpaquePixelsCount","amountToNext","actualPosition","currentPosition","outputOffset","_resizeHeightRGBChannels","outputHeightWorkBench","heightBuffer","outputHeightWorkBenchOpaquePixelsCount","caret","interpolationHeightSourceReadStop","pixelOffsetAccumulated","pixelOffsetAccumulated2","BILINEARAlgo","generateFloatBuffer","generateFloat64Buffer","generateUint8Buffer","operations","nearestNeighbor","wSrc","hSrc","wDst","hDst","bufSrc","bufDst","posDst","posSrc","bilinearInterpolation","interpolate","kMin","vMin","kMax","vMax","xMin","xMax","yMin","yMax","posMin","posMax","_interpolate2D","wM","wDst2","hM","hDst2","buf1","xPos","srcPos","buf1Pos","kPos","x3","buf2","yPos","buf2Pos","y3","realColors","xyPos","pixelAlpha","bicubicInterpolation","hermiteInterpolation","c0","c3","bezierInterpolation","nt","matrixRotate","deg","angle","nW","nH","dstBuffer","createIdxTranslationFunction","srcIdxFunction","dstIdxFunction","srcIdx","pixelRGBA","advancedRotate","cosine","sine","bW","bH","createTranslationFunction","translate2Cartesian","translate2Screen","cartesian","crop","plugins","srcx","srcy","srcw","srch","blur","rsum","gsum","bsum","asum","p1","p2","yp","yw","pa","wm","hm","rad1","mulSum","shgSum","vmin","vmax","iterations","circle","center","curR","brightness","contrast","adjust","posterize","sepia","fade","convolution","newData","kRows","kCols","rowEnd","colEnd","rowIni","colIni","rSum","gSum","bSum","gi","idxi","opaque","pixelate","xx","yx","convolute","colour","contain","alignBits","hbits","alignH","alignV","cover","autocrop","leaveBorder","tolerance","cropOnlyFrames","cropSymmetric","ignoreSides","north","south","east","west","colorTarget","northPixelsToCrop","eastPixelsToCrop","southPixelsToCrop","westPixelsToCrop","colorXY","doCrop","widthOfRemainingPixels","heightOfRemainingPixels","displace","displacement","ids","dither565","dither16","fisheye","hx","hy","rn","cosA","sinA","mirror","gaussian","range","rr2","rr2pi","dsq","wsum","iy","ix","invert","destX","destY","bounds","FONT_SANS_8_BLACK","FONT_SANS_10_BLACK","FONT_SANS_12_BLACK","FONT_SANS_14_BLACK","FONT_SANS_16_BLACK","FONT_SANS_32_BLACK","FONT_SANS_64_BLACK","FONT_SANS_128_BLACK","FONT_SANS_8_WHITE","FONT_SANS_16_WHITE","FONT_SANS_32_WHITE","FONT_SANS_64_WHITE","FONT_SANS_128_WHITE","loadFont","firstString","newPages","loadPages","print","alignmentX","alignmentY","lineString","alignmentWidth","alignment","xOffsetBasedOnAlignment","RESIZE_NEAREST_NEIGHBOR","RESIZE_BILINEAR","RESIZE_BICUBIC","RESIZE_HERMITE","RESIZE_BEZIER","rotate","scaleToFit","shadow","orig","autoGreyscale","configuration","jimpConfig","addToConfig","newConfig","typeModule","mimeType","pluginModule","plugin","MIME_BMP","MIME_X_MS_BMP","MIME_TIFF","t256","t257","tiff","MIME_GIF","gifObj","gifData","newFrame","newGif","initializedPlugins"],"sourceRoot":""} \ No newline at end of file diff --git a/project starter code/node_modules/jimp/browser/lib/jimp.min.js b/project starter code/node_modules/jimp/browser/lib/jimp.min.js deleted file mode 100644 index 4dfdd1e2..00000000 --- a/project starter code/node_modules/jimp/browser/lib/jimp.min.js +++ /dev/null @@ -1,27 +0,0 @@ -/* -Jimp v0.16.1 -https://github.com/oliver-moran/jimp -Ported for the Web by Phil Seaton -MIT License - -Copyright (c) 2018 Oliver Moran - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ -undefined \ No newline at end of file diff --git a/project starter code/node_modules/jimp/dist/index.js b/project starter code/node_modules/jimp/dist/index.js index 1210d813..890054ea 100644 --- a/project starter code/node_modules/jimp/dist/index.js +++ b/project starter code/node_modules/jimp/dist/index.js @@ -1,23 +1,18 @@ "use strict"; -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - Object.defineProperty(exports, "__esModule", { value: true }); -exports["default"] = void 0; - +exports.default = void 0; var _custom = _interopRequireDefault(require("@jimp/custom")); - var _types = _interopRequireDefault(require("@jimp/types")); - var _plugins = _interopRequireDefault(require("@jimp/plugins")); - -var _default = (0, _custom["default"])({ - types: [_types["default"]], - plugins: [_plugins["default"]] +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _default = (0, _custom.default)({ + types: [_types.default], + plugins: [_plugins.default] }); - -exports["default"] = _default; +exports.default = _default; module.exports = exports.default; +module.exports.default = exports.default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/jimp/dist/index.js.map b/project starter code/node_modules/jimp/dist/index.js.map index 4a23c7a9..f84f0ff1 100644 --- a/project starter code/node_modules/jimp/dist/index.js.map +++ b/project starter code/node_modules/jimp/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["types","plugins"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;eAEe,wBAAU;AACvBA,EAAAA,KAAK,EAAE,CAACA,iBAAD,CADgB;AAEvBC,EAAAA,OAAO,EAAE,CAACA,mBAAD;AAFc,CAAV,C","sourcesContent":["import configure from '@jimp/custom';\n\nimport types from '@jimp/types';\nimport plugins from '@jimp/plugins';\n\nexport default configure({\n types: [types],\n plugins: [plugins]\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["configure","types","plugins"],"sources":["../src/index.js"],"sourcesContent":["import configure from \"@jimp/custom\";\n\nimport types from \"@jimp/types\";\nimport plugins from \"@jimp/plugins\";\n\nexport default configure({\n types: [types],\n plugins: [plugins],\n});\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AAAoC;AAAA,eAErB,IAAAA,eAAS,EAAC;EACvBC,KAAK,EAAE,CAACA,cAAK,CAAC;EACdC,OAAO,EAAE,CAACA,gBAAO;AACnB,CAAC,CAAC;AAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/project starter code/node_modules/jimp/es/index.js b/project starter code/node_modules/jimp/es/index.js index 62e78be0..f14cf14a 100644 --- a/project starter code/node_modules/jimp/es/index.js +++ b/project starter code/node_modules/jimp/es/index.js @@ -1,22 +1,8 @@ -"use strict"; - -var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); - -Object.defineProperty(exports, "__esModule", { - value: true +import configure from "@jimp/custom"; +import types from "@jimp/types"; +import plugins from "@jimp/plugins"; +export default configure({ + types: [types], + plugins: [plugins] }); -exports["default"] = void 0; - -var _custom = _interopRequireDefault(require("@jimp/custom")); - -var _types = _interopRequireDefault(require("@jimp/types")); - -var _plugins = _interopRequireDefault(require("@jimp/plugins")); - -var _default = (0, _custom["default"])({ - types: [_types["default"]], - plugins: [_plugins["default"]] -}); - -exports["default"] = _default; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/jimp/es/index.js.map b/project starter code/node_modules/jimp/es/index.js.map index 4a23c7a9..7f9aa10a 100644 --- a/project starter code/node_modules/jimp/es/index.js.map +++ b/project starter code/node_modules/jimp/es/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/index.js"],"names":["types","plugins"],"mappings":";;;;;;;;;AAAA;;AAEA;;AACA;;eAEe,wBAAU;AACvBA,EAAAA,KAAK,EAAE,CAACA,iBAAD,CADgB;AAEvBC,EAAAA,OAAO,EAAE,CAACA,mBAAD;AAFc,CAAV,C","sourcesContent":["import configure from '@jimp/custom';\n\nimport types from '@jimp/types';\nimport plugins from '@jimp/plugins';\n\nexport default configure({\n types: [types],\n plugins: [plugins]\n});\n"],"file":"index.js"} \ No newline at end of file +{"version":3,"file":"index.js","names":["configure","types","plugins"],"sources":["../src/index.js"],"sourcesContent":["import configure from \"@jimp/custom\";\n\nimport types from \"@jimp/types\";\nimport plugins from \"@jimp/plugins\";\n\nexport default configure({\n types: [types],\n plugins: [plugins],\n});\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,cAAc;AAEpC,OAAOC,KAAK,MAAM,aAAa;AAC/B,OAAOC,OAAO,MAAM,eAAe;AAEnC,eAAeF,SAAS,CAAC;EACvBC,KAAK,EAAE,CAACA,KAAK,CAAC;EACdC,OAAO,EAAE,CAACA,OAAO;AACnB,CAAC,CAAC"} \ No newline at end of file diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt index 6175b9cb..2bb22b19 100644 --- a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt +++ b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt @@ -4,7 +4,8 @@ - + + @@ -193,7 +194,7 @@ - + diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-black/open-sans-128-black.png b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-black/open-sans-128-black.png index 77cd5ed6..7e9986e2 100644 Binary files a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-black/open-sans-128-black.png and b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-black/open-sans-128-black.png differ diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt index 9c89b440..5e8811e6 100644 --- a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt +++ b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt @@ -4,7 +4,8 @@ - + + @@ -193,7 +194,7 @@ - + diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-white/open-sans-128-white.png b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-white/open-sans-128-white.png index 461af9a0..64b949b1 100644 Binary files a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-white/open-sans-128-white.png and b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-128-white/open-sans-128-white.png differ diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt index 602a3a4e..afb29970 100644 --- a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt +++ b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt @@ -1,10 +1,11 @@ - + - + + @@ -193,7 +194,7 @@ - + diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-black/open-sans-16-black.png b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-black/open-sans-16-black.png index 4f7e287b..99171bea 100644 Binary files a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-black/open-sans-16-black.png and b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-black/open-sans-16-black.png differ diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt index c78ccdce..2b6cbe79 100644 --- a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt +++ b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt @@ -1,10 +1,11 @@ - + - + + @@ -193,7 +194,7 @@ - + diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-white/open-sans-16-white.png b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-white/open-sans-16-white.png index 039206cf..ccb1e3c9 100644 Binary files a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-white/open-sans-16-white.png and b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-16-white/open-sans-16-white.png differ diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt index 3733597b..f2d9bf4a 100644 --- a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt +++ b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt @@ -1,10 +1,11 @@ - + - + + @@ -193,7 +194,7 @@ - + diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-black/open-sans-32-black.png b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-black/open-sans-32-black.png index a064a112..50ff1b41 100644 Binary files a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-black/open-sans-32-black.png and b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-black/open-sans-32-black.png differ diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt index 6b51c7c0..35c3584d 100644 --- a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt +++ b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt @@ -1,10 +1,11 @@ - + - + + @@ -193,7 +194,7 @@ - + diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-white/open-sans-32-white.png b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-white/open-sans-32-white.png index 4ecce3e5..5900c354 100644 Binary files a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-white/open-sans-32-white.png and b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-32-white/open-sans-32-white.png differ diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt index 500c923e..f4580f3c 100644 --- a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt +++ b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt @@ -4,7 +4,8 @@ - + + @@ -193,7 +194,7 @@ - + diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-black/open-sans-64-black.png b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-black/open-sans-64-black.png index 25fe95fe..47af5238 100644 Binary files a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-black/open-sans-64-black.png and b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-black/open-sans-64-black.png differ diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt index 19a72453..dca72ad3 100644 --- a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt +++ b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt @@ -4,7 +4,8 @@ - + + @@ -193,7 +194,7 @@ - + diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-white/open-sans-64-white.png b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-white/open-sans-64-white.png index 1baf1f50..de9a88aa 100644 Binary files a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-white/open-sans-64-white.png and b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-64-white/open-sans-64-white.png differ diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt index 15b6be3a..34f0e621 100644 --- a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt +++ b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt @@ -1,10 +1,11 @@ - + - + + @@ -193,7 +194,7 @@ - + diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-black/open-sans-8-black.png b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-black/open-sans-8-black.png index 71a55514..b0579858 100644 Binary files a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-black/open-sans-8-black.png and b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-black/open-sans-8-black.png differ diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt index 3264cc42..6d437678 100644 --- a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt +++ b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt @@ -4,7 +4,8 @@ - + + @@ -193,7 +194,7 @@ - + diff --git a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-white/open-sans-8-white.png b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-white/open-sans-8-white.png index ed1eb48b..435f6d5e 100644 Binary files a/project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-white/open-sans-8-white.png and b/project starter code/node_modules/jimp/fonts/open-sans/open-sans-8-white/open-sans-8-white.png differ diff --git a/project starter code/node_modules/jimp/package.json b/project starter code/node_modules/jimp/package.json index de08b048..e648e3ce 100644 --- a/project starter code/node_modules/jimp/package.json +++ b/project starter code/node_modules/jimp/package.json @@ -1,17 +1,11 @@ { "name": "jimp", - "version": "0.16.2", + "version": "0.22.12", "description": "An image processing library written entirely in JavaScript (i.e. zero external or native dependencies)", "main": "dist/index.js", "module": "es/index.js", "types": "types/index.d.ts", - "typesVersions": { - ">=3.1.0-0": { - "*": [ - "types/ts3.1/index.d.ts" - ] - } - }, + "browser": "browser/lib/jimp.js", "tonicExampleFilename": "example.js", "files": [ "browser", @@ -21,18 +15,11 @@ "fonts", "types" ], - "repository": { - "type": "git", - "url": "https://github.com/oliver-moran/jimp.git" - }, - "bugs": { - "url": "https://github.com/oliver-moran/jimp/issues" - }, + "repository": "jimp-dev/jimp", "scripts": { - "test": "cross-env BABEL_ENV=test mocha --require @babel/register", + "test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive test --extension js", "test:watch": "npm run test -- --reporter min --watch", "test:coverage": "nyc npm run test", - "browser-build": "node tools/browser-build.js test", "build": "npm run build:browser && npm run build:node:production && npm run build:module", "build:watch": "npm run build:node:debug -- -- --watch --verbose", "build:debug": "npm run build:browser:debug && npm run build:node:debug", @@ -40,8 +27,8 @@ "build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js", "build:node:debug": "cross-env BABEL_ENV=development npm run build:node", "build:node:production": "cross-env BABEL_ENV=production npm run build:node", - "build:browser": "cross-env BABEL_ENV=production node tools/browser-build.js prepublish", - "build:browser:debug": "cross-env BABEL_ENV=development ENV=browser node tools/browser-build.js prepublish" + "build:browser": "cross-env NODE_ENV=production webpack", + "build:browser:debug": "cross-env NODE_ENV=development ENV=browser webpack" }, "keywords": [ "image", @@ -58,50 +45,19 @@ "author": "Oliver Moran ", "license": "MIT", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/custom": "^0.16.2", - "@jimp/plugins": "^0.16.2", - "@jimp/types": "^0.16.2", + "@jimp/custom": "^0.22.12", + "@jimp/plugins": "^0.22.12", + "@jimp/types": "^0.22.12", "regenerator-runtime": "^0.13.3" }, "devDependencies": { - "@babel/cli": "^7.7.0", - "@babel/core": "^7.7.2", - "@babel/plugin-proposal-class-properties": "^7.7.0", - "@babel/plugin-syntax-object-rest-spread": "^7.2.0", - "@babel/preset-env": "^7.7.1", - "@babel/register": "^7.7.0", - "@jimp/test-utils": "^0.16.2", - "babel-eslint": "^10.0.3", - "babel-plugin-add-module-exports": "^1.0.2", - "babel-plugin-istanbul": "^5.2.0", - "babel-plugin-source-map-support": "^2.1.1", - "babelify": "^10.0.0", - "browserify": "^16.5.0", - "cross-env": "^6.0.0", - "dtslint": "^0.9.8", - "envify": "^4.1.0", - "eslint": "^6.4.0", - "eslint-plugin-prettier": "^3.1.1", + "@jimp/test-utils": "^0.22.12", + "empty-module": "^0.0.2", "express": "^4.17.1", - "husky": "^3.0.5", - "karma": "^4.3.0", - "karma-browserify": "^6.1.0", - "karma-chrome-launcher": "^3.1.0", - "karma-firefox-launcher": "^1.2.0", - "lerna": "^3.16.4", - "lerna-changelog": "^0.8.2", - "lint-staged": "^9.2.5", - "mocha": "^6.2.0", - "nyc": "^14.1.1", - "prettier": "^1.18.2", - "source-map-support": "^0.5.13", - "tfilter": "^1.0.1", - "uglify-js": "^3.6.0", - "watchify": "^3.11.1", - "xo": "^0.24.0" + "path-browserify": "^1.0.1", + "webpack": "^5.75.0", + "webpack-cli": "^5.0.1" }, - "xo": false, "nyc": { "sourceMap": false, "instrument": false, @@ -116,5 +72,5 @@ "test/*.js" ] }, - "gitHead": "e4d6af032fdabdb4b8a4368ec957dec8ea426ef4" + "gitHead": "a4a8d6364bbf97629749e196f3b0a4c94c9a7abc" } diff --git a/project starter code/node_modules/jimp/types/index.d.ts b/project starter code/node_modules/jimp/types/index.d.ts index 88687bdf..5647fb12 100644 --- a/project starter code/node_modules/jimp/types/index.d.ts +++ b/project starter code/node_modules/jimp/types/index.d.ts @@ -1,600 +1,53 @@ -// TypeScript Version: 2.8 - - -declare const DepreciatedJimp: DepreciatedJimp; - -export = DepreciatedJimp; - -/** - * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version - */ -interface DepreciatedJimp { - // Constructors - new(path: string, cb?: ImageCallback): this; - new(urlOptions: URLOptions, cb?: ImageCallback): this; - new(image: DepreciatedJimp, cb?: ImageCallback): this; - new(data: Buffer | Bitmap, cb?: ImageCallback): this; - new(w: number, h: number, cb?: ImageCallback): this; - new( - w: number, - h: number, - background?: number | string, - cb?: ImageCallback - ): this; - // For custom constructors when using Jimp.appendConstructorOption - new(...args: any[]): this; - prototype: this; - - // Constants - AUTO: -1; - - // supported mime types - MIME_PNG: 'image/png'; - MIME_TIFF: 'image/tiff'; - MIME_JPEG: 'image/jpeg'; - MIME_JGD: 'image/jgd'; - MIME_BMP: 'image/bmp'; - MIME_X_MS_BMP: 'image/x-ms-bmp'; - MIME_GIF: 'image/gif'; - // PNG filter types - PNG_FILTER_AUTO: -1; - PNG_FILTER_NONE: 0; - PNG_FILTER_SUB: 1; - PNG_FILTER_UP: 2; - PNG_FILTER_AVERAGE: 3; - PNG_FILTER_PATH: 4; - - // resize methods - RESIZE_NEAREST_NEIGHBOR: 'nearestNeighbor'; - RESIZE_BILINEAR: 'bilinearInterpolation'; - RESIZE_BICUBIC: 'bicubicInterpolation'; - RESIZE_HERMITE: 'hermiteInterpolation'; - RESIZE_BEZIER: 'bezierInterpolation'; - - // blend modes - BLEND_SOURCE_OVER: string; - BLEND_DESTINATION_OVER: string; - BLEND_MULTIPLY: string; - BLEND_SCREEN: string; - BLEND_OVERLAY: string; - BLEND_DARKEN: string; - BLEND_LIGHTEN: string; - BLEND_HARDLIGHT: string; - BLEND_DIFFERENCE: string; - BLEND_EXCLUSION: string; - - // Align modes for cover, contain, bit masks - HORIZONTAL_ALIGN_LEFT: 1; - HORIZONTAL_ALIGN_CENTER: 2; - HORIZONTAL_ALIGN_RIGHT: 4; - - VERTICAL_ALIGN_TOP: 8; - VERTICAL_ALIGN_MIDDLE: 16; - VERTICAL_ALIGN_BOTTOM: 32; - - // Font locations - FONT_SANS_8_BLACK: string; - FONT_SANS_10_BLACK: string; - FONT_SANS_12_BLACK: string; - FONT_SANS_14_BLACK: string; - FONT_SANS_16_BLACK: string; - FONT_SANS_32_BLACK: string; - FONT_SANS_64_BLACK: string; - FONT_SANS_128_BLACK: string; - - FONT_SANS_8_WHITE: string; - FONT_SANS_16_WHITE: string; - FONT_SANS_32_WHITE: string; - FONT_SANS_64_WHITE: string; - FONT_SANS_128_WHITE: string; - - // Edge Handling - EDGE_EXTEND: 1; - EDGE_WRAP: 2; - EDGE_CROP: 3; - - // Properties - bitmap: Bitmap; - - _quality: number; - _deflateLevel: number; - _deflateStrategy: number; - _filterType: number; - _rgba: boolean; - _background: number; - _originalMime: string; - - // Methods - on( - event: T, - cb: (data: ListenerData) => any - ): any; - parseBitmap( - data: Buffer, - path: string | null | undefined, - cb?: ImageCallback - ): void; - hasAlpha(): boolean; - getHeight(): number; - getWidth(): number; - inspect(): string; - toString(): string; - getMIME(): string; - getExtension(): string; - distanceFromHash(hash: string): number; - write(path: string, cb?: ImageCallback): this; - writeAsync(path: string): Promise; - deflateLevel(l: number, cb?: ImageCallback): this; - deflateStrategy(s: number, cb?: ImageCallback): this; - colorType(s: number, cb?: ImageCallback): this; - filterType(f: number, cb?: ImageCallback): this; - rgba(bool: boolean, cb?: ImageCallback): this; - quality(n: number, cb?: ImageCallback): this; - getBase64(mime: string, cb: GenericCallback): this; - getBase64Async(mime: string): Promise; - hash(cb?: GenericCallback): string; - hash( - base: number | null | undefined, - cb?: GenericCallback - ): string; - getBuffer(mime: string, cb: GenericCallback): this; - getBufferAsync(mime: string): Promise; - getPixelIndex( - x: number, - y: number, - cb?: GenericCallback - ): number; - getPixelIndex( - x: number, - y: number, - edgeHandling: string, - cb?: GenericCallback - ): number; - getPixelColor( - x: number, - y: number, - cb?: GenericCallback - ): number; - getPixelColour( - x: number, - y: number, - cb?: GenericCallback - ): number; - setPixelColor(hex: number, x: number, y: number, cb?: ImageCallback): this; - setPixelColour(hex: number, x: number, y: number, cb?: ImageCallback): this; - clone(cb?: ImageCallback): this; - cloneQuiet(cb?: ImageCallback): this; - background(hex: number, cb?: ImageCallback): this; - backgroundQuiet(hex: number, cb?: ImageCallback): this; - scan( - x: number, - y: number, - w: number, - h: number, - f: (this: this, x: number, y: number, idx: number) => any, - cb?: ImageCallback - ): this; - scanQuiet( - x: number, - y: number, - w: number, - h: number, - f: (this: this, x: number, y: number, idx: number) => any, - cb?: ImageCallback - ): this; - scanIterator( - x: number, - y: number, - w: number, - h: number - ): IterableIterator<{ x: number; y: number; idx: number; image: DepreciatedJimp }>; - crop(x: number, y: number, w: number, h: number, cb?: ImageCallback): this; - cropQuiet( - x: number, - y: number, - w: number, - h: number, - cb?: ImageCallback - ): this; - - // Color methods - brightness(val: number, cb?: ImageCallback): this; - contrast(val: number, cb?: ImageCallback): this; - posterize(n: number, cb?: ImageCallback): this; - greyscale(cb?: ImageCallback): this; - grayscale(cb?: ImageCallback): this; - opacity(f: number, cb?: ImageCallback): this; - sepia(cb?: ImageCallback): this; - fade(f: number, cb?: ImageCallback): this; - convolution(kernel: number[][], cb?: ImageCallback): this; - convolution( - kernel: number[][], - edgeHandling: string, - cb?: ImageCallback - ): this; - opaque(cb?: ImageCallback): this; - pixelate(size: number, cb?: ImageCallback): this; - pixelate( - size: number, - x: number, - y: number, - w: number, - h: number, - cb?: ImageCallback - ): this; - convolute(kernel: number[][], cb?: ImageCallback): this; - convolute( - kernel: number[][], - x: number, - y: number, - w: number, - h: number, - cb?: ImageCallback - ): this; - color(actions: ColorAction[], cb?: ImageCallback): this; - colour(actions: ColorAction[], cb?: ImageCallback): this; - - // Shape methods - rotate(deg: number, cb?: ImageCallback): this; - rotate(deg: number, mode: string | boolean, cb?: ImageCallback): this; - flip(horizontal: boolean, vertical: boolean, cb?: ImageCallback): this; - mirror(horizontal: boolean, vertical: boolean, cb?: ImageCallback): this; - resize(w: number, h: number, cb?: ImageCallback): this; - resize(w: number, h: number, mode?: string, cb?: ImageCallback): this; - cover(w: number, h: number, cb?: ImageCallback): this; - cover(w: number, h: number, alignBits?: number, cb?: ImageCallback): this; - cover( - w: number, - h: number, - alignBits?: number, - mode?: string, - cb?: ImageCallback - ): this; - contain(w: number, h: number, cb?: ImageCallback): this; - contain(w: number, h: number, mode?: string, cb?: ImageCallback): this; - contain(w: number, h: number, alignBits?: number, cb?: ImageCallback): this; - contain( - w: number, - h: number, - alignBits?: number, - mode?: string, - cb?: ImageCallback - ): this; - scale(f: number, cb?: ImageCallback): this; - scale(f: number, mode?: string, cb?: ImageCallback): this; - scaleToFit(w: number, h: number, cb?: ImageCallback): this; - scaleToFit(w: number, h: number, mode?: string, cb?: ImageCallback): this; - displace(map: DepreciatedJimp, offset: number, cb?: ImageCallback): this; - autocrop(tolerance?: number, cb?: ImageCallback): this; - autocrop(cropOnlyFrames?: boolean, cb?: ImageCallback): this; - autocrop( - tolerance?: number, - cropOnlyFrames?: boolean, - cb?: ImageCallback - ): this; - autocrop( - options: { - tolerance?: number; - cropOnlyFrames?: boolean; - cropSymmetric?: boolean; - leaveBorder?: number; - }, - cb?: ImageCallback - ): this; - - // Text methods - print( - font: Font, - x: number, - y: number, - text: PrintableText, - cb?: ImageCallback - ): this; - print( - font: Font, - x: number, - y: number, - text: PrintableText, - maxWidth?: number, - cb?: ImageCallback - ): this; - print( - font: Font, - x: number, - y: number, - text: PrintableText, - maxWidth?: number, - maxHeight?: number, - cb?: ImageCallback - ): this; - - // Effect methods - blur(r: number, cb?: ImageCallback): this; - dither565(cb?: ImageCallback): this; - dither16(cb?: ImageCallback): this; - histogram(): { - r: number[]; - g: number[]; - b: number[]; - }; - normalize(cb?: ImageCallback): this; - invert(cb?: ImageCallback): this; - gaussian(r: number, cb?: ImageCallback): this; - composite( - src: DepreciatedJimp, - x: number, - y: number, - options?: BlendMode, - cb?: ImageCallback - ): this; - blit(src: DepreciatedJimp, x: number, y: number, cb?: ImageCallback): this; - blit( - src: DepreciatedJimp, - x: number, - y: number, - srcx: number, - srcy: number, - srcw: number, - srch: number, - cb?: ImageCallback - ): this; - mask(src: this, x: number, y: number, cb?: ImageCallback): this; - - // Functions - /** - * I'd like to make `Args` generic and used in `run` and `test` but alas, - * it's not possible RN: - * https://github.com/microsoft/TypeScript/issues/26113 - */ - appendConstructorOption( - name: string, - test: (...args: any[]) => boolean, - run: ( - this: this, - resolve: (jimp?: this) => any, - reject: (reason: Error) => any, - ...args: any[] - ) => any - ): void; - read(path: string, cb?: ImageCallback): Promise; - read(image: this, cb?: ImageCallback): Promise; - read(data: Buffer, cb?: ImageCallback): Promise; - read( - w: number, - h: number, - background?: number | string, - cb?: ImageCallback - ): Promise; create(path: string): Promise; - create(image: this): Promise; - create(data: Buffer): Promise; - create(w: number, h: number, background?: number | string): Promise; - rgbaToInt( - r: number, - g: number, - b: number, - a: number, - cb: GenericCallback - ): number; - intToRGBA(i: number, cb?: GenericCallback): RGBA; - cssColorToHex(cssColor: string): number; - limit255(n: number): number; - diff( - img1: this, - img2: this, - threshold?: number - ): { - percent: number; - image: DepreciatedJimp; - }; - distance(img1: this, img2: this): number; - compareHashes(hash1: string, hash2: string): number; - colorDiff(rgba1: RGB, rgba2: RGB): number; - colorDiff(rgba1: RGBA, rgba2: RGBA): number; - loadFont(file: string): Promise; - loadFont(file: string, cb: GenericCallback): Promise; - measureText(font: Font, text: PrintableText): number; - measureTextHeight(font: Font, text: PrintableText, maxWidth: number): number; - circle( - options?: { - radius: number; - x: number; - y: number; - }, - cb?: ImageCallback - ): this; - circle(cb?: ImageCallback): this; - fishEye(opts?: { r: number }, cb?: ImageCallback): this; - fishEye(cb?: ImageCallback): this; - shadow( - options?: { - size?: number; - opacity?: number; - x?: number; - y?: number; - }, - cb?: ImageCallback - ): this; - shadow(cb?: ImageCallback): this; - threshold( - opts: { - max: number; - replace?: number; - autoGreyscale?: boolean; - }, - cb?: ImageCallback - ): this; -} - -type GenericCallback = ( - this: TThis, - err: Error | null, - value: T -) => U; - -type ImageCallback = ( - this: DepreciatedJimp, - err: Error | null, - value: DepreciatedJimp, - coords: { - x: number; - y: number; - } -) => U; - -type ColorActionName = - | 'mix' - | 'tint' - | 'shade' - | 'xor' - | 'red' - | 'green' - | 'blue' - | 'hue'; - -type ColorAction = { - apply: ColorActionName; - params: any; -}; - -type BlendMode = { - mode: string; - opacitySource: number; - opacityDest: number; -}; - -type ChangeName = 'background' | 'scan' | 'crop'; - -type ListenableName = - | 'any' - | 'initialized' - | 'before-change' - | 'changed' - | 'before-clone' - | 'cloned' - | ChangeName; - -type ListenerData = T extends 'any' - ? any - : T extends ChangeName - ? { - eventName: 'before-change' | 'changed'; - methodName: T; - [key: string]: any; - } - : { - eventName: T; - methodName: T extends 'initialized' - ? 'constructor' - : T extends 'before-change' | 'changed' - ? ChangeName - : T extends 'before-clone' | 'cloned' ? 'clone' : any; - }; - -type PrintableText = - | any - | { - text: string; - alignmentX: number; - alignmentY: number; -}; - -type URLOptions = { - url: string; - compression?: boolean; - headers: { - [key: string]: any; +// Minimum TypeScript Version: 3.1 + +/** + * While there is nothing in these typings that prevent it from running in TS 2.8 even, + * due to the complexity of the typings anything lower than TS 3.1 will only see + * Jimp as `any`. In order to test the strict versions of these types in our typing + * test suite, the version has been bumped to 3.1 + */ + +import { + Jimp as JimpType, + Bitmap, + RGB, + RGBA, + UnionToIntersection, + GetPluginVal, + GetPluginConst, + GetPluginEncoders, + GetPluginDecoders, + JimpConstructors, +} from "@jimp/core"; +import typeFn from "@jimp/types"; +import pluginFn from "@jimp/plugins"; + +type Types = ReturnType; +type Plugins = ReturnType; + +type IntersectedPluginTypes = UnionToIntersection< + GetPluginVal | GetPluginVal +>; + +type IntersectedPluginConsts = UnionToIntersection< + GetPluginConst | GetPluginConst +>; + +type IntersectedPluginEncoders = UnionToIntersection< + GetPluginEncoders | GetPluginEncoders +>; + +type IntersectedPluginDecoders = UnionToIntersection< + GetPluginDecoders | GetPluginDecoders +>; + +type Jimp = JimpType & IntersectedPluginTypes; + +declare const Jimp: JimpConstructors & + IntersectedPluginConsts & { + prototype: Jimp; + encoders: IntersectedPluginEncoders; + decoders: IntersectedPluginDecoders; }; -}; - -/** - * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version - */ -interface Bitmap { - data: Buffer; - width: number; - height: number; -} -/** - * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version - */ -interface RGB { - r: number; - g: number; - b: number; -} - -/** - * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version - */ -interface RGBA { - r: number; - g: number; - b: number; - a: number; -} - -/** - * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version - */ -interface FontChar { - id: number; - x: number; - y: number; - width: number; - height: number; - xoffset: number; - yoffset: number; - xadvance: number; - page: number; - chnl: number; -} - -/** - * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version - */ -interface FontInfo { - face: string; - size: number; - bold: number; - italic: number; - charset: string; - unicode: number; - stretchH: number; - smooth: number; - aa: number; - padding: [number, number, number, number]; - spacing: [number, number]; -} -/** - * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version - */ -interface FontCommon { - lineHeight: number; - base: number; - scaleW: number; - scaleH: number; - pages: number; - packed: number; - alphaChnl: number; - redChnl: number; - greenChnl: number; - blueChnl: number; -} - -/** - * @deprecated Jimp typings for TS <3.1 are being depreciated. Please upgrade your TypeScript version - */ -interface Font { - chars: { - [char: string]: FontChar; - }; - kernings: { - [firstString: string]: { - [secondString: string]: number; - }; - }; - pages: string[]; - common: FontCommon; - info: FontInfo; -} +export = Jimp; diff --git a/project starter code/node_modules/jimp/types/test.ts b/project starter code/node_modules/jimp/types/test.ts index 6287d9c0..89e29abb 100644 --- a/project starter code/node_modules/jimp/types/test.ts +++ b/project starter code/node_modules/jimp/types/test.ts @@ -1,12 +1,19 @@ -import * as Jimp from 'jimp'; +import * as Jimp from "jimp"; +import { ColorActionName } from "@jimp/plugin-color"; -const jimpInst: Jimp = new Jimp('test'); +const jimpInst: Jimp = new Jimp("test"); // Main Jimp export should already have all of these already applied -jimpInst.read('Test'); +// $ExpectError +jimpInst.read("Test"); jimpInst.displace(jimpInst, 2); jimpInst.resize(40, 40); -// $ExpectType 0 +jimpInst.displace(jimpInst, 2); +jimpInst.shadow((err, val, coords) => {}); +jimpInst.fishEye({ r: 12 }); +jimpInst.circle({ radius: 12, x: 12, y: 12 }); +jimpInst.color([{ apply: ColorActionName.SATURATE, params: [90] }]); +// $ExpectError jimpInst.PNG_FILTER_NONE; // $ExpectError @@ -16,10 +23,8 @@ jimpInst.test; jimpInst.func(); // Main Jimp export should already have all of these already applied -Jimp.read('Test'); -Jimp.displace(Jimp, 2); -Jimp.shadow((err, val, coords) => {}); -Jimp.resize(40, 40); +Jimp.read("Test"); + // $ExpectType 0 Jimp.PNG_FILTER_NONE; @@ -29,56 +34,57 @@ Jimp.test; // $ExpectError Jimp.func(); -test('can clone properly', async () => { - const baseImage = await Jimp.read('filename'); +test("can clone properly", async () => { + const baseImage = await Jimp.read("filename"); const cloneBaseImage = baseImage.clone(); - // $ExpectType -1 - cloneBaseImage.PNG_FILTER_AUTO; + // $ExpectType number + cloneBaseImage._deflateLevel; - test('can handle `this` returns on the core type properly', () => { - // $ExpectType -1 - cloneBaseImage.diff(jimpInst, jimpInst).image.PNG_FILTER_AUTO + test("can handle `this` returns on the core type properly", () => { + // $ExpectType number + cloneBaseImage.posterize(3)._quality; }); - test('can handle `this` returns properly', () => { + test("can handle `this` returns properly", () => { cloneBaseImage .resize(1, 1) .crop(0, 0, 0, 0) .mask(cloneBaseImage, 2, 2) - .print('a' as any, 2, 2, 'a' as any) + .print("a" as any, 2, 2, "a" as any) .resize(1, 1) .quality(1) - .deflateLevel(2) - .PNG_FILTER_AUTO; + .deflateLevel(2)._filterType; }); - test('can handle imageCallbacks `this` properly', () => { + test("can handle imageCallbacks `this` properly", () => { cloneBaseImage.rgba(false, (_, jimpCBIn) => { - jimpCBIn.read('Test'); + // $ExpectError + jimpCBIn.read("Test"); jimpCBIn.displace(jimpInst, 2); jimpCBIn.resize(40, 40); - // $ExpectType 0 - jimpCBIn.PNG_FILTER_NONE; + // $ExpectType number + jimpCBIn._filterType; // $ExpectError jimpCBIn.test; // $ExpectError jimpCBIn.func(); - }) - }) + }); + }); }); -test('Can handle callback with constructor', () => { +test("Can handle callback with constructor", () => { const myBmpBuffer: Buffer = {} as any; Jimp.read(myBmpBuffer, (err, cbJimpInst) => { - cbJimpInst.read('Test'); + // $ExpectError + cbJimpInst.read("Test"); cbJimpInst.displace(jimpInst, 2); cbJimpInst.resize(40, 40); - // $ExpectType 0 - cbJimpInst.PNG_FILTER_NONE; + // $ExpectType number + cbJimpInst._filterType; // $ExpectError cbJimpInst.test; @@ -86,17 +92,4 @@ test('Can handle callback with constructor', () => { // $ExpectError cbJimpInst.func(); }); -}) - -test('Can handle appendConstructorOption', () => { - Jimp.appendConstructorOption( - 'Name of Option', - args => args.hasSomeCustomThing, - function(resolve, reject, args) { - // $ExpectError - this.bitmap = 3; - Jimp.resize(2, 2); - resolve(); - } - ); }); diff --git a/project starter code/node_modules/jimp/types/ts3.1/index.d.ts b/project starter code/node_modules/jimp/types/ts3.1/index.d.ts deleted file mode 100644 index 08877f8b..00000000 --- a/project starter code/node_modules/jimp/types/ts3.1/index.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -/** - * While there is nothing in these typings that prevent it from running in TS 2.8 even, - * due to the complexity of the typings anything lower than TS 3.1 will only see - * Jimp as `any`. In order to test the strict versions of these types in our typing - * test suite, the version has been bumped to 3.1 - */ - -import { - Jimp as JimpType, - Bitmap, - RGB, - RGBA, - UnionToIntersection, - GetPluginVal, - GetPluginConst, - GetPluginEncoders, - GetPluginDecoders, - JimpConstructors -} from '@jimp/core'; -import typeFn from '@jimp/types'; -import pluginFn from '@jimp/plugins'; - -type Types = ReturnType; -type Plugins = ReturnType; - -type IntersectedPluginTypes = UnionToIntersection< - GetPluginVal | GetPluginVal ->; - -type IntersectedPluginConsts = UnionToIntersection< - GetPluginConst | GetPluginConst ->; - -type IntersectedPluginEncoders = UnionToIntersection< - GetPluginEncoders | GetPluginEncoders ->; - -type IntersectedPluginDecoders = UnionToIntersection< - GetPluginDecoders | GetPluginDecoders ->; - -type Jimp = JimpType & IntersectedPluginTypes; - -declare const Jimp: JimpConstructors & IntersectedPluginConsts & { - prototype: Jimp; - encoders: IntersectedPluginEncoders; - decoders: IntersectedPluginDecoders; -}; - -export = Jimp; diff --git a/project starter code/node_modules/jimp/types/ts3.1/test.ts b/project starter code/node_modules/jimp/types/ts3.1/test.ts deleted file mode 100644 index ae64a487..00000000 --- a/project starter code/node_modules/jimp/types/ts3.1/test.ts +++ /dev/null @@ -1,94 +0,0 @@ -import * as Jimp from 'jimp'; - -const jimpInst: Jimp = new Jimp('test'); - -// Main Jimp export should already have all of these already applied -// $ExpectError -jimpInst.read('Test'); -jimpInst.displace(jimpInst, 2); -jimpInst.resize(40, 40); -jimpInst.displace(jimpInst, 2); -jimpInst.shadow((err, val, coords) => {}); -jimpInst.fishEye({r: 12}); -jimpInst.circle({radius: 12, x: 12, y: 12}); -// $ExpectError -jimpInst.PNG_FILTER_NONE; - -// $ExpectError -jimpInst.test; - -// $ExpectError -jimpInst.func(); - -// Main Jimp export should already have all of these already applied -Jimp.read('Test'); - -// $ExpectType 0 -Jimp.PNG_FILTER_NONE; - -// $ExpectError -Jimp.test; - -// $ExpectError -Jimp.func(); - -test('can clone properly', async () => { - const baseImage = await Jimp.read('filename'); - const cloneBaseImage = baseImage.clone(); - - // $ExpectType number - cloneBaseImage._deflateLevel; - - test('can handle `this` returns on the core type properly', () => { - // $ExpectType number - cloneBaseImage.posterize(3)._quality - }); - - test('can handle `this` returns properly', () => { - cloneBaseImage - .resize(1, 1) - .crop(0, 0, 0, 0) - .mask(cloneBaseImage, 2, 2) - .print('a' as any, 2, 2, 'a' as any) - .resize(1, 1) - .quality(1) - .deflateLevel(2) - ._filterType; - }); - - test('can handle imageCallbacks `this` properly', () => { - cloneBaseImage.rgba(false, (_, jimpCBIn) => { - // $ExpectError - jimpCBIn.read('Test'); - jimpCBIn.displace(jimpInst, 2); - jimpCBIn.resize(40, 40); - // $ExpectType number - jimpCBIn._filterType; - - // $ExpectError - jimpCBIn.test; - - // $ExpectError - jimpCBIn.func(); - }) - }) -}); - -test('Can handle callback with constructor', () => { - const myBmpBuffer: Buffer = {} as any; - - Jimp.read(myBmpBuffer, (err, cbJimpInst) => { - // $ExpectError - cbJimpInst.read('Test'); - cbJimpInst.displace(jimpInst, 2); - cbJimpInst.resize(40, 40); - // $ExpectType number - cbJimpInst._filterType; - - // $ExpectError - cbJimpInst.test; - - // $ExpectError - cbJimpInst.func(); - }); -}); diff --git a/project starter code/node_modules/jimp/types/ts3.1/tsconfig.json b/project starter code/node_modules/jimp/types/ts3.1/tsconfig.json deleted file mode 100644 index 6dbbf36d..00000000 --- a/project starter code/node_modules/jimp/types/ts3.1/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": ["es6"], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "noEmit": true, - - // If the library is an external module (uses `export`), this allows your test file to import "mylib" instead of "./index". - // If the library is global (cannot be imported via `import` or `require`), leave this out. - "baseUrl": "../test", - "paths": { - "mylib": ["."] - } - } -} diff --git a/project starter code/node_modules/jimp/types/tsconfig.json b/project starter code/node_modules/jimp/types/tsconfig.json index 6dbbf36d..eb1dd15b 100644 --- a/project starter code/node_modules/jimp/types/tsconfig.json +++ b/project starter code/node_modules/jimp/types/tsconfig.json @@ -6,6 +6,7 @@ "noImplicitThis": true, "strictNullChecks": true, "strictFunctionTypes": true, + "skipLibCheck": true, "noEmit": true, // If the library is an external module (uses `export`), this allows your test file to import "mylib" instead of "./index". diff --git a/project starter code/node_modules/minimatch/LICENSE b/project starter code/node_modules/minimatch/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/project starter code/node_modules/minimatch/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/project starter code/node_modules/minimatch/README.md b/project starter code/node_modules/minimatch/README.md new file mode 100644 index 00000000..33ede1d6 --- /dev/null +++ b/project starter code/node_modules/minimatch/README.md @@ -0,0 +1,230 @@ +# minimatch + +A minimal matching utility. + +[![Build Status](https://travis-ci.org/isaacs/minimatch.svg?branch=master)](http://travis-ci.org/isaacs/minimatch) + + +This is the matching library used internally by npm. + +It works by converting glob expressions into JavaScript `RegExp` +objects. + +## Usage + +```javascript +var minimatch = require("minimatch") + +minimatch("bar.foo", "*.foo") // true! +minimatch("bar.foo", "*.bar") // false! +minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy! +``` + +## Features + +Supports these glob features: + +* Brace Expansion +* Extended glob matching +* "Globstar" `**` matching + +See: + +* `man sh` +* `man bash` +* `man 3 fnmatch` +* `man 5 gitignore` + +## Minimatch Class + +Create a minimatch object by instantiating the `minimatch.Minimatch` class. + +```javascript +var Minimatch = require("minimatch").Minimatch +var mm = new Minimatch(pattern, options) +``` + +### Properties + +* `pattern` The original pattern the minimatch object represents. +* `options` The options supplied to the constructor. +* `set` A 2-dimensional array of regexp or string expressions. + Each row in the + array corresponds to a brace-expanded pattern. Each item in the row + corresponds to a single path-part. For example, the pattern + `{a,b/c}/d` would expand to a set of patterns like: + + [ [ a, d ] + , [ b, c, d ] ] + + If a portion of the pattern doesn't have any "magic" in it + (that is, it's something like `"foo"` rather than `fo*o?`), then it + will be left as a string rather than converted to a regular + expression. + +* `regexp` Created by the `makeRe` method. A single regular expression + expressing the entire pattern. This is useful in cases where you wish + to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled. +* `negate` True if the pattern is negated. +* `comment` True if the pattern is a comment. +* `empty` True if the pattern is `""`. + +### Methods + +* `makeRe` Generate the `regexp` member if necessary, and return it. + Will return `false` if the pattern is invalid. +* `match(fname)` Return true if the filename matches the pattern, or + false otherwise. +* `matchOne(fileArray, patternArray, partial)` Take a `/`-split + filename, and match it against a single row in the `regExpSet`. This + method is mainly for internal use, but is exposed so that it can be + used by a glob-walker that needs to avoid excessive filesystem calls. + +All other methods are internal, and will be called as necessary. + +### minimatch(path, pattern, options) + +Main export. Tests a path against the pattern using the options. + +```javascript +var isJS = minimatch(file, "*.js", { matchBase: true }) +``` + +### minimatch.filter(pattern, options) + +Returns a function that tests its +supplied argument, suitable for use with `Array.filter`. Example: + +```javascript +var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true})) +``` + +### minimatch.match(list, pattern, options) + +Match against the list of +files, in the style of fnmatch or glob. If nothing is matched, and +options.nonull is set, then return a list containing the pattern itself. + +```javascript +var javascripts = minimatch.match(fileList, "*.js", {matchBase: true})) +``` + +### minimatch.makeRe(pattern, options) + +Make a regular expression object from the pattern. + +## Options + +All options are `false` by default. + +### debug + +Dump a ton of stuff to stderr. + +### nobrace + +Do not expand `{a,b}` and `{1..3}` brace sets. + +### noglobstar + +Disable `**` matching against multiple folder names. + +### dot + +Allow patterns to match filenames starting with a period, even if +the pattern does not explicitly have a period in that spot. + +Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot` +is set. + +### noext + +Disable "extglob" style patterns like `+(a|b)`. + +### nocase + +Perform a case-insensitive match. + +### nonull + +When a match is not found by `minimatch.match`, return a list containing +the pattern itself if this option is set. When not set, an empty list +is returned if there are no matches. + +### matchBase + +If set, then patterns without slashes will be matched +against the basename of the path if it contains slashes. For example, +`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. + +### nocomment + +Suppress the behavior of treating `#` at the start of a pattern as a +comment. + +### nonegate + +Suppress the behavior of treating a leading `!` character as negation. + +### flipNegate + +Returns from negate expressions the same as if they were not negated. +(Ie, true on a hit, false on a miss.) + +### partial + +Compare a partial path to a pattern. As long as the parts of the path that +are present are not contradicted by the pattern, it will be treated as a +match. This is useful in applications where you're walking through a +folder structure, and don't yet have the full path, but want to ensure that +you do not walk down paths that can never be a match. + +For example, + +```js +minimatch('/a/b', '/a/*/c/d', { partial: true }) // true, might be /a/b/c/d +minimatch('/a/b', '/**/d', { partial: true }) // true, might be /a/b/.../d +minimatch('/x/y/z', '/a/**/z', { partial: true }) // false, because x !== a +``` + +### allowWindowsEscape + +Windows path separator `\` is by default converted to `/`, which +prohibits the usage of `\` as a escape character. This flag skips that +behavior and allows using the escape character. + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between minimatch and other +implementations, and are intentional. + +If the pattern starts with a `!` character, then it is negated. Set the +`nonegate` flag to suppress this behavior, and treat leading `!` +characters normally. This is perhaps relevant if you wish to start the +pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` +characters at the start of a pattern will negate the pattern multiple +times. + +If a pattern starts with `#`, then it is treated as a comment, and +will not match anything. Use `\#` to match a literal `#` at the +start of a line, or set the `nocomment` flag to suppress this behavior. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.1, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then minimatch.match returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. diff --git a/project starter code/node_modules/minimatch/minimatch.js b/project starter code/node_modules/minimatch/minimatch.js new file mode 100644 index 00000000..fda45ade --- /dev/null +++ b/project starter code/node_modules/minimatch/minimatch.js @@ -0,0 +1,947 @@ +module.exports = minimatch +minimatch.Minimatch = Minimatch + +var path = (function () { try { return require('path') } catch (e) {}}()) || { + sep: '/' +} +minimatch.sep = path.sep + +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} +var expand = require('brace-expansion') + +var plTypes = { + '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, + '?': { open: '(?:', close: ')?' }, + '+': { open: '(?:', close: ')+' }, + '*': { open: '(?:', close: ')*' }, + '@': { open: '(?:', close: ')' } +} + +// any single thing other than / +// don't need to escape / when using new RegExp() +var qmark = '[^/]' + +// * => any number of characters +var star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} + +function ext (a, b) { + b = b || {} + var t = {} + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || typeof def !== 'object' || !Object.keys(def).length) { + return minimatch + } + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + m.Minimatch.defaults = function defaults (options) { + return orig.defaults(ext(def, options)).Minimatch + } + + m.filter = function filter (pattern, options) { + return orig.filter(pattern, ext(def, options)) + } + + m.defaults = function defaults (options) { + return orig.defaults(ext(def, options)) + } + + m.makeRe = function makeRe (pattern, options) { + return orig.makeRe(pattern, ext(def, options)) + } + + m.braceExpand = function braceExpand (pattern, options) { + return orig.braceExpand(pattern, ext(def, options)) + } + + m.match = function (list, pattern, options) { + return orig.match(list, pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + assertValidPattern(pattern) + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + assertValidPattern(pattern) + + if (!options) options = {} + + pattern = pattern.trim() + + // windows support: need to use /, not \ + if (!options.allowWindowsEscape && path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } + + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + this.partial = !!options.partial + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = function debug() { console.error.apply(console, arguments) } + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 + + if (options.nonegate) return + + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} + +Minimatch.prototype.braceExpand = braceExpand + +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } + } + + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern + + assertValidPattern(pattern) + + // Thanks to Yeting Li for + // improving this regexp to avoid a ReDOS vulnerability. + if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +var MAX_PATTERN_LENGTH = 1024 * 64 +var assertValidPattern = function (pattern) { + if (typeof pattern !== 'string') { + throw new TypeError('invalid pattern') + } + + if (pattern.length > MAX_PATTERN_LENGTH) { + throw new TypeError('pattern is too long') + } +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + assertValidPattern(pattern) + + var options = this.options + + // shortcuts + if (pattern === '**') { + if (!options.noglobstar) + return GLOBSTAR + else + pattern = '*' + } + if (pattern === '') return '' + + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var negativeLists = [] + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this + + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue + } + + switch (c) { + /* istanbul ignore next */ + case '/': { + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + } + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } + + if (!stateChar) { + re += '\\(' + continue + } + + patternListStack.push({ + type: stateChar, + start: i - 1, + reStart: re.length, + open: plTypes[stateChar].open, + close: plTypes[stateChar].close + }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!(?:' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } + + clearStateChar() + hasMagic = true + var pl = patternListStack.pop() + // negation is (?:(?!js)[^/]*) + // The others are (?:) + re += pl.close + if (pl.type === '!') { + negativeLists.push(pl) + } + pl.reEnd = re.length + continue + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } + + clearStateChar() + re += '|' + continue + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += '\\' + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + + // finish up the class. + hasMagic = true + inClass = false + re += c + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } + + re += c + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + pl.open.length) + this.debug('setting tail', re, pl) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail, pl, re) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '[': case '.': case '(': addPatternStart = true + } + + // Hack to work around lack of negative lookbehind in JS + // A pattern like: *.!(x).!(y|z) needs to ensure that a name + // like 'a.xyz.yz' doesn't match. So, the first negative + // lookahead, has to look ALL the way ahead, to the end of + // the pattern. + for (var n = negativeLists.length - 1; n > -1; n--) { + var nl = negativeLists[n] + + var nlBefore = re.slice(0, nl.reStart) + var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) + var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + var nlAfter = re.slice(nl.reEnd) + + nlLast += nlAfter + + // Handle nested stuff like *(*.js|!(*.json)), where open parens + // mean that we should *not* include the ) in the bit that is considered + // "after" the negated section. + var openParensBefore = nlBefore.split('(').length - 1 + var cleanAfter = nlAfter + for (i = 0; i < openParensBefore; i++) { + cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') + } + nlAfter = cleanAfter + + var dollar = '' + if (nlAfter === '' && isSub !== SUBPARSE) { + dollar = '$' + } + var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast + re = newRe + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) { + re = '(?=.)' + re + } + + if (addPatternStart) { + re = patternStart + re + } + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + var flags = options.nocase ? 'i' : '' + try { + var regExp = new RegExp('^' + re + '$', flags) + } catch (er) /* istanbul ignore next - should be impossible */ { + // If it was an invalid regular expression, then it can't match + // anything. This trick looks for a character after the end of + // the string, which is of course impossible, except in multi-line + // mode, but it's not a /m regex. + return new RegExp('$.') + } + + regExp._glob = pattern + regExp._src = re + + return regExp +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} + +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options + + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) /* istanbul ignore next - should be impossible */ { + this.regexp = false + } + return this.regexp +} + +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +Minimatch.prototype.match = function match (f, partial) { + if (typeof partial === 'undefined') partial = this.partial + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true + + var options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} + +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options + + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) + + this.debug('matchOne', file.length, pattern.length) + + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + /* istanbul ignore if */ + if (p === false) return false + + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) + + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } + + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] + + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } + + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } + + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + /* istanbul ignore if */ + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + hit = f === p + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else /* istanbul ignore else */ if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + return (fi === fl - 1) && (file[fi] === '') + } + + // should be unreachable. + /* istanbul ignore next */ + throw new Error('wtf?') +} + +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} + +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} diff --git a/project starter code/node_modules/minimatch/package.json b/project starter code/node_modules/minimatch/package.json new file mode 100644 index 00000000..566efdfe --- /dev/null +++ b/project starter code/node_modules/minimatch/package.json @@ -0,0 +1,33 @@ +{ + "author": "Isaac Z. Schlueter (http://blog.izs.me)", + "name": "minimatch", + "description": "a glob matcher in javascript", + "version": "3.1.2", + "publishConfig": { + "tag": "v3-legacy" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/minimatch.git" + }, + "main": "minimatch.js", + "scripts": { + "test": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --all; git push origin --tags" + }, + "engines": { + "node": "*" + }, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "devDependencies": { + "tap": "^15.1.6" + }, + "license": "ISC", + "files": [ + "minimatch.js" + ] +} diff --git a/project starter code/node_modules/minimist/.eslintrc b/project starter code/node_modules/minimist/.eslintrc deleted file mode 100644 index 137f67b4..00000000 --- a/project starter code/node_modules/minimist/.eslintrc +++ /dev/null @@ -1,54 +0,0 @@ -{ - "root": true, - - "extends": "@ljharb/eslint-config/node/0.4", - - "rules": { - "array-bracket-spacing": 0, - "array-element-newline": 0, - "brace-style": 1, - "camelcase": 1, - "comma-dangle": 1, - "comma-spacing": 1, - "complexity": 0, - "curly": 1, - "dot-notation": 1, - "eol-last": 1, - "func-style": 1, - "function-paren-newline": 1, - "indent": [1, 4], - "key-spacing": 1, - "max-lines-per-function": 0, - "max-nested-callbacks": 1, - "max-statements": 0, - "multiline-comment-style": 1, - "no-array-constructor": 1, - "no-continue": 1, - "no-div-regex": 1, - "no-extra-parens": 1, - "no-mixed-operators": 1, - "no-multi-spaces": 1, - "no-multiple-empty-lines": 1, - "no-param-reassign": 1, - "no-plusplus": 1, - "no-proto": 1, - "no-redeclare": 1, - "no-restricted-syntax": 1, - "no-shadow": 1, - "no-trailing-spaces": 1, - "no-unused-vars": 1, - "no-use-before-define": 1, - "object-curly-newline": 1, - "object-curly-spacing": 1, - "operator-linebreak": 1, - "quote-props": 1, - "quotes": 1, - "semi-style": 1, - "semi": 1, - "space-before-blocks": 1, - "space-before-function-paren": 1, - "space-infix-ops": 1, - "strict": 1, - "wrap-regex": 1, - }, -} diff --git a/project starter code/node_modules/minimist/.github/FUNDING.yml b/project starter code/node_modules/minimist/.github/FUNDING.yml deleted file mode 100644 index a9366222..00000000 --- a/project starter code/node_modules/minimist/.github/FUNDING.yml +++ /dev/null @@ -1,12 +0,0 @@ -# These are supported funding model platforms - -github: [ljharb] -patreon: # Replace with a single Patreon username -open_collective: # Replace with a single Open Collective username -ko_fi: # Replace with a single Ko-fi username -tidelift: npm/minimist -community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry -liberapay: # Replace with a single Liberapay username -issuehunt: # Replace with a single IssueHunt username -otechie: # Replace with a single Otechie username -custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/project starter code/node_modules/minimist/.nycrc b/project starter code/node_modules/minimist/.nycrc deleted file mode 100644 index 55c3d293..00000000 --- a/project starter code/node_modules/minimist/.nycrc +++ /dev/null @@ -1,14 +0,0 @@ -{ - "all": true, - "check-coverage": false, - "reporter": ["text-summary", "text", "html", "json"], - "lines": 86, - "statements": 85.93, - "functions": 82.43, - "branches": 76.06, - "exclude": [ - "coverage", - "example", - "test" - ] -} diff --git a/project starter code/node_modules/minimist/CHANGELOG.md b/project starter code/node_modules/minimist/CHANGELOG.md deleted file mode 100644 index e0e00bd0..00000000 --- a/project starter code/node_modules/minimist/CHANGELOG.md +++ /dev/null @@ -1,212 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [v1.2.7](https://github.com/minimistjs/minimist/compare/v1.2.6...v1.2.7) - 2022-10-10 - -### Commits - -- [meta] add `auto-changelog` [`0ebf4eb`](https://github.com/minimistjs/minimist/commit/0ebf4ebcd5f7787a5524d31a849ef41316b83c3c) -- [actions] add reusable workflows [`e115b63`](https://github.com/minimistjs/minimist/commit/e115b63fa9d3909f33b00a2db647ff79068388de) -- [eslint] add eslint; rules to enable later are warnings [`f58745b`](https://github.com/minimistjs/minimist/commit/f58745b9bb84348e1be72af7dbba5840c7c13013) -- [Dev Deps] switch from `covert` to `nyc` [`ab03356`](https://github.com/minimistjs/minimist/commit/ab033567b9c8b31117cb026dc7f1e592ce455c65) -- [readme] rename and add badges [`236f4a0`](https://github.com/minimistjs/minimist/commit/236f4a07e4ebe5ee44f1496ec6974991ab293ffd) -- [meta] create FUNDING.yml; add `funding` in package.json [`783a49b`](https://github.com/minimistjs/minimist/commit/783a49bfd47e8335d3098a8cac75662cf71eb32a) -- [meta] use `npmignore` to autogenerate an npmignore file [`f81ece6`](https://github.com/minimistjs/minimist/commit/f81ece6aaec2fa14e69ff4f1e0407a8c4e2635a2) -- Only apps should have lockfiles [`56cad44`](https://github.com/minimistjs/minimist/commit/56cad44c7f879b9bb5ec18fcc349308024a89bfc) -- [Dev Deps] update `covert`, `tape`; remove unnecessary `tap` [`49c5f9f`](https://github.com/minimistjs/minimist/commit/49c5f9fb7e6a92db9eb340cc679de92fb3aacded) -- [Tests] add `aud` in `posttest` [`228ae93`](https://github.com/minimistjs/minimist/commit/228ae938f3cd9db9dfd8bd7458b076a7b2aef280) -- [meta] add `safe-publish-latest` [`01fc23f`](https://github.com/minimistjs/minimist/commit/01fc23f5104f85c75059972e01dd33796ab529ff) -- [meta] update repo URLs [`6b164c7`](https://github.com/minimistjs/minimist/commit/6b164c7d68e0b6bf32f894699effdfb7c63041dd) - -## [v1.2.6](https://github.com/minimistjs/minimist/compare/v1.2.5...v1.2.6) - 2022-03-21 - -### Commits - -- test from prototype pollution PR [`bc8ecee`](https://github.com/minimistjs/minimist/commit/bc8ecee43875261f4f17eb20b1243d3ed15e70eb) -- isConstructorOrProto adapted from PR [`c2b9819`](https://github.com/minimistjs/minimist/commit/c2b981977fa834b223b408cfb860f933c9811e4d) -- security notice for additional prototype pollution issue [`ef88b93`](https://github.com/minimistjs/minimist/commit/ef88b9325f77b5ee643ccfc97e2ebda577e4c4e2) - -## [v1.2.5](https://github.com/minimistjs/minimist/compare/v1.2.4...v1.2.5) - 2020-03-12 - -## [v1.2.4](https://github.com/minimistjs/minimist/compare/v1.2.3...v1.2.4) - 2020-03-11 - -### Commits - -- security notice [`4cf1354`](https://github.com/minimistjs/minimist/commit/4cf1354839cb972e38496d35e12f806eea92c11f) -- additional test for constructor prototype pollution [`1043d21`](https://github.com/minimistjs/minimist/commit/1043d212c3caaf871966e710f52cfdf02f9eea4b) - -## [v1.2.3](https://github.com/minimistjs/minimist/compare/v1.2.2...v1.2.3) - 2020-03-10 - -### Commits - -- more failing proto pollution tests [`13c01a5`](https://github.com/minimistjs/minimist/commit/13c01a5327736903704984b7f65616b8476850cc) -- even more aggressive checks for protocol pollution [`38a4d1c`](https://github.com/minimistjs/minimist/commit/38a4d1caead72ef99e824bb420a2528eec03d9ab) - -## [v1.2.2](https://github.com/minimistjs/minimist/compare/v1.2.1...v1.2.2) - 2020-03-10 - -### Commits - -- failing test for protocol pollution [`0efed03`](https://github.com/minimistjs/minimist/commit/0efed0340ec8433638758f7ca0c77cb20a0bfbab) -- cleanup [`67d3722`](https://github.com/minimistjs/minimist/commit/67d3722413448d00a62963d2d30c34656a92d7e2) -- console.dir -> console.log [`47acf72`](https://github.com/minimistjs/minimist/commit/47acf72c715a630bf9ea013867f47f1dd69dfc54) -- don't assign onto __proto__ [`63e7ed0`](https://github.com/minimistjs/minimist/commit/63e7ed05aa4b1889ec2f3b196426db4500cbda94) - -## [v1.2.1](https://github.com/minimistjs/minimist/compare/v1.2.0...v1.2.1) - 2020-03-10 - -### Merged - -- move the `opts['--']` example back where it belongs [`#63`](https://github.com/minimistjs/minimist/pull/63) - -### Commits - -- add test [`6be5dae`](https://github.com/minimistjs/minimist/commit/6be5dae35a32a987bcf4137fcd6c19c5200ee909) -- fix bad boolean regexp [`ac3fc79`](https://github.com/minimistjs/minimist/commit/ac3fc796e63b95128fdbdf67ea7fad71bd59aa76) - -## [v1.2.0](https://github.com/minimistjs/minimist/compare/v1.1.3...v1.2.0) - 2015-08-24 - -### Commits - -- failing -k=v short test [`63416b8`](https://github.com/minimistjs/minimist/commit/63416b8cd1d0d70e4714564cce465a36e4dd26d7) -- kv short fix [`6bbe145`](https://github.com/minimistjs/minimist/commit/6bbe14529166245e86424f220a2321442fe88dc3) -- failing kv short test [`f72ab7f`](https://github.com/minimistjs/minimist/commit/f72ab7f4572adc52902c9b6873cc969192f01b10) -- fixed kv test [`f5a48c3`](https://github.com/minimistjs/minimist/commit/f5a48c3e50e40ca54f00c8e84de4b4d6e9897fa8) -- enforce space between arg key and value [`86b321a`](https://github.com/minimistjs/minimist/commit/86b321affe648a8e016c095a4f0efa9d9074f502) - -## [v1.1.3](https://github.com/minimistjs/minimist/compare/v1.1.2...v1.1.3) - 2015-08-06 - -### Commits - -- add failing test - boolean alias array [`0fa3c5b`](https://github.com/minimistjs/minimist/commit/0fa3c5b3dd98551ddecf5392831b4c21211743fc) -- fix boolean values with multiple aliases [`9c0a6e7`](https://github.com/minimistjs/minimist/commit/9c0a6e7de25a273b11bbf9a7464f0bd833779795) - -## [v1.1.2](https://github.com/minimistjs/minimist/compare/v1.1.1...v1.1.2) - 2015-07-22 - -### Commits - -- Convert boolean arguments to boolean values [`8f3dc27`](https://github.com/minimistjs/minimist/commit/8f3dc27cf833f1d54671b6d0bcb55c2fe19672a9) -- use non-ancient npm, node 0.12 and iojs [`61ed1d0`](https://github.com/minimistjs/minimist/commit/61ed1d034b9ec7282764ce76f3992b1a0b4906ae) -- an older npm for 0.8 [`25cf778`](https://github.com/minimistjs/minimist/commit/25cf778b1220e7838a526832ad6972f75244054f) - -## [v1.1.1](https://github.com/minimistjs/minimist/compare/v1.1.0...v1.1.1) - 2015-03-10 - -### Commits - -- check that they type of a value is a boolean, not just that it is currently set to a boolean [`6863198`](https://github.com/minimistjs/minimist/commit/6863198e36139830ff1f20ffdceaddd93f2c1db9) -- upgrade tape, fix type issues from old tape version [`806712d`](https://github.com/minimistjs/minimist/commit/806712df91604ed02b8e39aa372b84aea659ee34) -- test for setting a boolean to a null default [`8c444fe`](https://github.com/minimistjs/minimist/commit/8c444fe89384ded7d441c120915ea60620b01dd3) -- if the previous value was a boolean, without an default (or with an alias) don't make an array either [`e5f419a`](https://github.com/minimistjs/minimist/commit/e5f419a3b5b3bc3f9e5ac71b7040621af70ed2dd) - -## [v1.1.0](https://github.com/minimistjs/minimist/compare/v1.0.0...v1.1.0) - 2014-08-10 - -### Commits - -- add support for handling "unknown" options not registered with the parser. [`6f3cc5d`](https://github.com/minimistjs/minimist/commit/6f3cc5d4e84524932a6ef2ce3592acc67cdd4383) -- reformat package.json [`02ed371`](https://github.com/minimistjs/minimist/commit/02ed37115194d3697ff358e8e25e5e66bab1d9f8) -- coverage script [`e5531ba`](https://github.com/minimistjs/minimist/commit/e5531ba0479da3b8138d3d8cac545d84ccb1c8df) -- extra fn to get 100% coverage again [`a6972da`](https://github.com/minimistjs/minimist/commit/a6972da89e56bf77642f8ec05a13b6558db93498) - -## [v1.0.0](https://github.com/minimistjs/minimist/compare/v0.2.1...v1.0.0) - 2014-08-10 - -### Commits - -- added stopEarly option [`471c7e4`](https://github.com/minimistjs/minimist/commit/471c7e4a7e910fc7ad8f9df850a186daf32c64e9) -- fix list [`fef6ae7`](https://github.com/minimistjs/minimist/commit/fef6ae79c38b9dc1c49569abb7cd04eb965eac5e) - -## [v0.2.1](https://github.com/minimistjs/minimist/compare/v0.2.0...v0.2.1) - 2020-03-12 - -## [v0.2.0](https://github.com/minimistjs/minimist/compare/v0.1.0...v0.2.0) - 2014-06-19 - -### Commits - -- support all-boolean mode [`450a97f`](https://github.com/minimistjs/minimist/commit/450a97f6e2bc85c7a4a13185c19a818d9a5ebe69) - -## [v0.1.0](https://github.com/minimistjs/minimist/compare/v0.0.10...v0.1.0) - 2014-05-12 - -### Commits - -- Provide a mechanism to segregate -- arguments [`ce4a1e6`](https://github.com/minimistjs/minimist/commit/ce4a1e63a7e8d5ab88d2a3768adefa6af98a445a) -- documented argv['--'] [`14db0e6`](https://github.com/minimistjs/minimist/commit/14db0e6dbc6d2b9e472adaa54dad7004b364634f) -- Adding a test-case for notFlags segregation [`715c1e3`](https://github.com/minimistjs/minimist/commit/715c1e3714be223f998f6c537af6b505f0236c16) - -## [v0.0.10](https://github.com/minimistjs/minimist/compare/v0.0.9...v0.0.10) - 2014-05-11 - -### Commits - -- dedicated boolean test [`46e448f`](https://github.com/minimistjs/minimist/commit/46e448f9f513cfeb2bcc8b688b9b47ba1e515c2b) -- dedicated num test [`9bf2d36`](https://github.com/minimistjs/minimist/commit/9bf2d36f1d3b8795be90b8f7de0a937f098aa394) -- aliased values treated as strings [`1ab743b`](https://github.com/minimistjs/minimist/commit/1ab743bad4484d69f1259bed42f9531de01119de) -- cover the case of already numbers, at 100% coverage [`b2bb044`](https://github.com/minimistjs/minimist/commit/b2bb04436599d77a2ce029e8e555e25b3aa55d13) -- another test for higher coverage [`3662624`](https://github.com/minimistjs/minimist/commit/3662624be976d5489d486a856849c048d13be903) - -## [v0.0.9](https://github.com/minimistjs/minimist/compare/v0.0.8...v0.0.9) - 2014-05-08 - -### Commits - -- Eliminate `longest` fn. [`824f642`](https://github.com/minimistjs/minimist/commit/824f642038d1b02ede68b6261d1d65163390929a) - -## [v0.0.8](https://github.com/minimistjs/minimist/compare/v0.0.7...v0.0.8) - 2014-02-20 - -### Commits - -- return '' if flag is string and empty [`fa63ed4`](https://github.com/minimistjs/minimist/commit/fa63ed4651a4ef4eefddce34188e0d98d745a263) -- handle joined single letters [`66c248f`](https://github.com/minimistjs/minimist/commit/66c248f0241d4d421d193b022e9e365f11178534) - -## [v0.0.7](https://github.com/minimistjs/minimist/compare/v0.0.6...v0.0.7) - 2014-02-08 - -### Commits - -- another swap of .test for .match [`d1da408`](https://github.com/minimistjs/minimist/commit/d1da40819acbe846d89a5c02721211e3c1260dde) - -## [v0.0.6](https://github.com/minimistjs/minimist/compare/v0.0.5...v0.0.6) - 2014-02-08 - -### Commits - -- use .test() instead of .match() to not crash on non-string values in the arguments array [`7e0d1ad`](https://github.com/minimistjs/minimist/commit/7e0d1add8c9e5b9b20a4d3d0f9a94d824c578da1) - -## [v0.0.5](https://github.com/minimistjs/minimist/compare/v0.0.4...v0.0.5) - 2013-09-18 - -### Commits - -- Improve '--' handling. [`b11822c`](https://github.com/minimistjs/minimist/commit/b11822c09cc9d2460f30384d12afc0b953c037a4) - -## [v0.0.4](https://github.com/minimistjs/minimist/compare/v0.0.3...v0.0.4) - 2013-09-17 - -## [v0.0.3](https://github.com/minimistjs/minimist/compare/v0.0.2...v0.0.3) - 2013-09-12 - -### Commits - -- failing test for single dash preceeding a double dash [`b465514`](https://github.com/minimistjs/minimist/commit/b465514b82c9ae28972d714facd951deb2ad762b) -- fix for the dot test [`6a095f1`](https://github.com/minimistjs/minimist/commit/6a095f1d364c8fab2d6753d2291a0649315d297a) - -## [v0.0.2](https://github.com/minimistjs/minimist/compare/v0.0.1...v0.0.2) - 2013-08-28 - -### Commits - -- allow dotted aliases & defaults [`321c33e`](https://github.com/minimistjs/minimist/commit/321c33e755485faaeb44eeb1c05d33b2e0a5a7c4) -- use a better version of ff [`e40f611`](https://github.com/minimistjs/minimist/commit/e40f61114cf7be6f7947f7b3eed345853a67dbbb) - -## [v0.0.1](https://github.com/minimistjs/minimist/compare/v0.0.0...v0.0.1) - 2013-06-25 - -### Commits - -- remove trailing commas [`6ff0fa0`](https://github.com/minimistjs/minimist/commit/6ff0fa055064f15dbe06d50b89d5173a6796e1db) - -## v0.0.0 - 2013-06-25 - -### Commits - -- half of the parse test ported [`3079326`](https://github.com/minimistjs/minimist/commit/307932601325087de6cf94188eb798ffc4f3088a) -- stripped down code and a passing test from optimist [`7cced88`](https://github.com/minimistjs/minimist/commit/7cced88d82e399d1a03ed23eb667f04d3f320d10) -- ported parse tests completely over [`9448754`](https://github.com/minimistjs/minimist/commit/944875452e0820df6830b1408c26a0f7d3e1db04) -- docs, package.json [`a5bf46a`](https://github.com/minimistjs/minimist/commit/a5bf46ac9bb3bd114a9c340276c62c1091e538d5) -- move more short tests into short.js [`503edb5`](https://github.com/minimistjs/minimist/commit/503edb5c41d89c0d40831ee517154fc13b0f18b9) -- default bool test was wrong, not the code [`1b9f5db`](https://github.com/minimistjs/minimist/commit/1b9f5db4741b49962846081b68518de824992097) -- passing long tests ripped out of parse.js [`7972c4a`](https://github.com/minimistjs/minimist/commit/7972c4aff1f4803079e1668006658e2a761a0428) -- badges [`84c0370`](https://github.com/minimistjs/minimist/commit/84c037063664d42878aace715fe6572ce01b6f3b) -- all the tests now ported, some failures [`64239ed`](https://github.com/minimistjs/minimist/commit/64239edfe92c711c4eb0da254fcdfad2a5fdb605) -- failing short test [`f8a5341`](https://github.com/minimistjs/minimist/commit/f8a534112dd1138d2fad722def56a848480c446f) -- fixed the numeric test [`6b034f3`](https://github.com/minimistjs/minimist/commit/6b034f37c79342c60083ed97fd222e16928aac51) diff --git a/project starter code/node_modules/minimist/README.md b/project starter code/node_modules/minimist/README.md deleted file mode 100644 index 30ff92df..00000000 --- a/project starter code/node_modules/minimist/README.md +++ /dev/null @@ -1,117 +0,0 @@ -# minimist [![Version Badge][npm-version-svg]][package-url] - -[![github actions][actions-image]][actions-url] -[![coverage][codecov-image]][codecov-url] -[![License][license-image]][license-url] -[![Downloads][downloads-image]][downloads-url] - -[![npm badge][npm-badge-png]][package-url] - -parse argument options - -This module is the guts of optimist's argument parser without all the -fanciful decoration. - -# example - -``` js -var argv = require('minimist')(process.argv.slice(2)); -console.log(argv); -``` - -``` -$ node example/parse.js -a beep -b boop -{ _: [], a: 'beep', b: 'boop' } -``` - -``` -$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz -{ _: [ 'foo', 'bar', 'baz' ], - x: 3, - y: 4, - n: 5, - a: true, - b: true, - c: true, - beep: 'boop' } -``` - -# security - -Previous versions had a prototype pollution bug that could cause privilege -escalation in some circumstances when handling untrusted user input. - -Please use version 1.2.6 or later: - -* https://security.snyk.io/vuln/SNYK-JS-MINIMIST-2429795 (version <=1.2.5) -* https://snyk.io/vuln/SNYK-JS-MINIMIST-559764 (version <=1.2.3) - -# methods - -``` js -var parseArgs = require('minimist') -``` - -## var argv = parseArgs(args, opts={}) - -Return an argument object `argv` populated with the array arguments from `args`. - -`argv._` contains all the arguments that didn't have an option associated with -them. - -Numeric-looking arguments will be returned as numbers unless `opts.string` or -`opts.boolean` is set for that argument name. - -Any arguments after `'--'` will not be parsed and will end up in `argv._`. - -options can be: - -* `opts.string` - a string or array of strings argument names to always treat as -strings -* `opts.boolean` - a boolean, string or array of strings to always treat as -booleans. if `true` will treat all double hyphenated arguments without equal signs -as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`) -* `opts.alias` - an object mapping string names to strings or arrays of string -argument names to use as aliases -* `opts.default` - an object mapping string argument names to default values -* `opts.stopEarly` - when true, populate `argv._` with everything after the -first non-option -* `opts['--']` - when true, populate `argv._` with everything before the `--` -and `argv['--']` with everything after the `--`. Here's an example: - - ``` - > require('./')('one two three -- four five --six'.split(' '), { '--': true }) - { _: [ 'one', 'two', 'three' ], - '--': [ 'four', 'five', '--six' ] } - ``` - - Note that with `opts['--']` set, parsing for arguments still stops after the - `--`. - -* `opts.unknown` - a function which is invoked with a command line parameter not -defined in the `opts` configuration object. If the function returns `false`, the -unknown option is not added to `argv`. - -# install - -With [npm](https://npmjs.org) do: - -``` -npm install minimist -``` - -# license - -MIT - -[package-url]: https://npmjs.org/package/minimist -[npm-version-svg]: https://versionbadg.es/minimistjs/minimist.svg -[npm-badge-png]: https://nodei.co/npm/minimist.png?downloads=true&stars=true -[license-image]: https://img.shields.io/npm/l/minimist.svg -[license-url]: LICENSE -[downloads-image]: https://img.shields.io/npm/dm/minimist.svg -[downloads-url]: https://npm-stat.com/charts.html?package=minimist -[codecov-image]: https://codecov.io/gh/minimistjs/minimist/branch/main/graphs/badge.svg -[codecov-url]: https://app.codecov.io/gh/minimistjs/minimist/ -[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/minimistjs/minimist -[actions-url]: https://github.com/minimistjs/minimist/actions diff --git a/project starter code/node_modules/minimist/example/parse.js b/project starter code/node_modules/minimist/example/parse.js deleted file mode 100644 index f7c8d498..00000000 --- a/project starter code/node_modules/minimist/example/parse.js +++ /dev/null @@ -1,2 +0,0 @@ -var argv = require('../')(process.argv.slice(2)); -console.log(argv); diff --git a/project starter code/node_modules/minimist/index.js b/project starter code/node_modules/minimist/index.js deleted file mode 100644 index d9c3eb79..00000000 --- a/project starter code/node_modules/minimist/index.js +++ /dev/null @@ -1,249 +0,0 @@ -module.exports = function (args, opts) { - if (!opts) opts = {}; - - var flags = { bools : {}, strings : {}, unknownFn: null }; - - if (typeof opts['unknown'] === 'function') { - flags.unknownFn = opts['unknown']; - } - - if (typeof opts['boolean'] === 'boolean' && opts['boolean']) { - flags.allBools = true; - } else { - [].concat(opts['boolean']).filter(Boolean).forEach(function (key) { - flags.bools[key] = true; - }); - } - - var aliases = {}; - Object.keys(opts.alias || {}).forEach(function (key) { - aliases[key] = [].concat(opts.alias[key]); - aliases[key].forEach(function (x) { - aliases[x] = [key].concat(aliases[key].filter(function (y) { - return x !== y; - })); - }); - }); - - [].concat(opts.string).filter(Boolean).forEach(function (key) { - flags.strings[key] = true; - if (aliases[key]) { - flags.strings[aliases[key]] = true; - } - }); - - var defaults = opts['default'] || {}; - - var argv = { _ : [] }; - Object.keys(flags.bools).forEach(function (key) { - setArg(key, defaults[key] === undefined ? false : defaults[key]); - }); - - var notFlags = []; - - if (args.indexOf('--') !== -1) { - notFlags = args.slice(args.indexOf('--')+1); - args = args.slice(0, args.indexOf('--')); - } - - function argDefined(key, arg) { - return (flags.allBools && /^--[^=]+$/.test(arg)) || - flags.strings[key] || flags.bools[key] || aliases[key]; - } - - function setArg (key, val, arg) { - if (arg && flags.unknownFn && !argDefined(key, arg)) { - if (flags.unknownFn(arg) === false) return; - } - - var value = !flags.strings[key] && isNumber(val) - ? Number(val) : val - ; - setKey(argv, key.split('.'), value); - - (aliases[key] || []).forEach(function (x) { - setKey(argv, x.split('.'), value); - }); - } - - function setKey (obj, keys, value) { - var o = obj; - for (var i = 0; i < keys.length-1; i++) { - var key = keys[i]; - if (isConstructorOrProto(o, key)) return; - if (o[key] === undefined) o[key] = {}; - if (o[key] === Object.prototype || o[key] === Number.prototype - || o[key] === String.prototype) o[key] = {}; - if (o[key] === Array.prototype) o[key] = []; - o = o[key]; - } - - var key = keys[keys.length - 1]; - if (isConstructorOrProto(o, key)) return; - if (o === Object.prototype || o === Number.prototype - || o === String.prototype) o = {}; - if (o === Array.prototype) o = []; - if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') { - o[key] = value; - } - else if (Array.isArray(o[key])) { - o[key].push(value); - } - else { - o[key] = [ o[key], value ]; - } - } - - function aliasIsBoolean(key) { - return aliases[key].some(function (x) { - return flags.bools[x]; - }); - } - - for (var i = 0; i < args.length; i++) { - var arg = args[i]; - - if (/^--.+=/.test(arg)) { - // Using [\s\S] instead of . because js doesn't support the - // 'dotall' regex modifier. See: - // http://stackoverflow.com/a/1068308/13216 - var m = arg.match(/^--([^=]+)=([\s\S]*)$/); - var key = m[1]; - var value = m[2]; - if (flags.bools[key]) { - value = value !== 'false'; - } - setArg(key, value, arg); - } - else if (/^--no-.+/.test(arg)) { - var key = arg.match(/^--no-(.+)/)[1]; - setArg(key, false, arg); - } - else if (/^--.+/.test(arg)) { - var key = arg.match(/^--(.+)/)[1]; - var next = args[i + 1]; - if (next !== undefined && !/^-/.test(next) - && !flags.bools[key] - && !flags.allBools - && (aliases[key] ? !aliasIsBoolean(key) : true)) { - setArg(key, next, arg); - i++; - } - else if (/^(true|false)$/.test(next)) { - setArg(key, next === 'true', arg); - i++; - } - else { - setArg(key, flags.strings[key] ? '' : true, arg); - } - } - else if (/^-[^-]+/.test(arg)) { - var letters = arg.slice(1,-1).split(''); - - var broken = false; - for (var j = 0; j < letters.length; j++) { - var next = arg.slice(j+2); - - if (next === '-') { - setArg(letters[j], next, arg) - continue; - } - - if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) { - setArg(letters[j], next.split('=')[1], arg); - broken = true; - break; - } - - if (/[A-Za-z]/.test(letters[j]) - && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) { - setArg(letters[j], next, arg); - broken = true; - break; - } - - if (letters[j+1] && letters[j+1].match(/\W/)) { - setArg(letters[j], arg.slice(j+2), arg); - broken = true; - break; - } - else { - setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg); - } - } - - var key = arg.slice(-1)[0]; - if (!broken && key !== '-') { - if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1]) - && !flags.bools[key] - && (aliases[key] ? !aliasIsBoolean(key) : true)) { - setArg(key, args[i+1], arg); - i++; - } - else if (args[i+1] && /^(true|false)$/.test(args[i+1])) { - setArg(key, args[i+1] === 'true', arg); - i++; - } - else { - setArg(key, flags.strings[key] ? '' : true, arg); - } - } - } - else { - if (!flags.unknownFn || flags.unknownFn(arg) !== false) { - argv._.push( - flags.strings['_'] || !isNumber(arg) ? arg : Number(arg) - ); - } - if (opts.stopEarly) { - argv._.push.apply(argv._, args.slice(i + 1)); - break; - } - } - } - - Object.keys(defaults).forEach(function (key) { - if (!hasKey(argv, key.split('.'))) { - setKey(argv, key.split('.'), defaults[key]); - - (aliases[key] || []).forEach(function (x) { - setKey(argv, x.split('.'), defaults[key]); - }); - } - }); - - if (opts['--']) { - argv['--'] = new Array(); - notFlags.forEach(function(key) { - argv['--'].push(key); - }); - } - else { - notFlags.forEach(function(key) { - argv._.push(key); - }); - } - - return argv; -}; - -function hasKey (obj, keys) { - var o = obj; - keys.slice(0,-1).forEach(function (key) { - o = (o[key] || {}); - }); - - var key = keys[keys.length - 1]; - return key in o; -} - -function isNumber (x) { - if (typeof x === 'number') return true; - if (/^0x[0-9a-f]+$/i.test(x)) return true; - return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x); -} - - -function isConstructorOrProto (obj, key) { - return key === 'constructor' && typeof obj[key] === 'function' || key === '__proto__'; -} diff --git a/project starter code/node_modules/minimist/package.json b/project starter code/node_modules/minimist/package.json deleted file mode 100644 index 89a639ed..00000000 --- a/project starter code/node_modules/minimist/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "name": "minimist", - "version": "1.2.7", - "description": "parse argument options", - "main": "index.js", - "devDependencies": { - "@ljharb/eslint-config": "^21.0.0", - "aud": "^2.0.1", - "auto-changelog": "^2.4.0", - "eslint": "=8.8.0", - "in-publish": "^2.0.1", - "npmignore": "^0.3.0", - "nyc": "^10.3.2", - "safe-publish-latest": "^2.0.0", - "tape": "^5.6.1" - }, - "scripts": { - "prepack": "npmignore --auto --commentLines=auto", - "prepublishOnly": "safe-publish-latest", - "prepublish": "not-in-publish || npm run prepublishOnly", - "lint": "eslint --ext=js,mjs .", - "pretest": "npm run lint", - "tests-only": "nyc tape test/*.js", - "test": "npm run tests-only", - "posttest": "aud --production", - "version": "auto-changelog && git add CHANGELOG.md", - "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" - }, - "testling": { - "files": "test/*.js", - "browsers": [ - "ie/6..latest", - "ff/5", - "firefox/latest", - "chrome/10", - "chrome/latest", - "safari/5.1", - "safari/latest", - "opera/12" - ] - }, - "repository": { - "type": "git", - "url": "git://github.com/minimistjs/minimist.git" - }, - "homepage": "https://github.com/minimistjs/minimist", - "keywords": [ - "argv", - "getopt", - "parser", - "optimist" - ], - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - }, - "license": "MIT", - "auto-changelog": { - "output": "CHANGELOG.md", - "template": "keepachangelog", - "unreleased": false, - "commitLimit": false, - "backfillLimit": false, - "hideCredit": true - }, - "publishConfig": { - "ignore": [ - ".github/workflows" - ] - } -} diff --git a/project starter code/node_modules/minimist/test/all_bool.js b/project starter code/node_modules/minimist/test/all_bool.js deleted file mode 100644 index ac835483..00000000 --- a/project starter code/node_modules/minimist/test/all_bool.js +++ /dev/null @@ -1,32 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('flag boolean true (default all --args to boolean)', function (t) { - var argv = parse(['moo', '--honk', 'cow'], { - boolean: true - }); - - t.deepEqual(argv, { - honk: true, - _: ['moo', 'cow'] - }); - - t.deepEqual(typeof argv.honk, 'boolean'); - t.end(); -}); - -test('flag boolean true only affects double hyphen arguments without equals signs', function (t) { - var argv = parse(['moo', '--honk', 'cow', '-p', '55', '--tacos=good'], { - boolean: true - }); - - t.deepEqual(argv, { - honk: true, - tacos: 'good', - p: 55, - _: ['moo', 'cow'] - }); - - t.deepEqual(typeof argv.honk, 'boolean'); - t.end(); -}); diff --git a/project starter code/node_modules/minimist/test/bool.js b/project starter code/node_modules/minimist/test/bool.js deleted file mode 100644 index 5f7dbde1..00000000 --- a/project starter code/node_modules/minimist/test/bool.js +++ /dev/null @@ -1,178 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('flag boolean default false', function (t) { - var argv = parse(['moo'], { - boolean: ['t', 'verbose'], - default: { verbose: false, t: false } - }); - - t.deepEqual(argv, { - verbose: false, - t: false, - _: ['moo'] - }); - - t.deepEqual(typeof argv.verbose, 'boolean'); - t.deepEqual(typeof argv.t, 'boolean'); - t.end(); - -}); - -test('boolean groups', function (t) { - var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], { - boolean: ['x','y','z'] - }); - - t.deepEqual(argv, { - x : true, - y : false, - z : true, - _ : [ 'one', 'two', 'three' ] - }); - - t.deepEqual(typeof argv.x, 'boolean'); - t.deepEqual(typeof argv.y, 'boolean'); - t.deepEqual(typeof argv.z, 'boolean'); - t.end(); -}); -test('boolean and alias with chainable api', function (t) { - var aliased = [ '-h', 'derp' ]; - var regular = [ '--herp', 'derp' ]; - var opts = { - herp: { alias: 'h', boolean: true } - }; - var aliasedArgv = parse(aliased, { - boolean: 'herp', - alias: { h: 'herp' } - }); - var propertyArgv = parse(regular, { - boolean: 'herp', - alias: { h: 'herp' } - }); - var expected = { - herp: true, - h: true, - '_': [ 'derp' ] - }; - - t.same(aliasedArgv, expected); - t.same(propertyArgv, expected); - t.end(); -}); - -test('boolean and alias with options hash', function (t) { - var aliased = [ '-h', 'derp' ]; - var regular = [ '--herp', 'derp' ]; - var opts = { - alias: { 'h': 'herp' }, - boolean: 'herp' - }; - var aliasedArgv = parse(aliased, opts); - var propertyArgv = parse(regular, opts); - var expected = { - herp: true, - h: true, - '_': [ 'derp' ] - }; - t.same(aliasedArgv, expected); - t.same(propertyArgv, expected); - t.end(); -}); - -test('boolean and alias array with options hash', function (t) { - var aliased = [ '-h', 'derp' ]; - var regular = [ '--herp', 'derp' ]; - var alt = [ '--harp', 'derp' ]; - var opts = { - alias: { 'h': ['herp', 'harp'] }, - boolean: 'h' - }; - var aliasedArgv = parse(aliased, opts); - var propertyArgv = parse(regular, opts); - var altPropertyArgv = parse(alt, opts); - var expected = { - harp: true, - herp: true, - h: true, - '_': [ 'derp' ] - }; - t.same(aliasedArgv, expected); - t.same(propertyArgv, expected); - t.same(altPropertyArgv, expected); - t.end(); -}); - -test('boolean and alias using explicit true', function (t) { - var aliased = [ '-h', 'true' ]; - var regular = [ '--herp', 'true' ]; - var opts = { - alias: { h: 'herp' }, - boolean: 'h' - }; - var aliasedArgv = parse(aliased, opts); - var propertyArgv = parse(regular, opts); - var expected = { - herp: true, - h: true, - '_': [ ] - }; - - t.same(aliasedArgv, expected); - t.same(propertyArgv, expected); - t.end(); -}); - -// regression, see https://github.com/substack/node-optimist/issues/71 -test('boolean and --x=true', function(t) { - var parsed = parse(['--boool', '--other=true'], { - boolean: 'boool' - }); - - t.same(parsed.boool, true); - t.same(parsed.other, 'true'); - - parsed = parse(['--boool', '--other=false'], { - boolean: 'boool' - }); - - t.same(parsed.boool, true); - t.same(parsed.other, 'false'); - t.end(); -}); - -test('boolean --boool=true', function (t) { - var parsed = parse(['--boool=true'], { - default: { - boool: false - }, - boolean: ['boool'] - }); - - t.same(parsed.boool, true); - t.end(); -}); - -test('boolean --boool=false', function (t) { - var parsed = parse(['--boool=false'], { - default: { - boool: true - }, - boolean: ['boool'] - }); - - t.same(parsed.boool, false); - t.end(); -}); - -test('boolean using something similar to true', function (t) { - var opts = { boolean: 'h' }; - var result = parse(['-h', 'true.txt'], opts); - var expected = { - h: true, - '_': ['true.txt'] - }; - - t.same(result, expected); - t.end(); -}); \ No newline at end of file diff --git a/project starter code/node_modules/minimist/test/dash.js b/project starter code/node_modules/minimist/test/dash.js deleted file mode 100644 index 5a4fa5be..00000000 --- a/project starter code/node_modules/minimist/test/dash.js +++ /dev/null @@ -1,31 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('-', function (t) { - t.plan(5); - t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] }); - t.deepEqual(parse([ '-' ]), { _: [ '-' ] }); - t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] }); - t.deepEqual( - parse([ '-b', '-' ], { boolean: 'b' }), - { b: true, _: [ '-' ] } - ); - t.deepEqual( - parse([ '-s', '-' ], { string: 's' }), - { s: '-', _: [] } - ); -}); - -test('-a -- b', function (t) { - t.plan(3); - t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] }); - t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); - t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] }); -}); - -test('move arguments after the -- into their own `--` array', function(t) { - t.plan(1); - t.deepEqual( - parse([ '--name', 'John', 'before', '--', 'after' ], { '--': true }), - { name: 'John', _: [ 'before' ], '--': [ 'after' ] }); -}); diff --git a/project starter code/node_modules/minimist/test/default_bool.js b/project starter code/node_modules/minimist/test/default_bool.js deleted file mode 100644 index 780a3112..00000000 --- a/project starter code/node_modules/minimist/test/default_bool.js +++ /dev/null @@ -1,35 +0,0 @@ -var test = require('tape'); -var parse = require('../'); - -test('boolean default true', function (t) { - var argv = parse([], { - boolean: 'sometrue', - default: { sometrue: true } - }); - t.equal(argv.sometrue, true); - t.end(); -}); - -test('boolean default false', function (t) { - var argv = parse([], { - boolean: 'somefalse', - default: { somefalse: false } - }); - t.equal(argv.somefalse, false); - t.end(); -}); - -test('boolean default to null', function (t) { - var argv = parse([], { - boolean: 'maybe', - default: { maybe: null } - }); - t.equal(argv.maybe, null); - var argv = parse(['--maybe'], { - boolean: 'maybe', - default: { maybe: null } - }); - t.equal(argv.maybe, true); - t.end(); - -}) diff --git a/project starter code/node_modules/minimist/test/dotted.js b/project starter code/node_modules/minimist/test/dotted.js deleted file mode 100644 index d8b3e856..00000000 --- a/project starter code/node_modules/minimist/test/dotted.js +++ /dev/null @@ -1,22 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('dotted alias', function (t) { - var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); - t.equal(argv.a.b, 22); - t.equal(argv.aa.bb, 22); - t.end(); -}); - -test('dotted default', function (t) { - var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}}); - t.equal(argv.a.b, 11); - t.equal(argv.aa.bb, 11); - t.end(); -}); - -test('dotted default with no alias', function (t) { - var argv = parse('', {default: {'a.b': 11}}); - t.equal(argv.a.b, 11); - t.end(); -}); diff --git a/project starter code/node_modules/minimist/test/kv_short.js b/project starter code/node_modules/minimist/test/kv_short.js deleted file mode 100644 index f813b305..00000000 --- a/project starter code/node_modules/minimist/test/kv_short.js +++ /dev/null @@ -1,16 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('short -k=v' , function (t) { - t.plan(1); - - var argv = parse([ '-b=123' ]); - t.deepEqual(argv, { b: 123, _: [] }); -}); - -test('multi short -k=v' , function (t) { - t.plan(1); - - var argv = parse([ '-a=whatever', '-b=robots' ]); - t.deepEqual(argv, { a: 'whatever', b: 'robots', _: [] }); -}); diff --git a/project starter code/node_modules/minimist/test/long.js b/project starter code/node_modules/minimist/test/long.js deleted file mode 100644 index 5d3a1e09..00000000 --- a/project starter code/node_modules/minimist/test/long.js +++ /dev/null @@ -1,31 +0,0 @@ -var test = require('tape'); -var parse = require('../'); - -test('long opts', function (t) { - t.deepEqual( - parse([ '--bool' ]), - { bool : true, _ : [] }, - 'long boolean' - ); - t.deepEqual( - parse([ '--pow', 'xixxle' ]), - { pow : 'xixxle', _ : [] }, - 'long capture sp' - ); - t.deepEqual( - parse([ '--pow=xixxle' ]), - { pow : 'xixxle', _ : [] }, - 'long capture eq' - ); - t.deepEqual( - parse([ '--host', 'localhost', '--port', '555' ]), - { host : 'localhost', port : 555, _ : [] }, - 'long captures sp' - ); - t.deepEqual( - parse([ '--host=localhost', '--port=555' ]), - { host : 'localhost', port : 555, _ : [] }, - 'long captures eq' - ); - t.end(); -}); diff --git a/project starter code/node_modules/minimist/test/num.js b/project starter code/node_modules/minimist/test/num.js deleted file mode 100644 index 2cc77f4d..00000000 --- a/project starter code/node_modules/minimist/test/num.js +++ /dev/null @@ -1,36 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('nums', function (t) { - var argv = parse([ - '-x', '1234', - '-y', '5.67', - '-z', '1e7', - '-w', '10f', - '--hex', '0xdeadbeef', - '789' - ]); - t.deepEqual(argv, { - x : 1234, - y : 5.67, - z : 1e7, - w : '10f', - hex : 0xdeadbeef, - _ : [ 789 ] - }); - t.deepEqual(typeof argv.x, 'number'); - t.deepEqual(typeof argv.y, 'number'); - t.deepEqual(typeof argv.z, 'number'); - t.deepEqual(typeof argv.w, 'string'); - t.deepEqual(typeof argv.hex, 'number'); - t.deepEqual(typeof argv._[0], 'number'); - t.end(); -}); - -test('already a number', function (t) { - var argv = parse([ '-x', 1234, 789 ]); - t.deepEqual(argv, { x : 1234, _ : [ 789 ] }); - t.deepEqual(typeof argv.x, 'number'); - t.deepEqual(typeof argv._[0], 'number'); - t.end(); -}); diff --git a/project starter code/node_modules/minimist/test/parse.js b/project starter code/node_modules/minimist/test/parse.js deleted file mode 100644 index 7b4a2a17..00000000 --- a/project starter code/node_modules/minimist/test/parse.js +++ /dev/null @@ -1,197 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('parse args', function (t) { - t.deepEqual( - parse([ '--no-moo' ]), - { moo : false, _ : [] }, - 'no' - ); - t.deepEqual( - parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]), - { v : ['a','b','c'], _ : [] }, - 'multi' - ); - t.end(); -}); - -test('comprehensive', function (t) { - t.deepEqual( - parse([ - '--name=meowmers', 'bare', '-cats', 'woo', - '-h', 'awesome', '--multi=quux', - '--key', 'value', - '-b', '--bool', '--no-meep', '--multi=baz', - '--', '--not-a-flag', 'eek' - ]), - { - c : true, - a : true, - t : true, - s : 'woo', - h : 'awesome', - b : true, - bool : true, - key : 'value', - multi : [ 'quux', 'baz' ], - meep : false, - name : 'meowmers', - _ : [ 'bare', '--not-a-flag', 'eek' ] - } - ); - t.end(); -}); - -test('flag boolean', function (t) { - var argv = parse([ '-t', 'moo' ], { boolean: 't' }); - t.deepEqual(argv, { t : true, _ : [ 'moo' ] }); - t.deepEqual(typeof argv.t, 'boolean'); - t.end(); -}); - -test('flag boolean value', function (t) { - var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], { - boolean: [ 't', 'verbose' ], - default: { verbose: true } - }); - - t.deepEqual(argv, { - verbose: false, - t: true, - _: ['moo'] - }); - - t.deepEqual(typeof argv.verbose, 'boolean'); - t.deepEqual(typeof argv.t, 'boolean'); - t.end(); -}); - -test('newlines in params' , function (t) { - var args = parse([ '-s', "X\nX" ]) - t.deepEqual(args, { _ : [], s : "X\nX" }); - - // reproduce in bash: - // VALUE="new - // line" - // node program.js --s="$VALUE" - args = parse([ "--s=X\nX" ]) - t.deepEqual(args, { _ : [], s : "X\nX" }); - t.end(); -}); - -test('strings' , function (t) { - var s = parse([ '-s', '0001234' ], { string: 's' }).s; - t.equal(s, '0001234'); - t.equal(typeof s, 'string'); - - var x = parse([ '-x', '56' ], { string: 'x' }).x; - t.equal(x, '56'); - t.equal(typeof x, 'string'); - t.end(); -}); - -test('stringArgs', function (t) { - var s = parse([ ' ', ' ' ], { string: '_' })._; - t.same(s.length, 2); - t.same(typeof s[0], 'string'); - t.same(s[0], ' '); - t.same(typeof s[1], 'string'); - t.same(s[1], ' '); - t.end(); -}); - -test('empty strings', function(t) { - var s = parse([ '-s' ], { string: 's' }).s; - t.equal(s, ''); - t.equal(typeof s, 'string'); - - var str = parse([ '--str' ], { string: 'str' }).str; - t.equal(str, ''); - t.equal(typeof str, 'string'); - - var letters = parse([ '-art' ], { - string: [ 'a', 't' ] - }); - - t.equal(letters.a, ''); - t.equal(letters.r, true); - t.equal(letters.t, ''); - - t.end(); -}); - - -test('string and alias', function(t) { - var x = parse([ '--str', '000123' ], { - string: 's', - alias: { s: 'str' } - }); - - t.equal(x.str, '000123'); - t.equal(typeof x.str, 'string'); - t.equal(x.s, '000123'); - t.equal(typeof x.s, 'string'); - - var y = parse([ '-s', '000123' ], { - string: 'str', - alias: { str: 's' } - }); - - t.equal(y.str, '000123'); - t.equal(typeof y.str, 'string'); - t.equal(y.s, '000123'); - t.equal(typeof y.s, 'string'); - t.end(); -}); - -test('slashBreak', function (t) { - t.same( - parse([ '-I/foo/bar/baz' ]), - { I : '/foo/bar/baz', _ : [] } - ); - t.same( - parse([ '-xyz/foo/bar/baz' ]), - { x : true, y : true, z : '/foo/bar/baz', _ : [] } - ); - t.end(); -}); - -test('alias', function (t) { - var argv = parse([ '-f', '11', '--zoom', '55' ], { - alias: { z: 'zoom' } - }); - t.equal(argv.zoom, 55); - t.equal(argv.z, argv.zoom); - t.equal(argv.f, 11); - t.end(); -}); - -test('multiAlias', function (t) { - var argv = parse([ '-f', '11', '--zoom', '55' ], { - alias: { z: [ 'zm', 'zoom' ] } - }); - t.equal(argv.zoom, 55); - t.equal(argv.z, argv.zoom); - t.equal(argv.z, argv.zm); - t.equal(argv.f, 11); - t.end(); -}); - -test('nested dotted objects', function (t) { - var argv = parse([ - '--foo.bar', '3', '--foo.baz', '4', - '--foo.quux.quibble', '5', '--foo.quux.o_O', - '--beep.boop' - ]); - - t.same(argv.foo, { - bar : 3, - baz : 4, - quux : { - quibble : 5, - o_O : true - } - }); - t.same(argv.beep, { boop : true }); - t.end(); -}); diff --git a/project starter code/node_modules/minimist/test/parse_modified.js b/project starter code/node_modules/minimist/test/parse_modified.js deleted file mode 100644 index ab620dc5..00000000 --- a/project starter code/node_modules/minimist/test/parse_modified.js +++ /dev/null @@ -1,9 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('parse with modifier functions' , function (t) { - t.plan(1); - - var argv = parse([ '-b', '123' ], { boolean: 'b' }); - t.deepEqual(argv, { b: true, _: [123] }); -}); diff --git a/project starter code/node_modules/minimist/test/proto.js b/project starter code/node_modules/minimist/test/proto.js deleted file mode 100644 index 4ac62df2..00000000 --- a/project starter code/node_modules/minimist/test/proto.js +++ /dev/null @@ -1,60 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('proto pollution', function (t) { - var argv = parse(['--__proto__.x','123']); - t.equal({}.x, undefined); - t.equal(argv.__proto__.x, undefined); - t.equal(argv.x, undefined); - t.end(); -}); - -test('proto pollution (array)', function (t) { - var argv = parse(['--x','4','--x','5','--x.__proto__.z','789']); - t.equal({}.z, undefined); - t.deepEqual(argv.x, [4,5]); - t.equal(argv.x.z, undefined); - t.equal(argv.x.__proto__.z, undefined); - t.end(); -}); - -test('proto pollution (number)', function (t) { - var argv = parse(['--x','5','--x.__proto__.z','100']); - t.equal({}.z, undefined); - t.equal((4).z, undefined); - t.equal(argv.x, 5); - t.equal(argv.x.z, undefined); - t.end(); -}); - -test('proto pollution (string)', function (t) { - var argv = parse(['--x','abc','--x.__proto__.z','def']); - t.equal({}.z, undefined); - t.equal('...'.z, undefined); - t.equal(argv.x, 'abc'); - t.equal(argv.x.z, undefined); - t.end(); -}); - -test('proto pollution (constructor)', function (t) { - var argv = parse(['--constructor.prototype.y','123']); - t.equal({}.y, undefined); - t.equal(argv.y, undefined); - t.end(); -}); - -test('proto pollution (constructor function)', function (t) { - var argv = parse(['--_.concat.constructor.prototype.y', '123']); - function fnToBeTested() {} - t.equal(fnToBeTested.y, undefined); - t.equal(argv.y, undefined); - t.end(); -}); - -// powered by snyk - https://github.com/backstage/backstage/issues/10343 -test('proto pollution (constructor function) snyk', function (t) { - var argv = parse('--_.constructor.constructor.prototype.foo bar'.split(' ')); - t.equal((function(){}).foo, undefined); - t.equal(argv.y, undefined); - t.end(); -}) diff --git a/project starter code/node_modules/minimist/test/short.js b/project starter code/node_modules/minimist/test/short.js deleted file mode 100644 index d513a1c2..00000000 --- a/project starter code/node_modules/minimist/test/short.js +++ /dev/null @@ -1,67 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('numeric short args', function (t) { - t.plan(2); - t.deepEqual(parse([ '-n123' ]), { n: 123, _: [] }); - t.deepEqual( - parse([ '-123', '456' ]), - { 1: true, 2: true, 3: 456, _: [] } - ); -}); - -test('short', function (t) { - t.deepEqual( - parse([ '-b' ]), - { b : true, _ : [] }, - 'short boolean' - ); - t.deepEqual( - parse([ 'foo', 'bar', 'baz' ]), - { _ : [ 'foo', 'bar', 'baz' ] }, - 'bare' - ); - t.deepEqual( - parse([ '-cats' ]), - { c : true, a : true, t : true, s : true, _ : [] }, - 'group' - ); - t.deepEqual( - parse([ '-cats', 'meow' ]), - { c : true, a : true, t : true, s : 'meow', _ : [] }, - 'short group next' - ); - t.deepEqual( - parse([ '-h', 'localhost' ]), - { h : 'localhost', _ : [] }, - 'short capture' - ); - t.deepEqual( - parse([ '-h', 'localhost', '-p', '555' ]), - { h : 'localhost', p : 555, _ : [] }, - 'short captures' - ); - t.end(); -}); - -test('mixed short bool and capture', function (t) { - t.same( - parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), - { - f : true, p : 555, h : 'localhost', - _ : [ 'script.js' ] - } - ); - t.end(); -}); - -test('short and long', function (t) { - t.deepEqual( - parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), - { - f : true, p : 555, h : 'localhost', - _ : [ 'script.js' ] - } - ); - t.end(); -}); diff --git a/project starter code/node_modules/minimist/test/stop_early.js b/project starter code/node_modules/minimist/test/stop_early.js deleted file mode 100644 index bdf9fbcb..00000000 --- a/project starter code/node_modules/minimist/test/stop_early.js +++ /dev/null @@ -1,15 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('stops parsing on the first non-option when stopEarly is set', function (t) { - var argv = parse(['--aaa', 'bbb', 'ccc', '--ddd'], { - stopEarly: true - }); - - t.deepEqual(argv, { - aaa: 'bbb', - _: ['ccc', '--ddd'] - }); - - t.end(); -}); diff --git a/project starter code/node_modules/minimist/test/unknown.js b/project starter code/node_modules/minimist/test/unknown.js deleted file mode 100644 index 462a36bd..00000000 --- a/project starter code/node_modules/minimist/test/unknown.js +++ /dev/null @@ -1,102 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('boolean and alias is not unknown', function (t) { - var unknown = []; - function unknownFn(arg) { - unknown.push(arg); - return false; - } - var aliased = [ '-h', 'true', '--derp', 'true' ]; - var regular = [ '--herp', 'true', '-d', 'true' ]; - var opts = { - alias: { h: 'herp' }, - boolean: 'h', - unknown: unknownFn - }; - var aliasedArgv = parse(aliased, opts); - var propertyArgv = parse(regular, opts); - - t.same(unknown, ['--derp', '-d']); - t.end(); -}); - -test('flag boolean true any double hyphen argument is not unknown', function (t) { - var unknown = []; - function unknownFn(arg) { - unknown.push(arg); - return false; - } - var argv = parse(['--honk', '--tacos=good', 'cow', '-p', '55'], { - boolean: true, - unknown: unknownFn - }); - t.same(unknown, ['--tacos=good', 'cow', '-p']); - t.same(argv, { - honk: true, - _: [] - }); - t.end(); -}); - -test('string and alias is not unknown', function (t) { - var unknown = []; - function unknownFn(arg) { - unknown.push(arg); - return false; - } - var aliased = [ '-h', 'hello', '--derp', 'goodbye' ]; - var regular = [ '--herp', 'hello', '-d', 'moon' ]; - var opts = { - alias: { h: 'herp' }, - string: 'h', - unknown: unknownFn - }; - var aliasedArgv = parse(aliased, opts); - var propertyArgv = parse(regular, opts); - - t.same(unknown, ['--derp', '-d']); - t.end(); -}); - -test('default and alias is not unknown', function (t) { - var unknown = []; - function unknownFn(arg) { - unknown.push(arg); - return false; - } - var aliased = [ '-h', 'hello' ]; - var regular = [ '--herp', 'hello' ]; - var opts = { - default: { 'h': 'bar' }, - alias: { 'h': 'herp' }, - unknown: unknownFn - }; - var aliasedArgv = parse(aliased, opts); - var propertyArgv = parse(regular, opts); - - t.same(unknown, []); - t.end(); - unknownFn(); // exercise fn for 100% coverage -}); - -test('value following -- is not unknown', function (t) { - var unknown = []; - function unknownFn(arg) { - unknown.push(arg); - return false; - } - var aliased = [ '--bad', '--', 'good', 'arg' ]; - var opts = { - '--': true, - unknown: unknownFn - }; - var argv = parse(aliased, opts); - - t.same(unknown, ['--bad']); - t.same(argv, { - '--': ['good', 'arg'], - '_': [] - }) - t.end(); -}); diff --git a/project starter code/node_modules/minimist/test/whitespace.js b/project starter code/node_modules/minimist/test/whitespace.js deleted file mode 100644 index 8a52a58c..00000000 --- a/project starter code/node_modules/minimist/test/whitespace.js +++ /dev/null @@ -1,8 +0,0 @@ -var parse = require('../'); -var test = require('tape'); - -test('whitespace should be whitespace' , function (t) { - t.plan(1); - var x = parse([ '-x', '\t' ]).x; - t.equal(x, '\t'); -}); diff --git a/project starter code/node_modules/mkdirp/LICENSE b/project starter code/node_modules/mkdirp/LICENSE deleted file mode 100644 index 432d1aeb..00000000 --- a/project starter code/node_modules/mkdirp/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright 2010 James Halliday (mail@substack.net) - -This project is free software released under the MIT/X11 license: - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/project starter code/node_modules/mkdirp/bin/cmd.js b/project starter code/node_modules/mkdirp/bin/cmd.js deleted file mode 100644 index d95de15a..00000000 --- a/project starter code/node_modules/mkdirp/bin/cmd.js +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env node - -var mkdirp = require('../'); -var minimist = require('minimist'); -var fs = require('fs'); - -var argv = minimist(process.argv.slice(2), { - alias: { m: 'mode', h: 'help' }, - string: [ 'mode' ] -}); -if (argv.help) { - fs.createReadStream(__dirname + '/usage.txt').pipe(process.stdout); - return; -} - -var paths = argv._.slice(); -var mode = argv.mode ? parseInt(argv.mode, 8) : undefined; - -(function next () { - if (paths.length === 0) return; - var p = paths.shift(); - - if (mode === undefined) mkdirp(p, cb) - else mkdirp(p, mode, cb) - - function cb (err) { - if (err) { - console.error(err.message); - process.exit(1); - } - else next(); - } -})(); diff --git a/project starter code/node_modules/mkdirp/bin/usage.txt b/project starter code/node_modules/mkdirp/bin/usage.txt deleted file mode 100644 index f952aa2c..00000000 --- a/project starter code/node_modules/mkdirp/bin/usage.txt +++ /dev/null @@ -1,12 +0,0 @@ -usage: mkdirp [DIR1,DIR2..] {OPTIONS} - - Create each supplied directory including any necessary parent directories that - don't yet exist. - - If the directory already exists, do nothing. - -OPTIONS are: - - -m, --mode If a directory needs to be created, set the mode as an octal - permission string. - diff --git a/project starter code/node_modules/mkdirp/index.js b/project starter code/node_modules/mkdirp/index.js deleted file mode 100644 index 0890ac3b..00000000 --- a/project starter code/node_modules/mkdirp/index.js +++ /dev/null @@ -1,102 +0,0 @@ -var path = require('path'); -var fs = require('fs'); -var _0777 = parseInt('0777', 8); - -module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; - -function mkdirP (p, opts, f, made) { - if (typeof opts === 'function') { - f = opts; - opts = {}; - } - else if (!opts || typeof opts !== 'object') { - opts = { mode: opts }; - } - - var mode = opts.mode; - var xfs = opts.fs || fs; - - if (mode === undefined) { - mode = _0777 - } - if (!made) made = null; - - var cb = f || /* istanbul ignore next */ function () {}; - p = path.resolve(p); - - xfs.mkdir(p, mode, function (er) { - if (!er) { - made = made || p; - return cb(null, made); - } - switch (er.code) { - case 'ENOENT': - /* istanbul ignore if */ - if (path.dirname(p) === p) return cb(er); - mkdirP(path.dirname(p), opts, function (er, made) { - /* istanbul ignore if */ - if (er) cb(er, made); - else mkdirP(p, opts, cb, made); - }); - break; - - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - xfs.stat(p, function (er2, stat) { - // if the stat fails, then that's super weird. - // let the original error be the failure reason. - if (er2 || !stat.isDirectory()) cb(er, made) - else cb(null, made); - }); - break; - } - }); -} - -mkdirP.sync = function sync (p, opts, made) { - if (!opts || typeof opts !== 'object') { - opts = { mode: opts }; - } - - var mode = opts.mode; - var xfs = opts.fs || fs; - - if (mode === undefined) { - mode = _0777 - } - if (!made) made = null; - - p = path.resolve(p); - - try { - xfs.mkdirSync(p, mode); - made = made || p; - } - catch (err0) { - switch (err0.code) { - case 'ENOENT' : - made = sync(path.dirname(p), opts, made); - sync(p, opts, made); - break; - - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - var stat; - try { - stat = xfs.statSync(p); - } - catch (err1) /* istanbul ignore next */ { - throw err0; - } - /* istanbul ignore if */ - if (!stat.isDirectory()) throw err0; - break; - } - } - - return made; -}; diff --git a/project starter code/node_modules/mkdirp/package.json b/project starter code/node_modules/mkdirp/package.json deleted file mode 100644 index 951e58da..00000000 --- a/project starter code/node_modules/mkdirp/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "mkdirp", - "description": "Recursively mkdir, like `mkdir -p`", - "version": "0.5.6", - "publishConfig": { - "tag": "legacy" - }, - "author": "James Halliday (http://substack.net)", - "main": "index.js", - "keywords": [ - "mkdir", - "directory" - ], - "repository": { - "type": "git", - "url": "https://github.com/substack/node-mkdirp.git" - }, - "scripts": { - "test": "tap test/*.js" - }, - "dependencies": { - "minimist": "^1.2.6" - }, - "devDependencies": { - "tap": "^16.0.1" - }, - "bin": "bin/cmd.js", - "license": "MIT", - "files": [ - "bin", - "index.js" - ] -} diff --git a/project starter code/node_modules/mkdirp/readme.markdown b/project starter code/node_modules/mkdirp/readme.markdown deleted file mode 100644 index fc314bfb..00000000 --- a/project starter code/node_modules/mkdirp/readme.markdown +++ /dev/null @@ -1,100 +0,0 @@ -# mkdirp - -Like `mkdir -p`, but in node.js! - -[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp) - -# example - -## pow.js - -```js -var mkdirp = require('mkdirp'); - -mkdirp('/tmp/foo/bar/baz', function (err) { - if (err) console.error(err) - else console.log('pow!') -}); -``` - -Output - -``` -pow! -``` - -And now /tmp/foo/bar/baz exists, huzzah! - -# methods - -```js -var mkdirp = require('mkdirp'); -``` - -## mkdirp(dir, opts, cb) - -Create a new directory and any necessary subdirectories at `dir` with octal -permission string `opts.mode`. If `opts` is a non-object, it will be treated as -the `opts.mode`. - -If `opts.mode` isn't specified, it defaults to `0777`. - -`cb(err, made)` fires with the error or the first directory `made` -that had to be created, if any. - -You can optionally pass in an alternate `fs` implementation by passing in -`opts.fs`. Your implementation should have `opts.fs.mkdir(path, mode, cb)` and -`opts.fs.stat(path, cb)`. - -## mkdirp.sync(dir, opts) - -Synchronously create a new directory and any necessary subdirectories at `dir` -with octal permission string `opts.mode`. If `opts` is a non-object, it will be -treated as the `opts.mode`. - -If `opts.mode` isn't specified, it defaults to `0777`. - -Returns the first directory that had to be created, if any. - -You can optionally pass in an alternate `fs` implementation by passing in -`opts.fs`. Your implementation should have `opts.fs.mkdirSync(path, mode)` and -`opts.fs.statSync(path)`. - -# usage - -This package also ships with a `mkdirp` command. - -``` -usage: mkdirp [DIR1,DIR2..] {OPTIONS} - - Create each supplied directory including any necessary parent directories that - don't yet exist. - - If the directory already exists, do nothing. - -OPTIONS are: - - -m, --mode If a directory needs to be created, set the mode as an octal - permission string. - -``` - -# install - -With [npm](http://npmjs.org) do: - -``` -npm install mkdirp -``` - -to get the library, or - -``` -npm install -g mkdirp -``` - -to get the command. - -# license - -MIT diff --git a/project starter code/node_modules/node-fetch/LICENSE.md b/project starter code/node_modules/node-fetch/LICENSE.md new file mode 100644 index 00000000..660ffecb --- /dev/null +++ b/project starter code/node_modules/node-fetch/LICENSE.md @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2016 David Frank + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/project starter code/node_modules/node-fetch/README.md b/project starter code/node_modules/node-fetch/README.md new file mode 100644 index 00000000..55f09b7f --- /dev/null +++ b/project starter code/node_modules/node-fetch/README.md @@ -0,0 +1,634 @@ +node-fetch +========== + +[![npm version][npm-image]][npm-url] +[![build status][travis-image]][travis-url] +[![coverage status][codecov-image]][codecov-url] +[![install size][install-size-image]][install-size-url] +[![Discord][discord-image]][discord-url] + +A light-weight module that brings `window.fetch` to Node.js + +(We are looking for [v2 maintainers and collaborators](https://github.com/bitinn/node-fetch/issues/567)) + +[![Backers][opencollective-image]][opencollective-url] + + + +- [Motivation](#motivation) +- [Features](#features) +- [Difference from client-side fetch](#difference-from-client-side-fetch) +- [Installation](#installation) +- [Loading and configuring the module](#loading-and-configuring-the-module) +- [Common Usage](#common-usage) + - [Plain text or HTML](#plain-text-or-html) + - [JSON](#json) + - [Simple Post](#simple-post) + - [Post with JSON](#post-with-json) + - [Post with form parameters](#post-with-form-parameters) + - [Handling exceptions](#handling-exceptions) + - [Handling client and server errors](#handling-client-and-server-errors) +- [Advanced Usage](#advanced-usage) + - [Streams](#streams) + - [Buffer](#buffer) + - [Accessing Headers and other Meta data](#accessing-headers-and-other-meta-data) + - [Extract Set-Cookie Header](#extract-set-cookie-header) + - [Post data using a file stream](#post-data-using-a-file-stream) + - [Post with form-data (detect multipart)](#post-with-form-data-detect-multipart) + - [Request cancellation with AbortSignal](#request-cancellation-with-abortsignal) +- [API](#api) + - [fetch(url[, options])](#fetchurl-options) + - [Options](#options) + - [Class: Request](#class-request) + - [Class: Response](#class-response) + - [Class: Headers](#class-headers) + - [Interface: Body](#interface-body) + - [Class: FetchError](#class-fetcherror) +- [License](#license) +- [Acknowledgement](#acknowledgement) + + + +## Motivation + +Instead of implementing `XMLHttpRequest` in Node.js to run browser-specific [Fetch polyfill](https://github.com/github/fetch), why not go from native `http` to `fetch` API directly? Hence, `node-fetch`, minimal code for a `window.fetch` compatible API on Node.js runtime. + +See Matt Andrews' [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch) or Leonardo Quixada's [cross-fetch](https://github.com/lquixada/cross-fetch) for isomorphic usage (exports `node-fetch` for server-side, `whatwg-fetch` for client-side). + +## Features + +- Stay consistent with `window.fetch` API. +- Make conscious trade-off when following [WHATWG fetch spec][whatwg-fetch] and [stream spec](https://streams.spec.whatwg.org/) implementation details, document known differences. +- Use native promise but allow substituting it with [insert your favorite promise library]. +- Use native Node streams for body on both request and response. +- Decode content encoding (gzip/deflate) properly and convert string output (such as `res.text()` and `res.json()`) to UTF-8 automatically. +- Useful extensions such as timeout, redirect limit, response size limit, [explicit errors](ERROR-HANDLING.md) for troubleshooting. + +## Difference from client-side fetch + +- See [Known Differences](LIMITS.md) for details. +- If you happen to use a missing feature that `window.fetch` offers, feel free to open an issue. +- Pull requests are welcomed too! + +## Installation + +Current stable release (`2.x`) + +```sh +$ npm install node-fetch +``` + +## Loading and configuring the module +We suggest you load the module via `require` until the stabilization of ES modules in node: +```js +const fetch = require('node-fetch'); +``` + +If you are using a Promise library other than native, set it through `fetch.Promise`: +```js +const Bluebird = require('bluebird'); + +fetch.Promise = Bluebird; +``` + +## Common Usage + +NOTE: The documentation below is up-to-date with `2.x` releases; see the [`1.x` readme](https://github.com/bitinn/node-fetch/blob/1.x/README.md), [changelog](https://github.com/bitinn/node-fetch/blob/1.x/CHANGELOG.md) and [2.x upgrade guide](UPGRADE-GUIDE.md) for the differences. + +#### Plain text or HTML +```js +fetch('https://github.com/') + .then(res => res.text()) + .then(body => console.log(body)); +``` + +#### JSON + +```js + +fetch('https://api.github.com/users/github') + .then(res => res.json()) + .then(json => console.log(json)); +``` + +#### Simple Post +```js +fetch('https://httpbin.org/post', { method: 'POST', body: 'a=1' }) + .then(res => res.json()) // expecting a json response + .then(json => console.log(json)); +``` + +#### Post with JSON + +```js +const body = { a: 1 }; + +fetch('https://httpbin.org/post', { + method: 'post', + body: JSON.stringify(body), + headers: { 'Content-Type': 'application/json' }, + }) + .then(res => res.json()) + .then(json => console.log(json)); +``` + +#### Post with form parameters +`URLSearchParams` is available in Node.js as of v7.5.0. See [official documentation](https://nodejs.org/api/url.html#url_class_urlsearchparams) for more usage methods. + +NOTE: The `Content-Type` header is only set automatically to `x-www-form-urlencoded` when an instance of `URLSearchParams` is given as such: + +```js +const { URLSearchParams } = require('url'); + +const params = new URLSearchParams(); +params.append('a', 1); + +fetch('https://httpbin.org/post', { method: 'POST', body: params }) + .then(res => res.json()) + .then(json => console.log(json)); +``` + +#### Handling exceptions +NOTE: 3xx-5xx responses are *NOT* exceptions and should be handled in `then()`; see the next section for more information. + +Adding a catch to the fetch promise chain will catch *all* exceptions, such as errors originating from node core libraries, network errors and operational errors, which are instances of FetchError. See the [error handling document](ERROR-HANDLING.md) for more details. + +```js +fetch('https://domain.invalid/') + .catch(err => console.error(err)); +``` + +#### Handling client and server errors +It is common to create a helper function to check that the response contains no client (4xx) or server (5xx) error responses: + +```js +function checkStatus(res) { + if (res.ok) { // res.status >= 200 && res.status < 300 + return res; + } else { + throw MyCustomError(res.statusText); + } +} + +fetch('https://httpbin.org/status/400') + .then(checkStatus) + .then(res => console.log('will not get here...')) +``` + +## Advanced Usage + +#### Streams +The "Node.js way" is to use streams when possible: + +```js +fetch('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png') + .then(res => { + const dest = fs.createWriteStream('./octocat.png'); + res.body.pipe(dest); + }); +``` + +In Node.js 14 you can also use async iterators to read `body`; however, be careful to catch +errors -- the longer a response runs, the more likely it is to encounter an error. + +```js +const fetch = require('node-fetch'); +const response = await fetch('https://httpbin.org/stream/3'); +try { + for await (const chunk of response.body) { + console.dir(JSON.parse(chunk.toString())); + } +} catch (err) { + console.error(err.stack); +} +``` + +In Node.js 12 you can also use async iterators to read `body`; however, async iterators with streams +did not mature until Node.js 14, so you need to do some extra work to ensure you handle errors +directly from the stream and wait on it response to fully close. + +```js +const fetch = require('node-fetch'); +const read = async body => { + let error; + body.on('error', err => { + error = err; + }); + for await (const chunk of body) { + console.dir(JSON.parse(chunk.toString())); + } + return new Promise((resolve, reject) => { + body.on('close', () => { + error ? reject(error) : resolve(); + }); + }); +}; +try { + const response = await fetch('https://httpbin.org/stream/3'); + await read(response.body); +} catch (err) { + console.error(err.stack); +} +``` + +#### Buffer +If you prefer to cache binary data in full, use buffer(). (NOTE: `buffer()` is a `node-fetch`-only API) + +```js +const fileType = require('file-type'); + +fetch('https://assets-cdn.github.com/images/modules/logos_page/Octocat.png') + .then(res => res.buffer()) + .then(buffer => fileType(buffer)) + .then(type => { /* ... */ }); +``` + +#### Accessing Headers and other Meta data +```js +fetch('https://github.com/') + .then(res => { + console.log(res.ok); + console.log(res.status); + console.log(res.statusText); + console.log(res.headers.raw()); + console.log(res.headers.get('content-type')); + }); +``` + +#### Extract Set-Cookie Header + +Unlike browsers, you can access raw `Set-Cookie` headers manually using `Headers.raw()`. This is a `node-fetch` only API. + +```js +fetch(url).then(res => { + // returns an array of values, instead of a string of comma-separated values + console.log(res.headers.raw()['set-cookie']); +}); +``` + +#### Post data using a file stream + +```js +const { createReadStream } = require('fs'); + +const stream = createReadStream('input.txt'); + +fetch('https://httpbin.org/post', { method: 'POST', body: stream }) + .then(res => res.json()) + .then(json => console.log(json)); +``` + +#### Post with form-data (detect multipart) + +```js +const FormData = require('form-data'); + +const form = new FormData(); +form.append('a', 1); + +fetch('https://httpbin.org/post', { method: 'POST', body: form }) + .then(res => res.json()) + .then(json => console.log(json)); + +// OR, using custom headers +// NOTE: getHeaders() is non-standard API + +const form = new FormData(); +form.append('a', 1); + +const options = { + method: 'POST', + body: form, + headers: form.getHeaders() +} + +fetch('https://httpbin.org/post', options) + .then(res => res.json()) + .then(json => console.log(json)); +``` + +#### Request cancellation with AbortSignal + +> NOTE: You may cancel streamed requests only on Node >= v8.0.0 + +You may cancel requests with `AbortController`. A suggested implementation is [`abort-controller`](https://www.npmjs.com/package/abort-controller). + +An example of timing out a request after 150ms could be achieved as the following: + +```js +import AbortController from 'abort-controller'; + +const controller = new AbortController(); +const timeout = setTimeout( + () => { controller.abort(); }, + 150, +); + +fetch(url, { signal: controller.signal }) + .then(res => res.json()) + .then( + data => { + useData(data) + }, + err => { + if (err.name === 'AbortError') { + // request was aborted + } + }, + ) + .finally(() => { + clearTimeout(timeout); + }); +``` + +See [test cases](https://github.com/bitinn/node-fetch/blob/master/test/test.js) for more examples. + + +## API + +### fetch(url[, options]) + +- `url` A string representing the URL for fetching +- `options` [Options](#fetch-options) for the HTTP(S) request +- Returns: Promise<[Response](#class-response)> + +Perform an HTTP(S) fetch. + +`url` should be an absolute url, such as `https://example.com/`. A path-relative URL (`/file/under/root`) or protocol-relative URL (`//can-be-http-or-https.com/`) will result in a rejected `Promise`. + + +### Options + +The default values are shown after each option key. + +```js +{ + // These properties are part of the Fetch Standard + method: 'GET', + headers: {}, // request headers. format is the identical to that accepted by the Headers constructor (see below) + body: null, // request body. can be null, a string, a Buffer, a Blob, or a Node.js Readable stream + redirect: 'follow', // set to `manual` to extract redirect headers, `error` to reject redirect + signal: null, // pass an instance of AbortSignal to optionally abort requests + + // The following properties are node-fetch extensions + follow: 20, // maximum redirect count. 0 to not follow redirect + timeout: 0, // req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies). Signal is recommended instead. + compress: true, // support gzip/deflate content encoding. false to disable + size: 0, // maximum response body size in bytes. 0 to disable + agent: null // http(s).Agent instance or function that returns an instance (see below) +} +``` + +##### Default Headers + +If no values are set, the following request headers will be sent automatically: + +Header | Value +------------------- | -------------------------------------------------------- +`Accept-Encoding` | `gzip,deflate` _(when `options.compress === true`)_ +`Accept` | `*/*` +`Content-Length` | _(automatically calculated, if possible)_ +`Transfer-Encoding` | `chunked` _(when `req.body` is a stream)_ +`User-Agent` | `node-fetch/1.0 (+https://github.com/bitinn/node-fetch)` + +Note: when `body` is a `Stream`, `Content-Length` is not set automatically. + +##### Custom Agent + +The `agent` option allows you to specify networking related options which are out of the scope of Fetch, including and not limited to the following: + +- Support self-signed certificate +- Use only IPv4 or IPv6 +- Custom DNS Lookup + +See [`http.Agent`](https://nodejs.org/api/http.html#http_new_agent_options) for more information. + +If no agent is specified, the default agent provided by Node.js is used. Note that [this changed in Node.js 19](https://github.com/nodejs/node/blob/4267b92604ad78584244488e7f7508a690cb80d0/lib/_http_agent.js#L564) to have `keepalive` true by default. If you wish to enable `keepalive` in an earlier version of Node.js, you can override the agent as per the following code sample. + +In addition, the `agent` option accepts a function that returns `http`(s)`.Agent` instance given current [URL](https://nodejs.org/api/url.html), this is useful during a redirection chain across HTTP and HTTPS protocol. + +```js +const httpAgent = new http.Agent({ + keepAlive: true +}); +const httpsAgent = new https.Agent({ + keepAlive: true +}); + +const options = { + agent: function (_parsedURL) { + if (_parsedURL.protocol == 'http:') { + return httpAgent; + } else { + return httpsAgent; + } + } +} +``` + + +### Class: Request + +An HTTP(S) request containing information about URL, method, headers, and the body. This class implements the [Body](#iface-body) interface. + +Due to the nature of Node.js, the following properties are not implemented at this moment: + +- `type` +- `destination` +- `referrer` +- `referrerPolicy` +- `mode` +- `credentials` +- `cache` +- `integrity` +- `keepalive` + +The following node-fetch extension properties are provided: + +- `follow` +- `compress` +- `counter` +- `agent` + +See [options](#fetch-options) for exact meaning of these extensions. + +#### new Request(input[, options]) + +*(spec-compliant)* + +- `input` A string representing a URL, or another `Request` (which will be cloned) +- `options` [Options][#fetch-options] for the HTTP(S) request + +Constructs a new `Request` object. The constructor is identical to that in the [browser](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request). + +In most cases, directly `fetch(url, options)` is simpler than creating a `Request` object. + + +### Class: Response + +An HTTP(S) response. This class implements the [Body](#iface-body) interface. + +The following properties are not implemented in node-fetch at this moment: + +- `Response.error()` +- `Response.redirect()` +- `type` +- `trailer` + +#### new Response([body[, options]]) + +*(spec-compliant)* + +- `body` A `String` or [`Readable` stream][node-readable] +- `options` A [`ResponseInit`][response-init] options dictionary + +Constructs a new `Response` object. The constructor is identical to that in the [browser](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response). + +Because Node.js does not implement service workers (for which this class was designed), one rarely has to construct a `Response` directly. + +#### response.ok + +*(spec-compliant)* + +Convenience property representing if the request ended normally. Will evaluate to true if the response status was greater than or equal to 200 but smaller than 300. + +#### response.redirected + +*(spec-compliant)* + +Convenience property representing if the request has been redirected at least once. Will evaluate to true if the internal redirect counter is greater than 0. + + +### Class: Headers + +This class allows manipulating and iterating over a set of HTTP headers. All methods specified in the [Fetch Standard][whatwg-fetch] are implemented. + +#### new Headers([init]) + +*(spec-compliant)* + +- `init` Optional argument to pre-fill the `Headers` object + +Construct a new `Headers` object. `init` can be either `null`, a `Headers` object, an key-value map object or any iterable object. + +```js +// Example adapted from https://fetch.spec.whatwg.org/#example-headers-class + +const meta = { + 'Content-Type': 'text/xml', + 'Breaking-Bad': '<3' +}; +const headers = new Headers(meta); + +// The above is equivalent to +const meta = [ + [ 'Content-Type', 'text/xml' ], + [ 'Breaking-Bad', '<3' ] +]; +const headers = new Headers(meta); + +// You can in fact use any iterable objects, like a Map or even another Headers +const meta = new Map(); +meta.set('Content-Type', 'text/xml'); +meta.set('Breaking-Bad', '<3'); +const headers = new Headers(meta); +const copyOfHeaders = new Headers(headers); +``` + + +### Interface: Body + +`Body` is an abstract interface with methods that are applicable to both `Request` and `Response` classes. + +The following methods are not yet implemented in node-fetch at this moment: + +- `formData()` + +#### body.body + +*(deviation from spec)* + +* Node.js [`Readable` stream][node-readable] + +Data are encapsulated in the `Body` object. Note that while the [Fetch Standard][whatwg-fetch] requires the property to always be a WHATWG `ReadableStream`, in node-fetch it is a Node.js [`Readable` stream][node-readable]. + +#### body.bodyUsed + +*(spec-compliant)* + +* `Boolean` + +A boolean property for if this body has been consumed. Per the specs, a consumed body cannot be used again. + +#### body.arrayBuffer() +#### body.blob() +#### body.json() +#### body.text() + +*(spec-compliant)* + +* Returns: Promise + +Consume the body and return a promise that will resolve to one of these formats. + +#### body.buffer() + +*(node-fetch extension)* + +* Returns: Promise<Buffer> + +Consume the body and return a promise that will resolve to a Buffer. + +#### body.textConverted() + +*(node-fetch extension)* + +* Returns: Promise<String> + +Identical to `body.text()`, except instead of always converting to UTF-8, encoding sniffing will be performed and text converted to UTF-8 if possible. + +(This API requires an optional dependency of the npm package [encoding](https://www.npmjs.com/package/encoding), which you need to install manually. `webpack` users may see [a warning message](https://github.com/bitinn/node-fetch/issues/412#issuecomment-379007792) due to this optional dependency.) + + +### Class: FetchError + +*(node-fetch extension)* + +An operational error in the fetching process. See [ERROR-HANDLING.md][] for more info. + + +### Class: AbortError + +*(node-fetch extension)* + +An Error thrown when the request is aborted in response to an `AbortSignal`'s `abort` event. It has a `name` property of `AbortError`. See [ERROR-HANDLING.MD][] for more info. + +## Acknowledgement + +Thanks to [github/fetch](https://github.com/github/fetch) for providing a solid implementation reference. + +`node-fetch` v1 was maintained by [@bitinn](https://github.com/bitinn); v2 was maintained by [@TimothyGu](https://github.com/timothygu), [@bitinn](https://github.com/bitinn) and [@jimmywarting](https://github.com/jimmywarting); v2 readme is written by [@jkantr](https://github.com/jkantr). + +## License + +MIT + +[npm-image]: https://flat.badgen.net/npm/v/node-fetch +[npm-url]: https://www.npmjs.com/package/node-fetch +[travis-image]: https://flat.badgen.net/travis/bitinn/node-fetch +[travis-url]: https://travis-ci.org/bitinn/node-fetch +[codecov-image]: https://flat.badgen.net/codecov/c/github/bitinn/node-fetch/master +[codecov-url]: https://codecov.io/gh/bitinn/node-fetch +[install-size-image]: https://flat.badgen.net/packagephobia/install/node-fetch +[install-size-url]: https://packagephobia.now.sh/result?p=node-fetch +[discord-image]: https://img.shields.io/discord/619915844268326952?color=%237289DA&label=Discord&style=flat-square +[discord-url]: https://discord.gg/Zxbndcm +[opencollective-image]: https://opencollective.com/node-fetch/backers.svg +[opencollective-url]: https://opencollective.com/node-fetch +[whatwg-fetch]: https://fetch.spec.whatwg.org/ +[response-init]: https://fetch.spec.whatwg.org/#responseinit +[node-readable]: https://nodejs.org/api/stream.html#stream_readable_streams +[mdn-headers]: https://developer.mozilla.org/en-US/docs/Web/API/Headers +[LIMITS.md]: https://github.com/bitinn/node-fetch/blob/master/LIMITS.md +[ERROR-HANDLING.md]: https://github.com/bitinn/node-fetch/blob/master/ERROR-HANDLING.md +[UPGRADE-GUIDE.md]: https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md diff --git a/project starter code/node_modules/node-fetch/browser.js b/project starter code/node_modules/node-fetch/browser.js new file mode 100644 index 00000000..ee86265a --- /dev/null +++ b/project starter code/node_modules/node-fetch/browser.js @@ -0,0 +1,25 @@ +"use strict"; + +// ref: https://github.com/tc39/proposal-global +var getGlobal = function () { + // the only reliable means to get the global object is + // `Function('return this')()` + // However, this causes CSP violations in Chrome apps. + if (typeof self !== 'undefined') { return self; } + if (typeof window !== 'undefined') { return window; } + if (typeof global !== 'undefined') { return global; } + throw new Error('unable to locate global object'); +} + +var globalObject = getGlobal(); + +module.exports = exports = globalObject.fetch; + +// Needed for TypeScript and Webpack. +if (globalObject.fetch) { + exports.default = globalObject.fetch.bind(globalObject); +} + +exports.Headers = globalObject.Headers; +exports.Request = globalObject.Request; +exports.Response = globalObject.Response; diff --git a/project starter code/node_modules/node-fetch/lib/index.es.js b/project starter code/node_modules/node-fetch/lib/index.es.js new file mode 100644 index 00000000..aae9799c --- /dev/null +++ b/project starter code/node_modules/node-fetch/lib/index.es.js @@ -0,0 +1,1777 @@ +process.emitWarning("The .es.js file is deprecated. Use .mjs instead."); + +import Stream from 'stream'; +import http from 'http'; +import Url from 'url'; +import whatwgUrl from 'whatwg-url'; +import https from 'https'; +import zlib from 'zlib'; + +// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js + +// fix for "Readable" isn't a named export issue +const Readable = Stream.Readable; + +const BUFFER = Symbol('buffer'); +const TYPE = Symbol('type'); + +class Blob { + constructor() { + this[TYPE] = ''; + + const blobParts = arguments[0]; + const options = arguments[1]; + + const buffers = []; + let size = 0; + + if (blobParts) { + const a = blobParts; + const length = Number(a.length); + for (let i = 0; i < length; i++) { + const element = a[i]; + let buffer; + if (element instanceof Buffer) { + buffer = element; + } else if (ArrayBuffer.isView(element)) { + buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); + } else if (element instanceof ArrayBuffer) { + buffer = Buffer.from(element); + } else if (element instanceof Blob) { + buffer = element[BUFFER]; + } else { + buffer = Buffer.from(typeof element === 'string' ? element : String(element)); + } + size += buffer.length; + buffers.push(buffer); + } + } + + this[BUFFER] = Buffer.concat(buffers); + + let type = options && options.type !== undefined && String(options.type).toLowerCase(); + if (type && !/[^\u0020-\u007E]/.test(type)) { + this[TYPE] = type; + } + } + get size() { + return this[BUFFER].length; + } + get type() { + return this[TYPE]; + } + text() { + return Promise.resolve(this[BUFFER].toString()); + } + arrayBuffer() { + const buf = this[BUFFER]; + const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + return Promise.resolve(ab); + } + stream() { + const readable = new Readable(); + readable._read = function () {}; + readable.push(this[BUFFER]); + readable.push(null); + return readable; + } + toString() { + return '[object Blob]'; + } + slice() { + const size = this.size; + + const start = arguments[0]; + const end = arguments[1]; + let relativeStart, relativeEnd; + if (start === undefined) { + relativeStart = 0; + } else if (start < 0) { + relativeStart = Math.max(size + start, 0); + } else { + relativeStart = Math.min(start, size); + } + if (end === undefined) { + relativeEnd = size; + } else if (end < 0) { + relativeEnd = Math.max(size + end, 0); + } else { + relativeEnd = Math.min(end, size); + } + const span = Math.max(relativeEnd - relativeStart, 0); + + const buffer = this[BUFFER]; + const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); + const blob = new Blob([], { type: arguments[2] }); + blob[BUFFER] = slicedBuffer; + return blob; + } +} + +Object.defineProperties(Blob.prototype, { + size: { enumerable: true }, + type: { enumerable: true }, + slice: { enumerable: true } +}); + +Object.defineProperty(Blob.prototype, Symbol.toStringTag, { + value: 'Blob', + writable: false, + enumerable: false, + configurable: true +}); + +/** + * fetch-error.js + * + * FetchError interface for operational errors + */ + +/** + * Create FetchError instance + * + * @param String message Error message for human + * @param String type Error type for machine + * @param String systemError For Node.js system error + * @return FetchError + */ +function FetchError(message, type, systemError) { + Error.call(this, message); + + this.message = message; + this.type = type; + + // when err.type is `system`, err.code contains system error code + if (systemError) { + this.code = this.errno = systemError.code; + } + + // hide custom error implementation details from end-users + Error.captureStackTrace(this, this.constructor); +} + +FetchError.prototype = Object.create(Error.prototype); +FetchError.prototype.constructor = FetchError; +FetchError.prototype.name = 'FetchError'; + +let convert; +try { + convert = require('encoding').convert; +} catch (e) {} + +const INTERNALS = Symbol('Body internals'); + +// fix an issue where "PassThrough" isn't a named export for node <10 +const PassThrough = Stream.PassThrough; + +/** + * Body mixin + * + * Ref: https://fetch.spec.whatwg.org/#body + * + * @param Stream body Readable stream + * @param Object opts Response options + * @return Void + */ +function Body(body) { + var _this = this; + + var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, + _ref$size = _ref.size; + + let size = _ref$size === undefined ? 0 : _ref$size; + var _ref$timeout = _ref.timeout; + let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; + + if (body == null) { + // body is undefined or null + body = null; + } else if (isURLSearchParams(body)) { + // body is a URLSearchParams + body = Buffer.from(body.toString()); + } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { + // body is ArrayBuffer + body = Buffer.from(body); + } else if (ArrayBuffer.isView(body)) { + // body is ArrayBufferView + body = Buffer.from(body.buffer, body.byteOffset, body.byteLength); + } else if (body instanceof Stream) ; else { + // none of the above + // coerce to string then buffer + body = Buffer.from(String(body)); + } + this[INTERNALS] = { + body, + disturbed: false, + error: null + }; + this.size = size; + this.timeout = timeout; + + if (body instanceof Stream) { + body.on('error', function (err) { + const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); + _this[INTERNALS].error = error; + }); + } +} + +Body.prototype = { + get body() { + return this[INTERNALS].body; + }, + + get bodyUsed() { + return this[INTERNALS].disturbed; + }, + + /** + * Decode response as ArrayBuffer + * + * @return Promise + */ + arrayBuffer() { + return consumeBody.call(this).then(function (buf) { + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + }); + }, + + /** + * Return raw response as Blob + * + * @return Promise + */ + blob() { + let ct = this.headers && this.headers.get('content-type') || ''; + return consumeBody.call(this).then(function (buf) { + return Object.assign( + // Prevent copying + new Blob([], { + type: ct.toLowerCase() + }), { + [BUFFER]: buf + }); + }); + }, + + /** + * Decode response as json + * + * @return Promise + */ + json() { + var _this2 = this; + + return consumeBody.call(this).then(function (buffer) { + try { + return JSON.parse(buffer.toString()); + } catch (err) { + return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); + } + }); + }, + + /** + * Decode response as text + * + * @return Promise + */ + text() { + return consumeBody.call(this).then(function (buffer) { + return buffer.toString(); + }); + }, + + /** + * Decode response as buffer (non-spec api) + * + * @return Promise + */ + buffer() { + return consumeBody.call(this); + }, + + /** + * Decode response as text, while automatically detecting the encoding and + * trying to decode to UTF-8 (non-spec api) + * + * @return Promise + */ + textConverted() { + var _this3 = this; + + return consumeBody.call(this).then(function (buffer) { + return convertBody(buffer, _this3.headers); + }); + } +}; + +// In browsers, all properties are enumerable. +Object.defineProperties(Body.prototype, { + body: { enumerable: true }, + bodyUsed: { enumerable: true }, + arrayBuffer: { enumerable: true }, + blob: { enumerable: true }, + json: { enumerable: true }, + text: { enumerable: true } +}); + +Body.mixIn = function (proto) { + for (const name of Object.getOwnPropertyNames(Body.prototype)) { + // istanbul ignore else: future proof + if (!(name in proto)) { + const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); + Object.defineProperty(proto, name, desc); + } + } +}; + +/** + * Consume and convert an entire Body to a Buffer. + * + * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body + * + * @return Promise + */ +function consumeBody() { + var _this4 = this; + + if (this[INTERNALS].disturbed) { + return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); + } + + this[INTERNALS].disturbed = true; + + if (this[INTERNALS].error) { + return Body.Promise.reject(this[INTERNALS].error); + } + + let body = this.body; + + // body is null + if (body === null) { + return Body.Promise.resolve(Buffer.alloc(0)); + } + + // body is blob + if (isBlob(body)) { + body = body.stream(); + } + + // body is buffer + if (Buffer.isBuffer(body)) { + return Body.Promise.resolve(body); + } + + // istanbul ignore if: should never happen + if (!(body instanceof Stream)) { + return Body.Promise.resolve(Buffer.alloc(0)); + } + + // body is stream + // get ready to actually consume the body + let accum = []; + let accumBytes = 0; + let abort = false; + + return new Body.Promise(function (resolve, reject) { + let resTimeout; + + // allow timeout on slow response body + if (_this4.timeout) { + resTimeout = setTimeout(function () { + abort = true; + reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); + }, _this4.timeout); + } + + // handle stream errors + body.on('error', function (err) { + if (err.name === 'AbortError') { + // if the request was aborted, reject with this Error + abort = true; + reject(err); + } else { + // other errors, such as incorrect content-encoding + reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); + } + }); + + body.on('data', function (chunk) { + if (abort || chunk === null) { + return; + } + + if (_this4.size && accumBytes + chunk.length > _this4.size) { + abort = true; + reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); + return; + } + + accumBytes += chunk.length; + accum.push(chunk); + }); + + body.on('end', function () { + if (abort) { + return; + } + + clearTimeout(resTimeout); + + try { + resolve(Buffer.concat(accum, accumBytes)); + } catch (err) { + // handle streams that have accumulated too much data (issue #414) + reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); + } + }); + }); +} + +/** + * Detect buffer encoding and convert to target encoding + * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding + * + * @param Buffer buffer Incoming buffer + * @param String encoding Target encoding + * @return String + */ +function convertBody(buffer, headers) { + if (typeof convert !== 'function') { + throw new Error('The package `encoding` must be installed to use the textConverted() function'); + } + + const ct = headers.get('content-type'); + let charset = 'utf-8'; + let res, str; + + // header + if (ct) { + res = /charset=([^;]*)/i.exec(ct); + } + + // no charset in content type, peek at response body for at most 1024 bytes + str = buffer.slice(0, 1024).toString(); + + // html5 + if (!res && str) { + res = / 0 && arguments[0] !== undefined ? arguments[0] : undefined; + + this[MAP] = Object.create(null); + + if (init instanceof Headers) { + const rawHeaders = init.raw(); + const headerNames = Object.keys(rawHeaders); + + for (const headerName of headerNames) { + for (const value of rawHeaders[headerName]) { + this.append(headerName, value); + } + } + + return; + } + + // We don't worry about converting prop to ByteString here as append() + // will handle it. + if (init == null) ; else if (typeof init === 'object') { + const method = init[Symbol.iterator]; + if (method != null) { + if (typeof method !== 'function') { + throw new TypeError('Header pairs must be iterable'); + } + + // sequence> + // Note: per spec we have to first exhaust the lists then process them + const pairs = []; + for (const pair of init) { + if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { + throw new TypeError('Each header pair must be iterable'); + } + pairs.push(Array.from(pair)); + } + + for (const pair of pairs) { + if (pair.length !== 2) { + throw new TypeError('Each header pair must be a name/value tuple'); + } + this.append(pair[0], pair[1]); + } + } else { + // record + for (const key of Object.keys(init)) { + const value = init[key]; + this.append(key, value); + } + } + } else { + throw new TypeError('Provided initializer must be an object'); + } + } + + /** + * Return combined header value given name + * + * @param String name Header name + * @return Mixed + */ + get(name) { + name = `${name}`; + validateName(name); + const key = find(this[MAP], name); + if (key === undefined) { + return null; + } + + return this[MAP][key].join(', '); + } + + /** + * Iterate over all headers + * + * @param Function callback Executed for each item with parameters (value, name, thisArg) + * @param Boolean thisArg `this` context for callback function + * @return Void + */ + forEach(callback) { + let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; + + let pairs = getHeaders(this); + let i = 0; + while (i < pairs.length) { + var _pairs$i = pairs[i]; + const name = _pairs$i[0], + value = _pairs$i[1]; + + callback.call(thisArg, value, name, this); + pairs = getHeaders(this); + i++; + } + } + + /** + * Overwrite header values given name + * + * @param String name Header name + * @param String value Header value + * @return Void + */ + set(name, value) { + name = `${name}`; + value = `${value}`; + validateName(name); + validateValue(value); + const key = find(this[MAP], name); + this[MAP][key !== undefined ? key : name] = [value]; + } + + /** + * Append a value onto existing header + * + * @param String name Header name + * @param String value Header value + * @return Void + */ + append(name, value) { + name = `${name}`; + value = `${value}`; + validateName(name); + validateValue(value); + const key = find(this[MAP], name); + if (key !== undefined) { + this[MAP][key].push(value); + } else { + this[MAP][name] = [value]; + } + } + + /** + * Check for header name existence + * + * @param String name Header name + * @return Boolean + */ + has(name) { + name = `${name}`; + validateName(name); + return find(this[MAP], name) !== undefined; + } + + /** + * Delete all header values given name + * + * @param String name Header name + * @return Void + */ + delete(name) { + name = `${name}`; + validateName(name); + const key = find(this[MAP], name); + if (key !== undefined) { + delete this[MAP][key]; + } + } + + /** + * Return raw headers (non-spec api) + * + * @return Object + */ + raw() { + return this[MAP]; + } + + /** + * Get an iterator on keys. + * + * @return Iterator + */ + keys() { + return createHeadersIterator(this, 'key'); + } + + /** + * Get an iterator on values. + * + * @return Iterator + */ + values() { + return createHeadersIterator(this, 'value'); + } + + /** + * Get an iterator on entries. + * + * This is the default iterator of the Headers object. + * + * @return Iterator + */ + [Symbol.iterator]() { + return createHeadersIterator(this, 'key+value'); + } +} +Headers.prototype.entries = Headers.prototype[Symbol.iterator]; + +Object.defineProperty(Headers.prototype, Symbol.toStringTag, { + value: 'Headers', + writable: false, + enumerable: false, + configurable: true +}); + +Object.defineProperties(Headers.prototype, { + get: { enumerable: true }, + forEach: { enumerable: true }, + set: { enumerable: true }, + append: { enumerable: true }, + has: { enumerable: true }, + delete: { enumerable: true }, + keys: { enumerable: true }, + values: { enumerable: true }, + entries: { enumerable: true } +}); + +function getHeaders(headers) { + let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; + + const keys = Object.keys(headers[MAP]).sort(); + return keys.map(kind === 'key' ? function (k) { + return k.toLowerCase(); + } : kind === 'value' ? function (k) { + return headers[MAP][k].join(', '); + } : function (k) { + return [k.toLowerCase(), headers[MAP][k].join(', ')]; + }); +} + +const INTERNAL = Symbol('internal'); + +function createHeadersIterator(target, kind) { + const iterator = Object.create(HeadersIteratorPrototype); + iterator[INTERNAL] = { + target, + kind, + index: 0 + }; + return iterator; +} + +const HeadersIteratorPrototype = Object.setPrototypeOf({ + next() { + // istanbul ignore if + if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { + throw new TypeError('Value of `this` is not a HeadersIterator'); + } + + var _INTERNAL = this[INTERNAL]; + const target = _INTERNAL.target, + kind = _INTERNAL.kind, + index = _INTERNAL.index; + + const values = getHeaders(target, kind); + const len = values.length; + if (index >= len) { + return { + value: undefined, + done: true + }; + } + + this[INTERNAL].index = index + 1; + + return { + value: values[index], + done: false + }; + } +}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); + +Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { + value: 'HeadersIterator', + writable: false, + enumerable: false, + configurable: true +}); + +/** + * Export the Headers object in a form that Node.js can consume. + * + * @param Headers headers + * @return Object + */ +function exportNodeCompatibleHeaders(headers) { + const obj = Object.assign({ __proto__: null }, headers[MAP]); + + // http.request() only supports string as Host header. This hack makes + // specifying custom Host header possible. + const hostHeaderKey = find(headers[MAP], 'Host'); + if (hostHeaderKey !== undefined) { + obj[hostHeaderKey] = obj[hostHeaderKey][0]; + } + + return obj; +} + +/** + * Create a Headers object from an object of headers, ignoring those that do + * not conform to HTTP grammar productions. + * + * @param Object obj Object of headers + * @return Headers + */ +function createHeadersLenient(obj) { + const headers = new Headers(); + for (const name of Object.keys(obj)) { + if (invalidTokenRegex.test(name)) { + continue; + } + if (Array.isArray(obj[name])) { + for (const val of obj[name]) { + if (invalidHeaderCharRegex.test(val)) { + continue; + } + if (headers[MAP][name] === undefined) { + headers[MAP][name] = [val]; + } else { + headers[MAP][name].push(val); + } + } + } else if (!invalidHeaderCharRegex.test(obj[name])) { + headers[MAP][name] = [obj[name]]; + } + } + return headers; +} + +const INTERNALS$1 = Symbol('Response internals'); + +// fix an issue where "STATUS_CODES" aren't a named export for node <10 +const STATUS_CODES = http.STATUS_CODES; + +/** + * Response class + * + * @param Stream body Readable stream + * @param Object opts Response options + * @return Void + */ +class Response { + constructor() { + let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + Body.call(this, body, opts); + + const status = opts.status || 200; + const headers = new Headers(opts.headers); + + if (body != null && !headers.has('Content-Type')) { + const contentType = extractContentType(body); + if (contentType) { + headers.append('Content-Type', contentType); + } + } + + this[INTERNALS$1] = { + url: opts.url, + status, + statusText: opts.statusText || STATUS_CODES[status], + headers, + counter: opts.counter + }; + } + + get url() { + return this[INTERNALS$1].url || ''; + } + + get status() { + return this[INTERNALS$1].status; + } + + /** + * Convenience property representing if the request ended normally + */ + get ok() { + return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; + } + + get redirected() { + return this[INTERNALS$1].counter > 0; + } + + get statusText() { + return this[INTERNALS$1].statusText; + } + + get headers() { + return this[INTERNALS$1].headers; + } + + /** + * Clone this response + * + * @return Response + */ + clone() { + return new Response(clone(this), { + url: this.url, + status: this.status, + statusText: this.statusText, + headers: this.headers, + ok: this.ok, + redirected: this.redirected + }); + } +} + +Body.mixIn(Response.prototype); + +Object.defineProperties(Response.prototype, { + url: { enumerable: true }, + status: { enumerable: true }, + ok: { enumerable: true }, + redirected: { enumerable: true }, + statusText: { enumerable: true }, + headers: { enumerable: true }, + clone: { enumerable: true } +}); + +Object.defineProperty(Response.prototype, Symbol.toStringTag, { + value: 'Response', + writable: false, + enumerable: false, + configurable: true +}); + +const INTERNALS$2 = Symbol('Request internals'); +const URL = Url.URL || whatwgUrl.URL; + +// fix an issue where "format", "parse" aren't a named export for node <10 +const parse_url = Url.parse; +const format_url = Url.format; + +/** + * Wrapper around `new URL` to handle arbitrary URLs + * + * @param {string} urlStr + * @return {void} + */ +function parseURL(urlStr) { + /* + Check whether the URL is absolute or not + Scheme: https://tools.ietf.org/html/rfc3986#section-3.1 + Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3 + */ + if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.exec(urlStr)) { + urlStr = new URL(urlStr).toString(); + } + + // Fallback to old implementation for arbitrary URLs + return parse_url(urlStr); +} + +const streamDestructionSupported = 'destroy' in Stream.Readable.prototype; + +/** + * Check if a value is an instance of Request. + * + * @param Mixed input + * @return Boolean + */ +function isRequest(input) { + return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; +} + +function isAbortSignal(signal) { + const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal); + return !!(proto && proto.constructor.name === 'AbortSignal'); +} + +/** + * Request class + * + * @param Mixed input Url or Request instance + * @param Object init Custom options + * @return Void + */ +class Request { + constructor(input) { + let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + let parsedURL; + + // normalize input + if (!isRequest(input)) { + if (input && input.href) { + // in order to support Node.js' Url objects; though WHATWG's URL objects + // will fall into this branch also (since their `toString()` will return + // `href` property anyway) + parsedURL = parseURL(input.href); + } else { + // coerce input to a string before attempting to parse + parsedURL = parseURL(`${input}`); + } + input = {}; + } else { + parsedURL = parseURL(input.url); + } + + let method = init.method || input.method || 'GET'; + method = method.toUpperCase(); + + if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { + throw new TypeError('Request with GET/HEAD method cannot have body'); + } + + let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; + + Body.call(this, inputBody, { + timeout: init.timeout || input.timeout || 0, + size: init.size || input.size || 0 + }); + + const headers = new Headers(init.headers || input.headers || {}); + + if (inputBody != null && !headers.has('Content-Type')) { + const contentType = extractContentType(inputBody); + if (contentType) { + headers.append('Content-Type', contentType); + } + } + + let signal = isRequest(input) ? input.signal : null; + if ('signal' in init) signal = init.signal; + + if (signal != null && !isAbortSignal(signal)) { + throw new TypeError('Expected signal to be an instanceof AbortSignal'); + } + + this[INTERNALS$2] = { + method, + redirect: init.redirect || input.redirect || 'follow', + headers, + parsedURL, + signal + }; + + // node-fetch-only options + this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; + this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; + this.counter = init.counter || input.counter || 0; + this.agent = init.agent || input.agent; + } + + get method() { + return this[INTERNALS$2].method; + } + + get url() { + return format_url(this[INTERNALS$2].parsedURL); + } + + get headers() { + return this[INTERNALS$2].headers; + } + + get redirect() { + return this[INTERNALS$2].redirect; + } + + get signal() { + return this[INTERNALS$2].signal; + } + + /** + * Clone this request + * + * @return Request + */ + clone() { + return new Request(this); + } +} + +Body.mixIn(Request.prototype); + +Object.defineProperty(Request.prototype, Symbol.toStringTag, { + value: 'Request', + writable: false, + enumerable: false, + configurable: true +}); + +Object.defineProperties(Request.prototype, { + method: { enumerable: true }, + url: { enumerable: true }, + headers: { enumerable: true }, + redirect: { enumerable: true }, + clone: { enumerable: true }, + signal: { enumerable: true } +}); + +/** + * Convert a Request to Node.js http request options. + * + * @param Request A Request instance + * @return Object The options object to be passed to http.request + */ +function getNodeRequestOptions(request) { + const parsedURL = request[INTERNALS$2].parsedURL; + const headers = new Headers(request[INTERNALS$2].headers); + + // fetch step 1.3 + if (!headers.has('Accept')) { + headers.set('Accept', '*/*'); + } + + // Basic fetch + if (!parsedURL.protocol || !parsedURL.hostname) { + throw new TypeError('Only absolute URLs are supported'); + } + + if (!/^https?:$/.test(parsedURL.protocol)) { + throw new TypeError('Only HTTP(S) protocols are supported'); + } + + if (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) { + throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8'); + } + + // HTTP-network-or-cache fetch steps 2.4-2.7 + let contentLengthValue = null; + if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { + contentLengthValue = '0'; + } + if (request.body != null) { + const totalBytes = getTotalBytes(request); + if (typeof totalBytes === 'number') { + contentLengthValue = String(totalBytes); + } + } + if (contentLengthValue) { + headers.set('Content-Length', contentLengthValue); + } + + // HTTP-network-or-cache fetch step 2.11 + if (!headers.has('User-Agent')) { + headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); + } + + // HTTP-network-or-cache fetch step 2.15 + if (request.compress && !headers.has('Accept-Encoding')) { + headers.set('Accept-Encoding', 'gzip,deflate'); + } + + let agent = request.agent; + if (typeof agent === 'function') { + agent = agent(parsedURL); + } + + // HTTP-network fetch step 4.2 + // chunked encoding is handled by Node.js + + return Object.assign({}, parsedURL, { + method: request.method, + headers: exportNodeCompatibleHeaders(headers), + agent + }); +} + +/** + * abort-error.js + * + * AbortError interface for cancelled requests + */ + +/** + * Create AbortError instance + * + * @param String message Error message for human + * @return AbortError + */ +function AbortError(message) { + Error.call(this, message); + + this.type = 'aborted'; + this.message = message; + + // hide custom error implementation details from end-users + Error.captureStackTrace(this, this.constructor); +} + +AbortError.prototype = Object.create(Error.prototype); +AbortError.prototype.constructor = AbortError; +AbortError.prototype.name = 'AbortError'; + +const URL$1 = Url.URL || whatwgUrl.URL; + +// fix an issue where "PassThrough", "resolve" aren't a named export for node <10 +const PassThrough$1 = Stream.PassThrough; + +const isDomainOrSubdomain = function isDomainOrSubdomain(destination, original) { + const orig = new URL$1(original).hostname; + const dest = new URL$1(destination).hostname; + + return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest); +}; + +/** + * isSameProtocol reports whether the two provided URLs use the same protocol. + * + * Both domains must already be in canonical form. + * @param {string|URL} original + * @param {string|URL} destination + */ +const isSameProtocol = function isSameProtocol(destination, original) { + const orig = new URL$1(original).protocol; + const dest = new URL$1(destination).protocol; + + return orig === dest; +}; + +/** + * Fetch function + * + * @param Mixed url Absolute url or Request instance + * @param Object opts Fetch options + * @return Promise + */ +function fetch(url, opts) { + + // allow custom promise + if (!fetch.Promise) { + throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); + } + + Body.Promise = fetch.Promise; + + // wrap http.request into fetch + return new fetch.Promise(function (resolve, reject) { + // build request object + const request = new Request(url, opts); + const options = getNodeRequestOptions(request); + + const send = (options.protocol === 'https:' ? https : http).request; + const signal = request.signal; + + let response = null; + + const abort = function abort() { + let error = new AbortError('The user aborted a request.'); + reject(error); + if (request.body && request.body instanceof Stream.Readable) { + destroyStream(request.body, error); + } + if (!response || !response.body) return; + response.body.emit('error', error); + }; + + if (signal && signal.aborted) { + abort(); + return; + } + + const abortAndFinalize = function abortAndFinalize() { + abort(); + finalize(); + }; + + // send request + const req = send(options); + let reqTimeout; + + if (signal) { + signal.addEventListener('abort', abortAndFinalize); + } + + function finalize() { + req.abort(); + if (signal) signal.removeEventListener('abort', abortAndFinalize); + clearTimeout(reqTimeout); + } + + if (request.timeout) { + req.once('socket', function (socket) { + reqTimeout = setTimeout(function () { + reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); + finalize(); + }, request.timeout); + }); + } + + req.on('error', function (err) { + reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); + + if (response && response.body) { + destroyStream(response.body, err); + } + + finalize(); + }); + + fixResponseChunkedTransferBadEnding(req, function (err) { + if (signal && signal.aborted) { + return; + } + + if (response && response.body) { + destroyStream(response.body, err); + } + }); + + /* c8 ignore next 18 */ + if (parseInt(process.version.substring(1)) < 14) { + // Before Node.js 14, pipeline() does not fully support async iterators and does not always + // properly handle when the socket close/end events are out of order. + req.on('socket', function (s) { + s.addListener('close', function (hadError) { + // if a data listener is still present we didn't end cleanly + const hasDataListener = s.listenerCount('data') > 0; + + // if end happened before close but the socket didn't emit an error, do it now + if (response && hasDataListener && !hadError && !(signal && signal.aborted)) { + const err = new Error('Premature close'); + err.code = 'ERR_STREAM_PREMATURE_CLOSE'; + response.body.emit('error', err); + } + }); + }); + } + + req.on('response', function (res) { + clearTimeout(reqTimeout); + + const headers = createHeadersLenient(res.headers); + + // HTTP fetch step 5 + if (fetch.isRedirect(res.statusCode)) { + // HTTP fetch step 5.2 + const location = headers.get('Location'); + + // HTTP fetch step 5.3 + let locationURL = null; + try { + locationURL = location === null ? null : new URL$1(location, request.url).toString(); + } catch (err) { + // error here can only be invalid URL in Location: header + // do not throw when options.redirect == manual + // let the user extract the errorneous redirect URL + if (request.redirect !== 'manual') { + reject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, 'invalid-redirect')); + finalize(); + return; + } + } + + // HTTP fetch step 5.5 + switch (request.redirect) { + case 'error': + reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect')); + finalize(); + return; + case 'manual': + // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. + if (locationURL !== null) { + // handle corrupted header + try { + headers.set('Location', locationURL); + } catch (err) { + // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request + reject(err); + } + } + break; + case 'follow': + // HTTP-redirect fetch step 2 + if (locationURL === null) { + break; + } + + // HTTP-redirect fetch step 5 + if (request.counter >= request.follow) { + reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); + finalize(); + return; + } + + // HTTP-redirect fetch step 6 (counter increment) + // Create a new Request object. + const requestOpts = { + headers: new Headers(request.headers), + follow: request.follow, + counter: request.counter + 1, + agent: request.agent, + compress: request.compress, + method: request.method, + body: request.body, + signal: request.signal, + timeout: request.timeout, + size: request.size + }; + + if (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) { + for (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) { + requestOpts.headers.delete(name); + } + } + + // HTTP-redirect fetch step 9 + if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { + reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); + finalize(); + return; + } + + // HTTP-redirect fetch step 11 + if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { + requestOpts.method = 'GET'; + requestOpts.body = undefined; + requestOpts.headers.delete('content-length'); + } + + // HTTP-redirect fetch step 15 + resolve(fetch(new Request(locationURL, requestOpts))); + finalize(); + return; + } + } + + // prepare response + res.once('end', function () { + if (signal) signal.removeEventListener('abort', abortAndFinalize); + }); + let body = res.pipe(new PassThrough$1()); + + const response_options = { + url: request.url, + status: res.statusCode, + statusText: res.statusMessage, + headers: headers, + size: request.size, + timeout: request.timeout, + counter: request.counter + }; + + // HTTP-network fetch step 12.1.1.3 + const codings = headers.get('Content-Encoding'); + + // HTTP-network fetch step 12.1.1.4: handle content codings + + // in following scenarios we ignore compression support + // 1. compression support is disabled + // 2. HEAD request + // 3. no Content-Encoding header + // 4. no content response (204) + // 5. content not modified response (304) + if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { + response = new Response(body, response_options); + resolve(response); + return; + } + + // For Node v6+ + // Be less strict when decoding compressed responses, since sometimes + // servers send slightly invalid responses that are still accepted + // by common browsers. + // Always using Z_SYNC_FLUSH is what cURL does. + const zlibOptions = { + flush: zlib.Z_SYNC_FLUSH, + finishFlush: zlib.Z_SYNC_FLUSH + }; + + // for gzip + if (codings == 'gzip' || codings == 'x-gzip') { + body = body.pipe(zlib.createGunzip(zlibOptions)); + response = new Response(body, response_options); + resolve(response); + return; + } + + // for deflate + if (codings == 'deflate' || codings == 'x-deflate') { + // handle the infamous raw deflate response from old servers + // a hack for old IIS and Apache servers + const raw = res.pipe(new PassThrough$1()); + raw.once('data', function (chunk) { + // see http://stackoverflow.com/questions/37519828 + if ((chunk[0] & 0x0F) === 0x08) { + body = body.pipe(zlib.createInflate()); + } else { + body = body.pipe(zlib.createInflateRaw()); + } + response = new Response(body, response_options); + resolve(response); + }); + raw.on('end', function () { + // some old IIS servers return zero-length OK deflate responses, so 'data' is never emitted. + if (!response) { + response = new Response(body, response_options); + resolve(response); + } + }); + return; + } + + // for br + if (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') { + body = body.pipe(zlib.createBrotliDecompress()); + response = new Response(body, response_options); + resolve(response); + return; + } + + // otherwise, use response as-is + response = new Response(body, response_options); + resolve(response); + }); + + writeToStream(req, request); + }); +} +function fixResponseChunkedTransferBadEnding(request, errorCallback) { + let socket; + + request.on('socket', function (s) { + socket = s; + }); + + request.on('response', function (response) { + const headers = response.headers; + + if (headers['transfer-encoding'] === 'chunked' && !headers['content-length']) { + response.once('close', function (hadError) { + // tests for socket presence, as in some situations the + // the 'socket' event is not triggered for the request + // (happens in deno), avoids `TypeError` + // if a data listener is still present we didn't end cleanly + const hasDataListener = socket && socket.listenerCount('data') > 0; + + if (hasDataListener && !hadError) { + const err = new Error('Premature close'); + err.code = 'ERR_STREAM_PREMATURE_CLOSE'; + errorCallback(err); + } + }); + } + }); +} + +function destroyStream(stream, err) { + if (stream.destroy) { + stream.destroy(err); + } else { + // node < 8 + stream.emit('error', err); + stream.end(); + } +} + +/** + * Redirect code matching + * + * @param Number code Status code + * @return Boolean + */ +fetch.isRedirect = function (code) { + return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; +}; + +// expose Promise +fetch.Promise = global.Promise; + +export default fetch; +export { Headers, Request, Response, FetchError, AbortError }; diff --git a/project starter code/node_modules/node-fetch/lib/index.js b/project starter code/node_modules/node-fetch/lib/index.js new file mode 100644 index 00000000..567ff5da --- /dev/null +++ b/project starter code/node_modules/node-fetch/lib/index.js @@ -0,0 +1,1787 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var Stream = _interopDefault(require('stream')); +var http = _interopDefault(require('http')); +var Url = _interopDefault(require('url')); +var whatwgUrl = _interopDefault(require('whatwg-url')); +var https = _interopDefault(require('https')); +var zlib = _interopDefault(require('zlib')); + +// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js + +// fix for "Readable" isn't a named export issue +const Readable = Stream.Readable; + +const BUFFER = Symbol('buffer'); +const TYPE = Symbol('type'); + +class Blob { + constructor() { + this[TYPE] = ''; + + const blobParts = arguments[0]; + const options = arguments[1]; + + const buffers = []; + let size = 0; + + if (blobParts) { + const a = blobParts; + const length = Number(a.length); + for (let i = 0; i < length; i++) { + const element = a[i]; + let buffer; + if (element instanceof Buffer) { + buffer = element; + } else if (ArrayBuffer.isView(element)) { + buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); + } else if (element instanceof ArrayBuffer) { + buffer = Buffer.from(element); + } else if (element instanceof Blob) { + buffer = element[BUFFER]; + } else { + buffer = Buffer.from(typeof element === 'string' ? element : String(element)); + } + size += buffer.length; + buffers.push(buffer); + } + } + + this[BUFFER] = Buffer.concat(buffers); + + let type = options && options.type !== undefined && String(options.type).toLowerCase(); + if (type && !/[^\u0020-\u007E]/.test(type)) { + this[TYPE] = type; + } + } + get size() { + return this[BUFFER].length; + } + get type() { + return this[TYPE]; + } + text() { + return Promise.resolve(this[BUFFER].toString()); + } + arrayBuffer() { + const buf = this[BUFFER]; + const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + return Promise.resolve(ab); + } + stream() { + const readable = new Readable(); + readable._read = function () {}; + readable.push(this[BUFFER]); + readable.push(null); + return readable; + } + toString() { + return '[object Blob]'; + } + slice() { + const size = this.size; + + const start = arguments[0]; + const end = arguments[1]; + let relativeStart, relativeEnd; + if (start === undefined) { + relativeStart = 0; + } else if (start < 0) { + relativeStart = Math.max(size + start, 0); + } else { + relativeStart = Math.min(start, size); + } + if (end === undefined) { + relativeEnd = size; + } else if (end < 0) { + relativeEnd = Math.max(size + end, 0); + } else { + relativeEnd = Math.min(end, size); + } + const span = Math.max(relativeEnd - relativeStart, 0); + + const buffer = this[BUFFER]; + const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); + const blob = new Blob([], { type: arguments[2] }); + blob[BUFFER] = slicedBuffer; + return blob; + } +} + +Object.defineProperties(Blob.prototype, { + size: { enumerable: true }, + type: { enumerable: true }, + slice: { enumerable: true } +}); + +Object.defineProperty(Blob.prototype, Symbol.toStringTag, { + value: 'Blob', + writable: false, + enumerable: false, + configurable: true +}); + +/** + * fetch-error.js + * + * FetchError interface for operational errors + */ + +/** + * Create FetchError instance + * + * @param String message Error message for human + * @param String type Error type for machine + * @param String systemError For Node.js system error + * @return FetchError + */ +function FetchError(message, type, systemError) { + Error.call(this, message); + + this.message = message; + this.type = type; + + // when err.type is `system`, err.code contains system error code + if (systemError) { + this.code = this.errno = systemError.code; + } + + // hide custom error implementation details from end-users + Error.captureStackTrace(this, this.constructor); +} + +FetchError.prototype = Object.create(Error.prototype); +FetchError.prototype.constructor = FetchError; +FetchError.prototype.name = 'FetchError'; + +let convert; +try { + convert = require('encoding').convert; +} catch (e) {} + +const INTERNALS = Symbol('Body internals'); + +// fix an issue where "PassThrough" isn't a named export for node <10 +const PassThrough = Stream.PassThrough; + +/** + * Body mixin + * + * Ref: https://fetch.spec.whatwg.org/#body + * + * @param Stream body Readable stream + * @param Object opts Response options + * @return Void + */ +function Body(body) { + var _this = this; + + var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, + _ref$size = _ref.size; + + let size = _ref$size === undefined ? 0 : _ref$size; + var _ref$timeout = _ref.timeout; + let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; + + if (body == null) { + // body is undefined or null + body = null; + } else if (isURLSearchParams(body)) { + // body is a URLSearchParams + body = Buffer.from(body.toString()); + } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { + // body is ArrayBuffer + body = Buffer.from(body); + } else if (ArrayBuffer.isView(body)) { + // body is ArrayBufferView + body = Buffer.from(body.buffer, body.byteOffset, body.byteLength); + } else if (body instanceof Stream) ; else { + // none of the above + // coerce to string then buffer + body = Buffer.from(String(body)); + } + this[INTERNALS] = { + body, + disturbed: false, + error: null + }; + this.size = size; + this.timeout = timeout; + + if (body instanceof Stream) { + body.on('error', function (err) { + const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); + _this[INTERNALS].error = error; + }); + } +} + +Body.prototype = { + get body() { + return this[INTERNALS].body; + }, + + get bodyUsed() { + return this[INTERNALS].disturbed; + }, + + /** + * Decode response as ArrayBuffer + * + * @return Promise + */ + arrayBuffer() { + return consumeBody.call(this).then(function (buf) { + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + }); + }, + + /** + * Return raw response as Blob + * + * @return Promise + */ + blob() { + let ct = this.headers && this.headers.get('content-type') || ''; + return consumeBody.call(this).then(function (buf) { + return Object.assign( + // Prevent copying + new Blob([], { + type: ct.toLowerCase() + }), { + [BUFFER]: buf + }); + }); + }, + + /** + * Decode response as json + * + * @return Promise + */ + json() { + var _this2 = this; + + return consumeBody.call(this).then(function (buffer) { + try { + return JSON.parse(buffer.toString()); + } catch (err) { + return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); + } + }); + }, + + /** + * Decode response as text + * + * @return Promise + */ + text() { + return consumeBody.call(this).then(function (buffer) { + return buffer.toString(); + }); + }, + + /** + * Decode response as buffer (non-spec api) + * + * @return Promise + */ + buffer() { + return consumeBody.call(this); + }, + + /** + * Decode response as text, while automatically detecting the encoding and + * trying to decode to UTF-8 (non-spec api) + * + * @return Promise + */ + textConverted() { + var _this3 = this; + + return consumeBody.call(this).then(function (buffer) { + return convertBody(buffer, _this3.headers); + }); + } +}; + +// In browsers, all properties are enumerable. +Object.defineProperties(Body.prototype, { + body: { enumerable: true }, + bodyUsed: { enumerable: true }, + arrayBuffer: { enumerable: true }, + blob: { enumerable: true }, + json: { enumerable: true }, + text: { enumerable: true } +}); + +Body.mixIn = function (proto) { + for (const name of Object.getOwnPropertyNames(Body.prototype)) { + // istanbul ignore else: future proof + if (!(name in proto)) { + const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); + Object.defineProperty(proto, name, desc); + } + } +}; + +/** + * Consume and convert an entire Body to a Buffer. + * + * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body + * + * @return Promise + */ +function consumeBody() { + var _this4 = this; + + if (this[INTERNALS].disturbed) { + return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); + } + + this[INTERNALS].disturbed = true; + + if (this[INTERNALS].error) { + return Body.Promise.reject(this[INTERNALS].error); + } + + let body = this.body; + + // body is null + if (body === null) { + return Body.Promise.resolve(Buffer.alloc(0)); + } + + // body is blob + if (isBlob(body)) { + body = body.stream(); + } + + // body is buffer + if (Buffer.isBuffer(body)) { + return Body.Promise.resolve(body); + } + + // istanbul ignore if: should never happen + if (!(body instanceof Stream)) { + return Body.Promise.resolve(Buffer.alloc(0)); + } + + // body is stream + // get ready to actually consume the body + let accum = []; + let accumBytes = 0; + let abort = false; + + return new Body.Promise(function (resolve, reject) { + let resTimeout; + + // allow timeout on slow response body + if (_this4.timeout) { + resTimeout = setTimeout(function () { + abort = true; + reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); + }, _this4.timeout); + } + + // handle stream errors + body.on('error', function (err) { + if (err.name === 'AbortError') { + // if the request was aborted, reject with this Error + abort = true; + reject(err); + } else { + // other errors, such as incorrect content-encoding + reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); + } + }); + + body.on('data', function (chunk) { + if (abort || chunk === null) { + return; + } + + if (_this4.size && accumBytes + chunk.length > _this4.size) { + abort = true; + reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); + return; + } + + accumBytes += chunk.length; + accum.push(chunk); + }); + + body.on('end', function () { + if (abort) { + return; + } + + clearTimeout(resTimeout); + + try { + resolve(Buffer.concat(accum, accumBytes)); + } catch (err) { + // handle streams that have accumulated too much data (issue #414) + reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); + } + }); + }); +} + +/** + * Detect buffer encoding and convert to target encoding + * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding + * + * @param Buffer buffer Incoming buffer + * @param String encoding Target encoding + * @return String + */ +function convertBody(buffer, headers) { + if (typeof convert !== 'function') { + throw new Error('The package `encoding` must be installed to use the textConverted() function'); + } + + const ct = headers.get('content-type'); + let charset = 'utf-8'; + let res, str; + + // header + if (ct) { + res = /charset=([^;]*)/i.exec(ct); + } + + // no charset in content type, peek at response body for at most 1024 bytes + str = buffer.slice(0, 1024).toString(); + + // html5 + if (!res && str) { + res = / 0 && arguments[0] !== undefined ? arguments[0] : undefined; + + this[MAP] = Object.create(null); + + if (init instanceof Headers) { + const rawHeaders = init.raw(); + const headerNames = Object.keys(rawHeaders); + + for (const headerName of headerNames) { + for (const value of rawHeaders[headerName]) { + this.append(headerName, value); + } + } + + return; + } + + // We don't worry about converting prop to ByteString here as append() + // will handle it. + if (init == null) ; else if (typeof init === 'object') { + const method = init[Symbol.iterator]; + if (method != null) { + if (typeof method !== 'function') { + throw new TypeError('Header pairs must be iterable'); + } + + // sequence> + // Note: per spec we have to first exhaust the lists then process them + const pairs = []; + for (const pair of init) { + if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { + throw new TypeError('Each header pair must be iterable'); + } + pairs.push(Array.from(pair)); + } + + for (const pair of pairs) { + if (pair.length !== 2) { + throw new TypeError('Each header pair must be a name/value tuple'); + } + this.append(pair[0], pair[1]); + } + } else { + // record + for (const key of Object.keys(init)) { + const value = init[key]; + this.append(key, value); + } + } + } else { + throw new TypeError('Provided initializer must be an object'); + } + } + + /** + * Return combined header value given name + * + * @param String name Header name + * @return Mixed + */ + get(name) { + name = `${name}`; + validateName(name); + const key = find(this[MAP], name); + if (key === undefined) { + return null; + } + + return this[MAP][key].join(', '); + } + + /** + * Iterate over all headers + * + * @param Function callback Executed for each item with parameters (value, name, thisArg) + * @param Boolean thisArg `this` context for callback function + * @return Void + */ + forEach(callback) { + let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; + + let pairs = getHeaders(this); + let i = 0; + while (i < pairs.length) { + var _pairs$i = pairs[i]; + const name = _pairs$i[0], + value = _pairs$i[1]; + + callback.call(thisArg, value, name, this); + pairs = getHeaders(this); + i++; + } + } + + /** + * Overwrite header values given name + * + * @param String name Header name + * @param String value Header value + * @return Void + */ + set(name, value) { + name = `${name}`; + value = `${value}`; + validateName(name); + validateValue(value); + const key = find(this[MAP], name); + this[MAP][key !== undefined ? key : name] = [value]; + } + + /** + * Append a value onto existing header + * + * @param String name Header name + * @param String value Header value + * @return Void + */ + append(name, value) { + name = `${name}`; + value = `${value}`; + validateName(name); + validateValue(value); + const key = find(this[MAP], name); + if (key !== undefined) { + this[MAP][key].push(value); + } else { + this[MAP][name] = [value]; + } + } + + /** + * Check for header name existence + * + * @param String name Header name + * @return Boolean + */ + has(name) { + name = `${name}`; + validateName(name); + return find(this[MAP], name) !== undefined; + } + + /** + * Delete all header values given name + * + * @param String name Header name + * @return Void + */ + delete(name) { + name = `${name}`; + validateName(name); + const key = find(this[MAP], name); + if (key !== undefined) { + delete this[MAP][key]; + } + } + + /** + * Return raw headers (non-spec api) + * + * @return Object + */ + raw() { + return this[MAP]; + } + + /** + * Get an iterator on keys. + * + * @return Iterator + */ + keys() { + return createHeadersIterator(this, 'key'); + } + + /** + * Get an iterator on values. + * + * @return Iterator + */ + values() { + return createHeadersIterator(this, 'value'); + } + + /** + * Get an iterator on entries. + * + * This is the default iterator of the Headers object. + * + * @return Iterator + */ + [Symbol.iterator]() { + return createHeadersIterator(this, 'key+value'); + } +} +Headers.prototype.entries = Headers.prototype[Symbol.iterator]; + +Object.defineProperty(Headers.prototype, Symbol.toStringTag, { + value: 'Headers', + writable: false, + enumerable: false, + configurable: true +}); + +Object.defineProperties(Headers.prototype, { + get: { enumerable: true }, + forEach: { enumerable: true }, + set: { enumerable: true }, + append: { enumerable: true }, + has: { enumerable: true }, + delete: { enumerable: true }, + keys: { enumerable: true }, + values: { enumerable: true }, + entries: { enumerable: true } +}); + +function getHeaders(headers) { + let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; + + const keys = Object.keys(headers[MAP]).sort(); + return keys.map(kind === 'key' ? function (k) { + return k.toLowerCase(); + } : kind === 'value' ? function (k) { + return headers[MAP][k].join(', '); + } : function (k) { + return [k.toLowerCase(), headers[MAP][k].join(', ')]; + }); +} + +const INTERNAL = Symbol('internal'); + +function createHeadersIterator(target, kind) { + const iterator = Object.create(HeadersIteratorPrototype); + iterator[INTERNAL] = { + target, + kind, + index: 0 + }; + return iterator; +} + +const HeadersIteratorPrototype = Object.setPrototypeOf({ + next() { + // istanbul ignore if + if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { + throw new TypeError('Value of `this` is not a HeadersIterator'); + } + + var _INTERNAL = this[INTERNAL]; + const target = _INTERNAL.target, + kind = _INTERNAL.kind, + index = _INTERNAL.index; + + const values = getHeaders(target, kind); + const len = values.length; + if (index >= len) { + return { + value: undefined, + done: true + }; + } + + this[INTERNAL].index = index + 1; + + return { + value: values[index], + done: false + }; + } +}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); + +Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { + value: 'HeadersIterator', + writable: false, + enumerable: false, + configurable: true +}); + +/** + * Export the Headers object in a form that Node.js can consume. + * + * @param Headers headers + * @return Object + */ +function exportNodeCompatibleHeaders(headers) { + const obj = Object.assign({ __proto__: null }, headers[MAP]); + + // http.request() only supports string as Host header. This hack makes + // specifying custom Host header possible. + const hostHeaderKey = find(headers[MAP], 'Host'); + if (hostHeaderKey !== undefined) { + obj[hostHeaderKey] = obj[hostHeaderKey][0]; + } + + return obj; +} + +/** + * Create a Headers object from an object of headers, ignoring those that do + * not conform to HTTP grammar productions. + * + * @param Object obj Object of headers + * @return Headers + */ +function createHeadersLenient(obj) { + const headers = new Headers(); + for (const name of Object.keys(obj)) { + if (invalidTokenRegex.test(name)) { + continue; + } + if (Array.isArray(obj[name])) { + for (const val of obj[name]) { + if (invalidHeaderCharRegex.test(val)) { + continue; + } + if (headers[MAP][name] === undefined) { + headers[MAP][name] = [val]; + } else { + headers[MAP][name].push(val); + } + } + } else if (!invalidHeaderCharRegex.test(obj[name])) { + headers[MAP][name] = [obj[name]]; + } + } + return headers; +} + +const INTERNALS$1 = Symbol('Response internals'); + +// fix an issue where "STATUS_CODES" aren't a named export for node <10 +const STATUS_CODES = http.STATUS_CODES; + +/** + * Response class + * + * @param Stream body Readable stream + * @param Object opts Response options + * @return Void + */ +class Response { + constructor() { + let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + Body.call(this, body, opts); + + const status = opts.status || 200; + const headers = new Headers(opts.headers); + + if (body != null && !headers.has('Content-Type')) { + const contentType = extractContentType(body); + if (contentType) { + headers.append('Content-Type', contentType); + } + } + + this[INTERNALS$1] = { + url: opts.url, + status, + statusText: opts.statusText || STATUS_CODES[status], + headers, + counter: opts.counter + }; + } + + get url() { + return this[INTERNALS$1].url || ''; + } + + get status() { + return this[INTERNALS$1].status; + } + + /** + * Convenience property representing if the request ended normally + */ + get ok() { + return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; + } + + get redirected() { + return this[INTERNALS$1].counter > 0; + } + + get statusText() { + return this[INTERNALS$1].statusText; + } + + get headers() { + return this[INTERNALS$1].headers; + } + + /** + * Clone this response + * + * @return Response + */ + clone() { + return new Response(clone(this), { + url: this.url, + status: this.status, + statusText: this.statusText, + headers: this.headers, + ok: this.ok, + redirected: this.redirected + }); + } +} + +Body.mixIn(Response.prototype); + +Object.defineProperties(Response.prototype, { + url: { enumerable: true }, + status: { enumerable: true }, + ok: { enumerable: true }, + redirected: { enumerable: true }, + statusText: { enumerable: true }, + headers: { enumerable: true }, + clone: { enumerable: true } +}); + +Object.defineProperty(Response.prototype, Symbol.toStringTag, { + value: 'Response', + writable: false, + enumerable: false, + configurable: true +}); + +const INTERNALS$2 = Symbol('Request internals'); +const URL = Url.URL || whatwgUrl.URL; + +// fix an issue where "format", "parse" aren't a named export for node <10 +const parse_url = Url.parse; +const format_url = Url.format; + +/** + * Wrapper around `new URL` to handle arbitrary URLs + * + * @param {string} urlStr + * @return {void} + */ +function parseURL(urlStr) { + /* + Check whether the URL is absolute or not + Scheme: https://tools.ietf.org/html/rfc3986#section-3.1 + Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3 + */ + if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.exec(urlStr)) { + urlStr = new URL(urlStr).toString(); + } + + // Fallback to old implementation for arbitrary URLs + return parse_url(urlStr); +} + +const streamDestructionSupported = 'destroy' in Stream.Readable.prototype; + +/** + * Check if a value is an instance of Request. + * + * @param Mixed input + * @return Boolean + */ +function isRequest(input) { + return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; +} + +function isAbortSignal(signal) { + const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal); + return !!(proto && proto.constructor.name === 'AbortSignal'); +} + +/** + * Request class + * + * @param Mixed input Url or Request instance + * @param Object init Custom options + * @return Void + */ +class Request { + constructor(input) { + let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + let parsedURL; + + // normalize input + if (!isRequest(input)) { + if (input && input.href) { + // in order to support Node.js' Url objects; though WHATWG's URL objects + // will fall into this branch also (since their `toString()` will return + // `href` property anyway) + parsedURL = parseURL(input.href); + } else { + // coerce input to a string before attempting to parse + parsedURL = parseURL(`${input}`); + } + input = {}; + } else { + parsedURL = parseURL(input.url); + } + + let method = init.method || input.method || 'GET'; + method = method.toUpperCase(); + + if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { + throw new TypeError('Request with GET/HEAD method cannot have body'); + } + + let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; + + Body.call(this, inputBody, { + timeout: init.timeout || input.timeout || 0, + size: init.size || input.size || 0 + }); + + const headers = new Headers(init.headers || input.headers || {}); + + if (inputBody != null && !headers.has('Content-Type')) { + const contentType = extractContentType(inputBody); + if (contentType) { + headers.append('Content-Type', contentType); + } + } + + let signal = isRequest(input) ? input.signal : null; + if ('signal' in init) signal = init.signal; + + if (signal != null && !isAbortSignal(signal)) { + throw new TypeError('Expected signal to be an instanceof AbortSignal'); + } + + this[INTERNALS$2] = { + method, + redirect: init.redirect || input.redirect || 'follow', + headers, + parsedURL, + signal + }; + + // node-fetch-only options + this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; + this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; + this.counter = init.counter || input.counter || 0; + this.agent = init.agent || input.agent; + } + + get method() { + return this[INTERNALS$2].method; + } + + get url() { + return format_url(this[INTERNALS$2].parsedURL); + } + + get headers() { + return this[INTERNALS$2].headers; + } + + get redirect() { + return this[INTERNALS$2].redirect; + } + + get signal() { + return this[INTERNALS$2].signal; + } + + /** + * Clone this request + * + * @return Request + */ + clone() { + return new Request(this); + } +} + +Body.mixIn(Request.prototype); + +Object.defineProperty(Request.prototype, Symbol.toStringTag, { + value: 'Request', + writable: false, + enumerable: false, + configurable: true +}); + +Object.defineProperties(Request.prototype, { + method: { enumerable: true }, + url: { enumerable: true }, + headers: { enumerable: true }, + redirect: { enumerable: true }, + clone: { enumerable: true }, + signal: { enumerable: true } +}); + +/** + * Convert a Request to Node.js http request options. + * + * @param Request A Request instance + * @return Object The options object to be passed to http.request + */ +function getNodeRequestOptions(request) { + const parsedURL = request[INTERNALS$2].parsedURL; + const headers = new Headers(request[INTERNALS$2].headers); + + // fetch step 1.3 + if (!headers.has('Accept')) { + headers.set('Accept', '*/*'); + } + + // Basic fetch + if (!parsedURL.protocol || !parsedURL.hostname) { + throw new TypeError('Only absolute URLs are supported'); + } + + if (!/^https?:$/.test(parsedURL.protocol)) { + throw new TypeError('Only HTTP(S) protocols are supported'); + } + + if (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) { + throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8'); + } + + // HTTP-network-or-cache fetch steps 2.4-2.7 + let contentLengthValue = null; + if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { + contentLengthValue = '0'; + } + if (request.body != null) { + const totalBytes = getTotalBytes(request); + if (typeof totalBytes === 'number') { + contentLengthValue = String(totalBytes); + } + } + if (contentLengthValue) { + headers.set('Content-Length', contentLengthValue); + } + + // HTTP-network-or-cache fetch step 2.11 + if (!headers.has('User-Agent')) { + headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); + } + + // HTTP-network-or-cache fetch step 2.15 + if (request.compress && !headers.has('Accept-Encoding')) { + headers.set('Accept-Encoding', 'gzip,deflate'); + } + + let agent = request.agent; + if (typeof agent === 'function') { + agent = agent(parsedURL); + } + + // HTTP-network fetch step 4.2 + // chunked encoding is handled by Node.js + + return Object.assign({}, parsedURL, { + method: request.method, + headers: exportNodeCompatibleHeaders(headers), + agent + }); +} + +/** + * abort-error.js + * + * AbortError interface for cancelled requests + */ + +/** + * Create AbortError instance + * + * @param String message Error message for human + * @return AbortError + */ +function AbortError(message) { + Error.call(this, message); + + this.type = 'aborted'; + this.message = message; + + // hide custom error implementation details from end-users + Error.captureStackTrace(this, this.constructor); +} + +AbortError.prototype = Object.create(Error.prototype); +AbortError.prototype.constructor = AbortError; +AbortError.prototype.name = 'AbortError'; + +const URL$1 = Url.URL || whatwgUrl.URL; + +// fix an issue where "PassThrough", "resolve" aren't a named export for node <10 +const PassThrough$1 = Stream.PassThrough; + +const isDomainOrSubdomain = function isDomainOrSubdomain(destination, original) { + const orig = new URL$1(original).hostname; + const dest = new URL$1(destination).hostname; + + return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest); +}; + +/** + * isSameProtocol reports whether the two provided URLs use the same protocol. + * + * Both domains must already be in canonical form. + * @param {string|URL} original + * @param {string|URL} destination + */ +const isSameProtocol = function isSameProtocol(destination, original) { + const orig = new URL$1(original).protocol; + const dest = new URL$1(destination).protocol; + + return orig === dest; +}; + +/** + * Fetch function + * + * @param Mixed url Absolute url or Request instance + * @param Object opts Fetch options + * @return Promise + */ +function fetch(url, opts) { + + // allow custom promise + if (!fetch.Promise) { + throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); + } + + Body.Promise = fetch.Promise; + + // wrap http.request into fetch + return new fetch.Promise(function (resolve, reject) { + // build request object + const request = new Request(url, opts); + const options = getNodeRequestOptions(request); + + const send = (options.protocol === 'https:' ? https : http).request; + const signal = request.signal; + + let response = null; + + const abort = function abort() { + let error = new AbortError('The user aborted a request.'); + reject(error); + if (request.body && request.body instanceof Stream.Readable) { + destroyStream(request.body, error); + } + if (!response || !response.body) return; + response.body.emit('error', error); + }; + + if (signal && signal.aborted) { + abort(); + return; + } + + const abortAndFinalize = function abortAndFinalize() { + abort(); + finalize(); + }; + + // send request + const req = send(options); + let reqTimeout; + + if (signal) { + signal.addEventListener('abort', abortAndFinalize); + } + + function finalize() { + req.abort(); + if (signal) signal.removeEventListener('abort', abortAndFinalize); + clearTimeout(reqTimeout); + } + + if (request.timeout) { + req.once('socket', function (socket) { + reqTimeout = setTimeout(function () { + reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); + finalize(); + }, request.timeout); + }); + } + + req.on('error', function (err) { + reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); + + if (response && response.body) { + destroyStream(response.body, err); + } + + finalize(); + }); + + fixResponseChunkedTransferBadEnding(req, function (err) { + if (signal && signal.aborted) { + return; + } + + if (response && response.body) { + destroyStream(response.body, err); + } + }); + + /* c8 ignore next 18 */ + if (parseInt(process.version.substring(1)) < 14) { + // Before Node.js 14, pipeline() does not fully support async iterators and does not always + // properly handle when the socket close/end events are out of order. + req.on('socket', function (s) { + s.addListener('close', function (hadError) { + // if a data listener is still present we didn't end cleanly + const hasDataListener = s.listenerCount('data') > 0; + + // if end happened before close but the socket didn't emit an error, do it now + if (response && hasDataListener && !hadError && !(signal && signal.aborted)) { + const err = new Error('Premature close'); + err.code = 'ERR_STREAM_PREMATURE_CLOSE'; + response.body.emit('error', err); + } + }); + }); + } + + req.on('response', function (res) { + clearTimeout(reqTimeout); + + const headers = createHeadersLenient(res.headers); + + // HTTP fetch step 5 + if (fetch.isRedirect(res.statusCode)) { + // HTTP fetch step 5.2 + const location = headers.get('Location'); + + // HTTP fetch step 5.3 + let locationURL = null; + try { + locationURL = location === null ? null : new URL$1(location, request.url).toString(); + } catch (err) { + // error here can only be invalid URL in Location: header + // do not throw when options.redirect == manual + // let the user extract the errorneous redirect URL + if (request.redirect !== 'manual') { + reject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, 'invalid-redirect')); + finalize(); + return; + } + } + + // HTTP fetch step 5.5 + switch (request.redirect) { + case 'error': + reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect')); + finalize(); + return; + case 'manual': + // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. + if (locationURL !== null) { + // handle corrupted header + try { + headers.set('Location', locationURL); + } catch (err) { + // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request + reject(err); + } + } + break; + case 'follow': + // HTTP-redirect fetch step 2 + if (locationURL === null) { + break; + } + + // HTTP-redirect fetch step 5 + if (request.counter >= request.follow) { + reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); + finalize(); + return; + } + + // HTTP-redirect fetch step 6 (counter increment) + // Create a new Request object. + const requestOpts = { + headers: new Headers(request.headers), + follow: request.follow, + counter: request.counter + 1, + agent: request.agent, + compress: request.compress, + method: request.method, + body: request.body, + signal: request.signal, + timeout: request.timeout, + size: request.size + }; + + if (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) { + for (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) { + requestOpts.headers.delete(name); + } + } + + // HTTP-redirect fetch step 9 + if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { + reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); + finalize(); + return; + } + + // HTTP-redirect fetch step 11 + if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { + requestOpts.method = 'GET'; + requestOpts.body = undefined; + requestOpts.headers.delete('content-length'); + } + + // HTTP-redirect fetch step 15 + resolve(fetch(new Request(locationURL, requestOpts))); + finalize(); + return; + } + } + + // prepare response + res.once('end', function () { + if (signal) signal.removeEventListener('abort', abortAndFinalize); + }); + let body = res.pipe(new PassThrough$1()); + + const response_options = { + url: request.url, + status: res.statusCode, + statusText: res.statusMessage, + headers: headers, + size: request.size, + timeout: request.timeout, + counter: request.counter + }; + + // HTTP-network fetch step 12.1.1.3 + const codings = headers.get('Content-Encoding'); + + // HTTP-network fetch step 12.1.1.4: handle content codings + + // in following scenarios we ignore compression support + // 1. compression support is disabled + // 2. HEAD request + // 3. no Content-Encoding header + // 4. no content response (204) + // 5. content not modified response (304) + if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { + response = new Response(body, response_options); + resolve(response); + return; + } + + // For Node v6+ + // Be less strict when decoding compressed responses, since sometimes + // servers send slightly invalid responses that are still accepted + // by common browsers. + // Always using Z_SYNC_FLUSH is what cURL does. + const zlibOptions = { + flush: zlib.Z_SYNC_FLUSH, + finishFlush: zlib.Z_SYNC_FLUSH + }; + + // for gzip + if (codings == 'gzip' || codings == 'x-gzip') { + body = body.pipe(zlib.createGunzip(zlibOptions)); + response = new Response(body, response_options); + resolve(response); + return; + } + + // for deflate + if (codings == 'deflate' || codings == 'x-deflate') { + // handle the infamous raw deflate response from old servers + // a hack for old IIS and Apache servers + const raw = res.pipe(new PassThrough$1()); + raw.once('data', function (chunk) { + // see http://stackoverflow.com/questions/37519828 + if ((chunk[0] & 0x0F) === 0x08) { + body = body.pipe(zlib.createInflate()); + } else { + body = body.pipe(zlib.createInflateRaw()); + } + response = new Response(body, response_options); + resolve(response); + }); + raw.on('end', function () { + // some old IIS servers return zero-length OK deflate responses, so 'data' is never emitted. + if (!response) { + response = new Response(body, response_options); + resolve(response); + } + }); + return; + } + + // for br + if (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') { + body = body.pipe(zlib.createBrotliDecompress()); + response = new Response(body, response_options); + resolve(response); + return; + } + + // otherwise, use response as-is + response = new Response(body, response_options); + resolve(response); + }); + + writeToStream(req, request); + }); +} +function fixResponseChunkedTransferBadEnding(request, errorCallback) { + let socket; + + request.on('socket', function (s) { + socket = s; + }); + + request.on('response', function (response) { + const headers = response.headers; + + if (headers['transfer-encoding'] === 'chunked' && !headers['content-length']) { + response.once('close', function (hadError) { + // tests for socket presence, as in some situations the + // the 'socket' event is not triggered for the request + // (happens in deno), avoids `TypeError` + // if a data listener is still present we didn't end cleanly + const hasDataListener = socket && socket.listenerCount('data') > 0; + + if (hasDataListener && !hadError) { + const err = new Error('Premature close'); + err.code = 'ERR_STREAM_PREMATURE_CLOSE'; + errorCallback(err); + } + }); + } + }); +} + +function destroyStream(stream, err) { + if (stream.destroy) { + stream.destroy(err); + } else { + // node < 8 + stream.emit('error', err); + stream.end(); + } +} + +/** + * Redirect code matching + * + * @param Number code Status code + * @return Boolean + */ +fetch.isRedirect = function (code) { + return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; +}; + +// expose Promise +fetch.Promise = global.Promise; + +module.exports = exports = fetch; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = exports; +exports.Headers = Headers; +exports.Request = Request; +exports.Response = Response; +exports.FetchError = FetchError; +exports.AbortError = AbortError; diff --git a/project starter code/node_modules/node-fetch/lib/index.mjs b/project starter code/node_modules/node-fetch/lib/index.mjs new file mode 100644 index 00000000..2863dd9c --- /dev/null +++ b/project starter code/node_modules/node-fetch/lib/index.mjs @@ -0,0 +1,1775 @@ +import Stream from 'stream'; +import http from 'http'; +import Url from 'url'; +import whatwgUrl from 'whatwg-url'; +import https from 'https'; +import zlib from 'zlib'; + +// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js + +// fix for "Readable" isn't a named export issue +const Readable = Stream.Readable; + +const BUFFER = Symbol('buffer'); +const TYPE = Symbol('type'); + +class Blob { + constructor() { + this[TYPE] = ''; + + const blobParts = arguments[0]; + const options = arguments[1]; + + const buffers = []; + let size = 0; + + if (blobParts) { + const a = blobParts; + const length = Number(a.length); + for (let i = 0; i < length; i++) { + const element = a[i]; + let buffer; + if (element instanceof Buffer) { + buffer = element; + } else if (ArrayBuffer.isView(element)) { + buffer = Buffer.from(element.buffer, element.byteOffset, element.byteLength); + } else if (element instanceof ArrayBuffer) { + buffer = Buffer.from(element); + } else if (element instanceof Blob) { + buffer = element[BUFFER]; + } else { + buffer = Buffer.from(typeof element === 'string' ? element : String(element)); + } + size += buffer.length; + buffers.push(buffer); + } + } + + this[BUFFER] = Buffer.concat(buffers); + + let type = options && options.type !== undefined && String(options.type).toLowerCase(); + if (type && !/[^\u0020-\u007E]/.test(type)) { + this[TYPE] = type; + } + } + get size() { + return this[BUFFER].length; + } + get type() { + return this[TYPE]; + } + text() { + return Promise.resolve(this[BUFFER].toString()); + } + arrayBuffer() { + const buf = this[BUFFER]; + const ab = buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + return Promise.resolve(ab); + } + stream() { + const readable = new Readable(); + readable._read = function () {}; + readable.push(this[BUFFER]); + readable.push(null); + return readable; + } + toString() { + return '[object Blob]'; + } + slice() { + const size = this.size; + + const start = arguments[0]; + const end = arguments[1]; + let relativeStart, relativeEnd; + if (start === undefined) { + relativeStart = 0; + } else if (start < 0) { + relativeStart = Math.max(size + start, 0); + } else { + relativeStart = Math.min(start, size); + } + if (end === undefined) { + relativeEnd = size; + } else if (end < 0) { + relativeEnd = Math.max(size + end, 0); + } else { + relativeEnd = Math.min(end, size); + } + const span = Math.max(relativeEnd - relativeStart, 0); + + const buffer = this[BUFFER]; + const slicedBuffer = buffer.slice(relativeStart, relativeStart + span); + const blob = new Blob([], { type: arguments[2] }); + blob[BUFFER] = slicedBuffer; + return blob; + } +} + +Object.defineProperties(Blob.prototype, { + size: { enumerable: true }, + type: { enumerable: true }, + slice: { enumerable: true } +}); + +Object.defineProperty(Blob.prototype, Symbol.toStringTag, { + value: 'Blob', + writable: false, + enumerable: false, + configurable: true +}); + +/** + * fetch-error.js + * + * FetchError interface for operational errors + */ + +/** + * Create FetchError instance + * + * @param String message Error message for human + * @param String type Error type for machine + * @param String systemError For Node.js system error + * @return FetchError + */ +function FetchError(message, type, systemError) { + Error.call(this, message); + + this.message = message; + this.type = type; + + // when err.type is `system`, err.code contains system error code + if (systemError) { + this.code = this.errno = systemError.code; + } + + // hide custom error implementation details from end-users + Error.captureStackTrace(this, this.constructor); +} + +FetchError.prototype = Object.create(Error.prototype); +FetchError.prototype.constructor = FetchError; +FetchError.prototype.name = 'FetchError'; + +let convert; +try { + convert = require('encoding').convert; +} catch (e) {} + +const INTERNALS = Symbol('Body internals'); + +// fix an issue where "PassThrough" isn't a named export for node <10 +const PassThrough = Stream.PassThrough; + +/** + * Body mixin + * + * Ref: https://fetch.spec.whatwg.org/#body + * + * @param Stream body Readable stream + * @param Object opts Response options + * @return Void + */ +function Body(body) { + var _this = this; + + var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, + _ref$size = _ref.size; + + let size = _ref$size === undefined ? 0 : _ref$size; + var _ref$timeout = _ref.timeout; + let timeout = _ref$timeout === undefined ? 0 : _ref$timeout; + + if (body == null) { + // body is undefined or null + body = null; + } else if (isURLSearchParams(body)) { + // body is a URLSearchParams + body = Buffer.from(body.toString()); + } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (Object.prototype.toString.call(body) === '[object ArrayBuffer]') { + // body is ArrayBuffer + body = Buffer.from(body); + } else if (ArrayBuffer.isView(body)) { + // body is ArrayBufferView + body = Buffer.from(body.buffer, body.byteOffset, body.byteLength); + } else if (body instanceof Stream) ; else { + // none of the above + // coerce to string then buffer + body = Buffer.from(String(body)); + } + this[INTERNALS] = { + body, + disturbed: false, + error: null + }; + this.size = size; + this.timeout = timeout; + + if (body instanceof Stream) { + body.on('error', function (err) { + const error = err.name === 'AbortError' ? err : new FetchError(`Invalid response body while trying to fetch ${_this.url}: ${err.message}`, 'system', err); + _this[INTERNALS].error = error; + }); + } +} + +Body.prototype = { + get body() { + return this[INTERNALS].body; + }, + + get bodyUsed() { + return this[INTERNALS].disturbed; + }, + + /** + * Decode response as ArrayBuffer + * + * @return Promise + */ + arrayBuffer() { + return consumeBody.call(this).then(function (buf) { + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + }); + }, + + /** + * Return raw response as Blob + * + * @return Promise + */ + blob() { + let ct = this.headers && this.headers.get('content-type') || ''; + return consumeBody.call(this).then(function (buf) { + return Object.assign( + // Prevent copying + new Blob([], { + type: ct.toLowerCase() + }), { + [BUFFER]: buf + }); + }); + }, + + /** + * Decode response as json + * + * @return Promise + */ + json() { + var _this2 = this; + + return consumeBody.call(this).then(function (buffer) { + try { + return JSON.parse(buffer.toString()); + } catch (err) { + return Body.Promise.reject(new FetchError(`invalid json response body at ${_this2.url} reason: ${err.message}`, 'invalid-json')); + } + }); + }, + + /** + * Decode response as text + * + * @return Promise + */ + text() { + return consumeBody.call(this).then(function (buffer) { + return buffer.toString(); + }); + }, + + /** + * Decode response as buffer (non-spec api) + * + * @return Promise + */ + buffer() { + return consumeBody.call(this); + }, + + /** + * Decode response as text, while automatically detecting the encoding and + * trying to decode to UTF-8 (non-spec api) + * + * @return Promise + */ + textConverted() { + var _this3 = this; + + return consumeBody.call(this).then(function (buffer) { + return convertBody(buffer, _this3.headers); + }); + } +}; + +// In browsers, all properties are enumerable. +Object.defineProperties(Body.prototype, { + body: { enumerable: true }, + bodyUsed: { enumerable: true }, + arrayBuffer: { enumerable: true }, + blob: { enumerable: true }, + json: { enumerable: true }, + text: { enumerable: true } +}); + +Body.mixIn = function (proto) { + for (const name of Object.getOwnPropertyNames(Body.prototype)) { + // istanbul ignore else: future proof + if (!(name in proto)) { + const desc = Object.getOwnPropertyDescriptor(Body.prototype, name); + Object.defineProperty(proto, name, desc); + } + } +}; + +/** + * Consume and convert an entire Body to a Buffer. + * + * Ref: https://fetch.spec.whatwg.org/#concept-body-consume-body + * + * @return Promise + */ +function consumeBody() { + var _this4 = this; + + if (this[INTERNALS].disturbed) { + return Body.Promise.reject(new TypeError(`body used already for: ${this.url}`)); + } + + this[INTERNALS].disturbed = true; + + if (this[INTERNALS].error) { + return Body.Promise.reject(this[INTERNALS].error); + } + + let body = this.body; + + // body is null + if (body === null) { + return Body.Promise.resolve(Buffer.alloc(0)); + } + + // body is blob + if (isBlob(body)) { + body = body.stream(); + } + + // body is buffer + if (Buffer.isBuffer(body)) { + return Body.Promise.resolve(body); + } + + // istanbul ignore if: should never happen + if (!(body instanceof Stream)) { + return Body.Promise.resolve(Buffer.alloc(0)); + } + + // body is stream + // get ready to actually consume the body + let accum = []; + let accumBytes = 0; + let abort = false; + + return new Body.Promise(function (resolve, reject) { + let resTimeout; + + // allow timeout on slow response body + if (_this4.timeout) { + resTimeout = setTimeout(function () { + abort = true; + reject(new FetchError(`Response timeout while trying to fetch ${_this4.url} (over ${_this4.timeout}ms)`, 'body-timeout')); + }, _this4.timeout); + } + + // handle stream errors + body.on('error', function (err) { + if (err.name === 'AbortError') { + // if the request was aborted, reject with this Error + abort = true; + reject(err); + } else { + // other errors, such as incorrect content-encoding + reject(new FetchError(`Invalid response body while trying to fetch ${_this4.url}: ${err.message}`, 'system', err)); + } + }); + + body.on('data', function (chunk) { + if (abort || chunk === null) { + return; + } + + if (_this4.size && accumBytes + chunk.length > _this4.size) { + abort = true; + reject(new FetchError(`content size at ${_this4.url} over limit: ${_this4.size}`, 'max-size')); + return; + } + + accumBytes += chunk.length; + accum.push(chunk); + }); + + body.on('end', function () { + if (abort) { + return; + } + + clearTimeout(resTimeout); + + try { + resolve(Buffer.concat(accum, accumBytes)); + } catch (err) { + // handle streams that have accumulated too much data (issue #414) + reject(new FetchError(`Could not create Buffer from response body for ${_this4.url}: ${err.message}`, 'system', err)); + } + }); + }); +} + +/** + * Detect buffer encoding and convert to target encoding + * ref: http://www.w3.org/TR/2011/WD-html5-20110113/parsing.html#determining-the-character-encoding + * + * @param Buffer buffer Incoming buffer + * @param String encoding Target encoding + * @return String + */ +function convertBody(buffer, headers) { + if (typeof convert !== 'function') { + throw new Error('The package `encoding` must be installed to use the textConverted() function'); + } + + const ct = headers.get('content-type'); + let charset = 'utf-8'; + let res, str; + + // header + if (ct) { + res = /charset=([^;]*)/i.exec(ct); + } + + // no charset in content type, peek at response body for at most 1024 bytes + str = buffer.slice(0, 1024).toString(); + + // html5 + if (!res && str) { + res = / 0 && arguments[0] !== undefined ? arguments[0] : undefined; + + this[MAP] = Object.create(null); + + if (init instanceof Headers) { + const rawHeaders = init.raw(); + const headerNames = Object.keys(rawHeaders); + + for (const headerName of headerNames) { + for (const value of rawHeaders[headerName]) { + this.append(headerName, value); + } + } + + return; + } + + // We don't worry about converting prop to ByteString here as append() + // will handle it. + if (init == null) ; else if (typeof init === 'object') { + const method = init[Symbol.iterator]; + if (method != null) { + if (typeof method !== 'function') { + throw new TypeError('Header pairs must be iterable'); + } + + // sequence> + // Note: per spec we have to first exhaust the lists then process them + const pairs = []; + for (const pair of init) { + if (typeof pair !== 'object' || typeof pair[Symbol.iterator] !== 'function') { + throw new TypeError('Each header pair must be iterable'); + } + pairs.push(Array.from(pair)); + } + + for (const pair of pairs) { + if (pair.length !== 2) { + throw new TypeError('Each header pair must be a name/value tuple'); + } + this.append(pair[0], pair[1]); + } + } else { + // record + for (const key of Object.keys(init)) { + const value = init[key]; + this.append(key, value); + } + } + } else { + throw new TypeError('Provided initializer must be an object'); + } + } + + /** + * Return combined header value given name + * + * @param String name Header name + * @return Mixed + */ + get(name) { + name = `${name}`; + validateName(name); + const key = find(this[MAP], name); + if (key === undefined) { + return null; + } + + return this[MAP][key].join(', '); + } + + /** + * Iterate over all headers + * + * @param Function callback Executed for each item with parameters (value, name, thisArg) + * @param Boolean thisArg `this` context for callback function + * @return Void + */ + forEach(callback) { + let thisArg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined; + + let pairs = getHeaders(this); + let i = 0; + while (i < pairs.length) { + var _pairs$i = pairs[i]; + const name = _pairs$i[0], + value = _pairs$i[1]; + + callback.call(thisArg, value, name, this); + pairs = getHeaders(this); + i++; + } + } + + /** + * Overwrite header values given name + * + * @param String name Header name + * @param String value Header value + * @return Void + */ + set(name, value) { + name = `${name}`; + value = `${value}`; + validateName(name); + validateValue(value); + const key = find(this[MAP], name); + this[MAP][key !== undefined ? key : name] = [value]; + } + + /** + * Append a value onto existing header + * + * @param String name Header name + * @param String value Header value + * @return Void + */ + append(name, value) { + name = `${name}`; + value = `${value}`; + validateName(name); + validateValue(value); + const key = find(this[MAP], name); + if (key !== undefined) { + this[MAP][key].push(value); + } else { + this[MAP][name] = [value]; + } + } + + /** + * Check for header name existence + * + * @param String name Header name + * @return Boolean + */ + has(name) { + name = `${name}`; + validateName(name); + return find(this[MAP], name) !== undefined; + } + + /** + * Delete all header values given name + * + * @param String name Header name + * @return Void + */ + delete(name) { + name = `${name}`; + validateName(name); + const key = find(this[MAP], name); + if (key !== undefined) { + delete this[MAP][key]; + } + } + + /** + * Return raw headers (non-spec api) + * + * @return Object + */ + raw() { + return this[MAP]; + } + + /** + * Get an iterator on keys. + * + * @return Iterator + */ + keys() { + return createHeadersIterator(this, 'key'); + } + + /** + * Get an iterator on values. + * + * @return Iterator + */ + values() { + return createHeadersIterator(this, 'value'); + } + + /** + * Get an iterator on entries. + * + * This is the default iterator of the Headers object. + * + * @return Iterator + */ + [Symbol.iterator]() { + return createHeadersIterator(this, 'key+value'); + } +} +Headers.prototype.entries = Headers.prototype[Symbol.iterator]; + +Object.defineProperty(Headers.prototype, Symbol.toStringTag, { + value: 'Headers', + writable: false, + enumerable: false, + configurable: true +}); + +Object.defineProperties(Headers.prototype, { + get: { enumerable: true }, + forEach: { enumerable: true }, + set: { enumerable: true }, + append: { enumerable: true }, + has: { enumerable: true }, + delete: { enumerable: true }, + keys: { enumerable: true }, + values: { enumerable: true }, + entries: { enumerable: true } +}); + +function getHeaders(headers) { + let kind = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'key+value'; + + const keys = Object.keys(headers[MAP]).sort(); + return keys.map(kind === 'key' ? function (k) { + return k.toLowerCase(); + } : kind === 'value' ? function (k) { + return headers[MAP][k].join(', '); + } : function (k) { + return [k.toLowerCase(), headers[MAP][k].join(', ')]; + }); +} + +const INTERNAL = Symbol('internal'); + +function createHeadersIterator(target, kind) { + const iterator = Object.create(HeadersIteratorPrototype); + iterator[INTERNAL] = { + target, + kind, + index: 0 + }; + return iterator; +} + +const HeadersIteratorPrototype = Object.setPrototypeOf({ + next() { + // istanbul ignore if + if (!this || Object.getPrototypeOf(this) !== HeadersIteratorPrototype) { + throw new TypeError('Value of `this` is not a HeadersIterator'); + } + + var _INTERNAL = this[INTERNAL]; + const target = _INTERNAL.target, + kind = _INTERNAL.kind, + index = _INTERNAL.index; + + const values = getHeaders(target, kind); + const len = values.length; + if (index >= len) { + return { + value: undefined, + done: true + }; + } + + this[INTERNAL].index = index + 1; + + return { + value: values[index], + done: false + }; + } +}, Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]()))); + +Object.defineProperty(HeadersIteratorPrototype, Symbol.toStringTag, { + value: 'HeadersIterator', + writable: false, + enumerable: false, + configurable: true +}); + +/** + * Export the Headers object in a form that Node.js can consume. + * + * @param Headers headers + * @return Object + */ +function exportNodeCompatibleHeaders(headers) { + const obj = Object.assign({ __proto__: null }, headers[MAP]); + + // http.request() only supports string as Host header. This hack makes + // specifying custom Host header possible. + const hostHeaderKey = find(headers[MAP], 'Host'); + if (hostHeaderKey !== undefined) { + obj[hostHeaderKey] = obj[hostHeaderKey][0]; + } + + return obj; +} + +/** + * Create a Headers object from an object of headers, ignoring those that do + * not conform to HTTP grammar productions. + * + * @param Object obj Object of headers + * @return Headers + */ +function createHeadersLenient(obj) { + const headers = new Headers(); + for (const name of Object.keys(obj)) { + if (invalidTokenRegex.test(name)) { + continue; + } + if (Array.isArray(obj[name])) { + for (const val of obj[name]) { + if (invalidHeaderCharRegex.test(val)) { + continue; + } + if (headers[MAP][name] === undefined) { + headers[MAP][name] = [val]; + } else { + headers[MAP][name].push(val); + } + } + } else if (!invalidHeaderCharRegex.test(obj[name])) { + headers[MAP][name] = [obj[name]]; + } + } + return headers; +} + +const INTERNALS$1 = Symbol('Response internals'); + +// fix an issue where "STATUS_CODES" aren't a named export for node <10 +const STATUS_CODES = http.STATUS_CODES; + +/** + * Response class + * + * @param Stream body Readable stream + * @param Object opts Response options + * @return Void + */ +class Response { + constructor() { + let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + Body.call(this, body, opts); + + const status = opts.status || 200; + const headers = new Headers(opts.headers); + + if (body != null && !headers.has('Content-Type')) { + const contentType = extractContentType(body); + if (contentType) { + headers.append('Content-Type', contentType); + } + } + + this[INTERNALS$1] = { + url: opts.url, + status, + statusText: opts.statusText || STATUS_CODES[status], + headers, + counter: opts.counter + }; + } + + get url() { + return this[INTERNALS$1].url || ''; + } + + get status() { + return this[INTERNALS$1].status; + } + + /** + * Convenience property representing if the request ended normally + */ + get ok() { + return this[INTERNALS$1].status >= 200 && this[INTERNALS$1].status < 300; + } + + get redirected() { + return this[INTERNALS$1].counter > 0; + } + + get statusText() { + return this[INTERNALS$1].statusText; + } + + get headers() { + return this[INTERNALS$1].headers; + } + + /** + * Clone this response + * + * @return Response + */ + clone() { + return new Response(clone(this), { + url: this.url, + status: this.status, + statusText: this.statusText, + headers: this.headers, + ok: this.ok, + redirected: this.redirected + }); + } +} + +Body.mixIn(Response.prototype); + +Object.defineProperties(Response.prototype, { + url: { enumerable: true }, + status: { enumerable: true }, + ok: { enumerable: true }, + redirected: { enumerable: true }, + statusText: { enumerable: true }, + headers: { enumerable: true }, + clone: { enumerable: true } +}); + +Object.defineProperty(Response.prototype, Symbol.toStringTag, { + value: 'Response', + writable: false, + enumerable: false, + configurable: true +}); + +const INTERNALS$2 = Symbol('Request internals'); +const URL = Url.URL || whatwgUrl.URL; + +// fix an issue where "format", "parse" aren't a named export for node <10 +const parse_url = Url.parse; +const format_url = Url.format; + +/** + * Wrapper around `new URL` to handle arbitrary URLs + * + * @param {string} urlStr + * @return {void} + */ +function parseURL(urlStr) { + /* + Check whether the URL is absolute or not + Scheme: https://tools.ietf.org/html/rfc3986#section-3.1 + Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3 + */ + if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.exec(urlStr)) { + urlStr = new URL(urlStr).toString(); + } + + // Fallback to old implementation for arbitrary URLs + return parse_url(urlStr); +} + +const streamDestructionSupported = 'destroy' in Stream.Readable.prototype; + +/** + * Check if a value is an instance of Request. + * + * @param Mixed input + * @return Boolean + */ +function isRequest(input) { + return typeof input === 'object' && typeof input[INTERNALS$2] === 'object'; +} + +function isAbortSignal(signal) { + const proto = signal && typeof signal === 'object' && Object.getPrototypeOf(signal); + return !!(proto && proto.constructor.name === 'AbortSignal'); +} + +/** + * Request class + * + * @param Mixed input Url or Request instance + * @param Object init Custom options + * @return Void + */ +class Request { + constructor(input) { + let init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + let parsedURL; + + // normalize input + if (!isRequest(input)) { + if (input && input.href) { + // in order to support Node.js' Url objects; though WHATWG's URL objects + // will fall into this branch also (since their `toString()` will return + // `href` property anyway) + parsedURL = parseURL(input.href); + } else { + // coerce input to a string before attempting to parse + parsedURL = parseURL(`${input}`); + } + input = {}; + } else { + parsedURL = parseURL(input.url); + } + + let method = init.method || input.method || 'GET'; + method = method.toUpperCase(); + + if ((init.body != null || isRequest(input) && input.body !== null) && (method === 'GET' || method === 'HEAD')) { + throw new TypeError('Request with GET/HEAD method cannot have body'); + } + + let inputBody = init.body != null ? init.body : isRequest(input) && input.body !== null ? clone(input) : null; + + Body.call(this, inputBody, { + timeout: init.timeout || input.timeout || 0, + size: init.size || input.size || 0 + }); + + const headers = new Headers(init.headers || input.headers || {}); + + if (inputBody != null && !headers.has('Content-Type')) { + const contentType = extractContentType(inputBody); + if (contentType) { + headers.append('Content-Type', contentType); + } + } + + let signal = isRequest(input) ? input.signal : null; + if ('signal' in init) signal = init.signal; + + if (signal != null && !isAbortSignal(signal)) { + throw new TypeError('Expected signal to be an instanceof AbortSignal'); + } + + this[INTERNALS$2] = { + method, + redirect: init.redirect || input.redirect || 'follow', + headers, + parsedURL, + signal + }; + + // node-fetch-only options + this.follow = init.follow !== undefined ? init.follow : input.follow !== undefined ? input.follow : 20; + this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true; + this.counter = init.counter || input.counter || 0; + this.agent = init.agent || input.agent; + } + + get method() { + return this[INTERNALS$2].method; + } + + get url() { + return format_url(this[INTERNALS$2].parsedURL); + } + + get headers() { + return this[INTERNALS$2].headers; + } + + get redirect() { + return this[INTERNALS$2].redirect; + } + + get signal() { + return this[INTERNALS$2].signal; + } + + /** + * Clone this request + * + * @return Request + */ + clone() { + return new Request(this); + } +} + +Body.mixIn(Request.prototype); + +Object.defineProperty(Request.prototype, Symbol.toStringTag, { + value: 'Request', + writable: false, + enumerable: false, + configurable: true +}); + +Object.defineProperties(Request.prototype, { + method: { enumerable: true }, + url: { enumerable: true }, + headers: { enumerable: true }, + redirect: { enumerable: true }, + clone: { enumerable: true }, + signal: { enumerable: true } +}); + +/** + * Convert a Request to Node.js http request options. + * + * @param Request A Request instance + * @return Object The options object to be passed to http.request + */ +function getNodeRequestOptions(request) { + const parsedURL = request[INTERNALS$2].parsedURL; + const headers = new Headers(request[INTERNALS$2].headers); + + // fetch step 1.3 + if (!headers.has('Accept')) { + headers.set('Accept', '*/*'); + } + + // Basic fetch + if (!parsedURL.protocol || !parsedURL.hostname) { + throw new TypeError('Only absolute URLs are supported'); + } + + if (!/^https?:$/.test(parsedURL.protocol)) { + throw new TypeError('Only HTTP(S) protocols are supported'); + } + + if (request.signal && request.body instanceof Stream.Readable && !streamDestructionSupported) { + throw new Error('Cancellation of streamed requests with AbortSignal is not supported in node < 8'); + } + + // HTTP-network-or-cache fetch steps 2.4-2.7 + let contentLengthValue = null; + if (request.body == null && /^(POST|PUT)$/i.test(request.method)) { + contentLengthValue = '0'; + } + if (request.body != null) { + const totalBytes = getTotalBytes(request); + if (typeof totalBytes === 'number') { + contentLengthValue = String(totalBytes); + } + } + if (contentLengthValue) { + headers.set('Content-Length', contentLengthValue); + } + + // HTTP-network-or-cache fetch step 2.11 + if (!headers.has('User-Agent')) { + headers.set('User-Agent', 'node-fetch/1.0 (+https://github.com/bitinn/node-fetch)'); + } + + // HTTP-network-or-cache fetch step 2.15 + if (request.compress && !headers.has('Accept-Encoding')) { + headers.set('Accept-Encoding', 'gzip,deflate'); + } + + let agent = request.agent; + if (typeof agent === 'function') { + agent = agent(parsedURL); + } + + // HTTP-network fetch step 4.2 + // chunked encoding is handled by Node.js + + return Object.assign({}, parsedURL, { + method: request.method, + headers: exportNodeCompatibleHeaders(headers), + agent + }); +} + +/** + * abort-error.js + * + * AbortError interface for cancelled requests + */ + +/** + * Create AbortError instance + * + * @param String message Error message for human + * @return AbortError + */ +function AbortError(message) { + Error.call(this, message); + + this.type = 'aborted'; + this.message = message; + + // hide custom error implementation details from end-users + Error.captureStackTrace(this, this.constructor); +} + +AbortError.prototype = Object.create(Error.prototype); +AbortError.prototype.constructor = AbortError; +AbortError.prototype.name = 'AbortError'; + +const URL$1 = Url.URL || whatwgUrl.URL; + +// fix an issue where "PassThrough", "resolve" aren't a named export for node <10 +const PassThrough$1 = Stream.PassThrough; + +const isDomainOrSubdomain = function isDomainOrSubdomain(destination, original) { + const orig = new URL$1(original).hostname; + const dest = new URL$1(destination).hostname; + + return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest); +}; + +/** + * isSameProtocol reports whether the two provided URLs use the same protocol. + * + * Both domains must already be in canonical form. + * @param {string|URL} original + * @param {string|URL} destination + */ +const isSameProtocol = function isSameProtocol(destination, original) { + const orig = new URL$1(original).protocol; + const dest = new URL$1(destination).protocol; + + return orig === dest; +}; + +/** + * Fetch function + * + * @param Mixed url Absolute url or Request instance + * @param Object opts Fetch options + * @return Promise + */ +function fetch(url, opts) { + + // allow custom promise + if (!fetch.Promise) { + throw new Error('native promise missing, set fetch.Promise to your favorite alternative'); + } + + Body.Promise = fetch.Promise; + + // wrap http.request into fetch + return new fetch.Promise(function (resolve, reject) { + // build request object + const request = new Request(url, opts); + const options = getNodeRequestOptions(request); + + const send = (options.protocol === 'https:' ? https : http).request; + const signal = request.signal; + + let response = null; + + const abort = function abort() { + let error = new AbortError('The user aborted a request.'); + reject(error); + if (request.body && request.body instanceof Stream.Readable) { + destroyStream(request.body, error); + } + if (!response || !response.body) return; + response.body.emit('error', error); + }; + + if (signal && signal.aborted) { + abort(); + return; + } + + const abortAndFinalize = function abortAndFinalize() { + abort(); + finalize(); + }; + + // send request + const req = send(options); + let reqTimeout; + + if (signal) { + signal.addEventListener('abort', abortAndFinalize); + } + + function finalize() { + req.abort(); + if (signal) signal.removeEventListener('abort', abortAndFinalize); + clearTimeout(reqTimeout); + } + + if (request.timeout) { + req.once('socket', function (socket) { + reqTimeout = setTimeout(function () { + reject(new FetchError(`network timeout at: ${request.url}`, 'request-timeout')); + finalize(); + }, request.timeout); + }); + } + + req.on('error', function (err) { + reject(new FetchError(`request to ${request.url} failed, reason: ${err.message}`, 'system', err)); + + if (response && response.body) { + destroyStream(response.body, err); + } + + finalize(); + }); + + fixResponseChunkedTransferBadEnding(req, function (err) { + if (signal && signal.aborted) { + return; + } + + if (response && response.body) { + destroyStream(response.body, err); + } + }); + + /* c8 ignore next 18 */ + if (parseInt(process.version.substring(1)) < 14) { + // Before Node.js 14, pipeline() does not fully support async iterators and does not always + // properly handle when the socket close/end events are out of order. + req.on('socket', function (s) { + s.addListener('close', function (hadError) { + // if a data listener is still present we didn't end cleanly + const hasDataListener = s.listenerCount('data') > 0; + + // if end happened before close but the socket didn't emit an error, do it now + if (response && hasDataListener && !hadError && !(signal && signal.aborted)) { + const err = new Error('Premature close'); + err.code = 'ERR_STREAM_PREMATURE_CLOSE'; + response.body.emit('error', err); + } + }); + }); + } + + req.on('response', function (res) { + clearTimeout(reqTimeout); + + const headers = createHeadersLenient(res.headers); + + // HTTP fetch step 5 + if (fetch.isRedirect(res.statusCode)) { + // HTTP fetch step 5.2 + const location = headers.get('Location'); + + // HTTP fetch step 5.3 + let locationURL = null; + try { + locationURL = location === null ? null : new URL$1(location, request.url).toString(); + } catch (err) { + // error here can only be invalid URL in Location: header + // do not throw when options.redirect == manual + // let the user extract the errorneous redirect URL + if (request.redirect !== 'manual') { + reject(new FetchError(`uri requested responds with an invalid redirect URL: ${location}`, 'invalid-redirect')); + finalize(); + return; + } + } + + // HTTP fetch step 5.5 + switch (request.redirect) { + case 'error': + reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect')); + finalize(); + return; + case 'manual': + // node-fetch-specific step: make manual redirect a bit easier to use by setting the Location header value to the resolved URL. + if (locationURL !== null) { + // handle corrupted header + try { + headers.set('Location', locationURL); + } catch (err) { + // istanbul ignore next: nodejs server prevent invalid response headers, we can't test this through normal request + reject(err); + } + } + break; + case 'follow': + // HTTP-redirect fetch step 2 + if (locationURL === null) { + break; + } + + // HTTP-redirect fetch step 5 + if (request.counter >= request.follow) { + reject(new FetchError(`maximum redirect reached at: ${request.url}`, 'max-redirect')); + finalize(); + return; + } + + // HTTP-redirect fetch step 6 (counter increment) + // Create a new Request object. + const requestOpts = { + headers: new Headers(request.headers), + follow: request.follow, + counter: request.counter + 1, + agent: request.agent, + compress: request.compress, + method: request.method, + body: request.body, + signal: request.signal, + timeout: request.timeout, + size: request.size + }; + + if (!isDomainOrSubdomain(request.url, locationURL) || !isSameProtocol(request.url, locationURL)) { + for (const name of ['authorization', 'www-authenticate', 'cookie', 'cookie2']) { + requestOpts.headers.delete(name); + } + } + + // HTTP-redirect fetch step 9 + if (res.statusCode !== 303 && request.body && getTotalBytes(request) === null) { + reject(new FetchError('Cannot follow redirect with body being a readable stream', 'unsupported-redirect')); + finalize(); + return; + } + + // HTTP-redirect fetch step 11 + if (res.statusCode === 303 || (res.statusCode === 301 || res.statusCode === 302) && request.method === 'POST') { + requestOpts.method = 'GET'; + requestOpts.body = undefined; + requestOpts.headers.delete('content-length'); + } + + // HTTP-redirect fetch step 15 + resolve(fetch(new Request(locationURL, requestOpts))); + finalize(); + return; + } + } + + // prepare response + res.once('end', function () { + if (signal) signal.removeEventListener('abort', abortAndFinalize); + }); + let body = res.pipe(new PassThrough$1()); + + const response_options = { + url: request.url, + status: res.statusCode, + statusText: res.statusMessage, + headers: headers, + size: request.size, + timeout: request.timeout, + counter: request.counter + }; + + // HTTP-network fetch step 12.1.1.3 + const codings = headers.get('Content-Encoding'); + + // HTTP-network fetch step 12.1.1.4: handle content codings + + // in following scenarios we ignore compression support + // 1. compression support is disabled + // 2. HEAD request + // 3. no Content-Encoding header + // 4. no content response (204) + // 5. content not modified response (304) + if (!request.compress || request.method === 'HEAD' || codings === null || res.statusCode === 204 || res.statusCode === 304) { + response = new Response(body, response_options); + resolve(response); + return; + } + + // For Node v6+ + // Be less strict when decoding compressed responses, since sometimes + // servers send slightly invalid responses that are still accepted + // by common browsers. + // Always using Z_SYNC_FLUSH is what cURL does. + const zlibOptions = { + flush: zlib.Z_SYNC_FLUSH, + finishFlush: zlib.Z_SYNC_FLUSH + }; + + // for gzip + if (codings == 'gzip' || codings == 'x-gzip') { + body = body.pipe(zlib.createGunzip(zlibOptions)); + response = new Response(body, response_options); + resolve(response); + return; + } + + // for deflate + if (codings == 'deflate' || codings == 'x-deflate') { + // handle the infamous raw deflate response from old servers + // a hack for old IIS and Apache servers + const raw = res.pipe(new PassThrough$1()); + raw.once('data', function (chunk) { + // see http://stackoverflow.com/questions/37519828 + if ((chunk[0] & 0x0F) === 0x08) { + body = body.pipe(zlib.createInflate()); + } else { + body = body.pipe(zlib.createInflateRaw()); + } + response = new Response(body, response_options); + resolve(response); + }); + raw.on('end', function () { + // some old IIS servers return zero-length OK deflate responses, so 'data' is never emitted. + if (!response) { + response = new Response(body, response_options); + resolve(response); + } + }); + return; + } + + // for br + if (codings == 'br' && typeof zlib.createBrotliDecompress === 'function') { + body = body.pipe(zlib.createBrotliDecompress()); + response = new Response(body, response_options); + resolve(response); + return; + } + + // otherwise, use response as-is + response = new Response(body, response_options); + resolve(response); + }); + + writeToStream(req, request); + }); +} +function fixResponseChunkedTransferBadEnding(request, errorCallback) { + let socket; + + request.on('socket', function (s) { + socket = s; + }); + + request.on('response', function (response) { + const headers = response.headers; + + if (headers['transfer-encoding'] === 'chunked' && !headers['content-length']) { + response.once('close', function (hadError) { + // tests for socket presence, as in some situations the + // the 'socket' event is not triggered for the request + // (happens in deno), avoids `TypeError` + // if a data listener is still present we didn't end cleanly + const hasDataListener = socket && socket.listenerCount('data') > 0; + + if (hasDataListener && !hadError) { + const err = new Error('Premature close'); + err.code = 'ERR_STREAM_PREMATURE_CLOSE'; + errorCallback(err); + } + }); + } + }); +} + +function destroyStream(stream, err) { + if (stream.destroy) { + stream.destroy(err); + } else { + // node < 8 + stream.emit('error', err); + stream.end(); + } +} + +/** + * Redirect code matching + * + * @param Number code Status code + * @return Boolean + */ +fetch.isRedirect = function (code) { + return code === 301 || code === 302 || code === 303 || code === 307 || code === 308; +}; + +// expose Promise +fetch.Promise = global.Promise; + +export default fetch; +export { Headers, Request, Response, FetchError, AbortError }; diff --git a/project starter code/node_modules/node-fetch/package.json b/project starter code/node_modules/node-fetch/package.json new file mode 100644 index 00000000..e0be1768 --- /dev/null +++ b/project starter code/node_modules/node-fetch/package.json @@ -0,0 +1,89 @@ +{ + "name": "node-fetch", + "version": "2.7.0", + "description": "A light-weight module that brings window.fetch to node.js", + "main": "lib/index.js", + "browser": "./browser.js", + "module": "lib/index.mjs", + "files": [ + "lib/index.js", + "lib/index.mjs", + "lib/index.es.js", + "browser.js" + ], + "engines": { + "node": "4.x || >=6.0.0" + }, + "scripts": { + "build": "cross-env BABEL_ENV=rollup rollup -c", + "prepare": "npm run build", + "test": "cross-env BABEL_ENV=test mocha --require babel-register --throw-deprecation test/test.js", + "report": "cross-env BABEL_ENV=coverage nyc --reporter lcov --reporter text mocha -R spec test/test.js", + "coverage": "cross-env BABEL_ENV=coverage nyc --reporter json --reporter text mocha -R spec test/test.js && codecov -f coverage/coverage-final.json" + }, + "repository": { + "type": "git", + "url": "https://github.com/bitinn/node-fetch.git" + }, + "keywords": [ + "fetch", + "http", + "promise" + ], + "author": "David Frank", + "license": "MIT", + "bugs": { + "url": "https://github.com/bitinn/node-fetch/issues" + }, + "homepage": "https://github.com/bitinn/node-fetch", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + }, + "devDependencies": { + "@ungap/url-search-params": "^0.1.2", + "abort-controller": "^1.1.0", + "abortcontroller-polyfill": "^1.3.0", + "babel-core": "^6.26.3", + "babel-plugin-istanbul": "^4.1.6", + "babel-plugin-transform-async-generator-functions": "^6.24.1", + "babel-polyfill": "^6.26.0", + "babel-preset-env": "1.4.0", + "babel-register": "^6.16.3", + "chai": "^3.5.0", + "chai-as-promised": "^7.1.1", + "chai-iterator": "^1.1.1", + "chai-string": "~1.3.0", + "codecov": "3.3.0", + "cross-env": "^5.2.0", + "form-data": "^2.3.3", + "is-builtin-module": "^1.0.0", + "mocha": "^5.0.0", + "nyc": "11.9.0", + "parted": "^0.1.1", + "promise": "^8.0.3", + "resumer": "0.0.0", + "rollup": "^0.63.4", + "rollup-plugin-babel": "^3.0.7", + "string-to-arraybuffer": "^1.0.2", + "teeny-request": "3.7.0" + }, + "release": { + "branches": [ + "+([0-9]).x", + "main", + "next", + { + "name": "beta", + "prerelease": true + } + ] + } +} diff --git a/project starter code/node_modules/nodemon/.prettierrc.json b/project starter code/node_modules/nodemon/.prettierrc.json new file mode 100644 index 00000000..544138be --- /dev/null +++ b/project starter code/node_modules/nodemon/.prettierrc.json @@ -0,0 +1,3 @@ +{ + "singleQuote": true +} diff --git a/project starter code/node_modules/nodemon/LICENSE b/project starter code/node_modules/nodemon/LICENSE new file mode 100644 index 00000000..19c91a2f --- /dev/null +++ b/project starter code/node_modules/nodemon/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2010 - present, Remy Sharp, https://remysharp.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/project starter code/node_modules/nodemon/README.md b/project starter code/node_modules/nodemon/README.md new file mode 100644 index 00000000..0174d340 --- /dev/null +++ b/project starter code/node_modules/nodemon/README.md @@ -0,0 +1,466 @@ +

+ Nodemon Logo +

+ +# nodemon + +nodemon is a tool that helps develop Node.js based applications by automatically restarting the node application when file changes in the directory are detected. + +nodemon does **not** require *any* additional changes to your code or method of development. nodemon is a replacement wrapper for `node`. To use `nodemon`, replace the word `node` on the command line when executing your script. + +[![NPM version](https://badge.fury.io/js/nodemon.svg)](https://npmjs.org/package/nodemon) +[![Backers on Open Collective](https://opencollective.com/nodemon/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/nodemon/sponsors/badge.svg)](#sponsors) + +# Installation + +Either through cloning with git or by using [npm](http://npmjs.org) (the recommended way): + +```bash +npm install -g nodemon # or using yarn: yarn global add nodemon +``` + +And nodemon will be installed globally to your system path. + +You can also install nodemon as a development dependency: + +```bash +npm install --save-dev nodemon # or using yarn: yarn add nodemon -D +``` + +With a local installation, nodemon will not be available in your system path or you can't use it directly from the command line. Instead, the local installation of nodemon can be run by calling it from within an npm script (such as `npm start`) or using `npx nodemon`. + +# Usage + +nodemon wraps your application, so you can pass all the arguments you would normally pass to your app: + +```bash +nodemon [your node app] +``` + +For CLI options, use the `-h` (or `--help`) argument: + +```bash +nodemon -h +``` + +Using nodemon is simple, if my application accepted a host and port as the arguments, I would start it as so: + +```bash +nodemon ./server.js localhost 8080 +``` + +Any output from this script is prefixed with `[nodemon]`, otherwise all output from your application, errors included, will be echoed out as expected. + +You can also pass the `inspect` flag to node through the command line as you would normally: + +```bash +nodemon --inspect ./server.js 80 +``` + +If you have a `package.json` file for your app, you can omit the main script entirely and nodemon will read the `package.json` for the `main` property and use that value as the app ([ref](https://github.com/remy/nodemon/issues/14)). + +nodemon will also search for the `scripts.start` property in `package.json` (as of nodemon 1.1.x). + +Also check out the [FAQ](https://github.com/remy/nodemon/blob/master/faq.md) or [issues](https://github.com/remy/nodemon/issues) for nodemon. + +## Automatic re-running + +nodemon was originally written to restart hanging processes such as web servers, but now supports apps that cleanly exit. If your script exits cleanly, nodemon will continue to monitor the directory (or directories) and restart the script if there are any changes. + +## Manual restarting + +Whilst nodemon is running, if you need to manually restart your application, instead of stopping and restart nodemon, you can type `rs` with a carriage return, and nodemon will restart your process. + +## Config files + +nodemon supports local and global configuration files. These are usually named `nodemon.json` and can be located in the current working directory or in your home directory. An alternative local configuration file can be specified with the `--config ` option. + +The specificity is as follows, so that a command line argument will always override the config file settings: + +- command line arguments +- local config +- global config + +A config file can take any of the command line arguments as JSON key values, for example: + +```json +{ + "verbose": true, + "ignore": ["*.test.js", "**/fixtures/**"], + "execMap": { + "rb": "ruby", + "pde": "processing --sketch={{pwd}} --run" + } +} +``` + +The above `nodemon.json` file might be my global config so that I have support for ruby files and processing files, and I can run `nodemon demo.pde` and nodemon will automatically know how to run the script even though out of the box support for processing scripts. + +A further example of options can be seen in [sample-nodemon.md](https://github.com/remy/nodemon/blob/master/doc/sample-nodemon.md) + +### package.json + +If you want to keep all your package configurations in one place, nodemon supports using `package.json` for configuration. +Specify the config in the same format as you would for a config file but under `nodemonConfig` in the `package.json` file, for example, take the following `package.json`: + +```json +{ + "name": "nodemon", + "homepage": "http://nodemon.io", + "...": "... other standard package.json values", + "nodemonConfig": { + "ignore": ["**/test/**", "**/docs/**"], + "delay": 2500 + } +} +``` + +Note that if you specify a `--config` file or provide a local `nodemon.json` any `package.json` config is ignored. + +*This section needs better documentation, but for now you can also see `nodemon --help config` ([also here](https://github.com/remy/nodemon/blob/master/doc/cli/config.txt))*. + +## Using nodemon as a module + +Please see [doc/requireable.md](doc/requireable.md) + +## Using nodemon as child process + +Please see [doc/events.md](doc/events.md#Using_nodemon_as_child_process) + +## Running non-node scripts + +nodemon can also be used to execute and monitor other programs. nodemon will read the file extension of the script being run and monitor that extension instead of `.js` if there's no `nodemon.json`: + +```bash +nodemon --exec "python -v" ./app.py +``` + +Now nodemon will run `app.py` with python in verbose mode (note that if you're not passing args to the exec program, you don't need the quotes), and look for new or modified files with the `.py` extension. + +### Default executables + +Using the `nodemon.json` config file, you can define your own default executables using the `execMap` property. This is particularly useful if you're working with a language that isn't supported by default by nodemon. + +To add support for nodemon to know about the `.pl` extension (for Perl), the `nodemon.json` file would add: + +```json +{ + "execMap": { + "pl": "perl" + } +} +``` + +Now running the following, nodemon will know to use `perl` as the executable: + +```bash +nodemon script.pl +``` + +It's generally recommended to use the global `nodemon.json` to add your own `execMap` options. However, if there's a common default that's missing, this can be merged in to the project so that nodemon supports it by default, by changing [default.js](https://github.com/remy/nodemon/blob/master/lib/config/defaults.js) and sending a pull request. + +## Monitoring multiple directories + +By default nodemon monitors the current working directory. If you want to take control of that option, use the `--watch` option to add specific paths: + +```bash +nodemon --watch app --watch libs app/server.js +``` + +Now nodemon will only restart if there are changes in the `./app` or `./libs` directory. By default nodemon will traverse sub-directories, so there's no need in explicitly including sub-directories. + +Nodemon also supports unix globbing, e.g `--watch './lib/*'`. The globbing pattern must be quoted. For advanced globbing, [see `picomatch` documentation](https://github.com/micromatch/picomatch#advanced-globbing), the library that nodemon uses through `chokidar` (which in turn uses it through `anymatch`). + +## Specifying extension watch list + +By default, nodemon looks for files with the `.js`, `.mjs`, `.coffee`, `.litcoffee`, and `.json` extensions. If you use the `--exec` option and monitor `app.py` nodemon will monitor files with the extension of `.py`. However, you can specify your own list with the `-e` (or `--ext`) switch like so: + +```bash +nodemon -e js,pug +``` + +Now nodemon will restart on any changes to files in the directory (or subdirectories) with the extensions `.js`, `.pug`. + +## Ignoring files + +By default, nodemon will only restart when a `.js` JavaScript file changes. In some cases you will want to ignore some specific files, directories or file patterns, to prevent nodemon from prematurely restarting your application. + +This can be done via the command line: + +```bash +nodemon --ignore lib/ --ignore tests/ +``` + +Or specific files can be ignored: + +```bash +nodemon --ignore lib/app.js +``` + +Patterns can also be ignored (but be sure to quote the arguments): + +```bash +nodemon --ignore 'lib/*.js' +``` + +**Important** the ignore rules are patterns matched to the full absolute path, and this determines how many files are monitored. If using a wild card glob pattern, it needs to be used as `**` or omitted entirely. For example, `nodemon --ignore '**/test/**'` will work, whereas `--ignore '*/test/*'` will not. + +Note that by default, nodemon will ignore the `.git`, `node_modules`, `bower_components`, `.nyc_output`, `coverage` and `.sass-cache` directories and *add* your ignored patterns to the list. If you want to indeed watch a directory like `node_modules`, you need to [override the underlying default ignore rules](https://github.com/remy/nodemon/blob/master/faq.md#overriding-the-underlying-default-ignore-rules). + +## Application isn't restarting + +In some networked environments (such as a container running nodemon reading across a mounted drive), you will need to use the `legacyWatch: true` which enables Chokidar's polling. + +Via the CLI, use either `--legacy-watch` or `-L` for short: + +```bash +nodemon -L +``` + +Though this should be a last resort as it will poll every file it can find. + +## Delaying restarting + +In some situations, you may want to wait until a number of files have changed. The timeout before checking for new file changes is 1 second. If you're uploading a number of files and it's taking some number of seconds, this could cause your app to restart multiple times unnecessarily. + +To add an extra throttle, or delay restarting, use the `--delay` command: + +```bash +nodemon --delay 10 server.js +``` + +For more precision, milliseconds can be specified. Either as a float: + +```bash +nodemon --delay 2.5 server.js +``` + +Or using the time specifier (ms): + +```bash +nodemon --delay 2500ms server.js +``` + +The delay figure is number of seconds (or milliseconds, if specified) to delay before restarting. So nodemon will only restart your app the given number of seconds after the *last* file change. + +If you are setting this value in `nodemon.json`, the value will always be interpreted in milliseconds. E.g., the following are equivalent: + +```bash +nodemon --delay 2.5 + +{ + "delay": 2500 +} +``` + +## Gracefully reloading down your script + +It is possible to have nodemon send any signal that you specify to your application. + +```bash +nodemon --signal SIGHUP server.js +``` + +Your application can handle the signal as follows. + +```js +process.once("SIGHUP", function () { + reloadSomeConfiguration(); +}) +``` + +Please note that nodemon will send this signal to every process in the process tree. + +If you are using `cluster`, then each workers (as well as the master) will receive the signal. If you wish to terminate all workers on receiving a `SIGHUP`, a common pattern is to catch the `SIGHUP` in the master, and forward `SIGTERM` to all workers, while ensuring that all workers ignore `SIGHUP`. + +```js +if (cluster.isMaster) { + process.on("SIGHUP", function () { + for (const worker of Object.values(cluster.workers)) { + worker.process.kill("SIGTERM"); + } + }); +} else { + process.on("SIGHUP", function() {}) +} +``` + +## Controlling shutdown of your script + +nodemon sends a kill signal to your application when it sees a file update. If you need to clean up on shutdown inside your script you can capture the kill signal and handle it yourself. + +The following example will listen once for the `SIGUSR2` signal (used by nodemon to restart), run the clean up process and then kill itself for nodemon to continue control: + +```js +process.once('SIGUSR2', function () { + gracefulShutdown(function () { + process.kill(process.pid, 'SIGUSR2'); + }); +}); +``` + +Note that the `process.kill` is *only* called once your shutdown jobs are complete. Hat tip to [Benjie Gillam](http://www.benjiegillam.com/2011/08/node-js-clean-restart-and-faster-development-with-nodemon/) for writing this technique up. + +## Triggering events when nodemon state changes + +If you want growl like notifications when nodemon restarts or to trigger an action when an event happens, then you can either `require` nodemon or add event actions to your `nodemon.json` file. + +For example, to trigger a notification on a Mac when nodemon restarts, `nodemon.json` looks like this: + +```json +{ + "events": { + "restart": "osascript -e 'display notification \"app restarted\" with title \"nodemon\"'" + } +} +``` + +A full list of available events is listed on the [event states wiki](https://github.com/remy/nodemon/wiki/Events#states). Note that you can bind to both states and messages. + +## Pipe output to somewhere else + +```js +nodemon({ + script: ..., + stdout: false // important: this tells nodemon not to output to console +}).on('readable', function() { // the `readable` event indicates that data is ready to pick up + this.stdout.pipe(fs.createWriteStream('output.txt')); + this.stderr.pipe(fs.createWriteStream('err.txt')); +}); +``` + +## Using nodemon in your gulp workflow + +Check out the [gulp-nodemon](https://github.com/JacksonGariety/gulp-nodemon) plugin to integrate nodemon with the rest of your project's gulp workflow. + +## Using nodemon in your Grunt workflow + +Check out the [grunt-nodemon](https://github.com/ChrisWren/grunt-nodemon) plugin to integrate nodemon with the rest of your project's grunt workflow. + +## Pronunciation + +> nodemon, is it pronounced: node-mon, no-demon or node-e-mon (like pokémon)? + +Well...I've been asked this many times before. I like that I've been asked this before. There's been bets as to which one it actually is. + +The answer is simple, but possibly frustrating. I'm not saying (how I pronounce it). It's up to you to call it as you like. All answers are correct :) + +## Design principles + +- Fewer flags is better +- Works across all platforms +- Fewer features +- Let individuals build on top of nodemon +- Offer all CLI functionality as an API +- Contributions must have and pass tests + +Nodemon is not perfect, and CLI arguments has sprawled beyond where I'm completely happy, but perhaps it can be reduced a little one day. + +## FAQ + +See the [FAQ](https://github.com/remy/nodemon/blob/master/faq.md) and please add your own questions if you think they would help others. + +## Backers + +Thank you to all [our backers](https://opencollective.com/nodemon#backer)! 🙏 + +[![nodemon backers](https://opencollective.com/nodemon/backers.svg?width=890)](https://opencollective.com/nodemon#backers) + +## Sponsors + +Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Sponsor this project today ❤️](https://opencollective.com/nodemon#sponsor) + +
buy instagram followers on skweezer.net today +Netpositive +KasynoHEX +Casinoonlineaams.com +Best Aussie casinos at aussielowdepositcasino.com +Best online casinos not on GamStop in the UK +TheCasinoDB +Marketing +Rating of best betting sites in Australia +inkedin +AU Internet Pokies +AU Online Casinos +casino online stranieri +Goread.io +We are the most advanced casino guide! +Best Australian online casinos. Reviewed by Correct Casinos. +Casino utan svensk licens + +Do My Online Class - NoNeedToStudy.com +Slotmachineweb.com +Website dedicated to finding the best and safest licensed online casinos in India +CasinoWizard +Scommesseseriea.eu +Gambe Online AU +Gamble Online +Italianonlinecasino.net +nongamstopcasinos.net +Scommesse777 +Twicsy +At Casinoaustraliaonline.com, we review, compare and list all the best gambling sites for Aussies.
+ +Casinon utan svensk licens erbjuder generösa bonusar och kampanjer. Besök coolspins.net för att utforska säkra och pålitliga alternativ. +BestUSCasinos +TightPoker +Buy Instagram Likes +btcgaming +Norway's biggest and most reliable online casino portal +OnlineCasinosSpelen +Beoordelen van nieuwe online casino's 2023 +CasinoZonderRegistratie.net - Nederlandse Top Casino's +OnlineCasinoProfy is your guide to the world of gambling. +OSLabs is a nonprofit tech accelerator devoted to furthering high-impact open source software within a collaborative community of dedicated engineers and mentors +Ilmaiset Pitkävetovihjeet +Famoid is a digital marketing agency that specializes in social media services and tools. +LookSlots +Gives a fun for our users +We are the leading Nearshore Technology Solutions company. We architect and engineer scalable and high-performing software solutions. +Buy real Instagram followers from Twicsy starting at only $2.97. Twicsy has been voted the best site to buy followers from the likes of US Magazine. +SocialWick offers the best Instagram Followers in the market. If you are looking to boost your organic growth, buy Instagram followers from SocialWick +Online United States Casinos +https://bestnongamstopcasinos.net +Aviators +Online iGaming platform with reliable and trusted reviews. +Online Casinos Australia +Looking to boost your YouTube channel? Buy YouTube subscribers with Views4You and watch your audience grow! +casinosonlineaus +Verified reviews of the most reputable Canadian online casinos at leafletcasino.com +Buy Telegram Members +Najděte nejlepší online casino v České republice +We review the entire iGaming industry from A to Z +Helping Swedes finding safe unlicensed casinos +free spins no deposit +I migliori casinò online dagli esperti di SitiCasinoNonAAMS +aussiecasinoreviewer.com +MEGAFAMOUS.com +PopularityBazaar helps you quickly grow your social media accounts. Buy 100% real likes, followers, views, comments, and more to kickstart your online presence. +Non-GamStop NonStop Casino +philippinescasinos.ph +Incognito +NonGamStopBets Casinos not on GamStop +Buy real Instagram followers from Stormlikes starting at only $2.97. Stormlikes has been voted the best site to buy followers from the likes of US Magazine. +UpGrow is the Best Instagram Growth Service in 2024. Get more real Instagram followers with our AI-powered growth engine to get 10x faster results. +Reviewing companies in high-risk industries like online casinos, forex brokers and crypto exchanges +Analysis of payment methods for use in the iGaming +30 Best Casinos Not on Gamstop in 2024 +No deposit casino promo Codes 2024 - The best online Casinos websites. No deposit bonus codes, Free Spins and Promo Codes. Stake, Roobet, Jackpotcity and more. +Online casino. +Listing no deposit bonus offers from various internet sites . +Marketing research website. +Quantum AI +Fortune Tiger +Parimatch +Supbot.com +ExpressFollowers +SidesMedia +BuitenlandseOnlineCasinos +
+ +Please note that links to the sponsors above are not direct endorsements nor affiliated with any of contributors of the nodemon project. + +# License + +MIT [http://rem.mit-license.org](http://rem.mit-license.org) diff --git a/project starter code/node_modules/nodemon/bin/nodemon.js b/project starter code/node_modules/nodemon/bin/nodemon.js new file mode 100644 index 00000000..3d490f14 --- /dev/null +++ b/project starter code/node_modules/nodemon/bin/nodemon.js @@ -0,0 +1,16 @@ +#!/usr/bin/env node + +const cli = require('../lib/cli'); +const nodemon = require('../lib/'); +const options = cli.parse(process.argv); + +nodemon(options); + +const fs = require('fs'); + +// checks for available update and returns an instance +const pkg = JSON.parse(fs.readFileSync(__dirname + '/../package.json')); + +if (pkg.version.indexOf('0.0.0') !== 0 && options.noUpdateNotifier !== true) { + require('simple-update-notifier')({ pkg }); +} diff --git a/project starter code/node_modules/nodemon/bin/windows-kill.exe b/project starter code/node_modules/nodemon/bin/windows-kill.exe new file mode 100644 index 00000000..98d7d7f7 Binary files /dev/null and b/project starter code/node_modules/nodemon/bin/windows-kill.exe differ diff --git a/project starter code/node_modules/nodemon/doc/cli/authors.txt b/project starter code/node_modules/nodemon/doc/cli/authors.txt new file mode 100644 index 00000000..6c77a12a --- /dev/null +++ b/project starter code/node_modules/nodemon/doc/cli/authors.txt @@ -0,0 +1,8 @@ + + Remy Sharp - author and maintainer + https://github.com/remy + https://twitter.com/rem + + Contributors: https://github.com/remy/nodemon/graphs/contributors ❤︎ + + Please help make nodemon better: https://github.com/remy/nodemon/ diff --git a/project starter code/node_modules/nodemon/doc/cli/config.txt b/project starter code/node_modules/nodemon/doc/cli/config.txt new file mode 100644 index 00000000..5de9bba5 --- /dev/null +++ b/project starter code/node_modules/nodemon/doc/cli/config.txt @@ -0,0 +1,44 @@ + + Typically the options to control nodemon are passed in via the CLI and are + listed under: nodemon --help options + + nodemon can also be configured via a local and global config file: + + * $HOME/nodemon.json + * $PWD/nodemon.json OR --config + * nodemonConfig in package.json + + All config options in the .json file map 1-to-1 with the CLI options, so a + config could read as: + + { + "ext": "*.pde", + "verbose": true, + "exec": "processing --sketch=game --run" + } + + There are a limited number of variables available in the config (since you + could use backticks on the CLI to use a variable, backticks won't work in + the .json config). + + * {{pwd}} - the current directory + * {{filename}} - the filename you pass to nodemon + + For example: + + { + "ext": "*.pde", + "verbose": true, + "exec": "processing --sketch={{pwd}} --run" + } + + The global config file is useful for setting up default executables + instead of repeating the same option in each of your local configs: + + { + "verbose": true, + "execMap": { + "rb": "ruby", + "pde": "processing --sketch={{pwd}} --run" + } + } diff --git a/project starter code/node_modules/nodemon/doc/cli/help.txt b/project starter code/node_modules/nodemon/doc/cli/help.txt new file mode 100644 index 00000000..7ba4ff2a --- /dev/null +++ b/project starter code/node_modules/nodemon/doc/cli/help.txt @@ -0,0 +1,29 @@ + Usage: nodemon [options] [script.js] [args] + + Options: + + --config file ............ alternate nodemon.json config file to use + -e, --ext ................ extensions to look for, ie. js,pug,hbs. + -x, --exec app ........... execute script with "app", ie. -x "python -v". + -w, --watch path ......... watch directory "path" or files. use once for + each directory or file to watch. + -i, --ignore ............. ignore specific files or directories. + -V, --verbose ............ show detail on what is causing restarts. + -- ........... to tell nodemon stop slurping arguments. + + Note: if the script is omitted, nodemon will try to read "main" from + package.json and without a nodemon.json, nodemon will monitor .js, .mjs, .coffee, + .litcoffee, and .json by default. + + For advanced nodemon configuration use nodemon.json: nodemon --help config + See also the sample: https://github.com/remy/nodemon/wiki/Sample-nodemon.json + + Examples: + + $ nodemon server.js + $ nodemon -w ../foo server.js apparg1 apparg2 + $ nodemon --exec python app.py + $ nodemon --exec "make build" -e "styl hbs" + $ nodemon app.js -- --config # pass config to app.js + + \x1B[1mAll options are documented under: \x1B[4mnodemon --help options\x1B[0m diff --git a/project starter code/node_modules/nodemon/doc/cli/logo.txt b/project starter code/node_modules/nodemon/doc/cli/logo.txt new file mode 100644 index 00000000..150f97f5 --- /dev/null +++ b/project starter code/node_modules/nodemon/doc/cli/logo.txt @@ -0,0 +1,20 @@ + ; ; + kO. x0 + KMX, .:x0kc. 'KMN + 0MMM0: 'oKMMMMMMMXd, ;OMMMX + oMMMMMWKOONMMMMMMMMMMMMMWOOKWMMMMMx + OMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMK. + .oWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMd. + KMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMN + KMMMMMMMMMMMMMMW0k0WMMMMMMMMMMMMMMW + KMMMMMMMMMMMNk:. :xNMMMMMMMMMMMW + KMMMMMMMMMMK OMMMMMMMMMMW + KMMMMMMMMMMO xMMMMMMMMMMN + KMMMMMMMMMMO xMMMMMMMMMMN + KMMMMMMMMMMO xMMMMMMMMMMN + KMMMMMMMMMMO xMMMMMMMMMMN + KMMMMMMMMMMO xMMMMMMMMMMN + KMMMMMMMMMNc ;NMMMMMMMMMN + KMMMMMW0o' .lOWMMMMMN + KMMKd; ,oKMMN + kX: ,K0 \ No newline at end of file diff --git a/project starter code/node_modules/nodemon/doc/cli/options.txt b/project starter code/node_modules/nodemon/doc/cli/options.txt new file mode 100644 index 00000000..598ae63b --- /dev/null +++ b/project starter code/node_modules/nodemon/doc/cli/options.txt @@ -0,0 +1,36 @@ + +Configuration + --config .......... alternate nodemon.json config file to use + --exitcrash .............. exit on crash, allows nodemon to work with other watchers + -i, --ignore ............. ignore specific files or directories + --no-colors .............. disable color output + --signal ........ use specified kill signal instead of default (ex. SIGTERM) + -w, --watch path ......... watch directory "dir" or files. use once for each + directory or file to watch + --no-update-notifier ..... opt-out of update version check + +Execution + -C, --on-change-only ..... execute script on change only, not startup + --cwd .............. change into before running the script + -e, --ext ................ extensions to look for, ie. "js,pug,hbs" + -I, --no-stdin ........... nodemon passes stdin directly to child process + --spawn .................. force nodemon to use spawn (over fork) [node only] + -x, --exec app ........... execute script with "app", ie. -x "python -v" + -- ........... to tell nodemon stop slurping arguments + +Watching + -d, --delay n ............ debounce restart for "n" seconds + -L, --legacy-watch ....... use polling to watch for changes (typically needed + when watching over a network/Docker) + -P, --polling-interval ... combined with -L, milliseconds to poll for (default 100) + +Information + --dump ................... print full debug configuration + -h, --help ............... default help + --help ........... help on a specific feature. Try "--help topics" + -q, --quiet .............. minimise nodemon messages to start/stop only + -v, --version ............ current nodemon version + -V, --verbose ............ show detail on what is causing restarts + + +> Note that any unrecognised arguments are passed to the executing command. diff --git a/project starter code/node_modules/nodemon/doc/cli/topics.txt b/project starter code/node_modules/nodemon/doc/cli/topics.txt new file mode 100644 index 00000000..9fe3e2b5 --- /dev/null +++ b/project starter code/node_modules/nodemon/doc/cli/topics.txt @@ -0,0 +1,8 @@ + + options .................. show all available nodemon options + config ................... default config options using nodemon.json + authors .................. contributors to this project + logo ..................... <3 + whoami ................... I, AM, NODEMON \o/ + + Please support https://github.com/remy/nodemon/ diff --git a/project starter code/node_modules/nodemon/doc/cli/usage.txt b/project starter code/node_modules/nodemon/doc/cli/usage.txt new file mode 100644 index 00000000..bca98b5e --- /dev/null +++ b/project starter code/node_modules/nodemon/doc/cli/usage.txt @@ -0,0 +1,3 @@ + Usage: nodemon [nodemon options] [script.js] [args] + + See "nodemon --help" for more. diff --git a/project starter code/node_modules/nodemon/doc/cli/whoami.txt b/project starter code/node_modules/nodemon/doc/cli/whoami.txt new file mode 100644 index 00000000..efc3382e --- /dev/null +++ b/project starter code/node_modules/nodemon/doc/cli/whoami.txt @@ -0,0 +1,9 @@ +__/\\\\\_____/\\\_______/\\\\\_______/\\\\\\\\\\\\_____/\\\\\\\\\\\\\\\__/\\\\____________/\\\\_______/\\\\\_______/\\\\\_____/\\\_ + _\/\\\\\\___\/\\\_____/\\\///\\\____\/\\\////////\\\__\/\\\///////////__\/\\\\\\________/\\\\\\_____/\\\///\\\____\/\\\\\\___\/\\\_ + _\/\\\/\\\__\/\\\___/\\\/__\///\\\__\/\\\______\//\\\_\/\\\_____________\/\\\//\\\____/\\\//\\\___/\\\/__\///\\\__\/\\\/\\\__\/\\\_ + _\/\\\//\\\_\/\\\__/\\\______\//\\\_\/\\\_______\/\\\_\/\\\\\\\\\\\_____\/\\\\///\\\/\\\/_\/\\\__/\\\______\//\\\_\/\\\//\\\_\/\\\_ + _\/\\\\//\\\\/\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/\\\///////______\/\\\__\///\\\/___\/\\\_\/\\\_______\/\\\_\/\\\\//\\\\/\\\_ + _\/\\\_\//\\\/\\\_\//\\\______/\\\__\/\\\_______\/\\\_\/\\\_____________\/\\\____\///_____\/\\\_\//\\\______/\\\__\/\\\_\//\\\/\\\_ + _\/\\\__\//\\\\\\__\///\\\__/\\\____\/\\\_______/\\\__\/\\\_____________\/\\\_____________\/\\\__\///\\\__/\\\____\/\\\__\//\\\\\\_ + _\/\\\___\//\\\\\____\///\\\\\/_____\/\\\\\\\\\\\\/___\/\\\\\\\\\\\\\\\_\/\\\_____________\/\\\____\///\\\\\/_____\/\\\___\//\\\\\_ + _\///_____\/////_______\/////_______\////////////_____\///////////////__\///______________\///_______\/////_______\///_____\/////__ \ No newline at end of file diff --git a/project starter code/node_modules/nodemon/index.d.ts b/project starter code/node_modules/nodemon/index.d.ts new file mode 100644 index 00000000..4b146e5d --- /dev/null +++ b/project starter code/node_modules/nodemon/index.d.ts @@ -0,0 +1,126 @@ +type NodemonEventHandler = + | 'start' + | 'crash' + | 'exit' + | 'quit' + | 'restart' + | 'config:update' + | 'log' + | 'readable' + | 'stdout' + | 'stderr'; + +type NodemonEventListener = { + on(event: 'start' | 'crash' | 'readable', listener: () => void): Nodemon; + on(event: 'log', listener: (e: NodemonEventLog) => void): Nodemon; + on(event: 'stdout' | 'stderr', listener: (e: string) => void): Nodemon; + on(event: 'restart', listener: (e?: NodemonEventRestart) => void): Nodemon; + on(event: 'quit', listener: (e?: NodemonEventQuit) => void): Nodemon; + on(event: 'exit', listener: (e?: NodemonEventExit) => void): Nodemon; + on( + event: 'config:update', + listener: (e?: NodemonEventConfig) => void + ): Nodemon; +}; + +type Nodemon = { + (options?: NodemonSettings): Nodemon; + on(event: 'start' | 'crash', listener: () => void): Nodemon; + on(event: 'log', listener: (e: NodemonEventLog) => void): Nodemon; + on(event: 'restart', listener: (e?: NodemonEventRestart) => void): Nodemon; + on(event: 'quit', listener: (e?: NodemonEventQuit) => void): Nodemon; + on(event: 'exit', listener: (e?: NodemonEventExit) => void): Nodemon; + on( + event: 'config:update', + listener: (e?: NodemonEventConfig) => void + ): Nodemon; + + // this is repeated because VS Code doesn't autocomplete otherwise + addEventListener(event: 'start' | 'crash', listener: () => void): Nodemon; + addEventListener( + event: 'log', + listener: (e: NodemonEventLog) => void + ): Nodemon; + addEventListener( + event: 'restart', + listener: (e?: NodemonEventRestart) => void + ): Nodemon; + addEventListener( + event: 'quit', + listener: (e?: NodemonEventQuit) => void + ): Nodemon; + addEventListener( + event: 'exit', + listener: (e?: NodemonEventExit) => void + ): Nodemon; + addEventListener( + event: 'config:update', + listener: (e?: NodemonEventConfig) => void + ): Nodemon; + + once(event: 'start' | 'crash', listener: () => void): Nodemon; + once(event: 'log', listener: (e: NodemonEventLog) => void): Nodemon; + once(event: 'restart', listener: (e?: NodemonEventRestart) => void): Nodemon; + once(event: 'quit', listener: (e?: NodemonEventQuit) => void): Nodemon; + once(event: 'exit', listener: (e?: NodemonEventExit) => void): Nodemon; + once( + event: 'config:update', + listener: (e?: NodemonEventConfig) => void + ): Nodemon; + + removeAllListeners(event: NodemonEventHandler): Nodemon; + emit(type: NodemonEventHandler, event?: any): Nodemon; + reset(callback: Function): Nodemon; + restart(): Nodemon; + config: NodemonSettings; +}; + +type NodemonEventLog = { + /** + detail*: what you get with nodemon --verbose. + status: subprocess starting, restarting. + fail: is the subprocess crashing. + error: is a nodemon system error. + */ + type: 'detail' | 'log' | 'status' | 'error' | 'fail'; + /** the plain text message */ + message: String; + /** contains the terminal escape codes to add colour, plus the "[nodemon]" prefix */ + colour: String; +}; + +interface NodemonEventRestart { + matched?: { + result: string[]; + total: number; + }; +} + +type NodemonEventQuit = 143 | 130; +type NodemonEventExit = number; + +// TODO: Define the type of NodemonEventConfig +type NodemonEventConfig = any; + +interface NodemonSettings { + /* restartable defaults to "rs" as a string the user enters */ + restartable?: false | String; + colours?: Boolean; + execMap?: { [key: string]: string }; + ignoreRoot?: string[]; + watch?: string[]; + stdin?: boolean; + runOnChangeOnly?: boolean; + verbose?: boolean; + signal?: string; + stdout?: boolean; + watchOptions?: WatchOptions; +} + +interface WatchOptions { + ignorePermissionErrors: boolean; + ignored: string; + persistent: boolean; + usePolling: boolean; + interval: number; +} diff --git a/project starter code/node_modules/nodemon/jsconfig.json b/project starter code/node_modules/nodemon/jsconfig.json new file mode 100644 index 00000000..d77141cb --- /dev/null +++ b/project starter code/node_modules/nodemon/jsconfig.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "typeRoots": ["./index.d.ts", "./node_modules/@types"], + "checkJs": true + }, + "exclude": ["node_modules"] +} diff --git a/project starter code/node_modules/nodemon/lib/cli/index.js b/project starter code/node_modules/nodemon/lib/cli/index.js new file mode 100644 index 00000000..bf9e8099 --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/cli/index.js @@ -0,0 +1,49 @@ +var parse = require('./parse'); + +/** + * Converts a string to command line args, in particular + * groups together quoted values. + * This is a utility function to allow calling nodemon as a required + * library, but with the CLI args passed in (instead of an object). + * + * @param {String} string + * @return {Array} + */ +function stringToArgs(string) { + var args = []; + + var parts = string.split(' '); + var length = parts.length; + var i = 0; + var open = false; + var grouped = ''; + var lead = ''; + + for (; i < length; i++) { + lead = parts[i].substring(0, 1); + if (lead === '"' || lead === '\'') { + open = lead; + grouped = parts[i].substring(1); + } else if (open && parts[i].slice(-1) === open) { + open = false; + grouped += ' ' + parts[i].slice(0, -1); + args.push(grouped); + } else if (open) { + grouped += ' ' + parts[i]; + } else { + args.push(parts[i]); + } + } + + return args; +} + +module.exports = { + parse: function (argv) { + if (typeof argv === 'string') { + argv = stringToArgs(argv); + } + + return parse(argv); + }, +}; \ No newline at end of file diff --git a/project starter code/node_modules/nodemon/lib/cli/parse.js b/project starter code/node_modules/nodemon/lib/cli/parse.js new file mode 100644 index 00000000..ad740038 --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/cli/parse.js @@ -0,0 +1,230 @@ +/* + +nodemon is a utility for node, and replaces the use of the executable +node. So the user calls `nodemon foo.js` instead. + +nodemon can be run in a number of ways: + +`nodemon` - tries to use package.json#main property to run +`nodemon` - if no package, looks for index.js +`nodemon app.js` - runs app.js +`nodemon --arg app.js --apparg` - eats arg1, and runs app.js with apparg +`nodemon --apparg` - as above, but passes apparg to package.json#main (or + index.js) +`nodemon --debug app.js + +*/ + +var fs = require('fs'); +var path = require('path'); +var existsSync = fs.existsSync || path.existsSync; + +module.exports = parse; + +/** + * Parses the command line arguments `process.argv` and returns the + * nodemon options, the user script and the executable script. + * + * @param {Array} full process arguments, including `node` leading arg + * @return {Object} { options, script, args } + */ +function parse(argv) { + if (typeof argv === 'string') { + argv = argv.split(' '); + } + + var eat = function (i, args) { + if (i <= args.length) { + return args.splice(i + 1, 1).pop(); + } + }; + + var args = argv.slice(2); + var script = null; + var nodemonOptions = { scriptPosition: null }; + + var nodemonOpt = nodemonOption.bind(null, nodemonOptions); + var lookForArgs = true; + + // move forward through the arguments + for (var i = 0; i < args.length; i++) { + // if the argument looks like a file, then stop eating + if (!script) { + if (args[i] === '.' || existsSync(args[i])) { + script = args.splice(i, 1).pop(); + + // we capture the position of the script because we'll reinsert it in + // the right place in run.js:command (though I'm not sure we should even + // take it out of the array in the first place, but this solves passing + // arguments to the exec process for now). + nodemonOptions.scriptPosition = i; + i--; + continue; + } + } + + if (lookForArgs) { + // respect the standard way of saying: hereafter belongs to my script + if (args[i] === '--') { + args.splice(i, 1); + nodemonOptions.scriptPosition = i; + // cycle back one argument, as we just ate this one up + i--; + + // ignore all further nodemon arguments + lookForArgs = false; + + // move to the next iteration + continue; + } + + if (nodemonOpt(args[i], eat.bind(null, i, args)) !== false) { + args.splice(i, 1); + // cycle back one argument, as we just ate this one up + i--; + } + } + } + + nodemonOptions.script = script; + nodemonOptions.args = args; + + return nodemonOptions; +} + + +/** + * Given an argument (ie. from process.argv), sets nodemon + * options and can eat up the argument value + * + * @param {Object} options object that will be updated + * @param {Sting} current argument from argv + * @param {Function} the callback to eat up the next argument in argv + * @return {Boolean} false if argument was not a nodemon arg + */ +function nodemonOption(options, arg, eatNext) { + // line separation on purpose to help legibility + if (arg === '--help' || arg === '-h' || arg === '-?') { + var help = eatNext(); + options.help = help ? help : true; + } else + + if (arg === '--version' || arg === '-v') { + options.version = true; + } else + + if (arg === '--no-update-notifier') { + options.noUpdateNotifier = true; + } else + + if (arg === '--spawn') { + options.spawn = true; + } else + + if (arg === '--dump') { + options.dump = true; + } else + + if (arg === '--verbose' || arg === '-V') { + options.verbose = true; + } else + + if (arg === '--legacy-watch' || arg === '-L') { + options.legacyWatch = true; + } else + + if (arg === '--polling-interval' || arg === '-P') { + options.pollingInterval = parseInt(eatNext(), 10); + } else + + // Depricated as this is "on" by default + if (arg === '--js') { + options.js = true; + } else + + if (arg === '--quiet' || arg === '-q') { + options.quiet = true; + } else + + if (arg === '--config') { + options.configFile = eatNext(); + } else + + if (arg === '--watch' || arg === '-w') { + if (!options.watch) { options.watch = []; } + options.watch.push(eatNext()); + } else + + if (arg === '--ignore' || arg === '-i') { + if (!options.ignore) { options.ignore = []; } + options.ignore.push(eatNext()); + } else + + if (arg === '--exitcrash') { + options.exitcrash = true; + } else + + if (arg === '--delay' || arg === '-d') { + options.delay = parseDelay(eatNext()); + } else + + if (arg === '--exec' || arg === '-x') { + options.exec = eatNext(); + } else + + if (arg === '--no-stdin' || arg === '-I') { + options.stdin = false; + } else + + if (arg === '--on-change-only' || arg === '-C') { + options.runOnChangeOnly = true; + } else + + if (arg === '--ext' || arg === '-e') { + options.ext = eatNext(); + } else + + if (arg === '--no-colours' || arg === '--no-colors') { + options.colours = false; + } else + + if (arg === '--signal' || arg === '-s') { + options.signal = eatNext(); + } else + + if (arg === '--cwd') { + options.cwd = eatNext(); + + // go ahead and change directory. This is primarily for nodemon tools like + // grunt-nodemon - we're doing this early because it will affect where the + // user script is searched for. + process.chdir(path.resolve(options.cwd)); + } else { + + // this means we didn't match + return false; + } +} + +/** + * Given an argument (ie. from nodemonOption()), will parse and return the + * equivalent millisecond value or 0 if the argument cannot be parsed + * + * @param {String} argument value given to the --delay option + * @return {Number} millisecond equivalent of the argument + */ +function parseDelay(value) { + var millisPerSecond = 1000; + var millis = 0; + + if (value.match(/^\d*ms$/)) { + // Explicitly parse for milliseconds when using ms time specifier + millis = parseInt(value, 10); + } else { + // Otherwise, parse for seconds, with or without time specifier then convert + millis = parseFloat(value) * millisPerSecond; + } + + return isNaN(millis) ? 0 : millis; +} + diff --git a/project starter code/node_modules/nodemon/lib/config/command.js b/project starter code/node_modules/nodemon/lib/config/command.js new file mode 100644 index 00000000..9839b5c7 --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/config/command.js @@ -0,0 +1,43 @@ +module.exports = command; + +/** + * command constructs the executable command to run in a shell including the + * user script, the command arguments. + * + * @param {Object} settings Object as: + * { execOptions: { + * exec: String, + * [script: String], + * [scriptPosition: Number], + * [execArgs: Array] + * } + * } + * @return {Object} an object with the node executable and the + * arguments to the command + */ +function command(settings) { + var options = settings.execOptions; + var executable = options.exec; + var args = []; + + // after "executable" go the exec args (like --debug, etc) + if (options.execArgs) { + [].push.apply(args, options.execArgs); + } + + // then goes the user's script arguments + if (options.args) { + [].push.apply(args, options.args); + } + + // after the "executable" goes the user's script + if (options.script) { + args.splice((options.scriptPosition || 0) + + options.execArgs.length, 0, options.script); + } + + return { + executable: executable, + args: args, + }; +} diff --git a/project starter code/node_modules/nodemon/lib/config/defaults.js b/project starter code/node_modules/nodemon/lib/config/defaults.js new file mode 100644 index 00000000..dc95d346 --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/config/defaults.js @@ -0,0 +1,34 @@ +var ignoreRoot = require('ignore-by-default').directories(); + +// default options for config.options +const defaults = { + restartable: 'rs', + colours: true, + execMap: { + py: 'python', + rb: 'ruby', + ts: 'ts-node', + // more can be added here such as ls: lsc - but please ensure it's cross + // compatible with linux, mac and windows, or make the default.js + // dynamically append the `.cmd` for node based utilities + }, + ignoreRoot: ignoreRoot.map((_) => `**/${_}/**`), + watch: ['*.*'], + stdin: true, + runOnChangeOnly: false, + verbose: false, + signal: 'SIGUSR2', + // 'stdout' refers to the default behaviour of a required nodemon's child, + // but also includes stderr. If this is false, data is still dispatched via + // nodemon.on('stdout/stderr') + stdout: true, + watchOptions: {}, +}; + +const nodeOptions = process.env.NODE_OPTIONS || ''; // ? + +if (/--(loader|import)\b/.test(nodeOptions)) { + delete defaults.execMap.ts; +} + +module.exports = defaults; diff --git a/project starter code/node_modules/nodemon/lib/config/exec.js b/project starter code/node_modules/nodemon/lib/config/exec.js new file mode 100644 index 00000000..6d17eabb --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/config/exec.js @@ -0,0 +1,234 @@ +const path = require('path'); +const fs = require('fs'); +const existsSync = fs.existsSync; +const utils = require('../utils'); + +module.exports = exec; +module.exports.expandScript = expandScript; + +/** + * Reads the cwd/package.json file and looks to see if it can load a script + * and possibly an exec first from package.main, then package.start. + * + * @return {Object} exec & script if found + */ +function execFromPackage() { + // doing a try/catch because we can't use the path.exist callback pattern + // or we could, but the code would get messy, so this will do exactly + // what we're after - if the file doesn't exist, it'll throw. + try { + // note: this isn't nodemon's package, it's the user's cwd package + var pkg = require(path.join(process.cwd(), 'package.json')); + if (pkg.main !== undefined) { + // no app found to run - so give them a tip and get the feck out + return { exec: null, script: pkg.main }; + } + + if (pkg.scripts && pkg.scripts.start) { + return { exec: pkg.scripts.start }; + } + } catch (e) {} + + return null; +} + +function replace(map, str) { + var re = new RegExp('{{(' + Object.keys(map).join('|') + ')}}', 'g'); + return str.replace(re, function (all, m) { + return map[m] || all || ''; + }); +} + +function expandScript(script, ext) { + if (!ext) { + ext = '.js'; + } + if (script.indexOf(ext) !== -1) { + return script; + } + + if (existsSync(path.resolve(script))) { + return script; + } + + if (existsSync(path.resolve(script + ext))) { + return script + ext; + } + + return script; +} + +/** + * Discovers all the options required to run the script + * and if a custom exec has been passed in, then it will + * also try to work out what extensions to monitor and + * whether there's a special way of running that script. + * + * @param {Object} nodemonOptions + * @param {Object} execMap + * @return {Object} new and updated version of nodemonOptions + */ +function exec(nodemonOptions, execMap) { + if (!execMap) { + execMap = {}; + } + + var options = utils.clone(nodemonOptions || {}); + var script; + + // if there's no script passed, try to get it from the first argument + if (!options.script && (options.args || []).length) { + script = expandScript( + options.args[0], + options.ext && '.' + (options.ext || 'js').split(',')[0] + ); + + // if the script was found, shift it off our args + if (script !== options.args[0]) { + options.script = script; + options.args.shift(); + } + } + + // if there's no exec found yet, then try to read it from the local + // package.json this logic used to sit in the cli/parse, but actually the cli + // should be parsed first, then the user options (via nodemon.json) then + // finally default down to pot shots at the directory via package.json + if (!options.exec && !options.script) { + var found = execFromPackage(); + if (found !== null) { + if (found.exec) { + options.exec = found.exec; + } + if (!options.script) { + options.script = found.script; + } + if (Array.isArray(options.args) && options.scriptPosition === null) { + options.scriptPosition = options.args.length; + } + } + } + + // var options = utils.clone(nodemonOptions || {}); + script = path.basename(options.script || ''); + + var scriptExt = path.extname(script).slice(1); + + var extension = options.ext; + if (extension === undefined) { + var isJS = scriptExt === 'js' || scriptExt === 'mjs' || scriptExt === 'cjs'; + extension = isJS || !scriptExt ? 'js,mjs,cjs' : scriptExt; + extension += ',json'; // Always watch JSON files + } + + var execDefined = !!options.exec; + + // allows the user to simplify cli usage: + // https://github.com/remy/nodemon/issues/195 + // but always give preference to the user defined argument + if (!options.exec && execMap[scriptExt] !== undefined) { + options.exec = execMap[scriptExt]; + execDefined = true; + } + + options.execArgs = nodemonOptions.execArgs || []; + + if (Array.isArray(options.exec)) { + options.execArgs = options.exec; + options.exec = options.execArgs.shift(); + } + + if (options.exec === undefined) { + options.exec = 'node'; + } else { + // allow variable substitution for {{filename}} and {{pwd}} + var substitution = replace.bind(null, { + filename: options.script, + pwd: process.cwd(), + }); + + var newExec = substitution(options.exec); + if ( + newExec !== options.exec && + options.exec.indexOf('{{filename}}') !== -1 + ) { + options.script = null; + } + options.exec = newExec; + + var newExecArgs = options.execArgs.map(substitution); + if (newExecArgs.join('') !== options.execArgs.join('')) { + options.execArgs = newExecArgs; + delete options.script; + } + } + + if (options.exec === 'node' && options.nodeArgs && options.nodeArgs.length) { + options.execArgs = options.execArgs.concat(options.nodeArgs); + } + + // note: indexOf('coffee') handles both .coffee and .litcoffee + if ( + !execDefined && + options.exec === 'node' && + scriptExt.indexOf('coffee') !== -1 + ) { + options.exec = 'coffee'; + + // we need to get execArgs set before the script + // for example, in `nodemon --debug my-script.coffee --my-flag`, debug is an + // execArg, while my-flag is a script arg + var leadingArgs = (options.args || []).splice(0, options.scriptPosition); + options.execArgs = options.execArgs.concat(leadingArgs); + options.scriptPosition = 0; + + if (options.execArgs.length > 0) { + // because this is the coffee executable, we need to combine the exec args + // into a single argument after the nodejs flag + options.execArgs = ['--nodejs', options.execArgs.join(' ')]; + } + } + + if (options.exec === 'coffee') { + // don't override user specified extension tracking + if (options.ext === undefined) { + if (extension) { + extension += ','; + } + extension += 'coffee,litcoffee'; + } + + // because windows can't find 'coffee', it needs the real file 'coffee.cmd' + if (utils.isWindows) { + options.exec += '.cmd'; + } + } + + // allow users to make a mistake on the extension to monitor + // converts .js, pug => js,pug + // BIG NOTE: user can't do this: nodemon -e *.js + // because the terminal will automatically expand the glob against + // the file system :( + extension = (extension.match(/[^,*\s]+/g) || []) + .map((ext) => ext.replace(/^\./, '')) + .join(','); + + options.ext = extension; + + if (options.script) { + options.script = expandScript( + options.script, + extension && '.' + extension.split(',')[0] + ); + } + + options.env = {}; + // make sure it's an object (and since we don't have ) + if ({}.toString.apply(nodemonOptions.env) === '[object Object]') { + options.env = utils.clone(nodemonOptions.env); + } else if (nodemonOptions.env !== undefined) { + throw new Error('nodemon env values must be an object: { PORT: 8000 }'); + } + + return options; +} diff --git a/project starter code/node_modules/nodemon/lib/config/index.js b/project starter code/node_modules/nodemon/lib/config/index.js new file mode 100644 index 00000000..c78c435c --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/config/index.js @@ -0,0 +1,93 @@ +/** + * Manages the internal config of nodemon, checking for the state of support + * with fs.watch, how nodemon can watch files (using find or fs methods). + * + * This is *not* the user's config. + */ +var debug = require('debug')('nodemon'); +var load = require('./load'); +var rules = require('../rules'); +var utils = require('../utils'); +var pinVersion = require('../version').pin; +var command = require('./command'); +var rulesToMonitor = require('../monitor/match').rulesToMonitor; +var bus = utils.bus; + +function reset() { + rules.reset(); + + config.dirs = []; + config.options = { ignore: [], watch: [], monitor: [] }; + config.lastStarted = 0; + config.loaded = []; +} + +var config = { + run: false, + system: { + cwd: process.cwd(), + }, + required: false, + dirs: [], + timeout: 1000, + options: {}, +}; + +/** + * Take user defined settings, then detect the local machine capability, then + * look for local and global nodemon.json files and merge together the final + * settings with the config for nodemon. + * + * @param {Object} settings user defined settings for nodemon (typically on + * the cli) + * @param {Function} ready callback fired once the config is loaded + */ +config.load = function (settings, ready) { + reset(); + var config = this; + load(settings, config.options, config, function (options) { + config.options = options; + + if (options.watch.length === 0) { + // this is to catch when the watch is left blank + options.watch.push('*.*'); + } + + if (options['watch_interval']) { // jshint ignore:line + options.watchInterval = options['watch_interval']; // jshint ignore:line + } + + config.watchInterval = options.watchInterval || null; + if (options.signal) { + config.signal = options.signal; + } + + var cmd = command(config.options); + config.command = { + raw: cmd, + string: utils.stringify(cmd.executable, cmd.args), + }; + + // now run automatic checks on system adding to the config object + options.monitor = rulesToMonitor(options.watch, options.ignore, config); + + var cwd = process.cwd(); + debug('config: dirs', config.dirs); + if (config.dirs.length === 0) { + config.dirs.unshift(cwd); + } + + bus.emit('config:update', config); + pinVersion().then(function () { + ready(config); + }).catch(e => { + // this doesn't help testing, but does give exposure on syntax errors + console.error(e.stack); + setTimeout(() => { throw e; }, 0); + }); + }); +}; + +config.reset = reset; + +module.exports = config; diff --git a/project starter code/node_modules/nodemon/lib/config/load.js b/project starter code/node_modules/nodemon/lib/config/load.js new file mode 100644 index 00000000..75d8443f --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/config/load.js @@ -0,0 +1,223 @@ +var debug = require('debug')('nodemon'); +var fs = require('fs'); +var path = require('path'); +var exists = fs.exists || path.exists; +var utils = require('../utils'); +var rules = require('../rules'); +var parse = require('../rules/parse'); +var exec = require('./exec'); +var defaults = require('./defaults'); + +module.exports = load; +module.exports.mutateExecOptions = mutateExecOptions; + +var existsSync = fs.existsSync || path.existsSync; + +function findAppScript() { + // nodemon has been run alone, so try to read the package file + // or try to read the index.js file + + var pkg = + existsSync(path.join(process.cwd(), 'package.json')) && + require(path.join(process.cwd(), 'package.json')); + if ((!pkg || pkg.main == undefined) && existsSync('./index.js')) { + return 'index.js'; + } +} + +/** + * Load the nodemon config, first reading the global root/nodemon.json, then + * the local nodemon.json to the exec and then overwriting using any user + * specified settings (i.e. from the cli) + * + * @param {Object} settings user defined settings + * @param {Function} ready callback that receives complete config + */ +function load(settings, options, config, callback) { + config.loaded = []; + // first load the root nodemon.json + loadFile(options, config, utils.home, function (options) { + // then load the user's local configuration file + if (settings.configFile) { + options.configFile = path.resolve(settings.configFile); + } + loadFile(options, config, process.cwd(), function (options) { + // Then merge over with the user settings (parsed from the cli). + // Note that merge protects and favours existing values over new values, + // and thus command line arguments get priority + options = utils.merge(settings, options); + + // legacy support + if (!Array.isArray(options.ignore)) { + options.ignore = [options.ignore]; + } + + if (!options.ignoreRoot) { + options.ignoreRoot = defaults.ignoreRoot; + } + + // blend the user ignore and the default ignore together + if (options.ignoreRoot && options.ignore) { + if (!Array.isArray(options.ignoreRoot)) { + options.ignoreRoot = [options.ignoreRoot]; + } + options.ignore = options.ignoreRoot.concat(options.ignore); + } else { + options.ignore = defaults.ignore.concat(options.ignore); + } + + // add in any missing defaults + options = utils.merge(options, defaults); + + if (!options.script && !options.exec) { + var found = findAppScript(); + if (found) { + if (!options.args) { + options.args = []; + } + // if the script is found as a result of not being on the command + // line, then we move any of the pre double-dash args in execArgs + const n = + options.scriptPosition === null + ? options.args.length + : options.scriptPosition; + + options.execArgs = (options.execArgs || []).concat( + options.args.splice(0, n) + ); + options.scriptPosition = null; + + options.script = found; + } + } + + mutateExecOptions(options); + + if (options.quiet) { + utils.quiet(); + } + + if (options.verbose) { + utils.debug = true; + } + + // simplify the ready callback to be called after the rules are normalised + // from strings to regexp through the rules lib. Note that this gets + // created *after* options is overwritten twice in the lines above. + var ready = function (options) { + normaliseRules(options, callback); + }; + + ready(options); + }); + }); +} + +function normaliseRules(options, ready) { + // convert ignore and watch options to rules/regexp + rules.watch.add(options.watch); + rules.ignore.add(options.ignore); + + // normalise the watch and ignore arrays + options.watch = options.watch === false ? false : rules.rules.watch; + options.ignore = rules.rules.ignore; + + ready(options); +} + +/** + * Looks for a config in the current working directory, and a config in the + * user's home directory, merging the two together, giving priority to local + * config. This can then be overwritten later by command line arguments + * + * @param {Function} ready callback to pass loaded settings to + */ +function loadFile(options, config, dir, ready) { + if (!ready) { + ready = function () {}; + } + + var callback = function (settings) { + // prefer the local nodemon.json and fill in missing items using + // the global options + ready(utils.merge(settings, options)); + }; + + if (!dir) { + return callback({}); + } + + var filename = options.configFile || path.join(dir, 'nodemon.json'); + + if (config.loaded.indexOf(filename) !== -1) { + // don't bother re-parsing the same config file + return callback({}); + } + + fs.readFile(filename, 'utf8', function (err, data) { + if (err) { + if (err.code === 'ENOENT') { + if (!options.configFile && dir !== utils.home) { + // if no specified local config file and local nodemon.json + // doesn't exist, try the package.json + return loadPackageJSON(config, callback); + } + } + return callback({}); + } + + var settings = {}; + + try { + settings = JSON.parse(data.toString('utf8').replace(/^\uFEFF/, '')); + if (!filename.endsWith('package.json') || settings.nodemonConfig) { + config.loaded.push(filename); + } + } catch (e) { + utils.log.fail('Failed to parse config ' + filename); + console.error(e); + process.exit(1); + } + + // options values will overwrite settings + callback(settings); + }); +} + +function loadPackageJSON(config, ready) { + if (!ready) { + ready = () => {}; + } + + const dir = process.cwd(); + const filename = path.join(dir, 'package.json'); + const packageLoadOptions = { configFile: filename }; + return loadFile(packageLoadOptions, config, dir, (settings) => { + ready(settings.nodemonConfig || {}); + }); +} + +function mutateExecOptions(options) { + // work out the execOptions based on the final config we have + options.execOptions = exec( + { + script: options.script, + exec: options.exec, + args: options.args, + scriptPosition: options.scriptPosition, + nodeArgs: options.nodeArgs, + execArgs: options.execArgs, + ext: options.ext, + env: options.env, + }, + options.execMap + ); + + // clean up values that we don't need at the top level + delete options.scriptPosition; + delete options.script; + delete options.args; + delete options.ext; + + return options; +} diff --git a/project starter code/node_modules/nodemon/lib/help/index.js b/project starter code/node_modules/nodemon/lib/help/index.js new file mode 100644 index 00000000..1054b602 --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/help/index.js @@ -0,0 +1,27 @@ +var fs = require('fs'); +var path = require('path'); +const supportsColor = require('supports-color'); + +module.exports = help; + +const highlight = supportsColor.stdout ? '\x1B\[$1m' : ''; + +function help(item) { + if (!item) { + item = 'help'; + } else if (item === true) { // if used with -h or --help and no args + item = 'help'; + } + + // cleanse the filename to only contain letters + // aka: /\W/g but figured this was eaiser to read + item = item.replace(/[^a-z]/gi, ''); + + try { + var dir = path.join(__dirname, '..', '..', 'doc', 'cli', item + '.txt'); + var body = fs.readFileSync(dir, 'utf8'); + return body.replace(/\\x1B\[(.)m/g, highlight); + } catch (e) { + return '"' + item + '" help can\'t be found'; + } +} diff --git a/project starter code/node_modules/nodemon/lib/index.js b/project starter code/node_modules/nodemon/lib/index.js new file mode 100644 index 00000000..0eca5c45 --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/index.js @@ -0,0 +1 @@ +module.exports = require('./nodemon'); \ No newline at end of file diff --git a/project starter code/node_modules/nodemon/lib/monitor/index.js b/project starter code/node_modules/nodemon/lib/monitor/index.js new file mode 100644 index 00000000..89db029b --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/monitor/index.js @@ -0,0 +1,4 @@ +module.exports = { + run: require('./run'), + watch: require('./watch').watch, +}; diff --git a/project starter code/node_modules/nodemon/lib/monitor/match.js b/project starter code/node_modules/nodemon/lib/monitor/match.js new file mode 100644 index 00000000..2ac3b291 --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/monitor/match.js @@ -0,0 +1,276 @@ +const minimatch = require('minimatch'); +const path = require('path'); +const fs = require('fs'); +const debug = require('debug')('nodemon:match'); +const utils = require('../utils'); + +module.exports = match; +module.exports.rulesToMonitor = rulesToMonitor; + +function rulesToMonitor(watch, ignore, config) { + var monitor = []; + + if (!Array.isArray(ignore)) { + if (ignore) { + ignore = [ignore]; + } else { + ignore = []; + } + } + + if (!Array.isArray(watch)) { + if (watch) { + watch = [watch]; + } else { + watch = []; + } + } + + if (watch && watch.length) { + monitor = utils.clone(watch); + } + + if (ignore) { + [].push.apply(monitor, (ignore || []).map(function (rule) { + return '!' + rule; + })); + } + + var cwd = process.cwd(); + + // next check if the monitored paths are actual directories + // or just patterns - and expand the rule to include *.* + monitor = monitor.map(function (rule) { + var not = rule.slice(0, 1) === '!'; + + if (not) { + rule = rule.slice(1); + } + + if (rule === '.' || rule === '.*') { + rule = '*.*'; + } + + var dir = path.resolve(cwd, rule); + + try { + var stat = fs.statSync(dir); + if (stat.isDirectory()) { + rule = dir; + if (rule.slice(-1) !== '/') { + rule += '/'; + } + rule += '**/*'; + + // `!not` ... sorry. + if (!not) { + config.dirs.push(dir); + } + } else { + // ensures we end up in the check that tries to get a base directory + // and then adds it to the watch list + throw new Error(); + } + } catch (e) { + var base = tryBaseDir(dir); + if (!not && base) { + if (config.dirs.indexOf(base) === -1) { + config.dirs.push(base); + } + } + } + + if (rule.slice(-1) === '/') { + // just slap on a * anyway + rule += '*'; + } + + // if the url ends with * but not **/* and not *.* + // then convert to **/* - somehow it was missed :-\ + if (rule.slice(-4) !== '**/*' && + rule.slice(-1) === '*' && + rule.indexOf('*.') === -1) { + + if (rule.slice(-2) !== '**') { + rule += '*/*'; + } + } + + + return (not ? '!' : '') + rule; + }); + + return monitor; +} + +function tryBaseDir(dir) { + var stat; + if (/[?*\{\[]+/.test(dir)) { // if this is pattern, then try to find the base + try { + var base = path.dirname(dir.replace(/([?*\{\[]+.*$)/, 'foo')); + stat = fs.statSync(base); + if (stat.isDirectory()) { + return base; + } + } catch (error) { + // console.log(error); + } + } else { + try { + stat = fs.statSync(dir); + // if this path is actually a single file that exists, then just monitor + // that, *specifically*. + if (stat.isFile() || stat.isDirectory()) { + return dir; + } + } catch (e) { } + } + + return false; +} + +function match(files, monitor, ext) { + // sort the rules by highest specificity (based on number of slashes) + // ignore rules (!) get sorted highest as they take precedent + const cwd = process.cwd(); + var rules = monitor.sort(function (a, b) { + var r = b.split(path.sep).length - a.split(path.sep).length; + var aIsIgnore = a.slice(0, 1) === '!'; + var bIsIgnore = b.slice(0, 1) === '!'; + + if (aIsIgnore || bIsIgnore) { + if (aIsIgnore) { + return -1; + } + + return 1; + } + + if (r === 0) { + return b.length - a.length; + } + return r; + }).map(function (s) { + var prefix = s.slice(0, 1); + + if (prefix === '!') { + if (s.indexOf('!' + cwd) === 0) { + return s; + } + + // if it starts with a period, then let's get the relative path + if (s.indexOf('!.') === 0) { + return '!' + path.resolve(cwd, s.substring(1)); + } + + return '!**' + (prefix !== path.sep ? path.sep : '') + s.slice(1); + } + + // if it starts with a period, then let's get the relative path + if (s.indexOf('.') === 0) { + return path.resolve(cwd, s); + } + + if (s.indexOf(cwd) === 0) { + return s; + } + + return '**' + (prefix !== path.sep ? path.sep : '') + s; + }); + + debug('rules', rules); + + var good = []; + var whitelist = []; // files that we won't check against the extension + var ignored = 0; + var watched = 0; + var usedRules = []; + var minimatchOpts = { + dot: true, + }; + + // enable case-insensitivity on Windows + if (utils.isWindows) { + minimatchOpts.nocase = true; + } + + files.forEach(function (file) { + file = path.resolve(cwd, file); + + var matched = false; + for (var i = 0; i < rules.length; i++) { + if (rules[i].slice(0, 1) === '!') { + if (!minimatch(file, rules[i], minimatchOpts)) { + debug('ignored', file, 'rule:', rules[i]); + ignored++; + matched = true; + break; + } + } else { + debug('matched', file, 'rule:', rules[i]); + if (minimatch(file, rules[i], minimatchOpts)) { + watched++; + + // don't repeat the output if a rule is matched + if (usedRules.indexOf(rules[i]) === -1) { + usedRules.push(rules[i]); + utils.log.detail('matched rule: ' + rules[i]); + } + + // if the rule doesn't match the WATCH EVERYTHING + // but *does* match a rule that ends with *.*, then + // white list it - in that we don't run it through + // the extension check too. + if (rules[i] !== '**' + path.sep + '*.*' && + rules[i].slice(-3) === '*.*') { + whitelist.push(file); + } else if (path.basename(file) === path.basename(rules[i])) { + // if the file matches the actual rule, then it's put on whitelist + whitelist.push(file); + } else { + good.push(file); + } + matched = true; + break; + } else { + // utils.log.detail('no match: ' + rules[i], file); + } + } + } + if (!matched) { + ignored++; + } + }); + + debug('good', good) + + // finally check the good files against the extensions that we're monitoring + if (ext) { + if (ext.indexOf(',') === -1) { + ext = '**/*.' + ext; + } else { + ext = '**/*.{' + ext + '}'; + } + + good = good.filter(function (file) { + // only compare the filename to the extension test + return minimatch(path.basename(file), ext, minimatchOpts); + }); + } // else assume *.* + + var result = good.concat(whitelist); + + if (utils.isWindows) { + // fix for windows testing - I *think* this is okay to do + result = result.map(function (file) { + return file.slice(0, 1).toLowerCase() + file.slice(1); + }); + } + + return { + result: result, + ignored: ignored, + watched: watched, + total: files.length, + }; +} diff --git a/project starter code/node_modules/nodemon/lib/monitor/run.js b/project starter code/node_modules/nodemon/lib/monitor/run.js new file mode 100644 index 00000000..e05041e4 --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/monitor/run.js @@ -0,0 +1,555 @@ +var debug = require('debug')('nodemon:run'); +const statSync = require('fs').statSync; +var utils = require('../utils'); +var bus = utils.bus; +var childProcess = require('child_process'); +var spawn = childProcess.spawn; +var exec = childProcess.exec; +var execSync = childProcess.execSync; +var fork = childProcess.fork; +var watch = require('./watch').watch; +var config = require('../config'); +var child = null; // the actual child process we spawn +var killedAfterChange = false; +var noop = () => {}; +var restart = null; +var psTree = require('pstree.remy'); +var path = require('path'); +var signals = require('./signals'); +const undefsafe = require('undefsafe'); +const osRelease = parseInt(require('os').release().split('.')[0], 10); + +function run(options) { + var cmd = config.command.raw; + // moved up + // we need restart function below in the global scope for run.kill + /*jshint validthis:true*/ + restart = run.bind(this, options); + run.restart = restart; + + // binding options with instance of run + // so that we can use it in run.kill + run.options = options; + + var runCmd = !options.runOnChangeOnly || config.lastStarted !== 0; + if (runCmd) { + utils.log.status('starting `' + config.command.string + '`'); + } else { + // should just watch file if command is not to be run + // had another alternate approach + // to stop process being forked/spawned in the below code + // but this approach does early exit and makes code cleaner + debug('start watch on: %s', config.options.watch); + if (config.options.watch !== false) { + watch(); + return; + } + } + + config.lastStarted = Date.now(); + + var stdio = ['pipe', 'pipe', 'pipe']; + + if (config.options.stdout) { + stdio = ['pipe', process.stdout, process.stderr]; + } + + if (config.options.stdin === false) { + stdio = [process.stdin, process.stdout, process.stderr]; + } + + var sh = 'sh'; + var shFlag = '-c'; + + const binPath = process.cwd() + '/node_modules/.bin'; + + const spawnOptions = { + env: Object.assign({}, process.env, options.execOptions.env, { + PATH: + binPath + + path.delimiter + + (undefsafe(options, '.execOptions.env.PATH') || process.env.PATH), + }), + stdio: stdio, + }; + + var executable = cmd.executable; + + if (utils.isWindows) { + // if the exec includes a forward slash, reverse it for windows compat + // but *only* apply to the first command, and none of the arguments. + // ref #1251 and #1236 + if (executable.indexOf('/') !== -1) { + executable = executable + .split(' ') + .map((e, i) => { + if (i === 0) { + return path.normalize(e); + } + return e; + }) + .join(' '); + } + // taken from npm's cli: https://git.io/vNFD4 + sh = process.env.comspec || 'cmd'; + shFlag = '/d /s /c'; + spawnOptions.windowsVerbatimArguments = true; + spawnOptions.windowsHide = true; + } + + var args = runCmd ? utils.stringify(executable, cmd.args) : ':'; + var spawnArgs = [sh, [shFlag, args], spawnOptions]; + + const firstArg = cmd.args[0] || ''; + + var inBinPath = false; + try { + inBinPath = statSync(`${binPath}/${executable}`).isFile(); + } catch (e) {} + + // hasStdio allows us to correctly handle stdin piping + // see: https://git.io/vNtX3 + const hasStdio = utils.satisfies('>= 6.4.0 || < 5'); + + // forking helps with sub-process handling and tends to clean up better + // than spawning, but it should only be used under specific conditions + const shouldFork = + !config.options.spawn && + !inBinPath && + !(firstArg.indexOf('-') === 0) && // don't fork if there's a node exec arg + firstArg !== 'inspect' && // don't fork it's `inspect` debugger + executable === 'node' && // only fork if node + utils.version.major > 4; // only fork if node version > 4 + + if (shouldFork) { + // this assumes the first argument is the script and slices it out, since + // we're forking + var forkArgs = cmd.args.slice(1); + var env = utils.merge(options.execOptions.env, process.env); + stdio.push('ipc'); + const forkOptions = { + env: env, + stdio: stdio, + silent: !hasStdio, + }; + if (utils.isWindows) { + forkOptions.windowsHide = true; + } + child = fork(options.execOptions.script, forkArgs, forkOptions); + utils.log.detail('forking'); + debug('fork', sh, shFlag, args); + } else { + utils.log.detail('spawning'); + child = spawn.apply(null, spawnArgs); + debug('spawn', sh, shFlag, args); + } + + if (config.required) { + var emit = { + stdout: function (data) { + bus.emit('stdout', data); + }, + stderr: function (data) { + bus.emit('stderr', data); + }, + }; + + // now work out what to bind to... + if (config.options.stdout) { + child.on('stdout', emit.stdout).on('stderr', emit.stderr); + } else { + child.stdout.on('data', emit.stdout); + child.stderr.on('data', emit.stderr); + + bus.stdout = child.stdout; + bus.stderr = child.stderr; + } + + if (shouldFork) { + child.on('message', function (message, sendHandle) { + bus.emit('message', message, sendHandle); + }); + } + } + + bus.emit('start'); + + utils.log.detail('child pid: ' + child.pid); + + child.on('error', function (error) { + bus.emit('error', error); + if (error.code === 'ENOENT') { + utils.log.error('unable to run executable: "' + cmd.executable + '"'); + process.exit(1); + } else { + utils.log.error('failed to start child process: ' + error.code); + throw error; + } + }); + + child.on('exit', function (code, signal) { + if (child && child.stdin) { + process.stdin.unpipe(child.stdin); + } + + if (code === 127) { + utils.log.error( + 'failed to start process, "' + cmd.executable + '" exec not found' + ); + bus.emit('error', code); + process.exit(); + } + + // If the command failed with code 2, it may or may not be a syntax error + // See: http://git.io/fNOAR + // We will only assume a parse error, if the child failed quickly + if (code === 2 && Date.now() < config.lastStarted + 500) { + utils.log.error('process failed, unhandled exit code (2)'); + utils.log.error(''); + utils.log.error('Either the command has a syntax error,'); + utils.log.error('or it is exiting with reserved code 2.'); + utils.log.error(''); + utils.log.error('To keep nodemon running even after a code 2,'); + utils.log.error('add this to the end of your command: || exit 1'); + utils.log.error(''); + utils.log.error('Read more here: https://git.io/fNOAG'); + utils.log.error(''); + utils.log.error('nodemon will stop now so that you can fix the command.'); + utils.log.error(''); + bus.emit('error', code); + process.exit(); + } + + // In case we killed the app ourselves, set the signal thusly + if (killedAfterChange) { + killedAfterChange = false; + signal = config.signal; + } + // this is nasty, but it gives it windows support + if (utils.isWindows && signal === 'SIGTERM') { + signal = config.signal; + } + + if (signal === config.signal || code === 0) { + // this was a clean exit, so emit exit, rather than crash + debug('bus.emit(exit) via ' + config.signal); + bus.emit('exit', signal); + + // exit the monitor, but do it gracefully + if (signal === config.signal) { + return restart(); + } + + if (code === 0) { + // clean exit - wait until file change to restart + if (runCmd) { + utils.log.status('clean exit - waiting for changes before restart'); + } + child = null; + } + } else { + bus.emit('crash'); + if (options.exitcrash) { + utils.log.fail('app crashed'); + if (!config.required) { + process.exit(1); + } + } else { + utils.log.fail( + 'app crashed - waiting for file changes before' + ' starting...' + ); + child = null; + } + } + + if (config.options.restartable) { + // stdin needs to kick in again to be able to listen to the + // restart command + process.stdin.resume(); + } + }); + + // moved the run.kill outside to handle both the cases + // intial start + // no start + + // connect stdin to the child process (options.stdin is on by default) + if (options.stdin) { + process.stdin.resume(); + // FIXME decide whether or not we need to decide the encoding + // process.stdin.setEncoding('utf8'); + + // swallow the stdin error if it happens + // ref: https://github.com/remy/nodemon/issues/1195 + if (hasStdio) { + child.stdin.on('error', () => {}); + process.stdin.pipe(child.stdin); + } else { + if (child.stdout) { + child.stdout.pipe(process.stdout); + } else { + utils.log.error( + 'running an unsupported version of node ' + process.version + ); + utils.log.error( + 'nodemon may not work as expected - ' + + 'please consider upgrading to LTS' + ); + } + } + + bus.once('exit', function () { + if (child && process.stdin.unpipe) { + // node > 0.8 + process.stdin.unpipe(child.stdin); + } + }); + } + + debug('start watch on: %s', config.options.watch); + if (config.options.watch !== false) { + watch(); + } +} + +function waitForSubProcesses(pid, callback) { + debug('checking ps tree for pids of ' + pid); + psTree(pid, (err, pids) => { + if (!pids.length) { + return callback(); + } + + utils.log.status( + `still waiting for ${pids.length} sub-process${ + pids.length > 2 ? 'es' : '' + } to finish...` + ); + setTimeout(() => waitForSubProcesses(pid, callback), 1000); + }); +} + +function kill(child, signal, callback) { + if (!callback) { + callback = noop; + } + + if (utils.isWindows) { + const taskKill = () => { + try { + exec('taskkill /pid ' + child.pid + ' /T /F'); + } catch (e) { + utils.log.error('Could not shutdown sub process cleanly'); + } + }; + + // We are handling a 'SIGKILL' , 'SIGUSR2' and 'SIGUSR1' POSIX signal under Windows the + // same way it is handled on a UNIX system: We are performing + // a hard shutdown without waiting for the process to clean-up. + if ( + signal === 'SIGKILL' || + osRelease < 10 || + signal === 'SIGUSR2' || + signal === 'SIGUSR1' + ) { + debug('terminating process group by force: %s', child.pid); + + // We are using the taskkill utility to terminate the whole + // process group ('/t') of the child ('/pid') by force ('/f'). + // We need to end all sub processes, because the 'child' + // process in this context is actually a cmd.exe wrapper. + taskKill(); + callback(); + return; + } + + try { + // We are using the Windows Management Instrumentation Command-line + // (wmic.exe) to resolve the sub-child process identifier, because the + // 'child' process in this context is actually a cmd.exe wrapper. + // We want to send the termination signal directly to the node process. + // The '2> nul' silences the no process found error message. + const resultBuffer = execSync( + `wmic process where (ParentProcessId=${child.pid}) get ProcessId 2> nul` + ); + const result = resultBuffer.toString().match(/^[0-9]+/m); + + // If there is no sub-child process we fall back to the child process. + const processId = Array.isArray(result) ? result[0] : child.pid; + + debug('sending kill signal SIGINT to process: %s', processId); + + // We are using the standalone 'windows-kill' executable to send the + // standard POSIX signal 'SIGINT' to the node process. This fixes #1720. + const windowsKill = path.normalize( + `${__dirname}/../../bin/windows-kill.exe` + ); + + // We have to detach the 'windows-kill' execution completely from this + // process group to avoid terminating the nodemon process itself. + // See: https://github.com/alirdn/windows-kill#how-it-works--limitations + // + // Therefore we are using 'start' to create a new cmd.exe context. + // The '/min' option hides the new terminal window and the '/wait' + // option lets the process wait for the command to finish. + + execSync( + `start "windows-kill" /min /wait "${windowsKill}" -SIGINT ${processId}` + ); + } catch (e) { + taskKill(); + } + callback(); + } else { + // we use psTree to kill the full subtree of nodemon, because when + // spawning processes like `coffee` under the `--debug` flag, it'll spawn + // it's own child, and that can't be killed by nodemon, so psTree gives us + // an array of PIDs that have spawned under nodemon, and we send each the + // configured signal (default: SIGUSR2) signal, which fixes #335 + // note that psTree also works if `ps` is missing by looking in /proc + let sig = signal.replace('SIG', ''); + + psTree(child.pid, function (err, pids) { + // if ps isn't native to the OS, then we need to send the numeric value + // for the signal during the kill, `signals` is a lookup table for that. + if (!psTree.hasPS) { + sig = signals[signal]; + } + + // the sub processes need to be killed from smallest to largest + debug('sending kill signal to ' + pids.join(', ')); + + child.kill(signal); + + pids.sort().forEach((pid) => exec(`kill -${sig} ${pid}`, noop)); + + waitForSubProcesses(child.pid, () => { + // finally kill the main user process + exec(`kill -${sig} ${child.pid}`, callback); + }); + }); + } +} + +run.kill = function (noRestart, callback) { + // I hate code like this :( - Remy (author of said code) + if (typeof noRestart === 'function') { + callback = noRestart; + noRestart = false; + } + + if (!callback) { + callback = noop; + } + + if (child !== null) { + // if the stdin piping is on, we need to unpipe, but also close stdin on + // the child, otherwise linux can throw EPIPE or ECONNRESET errors. + if (run.options.stdin) { + process.stdin.unpipe(child.stdin); + } + + // For the on('exit', ...) handler above the following looks like a + // crash, so we set the killedAfterChange flag if a restart is planned + if (!noRestart) { + killedAfterChange = true; + } + + /* Now kill the entire subtree of processes belonging to nodemon */ + var oldPid = child.pid; + if (child) { + kill(child, config.signal, function () { + // this seems to fix the 0.11.x issue with the "rs" restart command, + // though I'm unsure why. it seems like more data is streamed in to + // stdin after we close. + if (child && run.options.stdin && child.stdin && oldPid === child.pid) { + child.stdin.end(); + } + callback(); + }); + } + } else if (!noRestart) { + // if there's no child, then we need to manually start the process + // this is because as there was no child, the child.on('exit') event + // handler doesn't exist which would normally trigger the restart. + bus.once('start', callback); + run.restart(); + } else { + callback(); + } +}; + +run.restart = noop; + +bus.on('quit', function onQuit(code) { + if (code === undefined) { + code = 0; + } + + // remove event listener + var exitTimer = null; + var exit = function () { + clearTimeout(exitTimer); + exit = noop; // null out in case of race condition + child = null; + if (!config.required) { + // Execute all other quit listeners. + bus.listeners('quit').forEach(function (listener) { + if (listener !== onQuit) { + listener(); + } + }); + process.exit(code); + } else { + bus.emit('exit'); + } + }; + + // if we're not running already, don't bother with trying to kill + if (config.run === false) { + return exit(); + } + + // immediately try to stop any polling + config.run = false; + + if (child) { + // give up waiting for the kids after 10 seconds + exitTimer = setTimeout(exit, 10 * 1000); + child.removeAllListeners('exit'); + child.once('exit', exit); + + kill(child, 'SIGINT'); + } else { + exit(); + } +}); + +bus.on('restart', function () { + // run.kill will send a SIGINT to the child process, which will cause it + // to terminate, which in turn uses the 'exit' event handler to restart + run.kill(); +}); + +// remove the child file on exit +process.on('exit', function () { + utils.log.detail('exiting'); + if (child) { + child.kill(); + } +}); + +// because windows borks when listening for the SIG* events +if (!utils.isWindows) { + bus.once('boot', () => { + // usual suspect: ctrl+c exit + process.once('SIGINT', () => bus.emit('quit', 130)); + process.once('SIGTERM', () => { + bus.emit('quit', 143); + if (child) { + child.kill('SIGTERM'); + } + }); + }); +} + +module.exports = run; diff --git a/project starter code/node_modules/nodemon/lib/monitor/signals.js b/project starter code/node_modules/nodemon/lib/monitor/signals.js new file mode 100644 index 00000000..daff6e05 --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/monitor/signals.js @@ -0,0 +1,34 @@ +module.exports = { + SIGHUP: 1, + SIGINT: 2, + SIGQUIT: 3, + SIGILL: 4, + SIGTRAP: 5, + SIGABRT: 6, + SIGBUS: 7, + SIGFPE: 8, + SIGKILL: 9, + SIGUSR1: 10, + SIGSEGV: 11, + SIGUSR2: 12, + SIGPIPE: 13, + SIGALRM: 14, + SIGTERM: 15, + SIGSTKFLT: 16, + SIGCHLD: 17, + SIGCONT: 18, + SIGSTOP: 19, + SIGTSTP: 20, + SIGTTIN: 21, + SIGTTOU: 22, + SIGURG: 23, + SIGXCPU: 24, + SIGXFSZ: 25, + SIGVTALRM: 26, + SIGPROF: 27, + SIGWINCH: 28, + SIGIO: 29, + SIGPWR: 30, + SIGSYS: 31, + SIGRTMIN: 35, +} diff --git a/project starter code/node_modules/nodemon/lib/monitor/watch.js b/project starter code/node_modules/nodemon/lib/monitor/watch.js new file mode 100644 index 00000000..d0ac7fe1 --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/monitor/watch.js @@ -0,0 +1,244 @@ +module.exports.watch = watch; +module.exports.resetWatchers = resetWatchers; + +var debug = require('debug')('nodemon:watch'); +var debugRoot = require('debug')('nodemon'); +var chokidar = require('chokidar'); +var undefsafe = require('undefsafe'); +var config = require('../config'); +var path = require('path'); +var utils = require('../utils'); +var bus = utils.bus; +var match = require('./match'); +var watchers = []; +var debouncedBus; + +bus.on('reset', resetWatchers); + +function resetWatchers() { + debugRoot('resetting watchers'); + watchers.forEach(function (watcher) { + watcher.close(); + }); + watchers = []; +} + +function watch() { + if (watchers.length) { + debug('early exit on watch, still watching (%s)', watchers.length); + return; + } + + var dirs = [].slice.call(config.dirs); + + debugRoot('start watch on: %s', dirs.join(', ')); + const rootIgnored = config.options.ignore; + debugRoot('ignored', rootIgnored); + + var watchedFiles = []; + + const promise = new Promise(function (resolve) { + const dotFilePattern = /[/\\]\./; + var ignored = match.rulesToMonitor( + [], // not needed + Array.from(rootIgnored), + config + ).map(pattern => pattern.slice(1)); + + const addDotFile = dirs.filter(dir => dir.match(dotFilePattern)); + + // don't ignore dotfiles if explicitly watched. + if (addDotFile.length === 0) { + ignored.push(dotFilePattern); + } + + var watchOptions = { + ignorePermissionErrors: true, + ignored: ignored, + persistent: true, + usePolling: config.options.legacyWatch || false, + interval: config.options.pollingInterval, + // note to future developer: I've gone back and forth on adding `cwd` + // to the props and in some cases it fixes bugs but typically it causes + // bugs elsewhere (since nodemon is used is so many ways). the final + // decision is to *not* use it at all and work around it + // cwd: ... + }; + + if (utils.isWindows) { + watchOptions.disableGlobbing = true; + } + + if (utils.isIBMi) { + watchOptions.usePolling = true; + } + + if (process.env.TEST) { + watchOptions.useFsEvents = false; + } + + var watcher = chokidar.watch( + dirs, + Object.assign({}, watchOptions, config.options.watchOptions || {}) + ); + + watcher.ready = false; + + var total = 0; + + watcher.on('change', filterAndRestart); + watcher.on('unlink', filterAndRestart); + watcher.on('add', function (file) { + if (watcher.ready) { + return filterAndRestart(file); + } + + watchedFiles.push(file); + bus.emit('watching', file); + debug('chokidar watching: %s', file); + }); + watcher.on('ready', function () { + watchedFiles = Array.from(new Set(watchedFiles)); // ensure no dupes + total = watchedFiles.length; + watcher.ready = true; + resolve(total); + debugRoot('watch is complete'); + }); + + watcher.on('error', function (error) { + if (error.code === 'EINVAL') { + utils.log.error( + 'Internal watch failed. Likely cause: too many ' + + 'files being watched (perhaps from the root of a drive?\n' + + 'See https://github.com/paulmillr/chokidar/issues/229 for details' + ); + } else { + utils.log.error('Internal watch failed: ' + error.message); + process.exit(1); + } + }); + + watchers.push(watcher); + }); + + return promise.catch(e => { + // this is a core error and it should break nodemon - so I have to break + // out of a promise using the setTimeout + setTimeout(() => { + throw e; + }); + }).then(function () { + utils.log.detail(`watching ${watchedFiles.length} file${ + watchedFiles.length === 1 ? '' : 's'}`); + return watchedFiles; + }); +} + +function filterAndRestart(files) { + if (!Array.isArray(files)) { + files = [files]; + } + + if (files.length) { + var cwd = process.cwd(); + if (this.options && this.options.cwd) { + cwd = this.options.cwd; + } + + utils.log.detail( + 'files triggering change check: ' + + files + .map(file => { + const res = path.relative(cwd, file); + return res; + }) + .join(', ') + ); + + // make sure the path is right and drop an empty + // filenames (sometimes on windows) + files = files.filter(Boolean).map(file => { + return path.relative(process.cwd(), path.relative(cwd, file)); + }); + + if (utils.isWindows) { + // ensure the drive letter is in uppercase (c:\foo -> C:\foo) + files = files.map(f => { + if (f.indexOf(':') === -1) { return f; } + return f[0].toUpperCase() + f.slice(1); + }); + } + + + debug('filterAndRestart on', files); + + var matched = match( + files, + config.options.monitor, + undefsafe(config, 'options.execOptions.ext') + ); + + debug('matched?', JSON.stringify(matched)); + + // if there's no matches, then test to see if the changed file is the + // running script, if so, let's allow a restart + if (config.options.execOptions && config.options.execOptions.script) { + const script = path.resolve(config.options.execOptions.script); + if (matched.result.length === 0 && script) { + const length = script.length; + files.find(file => { + if (file.substr(-length, length) === script) { + matched = { + result: [file], + total: 1, + }; + return true; + } + }); + } + } + + utils.log.detail( + 'changes after filters (before/after): ' + + [files.length, matched.result.length].join('/') + ); + + // reset the last check so we're only looking at recently modified files + config.lastStarted = Date.now(); + + if (matched.result.length) { + if (config.options.delay > 0) { + utils.log.detail('delaying restart for ' + config.options.delay + 'ms'); + if (debouncedBus === undefined) { + debouncedBus = debounce(restartBus, config.options.delay); + } + debouncedBus(matched); + } else { + return restartBus(matched); + } + } + } +} + +function restartBus(matched) { + utils.log.status('restarting due to changes...'); + matched.result.map(file => { + utils.log.detail(path.relative(process.cwd(), file)); + }); + + if (config.options.verbose) { + utils.log._log(''); + } + + bus.emit('restart', matched.result); +} + +function debounce(fn, delay) { + var timer = null; + return function () { + const context = this; + const args = arguments; + clearTimeout(timer); + timer = setTimeout(() =>fn.apply(context, args), delay); + }; +} diff --git a/project starter code/node_modules/nodemon/lib/nodemon.js b/project starter code/node_modules/nodemon/lib/nodemon.js new file mode 100644 index 00000000..278ea658 --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/nodemon.js @@ -0,0 +1,315 @@ +var debug = require('debug')('nodemon'); +var path = require('path'); +var monitor = require('./monitor'); +var cli = require('./cli'); +var version = require('./version'); +var util = require('util'); +var utils = require('./utils'); +var bus = utils.bus; +var help = require('./help'); +var config = require('./config'); +var spawn = require('./spawn'); +const defaults = require('./config/defaults') +var eventHandlers = {}; + +// this is fairly dirty, but theoretically sound since it's part of the +// stable module API +config.required = utils.isRequired; + +/** + * @param {NodemonSettings} settings + * @returns {Nodemon} + */ +function nodemon(settings) { + bus.emit('boot'); + nodemon.reset(); + + // allow the cli string as the argument to nodemon, and allow for + // `node nodemon -V app.js` or just `-V app.js` + if (typeof settings === 'string') { + settings = settings.trim(); + if (settings.indexOf('node') !== 0) { + if (settings.indexOf('nodemon') !== 0) { + settings = 'nodemon ' + settings; + } + settings = 'node ' + settings; + } + settings = cli.parse(settings); + } + + // set the debug flag as early as possible to get all the detailed logging + if (settings.verbose) { + utils.debug = true; + } + + if (settings.help) { + if (process.stdout.isTTY) { + process.stdout._handle.setBlocking(true); // nodejs/node#6456 + } + console.log(help(settings.help)); + if (!config.required) { + process.exit(0); + } + } + + if (settings.version) { + version().then(function (v) { + console.log(v); + if (!config.required) { + process.exit(0); + } + }); + return; + } + + // nodemon tools like grunt-nodemon. This affects where + // the script is being run from, and will affect where + // nodemon looks for the nodemon.json files + if (settings.cwd) { + // this is protection to make sure we haven't dont the chdir already... + // say like in cli/parse.js (which is where we do this once already!) + if (process.cwd() !== path.resolve(config.system.cwd, settings.cwd)) { + process.chdir(settings.cwd); + } + } + + const cwd = process.cwd(); + + config.load(settings, function (config) { + if (!config.options.dump && !config.options.execOptions.script && + config.options.execOptions.exec === 'node') { + if (!config.required) { + console.log(help('usage')); + process.exit(); + } + return; + } + + // before we print anything, update the colour setting on logging + utils.colours = config.options.colours; + + // always echo out the current version + utils.log.info(version.pinned); + + const cwd = process.cwd(); + + if (config.options.cwd) { + utils.log.detail('process root: ' + cwd); + } + + config.loaded.map(file => file.replace(cwd, '.')).forEach(file => { + utils.log.detail('reading config ' + file); + }); + + if (config.options.stdin && config.options.restartable) { + // allow nodemon to restart when the use types 'rs\n' + process.stdin.resume(); + process.stdin.setEncoding('utf8'); + process.stdin.on('data', data => { + const str = data.toString().trim().toLowerCase(); + + // if the keys entered match the restartable value, then restart! + if (str === config.options.restartable) { + bus.emit('restart'); + } else if (data.charCodeAt(0) === 12) { // ctrl+l + console.clear(); + } + }); + } else if (config.options.stdin) { + // so let's make sure we don't eat the key presses + // but also, since we're wrapping, watch out for + // special keys, like ctrl+c x 2 or '.exit' or ctrl+d or ctrl+l + var ctrlC = false; + var buffer = ''; + + process.stdin.on('data', function (data) { + data = data.toString(); + buffer += data; + const chr = data.charCodeAt(0); + + // if restartable, echo back + if (chr === 3) { + if (ctrlC) { + process.exit(0); + } + + ctrlC = true; + return; + } else if (buffer === '.exit' || chr === 4) { // ctrl+d + process.exit(); + } else if (chr === 13 || chr === 10) { // enter / carriage return + buffer = ''; + } else if (chr === 12) { // ctrl+l + console.clear(); + buffer = ''; + } + ctrlC = false; + }); + if (process.stdin.setRawMode) { + process.stdin.setRawMode(true); + } + } + + if (config.options.restartable) { + utils.log.info('to restart at any time, enter `' + + config.options.restartable + '`'); + } + + if (!config.required) { + const restartSignal = config.options.signal === 'SIGUSR2' ? 'SIGHUP' : 'SIGUSR2'; + process.on(restartSignal, nodemon.restart); + utils.bus.on('error', () => { + utils.log.fail((new Error().stack)); + }); + utils.log.detail((config.options.restartable ? 'or ' : '') + 'send ' + + restartSignal + ' to ' + process.pid + ' to restart'); + } + + const ignoring = config.options.monitor.map(function (rule) { + if (rule.slice(0, 1) !== '!') { + return false; + } + + rule = rule.slice(1); + + // don't notify of default ignores + if (defaults.ignoreRoot.indexOf(rule) !== -1) { + return false; + return rule.slice(3).slice(0, -3); + } + + if (rule.startsWith(cwd)) { + return rule.replace(cwd, '.'); + } + + return rule; + }).filter(Boolean).join(' '); + if (ignoring) utils.log.detail('ignoring: ' + ignoring); + + utils.log.info('watching path(s): ' + config.options.monitor.map(function (rule) { + if (rule.slice(0, 1) !== '!') { + try { + rule = path.relative(process.cwd(), rule); + } catch (e) {} + + return rule; + } + + return false; + }).filter(Boolean).join(' ')); + + utils.log.info('watching extensions: ' + (config.options.execOptions.ext || '(all)')); + + if (config.options.dump) { + utils.log._log('log', '--------------'); + utils.log._log('log', 'node: ' + process.version); + utils.log._log('log', 'nodemon: ' + version.pinned); + utils.log._log('log', 'command: ' + process.argv.join(' ')); + utils.log._log('log', 'cwd: ' + cwd); + utils.log._log('log', ['OS:', process.platform, process.arch].join(' ')); + utils.log._log('log', '--------------'); + utils.log._log('log', util.inspect(config, { depth: null })); + utils.log._log('log', '--------------'); + if (!config.required) { + process.exit(); + } + + return; + } + + config.run = true; + + if (config.options.stdout === false) { + nodemon.on('start', function () { + nodemon.stdout = bus.stdout; + nodemon.stderr = bus.stderr; + + bus.emit('readable'); + }); + } + + if (config.options.events && Object.keys(config.options.events).length) { + Object.keys(config.options.events).forEach(function (key) { + utils.log.detail('bind ' + key + ' -> `' + + config.options.events[key] + '`'); + nodemon.on(key, function () { + if (config.options && config.options.events) { + spawn(config.options.events[key], config, + [].slice.apply(arguments)); + } + }); + }); + } + + monitor.run(config.options); + + }); + + return nodemon; +} + +nodemon.restart = function () { + utils.log.status('restarting child process'); + bus.emit('restart'); + return nodemon; +}; + +nodemon.addListener = nodemon.on = function (event, handler) { + if (!eventHandlers[event]) { eventHandlers[event] = []; } + eventHandlers[event].push(handler); + bus.on(event, handler); + return nodemon; +}; + +nodemon.once = function (event, handler) { + if (!eventHandlers[event]) { eventHandlers[event] = []; } + eventHandlers[event].push(handler); + bus.once(event, function () { + debug('bus.once(%s)', event); + eventHandlers[event].splice(eventHandlers[event].indexOf(handler), 1); + handler.apply(this, arguments); + }); + return nodemon; +}; + +nodemon.emit = function () { + bus.emit.apply(bus, [].slice.call(arguments)); + return nodemon; +}; + +nodemon.removeAllListeners = function (event) { + // unbind only the `nodemon.on` event handlers + Object.keys(eventHandlers).filter(function (e) { + return event ? e === event : true; + }).forEach(function (event) { + eventHandlers[event].forEach(function (handler) { + bus.removeListener(event, handler); + eventHandlers[event].splice(eventHandlers[event].indexOf(handler), 1); + }); + }); + + return nodemon; +}; + +nodemon.reset = function (done) { + bus.emit('reset', done); +}; + +bus.on('reset', function (done) { + debug('reset'); + nodemon.removeAllListeners(); + monitor.run.kill(true, function () { + utils.reset(); + config.reset(); + config.run = false; + if (done) { + done(); + } + }); +}); + +// expose the full config +nodemon.config = config; + +module.exports = nodemon; + diff --git a/project starter code/node_modules/nodemon/lib/rules/add.js b/project starter code/node_modules/nodemon/lib/rules/add.js new file mode 100644 index 00000000..de85bb7f --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/rules/add.js @@ -0,0 +1,89 @@ +'use strict'; + +var utils = require('../utils'); + +// internal +var reEscComments = /\\#/g; +// note that '^^' is used in place of escaped comments +var reUnescapeComments = /\^\^/g; +var reComments = /#.*$/; +var reEscapeChars = /[.|\-[\]()\\]/g; +var reAsterisk = /\*/g; + +module.exports = add; + +/** + * Converts file patterns or regular expressions to nodemon + * compatible RegExp matching rules. Note: the `rules` argument + * object is modified to include the new rule and new RegExp + * + * ### Example: + * + * var rules = { watch: [], ignore: [] }; + * add(rules, 'watch', '*.js'); + * add(rules, 'ignore', '/public/'); + * add(rules, 'watch', ':(\d)*\.js'); // note: string based regexp + * add(rules, 'watch', /\d*\.js/); + * + * @param {Object} rules containing `watch` and `ignore`. Also updated during + * execution + * @param {String} which must be either "watch" or "ignore" + * @param {String|RegExp} the actual rule. + */ +function add(rules, which, rule) { + if (!{ ignore: 1, watch: 1}[which]) { + throw new Error('rules/index.js#add requires "ignore" or "watch" as the ' + + 'first argument'); + } + + if (Array.isArray(rule)) { + rule.forEach(function (rule) { + add(rules, which, rule); + }); + return; + } + + // support the rule being a RegExp, but reformat it to + // the custom : format that we're working with. + if (rule instanceof RegExp) { + // rule = ':' + rule.toString().replace(/^\/(.*?)\/$/g, '$1'); + utils.log.error('RegExp format no longer supported, but globs are.'); + return; + } + + // remove comments and trim lines + // this mess of replace methods is escaping "\#" to allow for emacs temp files + + // first up strip comments and remove blank head or tails + rule = (rule || '').replace(reEscComments, '^^') + .replace(reComments, '') + .replace(reUnescapeComments, '#').trim(); + + var regexp = false; + + if (typeof rule === 'string' && rule.substring(0, 1) === ':') { + rule = rule.substring(1); + utils.log.error('RegExp no longer supported: ' + rule); + regexp = true; + } else if (rule.length === 0) { + // blank line (or it was a comment) + return; + } + + if (regexp) { + // rules[which].push(rule); + } else { + // rule = rule.replace(reEscapeChars, '\\$&') + // .replace(reAsterisk, '.*'); + + rules[which].push(rule); + // compile a regexp of all the rules for this ignore or watch + var re = rules[which].map(function (rule) { + return rule.replace(reEscapeChars, '\\$&') + .replace(reAsterisk, '.*'); + }).join('|'); + + // used for the directory matching + rules[which].re = new RegExp(re); + } +} diff --git a/project starter code/node_modules/nodemon/lib/rules/index.js b/project starter code/node_modules/nodemon/lib/rules/index.js new file mode 100644 index 00000000..04aa92f8 --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/rules/index.js @@ -0,0 +1,53 @@ +'use strict'; +var utils = require('../utils'); +var add = require('./add'); +var parse = require('./parse'); + +// exported +var rules = { ignore: [], watch: [] }; + +/** + * Loads a nodemon config file and populates the ignore + * and watch rules with it's contents, and calls callback + * with the new rules + * + * @param {String} filename + * @param {Function} callback + */ +function load(filename, callback) { + parse(filename, function (err, result) { + if (err) { + // we should have bombed already, but + utils.log.error(err); + callback(err); + } + + if (result.raw) { + result.raw.forEach(add.bind(null, rules, 'ignore')); + } else { + result.ignore.forEach(add.bind(null, rules, 'ignore')); + result.watch.forEach(add.bind(null, rules, 'watch')); + } + + callback(null, rules); + }); +} + +module.exports = { + reset: function () { // just used for testing + rules.ignore.length = rules.watch.length = 0; + delete rules.ignore.re; + delete rules.watch.re; + }, + load: load, + ignore: { + test: add.bind(null, rules, 'ignore'), + add: add.bind(null, rules, 'ignore'), + }, + watch: { + test: add.bind(null, rules, 'watch'), + add: add.bind(null, rules, 'watch'), + }, + add: add.bind(null, rules), + rules: rules, +}; \ No newline at end of file diff --git a/project starter code/node_modules/nodemon/lib/rules/parse.js b/project starter code/node_modules/nodemon/lib/rules/parse.js new file mode 100644 index 00000000..6e1cacea --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/rules/parse.js @@ -0,0 +1,43 @@ +'use strict'; +var fs = require('fs'); + +/** + * Parse the nodemon config file, supporting both old style + * plain text config file, and JSON version of the config + * + * @param {String} filename + * @param {Function} callback + */ +function parse(filename, callback) { + var rules = { + ignore: [], + watch: [], + }; + + fs.readFile(filename, 'utf8', function (err, content) { + + if (err) { + return callback(err); + } + + var json = null; + try { + json = JSON.parse(content); + } catch (e) {} + + if (json !== null) { + rules = { + ignore: json.ignore || [], + watch: json.watch || [], + }; + + return callback(null, rules); + } + + // otherwise return the raw file + return callback(null, { raw: content.split(/\n/) }); + }); +} + +module.exports = parse; + diff --git a/project starter code/node_modules/nodemon/lib/spawn.js b/project starter code/node_modules/nodemon/lib/spawn.js new file mode 100644 index 00000000..256734a0 --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/spawn.js @@ -0,0 +1,74 @@ +const path = require('path'); +const utils = require('./utils'); +const merge = utils.merge; +const bus = utils.bus; +const spawn = require('child_process').spawn; + +module.exports = function spawnCommand(command, config, eventArgs) { + var stdio = ['pipe', 'pipe', 'pipe']; + + if (config.options.stdout) { + stdio = ['pipe', process.stdout, process.stderr]; + } + + const env = merge(process.env, { FILENAME: eventArgs[0] }); + + var sh = 'sh'; + var shFlag = '-c'; + var spawnOptions = { + env: merge(config.options.execOptions.env, env), + stdio: stdio, + }; + + if (!Array.isArray(command)) { + command = [command]; + } + + if (utils.isWindows) { + // if the exec includes a forward slash, reverse it for windows compat + // but *only* apply to the first command, and none of the arguments. + // ref #1251 and #1236 + command = command.map(executable => { + if (executable.indexOf('/') === -1) { + return executable; + } + + return executable.split(' ').map((e, i) => { + if (i === 0) { + return path.normalize(e); + } + return e; + }).join(' '); + }); + // taken from npm's cli: https://git.io/vNFD4 + sh = process.env.comspec || 'cmd'; + shFlag = '/d /s /c'; + spawnOptions.windowsVerbatimArguments = true; + spawnOptions.windowsHide = true; + } + + const args = command.join(' '); + const child = spawn(sh, [shFlag, args], spawnOptions); + + if (config.required) { + var emit = { + stdout: function (data) { + bus.emit('stdout', data); + }, + stderr: function (data) { + bus.emit('stderr', data); + }, + }; + + // now work out what to bind to... + if (config.options.stdout) { + child.on('stdout', emit.stdout).on('stderr', emit.stderr); + } else { + child.stdout.on('data', emit.stdout); + child.stderr.on('data', emit.stderr); + + bus.stdout = child.stdout; + bus.stderr = child.stderr; + } + } +}; diff --git a/project starter code/node_modules/nodemon/lib/utils/bus.js b/project starter code/node_modules/nodemon/lib/utils/bus.js new file mode 100644 index 00000000..4e120c58 --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/utils/bus.js @@ -0,0 +1,44 @@ +var events = require('events'); +var debug = require('debug')('nodemon'); +var util = require('util'); + +var Bus = function () { + events.EventEmitter.call(this); +}; + +util.inherits(Bus, events.EventEmitter); + +var bus = new Bus(); + +// /* +var collected = {}; +bus.on('newListener', function (event) { + debug('bus new listener: %s (%s)', event, bus.listeners(event).length); + if (!collected[event]) { + collected[event] = true; + bus.on(event, function () { + debug('bus emit: %s', event); + }); + } +}); + +// */ + +// proxy process messages (if forked) to the bus +process.on('message', function (event) { + debug('process.message(%s)', event); + bus.emit(event); +}); + +var emit = bus.emit; + +// if nodemon was spawned via a fork, allow upstream communication +// via process.send +if (process.send) { + bus.emit = function (event, data) { + process.send({ type: event, data: data }); + emit.apply(bus, arguments); + }; +} + +module.exports = bus; diff --git a/project starter code/node_modules/nodemon/lib/utils/clone.js b/project starter code/node_modules/nodemon/lib/utils/clone.js new file mode 100644 index 00000000..6ba6330f --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/utils/clone.js @@ -0,0 +1,40 @@ +module.exports = clone; + +// via http://stackoverflow.com/a/728694/22617 +function clone(obj) { + // Handle the 3 simple types, and null or undefined + if (null === obj || 'object' !== typeof obj) { + return obj; + } + + var copy; + + // Handle Date + if (obj instanceof Date) { + copy = new Date(); + copy.setTime(obj.getTime()); + return copy; + } + + // Handle Array + if (obj instanceof Array) { + copy = []; + for (var i = 0, len = obj.length; i < len; i++) { + copy[i] = clone(obj[i]); + } + return copy; + } + + // Handle Object + if (obj instanceof Object) { + copy = {}; + for (var attr in obj) { + if (obj.hasOwnProperty && obj.hasOwnProperty(attr)) { + copy[attr] = clone(obj[attr]); + } + } + return copy; + } + + throw new Error('Unable to copy obj! Its type isn\'t supported.'); +} \ No newline at end of file diff --git a/project starter code/node_modules/nodemon/lib/utils/colour.js b/project starter code/node_modules/nodemon/lib/utils/colour.js new file mode 100644 index 00000000..8c1b5905 --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/utils/colour.js @@ -0,0 +1,26 @@ +/** + * Encodes a string in a colour: red, yellow or green + * @param {String} c colour to highlight in + * @param {String} str the string to encode + * @return {String} coloured string for terminal printing + */ +function colour(c, str) { + return (colour[c] || colour.black) + str + colour.black; +} + +function strip(str) { + re.lastIndex = 0; // reset position + return str.replace(re, ''); +} + +colour.red = '\x1B[31m'; +colour.yellow = '\x1B[33m'; +colour.green = '\x1B[32m'; +colour.black = '\x1B[39m'; + +var reStr = Object.keys(colour).map(key => colour[key]).join('|'); +var re = new RegExp(('(' + reStr + ')').replace(/\[/g, '\\['), 'g'); + +colour.strip = strip; + +module.exports = colour; diff --git a/project starter code/node_modules/nodemon/lib/utils/index.js b/project starter code/node_modules/nodemon/lib/utils/index.js new file mode 100644 index 00000000..92651216 --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/utils/index.js @@ -0,0 +1,103 @@ +var noop = function () { }; +var path = require('path'); +const semver = require('semver'); +var version = process.versions.node.split('.') || [null, null, null]; + +var utils = (module.exports = { + semver: semver, + satisfies: test => semver.satisfies(process.versions.node, test), + version: { + major: parseInt(version[0] || 0, 10), + minor: parseInt(version[1] || 0, 10), + patch: parseInt(version[2] || 0, 10), + }, + clone: require('./clone'), + merge: require('./merge'), + bus: require('./bus'), + isWindows: process.platform === 'win32', + isMac: process.platform === 'darwin', + isLinux: process.platform === 'linux', + isIBMi: require('os').type() === 'OS400', + isRequired: (function () { + var p = module.parent; + while (p) { + // in electron.js engine it happens + if (!p.filename) { + return true; + } + if (p.filename.indexOf('bin' + path.sep + 'nodemon.js') !== -1) { + return false; + } + p = p.parent; + } + + return true; + })(), + home: process.env.HOME || process.env.HOMEPATH, + quiet: function () { + // nukes the logging + if (!this.debug) { + for (var method in utils.log) { + if (typeof utils.log[method] === 'function') { + utils.log[method] = noop; + } + } + } + }, + reset: function () { + if (!this.debug) { + for (var method in utils.log) { + if (typeof utils.log[method] === 'function') { + delete utils.log[method]; + } + } + } + this.debug = false; + }, + regexpToText: function (t) { + return t + .replace(/\.\*\\./g, '*.') + .replace(/\\{2}/g, '^^') + .replace(/\\/g, '') + .replace(/\^\^/g, '\\'); + }, + stringify: function (exec, args) { + // serializes an executable string and array of arguments into a string + args = args || []; + + return [exec] + .concat( + args.map(function (arg) { + // if an argument contains a space, we want to show it with quotes + // around it to indicate that it is a single argument + if (arg.length > 0 && arg.indexOf(' ') === -1) { + return arg; + } + // this should correctly escape nested quotes + return JSON.stringify(arg); + }) + ) + .join(' ') + .trim(); + }, +}); + +utils.log = require('./log')(utils.isRequired); + +Object.defineProperty(utils, 'debug', { + set: function (value) { + this.log.debug = value; + }, + get: function () { + return this.log.debug; + }, +}); + +Object.defineProperty(utils, 'colours', { + set: function (value) { + this.log.useColours = value; + }, + get: function () { + return this.log.useColours; + }, +}); diff --git a/project starter code/node_modules/nodemon/lib/utils/log.js b/project starter code/node_modules/nodemon/lib/utils/log.js new file mode 100644 index 00000000..65800872 --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/utils/log.js @@ -0,0 +1,82 @@ +var colour = require('./colour'); +var bus = require('./bus'); +var required = false; +var useColours = true; + +var coding = { + log: 'black', + info: 'yellow', + status: 'green', + detail: 'yellow', + fail: 'red', + error: 'red', +}; + +function log(type, text) { + var msg = '[nodemon] ' + (text || ''); + + if (useColours) { + msg = colour(coding[type], msg); + } + + // always push the message through our bus, using nextTick + // to help testing and get _out of_ promises. + process.nextTick(() => { + bus.emit('log', { type: type, message: text, colour: msg }); + }); + + // but if we're running on the command line, also echo out + // question: should we actually just consume our own events? + if (!required) { + if (type === 'error') { + console.error(msg); + } else { + console.log(msg || ''); + } + } +} + +var Logger = function (r) { + if (!(this instanceof Logger)) { + return new Logger(r); + } + this.required(r); + return this; +}; + +Object.keys(coding).forEach(function (type) { + Logger.prototype[type] = log.bind(null, type); +}); + +// detail is for messages that are turned on during debug +Logger.prototype.detail = function (msg) { + if (this.debug) { + log('detail', msg); + } +}; + +Logger.prototype.required = function (val) { + required = val; +}; + +Logger.prototype.debug = false; +Logger.prototype._log = function (type, msg) { + if (required) { + bus.emit('log', { type: type, message: msg || '', colour: msg || '' }); + } else if (type === 'error') { + console.error(msg); + } else { + console.log(msg || ''); + } +}; + +Object.defineProperty(Logger.prototype, 'useColours', { + set: function (val) { + useColours = val; + }, + get: function () { + return useColours; + }, +}); + +module.exports = Logger; diff --git a/project starter code/node_modules/nodemon/lib/utils/merge.js b/project starter code/node_modules/nodemon/lib/utils/merge.js new file mode 100644 index 00000000..1f3440bd --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/utils/merge.js @@ -0,0 +1,47 @@ +var clone = require('./clone'); + +module.exports = merge; + +function typesMatch(a, b) { + return (typeof a === typeof b) && (Array.isArray(a) === Array.isArray(b)); +} + +/** + * A deep merge of the source based on the target. + * @param {Object} source [description] + * @param {Object} target [description] + * @return {Object} [description] + */ +function merge(source, target, result) { + if (result === undefined) { + result = clone(source); + } + + // merge missing values from the target to the source + Object.getOwnPropertyNames(target).forEach(function (key) { + if (source[key] === undefined) { + result[key] = target[key]; + } + }); + + Object.getOwnPropertyNames(source).forEach(function (key) { + var value = source[key]; + + if (target[key] && typesMatch(value, target[key])) { + // merge empty values + if (value === '') { + result[key] = target[key]; + } + + if (Array.isArray(value)) { + if (value.length === 0 && target[key].length) { + result[key] = target[key].slice(0); + } + } else if (typeof value === 'object') { + result[key] = merge(value, target[key]); + } + } + }); + + return result; +} \ No newline at end of file diff --git a/project starter code/node_modules/nodemon/lib/version.js b/project starter code/node_modules/nodemon/lib/version.js new file mode 100644 index 00000000..d0f51044 --- /dev/null +++ b/project starter code/node_modules/nodemon/lib/version.js @@ -0,0 +1,100 @@ +module.exports = version; +module.exports.pin = pin; + +var fs = require('fs'); +var path = require('path'); +var exec = require('child_process').exec; +var root = null; + +function pin() { + return version().then(function (v) { + version.pinned = v; + }); +} + +function version(callback) { + // first find the package.json as this will be our root + var promise = findPackage(path.dirname(module.parent.filename)) + .then(function (dir) { + // now try to load the package + var v = require(path.resolve(dir, 'package.json')).version; + + if (v && v !== '0.0.0-development') { + return v; + } + + root = dir; + + // else we're in development, give the commit out + // get the last commit and whether the working dir is dirty + var promises = [ + branch().catch(function () { return 'master'; }), + commit().catch(function () { return ''; }), + dirty().catch(function () { return 0; }), + ]; + + // use the cached result as the export + return Promise.all(promises).then(function (res) { + var branch = res[0]; + var commit = res[1]; + var dirtyCount = parseInt(res[2], 10); + var curr = branch + ': ' + commit; + if (dirtyCount !== 0) { + curr += ' (' + dirtyCount + ' dirty files)'; + } + + return curr; + }); + }).catch(function (error) { + console.log(error.stack); + throw error; + }); + + if (callback) { + promise.then(function (res) { + callback(null, res); + }, callback); + } + + return promise; +} + +function findPackage(dir) { + if (dir === '/') { + return Promise.reject(new Error('package not found')); + } + return new Promise(function (resolve) { + fs.stat(path.resolve(dir, 'package.json'), function (error, exists) { + if (error || !exists) { + return resolve(findPackage(path.resolve(dir, '..'))); + } + + resolve(dir); + }); + }); +} + +function command(cmd) { + return new Promise(function (resolve, reject) { + exec(cmd, { cwd: root }, function (err, stdout, stderr) { + var error = stderr.trim(); + if (error) { + return reject(new Error(error)); + } + resolve(stdout.split('\n').join('')); + }); + }); +} + +function commit() { + return command('git rev-parse HEAD'); +} + +function branch() { + return command('git rev-parse --abbrev-ref HEAD'); +} + +function dirty() { + return command('expr $(git status --porcelain 2>/dev/null| ' + + 'egrep "^(M| M)" | wc -l)'); +} diff --git a/project starter code/node_modules/nodemon/node_modules/debug/LICENSE b/project starter code/node_modules/nodemon/node_modules/debug/LICENSE new file mode 100644 index 00000000..1a9820e2 --- /dev/null +++ b/project starter code/node_modules/nodemon/node_modules/debug/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk +Copyright (c) 2018-2021 Josh Junon + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the 'Software'), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/project starter code/node_modules/nodemon/node_modules/debug/README.md b/project starter code/node_modules/nodemon/node_modules/debug/README.md new file mode 100644 index 00000000..e9c3e047 --- /dev/null +++ b/project starter code/node_modules/nodemon/node_modules/debug/README.md @@ -0,0 +1,481 @@ +# debug +[![Build Status](https://travis-ci.org/debug-js/debug.svg?branch=master)](https://travis-ci.org/debug-js/debug) [![Coverage Status](https://coveralls.io/repos/github/debug-js/debug/badge.svg?branch=master)](https://coveralls.io/github/debug-js/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + + + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +screen shot 2017-08-08 at 12 53 04 pm +screen shot 2017-08-08 at 12 53 38 pm +screen shot 2017-08-08 at 12 53 25 pm + +#### Windows command prompt notes + +##### CMD + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Example: + +```cmd +set DEBUG=* & node app.js +``` + +##### PowerShell (VS Code default) + +PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Example: + +```cmd +$env:DEBUG='app';node app.js +``` + +Then, run the program to be debugged as usual. + +npm script example: +```js + "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", +``` + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + + + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + + + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + + + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + +In Chromium-based web browsers (e.g. Brave, Chrome, and Electron), the JavaScript console will—by default—only show messages logged by `debug` if the "Verbose" log level is _enabled_. + + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Extend +You can simply extend debugger +```js +const log = require('debug')('auth'); + +//creates new debug instance with extended namespace +const logSign = log.extend('sign'); +const logLogin = log.extend('login'); + +log('hello'); // auth hello +logSign('hello'); //auth:sign hello +logLogin('hello'); //auth:login hello +``` + +## Set dynamically + +You can also enable debug dynamically by calling the `enable()` method : + +```js +let debug = require('debug'); + +console.log(1, debug.enabled('test')); + +debug.enable('test'); +console.log(2, debug.enabled('test')); + +debug.disable(); +console.log(3, debug.enabled('test')); + +``` + +print : +``` +1 false +2 true +3 false +``` + +Usage : +`enable(namespaces)` +`namespaces` can include modes separated by a colon and wildcards. + +Note that calling `enable()` completely overrides previously set DEBUG variable : + +``` +$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' +=> false +``` + +`disable()` + +Will disable all namespaces. The functions returns the namespaces currently +enabled (and skipped). This can be useful if you want to disable debugging +temporarily without knowing what was enabled to begin with. + +For example: + +```js +let debug = require('debug'); +debug.enable('foo:*,-foo:bar'); +let namespaces = debug.disable(); +debug.enable(namespaces); +``` + +Note: There is no guarantee that the string will be identical to the initial +enable string, but semantically they will be identical. + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + +## Usage in child processes + +Due to the way `debug` detects if the output is a TTY or not, colors are not shown in child processes when `stderr` is piped. A solution is to pass the `DEBUG_COLORS=1` environment variable to the child process. +For example: + +```javascript +worker = fork(WORKER_WRAP_PATH, [workerPath], { + stdio: [ + /* stdin: */ 0, + /* stdout: */ 'pipe', + /* stderr: */ 'pipe', + 'ipc', + ], + env: Object.assign({}, process.env, { + DEBUG_COLORS: 1 // without this settings, colors won't be shown + }), +}); + +worker.stderr.pipe(process.stderr, { end: false }); +``` + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + - Josh Junon + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> +Copyright (c) 2018-2021 Josh Junon + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/project starter code/node_modules/nodemon/node_modules/debug/package.json b/project starter code/node_modules/nodemon/node_modules/debug/package.json new file mode 100644 index 00000000..3bcdc242 --- /dev/null +++ b/project starter code/node_modules/nodemon/node_modules/debug/package.json @@ -0,0 +1,59 @@ +{ + "name": "debug", + "version": "4.3.4", + "repository": { + "type": "git", + "url": "git://github.com/debug-js/debug.git" + }, + "description": "Lightweight debugging utility for Node.js and the browser", + "keywords": [ + "debug", + "log", + "debugger" + ], + "files": [ + "src", + "LICENSE", + "README.md" + ], + "author": "Josh Junon ", + "contributors": [ + "TJ Holowaychuk ", + "Nathan Rajlich (http://n8.io)", + "Andrew Rhyne " + ], + "license": "MIT", + "scripts": { + "lint": "xo", + "test": "npm run test:node && npm run test:browser && npm run lint", + "test:node": "istanbul cover _mocha -- test.js", + "test:browser": "karma start --single-run", + "test:coverage": "cat ./coverage/lcov.info | coveralls" + }, + "dependencies": { + "ms": "2.1.2" + }, + "devDependencies": { + "brfs": "^2.0.1", + "browserify": "^16.2.3", + "coveralls": "^3.0.2", + "istanbul": "^0.4.5", + "karma": "^3.1.4", + "karma-browserify": "^6.0.0", + "karma-chrome-launcher": "^2.2.0", + "karma-mocha": "^1.3.0", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "xo": "^0.23.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + }, + "main": "./src/index.js", + "browser": "./src/browser.js", + "engines": { + "node": ">=6.0" + } +} diff --git a/project starter code/node_modules/nodemon/node_modules/debug/src/browser.js b/project starter code/node_modules/nodemon/node_modules/debug/src/browser.js new file mode 100644 index 00000000..cd0fc35d --- /dev/null +++ b/project starter code/node_modules/nodemon/node_modules/debug/src/browser.js @@ -0,0 +1,269 @@ +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ +exports.log = console.debug || console.log || (() => {}); + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; diff --git a/project starter code/node_modules/nodemon/node_modules/debug/src/common.js b/project starter code/node_modules/nodemon/node_modules/debug/src/common.js new file mode 100644 index 00000000..e3291b20 --- /dev/null +++ b/project starter code/node_modules/nodemon/node_modules/debug/src/common.js @@ -0,0 +1,274 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + createDebug.destroy = destroy; + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + + return enabledCache; + }, + set: v => { + enableOverride = v; + } + }); + + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + return debug; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; diff --git a/project starter code/node_modules/nodemon/node_modules/debug/src/index.js b/project starter code/node_modules/nodemon/node_modules/debug/src/index.js new file mode 100644 index 00000000..bf4c57f2 --- /dev/null +++ b/project starter code/node_modules/nodemon/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} diff --git a/project starter code/node_modules/nodemon/node_modules/debug/src/node.js b/project starter code/node_modules/nodemon/node_modules/debug/src/node.js new file mode 100644 index 00000000..79bc085c --- /dev/null +++ b/project starter code/node_modules/nodemon/node_modules/debug/src/node.js @@ -0,0 +1,263 @@ +/** + * Module dependencies. + */ + +const tty = require('tty'); +const util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = require('supports-color'); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(str => str.trim()) + .join(' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; diff --git a/project starter code/node_modules/nodemon/node_modules/ms/index.js b/project starter code/node_modules/nodemon/node_modules/ms/index.js new file mode 100644 index 00000000..c4498bcc --- /dev/null +++ b/project starter code/node_modules/nodemon/node_modules/ms/index.js @@ -0,0 +1,162 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} diff --git a/project starter code/node_modules/nodemon/node_modules/ms/license.md b/project starter code/node_modules/nodemon/node_modules/ms/license.md new file mode 100644 index 00000000..69b61253 --- /dev/null +++ b/project starter code/node_modules/nodemon/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Zeit, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/project starter code/node_modules/nodemon/node_modules/ms/package.json b/project starter code/node_modules/nodemon/node_modules/ms/package.json new file mode 100644 index 00000000..eea666e1 --- /dev/null +++ b/project starter code/node_modules/nodemon/node_modules/ms/package.json @@ -0,0 +1,37 @@ +{ + "name": "ms", + "version": "2.1.2", + "description": "Tiny millisecond conversion utility", + "repository": "zeit/ms", + "main": "./index", + "files": [ + "index.js" + ], + "scripts": { + "precommit": "lint-staged", + "lint": "eslint lib/* bin/*", + "test": "mocha tests.js" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "license": "MIT", + "devDependencies": { + "eslint": "4.12.1", + "expect.js": "0.3.1", + "husky": "0.14.3", + "lint-staged": "5.0.0", + "mocha": "4.0.1" + } +} diff --git a/project starter code/node_modules/nodemon/node_modules/ms/readme.md b/project starter code/node_modules/nodemon/node_modules/ms/readme.md new file mode 100644 index 00000000..9a1996b1 --- /dev/null +++ b/project starter code/node_modules/nodemon/node_modules/ms/readme.md @@ -0,0 +1,60 @@ +# ms + +[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms) +[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +ms('-3 days') // -259200000 +ms('-1h') // -3600000 +ms('-200') // -200 +``` + +### Convert from Milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(-3 * 60000) // "-3m" +ms(ms('10 hours')) // "10h" +``` + +### Time Format Written-Out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(-3 * 60000, { long: true }) // "-3 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [Node.js](https://nodejs.org) and in the browser +- If a number is supplied to `ms`, a string with a unit is returned +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) +- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned + +## Related Packages + +- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. + +## Caught a Bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/project starter code/node_modules/nodemon/package.json b/project starter code/node_modules/nodemon/package.json new file mode 100644 index 00000000..1e58ccbf --- /dev/null +++ b/project starter code/node_modules/nodemon/package.json @@ -0,0 +1,75 @@ +{ + "name": "nodemon", + "homepage": "https://nodemon.io", + "author": { + "name": "Remy Sharp", + "url": "https://github.com/remy" + }, + "bin": { + "nodemon": "./bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "repository": { + "type": "git", + "url": "https://github.com/remy/nodemon.git" + }, + "description": "Simple monitor script for use during development of a Node.js app.", + "keywords": [ + "cli", + "monitor", + "monitor", + "development", + "restart", + "autoload", + "reload", + "terminal" + ], + "license": "MIT", + "types": "./index.d.ts", + "main": "./lib/nodemon", + "scripts": { + "commitmsg": "commitlint -e", + "coverage": "istanbul cover _mocha -- --timeout 30000 --ui bdd --reporter list test/**/*.test.js", + "lint": "eslint lib/**/*.js", + "test": "npm run lint && npm run spec", + "spec": "for FILE in test/**/*.test.js; do echo $FILE; TEST=1 mocha --exit --timeout 30000 $FILE; if [ $? -ne 0 ]; then exit 1; fi; sleep 1; done", + "postspec": "npm run clean", + "clean": "rm -rf test/fixtures/test*.js test/fixtures/test*.md", + "web": "node web", + "semantic-release": "semantic-release", + "prepush": "npm run lint", + "killall": "ps auxww | grep node | grep -v grep | awk '{ print $2 }' | xargs kill -9" + }, + "devDependencies": { + "@commitlint/cli": "^11.0.0", + "@commitlint/config-conventional": "^11.0.0", + "async": "1.4.2", + "coffee-script": "~1.7.1", + "eslint": "^7.32.0", + "husky": "^7.0.4", + "mocha": "^2.5.3", + "nyc": "^15.1.0", + "proxyquire": "^1.8.0", + "semantic-release": "^18.0.0", + "should": "~4.0.0" + }, + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.1.2", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "version": "3.1.1", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } +} diff --git a/project starter code/node_modules/normalize-path/LICENSE b/project starter code/node_modules/normalize-path/LICENSE new file mode 100644 index 00000000..d32ab442 --- /dev/null +++ b/project starter code/node_modules/normalize-path/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2018, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/project starter code/node_modules/normalize-path/README.md b/project starter code/node_modules/normalize-path/README.md new file mode 100644 index 00000000..726d4d68 --- /dev/null +++ b/project starter code/node_modules/normalize-path/README.md @@ -0,0 +1,127 @@ +# normalize-path [![NPM version](https://img.shields.io/npm/v/normalize-path.svg?style=flat)](https://www.npmjs.com/package/normalize-path) [![NPM monthly downloads](https://img.shields.io/npm/dm/normalize-path.svg?style=flat)](https://npmjs.org/package/normalize-path) [![NPM total downloads](https://img.shields.io/npm/dt/normalize-path.svg?style=flat)](https://npmjs.org/package/normalize-path) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/normalize-path.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/normalize-path) + +> Normalize slashes in a file path to be posix/unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes, unless disabled. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save normalize-path +``` + +## Usage + +```js +const normalize = require('normalize-path'); + +console.log(normalize('\\foo\\bar\\baz\\')); +//=> '/foo/bar/baz' +``` + +**win32 namespaces** + +```js +console.log(normalize('\\\\?\\UNC\\Server01\\user\\docs\\Letter.txt')); +//=> '//?/UNC/Server01/user/docs/Letter.txt' + +console.log(normalize('\\\\.\\CdRomX')); +//=> '//./CdRomX' +``` + +**Consecutive slashes** + +Condenses multiple consecutive forward slashes (except for leading slashes in win32 namespaces) to a single slash. + +```js +console.log(normalize('.//foo//bar///////baz/')); +//=> './foo/bar/baz' +``` + +### Trailing slashes + +By default trailing slashes are removed. Pass `false` as the last argument to disable this behavior and _**keep** trailing slashes_: + +```js +console.log(normalize('foo\\bar\\baz\\', false)); //=> 'foo/bar/baz/' +console.log(normalize('./foo/bar/baz/', false)); //=> './foo/bar/baz/' +``` + +## Release history + +### v3.0 + +No breaking changes in this release. + +* a check was added to ensure that [win32 namespaces](https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces) are handled properly by win32 `path.parse()` after a path has been normalized by this library. +* a minor optimization was made to simplify how the trailing separator was handled + +## About + +
+Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
+ +
+Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
+ +
+Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
+ +### Related projects + +Other useful path-related libraries: + +* [contains-path](https://www.npmjs.com/package/contains-path): Return true if a file path contains the given path. | [homepage](https://github.com/jonschlinkert/contains-path "Return true if a file path contains the given path.") +* [is-absolute](https://www.npmjs.com/package/is-absolute): Returns true if a file path is absolute. Does not rely on the path module… [more](https://github.com/jonschlinkert/is-absolute) | [homepage](https://github.com/jonschlinkert/is-absolute "Returns true if a file path is absolute. Does not rely on the path module and can be used as a polyfill for node.js native `path.isAbolute`.") +* [is-relative](https://www.npmjs.com/package/is-relative): Returns `true` if the path appears to be relative. | [homepage](https://github.com/jonschlinkert/is-relative "Returns `true` if the path appears to be relative.") +* [parse-filepath](https://www.npmjs.com/package/parse-filepath): Pollyfill for node.js `path.parse`, parses a filepath into an object. | [homepage](https://github.com/jonschlinkert/parse-filepath "Pollyfill for node.js `path.parse`, parses a filepath into an object.") +* [path-ends-with](https://www.npmjs.com/package/path-ends-with): Return `true` if a file path ends with the given string/suffix. | [homepage](https://github.com/jonschlinkert/path-ends-with "Return `true` if a file path ends with the given string/suffix.") +* [unixify](https://www.npmjs.com/package/unixify): Convert Windows file paths to unix paths. | [homepage](https://github.com/jonschlinkert/unixify "Convert Windows file paths to unix paths.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 35 | [jonschlinkert](https://github.com/jonschlinkert) | +| 1 | [phated](https://github.com/phated) | + +### Author + +**Jon Schlinkert** + +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on April 19, 2018._ \ No newline at end of file diff --git a/project starter code/node_modules/normalize-path/index.js b/project starter code/node_modules/normalize-path/index.js new file mode 100644 index 00000000..6fac553a --- /dev/null +++ b/project starter code/node_modules/normalize-path/index.js @@ -0,0 +1,35 @@ +/*! + * normalize-path + * + * Copyright (c) 2014-2018, Jon Schlinkert. + * Released under the MIT License. + */ + +module.exports = function(path, stripTrailing) { + if (typeof path !== 'string') { + throw new TypeError('expected path to be a string'); + } + + if (path === '\\' || path === '/') return '/'; + + var len = path.length; + if (len <= 1) return path; + + // ensure that win32 namespaces has two leading slashes, so that the path is + // handled properly by the win32 version of path.parse() after being normalized + // https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces + var prefix = ''; + if (len > 4 && path[3] === '\\') { + var ch = path[2]; + if ((ch === '?' || ch === '.') && path.slice(0, 2) === '\\\\') { + path = path.slice(2); + prefix = '//'; + } + } + + var segs = path.split(/[/\\]+/); + if (stripTrailing !== false && segs[segs.length - 1] === '') { + segs.pop(); + } + return prefix + segs.join('/'); +}; diff --git a/project starter code/node_modules/normalize-path/package.json b/project starter code/node_modules/normalize-path/package.json new file mode 100644 index 00000000..ad61098a --- /dev/null +++ b/project starter code/node_modules/normalize-path/package.json @@ -0,0 +1,77 @@ +{ + "name": "normalize-path", + "description": "Normalize slashes in a file path to be posix/unix-like forward slashes. Also condenses repeat slashes to a single slash and removes and trailing slashes, unless disabled.", + "version": "3.0.0", + "homepage": "https://github.com/jonschlinkert/normalize-path", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "Blaine Bublitz (https://twitter.com/BlaineBublitz)", + "Jon Schlinkert (http://twitter.com/jonschlinkert)" + ], + "repository": "jonschlinkert/normalize-path", + "bugs": { + "url": "https://github.com/jonschlinkert/normalize-path/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "devDependencies": { + "gulp-format-md": "^1.0.0", + "minimist": "^1.2.0", + "mocha": "^3.5.3" + }, + "keywords": [ + "absolute", + "backslash", + "delimiter", + "file", + "file-path", + "filepath", + "fix", + "forward", + "fp", + "fs", + "normalize", + "path", + "relative", + "separator", + "slash", + "slashes", + "trailing", + "unix", + "urix" + ], + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "description": "Other useful path-related libraries:", + "list": [ + "contains-path", + "is-absolute", + "is-relative", + "parse-filepath", + "path-ends-with", + "path-ends-with", + "unixify" + ] + }, + "lint": { + "reflinks": true + } + } +} diff --git a/project starter code/node_modules/object-inspect/CHANGELOG.md b/project starter code/node_modules/object-inspect/CHANGELOG.md index 36d19581..c5772b4c 100644 --- a/project starter code/node_modules/object-inspect/CHANGELOG.md +++ b/project starter code/node_modules/object-inspect/CHANGELOG.md @@ -5,6 +5,35 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v1.13.1](https://github.com/inspect-js/object-inspect/compare/v1.13.0...v1.13.1) - 2023-10-19 + +### Commits + +- [Fix] in IE 8, global can !== window despite them being prototypes of each other [`30d0859`](https://github.com/inspect-js/object-inspect/commit/30d0859dc4606cf75c2410edcd5d5c6355f8d372) + +## [v1.13.0](https://github.com/inspect-js/object-inspect/compare/v1.12.3...v1.13.0) - 2023-10-14 + +### Commits + +- [New] add special handling for the global object [`431bab2`](https://github.com/inspect-js/object-inspect/commit/431bab21a490ee51d35395966a504501e8c685da) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`fd4f619`](https://github.com/inspect-js/object-inspect/commit/fd4f6193562b4b0e95dcf5c0201b4e8cbbc4f58d) +- [Dev Deps] update `mock-property`, `tape` [`b453f6c`](https://github.com/inspect-js/object-inspect/commit/b453f6ceeebf8a1b738a1029754092e0367a4134) +- [Dev Deps] update `error-cause` [`e8ffc57`](https://github.com/inspect-js/object-inspect/commit/e8ffc577d73b92bb6a4b00c44f14e3319e374888) +- [Dev Deps] update `tape` [`054b8b9`](https://github.com/inspect-js/object-inspect/commit/054b8b9b98633284cf989e582450ebfbbe53503c) +- [Dev Deps] temporarily remove `aud` due to breaking change in transitive deps [`2476845`](https://github.com/inspect-js/object-inspect/commit/2476845e0678dd290c541c81cd3dec8420782c52) +- [Dev Deps] pin `glob`, since v10.3.8+ requires a broken `jackspeak` [`383fa5e`](https://github.com/inspect-js/object-inspect/commit/383fa5eebc0afd705cc778a4b49d8e26452e49a8) +- [Dev Deps] pin `jackspeak` since 2.1.2+ depends on npm aliases, which kill the install process in npm < 6 [`68c244c`](https://github.com/inspect-js/object-inspect/commit/68c244c5174cdd877e5dcb8ee90aa3f44b2f25be) + +## [v1.12.3](https://github.com/inspect-js/object-inspect/compare/v1.12.2...v1.12.3) - 2023-01-12 + +### Commits + +- [Fix] in eg FF 24, collections lack forEach [`75fc226`](https://github.com/inspect-js/object-inspect/commit/75fc22673c82d45f28322b1946bb0eb41b672b7f) +- [actions] update rebase action to use reusable workflow [`250a277`](https://github.com/inspect-js/object-inspect/commit/250a277a095e9dacc029ab8454dcfc15de549dcd) +- [Dev Deps] update `aud`, `es-value-fixtures`, `tape` [`66a19b3`](https://github.com/inspect-js/object-inspect/commit/66a19b3209ccc3c5ef4b34c3cb0160e65d1ce9d5) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `error-cause` [`c43d332`](https://github.com/inspect-js/object-inspect/commit/c43d3324b48384a16fd3dc444e5fc589d785bef3) +- [Tests] add `@pkgjs/support` to `postlint` [`e2618d2`](https://github.com/inspect-js/object-inspect/commit/e2618d22a7a3fa361b6629b53c1752fddc9c4d80) + ## [v1.12.2](https://github.com/inspect-js/object-inspect/compare/v1.12.1...v1.12.2) - 2022-05-26 ### Commits diff --git a/project starter code/node_modules/object-inspect/index.js b/project starter code/node_modules/object-inspect/index.js index 7ab98a68..ff203349 100644 --- a/project starter code/node_modules/object-inspect/index.js +++ b/project starter code/node_modules/object-inspect/index.js @@ -202,16 +202,20 @@ module.exports = function inspect_(obj, options, depth, seen) { } if (isMap(obj)) { var mapParts = []; - mapForEach.call(obj, function (value, key) { - mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj)); - }); + if (mapForEach) { + mapForEach.call(obj, function (value, key) { + mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj)); + }); + } return collectionOf('Map', mapSize.call(obj), mapParts, indent); } if (isSet(obj)) { var setParts = []; - setForEach.call(obj, function (value) { - setParts.push(inspect(value, obj)); - }); + if (setForEach) { + setForEach.call(obj, function (value) { + setParts.push(inspect(value, obj)); + }); + } return collectionOf('Set', setSize.call(obj), setParts, indent); } if (isWeakMap(obj)) { @@ -235,6 +239,14 @@ module.exports = function inspect_(obj, options, depth, seen) { if (isString(obj)) { return markBoxed(inspect(String(obj))); } + // note: in IE 8, sometimes `global !== window` but both are the prototypes of each other + /* eslint-env browser */ + if (typeof window !== 'undefined' && obj === window) { + return '{ [object Window] }'; + } + if (obj === global) { + return '{ [object globalThis] }'; + } if (!isDate(obj) && !isRegExp(obj)) { var ys = arrObjKeys(obj, inspect); var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object; diff --git a/project starter code/node_modules/object-inspect/package.json b/project starter code/node_modules/object-inspect/package.json index 7e0b87c7..02de342e 100644 --- a/project starter code/node_modules/object-inspect/package.json +++ b/project starter code/node_modules/object-inspect/package.json @@ -1,34 +1,39 @@ { "name": "object-inspect", - "version": "1.12.2", + "version": "1.13.1", "description": "string representations of objects in node and the browser", "main": "index.js", "sideEffects": false, "devDependencies": { - "@ljharb/eslint-config": "^21.0.0", - "aud": "^2.0.0", + "@ljharb/eslint-config": "^21.1.0", + "@pkgjs/support": "^0.0.6", "auto-changelog": "^2.4.0", "core-js": "^2.6.12", - "error-cause": "^1.0.4", - "es-value-fixtures": "^1.4.1", + "error-cause": "^1.0.6", + "es-value-fixtures": "^1.4.2", "eslint": "=8.8.0", "for-each": "^0.3.3", "functions-have-names": "^1.2.3", + "glob": "=10.3.7", + "globalthis": "^1.0.3", "has-tostringtag": "^1.0.0", + "in-publish": "^2.0.1", + "jackspeak": "=2.1.1", "make-arrow-function": "^1.2.0", - "mock-property": "^1.0.0", + "mock-property": "^1.0.2", "npmignore": "^0.3.0", "nyc": "^10.3.2", "safe-publish-latest": "^2.0.0", "string.prototype.repeat": "^1.0.0", - "tape": "^5.5.3" + "tape": "^5.7.1" }, "scripts": { "prepack": "npmignore --auto --commentLines=autogenerated", "prepublish": "not-in-publish || npm run prepublishOnly", "prepublishOnly": "safe-publish-latest", "pretest": "npm run lint", - "lint": "eslint .", + "lint": "eslint --ext=js,mjs .", + "postlint": "npx @pkgjs/support validate", "test": "npm run tests-only && npm run test:corejs", "tests-only": "nyc tape 'test/*.js'", "test:corejs": "nyc tape test-core-js.js 'test/*.js'", diff --git a/project starter code/node_modules/object-inspect/test/global.js b/project starter code/node_modules/object-inspect/test/global.js new file mode 100644 index 00000000..c57216ae --- /dev/null +++ b/project starter code/node_modules/object-inspect/test/global.js @@ -0,0 +1,17 @@ +'use strict'; + +var inspect = require('../'); + +var test = require('tape'); +var globalThis = require('globalthis')(); + +test('global object', function (t) { + /* eslint-env browser */ + var expected = typeof window === 'undefined' ? 'globalThis' : 'Window'; + t.equal( + inspect([globalThis]), + '[ { [object ' + expected + '] } ]' + ); + + t.end(); +}); diff --git a/project starter code/node_modules/parse-bmfont-xml/lib/parse-attribs.js b/project starter code/node_modules/parse-bmfont-xml/lib/parse-attribs.js index 0e72ffa1..1dfba3b6 100644 --- a/project starter code/node_modules/parse-bmfont-xml/lib/parse-attribs.js +++ b/project starter code/node_modules/parse-bmfont-xml/lib/parse-attribs.js @@ -5,6 +5,7 @@ var GLYPH_DESIGNER_ERROR = 'chasrset' module.exports = function parseAttributes(obj) { + obj = Object.assign({}, obj) if (GLYPH_DESIGNER_ERROR in obj) { obj['charset'] = obj[GLYPH_DESIGNER_ERROR] delete obj[GLYPH_DESIGNER_ERROR] diff --git a/project starter code/node_modules/parse-bmfont-xml/package.json b/project starter code/node_modules/parse-bmfont-xml/package.json index 98c05e66..2668e900 100644 --- a/project starter code/node_modules/parse-bmfont-xml/package.json +++ b/project starter code/node_modules/parse-bmfont-xml/package.json @@ -1,6 +1,6 @@ { "name": "parse-bmfont-xml", - "version": "1.1.4", + "version": "1.1.6", "description": "parses XML BMFont files into a JavaScript object", "main": "lib/index.js", "browser": "lib/browser.js", @@ -12,7 +12,7 @@ }, "dependencies": { "xml-parse-from-string": "^1.0.0", - "xml2js": "^0.4.5" + "xml2js": "^0.5.0" }, "devDependencies": { "brfs": "^1.4.0", diff --git a/project starter code/node_modules/peek-readable/LICENSE b/project starter code/node_modules/peek-readable/LICENSE new file mode 100644 index 00000000..9ba5f032 --- /dev/null +++ b/project starter code/node_modules/peek-readable/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2010-2017 Borewit + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/project starter code/node_modules/peek-readable/README.md b/project starter code/node_modules/peek-readable/README.md new file mode 100644 index 00000000..72221e1e --- /dev/null +++ b/project starter code/node_modules/peek-readable/README.md @@ -0,0 +1,93 @@ +![Node.js CI](https://github.com/Borewit/peek-readable/workflows/Node.js%20CI/badge.svg) +[![NPM version](https://badge.fury.io/js/peek-readable.svg)](https://npmjs.org/package/peek-readable) +[![npm downloads](http://img.shields.io/npm/dm/peek-readable.svg)](https://npmcharts.com/compare/peek-readable?start=600&interval=30) +[![Coverage Status](https://coveralls.io/repos/github/Borewit/peek-readable/badge.svg?branch=master)](https://coveralls.io/github/Borewit/peek-readable?branch=master) +[![Codacy Badge](https://app.codacy.com/project/badge/Grade/d4b511481b3a4634b6ca5c0724407eb9)](https://www.codacy.com/gh/Borewit/peek-readable/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Borewit/peek-readable&utm_campaign=Badge_Grade) +[![Total alerts](https://img.shields.io/lgtm/alerts/g/Borewit/peek-readable.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Borewit/peek-readable/alerts/) +[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/Borewit/peek-readable.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Borewit/peek-readable/context:javascript) +[![Known Vulnerabilities](https://snyk.io/test/github/Borewit/peek-readable/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Borewit/peek-readable?targetFile=package.json) + +# peek-readable + +A promise based asynchronous stream reader, which makes reading from a stream easy. + +Allows to read and peek from a [Readable Stream](https://nodejs.org/api/stream.html#stream_readable_streams) + +Note that [peek-readable](https://github.com/Borewit/peek-readable) was formally released as [then-read-stream](https://github.com/Borewit/peek-readable). + +## Usage + +### Installation + +```shell script +npm install --save peek-readable +``` + +The `peek-readable` contains one class: `StreamReader`, which reads from a [stream.Readable](https://nodejs.org/api/stream.html#stream_class_stream_readable). + +### Compatibility + +NPM module is compliant with [ECMAScript 2018 (ES9)](https://en.wikipedia.org/wiki/ECMAScript#9th_Edition_%E2%80%93_ECMAScript_2018). + +## Examples + +In the following example we read the first 16 bytes from a stream and store them in our buffer. +Source code of examples can be found [here](test/examples.ts). + +```js +const fs = require('fs'); +const { StreamReader } = require('peek-readable'); + +(async () => { + const readable = fs.createReadStream('JPEG_example_JPG_RIP_001.jpg'); + const streamReader = new StreamReader(readable); + const uint8Array = new Uint8Array(16); + const bytesRead = await streamReader.read(uint8Array, 0, 16);; + // buffer contains 16 bytes, if the end-of-stream has not been reached +})(); +``` + +End-of-stream detection: +```js +(async () => { + + const fileReadStream = fs.createReadStream('JPEG_example_JPG_RIP_001.jpg'); + const streamReader = new StreamReader(fileReadStream); + const buffer = Buffer.alloc(16); // or use: new Uint8Array(16); + + try { + await streamReader.read(buffer, 0, 16); + // buffer contains 16 bytes, if the end-of-stream has not been reached + } catch(error) { + if (error instanceof EndOfStreamError) { + console.log('End-of-stream reached'); + } + } +})(); +``` + +With peek you can read ahead: +```js +const fs = require('fs'); +const { StreamReader } = require('peek-readable'); + +const fileReadStream = fs.createReadStream('JPEG_example_JPG_RIP_001.jpg'); +const streamReader = new StreamReader(fileReadStream); +const buffer = Buffer.alloc(20); + +(async () => { + let bytesRead = await streamReader.peek(buffer, 0, 3); + if (bytesRead === 3 && buffer[0] === 0xFF && buffer[1] === 0xD8 && buffer[2] === 0xFF) { + console.log('This is a JPEG file'); + } else { + throw Error('Expected a JPEG file'); + } + + bytesRead = await streamReader.read(buffer, 0, 20); // Read JPEG header + if (bytesRead === 20) { + console.log('Got the JPEG header'); + } else { + throw Error('Failed to read JPEG header'); + } +})(); +``` diff --git a/project starter code/node_modules/peek-readable/lib/Deferred.d.ts b/project starter code/node_modules/peek-readable/lib/Deferred.d.ts new file mode 100644 index 00000000..b7294492 --- /dev/null +++ b/project starter code/node_modules/peek-readable/lib/Deferred.d.ts @@ -0,0 +1,6 @@ +export declare class Deferred { + promise: Promise; + resolve: (value: T) => void; + reject: (reason: any) => void; + constructor(); +} diff --git a/project starter code/node_modules/peek-readable/lib/Deferred.js b/project starter code/node_modules/peek-readable/lib/Deferred.js new file mode 100644 index 00000000..84c42b31 --- /dev/null +++ b/project starter code/node_modules/peek-readable/lib/Deferred.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Deferred = void 0; +class Deferred { + constructor() { + this.resolve = () => null; + this.reject = () => null; + this.promise = new Promise((resolve, reject) => { + this.reject = reject; + this.resolve = resolve; + }); + } +} +exports.Deferred = Deferred; diff --git a/project starter code/node_modules/peek-readable/lib/EndOfFileStream.d.ts b/project starter code/node_modules/peek-readable/lib/EndOfFileStream.d.ts new file mode 100644 index 00000000..1081cb06 --- /dev/null +++ b/project starter code/node_modules/peek-readable/lib/EndOfFileStream.d.ts @@ -0,0 +1,7 @@ +export declare const defaultMessages = "End-Of-Stream"; +/** + * Thrown on read operation of the end of file or stream has been reached + */ +export declare class EndOfStreamError extends Error { + constructor(); +} diff --git a/project starter code/node_modules/peek-readable/lib/EndOfFileStream.js b/project starter code/node_modules/peek-readable/lib/EndOfFileStream.js new file mode 100644 index 00000000..6ae832ed --- /dev/null +++ b/project starter code/node_modules/peek-readable/lib/EndOfFileStream.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.EndOfStreamError = exports.defaultMessages = void 0; +exports.defaultMessages = 'End-Of-Stream'; +/** + * Thrown on read operation of the end of file or stream has been reached + */ +class EndOfStreamError extends Error { + constructor() { + super(exports.defaultMessages); + } +} +exports.EndOfStreamError = EndOfStreamError; diff --git a/project starter code/node_modules/peek-readable/lib/StreamReader.d.ts b/project starter code/node_modules/peek-readable/lib/StreamReader.d.ts new file mode 100644 index 00000000..114c9689 --- /dev/null +++ b/project starter code/node_modules/peek-readable/lib/StreamReader.d.ts @@ -0,0 +1,47 @@ +/// +import { Readable } from 'stream'; +export { EndOfStreamError } from './EndOfFileStream'; +export declare class StreamReader { + private s; + /** + * Deferred used for postponed read request (as not data is yet available to read) + */ + private deferred; + private endOfStream; + /** + * Store peeked data + * @type {Array} + */ + private peekQueue; + constructor(s: Readable); + /** + * Read ahead (peek) from stream. Subsequent read or peeks will return the same data + * @param uint8Array - Uint8Array (or Buffer) to store data read from stream in + * @param offset - Offset target + * @param length - Number of bytes to read + * @returns Number of bytes peeked + */ + peek(uint8Array: Uint8Array, offset: number, length: number): Promise; + /** + * Read chunk from stream + * @param buffer - Target Uint8Array (or Buffer) to store data read from stream in + * @param offset - Offset target + * @param length - Number of bytes to read + * @returns Number of bytes read + */ + read(buffer: Uint8Array, offset: number, length: number): Promise; + /** + * Read chunk from stream + * @param buffer Target Uint8Array (or Buffer) to store data read from stream in + * @param offset Offset target + * @param length Number of bytes to read + * @returns Number of bytes read + */ + private readFromStream; + /** + * Process deferred read request + * @param request Deferred read request + */ + private readDeferred; + private reject; +} diff --git a/project starter code/node_modules/peek-readable/lib/StreamReader.js b/project starter code/node_modules/peek-readable/lib/StreamReader.js new file mode 100644 index 00000000..1a812624 --- /dev/null +++ b/project starter code/node_modules/peek-readable/lib/StreamReader.js @@ -0,0 +1,134 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StreamReader = exports.EndOfStreamError = void 0; +const EndOfFileStream_1 = require("./EndOfFileStream"); +const Deferred_1 = require("./Deferred"); +var EndOfFileStream_2 = require("./EndOfFileStream"); +Object.defineProperty(exports, "EndOfStreamError", { enumerable: true, get: function () { return EndOfFileStream_2.EndOfStreamError; } }); +const maxStreamReadSize = 1 * 1024 * 1024; // Maximum request length on read-stream operation +class StreamReader { + constructor(s) { + this.s = s; + /** + * Deferred used for postponed read request (as not data is yet available to read) + */ + this.deferred = null; + this.endOfStream = false; + /** + * Store peeked data + * @type {Array} + */ + this.peekQueue = []; + if (!s.read || !s.once) { + throw new Error('Expected an instance of stream.Readable'); + } + this.s.once('end', () => this.reject(new EndOfFileStream_1.EndOfStreamError())); + this.s.once('error', err => this.reject(err)); + this.s.once('close', () => this.reject(new Error('Stream closed'))); + } + /** + * Read ahead (peek) from stream. Subsequent read or peeks will return the same data + * @param uint8Array - Uint8Array (or Buffer) to store data read from stream in + * @param offset - Offset target + * @param length - Number of bytes to read + * @returns Number of bytes peeked + */ + async peek(uint8Array, offset, length) { + const bytesRead = await this.read(uint8Array, offset, length); + this.peekQueue.push(uint8Array.subarray(offset, offset + bytesRead)); // Put read data back to peek buffer + return bytesRead; + } + /** + * Read chunk from stream + * @param buffer - Target Uint8Array (or Buffer) to store data read from stream in + * @param offset - Offset target + * @param length - Number of bytes to read + * @returns Number of bytes read + */ + async read(buffer, offset, length) { + if (length === 0) { + return 0; + } + if (this.peekQueue.length === 0 && this.endOfStream) { + throw new EndOfFileStream_1.EndOfStreamError(); + } + let remaining = length; + let bytesRead = 0; + // consume peeked data first + while (this.peekQueue.length > 0 && remaining > 0) { + const peekData = this.peekQueue.pop(); // Front of queue + if (!peekData) + throw new Error('peekData should be defined'); + const lenCopy = Math.min(peekData.length, remaining); + buffer.set(peekData.subarray(0, lenCopy), offset + bytesRead); + bytesRead += lenCopy; + remaining -= lenCopy; + if (lenCopy < peekData.length) { + // remainder back to queue + this.peekQueue.push(peekData.subarray(lenCopy)); + } + } + // continue reading from stream if required + while (remaining > 0 && !this.endOfStream) { + const reqLen = Math.min(remaining, maxStreamReadSize); + const chunkLen = await this.readFromStream(buffer, offset + bytesRead, reqLen); + bytesRead += chunkLen; + if (chunkLen < reqLen) + break; + remaining -= chunkLen; + } + return bytesRead; + } + /** + * Read chunk from stream + * @param buffer Target Uint8Array (or Buffer) to store data read from stream in + * @param offset Offset target + * @param length Number of bytes to read + * @returns Number of bytes read + */ + async readFromStream(buffer, offset, length) { + const readBuffer = this.s.read(length); + if (readBuffer) { + buffer.set(readBuffer, offset); + return readBuffer.length; + } + else { + const request = { + buffer, + offset, + length, + deferred: new Deferred_1.Deferred() + }; + this.deferred = request.deferred; + this.s.once('readable', () => { + this.readDeferred(request); + }); + return request.deferred.promise; + } + } + /** + * Process deferred read request + * @param request Deferred read request + */ + readDeferred(request) { + const readBuffer = this.s.read(request.length); + if (readBuffer) { + request.buffer.set(readBuffer, request.offset); + request.deferred.resolve(readBuffer.length); + this.deferred = null; + } + else { + this.s.once('readable', () => { + this.readDeferred(request); + }); + } + } + reject(err) { + this.endOfStream = true; + if (this.deferred) { + this.deferred.reject(err); + this.deferred = null; + } + } +} +exports.StreamReader = StreamReader; diff --git a/project starter code/node_modules/peek-readable/lib/index.d.ts b/project starter code/node_modules/peek-readable/lib/index.d.ts new file mode 100644 index 00000000..764e4fae --- /dev/null +++ b/project starter code/node_modules/peek-readable/lib/index.d.ts @@ -0,0 +1,2 @@ +export { EndOfStreamError } from './EndOfFileStream'; +export { StreamReader } from './StreamReader'; diff --git a/project starter code/node_modules/peek-readable/lib/index.js b/project starter code/node_modules/peek-readable/lib/index.js new file mode 100644 index 00000000..34cd7654 --- /dev/null +++ b/project starter code/node_modules/peek-readable/lib/index.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StreamReader = exports.EndOfStreamError = void 0; +var EndOfFileStream_1 = require("./EndOfFileStream"); +Object.defineProperty(exports, "EndOfStreamError", { enumerable: true, get: function () { return EndOfFileStream_1.EndOfStreamError; } }); +var StreamReader_1 = require("./StreamReader"); +Object.defineProperty(exports, "StreamReader", { enumerable: true, get: function () { return StreamReader_1.StreamReader; } }); diff --git a/project starter code/node_modules/peek-readable/package.json b/project starter code/node_modules/peek-readable/package.json new file mode 100644 index 00000000..d460956b --- /dev/null +++ b/project starter code/node_modules/peek-readable/package.json @@ -0,0 +1,87 @@ +{ + "name": "peek-readable", + "version": "4.1.0", + "description": "Read and peek from a readable stream", + "author": { + "name": "Borewit", + "url": "https://github.com/Borewit" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + }, + "scripts": { + "clean": "del-cli lib/**/*.js lib/**/*.js.map lib/**/*.d.ts test/**/*.js test/**/*.js.map coverage .nyc_output", + "build": "npm run clean && npm run compile", + "compile-src": "tsc -p lib", + "compile-test": "tsc -p test", + "compile": "npm run compile-src && yarn run compile-test", + "eslint": "eslint lib test --ext .ts --ignore-pattern *.d.ts", + "lint-md": "remark -u preset-lint-recommended .", + "lint": "npm run lint-md && npm run eslint", + "test": "mocha --require ts-node/register --require source-map-support/register --full-trace test/*.ts", + "test-coverage": "nyc npm run test", + "send-coveralls": "nyc report --reporter=text-lcov | coveralls", + "start": "npm run compile && npm run lint && npm run cover-test" + }, + "engines": { + "node": ">=8" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Borewit/peek-readable" + }, + "license": "MIT", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "bugs": { + "url": "https://github.com/Borewit/peek-readable/issues" + }, + "files": [ + "lib/**/*.js", + "lib/**/*.d.ts" + ], + "devDependencies": { + "@types/chai": "^4.3.0", + "@types/mocha": "^9.1.0", + "@types/node": "^17.0.0", + "@typescript-eslint/eslint-plugin": "^4.33.0", + "@typescript-eslint/parser": "^4.33.0", + "add": "^2.0.6", + "chai": "^4.3.6", + "coveralls": "^3.1.1", + "del-cli": "^4.0.1", + "eslint": "^7.32.0", + "eslint-config-prettier": "^8.3.0", + "eslint-import-resolver-typescript": "^2.5.0", + "eslint-plugin-import": "^2.25.4", + "eslint-plugin-jsdoc": "^37.7.1", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-unicorn": "^40.1.0", + "mocha": "^9.2.0", + "nyc": "^15.1.0", + "remark-cli": "^10.0.1", + "remark-preset-lint-recommended": "^6.1.2", + "ts-node": "^10.4.0", + "typescript": "^4.5.5" + }, + "keywords": [ + "readable", + "buffer", + "stream", + "read" + ], + "nyc": { + "check-coverage": true, + "extension": [ + ".ts" + ], + "sourceMap": true, + "instrument": true, + "reporter": [ + "lcov", + "text" + ], + "report-dir": "coverage" + } +} diff --git a/project starter code/node_modules/picomatch/CHANGELOG.md b/project starter code/node_modules/picomatch/CHANGELOG.md new file mode 100644 index 00000000..8ccc6c1b --- /dev/null +++ b/project starter code/node_modules/picomatch/CHANGELOG.md @@ -0,0 +1,136 @@ +# Release history + +**All notable changes to this project will be documented in this file.** + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + +
+ Guiding Principles + +- Changelogs are for humans, not machines. +- There should be an entry for every single version. +- The same types of changes should be grouped. +- Versions and sections should be linkable. +- The latest version comes first. +- The release date of each versions is displayed. +- Mention whether you follow Semantic Versioning. + +
+ +
+ Types of changes + +Changelog entries are classified using the following labels _(from [keep-a-changelog](http://keepachangelog.com/)_): + +- `Added` for new features. +- `Changed` for changes in existing functionality. +- `Deprecated` for soon-to-be removed features. +- `Removed` for now removed features. +- `Fixed` for any bug fixes. +- `Security` in case of vulnerabilities. + +
+ +## 2.3.1 (2022-01-02) + +### Fixed + +* Fixes bug when a pattern containing an expression after the closing parenthesis (`/!(*.d).{ts,tsx}`) was incorrectly converted to regexp ([9f241ef](https://github.com/micromatch/picomatch/commit/9f241ef)). + +### Changed + +* Some documentation improvements ([f81d236](https://github.com/micromatch/picomatch/commit/f81d236), [421e0e7](https://github.com/micromatch/picomatch/commit/421e0e7)). + +## 2.3.0 (2021-05-21) + +### Fixed + +* Fixes bug where file names with two dots were not being matched consistently with negation extglobs containing a star ([56083ef](https://github.com/micromatch/picomatch/commit/56083ef)) + +## 2.2.3 (2021-04-10) + +### Fixed + +* Do not skip pattern seperator for square brackets ([fb08a30](https://github.com/micromatch/picomatch/commit/fb08a30)). +* Set negatedExtGlob also if it does not span the whole pattern ([032e3f5](https://github.com/micromatch/picomatch/commit/032e3f5)). + +## 2.2.2 (2020-03-21) + +### Fixed + +* Correctly handle parts of the pattern after parentheses in the `scan` method ([e15b920](https://github.com/micromatch/picomatch/commit/e15b920)). + +## 2.2.1 (2020-01-04) + +* Fixes [#49](https://github.com/micromatch/picomatch/issues/49), so that braces with no sets or ranges are now propertly treated as literals. + +## 2.2.0 (2020-01-04) + +* Disable fastpaths mode for the parse method ([5b8d33f](https://github.com/micromatch/picomatch/commit/5b8d33f)) +* Add `tokens`, `slashes`, and `parts` to the object returned by `picomatch.scan()`. + +## 2.1.0 (2019-10-31) + +* add benchmarks for scan ([4793b92](https://github.com/micromatch/picomatch/commit/4793b92)) +* Add eslint object-curly-spacing rule ([707c650](https://github.com/micromatch/picomatch/commit/707c650)) +* Add prefer-const eslint rule ([5c7501c](https://github.com/micromatch/picomatch/commit/5c7501c)) +* Add support for nonegate in scan API ([275c9b9](https://github.com/micromatch/picomatch/commit/275c9b9)) +* Change lets to consts. Move root import up. ([4840625](https://github.com/micromatch/picomatch/commit/4840625)) +* closes https://github.com/micromatch/picomatch/issues/21 ([766bcb0](https://github.com/micromatch/picomatch/commit/766bcb0)) +* Fix "Extglobs" table in readme ([eb19da8](https://github.com/micromatch/picomatch/commit/eb19da8)) +* fixes https://github.com/micromatch/picomatch/issues/20 ([9caca07](https://github.com/micromatch/picomatch/commit/9caca07)) +* fixes https://github.com/micromatch/picomatch/issues/26 ([fa58f45](https://github.com/micromatch/picomatch/commit/fa58f45)) +* Lint test ([d433a34](https://github.com/micromatch/picomatch/commit/d433a34)) +* lint unit tests ([0159b55](https://github.com/micromatch/picomatch/commit/0159b55)) +* Make scan work with noext ([6c02e03](https://github.com/micromatch/picomatch/commit/6c02e03)) +* minor linting ([c2a2b87](https://github.com/micromatch/picomatch/commit/c2a2b87)) +* minor parser improvements ([197671d](https://github.com/micromatch/picomatch/commit/197671d)) +* remove eslint since it... ([07876fa](https://github.com/micromatch/picomatch/commit/07876fa)) +* remove funding file ([8ebe96d](https://github.com/micromatch/picomatch/commit/8ebe96d)) +* Remove unused funks ([cbc6d54](https://github.com/micromatch/picomatch/commit/cbc6d54)) +* Run eslint during pretest, fix existing eslint findings ([0682367](https://github.com/micromatch/picomatch/commit/0682367)) +* support `noparen` in scan ([3d37569](https://github.com/micromatch/picomatch/commit/3d37569)) +* update changelog ([7b34e77](https://github.com/micromatch/picomatch/commit/7b34e77)) +* update travis ([777f038](https://github.com/micromatch/picomatch/commit/777f038)) +* Use eslint-disable-next-line instead of eslint-disable ([4e7c1fd](https://github.com/micromatch/picomatch/commit/4e7c1fd)) + +## 2.0.7 (2019-05-14) + +* 2.0.7 ([9eb9a71](https://github.com/micromatch/picomatch/commit/9eb9a71)) +* supports lookbehinds ([1f63f7e](https://github.com/micromatch/picomatch/commit/1f63f7e)) +* update .verb.md file with typo change ([2741279](https://github.com/micromatch/picomatch/commit/2741279)) +* fix: typo in README ([0753e44](https://github.com/micromatch/picomatch/commit/0753e44)) + +## 2.0.4 (2019-04-10) + +### Fixed + +- Readme link [fixed](https://github.com/micromatch/picomatch/pull/13/commits/a96ab3aa2b11b6861c23289964613d85563b05df) by @danez. +- `options.capture` now works as expected when fastpaths are enabled. See https://github.com/micromatch/picomatch/pull/12/commits/26aefd71f1cfaf95c37f1c1fcab68a693b037304. Thanks to @DrPizza. + +## 2.0.0 (2019-04-10) + +### Added + +- Adds support for `options.onIgnore`. See the readme for details +- Adds support for `options.onResult`. See the readme for details + +### Breaking changes + +- The unixify option was renamed to `windows` +- caching and all related options and methods have been removed + +## 1.0.0 (2018-11-05) + +- adds `.onMatch` option +- improvements to `.scan` method +- numerous improvements and optimizations for matching and parsing +- better windows path handling + +## 0.1.0 - 2017-04-13 + +First release. + + +[keep-a-changelog]: https://github.com/olivierlacan/keep-a-changelog diff --git a/project starter code/node_modules/picomatch/LICENSE b/project starter code/node_modules/picomatch/LICENSE new file mode 100644 index 00000000..3608dca2 --- /dev/null +++ b/project starter code/node_modules/picomatch/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017-present, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/project starter code/node_modules/picomatch/README.md b/project starter code/node_modules/picomatch/README.md new file mode 100644 index 00000000..b0526e28 --- /dev/null +++ b/project starter code/node_modules/picomatch/README.md @@ -0,0 +1,708 @@ +

Picomatch

+ +

+ +version + + +test status + + +coverage status + + +downloads + +

+ +
+
+ +

+Blazing fast and accurate glob matcher written in JavaScript.
+No dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions. +

+ +
+
+ +## Why picomatch? + +* **Lightweight** - No dependencies +* **Minimal** - Tiny API surface. Main export is a function that takes a glob pattern and returns a matcher function. +* **Fast** - Loads in about 2ms (that's several times faster than a [single frame of a HD movie](http://www.endmemo.com/sconvert/framespersecondframespermillisecond.php) at 60fps) +* **Performant** - Use the returned matcher function to speed up repeat matching (like when watching files) +* **Accurate matching** - Using wildcards (`*` and `?`), globstars (`**`) for nested directories, [advanced globbing](#advanced-globbing) with extglobs, braces, and POSIX brackets, and support for escaping special characters with `\` or quotes. +* **Well tested** - Thousands of unit tests + +See the [library comparison](#library-comparisons) to other libraries. + +
+
+ +## Table of Contents + +
Click to expand + +- [Install](#install) +- [Usage](#usage) +- [API](#api) + * [picomatch](#picomatch) + * [.test](#test) + * [.matchBase](#matchbase) + * [.isMatch](#ismatch) + * [.parse](#parse) + * [.scan](#scan) + * [.compileRe](#compilere) + * [.makeRe](#makere) + * [.toRegex](#toregex) +- [Options](#options) + * [Picomatch options](#picomatch-options) + * [Scan Options](#scan-options) + * [Options Examples](#options-examples) +- [Globbing features](#globbing-features) + * [Basic globbing](#basic-globbing) + * [Advanced globbing](#advanced-globbing) + * [Braces](#braces) + * [Matching special characters as literals](#matching-special-characters-as-literals) +- [Library Comparisons](#library-comparisons) +- [Benchmarks](#benchmarks) +- [Philosophies](#philosophies) +- [About](#about) + * [Author](#author) + * [License](#license) + +_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ + +
+ +
+
+ +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +npm install --save picomatch +``` + +
+ +## Usage + +The main export is a function that takes a glob pattern and an options object and returns a function for matching strings. + +```js +const pm = require('picomatch'); +const isMatch = pm('*.js'); + +console.log(isMatch('abcd')); //=> false +console.log(isMatch('a.js')); //=> true +console.log(isMatch('a.md')); //=> false +console.log(isMatch('a/b.js')); //=> false +``` + +
+ +## API + +### [picomatch](lib/picomatch.js#L32) + +Creates a matcher function from one or more glob patterns. The returned function takes a string to match as its first argument, and returns true if the string is a match. The returned matcher function also takes a boolean as the second argument that, when true, returns an object with additional information. + +**Params** + +* `globs` **{String|Array}**: One or more glob patterns. +* `options` **{Object=}** +* `returns` **{Function=}**: Returns a matcher function. + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch(glob[, options]); + +const isMatch = picomatch('*.!(*a)'); +console.log(isMatch('a.a')); //=> false +console.log(isMatch('a.b')); //=> true +``` + +### [.test](lib/picomatch.js#L117) + +Test `input` with the given `regex`. This is used by the main `picomatch()` function to test the input string. + +**Params** + +* `input` **{String}**: String to test. +* `regex` **{RegExp}** +* `returns` **{Object}**: Returns an object with matching info. + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.test(input, regex[, options]); + +console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); +// { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } +``` + +### [.matchBase](lib/picomatch.js#L161) + +Match the basename of a filepath. + +**Params** + +* `input` **{String}**: String to test. +* `glob` **{RegExp|String}**: Glob pattern or regex created by [.makeRe](#makeRe). +* `returns` **{Boolean}** + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.matchBase(input, glob[, options]); +console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true +``` + +### [.isMatch](lib/picomatch.js#L183) + +Returns true if **any** of the given glob `patterns` match the specified `string`. + +**Params** + +* **{String|Array}**: str The string to test. +* **{String|Array}**: patterns One or more glob patterns to use for matching. +* **{Object}**: See available [options](#options). +* `returns` **{Boolean}**: Returns true if any patterns match `str` + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.isMatch(string, patterns[, options]); + +console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true +console.log(picomatch.isMatch('a.a', 'b.*')); //=> false +``` + +### [.parse](lib/picomatch.js#L199) + +Parse a glob pattern to create the source string for a regular expression. + +**Params** + +* `pattern` **{String}** +* `options` **{Object}** +* `returns` **{Object}**: Returns an object with useful properties and output to be used as a regex source string. + +**Example** + +```js +const picomatch = require('picomatch'); +const result = picomatch.parse(pattern[, options]); +``` + +### [.scan](lib/picomatch.js#L231) + +Scan a glob pattern to separate the pattern into segments. + +**Params** + +* `input` **{String}**: Glob pattern to scan. +* `options` **{Object}** +* `returns` **{Object}**: Returns an object with + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.scan(input[, options]); + +const result = picomatch.scan('!./foo/*.js'); +console.log(result); +{ prefix: '!./', + input: '!./foo/*.js', + start: 3, + base: 'foo', + glob: '*.js', + isBrace: false, + isBracket: false, + isGlob: true, + isExtglob: false, + isGlobstar: false, + negated: true } +``` + +### [.compileRe](lib/picomatch.js#L245) + +Compile a regular expression from the `state` object returned by the +[parse()](#parse) method. + +**Params** + +* `state` **{Object}** +* `options` **{Object}** +* `returnOutput` **{Boolean}**: Intended for implementors, this argument allows you to return the raw output from the parser. +* `returnState` **{Boolean}**: Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. +* `returns` **{RegExp}** + +### [.makeRe](lib/picomatch.js#L286) + +Create a regular expression from a parsed glob pattern. + +**Params** + +* `state` **{String}**: The object returned from the `.parse` method. +* `options` **{Object}** +* `returnOutput` **{Boolean}**: Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. +* `returnState` **{Boolean}**: Implementors may use this argument to return the state from the parsed glob with the returned regular expression. +* `returns` **{RegExp}**: Returns a regex created from the given pattern. + +**Example** + +```js +const picomatch = require('picomatch'); +const state = picomatch.parse('*.js'); +// picomatch.compileRe(state[, options]); + +console.log(picomatch.compileRe(state)); +//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ +``` + +### [.toRegex](lib/picomatch.js#L321) + +Create a regular expression from the given regex source string. + +**Params** + +* `source` **{String}**: Regular expression source string. +* `options` **{Object}** +* `returns` **{RegExp}** + +**Example** + +```js +const picomatch = require('picomatch'); +// picomatch.toRegex(source[, options]); + +const { output } = picomatch.parse('*.js'); +console.log(picomatch.toRegex(output)); +//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ +``` + +
+ +## Options + +### Picomatch options + +The following options may be used with the main `picomatch()` function or any of the methods on the picomatch API. + +| **Option** | **Type** | **Default value** | **Description** | +| --- | --- | --- | --- | +| `basename` | `boolean` | `false` | If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. | +| `bash` | `boolean` | `false` | Follow bash matching rules more strictly - disallows backslashes as escape characters, and treats single stars as globstars (`**`). | +| `capture` | `boolean` | `undefined` | Return regex matches in supporting methods. | +| `contains` | `boolean` | `undefined` | Allows glob to match any part of the given string(s). | +| `cwd` | `string` | `process.cwd()` | Current working directory. Used by `picomatch.split()` | +| `debug` | `boolean` | `undefined` | Debug regular expressions when an error is thrown. | +| `dot` | `boolean` | `false` | Enable dotfile matching. By default, dotfiles are ignored unless a `.` is explicitly defined in the pattern, or `options.dot` is true | +| `expandRange` | `function` | `undefined` | Custom function for expanding ranges in brace patterns, such as `{a..z}`. The function receives the range values as two arguments, and it must return a string to be used in the generated regex. It's recommended that returned strings be wrapped in parentheses. | +| `failglob` | `boolean` | `false` | Throws an error if no matches are found. Based on the bash option of the same name. | +| `fastpaths` | `boolean` | `true` | To speed up processing, full parsing is skipped for a handful common glob patterns. Disable this behavior by setting this option to `false`. | +| `flags` | `string` | `undefined` | Regex flags to use in the generated regex. If defined, the `nocase` option will be overridden. | +| [format](#optionsformat) | `function` | `undefined` | Custom function for formatting the returned string. This is useful for removing leading slashes, converting Windows paths to Posix paths, etc. | +| `ignore` | `array\|string` | `undefined` | One or more glob patterns for excluding strings that should not be matched from the result. | +| `keepQuotes` | `boolean` | `false` | Retain quotes in the generated regex, since quotes may also be used as an alternative to backslashes. | +| `literalBrackets` | `boolean` | `undefined` | When `true`, brackets in the glob pattern will be escaped so that only literal brackets will be matched. | +| `matchBase` | `boolean` | `false` | Alias for `basename` | +| `maxLength` | `boolean` | `65536` | Limit the max length of the input string. An error is thrown if the input string is longer than this value. | +| `nobrace` | `boolean` | `false` | Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as literal characters. | +| `nobracket` | `boolean` | `undefined` | Disable matching with regex brackets. | +| `nocase` | `boolean` | `false` | Make matching case-insensitive. Equivalent to the regex `i` flag. Note that this option is overridden by the `flags` option. | +| `nodupes` | `boolean` | `true` | Deprecated, use `nounique` instead. This option will be removed in a future major release. By default duplicates are removed. Disable uniquification by setting this option to false. | +| `noext` | `boolean` | `false` | Alias for `noextglob` | +| `noextglob` | `boolean` | `false` | Disable support for matching with extglobs (like `+(a\|b)`) | +| `noglobstar` | `boolean` | `false` | Disable support for matching nested directories with globstars (`**`) | +| `nonegate` | `boolean` | `false` | Disable support for negating with leading `!` | +| `noquantifiers` | `boolean` | `false` | Disable support for regex quantifiers (like `a{1,2}`) and treat them as brace patterns to be expanded. | +| [onIgnore](#optionsonIgnore) | `function` | `undefined` | Function to be called on ignored items. | +| [onMatch](#optionsonMatch) | `function` | `undefined` | Function to be called on matched items. | +| [onResult](#optionsonResult) | `function` | `undefined` | Function to be called on all items, regardless of whether or not they are matched or ignored. | +| `posix` | `boolean` | `false` | Support POSIX character classes ("posix brackets"). | +| `posixSlashes` | `boolean` | `undefined` | Convert all slashes in file paths to forward slashes. This does not convert slashes in the glob pattern itself | +| `prepend` | `boolean` | `undefined` | String to prepend to the generated regex used for matching. | +| `regex` | `boolean` | `false` | Use regular expression rules for `+` (instead of matching literal `+`), and for stars that follow closing parentheses or brackets (as in `)*` and `]*`). | +| `strictBrackets` | `boolean` | `undefined` | Throw an error if brackets, braces, or parens are imbalanced. | +| `strictSlashes` | `boolean` | `undefined` | When true, picomatch won't match trailing slashes with single stars. | +| `unescape` | `boolean` | `undefined` | Remove backslashes preceding escaped characters in the glob pattern. By default, backslashes are retained. | +| `unixify` | `boolean` | `undefined` | Alias for `posixSlashes`, for backwards compatibility. | + +picomatch has automatic detection for regex positive and negative lookbehinds. If the pattern contains a negative lookbehind, you must be using Node.js >= 8.10 or else picomatch will throw an error. + +### Scan Options + +In addition to the main [picomatch options](#picomatch-options), the following options may also be used with the [.scan](#scan) method. + +| **Option** | **Type** | **Default value** | **Description** | +| --- | --- | --- | --- | +| `tokens` | `boolean` | `false` | When `true`, the returned object will include an array of tokens (objects), representing each path "segment" in the scanned glob pattern | +| `parts` | `boolean` | `false` | When `true`, the returned object will include an array of strings representing each path "segment" in the scanned glob pattern. This is automatically enabled when `options.tokens` is true | + +**Example** + +```js +const picomatch = require('picomatch'); +const result = picomatch.scan('!./foo/*.js', { tokens: true }); +console.log(result); +// { +// prefix: '!./', +// input: '!./foo/*.js', +// start: 3, +// base: 'foo', +// glob: '*.js', +// isBrace: false, +// isBracket: false, +// isGlob: true, +// isExtglob: false, +// isGlobstar: false, +// negated: true, +// maxDepth: 2, +// tokens: [ +// { value: '!./', depth: 0, isGlob: false, negated: true, isPrefix: true }, +// { value: 'foo', depth: 1, isGlob: false }, +// { value: '*.js', depth: 1, isGlob: true } +// ], +// slashes: [ 2, 6 ], +// parts: [ 'foo', '*.js' ] +// } +``` + +
+ +### Options Examples + +#### options.expandRange + +**Type**: `function` + +**Default**: `undefined` + +Custom function for expanding ranges in brace patterns. The [fill-range](https://github.com/jonschlinkert/fill-range) library is ideal for this purpose, or you can use custom code to do whatever you need. + +**Example** + +The following example shows how to create a glob that matches a folder + +```js +const fill = require('fill-range'); +const regex = pm.makeRe('foo/{01..25}/bar', { + expandRange(a, b) { + return `(${fill(a, b, { toRegex: true })})`; + } +}); + +console.log(regex); +//=> /^(?:foo\/((?:0[1-9]|1[0-9]|2[0-5]))\/bar)$/ + +console.log(regex.test('foo/00/bar')) // false +console.log(regex.test('foo/01/bar')) // true +console.log(regex.test('foo/10/bar')) // true +console.log(regex.test('foo/22/bar')) // true +console.log(regex.test('foo/25/bar')) // true +console.log(regex.test('foo/26/bar')) // false +``` + +#### options.format + +**Type**: `function` + +**Default**: `undefined` + +Custom function for formatting strings before they're matched. + +**Example** + +```js +// strip leading './' from strings +const format = str => str.replace(/^\.\//, ''); +const isMatch = picomatch('foo/*.js', { format }); +console.log(isMatch('./foo/bar.js')); //=> true +``` + +#### options.onMatch + +```js +const onMatch = ({ glob, regex, input, output }) => { + console.log({ glob, regex, input, output }); +}; + +const isMatch = picomatch('*', { onMatch }); +isMatch('foo'); +isMatch('bar'); +isMatch('baz'); +``` + +#### options.onIgnore + +```js +const onIgnore = ({ glob, regex, input, output }) => { + console.log({ glob, regex, input, output }); +}; + +const isMatch = picomatch('*', { onIgnore, ignore: 'f*' }); +isMatch('foo'); +isMatch('bar'); +isMatch('baz'); +``` + +#### options.onResult + +```js +const onResult = ({ glob, regex, input, output }) => { + console.log({ glob, regex, input, output }); +}; + +const isMatch = picomatch('*', { onResult, ignore: 'f*' }); +isMatch('foo'); +isMatch('bar'); +isMatch('baz'); +``` + +
+
+ +## Globbing features + +* [Basic globbing](#basic-globbing) (Wildcard matching) +* [Advanced globbing](#advanced-globbing) (extglobs, posix brackets, brace matching) + +### Basic globbing + +| **Character** | **Description** | +| --- | --- | +| `*` | Matches any character zero or more times, excluding path separators. Does _not match_ path separators or hidden files or directories ("dotfiles"), unless explicitly enabled by setting the `dot` option to `true`. | +| `**` | Matches any character zero or more times, including path separators. Note that `**` will only match path separators (`/`, and `\\` on Windows) when they are the only characters in a path segment. Thus, `foo**/bar` is equivalent to `foo*/bar`, and `foo/a**b/bar` is equivalent to `foo/a*b/bar`, and _more than two_ consecutive stars in a glob path segment are regarded as _a single star_. Thus, `foo/***/bar` is equivalent to `foo/*/bar`. | +| `?` | Matches any character excluding path separators one time. Does _not match_ path separators or leading dots. | +| `[abc]` | Matches any characters inside the brackets. For example, `[abc]` would match the characters `a`, `b` or `c`, and nothing else. | + +#### Matching behavior vs. Bash + +Picomatch's matching features and expected results in unit tests are based on Bash's unit tests and the Bash 4.3 specification, with the following exceptions: + +* Bash will match `foo/bar/baz` with `*`. Picomatch only matches nested directories with `**`. +* Bash greedily matches with negated extglobs. For example, Bash 4.3 says that `!(foo)*` should match `foo` and `foobar`, since the trailing `*` bracktracks to match the preceding pattern. This is very memory-inefficient, and IMHO, also incorrect. Picomatch would return `false` for both `foo` and `foobar`. + +
+ +### Advanced globbing + +* [extglobs](#extglobs) +* [POSIX brackets](#posix-brackets) +* [Braces](#brace-expansion) + +#### Extglobs + +| **Pattern** | **Description** | +| --- | --- | +| `@(pattern)` | Match _only one_ consecutive occurrence of `pattern` | +| `*(pattern)` | Match _zero or more_ consecutive occurrences of `pattern` | +| `+(pattern)` | Match _one or more_ consecutive occurrences of `pattern` | +| `?(pattern)` | Match _zero or **one**_ consecutive occurrences of `pattern` | +| `!(pattern)` | Match _anything but_ `pattern` | + +**Examples** + +```js +const pm = require('picomatch'); + +// *(pattern) matches ZERO or more of "pattern" +console.log(pm.isMatch('a', 'a*(z)')); // true +console.log(pm.isMatch('az', 'a*(z)')); // true +console.log(pm.isMatch('azzz', 'a*(z)')); // true + +// +(pattern) matches ONE or more of "pattern" +console.log(pm.isMatch('a', 'a*(z)')); // true +console.log(pm.isMatch('az', 'a*(z)')); // true +console.log(pm.isMatch('azzz', 'a*(z)')); // true + +// supports multiple extglobs +console.log(pm.isMatch('foo.bar', '!(foo).!(bar)')); // false + +// supports nested extglobs +console.log(pm.isMatch('foo.bar', '!(!(foo)).!(!(bar))')); // true +``` + +#### POSIX brackets + +POSIX classes are disabled by default. Enable this feature by setting the `posix` option to true. + +**Enable POSIX bracket support** + +```js +console.log(pm.makeRe('[[:word:]]+', { posix: true })); +//=> /^(?:(?=.)[A-Za-z0-9_]+\/?)$/ +``` + +**Supported POSIX classes** + +The following named POSIX bracket expressions are supported: + +* `[:alnum:]` - Alphanumeric characters, equ `[a-zA-Z0-9]` +* `[:alpha:]` - Alphabetical characters, equivalent to `[a-zA-Z]`. +* `[:ascii:]` - ASCII characters, equivalent to `[\\x00-\\x7F]`. +* `[:blank:]` - Space and tab characters, equivalent to `[ \\t]`. +* `[:cntrl:]` - Control characters, equivalent to `[\\x00-\\x1F\\x7F]`. +* `[:digit:]` - Numerical digits, equivalent to `[0-9]`. +* `[:graph:]` - Graph characters, equivalent to `[\\x21-\\x7E]`. +* `[:lower:]` - Lowercase letters, equivalent to `[a-z]`. +* `[:print:]` - Print characters, equivalent to `[\\x20-\\x7E ]`. +* `[:punct:]` - Punctuation and symbols, equivalent to `[\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~]`. +* `[:space:]` - Extended space characters, equivalent to `[ \\t\\r\\n\\v\\f]`. +* `[:upper:]` - Uppercase letters, equivalent to `[A-Z]`. +* `[:word:]` - Word characters (letters, numbers and underscores), equivalent to `[A-Za-z0-9_]`. +* `[:xdigit:]` - Hexadecimal digits, equivalent to `[A-Fa-f0-9]`. + +See the [Bash Reference Manual](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html) for more information. + +### Braces + +Picomatch does not do brace expansion. For [brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) and advanced matching with braces, use [micromatch](https://github.com/micromatch/micromatch) instead. Picomatch has very basic support for braces. + +### Matching special characters as literals + +If you wish to match the following special characters in a filepath, and you want to use these characters in your glob pattern, they must be escaped with backslashes or quotes: + +**Special Characters** + +Some characters that are used for matching in regular expressions are also regarded as valid file path characters on some platforms. + +To match any of the following characters as literals: `$^*+?()[] + +Examples: + +```js +console.log(pm.makeRe('foo/bar \\(1\\)')); +console.log(pm.makeRe('foo/bar \\(1\\)')); +``` + +
+
+ +## Library Comparisons + +The following table shows which features are supported by [minimatch](https://github.com/isaacs/minimatch), [micromatch](https://github.com/micromatch/micromatch), [picomatch](https://github.com/micromatch/picomatch), [nanomatch](https://github.com/micromatch/nanomatch), [extglob](https://github.com/micromatch/extglob), [braces](https://github.com/micromatch/braces), and [expand-brackets](https://github.com/micromatch/expand-brackets). + +| **Feature** | `minimatch` | `micromatch` | `picomatch` | `nanomatch` | `extglob` | `braces` | `expand-brackets` | +| --- | --- | --- | --- | --- | --- | --- | --- | +| Wildcard matching (`*?+`) | ✔ | ✔ | ✔ | ✔ | - | - | - | +| Advancing globbing | ✔ | ✔ | ✔ | - | - | - | - | +| Brace _matching_ | ✔ | ✔ | ✔ | - | - | ✔ | - | +| Brace _expansion_ | ✔ | ✔ | - | - | - | ✔ | - | +| Extglobs | partial | ✔ | ✔ | - | ✔ | - | - | +| Posix brackets | - | ✔ | ✔ | - | - | - | ✔ | +| Regular expression syntax | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | +| File system operations | - | - | - | - | - | - | - | + +
+
+ +## Benchmarks + +Performance comparison of picomatch and minimatch. + +``` +# .makeRe star + picomatch x 1,993,050 ops/sec ±0.51% (91 runs sampled) + minimatch x 627,206 ops/sec ±1.96% (87 runs sampled)) + +# .makeRe star; dot=true + picomatch x 1,436,640 ops/sec ±0.62% (91 runs sampled) + minimatch x 525,876 ops/sec ±0.60% (88 runs sampled) + +# .makeRe globstar + picomatch x 1,592,742 ops/sec ±0.42% (90 runs sampled) + minimatch x 962,043 ops/sec ±1.76% (91 runs sampled)d) + +# .makeRe globstars + picomatch x 1,615,199 ops/sec ±0.35% (94 runs sampled) + minimatch x 477,179 ops/sec ±1.33% (91 runs sampled) + +# .makeRe with leading star + picomatch x 1,220,856 ops/sec ±0.40% (92 runs sampled) + minimatch x 453,564 ops/sec ±1.43% (94 runs sampled) + +# .makeRe - basic braces + picomatch x 392,067 ops/sec ±0.70% (90 runs sampled) + minimatch x 99,532 ops/sec ±2.03% (87 runs sampled)) +``` + +
+
+ +## Philosophies + +The goal of this library is to be blazing fast, without compromising on accuracy. + +**Accuracy** + +The number one of goal of this library is accuracy. However, it's not unusual for different glob implementations to have different rules for matching behavior, even with simple wildcard matching. It gets increasingly more complicated when combinations of different features are combined, like when extglobs are combined with globstars, braces, slashes, and so on: `!(**/{a,b,*/c})`. + +Thus, given that there is no canonical glob specification to use as a single source of truth when differences of opinion arise regarding behavior, sometimes we have to implement our best judgement and rely on feedback from users to make improvements. + +**Performance** + +Although this library performs well in benchmarks, and in most cases it's faster than other popular libraries we benchmarked against, we will always choose accuracy over performance. It's not helpful to anyone if our library is faster at returning the wrong answer. + +
+
+ +## About + +
+Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards. + +
+ +
+Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +npm install && npm test +``` + +
+ +
+Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
+ +### Author + +**Jon Schlinkert** + +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) + +### License + +Copyright © 2017-present, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). diff --git a/project starter code/node_modules/picomatch/index.js b/project starter code/node_modules/picomatch/index.js new file mode 100644 index 00000000..d2f2bc59 --- /dev/null +++ b/project starter code/node_modules/picomatch/index.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./lib/picomatch'); diff --git a/project starter code/node_modules/picomatch/lib/constants.js b/project starter code/node_modules/picomatch/lib/constants.js new file mode 100644 index 00000000..a62ef387 --- /dev/null +++ b/project starter code/node_modules/picomatch/lib/constants.js @@ -0,0 +1,179 @@ +'use strict'; + +const path = require('path'); +const WIN_SLASH = '\\\\/'; +const WIN_NO_SLASH = `[^${WIN_SLASH}]`; + +/** + * Posix glob regex + */ + +const DOT_LITERAL = '\\.'; +const PLUS_LITERAL = '\\+'; +const QMARK_LITERAL = '\\?'; +const SLASH_LITERAL = '\\/'; +const ONE_CHAR = '(?=.)'; +const QMARK = '[^/]'; +const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; +const START_ANCHOR = `(?:^|${SLASH_LITERAL})`; +const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; +const NO_DOT = `(?!${DOT_LITERAL})`; +const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; +const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; +const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; +const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; +const STAR = `${QMARK}*?`; + +const POSIX_CHARS = { + DOT_LITERAL, + PLUS_LITERAL, + QMARK_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + QMARK, + END_ANCHOR, + DOTS_SLASH, + NO_DOT, + NO_DOTS, + NO_DOT_SLASH, + NO_DOTS_SLASH, + QMARK_NO_DOT, + STAR, + START_ANCHOR +}; + +/** + * Windows glob regex + */ + +const WINDOWS_CHARS = { + ...POSIX_CHARS, + + SLASH_LITERAL: `[${WIN_SLASH}]`, + QMARK: WIN_NO_SLASH, + STAR: `${WIN_NO_SLASH}*?`, + DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, + NO_DOT: `(?!${DOT_LITERAL})`, + NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, + NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`, + NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, + QMARK_NO_DOT: `[^.${WIN_SLASH}]`, + START_ANCHOR: `(?:^|[${WIN_SLASH}])`, + END_ANCHOR: `(?:[${WIN_SLASH}]|$)` +}; + +/** + * POSIX Bracket Regex + */ + +const POSIX_REGEX_SOURCE = { + alnum: 'a-zA-Z0-9', + alpha: 'a-zA-Z', + ascii: '\\x00-\\x7F', + blank: ' \\t', + cntrl: '\\x00-\\x1F\\x7F', + digit: '0-9', + graph: '\\x21-\\x7E', + lower: 'a-z', + print: '\\x20-\\x7E ', + punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~', + space: ' \\t\\r\\n\\v\\f', + upper: 'A-Z', + word: 'A-Za-z0-9_', + xdigit: 'A-Fa-f0-9' +}; + +module.exports = { + MAX_LENGTH: 1024 * 64, + POSIX_REGEX_SOURCE, + + // regular expressions + REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, + REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, + REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, + REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, + REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, + REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, + + // Replace globs with equivalent patterns to reduce parsing time. + REPLACEMENTS: { + '***': '*', + '**/**': '**', + '**/**/**': '**' + }, + + // Digits + CHAR_0: 48, /* 0 */ + CHAR_9: 57, /* 9 */ + + // Alphabet chars. + CHAR_UPPERCASE_A: 65, /* A */ + CHAR_LOWERCASE_A: 97, /* a */ + CHAR_UPPERCASE_Z: 90, /* Z */ + CHAR_LOWERCASE_Z: 122, /* z */ + + CHAR_LEFT_PARENTHESES: 40, /* ( */ + CHAR_RIGHT_PARENTHESES: 41, /* ) */ + + CHAR_ASTERISK: 42, /* * */ + + // Non-alphabetic chars. + CHAR_AMPERSAND: 38, /* & */ + CHAR_AT: 64, /* @ */ + CHAR_BACKWARD_SLASH: 92, /* \ */ + CHAR_CARRIAGE_RETURN: 13, /* \r */ + CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */ + CHAR_COLON: 58, /* : */ + CHAR_COMMA: 44, /* , */ + CHAR_DOT: 46, /* . */ + CHAR_DOUBLE_QUOTE: 34, /* " */ + CHAR_EQUAL: 61, /* = */ + CHAR_EXCLAMATION_MARK: 33, /* ! */ + CHAR_FORM_FEED: 12, /* \f */ + CHAR_FORWARD_SLASH: 47, /* / */ + CHAR_GRAVE_ACCENT: 96, /* ` */ + CHAR_HASH: 35, /* # */ + CHAR_HYPHEN_MINUS: 45, /* - */ + CHAR_LEFT_ANGLE_BRACKET: 60, /* < */ + CHAR_LEFT_CURLY_BRACE: 123, /* { */ + CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */ + CHAR_LINE_FEED: 10, /* \n */ + CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */ + CHAR_PERCENT: 37, /* % */ + CHAR_PLUS: 43, /* + */ + CHAR_QUESTION_MARK: 63, /* ? */ + CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */ + CHAR_RIGHT_CURLY_BRACE: 125, /* } */ + CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */ + CHAR_SEMICOLON: 59, /* ; */ + CHAR_SINGLE_QUOTE: 39, /* ' */ + CHAR_SPACE: 32, /* */ + CHAR_TAB: 9, /* \t */ + CHAR_UNDERSCORE: 95, /* _ */ + CHAR_VERTICAL_LINE: 124, /* | */ + CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */ + + SEP: path.sep, + + /** + * Create EXTGLOB_CHARS + */ + + extglobChars(chars) { + return { + '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` }, + '?': { type: 'qmark', open: '(?:', close: ')?' }, + '+': { type: 'plus', open: '(?:', close: ')+' }, + '*': { type: 'star', open: '(?:', close: ')*' }, + '@': { type: 'at', open: '(?:', close: ')' } + }; + }, + + /** + * Create GLOB_CHARS + */ + + globChars(win32) { + return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; + } +}; diff --git a/project starter code/node_modules/picomatch/lib/parse.js b/project starter code/node_modules/picomatch/lib/parse.js new file mode 100644 index 00000000..58269d01 --- /dev/null +++ b/project starter code/node_modules/picomatch/lib/parse.js @@ -0,0 +1,1091 @@ +'use strict'; + +const constants = require('./constants'); +const utils = require('./utils'); + +/** + * Constants + */ + +const { + MAX_LENGTH, + POSIX_REGEX_SOURCE, + REGEX_NON_SPECIAL_CHARS, + REGEX_SPECIAL_CHARS_BACKREF, + REPLACEMENTS +} = constants; + +/** + * Helpers + */ + +const expandRange = (args, options) => { + if (typeof options.expandRange === 'function') { + return options.expandRange(...args, options); + } + + args.sort(); + const value = `[${args.join('-')}]`; + + try { + /* eslint-disable-next-line no-new */ + new RegExp(value); + } catch (ex) { + return args.map(v => utils.escapeRegex(v)).join('..'); + } + + return value; +}; + +/** + * Create the message for a syntax error + */ + +const syntaxError = (type, char) => { + return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`; +}; + +/** + * Parse the given input string. + * @param {String} input + * @param {Object} options + * @return {Object} + */ + +const parse = (input, options) => { + if (typeof input !== 'string') { + throw new TypeError('Expected a string'); + } + + input = REPLACEMENTS[input] || input; + + const opts = { ...options }; + const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + + let len = input.length; + if (len > max) { + throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); + } + + const bos = { type: 'bos', value: '', output: opts.prepend || '' }; + const tokens = [bos]; + + const capture = opts.capture ? '' : '?:'; + const win32 = utils.isWindows(options); + + // create constants based on platform, for windows or posix + const PLATFORM_CHARS = constants.globChars(win32); + const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS); + + const { + DOT_LITERAL, + PLUS_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + DOTS_SLASH, + NO_DOT, + NO_DOT_SLASH, + NO_DOTS_SLASH, + QMARK, + QMARK_NO_DOT, + STAR, + START_ANCHOR + } = PLATFORM_CHARS; + + const globstar = opts => { + return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; + }; + + const nodot = opts.dot ? '' : NO_DOT; + const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; + let star = opts.bash === true ? globstar(opts) : STAR; + + if (opts.capture) { + star = `(${star})`; + } + + // minimatch options support + if (typeof opts.noext === 'boolean') { + opts.noextglob = opts.noext; + } + + const state = { + input, + index: -1, + start: 0, + dot: opts.dot === true, + consumed: '', + output: '', + prefix: '', + backtrack: false, + negated: false, + brackets: 0, + braces: 0, + parens: 0, + quotes: 0, + globstar: false, + tokens + }; + + input = utils.removePrefix(input, state); + len = input.length; + + const extglobs = []; + const braces = []; + const stack = []; + let prev = bos; + let value; + + /** + * Tokenizing helpers + */ + + const eos = () => state.index === len - 1; + const peek = state.peek = (n = 1) => input[state.index + n]; + const advance = state.advance = () => input[++state.index] || ''; + const remaining = () => input.slice(state.index + 1); + const consume = (value = '', num = 0) => { + state.consumed += value; + state.index += num; + }; + + const append = token => { + state.output += token.output != null ? token.output : token.value; + consume(token.value); + }; + + const negate = () => { + let count = 1; + + while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) { + advance(); + state.start++; + count++; + } + + if (count % 2 === 0) { + return false; + } + + state.negated = true; + state.start++; + return true; + }; + + const increment = type => { + state[type]++; + stack.push(type); + }; + + const decrement = type => { + state[type]--; + stack.pop(); + }; + + /** + * Push tokens onto the tokens array. This helper speeds up + * tokenizing by 1) helping us avoid backtracking as much as possible, + * and 2) helping us avoid creating extra tokens when consecutive + * characters are plain text. This improves performance and simplifies + * lookbehinds. + */ + + const push = tok => { + if (prev.type === 'globstar') { + const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); + const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); + + if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { + state.output = state.output.slice(0, -prev.output.length); + prev.type = 'star'; + prev.value = '*'; + prev.output = star; + state.output += prev.output; + } + } + + if (extglobs.length && tok.type !== 'paren') { + extglobs[extglobs.length - 1].inner += tok.value; + } + + if (tok.value || tok.output) append(tok); + if (prev && prev.type === 'text' && tok.type === 'text') { + prev.value += tok.value; + prev.output = (prev.output || '') + tok.value; + return; + } + + tok.prev = prev; + tokens.push(tok); + prev = tok; + }; + + const extglobOpen = (type, value) => { + const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; + + token.prev = prev; + token.parens = state.parens; + token.output = state.output; + const output = (opts.capture ? '(' : '') + token.open; + + increment('parens'); + push({ type, value, output: state.output ? '' : ONE_CHAR }); + push({ type: 'paren', extglob: true, value: advance(), output }); + extglobs.push(token); + }; + + const extglobClose = token => { + let output = token.close + (opts.capture ? ')' : ''); + let rest; + + if (token.type === 'negate') { + let extglobStar = star; + + if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { + extglobStar = globstar(opts); + } + + if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) { + output = token.close = `)$))${extglobStar}`; + } + + if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) { + // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis. + // In this case, we need to parse the string and use it in the output of the original pattern. + // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`. + // + // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`. + const expression = parse(rest, { ...options, fastpaths: false }).output; + + output = token.close = `)${expression})${extglobStar})`; + } + + if (token.prev.type === 'bos') { + state.negatedExtglob = true; + } + } + + push({ type: 'paren', extglob: true, value, output }); + decrement('parens'); + }; + + /** + * Fast paths + */ + + if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) { + let backslashes = false; + + let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => { + if (first === '\\') { + backslashes = true; + return m; + } + + if (first === '?') { + if (esc) { + return esc + first + (rest ? QMARK.repeat(rest.length) : ''); + } + if (index === 0) { + return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ''); + } + return QMARK.repeat(chars.length); + } + + if (first === '.') { + return DOT_LITERAL.repeat(chars.length); + } + + if (first === '*') { + if (esc) { + return esc + first + (rest ? star : ''); + } + return star; + } + return esc ? m : `\\${m}`; + }); + + if (backslashes === true) { + if (opts.unescape === true) { + output = output.replace(/\\/g, ''); + } else { + output = output.replace(/\\+/g, m => { + return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : ''); + }); + } + } + + if (output === input && opts.contains === true) { + state.output = input; + return state; + } + + state.output = utils.wrapOutput(output, state, options); + return state; + } + + /** + * Tokenize input until we reach end-of-string + */ + + while (!eos()) { + value = advance(); + + if (value === '\u0000') { + continue; + } + + /** + * Escaped characters + */ + + if (value === '\\') { + const next = peek(); + + if (next === '/' && opts.bash !== true) { + continue; + } + + if (next === '.' || next === ';') { + continue; + } + + if (!next) { + value += '\\'; + push({ type: 'text', value }); + continue; + } + + // collapse slashes to reduce potential for exploits + const match = /^\\+/.exec(remaining()); + let slashes = 0; + + if (match && match[0].length > 2) { + slashes = match[0].length; + state.index += slashes; + if (slashes % 2 !== 0) { + value += '\\'; + } + } + + if (opts.unescape === true) { + value = advance(); + } else { + value += advance(); + } + + if (state.brackets === 0) { + push({ type: 'text', value }); + continue; + } + } + + /** + * If we're inside a regex character class, continue + * until we reach the closing bracket. + */ + + if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) { + if (opts.posix !== false && value === ':') { + const inner = prev.value.slice(1); + if (inner.includes('[')) { + prev.posix = true; + + if (inner.includes(':')) { + const idx = prev.value.lastIndexOf('['); + const pre = prev.value.slice(0, idx); + const rest = prev.value.slice(idx + 2); + const posix = POSIX_REGEX_SOURCE[rest]; + if (posix) { + prev.value = pre + posix; + state.backtrack = true; + advance(); + + if (!bos.output && tokens.indexOf(prev) === 1) { + bos.output = ONE_CHAR; + } + continue; + } + } + } + } + + if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) { + value = `\\${value}`; + } + + if (value === ']' && (prev.value === '[' || prev.value === '[^')) { + value = `\\${value}`; + } + + if (opts.posix === true && value === '!' && prev.value === '[') { + value = '^'; + } + + prev.value += value; + append({ value }); + continue; + } + + /** + * If we're inside a quoted string, continue + * until we reach the closing double quote. + */ + + if (state.quotes === 1 && value !== '"') { + value = utils.escapeRegex(value); + prev.value += value; + append({ value }); + continue; + } + + /** + * Double quotes + */ + + if (value === '"') { + state.quotes = state.quotes === 1 ? 0 : 1; + if (opts.keepQuotes === true) { + push({ type: 'text', value }); + } + continue; + } + + /** + * Parentheses + */ + + if (value === '(') { + increment('parens'); + push({ type: 'paren', value }); + continue; + } + + if (value === ')') { + if (state.parens === 0 && opts.strictBrackets === true) { + throw new SyntaxError(syntaxError('opening', '(')); + } + + const extglob = extglobs[extglobs.length - 1]; + if (extglob && state.parens === extglob.parens + 1) { + extglobClose(extglobs.pop()); + continue; + } + + push({ type: 'paren', value, output: state.parens ? ')' : '\\)' }); + decrement('parens'); + continue; + } + + /** + * Square brackets + */ + + if (value === '[') { + if (opts.nobracket === true || !remaining().includes(']')) { + if (opts.nobracket !== true && opts.strictBrackets === true) { + throw new SyntaxError(syntaxError('closing', ']')); + } + + value = `\\${value}`; + } else { + increment('brackets'); + } + + push({ type: 'bracket', value }); + continue; + } + + if (value === ']') { + if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) { + push({ type: 'text', value, output: `\\${value}` }); + continue; + } + + if (state.brackets === 0) { + if (opts.strictBrackets === true) { + throw new SyntaxError(syntaxError('opening', '[')); + } + + push({ type: 'text', value, output: `\\${value}` }); + continue; + } + + decrement('brackets'); + + const prevValue = prev.value.slice(1); + if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) { + value = `/${value}`; + } + + prev.value += value; + append({ value }); + + // when literal brackets are explicitly disabled + // assume we should match with a regex character class + if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) { + continue; + } + + const escaped = utils.escapeRegex(prev.value); + state.output = state.output.slice(0, -prev.value.length); + + // when literal brackets are explicitly enabled + // assume we should escape the brackets to match literal characters + if (opts.literalBrackets === true) { + state.output += escaped; + prev.value = escaped; + continue; + } + + // when the user specifies nothing, try to match both + prev.value = `(${capture}${escaped}|${prev.value})`; + state.output += prev.value; + continue; + } + + /** + * Braces + */ + + if (value === '{' && opts.nobrace !== true) { + increment('braces'); + + const open = { + type: 'brace', + value, + output: '(', + outputIndex: state.output.length, + tokensIndex: state.tokens.length + }; + + braces.push(open); + push(open); + continue; + } + + if (value === '}') { + const brace = braces[braces.length - 1]; + + if (opts.nobrace === true || !brace) { + push({ type: 'text', value, output: value }); + continue; + } + + let output = ')'; + + if (brace.dots === true) { + const arr = tokens.slice(); + const range = []; + + for (let i = arr.length - 1; i >= 0; i--) { + tokens.pop(); + if (arr[i].type === 'brace') { + break; + } + if (arr[i].type !== 'dots') { + range.unshift(arr[i].value); + } + } + + output = expandRange(range, opts); + state.backtrack = true; + } + + if (brace.comma !== true && brace.dots !== true) { + const out = state.output.slice(0, brace.outputIndex); + const toks = state.tokens.slice(brace.tokensIndex); + brace.value = brace.output = '\\{'; + value = output = '\\}'; + state.output = out; + for (const t of toks) { + state.output += (t.output || t.value); + } + } + + push({ type: 'brace', value, output }); + decrement('braces'); + braces.pop(); + continue; + } + + /** + * Pipes + */ + + if (value === '|') { + if (extglobs.length > 0) { + extglobs[extglobs.length - 1].conditions++; + } + push({ type: 'text', value }); + continue; + } + + /** + * Commas + */ + + if (value === ',') { + let output = value; + + const brace = braces[braces.length - 1]; + if (brace && stack[stack.length - 1] === 'braces') { + brace.comma = true; + output = '|'; + } + + push({ type: 'comma', value, output }); + continue; + } + + /** + * Slashes + */ + + if (value === '/') { + // if the beginning of the glob is "./", advance the start + // to the current index, and don't add the "./" characters + // to the state. This greatly simplifies lookbehinds when + // checking for BOS characters like "!" and "." (not "./") + if (prev.type === 'dot' && state.index === state.start + 1) { + state.start = state.index + 1; + state.consumed = ''; + state.output = ''; + tokens.pop(); + prev = bos; // reset "prev" to the first token + continue; + } + + push({ type: 'slash', value, output: SLASH_LITERAL }); + continue; + } + + /** + * Dots + */ + + if (value === '.') { + if (state.braces > 0 && prev.type === 'dot') { + if (prev.value === '.') prev.output = DOT_LITERAL; + const brace = braces[braces.length - 1]; + prev.type = 'dots'; + prev.output += value; + prev.value += value; + brace.dots = true; + continue; + } + + if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') { + push({ type: 'text', value, output: DOT_LITERAL }); + continue; + } + + push({ type: 'dot', value, output: DOT_LITERAL }); + continue; + } + + /** + * Question marks + */ + + if (value === '?') { + const isGroup = prev && prev.value === '('; + if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + extglobOpen('qmark', value); + continue; + } + + if (prev && prev.type === 'paren') { + const next = peek(); + let output = value; + + if (next === '<' && !utils.supportsLookbehinds()) { + throw new Error('Node.js v10 or higher is required for regex lookbehinds'); + } + + if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) { + output = `\\${value}`; + } + + push({ type: 'text', value, output }); + continue; + } + + if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) { + push({ type: 'qmark', value, output: QMARK_NO_DOT }); + continue; + } + + push({ type: 'qmark', value, output: QMARK }); + continue; + } + + /** + * Exclamation + */ + + if (value === '!') { + if (opts.noextglob !== true && peek() === '(') { + if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) { + extglobOpen('negate', value); + continue; + } + } + + if (opts.nonegate !== true && state.index === 0) { + negate(); + continue; + } + } + + /** + * Plus + */ + + if (value === '+') { + if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + extglobOpen('plus', value); + continue; + } + + if ((prev && prev.value === '(') || opts.regex === false) { + push({ type: 'plus', value, output: PLUS_LITERAL }); + continue; + } + + if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) { + push({ type: 'plus', value }); + continue; + } + + push({ type: 'plus', value: PLUS_LITERAL }); + continue; + } + + /** + * Plain text + */ + + if (value === '@') { + if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + push({ type: 'at', extglob: true, value, output: '' }); + continue; + } + + push({ type: 'text', value }); + continue; + } + + /** + * Plain text + */ + + if (value !== '*') { + if (value === '$' || value === '^') { + value = `\\${value}`; + } + + const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); + if (match) { + value += match[0]; + state.index += match[0].length; + } + + push({ type: 'text', value }); + continue; + } + + /** + * Stars + */ + + if (prev && (prev.type === 'globstar' || prev.star === true)) { + prev.type = 'star'; + prev.star = true; + prev.value += value; + prev.output = star; + state.backtrack = true; + state.globstar = true; + consume(value); + continue; + } + + let rest = remaining(); + if (opts.noextglob !== true && /^\([^?]/.test(rest)) { + extglobOpen('star', value); + continue; + } + + if (prev.type === 'star') { + if (opts.noglobstar === true) { + consume(value); + continue; + } + + const prior = prev.prev; + const before = prior.prev; + const isStart = prior.type === 'slash' || prior.type === 'bos'; + const afterStar = before && (before.type === 'star' || before.type === 'globstar'); + + if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) { + push({ type: 'star', value, output: '' }); + continue; + } + + const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace'); + const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren'); + if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) { + push({ type: 'star', value, output: '' }); + continue; + } + + // strip consecutive `/**/` + while (rest.slice(0, 3) === '/**') { + const after = input[state.index + 4]; + if (after && after !== '/') { + break; + } + rest = rest.slice(3); + consume('/**', 3); + } + + if (prior.type === 'bos' && eos()) { + prev.type = 'globstar'; + prev.value += value; + prev.output = globstar(opts); + state.output = prev.output; + state.globstar = true; + consume(value); + continue; + } + + if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) { + state.output = state.output.slice(0, -(prior.output + prev.output).length); + prior.output = `(?:${prior.output}`; + + prev.type = 'globstar'; + prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)'); + prev.value += value; + state.globstar = true; + state.output += prior.output + prev.output; + consume(value); + continue; + } + + if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') { + const end = rest[1] !== void 0 ? '|$' : ''; + + state.output = state.output.slice(0, -(prior.output + prev.output).length); + prior.output = `(?:${prior.output}`; + + prev.type = 'globstar'; + prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`; + prev.value += value; + + state.output += prior.output + prev.output; + state.globstar = true; + + consume(value + advance()); + + push({ type: 'slash', value: '/', output: '' }); + continue; + } + + if (prior.type === 'bos' && rest[0] === '/') { + prev.type = 'globstar'; + prev.value += value; + prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`; + state.output = prev.output; + state.globstar = true; + consume(value + advance()); + push({ type: 'slash', value: '/', output: '' }); + continue; + } + + // remove single star from output + state.output = state.output.slice(0, -prev.output.length); + + // reset previous token to globstar + prev.type = 'globstar'; + prev.output = globstar(opts); + prev.value += value; + + // reset output with globstar + state.output += prev.output; + state.globstar = true; + consume(value); + continue; + } + + const token = { type: 'star', value, output: star }; + + if (opts.bash === true) { + token.output = '.*?'; + if (prev.type === 'bos' || prev.type === 'slash') { + token.output = nodot + token.output; + } + push(token); + continue; + } + + if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) { + token.output = value; + push(token); + continue; + } + + if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') { + if (prev.type === 'dot') { + state.output += NO_DOT_SLASH; + prev.output += NO_DOT_SLASH; + + } else if (opts.dot === true) { + state.output += NO_DOTS_SLASH; + prev.output += NO_DOTS_SLASH; + + } else { + state.output += nodot; + prev.output += nodot; + } + + if (peek() !== '*') { + state.output += ONE_CHAR; + prev.output += ONE_CHAR; + } + } + + push(token); + } + + while (state.brackets > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']')); + state.output = utils.escapeLast(state.output, '['); + decrement('brackets'); + } + + while (state.parens > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')')); + state.output = utils.escapeLast(state.output, '('); + decrement('parens'); + } + + while (state.braces > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}')); + state.output = utils.escapeLast(state.output, '{'); + decrement('braces'); + } + + if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) { + push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` }); + } + + // rebuild the output if we had to backtrack at any point + if (state.backtrack === true) { + state.output = ''; + + for (const token of state.tokens) { + state.output += token.output != null ? token.output : token.value; + + if (token.suffix) { + state.output += token.suffix; + } + } + } + + return state; +}; + +/** + * Fast paths for creating regular expressions for common glob patterns. + * This can significantly speed up processing and has very little downside + * impact when none of the fast paths match. + */ + +parse.fastpaths = (input, options) => { + const opts = { ...options }; + const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + const len = input.length; + if (len > max) { + throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); + } + + input = REPLACEMENTS[input] || input; + const win32 = utils.isWindows(options); + + // create constants based on platform, for windows or posix + const { + DOT_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + DOTS_SLASH, + NO_DOT, + NO_DOTS, + NO_DOTS_SLASH, + STAR, + START_ANCHOR + } = constants.globChars(win32); + + const nodot = opts.dot ? NO_DOTS : NO_DOT; + const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT; + const capture = opts.capture ? '' : '?:'; + const state = { negated: false, prefix: '' }; + let star = opts.bash === true ? '.*?' : STAR; + + if (opts.capture) { + star = `(${star})`; + } + + const globstar = opts => { + if (opts.noglobstar === true) return star; + return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; + }; + + const create = str => { + switch (str) { + case '*': + return `${nodot}${ONE_CHAR}${star}`; + + case '.*': + return `${DOT_LITERAL}${ONE_CHAR}${star}`; + + case '*.*': + return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; + + case '*/*': + return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`; + + case '**': + return nodot + globstar(opts); + + case '**/*': + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`; + + case '**/*.*': + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; + + case '**/.*': + return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`; + + default: { + const match = /^(.*?)\.(\w+)$/.exec(str); + if (!match) return; + + const source = create(match[1]); + if (!source) return; + + return source + DOT_LITERAL + match[2]; + } + } + }; + + const output = utils.removePrefix(input, state); + let source = create(output); + + if (source && opts.strictSlashes !== true) { + source += `${SLASH_LITERAL}?`; + } + + return source; +}; + +module.exports = parse; diff --git a/project starter code/node_modules/picomatch/lib/picomatch.js b/project starter code/node_modules/picomatch/lib/picomatch.js new file mode 100644 index 00000000..782d8094 --- /dev/null +++ b/project starter code/node_modules/picomatch/lib/picomatch.js @@ -0,0 +1,342 @@ +'use strict'; + +const path = require('path'); +const scan = require('./scan'); +const parse = require('./parse'); +const utils = require('./utils'); +const constants = require('./constants'); +const isObject = val => val && typeof val === 'object' && !Array.isArray(val); + +/** + * Creates a matcher function from one or more glob patterns. The + * returned function takes a string to match as its first argument, + * and returns true if the string is a match. The returned matcher + * function also takes a boolean as the second argument that, when true, + * returns an object with additional information. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch(glob[, options]); + * + * const isMatch = picomatch('*.!(*a)'); + * console.log(isMatch('a.a')); //=> false + * console.log(isMatch('a.b')); //=> true + * ``` + * @name picomatch + * @param {String|Array} `globs` One or more glob patterns. + * @param {Object=} `options` + * @return {Function=} Returns a matcher function. + * @api public + */ + +const picomatch = (glob, options, returnState = false) => { + if (Array.isArray(glob)) { + const fns = glob.map(input => picomatch(input, options, returnState)); + const arrayMatcher = str => { + for (const isMatch of fns) { + const state = isMatch(str); + if (state) return state; + } + return false; + }; + return arrayMatcher; + } + + const isState = isObject(glob) && glob.tokens && glob.input; + + if (glob === '' || (typeof glob !== 'string' && !isState)) { + throw new TypeError('Expected pattern to be a non-empty string'); + } + + const opts = options || {}; + const posix = utils.isWindows(options); + const regex = isState + ? picomatch.compileRe(glob, options) + : picomatch.makeRe(glob, options, false, true); + + const state = regex.state; + delete regex.state; + + let isIgnored = () => false; + if (opts.ignore) { + const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; + isIgnored = picomatch(opts.ignore, ignoreOpts, returnState); + } + + const matcher = (input, returnObject = false) => { + const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix }); + const result = { glob, state, regex, posix, input, output, match, isMatch }; + + if (typeof opts.onResult === 'function') { + opts.onResult(result); + } + + if (isMatch === false) { + result.isMatch = false; + return returnObject ? result : false; + } + + if (isIgnored(input)) { + if (typeof opts.onIgnore === 'function') { + opts.onIgnore(result); + } + result.isMatch = false; + return returnObject ? result : false; + } + + if (typeof opts.onMatch === 'function') { + opts.onMatch(result); + } + return returnObject ? result : true; + }; + + if (returnState) { + matcher.state = state; + } + + return matcher; +}; + +/** + * Test `input` with the given `regex`. This is used by the main + * `picomatch()` function to test the input string. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.test(input, regex[, options]); + * + * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); + * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } + * ``` + * @param {String} `input` String to test. + * @param {RegExp} `regex` + * @return {Object} Returns an object with matching info. + * @api public + */ + +picomatch.test = (input, regex, options, { glob, posix } = {}) => { + if (typeof input !== 'string') { + throw new TypeError('Expected input to be a string'); + } + + if (input === '') { + return { isMatch: false, output: '' }; + } + + const opts = options || {}; + const format = opts.format || (posix ? utils.toPosixSlashes : null); + let match = input === glob; + let output = (match && format) ? format(input) : input; + + if (match === false) { + output = format ? format(input) : input; + match = output === glob; + } + + if (match === false || opts.capture === true) { + if (opts.matchBase === true || opts.basename === true) { + match = picomatch.matchBase(input, regex, options, posix); + } else { + match = regex.exec(output); + } + } + + return { isMatch: Boolean(match), match, output }; +}; + +/** + * Match the basename of a filepath. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.matchBase(input, glob[, options]); + * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true + * ``` + * @param {String} `input` String to test. + * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe). + * @return {Boolean} + * @api public + */ + +picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => { + const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options); + return regex.test(path.basename(input)); +}; + +/** + * Returns true if **any** of the given glob `patterns` match the specified `string`. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.isMatch(string, patterns[, options]); + * + * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true + * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false + * ``` + * @param {String|Array} str The string to test. + * @param {String|Array} patterns One or more glob patterns to use for matching. + * @param {Object} [options] See available [options](#options). + * @return {Boolean} Returns true if any patterns match `str` + * @api public + */ + +picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); + +/** + * Parse a glob pattern to create the source string for a regular + * expression. + * + * ```js + * const picomatch = require('picomatch'); + * const result = picomatch.parse(pattern[, options]); + * ``` + * @param {String} `pattern` + * @param {Object} `options` + * @return {Object} Returns an object with useful properties and output to be used as a regex source string. + * @api public + */ + +picomatch.parse = (pattern, options) => { + if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options)); + return parse(pattern, { ...options, fastpaths: false }); +}; + +/** + * Scan a glob pattern to separate the pattern into segments. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.scan(input[, options]); + * + * const result = picomatch.scan('!./foo/*.js'); + * console.log(result); + * { prefix: '!./', + * input: '!./foo/*.js', + * start: 3, + * base: 'foo', + * glob: '*.js', + * isBrace: false, + * isBracket: false, + * isGlob: true, + * isExtglob: false, + * isGlobstar: false, + * negated: true } + * ``` + * @param {String} `input` Glob pattern to scan. + * @param {Object} `options` + * @return {Object} Returns an object with + * @api public + */ + +picomatch.scan = (input, options) => scan(input, options); + +/** + * Compile a regular expression from the `state` object returned by the + * [parse()](#parse) method. + * + * @param {Object} `state` + * @param {Object} `options` + * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser. + * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. + * @return {RegExp} + * @api public + */ + +picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => { + if (returnOutput === true) { + return state.output; + } + + const opts = options || {}; + const prepend = opts.contains ? '' : '^'; + const append = opts.contains ? '' : '$'; + + let source = `${prepend}(?:${state.output})${append}`; + if (state && state.negated === true) { + source = `^(?!${source}).*$`; + } + + const regex = picomatch.toRegex(source, options); + if (returnState === true) { + regex.state = state; + } + + return regex; +}; + +/** + * Create a regular expression from a parsed glob pattern. + * + * ```js + * const picomatch = require('picomatch'); + * const state = picomatch.parse('*.js'); + * // picomatch.compileRe(state[, options]); + * + * console.log(picomatch.compileRe(state)); + * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ + * ``` + * @param {String} `state` The object returned from the `.parse` method. + * @param {Object} `options` + * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. + * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression. + * @return {RegExp} Returns a regex created from the given pattern. + * @api public + */ + +picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => { + if (!input || typeof input !== 'string') { + throw new TypeError('Expected a non-empty string'); + } + + let parsed = { negated: false, fastpaths: true }; + + if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) { + parsed.output = parse.fastpaths(input, options); + } + + if (!parsed.output) { + parsed = parse(input, options); + } + + return picomatch.compileRe(parsed, options, returnOutput, returnState); +}; + +/** + * Create a regular expression from the given regex source string. + * + * ```js + * const picomatch = require('picomatch'); + * // picomatch.toRegex(source[, options]); + * + * const { output } = picomatch.parse('*.js'); + * console.log(picomatch.toRegex(output)); + * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ + * ``` + * @param {String} `source` Regular expression source string. + * @param {Object} `options` + * @return {RegExp} + * @api public + */ + +picomatch.toRegex = (source, options) => { + try { + const opts = options || {}; + return new RegExp(source, opts.flags || (opts.nocase ? 'i' : '')); + } catch (err) { + if (options && options.debug === true) throw err; + return /$^/; + } +}; + +/** + * Picomatch constants. + * @return {Object} + */ + +picomatch.constants = constants; + +/** + * Expose "picomatch" + */ + +module.exports = picomatch; diff --git a/project starter code/node_modules/picomatch/lib/scan.js b/project starter code/node_modules/picomatch/lib/scan.js new file mode 100644 index 00000000..e59cd7a1 --- /dev/null +++ b/project starter code/node_modules/picomatch/lib/scan.js @@ -0,0 +1,391 @@ +'use strict'; + +const utils = require('./utils'); +const { + CHAR_ASTERISK, /* * */ + CHAR_AT, /* @ */ + CHAR_BACKWARD_SLASH, /* \ */ + CHAR_COMMA, /* , */ + CHAR_DOT, /* . */ + CHAR_EXCLAMATION_MARK, /* ! */ + CHAR_FORWARD_SLASH, /* / */ + CHAR_LEFT_CURLY_BRACE, /* { */ + CHAR_LEFT_PARENTHESES, /* ( */ + CHAR_LEFT_SQUARE_BRACKET, /* [ */ + CHAR_PLUS, /* + */ + CHAR_QUESTION_MARK, /* ? */ + CHAR_RIGHT_CURLY_BRACE, /* } */ + CHAR_RIGHT_PARENTHESES, /* ) */ + CHAR_RIGHT_SQUARE_BRACKET /* ] */ +} = require('./constants'); + +const isPathSeparator = code => { + return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; +}; + +const depth = token => { + if (token.isPrefix !== true) { + token.depth = token.isGlobstar ? Infinity : 1; + } +}; + +/** + * Quickly scans a glob pattern and returns an object with a handful of + * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists), + * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not + * with `!(`) and `negatedExtglob` (true if the path starts with `!(`). + * + * ```js + * const pm = require('picomatch'); + * console.log(pm.scan('foo/bar/*.js')); + * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' } + * ``` + * @param {String} `str` + * @param {Object} `options` + * @return {Object} Returns an object with tokens and regex source string. + * @api public + */ + +const scan = (input, options) => { + const opts = options || {}; + + const length = input.length - 1; + const scanToEnd = opts.parts === true || opts.scanToEnd === true; + const slashes = []; + const tokens = []; + const parts = []; + + let str = input; + let index = -1; + let start = 0; + let lastIndex = 0; + let isBrace = false; + let isBracket = false; + let isGlob = false; + let isExtglob = false; + let isGlobstar = false; + let braceEscaped = false; + let backslashes = false; + let negated = false; + let negatedExtglob = false; + let finished = false; + let braces = 0; + let prev; + let code; + let token = { value: '', depth: 0, isGlob: false }; + + const eos = () => index >= length; + const peek = () => str.charCodeAt(index + 1); + const advance = () => { + prev = code; + return str.charCodeAt(++index); + }; + + while (index < length) { + code = advance(); + let next; + + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + code = advance(); + + if (code === CHAR_LEFT_CURLY_BRACE) { + braceEscaped = true; + } + continue; + } + + if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) { + braces++; + + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + + if (code === CHAR_LEFT_CURLY_BRACE) { + braces++; + continue; + } + + if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) { + isBrace = token.isBrace = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (braceEscaped !== true && code === CHAR_COMMA) { + isBrace = token.isBrace = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (code === CHAR_RIGHT_CURLY_BRACE) { + braces--; + + if (braces === 0) { + braceEscaped = false; + isBrace = token.isBrace = true; + finished = true; + break; + } + } + } + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (code === CHAR_FORWARD_SLASH) { + slashes.push(index); + tokens.push(token); + token = { value: '', depth: 0, isGlob: false }; + + if (finished === true) continue; + if (prev === CHAR_DOT && index === (start + 1)) { + start += 2; + continue; + } + + lastIndex = index + 1; + continue; + } + + if (opts.noext !== true) { + const isExtglobChar = code === CHAR_PLUS + || code === CHAR_AT + || code === CHAR_ASTERISK + || code === CHAR_QUESTION_MARK + || code === CHAR_EXCLAMATION_MARK; + + if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) { + isGlob = token.isGlob = true; + isExtglob = token.isExtglob = true; + finished = true; + if (code === CHAR_EXCLAMATION_MARK && index === start) { + negatedExtglob = true; + } + + if (scanToEnd === true) { + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + code = advance(); + continue; + } + + if (code === CHAR_RIGHT_PARENTHESES) { + isGlob = token.isGlob = true; + finished = true; + break; + } + } + continue; + } + break; + } + } + + if (code === CHAR_ASTERISK) { + if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + break; + } + + if (code === CHAR_QUESTION_MARK) { + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + break; + } + + if (code === CHAR_LEFT_SQUARE_BRACKET) { + while (eos() !== true && (next = advance())) { + if (next === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + + if (next === CHAR_RIGHT_SQUARE_BRACKET) { + isBracket = token.isBracket = true; + isGlob = token.isGlob = true; + finished = true; + break; + } + } + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) { + negated = token.negated = true; + start++; + continue; + } + + if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) { + isGlob = token.isGlob = true; + + if (scanToEnd === true) { + while (eos() !== true && (code = advance())) { + if (code === CHAR_LEFT_PARENTHESES) { + backslashes = token.backslashes = true; + code = advance(); + continue; + } + + if (code === CHAR_RIGHT_PARENTHESES) { + finished = true; + break; + } + } + continue; + } + break; + } + + if (isGlob === true) { + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + } + + if (opts.noext === true) { + isExtglob = false; + isGlob = false; + } + + let base = str; + let prefix = ''; + let glob = ''; + + if (start > 0) { + prefix = str.slice(0, start); + str = str.slice(start); + lastIndex -= start; + } + + if (base && isGlob === true && lastIndex > 0) { + base = str.slice(0, lastIndex); + glob = str.slice(lastIndex); + } else if (isGlob === true) { + base = ''; + glob = str; + } else { + base = str; + } + + if (base && base !== '' && base !== '/' && base !== str) { + if (isPathSeparator(base.charCodeAt(base.length - 1))) { + base = base.slice(0, -1); + } + } + + if (opts.unescape === true) { + if (glob) glob = utils.removeBackslashes(glob); + + if (base && backslashes === true) { + base = utils.removeBackslashes(base); + } + } + + const state = { + prefix, + input, + start, + base, + glob, + isBrace, + isBracket, + isGlob, + isExtglob, + isGlobstar, + negated, + negatedExtglob + }; + + if (opts.tokens === true) { + state.maxDepth = 0; + if (!isPathSeparator(code)) { + tokens.push(token); + } + state.tokens = tokens; + } + + if (opts.parts === true || opts.tokens === true) { + let prevIndex; + + for (let idx = 0; idx < slashes.length; idx++) { + const n = prevIndex ? prevIndex + 1 : start; + const i = slashes[idx]; + const value = input.slice(n, i); + if (opts.tokens) { + if (idx === 0 && start !== 0) { + tokens[idx].isPrefix = true; + tokens[idx].value = prefix; + } else { + tokens[idx].value = value; + } + depth(tokens[idx]); + state.maxDepth += tokens[idx].depth; + } + if (idx !== 0 || value !== '') { + parts.push(value); + } + prevIndex = i; + } + + if (prevIndex && prevIndex + 1 < input.length) { + const value = input.slice(prevIndex + 1); + parts.push(value); + + if (opts.tokens) { + tokens[tokens.length - 1].value = value; + depth(tokens[tokens.length - 1]); + state.maxDepth += tokens[tokens.length - 1].depth; + } + } + + state.slashes = slashes; + state.parts = parts; + } + + return state; +}; + +module.exports = scan; diff --git a/project starter code/node_modules/picomatch/lib/utils.js b/project starter code/node_modules/picomatch/lib/utils.js new file mode 100644 index 00000000..c3ca766a --- /dev/null +++ b/project starter code/node_modules/picomatch/lib/utils.js @@ -0,0 +1,64 @@ +'use strict'; + +const path = require('path'); +const win32 = process.platform === 'win32'; +const { + REGEX_BACKSLASH, + REGEX_REMOVE_BACKSLASH, + REGEX_SPECIAL_CHARS, + REGEX_SPECIAL_CHARS_GLOBAL +} = require('./constants'); + +exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); +exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); +exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str); +exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1'); +exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/'); + +exports.removeBackslashes = str => { + return str.replace(REGEX_REMOVE_BACKSLASH, match => { + return match === '\\' ? '' : match; + }); +}; + +exports.supportsLookbehinds = () => { + const segs = process.version.slice(1).split('.').map(Number); + if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) { + return true; + } + return false; +}; + +exports.isWindows = options => { + if (options && typeof options.windows === 'boolean') { + return options.windows; + } + return win32 === true || path.sep === '\\'; +}; + +exports.escapeLast = (input, char, lastIdx) => { + const idx = input.lastIndexOf(char, lastIdx); + if (idx === -1) return input; + if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1); + return `${input.slice(0, idx)}\\${input.slice(idx)}`; +}; + +exports.removePrefix = (input, state = {}) => { + let output = input; + if (output.startsWith('./')) { + output = output.slice(2); + state.prefix = './'; + } + return output; +}; + +exports.wrapOutput = (input, state = {}, options = {}) => { + const prepend = options.contains ? '' : '^'; + const append = options.contains ? '' : '$'; + + let output = `${prepend}(?:${input})${append}`; + if (state.negated === true) { + output = `(?:^(?!${output}).*$)`; + } + return output; +}; diff --git a/project starter code/node_modules/picomatch/package.json b/project starter code/node_modules/picomatch/package.json new file mode 100644 index 00000000..3db22d40 --- /dev/null +++ b/project starter code/node_modules/picomatch/package.json @@ -0,0 +1,81 @@ +{ + "name": "picomatch", + "description": "Blazing fast and accurate glob matcher written in JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.", + "version": "2.3.1", + "homepage": "https://github.com/micromatch/picomatch", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "funding": "https://github.com/sponsors/jonschlinkert", + "repository": "micromatch/picomatch", + "bugs": { + "url": "https://github.com/micromatch/picomatch/issues" + }, + "license": "MIT", + "files": [ + "index.js", + "lib" + ], + "main": "index.js", + "engines": { + "node": ">=8.6" + }, + "scripts": { + "lint": "eslint --cache --cache-location node_modules/.cache/.eslintcache --report-unused-disable-directives --ignore-path .gitignore .", + "mocha": "mocha --reporter dot", + "test": "npm run lint && npm run mocha", + "test:ci": "npm run test:cover", + "test:cover": "nyc npm run mocha" + }, + "devDependencies": { + "eslint": "^6.8.0", + "fill-range": "^7.0.1", + "gulp-format-md": "^2.0.0", + "mocha": "^6.2.2", + "nyc": "^15.0.0", + "time-require": "github:jonschlinkert/time-require" + }, + "keywords": [ + "glob", + "match", + "picomatch" + ], + "nyc": { + "reporter": [ + "html", + "lcov", + "text-summary" + ] + }, + "verb": { + "toc": { + "render": true, + "method": "preWrite", + "maxdepth": 3 + }, + "layout": "empty", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "related": { + "list": [ + "braces", + "micromatch" + ] + }, + "reflinks": [ + "braces", + "expand-brackets", + "extglob", + "fill-range", + "micromatch", + "minimatch", + "nanomatch", + "picomatch" + ] + } +} diff --git a/project starter code/node_modules/pngjs/.eslintrc.json b/project starter code/node_modules/pixelmatch/node_modules/pngjs/.eslintrc.json similarity index 100% rename from project starter code/node_modules/pngjs/.eslintrc.json rename to project starter code/node_modules/pixelmatch/node_modules/pngjs/.eslintrc.json diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/LICENSE b/project starter code/node_modules/pixelmatch/node_modules/pngjs/LICENSE new file mode 100644 index 00000000..6942e254 --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/LICENSE @@ -0,0 +1,20 @@ +pngjs2 original work Copyright (c) 2015 Luke Page & Original Contributors +pngjs derived work Copyright (c) 2012 Kuba Niegowski + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/README.md b/project starter code/node_modules/pixelmatch/node_modules/pngjs/README.md new file mode 100644 index 00000000..fcd2f0db --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/README.md @@ -0,0 +1,397 @@ +[![Build Status](https://travis-ci.org/lukeapage/pngjs.svg?branch=master)](https://travis-ci.org/lukeapage/pngjs) [![Build status](https://ci.appveyor.com/api/projects/status/tb8418jql1trkntd/branch/master?svg=true)](https://ci.appveyor.com/project/lukeapage/pngjs2/branch/master) [![Coverage Status](https://coveralls.io/repos/lukeapage/pngjs2/badge.svg?branch=master&service=github)](https://coveralls.io/github/lukeapage/pngjs2?branch=master) [![npm version](https://badge.fury.io/js/pngjs.svg)](http://badge.fury.io/js/pngjs) + +pngjs +======== + +[![Greenkeeper badge](https://badges.greenkeeper.io/lukeapage/pngjs.svg)](https://greenkeeper.io/) +Simple PNG encoder/decoder for Node.js with no dependencies. + +Based on the original [pngjs](https://github.com/niegowski/node-pngjs) with the follow enhancements. + + * Support for reading 1,2,4 & 16 bit files + * Support for reading interlace files + * Support for reading `tTRNS` transparent colours + * Support for writing colortype 0 (grayscale), colortype 2 (RGB), colortype 4 (grayscale alpha) and colortype 6 (RGBA) + * Sync interface as well as async + * API compatible with pngjs and node-pngjs + +Known lack of support for: + + * Extended PNG e.g. Animation + * Writing in colortype 3 (indexed color) + +# Table of Contents +* [Requirements](#requirements) +* [Comparison Table](#comparison-table) +* [Tests](#tests) +* [Installation](#installation) +* [Browser](#browser) +* [Example](#example) +* [Async API](#async-api) +* [Sync API](#sync-api) +* [Changelog](#changelog) + +Requirements +============ + +* Node.js v4 (use older v2.3.0 for 0.10/0.12/iojs support) + +Comparison Table +================ + +Name | Forked From | Sync | Async | 16 Bit | 1/2/4 Bit | Interlace | Gamma | Encodes | Tested +---------|--------------|------|-------|--------|-----------|-----------|-------|---------|-------- +pngjs | | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes +node-png | pngjs | No | Yes | No | No | No | Hidden| Yes | Manual +png-coder| pngjs | No | Yes | Yes | No | No | Hidden| Yes | Manual +pngparse | | No | Yes | No | Yes | No | No | No | Yes +pngparse-sync | pngparse| Yes | No | No | Yes | No | No | No | Yes +png-async| | No | Yes | No | No | No | No | Yes | Yes +png-js | | No | Yes | No | No | No | No | No | No + + +Native C++ node decoders: + * png + * png-sync (sync version of above) + * pixel-png + * png-img + +Tests +===== + +Tested using [PNG Suite](http://www.schaik.com/pngsuite/). We read every file into pngjs, output it in standard 8bit colour, synchronously and asynchronously, then compare the original with the newly saved images. + +To run the tests, fetch the repo (tests are not distributed via npm) and install with `npm i`, run `npm test`. + +The only thing not converted is gamma correction - this is because multiple vendors will do gamma correction differently, so the tests will have different results on different browsers. + +In addition we use a tolerance of 3 for 16 bit images in PhantomJS because PhantomJS seems to have non-compliant rules for downscaling 16 bit images. + +Installation +=============== +``` +$ npm install pngjs --save +``` + +Browser +=========== +The package has been build with a [Browserify](browserify.org) version (`npm run browserify`) and you can use the browser version by including in your code: + +``` +import { PNG } from 'pngjs/browser'; +``` + +Example +========== +```js +var fs = require('fs'), + PNG = require('pngjs').PNG; + +fs.createReadStream('in.png') + .pipe(new PNG({ + filterType: 4 + })) + .on('parsed', function() { + + for (var y = 0; y < this.height; y++) { + for (var x = 0; x < this.width; x++) { + var idx = (this.width * y + x) << 2; + + // invert color + this.data[idx] = 255 - this.data[idx]; + this.data[idx+1] = 255 - this.data[idx+1]; + this.data[idx+2] = 255 - this.data[idx+2]; + + // and reduce opacity + this.data[idx+3] = this.data[idx+3] >> 1; + } + } + + this.pack().pipe(fs.createWriteStream('out.png')); + }); +``` +For more examples see `examples` folder. + +Async API +================ + +As input any color type is accepted (grayscale, rgb, palette, grayscale with alpha, rgb with alpha) but 8 bit per sample (channel) is the only supported bit depth. Interlaced mode is not supported. + +## Class: PNG +`PNG` is readable and writable `Stream`. + + +### Options +- `width` - use this with `height` if you want to create png from scratch +- `height` - as above +- `checkCRC` - whether parser should be strict about checksums in source stream (default: `true`) +- `deflateChunkSize` - chunk size used for deflating data chunks, this should be power of 2 and must not be less than 256 and more than 32*1024 (default: 32 kB) +- `deflateLevel` - compression level for deflate (default: 9) +- `deflateStrategy` - compression strategy for deflate (default: 3) +- `deflateFactory` - deflate stream factory (default: `zlib.createDeflate`) +- `filterType` - png filtering method for scanlines (default: -1 => auto, accepts array of numbers 0-4) +- `colorType` - the output colorType - see constants. 0 = grayscale, no alpha, 2 = color, no alpha, 4 = grayscale & alpha, 6 = color & alpha. Default currently 6, but in the future may calculate best mode. +- `inputColorType` - the input colorType - see constants. Default is 6 (RGBA) +- `bitDepth` - the bitDepth of the output, 8 or 16 bits. Input data is expected to have this bit depth. +16 bit data is expected in the system endianness (Default: 8) +- `inputHasAlpha` - whether the input bitmap has 4 bytes per pixel (rgb and alpha) or 3 (rgb - no alpha). +- `bgColor` - an object containing red, green, and blue values between 0 and 255 +that is used when packing a PNG if alpha is not to be included (default: 255,255,255) + + +### Event "metadata" +`function(metadata) { }` +Image's header has been parsed, metadata contains this information: +- `width` image size in pixels +- `height` image size in pixels +- `palette` image is paletted +- `color` image is not grayscale +- `alpha` image contains alpha channel +- `interlace` image is interlaced + + +### Event: "parsed" +`function(data) { }` +Input image has been completely parsed, `data` is complete and ready for modification. + + +### Event: "error" +`function(error) { }` + + +### png.parse(data, [callback]) +Parses PNG file data. Can be `String` or `Buffer`. Alternatively you can stream data to instance of PNG. + +Optional `callback` is once called on `error` or `parsed`. The callback gets +two arguments `(err, data)`. + +Returns `this` for method chaining. + +#### Example +```js +new PNG({ filterType:4 }).parse( imageData, function(error, data) +{ + console.log(error, data) +}); +``` + +### png.pack() +Starts converting data to PNG file Stream. + +Returns `this` for method chaining. + + +### png.bitblt(dst, sx, sy, w, h, dx, dy) +Helper for image manipulation, copies a rectangle of pixels from current (i.e. the source) image (`sx`, `sy`, `w`, `h`) to `dst` image (at `dx`, `dy`). + +Returns `this` for method chaining. + +For example, the following code copies the top-left 100x50 px of `in.png` into dst and writes it to `out.png`: +```js +var dst = new PNG({width: 100, height: 50}); +fs.createReadStream('in.png') + .pipe(new PNG()) + .on('parsed', function() { + this.bitblt(dst, 0, 0, 100, 50, 0, 0); + dst.pack().pipe(fs.createWriteStream('out.png')); + }); +``` + +### Property: adjustGamma() +Helper that takes data and adjusts it to be gamma corrected. Note that it is not 100% reliable with transparent colours because that requires knowing the background colour the bitmap is rendered on to. + +In tests against PNG suite it compared 100% with chrome on all 8 bit and below images. On IE there were some differences. + +The following example reads a file, adjusts the gamma (which sets the gamma to 0) and writes it out again, effectively removing any gamma correction from the image. + +```js +fs.createReadStream('in.png') + .pipe(new PNG()) + .on('parsed', function() { + this.adjustGamma(); + this.pack().pipe(fs.createWriteStream('out.png')); + }); +``` + +### Property: width +Width of image in pixels + + +### Property: height +Height of image in pixels + + +### Property: data +Buffer of image pixel data. Every pixel consists 4 bytes: R, G, B, A (opacity). + + +### Property: gamma +Gamma of image (0 if not specified) + +## Packing a PNG and removing alpha (RGBA to RGB) + +When removing the alpha channel from an image, there needs to be a background color to correctly +convert each pixel's transparency to the appropriate RGB value. By default, pngjs will flatten +the image against a white background. You can override this in the options: + +```js +var fs = require('fs'), + PNG = require('pngjs').PNG; + +fs.createReadStream('in.png') + .pipe(new PNG({ + colorType: 2, + bgColor: { + red: 0, + green: 255, + blue: 0 + } + })) + .on('parsed', function() { + this.pack().pipe(fs.createWriteStream('out.png')); + }); +``` + +# Sync API + +## PNG.sync + +### PNG.sync.read(buffer) + +Take a buffer and returns a PNG image. The properties on the image include the meta data and `data` as per the async API above. + +``` +var data = fs.readFileSync('in.png'); +var png = PNG.sync.read(data); +``` + +### PNG.sync.write(png) + +Take a PNG image and returns a buffer. The properties on the image include the meta data and `data` as per the async API above. + +``` +var data = fs.readFileSync('in.png'); +var png = PNG.sync.read(data); +var options = { colorType: 6 }; +var buffer = PNG.sync.write(png, options); +fs.writeFileSync('out.png', buffer); +``` + +### PNG.adjustGamma(src) + +Adjusts the gamma of a sync image. See the async adjustGamma. + +``` +var data = fs.readFileSync('in.png'); +var png = PNG.sync.read(data); +PNG.adjustGamma(png); +``` + + +Changelog +============ + +### 3.4.0 - 09/03/2019 + +- Include whether the png has alpha in the meta data +- emit an error if the image is truncated instead of hanging +- Add a browserified version +- speed up some mapping functions + +### 3.3.3 - 19/04/2018 + +- Real fix for node 9 + +### 3.3.2 - 16/02/2018 + +- Fix for node 9 + +### 3.3.1 - 15/11/2017 + +- Bugfixes and removal of es6 + +### 3.3.0 + +- Add writing 16 bit channels and support for grayscale input + +### 3.2.0 - 30/04/2017 + +- Support for encoding 8-bit grayscale images + +### 3.1.0 - 30/04/2017 + - Support for pngs with zlib chunks that are malformed after valid data + +### 3.0.1 - 16/02/2017 + - Fix single pixel pngs + +### 3.0.0 - 03/08/2016 + - Drop support for node below v4 and iojs. Pin to 2.3.0 to use with old, unsupported or patched node versions. + +### 2.3.0 - 22/04/2016 + - Support for sync in node 0.10 + +### 2.2.0 - 04/12/2015 + - Add sync write api + - Fix newfile example + - Correct comparison table + +### 2.1.0 - 28/10/2015 + - rename package to pngjs + - added 'bgColor' option + +### 2.0.0 - 08/10/2015 + - fixes to readme + - *breaking change* - bitblt on the png prototype now doesn't take a unused, unnecessary src first argument + +### 1.2.0 - 13/09/2015 + - support passing colorType to write PNG's and writing bitmaps without alpha information + +### 1.1.0 - 07/09/2015 + - support passing a deflate factory for controlled compression + +### 1.0.2 - 22/08/2015 + - Expose all PNG creation info + +### 1.0.1 - 21/08/2015 + - Fix non square interlaced files + +### 1.0.0 - 08/08/2015 + - More tests + - source linted + - maintainability refactorings + - async API - exceptions in reading now emit warnings + - documentation improvement - sync api now documented, adjustGamma documented + - breaking change - gamma chunk is now written. previously a read then write would destroy gamma information, now it is persisted. + +### 0.0.3 - 03/08/2015 + - Error handling fixes + - ignore files for smaller npm footprint + +### 0.0.2 - 02/08/2015 + - Bugfixes to interlacing, support for transparent colours + +### 0.0.1 - 02/08/2015 + - Initial release, see pngjs for older changelog. + +License +========= + +(The MIT License) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/browser.js b/project starter code/node_modules/pixelmatch/node_modules/pngjs/browser.js new file mode 100644 index 00000000..72c92164 --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/browser.js @@ -0,0 +1,15624 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.png = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i= data.length) { + throw new Error('Ran out of data'); + } + + var pixel = data[rawPos]; + pxData[pxPos] = pixel; + pxData[pxPos + 1] = pixel; + pxData[pxPos + 2] = pixel; + pxData[pxPos + 3] = data[rawPos + 1]; + }, + + // 3 - RGB + // 0: 0, 1: 1, 2: 2, 3: 0xff + function(pxData, data, pxPos, rawPos) { + if (rawPos + 2 >= data.length) { + throw new Error('Ran out of data'); + } + + pxData[pxPos] = data[rawPos]; + pxData[pxPos + 1] = data[rawPos + 1]; + pxData[pxPos + 2] = data[rawPos + 2]; + pxData[pxPos + 3] = 0xff; + }, + + // 4 - RGBA + // 0: 0, 1: 1, 2: 2, 3: 3 + function(pxData, data, pxPos, rawPos) { + if (rawPos + 3 >= data.length) { + throw new Error('Ran out of data'); + } + + pxData[pxPos] = data[rawPos]; + pxData[pxPos + 1] = data[rawPos + 1]; + pxData[pxPos + 2] = data[rawPos + 2]; + pxData[pxPos + 3] = data[rawPos + 3]; + } +]; + +var pixelBppCustomMapper = [ + // 0 - dummy entry + function() {}, + + // 1 - L + // 0: 0, 1: 0, 2: 0, 3: 0xff + function(pxData, pixelData, pxPos, maxBit) { + var pixel = pixelData[0]; + pxData[pxPos] = pixel; + pxData[pxPos + 1] = pixel; + pxData[pxPos + 2] = pixel; + pxData[pxPos + 3] = maxBit; + }, + + // 2 - LA + // 0: 0, 1: 0, 2: 0, 3: 1 + function(pxData, pixelData, pxPos) { + var pixel = pixelData[0]; + pxData[pxPos] = pixel; + pxData[pxPos + 1] = pixel; + pxData[pxPos + 2] = pixel; + pxData[pxPos + 3] = pixelData[1]; + }, + + // 3 - RGB + // 0: 0, 1: 1, 2: 2, 3: 0xff + function(pxData, pixelData, pxPos, maxBit) { + pxData[pxPos] = pixelData[0]; + pxData[pxPos + 1] = pixelData[1]; + pxData[pxPos + 2] = pixelData[2]; + pxData[pxPos + 3] = maxBit; + }, + + // 4 - RGBA + // 0: 0, 1: 1, 2: 2, 3: 3 + function(pxData, pixelData, pxPos) { + pxData[pxPos] = pixelData[0]; + pxData[pxPos + 1] = pixelData[1]; + pxData[pxPos + 2] = pixelData[2]; + pxData[pxPos + 3] = pixelData[3]; + } +]; + +function bitRetriever(data, depth) { + + var leftOver = []; + var i = 0; + + function split() { + if (i === data.length) { + throw new Error('Ran out of data'); + } + var byte = data[i]; + i++; + var byte8, byte7, byte6, byte5, byte4, byte3, byte2, byte1; + switch (depth) { + default: + throw new Error('unrecognised depth'); + case 16: + byte2 = data[i]; + i++; + leftOver.push(((byte << 8) + byte2)); + break; + case 4: + byte2 = byte & 0x0f; + byte1 = byte >> 4; + leftOver.push(byte1, byte2); + break; + case 2: + byte4 = byte & 3; + byte3 = byte >> 2 & 3; + byte2 = byte >> 4 & 3; + byte1 = byte >> 6 & 3; + leftOver.push(byte1, byte2, byte3, byte4); + break; + case 1: + byte8 = byte & 1; + byte7 = byte >> 1 & 1; + byte6 = byte >> 2 & 1; + byte5 = byte >> 3 & 1; + byte4 = byte >> 4 & 1; + byte3 = byte >> 5 & 1; + byte2 = byte >> 6 & 1; + byte1 = byte >> 7 & 1; + leftOver.push(byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8); + break; + } + } + + return { + get: function(count) { + while (leftOver.length < count) { + split(); + } + var returner = leftOver.slice(0, count); + leftOver = leftOver.slice(count); + return returner; + }, + resetAfterLine: function() { + leftOver.length = 0; + }, + end: function() { + if (i !== data.length) { + throw new Error('extra data found'); + } + } + }; +} + +function mapImage8Bit(image, pxData, getPxPos, bpp, data, rawPos) { // eslint-disable-line max-params + var imageWidth = image.width; + var imageHeight = image.height; + var imagePass = image.index; + for (var y = 0; y < imageHeight; y++) { + for (var x = 0; x < imageWidth; x++) { + var pxPos = getPxPos(x, y, imagePass); + pixelBppMapper[bpp](pxData, data, pxPos, rawPos); + rawPos += bpp; //eslint-disable-line no-param-reassign + } + } + return rawPos; +} + +function mapImageCustomBit(image, pxData, getPxPos, bpp, bits, maxBit) { // eslint-disable-line max-params + var imageWidth = image.width; + var imageHeight = image.height; + var imagePass = image.index; + for (var y = 0; y < imageHeight; y++) { + for (var x = 0; x < imageWidth; x++) { + var pixelData = bits.get(bpp); + var pxPos = getPxPos(x, y, imagePass); + pixelBppCustomMapper[bpp](pxData, pixelData, pxPos, maxBit); + } + bits.resetAfterLine(); + } +} + +exports.dataToBitMap = function(data, bitmapInfo) { + + var width = bitmapInfo.width; + var height = bitmapInfo.height; + var depth = bitmapInfo.depth; + var bpp = bitmapInfo.bpp; + var interlace = bitmapInfo.interlace; + + if (depth !== 8) { + var bits = bitRetriever(data, depth); + } + var pxData; + if (depth <= 8) { + pxData = new Buffer(width * height * 4); + } + else { + pxData = new Uint16Array(width * height * 4); + } + var maxBit = Math.pow(2, depth) - 1; + var rawPos = 0; + var images; + var getPxPos; + + if (interlace) { + images = interlaceUtils.getImagePasses(width, height); + getPxPos = interlaceUtils.getInterlaceIterator(width, height); + } + else { + var nonInterlacedPxPos = 0; + getPxPos = function() { + var returner = nonInterlacedPxPos; + nonInterlacedPxPos += 4; + return returner; + }; + images = [{ width: width, height: height }]; + } + + for (var imageIndex = 0; imageIndex < images.length; imageIndex++) { + if (depth === 8) { + rawPos = mapImage8Bit(images[imageIndex], pxData, getPxPos, bpp, data, rawPos); + } + else { + mapImageCustomBit(images[imageIndex], pxData, getPxPos, bpp, bits, maxBit); + } + } + if (depth === 8) { + if (rawPos !== data.length) { + throw new Error('extra data found'); + } + } + else { + bits.end(); + } + + return pxData; +}; + +}).call(this,require("buffer").Buffer) +},{"./interlace":11,"buffer":32}],2:[function(require,module,exports){ +(function (Buffer){ +'use strict'; + +var constants = require('./constants'); + +module.exports = function(dataIn, width, height, options) { + var outHasAlpha = [constants.COLORTYPE_COLOR_ALPHA, constants.COLORTYPE_ALPHA].indexOf(options.colorType) !== -1; + if (options.colorType === options.inputColorType) { + var bigEndian = (function() { + var buffer = new ArrayBuffer(2); + new DataView(buffer).setInt16(0, 256, true /* littleEndian */); + // Int16Array uses the platform's endianness. + return new Int16Array(buffer)[0] !== 256; + })(); + // If no need to convert to grayscale and alpha is present/absent in both, take a fast route + if (options.bitDepth === 8 || (options.bitDepth === 16 && bigEndian)) { + return dataIn; + } + } + + // map to a UInt16 array if data is 16bit, fix endianness below + var data = options.bitDepth !== 16 ? dataIn : new Uint16Array(dataIn.buffer); + + var maxValue = 255; + var inBpp = constants.COLORTYPE_TO_BPP_MAP[options.inputColorType]; + if (inBpp === 4 && !options.inputHasAlpha) { + inBpp = 3; + } + var outBpp = constants.COLORTYPE_TO_BPP_MAP[options.colorType]; + if (options.bitDepth === 16) { + maxValue = 65535; + outBpp *= 2; + } + var outData = new Buffer(width * height * outBpp); + + var inIndex = 0; + var outIndex = 0; + + var bgColor = options.bgColor || {}; + if (bgColor.red === undefined) { + bgColor.red = maxValue; + } + if (bgColor.green === undefined) { + bgColor.green = maxValue; + } + if (bgColor.blue === undefined) { + bgColor.blue = maxValue; + } + + function getRGBA() { + var red; + var green; + var blue; + var alpha = maxValue; + switch (options.inputColorType) { + case constants.COLORTYPE_COLOR_ALPHA: + alpha = data[inIndex + 3]; + red = data[inIndex]; + green = data[inIndex + 1]; + blue = data[inIndex + 2]; + break; + case constants.COLORTYPE_COLOR: + red = data[inIndex]; + green = data[inIndex + 1]; + blue = data[inIndex + 2]; + break; + case constants.COLORTYPE_ALPHA: + alpha = data[inIndex + 1]; + red = data[inIndex]; + green = red; + blue = red; + break; + case constants.COLORTYPE_GRAYSCALE: + red = data[inIndex]; + green = red; + blue = red; + break; + default: + throw new Error('input color type:' + options.inputColorType + ' is not supported at present'); + } + + if (options.inputHasAlpha) { + if (!outHasAlpha) { + alpha /= maxValue; + red = Math.min(Math.max(Math.round((1 - alpha) * bgColor.red + alpha * red), 0), maxValue); + green = Math.min(Math.max(Math.round((1 - alpha) * bgColor.green + alpha * green), 0), maxValue); + blue = Math.min(Math.max(Math.round((1 - alpha) * bgColor.blue + alpha * blue), 0), maxValue); + } + } + return { red: red, green: green, blue: blue, alpha: alpha }; + } + + for (var y = 0; y < height; y++) { + for (var x = 0; x < width; x++) { + var rgba = getRGBA(data, inIndex); + + switch (options.colorType) { + case constants.COLORTYPE_COLOR_ALPHA: + case constants.COLORTYPE_COLOR: + if (options.bitDepth === 8) { + outData[outIndex] = rgba.red; + outData[outIndex + 1] = rgba.green; + outData[outIndex + 2] = rgba.blue; + if (outHasAlpha) { + outData[outIndex + 3] = rgba.alpha; + } + } + else { + outData.writeUInt16BE(rgba.red, outIndex); + outData.writeUInt16BE(rgba.green, outIndex + 2); + outData.writeUInt16BE(rgba.blue, outIndex + 4); + if (outHasAlpha) { + outData.writeUInt16BE(rgba.alpha, outIndex + 6); + } + } + break; + case constants.COLORTYPE_ALPHA: + case constants.COLORTYPE_GRAYSCALE: + // Convert to grayscale and alpha + var grayscale = (rgba.red + rgba.green + rgba.blue) / 3; + if (options.bitDepth === 8) { + outData[outIndex] = grayscale; + if (outHasAlpha) { + outData[outIndex + 1] = rgba.alpha; + } + } + else { + outData.writeUInt16BE(grayscale, outIndex); + if (outHasAlpha) { + outData.writeUInt16BE(rgba.alpha, outIndex + 2); + } + } + break; + default: + throw new Error('unrecognised color Type ' + options.colorType); + } + + inIndex += inBpp; + outIndex += outBpp; + } + } + + return outData; +}; + +}).call(this,require("buffer").Buffer) +},{"./constants":4,"buffer":32}],3:[function(require,module,exports){ +(function (process,Buffer){ +'use strict'; + + +var util = require('util'); +var Stream = require('stream'); + + +var ChunkStream = module.exports = function() { + Stream.call(this); + + this._buffers = []; + this._buffered = 0; + + this._reads = []; + this._paused = false; + + this._encoding = 'utf8'; + this.writable = true; +}; +util.inherits(ChunkStream, Stream); + + +ChunkStream.prototype.read = function(length, callback) { + + this._reads.push({ + length: Math.abs(length), // if length < 0 then at most this length + allowLess: length < 0, + func: callback + }); + + process.nextTick(function() { + this._process(); + + // its paused and there is not enought data then ask for more + if (this._paused && this._reads.length > 0) { + this._paused = false; + + this.emit('drain'); + } + }.bind(this)); +}; + +ChunkStream.prototype.write = function(data, encoding) { + + if (!this.writable) { + this.emit('error', new Error('Stream not writable')); + return false; + } + + var dataBuffer; + if (Buffer.isBuffer(data)) { + dataBuffer = data; + } + else { + dataBuffer = new Buffer(data, encoding || this._encoding); + } + + this._buffers.push(dataBuffer); + this._buffered += dataBuffer.length; + + this._process(); + + // ok if there are no more read requests + if (this._reads && this._reads.length === 0) { + this._paused = true; + } + + return this.writable && !this._paused; +}; + +ChunkStream.prototype.end = function(data, encoding) { + + if (data) { + this.write(data, encoding); + } + + this.writable = false; + + // already destroyed + if (!this._buffers) { + return; + } + + // enqueue or handle end + if (this._buffers.length === 0) { + this._end(); + } + else { + this._buffers.push(null); + this._process(); + } +}; + +ChunkStream.prototype.destroySoon = ChunkStream.prototype.end; + +ChunkStream.prototype._end = function() { + + if (this._reads.length > 0) { + this.emit('error', + new Error('Unexpected end of input') + ); + } + + this.destroy(); +}; + +ChunkStream.prototype.destroy = function() { + + if (!this._buffers) { + return; + } + + this.writable = false; + this._reads = null; + this._buffers = null; + + this.emit('close'); +}; + +ChunkStream.prototype._processReadAllowingLess = function(read) { + // ok there is any data so that we can satisfy this request + this._reads.shift(); // == read + + // first we need to peek into first buffer + var smallerBuf = this._buffers[0]; + + // ok there is more data than we need + if (smallerBuf.length > read.length) { + + this._buffered -= read.length; + this._buffers[0] = smallerBuf.slice(read.length); + + read.func.call(this, smallerBuf.slice(0, read.length)); + + } + else { + // ok this is less than maximum length so use it all + this._buffered -= smallerBuf.length; + this._buffers.shift(); // == smallerBuf + + read.func.call(this, smallerBuf); + } +}; + +ChunkStream.prototype._processRead = function(read) { + this._reads.shift(); // == read + + var pos = 0; + var count = 0; + var data = new Buffer(read.length); + + // create buffer for all data + while (pos < read.length) { + + var buf = this._buffers[count++]; + var len = Math.min(buf.length, read.length - pos); + + buf.copy(data, pos, 0, len); + pos += len; + + // last buffer wasn't used all so just slice it and leave + if (len !== buf.length) { + this._buffers[--count] = buf.slice(len); + } + } + + // remove all used buffers + if (count > 0) { + this._buffers.splice(0, count); + } + + this._buffered -= read.length; + + read.func.call(this, data); +}; + +ChunkStream.prototype._process = function() { + + try { + // as long as there is any data and read requests + while (this._buffered > 0 && this._reads && this._reads.length > 0) { + + var read = this._reads[0]; + + // read any data (but no more than length) + if (read.allowLess) { + this._processReadAllowingLess(read); + + } + else if (this._buffered >= read.length) { + // ok we can meet some expectations + + this._processRead(read); + } + else { + // not enought data to satisfy first request in queue + // so we need to wait for more + break; + } + } + + if (this._buffers && !this.writable) { + this._end(); + } + } + catch (ex) { + this.emit('error', ex); + } +}; + +}).call(this,require('_process'),require("buffer").Buffer) +},{"_process":51,"buffer":32,"stream":64,"util":69}],4:[function(require,module,exports){ +'use strict'; + + +module.exports = { + + PNG_SIGNATURE: [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a], + + TYPE_IHDR: 0x49484452, + TYPE_IEND: 0x49454e44, + TYPE_IDAT: 0x49444154, + TYPE_PLTE: 0x504c5445, + TYPE_tRNS: 0x74524e53, // eslint-disable-line camelcase + TYPE_gAMA: 0x67414d41, // eslint-disable-line camelcase + + // color-type bits + COLORTYPE_GRAYSCALE: 0, + COLORTYPE_PALETTE: 1, + COLORTYPE_COLOR: 2, + COLORTYPE_ALPHA: 4, // e.g. grayscale and alpha + + // color-type combinations + COLORTYPE_PALETTE_COLOR: 3, + COLORTYPE_COLOR_ALPHA: 6, + + COLORTYPE_TO_BPP_MAP: { + 0: 1, + 2: 3, + 3: 1, + 4: 2, + 6: 4 + }, + + GAMMA_DIVISION: 100000 +}; + +},{}],5:[function(require,module,exports){ +'use strict'; + +var crcTable = []; + +(function() { + for (var i = 0; i < 256; i++) { + var currentCrc = i; + for (var j = 0; j < 8; j++) { + if (currentCrc & 1) { + currentCrc = 0xedb88320 ^ (currentCrc >>> 1); + } + else { + currentCrc = currentCrc >>> 1; + } + } + crcTable[i] = currentCrc; + } +}()); + +var CrcCalculator = module.exports = function() { + this._crc = -1; +}; + +CrcCalculator.prototype.write = function(data) { + + for (var i = 0; i < data.length; i++) { + this._crc = crcTable[(this._crc ^ data[i]) & 0xff] ^ (this._crc >>> 8); + } + return true; +}; + +CrcCalculator.prototype.crc32 = function() { + return this._crc ^ -1; +}; + + +CrcCalculator.crc32 = function(buf) { + + var crc = -1; + for (var i = 0; i < buf.length; i++) { + crc = crcTable[(crc ^ buf[i]) & 0xff] ^ (crc >>> 8); + } + return crc ^ -1; +}; + +},{}],6:[function(require,module,exports){ +(function (Buffer){ +'use strict'; + +var paethPredictor = require('./paeth-predictor'); + +function filterNone(pxData, pxPos, byteWidth, rawData, rawPos) { + + for (var x = 0; x < byteWidth; x++) { + rawData[rawPos + x] = pxData[pxPos + x]; + } +} + +function filterSumNone(pxData, pxPos, byteWidth) { + + var sum = 0; + var length = pxPos + byteWidth; + + for (var i = pxPos; i < length; i++) { + sum += Math.abs(pxData[i]); + } + return sum; +} + +function filterSub(pxData, pxPos, byteWidth, rawData, rawPos, bpp) { + + for (var x = 0; x < byteWidth; x++) { + + var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + var val = pxData[pxPos + x] - left; + + rawData[rawPos + x] = val; + } +} + +function filterSumSub(pxData, pxPos, byteWidth, bpp) { + + var sum = 0; + for (var x = 0; x < byteWidth; x++) { + + var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + var val = pxData[pxPos + x] - left; + + sum += Math.abs(val); + } + + return sum; +} + +function filterUp(pxData, pxPos, byteWidth, rawData, rawPos) { + + for (var x = 0; x < byteWidth; x++) { + + var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; + var val = pxData[pxPos + x] - up; + + rawData[rawPos + x] = val; + } +} + +function filterSumUp(pxData, pxPos, byteWidth) { + + var sum = 0; + var length = pxPos + byteWidth; + for (var x = pxPos; x < length; x++) { + + var up = pxPos > 0 ? pxData[x - byteWidth] : 0; + var val = pxData[x] - up; + + sum += Math.abs(val); + } + + return sum; +} + +function filterAvg(pxData, pxPos, byteWidth, rawData, rawPos, bpp) { + + for (var x = 0; x < byteWidth; x++) { + + var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; + var val = pxData[pxPos + x] - ((left + up) >> 1); + + rawData[rawPos + x] = val; + } +} + +function filterSumAvg(pxData, pxPos, byteWidth, bpp) { + + var sum = 0; + for (var x = 0; x < byteWidth; x++) { + + var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; + var val = pxData[pxPos + x] - ((left + up) >> 1); + + sum += Math.abs(val); + } + + return sum; +} + +function filterPaeth(pxData, pxPos, byteWidth, rawData, rawPos, bpp) { + + for (var x = 0; x < byteWidth; x++) { + + var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; + var upleft = pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0; + var val = pxData[pxPos + x] - paethPredictor(left, up, upleft); + + rawData[rawPos + x] = val; + } +} + +function filterSumPaeth(pxData, pxPos, byteWidth, bpp) { + var sum = 0; + for (var x = 0; x < byteWidth; x++) { + + var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; + var upleft = pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0; + var val = pxData[pxPos + x] - paethPredictor(left, up, upleft); + + sum += Math.abs(val); + } + + return sum; +} + +var filters = { + 0: filterNone, + 1: filterSub, + 2: filterUp, + 3: filterAvg, + 4: filterPaeth +}; + +var filterSums = { + 0: filterSumNone, + 1: filterSumSub, + 2: filterSumUp, + 3: filterSumAvg, + 4: filterSumPaeth +}; + +module.exports = function(pxData, width, height, options, bpp) { + + var filterTypes; + if (!('filterType' in options) || options.filterType === -1) { + filterTypes = [0, 1, 2, 3, 4]; + } + else if (typeof options.filterType === 'number') { + filterTypes = [options.filterType]; + } + else { + throw new Error('unrecognised filter types'); + } + + if (options.bitDepth === 16) { + bpp *= 2; + } + var byteWidth = width * bpp; + var rawPos = 0; + var pxPos = 0; + var rawData = new Buffer((byteWidth + 1) * height); + + var sel = filterTypes[0]; + + for (var y = 0; y < height; y++) { + + if (filterTypes.length > 1) { + // find best filter for this line (with lowest sum of values) + var min = Infinity; + + for (var i = 0; i < filterTypes.length; i++) { + var sum = filterSums[filterTypes[i]](pxData, pxPos, byteWidth, bpp); + if (sum < min) { + sel = filterTypes[i]; + min = sum; + } + } + } + + rawData[rawPos] = sel; + rawPos++; + filters[sel](pxData, pxPos, byteWidth, rawData, rawPos, bpp); + rawPos += byteWidth; + pxPos += byteWidth; + } + return rawData; +}; + +}).call(this,require("buffer").Buffer) +},{"./paeth-predictor":15,"buffer":32}],7:[function(require,module,exports){ +(function (Buffer){ +'use strict'; + +var util = require('util'); +var ChunkStream = require('./chunkstream'); +var Filter = require('./filter-parse'); + + +var FilterAsync = module.exports = function(bitmapInfo) { + ChunkStream.call(this); + + var buffers = []; + var that = this; + this._filter = new Filter(bitmapInfo, { + read: this.read.bind(this), + write: function(buffer) { + buffers.push(buffer); + }, + complete: function() { + that.emit('complete', Buffer.concat(buffers)); + } + }); + + this._filter.start(); +}; +util.inherits(FilterAsync, ChunkStream); + +}).call(this,require("buffer").Buffer) +},{"./chunkstream":3,"./filter-parse":9,"buffer":32,"util":69}],8:[function(require,module,exports){ +(function (Buffer){ +'use strict'; + +var SyncReader = require('./sync-reader'); +var Filter = require('./filter-parse'); + + +exports.process = function(inBuffer, bitmapInfo) { + + var outBuffers = []; + var reader = new SyncReader(inBuffer); + var filter = new Filter(bitmapInfo, { + read: reader.read.bind(reader), + write: function(bufferPart) { + outBuffers.push(bufferPart); + }, + complete: function() { + } + }); + + filter.start(); + reader.process(); + + return Buffer.concat(outBuffers); +}; +}).call(this,require("buffer").Buffer) +},{"./filter-parse":9,"./sync-reader":22,"buffer":32}],9:[function(require,module,exports){ +(function (Buffer){ +'use strict'; + +var interlaceUtils = require('./interlace'); +var paethPredictor = require('./paeth-predictor'); + +function getByteWidth(width, bpp, depth) { + var byteWidth = width * bpp; + if (depth !== 8) { + byteWidth = Math.ceil(byteWidth / (8 / depth)); + } + return byteWidth; +} + +var Filter = module.exports = function(bitmapInfo, dependencies) { + + var width = bitmapInfo.width; + var height = bitmapInfo.height; + var interlace = bitmapInfo.interlace; + var bpp = bitmapInfo.bpp; + var depth = bitmapInfo.depth; + + this.read = dependencies.read; + this.write = dependencies.write; + this.complete = dependencies.complete; + + this._imageIndex = 0; + this._images = []; + if (interlace) { + var passes = interlaceUtils.getImagePasses(width, height); + for (var i = 0; i < passes.length; i++) { + this._images.push({ + byteWidth: getByteWidth(passes[i].width, bpp, depth), + height: passes[i].height, + lineIndex: 0 + }); + } + } + else { + this._images.push({ + byteWidth: getByteWidth(width, bpp, depth), + height: height, + lineIndex: 0 + }); + } + + // when filtering the line we look at the pixel to the left + // the spec also says it is done on a byte level regardless of the number of pixels + // so if the depth is byte compatible (8 or 16) we subtract the bpp in order to compare back + // a pixel rather than just a different byte part. However if we are sub byte, we ignore. + if (depth === 8) { + this._xComparison = bpp; + } + else if (depth === 16) { + this._xComparison = bpp * 2; + } + else { + this._xComparison = 1; + } +}; + +Filter.prototype.start = function() { + this.read(this._images[this._imageIndex].byteWidth + 1, this._reverseFilterLine.bind(this)); +}; + +Filter.prototype._unFilterType1 = function(rawData, unfilteredLine, byteWidth) { + + var xComparison = this._xComparison; + var xBiggerThan = xComparison - 1; + + for (var x = 0; x < byteWidth; x++) { + var rawByte = rawData[1 + x]; + var f1Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; + unfilteredLine[x] = rawByte + f1Left; + } +}; + +Filter.prototype._unFilterType2 = function(rawData, unfilteredLine, byteWidth) { + + var lastLine = this._lastLine; + + for (var x = 0; x < byteWidth; x++) { + var rawByte = rawData[1 + x]; + var f2Up = lastLine ? lastLine[x] : 0; + unfilteredLine[x] = rawByte + f2Up; + } +}; + +Filter.prototype._unFilterType3 = function(rawData, unfilteredLine, byteWidth) { + + var xComparison = this._xComparison; + var xBiggerThan = xComparison - 1; + var lastLine = this._lastLine; + + for (var x = 0; x < byteWidth; x++) { + var rawByte = rawData[1 + x]; + var f3Up = lastLine ? lastLine[x] : 0; + var f3Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; + var f3Add = Math.floor((f3Left + f3Up) / 2); + unfilteredLine[x] = rawByte + f3Add; + } +}; + +Filter.prototype._unFilterType4 = function(rawData, unfilteredLine, byteWidth) { + + var xComparison = this._xComparison; + var xBiggerThan = xComparison - 1; + var lastLine = this._lastLine; + + for (var x = 0; x < byteWidth; x++) { + var rawByte = rawData[1 + x]; + var f4Up = lastLine ? lastLine[x] : 0; + var f4Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; + var f4UpLeft = x > xBiggerThan && lastLine ? lastLine[x - xComparison] : 0; + var f4Add = paethPredictor(f4Left, f4Up, f4UpLeft); + unfilteredLine[x] = rawByte + f4Add; + } +}; + +Filter.prototype._reverseFilterLine = function(rawData) { + + var filter = rawData[0]; + var unfilteredLine; + var currentImage = this._images[this._imageIndex]; + var byteWidth = currentImage.byteWidth; + + if (filter === 0) { + unfilteredLine = rawData.slice(1, byteWidth + 1); + } + else { + + unfilteredLine = new Buffer(byteWidth); + + switch (filter) { + case 1: + this._unFilterType1(rawData, unfilteredLine, byteWidth); + break; + case 2: + this._unFilterType2(rawData, unfilteredLine, byteWidth); + break; + case 3: + this._unFilterType3(rawData, unfilteredLine, byteWidth); + break; + case 4: + this._unFilterType4(rawData, unfilteredLine, byteWidth); + break; + default: + throw new Error('Unrecognised filter type - ' + filter); + } + } + + this.write(unfilteredLine); + + currentImage.lineIndex++; + if (currentImage.lineIndex >= currentImage.height) { + this._lastLine = null; + this._imageIndex++; + currentImage = this._images[this._imageIndex]; + } + else { + this._lastLine = unfilteredLine; + } + + if (currentImage) { + // read, using the byte width that may be from the new current image + this.read(currentImage.byteWidth + 1, this._reverseFilterLine.bind(this)); + } + else { + this._lastLine = null; + this.complete(); + } +}; + +}).call(this,require("buffer").Buffer) +},{"./interlace":11,"./paeth-predictor":15,"buffer":32}],10:[function(require,module,exports){ +(function (Buffer){ +'use strict'; + +function dePalette(indata, outdata, width, height, palette) { + var pxPos = 0; + // use values from palette + for (var y = 0; y < height; y++) { + for (var x = 0; x < width; x++) { + var color = palette[indata[pxPos]]; + + if (!color) { + throw new Error('index ' + indata[pxPos] + ' not in palette'); + } + + for (var i = 0; i < 4; i++) { + outdata[pxPos + i] = color[i]; + } + pxPos += 4; + } + } +} + +function replaceTransparentColor(indata, outdata, width, height, transColor) { + var pxPos = 0; + for (var y = 0; y < height; y++) { + for (var x = 0; x < width; x++) { + var makeTrans = false; + + if (transColor.length === 1) { + if (transColor[0] === indata[pxPos]) { + makeTrans = true; + } + } + else if (transColor[0] === indata[pxPos] && transColor[1] === indata[pxPos + 1] && transColor[2] === indata[pxPos + 2]) { + makeTrans = true; + } + if (makeTrans) { + for (var i = 0; i < 4; i++) { + outdata[pxPos + i] = 0; + } + } + pxPos += 4; + } + } +} + +function scaleDepth(indata, outdata, width, height, depth) { + var maxOutSample = 255; + var maxInSample = Math.pow(2, depth) - 1; + var pxPos = 0; + + for (var y = 0; y < height; y++) { + for (var x = 0; x < width; x++) { + for (var i = 0; i < 4; i++) { + outdata[pxPos + i] = Math.floor((indata[pxPos + i] * maxOutSample) / maxInSample + 0.5); + } + pxPos += 4; + } + } +} + +module.exports = function(indata, imageData) { + + var depth = imageData.depth; + var width = imageData.width; + var height = imageData.height; + var colorType = imageData.colorType; + var transColor = imageData.transColor; + var palette = imageData.palette; + + var outdata = indata; // only different for 16 bits + + if (colorType === 3) { // paletted + dePalette(indata, outdata, width, height, palette); + } + else { + if (transColor) { + replaceTransparentColor(indata, outdata, width, height, transColor); + } + // if it needs scaling + if (depth !== 8) { + // if we need to change the buffer size + if (depth === 16) { + outdata = new Buffer(width * height * 4); + } + scaleDepth(indata, outdata, width, height, depth); + } + } + return outdata; +}; + +}).call(this,require("buffer").Buffer) +},{"buffer":32}],11:[function(require,module,exports){ +'use strict'; + +// Adam 7 +// 0 1 2 3 4 5 6 7 +// 0 x 6 4 6 x 6 4 6 +// 1 7 7 7 7 7 7 7 7 +// 2 5 6 5 6 5 6 5 6 +// 3 7 7 7 7 7 7 7 7 +// 4 3 6 4 6 3 6 4 6 +// 5 7 7 7 7 7 7 7 7 +// 6 5 6 5 6 5 6 5 6 +// 7 7 7 7 7 7 7 7 7 + + +var imagePasses = [ + { // pass 1 - 1px + x: [0], + y: [0] + }, + { // pass 2 - 1px + x: [4], + y: [0] + }, + { // pass 3 - 2px + x: [0, 4], + y: [4] + }, + { // pass 4 - 4px + x: [2, 6], + y: [0, 4] + }, + { // pass 5 - 8px + x: [0, 2, 4, 6], + y: [2, 6] + }, + { // pass 6 - 16px + x: [1, 3, 5, 7], + y: [0, 2, 4, 6] + }, + { // pass 7 - 32px + x: [0, 1, 2, 3, 4, 5, 6, 7], + y: [1, 3, 5, 7] + } +]; + +exports.getImagePasses = function(width, height) { + var images = []; + var xLeftOver = width % 8; + var yLeftOver = height % 8; + var xRepeats = (width - xLeftOver) / 8; + var yRepeats = (height - yLeftOver) / 8; + for (var i = 0; i < imagePasses.length; i++) { + var pass = imagePasses[i]; + var passWidth = xRepeats * pass.x.length; + var passHeight = yRepeats * pass.y.length; + for (var j = 0; j < pass.x.length; j++) { + if (pass.x[j] < xLeftOver) { + passWidth++; + } + else { + break; + } + } + for (j = 0; j < pass.y.length; j++) { + if (pass.y[j] < yLeftOver) { + passHeight++; + } + else { + break; + } + } + if (passWidth > 0 && passHeight > 0) { + images.push({ width: passWidth, height: passHeight, index: i }); + } + } + return images; +}; + +exports.getInterlaceIterator = function(width) { + return function(x, y, pass) { + var outerXLeftOver = x % imagePasses[pass].x.length; + var outerX = (((x - outerXLeftOver) / imagePasses[pass].x.length) * 8) + imagePasses[pass].x[outerXLeftOver]; + var outerYLeftOver = y % imagePasses[pass].y.length; + var outerY = (((y - outerYLeftOver) / imagePasses[pass].y.length) * 8) + imagePasses[pass].y[outerYLeftOver]; + return (outerX * 4) + (outerY * width * 4); + }; +}; +},{}],12:[function(require,module,exports){ +(function (Buffer){ +'use strict'; + +var util = require('util'); +var Stream = require('stream'); +var constants = require('./constants'); +var Packer = require('./packer'); + +var PackerAsync = module.exports = function(opt) { + Stream.call(this); + + var options = opt || {}; + + this._packer = new Packer(options); + this._deflate = this._packer.createDeflate(); + + this.readable = true; +}; +util.inherits(PackerAsync, Stream); + + +PackerAsync.prototype.pack = function(data, width, height, gamma) { + // Signature + this.emit('data', new Buffer(constants.PNG_SIGNATURE)); + this.emit('data', this._packer.packIHDR(width, height)); + + if (gamma) { + this.emit('data', this._packer.packGAMA(gamma)); + } + + var filteredData = this._packer.filterData(data, width, height); + + // compress it + this._deflate.on('error', this.emit.bind(this, 'error')); + + this._deflate.on('data', function(compressedData) { + this.emit('data', this._packer.packIDAT(compressedData)); + }.bind(this)); + + this._deflate.on('end', function() { + this.emit('data', this._packer.packIEND()); + this.emit('end'); + }.bind(this)); + + this._deflate.end(filteredData); +}; + +}).call(this,require("buffer").Buffer) +},{"./constants":4,"./packer":14,"buffer":32,"stream":64,"util":69}],13:[function(require,module,exports){ +(function (Buffer){ +'use strict'; + +var hasSyncZlib = true; +var zlib = require('zlib'); +if (!zlib.deflateSync) { + hasSyncZlib = false; +} +var constants = require('./constants'); +var Packer = require('./packer'); + +module.exports = function(metaData, opt) { + + if (!hasSyncZlib) { + throw new Error('To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0'); + } + + var options = opt || {}; + + var packer = new Packer(options); + + var chunks = []; + + // Signature + chunks.push(new Buffer(constants.PNG_SIGNATURE)); + + // Header + chunks.push(packer.packIHDR(metaData.width, metaData.height)); + + if (metaData.gamma) { + chunks.push(packer.packGAMA(metaData.gamma)); + } + + var filteredData = packer.filterData(metaData.data, metaData.width, metaData.height); + + // compress it + var compressedData = zlib.deflateSync(filteredData, packer.getDeflateOptions()); + filteredData = null; + + if (!compressedData || !compressedData.length) { + throw new Error('bad png - invalid compressed data response'); + } + chunks.push(packer.packIDAT(compressedData)); + + // End + chunks.push(packer.packIEND()); + + return Buffer.concat(chunks); +}; + +}).call(this,require("buffer").Buffer) +},{"./constants":4,"./packer":14,"buffer":32,"zlib":30}],14:[function(require,module,exports){ +(function (Buffer){ +'use strict'; + +var constants = require('./constants'); +var CrcStream = require('./crc'); +var bitPacker = require('./bitpacker'); +var filter = require('./filter-pack'); +var zlib = require('zlib'); + +var Packer = module.exports = function(options) { + this._options = options; + + options.deflateChunkSize = options.deflateChunkSize || 32 * 1024; + options.deflateLevel = options.deflateLevel != null ? options.deflateLevel : 9; + options.deflateStrategy = options.deflateStrategy != null ? options.deflateStrategy : 3; + options.inputHasAlpha = options.inputHasAlpha != null ? options.inputHasAlpha : true; + options.deflateFactory = options.deflateFactory || zlib.createDeflate; + options.bitDepth = options.bitDepth || 8; + // This is outputColorType + options.colorType = (typeof options.colorType === 'number') ? options.colorType : constants.COLORTYPE_COLOR_ALPHA; + options.inputColorType = (typeof options.inputColorType === 'number') ? options.inputColorType : constants.COLORTYPE_COLOR_ALPHA; + + if ([ + constants.COLORTYPE_GRAYSCALE, + constants.COLORTYPE_COLOR, + constants.COLORTYPE_COLOR_ALPHA, + constants.COLORTYPE_ALPHA + ].indexOf(options.colorType) === -1) { + throw new Error('option color type:' + options.colorType + ' is not supported at present'); + } + if ([ + constants.COLORTYPE_GRAYSCALE, + constants.COLORTYPE_COLOR, + constants.COLORTYPE_COLOR_ALPHA, + constants.COLORTYPE_ALPHA + ].indexOf(options.inputColorType) === -1) { + throw new Error('option input color type:' + options.inputColorType + ' is not supported at present'); + } + if (options.bitDepth !== 8 && options.bitDepth !== 16) { + throw new Error('option bit depth:' + options.bitDepth + ' is not supported at present'); + } +}; + +Packer.prototype.getDeflateOptions = function() { + return { + chunkSize: this._options.deflateChunkSize, + level: this._options.deflateLevel, + strategy: this._options.deflateStrategy + }; +}; + +Packer.prototype.createDeflate = function() { + return this._options.deflateFactory(this.getDeflateOptions()); +}; + +Packer.prototype.filterData = function(data, width, height) { + // convert to correct format for filtering (e.g. right bpp and bit depth) + var packedData = bitPacker(data, width, height, this._options); + + // filter pixel data + var bpp = constants.COLORTYPE_TO_BPP_MAP[this._options.colorType]; + var filteredData = filter(packedData, width, height, this._options, bpp); + return filteredData; +}; + +Packer.prototype._packChunk = function(type, data) { + + var len = (data ? data.length : 0); + var buf = new Buffer(len + 12); + + buf.writeUInt32BE(len, 0); + buf.writeUInt32BE(type, 4); + + if (data) { + data.copy(buf, 8); + } + + buf.writeInt32BE(CrcStream.crc32(buf.slice(4, buf.length - 4)), buf.length - 4); + return buf; +}; + +Packer.prototype.packGAMA = function(gamma) { + var buf = new Buffer(4); + buf.writeUInt32BE(Math.floor(gamma * constants.GAMMA_DIVISION), 0); + return this._packChunk(constants.TYPE_gAMA, buf); +}; + +Packer.prototype.packIHDR = function(width, height) { + + var buf = new Buffer(13); + buf.writeUInt32BE(width, 0); + buf.writeUInt32BE(height, 4); + buf[8] = this._options.bitDepth; // Bit depth + buf[9] = this._options.colorType; // colorType + buf[10] = 0; // compression + buf[11] = 0; // filter + buf[12] = 0; // interlace + + return this._packChunk(constants.TYPE_IHDR, buf); +}; + +Packer.prototype.packIDAT = function(data) { + return this._packChunk(constants.TYPE_IDAT, data); +}; + +Packer.prototype.packIEND = function() { + return this._packChunk(constants.TYPE_IEND, null); +}; + +}).call(this,require("buffer").Buffer) +},{"./bitpacker":2,"./constants":4,"./crc":5,"./filter-pack":6,"buffer":32,"zlib":30}],15:[function(require,module,exports){ +'use strict'; + +module.exports = function paethPredictor(left, above, upLeft) { + + var paeth = left + above - upLeft; + var pLeft = Math.abs(paeth - left); + var pAbove = Math.abs(paeth - above); + var pUpLeft = Math.abs(paeth - upLeft); + + if (pLeft <= pAbove && pLeft <= pUpLeft) { + return left; + } + if (pAbove <= pUpLeft) { + return above; + } + return upLeft; +}; +},{}],16:[function(require,module,exports){ +'use strict'; + +var util = require('util'); +var zlib = require('zlib'); +var ChunkStream = require('./chunkstream'); +var FilterAsync = require('./filter-parse-async'); +var Parser = require('./parser'); +var bitmapper = require('./bitmapper'); +var formatNormaliser = require('./format-normaliser'); + +var ParserAsync = module.exports = function(options) { + ChunkStream.call(this); + + this._parser = new Parser(options, { + read: this.read.bind(this), + error: this._handleError.bind(this), + metadata: this._handleMetaData.bind(this), + gamma: this.emit.bind(this, 'gamma'), + palette: this._handlePalette.bind(this), + transColor: this._handleTransColor.bind(this), + finished: this._finished.bind(this), + inflateData: this._inflateData.bind(this), + simpleTransparency: this._simpleTransparency.bind(this), + headersFinished: this._headersFinished.bind(this) + }); + this._options = options; + this.writable = true; + + this._parser.start(); +}; +util.inherits(ParserAsync, ChunkStream); + + +ParserAsync.prototype._handleError = function(err) { + + this.emit('error', err); + + this.writable = false; + + this.destroy(); + + if (this._inflate && this._inflate.destroy) { + this._inflate.destroy(); + } + + if (this._filter) { + this._filter.destroy(); + // For backward compatibility with Node 7 and below. + // Suppress errors due to _inflate calling write() even after + // it's destroy()'ed. + this._filter.on('error', function() {}); + } + + this.errord = true; +}; + +ParserAsync.prototype._inflateData = function(data) { + if (!this._inflate) { + if (this._bitmapInfo.interlace) { + this._inflate = zlib.createInflate(); + + this._inflate.on('error', this.emit.bind(this, 'error')); + this._filter.on('complete', this._complete.bind(this)); + + this._inflate.pipe(this._filter); + } + else { + var rowSize = ((this._bitmapInfo.width * this._bitmapInfo.bpp * this._bitmapInfo.depth + 7) >> 3) + 1; + var imageSize = rowSize * this._bitmapInfo.height; + var chunkSize = Math.max(imageSize, zlib.Z_MIN_CHUNK); + + this._inflate = zlib.createInflate({ chunkSize: chunkSize }); + var leftToInflate = imageSize; + + var emitError = this.emit.bind(this, 'error'); + this._inflate.on('error', function(err) { + if (!leftToInflate) { + return; + } + + emitError(err); + }); + this._filter.on('complete', this._complete.bind(this)); + + var filterWrite = this._filter.write.bind(this._filter); + this._inflate.on('data', function(chunk) { + if (!leftToInflate) { + return; + } + + if (chunk.length > leftToInflate) { + chunk = chunk.slice(0, leftToInflate); + } + + leftToInflate -= chunk.length; + + filterWrite(chunk); + }); + + this._inflate.on('end', this._filter.end.bind(this._filter)); + } + } + this._inflate.write(data); +}; + +ParserAsync.prototype._handleMetaData = function(metaData) { + this._metaData = metaData; + this._bitmapInfo = Object.create(metaData); + + this._filter = new FilterAsync(this._bitmapInfo); +}; + +ParserAsync.prototype._handleTransColor = function(transColor) { + this._bitmapInfo.transColor = transColor; +}; + +ParserAsync.prototype._handlePalette = function(palette) { + this._bitmapInfo.palette = palette; +}; + +ParserAsync.prototype._simpleTransparency = function() { + this._metaData.alpha = true; +}; + +ParserAsync.prototype._headersFinished = function() { + // Up until this point, we don't know if we have a tRNS chunk (alpha) + // so we can't emit metadata any earlier + this.emit('metadata', this._metaData); +}; + +ParserAsync.prototype._finished = function() { + if (this.errord) { + return; + } + + if (!this._inflate) { + this.emit('error', 'No Inflate block'); + } + else { + // no more data to inflate + this._inflate.end(); + } + this.destroySoon(); +}; + +ParserAsync.prototype._complete = function(filteredData) { + + if (this.errord) { + return; + } + + try { + var bitmapData = bitmapper.dataToBitMap(filteredData, this._bitmapInfo); + + var normalisedBitmapData = formatNormaliser(bitmapData, this._bitmapInfo); + bitmapData = null; + } + catch (ex) { + this._handleError(ex); + return; + } + + this.emit('parsed', normalisedBitmapData); +}; + +},{"./bitmapper":1,"./chunkstream":3,"./filter-parse-async":7,"./format-normaliser":10,"./parser":18,"util":69,"zlib":30}],17:[function(require,module,exports){ +(function (Buffer){ +'use strict'; + +var hasSyncZlib = true; +var zlib = require('zlib'); +var inflateSync = require('./sync-inflate'); +if (!zlib.deflateSync) { + hasSyncZlib = false; +} +var SyncReader = require('./sync-reader'); +var FilterSync = require('./filter-parse-sync'); +var Parser = require('./parser'); +var bitmapper = require('./bitmapper'); +var formatNormaliser = require('./format-normaliser'); + + +module.exports = function(buffer, options) { + + if (!hasSyncZlib) { + throw new Error('To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0'); + } + + var err; + function handleError(_err_) { + err = _err_; + } + + var metaData; + function handleMetaData(_metaData_) { + metaData = _metaData_; + } + + function handleTransColor(transColor) { + metaData.transColor = transColor; + } + + function handlePalette(palette) { + metaData.palette = palette; + } + + function handleSimpleTransparency() { + metaData.alpha = true; + } + + var gamma; + function handleGamma(_gamma_) { + gamma = _gamma_; + } + + var inflateDataList = []; + function handleInflateData(inflatedData) { + inflateDataList.push(inflatedData); + } + + var reader = new SyncReader(buffer); + + var parser = new Parser(options, { + read: reader.read.bind(reader), + error: handleError, + metadata: handleMetaData, + gamma: handleGamma, + palette: handlePalette, + transColor: handleTransColor, + inflateData: handleInflateData, + simpleTransparency: handleSimpleTransparency + }); + + parser.start(); + reader.process(); + + if (err) { + throw err; + } + + //join together the inflate datas + var inflateData = Buffer.concat(inflateDataList); + inflateDataList.length = 0; + + var inflatedData; + if (metaData.interlace) { + inflatedData = zlib.inflateSync(inflateData); + } + else { + var rowSize = ((metaData.width * metaData.bpp * metaData.depth + 7) >> 3) + 1; + var imageSize = rowSize * metaData.height; + inflatedData = inflateSync(inflateData, { chunkSize: imageSize, maxLength: imageSize }); + } + inflateData = null; + + if (!inflatedData || !inflatedData.length) { + throw new Error('bad png - invalid inflate data response'); + } + + var unfilteredData = FilterSync.process(inflatedData, metaData); + inflateData = null; + + var bitmapData = bitmapper.dataToBitMap(unfilteredData, metaData); + unfilteredData = null; + + var normalisedBitmapData = formatNormaliser(bitmapData, metaData); + + metaData.data = normalisedBitmapData; + metaData.gamma = gamma || 0; + + return metaData; +}; + +}).call(this,require("buffer").Buffer) +},{"./bitmapper":1,"./filter-parse-sync":8,"./format-normaliser":10,"./parser":18,"./sync-inflate":21,"./sync-reader":22,"buffer":32,"zlib":30}],18:[function(require,module,exports){ +(function (Buffer){ +'use strict'; + +var constants = require('./constants'); +var CrcCalculator = require('./crc'); + + +var Parser = module.exports = function(options, dependencies) { + + this._options = options; + options.checkCRC = options.checkCRC !== false; + + this._hasIHDR = false; + this._hasIEND = false; + this._emittedHeadersFinished = false; + + // input flags/metadata + this._palette = []; + this._colorType = 0; + + this._chunks = {}; + this._chunks[constants.TYPE_IHDR] = this._handleIHDR.bind(this); + this._chunks[constants.TYPE_IEND] = this._handleIEND.bind(this); + this._chunks[constants.TYPE_IDAT] = this._handleIDAT.bind(this); + this._chunks[constants.TYPE_PLTE] = this._handlePLTE.bind(this); + this._chunks[constants.TYPE_tRNS] = this._handleTRNS.bind(this); + this._chunks[constants.TYPE_gAMA] = this._handleGAMA.bind(this); + + this.read = dependencies.read; + this.error = dependencies.error; + this.metadata = dependencies.metadata; + this.gamma = dependencies.gamma; + this.transColor = dependencies.transColor; + this.palette = dependencies.palette; + this.parsed = dependencies.parsed; + this.inflateData = dependencies.inflateData; + this.finished = dependencies.finished; + this.simpleTransparency = dependencies.simpleTransparency; + this.headersFinished = dependencies.headersFinished || function() {}; +}; + +Parser.prototype.start = function() { + this.read(constants.PNG_SIGNATURE.length, + this._parseSignature.bind(this) + ); +}; + +Parser.prototype._parseSignature = function(data) { + + var signature = constants.PNG_SIGNATURE; + + for (var i = 0; i < signature.length; i++) { + if (data[i] !== signature[i]) { + this.error(new Error('Invalid file signature')); + return; + } + } + this.read(8, this._parseChunkBegin.bind(this)); +}; + +Parser.prototype._parseChunkBegin = function(data) { + + // chunk content length + var length = data.readUInt32BE(0); + + // chunk type + var type = data.readUInt32BE(4); + var name = ''; + for (var i = 4; i < 8; i++) { + name += String.fromCharCode(data[i]); + } + + //console.log('chunk ', name, length); + + // chunk flags + var ancillary = Boolean(data[4] & 0x20); // or critical + // priv = Boolean(data[5] & 0x20), // or public + // safeToCopy = Boolean(data[7] & 0x20); // or unsafe + + if (!this._hasIHDR && type !== constants.TYPE_IHDR) { + this.error(new Error('Expected IHDR on beggining')); + return; + } + + this._crc = new CrcCalculator(); + this._crc.write(new Buffer(name)); + + if (this._chunks[type]) { + return this._chunks[type](length); + } + + if (!ancillary) { + this.error(new Error('Unsupported critical chunk type ' + name)); + return; + } + + this.read(length + 4, this._skipChunk.bind(this)); +}; + +Parser.prototype._skipChunk = function(/*data*/) { + this.read(8, this._parseChunkBegin.bind(this)); +}; + +Parser.prototype._handleChunkEnd = function() { + this.read(4, this._parseChunkEnd.bind(this)); +}; + +Parser.prototype._parseChunkEnd = function(data) { + + var fileCrc = data.readInt32BE(0); + var calcCrc = this._crc.crc32(); + + // check CRC + if (this._options.checkCRC && calcCrc !== fileCrc) { + this.error(new Error('Crc error - ' + fileCrc + ' - ' + calcCrc)); + return; + } + + if (!this._hasIEND) { + this.read(8, this._parseChunkBegin.bind(this)); + } +}; + +Parser.prototype._handleIHDR = function(length) { + this.read(length, this._parseIHDR.bind(this)); +}; +Parser.prototype._parseIHDR = function(data) { + + this._crc.write(data); + + var width = data.readUInt32BE(0); + var height = data.readUInt32BE(4); + var depth = data[8]; + var colorType = data[9]; // bits: 1 palette, 2 color, 4 alpha + var compr = data[10]; + var filter = data[11]; + var interlace = data[12]; + + // console.log(' width', width, 'height', height, + // 'depth', depth, 'colorType', colorType, + // 'compr', compr, 'filter', filter, 'interlace', interlace + // ); + + if (depth !== 8 && depth !== 4 && depth !== 2 && depth !== 1 && depth !== 16) { + this.error(new Error('Unsupported bit depth ' + depth)); + return; + } + if (!(colorType in constants.COLORTYPE_TO_BPP_MAP)) { + this.error(new Error('Unsupported color type')); + return; + } + if (compr !== 0) { + this.error(new Error('Unsupported compression method')); + return; + } + if (filter !== 0) { + this.error(new Error('Unsupported filter method')); + return; + } + if (interlace !== 0 && interlace !== 1) { + this.error(new Error('Unsupported interlace method')); + return; + } + + this._colorType = colorType; + + var bpp = constants.COLORTYPE_TO_BPP_MAP[this._colorType]; + + this._hasIHDR = true; + + this.metadata({ + width: width, + height: height, + depth: depth, + interlace: Boolean(interlace), + palette: Boolean(colorType & constants.COLORTYPE_PALETTE), + color: Boolean(colorType & constants.COLORTYPE_COLOR), + alpha: Boolean(colorType & constants.COLORTYPE_ALPHA), + bpp: bpp, + colorType: colorType + }); + + this._handleChunkEnd(); +}; + + +Parser.prototype._handlePLTE = function(length) { + this.read(length, this._parsePLTE.bind(this)); +}; +Parser.prototype._parsePLTE = function(data) { + + this._crc.write(data); + + var entries = Math.floor(data.length / 3); + // console.log('Palette:', entries); + + for (var i = 0; i < entries; i++) { + this._palette.push([ + data[i * 3], + data[i * 3 + 1], + data[i * 3 + 2], + 0xff + ]); + } + + this.palette(this._palette); + + this._handleChunkEnd(); +}; + +Parser.prototype._handleTRNS = function(length) { + this.simpleTransparency(); + this.read(length, this._parseTRNS.bind(this)); +}; +Parser.prototype._parseTRNS = function(data) { + + this._crc.write(data); + + // palette + if (this._colorType === constants.COLORTYPE_PALETTE_COLOR) { + if (this._palette.length === 0) { + this.error(new Error('Transparency chunk must be after palette')); + return; + } + if (data.length > this._palette.length) { + this.error(new Error('More transparent colors than palette size')); + return; + } + for (var i = 0; i < data.length; i++) { + this._palette[i][3] = data[i]; + } + this.palette(this._palette); + } + + // for colorType 0 (grayscale) and 2 (rgb) + // there might be one gray/color defined as transparent + if (this._colorType === constants.COLORTYPE_GRAYSCALE) { + // grey, 2 bytes + this.transColor([data.readUInt16BE(0)]); + } + if (this._colorType === constants.COLORTYPE_COLOR) { + this.transColor([data.readUInt16BE(0), data.readUInt16BE(2), data.readUInt16BE(4)]); + } + + this._handleChunkEnd(); +}; + +Parser.prototype._handleGAMA = function(length) { + this.read(length, this._parseGAMA.bind(this)); +}; +Parser.prototype._parseGAMA = function(data) { + + this._crc.write(data); + this.gamma(data.readUInt32BE(0) / constants.GAMMA_DIVISION); + + this._handleChunkEnd(); +}; + +Parser.prototype._handleIDAT = function(length) { + if (!this._emittedHeadersFinished) { + this._emittedHeadersFinished = true; + this.headersFinished(); + } + this.read(-length, this._parseIDAT.bind(this, length)); +}; +Parser.prototype._parseIDAT = function(length, data) { + + this._crc.write(data); + + if (this._colorType === constants.COLORTYPE_PALETTE_COLOR && this._palette.length === 0) { + throw new Error('Expected palette not found'); + } + + this.inflateData(data); + var leftOverLength = length - data.length; + + if (leftOverLength > 0) { + this._handleIDAT(leftOverLength); + } + else { + this._handleChunkEnd(); + } +}; + +Parser.prototype._handleIEND = function(length) { + this.read(length, this._parseIEND.bind(this)); +}; +Parser.prototype._parseIEND = function(data) { + + this._crc.write(data); + + this._hasIEND = true; + this._handleChunkEnd(); + + if (this.finished) { + this.finished(); + } +}; + +}).call(this,require("buffer").Buffer) +},{"./constants":4,"./crc":5,"buffer":32}],19:[function(require,module,exports){ +'use strict'; + + +var parse = require('./parser-sync'); +var pack = require('./packer-sync'); + + +exports.read = function(buffer, options) { + + return parse(buffer, options || {}); +}; + +exports.write = function(png, options) { + + return pack(png, options); +}; + +},{"./packer-sync":13,"./parser-sync":17}],20:[function(require,module,exports){ +(function (process,Buffer){ +'use strict'; + +var util = require('util'); +var Stream = require('stream'); +var Parser = require('./parser-async'); +var Packer = require('./packer-async'); +var PNGSync = require('./png-sync'); + + +var PNG = exports.PNG = function(options) { + Stream.call(this); + + options = options || {}; // eslint-disable-line no-param-reassign + + // coerce pixel dimensions to integers (also coerces undefined -> 0): + this.width = options.width | 0; + this.height = options.height | 0; + + this.data = this.width > 0 && this.height > 0 ? + new Buffer(4 * this.width * this.height) : null; + + if (options.fill && this.data) { + this.data.fill(0); + } + + this.gamma = 0; + this.readable = this.writable = true; + + this._parser = new Parser(options); + + this._parser.on('error', this.emit.bind(this, 'error')); + this._parser.on('close', this._handleClose.bind(this)); + this._parser.on('metadata', this._metadata.bind(this)); + this._parser.on('gamma', this._gamma.bind(this)); + this._parser.on('parsed', function(data) { + this.data = data; + this.emit('parsed', data); + }.bind(this)); + + this._packer = new Packer(options); + this._packer.on('data', this.emit.bind(this, 'data')); + this._packer.on('end', this.emit.bind(this, 'end')); + this._parser.on('close', this._handleClose.bind(this)); + this._packer.on('error', this.emit.bind(this, 'error')); + +}; +util.inherits(PNG, Stream); + +PNG.sync = PNGSync; + +PNG.prototype.pack = function() { + + if (!this.data || !this.data.length) { + this.emit('error', 'No data provided'); + return this; + } + + process.nextTick(function() { + this._packer.pack(this.data, this.width, this.height, this.gamma); + }.bind(this)); + + return this; +}; + + +PNG.prototype.parse = function(data, callback) { + + if (callback) { + var onParsed, onError; + + onParsed = function(parsedData) { + this.removeListener('error', onError); + + this.data = parsedData; + callback(null, this); + }.bind(this); + + onError = function(err) { + this.removeListener('parsed', onParsed); + + callback(err, null); + }.bind(this); + + this.once('parsed', onParsed); + this.once('error', onError); + } + + this.end(data); + return this; +}; + +PNG.prototype.write = function(data) { + this._parser.write(data); + return true; +}; + +PNG.prototype.end = function(data) { + this._parser.end(data); +}; + +PNG.prototype._metadata = function(metadata) { + this.width = metadata.width; + this.height = metadata.height; + + this.emit('metadata', metadata); +}; + +PNG.prototype._gamma = function(gamma) { + this.gamma = gamma; +}; + +PNG.prototype._handleClose = function() { + if (!this._parser.writable && !this._packer.readable) { + this.emit('close'); + } +}; + + +PNG.bitblt = function(src, dst, srcX, srcY, width, height, deltaX, deltaY) { // eslint-disable-line max-params + // coerce pixel dimensions to integers (also coerces undefined -> 0): + /* eslint-disable no-param-reassign */ + srcX |= 0; + srcY |= 0; + width |= 0; + height |= 0; + deltaX |= 0; + deltaY |= 0; + /* eslint-enable no-param-reassign */ + + if (srcX > src.width || srcY > src.height || srcX + width > src.width || srcY + height > src.height) { + throw new Error('bitblt reading outside image'); + } + + if (deltaX > dst.width || deltaY > dst.height || deltaX + width > dst.width || deltaY + height > dst.height) { + throw new Error('bitblt writing outside image'); + } + + for (var y = 0; y < height; y++) { + src.data.copy(dst.data, + ((deltaY + y) * dst.width + deltaX) << 2, + ((srcY + y) * src.width + srcX) << 2, + ((srcY + y) * src.width + srcX + width) << 2 + ); + } +}; + + +PNG.prototype.bitblt = function(dst, srcX, srcY, width, height, deltaX, deltaY) { // eslint-disable-line max-params + + PNG.bitblt(this, dst, srcX, srcY, width, height, deltaX, deltaY); + return this; +}; + +PNG.adjustGamma = function(src) { + if (src.gamma) { + for (var y = 0; y < src.height; y++) { + for (var x = 0; x < src.width; x++) { + var idx = (src.width * y + x) << 2; + + for (var i = 0; i < 3; i++) { + var sample = src.data[idx + i] / 255; + sample = Math.pow(sample, 1 / 2.2 / src.gamma); + src.data[idx + i] = Math.round(sample * 255); + } + } + } + src.gamma = 0; + } +}; + +PNG.prototype.adjustGamma = function() { + PNG.adjustGamma(this); +}; + +}).call(this,require('_process'),require("buffer").Buffer) +},{"./packer-async":12,"./parser-async":16,"./png-sync":19,"_process":51,"buffer":32,"stream":64,"util":69}],21:[function(require,module,exports){ +(function (process,Buffer){ +'use strict'; + +var assert = require('assert').ok; +var zlib = require('zlib'); +var util = require('util'); + +var kMaxLength = require('buffer').kMaxLength; + +function Inflate(opts) { + if (!(this instanceof Inflate)) { + return new Inflate(opts); + } + + if (opts && opts.chunkSize < zlib.Z_MIN_CHUNK) { + opts.chunkSize = zlib.Z_MIN_CHUNK; + } + + zlib.Inflate.call(this, opts); + + // Node 8 --> 9 compatibility check + this._offset = this._offset === undefined ? this._outOffset : this._offset; + this._buffer = this._buffer || this._outBuffer; + + if (opts && opts.maxLength != null) { + this._maxLength = opts.maxLength; + } +} + +function createInflate(opts) { + return new Inflate(opts); +} + +function _close(engine, callback) { + if (callback) { + process.nextTick(callback); + } + + // Caller may invoke .close after a zlib error (which will null _handle). + if (!engine._handle) { + return; + } + + engine._handle.close(); + engine._handle = null; +} + +Inflate.prototype._processChunk = function(chunk, flushFlag, asyncCb) { + if (typeof asyncCb === 'function') { + return zlib.Inflate._processChunk.call(this, chunk, flushFlag, asyncCb); + } + + var self = this; + + var availInBefore = chunk && chunk.length; + var availOutBefore = this._chunkSize - this._offset; + var leftToInflate = this._maxLength; + var inOff = 0; + + var buffers = []; + var nread = 0; + + var error; + this.on('error', function(err) { + error = err; + }); + + function handleChunk(availInAfter, availOutAfter) { + if (self._hadError) { + return; + } + + var have = availOutBefore - availOutAfter; + assert(have >= 0, 'have should not go down'); + + if (have > 0) { + var out = self._buffer.slice(self._offset, self._offset + have); + self._offset += have; + + if (out.length > leftToInflate) { + out = out.slice(0, leftToInflate); + } + + buffers.push(out); + nread += out.length; + leftToInflate -= out.length; + + if (leftToInflate === 0) { + return false; + } + } + + if (availOutAfter === 0 || self._offset >= self._chunkSize) { + availOutBefore = self._chunkSize; + self._offset = 0; + self._buffer = Buffer.allocUnsafe(self._chunkSize); + } + + if (availOutAfter === 0) { + inOff += (availInBefore - availInAfter); + availInBefore = availInAfter; + + return true; + } + + return false; + } + + assert(this._handle, 'zlib binding closed'); + do { + var res = this._handle.writeSync(flushFlag, + chunk, // in + inOff, // in_off + availInBefore, // in_len + this._buffer, // out + this._offset, //out_off + availOutBefore); // out_len + // Node 8 --> 9 compatibility check + res = res || this._writeState; + } while (!this._hadError && handleChunk(res[0], res[1])); + + if (this._hadError) { + throw error; + } + + if (nread >= kMaxLength) { + _close(this); + throw new RangeError('Cannot create final Buffer. It would be larger than 0x' + kMaxLength.toString(16) + ' bytes'); + } + + var buf = Buffer.concat(buffers, nread); + _close(this); + + return buf; +}; + +util.inherits(Inflate, zlib.Inflate); + +function zlibBufferSync(engine, buffer) { + if (typeof buffer === 'string') { + buffer = Buffer.from(buffer); + } + if (!(buffer instanceof Buffer)) { + throw new TypeError('Not a string or buffer'); + } + + var flushFlag = engine._finishFlushFlag; + if (flushFlag == null) { + flushFlag = zlib.Z_FINISH; + } + + return engine._processChunk(buffer, flushFlag); +} + +function inflateSync(buffer, opts) { + return zlibBufferSync(new Inflate(opts), buffer); +} + +module.exports = exports = inflateSync; +exports.Inflate = Inflate; +exports.createInflate = createInflate; +exports.inflateSync = inflateSync; + +}).call(this,require('_process'),require("buffer").Buffer) +},{"_process":51,"assert":23,"buffer":32,"util":69,"zlib":30}],22:[function(require,module,exports){ +'use strict'; + +var SyncReader = module.exports = function(buffer) { + + this._buffer = buffer; + this._reads = []; +}; + +SyncReader.prototype.read = function(length, callback) { + + this._reads.push({ + length: Math.abs(length), // if length < 0 then at most this length + allowLess: length < 0, + func: callback + }); +}; + +SyncReader.prototype.process = function() { + + // as long as there is any data and read requests + while (this._reads.length > 0 && this._buffer.length) { + + var read = this._reads[0]; + + if (this._buffer.length && (this._buffer.length >= read.length || read.allowLess)) { + + // ok there is any data so that we can satisfy this request + this._reads.shift(); // == read + + var buf = this._buffer; + + this._buffer = buf.slice(read.length); + + read.func.call(this, buf.slice(0, read.length)); + + } + else { + break; + } + + } + + if (this._reads.length > 0) { + return new Error('There are some read requests waitng on finished stream'); + } + + if (this._buffer.length > 0) { + return new Error('unrecognised content at end of stream'); + } + +}; + +},{}],23:[function(require,module,exports){ +(function (global){ +'use strict'; + +// compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js +// original notice: + +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +function compare(a, b) { + if (a === b) { + return 0; + } + + var x = a.length; + var y = b.length; + + for (var i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i]; + y = b[i]; + break; + } + } + + if (x < y) { + return -1; + } + if (y < x) { + return 1; + } + return 0; +} +function isBuffer(b) { + if (global.Buffer && typeof global.Buffer.isBuffer === 'function') { + return global.Buffer.isBuffer(b); + } + return !!(b != null && b._isBuffer); +} + +// based on node assert, original notice: + +// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 +// +// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! +// +// Originally from narwhal.js (http://narwhaljs.org) +// Copyright (c) 2009 Thomas Robinson <280north.com> +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the 'Software'), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +var util = require('util/'); +var hasOwn = Object.prototype.hasOwnProperty; +var pSlice = Array.prototype.slice; +var functionsHaveNames = (function () { + return function foo() {}.name === 'foo'; +}()); +function pToString (obj) { + return Object.prototype.toString.call(obj); +} +function isView(arrbuf) { + if (isBuffer(arrbuf)) { + return false; + } + if (typeof global.ArrayBuffer !== 'function') { + return false; + } + if (typeof ArrayBuffer.isView === 'function') { + return ArrayBuffer.isView(arrbuf); + } + if (!arrbuf) { + return false; + } + if (arrbuf instanceof DataView) { + return true; + } + if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) { + return true; + } + return false; +} +// 1. The assert module provides functions that throw +// AssertionError's when particular conditions are not met. The +// assert module must conform to the following interface. + +var assert = module.exports = ok; + +// 2. The AssertionError is defined in assert. +// new assert.AssertionError({ message: message, +// actual: actual, +// expected: expected }) + +var regex = /\s*function\s+([^\(\s]*)\s*/; +// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js +function getName(func) { + if (!util.isFunction(func)) { + return; + } + if (functionsHaveNames) { + return func.name; + } + var str = func.toString(); + var match = str.match(regex); + return match && match[1]; +} +assert.AssertionError = function AssertionError(options) { + this.name = 'AssertionError'; + this.actual = options.actual; + this.expected = options.expected; + this.operator = options.operator; + if (options.message) { + this.message = options.message; + this.generatedMessage = false; + } else { + this.message = getMessage(this); + this.generatedMessage = true; + } + var stackStartFunction = options.stackStartFunction || fail; + if (Error.captureStackTrace) { + Error.captureStackTrace(this, stackStartFunction); + } else { + // non v8 browsers so we can have a stacktrace + var err = new Error(); + if (err.stack) { + var out = err.stack; + + // try to strip useless frames + var fn_name = getName(stackStartFunction); + var idx = out.indexOf('\n' + fn_name); + if (idx >= 0) { + // once we have located the function frame + // we need to strip out everything before it (and its line) + var next_line = out.indexOf('\n', idx + 1); + out = out.substring(next_line + 1); + } + + this.stack = out; + } + } +}; + +// assert.AssertionError instanceof Error +util.inherits(assert.AssertionError, Error); + +function truncate(s, n) { + if (typeof s === 'string') { + return s.length < n ? s : s.slice(0, n); + } else { + return s; + } +} +function inspect(something) { + if (functionsHaveNames || !util.isFunction(something)) { + return util.inspect(something); + } + var rawname = getName(something); + var name = rawname ? ': ' + rawname : ''; + return '[Function' + name + ']'; +} +function getMessage(self) { + return truncate(inspect(self.actual), 128) + ' ' + + self.operator + ' ' + + truncate(inspect(self.expected), 128); +} + +// At present only the three keys mentioned above are used and +// understood by the spec. Implementations or sub modules can pass +// other keys to the AssertionError's constructor - they will be +// ignored. + +// 3. All of the following functions must throw an AssertionError +// when a corresponding condition is not met, with a message that +// may be undefined if not provided. All assertion methods provide +// both the actual and expected values to the assertion error for +// display purposes. + +function fail(actual, expected, message, operator, stackStartFunction) { + throw new assert.AssertionError({ + message: message, + actual: actual, + expected: expected, + operator: operator, + stackStartFunction: stackStartFunction + }); +} + +// EXTENSION! allows for well behaved errors defined elsewhere. +assert.fail = fail; + +// 4. Pure assertion tests whether a value is truthy, as determined +// by !!guard. +// assert.ok(guard, message_opt); +// This statement is equivalent to assert.equal(true, !!guard, +// message_opt);. To test strictly for the value true, use +// assert.strictEqual(true, guard, message_opt);. + +function ok(value, message) { + if (!value) fail(value, true, message, '==', assert.ok); +} +assert.ok = ok; + +// 5. The equality assertion tests shallow, coercive equality with +// ==. +// assert.equal(actual, expected, message_opt); + +assert.equal = function equal(actual, expected, message) { + if (actual != expected) fail(actual, expected, message, '==', assert.equal); +}; + +// 6. The non-equality assertion tests for whether two objects are not equal +// with != assert.notEqual(actual, expected, message_opt); + +assert.notEqual = function notEqual(actual, expected, message) { + if (actual == expected) { + fail(actual, expected, message, '!=', assert.notEqual); + } +}; + +// 7. The equivalence assertion tests a deep equality relation. +// assert.deepEqual(actual, expected, message_opt); + +assert.deepEqual = function deepEqual(actual, expected, message) { + if (!_deepEqual(actual, expected, false)) { + fail(actual, expected, message, 'deepEqual', assert.deepEqual); + } +}; + +assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { + if (!_deepEqual(actual, expected, true)) { + fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual); + } +}; + +function _deepEqual(actual, expected, strict, memos) { + // 7.1. All identical values are equivalent, as determined by ===. + if (actual === expected) { + return true; + } else if (isBuffer(actual) && isBuffer(expected)) { + return compare(actual, expected) === 0; + + // 7.2. If the expected value is a Date object, the actual value is + // equivalent if it is also a Date object that refers to the same time. + } else if (util.isDate(actual) && util.isDate(expected)) { + return actual.getTime() === expected.getTime(); + + // 7.3 If the expected value is a RegExp object, the actual value is + // equivalent if it is also a RegExp object with the same source and + // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). + } else if (util.isRegExp(actual) && util.isRegExp(expected)) { + return actual.source === expected.source && + actual.global === expected.global && + actual.multiline === expected.multiline && + actual.lastIndex === expected.lastIndex && + actual.ignoreCase === expected.ignoreCase; + + // 7.4. Other pairs that do not both pass typeof value == 'object', + // equivalence is determined by ==. + } else if ((actual === null || typeof actual !== 'object') && + (expected === null || typeof expected !== 'object')) { + return strict ? actual === expected : actual == expected; + + // If both values are instances of typed arrays, wrap their underlying + // ArrayBuffers in a Buffer each to increase performance + // This optimization requires the arrays to have the same type as checked by + // Object.prototype.toString (aka pToString). Never perform binary + // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their + // bit patterns are not identical. + } else if (isView(actual) && isView(expected) && + pToString(actual) === pToString(expected) && + !(actual instanceof Float32Array || + actual instanceof Float64Array)) { + return compare(new Uint8Array(actual.buffer), + new Uint8Array(expected.buffer)) === 0; + + // 7.5 For all other Object pairs, including Array objects, equivalence is + // determined by having the same number of owned properties (as verified + // with Object.prototype.hasOwnProperty.call), the same set of keys + // (although not necessarily the same order), equivalent values for every + // corresponding key, and an identical 'prototype' property. Note: this + // accounts for both named and indexed properties on Arrays. + } else if (isBuffer(actual) !== isBuffer(expected)) { + return false; + } else { + memos = memos || {actual: [], expected: []}; + + var actualIndex = memos.actual.indexOf(actual); + if (actualIndex !== -1) { + if (actualIndex === memos.expected.indexOf(expected)) { + return true; + } + } + + memos.actual.push(actual); + memos.expected.push(expected); + + return objEquiv(actual, expected, strict, memos); + } +} + +function isArguments(object) { + return Object.prototype.toString.call(object) == '[object Arguments]'; +} + +function objEquiv(a, b, strict, actualVisitedObjects) { + if (a === null || a === undefined || b === null || b === undefined) + return false; + // if one is a primitive, the other must be same + if (util.isPrimitive(a) || util.isPrimitive(b)) + return a === b; + if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) + return false; + var aIsArgs = isArguments(a); + var bIsArgs = isArguments(b); + if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) + return false; + if (aIsArgs) { + a = pSlice.call(a); + b = pSlice.call(b); + return _deepEqual(a, b, strict); + } + var ka = objectKeys(a); + var kb = objectKeys(b); + var key, i; + // having the same number of owned properties (keys incorporates + // hasOwnProperty) + if (ka.length !== kb.length) + return false; + //the same set of keys (although not necessarily the same order), + ka.sort(); + kb.sort(); + //~~~cheap key test + for (i = ka.length - 1; i >= 0; i--) { + if (ka[i] !== kb[i]) + return false; + } + //equivalent values for every corresponding key, and + //~~~possibly expensive deep test + for (i = ka.length - 1; i >= 0; i--) { + key = ka[i]; + if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects)) + return false; + } + return true; +} + +// 8. The non-equivalence assertion tests for any deep inequality. +// assert.notDeepEqual(actual, expected, message_opt); + +assert.notDeepEqual = function notDeepEqual(actual, expected, message) { + if (_deepEqual(actual, expected, false)) { + fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); + } +}; + +assert.notDeepStrictEqual = notDeepStrictEqual; +function notDeepStrictEqual(actual, expected, message) { + if (_deepEqual(actual, expected, true)) { + fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual); + } +} + + +// 9. The strict equality assertion tests strict equality, as determined by ===. +// assert.strictEqual(actual, expected, message_opt); + +assert.strictEqual = function strictEqual(actual, expected, message) { + if (actual !== expected) { + fail(actual, expected, message, '===', assert.strictEqual); + } +}; + +// 10. The strict non-equality assertion tests for strict inequality, as +// determined by !==. assert.notStrictEqual(actual, expected, message_opt); + +assert.notStrictEqual = function notStrictEqual(actual, expected, message) { + if (actual === expected) { + fail(actual, expected, message, '!==', assert.notStrictEqual); + } +}; + +function expectedException(actual, expected) { + if (!actual || !expected) { + return false; + } + + if (Object.prototype.toString.call(expected) == '[object RegExp]') { + return expected.test(actual); + } + + try { + if (actual instanceof expected) { + return true; + } + } catch (e) { + // Ignore. The instanceof check doesn't work for arrow functions. + } + + if (Error.isPrototypeOf(expected)) { + return false; + } + + return expected.call({}, actual) === true; +} + +function _tryBlock(block) { + var error; + try { + block(); + } catch (e) { + error = e; + } + return error; +} + +function _throws(shouldThrow, block, expected, message) { + var actual; + + if (typeof block !== 'function') { + throw new TypeError('"block" argument must be a function'); + } + + if (typeof expected === 'string') { + message = expected; + expected = null; + } + + actual = _tryBlock(block); + + message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + + (message ? ' ' + message : '.'); + + if (shouldThrow && !actual) { + fail(actual, expected, 'Missing expected exception' + message); + } + + var userProvidedMessage = typeof message === 'string'; + var isUnwantedException = !shouldThrow && util.isError(actual); + var isUnexpectedException = !shouldThrow && actual && !expected; + + if ((isUnwantedException && + userProvidedMessage && + expectedException(actual, expected)) || + isUnexpectedException) { + fail(actual, expected, 'Got unwanted exception' + message); + } + + if ((shouldThrow && actual && expected && + !expectedException(actual, expected)) || (!shouldThrow && actual)) { + throw actual; + } +} + +// 11. Expected to throw an error: +// assert.throws(block, Error_opt, message_opt); + +assert.throws = function(block, /*optional*/error, /*optional*/message) { + _throws(true, block, error, message); +}; + +// EXTENSION! This is annoying to write outside this module. +assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { + _throws(false, block, error, message); +}; + +assert.ifError = function(err) { if (err) throw err; }; + +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) { + if (hasOwn.call(obj, key)) keys.push(key); + } + return keys; +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"util/":26}],24:[function(require,module,exports){ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } +} + +},{}],25:[function(require,module,exports){ +module.exports = function isBuffer(arg) { + return arg && typeof arg === 'object' + && typeof arg.copy === 'function' + && typeof arg.fill === 'function' + && typeof arg.readUInt8 === 'function'; +} +},{}],26:[function(require,module,exports){ +(function (process,global){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +var formatRegExp = /%[sdj%]/g; +exports.format = function(f) { + if (!isString(f)) { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(inspect(arguments[i])); + } + return objects.join(' '); + } + + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function(x) { + if (x === '%%') return '%'; + if (i >= len) return x; + switch (x) { + case '%s': return String(args[i++]); + case '%d': return Number(args[i++]); + case '%j': + try { + return JSON.stringify(args[i++]); + } catch (_) { + return '[Circular]'; + } + default: + return x; + } + }); + for (var x = args[i]; i < len; x = args[++i]) { + if (isNull(x) || !isObject(x)) { + str += ' ' + x; + } else { + str += ' ' + inspect(x); + } + } + return str; +}; + + +// Mark that a method should not be used. +// Returns a modified function which warns once by default. +// If --no-deprecation is set, then it is a no-op. +exports.deprecate = function(fn, msg) { + // Allow for deprecating things in the process of starting up. + if (isUndefined(global.process)) { + return function() { + return exports.deprecate(fn, msg).apply(this, arguments); + }; + } + + if (process.noDeprecation === true) { + return fn; + } + + var warned = false; + function deprecated() { + if (!warned) { + if (process.throwDeprecation) { + throw new Error(msg); + } else if (process.traceDeprecation) { + console.trace(msg); + } else { + console.error(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; +}; + + +var debugs = {}; +var debugEnviron; +exports.debuglog = function(set) { + if (isUndefined(debugEnviron)) + debugEnviron = process.env.NODE_DEBUG || ''; + set = set.toUpperCase(); + if (!debugs[set]) { + if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { + var pid = process.pid; + debugs[set] = function() { + var msg = exports.format.apply(exports, arguments); + console.error('%s %d: %s', set, pid, msg); + }; + } else { + debugs[set] = function() {}; + } + } + return debugs[set]; +}; + + +/** + * Echos the value of a value. Trys to print the value out + * in the best way possible given the different types. + * + * @param {Object} obj The object to print out. + * @param {Object} opts Optional options object that alters the output. + */ +/* legacy: obj, showHidden, depth, colors*/ +function inspect(obj, opts) { + // default options + var ctx = { + seen: [], + stylize: stylizeNoColor + }; + // legacy... + if (arguments.length >= 3) ctx.depth = arguments[2]; + if (arguments.length >= 4) ctx.colors = arguments[3]; + if (isBoolean(opts)) { + // legacy... + ctx.showHidden = opts; + } else if (opts) { + // got an "options" object + exports._extend(ctx, opts); + } + // set default options + if (isUndefined(ctx.showHidden)) ctx.showHidden = false; + if (isUndefined(ctx.depth)) ctx.depth = 2; + if (isUndefined(ctx.colors)) ctx.colors = false; + if (isUndefined(ctx.customInspect)) ctx.customInspect = true; + if (ctx.colors) ctx.stylize = stylizeWithColor; + return formatValue(ctx, obj, ctx.depth); +} +exports.inspect = inspect; + + +// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics +inspect.colors = { + 'bold' : [1, 22], + 'italic' : [3, 23], + 'underline' : [4, 24], + 'inverse' : [7, 27], + 'white' : [37, 39], + 'grey' : [90, 39], + 'black' : [30, 39], + 'blue' : [34, 39], + 'cyan' : [36, 39], + 'green' : [32, 39], + 'magenta' : [35, 39], + 'red' : [31, 39], + 'yellow' : [33, 39] +}; + +// Don't use 'blue' not visible on cmd.exe +inspect.styles = { + 'special': 'cyan', + 'number': 'yellow', + 'boolean': 'yellow', + 'undefined': 'grey', + 'null': 'bold', + 'string': 'green', + 'date': 'magenta', + // "name": intentionally not styling + 'regexp': 'red' +}; + + +function stylizeWithColor(str, styleType) { + var style = inspect.styles[styleType]; + + if (style) { + return '\u001b[' + inspect.colors[style][0] + 'm' + str + + '\u001b[' + inspect.colors[style][1] + 'm'; + } else { + return str; + } +} + + +function stylizeNoColor(str, styleType) { + return str; +} + + +function arrayToHash(array) { + var hash = {}; + + array.forEach(function(val, idx) { + hash[val] = true; + }); + + return hash; +} + + +function formatValue(ctx, value, recurseTimes) { + // Provide a hook for user-specified inspect functions. + // Check that value is an object with an inspect function on it + if (ctx.customInspect && + value && + isFunction(value.inspect) && + // Filter out the util module, it's inspect function is special + value.inspect !== exports.inspect && + // Also filter out any prototype objects using the circular check. + !(value.constructor && value.constructor.prototype === value)) { + var ret = value.inspect(recurseTimes, ctx); + if (!isString(ret)) { + ret = formatValue(ctx, ret, recurseTimes); + } + return ret; + } + + // Primitive types cannot have properties + var primitive = formatPrimitive(ctx, value); + if (primitive) { + return primitive; + } + + // Look up the keys of the object. + var keys = Object.keys(value); + var visibleKeys = arrayToHash(keys); + + if (ctx.showHidden) { + keys = Object.getOwnPropertyNames(value); + } + + // IE doesn't make error fields non-enumerable + // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx + if (isError(value) + && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { + return formatError(value); + } + + // Some type of object without properties can be shortcutted. + if (keys.length === 0) { + if (isFunction(value)) { + var name = value.name ? ': ' + value.name : ''; + return ctx.stylize('[Function' + name + ']', 'special'); + } + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } + if (isDate(value)) { + return ctx.stylize(Date.prototype.toString.call(value), 'date'); + } + if (isError(value)) { + return formatError(value); + } + } + + var base = '', array = false, braces = ['{', '}']; + + // Make Array say that they are Array + if (isArray(value)) { + array = true; + braces = ['[', ']']; + } + + // Make functions say that they are functions + if (isFunction(value)) { + var n = value.name ? ': ' + value.name : ''; + base = ' [Function' + n + ']'; + } + + // Make RegExps say that they are RegExps + if (isRegExp(value)) { + base = ' ' + RegExp.prototype.toString.call(value); + } + + // Make dates with properties first say the date + if (isDate(value)) { + base = ' ' + Date.prototype.toUTCString.call(value); + } + + // Make error with message first say the error + if (isError(value)) { + base = ' ' + formatError(value); + } + + if (keys.length === 0 && (!array || value.length == 0)) { + return braces[0] + base + braces[1]; + } + + if (recurseTimes < 0) { + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } else { + return ctx.stylize('[Object]', 'special'); + } + } + + ctx.seen.push(value); + + var output; + if (array) { + output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); + } else { + output = keys.map(function(key) { + return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); + }); + } + + ctx.seen.pop(); + + return reduceToSingleString(output, base, braces); +} + + +function formatPrimitive(ctx, value) { + if (isUndefined(value)) + return ctx.stylize('undefined', 'undefined'); + if (isString(value)) { + var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + '\''; + return ctx.stylize(simple, 'string'); + } + if (isNumber(value)) + return ctx.stylize('' + value, 'number'); + if (isBoolean(value)) + return ctx.stylize('' + value, 'boolean'); + // For some reason typeof null is "object", so special case here. + if (isNull(value)) + return ctx.stylize('null', 'null'); +} + + +function formatError(value) { + return '[' + Error.prototype.toString.call(value) + ']'; +} + + +function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { + var output = []; + for (var i = 0, l = value.length; i < l; ++i) { + if (hasOwnProperty(value, String(i))) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + String(i), true)); + } else { + output.push(''); + } + } + keys.forEach(function(key) { + if (!key.match(/^\d+$/)) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + key, true)); + } + }); + return output; +} + + +function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { + var name, str, desc; + desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; + if (desc.get) { + if (desc.set) { + str = ctx.stylize('[Getter/Setter]', 'special'); + } else { + str = ctx.stylize('[Getter]', 'special'); + } + } else { + if (desc.set) { + str = ctx.stylize('[Setter]', 'special'); + } + } + if (!hasOwnProperty(visibleKeys, key)) { + name = '[' + key + ']'; + } + if (!str) { + if (ctx.seen.indexOf(desc.value) < 0) { + if (isNull(recurseTimes)) { + str = formatValue(ctx, desc.value, null); + } else { + str = formatValue(ctx, desc.value, recurseTimes - 1); + } + if (str.indexOf('\n') > -1) { + if (array) { + str = str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n').substr(2); + } else { + str = '\n' + str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n'); + } + } + } else { + str = ctx.stylize('[Circular]', 'special'); + } + } + if (isUndefined(name)) { + if (array && key.match(/^\d+$/)) { + return str; + } + name = JSON.stringify('' + key); + if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { + name = name.substr(1, name.length - 2); + name = ctx.stylize(name, 'name'); + } else { + name = name.replace(/'/g, "\\'") + .replace(/\\"/g, '"') + .replace(/(^"|"$)/g, "'"); + name = ctx.stylize(name, 'string'); + } + } + + return name + ': ' + str; +} + + +function reduceToSingleString(output, base, braces) { + var numLinesEst = 0; + var length = output.reduce(function(prev, cur) { + numLinesEst++; + if (cur.indexOf('\n') >= 0) numLinesEst++; + return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; + }, 0); + + if (length > 60) { + return braces[0] + + (base === '' ? '' : base + '\n ') + + ' ' + + output.join(',\n ') + + ' ' + + braces[1]; + } + + return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; +} + + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. +function isArray(ar) { + return Array.isArray(ar); +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return isObject(re) && objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return isObject(d) && objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return isObject(e) && + (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +exports.isBuffer = require('./support/isBuffer'); + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + + +function pad(n) { + return n < 10 ? '0' + n.toString(10) : n.toString(10); +} + + +var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', + 'Oct', 'Nov', 'Dec']; + +// 26 Feb 16:19:34 +function timestamp() { + var d = new Date(); + var time = [pad(d.getHours()), + pad(d.getMinutes()), + pad(d.getSeconds())].join(':'); + return [d.getDate(), months[d.getMonth()], time].join(' '); +} + + +// log is just a thin wrapper to console.log that prepends a timestamp +exports.log = function() { + console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); +}; + + +/** + * Inherit the prototype methods from one constructor into another. + * + * The Function.prototype.inherits from lang.js rewritten as a standalone + * function (not on Function.prototype). NOTE: If this file is to be loaded + * during bootstrapping this function needs to be rewritten using some native + * functions as prototype setup using normal JavaScript does not work as + * expected during bootstrapping (see mirror.js in r114903). + * + * @param {function} ctor Constructor function which needs to inherit the + * prototype. + * @param {function} superCtor Constructor function to inherit prototype from. + */ +exports.inherits = require('inherits'); + +exports._extend = function(origin, add) { + // Don't do anything if add isn't an object + if (!add || !isObject(add)) return origin; + + var keys = Object.keys(add); + var i = keys.length; + while (i--) { + origin[keys[i]] = add[keys[i]]; + } + return origin; +}; + +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./support/isBuffer":25,"_process":51,"inherits":24}],27:[function(require,module,exports){ +'use strict' + +exports.byteLength = byteLength +exports.toByteArray = toByteArray +exports.fromByteArray = fromByteArray + +var lookup = [] +var revLookup = [] +var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array + +var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' +for (var i = 0, len = code.length; i < len; ++i) { + lookup[i] = code[i] + revLookup[code.charCodeAt(i)] = i +} + +// Support decoding URL-safe base64 strings, as Node.js does. +// See: https://en.wikipedia.org/wiki/Base64#URL_applications +revLookup['-'.charCodeAt(0)] = 62 +revLookup['_'.charCodeAt(0)] = 63 + +function getLens (b64) { + var len = b64.length + + if (len % 4 > 0) { + throw new Error('Invalid string. Length must be a multiple of 4') + } + + // Trim off extra bytes after placeholder bytes are found + // See: https://github.com/beatgammit/base64-js/issues/42 + var validLen = b64.indexOf('=') + if (validLen === -1) validLen = len + + var placeHoldersLen = validLen === len + ? 0 + : 4 - (validLen % 4) + + return [validLen, placeHoldersLen] +} + +// base64 is 4/3 + up to two characters of the original data +function byteLength (b64) { + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} + +function _byteLength (b64, validLen, placeHoldersLen) { + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} + +function toByteArray (b64) { + var tmp + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + + var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) + + var curByte = 0 + + // if there are placeholders, only get up to the last complete 4 chars + var len = placeHoldersLen > 0 + ? validLen - 4 + : validLen + + for (var i = 0; i < len; i += 4) { + tmp = + (revLookup[b64.charCodeAt(i)] << 18) | + (revLookup[b64.charCodeAt(i + 1)] << 12) | + (revLookup[b64.charCodeAt(i + 2)] << 6) | + revLookup[b64.charCodeAt(i + 3)] + arr[curByte++] = (tmp >> 16) & 0xFF + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } + + if (placeHoldersLen === 2) { + tmp = + (revLookup[b64.charCodeAt(i)] << 2) | + (revLookup[b64.charCodeAt(i + 1)] >> 4) + arr[curByte++] = tmp & 0xFF + } + + if (placeHoldersLen === 1) { + tmp = + (revLookup[b64.charCodeAt(i)] << 10) | + (revLookup[b64.charCodeAt(i + 1)] << 4) | + (revLookup[b64.charCodeAt(i + 2)] >> 2) + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } + + return arr +} + +function tripletToBase64 (num) { + return lookup[num >> 18 & 0x3F] + + lookup[num >> 12 & 0x3F] + + lookup[num >> 6 & 0x3F] + + lookup[num & 0x3F] +} + +function encodeChunk (uint8, start, end) { + var tmp + var output = [] + for (var i = start; i < end; i += 3) { + tmp = + ((uint8[i] << 16) & 0xFF0000) + + ((uint8[i + 1] << 8) & 0xFF00) + + (uint8[i + 2] & 0xFF) + output.push(tripletToBase64(tmp)) + } + return output.join('') +} + +function fromByteArray (uint8) { + var tmp + var len = uint8.length + var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes + var parts = [] + var maxChunkLength = 16383 // must be multiple of 3 + + // go through the array every three bytes, we'll deal with trailing stuff later + for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { + parts.push(encodeChunk( + uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) + )) + } + + // pad the end with zeros, but make sure to not forget the extra bytes + if (extraBytes === 1) { + tmp = uint8[len - 1] + parts.push( + lookup[tmp >> 2] + + lookup[(tmp << 4) & 0x3F] + + '==' + ) + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + uint8[len - 1] + parts.push( + lookup[tmp >> 10] + + lookup[(tmp >> 4) & 0x3F] + + lookup[(tmp << 2) & 0x3F] + + '=' + ) + } + + return parts.join('') +} + +},{}],28:[function(require,module,exports){ + +},{}],29:[function(require,module,exports){ +(function (process,Buffer){ +'use strict'; +/* eslint camelcase: "off" */ + +var assert = require('assert'); + +var Zstream = require('pako/lib/zlib/zstream'); +var zlib_deflate = require('pako/lib/zlib/deflate.js'); +var zlib_inflate = require('pako/lib/zlib/inflate.js'); +var constants = require('pako/lib/zlib/constants'); + +for (var key in constants) { + exports[key] = constants[key]; +} + +// zlib modes +exports.NONE = 0; +exports.DEFLATE = 1; +exports.INFLATE = 2; +exports.GZIP = 3; +exports.GUNZIP = 4; +exports.DEFLATERAW = 5; +exports.INFLATERAW = 6; +exports.UNZIP = 7; + +var GZIP_HEADER_ID1 = 0x1f; +var GZIP_HEADER_ID2 = 0x8b; + +/** + * Emulate Node's zlib C++ layer for use by the JS layer in index.js + */ +function Zlib(mode) { + if (typeof mode !== 'number' || mode < exports.DEFLATE || mode > exports.UNZIP) { + throw new TypeError('Bad argument'); + } + + this.dictionary = null; + this.err = 0; + this.flush = 0; + this.init_done = false; + this.level = 0; + this.memLevel = 0; + this.mode = mode; + this.strategy = 0; + this.windowBits = 0; + this.write_in_progress = false; + this.pending_close = false; + this.gzip_id_bytes_read = 0; +} + +Zlib.prototype.close = function () { + if (this.write_in_progress) { + this.pending_close = true; + return; + } + + this.pending_close = false; + + assert(this.init_done, 'close before init'); + assert(this.mode <= exports.UNZIP); + + if (this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW) { + zlib_deflate.deflateEnd(this.strm); + } else if (this.mode === exports.INFLATE || this.mode === exports.GUNZIP || this.mode === exports.INFLATERAW || this.mode === exports.UNZIP) { + zlib_inflate.inflateEnd(this.strm); + } + + this.mode = exports.NONE; + + this.dictionary = null; +}; + +Zlib.prototype.write = function (flush, input, in_off, in_len, out, out_off, out_len) { + return this._write(true, flush, input, in_off, in_len, out, out_off, out_len); +}; + +Zlib.prototype.writeSync = function (flush, input, in_off, in_len, out, out_off, out_len) { + return this._write(false, flush, input, in_off, in_len, out, out_off, out_len); +}; + +Zlib.prototype._write = function (async, flush, input, in_off, in_len, out, out_off, out_len) { + assert.equal(arguments.length, 8); + + assert(this.init_done, 'write before init'); + assert(this.mode !== exports.NONE, 'already finalized'); + assert.equal(false, this.write_in_progress, 'write already in progress'); + assert.equal(false, this.pending_close, 'close is pending'); + + this.write_in_progress = true; + + assert.equal(false, flush === undefined, 'must provide flush value'); + + this.write_in_progress = true; + + if (flush !== exports.Z_NO_FLUSH && flush !== exports.Z_PARTIAL_FLUSH && flush !== exports.Z_SYNC_FLUSH && flush !== exports.Z_FULL_FLUSH && flush !== exports.Z_FINISH && flush !== exports.Z_BLOCK) { + throw new Error('Invalid flush value'); + } + + if (input == null) { + input = Buffer.alloc(0); + in_len = 0; + in_off = 0; + } + + this.strm.avail_in = in_len; + this.strm.input = input; + this.strm.next_in = in_off; + this.strm.avail_out = out_len; + this.strm.output = out; + this.strm.next_out = out_off; + this.flush = flush; + + if (!async) { + // sync version + this._process(); + + if (this._checkError()) { + return this._afterSync(); + } + return; + } + + // async version + var self = this; + process.nextTick(function () { + self._process(); + self._after(); + }); + + return this; +}; + +Zlib.prototype._afterSync = function () { + var avail_out = this.strm.avail_out; + var avail_in = this.strm.avail_in; + + this.write_in_progress = false; + + return [avail_in, avail_out]; +}; + +Zlib.prototype._process = function () { + var next_expected_header_byte = null; + + // If the avail_out is left at 0, then it means that it ran out + // of room. If there was avail_out left over, then it means + // that all of the input was consumed. + switch (this.mode) { + case exports.DEFLATE: + case exports.GZIP: + case exports.DEFLATERAW: + this.err = zlib_deflate.deflate(this.strm, this.flush); + break; + case exports.UNZIP: + if (this.strm.avail_in > 0) { + next_expected_header_byte = this.strm.next_in; + } + + switch (this.gzip_id_bytes_read) { + case 0: + if (next_expected_header_byte === null) { + break; + } + + if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID1) { + this.gzip_id_bytes_read = 1; + next_expected_header_byte++; + + if (this.strm.avail_in === 1) { + // The only available byte was already read. + break; + } + } else { + this.mode = exports.INFLATE; + break; + } + + // fallthrough + case 1: + if (next_expected_header_byte === null) { + break; + } + + if (this.strm.input[next_expected_header_byte] === GZIP_HEADER_ID2) { + this.gzip_id_bytes_read = 2; + this.mode = exports.GUNZIP; + } else { + // There is no actual difference between INFLATE and INFLATERAW + // (after initialization). + this.mode = exports.INFLATE; + } + + break; + default: + throw new Error('invalid number of gzip magic number bytes read'); + } + + // fallthrough + case exports.INFLATE: + case exports.GUNZIP: + case exports.INFLATERAW: + this.err = zlib_inflate.inflate(this.strm, this.flush + + // If data was encoded with dictionary + );if (this.err === exports.Z_NEED_DICT && this.dictionary) { + // Load it + this.err = zlib_inflate.inflateSetDictionary(this.strm, this.dictionary); + if (this.err === exports.Z_OK) { + // And try to decode again + this.err = zlib_inflate.inflate(this.strm, this.flush); + } else if (this.err === exports.Z_DATA_ERROR) { + // Both inflateSetDictionary() and inflate() return Z_DATA_ERROR. + // Make it possible for After() to tell a bad dictionary from bad + // input. + this.err = exports.Z_NEED_DICT; + } + } + while (this.strm.avail_in > 0 && this.mode === exports.GUNZIP && this.err === exports.Z_STREAM_END && this.strm.next_in[0] !== 0x00) { + // Bytes remain in input buffer. Perhaps this is another compressed + // member in the same archive, or just trailing garbage. + // Trailing zero bytes are okay, though, since they are frequently + // used for padding. + + this.reset(); + this.err = zlib_inflate.inflate(this.strm, this.flush); + } + break; + default: + throw new Error('Unknown mode ' + this.mode); + } +}; + +Zlib.prototype._checkError = function () { + // Acceptable error states depend on the type of zlib stream. + switch (this.err) { + case exports.Z_OK: + case exports.Z_BUF_ERROR: + if (this.strm.avail_out !== 0 && this.flush === exports.Z_FINISH) { + this._error('unexpected end of file'); + return false; + } + break; + case exports.Z_STREAM_END: + // normal statuses, not fatal + break; + case exports.Z_NEED_DICT: + if (this.dictionary == null) { + this._error('Missing dictionary'); + } else { + this._error('Bad dictionary'); + } + return false; + default: + // something else. + this._error('Zlib error'); + return false; + } + + return true; +}; + +Zlib.prototype._after = function () { + if (!this._checkError()) { + return; + } + + var avail_out = this.strm.avail_out; + var avail_in = this.strm.avail_in; + + this.write_in_progress = false; + + // call the write() cb + this.callback(avail_in, avail_out); + + if (this.pending_close) { + this.close(); + } +}; + +Zlib.prototype._error = function (message) { + if (this.strm.msg) { + message = this.strm.msg; + } + this.onerror(message, this.err + + // no hope of rescue. + );this.write_in_progress = false; + if (this.pending_close) { + this.close(); + } +}; + +Zlib.prototype.init = function (windowBits, level, memLevel, strategy, dictionary) { + assert(arguments.length === 4 || arguments.length === 5, 'init(windowBits, level, memLevel, strategy, [dictionary])'); + + assert(windowBits >= 8 && windowBits <= 15, 'invalid windowBits'); + assert(level >= -1 && level <= 9, 'invalid compression level'); + + assert(memLevel >= 1 && memLevel <= 9, 'invalid memlevel'); + + assert(strategy === exports.Z_FILTERED || strategy === exports.Z_HUFFMAN_ONLY || strategy === exports.Z_RLE || strategy === exports.Z_FIXED || strategy === exports.Z_DEFAULT_STRATEGY, 'invalid strategy'); + + this._init(level, windowBits, memLevel, strategy, dictionary); + this._setDictionary(); +}; + +Zlib.prototype.params = function () { + throw new Error('deflateParams Not supported'); +}; + +Zlib.prototype.reset = function () { + this._reset(); + this._setDictionary(); +}; + +Zlib.prototype._init = function (level, windowBits, memLevel, strategy, dictionary) { + this.level = level; + this.windowBits = windowBits; + this.memLevel = memLevel; + this.strategy = strategy; + + this.flush = exports.Z_NO_FLUSH; + + this.err = exports.Z_OK; + + if (this.mode === exports.GZIP || this.mode === exports.GUNZIP) { + this.windowBits += 16; + } + + if (this.mode === exports.UNZIP) { + this.windowBits += 32; + } + + if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW) { + this.windowBits = -1 * this.windowBits; + } + + this.strm = new Zstream(); + + switch (this.mode) { + case exports.DEFLATE: + case exports.GZIP: + case exports.DEFLATERAW: + this.err = zlib_deflate.deflateInit2(this.strm, this.level, exports.Z_DEFLATED, this.windowBits, this.memLevel, this.strategy); + break; + case exports.INFLATE: + case exports.GUNZIP: + case exports.INFLATERAW: + case exports.UNZIP: + this.err = zlib_inflate.inflateInit2(this.strm, this.windowBits); + break; + default: + throw new Error('Unknown mode ' + this.mode); + } + + if (this.err !== exports.Z_OK) { + this._error('Init error'); + } + + this.dictionary = dictionary; + + this.write_in_progress = false; + this.init_done = true; +}; + +Zlib.prototype._setDictionary = function () { + if (this.dictionary == null) { + return; + } + + this.err = exports.Z_OK; + + switch (this.mode) { + case exports.DEFLATE: + case exports.DEFLATERAW: + this.err = zlib_deflate.deflateSetDictionary(this.strm, this.dictionary); + break; + default: + break; + } + + if (this.err !== exports.Z_OK) { + this._error('Failed to set dictionary'); + } +}; + +Zlib.prototype._reset = function () { + this.err = exports.Z_OK; + + switch (this.mode) { + case exports.DEFLATE: + case exports.DEFLATERAW: + case exports.GZIP: + this.err = zlib_deflate.deflateReset(this.strm); + break; + case exports.INFLATE: + case exports.INFLATERAW: + case exports.GUNZIP: + this.err = zlib_inflate.inflateReset(this.strm); + break; + default: + break; + } + + if (this.err !== exports.Z_OK) { + this._error('Failed to reset stream'); + } +}; + +exports.Zlib = Zlib; +}).call(this,require('_process'),require("buffer").Buffer) +},{"_process":51,"assert":23,"buffer":32,"pako/lib/zlib/constants":41,"pako/lib/zlib/deflate.js":43,"pako/lib/zlib/inflate.js":45,"pako/lib/zlib/zstream":49}],30:[function(require,module,exports){ +(function (process){ +'use strict'; + +var Buffer = require('buffer').Buffer; +var Transform = require('stream').Transform; +var binding = require('./binding'); +var util = require('util'); +var assert = require('assert').ok; +var kMaxLength = require('buffer').kMaxLength; +var kRangeErrorMessage = 'Cannot create final Buffer. It would be larger ' + 'than 0x' + kMaxLength.toString(16) + ' bytes'; + +// zlib doesn't provide these, so kludge them in following the same +// const naming scheme zlib uses. +binding.Z_MIN_WINDOWBITS = 8; +binding.Z_MAX_WINDOWBITS = 15; +binding.Z_DEFAULT_WINDOWBITS = 15; + +// fewer than 64 bytes per chunk is stupid. +// technically it could work with as few as 8, but even 64 bytes +// is absurdly low. Usually a MB or more is best. +binding.Z_MIN_CHUNK = 64; +binding.Z_MAX_CHUNK = Infinity; +binding.Z_DEFAULT_CHUNK = 16 * 1024; + +binding.Z_MIN_MEMLEVEL = 1; +binding.Z_MAX_MEMLEVEL = 9; +binding.Z_DEFAULT_MEMLEVEL = 8; + +binding.Z_MIN_LEVEL = -1; +binding.Z_MAX_LEVEL = 9; +binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION; + +// expose all the zlib constants +var bkeys = Object.keys(binding); +for (var bk = 0; bk < bkeys.length; bk++) { + var bkey = bkeys[bk]; + if (bkey.match(/^Z/)) { + Object.defineProperty(exports, bkey, { + enumerable: true, value: binding[bkey], writable: false + }); + } +} + +// translation table for return codes. +var codes = { + Z_OK: binding.Z_OK, + Z_STREAM_END: binding.Z_STREAM_END, + Z_NEED_DICT: binding.Z_NEED_DICT, + Z_ERRNO: binding.Z_ERRNO, + Z_STREAM_ERROR: binding.Z_STREAM_ERROR, + Z_DATA_ERROR: binding.Z_DATA_ERROR, + Z_MEM_ERROR: binding.Z_MEM_ERROR, + Z_BUF_ERROR: binding.Z_BUF_ERROR, + Z_VERSION_ERROR: binding.Z_VERSION_ERROR +}; + +var ckeys = Object.keys(codes); +for (var ck = 0; ck < ckeys.length; ck++) { + var ckey = ckeys[ck]; + codes[codes[ckey]] = ckey; +} + +Object.defineProperty(exports, 'codes', { + enumerable: true, value: Object.freeze(codes), writable: false +}); + +exports.Deflate = Deflate; +exports.Inflate = Inflate; +exports.Gzip = Gzip; +exports.Gunzip = Gunzip; +exports.DeflateRaw = DeflateRaw; +exports.InflateRaw = InflateRaw; +exports.Unzip = Unzip; + +exports.createDeflate = function (o) { + return new Deflate(o); +}; + +exports.createInflate = function (o) { + return new Inflate(o); +}; + +exports.createDeflateRaw = function (o) { + return new DeflateRaw(o); +}; + +exports.createInflateRaw = function (o) { + return new InflateRaw(o); +}; + +exports.createGzip = function (o) { + return new Gzip(o); +}; + +exports.createGunzip = function (o) { + return new Gunzip(o); +}; + +exports.createUnzip = function (o) { + return new Unzip(o); +}; + +// Convenience methods. +// compress/decompress a string or buffer in one step. +exports.deflate = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Deflate(opts), buffer, callback); +}; + +exports.deflateSync = function (buffer, opts) { + return zlibBufferSync(new Deflate(opts), buffer); +}; + +exports.gzip = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Gzip(opts), buffer, callback); +}; + +exports.gzipSync = function (buffer, opts) { + return zlibBufferSync(new Gzip(opts), buffer); +}; + +exports.deflateRaw = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new DeflateRaw(opts), buffer, callback); +}; + +exports.deflateRawSync = function (buffer, opts) { + return zlibBufferSync(new DeflateRaw(opts), buffer); +}; + +exports.unzip = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Unzip(opts), buffer, callback); +}; + +exports.unzipSync = function (buffer, opts) { + return zlibBufferSync(new Unzip(opts), buffer); +}; + +exports.inflate = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Inflate(opts), buffer, callback); +}; + +exports.inflateSync = function (buffer, opts) { + return zlibBufferSync(new Inflate(opts), buffer); +}; + +exports.gunzip = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Gunzip(opts), buffer, callback); +}; + +exports.gunzipSync = function (buffer, opts) { + return zlibBufferSync(new Gunzip(opts), buffer); +}; + +exports.inflateRaw = function (buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new InflateRaw(opts), buffer, callback); +}; + +exports.inflateRawSync = function (buffer, opts) { + return zlibBufferSync(new InflateRaw(opts), buffer); +}; + +function zlibBuffer(engine, buffer, callback) { + var buffers = []; + var nread = 0; + + engine.on('error', onError); + engine.on('end', onEnd); + + engine.end(buffer); + flow(); + + function flow() { + var chunk; + while (null !== (chunk = engine.read())) { + buffers.push(chunk); + nread += chunk.length; + } + engine.once('readable', flow); + } + + function onError(err) { + engine.removeListener('end', onEnd); + engine.removeListener('readable', flow); + callback(err); + } + + function onEnd() { + var buf; + var err = null; + + if (nread >= kMaxLength) { + err = new RangeError(kRangeErrorMessage); + } else { + buf = Buffer.concat(buffers, nread); + } + + buffers = []; + engine.close(); + callback(err, buf); + } +} + +function zlibBufferSync(engine, buffer) { + if (typeof buffer === 'string') buffer = Buffer.from(buffer); + + if (!Buffer.isBuffer(buffer)) throw new TypeError('Not a string or buffer'); + + var flushFlag = engine._finishFlushFlag; + + return engine._processChunk(buffer, flushFlag); +} + +// generic zlib +// minimal 2-byte header +function Deflate(opts) { + if (!(this instanceof Deflate)) return new Deflate(opts); + Zlib.call(this, opts, binding.DEFLATE); +} + +function Inflate(opts) { + if (!(this instanceof Inflate)) return new Inflate(opts); + Zlib.call(this, opts, binding.INFLATE); +} + +// gzip - bigger header, same deflate compression +function Gzip(opts) { + if (!(this instanceof Gzip)) return new Gzip(opts); + Zlib.call(this, opts, binding.GZIP); +} + +function Gunzip(opts) { + if (!(this instanceof Gunzip)) return new Gunzip(opts); + Zlib.call(this, opts, binding.GUNZIP); +} + +// raw - no header +function DeflateRaw(opts) { + if (!(this instanceof DeflateRaw)) return new DeflateRaw(opts); + Zlib.call(this, opts, binding.DEFLATERAW); +} + +function InflateRaw(opts) { + if (!(this instanceof InflateRaw)) return new InflateRaw(opts); + Zlib.call(this, opts, binding.INFLATERAW); +} + +// auto-detect header. +function Unzip(opts) { + if (!(this instanceof Unzip)) return new Unzip(opts); + Zlib.call(this, opts, binding.UNZIP); +} + +function isValidFlushFlag(flag) { + return flag === binding.Z_NO_FLUSH || flag === binding.Z_PARTIAL_FLUSH || flag === binding.Z_SYNC_FLUSH || flag === binding.Z_FULL_FLUSH || flag === binding.Z_FINISH || flag === binding.Z_BLOCK; +} + +// the Zlib class they all inherit from +// This thing manages the queue of requests, and returns +// true or false if there is anything in the queue when +// you call the .write() method. + +function Zlib(opts, mode) { + var _this = this; + + this._opts = opts = opts || {}; + this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK; + + Transform.call(this, opts); + + if (opts.flush && !isValidFlushFlag(opts.flush)) { + throw new Error('Invalid flush flag: ' + opts.flush); + } + if (opts.finishFlush && !isValidFlushFlag(opts.finishFlush)) { + throw new Error('Invalid flush flag: ' + opts.finishFlush); + } + + this._flushFlag = opts.flush || binding.Z_NO_FLUSH; + this._finishFlushFlag = typeof opts.finishFlush !== 'undefined' ? opts.finishFlush : binding.Z_FINISH; + + if (opts.chunkSize) { + if (opts.chunkSize < exports.Z_MIN_CHUNK || opts.chunkSize > exports.Z_MAX_CHUNK) { + throw new Error('Invalid chunk size: ' + opts.chunkSize); + } + } + + if (opts.windowBits) { + if (opts.windowBits < exports.Z_MIN_WINDOWBITS || opts.windowBits > exports.Z_MAX_WINDOWBITS) { + throw new Error('Invalid windowBits: ' + opts.windowBits); + } + } + + if (opts.level) { + if (opts.level < exports.Z_MIN_LEVEL || opts.level > exports.Z_MAX_LEVEL) { + throw new Error('Invalid compression level: ' + opts.level); + } + } + + if (opts.memLevel) { + if (opts.memLevel < exports.Z_MIN_MEMLEVEL || opts.memLevel > exports.Z_MAX_MEMLEVEL) { + throw new Error('Invalid memLevel: ' + opts.memLevel); + } + } + + if (opts.strategy) { + if (opts.strategy != exports.Z_FILTERED && opts.strategy != exports.Z_HUFFMAN_ONLY && opts.strategy != exports.Z_RLE && opts.strategy != exports.Z_FIXED && opts.strategy != exports.Z_DEFAULT_STRATEGY) { + throw new Error('Invalid strategy: ' + opts.strategy); + } + } + + if (opts.dictionary) { + if (!Buffer.isBuffer(opts.dictionary)) { + throw new Error('Invalid dictionary: it should be a Buffer instance'); + } + } + + this._handle = new binding.Zlib(mode); + + var self = this; + this._hadError = false; + this._handle.onerror = function (message, errno) { + // there is no way to cleanly recover. + // continuing only obscures problems. + _close(self); + self._hadError = true; + + var error = new Error(message); + error.errno = errno; + error.code = exports.codes[errno]; + self.emit('error', error); + }; + + var level = exports.Z_DEFAULT_COMPRESSION; + if (typeof opts.level === 'number') level = opts.level; + + var strategy = exports.Z_DEFAULT_STRATEGY; + if (typeof opts.strategy === 'number') strategy = opts.strategy; + + this._handle.init(opts.windowBits || exports.Z_DEFAULT_WINDOWBITS, level, opts.memLevel || exports.Z_DEFAULT_MEMLEVEL, strategy, opts.dictionary); + + this._buffer = Buffer.allocUnsafe(this._chunkSize); + this._offset = 0; + this._level = level; + this._strategy = strategy; + + this.once('end', this.close); + + Object.defineProperty(this, '_closed', { + get: function () { + return !_this._handle; + }, + configurable: true, + enumerable: true + }); +} + +util.inherits(Zlib, Transform); + +Zlib.prototype.params = function (level, strategy, callback) { + if (level < exports.Z_MIN_LEVEL || level > exports.Z_MAX_LEVEL) { + throw new RangeError('Invalid compression level: ' + level); + } + if (strategy != exports.Z_FILTERED && strategy != exports.Z_HUFFMAN_ONLY && strategy != exports.Z_RLE && strategy != exports.Z_FIXED && strategy != exports.Z_DEFAULT_STRATEGY) { + throw new TypeError('Invalid strategy: ' + strategy); + } + + if (this._level !== level || this._strategy !== strategy) { + var self = this; + this.flush(binding.Z_SYNC_FLUSH, function () { + assert(self._handle, 'zlib binding closed'); + self._handle.params(level, strategy); + if (!self._hadError) { + self._level = level; + self._strategy = strategy; + if (callback) callback(); + } + }); + } else { + process.nextTick(callback); + } +}; + +Zlib.prototype.reset = function () { + assert(this._handle, 'zlib binding closed'); + return this._handle.reset(); +}; + +// This is the _flush function called by the transform class, +// internally, when the last chunk has been written. +Zlib.prototype._flush = function (callback) { + this._transform(Buffer.alloc(0), '', callback); +}; + +Zlib.prototype.flush = function (kind, callback) { + var _this2 = this; + + var ws = this._writableState; + + if (typeof kind === 'function' || kind === undefined && !callback) { + callback = kind; + kind = binding.Z_FULL_FLUSH; + } + + if (ws.ended) { + if (callback) process.nextTick(callback); + } else if (ws.ending) { + if (callback) this.once('end', callback); + } else if (ws.needDrain) { + if (callback) { + this.once('drain', function () { + return _this2.flush(kind, callback); + }); + } + } else { + this._flushFlag = kind; + this.write(Buffer.alloc(0), '', callback); + } +}; + +Zlib.prototype.close = function (callback) { + _close(this, callback); + process.nextTick(emitCloseNT, this); +}; + +function _close(engine, callback) { + if (callback) process.nextTick(callback); + + // Caller may invoke .close after a zlib error (which will null _handle). + if (!engine._handle) return; + + engine._handle.close(); + engine._handle = null; +} + +function emitCloseNT(self) { + self.emit('close'); +} + +Zlib.prototype._transform = function (chunk, encoding, cb) { + var flushFlag; + var ws = this._writableState; + var ending = ws.ending || ws.ended; + var last = ending && (!chunk || ws.length === chunk.length); + + if (chunk !== null && !Buffer.isBuffer(chunk)) return cb(new Error('invalid input')); + + if (!this._handle) return cb(new Error('zlib binding closed')); + + // If it's the last chunk, or a final flush, we use the Z_FINISH flush flag + // (or whatever flag was provided using opts.finishFlush). + // If it's explicitly flushing at some other time, then we use + // Z_FULL_FLUSH. Otherwise, use Z_NO_FLUSH for maximum compression + // goodness. + if (last) flushFlag = this._finishFlushFlag;else { + flushFlag = this._flushFlag; + // once we've flushed the last of the queue, stop flushing and + // go back to the normal behavior. + if (chunk.length >= ws.length) { + this._flushFlag = this._opts.flush || binding.Z_NO_FLUSH; + } + } + + this._processChunk(chunk, flushFlag, cb); +}; + +Zlib.prototype._processChunk = function (chunk, flushFlag, cb) { + var availInBefore = chunk && chunk.length; + var availOutBefore = this._chunkSize - this._offset; + var inOff = 0; + + var self = this; + + var async = typeof cb === 'function'; + + if (!async) { + var buffers = []; + var nread = 0; + + var error; + this.on('error', function (er) { + error = er; + }); + + assert(this._handle, 'zlib binding closed'); + do { + var res = this._handle.writeSync(flushFlag, chunk, // in + inOff, // in_off + availInBefore, // in_len + this._buffer, // out + this._offset, //out_off + availOutBefore); // out_len + } while (!this._hadError && callback(res[0], res[1])); + + if (this._hadError) { + throw error; + } + + if (nread >= kMaxLength) { + _close(this); + throw new RangeError(kRangeErrorMessage); + } + + var buf = Buffer.concat(buffers, nread); + _close(this); + + return buf; + } + + assert(this._handle, 'zlib binding closed'); + var req = this._handle.write(flushFlag, chunk, // in + inOff, // in_off + availInBefore, // in_len + this._buffer, // out + this._offset, //out_off + availOutBefore); // out_len + + req.buffer = chunk; + req.callback = callback; + + function callback(availInAfter, availOutAfter) { + // When the callback is used in an async write, the callback's + // context is the `req` object that was created. The req object + // is === this._handle, and that's why it's important to null + // out the values after they are done being used. `this._handle` + // can stay in memory longer than the callback and buffer are needed. + if (this) { + this.buffer = null; + this.callback = null; + } + + if (self._hadError) return; + + var have = availOutBefore - availOutAfter; + assert(have >= 0, 'have should not go down'); + + if (have > 0) { + var out = self._buffer.slice(self._offset, self._offset + have); + self._offset += have; + // serve some output to the consumer. + if (async) { + self.push(out); + } else { + buffers.push(out); + nread += out.length; + } + } + + // exhausted the output buffer, or used all the input create a new one. + if (availOutAfter === 0 || self._offset >= self._chunkSize) { + availOutBefore = self._chunkSize; + self._offset = 0; + self._buffer = Buffer.allocUnsafe(self._chunkSize); + } + + if (availOutAfter === 0) { + // Not actually done. Need to reprocess. + // Also, update the availInBefore to the availInAfter value, + // so that if we have to hit it a third (fourth, etc.) time, + // it'll have the correct byte counts. + inOff += availInBefore - availInAfter; + availInBefore = availInAfter; + + if (!async) return true; + + var newReq = self._handle.write(flushFlag, chunk, inOff, availInBefore, self._buffer, self._offset, self._chunkSize); + newReq.callback = callback; // this same function + newReq.buffer = chunk; + return; + } + + if (!async) return false; + + // finished with the chunk. + cb(); + } +}; + +util.inherits(Deflate, Zlib); +util.inherits(Inflate, Zlib); +util.inherits(Gzip, Zlib); +util.inherits(Gunzip, Zlib); +util.inherits(DeflateRaw, Zlib); +util.inherits(InflateRaw, Zlib); +util.inherits(Unzip, Zlib); +}).call(this,require('_process')) +},{"./binding":29,"_process":51,"assert":23,"buffer":32,"stream":64,"util":69}],31:[function(require,module,exports){ +(function (global){ +'use strict'; + +var buffer = require('buffer'); +var Buffer = buffer.Buffer; +var SlowBuffer = buffer.SlowBuffer; +var MAX_LEN = buffer.kMaxLength || 2147483647; +exports.alloc = function alloc(size, fill, encoding) { + if (typeof Buffer.alloc === 'function') { + return Buffer.alloc(size, fill, encoding); + } + if (typeof encoding === 'number') { + throw new TypeError('encoding must not be number'); + } + if (typeof size !== 'number') { + throw new TypeError('size must be a number'); + } + if (size > MAX_LEN) { + throw new RangeError('size is too large'); + } + var enc = encoding; + var _fill = fill; + if (_fill === undefined) { + enc = undefined; + _fill = 0; + } + var buf = new Buffer(size); + if (typeof _fill === 'string') { + var fillBuf = new Buffer(_fill, enc); + var flen = fillBuf.length; + var i = -1; + while (++i < size) { + buf[i] = fillBuf[i % flen]; + } + } else { + buf.fill(_fill); + } + return buf; +} +exports.allocUnsafe = function allocUnsafe(size) { + if (typeof Buffer.allocUnsafe === 'function') { + return Buffer.allocUnsafe(size); + } + if (typeof size !== 'number') { + throw new TypeError('size must be a number'); + } + if (size > MAX_LEN) { + throw new RangeError('size is too large'); + } + return new Buffer(size); +} +exports.from = function from(value, encodingOrOffset, length) { + if (typeof Buffer.from === 'function' && (!global.Uint8Array || Uint8Array.from !== Buffer.from)) { + return Buffer.from(value, encodingOrOffset, length); + } + if (typeof value === 'number') { + throw new TypeError('"value" argument must not be a number'); + } + if (typeof value === 'string') { + return new Buffer(value, encodingOrOffset); + } + if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { + var offset = encodingOrOffset; + if (arguments.length === 1) { + return new Buffer(value); + } + if (typeof offset === 'undefined') { + offset = 0; + } + var len = length; + if (typeof len === 'undefined') { + len = value.byteLength - offset; + } + if (offset >= value.byteLength) { + throw new RangeError('\'offset\' is out of bounds'); + } + if (len > value.byteLength - offset) { + throw new RangeError('\'length\' is out of bounds'); + } + return new Buffer(value.slice(offset, offset + len)); + } + if (Buffer.isBuffer(value)) { + var out = new Buffer(value.length); + value.copy(out, 0, 0, value.length); + return out; + } + if (value) { + if (Array.isArray(value) || (typeof ArrayBuffer !== 'undefined' && value.buffer instanceof ArrayBuffer) || 'length' in value) { + return new Buffer(value); + } + if (value.type === 'Buffer' && Array.isArray(value.data)) { + return new Buffer(value.data); + } + } + + throw new TypeError('First argument must be a string, Buffer, ' + 'ArrayBuffer, Array, or array-like object.'); +} +exports.allocUnsafeSlow = function allocUnsafeSlow(size) { + if (typeof Buffer.allocUnsafeSlow === 'function') { + return Buffer.allocUnsafeSlow(size); + } + if (typeof size !== 'number') { + throw new TypeError('size must be a number'); + } + if (size >= MAX_LEN) { + throw new RangeError('size is too large'); + } + return new SlowBuffer(size); +} + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"buffer":32}],32:[function(require,module,exports){ +(function (Buffer){ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +/* eslint-disable no-proto */ + +'use strict' + +var base64 = require('base64-js') +var ieee754 = require('ieee754') + +exports.Buffer = Buffer +exports.SlowBuffer = SlowBuffer +exports.INSPECT_MAX_BYTES = 50 + +var K_MAX_LENGTH = 0x7fffffff +exports.kMaxLength = K_MAX_LENGTH + +/** + * If `Buffer.TYPED_ARRAY_SUPPORT`: + * === true Use Uint8Array implementation (fastest) + * === false Print warning and recommend using `buffer` v4.x which has an Object + * implementation (most compatible, even IE6) + * + * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, + * Opera 11.6+, iOS 4.2+. + * + * We report that the browser does not support typed arrays if the are not subclassable + * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` + * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support + * for __proto__ and has a buggy typed array implementation. + */ +Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport() + +if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && + typeof console.error === 'function') { + console.error( + 'This browser lacks typed array (Uint8Array) support which is required by ' + + '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.' + ) +} + +function typedArraySupport () { + // Can typed array instances can be augmented? + try { + var arr = new Uint8Array(1) + arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } } + return arr.foo() === 42 + } catch (e) { + return false + } +} + +Object.defineProperty(Buffer.prototype, 'parent', { + enumerable: true, + get: function () { + if (!Buffer.isBuffer(this)) return undefined + return this.buffer + } +}) + +Object.defineProperty(Buffer.prototype, 'offset', { + enumerable: true, + get: function () { + if (!Buffer.isBuffer(this)) return undefined + return this.byteOffset + } +}) + +function createBuffer (length) { + if (length > K_MAX_LENGTH) { + throw new RangeError('The value "' + length + '" is invalid for option "size"') + } + // Return an augmented `Uint8Array` instance + var buf = new Uint8Array(length) + buf.__proto__ = Buffer.prototype + return buf +} + +/** + * The Buffer constructor returns instances of `Uint8Array` that have their + * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of + * `Uint8Array`, so the returned instances will have all the node `Buffer` methods + * and the `Uint8Array` methods. Square bracket notation works as expected -- it + * returns a single octet. + * + * The `Uint8Array` prototype remains unmodified. + */ + +function Buffer (arg, encodingOrOffset, length) { + // Common case. + if (typeof arg === 'number') { + if (typeof encodingOrOffset === 'string') { + throw new TypeError( + 'The "string" argument must be of type string. Received type number' + ) + } + return allocUnsafe(arg) + } + return from(arg, encodingOrOffset, length) +} + +// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 +if (typeof Symbol !== 'undefined' && Symbol.species != null && + Buffer[Symbol.species] === Buffer) { + Object.defineProperty(Buffer, Symbol.species, { + value: null, + configurable: true, + enumerable: false, + writable: false + }) +} + +Buffer.poolSize = 8192 // not used by this implementation + +function from (value, encodingOrOffset, length) { + if (typeof value === 'string') { + return fromString(value, encodingOrOffset) + } + + if (ArrayBuffer.isView(value)) { + return fromArrayLike(value) + } + + if (value == null) { + throw TypeError( + 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + + 'or Array-like Object. Received type ' + (typeof value) + ) + } + + if (isInstance(value, ArrayBuffer) || + (value && isInstance(value.buffer, ArrayBuffer))) { + return fromArrayBuffer(value, encodingOrOffset, length) + } + + if (typeof value === 'number') { + throw new TypeError( + 'The "value" argument must not be of type number. Received type number' + ) + } + + var valueOf = value.valueOf && value.valueOf() + if (valueOf != null && valueOf !== value) { + return Buffer.from(valueOf, encodingOrOffset, length) + } + + var b = fromObject(value) + if (b) return b + + if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && + typeof value[Symbol.toPrimitive] === 'function') { + return Buffer.from( + value[Symbol.toPrimitive]('string'), encodingOrOffset, length + ) + } + + throw new TypeError( + 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + + 'or Array-like Object. Received type ' + (typeof value) + ) +} + +/** + * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError + * if value is a number. + * Buffer.from(str[, encoding]) + * Buffer.from(array) + * Buffer.from(buffer) + * Buffer.from(arrayBuffer[, byteOffset[, length]]) + **/ +Buffer.from = function (value, encodingOrOffset, length) { + return from(value, encodingOrOffset, length) +} + +// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: +// https://github.com/feross/buffer/pull/148 +Buffer.prototype.__proto__ = Uint8Array.prototype +Buffer.__proto__ = Uint8Array + +function assertSize (size) { + if (typeof size !== 'number') { + throw new TypeError('"size" argument must be of type number') + } else if (size < 0) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') + } +} + +function alloc (size, fill, encoding) { + assertSize(size) + if (size <= 0) { + return createBuffer(size) + } + if (fill !== undefined) { + // Only pay attention to encoding if it's a string. This + // prevents accidentally sending in a number that would + // be interpretted as a start offset. + return typeof encoding === 'string' + ? createBuffer(size).fill(fill, encoding) + : createBuffer(size).fill(fill) + } + return createBuffer(size) +} + +/** + * Creates a new filled Buffer instance. + * alloc(size[, fill[, encoding]]) + **/ +Buffer.alloc = function (size, fill, encoding) { + return alloc(size, fill, encoding) +} + +function allocUnsafe (size) { + assertSize(size) + return createBuffer(size < 0 ? 0 : checked(size) | 0) +} + +/** + * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. + * */ +Buffer.allocUnsafe = function (size) { + return allocUnsafe(size) +} +/** + * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. + */ +Buffer.allocUnsafeSlow = function (size) { + return allocUnsafe(size) +} + +function fromString (string, encoding) { + if (typeof encoding !== 'string' || encoding === '') { + encoding = 'utf8' + } + + if (!Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding) + } + + var length = byteLength(string, encoding) | 0 + var buf = createBuffer(length) + + var actual = buf.write(string, encoding) + + if (actual !== length) { + // Writing a hex string, for example, that contains invalid characters will + // cause everything after the first invalid character to be ignored. (e.g. + // 'abxxcd' will be treated as 'ab') + buf = buf.slice(0, actual) + } + + return buf +} + +function fromArrayLike (array) { + var length = array.length < 0 ? 0 : checked(array.length) | 0 + var buf = createBuffer(length) + for (var i = 0; i < length; i += 1) { + buf[i] = array[i] & 255 + } + return buf +} + +function fromArrayBuffer (array, byteOffset, length) { + if (byteOffset < 0 || array.byteLength < byteOffset) { + throw new RangeError('"offset" is outside of buffer bounds') + } + + if (array.byteLength < byteOffset + (length || 0)) { + throw new RangeError('"length" is outside of buffer bounds') + } + + var buf + if (byteOffset === undefined && length === undefined) { + buf = new Uint8Array(array) + } else if (length === undefined) { + buf = new Uint8Array(array, byteOffset) + } else { + buf = new Uint8Array(array, byteOffset, length) + } + + // Return an augmented `Uint8Array` instance + buf.__proto__ = Buffer.prototype + return buf +} + +function fromObject (obj) { + if (Buffer.isBuffer(obj)) { + var len = checked(obj.length) | 0 + var buf = createBuffer(len) + + if (buf.length === 0) { + return buf + } + + obj.copy(buf, 0, 0, len) + return buf + } + + if (obj.length !== undefined) { + if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { + return createBuffer(0) + } + return fromArrayLike(obj) + } + + if (obj.type === 'Buffer' && Array.isArray(obj.data)) { + return fromArrayLike(obj.data) + } +} + +function checked (length) { + // Note: cannot use `length < K_MAX_LENGTH` here because that fails when + // length is NaN (which is otherwise coerced to zero.) + if (length >= K_MAX_LENGTH) { + throw new RangeError('Attempt to allocate Buffer larger than maximum ' + + 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes') + } + return length | 0 +} + +function SlowBuffer (length) { + if (+length != length) { // eslint-disable-line eqeqeq + length = 0 + } + return Buffer.alloc(+length) +} + +Buffer.isBuffer = function isBuffer (b) { + return b != null && b._isBuffer === true && + b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false +} + +Buffer.compare = function compare (a, b) { + if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) + if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) + if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { + throw new TypeError( + 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' + ) + } + + if (a === b) return 0 + + var x = a.length + var y = b.length + + for (var i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i] + y = b[i] + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 +} + +Buffer.isEncoding = function isEncoding (encoding) { + switch (String(encoding).toLowerCase()) { + case 'hex': + case 'utf8': + case 'utf-8': + case 'ascii': + case 'latin1': + case 'binary': + case 'base64': + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return true + default: + return false + } +} + +Buffer.concat = function concat (list, length) { + if (!Array.isArray(list)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } + + if (list.length === 0) { + return Buffer.alloc(0) + } + + var i + if (length === undefined) { + length = 0 + for (i = 0; i < list.length; ++i) { + length += list[i].length + } + } + + var buffer = Buffer.allocUnsafe(length) + var pos = 0 + for (i = 0; i < list.length; ++i) { + var buf = list[i] + if (isInstance(buf, Uint8Array)) { + buf = Buffer.from(buf) + } + if (!Buffer.isBuffer(buf)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } + buf.copy(buffer, pos) + pos += buf.length + } + return buffer +} + +function byteLength (string, encoding) { + if (Buffer.isBuffer(string)) { + return string.length + } + if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { + return string.byteLength + } + if (typeof string !== 'string') { + throw new TypeError( + 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + + 'Received type ' + typeof string + ) + } + + var len = string.length + var mustMatch = (arguments.length > 2 && arguments[2] === true) + if (!mustMatch && len === 0) return 0 + + // Use a for loop to avoid recursion + var loweredCase = false + for (;;) { + switch (encoding) { + case 'ascii': + case 'latin1': + case 'binary': + return len + case 'utf8': + case 'utf-8': + return utf8ToBytes(string).length + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return len * 2 + case 'hex': + return len >>> 1 + case 'base64': + return base64ToBytes(string).length + default: + if (loweredCase) { + return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 + } + encoding = ('' + encoding).toLowerCase() + loweredCase = true + } + } +} +Buffer.byteLength = byteLength + +function slowToString (encoding, start, end) { + var loweredCase = false + + // No need to verify that "this.length <= MAX_UINT32" since it's a read-only + // property of a typed array. + + // This behaves neither like String nor Uint8Array in that we set start/end + // to their upper/lower bounds if the value passed is out of range. + // undefined is handled specially as per ECMA-262 6th Edition, + // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. + if (start === undefined || start < 0) { + start = 0 + } + // Return early if start > this.length. Done here to prevent potential uint32 + // coercion fail below. + if (start > this.length) { + return '' + } + + if (end === undefined || end > this.length) { + end = this.length + } + + if (end <= 0) { + return '' + } + + // Force coersion to uint32. This will also coerce falsey/NaN values to 0. + end >>>= 0 + start >>>= 0 + + if (end <= start) { + return '' + } + + if (!encoding) encoding = 'utf8' + + while (true) { + switch (encoding) { + case 'hex': + return hexSlice(this, start, end) + + case 'utf8': + case 'utf-8': + return utf8Slice(this, start, end) + + case 'ascii': + return asciiSlice(this, start, end) + + case 'latin1': + case 'binary': + return latin1Slice(this, start, end) + + case 'base64': + return base64Slice(this, start, end) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return utf16leSlice(this, start, end) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = (encoding + '').toLowerCase() + loweredCase = true + } + } +} + +// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) +// to detect a Buffer instance. It's not possible to use `instanceof Buffer` +// reliably in a browserify context because there could be multiple different +// copies of the 'buffer' package in use. This method works even for Buffer +// instances that were created from another copy of the `buffer` package. +// See: https://github.com/feross/buffer/issues/154 +Buffer.prototype._isBuffer = true + +function swap (b, n, m) { + var i = b[n] + b[n] = b[m] + b[m] = i +} + +Buffer.prototype.swap16 = function swap16 () { + var len = this.length + if (len % 2 !== 0) { + throw new RangeError('Buffer size must be a multiple of 16-bits') + } + for (var i = 0; i < len; i += 2) { + swap(this, i, i + 1) + } + return this +} + +Buffer.prototype.swap32 = function swap32 () { + var len = this.length + if (len % 4 !== 0) { + throw new RangeError('Buffer size must be a multiple of 32-bits') + } + for (var i = 0; i < len; i += 4) { + swap(this, i, i + 3) + swap(this, i + 1, i + 2) + } + return this +} + +Buffer.prototype.swap64 = function swap64 () { + var len = this.length + if (len % 8 !== 0) { + throw new RangeError('Buffer size must be a multiple of 64-bits') + } + for (var i = 0; i < len; i += 8) { + swap(this, i, i + 7) + swap(this, i + 1, i + 6) + swap(this, i + 2, i + 5) + swap(this, i + 3, i + 4) + } + return this +} + +Buffer.prototype.toString = function toString () { + var length = this.length + if (length === 0) return '' + if (arguments.length === 0) return utf8Slice(this, 0, length) + return slowToString.apply(this, arguments) +} + +Buffer.prototype.toLocaleString = Buffer.prototype.toString + +Buffer.prototype.equals = function equals (b) { + if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') + if (this === b) return true + return Buffer.compare(this, b) === 0 +} + +Buffer.prototype.inspect = function inspect () { + var str = '' + var max = exports.INSPECT_MAX_BYTES + str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() + if (this.length > max) str += ' ... ' + return '' +} + +Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { + if (isInstance(target, Uint8Array)) { + target = Buffer.from(target, target.offset, target.byteLength) + } + if (!Buffer.isBuffer(target)) { + throw new TypeError( + 'The "target" argument must be one of type Buffer or Uint8Array. ' + + 'Received type ' + (typeof target) + ) + } + + if (start === undefined) { + start = 0 + } + if (end === undefined) { + end = target ? target.length : 0 + } + if (thisStart === undefined) { + thisStart = 0 + } + if (thisEnd === undefined) { + thisEnd = this.length + } + + if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { + throw new RangeError('out of range index') + } + + if (thisStart >= thisEnd && start >= end) { + return 0 + } + if (thisStart >= thisEnd) { + return -1 + } + if (start >= end) { + return 1 + } + + start >>>= 0 + end >>>= 0 + thisStart >>>= 0 + thisEnd >>>= 0 + + if (this === target) return 0 + + var x = thisEnd - thisStart + var y = end - start + var len = Math.min(x, y) + + var thisCopy = this.slice(thisStart, thisEnd) + var targetCopy = target.slice(start, end) + + for (var i = 0; i < len; ++i) { + if (thisCopy[i] !== targetCopy[i]) { + x = thisCopy[i] + y = targetCopy[i] + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 +} + +// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, +// OR the last index of `val` in `buffer` at offset <= `byteOffset`. +// +// Arguments: +// - buffer - a Buffer to search +// - val - a string, Buffer, or number +// - byteOffset - an index into `buffer`; will be clamped to an int32 +// - encoding - an optional encoding, relevant is val is a string +// - dir - true for indexOf, false for lastIndexOf +function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { + // Empty buffer means no match + if (buffer.length === 0) return -1 + + // Normalize byteOffset + if (typeof byteOffset === 'string') { + encoding = byteOffset + byteOffset = 0 + } else if (byteOffset > 0x7fffffff) { + byteOffset = 0x7fffffff + } else if (byteOffset < -0x80000000) { + byteOffset = -0x80000000 + } + byteOffset = +byteOffset // Coerce to Number. + if (numberIsNaN(byteOffset)) { + // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer + byteOffset = dir ? 0 : (buffer.length - 1) + } + + // Normalize byteOffset: negative offsets start from the end of the buffer + if (byteOffset < 0) byteOffset = buffer.length + byteOffset + if (byteOffset >= buffer.length) { + if (dir) return -1 + else byteOffset = buffer.length - 1 + } else if (byteOffset < 0) { + if (dir) byteOffset = 0 + else return -1 + } + + // Normalize val + if (typeof val === 'string') { + val = Buffer.from(val, encoding) + } + + // Finally, search either indexOf (if dir is true) or lastIndexOf + if (Buffer.isBuffer(val)) { + // Special case: looking for empty string/buffer always fails + if (val.length === 0) { + return -1 + } + return arrayIndexOf(buffer, val, byteOffset, encoding, dir) + } else if (typeof val === 'number') { + val = val & 0xFF // Search for a byte value [0-255] + if (typeof Uint8Array.prototype.indexOf === 'function') { + if (dir) { + return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) + } else { + return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) + } + } + return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) + } + + throw new TypeError('val must be string, number or Buffer') +} + +function arrayIndexOf (arr, val, byteOffset, encoding, dir) { + var indexSize = 1 + var arrLength = arr.length + var valLength = val.length + + if (encoding !== undefined) { + encoding = String(encoding).toLowerCase() + if (encoding === 'ucs2' || encoding === 'ucs-2' || + encoding === 'utf16le' || encoding === 'utf-16le') { + if (arr.length < 2 || val.length < 2) { + return -1 + } + indexSize = 2 + arrLength /= 2 + valLength /= 2 + byteOffset /= 2 + } + } + + function read (buf, i) { + if (indexSize === 1) { + return buf[i] + } else { + return buf.readUInt16BE(i * indexSize) + } + } + + var i + if (dir) { + var foundIndex = -1 + for (i = byteOffset; i < arrLength; i++) { + if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { + if (foundIndex === -1) foundIndex = i + if (i - foundIndex + 1 === valLength) return foundIndex * indexSize + } else { + if (foundIndex !== -1) i -= i - foundIndex + foundIndex = -1 + } + } + } else { + if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength + for (i = byteOffset; i >= 0; i--) { + var found = true + for (var j = 0; j < valLength; j++) { + if (read(arr, i + j) !== read(val, j)) { + found = false + break + } + } + if (found) return i + } + } + + return -1 +} + +Buffer.prototype.includes = function includes (val, byteOffset, encoding) { + return this.indexOf(val, byteOffset, encoding) !== -1 +} + +Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, true) +} + +Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, false) +} + +function hexWrite (buf, string, offset, length) { + offset = Number(offset) || 0 + var remaining = buf.length - offset + if (!length) { + length = remaining + } else { + length = Number(length) + if (length > remaining) { + length = remaining + } + } + + var strLen = string.length + + if (length > strLen / 2) { + length = strLen / 2 + } + for (var i = 0; i < length; ++i) { + var parsed = parseInt(string.substr(i * 2, 2), 16) + if (numberIsNaN(parsed)) return i + buf[offset + i] = parsed + } + return i +} + +function utf8Write (buf, string, offset, length) { + return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) +} + +function asciiWrite (buf, string, offset, length) { + return blitBuffer(asciiToBytes(string), buf, offset, length) +} + +function latin1Write (buf, string, offset, length) { + return asciiWrite(buf, string, offset, length) +} + +function base64Write (buf, string, offset, length) { + return blitBuffer(base64ToBytes(string), buf, offset, length) +} + +function ucs2Write (buf, string, offset, length) { + return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) +} + +Buffer.prototype.write = function write (string, offset, length, encoding) { + // Buffer#write(string) + if (offset === undefined) { + encoding = 'utf8' + length = this.length + offset = 0 + // Buffer#write(string, encoding) + } else if (length === undefined && typeof offset === 'string') { + encoding = offset + length = this.length + offset = 0 + // Buffer#write(string, offset[, length][, encoding]) + } else if (isFinite(offset)) { + offset = offset >>> 0 + if (isFinite(length)) { + length = length >>> 0 + if (encoding === undefined) encoding = 'utf8' + } else { + encoding = length + length = undefined + } + } else { + throw new Error( + 'Buffer.write(string, encoding, offset[, length]) is no longer supported' + ) + } + + var remaining = this.length - offset + if (length === undefined || length > remaining) length = remaining + + if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { + throw new RangeError('Attempt to write outside buffer bounds') + } + + if (!encoding) encoding = 'utf8' + + var loweredCase = false + for (;;) { + switch (encoding) { + case 'hex': + return hexWrite(this, string, offset, length) + + case 'utf8': + case 'utf-8': + return utf8Write(this, string, offset, length) + + case 'ascii': + return asciiWrite(this, string, offset, length) + + case 'latin1': + case 'binary': + return latin1Write(this, string, offset, length) + + case 'base64': + // Warning: maxLength not taken into account in base64Write + return base64Write(this, string, offset, length) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return ucs2Write(this, string, offset, length) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = ('' + encoding).toLowerCase() + loweredCase = true + } + } +} + +Buffer.prototype.toJSON = function toJSON () { + return { + type: 'Buffer', + data: Array.prototype.slice.call(this._arr || this, 0) + } +} + +function base64Slice (buf, start, end) { + if (start === 0 && end === buf.length) { + return base64.fromByteArray(buf) + } else { + return base64.fromByteArray(buf.slice(start, end)) + } +} + +function utf8Slice (buf, start, end) { + end = Math.min(buf.length, end) + var res = [] + + var i = start + while (i < end) { + var firstByte = buf[i] + var codePoint = null + var bytesPerSequence = (firstByte > 0xEF) ? 4 + : (firstByte > 0xDF) ? 3 + : (firstByte > 0xBF) ? 2 + : 1 + + if (i + bytesPerSequence <= end) { + var secondByte, thirdByte, fourthByte, tempCodePoint + + switch (bytesPerSequence) { + case 1: + if (firstByte < 0x80) { + codePoint = firstByte + } + break + case 2: + secondByte = buf[i + 1] + if ((secondByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) + if (tempCodePoint > 0x7F) { + codePoint = tempCodePoint + } + } + break + case 3: + secondByte = buf[i + 1] + thirdByte = buf[i + 2] + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) + if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { + codePoint = tempCodePoint + } + } + break + case 4: + secondByte = buf[i + 1] + thirdByte = buf[i + 2] + fourthByte = buf[i + 3] + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) + if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { + codePoint = tempCodePoint + } + } + } + } + + if (codePoint === null) { + // we did not generate a valid codePoint so insert a + // replacement char (U+FFFD) and advance only 1 byte + codePoint = 0xFFFD + bytesPerSequence = 1 + } else if (codePoint > 0xFFFF) { + // encode to utf16 (surrogate pair dance) + codePoint -= 0x10000 + res.push(codePoint >>> 10 & 0x3FF | 0xD800) + codePoint = 0xDC00 | codePoint & 0x3FF + } + + res.push(codePoint) + i += bytesPerSequence + } + + return decodeCodePointsArray(res) +} + +// Based on http://stackoverflow.com/a/22747272/680742, the browser with +// the lowest limit is Chrome, with 0x10000 args. +// We go 1 magnitude less, for safety +var MAX_ARGUMENTS_LENGTH = 0x1000 + +function decodeCodePointsArray (codePoints) { + var len = codePoints.length + if (len <= MAX_ARGUMENTS_LENGTH) { + return String.fromCharCode.apply(String, codePoints) // avoid extra slice() + } + + // Decode in chunks to avoid "call stack size exceeded". + var res = '' + var i = 0 + while (i < len) { + res += String.fromCharCode.apply( + String, + codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) + ) + } + return res +} + +function asciiSlice (buf, start, end) { + var ret = '' + end = Math.min(buf.length, end) + + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i] & 0x7F) + } + return ret +} + +function latin1Slice (buf, start, end) { + var ret = '' + end = Math.min(buf.length, end) + + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i]) + } + return ret +} + +function hexSlice (buf, start, end) { + var len = buf.length + + if (!start || start < 0) start = 0 + if (!end || end < 0 || end > len) end = len + + var out = '' + for (var i = start; i < end; ++i) { + out += toHex(buf[i]) + } + return out +} + +function utf16leSlice (buf, start, end) { + var bytes = buf.slice(start, end) + var res = '' + for (var i = 0; i < bytes.length; i += 2) { + res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256)) + } + return res +} + +Buffer.prototype.slice = function slice (start, end) { + var len = this.length + start = ~~start + end = end === undefined ? len : ~~end + + if (start < 0) { + start += len + if (start < 0) start = 0 + } else if (start > len) { + start = len + } + + if (end < 0) { + end += len + if (end < 0) end = 0 + } else if (end > len) { + end = len + } + + if (end < start) end = start + + var newBuf = this.subarray(start, end) + // Return an augmented `Uint8Array` instance + newBuf.__proto__ = Buffer.prototype + return newBuf +} + +/* + * Need to make sure that buffer isn't trying to write out of bounds. + */ +function checkOffset (offset, ext, length) { + if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') + if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') +} + +Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + var val = this[offset] + var mul = 1 + var i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul + } + + return val +} + +Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) { + checkOffset(offset, byteLength, this.length) + } + + var val = this[offset + --byteLength] + var mul = 1 + while (byteLength > 0 && (mul *= 0x100)) { + val += this[offset + --byteLength] * mul + } + + return val +} + +Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 1, this.length) + return this[offset] +} + +Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + return this[offset] | (this[offset + 1] << 8) +} + +Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + return (this[offset] << 8) | this[offset + 1] +} + +Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return ((this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16)) + + (this[offset + 3] * 0x1000000) +} + +Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset] * 0x1000000) + + ((this[offset + 1] << 16) | + (this[offset + 2] << 8) | + this[offset + 3]) +} + +Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + var val = this[offset] + var mul = 1 + var i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul + } + mul *= 0x80 + + if (val >= mul) val -= Math.pow(2, 8 * byteLength) + + return val +} + +Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + var i = byteLength + var mul = 1 + var val = this[offset + --i] + while (i > 0 && (mul *= 0x100)) { + val += this[offset + --i] * mul + } + mul *= 0x80 + + if (val >= mul) val -= Math.pow(2, 8 * byteLength) + + return val +} + +Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 1, this.length) + if (!(this[offset] & 0x80)) return (this[offset]) + return ((0xff - this[offset] + 1) * -1) +} + +Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + var val = this[offset] | (this[offset + 1] << 8) + return (val & 0x8000) ? val | 0xFFFF0000 : val +} + +Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + var val = this[offset + 1] | (this[offset] << 8) + return (val & 0x8000) ? val | 0xFFFF0000 : val +} + +Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16) | + (this[offset + 3] << 24) +} + +Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset] << 24) | + (this[offset + 1] << 16) | + (this[offset + 2] << 8) | + (this[offset + 3]) +} + +Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + return ieee754.read(this, offset, true, 23, 4) +} + +Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + return ieee754.read(this, offset, false, 23, 4) +} + +Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 8, this.length) + return ieee754.read(this, offset, true, 52, 8) +} + +Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 8, this.length) + return ieee754.read(this, offset, false, 52, 8) +} + +function checkInt (buf, value, offset, ext, max, min) { + if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') + if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') + if (offset + ext > buf.length) throw new RangeError('Index out of range') +} + +Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1 + checkInt(this, value, offset, byteLength, maxBytes, 0) + } + + var mul = 1 + var i = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1 + checkInt(this, value, offset, byteLength, maxBytes, 0) + } + + var i = byteLength - 1 + var mul = 1 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) + this[offset] = (value & 0xff) + return offset + 1 +} + +Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + return offset + 2 +} + +Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) + this[offset] = (value >>> 8) + this[offset + 1] = (value & 0xff) + return offset + 2 +} + +Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) + this[offset + 3] = (value >>> 24) + this[offset + 2] = (value >>> 16) + this[offset + 1] = (value >>> 8) + this[offset] = (value & 0xff) + return offset + 4 +} + +Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) + this[offset] = (value >>> 24) + this[offset + 1] = (value >>> 16) + this[offset + 2] = (value >>> 8) + this[offset + 3] = (value & 0xff) + return offset + 4 +} + +Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + var limit = Math.pow(2, (8 * byteLength) - 1) + + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } + + var i = 0 + var mul = 1 + var sub = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { + sub = 1 + } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + var limit = Math.pow(2, (8 * byteLength) - 1) + + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } + + var i = byteLength - 1 + var mul = 1 + var sub = 0 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { + sub = 1 + } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) + if (value < 0) value = 0xff + value + 1 + this[offset] = (value & 0xff) + return offset + 1 +} + +Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + return offset + 2 +} + +Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) + this[offset] = (value >>> 8) + this[offset + 1] = (value & 0xff) + return offset + 2 +} + +Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + this[offset + 2] = (value >>> 16) + this[offset + 3] = (value >>> 24) + return offset + 4 +} + +Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) + if (value < 0) value = 0xffffffff + value + 1 + this[offset] = (value >>> 24) + this[offset + 1] = (value >>> 16) + this[offset + 2] = (value >>> 8) + this[offset + 3] = (value & 0xff) + return offset + 4 +} + +function checkIEEE754 (buf, value, offset, ext, max, min) { + if (offset + ext > buf.length) throw new RangeError('Index out of range') + if (offset < 0) throw new RangeError('Index out of range') +} + +function writeFloat (buf, value, offset, littleEndian, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) + } + ieee754.write(buf, value, offset, littleEndian, 23, 4) + return offset + 4 +} + +Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { + return writeFloat(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { + return writeFloat(this, value, offset, false, noAssert) +} + +function writeDouble (buf, value, offset, littleEndian, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) + } + ieee754.write(buf, value, offset, littleEndian, 52, 8) + return offset + 8 +} + +Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { + return writeDouble(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { + return writeDouble(this, value, offset, false, noAssert) +} + +// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) +Buffer.prototype.copy = function copy (target, targetStart, start, end) { + if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') + if (!start) start = 0 + if (!end && end !== 0) end = this.length + if (targetStart >= target.length) targetStart = target.length + if (!targetStart) targetStart = 0 + if (end > 0 && end < start) end = start + + // Copy 0 bytes; we're done + if (end === start) return 0 + if (target.length === 0 || this.length === 0) return 0 + + // Fatal error conditions + if (targetStart < 0) { + throw new RangeError('targetStart out of bounds') + } + if (start < 0 || start >= this.length) throw new RangeError('Index out of range') + if (end < 0) throw new RangeError('sourceEnd out of bounds') + + // Are we oob? + if (end > this.length) end = this.length + if (target.length - targetStart < end - start) { + end = target.length - targetStart + start + } + + var len = end - start + + if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { + // Use built-in when available, missing from IE11 + this.copyWithin(targetStart, start, end) + } else if (this === target && start < targetStart && targetStart < end) { + // descending copy from end + for (var i = len - 1; i >= 0; --i) { + target[i + targetStart] = this[i + start] + } + } else { + Uint8Array.prototype.set.call( + target, + this.subarray(start, end), + targetStart + ) + } + + return len +} + +// Usage: +// buffer.fill(number[, offset[, end]]) +// buffer.fill(buffer[, offset[, end]]) +// buffer.fill(string[, offset[, end]][, encoding]) +Buffer.prototype.fill = function fill (val, start, end, encoding) { + // Handle string cases: + if (typeof val === 'string') { + if (typeof start === 'string') { + encoding = start + start = 0 + end = this.length + } else if (typeof end === 'string') { + encoding = end + end = this.length + } + if (encoding !== undefined && typeof encoding !== 'string') { + throw new TypeError('encoding must be a string') + } + if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding) + } + if (val.length === 1) { + var code = val.charCodeAt(0) + if ((encoding === 'utf8' && code < 128) || + encoding === 'latin1') { + // Fast path: If `val` fits into a single byte, use that numeric value. + val = code + } + } + } else if (typeof val === 'number') { + val = val & 255 + } + + // Invalid ranges are not set to a default, so can range check early. + if (start < 0 || this.length < start || this.length < end) { + throw new RangeError('Out of range index') + } + + if (end <= start) { + return this + } + + start = start >>> 0 + end = end === undefined ? this.length : end >>> 0 + + if (!val) val = 0 + + var i + if (typeof val === 'number') { + for (i = start; i < end; ++i) { + this[i] = val + } + } else { + var bytes = Buffer.isBuffer(val) + ? val + : Buffer.from(val, encoding) + var len = bytes.length + if (len === 0) { + throw new TypeError('The value "' + val + + '" is invalid for argument "value"') + } + for (i = 0; i < end - start; ++i) { + this[i + start] = bytes[i % len] + } + } + + return this +} + +// HELPER FUNCTIONS +// ================ + +var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g + +function base64clean (str) { + // Node takes equal signs as end of the Base64 encoding + str = str.split('=')[0] + // Node strips out invalid characters like \n and \t from the string, base64-js does not + str = str.trim().replace(INVALID_BASE64_RE, '') + // Node converts strings with length < 2 to '' + if (str.length < 2) return '' + // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not + while (str.length % 4 !== 0) { + str = str + '=' + } + return str +} + +function toHex (n) { + if (n < 16) return '0' + n.toString(16) + return n.toString(16) +} + +function utf8ToBytes (string, units) { + units = units || Infinity + var codePoint + var length = string.length + var leadSurrogate = null + var bytes = [] + + for (var i = 0; i < length; ++i) { + codePoint = string.charCodeAt(i) + + // is surrogate component + if (codePoint > 0xD7FF && codePoint < 0xE000) { + // last char was a lead + if (!leadSurrogate) { + // no lead yet + if (codePoint > 0xDBFF) { + // unexpected trail + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + continue + } else if (i + 1 === length) { + // unpaired lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + continue + } + + // valid lead + leadSurrogate = codePoint + + continue + } + + // 2 leads in a row + if (codePoint < 0xDC00) { + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + leadSurrogate = codePoint + continue + } + + // valid surrogate pair + codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 + } else if (leadSurrogate) { + // valid bmp char, but last char was a lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + } + + leadSurrogate = null + + // encode utf8 + if (codePoint < 0x80) { + if ((units -= 1) < 0) break + bytes.push(codePoint) + } else if (codePoint < 0x800) { + if ((units -= 2) < 0) break + bytes.push( + codePoint >> 0x6 | 0xC0, + codePoint & 0x3F | 0x80 + ) + } else if (codePoint < 0x10000) { + if ((units -= 3) < 0) break + bytes.push( + codePoint >> 0xC | 0xE0, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ) + } else if (codePoint < 0x110000) { + if ((units -= 4) < 0) break + bytes.push( + codePoint >> 0x12 | 0xF0, + codePoint >> 0xC & 0x3F | 0x80, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ) + } else { + throw new Error('Invalid code point') + } + } + + return bytes +} + +function asciiToBytes (str) { + var byteArray = [] + for (var i = 0; i < str.length; ++i) { + // Node's code seems to be doing this and not & 0x7F.. + byteArray.push(str.charCodeAt(i) & 0xFF) + } + return byteArray +} + +function utf16leToBytes (str, units) { + var c, hi, lo + var byteArray = [] + for (var i = 0; i < str.length; ++i) { + if ((units -= 2) < 0) break + + c = str.charCodeAt(i) + hi = c >> 8 + lo = c % 256 + byteArray.push(lo) + byteArray.push(hi) + } + + return byteArray +} + +function base64ToBytes (str) { + return base64.toByteArray(base64clean(str)) +} + +function blitBuffer (src, dst, offset, length) { + for (var i = 0; i < length; ++i) { + if ((i + offset >= dst.length) || (i >= src.length)) break + dst[i + offset] = src[i] + } + return i +} + +// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass +// the `instanceof` check but they should be treated as of that type. +// See: https://github.com/feross/buffer/issues/166 +function isInstance (obj, type) { + return obj instanceof type || + (obj != null && obj.constructor != null && obj.constructor.name != null && + obj.constructor.name === type.name) +} +function numberIsNaN (obj) { + // For IE11 support + return obj !== obj // eslint-disable-line no-self-compare +} + +}).call(this,require("buffer").Buffer) +},{"base64-js":27,"buffer":32,"ieee754":35}],33:[function(require,module,exports){ +(function (Buffer){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. + +function isArray(arg) { + if (Array.isArray) { + return Array.isArray(arg); + } + return objectToString(arg) === '[object Array]'; +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +exports.isBuffer = Buffer.isBuffer; + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + +}).call(this,{"isBuffer":require("../../is-buffer/index.js")}) +},{"../../is-buffer/index.js":37}],34:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +function EventEmitter() { + this._events = this._events || {}; + this._maxListeners = this._maxListeners || undefined; +} +module.exports = EventEmitter; + +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; + +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._maxListeners = undefined; + +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +EventEmitter.defaultMaxListeners = 10; + +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +EventEmitter.prototype.setMaxListeners = function(n) { + if (!isNumber(n) || n < 0 || isNaN(n)) + throw TypeError('n must be a positive number'); + this._maxListeners = n; + return this; +}; + +EventEmitter.prototype.emit = function(type) { + var er, handler, len, args, i, listeners; + + if (!this._events) + this._events = {}; + + // If there is no 'error' event listener then throw. + if (type === 'error') { + if (!this._events.error || + (isObject(this._events.error) && !this._events.error.length)) { + er = arguments[1]; + if (er instanceof Error) { + throw er; // Unhandled 'error' event + } else { + // At least give some kind of context to the user + var err = new Error('Uncaught, unspecified "error" event. (' + er + ')'); + err.context = er; + throw err; + } + } + } + + handler = this._events[type]; + + if (isUndefined(handler)) + return false; + + if (isFunction(handler)) { + switch (arguments.length) { + // fast cases + case 1: + handler.call(this); + break; + case 2: + handler.call(this, arguments[1]); + break; + case 3: + handler.call(this, arguments[1], arguments[2]); + break; + // slower + default: + args = Array.prototype.slice.call(arguments, 1); + handler.apply(this, args); + } + } else if (isObject(handler)) { + args = Array.prototype.slice.call(arguments, 1); + listeners = handler.slice(); + len = listeners.length; + for (i = 0; i < len; i++) + listeners[i].apply(this, args); + } + + return true; +}; + +EventEmitter.prototype.addListener = function(type, listener) { + var m; + + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + if (!this._events) + this._events = {}; + + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (this._events.newListener) + this.emit('newListener', type, + isFunction(listener.listener) ? + listener.listener : listener); + + if (!this._events[type]) + // Optimize the case of one listener. Don't need the extra array object. + this._events[type] = listener; + else if (isObject(this._events[type])) + // If we've already got an array, just append. + this._events[type].push(listener); + else + // Adding the second element, need to change to array. + this._events[type] = [this._events[type], listener]; + + // Check for listener leak + if (isObject(this._events[type]) && !this._events[type].warned) { + if (!isUndefined(this._maxListeners)) { + m = this._maxListeners; + } else { + m = EventEmitter.defaultMaxListeners; + } + + if (m && m > 0 && this._events[type].length > m) { + this._events[type].warned = true; + console.error('(node) warning: possible EventEmitter memory ' + + 'leak detected. %d listeners added. ' + + 'Use emitter.setMaxListeners() to increase limit.', + this._events[type].length); + if (typeof console.trace === 'function') { + // not supported in IE 10 + console.trace(); + } + } + } + + return this; +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.once = function(type, listener) { + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + var fired = false; + + function g() { + this.removeListener(type, g); + + if (!fired) { + fired = true; + listener.apply(this, arguments); + } + } + + g.listener = listener; + this.on(type, g); + + return this; +}; + +// emits a 'removeListener' event iff the listener was removed +EventEmitter.prototype.removeListener = function(type, listener) { + var list, position, length, i; + + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + if (!this._events || !this._events[type]) + return this; + + list = this._events[type]; + length = list.length; + position = -1; + + if (list === listener || + (isFunction(list.listener) && list.listener === listener)) { + delete this._events[type]; + if (this._events.removeListener) + this.emit('removeListener', type, listener); + + } else if (isObject(list)) { + for (i = length; i-- > 0;) { + if (list[i] === listener || + (list[i].listener && list[i].listener === listener)) { + position = i; + break; + } + } + + if (position < 0) + return this; + + if (list.length === 1) { + list.length = 0; + delete this._events[type]; + } else { + list.splice(position, 1); + } + + if (this._events.removeListener) + this.emit('removeListener', type, listener); + } + + return this; +}; + +EventEmitter.prototype.removeAllListeners = function(type) { + var key, listeners; + + if (!this._events) + return this; + + // not listening for removeListener, no need to emit + if (!this._events.removeListener) { + if (arguments.length === 0) + this._events = {}; + else if (this._events[type]) + delete this._events[type]; + return this; + } + + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + for (key in this._events) { + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = {}; + return this; + } + + listeners = this._events[type]; + + if (isFunction(listeners)) { + this.removeListener(type, listeners); + } else if (listeners) { + // LIFO order + while (listeners.length) + this.removeListener(type, listeners[listeners.length - 1]); + } + delete this._events[type]; + + return this; +}; + +EventEmitter.prototype.listeners = function(type) { + var ret; + if (!this._events || !this._events[type]) + ret = []; + else if (isFunction(this._events[type])) + ret = [this._events[type]]; + else + ret = this._events[type].slice(); + return ret; +}; + +EventEmitter.prototype.listenerCount = function(type) { + if (this._events) { + var evlistener = this._events[type]; + + if (isFunction(evlistener)) + return 1; + else if (evlistener) + return evlistener.length; + } + return 0; +}; + +EventEmitter.listenerCount = function(emitter, type) { + return emitter.listenerCount(type); +}; + +function isFunction(arg) { + return typeof arg === 'function'; +} + +function isNumber(arg) { + return typeof arg === 'number'; +} + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} + +function isUndefined(arg) { + return arg === void 0; +} + +},{}],35:[function(require,module,exports){ +exports.read = function (buffer, offset, isLE, mLen, nBytes) { + var e, m + var eLen = (nBytes * 8) - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var nBits = -7 + var i = isLE ? (nBytes - 1) : 0 + var d = isLE ? -1 : 1 + var s = buffer[offset + i] + + i += d + + e = s & ((1 << (-nBits)) - 1) + s >>= (-nBits) + nBits += eLen + for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} + + m = e & ((1 << (-nBits)) - 1) + e >>= (-nBits) + nBits += mLen + for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} + + if (e === 0) { + e = 1 - eBias + } else if (e === eMax) { + return m ? NaN : ((s ? -1 : 1) * Infinity) + } else { + m = m + Math.pow(2, mLen) + e = e - eBias + } + return (s ? -1 : 1) * m * Math.pow(2, e - mLen) +} + +exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { + var e, m, c + var eLen = (nBytes * 8) - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) + var i = isLE ? 0 : (nBytes - 1) + var d = isLE ? 1 : -1 + var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 + + value = Math.abs(value) + + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0 + e = eMax + } else { + e = Math.floor(Math.log(value) / Math.LN2) + if (value * (c = Math.pow(2, -e)) < 1) { + e-- + c *= 2 + } + if (e + eBias >= 1) { + value += rt / c + } else { + value += rt * Math.pow(2, 1 - eBias) + } + if (value * c >= 2) { + e++ + c /= 2 + } + + if (e + eBias >= eMax) { + m = 0 + e = eMax + } else if (e + eBias >= 1) { + m = ((value * c) - 1) * Math.pow(2, mLen) + e = e + eBias + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) + e = 0 + } + } + + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} + + e = (e << mLen) | m + eLen += mLen + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} + + buffer[offset + i - d] |= s * 128 +} + +},{}],36:[function(require,module,exports){ +arguments[4][24][0].apply(exports,arguments) +},{"dup":24}],37:[function(require,module,exports){ +/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ + +// The _isBuffer check is for Safari 5-7 support, because it's missing +// Object.prototype.constructor. Remove this eventually +module.exports = function (obj) { + return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) +} + +function isBuffer (obj) { + return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) +} + +// For Node v0.10 support. Remove this eventually. +function isSlowBuffer (obj) { + return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) +} + +},{}],38:[function(require,module,exports){ +var toString = {}.toString; + +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; +}; + +},{}],39:[function(require,module,exports){ +'use strict'; + + +var TYPED_OK = (typeof Uint8Array !== 'undefined') && + (typeof Uint16Array !== 'undefined') && + (typeof Int32Array !== 'undefined'); + +function _has(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +} + +exports.assign = function (obj /*from1, from2, from3, ...*/) { + var sources = Array.prototype.slice.call(arguments, 1); + while (sources.length) { + var source = sources.shift(); + if (!source) { continue; } + + if (typeof source !== 'object') { + throw new TypeError(source + 'must be non-object'); + } + + for (var p in source) { + if (_has(source, p)) { + obj[p] = source[p]; + } + } + } + + return obj; +}; + + +// reduce buffer size, avoiding mem copy +exports.shrinkBuf = function (buf, size) { + if (buf.length === size) { return buf; } + if (buf.subarray) { return buf.subarray(0, size); } + buf.length = size; + return buf; +}; + + +var fnTyped = { + arraySet: function (dest, src, src_offs, len, dest_offs) { + if (src.subarray && dest.subarray) { + dest.set(src.subarray(src_offs, src_offs + len), dest_offs); + return; + } + // Fallback to ordinary array + for (var i = 0; i < len; i++) { + dest[dest_offs + i] = src[src_offs + i]; + } + }, + // Join array of chunks to single array. + flattenChunks: function (chunks) { + var i, l, len, pos, chunk, result; + + // calculate data length + len = 0; + for (i = 0, l = chunks.length; i < l; i++) { + len += chunks[i].length; + } + + // join chunks + result = new Uint8Array(len); + pos = 0; + for (i = 0, l = chunks.length; i < l; i++) { + chunk = chunks[i]; + result.set(chunk, pos); + pos += chunk.length; + } + + return result; + } +}; + +var fnUntyped = { + arraySet: function (dest, src, src_offs, len, dest_offs) { + for (var i = 0; i < len; i++) { + dest[dest_offs + i] = src[src_offs + i]; + } + }, + // Join array of chunks to single array. + flattenChunks: function (chunks) { + return [].concat.apply([], chunks); + } +}; + + +// Enable/Disable typed arrays use, for testing +// +exports.setTyped = function (on) { + if (on) { + exports.Buf8 = Uint8Array; + exports.Buf16 = Uint16Array; + exports.Buf32 = Int32Array; + exports.assign(exports, fnTyped); + } else { + exports.Buf8 = Array; + exports.Buf16 = Array; + exports.Buf32 = Array; + exports.assign(exports, fnUntyped); + } +}; + +exports.setTyped(TYPED_OK); + +},{}],40:[function(require,module,exports){ +'use strict'; + +// Note: adler32 takes 12% for level 0 and 2% for level 6. +// It isn't worth it to make additional optimizations as in original. +// Small size is preferable. + +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + +function adler32(adler, buf, len, pos) { + var s1 = (adler & 0xffff) |0, + s2 = ((adler >>> 16) & 0xffff) |0, + n = 0; + + while (len !== 0) { + // Set limit ~ twice less than 5552, to keep + // s2 in 31-bits, because we force signed ints. + // in other case %= will fail. + n = len > 2000 ? 2000 : len; + len -= n; + + do { + s1 = (s1 + buf[pos++]) |0; + s2 = (s2 + s1) |0; + } while (--n); + + s1 %= 65521; + s2 %= 65521; + } + + return (s1 | (s2 << 16)) |0; +} + + +module.exports = adler32; + +},{}],41:[function(require,module,exports){ +'use strict'; + +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + +module.exports = { + + /* Allowed flush values; see deflate() and inflate() below for details */ + Z_NO_FLUSH: 0, + Z_PARTIAL_FLUSH: 1, + Z_SYNC_FLUSH: 2, + Z_FULL_FLUSH: 3, + Z_FINISH: 4, + Z_BLOCK: 5, + Z_TREES: 6, + + /* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + Z_OK: 0, + Z_STREAM_END: 1, + Z_NEED_DICT: 2, + Z_ERRNO: -1, + Z_STREAM_ERROR: -2, + Z_DATA_ERROR: -3, + //Z_MEM_ERROR: -4, + Z_BUF_ERROR: -5, + //Z_VERSION_ERROR: -6, + + /* compression levels */ + Z_NO_COMPRESSION: 0, + Z_BEST_SPEED: 1, + Z_BEST_COMPRESSION: 9, + Z_DEFAULT_COMPRESSION: -1, + + + Z_FILTERED: 1, + Z_HUFFMAN_ONLY: 2, + Z_RLE: 3, + Z_FIXED: 4, + Z_DEFAULT_STRATEGY: 0, + + /* Possible values of the data_type field (though see inflate()) */ + Z_BINARY: 0, + Z_TEXT: 1, + //Z_ASCII: 1, // = Z_TEXT (deprecated) + Z_UNKNOWN: 2, + + /* The deflate compression method */ + Z_DEFLATED: 8 + //Z_NULL: null // Use -1 or null inline, depending on var type +}; + +},{}],42:[function(require,module,exports){ +'use strict'; + +// Note: we can't get significant speed boost here. +// So write code to minimize size - no pregenerated tables +// and array tools dependencies. + +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + +// Use ordinary array, since untyped makes no boost here +function makeTable() { + var c, table = []; + + for (var n = 0; n < 256; n++) { + c = n; + for (var k = 0; k < 8; k++) { + c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); + } + table[n] = c; + } + + return table; +} + +// Create table on load. Just 255 signed longs. Not a problem. +var crcTable = makeTable(); + + +function crc32(crc, buf, len, pos) { + var t = crcTable, + end = pos + len; + + crc ^= -1; + + for (var i = pos; i < end; i++) { + crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; + } + + return (crc ^ (-1)); // >>> 0; +} + + +module.exports = crc32; + +},{}],43:[function(require,module,exports){ +'use strict'; + +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + +var utils = require('../utils/common'); +var trees = require('./trees'); +var adler32 = require('./adler32'); +var crc32 = require('./crc32'); +var msg = require('./messages'); + +/* Public constants ==========================================================*/ +/* ===========================================================================*/ + + +/* Allowed flush values; see deflate() and inflate() below for details */ +var Z_NO_FLUSH = 0; +var Z_PARTIAL_FLUSH = 1; +//var Z_SYNC_FLUSH = 2; +var Z_FULL_FLUSH = 3; +var Z_FINISH = 4; +var Z_BLOCK = 5; +//var Z_TREES = 6; + + +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ +var Z_OK = 0; +var Z_STREAM_END = 1; +//var Z_NEED_DICT = 2; +//var Z_ERRNO = -1; +var Z_STREAM_ERROR = -2; +var Z_DATA_ERROR = -3; +//var Z_MEM_ERROR = -4; +var Z_BUF_ERROR = -5; +//var Z_VERSION_ERROR = -6; + + +/* compression levels */ +//var Z_NO_COMPRESSION = 0; +//var Z_BEST_SPEED = 1; +//var Z_BEST_COMPRESSION = 9; +var Z_DEFAULT_COMPRESSION = -1; + + +var Z_FILTERED = 1; +var Z_HUFFMAN_ONLY = 2; +var Z_RLE = 3; +var Z_FIXED = 4; +var Z_DEFAULT_STRATEGY = 0; + +/* Possible values of the data_type field (though see inflate()) */ +//var Z_BINARY = 0; +//var Z_TEXT = 1; +//var Z_ASCII = 1; // = Z_TEXT +var Z_UNKNOWN = 2; + + +/* The deflate compression method */ +var Z_DEFLATED = 8; + +/*============================================================================*/ + + +var MAX_MEM_LEVEL = 9; +/* Maximum value for memLevel in deflateInit2 */ +var MAX_WBITS = 15; +/* 32K LZ77 window */ +var DEF_MEM_LEVEL = 8; + + +var LENGTH_CODES = 29; +/* number of length codes, not counting the special END_BLOCK code */ +var LITERALS = 256; +/* number of literal bytes 0..255 */ +var L_CODES = LITERALS + 1 + LENGTH_CODES; +/* number of Literal or Length codes, including the END_BLOCK code */ +var D_CODES = 30; +/* number of distance codes */ +var BL_CODES = 19; +/* number of codes used to transfer the bit lengths */ +var HEAP_SIZE = 2 * L_CODES + 1; +/* maximum heap size */ +var MAX_BITS = 15; +/* All codes must not exceed MAX_BITS bits */ + +var MIN_MATCH = 3; +var MAX_MATCH = 258; +var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1); + +var PRESET_DICT = 0x20; + +var INIT_STATE = 42; +var EXTRA_STATE = 69; +var NAME_STATE = 73; +var COMMENT_STATE = 91; +var HCRC_STATE = 103; +var BUSY_STATE = 113; +var FINISH_STATE = 666; + +var BS_NEED_MORE = 1; /* block not completed, need more input or more output */ +var BS_BLOCK_DONE = 2; /* block flush performed */ +var BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */ +var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */ + +var OS_CODE = 0x03; // Unix :) . Don't detect, use this default. + +function err(strm, errorCode) { + strm.msg = msg[errorCode]; + return errorCode; +} + +function rank(f) { + return ((f) << 1) - ((f) > 4 ? 9 : 0); +} + +function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } + + +/* ========================================================================= + * Flush as much pending output as possible. All deflate() output goes + * through this function so some applications may wish to modify it + * to avoid allocating a large strm->output buffer and copying into it. + * (See also read_buf()). + */ +function flush_pending(strm) { + var s = strm.state; + + //_tr_flush_bits(s); + var len = s.pending; + if (len > strm.avail_out) { + len = strm.avail_out; + } + if (len === 0) { return; } + + utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out); + strm.next_out += len; + s.pending_out += len; + strm.total_out += len; + strm.avail_out -= len; + s.pending -= len; + if (s.pending === 0) { + s.pending_out = 0; + } +} + + +function flush_block_only(s, last) { + trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last); + s.block_start = s.strstart; + flush_pending(s.strm); +} + + +function put_byte(s, b) { + s.pending_buf[s.pending++] = b; +} + + +/* ========================================================================= + * Put a short in the pending buffer. The 16-bit value is put in MSB order. + * IN assertion: the stream state is correct and there is enough room in + * pending_buf. + */ +function putShortMSB(s, b) { +// put_byte(s, (Byte)(b >> 8)); +// put_byte(s, (Byte)(b & 0xff)); + s.pending_buf[s.pending++] = (b >>> 8) & 0xff; + s.pending_buf[s.pending++] = b & 0xff; +} + + +/* =========================================================================== + * Read a new buffer from the current input stream, update the adler32 + * and total number of bytes read. All deflate() input goes through + * this function so some applications may wish to modify it to avoid + * allocating a large strm->input buffer and copying from it. + * (See also flush_pending()). + */ +function read_buf(strm, buf, start, size) { + var len = strm.avail_in; + + if (len > size) { len = size; } + if (len === 0) { return 0; } + + strm.avail_in -= len; + + // zmemcpy(buf, strm->next_in, len); + utils.arraySet(buf, strm.input, strm.next_in, len, start); + if (strm.state.wrap === 1) { + strm.adler = adler32(strm.adler, buf, len, start); + } + + else if (strm.state.wrap === 2) { + strm.adler = crc32(strm.adler, buf, len, start); + } + + strm.next_in += len; + strm.total_in += len; + + return len; +} + + +/* =========================================================================== + * Set match_start to the longest match starting at the given string and + * return its length. Matches shorter or equal to prev_length are discarded, + * in which case the result is equal to prev_length and match_start is + * garbage. + * IN assertions: cur_match is the head of the hash chain for the current + * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 + * OUT assertion: the match length is not greater than s->lookahead. + */ +function longest_match(s, cur_match) { + var chain_length = s.max_chain_length; /* max hash chain length */ + var scan = s.strstart; /* current string */ + var match; /* matched string */ + var len; /* length of current match */ + var best_len = s.prev_length; /* best match length so far */ + var nice_match = s.nice_match; /* stop if match long enough */ + var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ? + s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/; + + var _win = s.window; // shortcut + + var wmask = s.w_mask; + var prev = s.prev; + + /* Stop when cur_match becomes <= limit. To simplify the code, + * we prevent matches with the string of window index 0. + */ + + var strend = s.strstart + MAX_MATCH; + var scan_end1 = _win[scan + best_len - 1]; + var scan_end = _win[scan + best_len]; + + /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. + * It is easy to get rid of this optimization if necessary. + */ + // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); + + /* Do not waste too much time if we already have a good match: */ + if (s.prev_length >= s.good_match) { + chain_length >>= 2; + } + /* Do not look for matches beyond the end of the input. This is necessary + * to make deflate deterministic. + */ + if (nice_match > s.lookahead) { nice_match = s.lookahead; } + + // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + + do { + // Assert(cur_match < s->strstart, "no future"); + match = cur_match; + + /* Skip to next match if the match length cannot increase + * or if the match length is less than 2. Note that the checks below + * for insufficient lookahead only occur occasionally for performance + * reasons. Therefore uninitialized memory will be accessed, and + * conditional jumps will be made that depend on those values. + * However the length of the match is limited to the lookahead, so + * the output of deflate is not affected by the uninitialized values. + */ + + if (_win[match + best_len] !== scan_end || + _win[match + best_len - 1] !== scan_end1 || + _win[match] !== _win[scan] || + _win[++match] !== _win[scan + 1]) { + continue; + } + + /* The check at best_len-1 can be removed because it will be made + * again later. (This heuristic is not always a win.) + * It is not necessary to compare scan[2] and match[2] since they + * are always equal when the other bytes match, given that + * the hash keys are equal and that HASH_BITS >= 8. + */ + scan += 2; + match++; + // Assert(*scan == *match, "match[2]?"); + + /* We check for insufficient lookahead only every 8th comparison; + * the 256th check will be made at strstart+258. + */ + do { + /*jshint noempty:false*/ + } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + scan < strend); + + // Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + + len = MAX_MATCH - (strend - scan); + scan = strend - MAX_MATCH; + + if (len > best_len) { + s.match_start = cur_match; + best_len = len; + if (len >= nice_match) { + break; + } + scan_end1 = _win[scan + best_len - 1]; + scan_end = _win[scan + best_len]; + } + } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0); + + if (best_len <= s.lookahead) { + return best_len; + } + return s.lookahead; +} + + +/* =========================================================================== + * Fill the window when the lookahead becomes insufficient. + * Updates strstart and lookahead. + * + * IN assertion: lookahead < MIN_LOOKAHEAD + * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD + * At least one byte has been read, or avail_in == 0; reads are + * performed for at least two bytes (required for the zip translate_eol + * option -- not supported here). + */ +function fill_window(s) { + var _w_size = s.w_size; + var p, n, m, more, str; + + //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); + + do { + more = s.window_size - s.lookahead - s.strstart; + + // JS ints have 32 bit, block below not needed + /* Deal with !@#$% 64K limit: */ + //if (sizeof(int) <= 2) { + // if (more == 0 && s->strstart == 0 && s->lookahead == 0) { + // more = wsize; + // + // } else if (more == (unsigned)(-1)) { + // /* Very unlikely, but possible on 16 bit machine if + // * strstart == 0 && lookahead == 1 (input done a byte at time) + // */ + // more--; + // } + //} + + + /* If the window is almost full and there is insufficient lookahead, + * move the upper half to the lower one to make room in the upper half. + */ + if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { + + utils.arraySet(s.window, s.window, _w_size, _w_size, 0); + s.match_start -= _w_size; + s.strstart -= _w_size; + /* we now have strstart >= MAX_DIST */ + s.block_start -= _w_size; + + /* Slide the hash table (could be avoided with 32 bit values + at the expense of memory usage). We slide even when level == 0 + to keep the hash table consistent if we switch back to level > 0 + later. (Using level 0 permanently is not an optimal usage of + zlib, so we don't care about this pathological case.) + */ + + n = s.hash_size; + p = n; + do { + m = s.head[--p]; + s.head[p] = (m >= _w_size ? m - _w_size : 0); + } while (--n); + + n = _w_size; + p = n; + do { + m = s.prev[--p]; + s.prev[p] = (m >= _w_size ? m - _w_size : 0); + /* If n is not on any hash chain, prev[n] is garbage but + * its value will never be used. + */ + } while (--n); + + more += _w_size; + } + if (s.strm.avail_in === 0) { + break; + } + + /* If there was no sliding: + * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && + * more == window_size - lookahead - strstart + * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) + * => more >= window_size - 2*WSIZE + 2 + * In the BIG_MEM or MMAP case (not yet supported), + * window_size == input_size + MIN_LOOKAHEAD && + * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. + * Otherwise, window_size == 2*WSIZE so more >= 2. + * If there was sliding, more >= WSIZE. So in all cases, more >= 2. + */ + //Assert(more >= 2, "more < 2"); + n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more); + s.lookahead += n; + + /* Initialize the hash value now that we have some input: */ + if (s.lookahead + s.insert >= MIN_MATCH) { + str = s.strstart - s.insert; + s.ins_h = s.window[str]; + + /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask; +//#if MIN_MATCH != 3 +// Call update_hash() MIN_MATCH-3 more times +//#endif + while (s.insert) { + /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; + + s.prev[str & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = str; + str++; + s.insert--; + if (s.lookahead + s.insert < MIN_MATCH) { + break; + } + } + } + /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, + * but this is not important since only literal bytes will be emitted. + */ + + } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); + + /* If the WIN_INIT bytes after the end of the current data have never been + * written, then zero those bytes in order to avoid memory check reports of + * the use of uninitialized (or uninitialised as Julian writes) bytes by + * the longest match routines. Update the high water mark for the next + * time through here. WIN_INIT is set to MAX_MATCH since the longest match + * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. + */ +// if (s.high_water < s.window_size) { +// var curr = s.strstart + s.lookahead; +// var init = 0; +// +// if (s.high_water < curr) { +// /* Previous high water mark below current data -- zero WIN_INIT +// * bytes or up to end of window, whichever is less. +// */ +// init = s.window_size - curr; +// if (init > WIN_INIT) +// init = WIN_INIT; +// zmemzero(s->window + curr, (unsigned)init); +// s->high_water = curr + init; +// } +// else if (s->high_water < (ulg)curr + WIN_INIT) { +// /* High water mark at or above current data, but below current data +// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up +// * to end of window, whichever is less. +// */ +// init = (ulg)curr + WIN_INIT - s->high_water; +// if (init > s->window_size - s->high_water) +// init = s->window_size - s->high_water; +// zmemzero(s->window + s->high_water, (unsigned)init); +// s->high_water += init; +// } +// } +// +// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, +// "not enough room for search"); +} + +/* =========================================================================== + * Copy without compression as much as possible from the input stream, return + * the current block state. + * This function does not insert new strings in the dictionary since + * uncompressible data is probably not useful. This function is used + * only for the level=0 compression option. + * NOTE: this function should be optimized to avoid extra copying from + * window to pending_buf. + */ +function deflate_stored(s, flush) { + /* Stored blocks are limited to 0xffff bytes, pending_buf is limited + * to pending_buf_size, and each stored block has a 5 byte header: + */ + var max_block_size = 0xffff; + + if (max_block_size > s.pending_buf_size - 5) { + max_block_size = s.pending_buf_size - 5; + } + + /* Copy as much as possible from input to output: */ + for (;;) { + /* Fill the window as much as possible: */ + if (s.lookahead <= 1) { + + //Assert(s->strstart < s->w_size+MAX_DIST(s) || + // s->block_start >= (long)s->w_size, "slide too late"); +// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) || +// s.block_start >= s.w_size)) { +// throw new Error("slide too late"); +// } + + fill_window(s); + if (s.lookahead === 0 && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + + if (s.lookahead === 0) { + break; + } + /* flush the current block */ + } + //Assert(s->block_start >= 0L, "block gone"); +// if (s.block_start < 0) throw new Error("block gone"); + + s.strstart += s.lookahead; + s.lookahead = 0; + + /* Emit a stored block if pending_buf will be full: */ + var max_start = s.block_start + max_block_size; + + if (s.strstart === 0 || s.strstart >= max_start) { + /* strstart == 0 is possible when wraparound on 16-bit machine */ + s.lookahead = s.strstart - max_start; + s.strstart = max_start; + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + + + } + /* Flush if we may have to slide, otherwise block_start may become + * negative and the data will be gone: + */ + if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + + s.insert = 0; + + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + + if (s.strstart > s.block_start) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + + return BS_NEED_MORE; +} + +/* =========================================================================== + * Compress as much as possible from the input stream, return the current + * block state. + * This function does not perform lazy evaluation of matches and inserts + * new strings in the dictionary only for unmatched strings or for short + * matches. It is used only for the fast compression options. + */ +function deflate_fast(s, flush) { + var hash_head; /* head of the hash chain */ + var bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s.lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { + break; /* flush the current block */ + } + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + hash_head = 0/*NIL*/; + if (s.lookahead >= MIN_MATCH) { + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + } + + /* Find the longest match, discarding those <= prev_length. + * At this point we have always match_length < MIN_MATCH + */ + if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + s.match_length = longest_match(s, hash_head); + /* longest_match() sets match_start */ + } + if (s.match_length >= MIN_MATCH) { + // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only + + /*** _tr_tally_dist(s, s.strstart - s.match_start, + s.match_length - MIN_MATCH, bflush); ***/ + bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH); + + s.lookahead -= s.match_length; + + /* Insert new strings in the hash table only if the match length + * is not too large. This saves time but degrades compression. + */ + if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) { + s.match_length--; /* string at strstart already in table */ + do { + s.strstart++; + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + /* strstart never exceeds WSIZE-MAX_MATCH, so there are + * always MIN_MATCH bytes ahead. + */ + } while (--s.match_length !== 0); + s.strstart++; + } else + { + s.strstart += s.match_length; + s.match_length = 0; + s.ins_h = s.window[s.strstart]; + /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask; + +//#if MIN_MATCH != 3 +// Call UPDATE_HASH() MIN_MATCH-3 more times +//#endif + /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not + * matter since it will be recomputed at next deflate call. + */ + } + } else { + /* No match, output a literal byte */ + //Tracevv((stderr,"%c", s.window[s.strstart])); + /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart]); + + s.lookahead--; + s.strstart++; + } + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1); + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + return BS_BLOCK_DONE; +} + +/* =========================================================================== + * Same as above, but achieves better compression. We use a lazy + * evaluation for matches: a match is finally adopted only if there is + * no better match at the next window position. + */ +function deflate_slow(s, flush) { + var hash_head; /* head of hash chain */ + var bflush; /* set if current block must be flushed */ + + var max_insert; + + /* Process the input block. */ + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s.lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { break; } /* flush the current block */ + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + hash_head = 0/*NIL*/; + if (s.lookahead >= MIN_MATCH) { + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + } + + /* Find the longest match, discarding those <= prev_length. + */ + s.prev_length = s.match_length; + s.prev_match = s.match_start; + s.match_length = MIN_MATCH - 1; + + if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match && + s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + s.match_length = longest_match(s, hash_head); + /* longest_match() sets match_start */ + + if (s.match_length <= 5 && + (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) { + + /* If prev_match is also MIN_MATCH, match_start is garbage + * but we will ignore the current match anyway. + */ + s.match_length = MIN_MATCH - 1; + } + } + /* If there was a match at the previous step and the current + * match is not better, output the previous match: + */ + if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { + max_insert = s.strstart + s.lookahead - MIN_MATCH; + /* Do not insert strings in hash table beyond this. */ + + //check_match(s, s.strstart-1, s.prev_match, s.prev_length); + + /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match, + s.prev_length - MIN_MATCH, bflush);***/ + bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH); + /* Insert in hash table all strings up to the end of the match. + * strstart-1 and strstart are already inserted. If there is not + * enough lookahead, the last two strings are not inserted in + * the hash table. + */ + s.lookahead -= s.prev_length - 1; + s.prev_length -= 2; + do { + if (++s.strstart <= max_insert) { + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + } + } while (--s.prev_length !== 0); + s.match_available = 0; + s.match_length = MIN_MATCH - 1; + s.strstart++; + + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + + } else if (s.match_available) { + /* If there was no match at the previous position, output a + * single literal. If there was a match but the current match + * is longer, truncate the previous match to a single literal. + */ + //Tracevv((stderr,"%c", s->window[s->strstart-1])); + /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); + + if (bflush) { + /*** FLUSH_BLOCK_ONLY(s, 0) ***/ + flush_block_only(s, false); + /***/ + } + s.strstart++; + s.lookahead--; + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } else { + /* There is no previous match to compare with, wait for + * the next step to decide. + */ + s.match_available = 1; + s.strstart++; + s.lookahead--; + } + } + //Assert (flush != Z_NO_FLUSH, "no flush?"); + if (s.match_available) { + //Tracevv((stderr,"%c", s->window[s->strstart-1])); + /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); + + s.match_available = 0; + } + s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + + return BS_BLOCK_DONE; +} + + +/* =========================================================================== + * For Z_RLE, simply look for runs of bytes, generate matches only of distance + * one. Do not maintain a hash table. (It will be regenerated if this run of + * deflate switches away from Z_RLE.) + */ +function deflate_rle(s, flush) { + var bflush; /* set if current block must be flushed */ + var prev; /* byte at distance one to match */ + var scan, strend; /* scan goes up to strend for length of run */ + + var _win = s.window; + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the longest run, plus one for the unrolled loop. + */ + if (s.lookahead <= MAX_MATCH) { + fill_window(s); + if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { break; } /* flush the current block */ + } + + /* See how many times the previous byte repeats */ + s.match_length = 0; + if (s.lookahead >= MIN_MATCH && s.strstart > 0) { + scan = s.strstart - 1; + prev = _win[scan]; + if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) { + strend = s.strstart + MAX_MATCH; + do { + /*jshint noempty:false*/ + } while (prev === _win[++scan] && prev === _win[++scan] && + prev === _win[++scan] && prev === _win[++scan] && + prev === _win[++scan] && prev === _win[++scan] && + prev === _win[++scan] && prev === _win[++scan] && + scan < strend); + s.match_length = MAX_MATCH - (strend - scan); + if (s.match_length > s.lookahead) { + s.match_length = s.lookahead; + } + } + //Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); + } + + /* Emit match if have run of MIN_MATCH or longer, else emit literal */ + if (s.match_length >= MIN_MATCH) { + //check_match(s, s.strstart, s.strstart - 1, s.match_length); + + /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/ + bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH); + + s.lookahead -= s.match_length; + s.strstart += s.match_length; + s.match_length = 0; + } else { + /* No match, output a literal byte */ + //Tracevv((stderr,"%c", s->window[s->strstart])); + /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart]); + + s.lookahead--; + s.strstart++; + } + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + s.insert = 0; + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + return BS_BLOCK_DONE; +} + +/* =========================================================================== + * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. + * (It will be regenerated if this run of deflate switches away from Huffman.) + */ +function deflate_huff(s, flush) { + var bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we have a literal to write. */ + if (s.lookahead === 0) { + fill_window(s); + if (s.lookahead === 0) { + if (flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + break; /* flush the current block */ + } + } + + /* Output a literal byte */ + s.match_length = 0; + //Tracevv((stderr,"%c", s->window[s->strstart])); + /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart]); + s.lookahead--; + s.strstart++; + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + s.insert = 0; + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + return BS_BLOCK_DONE; +} + +/* Values for max_lazy_match, good_match and max_chain_length, depending on + * the desired pack level (0..9). The values given below have been tuned to + * exclude worst case performance for pathological files. Better values may be + * found for specific files. + */ +function Config(good_length, max_lazy, nice_length, max_chain, func) { + this.good_length = good_length; + this.max_lazy = max_lazy; + this.nice_length = nice_length; + this.max_chain = max_chain; + this.func = func; +} + +var configuration_table; + +configuration_table = [ + /* good lazy nice chain */ + new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */ + new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */ + new Config(4, 5, 16, 8, deflate_fast), /* 2 */ + new Config(4, 6, 32, 32, deflate_fast), /* 3 */ + + new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */ + new Config(8, 16, 32, 32, deflate_slow), /* 5 */ + new Config(8, 16, 128, 128, deflate_slow), /* 6 */ + new Config(8, 32, 128, 256, deflate_slow), /* 7 */ + new Config(32, 128, 258, 1024, deflate_slow), /* 8 */ + new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */ +]; + + +/* =========================================================================== + * Initialize the "longest match" routines for a new zlib stream + */ +function lm_init(s) { + s.window_size = 2 * s.w_size; + + /*** CLEAR_HASH(s); ***/ + zero(s.head); // Fill with NIL (= 0); + + /* Set the default configuration parameters: + */ + s.max_lazy_match = configuration_table[s.level].max_lazy; + s.good_match = configuration_table[s.level].good_length; + s.nice_match = configuration_table[s.level].nice_length; + s.max_chain_length = configuration_table[s.level].max_chain; + + s.strstart = 0; + s.block_start = 0; + s.lookahead = 0; + s.insert = 0; + s.match_length = s.prev_length = MIN_MATCH - 1; + s.match_available = 0; + s.ins_h = 0; +} + + +function DeflateState() { + this.strm = null; /* pointer back to this zlib stream */ + this.status = 0; /* as the name implies */ + this.pending_buf = null; /* output still pending */ + this.pending_buf_size = 0; /* size of pending_buf */ + this.pending_out = 0; /* next pending byte to output to the stream */ + this.pending = 0; /* nb of bytes in the pending buffer */ + this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ + this.gzhead = null; /* gzip header information to write */ + this.gzindex = 0; /* where in extra, name, or comment */ + this.method = Z_DEFLATED; /* can only be DEFLATED */ + this.last_flush = -1; /* value of flush param for previous deflate call */ + + this.w_size = 0; /* LZ77 window size (32K by default) */ + this.w_bits = 0; /* log2(w_size) (8..16) */ + this.w_mask = 0; /* w_size - 1 */ + + this.window = null; + /* Sliding window. Input bytes are read into the second half of the window, + * and move to the first half later to keep a dictionary of at least wSize + * bytes. With this organization, matches are limited to a distance of + * wSize-MAX_MATCH bytes, but this ensures that IO is always + * performed with a length multiple of the block size. + */ + + this.window_size = 0; + /* Actual size of window: 2*wSize, except when the user input buffer + * is directly used as sliding window. + */ + + this.prev = null; + /* Link to older string with same hash index. To limit the size of this + * array to 64K, this link is maintained only for the last 32K strings. + * An index in this array is thus a window index modulo 32K. + */ + + this.head = null; /* Heads of the hash chains or NIL. */ + + this.ins_h = 0; /* hash index of string to be inserted */ + this.hash_size = 0; /* number of elements in hash table */ + this.hash_bits = 0; /* log2(hash_size) */ + this.hash_mask = 0; /* hash_size-1 */ + + this.hash_shift = 0; + /* Number of bits by which ins_h must be shifted at each input + * step. It must be such that after MIN_MATCH steps, the oldest + * byte no longer takes part in the hash key, that is: + * hash_shift * MIN_MATCH >= hash_bits + */ + + this.block_start = 0; + /* Window position at the beginning of the current output block. Gets + * negative when the window is moved backwards. + */ + + this.match_length = 0; /* length of best match */ + this.prev_match = 0; /* previous match */ + this.match_available = 0; /* set if previous match exists */ + this.strstart = 0; /* start of string to insert */ + this.match_start = 0; /* start of matching string */ + this.lookahead = 0; /* number of valid bytes ahead in window */ + + this.prev_length = 0; + /* Length of the best match at previous step. Matches not greater than this + * are discarded. This is used in the lazy match evaluation. + */ + + this.max_chain_length = 0; + /* To speed up deflation, hash chains are never searched beyond this + * length. A higher limit improves compression ratio but degrades the + * speed. + */ + + this.max_lazy_match = 0; + /* Attempt to find a better match only when the current match is strictly + * smaller than this value. This mechanism is used only for compression + * levels >= 4. + */ + // That's alias to max_lazy_match, don't use directly + //this.max_insert_length = 0; + /* Insert new strings in the hash table only if the match length is not + * greater than this length. This saves time but degrades compression. + * max_insert_length is used only for compression levels <= 3. + */ + + this.level = 0; /* compression level (1..9) */ + this.strategy = 0; /* favor or force Huffman coding*/ + + this.good_match = 0; + /* Use a faster search when the previous match is longer than this */ + + this.nice_match = 0; /* Stop searching when current match exceeds this */ + + /* used by trees.c: */ + + /* Didn't use ct_data typedef below to suppress compiler warning */ + + // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ + // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ + // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ + + // Use flat array of DOUBLE size, with interleaved fata, + // because JS does not support effective + this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2); + this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2); + this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2); + zero(this.dyn_ltree); + zero(this.dyn_dtree); + zero(this.bl_tree); + + this.l_desc = null; /* desc. for literal tree */ + this.d_desc = null; /* desc. for distance tree */ + this.bl_desc = null; /* desc. for bit length tree */ + + //ush bl_count[MAX_BITS+1]; + this.bl_count = new utils.Buf16(MAX_BITS + 1); + /* number of codes at each bit length for an optimal tree */ + + //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ + this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */ + zero(this.heap); + + this.heap_len = 0; /* number of elements in the heap */ + this.heap_max = 0; /* element of largest frequency */ + /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. + * The same heap array is used to build all trees. + */ + + this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1]; + zero(this.depth); + /* Depth of each subtree used as tie breaker for trees of equal frequency + */ + + this.l_buf = 0; /* buffer index for literals or lengths */ + + this.lit_bufsize = 0; + /* Size of match buffer for literals/lengths. There are 4 reasons for + * limiting lit_bufsize to 64K: + * - frequencies can be kept in 16 bit counters + * - if compression is not successful for the first block, all input + * data is still in the window so we can still emit a stored block even + * when input comes from standard input. (This can also be done for + * all blocks if lit_bufsize is not greater than 32K.) + * - if compression is not successful for a file smaller than 64K, we can + * even emit a stored file instead of a stored block (saving 5 bytes). + * This is applicable only for zip (not gzip or zlib). + * - creating new Huffman trees less frequently may not provide fast + * adaptation to changes in the input data statistics. (Take for + * example a binary file with poorly compressible code followed by + * a highly compressible string table.) Smaller buffer sizes give + * fast adaptation but have of course the overhead of transmitting + * trees more frequently. + * - I can't count above 4 + */ + + this.last_lit = 0; /* running index in l_buf */ + + this.d_buf = 0; + /* Buffer index for distances. To simplify the code, d_buf and l_buf have + * the same number of elements. To use different lengths, an extra flag + * array would be necessary. + */ + + this.opt_len = 0; /* bit length of current block with optimal trees */ + this.static_len = 0; /* bit length of current block with static trees */ + this.matches = 0; /* number of string matches in current block */ + this.insert = 0; /* bytes at end of window left to insert */ + + + this.bi_buf = 0; + /* Output buffer. bits are inserted starting at the bottom (least + * significant bits). + */ + this.bi_valid = 0; + /* Number of valid bits in bi_buf. All bits above the last valid bit + * are always zero. + */ + + // Used for window memory init. We safely ignore it for JS. That makes + // sense only for pointers and memory check tools. + //this.high_water = 0; + /* High water mark offset in window for initialized bytes -- bytes above + * this are set to zero in order to avoid memory check warnings when + * longest match routines access bytes past the input. This is then + * updated to the new high water mark. + */ +} + + +function deflateResetKeep(strm) { + var s; + + if (!strm || !strm.state) { + return err(strm, Z_STREAM_ERROR); + } + + strm.total_in = strm.total_out = 0; + strm.data_type = Z_UNKNOWN; + + s = strm.state; + s.pending = 0; + s.pending_out = 0; + + if (s.wrap < 0) { + s.wrap = -s.wrap; + /* was made negative by deflate(..., Z_FINISH); */ + } + s.status = (s.wrap ? INIT_STATE : BUSY_STATE); + strm.adler = (s.wrap === 2) ? + 0 // crc32(0, Z_NULL, 0) + : + 1; // adler32(0, Z_NULL, 0) + s.last_flush = Z_NO_FLUSH; + trees._tr_init(s); + return Z_OK; +} + + +function deflateReset(strm) { + var ret = deflateResetKeep(strm); + if (ret === Z_OK) { + lm_init(strm.state); + } + return ret; +} + + +function deflateSetHeader(strm, head) { + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; } + strm.state.gzhead = head; + return Z_OK; +} + + +function deflateInit2(strm, level, method, windowBits, memLevel, strategy) { + if (!strm) { // === Z_NULL + return Z_STREAM_ERROR; + } + var wrap = 1; + + if (level === Z_DEFAULT_COMPRESSION) { + level = 6; + } + + if (windowBits < 0) { /* suppress zlib wrapper */ + wrap = 0; + windowBits = -windowBits; + } + + else if (windowBits > 15) { + wrap = 2; /* write gzip wrapper instead */ + windowBits -= 16; + } + + + if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || + windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || + strategy < 0 || strategy > Z_FIXED) { + return err(strm, Z_STREAM_ERROR); + } + + + if (windowBits === 8) { + windowBits = 9; + } + /* until 256-byte window bug fixed */ + + var s = new DeflateState(); + + strm.state = s; + s.strm = strm; + + s.wrap = wrap; + s.gzhead = null; + s.w_bits = windowBits; + s.w_size = 1 << s.w_bits; + s.w_mask = s.w_size - 1; + + s.hash_bits = memLevel + 7; + s.hash_size = 1 << s.hash_bits; + s.hash_mask = s.hash_size - 1; + s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH); + + s.window = new utils.Buf8(s.w_size * 2); + s.head = new utils.Buf16(s.hash_size); + s.prev = new utils.Buf16(s.w_size); + + // Don't need mem init magic for JS. + //s.high_water = 0; /* nothing written to s->window yet */ + + s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ + + s.pending_buf_size = s.lit_bufsize * 4; + + //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); + //s->pending_buf = (uchf *) overlay; + s.pending_buf = new utils.Buf8(s.pending_buf_size); + + // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`) + //s->d_buf = overlay + s->lit_bufsize/sizeof(ush); + s.d_buf = 1 * s.lit_bufsize; + + //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; + s.l_buf = (1 + 2) * s.lit_bufsize; + + s.level = level; + s.strategy = strategy; + s.method = method; + + return deflateReset(strm); +} + +function deflateInit(strm, level) { + return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); +} + + +function deflate(strm, flush) { + var old_flush, s; + var beg, val; // for gzip header write only + + if (!strm || !strm.state || + flush > Z_BLOCK || flush < 0) { + return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR; + } + + s = strm.state; + + if (!strm.output || + (!strm.input && strm.avail_in !== 0) || + (s.status === FINISH_STATE && flush !== Z_FINISH)) { + return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR); + } + + s.strm = strm; /* just in case */ + old_flush = s.last_flush; + s.last_flush = flush; + + /* Write the header */ + if (s.status === INIT_STATE) { + + if (s.wrap === 2) { // GZIP header + strm.adler = 0; //crc32(0L, Z_NULL, 0); + put_byte(s, 31); + put_byte(s, 139); + put_byte(s, 8); + if (!s.gzhead) { // s->gzhead == Z_NULL + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, s.level === 9 ? 2 : + (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? + 4 : 0)); + put_byte(s, OS_CODE); + s.status = BUSY_STATE; + } + else { + put_byte(s, (s.gzhead.text ? 1 : 0) + + (s.gzhead.hcrc ? 2 : 0) + + (!s.gzhead.extra ? 0 : 4) + + (!s.gzhead.name ? 0 : 8) + + (!s.gzhead.comment ? 0 : 16) + ); + put_byte(s, s.gzhead.time & 0xff); + put_byte(s, (s.gzhead.time >> 8) & 0xff); + put_byte(s, (s.gzhead.time >> 16) & 0xff); + put_byte(s, (s.gzhead.time >> 24) & 0xff); + put_byte(s, s.level === 9 ? 2 : + (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? + 4 : 0)); + put_byte(s, s.gzhead.os & 0xff); + if (s.gzhead.extra && s.gzhead.extra.length) { + put_byte(s, s.gzhead.extra.length & 0xff); + put_byte(s, (s.gzhead.extra.length >> 8) & 0xff); + } + if (s.gzhead.hcrc) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0); + } + s.gzindex = 0; + s.status = EXTRA_STATE; + } + } + else // DEFLATE header + { + var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8; + var level_flags = -1; + + if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) { + level_flags = 0; + } else if (s.level < 6) { + level_flags = 1; + } else if (s.level === 6) { + level_flags = 2; + } else { + level_flags = 3; + } + header |= (level_flags << 6); + if (s.strstart !== 0) { header |= PRESET_DICT; } + header += 31 - (header % 31); + + s.status = BUSY_STATE; + putShortMSB(s, header); + + /* Save the adler32 of the preset dictionary: */ + if (s.strstart !== 0) { + putShortMSB(s, strm.adler >>> 16); + putShortMSB(s, strm.adler & 0xffff); + } + strm.adler = 1; // adler32(0L, Z_NULL, 0); + } + } + +//#ifdef GZIP + if (s.status === EXTRA_STATE) { + if (s.gzhead.extra/* != Z_NULL*/) { + beg = s.pending; /* start of bytes to update crc */ + + while (s.gzindex < (s.gzhead.extra.length & 0xffff)) { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + beg = s.pending; + if (s.pending === s.pending_buf_size) { + break; + } + } + put_byte(s, s.gzhead.extra[s.gzindex] & 0xff); + s.gzindex++; + } + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + if (s.gzindex === s.gzhead.extra.length) { + s.gzindex = 0; + s.status = NAME_STATE; + } + } + else { + s.status = NAME_STATE; + } + } + if (s.status === NAME_STATE) { + if (s.gzhead.name/* != Z_NULL*/) { + beg = s.pending; /* start of bytes to update crc */ + //int val; + + do { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + beg = s.pending; + if (s.pending === s.pending_buf_size) { + val = 1; + break; + } + } + // JS specific: little magic to add zero terminator to end of string + if (s.gzindex < s.gzhead.name.length) { + val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff; + } else { + val = 0; + } + put_byte(s, val); + } while (val !== 0); + + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + if (val === 0) { + s.gzindex = 0; + s.status = COMMENT_STATE; + } + } + else { + s.status = COMMENT_STATE; + } + } + if (s.status === COMMENT_STATE) { + if (s.gzhead.comment/* != Z_NULL*/) { + beg = s.pending; /* start of bytes to update crc */ + //int val; + + do { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + beg = s.pending; + if (s.pending === s.pending_buf_size) { + val = 1; + break; + } + } + // JS specific: little magic to add zero terminator to end of string + if (s.gzindex < s.gzhead.comment.length) { + val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff; + } else { + val = 0; + } + put_byte(s, val); + } while (val !== 0); + + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + if (val === 0) { + s.status = HCRC_STATE; + } + } + else { + s.status = HCRC_STATE; + } + } + if (s.status === HCRC_STATE) { + if (s.gzhead.hcrc) { + if (s.pending + 2 > s.pending_buf_size) { + flush_pending(strm); + } + if (s.pending + 2 <= s.pending_buf_size) { + put_byte(s, strm.adler & 0xff); + put_byte(s, (strm.adler >> 8) & 0xff); + strm.adler = 0; //crc32(0L, Z_NULL, 0); + s.status = BUSY_STATE; + } + } + else { + s.status = BUSY_STATE; + } + } +//#endif + + /* Flush as much pending output as possible */ + if (s.pending !== 0) { + flush_pending(strm); + if (strm.avail_out === 0) { + /* Since avail_out is 0, deflate will be called again with + * more output space, but possibly with both pending and + * avail_in equal to zero. There won't be anything to do, + * but this is not an error situation so make sure we + * return OK instead of BUF_ERROR at next call of deflate: + */ + s.last_flush = -1; + return Z_OK; + } + + /* Make sure there is something to do and avoid duplicate consecutive + * flushes. For repeated and useless calls with Z_FINISH, we keep + * returning Z_STREAM_END instead of Z_BUF_ERROR. + */ + } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && + flush !== Z_FINISH) { + return err(strm, Z_BUF_ERROR); + } + + /* User must not provide more input after the first FINISH: */ + if (s.status === FINISH_STATE && strm.avail_in !== 0) { + return err(strm, Z_BUF_ERROR); + } + + /* Start a new block or continue the current one. + */ + if (strm.avail_in !== 0 || s.lookahead !== 0 || + (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) { + var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) : + (s.strategy === Z_RLE ? deflate_rle(s, flush) : + configuration_table[s.level].func(s, flush)); + + if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) { + s.status = FINISH_STATE; + } + if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) { + if (strm.avail_out === 0) { + s.last_flush = -1; + /* avoid BUF_ERROR next call, see above */ + } + return Z_OK; + /* If flush != Z_NO_FLUSH && avail_out == 0, the next call + * of deflate should use the same flush parameter to make sure + * that the flush is complete. So we don't have to output an + * empty block here, this will be done at next call. This also + * ensures that for a very small output buffer, we emit at most + * one empty block. + */ + } + if (bstate === BS_BLOCK_DONE) { + if (flush === Z_PARTIAL_FLUSH) { + trees._tr_align(s); + } + else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ + + trees._tr_stored_block(s, 0, 0, false); + /* For a full flush, this empty block will be recognized + * as a special marker by inflate_sync(). + */ + if (flush === Z_FULL_FLUSH) { + /*** CLEAR_HASH(s); ***/ /* forget history */ + zero(s.head); // Fill with NIL (= 0); + + if (s.lookahead === 0) { + s.strstart = 0; + s.block_start = 0; + s.insert = 0; + } + } + } + flush_pending(strm); + if (strm.avail_out === 0) { + s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */ + return Z_OK; + } + } + } + //Assert(strm->avail_out > 0, "bug2"); + //if (strm.avail_out <= 0) { throw new Error("bug2");} + + if (flush !== Z_FINISH) { return Z_OK; } + if (s.wrap <= 0) { return Z_STREAM_END; } + + /* Write the trailer */ + if (s.wrap === 2) { + put_byte(s, strm.adler & 0xff); + put_byte(s, (strm.adler >> 8) & 0xff); + put_byte(s, (strm.adler >> 16) & 0xff); + put_byte(s, (strm.adler >> 24) & 0xff); + put_byte(s, strm.total_in & 0xff); + put_byte(s, (strm.total_in >> 8) & 0xff); + put_byte(s, (strm.total_in >> 16) & 0xff); + put_byte(s, (strm.total_in >> 24) & 0xff); + } + else + { + putShortMSB(s, strm.adler >>> 16); + putShortMSB(s, strm.adler & 0xffff); + } + + flush_pending(strm); + /* If avail_out is zero, the application will call deflate again + * to flush the rest. + */ + if (s.wrap > 0) { s.wrap = -s.wrap; } + /* write the trailer only once! */ + return s.pending !== 0 ? Z_OK : Z_STREAM_END; +} + +function deflateEnd(strm) { + var status; + + if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { + return Z_STREAM_ERROR; + } + + status = strm.state.status; + if (status !== INIT_STATE && + status !== EXTRA_STATE && + status !== NAME_STATE && + status !== COMMENT_STATE && + status !== HCRC_STATE && + status !== BUSY_STATE && + status !== FINISH_STATE + ) { + return err(strm, Z_STREAM_ERROR); + } + + strm.state = null; + + return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK; +} + + +/* ========================================================================= + * Initializes the compression dictionary from the given byte + * sequence without producing any compressed output. + */ +function deflateSetDictionary(strm, dictionary) { + var dictLength = dictionary.length; + + var s; + var str, n; + var wrap; + var avail; + var next; + var input; + var tmpDict; + + if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { + return Z_STREAM_ERROR; + } + + s = strm.state; + wrap = s.wrap; + + if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) { + return Z_STREAM_ERROR; + } + + /* when using zlib wrappers, compute Adler-32 for provided dictionary */ + if (wrap === 1) { + /* adler32(strm->adler, dictionary, dictLength); */ + strm.adler = adler32(strm.adler, dictionary, dictLength, 0); + } + + s.wrap = 0; /* avoid computing Adler-32 in read_buf */ + + /* if dictionary would fill window, just replace the history */ + if (dictLength >= s.w_size) { + if (wrap === 0) { /* already empty otherwise */ + /*** CLEAR_HASH(s); ***/ + zero(s.head); // Fill with NIL (= 0); + s.strstart = 0; + s.block_start = 0; + s.insert = 0; + } + /* use the tail */ + // dictionary = dictionary.slice(dictLength - s.w_size); + tmpDict = new utils.Buf8(s.w_size); + utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0); + dictionary = tmpDict; + dictLength = s.w_size; + } + /* insert dictionary into window and hash */ + avail = strm.avail_in; + next = strm.next_in; + input = strm.input; + strm.avail_in = dictLength; + strm.next_in = 0; + strm.input = dictionary; + fill_window(s); + while (s.lookahead >= MIN_MATCH) { + str = s.strstart; + n = s.lookahead - (MIN_MATCH - 1); + do { + /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; + + s.prev[str & s.w_mask] = s.head[s.ins_h]; + + s.head[s.ins_h] = str; + str++; + } while (--n); + s.strstart = str; + s.lookahead = MIN_MATCH - 1; + fill_window(s); + } + s.strstart += s.lookahead; + s.block_start = s.strstart; + s.insert = s.lookahead; + s.lookahead = 0; + s.match_length = s.prev_length = MIN_MATCH - 1; + s.match_available = 0; + strm.next_in = next; + strm.input = input; + strm.avail_in = avail; + s.wrap = wrap; + return Z_OK; +} + + +exports.deflateInit = deflateInit; +exports.deflateInit2 = deflateInit2; +exports.deflateReset = deflateReset; +exports.deflateResetKeep = deflateResetKeep; +exports.deflateSetHeader = deflateSetHeader; +exports.deflate = deflate; +exports.deflateEnd = deflateEnd; +exports.deflateSetDictionary = deflateSetDictionary; +exports.deflateInfo = 'pako deflate (from Nodeca project)'; + +/* Not implemented +exports.deflateBound = deflateBound; +exports.deflateCopy = deflateCopy; +exports.deflateParams = deflateParams; +exports.deflatePending = deflatePending; +exports.deflatePrime = deflatePrime; +exports.deflateTune = deflateTune; +*/ + +},{"../utils/common":39,"./adler32":40,"./crc32":42,"./messages":47,"./trees":48}],44:[function(require,module,exports){ +'use strict'; + +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + +// See state defs from inflate.js +var BAD = 30; /* got a data error -- remain here until reset */ +var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ + +/* + Decode literal, length, and distance codes and write out the resulting + literal and match bytes until either not enough input or output is + available, an end-of-block is encountered, or a data error is encountered. + When large enough input and output buffers are supplied to inflate(), for + example, a 16K input buffer and a 64K output buffer, more than 95% of the + inflate execution time is spent in this routine. + + Entry assumptions: + + state.mode === LEN + strm.avail_in >= 6 + strm.avail_out >= 258 + start >= strm.avail_out + state.bits < 8 + + On return, state.mode is one of: + + LEN -- ran out of enough output space or enough available input + TYPE -- reached end of block code, inflate() to interpret next block + BAD -- error in block data + + Notes: + + - The maximum input bits used by a length/distance pair is 15 bits for the + length code, 5 bits for the length extra, 15 bits for the distance code, + and 13 bits for the distance extra. This totals 48 bits, or six bytes. + Therefore if strm.avail_in >= 6, then there is enough input to avoid + checking for available input while decoding. + + - The maximum bytes that a single length/distance pair can output is 258 + bytes, which is the maximum length that can be coded. inflate_fast() + requires strm.avail_out >= 258 for each loop to avoid checking for + output space. + */ +module.exports = function inflate_fast(strm, start) { + var state; + var _in; /* local strm.input */ + var last; /* have enough input while in < last */ + var _out; /* local strm.output */ + var beg; /* inflate()'s initial strm.output */ + var end; /* while out < end, enough space available */ +//#ifdef INFLATE_STRICT + var dmax; /* maximum distance from zlib header */ +//#endif + var wsize; /* window size or zero if not using window */ + var whave; /* valid bytes in the window */ + var wnext; /* window write index */ + // Use `s_window` instead `window`, avoid conflict with instrumentation tools + var s_window; /* allocated sliding window, if wsize != 0 */ + var hold; /* local strm.hold */ + var bits; /* local strm.bits */ + var lcode; /* local strm.lencode */ + var dcode; /* local strm.distcode */ + var lmask; /* mask for first level of length codes */ + var dmask; /* mask for first level of distance codes */ + var here; /* retrieved table entry */ + var op; /* code bits, operation, extra bits, or */ + /* window position, window bytes to copy */ + var len; /* match length, unused bytes */ + var dist; /* match distance */ + var from; /* where to copy match from */ + var from_source; + + + var input, output; // JS specific, because we have no pointers + + /* copy state to local variables */ + state = strm.state; + //here = state.here; + _in = strm.next_in; + input = strm.input; + last = _in + (strm.avail_in - 5); + _out = strm.next_out; + output = strm.output; + beg = _out - (start - strm.avail_out); + end = _out + (strm.avail_out - 257); +//#ifdef INFLATE_STRICT + dmax = state.dmax; +//#endif + wsize = state.wsize; + whave = state.whave; + wnext = state.wnext; + s_window = state.window; + hold = state.hold; + bits = state.bits; + lcode = state.lencode; + dcode = state.distcode; + lmask = (1 << state.lenbits) - 1; + dmask = (1 << state.distbits) - 1; + + + /* decode literals and length/distances until end-of-block or not enough + input data or output space */ + + top: + do { + if (bits < 15) { + hold += input[_in++] << bits; + bits += 8; + hold += input[_in++] << bits; + bits += 8; + } + + here = lcode[hold & lmask]; + + dolen: + for (;;) { // Goto emulation + op = here >>> 24/*here.bits*/; + hold >>>= op; + bits -= op; + op = (here >>> 16) & 0xff/*here.op*/; + if (op === 0) { /* literal */ + //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + // "inflate: literal '%c'\n" : + // "inflate: literal 0x%02x\n", here.val)); + output[_out++] = here & 0xffff/*here.val*/; + } + else if (op & 16) { /* length base */ + len = here & 0xffff/*here.val*/; + op &= 15; /* number of extra bits */ + if (op) { + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + } + len += hold & ((1 << op) - 1); + hold >>>= op; + bits -= op; + } + //Tracevv((stderr, "inflate: length %u\n", len)); + if (bits < 15) { + hold += input[_in++] << bits; + bits += 8; + hold += input[_in++] << bits; + bits += 8; + } + here = dcode[hold & dmask]; + + dodist: + for (;;) { // goto emulation + op = here >>> 24/*here.bits*/; + hold >>>= op; + bits -= op; + op = (here >>> 16) & 0xff/*here.op*/; + + if (op & 16) { /* distance base */ + dist = here & 0xffff/*here.val*/; + op &= 15; /* number of extra bits */ + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + } + } + dist += hold & ((1 << op) - 1); +//#ifdef INFLATE_STRICT + if (dist > dmax) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break top; + } +//#endif + hold >>>= op; + bits -= op; + //Tracevv((stderr, "inflate: distance %u\n", dist)); + op = _out - beg; /* max distance in output */ + if (dist > op) { /* see if copy from window */ + op = dist - op; /* distance back in window */ + if (op > whave) { + if (state.sane) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break top; + } + +// (!) This block is disabled in zlib defaults, +// don't enable it for binary compatibility +//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR +// if (len <= op - whave) { +// do { +// output[_out++] = 0; +// } while (--len); +// continue top; +// } +// len -= op - whave; +// do { +// output[_out++] = 0; +// } while (--op > whave); +// if (op === 0) { +// from = _out - dist; +// do { +// output[_out++] = output[from++]; +// } while (--len); +// continue top; +// } +//#endif + } + from = 0; // window index + from_source = s_window; + if (wnext === 0) { /* very common case */ + from += wsize - op; + if (op < len) { /* some from window */ + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = _out - dist; /* rest from output */ + from_source = output; + } + } + else if (wnext < op) { /* wrap around window */ + from += wsize + wnext - op; + op -= wnext; + if (op < len) { /* some from end of window */ + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = 0; + if (wnext < len) { /* some from start of window */ + op = wnext; + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = _out - dist; /* rest from output */ + from_source = output; + } + } + } + else { /* contiguous in window */ + from += wnext - op; + if (op < len) { /* some from window */ + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = _out - dist; /* rest from output */ + from_source = output; + } + } + while (len > 2) { + output[_out++] = from_source[from++]; + output[_out++] = from_source[from++]; + output[_out++] = from_source[from++]; + len -= 3; + } + if (len) { + output[_out++] = from_source[from++]; + if (len > 1) { + output[_out++] = from_source[from++]; + } + } + } + else { + from = _out - dist; /* copy direct from output */ + do { /* minimum length is three */ + output[_out++] = output[from++]; + output[_out++] = output[from++]; + output[_out++] = output[from++]; + len -= 3; + } while (len > 2); + if (len) { + output[_out++] = output[from++]; + if (len > 1) { + output[_out++] = output[from++]; + } + } + } + } + else if ((op & 64) === 0) { /* 2nd level distance code */ + here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; + continue dodist; + } + else { + strm.msg = 'invalid distance code'; + state.mode = BAD; + break top; + } + + break; // need to emulate goto via "continue" + } + } + else if ((op & 64) === 0) { /* 2nd level length code */ + here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; + continue dolen; + } + else if (op & 32) { /* end-of-block */ + //Tracevv((stderr, "inflate: end of block\n")); + state.mode = TYPE; + break top; + } + else { + strm.msg = 'invalid literal/length code'; + state.mode = BAD; + break top; + } + + break; // need to emulate goto via "continue" + } + } while (_in < last && _out < end); + + /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ + len = bits >> 3; + _in -= len; + bits -= len << 3; + hold &= (1 << bits) - 1; + + /* update state and return */ + strm.next_in = _in; + strm.next_out = _out; + strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last)); + strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end)); + state.hold = hold; + state.bits = bits; + return; +}; + +},{}],45:[function(require,module,exports){ +'use strict'; + +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + +var utils = require('../utils/common'); +var adler32 = require('./adler32'); +var crc32 = require('./crc32'); +var inflate_fast = require('./inffast'); +var inflate_table = require('./inftrees'); + +var CODES = 0; +var LENS = 1; +var DISTS = 2; + +/* Public constants ==========================================================*/ +/* ===========================================================================*/ + + +/* Allowed flush values; see deflate() and inflate() below for details */ +//var Z_NO_FLUSH = 0; +//var Z_PARTIAL_FLUSH = 1; +//var Z_SYNC_FLUSH = 2; +//var Z_FULL_FLUSH = 3; +var Z_FINISH = 4; +var Z_BLOCK = 5; +var Z_TREES = 6; + + +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ +var Z_OK = 0; +var Z_STREAM_END = 1; +var Z_NEED_DICT = 2; +//var Z_ERRNO = -1; +var Z_STREAM_ERROR = -2; +var Z_DATA_ERROR = -3; +var Z_MEM_ERROR = -4; +var Z_BUF_ERROR = -5; +//var Z_VERSION_ERROR = -6; + +/* The deflate compression method */ +var Z_DEFLATED = 8; + + +/* STATES ====================================================================*/ +/* ===========================================================================*/ + + +var HEAD = 1; /* i: waiting for magic header */ +var FLAGS = 2; /* i: waiting for method and flags (gzip) */ +var TIME = 3; /* i: waiting for modification time (gzip) */ +var OS = 4; /* i: waiting for extra flags and operating system (gzip) */ +var EXLEN = 5; /* i: waiting for extra length (gzip) */ +var EXTRA = 6; /* i: waiting for extra bytes (gzip) */ +var NAME = 7; /* i: waiting for end of file name (gzip) */ +var COMMENT = 8; /* i: waiting for end of comment (gzip) */ +var HCRC = 9; /* i: waiting for header crc (gzip) */ +var DICTID = 10; /* i: waiting for dictionary check value */ +var DICT = 11; /* waiting for inflateSetDictionary() call */ +var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ +var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */ +var STORED = 14; /* i: waiting for stored size (length and complement) */ +var COPY_ = 15; /* i/o: same as COPY below, but only first time in */ +var COPY = 16; /* i/o: waiting for input or output to copy stored block */ +var TABLE = 17; /* i: waiting for dynamic block table lengths */ +var LENLENS = 18; /* i: waiting for code length code lengths */ +var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */ +var LEN_ = 20; /* i: same as LEN below, but only first time in */ +var LEN = 21; /* i: waiting for length/lit/eob code */ +var LENEXT = 22; /* i: waiting for length extra bits */ +var DIST = 23; /* i: waiting for distance code */ +var DISTEXT = 24; /* i: waiting for distance extra bits */ +var MATCH = 25; /* o: waiting for output space to copy string */ +var LIT = 26; /* o: waiting for output space to write literal */ +var CHECK = 27; /* i: waiting for 32-bit check value */ +var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */ +var DONE = 29; /* finished check, done -- remain here until reset */ +var BAD = 30; /* got a data error -- remain here until reset */ +var MEM = 31; /* got an inflate() memory error -- remain here until reset */ +var SYNC = 32; /* looking for synchronization bytes to restart inflate() */ + +/* ===========================================================================*/ + + + +var ENOUGH_LENS = 852; +var ENOUGH_DISTS = 592; +//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); + +var MAX_WBITS = 15; +/* 32K LZ77 window */ +var DEF_WBITS = MAX_WBITS; + + +function zswap32(q) { + return (((q >>> 24) & 0xff) + + ((q >>> 8) & 0xff00) + + ((q & 0xff00) << 8) + + ((q & 0xff) << 24)); +} + + +function InflateState() { + this.mode = 0; /* current inflate mode */ + this.last = false; /* true if processing last block */ + this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ + this.havedict = false; /* true if dictionary provided */ + this.flags = 0; /* gzip header method and flags (0 if zlib) */ + this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */ + this.check = 0; /* protected copy of check value */ + this.total = 0; /* protected copy of output count */ + // TODO: may be {} + this.head = null; /* where to save gzip header information */ + + /* sliding window */ + this.wbits = 0; /* log base 2 of requested window size */ + this.wsize = 0; /* window size or zero if not using window */ + this.whave = 0; /* valid bytes in the window */ + this.wnext = 0; /* window write index */ + this.window = null; /* allocated sliding window, if needed */ + + /* bit accumulator */ + this.hold = 0; /* input bit accumulator */ + this.bits = 0; /* number of bits in "in" */ + + /* for string and stored block copying */ + this.length = 0; /* literal or length of data to copy */ + this.offset = 0; /* distance back to copy string from */ + + /* for table and code decoding */ + this.extra = 0; /* extra bits needed */ + + /* fixed and dynamic code tables */ + this.lencode = null; /* starting table for length/literal codes */ + this.distcode = null; /* starting table for distance codes */ + this.lenbits = 0; /* index bits for lencode */ + this.distbits = 0; /* index bits for distcode */ + + /* dynamic table building */ + this.ncode = 0; /* number of code length code lengths */ + this.nlen = 0; /* number of length code lengths */ + this.ndist = 0; /* number of distance code lengths */ + this.have = 0; /* number of code lengths in lens[] */ + this.next = null; /* next available space in codes[] */ + + this.lens = new utils.Buf16(320); /* temporary storage for code lengths */ + this.work = new utils.Buf16(288); /* work area for code table building */ + + /* + because we don't have pointers in js, we use lencode and distcode directly + as buffers so we don't need codes + */ + //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */ + this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */ + this.distdyn = null; /* dynamic table for distance codes (JS specific) */ + this.sane = 0; /* if false, allow invalid distance too far */ + this.back = 0; /* bits back of last unprocessed length/lit */ + this.was = 0; /* initial length of match */ +} + +function inflateResetKeep(strm) { + var state; + + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + strm.total_in = strm.total_out = state.total = 0; + strm.msg = ''; /*Z_NULL*/ + if (state.wrap) { /* to support ill-conceived Java test suite */ + strm.adler = state.wrap & 1; + } + state.mode = HEAD; + state.last = 0; + state.havedict = 0; + state.dmax = 32768; + state.head = null/*Z_NULL*/; + state.hold = 0; + state.bits = 0; + //state.lencode = state.distcode = state.next = state.codes; + state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS); + state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS); + + state.sane = 1; + state.back = -1; + //Tracev((stderr, "inflate: reset\n")); + return Z_OK; +} + +function inflateReset(strm) { + var state; + + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + state.wsize = 0; + state.whave = 0; + state.wnext = 0; + return inflateResetKeep(strm); + +} + +function inflateReset2(strm, windowBits) { + var wrap; + var state; + + /* get the state */ + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + + /* extract wrap request from windowBits parameter */ + if (windowBits < 0) { + wrap = 0; + windowBits = -windowBits; + } + else { + wrap = (windowBits >> 4) + 1; + if (windowBits < 48) { + windowBits &= 15; + } + } + + /* set number of window bits, free window if different */ + if (windowBits && (windowBits < 8 || windowBits > 15)) { + return Z_STREAM_ERROR; + } + if (state.window !== null && state.wbits !== windowBits) { + state.window = null; + } + + /* update state and reset the rest of it */ + state.wrap = wrap; + state.wbits = windowBits; + return inflateReset(strm); +} + +function inflateInit2(strm, windowBits) { + var ret; + var state; + + if (!strm) { return Z_STREAM_ERROR; } + //strm.msg = Z_NULL; /* in case we return an error */ + + state = new InflateState(); + + //if (state === Z_NULL) return Z_MEM_ERROR; + //Tracev((stderr, "inflate: allocated\n")); + strm.state = state; + state.window = null/*Z_NULL*/; + ret = inflateReset2(strm, windowBits); + if (ret !== Z_OK) { + strm.state = null/*Z_NULL*/; + } + return ret; +} + +function inflateInit(strm) { + return inflateInit2(strm, DEF_WBITS); +} + + +/* + Return state with length and distance decoding tables and index sizes set to + fixed code decoding. Normally this returns fixed tables from inffixed.h. + If BUILDFIXED is defined, then instead this routine builds the tables the + first time it's called, and returns those tables the first time and + thereafter. This reduces the size of the code by about 2K bytes, in + exchange for a little execution time. However, BUILDFIXED should not be + used for threaded applications, since the rewriting of the tables and virgin + may not be thread-safe. + */ +var virgin = true; + +var lenfix, distfix; // We have no pointers in JS, so keep tables separate + +function fixedtables(state) { + /* build fixed huffman tables if first call (may not be thread safe) */ + if (virgin) { + var sym; + + lenfix = new utils.Buf32(512); + distfix = new utils.Buf32(32); + + /* literal/length table */ + sym = 0; + while (sym < 144) { state.lens[sym++] = 8; } + while (sym < 256) { state.lens[sym++] = 9; } + while (sym < 280) { state.lens[sym++] = 7; } + while (sym < 288) { state.lens[sym++] = 8; } + + inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 }); + + /* distance table */ + sym = 0; + while (sym < 32) { state.lens[sym++] = 5; } + + inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 }); + + /* do this just once */ + virgin = false; + } + + state.lencode = lenfix; + state.lenbits = 9; + state.distcode = distfix; + state.distbits = 5; +} + + +/* + Update the window with the last wsize (normally 32K) bytes written before + returning. If window does not exist yet, create it. This is only called + when a window is already in use, or when output has been written during this + inflate call, but the end of the deflate stream has not been reached yet. + It is also called to create a window for dictionary data when a dictionary + is loaded. + + Providing output buffers larger than 32K to inflate() should provide a speed + advantage, since only the last 32K of output is copied to the sliding window + upon return from inflate(), and since all distances after the first 32K of + output will fall in the output data, making match copies simpler and faster. + The advantage may be dependent on the size of the processor's data caches. + */ +function updatewindow(strm, src, end, copy) { + var dist; + var state = strm.state; + + /* if it hasn't been done already, allocate space for the window */ + if (state.window === null) { + state.wsize = 1 << state.wbits; + state.wnext = 0; + state.whave = 0; + + state.window = new utils.Buf8(state.wsize); + } + + /* copy state->wsize or less output bytes into the circular window */ + if (copy >= state.wsize) { + utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0); + state.wnext = 0; + state.whave = state.wsize; + } + else { + dist = state.wsize - state.wnext; + if (dist > copy) { + dist = copy; + } + //zmemcpy(state->window + state->wnext, end - copy, dist); + utils.arraySet(state.window, src, end - copy, dist, state.wnext); + copy -= dist; + if (copy) { + //zmemcpy(state->window, end - copy, copy); + utils.arraySet(state.window, src, end - copy, copy, 0); + state.wnext = copy; + state.whave = state.wsize; + } + else { + state.wnext += dist; + if (state.wnext === state.wsize) { state.wnext = 0; } + if (state.whave < state.wsize) { state.whave += dist; } + } + } + return 0; +} + +function inflate(strm, flush) { + var state; + var input, output; // input/output buffers + var next; /* next input INDEX */ + var put; /* next output INDEX */ + var have, left; /* available input and output */ + var hold; /* bit buffer */ + var bits; /* bits in bit buffer */ + var _in, _out; /* save starting available input and output */ + var copy; /* number of stored or match bytes to copy */ + var from; /* where to copy match bytes from */ + var from_source; + var here = 0; /* current decoding table entry */ + var here_bits, here_op, here_val; // paked "here" denormalized (JS specific) + //var last; /* parent table entry */ + var last_bits, last_op, last_val; // paked "last" denormalized (JS specific) + var len; /* length to copy for repeats, bits to drop */ + var ret; /* return code */ + var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */ + var opts; + + var n; // temporary var for NEED_BITS + + var order = /* permutation of code lengths */ + [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]; + + + if (!strm || !strm.state || !strm.output || + (!strm.input && strm.avail_in !== 0)) { + return Z_STREAM_ERROR; + } + + state = strm.state; + if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */ + + + //--- LOAD() --- + put = strm.next_out; + output = strm.output; + left = strm.avail_out; + next = strm.next_in; + input = strm.input; + have = strm.avail_in; + hold = state.hold; + bits = state.bits; + //--- + + _in = have; + _out = left; + ret = Z_OK; + + inf_leave: // goto emulation + for (;;) { + switch (state.mode) { + case HEAD: + if (state.wrap === 0) { + state.mode = TYPEDO; + break; + } + //=== NEEDBITS(16); + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */ + state.check = 0/*crc32(0L, Z_NULL, 0)*/; + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = FLAGS; + break; + } + state.flags = 0; /* expect zlib header */ + if (state.head) { + state.head.done = false; + } + if (!(state.wrap & 1) || /* check if zlib header allowed */ + (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) { + strm.msg = 'incorrect header check'; + state.mode = BAD; + break; + } + if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) { + strm.msg = 'unknown compression method'; + state.mode = BAD; + break; + } + //--- DROPBITS(4) ---// + hold >>>= 4; + bits -= 4; + //---// + len = (hold & 0x0f)/*BITS(4)*/ + 8; + if (state.wbits === 0) { + state.wbits = len; + } + else if (len > state.wbits) { + strm.msg = 'invalid window size'; + state.mode = BAD; + break; + } + state.dmax = 1 << len; + //Tracev((stderr, "inflate: zlib header ok\n")); + strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; + state.mode = hold & 0x200 ? DICTID : TYPE; + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + break; + case FLAGS: + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.flags = hold; + if ((state.flags & 0xff) !== Z_DEFLATED) { + strm.msg = 'unknown compression method'; + state.mode = BAD; + break; + } + if (state.flags & 0xe000) { + strm.msg = 'unknown header flags set'; + state.mode = BAD; + break; + } + if (state.head) { + state.head.text = ((hold >> 8) & 1); + } + if (state.flags & 0x0200) { + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = TIME; + /* falls through */ + case TIME: + //=== NEEDBITS(32); */ + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (state.head) { + state.head.time = hold; + } + if (state.flags & 0x0200) { + //=== CRC4(state.check, hold) + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + hbuf[2] = (hold >>> 16) & 0xff; + hbuf[3] = (hold >>> 24) & 0xff; + state.check = crc32(state.check, hbuf, 4, 0); + //=== + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = OS; + /* falls through */ + case OS: + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (state.head) { + state.head.xflags = (hold & 0xff); + state.head.os = (hold >> 8); + } + if (state.flags & 0x0200) { + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = EXLEN; + /* falls through */ + case EXLEN: + if (state.flags & 0x0400) { + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.length = hold; + if (state.head) { + state.head.extra_len = hold; + } + if (state.flags & 0x0200) { + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + } + else if (state.head) { + state.head.extra = null/*Z_NULL*/; + } + state.mode = EXTRA; + /* falls through */ + case EXTRA: + if (state.flags & 0x0400) { + copy = state.length; + if (copy > have) { copy = have; } + if (copy) { + if (state.head) { + len = state.head.extra_len - state.length; + if (!state.head.extra) { + // Use untyped array for more convenient processing later + state.head.extra = new Array(state.head.extra_len); + } + utils.arraySet( + state.head.extra, + input, + next, + // extra field is limited to 65536 bytes + // - no need for additional size check + copy, + /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ + len + ); + //zmemcpy(state.head.extra + len, next, + // len + copy > state.head.extra_max ? + // state.head.extra_max - len : copy); + } + if (state.flags & 0x0200) { + state.check = crc32(state.check, input, copy, next); + } + have -= copy; + next += copy; + state.length -= copy; + } + if (state.length) { break inf_leave; } + } + state.length = 0; + state.mode = NAME; + /* falls through */ + case NAME: + if (state.flags & 0x0800) { + if (have === 0) { break inf_leave; } + copy = 0; + do { + // TODO: 2 or 1 bytes? + len = input[next + copy++]; + /* use constant limit because in js we should not preallocate memory */ + if (state.head && len && + (state.length < 65536 /*state.head.name_max*/)) { + state.head.name += String.fromCharCode(len); + } + } while (len && copy < have); + + if (state.flags & 0x0200) { + state.check = crc32(state.check, input, copy, next); + } + have -= copy; + next += copy; + if (len) { break inf_leave; } + } + else if (state.head) { + state.head.name = null; + } + state.length = 0; + state.mode = COMMENT; + /* falls through */ + case COMMENT: + if (state.flags & 0x1000) { + if (have === 0) { break inf_leave; } + copy = 0; + do { + len = input[next + copy++]; + /* use constant limit because in js we should not preallocate memory */ + if (state.head && len && + (state.length < 65536 /*state.head.comm_max*/)) { + state.head.comment += String.fromCharCode(len); + } + } while (len && copy < have); + if (state.flags & 0x0200) { + state.check = crc32(state.check, input, copy, next); + } + have -= copy; + next += copy; + if (len) { break inf_leave; } + } + else if (state.head) { + state.head.comment = null; + } + state.mode = HCRC; + /* falls through */ + case HCRC: + if (state.flags & 0x0200) { + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (hold !== (state.check & 0xffff)) { + strm.msg = 'header crc mismatch'; + state.mode = BAD; + break; + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + } + if (state.head) { + state.head.hcrc = ((state.flags >> 9) & 1); + state.head.done = true; + } + strm.adler = state.check = 0; + state.mode = TYPE; + break; + case DICTID: + //=== NEEDBITS(32); */ + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + strm.adler = state.check = zswap32(hold); + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = DICT; + /* falls through */ + case DICT: + if (state.havedict === 0) { + //--- RESTORE() --- + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state.hold = hold; + state.bits = bits; + //--- + return Z_NEED_DICT; + } + strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; + state.mode = TYPE; + /* falls through */ + case TYPE: + if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; } + /* falls through */ + case TYPEDO: + if (state.last) { + //--- BYTEBITS() ---// + hold >>>= bits & 7; + bits -= bits & 7; + //---// + state.mode = CHECK; + break; + } + //=== NEEDBITS(3); */ + while (bits < 3) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.last = (hold & 0x01)/*BITS(1)*/; + //--- DROPBITS(1) ---// + hold >>>= 1; + bits -= 1; + //---// + + switch ((hold & 0x03)/*BITS(2)*/) { + case 0: /* stored block */ + //Tracev((stderr, "inflate: stored block%s\n", + // state.last ? " (last)" : "")); + state.mode = STORED; + break; + case 1: /* fixed block */ + fixedtables(state); + //Tracev((stderr, "inflate: fixed codes block%s\n", + // state.last ? " (last)" : "")); + state.mode = LEN_; /* decode codes */ + if (flush === Z_TREES) { + //--- DROPBITS(2) ---// + hold >>>= 2; + bits -= 2; + //---// + break inf_leave; + } + break; + case 2: /* dynamic block */ + //Tracev((stderr, "inflate: dynamic codes block%s\n", + // state.last ? " (last)" : "")); + state.mode = TABLE; + break; + case 3: + strm.msg = 'invalid block type'; + state.mode = BAD; + } + //--- DROPBITS(2) ---// + hold >>>= 2; + bits -= 2; + //---// + break; + case STORED: + //--- BYTEBITS() ---// /* go to byte boundary */ + hold >>>= bits & 7; + bits -= bits & 7; + //---// + //=== NEEDBITS(32); */ + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) { + strm.msg = 'invalid stored block lengths'; + state.mode = BAD; + break; + } + state.length = hold & 0xffff; + //Tracev((stderr, "inflate: stored length %u\n", + // state.length)); + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = COPY_; + if (flush === Z_TREES) { break inf_leave; } + /* falls through */ + case COPY_: + state.mode = COPY; + /* falls through */ + case COPY: + copy = state.length; + if (copy) { + if (copy > have) { copy = have; } + if (copy > left) { copy = left; } + if (copy === 0) { break inf_leave; } + //--- zmemcpy(put, next, copy); --- + utils.arraySet(output, input, next, copy, put); + //---// + have -= copy; + next += copy; + left -= copy; + put += copy; + state.length -= copy; + break; + } + //Tracev((stderr, "inflate: stored end\n")); + state.mode = TYPE; + break; + case TABLE: + //=== NEEDBITS(14); */ + while (bits < 14) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257; + //--- DROPBITS(5) ---// + hold >>>= 5; + bits -= 5; + //---// + state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1; + //--- DROPBITS(5) ---// + hold >>>= 5; + bits -= 5; + //---// + state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4; + //--- DROPBITS(4) ---// + hold >>>= 4; + bits -= 4; + //---// +//#ifndef PKZIP_BUG_WORKAROUND + if (state.nlen > 286 || state.ndist > 30) { + strm.msg = 'too many length or distance symbols'; + state.mode = BAD; + break; + } +//#endif + //Tracev((stderr, "inflate: table sizes ok\n")); + state.have = 0; + state.mode = LENLENS; + /* falls through */ + case LENLENS: + while (state.have < state.ncode) { + //=== NEEDBITS(3); + while (bits < 3) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.lens[order[state.have++]] = (hold & 0x07);//BITS(3); + //--- DROPBITS(3) ---// + hold >>>= 3; + bits -= 3; + //---// + } + while (state.have < 19) { + state.lens[order[state.have++]] = 0; + } + // We have separate tables & no pointers. 2 commented lines below not needed. + //state.next = state.codes; + //state.lencode = state.next; + // Switch to use dynamic table + state.lencode = state.lendyn; + state.lenbits = 7; + + opts = { bits: state.lenbits }; + ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts); + state.lenbits = opts.bits; + + if (ret) { + strm.msg = 'invalid code lengths set'; + state.mode = BAD; + break; + } + //Tracev((stderr, "inflate: code lengths ok\n")); + state.have = 0; + state.mode = CODELENS; + /* falls through */ + case CODELENS: + while (state.have < state.nlen + state.ndist) { + for (;;) { + here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/ + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + if (here_val < 16) { + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + state.lens[state.have++] = here_val; + } + else { + if (here_val === 16) { + //=== NEEDBITS(here.bits + 2); + n = here_bits + 2; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + if (state.have === 0) { + strm.msg = 'invalid bit length repeat'; + state.mode = BAD; + break; + } + len = state.lens[state.have - 1]; + copy = 3 + (hold & 0x03);//BITS(2); + //--- DROPBITS(2) ---// + hold >>>= 2; + bits -= 2; + //---// + } + else if (here_val === 17) { + //=== NEEDBITS(here.bits + 3); + n = here_bits + 3; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + len = 0; + copy = 3 + (hold & 0x07);//BITS(3); + //--- DROPBITS(3) ---// + hold >>>= 3; + bits -= 3; + //---// + } + else { + //=== NEEDBITS(here.bits + 7); + n = here_bits + 7; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + len = 0; + copy = 11 + (hold & 0x7f);//BITS(7); + //--- DROPBITS(7) ---// + hold >>>= 7; + bits -= 7; + //---// + } + if (state.have + copy > state.nlen + state.ndist) { + strm.msg = 'invalid bit length repeat'; + state.mode = BAD; + break; + } + while (copy--) { + state.lens[state.have++] = len; + } + } + } + + /* handle error breaks in while */ + if (state.mode === BAD) { break; } + + /* check for end-of-block code (better have one) */ + if (state.lens[256] === 0) { + strm.msg = 'invalid code -- missing end-of-block'; + state.mode = BAD; + break; + } + + /* build code tables -- note: do not change the lenbits or distbits + values here (9 and 6) without reading the comments in inftrees.h + concerning the ENOUGH constants, which depend on those values */ + state.lenbits = 9; + + opts = { bits: state.lenbits }; + ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); + // We have separate tables & no pointers. 2 commented lines below not needed. + // state.next_index = opts.table_index; + state.lenbits = opts.bits; + // state.lencode = state.next; + + if (ret) { + strm.msg = 'invalid literal/lengths set'; + state.mode = BAD; + break; + } + + state.distbits = 6; + //state.distcode.copy(state.codes); + // Switch to use dynamic table + state.distcode = state.distdyn; + opts = { bits: state.distbits }; + ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); + // We have separate tables & no pointers. 2 commented lines below not needed. + // state.next_index = opts.table_index; + state.distbits = opts.bits; + // state.distcode = state.next; + + if (ret) { + strm.msg = 'invalid distances set'; + state.mode = BAD; + break; + } + //Tracev((stderr, 'inflate: codes ok\n')); + state.mode = LEN_; + if (flush === Z_TREES) { break inf_leave; } + /* falls through */ + case LEN_: + state.mode = LEN; + /* falls through */ + case LEN: + if (have >= 6 && left >= 258) { + //--- RESTORE() --- + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state.hold = hold; + state.bits = bits; + //--- + inflate_fast(strm, _out); + //--- LOAD() --- + put = strm.next_out; + output = strm.output; + left = strm.avail_out; + next = strm.next_in; + input = strm.input; + have = strm.avail_in; + hold = state.hold; + bits = state.bits; + //--- + + if (state.mode === TYPE) { + state.back = -1; + } + break; + } + state.back = 0; + for (;;) { + here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/ + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if (here_bits <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + if (here_op && (here_op & 0xf0) === 0) { + last_bits = here_bits; + last_op = here_op; + last_val = here_val; + for (;;) { + here = state.lencode[last_val + + ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((last_bits + here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + //--- DROPBITS(last.bits) ---// + hold >>>= last_bits; + bits -= last_bits; + //---// + state.back += last_bits; + } + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + state.back += here_bits; + state.length = here_val; + if (here_op === 0) { + //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + // "inflate: literal '%c'\n" : + // "inflate: literal 0x%02x\n", here.val)); + state.mode = LIT; + break; + } + if (here_op & 32) { + //Tracevv((stderr, "inflate: end of block\n")); + state.back = -1; + state.mode = TYPE; + break; + } + if (here_op & 64) { + strm.msg = 'invalid literal/length code'; + state.mode = BAD; + break; + } + state.extra = here_op & 15; + state.mode = LENEXT; + /* falls through */ + case LENEXT: + if (state.extra) { + //=== NEEDBITS(state.extra); + n = state.extra; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; + //--- DROPBITS(state.extra) ---// + hold >>>= state.extra; + bits -= state.extra; + //---// + state.back += state.extra; + } + //Tracevv((stderr, "inflate: length %u\n", state.length)); + state.was = state.length; + state.mode = DIST; + /* falls through */ + case DIST: + for (;;) { + here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/ + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + if ((here_op & 0xf0) === 0) { + last_bits = here_bits; + last_op = here_op; + last_val = here_val; + for (;;) { + here = state.distcode[last_val + + ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((last_bits + here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + //--- DROPBITS(last.bits) ---// + hold >>>= last_bits; + bits -= last_bits; + //---// + state.back += last_bits; + } + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + state.back += here_bits; + if (here_op & 64) { + strm.msg = 'invalid distance code'; + state.mode = BAD; + break; + } + state.offset = here_val; + state.extra = (here_op) & 15; + state.mode = DISTEXT; + /* falls through */ + case DISTEXT: + if (state.extra) { + //=== NEEDBITS(state.extra); + n = state.extra; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; + //--- DROPBITS(state.extra) ---// + hold >>>= state.extra; + bits -= state.extra; + //---// + state.back += state.extra; + } +//#ifdef INFLATE_STRICT + if (state.offset > state.dmax) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break; + } +//#endif + //Tracevv((stderr, "inflate: distance %u\n", state.offset)); + state.mode = MATCH; + /* falls through */ + case MATCH: + if (left === 0) { break inf_leave; } + copy = _out - left; + if (state.offset > copy) { /* copy from window */ + copy = state.offset - copy; + if (copy > state.whave) { + if (state.sane) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break; + } +// (!) This block is disabled in zlib defaults, +// don't enable it for binary compatibility +//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR +// Trace((stderr, "inflate.c too far\n")); +// copy -= state.whave; +// if (copy > state.length) { copy = state.length; } +// if (copy > left) { copy = left; } +// left -= copy; +// state.length -= copy; +// do { +// output[put++] = 0; +// } while (--copy); +// if (state.length === 0) { state.mode = LEN; } +// break; +//#endif + } + if (copy > state.wnext) { + copy -= state.wnext; + from = state.wsize - copy; + } + else { + from = state.wnext - copy; + } + if (copy > state.length) { copy = state.length; } + from_source = state.window; + } + else { /* copy from output */ + from_source = output; + from = put - state.offset; + copy = state.length; + } + if (copy > left) { copy = left; } + left -= copy; + state.length -= copy; + do { + output[put++] = from_source[from++]; + } while (--copy); + if (state.length === 0) { state.mode = LEN; } + break; + case LIT: + if (left === 0) { break inf_leave; } + output[put++] = state.length; + left--; + state.mode = LEN; + break; + case CHECK: + if (state.wrap) { + //=== NEEDBITS(32); + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + // Use '|' instead of '+' to make sure that result is signed + hold |= input[next++] << bits; + bits += 8; + } + //===// + _out -= left; + strm.total_out += _out; + state.total += _out; + if (_out) { + strm.adler = state.check = + /*UPDATE(state.check, put - _out, _out);*/ + (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out)); + + } + _out = left; + // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too + if ((state.flags ? hold : zswap32(hold)) !== state.check) { + strm.msg = 'incorrect data check'; + state.mode = BAD; + break; + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + //Tracev((stderr, "inflate: check matches trailer\n")); + } + state.mode = LENGTH; + /* falls through */ + case LENGTH: + if (state.wrap && state.flags) { + //=== NEEDBITS(32); + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (hold !== (state.total & 0xffffffff)) { + strm.msg = 'incorrect length check'; + state.mode = BAD; + break; + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + //Tracev((stderr, "inflate: length matches trailer\n")); + } + state.mode = DONE; + /* falls through */ + case DONE: + ret = Z_STREAM_END; + break inf_leave; + case BAD: + ret = Z_DATA_ERROR; + break inf_leave; + case MEM: + return Z_MEM_ERROR; + case SYNC: + /* falls through */ + default: + return Z_STREAM_ERROR; + } + } + + // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave" + + /* + Return from inflate(), updating the total counts and the check value. + If there was no progress during the inflate() call, return a buffer + error. Call updatewindow() to create and/or update the window state. + Note: a memory error from inflate() is non-recoverable. + */ + + //--- RESTORE() --- + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state.hold = hold; + state.bits = bits; + //--- + + if (state.wsize || (_out !== strm.avail_out && state.mode < BAD && + (state.mode < CHECK || flush !== Z_FINISH))) { + if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { + state.mode = MEM; + return Z_MEM_ERROR; + } + } + _in -= strm.avail_in; + _out -= strm.avail_out; + strm.total_in += _in; + strm.total_out += _out; + state.total += _out; + if (state.wrap && _out) { + strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ + (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out)); + } + strm.data_type = state.bits + (state.last ? 64 : 0) + + (state.mode === TYPE ? 128 : 0) + + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); + if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) { + ret = Z_BUF_ERROR; + } + return ret; +} + +function inflateEnd(strm) { + + if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) { + return Z_STREAM_ERROR; + } + + var state = strm.state; + if (state.window) { + state.window = null; + } + strm.state = null; + return Z_OK; +} + +function inflateGetHeader(strm, head) { + var state; + + /* check state */ + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; } + + /* save header structure */ + state.head = head; + head.done = false; + return Z_OK; +} + +function inflateSetDictionary(strm, dictionary) { + var dictLength = dictionary.length; + + var state; + var dictid; + var ret; + + /* check state */ + if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; } + state = strm.state; + + if (state.wrap !== 0 && state.mode !== DICT) { + return Z_STREAM_ERROR; + } + + /* check for correct dictionary identifier */ + if (state.mode === DICT) { + dictid = 1; /* adler32(0, null, 0)*/ + /* dictid = adler32(dictid, dictionary, dictLength); */ + dictid = adler32(dictid, dictionary, dictLength, 0); + if (dictid !== state.check) { + return Z_DATA_ERROR; + } + } + /* copy dictionary to window using updatewindow(), which will amend the + existing dictionary if appropriate */ + ret = updatewindow(strm, dictionary, dictLength, dictLength); + if (ret) { + state.mode = MEM; + return Z_MEM_ERROR; + } + state.havedict = 1; + // Tracev((stderr, "inflate: dictionary set\n")); + return Z_OK; +} + +exports.inflateReset = inflateReset; +exports.inflateReset2 = inflateReset2; +exports.inflateResetKeep = inflateResetKeep; +exports.inflateInit = inflateInit; +exports.inflateInit2 = inflateInit2; +exports.inflate = inflate; +exports.inflateEnd = inflateEnd; +exports.inflateGetHeader = inflateGetHeader; +exports.inflateSetDictionary = inflateSetDictionary; +exports.inflateInfo = 'pako inflate (from Nodeca project)'; + +/* Not implemented +exports.inflateCopy = inflateCopy; +exports.inflateGetDictionary = inflateGetDictionary; +exports.inflateMark = inflateMark; +exports.inflatePrime = inflatePrime; +exports.inflateSync = inflateSync; +exports.inflateSyncPoint = inflateSyncPoint; +exports.inflateUndermine = inflateUndermine; +*/ + +},{"../utils/common":39,"./adler32":40,"./crc32":42,"./inffast":44,"./inftrees":46}],46:[function(require,module,exports){ +'use strict'; + +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + +var utils = require('../utils/common'); + +var MAXBITS = 15; +var ENOUGH_LENS = 852; +var ENOUGH_DISTS = 592; +//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); + +var CODES = 0; +var LENS = 1; +var DISTS = 2; + +var lbase = [ /* Length codes 257..285 base */ + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 +]; + +var lext = [ /* Length codes 257..285 extra */ + 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78 +]; + +var dbase = [ /* Distance codes 0..29 base */ + 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, + 8193, 12289, 16385, 24577, 0, 0 +]; + +var dext = [ /* Distance codes 0..29 extra */ + 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, + 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, + 28, 28, 29, 29, 64, 64 +]; + +module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) +{ + var bits = opts.bits; + //here = opts.here; /* table entry for duplication */ + + var len = 0; /* a code's length in bits */ + var sym = 0; /* index of code symbols */ + var min = 0, max = 0; /* minimum and maximum code lengths */ + var root = 0; /* number of index bits for root table */ + var curr = 0; /* number of index bits for current table */ + var drop = 0; /* code bits to drop for sub-table */ + var left = 0; /* number of prefix codes available */ + var used = 0; /* code entries in table used */ + var huff = 0; /* Huffman code */ + var incr; /* for incrementing code, index */ + var fill; /* index for replicating entries */ + var low; /* low bits for current root entry */ + var mask; /* mask for low root bits */ + var next; /* next available space in table */ + var base = null; /* base value table to use */ + var base_index = 0; +// var shoextra; /* extra bits table to use */ + var end; /* use base and extra for symbol > end */ + var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */ + var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */ + var extra = null; + var extra_index = 0; + + var here_bits, here_op, here_val; + + /* + Process a set of code lengths to create a canonical Huffman code. The + code lengths are lens[0..codes-1]. Each length corresponds to the + symbols 0..codes-1. The Huffman code is generated by first sorting the + symbols by length from short to long, and retaining the symbol order + for codes with equal lengths. Then the code starts with all zero bits + for the first code of the shortest length, and the codes are integer + increments for the same length, and zeros are appended as the length + increases. For the deflate format, these bits are stored backwards + from their more natural integer increment ordering, and so when the + decoding tables are built in the large loop below, the integer codes + are incremented backwards. + + This routine assumes, but does not check, that all of the entries in + lens[] are in the range 0..MAXBITS. The caller must assure this. + 1..MAXBITS is interpreted as that code length. zero means that that + symbol does not occur in this code. + + The codes are sorted by computing a count of codes for each length, + creating from that a table of starting indices for each length in the + sorted table, and then entering the symbols in order in the sorted + table. The sorted table is work[], with that space being provided by + the caller. + + The length counts are used for other purposes as well, i.e. finding + the minimum and maximum length codes, determining if there are any + codes at all, checking for a valid set of lengths, and looking ahead + at length counts to determine sub-table sizes when building the + decoding tables. + */ + + /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ + for (len = 0; len <= MAXBITS; len++) { + count[len] = 0; + } + for (sym = 0; sym < codes; sym++) { + count[lens[lens_index + sym]]++; + } + + /* bound code lengths, force root to be within code lengths */ + root = bits; + for (max = MAXBITS; max >= 1; max--) { + if (count[max] !== 0) { break; } + } + if (root > max) { + root = max; + } + if (max === 0) { /* no symbols to code at all */ + //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */ + //table.bits[opts.table_index] = 1; //here.bits = (var char)1; + //table.val[opts.table_index++] = 0; //here.val = (var short)0; + table[table_index++] = (1 << 24) | (64 << 16) | 0; + + + //table.op[opts.table_index] = 64; + //table.bits[opts.table_index] = 1; + //table.val[opts.table_index++] = 0; + table[table_index++] = (1 << 24) | (64 << 16) | 0; + + opts.bits = 1; + return 0; /* no symbols, but wait for decoding to report error */ + } + for (min = 1; min < max; min++) { + if (count[min] !== 0) { break; } + } + if (root < min) { + root = min; + } + + /* check for an over-subscribed or incomplete set of lengths */ + left = 1; + for (len = 1; len <= MAXBITS; len++) { + left <<= 1; + left -= count[len]; + if (left < 0) { + return -1; + } /* over-subscribed */ + } + if (left > 0 && (type === CODES || max !== 1)) { + return -1; /* incomplete set */ + } + + /* generate offsets into symbol table for each length for sorting */ + offs[1] = 0; + for (len = 1; len < MAXBITS; len++) { + offs[len + 1] = offs[len] + count[len]; + } + + /* sort symbols by length, by symbol order within each length */ + for (sym = 0; sym < codes; sym++) { + if (lens[lens_index + sym] !== 0) { + work[offs[lens[lens_index + sym]]++] = sym; + } + } + + /* + Create and fill in decoding tables. In this loop, the table being + filled is at next and has curr index bits. The code being used is huff + with length len. That code is converted to an index by dropping drop + bits off of the bottom. For codes where len is less than drop + curr, + those top drop + curr - len bits are incremented through all values to + fill the table with replicated entries. + + root is the number of index bits for the root table. When len exceeds + root, sub-tables are created pointed to by the root entry with an index + of the low root bits of huff. This is saved in low to check for when a + new sub-table should be started. drop is zero when the root table is + being filled, and drop is root when sub-tables are being filled. + + When a new sub-table is needed, it is necessary to look ahead in the + code lengths to determine what size sub-table is needed. The length + counts are used for this, and so count[] is decremented as codes are + entered in the tables. + + used keeps track of how many table entries have been allocated from the + provided *table space. It is checked for LENS and DIST tables against + the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in + the initial root table size constants. See the comments in inftrees.h + for more information. + + sym increments through all symbols, and the loop terminates when + all codes of length max, i.e. all codes, have been processed. This + routine permits incomplete codes, so another loop after this one fills + in the rest of the decoding tables with invalid code markers. + */ + + /* set up for code type */ + // poor man optimization - use if-else instead of switch, + // to avoid deopts in old v8 + if (type === CODES) { + base = extra = work; /* dummy value--not used */ + end = 19; + + } else if (type === LENS) { + base = lbase; + base_index -= 257; + extra = lext; + extra_index -= 257; + end = 256; + + } else { /* DISTS */ + base = dbase; + extra = dext; + end = -1; + } + + /* initialize opts for loop */ + huff = 0; /* starting code */ + sym = 0; /* starting code symbol */ + len = min; /* starting code length */ + next = table_index; /* current table to fill in */ + curr = root; /* current table index bits */ + drop = 0; /* current bits to drop from code for index */ + low = -1; /* trigger new sub-table when len > root */ + used = 1 << root; /* use root table entries */ + mask = used - 1; /* mask for comparing low */ + + /* check available table space */ + if ((type === LENS && used > ENOUGH_LENS) || + (type === DISTS && used > ENOUGH_DISTS)) { + return 1; + } + + /* process all codes and make table entries */ + for (;;) { + /* create table entry */ + here_bits = len - drop; + if (work[sym] < end) { + here_op = 0; + here_val = work[sym]; + } + else if (work[sym] > end) { + here_op = extra[extra_index + work[sym]]; + here_val = base[base_index + work[sym]]; + } + else { + here_op = 32 + 64; /* end of block */ + here_val = 0; + } + + /* replicate for those indices with low len bits equal to huff */ + incr = 1 << (len - drop); + fill = 1 << curr; + min = fill; /* save offset to next table */ + do { + fill -= incr; + table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0; + } while (fill !== 0); + + /* backwards increment the len-bit code huff */ + incr = 1 << (len - 1); + while (huff & incr) { + incr >>= 1; + } + if (incr !== 0) { + huff &= incr - 1; + huff += incr; + } else { + huff = 0; + } + + /* go to next symbol, update count, len */ + sym++; + if (--count[len] === 0) { + if (len === max) { break; } + len = lens[lens_index + work[sym]]; + } + + /* create new sub-table if needed */ + if (len > root && (huff & mask) !== low) { + /* if first time, transition to sub-tables */ + if (drop === 0) { + drop = root; + } + + /* increment past last table */ + next += min; /* here min is 1 << curr */ + + /* determine length of next table */ + curr = len - drop; + left = 1 << curr; + while (curr + drop < max) { + left -= count[curr + drop]; + if (left <= 0) { break; } + curr++; + left <<= 1; + } + + /* check for enough space */ + used += 1 << curr; + if ((type === LENS && used > ENOUGH_LENS) || + (type === DISTS && used > ENOUGH_DISTS)) { + return 1; + } + + /* point entry in root table to sub-table */ + low = huff & mask; + /*table.op[low] = curr; + table.bits[low] = root; + table.val[low] = next - opts.table_index;*/ + table[low] = (root << 24) | (curr << 16) | (next - table_index) |0; + } + } + + /* fill in remaining table entry if code is incomplete (guaranteed to have + at most one remaining entry, since if the code is incomplete, the + maximum code length that was allowed to get this far is one bit) */ + if (huff !== 0) { + //table.op[next + huff] = 64; /* invalid code marker */ + //table.bits[next + huff] = len - drop; + //table.val[next + huff] = 0; + table[next + huff] = ((len - drop) << 24) | (64 << 16) |0; + } + + /* set return parameters */ + //opts.table_index += used; + opts.bits = root; + return 0; +}; + +},{"../utils/common":39}],47:[function(require,module,exports){ +'use strict'; + +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + +module.exports = { + 2: 'need dictionary', /* Z_NEED_DICT 2 */ + 1: 'stream end', /* Z_STREAM_END 1 */ + 0: '', /* Z_OK 0 */ + '-1': 'file error', /* Z_ERRNO (-1) */ + '-2': 'stream error', /* Z_STREAM_ERROR (-2) */ + '-3': 'data error', /* Z_DATA_ERROR (-3) */ + '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */ + '-5': 'buffer error', /* Z_BUF_ERROR (-5) */ + '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ +}; + +},{}],48:[function(require,module,exports){ +'use strict'; + +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + +/* eslint-disable space-unary-ops */ + +var utils = require('../utils/common'); + +/* Public constants ==========================================================*/ +/* ===========================================================================*/ + + +//var Z_FILTERED = 1; +//var Z_HUFFMAN_ONLY = 2; +//var Z_RLE = 3; +var Z_FIXED = 4; +//var Z_DEFAULT_STRATEGY = 0; + +/* Possible values of the data_type field (though see inflate()) */ +var Z_BINARY = 0; +var Z_TEXT = 1; +//var Z_ASCII = 1; // = Z_TEXT +var Z_UNKNOWN = 2; + +/*============================================================================*/ + + +function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } + +// From zutil.h + +var STORED_BLOCK = 0; +var STATIC_TREES = 1; +var DYN_TREES = 2; +/* The three kinds of block type */ + +var MIN_MATCH = 3; +var MAX_MATCH = 258; +/* The minimum and maximum match lengths */ + +// From deflate.h +/* =========================================================================== + * Internal compression state. + */ + +var LENGTH_CODES = 29; +/* number of length codes, not counting the special END_BLOCK code */ + +var LITERALS = 256; +/* number of literal bytes 0..255 */ + +var L_CODES = LITERALS + 1 + LENGTH_CODES; +/* number of Literal or Length codes, including the END_BLOCK code */ + +var D_CODES = 30; +/* number of distance codes */ + +var BL_CODES = 19; +/* number of codes used to transfer the bit lengths */ + +var HEAP_SIZE = 2 * L_CODES + 1; +/* maximum heap size */ + +var MAX_BITS = 15; +/* All codes must not exceed MAX_BITS bits */ + +var Buf_size = 16; +/* size of bit buffer in bi_buf */ + + +/* =========================================================================== + * Constants + */ + +var MAX_BL_BITS = 7; +/* Bit length codes must not exceed MAX_BL_BITS bits */ + +var END_BLOCK = 256; +/* end of block literal code */ + +var REP_3_6 = 16; +/* repeat previous bit length 3-6 times (2 bits of repeat count) */ + +var REPZ_3_10 = 17; +/* repeat a zero length 3-10 times (3 bits of repeat count) */ + +var REPZ_11_138 = 18; +/* repeat a zero length 11-138 times (7 bits of repeat count) */ + +/* eslint-disable comma-spacing,array-bracket-spacing */ +var extra_lbits = /* extra bits for each length code */ + [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]; + +var extra_dbits = /* extra bits for each distance code */ + [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]; + +var extra_blbits = /* extra bits for each bit length code */ + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]; + +var bl_order = + [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]; +/* eslint-enable comma-spacing,array-bracket-spacing */ + +/* The lengths of the bit length codes are sent in order of decreasing + * probability, to avoid transmitting the lengths for unused bit length codes. + */ + +/* =========================================================================== + * Local data. These are initialized only once. + */ + +// We pre-fill arrays with 0 to avoid uninitialized gaps + +var DIST_CODE_LEN = 512; /* see definition of array dist_code below */ + +// !!!! Use flat array instead of structure, Freq = i*2, Len = i*2+1 +var static_ltree = new Array((L_CODES + 2) * 2); +zero(static_ltree); +/* The static literal tree. Since the bit lengths are imposed, there is no + * need for the L_CODES extra codes used during heap construction. However + * The codes 286 and 287 are needed to build a canonical tree (see _tr_init + * below). + */ + +var static_dtree = new Array(D_CODES * 2); +zero(static_dtree); +/* The static distance tree. (Actually a trivial tree since all codes use + * 5 bits.) + */ + +var _dist_code = new Array(DIST_CODE_LEN); +zero(_dist_code); +/* Distance codes. The first 256 values correspond to the distances + * 3 .. 258, the last 256 values correspond to the top 8 bits of + * the 15 bit distances. + */ + +var _length_code = new Array(MAX_MATCH - MIN_MATCH + 1); +zero(_length_code); +/* length code for each normalized match length (0 == MIN_MATCH) */ + +var base_length = new Array(LENGTH_CODES); +zero(base_length); +/* First normalized length for each code (0 = MIN_MATCH) */ + +var base_dist = new Array(D_CODES); +zero(base_dist); +/* First normalized distance for each code (0 = distance of 1) */ + + +function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) { + + this.static_tree = static_tree; /* static tree or NULL */ + this.extra_bits = extra_bits; /* extra bits for each code or NULL */ + this.extra_base = extra_base; /* base index for extra_bits */ + this.elems = elems; /* max number of elements in the tree */ + this.max_length = max_length; /* max bit length for the codes */ + + // show if `static_tree` has data or dummy - needed for monomorphic objects + this.has_stree = static_tree && static_tree.length; +} + + +var static_l_desc; +var static_d_desc; +var static_bl_desc; + + +function TreeDesc(dyn_tree, stat_desc) { + this.dyn_tree = dyn_tree; /* the dynamic tree */ + this.max_code = 0; /* largest code with non zero frequency */ + this.stat_desc = stat_desc; /* the corresponding static tree */ +} + + + +function d_code(dist) { + return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; +} + + +/* =========================================================================== + * Output a short LSB first on the stream. + * IN assertion: there is enough room in pendingBuf. + */ +function put_short(s, w) { +// put_byte(s, (uch)((w) & 0xff)); +// put_byte(s, (uch)((ush)(w) >> 8)); + s.pending_buf[s.pending++] = (w) & 0xff; + s.pending_buf[s.pending++] = (w >>> 8) & 0xff; +} + + +/* =========================================================================== + * Send a value on a given number of bits. + * IN assertion: length <= 16 and value fits in length bits. + */ +function send_bits(s, value, length) { + if (s.bi_valid > (Buf_size - length)) { + s.bi_buf |= (value << s.bi_valid) & 0xffff; + put_short(s, s.bi_buf); + s.bi_buf = value >> (Buf_size - s.bi_valid); + s.bi_valid += length - Buf_size; + } else { + s.bi_buf |= (value << s.bi_valid) & 0xffff; + s.bi_valid += length; + } +} + + +function send_code(s, c, tree) { + send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/); +} + + +/* =========================================================================== + * Reverse the first len bits of a code, using straightforward code (a faster + * method would use a table) + * IN assertion: 1 <= len <= 15 + */ +function bi_reverse(code, len) { + var res = 0; + do { + res |= code & 1; + code >>>= 1; + res <<= 1; + } while (--len > 0); + return res >>> 1; +} + + +/* =========================================================================== + * Flush the bit buffer, keeping at most 7 bits in it. + */ +function bi_flush(s) { + if (s.bi_valid === 16) { + put_short(s, s.bi_buf); + s.bi_buf = 0; + s.bi_valid = 0; + + } else if (s.bi_valid >= 8) { + s.pending_buf[s.pending++] = s.bi_buf & 0xff; + s.bi_buf >>= 8; + s.bi_valid -= 8; + } +} + + +/* =========================================================================== + * Compute the optimal bit lengths for a tree and update the total bit length + * for the current block. + * IN assertion: the fields freq and dad are set, heap[heap_max] and + * above are the tree nodes sorted by increasing frequency. + * OUT assertions: the field len is set to the optimal bit length, the + * array bl_count contains the frequencies for each bit length. + * The length opt_len is updated; static_len is also updated if stree is + * not null. + */ +function gen_bitlen(s, desc) +// deflate_state *s; +// tree_desc *desc; /* the tree descriptor */ +{ + var tree = desc.dyn_tree; + var max_code = desc.max_code; + var stree = desc.stat_desc.static_tree; + var has_stree = desc.stat_desc.has_stree; + var extra = desc.stat_desc.extra_bits; + var base = desc.stat_desc.extra_base; + var max_length = desc.stat_desc.max_length; + var h; /* heap index */ + var n, m; /* iterate over the tree elements */ + var bits; /* bit length */ + var xbits; /* extra bits */ + var f; /* frequency */ + var overflow = 0; /* number of elements with bit length too large */ + + for (bits = 0; bits <= MAX_BITS; bits++) { + s.bl_count[bits] = 0; + } + + /* In a first pass, compute the optimal bit lengths (which may + * overflow in the case of the bit length tree). + */ + tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */ + + for (h = s.heap_max + 1; h < HEAP_SIZE; h++) { + n = s.heap[h]; + bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1; + if (bits > max_length) { + bits = max_length; + overflow++; + } + tree[n * 2 + 1]/*.Len*/ = bits; + /* We overwrite tree[n].Dad which is no longer needed */ + + if (n > max_code) { continue; } /* not a leaf node */ + + s.bl_count[bits]++; + xbits = 0; + if (n >= base) { + xbits = extra[n - base]; + } + f = tree[n * 2]/*.Freq*/; + s.opt_len += f * (bits + xbits); + if (has_stree) { + s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits); + } + } + if (overflow === 0) { return; } + + // Trace((stderr,"\nbit length overflow\n")); + /* This happens for example on obj2 and pic of the Calgary corpus */ + + /* Find the first bit length which could increase: */ + do { + bits = max_length - 1; + while (s.bl_count[bits] === 0) { bits--; } + s.bl_count[bits]--; /* move one leaf down the tree */ + s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */ + s.bl_count[max_length]--; + /* The brother of the overflow item also moves one step up, + * but this does not affect bl_count[max_length] + */ + overflow -= 2; + } while (overflow > 0); + + /* Now recompute all bit lengths, scanning in increasing frequency. + * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all + * lengths instead of fixing only the wrong ones. This idea is taken + * from 'ar' written by Haruhiko Okumura.) + */ + for (bits = max_length; bits !== 0; bits--) { + n = s.bl_count[bits]; + while (n !== 0) { + m = s.heap[--h]; + if (m > max_code) { continue; } + if (tree[m * 2 + 1]/*.Len*/ !== bits) { + // Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); + s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/; + tree[m * 2 + 1]/*.Len*/ = bits; + } + n--; + } + } +} + + +/* =========================================================================== + * Generate the codes for a given tree and bit counts (which need not be + * optimal). + * IN assertion: the array bl_count contains the bit length statistics for + * the given tree and the field len is set for all tree elements. + * OUT assertion: the field code is set for all tree elements of non + * zero code length. + */ +function gen_codes(tree, max_code, bl_count) +// ct_data *tree; /* the tree to decorate */ +// int max_code; /* largest code with non zero frequency */ +// ushf *bl_count; /* number of codes at each bit length */ +{ + var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */ + var code = 0; /* running code value */ + var bits; /* bit index */ + var n; /* code index */ + + /* The distribution counts are first used to generate the code values + * without bit reversal. + */ + for (bits = 1; bits <= MAX_BITS; bits++) { + next_code[bits] = code = (code + bl_count[bits - 1]) << 1; + } + /* Check that the bit counts in bl_count are consistent. The last code + * must be all ones. + */ + //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */ + length = 0; + for (code = 0; code < LENGTH_CODES - 1; code++) { + base_length[code] = length; + for (n = 0; n < (1 << extra_lbits[code]); n++) { + _length_code[length++] = code; + } + } + //Assert (length == 256, "tr_static_init: length != 256"); + /* Note that the length 255 (match length 258) can be represented + * in two different ways: code 284 + 5 bits or code 285, so we + * overwrite length_code[255] to use the best encoding: + */ + _length_code[length - 1] = code; + + /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ + dist = 0; + for (code = 0; code < 16; code++) { + base_dist[code] = dist; + for (n = 0; n < (1 << extra_dbits[code]); n++) { + _dist_code[dist++] = code; + } + } + //Assert (dist == 256, "tr_static_init: dist != 256"); + dist >>= 7; /* from now on, all distances are divided by 128 */ + for (; code < D_CODES; code++) { + base_dist[code] = dist << 7; + for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) { + _dist_code[256 + dist++] = code; + } + } + //Assert (dist == 256, "tr_static_init: 256+dist != 512"); + + /* Construct the codes of the static literal tree */ + for (bits = 0; bits <= MAX_BITS; bits++) { + bl_count[bits] = 0; + } + + n = 0; + while (n <= 143) { + static_ltree[n * 2 + 1]/*.Len*/ = 8; + n++; + bl_count[8]++; + } + while (n <= 255) { + static_ltree[n * 2 + 1]/*.Len*/ = 9; + n++; + bl_count[9]++; + } + while (n <= 279) { + static_ltree[n * 2 + 1]/*.Len*/ = 7; + n++; + bl_count[7]++; + } + while (n <= 287) { + static_ltree[n * 2 + 1]/*.Len*/ = 8; + n++; + bl_count[8]++; + } + /* Codes 286 and 287 do not exist, but we must include them in the + * tree construction to get a canonical Huffman tree (longest code + * all ones) + */ + gen_codes(static_ltree, L_CODES + 1, bl_count); + + /* The static distance tree is trivial: */ + for (n = 0; n < D_CODES; n++) { + static_dtree[n * 2 + 1]/*.Len*/ = 5; + static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5); + } + + // Now data ready and we can init static trees + static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS); + static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS); + static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS); + + //static_init_done = true; +} + + +/* =========================================================================== + * Initialize a new block. + */ +function init_block(s) { + var n; /* iterates over tree elements */ + + /* Initialize the trees. */ + for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; } + for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; } + for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; } + + s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1; + s.opt_len = s.static_len = 0; + s.last_lit = s.matches = 0; +} + + +/* =========================================================================== + * Flush the bit buffer and align the output on a byte boundary + */ +function bi_windup(s) +{ + if (s.bi_valid > 8) { + put_short(s, s.bi_buf); + } else if (s.bi_valid > 0) { + //put_byte(s, (Byte)s->bi_buf); + s.pending_buf[s.pending++] = s.bi_buf; + } + s.bi_buf = 0; + s.bi_valid = 0; +} + +/* =========================================================================== + * Copy a stored block, storing first the length and its + * one's complement if requested. + */ +function copy_block(s, buf, len, header) +//DeflateState *s; +//charf *buf; /* the input data */ +//unsigned len; /* its length */ +//int header; /* true if block header must be written */ +{ + bi_windup(s); /* align on byte boundary */ + + if (header) { + put_short(s, len); + put_short(s, ~len); + } +// while (len--) { +// put_byte(s, *buf++); +// } + utils.arraySet(s.pending_buf, s.window, buf, len, s.pending); + s.pending += len; +} + +/* =========================================================================== + * Compares to subtrees, using the tree depth as tie breaker when + * the subtrees have equal frequency. This minimizes the worst case length. + */ +function smaller(tree, n, m, depth) { + var _n2 = n * 2; + var _m2 = m * 2; + return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ || + (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m])); +} + +/* =========================================================================== + * Restore the heap property by moving down the tree starting at node k, + * exchanging a node with the smallest of its two sons if necessary, stopping + * when the heap property is re-established (each father smaller than its + * two sons). + */ +function pqdownheap(s, tree, k) +// deflate_state *s; +// ct_data *tree; /* the tree to restore */ +// int k; /* node to move down */ +{ + var v = s.heap[k]; + var j = k << 1; /* left son of k */ + while (j <= s.heap_len) { + /* Set j to the smallest of the two sons: */ + if (j < s.heap_len && + smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) { + j++; + } + /* Exit if v is smaller than both sons */ + if (smaller(tree, v, s.heap[j], s.depth)) { break; } + + /* Exchange v with the smallest son */ + s.heap[k] = s.heap[j]; + k = j; + + /* And continue down the tree, setting j to the left son of k */ + j <<= 1; + } + s.heap[k] = v; +} + + +// inlined manually +// var SMALLEST = 1; + +/* =========================================================================== + * Send the block data compressed using the given Huffman trees + */ +function compress_block(s, ltree, dtree) +// deflate_state *s; +// const ct_data *ltree; /* literal tree */ +// const ct_data *dtree; /* distance tree */ +{ + var dist; /* distance of matched string */ + var lc; /* match length or unmatched char (if dist == 0) */ + var lx = 0; /* running index in l_buf */ + var code; /* the code to send */ + var extra; /* number of extra bits to send */ + + if (s.last_lit !== 0) { + do { + dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]); + lc = s.pending_buf[s.l_buf + lx]; + lx++; + + if (dist === 0) { + send_code(s, lc, ltree); /* send a literal byte */ + //Tracecv(isgraph(lc), (stderr," '%c' ", lc)); + } else { + /* Here, lc is the match length - MIN_MATCH */ + code = _length_code[lc]; + send_code(s, code + LITERALS + 1, ltree); /* send the length code */ + extra = extra_lbits[code]; + if (extra !== 0) { + lc -= base_length[code]; + send_bits(s, lc, extra); /* send the extra length bits */ + } + dist--; /* dist is now the match distance - 1 */ + code = d_code(dist); + //Assert (code < D_CODES, "bad d_code"); + + send_code(s, code, dtree); /* send the distance code */ + extra = extra_dbits[code]; + if (extra !== 0) { + dist -= base_dist[code]; + send_bits(s, dist, extra); /* send the extra distance bits */ + } + } /* literal or match pair ? */ + + /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ + //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, + // "pendingBuf overflow"); + + } while (lx < s.last_lit); + } + + send_code(s, END_BLOCK, ltree); +} + + +/* =========================================================================== + * Construct one Huffman tree and assigns the code bit strings and lengths. + * Update the total bit length for the current block. + * IN assertion: the field freq is set for all tree elements. + * OUT assertions: the fields len and code are set to the optimal bit length + * and corresponding code. The length opt_len is updated; static_len is + * also updated if stree is not null. The field max_code is set. + */ +function build_tree(s, desc) +// deflate_state *s; +// tree_desc *desc; /* the tree descriptor */ +{ + var tree = desc.dyn_tree; + var stree = desc.stat_desc.static_tree; + var has_stree = desc.stat_desc.has_stree; + var elems = desc.stat_desc.elems; + var n, m; /* iterate over heap elements */ + var max_code = -1; /* largest code with non zero frequency */ + var node; /* new node being created */ + + /* Construct the initial heap, with least frequent element in + * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. + * heap[0] is not used. + */ + s.heap_len = 0; + s.heap_max = HEAP_SIZE; + + for (n = 0; n < elems; n++) { + if (tree[n * 2]/*.Freq*/ !== 0) { + s.heap[++s.heap_len] = max_code = n; + s.depth[n] = 0; + + } else { + tree[n * 2 + 1]/*.Len*/ = 0; + } + } + + /* The pkzip format requires that at least one distance code exists, + * and that at least one bit should be sent even if there is only one + * possible code. So to avoid special checks later on we force at least + * two codes of non zero frequency. + */ + while (s.heap_len < 2) { + node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0); + tree[node * 2]/*.Freq*/ = 1; + s.depth[node] = 0; + s.opt_len--; + + if (has_stree) { + s.static_len -= stree[node * 2 + 1]/*.Len*/; + } + /* node is 0 or 1 so it does not have extra bits */ + } + desc.max_code = max_code; + + /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, + * establish sub-heaps of increasing lengths: + */ + for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); } + + /* Construct the Huffman tree by repeatedly combining the least two + * frequent nodes. + */ + node = elems; /* next internal node of the tree */ + do { + //pqremove(s, tree, n); /* n = node of least frequency */ + /*** pqremove ***/ + n = s.heap[1/*SMALLEST*/]; + s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--]; + pqdownheap(s, tree, 1/*SMALLEST*/); + /***/ + + m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */ + + s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */ + s.heap[--s.heap_max] = m; + + /* Create a new node father of n and m */ + tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/; + s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1; + tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node; + + /* and insert the new node in the heap */ + s.heap[1/*SMALLEST*/] = node++; + pqdownheap(s, tree, 1/*SMALLEST*/); + + } while (s.heap_len >= 2); + + s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/]; + + /* At this point, the fields freq and dad are set. We can now + * generate the bit lengths. + */ + gen_bitlen(s, desc); + + /* The field len is now set, we can generate the bit codes */ + gen_codes(tree, max_code, s.bl_count); +} + + +/* =========================================================================== + * Scan a literal or distance tree to determine the frequencies of the codes + * in the bit length tree. + */ +function scan_tree(s, tree, max_code) +// deflate_state *s; +// ct_data *tree; /* the tree to be scanned */ +// int max_code; /* and its largest code of non zero frequency */ +{ + var n; /* iterates over all tree elements */ + var prevlen = -1; /* last emitted length */ + var curlen; /* length of current code */ + + var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ + + var count = 0; /* repeat count of the current code */ + var max_count = 7; /* max repeat count */ + var min_count = 4; /* min repeat count */ + + if (nextlen === 0) { + max_count = 138; + min_count = 3; + } + tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */ + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; + nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; + + if (++count < max_count && curlen === nextlen) { + continue; + + } else if (count < min_count) { + s.bl_tree[curlen * 2]/*.Freq*/ += count; + + } else if (curlen !== 0) { + + if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; } + s.bl_tree[REP_3_6 * 2]/*.Freq*/++; + + } else if (count <= 10) { + s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++; + + } else { + s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++; + } + + count = 0; + prevlen = curlen; + + if (nextlen === 0) { + max_count = 138; + min_count = 3; + + } else if (curlen === nextlen) { + max_count = 6; + min_count = 3; + + } else { + max_count = 7; + min_count = 4; + } + } +} + + +/* =========================================================================== + * Send a literal or distance tree in compressed form, using the codes in + * bl_tree. + */ +function send_tree(s, tree, max_code) +// deflate_state *s; +// ct_data *tree; /* the tree to be scanned */ +// int max_code; /* and its largest code of non zero frequency */ +{ + var n; /* iterates over all tree elements */ + var prevlen = -1; /* last emitted length */ + var curlen; /* length of current code */ + + var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ + + var count = 0; /* repeat count of the current code */ + var max_count = 7; /* max repeat count */ + var min_count = 4; /* min repeat count */ + + /* tree[max_code+1].Len = -1; */ /* guard already set */ + if (nextlen === 0) { + max_count = 138; + min_count = 3; + } + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; + nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; + + if (++count < max_count && curlen === nextlen) { + continue; + + } else if (count < min_count) { + do { send_code(s, curlen, s.bl_tree); } while (--count !== 0); + + } else if (curlen !== 0) { + if (curlen !== prevlen) { + send_code(s, curlen, s.bl_tree); + count--; + } + //Assert(count >= 3 && count <= 6, " 3_6?"); + send_code(s, REP_3_6, s.bl_tree); + send_bits(s, count - 3, 2); + + } else if (count <= 10) { + send_code(s, REPZ_3_10, s.bl_tree); + send_bits(s, count - 3, 3); + + } else { + send_code(s, REPZ_11_138, s.bl_tree); + send_bits(s, count - 11, 7); + } + + count = 0; + prevlen = curlen; + if (nextlen === 0) { + max_count = 138; + min_count = 3; + + } else if (curlen === nextlen) { + max_count = 6; + min_count = 3; + + } else { + max_count = 7; + min_count = 4; + } + } +} + + +/* =========================================================================== + * Construct the Huffman tree for the bit lengths and return the index in + * bl_order of the last bit length code to send. + */ +function build_bl_tree(s) { + var max_blindex; /* index of last bit length code of non zero freq */ + + /* Determine the bit length frequencies for literal and distance trees */ + scan_tree(s, s.dyn_ltree, s.l_desc.max_code); + scan_tree(s, s.dyn_dtree, s.d_desc.max_code); + + /* Build the bit length tree: */ + build_tree(s, s.bl_desc); + /* opt_len now includes the length of the tree representations, except + * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. + */ + + /* Determine the number of bit length codes to send. The pkzip format + * requires that at least 4 bit length codes be sent. (appnote.txt says + * 3 but the actual value used is 4.) + */ + for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) { + if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) { + break; + } + } + /* Update opt_len to include the bit length tree and counts */ + s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; + //Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", + // s->opt_len, s->static_len)); + + return max_blindex; +} + + +/* =========================================================================== + * Send the header for a block using dynamic Huffman trees: the counts, the + * lengths of the bit length codes, the literal tree and the distance tree. + * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. + */ +function send_all_trees(s, lcodes, dcodes, blcodes) +// deflate_state *s; +// int lcodes, dcodes, blcodes; /* number of codes for each tree */ +{ + var rank; /* index in bl_order */ + + //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); + //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, + // "too many codes"); + //Tracev((stderr, "\nbl counts: ")); + send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */ + send_bits(s, dcodes - 1, 5); + send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */ + for (rank = 0; rank < blcodes; rank++) { + //Tracev((stderr, "\nbl code %2d ", bl_order[rank])); + send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3); + } + //Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); + + send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */ + //Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); + + send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */ + //Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); +} + + +/* =========================================================================== + * Check if the data type is TEXT or BINARY, using the following algorithm: + * - TEXT if the two conditions below are satisfied: + * a) There are no non-portable control characters belonging to the + * "black list" (0..6, 14..25, 28..31). + * b) There is at least one printable character belonging to the + * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). + * - BINARY otherwise. + * - The following partially-portable control characters form a + * "gray list" that is ignored in this detection algorithm: + * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). + * IN assertion: the fields Freq of dyn_ltree are set. + */ +function detect_data_type(s) { + /* black_mask is the bit mask of black-listed bytes + * set bits 0..6, 14..25, and 28..31 + * 0xf3ffc07f = binary 11110011111111111100000001111111 + */ + var black_mask = 0xf3ffc07f; + var n; + + /* Check for non-textual ("black-listed") bytes. */ + for (n = 0; n <= 31; n++, black_mask >>>= 1) { + if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) { + return Z_BINARY; + } + } + + /* Check for textual ("white-listed") bytes. */ + if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 || + s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) { + return Z_TEXT; + } + for (n = 32; n < LITERALS; n++) { + if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) { + return Z_TEXT; + } + } + + /* There are no "black-listed" or "white-listed" bytes: + * this stream either is empty or has tolerated ("gray-listed") bytes only. + */ + return Z_BINARY; +} + + +var static_init_done = false; + +/* =========================================================================== + * Initialize the tree data structures for a new zlib stream. + */ +function _tr_init(s) +{ + + if (!static_init_done) { + tr_static_init(); + static_init_done = true; + } + + s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); + s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); + s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); + + s.bi_buf = 0; + s.bi_valid = 0; + + /* Initialize the first block of the first file: */ + init_block(s); +} + + +/* =========================================================================== + * Send a stored block + */ +function _tr_stored_block(s, buf, stored_len, last) +//DeflateState *s; +//charf *buf; /* input block */ +//ulg stored_len; /* length of input block */ +//int last; /* one if this is the last block for a file */ +{ + send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */ + copy_block(s, buf, stored_len, true); /* with header */ +} + + +/* =========================================================================== + * Send one empty static block to give enough lookahead for inflate. + * This takes 10 bits, of which 7 may remain in the bit buffer. + */ +function _tr_align(s) { + send_bits(s, STATIC_TREES << 1, 3); + send_code(s, END_BLOCK, static_ltree); + bi_flush(s); +} + + +/* =========================================================================== + * Determine the best encoding for the current block: dynamic trees, static + * trees or store, and output the encoded block to the zip file. + */ +function _tr_flush_block(s, buf, stored_len, last) +//DeflateState *s; +//charf *buf; /* input block, or NULL if too old */ +//ulg stored_len; /* length of input block */ +//int last; /* one if this is the last block for a file */ +{ + var opt_lenb, static_lenb; /* opt_len and static_len in bytes */ + var max_blindex = 0; /* index of last bit length code of non zero freq */ + + /* Build the Huffman trees unless a stored block is forced */ + if (s.level > 0) { + + /* Check if the file is binary or text */ + if (s.strm.data_type === Z_UNKNOWN) { + s.strm.data_type = detect_data_type(s); + } + + /* Construct the literal and distance trees */ + build_tree(s, s.l_desc); + // Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, + // s->static_len)); + + build_tree(s, s.d_desc); + // Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, + // s->static_len)); + /* At this point, opt_len and static_len are the total bit lengths of + * the compressed block data, excluding the tree representations. + */ + + /* Build the bit length tree for the above two trees, and get the index + * in bl_order of the last bit length code to send. + */ + max_blindex = build_bl_tree(s); + + /* Determine the best encoding. Compute the block lengths in bytes. */ + opt_lenb = (s.opt_len + 3 + 7) >>> 3; + static_lenb = (s.static_len + 3 + 7) >>> 3; + + // Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", + // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, + // s->last_lit)); + + if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; } + + } else { + // Assert(buf != (char*)0, "lost buf"); + opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ + } + + if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) { + /* 4: two words for the lengths */ + + /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. + * Otherwise we can't have processed more than WSIZE input bytes since + * the last block flush, because compression would have been + * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to + * transform a block into a stored block. + */ + _tr_stored_block(s, buf, stored_len, last); + + } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) { + + send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3); + compress_block(s, static_ltree, static_dtree); + + } else { + send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3); + send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1); + compress_block(s, s.dyn_ltree, s.dyn_dtree); + } + // Assert (s->compressed_len == s->bits_sent, "bad compressed size"); + /* The above check is made mod 2^32, for files larger than 512 MB + * and uLong implemented on 32 bits. + */ + init_block(s); + + if (last) { + bi_windup(s); + } + // Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, + // s->compressed_len-7*last)); +} + +/* =========================================================================== + * Save the match info and tally the frequency counts. Return true if + * the current block must be flushed. + */ +function _tr_tally(s, dist, lc) +// deflate_state *s; +// unsigned dist; /* distance of matched string */ +// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ +{ + //var out_length, in_length, dcode; + + s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff; + s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff; + + s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff; + s.last_lit++; + + if (dist === 0) { + /* lc is the unmatched char */ + s.dyn_ltree[lc * 2]/*.Freq*/++; + } else { + s.matches++; + /* Here, lc is the match length - MIN_MATCH */ + dist--; /* dist = match distance - 1 */ + //Assert((ush)dist < (ush)MAX_DIST(s) && + // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && + // (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); + + s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++; + s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++; + } + +// (!) This block is disabled in zlib defaults, +// don't enable it for binary compatibility + +//#ifdef TRUNCATE_BLOCK +// /* Try to guess if it is profitable to stop the current block here */ +// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) { +// /* Compute an upper bound for the compressed length */ +// out_length = s.last_lit*8; +// in_length = s.strstart - s.block_start; +// +// for (dcode = 0; dcode < D_CODES; dcode++) { +// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]); +// } +// out_length >>>= 3; +// //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", +// // s->last_lit, in_length, out_length, +// // 100L - out_length*100L/in_length)); +// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) { +// return true; +// } +// } +//#endif + + return (s.last_lit === s.lit_bufsize - 1); + /* We avoid equality with lit_bufsize because of wraparound at 64K + * on 16 bit machines and because stored blocks are restricted to + * 64K-1 bytes. + */ +} + +exports._tr_init = _tr_init; +exports._tr_stored_block = _tr_stored_block; +exports._tr_flush_block = _tr_flush_block; +exports._tr_tally = _tr_tally; +exports._tr_align = _tr_align; + +},{"../utils/common":39}],49:[function(require,module,exports){ +'use strict'; + +// (C) 1995-2013 Jean-loup Gailly and Mark Adler +// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. + +function ZStream() { + /* next input byte */ + this.input = null; // JS specific, because we have no pointers + this.next_in = 0; + /* number of bytes available at input */ + this.avail_in = 0; + /* total number of input bytes read so far */ + this.total_in = 0; + /* next output byte should be put there */ + this.output = null; // JS specific, because we have no pointers + this.next_out = 0; + /* remaining free space at output */ + this.avail_out = 0; + /* total number of bytes output so far */ + this.total_out = 0; + /* last error message, NULL if no error */ + this.msg = ''/*Z_NULL*/; + /* not visible by applications */ + this.state = null; + /* best guess about the data type: binary or text */ + this.data_type = 2/*Z_UNKNOWN*/; + /* adler32 value of the uncompressed data */ + this.adler = 0; +} + +module.exports = ZStream; + +},{}],50:[function(require,module,exports){ +(function (process){ +'use strict'; + +if (!process.version || + process.version.indexOf('v0.') === 0 || + process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { + module.exports = nextTick; +} else { + module.exports = process.nextTick; +} + +function nextTick(fn, arg1, arg2, arg3) { + if (typeof fn !== 'function') { + throw new TypeError('"callback" argument must be a function'); + } + var len = arguments.length; + var args, i; + switch (len) { + case 0: + case 1: + return process.nextTick(fn); + case 2: + return process.nextTick(function afterTickOne() { + fn.call(null, arg1); + }); + case 3: + return process.nextTick(function afterTickTwo() { + fn.call(null, arg1, arg2); + }); + case 4: + return process.nextTick(function afterTickThree() { + fn.call(null, arg1, arg2, arg3); + }); + default: + args = new Array(len - 1); + i = 0; + while (i < args.length) { + args[i++] = arguments[i]; + } + return process.nextTick(function afterTick() { + fn.apply(null, args); + }); + } +} + +}).call(this,require('_process')) +},{"_process":51}],51:[function(require,module,exports){ +// shim for using process in browser +var process = module.exports = {}; + +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + +},{}],52:[function(require,module,exports){ +module.exports = require('./lib/_stream_duplex.js'); + +},{"./lib/_stream_duplex.js":53}],53:[function(require,module,exports){ +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + +'use strict'; + +/**/ + +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) { + keys.push(key); + }return keys; +}; +/**/ + +module.exports = Duplex; + +/**/ +var processNextTick = require('process-nextick-args'); +/**/ + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +var Readable = require('./_stream_readable'); +var Writable = require('./_stream_writable'); + +util.inherits(Duplex, Readable); + +var keys = objectKeys(Writable.prototype); +for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; +} + +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + + Readable.call(this, options); + Writable.call(this, options); + + if (options && options.readable === false) this.readable = false; + + if (options && options.writable === false) this.writable = false; + + this.allowHalfOpen = true; + if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; + + this.once('end', onend); +} + +// the no-half-open enforcer +function onend() { + // if we allow half-open state, or if the writable side ended, + // then we're ok. + if (this.allowHalfOpen || this._writableState.ended) return; + + // no more data can be written. + // But allow more writes to happen in this tick. + processNextTick(onEndNT, this); +} + +function onEndNT(self) { + self.end(); +} + +function forEach(xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } +} +},{"./_stream_readable":55,"./_stream_writable":57,"core-util-is":33,"inherits":36,"process-nextick-args":50}],54:[function(require,module,exports){ +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + +'use strict'; + +module.exports = PassThrough; + +var Transform = require('./_stream_transform'); + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +util.inherits(PassThrough, Transform); + +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options); + + Transform.call(this, options); +} + +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk); +}; +},{"./_stream_transform":56,"core-util-is":33,"inherits":36}],55:[function(require,module,exports){ +(function (process){ +'use strict'; + +module.exports = Readable; + +/**/ +var processNextTick = require('process-nextick-args'); +/**/ + +/**/ +var isArray = require('isarray'); +/**/ + +/**/ +var Duplex; +/**/ + +Readable.ReadableState = ReadableState; + +/**/ +var EE = require('events').EventEmitter; + +var EElistenerCount = function (emitter, type) { + return emitter.listeners(type).length; +}; +/**/ + +/**/ +var Stream = require('./internal/streams/stream'); +/**/ + +var Buffer = require('buffer').Buffer; +/**/ +var bufferShim = require('buffer-shims'); +/**/ + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +/**/ +var debugUtil = require('util'); +var debug = void 0; +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function () {}; +} +/**/ + +var BufferList = require('./internal/streams/BufferList'); +var StringDecoder; + +util.inherits(Readable, Stream); + +var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; + +function prependListener(emitter, event, fn) { + // Sadly this is not cacheable as some libraries bundle their own + // event emitter implementation with them. + if (typeof emitter.prependListener === 'function') { + return emitter.prependListener(event, fn); + } else { + // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; + } +} + +function ReadableState(options, stream) { + Duplex = Duplex || require('./_stream_duplex'); + + options = options || {}; + + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; + + if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode; + + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + var hwm = options.highWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; + + // cast to ints. + this.highWaterMark = ~~this.highWaterMark; + + // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // when piping, we only care about 'readable' events that happen + // after read()ing all the bytes and not getting any pushback. + this.ranOut = false; + + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + + // if true, a maybeReadMore has been scheduled + this.readingMore = false; + + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} + +function Readable(options) { + Duplex = Duplex || require('./_stream_duplex'); + + if (!(this instanceof Readable)) return new Readable(options); + + this._readableState = new ReadableState(options, this); + + // legacy + this.readable = true; + + if (options && typeof options.read === 'function') this._read = options.read; + + Stream.call(this); +} + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function (chunk, encoding) { + var state = this._readableState; + + if (!state.objectMode && typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = bufferShim.from(chunk, encoding); + encoding = ''; + } + } + + return readableAddChunk(this, state, chunk, encoding, false); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function (chunk) { + var state = this._readableState; + return readableAddChunk(this, state, chunk, '', true); +}; + +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; + +function readableAddChunk(stream, state, chunk, encoding, addToFront) { + var er = chunkInvalid(state, chunk); + if (er) { + stream.emit('error', er); + } else if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (state.ended && !addToFront) { + var e = new Error('stream.push() after EOF'); + stream.emit('error', e); + } else if (state.endEmitted && addToFront) { + var _e = new Error('stream.unshift() after end event'); + stream.emit('error', _e); + } else { + var skipAdd; + if (state.decoder && !addToFront && !encoding) { + chunk = state.decoder.write(chunk); + skipAdd = !state.objectMode && chunk.length === 0; + } + + if (!addToFront) state.reading = false; + + // Don't add to the buffer if we've decoded to an empty string chunk and + // we're not in object mode + if (!skipAdd) { + // if we want the data now, just emit it. + if (state.flowing && state.length === 0 && !state.sync) { + stream.emit('data', chunk); + stream.read(0); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + + if (state.needReadable) emitReadable(stream); + } + } + + maybeReadMore(stream, state); + } + } else if (!addToFront) { + state.reading = false; + } + + return needMoreData(state); +} + +// if it's past the high water mark, we can push in some more. +// Also, if we have no data yet, we can stand some +// more bytes. This is to work around cases where hwm=0, +// such as the repl. Also, if the push() triggered a +// readable event, and the user called read(largeNumber) such that +// needReadable was set, then we ought to push more, so that another +// 'readable' event will be triggered. +function needMoreData(state) { + return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); +} + +// backwards compatibility. +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; + this._readableState.decoder = new StringDecoder(enc); + this._readableState.encoding = enc; + return this; +}; + +// Don't raise the hwm > 8MB +var MAX_HWM = 0x800000; +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + n = MAX_HWM; + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } + return n; +} + +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) return 0; + if (state.objectMode) return 1; + if (n !== n) { + // Only flow one buffer at a time + if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; + } + // If we're asking for more than the current hwm, then raise the hwm. + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) return n; + // Don't have enough + if (!state.ended) { + state.needReadable = true; + return 0; + } + return state.length; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function (n) { + debug('read', n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + + if (n !== 0) state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); + return null; + } + + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this); + return null; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + debug('need readable', doRead); + + // if we currently have less than the highWaterMark, then also read some + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } else if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (!state.reading) n = howMuchToRead(nOrig, state); + } + + var ret; + if (n > 0) ret = fromList(n, state);else ret = null; + + if (ret === null) { + state.needReadable = true; + n = 0; + } else { + state.length -= n; + } + + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true; + + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended) endReadable(this); + } + + if (ret !== null) this.emit('data', ret); + + return ret; +}; + +function chunkInvalid(state, chunk) { + var er = null; + if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + return er; +} + +function onEofChunk(stream, state) { + if (state.ended) return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + + // emit 'readable' now to make sure it gets picked up. + emitReadable(stream); +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + state.needReadable = false; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream); + } +} + +function emitReadable_(stream) { + debug('emit readable'); + stream.emit('readable'); + flow(stream); +} + +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + processNextTick(maybeReadMore_, stream, state); + } +} + +function maybeReadMore_(stream, state) { + var len = state.length; + while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break;else len = state.length; + } + state.readingMore = false; +} + +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function (n) { + this.emit('error', new Error('_read() is not implemented')); +}; + +Readable.prototype.pipe = function (dest, pipeOpts) { + var src = this; + var state = this._readableState; + + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + + var endFn = doEnd ? onend : cleanup; + if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn); + + dest.on('unpipe', onunpipe); + function onunpipe(readable) { + debug('onunpipe'); + if (readable === src) { + cleanup(); + } + } + + function onend() { + debug('onend'); + dest.end(); + } + + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + + var cleanedUp = false; + function cleanup() { + debug('cleanup'); + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', cleanup); + src.removeListener('data', ondata); + + cleanedUp = true; + + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); + } + + // If the user pushes more data while we're writing to dest then we'll end up + // in ondata again. However, we only want to increase awaitDrain once because + // dest will only emit one 'drain' event for the multiple writes. + // => Introduce a guard on increasing awaitDrain. + var increasedAwaitDrain = false; + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + increasedAwaitDrain = false; + var ret = dest.write(chunk); + if (false === ret && !increasedAwaitDrain) { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug('false write response, pause', src._readableState.awaitDrain); + src._readableState.awaitDrain++; + increasedAwaitDrain = true; + } + src.pause(); + } + } + + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); + } + + // Make sure our error handler is attached before userland ones. + prependListener(dest, 'error', onerror); + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } + + // tell the dest that it's being piped to + dest.emit('pipe', src); + + // start the flow if it hasn't been started already. + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } + + return dest; +}; + +function pipeOnDrain(src) { + return function () { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { + state.flowing = true; + flow(src); + } + }; +} + +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) return this; + + if (!dest) dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this); + return this; + } + + // slow case. multiple pipe destinations. + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + + for (var i = 0; i < len; i++) { + dests[i].emit('unpipe', this); + }return this; + } + + // try to find the right one. + var index = indexOf(state.pipes, dest); + if (index === -1) return this; + + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; + + dest.emit('unpipe', this); + + return this; +}; + +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function (ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + + if (ev === 'data') { + // Start flowing on next tick if stream isn't explicitly paused + if (this._readableState.flowing !== false) this.resume(); + } else if (ev === 'readable') { + var state = this._readableState; + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.emittedReadable = false; + if (!state.reading) { + processNextTick(nReadingNextTick, this); + } else if (state.length) { + emitReadable(this, state); + } + } + } + + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; + +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.read(0); +} + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function () { + var state = this._readableState; + if (!state.flowing) { + debug('resume'); + state.flowing = true; + resume(this, state); + } + return this; +}; + +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + processNextTick(resume_, stream, state); + } +} + +function resume_(stream, state) { + if (!state.reading) { + debug('resume read 0'); + stream.read(0); + } + + state.resumeScheduled = false; + state.awaitDrain = 0; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) stream.read(0); +} + +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing); + if (false !== this._readableState.flowing) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + return this; +}; + +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); + while (state.flowing && stream.read() !== null) {} +} + +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function (stream) { + var state = this._readableState; + var paused = false; + + var self = this; + stream.on('end', function () { + debug('wrapped end'); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) self.push(chunk); + } + + self.push(null); + }); + + stream.on('data', function (chunk) { + debug('wrapped data'); + if (state.decoder) chunk = state.decoder.write(chunk); + + // don't skip over falsy values in objectMode + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; + + var ret = self.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function (method) { + return function () { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } + + // proxy certain important events. + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], self.emit.bind(self, kProxyEvents[n])); + } + + // when we try to consume some more bytes, simply unpause the + // underlying stream. + self._read = function (n) { + debug('wrapped _read', n); + if (paused) { + paused = false; + stream.resume(); + } + }; + + return self; +}; + +// exposed for testing purposes only. +Readable._fromList = fromList; + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromList(n, state) { + // nothing buffered + if (state.length === 0) return null; + + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = fromListPartial(n, state.buffer, state.decoder); + } + + return ret; +} + +// Extracts only enough buffered data to satisfy the amount requested. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromListPartial(n, list, hasStrings) { + var ret; + if (n < list.head.data.length) { + // slice is the same for buffers and strings + ret = list.head.data.slice(0, n); + list.head.data = list.head.data.slice(n); + } else if (n === list.head.data.length) { + // first chunk is a perfect match + ret = list.shift(); + } else { + // result spans more than one buffer + ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); + } + return ret; +} + +// Copies a specified amount of characters from the list of buffered data +// chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBufferString(n, list) { + var p = list.head; + var c = 1; + var ret = p.data; + n -= ret.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) ret += str;else ret += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) list.head = p.next;else list.head = list.tail = null; + } else { + list.head = p; + p.data = str.slice(nb); + } + break; + } + ++c; + } + list.length -= c; + return ret; +} + +// Copies a specified amount of bytes from the list of buffered data chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBuffer(n, list) { + var ret = bufferShim.allocUnsafe(n); + var p = list.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret, ret.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) list.head = p.next;else list.head = list.tail = null; + } else { + list.head = p; + p.data = buf.slice(nb); + } + break; + } + ++c; + } + list.length -= c; + return ret; +} + +function endReadable(stream) { + var state = stream._readableState; + + // If we get here before consuming all the bytes, then that is a + // bug in node. Should never happen. + if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); + + if (!state.endEmitted) { + state.ended = true; + processNextTick(endReadableNT, state, stream); + } +} + +function endReadableNT(state, stream) { + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + } +} + +function forEach(xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } +} + +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} +}).call(this,require('_process')) +},{"./_stream_duplex":53,"./internal/streams/BufferList":58,"./internal/streams/stream":59,"_process":51,"buffer":32,"buffer-shims":31,"core-util-is":33,"events":34,"inherits":36,"isarray":38,"process-nextick-args":50,"string_decoder/":65,"util":28}],56:[function(require,module,exports){ +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + +'use strict'; + +module.exports = Transform; + +var Duplex = require('./_stream_duplex'); + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +util.inherits(Transform, Duplex); + +function TransformState(stream) { + this.afterTransform = function (er, data) { + return afterTransform(stream, er, data); + }; + + this.needTransform = false; + this.transforming = false; + this.writecb = null; + this.writechunk = null; + this.writeencoding = null; +} + +function afterTransform(stream, er, data) { + var ts = stream._transformState; + ts.transforming = false; + + var cb = ts.writecb; + + if (!cb) return stream.emit('error', new Error('no writecb in Transform class')); + + ts.writechunk = null; + ts.writecb = null; + + if (data !== null && data !== undefined) stream.push(data); + + cb(er); + + var rs = stream._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + stream._read(rs.highWaterMark); + } +} + +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + + Duplex.call(this, options); + + this._transformState = new TransformState(this); + + var stream = this; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform; + + if (typeof options.flush === 'function') this._flush = options.flush; + } + + // When the writable side finishes, then flush out anything remaining. + this.once('prefinish', function () { + if (typeof this._flush === 'function') this._flush(function (er, data) { + done(stream, er, data); + });else done(stream); + }); +} + +Transform.prototype.push = function (chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function (chunk, encoding, cb) { + throw new Error('_transform() is not implemented'); +}; + +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function (n) { + var ts = this._transformState; + + if (ts.writechunk !== null && ts.writecb && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; + +function done(stream, er, data) { + if (er) return stream.emit('error', er); + + if (data !== null && data !== undefined) stream.push(data); + + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + var ws = stream._writableState; + var ts = stream._transformState; + + if (ws.length) throw new Error('Calling transform done when ws.length != 0'); + + if (ts.transforming) throw new Error('Calling transform done when still transforming'); + + return stream.push(null); +} +},{"./_stream_duplex":53,"core-util-is":33,"inherits":36}],57:[function(require,module,exports){ +(function (process,setImmediate){ +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. + +'use strict'; + +module.exports = Writable; + +/**/ +var processNextTick = require('process-nextick-args'); +/**/ + +/**/ +var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick; +/**/ + +/**/ +var Duplex; +/**/ + +Writable.WritableState = WritableState; + +/**/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/**/ + +/**/ +var internalUtil = { + deprecate: require('util-deprecate') +}; +/**/ + +/**/ +var Stream = require('./internal/streams/stream'); +/**/ + +var Buffer = require('buffer').Buffer; +/**/ +var bufferShim = require('buffer-shims'); +/**/ + +util.inherits(Writable, Stream); + +function nop() {} + +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} + +function WritableState(options, stream) { + Duplex = Duplex || require('./_stream_duplex'); + + options = options || {}; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + + if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + var hwm = options.highWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; + + // cast to ints. + this.highWaterMark = ~~this.highWaterMark; + + // drain event flag. + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // when true all writes will be buffered until .uncork() call + this.corked = 0; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function (er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + + this.bufferedRequest = null; + this.lastBufferedRequest = null; + + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; + + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; + + // count buffered requests + this.bufferedRequestCount = 0; + + // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two + this.corkedRequestsFree = new CorkedRequest(this); +} + +WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; + } + return out; +}; + +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function () { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.') + }); + } catch (_) {} +})(); + +// Test _writableState for inheritance to account for Duplex streams, +// whose prototype chain only points to Readable. +var realHasInstance; +if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function (object) { + if (realHasInstance.call(this, object)) return true; + + return object && object._writableState instanceof WritableState; + } + }); +} else { + realHasInstance = function (object) { + return object instanceof this; + }; +} + +function Writable(options) { + Duplex = Duplex || require('./_stream_duplex'); + + // Writable ctor is applied to Duplexes, too. + // `realHasInstance` is necessary because using plain `instanceof` + // would return false, as no `_writableState` property is attached. + + // Trying to use the custom `instanceof` for Writable here will also break the + // Node.js LazyTransform implementation, which has a non-trivial getter for + // `_writableState` that would lead to infinite recursion. + if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) { + return new Writable(options); + } + + this._writableState = new WritableState(options, this); + + // legacy. + this.writable = true; + + if (options) { + if (typeof options.write === 'function') this._write = options.write; + + if (typeof options.writev === 'function') this._writev = options.writev; + } + + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function () { + this.emit('error', new Error('Cannot pipe, not readable')); +}; + +function writeAfterEnd(stream, cb) { + var er = new Error('write after end'); + // TODO: defer error events consistently everywhere, not just the cb + stream.emit('error', er); + processNextTick(cb, er); +} + +// Checks that a user-supplied chunk is valid, especially for the particular +// mode the stream is in. Currently this means that `null` is never accepted +// and undefined/non-string values are only allowed in object mode. +function validChunk(stream, state, chunk, cb) { + var valid = true; + var er = false; + + if (chunk === null) { + er = new TypeError('May not write null values to stream'); + } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + if (er) { + stream.emit('error', er); + processNextTick(cb, er); + valid = false; + } + return valid; +} + +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + var isBuf = Buffer.isBuffer(chunk); + + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + + if (typeof cb !== 'function') cb = nop; + + if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + } + + return ret; +}; + +Writable.prototype.cork = function () { + var state = this._writableState; + + state.corked++; +}; + +Writable.prototype.uncork = function () { + var state = this._writableState; + + if (state.corked) { + state.corked--; + + if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; + +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; + +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = bufferShim.from(chunk, encoding); + } + return chunk; +} + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + chunk = decodeChunk(state, chunk, encoding); + if (Buffer.isBuffer(chunk)) encoding = 'buffer'; + } + var len = state.objectMode ? 1 : chunk.length; + + state.length += len; + + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) state.needDrain = true; + + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = new WriteReq(chunk, encoding, cb); + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } + + return ret; +} + +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} + +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + if (sync) processNextTick(cb, er);else cb(er); + + stream._writableState.errorEmitted = true; + stream.emit('error', er); +} + +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} + +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + + onwriteStateUpdate(state); + + if (er) onwriteError(stream, state, sync, er, cb);else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state); + + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + + if (sync) { + /**/ + asyncWrite(afterWrite, stream, state, finished, cb); + /**/ + } else { + afterWrite(stream, state, finished, cb); + } + } +} + +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + + var count = 0; + while (entry) { + buffer[count] = entry; + entry = entry.next; + count += 1; + } + + doWrite(stream, state, true, state.length, buffer, '', holder.finish); + + // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + break; + } + } + + if (entry === null) state.lastBufferedRequest = null; + } + + state.bufferedRequestCount = 0; + state.bufferedRequest = entry; + state.bufferProcessing = false; +} + +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new Error('_write() is not implemented')); +}; + +Writable.prototype._writev = null; + +Writable.prototype.end = function (chunk, encoding, cb) { + var state = this._writableState; + + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); + + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } + + // ignore unnecessary end() calls. + if (!state.ending && !state.finished) endWritable(this, state, cb); +}; + +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} + +function prefinish(stream, state) { + if (!state.prefinished) { + state.prefinished = true; + stream.emit('prefinish'); + } +} + +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + if (state.pendingcb === 0) { + prefinish(stream, state); + state.finished = true; + stream.emit('finish'); + } else { + prefinish(stream, state); + } + } + return need; +} + +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) processNextTick(cb);else stream.once('finish', cb); + } + state.ended = true; + stream.writable = false; +} + +// It seems a linked list but it is not +// there will be only 2 of these for each stream +function CorkedRequest(state) { + var _this = this; + + this.next = null; + this.entry = null; + this.finish = function (err) { + var entry = _this.entry; + _this.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } + if (state.corkedRequestsFree) { + state.corkedRequestsFree.next = _this; + } else { + state.corkedRequestsFree = _this; + } + }; +} +}).call(this,require('_process'),require("timers").setImmediate) +},{"./_stream_duplex":53,"./internal/streams/stream":59,"_process":51,"buffer":32,"buffer-shims":31,"core-util-is":33,"inherits":36,"process-nextick-args":50,"timers":66,"util-deprecate":67}],58:[function(require,module,exports){ +'use strict'; + +var Buffer = require('buffer').Buffer; +/**/ +var bufferShim = require('buffer-shims'); +/**/ + +module.exports = BufferList; + +function BufferList() { + this.head = null; + this.tail = null; + this.length = 0; +} + +BufferList.prototype.push = function (v) { + var entry = { data: v, next: null }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; +}; + +BufferList.prototype.unshift = function (v) { + var entry = { data: v, next: this.head }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; +}; + +BufferList.prototype.shift = function () { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; +}; + +BufferList.prototype.clear = function () { + this.head = this.tail = null; + this.length = 0; +}; + +BufferList.prototype.join = function (s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + while (p = p.next) { + ret += s + p.data; + }return ret; +}; + +BufferList.prototype.concat = function (n) { + if (this.length === 0) return bufferShim.alloc(0); + if (this.length === 1) return this.head.data; + var ret = bufferShim.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + p.data.copy(ret, i); + i += p.data.length; + p = p.next; + } + return ret; +}; +},{"buffer":32,"buffer-shims":31}],59:[function(require,module,exports){ +module.exports = require('events').EventEmitter; + +},{"events":34}],60:[function(require,module,exports){ +module.exports = require('./readable').PassThrough + +},{"./readable":61}],61:[function(require,module,exports){ +exports = module.exports = require('./lib/_stream_readable.js'); +exports.Stream = exports; +exports.Readable = exports; +exports.Writable = require('./lib/_stream_writable.js'); +exports.Duplex = require('./lib/_stream_duplex.js'); +exports.Transform = require('./lib/_stream_transform.js'); +exports.PassThrough = require('./lib/_stream_passthrough.js'); + +},{"./lib/_stream_duplex.js":53,"./lib/_stream_passthrough.js":54,"./lib/_stream_readable.js":55,"./lib/_stream_transform.js":56,"./lib/_stream_writable.js":57}],62:[function(require,module,exports){ +module.exports = require('./readable').Transform + +},{"./readable":61}],63:[function(require,module,exports){ +module.exports = require('./lib/_stream_writable.js'); + +},{"./lib/_stream_writable.js":57}],64:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +module.exports = Stream; + +var EE = require('events').EventEmitter; +var inherits = require('inherits'); + +inherits(Stream, EE); +Stream.Readable = require('readable-stream/readable.js'); +Stream.Writable = require('readable-stream/writable.js'); +Stream.Duplex = require('readable-stream/duplex.js'); +Stream.Transform = require('readable-stream/transform.js'); +Stream.PassThrough = require('readable-stream/passthrough.js'); + +// Backwards-compat with node 0.4.x +Stream.Stream = Stream; + + + +// old-style streams. Note that the pipe method (the only relevant +// part of this class) is overridden in the Readable class. + +function Stream() { + EE.call(this); +} + +Stream.prototype.pipe = function(dest, options) { + var source = this; + + function ondata(chunk) { + if (dest.writable) { + if (false === dest.write(chunk) && source.pause) { + source.pause(); + } + } + } + + source.on('data', ondata); + + function ondrain() { + if (source.readable && source.resume) { + source.resume(); + } + } + + dest.on('drain', ondrain); + + // If the 'end' option is not supplied, dest.end() will be called when + // source gets the 'end' or 'close' events. Only dest.end() once. + if (!dest._isStdio && (!options || options.end !== false)) { + source.on('end', onend); + source.on('close', onclose); + } + + var didOnEnd = false; + function onend() { + if (didOnEnd) return; + didOnEnd = true; + + dest.end(); + } + + + function onclose() { + if (didOnEnd) return; + didOnEnd = true; + + if (typeof dest.destroy === 'function') dest.destroy(); + } + + // don't leave dangling pipes when there are errors. + function onerror(er) { + cleanup(); + if (EE.listenerCount(this, 'error') === 0) { + throw er; // Unhandled stream error in pipe. + } + } + + source.on('error', onerror); + dest.on('error', onerror); + + // remove all the event listeners that were added. + function cleanup() { + source.removeListener('data', ondata); + dest.removeListener('drain', ondrain); + + source.removeListener('end', onend); + source.removeListener('close', onclose); + + source.removeListener('error', onerror); + dest.removeListener('error', onerror); + + source.removeListener('end', cleanup); + source.removeListener('close', cleanup); + + dest.removeListener('close', cleanup); + } + + source.on('end', cleanup); + source.on('close', cleanup); + + dest.on('close', cleanup); + + dest.emit('pipe', source); + + // Allow for unix-like usage: A.pipe(B).pipe(C) + return dest; +}; + +},{"events":34,"inherits":36,"readable-stream/duplex.js":52,"readable-stream/passthrough.js":60,"readable-stream/readable.js":61,"readable-stream/transform.js":62,"readable-stream/writable.js":63}],65:[function(require,module,exports){ +'use strict'; + +var Buffer = require('buffer').Buffer; +var bufferShim = require('buffer-shims'); + +var isEncoding = Buffer.isEncoding || function (encoding) { + encoding = '' + encoding; + switch (encoding && encoding.toLowerCase()) { + case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': + return true; + default: + return false; + } +}; + +function _normalizeEncoding(enc) { + if (!enc) return 'utf8'; + var retried; + while (true) { + switch (enc) { + case 'utf8': + case 'utf-8': + return 'utf8'; + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return 'utf16le'; + case 'latin1': + case 'binary': + return 'latin1'; + case 'base64': + case 'ascii': + case 'hex': + return enc; + default: + if (retried) return; // undefined + enc = ('' + enc).toLowerCase(); + retried = true; + } + } +}; + +// Do not cache `Buffer.isEncoding` when checking encoding names as some +// modules monkey-patch it to support additional encodings +function normalizeEncoding(enc) { + var nenc = _normalizeEncoding(enc); + if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); + return nenc || enc; +} + +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. +exports.StringDecoder = StringDecoder; +function StringDecoder(encoding) { + this.encoding = normalizeEncoding(encoding); + var nb; + switch (this.encoding) { + case 'utf16le': + this.text = utf16Text; + this.end = utf16End; + nb = 4; + break; + case 'utf8': + this.fillLast = utf8FillLast; + nb = 4; + break; + case 'base64': + this.text = base64Text; + this.end = base64End; + nb = 3; + break; + default: + this.write = simpleWrite; + this.end = simpleEnd; + return; + } + this.lastNeed = 0; + this.lastTotal = 0; + this.lastChar = bufferShim.allocUnsafe(nb); +} + +StringDecoder.prototype.write = function (buf) { + if (buf.length === 0) return ''; + var r; + var i; + if (this.lastNeed) { + r = this.fillLast(buf); + if (r === undefined) return ''; + i = this.lastNeed; + this.lastNeed = 0; + } else { + i = 0; + } + if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); + return r || ''; +}; + +StringDecoder.prototype.end = utf8End; + +// Returns only complete characters in a Buffer +StringDecoder.prototype.text = utf8Text; + +// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer +StringDecoder.prototype.fillLast = function (buf) { + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); + this.lastNeed -= buf.length; +}; + +// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a +// continuation byte. +function utf8CheckByte(byte) { + if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; + return -1; +} + +// Checks at most 3 bytes at the end of a Buffer in order to detect an +// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) +// needed to complete the UTF-8 character (if applicable) are returned. +function utf8CheckIncomplete(self, buf, i) { + var j = buf.length - 1; + if (j < i) return 0; + var nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 1; + return nb; + } + if (--j < i) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 2; + return nb; + } + if (--j < i) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) { + if (nb === 2) nb = 0;else self.lastNeed = nb - 3; + } + return nb; + } + return 0; +} + +// Validates as many continuation bytes for a multi-byte UTF-8 character as +// needed or are available. If we see a non-continuation byte where we expect +// one, we "replace" the validated continuation bytes we've seen so far with +// UTF-8 replacement characters ('\ufffd'), to match v8's UTF-8 decoding +// behavior. The continuation byte check is included three times in the case +// where all of the continuation bytes for a character exist in the same buffer. +// It is also done this way as a slight performance increase instead of using a +// loop. +function utf8CheckExtraBytes(self, buf, p) { + if ((buf[0] & 0xC0) !== 0x80) { + self.lastNeed = 0; + return '\ufffd'.repeat(p); + } + if (self.lastNeed > 1 && buf.length > 1) { + if ((buf[1] & 0xC0) !== 0x80) { + self.lastNeed = 1; + return '\ufffd'.repeat(p + 1); + } + if (self.lastNeed > 2 && buf.length > 2) { + if ((buf[2] & 0xC0) !== 0x80) { + self.lastNeed = 2; + return '\ufffd'.repeat(p + 2); + } + } + } +} + +// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. +function utf8FillLast(buf) { + var p = this.lastTotal - this.lastNeed; + var r = utf8CheckExtraBytes(this, buf, p); + if (r !== undefined) return r; + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, p, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, p, 0, buf.length); + this.lastNeed -= buf.length; +} + +// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a +// partial character, the character's bytes are buffered until the required +// number of bytes are available. +function utf8Text(buf, i) { + var total = utf8CheckIncomplete(this, buf, i); + if (!this.lastNeed) return buf.toString('utf8', i); + this.lastTotal = total; + var end = buf.length - (total - this.lastNeed); + buf.copy(this.lastChar, 0, end); + return buf.toString('utf8', i, end); +} + +// For UTF-8, a replacement character for each buffered byte of a (partial) +// character needs to be added to the output. +function utf8End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + '\ufffd'.repeat(this.lastTotal - this.lastNeed); + return r; +} + +// UTF-16LE typically needs two bytes per character, but even if we have an even +// number of bytes available, we need to check if we end on a leading/high +// surrogate. In that case, we need to wait for the next two bytes in order to +// decode the last character properly. +function utf16Text(buf, i) { + if ((buf.length - i) % 2 === 0) { + var r = buf.toString('utf16le', i); + if (r) { + var c = r.charCodeAt(r.length - 1); + if (c >= 0xD800 && c <= 0xDBFF) { + this.lastNeed = 2; + this.lastTotal = 4; + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + return r.slice(0, -1); + } + } + return r; + } + this.lastNeed = 1; + this.lastTotal = 2; + this.lastChar[0] = buf[buf.length - 1]; + return buf.toString('utf16le', i, buf.length - 1); +} + +// For UTF-16LE we do not explicitly append special replacement characters if we +// end on a partial character, we simply let v8 handle that. +function utf16End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) { + var end = this.lastTotal - this.lastNeed; + return r + this.lastChar.toString('utf16le', 0, end); + } + return r; +} + +function base64Text(buf, i) { + var n = (buf.length - i) % 3; + if (n === 0) return buf.toString('base64', i); + this.lastNeed = 3 - n; + this.lastTotal = 3; + if (n === 1) { + this.lastChar[0] = buf[buf.length - 1]; + } else { + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + } + return buf.toString('base64', i, buf.length - n); +} + +function base64End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); + return r; +} + +// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) +function simpleWrite(buf) { + return buf.toString(this.encoding); +} + +function simpleEnd(buf) { + return buf && buf.length ? this.write(buf) : ''; +} +},{"buffer":32,"buffer-shims":31}],66:[function(require,module,exports){ +(function (setImmediate,clearImmediate){ +var nextTick = require('process/browser.js').nextTick; +var apply = Function.prototype.apply; +var slice = Array.prototype.slice; +var immediateIds = {}; +var nextImmediateId = 0; + +// DOM APIs, for completeness + +exports.setTimeout = function() { + return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); +}; +exports.setInterval = function() { + return new Timeout(apply.call(setInterval, window, arguments), clearInterval); +}; +exports.clearTimeout = +exports.clearInterval = function(timeout) { timeout.close(); }; + +function Timeout(id, clearFn) { + this._id = id; + this._clearFn = clearFn; +} +Timeout.prototype.unref = Timeout.prototype.ref = function() {}; +Timeout.prototype.close = function() { + this._clearFn.call(window, this._id); +}; + +// Does not start the time, just sets up the members needed. +exports.enroll = function(item, msecs) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = msecs; +}; + +exports.unenroll = function(item) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = -1; +}; + +exports._unrefActive = exports.active = function(item) { + clearTimeout(item._idleTimeoutId); + + var msecs = item._idleTimeout; + if (msecs >= 0) { + item._idleTimeoutId = setTimeout(function onTimeout() { + if (item._onTimeout) + item._onTimeout(); + }, msecs); + } +}; + +// That's not how node.js implements it but the exposed api is the same. +exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) { + var id = nextImmediateId++; + var args = arguments.length < 2 ? false : slice.call(arguments, 1); + + immediateIds[id] = true; + + nextTick(function onNextTick() { + if (immediateIds[id]) { + // fn.call() is faster so we optimize for the common use-case + // @see http://jsperf.com/call-apply-segu + if (args) { + fn.apply(null, args); + } else { + fn.call(null); + } + // Prevent ids from leaking + exports.clearImmediate(id); + } + }); + + return id; +}; + +exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { + delete immediateIds[id]; +}; +}).call(this,require("timers").setImmediate,require("timers").clearImmediate) +},{"process/browser.js":51,"timers":66}],67:[function(require,module,exports){ +(function (global){ + +/** + * Module exports. + */ + +module.exports = deprecate; + +/** + * Mark that a method should not be used. + * Returns a modified function which warns once by default. + * + * If `localStorage.noDeprecation = true` is set, then it is a no-op. + * + * If `localStorage.throwDeprecation = true` is set, then deprecated functions + * will throw an Error when invoked. + * + * If `localStorage.traceDeprecation = true` is set, then deprecated functions + * will invoke `console.trace()` instead of `console.error()`. + * + * @param {Function} fn - the function to deprecate + * @param {String} msg - the string to print to the console when `fn` is invoked + * @returns {Function} a new "deprecated" version of `fn` + * @api public + */ + +function deprecate (fn, msg) { + if (config('noDeprecation')) { + return fn; + } + + var warned = false; + function deprecated() { + if (!warned) { + if (config('throwDeprecation')) { + throw new Error(msg); + } else if (config('traceDeprecation')) { + console.trace(msg); + } else { + console.warn(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; +} + +/** + * Checks `localStorage` for boolean values for the given `name`. + * + * @param {String} name + * @returns {Boolean} + * @api private + */ + +function config (name) { + // accessing global.localStorage can trigger a DOMException in sandboxed iframes + try { + if (!global.localStorage) return false; + } catch (_) { + return false; + } + var val = global.localStorage[name]; + if (null == val) return false; + return String(val).toLowerCase() === 'true'; +} + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],68:[function(require,module,exports){ +arguments[4][25][0].apply(exports,arguments) +},{"dup":25}],69:[function(require,module,exports){ +arguments[4][26][0].apply(exports,arguments) +},{"./support/isBuffer":68,"_process":51,"dup":26,"inherits":36}]},{},[20])(20) +}); diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/bitmapper.js b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/bitmapper.js new file mode 100644 index 00000000..e84111f0 --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/bitmapper.js @@ -0,0 +1,256 @@ +'use strict'; + +var interlaceUtils = require('./interlace'); + +var pixelBppMapper = [ + // 0 - dummy entry + function() {}, + + // 1 - L + // 0: 0, 1: 0, 2: 0, 3: 0xff + function(pxData, data, pxPos, rawPos) { + if (rawPos === data.length) { + throw new Error('Ran out of data'); + } + + var pixel = data[rawPos]; + pxData[pxPos] = pixel; + pxData[pxPos + 1] = pixel; + pxData[pxPos + 2] = pixel; + pxData[pxPos + 3] = 0xff; + }, + + // 2 - LA + // 0: 0, 1: 0, 2: 0, 3: 1 + function(pxData, data, pxPos, rawPos) { + if (rawPos + 1 >= data.length) { + throw new Error('Ran out of data'); + } + + var pixel = data[rawPos]; + pxData[pxPos] = pixel; + pxData[pxPos + 1] = pixel; + pxData[pxPos + 2] = pixel; + pxData[pxPos + 3] = data[rawPos + 1]; + }, + + // 3 - RGB + // 0: 0, 1: 1, 2: 2, 3: 0xff + function(pxData, data, pxPos, rawPos) { + if (rawPos + 2 >= data.length) { + throw new Error('Ran out of data'); + } + + pxData[pxPos] = data[rawPos]; + pxData[pxPos + 1] = data[rawPos + 1]; + pxData[pxPos + 2] = data[rawPos + 2]; + pxData[pxPos + 3] = 0xff; + }, + + // 4 - RGBA + // 0: 0, 1: 1, 2: 2, 3: 3 + function(pxData, data, pxPos, rawPos) { + if (rawPos + 3 >= data.length) { + throw new Error('Ran out of data'); + } + + pxData[pxPos] = data[rawPos]; + pxData[pxPos + 1] = data[rawPos + 1]; + pxData[pxPos + 2] = data[rawPos + 2]; + pxData[pxPos + 3] = data[rawPos + 3]; + } +]; + +var pixelBppCustomMapper = [ + // 0 - dummy entry + function() {}, + + // 1 - L + // 0: 0, 1: 0, 2: 0, 3: 0xff + function(pxData, pixelData, pxPos, maxBit) { + var pixel = pixelData[0]; + pxData[pxPos] = pixel; + pxData[pxPos + 1] = pixel; + pxData[pxPos + 2] = pixel; + pxData[pxPos + 3] = maxBit; + }, + + // 2 - LA + // 0: 0, 1: 0, 2: 0, 3: 1 + function(pxData, pixelData, pxPos) { + var pixel = pixelData[0]; + pxData[pxPos] = pixel; + pxData[pxPos + 1] = pixel; + pxData[pxPos + 2] = pixel; + pxData[pxPos + 3] = pixelData[1]; + }, + + // 3 - RGB + // 0: 0, 1: 1, 2: 2, 3: 0xff + function(pxData, pixelData, pxPos, maxBit) { + pxData[pxPos] = pixelData[0]; + pxData[pxPos + 1] = pixelData[1]; + pxData[pxPos + 2] = pixelData[2]; + pxData[pxPos + 3] = maxBit; + }, + + // 4 - RGBA + // 0: 0, 1: 1, 2: 2, 3: 3 + function(pxData, pixelData, pxPos) { + pxData[pxPos] = pixelData[0]; + pxData[pxPos + 1] = pixelData[1]; + pxData[pxPos + 2] = pixelData[2]; + pxData[pxPos + 3] = pixelData[3]; + } +]; + +function bitRetriever(data, depth) { + + var leftOver = []; + var i = 0; + + function split() { + if (i === data.length) { + throw new Error('Ran out of data'); + } + var byte = data[i]; + i++; + var byte8, byte7, byte6, byte5, byte4, byte3, byte2, byte1; + switch (depth) { + default: + throw new Error('unrecognised depth'); + case 16: + byte2 = data[i]; + i++; + leftOver.push(((byte << 8) + byte2)); + break; + case 4: + byte2 = byte & 0x0f; + byte1 = byte >> 4; + leftOver.push(byte1, byte2); + break; + case 2: + byte4 = byte & 3; + byte3 = byte >> 2 & 3; + byte2 = byte >> 4 & 3; + byte1 = byte >> 6 & 3; + leftOver.push(byte1, byte2, byte3, byte4); + break; + case 1: + byte8 = byte & 1; + byte7 = byte >> 1 & 1; + byte6 = byte >> 2 & 1; + byte5 = byte >> 3 & 1; + byte4 = byte >> 4 & 1; + byte3 = byte >> 5 & 1; + byte2 = byte >> 6 & 1; + byte1 = byte >> 7 & 1; + leftOver.push(byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8); + break; + } + } + + return { + get: function(count) { + while (leftOver.length < count) { + split(); + } + var returner = leftOver.slice(0, count); + leftOver = leftOver.slice(count); + return returner; + }, + resetAfterLine: function() { + leftOver.length = 0; + }, + end: function() { + if (i !== data.length) { + throw new Error('extra data found'); + } + } + }; +} + +function mapImage8Bit(image, pxData, getPxPos, bpp, data, rawPos) { // eslint-disable-line max-params + var imageWidth = image.width; + var imageHeight = image.height; + var imagePass = image.index; + for (var y = 0; y < imageHeight; y++) { + for (var x = 0; x < imageWidth; x++) { + var pxPos = getPxPos(x, y, imagePass); + pixelBppMapper[bpp](pxData, data, pxPos, rawPos); + rawPos += bpp; //eslint-disable-line no-param-reassign + } + } + return rawPos; +} + +function mapImageCustomBit(image, pxData, getPxPos, bpp, bits, maxBit) { // eslint-disable-line max-params + var imageWidth = image.width; + var imageHeight = image.height; + var imagePass = image.index; + for (var y = 0; y < imageHeight; y++) { + for (var x = 0; x < imageWidth; x++) { + var pixelData = bits.get(bpp); + var pxPos = getPxPos(x, y, imagePass); + pixelBppCustomMapper[bpp](pxData, pixelData, pxPos, maxBit); + } + bits.resetAfterLine(); + } +} + +exports.dataToBitMap = function(data, bitmapInfo) { + + var width = bitmapInfo.width; + var height = bitmapInfo.height; + var depth = bitmapInfo.depth; + var bpp = bitmapInfo.bpp; + var interlace = bitmapInfo.interlace; + + if (depth !== 8) { + var bits = bitRetriever(data, depth); + } + var pxData; + if (depth <= 8) { + pxData = new Buffer(width * height * 4); + } + else { + pxData = new Uint16Array(width * height * 4); + } + var maxBit = Math.pow(2, depth) - 1; + var rawPos = 0; + var images; + var getPxPos; + + if (interlace) { + images = interlaceUtils.getImagePasses(width, height); + getPxPos = interlaceUtils.getInterlaceIterator(width, height); + } + else { + var nonInterlacedPxPos = 0; + getPxPos = function() { + var returner = nonInterlacedPxPos; + nonInterlacedPxPos += 4; + return returner; + }; + images = [{ width: width, height: height }]; + } + + for (var imageIndex = 0; imageIndex < images.length; imageIndex++) { + if (depth === 8) { + rawPos = mapImage8Bit(images[imageIndex], pxData, getPxPos, bpp, data, rawPos); + } + else { + mapImageCustomBit(images[imageIndex], pxData, getPxPos, bpp, bits, maxBit); + } + } + if (depth === 8) { + if (rawPos !== data.length) { + throw new Error('extra data found'); + } + } + else { + bits.end(); + } + + return pxData; +}; diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/bitpacker.js b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/bitpacker.js new file mode 100644 index 00000000..788bf421 --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/bitpacker.js @@ -0,0 +1,143 @@ +'use strict'; + +var constants = require('./constants'); + +module.exports = function(dataIn, width, height, options) { + var outHasAlpha = [constants.COLORTYPE_COLOR_ALPHA, constants.COLORTYPE_ALPHA].indexOf(options.colorType) !== -1; + if (options.colorType === options.inputColorType) { + var bigEndian = (function() { + var buffer = new ArrayBuffer(2); + new DataView(buffer).setInt16(0, 256, true /* littleEndian */); + // Int16Array uses the platform's endianness. + return new Int16Array(buffer)[0] !== 256; + })(); + // If no need to convert to grayscale and alpha is present/absent in both, take a fast route + if (options.bitDepth === 8 || (options.bitDepth === 16 && bigEndian)) { + return dataIn; + } + } + + // map to a UInt16 array if data is 16bit, fix endianness below + var data = options.bitDepth !== 16 ? dataIn : new Uint16Array(dataIn.buffer); + + var maxValue = 255; + var inBpp = constants.COLORTYPE_TO_BPP_MAP[options.inputColorType]; + if (inBpp === 4 && !options.inputHasAlpha) { + inBpp = 3; + } + var outBpp = constants.COLORTYPE_TO_BPP_MAP[options.colorType]; + if (options.bitDepth === 16) { + maxValue = 65535; + outBpp *= 2; + } + var outData = new Buffer(width * height * outBpp); + + var inIndex = 0; + var outIndex = 0; + + var bgColor = options.bgColor || {}; + if (bgColor.red === undefined) { + bgColor.red = maxValue; + } + if (bgColor.green === undefined) { + bgColor.green = maxValue; + } + if (bgColor.blue === undefined) { + bgColor.blue = maxValue; + } + + function getRGBA() { + var red; + var green; + var blue; + var alpha = maxValue; + switch (options.inputColorType) { + case constants.COLORTYPE_COLOR_ALPHA: + alpha = data[inIndex + 3]; + red = data[inIndex]; + green = data[inIndex + 1]; + blue = data[inIndex + 2]; + break; + case constants.COLORTYPE_COLOR: + red = data[inIndex]; + green = data[inIndex + 1]; + blue = data[inIndex + 2]; + break; + case constants.COLORTYPE_ALPHA: + alpha = data[inIndex + 1]; + red = data[inIndex]; + green = red; + blue = red; + break; + case constants.COLORTYPE_GRAYSCALE: + red = data[inIndex]; + green = red; + blue = red; + break; + default: + throw new Error('input color type:' + options.inputColorType + ' is not supported at present'); + } + + if (options.inputHasAlpha) { + if (!outHasAlpha) { + alpha /= maxValue; + red = Math.min(Math.max(Math.round((1 - alpha) * bgColor.red + alpha * red), 0), maxValue); + green = Math.min(Math.max(Math.round((1 - alpha) * bgColor.green + alpha * green), 0), maxValue); + blue = Math.min(Math.max(Math.round((1 - alpha) * bgColor.blue + alpha * blue), 0), maxValue); + } + } + return { red: red, green: green, blue: blue, alpha: alpha }; + } + + for (var y = 0; y < height; y++) { + for (var x = 0; x < width; x++) { + var rgba = getRGBA(data, inIndex); + + switch (options.colorType) { + case constants.COLORTYPE_COLOR_ALPHA: + case constants.COLORTYPE_COLOR: + if (options.bitDepth === 8) { + outData[outIndex] = rgba.red; + outData[outIndex + 1] = rgba.green; + outData[outIndex + 2] = rgba.blue; + if (outHasAlpha) { + outData[outIndex + 3] = rgba.alpha; + } + } + else { + outData.writeUInt16BE(rgba.red, outIndex); + outData.writeUInt16BE(rgba.green, outIndex + 2); + outData.writeUInt16BE(rgba.blue, outIndex + 4); + if (outHasAlpha) { + outData.writeUInt16BE(rgba.alpha, outIndex + 6); + } + } + break; + case constants.COLORTYPE_ALPHA: + case constants.COLORTYPE_GRAYSCALE: + // Convert to grayscale and alpha + var grayscale = (rgba.red + rgba.green + rgba.blue) / 3; + if (options.bitDepth === 8) { + outData[outIndex] = grayscale; + if (outHasAlpha) { + outData[outIndex + 1] = rgba.alpha; + } + } + else { + outData.writeUInt16BE(grayscale, outIndex); + if (outHasAlpha) { + outData.writeUInt16BE(rgba.alpha, outIndex + 2); + } + } + break; + default: + throw new Error('unrecognised color Type ' + options.colorType); + } + + inIndex += inBpp; + outIndex += outBpp; + } + } + + return outData; +}; diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/chunkstream.js b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/chunkstream.js new file mode 100644 index 00000000..0e542dea --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/chunkstream.js @@ -0,0 +1,209 @@ +'use strict'; + + +var util = require('util'); +var Stream = require('stream'); + + +var ChunkStream = module.exports = function() { + Stream.call(this); + + this._buffers = []; + this._buffered = 0; + + this._reads = []; + this._paused = false; + + this._encoding = 'utf8'; + this.writable = true; +}; +util.inherits(ChunkStream, Stream); + + +ChunkStream.prototype.read = function(length, callback) { + + this._reads.push({ + length: Math.abs(length), // if length < 0 then at most this length + allowLess: length < 0, + func: callback + }); + + process.nextTick(function() { + this._process(); + + // its paused and there is not enought data then ask for more + if (this._paused && this._reads.length > 0) { + this._paused = false; + + this.emit('drain'); + } + }.bind(this)); +}; + +ChunkStream.prototype.write = function(data, encoding) { + + if (!this.writable) { + this.emit('error', new Error('Stream not writable')); + return false; + } + + var dataBuffer; + if (Buffer.isBuffer(data)) { + dataBuffer = data; + } + else { + dataBuffer = new Buffer(data, encoding || this._encoding); + } + + this._buffers.push(dataBuffer); + this._buffered += dataBuffer.length; + + this._process(); + + // ok if there are no more read requests + if (this._reads && this._reads.length === 0) { + this._paused = true; + } + + return this.writable && !this._paused; +}; + +ChunkStream.prototype.end = function(data, encoding) { + + if (data) { + this.write(data, encoding); + } + + this.writable = false; + + // already destroyed + if (!this._buffers) { + return; + } + + // enqueue or handle end + if (this._buffers.length === 0) { + this._end(); + } + else { + this._buffers.push(null); + this._process(); + } +}; + +ChunkStream.prototype.destroySoon = ChunkStream.prototype.end; + +ChunkStream.prototype._end = function() { + + if (this._reads.length > 0) { + this.emit('error', + new Error('Unexpected end of input') + ); + } + + this.destroy(); +}; + +ChunkStream.prototype.destroy = function() { + + if (!this._buffers) { + return; + } + + this.writable = false; + this._reads = null; + this._buffers = null; + + this.emit('close'); +}; + +ChunkStream.prototype._processReadAllowingLess = function(read) { + // ok there is any data so that we can satisfy this request + this._reads.shift(); // == read + + // first we need to peek into first buffer + var smallerBuf = this._buffers[0]; + + // ok there is more data than we need + if (smallerBuf.length > read.length) { + + this._buffered -= read.length; + this._buffers[0] = smallerBuf.slice(read.length); + + read.func.call(this, smallerBuf.slice(0, read.length)); + + } + else { + // ok this is less than maximum length so use it all + this._buffered -= smallerBuf.length; + this._buffers.shift(); // == smallerBuf + + read.func.call(this, smallerBuf); + } +}; + +ChunkStream.prototype._processRead = function(read) { + this._reads.shift(); // == read + + var pos = 0; + var count = 0; + var data = new Buffer(read.length); + + // create buffer for all data + while (pos < read.length) { + + var buf = this._buffers[count++]; + var len = Math.min(buf.length, read.length - pos); + + buf.copy(data, pos, 0, len); + pos += len; + + // last buffer wasn't used all so just slice it and leave + if (len !== buf.length) { + this._buffers[--count] = buf.slice(len); + } + } + + // remove all used buffers + if (count > 0) { + this._buffers.splice(0, count); + } + + this._buffered -= read.length; + + read.func.call(this, data); +}; + +ChunkStream.prototype._process = function() { + + try { + // as long as there is any data and read requests + while (this._buffered > 0 && this._reads && this._reads.length > 0) { + + var read = this._reads[0]; + + // read any data (but no more than length) + if (read.allowLess) { + this._processReadAllowingLess(read); + + } + else if (this._buffered >= read.length) { + // ok we can meet some expectations + + this._processRead(read); + } + else { + // not enought data to satisfy first request in queue + // so we need to wait for more + break; + } + } + + if (this._buffers && !this.writable) { + this._end(); + } + } + catch (ex) { + this.emit('error', ex); + } +}; diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/constants.js b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/constants.js new file mode 100644 index 00000000..22d919d6 --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/constants.js @@ -0,0 +1,34 @@ +'use strict'; + + +module.exports = { + + PNG_SIGNATURE: [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a], + + TYPE_IHDR: 0x49484452, + TYPE_IEND: 0x49454e44, + TYPE_IDAT: 0x49444154, + TYPE_PLTE: 0x504c5445, + TYPE_tRNS: 0x74524e53, // eslint-disable-line camelcase + TYPE_gAMA: 0x67414d41, // eslint-disable-line camelcase + + // color-type bits + COLORTYPE_GRAYSCALE: 0, + COLORTYPE_PALETTE: 1, + COLORTYPE_COLOR: 2, + COLORTYPE_ALPHA: 4, // e.g. grayscale and alpha + + // color-type combinations + COLORTYPE_PALETTE_COLOR: 3, + COLORTYPE_COLOR_ALPHA: 6, + + COLORTYPE_TO_BPP_MAP: { + 0: 1, + 2: 3, + 3: 1, + 4: 2, + 6: 4 + }, + + GAMMA_DIVISION: 100000 +}; diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/crc.js b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/crc.js new file mode 100644 index 00000000..0705ed26 --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/crc.js @@ -0,0 +1,44 @@ +'use strict'; + +var crcTable = []; + +(function() { + for (var i = 0; i < 256; i++) { + var currentCrc = i; + for (var j = 0; j < 8; j++) { + if (currentCrc & 1) { + currentCrc = 0xedb88320 ^ (currentCrc >>> 1); + } + else { + currentCrc = currentCrc >>> 1; + } + } + crcTable[i] = currentCrc; + } +}()); + +var CrcCalculator = module.exports = function() { + this._crc = -1; +}; + +CrcCalculator.prototype.write = function(data) { + + for (var i = 0; i < data.length; i++) { + this._crc = crcTable[(this._crc ^ data[i]) & 0xff] ^ (this._crc >>> 8); + } + return true; +}; + +CrcCalculator.prototype.crc32 = function() { + return this._crc ^ -1; +}; + + +CrcCalculator.crc32 = function(buf) { + + var crc = -1; + for (var i = 0; i < buf.length; i++) { + crc = crcTable[(crc ^ buf[i]) & 0xff] ^ (crc >>> 8); + } + return crc ^ -1; +}; diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/filter-pack.js b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/filter-pack.js new file mode 100644 index 00000000..0a3eac80 --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/filter-pack.js @@ -0,0 +1,190 @@ +'use strict'; + +var paethPredictor = require('./paeth-predictor'); + +function filterNone(pxData, pxPos, byteWidth, rawData, rawPos) { + + for (var x = 0; x < byteWidth; x++) { + rawData[rawPos + x] = pxData[pxPos + x]; + } +} + +function filterSumNone(pxData, pxPos, byteWidth) { + + var sum = 0; + var length = pxPos + byteWidth; + + for (var i = pxPos; i < length; i++) { + sum += Math.abs(pxData[i]); + } + return sum; +} + +function filterSub(pxData, pxPos, byteWidth, rawData, rawPos, bpp) { + + for (var x = 0; x < byteWidth; x++) { + + var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + var val = pxData[pxPos + x] - left; + + rawData[rawPos + x] = val; + } +} + +function filterSumSub(pxData, pxPos, byteWidth, bpp) { + + var sum = 0; + for (var x = 0; x < byteWidth; x++) { + + var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + var val = pxData[pxPos + x] - left; + + sum += Math.abs(val); + } + + return sum; +} + +function filterUp(pxData, pxPos, byteWidth, rawData, rawPos) { + + for (var x = 0; x < byteWidth; x++) { + + var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; + var val = pxData[pxPos + x] - up; + + rawData[rawPos + x] = val; + } +} + +function filterSumUp(pxData, pxPos, byteWidth) { + + var sum = 0; + var length = pxPos + byteWidth; + for (var x = pxPos; x < length; x++) { + + var up = pxPos > 0 ? pxData[x - byteWidth] : 0; + var val = pxData[x] - up; + + sum += Math.abs(val); + } + + return sum; +} + +function filterAvg(pxData, pxPos, byteWidth, rawData, rawPos, bpp) { + + for (var x = 0; x < byteWidth; x++) { + + var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; + var val = pxData[pxPos + x] - ((left + up) >> 1); + + rawData[rawPos + x] = val; + } +} + +function filterSumAvg(pxData, pxPos, byteWidth, bpp) { + + var sum = 0; + for (var x = 0; x < byteWidth; x++) { + + var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; + var val = pxData[pxPos + x] - ((left + up) >> 1); + + sum += Math.abs(val); + } + + return sum; +} + +function filterPaeth(pxData, pxPos, byteWidth, rawData, rawPos, bpp) { + + for (var x = 0; x < byteWidth; x++) { + + var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; + var upleft = pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0; + var val = pxData[pxPos + x] - paethPredictor(left, up, upleft); + + rawData[rawPos + x] = val; + } +} + +function filterSumPaeth(pxData, pxPos, byteWidth, bpp) { + var sum = 0; + for (var x = 0; x < byteWidth; x++) { + + var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; + var upleft = pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0; + var val = pxData[pxPos + x] - paethPredictor(left, up, upleft); + + sum += Math.abs(val); + } + + return sum; +} + +var filters = { + 0: filterNone, + 1: filterSub, + 2: filterUp, + 3: filterAvg, + 4: filterPaeth +}; + +var filterSums = { + 0: filterSumNone, + 1: filterSumSub, + 2: filterSumUp, + 3: filterSumAvg, + 4: filterSumPaeth +}; + +module.exports = function(pxData, width, height, options, bpp) { + + var filterTypes; + if (!('filterType' in options) || options.filterType === -1) { + filterTypes = [0, 1, 2, 3, 4]; + } + else if (typeof options.filterType === 'number') { + filterTypes = [options.filterType]; + } + else { + throw new Error('unrecognised filter types'); + } + + if (options.bitDepth === 16) { + bpp *= 2; + } + var byteWidth = width * bpp; + var rawPos = 0; + var pxPos = 0; + var rawData = new Buffer((byteWidth + 1) * height); + + var sel = filterTypes[0]; + + for (var y = 0; y < height; y++) { + + if (filterTypes.length > 1) { + // find best filter for this line (with lowest sum of values) + var min = Infinity; + + for (var i = 0; i < filterTypes.length; i++) { + var sum = filterSums[filterTypes[i]](pxData, pxPos, byteWidth, bpp); + if (sum < min) { + sel = filterTypes[i]; + min = sum; + } + } + } + + rawData[rawPos] = sel; + rawPos++; + filters[sel](pxData, pxPos, byteWidth, rawData, rawPos, bpp); + rawPos += byteWidth; + pxPos += byteWidth; + } + return rawData; +}; diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/filter-parse-async.js b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/filter-parse-async.js new file mode 100644 index 00000000..560c30ea --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/filter-parse-async.js @@ -0,0 +1,25 @@ +'use strict'; + +var util = require('util'); +var ChunkStream = require('./chunkstream'); +var Filter = require('./filter-parse'); + + +var FilterAsync = module.exports = function(bitmapInfo) { + ChunkStream.call(this); + + var buffers = []; + var that = this; + this._filter = new Filter(bitmapInfo, { + read: this.read.bind(this), + write: function(buffer) { + buffers.push(buffer); + }, + complete: function() { + that.emit('complete', Buffer.concat(buffers)); + } + }); + + this._filter.start(); +}; +util.inherits(FilterAsync, ChunkStream); diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/filter-parse-sync.js b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/filter-parse-sync.js new file mode 100644 index 00000000..958c6765 --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/filter-parse-sync.js @@ -0,0 +1,24 @@ +'use strict'; + +var SyncReader = require('./sync-reader'); +var Filter = require('./filter-parse'); + + +exports.process = function(inBuffer, bitmapInfo) { + + var outBuffers = []; + var reader = new SyncReader(inBuffer); + var filter = new Filter(bitmapInfo, { + read: reader.read.bind(reader), + write: function(bufferPart) { + outBuffers.push(bufferPart); + }, + complete: function() { + } + }); + + filter.start(); + reader.process(); + + return Buffer.concat(outBuffers); +}; \ No newline at end of file diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/filter-parse.js b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/filter-parse.js new file mode 100644 index 00000000..3f0e14bb --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/filter-parse.js @@ -0,0 +1,171 @@ +'use strict'; + +var interlaceUtils = require('./interlace'); +var paethPredictor = require('./paeth-predictor'); + +function getByteWidth(width, bpp, depth) { + var byteWidth = width * bpp; + if (depth !== 8) { + byteWidth = Math.ceil(byteWidth / (8 / depth)); + } + return byteWidth; +} + +var Filter = module.exports = function(bitmapInfo, dependencies) { + + var width = bitmapInfo.width; + var height = bitmapInfo.height; + var interlace = bitmapInfo.interlace; + var bpp = bitmapInfo.bpp; + var depth = bitmapInfo.depth; + + this.read = dependencies.read; + this.write = dependencies.write; + this.complete = dependencies.complete; + + this._imageIndex = 0; + this._images = []; + if (interlace) { + var passes = interlaceUtils.getImagePasses(width, height); + for (var i = 0; i < passes.length; i++) { + this._images.push({ + byteWidth: getByteWidth(passes[i].width, bpp, depth), + height: passes[i].height, + lineIndex: 0 + }); + } + } + else { + this._images.push({ + byteWidth: getByteWidth(width, bpp, depth), + height: height, + lineIndex: 0 + }); + } + + // when filtering the line we look at the pixel to the left + // the spec also says it is done on a byte level regardless of the number of pixels + // so if the depth is byte compatible (8 or 16) we subtract the bpp in order to compare back + // a pixel rather than just a different byte part. However if we are sub byte, we ignore. + if (depth === 8) { + this._xComparison = bpp; + } + else if (depth === 16) { + this._xComparison = bpp * 2; + } + else { + this._xComparison = 1; + } +}; + +Filter.prototype.start = function() { + this.read(this._images[this._imageIndex].byteWidth + 1, this._reverseFilterLine.bind(this)); +}; + +Filter.prototype._unFilterType1 = function(rawData, unfilteredLine, byteWidth) { + + var xComparison = this._xComparison; + var xBiggerThan = xComparison - 1; + + for (var x = 0; x < byteWidth; x++) { + var rawByte = rawData[1 + x]; + var f1Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; + unfilteredLine[x] = rawByte + f1Left; + } +}; + +Filter.prototype._unFilterType2 = function(rawData, unfilteredLine, byteWidth) { + + var lastLine = this._lastLine; + + for (var x = 0; x < byteWidth; x++) { + var rawByte = rawData[1 + x]; + var f2Up = lastLine ? lastLine[x] : 0; + unfilteredLine[x] = rawByte + f2Up; + } +}; + +Filter.prototype._unFilterType3 = function(rawData, unfilteredLine, byteWidth) { + + var xComparison = this._xComparison; + var xBiggerThan = xComparison - 1; + var lastLine = this._lastLine; + + for (var x = 0; x < byteWidth; x++) { + var rawByte = rawData[1 + x]; + var f3Up = lastLine ? lastLine[x] : 0; + var f3Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; + var f3Add = Math.floor((f3Left + f3Up) / 2); + unfilteredLine[x] = rawByte + f3Add; + } +}; + +Filter.prototype._unFilterType4 = function(rawData, unfilteredLine, byteWidth) { + + var xComparison = this._xComparison; + var xBiggerThan = xComparison - 1; + var lastLine = this._lastLine; + + for (var x = 0; x < byteWidth; x++) { + var rawByte = rawData[1 + x]; + var f4Up = lastLine ? lastLine[x] : 0; + var f4Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; + var f4UpLeft = x > xBiggerThan && lastLine ? lastLine[x - xComparison] : 0; + var f4Add = paethPredictor(f4Left, f4Up, f4UpLeft); + unfilteredLine[x] = rawByte + f4Add; + } +}; + +Filter.prototype._reverseFilterLine = function(rawData) { + + var filter = rawData[0]; + var unfilteredLine; + var currentImage = this._images[this._imageIndex]; + var byteWidth = currentImage.byteWidth; + + if (filter === 0) { + unfilteredLine = rawData.slice(1, byteWidth + 1); + } + else { + + unfilteredLine = new Buffer(byteWidth); + + switch (filter) { + case 1: + this._unFilterType1(rawData, unfilteredLine, byteWidth); + break; + case 2: + this._unFilterType2(rawData, unfilteredLine, byteWidth); + break; + case 3: + this._unFilterType3(rawData, unfilteredLine, byteWidth); + break; + case 4: + this._unFilterType4(rawData, unfilteredLine, byteWidth); + break; + default: + throw new Error('Unrecognised filter type - ' + filter); + } + } + + this.write(unfilteredLine); + + currentImage.lineIndex++; + if (currentImage.lineIndex >= currentImage.height) { + this._lastLine = null; + this._imageIndex++; + currentImage = this._images[this._imageIndex]; + } + else { + this._lastLine = unfilteredLine; + } + + if (currentImage) { + // read, using the byte width that may be from the new current image + this.read(currentImage.byteWidth + 1, this._reverseFilterLine.bind(this)); + } + else { + this._lastLine = null; + this.complete(); + } +}; diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/format-normaliser.js b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/format-normaliser.js new file mode 100644 index 00000000..378373f5 --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/format-normaliser.js @@ -0,0 +1,89 @@ +'use strict'; + +function dePalette(indata, outdata, width, height, palette) { + var pxPos = 0; + // use values from palette + for (var y = 0; y < height; y++) { + for (var x = 0; x < width; x++) { + var color = palette[indata[pxPos]]; + + if (!color) { + throw new Error('index ' + indata[pxPos] + ' not in palette'); + } + + for (var i = 0; i < 4; i++) { + outdata[pxPos + i] = color[i]; + } + pxPos += 4; + } + } +} + +function replaceTransparentColor(indata, outdata, width, height, transColor) { + var pxPos = 0; + for (var y = 0; y < height; y++) { + for (var x = 0; x < width; x++) { + var makeTrans = false; + + if (transColor.length === 1) { + if (transColor[0] === indata[pxPos]) { + makeTrans = true; + } + } + else if (transColor[0] === indata[pxPos] && transColor[1] === indata[pxPos + 1] && transColor[2] === indata[pxPos + 2]) { + makeTrans = true; + } + if (makeTrans) { + for (var i = 0; i < 4; i++) { + outdata[pxPos + i] = 0; + } + } + pxPos += 4; + } + } +} + +function scaleDepth(indata, outdata, width, height, depth) { + var maxOutSample = 255; + var maxInSample = Math.pow(2, depth) - 1; + var pxPos = 0; + + for (var y = 0; y < height; y++) { + for (var x = 0; x < width; x++) { + for (var i = 0; i < 4; i++) { + outdata[pxPos + i] = Math.floor((indata[pxPos + i] * maxOutSample) / maxInSample + 0.5); + } + pxPos += 4; + } + } +} + +module.exports = function(indata, imageData) { + + var depth = imageData.depth; + var width = imageData.width; + var height = imageData.height; + var colorType = imageData.colorType; + var transColor = imageData.transColor; + var palette = imageData.palette; + + var outdata = indata; // only different for 16 bits + + if (colorType === 3) { // paletted + dePalette(indata, outdata, width, height, palette); + } + else { + if (transColor) { + replaceTransparentColor(indata, outdata, width, height, transColor); + } + // if it needs scaling + if (depth !== 8) { + // if we need to change the buffer size + if (depth === 16) { + outdata = new Buffer(width * height * 4); + } + scaleDepth(indata, outdata, width, height, depth); + } + } + return outdata; +}; diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/interlace.js b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/interlace.js new file mode 100644 index 00000000..734ea23f --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/interlace.js @@ -0,0 +1,87 @@ +'use strict'; + +// Adam 7 +// 0 1 2 3 4 5 6 7 +// 0 x 6 4 6 x 6 4 6 +// 1 7 7 7 7 7 7 7 7 +// 2 5 6 5 6 5 6 5 6 +// 3 7 7 7 7 7 7 7 7 +// 4 3 6 4 6 3 6 4 6 +// 5 7 7 7 7 7 7 7 7 +// 6 5 6 5 6 5 6 5 6 +// 7 7 7 7 7 7 7 7 7 + + +var imagePasses = [ + { // pass 1 - 1px + x: [0], + y: [0] + }, + { // pass 2 - 1px + x: [4], + y: [0] + }, + { // pass 3 - 2px + x: [0, 4], + y: [4] + }, + { // pass 4 - 4px + x: [2, 6], + y: [0, 4] + }, + { // pass 5 - 8px + x: [0, 2, 4, 6], + y: [2, 6] + }, + { // pass 6 - 16px + x: [1, 3, 5, 7], + y: [0, 2, 4, 6] + }, + { // pass 7 - 32px + x: [0, 1, 2, 3, 4, 5, 6, 7], + y: [1, 3, 5, 7] + } +]; + +exports.getImagePasses = function(width, height) { + var images = []; + var xLeftOver = width % 8; + var yLeftOver = height % 8; + var xRepeats = (width - xLeftOver) / 8; + var yRepeats = (height - yLeftOver) / 8; + for (var i = 0; i < imagePasses.length; i++) { + var pass = imagePasses[i]; + var passWidth = xRepeats * pass.x.length; + var passHeight = yRepeats * pass.y.length; + for (var j = 0; j < pass.x.length; j++) { + if (pass.x[j] < xLeftOver) { + passWidth++; + } + else { + break; + } + } + for (j = 0; j < pass.y.length; j++) { + if (pass.y[j] < yLeftOver) { + passHeight++; + } + else { + break; + } + } + if (passWidth > 0 && passHeight > 0) { + images.push({ width: passWidth, height: passHeight, index: i }); + } + } + return images; +}; + +exports.getInterlaceIterator = function(width) { + return function(x, y, pass) { + var outerXLeftOver = x % imagePasses[pass].x.length; + var outerX = (((x - outerXLeftOver) / imagePasses[pass].x.length) * 8) + imagePasses[pass].x[outerXLeftOver]; + var outerYLeftOver = y % imagePasses[pass].y.length; + var outerY = (((y - outerYLeftOver) / imagePasses[pass].y.length) * 8) + imagePasses[pass].y[outerYLeftOver]; + return (outerX * 4) + (outerY * width * 4); + }; +}; \ No newline at end of file diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/packer-async.js b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/packer-async.js new file mode 100644 index 00000000..92294c89 --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/packer-async.js @@ -0,0 +1,45 @@ +'use strict'; + +var util = require('util'); +var Stream = require('stream'); +var constants = require('./constants'); +var Packer = require('./packer'); + +var PackerAsync = module.exports = function(opt) { + Stream.call(this); + + var options = opt || {}; + + this._packer = new Packer(options); + this._deflate = this._packer.createDeflate(); + + this.readable = true; +}; +util.inherits(PackerAsync, Stream); + + +PackerAsync.prototype.pack = function(data, width, height, gamma) { + // Signature + this.emit('data', new Buffer(constants.PNG_SIGNATURE)); + this.emit('data', this._packer.packIHDR(width, height)); + + if (gamma) { + this.emit('data', this._packer.packGAMA(gamma)); + } + + var filteredData = this._packer.filterData(data, width, height); + + // compress it + this._deflate.on('error', this.emit.bind(this, 'error')); + + this._deflate.on('data', function(compressedData) { + this.emit('data', this._packer.packIDAT(compressedData)); + }.bind(this)); + + this._deflate.on('end', function() { + this.emit('data', this._packer.packIEND()); + this.emit('end'); + }.bind(this)); + + this._deflate.end(filteredData); +}; diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/packer-sync.js b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/packer-sync.js new file mode 100644 index 00000000..6129098d --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/packer-sync.js @@ -0,0 +1,48 @@ +'use strict'; + +var hasSyncZlib = true; +var zlib = require('zlib'); +if (!zlib.deflateSync) { + hasSyncZlib = false; +} +var constants = require('./constants'); +var Packer = require('./packer'); + +module.exports = function(metaData, opt) { + + if (!hasSyncZlib) { + throw new Error('To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0'); + } + + var options = opt || {}; + + var packer = new Packer(options); + + var chunks = []; + + // Signature + chunks.push(new Buffer(constants.PNG_SIGNATURE)); + + // Header + chunks.push(packer.packIHDR(metaData.width, metaData.height)); + + if (metaData.gamma) { + chunks.push(packer.packGAMA(metaData.gamma)); + } + + var filteredData = packer.filterData(metaData.data, metaData.width, metaData.height); + + // compress it + var compressedData = zlib.deflateSync(filteredData, packer.getDeflateOptions()); + filteredData = null; + + if (!compressedData || !compressedData.length) { + throw new Error('bad png - invalid compressed data response'); + } + chunks.push(packer.packIDAT(compressedData)); + + // End + chunks.push(packer.packIEND()); + + return Buffer.concat(chunks); +}; diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/packer.js b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/packer.js new file mode 100644 index 00000000..b3f435d5 --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/packer.js @@ -0,0 +1,107 @@ +'use strict'; + +var constants = require('./constants'); +var CrcStream = require('./crc'); +var bitPacker = require('./bitpacker'); +var filter = require('./filter-pack'); +var zlib = require('zlib'); + +var Packer = module.exports = function(options) { + this._options = options; + + options.deflateChunkSize = options.deflateChunkSize || 32 * 1024; + options.deflateLevel = options.deflateLevel != null ? options.deflateLevel : 9; + options.deflateStrategy = options.deflateStrategy != null ? options.deflateStrategy : 3; + options.inputHasAlpha = options.inputHasAlpha != null ? options.inputHasAlpha : true; + options.deflateFactory = options.deflateFactory || zlib.createDeflate; + options.bitDepth = options.bitDepth || 8; + // This is outputColorType + options.colorType = (typeof options.colorType === 'number') ? options.colorType : constants.COLORTYPE_COLOR_ALPHA; + options.inputColorType = (typeof options.inputColorType === 'number') ? options.inputColorType : constants.COLORTYPE_COLOR_ALPHA; + + if ([ + constants.COLORTYPE_GRAYSCALE, + constants.COLORTYPE_COLOR, + constants.COLORTYPE_COLOR_ALPHA, + constants.COLORTYPE_ALPHA + ].indexOf(options.colorType) === -1) { + throw new Error('option color type:' + options.colorType + ' is not supported at present'); + } + if ([ + constants.COLORTYPE_GRAYSCALE, + constants.COLORTYPE_COLOR, + constants.COLORTYPE_COLOR_ALPHA, + constants.COLORTYPE_ALPHA + ].indexOf(options.inputColorType) === -1) { + throw new Error('option input color type:' + options.inputColorType + ' is not supported at present'); + } + if (options.bitDepth !== 8 && options.bitDepth !== 16) { + throw new Error('option bit depth:' + options.bitDepth + ' is not supported at present'); + } +}; + +Packer.prototype.getDeflateOptions = function() { + return { + chunkSize: this._options.deflateChunkSize, + level: this._options.deflateLevel, + strategy: this._options.deflateStrategy + }; +}; + +Packer.prototype.createDeflate = function() { + return this._options.deflateFactory(this.getDeflateOptions()); +}; + +Packer.prototype.filterData = function(data, width, height) { + // convert to correct format for filtering (e.g. right bpp and bit depth) + var packedData = bitPacker(data, width, height, this._options); + + // filter pixel data + var bpp = constants.COLORTYPE_TO_BPP_MAP[this._options.colorType]; + var filteredData = filter(packedData, width, height, this._options, bpp); + return filteredData; +}; + +Packer.prototype._packChunk = function(type, data) { + + var len = (data ? data.length : 0); + var buf = new Buffer(len + 12); + + buf.writeUInt32BE(len, 0); + buf.writeUInt32BE(type, 4); + + if (data) { + data.copy(buf, 8); + } + + buf.writeInt32BE(CrcStream.crc32(buf.slice(4, buf.length - 4)), buf.length - 4); + return buf; +}; + +Packer.prototype.packGAMA = function(gamma) { + var buf = new Buffer(4); + buf.writeUInt32BE(Math.floor(gamma * constants.GAMMA_DIVISION), 0); + return this._packChunk(constants.TYPE_gAMA, buf); +}; + +Packer.prototype.packIHDR = function(width, height) { + + var buf = new Buffer(13); + buf.writeUInt32BE(width, 0); + buf.writeUInt32BE(height, 4); + buf[8] = this._options.bitDepth; // Bit depth + buf[9] = this._options.colorType; // colorType + buf[10] = 0; // compression + buf[11] = 0; // filter + buf[12] = 0; // interlace + + return this._packChunk(constants.TYPE_IHDR, buf); +}; + +Packer.prototype.packIDAT = function(data) { + return this._packChunk(constants.TYPE_IDAT, data); +}; + +Packer.prototype.packIEND = function() { + return this._packChunk(constants.TYPE_IEND, null); +}; diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/paeth-predictor.js b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/paeth-predictor.js new file mode 100644 index 00000000..97c3adf3 --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/paeth-predictor.js @@ -0,0 +1,17 @@ +'use strict'; + +module.exports = function paethPredictor(left, above, upLeft) { + + var paeth = left + above - upLeft; + var pLeft = Math.abs(paeth - left); + var pAbove = Math.abs(paeth - above); + var pUpLeft = Math.abs(paeth - upLeft); + + if (pLeft <= pAbove && pLeft <= pUpLeft) { + return left; + } + if (pAbove <= pUpLeft) { + return above; + } + return upLeft; +}; \ No newline at end of file diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/parser-async.js b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/parser-async.js new file mode 100644 index 00000000..9c273536 --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/parser-async.js @@ -0,0 +1,164 @@ +'use strict'; + +var util = require('util'); +var zlib = require('zlib'); +var ChunkStream = require('./chunkstream'); +var FilterAsync = require('./filter-parse-async'); +var Parser = require('./parser'); +var bitmapper = require('./bitmapper'); +var formatNormaliser = require('./format-normaliser'); + +var ParserAsync = module.exports = function(options) { + ChunkStream.call(this); + + this._parser = new Parser(options, { + read: this.read.bind(this), + error: this._handleError.bind(this), + metadata: this._handleMetaData.bind(this), + gamma: this.emit.bind(this, 'gamma'), + palette: this._handlePalette.bind(this), + transColor: this._handleTransColor.bind(this), + finished: this._finished.bind(this), + inflateData: this._inflateData.bind(this), + simpleTransparency: this._simpleTransparency.bind(this), + headersFinished: this._headersFinished.bind(this) + }); + this._options = options; + this.writable = true; + + this._parser.start(); +}; +util.inherits(ParserAsync, ChunkStream); + + +ParserAsync.prototype._handleError = function(err) { + + this.emit('error', err); + + this.writable = false; + + this.destroy(); + + if (this._inflate && this._inflate.destroy) { + this._inflate.destroy(); + } + + if (this._filter) { + this._filter.destroy(); + // For backward compatibility with Node 7 and below. + // Suppress errors due to _inflate calling write() even after + // it's destroy()'ed. + this._filter.on('error', function() {}); + } + + this.errord = true; +}; + +ParserAsync.prototype._inflateData = function(data) { + if (!this._inflate) { + if (this._bitmapInfo.interlace) { + this._inflate = zlib.createInflate(); + + this._inflate.on('error', this.emit.bind(this, 'error')); + this._filter.on('complete', this._complete.bind(this)); + + this._inflate.pipe(this._filter); + } + else { + var rowSize = ((this._bitmapInfo.width * this._bitmapInfo.bpp * this._bitmapInfo.depth + 7) >> 3) + 1; + var imageSize = rowSize * this._bitmapInfo.height; + var chunkSize = Math.max(imageSize, zlib.Z_MIN_CHUNK); + + this._inflate = zlib.createInflate({ chunkSize: chunkSize }); + var leftToInflate = imageSize; + + var emitError = this.emit.bind(this, 'error'); + this._inflate.on('error', function(err) { + if (!leftToInflate) { + return; + } + + emitError(err); + }); + this._filter.on('complete', this._complete.bind(this)); + + var filterWrite = this._filter.write.bind(this._filter); + this._inflate.on('data', function(chunk) { + if (!leftToInflate) { + return; + } + + if (chunk.length > leftToInflate) { + chunk = chunk.slice(0, leftToInflate); + } + + leftToInflate -= chunk.length; + + filterWrite(chunk); + }); + + this._inflate.on('end', this._filter.end.bind(this._filter)); + } + } + this._inflate.write(data); +}; + +ParserAsync.prototype._handleMetaData = function(metaData) { + this._metaData = metaData; + this._bitmapInfo = Object.create(metaData); + + this._filter = new FilterAsync(this._bitmapInfo); +}; + +ParserAsync.prototype._handleTransColor = function(transColor) { + this._bitmapInfo.transColor = transColor; +}; + +ParserAsync.prototype._handlePalette = function(palette) { + this._bitmapInfo.palette = palette; +}; + +ParserAsync.prototype._simpleTransparency = function() { + this._metaData.alpha = true; +}; + +ParserAsync.prototype._headersFinished = function() { + // Up until this point, we don't know if we have a tRNS chunk (alpha) + // so we can't emit metadata any earlier + this.emit('metadata', this._metaData); +}; + +ParserAsync.prototype._finished = function() { + if (this.errord) { + return; + } + + if (!this._inflate) { + this.emit('error', 'No Inflate block'); + } + else { + // no more data to inflate + this._inflate.end(); + } + this.destroySoon(); +}; + +ParserAsync.prototype._complete = function(filteredData) { + + if (this.errord) { + return; + } + + try { + var bitmapData = bitmapper.dataToBitMap(filteredData, this._bitmapInfo); + + var normalisedBitmapData = formatNormaliser(bitmapData, this._bitmapInfo); + bitmapData = null; + } + catch (ex) { + this._handleError(ex); + return; + } + + this.emit('parsed', normalisedBitmapData); +}; diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/parser-sync.js b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/parser-sync.js new file mode 100644 index 00000000..ed899a45 --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/parser-sync.js @@ -0,0 +1,105 @@ +'use strict'; + +var hasSyncZlib = true; +var zlib = require('zlib'); +var inflateSync = require('./sync-inflate'); +if (!zlib.deflateSync) { + hasSyncZlib = false; +} +var SyncReader = require('./sync-reader'); +var FilterSync = require('./filter-parse-sync'); +var Parser = require('./parser'); +var bitmapper = require('./bitmapper'); +var formatNormaliser = require('./format-normaliser'); + + +module.exports = function(buffer, options) { + + if (!hasSyncZlib) { + throw new Error('To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0'); + } + + var err; + function handleError(_err_) { + err = _err_; + } + + var metaData; + function handleMetaData(_metaData_) { + metaData = _metaData_; + } + + function handleTransColor(transColor) { + metaData.transColor = transColor; + } + + function handlePalette(palette) { + metaData.palette = palette; + } + + function handleSimpleTransparency() { + metaData.alpha = true; + } + + var gamma; + function handleGamma(_gamma_) { + gamma = _gamma_; + } + + var inflateDataList = []; + function handleInflateData(inflatedData) { + inflateDataList.push(inflatedData); + } + + var reader = new SyncReader(buffer); + + var parser = new Parser(options, { + read: reader.read.bind(reader), + error: handleError, + metadata: handleMetaData, + gamma: handleGamma, + palette: handlePalette, + transColor: handleTransColor, + inflateData: handleInflateData, + simpleTransparency: handleSimpleTransparency + }); + + parser.start(); + reader.process(); + + if (err) { + throw err; + } + + //join together the inflate datas + var inflateData = Buffer.concat(inflateDataList); + inflateDataList.length = 0; + + var inflatedData; + if (metaData.interlace) { + inflatedData = zlib.inflateSync(inflateData); + } + else { + var rowSize = ((metaData.width * metaData.bpp * metaData.depth + 7) >> 3) + 1; + var imageSize = rowSize * metaData.height; + inflatedData = inflateSync(inflateData, { chunkSize: imageSize, maxLength: imageSize }); + } + inflateData = null; + + if (!inflatedData || !inflatedData.length) { + throw new Error('bad png - invalid inflate data response'); + } + + var unfilteredData = FilterSync.process(inflatedData, metaData); + inflateData = null; + + var bitmapData = bitmapper.dataToBitMap(unfilteredData, metaData); + unfilteredData = null; + + var normalisedBitmapData = formatNormaliser(bitmapData, metaData); + + metaData.data = normalisedBitmapData; + metaData.gamma = gamma || 0; + + return metaData; +}; diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/parser.js b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/parser.js new file mode 100644 index 00000000..9724443b --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/parser.js @@ -0,0 +1,297 @@ +'use strict'; + +var constants = require('./constants'); +var CrcCalculator = require('./crc'); + + +var Parser = module.exports = function(options, dependencies) { + + this._options = options; + options.checkCRC = options.checkCRC !== false; + + this._hasIHDR = false; + this._hasIEND = false; + this._emittedHeadersFinished = false; + + // input flags/metadata + this._palette = []; + this._colorType = 0; + + this._chunks = {}; + this._chunks[constants.TYPE_IHDR] = this._handleIHDR.bind(this); + this._chunks[constants.TYPE_IEND] = this._handleIEND.bind(this); + this._chunks[constants.TYPE_IDAT] = this._handleIDAT.bind(this); + this._chunks[constants.TYPE_PLTE] = this._handlePLTE.bind(this); + this._chunks[constants.TYPE_tRNS] = this._handleTRNS.bind(this); + this._chunks[constants.TYPE_gAMA] = this._handleGAMA.bind(this); + + this.read = dependencies.read; + this.error = dependencies.error; + this.metadata = dependencies.metadata; + this.gamma = dependencies.gamma; + this.transColor = dependencies.transColor; + this.palette = dependencies.palette; + this.parsed = dependencies.parsed; + this.inflateData = dependencies.inflateData; + this.finished = dependencies.finished; + this.simpleTransparency = dependencies.simpleTransparency; + this.headersFinished = dependencies.headersFinished || function() {}; +}; + +Parser.prototype.start = function() { + this.read(constants.PNG_SIGNATURE.length, + this._parseSignature.bind(this) + ); +}; + +Parser.prototype._parseSignature = function(data) { + + var signature = constants.PNG_SIGNATURE; + + for (var i = 0; i < signature.length; i++) { + if (data[i] !== signature[i]) { + this.error(new Error('Invalid file signature')); + return; + } + } + this.read(8, this._parseChunkBegin.bind(this)); +}; + +Parser.prototype._parseChunkBegin = function(data) { + + // chunk content length + var length = data.readUInt32BE(0); + + // chunk type + var type = data.readUInt32BE(4); + var name = ''; + for (var i = 4; i < 8; i++) { + name += String.fromCharCode(data[i]); + } + + //console.log('chunk ', name, length); + + // chunk flags + var ancillary = Boolean(data[4] & 0x20); // or critical + // priv = Boolean(data[5] & 0x20), // or public + // safeToCopy = Boolean(data[7] & 0x20); // or unsafe + + if (!this._hasIHDR && type !== constants.TYPE_IHDR) { + this.error(new Error('Expected IHDR on beggining')); + return; + } + + this._crc = new CrcCalculator(); + this._crc.write(new Buffer(name)); + + if (this._chunks[type]) { + return this._chunks[type](length); + } + + if (!ancillary) { + this.error(new Error('Unsupported critical chunk type ' + name)); + return; + } + + this.read(length + 4, this._skipChunk.bind(this)); +}; + +Parser.prototype._skipChunk = function(/*data*/) { + this.read(8, this._parseChunkBegin.bind(this)); +}; + +Parser.prototype._handleChunkEnd = function() { + this.read(4, this._parseChunkEnd.bind(this)); +}; + +Parser.prototype._parseChunkEnd = function(data) { + + var fileCrc = data.readInt32BE(0); + var calcCrc = this._crc.crc32(); + + // check CRC + if (this._options.checkCRC && calcCrc !== fileCrc) { + this.error(new Error('Crc error - ' + fileCrc + ' - ' + calcCrc)); + return; + } + + if (!this._hasIEND) { + this.read(8, this._parseChunkBegin.bind(this)); + } +}; + +Parser.prototype._handleIHDR = function(length) { + this.read(length, this._parseIHDR.bind(this)); +}; +Parser.prototype._parseIHDR = function(data) { + + this._crc.write(data); + + var width = data.readUInt32BE(0); + var height = data.readUInt32BE(4); + var depth = data[8]; + var colorType = data[9]; // bits: 1 palette, 2 color, 4 alpha + var compr = data[10]; + var filter = data[11]; + var interlace = data[12]; + + // console.log(' width', width, 'height', height, + // 'depth', depth, 'colorType', colorType, + // 'compr', compr, 'filter', filter, 'interlace', interlace + // ); + + if (depth !== 8 && depth !== 4 && depth !== 2 && depth !== 1 && depth !== 16) { + this.error(new Error('Unsupported bit depth ' + depth)); + return; + } + if (!(colorType in constants.COLORTYPE_TO_BPP_MAP)) { + this.error(new Error('Unsupported color type')); + return; + } + if (compr !== 0) { + this.error(new Error('Unsupported compression method')); + return; + } + if (filter !== 0) { + this.error(new Error('Unsupported filter method')); + return; + } + if (interlace !== 0 && interlace !== 1) { + this.error(new Error('Unsupported interlace method')); + return; + } + + this._colorType = colorType; + + var bpp = constants.COLORTYPE_TO_BPP_MAP[this._colorType]; + + this._hasIHDR = true; + + this.metadata({ + width: width, + height: height, + depth: depth, + interlace: Boolean(interlace), + palette: Boolean(colorType & constants.COLORTYPE_PALETTE), + color: Boolean(colorType & constants.COLORTYPE_COLOR), + alpha: Boolean(colorType & constants.COLORTYPE_ALPHA), + bpp: bpp, + colorType: colorType + }); + + this._handleChunkEnd(); +}; + + +Parser.prototype._handlePLTE = function(length) { + this.read(length, this._parsePLTE.bind(this)); +}; +Parser.prototype._parsePLTE = function(data) { + + this._crc.write(data); + + var entries = Math.floor(data.length / 3); + // console.log('Palette:', entries); + + for (var i = 0; i < entries; i++) { + this._palette.push([ + data[i * 3], + data[i * 3 + 1], + data[i * 3 + 2], + 0xff + ]); + } + + this.palette(this._palette); + + this._handleChunkEnd(); +}; + +Parser.prototype._handleTRNS = function(length) { + this.simpleTransparency(); + this.read(length, this._parseTRNS.bind(this)); +}; +Parser.prototype._parseTRNS = function(data) { + + this._crc.write(data); + + // palette + if (this._colorType === constants.COLORTYPE_PALETTE_COLOR) { + if (this._palette.length === 0) { + this.error(new Error('Transparency chunk must be after palette')); + return; + } + if (data.length > this._palette.length) { + this.error(new Error('More transparent colors than palette size')); + return; + } + for (var i = 0; i < data.length; i++) { + this._palette[i][3] = data[i]; + } + this.palette(this._palette); + } + + // for colorType 0 (grayscale) and 2 (rgb) + // there might be one gray/color defined as transparent + if (this._colorType === constants.COLORTYPE_GRAYSCALE) { + // grey, 2 bytes + this.transColor([data.readUInt16BE(0)]); + } + if (this._colorType === constants.COLORTYPE_COLOR) { + this.transColor([data.readUInt16BE(0), data.readUInt16BE(2), data.readUInt16BE(4)]); + } + + this._handleChunkEnd(); +}; + +Parser.prototype._handleGAMA = function(length) { + this.read(length, this._parseGAMA.bind(this)); +}; +Parser.prototype._parseGAMA = function(data) { + + this._crc.write(data); + this.gamma(data.readUInt32BE(0) / constants.GAMMA_DIVISION); + + this._handleChunkEnd(); +}; + +Parser.prototype._handleIDAT = function(length) { + if (!this._emittedHeadersFinished) { + this._emittedHeadersFinished = true; + this.headersFinished(); + } + this.read(-length, this._parseIDAT.bind(this, length)); +}; +Parser.prototype._parseIDAT = function(length, data) { + + this._crc.write(data); + + if (this._colorType === constants.COLORTYPE_PALETTE_COLOR && this._palette.length === 0) { + throw new Error('Expected palette not found'); + } + + this.inflateData(data); + var leftOverLength = length - data.length; + + if (leftOverLength > 0) { + this._handleIDAT(leftOverLength); + } + else { + this._handleChunkEnd(); + } +}; + +Parser.prototype._handleIEND = function(length) { + this.read(length, this._parseIEND.bind(this)); +}; +Parser.prototype._parseIEND = function(data) { + + this._crc.write(data); + + this._hasIEND = true; + this._handleChunkEnd(); + + if (this.finished) { + this.finished(); + } +}; diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/png-sync.js b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/png-sync.js new file mode 100644 index 00000000..81d04a46 --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/png-sync.js @@ -0,0 +1,16 @@ +'use strict'; + + +var parse = require('./parser-sync'); +var pack = require('./packer-sync'); + + +exports.read = function(buffer, options) { + + return parse(buffer, options || {}); +}; + +exports.write = function(png, options) { + + return pack(png, options); +}; diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/png.js b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/png.js new file mode 100644 index 00000000..1e407a77 --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/png.js @@ -0,0 +1,173 @@ +'use strict'; + +var util = require('util'); +var Stream = require('stream'); +var Parser = require('./parser-async'); +var Packer = require('./packer-async'); +var PNGSync = require('./png-sync'); + + +var PNG = exports.PNG = function(options) { + Stream.call(this); + + options = options || {}; // eslint-disable-line no-param-reassign + + // coerce pixel dimensions to integers (also coerces undefined -> 0): + this.width = options.width | 0; + this.height = options.height | 0; + + this.data = this.width > 0 && this.height > 0 ? + new Buffer(4 * this.width * this.height) : null; + + if (options.fill && this.data) { + this.data.fill(0); + } + + this.gamma = 0; + this.readable = this.writable = true; + + this._parser = new Parser(options); + + this._parser.on('error', this.emit.bind(this, 'error')); + this._parser.on('close', this._handleClose.bind(this)); + this._parser.on('metadata', this._metadata.bind(this)); + this._parser.on('gamma', this._gamma.bind(this)); + this._parser.on('parsed', function(data) { + this.data = data; + this.emit('parsed', data); + }.bind(this)); + + this._packer = new Packer(options); + this._packer.on('data', this.emit.bind(this, 'data')); + this._packer.on('end', this.emit.bind(this, 'end')); + this._parser.on('close', this._handleClose.bind(this)); + this._packer.on('error', this.emit.bind(this, 'error')); + +}; +util.inherits(PNG, Stream); + +PNG.sync = PNGSync; + +PNG.prototype.pack = function() { + + if (!this.data || !this.data.length) { + this.emit('error', 'No data provided'); + return this; + } + + process.nextTick(function() { + this._packer.pack(this.data, this.width, this.height, this.gamma); + }.bind(this)); + + return this; +}; + + +PNG.prototype.parse = function(data, callback) { + + if (callback) { + var onParsed, onError; + + onParsed = function(parsedData) { + this.removeListener('error', onError); + + this.data = parsedData; + callback(null, this); + }.bind(this); + + onError = function(err) { + this.removeListener('parsed', onParsed); + + callback(err, null); + }.bind(this); + + this.once('parsed', onParsed); + this.once('error', onError); + } + + this.end(data); + return this; +}; + +PNG.prototype.write = function(data) { + this._parser.write(data); + return true; +}; + +PNG.prototype.end = function(data) { + this._parser.end(data); +}; + +PNG.prototype._metadata = function(metadata) { + this.width = metadata.width; + this.height = metadata.height; + + this.emit('metadata', metadata); +}; + +PNG.prototype._gamma = function(gamma) { + this.gamma = gamma; +}; + +PNG.prototype._handleClose = function() { + if (!this._parser.writable && !this._packer.readable) { + this.emit('close'); + } +}; + + +PNG.bitblt = function(src, dst, srcX, srcY, width, height, deltaX, deltaY) { // eslint-disable-line max-params + // coerce pixel dimensions to integers (also coerces undefined -> 0): + /* eslint-disable no-param-reassign */ + srcX |= 0; + srcY |= 0; + width |= 0; + height |= 0; + deltaX |= 0; + deltaY |= 0; + /* eslint-enable no-param-reassign */ + + if (srcX > src.width || srcY > src.height || srcX + width > src.width || srcY + height > src.height) { + throw new Error('bitblt reading outside image'); + } + + if (deltaX > dst.width || deltaY > dst.height || deltaX + width > dst.width || deltaY + height > dst.height) { + throw new Error('bitblt writing outside image'); + } + + for (var y = 0; y < height; y++) { + src.data.copy(dst.data, + ((deltaY + y) * dst.width + deltaX) << 2, + ((srcY + y) * src.width + srcX) << 2, + ((srcY + y) * src.width + srcX + width) << 2 + ); + } +}; + + +PNG.prototype.bitblt = function(dst, srcX, srcY, width, height, deltaX, deltaY) { // eslint-disable-line max-params + + PNG.bitblt(this, dst, srcX, srcY, width, height, deltaX, deltaY); + return this; +}; + +PNG.adjustGamma = function(src) { + if (src.gamma) { + for (var y = 0; y < src.height; y++) { + for (var x = 0; x < src.width; x++) { + var idx = (src.width * y + x) << 2; + + for (var i = 0; i < 3; i++) { + var sample = src.data[idx + i] / 255; + sample = Math.pow(sample, 1 / 2.2 / src.gamma); + src.data[idx + i] = Math.round(sample * 255); + } + } + } + src.gamma = 0; + } +}; + +PNG.prototype.adjustGamma = function() { + PNG.adjustGamma(this); +}; diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/sync-inflate.js b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/sync-inflate.js new file mode 100644 index 00000000..87c19a1d --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/sync-inflate.js @@ -0,0 +1,161 @@ +'use strict'; + +var assert = require('assert').ok; +var zlib = require('zlib'); +var util = require('util'); + +var kMaxLength = require('buffer').kMaxLength; + +function Inflate(opts) { + if (!(this instanceof Inflate)) { + return new Inflate(opts); + } + + if (opts && opts.chunkSize < zlib.Z_MIN_CHUNK) { + opts.chunkSize = zlib.Z_MIN_CHUNK; + } + + zlib.Inflate.call(this, opts); + + // Node 8 --> 9 compatibility check + this._offset = this._offset === undefined ? this._outOffset : this._offset; + this._buffer = this._buffer || this._outBuffer; + + if (opts && opts.maxLength != null) { + this._maxLength = opts.maxLength; + } +} + +function createInflate(opts) { + return new Inflate(opts); +} + +function _close(engine, callback) { + if (callback) { + process.nextTick(callback); + } + + // Caller may invoke .close after a zlib error (which will null _handle). + if (!engine._handle) { + return; + } + + engine._handle.close(); + engine._handle = null; +} + +Inflate.prototype._processChunk = function(chunk, flushFlag, asyncCb) { + if (typeof asyncCb === 'function') { + return zlib.Inflate._processChunk.call(this, chunk, flushFlag, asyncCb); + } + + var self = this; + + var availInBefore = chunk && chunk.length; + var availOutBefore = this._chunkSize - this._offset; + var leftToInflate = this._maxLength; + var inOff = 0; + + var buffers = []; + var nread = 0; + + var error; + this.on('error', function(err) { + error = err; + }); + + function handleChunk(availInAfter, availOutAfter) { + if (self._hadError) { + return; + } + + var have = availOutBefore - availOutAfter; + assert(have >= 0, 'have should not go down'); + + if (have > 0) { + var out = self._buffer.slice(self._offset, self._offset + have); + self._offset += have; + + if (out.length > leftToInflate) { + out = out.slice(0, leftToInflate); + } + + buffers.push(out); + nread += out.length; + leftToInflate -= out.length; + + if (leftToInflate === 0) { + return false; + } + } + + if (availOutAfter === 0 || self._offset >= self._chunkSize) { + availOutBefore = self._chunkSize; + self._offset = 0; + self._buffer = Buffer.allocUnsafe(self._chunkSize); + } + + if (availOutAfter === 0) { + inOff += (availInBefore - availInAfter); + availInBefore = availInAfter; + + return true; + } + + return false; + } + + assert(this._handle, 'zlib binding closed'); + do { + var res = this._handle.writeSync(flushFlag, + chunk, // in + inOff, // in_off + availInBefore, // in_len + this._buffer, // out + this._offset, //out_off + availOutBefore); // out_len + // Node 8 --> 9 compatibility check + res = res || this._writeState; + } while (!this._hadError && handleChunk(res[0], res[1])); + + if (this._hadError) { + throw error; + } + + if (nread >= kMaxLength) { + _close(this); + throw new RangeError('Cannot create final Buffer. It would be larger than 0x' + kMaxLength.toString(16) + ' bytes'); + } + + var buf = Buffer.concat(buffers, nread); + _close(this); + + return buf; +}; + +util.inherits(Inflate, zlib.Inflate); + +function zlibBufferSync(engine, buffer) { + if (typeof buffer === 'string') { + buffer = Buffer.from(buffer); + } + if (!(buffer instanceof Buffer)) { + throw new TypeError('Not a string or buffer'); + } + + var flushFlag = engine._finishFlushFlag; + if (flushFlag == null) { + flushFlag = zlib.Z_FINISH; + } + + return engine._processChunk(buffer, flushFlag); +} + +function inflateSync(buffer, opts) { + return zlibBufferSync(new Inflate(opts), buffer); +} + +module.exports = exports = inflateSync; +exports.Inflate = Inflate; +exports.createInflate = createInflate; +exports.inflateSync = inflateSync; diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/sync-reader.js b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/sync-reader.js new file mode 100644 index 00000000..70ee2db0 --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/lib/sync-reader.js @@ -0,0 +1,51 @@ +'use strict'; + +var SyncReader = module.exports = function(buffer) { + + this._buffer = buffer; + this._reads = []; +}; + +SyncReader.prototype.read = function(length, callback) { + + this._reads.push({ + length: Math.abs(length), // if length < 0 then at most this length + allowLess: length < 0, + func: callback + }); +}; + +SyncReader.prototype.process = function() { + + // as long as there is any data and read requests + while (this._reads.length > 0 && this._buffer.length) { + + var read = this._reads[0]; + + if (this._buffer.length && (this._buffer.length >= read.length || read.allowLess)) { + + // ok there is any data so that we can satisfy this request + this._reads.shift(); // == read + + var buf = this._buffer; + + this._buffer = buf.slice(read.length); + + read.func.call(this, buf.slice(0, read.length)); + + } + else { + break; + } + + } + + if (this._reads.length > 0) { + return new Error('There are some read requests waitng on finished stream'); + } + + if (this._buffer.length > 0) { + return new Error('unrecognised content at end of stream'); + } + +}; diff --git a/project starter code/node_modules/pixelmatch/node_modules/pngjs/package.json b/project starter code/node_modules/pixelmatch/node_modules/pngjs/package.json new file mode 100644 index 00000000..998c9d60 --- /dev/null +++ b/project starter code/node_modules/pixelmatch/node_modules/pngjs/package.json @@ -0,0 +1,70 @@ +{ + "name": "pngjs", + "version": "3.4.0", + "description": "PNG encoder/decoder in pure JS, supporting any bit size & interlace, async & sync with full test suite.", + "contributors": [ + "Alexandre Paré", + "Gaurav Mali", + "Gusts Kaksis", + "Kuba Niegowski", + "Luke Page", + "Pietajan De Potter", + "Steven Sojka", + "liangzeng", + "Michael Vogt", + "Xin-Xin Wang", + "toriningen", + "Eugene Kulabuhov" + ], + "homepage": "https://github.com/lukeapage/pngjs", + "keywords": [ + "PNG", + "decoder", + "encoder", + "js-png", + "node-png", + "parser", + "png", + "png-js", + "png-parse", + "pngjs" + ], + "engines": { + "node": ">=4.0.0" + }, + "main": "./lib/png.js", + "directories": { + "lib": "lib", + "example": "examples", + "test": "test" + }, + "scripts": { + "build": "npm run prepublish", + "prepublish": "npm run browserify", + "browserify": "browserify lib/png.js --standalone png > browser.js", + "coverage": "istanbul -- cover node_modules/tape/bin/tape test/*-spec.js nolarge", + "coverage-report": "npm run coverage && istanbul report html", + "coveralls": "cat ./coverage/lcov.info | coveralls", + "test": "npm run lint && tape test/*-spec.js | tap-dot && node test/run-compare", + "lint": "eslint lib" + }, + "repository": { + "type": "git", + "url": "git://github.com/lukeapage/pngjs2.git" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/lukeapage/pngjs2/issues" + }, + "devDependencies": { + "browserify": "^14.5.0", + "buffer-equal": "1.0.0", + "connect": "^3.4.0", + "eslint": "^4.1.0", + "istanbul": "^0.4.4", + "phantomjs-prebuilt": "^2.1.7", + "serve-static": "^1.10.0", + "tap-dot": "^2.0.0", + "tape": "^4.0.2" + } +} diff --git a/project starter code/node_modules/pngjs/yarn.lock b/project starter code/node_modules/pixelmatch/node_modules/pngjs/yarn.lock similarity index 100% rename from project starter code/node_modules/pngjs/yarn.lock rename to project starter code/node_modules/pixelmatch/node_modules/pngjs/yarn.lock diff --git a/project starter code/node_modules/pngjs/README.md b/project starter code/node_modules/pngjs/README.md index fcd2f0db..2aef03d9 100644 --- a/project starter code/node_modules/pngjs/README.md +++ b/project starter code/node_modules/pngjs/README.md @@ -1,63 +1,55 @@ -[![Build Status](https://travis-ci.org/lukeapage/pngjs.svg?branch=master)](https://travis-ci.org/lukeapage/pngjs) [![Build status](https://ci.appveyor.com/api/projects/status/tb8418jql1trkntd/branch/master?svg=true)](https://ci.appveyor.com/project/lukeapage/pngjs2/branch/master) [![Coverage Status](https://coveralls.io/repos/lukeapage/pngjs2/badge.svg?branch=master&service=github)](https://coveralls.io/github/lukeapage/pngjs2?branch=master) [![npm version](https://badge.fury.io/js/pngjs.svg)](http://badge.fury.io/js/pngjs) +[![Build Status](https://travis-ci.com/lukeapage/pngjs.svg?branch=master)](https://travis-ci.com/lukeapage/pngjs) [![Build status](https://ci.appveyor.com/api/projects/status/qo5x8ayutr028108/branch/master?svg=true)](https://ci.appveyor.com/project/lukeapage/pngjs/branch/master) [![codecov](https://codecov.io/gh/lukeapage/pngjs/branch/master/graph/badge.svg)](https://codecov.io/gh/lukeapage/pngjs) [![npm version](https://badge.fury.io/js/pngjs.svg)](http://badge.fury.io/js/pngjs) -pngjs -======== +# pngjs -[![Greenkeeper badge](https://badges.greenkeeper.io/lukeapage/pngjs.svg)](https://greenkeeper.io/) Simple PNG encoder/decoder for Node.js with no dependencies. Based on the original [pngjs](https://github.com/niegowski/node-pngjs) with the follow enhancements. - * Support for reading 1,2,4 & 16 bit files - * Support for reading interlace files - * Support for reading `tTRNS` transparent colours - * Support for writing colortype 0 (grayscale), colortype 2 (RGB), colortype 4 (grayscale alpha) and colortype 6 (RGBA) - * Sync interface as well as async - * API compatible with pngjs and node-pngjs +- Support for reading 1,2,4 & 16 bit files +- Support for reading interlace files +- Support for reading `tTRNS` transparent colours +- Support for writing colortype 0 (grayscale), colortype 2 (RGB), colortype 4 (grayscale alpha) and colortype 6 (RGBA) +- Sync interface as well as async +- API compatible with pngjs and node-pngjs Known lack of support for: - * Extended PNG e.g. Animation - * Writing in colortype 3 (indexed color) +- Extended PNG e.g. Animation +- Writing in colortype 3 (indexed color) # Table of Contents -* [Requirements](#requirements) -* [Comparison Table](#comparison-table) -* [Tests](#tests) -* [Installation](#installation) -* [Browser](#browser) -* [Example](#example) -* [Async API](#async-api) -* [Sync API](#sync-api) -* [Changelog](#changelog) - -Requirements -============ - -* Node.js v4 (use older v2.3.0 for 0.10/0.12/iojs support) - -Comparison Table -================ - -Name | Forked From | Sync | Async | 16 Bit | 1/2/4 Bit | Interlace | Gamma | Encodes | Tested ----------|--------------|------|-------|--------|-----------|-----------|-------|---------|-------- -pngjs | | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes -node-png | pngjs | No | Yes | No | No | No | Hidden| Yes | Manual -png-coder| pngjs | No | Yes | Yes | No | No | Hidden| Yes | Manual -pngparse | | No | Yes | No | Yes | No | No | No | Yes -pngparse-sync | pngparse| Yes | No | No | Yes | No | No | No | Yes -png-async| | No | Yes | No | No | No | No | Yes | Yes -png-js | | No | Yes | No | No | No | No | No | No +- [Requirements](#requirements) +- [Comparison Table](#comparison-table) +- [Tests](#tests) +- [Installation](#installation) +- [Browser](#browser) +- [Example](#example) +- [Async API](#async-api) +- [Sync API](#sync-api) +- [Changelog](#changelog) + +# Comparison Table + +| Name | Forked From | Sync | Async | 16 Bit | 1/2/4 Bit | Interlace | Gamma | Encodes | Tested | +| ------------- | ----------- | ---- | ----- | ------ | --------- | --------- | ------ | ------- | ------ | +| pngjs | | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | +| node-png | pngjs | No | Yes | No | No | No | Hidden | Yes | Manual | +| png-coder | pngjs | No | Yes | Yes | No | No | Hidden | Yes | Manual | +| pngparse | | No | Yes | No | Yes | No | No | No | Yes | +| pngparse-sync | pngparse | Yes | No | No | Yes | No | No | No | Yes | +| png-async | | No | Yes | No | No | No | No | Yes | Yes | +| png-js | | No | Yes | No | No | No | No | No | No | Native C++ node decoders: - * png - * png-sync (sync version of above) - * pixel-png - * png-img -Tests -===== +- png +- png-sync (sync version of above) +- pixel-png +- png-img + +# Tests Tested using [PNG Suite](http://www.schaik.com/pngsuite/). We read every file into pngjs, output it in standard 8bit colour, synchronously and asynchronously, then compare the original with the newly saved images. @@ -65,67 +57,67 @@ To run the tests, fetch the repo (tests are not distributed via npm) and install The only thing not converted is gamma correction - this is because multiple vendors will do gamma correction differently, so the tests will have different results on different browsers. -In addition we use a tolerance of 3 for 16 bit images in PhantomJS because PhantomJS seems to have non-compliant rules for downscaling 16 bit images. +# Installation -Installation -=============== ``` $ npm install pngjs --save ``` -Browser -=========== +# Browser + The package has been build with a [Browserify](browserify.org) version (`npm run browserify`) and you can use the browser version by including in your code: ``` import { PNG } from 'pngjs/browser'; ``` -Example -========== +# Example + ```js -var fs = require('fs'), - PNG = require('pngjs').PNG; - -fs.createReadStream('in.png') - .pipe(new PNG({ - filterType: 4 - })) - .on('parsed', function() { - - for (var y = 0; y < this.height; y++) { - for (var x = 0; x < this.width; x++) { - var idx = (this.width * y + x) << 2; - - // invert color - this.data[idx] = 255 - this.data[idx]; - this.data[idx+1] = 255 - this.data[idx+1]; - this.data[idx+2] = 255 - this.data[idx+2]; - - // and reduce opacity - this.data[idx+3] = this.data[idx+3] >> 1; - } - } - - this.pack().pipe(fs.createWriteStream('out.png')); - }); +var fs = require("fs"), + PNG = require("pngjs").PNG; + +fs.createReadStream("in.png") + .pipe( + new PNG({ + filterType: 4, + }) + ) + .on("parsed", function () { + for (var y = 0; y < this.height; y++) { + for (var x = 0; x < this.width; x++) { + var idx = (this.width * y + x) << 2; + + // invert color + this.data[idx] = 255 - this.data[idx]; + this.data[idx + 1] = 255 - this.data[idx + 1]; + this.data[idx + 2] = 255 - this.data[idx + 2]; + + // and reduce opacity + this.data[idx + 3] = this.data[idx + 3] >> 1; + } + } + + this.pack().pipe(fs.createWriteStream("out.png")); + }); ``` + For more examples see `examples` folder. -Async API -================ +# Async API As input any color type is accepted (grayscale, rgb, palette, grayscale with alpha, rgb with alpha) but 8 bit per sample (channel) is the only supported bit depth. Interlaced mode is not supported. ## Class: PNG -`PNG` is readable and writable `Stream`. +`PNG` is readable and writable `Stream`. ### Options + - `width` - use this with `height` if you want to create png from scratch - `height` - as above - `checkCRC` - whether parser should be strict about checksums in source stream (default: `true`) -- `deflateChunkSize` - chunk size used for deflating data chunks, this should be power of 2 and must not be less than 256 and more than 32*1024 (default: 32 kB) +- `deflateChunkSize` - chunk size used for deflating data chunks, this should be power of 2 and must not be less than 256 and more than 32\*1024 (default: 32 kB) - `deflateLevel` - compression level for deflate (default: 9) - `deflateStrategy` - compression strategy for deflate (default: 3) - `deflateFactory` - deflate stream factory (default: `zlib.createDeflate`) @@ -133,15 +125,16 @@ As input any color type is accepted (grayscale, rgb, palette, grayscale with alp - `colorType` - the output colorType - see constants. 0 = grayscale, no alpha, 2 = color, no alpha, 4 = grayscale & alpha, 6 = color & alpha. Default currently 6, but in the future may calculate best mode. - `inputColorType` - the input colorType - see constants. Default is 6 (RGBA) - `bitDepth` - the bitDepth of the output, 8 or 16 bits. Input data is expected to have this bit depth. -16 bit data is expected in the system endianness (Default: 8) + 16 bit data is expected in the system endianness (Default: 8) - `inputHasAlpha` - whether the input bitmap has 4 bytes per pixel (rgb and alpha) or 3 (rgb - no alpha). - `bgColor` - an object containing red, green, and blue values between 0 and 255 -that is used when packing a PNG if alpha is not to be included (default: 255,255,255) - + that is used when packing a PNG if alpha is not to be included (default: 255,255,255) ### Event "metadata" + `function(metadata) { }` Image's header has been parsed, metadata contains this information: + - `width` image size in pixels - `height` image size in pixels - `palette` image is paletted @@ -149,17 +142,17 @@ Image's header has been parsed, metadata contains this information: - `alpha` image contains alpha channel - `interlace` image is interlaced - ### Event: "parsed" + `function(data) { }` Input image has been completely parsed, `data` is complete and ready for modification. - ### Event: "error" -`function(error) { }` +`function(error) { }` ### png.parse(data, [callback]) + Parses PNG file data. Can be `String` or `Buffer`. Alternatively you can stream data to instance of PNG. Optional `callback` is once called on `error` or `parsed`. The callback gets @@ -168,36 +161,39 @@ two arguments `(err, data)`. Returns `this` for method chaining. #### Example + ```js -new PNG({ filterType:4 }).parse( imageData, function(error, data) -{ - console.log(error, data) +new PNG({ filterType: 4 }).parse(imageData, function (error, data) { + console.log(error, data); }); ``` ### png.pack() + Starts converting data to PNG file Stream. Returns `this` for method chaining. - ### png.bitblt(dst, sx, sy, w, h, dx, dy) + Helper for image manipulation, copies a rectangle of pixels from current (i.e. the source) image (`sx`, `sy`, `w`, `h`) to `dst` image (at `dx`, `dy`). Returns `this` for method chaining. For example, the following code copies the top-left 100x50 px of `in.png` into dst and writes it to `out.png`: + ```js -var dst = new PNG({width: 100, height: 50}); -fs.createReadStream('in.png') - .pipe(new PNG()) - .on('parsed', function() { - this.bitblt(dst, 0, 0, 100, 50, 0, 0); - dst.pack().pipe(fs.createWriteStream('out.png')); - }); +var dst = new PNG({ width: 100, height: 50 }); +fs.createReadStream("in.png") + .pipe(new PNG()) + .on("parsed", function () { + this.bitblt(dst, 0, 0, 100, 50, 0, 0); + dst.pack().pipe(fs.createWriteStream("out.png")); + }); ``` ### Property: adjustGamma() + Helper that takes data and adjusts it to be gamma corrected. Note that it is not 100% reliable with transparent colours because that requires knowing the background colour the bitmap is rendered on to. In tests against PNG suite it compared 100% with chrome on all 8 bit and below images. On IE there were some differences. @@ -205,27 +201,28 @@ In tests against PNG suite it compared 100% with chrome on all 8 bit and below i The following example reads a file, adjusts the gamma (which sets the gamma to 0) and writes it out again, effectively removing any gamma correction from the image. ```js -fs.createReadStream('in.png') - .pipe(new PNG()) - .on('parsed', function() { - this.adjustGamma(); - this.pack().pipe(fs.createWriteStream('out.png')); - }); +fs.createReadStream("in.png") + .pipe(new PNG()) + .on("parsed", function () { + this.adjustGamma(); + this.pack().pipe(fs.createWriteStream("out.png")); + }); ``` ### Property: width -Width of image in pixels +Width of image in pixels ### Property: height -Height of image in pixels +Height of image in pixels ### Property: data -Buffer of image pixel data. Every pixel consists 4 bytes: R, G, B, A (opacity). +Buffer of image pixel data. Every pixel consists 4 bytes: R, G, B, A (opacity). ### Property: gamma + Gamma of image (0 if not specified) ## Packing a PNG and removing alpha (RGBA to RGB) @@ -235,21 +232,23 @@ convert each pixel's transparency to the appropriate RGB value. By default, pngj the image against a white background. You can override this in the options: ```js -var fs = require('fs'), - PNG = require('pngjs').PNG; - -fs.createReadStream('in.png') - .pipe(new PNG({ - colorType: 2, - bgColor: { - red: 0, - green: 255, - blue: 0 - } - })) - .on('parsed', function() { - this.pack().pipe(fs.createWriteStream('out.png')); - }); +var fs = require("fs"), + PNG = require("pngjs").PNG; + +fs.createReadStream("in.png") + .pipe( + new PNG({ + colorType: 2, + bgColor: { + red: 0, + green: 255, + blue: 0, + }, + }) + ) + .on("parsed", function () { + this.pack().pipe(fs.createWriteStream("out.png")); + }); ``` # Sync API @@ -287,9 +286,32 @@ var png = PNG.sync.read(data); PNG.adjustGamma(png); ``` +# Changelog + +### 6.0.0 - 24/10/2020 + +- BREAKING - Sync version now throws if there is unexpected content at the end of the stream. +- BREAKING - Drop support for node 10 (Though nothing incompatible in this release yet) +- Reduce the number of files included in the package + +### 5.1.0 - 13/09/2020 + +- Add option to skip rescaling + +### 5.0.0 - 15/04/2020 -Changelog -============ +- Drop support for Node 8 +- Browserified bundle may now contain ES20(15-20) code if the supported node version supports it. Please run the browserified version through babel if you need to support older browsers. + +### 4.0.1 - 15/04/2020 + +- Fix to possible null reference in nextTick of async method + +### 4.0.0 - 09/04/2020 + +- Fix issue in newer nodes with using Buffer +- Fix async issue with some png files +- Drop support for Node 4 & 6 ### 3.4.0 - 09/03/2019 @@ -319,62 +341,76 @@ Changelog - Support for encoding 8-bit grayscale images ### 3.1.0 - 30/04/2017 - - Support for pngs with zlib chunks that are malformed after valid data + +- Support for pngs with zlib chunks that are malformed after valid data ### 3.0.1 - 16/02/2017 - - Fix single pixel pngs + +- Fix single pixel pngs ### 3.0.0 - 03/08/2016 - - Drop support for node below v4 and iojs. Pin to 2.3.0 to use with old, unsupported or patched node versions. + +- Drop support for node below v4 and iojs. Pin to 2.3.0 to use with old, unsupported or patched node versions. ### 2.3.0 - 22/04/2016 - - Support for sync in node 0.10 + +- Support for sync in node 0.10 ### 2.2.0 - 04/12/2015 - - Add sync write api - - Fix newfile example - - Correct comparison table + +- Add sync write api +- Fix newfile example +- Correct comparison table ### 2.1.0 - 28/10/2015 - - rename package to pngjs - - added 'bgColor' option + +- rename package to pngjs +- added 'bgColor' option ### 2.0.0 - 08/10/2015 - - fixes to readme - - *breaking change* - bitblt on the png prototype now doesn't take a unused, unnecessary src first argument + +- fixes to readme +- _breaking change_ - bitblt on the png prototype now doesn't take a unused, unnecessary src first argument ### 1.2.0 - 13/09/2015 - - support passing colorType to write PNG's and writing bitmaps without alpha information + +- support passing colorType to write PNG's and writing bitmaps without alpha information ### 1.1.0 - 07/09/2015 - - support passing a deflate factory for controlled compression + +- support passing a deflate factory for controlled compression ### 1.0.2 - 22/08/2015 - - Expose all PNG creation info + +- Expose all PNG creation info ### 1.0.1 - 21/08/2015 - - Fix non square interlaced files + +- Fix non square interlaced files ### 1.0.0 - 08/08/2015 - - More tests - - source linted - - maintainability refactorings - - async API - exceptions in reading now emit warnings - - documentation improvement - sync api now documented, adjustGamma documented - - breaking change - gamma chunk is now written. previously a read then write would destroy gamma information, now it is persisted. + +- More tests +- source linted +- maintainability refactorings +- async API - exceptions in reading now emit warnings +- documentation improvement - sync api now documented, adjustGamma documented +- breaking change - gamma chunk is now written. previously a read then write would destroy gamma information, now it is persisted. ### 0.0.3 - 03/08/2015 - - Error handling fixes - - ignore files for smaller npm footprint + +- Error handling fixes +- ignore files for smaller npm footprint ### 0.0.2 - 02/08/2015 - - Bugfixes to interlacing, support for transparent colours + +- Bugfixes to interlacing, support for transparent colours ### 0.0.1 - 02/08/2015 - - Initial release, see pngjs for older changelog. -License -========= +- Initial release, see pngjs for older changelog. + +# License (The MIT License) diff --git a/project starter code/node_modules/pngjs/browser.js b/project starter code/node_modules/pngjs/browser.js index 72c92164..9b7a5c1d 100644 --- a/project starter code/node_modules/pngjs/browser.js +++ b/project starter code/node_modules/pngjs/browser.js @@ -1,21 +1,21 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.png = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i= data.length) { - throw new Error('Ran out of data'); + throw new Error("Ran out of data"); } - var pixel = data[rawPos]; + let pixel = data[rawPos]; pxData[pxPos] = pixel; pxData[pxPos + 1] = pixel; pxData[pxPos + 2] = pixel; @@ -38,9 +38,9 @@ var pixelBppMapper = [ // 3 - RGB // 0: 0, 1: 1, 2: 2, 3: 0xff - function(pxData, data, pxPos, rawPos) { + function (pxData, data, pxPos, rawPos) { if (rawPos + 2 >= data.length) { - throw new Error('Ran out of data'); + throw new Error("Ran out of data"); } pxData[pxPos] = data[rawPos]; @@ -51,26 +51,26 @@ var pixelBppMapper = [ // 4 - RGBA // 0: 0, 1: 1, 2: 2, 3: 3 - function(pxData, data, pxPos, rawPos) { + function (pxData, data, pxPos, rawPos) { if (rawPos + 3 >= data.length) { - throw new Error('Ran out of data'); + throw new Error("Ran out of data"); } pxData[pxPos] = data[rawPos]; pxData[pxPos + 1] = data[rawPos + 1]; pxData[pxPos + 2] = data[rawPos + 2]; pxData[pxPos + 3] = data[rawPos + 3]; - } + }, ]; -var pixelBppCustomMapper = [ +let pixelBppCustomMapper = [ // 0 - dummy entry - function() {}, + function () {}, // 1 - L // 0: 0, 1: 0, 2: 0, 3: 0xff - function(pxData, pixelData, pxPos, maxBit) { - var pixel = pixelData[0]; + function (pxData, pixelData, pxPos, maxBit) { + let pixel = pixelData[0]; pxData[pxPos] = pixel; pxData[pxPos + 1] = pixel; pxData[pxPos + 2] = pixel; @@ -79,8 +79,8 @@ var pixelBppCustomMapper = [ // 2 - LA // 0: 0, 1: 0, 2: 0, 3: 1 - function(pxData, pixelData, pxPos) { - var pixel = pixelData[0]; + function (pxData, pixelData, pxPos) { + let pixel = pixelData[0]; pxData[pxPos] = pixel; pxData[pxPos + 1] = pixel; pxData[pxPos + 2] = pixel; @@ -89,7 +89,7 @@ var pixelBppCustomMapper = [ // 3 - RGB // 0: 0, 1: 1, 2: 2, 3: 0xff - function(pxData, pixelData, pxPos, maxBit) { + function (pxData, pixelData, pxPos, maxBit) { pxData[pxPos] = pixelData[0]; pxData[pxPos + 1] = pixelData[1]; pxData[pxPos + 2] = pixelData[2]; @@ -98,33 +98,32 @@ var pixelBppCustomMapper = [ // 4 - RGBA // 0: 0, 1: 1, 2: 2, 3: 3 - function(pxData, pixelData, pxPos) { + function (pxData, pixelData, pxPos) { pxData[pxPos] = pixelData[0]; pxData[pxPos + 1] = pixelData[1]; pxData[pxPos + 2] = pixelData[2]; pxData[pxPos + 3] = pixelData[3]; - } + }, ]; function bitRetriever(data, depth) { - - var leftOver = []; - var i = 0; + let leftOver = []; + let i = 0; function split() { if (i === data.length) { - throw new Error('Ran out of data'); + throw new Error("Ran out of data"); } - var byte = data[i]; + let byte = data[i]; i++; - var byte8, byte7, byte6, byte5, byte4, byte3, byte2, byte1; + let byte8, byte7, byte6, byte5, byte4, byte3, byte2, byte1; switch (depth) { default: - throw new Error('unrecognised depth'); + throw new Error("unrecognised depth"); case 16: byte2 = data[i]; i++; - leftOver.push(((byte << 8) + byte2)); + leftOver.push((byte << 8) + byte2); break; case 4: byte2 = byte & 0x0f; @@ -133,52 +132,53 @@ function bitRetriever(data, depth) { break; case 2: byte4 = byte & 3; - byte3 = byte >> 2 & 3; - byte2 = byte >> 4 & 3; - byte1 = byte >> 6 & 3; + byte3 = (byte >> 2) & 3; + byte2 = (byte >> 4) & 3; + byte1 = (byte >> 6) & 3; leftOver.push(byte1, byte2, byte3, byte4); break; case 1: byte8 = byte & 1; - byte7 = byte >> 1 & 1; - byte6 = byte >> 2 & 1; - byte5 = byte >> 3 & 1; - byte4 = byte >> 4 & 1; - byte3 = byte >> 5 & 1; - byte2 = byte >> 6 & 1; - byte1 = byte >> 7 & 1; + byte7 = (byte >> 1) & 1; + byte6 = (byte >> 2) & 1; + byte5 = (byte >> 3) & 1; + byte4 = (byte >> 4) & 1; + byte3 = (byte >> 5) & 1; + byte2 = (byte >> 6) & 1; + byte1 = (byte >> 7) & 1; leftOver.push(byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8); break; } } return { - get: function(count) { + get: function (count) { while (leftOver.length < count) { split(); } - var returner = leftOver.slice(0, count); + let returner = leftOver.slice(0, count); leftOver = leftOver.slice(count); return returner; }, - resetAfterLine: function() { + resetAfterLine: function () { leftOver.length = 0; }, - end: function() { + end: function () { if (i !== data.length) { - throw new Error('extra data found'); + throw new Error("extra data found"); } - } + }, }; } -function mapImage8Bit(image, pxData, getPxPos, bpp, data, rawPos) { // eslint-disable-line max-params - var imageWidth = image.width; - var imageHeight = image.height; - var imagePass = image.index; - for (var y = 0; y < imageHeight; y++) { - for (var x = 0; x < imageWidth; x++) { - var pxPos = getPxPos(x, y, imagePass); +function mapImage8Bit(image, pxData, getPxPos, bpp, data, rawPos) { + // eslint-disable-line max-params + let imageWidth = image.width; + let imageHeight = image.height; + let imagePass = image.index; + for (let y = 0; y < imageHeight; y++) { + for (let x = 0; x < imageWidth; x++) { + let pxPos = getPxPos(x, y, imagePass); pixelBppMapper[bpp](pxData, data, pxPos, rawPos); rawPos += bpp; //eslint-disable-line no-param-reassign } @@ -186,89 +186,103 @@ function mapImage8Bit(image, pxData, getPxPos, bpp, data, rawPos) { // eslint-di return rawPos; } -function mapImageCustomBit(image, pxData, getPxPos, bpp, bits, maxBit) { // eslint-disable-line max-params - var imageWidth = image.width; - var imageHeight = image.height; - var imagePass = image.index; - for (var y = 0; y < imageHeight; y++) { - for (var x = 0; x < imageWidth; x++) { - var pixelData = bits.get(bpp); - var pxPos = getPxPos(x, y, imagePass); +function mapImageCustomBit(image, pxData, getPxPos, bpp, bits, maxBit) { + // eslint-disable-line max-params + let imageWidth = image.width; + let imageHeight = image.height; + let imagePass = image.index; + for (let y = 0; y < imageHeight; y++) { + for (let x = 0; x < imageWidth; x++) { + let pixelData = bits.get(bpp); + let pxPos = getPxPos(x, y, imagePass); pixelBppCustomMapper[bpp](pxData, pixelData, pxPos, maxBit); } bits.resetAfterLine(); } } -exports.dataToBitMap = function(data, bitmapInfo) { - - var width = bitmapInfo.width; - var height = bitmapInfo.height; - var depth = bitmapInfo.depth; - var bpp = bitmapInfo.bpp; - var interlace = bitmapInfo.interlace; +exports.dataToBitMap = function (data, bitmapInfo) { + let width = bitmapInfo.width; + let height = bitmapInfo.height; + let depth = bitmapInfo.depth; + let bpp = bitmapInfo.bpp; + let interlace = bitmapInfo.interlace; + let bits; if (depth !== 8) { - var bits = bitRetriever(data, depth); + bits = bitRetriever(data, depth); } - var pxData; + let pxData; if (depth <= 8) { - pxData = new Buffer(width * height * 4); - } - else { + pxData = Buffer.alloc(width * height * 4); + } else { pxData = new Uint16Array(width * height * 4); } - var maxBit = Math.pow(2, depth) - 1; - var rawPos = 0; - var images; - var getPxPos; + let maxBit = Math.pow(2, depth) - 1; + let rawPos = 0; + let images; + let getPxPos; if (interlace) { images = interlaceUtils.getImagePasses(width, height); getPxPos = interlaceUtils.getInterlaceIterator(width, height); - } - else { - var nonInterlacedPxPos = 0; - getPxPos = function() { - var returner = nonInterlacedPxPos; + } else { + let nonInterlacedPxPos = 0; + getPxPos = function () { + let returner = nonInterlacedPxPos; nonInterlacedPxPos += 4; return returner; }; images = [{ width: width, height: height }]; } - for (var imageIndex = 0; imageIndex < images.length; imageIndex++) { + for (let imageIndex = 0; imageIndex < images.length; imageIndex++) { if (depth === 8) { - rawPos = mapImage8Bit(images[imageIndex], pxData, getPxPos, bpp, data, rawPos); - } - else { - mapImageCustomBit(images[imageIndex], pxData, getPxPos, bpp, bits, maxBit); + rawPos = mapImage8Bit( + images[imageIndex], + pxData, + getPxPos, + bpp, + data, + rawPos + ); + } else { + mapImageCustomBit( + images[imageIndex], + pxData, + getPxPos, + bpp, + bits, + maxBit + ); } } if (depth === 8) { if (rawPos !== data.length) { - throw new Error('extra data found'); + throw new Error("extra data found"); } - } - else { + } else { bits.end(); } return pxData; }; -}).call(this,require("buffer").Buffer) -},{"./interlace":11,"buffer":32}],2:[function(require,module,exports){ -(function (Buffer){ -'use strict'; +}).call(this)}).call(this,require("buffer").Buffer) +},{"./interlace":11,"buffer":33}],2:[function(require,module,exports){ +(function (Buffer){(function (){ +"use strict"; -var constants = require('./constants'); +let constants = require("./constants"); -module.exports = function(dataIn, width, height, options) { - var outHasAlpha = [constants.COLORTYPE_COLOR_ALPHA, constants.COLORTYPE_ALPHA].indexOf(options.colorType) !== -1; +module.exports = function (dataIn, width, height, options) { + let outHasAlpha = + [constants.COLORTYPE_COLOR_ALPHA, constants.COLORTYPE_ALPHA].indexOf( + options.colorType + ) !== -1; if (options.colorType === options.inputColorType) { - var bigEndian = (function() { - var buffer = new ArrayBuffer(2); + let bigEndian = (function () { + let buffer = new ArrayBuffer(2); new DataView(buffer).setInt16(0, 256, true /* littleEndian */); // Int16Array uses the platform's endianness. return new Int16Array(buffer)[0] !== 256; @@ -280,24 +294,24 @@ module.exports = function(dataIn, width, height, options) { } // map to a UInt16 array if data is 16bit, fix endianness below - var data = options.bitDepth !== 16 ? dataIn : new Uint16Array(dataIn.buffer); + let data = options.bitDepth !== 16 ? dataIn : new Uint16Array(dataIn.buffer); - var maxValue = 255; - var inBpp = constants.COLORTYPE_TO_BPP_MAP[options.inputColorType]; + let maxValue = 255; + let inBpp = constants.COLORTYPE_TO_BPP_MAP[options.inputColorType]; if (inBpp === 4 && !options.inputHasAlpha) { inBpp = 3; } - var outBpp = constants.COLORTYPE_TO_BPP_MAP[options.colorType]; + let outBpp = constants.COLORTYPE_TO_BPP_MAP[options.colorType]; if (options.bitDepth === 16) { maxValue = 65535; outBpp *= 2; } - var outData = new Buffer(width * height * outBpp); + let outData = Buffer.alloc(width * height * outBpp); - var inIndex = 0; - var outIndex = 0; + let inIndex = 0; + let outIndex = 0; - var bgColor = options.bgColor || {}; + let bgColor = options.bgColor || {}; if (bgColor.red === undefined) { bgColor.red = maxValue; } @@ -309,10 +323,10 @@ module.exports = function(dataIn, width, height, options) { } function getRGBA() { - var red; - var green; - var blue; - var alpha = maxValue; + let red; + let green; + let blue; + let alpha = maxValue; switch (options.inputColorType) { case constants.COLORTYPE_COLOR_ALPHA: alpha = data[inIndex + 3]; @@ -337,23 +351,36 @@ module.exports = function(dataIn, width, height, options) { blue = red; break; default: - throw new Error('input color type:' + options.inputColorType + ' is not supported at present'); + throw new Error( + "input color type:" + + options.inputColorType + + " is not supported at present" + ); } if (options.inputHasAlpha) { if (!outHasAlpha) { alpha /= maxValue; - red = Math.min(Math.max(Math.round((1 - alpha) * bgColor.red + alpha * red), 0), maxValue); - green = Math.min(Math.max(Math.round((1 - alpha) * bgColor.green + alpha * green), 0), maxValue); - blue = Math.min(Math.max(Math.round((1 - alpha) * bgColor.blue + alpha * blue), 0), maxValue); + red = Math.min( + Math.max(Math.round((1 - alpha) * bgColor.red + alpha * red), 0), + maxValue + ); + green = Math.min( + Math.max(Math.round((1 - alpha) * bgColor.green + alpha * green), 0), + maxValue + ); + blue = Math.min( + Math.max(Math.round((1 - alpha) * bgColor.blue + alpha * blue), 0), + maxValue + ); } } return { red: red, green: green, blue: blue, alpha: alpha }; } - for (var y = 0; y < height; y++) { - for (var x = 0; x < width; x++) { - var rgba = getRGBA(data, inIndex); + for (let y = 0; y < height; y++) { + for (let x = 0; x < width; x++) { + let rgba = getRGBA(data, inIndex); switch (options.colorType) { case constants.COLORTYPE_COLOR_ALPHA: @@ -365,8 +392,7 @@ module.exports = function(dataIn, width, height, options) { if (outHasAlpha) { outData[outIndex + 3] = rgba.alpha; } - } - else { + } else { outData.writeUInt16BE(rgba.red, outIndex); outData.writeUInt16BE(rgba.green, outIndex + 2); outData.writeUInt16BE(rgba.blue, outIndex + 4); @@ -376,24 +402,24 @@ module.exports = function(dataIn, width, height, options) { } break; case constants.COLORTYPE_ALPHA: - case constants.COLORTYPE_GRAYSCALE: + case constants.COLORTYPE_GRAYSCALE: { // Convert to grayscale and alpha - var grayscale = (rgba.red + rgba.green + rgba.blue) / 3; + let grayscale = (rgba.red + rgba.green + rgba.blue) / 3; if (options.bitDepth === 8) { outData[outIndex] = grayscale; if (outHasAlpha) { outData[outIndex + 1] = rgba.alpha; } - } - else { + } else { outData.writeUInt16BE(grayscale, outIndex); if (outHasAlpha) { outData.writeUInt16BE(rgba.alpha, outIndex + 2); } } break; + } default: - throw new Error('unrecognised color Type ' + options.colorType); + throw new Error("unrecognised color Type " + options.colorType); } inIndex += inBpp; @@ -404,17 +430,15 @@ module.exports = function(dataIn, width, height, options) { return outData; }; -}).call(this,require("buffer").Buffer) -},{"./constants":4,"buffer":32}],3:[function(require,module,exports){ -(function (process,Buffer){ -'use strict'; - - -var util = require('util'); -var Stream = require('stream'); +}).call(this)}).call(this,require("buffer").Buffer) +},{"./constants":4,"buffer":33}],3:[function(require,module,exports){ +(function (process,Buffer){(function (){ +"use strict"; +let util = require("util"); +let Stream = require("stream"); -var ChunkStream = module.exports = function() { +let ChunkStream = (module.exports = function () { Stream.call(this); this._buffers = []; @@ -423,45 +447,43 @@ var ChunkStream = module.exports = function() { this._reads = []; this._paused = false; - this._encoding = 'utf8'; + this._encoding = "utf8"; this.writable = true; -}; +}); util.inherits(ChunkStream, Stream); - -ChunkStream.prototype.read = function(length, callback) { - +ChunkStream.prototype.read = function (length, callback) { this._reads.push({ length: Math.abs(length), // if length < 0 then at most this length allowLess: length < 0, - func: callback + func: callback, }); - process.nextTick(function() { - this._process(); + process.nextTick( + function () { + this._process(); - // its paused and there is not enought data then ask for more - if (this._paused && this._reads.length > 0) { - this._paused = false; + // its paused and there is not enought data then ask for more + if (this._paused && this._reads && this._reads.length > 0) { + this._paused = false; - this.emit('drain'); - } - }.bind(this)); + this.emit("drain"); + } + }.bind(this) + ); }; -ChunkStream.prototype.write = function(data, encoding) { - +ChunkStream.prototype.write = function (data, encoding) { if (!this.writable) { - this.emit('error', new Error('Stream not writable')); + this.emit("error", new Error("Stream not writable")); return false; } - var dataBuffer; + let dataBuffer; if (Buffer.isBuffer(data)) { dataBuffer = data; - } - else { - dataBuffer = new Buffer(data, encoding || this._encoding); + } else { + dataBuffer = Buffer.from(data, encoding || this._encoding); } this._buffers.push(dataBuffer); @@ -477,8 +499,7 @@ ChunkStream.prototype.write = function(data, encoding) { return this.writable && !this._paused; }; -ChunkStream.prototype.end = function(data, encoding) { - +ChunkStream.prototype.end = function (data, encoding) { if (data) { this.write(data, encoding); } @@ -493,8 +514,7 @@ ChunkStream.prototype.end = function(data, encoding) { // enqueue or handle end if (this._buffers.length === 0) { this._end(); - } - else { + } else { this._buffers.push(null); this._process(); } @@ -502,19 +522,15 @@ ChunkStream.prototype.end = function(data, encoding) { ChunkStream.prototype.destroySoon = ChunkStream.prototype.end; -ChunkStream.prototype._end = function() { - +ChunkStream.prototype._end = function () { if (this._reads.length > 0) { - this.emit('error', - new Error('Unexpected end of input') - ); + this.emit("error", new Error("Unexpected end of input")); } this.destroy(); }; -ChunkStream.prototype.destroy = function() { - +ChunkStream.prototype.destroy = function () { if (!this._buffers) { return; } @@ -523,26 +539,23 @@ ChunkStream.prototype.destroy = function() { this._reads = null; this._buffers = null; - this.emit('close'); + this.emit("close"); }; -ChunkStream.prototype._processReadAllowingLess = function(read) { +ChunkStream.prototype._processReadAllowingLess = function (read) { // ok there is any data so that we can satisfy this request this._reads.shift(); // == read // first we need to peek into first buffer - var smallerBuf = this._buffers[0]; + let smallerBuf = this._buffers[0]; // ok there is more data than we need if (smallerBuf.length > read.length) { - this._buffered -= read.length; this._buffers[0] = smallerBuf.slice(read.length); read.func.call(this, smallerBuf.slice(0, read.length)); - - } - else { + } else { // ok this is less than maximum length so use it all this._buffered -= smallerBuf.length; this._buffers.shift(); // == smallerBuf @@ -551,18 +564,17 @@ ChunkStream.prototype._processReadAllowingLess = function(read) { } }; -ChunkStream.prototype._processRead = function(read) { +ChunkStream.prototype._processRead = function (read) { this._reads.shift(); // == read - var pos = 0; - var count = 0; - var data = new Buffer(read.length); + let pos = 0; + let count = 0; + let data = Buffer.alloc(read.length); // create buffer for all data while (pos < read.length) { - - var buf = this._buffers[count++]; - var len = Math.min(buf.length, read.length - pos); + let buf = this._buffers[count++]; + let len = Math.min(buf.length, read.length - pos); buf.copy(data, pos, 0, len); pos += len; @@ -583,25 +595,20 @@ ChunkStream.prototype._processRead = function(read) { read.func.call(this, data); }; -ChunkStream.prototype._process = function() { - +ChunkStream.prototype._process = function () { try { // as long as there is any data and read requests while (this._buffered > 0 && this._reads && this._reads.length > 0) { - - var read = this._reads[0]; + let read = this._reads[0]; // read any data (but no more than length) if (read.allowLess) { this._processReadAllowingLess(read); - - } - else if (this._buffered >= read.length) { + } else if (this._buffered >= read.length) { // ok we can meet some expectations this._processRead(read); - } - else { + } else { // not enought data to satisfy first request in queue // so we need to wait for more break; @@ -611,19 +618,16 @@ ChunkStream.prototype._process = function() { if (this._buffers && !this.writable) { this._end(); } - } - catch (ex) { - this.emit('error', ex); + } catch (ex) { + this.emit("error", ex); } }; -}).call(this,require('_process'),require("buffer").Buffer) -},{"_process":51,"buffer":32,"stream":64,"util":69}],4:[function(require,module,exports){ -'use strict'; - +}).call(this)}).call(this,require('_process'),require("buffer").Buffer) +},{"_process":60,"buffer":33,"stream":61,"util":81}],4:[function(require,module,exports){ +"use strict"; module.exports = { - PNG_SIGNATURE: [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a], TYPE_IHDR: 0x49484452, @@ -648,100 +652,90 @@ module.exports = { 2: 3, 3: 1, 4: 2, - 6: 4 + 6: 4, }, - GAMMA_DIVISION: 100000 + GAMMA_DIVISION: 100000, }; },{}],5:[function(require,module,exports){ -'use strict'; +"use strict"; -var crcTable = []; +let crcTable = []; -(function() { - for (var i = 0; i < 256; i++) { - var currentCrc = i; - for (var j = 0; j < 8; j++) { +(function () { + for (let i = 0; i < 256; i++) { + let currentCrc = i; + for (let j = 0; j < 8; j++) { if (currentCrc & 1) { currentCrc = 0xedb88320 ^ (currentCrc >>> 1); - } - else { + } else { currentCrc = currentCrc >>> 1; } } crcTable[i] = currentCrc; } -}()); +})(); -var CrcCalculator = module.exports = function() { +let CrcCalculator = (module.exports = function () { this._crc = -1; -}; - -CrcCalculator.prototype.write = function(data) { +}); - for (var i = 0; i < data.length; i++) { +CrcCalculator.prototype.write = function (data) { + for (let i = 0; i < data.length; i++) { this._crc = crcTable[(this._crc ^ data[i]) & 0xff] ^ (this._crc >>> 8); } return true; }; -CrcCalculator.prototype.crc32 = function() { +CrcCalculator.prototype.crc32 = function () { return this._crc ^ -1; }; - -CrcCalculator.crc32 = function(buf) { - - var crc = -1; - for (var i = 0; i < buf.length; i++) { +CrcCalculator.crc32 = function (buf) { + let crc = -1; + for (let i = 0; i < buf.length; i++) { crc = crcTable[(crc ^ buf[i]) & 0xff] ^ (crc >>> 8); } return crc ^ -1; }; },{}],6:[function(require,module,exports){ -(function (Buffer){ -'use strict'; +(function (Buffer){(function (){ +"use strict"; -var paethPredictor = require('./paeth-predictor'); +let paethPredictor = require("./paeth-predictor"); function filterNone(pxData, pxPos, byteWidth, rawData, rawPos) { - - for (var x = 0; x < byteWidth; x++) { + for (let x = 0; x < byteWidth; x++) { rawData[rawPos + x] = pxData[pxPos + x]; } } function filterSumNone(pxData, pxPos, byteWidth) { + let sum = 0; + let length = pxPos + byteWidth; - var sum = 0; - var length = pxPos + byteWidth; - - for (var i = pxPos; i < length; i++) { + for (let i = pxPos; i < length; i++) { sum += Math.abs(pxData[i]); } return sum; } function filterSub(pxData, pxPos, byteWidth, rawData, rawPos, bpp) { - - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var val = pxData[pxPos + x] - left; + for (let x = 0; x < byteWidth; x++) { + let left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + let val = pxData[pxPos + x] - left; rawData[rawPos + x] = val; } } function filterSumSub(pxData, pxPos, byteWidth, bpp) { - - var sum = 0; - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var val = pxData[pxPos + x] - left; + let sum = 0; + for (let x = 0; x < byteWidth; x++) { + let left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + let val = pxData[pxPos + x] - left; sum += Math.abs(val); } @@ -750,24 +744,20 @@ function filterSumSub(pxData, pxPos, byteWidth, bpp) { } function filterUp(pxData, pxPos, byteWidth, rawData, rawPos) { - - for (var x = 0; x < byteWidth; x++) { - - var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; - var val = pxData[pxPos + x] - up; + for (let x = 0; x < byteWidth; x++) { + let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; + let val = pxData[pxPos + x] - up; rawData[rawPos + x] = val; } } function filterSumUp(pxData, pxPos, byteWidth) { - - var sum = 0; - var length = pxPos + byteWidth; - for (var x = pxPos; x < length; x++) { - - var up = pxPos > 0 ? pxData[x - byteWidth] : 0; - var val = pxData[x] - up; + let sum = 0; + let length = pxPos + byteWidth; + for (let x = pxPos; x < length; x++) { + let up = pxPos > 0 ? pxData[x - byteWidth] : 0; + let val = pxData[x] - up; sum += Math.abs(val); } @@ -776,25 +766,21 @@ function filterSumUp(pxData, pxPos, byteWidth) { } function filterAvg(pxData, pxPos, byteWidth, rawData, rawPos, bpp) { - - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; - var val = pxData[pxPos + x] - ((left + up) >> 1); + for (let x = 0; x < byteWidth; x++) { + let left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; + let val = pxData[pxPos + x] - ((left + up) >> 1); rawData[rawPos + x] = val; } } function filterSumAvg(pxData, pxPos, byteWidth, bpp) { - - var sum = 0; - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; - var val = pxData[pxPos + x] - ((left + up) >> 1); + let sum = 0; + for (let x = 0; x < byteWidth; x++) { + let left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; + let val = pxData[pxPos + x] - ((left + up) >> 1); sum += Math.abs(val); } @@ -803,26 +789,25 @@ function filterSumAvg(pxData, pxPos, byteWidth, bpp) { } function filterPaeth(pxData, pxPos, byteWidth, rawData, rawPos, bpp) { - - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; - var upleft = pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0; - var val = pxData[pxPos + x] - paethPredictor(left, up, upleft); + for (let x = 0; x < byteWidth; x++) { + let left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; + let upleft = + pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0; + let val = pxData[pxPos + x] - paethPredictor(left, up, upleft); rawData[rawPos + x] = val; } } function filterSumPaeth(pxData, pxPos, byteWidth, bpp) { - var sum = 0; - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; - var upleft = pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0; - var val = pxData[pxPos + x] - paethPredictor(left, up, upleft); + let sum = 0; + for (let x = 0; x < byteWidth; x++) { + let left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; + let upleft = + pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0; + let val = pxData[pxPos + x] - paethPredictor(left, up, upleft); sum += Math.abs(val); } @@ -830,53 +815,49 @@ function filterSumPaeth(pxData, pxPos, byteWidth, bpp) { return sum; } -var filters = { +let filters = { 0: filterNone, 1: filterSub, 2: filterUp, 3: filterAvg, - 4: filterPaeth + 4: filterPaeth, }; -var filterSums = { +let filterSums = { 0: filterSumNone, 1: filterSumSub, 2: filterSumUp, 3: filterSumAvg, - 4: filterSumPaeth + 4: filterSumPaeth, }; -module.exports = function(pxData, width, height, options, bpp) { - - var filterTypes; - if (!('filterType' in options) || options.filterType === -1) { +module.exports = function (pxData, width, height, options, bpp) { + let filterTypes; + if (!("filterType" in options) || options.filterType === -1) { filterTypes = [0, 1, 2, 3, 4]; - } - else if (typeof options.filterType === 'number') { + } else if (typeof options.filterType === "number") { filterTypes = [options.filterType]; - } - else { - throw new Error('unrecognised filter types'); + } else { + throw new Error("unrecognised filter types"); } if (options.bitDepth === 16) { bpp *= 2; } - var byteWidth = width * bpp; - var rawPos = 0; - var pxPos = 0; - var rawData = new Buffer((byteWidth + 1) * height); + let byteWidth = width * bpp; + let rawPos = 0; + let pxPos = 0; + let rawData = Buffer.alloc((byteWidth + 1) * height); - var sel = filterTypes[0]; - - for (var y = 0; y < height; y++) { + let sel = filterTypes[0]; + for (let y = 0; y < height; y++) { if (filterTypes.length > 1) { // find best filter for this line (with lowest sum of values) - var min = Infinity; + let min = Infinity; - for (var i = 0; i < filterTypes.length; i++) { - var sum = filterSums[filterTypes[i]](pxData, pxPos, byteWidth, bpp); + for (let i = 0; i < filterTypes.length; i++) { + let sum = filterSums[filterTypes[i]](pxData, pxPos, byteWidth, bpp); if (sum < min) { sel = filterTypes[i]; min = sum; @@ -893,55 +874,51 @@ module.exports = function(pxData, width, height, options, bpp) { return rawData; }; -}).call(this,require("buffer").Buffer) -},{"./paeth-predictor":15,"buffer":32}],7:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var util = require('util'); -var ChunkStream = require('./chunkstream'); -var Filter = require('./filter-parse'); +}).call(this)}).call(this,require("buffer").Buffer) +},{"./paeth-predictor":15,"buffer":33}],7:[function(require,module,exports){ +(function (Buffer){(function (){ +"use strict"; +let util = require("util"); +let ChunkStream = require("./chunkstream"); +let Filter = require("./filter-parse"); -var FilterAsync = module.exports = function(bitmapInfo) { +let FilterAsync = (module.exports = function (bitmapInfo) { ChunkStream.call(this); - var buffers = []; - var that = this; + let buffers = []; + let that = this; this._filter = new Filter(bitmapInfo, { read: this.read.bind(this), - write: function(buffer) { + write: function (buffer) { buffers.push(buffer); }, - complete: function() { - that.emit('complete', Buffer.concat(buffers)); - } + complete: function () { + that.emit("complete", Buffer.concat(buffers)); + }, }); this._filter.start(); -}; +}); util.inherits(FilterAsync, ChunkStream); -}).call(this,require("buffer").Buffer) -},{"./chunkstream":3,"./filter-parse":9,"buffer":32,"util":69}],8:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var SyncReader = require('./sync-reader'); -var Filter = require('./filter-parse'); - +}).call(this)}).call(this,require("buffer").Buffer) +},{"./chunkstream":3,"./filter-parse":9,"buffer":33,"util":81}],8:[function(require,module,exports){ +(function (Buffer){(function (){ +"use strict"; -exports.process = function(inBuffer, bitmapInfo) { +let SyncReader = require("./sync-reader"); +let Filter = require("./filter-parse"); - var outBuffers = []; - var reader = new SyncReader(inBuffer); - var filter = new Filter(bitmapInfo, { +exports.process = function (inBuffer, bitmapInfo) { + let outBuffers = []; + let reader = new SyncReader(inBuffer); + let filter = new Filter(bitmapInfo, { read: reader.read.bind(reader), - write: function(bufferPart) { + write: function (bufferPart) { outBuffers.push(bufferPart); }, - complete: function() { - } + complete: function () {}, }); filter.start(); @@ -949,29 +926,29 @@ exports.process = function(inBuffer, bitmapInfo) { return Buffer.concat(outBuffers); }; -}).call(this,require("buffer").Buffer) -},{"./filter-parse":9,"./sync-reader":22,"buffer":32}],9:[function(require,module,exports){ -(function (Buffer){ -'use strict'; -var interlaceUtils = require('./interlace'); -var paethPredictor = require('./paeth-predictor'); +}).call(this)}).call(this,require("buffer").Buffer) +},{"./filter-parse":9,"./sync-reader":22,"buffer":33}],9:[function(require,module,exports){ +(function (Buffer){(function (){ +"use strict"; + +let interlaceUtils = require("./interlace"); +let paethPredictor = require("./paeth-predictor"); function getByteWidth(width, bpp, depth) { - var byteWidth = width * bpp; + let byteWidth = width * bpp; if (depth !== 8) { byteWidth = Math.ceil(byteWidth / (8 / depth)); } return byteWidth; } -var Filter = module.exports = function(bitmapInfo, dependencies) { - - var width = bitmapInfo.width; - var height = bitmapInfo.height; - var interlace = bitmapInfo.interlace; - var bpp = bitmapInfo.bpp; - var depth = bitmapInfo.depth; +let Filter = (module.exports = function (bitmapInfo, dependencies) { + let width = bitmapInfo.width; + let height = bitmapInfo.height; + let interlace = bitmapInfo.interlace; + let bpp = bitmapInfo.bpp; + let depth = bitmapInfo.depth; this.read = dependencies.read; this.write = dependencies.write; @@ -980,20 +957,19 @@ var Filter = module.exports = function(bitmapInfo, dependencies) { this._imageIndex = 0; this._images = []; if (interlace) { - var passes = interlaceUtils.getImagePasses(width, height); - for (var i = 0; i < passes.length; i++) { + let passes = interlaceUtils.getImagePasses(width, height); + for (let i = 0; i < passes.length; i++) { this._images.push({ byteWidth: getByteWidth(passes[i].width, bpp, depth), height: passes[i].height, - lineIndex: 0 + lineIndex: 0, }); } - } - else { + } else { this._images.push({ byteWidth: getByteWidth(width, bpp, depth), height: height, - lineIndex: 0 + lineIndex: 0, }); } @@ -1003,86 +979,96 @@ var Filter = module.exports = function(bitmapInfo, dependencies) { // a pixel rather than just a different byte part. However if we are sub byte, we ignore. if (depth === 8) { this._xComparison = bpp; - } - else if (depth === 16) { + } else if (depth === 16) { this._xComparison = bpp * 2; - } - else { + } else { this._xComparison = 1; } -}; +}); -Filter.prototype.start = function() { - this.read(this._images[this._imageIndex].byteWidth + 1, this._reverseFilterLine.bind(this)); +Filter.prototype.start = function () { + this.read( + this._images[this._imageIndex].byteWidth + 1, + this._reverseFilterLine.bind(this) + ); }; -Filter.prototype._unFilterType1 = function(rawData, unfilteredLine, byteWidth) { - - var xComparison = this._xComparison; - var xBiggerThan = xComparison - 1; - - for (var x = 0; x < byteWidth; x++) { - var rawByte = rawData[1 + x]; - var f1Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; +Filter.prototype._unFilterType1 = function ( + rawData, + unfilteredLine, + byteWidth +) { + let xComparison = this._xComparison; + let xBiggerThan = xComparison - 1; + + for (let x = 0; x < byteWidth; x++) { + let rawByte = rawData[1 + x]; + let f1Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; unfilteredLine[x] = rawByte + f1Left; } }; -Filter.prototype._unFilterType2 = function(rawData, unfilteredLine, byteWidth) { +Filter.prototype._unFilterType2 = function ( + rawData, + unfilteredLine, + byteWidth +) { + let lastLine = this._lastLine; - var lastLine = this._lastLine; - - for (var x = 0; x < byteWidth; x++) { - var rawByte = rawData[1 + x]; - var f2Up = lastLine ? lastLine[x] : 0; + for (let x = 0; x < byteWidth; x++) { + let rawByte = rawData[1 + x]; + let f2Up = lastLine ? lastLine[x] : 0; unfilteredLine[x] = rawByte + f2Up; } }; -Filter.prototype._unFilterType3 = function(rawData, unfilteredLine, byteWidth) { - - var xComparison = this._xComparison; - var xBiggerThan = xComparison - 1; - var lastLine = this._lastLine; - - for (var x = 0; x < byteWidth; x++) { - var rawByte = rawData[1 + x]; - var f3Up = lastLine ? lastLine[x] : 0; - var f3Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; - var f3Add = Math.floor((f3Left + f3Up) / 2); +Filter.prototype._unFilterType3 = function ( + rawData, + unfilteredLine, + byteWidth +) { + let xComparison = this._xComparison; + let xBiggerThan = xComparison - 1; + let lastLine = this._lastLine; + + for (let x = 0; x < byteWidth; x++) { + let rawByte = rawData[1 + x]; + let f3Up = lastLine ? lastLine[x] : 0; + let f3Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; + let f3Add = Math.floor((f3Left + f3Up) / 2); unfilteredLine[x] = rawByte + f3Add; } }; -Filter.prototype._unFilterType4 = function(rawData, unfilteredLine, byteWidth) { - - var xComparison = this._xComparison; - var xBiggerThan = xComparison - 1; - var lastLine = this._lastLine; - - for (var x = 0; x < byteWidth; x++) { - var rawByte = rawData[1 + x]; - var f4Up = lastLine ? lastLine[x] : 0; - var f4Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; - var f4UpLeft = x > xBiggerThan && lastLine ? lastLine[x - xComparison] : 0; - var f4Add = paethPredictor(f4Left, f4Up, f4UpLeft); +Filter.prototype._unFilterType4 = function ( + rawData, + unfilteredLine, + byteWidth +) { + let xComparison = this._xComparison; + let xBiggerThan = xComparison - 1; + let lastLine = this._lastLine; + + for (let x = 0; x < byteWidth; x++) { + let rawByte = rawData[1 + x]; + let f4Up = lastLine ? lastLine[x] : 0; + let f4Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; + let f4UpLeft = x > xBiggerThan && lastLine ? lastLine[x - xComparison] : 0; + let f4Add = paethPredictor(f4Left, f4Up, f4UpLeft); unfilteredLine[x] = rawByte + f4Add; } }; -Filter.prototype._reverseFilterLine = function(rawData) { - - var filter = rawData[0]; - var unfilteredLine; - var currentImage = this._images[this._imageIndex]; - var byteWidth = currentImage.byteWidth; +Filter.prototype._reverseFilterLine = function (rawData) { + let filter = rawData[0]; + let unfilteredLine; + let currentImage = this._images[this._imageIndex]; + let byteWidth = currentImage.byteWidth; if (filter === 0) { unfilteredLine = rawData.slice(1, byteWidth + 1); - } - else { - - unfilteredLine = new Buffer(byteWidth); + } else { + unfilteredLine = Buffer.alloc(byteWidth); switch (filter) { case 1: @@ -1098,7 +1084,7 @@ Filter.prototype._reverseFilterLine = function(rawData) { this._unFilterType4(rawData, unfilteredLine, byteWidth); break; default: - throw new Error('Unrecognised filter type - ' + filter); + throw new Error("Unrecognised filter type - " + filter); } } @@ -1109,38 +1095,36 @@ Filter.prototype._reverseFilterLine = function(rawData) { this._lastLine = null; this._imageIndex++; currentImage = this._images[this._imageIndex]; - } - else { + } else { this._lastLine = unfilteredLine; } if (currentImage) { // read, using the byte width that may be from the new current image this.read(currentImage.byteWidth + 1, this._reverseFilterLine.bind(this)); - } - else { + } else { this._lastLine = null; this.complete(); } }; -}).call(this,require("buffer").Buffer) -},{"./interlace":11,"./paeth-predictor":15,"buffer":32}],10:[function(require,module,exports){ -(function (Buffer){ -'use strict'; +}).call(this)}).call(this,require("buffer").Buffer) +},{"./interlace":11,"./paeth-predictor":15,"buffer":33}],10:[function(require,module,exports){ +(function (Buffer){(function (){ +"use strict"; function dePalette(indata, outdata, width, height, palette) { - var pxPos = 0; + let pxPos = 0; // use values from palette - for (var y = 0; y < height; y++) { - for (var x = 0; x < width; x++) { - var color = palette[indata[pxPos]]; + for (let y = 0; y < height; y++) { + for (let x = 0; x < width; x++) { + let color = palette[indata[pxPos]]; if (!color) { - throw new Error('index ' + indata[pxPos] + ' not in palette'); + throw new Error("index " + indata[pxPos] + " not in palette"); } - for (var i = 0; i < 4; i++) { + for (let i = 0; i < 4; i++) { outdata[pxPos + i] = color[i]; } pxPos += 4; @@ -1149,21 +1133,24 @@ function dePalette(indata, outdata, width, height, palette) { } function replaceTransparentColor(indata, outdata, width, height, transColor) { - var pxPos = 0; - for (var y = 0; y < height; y++) { - for (var x = 0; x < width; x++) { - var makeTrans = false; + let pxPos = 0; + for (let y = 0; y < height; y++) { + for (let x = 0; x < width; x++) { + let makeTrans = false; if (transColor.length === 1) { if (transColor[0] === indata[pxPos]) { makeTrans = true; } - } - else if (transColor[0] === indata[pxPos] && transColor[1] === indata[pxPos + 1] && transColor[2] === indata[pxPos + 2]) { + } else if ( + transColor[0] === indata[pxPos] && + transColor[1] === indata[pxPos + 1] && + transColor[2] === indata[pxPos + 2] + ) { makeTrans = true; } if (makeTrans) { - for (var i = 0; i < 4; i++) { + for (let i = 0; i < 4; i++) { outdata[pxPos + i] = 0; } } @@ -1173,43 +1160,44 @@ function replaceTransparentColor(indata, outdata, width, height, transColor) { } function scaleDepth(indata, outdata, width, height, depth) { - var maxOutSample = 255; - var maxInSample = Math.pow(2, depth) - 1; - var pxPos = 0; - - for (var y = 0; y < height; y++) { - for (var x = 0; x < width; x++) { - for (var i = 0; i < 4; i++) { - outdata[pxPos + i] = Math.floor((indata[pxPos + i] * maxOutSample) / maxInSample + 0.5); + let maxOutSample = 255; + let maxInSample = Math.pow(2, depth) - 1; + let pxPos = 0; + + for (let y = 0; y < height; y++) { + for (let x = 0; x < width; x++) { + for (let i = 0; i < 4; i++) { + outdata[pxPos + i] = Math.floor( + (indata[pxPos + i] * maxOutSample) / maxInSample + 0.5 + ); } pxPos += 4; } } } -module.exports = function(indata, imageData) { - - var depth = imageData.depth; - var width = imageData.width; - var height = imageData.height; - var colorType = imageData.colorType; - var transColor = imageData.transColor; - var palette = imageData.palette; +module.exports = function (indata, imageData, skipRescale = false) { + let depth = imageData.depth; + let width = imageData.width; + let height = imageData.height; + let colorType = imageData.colorType; + let transColor = imageData.transColor; + let palette = imageData.palette; - var outdata = indata; // only different for 16 bits + let outdata = indata; // only different for 16 bits - if (colorType === 3) { // paletted + if (colorType === 3) { + // paletted dePalette(indata, outdata, width, height, palette); - } - else { + } else { if (transColor) { replaceTransparentColor(indata, outdata, width, height, transColor); } // if it needs scaling - if (depth !== 8) { + if (depth !== 8 && !skipRescale) { // if we need to change the buffer size if (depth === 16) { - outdata = new Buffer(width * height * 4); + outdata = Buffer.alloc(width * height * 4); } scaleDepth(indata, outdata, width, height, depth); } @@ -1217,9 +1205,9 @@ module.exports = function(indata, imageData) { return outdata; }; -}).call(this,require("buffer").Buffer) -},{"buffer":32}],11:[function(require,module,exports){ -'use strict'; +}).call(this)}).call(this,require("buffer").Buffer) +},{"buffer":33}],11:[function(require,module,exports){ +"use strict"; // Adam 7 // 0 1 2 3 4 5 6 7 @@ -1232,61 +1220,65 @@ module.exports = function(indata, imageData) { // 6 5 6 5 6 5 6 5 6 // 7 7 7 7 7 7 7 7 7 - -var imagePasses = [ - { // pass 1 - 1px +let imagePasses = [ + { + // pass 1 - 1px x: [0], - y: [0] + y: [0], }, - { // pass 2 - 1px + { + // pass 2 - 1px x: [4], - y: [0] + y: [0], }, - { // pass 3 - 2px + { + // pass 3 - 2px x: [0, 4], - y: [4] + y: [4], }, - { // pass 4 - 4px + { + // pass 4 - 4px x: [2, 6], - y: [0, 4] + y: [0, 4], }, - { // pass 5 - 8px + { + // pass 5 - 8px x: [0, 2, 4, 6], - y: [2, 6] + y: [2, 6], }, - { // pass 6 - 16px + { + // pass 6 - 16px x: [1, 3, 5, 7], - y: [0, 2, 4, 6] + y: [0, 2, 4, 6], }, - { // pass 7 - 32px + { + // pass 7 - 32px x: [0, 1, 2, 3, 4, 5, 6, 7], - y: [1, 3, 5, 7] - } + y: [1, 3, 5, 7], + }, ]; -exports.getImagePasses = function(width, height) { - var images = []; - var xLeftOver = width % 8; - var yLeftOver = height % 8; - var xRepeats = (width - xLeftOver) / 8; - var yRepeats = (height - yLeftOver) / 8; - for (var i = 0; i < imagePasses.length; i++) { - var pass = imagePasses[i]; - var passWidth = xRepeats * pass.x.length; - var passHeight = yRepeats * pass.y.length; - for (var j = 0; j < pass.x.length; j++) { +exports.getImagePasses = function (width, height) { + let images = []; + let xLeftOver = width % 8; + let yLeftOver = height % 8; + let xRepeats = (width - xLeftOver) / 8; + let yRepeats = (height - yLeftOver) / 8; + for (let i = 0; i < imagePasses.length; i++) { + let pass = imagePasses[i]; + let passWidth = xRepeats * pass.x.length; + let passHeight = yRepeats * pass.y.length; + for (let j = 0; j < pass.x.length; j++) { if (pass.x[j] < xLeftOver) { passWidth++; - } - else { + } else { break; } } - for (j = 0; j < pass.y.length; j++) { + for (let j = 0; j < pass.y.length; j++) { if (pass.y[j] < yLeftOver) { passHeight++; - } - else { + } else { break; } } @@ -1297,90 +1289,101 @@ exports.getImagePasses = function(width, height) { return images; }; -exports.getInterlaceIterator = function(width) { - return function(x, y, pass) { - var outerXLeftOver = x % imagePasses[pass].x.length; - var outerX = (((x - outerXLeftOver) / imagePasses[pass].x.length) * 8) + imagePasses[pass].x[outerXLeftOver]; - var outerYLeftOver = y % imagePasses[pass].y.length; - var outerY = (((y - outerYLeftOver) / imagePasses[pass].y.length) * 8) + imagePasses[pass].y[outerYLeftOver]; - return (outerX * 4) + (outerY * width * 4); +exports.getInterlaceIterator = function (width) { + return function (x, y, pass) { + let outerXLeftOver = x % imagePasses[pass].x.length; + let outerX = + ((x - outerXLeftOver) / imagePasses[pass].x.length) * 8 + + imagePasses[pass].x[outerXLeftOver]; + let outerYLeftOver = y % imagePasses[pass].y.length; + let outerY = + ((y - outerYLeftOver) / imagePasses[pass].y.length) * 8 + + imagePasses[pass].y[outerYLeftOver]; + return outerX * 4 + outerY * width * 4; }; }; + },{}],12:[function(require,module,exports){ -(function (Buffer){ -'use strict'; +(function (Buffer){(function (){ +"use strict"; -var util = require('util'); -var Stream = require('stream'); -var constants = require('./constants'); -var Packer = require('./packer'); +let util = require("util"); +let Stream = require("stream"); +let constants = require("./constants"); +let Packer = require("./packer"); -var PackerAsync = module.exports = function(opt) { +let PackerAsync = (module.exports = function (opt) { Stream.call(this); - var options = opt || {}; + let options = opt || {}; this._packer = new Packer(options); this._deflate = this._packer.createDeflate(); this.readable = true; -}; +}); util.inherits(PackerAsync, Stream); - -PackerAsync.prototype.pack = function(data, width, height, gamma) { +PackerAsync.prototype.pack = function (data, width, height, gamma) { // Signature - this.emit('data', new Buffer(constants.PNG_SIGNATURE)); - this.emit('data', this._packer.packIHDR(width, height)); + this.emit("data", Buffer.from(constants.PNG_SIGNATURE)); + this.emit("data", this._packer.packIHDR(width, height)); if (gamma) { - this.emit('data', this._packer.packGAMA(gamma)); + this.emit("data", this._packer.packGAMA(gamma)); } - var filteredData = this._packer.filterData(data, width, height); + let filteredData = this._packer.filterData(data, width, height); // compress it - this._deflate.on('error', this.emit.bind(this, 'error')); + this._deflate.on("error", this.emit.bind(this, "error")); - this._deflate.on('data', function(compressedData) { - this.emit('data', this._packer.packIDAT(compressedData)); - }.bind(this)); + this._deflate.on( + "data", + function (compressedData) { + this.emit("data", this._packer.packIDAT(compressedData)); + }.bind(this) + ); - this._deflate.on('end', function() { - this.emit('data', this._packer.packIEND()); - this.emit('end'); - }.bind(this)); + this._deflate.on( + "end", + function () { + this.emit("data", this._packer.packIEND()); + this.emit("end"); + }.bind(this) + ); this._deflate.end(filteredData); }; -}).call(this,require("buffer").Buffer) -},{"./constants":4,"./packer":14,"buffer":32,"stream":64,"util":69}],13:[function(require,module,exports){ -(function (Buffer){ -'use strict'; +}).call(this)}).call(this,require("buffer").Buffer) +},{"./constants":4,"./packer":14,"buffer":33,"stream":61,"util":81}],13:[function(require,module,exports){ +(function (Buffer){(function (){ +"use strict"; -var hasSyncZlib = true; -var zlib = require('zlib'); +let hasSyncZlib = true; +let zlib = require("zlib"); if (!zlib.deflateSync) { hasSyncZlib = false; } -var constants = require('./constants'); -var Packer = require('./packer'); - -module.exports = function(metaData, opt) { +let constants = require("./constants"); +let Packer = require("./packer"); +module.exports = function (metaData, opt) { if (!hasSyncZlib) { - throw new Error('To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0'); + throw new Error( + "To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0" + ); } - var options = opt || {}; + let options = opt || {}; - var packer = new Packer(options); + let packer = new Packer(options); - var chunks = []; + let chunks = []; // Signature - chunks.push(new Buffer(constants.PNG_SIGNATURE)); + chunks.push(Buffer.from(constants.PNG_SIGNATURE)); // Header chunks.push(packer.packIHDR(metaData.width, metaData.height)); @@ -1389,14 +1392,21 @@ module.exports = function(metaData, opt) { chunks.push(packer.packGAMA(metaData.gamma)); } - var filteredData = packer.filterData(metaData.data, metaData.width, metaData.height); + let filteredData = packer.filterData( + metaData.data, + metaData.width, + metaData.height + ); // compress it - var compressedData = zlib.deflateSync(filteredData, packer.getDeflateOptions()); + let compressedData = zlib.deflateSync( + filteredData, + packer.getDeflateOptions() + ); filteredData = null; if (!compressedData || !compressedData.length) { - throw new Error('bad png - invalid compressed data response'); + throw new Error("bad png - invalid compressed data response"); } chunks.push(packer.packIDAT(compressedData)); @@ -1406,77 +1416,97 @@ module.exports = function(metaData, opt) { return Buffer.concat(chunks); }; -}).call(this,require("buffer").Buffer) -},{"./constants":4,"./packer":14,"buffer":32,"zlib":30}],14:[function(require,module,exports){ -(function (Buffer){ -'use strict'; +}).call(this)}).call(this,require("buffer").Buffer) +},{"./constants":4,"./packer":14,"buffer":33,"zlib":32}],14:[function(require,module,exports){ +(function (Buffer){(function (){ +"use strict"; -var constants = require('./constants'); -var CrcStream = require('./crc'); -var bitPacker = require('./bitpacker'); -var filter = require('./filter-pack'); -var zlib = require('zlib'); +let constants = require("./constants"); +let CrcStream = require("./crc"); +let bitPacker = require("./bitpacker"); +let filter = require("./filter-pack"); +let zlib = require("zlib"); -var Packer = module.exports = function(options) { +let Packer = (module.exports = function (options) { this._options = options; options.deflateChunkSize = options.deflateChunkSize || 32 * 1024; - options.deflateLevel = options.deflateLevel != null ? options.deflateLevel : 9; - options.deflateStrategy = options.deflateStrategy != null ? options.deflateStrategy : 3; - options.inputHasAlpha = options.inputHasAlpha != null ? options.inputHasAlpha : true; + options.deflateLevel = + options.deflateLevel != null ? options.deflateLevel : 9; + options.deflateStrategy = + options.deflateStrategy != null ? options.deflateStrategy : 3; + options.inputHasAlpha = + options.inputHasAlpha != null ? options.inputHasAlpha : true; options.deflateFactory = options.deflateFactory || zlib.createDeflate; options.bitDepth = options.bitDepth || 8; // This is outputColorType - options.colorType = (typeof options.colorType === 'number') ? options.colorType : constants.COLORTYPE_COLOR_ALPHA; - options.inputColorType = (typeof options.inputColorType === 'number') ? options.inputColorType : constants.COLORTYPE_COLOR_ALPHA; - - if ([ - constants.COLORTYPE_GRAYSCALE, - constants.COLORTYPE_COLOR, - constants.COLORTYPE_COLOR_ALPHA, - constants.COLORTYPE_ALPHA - ].indexOf(options.colorType) === -1) { - throw new Error('option color type:' + options.colorType + ' is not supported at present'); - } - if ([ - constants.COLORTYPE_GRAYSCALE, - constants.COLORTYPE_COLOR, - constants.COLORTYPE_COLOR_ALPHA, - constants.COLORTYPE_ALPHA - ].indexOf(options.inputColorType) === -1) { - throw new Error('option input color type:' + options.inputColorType + ' is not supported at present'); + options.colorType = + typeof options.colorType === "number" + ? options.colorType + : constants.COLORTYPE_COLOR_ALPHA; + options.inputColorType = + typeof options.inputColorType === "number" + ? options.inputColorType + : constants.COLORTYPE_COLOR_ALPHA; + + if ( + [ + constants.COLORTYPE_GRAYSCALE, + constants.COLORTYPE_COLOR, + constants.COLORTYPE_COLOR_ALPHA, + constants.COLORTYPE_ALPHA, + ].indexOf(options.colorType) === -1 + ) { + throw new Error( + "option color type:" + options.colorType + " is not supported at present" + ); + } + if ( + [ + constants.COLORTYPE_GRAYSCALE, + constants.COLORTYPE_COLOR, + constants.COLORTYPE_COLOR_ALPHA, + constants.COLORTYPE_ALPHA, + ].indexOf(options.inputColorType) === -1 + ) { + throw new Error( + "option input color type:" + + options.inputColorType + + " is not supported at present" + ); } if (options.bitDepth !== 8 && options.bitDepth !== 16) { - throw new Error('option bit depth:' + options.bitDepth + ' is not supported at present'); + throw new Error( + "option bit depth:" + options.bitDepth + " is not supported at present" + ); } -}; +}); -Packer.prototype.getDeflateOptions = function() { +Packer.prototype.getDeflateOptions = function () { return { chunkSize: this._options.deflateChunkSize, level: this._options.deflateLevel, - strategy: this._options.deflateStrategy + strategy: this._options.deflateStrategy, }; }; -Packer.prototype.createDeflate = function() { +Packer.prototype.createDeflate = function () { return this._options.deflateFactory(this.getDeflateOptions()); }; -Packer.prototype.filterData = function(data, width, height) { +Packer.prototype.filterData = function (data, width, height) { // convert to correct format for filtering (e.g. right bpp and bit depth) - var packedData = bitPacker(data, width, height, this._options); + let packedData = bitPacker(data, width, height, this._options); // filter pixel data - var bpp = constants.COLORTYPE_TO_BPP_MAP[this._options.colorType]; - var filteredData = filter(packedData, width, height, this._options, bpp); + let bpp = constants.COLORTYPE_TO_BPP_MAP[this._options.colorType]; + let filteredData = filter(packedData, width, height, this._options, bpp); return filteredData; }; -Packer.prototype._packChunk = function(type, data) { - - var len = (data ? data.length : 0); - var buf = new Buffer(len + 12); +Packer.prototype._packChunk = function (type, data) { + let len = data ? data.length : 0; + let buf = Buffer.alloc(len + 12); buf.writeUInt32BE(len, 0); buf.writeUInt32BE(type, 4); @@ -1485,19 +1515,21 @@ Packer.prototype._packChunk = function(type, data) { data.copy(buf, 8); } - buf.writeInt32BE(CrcStream.crc32(buf.slice(4, buf.length - 4)), buf.length - 4); + buf.writeInt32BE( + CrcStream.crc32(buf.slice(4, buf.length - 4)), + buf.length - 4 + ); return buf; }; -Packer.prototype.packGAMA = function(gamma) { - var buf = new Buffer(4); +Packer.prototype.packGAMA = function (gamma) { + let buf = Buffer.alloc(4); buf.writeUInt32BE(Math.floor(gamma * constants.GAMMA_DIVISION), 0); return this._packChunk(constants.TYPE_gAMA, buf); }; -Packer.prototype.packIHDR = function(width, height) { - - var buf = new Buffer(13); +Packer.prototype.packIHDR = function (width, height) { + let buf = Buffer.alloc(13); buf.writeUInt32BE(width, 0); buf.writeUInt32BE(height, 4); buf[8] = this._options.bitDepth; // Bit depth @@ -1509,24 +1541,23 @@ Packer.prototype.packIHDR = function(width, height) { return this._packChunk(constants.TYPE_IHDR, buf); }; -Packer.prototype.packIDAT = function(data) { +Packer.prototype.packIDAT = function (data) { return this._packChunk(constants.TYPE_IDAT, data); }; -Packer.prototype.packIEND = function() { +Packer.prototype.packIEND = function () { return this._packChunk(constants.TYPE_IEND, null); }; -}).call(this,require("buffer").Buffer) -},{"./bitpacker":2,"./constants":4,"./crc":5,"./filter-pack":6,"buffer":32,"zlib":30}],15:[function(require,module,exports){ -'use strict'; +}).call(this)}).call(this,require("buffer").Buffer) +},{"./bitpacker":2,"./constants":4,"./crc":5,"./filter-pack":6,"buffer":33,"zlib":32}],15:[function(require,module,exports){ +"use strict"; module.exports = function paethPredictor(left, above, upLeft) { - - var paeth = left + above - upLeft; - var pLeft = Math.abs(paeth - left); - var pAbove = Math.abs(paeth - above); - var pUpLeft = Math.abs(paeth - upLeft); + let paeth = left + above - upLeft; + let pLeft = Math.abs(paeth - left); + let pAbove = Math.abs(paeth - above); + let pUpLeft = Math.abs(paeth - upLeft); if (pLeft <= pAbove && pLeft <= pUpLeft) { return left; @@ -1536,43 +1567,42 @@ module.exports = function paethPredictor(left, above, upLeft) { } return upLeft; }; + },{}],16:[function(require,module,exports){ -'use strict'; +"use strict"; -var util = require('util'); -var zlib = require('zlib'); -var ChunkStream = require('./chunkstream'); -var FilterAsync = require('./filter-parse-async'); -var Parser = require('./parser'); -var bitmapper = require('./bitmapper'); -var formatNormaliser = require('./format-normaliser'); - -var ParserAsync = module.exports = function(options) { +let util = require("util"); +let zlib = require("zlib"); +let ChunkStream = require("./chunkstream"); +let FilterAsync = require("./filter-parse-async"); +let Parser = require("./parser"); +let bitmapper = require("./bitmapper"); +let formatNormaliser = require("./format-normaliser"); + +let ParserAsync = (module.exports = function (options) { ChunkStream.call(this); this._parser = new Parser(options, { read: this.read.bind(this), error: this._handleError.bind(this), metadata: this._handleMetaData.bind(this), - gamma: this.emit.bind(this, 'gamma'), + gamma: this.emit.bind(this, "gamma"), palette: this._handlePalette.bind(this), transColor: this._handleTransColor.bind(this), finished: this._finished.bind(this), inflateData: this._inflateData.bind(this), simpleTransparency: this._simpleTransparency.bind(this), - headersFinished: this._headersFinished.bind(this) + headersFinished: this._headersFinished.bind(this), }); this._options = options; this.writable = true; this._parser.start(); -}; +}); util.inherits(ParserAsync, ChunkStream); - -ParserAsync.prototype._handleError = function(err) { - - this.emit('error', err); +ParserAsync.prototype._handleError = function (err) { + this.emit("error", err); this.writable = false; @@ -1587,42 +1617,47 @@ ParserAsync.prototype._handleError = function(err) { // For backward compatibility with Node 7 and below. // Suppress errors due to _inflate calling write() even after // it's destroy()'ed. - this._filter.on('error', function() {}); + this._filter.on("error", function () {}); } this.errord = true; }; -ParserAsync.prototype._inflateData = function(data) { +ParserAsync.prototype._inflateData = function (data) { if (!this._inflate) { if (this._bitmapInfo.interlace) { this._inflate = zlib.createInflate(); - this._inflate.on('error', this.emit.bind(this, 'error')); - this._filter.on('complete', this._complete.bind(this)); + this._inflate.on("error", this.emit.bind(this, "error")); + this._filter.on("complete", this._complete.bind(this)); this._inflate.pipe(this._filter); - } - else { - var rowSize = ((this._bitmapInfo.width * this._bitmapInfo.bpp * this._bitmapInfo.depth + 7) >> 3) + 1; - var imageSize = rowSize * this._bitmapInfo.height; - var chunkSize = Math.max(imageSize, zlib.Z_MIN_CHUNK); + } else { + let rowSize = + ((this._bitmapInfo.width * + this._bitmapInfo.bpp * + this._bitmapInfo.depth + + 7) >> + 3) + + 1; + let imageSize = rowSize * this._bitmapInfo.height; + let chunkSize = Math.max(imageSize, zlib.Z_MIN_CHUNK); this._inflate = zlib.createInflate({ chunkSize: chunkSize }); - var leftToInflate = imageSize; + let leftToInflate = imageSize; - var emitError = this.emit.bind(this, 'error'); - this._inflate.on('error', function(err) { + let emitError = this.emit.bind(this, "error"); + this._inflate.on("error", function (err) { if (!leftToInflate) { return; } emitError(err); }); - this._filter.on('complete', this._complete.bind(this)); + this._filter.on("complete", this._complete.bind(this)); - var filterWrite = this._filter.write.bind(this._filter); - this._inflate.on('data', function(chunk) { + let filterWrite = this._filter.write.bind(this._filter); + this._inflate.on("data", function (chunk) { if (!leftToInflate) { return; } @@ -1636,101 +1671,103 @@ ParserAsync.prototype._inflateData = function(data) { filterWrite(chunk); }); - this._inflate.on('end', this._filter.end.bind(this._filter)); + this._inflate.on("end", this._filter.end.bind(this._filter)); } } this._inflate.write(data); }; -ParserAsync.prototype._handleMetaData = function(metaData) { +ParserAsync.prototype._handleMetaData = function (metaData) { this._metaData = metaData; this._bitmapInfo = Object.create(metaData); this._filter = new FilterAsync(this._bitmapInfo); }; -ParserAsync.prototype._handleTransColor = function(transColor) { +ParserAsync.prototype._handleTransColor = function (transColor) { this._bitmapInfo.transColor = transColor; }; -ParserAsync.prototype._handlePalette = function(palette) { +ParserAsync.prototype._handlePalette = function (palette) { this._bitmapInfo.palette = palette; }; -ParserAsync.prototype._simpleTransparency = function() { +ParserAsync.prototype._simpleTransparency = function () { this._metaData.alpha = true; }; -ParserAsync.prototype._headersFinished = function() { +ParserAsync.prototype._headersFinished = function () { // Up until this point, we don't know if we have a tRNS chunk (alpha) // so we can't emit metadata any earlier - this.emit('metadata', this._metaData); + this.emit("metadata", this._metaData); }; -ParserAsync.prototype._finished = function() { +ParserAsync.prototype._finished = function () { if (this.errord) { return; } if (!this._inflate) { - this.emit('error', 'No Inflate block'); - } - else { + this.emit("error", "No Inflate block"); + } else { // no more data to inflate this._inflate.end(); } - this.destroySoon(); }; -ParserAsync.prototype._complete = function(filteredData) { - +ParserAsync.prototype._complete = function (filteredData) { if (this.errord) { return; } + let normalisedBitmapData; + try { - var bitmapData = bitmapper.dataToBitMap(filteredData, this._bitmapInfo); + let bitmapData = bitmapper.dataToBitMap(filteredData, this._bitmapInfo); - var normalisedBitmapData = formatNormaliser(bitmapData, this._bitmapInfo); + normalisedBitmapData = formatNormaliser( + bitmapData, + this._bitmapInfo, + this._options.skipRescale + ); bitmapData = null; - } - catch (ex) { + } catch (ex) { this._handleError(ex); return; } - this.emit('parsed', normalisedBitmapData); + this.emit("parsed", normalisedBitmapData); }; -},{"./bitmapper":1,"./chunkstream":3,"./filter-parse-async":7,"./format-normaliser":10,"./parser":18,"util":69,"zlib":30}],17:[function(require,module,exports){ -(function (Buffer){ -'use strict'; +},{"./bitmapper":1,"./chunkstream":3,"./filter-parse-async":7,"./format-normaliser":10,"./parser":18,"util":81,"zlib":32}],17:[function(require,module,exports){ +(function (Buffer){(function (){ +"use strict"; -var hasSyncZlib = true; -var zlib = require('zlib'); -var inflateSync = require('./sync-inflate'); +let hasSyncZlib = true; +let zlib = require("zlib"); +let inflateSync = require("./sync-inflate"); if (!zlib.deflateSync) { hasSyncZlib = false; } -var SyncReader = require('./sync-reader'); -var FilterSync = require('./filter-parse-sync'); -var Parser = require('./parser'); -var bitmapper = require('./bitmapper'); -var formatNormaliser = require('./format-normaliser'); - - -module.exports = function(buffer, options) { +let SyncReader = require("./sync-reader"); +let FilterSync = require("./filter-parse-sync"); +let Parser = require("./parser"); +let bitmapper = require("./bitmapper"); +let formatNormaliser = require("./format-normaliser"); +module.exports = function (buffer, options) { if (!hasSyncZlib) { - throw new Error('To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0'); + throw new Error( + "To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0" + ); } - var err; + let err; function handleError(_err_) { err = _err_; } - var metaData; + let metaData; function handleMetaData(_metaData_) { metaData = _metaData_; } @@ -1747,19 +1784,19 @@ module.exports = function(buffer, options) { metaData.alpha = true; } - var gamma; + let gamma; function handleGamma(_gamma_) { gamma = _gamma_; } - var inflateDataList = []; + let inflateDataList = []; function handleInflateData(inflatedData) { inflateDataList.push(inflatedData); } - var reader = new SyncReader(buffer); + let reader = new SyncReader(buffer); - var parser = new Parser(options, { + let parser = new Parser(options, { read: reader.read.bind(reader), error: handleError, metadata: handleMetaData, @@ -1767,7 +1804,7 @@ module.exports = function(buffer, options) { palette: handlePalette, transColor: handleTransColor, inflateData: handleInflateData, - simpleTransparency: handleSimpleTransparency + simpleTransparency: handleSimpleTransparency, }); parser.start(); @@ -1778,31 +1815,38 @@ module.exports = function(buffer, options) { } //join together the inflate datas - var inflateData = Buffer.concat(inflateDataList); + let inflateData = Buffer.concat(inflateDataList); inflateDataList.length = 0; - var inflatedData; + let inflatedData; if (metaData.interlace) { inflatedData = zlib.inflateSync(inflateData); - } - else { - var rowSize = ((metaData.width * metaData.bpp * metaData.depth + 7) >> 3) + 1; - var imageSize = rowSize * metaData.height; - inflatedData = inflateSync(inflateData, { chunkSize: imageSize, maxLength: imageSize }); + } else { + let rowSize = + ((metaData.width * metaData.bpp * metaData.depth + 7) >> 3) + 1; + let imageSize = rowSize * metaData.height; + inflatedData = inflateSync(inflateData, { + chunkSize: imageSize, + maxLength: imageSize, + }); } inflateData = null; if (!inflatedData || !inflatedData.length) { - throw new Error('bad png - invalid inflate data response'); + throw new Error("bad png - invalid inflate data response"); } - var unfilteredData = FilterSync.process(inflatedData, metaData); + let unfilteredData = FilterSync.process(inflatedData, metaData); inflateData = null; - var bitmapData = bitmapper.dataToBitMap(unfilteredData, metaData); + let bitmapData = bitmapper.dataToBitMap(unfilteredData, metaData); unfilteredData = null; - var normalisedBitmapData = formatNormaliser(bitmapData, metaData); + let normalisedBitmapData = formatNormaliser( + bitmapData, + metaData, + options.skipRescale + ); metaData.data = normalisedBitmapData; metaData.gamma = gamma || 0; @@ -1810,17 +1854,15 @@ module.exports = function(buffer, options) { return metaData; }; -}).call(this,require("buffer").Buffer) -},{"./bitmapper":1,"./filter-parse-sync":8,"./format-normaliser":10,"./parser":18,"./sync-inflate":21,"./sync-reader":22,"buffer":32,"zlib":30}],18:[function(require,module,exports){ -(function (Buffer){ -'use strict'; - -var constants = require('./constants'); -var CrcCalculator = require('./crc'); - +}).call(this)}).call(this,require("buffer").Buffer) +},{"./bitmapper":1,"./filter-parse-sync":8,"./format-normaliser":10,"./parser":18,"./sync-inflate":21,"./sync-reader":22,"buffer":33,"zlib":32}],18:[function(require,module,exports){ +(function (Buffer){(function (){ +"use strict"; -var Parser = module.exports = function(options, dependencies) { +let constants = require("./constants"); +let CrcCalculator = require("./crc"); +let Parser = (module.exports = function (options, dependencies) { this._options = options; options.checkCRC = options.checkCRC !== false; @@ -1850,83 +1892,78 @@ var Parser = module.exports = function(options, dependencies) { this.inflateData = dependencies.inflateData; this.finished = dependencies.finished; this.simpleTransparency = dependencies.simpleTransparency; - this.headersFinished = dependencies.headersFinished || function() {}; -}; + this.headersFinished = dependencies.headersFinished || function () {}; +}); -Parser.prototype.start = function() { - this.read(constants.PNG_SIGNATURE.length, - this._parseSignature.bind(this) - ); +Parser.prototype.start = function () { + this.read(constants.PNG_SIGNATURE.length, this._parseSignature.bind(this)); }; -Parser.prototype._parseSignature = function(data) { - - var signature = constants.PNG_SIGNATURE; +Parser.prototype._parseSignature = function (data) { + let signature = constants.PNG_SIGNATURE; - for (var i = 0; i < signature.length; i++) { + for (let i = 0; i < signature.length; i++) { if (data[i] !== signature[i]) { - this.error(new Error('Invalid file signature')); + this.error(new Error("Invalid file signature")); return; } } this.read(8, this._parseChunkBegin.bind(this)); }; -Parser.prototype._parseChunkBegin = function(data) { - +Parser.prototype._parseChunkBegin = function (data) { // chunk content length - var length = data.readUInt32BE(0); + let length = data.readUInt32BE(0); // chunk type - var type = data.readUInt32BE(4); - var name = ''; - for (var i = 4; i < 8; i++) { + let type = data.readUInt32BE(4); + let name = ""; + for (let i = 4; i < 8; i++) { name += String.fromCharCode(data[i]); } //console.log('chunk ', name, length); // chunk flags - var ancillary = Boolean(data[4] & 0x20); // or critical + let ancillary = Boolean(data[4] & 0x20); // or critical // priv = Boolean(data[5] & 0x20), // or public // safeToCopy = Boolean(data[7] & 0x20); // or unsafe if (!this._hasIHDR && type !== constants.TYPE_IHDR) { - this.error(new Error('Expected IHDR on beggining')); + this.error(new Error("Expected IHDR on beggining")); return; } this._crc = new CrcCalculator(); - this._crc.write(new Buffer(name)); + this._crc.write(Buffer.from(name)); if (this._chunks[type]) { return this._chunks[type](length); } if (!ancillary) { - this.error(new Error('Unsupported critical chunk type ' + name)); + this.error(new Error("Unsupported critical chunk type " + name)); return; } this.read(length + 4, this._skipChunk.bind(this)); }; -Parser.prototype._skipChunk = function(/*data*/) { +Parser.prototype._skipChunk = function (/*data*/) { this.read(8, this._parseChunkBegin.bind(this)); }; -Parser.prototype._handleChunkEnd = function() { +Parser.prototype._handleChunkEnd = function () { this.read(4, this._parseChunkEnd.bind(this)); }; -Parser.prototype._parseChunkEnd = function(data) { - - var fileCrc = data.readInt32BE(0); - var calcCrc = this._crc.crc32(); +Parser.prototype._parseChunkEnd = function (data) { + let fileCrc = data.readInt32BE(0); + let calcCrc = this._crc.crc32(); // check CRC if (this._options.checkCRC && calcCrc !== fileCrc) { - this.error(new Error('Crc error - ' + fileCrc + ' - ' + calcCrc)); + this.error(new Error("Crc error - " + fileCrc + " - " + calcCrc)); return; } @@ -1935,50 +1972,55 @@ Parser.prototype._parseChunkEnd = function(data) { } }; -Parser.prototype._handleIHDR = function(length) { +Parser.prototype._handleIHDR = function (length) { this.read(length, this._parseIHDR.bind(this)); }; -Parser.prototype._parseIHDR = function(data) { - +Parser.prototype._parseIHDR = function (data) { this._crc.write(data); - var width = data.readUInt32BE(0); - var height = data.readUInt32BE(4); - var depth = data[8]; - var colorType = data[9]; // bits: 1 palette, 2 color, 4 alpha - var compr = data[10]; - var filter = data[11]; - var interlace = data[12]; + let width = data.readUInt32BE(0); + let height = data.readUInt32BE(4); + let depth = data[8]; + let colorType = data[9]; // bits: 1 palette, 2 color, 4 alpha + let compr = data[10]; + let filter = data[11]; + let interlace = data[12]; // console.log(' width', width, 'height', height, // 'depth', depth, 'colorType', colorType, // 'compr', compr, 'filter', filter, 'interlace', interlace // ); - if (depth !== 8 && depth !== 4 && depth !== 2 && depth !== 1 && depth !== 16) { - this.error(new Error('Unsupported bit depth ' + depth)); + if ( + depth !== 8 && + depth !== 4 && + depth !== 2 && + depth !== 1 && + depth !== 16 + ) { + this.error(new Error("Unsupported bit depth " + depth)); return; } if (!(colorType in constants.COLORTYPE_TO_BPP_MAP)) { - this.error(new Error('Unsupported color type')); + this.error(new Error("Unsupported color type")); return; } if (compr !== 0) { - this.error(new Error('Unsupported compression method')); + this.error(new Error("Unsupported compression method")); return; } if (filter !== 0) { - this.error(new Error('Unsupported filter method')); + this.error(new Error("Unsupported filter method")); return; } if (interlace !== 0 && interlace !== 1) { - this.error(new Error('Unsupported interlace method')); + this.error(new Error("Unsupported interlace method")); return; } this._colorType = colorType; - var bpp = constants.COLORTYPE_TO_BPP_MAP[this._colorType]; + let bpp = constants.COLORTYPE_TO_BPP_MAP[this._colorType]; this._hasIHDR = true; @@ -1991,30 +2033,23 @@ Parser.prototype._parseIHDR = function(data) { color: Boolean(colorType & constants.COLORTYPE_COLOR), alpha: Boolean(colorType & constants.COLORTYPE_ALPHA), bpp: bpp, - colorType: colorType + colorType: colorType, }); this._handleChunkEnd(); }; - -Parser.prototype._handlePLTE = function(length) { +Parser.prototype._handlePLTE = function (length) { this.read(length, this._parsePLTE.bind(this)); }; -Parser.prototype._parsePLTE = function(data) { - +Parser.prototype._parsePLTE = function (data) { this._crc.write(data); - var entries = Math.floor(data.length / 3); + let entries = Math.floor(data.length / 3); // console.log('Palette:', entries); - for (var i = 0; i < entries; i++) { - this._palette.push([ - data[i * 3], - data[i * 3 + 1], - data[i * 3 + 2], - 0xff - ]); + for (let i = 0; i < entries; i++) { + this._palette.push([data[i * 3], data[i * 3 + 1], data[i * 3 + 2], 0xff]); } this.palette(this._palette); @@ -2022,25 +2057,24 @@ Parser.prototype._parsePLTE = function(data) { this._handleChunkEnd(); }; -Parser.prototype._handleTRNS = function(length) { +Parser.prototype._handleTRNS = function (length) { this.simpleTransparency(); this.read(length, this._parseTRNS.bind(this)); }; -Parser.prototype._parseTRNS = function(data) { - +Parser.prototype._parseTRNS = function (data) { this._crc.write(data); // palette if (this._colorType === constants.COLORTYPE_PALETTE_COLOR) { if (this._palette.length === 0) { - this.error(new Error('Transparency chunk must be after palette')); + this.error(new Error("Transparency chunk must be after palette")); return; } if (data.length > this._palette.length) { - this.error(new Error('More transparent colors than palette size')); + this.error(new Error("More transparent colors than palette size")); return; } - for (var i = 0; i < data.length; i++) { + for (let i = 0; i < data.length; i++) { this._palette[i][3] = data[i]; } this.palette(this._palette); @@ -2053,54 +2087,57 @@ Parser.prototype._parseTRNS = function(data) { this.transColor([data.readUInt16BE(0)]); } if (this._colorType === constants.COLORTYPE_COLOR) { - this.transColor([data.readUInt16BE(0), data.readUInt16BE(2), data.readUInt16BE(4)]); + this.transColor([ + data.readUInt16BE(0), + data.readUInt16BE(2), + data.readUInt16BE(4), + ]); } this._handleChunkEnd(); }; -Parser.prototype._handleGAMA = function(length) { +Parser.prototype._handleGAMA = function (length) { this.read(length, this._parseGAMA.bind(this)); }; -Parser.prototype._parseGAMA = function(data) { - +Parser.prototype._parseGAMA = function (data) { this._crc.write(data); this.gamma(data.readUInt32BE(0) / constants.GAMMA_DIVISION); this._handleChunkEnd(); }; -Parser.prototype._handleIDAT = function(length) { +Parser.prototype._handleIDAT = function (length) { if (!this._emittedHeadersFinished) { this._emittedHeadersFinished = true; this.headersFinished(); } this.read(-length, this._parseIDAT.bind(this, length)); }; -Parser.prototype._parseIDAT = function(length, data) { - +Parser.prototype._parseIDAT = function (length, data) { this._crc.write(data); - if (this._colorType === constants.COLORTYPE_PALETTE_COLOR && this._palette.length === 0) { - throw new Error('Expected palette not found'); + if ( + this._colorType === constants.COLORTYPE_PALETTE_COLOR && + this._palette.length === 0 + ) { + throw new Error("Expected palette not found"); } this.inflateData(data); - var leftOverLength = length - data.length; + let leftOverLength = length - data.length; if (leftOverLength > 0) { this._handleIDAT(leftOverLength); - } - else { - this._handleChunkEnd(); + } else { + this._handleChunkEnd(); } }; -Parser.prototype._handleIEND = function(length) { +Parser.prototype._handleIEND = function (length) { this.read(length, this._parseIEND.bind(this)); }; -Parser.prototype._parseIEND = function(data) { - +Parser.prototype._parseIEND = function (data) { this._crc.write(data); this._hasIEND = true; @@ -2111,37 +2148,32 @@ Parser.prototype._parseIEND = function(data) { } }; -}).call(this,require("buffer").Buffer) -},{"./constants":4,"./crc":5,"buffer":32}],19:[function(require,module,exports){ -'use strict'; - - -var parse = require('./parser-sync'); -var pack = require('./packer-sync'); - +}).call(this)}).call(this,require("buffer").Buffer) +},{"./constants":4,"./crc":5,"buffer":33}],19:[function(require,module,exports){ +"use strict"; -exports.read = function(buffer, options) { +let parse = require("./parser-sync"); +let pack = require("./packer-sync"); +exports.read = function (buffer, options) { return parse(buffer, options || {}); }; -exports.write = function(png, options) { - +exports.write = function (png, options) { return pack(png, options); }; },{"./packer-sync":13,"./parser-sync":17}],20:[function(require,module,exports){ -(function (process,Buffer){ -'use strict'; - -var util = require('util'); -var Stream = require('stream'); -var Parser = require('./parser-async'); -var Packer = require('./packer-async'); -var PNGSync = require('./png-sync'); +(function (process,Buffer){(function (){ +"use strict"; +let util = require("util"); +let Stream = require("stream"); +let Parser = require("./parser-async"); +let Packer = require("./packer-async"); +let PNGSync = require("./png-sync"); -var PNG = exports.PNG = function(options) { +let PNG = (exports.PNG = function (options) { Stream.call(this); options = options || {}; // eslint-disable-line no-param-reassign @@ -2150,8 +2182,10 @@ var PNG = exports.PNG = function(options) { this.width = options.width | 0; this.height = options.height | 0; - this.data = this.width > 0 && this.height > 0 ? - new Buffer(4 * this.width * this.height) : null; + this.data = + this.width > 0 && this.height > 0 + ? Buffer.alloc(4 * this.width * this.height) + : null; if (options.fill && this.data) { this.data.fill(0); @@ -2162,95 +2196,96 @@ var PNG = exports.PNG = function(options) { this._parser = new Parser(options); - this._parser.on('error', this.emit.bind(this, 'error')); - this._parser.on('close', this._handleClose.bind(this)); - this._parser.on('metadata', this._metadata.bind(this)); - this._parser.on('gamma', this._gamma.bind(this)); - this._parser.on('parsed', function(data) { - this.data = data; - this.emit('parsed', data); - }.bind(this)); + this._parser.on("error", this.emit.bind(this, "error")); + this._parser.on("close", this._handleClose.bind(this)); + this._parser.on("metadata", this._metadata.bind(this)); + this._parser.on("gamma", this._gamma.bind(this)); + this._parser.on( + "parsed", + function (data) { + this.data = data; + this.emit("parsed", data); + }.bind(this) + ); this._packer = new Packer(options); - this._packer.on('data', this.emit.bind(this, 'data')); - this._packer.on('end', this.emit.bind(this, 'end')); - this._parser.on('close', this._handleClose.bind(this)); - this._packer.on('error', this.emit.bind(this, 'error')); - -}; + this._packer.on("data", this.emit.bind(this, "data")); + this._packer.on("end", this.emit.bind(this, "end")); + this._parser.on("close", this._handleClose.bind(this)); + this._packer.on("error", this.emit.bind(this, "error")); +}); util.inherits(PNG, Stream); PNG.sync = PNGSync; -PNG.prototype.pack = function() { - +PNG.prototype.pack = function () { if (!this.data || !this.data.length) { - this.emit('error', 'No data provided'); + this.emit("error", "No data provided"); return this; } - process.nextTick(function() { - this._packer.pack(this.data, this.width, this.height, this.gamma); - }.bind(this)); + process.nextTick( + function () { + this._packer.pack(this.data, this.width, this.height, this.gamma); + }.bind(this) + ); return this; }; - -PNG.prototype.parse = function(data, callback) { - +PNG.prototype.parse = function (data, callback) { if (callback) { - var onParsed, onError; + let onParsed, onError; - onParsed = function(parsedData) { - this.removeListener('error', onError); + onParsed = function (parsedData) { + this.removeListener("error", onError); this.data = parsedData; callback(null, this); }.bind(this); - onError = function(err) { - this.removeListener('parsed', onParsed); + onError = function (err) { + this.removeListener("parsed", onParsed); callback(err, null); }.bind(this); - this.once('parsed', onParsed); - this.once('error', onError); + this.once("parsed", onParsed); + this.once("error", onError); } this.end(data); return this; }; -PNG.prototype.write = function(data) { +PNG.prototype.write = function (data) { this._parser.write(data); return true; }; -PNG.prototype.end = function(data) { +PNG.prototype.end = function (data) { this._parser.end(data); }; -PNG.prototype._metadata = function(metadata) { +PNG.prototype._metadata = function (metadata) { this.width = metadata.width; this.height = metadata.height; - this.emit('metadata', metadata); + this.emit("metadata", metadata); }; -PNG.prototype._gamma = function(gamma) { +PNG.prototype._gamma = function (gamma) { this.gamma = gamma; }; -PNG.prototype._handleClose = function() { +PNG.prototype._handleClose = function () { if (!this._parser.writable && !this._packer.readable) { - this.emit('close'); + this.emit("close"); } }; - -PNG.bitblt = function(src, dst, srcX, srcY, width, height, deltaX, deltaY) { // eslint-disable-line max-params +PNG.bitblt = function (src, dst, srcX, srcY, width, height, deltaX, deltaY) { + // eslint-disable-line max-params // coerce pixel dimensions to integers (also coerces undefined -> 0): /* eslint-disable no-param-reassign */ srcX |= 0; @@ -2261,16 +2296,27 @@ PNG.bitblt = function(src, dst, srcX, srcY, width, height, deltaX, deltaY) { // deltaY |= 0; /* eslint-enable no-param-reassign */ - if (srcX > src.width || srcY > src.height || srcX + width > src.width || srcY + height > src.height) { - throw new Error('bitblt reading outside image'); + if ( + srcX > src.width || + srcY > src.height || + srcX + width > src.width || + srcY + height > src.height + ) { + throw new Error("bitblt reading outside image"); } - if (deltaX > dst.width || deltaY > dst.height || deltaX + width > dst.width || deltaY + height > dst.height) { - throw new Error('bitblt writing outside image'); + if ( + deltaX > dst.width || + deltaY > dst.height || + deltaX + width > dst.width || + deltaY + height > dst.height + ) { + throw new Error("bitblt writing outside image"); } - for (var y = 0; y < height; y++) { - src.data.copy(dst.data, + for (let y = 0; y < height; y++) { + src.data.copy( + dst.data, ((deltaY + y) * dst.width + deltaX) << 2, ((srcY + y) * src.width + srcX) << 2, ((srcY + y) * src.width + srcX + width) << 2 @@ -2278,21 +2324,29 @@ PNG.bitblt = function(src, dst, srcX, srcY, width, height, deltaX, deltaY) { // } }; - -PNG.prototype.bitblt = function(dst, srcX, srcY, width, height, deltaX, deltaY) { // eslint-disable-line max-params +PNG.prototype.bitblt = function ( + dst, + srcX, + srcY, + width, + height, + deltaX, + deltaY +) { + // eslint-disable-line max-params PNG.bitblt(this, dst, srcX, srcY, width, height, deltaX, deltaY); return this; }; -PNG.adjustGamma = function(src) { +PNG.adjustGamma = function (src) { if (src.gamma) { - for (var y = 0; y < src.height; y++) { - for (var x = 0; x < src.width; x++) { - var idx = (src.width * y + x) << 2; + for (let y = 0; y < src.height; y++) { + for (let x = 0; x < src.width; x++) { + let idx = (src.width * y + x) << 2; - for (var i = 0; i < 3; i++) { - var sample = src.data[idx + i] / 255; + for (let i = 0; i < 3; i++) { + let sample = src.data[idx + i] / 255; sample = Math.pow(sample, 1 / 2.2 / src.gamma); src.data[idx + i] = Math.round(sample * 255); } @@ -2302,20 +2356,20 @@ PNG.adjustGamma = function(src) { } }; -PNG.prototype.adjustGamma = function() { +PNG.prototype.adjustGamma = function () { PNG.adjustGamma(this); }; -}).call(this,require('_process'),require("buffer").Buffer) -},{"./packer-async":12,"./parser-async":16,"./png-sync":19,"_process":51,"buffer":32,"stream":64,"util":69}],21:[function(require,module,exports){ -(function (process,Buffer){ -'use strict'; +}).call(this)}).call(this,require('_process'),require("buffer").Buffer) +},{"./packer-async":12,"./parser-async":16,"./png-sync":19,"_process":60,"buffer":33,"stream":61,"util":81}],21:[function(require,module,exports){ +(function (process,Buffer){(function (){ +"use strict"; -var assert = require('assert').ok; -var zlib = require('zlib'); -var util = require('util'); +let assert = require("assert").ok; +let zlib = require("zlib"); +let util = require("util"); -var kMaxLength = require('buffer').kMaxLength; +let kMaxLength = require("buffer").kMaxLength; function Inflate(opts) { if (!(this instanceof Inflate)) { @@ -2355,23 +2409,23 @@ function _close(engine, callback) { engine._handle = null; } -Inflate.prototype._processChunk = function(chunk, flushFlag, asyncCb) { - if (typeof asyncCb === 'function') { +Inflate.prototype._processChunk = function (chunk, flushFlag, asyncCb) { + if (typeof asyncCb === "function") { return zlib.Inflate._processChunk.call(this, chunk, flushFlag, asyncCb); } - var self = this; + let self = this; - var availInBefore = chunk && chunk.length; - var availOutBefore = this._chunkSize - this._offset; - var leftToInflate = this._maxLength; - var inOff = 0; + let availInBefore = chunk && chunk.length; + let availOutBefore = this._chunkSize - this._offset; + let leftToInflate = this._maxLength; + let inOff = 0; - var buffers = []; - var nread = 0; + let buffers = []; + let nread = 0; - var error; - this.on('error', function(err) { + let error; + this.on("error", function (err) { error = err; }); @@ -2380,11 +2434,11 @@ Inflate.prototype._processChunk = function(chunk, flushFlag, asyncCb) { return; } - var have = availOutBefore - availOutAfter; - assert(have >= 0, 'have should not go down'); + let have = availOutBefore - availOutAfter; + assert(have >= 0, "have should not go down"); if (have > 0) { - var out = self._buffer.slice(self._offset, self._offset + have); + let out = self._buffer.slice(self._offset, self._offset + have); self._offset += have; if (out.length > leftToInflate) { @@ -2407,7 +2461,7 @@ Inflate.prototype._processChunk = function(chunk, flushFlag, asyncCb) { } if (availOutAfter === 0) { - inOff += (availInBefore - availInAfter); + inOff += availInBefore - availInAfter; availInBefore = availInAfter; return true; @@ -2416,15 +2470,18 @@ Inflate.prototype._processChunk = function(chunk, flushFlag, asyncCb) { return false; } - assert(this._handle, 'zlib binding closed'); + assert(this._handle, "zlib binding closed"); + let res; do { - var res = this._handle.writeSync(flushFlag, + res = this._handle.writeSync( + flushFlag, chunk, // in inOff, // in_off availInBefore, // in_len this._buffer, // out this._offset, //out_off - availOutBefore); // out_len + availOutBefore + ); // out_len // Node 8 --> 9 compatibility check res = res || this._writeState; } while (!this._hadError && handleChunk(res[0], res[1])); @@ -2435,10 +2492,14 @@ Inflate.prototype._processChunk = function(chunk, flushFlag, asyncCb) { if (nread >= kMaxLength) { _close(this); - throw new RangeError('Cannot create final Buffer. It would be larger than 0x' + kMaxLength.toString(16) + ' bytes'); + throw new RangeError( + "Cannot create final Buffer. It would be larger than 0x" + + kMaxLength.toString(16) + + " bytes" + ); } - var buf = Buffer.concat(buffers, nread); + let buf = Buffer.concat(buffers, nread); _close(this); return buf; @@ -2447,14 +2508,14 @@ Inflate.prototype._processChunk = function(chunk, flushFlag, asyncCb) { util.inherits(Inflate, zlib.Inflate); function zlibBufferSync(engine, buffer) { - if (typeof buffer === 'string') { + if (typeof buffer === "string") { buffer = Buffer.from(buffer); } if (!(buffer instanceof Buffer)) { - throw new TypeError('Not a string or buffer'); + throw new TypeError("Not a string or buffer"); } - var flushFlag = engine._finishFlushFlag; + let flushFlag = engine._finishFlushFlag; if (flushFlag == null) { flushFlag = zlib.Z_FINISH; } @@ -2471,62 +2532,56 @@ exports.Inflate = Inflate; exports.createInflate = createInflate; exports.inflateSync = inflateSync; -}).call(this,require('_process'),require("buffer").Buffer) -},{"_process":51,"assert":23,"buffer":32,"util":69,"zlib":30}],22:[function(require,module,exports){ -'use strict'; - -var SyncReader = module.exports = function(buffer) { +}).call(this)}).call(this,require('_process'),require("buffer").Buffer) +},{"_process":60,"assert":23,"buffer":33,"util":81,"zlib":32}],22:[function(require,module,exports){ +"use strict"; +let SyncReader = (module.exports = function (buffer) { this._buffer = buffer; this._reads = []; -}; - -SyncReader.prototype.read = function(length, callback) { +}); +SyncReader.prototype.read = function (length, callback) { this._reads.push({ length: Math.abs(length), // if length < 0 then at most this length allowLess: length < 0, - func: callback + func: callback, }); }; -SyncReader.prototype.process = function() { - +SyncReader.prototype.process = function () { // as long as there is any data and read requests while (this._reads.length > 0 && this._buffer.length) { + let read = this._reads[0]; - var read = this._reads[0]; - - if (this._buffer.length && (this._buffer.length >= read.length || read.allowLess)) { - + if ( + this._buffer.length && + (this._buffer.length >= read.length || read.allowLess) + ) { // ok there is any data so that we can satisfy this request this._reads.shift(); // == read - var buf = this._buffer; + let buf = this._buffer; this._buffer = buf.slice(read.length); read.func.call(this, buf.slice(0, read.length)); - - } - else { + } else { break; } - } if (this._reads.length > 0) { - return new Error('There are some read requests waitng on finished stream'); + throw new Error("There are some read requests waitng on finished stream"); } if (this._buffer.length > 0) { - return new Error('unrecognised content at end of stream'); + throw new Error("unrecognised content at end of stream"); } - }; },{}],23:[function(require,module,exports){ -(function (global){ +(function (global){(function (){ 'use strict'; // compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js @@ -3018,7 +3073,7 @@ var objectKeys = Object.keys || function (obj) { return keys; }; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"util/":26}],24:[function(require,module,exports){ if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module @@ -3052,7 +3107,7 @@ module.exports = function isBuffer(arg) { && typeof arg.readUInt8 === 'function'; } },{}],26:[function(require,module,exports){ -(function (process,global){ +(function (process,global){(function (){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -3640,8 +3695,60 @@ function hasOwnProperty(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":25,"_process":51,"inherits":24}],27:[function(require,module,exports){ +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./support/isBuffer":25,"_process":60,"inherits":24}],27:[function(require,module,exports){ +(function (global){(function (){ +'use strict'; + +var filter = require('array-filter'); + +module.exports = function availableTypedArrays() { + return filter([ + 'BigInt64Array', + 'BigUint64Array', + 'Float32Array', + 'Float64Array', + 'Int16Array', + 'Int32Array', + 'Int8Array', + 'Uint16Array', + 'Uint32Array', + 'Uint8Array', + 'Uint8ClampedArray' + ], function (typedArray) { + return typeof global[typedArray] === 'function'; + }); +}; + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"array-filter":28}],28:[function(require,module,exports){ + +/** + * Array#filter. + * + * @param {Array} arr + * @param {Function} fn + * @param {Object=} self + * @return {Array} + * @throw TypeError + */ + +module.exports = function (arr, fn, self) { + if (arr.filter) return arr.filter(fn, self); + if (void 0 === arr || null === arr) throw new TypeError; + if ('function' != typeof fn) throw new TypeError; + var ret = []; + for (var i = 0; i < arr.length; i++) { + if (!hasOwn.call(arr, i)) continue; + var val = arr[i]; + if (fn.call(self, val, i, arr)) ret.push(val); + } + return ret; +}; + +var hasOwn = Object.prototype.hasOwnProperty; + +},{}],29:[function(require,module,exports){ 'use strict' exports.byteLength = byteLength @@ -3709,7 +3816,8 @@ function toByteArray (b64) { ? validLen - 4 : validLen - for (var i = 0; i < len; i += 4) { + var i + for (i = 0; i < len; i += 4) { tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | @@ -3794,10 +3902,10 @@ function fromByteArray (uint8) { return parts.join('') } -},{}],28:[function(require,module,exports){ +},{}],30:[function(require,module,exports){ -},{}],29:[function(require,module,exports){ -(function (process,Buffer){ +},{}],31:[function(require,module,exports){ +(function (process,Buffer){(function (){ 'use strict'; /* eslint camelcase: "off" */ @@ -4207,9 +4315,9 @@ Zlib.prototype._reset = function () { }; exports.Zlib = Zlib; -}).call(this,require('_process'),require("buffer").Buffer) -},{"_process":51,"assert":23,"buffer":32,"pako/lib/zlib/constants":41,"pako/lib/zlib/deflate.js":43,"pako/lib/zlib/inflate.js":45,"pako/lib/zlib/zstream":49}],30:[function(require,module,exports){ -(function (process){ +}).call(this)}).call(this,require('_process'),require("buffer").Buffer) +},{"_process":60,"assert":23,"buffer":33,"pako/lib/zlib/constants":51,"pako/lib/zlib/deflate.js":53,"pako/lib/zlib/inflate.js":55,"pako/lib/zlib/zstream":59}],32:[function(require,module,exports){ +(function (process){(function (){ 'use strict'; var Buffer = require('buffer').Buffer; @@ -4819,121 +4927,9 @@ util.inherits(Gunzip, Zlib); util.inherits(DeflateRaw, Zlib); util.inherits(InflateRaw, Zlib); util.inherits(Unzip, Zlib); -}).call(this,require('_process')) -},{"./binding":29,"_process":51,"assert":23,"buffer":32,"stream":64,"util":69}],31:[function(require,module,exports){ -(function (global){ -'use strict'; - -var buffer = require('buffer'); -var Buffer = buffer.Buffer; -var SlowBuffer = buffer.SlowBuffer; -var MAX_LEN = buffer.kMaxLength || 2147483647; -exports.alloc = function alloc(size, fill, encoding) { - if (typeof Buffer.alloc === 'function') { - return Buffer.alloc(size, fill, encoding); - } - if (typeof encoding === 'number') { - throw new TypeError('encoding must not be number'); - } - if (typeof size !== 'number') { - throw new TypeError('size must be a number'); - } - if (size > MAX_LEN) { - throw new RangeError('size is too large'); - } - var enc = encoding; - var _fill = fill; - if (_fill === undefined) { - enc = undefined; - _fill = 0; - } - var buf = new Buffer(size); - if (typeof _fill === 'string') { - var fillBuf = new Buffer(_fill, enc); - var flen = fillBuf.length; - var i = -1; - while (++i < size) { - buf[i] = fillBuf[i % flen]; - } - } else { - buf.fill(_fill); - } - return buf; -} -exports.allocUnsafe = function allocUnsafe(size) { - if (typeof Buffer.allocUnsafe === 'function') { - return Buffer.allocUnsafe(size); - } - if (typeof size !== 'number') { - throw new TypeError('size must be a number'); - } - if (size > MAX_LEN) { - throw new RangeError('size is too large'); - } - return new Buffer(size); -} -exports.from = function from(value, encodingOrOffset, length) { - if (typeof Buffer.from === 'function' && (!global.Uint8Array || Uint8Array.from !== Buffer.from)) { - return Buffer.from(value, encodingOrOffset, length); - } - if (typeof value === 'number') { - throw new TypeError('"value" argument must not be a number'); - } - if (typeof value === 'string') { - return new Buffer(value, encodingOrOffset); - } - if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { - var offset = encodingOrOffset; - if (arguments.length === 1) { - return new Buffer(value); - } - if (typeof offset === 'undefined') { - offset = 0; - } - var len = length; - if (typeof len === 'undefined') { - len = value.byteLength - offset; - } - if (offset >= value.byteLength) { - throw new RangeError('\'offset\' is out of bounds'); - } - if (len > value.byteLength - offset) { - throw new RangeError('\'length\' is out of bounds'); - } - return new Buffer(value.slice(offset, offset + len)); - } - if (Buffer.isBuffer(value)) { - var out = new Buffer(value.length); - value.copy(out, 0, 0, value.length); - return out; - } - if (value) { - if (Array.isArray(value) || (typeof ArrayBuffer !== 'undefined' && value.buffer instanceof ArrayBuffer) || 'length' in value) { - return new Buffer(value); - } - if (value.type === 'Buffer' && Array.isArray(value.data)) { - return new Buffer(value.data); - } - } - - throw new TypeError('First argument must be a string, Buffer, ' + 'ArrayBuffer, Array, or array-like object.'); -} -exports.allocUnsafeSlow = function allocUnsafeSlow(size) { - if (typeof Buffer.allocUnsafeSlow === 'function') { - return Buffer.allocUnsafeSlow(size); - } - if (typeof size !== 'number') { - throw new TypeError('size must be a number'); - } - if (size >= MAX_LEN) { - throw new RangeError('size is too large'); - } - return new SlowBuffer(size); -} - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"buffer":32}],32:[function(require,module,exports){ -(function (Buffer){ +}).call(this)}).call(this,require('_process')) +},{"./binding":31,"_process":60,"assert":23,"buffer":33,"stream":61,"util":81}],33:[function(require,module,exports){ +(function (Buffer){(function (){ /*! * The buffer module from node.js, for the browser. * @@ -6712,119 +6708,281 @@ function numberIsNaN (obj) { return obj !== obj // eslint-disable-line no-self-compare } -}).call(this,require("buffer").Buffer) -},{"base64-js":27,"buffer":32,"ieee754":35}],33:[function(require,module,exports){ -(function (Buffer){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. +}).call(this)}).call(this,require("buffer").Buffer) +},{"base64-js":29,"buffer":33,"ieee754":44}],34:[function(require,module,exports){ +'use strict'; -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. +/* globals + Atomics, + SharedArrayBuffer, +*/ -function isArray(arg) { - if (Array.isArray) { - return Array.isArray(arg); - } - return objectToString(arg) === '[object Array]'; -} -exports.isArray = isArray; +var undefined; + +var $TypeError = TypeError; + +var $gOPD = Object.getOwnPropertyDescriptor; +if ($gOPD) { + try { + $gOPD({}, ''); + } catch (e) { + $gOPD = null; // this is IE 8, which has a broken gOPD + } +} + +var throwTypeError = function () { throw new $TypeError(); }; +var ThrowTypeError = $gOPD + ? (function () { + try { + // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties + arguments.callee; // IE 8 does not throw here + return throwTypeError; + } catch (calleeThrows) { + try { + // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '') + return $gOPD(arguments, 'callee').get; + } catch (gOPDthrows) { + return throwTypeError; + } + } + }()) + : throwTypeError; + +var hasSymbols = require('has-symbols')(); + +var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto + +var generator; // = function * () {}; +var generatorFunction = generator ? getProto(generator) : undefined; +var asyncFn; // async function() {}; +var asyncFunction = asyncFn ? asyncFn.constructor : undefined; +var asyncGen; // async function * () {}; +var asyncGenFunction = asyncGen ? getProto(asyncGen) : undefined; +var asyncGenIterator = asyncGen ? asyncGen() : undefined; + +var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array); + +var INTRINSICS = { + '%Array%': Array, + '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer, + '%ArrayBufferPrototype%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer.prototype, + '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined, + '%ArrayPrototype%': Array.prototype, + '%ArrayProto_entries%': Array.prototype.entries, + '%ArrayProto_forEach%': Array.prototype.forEach, + '%ArrayProto_keys%': Array.prototype.keys, + '%ArrayProto_values%': Array.prototype.values, + '%AsyncFromSyncIteratorPrototype%': undefined, + '%AsyncFunction%': asyncFunction, + '%AsyncFunctionPrototype%': asyncFunction ? asyncFunction.prototype : undefined, + '%AsyncGenerator%': asyncGen ? getProto(asyncGenIterator) : undefined, + '%AsyncGeneratorFunction%': asyncGenFunction, + '%AsyncGeneratorPrototype%': asyncGenFunction ? asyncGenFunction.prototype : undefined, + '%AsyncIteratorPrototype%': asyncGenIterator && hasSymbols && Symbol.asyncIterator ? asyncGenIterator[Symbol.asyncIterator]() : undefined, + '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics, + '%Boolean%': Boolean, + '%BooleanPrototype%': Boolean.prototype, + '%DataView%': typeof DataView === 'undefined' ? undefined : DataView, + '%DataViewPrototype%': typeof DataView === 'undefined' ? undefined : DataView.prototype, + '%Date%': Date, + '%DatePrototype%': Date.prototype, + '%decodeURI%': decodeURI, + '%decodeURIComponent%': decodeURIComponent, + '%encodeURI%': encodeURI, + '%encodeURIComponent%': encodeURIComponent, + '%Error%': Error, + '%ErrorPrototype%': Error.prototype, + '%eval%': eval, // eslint-disable-line no-eval + '%EvalError%': EvalError, + '%EvalErrorPrototype%': EvalError.prototype, + '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array, + '%Float32ArrayPrototype%': typeof Float32Array === 'undefined' ? undefined : Float32Array.prototype, + '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array, + '%Float64ArrayPrototype%': typeof Float64Array === 'undefined' ? undefined : Float64Array.prototype, + '%Function%': Function, + '%FunctionPrototype%': Function.prototype, + '%Generator%': generator ? getProto(generator()) : undefined, + '%GeneratorFunction%': generatorFunction, + '%GeneratorPrototype%': generatorFunction ? generatorFunction.prototype : undefined, + '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array, + '%Int8ArrayPrototype%': typeof Int8Array === 'undefined' ? undefined : Int8Array.prototype, + '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array, + '%Int16ArrayPrototype%': typeof Int16Array === 'undefined' ? undefined : Int8Array.prototype, + '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array, + '%Int32ArrayPrototype%': typeof Int32Array === 'undefined' ? undefined : Int32Array.prototype, + '%isFinite%': isFinite, + '%isNaN%': isNaN, + '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined, + '%JSON%': typeof JSON === 'object' ? JSON : undefined, + '%JSONParse%': typeof JSON === 'object' ? JSON.parse : undefined, + '%Map%': typeof Map === 'undefined' ? undefined : Map, + '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()), + '%MapPrototype%': typeof Map === 'undefined' ? undefined : Map.prototype, + '%Math%': Math, + '%Number%': Number, + '%NumberPrototype%': Number.prototype, + '%Object%': Object, + '%ObjectPrototype%': Object.prototype, + '%ObjProto_toString%': Object.prototype.toString, + '%ObjProto_valueOf%': Object.prototype.valueOf, + '%parseFloat%': parseFloat, + '%parseInt%': parseInt, + '%Promise%': typeof Promise === 'undefined' ? undefined : Promise, + '%PromisePrototype%': typeof Promise === 'undefined' ? undefined : Promise.prototype, + '%PromiseProto_then%': typeof Promise === 'undefined' ? undefined : Promise.prototype.then, + '%Promise_all%': typeof Promise === 'undefined' ? undefined : Promise.all, + '%Promise_reject%': typeof Promise === 'undefined' ? undefined : Promise.reject, + '%Promise_resolve%': typeof Promise === 'undefined' ? undefined : Promise.resolve, + '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy, + '%RangeError%': RangeError, + '%RangeErrorPrototype%': RangeError.prototype, + '%ReferenceError%': ReferenceError, + '%ReferenceErrorPrototype%': ReferenceError.prototype, + '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect, + '%RegExp%': RegExp, + '%RegExpPrototype%': RegExp.prototype, + '%Set%': typeof Set === 'undefined' ? undefined : Set, + '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()), + '%SetPrototype%': typeof Set === 'undefined' ? undefined : Set.prototype, + '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer, + '%SharedArrayBufferPrototype%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer.prototype, + '%String%': String, + '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined, + '%StringPrototype%': String.prototype, + '%Symbol%': hasSymbols ? Symbol : undefined, + '%SymbolPrototype%': hasSymbols ? Symbol.prototype : undefined, + '%SyntaxError%': SyntaxError, + '%SyntaxErrorPrototype%': SyntaxError.prototype, + '%ThrowTypeError%': ThrowTypeError, + '%TypedArray%': TypedArray, + '%TypedArrayPrototype%': TypedArray ? TypedArray.prototype : undefined, + '%TypeError%': $TypeError, + '%TypeErrorPrototype%': $TypeError.prototype, + '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array, + '%Uint8ArrayPrototype%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array.prototype, + '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray, + '%Uint8ClampedArrayPrototype%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray.prototype, + '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array, + '%Uint16ArrayPrototype%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array.prototype, + '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array, + '%Uint32ArrayPrototype%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array.prototype, + '%URIError%': URIError, + '%URIErrorPrototype%': URIError.prototype, + '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap, + '%WeakMapPrototype%': typeof WeakMap === 'undefined' ? undefined : WeakMap.prototype, + '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet, + '%WeakSetPrototype%': typeof WeakSet === 'undefined' ? undefined : WeakSet.prototype +}; -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; +var bind = require('function-bind'); +var $replace = bind.call(Function.call, String.prototype.replace); + +/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */ +var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; +var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */ +var stringToPath = function stringToPath(string) { + var result = []; + $replace(string, rePropName, function (match, number, quote, subString) { + result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : (number || match); + }); + return result; +}; +/* end adaptation */ -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; +var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) { + if (!(name in INTRINSICS)) { + throw new SyntaxError('intrinsic ' + name + ' does not exist!'); + } -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; + // istanbul ignore if // hopefully this is impossible to test :-) + if (typeof INTRINSICS[name] === 'undefined' && !allowMissing) { + throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!'); + } -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; + return INTRINSICS[name]; +}; -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; +module.exports = function GetIntrinsic(name, allowMissing) { + if (typeof name !== 'string' || name.length === 0) { + throw new TypeError('intrinsic name must be a non-empty string'); + } + if (arguments.length > 1 && typeof allowMissing !== 'boolean') { + throw new TypeError('"allowMissing" argument must be a boolean'); + } + + var parts = stringToPath(name); + + var value = getBaseIntrinsic('%' + (parts.length > 0 ? parts[0] : '') + '%', allowMissing); + for (var i = 1; i < parts.length; i += 1) { + if (value != null) { + if ($gOPD && (i + 1) >= parts.length) { + var desc = $gOPD(value, parts[i]); + if (!allowMissing && !(parts[i] in value)) { + throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.'); + } + value = desc ? (desc.get || desc.value) : value[parts[i]]; + } else { + value = value[parts[i]]; + } + } + } + return value; +}; -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; +},{"function-bind":41,"has-symbols":42}],35:[function(require,module,exports){ +'use strict'; -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; +var bind = require('function-bind'); -function isRegExp(re) { - return objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; +var GetIntrinsic = require('../GetIntrinsic'); -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; +var $Function = GetIntrinsic('%Function%'); +var $apply = $Function.apply; +var $call = $Function.call; -function isDate(d) { - return objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; +module.exports = function callBind() { + return bind.apply($call, arguments); +}; -function isError(e) { - return (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; +module.exports.apply = function applyBind() { + return bind.apply($apply, arguments); +}; -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; +},{"../GetIntrinsic":34,"function-bind":41}],36:[function(require,module,exports){ +'use strict'; -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; +var GetIntrinsic = require('../GetIntrinsic'); -exports.isBuffer = Buffer.isBuffer; +var callBind = require('./callBind'); -function objectToString(o) { - return Object.prototype.toString.call(o); +var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf')); + +module.exports = function callBoundIntrinsic(name, allowMissing) { + var intrinsic = GetIntrinsic(name, !!allowMissing); + if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.')) { + return callBind(intrinsic); + } + return intrinsic; +}; + +},{"../GetIntrinsic":34,"./callBind":35}],37:[function(require,module,exports){ +'use strict'; + +var GetIntrinsic = require('../GetIntrinsic'); + +var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%'); +if ($gOPD) { + try { + $gOPD([], 'length'); + } catch (e) { + // IE 8 has a broken gOPD + $gOPD = null; + } } -}).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":37}],34:[function(require,module,exports){ +module.exports = $gOPD; + +},{"../GetIntrinsic":34}],38:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -6846,289 +7004,609 @@ function objectToString(o) { // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. +'use strict'; + +var R = typeof Reflect === 'object' ? Reflect : null +var ReflectApply = R && typeof R.apply === 'function' + ? R.apply + : function ReflectApply(target, receiver, args) { + return Function.prototype.apply.call(target, receiver, args); + } + +var ReflectOwnKeys +if (R && typeof R.ownKeys === 'function') { + ReflectOwnKeys = R.ownKeys +} else if (Object.getOwnPropertySymbols) { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target) + .concat(Object.getOwnPropertySymbols(target)); + }; +} else { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target); + }; +} + +function ProcessEmitWarning(warning) { + if (console && console.warn) console.warn(warning); +} + +var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) { + return value !== value; +} + function EventEmitter() { - this._events = this._events || {}; - this._maxListeners = this._maxListeners || undefined; + EventEmitter.init.call(this); } module.exports = EventEmitter; +module.exports.once = once; // Backwards-compat with node 0.10.x EventEmitter.EventEmitter = EventEmitter; EventEmitter.prototype._events = undefined; +EventEmitter.prototype._eventsCount = 0; EventEmitter.prototype._maxListeners = undefined; // By default EventEmitters will print a warning if more than 10 listeners are // added to it. This is a useful default which helps finding memory leaks. -EventEmitter.defaultMaxListeners = 10; +var defaultMaxListeners = 10; + +function checkListener(listener) { + if (typeof listener !== 'function') { + throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); + } +} + +Object.defineProperty(EventEmitter, 'defaultMaxListeners', { + enumerable: true, + get: function() { + return defaultMaxListeners; + }, + set: function(arg) { + if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { + throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); + } + defaultMaxListeners = arg; + } +}); + +EventEmitter.init = function() { + + if (this._events === undefined || + this._events === Object.getPrototypeOf(this)._events) { + this._events = Object.create(null); + this._eventsCount = 0; + } + + this._maxListeners = this._maxListeners || undefined; +}; // Obviously not all Emitters should be limited to 10. This function allows // that to be increased. Set to zero for unlimited. -EventEmitter.prototype.setMaxListeners = function(n) { - if (!isNumber(n) || n < 0 || isNaN(n)) - throw TypeError('n must be a positive number'); +EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { + if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { + throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); + } this._maxListeners = n; return this; }; -EventEmitter.prototype.emit = function(type) { - var er, handler, len, args, i, listeners; +function _getMaxListeners(that) { + if (that._maxListeners === undefined) + return EventEmitter.defaultMaxListeners; + return that._maxListeners; +} + +EventEmitter.prototype.getMaxListeners = function getMaxListeners() { + return _getMaxListeners(this); +}; + +EventEmitter.prototype.emit = function emit(type) { + var args = []; + for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); + var doError = (type === 'error'); - if (!this._events) - this._events = {}; + var events = this._events; + if (events !== undefined) + doError = (doError && events.error === undefined); + else if (!doError) + return false; // If there is no 'error' event listener then throw. - if (type === 'error') { - if (!this._events.error || - (isObject(this._events.error) && !this._events.error.length)) { - er = arguments[1]; - if (er instanceof Error) { - throw er; // Unhandled 'error' event - } else { - // At least give some kind of context to the user - var err = new Error('Uncaught, unspecified "error" event. (' + er + ')'); - err.context = er; - throw err; - } + if (doError) { + var er; + if (args.length > 0) + er = args[0]; + if (er instanceof Error) { + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. + throw er; // Unhandled 'error' event } + // At least give some kind of context to the user + var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); + err.context = er; + throw err; // Unhandled 'error' event } - handler = this._events[type]; + var handler = events[type]; - if (isUndefined(handler)) + if (handler === undefined) return false; - if (isFunction(handler)) { - switch (arguments.length) { - // fast cases - case 1: - handler.call(this); - break; - case 2: - handler.call(this, arguments[1]); - break; - case 3: - handler.call(this, arguments[1], arguments[2]); - break; - // slower - default: - args = Array.prototype.slice.call(arguments, 1); - handler.apply(this, args); - } - } else if (isObject(handler)) { - args = Array.prototype.slice.call(arguments, 1); - listeners = handler.slice(); - len = listeners.length; - for (i = 0; i < len; i++) - listeners[i].apply(this, args); + if (typeof handler === 'function') { + ReflectApply(handler, this, args); + } else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + ReflectApply(listeners[i], this, args); } return true; }; -EventEmitter.prototype.addListener = function(type, listener) { +function _addListener(target, type, listener, prepend) { var m; + var events; + var existing; - if (!isFunction(listener)) - throw TypeError('listener must be a function'); + checkListener(listener); - if (!this._events) - this._events = {}; + events = target._events; + if (events === undefined) { + events = target._events = Object.create(null); + target._eventsCount = 0; + } else { + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (events.newListener !== undefined) { + target.emit('newListener', type, + listener.listener ? listener.listener : listener); - // To avoid recursion in the case that type === "newListener"! Before - // adding it to the listeners, first emit "newListener". - if (this._events.newListener) - this.emit('newListener', type, - isFunction(listener.listener) ? - listener.listener : listener); + // Re-assign `events` because a newListener handler could have caused the + // this._events to be assigned to a new object + events = target._events; + } + existing = events[type]; + } - if (!this._events[type]) + if (existing === undefined) { // Optimize the case of one listener. Don't need the extra array object. - this._events[type] = listener; - else if (isObject(this._events[type])) - // If we've already got an array, just append. - this._events[type].push(listener); - else - // Adding the second element, need to change to array. - this._events[type] = [this._events[type], listener]; - - // Check for listener leak - if (isObject(this._events[type]) && !this._events[type].warned) { - if (!isUndefined(this._maxListeners)) { - m = this._maxListeners; + existing = events[type] = listener; + ++target._eventsCount; + } else { + if (typeof existing === 'function') { + // Adding the second element, need to change to array. + existing = events[type] = + prepend ? [listener, existing] : [existing, listener]; + // If we've already got an array, just append. + } else if (prepend) { + existing.unshift(listener); } else { - m = EventEmitter.defaultMaxListeners; - } - - if (m && m > 0 && this._events[type].length > m) { - this._events[type].warned = true; - console.error('(node) warning: possible EventEmitter memory ' + - 'leak detected. %d listeners added. ' + - 'Use emitter.setMaxListeners() to increase limit.', - this._events[type].length); - if (typeof console.trace === 'function') { - // not supported in IE 10 - console.trace(); - } + existing.push(listener); + } + + // Check for listener leak + m = _getMaxListeners(target); + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; + // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + var w = new Error('Possible EventEmitter memory leak detected. ' + + existing.length + ' ' + String(type) + ' listeners ' + + 'added. Use emitter.setMaxListeners() to ' + + 'increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + ProcessEmitWarning(w); } } - return this; + return target; +} + +EventEmitter.prototype.addListener = function addListener(type, listener) { + return _addListener(this, type, listener, false); }; EventEmitter.prototype.on = EventEmitter.prototype.addListener; -EventEmitter.prototype.once = function(type, listener) { - if (!isFunction(listener)) - throw TypeError('listener must be a function'); - - var fired = false; - - function g() { - this.removeListener(type, g); +EventEmitter.prototype.prependListener = + function prependListener(type, listener) { + return _addListener(this, type, listener, true); + }; - if (!fired) { - fired = true; - listener.apply(this, arguments); - } +function onceWrapper() { + if (!this.fired) { + this.target.removeListener(this.type, this.wrapFn); + this.fired = true; + if (arguments.length === 0) + return this.listener.call(this.target); + return this.listener.apply(this.target, arguments); } +} - g.listener = listener; - this.on(type, g); +function _onceWrap(target, type, listener) { + var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; + var wrapped = onceWrapper.bind(state); + wrapped.listener = listener; + state.wrapFn = wrapped; + return wrapped; +} +EventEmitter.prototype.once = function once(type, listener) { + checkListener(listener); + this.on(type, _onceWrap(this, type, listener)); return this; }; -// emits a 'removeListener' event iff the listener was removed -EventEmitter.prototype.removeListener = function(type, listener) { - var list, position, length, i; +EventEmitter.prototype.prependOnceListener = + function prependOnceListener(type, listener) { + checkListener(listener); + this.prependListener(type, _onceWrap(this, type, listener)); + return this; + }; - if (!isFunction(listener)) - throw TypeError('listener must be a function'); +// Emits a 'removeListener' event if and only if the listener was removed. +EventEmitter.prototype.removeListener = + function removeListener(type, listener) { + var list, events, position, i, originalListener; - if (!this._events || !this._events[type]) - return this; + checkListener(listener); - list = this._events[type]; - length = list.length; - position = -1; - - if (list === listener || - (isFunction(list.listener) && list.listener === listener)) { - delete this._events[type]; - if (this._events.removeListener) - this.emit('removeListener', type, listener); - - } else if (isObject(list)) { - for (i = length; i-- > 0;) { - if (list[i] === listener || - (list[i].listener && list[i].listener === listener)) { - position = i; - break; + events = this._events; + if (events === undefined) + return this; + + list = events[type]; + if (list === undefined) + return this; + + if (list === listener || list.listener === listener) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else { + delete events[type]; + if (events.removeListener) + this.emit('removeListener', type, list.listener || listener); + } + } else if (typeof list !== 'function') { + position = -1; + + for (i = list.length - 1; i >= 0; i--) { + if (list[i] === listener || list[i].listener === listener) { + originalListener = list[i].listener; + position = i; + break; + } + } + + if (position < 0) + return this; + + if (position === 0) + list.shift(); + else { + spliceOne(list, position); + } + + if (list.length === 1) + events[type] = list[0]; + + if (events.removeListener !== undefined) + this.emit('removeListener', type, originalListener || listener); } - } - if (position < 0) return this; + }; - if (list.length === 1) { - list.length = 0; - delete this._events[type]; - } else { - list.splice(position, 1); - } +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + +EventEmitter.prototype.removeAllListeners = + function removeAllListeners(type) { + var listeners, events, i; + + events = this._events; + if (events === undefined) + return this; + + // not listening for removeListener, no need to emit + if (events.removeListener === undefined) { + if (arguments.length === 0) { + this._events = Object.create(null); + this._eventsCount = 0; + } else if (events[type] !== undefined) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else + delete events[type]; + } + return this; + } - if (this._events.removeListener) - this.emit('removeListener', type, listener); - } + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + var keys = Object.keys(events); + var key; + for (i = 0; i < keys.length; ++i) { + key = keys[i]; + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = Object.create(null); + this._eventsCount = 0; + return this; + } - return this; -}; + listeners = events[type]; -EventEmitter.prototype.removeAllListeners = function(type) { - var key, listeners; + if (typeof listeners === 'function') { + this.removeListener(type, listeners); + } else if (listeners !== undefined) { + // LIFO order + for (i = listeners.length - 1; i >= 0; i--) { + this.removeListener(type, listeners[i]); + } + } - if (!this._events) - return this; + return this; + }; - // not listening for removeListener, no need to emit - if (!this._events.removeListener) { - if (arguments.length === 0) - this._events = {}; - else if (this._events[type]) - delete this._events[type]; - return this; - } +function _listeners(target, type, unwrap) { + var events = target._events; - // emit removeListener for all listeners on all events - if (arguments.length === 0) { - for (key in this._events) { - if (key === 'removeListener') continue; - this.removeAllListeners(key); - } - this.removeAllListeners('removeListener'); - this._events = {}; - return this; - } + if (events === undefined) + return []; - listeners = this._events[type]; + var evlistener = events[type]; + if (evlistener === undefined) + return []; - if (isFunction(listeners)) { - this.removeListener(type, listeners); - } else if (listeners) { - // LIFO order - while (listeners.length) - this.removeListener(type, listeners[listeners.length - 1]); - } - delete this._events[type]; + if (typeof evlistener === 'function') + return unwrap ? [evlistener.listener || evlistener] : [evlistener]; - return this; + return unwrap ? + unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); +} + +EventEmitter.prototype.listeners = function listeners(type) { + return _listeners(this, type, true); }; -EventEmitter.prototype.listeners = function(type) { - var ret; - if (!this._events || !this._events[type]) - ret = []; - else if (isFunction(this._events[type])) - ret = [this._events[type]]; - else - ret = this._events[type].slice(); - return ret; +EventEmitter.prototype.rawListeners = function rawListeners(type) { + return _listeners(this, type, false); +}; + +EventEmitter.listenerCount = function(emitter, type) { + if (typeof emitter.listenerCount === 'function') { + return emitter.listenerCount(type); + } else { + return listenerCount.call(emitter, type); + } }; -EventEmitter.prototype.listenerCount = function(type) { - if (this._events) { - var evlistener = this._events[type]; +EventEmitter.prototype.listenerCount = listenerCount; +function listenerCount(type) { + var events = this._events; - if (isFunction(evlistener)) + if (events !== undefined) { + var evlistener = events[type]; + + if (typeof evlistener === 'function') { return 1; - else if (evlistener) + } else if (evlistener !== undefined) { return evlistener.length; + } } + return 0; -}; +} -EventEmitter.listenerCount = function(emitter, type) { - return emitter.listenerCount(type); +EventEmitter.prototype.eventNames = function eventNames() { + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; }; -function isFunction(arg) { - return typeof arg === 'function'; +function arrayClone(arr, n) { + var copy = new Array(n); + for (var i = 0; i < n; ++i) + copy[i] = arr[i]; + return copy; } -function isNumber(arg) { - return typeof arg === 'number'; +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) + list[index] = list[index + 1]; + list.pop(); } -function isObject(arg) { - return typeof arg === 'object' && arg !== null; +function unwrapListeners(arr) { + var ret = new Array(arr.length); + for (var i = 0; i < ret.length; ++i) { + ret[i] = arr[i].listener || arr[i]; + } + return ret; } -function isUndefined(arg) { - return arg === void 0; +function once(emitter, name) { + return new Promise(function (resolve, reject) { + function eventListener() { + if (errorListener !== undefined) { + emitter.removeListener('error', errorListener); + } + resolve([].slice.call(arguments)); + }; + var errorListener; + + // Adding an error listener is not optional because + // if an error is thrown on an event emitter we cannot + // guarantee that the actual event we are waiting will + // be fired. The result could be a silent way to create + // memory or file descriptor leaks, which is something + // we should avoid. + if (name !== 'error') { + errorListener = function errorListener(err) { + emitter.removeListener(name, eventListener); + reject(err); + }; + + emitter.once('error', errorListener); + } + + emitter.once(name, eventListener); + }); } -},{}],35:[function(require,module,exports){ +},{}],39:[function(require,module,exports){ + +var hasOwn = Object.prototype.hasOwnProperty; +var toString = Object.prototype.toString; + +module.exports = function forEach (obj, fn, ctx) { + if (toString.call(fn) !== '[object Function]') { + throw new TypeError('iterator must be a function'); + } + var l = obj.length; + if (l === +l) { + for (var i = 0; i < l; i++) { + fn.call(ctx, obj[i], i, obj); + } + } else { + for (var k in obj) { + if (hasOwn.call(obj, k)) { + fn.call(ctx, obj[k], k, obj); + } + } + } +}; + + +},{}],40:[function(require,module,exports){ +'use strict'; + +/* eslint no-invalid-this: 1 */ + +var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; +var slice = Array.prototype.slice; +var toStr = Object.prototype.toString; +var funcType = '[object Function]'; + +module.exports = function bind(that) { + var target = this; + if (typeof target !== 'function' || toStr.call(target) !== funcType) { + throw new TypeError(ERROR_MESSAGE + target); + } + var args = slice.call(arguments, 1); + + var bound; + var binder = function () { + if (this instanceof bound) { + var result = target.apply( + this, + args.concat(slice.call(arguments)) + ); + if (Object(result) === result) { + return result; + } + return this; + } else { + return target.apply( + that, + args.concat(slice.call(arguments)) + ); + } + }; + + var boundLength = Math.max(0, target.length - args.length); + var boundArgs = []; + for (var i = 0; i < boundLength; i++) { + boundArgs.push('$' + i); + } + + bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder); + + if (target.prototype) { + var Empty = function Empty() {}; + Empty.prototype = target.prototype; + bound.prototype = new Empty(); + Empty.prototype = null; + } + + return bound; +}; + +},{}],41:[function(require,module,exports){ +'use strict'; + +var implementation = require('./implementation'); + +module.exports = Function.prototype.bind || implementation; + +},{"./implementation":40}],42:[function(require,module,exports){ +(function (global){(function (){ +'use strict'; + +var origSymbol = global.Symbol; +var hasSymbolSham = require('./shams'); + +module.exports = function hasNativeSymbols() { + if (typeof origSymbol !== 'function') { return false; } + if (typeof Symbol !== 'function') { return false; } + if (typeof origSymbol('foo') !== 'symbol') { return false; } + if (typeof Symbol('bar') !== 'symbol') { return false; } + + return hasSymbolSham(); +}; + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./shams":43}],43:[function(require,module,exports){ +'use strict'; + +/* eslint complexity: [2, 18], max-statements: [2, 33] */ +module.exports = function hasSymbols() { + if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; } + if (typeof Symbol.iterator === 'symbol') { return true; } + + var obj = {}; + var sym = Symbol('test'); + var symObj = Object(sym); + if (typeof sym === 'string') { return false; } + + if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; } + if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; } + + // temp disabled per https://github.com/ljharb/object.assign/issues/17 + // if (sym instanceof Symbol) { return false; } + // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4 + // if (!(symObj instanceof Symbol)) { return false; } + + // if (typeof Symbol.prototype.toString !== 'function') { return false; } + // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; } + + var symVal = 42; + obj[sym] = symVal; + for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax + if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; } + + if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; } + + var syms = Object.getOwnPropertySymbols(obj); + if (syms.length !== 1 || syms[0] !== sym) { return false; } + + if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; } + + if (typeof Object.getOwnPropertyDescriptor === 'function') { + var descriptor = Object.getOwnPropertyDescriptor(obj, sym); + if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; } + } + + return true; +}; + +},{}],44:[function(require,module,exports){ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = (nBytes * 8) - mLen - 1 @@ -7214,39 +7692,168 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { buffer[offset + i - d] |= s * 128 } -},{}],36:[function(require,module,exports){ -arguments[4][24][0].apply(exports,arguments) -},{"dup":24}],37:[function(require,module,exports){ -/*! - * Determine if an object is a Buffer - * - * @author Feross Aboukhadijeh - * @license MIT - */ - -// The _isBuffer check is for Safari 5-7 support, because it's missing -// Object.prototype.constructor. Remove this eventually -module.exports = function (obj) { - return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) +},{}],45:[function(require,module,exports){ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }) + } + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } + } } -function isBuffer (obj) { - return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) -} +},{}],46:[function(require,module,exports){ +'use strict'; -// For Node v0.10 support. Remove this eventually. -function isSlowBuffer (obj) { - return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) -} +var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; +var toStr = Object.prototype.toString; -},{}],38:[function(require,module,exports){ -var toString = {}.toString; +var isStandardArguments = function isArguments(value) { + if (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) { + return false; + } + return toStr.call(value) === '[object Arguments]'; +}; -module.exports = Array.isArray || function (arr) { - return toString.call(arr) == '[object Array]'; +var isLegacyArguments = function isArguments(value) { + if (isStandardArguments(value)) { + return true; + } + return value !== null && + typeof value === 'object' && + typeof value.length === 'number' && + value.length >= 0 && + toStr.call(value) !== '[object Array]' && + toStr.call(value.callee) === '[object Function]'; }; -},{}],39:[function(require,module,exports){ +var supportsStandardArguments = (function () { + return isStandardArguments(arguments); +}()); + +isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests + +module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments; + +},{}],47:[function(require,module,exports){ +'use strict'; + +var toStr = Object.prototype.toString; +var fnToStr = Function.prototype.toString; +var isFnRegex = /^\s*(?:function)?\*/; +var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol'; +var getProto = Object.getPrototypeOf; +var getGeneratorFunc = function () { // eslint-disable-line consistent-return + if (!hasToStringTag) { + return false; + } + try { + return Function('return function*() {}')(); + } catch (e) { + } +}; +var generatorFunc = getGeneratorFunc(); +var GeneratorFunction = generatorFunc ? getProto(generatorFunc) : {}; + +module.exports = function isGeneratorFunction(fn) { + if (typeof fn !== 'function') { + return false; + } + if (isFnRegex.test(fnToStr.call(fn))) { + return true; + } + if (!hasToStringTag) { + var str = toStr.call(fn); + return str === '[object GeneratorFunction]'; + } + return getProto(fn) === GeneratorFunction; +}; + +},{}],48:[function(require,module,exports){ +(function (global){(function (){ +'use strict'; + +var forEach = require('foreach'); +var availableTypedArrays = require('available-typed-arrays'); +var callBound = require('es-abstract/helpers/callBound'); + +var $toString = callBound('Object.prototype.toString'); +var hasSymbols = require('has-symbols')(); +var hasToStringTag = hasSymbols && typeof Symbol.toStringTag === 'symbol'; + +var typedArrays = availableTypedArrays(); + +var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) { + for (var i = 0; i < array.length; i += 1) { + if (array[i] === value) { + return i; + } + } + return -1; +}; +var $slice = callBound('String.prototype.slice'); +var toStrTags = {}; +var gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor'); +var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); +if (hasToStringTag && gOPD && getPrototypeOf) { + forEach(typedArrays, function (typedArray) { + var arr = new global[typedArray](); + if (!(Symbol.toStringTag in arr)) { + throw new EvalError('this engine has support for Symbol.toStringTag, but ' + typedArray + ' does not have the property! Please report this.'); + } + var proto = getPrototypeOf(arr); + var descriptor = gOPD(proto, Symbol.toStringTag); + if (!descriptor) { + var superProto = getPrototypeOf(proto); + descriptor = gOPD(superProto, Symbol.toStringTag); + } + toStrTags[typedArray] = descriptor.get; + }); +} + +var tryTypedArrays = function tryAllTypedArrays(value) { + var anyTrue = false; + forEach(toStrTags, function (getter, typedArray) { + if (!anyTrue) { + try { + anyTrue = getter.call(value) === typedArray; + } catch (e) { /**/ } + } + }); + return anyTrue; +}; + +module.exports = function isTypedArray(value) { + if (!value || typeof value !== 'object') { return false; } + if (!hasToStringTag) { + var tag = $slice($toString(value), 8, -1); + return $indexOf(typedArrays, tag) > -1; + } + if (!gOPD) { return false; } + return tryTypedArrays(value); +}; + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"available-typed-arrays":27,"es-abstract/helpers/callBound":36,"es-abstract/helpers/getOwnPropertyDescriptor":37,"foreach":39,"has-symbols":42}],49:[function(require,module,exports){ 'use strict'; @@ -7353,7 +7960,7 @@ exports.setTyped = function (on) { exports.setTyped(TYPED_OK); -},{}],40:[function(require,module,exports){ +},{}],50:[function(require,module,exports){ 'use strict'; // Note: adler32 takes 12% for level 0 and 2% for level 6. @@ -7406,7 +8013,7 @@ function adler32(adler, buf, len, pos) { module.exports = adler32; -},{}],41:[function(require,module,exports){ +},{}],51:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -7476,7 +8083,7 @@ module.exports = { //Z_NULL: null // Use -1 or null inline, depending on var type }; -},{}],42:[function(require,module,exports){ +},{}],52:[function(require,module,exports){ 'use strict'; // Note: we can't get significant speed boost here. @@ -7537,7 +8144,7 @@ function crc32(crc, buf, len, pos) { module.exports = crc32; -},{}],43:[function(require,module,exports){ +},{}],53:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -8994,7 +9601,7 @@ function deflate(strm, flush) { (!s.gzhead.extra ? 0 : 4) + (!s.gzhead.name ? 0 : 8) + (!s.gzhead.comment ? 0 : 16) - ); + ); put_byte(s, s.gzhead.time & 0xff); put_byte(s, (s.gzhead.time >> 8) & 0xff); put_byte(s, (s.gzhead.time >> 16) & 0xff); @@ -9413,7 +10020,7 @@ exports.deflatePrime = deflatePrime; exports.deflateTune = deflateTune; */ -},{"../utils/common":39,"./adler32":40,"./crc32":42,"./messages":47,"./trees":48}],44:[function(require,module,exports){ +},{"../utils/common":49,"./adler32":50,"./crc32":52,"./messages":57,"./trees":58}],54:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -9760,7 +10367,7 @@ module.exports = function inflate_fast(strm, start) { return; }; -},{}],45:[function(require,module,exports){ +},{}],55:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -11318,7 +11925,7 @@ exports.inflateSyncPoint = inflateSyncPoint; exports.inflateUndermine = inflateUndermine; */ -},{"../utils/common":39,"./adler32":40,"./crc32":42,"./inffast":44,"./inftrees":46}],46:[function(require,module,exports){ +},{"../utils/common":49,"./adler32":50,"./crc32":52,"./inffast":54,"./inftrees":56}],56:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -11663,7 +12270,7 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta return 0; }; -},{"../utils/common":39}],47:[function(require,module,exports){ +},{"../utils/common":49}],57:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -11697,7 +12304,7 @@ module.exports = { '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ }; -},{}],48:[function(require,module,exports){ +},{}],58:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -11719,8 +12326,6 @@ module.exports = { // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. -/* eslint-disable space-unary-ops */ - var utils = require('../utils/common'); /* Public constants ==========================================================*/ @@ -12921,7 +13526,7 @@ exports._tr_flush_block = _tr_flush_block; exports._tr_tally = _tr_tally; exports._tr_align = _tr_align; -},{"../utils/common":39}],49:[function(require,module,exports){ +},{"../utils/common":49}],59:[function(require,module,exports){ 'use strict'; // (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -12970,54 +13575,7 @@ function ZStream() { module.exports = ZStream; -},{}],50:[function(require,module,exports){ -(function (process){ -'use strict'; - -if (!process.version || - process.version.indexOf('v0.') === 0 || - process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { - module.exports = nextTick; -} else { - module.exports = process.nextTick; -} - -function nextTick(fn, arg1, arg2, arg3) { - if (typeof fn !== 'function') { - throw new TypeError('"callback" argument must be a function'); - } - var len = arguments.length; - var args, i; - switch (len) { - case 0: - case 1: - return process.nextTick(fn); - case 2: - return process.nextTick(function afterTickOne() { - fn.call(null, arg1); - }); - case 3: - return process.nextTick(function afterTickTwo() { - fn.call(null, arg1, arg2); - }); - case 4: - return process.nextTick(function afterTickThree() { - fn.call(null, arg1, arg2, arg3); - }); - default: - args = new Array(len - 1); - i = 0; - while (i < args.length) { - args[i++] = arguments[i]; - } - return process.nextTick(function afterTick() { - fn.apply(null, args); - }); - } -} - -}).call(this,require('_process')) -},{"_process":51}],51:[function(require,module,exports){ +},{}],60:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -13203,368 +13761,801 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],52:[function(require,module,exports){ -module.exports = require('./lib/_stream_duplex.js'); +},{}],61:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. -},{"./lib/_stream_duplex.js":53}],53:[function(require,module,exports){ -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototypal inheritance, this class -// prototypally inherits from Readable, and then parasitically from -// Writable. +module.exports = Stream; -'use strict'; +var EE = require('events').EventEmitter; +var inherits = require('inherits'); -/**/ +inherits(Stream, EE); +Stream.Readable = require('readable-stream/lib/_stream_readable.js'); +Stream.Writable = require('readable-stream/lib/_stream_writable.js'); +Stream.Duplex = require('readable-stream/lib/_stream_duplex.js'); +Stream.Transform = require('readable-stream/lib/_stream_transform.js'); +Stream.PassThrough = require('readable-stream/lib/_stream_passthrough.js'); +Stream.finished = require('readable-stream/lib/internal/streams/end-of-stream.js') +Stream.pipeline = require('readable-stream/lib/internal/streams/pipeline.js') -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - keys.push(key); - }return keys; -}; -/**/ +// Backwards-compat with node 0.4.x +Stream.Stream = Stream; -module.exports = Duplex; -/**/ -var processNextTick = require('process-nextick-args'); -/**/ -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ +// old-style streams. Note that the pipe method (the only relevant +// part of this class) is overridden in the Readable class. -var Readable = require('./_stream_readable'); -var Writable = require('./_stream_writable'); +function Stream() { + EE.call(this); +} -util.inherits(Duplex, Readable); +Stream.prototype.pipe = function(dest, options) { + var source = this; -var keys = objectKeys(Writable.prototype); -for (var v = 0; v < keys.length; v++) { - var method = keys[v]; - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; -} + function ondata(chunk) { + if (dest.writable) { + if (false === dest.write(chunk) && source.pause) { + source.pause(); + } + } + } -function Duplex(options) { - if (!(this instanceof Duplex)) return new Duplex(options); + source.on('data', ondata); - Readable.call(this, options); - Writable.call(this, options); + function ondrain() { + if (source.readable && source.resume) { + source.resume(); + } + } - if (options && options.readable === false) this.readable = false; + dest.on('drain', ondrain); - if (options && options.writable === false) this.writable = false; + // If the 'end' option is not supplied, dest.end() will be called when + // source gets the 'end' or 'close' events. Only dest.end() once. + if (!dest._isStdio && (!options || options.end !== false)) { + source.on('end', onend); + source.on('close', onclose); + } - this.allowHalfOpen = true; - if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; + var didOnEnd = false; + function onend() { + if (didOnEnd) return; + didOnEnd = true; - this.once('end', onend); -} + dest.end(); + } -// the no-half-open enforcer -function onend() { - // if we allow half-open state, or if the writable side ended, - // then we're ok. - if (this.allowHalfOpen || this._writableState.ended) return; - // no more data can be written. - // But allow more writes to happen in this tick. - processNextTick(onEndNT, this); -} + function onclose() { + if (didOnEnd) return; + didOnEnd = true; -function onEndNT(self) { - self.end(); -} + if (typeof dest.destroy === 'function') dest.destroy(); + } -function forEach(xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); + // don't leave dangling pipes when there are errors. + function onerror(er) { + cleanup(); + if (EE.listenerCount(this, 'error') === 0) { + throw er; // Unhandled stream error in pipe. + } } -} -},{"./_stream_readable":55,"./_stream_writable":57,"core-util-is":33,"inherits":36,"process-nextick-args":50}],54:[function(require,module,exports){ -// a passthrough stream. -// basically just the most minimal sort of Transform stream. -// Every written chunk gets output as-is. -'use strict'; + source.on('error', onerror); + dest.on('error', onerror); -module.exports = PassThrough; + // remove all the event listeners that were added. + function cleanup() { + source.removeListener('data', ondata); + dest.removeListener('drain', ondrain); -var Transform = require('./_stream_transform'); + source.removeListener('end', onend); + source.removeListener('close', onclose); -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ + source.removeListener('error', onerror); + dest.removeListener('error', onerror); -util.inherits(PassThrough, Transform); + source.removeListener('end', cleanup); + source.removeListener('close', cleanup); -function PassThrough(options) { - if (!(this instanceof PassThrough)) return new PassThrough(options); + dest.removeListener('close', cleanup); + } - Transform.call(this, options); -} + source.on('end', cleanup); + source.on('close', cleanup); -PassThrough.prototype._transform = function (chunk, encoding, cb) { - cb(null, chunk); + dest.on('close', cleanup); + + dest.emit('pipe', source); + + // Allow for unix-like usage: A.pipe(B).pipe(C) + return dest; }; -},{"./_stream_transform":56,"core-util-is":33,"inherits":36}],55:[function(require,module,exports){ -(function (process){ + +},{"events":38,"inherits":45,"readable-stream/lib/_stream_duplex.js":63,"readable-stream/lib/_stream_passthrough.js":64,"readable-stream/lib/_stream_readable.js":65,"readable-stream/lib/_stream_transform.js":66,"readable-stream/lib/_stream_writable.js":67,"readable-stream/lib/internal/streams/end-of-stream.js":71,"readable-stream/lib/internal/streams/pipeline.js":73}],62:[function(require,module,exports){ 'use strict'; -module.exports = Readable; +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } -/**/ -var processNextTick = require('process-nextick-args'); -/**/ +var codes = {}; -/**/ -var isArray = require('isarray'); -/**/ +function createErrorType(code, message, Base) { + if (!Base) { + Base = Error; + } -/**/ -var Duplex; -/**/ + function getMessage(arg1, arg2, arg3) { + if (typeof message === 'string') { + return message; + } else { + return message(arg1, arg2, arg3); + } + } -Readable.ReadableState = ReadableState; + var NodeError = + /*#__PURE__*/ + function (_Base) { + _inheritsLoose(NodeError, _Base); -/**/ -var EE = require('events').EventEmitter; + function NodeError(arg1, arg2, arg3) { + return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; + } -var EElistenerCount = function (emitter, type) { - return emitter.listeners(type).length; -}; -/**/ + return NodeError; + }(Base); -/**/ -var Stream = require('./internal/streams/stream'); -/**/ + NodeError.prototype.name = Base.name; + NodeError.prototype.code = code; + codes[code] = NodeError; +} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js -var Buffer = require('buffer').Buffer; -/**/ -var bufferShim = require('buffer-shims'); -/**/ -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ +function oneOf(expected, thing) { + if (Array.isArray(expected)) { + var len = expected.length; + expected = expected.map(function (i) { + return String(i); + }); -/**/ -var debugUtil = require('util'); -var debug = void 0; -if (debugUtil && debugUtil.debuglog) { - debug = debugUtil.debuglog('stream'); -} else { - debug = function () {}; -} -/**/ + if (len > 2) { + return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1]; + } else if (len === 2) { + return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); + } else { + return "of ".concat(thing, " ").concat(expected[0]); + } + } else { + return "of ".concat(thing, " ").concat(String(expected)); + } +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith -var BufferList = require('./internal/streams/BufferList'); -var StringDecoder; -util.inherits(Readable, Stream); +function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith -var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; -function prependListener(emitter, event, fn) { - // Sadly this is not cacheable as some libraries bundle their own - // event emitter implementation with them. - if (typeof emitter.prependListener === 'function') { - return emitter.prependListener(event, fn); +function endsWith(str, search, this_len) { + if (this_len === undefined || this_len > str.length) { + this_len = str.length; + } + + return str.substring(this_len - search.length, this_len) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes + + +function includes(str, search, start) { + if (typeof start !== 'number') { + start = 0; + } + + if (start + search.length > str.length) { + return false; } else { - // This is a hack to make sure that our error handler is attached before any - // userland ones. NEVER DO THIS. This is here only because this code needs - // to continue to work with older versions of Node.js that do not include - // the prependListener() method. The goal is to eventually remove this hack. - if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; + return str.indexOf(search, start) !== -1; } } -function ReadableState(options, stream) { - Duplex = Duplex || require('./_stream_duplex'); +createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { + return 'The value "' + value + '" is invalid for option "' + name + '"'; +}, TypeError); +createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { + // determiner: 'must be' or 'must not be' + var determiner; - options = options || {}; + if (typeof expected === 'string' && startsWith(expected, 'not ')) { + determiner = 'must not be'; + expected = expected.replace(/^not /, ''); + } else { + determiner = 'must be'; + } - // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - this.objectMode = !!options.objectMode; + var msg; - if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode; + if (endsWith(name, ' argument')) { + // For cases like 'first argument' + msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } else { + var type = includes(name, '.') ? 'property' : 'argument'; + msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } - // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - var hwm = options.highWaterMark; - var defaultHwm = this.objectMode ? 16 : 16 * 1024; - this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; + msg += ". Received type ".concat(typeof actual); + return msg; +}, TypeError); +createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); +createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { + return 'The ' + name + ' method is not implemented'; +}); +createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); +createErrorType('ERR_STREAM_DESTROYED', function (name) { + return 'Cannot call ' + name + ' after a stream was destroyed'; +}); +createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); +createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); +createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); +createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); +createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { + return 'Unknown encoding: ' + arg; +}, TypeError); +createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); +module.exports.codes = codes; + +},{}],63:[function(require,module,exports){ +(function (process){(function (){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. +'use strict'; +/**/ - // cast to ints. - this.highWaterMark = ~~this.highWaterMark; +var objectKeys = Object.keys || function (obj) { + var keys = []; - // A linked list is used to store data chunks instead of an array because the - // linked list can remove elements from the beginning faster than - // array.shift() - this.buffer = new BufferList(); - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; + for (var key in obj) { + keys.push(key); + } - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; + return keys; +}; +/**/ - // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - this.resumeScheduled = false; - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; +module.exports = Duplex; - // when piping, we only care about 'readable' events that happen - // after read()ing all the bytes and not getting any pushback. - this.ranOut = false; +var Readable = require('./_stream_readable'); - // the number of writers that are awaiting a drain event in .pipe()s - this.awaitDrain = 0; +var Writable = require('./_stream_writable'); - // if true, a maybeReadMore has been scheduled - this.readingMore = false; +require('inherits')(Duplex, Readable); - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; +{ + // Allow the keys array to be GC'ed. + var keys = objectKeys(Writable.prototype); + + for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; } } -function Readable(options) { - Duplex = Duplex || require('./_stream_duplex'); +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + Readable.call(this, options); + Writable.call(this, options); + this.allowHalfOpen = true; - if (!(this instanceof Readable)) return new Readable(options); + if (options) { + if (options.readable === false) this.readable = false; + if (options.writable === false) this.writable = false; - this._readableState = new ReadableState(options, this); + if (options.allowHalfOpen === false) { + this.allowHalfOpen = false; + this.once('end', onend); + } + } +} - // legacy - this.readable = true; +Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); +Object.defineProperty(Duplex.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +Object.defineProperty(Duplex.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); // the no-half-open enforcer - if (options && typeof options.read === 'function') this._read = options.read; +function onend() { + // If the writable side ended, then we're ok. + if (this._writableState.ended) return; // no more data can be written. + // But allow more writes to happen in this tick. - Stream.call(this); + process.nextTick(onEndNT, this); } -// Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. -Readable.prototype.push = function (chunk, encoding) { - var state = this._readableState; +function onEndNT(self) { + self.end(); +} - if (!state.objectMode && typeof chunk === 'string') { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = bufferShim.from(chunk, encoding); - encoding = ''; +Object.defineProperty(Duplex.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined || this._writableState === undefined) { + return false; } + + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (this._readableState === undefined || this._writableState === undefined) { + return; + } // backward compatibility, the user is explicitly + // managing destroyed + + + this._readableState.destroyed = value; + this._writableState.destroyed = value; } +}); +}).call(this)}).call(this,require('_process')) +},{"./_stream_readable":65,"./_stream_writable":67,"_process":60,"inherits":45}],64:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. +'use strict'; + +module.exports = PassThrough; + +var Transform = require('./_stream_transform'); + +require('inherits')(PassThrough, Transform); + +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options); + Transform.call(this, options); +} - return readableAddChunk(this, state, chunk, encoding, false); +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk); }; +},{"./_stream_transform":66,"inherits":45}],65:[function(require,module,exports){ +(function (process,global){(function (){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. +'use strict'; -// Unshift should *always* be something directly out of read() -Readable.prototype.unshift = function (chunk) { - var state = this._readableState; - return readableAddChunk(this, state, chunk, '', true); +module.exports = Readable; +/**/ + +var Duplex; +/**/ + +Readable.ReadableState = ReadableState; +/**/ + +var EE = require('events').EventEmitter; + +var EElistenerCount = function EElistenerCount(emitter, type) { + return emitter.listeners(type).length; }; +/**/ -Readable.prototype.isPaused = function () { - return this._readableState.flowing === false; +/**/ + + +var Stream = require('./internal/streams/stream'); +/**/ + + +var Buffer = require('buffer').Buffer; + +var OurUint8Array = global.Uint8Array || function () {}; + +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} + +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} +/**/ + + +var debugUtil = require('util'); + +var debug; + +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function debug() {}; +} +/**/ + + +var BufferList = require('./internal/streams/buffer_list'); + +var destroyImpl = require('./internal/streams/destroy'); + +var _require = require('./internal/streams/state'), + getHighWaterMark = _require.getHighWaterMark; + +var _require$codes = require('../errors').codes, + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance. + + +var StringDecoder; +var createReadableStreamAsyncIterator; +var from; + +require('inherits')(Readable, Stream); + +var errorOrDestroy = destroyImpl.errorOrDestroy; +var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; + +function prependListener(emitter, event, fn) { + // Sadly this is not cacheable as some libraries bundle their own + // event emitter implementation with them. + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; +} + +function ReadableState(options, stream, isDuplex) { + Duplex = Duplex || require('./_stream_duplex'); + options = options || {}; // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + + this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() + + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted + // immediately, or on a later tick. We set this to true at first, because + // any actions that shouldn't happen until "later" should generally also + // not happen before the first read call. + + this.sync = true; // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + this.paused = true; // Should close be emitted on destroy. Defaults to true. + + this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish') + + this.autoDestroy = !!options.autoDestroy; // has it been destroyed + + this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + + this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s + + this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled + + this.readingMore = false; + this.decoder = null; + this.encoding = null; + + if (options.encoding) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} + +function Readable(options) { + Duplex = Duplex || require('./_stream_duplex'); + if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside + // the ReadableState constructor, at least with V8 6.5 + + var isDuplex = this instanceof Duplex; + this._readableState = new ReadableState(options, this, isDuplex); // legacy + + this.readable = true; + + if (options) { + if (typeof options.read === 'function') this._read = options.read; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + } + + Stream.call(this); +} + +Object.defineProperty(Readable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined) { + return false; + } + + return this._readableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._readableState) { + return; + } // backward compatibility, the user is explicitly + // managing destroyed + + + this._readableState.destroyed = value; + } +}); +Readable.prototype.destroy = destroyImpl.destroy; +Readable.prototype._undestroy = destroyImpl.undestroy; + +Readable.prototype._destroy = function (err, cb) { + cb(err); +}; // Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. + + +Readable.prototype.push = function (chunk, encoding) { + var state = this._readableState; + var skipChunkCheck; + + if (!state.objectMode) { + if (typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + + if (encoding !== state.encoding) { + chunk = Buffer.from(chunk, encoding); + encoding = ''; + } + + skipChunkCheck = true; + } + } else { + skipChunkCheck = true; + } + + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); +}; // Unshift should *always* be something directly out of read() + + +Readable.prototype.unshift = function (chunk) { + return readableAddChunk(this, chunk, null, true, false); }; -function readableAddChunk(stream, state, chunk, encoding, addToFront) { - var er = chunkInvalid(state, chunk); - if (er) { - stream.emit('error', er); - } else if (chunk === null) { +function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + debug('readableAddChunk', chunk); + var state = stream._readableState; + + if (chunk === null) { state.reading = false; onEofChunk(stream, state); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (state.ended && !addToFront) { - var e = new Error('stream.push() after EOF'); - stream.emit('error', e); - } else if (state.endEmitted && addToFront) { - var _e = new Error('stream.unshift() after end event'); - stream.emit('error', _e); - } else { - var skipAdd; - if (state.decoder && !addToFront && !encoding) { - chunk = state.decoder.write(chunk); - skipAdd = !state.objectMode && chunk.length === 0; + } else { + var er; + if (!skipChunkCheck) er = chunkInvalid(state, chunk); + + if (er) { + errorOrDestroy(stream, er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { + chunk = _uint8ArrayToBuffer(chunk); } - if (!addToFront) state.reading = false; + if (addToFront) { + if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true); + } else if (state.ended) { + errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); + } else if (state.destroyed) { + return false; + } else { + state.reading = false; - // Don't add to the buffer if we've decoded to an empty string chunk and - // we're not in object mode - if (!skipAdd) { - // if we want the data now, just emit it. - if (state.flowing && state.length === 0 && !state.sync) { - stream.emit('data', chunk); - stream.read(0); + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); - - if (state.needReadable) emitReadable(stream); + addChunk(stream, state, chunk, false); } } - + } else if (!addToFront) { + state.reading = false; maybeReadMore(stream, state); } - } else if (!addToFront) { - state.reading = false; + } // We can push more data if we are below the highWaterMark. + // Also, if we have no data yet, we can stand some more bytes. + // This is to work around cases where hwm=0, such as the repl. + + + return !state.ended && (state.length < state.highWaterMark || state.length === 0); +} + +function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + state.awaitDrain = 0; + stream.emit('data', chunk); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + if (state.needReadable) emitReadable(stream); } - return needMoreData(state); + maybeReadMore(stream, state); } -// if it's past the high water mark, we can push in some more. -// Also, if we have no data yet, we can stand some -// more bytes. This is to work around cases where hwm=0, -// such as the repl. Also, if the push() triggered a -// readable event, and the user called read(largeNumber) such that -// needReadable was set, then we ought to push more, so that another -// 'readable' event will be triggered. -function needMoreData(state) { - return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); +function chunkInvalid(state, chunk) { + var er; + + if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk); + } + + return er; } -// backwards compatibility. +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; // backwards compatibility. + + Readable.prototype.setEncoding = function (enc) { if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this._readableState.decoder = new StringDecoder(enc); - this._readableState.encoding = enc; + var decoder = new StringDecoder(enc); + this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8 + + this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers: + + var p = this._readableState.buffer.head; + var content = ''; + + while (p !== null) { + content += decoder.write(p.data); + p = p.next; + } + + this._readableState.buffer.clear(); + + if (content !== '') this._readableState.buffer.push(content); + this._readableState.length = content.length; return this; -}; +}; // Don't raise the hwm > 1GB + + +var MAX_HWM = 0x40000000; -// Don't raise the hwm > 8MB -var MAX_HWM = 0x800000; function computeNewHighWaterMark(n) { if (n >= MAX_HWM) { + // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE. n = MAX_HWM; } else { // Get the next highest power of 2 to prevent increasing hwm excessively in @@ -13577,56 +14568,55 @@ function computeNewHighWaterMark(n) { n |= n >>> 16; n++; } - return n; -} -// This function is designed to be inlinable, so please take care when making + return n; +} // This function is designed to be inlinable, so please take care when making // changes to the function body. + + function howMuchToRead(n, state) { if (n <= 0 || state.length === 0 && state.ended) return 0; if (state.objectMode) return 1; + if (n !== n) { // Only flow one buffer at a time if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; - } - // If we're asking for more than the current hwm, then raise the hwm. + } // If we're asking for more than the current hwm, then raise the hwm. + + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); - if (n <= state.length) return n; - // Don't have enough + if (n <= state.length) return n; // Don't have enough + if (!state.ended) { state.needReadable = true; return 0; } + return state.length; -} +} // you can override either this method, or the async _read(n) below. + -// you can override either this method, or the async _read(n) below. Readable.prototype.read = function (n) { debug('read', n); n = parseInt(n, 10); var state = this._readableState; var nOrig = n; - - if (n !== 0) state.emittedReadable = false; - - // if we're doing read(0) to trigger a readable event, but we + if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we // already have a bunch of data in the buffer, then just trigger // the 'readable' event and move on. - if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { + + if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { debug('read: emitReadable', state.length, state.ended); if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); return null; } - n = howMuchToRead(n, state); + n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up. - // if we've ended, and we're now clear, then finish it up. if (n === 0 && state.ended) { if (state.length === 0) endReadable(this); return null; - } - - // All the actual chunk generation logic needs to be + } // All the actual chunk generation logic needs to be // *below* the call to _read. The reason is that in certain // synthetic stream cases, such as passthrough streams, _read // may be a completely synchronous operation which may change @@ -13647,33 +14637,34 @@ Readable.prototype.read = function (n) { // 'readable' etc. // // 3. Actually pull the requested chunks out of the buffer and return. - // if we need a readable event, then we need to do some reading. + + var doRead = state.needReadable; - debug('need readable', doRead); + debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some - // if we currently have less than the highWaterMark, then also read some if (state.length === 0 || state.length - n < state.highWaterMark) { doRead = true; debug('length less than watermark', doRead); - } - - // however, if we've ended, then there's no point, and if we're already + } // however, if we've ended, then there's no point, and if we're already // reading, then it's unnecessary. + + if (state.ended || state.reading) { doRead = false; debug('reading or ended', doRead); } else if (doRead) { debug('do read'); state.reading = true; - state.sync = true; - // if the length is currently zero, then we *need* a readable event. - if (state.length === 0) state.needReadable = true; - // call internal read method + state.sync = true; // if the length is currently zero, then we *need* a readable event. + + if (state.length === 0) state.needReadable = true; // call internal read method + this._read(state.highWaterMark); - state.sync = false; - // If _read pushed data synchronously, then `reading` will be false, + + state.sync = false; // If _read pushed data synchronously, then `reading` will be false, // and we need to re-evaluate how much data we can return to the user. + if (!state.reading) n = howMuchToRead(nOrig, state); } @@ -13681,99 +14672,144 @@ Readable.prototype.read = function (n) { if (n > 0) ret = fromList(n, state);else ret = null; if (ret === null) { - state.needReadable = true; + state.needReadable = state.length <= state.highWaterMark; n = 0; } else { state.length -= n; + state.awaitDrain = 0; } if (state.length === 0) { // If we have nothing in the buffer, then we want to know // as soon as we *do* get something into the buffer. - if (!state.ended) state.needReadable = true; + if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick. - // If we tried to read() past the EOF, then emit end on the next tick. if (nOrig !== n && state.ended) endReadable(this); } if (ret !== null) this.emit('data', ret); - return ret; }; -function chunkInvalid(state, chunk) { - var er = null; - if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) { - er = new TypeError('Invalid non-string/buffer chunk'); - } - return er; -} - function onEofChunk(stream, state) { + debug('onEofChunk'); if (state.ended) return; + if (state.decoder) { var chunk = state.decoder.end(); + if (chunk && chunk.length) { state.buffer.push(chunk); state.length += state.objectMode ? 1 : chunk.length; } } + state.ended = true; - // emit 'readable' now to make sure it gets picked up. - emitReadable(stream); -} + if (state.sync) { + // if we are sync, wait until next tick to emit the data. + // Otherwise we risk emitting data in the flow() + // the readable code triggers during a read() call + emitReadable(stream); + } else { + // emit 'readable' now to make sure it gets picked up. + state.needReadable = false; -// Don't emit readable right away in sync mode, because this can trigger + if (!state.emittedReadable) { + state.emittedReadable = true; + emitReadable_(stream); + } + } +} // Don't emit readable right away in sync mode, because this can trigger // another read() call => stack overflow. This way, it might trigger // a nextTick recursion warning, but that's not so bad. + + function emitReadable(stream) { var state = stream._readableState; + debug('emitReadable', state.needReadable, state.emittedReadable); state.needReadable = false; + if (!state.emittedReadable) { debug('emitReadable', state.flowing); state.emittedReadable = true; - if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream); + process.nextTick(emitReadable_, stream); } } function emitReadable_(stream) { - debug('emit readable'); - stream.emit('readable'); - flow(stream); -} + var state = stream._readableState; + debug('emitReadable_', state.destroyed, state.length, state.ended); + + if (!state.destroyed && (state.length || state.ended)) { + stream.emit('readable'); + state.emittedReadable = false; + } // The stream needs another readable event if + // 1. It is not flowing, as the flow mechanism will take + // care of it. + // 2. It is not ended. + // 3. It is below the highWaterMark, so we can schedule + // another readable later. -// at this point, the user has presumably seen the 'readable' event, + + state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; + flow(stream); +} // at this point, the user has presumably seen the 'readable' event, // and called read() to consume some data. that may have triggered // in turn another _read(n) call, in which case reading = true if // it's in progress. // However, if we're not ended, or reading, and the length < hwm, // then go ahead and try to read some more preemptively. + + function maybeReadMore(stream, state) { if (!state.readingMore) { state.readingMore = true; - processNextTick(maybeReadMore_, stream, state); + process.nextTick(maybeReadMore_, stream, state); } } function maybeReadMore_(stream, state) { - var len = state.length; - while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { + // Attempt to read more data if we should. + // + // The conditions for reading more data are (one of): + // - Not enough data buffered (state.length < state.highWaterMark). The loop + // is responsible for filling the buffer with enough data if such data + // is available. If highWaterMark is 0 and we are not in the flowing mode + // we should _not_ attempt to buffer any extra data. We'll get more data + // when the stream consumer calls read() instead. + // - No data in the buffer, and the stream is in flowing mode. In this mode + // the loop below is responsible for ensuring read() is called. Failing to + // call read here would abort the flow and there's no other mechanism for + // continuing the flow if the stream consumer has just subscribed to the + // 'data' event. + // + // In addition to the above conditions to keep reading data, the following + // conditions prevent the data from being read: + // - The stream has ended (state.ended). + // - There is already a pending 'read' operation (state.reading). This is a + // case where the the stream has called the implementation defined _read() + // method, but they are processing the call asynchronously and have _not_ + // called push() with new data. In this case we skip performing more + // read()s. The execution ends in this method again after the _read() ends + // up calling push() with more data. + while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { + var len = state.length; debug('maybeReadMore read 0'); stream.read(0); - if (len === state.length) - // didn't get any data, stop spinning. - break;else len = state.length; + if (len === state.length) // didn't get any data, stop spinning. + break; } - state.readingMore = false; -} -// abstract method. to be overridden in specific implementation classes. + state.readingMore = false; +} // abstract method. to be overridden in specific implementation classes. // call cb(er, data) where data is <= n in length. // for virtual (non-string, non-buffer) streams, "length" is somewhat // arbitrary, and perhaps not very meaningful. + + Readable.prototype._read = function (n) { - this.emit('error', new Error('_read() is not implemented')); + errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()')); }; Readable.prototype.pipe = function (dest, pipeOpts) { @@ -13784,122 +14820,123 @@ Readable.prototype.pipe = function (dest, pipeOpts) { case 0: state.pipes = dest; break; + case 1: state.pipes = [state.pipes, dest]; break; + default: state.pipes.push(dest); break; } + state.pipesCount += 1; debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); - var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; - - var endFn = doEnd ? onend : cleanup; - if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn); - + var endFn = doEnd ? onend : unpipe; + if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn); dest.on('unpipe', onunpipe); - function onunpipe(readable) { + + function onunpipe(readable, unpipeInfo) { debug('onunpipe'); + if (readable === src) { - cleanup(); + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } } } function onend() { debug('onend'); dest.end(); - } - - // when the dest drains, it reduces the awaitDrain counter + } // when the dest drains, it reduces the awaitDrain counter // on the source. This would be more elegant with a .once() // handler in flow(), but adding and removing repeatedly is // too slow. + + var ondrain = pipeOnDrain(src); dest.on('drain', ondrain); - var cleanedUp = false; + function cleanup() { - debug('cleanup'); - // cleanup event handlers once the pipe is broken + debug('cleanup'); // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); dest.removeListener('finish', onfinish); dest.removeListener('drain', ondrain); dest.removeListener('error', onerror); dest.removeListener('unpipe', onunpipe); src.removeListener('end', onend); - src.removeListener('end', cleanup); + src.removeListener('end', unpipe); src.removeListener('data', ondata); - - cleanedUp = true; - - // if the reader is waiting for a drain event from this + cleanedUp = true; // if the reader is waiting for a drain event from this // specific writer, then it would cause it to never start // flowing again. // So, if this is awaiting a drain, then we just call it now. // If we don't know, then assume that we are waiting for one. + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); } - // If the user pushes more data while we're writing to dest then we'll end up - // in ondata again. However, we only want to increase awaitDrain once because - // dest will only emit one 'drain' event for the multiple writes. - // => Introduce a guard on increasing awaitDrain. - var increasedAwaitDrain = false; src.on('data', ondata); + function ondata(chunk) { debug('ondata'); - increasedAwaitDrain = false; var ret = dest.write(chunk); - if (false === ret && !increasedAwaitDrain) { + debug('dest.write', ret); + + if (ret === false) { // If the user unpiped during `dest.write()`, it is possible // to get stuck in a permanently paused state if that write // also returned false. // => Check whether `dest` is still a piping destination. if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { - debug('false write response, pause', src._readableState.awaitDrain); - src._readableState.awaitDrain++; - increasedAwaitDrain = true; + debug('false write response, pause', state.awaitDrain); + state.awaitDrain++; } + src.pause(); } - } - - // if the dest has an error, then stop piping into it. + } // if the dest has an error, then stop piping into it. // however, don't suppress the throwing behavior for this. + + function onerror(er) { debug('onerror', er); unpipe(); dest.removeListener('error', onerror); - if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); - } + if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er); + } // Make sure our error handler is attached before userland ones. + - // Make sure our error handler is attached before userland ones. - prependListener(dest, 'error', onerror); + prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once. - // Both close and finish should trigger unpipe, but only once. function onclose() { dest.removeListener('finish', onfinish); unpipe(); } + dest.once('close', onclose); + function onfinish() { debug('onfinish'); dest.removeListener('close', onclose); unpipe(); } + dest.once('finish', onfinish); function unpipe() { debug('unpipe'); src.unpipe(dest); - } + } // tell the dest that it's being piped to - // tell the dest that it's being piped to - dest.emit('pipe', src); - // start the flow if it hasn't been started already. + dest.emit('pipe', src); // start the flow if it hasn't been started already. + if (!state.flowing) { debug('pipe resume'); src.resume(); @@ -13909,10 +14946,11 @@ Readable.prototype.pipe = function (dest, pipeOpts) { }; function pipeOnDrain(src) { - return function () { + return function pipeOnDrainFunctionResult() { var state = src._readableState; debug('pipeOnDrain', state.awaitDrain); if (state.awaitDrain) state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { state.flowing = true; flow(src); @@ -13922,26 +14960,24 @@ function pipeOnDrain(src) { Readable.prototype.unpipe = function (dest) { var state = this._readableState; + var unpipeInfo = { + hasUnpiped: false + }; // if we're not piping anywhere, then do nothing. - // if we're not piping anywhere, then do nothing. - if (state.pipesCount === 0) return this; + if (state.pipesCount === 0) return this; // just one destination. most common case. - // just one destination. most common case. if (state.pipesCount === 1) { // passed in one, but it's not the right one. if (dest && dest !== state.pipes) return this; + if (!dest) dest = state.pipes; // got a match. - if (!dest) dest = state.pipes; - - // got a match. state.pipes = null; state.pipesCount = 0; state.flowing = false; - if (dest) dest.emit('unpipe', this); + if (dest) dest.emit('unpipe', this, unpipeInfo); return this; - } + } // slow case. multiple pipe destinations. - // slow case. multiple pipe destinations. if (!dest) { // remove all. @@ -13952,80 +14988,139 @@ Readable.prototype.unpipe = function (dest) { state.flowing = false; for (var i = 0; i < len; i++) { - dests[i].emit('unpipe', this); - }return this; - } + dests[i].emit('unpipe', this, { + hasUnpiped: false + }); + } + + return this; + } // try to find the right one. + - // try to find the right one. var index = indexOf(state.pipes, dest); if (index === -1) return this; - state.pipes.splice(index, 1); state.pipesCount -= 1; if (state.pipesCount === 1) state.pipes = state.pipes[0]; - - dest.emit('unpipe', this); - + dest.emit('unpipe', this, unpipeInfo); return this; -}; - -// set up data events if they are asked for +}; // set up data events if they are asked for // Ensure readable listeners eventually get something + + Readable.prototype.on = function (ev, fn) { var res = Stream.prototype.on.call(this, ev, fn); + var state = this._readableState; if (ev === 'data') { - // Start flowing on next tick if stream isn't explicitly paused - if (this._readableState.flowing !== false) this.resume(); + // update readableListening so that resume() may be a no-op + // a few lines down. This is needed to support once('readable'). + state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused + + if (state.flowing !== false) this.resume(); } else if (ev === 'readable') { - var state = this._readableState; if (!state.endEmitted && !state.readableListening) { state.readableListening = state.needReadable = true; + state.flowing = false; state.emittedReadable = false; - if (!state.reading) { - processNextTick(nReadingNextTick, this); - } else if (state.length) { - emitReadable(this, state); + debug('on readable', state.length, state.reading); + + if (state.length) { + emitReadable(this); + } else if (!state.reading) { + process.nextTick(nReadingNextTick, this); } } } return res; }; + Readable.prototype.addListener = Readable.prototype.on; +Readable.prototype.removeListener = function (ev, fn) { + var res = Stream.prototype.removeListener.call(this, ev, fn); + + if (ev === 'readable') { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } + + return res; +}; + +Readable.prototype.removeAllListeners = function (ev) { + var res = Stream.prototype.removeAllListeners.apply(this, arguments); + + if (ev === 'readable' || ev === undefined) { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } + + return res; +}; + +function updateReadableListening(self) { + var state = self._readableState; + state.readableListening = self.listenerCount('readable') > 0; + + if (state.resumeScheduled && !state.paused) { + // flowing needs to be set to true now, otherwise + // the upcoming resume will not flow. + state.flowing = true; // crude way to check if we should resume + } else if (self.listenerCount('data') > 0) { + self.resume(); + } +} + function nReadingNextTick(self) { debug('readable nexttick read 0'); self.read(0); -} - -// pause() and resume() are remnants of the legacy readable stream API +} // pause() and resume() are remnants of the legacy readable stream API // If the user uses them, then switch into old mode. + + Readable.prototype.resume = function () { var state = this._readableState; + if (!state.flowing) { - debug('resume'); - state.flowing = true; + debug('resume'); // we flow only if there is no one listening + // for readable, but we still have to call + // resume() + + state.flowing = !state.readableListening; resume(this, state); } + + state.paused = false; return this; }; function resume(stream, state) { if (!state.resumeScheduled) { state.resumeScheduled = true; - processNextTick(resume_, stream, state); + process.nextTick(resume_, stream, state); } } function resume_(stream, state) { + debug('resume', state.reading); + if (!state.reading) { - debug('resume read 0'); stream.read(0); } state.resumeScheduled = false; - state.awaitDrain = 0; stream.emit('resume'); flow(stream); if (state.flowing && !state.reading) stream.read(0); @@ -14033,221 +15128,229 @@ function resume_(stream, state) { Readable.prototype.pause = function () { debug('call pause flowing=%j', this._readableState.flowing); - if (false !== this._readableState.flowing) { + + if (this._readableState.flowing !== false) { debug('pause'); this._readableState.flowing = false; this.emit('pause'); } + + this._readableState.paused = true; return this; }; function flow(stream) { var state = stream._readableState; debug('flow', state.flowing); - while (state.flowing && stream.read() !== null) {} -} -// wrap an old-style stream as the async data source. + while (state.flowing && stream.read() !== null) { + ; + } +} // wrap an old-style stream as the async data source. // This is *not* part of the readable stream interface. // It is an ugly unfortunate mess of history. + + Readable.prototype.wrap = function (stream) { + var _this = this; + var state = this._readableState; var paused = false; - - var self = this; stream.on('end', function () { debug('wrapped end'); + if (state.decoder && !state.ended) { var chunk = state.decoder.end(); - if (chunk && chunk.length) self.push(chunk); + if (chunk && chunk.length) _this.push(chunk); } - self.push(null); + _this.push(null); }); - stream.on('data', function (chunk) { debug('wrapped data'); - if (state.decoder) chunk = state.decoder.write(chunk); + if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode - // don't skip over falsy values in objectMode if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; - var ret = self.push(chunk); + var ret = _this.push(chunk); + if (!ret) { paused = true; stream.pause(); } - }); - - // proxy all the other methods. + }); // proxy all the other methods. // important when wrapping filters and duplexes. + for (var i in stream) { if (this[i] === undefined && typeof stream[i] === 'function') { - this[i] = function (method) { - return function () { + this[i] = function methodWrap(method) { + return function methodWrapReturnFunction() { return stream[method].apply(stream, arguments); }; }(i); } - } + } // proxy certain important events. - // proxy certain important events. - for (var n = 0; n < kProxyEvents.length; n++) { - stream.on(kProxyEvents[n], self.emit.bind(self, kProxyEvents[n])); - } - // when we try to consume some more bytes, simply unpause the + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } // when we try to consume some more bytes, simply unpause the // underlying stream. - self._read = function (n) { + + + this._read = function (n) { debug('wrapped _read', n); + if (paused) { paused = false; stream.resume(); } }; - return self; + return this; }; -// exposed for testing purposes only. -Readable._fromList = fromList; +if (typeof Symbol === 'function') { + Readable.prototype[Symbol.asyncIterator] = function () { + if (createReadableStreamAsyncIterator === undefined) { + createReadableStreamAsyncIterator = require('./internal/streams/async_iterator'); + } + + return createReadableStreamAsyncIterator(this); + }; +} + +Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.highWaterMark; + } +}); +Object.defineProperty(Readable.prototype, 'readableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState && this._readableState.buffer; + } +}); +Object.defineProperty(Readable.prototype, 'readableFlowing', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.flowing; + }, + set: function set(state) { + if (this._readableState) { + this._readableState.flowing = state; + } + } +}); // exposed for testing purposes only. -// Pluck off n bytes from an array of buffers. +Readable._fromList = fromList; +Object.defineProperty(Readable.prototype, 'readableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.length; + } +}); // Pluck off n bytes from an array of buffers. // Length is the combined lengths of all the buffers in the list. // This function is designed to be inlinable, so please take care when making // changes to the function body. + function fromList(n, state) { // nothing buffered if (state.length === 0) return null; - var ret; if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { // read it all, truncate the list - if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length); + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length); state.buffer.clear(); } else { // read part of list - ret = fromListPartial(n, state.buffer, state.decoder); - } - - return ret; -} - -// Extracts only enough buffered data to satisfy the amount requested. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function fromListPartial(n, list, hasStrings) { - var ret; - if (n < list.head.data.length) { - // slice is the same for buffers and strings - ret = list.head.data.slice(0, n); - list.head.data = list.head.data.slice(n); - } else if (n === list.head.data.length) { - // first chunk is a perfect match - ret = list.shift(); - } else { - // result spans more than one buffer - ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); - } - return ret; -} - -// Copies a specified amount of characters from the list of buffered data -// chunks. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function copyFromBufferString(n, list) { - var p = list.head; - var c = 1; - var ret = p.data; - n -= ret.length; - while (p = p.next) { - var str = p.data; - var nb = n > str.length ? str.length : n; - if (nb === str.length) ret += str;else ret += str.slice(0, n); - n -= nb; - if (n === 0) { - if (nb === str.length) { - ++c; - if (p.next) list.head = p.next;else list.head = list.tail = null; - } else { - list.head = p; - p.data = str.slice(nb); - } - break; - } - ++c; - } - list.length -= c; - return ret; -} - -// Copies a specified amount of bytes from the list of buffered data chunks. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function copyFromBuffer(n, list) { - var ret = bufferShim.allocUnsafe(n); - var p = list.head; - var c = 1; - p.data.copy(ret); - n -= p.data.length; - while (p = p.next) { - var buf = p.data; - var nb = n > buf.length ? buf.length : n; - buf.copy(ret, ret.length - n, 0, nb); - n -= nb; - if (n === 0) { - if (nb === buf.length) { - ++c; - if (p.next) list.head = p.next;else list.head = list.tail = null; - } else { - list.head = p; - p.data = buf.slice(nb); - } - break; - } - ++c; + ret = state.buffer.consume(n, state.decoder); } - list.length -= c; return ret; } function endReadable(stream) { var state = stream._readableState; - - // If we get here before consuming all the bytes, then that is a - // bug in node. Should never happen. - if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); + debug('endReadable', state.endEmitted); if (!state.endEmitted) { state.ended = true; - processNextTick(endReadableNT, state, stream); + process.nextTick(endReadableNT, state, stream); } } function endReadableNT(state, stream) { - // Check that we didn't get one last unshift. + debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { state.endEmitted = true; stream.readable = false; stream.emit('end'); + + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the writable side is ready for autoDestroy as well + var wState = stream._writableState; + + if (!wState || wState.autoDestroy && wState.finished) { + stream.destroy(); + } + } } } -function forEach(xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } +if (typeof Symbol === 'function') { + Readable.from = function (iterable, opts) { + if (from === undefined) { + from = require('./internal/streams/from'); + } + + return from(Readable, iterable, opts); + }; } function indexOf(xs, x) { for (var i = 0, l = xs.length; i < l; i++) { if (xs[i] === x) return i; } + return -1; } -}).call(this,require('_process')) -},{"./_stream_duplex":53,"./internal/streams/BufferList":58,"./internal/streams/stream":59,"_process":51,"buffer":32,"buffer-shims":31,"core-util-is":33,"events":34,"inherits":36,"isarray":38,"process-nextick-args":50,"string_decoder/":65,"util":28}],56:[function(require,module,exports){ +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../errors":62,"./_stream_duplex":63,"./internal/streams/async_iterator":68,"./internal/streams/buffer_list":69,"./internal/streams/destroy":70,"./internal/streams/from":72,"./internal/streams/state":74,"./internal/streams/stream":75,"_process":60,"buffer":33,"events":38,"inherits":45,"string_decoder/":76,"util":30}],66:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. // a transform stream is a readable/writable stream where you do // something with the data. Sometimes it's called a "filter", // but that's not a great name for it, since that implies a thing where @@ -14289,91 +15392,85 @@ function indexOf(xs, x) { // However, even in such a pathological case, only a single written chunk // would be consumed, and then the rest would wait (un-transformed) until // the results of the previous transformed chunk were consumed. - 'use strict'; module.exports = Transform; -var Duplex = require('./_stream_duplex'); - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ +var _require$codes = require('../errors').codes, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, + ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; -util.inherits(Transform, Duplex); - -function TransformState(stream) { - this.afterTransform = function (er, data) { - return afterTransform(stream, er, data); - }; +var Duplex = require('./_stream_duplex'); - this.needTransform = false; - this.transforming = false; - this.writecb = null; - this.writechunk = null; - this.writeencoding = null; -} +require('inherits')(Transform, Duplex); -function afterTransform(stream, er, data) { - var ts = stream._transformState; +function afterTransform(er, data) { + var ts = this._transformState; ts.transforming = false; - var cb = ts.writecb; - if (!cb) return stream.emit('error', new Error('no writecb in Transform class')); + if (cb === null) { + return this.emit('error', new ERR_MULTIPLE_CALLBACK()); + } ts.writechunk = null; ts.writecb = null; - - if (data !== null && data !== undefined) stream.push(data); - + if (data != null) // single equals check for both `null` and `undefined` + this.push(data); cb(er); - - var rs = stream._readableState; + var rs = this._readableState; rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { - stream._read(rs.highWaterMark); + this._read(rs.highWaterMark); } } function Transform(options) { if (!(this instanceof Transform)) return new Transform(options); - Duplex.call(this, options); - - this._transformState = new TransformState(this); - - var stream = this; - - // start out asking for a readable event once data is transformed. - this._readableState.needReadable = true; - - // we have implemented the _read method, and done the other things + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null + }; // start out asking for a readable event once data is transformed. + + this._readableState.needReadable = true; // we have implemented the _read method, and done the other things // that Readable wants before the first _read call, so unset the // sync guard flag. + this._readableState.sync = false; if (options) { if (typeof options.transform === 'function') this._transform = options.transform; - if (typeof options.flush === 'function') this._flush = options.flush; - } + } // When the writable side finishes, then flush out anything remaining. - // When the writable side finishes, then flush out anything remaining. - this.once('prefinish', function () { - if (typeof this._flush === 'function') this._flush(function (er, data) { - done(stream, er, data); - });else done(stream); - }); + + this.on('prefinish', prefinish); } -Transform.prototype.push = function (chunk, encoding) { +function prefinish() { + var _this = this; + + if (typeof this._flush === 'function' && !this._readableState.destroyed) { + this._flush(function (er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } +} + +Transform.prototype.push = function (chunk, encoding) { this._transformState.needTransform = false; return Duplex.prototype.push.call(this, chunk, encoding); -}; - -// This is the part where you do stuff! +}; // This is the part where you do stuff! // override this function in implementation classes. // 'chunk' is an input chunk. // @@ -14383,8 +15480,10 @@ Transform.prototype.push = function (chunk, encoding) { // Call `cb(err)` when you are done with this chunk. If you pass // an error, then that'll put the hurt on the whole operation. If you // never call cb(), then you'll never get another chunk. + + Transform.prototype._transform = function (chunk, encoding, cb) { - throw new Error('_transform() is not implemented'); + cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()')); }; Transform.prototype._write = function (chunk, encoding, cb) { @@ -14392,20 +15491,22 @@ Transform.prototype._write = function (chunk, encoding, cb) { ts.writecb = cb; ts.writechunk = chunk; ts.writeencoding = encoding; + if (!ts.transforming) { var rs = this._readableState; if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); } -}; - -// Doesn't matter what the args are here. +}; // Doesn't matter what the args are here. // _transform does all the work. // That we got here means that the readable side wants more data. + + Transform.prototype._read = function (n) { var ts = this._transformState; - if (ts.writechunk !== null && ts.writecb && !ts.transforming) { + if (ts.writechunk !== null && !ts.transforming) { ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); } else { // mark that we need a transform, so that any data that comes in @@ -14414,275 +15515,321 @@ Transform.prototype._read = function (n) { } }; +Transform.prototype._destroy = function (err, cb) { + Duplex.prototype._destroy.call(this, err, function (err2) { + cb(err2); + }); +}; + function done(stream, er, data) { if (er) return stream.emit('error', er); - - if (data !== null && data !== undefined) stream.push(data); - + if (data != null) // single equals check for both `null` and `undefined` + stream.push(data); // TODO(BridgeAR): Write a test for these two error cases // if there's nothing in the write buffer, then that means // that nothing more will ever be provided - var ws = stream._writableState; - var ts = stream._transformState; - - if (ws.length) throw new Error('Calling transform done when ws.length != 0'); - - if (ts.transforming) throw new Error('Calling transform done when still transforming'); + if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0(); + if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); return stream.push(null); } -},{"./_stream_duplex":53,"core-util-is":33,"inherits":36}],57:[function(require,module,exports){ -(function (process,setImmediate){ +},{"../errors":62,"./_stream_duplex":63,"inherits":45}],67:[function(require,module,exports){ +(function (process,global){(function (){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. // A bit simpler than readable streams. // Implement an async ._write(chunk, encoding, cb), and it'll handle all // the drain event emission and buffering. - 'use strict'; module.exports = Writable; +/* */ -/**/ -var processNextTick = require('process-nextick-args'); -/**/ +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} // It seems a linked list but it is not +// there will be only 2 of these for each stream -/**/ -var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick; -/**/ + +function CorkedRequest(state) { + var _this = this; + + this.next = null; + this.entry = null; + + this.finish = function () { + onCorkedFinish(_this, state); + }; +} +/* */ /**/ + + var Duplex; /**/ Writable.WritableState = WritableState; - /**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ -/**/ var internalUtil = { deprecate: require('util-deprecate') }; /**/ /**/ + var Stream = require('./internal/streams/stream'); /**/ + var Buffer = require('buffer').Buffer; -/**/ -var bufferShim = require('buffer-shims'); -/**/ -util.inherits(Writable, Stream); +var OurUint8Array = global.Uint8Array || function () {}; -function nop() {} +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} -function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; - this.next = null; +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; } -function WritableState(options, stream) { - Duplex = Duplex || require('./_stream_duplex'); +var destroyImpl = require('./internal/streams/destroy'); - options = options || {}; +var _require = require('./internal/streams/state'), + getHighWaterMark = _require.getHighWaterMark; - // object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!options.objectMode; +var _require$codes = require('../errors').codes, + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, + ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, + ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, + ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; + +var errorOrDestroy = destroyImpl.errorOrDestroy; + +require('inherits')(Writable, Stream); + +function nop() {} - if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode; +function WritableState(options, stream, isDuplex) { + Duplex = Duplex || require('./_stream_duplex'); + options = options || {}; // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream, + // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. + + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream + // contains buffers or objects. - // the point at which write() starts returning false + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false // Note: 0 is a valid value, means that we always return false if // the entire buffer is not flushed immediately on write() - var hwm = options.highWaterMark; - var defaultHwm = this.objectMode ? 16 : 16 * 1024; - this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; - - // cast to ints. - this.highWaterMark = ~~this.highWaterMark; - - // drain event flag. - this.needDrain = false; - // at the start of calling end() - this.ending = false; - // when end() has been called, and returned - this.ended = false; - // when 'finish' is emitted - this.finished = false; - // should we decode strings into buffers before passing to _write? + this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called + + this.finalCalled = false; // drain event flag. + + this.needDrain = false; // at the start of calling end() + + this.ending = false; // when end() has been called, and returned + + this.ended = false; // when 'finish' is emitted + + this.finished = false; // has it been destroyed + + this.destroyed = false; // should we decode strings into buffers before passing to _write? // this is here so that some node-core streams can optimize string // handling at a lower level. - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; - // Crypto is kind of old and crusty. Historically, its default string + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string // encoding is 'binary' so we have to make this configurable. // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - // not an actual buffer we keep track of, but a measurement + this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement // of how much we're waiting to get pushed to some underlying // socket or file. - this.length = 0; - // a flag to see when we're in the middle of a write. - this.writing = false; + this.length = 0; // a flag to see when we're in the middle of a write. - // when true all writes will be buffered until .uncork() call - this.corked = 0; + this.writing = false; // when true all writes will be buffered until .uncork() call - // a flag to be able to tell if the onwrite cb is called immediately, + this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately, // or on a later tick. We set this to true at first, because any // actions that shouldn't happen until "later" should generally also // not happen before the first write call. - this.sync = true; - // a flag to know if we're processing previously buffered items, which + this.sync = true; // a flag to know if we're processing previously buffered items, which // may call the _write() callback in the same tick, so that we don't // end up in an overlapped onwrite situation. - this.bufferProcessing = false; - // the callback that's passed to _write(chunk,cb) + this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb) + this.onwrite = function (er) { onwrite(stream, er); - }; + }; // the callback that the user supplies to write(chunk,encoding,cb) - // the callback that the user supplies to write(chunk,encoding,cb) - this.writecb = null; - // the amount that is being written when _write is called. - this.writelen = 0; + this.writecb = null; // the amount that is being written when _write is called. + this.writelen = 0; this.bufferedRequest = null; - this.lastBufferedRequest = null; - - // number of pending user-supplied write callbacks + this.lastBufferedRequest = null; // number of pending user-supplied write callbacks // this must be 0 before 'finish' can be emitted - this.pendingcb = 0; - // emit prefinish if the only thing we're waiting for is _write cbs + this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs // This is relevant for synchronous Transform streams - this.prefinished = false; - // True if the error was already emitted and should not be thrown again - this.errorEmitted = false; + this.prefinished = false; // True if the error was already emitted and should not be thrown again + + this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true. - // count buffered requests - this.bufferedRequestCount = 0; + this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end') - // allocate the first CorkedRequest, there is always + this.autoDestroy = !!options.autoDestroy; // count buffered requests + + this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always // one allocated and free to use, and we maintain at most two + this.corkedRequestsFree = new CorkedRequest(this); } WritableState.prototype.getBuffer = function getBuffer() { var current = this.bufferedRequest; var out = []; + while (current) { out.push(current); current = current.next; } + return out; }; (function () { try { Object.defineProperty(WritableState.prototype, 'buffer', { - get: internalUtil.deprecate(function () { + get: internalUtil.deprecate(function writableStateBufferGetter() { return this.getBuffer(); - }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.') + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') }); } catch (_) {} -})(); - -// Test _writableState for inheritance to account for Duplex streams, +})(); // Test _writableState for inheritance to account for Duplex streams, // whose prototype chain only points to Readable. + + var realHasInstance; + if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { realHasInstance = Function.prototype[Symbol.hasInstance]; Object.defineProperty(Writable, Symbol.hasInstance, { - value: function (object) { + value: function value(object) { if (realHasInstance.call(this, object)) return true; - + if (this !== Writable) return false; return object && object._writableState instanceof WritableState; } }); } else { - realHasInstance = function (object) { + realHasInstance = function realHasInstance(object) { return object instanceof this; }; } function Writable(options) { - Duplex = Duplex || require('./_stream_duplex'); - - // Writable ctor is applied to Duplexes, too. + Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too. // `realHasInstance` is necessary because using plain `instanceof` // would return false, as no `_writableState` property is attached. - // Trying to use the custom `instanceof` for Writable here will also break the // Node.js LazyTransform implementation, which has a non-trivial getter for // `_writableState` that would lead to infinite recursion. - if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) { - return new Writable(options); - } + // Checking for a Stream.Duplex instance is faster here instead of inside + // the WritableState constructor, at least with V8 6.5 - this._writableState = new WritableState(options, this); + var isDuplex = this instanceof Duplex; + if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); + this._writableState = new WritableState(options, this, isDuplex); // legacy. - // legacy. this.writable = true; if (options) { if (typeof options.write === 'function') this._write = options.write; - if (typeof options.writev === 'function') this._writev = options.writev; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + if (typeof options.final === 'function') this._final = options.final; } Stream.call(this); -} +} // Otherwise people can pipe Writable streams, which is just wrong. + -// Otherwise people can pipe Writable streams, which is just wrong. Writable.prototype.pipe = function () { - this.emit('error', new Error('Cannot pipe, not readable')); + errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); }; function writeAfterEnd(stream, cb) { - var er = new Error('write after end'); - // TODO: defer error events consistently everywhere, not just the cb - stream.emit('error', er); - processNextTick(cb, er); -} + var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb -// Checks that a user-supplied chunk is valid, especially for the particular + errorOrDestroy(stream, er); + process.nextTick(cb, er); +} // Checks that a user-supplied chunk is valid, especially for the particular // mode the stream is in. Currently this means that `null` is never accepted // and undefined/non-string values are only allowed in object mode. + + function validChunk(stream, state, chunk, cb) { - var valid = true; - var er = false; + var er; if (chunk === null) { - er = new TypeError('May not write null values to stream'); - } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { - er = new TypeError('Invalid non-string/buffer chunk'); + er = new ERR_STREAM_NULL_VALUES(); + } else if (typeof chunk !== 'string' && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk); } + if (er) { - stream.emit('error', er); - processNextTick(cb, er); - valid = false; + errorOrDestroy(stream, er); + process.nextTick(cb, er); + return false; } - return valid; + + return true; } Writable.prototype.write = function (chunk, encoding, cb) { var state = this._writableState; var ret = false; - var isBuf = Buffer.isBuffer(chunk); + + var isBuf = !state.objectMode && _isUint8Array(chunk); + + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); + } if (typeof encoding === 'function') { cb = encoding; @@ -14690,21 +15837,16 @@ Writable.prototype.write = function (chunk, encoding, cb) { } if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; - if (typeof cb !== 'function') cb = nop; - - if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { state.pendingcb++; ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); } - return ret; }; Writable.prototype.cork = function () { - var state = this._writableState; - - state.corked++; + this._writableState.corked++; }; Writable.prototype.uncork = function () { @@ -14712,50 +15854,81 @@ Writable.prototype.uncork = function () { if (state.corked) { state.corked--; - - if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); } }; Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { // node::ParseEncoding() requires lower case. if (typeof encoding === 'string') encoding = encoding.toLowerCase(); - if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding); this._writableState.defaultEncoding = encoding; return this; }; +Object.defineProperty(Writable.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); + function decodeChunk(state, chunk, encoding) { if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { - chunk = bufferShim.from(chunk, encoding); + chunk = Buffer.from(chunk, encoding); } + return chunk; } -// if we're already writing something, then just put this +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); // if we're already writing something, then just put this // in the queue, and wait our turn. Otherwise, call _write // If we return false, then we need a drain event, so set that flag. + function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { if (!isBuf) { - chunk = decodeChunk(state, chunk, encoding); - if (Buffer.isBuffer(chunk)) encoding = 'buffer'; + var newChunk = decodeChunk(state, chunk, encoding); + + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; + } } - var len = state.objectMode ? 1 : chunk.length; + var len = state.objectMode ? 1 : chunk.length; state.length += len; + var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false. - var ret = state.length < state.highWaterMark; - // we must ensure that previous needDrain will not be reset to false. if (!ret) state.needDrain = true; if (state.writing || state.corked) { var last = state.lastBufferedRequest; - state.lastBufferedRequest = new WriteReq(chunk, encoding, cb); + state.lastBufferedRequest = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; + if (last) { last.next = state.lastBufferedRequest; } else { state.bufferedRequest = state.lastBufferedRequest; } + state.bufferedRequestCount += 1; } else { doWrite(stream, state, false, len, chunk, encoding, cb); @@ -14769,16 +15942,32 @@ function doWrite(stream, state, writev, len, chunk, encoding, cb) { state.writecb = cb; state.writing = true; state.sync = true; - if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); state.sync = false; } function onwriteError(stream, state, sync, er, cb) { --state.pendingcb; - if (sync) processNextTick(cb, er);else cb(er); - stream._writableState.errorEmitted = true; - stream.emit('error', er); + if (sync) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + process.nextTick(cb, er); // this can emit finish, and it will always happen + // after error + + process.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); // this can emit finish, but finish must + // always follow error + + finishMaybe(stream, state); + } } function onwriteStateUpdate(state) { @@ -14792,21 +15981,18 @@ function onwrite(stream, er) { var state = stream._writableState; var sync = state.sync; var cb = state.writecb; - + if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); onwriteStateUpdate(state); - if (er) onwriteError(stream, state, sync, er, cb);else { // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(state); + var finished = needFinish(state) || stream.destroyed; if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { clearBuffer(stream, state); } if (sync) { - /**/ - asyncWrite(afterWrite, stream, state, finished, cb); - /**/ + process.nextTick(afterWrite, stream, state, finished, cb); } else { afterWrite(stream, state, finished, cb); } @@ -14818,19 +16004,19 @@ function afterWrite(stream, state, finished, cb) { state.pendingcb--; cb(); finishMaybe(stream, state); -} - -// Must force callback to be called on nextTick, so that we don't +} // Must force callback to be called on nextTick, so that we don't // emit 'drain' before the write() consumer gets the 'false' return // value, and has a chance to attach a 'drain' listener. + + function onwriteDrain(stream, state) { if (state.length === 0 && state.needDrain) { state.needDrain = false; stream.emit('drain'); } -} +} // if there's something in the buffer waiting, then process it + -// if there's something in the buffer waiting, then process it function clearBuffer(stream, state) { state.bufferProcessing = true; var entry = state.bufferedRequest; @@ -14841,26 +16027,31 @@ function clearBuffer(stream, state) { var buffer = new Array(l); var holder = state.corkedRequestsFree; holder.entry = entry; - var count = 0; + var allBuffers = true; + while (entry) { buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; entry = entry.next; count += 1; } - doWrite(stream, state, true, state.length, buffer, '', holder.finish); - - // doWrite is almost always async, defer these to save a bit of time + buffer.allBuffers = allBuffers; + doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time // as the hot path ends with doWrite + state.pendingcb++; state.lastBufferedRequest = null; + if (holder.next) { state.corkedRequestsFree = holder.next; holder.next = null; } else { state.corkedRequestsFree = new CorkedRequest(state); } + + state.bufferedRequestCount = 0; } else { // Slow case, write chunks one-by-one while (entry) { @@ -14868,13 +16059,13 @@ function clearBuffer(stream, state) { var encoding = entry.encoding; var cb = entry.callback; var len = state.objectMode ? 1 : chunk.length; - doWrite(stream, state, false, len, chunk, encoding, cb); entry = entry.next; - // if we didn't call the onwrite immediately, then + state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then // it means that we need to wait until it does. // also, that means that the chunk and cb are currently // being processed, so move the buffer counter past them. + if (state.writing) { break; } @@ -14883,13 +16074,12 @@ function clearBuffer(stream, state) { if (entry === null) state.lastBufferedRequest = null; } - state.bufferedRequestCount = 0; state.bufferedRequest = entry; state.bufferProcessing = false; } Writable.prototype._write = function (chunk, encoding, cb) { - cb(new Error('_write() is not implemented')); + cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); }; Writable.prototype._writev = null; @@ -14906,412 +16096,1053 @@ Writable.prototype.end = function (chunk, encoding, cb) { encoding = null; } - if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks - // .end() fully uncorks if (state.corked) { state.corked = 1; this.uncork(); - } + } // ignore unnecessary end() calls. + - // ignore unnecessary end() calls. - if (!state.ending && !state.finished) endWritable(this, state, cb); + if (!state.ending) endWritable(this, state, cb); + return this; }; +Object.defineProperty(Writable.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); + function needFinish(state) { return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; } -function prefinish(stream, state) { - if (!state.prefinished) { +function callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; + + if (err) { + errorOrDestroy(stream, err); + } + state.prefinished = true; stream.emit('prefinish'); + finishMaybe(stream, state); + }); +} + +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function' && !state.destroyed) { + state.pendingcb++; + state.finalCalled = true; + process.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit('prefinish'); + } } } function finishMaybe(stream, state) { var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { - prefinish(stream, state); state.finished = true; stream.emit('finish'); - } else { - prefinish(stream, state); + + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the readable side is ready for autoDestroy as well + var rState = stream._readableState; + + if (!rState || rState.autoDestroy && rState.endEmitted) { + stream.destroy(); + } + } } } + return need; } function endWritable(stream, state, cb) { state.ending = true; finishMaybe(stream, state); + if (cb) { - if (state.finished) processNextTick(cb);else stream.once('finish', cb); + if (state.finished) process.nextTick(cb);else stream.once('finish', cb); } + state.ended = true; stream.writable = false; } -// It seems a linked list but it is not -// there will be only 2 of these for each stream -function CorkedRequest(state) { - var _this = this; +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; - this.next = null; - this.entry = null; - this.finish = function (err) { - var entry = _this.entry; - _this.entry = null; - while (entry) { - var cb = entry.callback; - state.pendingcb--; - cb(err); - entry = entry.next; - } - if (state.corkedRequestsFree) { - state.corkedRequestsFree.next = _this; - } else { - state.corkedRequestsFree = _this; - } - }; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } // reuse the free corkReq. + + + state.corkedRequestsFree.next = corkReq; } -}).call(this,require('_process'),require("timers").setImmediate) -},{"./_stream_duplex":53,"./internal/streams/stream":59,"_process":51,"buffer":32,"buffer-shims":31,"core-util-is":33,"inherits":36,"process-nextick-args":50,"timers":66,"util-deprecate":67}],58:[function(require,module,exports){ -'use strict'; -var Buffer = require('buffer').Buffer; -/**/ -var bufferShim = require('buffer-shims'); -/**/ +Object.defineProperty(Writable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._writableState === undefined) { + return false; + } -module.exports = BufferList; + return this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; + } // backward compatibility, the user is explicitly + // managing destroyed -function BufferList() { - this.head = null; - this.tail = null; - this.length = 0; -} -BufferList.prototype.push = function (v) { - var entry = { data: v, next: null }; - if (this.length > 0) this.tail.next = entry;else this.head = entry; - this.tail = entry; - ++this.length; -}; + this._writableState.destroyed = value; + } +}); +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; -BufferList.prototype.unshift = function (v) { - var entry = { data: v, next: this.head }; - if (this.length === 0) this.tail = entry; - this.head = entry; - ++this.length; +Writable.prototype._destroy = function (err, cb) { + cb(err); }; +}).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../errors":62,"./_stream_duplex":63,"./internal/streams/destroy":70,"./internal/streams/state":74,"./internal/streams/stream":75,"_process":60,"buffer":33,"inherits":45,"util-deprecate":78}],68:[function(require,module,exports){ +(function (process){(function (){ +'use strict'; -BufferList.prototype.shift = function () { - if (this.length === 0) return; - var ret = this.head.data; - if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; - --this.length; - return ret; -}; +var _Object$setPrototypeO; -BufferList.prototype.clear = function () { - this.head = this.tail = null; - this.length = 0; -}; +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -BufferList.prototype.join = function (s) { - if (this.length === 0) return ''; - var p = this.head; - var ret = '' + p.data; - while (p = p.next) { - ret += s + p.data; - }return ret; -}; - -BufferList.prototype.concat = function (n) { - if (this.length === 0) return bufferShim.alloc(0); - if (this.length === 1) return this.head.data; - var ret = bufferShim.allocUnsafe(n >>> 0); - var p = this.head; - var i = 0; - while (p) { - p.data.copy(ret, i); - i += p.data.length; - p = p.next; +var finished = require('./end-of-stream'); + +var kLastResolve = Symbol('lastResolve'); +var kLastReject = Symbol('lastReject'); +var kError = Symbol('error'); +var kEnded = Symbol('ended'); +var kLastPromise = Symbol('lastPromise'); +var kHandlePromise = Symbol('handlePromise'); +var kStream = Symbol('stream'); + +function createIterResult(value, done) { + return { + value: value, + done: done + }; +} + +function readAndResolve(iter) { + var resolve = iter[kLastResolve]; + + if (resolve !== null) { + var data = iter[kStream].read(); // we defer if data is null + // we can be expecting either 'end' or + // 'error' + + if (data !== null) { + iter[kLastPromise] = null; + iter[kLastResolve] = null; + iter[kLastReject] = null; + resolve(createIterResult(data, false)); + } } - return ret; -}; -},{"buffer":32,"buffer-shims":31}],59:[function(require,module,exports){ -module.exports = require('events').EventEmitter; +} -},{"events":34}],60:[function(require,module,exports){ -module.exports = require('./readable').PassThrough +function onReadable(iter) { + // we wait for the next tick, because it might + // emit an error with process.nextTick + process.nextTick(readAndResolve, iter); +} -},{"./readable":61}],61:[function(require,module,exports){ -exports = module.exports = require('./lib/_stream_readable.js'); -exports.Stream = exports; -exports.Readable = exports; -exports.Writable = require('./lib/_stream_writable.js'); -exports.Duplex = require('./lib/_stream_duplex.js'); -exports.Transform = require('./lib/_stream_transform.js'); -exports.PassThrough = require('./lib/_stream_passthrough.js'); +function wrapForNext(lastPromise, iter) { + return function (resolve, reject) { + lastPromise.then(function () { + if (iter[kEnded]) { + resolve(createIterResult(undefined, true)); + return; + } -},{"./lib/_stream_duplex.js":53,"./lib/_stream_passthrough.js":54,"./lib/_stream_readable.js":55,"./lib/_stream_transform.js":56,"./lib/_stream_writable.js":57}],62:[function(require,module,exports){ -module.exports = require('./readable').Transform + iter[kHandlePromise](resolve, reject); + }, reject); + }; +} -},{"./readable":61}],63:[function(require,module,exports){ -module.exports = require('./lib/_stream_writable.js'); +var AsyncIteratorPrototype = Object.getPrototypeOf(function () {}); +var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { + get stream() { + return this[kStream]; + }, -},{"./lib/_stream_writable.js":57}],64:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. + next: function next() { + var _this = this; -module.exports = Stream; + // if we have detected an error in the meanwhile + // reject straight away + var error = this[kError]; -var EE = require('events').EventEmitter; -var inherits = require('inherits'); + if (error !== null) { + return Promise.reject(error); + } -inherits(Stream, EE); -Stream.Readable = require('readable-stream/readable.js'); -Stream.Writable = require('readable-stream/writable.js'); -Stream.Duplex = require('readable-stream/duplex.js'); -Stream.Transform = require('readable-stream/transform.js'); -Stream.PassThrough = require('readable-stream/passthrough.js'); + if (this[kEnded]) { + return Promise.resolve(createIterResult(undefined, true)); + } -// Backwards-compat with node 0.4.x -Stream.Stream = Stream; + if (this[kStream].destroyed) { + // We need to defer via nextTick because if .destroy(err) is + // called, the error will be emitted via nextTick, and + // we cannot guarantee that there is no error lingering around + // waiting to be emitted. + return new Promise(function (resolve, reject) { + process.nextTick(function () { + if (_this[kError]) { + reject(_this[kError]); + } else { + resolve(createIterResult(undefined, true)); + } + }); + }); + } // if we have multiple next() calls + // we will wait for the previous Promise to finish + // this logic is optimized to support for await loops, + // where next() is only called once at a time + var lastPromise = this[kLastPromise]; + var promise; -// old-style streams. Note that the pipe method (the only relevant -// part of this class) is overridden in the Readable class. + if (lastPromise) { + promise = new Promise(wrapForNext(lastPromise, this)); + } else { + // fast path needed to support multiple this.push() + // without triggering the next() queue + var data = this[kStream].read(); -function Stream() { - EE.call(this); -} + if (data !== null) { + return Promise.resolve(createIterResult(data, false)); + } -Stream.prototype.pipe = function(dest, options) { - var source = this; + promise = new Promise(this[kHandlePromise]); + } - function ondata(chunk) { - if (dest.writable) { - if (false === dest.write(chunk) && source.pause) { - source.pause(); + this[kLastPromise] = promise; + return promise; + } +}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () { + return this; +}), _defineProperty(_Object$setPrototypeO, "return", function _return() { + var _this2 = this; + + // destroy(err, cb) is a private API + // we can guarantee we have that here, because we control the + // Readable class this is attached to + return new Promise(function (resolve, reject) { + _this2[kStream].destroy(null, function (err) { + if (err) { + reject(err); + return; + } + + resolve(createIterResult(undefined, true)); + }); + }); +}), _Object$setPrototypeO), AsyncIteratorPrototype); + +var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { + var _Object$create; + + var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { + value: stream, + writable: true + }), _defineProperty(_Object$create, kLastResolve, { + value: null, + writable: true + }), _defineProperty(_Object$create, kLastReject, { + value: null, + writable: true + }), _defineProperty(_Object$create, kError, { + value: null, + writable: true + }), _defineProperty(_Object$create, kEnded, { + value: stream._readableState.endEmitted, + writable: true + }), _defineProperty(_Object$create, kHandlePromise, { + value: function value(resolve, reject) { + var data = iterator[kStream].read(); + + if (data) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(data, false)); + } else { + iterator[kLastResolve] = resolve; + iterator[kLastReject] = reject; + } + }, + writable: true + }), _Object$create)); + iterator[kLastPromise] = null; + finished(stream, function (err) { + if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { + var reject = iterator[kLastReject]; // reject if we are waiting for data in the Promise + // returned by next() and store the error + + if (reject !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + reject(err); } + + iterator[kError] = err; + return; } - } - source.on('data', ondata); + var resolve = iterator[kLastResolve]; - function ondrain() { - if (source.readable && source.resume) { - source.resume(); + if (resolve !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(undefined, true)); } - } - dest.on('drain', ondrain); + iterator[kEnded] = true; + }); + stream.on('readable', onReadable.bind(null, iterator)); + return iterator; +}; - // If the 'end' option is not supplied, dest.end() will be called when - // source gets the 'end' or 'close' events. Only dest.end() once. - if (!dest._isStdio && (!options || options.end !== false)) { - source.on('end', onend); - source.on('close', onclose); - } +module.exports = createReadableStreamAsyncIterator; +}).call(this)}).call(this,require('_process')) +},{"./end-of-stream":71,"_process":60}],69:[function(require,module,exports){ +'use strict'; - var didOnEnd = false; - function onend() { - if (didOnEnd) return; - didOnEnd = true; +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } - dest.end(); - } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - function onclose() { - if (didOnEnd) return; - didOnEnd = true; +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - if (typeof dest.destroy === 'function') dest.destroy(); +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +var _require = require('buffer'), + Buffer = _require.Buffer; + +var _require2 = require('util'), + inspect = _require2.inspect; + +var custom = inspect && inspect.custom || 'inspect'; + +function copyBuffer(src, target, offset) { + Buffer.prototype.copy.call(src, target, offset); +} + +module.exports = +/*#__PURE__*/ +function () { + function BufferList() { + _classCallCheck(this, BufferList); + + this.head = null; + this.tail = null; + this.length = 0; } - // don't leave dangling pipes when there are errors. - function onerror(er) { - cleanup(); - if (EE.listenerCount(this, 'error') === 0) { - throw er; // Unhandled stream error in pipe. + _createClass(BufferList, [{ + key: "push", + value: function push(v) { + var entry = { + data: v, + next: null + }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; + } + }, { + key: "unshift", + value: function unshift(v) { + var entry = { + data: v, + next: this.head + }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + } + }, { + key: "shift", + value: function shift() { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; + } + }, { + key: "clear", + value: function clear() { + this.head = this.tail = null; + this.length = 0; + } + }, { + key: "join", + value: function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + + while (p = p.next) { + ret += s + p.data; + } + + return ret; } - } + }, { + key: "concat", + value: function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + var ret = Buffer.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; - source.on('error', onerror); - dest.on('error', onerror); + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } - // remove all the event listeners that were added. - function cleanup() { - source.removeListener('data', ondata); - dest.removeListener('drain', ondrain); + return ret; + } // Consumes a specified amount of bytes or characters from the buffered data. + + }, { + key: "consume", + value: function consume(n, hasStrings) { + var ret; + + if (n < this.head.data.length) { + // `slice` is the same for buffers and strings. + ret = this.head.data.slice(0, n); + this.head.data = this.head.data.slice(n); + } else if (n === this.head.data.length) { + // First chunk is a perfect match. + ret = this.shift(); + } else { + // Result spans more than one buffer. + ret = hasStrings ? this._getString(n) : this._getBuffer(n); + } - source.removeListener('end', onend); - source.removeListener('close', onclose); + return ret; + } + }, { + key: "first", + value: function first() { + return this.head.data; + } // Consumes a specified amount of characters from the buffered data. + + }, { + key: "_getString", + value: function _getString(n) { + var p = this.head; + var c = 1; + var ret = p.data; + n -= ret.length; + + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) ret += str;else ret += str.slice(0, n); + n -= nb; + + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = str.slice(nb); + } - source.removeListener('error', onerror); - dest.removeListener('error', onerror); + break; + } - source.removeListener('end', cleanup); - source.removeListener('close', cleanup); + ++c; + } - dest.removeListener('close', cleanup); - } + this.length -= c; + return ret; + } // Consumes a specified amount of bytes from the buffered data. + + }, { + key: "_getBuffer", + value: function _getBuffer(n) { + var ret = Buffer.allocUnsafe(n); + var p = this.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret, ret.length - n, 0, nb); + n -= nb; + + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = buf.slice(nb); + } - source.on('end', cleanup); - source.on('close', cleanup); + break; + } - dest.on('close', cleanup); + ++c; + } - dest.emit('pipe', source); + this.length -= c; + return ret; + } // Make sure the linked list only shows the minimal necessary information. + + }, { + key: custom, + value: function value(_, options) { + return inspect(this, _objectSpread({}, options, { + // Only inspect one level. + depth: 0, + // It should not recurse. + customInspect: false + })); + } + }]); + + return BufferList; +}(); +},{"buffer":33,"util":30}],70:[function(require,module,exports){ +(function (process){(function (){ +'use strict'; // undocumented cb() API, needed for core, not for public API + +function destroy(err, cb) { + var _this = this; - // Allow for unix-like usage: A.pipe(B).pipe(C) - return dest; -}; + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; -},{"events":34,"inherits":36,"readable-stream/duplex.js":52,"readable-stream/passthrough.js":60,"readable-stream/readable.js":61,"readable-stream/transform.js":62,"readable-stream/writable.js":63}],65:[function(require,module,exports){ -'use strict'; + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + process.nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + process.nextTick(emitErrorNT, this, err); + } + } -var Buffer = require('buffer').Buffer; -var bufferShim = require('buffer-shims'); + return this; + } // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks -var isEncoding = Buffer.isEncoding || function (encoding) { - encoding = '' + encoding; - switch (encoding && encoding.toLowerCase()) { - case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': - return true; - default: - return false; + + if (this._readableState) { + this._readableState.destroyed = true; + } // if this is a duplex stream mark the writable part as destroyed as well + + + if (this._writableState) { + this._writableState.destroyed = true; } -}; -function _normalizeEncoding(enc) { - if (!enc) return 'utf8'; - var retried; - while (true) { - switch (enc) { - case 'utf8': - case 'utf-8': - return 'utf8'; - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return 'utf16le'; - case 'latin1': - case 'binary': - return 'latin1'; - case 'base64': - case 'ascii': - case 'hex': - return enc; - default: - if (retried) return; // undefined - enc = ('' + enc).toLowerCase(); - retried = true; + this._destroy(err || null, function (err) { + if (!cb && err) { + if (!_this._writableState) { + process.nextTick(emitErrorAndCloseNT, _this, err); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + process.nextTick(emitErrorAndCloseNT, _this, err); + } else { + process.nextTick(emitCloseNT, _this); + } + } else if (cb) { + process.nextTick(emitCloseNT, _this); + cb(err); + } else { + process.nextTick(emitCloseNT, _this); } - } -}; + }); -// Do not cache `Buffer.isEncoding` when checking encoding names as some -// modules monkey-patch it to support additional encodings -function normalizeEncoding(enc) { - var nenc = _normalizeEncoding(enc); - if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); - return nenc || enc; + return this; } -// StringDecoder provides an interface for efficiently splitting a series of -// buffers into a series of JS strings without breaking apart multi-byte -// characters. -exports.StringDecoder = StringDecoder; -function StringDecoder(encoding) { - this.encoding = normalizeEncoding(encoding); - var nb; - switch (this.encoding) { - case 'utf16le': - this.text = utf16Text; - this.end = utf16End; - nb = 4; - break; - case 'utf8': - this.fillLast = utf8FillLast; - nb = 4; - break; - case 'base64': - this.text = base64Text; - this.end = base64End; - nb = 3; - break; - default: - this.write = simpleWrite; - this.end = simpleEnd; - return; - } - this.lastNeed = 0; - this.lastTotal = 0; - this.lastChar = bufferShim.allocUnsafe(nb); +function emitErrorAndCloseNT(self, err) { + emitErrorNT(self, err); + emitCloseNT(self); } -StringDecoder.prototype.write = function (buf) { - if (buf.length === 0) return ''; - var r; - var i; - if (this.lastNeed) { - r = this.fillLast(buf); - if (r === undefined) return ''; - i = this.lastNeed; - this.lastNeed = 0; - } else { - i = 0; +function emitCloseNT(self) { + if (self._writableState && !self._writableState.emitClose) return; + if (self._readableState && !self._readableState.emitClose) return; + self.emit('close'); +} + +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; } - if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); - return r || ''; -}; -StringDecoder.prototype.end = utf8End; + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; + } +} -// Returns only complete characters in a Buffer -StringDecoder.prototype.text = utf8Text; +function emitErrorNT(self, err) { + self.emit('error', err); +} -// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer -StringDecoder.prototype.fillLast = function (buf) { - if (this.lastNeed <= buf.length) { - buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } +function errorOrDestroy(stream, err) { + // We have tests that rely on errors being emitted + // in the same tick, so changing this is semver major. + // For now when you opt-in to autoDestroy we allow + // the error to be emitted nextTick. In a future + // semver major update we should change the default to this. + var rState = stream._readableState; + var wState = stream._writableState; + if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); +} + +module.exports = { + destroy: destroy, + undestroy: undestroy, + errorOrDestroy: errorOrDestroy +}; +}).call(this)}).call(this,require('_process')) +},{"_process":60}],71:[function(require,module,exports){ +// Ported from https://github.com/mafintosh/end-of-stream with +// permission from the author, Mathias Buus (@mafintosh). +'use strict'; + +var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE; + +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + callback.apply(this, args); + }; +} + +function noop() {} + +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} + +function eos(stream, opts, callback) { + if (typeof opts === 'function') return eos(stream, null, opts); + if (!opts) opts = {}; + callback = once(callback || noop); + var readable = opts.readable || opts.readable !== false && stream.readable; + var writable = opts.writable || opts.writable !== false && stream.writable; + + var onlegacyfinish = function onlegacyfinish() { + if (!stream.writable) onfinish(); + }; + + var writableEnded = stream._writableState && stream._writableState.finished; + + var onfinish = function onfinish() { + writable = false; + writableEnded = true; + if (!readable) callback.call(stream); + }; + + var readableEnded = stream._readableState && stream._readableState.endEmitted; + + var onend = function onend() { + readable = false; + readableEnded = true; + if (!writable) callback.call(stream); + }; + + var onerror = function onerror(err) { + callback.call(stream, err); + }; + + var onclose = function onclose() { + var err; + + if (readable && !readableEnded) { + if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + + if (writable && !writableEnded) { + if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + }; + + var onrequest = function onrequest() { + stream.req.on('finish', onfinish); + }; + + if (isRequest(stream)) { + stream.on('complete', onfinish); + stream.on('abort', onclose); + if (stream.req) onrequest();else stream.on('request', onrequest); + } else if (writable && !stream._writableState) { + // legacy streams + stream.on('end', onlegacyfinish); + stream.on('close', onlegacyfinish); + } + + stream.on('end', onend); + stream.on('finish', onfinish); + if (opts.error !== false) stream.on('error', onerror); + stream.on('close', onclose); + return function () { + stream.removeListener('complete', onfinish); + stream.removeListener('abort', onclose); + stream.removeListener('request', onrequest); + if (stream.req) stream.req.removeListener('finish', onfinish); + stream.removeListener('end', onlegacyfinish); + stream.removeListener('close', onlegacyfinish); + stream.removeListener('finish', onfinish); + stream.removeListener('end', onend); + stream.removeListener('error', onerror); + stream.removeListener('close', onclose); + }; +} + +module.exports = eos; +},{"../../../errors":62}],72:[function(require,module,exports){ +module.exports = function () { + throw new Error('Readable.from is not available in the browser') +}; + +},{}],73:[function(require,module,exports){ +// Ported from https://github.com/mafintosh/pump with +// permission from the author, Mathias Buus (@mafintosh). +'use strict'; + +var eos; + +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + callback.apply(void 0, arguments); + }; +} + +var _require$codes = require('../../../errors').codes, + ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; + +function noop(err) { + // Rethrow the error if it exists to avoid swallowing it + if (err) throw err; +} + +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} + +function destroyer(stream, reading, writing, callback) { + callback = once(callback); + var closed = false; + stream.on('close', function () { + closed = true; + }); + if (eos === undefined) eos = require('./end-of-stream'); + eos(stream, { + readable: reading, + writable: writing + }, function (err) { + if (err) return callback(err); + closed = true; + callback(); + }); + var destroyed = false; + return function (err) { + if (closed) return; + if (destroyed) return; + destroyed = true; // request.destroy just do .end - .abort is what we want + + if (isRequest(stream)) return stream.abort(); + if (typeof stream.destroy === 'function') return stream.destroy(); + callback(err || new ERR_STREAM_DESTROYED('pipe')); + }; +} + +function call(fn) { + fn(); +} + +function pipe(from, to) { + return from.pipe(to); +} + +function popCallback(streams) { + if (!streams.length) return noop; + if (typeof streams[streams.length - 1] !== 'function') return noop; + return streams.pop(); +} + +function pipeline() { + for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { + streams[_key] = arguments[_key]; + } + + var callback = popCallback(streams); + if (Array.isArray(streams[0])) streams = streams[0]; + + if (streams.length < 2) { + throw new ERR_MISSING_ARGS('streams'); + } + + var error; + var destroys = streams.map(function (stream, i) { + var reading = i < streams.length - 1; + var writing = i > 0; + return destroyer(stream, reading, writing, function (err) { + if (!error) error = err; + if (err) destroys.forEach(call); + if (reading) return; + destroys.forEach(call); + callback(error); + }); + }); + return streams.reduce(pipe); +} + +module.exports = pipeline; +},{"../../../errors":62,"./end-of-stream":71}],74:[function(require,module,exports){ +'use strict'; + +var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE; + +function highWaterMarkFrom(options, isDuplex, duplexKey) { + return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; +} + +function getHighWaterMark(state, options, duplexKey, isDuplex) { + var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); + + if (hwm != null) { + if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { + var name = isDuplex ? duplexKey : 'highWaterMark'; + throw new ERR_INVALID_OPT_VALUE(name, hwm); + } + + return Math.floor(hwm); + } // Default value + + + return state.objectMode ? 16 : 16 * 1024; +} + +module.exports = { + getHighWaterMark: getHighWaterMark +}; +},{"../../../errors":62}],75:[function(require,module,exports){ +module.exports = require('events').EventEmitter; + +},{"events":38}],76:[function(require,module,exports){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +/**/ + +var Buffer = require('safe-buffer').Buffer; +/**/ + +var isEncoding = Buffer.isEncoding || function (encoding) { + encoding = '' + encoding; + switch (encoding && encoding.toLowerCase()) { + case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': + return true; + default: + return false; + } +}; + +function _normalizeEncoding(enc) { + if (!enc) return 'utf8'; + var retried; + while (true) { + switch (enc) { + case 'utf8': + case 'utf-8': + return 'utf8'; + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return 'utf16le'; + case 'latin1': + case 'binary': + return 'latin1'; + case 'base64': + case 'ascii': + case 'hex': + return enc; + default: + if (retried) return; // undefined + enc = ('' + enc).toLowerCase(); + retried = true; + } + } +}; + +// Do not cache `Buffer.isEncoding` when checking encoding names as some +// modules monkey-patch it to support additional encodings +function normalizeEncoding(enc) { + var nenc = _normalizeEncoding(enc); + if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); + return nenc || enc; +} + +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. +exports.StringDecoder = StringDecoder; +function StringDecoder(encoding) { + this.encoding = normalizeEncoding(encoding); + var nb; + switch (this.encoding) { + case 'utf16le': + this.text = utf16Text; + this.end = utf16End; + nb = 4; + break; + case 'utf8': + this.fillLast = utf8FillLast; + nb = 4; + break; + case 'base64': + this.text = base64Text; + this.end = base64End; + nb = 3; + break; + default: + this.write = simpleWrite; + this.end = simpleEnd; + return; + } + this.lastNeed = 0; + this.lastTotal = 0; + this.lastChar = Buffer.allocUnsafe(nb); +} + +StringDecoder.prototype.write = function (buf) { + if (buf.length === 0) return ''; + var r; + var i; + if (this.lastNeed) { + r = this.fillLast(buf); + if (r === undefined) return ''; + i = this.lastNeed; + this.lastNeed = 0; + } else { + i = 0; + } + if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); + return r || ''; +}; + +StringDecoder.prototype.end = utf8End; + +// Returns only complete characters in a Buffer +StringDecoder.prototype.text = utf8Text; + +// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer +StringDecoder.prototype.fillLast = function (buf) { + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); this.lastNeed -= buf.length; }; // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a -// continuation byte. +// continuation byte. If an invalid byte is detected, -2 is returned. function utf8CheckByte(byte) { if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; - return -1; + return byte >> 6 === 0x02 ? -1 : -2; } // Checks at most 3 bytes at the end of a Buffer in order to detect an @@ -15325,13 +17156,13 @@ function utf8CheckIncomplete(self, buf, i) { if (nb > 0) self.lastNeed = nb - 1; return nb; } - if (--j < i) return 0; + if (--j < i || nb === -2) return 0; nb = utf8CheckByte(buf[j]); if (nb >= 0) { if (nb > 0) self.lastNeed = nb - 2; return nb; } - if (--j < i) return 0; + if (--j < i || nb === -2) return 0; nb = utf8CheckByte(buf[j]); if (nb >= 0) { if (nb > 0) { @@ -15345,7 +17176,7 @@ function utf8CheckIncomplete(self, buf, i) { // Validates as many continuation bytes for a multi-byte UTF-8 character as // needed or are available. If we see a non-continuation byte where we expect // one, we "replace" the validated continuation bytes we've seen so far with -// UTF-8 replacement characters ('\ufffd'), to match v8's UTF-8 decoding +// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding // behavior. The continuation byte check is included three times in the case // where all of the continuation bytes for a character exist in the same buffer. // It is also done this way as a slight performance increase instead of using a @@ -15353,17 +17184,17 @@ function utf8CheckIncomplete(self, buf, i) { function utf8CheckExtraBytes(self, buf, p) { if ((buf[0] & 0xC0) !== 0x80) { self.lastNeed = 0; - return '\ufffd'.repeat(p); + return '\ufffd'; } if (self.lastNeed > 1 && buf.length > 1) { if ((buf[1] & 0xC0) !== 0x80) { self.lastNeed = 1; - return '\ufffd'.repeat(p + 1); + return '\ufffd'; } if (self.lastNeed > 2 && buf.length > 2) { if ((buf[2] & 0xC0) !== 0x80) { self.lastNeed = 2; - return '\ufffd'.repeat(p + 2); + return '\ufffd'; } } } @@ -15382,243 +17213,1342 @@ function utf8FillLast(buf) { this.lastNeed -= buf.length; } -// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a -// partial character, the character's bytes are buffered until the required -// number of bytes are available. -function utf8Text(buf, i) { - var total = utf8CheckIncomplete(this, buf, i); - if (!this.lastNeed) return buf.toString('utf8', i); - this.lastTotal = total; - var end = buf.length - (total - this.lastNeed); - buf.copy(this.lastChar, 0, end); - return buf.toString('utf8', i, end); +// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a +// partial character, the character's bytes are buffered until the required +// number of bytes are available. +function utf8Text(buf, i) { + var total = utf8CheckIncomplete(this, buf, i); + if (!this.lastNeed) return buf.toString('utf8', i); + this.lastTotal = total; + var end = buf.length - (total - this.lastNeed); + buf.copy(this.lastChar, 0, end); + return buf.toString('utf8', i, end); +} + +// For UTF-8, a replacement character is added when ending on a partial +// character. +function utf8End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + '\ufffd'; + return r; +} + +// UTF-16LE typically needs two bytes per character, but even if we have an even +// number of bytes available, we need to check if we end on a leading/high +// surrogate. In that case, we need to wait for the next two bytes in order to +// decode the last character properly. +function utf16Text(buf, i) { + if ((buf.length - i) % 2 === 0) { + var r = buf.toString('utf16le', i); + if (r) { + var c = r.charCodeAt(r.length - 1); + if (c >= 0xD800 && c <= 0xDBFF) { + this.lastNeed = 2; + this.lastTotal = 4; + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + return r.slice(0, -1); + } + } + return r; + } + this.lastNeed = 1; + this.lastTotal = 2; + this.lastChar[0] = buf[buf.length - 1]; + return buf.toString('utf16le', i, buf.length - 1); +} + +// For UTF-16LE we do not explicitly append special replacement characters if we +// end on a partial character, we simply let v8 handle that. +function utf16End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) { + var end = this.lastTotal - this.lastNeed; + return r + this.lastChar.toString('utf16le', 0, end); + } + return r; +} + +function base64Text(buf, i) { + var n = (buf.length - i) % 3; + if (n === 0) return buf.toString('base64', i); + this.lastNeed = 3 - n; + this.lastTotal = 3; + if (n === 1) { + this.lastChar[0] = buf[buf.length - 1]; + } else { + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + } + return buf.toString('base64', i, buf.length - n); +} + +function base64End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); + return r; +} + +// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) +function simpleWrite(buf) { + return buf.toString(this.encoding); +} + +function simpleEnd(buf) { + return buf && buf.length ? this.write(buf) : ''; +} +},{"safe-buffer":77}],77:[function(require,module,exports){ +/*! safe-buffer. MIT License. Feross Aboukhadijeh */ +/* eslint-disable node/no-deprecated-api */ +var buffer = require('buffer') +var Buffer = buffer.Buffer + +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } +} +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer +} + +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.prototype = Object.create(Buffer.prototype) + +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) + +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} + +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} + +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) +} + +},{"buffer":33}],78:[function(require,module,exports){ +(function (global){(function (){ + +/** + * Module exports. + */ + +module.exports = deprecate; + +/** + * Mark that a method should not be used. + * Returns a modified function which warns once by default. + * + * If `localStorage.noDeprecation = true` is set, then it is a no-op. + * + * If `localStorage.throwDeprecation = true` is set, then deprecated functions + * will throw an Error when invoked. + * + * If `localStorage.traceDeprecation = true` is set, then deprecated functions + * will invoke `console.trace()` instead of `console.error()`. + * + * @param {Function} fn - the function to deprecate + * @param {String} msg - the string to print to the console when `fn` is invoked + * @returns {Function} a new "deprecated" version of `fn` + * @api public + */ + +function deprecate (fn, msg) { + if (config('noDeprecation')) { + return fn; + } + + var warned = false; + function deprecated() { + if (!warned) { + if (config('throwDeprecation')) { + throw new Error(msg); + } else if (config('traceDeprecation')) { + console.trace(msg); + } else { + console.warn(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; +} + +/** + * Checks `localStorage` for boolean values for the given `name`. + * + * @param {String} name + * @returns {Boolean} + * @api private + */ + +function config (name) { + // accessing global.localStorage can trigger a DOMException in sandboxed iframes + try { + if (!global.localStorage) return false; + } catch (_) { + return false; + } + var val = global.localStorage[name]; + if (null == val) return false; + return String(val).toLowerCase() === 'true'; +} + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],79:[function(require,module,exports){ +arguments[4][25][0].apply(exports,arguments) +},{"dup":25}],80:[function(require,module,exports){ +// Currently in sync with Node.js lib/internal/util/types.js +// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9 + +'use strict'; + +var isArgumentsObject = require('is-arguments'); +var isGeneratorFunction = require('is-generator-function'); +var whichTypedArray = require('which-typed-array'); +var isTypedArray = require('is-typed-array'); + +function uncurryThis(f) { + return f.call.bind(f); +} + +var BigIntSupported = typeof BigInt !== 'undefined'; +var SymbolSupported = typeof Symbol !== 'undefined'; + +var ObjectToString = uncurryThis(Object.prototype.toString); + +var numberValue = uncurryThis(Number.prototype.valueOf); +var stringValue = uncurryThis(String.prototype.valueOf); +var booleanValue = uncurryThis(Boolean.prototype.valueOf); + +if (BigIntSupported) { + var bigIntValue = uncurryThis(BigInt.prototype.valueOf); +} + +if (SymbolSupported) { + var symbolValue = uncurryThis(Symbol.prototype.valueOf); +} + +function checkBoxedPrimitive(value, prototypeValueOf) { + if (typeof value !== 'object') { + return false; + } + try { + prototypeValueOf(value); + return true; + } catch(e) { + return false; + } +} + +exports.isArgumentsObject = isArgumentsObject; +exports.isGeneratorFunction = isGeneratorFunction; +exports.isTypedArray = isTypedArray; + +// Taken from here and modified for better browser support +// https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js +function isPromise(input) { + return ( + ( + typeof Promise !== 'undefined' && + input instanceof Promise + ) || + ( + input !== null && + typeof input === 'object' && + typeof input.then === 'function' && + typeof input.catch === 'function' + ) + ); +} +exports.isPromise = isPromise; + +function isArrayBufferView(value) { + if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) { + return ArrayBuffer.isView(value); + } + + return ( + isTypedArray(value) || + isDataView(value) + ); +} +exports.isArrayBufferView = isArrayBufferView; + + +function isUint8Array(value) { + return whichTypedArray(value) === 'Uint8Array'; +} +exports.isUint8Array = isUint8Array; + +function isUint8ClampedArray(value) { + return whichTypedArray(value) === 'Uint8ClampedArray'; +} +exports.isUint8ClampedArray = isUint8ClampedArray; + +function isUint16Array(value) { + return whichTypedArray(value) === 'Uint16Array'; +} +exports.isUint16Array = isUint16Array; + +function isUint32Array(value) { + return whichTypedArray(value) === 'Uint32Array'; +} +exports.isUint32Array = isUint32Array; + +function isInt8Array(value) { + return whichTypedArray(value) === 'Int8Array'; +} +exports.isInt8Array = isInt8Array; + +function isInt16Array(value) { + return whichTypedArray(value) === 'Int16Array'; +} +exports.isInt16Array = isInt16Array; + +function isInt32Array(value) { + return whichTypedArray(value) === 'Int32Array'; +} +exports.isInt32Array = isInt32Array; + +function isFloat32Array(value) { + return whichTypedArray(value) === 'Float32Array'; +} +exports.isFloat32Array = isFloat32Array; + +function isFloat64Array(value) { + return whichTypedArray(value) === 'Float64Array'; +} +exports.isFloat64Array = isFloat64Array; + +function isBigInt64Array(value) { + return whichTypedArray(value) === 'BigInt64Array'; +} +exports.isBigInt64Array = isBigInt64Array; + +function isBigUint64Array(value) { + return whichTypedArray(value) === 'BigUint64Array'; +} +exports.isBigUint64Array = isBigUint64Array; + +function isMapToString(value) { + return ObjectToString(value) === '[object Map]'; +} +isMapToString.working = ( + typeof Map !== 'undefined' && + isMapToString(new Map()) +); + +function isMap(value) { + if (typeof Map === 'undefined') { + return false; + } + + return isMapToString.working + ? isMapToString(value) + : value instanceof Map; +} +exports.isMap = isMap; + +function isSetToString(value) { + return ObjectToString(value) === '[object Set]'; +} +isSetToString.working = ( + typeof Set !== 'undefined' && + isSetToString(new Set()) +); +function isSet(value) { + if (typeof Set === 'undefined') { + return false; + } + + return isSetToString.working + ? isSetToString(value) + : value instanceof Set; +} +exports.isSet = isSet; + +function isWeakMapToString(value) { + return ObjectToString(value) === '[object WeakMap]'; +} +isWeakMapToString.working = ( + typeof WeakMap !== 'undefined' && + isWeakMapToString(new WeakMap()) +); +function isWeakMap(value) { + if (typeof WeakMap === 'undefined') { + return false; + } + + return isWeakMapToString.working + ? isWeakMapToString(value) + : value instanceof WeakMap; +} +exports.isWeakMap = isWeakMap; + +function isWeakSetToString(value) { + return ObjectToString(value) === '[object WeakSet]'; +} +isWeakSetToString.working = ( + typeof WeakSet !== 'undefined' && + isWeakSetToString(new WeakSet()) +); +function isWeakSet(value) { + return isWeakSetToString(value); +} +exports.isWeakSet = isWeakSet; + +function isArrayBufferToString(value) { + return ObjectToString(value) === '[object ArrayBuffer]'; +} +isArrayBufferToString.working = ( + typeof ArrayBuffer !== 'undefined' && + isArrayBufferToString(new ArrayBuffer()) +); +function isArrayBuffer(value) { + if (typeof ArrayBuffer === 'undefined') { + return false; + } + + return isArrayBufferToString.working + ? isArrayBufferToString(value) + : value instanceof ArrayBuffer; +} +exports.isArrayBuffer = isArrayBuffer; + +function isDataViewToString(value) { + return ObjectToString(value) === '[object DataView]'; +} +isDataViewToString.working = ( + typeof ArrayBuffer !== 'undefined' && + typeof DataView !== 'undefined' && + isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1)) +); +function isDataView(value) { + if (typeof DataView === 'undefined') { + return false; + } + + return isDataViewToString.working + ? isDataViewToString(value) + : value instanceof DataView; +} +exports.isDataView = isDataView; + +function isSharedArrayBufferToString(value) { + return ObjectToString(value) === '[object SharedArrayBuffer]'; +} +isSharedArrayBufferToString.working = ( + typeof SharedArrayBuffer !== 'undefined' && + isSharedArrayBufferToString(new SharedArrayBuffer()) +); +function isSharedArrayBuffer(value) { + if (typeof SharedArrayBuffer === 'undefined') { + return false; + } + + return isSharedArrayBufferToString.working + ? isSharedArrayBufferToString(value) + : value instanceof SharedArrayBuffer; +} +exports.isSharedArrayBuffer = isSharedArrayBuffer; + +function isAsyncFunction(value) { + return ObjectToString(value) === '[object AsyncFunction]'; +} +exports.isAsyncFunction = isAsyncFunction; + +function isMapIterator(value) { + return ObjectToString(value) === '[object Map Iterator]'; +} +exports.isMapIterator = isMapIterator; + +function isSetIterator(value) { + return ObjectToString(value) === '[object Set Iterator]'; +} +exports.isSetIterator = isSetIterator; + +function isGeneratorObject(value) { + return ObjectToString(value) === '[object Generator]'; +} +exports.isGeneratorObject = isGeneratorObject; + +function isWebAssemblyCompiledModule(value) { + return ObjectToString(value) === '[object WebAssembly.Module]'; +} +exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule; + +function isNumberObject(value) { + return checkBoxedPrimitive(value, numberValue); +} +exports.isNumberObject = isNumberObject; + +function isStringObject(value) { + return checkBoxedPrimitive(value, stringValue); +} +exports.isStringObject = isStringObject; + +function isBooleanObject(value) { + return checkBoxedPrimitive(value, booleanValue); +} +exports.isBooleanObject = isBooleanObject; + +function isBigIntObject(value) { + return BigIntSupported && checkBoxedPrimitive(value, bigIntValue); +} +exports.isBigIntObject = isBigIntObject; + +function isSymbolObject(value) { + return SymbolSupported && checkBoxedPrimitive(value, symbolValue); +} +exports.isSymbolObject = isSymbolObject; + +function isBoxedPrimitive(value) { + return ( + isNumberObject(value) || + isStringObject(value) || + isBooleanObject(value) || + isBigIntObject(value) || + isSymbolObject(value) + ); +} +exports.isBoxedPrimitive = isBoxedPrimitive; + +function isAnyArrayBuffer(value) { + return typeof Uint8Array !== 'undefined' && ( + isArrayBuffer(value) || + isSharedArrayBuffer(value) + ); +} +exports.isAnyArrayBuffer = isAnyArrayBuffer; + +['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) { + Object.defineProperty(exports, method, { + enumerable: false, + value: function() { + throw new Error(method + ' is not supported in userland'); + } + }); +}); + +},{"is-arguments":46,"is-generator-function":47,"is-typed-array":48,"which-typed-array":82}],81:[function(require,module,exports){ +(function (process){(function (){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || + function getOwnPropertyDescriptors(obj) { + var keys = Object.keys(obj); + var descriptors = {}; + for (var i = 0; i < keys.length; i++) { + descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]); + } + return descriptors; + }; + +var formatRegExp = /%[sdj%]/g; +exports.format = function(f) { + if (!isString(f)) { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(inspect(arguments[i])); + } + return objects.join(' '); + } + + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function(x) { + if (x === '%%') return '%'; + if (i >= len) return x; + switch (x) { + case '%s': return String(args[i++]); + case '%d': return Number(args[i++]); + case '%j': + try { + return JSON.stringify(args[i++]); + } catch (_) { + return '[Circular]'; + } + default: + return x; + } + }); + for (var x = args[i]; i < len; x = args[++i]) { + if (isNull(x) || !isObject(x)) { + str += ' ' + x; + } else { + str += ' ' + inspect(x); + } + } + return str; +}; + + +// Mark that a method should not be used. +// Returns a modified function which warns once by default. +// If --no-deprecation is set, then it is a no-op. +exports.deprecate = function(fn, msg) { + if (typeof process !== 'undefined' && process.noDeprecation === true) { + return fn; + } + + // Allow for deprecating things in the process of starting up. + if (typeof process === 'undefined') { + return function() { + return exports.deprecate(fn, msg).apply(this, arguments); + }; + } + + var warned = false; + function deprecated() { + if (!warned) { + if (process.throwDeprecation) { + throw new Error(msg); + } else if (process.traceDeprecation) { + console.trace(msg); + } else { + console.error(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; +}; + + +var debugs = {}; +var debugEnvRegex = /^$/; + +if (process.env.NODE_DEBUG) { + var debugEnv = process.env.NODE_DEBUG; + debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, '\\$&') + .replace(/\*/g, '.*') + .replace(/,/g, '$|^') + .toUpperCase(); + debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i'); +} +exports.debuglog = function(set) { + set = set.toUpperCase(); + if (!debugs[set]) { + if (debugEnvRegex.test(set)) { + var pid = process.pid; + debugs[set] = function() { + var msg = exports.format.apply(exports, arguments); + console.error('%s %d: %s', set, pid, msg); + }; + } else { + debugs[set] = function() {}; + } + } + return debugs[set]; +}; + + +/** + * Echos the value of a value. Trys to print the value out + * in the best way possible given the different types. + * + * @param {Object} obj The object to print out. + * @param {Object} opts Optional options object that alters the output. + */ +/* legacy: obj, showHidden, depth, colors*/ +function inspect(obj, opts) { + // default options + var ctx = { + seen: [], + stylize: stylizeNoColor + }; + // legacy... + if (arguments.length >= 3) ctx.depth = arguments[2]; + if (arguments.length >= 4) ctx.colors = arguments[3]; + if (isBoolean(opts)) { + // legacy... + ctx.showHidden = opts; + } else if (opts) { + // got an "options" object + exports._extend(ctx, opts); + } + // set default options + if (isUndefined(ctx.showHidden)) ctx.showHidden = false; + if (isUndefined(ctx.depth)) ctx.depth = 2; + if (isUndefined(ctx.colors)) ctx.colors = false; + if (isUndefined(ctx.customInspect)) ctx.customInspect = true; + if (ctx.colors) ctx.stylize = stylizeWithColor; + return formatValue(ctx, obj, ctx.depth); +} +exports.inspect = inspect; + + +// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics +inspect.colors = { + 'bold' : [1, 22], + 'italic' : [3, 23], + 'underline' : [4, 24], + 'inverse' : [7, 27], + 'white' : [37, 39], + 'grey' : [90, 39], + 'black' : [30, 39], + 'blue' : [34, 39], + 'cyan' : [36, 39], + 'green' : [32, 39], + 'magenta' : [35, 39], + 'red' : [31, 39], + 'yellow' : [33, 39] +}; + +// Don't use 'blue' not visible on cmd.exe +inspect.styles = { + 'special': 'cyan', + 'number': 'yellow', + 'boolean': 'yellow', + 'undefined': 'grey', + 'null': 'bold', + 'string': 'green', + 'date': 'magenta', + // "name": intentionally not styling + 'regexp': 'red' +}; + + +function stylizeWithColor(str, styleType) { + var style = inspect.styles[styleType]; + + if (style) { + return '\u001b[' + inspect.colors[style][0] + 'm' + str + + '\u001b[' + inspect.colors[style][1] + 'm'; + } else { + return str; + } +} + + +function stylizeNoColor(str, styleType) { + return str; +} + + +function arrayToHash(array) { + var hash = {}; + + array.forEach(function(val, idx) { + hash[val] = true; + }); + + return hash; +} + + +function formatValue(ctx, value, recurseTimes) { + // Provide a hook for user-specified inspect functions. + // Check that value is an object with an inspect function on it + if (ctx.customInspect && + value && + isFunction(value.inspect) && + // Filter out the util module, it's inspect function is special + value.inspect !== exports.inspect && + // Also filter out any prototype objects using the circular check. + !(value.constructor && value.constructor.prototype === value)) { + var ret = value.inspect(recurseTimes, ctx); + if (!isString(ret)) { + ret = formatValue(ctx, ret, recurseTimes); + } + return ret; + } + + // Primitive types cannot have properties + var primitive = formatPrimitive(ctx, value); + if (primitive) { + return primitive; + } + + // Look up the keys of the object. + var keys = Object.keys(value); + var visibleKeys = arrayToHash(keys); + + if (ctx.showHidden) { + keys = Object.getOwnPropertyNames(value); + } + + // IE doesn't make error fields non-enumerable + // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx + if (isError(value) + && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { + return formatError(value); + } + + // Some type of object without properties can be shortcutted. + if (keys.length === 0) { + if (isFunction(value)) { + var name = value.name ? ': ' + value.name : ''; + return ctx.stylize('[Function' + name + ']', 'special'); + } + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } + if (isDate(value)) { + return ctx.stylize(Date.prototype.toString.call(value), 'date'); + } + if (isError(value)) { + return formatError(value); + } + } + + var base = '', array = false, braces = ['{', '}']; + + // Make Array say that they are Array + if (isArray(value)) { + array = true; + braces = ['[', ']']; + } + + // Make functions say that they are functions + if (isFunction(value)) { + var n = value.name ? ': ' + value.name : ''; + base = ' [Function' + n + ']'; + } + + // Make RegExps say that they are RegExps + if (isRegExp(value)) { + base = ' ' + RegExp.prototype.toString.call(value); + } + + // Make dates with properties first say the date + if (isDate(value)) { + base = ' ' + Date.prototype.toUTCString.call(value); + } + + // Make error with message first say the error + if (isError(value)) { + base = ' ' + formatError(value); + } + + if (keys.length === 0 && (!array || value.length == 0)) { + return braces[0] + base + braces[1]; + } + + if (recurseTimes < 0) { + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } else { + return ctx.stylize('[Object]', 'special'); + } + } + + ctx.seen.push(value); + + var output; + if (array) { + output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); + } else { + output = keys.map(function(key) { + return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); + }); + } + + ctx.seen.pop(); + + return reduceToSingleString(output, base, braces); +} + + +function formatPrimitive(ctx, value) { + if (isUndefined(value)) + return ctx.stylize('undefined', 'undefined'); + if (isString(value)) { + var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + '\''; + return ctx.stylize(simple, 'string'); + } + if (isNumber(value)) + return ctx.stylize('' + value, 'number'); + if (isBoolean(value)) + return ctx.stylize('' + value, 'boolean'); + // For some reason typeof null is "object", so special case here. + if (isNull(value)) + return ctx.stylize('null', 'null'); +} + + +function formatError(value) { + return '[' + Error.prototype.toString.call(value) + ']'; +} + + +function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { + var output = []; + for (var i = 0, l = value.length; i < l; ++i) { + if (hasOwnProperty(value, String(i))) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + String(i), true)); + } else { + output.push(''); + } + } + keys.forEach(function(key) { + if (!key.match(/^\d+$/)) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + key, true)); + } + }); + return output; +} + + +function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { + var name, str, desc; + desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; + if (desc.get) { + if (desc.set) { + str = ctx.stylize('[Getter/Setter]', 'special'); + } else { + str = ctx.stylize('[Getter]', 'special'); + } + } else { + if (desc.set) { + str = ctx.stylize('[Setter]', 'special'); + } + } + if (!hasOwnProperty(visibleKeys, key)) { + name = '[' + key + ']'; + } + if (!str) { + if (ctx.seen.indexOf(desc.value) < 0) { + if (isNull(recurseTimes)) { + str = formatValue(ctx, desc.value, null); + } else { + str = formatValue(ctx, desc.value, recurseTimes - 1); + } + if (str.indexOf('\n') > -1) { + if (array) { + str = str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n').substr(2); + } else { + str = '\n' + str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n'); + } + } + } else { + str = ctx.stylize('[Circular]', 'special'); + } + } + if (isUndefined(name)) { + if (array && key.match(/^\d+$/)) { + return str; + } + name = JSON.stringify('' + key); + if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { + name = name.substr(1, name.length - 2); + name = ctx.stylize(name, 'name'); + } else { + name = name.replace(/'/g, "\\'") + .replace(/\\"/g, '"') + .replace(/(^"|"$)/g, "'"); + name = ctx.stylize(name, 'string'); + } + } + + return name + ': ' + str; +} + + +function reduceToSingleString(output, base, braces) { + var numLinesEst = 0; + var length = output.reduce(function(prev, cur) { + numLinesEst++; + if (cur.indexOf('\n') >= 0) numLinesEst++; + return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; + }, 0); + + if (length > 60) { + return braces[0] + + (base === '' ? '' : base + '\n ') + + ' ' + + output.join(',\n ') + + ' ' + + braces[1]; + } + + return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; +} + + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. +exports.types = require('./support/types'); + +function isArray(ar) { + return Array.isArray(ar); +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; } +exports.isNull = isNull; -// For UTF-8, a replacement character for each buffered byte of a (partial) -// character needs to be added to the output. -function utf8End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + '\ufffd'.repeat(this.lastTotal - this.lastNeed); - return r; +function isNullOrUndefined(arg) { + return arg == null; } +exports.isNullOrUndefined = isNullOrUndefined; -// UTF-16LE typically needs two bytes per character, but even if we have an even -// number of bytes available, we need to check if we end on a leading/high -// surrogate. In that case, we need to wait for the next two bytes in order to -// decode the last character properly. -function utf16Text(buf, i) { - if ((buf.length - i) % 2 === 0) { - var r = buf.toString('utf16le', i); - if (r) { - var c = r.charCodeAt(r.length - 1); - if (c >= 0xD800 && c <= 0xDBFF) { - this.lastNeed = 2; - this.lastTotal = 4; - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - return r.slice(0, -1); - } - } - return r; - } - this.lastNeed = 1; - this.lastTotal = 2; - this.lastChar[0] = buf[buf.length - 1]; - return buf.toString('utf16le', i, buf.length - 1); +function isNumber(arg) { + return typeof arg === 'number'; } +exports.isNumber = isNumber; -// For UTF-16LE we do not explicitly append special replacement characters if we -// end on a partial character, we simply let v8 handle that. -function utf16End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) { - var end = this.lastTotal - this.lastNeed; - return r + this.lastChar.toString('utf16le', 0, end); - } - return r; +function isString(arg) { + return typeof arg === 'string'; } +exports.isString = isString; -function base64Text(buf, i) { - var n = (buf.length - i) % 3; - if (n === 0) return buf.toString('base64', i); - this.lastNeed = 3 - n; - this.lastTotal = 3; - if (n === 1) { - this.lastChar[0] = buf[buf.length - 1]; - } else { - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - } - return buf.toString('base64', i, buf.length - n); +function isSymbol(arg) { + return typeof arg === 'symbol'; } +exports.isSymbol = isSymbol; -function base64End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); - return r; +function isUndefined(arg) { + return arg === void 0; } +exports.isUndefined = isUndefined; -// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) -function simpleWrite(buf) { - return buf.toString(this.encoding); +function isRegExp(re) { + return isObject(re) && objectToString(re) === '[object RegExp]'; } +exports.isRegExp = isRegExp; +exports.types.isRegExp = isRegExp; -function simpleEnd(buf) { - return buf && buf.length ? this.write(buf) : ''; +function isObject(arg) { + return typeof arg === 'object' && arg !== null; } -},{"buffer":32,"buffer-shims":31}],66:[function(require,module,exports){ -(function (setImmediate,clearImmediate){ -var nextTick = require('process/browser.js').nextTick; -var apply = Function.prototype.apply; -var slice = Array.prototype.slice; -var immediateIds = {}; -var nextImmediateId = 0; +exports.isObject = isObject; + +function isDate(d) { + return isObject(d) && objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; +exports.types.isDate = isDate; -// DOM APIs, for completeness +function isError(e) { + return isObject(e) && + (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; +exports.types.isNativeError = isError; -exports.setTimeout = function() { - return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); -}; -exports.setInterval = function() { - return new Timeout(apply.call(setInterval, window, arguments), clearInterval); -}; -exports.clearTimeout = -exports.clearInterval = function(timeout) { timeout.close(); }; +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; -function Timeout(id, clearFn) { - this._id = id; - this._clearFn = clearFn; +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; } -Timeout.prototype.unref = Timeout.prototype.ref = function() {}; -Timeout.prototype.close = function() { - this._clearFn.call(window, this._id); -}; +exports.isPrimitive = isPrimitive; -// Does not start the time, just sets up the members needed. -exports.enroll = function(item, msecs) { - clearTimeout(item._idleTimeoutId); - item._idleTimeout = msecs; -}; +exports.isBuffer = require('./support/isBuffer'); -exports.unenroll = function(item) { - clearTimeout(item._idleTimeoutId); - item._idleTimeout = -1; -}; +function objectToString(o) { + return Object.prototype.toString.call(o); +} -exports._unrefActive = exports.active = function(item) { - clearTimeout(item._idleTimeoutId); - var msecs = item._idleTimeout; - if (msecs >= 0) { - item._idleTimeoutId = setTimeout(function onTimeout() { - if (item._onTimeout) - item._onTimeout(); - }, msecs); - } -}; +function pad(n) { + return n < 10 ? '0' + n.toString(10) : n.toString(10); +} -// That's not how node.js implements it but the exposed api is the same. -exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) { - var id = nextImmediateId++; - var args = arguments.length < 2 ? false : slice.call(arguments, 1); - immediateIds[id] = true; +var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', + 'Oct', 'Nov', 'Dec']; - nextTick(function onNextTick() { - if (immediateIds[id]) { - // fn.call() is faster so we optimize for the common use-case - // @see http://jsperf.com/call-apply-segu - if (args) { - fn.apply(null, args); - } else { - fn.call(null); - } - // Prevent ids from leaking - exports.clearImmediate(id); - } - }); +// 26 Feb 16:19:34 +function timestamp() { + var d = new Date(); + var time = [pad(d.getHours()), + pad(d.getMinutes()), + pad(d.getSeconds())].join(':'); + return [d.getDate(), months[d.getMonth()], time].join(' '); +} - return id; -}; -exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { - delete immediateIds[id]; +// log is just a thin wrapper to console.log that prepends a timestamp +exports.log = function() { + console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); }; -}).call(this,require("timers").setImmediate,require("timers").clearImmediate) -},{"process/browser.js":51,"timers":66}],67:[function(require,module,exports){ -(function (global){ - -/** - * Module exports. - */ -module.exports = deprecate; /** - * Mark that a method should not be used. - * Returns a modified function which warns once by default. - * - * If `localStorage.noDeprecation = true` is set, then it is a no-op. - * - * If `localStorage.throwDeprecation = true` is set, then deprecated functions - * will throw an Error when invoked. + * Inherit the prototype methods from one constructor into another. * - * If `localStorage.traceDeprecation = true` is set, then deprecated functions - * will invoke `console.trace()` instead of `console.error()`. + * The Function.prototype.inherits from lang.js rewritten as a standalone + * function (not on Function.prototype). NOTE: If this file is to be loaded + * during bootstrapping this function needs to be rewritten using some native + * functions as prototype setup using normal JavaScript does not work as + * expected during bootstrapping (see mirror.js in r114903). * - * @param {Function} fn - the function to deprecate - * @param {String} msg - the string to print to the console when `fn` is invoked - * @returns {Function} a new "deprecated" version of `fn` - * @api public + * @param {function} ctor Constructor function which needs to inherit the + * prototype. + * @param {function} superCtor Constructor function to inherit prototype from. */ +exports.inherits = require('inherits'); -function deprecate (fn, msg) { - if (config('noDeprecation')) { +exports._extend = function(origin, add) { + // Don't do anything if add isn't an object + if (!add || !isObject(add)) return origin; + + var keys = Object.keys(add); + var i = keys.length; + while (i--) { + origin[keys[i]] = add[keys[i]]; + } + return origin; +}; + +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined; + +exports.promisify = function promisify(original) { + if (typeof original !== 'function') + throw new TypeError('The "original" argument must be of type Function'); + + if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) { + var fn = original[kCustomPromisifiedSymbol]; + if (typeof fn !== 'function') { + throw new TypeError('The "util.promisify.custom" argument must be of type Function'); + } + Object.defineProperty(fn, kCustomPromisifiedSymbol, { + value: fn, enumerable: false, writable: false, configurable: true + }); return fn; } - var warned = false; - function deprecated() { - if (!warned) { - if (config('throwDeprecation')) { - throw new Error(msg); - } else if (config('traceDeprecation')) { - console.trace(msg); + function fn() { + var promiseResolve, promiseReject; + var promise = new Promise(function (resolve, reject) { + promiseResolve = resolve; + promiseReject = reject; + }); + + var args = []; + for (var i = 0; i < arguments.length; i++) { + args.push(arguments[i]); + } + args.push(function (err, value) { + if (err) { + promiseReject(err); } else { - console.warn(msg); + promiseResolve(value); } - warned = true; + }); + + try { + original.apply(this, args); + } catch (err) { + promiseReject(err); } - return fn.apply(this, arguments); + + return promise; } - return deprecated; + Object.setPrototypeOf(fn, Object.getPrototypeOf(original)); + + if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, { + value: fn, enumerable: false, writable: false, configurable: true + }); + return Object.defineProperties( + fn, + getOwnPropertyDescriptors(original) + ); } -/** - * Checks `localStorage` for boolean values for the given `name`. - * - * @param {String} name - * @returns {Boolean} - * @api private - */ +exports.promisify.custom = kCustomPromisifiedSymbol -function config (name) { - // accessing global.localStorage can trigger a DOMException in sandboxed iframes - try { - if (!global.localStorage) return false; - } catch (_) { - return false; +function callbackifyOnRejected(reason, cb) { + // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M). + // Because `null` is a special error value in callbacks which means "no error + // occurred", we error-wrap so the callback consumer can distinguish between + // "the promise rejected with null" or "the promise fulfilled with undefined". + if (!reason) { + var newReason = new Error('Promise was rejected with a falsy value'); + newReason.reason = reason; + reason = newReason; } - var val = global.localStorage[name]; - if (null == val) return false; - return String(val).toLowerCase() === 'true'; + return cb(reason); } -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],68:[function(require,module,exports){ -arguments[4][25][0].apply(exports,arguments) -},{"dup":25}],69:[function(require,module,exports){ -arguments[4][26][0].apply(exports,arguments) -},{"./support/isBuffer":68,"_process":51,"dup":26,"inherits":36}]},{},[20])(20) -}); +function callbackify(original) { + if (typeof original !== 'function') { + throw new TypeError('The "original" argument must be of type Function'); + } + + // We DO NOT return the promise as it gives the user a false sense that + // the promise is actually somehow related to the callback's execution + // and that the callback throwing will reject the promise. + function callbackified() { + var args = []; + for (var i = 0; i < arguments.length; i++) { + args.push(arguments[i]); + } + + var maybeCb = args.pop(); + if (typeof maybeCb !== 'function') { + throw new TypeError('The last argument must be of type Function'); + } + var self = this; + var cb = function() { + return maybeCb.apply(self, arguments); + }; + // In true node style we process the callback on `nextTick` with all the + // implications (stack, `uncaughtException`, `async_hooks`) + original.apply(this, args) + .then(function(ret) { process.nextTick(cb.bind(null, null, ret)) }, + function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)) }); + } + + Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original)); + Object.defineProperties(callbackified, + getOwnPropertyDescriptors(original)); + return callbackified; +} +exports.callbackify = callbackify; + +}).call(this)}).call(this,require('_process')) +},{"./support/isBuffer":79,"./support/types":80,"_process":60,"inherits":45}],82:[function(require,module,exports){ +(function (global){(function (){ +'use strict'; + +var forEach = require('foreach'); +var availableTypedArrays = require('available-typed-arrays'); +var callBound = require('es-abstract/helpers/callBound'); + +var $toString = callBound('Object.prototype.toString'); +var hasSymbols = require('has-symbols')(); +var hasToStringTag = hasSymbols && typeof Symbol.toStringTag === 'symbol'; + +var typedArrays = availableTypedArrays(); + +var $slice = callBound('String.prototype.slice'); +var toStrTags = {}; +var gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor'); +var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); +if (hasToStringTag && gOPD && getPrototypeOf) { + forEach(typedArrays, function (typedArray) { + if (typeof global[typedArray] === 'function') { + var arr = new global[typedArray](); + if (!(Symbol.toStringTag in arr)) { + throw new EvalError('this engine has support for Symbol.toStringTag, but ' + typedArray + ' does not have the property! Please report this.'); + } + var proto = getPrototypeOf(arr); + var descriptor = gOPD(proto, Symbol.toStringTag); + if (!descriptor) { + var superProto = getPrototypeOf(proto); + descriptor = gOPD(superProto, Symbol.toStringTag); + } + toStrTags[typedArray] = descriptor.get; + } + }); +} + +var tryTypedArrays = function tryAllTypedArrays(value) { + var foundName = false; + forEach(toStrTags, function (getter, typedArray) { + if (!foundName) { + try { + var name = getter.call(value); + if (name === typedArray) { + foundName = name; + } + } catch (e) {} + } + }); + return foundName; +}; + +var isTypedArray = require('is-typed-array'); + +module.exports = function whichTypedArray(value) { + if (!isTypedArray(value)) { return false; } + if (!hasToStringTag) { return $slice($toString(value), 8, -1); } + return tryTypedArrays(value); +}; + +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"available-typed-arrays":27,"es-abstract/helpers/callBound":36,"es-abstract/helpers/getOwnPropertyDescriptor":37,"foreach":39,"has-symbols":42,"is-typed-array":48}]},{},[20])(20) +}); \ No newline at end of file diff --git a/project starter code/node_modules/pngjs/lib/bitmapper.js b/project starter code/node_modules/pngjs/lib/bitmapper.js index e84111f0..18378a02 100644 --- a/project starter code/node_modules/pngjs/lib/bitmapper.js +++ b/project starter code/node_modules/pngjs/lib/bitmapper.js @@ -1,19 +1,19 @@ -'use strict'; +"use strict"; -var interlaceUtils = require('./interlace'); +let interlaceUtils = require("./interlace"); -var pixelBppMapper = [ +let pixelBppMapper = [ // 0 - dummy entry - function() {}, + function () {}, // 1 - L // 0: 0, 1: 0, 2: 0, 3: 0xff - function(pxData, data, pxPos, rawPos) { + function (pxData, data, pxPos, rawPos) { if (rawPos === data.length) { - throw new Error('Ran out of data'); + throw new Error("Ran out of data"); } - var pixel = data[rawPos]; + let pixel = data[rawPos]; pxData[pxPos] = pixel; pxData[pxPos + 1] = pixel; pxData[pxPos + 2] = pixel; @@ -22,12 +22,12 @@ var pixelBppMapper = [ // 2 - LA // 0: 0, 1: 0, 2: 0, 3: 1 - function(pxData, data, pxPos, rawPos) { + function (pxData, data, pxPos, rawPos) { if (rawPos + 1 >= data.length) { - throw new Error('Ran out of data'); + throw new Error("Ran out of data"); } - var pixel = data[rawPos]; + let pixel = data[rawPos]; pxData[pxPos] = pixel; pxData[pxPos + 1] = pixel; pxData[pxPos + 2] = pixel; @@ -36,9 +36,9 @@ var pixelBppMapper = [ // 3 - RGB // 0: 0, 1: 1, 2: 2, 3: 0xff - function(pxData, data, pxPos, rawPos) { + function (pxData, data, pxPos, rawPos) { if (rawPos + 2 >= data.length) { - throw new Error('Ran out of data'); + throw new Error("Ran out of data"); } pxData[pxPos] = data[rawPos]; @@ -49,26 +49,26 @@ var pixelBppMapper = [ // 4 - RGBA // 0: 0, 1: 1, 2: 2, 3: 3 - function(pxData, data, pxPos, rawPos) { + function (pxData, data, pxPos, rawPos) { if (rawPos + 3 >= data.length) { - throw new Error('Ran out of data'); + throw new Error("Ran out of data"); } pxData[pxPos] = data[rawPos]; pxData[pxPos + 1] = data[rawPos + 1]; pxData[pxPos + 2] = data[rawPos + 2]; pxData[pxPos + 3] = data[rawPos + 3]; - } + }, ]; -var pixelBppCustomMapper = [ +let pixelBppCustomMapper = [ // 0 - dummy entry - function() {}, + function () {}, // 1 - L // 0: 0, 1: 0, 2: 0, 3: 0xff - function(pxData, pixelData, pxPos, maxBit) { - var pixel = pixelData[0]; + function (pxData, pixelData, pxPos, maxBit) { + let pixel = pixelData[0]; pxData[pxPos] = pixel; pxData[pxPos + 1] = pixel; pxData[pxPos + 2] = pixel; @@ -77,8 +77,8 @@ var pixelBppCustomMapper = [ // 2 - LA // 0: 0, 1: 0, 2: 0, 3: 1 - function(pxData, pixelData, pxPos) { - var pixel = pixelData[0]; + function (pxData, pixelData, pxPos) { + let pixel = pixelData[0]; pxData[pxPos] = pixel; pxData[pxPos + 1] = pixel; pxData[pxPos + 2] = pixel; @@ -87,7 +87,7 @@ var pixelBppCustomMapper = [ // 3 - RGB // 0: 0, 1: 1, 2: 2, 3: 0xff - function(pxData, pixelData, pxPos, maxBit) { + function (pxData, pixelData, pxPos, maxBit) { pxData[pxPos] = pixelData[0]; pxData[pxPos + 1] = pixelData[1]; pxData[pxPos + 2] = pixelData[2]; @@ -96,33 +96,32 @@ var pixelBppCustomMapper = [ // 4 - RGBA // 0: 0, 1: 1, 2: 2, 3: 3 - function(pxData, pixelData, pxPos) { + function (pxData, pixelData, pxPos) { pxData[pxPos] = pixelData[0]; pxData[pxPos + 1] = pixelData[1]; pxData[pxPos + 2] = pixelData[2]; pxData[pxPos + 3] = pixelData[3]; - } + }, ]; function bitRetriever(data, depth) { - - var leftOver = []; - var i = 0; + let leftOver = []; + let i = 0; function split() { if (i === data.length) { - throw new Error('Ran out of data'); + throw new Error("Ran out of data"); } - var byte = data[i]; + let byte = data[i]; i++; - var byte8, byte7, byte6, byte5, byte4, byte3, byte2, byte1; + let byte8, byte7, byte6, byte5, byte4, byte3, byte2, byte1; switch (depth) { default: - throw new Error('unrecognised depth'); + throw new Error("unrecognised depth"); case 16: byte2 = data[i]; i++; - leftOver.push(((byte << 8) + byte2)); + leftOver.push((byte << 8) + byte2); break; case 4: byte2 = byte & 0x0f; @@ -131,52 +130,53 @@ function bitRetriever(data, depth) { break; case 2: byte4 = byte & 3; - byte3 = byte >> 2 & 3; - byte2 = byte >> 4 & 3; - byte1 = byte >> 6 & 3; + byte3 = (byte >> 2) & 3; + byte2 = (byte >> 4) & 3; + byte1 = (byte >> 6) & 3; leftOver.push(byte1, byte2, byte3, byte4); break; case 1: byte8 = byte & 1; - byte7 = byte >> 1 & 1; - byte6 = byte >> 2 & 1; - byte5 = byte >> 3 & 1; - byte4 = byte >> 4 & 1; - byte3 = byte >> 5 & 1; - byte2 = byte >> 6 & 1; - byte1 = byte >> 7 & 1; + byte7 = (byte >> 1) & 1; + byte6 = (byte >> 2) & 1; + byte5 = (byte >> 3) & 1; + byte4 = (byte >> 4) & 1; + byte3 = (byte >> 5) & 1; + byte2 = (byte >> 6) & 1; + byte1 = (byte >> 7) & 1; leftOver.push(byte1, byte2, byte3, byte4, byte5, byte6, byte7, byte8); break; } } return { - get: function(count) { + get: function (count) { while (leftOver.length < count) { split(); } - var returner = leftOver.slice(0, count); + let returner = leftOver.slice(0, count); leftOver = leftOver.slice(count); return returner; }, - resetAfterLine: function() { + resetAfterLine: function () { leftOver.length = 0; }, - end: function() { + end: function () { if (i !== data.length) { - throw new Error('extra data found'); + throw new Error("extra data found"); } - } + }, }; } -function mapImage8Bit(image, pxData, getPxPos, bpp, data, rawPos) { // eslint-disable-line max-params - var imageWidth = image.width; - var imageHeight = image.height; - var imagePass = image.index; - for (var y = 0; y < imageHeight; y++) { - for (var x = 0; x < imageWidth; x++) { - var pxPos = getPxPos(x, y, imagePass); +function mapImage8Bit(image, pxData, getPxPos, bpp, data, rawPos) { + // eslint-disable-line max-params + let imageWidth = image.width; + let imageHeight = image.height; + let imagePass = image.index; + for (let y = 0; y < imageHeight; y++) { + for (let x = 0; x < imageWidth; x++) { + let pxPos = getPxPos(x, y, imagePass); pixelBppMapper[bpp](pxData, data, pxPos, rawPos); rawPos += bpp; //eslint-disable-line no-param-reassign } @@ -184,71 +184,82 @@ function mapImage8Bit(image, pxData, getPxPos, bpp, data, rawPos) { // eslint-di return rawPos; } -function mapImageCustomBit(image, pxData, getPxPos, bpp, bits, maxBit) { // eslint-disable-line max-params - var imageWidth = image.width; - var imageHeight = image.height; - var imagePass = image.index; - for (var y = 0; y < imageHeight; y++) { - for (var x = 0; x < imageWidth; x++) { - var pixelData = bits.get(bpp); - var pxPos = getPxPos(x, y, imagePass); +function mapImageCustomBit(image, pxData, getPxPos, bpp, bits, maxBit) { + // eslint-disable-line max-params + let imageWidth = image.width; + let imageHeight = image.height; + let imagePass = image.index; + for (let y = 0; y < imageHeight; y++) { + for (let x = 0; x < imageWidth; x++) { + let pixelData = bits.get(bpp); + let pxPos = getPxPos(x, y, imagePass); pixelBppCustomMapper[bpp](pxData, pixelData, pxPos, maxBit); } bits.resetAfterLine(); } } -exports.dataToBitMap = function(data, bitmapInfo) { - - var width = bitmapInfo.width; - var height = bitmapInfo.height; - var depth = bitmapInfo.depth; - var bpp = bitmapInfo.bpp; - var interlace = bitmapInfo.interlace; +exports.dataToBitMap = function (data, bitmapInfo) { + let width = bitmapInfo.width; + let height = bitmapInfo.height; + let depth = bitmapInfo.depth; + let bpp = bitmapInfo.bpp; + let interlace = bitmapInfo.interlace; + let bits; if (depth !== 8) { - var bits = bitRetriever(data, depth); + bits = bitRetriever(data, depth); } - var pxData; + let pxData; if (depth <= 8) { - pxData = new Buffer(width * height * 4); - } - else { + pxData = Buffer.alloc(width * height * 4); + } else { pxData = new Uint16Array(width * height * 4); } - var maxBit = Math.pow(2, depth) - 1; - var rawPos = 0; - var images; - var getPxPos; + let maxBit = Math.pow(2, depth) - 1; + let rawPos = 0; + let images; + let getPxPos; if (interlace) { images = interlaceUtils.getImagePasses(width, height); getPxPos = interlaceUtils.getInterlaceIterator(width, height); - } - else { - var nonInterlacedPxPos = 0; - getPxPos = function() { - var returner = nonInterlacedPxPos; + } else { + let nonInterlacedPxPos = 0; + getPxPos = function () { + let returner = nonInterlacedPxPos; nonInterlacedPxPos += 4; return returner; }; images = [{ width: width, height: height }]; } - for (var imageIndex = 0; imageIndex < images.length; imageIndex++) { + for (let imageIndex = 0; imageIndex < images.length; imageIndex++) { if (depth === 8) { - rawPos = mapImage8Bit(images[imageIndex], pxData, getPxPos, bpp, data, rawPos); - } - else { - mapImageCustomBit(images[imageIndex], pxData, getPxPos, bpp, bits, maxBit); + rawPos = mapImage8Bit( + images[imageIndex], + pxData, + getPxPos, + bpp, + data, + rawPos + ); + } else { + mapImageCustomBit( + images[imageIndex], + pxData, + getPxPos, + bpp, + bits, + maxBit + ); } } if (depth === 8) { if (rawPos !== data.length) { - throw new Error('extra data found'); + throw new Error("extra data found"); } - } - else { + } else { bits.end(); } diff --git a/project starter code/node_modules/pngjs/lib/bitpacker.js b/project starter code/node_modules/pngjs/lib/bitpacker.js index 788bf421..d7a4e656 100644 --- a/project starter code/node_modules/pngjs/lib/bitpacker.js +++ b/project starter code/node_modules/pngjs/lib/bitpacker.js @@ -1,12 +1,15 @@ -'use strict'; +"use strict"; -var constants = require('./constants'); +let constants = require("./constants"); -module.exports = function(dataIn, width, height, options) { - var outHasAlpha = [constants.COLORTYPE_COLOR_ALPHA, constants.COLORTYPE_ALPHA].indexOf(options.colorType) !== -1; +module.exports = function (dataIn, width, height, options) { + let outHasAlpha = + [constants.COLORTYPE_COLOR_ALPHA, constants.COLORTYPE_ALPHA].indexOf( + options.colorType + ) !== -1; if (options.colorType === options.inputColorType) { - var bigEndian = (function() { - var buffer = new ArrayBuffer(2); + let bigEndian = (function () { + let buffer = new ArrayBuffer(2); new DataView(buffer).setInt16(0, 256, true /* littleEndian */); // Int16Array uses the platform's endianness. return new Int16Array(buffer)[0] !== 256; @@ -18,24 +21,24 @@ module.exports = function(dataIn, width, height, options) { } // map to a UInt16 array if data is 16bit, fix endianness below - var data = options.bitDepth !== 16 ? dataIn : new Uint16Array(dataIn.buffer); + let data = options.bitDepth !== 16 ? dataIn : new Uint16Array(dataIn.buffer); - var maxValue = 255; - var inBpp = constants.COLORTYPE_TO_BPP_MAP[options.inputColorType]; + let maxValue = 255; + let inBpp = constants.COLORTYPE_TO_BPP_MAP[options.inputColorType]; if (inBpp === 4 && !options.inputHasAlpha) { inBpp = 3; } - var outBpp = constants.COLORTYPE_TO_BPP_MAP[options.colorType]; + let outBpp = constants.COLORTYPE_TO_BPP_MAP[options.colorType]; if (options.bitDepth === 16) { maxValue = 65535; outBpp *= 2; } - var outData = new Buffer(width * height * outBpp); + let outData = Buffer.alloc(width * height * outBpp); - var inIndex = 0; - var outIndex = 0; + let inIndex = 0; + let outIndex = 0; - var bgColor = options.bgColor || {}; + let bgColor = options.bgColor || {}; if (bgColor.red === undefined) { bgColor.red = maxValue; } @@ -47,10 +50,10 @@ module.exports = function(dataIn, width, height, options) { } function getRGBA() { - var red; - var green; - var blue; - var alpha = maxValue; + let red; + let green; + let blue; + let alpha = maxValue; switch (options.inputColorType) { case constants.COLORTYPE_COLOR_ALPHA: alpha = data[inIndex + 3]; @@ -75,23 +78,36 @@ module.exports = function(dataIn, width, height, options) { blue = red; break; default: - throw new Error('input color type:' + options.inputColorType + ' is not supported at present'); + throw new Error( + "input color type:" + + options.inputColorType + + " is not supported at present" + ); } if (options.inputHasAlpha) { if (!outHasAlpha) { alpha /= maxValue; - red = Math.min(Math.max(Math.round((1 - alpha) * bgColor.red + alpha * red), 0), maxValue); - green = Math.min(Math.max(Math.round((1 - alpha) * bgColor.green + alpha * green), 0), maxValue); - blue = Math.min(Math.max(Math.round((1 - alpha) * bgColor.blue + alpha * blue), 0), maxValue); + red = Math.min( + Math.max(Math.round((1 - alpha) * bgColor.red + alpha * red), 0), + maxValue + ); + green = Math.min( + Math.max(Math.round((1 - alpha) * bgColor.green + alpha * green), 0), + maxValue + ); + blue = Math.min( + Math.max(Math.round((1 - alpha) * bgColor.blue + alpha * blue), 0), + maxValue + ); } } return { red: red, green: green, blue: blue, alpha: alpha }; } - for (var y = 0; y < height; y++) { - for (var x = 0; x < width; x++) { - var rgba = getRGBA(data, inIndex); + for (let y = 0; y < height; y++) { + for (let x = 0; x < width; x++) { + let rgba = getRGBA(data, inIndex); switch (options.colorType) { case constants.COLORTYPE_COLOR_ALPHA: @@ -103,8 +119,7 @@ module.exports = function(dataIn, width, height, options) { if (outHasAlpha) { outData[outIndex + 3] = rgba.alpha; } - } - else { + } else { outData.writeUInt16BE(rgba.red, outIndex); outData.writeUInt16BE(rgba.green, outIndex + 2); outData.writeUInt16BE(rgba.blue, outIndex + 4); @@ -114,24 +129,24 @@ module.exports = function(dataIn, width, height, options) { } break; case constants.COLORTYPE_ALPHA: - case constants.COLORTYPE_GRAYSCALE: + case constants.COLORTYPE_GRAYSCALE: { // Convert to grayscale and alpha - var grayscale = (rgba.red + rgba.green + rgba.blue) / 3; + let grayscale = (rgba.red + rgba.green + rgba.blue) / 3; if (options.bitDepth === 8) { outData[outIndex] = grayscale; if (outHasAlpha) { outData[outIndex + 1] = rgba.alpha; } - } - else { + } else { outData.writeUInt16BE(grayscale, outIndex); if (outHasAlpha) { outData.writeUInt16BE(rgba.alpha, outIndex + 2); } } break; + } default: - throw new Error('unrecognised color Type ' + options.colorType); + throw new Error("unrecognised color Type " + options.colorType); } inIndex += inBpp; diff --git a/project starter code/node_modules/pngjs/lib/chunkstream.js b/project starter code/node_modules/pngjs/lib/chunkstream.js index 0e542dea..95b46d48 100644 --- a/project starter code/node_modules/pngjs/lib/chunkstream.js +++ b/project starter code/node_modules/pngjs/lib/chunkstream.js @@ -1,11 +1,9 @@ -'use strict'; +"use strict"; +let util = require("util"); +let Stream = require("stream"); -var util = require('util'); -var Stream = require('stream'); - - -var ChunkStream = module.exports = function() { +let ChunkStream = (module.exports = function () { Stream.call(this); this._buffers = []; @@ -14,45 +12,43 @@ var ChunkStream = module.exports = function() { this._reads = []; this._paused = false; - this._encoding = 'utf8'; + this._encoding = "utf8"; this.writable = true; -}; +}); util.inherits(ChunkStream, Stream); - -ChunkStream.prototype.read = function(length, callback) { - +ChunkStream.prototype.read = function (length, callback) { this._reads.push({ length: Math.abs(length), // if length < 0 then at most this length allowLess: length < 0, - func: callback + func: callback, }); - process.nextTick(function() { - this._process(); + process.nextTick( + function () { + this._process(); - // its paused and there is not enought data then ask for more - if (this._paused && this._reads.length > 0) { - this._paused = false; + // its paused and there is not enought data then ask for more + if (this._paused && this._reads && this._reads.length > 0) { + this._paused = false; - this.emit('drain'); - } - }.bind(this)); + this.emit("drain"); + } + }.bind(this) + ); }; -ChunkStream.prototype.write = function(data, encoding) { - +ChunkStream.prototype.write = function (data, encoding) { if (!this.writable) { - this.emit('error', new Error('Stream not writable')); + this.emit("error", new Error("Stream not writable")); return false; } - var dataBuffer; + let dataBuffer; if (Buffer.isBuffer(data)) { dataBuffer = data; - } - else { - dataBuffer = new Buffer(data, encoding || this._encoding); + } else { + dataBuffer = Buffer.from(data, encoding || this._encoding); } this._buffers.push(dataBuffer); @@ -68,8 +64,7 @@ ChunkStream.prototype.write = function(data, encoding) { return this.writable && !this._paused; }; -ChunkStream.prototype.end = function(data, encoding) { - +ChunkStream.prototype.end = function (data, encoding) { if (data) { this.write(data, encoding); } @@ -84,8 +79,7 @@ ChunkStream.prototype.end = function(data, encoding) { // enqueue or handle end if (this._buffers.length === 0) { this._end(); - } - else { + } else { this._buffers.push(null); this._process(); } @@ -93,19 +87,15 @@ ChunkStream.prototype.end = function(data, encoding) { ChunkStream.prototype.destroySoon = ChunkStream.prototype.end; -ChunkStream.prototype._end = function() { - +ChunkStream.prototype._end = function () { if (this._reads.length > 0) { - this.emit('error', - new Error('Unexpected end of input') - ); + this.emit("error", new Error("Unexpected end of input")); } this.destroy(); }; -ChunkStream.prototype.destroy = function() { - +ChunkStream.prototype.destroy = function () { if (!this._buffers) { return; } @@ -114,26 +104,23 @@ ChunkStream.prototype.destroy = function() { this._reads = null; this._buffers = null; - this.emit('close'); + this.emit("close"); }; -ChunkStream.prototype._processReadAllowingLess = function(read) { +ChunkStream.prototype._processReadAllowingLess = function (read) { // ok there is any data so that we can satisfy this request this._reads.shift(); // == read // first we need to peek into first buffer - var smallerBuf = this._buffers[0]; + let smallerBuf = this._buffers[0]; // ok there is more data than we need if (smallerBuf.length > read.length) { - this._buffered -= read.length; this._buffers[0] = smallerBuf.slice(read.length); read.func.call(this, smallerBuf.slice(0, read.length)); - - } - else { + } else { // ok this is less than maximum length so use it all this._buffered -= smallerBuf.length; this._buffers.shift(); // == smallerBuf @@ -142,18 +129,17 @@ ChunkStream.prototype._processReadAllowingLess = function(read) { } }; -ChunkStream.prototype._processRead = function(read) { +ChunkStream.prototype._processRead = function (read) { this._reads.shift(); // == read - var pos = 0; - var count = 0; - var data = new Buffer(read.length); + let pos = 0; + let count = 0; + let data = Buffer.alloc(read.length); // create buffer for all data while (pos < read.length) { - - var buf = this._buffers[count++]; - var len = Math.min(buf.length, read.length - pos); + let buf = this._buffers[count++]; + let len = Math.min(buf.length, read.length - pos); buf.copy(data, pos, 0, len); pos += len; @@ -174,25 +160,20 @@ ChunkStream.prototype._processRead = function(read) { read.func.call(this, data); }; -ChunkStream.prototype._process = function() { - +ChunkStream.prototype._process = function () { try { // as long as there is any data and read requests while (this._buffered > 0 && this._reads && this._reads.length > 0) { - - var read = this._reads[0]; + let read = this._reads[0]; // read any data (but no more than length) if (read.allowLess) { this._processReadAllowingLess(read); - - } - else if (this._buffered >= read.length) { + } else if (this._buffered >= read.length) { // ok we can meet some expectations this._processRead(read); - } - else { + } else { // not enought data to satisfy first request in queue // so we need to wait for more break; @@ -202,8 +183,7 @@ ChunkStream.prototype._process = function() { if (this._buffers && !this.writable) { this._end(); } - } - catch (ex) { - this.emit('error', ex); + } catch (ex) { + this.emit("error", ex); } }; diff --git a/project starter code/node_modules/pngjs/lib/constants.js b/project starter code/node_modules/pngjs/lib/constants.js index 22d919d6..21fdad68 100644 --- a/project starter code/node_modules/pngjs/lib/constants.js +++ b/project starter code/node_modules/pngjs/lib/constants.js @@ -1,8 +1,6 @@ -'use strict'; - +"use strict"; module.exports = { - PNG_SIGNATURE: [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a], TYPE_IHDR: 0x49484452, @@ -27,8 +25,8 @@ module.exports = { 2: 3, 3: 1, 4: 2, - 6: 4 + 6: 4, }, - GAMMA_DIVISION: 100000 + GAMMA_DIVISION: 100000, }; diff --git a/project starter code/node_modules/pngjs/lib/crc.js b/project starter code/node_modules/pngjs/lib/crc.js index 0705ed26..950ec8ae 100644 --- a/project starter code/node_modules/pngjs/lib/crc.js +++ b/project starter code/node_modules/pngjs/lib/crc.js @@ -1,43 +1,39 @@ -'use strict'; +"use strict"; -var crcTable = []; +let crcTable = []; -(function() { - for (var i = 0; i < 256; i++) { - var currentCrc = i; - for (var j = 0; j < 8; j++) { +(function () { + for (let i = 0; i < 256; i++) { + let currentCrc = i; + for (let j = 0; j < 8; j++) { if (currentCrc & 1) { currentCrc = 0xedb88320 ^ (currentCrc >>> 1); - } - else { + } else { currentCrc = currentCrc >>> 1; } } crcTable[i] = currentCrc; } -}()); +})(); -var CrcCalculator = module.exports = function() { +let CrcCalculator = (module.exports = function () { this._crc = -1; -}; - -CrcCalculator.prototype.write = function(data) { +}); - for (var i = 0; i < data.length; i++) { +CrcCalculator.prototype.write = function (data) { + for (let i = 0; i < data.length; i++) { this._crc = crcTable[(this._crc ^ data[i]) & 0xff] ^ (this._crc >>> 8); } return true; }; -CrcCalculator.prototype.crc32 = function() { +CrcCalculator.prototype.crc32 = function () { return this._crc ^ -1; }; - -CrcCalculator.crc32 = function(buf) { - - var crc = -1; - for (var i = 0; i < buf.length; i++) { +CrcCalculator.crc32 = function (buf) { + let crc = -1; + for (let i = 0; i < buf.length; i++) { crc = crcTable[(crc ^ buf[i]) & 0xff] ^ (crc >>> 8); } return crc ^ -1; diff --git a/project starter code/node_modules/pngjs/lib/filter-pack.js b/project starter code/node_modules/pngjs/lib/filter-pack.js index 0a3eac80..32c85c40 100644 --- a/project starter code/node_modules/pngjs/lib/filter-pack.js +++ b/project starter code/node_modules/pngjs/lib/filter-pack.js @@ -1,43 +1,37 @@ -'use strict'; +"use strict"; -var paethPredictor = require('./paeth-predictor'); +let paethPredictor = require("./paeth-predictor"); function filterNone(pxData, pxPos, byteWidth, rawData, rawPos) { - - for (var x = 0; x < byteWidth; x++) { + for (let x = 0; x < byteWidth; x++) { rawData[rawPos + x] = pxData[pxPos + x]; } } function filterSumNone(pxData, pxPos, byteWidth) { + let sum = 0; + let length = pxPos + byteWidth; - var sum = 0; - var length = pxPos + byteWidth; - - for (var i = pxPos; i < length; i++) { + for (let i = pxPos; i < length; i++) { sum += Math.abs(pxData[i]); } return sum; } function filterSub(pxData, pxPos, byteWidth, rawData, rawPos, bpp) { - - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var val = pxData[pxPos + x] - left; + for (let x = 0; x < byteWidth; x++) { + let left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + let val = pxData[pxPos + x] - left; rawData[rawPos + x] = val; } } function filterSumSub(pxData, pxPos, byteWidth, bpp) { - - var sum = 0; - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var val = pxData[pxPos + x] - left; + let sum = 0; + for (let x = 0; x < byteWidth; x++) { + let left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + let val = pxData[pxPos + x] - left; sum += Math.abs(val); } @@ -46,24 +40,20 @@ function filterSumSub(pxData, pxPos, byteWidth, bpp) { } function filterUp(pxData, pxPos, byteWidth, rawData, rawPos) { - - for (var x = 0; x < byteWidth; x++) { - - var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; - var val = pxData[pxPos + x] - up; + for (let x = 0; x < byteWidth; x++) { + let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; + let val = pxData[pxPos + x] - up; rawData[rawPos + x] = val; } } function filterSumUp(pxData, pxPos, byteWidth) { - - var sum = 0; - var length = pxPos + byteWidth; - for (var x = pxPos; x < length; x++) { - - var up = pxPos > 0 ? pxData[x - byteWidth] : 0; - var val = pxData[x] - up; + let sum = 0; + let length = pxPos + byteWidth; + for (let x = pxPos; x < length; x++) { + let up = pxPos > 0 ? pxData[x - byteWidth] : 0; + let val = pxData[x] - up; sum += Math.abs(val); } @@ -72,25 +62,21 @@ function filterSumUp(pxData, pxPos, byteWidth) { } function filterAvg(pxData, pxPos, byteWidth, rawData, rawPos, bpp) { - - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; - var val = pxData[pxPos + x] - ((left + up) >> 1); + for (let x = 0; x < byteWidth; x++) { + let left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; + let val = pxData[pxPos + x] - ((left + up) >> 1); rawData[rawPos + x] = val; } } function filterSumAvg(pxData, pxPos, byteWidth, bpp) { - - var sum = 0; - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; - var val = pxData[pxPos + x] - ((left + up) >> 1); + let sum = 0; + for (let x = 0; x < byteWidth; x++) { + let left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; + let val = pxData[pxPos + x] - ((left + up) >> 1); sum += Math.abs(val); } @@ -99,26 +85,25 @@ function filterSumAvg(pxData, pxPos, byteWidth, bpp) { } function filterPaeth(pxData, pxPos, byteWidth, rawData, rawPos, bpp) { - - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; - var upleft = pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0; - var val = pxData[pxPos + x] - paethPredictor(left, up, upleft); + for (let x = 0; x < byteWidth; x++) { + let left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; + let upleft = + pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0; + let val = pxData[pxPos + x] - paethPredictor(left, up, upleft); rawData[rawPos + x] = val; } } function filterSumPaeth(pxData, pxPos, byteWidth, bpp) { - var sum = 0; - for (var x = 0; x < byteWidth; x++) { - - var left = x >= bpp ? pxData[pxPos + x - bpp] : 0; - var up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; - var upleft = pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0; - var val = pxData[pxPos + x] - paethPredictor(left, up, upleft); + let sum = 0; + for (let x = 0; x < byteWidth; x++) { + let left = x >= bpp ? pxData[pxPos + x - bpp] : 0; + let up = pxPos > 0 ? pxData[pxPos + x - byteWidth] : 0; + let upleft = + pxPos > 0 && x >= bpp ? pxData[pxPos + x - (byteWidth + bpp)] : 0; + let val = pxData[pxPos + x] - paethPredictor(left, up, upleft); sum += Math.abs(val); } @@ -126,53 +111,49 @@ function filterSumPaeth(pxData, pxPos, byteWidth, bpp) { return sum; } -var filters = { +let filters = { 0: filterNone, 1: filterSub, 2: filterUp, 3: filterAvg, - 4: filterPaeth + 4: filterPaeth, }; -var filterSums = { +let filterSums = { 0: filterSumNone, 1: filterSumSub, 2: filterSumUp, 3: filterSumAvg, - 4: filterSumPaeth + 4: filterSumPaeth, }; -module.exports = function(pxData, width, height, options, bpp) { - - var filterTypes; - if (!('filterType' in options) || options.filterType === -1) { +module.exports = function (pxData, width, height, options, bpp) { + let filterTypes; + if (!("filterType" in options) || options.filterType === -1) { filterTypes = [0, 1, 2, 3, 4]; - } - else if (typeof options.filterType === 'number') { + } else if (typeof options.filterType === "number") { filterTypes = [options.filterType]; - } - else { - throw new Error('unrecognised filter types'); + } else { + throw new Error("unrecognised filter types"); } if (options.bitDepth === 16) { bpp *= 2; } - var byteWidth = width * bpp; - var rawPos = 0; - var pxPos = 0; - var rawData = new Buffer((byteWidth + 1) * height); - - var sel = filterTypes[0]; + let byteWidth = width * bpp; + let rawPos = 0; + let pxPos = 0; + let rawData = Buffer.alloc((byteWidth + 1) * height); - for (var y = 0; y < height; y++) { + let sel = filterTypes[0]; + for (let y = 0; y < height; y++) { if (filterTypes.length > 1) { // find best filter for this line (with lowest sum of values) - var min = Infinity; + let min = Infinity; - for (var i = 0; i < filterTypes.length; i++) { - var sum = filterSums[filterTypes[i]](pxData, pxPos, byteWidth, bpp); + for (let i = 0; i < filterTypes.length; i++) { + let sum = filterSums[filterTypes[i]](pxData, pxPos, byteWidth, bpp); if (sum < min) { sel = filterTypes[i]; min = sum; diff --git a/project starter code/node_modules/pngjs/lib/filter-parse-async.js b/project starter code/node_modules/pngjs/lib/filter-parse-async.js index 560c30ea..832b86cd 100644 --- a/project starter code/node_modules/pngjs/lib/filter-parse-async.js +++ b/project starter code/node_modules/pngjs/lib/filter-parse-async.js @@ -1,25 +1,24 @@ -'use strict'; +"use strict"; -var util = require('util'); -var ChunkStream = require('./chunkstream'); -var Filter = require('./filter-parse'); +let util = require("util"); +let ChunkStream = require("./chunkstream"); +let Filter = require("./filter-parse"); - -var FilterAsync = module.exports = function(bitmapInfo) { +let FilterAsync = (module.exports = function (bitmapInfo) { ChunkStream.call(this); - var buffers = []; - var that = this; + let buffers = []; + let that = this; this._filter = new Filter(bitmapInfo, { read: this.read.bind(this), - write: function(buffer) { + write: function (buffer) { buffers.push(buffer); }, - complete: function() { - that.emit('complete', Buffer.concat(buffers)); - } + complete: function () { + that.emit("complete", Buffer.concat(buffers)); + }, }); this._filter.start(); -}; +}); util.inherits(FilterAsync, ChunkStream); diff --git a/project starter code/node_modules/pngjs/lib/filter-parse-sync.js b/project starter code/node_modules/pngjs/lib/filter-parse-sync.js index 958c6765..6924d161 100644 --- a/project starter code/node_modules/pngjs/lib/filter-parse-sync.js +++ b/project starter code/node_modules/pngjs/lib/filter-parse-sync.js @@ -1,24 +1,21 @@ -'use strict'; +"use strict"; -var SyncReader = require('./sync-reader'); -var Filter = require('./filter-parse'); +let SyncReader = require("./sync-reader"); +let Filter = require("./filter-parse"); - -exports.process = function(inBuffer, bitmapInfo) { - - var outBuffers = []; - var reader = new SyncReader(inBuffer); - var filter = new Filter(bitmapInfo, { +exports.process = function (inBuffer, bitmapInfo) { + let outBuffers = []; + let reader = new SyncReader(inBuffer); + let filter = new Filter(bitmapInfo, { read: reader.read.bind(reader), - write: function(bufferPart) { + write: function (bufferPart) { outBuffers.push(bufferPart); }, - complete: function() { - } + complete: function () {}, }); filter.start(); reader.process(); return Buffer.concat(outBuffers); -}; \ No newline at end of file +}; diff --git a/project starter code/node_modules/pngjs/lib/filter-parse.js b/project starter code/node_modules/pngjs/lib/filter-parse.js index 3f0e14bb..3a32e5ee 100644 --- a/project starter code/node_modules/pngjs/lib/filter-parse.js +++ b/project starter code/node_modules/pngjs/lib/filter-parse.js @@ -1,23 +1,22 @@ -'use strict'; +"use strict"; -var interlaceUtils = require('./interlace'); -var paethPredictor = require('./paeth-predictor'); +let interlaceUtils = require("./interlace"); +let paethPredictor = require("./paeth-predictor"); function getByteWidth(width, bpp, depth) { - var byteWidth = width * bpp; + let byteWidth = width * bpp; if (depth !== 8) { byteWidth = Math.ceil(byteWidth / (8 / depth)); } return byteWidth; } -var Filter = module.exports = function(bitmapInfo, dependencies) { - - var width = bitmapInfo.width; - var height = bitmapInfo.height; - var interlace = bitmapInfo.interlace; - var bpp = bitmapInfo.bpp; - var depth = bitmapInfo.depth; +let Filter = (module.exports = function (bitmapInfo, dependencies) { + let width = bitmapInfo.width; + let height = bitmapInfo.height; + let interlace = bitmapInfo.interlace; + let bpp = bitmapInfo.bpp; + let depth = bitmapInfo.depth; this.read = dependencies.read; this.write = dependencies.write; @@ -26,20 +25,19 @@ var Filter = module.exports = function(bitmapInfo, dependencies) { this._imageIndex = 0; this._images = []; if (interlace) { - var passes = interlaceUtils.getImagePasses(width, height); - for (var i = 0; i < passes.length; i++) { + let passes = interlaceUtils.getImagePasses(width, height); + for (let i = 0; i < passes.length; i++) { this._images.push({ byteWidth: getByteWidth(passes[i].width, bpp, depth), height: passes[i].height, - lineIndex: 0 + lineIndex: 0, }); } - } - else { + } else { this._images.push({ byteWidth: getByteWidth(width, bpp, depth), height: height, - lineIndex: 0 + lineIndex: 0, }); } @@ -49,86 +47,96 @@ var Filter = module.exports = function(bitmapInfo, dependencies) { // a pixel rather than just a different byte part. However if we are sub byte, we ignore. if (depth === 8) { this._xComparison = bpp; - } - else if (depth === 16) { + } else if (depth === 16) { this._xComparison = bpp * 2; - } - else { + } else { this._xComparison = 1; } -}; +}); -Filter.prototype.start = function() { - this.read(this._images[this._imageIndex].byteWidth + 1, this._reverseFilterLine.bind(this)); +Filter.prototype.start = function () { + this.read( + this._images[this._imageIndex].byteWidth + 1, + this._reverseFilterLine.bind(this) + ); }; -Filter.prototype._unFilterType1 = function(rawData, unfilteredLine, byteWidth) { - - var xComparison = this._xComparison; - var xBiggerThan = xComparison - 1; - - for (var x = 0; x < byteWidth; x++) { - var rawByte = rawData[1 + x]; - var f1Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; +Filter.prototype._unFilterType1 = function ( + rawData, + unfilteredLine, + byteWidth +) { + let xComparison = this._xComparison; + let xBiggerThan = xComparison - 1; + + for (let x = 0; x < byteWidth; x++) { + let rawByte = rawData[1 + x]; + let f1Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; unfilteredLine[x] = rawByte + f1Left; } }; -Filter.prototype._unFilterType2 = function(rawData, unfilteredLine, byteWidth) { +Filter.prototype._unFilterType2 = function ( + rawData, + unfilteredLine, + byteWidth +) { + let lastLine = this._lastLine; - var lastLine = this._lastLine; - - for (var x = 0; x < byteWidth; x++) { - var rawByte = rawData[1 + x]; - var f2Up = lastLine ? lastLine[x] : 0; + for (let x = 0; x < byteWidth; x++) { + let rawByte = rawData[1 + x]; + let f2Up = lastLine ? lastLine[x] : 0; unfilteredLine[x] = rawByte + f2Up; } }; -Filter.prototype._unFilterType3 = function(rawData, unfilteredLine, byteWidth) { - - var xComparison = this._xComparison; - var xBiggerThan = xComparison - 1; - var lastLine = this._lastLine; - - for (var x = 0; x < byteWidth; x++) { - var rawByte = rawData[1 + x]; - var f3Up = lastLine ? lastLine[x] : 0; - var f3Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; - var f3Add = Math.floor((f3Left + f3Up) / 2); +Filter.prototype._unFilterType3 = function ( + rawData, + unfilteredLine, + byteWidth +) { + let xComparison = this._xComparison; + let xBiggerThan = xComparison - 1; + let lastLine = this._lastLine; + + for (let x = 0; x < byteWidth; x++) { + let rawByte = rawData[1 + x]; + let f3Up = lastLine ? lastLine[x] : 0; + let f3Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; + let f3Add = Math.floor((f3Left + f3Up) / 2); unfilteredLine[x] = rawByte + f3Add; } }; -Filter.prototype._unFilterType4 = function(rawData, unfilteredLine, byteWidth) { - - var xComparison = this._xComparison; - var xBiggerThan = xComparison - 1; - var lastLine = this._lastLine; - - for (var x = 0; x < byteWidth; x++) { - var rawByte = rawData[1 + x]; - var f4Up = lastLine ? lastLine[x] : 0; - var f4Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; - var f4UpLeft = x > xBiggerThan && lastLine ? lastLine[x - xComparison] : 0; - var f4Add = paethPredictor(f4Left, f4Up, f4UpLeft); +Filter.prototype._unFilterType4 = function ( + rawData, + unfilteredLine, + byteWidth +) { + let xComparison = this._xComparison; + let xBiggerThan = xComparison - 1; + let lastLine = this._lastLine; + + for (let x = 0; x < byteWidth; x++) { + let rawByte = rawData[1 + x]; + let f4Up = lastLine ? lastLine[x] : 0; + let f4Left = x > xBiggerThan ? unfilteredLine[x - xComparison] : 0; + let f4UpLeft = x > xBiggerThan && lastLine ? lastLine[x - xComparison] : 0; + let f4Add = paethPredictor(f4Left, f4Up, f4UpLeft); unfilteredLine[x] = rawByte + f4Add; } }; -Filter.prototype._reverseFilterLine = function(rawData) { - - var filter = rawData[0]; - var unfilteredLine; - var currentImage = this._images[this._imageIndex]; - var byteWidth = currentImage.byteWidth; +Filter.prototype._reverseFilterLine = function (rawData) { + let filter = rawData[0]; + let unfilteredLine; + let currentImage = this._images[this._imageIndex]; + let byteWidth = currentImage.byteWidth; if (filter === 0) { unfilteredLine = rawData.slice(1, byteWidth + 1); - } - else { - - unfilteredLine = new Buffer(byteWidth); + } else { + unfilteredLine = Buffer.alloc(byteWidth); switch (filter) { case 1: @@ -144,7 +152,7 @@ Filter.prototype._reverseFilterLine = function(rawData) { this._unFilterType4(rawData, unfilteredLine, byteWidth); break; default: - throw new Error('Unrecognised filter type - ' + filter); + throw new Error("Unrecognised filter type - " + filter); } } @@ -155,16 +163,14 @@ Filter.prototype._reverseFilterLine = function(rawData) { this._lastLine = null; this._imageIndex++; currentImage = this._images[this._imageIndex]; - } - else { + } else { this._lastLine = unfilteredLine; } if (currentImage) { // read, using the byte width that may be from the new current image this.read(currentImage.byteWidth + 1, this._reverseFilterLine.bind(this)); - } - else { + } else { this._lastLine = null; this.complete(); } diff --git a/project starter code/node_modules/pngjs/lib/format-normaliser.js b/project starter code/node_modules/pngjs/lib/format-normaliser.js index 378373f5..209b66bb 100644 --- a/project starter code/node_modules/pngjs/lib/format-normaliser.js +++ b/project starter code/node_modules/pngjs/lib/format-normaliser.js @@ -1,17 +1,17 @@ -'use strict'; +"use strict"; function dePalette(indata, outdata, width, height, palette) { - var pxPos = 0; + let pxPos = 0; // use values from palette - for (var y = 0; y < height; y++) { - for (var x = 0; x < width; x++) { - var color = palette[indata[pxPos]]; + for (let y = 0; y < height; y++) { + for (let x = 0; x < width; x++) { + let color = palette[indata[pxPos]]; if (!color) { - throw new Error('index ' + indata[pxPos] + ' not in palette'); + throw new Error("index " + indata[pxPos] + " not in palette"); } - for (var i = 0; i < 4; i++) { + for (let i = 0; i < 4; i++) { outdata[pxPos + i] = color[i]; } pxPos += 4; @@ -20,21 +20,24 @@ function dePalette(indata, outdata, width, height, palette) { } function replaceTransparentColor(indata, outdata, width, height, transColor) { - var pxPos = 0; - for (var y = 0; y < height; y++) { - for (var x = 0; x < width; x++) { - var makeTrans = false; + let pxPos = 0; + for (let y = 0; y < height; y++) { + for (let x = 0; x < width; x++) { + let makeTrans = false; if (transColor.length === 1) { if (transColor[0] === indata[pxPos]) { makeTrans = true; } - } - else if (transColor[0] === indata[pxPos] && transColor[1] === indata[pxPos + 1] && transColor[2] === indata[pxPos + 2]) { + } else if ( + transColor[0] === indata[pxPos] && + transColor[1] === indata[pxPos + 1] && + transColor[2] === indata[pxPos + 2] + ) { makeTrans = true; } if (makeTrans) { - for (var i = 0; i < 4; i++) { + for (let i = 0; i < 4; i++) { outdata[pxPos + i] = 0; } } @@ -44,43 +47,44 @@ function replaceTransparentColor(indata, outdata, width, height, transColor) { } function scaleDepth(indata, outdata, width, height, depth) { - var maxOutSample = 255; - var maxInSample = Math.pow(2, depth) - 1; - var pxPos = 0; + let maxOutSample = 255; + let maxInSample = Math.pow(2, depth) - 1; + let pxPos = 0; - for (var y = 0; y < height; y++) { - for (var x = 0; x < width; x++) { - for (var i = 0; i < 4; i++) { - outdata[pxPos + i] = Math.floor((indata[pxPos + i] * maxOutSample) / maxInSample + 0.5); + for (let y = 0; y < height; y++) { + for (let x = 0; x < width; x++) { + for (let i = 0; i < 4; i++) { + outdata[pxPos + i] = Math.floor( + (indata[pxPos + i] * maxOutSample) / maxInSample + 0.5 + ); } pxPos += 4; } } } -module.exports = function(indata, imageData) { - - var depth = imageData.depth; - var width = imageData.width; - var height = imageData.height; - var colorType = imageData.colorType; - var transColor = imageData.transColor; - var palette = imageData.palette; +module.exports = function (indata, imageData, skipRescale = false) { + let depth = imageData.depth; + let width = imageData.width; + let height = imageData.height; + let colorType = imageData.colorType; + let transColor = imageData.transColor; + let palette = imageData.palette; - var outdata = indata; // only different for 16 bits + let outdata = indata; // only different for 16 bits - if (colorType === 3) { // paletted + if (colorType === 3) { + // paletted dePalette(indata, outdata, width, height, palette); - } - else { + } else { if (transColor) { replaceTransparentColor(indata, outdata, width, height, transColor); } // if it needs scaling - if (depth !== 8) { + if (depth !== 8 && !skipRescale) { // if we need to change the buffer size if (depth === 16) { - outdata = new Buffer(width * height * 4); + outdata = Buffer.alloc(width * height * 4); } scaleDepth(indata, outdata, width, height, depth); } diff --git a/project starter code/node_modules/pngjs/lib/interlace.js b/project starter code/node_modules/pngjs/lib/interlace.js index 734ea23f..a035cb15 100644 --- a/project starter code/node_modules/pngjs/lib/interlace.js +++ b/project starter code/node_modules/pngjs/lib/interlace.js @@ -1,4 +1,4 @@ -'use strict'; +"use strict"; // Adam 7 // 0 1 2 3 4 5 6 7 @@ -11,61 +11,65 @@ // 6 5 6 5 6 5 6 5 6 // 7 7 7 7 7 7 7 7 7 - -var imagePasses = [ - { // pass 1 - 1px +let imagePasses = [ + { + // pass 1 - 1px x: [0], - y: [0] + y: [0], }, - { // pass 2 - 1px + { + // pass 2 - 1px x: [4], - y: [0] + y: [0], }, - { // pass 3 - 2px + { + // pass 3 - 2px x: [0, 4], - y: [4] + y: [4], }, - { // pass 4 - 4px + { + // pass 4 - 4px x: [2, 6], - y: [0, 4] + y: [0, 4], }, - { // pass 5 - 8px + { + // pass 5 - 8px x: [0, 2, 4, 6], - y: [2, 6] + y: [2, 6], }, - { // pass 6 - 16px + { + // pass 6 - 16px x: [1, 3, 5, 7], - y: [0, 2, 4, 6] + y: [0, 2, 4, 6], }, - { // pass 7 - 32px + { + // pass 7 - 32px x: [0, 1, 2, 3, 4, 5, 6, 7], - y: [1, 3, 5, 7] - } + y: [1, 3, 5, 7], + }, ]; -exports.getImagePasses = function(width, height) { - var images = []; - var xLeftOver = width % 8; - var yLeftOver = height % 8; - var xRepeats = (width - xLeftOver) / 8; - var yRepeats = (height - yLeftOver) / 8; - for (var i = 0; i < imagePasses.length; i++) { - var pass = imagePasses[i]; - var passWidth = xRepeats * pass.x.length; - var passHeight = yRepeats * pass.y.length; - for (var j = 0; j < pass.x.length; j++) { +exports.getImagePasses = function (width, height) { + let images = []; + let xLeftOver = width % 8; + let yLeftOver = height % 8; + let xRepeats = (width - xLeftOver) / 8; + let yRepeats = (height - yLeftOver) / 8; + for (let i = 0; i < imagePasses.length; i++) { + let pass = imagePasses[i]; + let passWidth = xRepeats * pass.x.length; + let passHeight = yRepeats * pass.y.length; + for (let j = 0; j < pass.x.length; j++) { if (pass.x[j] < xLeftOver) { passWidth++; - } - else { + } else { break; } } - for (j = 0; j < pass.y.length; j++) { + for (let j = 0; j < pass.y.length; j++) { if (pass.y[j] < yLeftOver) { passHeight++; - } - else { + } else { break; } } @@ -76,12 +80,16 @@ exports.getImagePasses = function(width, height) { return images; }; -exports.getInterlaceIterator = function(width) { - return function(x, y, pass) { - var outerXLeftOver = x % imagePasses[pass].x.length; - var outerX = (((x - outerXLeftOver) / imagePasses[pass].x.length) * 8) + imagePasses[pass].x[outerXLeftOver]; - var outerYLeftOver = y % imagePasses[pass].y.length; - var outerY = (((y - outerYLeftOver) / imagePasses[pass].y.length) * 8) + imagePasses[pass].y[outerYLeftOver]; - return (outerX * 4) + (outerY * width * 4); +exports.getInterlaceIterator = function (width) { + return function (x, y, pass) { + let outerXLeftOver = x % imagePasses[pass].x.length; + let outerX = + ((x - outerXLeftOver) / imagePasses[pass].x.length) * 8 + + imagePasses[pass].x[outerXLeftOver]; + let outerYLeftOver = y % imagePasses[pass].y.length; + let outerY = + ((y - outerYLeftOver) / imagePasses[pass].y.length) * 8 + + imagePasses[pass].y[outerYLeftOver]; + return outerX * 4 + outerY * width * 4; }; -}; \ No newline at end of file +}; diff --git a/project starter code/node_modules/pngjs/lib/packer-async.js b/project starter code/node_modules/pngjs/lib/packer-async.js index 92294c89..f3df73aa 100644 --- a/project starter code/node_modules/pngjs/lib/packer-async.js +++ b/project starter code/node_modules/pngjs/lib/packer-async.js @@ -1,45 +1,50 @@ -'use strict'; +"use strict"; -var util = require('util'); -var Stream = require('stream'); -var constants = require('./constants'); -var Packer = require('./packer'); +let util = require("util"); +let Stream = require("stream"); +let constants = require("./constants"); +let Packer = require("./packer"); -var PackerAsync = module.exports = function(opt) { +let PackerAsync = (module.exports = function (opt) { Stream.call(this); - var options = opt || {}; + let options = opt || {}; this._packer = new Packer(options); this._deflate = this._packer.createDeflate(); this.readable = true; -}; +}); util.inherits(PackerAsync, Stream); - -PackerAsync.prototype.pack = function(data, width, height, gamma) { +PackerAsync.prototype.pack = function (data, width, height, gamma) { // Signature - this.emit('data', new Buffer(constants.PNG_SIGNATURE)); - this.emit('data', this._packer.packIHDR(width, height)); + this.emit("data", Buffer.from(constants.PNG_SIGNATURE)); + this.emit("data", this._packer.packIHDR(width, height)); if (gamma) { - this.emit('data', this._packer.packGAMA(gamma)); + this.emit("data", this._packer.packGAMA(gamma)); } - var filteredData = this._packer.filterData(data, width, height); + let filteredData = this._packer.filterData(data, width, height); // compress it - this._deflate.on('error', this.emit.bind(this, 'error')); - - this._deflate.on('data', function(compressedData) { - this.emit('data', this._packer.packIDAT(compressedData)); - }.bind(this)); - - this._deflate.on('end', function() { - this.emit('data', this._packer.packIEND()); - this.emit('end'); - }.bind(this)); + this._deflate.on("error", this.emit.bind(this, "error")); + + this._deflate.on( + "data", + function (compressedData) { + this.emit("data", this._packer.packIDAT(compressedData)); + }.bind(this) + ); + + this._deflate.on( + "end", + function () { + this.emit("data", this._packer.packIEND()); + this.emit("end"); + }.bind(this) + ); this._deflate.end(filteredData); }; diff --git a/project starter code/node_modules/pngjs/lib/packer-sync.js b/project starter code/node_modules/pngjs/lib/packer-sync.js index 6129098d..f5ab0b3d 100644 --- a/project starter code/node_modules/pngjs/lib/packer-sync.js +++ b/project starter code/node_modules/pngjs/lib/packer-sync.js @@ -1,27 +1,28 @@ -'use strict'; +"use strict"; -var hasSyncZlib = true; -var zlib = require('zlib'); +let hasSyncZlib = true; +let zlib = require("zlib"); if (!zlib.deflateSync) { hasSyncZlib = false; } -var constants = require('./constants'); -var Packer = require('./packer'); - -module.exports = function(metaData, opt) { +let constants = require("./constants"); +let Packer = require("./packer"); +module.exports = function (metaData, opt) { if (!hasSyncZlib) { - throw new Error('To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0'); + throw new Error( + "To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0" + ); } - var options = opt || {}; + let options = opt || {}; - var packer = new Packer(options); + let packer = new Packer(options); - var chunks = []; + let chunks = []; // Signature - chunks.push(new Buffer(constants.PNG_SIGNATURE)); + chunks.push(Buffer.from(constants.PNG_SIGNATURE)); // Header chunks.push(packer.packIHDR(metaData.width, metaData.height)); @@ -30,14 +31,21 @@ module.exports = function(metaData, opt) { chunks.push(packer.packGAMA(metaData.gamma)); } - var filteredData = packer.filterData(metaData.data, metaData.width, metaData.height); + let filteredData = packer.filterData( + metaData.data, + metaData.width, + metaData.height + ); // compress it - var compressedData = zlib.deflateSync(filteredData, packer.getDeflateOptions()); + let compressedData = zlib.deflateSync( + filteredData, + packer.getDeflateOptions() + ); filteredData = null; if (!compressedData || !compressedData.length) { - throw new Error('bad png - invalid compressed data response'); + throw new Error("bad png - invalid compressed data response"); } chunks.push(packer.packIDAT(compressedData)); diff --git a/project starter code/node_modules/pngjs/lib/packer.js b/project starter code/node_modules/pngjs/lib/packer.js index b3f435d5..4aba12c8 100644 --- a/project starter code/node_modules/pngjs/lib/packer.js +++ b/project starter code/node_modules/pngjs/lib/packer.js @@ -1,71 +1,91 @@ -'use strict'; +"use strict"; -var constants = require('./constants'); -var CrcStream = require('./crc'); -var bitPacker = require('./bitpacker'); -var filter = require('./filter-pack'); -var zlib = require('zlib'); +let constants = require("./constants"); +let CrcStream = require("./crc"); +let bitPacker = require("./bitpacker"); +let filter = require("./filter-pack"); +let zlib = require("zlib"); -var Packer = module.exports = function(options) { +let Packer = (module.exports = function (options) { this._options = options; options.deflateChunkSize = options.deflateChunkSize || 32 * 1024; - options.deflateLevel = options.deflateLevel != null ? options.deflateLevel : 9; - options.deflateStrategy = options.deflateStrategy != null ? options.deflateStrategy : 3; - options.inputHasAlpha = options.inputHasAlpha != null ? options.inputHasAlpha : true; + options.deflateLevel = + options.deflateLevel != null ? options.deflateLevel : 9; + options.deflateStrategy = + options.deflateStrategy != null ? options.deflateStrategy : 3; + options.inputHasAlpha = + options.inputHasAlpha != null ? options.inputHasAlpha : true; options.deflateFactory = options.deflateFactory || zlib.createDeflate; options.bitDepth = options.bitDepth || 8; // This is outputColorType - options.colorType = (typeof options.colorType === 'number') ? options.colorType : constants.COLORTYPE_COLOR_ALPHA; - options.inputColorType = (typeof options.inputColorType === 'number') ? options.inputColorType : constants.COLORTYPE_COLOR_ALPHA; - - if ([ - constants.COLORTYPE_GRAYSCALE, - constants.COLORTYPE_COLOR, - constants.COLORTYPE_COLOR_ALPHA, - constants.COLORTYPE_ALPHA - ].indexOf(options.colorType) === -1) { - throw new Error('option color type:' + options.colorType + ' is not supported at present'); + options.colorType = + typeof options.colorType === "number" + ? options.colorType + : constants.COLORTYPE_COLOR_ALPHA; + options.inputColorType = + typeof options.inputColorType === "number" + ? options.inputColorType + : constants.COLORTYPE_COLOR_ALPHA; + + if ( + [ + constants.COLORTYPE_GRAYSCALE, + constants.COLORTYPE_COLOR, + constants.COLORTYPE_COLOR_ALPHA, + constants.COLORTYPE_ALPHA, + ].indexOf(options.colorType) === -1 + ) { + throw new Error( + "option color type:" + options.colorType + " is not supported at present" + ); } - if ([ - constants.COLORTYPE_GRAYSCALE, - constants.COLORTYPE_COLOR, - constants.COLORTYPE_COLOR_ALPHA, - constants.COLORTYPE_ALPHA - ].indexOf(options.inputColorType) === -1) { - throw new Error('option input color type:' + options.inputColorType + ' is not supported at present'); + if ( + [ + constants.COLORTYPE_GRAYSCALE, + constants.COLORTYPE_COLOR, + constants.COLORTYPE_COLOR_ALPHA, + constants.COLORTYPE_ALPHA, + ].indexOf(options.inputColorType) === -1 + ) { + throw new Error( + "option input color type:" + + options.inputColorType + + " is not supported at present" + ); } if (options.bitDepth !== 8 && options.bitDepth !== 16) { - throw new Error('option bit depth:' + options.bitDepth + ' is not supported at present'); + throw new Error( + "option bit depth:" + options.bitDepth + " is not supported at present" + ); } -}; +}); -Packer.prototype.getDeflateOptions = function() { +Packer.prototype.getDeflateOptions = function () { return { chunkSize: this._options.deflateChunkSize, level: this._options.deflateLevel, - strategy: this._options.deflateStrategy + strategy: this._options.deflateStrategy, }; }; -Packer.prototype.createDeflate = function() { +Packer.prototype.createDeflate = function () { return this._options.deflateFactory(this.getDeflateOptions()); }; -Packer.prototype.filterData = function(data, width, height) { +Packer.prototype.filterData = function (data, width, height) { // convert to correct format for filtering (e.g. right bpp and bit depth) - var packedData = bitPacker(data, width, height, this._options); + let packedData = bitPacker(data, width, height, this._options); // filter pixel data - var bpp = constants.COLORTYPE_TO_BPP_MAP[this._options.colorType]; - var filteredData = filter(packedData, width, height, this._options, bpp); + let bpp = constants.COLORTYPE_TO_BPP_MAP[this._options.colorType]; + let filteredData = filter(packedData, width, height, this._options, bpp); return filteredData; }; -Packer.prototype._packChunk = function(type, data) { - - var len = (data ? data.length : 0); - var buf = new Buffer(len + 12); +Packer.prototype._packChunk = function (type, data) { + let len = data ? data.length : 0; + let buf = Buffer.alloc(len + 12); buf.writeUInt32BE(len, 0); buf.writeUInt32BE(type, 4); @@ -74,19 +94,21 @@ Packer.prototype._packChunk = function(type, data) { data.copy(buf, 8); } - buf.writeInt32BE(CrcStream.crc32(buf.slice(4, buf.length - 4)), buf.length - 4); + buf.writeInt32BE( + CrcStream.crc32(buf.slice(4, buf.length - 4)), + buf.length - 4 + ); return buf; }; -Packer.prototype.packGAMA = function(gamma) { - var buf = new Buffer(4); +Packer.prototype.packGAMA = function (gamma) { + let buf = Buffer.alloc(4); buf.writeUInt32BE(Math.floor(gamma * constants.GAMMA_DIVISION), 0); return this._packChunk(constants.TYPE_gAMA, buf); }; -Packer.prototype.packIHDR = function(width, height) { - - var buf = new Buffer(13); +Packer.prototype.packIHDR = function (width, height) { + let buf = Buffer.alloc(13); buf.writeUInt32BE(width, 0); buf.writeUInt32BE(height, 4); buf[8] = this._options.bitDepth; // Bit depth @@ -98,10 +120,10 @@ Packer.prototype.packIHDR = function(width, height) { return this._packChunk(constants.TYPE_IHDR, buf); }; -Packer.prototype.packIDAT = function(data) { +Packer.prototype.packIDAT = function (data) { return this._packChunk(constants.TYPE_IDAT, data); }; -Packer.prototype.packIEND = function() { +Packer.prototype.packIEND = function () { return this._packChunk(constants.TYPE_IEND, null); }; diff --git a/project starter code/node_modules/pngjs/lib/paeth-predictor.js b/project starter code/node_modules/pngjs/lib/paeth-predictor.js index 97c3adf3..9634497d 100644 --- a/project starter code/node_modules/pngjs/lib/paeth-predictor.js +++ b/project starter code/node_modules/pngjs/lib/paeth-predictor.js @@ -1,11 +1,10 @@ -'use strict'; +"use strict"; module.exports = function paethPredictor(left, above, upLeft) { - - var paeth = left + above - upLeft; - var pLeft = Math.abs(paeth - left); - var pAbove = Math.abs(paeth - above); - var pUpLeft = Math.abs(paeth - upLeft); + let paeth = left + above - upLeft; + let pLeft = Math.abs(paeth - left); + let pAbove = Math.abs(paeth - above); + let pUpLeft = Math.abs(paeth - upLeft); if (pLeft <= pAbove && pLeft <= pUpLeft) { return left; @@ -14,4 +13,4 @@ module.exports = function paethPredictor(left, above, upLeft) { return above; } return upLeft; -}; \ No newline at end of file +}; diff --git a/project starter code/node_modules/pngjs/lib/parser-async.js b/project starter code/node_modules/pngjs/lib/parser-async.js index 9c273536..1aacde34 100644 --- a/project starter code/node_modules/pngjs/lib/parser-async.js +++ b/project starter code/node_modules/pngjs/lib/parser-async.js @@ -1,39 +1,37 @@ -'use strict'; +"use strict"; -var util = require('util'); -var zlib = require('zlib'); -var ChunkStream = require('./chunkstream'); -var FilterAsync = require('./filter-parse-async'); -var Parser = require('./parser'); -var bitmapper = require('./bitmapper'); -var formatNormaliser = require('./format-normaliser'); +let util = require("util"); +let zlib = require("zlib"); +let ChunkStream = require("./chunkstream"); +let FilterAsync = require("./filter-parse-async"); +let Parser = require("./parser"); +let bitmapper = require("./bitmapper"); +let formatNormaliser = require("./format-normaliser"); -var ParserAsync = module.exports = function(options) { +let ParserAsync = (module.exports = function (options) { ChunkStream.call(this); this._parser = new Parser(options, { read: this.read.bind(this), error: this._handleError.bind(this), metadata: this._handleMetaData.bind(this), - gamma: this.emit.bind(this, 'gamma'), + gamma: this.emit.bind(this, "gamma"), palette: this._handlePalette.bind(this), transColor: this._handleTransColor.bind(this), finished: this._finished.bind(this), inflateData: this._inflateData.bind(this), simpleTransparency: this._simpleTransparency.bind(this), - headersFinished: this._headersFinished.bind(this) + headersFinished: this._headersFinished.bind(this), }); this._options = options; this.writable = true; this._parser.start(); -}; +}); util.inherits(ParserAsync, ChunkStream); - -ParserAsync.prototype._handleError = function(err) { - - this.emit('error', err); +ParserAsync.prototype._handleError = function (err) { + this.emit("error", err); this.writable = false; @@ -48,42 +46,47 @@ ParserAsync.prototype._handleError = function(err) { // For backward compatibility with Node 7 and below. // Suppress errors due to _inflate calling write() even after // it's destroy()'ed. - this._filter.on('error', function() {}); + this._filter.on("error", function () {}); } this.errord = true; }; -ParserAsync.prototype._inflateData = function(data) { +ParserAsync.prototype._inflateData = function (data) { if (!this._inflate) { if (this._bitmapInfo.interlace) { this._inflate = zlib.createInflate(); - this._inflate.on('error', this.emit.bind(this, 'error')); - this._filter.on('complete', this._complete.bind(this)); + this._inflate.on("error", this.emit.bind(this, "error")); + this._filter.on("complete", this._complete.bind(this)); this._inflate.pipe(this._filter); - } - else { - var rowSize = ((this._bitmapInfo.width * this._bitmapInfo.bpp * this._bitmapInfo.depth + 7) >> 3) + 1; - var imageSize = rowSize * this._bitmapInfo.height; - var chunkSize = Math.max(imageSize, zlib.Z_MIN_CHUNK); + } else { + let rowSize = + ((this._bitmapInfo.width * + this._bitmapInfo.bpp * + this._bitmapInfo.depth + + 7) >> + 3) + + 1; + let imageSize = rowSize * this._bitmapInfo.height; + let chunkSize = Math.max(imageSize, zlib.Z_MIN_CHUNK); this._inflate = zlib.createInflate({ chunkSize: chunkSize }); - var leftToInflate = imageSize; + let leftToInflate = imageSize; - var emitError = this.emit.bind(this, 'error'); - this._inflate.on('error', function(err) { + let emitError = this.emit.bind(this, "error"); + this._inflate.on("error", function (err) { if (!leftToInflate) { return; } emitError(err); }); - this._filter.on('complete', this._complete.bind(this)); + this._filter.on("complete", this._complete.bind(this)); - var filterWrite = this._filter.write.bind(this._filter); - this._inflate.on('data', function(chunk) { + let filterWrite = this._filter.write.bind(this._filter); + this._inflate.on("data", function (chunk) { if (!leftToInflate) { return; } @@ -97,68 +100,70 @@ ParserAsync.prototype._inflateData = function(data) { filterWrite(chunk); }); - this._inflate.on('end', this._filter.end.bind(this._filter)); + this._inflate.on("end", this._filter.end.bind(this._filter)); } } this._inflate.write(data); }; -ParserAsync.prototype._handleMetaData = function(metaData) { +ParserAsync.prototype._handleMetaData = function (metaData) { this._metaData = metaData; this._bitmapInfo = Object.create(metaData); this._filter = new FilterAsync(this._bitmapInfo); }; -ParserAsync.prototype._handleTransColor = function(transColor) { +ParserAsync.prototype._handleTransColor = function (transColor) { this._bitmapInfo.transColor = transColor; }; -ParserAsync.prototype._handlePalette = function(palette) { +ParserAsync.prototype._handlePalette = function (palette) { this._bitmapInfo.palette = palette; }; -ParserAsync.prototype._simpleTransparency = function() { +ParserAsync.prototype._simpleTransparency = function () { this._metaData.alpha = true; }; -ParserAsync.prototype._headersFinished = function() { +ParserAsync.prototype._headersFinished = function () { // Up until this point, we don't know if we have a tRNS chunk (alpha) // so we can't emit metadata any earlier - this.emit('metadata', this._metaData); + this.emit("metadata", this._metaData); }; -ParserAsync.prototype._finished = function() { +ParserAsync.prototype._finished = function () { if (this.errord) { return; } if (!this._inflate) { - this.emit('error', 'No Inflate block'); - } - else { + this.emit("error", "No Inflate block"); + } else { // no more data to inflate this._inflate.end(); } - this.destroySoon(); }; -ParserAsync.prototype._complete = function(filteredData) { - +ParserAsync.prototype._complete = function (filteredData) { if (this.errord) { return; } + let normalisedBitmapData; + try { - var bitmapData = bitmapper.dataToBitMap(filteredData, this._bitmapInfo); + let bitmapData = bitmapper.dataToBitMap(filteredData, this._bitmapInfo); - var normalisedBitmapData = formatNormaliser(bitmapData, this._bitmapInfo); + normalisedBitmapData = formatNormaliser( + bitmapData, + this._bitmapInfo, + this._options.skipRescale + ); bitmapData = null; - } - catch (ex) { + } catch (ex) { this._handleError(ex); return; } - this.emit('parsed', normalisedBitmapData); + this.emit("parsed", normalisedBitmapData); }; diff --git a/project starter code/node_modules/pngjs/lib/parser-sync.js b/project starter code/node_modules/pngjs/lib/parser-sync.js index ed899a45..76cb134b 100644 --- a/project starter code/node_modules/pngjs/lib/parser-sync.js +++ b/project starter code/node_modules/pngjs/lib/parser-sync.js @@ -1,30 +1,30 @@ -'use strict'; +"use strict"; -var hasSyncZlib = true; -var zlib = require('zlib'); -var inflateSync = require('./sync-inflate'); +let hasSyncZlib = true; +let zlib = require("zlib"); +let inflateSync = require("./sync-inflate"); if (!zlib.deflateSync) { hasSyncZlib = false; } -var SyncReader = require('./sync-reader'); -var FilterSync = require('./filter-parse-sync'); -var Parser = require('./parser'); -var bitmapper = require('./bitmapper'); -var formatNormaliser = require('./format-normaliser'); - - -module.exports = function(buffer, options) { +let SyncReader = require("./sync-reader"); +let FilterSync = require("./filter-parse-sync"); +let Parser = require("./parser"); +let bitmapper = require("./bitmapper"); +let formatNormaliser = require("./format-normaliser"); +module.exports = function (buffer, options) { if (!hasSyncZlib) { - throw new Error('To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0'); + throw new Error( + "To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0" + ); } - var err; + let err; function handleError(_err_) { err = _err_; } - var metaData; + let metaData; function handleMetaData(_metaData_) { metaData = _metaData_; } @@ -41,19 +41,19 @@ module.exports = function(buffer, options) { metaData.alpha = true; } - var gamma; + let gamma; function handleGamma(_gamma_) { gamma = _gamma_; } - var inflateDataList = []; + let inflateDataList = []; function handleInflateData(inflatedData) { inflateDataList.push(inflatedData); } - var reader = new SyncReader(buffer); + let reader = new SyncReader(buffer); - var parser = new Parser(options, { + let parser = new Parser(options, { read: reader.read.bind(reader), error: handleError, metadata: handleMetaData, @@ -61,7 +61,7 @@ module.exports = function(buffer, options) { palette: handlePalette, transColor: handleTransColor, inflateData: handleInflateData, - simpleTransparency: handleSimpleTransparency + simpleTransparency: handleSimpleTransparency, }); parser.start(); @@ -72,31 +72,38 @@ module.exports = function(buffer, options) { } //join together the inflate datas - var inflateData = Buffer.concat(inflateDataList); + let inflateData = Buffer.concat(inflateDataList); inflateDataList.length = 0; - var inflatedData; + let inflatedData; if (metaData.interlace) { inflatedData = zlib.inflateSync(inflateData); - } - else { - var rowSize = ((metaData.width * metaData.bpp * metaData.depth + 7) >> 3) + 1; - var imageSize = rowSize * metaData.height; - inflatedData = inflateSync(inflateData, { chunkSize: imageSize, maxLength: imageSize }); + } else { + let rowSize = + ((metaData.width * metaData.bpp * metaData.depth + 7) >> 3) + 1; + let imageSize = rowSize * metaData.height; + inflatedData = inflateSync(inflateData, { + chunkSize: imageSize, + maxLength: imageSize, + }); } inflateData = null; if (!inflatedData || !inflatedData.length) { - throw new Error('bad png - invalid inflate data response'); + throw new Error("bad png - invalid inflate data response"); } - var unfilteredData = FilterSync.process(inflatedData, metaData); + let unfilteredData = FilterSync.process(inflatedData, metaData); inflateData = null; - var bitmapData = bitmapper.dataToBitMap(unfilteredData, metaData); + let bitmapData = bitmapper.dataToBitMap(unfilteredData, metaData); unfilteredData = null; - var normalisedBitmapData = formatNormaliser(bitmapData, metaData); + let normalisedBitmapData = formatNormaliser( + bitmapData, + metaData, + options.skipRescale + ); metaData.data = normalisedBitmapData; metaData.gamma = gamma || 0; diff --git a/project starter code/node_modules/pngjs/lib/parser.js b/project starter code/node_modules/pngjs/lib/parser.js index 9724443b..51a8f2a5 100644 --- a/project starter code/node_modules/pngjs/lib/parser.js +++ b/project starter code/node_modules/pngjs/lib/parser.js @@ -1,11 +1,9 @@ -'use strict'; +"use strict"; -var constants = require('./constants'); -var CrcCalculator = require('./crc'); - - -var Parser = module.exports = function(options, dependencies) { +let constants = require("./constants"); +let CrcCalculator = require("./crc"); +let Parser = (module.exports = function (options, dependencies) { this._options = options; options.checkCRC = options.checkCRC !== false; @@ -35,83 +33,78 @@ var Parser = module.exports = function(options, dependencies) { this.inflateData = dependencies.inflateData; this.finished = dependencies.finished; this.simpleTransparency = dependencies.simpleTransparency; - this.headersFinished = dependencies.headersFinished || function() {}; -}; + this.headersFinished = dependencies.headersFinished || function () {}; +}); -Parser.prototype.start = function() { - this.read(constants.PNG_SIGNATURE.length, - this._parseSignature.bind(this) - ); +Parser.prototype.start = function () { + this.read(constants.PNG_SIGNATURE.length, this._parseSignature.bind(this)); }; -Parser.prototype._parseSignature = function(data) { - - var signature = constants.PNG_SIGNATURE; +Parser.prototype._parseSignature = function (data) { + let signature = constants.PNG_SIGNATURE; - for (var i = 0; i < signature.length; i++) { + for (let i = 0; i < signature.length; i++) { if (data[i] !== signature[i]) { - this.error(new Error('Invalid file signature')); + this.error(new Error("Invalid file signature")); return; } } this.read(8, this._parseChunkBegin.bind(this)); }; -Parser.prototype._parseChunkBegin = function(data) { - +Parser.prototype._parseChunkBegin = function (data) { // chunk content length - var length = data.readUInt32BE(0); + let length = data.readUInt32BE(0); // chunk type - var type = data.readUInt32BE(4); - var name = ''; - for (var i = 4; i < 8; i++) { + let type = data.readUInt32BE(4); + let name = ""; + for (let i = 4; i < 8; i++) { name += String.fromCharCode(data[i]); } //console.log('chunk ', name, length); // chunk flags - var ancillary = Boolean(data[4] & 0x20); // or critical + let ancillary = Boolean(data[4] & 0x20); // or critical // priv = Boolean(data[5] & 0x20), // or public // safeToCopy = Boolean(data[7] & 0x20); // or unsafe if (!this._hasIHDR && type !== constants.TYPE_IHDR) { - this.error(new Error('Expected IHDR on beggining')); + this.error(new Error("Expected IHDR on beggining")); return; } this._crc = new CrcCalculator(); - this._crc.write(new Buffer(name)); + this._crc.write(Buffer.from(name)); if (this._chunks[type]) { return this._chunks[type](length); } if (!ancillary) { - this.error(new Error('Unsupported critical chunk type ' + name)); + this.error(new Error("Unsupported critical chunk type " + name)); return; } this.read(length + 4, this._skipChunk.bind(this)); }; -Parser.prototype._skipChunk = function(/*data*/) { +Parser.prototype._skipChunk = function (/*data*/) { this.read(8, this._parseChunkBegin.bind(this)); }; -Parser.prototype._handleChunkEnd = function() { +Parser.prototype._handleChunkEnd = function () { this.read(4, this._parseChunkEnd.bind(this)); }; -Parser.prototype._parseChunkEnd = function(data) { - - var fileCrc = data.readInt32BE(0); - var calcCrc = this._crc.crc32(); +Parser.prototype._parseChunkEnd = function (data) { + let fileCrc = data.readInt32BE(0); + let calcCrc = this._crc.crc32(); // check CRC if (this._options.checkCRC && calcCrc !== fileCrc) { - this.error(new Error('Crc error - ' + fileCrc + ' - ' + calcCrc)); + this.error(new Error("Crc error - " + fileCrc + " - " + calcCrc)); return; } @@ -120,50 +113,55 @@ Parser.prototype._parseChunkEnd = function(data) { } }; -Parser.prototype._handleIHDR = function(length) { +Parser.prototype._handleIHDR = function (length) { this.read(length, this._parseIHDR.bind(this)); }; -Parser.prototype._parseIHDR = function(data) { - +Parser.prototype._parseIHDR = function (data) { this._crc.write(data); - var width = data.readUInt32BE(0); - var height = data.readUInt32BE(4); - var depth = data[8]; - var colorType = data[9]; // bits: 1 palette, 2 color, 4 alpha - var compr = data[10]; - var filter = data[11]; - var interlace = data[12]; + let width = data.readUInt32BE(0); + let height = data.readUInt32BE(4); + let depth = data[8]; + let colorType = data[9]; // bits: 1 palette, 2 color, 4 alpha + let compr = data[10]; + let filter = data[11]; + let interlace = data[12]; // console.log(' width', width, 'height', height, // 'depth', depth, 'colorType', colorType, // 'compr', compr, 'filter', filter, 'interlace', interlace // ); - if (depth !== 8 && depth !== 4 && depth !== 2 && depth !== 1 && depth !== 16) { - this.error(new Error('Unsupported bit depth ' + depth)); + if ( + depth !== 8 && + depth !== 4 && + depth !== 2 && + depth !== 1 && + depth !== 16 + ) { + this.error(new Error("Unsupported bit depth " + depth)); return; } if (!(colorType in constants.COLORTYPE_TO_BPP_MAP)) { - this.error(new Error('Unsupported color type')); + this.error(new Error("Unsupported color type")); return; } if (compr !== 0) { - this.error(new Error('Unsupported compression method')); + this.error(new Error("Unsupported compression method")); return; } if (filter !== 0) { - this.error(new Error('Unsupported filter method')); + this.error(new Error("Unsupported filter method")); return; } if (interlace !== 0 && interlace !== 1) { - this.error(new Error('Unsupported interlace method')); + this.error(new Error("Unsupported interlace method")); return; } this._colorType = colorType; - var bpp = constants.COLORTYPE_TO_BPP_MAP[this._colorType]; + let bpp = constants.COLORTYPE_TO_BPP_MAP[this._colorType]; this._hasIHDR = true; @@ -176,30 +174,23 @@ Parser.prototype._parseIHDR = function(data) { color: Boolean(colorType & constants.COLORTYPE_COLOR), alpha: Boolean(colorType & constants.COLORTYPE_ALPHA), bpp: bpp, - colorType: colorType + colorType: colorType, }); this._handleChunkEnd(); }; - -Parser.prototype._handlePLTE = function(length) { +Parser.prototype._handlePLTE = function (length) { this.read(length, this._parsePLTE.bind(this)); }; -Parser.prototype._parsePLTE = function(data) { - +Parser.prototype._parsePLTE = function (data) { this._crc.write(data); - var entries = Math.floor(data.length / 3); + let entries = Math.floor(data.length / 3); // console.log('Palette:', entries); - for (var i = 0; i < entries; i++) { - this._palette.push([ - data[i * 3], - data[i * 3 + 1], - data[i * 3 + 2], - 0xff - ]); + for (let i = 0; i < entries; i++) { + this._palette.push([data[i * 3], data[i * 3 + 1], data[i * 3 + 2], 0xff]); } this.palette(this._palette); @@ -207,25 +198,24 @@ Parser.prototype._parsePLTE = function(data) { this._handleChunkEnd(); }; -Parser.prototype._handleTRNS = function(length) { +Parser.prototype._handleTRNS = function (length) { this.simpleTransparency(); this.read(length, this._parseTRNS.bind(this)); }; -Parser.prototype._parseTRNS = function(data) { - +Parser.prototype._parseTRNS = function (data) { this._crc.write(data); // palette if (this._colorType === constants.COLORTYPE_PALETTE_COLOR) { if (this._palette.length === 0) { - this.error(new Error('Transparency chunk must be after palette')); + this.error(new Error("Transparency chunk must be after palette")); return; } if (data.length > this._palette.length) { - this.error(new Error('More transparent colors than palette size')); + this.error(new Error("More transparent colors than palette size")); return; } - for (var i = 0; i < data.length; i++) { + for (let i = 0; i < data.length; i++) { this._palette[i][3] = data[i]; } this.palette(this._palette); @@ -238,54 +228,57 @@ Parser.prototype._parseTRNS = function(data) { this.transColor([data.readUInt16BE(0)]); } if (this._colorType === constants.COLORTYPE_COLOR) { - this.transColor([data.readUInt16BE(0), data.readUInt16BE(2), data.readUInt16BE(4)]); + this.transColor([ + data.readUInt16BE(0), + data.readUInt16BE(2), + data.readUInt16BE(4), + ]); } this._handleChunkEnd(); }; -Parser.prototype._handleGAMA = function(length) { +Parser.prototype._handleGAMA = function (length) { this.read(length, this._parseGAMA.bind(this)); }; -Parser.prototype._parseGAMA = function(data) { - +Parser.prototype._parseGAMA = function (data) { this._crc.write(data); this.gamma(data.readUInt32BE(0) / constants.GAMMA_DIVISION); this._handleChunkEnd(); }; -Parser.prototype._handleIDAT = function(length) { +Parser.prototype._handleIDAT = function (length) { if (!this._emittedHeadersFinished) { this._emittedHeadersFinished = true; this.headersFinished(); } this.read(-length, this._parseIDAT.bind(this, length)); }; -Parser.prototype._parseIDAT = function(length, data) { - +Parser.prototype._parseIDAT = function (length, data) { this._crc.write(data); - if (this._colorType === constants.COLORTYPE_PALETTE_COLOR && this._palette.length === 0) { - throw new Error('Expected palette not found'); + if ( + this._colorType === constants.COLORTYPE_PALETTE_COLOR && + this._palette.length === 0 + ) { + throw new Error("Expected palette not found"); } this.inflateData(data); - var leftOverLength = length - data.length; + let leftOverLength = length - data.length; if (leftOverLength > 0) { this._handleIDAT(leftOverLength); - } - else { + } else { this._handleChunkEnd(); } }; -Parser.prototype._handleIEND = function(length) { +Parser.prototype._handleIEND = function (length) { this.read(length, this._parseIEND.bind(this)); }; -Parser.prototype._parseIEND = function(data) { - +Parser.prototype._parseIEND = function (data) { this._crc.write(data); this._hasIEND = true; diff --git a/project starter code/node_modules/pngjs/lib/png-sync.js b/project starter code/node_modules/pngjs/lib/png-sync.js index 81d04a46..68cac9bc 100644 --- a/project starter code/node_modules/pngjs/lib/png-sync.js +++ b/project starter code/node_modules/pngjs/lib/png-sync.js @@ -1,16 +1,12 @@ -'use strict'; +"use strict"; +let parse = require("./parser-sync"); +let pack = require("./packer-sync"); -var parse = require('./parser-sync'); -var pack = require('./packer-sync'); - - -exports.read = function(buffer, options) { - +exports.read = function (buffer, options) { return parse(buffer, options || {}); }; -exports.write = function(png, options) { - +exports.write = function (png, options) { return pack(png, options); }; diff --git a/project starter code/node_modules/pngjs/lib/png.js b/project starter code/node_modules/pngjs/lib/png.js index 1e407a77..0b8af3f7 100644 --- a/project starter code/node_modules/pngjs/lib/png.js +++ b/project starter code/node_modules/pngjs/lib/png.js @@ -1,13 +1,12 @@ -'use strict'; +"use strict"; -var util = require('util'); -var Stream = require('stream'); -var Parser = require('./parser-async'); -var Packer = require('./packer-async'); -var PNGSync = require('./png-sync'); +let util = require("util"); +let Stream = require("stream"); +let Parser = require("./parser-async"); +let Packer = require("./packer-async"); +let PNGSync = require("./png-sync"); - -var PNG = exports.PNG = function(options) { +let PNG = (exports.PNG = function (options) { Stream.call(this); options = options || {}; // eslint-disable-line no-param-reassign @@ -16,8 +15,10 @@ var PNG = exports.PNG = function(options) { this.width = options.width | 0; this.height = options.height | 0; - this.data = this.width > 0 && this.height > 0 ? - new Buffer(4 * this.width * this.height) : null; + this.data = + this.width > 0 && this.height > 0 + ? Buffer.alloc(4 * this.width * this.height) + : null; if (options.fill && this.data) { this.data.fill(0); @@ -28,95 +29,96 @@ var PNG = exports.PNG = function(options) { this._parser = new Parser(options); - this._parser.on('error', this.emit.bind(this, 'error')); - this._parser.on('close', this._handleClose.bind(this)); - this._parser.on('metadata', this._metadata.bind(this)); - this._parser.on('gamma', this._gamma.bind(this)); - this._parser.on('parsed', function(data) { - this.data = data; - this.emit('parsed', data); - }.bind(this)); + this._parser.on("error", this.emit.bind(this, "error")); + this._parser.on("close", this._handleClose.bind(this)); + this._parser.on("metadata", this._metadata.bind(this)); + this._parser.on("gamma", this._gamma.bind(this)); + this._parser.on( + "parsed", + function (data) { + this.data = data; + this.emit("parsed", data); + }.bind(this) + ); this._packer = new Packer(options); - this._packer.on('data', this.emit.bind(this, 'data')); - this._packer.on('end', this.emit.bind(this, 'end')); - this._parser.on('close', this._handleClose.bind(this)); - this._packer.on('error', this.emit.bind(this, 'error')); - -}; + this._packer.on("data", this.emit.bind(this, "data")); + this._packer.on("end", this.emit.bind(this, "end")); + this._parser.on("close", this._handleClose.bind(this)); + this._packer.on("error", this.emit.bind(this, "error")); +}); util.inherits(PNG, Stream); PNG.sync = PNGSync; -PNG.prototype.pack = function() { - +PNG.prototype.pack = function () { if (!this.data || !this.data.length) { - this.emit('error', 'No data provided'); + this.emit("error", "No data provided"); return this; } - process.nextTick(function() { - this._packer.pack(this.data, this.width, this.height, this.gamma); - }.bind(this)); + process.nextTick( + function () { + this._packer.pack(this.data, this.width, this.height, this.gamma); + }.bind(this) + ); return this; }; - -PNG.prototype.parse = function(data, callback) { - +PNG.prototype.parse = function (data, callback) { if (callback) { - var onParsed, onError; + let onParsed, onError; - onParsed = function(parsedData) { - this.removeListener('error', onError); + onParsed = function (parsedData) { + this.removeListener("error", onError); this.data = parsedData; callback(null, this); }.bind(this); - onError = function(err) { - this.removeListener('parsed', onParsed); + onError = function (err) { + this.removeListener("parsed", onParsed); callback(err, null); }.bind(this); - this.once('parsed', onParsed); - this.once('error', onError); + this.once("parsed", onParsed); + this.once("error", onError); } this.end(data); return this; }; -PNG.prototype.write = function(data) { +PNG.prototype.write = function (data) { this._parser.write(data); return true; }; -PNG.prototype.end = function(data) { +PNG.prototype.end = function (data) { this._parser.end(data); }; -PNG.prototype._metadata = function(metadata) { +PNG.prototype._metadata = function (metadata) { this.width = metadata.width; this.height = metadata.height; - this.emit('metadata', metadata); + this.emit("metadata", metadata); }; -PNG.prototype._gamma = function(gamma) { +PNG.prototype._gamma = function (gamma) { this.gamma = gamma; }; -PNG.prototype._handleClose = function() { +PNG.prototype._handleClose = function () { if (!this._parser.writable && !this._packer.readable) { - this.emit('close'); + this.emit("close"); } }; - -PNG.bitblt = function(src, dst, srcX, srcY, width, height, deltaX, deltaY) { // eslint-disable-line max-params +PNG.bitblt = function (src, dst, srcX, srcY, width, height, deltaX, deltaY) { + // eslint-disable-line max-params // coerce pixel dimensions to integers (also coerces undefined -> 0): /* eslint-disable no-param-reassign */ srcX |= 0; @@ -127,16 +129,27 @@ PNG.bitblt = function(src, dst, srcX, srcY, width, height, deltaX, deltaY) { // deltaY |= 0; /* eslint-enable no-param-reassign */ - if (srcX > src.width || srcY > src.height || srcX + width > src.width || srcY + height > src.height) { - throw new Error('bitblt reading outside image'); + if ( + srcX > src.width || + srcY > src.height || + srcX + width > src.width || + srcY + height > src.height + ) { + throw new Error("bitblt reading outside image"); } - if (deltaX > dst.width || deltaY > dst.height || deltaX + width > dst.width || deltaY + height > dst.height) { - throw new Error('bitblt writing outside image'); + if ( + deltaX > dst.width || + deltaY > dst.height || + deltaX + width > dst.width || + deltaY + height > dst.height + ) { + throw new Error("bitblt writing outside image"); } - for (var y = 0; y < height; y++) { - src.data.copy(dst.data, + for (let y = 0; y < height; y++) { + src.data.copy( + dst.data, ((deltaY + y) * dst.width + deltaX) << 2, ((srcY + y) * src.width + srcX) << 2, ((srcY + y) * src.width + srcX + width) << 2 @@ -144,21 +157,29 @@ PNG.bitblt = function(src, dst, srcX, srcY, width, height, deltaX, deltaY) { // } }; - -PNG.prototype.bitblt = function(dst, srcX, srcY, width, height, deltaX, deltaY) { // eslint-disable-line max-params +PNG.prototype.bitblt = function ( + dst, + srcX, + srcY, + width, + height, + deltaX, + deltaY +) { + // eslint-disable-line max-params PNG.bitblt(this, dst, srcX, srcY, width, height, deltaX, deltaY); return this; }; -PNG.adjustGamma = function(src) { +PNG.adjustGamma = function (src) { if (src.gamma) { - for (var y = 0; y < src.height; y++) { - for (var x = 0; x < src.width; x++) { - var idx = (src.width * y + x) << 2; + for (let y = 0; y < src.height; y++) { + for (let x = 0; x < src.width; x++) { + let idx = (src.width * y + x) << 2; - for (var i = 0; i < 3; i++) { - var sample = src.data[idx + i] / 255; + for (let i = 0; i < 3; i++) { + let sample = src.data[idx + i] / 255; sample = Math.pow(sample, 1 / 2.2 / src.gamma); src.data[idx + i] = Math.round(sample * 255); } @@ -168,6 +189,6 @@ PNG.adjustGamma = function(src) { } }; -PNG.prototype.adjustGamma = function() { +PNG.prototype.adjustGamma = function () { PNG.adjustGamma(this); }; diff --git a/project starter code/node_modules/pngjs/lib/sync-inflate.js b/project starter code/node_modules/pngjs/lib/sync-inflate.js index 87c19a1d..4da0d5f0 100644 --- a/project starter code/node_modules/pngjs/lib/sync-inflate.js +++ b/project starter code/node_modules/pngjs/lib/sync-inflate.js @@ -1,10 +1,10 @@ -'use strict'; +"use strict"; -var assert = require('assert').ok; -var zlib = require('zlib'); -var util = require('util'); +let assert = require("assert").ok; +let zlib = require("zlib"); +let util = require("util"); -var kMaxLength = require('buffer').kMaxLength; +let kMaxLength = require("buffer").kMaxLength; function Inflate(opts) { if (!(this instanceof Inflate)) { @@ -44,23 +44,23 @@ function _close(engine, callback) { engine._handle = null; } -Inflate.prototype._processChunk = function(chunk, flushFlag, asyncCb) { - if (typeof asyncCb === 'function') { +Inflate.prototype._processChunk = function (chunk, flushFlag, asyncCb) { + if (typeof asyncCb === "function") { return zlib.Inflate._processChunk.call(this, chunk, flushFlag, asyncCb); } - var self = this; + let self = this; - var availInBefore = chunk && chunk.length; - var availOutBefore = this._chunkSize - this._offset; - var leftToInflate = this._maxLength; - var inOff = 0; + let availInBefore = chunk && chunk.length; + let availOutBefore = this._chunkSize - this._offset; + let leftToInflate = this._maxLength; + let inOff = 0; - var buffers = []; - var nread = 0; + let buffers = []; + let nread = 0; - var error; - this.on('error', function(err) { + let error; + this.on("error", function (err) { error = err; }); @@ -69,11 +69,11 @@ Inflate.prototype._processChunk = function(chunk, flushFlag, asyncCb) { return; } - var have = availOutBefore - availOutAfter; - assert(have >= 0, 'have should not go down'); + let have = availOutBefore - availOutAfter; + assert(have >= 0, "have should not go down"); if (have > 0) { - var out = self._buffer.slice(self._offset, self._offset + have); + let out = self._buffer.slice(self._offset, self._offset + have); self._offset += have; if (out.length > leftToInflate) { @@ -96,7 +96,7 @@ Inflate.prototype._processChunk = function(chunk, flushFlag, asyncCb) { } if (availOutAfter === 0) { - inOff += (availInBefore - availInAfter); + inOff += availInBefore - availInAfter; availInBefore = availInAfter; return true; @@ -105,15 +105,18 @@ Inflate.prototype._processChunk = function(chunk, flushFlag, asyncCb) { return false; } - assert(this._handle, 'zlib binding closed'); + assert(this._handle, "zlib binding closed"); + let res; do { - var res = this._handle.writeSync(flushFlag, + res = this._handle.writeSync( + flushFlag, chunk, // in inOff, // in_off availInBefore, // in_len this._buffer, // out this._offset, //out_off - availOutBefore); // out_len + availOutBefore + ); // out_len // Node 8 --> 9 compatibility check res = res || this._writeState; } while (!this._hadError && handleChunk(res[0], res[1])); @@ -124,10 +127,14 @@ Inflate.prototype._processChunk = function(chunk, flushFlag, asyncCb) { if (nread >= kMaxLength) { _close(this); - throw new RangeError('Cannot create final Buffer. It would be larger than 0x' + kMaxLength.toString(16) + ' bytes'); + throw new RangeError( + "Cannot create final Buffer. It would be larger than 0x" + + kMaxLength.toString(16) + + " bytes" + ); } - var buf = Buffer.concat(buffers, nread); + let buf = Buffer.concat(buffers, nread); _close(this); return buf; @@ -136,14 +143,14 @@ Inflate.prototype._processChunk = function(chunk, flushFlag, asyncCb) { util.inherits(Inflate, zlib.Inflate); function zlibBufferSync(engine, buffer) { - if (typeof buffer === 'string') { + if (typeof buffer === "string") { buffer = Buffer.from(buffer); } if (!(buffer instanceof Buffer)) { - throw new TypeError('Not a string or buffer'); + throw new TypeError("Not a string or buffer"); } - var flushFlag = engine._finishFlushFlag; + let flushFlag = engine._finishFlushFlag; if (flushFlag == null) { flushFlag = zlib.Z_FINISH; } diff --git a/project starter code/node_modules/pngjs/lib/sync-reader.js b/project starter code/node_modules/pngjs/lib/sync-reader.js index 70ee2db0..213d1a75 100644 --- a/project starter code/node_modules/pngjs/lib/sync-reader.js +++ b/project starter code/node_modules/pngjs/lib/sync-reader.js @@ -1,51 +1,45 @@ -'use strict'; - -var SyncReader = module.exports = function(buffer) { +"use strict"; +let SyncReader = (module.exports = function (buffer) { this._buffer = buffer; this._reads = []; -}; - -SyncReader.prototype.read = function(length, callback) { +}); +SyncReader.prototype.read = function (length, callback) { this._reads.push({ length: Math.abs(length), // if length < 0 then at most this length allowLess: length < 0, - func: callback + func: callback, }); }; -SyncReader.prototype.process = function() { - +SyncReader.prototype.process = function () { // as long as there is any data and read requests while (this._reads.length > 0 && this._buffer.length) { + let read = this._reads[0]; - var read = this._reads[0]; - - if (this._buffer.length && (this._buffer.length >= read.length || read.allowLess)) { - + if ( + this._buffer.length && + (this._buffer.length >= read.length || read.allowLess) + ) { // ok there is any data so that we can satisfy this request this._reads.shift(); // == read - var buf = this._buffer; + let buf = this._buffer; this._buffer = buf.slice(read.length); read.func.call(this, buf.slice(0, read.length)); - - } - else { + } else { break; } - } if (this._reads.length > 0) { - return new Error('There are some read requests waitng on finished stream'); + throw new Error("There are some read requests waitng on finished stream"); } if (this._buffer.length > 0) { - return new Error('unrecognised content at end of stream'); + throw new Error("unrecognised content at end of stream"); } - }; diff --git a/project starter code/node_modules/pngjs/package.json b/project starter code/node_modules/pngjs/package.json index 998c9d60..c75142e2 100644 --- a/project starter code/node_modules/pngjs/package.json +++ b/project starter code/node_modules/pngjs/package.json @@ -1,6 +1,6 @@ { "name": "pngjs", - "version": "3.4.0", + "version": "6.0.0", "description": "PNG encoder/decoder in pure JS, supporting any bit size & interlace, async & sync with full test suite.", "contributors": [ "Alexandre Paré", @@ -30,7 +30,7 @@ "pngjs" ], "engines": { - "node": ">=4.0.0" + "node": ">=12.13.0" }, "main": "./lib/png.js", "directories": { @@ -38,33 +38,40 @@ "example": "examples", "test": "test" }, + "files": [ + "browser.js", + "lib/" + ], "scripts": { - "build": "npm run prepublish", - "prepublish": "npm run browserify", + "build": "yarn prepublish", + "prepublish": "yarn browserify", "browserify": "browserify lib/png.js --standalone png > browser.js", - "coverage": "istanbul -- cover node_modules/tape/bin/tape test/*-spec.js nolarge", - "coverage-report": "npm run coverage && istanbul report html", - "coveralls": "cat ./coverage/lcov.info | coveralls", - "test": "npm run lint && tape test/*-spec.js | tap-dot && node test/run-compare", - "lint": "eslint lib" + "coverage": "nyc --reporter=lcov --reporter=text-summary tape test/*-spec.js nolarge", + "test": "yarn lint && yarn prettier:check && tape test/*-spec.js | tap-dot && node test/run-compare", + "lint": "eslint .", + "prettier:write": "prettier --write .", + "prettier:check": "prettier --check ." }, "repository": { "type": "git", - "url": "git://github.com/lukeapage/pngjs2.git" + "url": "git://github.com/lukeapage/pngjs.git" }, "license": "MIT", "bugs": { - "url": "https://github.com/lukeapage/pngjs2/issues" + "url": "https://github.com/lukeapage/pngjs/issues" }, "devDependencies": { - "browserify": "^14.5.0", + "browserify": "17.0.0", "buffer-equal": "1.0.0", - "connect": "^3.4.0", - "eslint": "^4.1.0", - "istanbul": "^0.4.4", - "phantomjs-prebuilt": "^2.1.7", - "serve-static": "^1.10.0", - "tap-dot": "^2.0.0", - "tape": "^4.0.2" + "codecov": "3.7.1", + "connect": "3.7.0", + "eslint": "7.8.1", + "eslint-config-prettier": "6.14.0", + "nyc": "15.1.0", + "prettier": "2.1.1", + "puppeteer": "5.4.0", + "serve-static": "1.14.1", + "tap-dot": "2.0.0", + "tape": "5.0.1" } } diff --git a/project starter code/node_modules/proxy-from-env/.eslintrc b/project starter code/node_modules/proxy-from-env/.eslintrc new file mode 100644 index 00000000..a51449b2 --- /dev/null +++ b/project starter code/node_modules/proxy-from-env/.eslintrc @@ -0,0 +1,29 @@ +{ + "env": { + "node": true + }, + "rules": { + "array-bracket-spacing": [2, "never"], + "block-scoped-var": 2, + "brace-style": [2, "1tbs"], + "camelcase": 1, + "computed-property-spacing": [2, "never"], + "curly": 2, + "eol-last": 2, + "eqeqeq": [2, "smart"], + "max-depth": [1, 3], + "max-len": [1, 80], + "max-statements": [1, 15], + "new-cap": 1, + "no-extend-native": 2, + "no-mixed-spaces-and-tabs": 2, + "no-trailing-spaces": 2, + "no-unused-vars": 1, + "no-use-before-define": [2, "nofunc"], + "object-curly-spacing": [2, "never"], + "quotes": [2, "single", "avoid-escape"], + "semi": [2, "always"], + "keyword-spacing": [2, {"before": true, "after": true}], + "space-unary-ops": 2 + } +} diff --git a/project starter code/node_modules/proxy-from-env/.travis.yml b/project starter code/node_modules/proxy-from-env/.travis.yml new file mode 100644 index 00000000..64a05f94 --- /dev/null +++ b/project starter code/node_modules/proxy-from-env/.travis.yml @@ -0,0 +1,10 @@ +language: node_js +node_js: + - node + - lts/* +script: + - npm run lint + # test-coverage will also run the tests, but does not print helpful output upon test failure. + # So we also run the tests separately. + - npm run test + - npm run test-coverage && cat coverage/lcov.info | ./node_modules/.bin/coveralls && rm -rf coverage diff --git a/project starter code/node_modules/proxy-from-env/LICENSE b/project starter code/node_modules/proxy-from-env/LICENSE new file mode 100644 index 00000000..8f25097d --- /dev/null +++ b/project starter code/node_modules/proxy-from-env/LICENSE @@ -0,0 +1,20 @@ +The MIT License + +Copyright (C) 2016-2018 Rob Wu + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/project starter code/node_modules/proxy-from-env/README.md b/project starter code/node_modules/proxy-from-env/README.md new file mode 100644 index 00000000..e82520c1 --- /dev/null +++ b/project starter code/node_modules/proxy-from-env/README.md @@ -0,0 +1,131 @@ +# proxy-from-env + +[![Build Status](https://travis-ci.org/Rob--W/proxy-from-env.svg?branch=master)](https://travis-ci.org/Rob--W/proxy-from-env) +[![Coverage Status](https://coveralls.io/repos/github/Rob--W/proxy-from-env/badge.svg?branch=master)](https://coveralls.io/github/Rob--W/proxy-from-env?branch=master) + +`proxy-from-env` is a Node.js package that exports a function (`getProxyForUrl`) +that takes an input URL (a string or +[`url.parse`](https://nodejs.org/docs/latest/api/url.html#url_url_parsing)'s +return value) and returns the desired proxy URL (also a string) based on +standard proxy environment variables. If no proxy is set, an empty string is +returned. + +It is your responsibility to actually proxy the request using the given URL. + +Installation: + +```sh +npm install proxy-from-env +``` + +## Example +This example shows how the data for a URL can be fetched via the +[`http` module](https://nodejs.org/api/http.html), in a proxy-aware way. + +```javascript +var http = require('http'); +var parseUrl = require('url').parse; +var getProxyForUrl = require('proxy-from-env').getProxyForUrl; + +var some_url = 'http://example.com/something'; + +// // Example, if there is a proxy server at 10.0.0.1:1234, then setting the +// // http_proxy environment variable causes the request to go through a proxy. +// process.env.http_proxy = 'http://10.0.0.1:1234'; +// +// // But if the host to be proxied is listed in NO_PROXY, then the request is +// // not proxied (but a direct request is made). +// process.env.no_proxy = 'example.com'; + +var proxy_url = getProxyForUrl(some_url); // <-- Our magic. +if (proxy_url) { + // Should be proxied through proxy_url. + var parsed_some_url = parseUrl(some_url); + var parsed_proxy_url = parseUrl(proxy_url); + // A HTTP proxy is quite simple. It is similar to a normal request, except the + // path is an absolute URL, and the proxied URL's host is put in the header + // instead of the server's actual host. + httpOptions = { + protocol: parsed_proxy_url.protocol, + hostname: parsed_proxy_url.hostname, + port: parsed_proxy_url.port, + path: parsed_some_url.href, + headers: { + Host: parsed_some_url.host, // = host name + optional port. + }, + }; +} else { + // Direct request. + httpOptions = some_url; +} +http.get(httpOptions, function(res) { + var responses = []; + res.on('data', function(chunk) { responses.push(chunk); }); + res.on('end', function() { console.log(responses.join('')); }); +}); + +``` + +## Environment variables +The environment variables can be specified in lowercase or uppercase, with the +lowercase name having precedence over the uppercase variant. A variable that is +not set has the same meaning as a variable that is set but has no value. + +### NO\_PROXY + +`NO_PROXY` is a list of host names (optionally with a port). If the input URL +matches any of the entries in `NO_PROXY`, then the input URL should be fetched +by a direct request (i.e. without a proxy). + +Matching follows the following rules: + +- `NO_PROXY=*` disables all proxies. +- Space and commas may be used to separate the entries in the `NO_PROXY` list. +- If `NO_PROXY` does not contain any entries, then proxies are never disabled. +- If a port is added after the host name, then the ports must match. If the URL + does not have an explicit port name, the protocol's default port is used. +- Generally, the proxy is only disabled if the host name is an exact match for + an entry in the `NO_PROXY` list. The only exceptions are entries that start + with a dot or with a wildcard; then the proxy is disabled if the host name + ends with the entry. + +See `test.js` for examples of what should match and what does not. + +### \*\_PROXY + +The environment variable used for the proxy depends on the protocol of the URL. +For example, `https://example.com` uses the "https" protocol, and therefore the +proxy to be used is `HTTPS_PROXY` (_NOT_ `HTTP_PROXY`, which is _only_ used for +http:-URLs). + +The library is not limited to http(s), other schemes such as +`FTP_PROXY` (ftp:), +`WSS_PROXY` (wss:), +`WS_PROXY` (ws:) +are also supported. + +If present, `ALL_PROXY` is used as fallback if there is no other match. + + +## External resources +The exact way of parsing the environment variables is not codified in any +standard. This library is designed to be compatible with formats as expected by +existing software. +The following resources were used to determine the desired behavior: + +- cURL: + https://curl.haxx.se/docs/manpage.html#ENVIRONMENT + https://github.com/curl/curl/blob/4af40b3646d3b09f68e419f7ca866ff395d1f897/lib/url.c#L4446-L4514 + https://github.com/curl/curl/blob/4af40b3646d3b09f68e419f7ca866ff395d1f897/lib/url.c#L4608-L4638 + +- wget: + https://www.gnu.org/software/wget/manual/wget.html#Proxies + http://git.savannah.gnu.org/cgit/wget.git/tree/src/init.c?id=636a5f9a1c508aa39e35a3a8e9e54520a284d93d#n383 + http://git.savannah.gnu.org/cgit/wget.git/tree/src/retr.c?id=93c1517c4071c4288ba5a4b038e7634e4c6b5482#n1278 + +- W3: + https://www.w3.org/Daemon/User/Proxies/ProxyClients.html + +- Python's urllib: + https://github.com/python/cpython/blob/936135bb97fe04223aa30ca6e98eac8f3ed6b349/Lib/urllib/request.py#L755-L782 + https://github.com/python/cpython/blob/936135bb97fe04223aa30ca6e98eac8f3ed6b349/Lib/urllib/request.py#L2444-L2479 diff --git a/project starter code/node_modules/proxy-from-env/index.js b/project starter code/node_modules/proxy-from-env/index.js new file mode 100644 index 00000000..df75004a --- /dev/null +++ b/project starter code/node_modules/proxy-from-env/index.js @@ -0,0 +1,108 @@ +'use strict'; + +var parseUrl = require('url').parse; + +var DEFAULT_PORTS = { + ftp: 21, + gopher: 70, + http: 80, + https: 443, + ws: 80, + wss: 443, +}; + +var stringEndsWith = String.prototype.endsWith || function(s) { + return s.length <= this.length && + this.indexOf(s, this.length - s.length) !== -1; +}; + +/** + * @param {string|object} url - The URL, or the result from url.parse. + * @return {string} The URL of the proxy that should handle the request to the + * given URL. If no proxy is set, this will be an empty string. + */ +function getProxyForUrl(url) { + var parsedUrl = typeof url === 'string' ? parseUrl(url) : url || {}; + var proto = parsedUrl.protocol; + var hostname = parsedUrl.host; + var port = parsedUrl.port; + if (typeof hostname !== 'string' || !hostname || typeof proto !== 'string') { + return ''; // Don't proxy URLs without a valid scheme or host. + } + + proto = proto.split(':', 1)[0]; + // Stripping ports in this way instead of using parsedUrl.hostname to make + // sure that the brackets around IPv6 addresses are kept. + hostname = hostname.replace(/:\d*$/, ''); + port = parseInt(port) || DEFAULT_PORTS[proto] || 0; + if (!shouldProxy(hostname, port)) { + return ''; // Don't proxy URLs that match NO_PROXY. + } + + var proxy = + getEnv('npm_config_' + proto + '_proxy') || + getEnv(proto + '_proxy') || + getEnv('npm_config_proxy') || + getEnv('all_proxy'); + if (proxy && proxy.indexOf('://') === -1) { + // Missing scheme in proxy, default to the requested URL's scheme. + proxy = proto + '://' + proxy; + } + return proxy; +} + +/** + * Determines whether a given URL should be proxied. + * + * @param {string} hostname - The host name of the URL. + * @param {number} port - The effective port of the URL. + * @returns {boolean} Whether the given URL should be proxied. + * @private + */ +function shouldProxy(hostname, port) { + var NO_PROXY = + (getEnv('npm_config_no_proxy') || getEnv('no_proxy')).toLowerCase(); + if (!NO_PROXY) { + return true; // Always proxy if NO_PROXY is not set. + } + if (NO_PROXY === '*') { + return false; // Never proxy if wildcard is set. + } + + return NO_PROXY.split(/[,\s]/).every(function(proxy) { + if (!proxy) { + return true; // Skip zero-length hosts. + } + var parsedProxy = proxy.match(/^(.+):(\d+)$/); + var parsedProxyHostname = parsedProxy ? parsedProxy[1] : proxy; + var parsedProxyPort = parsedProxy ? parseInt(parsedProxy[2]) : 0; + if (parsedProxyPort && parsedProxyPort !== port) { + return true; // Skip if ports don't match. + } + + if (!/^[.*]/.test(parsedProxyHostname)) { + // No wildcards, so stop proxying if there is an exact match. + return hostname !== parsedProxyHostname; + } + + if (parsedProxyHostname.charAt(0) === '*') { + // Remove leading wildcard. + parsedProxyHostname = parsedProxyHostname.slice(1); + } + // Stop proxying if the hostname ends with the no_proxy host. + return !stringEndsWith.call(hostname, parsedProxyHostname); + }); +} + +/** + * Get the value for an environment variable. + * + * @param {string} key - The name of the environment variable. + * @return {string} The value of the environment variable. + * @private + */ +function getEnv(key) { + return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || ''; +} + +exports.getProxyForUrl = getProxyForUrl; diff --git a/project starter code/node_modules/proxy-from-env/package.json b/project starter code/node_modules/proxy-from-env/package.json new file mode 100644 index 00000000..be2b845b --- /dev/null +++ b/project starter code/node_modules/proxy-from-env/package.json @@ -0,0 +1,34 @@ +{ + "name": "proxy-from-env", + "version": "1.1.0", + "description": "Offers getProxyForUrl to get the proxy URL for a URL, respecting the *_PROXY (e.g. HTTP_PROXY) and NO_PROXY environment variables.", + "main": "index.js", + "scripts": { + "lint": "eslint *.js", + "test": "mocha ./test.js --reporter spec", + "test-coverage": "istanbul cover ./node_modules/.bin/_mocha -- --reporter spec" + }, + "repository": { + "type": "git", + "url": "https://github.com/Rob--W/proxy-from-env.git" + }, + "keywords": [ + "proxy", + "http_proxy", + "https_proxy", + "no_proxy", + "environment" + ], + "author": "Rob Wu (https://robwu.nl/)", + "license": "MIT", + "bugs": { + "url": "https://github.com/Rob--W/proxy-from-env/issues" + }, + "homepage": "https://github.com/Rob--W/proxy-from-env#readme", + "devDependencies": { + "coveralls": "^3.0.9", + "eslint": "^6.8.0", + "istanbul": "^0.4.5", + "mocha": "^7.1.0" + } +} diff --git a/project starter code/node_modules/proxy-from-env/test.js b/project starter code/node_modules/proxy-from-env/test.js new file mode 100644 index 00000000..abf65423 --- /dev/null +++ b/project starter code/node_modules/proxy-from-env/test.js @@ -0,0 +1,483 @@ +/* eslint max-statements:0 */ +'use strict'; + +var assert = require('assert'); +var parseUrl = require('url').parse; + +var getProxyForUrl = require('./').getProxyForUrl; + +// Runs the callback with process.env temporarily set to env. +function runWithEnv(env, callback) { + var originalEnv = process.env; + process.env = env; + try { + callback(); + } finally { + process.env = originalEnv; + } +} + +// Defines a test case that checks whether getProxyForUrl(input) === expected. +function testProxyUrl(env, expected, input) { + assert(typeof env === 'object' && env !== null); + // Copy object to make sure that the in param does not get modified between + // the call of this function and the use of it below. + env = JSON.parse(JSON.stringify(env)); + + var title = 'getProxyForUrl(' + JSON.stringify(input) + ')' + + ' === ' + JSON.stringify(expected); + + // Save call stack for later use. + var stack = {}; + Error.captureStackTrace(stack, testProxyUrl); + // Only use the last stack frame because that shows where this function is + // called, and that is sufficient for our purpose. No need to flood the logs + // with an uninteresting stack trace. + stack = stack.stack.split('\n', 2)[1]; + + it(title, function() { + var actual; + runWithEnv(env, function() { + actual = getProxyForUrl(input); + }); + if (expected === actual) { + return; // Good! + } + try { + assert.strictEqual(expected, actual); // Create a formatted error message. + // Should not happen because previously we determined expected !== actual. + throw new Error('assert.strictEqual passed. This is impossible!'); + } catch (e) { + // Use the original stack trace, so we can see a helpful line number. + e.stack = e.message + stack; + throw e; + } + }); +} + +describe('getProxyForUrl', function() { + describe('No proxy variables', function() { + var env = {}; + testProxyUrl(env, '', 'http://example.com'); + testProxyUrl(env, '', 'https://example.com'); + testProxyUrl(env, '', 'ftp://example.com'); + }); + + describe('Invalid URLs', function() { + var env = {}; + env.ALL_PROXY = 'http://unexpected.proxy'; + testProxyUrl(env, '', 'bogus'); + testProxyUrl(env, '', '//example.com'); + testProxyUrl(env, '', '://example.com'); + testProxyUrl(env, '', '://'); + testProxyUrl(env, '', '/path'); + testProxyUrl(env, '', ''); + testProxyUrl(env, '', 'http:'); + testProxyUrl(env, '', 'http:/'); + testProxyUrl(env, '', 'http://'); + testProxyUrl(env, '', 'prototype://'); + testProxyUrl(env, '', 'hasOwnProperty://'); + testProxyUrl(env, '', '__proto__://'); + testProxyUrl(env, '', undefined); + testProxyUrl(env, '', null); + testProxyUrl(env, '', {}); + testProxyUrl(env, '', {host: 'x', protocol: 1}); + testProxyUrl(env, '', {host: 1, protocol: 'x'}); + }); + + describe('http_proxy and HTTP_PROXY', function() { + var env = {}; + env.HTTP_PROXY = 'http://http-proxy'; + + testProxyUrl(env, '', 'https://example'); + testProxyUrl(env, 'http://http-proxy', 'http://example'); + testProxyUrl(env, 'http://http-proxy', parseUrl('http://example')); + + // eslint-disable-next-line camelcase + env.http_proxy = 'http://priority'; + testProxyUrl(env, 'http://priority', 'http://example'); + }); + + describe('http_proxy with non-sensical value', function() { + var env = {}; + // Crazy values should be passed as-is. It is the responsibility of the + // one who launches the application that the value makes sense. + // TODO: Should we be stricter and perform validation? + env.HTTP_PROXY = 'Crazy \n!() { ::// }'; + testProxyUrl(env, 'Crazy \n!() { ::// }', 'http://wow'); + + // The implementation assumes that the HTTP_PROXY environment variable is + // somewhat reasonable, and if the scheme is missing, it is added. + // Garbage in, garbage out some would say... + env.HTTP_PROXY = 'crazy without colon slash slash'; + testProxyUrl(env, 'http://crazy without colon slash slash', 'http://wow'); + }); + + describe('https_proxy and HTTPS_PROXY', function() { + var env = {}; + // Assert that there is no fall back to http_proxy + env.HTTP_PROXY = 'http://unexpected.proxy'; + testProxyUrl(env, '', 'https://example'); + + env.HTTPS_PROXY = 'http://https-proxy'; + testProxyUrl(env, 'http://https-proxy', 'https://example'); + + // eslint-disable-next-line camelcase + env.https_proxy = 'http://priority'; + testProxyUrl(env, 'http://priority', 'https://example'); + }); + + describe('ftp_proxy', function() { + var env = {}; + // Something else than http_proxy / https, as a sanity check. + env.FTP_PROXY = 'http://ftp-proxy'; + + testProxyUrl(env, 'http://ftp-proxy', 'ftp://example'); + testProxyUrl(env, '', 'ftps://example'); + }); + + describe('all_proxy', function() { + var env = {}; + env.ALL_PROXY = 'http://catch-all'; + testProxyUrl(env, 'http://catch-all', 'https://example'); + + // eslint-disable-next-line camelcase + env.all_proxy = 'http://priority'; + testProxyUrl(env, 'http://priority', 'https://example'); + }); + + describe('all_proxy without scheme', function() { + var env = {}; + env.ALL_PROXY = 'noscheme'; + testProxyUrl(env, 'http://noscheme', 'http://example'); + testProxyUrl(env, 'https://noscheme', 'https://example'); + + // The module does not impose restrictions on the scheme. + testProxyUrl(env, 'bogus-scheme://noscheme', 'bogus-scheme://example'); + + // But the URL should still be valid. + testProxyUrl(env, '', 'bogus'); + }); + + describe('no_proxy empty', function() { + var env = {}; + env.HTTPS_PROXY = 'http://proxy'; + + // NO_PROXY set but empty. + env.NO_PROXY = ''; + testProxyUrl(env, 'http://proxy', 'https://example'); + + // No entries in NO_PROXY (comma). + env.NO_PROXY = ','; + testProxyUrl(env, 'http://proxy', 'https://example'); + + // No entries in NO_PROXY (whitespace). + env.NO_PROXY = ' '; + testProxyUrl(env, 'http://proxy', 'https://example'); + + // No entries in NO_PROXY (multiple whitespace / commas). + env.NO_PROXY = ',\t,,,\n, ,\r'; + testProxyUrl(env, 'http://proxy', 'https://example'); + }); + + describe('no_proxy=example (single host)', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + + env.NO_PROXY = 'example'; + testProxyUrl(env, '', 'http://example'); + testProxyUrl(env, '', 'http://example:80'); + testProxyUrl(env, '', 'http://example:0'); + testProxyUrl(env, '', 'http://example:1337'); + testProxyUrl(env, 'http://proxy', 'http://sub.example'); + testProxyUrl(env, 'http://proxy', 'http://prefexample'); + testProxyUrl(env, 'http://proxy', 'http://example.no'); + testProxyUrl(env, 'http://proxy', 'http://a.b.example'); + testProxyUrl(env, 'http://proxy', 'http://host/example'); + }); + + describe('no_proxy=sub.example (subdomain)', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + + env.NO_PROXY = 'sub.example'; + testProxyUrl(env, 'http://proxy', 'http://example'); + testProxyUrl(env, 'http://proxy', 'http://example:80'); + testProxyUrl(env, 'http://proxy', 'http://example:0'); + testProxyUrl(env, 'http://proxy', 'http://example:1337'); + testProxyUrl(env, '', 'http://sub.example'); + testProxyUrl(env, 'http://proxy', 'http://no.sub.example'); + testProxyUrl(env, 'http://proxy', 'http://sub-example'); + testProxyUrl(env, 'http://proxy', 'http://example.sub'); + }); + + describe('no_proxy=example:80 (host + port)', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + + env.NO_PROXY = 'example:80'; + testProxyUrl(env, '', 'http://example'); + testProxyUrl(env, '', 'http://example:80'); + testProxyUrl(env, '', 'http://example:0'); + testProxyUrl(env, 'http://proxy', 'http://example:1337'); + testProxyUrl(env, 'http://proxy', 'http://sub.example'); + testProxyUrl(env, 'http://proxy', 'http://prefexample'); + testProxyUrl(env, 'http://proxy', 'http://example.no'); + testProxyUrl(env, 'http://proxy', 'http://a.b.example'); + }); + + describe('no_proxy=.example (host suffix)', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + + env.NO_PROXY = '.example'; + testProxyUrl(env, 'http://proxy', 'http://example'); + testProxyUrl(env, 'http://proxy', 'http://example:80'); + testProxyUrl(env, 'http://proxy', 'http://example:1337'); + testProxyUrl(env, '', 'http://sub.example'); + testProxyUrl(env, '', 'http://sub.example:80'); + testProxyUrl(env, '', 'http://sub.example:1337'); + testProxyUrl(env, 'http://proxy', 'http://prefexample'); + testProxyUrl(env, 'http://proxy', 'http://example.no'); + testProxyUrl(env, '', 'http://a.b.example'); + }); + + describe('no_proxy=*', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + env.NO_PROXY = '*'; + testProxyUrl(env, '', 'http://example.com'); + }); + + describe('no_proxy=*.example (host suffix with *.)', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + + env.NO_PROXY = '*.example'; + testProxyUrl(env, 'http://proxy', 'http://example'); + testProxyUrl(env, 'http://proxy', 'http://example:80'); + testProxyUrl(env, 'http://proxy', 'http://example:1337'); + testProxyUrl(env, '', 'http://sub.example'); + testProxyUrl(env, '', 'http://sub.example:80'); + testProxyUrl(env, '', 'http://sub.example:1337'); + testProxyUrl(env, 'http://proxy', 'http://prefexample'); + testProxyUrl(env, 'http://proxy', 'http://example.no'); + testProxyUrl(env, '', 'http://a.b.example'); + }); + + describe('no_proxy=*example (substring suffix)', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + + env.NO_PROXY = '*example'; + testProxyUrl(env, '', 'http://example'); + testProxyUrl(env, '', 'http://example:80'); + testProxyUrl(env, '', 'http://example:1337'); + testProxyUrl(env, '', 'http://sub.example'); + testProxyUrl(env, '', 'http://sub.example:80'); + testProxyUrl(env, '', 'http://sub.example:1337'); + testProxyUrl(env, '', 'http://prefexample'); + testProxyUrl(env, '', 'http://a.b.example'); + testProxyUrl(env, 'http://proxy', 'http://example.no'); + testProxyUrl(env, 'http://proxy', 'http://host/example'); + }); + + describe('no_proxy=.*example (arbitrary wildcards are NOT supported)', + function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + + env.NO_PROXY = '.*example'; + testProxyUrl(env, 'http://proxy', 'http://example'); + testProxyUrl(env, 'http://proxy', 'http://sub.example'); + testProxyUrl(env, 'http://proxy', 'http://sub.example'); + testProxyUrl(env, 'http://proxy', 'http://prefexample'); + testProxyUrl(env, 'http://proxy', 'http://x.prefexample'); + testProxyUrl(env, 'http://proxy', 'http://a.b.example'); + }); + + describe('no_proxy=[::1],[::2]:80,10.0.0.1,10.0.0.2:80 (IP addresses)', + function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + + env.NO_PROXY = '[::1],[::2]:80,10.0.0.1,10.0.0.2:80'; + testProxyUrl(env, '', 'http://[::1]/'); + testProxyUrl(env, '', 'http://[::1]:80/'); + testProxyUrl(env, '', 'http://[::1]:1337/'); + + testProxyUrl(env, '', 'http://[::2]/'); + testProxyUrl(env, '', 'http://[::2]:80/'); + testProxyUrl(env, 'http://proxy', 'http://[::2]:1337/'); + + testProxyUrl(env, '', 'http://10.0.0.1/'); + testProxyUrl(env, '', 'http://10.0.0.1:80/'); + testProxyUrl(env, '', 'http://10.0.0.1:1337/'); + + testProxyUrl(env, '', 'http://10.0.0.2/'); + testProxyUrl(env, '', 'http://10.0.0.2:80/'); + testProxyUrl(env, 'http://proxy', 'http://10.0.0.2:1337/'); + }); + + describe('no_proxy=127.0.0.1/32 (CIDR is NOT supported)', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + + env.NO_PROXY = '127.0.0.1/32'; + testProxyUrl(env, 'http://proxy', 'http://127.0.0.1'); + testProxyUrl(env, 'http://proxy', 'http://127.0.0.1/32'); + }); + + describe('no_proxy=127.0.0.1 does NOT match localhost', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + + env.NO_PROXY = '127.0.0.1'; + testProxyUrl(env, '', 'http://127.0.0.1'); + // We're not performing DNS queries, so this shouldn't match. + testProxyUrl(env, 'http://proxy', 'http://localhost'); + }); + + describe('no_proxy with protocols that have a default port', function() { + var env = {}; + env.WS_PROXY = 'http://ws'; + env.WSS_PROXY = 'http://wss'; + env.HTTP_PROXY = 'http://http'; + env.HTTPS_PROXY = 'http://https'; + env.GOPHER_PROXY = 'http://gopher'; + env.FTP_PROXY = 'http://ftp'; + env.ALL_PROXY = 'http://all'; + + env.NO_PROXY = 'xxx:21,xxx:70,xxx:80,xxx:443'; + + testProxyUrl(env, '', 'http://xxx'); + testProxyUrl(env, '', 'http://xxx:80'); + testProxyUrl(env, 'http://http', 'http://xxx:1337'); + + testProxyUrl(env, '', 'ws://xxx'); + testProxyUrl(env, '', 'ws://xxx:80'); + testProxyUrl(env, 'http://ws', 'ws://xxx:1337'); + + testProxyUrl(env, '', 'https://xxx'); + testProxyUrl(env, '', 'https://xxx:443'); + testProxyUrl(env, 'http://https', 'https://xxx:1337'); + + testProxyUrl(env, '', 'wss://xxx'); + testProxyUrl(env, '', 'wss://xxx:443'); + testProxyUrl(env, 'http://wss', 'wss://xxx:1337'); + + testProxyUrl(env, '', 'gopher://xxx'); + testProxyUrl(env, '', 'gopher://xxx:70'); + testProxyUrl(env, 'http://gopher', 'gopher://xxx:1337'); + + testProxyUrl(env, '', 'ftp://xxx'); + testProxyUrl(env, '', 'ftp://xxx:21'); + testProxyUrl(env, 'http://ftp', 'ftp://xxx:1337'); + }); + + describe('no_proxy should not be case-sensitive', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + env.NO_PROXY = 'XXX,YYY,ZzZ'; + + testProxyUrl(env, '', 'http://xxx'); + testProxyUrl(env, '', 'http://XXX'); + testProxyUrl(env, '', 'http://yyy'); + testProxyUrl(env, '', 'http://YYY'); + testProxyUrl(env, '', 'http://ZzZ'); + testProxyUrl(env, '', 'http://zZz'); + }); + + describe('NPM proxy configuration', function() { + describe('npm_config_http_proxy should work', function() { + var env = {}; + // eslint-disable-next-line camelcase + env.npm_config_http_proxy = 'http://http-proxy'; + + testProxyUrl(env, '', 'https://example'); + testProxyUrl(env, 'http://http-proxy', 'http://example'); + + // eslint-disable-next-line camelcase + env.npm_config_http_proxy = 'http://priority'; + testProxyUrl(env, 'http://priority', 'http://example'); + }); + // eslint-disable-next-line max-len + describe('npm_config_http_proxy should take precedence over HTTP_PROXY and npm_config_proxy', function() { + var env = {}; + // eslint-disable-next-line camelcase + env.npm_config_http_proxy = 'http://http-proxy'; + // eslint-disable-next-line camelcase + env.npm_config_proxy = 'http://unexpected-proxy'; + env.HTTP_PROXY = 'http://unexpected-proxy'; + + testProxyUrl(env, 'http://http-proxy', 'http://example'); + }); + describe('npm_config_https_proxy should work', function() { + var env = {}; + // eslint-disable-next-line camelcase + env.npm_config_http_proxy = 'http://unexpected.proxy'; + testProxyUrl(env, '', 'https://example'); + + // eslint-disable-next-line camelcase + env.npm_config_https_proxy = 'http://https-proxy'; + testProxyUrl(env, 'http://https-proxy', 'https://example'); + + // eslint-disable-next-line camelcase + env.npm_config_https_proxy = 'http://priority'; + testProxyUrl(env, 'http://priority', 'https://example'); + }); + // eslint-disable-next-line max-len + describe('npm_config_https_proxy should take precedence over HTTPS_PROXY and npm_config_proxy', function() { + var env = {}; + // eslint-disable-next-line camelcase + env.npm_config_https_proxy = 'http://https-proxy'; + // eslint-disable-next-line camelcase + env.npm_config_proxy = 'http://unexpected-proxy'; + env.HTTPS_PROXY = 'http://unexpected-proxy'; + + testProxyUrl(env, 'http://https-proxy', 'https://example'); + }); + describe('npm_config_proxy should work', function() { + var env = {}; + // eslint-disable-next-line camelcase + env.npm_config_proxy = 'http://http-proxy'; + testProxyUrl(env, 'http://http-proxy', 'http://example'); + testProxyUrl(env, 'http://http-proxy', 'https://example'); + + // eslint-disable-next-line camelcase + env.npm_config_proxy = 'http://priority'; + testProxyUrl(env, 'http://priority', 'http://example'); + testProxyUrl(env, 'http://priority', 'https://example'); + }); + // eslint-disable-next-line max-len + describe('HTTP_PROXY and HTTPS_PROXY should take precedence over npm_config_proxy', function() { + var env = {}; + env.HTTP_PROXY = 'http://http-proxy'; + env.HTTPS_PROXY = 'http://https-proxy'; + // eslint-disable-next-line camelcase + env.npm_config_proxy = 'http://unexpected-proxy'; + testProxyUrl(env, 'http://http-proxy', 'http://example'); + testProxyUrl(env, 'http://https-proxy', 'https://example'); + }); + describe('npm_config_no_proxy should work', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + // eslint-disable-next-line camelcase + env.npm_config_no_proxy = 'example'; + + testProxyUrl(env, '', 'http://example'); + testProxyUrl(env, 'http://proxy', 'http://otherwebsite'); + }); + // eslint-disable-next-line max-len + describe('npm_config_no_proxy should take precedence over NO_PROXY', function() { + var env = {}; + env.HTTP_PROXY = 'http://proxy'; + env.NO_PROXY = 'otherwebsite'; + // eslint-disable-next-line camelcase + env.npm_config_no_proxy = 'example'; + + testProxyUrl(env, '', 'http://example'); + testProxyUrl(env, 'http://proxy', 'http://otherwebsite'); + }); + }); +}); diff --git a/project starter code/node_modules/pstree.remy/.travis.yml b/project starter code/node_modules/pstree.remy/.travis.yml new file mode 100644 index 00000000..5bf093ee --- /dev/null +++ b/project starter code/node_modules/pstree.remy/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +cache: + directories: + - ~/.npm +notifications: + email: false +node_js: + - '8' diff --git a/project starter code/node_modules/pstree.remy/LICENSE b/project starter code/node_modules/pstree.remy/LICENSE new file mode 100644 index 00000000..e83bea65 --- /dev/null +++ b/project starter code/node_modules/pstree.remy/LICENSE @@ -0,0 +1,7 @@ +The MIT License (MIT) +Copyright © 2019 Remy Sharp, https://remysharp.com +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/project starter code/node_modules/pstree.remy/README.md b/project starter code/node_modules/pstree.remy/README.md new file mode 100644 index 00000000..5f44c629 --- /dev/null +++ b/project starter code/node_modules/pstree.remy/README.md @@ -0,0 +1,26 @@ +# pstree.remy + +> Cross platform ps-tree (including unix flavours without ps) + +## Installation + +```shel +npm install pstree.remy +``` + +## Usage + +```js +const psTree = psTree require('pstree.remy'); + +psTree(PID, (err, pids) => { + if (err) { + console.error(err); + } + console.log(pids) +}); + +console.log(psTree.hasPS + ? "This platform has the ps shell command" + : "This platform does not have the ps shell command"); +``` diff --git a/project starter code/node_modules/pstree.remy/lib/index.js b/project starter code/node_modules/pstree.remy/lib/index.js new file mode 100644 index 00000000..743e9979 --- /dev/null +++ b/project starter code/node_modules/pstree.remy/lib/index.js @@ -0,0 +1,37 @@ +const exec = require('child_process').exec; +const tree = require('./tree'); +const utils = require('./utils'); +var hasPS = true; + +// discover if the OS has `ps`, and therefore can use psTree +exec('ps', (error) => { + module.exports.hasPS = hasPS = !error; +}); + +module.exports = function main(pid, callback) { + if (typeof pid === 'number') { + pid = pid.toString(); + } + + if (hasPS && !process.env.NO_PS) { + return tree(pid, callback); + } + + utils + .getStat() + .then(utils.tree) + .then((tree) => utils.pidsForTree(tree, pid)) + .then((res) => + callback( + null, + res.map((p) => p.PID) + ) + ) + .catch((error) => callback(error)); +}; + +if (!module.parent) { + module.exports(process.argv[2], (e, pids) => console.log(pids)); +} + +module.exports.hasPS = hasPS; diff --git a/project starter code/node_modules/pstree.remy/lib/tree.js b/project starter code/node_modules/pstree.remy/lib/tree.js new file mode 100644 index 00000000..bac7cce6 --- /dev/null +++ b/project starter code/node_modules/pstree.remy/lib/tree.js @@ -0,0 +1,37 @@ +const spawn = require('child_process').spawn; + +module.exports = function (rootPid, callback) { + const pidsOfInterest = new Set([parseInt(rootPid, 10)]); + var output = ''; + + // *nix + const ps = spawn('ps', ['-A', '-o', 'ppid,pid']); + ps.stdout.on('data', (data) => { + output += data.toString('ascii'); + }); + + ps.on('close', () => { + try { + const res = output + .split('\n') + .slice(1) + .map((_) => _.trim()) + .reduce((acc, line) => { + const pids = line.split(/\s+/); + const ppid = parseInt(pids[0], 10); + + if (pidsOfInterest.has(ppid)) { + const pid = parseInt(pids[1], 10); + acc.push(pid); + pidsOfInterest.add(pid); + } + + return acc; + }, []); + + callback(null, res); + } catch (e) { + callback(e, null); + } + }); +}; diff --git a/project starter code/node_modules/pstree.remy/lib/utils.js b/project starter code/node_modules/pstree.remy/lib/utils.js new file mode 100644 index 00000000..8fa5719e --- /dev/null +++ b/project starter code/node_modules/pstree.remy/lib/utils.js @@ -0,0 +1,53 @@ +const spawn = require('child_process').spawn; + +module.exports = { tree, pidsForTree, getStat }; + +function getStat() { + return new Promise((resolve) => { + const command = `ls /proc | grep -E '^[0-9]+$' | xargs -I{} cat /proc/{}/stat`; + const spawned = spawn('sh', ['-c', command], { + stdio: ['pipe', 'pipe', 'pipe'], + }); + + var res = ''; + spawned.stdout.on('data', (data) => (res += data)); + spawned.on('close', () => resolve(res)); + }); +} + +function template(s) { + var stat = null; + // 'pid', 'comm', 'state', 'ppid', 'pgrp' + // %d (%s) %c %d %d + s.replace( + /(\d+) \((.*?)\)\s(.+?)\s(\d+)\s/g, + (all, PID, COMMAND, STAT, PPID) => { + stat = { PID, COMMAND, PPID, STAT }; + } + ); + + return stat; +} + +function tree(stats) { + const processes = stats.split('\n').map(template).filter(Boolean); + + return processes; +} + +function pidsForTree(tree, pid) { + if (typeof pid === 'number') { + pid = pid.toString(); + } + const parents = [pid]; + const pids = []; + + tree.forEach((proc) => { + if (parents.indexOf(proc.PPID) !== -1) { + parents.push(proc.PID); + pids.push(proc); + } + }); + + return pids; +} diff --git a/project starter code/node_modules/pstree.remy/package.json b/project starter code/node_modules/pstree.remy/package.json new file mode 100644 index 00000000..35c70683 --- /dev/null +++ b/project starter code/node_modules/pstree.remy/package.json @@ -0,0 +1,33 @@ +{ + "name": "pstree.remy", + "version": "1.1.8", + "main": "lib/index.js", + "prettier": { + "trailingComma": "es5", + "semi": true, + "singleQuote": true + }, + "scripts": { + "test": "tap tests/*.test.js", + "_prepublish": "npm test" + }, + "keywords": [ + "ps", + "pstree", + "ps tree" + ], + "author": "Remy Sharp", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/remy/pstree.git" + }, + "devDependencies": { + "tap": "^11.0.0" + }, + "directories": { + "test": "tests" + }, + "dependencies": {}, + "description": "Collects the full tree of processes from /proc" +} diff --git a/project starter code/node_modules/pstree.remy/tests/fixtures/index.js b/project starter code/node_modules/pstree.remy/tests/fixtures/index.js new file mode 100644 index 00000000..4cdbcb1b --- /dev/null +++ b/project starter code/node_modules/pstree.remy/tests/fixtures/index.js @@ -0,0 +1,13 @@ +const spawn = require('child_process').spawn; +function run() { + spawn( + 'sh', + ['-c', 'node -e "setInterval(() => console.log(`running`), 200)"'], + { + stdio: 'pipe', + } + ); +} + +var runCallCount = process.argv[2] || 1; +for (var i = 0; i < runCallCount; i++) run(); diff --git a/project starter code/node_modules/pstree.remy/tests/fixtures/out1 b/project starter code/node_modules/pstree.remy/tests/fixtures/out1 new file mode 100644 index 00000000..abfe5810 --- /dev/null +++ b/project starter code/node_modules/pstree.remy/tests/fixtures/out1 @@ -0,0 +1,10 @@ +1 (npm) S 0 1 1 34816 1 4210944 11112 0 0 0 45 8 0 0 20 0 10 0 330296 1089871872 11809 18446744073709551615 4194304 29343848 140726436642896 0 0 0 0 4096 2072112895 0 0 0 17 0 0 0 0 0 0 31441000 31537208 37314560 140726436650815 140726436650847 140726436650847 140726436650986 0 +15 (sh) S 1 1 1 34816 1 4210688 115 0 0 0 0 0 0 0 20 0 1 0 330372 4399104 187 18446744073709551615 94374393548800 94374393655428 140722913272992 0 0 0 0 0 65538 0 0 0 17 0 0 0 0 0 0 94374395756424 94374395761184 94374404673536 140722913278928 140722913278959 140722913278959 140722913284080 0 +16 (node) S 15 1 1 34816 1 4210688 6930 103 0 0 32 2 0 0 20 0 10 0 330373 1068478464 8412 18446744073709551615 4194304 29343848 140727228046064 0 0 0 0 4096 134300162 0 0 0 17 1 0 0 1 0 0 31441000 31537208 52584448 140727228050313 140727228050383 140727228050383 140727228055530 0 +27 (sh) S 16 1 1 34816 1 4210688 111 0 0 0 0 0 0 0 20 0 1 0 330410 4399104 193 18446744073709551615 94848235986944 94848236093572 140727019991184 0 0 0 0 0 65538 0 0 0 17 1 0 0 0 0 0 94848238194568 94848238199328 94848261660672 140727019998122 140727019998165 140727019998165 140727020003312 0 +28 (node) S 27 1 1 34816 1 4210688 3576 268 0 0 12 2 0 0 20 0 10 0 330411 930213888 6760 18446744073709551615 4194304 29343848 140726559664992 0 0 0 0 4096 134300162 0 0 0 17 1 0 0 0 0 0 31441000 31537208 32591872 140726559669117 140726559669199 140726559669199 140726559674346 0 +39 (node) S 28 1 1 34816 1 4210688 47517 0 0 0 151 9 0 0 20 0 6 0 330427 985739264 31859 18446744073709551615 4194304 29343848 140737324503920 0 0 0 0 4096 134234626 0 0 0 17 0 0 0 0 0 0 31441000 31537208 51585024 140737324510060 140737324510159 140737324510159 140737324515306 0 +45 (bash) S 0 45 45 34817 50 4210944 752 256 0 0 2 0 0 0 20 0 1 0 331039 18628608 789 18446744073709551615 4194304 5242124 140724425887696 0 0 0 65536 3670020 1266777851 0 0 0 17 1 0 0 0 0 0 7341384 7388228 30310400 140724425891678 140724425891683 140724425891683 140724425891822 0 +cat: /proc/50/stat: No such file or directory +cat: /proc/51/stat: No such file or directory +52 (xargs) S 45 50 45 34817 50 4210688 179 661 0 0 0 0 0 0 20 0 1 0 331544 4608000 346 18446744073709551615 94587588550656 94587588614028 140735223856048 0 0 0 0 0 2560 0 0 0 17 1 0 0 0 0 0 94587590711464 94587590713504 94587603169280 140735223861006 140735223861035 140735223861035 140735223861225 0 diff --git a/project starter code/node_modules/pstree.remy/tests/fixtures/out2 b/project starter code/node_modules/pstree.remy/tests/fixtures/out2 new file mode 100644 index 00000000..3b31137d --- /dev/null +++ b/project starter code/node_modules/pstree.remy/tests/fixtures/out2 @@ -0,0 +1,29 @@ +cat: /proc/4087/stat: No such file or directory +cat: /proc/4088/stat: No such file or directory +1 (init) S 0 1 1 0 -1 4210944 9227 55994 29 319 7 5 68 16 20 0 1 0 1286281 33660928 855 18446744073709551615 1 1 0 0 0 0 0 4096 536962595 0 0 0 17 4 0 0 3 0 0 0 0 0 0 0 0 0 0 +1032 (ntpd) S 1 1032 1032 0 -1 4211008 178 0 1 0 0 0 0 0 20 0 1 0 1287033 25743360 1058 18446744073709551615 1 1 0 0 0 0 0 4096 27207 0 0 0 17 4 0 0 0 0 0 0 0 0 0 0 0 0 0 +126 (irqbalance) S 1 126 126 0 -1 1077952832 1217 0 0 0 1 6 0 0 20 0 1 0 1286749 20189184 647 18446744073709551615 1 1 0 0 0 0 0 0 3 0 0 0 17 4 0 0 0 0 0 0 0 0 0 0 0 0 0 +181 (mysqld) S 1 181 181 0 -1 4210944 6399 0 46 0 8 6 0 0 20 0 22 0 1286761 748453888 14476 18446744073709551615 1 1 0 0 0 0 552967 4096 26345 0 0 0 17 4 0 0 10 0 0 0 0 0 0 0 0 0 0 +194 (memcached) S 1 187 187 0 -1 4210944 252 0 4 0 0 0 0 0 20 0 6 0 1286766 333221888 648 18446744073709551615 1 1 0 0 0 0 0 4096 2 0 0 0 17 4 0 0 0 0 0 0 0 0 0 0 0 0 0 +243 (dbus-daemon) S 1 243 243 0 -1 4211008 67 0 0 0 0 0 0 0 20 0 1 0 1286779 40087552 598 18446744073709551615 1 1 0 0 0 0 0 0 16385 0 0 0 17 4 0 0 0 0 0 0 0 0 0 0 0 0 0 +254 (rsyslogd) S 1 254 254 0 -1 4211008 107 0 0 0 2 2 0 0 20 0 3 0 1286782 186601472 696 18446744073709551615 1 1 0 0 0 0 0 16781830 1133601 0 0 0 17 5 0 0 0 0 0 0 0 0 0 0 0 0 0 +265 (systemd-logind) S 1 265 265 0 -1 4210944 276 0 2 0 0 0 0 0 20 0 1 0 1286786 35880960 720 18446744073709551615 1 1 0 0 0 0 0 0 0 0 0 0 17 4 0 0 0 0 0 0 0 0 0 0 0 0 0 +333 (postgres) S 1 303 303 0 -1 4210688 3169 3466 15 18 0 1 1 1 20 0 1 0 1286817 156073984 5002 18446744073709551615 1 1 0 0 0 0 0 19935232 84487 0 0 0 17 5 0 0 1 0 0 0 0 0 0 0 0 0 0 +359 (postgres) S 333 359 359 0 -1 4210752 90 0 0 0 0 0 0 0 20 0 1 0 1286822 156073984 827 18446744073709551615 1 1 0 0 0 0 0 16805888 2567 0 0 0 17 4 0 0 0 0 0 0 0 0 0 0 0 0 0 +360 (postgres) S 333 360 360 0 -1 4210752 119 0 0 0 0 0 0 0 20 0 1 0 1286822 156073984 827 18446744073709551615 1 1 0 0 0 0 0 16791554 16901 0 0 0 17 4 0 0 0 0 0 0 0 0 0 0 0 0 0 +361 (postgres) S 333 361 361 0 -1 4210752 87 0 0 0 0 0 0 0 20 0 1 0 1286822 156073984 827 18446744073709551615 1 1 0 0 0 0 0 16791552 16903 0 0 0 17 4 0 0 0 0 0 0 0 0 0 0 0 0 0 +362 (postgres) S 333 362 362 0 -1 4210752 292 0 3 0 0 0 0 0 20 0 1 0 1286822 156930048 1373 18446744073709551615 1 1 0 0 0 0 0 19927040 27271 0 0 0 17 5 0 0 0 0 0 0 0 0 0 0 0 0 0 +363 (postgres) S 333 363 363 0 -1 4210752 82 0 0 0 0 0 0 0 20 0 1 0 1286822 115924992 887 18446744073709551615 1 1 0 0 0 0 0 16808450 5 0 0 0 17 5 0 0 0 0 0 0 0 0 0 0 0 0 0 +4050 (npm) S 50 50 50 34817 50 4210688 5109 0 0 0 36 3 0 0 20 0 10 0 1292968 738025472 10051 18446744073709551615 4194304 33165900 140723623956256 0 0 0 0 4096 134300162 0 0 0 17 4 0 0 0 0 0 35263056 35370992 48369664 140723623964237 140723623964294 140723623964294 140723623968712 0 +4060 (sh) S 4050 50 50 34817 50 4210688 121 0 0 0 0 0 0 0 20 0 1 0 1293007 4579328 174 18446744073709551615 94347643936768 94347644049516 140735136055088 0 0 0 0 0 65538 1 0 0 17 5 0 0 0 0 0 94347646148008 94347646153216 94347660038144 140735136063095 140735136063129 140735136063129 140735136071664 0 +4061 (node) S 4060 50 50 34817 50 4210688 6501 0 0 0 42 2 0 0 20 0 6 0 1293008 705769472 10211 18446744073709551615 4194304 33165900 140730532686288 0 0 0 0 4096 2072111671 0 0 0 17 5 0 0 0 0 0 35263056 35370992 45867008 140730532695579 140730532695657 140730532695657 140730532704200 0 +4067 (node) S 4061 50 50 34817 50 4210688 6746 221 0 0 38 3 0 0 20 0 10 0 1293051 738910208 10527 18446744073709551615 4194304 33165900 140724824971632 0 0 0 0 4096 2072111671 0 0 0 17 4 0 0 0 0 0 35263056 35370992 68595712 140724824980995 140724824981063 140724824981063 140724824989640 0 +4079 (sh) S 4067 50 50 34817 50 4210688 118 0 0 0 0 0 0 0 20 0 1 0 1293092 4579328 194 18446744073709551615 94573702131712 94573702244460 140724712357120 0 0 0 0 0 65538 1 0 0 17 4 0 0 0 0 0 94573704342952 94573704348160 94573718511616 140724712361487 140724712361583 140724712361583 140724712370160 0 +4080 (node) S 4079 50 50 34817 50 4210688 2428 0 0 0 8 1 0 0 20 0 6 0 1293093 693059584 7251 18446744073709551615 4194304 33165900 140726023392816 0 0 0 0 4096 134234626 0 0 0 17 5 0 0 0 0 0 35263056 35370992 55226368 140726023396847 140726023396935 140726023396935 140726023405512 0 +4086 (sh) S 4067 50 50 34817 50 4210688 131 244 0 0 0 0 0 0 20 0 1 0 1293143 4579328 200 18446744073709551615 94347550273536 94347550386284 140737219399136 0 0 0 0 0 65538 1 0 0 17 5 0 0 0 0 0 94347552484776 94347552489984 94347554299904 140737219403308 140737219403375 140737219403375 140737219411952 0 +4089 (xargs) S 4086 50 50 34817 50 4210688 333 1924 0 0 0 0 0 0 20 0 1 0 1293143 17600512 477 18446744073709551615 4194304 4232732 140721633759248 0 0 0 0 0 0 1 0 0 17 5 0 0 0 0 0 6331920 6332980 32182272 140721633762891 140721633762920 140721633762920 140721633771497 0 +50 (bash) S 0 50 50 34817 50 4210944 43914 1032463 9 705 44 21 4213 818 20 0 1 0 1286336 42266624 3599 18446744073709551615 4194304 5173404 140732749083280 0 0 0 65536 4 1132560123 1 0 0 17 4 0 0 410 0 0 7273968 7310504 21196800 140732749086490 140732749086517 140732749086517 140732749086702 0 +79 (acpid) S 1 79 79 0 -1 4210752 46 0 0 0 0 0 0 0 20 0 1 0 1286717 4493312 407 18446744073709551615 1 1 0 0 0 0 0 4096 16391 0 0 0 17 5 0 0 0 0 0 0 0 0 0 0 0 0 0 +83 (sshd) S 1 83 83 0 -1 4210944 354 0 27 0 0 0 0 0 20 0 1 0 1286718 62873600 1290 18446744073709551615 1 1 0 0 0 0 0 4096 81925 0 0 0 17 4 0 0 30 0 0 0 0 0 0 0 0 0 0 +94 (cron) S 1 94 94 0 -1 1077952576 103 449 0 1 0 0 0 0 20 0 1 0 1286743 24240128 559 18446744073709551615 1 1 0 0 0 0 0 0 65537 0 0 0 17 4 0 0 0 0 0 0 0 0 0 0 0 0 0 +95 (atd) S 1 95 95 0 -1 1077952576 28 0 0 0 0 0 0 0 20 0 1 0 1286743 19615744 41 18446744073709551615 1 1 0 0 0 0 0 0 81923 0 0 0 17 4 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/project starter code/node_modules/pstree.remy/tests/index.test.js b/project starter code/node_modules/pstree.remy/tests/index.test.js new file mode 100644 index 00000000..50096b95 --- /dev/null +++ b/project starter code/node_modules/pstree.remy/tests/index.test.js @@ -0,0 +1,51 @@ +const tap = require('tap'); +const test = tap.test; +const readFile = require('fs').readFileSync; +const spawn = require('child_process').spawn; +const pstree = require('../'); +const { tree, pidsForTree, getStat } = require('../lib/utils'); + +if (process.platform !== 'darwin') { + test('reads from /proc', async (t) => { + const ps = await getStat(); + t.ok(ps.split('\n').length > 1); + }); +} + +test('tree for live env', async (t) => { + const pid = 4079; + const fixture = readFile(__dirname + '/fixtures/out2', 'utf8'); + const ps = await tree(fixture); + t.deepEqual( + pidsForTree(ps, pid).map((_) => _.PID), + ['4080'] + ); +}); + +function testTree(t, runCallCount) { + const sub = spawn('node', [`${__dirname}/fixtures/index.js`, runCallCount], { + stdio: 'pipe', + }); + setTimeout(() => { + const pid = sub.pid; + + pstree(pid, (error, pids) => { + pids.concat([pid]).forEach((p) => { + spawn('kill', ['-s', 'SIGTERM', p]); + }); + + // the fixture launches `sh` which launches node which is why we + // are looking for two processes. + // Important: IDKW but MacOS seems to skip the `sh` process. no idea. + t.equal(pids.length, runCallCount * 2); + t.end(); + }); + }, 1000); +} + +test('can read full process tree', (t) => { + testTree(t, 1); +}); +test('can read full process tree with multiple processes', (t) => { + testTree(t, 2); +}); diff --git a/project starter code/node_modules/raw-body/HISTORY.md b/project starter code/node_modules/raw-body/HISTORY.md index 0b6b8373..baf0e2d8 100644 --- a/project starter code/node_modules/raw-body/HISTORY.md +++ b/project starter code/node_modules/raw-body/HISTORY.md @@ -1,3 +1,8 @@ +2.5.2 / 2023-02-21 +================== + + * Fix error message for non-stream argument + 2.5.1 / 2022-02-28 ================== diff --git a/project starter code/node_modules/raw-body/README.md b/project starter code/node_modules/raw-body/README.md index 695c6607..d9b36d61 100644 --- a/project starter code/node_modules/raw-body/README.md +++ b/project starter code/node_modules/raw-body/README.md @@ -219,5 +219,5 @@ server.listen(3000); [coveralls-url]: https://coveralls.io/r/stream-utils/raw-body?branch=master [downloads-image]: https://img.shields.io/npm/dm/raw-body.svg [downloads-url]: https://npmjs.org/package/raw-body -[github-actions-ci-image]: https://img.shields.io/github/workflow/status/stream-utils/raw-body/ci/master?label=ci +[github-actions-ci-image]: https://img.shields.io/github/actions/workflow/status/stream-utils/raw-body/ci.yml?branch=master&label=ci [github-actions-ci-url]: https://github.com/jshttp/stream-utils/raw-body?query=workflow%3Aci diff --git a/project starter code/node_modules/raw-body/index.js b/project starter code/node_modules/raw-body/index.js index a8f537f3..9cdcd122 100644 --- a/project starter code/node_modules/raw-body/index.js +++ b/project starter code/node_modules/raw-body/index.js @@ -69,6 +69,13 @@ function getRawBody (stream, options, callback) { var done = callback var opts = options || {} + // light validation + if (stream === undefined) { + throw new TypeError('argument stream is required') + } else if (typeof stream !== 'object' || stream === null || typeof stream.on !== 'function') { + throw new TypeError('argument stream must be a stream') + } + if (options === true || typeof options === 'string') { // short cut for encoding opts = { diff --git a/project starter code/node_modules/raw-body/package.json b/project starter code/node_modules/raw-body/package.json index 50fc90ad..aabb1c36 100644 --- a/project starter code/node_modules/raw-body/package.json +++ b/project starter code/node_modules/raw-body/package.json @@ -1,7 +1,7 @@ { "name": "raw-body", "description": "Get and validate the raw body of a readable stream.", - "version": "2.5.1", + "version": "2.5.2", "author": "Jonathan Ong (http://jongleberry.com)", "contributors": [ "Douglas Christopher Wilson ", @@ -17,14 +17,14 @@ }, "devDependencies": { "bluebird": "3.7.2", - "eslint": "7.32.0", - "eslint-config-standard": "14.1.1", - "eslint-plugin-import": "2.25.4", - "eslint-plugin-markdown": "2.2.1", + "eslint": "8.34.0", + "eslint-config-standard": "15.0.1", + "eslint-plugin-import": "2.27.5", + "eslint-plugin-markdown": "3.0.0", "eslint-plugin-node": "11.1.0", - "eslint-plugin-promise": "5.2.0", + "eslint-plugin-promise": "6.1.1", "eslint-plugin-standard": "4.1.0", - "mocha": "9.2.1", + "mocha": "10.2.0", "nyc": "15.1.0", "readable-stream": "2.3.7", "safe-buffer": "5.2.1" diff --git a/project starter code/node_modules/readable-stream/CONTRIBUTING.md b/project starter code/node_modules/readable-stream/CONTRIBUTING.md new file mode 100644 index 00000000..f478d58d --- /dev/null +++ b/project starter code/node_modules/readable-stream/CONTRIBUTING.md @@ -0,0 +1,38 @@ +# Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +* (a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +* (b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +* (c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +* (d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. + +## Moderation Policy + +The [Node.js Moderation Policy] applies to this WG. + +## Code of Conduct + +The [Node.js Code of Conduct][] applies to this WG. + +[Node.js Code of Conduct]: +https://github.com/nodejs/node/blob/master/CODE_OF_CONDUCT.md +[Node.js Moderation Policy]: +https://github.com/nodejs/TSC/blob/master/Moderation-Policy.md diff --git a/project starter code/node_modules/readable-stream/GOVERNANCE.md b/project starter code/node_modules/readable-stream/GOVERNANCE.md new file mode 100644 index 00000000..16ffb93f --- /dev/null +++ b/project starter code/node_modules/readable-stream/GOVERNANCE.md @@ -0,0 +1,136 @@ +### Streams Working Group + +The Node.js Streams is jointly governed by a Working Group +(WG) +that is responsible for high-level guidance of the project. + +The WG has final authority over this project including: + +* Technical direction +* Project governance and process (including this policy) +* Contribution policy +* GitHub repository hosting +* Conduct guidelines +* Maintaining the list of additional Collaborators + +For the current list of WG members, see the project +[README.md](./README.md#current-project-team-members). + +### Collaborators + +The readable-stream GitHub repository is +maintained by the WG and additional Collaborators who are added by the +WG on an ongoing basis. + +Individuals making significant and valuable contributions are made +Collaborators and given commit-access to the project. These +individuals are identified by the WG and their addition as +Collaborators is discussed during the WG meeting. + +_Note:_ If you make a significant contribution and are not considered +for commit-access log an issue or contact a WG member directly and it +will be brought up in the next WG meeting. + +Modifications of the contents of the readable-stream repository are +made on +a collaborative basis. Anybody with a GitHub account may propose a +modification via pull request and it will be considered by the project +Collaborators. All pull requests must be reviewed and accepted by a +Collaborator with sufficient expertise who is able to take full +responsibility for the change. In the case of pull requests proposed +by an existing Collaborator, an additional Collaborator is required +for sign-off. Consensus should be sought if additional Collaborators +participate and there is disagreement around a particular +modification. See _Consensus Seeking Process_ below for further detail +on the consensus model used for governance. + +Collaborators may opt to elevate significant or controversial +modifications, or modifications that have not found consensus to the +WG for discussion by assigning the ***WG-agenda*** tag to a pull +request or issue. The WG should serve as the final arbiter where +required. + +For the current list of Collaborators, see the project +[README.md](./README.md#members). + +### WG Membership + +WG seats are not time-limited. There is no fixed size of the WG. +However, the expected target is between 6 and 12, to ensure adequate +coverage of important areas of expertise, balanced with the ability to +make decisions efficiently. + +There is no specific set of requirements or qualifications for WG +membership beyond these rules. + +The WG may add additional members to the WG by unanimous consensus. + +A WG member may be removed from the WG by voluntary resignation, or by +unanimous consensus of all other WG members. + +Changes to WG membership should be posted in the agenda, and may be +suggested as any other agenda item (see "WG Meetings" below). + +If an addition or removal is proposed during a meeting, and the full +WG is not in attendance to participate, then the addition or removal +is added to the agenda for the subsequent meeting. This is to ensure +that all members are given the opportunity to participate in all +membership decisions. If a WG member is unable to attend a meeting +where a planned membership decision is being made, then their consent +is assumed. + +No more than 1/3 of the WG members may be affiliated with the same +employer. If removal or resignation of a WG member, or a change of +employment by a WG member, creates a situation where more than 1/3 of +the WG membership shares an employer, then the situation must be +immediately remedied by the resignation or removal of one or more WG +members affiliated with the over-represented employer(s). + +### WG Meetings + +The WG meets occasionally on a Google Hangout On Air. A designated moderator +approved by the WG runs the meeting. Each meeting should be +published to YouTube. + +Items are added to the WG agenda that are considered contentious or +are modifications of governance, contribution policy, WG membership, +or release process. + +The intention of the agenda is not to approve or review all patches; +that should happen continuously on GitHub and be handled by the larger +group of Collaborators. + +Any community member or contributor can ask that something be added to +the next meeting's agenda by logging a GitHub Issue. Any Collaborator, +WG member or the moderator can add the item to the agenda by adding +the ***WG-agenda*** tag to the issue. + +Prior to each WG meeting the moderator will share the Agenda with +members of the WG. WG members can add any items they like to the +agenda at the beginning of each meeting. The moderator and the WG +cannot veto or remove items. + +The WG may invite persons or representatives from certain projects to +participate in a non-voting capacity. + +The moderator is responsible for summarizing the discussion of each +agenda item and sends it as a pull request after the meeting. + +### Consensus Seeking Process + +The WG follows a +[Consensus +Seeking](http://en.wikipedia.org/wiki/Consensus-seeking_decision-making) +decision-making model. + +When an agenda item has appeared to reach a consensus the moderator +will ask "Does anyone object?" as a final call for dissent from the +consensus. + +If an agenda item cannot reach a consensus a WG member can call for +either a closing vote or a vote to table the issue to the next +meeting. The call for a vote must be seconded by a majority of the WG +or else the discussion will continue. Simple majority wins. + +Note that changes to WG membership require a majority consensus. See +"WG Membership" above. diff --git a/project starter code/node_modules/readable-stream/LICENSE b/project starter code/node_modules/readable-stream/LICENSE new file mode 100644 index 00000000..2873b3b2 --- /dev/null +++ b/project starter code/node_modules/readable-stream/LICENSE @@ -0,0 +1,47 @@ +Node.js is licensed for use as follows: + +""" +Copyright Node.js contributors. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. +""" + +This license applies to parts of Node.js originating from the +https://github.com/joyent/node repository: + +""" +Copyright Joyent, Inc. and other Node contributors. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. +""" diff --git a/project starter code/node_modules/readable-stream/README.md b/project starter code/node_modules/readable-stream/README.md new file mode 100644 index 00000000..19117c1a --- /dev/null +++ b/project starter code/node_modules/readable-stream/README.md @@ -0,0 +1,106 @@ +# readable-stream + +***Node.js core streams for userland*** [![Build Status](https://travis-ci.com/nodejs/readable-stream.svg?branch=master)](https://travis-ci.com/nodejs/readable-stream) + + +[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/) +[![NPM](https://nodei.co/npm-dl/readable-stream.png?&months=6&height=3)](https://nodei.co/npm/readable-stream/) + + +[![Sauce Test Status](https://saucelabs.com/browser-matrix/readabe-stream.svg)](https://saucelabs.com/u/readabe-stream) + +```bash +npm install --save readable-stream +``` + +This package is a mirror of the streams implementations in Node.js. + +Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v10.18.1/docs/api/stream.html). + +If you want to guarantee a stable streams base, regardless of what version of +Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html). + +As of version 2.0.0 **readable-stream** uses semantic versioning. + +## Version 3.x.x + +v3.x.x of `readable-stream` is a cut from Node 10. This version supports Node 6, 8, and 10, as well as evergreen browsers, IE 11 and latest Safari. The breaking changes introduced by v3 are composed by the combined breaking changes in [Node v9](https://nodejs.org/en/blog/release/v9.0.0/) and [Node v10](https://nodejs.org/en/blog/release/v10.0.0/), as follows: + +1. Error codes: https://github.com/nodejs/node/pull/13310, + https://github.com/nodejs/node/pull/13291, + https://github.com/nodejs/node/pull/16589, + https://github.com/nodejs/node/pull/15042, + https://github.com/nodejs/node/pull/15665, + https://github.com/nodejs/readable-stream/pull/344 +2. 'readable' have precedence over flowing + https://github.com/nodejs/node/pull/18994 +3. make virtual methods errors consistent + https://github.com/nodejs/node/pull/18813 +4. updated streams error handling + https://github.com/nodejs/node/pull/18438 +5. writable.end should return this. + https://github.com/nodejs/node/pull/18780 +6. readable continues to read when push('') + https://github.com/nodejs/node/pull/18211 +7. add custom inspect to BufferList + https://github.com/nodejs/node/pull/17907 +8. always defer 'readable' with nextTick + https://github.com/nodejs/node/pull/17979 + +## Version 2.x.x +v2.x.x of `readable-stream` is a cut of the stream module from Node 8 (there have been no semver-major changes from Node 4 to 8). This version supports all Node.js versions from 0.8, as well as evergreen browsers and IE 10 & 11. + +### Big Thanks + +Cross-browser Testing Platform and Open Source <3 Provided by [Sauce Labs][sauce] + +# Usage + +You can swap your `require('stream')` with `require('readable-stream')` +without any changes, if you are just using one of the main classes and +functions. + +```js +const { + Readable, + Writable, + Transform, + Duplex, + pipeline, + finished +} = require('readable-stream') +```` + +Note that `require('stream')` will return `Stream`, while +`require('readable-stream')` will return `Readable`. We discourage using +whatever is exported directly, but rather use one of the properties as +shown in the example above. + +# Streams Working Group + +`readable-stream` is maintained by the Streams Working Group, which +oversees the development and maintenance of the Streams API within +Node.js. The responsibilities of the Streams Working Group include: + +* Addressing stream issues on the Node.js issue tracker. +* Authoring and editing stream documentation within the Node.js project. +* Reviewing changes to stream subclasses within the Node.js project. +* Redirecting changes to streams from the Node.js project to this + project. +* Assisting in the implementation of stream providers within Node.js. +* Recommending versions of `readable-stream` to be included in Node.js. +* Messaging about the future of streams to give the community advance + notice of changes. + + +## Team Members + +* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) <calvin.metcalf@gmail.com> + - Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242 +* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) <mathiasbuus@gmail.com> +* **Matteo Collina** ([@mcollina](https://github.com/mcollina)) <matteo.collina@gmail.com> + - Release GPG key: 3ABC01543F22DD2239285CDD818674489FBC127E +* **Irina Shestak** ([@lrlna](https://github.com/lrlna)) <shestak.irina@gmail.com> +* **Yoshua Wyuts** ([@yoshuawuyts](https://github.com/yoshuawuyts)) <yoshuawuyts@gmail.com> + +[sauce]: https://saucelabs.com diff --git a/project starter code/node_modules/readable-stream/errors-browser.js b/project starter code/node_modules/readable-stream/errors-browser.js new file mode 100644 index 00000000..fb8e73e1 --- /dev/null +++ b/project starter code/node_modules/readable-stream/errors-browser.js @@ -0,0 +1,127 @@ +'use strict'; + +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } + +var codes = {}; + +function createErrorType(code, message, Base) { + if (!Base) { + Base = Error; + } + + function getMessage(arg1, arg2, arg3) { + if (typeof message === 'string') { + return message; + } else { + return message(arg1, arg2, arg3); + } + } + + var NodeError = + /*#__PURE__*/ + function (_Base) { + _inheritsLoose(NodeError, _Base); + + function NodeError(arg1, arg2, arg3) { + return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; + } + + return NodeError; + }(Base); + + NodeError.prototype.name = Base.name; + NodeError.prototype.code = code; + codes[code] = NodeError; +} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js + + +function oneOf(expected, thing) { + if (Array.isArray(expected)) { + var len = expected.length; + expected = expected.map(function (i) { + return String(i); + }); + + if (len > 2) { + return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1]; + } else if (len === 2) { + return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); + } else { + return "of ".concat(thing, " ").concat(expected[0]); + } + } else { + return "of ".concat(thing, " ").concat(String(expected)); + } +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith + + +function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith + + +function endsWith(str, search, this_len) { + if (this_len === undefined || this_len > str.length) { + this_len = str.length; + } + + return str.substring(this_len - search.length, this_len) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes + + +function includes(str, search, start) { + if (typeof start !== 'number') { + start = 0; + } + + if (start + search.length > str.length) { + return false; + } else { + return str.indexOf(search, start) !== -1; + } +} + +createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { + return 'The value "' + value + '" is invalid for option "' + name + '"'; +}, TypeError); +createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { + // determiner: 'must be' or 'must not be' + var determiner; + + if (typeof expected === 'string' && startsWith(expected, 'not ')) { + determiner = 'must not be'; + expected = expected.replace(/^not /, ''); + } else { + determiner = 'must be'; + } + + var msg; + + if (endsWith(name, ' argument')) { + // For cases like 'first argument' + msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } else { + var type = includes(name, '.') ? 'property' : 'argument'; + msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } + + msg += ". Received type ".concat(typeof actual); + return msg; +}, TypeError); +createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); +createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { + return 'The ' + name + ' method is not implemented'; +}); +createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); +createErrorType('ERR_STREAM_DESTROYED', function (name) { + return 'Cannot call ' + name + ' after a stream was destroyed'; +}); +createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); +createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); +createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); +createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); +createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { + return 'Unknown encoding: ' + arg; +}, TypeError); +createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); +module.exports.codes = codes; diff --git a/project starter code/node_modules/readable-stream/errors.js b/project starter code/node_modules/readable-stream/errors.js new file mode 100644 index 00000000..8471526d --- /dev/null +++ b/project starter code/node_modules/readable-stream/errors.js @@ -0,0 +1,116 @@ +'use strict'; + +const codes = {}; + +function createErrorType(code, message, Base) { + if (!Base) { + Base = Error + } + + function getMessage (arg1, arg2, arg3) { + if (typeof message === 'string') { + return message + } else { + return message(arg1, arg2, arg3) + } + } + + class NodeError extends Base { + constructor (arg1, arg2, arg3) { + super(getMessage(arg1, arg2, arg3)); + } + } + + NodeError.prototype.name = Base.name; + NodeError.prototype.code = code; + + codes[code] = NodeError; +} + +// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js +function oneOf(expected, thing) { + if (Array.isArray(expected)) { + const len = expected.length; + expected = expected.map((i) => String(i)); + if (len > 2) { + return `one of ${thing} ${expected.slice(0, len - 1).join(', ')}, or ` + + expected[len - 1]; + } else if (len === 2) { + return `one of ${thing} ${expected[0]} or ${expected[1]}`; + } else { + return `of ${thing} ${expected[0]}`; + } + } else { + return `of ${thing} ${String(expected)}`; + } +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith +function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith +function endsWith(str, search, this_len) { + if (this_len === undefined || this_len > str.length) { + this_len = str.length; + } + return str.substring(this_len - search.length, this_len) === search; +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes +function includes(str, search, start) { + if (typeof start !== 'number') { + start = 0; + } + + if (start + search.length > str.length) { + return false; + } else { + return str.indexOf(search, start) !== -1; + } +} + +createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { + return 'The value "' + value + '" is invalid for option "' + name + '"' +}, TypeError); +createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { + // determiner: 'must be' or 'must not be' + let determiner; + if (typeof expected === 'string' && startsWith(expected, 'not ')) { + determiner = 'must not be'; + expected = expected.replace(/^not /, ''); + } else { + determiner = 'must be'; + } + + let msg; + if (endsWith(name, ' argument')) { + // For cases like 'first argument' + msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`; + } else { + const type = includes(name, '.') ? 'property' : 'argument'; + msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, 'type')}`; + } + + msg += `. Received type ${typeof actual}`; + return msg; +}, TypeError); +createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); +createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { + return 'The ' + name + ' method is not implemented' +}); +createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); +createErrorType('ERR_STREAM_DESTROYED', function (name) { + return 'Cannot call ' + name + ' after a stream was destroyed'; +}); +createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); +createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); +createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); +createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); +createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { + return 'Unknown encoding: ' + arg +}, TypeError); +createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); + +module.exports.codes = codes; diff --git a/project starter code/node_modules/readable-stream/experimentalWarning.js b/project starter code/node_modules/readable-stream/experimentalWarning.js new file mode 100644 index 00000000..78e84149 --- /dev/null +++ b/project starter code/node_modules/readable-stream/experimentalWarning.js @@ -0,0 +1,17 @@ +'use strict' + +var experimentalWarnings = new Set(); + +function emitExperimentalWarning(feature) { + if (experimentalWarnings.has(feature)) return; + var msg = feature + ' is an experimental feature. This feature could ' + + 'change at any time'; + experimentalWarnings.add(feature); + process.emitWarning(msg, 'ExperimentalWarning'); +} + +function noop() {} + +module.exports.emitExperimentalWarning = process.emitWarning + ? emitExperimentalWarning + : noop; diff --git a/project starter code/node_modules/readable-stream/lib/_stream_duplex.js b/project starter code/node_modules/readable-stream/lib/_stream_duplex.js new file mode 100644 index 00000000..19abfa60 --- /dev/null +++ b/project starter code/node_modules/readable-stream/lib/_stream_duplex.js @@ -0,0 +1,126 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + +'use strict'; + +/**/ +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) keys.push(key); + return keys; +}; +/**/ + +module.exports = Duplex; +var Readable = require('./_stream_readable'); +var Writable = require('./_stream_writable'); +require('inherits')(Duplex, Readable); +{ + // Allow the keys array to be GC'ed. + var keys = objectKeys(Writable.prototype); + for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; + } +} +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + Readable.call(this, options); + Writable.call(this, options); + this.allowHalfOpen = true; + if (options) { + if (options.readable === false) this.readable = false; + if (options.writable === false) this.writable = false; + if (options.allowHalfOpen === false) { + this.allowHalfOpen = false; + this.once('end', onend); + } + } +} +Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); +Object.defineProperty(Duplex.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +Object.defineProperty(Duplex.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); + +// the no-half-open enforcer +function onend() { + // If the writable side ended, then we're ok. + if (this._writableState.ended) return; + + // no more data can be written. + // But allow more writes to happen in this tick. + process.nextTick(onEndNT, this); +} +function onEndNT(self) { + self.end(); +} +Object.defineProperty(Duplex.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined || this._writableState === undefined) { + return false; + } + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (this._readableState === undefined || this._writableState === undefined) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } +}); \ No newline at end of file diff --git a/project starter code/node_modules/readable-stream/lib/_stream_passthrough.js b/project starter code/node_modules/readable-stream/lib/_stream_passthrough.js new file mode 100644 index 00000000..24a6bdde --- /dev/null +++ b/project starter code/node_modules/readable-stream/lib/_stream_passthrough.js @@ -0,0 +1,37 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + +'use strict'; + +module.exports = PassThrough; +var Transform = require('./_stream_transform'); +require('inherits')(PassThrough, Transform); +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options); + Transform.call(this, options); +} +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk); +}; \ No newline at end of file diff --git a/project starter code/node_modules/readable-stream/lib/_stream_readable.js b/project starter code/node_modules/readable-stream/lib/_stream_readable.js new file mode 100644 index 00000000..df1f608d --- /dev/null +++ b/project starter code/node_modules/readable-stream/lib/_stream_readable.js @@ -0,0 +1,1027 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +module.exports = Readable; + +/**/ +var Duplex; +/**/ + +Readable.ReadableState = ReadableState; + +/**/ +var EE = require('events').EventEmitter; +var EElistenerCount = function EElistenerCount(emitter, type) { + return emitter.listeners(type).length; +}; +/**/ + +/**/ +var Stream = require('./internal/streams/stream'); +/**/ + +var Buffer = require('buffer').Buffer; +var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} + +/**/ +var debugUtil = require('util'); +var debug; +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function debug() {}; +} +/**/ + +var BufferList = require('./internal/streams/buffer_list'); +var destroyImpl = require('./internal/streams/destroy'); +var _require = require('./internal/streams/state'), + getHighWaterMark = _require.getHighWaterMark; +var _require$codes = require('../errors').codes, + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; + +// Lazy loaded to improve the startup performance. +var StringDecoder; +var createReadableStreamAsyncIterator; +var from; +require('inherits')(Readable, Stream); +var errorOrDestroy = destroyImpl.errorOrDestroy; +var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; +function prependListener(emitter, event, fn) { + // Sadly this is not cacheable as some libraries bundle their own + // event emitter implementation with them. + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); + + // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; +} +function ReadableState(options, stream, isDuplex) { + Duplex = Duplex || require('./_stream_duplex'); + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; + + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; + + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); + + // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; + + // a flag to be able to tell if the event 'readable'/'data' is emitted + // immediately, or on a later tick. We set this to true at first, because + // any actions that shouldn't happen until "later" should generally also + // not happen before the first read call. + this.sync = true; + + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + this.paused = true; + + // Should close be emitted on destroy. Defaults to true. + this.emitClose = options.emitClose !== false; + + // Should .destroy() be called after 'end' (and potentially 'finish') + this.autoDestroy = !!options.autoDestroy; + + // has it been destroyed + this.destroyed = false; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + + // if true, a maybeReadMore has been scheduled + this.readingMore = false; + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} +function Readable(options) { + Duplex = Duplex || require('./_stream_duplex'); + if (!(this instanceof Readable)) return new Readable(options); + + // Checking for a Stream.Duplex instance is faster here instead of inside + // the ReadableState constructor, at least with V8 6.5 + var isDuplex = this instanceof Duplex; + this._readableState = new ReadableState(options, this, isDuplex); + + // legacy + this.readable = true; + if (options) { + if (typeof options.read === 'function') this._read = options.read; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + } + Stream.call(this); +} +Object.defineProperty(Readable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined) { + return false; + } + return this._readableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._readableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + } +}); +Readable.prototype.destroy = destroyImpl.destroy; +Readable.prototype._undestroy = destroyImpl.undestroy; +Readable.prototype._destroy = function (err, cb) { + cb(err); +}; + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function (chunk, encoding) { + var state = this._readableState; + var skipChunkCheck; + if (!state.objectMode) { + if (typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = Buffer.from(chunk, encoding); + encoding = ''; + } + skipChunkCheck = true; + } + } else { + skipChunkCheck = true; + } + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function (chunk) { + return readableAddChunk(this, chunk, null, true, false); +}; +function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + debug('readableAddChunk', chunk); + var state = stream._readableState; + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) er = chunkInvalid(state, chunk); + if (er) { + errorOrDestroy(stream, er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } + if (addToFront) { + if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true); + } else if (state.ended) { + errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); + } else if (state.destroyed) { + return false; + } else { + state.reading = false; + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); + } + } + } else if (!addToFront) { + state.reading = false; + maybeReadMore(stream, state); + } + } + + // We can push more data if we are below the highWaterMark. + // Also, if we have no data yet, we can stand some more bytes. + // This is to work around cases where hwm=0, such as the repl. + return !state.ended && (state.length < state.highWaterMark || state.length === 0); +} +function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + state.awaitDrain = 0; + stream.emit('data', chunk); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + if (state.needReadable) emitReadable(stream); + } + maybeReadMore(stream, state); +} +function chunkInvalid(state, chunk) { + var er; + if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk); + } + return er; +} +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; + +// backwards compatibility. +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; + var decoder = new StringDecoder(enc); + this._readableState.decoder = decoder; + // If setEncoding(null), decoder.encoding equals utf8 + this._readableState.encoding = this._readableState.decoder.encoding; + + // Iterate over current buffer to convert already stored Buffers: + var p = this._readableState.buffer.head; + var content = ''; + while (p !== null) { + content += decoder.write(p.data); + p = p.next; + } + this._readableState.buffer.clear(); + if (content !== '') this._readableState.buffer.push(content); + this._readableState.length = content.length; + return this; +}; + +// Don't raise the hwm > 1GB +var MAX_HWM = 0x40000000; +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE. + n = MAX_HWM; + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } + return n; +} + +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) return 0; + if (state.objectMode) return 1; + if (n !== n) { + // Only flow one buffer at a time + if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; + } + // If we're asking for more than the current hwm, then raise the hwm. + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) return n; + // Don't have enough + if (!state.ended) { + state.needReadable = true; + return 0; + } + return state.length; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function (n) { + debug('read', n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + if (n !== 0) state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); + return null; + } + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this); + return null; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + debug('need readable', doRead); + + // if we currently have less than the highWaterMark, then also read some + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } else if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (!state.reading) n = howMuchToRead(nOrig, state); + } + var ret; + if (n > 0) ret = fromList(n, state);else ret = null; + if (ret === null) { + state.needReadable = state.length <= state.highWaterMark; + n = 0; + } else { + state.length -= n; + state.awaitDrain = 0; + } + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true; + + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended) endReadable(this); + } + if (ret !== null) this.emit('data', ret); + return ret; +}; +function onEofChunk(stream, state) { + debug('onEofChunk'); + if (state.ended) return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + if (state.sync) { + // if we are sync, wait until next tick to emit the data. + // Otherwise we risk emitting data in the flow() + // the readable code triggers during a read() call + emitReadable(stream); + } else { + // emit 'readable' now to make sure it gets picked up. + state.needReadable = false; + if (!state.emittedReadable) { + state.emittedReadable = true; + emitReadable_(stream); + } + } +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + debug('emitReadable', state.needReadable, state.emittedReadable); + state.needReadable = false; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + process.nextTick(emitReadable_, stream); + } +} +function emitReadable_(stream) { + var state = stream._readableState; + debug('emitReadable_', state.destroyed, state.length, state.ended); + if (!state.destroyed && (state.length || state.ended)) { + stream.emit('readable'); + state.emittedReadable = false; + } + + // The stream needs another readable event if + // 1. It is not flowing, as the flow mechanism will take + // care of it. + // 2. It is not ended. + // 3. It is below the highWaterMark, so we can schedule + // another readable later. + state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; + flow(stream); +} + +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + process.nextTick(maybeReadMore_, stream, state); + } +} +function maybeReadMore_(stream, state) { + // Attempt to read more data if we should. + // + // The conditions for reading more data are (one of): + // - Not enough data buffered (state.length < state.highWaterMark). The loop + // is responsible for filling the buffer with enough data if such data + // is available. If highWaterMark is 0 and we are not in the flowing mode + // we should _not_ attempt to buffer any extra data. We'll get more data + // when the stream consumer calls read() instead. + // - No data in the buffer, and the stream is in flowing mode. In this mode + // the loop below is responsible for ensuring read() is called. Failing to + // call read here would abort the flow and there's no other mechanism for + // continuing the flow if the stream consumer has just subscribed to the + // 'data' event. + // + // In addition to the above conditions to keep reading data, the following + // conditions prevent the data from being read: + // - The stream has ended (state.ended). + // - There is already a pending 'read' operation (state.reading). This is a + // case where the the stream has called the implementation defined _read() + // method, but they are processing the call asynchronously and have _not_ + // called push() with new data. In this case we skip performing more + // read()s. The execution ends in this method again after the _read() ends + // up calling push() with more data. + while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { + var len = state.length; + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break; + } + state.readingMore = false; +} + +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function (n) { + errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()')); +}; +Readable.prototype.pipe = function (dest, pipeOpts) { + var src = this; + var state = this._readableState; + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + var endFn = doEnd ? onend : unpipe; + if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn); + dest.on('unpipe', onunpipe); + function onunpipe(readable, unpipeInfo) { + debug('onunpipe'); + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } + } + } + function onend() { + debug('onend'); + dest.end(); + } + + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + var cleanedUp = false; + function cleanup() { + debug('cleanup'); + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', unpipe); + src.removeListener('data', ondata); + cleanedUp = true; + + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); + } + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + var ret = dest.write(chunk); + debug('dest.write', ret); + if (ret === false) { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug('false write response, pause', state.awaitDrain); + state.awaitDrain++; + } + src.pause(); + } + } + + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er); + } + + // Make sure our error handler is attached before userland ones. + prependListener(dest, 'error', onerror); + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } + + // tell the dest that it's being piped to + dest.emit('pipe', src); + + // start the flow if it hasn't been started already. + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } + return dest; +}; +function pipeOnDrain(src) { + return function pipeOnDrainFunctionResult() { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { + state.flowing = true; + flow(src); + } + }; +} +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + var unpipeInfo = { + hasUnpiped: false + }; + + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) return this; + if (!dest) dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this, unpipeInfo); + return this; + } + + // slow case. multiple pipe destinations. + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + for (var i = 0; i < len; i++) dests[i].emit('unpipe', this, { + hasUnpiped: false + }); + return this; + } + + // try to find the right one. + var index = indexOf(state.pipes, dest); + if (index === -1) return this; + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; + dest.emit('unpipe', this, unpipeInfo); + return this; +}; + +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function (ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + var state = this._readableState; + if (ev === 'data') { + // update readableListening so that resume() may be a no-op + // a few lines down. This is needed to support once('readable'). + state.readableListening = this.listenerCount('readable') > 0; + + // Try start flowing on next tick if stream isn't explicitly paused + if (state.flowing !== false) this.resume(); + } else if (ev === 'readable') { + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.flowing = false; + state.emittedReadable = false; + debug('on readable', state.length, state.reading); + if (state.length) { + emitReadable(this); + } else if (!state.reading) { + process.nextTick(nReadingNextTick, this); + } + } + } + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; +Readable.prototype.removeListener = function (ev, fn) { + var res = Stream.prototype.removeListener.call(this, ev, fn); + if (ev === 'readable') { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } + return res; +}; +Readable.prototype.removeAllListeners = function (ev) { + var res = Stream.prototype.removeAllListeners.apply(this, arguments); + if (ev === 'readable' || ev === undefined) { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } + return res; +}; +function updateReadableListening(self) { + var state = self._readableState; + state.readableListening = self.listenerCount('readable') > 0; + if (state.resumeScheduled && !state.paused) { + // flowing needs to be set to true now, otherwise + // the upcoming resume will not flow. + state.flowing = true; + + // crude way to check if we should resume + } else if (self.listenerCount('data') > 0) { + self.resume(); + } +} +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.read(0); +} + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function () { + var state = this._readableState; + if (!state.flowing) { + debug('resume'); + // we flow only if there is no one listening + // for readable, but we still have to call + // resume() + state.flowing = !state.readableListening; + resume(this, state); + } + state.paused = false; + return this; +}; +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + process.nextTick(resume_, stream, state); + } +} +function resume_(stream, state) { + debug('resume', state.reading); + if (!state.reading) { + stream.read(0); + } + state.resumeScheduled = false; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) stream.read(0); +} +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing); + if (this._readableState.flowing !== false) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + this._readableState.paused = true; + return this; +}; +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); + while (state.flowing && stream.read() !== null); +} + +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function (stream) { + var _this = this; + var state = this._readableState; + var paused = false; + stream.on('end', function () { + debug('wrapped end'); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) _this.push(chunk); + } + _this.push(null); + }); + stream.on('data', function (chunk) { + debug('wrapped data'); + if (state.decoder) chunk = state.decoder.write(chunk); + + // don't skip over falsy values in objectMode + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; + var ret = _this.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function methodWrap(method) { + return function methodWrapReturnFunction() { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } + + // proxy certain important events. + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } + + // when we try to consume some more bytes, simply unpause the + // underlying stream. + this._read = function (n) { + debug('wrapped _read', n); + if (paused) { + paused = false; + stream.resume(); + } + }; + return this; +}; +if (typeof Symbol === 'function') { + Readable.prototype[Symbol.asyncIterator] = function () { + if (createReadableStreamAsyncIterator === undefined) { + createReadableStreamAsyncIterator = require('./internal/streams/async_iterator'); + } + return createReadableStreamAsyncIterator(this); + }; +} +Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.highWaterMark; + } +}); +Object.defineProperty(Readable.prototype, 'readableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState && this._readableState.buffer; + } +}); +Object.defineProperty(Readable.prototype, 'readableFlowing', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.flowing; + }, + set: function set(state) { + if (this._readableState) { + this._readableState.flowing = state; + } + } +}); + +// exposed for testing purposes only. +Readable._fromList = fromList; +Object.defineProperty(Readable.prototype, 'readableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.length; + } +}); + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromList(n, state) { + // nothing buffered + if (state.length === 0) return null; + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = state.buffer.consume(n, state.decoder); + } + return ret; +} +function endReadable(stream) { + var state = stream._readableState; + debug('endReadable', state.endEmitted); + if (!state.endEmitted) { + state.ended = true; + process.nextTick(endReadableNT, state, stream); + } +} +function endReadableNT(state, stream) { + debug('endReadableNT', state.endEmitted, state.length); + + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the writable side is ready for autoDestroy as well + var wState = stream._writableState; + if (!wState || wState.autoDestroy && wState.finished) { + stream.destroy(); + } + } + } +} +if (typeof Symbol === 'function') { + Readable.from = function (iterable, opts) { + if (from === undefined) { + from = require('./internal/streams/from'); + } + return from(Readable, iterable, opts); + }; +} +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} \ No newline at end of file diff --git a/project starter code/node_modules/readable-stream/lib/_stream_transform.js b/project starter code/node_modules/readable-stream/lib/_stream_transform.js new file mode 100644 index 00000000..1ccb7157 --- /dev/null +++ b/project starter code/node_modules/readable-stream/lib/_stream_transform.js @@ -0,0 +1,190 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + +'use strict'; + +module.exports = Transform; +var _require$codes = require('../errors').codes, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, + ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; +var Duplex = require('./_stream_duplex'); +require('inherits')(Transform, Duplex); +function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + var cb = ts.writecb; + if (cb === null) { + return this.emit('error', new ERR_MULTIPLE_CALLBACK()); + } + ts.writechunk = null; + ts.writecb = null; + if (data != null) + // single equals check for both `null` and `undefined` + this.push(data); + cb(er); + var rs = this._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); + } +} +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + Duplex.call(this, options); + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null + }; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform; + if (typeof options.flush === 'function') this._flush = options.flush; + } + + // When the writable side finishes, then flush out anything remaining. + this.on('prefinish', prefinish); +} +function prefinish() { + var _this = this; + if (typeof this._flush === 'function' && !this._readableState.destroyed) { + this._flush(function (er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } +} +Transform.prototype.push = function (chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()')); +}; +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function (n) { + var ts = this._transformState; + if (ts.writechunk !== null && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; +Transform.prototype._destroy = function (err, cb) { + Duplex.prototype._destroy.call(this, err, function (err2) { + cb(err2); + }); +}; +function done(stream, er, data) { + if (er) return stream.emit('error', er); + if (data != null) + // single equals check for both `null` and `undefined` + stream.push(data); + + // TODO(BridgeAR): Write a test for these two error cases + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0(); + if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); + return stream.push(null); +} \ No newline at end of file diff --git a/project starter code/node_modules/readable-stream/lib/_stream_writable.js b/project starter code/node_modules/readable-stream/lib/_stream_writable.js new file mode 100644 index 00000000..292415e2 --- /dev/null +++ b/project starter code/node_modules/readable-stream/lib/_stream_writable.js @@ -0,0 +1,641 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. + +'use strict'; + +module.exports = Writable; + +/* */ +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} + +// It seems a linked list but it is not +// there will be only 2 of these for each stream +function CorkedRequest(state) { + var _this = this; + this.next = null; + this.entry = null; + this.finish = function () { + onCorkedFinish(_this, state); + }; +} +/* */ + +/**/ +var Duplex; +/**/ + +Writable.WritableState = WritableState; + +/**/ +var internalUtil = { + deprecate: require('util-deprecate') +}; +/**/ + +/**/ +var Stream = require('./internal/streams/stream'); +/**/ + +var Buffer = require('buffer').Buffer; +var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} +var destroyImpl = require('./internal/streams/destroy'); +var _require = require('./internal/streams/state'), + getHighWaterMark = _require.getHighWaterMark; +var _require$codes = require('../errors').codes, + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, + ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, + ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, + ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; +var errorOrDestroy = destroyImpl.errorOrDestroy; +require('inherits')(Writable, Stream); +function nop() {} +function WritableState(options, stream, isDuplex) { + Duplex = Duplex || require('./_stream_duplex'); + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream, + // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); + + // if _final has been called + this.finalCalled = false; + + // drain event flag. + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // has it been destroyed + this.destroyed = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // when true all writes will be buffered until .uncork() call + this.corked = 0; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function (er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + this.bufferedRequest = null; + this.lastBufferedRequest = null; + + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; + + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; + + // Should close be emitted on destroy. Defaults to true. + this.emitClose = options.emitClose !== false; + + // Should .destroy() be called after 'finish' (and potentially 'end') + this.autoDestroy = !!options.autoDestroy; + + // count buffered requests + this.bufferedRequestCount = 0; + + // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two + this.corkedRequestsFree = new CorkedRequest(this); +} +WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; + } + return out; +}; +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function writableStateBufferGetter() { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') + }); + } catch (_) {} +})(); + +// Test _writableState for inheritance to account for Duplex streams, +// whose prototype chain only points to Readable. +var realHasInstance; +if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function value(object) { + if (realHasInstance.call(this, object)) return true; + if (this !== Writable) return false; + return object && object._writableState instanceof WritableState; + } + }); +} else { + realHasInstance = function realHasInstance(object) { + return object instanceof this; + }; +} +function Writable(options) { + Duplex = Duplex || require('./_stream_duplex'); + + // Writable ctor is applied to Duplexes, too. + // `realHasInstance` is necessary because using plain `instanceof` + // would return false, as no `_writableState` property is attached. + + // Trying to use the custom `instanceof` for Writable here will also break the + // Node.js LazyTransform implementation, which has a non-trivial getter for + // `_writableState` that would lead to infinite recursion. + + // Checking for a Stream.Duplex instance is faster here instead of inside + // the WritableState constructor, at least with V8 6.5 + var isDuplex = this instanceof Duplex; + if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); + this._writableState = new WritableState(options, this, isDuplex); + + // legacy. + this.writable = true; + if (options) { + if (typeof options.write === 'function') this._write = options.write; + if (typeof options.writev === 'function') this._writev = options.writev; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + if (typeof options.final === 'function') this._final = options.final; + } + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function () { + errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); +}; +function writeAfterEnd(stream, cb) { + var er = new ERR_STREAM_WRITE_AFTER_END(); + // TODO: defer error events consistently everywhere, not just the cb + errorOrDestroy(stream, er); + process.nextTick(cb, er); +} + +// Checks that a user-supplied chunk is valid, especially for the particular +// mode the stream is in. Currently this means that `null` is never accepted +// and undefined/non-string values are only allowed in object mode. +function validChunk(stream, state, chunk, cb) { + var er; + if (chunk === null) { + er = new ERR_STREAM_NULL_VALUES(); + } else if (typeof chunk !== 'string' && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk); + } + if (er) { + errorOrDestroy(stream, er); + process.nextTick(cb, er); + return false; + } + return true; +} +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + var isBuf = !state.objectMode && _isUint8Array(chunk); + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + if (typeof cb !== 'function') cb = nop; + if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + } + return ret; +}; +Writable.prototype.cork = function () { + this._writableState.corked++; +}; +Writable.prototype.uncork = function () { + var state = this._writableState; + if (state.corked) { + state.corked--; + if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; +Object.defineProperty(Writable.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + return chunk; +} +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; + } + } + var len = state.objectMode ? 1 : chunk.length; + state.length += len; + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) state.needDrain = true; + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } + return ret; +} +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + if (sync) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + process.nextTick(cb, er); + // this can emit finish, and it will always happen + // after error + process.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + // this can emit finish, but finish must + // always follow error + finishMaybe(stream, state); + } +} +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); + onwriteStateUpdate(state); + if (er) onwriteError(stream, state, sync, er, cb);else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state) || stream.destroyed; + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + if (sync) { + process.nextTick(afterWrite, stream, state, finished, cb); + } else { + afterWrite(stream, state, finished, cb); + } + } +} +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + var count = 0; + var allBuffers = true; + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; + entry = entry.next; + count += 1; + } + buffer.allBuffers = allBuffers; + doWrite(stream, state, true, state.length, buffer, '', holder.finish); + + // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + state.bufferedRequestCount = 0; + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + state.bufferedRequestCount--; + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + break; + } + } + if (entry === null) state.lastBufferedRequest = null; + } + state.bufferedRequest = entry; + state.bufferProcessing = false; +} +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); +}; +Writable.prototype._writev = null; +Writable.prototype.end = function (chunk, encoding, cb) { + var state = this._writableState; + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); + + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } + + // ignore unnecessary end() calls. + if (!state.ending) endWritable(this, state, cb); + return this; +}; +Object.defineProperty(Writable.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} +function callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; + if (err) { + errorOrDestroy(stream, err); + } + state.prefinished = true; + stream.emit('prefinish'); + finishMaybe(stream, state); + }); +} +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function' && !state.destroyed) { + state.pendingcb++; + state.finalCalled = true; + process.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit('prefinish'); + } + } +} +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { + state.finished = true; + stream.emit('finish'); + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the readable side is ready for autoDestroy as well + var rState = stream._readableState; + if (!rState || rState.autoDestroy && rState.endEmitted) { + stream.destroy(); + } + } + } + } + return need; +} +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) process.nextTick(cb);else stream.once('finish', cb); + } + state.ended = true; + stream.writable = false; +} +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } + + // reuse the free corkReq. + state.corkedRequestsFree.next = corkReq; +} +Object.defineProperty(Writable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._writableState === undefined) { + return false; + } + return this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._writableState.destroyed = value; + } +}); +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; +Writable.prototype._destroy = function (err, cb) { + cb(err); +}; \ No newline at end of file diff --git a/project starter code/node_modules/readable-stream/lib/internal/streams/async_iterator.js b/project starter code/node_modules/readable-stream/lib/internal/streams/async_iterator.js new file mode 100644 index 00000000..742c5a46 --- /dev/null +++ b/project starter code/node_modules/readable-stream/lib/internal/streams/async_iterator.js @@ -0,0 +1,180 @@ +'use strict'; + +var _Object$setPrototypeO; +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var finished = require('./end-of-stream'); +var kLastResolve = Symbol('lastResolve'); +var kLastReject = Symbol('lastReject'); +var kError = Symbol('error'); +var kEnded = Symbol('ended'); +var kLastPromise = Symbol('lastPromise'); +var kHandlePromise = Symbol('handlePromise'); +var kStream = Symbol('stream'); +function createIterResult(value, done) { + return { + value: value, + done: done + }; +} +function readAndResolve(iter) { + var resolve = iter[kLastResolve]; + if (resolve !== null) { + var data = iter[kStream].read(); + // we defer if data is null + // we can be expecting either 'end' or + // 'error' + if (data !== null) { + iter[kLastPromise] = null; + iter[kLastResolve] = null; + iter[kLastReject] = null; + resolve(createIterResult(data, false)); + } + } +} +function onReadable(iter) { + // we wait for the next tick, because it might + // emit an error with process.nextTick + process.nextTick(readAndResolve, iter); +} +function wrapForNext(lastPromise, iter) { + return function (resolve, reject) { + lastPromise.then(function () { + if (iter[kEnded]) { + resolve(createIterResult(undefined, true)); + return; + } + iter[kHandlePromise](resolve, reject); + }, reject); + }; +} +var AsyncIteratorPrototype = Object.getPrototypeOf(function () {}); +var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { + get stream() { + return this[kStream]; + }, + next: function next() { + var _this = this; + // if we have detected an error in the meanwhile + // reject straight away + var error = this[kError]; + if (error !== null) { + return Promise.reject(error); + } + if (this[kEnded]) { + return Promise.resolve(createIterResult(undefined, true)); + } + if (this[kStream].destroyed) { + // We need to defer via nextTick because if .destroy(err) is + // called, the error will be emitted via nextTick, and + // we cannot guarantee that there is no error lingering around + // waiting to be emitted. + return new Promise(function (resolve, reject) { + process.nextTick(function () { + if (_this[kError]) { + reject(_this[kError]); + } else { + resolve(createIterResult(undefined, true)); + } + }); + }); + } + + // if we have multiple next() calls + // we will wait for the previous Promise to finish + // this logic is optimized to support for await loops, + // where next() is only called once at a time + var lastPromise = this[kLastPromise]; + var promise; + if (lastPromise) { + promise = new Promise(wrapForNext(lastPromise, this)); + } else { + // fast path needed to support multiple this.push() + // without triggering the next() queue + var data = this[kStream].read(); + if (data !== null) { + return Promise.resolve(createIterResult(data, false)); + } + promise = new Promise(this[kHandlePromise]); + } + this[kLastPromise] = promise; + return promise; + } +}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () { + return this; +}), _defineProperty(_Object$setPrototypeO, "return", function _return() { + var _this2 = this; + // destroy(err, cb) is a private API + // we can guarantee we have that here, because we control the + // Readable class this is attached to + return new Promise(function (resolve, reject) { + _this2[kStream].destroy(null, function (err) { + if (err) { + reject(err); + return; + } + resolve(createIterResult(undefined, true)); + }); + }); +}), _Object$setPrototypeO), AsyncIteratorPrototype); +var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { + var _Object$create; + var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { + value: stream, + writable: true + }), _defineProperty(_Object$create, kLastResolve, { + value: null, + writable: true + }), _defineProperty(_Object$create, kLastReject, { + value: null, + writable: true + }), _defineProperty(_Object$create, kError, { + value: null, + writable: true + }), _defineProperty(_Object$create, kEnded, { + value: stream._readableState.endEmitted, + writable: true + }), _defineProperty(_Object$create, kHandlePromise, { + value: function value(resolve, reject) { + var data = iterator[kStream].read(); + if (data) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(data, false)); + } else { + iterator[kLastResolve] = resolve; + iterator[kLastReject] = reject; + } + }, + writable: true + }), _Object$create)); + iterator[kLastPromise] = null; + finished(stream, function (err) { + if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { + var reject = iterator[kLastReject]; + // reject if we are waiting for data in the Promise + // returned by next() and store the error + if (reject !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + reject(err); + } + iterator[kError] = err; + return; + } + var resolve = iterator[kLastResolve]; + if (resolve !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(undefined, true)); + } + iterator[kEnded] = true; + }); + stream.on('readable', onReadable.bind(null, iterator)); + return iterator; +}; +module.exports = createReadableStreamAsyncIterator; \ No newline at end of file diff --git a/project starter code/node_modules/readable-stream/lib/internal/streams/buffer_list.js b/project starter code/node_modules/readable-stream/lib/internal/streams/buffer_list.js new file mode 100644 index 00000000..69bda497 --- /dev/null +++ b/project starter code/node_modules/readable-stream/lib/internal/streams/buffer_list.js @@ -0,0 +1,183 @@ +'use strict'; + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var _require = require('buffer'), + Buffer = _require.Buffer; +var _require2 = require('util'), + inspect = _require2.inspect; +var custom = inspect && inspect.custom || 'inspect'; +function copyBuffer(src, target, offset) { + Buffer.prototype.copy.call(src, target, offset); +} +module.exports = /*#__PURE__*/function () { + function BufferList() { + _classCallCheck(this, BufferList); + this.head = null; + this.tail = null; + this.length = 0; + } + _createClass(BufferList, [{ + key: "push", + value: function push(v) { + var entry = { + data: v, + next: null + }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; + } + }, { + key: "unshift", + value: function unshift(v) { + var entry = { + data: v, + next: this.head + }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + } + }, { + key: "shift", + value: function shift() { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; + } + }, { + key: "clear", + value: function clear() { + this.head = this.tail = null; + this.length = 0; + } + }, { + key: "join", + value: function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + while (p = p.next) ret += s + p.data; + return ret; + } + }, { + key: "concat", + value: function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + var ret = Buffer.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } + return ret; + } + + // Consumes a specified amount of bytes or characters from the buffered data. + }, { + key: "consume", + value: function consume(n, hasStrings) { + var ret; + if (n < this.head.data.length) { + // `slice` is the same for buffers and strings. + ret = this.head.data.slice(0, n); + this.head.data = this.head.data.slice(n); + } else if (n === this.head.data.length) { + // First chunk is a perfect match. + ret = this.shift(); + } else { + // Result spans more than one buffer. + ret = hasStrings ? this._getString(n) : this._getBuffer(n); + } + return ret; + } + }, { + key: "first", + value: function first() { + return this.head.data; + } + + // Consumes a specified amount of characters from the buffered data. + }, { + key: "_getString", + value: function _getString(n) { + var p = this.head; + var c = 1; + var ret = p.data; + n -= ret.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) ret += str;else ret += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = str.slice(nb); + } + break; + } + ++c; + } + this.length -= c; + return ret; + } + + // Consumes a specified amount of bytes from the buffered data. + }, { + key: "_getBuffer", + value: function _getBuffer(n) { + var ret = Buffer.allocUnsafe(n); + var p = this.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret, ret.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = buf.slice(nb); + } + break; + } + ++c; + } + this.length -= c; + return ret; + } + + // Make sure the linked list only shows the minimal necessary information. + }, { + key: custom, + value: function value(_, options) { + return inspect(this, _objectSpread(_objectSpread({}, options), {}, { + // Only inspect one level. + depth: 0, + // It should not recurse. + customInspect: false + })); + } + }]); + return BufferList; +}(); \ No newline at end of file diff --git a/project starter code/node_modules/readable-stream/lib/internal/streams/destroy.js b/project starter code/node_modules/readable-stream/lib/internal/streams/destroy.js new file mode 100644 index 00000000..31a17c4d --- /dev/null +++ b/project starter code/node_modules/readable-stream/lib/internal/streams/destroy.js @@ -0,0 +1,96 @@ +'use strict'; + +// undocumented cb() API, needed for core, not for public API +function destroy(err, cb) { + var _this = this; + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + process.nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + process.nextTick(emitErrorNT, this, err); + } + } + return this; + } + + // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks + + if (this._readableState) { + this._readableState.destroyed = true; + } + + // if this is a duplex stream mark the writable part as destroyed as well + if (this._writableState) { + this._writableState.destroyed = true; + } + this._destroy(err || null, function (err) { + if (!cb && err) { + if (!_this._writableState) { + process.nextTick(emitErrorAndCloseNT, _this, err); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + process.nextTick(emitErrorAndCloseNT, _this, err); + } else { + process.nextTick(emitCloseNT, _this); + } + } else if (cb) { + process.nextTick(emitCloseNT, _this); + cb(err); + } else { + process.nextTick(emitCloseNT, _this); + } + }); + return this; +} +function emitErrorAndCloseNT(self, err) { + emitErrorNT(self, err); + emitCloseNT(self); +} +function emitCloseNT(self) { + if (self._writableState && !self._writableState.emitClose) return; + if (self._readableState && !self._readableState.emitClose) return; + self.emit('close'); +} +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; + } + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; + } +} +function emitErrorNT(self, err) { + self.emit('error', err); +} +function errorOrDestroy(stream, err) { + // We have tests that rely on errors being emitted + // in the same tick, so changing this is semver major. + // For now when you opt-in to autoDestroy we allow + // the error to be emitted nextTick. In a future + // semver major update we should change the default to this. + + var rState = stream._readableState; + var wState = stream._writableState; + if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); +} +module.exports = { + destroy: destroy, + undestroy: undestroy, + errorOrDestroy: errorOrDestroy +}; \ No newline at end of file diff --git a/project starter code/node_modules/readable-stream/lib/internal/streams/end-of-stream.js b/project starter code/node_modules/readable-stream/lib/internal/streams/end-of-stream.js new file mode 100644 index 00000000..59c671b5 --- /dev/null +++ b/project starter code/node_modules/readable-stream/lib/internal/streams/end-of-stream.js @@ -0,0 +1,86 @@ +// Ported from https://github.com/mafintosh/end-of-stream with +// permission from the author, Mathias Buus (@mafintosh). + +'use strict'; + +var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE; +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + callback.apply(this, args); + }; +} +function noop() {} +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} +function eos(stream, opts, callback) { + if (typeof opts === 'function') return eos(stream, null, opts); + if (!opts) opts = {}; + callback = once(callback || noop); + var readable = opts.readable || opts.readable !== false && stream.readable; + var writable = opts.writable || opts.writable !== false && stream.writable; + var onlegacyfinish = function onlegacyfinish() { + if (!stream.writable) onfinish(); + }; + var writableEnded = stream._writableState && stream._writableState.finished; + var onfinish = function onfinish() { + writable = false; + writableEnded = true; + if (!readable) callback.call(stream); + }; + var readableEnded = stream._readableState && stream._readableState.endEmitted; + var onend = function onend() { + readable = false; + readableEnded = true; + if (!writable) callback.call(stream); + }; + var onerror = function onerror(err) { + callback.call(stream, err); + }; + var onclose = function onclose() { + var err; + if (readable && !readableEnded) { + if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + if (writable && !writableEnded) { + if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + }; + var onrequest = function onrequest() { + stream.req.on('finish', onfinish); + }; + if (isRequest(stream)) { + stream.on('complete', onfinish); + stream.on('abort', onclose); + if (stream.req) onrequest();else stream.on('request', onrequest); + } else if (writable && !stream._writableState) { + // legacy streams + stream.on('end', onlegacyfinish); + stream.on('close', onlegacyfinish); + } + stream.on('end', onend); + stream.on('finish', onfinish); + if (opts.error !== false) stream.on('error', onerror); + stream.on('close', onclose); + return function () { + stream.removeListener('complete', onfinish); + stream.removeListener('abort', onclose); + stream.removeListener('request', onrequest); + if (stream.req) stream.req.removeListener('finish', onfinish); + stream.removeListener('end', onlegacyfinish); + stream.removeListener('close', onlegacyfinish); + stream.removeListener('finish', onfinish); + stream.removeListener('end', onend); + stream.removeListener('error', onerror); + stream.removeListener('close', onclose); + }; +} +module.exports = eos; \ No newline at end of file diff --git a/project starter code/node_modules/readable-stream/lib/internal/streams/from-browser.js b/project starter code/node_modules/readable-stream/lib/internal/streams/from-browser.js new file mode 100644 index 00000000..a4ce56f3 --- /dev/null +++ b/project starter code/node_modules/readable-stream/lib/internal/streams/from-browser.js @@ -0,0 +1,3 @@ +module.exports = function () { + throw new Error('Readable.from is not available in the browser') +}; diff --git a/project starter code/node_modules/readable-stream/lib/internal/streams/from.js b/project starter code/node_modules/readable-stream/lib/internal/streams/from.js new file mode 100644 index 00000000..0a34ee92 --- /dev/null +++ b/project starter code/node_modules/readable-stream/lib/internal/streams/from.js @@ -0,0 +1,52 @@ +'use strict'; + +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var ERR_INVALID_ARG_TYPE = require('../../../errors').codes.ERR_INVALID_ARG_TYPE; +function from(Readable, iterable, opts) { + var iterator; + if (iterable && typeof iterable.next === 'function') { + iterator = iterable; + } else if (iterable && iterable[Symbol.asyncIterator]) iterator = iterable[Symbol.asyncIterator]();else if (iterable && iterable[Symbol.iterator]) iterator = iterable[Symbol.iterator]();else throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable); + var readable = new Readable(_objectSpread({ + objectMode: true + }, opts)); + // Reading boolean to protect against _read + // being called before last iteration completion. + var reading = false; + readable._read = function () { + if (!reading) { + reading = true; + next(); + } + }; + function next() { + return _next2.apply(this, arguments); + } + function _next2() { + _next2 = _asyncToGenerator(function* () { + try { + var _yield$iterator$next = yield iterator.next(), + value = _yield$iterator$next.value, + done = _yield$iterator$next.done; + if (done) { + readable.push(null); + } else if (readable.push(yield value)) { + next(); + } else { + reading = false; + } + } catch (err) { + readable.destroy(err); + } + }); + return _next2.apply(this, arguments); + } + return readable; +} +module.exports = from; diff --git a/project starter code/node_modules/readable-stream/lib/internal/streams/pipeline.js b/project starter code/node_modules/readable-stream/lib/internal/streams/pipeline.js new file mode 100644 index 00000000..e6f39241 --- /dev/null +++ b/project starter code/node_modules/readable-stream/lib/internal/streams/pipeline.js @@ -0,0 +1,86 @@ +// Ported from https://github.com/mafintosh/pump with +// permission from the author, Mathias Buus (@mafintosh). + +'use strict'; + +var eos; +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + callback.apply(void 0, arguments); + }; +} +var _require$codes = require('../../../errors').codes, + ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; +function noop(err) { + // Rethrow the error if it exists to avoid swallowing it + if (err) throw err; +} +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} +function destroyer(stream, reading, writing, callback) { + callback = once(callback); + var closed = false; + stream.on('close', function () { + closed = true; + }); + if (eos === undefined) eos = require('./end-of-stream'); + eos(stream, { + readable: reading, + writable: writing + }, function (err) { + if (err) return callback(err); + closed = true; + callback(); + }); + var destroyed = false; + return function (err) { + if (closed) return; + if (destroyed) return; + destroyed = true; + + // request.destroy just do .end - .abort is what we want + if (isRequest(stream)) return stream.abort(); + if (typeof stream.destroy === 'function') return stream.destroy(); + callback(err || new ERR_STREAM_DESTROYED('pipe')); + }; +} +function call(fn) { + fn(); +} +function pipe(from, to) { + return from.pipe(to); +} +function popCallback(streams) { + if (!streams.length) return noop; + if (typeof streams[streams.length - 1] !== 'function') return noop; + return streams.pop(); +} +function pipeline() { + for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { + streams[_key] = arguments[_key]; + } + var callback = popCallback(streams); + if (Array.isArray(streams[0])) streams = streams[0]; + if (streams.length < 2) { + throw new ERR_MISSING_ARGS('streams'); + } + var error; + var destroys = streams.map(function (stream, i) { + var reading = i < streams.length - 1; + var writing = i > 0; + return destroyer(stream, reading, writing, function (err) { + if (!error) error = err; + if (err) destroys.forEach(call); + if (reading) return; + destroys.forEach(call); + callback(error); + }); + }); + return streams.reduce(pipe); +} +module.exports = pipeline; \ No newline at end of file diff --git a/project starter code/node_modules/readable-stream/lib/internal/streams/state.js b/project starter code/node_modules/readable-stream/lib/internal/streams/state.js new file mode 100644 index 00000000..3fbf8927 --- /dev/null +++ b/project starter code/node_modules/readable-stream/lib/internal/streams/state.js @@ -0,0 +1,22 @@ +'use strict'; + +var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE; +function highWaterMarkFrom(options, isDuplex, duplexKey) { + return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; +} +function getHighWaterMark(state, options, duplexKey, isDuplex) { + var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); + if (hwm != null) { + if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { + var name = isDuplex ? duplexKey : 'highWaterMark'; + throw new ERR_INVALID_OPT_VALUE(name, hwm); + } + return Math.floor(hwm); + } + + // Default value + return state.objectMode ? 16 : 16 * 1024; +} +module.exports = { + getHighWaterMark: getHighWaterMark +}; \ No newline at end of file diff --git a/project starter code/node_modules/readable-stream/lib/internal/streams/stream-browser.js b/project starter code/node_modules/readable-stream/lib/internal/streams/stream-browser.js new file mode 100644 index 00000000..9332a3fd --- /dev/null +++ b/project starter code/node_modules/readable-stream/lib/internal/streams/stream-browser.js @@ -0,0 +1 @@ +module.exports = require('events').EventEmitter; diff --git a/project starter code/node_modules/readable-stream/lib/internal/streams/stream.js b/project starter code/node_modules/readable-stream/lib/internal/streams/stream.js new file mode 100644 index 00000000..ce2ad5b6 --- /dev/null +++ b/project starter code/node_modules/readable-stream/lib/internal/streams/stream.js @@ -0,0 +1 @@ +module.exports = require('stream'); diff --git a/project starter code/node_modules/readable-stream/package.json b/project starter code/node_modules/readable-stream/package.json new file mode 100644 index 00000000..ade59e71 --- /dev/null +++ b/project starter code/node_modules/readable-stream/package.json @@ -0,0 +1,68 @@ +{ + "name": "readable-stream", + "version": "3.6.2", + "description": "Streams3, a user-land copy of the stream library from Node.js", + "main": "readable.js", + "engines": { + "node": ">= 6" + }, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "devDependencies": { + "@babel/cli": "^7.2.0", + "@babel/core": "^7.2.0", + "@babel/polyfill": "^7.0.0", + "@babel/preset-env": "^7.2.0", + "airtap": "0.0.9", + "assert": "^1.4.0", + "bl": "^2.0.0", + "deep-strict-equal": "^0.2.0", + "events.once": "^2.0.2", + "glob": "^7.1.2", + "gunzip-maybe": "^1.4.1", + "hyperquest": "^2.1.3", + "lolex": "^2.6.0", + "nyc": "^11.0.0", + "pump": "^3.0.0", + "rimraf": "^2.6.2", + "tap": "^12.0.0", + "tape": "^4.9.0", + "tar-fs": "^1.16.2", + "util-promisify": "^2.1.0" + }, + "scripts": { + "test": "tap -J --no-esm test/parallel/*.js test/ours/*.js", + "ci": "TAP=1 tap --no-esm test/parallel/*.js test/ours/*.js | tee test.tap", + "test-browsers": "airtap --sauce-connect --loopback airtap.local -- test/browser.js", + "test-browser-local": "airtap --open --local -- test/browser.js", + "cover": "nyc npm test", + "report": "nyc report --reporter=lcov", + "update-browser-errors": "babel -o errors-browser.js errors.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/nodejs/readable-stream" + }, + "keywords": [ + "readable", + "stream", + "pipe" + ], + "browser": { + "util": false, + "worker_threads": false, + "./errors": "./errors-browser.js", + "./readable.js": "./readable-browser.js", + "./lib/internal/streams/from.js": "./lib/internal/streams/from-browser.js", + "./lib/internal/streams/stream.js": "./lib/internal/streams/stream-browser.js" + }, + "nyc": { + "include": [ + "lib/**.js" + ] + }, + "license": "MIT" +} diff --git a/project starter code/node_modules/readable-stream/readable-browser.js b/project starter code/node_modules/readable-stream/readable-browser.js new file mode 100644 index 00000000..adbf60de --- /dev/null +++ b/project starter code/node_modules/readable-stream/readable-browser.js @@ -0,0 +1,9 @@ +exports = module.exports = require('./lib/_stream_readable.js'); +exports.Stream = exports; +exports.Readable = exports; +exports.Writable = require('./lib/_stream_writable.js'); +exports.Duplex = require('./lib/_stream_duplex.js'); +exports.Transform = require('./lib/_stream_transform.js'); +exports.PassThrough = require('./lib/_stream_passthrough.js'); +exports.finished = require('./lib/internal/streams/end-of-stream.js'); +exports.pipeline = require('./lib/internal/streams/pipeline.js'); diff --git a/project starter code/node_modules/readable-stream/readable.js b/project starter code/node_modules/readable-stream/readable.js new file mode 100644 index 00000000..9e0ca120 --- /dev/null +++ b/project starter code/node_modules/readable-stream/readable.js @@ -0,0 +1,16 @@ +var Stream = require('stream'); +if (process.env.READABLE_STREAM === 'disable' && Stream) { + module.exports = Stream.Readable; + Object.assign(module.exports, Stream); + module.exports.Stream = Stream; +} else { + exports = module.exports = require('./lib/_stream_readable.js'); + exports.Stream = Stream || exports; + exports.Readable = exports; + exports.Writable = require('./lib/_stream_writable.js'); + exports.Duplex = require('./lib/_stream_duplex.js'); + exports.Transform = require('./lib/_stream_transform.js'); + exports.PassThrough = require('./lib/_stream_passthrough.js'); + exports.finished = require('./lib/internal/streams/end-of-stream.js'); + exports.pipeline = require('./lib/internal/streams/pipeline.js'); +} diff --git a/project starter code/node_modules/readable-web-to-node-stream/README.md b/project starter code/node_modules/readable-web-to-node-stream/README.md new file mode 100644 index 00000000..4a717d86 --- /dev/null +++ b/project starter code/node_modules/readable-web-to-node-stream/README.md @@ -0,0 +1,71 @@ +![Karma CI](https://github.com/Borewit/readable-web-to-node-stream/workflows/Karma%20CI/badge.svg) +[![NPM version](https://badge.fury.io/js/readable-web-to-node-stream.svg)](https://npmjs.org/package/readable-web-to-node-stream) +[![npm downloads](http://img.shields.io/npm/dm/readable-web-to-node-stream.svg)](https://npmcharts.com/compare/readable-web-to-node-stream) +[![dependencies Status](https://david-dm.org/Borewit/readable-web-to-node-stream/status.svg)](https://david-dm.org/Borewit/readable-web-to-node-stream) +[![Known Vulnerabilities](https://snyk.io/test/github/Borewit/readable-web-to-node-stream/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Borewit/readable-web-to-node-stream?targetFile=package.json) +[![Codacy Badge](https://app.codacy.com/project/badge/Grade/d4b511481b3a4634b6ca5c0724407eb9)](https://www.codacy.com/gh/Borewit/peek-readable/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Borewit/peek-readable&utm_campaign=Badge_Grade) +[![Coverage Status](https://coveralls.io/repos/github/Borewit/readable-web-to-node-stream/badge.svg?branch=master)](https://coveralls.io/github/Borewit/readable-web-to-node-stream?branch=master) +[![Minified size](https://badgen.net/bundlephobia/min/readable-web-to-node-stream)](https://bundlephobia.com/result?p=readable-web-to-node-stream) + +# readable-web-to-node-stream + +Converts a [Web-API readable stream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader) into a [Node.js readable stream](https://nodejs.org/api/stream.html#stream_readable_streams). + +## Installation +Install via [npm](http://npmjs.org/): + +```bash +npm install readable-web-to-node-stream +``` +or or [yarn](https://yarnpkg.com/): +```bash +yarn add readable-web-to-node-stream +``` + +## Compatibility + +Source is written in TypeScript and compiled to ECMAScript 2017 (ES8). + +Unit tests are performed on the following browsers: + +* Google Chrome 74.0 +* Firefox 68.0 +* Safari 12.0 +* Opera 60.0 + +## Example + +Import readable-web-stream-to-node in JavaScript: +```js +const {ReadableWebToNodeStream} = require('readable-web-to-node-stream'); + +async function download(url) { + const response = await fetch(url); + const readableWebStream = response.body; + const nodeStream = new ReadableWebToNodeStream(readableWebStream); +} +``` + +## API + +**constructor(stream: ReadableStream): Promise** + +`stream: ReadableStream`: the [Web-API readable stream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader). + +**close(): Promise** +Will cancel close the Readable-node stream, and will release Web-API-readable-stream. + +**waitForReadToComplete(): Promise** +If there is no unresolved read call to Web-API Readable​Stream immediately returns, otherwise it will wait until the read is resolved. + +## Licence + +(The MIT License) + +Copyright (c) 2019 Borewit + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/project starter code/node_modules/readable-web-to-node-stream/lib/index.d.ts b/project starter code/node_modules/readable-web-to-node-stream/lib/index.d.ts new file mode 100644 index 00000000..7d7145bd --- /dev/null +++ b/project starter code/node_modules/readable-web-to-node-stream/lib/index.d.ts @@ -0,0 +1,39 @@ +import { Readable } from 'readable-stream'; +/** + * Converts a Web-API stream into Node stream.Readable class + * Node stream readable: https://nodejs.org/api/stream.html#stream_readable_streams + * Web API readable-stream: https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream + * Node readable stream: https://nodejs.org/api/stream.html#stream_readable_streams + */ +export declare class ReadableWebToNodeStream extends Readable { + bytesRead: number; + released: boolean; + /** + * Default web API stream reader + * https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader + */ + private reader; + private pendingRead; + /** + * + * @param stream Readable​Stream: https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream + */ + constructor(stream: ReadableStream); + /** + * Implementation of readable._read(size). + * When readable._read() is called, if data is available from the resource, + * the implementation should begin pushing that data into the read queue + * https://nodejs.org/api/stream.html#stream_readable_read_size_1 + */ + _read(): Promise; + /** + * If there is no unresolved read call to Web-API Readable​Stream immediately returns; + * otherwise will wait until the read is resolved. + */ + waitForReadToComplete(): Promise; + /** + * Close wrapper + */ + close(): Promise; + private syncAndRelease; +} diff --git a/project starter code/node_modules/readable-web-to-node-stream/lib/index.js b/project starter code/node_modules/readable-web-to-node-stream/lib/index.js new file mode 100644 index 00000000..1efaea17 --- /dev/null +++ b/project starter code/node_modules/readable-web-to-node-stream/lib/index.js @@ -0,0 +1,69 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ReadableWebToNodeStream = void 0; +const readable_stream_1 = require("readable-stream"); +/** + * Converts a Web-API stream into Node stream.Readable class + * Node stream readable: https://nodejs.org/api/stream.html#stream_readable_streams + * Web API readable-stream: https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream + * Node readable stream: https://nodejs.org/api/stream.html#stream_readable_streams + */ +class ReadableWebToNodeStream extends readable_stream_1.Readable { + /** + * + * @param stream Readable​Stream: https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream + */ + constructor(stream) { + super(); + this.bytesRead = 0; + this.released = false; + this.reader = stream.getReader(); + } + /** + * Implementation of readable._read(size). + * When readable._read() is called, if data is available from the resource, + * the implementation should begin pushing that data into the read queue + * https://nodejs.org/api/stream.html#stream_readable_read_size_1 + */ + async _read() { + // Should start pushing data into the queue + // Read data from the underlying Web-API-readable-stream + if (this.released) { + this.push(null); // Signal EOF + return; + } + this.pendingRead = this.reader.read(); + const data = await this.pendingRead; + // clear the promise before pushing pushing new data to the queue and allow sequential calls to _read() + delete this.pendingRead; + if (data.done || this.released) { + this.push(null); // Signal EOF + } + else { + this.bytesRead += data.value.length; + this.push(data.value); // Push new data to the queue + } + } + /** + * If there is no unresolved read call to Web-API Readable​Stream immediately returns; + * otherwise will wait until the read is resolved. + */ + async waitForReadToComplete() { + if (this.pendingRead) { + await this.pendingRead; + } + } + /** + * Close wrapper + */ + async close() { + await this.syncAndRelease(); + } + async syncAndRelease() { + this.released = true; + await this.waitForReadToComplete(); + await this.reader.releaseLock(); + } +} +exports.ReadableWebToNodeStream = ReadableWebToNodeStream; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/project starter code/node_modules/readable-web-to-node-stream/lib/index.spec.js b/project starter code/node_modules/readable-web-to-node-stream/lib/index.spec.js new file mode 100644 index 00000000..98ddd4e5 --- /dev/null +++ b/project starter code/node_modules/readable-web-to-node-stream/lib/index.spec.js @@ -0,0 +1,147 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseReadableStream = void 0; +localStorage.debug = 'readable-web-to-node-stream'; +const assert = require("assert"); +const mmb = require("music-metadata-browser"); +const index_1 = require("./index"); +async function httpGetByUrl(url) { + const response = await fetch(url); + const headers = []; + response.headers.forEach(header => { + headers.push(header); + }); + assert.ok(response.ok, `HTTP error status=${response.status}: ${response.statusText}`); + assert.ok(response.body, 'HTTP-stream'); + return response; +} +async function parseReadableStream(stream, fileInfo, options) { + const ns = new index_1.ReadableWebToNodeStream(stream); + const res = await mmb.parseNodeStream(ns, fileInfo, options); + await ns.close(); + return res; +} +exports.parseReadableStream = parseReadableStream; +const tiuqottigeloot_vol24_Tracks = [ + { + url: '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/01%20-%20Diablo%20Swing%20Orchestra%20-%20Heroines.mp3', + duration: 322.612245, + metaData: { + title: 'Heroines', + artist: 'Diablo Swing Orchestra' + } + }, + { + url: '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/02%20-%20Eclectek%20-%20We%20Are%20Going%20To%20Eclecfunk%20Your%20Ass.mp3', + duration: 190.093061, + metaData: { + title: 'We Are Going to Eclecfunk Your Ass', + artist: 'Eclectek' + } + } /* , + { + url: + '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/03%20-%20Auto-Pilot%20-%20Seventeen.mp3', + duration: 214.622041, + metaData: { + title: 'Seventeen', + artist: 'Auto-Pilot' + } + }, + { + url: + '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/04%20-%20Muha%20-%20Microphone.mp3', + duration: 181.838367, + metaData: { + title: 'Microphone', + artist: 'Muha' + } + }, + { + url: + '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/05%20-%20Just%20Plain%20Ant%20-%20Stumble.mp3', + duration: 86.047347, + metaData: { + title: 'Stumble', + artist: 'Just Plain Ant' + } + }, + { + url: + '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/06%20-%20Sleaze%20-%20God%20Damn.mp3', + duration: 226.795102, + metaData: { + title: 'God Damn', + artist: 'Sleaze' + } + }, + { + url: + '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/07%20-%20Juanitos%20-%20Hola%20Hola%20Bossa%20Nova.mp3', + duration: 207.072653, + metaData: { + title: 'Hola Hola Bossa Nova', + artist: 'Juanitos' + } + }, + { + url: + '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/08%20-%20Entertainment%20For%20The%20Braindead%20-%20Resolutions%20(Chris%20Summer%20Remix).mp3', + duration: 314.331429, + metaData: { + title: 'Resolutions (Chris Summer remix)', + artist: 'Entertainment for the Braindead' + } + }, + { + url: + '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/09%20-%20Nobara%20Hayakawa%20-%20Trail.mp3', + duration: 204.042449, + metaData: { + title: 'Trail', + artist: 'Nobara Hayakawa' + } + }, + { + url: + '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/10%20-%20Paper%20Navy%20-%20Tongue%20Tied.mp3', + duration: 201.116735, + metaData: { + title: 'Tongue Tied', + artist: 'Paper Navy' + } + }, + { + url: + '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/11%20-%2060%20Tigres%20-%20Garage.mp3', + duration: 245.394286, + metaData: { + title: 'Garage', + artist: '60 Tigres' + } + }, + { + url: + '/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/12%20-%20CM%20aka%20Creative%20-%20The%20Cycle%20(Featuring%20Mista%20Mista).mp3', + duration: 221.44, + metaData: { + title: 'The Cycle (feat. Mista Mista)', + artist: 'CM aka Creative' + } + } */ +]; +describe('Parse WebAmp tracks', () => { + tiuqottigeloot_vol24_Tracks.forEach(track => { + it(`track ${track.metaData.artist} - ${track.metaData.title}`, async () => { + const url = 'https://raw.githubusercontent.com/Borewit/test-audio/958e057' + track.url; + const response = await httpGetByUrl(url); + const metadata = await parseReadableStream(response.body, { + size: parseInt(response.headers.get('Content-Length'), 10), + mimeType: response.headers.get('Content-Type') + }); + expect(metadata.common.artist).toEqual(track.metaData.artist); + expect(metadata.common.title).toEqual(track.metaData.title); + }, 20000); + }); +}); +//# sourceMappingURL=index.spec.js.map \ No newline at end of file diff --git a/project starter code/node_modules/readable-web-to-node-stream/package.json b/project starter code/node_modules/readable-web-to-node-stream/package.json new file mode 100644 index 00000000..057c39f8 --- /dev/null +++ b/project starter code/node_modules/readable-web-to-node-stream/package.json @@ -0,0 +1,84 @@ +{ + "name": "readable-web-to-node-stream", + "version": "3.0.2", + "description": "Converts a Web-API readable-stream into a Node readable-stream.", + "main": "lib/index.js", + "files": [ + "lib/**/*.js", + "lib/**/*.d.ts" + ], + "engines": { + "node": ">=8" + }, + "types": "lib/index.d.ts", + "scripts": { + "clean": "del-cli lib/**/*.js lib/**/*.js.map lib/**/*.d.ts coverage", + "compile-lib": "tsc -p lib/tsconfig.json", + "compile-test": "tsc -p lib/tsconfig.spec.json", + "prepublishOnly": "yarn run build", + "build": "npm run compile-lib && npm run compile-test", + "tslint": "tslint 'lib/**/*.ts' --exclude 'lib/**/*.d.ts'", + "eslint": "eslint karma.conf.js", + "lint": "npm run tslint && npm run eslint", + "test": "karma start --single-run", + "karma": "karma start", + "karma-firefox": "karma start --browsers Firefox", + "karma-once": "karma start --browsers Chrome --single-run", + "travis-karma": "karma start --browsers Firefox --single-run --reporters coverage-istanbul,spec", + "browserstack": "karma start --browsers bs_win_chrome,bs_win_firefox,bs_osx_safari --single-run --reporters coverage-istanbul,spec", + "travis-karma-browserstack": "karma start --browsers bs_win_chrome,bs_win_firefox,bs_osx_safari --single-run --reporters coverage-istanbul,spec,BrowserStack", + "post-coveralls": "coveralls < coverage/lcov.info", + "post-codacy": " codacy-coverage < coverage/lcov.info" + }, + "keywords": [ + "stream.readable", + "web", + "node", + "browser", + "stream", + "covert", + "coverter", + "readable", + "readablestream" + ], + "repository": "https://github.com/Borewit/readable-web-to-node-stream.git", + "author": { + "name": "Borewit", + "url": "https://github.com/Borewit" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/Borewit/readable-web-to-node-stream/issues" + }, + "dependencies": { + "readable-stream": "^3.6.0" + }, + "devDependencies": { + "@types/jasmine": "^3.8.1", + "@types/node": "^16.3.1", + "@types/readable-stream": "^2.3.9", + "coveralls": "^3.1.0", + "del-cli": "^3.0.1", + "eslint": "^7.18.0", + "istanbul-instrumenter-loader": "^3.0.1", + "jasmine-core": "^3.8.0", + "karma": "^6.3.4", + "karma-browserstack-launcher": "^1.6.0", + "karma-chrome-launcher": "^3.1.0", + "karma-coverage-istanbul-reporter": "^3.0.3", + "karma-firefox-launcher": "^2.1.0", + "karma-jasmine": "^4.0.1", + "karma-jasmine-html-reporter": "^1.7.0", + "karma-spec-reporter": "^0.0.32", + "karma-webpack": "^5.0.0", + "music-metadata-browser": "^2.2.7", + "ts-loader": "^8.0.14", + "tslint": "^6.1.3", + "typescript": "^4.3.5", + "webpack": "^4.46.0" + } +} diff --git a/project starter code/node_modules/readdirp/LICENSE b/project starter code/node_modules/readdirp/LICENSE new file mode 100644 index 00000000..037cbb4e --- /dev/null +++ b/project starter code/node_modules/readdirp/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2012-2019 Thorsten Lorenz, Paul Miller (https://paulmillr.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/project starter code/node_modules/readdirp/README.md b/project starter code/node_modules/readdirp/README.md new file mode 100644 index 00000000..465593c9 --- /dev/null +++ b/project starter code/node_modules/readdirp/README.md @@ -0,0 +1,122 @@ +# readdirp [![Weekly downloads](https://img.shields.io/npm/dw/readdirp.svg)](https://github.com/paulmillr/readdirp) + +Recursive version of [fs.readdir](https://nodejs.org/api/fs.html#fs_fs_readdir_path_options_callback). Exposes a **stream API** and a **promise API**. + + +```sh +npm install readdirp +``` + +```javascript +const readdirp = require('readdirp'); + +// Use streams to achieve small RAM & CPU footprint. +// 1) Streams example with for-await. +for await (const entry of readdirp('.')) { + const {path} = entry; + console.log(`${JSON.stringify({path})}`); +} + +// 2) Streams example, non for-await. +// Print out all JS files along with their size within the current folder & subfolders. +readdirp('.', {fileFilter: '*.js', alwaysStat: true}) + .on('data', (entry) => { + const {path, stats: {size}} = entry; + console.log(`${JSON.stringify({path, size})}`); + }) + // Optionally call stream.destroy() in `warn()` in order to abort and cause 'close' to be emitted + .on('warn', error => console.error('non-fatal error', error)) + .on('error', error => console.error('fatal error', error)) + .on('end', () => console.log('done')); + +// 3) Promise example. More RAM and CPU than streams / for-await. +const files = await readdirp.promise('.'); +console.log(files.map(file => file.path)); + +// Other options. +readdirp('test', { + fileFilter: '*.js', + directoryFilter: ['!.git', '!*modules'] + // directoryFilter: (di) => di.basename.length === 9 + type: 'files_directories', + depth: 1 +}); +``` + +For more examples, check out `examples` directory. + +## API + +`const stream = readdirp(root[, options])` — **Stream API** + +- Reads given root recursively and returns a `stream` of [entry infos](#entryinfo) +- Optionally can be used like `for await (const entry of stream)` with node.js 10+ (`asyncIterator`). +- `on('data', (entry) => {})` [entry info](#entryinfo) for every file / dir. +- `on('warn', (error) => {})` non-fatal `Error` that prevents a file / dir from being processed. Example: inaccessible to the user. +- `on('error', (error) => {})` fatal `Error` which also ends the stream. Example: illegal options where passed. +- `on('end')` — we are done. Called when all entries were found and no more will be emitted. +- `on('close')` — stream is destroyed via `stream.destroy()`. + Could be useful if you want to manually abort even on a non fatal error. + At that point the stream is no longer `readable` and no more entries, warning or errors are emitted +- To learn more about streams, consult the very detailed [nodejs streams documentation](https://nodejs.org/api/stream.html) + or the [stream-handbook](https://github.com/substack/stream-handbook) + +`const entries = await readdirp.promise(root[, options])` — **Promise API**. Returns a list of [entry infos](#entryinfo). + +First argument is awalys `root`, path in which to start reading and recursing into subdirectories. + +### options + +- `fileFilter: ["*.js"]`: filter to include or exclude files. A `Function`, Glob string or Array of glob strings. + - **Function**: a function that takes an entry info as a parameter and returns true to include or false to exclude the entry + - **Glob string**: a string (e.g., `*.js`) which is matched using [picomatch](https://github.com/micromatch/picomatch), so go there for more + information. Globstars (`**`) are not supported since specifying a recursive pattern for an already recursive function doesn't make sense. Negated globs (as explained in the minimatch documentation) are allowed, e.g., `!*.txt` matches everything but text files. + - **Array of glob strings**: either need to be all inclusive or all exclusive (negated) patterns otherwise an error is thrown. + `['*.json', '*.js']` includes all JavaScript and Json files. + `['!.git', '!node_modules']` includes all directories except the '.git' and 'node_modules'. + - Directories that do not pass a filter will not be recursed into. +- `directoryFilter: ['!.git']`: filter to include/exclude directories found and to recurse into. Directories that do not pass a filter will not be recursed into. +- `depth: 5`: depth at which to stop recursing even if more subdirectories are found +- `type: 'files'`: determines if data events on the stream should be emitted for `'files'` (default), `'directories'`, `'files_directories'`, or `'all'`. Setting to `'all'` will also include entries for other types of file descriptors like character devices, unix sockets and named pipes. +- `alwaysStat: false`: always return `stats` property for every file. Default is `false`, readdirp will return `Dirent` entries. Setting it to `true` can double readdir execution time - use it only when you need file `size`, `mtime` etc. Cannot be enabled on node <10.10.0. +- `lstat: false`: include symlink entries in the stream along with files. When `true`, `fs.lstat` would be used instead of `fs.stat` + +### `EntryInfo` + +Has the following properties: + +- `path: 'assets/javascripts/react.js'`: path to the file/directory (relative to given root) +- `fullPath: '/Users/dev/projects/app/assets/javascripts/react.js'`: full path to the file/directory found +- `basename: 'react.js'`: name of the file/directory +- `dirent: fs.Dirent`: built-in [dir entry object](https://nodejs.org/api/fs.html#fs_class_fs_dirent) - only with `alwaysStat: false` +- `stats: fs.Stats`: built in [stat object](https://nodejs.org/api/fs.html#fs_class_fs_stats) - only with `alwaysStat: true` + +## Changelog + +- 3.5 (Oct 13, 2020) disallows recursive directory-based symlinks. + Before, it could have entered infinite loop. +- 3.4 (Mar 19, 2020) adds support for directory-based symlinks. +- 3.3 (Dec 6, 2019) stabilizes RAM consumption and enables perf management with `highWaterMark` option. Fixes race conditions related to `for-await` looping. +- 3.2 (Oct 14, 2019) improves performance by 250% and makes streams implementation more idiomatic. +- 3.1 (Jul 7, 2019) brings `bigint` support to `stat` output on Windows. This is backwards-incompatible for some cases. Be careful. It you use it incorrectly, you'll see "TypeError: Cannot mix BigInt and other types, use explicit conversions". +- 3.0 brings huge performance improvements and stream backpressure support. +- Upgrading 2.x to 3.x: + - Signature changed from `readdirp(options)` to `readdirp(root, options)` + - Replaced callback API with promise API. + - Renamed `entryType` option to `type` + - Renamed `entryType: 'both'` to `'files_directories'` + - `EntryInfo` + - Renamed `stat` to `stats` + - Emitted only when `alwaysStat: true` + - `dirent` is emitted instead of `stats` by default with `alwaysStat: false` + - Renamed `name` to `basename` + - Removed `parentDir` and `fullParentDir` properties +- Supported node.js versions: + - 3.x: node 8+ + - 2.x: node 0.6+ + +## License + +Copyright (c) 2012-2019 Thorsten Lorenz, Paul Miller () + +MIT License, see [LICENSE](LICENSE) file. diff --git a/project starter code/node_modules/readdirp/index.d.ts b/project starter code/node_modules/readdirp/index.d.ts new file mode 100644 index 00000000..cbbd76ca --- /dev/null +++ b/project starter code/node_modules/readdirp/index.d.ts @@ -0,0 +1,43 @@ +// TypeScript Version: 3.2 + +/// + +import * as fs from 'fs'; +import { Readable } from 'stream'; + +declare namespace readdir { + interface EntryInfo { + path: string; + fullPath: string; + basename: string; + stats?: fs.Stats; + dirent?: fs.Dirent; + } + + interface ReaddirpOptions { + root?: string; + fileFilter?: string | string[] | ((entry: EntryInfo) => boolean); + directoryFilter?: string | string[] | ((entry: EntryInfo) => boolean); + type?: 'files' | 'directories' | 'files_directories' | 'all'; + lstat?: boolean; + depth?: number; + alwaysStat?: boolean; + } + + interface ReaddirpStream extends Readable, AsyncIterable { + read(): EntryInfo; + [Symbol.asyncIterator](): AsyncIterableIterator; + } + + function promise( + root: string, + options?: ReaddirpOptions + ): Promise; +} + +declare function readdir( + root: string, + options?: readdir.ReaddirpOptions +): readdir.ReaddirpStream; + +export = readdir; diff --git a/project starter code/node_modules/readdirp/index.js b/project starter code/node_modules/readdirp/index.js new file mode 100644 index 00000000..cf739b2d --- /dev/null +++ b/project starter code/node_modules/readdirp/index.js @@ -0,0 +1,287 @@ +'use strict'; + +const fs = require('fs'); +const { Readable } = require('stream'); +const sysPath = require('path'); +const { promisify } = require('util'); +const picomatch = require('picomatch'); + +const readdir = promisify(fs.readdir); +const stat = promisify(fs.stat); +const lstat = promisify(fs.lstat); +const realpath = promisify(fs.realpath); + +/** + * @typedef {Object} EntryInfo + * @property {String} path + * @property {String} fullPath + * @property {fs.Stats=} stats + * @property {fs.Dirent=} dirent + * @property {String} basename + */ + +const BANG = '!'; +const RECURSIVE_ERROR_CODE = 'READDIRP_RECURSIVE_ERROR'; +const NORMAL_FLOW_ERRORS = new Set(['ENOENT', 'EPERM', 'EACCES', 'ELOOP', RECURSIVE_ERROR_CODE]); +const FILE_TYPE = 'files'; +const DIR_TYPE = 'directories'; +const FILE_DIR_TYPE = 'files_directories'; +const EVERYTHING_TYPE = 'all'; +const ALL_TYPES = [FILE_TYPE, DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE]; + +const isNormalFlowError = error => NORMAL_FLOW_ERRORS.has(error.code); +const [maj, min] = process.versions.node.split('.').slice(0, 2).map(n => Number.parseInt(n, 10)); +const wantBigintFsStats = process.platform === 'win32' && (maj > 10 || (maj === 10 && min >= 5)); + +const normalizeFilter = filter => { + if (filter === undefined) return; + if (typeof filter === 'function') return filter; + + if (typeof filter === 'string') { + const glob = picomatch(filter.trim()); + return entry => glob(entry.basename); + } + + if (Array.isArray(filter)) { + const positive = []; + const negative = []; + for (const item of filter) { + const trimmed = item.trim(); + if (trimmed.charAt(0) === BANG) { + negative.push(picomatch(trimmed.slice(1))); + } else { + positive.push(picomatch(trimmed)); + } + } + + if (negative.length > 0) { + if (positive.length > 0) { + return entry => + positive.some(f => f(entry.basename)) && !negative.some(f => f(entry.basename)); + } + return entry => !negative.some(f => f(entry.basename)); + } + return entry => positive.some(f => f(entry.basename)); + } +}; + +class ReaddirpStream extends Readable { + static get defaultOptions() { + return { + root: '.', + /* eslint-disable no-unused-vars */ + fileFilter: (path) => true, + directoryFilter: (path) => true, + /* eslint-enable no-unused-vars */ + type: FILE_TYPE, + lstat: false, + depth: 2147483648, + alwaysStat: false + }; + } + + constructor(options = {}) { + super({ + objectMode: true, + autoDestroy: true, + highWaterMark: options.highWaterMark || 4096 + }); + const opts = { ...ReaddirpStream.defaultOptions, ...options }; + const { root, type } = opts; + + this._fileFilter = normalizeFilter(opts.fileFilter); + this._directoryFilter = normalizeFilter(opts.directoryFilter); + + const statMethod = opts.lstat ? lstat : stat; + // Use bigint stats if it's windows and stat() supports options (node 10+). + if (wantBigintFsStats) { + this._stat = path => statMethod(path, { bigint: true }); + } else { + this._stat = statMethod; + } + + this._maxDepth = opts.depth; + this._wantsDir = [DIR_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type); + this._wantsFile = [FILE_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type); + this._wantsEverything = type === EVERYTHING_TYPE; + this._root = sysPath.resolve(root); + this._isDirent = ('Dirent' in fs) && !opts.alwaysStat; + this._statsProp = this._isDirent ? 'dirent' : 'stats'; + this._rdOptions = { encoding: 'utf8', withFileTypes: this._isDirent }; + + // Launch stream with one parent, the root dir. + this.parents = [this._exploreDir(root, 1)]; + this.reading = false; + this.parent = undefined; + } + + async _read(batch) { + if (this.reading) return; + this.reading = true; + + try { + while (!this.destroyed && batch > 0) { + const { path, depth, files = [] } = this.parent || {}; + + if (files.length > 0) { + const slice = files.splice(0, batch).map(dirent => this._formatEntry(dirent, path)); + for (const entry of await Promise.all(slice)) { + if (this.destroyed) return; + + const entryType = await this._getEntryType(entry); + if (entryType === 'directory' && this._directoryFilter(entry)) { + if (depth <= this._maxDepth) { + this.parents.push(this._exploreDir(entry.fullPath, depth + 1)); + } + + if (this._wantsDir) { + this.push(entry); + batch--; + } + } else if ((entryType === 'file' || this._includeAsFile(entry)) && this._fileFilter(entry)) { + if (this._wantsFile) { + this.push(entry); + batch--; + } + } + } + } else { + const parent = this.parents.pop(); + if (!parent) { + this.push(null); + break; + } + this.parent = await parent; + if (this.destroyed) return; + } + } + } catch (error) { + this.destroy(error); + } finally { + this.reading = false; + } + } + + async _exploreDir(path, depth) { + let files; + try { + files = await readdir(path, this._rdOptions); + } catch (error) { + this._onError(error); + } + return { files, depth, path }; + } + + async _formatEntry(dirent, path) { + let entry; + try { + const basename = this._isDirent ? dirent.name : dirent; + const fullPath = sysPath.resolve(sysPath.join(path, basename)); + entry = { path: sysPath.relative(this._root, fullPath), fullPath, basename }; + entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath); + } catch (err) { + this._onError(err); + } + return entry; + } + + _onError(err) { + if (isNormalFlowError(err) && !this.destroyed) { + this.emit('warn', err); + } else { + this.destroy(err); + } + } + + async _getEntryType(entry) { + // entry may be undefined, because a warning or an error were emitted + // and the statsProp is undefined + const stats = entry && entry[this._statsProp]; + if (!stats) { + return; + } + if (stats.isFile()) { + return 'file'; + } + if (stats.isDirectory()) { + return 'directory'; + } + if (stats && stats.isSymbolicLink()) { + const full = entry.fullPath; + try { + const entryRealPath = await realpath(full); + const entryRealPathStats = await lstat(entryRealPath); + if (entryRealPathStats.isFile()) { + return 'file'; + } + if (entryRealPathStats.isDirectory()) { + const len = entryRealPath.length; + if (full.startsWith(entryRealPath) && full.substr(len, 1) === sysPath.sep) { + const recursiveError = new Error( + `Circular symlink detected: "${full}" points to "${entryRealPath}"` + ); + recursiveError.code = RECURSIVE_ERROR_CODE; + return this._onError(recursiveError); + } + return 'directory'; + } + } catch (error) { + this._onError(error); + } + } + } + + _includeAsFile(entry) { + const stats = entry && entry[this._statsProp]; + + return stats && this._wantsEverything && !stats.isDirectory(); + } +} + +/** + * @typedef {Object} ReaddirpArguments + * @property {Function=} fileFilter + * @property {Function=} directoryFilter + * @property {String=} type + * @property {Number=} depth + * @property {String=} root + * @property {Boolean=} lstat + * @property {Boolean=} bigint + */ + +/** + * Main function which ends up calling readdirRec and reads all files and directories in given root recursively. + * @param {String} root Root directory + * @param {ReaddirpArguments=} options Options to specify root (start directory), filters and recursion depth + */ +const readdirp = (root, options = {}) => { + let type = options.entryType || options.type; + if (type === 'both') type = FILE_DIR_TYPE; // backwards-compatibility + if (type) options.type = type; + if (!root) { + throw new Error('readdirp: root argument is required. Usage: readdirp(root, options)'); + } else if (typeof root !== 'string') { + throw new TypeError('readdirp: root argument must be a string. Usage: readdirp(root, options)'); + } else if (type && !ALL_TYPES.includes(type)) { + throw new Error(`readdirp: Invalid type passed. Use one of ${ALL_TYPES.join(', ')}`); + } + + options.root = root; + return new ReaddirpStream(options); +}; + +const readdirpPromise = (root, options = {}) => { + return new Promise((resolve, reject) => { + const files = []; + readdirp(root, options) + .on('data', entry => files.push(entry)) + .on('end', () => resolve(files)) + .on('error', error => reject(error)); + }); +}; + +readdirp.promise = readdirpPromise; +readdirp.ReaddirpStream = ReaddirpStream; +readdirp.default = readdirp; + +module.exports = readdirp; diff --git a/project starter code/node_modules/readdirp/package.json b/project starter code/node_modules/readdirp/package.json new file mode 100644 index 00000000..dba53888 --- /dev/null +++ b/project starter code/node_modules/readdirp/package.json @@ -0,0 +1,122 @@ +{ + "name": "readdirp", + "description": "Recursive version of fs.readdir with streaming API.", + "version": "3.6.0", + "homepage": "https://github.com/paulmillr/readdirp", + "repository": { + "type": "git", + "url": "git://github.com/paulmillr/readdirp.git" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/paulmillr/readdirp/issues" + }, + "author": "Thorsten Lorenz (thlorenz.com)", + "contributors": [ + "Thorsten Lorenz (thlorenz.com)", + "Paul Miller (https://paulmillr.com)" + ], + "main": "index.js", + "engines": { + "node": ">=8.10.0" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "recursive", + "fs", + "stream", + "streams", + "readdir", + "filesystem", + "find", + "filter" + ], + "scripts": { + "dtslint": "dtslint", + "nyc": "nyc", + "mocha": "mocha --exit", + "lint": "eslint --report-unused-disable-directives --ignore-path .gitignore .", + "test": "npm run lint && nyc npm run mocha" + }, + "dependencies": { + "picomatch": "^2.2.1" + }, + "devDependencies": { + "@types/node": "^14", + "chai": "^4.2", + "chai-subset": "^1.6", + "dtslint": "^3.3.0", + "eslint": "^7.0.0", + "mocha": "^7.1.1", + "nyc": "^15.0.0", + "rimraf": "^3.0.0", + "typescript": "^4.0.3" + }, + "nyc": { + "reporter": [ + "html", + "text" + ] + }, + "eslintConfig": { + "root": true, + "extends": "eslint:recommended", + "parserOptions": { + "ecmaVersion": 9, + "sourceType": "script" + }, + "env": { + "node": true, + "es6": true + }, + "rules": { + "array-callback-return": "error", + "no-empty": [ + "error", + { + "allowEmptyCatch": true + } + ], + "no-else-return": [ + "error", + { + "allowElseIf": false + } + ], + "no-lonely-if": "error", + "no-var": "error", + "object-shorthand": "error", + "prefer-arrow-callback": [ + "error", + { + "allowNamedFunctions": true + } + ], + "prefer-const": [ + "error", + { + "ignoreReadBeforeAssign": true + } + ], + "prefer-destructuring": [ + "error", + { + "object": true, + "array": false + } + ], + "prefer-spread": "error", + "prefer-template": "error", + "radix": "error", + "semi": "error", + "strict": "error", + "quotes": [ + "error", + "single" + ] + } + } +} diff --git a/project starter code/node_modules/sax/LICENSE b/project starter code/node_modules/sax/LICENSE index ccffa082..6e8e4c14 100644 --- a/project starter code/node_modules/sax/LICENSE +++ b/project starter code/node_modules/sax/LICENSE @@ -1,6 +1,6 @@ The ISC License -Copyright (c) Isaac Z. Schlueter and Contributors +Copyright (c) 2010-2022 Isaac Z. Schlueter and Contributors Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -19,7 +19,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. `String.fromCodePoint` by Mathias Bynens used according to terms of MIT License, as follows: - Copyright Mathias Bynens +Copyright (c) 2010-2022 Mathias Bynens Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/project starter code/node_modules/sax/lib/sax.js b/project starter code/node_modules/sax/lib/sax.js index 795d607e..ffd441ae 100644 --- a/project starter code/node_modules/sax/lib/sax.js +++ b/project starter code/node_modules/sax/lib/sax.js @@ -164,6 +164,7 @@ } catch (ex) { Stream = function () {} } + if (!Stream) Stream = function () {} var streamWraps = sax.EVENTS.filter(function (ev) { return ev !== 'error' && ev !== 'end' @@ -1482,9 +1483,16 @@ } if (c === ';') { - parser[buffer] += parseEntity(parser) - parser.entity = '' - parser.state = returnState + if (parser.opt.unparsedEntities) { + var parsedEntity = parseEntity(parser) + parser.entity = '' + parser.state = returnState + parser.write(parsedEntity) + } else { + parser[buffer] += parseEntity(parser) + parser.entity = '' + parser.state = returnState + } } else if (isMatch(parser.entity.length ? entityBody : entityStart, c)) { parser.entity += c } else { @@ -1496,8 +1504,9 @@ continue - default: + default: /* istanbul ignore next */ { throw new Error(parser, 'Unknown state: ' + parser.state) + } } } // while diff --git a/project starter code/node_modules/sax/package.json b/project starter code/node_modules/sax/package.json index d2039bf3..ad3178ae 100644 --- a/project starter code/node_modules/sax/package.json +++ b/project starter code/node_modules/sax/package.json @@ -2,12 +2,11 @@ "name": "sax", "description": "An evented streaming XML parser in JavaScript", "author": "Isaac Z. Schlueter (http://blog.izs.me/)", - "version": "1.2.4", + "version": "1.3.0", "main": "lib/sax.js", "license": "ISC", "scripts": { "test": "tap test/*.js --cov -j4", - "posttest": "standard -F test/*.js lib/*.js", "preversion": "npm test", "postversion": "npm publish", "postpublish": "git push origin --all; git push origin --tags" @@ -19,7 +18,12 @@ "README.md" ], "devDependencies": { - "standard": "^8.6.0", - "tap": "^10.5.1" + "tap": "^15.1.6" + }, + "tap": { + "statements": 79, + "branches": 75, + "functions": 80, + "lines": 79 } } diff --git a/project starter code/node_modules/semver/LICENSE b/project starter code/node_modules/semver/LICENSE new file mode 100644 index 00000000..19129e31 --- /dev/null +++ b/project starter code/node_modules/semver/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/project starter code/node_modules/semver/README.md b/project starter code/node_modules/semver/README.md new file mode 100644 index 00000000..673e9c35 --- /dev/null +++ b/project starter code/node_modules/semver/README.md @@ -0,0 +1,654 @@ +semver(1) -- The semantic versioner for npm +=========================================== + +## Install + +```bash +npm install semver +```` + +## Usage + +As a node module: + +```js +const semver = require('semver') + +semver.valid('1.2.3') // '1.2.3' +semver.valid('a.b.c') // null +semver.clean(' =v1.2.3 ') // '1.2.3' +semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true +semver.gt('1.2.3', '9.8.7') // false +semver.lt('1.2.3', '9.8.7') // true +semver.minVersion('>=1.0.0') // '1.0.0' +semver.valid(semver.coerce('v2')) // '2.0.0' +semver.valid(semver.coerce('42.6.7.9.3-alpha')) // '42.6.7' +``` + +You can also just load the module for the function that you care about if +you'd like to minimize your footprint. + +```js +// load the whole API at once in a single object +const semver = require('semver') + +// or just load the bits you need +// all of them listed here, just pick and choose what you want + +// classes +const SemVer = require('semver/classes/semver') +const Comparator = require('semver/classes/comparator') +const Range = require('semver/classes/range') + +// functions for working with versions +const semverParse = require('semver/functions/parse') +const semverValid = require('semver/functions/valid') +const semverClean = require('semver/functions/clean') +const semverInc = require('semver/functions/inc') +const semverDiff = require('semver/functions/diff') +const semverMajor = require('semver/functions/major') +const semverMinor = require('semver/functions/minor') +const semverPatch = require('semver/functions/patch') +const semverPrerelease = require('semver/functions/prerelease') +const semverCompare = require('semver/functions/compare') +const semverRcompare = require('semver/functions/rcompare') +const semverCompareLoose = require('semver/functions/compare-loose') +const semverCompareBuild = require('semver/functions/compare-build') +const semverSort = require('semver/functions/sort') +const semverRsort = require('semver/functions/rsort') + +// low-level comparators between versions +const semverGt = require('semver/functions/gt') +const semverLt = require('semver/functions/lt') +const semverEq = require('semver/functions/eq') +const semverNeq = require('semver/functions/neq') +const semverGte = require('semver/functions/gte') +const semverLte = require('semver/functions/lte') +const semverCmp = require('semver/functions/cmp') +const semverCoerce = require('semver/functions/coerce') + +// working with ranges +const semverSatisfies = require('semver/functions/satisfies') +const semverMaxSatisfying = require('semver/ranges/max-satisfying') +const semverMinSatisfying = require('semver/ranges/min-satisfying') +const semverToComparators = require('semver/ranges/to-comparators') +const semverMinVersion = require('semver/ranges/min-version') +const semverValidRange = require('semver/ranges/valid') +const semverOutside = require('semver/ranges/outside') +const semverGtr = require('semver/ranges/gtr') +const semverLtr = require('semver/ranges/ltr') +const semverIntersects = require('semver/ranges/intersects') +const semverSimplifyRange = require('semver/ranges/simplify') +const semverRangeSubset = require('semver/ranges/subset') +``` + +As a command-line utility: + +``` +$ semver -h + +A JavaScript implementation of the https://semver.org/ specification +Copyright Isaac Z. Schlueter + +Usage: semver [options] [ [...]] +Prints valid versions sorted by SemVer precedence + +Options: +-r --range + Print versions that match the specified range. + +-i --increment [] + Increment a version by the specified level. Level can + be one of: major, minor, patch, premajor, preminor, + prepatch, or prerelease. Default level is 'patch'. + Only one version may be specified. + +--preid + Identifier to be used to prefix premajor, preminor, + prepatch or prerelease version increments. + +-l --loose + Interpret versions and ranges loosely + +-n <0|1> + This is the base to be used for the prerelease identifier. + +-p --include-prerelease + Always include prerelease versions in range matching + +-c --coerce + Coerce a string into SemVer if possible + (does not imply --loose) + +--rtl + Coerce version strings right to left + +--ltr + Coerce version strings left to right (default) + +Program exits successfully if any valid version satisfies +all supplied ranges, and prints all satisfying versions. + +If no satisfying versions are found, then exits failure. + +Versions are printed in ascending order, so supplying +multiple versions to the utility will just sort them. +``` + +## Versions + +A "version" is described by the `v2.0.0` specification found at +. + +A leading `"="` or `"v"` character is stripped off and ignored. + +## Ranges + +A `version range` is a set of `comparators` that specify versions +that satisfy the range. + +A `comparator` is composed of an `operator` and a `version`. The set +of primitive `operators` is: + +* `<` Less than +* `<=` Less than or equal to +* `>` Greater than +* `>=` Greater than or equal to +* `=` Equal. If no operator is specified, then equality is assumed, + so this operator is optional but MAY be included. + +For example, the comparator `>=1.2.7` would match the versions +`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6` +or `1.1.0`. The comparator `>1` is equivalent to `>=2.0.0` and +would match the versions `2.0.0` and `3.1.0`, but not the versions +`1.0.1` or `1.1.0`. + +Comparators can be joined by whitespace to form a `comparator set`, +which is satisfied by the **intersection** of all of the comparators +it includes. + +A range is composed of one or more comparator sets, joined by `||`. A +version matches a range if and only if every comparator in at least +one of the `||`-separated comparator sets is satisfied by the version. + +For example, the range `>=1.2.7 <1.3.0` would match the versions +`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`, +or `1.1.0`. + +The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`, +`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`. + +### Prerelease Tags + +If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then +it will only be allowed to satisfy comparator sets if at least one +comparator with the same `[major, minor, patch]` tuple also has a +prerelease tag. + +For example, the range `>1.2.3-alpha.3` would be allowed to match the +version `1.2.3-alpha.7`, but it would *not* be satisfied by +`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater +than" `1.2.3-alpha.3` according to the SemVer sort rules. The version +range only accepts prerelease tags on the `1.2.3` version. +Version `3.4.5` *would* satisfy the range because it does not have a +prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`. + +The purpose of this behavior is twofold. First, prerelease versions +frequently are updated very quickly, and contain many breaking changes +that are (by the author's design) not yet fit for public consumption. +Therefore, by default, they are excluded from range-matching +semantics. + +Second, a user who has opted into using a prerelease version has +indicated the intent to use *that specific* set of +alpha/beta/rc versions. By including a prerelease tag in the range, +the user is indicating that they are aware of the risk. However, it +is still not appropriate to assume that they have opted into taking a +similar risk on the *next* set of prerelease versions. + +Note that this behavior can be suppressed (treating all prerelease +versions as if they were normal versions, for range-matching) +by setting the `includePrerelease` flag on the options +object to any +[functions](https://github.com/npm/node-semver#functions) that do +range matching. + +#### Prerelease Identifiers + +The method `.inc` takes an additional `identifier` string argument that +will append the value of the string as a prerelease identifier: + +```javascript +semver.inc('1.2.3', 'prerelease', 'beta') +// '1.2.4-beta.0' +``` + +command-line example: + +```bash +$ semver 1.2.3 -i prerelease --preid beta +1.2.4-beta.0 +``` + +Which then can be used to increment further: + +```bash +$ semver 1.2.4-beta.0 -i prerelease +1.2.4-beta.1 +``` + +#### Prerelease Identifier Base + +The method `.inc` takes an optional parameter 'identifierBase' string +that will let you let your prerelease number as zero-based or one-based. +Set to `false` to omit the prerelease number altogether. +If you do not specify this parameter, it will default to zero-based. + +```javascript +semver.inc('1.2.3', 'prerelease', 'beta', '1') +// '1.2.4-beta.1' +``` + +```javascript +semver.inc('1.2.3', 'prerelease', 'beta', false) +// '1.2.4-beta' +``` + +command-line example: + +```bash +$ semver 1.2.3 -i prerelease --preid beta -n 1 +1.2.4-beta.1 +``` + +```bash +$ semver 1.2.3 -i prerelease --preid beta -n false +1.2.4-beta +``` + +### Advanced Range Syntax + +Advanced range syntax desugars to primitive comparators in +deterministic ways. + +Advanced ranges may be combined in the same way as primitive +comparators using white space or `||`. + +#### Hyphen Ranges `X.Y.Z - A.B.C` + +Specifies an inclusive set. + +* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4` + +If a partial version is provided as the first version in the inclusive +range, then the missing pieces are replaced with zeroes. + +* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4` + +If a partial version is provided as the second version in the +inclusive range, then all versions that start with the supplied parts +of the tuple are accepted, but nothing that would be greater than the +provided tuple parts. + +* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0-0` +* `1.2.3 - 2` := `>=1.2.3 <3.0.0-0` + +#### X-Ranges `1.2.x` `1.X` `1.2.*` `*` + +Any of `X`, `x`, or `*` may be used to "stand in" for one of the +numeric values in the `[major, minor, patch]` tuple. + +* `*` := `>=0.0.0` (Any non-prerelease version satisfies, unless + `includePrerelease` is specified, in which case any version at all + satisfies) +* `1.x` := `>=1.0.0 <2.0.0-0` (Matching major version) +* `1.2.x` := `>=1.2.0 <1.3.0-0` (Matching major and minor versions) + +A partial version range is treated as an X-Range, so the special +character is in fact optional. + +* `""` (empty string) := `*` := `>=0.0.0` +* `1` := `1.x.x` := `>=1.0.0 <2.0.0-0` +* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0-0` + +#### Tilde Ranges `~1.2.3` `~1.2` `~1` + +Allows patch-level changes if a minor version is specified on the +comparator. Allows minor-level changes if not. + +* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0-0` +* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0-0` (Same as `1.2.x`) +* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0-0` (Same as `1.x`) +* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0-0` +* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0-0` (Same as `0.2.x`) +* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0-0` (Same as `0.x`) +* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0-0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. + +#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4` + +Allows changes that do not modify the left-most non-zero element in the +`[major, minor, patch]` tuple. In other words, this allows patch and +minor updates for versions `1.0.0` and above, patch updates for +versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`. + +Many authors treat a `0.x` version as if the `x` were the major +"breaking-change" indicator. + +Caret ranges are ideal when an author may make breaking changes +between `0.2.4` and `0.3.0` releases, which is a common practice. +However, it presumes that there will *not* be breaking changes between +`0.2.4` and `0.2.5`. It allows for changes that are presumed to be +additive (but non-breaking), according to commonly observed practices. + +* `^1.2.3` := `>=1.2.3 <2.0.0-0` +* `^0.2.3` := `>=0.2.3 <0.3.0-0` +* `^0.0.3` := `>=0.0.3 <0.0.4-0` +* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0-0` Note that prereleases in + the `1.2.3` version will be allowed, if they are greater than or + equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but + `1.2.4-beta.2` would not, because it is a prerelease of a + different `[major, minor, patch]` tuple. +* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4-0` Note that prereleases in the + `0.0.3` version *only* will be allowed, if they are greater than or + equal to `beta`. So, `0.0.3-pr.2` would be allowed. + +When parsing caret ranges, a missing `patch` value desugars to the +number `0`, but will allow flexibility within that value, even if the +major and minor versions are both `0`. + +* `^1.2.x` := `>=1.2.0 <2.0.0-0` +* `^0.0.x` := `>=0.0.0 <0.1.0-0` +* `^0.0` := `>=0.0.0 <0.1.0-0` + +A missing `minor` and `patch` values will desugar to zero, but also +allow flexibility within those values, even if the major version is +zero. + +* `^1.x` := `>=1.0.0 <2.0.0-0` +* `^0.x` := `>=0.0.0 <1.0.0-0` + +### Range Grammar + +Putting all this together, here is a Backus-Naur grammar for ranges, +for the benefit of parser authors: + +```bnf +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ +``` + +## Functions + +All methods and classes take a final `options` object argument. All +options in this object are `false` by default. The options supported +are: + +- `loose`: Be more forgiving about not-quite-valid semver strings. + (Any resulting output will always be 100% strict compliant, of + course.) For backwards compatibility reasons, if the `options` + argument is a boolean value instead of an object, it is interpreted + to be the `loose` param. +- `includePrerelease`: Set to suppress the [default + behavior](https://github.com/npm/node-semver#prerelease-tags) of + excluding prerelease tagged versions from ranges unless they are + explicitly opted into. + +Strict-mode Comparators and Ranges will be strict about the SemVer +strings that they parse. + +* `valid(v)`: Return the parsed version, or null if it's not valid. +* `inc(v, release, options, identifier, identifierBase)`: + Return the version incremented by the release + type (`major`, `premajor`, `minor`, `preminor`, `patch`, + `prepatch`, or `prerelease`), or null if it's not valid + * `premajor` in one call will bump the version up to the next major + version and down to a prerelease of that major version. + `preminor`, and `prepatch` work the same way. + * If called from a non-prerelease version, `prerelease` will work the + same as `prepatch`. It increments the patch version and then makes a + prerelease. If the input version is already a prerelease it simply + increments it. + * `identifier` can be used to prefix `premajor`, `preminor`, + `prepatch`, or `prerelease` version increments. `identifierBase` + is the base to be used for the `prerelease` identifier. +* `prerelease(v)`: Returns an array of prerelease components, or null + if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]` +* `major(v)`: Return the major version number. +* `minor(v)`: Return the minor version number. +* `patch(v)`: Return the patch version number. +* `intersects(r1, r2, loose)`: Return true if the two supplied ranges + or comparators intersect. +* `parse(v)`: Attempt to parse a string as a semantic version, returning either + a `SemVer` object or `null`. + +### Comparison + +* `gt(v1, v2)`: `v1 > v2` +* `gte(v1, v2)`: `v1 >= v2` +* `lt(v1, v2)`: `v1 < v2` +* `lte(v1, v2)`: `v1 <= v2` +* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent, + even if they're not the same string. You already know how to + compare strings. +* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`. +* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call + the corresponding function above. `"==="` and `"!=="` do simple + string comparison, but are included for completeness. Throws if an + invalid comparison string is provided. +* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if + `v2` is greater. Sorts in ascending order if passed to `Array.sort()`. +* `rcompare(v1, v2)`: The reverse of `compare`. Sorts an array of versions + in descending order when passed to `Array.sort()`. +* `compareBuild(v1, v2)`: The same as `compare` but considers `build` when two versions + are equal. Sorts in ascending order if passed to `Array.sort()`. +* `compareLoose(v1, v2)`: Short for ``compare(v1, v2, { loose: true })`. +* `diff(v1, v2)`: Returns the difference between two versions by the release type + (`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`), + or null if the versions are the same. + +### Sorting + +* `sort(versions)`: Returns a sorted array of versions based on the `compareBuild` + function. +* `rsort(versions)`: The reverse of `sort`. Returns an array of versions based on + the `compareBuild` function in descending order. + +### Comparators + +* `intersects(comparator)`: Return true if the comparators intersect + +### Ranges + +* `validRange(range)`: Return the valid range or null if it's not valid +* `satisfies(version, range)`: Return true if the version satisfies the + range. +* `maxSatisfying(versions, range)`: Return the highest version in the list + that satisfies the range, or `null` if none of them do. +* `minSatisfying(versions, range)`: Return the lowest version in the list + that satisfies the range, or `null` if none of them do. +* `minVersion(range)`: Return the lowest version that can match + the given range. +* `gtr(version, range)`: Return `true` if the version is greater than all the + versions possible in the range. +* `ltr(version, range)`: Return `true` if the version is less than all the + versions possible in the range. +* `outside(version, range, hilo)`: Return true if the version is outside + the bounds of the range in either the high or low direction. The + `hilo` argument must be either the string `'>'` or `'<'`. (This is + the function called by `gtr` and `ltr`.) +* `intersects(range)`: Return true if any of the range comparators intersect. +* `simplifyRange(versions, range)`: Return a "simplified" range that + matches the same items in the `versions` list as the range specified. Note + that it does *not* guarantee that it would match the same versions in all + cases, only for the set of versions provided. This is useful when + generating ranges by joining together multiple versions with `||` + programmatically, to provide the user with something a bit more + ergonomic. If the provided range is shorter in string-length than the + generated range, then that is returned. +* `subset(subRange, superRange)`: Return `true` if the `subRange` range is + entirely contained by the `superRange` range. + +Note that, since ranges may be non-contiguous, a version might not be +greater than a range, less than a range, *or* satisfy a range! For +example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9` +until `2.0.0`, so version `1.2.10` would not be greater than the +range (because `2.0.1` satisfies, which is higher), nor less than the +range (since `1.2.8` satisfies, which is lower), and it also does not +satisfy the range. + +If you want to know if a version satisfies or does not satisfy a +range, use the `satisfies(version, range)` function. + +### Coercion + +* `coerce(version, options)`: Coerces a string to semver if possible + +This aims to provide a very forgiving translation of a non-semver string to +semver. It looks for the first digit in a string and consumes all +remaining characters which satisfy at least a partial semver (e.g., `1`, +`1.2`, `1.2.3`) up to the max permitted length (256 characters). Longer +versions are simply truncated (`4.6.3.9.2-alpha2` becomes `4.6.3`). All +surrounding text is simply ignored (`v3.4 replaces v3.3.1` becomes +`3.4.0`). Only text which lacks digits will fail coercion (`version one` +is not valid). The maximum length for any semver component considered for +coercion is 16 characters; longer components will be ignored +(`10000000000000000.4.7.4` becomes `4.7.4`). The maximum value for any +semver component is `Number.MAX_SAFE_INTEGER || (2**53 - 1)`; higher value +components are invalid (`9999999999999999.4.7.4` is likely invalid). + +If the `options.rtl` flag is set, then `coerce` will return the right-most +coercible tuple that does not share an ending index with a longer coercible +tuple. For example, `1.2.3.4` will return `2.3.4` in rtl mode, not +`4.0.0`. `1.2.3/4` will return `4.0.0`, because the `4` is not a part of +any other overlapping SemVer tuple. + +If the `options.includePrerelease` flag is set, then the `coerce` result will contain +prerelease and build parts of a version. For example, `1.2.3.4-rc.1+rev.2` +will preserve prerelease `rc.1` and build `rev.2` in the result. + +### Clean + +* `clean(version)`: Clean a string to be a valid semver if possible + +This will return a cleaned and trimmed semver version. If the provided +version is not valid a null will be returned. This does not work for +ranges. + +ex. +* `s.clean(' = v 2.1.5foo')`: `null` +* `s.clean(' = v 2.1.5foo', { loose: true })`: `'2.1.5-foo'` +* `s.clean(' = v 2.1.5-foo')`: `null` +* `s.clean(' = v 2.1.5-foo', { loose: true })`: `'2.1.5-foo'` +* `s.clean('=v2.1.5')`: `'2.1.5'` +* `s.clean(' =v2.1.5')`: `'2.1.5'` +* `s.clean(' 2.1.5 ')`: `'2.1.5'` +* `s.clean('~1.0.0')`: `null` + +## Constants + +As a convenience, helper constants are exported to provide information about what `node-semver` supports: + +### `RELEASE_TYPES` + +- major +- premajor +- minor +- preminor +- patch +- prepatch +- prerelease + +``` +const semver = require('semver'); + +if (semver.RELEASE_TYPES.includes(arbitraryUserInput)) { + console.log('This is a valid release type!'); +} else { + console.warn('This is NOT a valid release type!'); +} +``` + +### `SEMVER_SPEC_VERSION` + +2.0.0 + +``` +const semver = require('semver'); + +console.log('We are currently using the semver specification version:', semver.SEMVER_SPEC_VERSION); +``` + +## Exported Modules + + + +You may pull in just the part of this semver utility that you need if you +are sensitive to packing and tree-shaking concerns. The main +`require('semver')` export uses getter functions to lazily load the parts +of the API that are used. + +The following modules are available: + +* `require('semver')` +* `require('semver/classes')` +* `require('semver/classes/comparator')` +* `require('semver/classes/range')` +* `require('semver/classes/semver')` +* `require('semver/functions/clean')` +* `require('semver/functions/cmp')` +* `require('semver/functions/coerce')` +* `require('semver/functions/compare')` +* `require('semver/functions/compare-build')` +* `require('semver/functions/compare-loose')` +* `require('semver/functions/diff')` +* `require('semver/functions/eq')` +* `require('semver/functions/gt')` +* `require('semver/functions/gte')` +* `require('semver/functions/inc')` +* `require('semver/functions/lt')` +* `require('semver/functions/lte')` +* `require('semver/functions/major')` +* `require('semver/functions/minor')` +* `require('semver/functions/neq')` +* `require('semver/functions/parse')` +* `require('semver/functions/patch')` +* `require('semver/functions/prerelease')` +* `require('semver/functions/rcompare')` +* `require('semver/functions/rsort')` +* `require('semver/functions/satisfies')` +* `require('semver/functions/sort')` +* `require('semver/functions/valid')` +* `require('semver/ranges/gtr')` +* `require('semver/ranges/intersects')` +* `require('semver/ranges/ltr')` +* `require('semver/ranges/max-satisfying')` +* `require('semver/ranges/min-satisfying')` +* `require('semver/ranges/min-version')` +* `require('semver/ranges/outside')` +* `require('semver/ranges/simplify')` +* `require('semver/ranges/subset')` +* `require('semver/ranges/to-comparators')` +* `require('semver/ranges/valid')` + diff --git a/project starter code/node_modules/semver/bin/semver.js b/project starter code/node_modules/semver/bin/semver.js new file mode 100644 index 00000000..f62b566f --- /dev/null +++ b/project starter code/node_modules/semver/bin/semver.js @@ -0,0 +1,188 @@ +#!/usr/bin/env node +// Standalone semver comparison program. +// Exits successfully and prints matching version(s) if +// any supplied version is valid and passes all tests. + +const argv = process.argv.slice(2) + +let versions = [] + +const range = [] + +let inc = null + +const version = require('../package.json').version + +let loose = false + +let includePrerelease = false + +let coerce = false + +let rtl = false + +let identifier + +let identifierBase + +const semver = require('../') +const parseOptions = require('../internal/parse-options') + +let reverse = false + +let options = {} + +const main = () => { + if (!argv.length) { + return help() + } + while (argv.length) { + let a = argv.shift() + const indexOfEqualSign = a.indexOf('=') + if (indexOfEqualSign !== -1) { + const value = a.slice(indexOfEqualSign + 1) + a = a.slice(0, indexOfEqualSign) + argv.unshift(value) + } + switch (a) { + case '-rv': case '-rev': case '--rev': case '--reverse': + reverse = true + break + case '-l': case '--loose': + loose = true + break + case '-p': case '--include-prerelease': + includePrerelease = true + break + case '-v': case '--version': + versions.push(argv.shift()) + break + case '-i': case '--inc': case '--increment': + switch (argv[0]) { + case 'major': case 'minor': case 'patch': case 'prerelease': + case 'premajor': case 'preminor': case 'prepatch': + inc = argv.shift() + break + default: + inc = 'patch' + break + } + break + case '--preid': + identifier = argv.shift() + break + case '-r': case '--range': + range.push(argv.shift()) + break + case '-n': + identifierBase = argv.shift() + if (identifierBase === 'false') { + identifierBase = false + } + break + case '-c': case '--coerce': + coerce = true + break + case '--rtl': + rtl = true + break + case '--ltr': + rtl = false + break + case '-h': case '--help': case '-?': + return help() + default: + versions.push(a) + break + } + } + + options = parseOptions({ loose, includePrerelease, rtl }) + + versions = versions.map((v) => { + return coerce ? (semver.coerce(v, options) || { version: v }).version : v + }).filter((v) => { + return semver.valid(v) + }) + if (!versions.length) { + return fail() + } + if (inc && (versions.length !== 1 || range.length)) { + return failInc() + } + + for (let i = 0, l = range.length; i < l; i++) { + versions = versions.filter((v) => { + return semver.satisfies(v, range[i], options) + }) + if (!versions.length) { + return fail() + } + } + versions + .sort((a, b) => semver[reverse ? 'rcompare' : 'compare'](a, b, options)) + .map(v => semver.clean(v, options)) + .map(v => inc ? semver.inc(v, inc, options, identifier, identifierBase) : v) + .forEach(v => console.log(v)) +} + +const failInc = () => { + console.error('--inc can only be used on a single version with no range') + fail() +} + +const fail = () => process.exit(1) + +const help = () => console.log( +`SemVer ${version} + +A JavaScript implementation of the https://semver.org/ specification +Copyright Isaac Z. Schlueter + +Usage: semver [options] [ [...]] +Prints valid versions sorted by SemVer precedence + +Options: +-r --range + Print versions that match the specified range. + +-i --increment [] + Increment a version by the specified level. Level can + be one of: major, minor, patch, premajor, preminor, + prepatch, or prerelease. Default level is 'patch'. + Only one version may be specified. + +--preid + Identifier to be used to prefix premajor, preminor, + prepatch or prerelease version increments. + +-l --loose + Interpret versions and ranges loosely + +-p --include-prerelease + Always include prerelease versions in range matching + +-c --coerce + Coerce a string into SemVer if possible + (does not imply --loose) + +--rtl + Coerce version strings right to left + +--ltr + Coerce version strings left to right (default) + +-n + Base number to be used for the prerelease identifier. + Can be either 0 or 1, or false to omit the number altogether. + Defaults to 0. + +Program exits successfully if any valid version satisfies +all supplied ranges, and prints all satisfying versions. + +If no satisfying versions are found, then exits failure. + +Versions are printed in ascending order, so supplying +multiple versions to the utility will just sort them.`) + +main() diff --git a/project starter code/node_modules/semver/classes/comparator.js b/project starter code/node_modules/semver/classes/comparator.js new file mode 100644 index 00000000..3d39c0ee --- /dev/null +++ b/project starter code/node_modules/semver/classes/comparator.js @@ -0,0 +1,141 @@ +const ANY = Symbol('SemVer ANY') +// hoisted class for cyclic dependency +class Comparator { + static get ANY () { + return ANY + } + + constructor (comp, options) { + options = parseOptions(options) + + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp + } else { + comp = comp.value + } + } + + comp = comp.trim().split(/\s+/).join(' ') + debug('comparator', comp, options) + this.options = options + this.loose = !!options.loose + this.parse(comp) + + if (this.semver === ANY) { + this.value = '' + } else { + this.value = this.operator + this.semver.version + } + + debug('comp', this) + } + + parse (comp) { + const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + const m = comp.match(r) + + if (!m) { + throw new TypeError(`Invalid comparator: ${comp}`) + } + + this.operator = m[1] !== undefined ? m[1] : '' + if (this.operator === '=') { + this.operator = '' + } + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) { + this.semver = ANY + } else { + this.semver = new SemVer(m[2], this.options.loose) + } + } + + toString () { + return this.value + } + + test (version) { + debug('Comparator.test', version, this.options.loose) + + if (this.semver === ANY || version === ANY) { + return true + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + return cmp(version, this.operator, this.semver, this.options) + } + + intersects (comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required') + } + + if (this.operator === '') { + if (this.value === '') { + return true + } + return new Range(comp.value, options).test(this.value) + } else if (comp.operator === '') { + if (comp.value === '') { + return true + } + return new Range(this.value, options).test(comp.semver) + } + + options = parseOptions(options) + + // Special cases where nothing can possibly be lower + if (options.includePrerelease && + (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) { + return false + } + if (!options.includePrerelease && + (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) { + return false + } + + // Same direction increasing (> or >=) + if (this.operator.startsWith('>') && comp.operator.startsWith('>')) { + return true + } + // Same direction decreasing (< or <=) + if (this.operator.startsWith('<') && comp.operator.startsWith('<')) { + return true + } + // same SemVer and both sides are inclusive (<= or >=) + if ( + (this.semver.version === comp.semver.version) && + this.operator.includes('=') && comp.operator.includes('=')) { + return true + } + // opposite directions less than + if (cmp(this.semver, '<', comp.semver, options) && + this.operator.startsWith('>') && comp.operator.startsWith('<')) { + return true + } + // opposite directions greater than + if (cmp(this.semver, '>', comp.semver, options) && + this.operator.startsWith('<') && comp.operator.startsWith('>')) { + return true + } + return false + } +} + +module.exports = Comparator + +const parseOptions = require('../internal/parse-options') +const { safeRe: re, t } = require('../internal/re') +const cmp = require('../functions/cmp') +const debug = require('../internal/debug') +const SemVer = require('./semver') +const Range = require('./range') diff --git a/project starter code/node_modules/semver/classes/index.js b/project starter code/node_modules/semver/classes/index.js new file mode 100644 index 00000000..5e3f5c9b --- /dev/null +++ b/project starter code/node_modules/semver/classes/index.js @@ -0,0 +1,5 @@ +module.exports = { + SemVer: require('./semver.js'), + Range: require('./range.js'), + Comparator: require('./comparator.js'), +} diff --git a/project starter code/node_modules/semver/classes/range.js b/project starter code/node_modules/semver/classes/range.js new file mode 100644 index 00000000..117b45a2 --- /dev/null +++ b/project starter code/node_modules/semver/classes/range.js @@ -0,0 +1,540 @@ +// hoisted class for cyclic dependency +class Range { + constructor (range, options) { + options = parseOptions(options) + + if (range instanceof Range) { + if ( + range.loose === !!options.loose && + range.includePrerelease === !!options.includePrerelease + ) { + return range + } else { + return new Range(range.raw, options) + } + } + + if (range instanceof Comparator) { + // just put it in the set and return + this.raw = range.value + this.set = [[range]] + this.format() + return this + } + + this.options = options + this.loose = !!options.loose + this.includePrerelease = !!options.includePrerelease + + // First reduce all whitespace as much as possible so we do not have to rely + // on potentially slow regexes like \s*. This is then stored and used for + // future error messages as well. + this.raw = range + .trim() + .split(/\s+/) + .join(' ') + + // First, split on || + this.set = this.raw + .split('||') + // map the range to a 2d array of comparators + .map(r => this.parseRange(r.trim())) + // throw out any comparator lists that are empty + // this generally means that it was not a valid range, which is allowed + // in loose mode, but will still throw if the WHOLE range is invalid. + .filter(c => c.length) + + if (!this.set.length) { + throw new TypeError(`Invalid SemVer Range: ${this.raw}`) + } + + // if we have any that are not the null set, throw out null sets. + if (this.set.length > 1) { + // keep the first one, in case they're all null sets + const first = this.set[0] + this.set = this.set.filter(c => !isNullSet(c[0])) + if (this.set.length === 0) { + this.set = [first] + } else if (this.set.length > 1) { + // if we have any that are *, then the range is just * + for (const c of this.set) { + if (c.length === 1 && isAny(c[0])) { + this.set = [c] + break + } + } + } + } + + this.format() + } + + format () { + this.range = this.set + .map((comps) => comps.join(' ').trim()) + .join('||') + .trim() + return this.range + } + + toString () { + return this.range + } + + parseRange (range) { + // memoize range parsing for performance. + // this is a very hot path, and fully deterministic. + const memoOpts = + (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | + (this.options.loose && FLAG_LOOSE) + const memoKey = memoOpts + ':' + range + const cached = cache.get(memoKey) + if (cached) { + return cached + } + + const loose = this.options.loose + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] + range = range.replace(hr, hyphenReplace(this.options.includePrerelease)) + debug('hyphen replace', range) + + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range) + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(re[t.TILDETRIM], tildeTrimReplace) + debug('tilde trim', range) + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(re[t.CARETTRIM], caretTrimReplace) + debug('caret trim', range) + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + let rangeList = range + .split(' ') + .map(comp => parseComparator(comp, this.options)) + .join(' ') + .split(/\s+/) + // >=0.0.0 is equivalent to * + .map(comp => replaceGTE0(comp, this.options)) + + if (loose) { + // in loose mode, throw out any that are not valid comparators + rangeList = rangeList.filter(comp => { + debug('loose invalid filter', comp, this.options) + return !!comp.match(re[t.COMPARATORLOOSE]) + }) + } + debug('range list', rangeList) + + // if any comparators are the null set, then replace with JUST null set + // if more than one comparator, remove any * comparators + // also, don't include the same comparator more than once + const rangeMap = new Map() + const comparators = rangeList.map(comp => new Comparator(comp, this.options)) + for (const comp of comparators) { + if (isNullSet(comp)) { + return [comp] + } + rangeMap.set(comp.value, comp) + } + if (rangeMap.size > 1 && rangeMap.has('')) { + rangeMap.delete('') + } + + const result = [...rangeMap.values()] + cache.set(memoKey, result) + return result + } + + intersects (range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required') + } + + return this.set.some((thisComparators) => { + return ( + isSatisfiable(thisComparators, options) && + range.set.some((rangeComparators) => { + return ( + isSatisfiable(rangeComparators, options) && + thisComparators.every((thisComparator) => { + return rangeComparators.every((rangeComparator) => { + return thisComparator.intersects(rangeComparator, options) + }) + }) + ) + }) + ) + }) + } + + // if ANY of the sets match ALL of its comparators, then pass + test (version) { + if (!version) { + return false + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + for (let i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true + } + } + return false + } +} + +module.exports = Range + +const LRU = require('../internal/lrucache') +const cache = new LRU() + +const parseOptions = require('../internal/parse-options') +const Comparator = require('./comparator') +const debug = require('../internal/debug') +const SemVer = require('./semver') +const { + safeRe: re, + t, + comparatorTrimReplace, + tildeTrimReplace, + caretTrimReplace, +} = require('../internal/re') +const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require('../internal/constants') + +const isNullSet = c => c.value === '<0.0.0-0' +const isAny = c => c.value === '' + +// take a set of comparators and determine whether there +// exists a version which can satisfy it +const isSatisfiable = (comparators, options) => { + let result = true + const remainingComparators = comparators.slice() + let testComparator = remainingComparators.pop() + + while (result && remainingComparators.length) { + result = remainingComparators.every((otherComparator) => { + return testComparator.intersects(otherComparator, options) + }) + + testComparator = remainingComparators.pop() + } + + return result +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +const parseComparator = (comp, options) => { + debug('comp', comp, options) + comp = replaceCarets(comp, options) + debug('caret', comp) + comp = replaceTildes(comp, options) + debug('tildes', comp) + comp = replaceXRanges(comp, options) + debug('xrange', comp) + comp = replaceStars(comp, options) + debug('stars', comp) + return comp +} + +const isX = id => !id || id.toLowerCase() === 'x' || id === '*' + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0 +// ~0.0.1 --> >=0.0.1 <0.1.0-0 +const replaceTildes = (comp, options) => { + return comp + .trim() + .split(/\s+/) + .map((c) => replaceTilde(c, options)) + .join(' ') +} + +const replaceTilde = (comp, options) => { + const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE] + return comp.replace(r, (_, M, m, p, pr) => { + debug('tilde', comp, _, M, m, p, pr) + let ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = `>=${M}.0.0 <${+M + 1}.0.0-0` + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0-0 + ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0` + } else if (pr) { + debug('replaceTilde pr', pr) + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${+m + 1}.0-0` + } else { + // ~1.2.3 == >=1.2.3 <1.3.0-0 + ret = `>=${M}.${m}.${p + } <${M}.${+m + 1}.0-0` + } + + debug('tilde return', ret) + return ret + }) +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0 +// ^1.2.3 --> >=1.2.3 <2.0.0-0 +// ^1.2.0 --> >=1.2.0 <2.0.0-0 +// ^0.0.1 --> >=0.0.1 <0.0.2-0 +// ^0.1.0 --> >=0.1.0 <0.2.0-0 +const replaceCarets = (comp, options) => { + return comp + .trim() + .split(/\s+/) + .map((c) => replaceCaret(c, options)) + .join(' ') +} + +const replaceCaret = (comp, options) => { + debug('caret', comp, options) + const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET] + const z = options.includePrerelease ? '-0' : '' + return comp.replace(r, (_, M, m, p, pr) => { + debug('caret', comp, _, M, m, p, pr) + let ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0` + } else if (isX(p)) { + if (M === '0') { + ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0` + } else { + ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0` + } + } else if (pr) { + debug('replaceCaret pr', pr) + if (M === '0') { + if (m === '0') { + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${m}.${+p + 1}-0` + } else { + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${+m + 1}.0-0` + } + } else { + ret = `>=${M}.${m}.${p}-${pr + } <${+M + 1}.0.0-0` + } + } else { + debug('no pr') + if (M === '0') { + if (m === '0') { + ret = `>=${M}.${m}.${p + }${z} <${M}.${m}.${+p + 1}-0` + } else { + ret = `>=${M}.${m}.${p + }${z} <${M}.${+m + 1}.0-0` + } + } else { + ret = `>=${M}.${m}.${p + } <${+M + 1}.0.0-0` + } + } + + debug('caret return', ret) + return ret + }) +} + +const replaceXRanges = (comp, options) => { + debug('replaceXRanges', comp, options) + return comp + .split(/\s+/) + .map((c) => replaceXRange(c, options)) + .join(' ') +} + +const replaceXRange = (comp, options) => { + comp = comp.trim() + const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE] + return comp.replace(r, (ret, gtlt, M, m, p, pr) => { + debug('xRange', comp, ret, gtlt, M, m, p, pr) + const xM = isX(M) + const xm = xM || isX(m) + const xp = xm || isX(p) + const anyX = xp + + if (gtlt === '=' && anyX) { + gtlt = '' + } + + // if we're including prereleases in the match, then we need + // to fix this to -0, the lowest possible prerelease value + pr = options.includePrerelease ? '-0' : '' + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0-0' + } else { + // nothing is forbidden + ret = '*' + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0 + } + p = 0 + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + gtlt = '>=' + if (xm) { + M = +M + 1 + m = 0 + p = 0 + } else { + m = +m + 1 + p = 0 + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<' + if (xm) { + M = +M + 1 + } else { + m = +m + 1 + } + } + + if (gtlt === '<') { + pr = '-0' + } + + ret = `${gtlt + M}.${m}.${p}${pr}` + } else if (xm) { + ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0` + } else if (xp) { + ret = `>=${M}.${m}.0${pr + } <${M}.${+m + 1}.0-0` + } + + debug('xRange return', ret) + + return ret + }) +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +const replaceStars = (comp, options) => { + debug('replaceStars', comp, options) + // Looseness is ignored here. star is always as loose as it gets! + return comp + .trim() + .replace(re[t.STAR], '') +} + +const replaceGTE0 = (comp, options) => { + debug('replaceGTE0', comp, options) + return comp + .trim() + .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '') +} + +// This function is passed to string.replace(re[t.HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0-0 +// TODO build? +const hyphenReplace = incPr => ($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr) => { + if (isX(fM)) { + from = '' + } else if (isX(fm)) { + from = `>=${fM}.0.0${incPr ? '-0' : ''}` + } else if (isX(fp)) { + from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}` + } else if (fpr) { + from = `>=${from}` + } else { + from = `>=${from}${incPr ? '-0' : ''}` + } + + if (isX(tM)) { + to = '' + } else if (isX(tm)) { + to = `<${+tM + 1}.0.0-0` + } else if (isX(tp)) { + to = `<${tM}.${+tm + 1}.0-0` + } else if (tpr) { + to = `<=${tM}.${tm}.${tp}-${tpr}` + } else if (incPr) { + to = `<${tM}.${tm}.${+tp + 1}-0` + } else { + to = `<=${to}` + } + + return `${from} ${to}`.trim() +} + +const testSet = (set, version, options) => { + for (let i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false + } + } + + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (let i = 0; i < set.length; i++) { + debug(set[i].semver) + if (set[i].semver === Comparator.ANY) { + continue + } + + if (set[i].semver.prerelease.length > 0) { + const allowed = set[i].semver + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) { + return true + } + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false + } + + return true +} diff --git a/project starter code/node_modules/semver/classes/semver.js b/project starter code/node_modules/semver/classes/semver.js new file mode 100644 index 00000000..13e66ce4 --- /dev/null +++ b/project starter code/node_modules/semver/classes/semver.js @@ -0,0 +1,302 @@ +const debug = require('../internal/debug') +const { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants') +const { safeRe: re, t } = require('../internal/re') + +const parseOptions = require('../internal/parse-options') +const { compareIdentifiers } = require('../internal/identifiers') +class SemVer { + constructor (version, options) { + options = parseOptions(options) + + if (version instanceof SemVer) { + if (version.loose === !!options.loose && + version.includePrerelease === !!options.includePrerelease) { + return version + } else { + version = version.version + } + } else if (typeof version !== 'string') { + throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`) + } + + if (version.length > MAX_LENGTH) { + throw new TypeError( + `version is longer than ${MAX_LENGTH} characters` + ) + } + + debug('SemVer', version, options) + this.options = options + this.loose = !!options.loose + // this isn't actually relevant for versions, but keep it so that we + // don't run into trouble passing this.options around. + this.includePrerelease = !!options.includePrerelease + + const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]) + + if (!m) { + throw new TypeError(`Invalid Version: ${version}`) + } + + this.raw = version + + // these are actually numbers + this.major = +m[1] + this.minor = +m[2] + this.patch = +m[3] + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version') + } + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version') + } + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version') + } + + // numberify any prerelease numeric ids + if (!m[4]) { + this.prerelease = [] + } else { + this.prerelease = m[4].split('.').map((id) => { + if (/^[0-9]+$/.test(id)) { + const num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num + } + } + return id + }) + } + + this.build = m[5] ? m[5].split('.') : [] + this.format() + } + + format () { + this.version = `${this.major}.${this.minor}.${this.patch}` + if (this.prerelease.length) { + this.version += `-${this.prerelease.join('.')}` + } + return this.version + } + + toString () { + return this.version + } + + compare (other) { + debug('SemVer.compare', this.version, this.options, other) + if (!(other instanceof SemVer)) { + if (typeof other === 'string' && other === this.version) { + return 0 + } + other = new SemVer(other, this.options) + } + + if (other.version === this.version) { + return 0 + } + + return this.compareMain(other) || this.comparePre(other) + } + + compareMain (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + return ( + compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch) + ) + } + + comparePre (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) { + return -1 + } else if (!this.prerelease.length && other.prerelease.length) { + return 1 + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0 + } + + let i = 0 + do { + const a = this.prerelease[i] + const b = other.prerelease[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) + } + + compareBuild (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } + + let i = 0 + do { + const a = this.build[i] + const b = other.build[i] + debug('build compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) + } + + // preminor will bump the version up to the next minor release, and immediately + // down to pre-release. premajor and prepatch work the same way. + inc (release, identifier, identifierBase) { + switch (release) { + case 'premajor': + this.prerelease.length = 0 + this.patch = 0 + this.minor = 0 + this.major++ + this.inc('pre', identifier, identifierBase) + break + case 'preminor': + this.prerelease.length = 0 + this.patch = 0 + this.minor++ + this.inc('pre', identifier, identifierBase) + break + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0 + this.inc('patch', identifier, identifierBase) + this.inc('pre', identifier, identifierBase) + break + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier, identifierBase) + } + this.inc('pre', identifier, identifierBase) + break + + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if ( + this.minor !== 0 || + this.patch !== 0 || + this.prerelease.length === 0 + ) { + this.major++ + } + this.minor = 0 + this.patch = 0 + this.prerelease = [] + break + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++ + } + this.patch = 0 + this.prerelease = [] + break + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++ + } + this.prerelease = [] + break + // This probably shouldn't be used publicly. + // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. + case 'pre': { + const base = Number(identifierBase) ? 1 : 0 + + if (!identifier && identifierBase === false) { + throw new Error('invalid increment argument: identifier is empty') + } + + if (this.prerelease.length === 0) { + this.prerelease = [base] + } else { + let i = this.prerelease.length + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++ + i = -2 + } + } + if (i === -1) { + // didn't increment anything + if (identifier === this.prerelease.join('.') && identifierBase === false) { + throw new Error('invalid increment argument: identifier already exists') + } + this.prerelease.push(base) + } + } + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + let prerelease = [identifier, base] + if (identifierBase === false) { + prerelease = [identifier] + } + if (compareIdentifiers(this.prerelease[0], identifier) === 0) { + if (isNaN(this.prerelease[1])) { + this.prerelease = prerelease + } + } else { + this.prerelease = prerelease + } + } + break + } + default: + throw new Error(`invalid increment argument: ${release}`) + } + this.raw = this.format() + if (this.build.length) { + this.raw += `+${this.build.join('.')}` + } + return this + } +} + +module.exports = SemVer diff --git a/project starter code/node_modules/semver/functions/clean.js b/project starter code/node_modules/semver/functions/clean.js new file mode 100644 index 00000000..811fe6b8 --- /dev/null +++ b/project starter code/node_modules/semver/functions/clean.js @@ -0,0 +1,6 @@ +const parse = require('./parse') +const clean = (version, options) => { + const s = parse(version.trim().replace(/^[=v]+/, ''), options) + return s ? s.version : null +} +module.exports = clean diff --git a/project starter code/node_modules/semver/functions/cmp.js b/project starter code/node_modules/semver/functions/cmp.js new file mode 100644 index 00000000..40119094 --- /dev/null +++ b/project starter code/node_modules/semver/functions/cmp.js @@ -0,0 +1,52 @@ +const eq = require('./eq') +const neq = require('./neq') +const gt = require('./gt') +const gte = require('./gte') +const lt = require('./lt') +const lte = require('./lte') + +const cmp = (a, op, b, loose) => { + switch (op) { + case '===': + if (typeof a === 'object') { + a = a.version + } + if (typeof b === 'object') { + b = b.version + } + return a === b + + case '!==': + if (typeof a === 'object') { + a = a.version + } + if (typeof b === 'object') { + b = b.version + } + return a !== b + + case '': + case '=': + case '==': + return eq(a, b, loose) + + case '!=': + return neq(a, b, loose) + + case '>': + return gt(a, b, loose) + + case '>=': + return gte(a, b, loose) + + case '<': + return lt(a, b, loose) + + case '<=': + return lte(a, b, loose) + + default: + throw new TypeError(`Invalid operator: ${op}`) + } +} +module.exports = cmp diff --git a/project starter code/node_modules/semver/functions/coerce.js b/project starter code/node_modules/semver/functions/coerce.js new file mode 100644 index 00000000..b378dcea --- /dev/null +++ b/project starter code/node_modules/semver/functions/coerce.js @@ -0,0 +1,60 @@ +const SemVer = require('../classes/semver') +const parse = require('./parse') +const { safeRe: re, t } = require('../internal/re') + +const coerce = (version, options) => { + if (version instanceof SemVer) { + return version + } + + if (typeof version === 'number') { + version = String(version) + } + + if (typeof version !== 'string') { + return null + } + + options = options || {} + + let match = null + if (!options.rtl) { + match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]) + } else { + // Find the right-most coercible string that does not share + // a terminus with a more left-ward coercible string. + // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' + // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4' + // + // Walk through the string checking with a /g regexp + // Manually set the index so as to pick up overlapping matches. + // Stop when we get a match that ends at the string end, since no + // coercible string can be more right-ward without the same terminus. + const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL] + let next + while ((next = coerceRtlRegex.exec(version)) && + (!match || match.index + match[0].length !== version.length) + ) { + if (!match || + next.index + next[0].length !== match.index + match[0].length) { + match = next + } + coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length + } + // leave it in a clean state + coerceRtlRegex.lastIndex = -1 + } + + if (match === null) { + return null + } + + const major = match[2] + const minor = match[3] || '0' + const patch = match[4] || '0' + const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : '' + const build = options.includePrerelease && match[6] ? `+${match[6]}` : '' + + return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options) +} +module.exports = coerce diff --git a/project starter code/node_modules/semver/functions/compare-build.js b/project starter code/node_modules/semver/functions/compare-build.js new file mode 100644 index 00000000..9eb881be --- /dev/null +++ b/project starter code/node_modules/semver/functions/compare-build.js @@ -0,0 +1,7 @@ +const SemVer = require('../classes/semver') +const compareBuild = (a, b, loose) => { + const versionA = new SemVer(a, loose) + const versionB = new SemVer(b, loose) + return versionA.compare(versionB) || versionA.compareBuild(versionB) +} +module.exports = compareBuild diff --git a/project starter code/node_modules/semver/functions/compare-loose.js b/project starter code/node_modules/semver/functions/compare-loose.js new file mode 100644 index 00000000..4881fbe0 --- /dev/null +++ b/project starter code/node_modules/semver/functions/compare-loose.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const compareLoose = (a, b) => compare(a, b, true) +module.exports = compareLoose diff --git a/project starter code/node_modules/semver/functions/compare.js b/project starter code/node_modules/semver/functions/compare.js new file mode 100644 index 00000000..748b7afa --- /dev/null +++ b/project starter code/node_modules/semver/functions/compare.js @@ -0,0 +1,5 @@ +const SemVer = require('../classes/semver') +const compare = (a, b, loose) => + new SemVer(a, loose).compare(new SemVer(b, loose)) + +module.exports = compare diff --git a/project starter code/node_modules/semver/functions/diff.js b/project starter code/node_modules/semver/functions/diff.js new file mode 100644 index 00000000..fc224e30 --- /dev/null +++ b/project starter code/node_modules/semver/functions/diff.js @@ -0,0 +1,65 @@ +const parse = require('./parse.js') + +const diff = (version1, version2) => { + const v1 = parse(version1, null, true) + const v2 = parse(version2, null, true) + const comparison = v1.compare(v2) + + if (comparison === 0) { + return null + } + + const v1Higher = comparison > 0 + const highVersion = v1Higher ? v1 : v2 + const lowVersion = v1Higher ? v2 : v1 + const highHasPre = !!highVersion.prerelease.length + const lowHasPre = !!lowVersion.prerelease.length + + if (lowHasPre && !highHasPre) { + // Going from prerelease -> no prerelease requires some special casing + + // If the low version has only a major, then it will always be a major + // Some examples: + // 1.0.0-1 -> 1.0.0 + // 1.0.0-1 -> 1.1.1 + // 1.0.0-1 -> 2.0.0 + if (!lowVersion.patch && !lowVersion.minor) { + return 'major' + } + + // Otherwise it can be determined by checking the high version + + if (highVersion.patch) { + // anything higher than a patch bump would result in the wrong version + return 'patch' + } + + if (highVersion.minor) { + // anything higher than a minor bump would result in the wrong version + return 'minor' + } + + // bumping major/minor/patch all have same result + return 'major' + } + + // add the `pre` prefix if we are going to a prerelease version + const prefix = highHasPre ? 'pre' : '' + + if (v1.major !== v2.major) { + return prefix + 'major' + } + + if (v1.minor !== v2.minor) { + return prefix + 'minor' + } + + if (v1.patch !== v2.patch) { + return prefix + 'patch' + } + + // high and low are preleases + return 'prerelease' +} + +module.exports = diff diff --git a/project starter code/node_modules/semver/functions/eq.js b/project starter code/node_modules/semver/functions/eq.js new file mode 100644 index 00000000..271fed97 --- /dev/null +++ b/project starter code/node_modules/semver/functions/eq.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const eq = (a, b, loose) => compare(a, b, loose) === 0 +module.exports = eq diff --git a/project starter code/node_modules/semver/functions/gt.js b/project starter code/node_modules/semver/functions/gt.js new file mode 100644 index 00000000..d9b2156d --- /dev/null +++ b/project starter code/node_modules/semver/functions/gt.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const gt = (a, b, loose) => compare(a, b, loose) > 0 +module.exports = gt diff --git a/project starter code/node_modules/semver/functions/gte.js b/project starter code/node_modules/semver/functions/gte.js new file mode 100644 index 00000000..5aeaa634 --- /dev/null +++ b/project starter code/node_modules/semver/functions/gte.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const gte = (a, b, loose) => compare(a, b, loose) >= 0 +module.exports = gte diff --git a/project starter code/node_modules/semver/functions/inc.js b/project starter code/node_modules/semver/functions/inc.js new file mode 100644 index 00000000..7670b1be --- /dev/null +++ b/project starter code/node_modules/semver/functions/inc.js @@ -0,0 +1,19 @@ +const SemVer = require('../classes/semver') + +const inc = (version, release, options, identifier, identifierBase) => { + if (typeof (options) === 'string') { + identifierBase = identifier + identifier = options + options = undefined + } + + try { + return new SemVer( + version instanceof SemVer ? version.version : version, + options + ).inc(release, identifier, identifierBase).version + } catch (er) { + return null + } +} +module.exports = inc diff --git a/project starter code/node_modules/semver/functions/lt.js b/project starter code/node_modules/semver/functions/lt.js new file mode 100644 index 00000000..b440ab7d --- /dev/null +++ b/project starter code/node_modules/semver/functions/lt.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const lt = (a, b, loose) => compare(a, b, loose) < 0 +module.exports = lt diff --git a/project starter code/node_modules/semver/functions/lte.js b/project starter code/node_modules/semver/functions/lte.js new file mode 100644 index 00000000..6dcc9565 --- /dev/null +++ b/project starter code/node_modules/semver/functions/lte.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const lte = (a, b, loose) => compare(a, b, loose) <= 0 +module.exports = lte diff --git a/project starter code/node_modules/semver/functions/major.js b/project starter code/node_modules/semver/functions/major.js new file mode 100644 index 00000000..4283165e --- /dev/null +++ b/project starter code/node_modules/semver/functions/major.js @@ -0,0 +1,3 @@ +const SemVer = require('../classes/semver') +const major = (a, loose) => new SemVer(a, loose).major +module.exports = major diff --git a/project starter code/node_modules/semver/functions/minor.js b/project starter code/node_modules/semver/functions/minor.js new file mode 100644 index 00000000..57b3455f --- /dev/null +++ b/project starter code/node_modules/semver/functions/minor.js @@ -0,0 +1,3 @@ +const SemVer = require('../classes/semver') +const minor = (a, loose) => new SemVer(a, loose).minor +module.exports = minor diff --git a/project starter code/node_modules/semver/functions/neq.js b/project starter code/node_modules/semver/functions/neq.js new file mode 100644 index 00000000..f944c015 --- /dev/null +++ b/project starter code/node_modules/semver/functions/neq.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const neq = (a, b, loose) => compare(a, b, loose) !== 0 +module.exports = neq diff --git a/project starter code/node_modules/semver/functions/parse.js b/project starter code/node_modules/semver/functions/parse.js new file mode 100644 index 00000000..459b3b17 --- /dev/null +++ b/project starter code/node_modules/semver/functions/parse.js @@ -0,0 +1,16 @@ +const SemVer = require('../classes/semver') +const parse = (version, options, throwErrors = false) => { + if (version instanceof SemVer) { + return version + } + try { + return new SemVer(version, options) + } catch (er) { + if (!throwErrors) { + return null + } + throw er + } +} + +module.exports = parse diff --git a/project starter code/node_modules/semver/functions/patch.js b/project starter code/node_modules/semver/functions/patch.js new file mode 100644 index 00000000..63afca25 --- /dev/null +++ b/project starter code/node_modules/semver/functions/patch.js @@ -0,0 +1,3 @@ +const SemVer = require('../classes/semver') +const patch = (a, loose) => new SemVer(a, loose).patch +module.exports = patch diff --git a/project starter code/node_modules/semver/functions/prerelease.js b/project starter code/node_modules/semver/functions/prerelease.js new file mode 100644 index 00000000..06aa1324 --- /dev/null +++ b/project starter code/node_modules/semver/functions/prerelease.js @@ -0,0 +1,6 @@ +const parse = require('./parse') +const prerelease = (version, options) => { + const parsed = parse(version, options) + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null +} +module.exports = prerelease diff --git a/project starter code/node_modules/semver/functions/rcompare.js b/project starter code/node_modules/semver/functions/rcompare.js new file mode 100644 index 00000000..0ac509e7 --- /dev/null +++ b/project starter code/node_modules/semver/functions/rcompare.js @@ -0,0 +1,3 @@ +const compare = require('./compare') +const rcompare = (a, b, loose) => compare(b, a, loose) +module.exports = rcompare diff --git a/project starter code/node_modules/semver/functions/rsort.js b/project starter code/node_modules/semver/functions/rsort.js new file mode 100644 index 00000000..82404c5c --- /dev/null +++ b/project starter code/node_modules/semver/functions/rsort.js @@ -0,0 +1,3 @@ +const compareBuild = require('./compare-build') +const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)) +module.exports = rsort diff --git a/project starter code/node_modules/semver/functions/satisfies.js b/project starter code/node_modules/semver/functions/satisfies.js new file mode 100644 index 00000000..50af1c19 --- /dev/null +++ b/project starter code/node_modules/semver/functions/satisfies.js @@ -0,0 +1,10 @@ +const Range = require('../classes/range') +const satisfies = (version, range, options) => { + try { + range = new Range(range, options) + } catch (er) { + return false + } + return range.test(version) +} +module.exports = satisfies diff --git a/project starter code/node_modules/semver/functions/sort.js b/project starter code/node_modules/semver/functions/sort.js new file mode 100644 index 00000000..4d10917a --- /dev/null +++ b/project starter code/node_modules/semver/functions/sort.js @@ -0,0 +1,3 @@ +const compareBuild = require('./compare-build') +const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)) +module.exports = sort diff --git a/project starter code/node_modules/semver/functions/valid.js b/project starter code/node_modules/semver/functions/valid.js new file mode 100644 index 00000000..f27bae10 --- /dev/null +++ b/project starter code/node_modules/semver/functions/valid.js @@ -0,0 +1,6 @@ +const parse = require('./parse') +const valid = (version, options) => { + const v = parse(version, options) + return v ? v.version : null +} +module.exports = valid diff --git a/project starter code/node_modules/semver/index.js b/project starter code/node_modules/semver/index.js new file mode 100644 index 00000000..86d42ac1 --- /dev/null +++ b/project starter code/node_modules/semver/index.js @@ -0,0 +1,89 @@ +// just pre-load all the stuff that index.js lazily exports +const internalRe = require('./internal/re') +const constants = require('./internal/constants') +const SemVer = require('./classes/semver') +const identifiers = require('./internal/identifiers') +const parse = require('./functions/parse') +const valid = require('./functions/valid') +const clean = require('./functions/clean') +const inc = require('./functions/inc') +const diff = require('./functions/diff') +const major = require('./functions/major') +const minor = require('./functions/minor') +const patch = require('./functions/patch') +const prerelease = require('./functions/prerelease') +const compare = require('./functions/compare') +const rcompare = require('./functions/rcompare') +const compareLoose = require('./functions/compare-loose') +const compareBuild = require('./functions/compare-build') +const sort = require('./functions/sort') +const rsort = require('./functions/rsort') +const gt = require('./functions/gt') +const lt = require('./functions/lt') +const eq = require('./functions/eq') +const neq = require('./functions/neq') +const gte = require('./functions/gte') +const lte = require('./functions/lte') +const cmp = require('./functions/cmp') +const coerce = require('./functions/coerce') +const Comparator = require('./classes/comparator') +const Range = require('./classes/range') +const satisfies = require('./functions/satisfies') +const toComparators = require('./ranges/to-comparators') +const maxSatisfying = require('./ranges/max-satisfying') +const minSatisfying = require('./ranges/min-satisfying') +const minVersion = require('./ranges/min-version') +const validRange = require('./ranges/valid') +const outside = require('./ranges/outside') +const gtr = require('./ranges/gtr') +const ltr = require('./ranges/ltr') +const intersects = require('./ranges/intersects') +const simplifyRange = require('./ranges/simplify') +const subset = require('./ranges/subset') +module.exports = { + parse, + valid, + clean, + inc, + diff, + major, + minor, + patch, + prerelease, + compare, + rcompare, + compareLoose, + compareBuild, + sort, + rsort, + gt, + lt, + eq, + neq, + gte, + lte, + cmp, + coerce, + Comparator, + Range, + satisfies, + toComparators, + maxSatisfying, + minSatisfying, + minVersion, + validRange, + outside, + gtr, + ltr, + intersects, + simplifyRange, + subset, + SemVer, + re: internalRe.re, + src: internalRe.src, + tokens: internalRe.t, + SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION, + RELEASE_TYPES: constants.RELEASE_TYPES, + compareIdentifiers: identifiers.compareIdentifiers, + rcompareIdentifiers: identifiers.rcompareIdentifiers, +} diff --git a/project starter code/node_modules/semver/internal/constants.js b/project starter code/node_modules/semver/internal/constants.js new file mode 100644 index 00000000..94be1c57 --- /dev/null +++ b/project starter code/node_modules/semver/internal/constants.js @@ -0,0 +1,35 @@ +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +const SEMVER_SPEC_VERSION = '2.0.0' + +const MAX_LENGTH = 256 +const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || +/* istanbul ignore next */ 9007199254740991 + +// Max safe segment length for coercion. +const MAX_SAFE_COMPONENT_LENGTH = 16 + +// Max safe length for a build identifier. The max length minus 6 characters for +// the shortest version with a build 0.0.0+BUILD. +const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6 + +const RELEASE_TYPES = [ + 'major', + 'premajor', + 'minor', + 'preminor', + 'patch', + 'prepatch', + 'prerelease', +] + +module.exports = { + MAX_LENGTH, + MAX_SAFE_COMPONENT_LENGTH, + MAX_SAFE_BUILD_LENGTH, + MAX_SAFE_INTEGER, + RELEASE_TYPES, + SEMVER_SPEC_VERSION, + FLAG_INCLUDE_PRERELEASE: 0b001, + FLAG_LOOSE: 0b010, +} diff --git a/project starter code/node_modules/semver/internal/debug.js b/project starter code/node_modules/semver/internal/debug.js new file mode 100644 index 00000000..1c00e136 --- /dev/null +++ b/project starter code/node_modules/semver/internal/debug.js @@ -0,0 +1,9 @@ +const debug = ( + typeof process === 'object' && + process.env && + process.env.NODE_DEBUG && + /\bsemver\b/i.test(process.env.NODE_DEBUG) +) ? (...args) => console.error('SEMVER', ...args) + : () => {} + +module.exports = debug diff --git a/project starter code/node_modules/semver/internal/identifiers.js b/project starter code/node_modules/semver/internal/identifiers.js new file mode 100644 index 00000000..e612d0a3 --- /dev/null +++ b/project starter code/node_modules/semver/internal/identifiers.js @@ -0,0 +1,23 @@ +const numeric = /^[0-9]+$/ +const compareIdentifiers = (a, b) => { + const anum = numeric.test(a) + const bnum = numeric.test(b) + + if (anum && bnum) { + a = +a + b = +b + } + + return a === b ? 0 + : (anum && !bnum) ? -1 + : (bnum && !anum) ? 1 + : a < b ? -1 + : 1 +} + +const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a) + +module.exports = { + compareIdentifiers, + rcompareIdentifiers, +} diff --git a/project starter code/node_modules/semver/internal/lrucache.js b/project starter code/node_modules/semver/internal/lrucache.js new file mode 100644 index 00000000..6d89ec94 --- /dev/null +++ b/project starter code/node_modules/semver/internal/lrucache.js @@ -0,0 +1,40 @@ +class LRUCache { + constructor () { + this.max = 1000 + this.map = new Map() + } + + get (key) { + const value = this.map.get(key) + if (value === undefined) { + return undefined + } else { + // Remove the key from the map and add it to the end + this.map.delete(key) + this.map.set(key, value) + return value + } + } + + delete (key) { + return this.map.delete(key) + } + + set (key, value) { + const deleted = this.delete(key) + + if (!deleted && value !== undefined) { + // If cache is full, delete the least recently used item + if (this.map.size >= this.max) { + const firstKey = this.map.keys().next().value + this.delete(firstKey) + } + + this.map.set(key, value) + } + + return this + } +} + +module.exports = LRUCache diff --git a/project starter code/node_modules/semver/internal/parse-options.js b/project starter code/node_modules/semver/internal/parse-options.js new file mode 100644 index 00000000..10d64ce0 --- /dev/null +++ b/project starter code/node_modules/semver/internal/parse-options.js @@ -0,0 +1,15 @@ +// parse out just the options we care about +const looseOption = Object.freeze({ loose: true }) +const emptyOpts = Object.freeze({ }) +const parseOptions = options => { + if (!options) { + return emptyOpts + } + + if (typeof options !== 'object') { + return looseOption + } + + return options +} +module.exports = parseOptions diff --git a/project starter code/node_modules/semver/internal/re.js b/project starter code/node_modules/semver/internal/re.js new file mode 100644 index 00000000..fd8920e7 --- /dev/null +++ b/project starter code/node_modules/semver/internal/re.js @@ -0,0 +1,217 @@ +const { + MAX_SAFE_COMPONENT_LENGTH, + MAX_SAFE_BUILD_LENGTH, + MAX_LENGTH, +} = require('./constants') +const debug = require('./debug') +exports = module.exports = {} + +// The actual regexps go on exports.re +const re = exports.re = [] +const safeRe = exports.safeRe = [] +const src = exports.src = [] +const t = exports.t = {} +let R = 0 + +const LETTERDASHNUMBER = '[a-zA-Z0-9-]' + +// Replace some greedy regex tokens to prevent regex dos issues. These regex are +// used internally via the safeRe object since all inputs in this library get +// normalized first to trim and collapse all extra whitespace. The original +// regexes are exported for userland consumption and lower level usage. A +// future breaking change could export the safer regex only with a note that +// all input should have extra whitespace removed. +const safeRegexReplacements = [ + ['\\s', 1], + ['\\d', MAX_LENGTH], + [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH], +] + +const makeSafeRegex = (value) => { + for (const [token, max] of safeRegexReplacements) { + value = value + .split(`${token}*`).join(`${token}{0,${max}}`) + .split(`${token}+`).join(`${token}{1,${max}}`) + } + return value +} + +const createToken = (name, value, isGlobal) => { + const safe = makeSafeRegex(value) + const index = R++ + debug(name, index, value) + t[name] = index + src[index] = value + re[index] = new RegExp(value, isGlobal ? 'g' : undefined) + safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined) +} + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*') +createToken('NUMERICIDENTIFIERLOOSE', '\\d+') + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`) + +// ## Main Version +// Three dot-separated numeric identifiers. + +createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})`) + +createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})`) + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER] +}|${src[t.NONNUMERICIDENTIFIER]})`) + +createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE] +}|${src[t.NONNUMERICIDENTIFIER]})`) + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER] +}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`) + +createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE] +}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`) + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`) + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER] +}(?:\\.${src[t.BUILDIDENTIFIER]})*))`) + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +createToken('FULLPLAIN', `v?${src[t.MAINVERSION] +}${src[t.PRERELEASE]}?${ + src[t.BUILD]}?`) + +createToken('FULL', `^${src[t.FULLPLAIN]}$`) + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] +}${src[t.PRERELEASELOOSE]}?${ + src[t.BUILD]}?`) + +createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`) + +createToken('GTLT', '((?:<|>)?=?)') + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`) +createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`) + +createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:${src[t.PRERELEASE]})?${ + src[t.BUILD]}?` + + `)?)?`) + +createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:${src[t.PRERELEASELOOSE]})?${ + src[t.BUILD]}?` + + `)?)?`) + +createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`) +createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`) + +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +createToken('COERCEPLAIN', `${'(^|[^\\d])' + + '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`) +createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`) +createToken('COERCEFULL', src[t.COERCEPLAIN] + + `(?:${src[t.PRERELEASE]})?` + + `(?:${src[t.BUILD]})?` + + `(?:$|[^\\d])`) +createToken('COERCERTL', src[t.COERCE], true) +createToken('COERCERTLFULL', src[t.COERCEFULL], true) + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +createToken('LONETILDE', '(?:~>?)') + +createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true) +exports.tildeTrimReplace = '$1~' + +createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`) +createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`) + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +createToken('LONECARET', '(?:\\^)') + +createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true) +exports.caretTrimReplace = '$1^' + +createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`) +createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`) + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`) +createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`) + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT] +}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true) +exports.comparatorTrimReplace = '$1$2$3' + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAIN]})` + + `\\s*$`) + +createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAINLOOSE]})` + + `\\s*$`) + +// Star ranges basically just allow anything at all. +createToken('STAR', '(<|>)?=?\\s*\\*') +// >=0.0.0 is like a star +createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$') +createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$') diff --git a/project starter code/node_modules/semver/package.json b/project starter code/node_modules/semver/package.json new file mode 100644 index 00000000..cb8def45 --- /dev/null +++ b/project starter code/node_modules/semver/package.json @@ -0,0 +1,77 @@ +{ + "name": "semver", + "version": "7.6.2", + "description": "The semantic version parser used by npm.", + "main": "index.js", + "scripts": { + "test": "tap", + "snap": "tap", + "lint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"", + "postlint": "template-oss-check", + "lintfix": "npm run lint -- --fix", + "posttest": "npm run lint", + "template-oss-apply": "template-oss-apply --force" + }, + "devDependencies": { + "@npmcli/eslint-config": "^4.0.0", + "@npmcli/template-oss": "4.22.0", + "benchmark": "^2.1.4", + "tap": "^16.0.0" + }, + "license": "ISC", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/node-semver.git" + }, + "bin": { + "semver": "bin/semver.js" + }, + "files": [ + "bin/", + "lib/", + "classes/", + "functions/", + "internal/", + "ranges/", + "index.js", + "preload.js", + "range.bnf" + ], + "tap": { + "timeout": 30, + "coverage-map": "map.js", + "nyc-arg": [ + "--exclude", + "tap-snapshots/**" + ] + }, + "engines": { + "node": ">=10" + }, + "author": "GitHub Inc.", + "templateOSS": { + "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", + "version": "4.22.0", + "engines": ">=10", + "distPaths": [ + "classes/", + "functions/", + "internal/", + "ranges/", + "index.js", + "preload.js", + "range.bnf" + ], + "allowPaths": [ + "/classes/", + "/functions/", + "/internal/", + "/ranges/", + "/index.js", + "/preload.js", + "/range.bnf", + "/benchmarks" + ], + "publish": "true" + } +} diff --git a/project starter code/node_modules/semver/preload.js b/project starter code/node_modules/semver/preload.js new file mode 100644 index 00000000..947cd4f7 --- /dev/null +++ b/project starter code/node_modules/semver/preload.js @@ -0,0 +1,2 @@ +// XXX remove in v8 or beyond +module.exports = require('./index.js') diff --git a/project starter code/node_modules/semver/range.bnf b/project starter code/node_modules/semver/range.bnf new file mode 100644 index 00000000..d4c6ae0d --- /dev/null +++ b/project starter code/node_modules/semver/range.bnf @@ -0,0 +1,16 @@ +range-set ::= range ( logical-or range ) * +logical-or ::= ( ' ' ) * '||' ( ' ' ) * +range ::= hyphen | simple ( ' ' simple ) * | '' +hyphen ::= partial ' - ' partial +simple ::= primitive | partial | tilde | caret +primitive ::= ( '<' | '>' | '>=' | '<=' | '=' ) partial +partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )? +xr ::= 'x' | 'X' | '*' | nr +nr ::= '0' | [1-9] ( [0-9] ) * +tilde ::= '~' partial +caret ::= '^' partial +qualifier ::= ( '-' pre )? ( '+' build )? +pre ::= parts +build ::= parts +parts ::= part ( '.' part ) * +part ::= nr | [-0-9A-Za-z]+ diff --git a/project starter code/node_modules/semver/ranges/gtr.js b/project starter code/node_modules/semver/ranges/gtr.js new file mode 100644 index 00000000..db7e3559 --- /dev/null +++ b/project starter code/node_modules/semver/ranges/gtr.js @@ -0,0 +1,4 @@ +// Determine if version is greater than all the versions possible in the range. +const outside = require('./outside') +const gtr = (version, range, options) => outside(version, range, '>', options) +module.exports = gtr diff --git a/project starter code/node_modules/semver/ranges/intersects.js b/project starter code/node_modules/semver/ranges/intersects.js new file mode 100644 index 00000000..e0e9b7ce --- /dev/null +++ b/project starter code/node_modules/semver/ranges/intersects.js @@ -0,0 +1,7 @@ +const Range = require('../classes/range') +const intersects = (r1, r2, options) => { + r1 = new Range(r1, options) + r2 = new Range(r2, options) + return r1.intersects(r2, options) +} +module.exports = intersects diff --git a/project starter code/node_modules/semver/ranges/ltr.js b/project starter code/node_modules/semver/ranges/ltr.js new file mode 100644 index 00000000..528a885e --- /dev/null +++ b/project starter code/node_modules/semver/ranges/ltr.js @@ -0,0 +1,4 @@ +const outside = require('./outside') +// Determine if version is less than all the versions possible in the range +const ltr = (version, range, options) => outside(version, range, '<', options) +module.exports = ltr diff --git a/project starter code/node_modules/semver/ranges/max-satisfying.js b/project starter code/node_modules/semver/ranges/max-satisfying.js new file mode 100644 index 00000000..6e3d993c --- /dev/null +++ b/project starter code/node_modules/semver/ranges/max-satisfying.js @@ -0,0 +1,25 @@ +const SemVer = require('../classes/semver') +const Range = require('../classes/range') + +const maxSatisfying = (versions, range, options) => { + let max = null + let maxSV = null + let rangeObj = null + try { + rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v + maxSV = new SemVer(max, options) + } + } + }) + return max +} +module.exports = maxSatisfying diff --git a/project starter code/node_modules/semver/ranges/min-satisfying.js b/project starter code/node_modules/semver/ranges/min-satisfying.js new file mode 100644 index 00000000..9b60974e --- /dev/null +++ b/project starter code/node_modules/semver/ranges/min-satisfying.js @@ -0,0 +1,24 @@ +const SemVer = require('../classes/semver') +const Range = require('../classes/range') +const minSatisfying = (versions, range, options) => { + let min = null + let minSV = null + let rangeObj = null + try { + rangeObj = new Range(range, options) + } catch (er) { + return null + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v + minSV = new SemVer(min, options) + } + } + }) + return min +} +module.exports = minSatisfying diff --git a/project starter code/node_modules/semver/ranges/min-version.js b/project starter code/node_modules/semver/ranges/min-version.js new file mode 100644 index 00000000..350e1f78 --- /dev/null +++ b/project starter code/node_modules/semver/ranges/min-version.js @@ -0,0 +1,61 @@ +const SemVer = require('../classes/semver') +const Range = require('../classes/range') +const gt = require('../functions/gt') + +const minVersion = (range, loose) => { + range = new Range(range, loose) + + let minver = new SemVer('0.0.0') + if (range.test(minver)) { + return minver + } + + minver = new SemVer('0.0.0-0') + if (range.test(minver)) { + return minver + } + + minver = null + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i] + + let setMin = null + comparators.forEach((comparator) => { + // Clone to avoid manipulating the comparator's semver object. + const compver = new SemVer(comparator.semver.version) + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++ + } else { + compver.prerelease.push(0) + } + compver.raw = compver.format() + /* fallthrough */ + case '': + case '>=': + if (!setMin || gt(compver, setMin)) { + setMin = compver + } + break + case '<': + case '<=': + /* Ignore maximum versions */ + break + /* istanbul ignore next */ + default: + throw new Error(`Unexpected operation: ${comparator.operator}`) + } + }) + if (setMin && (!minver || gt(minver, setMin))) { + minver = setMin + } + } + + if (minver && range.test(minver)) { + return minver + } + + return null +} +module.exports = minVersion diff --git a/project starter code/node_modules/semver/ranges/outside.js b/project starter code/node_modules/semver/ranges/outside.js new file mode 100644 index 00000000..ae99b10a --- /dev/null +++ b/project starter code/node_modules/semver/ranges/outside.js @@ -0,0 +1,80 @@ +const SemVer = require('../classes/semver') +const Comparator = require('../classes/comparator') +const { ANY } = Comparator +const Range = require('../classes/range') +const satisfies = require('../functions/satisfies') +const gt = require('../functions/gt') +const lt = require('../functions/lt') +const lte = require('../functions/lte') +const gte = require('../functions/gte') + +const outside = (version, range, hilo, options) => { + version = new SemVer(version, options) + range = new Range(range, options) + + let gtfn, ltefn, ltfn, comp, ecomp + switch (hilo) { + case '>': + gtfn = gt + ltefn = lte + ltfn = lt + comp = '>' + ecomp = '>=' + break + case '<': + gtfn = lt + ltefn = gte + ltfn = gt + comp = '<' + ecomp = '<=' + break + default: + throw new TypeError('Must provide a hilo val of "<" or ">"') + } + + // If it satisfies the range it is not outside + if (satisfies(version, range, options)) { + return false + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i] + + let high = null + let low = null + + comparators.forEach((comparator) => { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') + } + high = high || comparator + low = low || comparator + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator + } + }) + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false + } + } + return true +} + +module.exports = outside diff --git a/project starter code/node_modules/semver/ranges/simplify.js b/project starter code/node_modules/semver/ranges/simplify.js new file mode 100644 index 00000000..618d5b62 --- /dev/null +++ b/project starter code/node_modules/semver/ranges/simplify.js @@ -0,0 +1,47 @@ +// given a set of versions and a range, create a "simplified" range +// that includes the same versions that the original range does +// If the original range is shorter than the simplified one, return that. +const satisfies = require('../functions/satisfies.js') +const compare = require('../functions/compare.js') +module.exports = (versions, range, options) => { + const set = [] + let first = null + let prev = null + const v = versions.sort((a, b) => compare(a, b, options)) + for (const version of v) { + const included = satisfies(version, range, options) + if (included) { + prev = version + if (!first) { + first = version + } + } else { + if (prev) { + set.push([first, prev]) + } + prev = null + first = null + } + } + if (first) { + set.push([first, null]) + } + + const ranges = [] + for (const [min, max] of set) { + if (min === max) { + ranges.push(min) + } else if (!max && min === v[0]) { + ranges.push('*') + } else if (!max) { + ranges.push(`>=${min}`) + } else if (min === v[0]) { + ranges.push(`<=${max}`) + } else { + ranges.push(`${min} - ${max}`) + } + } + const simplified = ranges.join(' || ') + const original = typeof range.raw === 'string' ? range.raw : String(range) + return simplified.length < original.length ? simplified : range +} diff --git a/project starter code/node_modules/semver/ranges/subset.js b/project starter code/node_modules/semver/ranges/subset.js new file mode 100644 index 00000000..1e5c2683 --- /dev/null +++ b/project starter code/node_modules/semver/ranges/subset.js @@ -0,0 +1,247 @@ +const Range = require('../classes/range.js') +const Comparator = require('../classes/comparator.js') +const { ANY } = Comparator +const satisfies = require('../functions/satisfies.js') +const compare = require('../functions/compare.js') + +// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff: +// - Every simple range `r1, r2, ...` is a null set, OR +// - Every simple range `r1, r2, ...` which is not a null set is a subset of +// some `R1, R2, ...` +// +// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff: +// - If c is only the ANY comparator +// - If C is only the ANY comparator, return true +// - Else if in prerelease mode, return false +// - else replace c with `[>=0.0.0]` +// - If C is only the ANY comparator +// - if in prerelease mode, return true +// - else replace C with `[>=0.0.0]` +// - Let EQ be the set of = comparators in c +// - If EQ is more than one, return true (null set) +// - Let GT be the highest > or >= comparator in c +// - Let LT be the lowest < or <= comparator in c +// - If GT and LT, and GT.semver > LT.semver, return true (null set) +// - If any C is a = range, and GT or LT are set, return false +// - If EQ +// - If GT, and EQ does not satisfy GT, return true (null set) +// - If LT, and EQ does not satisfy LT, return true (null set) +// - If EQ satisfies every C, return true +// - Else return false +// - If GT +// - If GT.semver is lower than any > or >= comp in C, return false +// - If GT is >=, and GT.semver does not satisfy every C, return false +// - If GT.semver has a prerelease, and not in prerelease mode +// - If no C has a prerelease and the GT.semver tuple, return false +// - If LT +// - If LT.semver is greater than any < or <= comp in C, return false +// - If LT is <=, and LT.semver does not satisfy every C, return false +// - If GT.semver has a prerelease, and not in prerelease mode +// - If no C has a prerelease and the LT.semver tuple, return false +// - Else return true + +const subset = (sub, dom, options = {}) => { + if (sub === dom) { + return true + } + + sub = new Range(sub, options) + dom = new Range(dom, options) + let sawNonNull = false + + OUTER: for (const simpleSub of sub.set) { + for (const simpleDom of dom.set) { + const isSub = simpleSubset(simpleSub, simpleDom, options) + sawNonNull = sawNonNull || isSub !== null + if (isSub) { + continue OUTER + } + } + // the null set is a subset of everything, but null simple ranges in + // a complex range should be ignored. so if we saw a non-null range, + // then we know this isn't a subset, but if EVERY simple range was null, + // then it is a subset. + if (sawNonNull) { + return false + } + } + return true +} + +const minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')] +const minimumVersion = [new Comparator('>=0.0.0')] + +const simpleSubset = (sub, dom, options) => { + if (sub === dom) { + return true + } + + if (sub.length === 1 && sub[0].semver === ANY) { + if (dom.length === 1 && dom[0].semver === ANY) { + return true + } else if (options.includePrerelease) { + sub = minimumVersionWithPreRelease + } else { + sub = minimumVersion + } + } + + if (dom.length === 1 && dom[0].semver === ANY) { + if (options.includePrerelease) { + return true + } else { + dom = minimumVersion + } + } + + const eqSet = new Set() + let gt, lt + for (const c of sub) { + if (c.operator === '>' || c.operator === '>=') { + gt = higherGT(gt, c, options) + } else if (c.operator === '<' || c.operator === '<=') { + lt = lowerLT(lt, c, options) + } else { + eqSet.add(c.semver) + } + } + + if (eqSet.size > 1) { + return null + } + + let gtltComp + if (gt && lt) { + gtltComp = compare(gt.semver, lt.semver, options) + if (gtltComp > 0) { + return null + } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) { + return null + } + } + + // will iterate one or zero times + for (const eq of eqSet) { + if (gt && !satisfies(eq, String(gt), options)) { + return null + } + + if (lt && !satisfies(eq, String(lt), options)) { + return null + } + + for (const c of dom) { + if (!satisfies(eq, String(c), options)) { + return false + } + } + + return true + } + + let higher, lower + let hasDomLT, hasDomGT + // if the subset has a prerelease, we need a comparator in the superset + // with the same tuple and a prerelease, or it's not a subset + let needDomLTPre = lt && + !options.includePrerelease && + lt.semver.prerelease.length ? lt.semver : false + let needDomGTPre = gt && + !options.includePrerelease && + gt.semver.prerelease.length ? gt.semver : false + // exception: <1.2.3-0 is the same as <1.2.3 + if (needDomLTPre && needDomLTPre.prerelease.length === 1 && + lt.operator === '<' && needDomLTPre.prerelease[0] === 0) { + needDomLTPre = false + } + + for (const c of dom) { + hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=' + hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=' + if (gt) { + if (needDomGTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && + c.semver.major === needDomGTPre.major && + c.semver.minor === needDomGTPre.minor && + c.semver.patch === needDomGTPre.patch) { + needDomGTPre = false + } + } + if (c.operator === '>' || c.operator === '>=') { + higher = higherGT(gt, c, options) + if (higher === c && higher !== gt) { + return false + } + } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) { + return false + } + } + if (lt) { + if (needDomLTPre) { + if (c.semver.prerelease && c.semver.prerelease.length && + c.semver.major === needDomLTPre.major && + c.semver.minor === needDomLTPre.minor && + c.semver.patch === needDomLTPre.patch) { + needDomLTPre = false + } + } + if (c.operator === '<' || c.operator === '<=') { + lower = lowerLT(lt, c, options) + if (lower === c && lower !== lt) { + return false + } + } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) { + return false + } + } + if (!c.operator && (lt || gt) && gtltComp !== 0) { + return false + } + } + + // if there was a < or >, and nothing in the dom, then must be false + // UNLESS it was limited by another range in the other direction. + // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0 + if (gt && hasDomLT && !lt && gtltComp !== 0) { + return false + } + + if (lt && hasDomGT && !gt && gtltComp !== 0) { + return false + } + + // we needed a prerelease range in a specific tuple, but didn't get one + // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0, + // because it includes prereleases in the 1.2.3 tuple + if (needDomGTPre || needDomLTPre) { + return false + } + + return true +} + +// >=1.2.3 is lower than >1.2.3 +const higherGT = (a, b, options) => { + if (!a) { + return b + } + const comp = compare(a.semver, b.semver, options) + return comp > 0 ? a + : comp < 0 ? b + : b.operator === '>' && a.operator === '>=' ? b + : a +} + +// <=1.2.3 is higher than <1.2.3 +const lowerLT = (a, b, options) => { + if (!a) { + return b + } + const comp = compare(a.semver, b.semver, options) + return comp < 0 ? a + : comp > 0 ? b + : b.operator === '<' && a.operator === '<=' ? b + : a +} + +module.exports = subset diff --git a/project starter code/node_modules/semver/ranges/to-comparators.js b/project starter code/node_modules/semver/ranges/to-comparators.js new file mode 100644 index 00000000..6c8bc7e6 --- /dev/null +++ b/project starter code/node_modules/semver/ranges/to-comparators.js @@ -0,0 +1,8 @@ +const Range = require('../classes/range') + +// Mostly just for testing and legacy API reasons +const toComparators = (range, options) => + new Range(range, options).set + .map(comp => comp.map(c => c.value).join(' ').trim().split(' ')) + +module.exports = toComparators diff --git a/project starter code/node_modules/semver/ranges/valid.js b/project starter code/node_modules/semver/ranges/valid.js new file mode 100644 index 00000000..365f3568 --- /dev/null +++ b/project starter code/node_modules/semver/ranges/valid.js @@ -0,0 +1,11 @@ +const Range = require('../classes/range') +const validRange = (range, options) => { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*' + } catch (er) { + return null + } +} +module.exports = validRange diff --git a/project starter code/node_modules/set-function-length/.eslintrc b/project starter code/node_modules/set-function-length/.eslintrc new file mode 100644 index 00000000..7cff5071 --- /dev/null +++ b/project starter code/node_modules/set-function-length/.eslintrc @@ -0,0 +1,27 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "id-length": "off", + "new-cap": ["error", { + "capIsNewExceptions": [ + "GetIntrinsic" + ], + }], + "no-extra-parens": "off", + }, + + "overrides": [ + { + "files": ["test/**/*.js"], + "rules": { + "id-length": "off", + "max-lines-per-function": "off", + "multiline-comment-style": "off", + "no-empty-function": "off", + }, + }, + ], +} diff --git a/project starter code/node_modules/set-function-length/.github/FUNDING.yml b/project starter code/node_modules/set-function-length/.github/FUNDING.yml new file mode 100644 index 00000000..92feb6f9 --- /dev/null +++ b/project starter code/node_modules/set-function-length/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/set-function-name +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with a single custom sponsorship URL diff --git a/project starter code/node_modules/set-function-length/.nycrc b/project starter code/node_modules/set-function-length/.nycrc new file mode 100644 index 00000000..1826526e --- /dev/null +++ b/project starter code/node_modules/set-function-length/.nycrc @@ -0,0 +1,13 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "lines": 86, + "statements": 85.93, + "functions": 82.43, + "branches": 76.06, + "exclude": [ + "coverage", + "test" + ] +} diff --git a/project starter code/node_modules/set-function-length/CHANGELOG.md b/project starter code/node_modules/set-function-length/CHANGELOG.md new file mode 100644 index 00000000..bac439d8 --- /dev/null +++ b/project starter code/node_modules/set-function-length/CHANGELOG.md @@ -0,0 +1,70 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.2.2](https://github.com/ljharb/set-function-length/compare/v1.2.1...v1.2.2) - 2024-03-09 + +### Commits + +- [types] use shared config [`027032f`](https://github.com/ljharb/set-function-length/commit/027032fe9cc439644a07248ea6a8d813fcc767cb) +- [actions] remove redundant finisher; use reusable workflow [`1fd4fb1`](https://github.com/ljharb/set-function-length/commit/1fd4fb1c58bd5170f0dcff7e320077c0aa2ffdeb) +- [types] use a handwritten d.ts file instead of emit [`01b9761`](https://github.com/ljharb/set-function-length/commit/01b9761742c95e1118e8c2d153ce2ae43d9731aa) +- [Deps] update `define-data-property`, `get-intrinsic`, `has-property-descriptors` [`bee8eaf`](https://github.com/ljharb/set-function-length/commit/bee8eaf7749f325357ade85cffeaeef679e513d4) +- [Dev Deps] update `call-bind`, `tape` [`5dae579`](https://github.com/ljharb/set-function-length/commit/5dae579fdc3aab91b14ebb58f9c19ee3f509d434) +- [Tests] use `@arethetypeswrong/cli` [`7e22425`](https://github.com/ljharb/set-function-length/commit/7e22425d15957fd3d6da0b6bca4afc0c8d255d2d) + +## [v1.2.1](https://github.com/ljharb/set-function-length/compare/v1.2.0...v1.2.1) - 2024-02-06 + +### Commits + +- [Dev Deps] update `call-bind`, `tape`, `typescript` [`d9a4601`](https://github.com/ljharb/set-function-length/commit/d9a460199c4c1fa37da9ebe055e2c884128f0738) +- [Deps] update `define-data-property`, `get-intrinsic` [`38d39ae`](https://github.com/ljharb/set-function-length/commit/38d39aed13a757ed36211d5b0437b88485090c6b) +- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`b4bfe5a`](https://github.com/ljharb/set-function-length/commit/b4bfe5ae0953b906d55b85f867eca5e7f673ebf4) + +## [v1.2.0](https://github.com/ljharb/set-function-length/compare/v1.1.1...v1.2.0) - 2024-01-14 + +### Commits + +- [New] add types [`f6d9088`](https://github.com/ljharb/set-function-length/commit/f6d9088b9283a3112b21c6776e8bef6d1f30558a) +- [Fix] ensure `env` properties are always booleans [`0c42f84`](https://github.com/ljharb/set-function-length/commit/0c42f84979086389b3229e1b4272697fd352275a) +- [Dev Deps] update `aud`, `call-bind`, `npmignore`, `tape` [`2b75f75`](https://github.com/ljharb/set-function-length/commit/2b75f75468093a4bb8ce8ca989b2edd2e80d95d1) +- [Deps] update `get-intrinsic`, `has-property-descriptors` [`19bf0fc`](https://github.com/ljharb/set-function-length/commit/19bf0fc4ffaa5ad425acbfa150516be9f3b6263a) +- [meta] add `sideEffects` flag [`8bb9b78`](https://github.com/ljharb/set-function-length/commit/8bb9b78c11c621123f725c9470222f43466c01d0) + +## [v1.1.1](https://github.com/ljharb/set-function-length/compare/v1.1.0...v1.1.1) - 2023-10-19 + +### Fixed + +- [Fix] move `define-data-property` to runtime deps [`#2`](https://github.com/ljharb/set-function-length/issues/2) + +### Commits + +- [Dev Deps] update `object-inspect`; add missing `call-bind` [`5aecf79`](https://github.com/ljharb/set-function-length/commit/5aecf79e7d6400957a5d9bd9ac20d4528908ca18) + +## [v1.1.0](https://github.com/ljharb/set-function-length/compare/v1.0.1...v1.1.0) - 2023-10-13 + +### Commits + +- [New] add `env` entry point [`475c87a`](https://github.com/ljharb/set-function-length/commit/475c87aa2f59b700aaed589d980624ec596acdcb) +- [Tests] add coverage with `nyc` [`14f0bf8`](https://github.com/ljharb/set-function-length/commit/14f0bf8c145ae60bf14a026420a06bb7be132c36) +- [eslint] fix linting failure [`fb516f9`](https://github.com/ljharb/set-function-length/commit/fb516f93c664057138c53559ef63c8622a093335) +- [Deps] update `define-data-property` [`d727e7c`](https://github.com/ljharb/set-function-length/commit/d727e7c6c9a40d7bf26797694e500ea68741feea) + +## [v1.0.1](https://github.com/ljharb/set-function-length/compare/v1.0.0...v1.0.1) - 2023-10-12 + +### Commits + +- [Refactor] use `get-intrinsic`, since it‘s in the dep graph anyways [`278a954`](https://github.com/ljharb/set-function-length/commit/278a954a06cd849051c569ff7aee56df6798933e) +- [meta] add `exports` [`72acfe5`](https://github.com/ljharb/set-function-length/commit/72acfe5a0310071fb205a72caba5ecbab24336a0) + +## v1.0.0 - 2023-10-12 + +### Commits + +- Initial implementation, tests, readme [`fce14e1`](https://github.com/ljharb/set-function-length/commit/fce14e17586460e4f294405173be72b6ffdf7e5f) +- Initial commit [`ca7ba85`](https://github.com/ljharb/set-function-length/commit/ca7ba857c7c283f9d26e21f14e71cd388f2cb722) +- npm init [`6a7e493`](https://github.com/ljharb/set-function-length/commit/6a7e493927736cebcaf5c1a84e69b8e6b7b744d8) +- Only apps should have lockfiles [`d2bf6c4`](https://github.com/ljharb/set-function-length/commit/d2bf6c43de8a51b02a0aa53e8d62cb50c4a2b0da) diff --git a/project starter code/node_modules/set-function-length/LICENSE b/project starter code/node_modules/set-function-length/LICENSE new file mode 100644 index 00000000..03149290 --- /dev/null +++ b/project starter code/node_modules/set-function-length/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Jordan Harband and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/project starter code/node_modules/set-function-length/README.md b/project starter code/node_modules/set-function-length/README.md new file mode 100644 index 00000000..15e3ac4b --- /dev/null +++ b/project starter code/node_modules/set-function-length/README.md @@ -0,0 +1,56 @@ +# set-function-length [![Version Badge][npm-version-svg]][package-url] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][npm-badge-png]][package-url] + +Set a function’s length. + +Arguments: + - `fn`: the function + - `length`: the new length. Must be an integer between 0 and 2**32. + - `loose`: Optional. If true, and the length fails to be set, do not throw. Default false. + +Returns `fn`. + +## Usage + +```javascript +var setFunctionLength = require('set-function-length'); +var assert = require('assert'); + +function zero() {} +function one(_) {} +function two(_, __) {} + +assert.equal(zero.length, 0); +assert.equal(one.length, 1); +assert.equal(two.length, 2); + +assert.equal(setFunctionLength(zero, 10), zero); +assert.equal(setFunctionLength(one, 11), one); +assert.equal(setFunctionLength(two, 12), two); + +assert.equal(zero.length, 10); +assert.equal(one.length, 11); +assert.equal(two.length, 12); +``` + +[package-url]: https://npmjs.org/package/set-function-length +[npm-version-svg]: https://versionbadg.es/ljharb/set-function-length.svg +[deps-svg]: https://david-dm.org/ljharb/set-function-length.svg +[deps-url]: https://david-dm.org/ljharb/set-function-length +[dev-deps-svg]: https://david-dm.org/ljharb/set-function-length/dev-status.svg +[dev-deps-url]: https://david-dm.org/ljharb/set-function-length#info=devDependencies +[npm-badge-png]: https://nodei.co/npm/set-function-length.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/set-function-length.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/set-function-length.svg +[downloads-url]: https://npm-stat.com/charts.html?package=set-function-length +[codecov-image]: https://codecov.io/gh/ljharb/set-function-length/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/ljharb/set-function-length/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/set-function-length +[actions-url]: https://github.com/ljharb/set-function-length/actions diff --git a/project starter code/node_modules/set-function-length/env.d.ts b/project starter code/node_modules/set-function-length/env.d.ts new file mode 100644 index 00000000..970ea535 --- /dev/null +++ b/project starter code/node_modules/set-function-length/env.d.ts @@ -0,0 +1,9 @@ +declare const env: { + __proto__: null, + boundFnsHaveConfigurableLengths: boolean; + boundFnsHaveWritableLengths: boolean; + functionsHaveConfigurableLengths: boolean; + functionsHaveWritableLengths: boolean; +}; + +export = env; \ No newline at end of file diff --git a/project starter code/node_modules/set-function-length/env.js b/project starter code/node_modules/set-function-length/env.js new file mode 100644 index 00000000..d9b0a299 --- /dev/null +++ b/project starter code/node_modules/set-function-length/env.js @@ -0,0 +1,25 @@ +'use strict'; + +var gOPD = require('gopd'); +var bind = require('function-bind'); + +var unbound = gOPD && gOPD(function () {}, 'length'); +// @ts-expect-error ts(2555) TS is overly strict with .call +var bound = gOPD && gOPD(bind.call(function () {}), 'length'); + +var functionsHaveConfigurableLengths = !!(unbound && unbound.configurable); + +var functionsHaveWritableLengths = !!(unbound && unbound.writable); + +var boundFnsHaveConfigurableLengths = !!(bound && bound.configurable); + +var boundFnsHaveWritableLengths = !!(bound && bound.writable); + +/** @type {import('./env')} */ +module.exports = { + __proto__: null, + boundFnsHaveConfigurableLengths: boundFnsHaveConfigurableLengths, + boundFnsHaveWritableLengths: boundFnsHaveWritableLengths, + functionsHaveConfigurableLengths: functionsHaveConfigurableLengths, + functionsHaveWritableLengths: functionsHaveWritableLengths +}; diff --git a/project starter code/node_modules/set-function-length/index.d.ts b/project starter code/node_modules/set-function-length/index.d.ts new file mode 100644 index 00000000..0451ecd3 --- /dev/null +++ b/project starter code/node_modules/set-function-length/index.d.ts @@ -0,0 +1,7 @@ +declare namespace setFunctionLength { + type Func = (...args: unknown[]) => unknown; +} + +declare function setFunctionLength(fn: T, length: number, loose?: boolean): T; + +export = setFunctionLength; \ No newline at end of file diff --git a/project starter code/node_modules/set-function-length/index.js b/project starter code/node_modules/set-function-length/index.js new file mode 100644 index 00000000..14ce74da --- /dev/null +++ b/project starter code/node_modules/set-function-length/index.js @@ -0,0 +1,42 @@ +'use strict'; + +var GetIntrinsic = require('get-intrinsic'); +var define = require('define-data-property'); +var hasDescriptors = require('has-property-descriptors')(); +var gOPD = require('gopd'); + +var $TypeError = require('es-errors/type'); +var $floor = GetIntrinsic('%Math.floor%'); + +/** @type {import('.')} */ +module.exports = function setFunctionLength(fn, length) { + if (typeof fn !== 'function') { + throw new $TypeError('`fn` is not a function'); + } + if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) { + throw new $TypeError('`length` must be a positive 32-bit integer'); + } + + var loose = arguments.length > 2 && !!arguments[2]; + + var functionLengthIsConfigurable = true; + var functionLengthIsWritable = true; + if ('length' in fn && gOPD) { + var desc = gOPD(fn, 'length'); + if (desc && !desc.configurable) { + functionLengthIsConfigurable = false; + } + if (desc && !desc.writable) { + functionLengthIsWritable = false; + } + } + + if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) { + if (hasDescriptors) { + define(/** @type {Parameters[0]} */ (fn), 'length', length, true, true); + } else { + define(/** @type {Parameters[0]} */ (fn), 'length', length); + } + } + return fn; +}; diff --git a/project starter code/node_modules/set-function-length/package.json b/project starter code/node_modules/set-function-length/package.json new file mode 100644 index 00000000..f6b88819 --- /dev/null +++ b/project starter code/node_modules/set-function-length/package.json @@ -0,0 +1,102 @@ +{ + "name": "set-function-length", + "version": "1.2.2", + "description": "Set a function's length property", + "main": "index.js", + "exports": { + ".": "./index.js", + "./env": "./env.js", + "./package.json": "./package.json" + }, + "sideEffects": false, + "directories": { + "test": "test" + }, + "scripts": { + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "tsc": "tsc -p .", + "posttsc": "attw -P", + "prelint": "evalmd README.md", + "lint": "eslint --ext=js,mjs .", + "postlint": "npm run tsc", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ljharb/set-function-length.git" + }, + "keywords": [ + "javascript", + "ecmascript", + "set", + "function", + "length", + "function.length" + ], + "author": "Jordan Harband ", + "license": "MIT", + "bugs": { + "url": "https://github.com/ljharb/set-function-length/issues" + }, + "homepage": "https://github.com/ljharb/set-function-length#readme", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "devDependencies": { + "@arethetypeswrong/cli": "^0.15.1", + "@ljharb/eslint-config": "^21.1.0", + "@ljharb/tsconfig": "^0.1.1", + "@types/call-bind": "^1.0.5", + "@types/define-properties": "^1.1.5", + "@types/es-value-fixtures": "^1.4.4", + "@types/for-each": "^0.3.3", + "@types/function-bind": "^1.1.10", + "@types/gopd": "^1.0.3", + "@types/has-property-descriptors": "^1.0.3", + "@types/object-inspect": "^1.8.4", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "call-bind": "^1.0.7", + "es-value-fixtures": "^1.4.2", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "for-each": "^0.3.3", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", + "nyc": "^10.3.2", + "object-inspect": "^1.13.1", + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.5", + "typescript": "next" + }, + "engines": { + "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows", + "test" + ] + } +} diff --git a/project starter code/node_modules/set-function-length/tsconfig.json b/project starter code/node_modules/set-function-length/tsconfig.json new file mode 100644 index 00000000..d9a6668c --- /dev/null +++ b/project starter code/node_modules/set-function-length/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@ljharb/tsconfig", + "compilerOptions": { + "target": "es2021", + }, + "exclude": [ + "coverage", + ], +} diff --git a/project starter code/node_modules/side-channel/.editorconfig b/project starter code/node_modules/side-channel/.editorconfig new file mode 100644 index 00000000..72e0ebaa --- /dev/null +++ b/project starter code/node_modules/side-channel/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = tab +indent_size = 2 +trim_trailing_whitespace = true diff --git a/project starter code/node_modules/side-channel/.eslintignore b/project starter code/node_modules/side-channel/.eslintignore deleted file mode 100644 index 404abb22..00000000 --- a/project starter code/node_modules/side-channel/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -coverage/ diff --git a/project starter code/node_modules/side-channel/.eslintrc b/project starter code/node_modules/side-channel/.eslintrc index 850ac1fa..93978e7d 100644 --- a/project starter code/node_modules/side-channel/.eslintrc +++ b/project starter code/node_modules/side-channel/.eslintrc @@ -5,7 +5,7 @@ "rules": { "max-lines-per-function": 0, - "max-params": 0, + "multiline-comment-style": 1, "new-cap": [2, { "capIsNewExceptions": ["GetIntrinsic"] }], }, } diff --git a/project starter code/node_modules/side-channel/CHANGELOG.md b/project starter code/node_modules/side-channel/CHANGELOG.md index a3d161fa..25369c5f 100644 --- a/project starter code/node_modules/side-channel/CHANGELOG.md +++ b/project starter code/node_modules/side-channel/CHANGELOG.md @@ -5,6 +5,36 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v1.0.6](https://github.com/ljharb/side-channel/compare/v1.0.5...v1.0.6) - 2024-02-29 + +### Commits + +- add types [`9beef66`](https://github.com/ljharb/side-channel/commit/9beef6643e6d717ea57bedabf86448123a7dd9e9) +- [meta] simplify `exports` [`4334cf9`](https://github.com/ljharb/side-channel/commit/4334cf9df654151504c383b62a2f9ebdc8d9d5ac) +- [Deps] update `call-bind` [`d6043c4`](https://github.com/ljharb/side-channel/commit/d6043c4d8f4d7be9037dd0f0419c7a2e0e39ec6a) +- [Dev Deps] update `tape` [`6aca376`](https://github.com/ljharb/side-channel/commit/6aca3761868dc8cd5ff7fd9799bf6b95e09a6eb0) + +## [v1.0.5](https://github.com/ljharb/side-channel/compare/v1.0.4...v1.0.5) - 2024-02-06 + +### Commits + +- [actions] reuse common workflows [`3d2e1ff`](https://github.com/ljharb/side-channel/commit/3d2e1ffd16dd6eaaf3e40ff57951f840d2d63c04) +- [meta] use `npmignore` to autogenerate an npmignore file [`04296ea`](https://github.com/ljharb/side-channel/commit/04296ea17d1544b0a5d20fd5bfb31aa4f6513eb9) +- [meta] add `.editorconfig`; add `eclint` [`130f0a6`](https://github.com/ljharb/side-channel/commit/130f0a6adbc04d385c7456a601d38344dce3d6a9) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `safe-publish-latest`, `tape` [`d480c2f`](https://github.com/ljharb/side-channel/commit/d480c2fbe757489ae9b4275491ffbcc3ac4725e9) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`ecbe70e`](https://github.com/ljharb/side-channel/commit/ecbe70e53a418234081a77971fec1fdfae20c841) +- [actions] update rebase action [`75240b9`](https://github.com/ljharb/side-channel/commit/75240b9963b816e8846400d2287cb68f88c7fba7) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `npmignore`, `tape` [`ae8d281`](https://github.com/ljharb/side-channel/commit/ae8d281572430099109870fd9430d2ca3f320b8d) +- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`7125b88`](https://github.com/ljharb/side-channel/commit/7125b885fd0eacad4fee9b073b72d14065ece278) +- [Deps] update `call-bind`, `get-intrinsic`, `object-inspect` [`82577c9`](https://github.com/ljharb/side-channel/commit/82577c9796304519139a570f82a317211b5f3b86) +- [Deps] update `call-bind`, `get-intrinsic`, `object-inspect` [`550aadf`](https://github.com/ljharb/side-channel/commit/550aadf20475a6081fd70304cc54f77259a5c8a8) +- [Tests] increase coverage [`5130877`](https://github.com/ljharb/side-channel/commit/5130877a7b27c862e64e6d1c12a178b28808859d) +- [Deps] update `get-intrinsic`, `object-inspect` [`ba0194c`](https://github.com/ljharb/side-channel/commit/ba0194c505b1a8a0427be14cadd5b8a46d4d01b8) +- [meta] add missing `engines.node` [`985fd24`](https://github.com/ljharb/side-channel/commit/985fd249663cb06617a693a94fe08cad12f5cb70) +- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`40227a8`](https://github.com/ljharb/side-channel/commit/40227a87b01709ad2c0eebf87eb4223a800099b9) +- [Deps] update `get-intrinsic` [`a989b40`](https://github.com/ljharb/side-channel/commit/a989b4024958737ae7be9fbffdeff2078f33a0fd) +- [Deps] update `object-inspect` [`aec42d2`](https://github.com/ljharb/side-channel/commit/aec42d2ec541a31aaa02475692c87d489237d9a3) + ## [v1.0.4](https://github.com/ljharb/side-channel/compare/v1.0.3...v1.0.4) - 2020-12-29 ### Commits diff --git a/project starter code/node_modules/side-channel/index.d.ts b/project starter code/node_modules/side-channel/index.d.ts new file mode 100644 index 00000000..7cb112b9 --- /dev/null +++ b/project starter code/node_modules/side-channel/index.d.ts @@ -0,0 +1,27 @@ +declare namespace getSideChannel { + type Key = unknown; + type ListNode = { + key: Key; + next: ListNode; + value: T; + }; + type RootNode = { + key: object; + next: null | ListNode; + }; + function listGetNode(list: RootNode, key: ListNode['key']): ListNode | void; + function listGet(objects: RootNode, key: ListNode['key']): T | void; + function listSet(objects: RootNode, key: ListNode['key'], value: T): void; + function listHas(objects: RootNode, key: ListNode['key']): boolean; + + type Channel = { + assert: (key: Key) => void; + has: (key: Key) => boolean; + get: (key: Key) => T; + set: (key: Key, value: T) => void; + } +} + +declare function getSideChannel(): getSideChannel.Channel; + +export = getSideChannel; diff --git a/project starter code/node_modules/side-channel/index.js b/project starter code/node_modules/side-channel/index.js index f1c48264..6b6926e1 100644 --- a/project starter code/node_modules/side-channel/index.js +++ b/project starter code/node_modules/side-channel/index.js @@ -4,7 +4,7 @@ var GetIntrinsic = require('get-intrinsic'); var callBound = require('call-bind/callBound'); var inspect = require('object-inspect'); -var $TypeError = GetIntrinsic('%TypeError%'); +var $TypeError = require('es-errors/type'); var $WeakMap = GetIntrinsic('%WeakMap%', true); var $Map = GetIntrinsic('%Map%', true); @@ -16,49 +16,58 @@ var $mapSet = callBound('Map.prototype.set', true); var $mapHas = callBound('Map.prototype.has', true); /* - * This function traverses the list returning the node corresponding to the - * given key. - * - * That node is also moved to the head of the list, so that if it's accessed - * again we don't need to traverse the whole list. By doing so, all the recently - * used nodes can be accessed relatively quickly. - */ +* This function traverses the list returning the node corresponding to the given key. +* +* That node is also moved to the head of the list, so that if it's accessed again we don't need to traverse the whole list. By doing so, all the recently used nodes can be accessed relatively quickly. +*/ +/** @type {import('.').listGetNode} */ var listGetNode = function (list, key) { // eslint-disable-line consistent-return - for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) { + /** @type {typeof list | NonNullable<(typeof list)['next']>} */ + var prev = list; + /** @type {(typeof list)['next']} */ + var curr; + for (; (curr = prev.next) !== null; prev = curr) { if (curr.key === key) { prev.next = curr.next; - curr.next = list.next; + // eslint-disable-next-line no-extra-parens + curr.next = /** @type {NonNullable} */ (list.next); list.next = curr; // eslint-disable-line no-param-reassign return curr; } } }; +/** @type {import('.').listGet} */ var listGet = function (objects, key) { var node = listGetNode(objects, key); return node && node.value; }; +/** @type {import('.').listSet} */ var listSet = function (objects, key, value) { var node = listGetNode(objects, key); if (node) { node.value = value; } else { // Prepend the new node to the beginning of the list - objects.next = { // eslint-disable-line no-param-reassign + objects.next = /** @type {import('.').ListNode} */ ({ // eslint-disable-line no-param-reassign, no-extra-parens key: key, next: objects.next, value: value - }; + }); } }; +/** @type {import('.').listHas} */ var listHas = function (objects, key) { return !!listGetNode(objects, key); }; +/** @type {import('.')} */ module.exports = function getSideChannel() { - var $wm; - var $m; - var $o; + /** @type {WeakMap} */ var $wm; + /** @type {Map} */ var $m; + /** @type {import('.').RootNode} */ var $o; + + /** @type {import('.').Channel} */ var channel = { assert: function (key) { if (!channel.has(key)) { @@ -109,11 +118,7 @@ module.exports = function getSideChannel() { $mapSet($m, key, value); } else { if (!$o) { - /* - * Initialize the linked list as an empty node, so that we don't have - * to special-case handling of the first node: we can always refer to - * it as (previous node).next, instead of something like (list).head - */ + // Initialize the linked list as an empty node, so that we don't have to special-case handling of the first node: we can always refer to it as (previous node).next, instead of something like (list).head $o = { key: {}, next: null }; } listSet($o, key, value); diff --git a/project starter code/node_modules/side-channel/package.json b/project starter code/node_modules/side-channel/package.json index a3e33f66..02cffca6 100644 --- a/project starter code/node_modules/side-channel/package.json +++ b/project starter code/node_modules/side-channel/package.json @@ -1,24 +1,24 @@ { "name": "side-channel", - "version": "1.0.4", + "version": "1.0.6", "description": "Store information about any JS value in a side channel. Uses WeakMap if available.", "main": "index.js", "exports": { "./package.json": "./package.json", - ".": [ - { - "default": "./index.js" - }, - "./index.js" - ] + ".": "./index.js" }, + "types": "./index.d.ts", "scripts": { - "prepublish": "safe-publish-latest", - "lint": "eslint .", + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublishOnly": "safe-publish-latest", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')", + "lint": "eslint --ext=js,mjs .", + "postlint": "tsc -p .", "pretest": "npm run lint", "tests-only": "nyc tape 'test/**/*.js'", "test": "npm run tests-only", - "posttest": "npx aud --production", + "posttest": "aud --production", "version": "auto-changelog && git add CHANGELOG.md", "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" }, @@ -43,18 +43,27 @@ }, "homepage": "https://github.com/ljharb/side-channel#readme", "devDependencies": { - "@ljharb/eslint-config": "^17.3.0", - "aud": "^1.1.3", - "auto-changelog": "^2.2.1", - "eslint": "^7.16.0", + "@ljharb/eslint-config": "^21.1.0", + "@types/call-bind": "^1.0.5", + "@types/get-intrinsic": "^1.2.2", + "@types/object-inspect": "^1.8.4", + "@types/tape": "^5.6.4", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eclint": "^2.8.1", + "eslint": "=8.8.0", + "in-publish": "^2.0.1", + "npmignore": "^0.3.1", "nyc": "^10.3.2", - "safe-publish-latest": "^1.1.4", - "tape": "^5.0.1" + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.5", + "typescript": "next" }, "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" }, "auto-changelog": { "output": "CHANGELOG.md", @@ -63,5 +72,13 @@ "commitLimit": false, "backfillLimit": false, "hideCredit": true + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] + }, + "engines": { + "node": ">= 0.4" } } diff --git a/project starter code/node_modules/side-channel/test/index.js b/project starter code/node_modules/side-channel/test/index.js index 3b92ef7e..8da32007 100644 --- a/project starter code/node_modules/side-channel/test/index.js +++ b/project starter code/node_modules/side-channel/test/index.js @@ -32,13 +32,18 @@ test('assert', function (t) { test('has', function (t) { var channel = getSideChannel(); - var o = []; + /** @type {unknown[]} */ var o = []; t.equal(channel.has(o), false, 'nonexistent value yields false'); channel.set(o, 'foo'); t.equal(channel.has(o), true, 'existent value yields true'); + t.equal(channel.has('abc'), false, 'non object value non existent yields false'); + + channel.set('abc', 'foo'); + t.equal(channel.has('abc'), true, 'non object value that exists yields true'); + t.end(); }); diff --git a/project starter code/node_modules/side-channel/tsconfig.json b/project starter code/node_modules/side-channel/tsconfig.json new file mode 100644 index 00000000..fdfa1550 --- /dev/null +++ b/project starter code/node_modules/side-channel/tsconfig.json @@ -0,0 +1,50 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Projects */ + + /* Language and Environment */ + "target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + // "rootDir": "./", /* Specify the root folder within your source files. */ + // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": ["types"], /* Specify multiple folders that act like `./node_modules/@types`. */ + "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */ + "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declarationMap": true, /* Create sourcemaps for d.ts files. */ + "noEmit": true, /* Disable emitting files from a compilation. */ + + /* Interop Constraints */ + "allowSyntheticDefaultImports": true, /* Allow `import x from y` when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + + /* Completeness */ + // "skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "exclude": [ + "coverage", + "test/list-exports" + ], +} diff --git a/project starter code/node_modules/simple-update-notifier/LICENSE b/project starter code/node_modules/simple-update-notifier/LICENSE new file mode 100644 index 00000000..1e0b0c11 --- /dev/null +++ b/project starter code/node_modules/simple-update-notifier/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Alex Brazier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/project starter code/node_modules/simple-update-notifier/README.md b/project starter code/node_modules/simple-update-notifier/README.md new file mode 100644 index 00000000..ec177944 --- /dev/null +++ b/project starter code/node_modules/simple-update-notifier/README.md @@ -0,0 +1,82 @@ +# simple-update-notifier [![GitHub stars](https://img.shields.io/github/stars/alexbrazier/simple-update-notifier?label=Star%20Project&style=social)](https://github.com/alexbrazier/simple-update-notifier/stargazers) + +[![CI](https://github.com/alexbrazier/simple-update-notifier/workflows/Build%20and%20Deploy/badge.svg)](https://github.com/alexbrazier/simple-update-notifier/actions) +[![Dependencies](https://img.shields.io/librariesio/release/npm/simple-update-notifier)](https://www.npmjs.com/package/simple-update-notifier?activeTab=dependencies) +[![npm](https://img.shields.io/npm/v/simple-update-notifier)](https://www.npmjs.com/package/simple-update-notifier) +[![npm bundle size](https://img.shields.io/bundlephobia/min/simple-update-notifier)](https://bundlephobia.com/result?p=simple-update-notifier) +[![npm downloads](https://img.shields.io/npm/dw/simple-update-notifier)](https://www.npmjs.com/package/simple-update-notifier) +[![License](https://img.shields.io/npm/l/simple-update-notifier)](./LICENSE) + +Simple update notifier to check for npm updates for cli applications. + +Demo in terminal showing an update is required + +Checks for updates for an npm module and outputs to the command line if there is one available. The result is cached for the specified time so it doesn't check every time the app runs. + +## Install + +```bash +npm install simple-update-notifier +OR +yarn add simple-update-notifier +``` + +## Usage + +```js +import updateNotifier from 'simple-update-notifier'; +import packageJson from './package.json' assert { type: 'json' }; + +updateNotifier({ pkg: packageJson }); +``` + +### Options + +#### pkg + +Type: `object` + +##### name + +_Required_\ +Type: `string` + +##### version + +_Required_\ +Type: `string` + +#### updateCheckInterval + +Type: `number`\ +Default: `1000 * 60 * 60 * 24` _(1 day)_ + +How often to check for updates. + +#### shouldNotifyInNpmScript + +Type: `boolean`\ +Default: `false` + +Allows notification to be shown when running as an npm script. + +#### distTag + +Type: `string`\ +Default: `'latest'` + +Which [dist-tag](https://docs.npmjs.com/adding-dist-tags-to-packages) to use to find the latest version. + +#### alwaysRun + +Type: `boolean`\ +Default: `false` + +When set, `updateCheckInterval` will not be respected and a check for an update will always be performed. + +#### debug + +Type: `boolean`\ +Default: `false` + +When set, logs explaining the decision will be output to `stderr` whenever the module opts to not print an update notification diff --git a/project starter code/node_modules/simple-update-notifier/build/index.d.ts b/project starter code/node_modules/simple-update-notifier/build/index.d.ts new file mode 100644 index 00000000..60f53e05 --- /dev/null +++ b/project starter code/node_modules/simple-update-notifier/build/index.d.ts @@ -0,0 +1,13 @@ +interface IUpdate { + pkg: { + name: string; + version: string; + }; + updateCheckInterval?: number; + shouldNotifyInNpmScript?: boolean; + distTag?: string; + alwaysRun?: boolean; + debug?: boolean; +} +declare const simpleUpdateNotifier: (args: IUpdate) => Promise; +export { simpleUpdateNotifier as default }; diff --git a/project starter code/node_modules/simple-update-notifier/build/index.js b/project starter code/node_modules/simple-update-notifier/build/index.js new file mode 100644 index 00000000..090f9df6 --- /dev/null +++ b/project starter code/node_modules/simple-update-notifier/build/index.js @@ -0,0 +1,210 @@ +'use strict'; + +var process$1 = require('process'); +var semver = require('semver'); +var os = require('os'); +var path = require('path'); +var fs = require('fs'); +var https = require('https'); + +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise */ + + +function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +} + +var packageJson = process$1.env.npm_package_json; +var userAgent = process$1.env.npm_config_user_agent; +var isNpm6 = Boolean(userAgent && userAgent.startsWith('npm')); +var isNpm7 = Boolean(packageJson && packageJson.endsWith('package.json')); +var isNpm = isNpm6 || isNpm7; +var isYarn = Boolean(userAgent && userAgent.startsWith('yarn')); +var isNpmOrYarn = isNpm || isYarn; + +var homeDirectory = os.homedir(); +var configDir = process.env.XDG_CONFIG_HOME || + path.join(homeDirectory, '.config', 'simple-update-notifier'); +var getConfigFile = function (packageName) { + return path.join(configDir, "".concat(packageName.replace('@', '').replace('/', '__'), ".json")); +}; +var createConfigDir = function () { + if (!fs.existsSync(configDir)) { + fs.mkdirSync(configDir, { recursive: true }); + } +}; +var getLastUpdate = function (packageName) { + var configFile = getConfigFile(packageName); + try { + if (!fs.existsSync(configFile)) { + return undefined; + } + var file = JSON.parse(fs.readFileSync(configFile, 'utf8')); + return file.lastUpdateCheck; + } + catch (_a) { + return undefined; + } +}; +var saveLastUpdate = function (packageName) { + var configFile = getConfigFile(packageName); + fs.writeFileSync(configFile, JSON.stringify({ lastUpdateCheck: new Date().getTime() })); +}; + +var getDistVersion = function (packageName, distTag) { return __awaiter(void 0, void 0, void 0, function () { + var url; + return __generator(this, function (_a) { + url = "https://registry.npmjs.org/-/package/".concat(packageName, "/dist-tags"); + return [2 /*return*/, new Promise(function (resolve, reject) { + https + .get(url, function (res) { + var body = ''; + res.on('data', function (chunk) { return (body += chunk); }); + res.on('end', function () { + try { + var json = JSON.parse(body); + var version = json[distTag]; + if (!version) { + reject(new Error('Error getting version')); + } + resolve(version); + } + catch (_a) { + reject(new Error('Could not parse version response')); + } + }); + }) + .on('error', function (err) { return reject(err); }); + })]; + }); +}); }; + +var hasNewVersion = function (_a) { + var pkg = _a.pkg, _b = _a.updateCheckInterval, updateCheckInterval = _b === void 0 ? 1000 * 60 * 60 * 24 : _b, _c = _a.distTag, distTag = _c === void 0 ? 'latest' : _c, alwaysRun = _a.alwaysRun, debug = _a.debug; + return __awaiter(void 0, void 0, void 0, function () { + var lastUpdateCheck, latestVersion; + return __generator(this, function (_d) { + switch (_d.label) { + case 0: + createConfigDir(); + lastUpdateCheck = getLastUpdate(pkg.name); + if (!(alwaysRun || + !lastUpdateCheck || + lastUpdateCheck < new Date().getTime() - updateCheckInterval)) return [3 /*break*/, 2]; + return [4 /*yield*/, getDistVersion(pkg.name, distTag)]; + case 1: + latestVersion = _d.sent(); + saveLastUpdate(pkg.name); + if (semver.gt(latestVersion, pkg.version)) { + return [2 /*return*/, latestVersion]; + } + else if (debug) { + console.error("Latest version (".concat(latestVersion, ") not newer than current version (").concat(pkg.version, ")")); + } + return [3 /*break*/, 3]; + case 2: + if (debug) { + console.error("Too recent to check for a new update. simpleUpdateNotifier() interval set to ".concat(updateCheckInterval, "ms but only ").concat(new Date().getTime() - lastUpdateCheck, "ms since last check.")); + } + _d.label = 3; + case 3: return [2 /*return*/, false]; + } + }); + }); +}; + +var borderedText = function (text) { + var lines = text.split('\n'); + var width = Math.max.apply(Math, lines.map(function (l) { return l.length; })); + var res = ["\u250C".concat('─'.repeat(width + 2), "\u2510")]; + for (var _i = 0, lines_1 = lines; _i < lines_1.length; _i++) { + var line = lines_1[_i]; + res.push("\u2502 ".concat(line.padEnd(width), " \u2502")); + } + res.push("\u2514".concat('─'.repeat(width + 2), "\u2518")); + return res.join('\n'); +}; + +var simpleUpdateNotifier = function (args) { return __awaiter(void 0, void 0, void 0, function () { + var latestVersion, err_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!args.alwaysRun && + (!process.stdout.isTTY || (isNpmOrYarn && !args.shouldNotifyInNpmScript))) { + if (args.debug) { + console.error('Opting out of running simpleUpdateNotifier()'); + } + return [2 /*return*/]; + } + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, hasNewVersion(args)]; + case 2: + latestVersion = _a.sent(); + if (latestVersion) { + console.error(borderedText("New version of ".concat(args.pkg.name, " available!\nCurrent Version: ").concat(args.pkg.version, "\nLatest Version: ").concat(latestVersion))); + } + return [3 /*break*/, 4]; + case 3: + err_1 = _a.sent(); + // Catch any network errors or cache writing errors so module doesn't cause a crash + if (args.debug && err_1 instanceof Error) { + console.error('Unexpected error in simpleUpdateNotifier():', err_1); + } + return [3 /*break*/, 4]; + case 4: return [2 /*return*/]; + } + }); +}); }; + +module.exports = simpleUpdateNotifier; diff --git a/project starter code/node_modules/simple-update-notifier/package.json b/project starter code/node_modules/simple-update-notifier/package.json new file mode 100644 index 00000000..4d710a72 --- /dev/null +++ b/project starter code/node_modules/simple-update-notifier/package.json @@ -0,0 +1,100 @@ +{ + "name": "simple-update-notifier", + "version": "2.0.0", + "description": "Simple update notifier to check for npm updates for cli applications", + "main": "build/index.js", + "types": "build/index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/alexbrazier/simple-update-notifier.git" + }, + "homepage": "https://github.com/alexbrazier/simple-update-notifier.git", + "author": "alexbrazier", + "license": "MIT", + "engines": { + "node": ">=10" + }, + "scripts": { + "test": "jest src --noStackTrace", + "build": "rollup -c rollup.config.js --bundleConfigAsCjs", + "prettier:check": "prettier --check src/**/*.ts", + "prettier": "prettier --write src/**/*.ts", + "eslint": "eslint src/**/*.ts", + "lint": "yarn prettier:check && yarn eslint", + "prepare": "yarn lint && yarn build", + "release": "release-it" + }, + "dependencies": { + "semver": "^7.5.3" + }, + "devDependencies": { + "@babel/preset-env": "^7.22.5", + "@babel/preset-typescript": "^7.22.5", + "@release-it/conventional-changelog": "^5.1.1", + "@types/jest": "^29.5.2", + "@types/node": "^20.3.1", + "@typescript-eslint/eslint-plugin": "^5.60.0", + "@typescript-eslint/parser": "^5.60.0", + "eslint": "^8.43.0", + "eslint-config-prettier": "^8.8.0", + "eslint-plugin-prettier": "^4.0.0", + "jest": "^29.5.0", + "prettier": "^2.8.8", + "release-it": "^15.11.0", + "rollup": "^3.25.2", + "rollup-plugin-ts": "^3.2.0", + "typescript": "^5.1.3" + }, + "resolutions": { + "semver": "^7.5.3" + }, + "publishConfig": { + "registry": "https://registry.npmjs.org/" + }, + "files": [ + "build", + "src" + ], + "release-it": { + "git": { + "commitMessage": "chore: release ${version}", + "tagName": "v${version}" + }, + "npm": { + "publish": true + }, + "github": { + "release": true + }, + "plugins": { + "@release-it/conventional-changelog": { + "preset": "angular", + "infile": "CHANGELOG.md" + } + } + }, + "eslintConfig": { + "plugins": [ + "@typescript-eslint", + "prettier" + ], + "extends": [ + "prettier", + "eslint:recommended", + "plugin:@typescript-eslint/recommended" + ], + "parser": "@typescript-eslint/parser", + "rules": { + "prettier/prettier": [ + "error", + { + "quoteProps": "consistent", + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "es5", + "useTabs": false + } + ] + } + } +} diff --git a/project starter code/node_modules/simple-update-notifier/src/borderedText.ts b/project starter code/node_modules/simple-update-notifier/src/borderedText.ts new file mode 100644 index 00000000..7145ac2f --- /dev/null +++ b/project starter code/node_modules/simple-update-notifier/src/borderedText.ts @@ -0,0 +1,12 @@ +const borderedText = (text: string) => { + const lines = text.split('\n'); + const width = Math.max(...lines.map((l) => l.length)); + const res = [`┌${'─'.repeat(width + 2)}┐`]; + for (const line of lines) { + res.push(`│ ${line.padEnd(width)} │`); + } + res.push(`└${'─'.repeat(width + 2)}┘`); + return res.join('\n'); +}; + +export default borderedText; diff --git a/project starter code/node_modules/simple-update-notifier/src/cache.spec.ts b/project starter code/node_modules/simple-update-notifier/src/cache.spec.ts new file mode 100644 index 00000000..49e1cb27 --- /dev/null +++ b/project starter code/node_modules/simple-update-notifier/src/cache.spec.ts @@ -0,0 +1,17 @@ +import { createConfigDir, getLastUpdate, saveLastUpdate } from './cache'; + +createConfigDir(); + +jest.useFakeTimers().setSystemTime(new Date('2022-01-01')); + +const fakeTime = new Date('2022-01-01').getTime(); + +test('can save update then get the update details', () => { + saveLastUpdate('test'); + expect(getLastUpdate('test')).toBe(fakeTime); +}); + +test('prefixed module can save update then get the update details', () => { + saveLastUpdate('@alexbrazier/test'); + expect(getLastUpdate('@alexbrazier/test')).toBe(fakeTime); +}); diff --git a/project starter code/node_modules/simple-update-notifier/src/cache.ts b/project starter code/node_modules/simple-update-notifier/src/cache.ts new file mode 100644 index 00000000..e11deba0 --- /dev/null +++ b/project starter code/node_modules/simple-update-notifier/src/cache.ts @@ -0,0 +1,44 @@ +import os from 'os'; +import path from 'path'; +import fs from 'fs'; + +const homeDirectory = os.homedir(); +const configDir = + process.env.XDG_CONFIG_HOME || + path.join(homeDirectory, '.config', 'simple-update-notifier'); + +const getConfigFile = (packageName: string) => { + return path.join( + configDir, + `${packageName.replace('@', '').replace('/', '__')}.json` + ); +}; + +export const createConfigDir = () => { + if (!fs.existsSync(configDir)) { + fs.mkdirSync(configDir, { recursive: true }); + } +}; + +export const getLastUpdate = (packageName: string) => { + const configFile = getConfigFile(packageName); + + try { + if (!fs.existsSync(configFile)) { + return undefined; + } + const file = JSON.parse(fs.readFileSync(configFile, 'utf8')); + return file.lastUpdateCheck as number; + } catch { + return undefined; + } +}; + +export const saveLastUpdate = (packageName: string) => { + const configFile = getConfigFile(packageName); + + fs.writeFileSync( + configFile, + JSON.stringify({ lastUpdateCheck: new Date().getTime() }) + ); +}; diff --git a/project starter code/node_modules/simple-update-notifier/src/getDistVersion.spec.ts b/project starter code/node_modules/simple-update-notifier/src/getDistVersion.spec.ts new file mode 100644 index 00000000..b78a42e5 --- /dev/null +++ b/project starter code/node_modules/simple-update-notifier/src/getDistVersion.spec.ts @@ -0,0 +1,35 @@ +import Stream from 'stream'; +import https from 'https'; +import getDistVersion from './getDistVersion'; + +jest.mock('https', () => ({ + get: jest.fn(), +})); + +test('Valid response returns version', async () => { + const st = new Stream(); + (https.get as jest.Mock).mockImplementation((url, cb) => { + cb(st); + + st.emit('data', '{"latest":"1.0.0"}'); + st.emit('end'); + }); + + const version = await getDistVersion('test', 'latest'); + + expect(version).toEqual('1.0.0'); +}); + +test('Invalid response throws error', async () => { + const st = new Stream(); + (https.get as jest.Mock).mockImplementation((url, cb) => { + cb(st); + + st.emit('data', 'some invalid json'); + st.emit('end'); + }); + + expect(getDistVersion('test', 'latest')).rejects.toThrow( + 'Could not parse version response' + ); +}); diff --git a/project starter code/node_modules/simple-update-notifier/src/getDistVersion.ts b/project starter code/node_modules/simple-update-notifier/src/getDistVersion.ts new file mode 100644 index 00000000..d474e1f9 --- /dev/null +++ b/project starter code/node_modules/simple-update-notifier/src/getDistVersion.ts @@ -0,0 +1,29 @@ +import https from 'https'; + +const getDistVersion = async (packageName: string, distTag: string) => { + const url = `https://registry.npmjs.org/-/package/${packageName}/dist-tags`; + + return new Promise((resolve, reject) => { + https + .get(url, (res) => { + let body = ''; + + res.on('data', (chunk) => (body += chunk)); + res.on('end', () => { + try { + const json = JSON.parse(body); + const version = json[distTag]; + if (!version) { + reject(new Error('Error getting version')); + } + resolve(version); + } catch { + reject(new Error('Could not parse version response')); + } + }); + }) + .on('error', (err) => reject(err)); + }); +}; + +export default getDistVersion; diff --git a/project starter code/node_modules/simple-update-notifier/src/hasNewVersion.spec.ts b/project starter code/node_modules/simple-update-notifier/src/hasNewVersion.spec.ts new file mode 100644 index 00000000..af7ab22c --- /dev/null +++ b/project starter code/node_modules/simple-update-notifier/src/hasNewVersion.spec.ts @@ -0,0 +1,82 @@ +import hasNewVersion from './hasNewVersion'; +import { getLastUpdate } from './cache'; +import getDistVersion from './getDistVersion'; + +jest.mock('./getDistVersion', () => jest.fn().mockReturnValue('1.0.0')); +jest.mock('./cache', () => ({ + getLastUpdate: jest.fn().mockReturnValue(undefined), + createConfigDir: jest.fn(), + saveLastUpdate: jest.fn(), +})); + +const pkg = { name: 'test', version: '1.0.0' }; + +afterEach(() => jest.clearAllMocks()); + +const defaultArgs = { + pkg, + shouldNotifyInNpmScript: true, + alwaysRun: true, +}; + +test('it should not trigger update for same version', async () => { + const newVersion = await hasNewVersion(defaultArgs); + + expect(newVersion).toBe(false); +}); + +test('it should trigger update for patch version bump', async () => { + (getDistVersion as jest.Mock).mockReturnValue('1.0.1'); + + const newVersion = await hasNewVersion(defaultArgs); + + expect(newVersion).toBe('1.0.1'); +}); + +test('it should trigger update for minor version bump', async () => { + (getDistVersion as jest.Mock).mockReturnValue('1.1.0'); + + const newVersion = await hasNewVersion(defaultArgs); + + expect(newVersion).toBe('1.1.0'); +}); + +test('it should trigger update for major version bump', async () => { + (getDistVersion as jest.Mock).mockReturnValue('2.0.0'); + + const newVersion = await hasNewVersion(defaultArgs); + + expect(newVersion).toBe('2.0.0'); +}); + +test('it should not trigger update if version is lower', async () => { + (getDistVersion as jest.Mock).mockReturnValue('0.0.9'); + + const newVersion = await hasNewVersion(defaultArgs); + + expect(newVersion).toBe(false); +}); + +it('should trigger update check if last update older than config', async () => { + const TWO_WEEKS = new Date().getTime() - 1000 * 60 * 60 * 24 * 14; + (getLastUpdate as jest.Mock).mockReturnValue(TWO_WEEKS); + const newVersion = await hasNewVersion({ + pkg, + shouldNotifyInNpmScript: true, + }); + + expect(newVersion).toBe(false); + expect(getDistVersion).toHaveBeenCalled(); +}); + +it('should not trigger update check if last update is too recent', async () => { + const TWELVE_HOURS = new Date().getTime() - 1000 * 60 * 60 * 12; + (getLastUpdate as jest.Mock).mockReturnValue(TWELVE_HOURS); + const newVersion = await hasNewVersion({ + pkg, + shouldNotifyInNpmScript: true, + }); + + expect(newVersion).toBe(false); + expect(getDistVersion).not.toHaveBeenCalled(); +}); diff --git a/project starter code/node_modules/simple-update-notifier/src/hasNewVersion.ts b/project starter code/node_modules/simple-update-notifier/src/hasNewVersion.ts new file mode 100644 index 00000000..31d5069f --- /dev/null +++ b/project starter code/node_modules/simple-update-notifier/src/hasNewVersion.ts @@ -0,0 +1,40 @@ +import semver from 'semver'; +import { createConfigDir, getLastUpdate, saveLastUpdate } from './cache'; +import getDistVersion from './getDistVersion'; +import { IUpdate } from './types'; + +const hasNewVersion = async ({ + pkg, + updateCheckInterval = 1000 * 60 * 60 * 24, + distTag = 'latest', + alwaysRun, + debug, +}: IUpdate) => { + createConfigDir(); + const lastUpdateCheck = getLastUpdate(pkg.name); + if ( + alwaysRun || + !lastUpdateCheck || + lastUpdateCheck < new Date().getTime() - updateCheckInterval + ) { + const latestVersion = await getDistVersion(pkg.name, distTag); + saveLastUpdate(pkg.name); + if (semver.gt(latestVersion, pkg.version)) { + return latestVersion; + } else if (debug) { + console.error( + `Latest version (${latestVersion}) not newer than current version (${pkg.version})` + ); + } + } else if (debug) { + console.error( + `Too recent to check for a new update. simpleUpdateNotifier() interval set to ${updateCheckInterval}ms but only ${ + new Date().getTime() - lastUpdateCheck + }ms since last check.` + ); + } + + return false; +}; + +export default hasNewVersion; diff --git a/project starter code/node_modules/simple-update-notifier/src/index.spec.ts b/project starter code/node_modules/simple-update-notifier/src/index.spec.ts new file mode 100644 index 00000000..98ffb5a9 --- /dev/null +++ b/project starter code/node_modules/simple-update-notifier/src/index.spec.ts @@ -0,0 +1,27 @@ +import simpleUpdateNotifier from '.'; +import hasNewVersion from './hasNewVersion'; + +const consoleSpy = jest.spyOn(console, 'error'); + +jest.mock('./hasNewVersion', () => jest.fn().mockResolvedValue('2.0.0')); + +beforeEach(jest.clearAllMocks); + +test('it logs message if update is available', async () => { + await simpleUpdateNotifier({ + pkg: { name: 'test', version: '1.0.0' }, + alwaysRun: true, + }); + + expect(consoleSpy).toHaveBeenCalledTimes(1); +}); + +test('it does not log message if update is not available', async () => { + (hasNewVersion as jest.Mock).mockResolvedValue(false); + await simpleUpdateNotifier({ + pkg: { name: 'test', version: '2.0.0' }, + alwaysRun: true, + }); + + expect(consoleSpy).toHaveBeenCalledTimes(0); +}); diff --git a/project starter code/node_modules/simple-update-notifier/src/index.ts b/project starter code/node_modules/simple-update-notifier/src/index.ts new file mode 100644 index 00000000..2b0d2cfc --- /dev/null +++ b/project starter code/node_modules/simple-update-notifier/src/index.ts @@ -0,0 +1,34 @@ +import isNpmOrYarn from './isNpmOrYarn'; +import hasNewVersion from './hasNewVersion'; +import { IUpdate } from './types'; +import borderedText from './borderedText'; + +const simpleUpdateNotifier = async (args: IUpdate) => { + if ( + !args.alwaysRun && + (!process.stdout.isTTY || (isNpmOrYarn && !args.shouldNotifyInNpmScript)) + ) { + if (args.debug) { + console.error('Opting out of running simpleUpdateNotifier()'); + } + return; + } + + try { + const latestVersion = await hasNewVersion(args); + if (latestVersion) { + console.error( + borderedText(`New version of ${args.pkg.name} available! +Current Version: ${args.pkg.version} +Latest Version: ${latestVersion}`) + ); + } + } catch (err) { + // Catch any network errors or cache writing errors so module doesn't cause a crash + if (args.debug && err instanceof Error) { + console.error('Unexpected error in simpleUpdateNotifier():', err); + } + } +}; + +export default simpleUpdateNotifier; diff --git a/project starter code/node_modules/simple-update-notifier/src/isNpmOrYarn.ts b/project starter code/node_modules/simple-update-notifier/src/isNpmOrYarn.ts new file mode 100644 index 00000000..ee4c8371 --- /dev/null +++ b/project starter code/node_modules/simple-update-notifier/src/isNpmOrYarn.ts @@ -0,0 +1,12 @@ +import process from 'process'; + +const packageJson = process.env.npm_package_json; +const userAgent = process.env.npm_config_user_agent; +const isNpm6 = Boolean(userAgent && userAgent.startsWith('npm')); +const isNpm7 = Boolean(packageJson && packageJson.endsWith('package.json')); + +const isNpm = isNpm6 || isNpm7; +const isYarn = Boolean(userAgent && userAgent.startsWith('yarn')); +const isNpmOrYarn = isNpm || isYarn; + +export default isNpmOrYarn; diff --git a/project starter code/node_modules/simple-update-notifier/src/types.ts b/project starter code/node_modules/simple-update-notifier/src/types.ts new file mode 100644 index 00000000..c395eb00 --- /dev/null +++ b/project starter code/node_modules/simple-update-notifier/src/types.ts @@ -0,0 +1,8 @@ +export interface IUpdate { + pkg: { name: string; version: string }; + updateCheckInterval?: number; + shouldNotifyInNpmScript?: boolean; + distTag?: string; + alwaysRun?: boolean; + debug?: boolean; +} diff --git a/project starter code/node_modules/string_decoder/LICENSE b/project starter code/node_modules/string_decoder/LICENSE new file mode 100644 index 00000000..778edb20 --- /dev/null +++ b/project starter code/node_modules/string_decoder/LICENSE @@ -0,0 +1,48 @@ +Node.js is licensed for use as follows: + +""" +Copyright Node.js contributors. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. +""" + +This license applies to parts of Node.js originating from the +https://github.com/joyent/node repository: + +""" +Copyright Joyent, Inc. and other Node contributors. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. +""" + diff --git a/project starter code/node_modules/string_decoder/README.md b/project starter code/node_modules/string_decoder/README.md new file mode 100644 index 00000000..5fd58315 --- /dev/null +++ b/project starter code/node_modules/string_decoder/README.md @@ -0,0 +1,47 @@ +# string_decoder + +***Node-core v8.9.4 string_decoder for userland*** + + +[![NPM](https://nodei.co/npm/string_decoder.png?downloads=true&downloadRank=true)](https://nodei.co/npm/string_decoder/) +[![NPM](https://nodei.co/npm-dl/string_decoder.png?&months=6&height=3)](https://nodei.co/npm/string_decoder/) + + +```bash +npm install --save string_decoder +``` + +***Node-core string_decoder for userland*** + +This package is a mirror of the string_decoder implementation in Node-core. + +Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.9.4/docs/api/). + +As of version 1.0.0 **string_decoder** uses semantic versioning. + +## Previous versions + +Previous version numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10. + +## Update + +The *build/* directory contains a build script that will scrape the source from the [nodejs/node](https://github.com/nodejs/node) repo given a specific Node version. + +## Streams Working Group + +`string_decoder` is maintained by the Streams Working Group, which +oversees the development and maintenance of the Streams API within +Node.js. The responsibilities of the Streams Working Group include: + +* Addressing stream issues on the Node.js issue tracker. +* Authoring and editing stream documentation within the Node.js project. +* Reviewing changes to stream subclasses within the Node.js project. +* Redirecting changes to streams from the Node.js project to this + project. +* Assisting in the implementation of stream providers within Node.js. +* Recommending versions of `readable-stream` to be included in Node.js. +* Messaging about the future of streams to give the community advance + notice of changes. + +See [readable-stream](https://github.com/nodejs/readable-stream) for +more details. diff --git a/project starter code/node_modules/string_decoder/lib/string_decoder.js b/project starter code/node_modules/string_decoder/lib/string_decoder.js new file mode 100644 index 00000000..2e89e63f --- /dev/null +++ b/project starter code/node_modules/string_decoder/lib/string_decoder.js @@ -0,0 +1,296 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +/**/ + +var Buffer = require('safe-buffer').Buffer; +/**/ + +var isEncoding = Buffer.isEncoding || function (encoding) { + encoding = '' + encoding; + switch (encoding && encoding.toLowerCase()) { + case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': + return true; + default: + return false; + } +}; + +function _normalizeEncoding(enc) { + if (!enc) return 'utf8'; + var retried; + while (true) { + switch (enc) { + case 'utf8': + case 'utf-8': + return 'utf8'; + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return 'utf16le'; + case 'latin1': + case 'binary': + return 'latin1'; + case 'base64': + case 'ascii': + case 'hex': + return enc; + default: + if (retried) return; // undefined + enc = ('' + enc).toLowerCase(); + retried = true; + } + } +}; + +// Do not cache `Buffer.isEncoding` when checking encoding names as some +// modules monkey-patch it to support additional encodings +function normalizeEncoding(enc) { + var nenc = _normalizeEncoding(enc); + if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); + return nenc || enc; +} + +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. +exports.StringDecoder = StringDecoder; +function StringDecoder(encoding) { + this.encoding = normalizeEncoding(encoding); + var nb; + switch (this.encoding) { + case 'utf16le': + this.text = utf16Text; + this.end = utf16End; + nb = 4; + break; + case 'utf8': + this.fillLast = utf8FillLast; + nb = 4; + break; + case 'base64': + this.text = base64Text; + this.end = base64End; + nb = 3; + break; + default: + this.write = simpleWrite; + this.end = simpleEnd; + return; + } + this.lastNeed = 0; + this.lastTotal = 0; + this.lastChar = Buffer.allocUnsafe(nb); +} + +StringDecoder.prototype.write = function (buf) { + if (buf.length === 0) return ''; + var r; + var i; + if (this.lastNeed) { + r = this.fillLast(buf); + if (r === undefined) return ''; + i = this.lastNeed; + this.lastNeed = 0; + } else { + i = 0; + } + if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); + return r || ''; +}; + +StringDecoder.prototype.end = utf8End; + +// Returns only complete characters in a Buffer +StringDecoder.prototype.text = utf8Text; + +// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer +StringDecoder.prototype.fillLast = function (buf) { + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); + this.lastNeed -= buf.length; +}; + +// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a +// continuation byte. If an invalid byte is detected, -2 is returned. +function utf8CheckByte(byte) { + if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; + return byte >> 6 === 0x02 ? -1 : -2; +} + +// Checks at most 3 bytes at the end of a Buffer in order to detect an +// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) +// needed to complete the UTF-8 character (if applicable) are returned. +function utf8CheckIncomplete(self, buf, i) { + var j = buf.length - 1; + if (j < i) return 0; + var nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 1; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 2; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) { + if (nb === 2) nb = 0;else self.lastNeed = nb - 3; + } + return nb; + } + return 0; +} + +// Validates as many continuation bytes for a multi-byte UTF-8 character as +// needed or are available. If we see a non-continuation byte where we expect +// one, we "replace" the validated continuation bytes we've seen so far with +// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding +// behavior. The continuation byte check is included three times in the case +// where all of the continuation bytes for a character exist in the same buffer. +// It is also done this way as a slight performance increase instead of using a +// loop. +function utf8CheckExtraBytes(self, buf, p) { + if ((buf[0] & 0xC0) !== 0x80) { + self.lastNeed = 0; + return '\ufffd'; + } + if (self.lastNeed > 1 && buf.length > 1) { + if ((buf[1] & 0xC0) !== 0x80) { + self.lastNeed = 1; + return '\ufffd'; + } + if (self.lastNeed > 2 && buf.length > 2) { + if ((buf[2] & 0xC0) !== 0x80) { + self.lastNeed = 2; + return '\ufffd'; + } + } + } +} + +// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. +function utf8FillLast(buf) { + var p = this.lastTotal - this.lastNeed; + var r = utf8CheckExtraBytes(this, buf, p); + if (r !== undefined) return r; + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, p, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, p, 0, buf.length); + this.lastNeed -= buf.length; +} + +// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a +// partial character, the character's bytes are buffered until the required +// number of bytes are available. +function utf8Text(buf, i) { + var total = utf8CheckIncomplete(this, buf, i); + if (!this.lastNeed) return buf.toString('utf8', i); + this.lastTotal = total; + var end = buf.length - (total - this.lastNeed); + buf.copy(this.lastChar, 0, end); + return buf.toString('utf8', i, end); +} + +// For UTF-8, a replacement character is added when ending on a partial +// character. +function utf8End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + '\ufffd'; + return r; +} + +// UTF-16LE typically needs two bytes per character, but even if we have an even +// number of bytes available, we need to check if we end on a leading/high +// surrogate. In that case, we need to wait for the next two bytes in order to +// decode the last character properly. +function utf16Text(buf, i) { + if ((buf.length - i) % 2 === 0) { + var r = buf.toString('utf16le', i); + if (r) { + var c = r.charCodeAt(r.length - 1); + if (c >= 0xD800 && c <= 0xDBFF) { + this.lastNeed = 2; + this.lastTotal = 4; + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + return r.slice(0, -1); + } + } + return r; + } + this.lastNeed = 1; + this.lastTotal = 2; + this.lastChar[0] = buf[buf.length - 1]; + return buf.toString('utf16le', i, buf.length - 1); +} + +// For UTF-16LE we do not explicitly append special replacement characters if we +// end on a partial character, we simply let v8 handle that. +function utf16End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) { + var end = this.lastTotal - this.lastNeed; + return r + this.lastChar.toString('utf16le', 0, end); + } + return r; +} + +function base64Text(buf, i) { + var n = (buf.length - i) % 3; + if (n === 0) return buf.toString('base64', i); + this.lastNeed = 3 - n; + this.lastTotal = 3; + if (n === 1) { + this.lastChar[0] = buf[buf.length - 1]; + } else { + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + } + return buf.toString('base64', i, buf.length - n); +} + +function base64End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); + return r; +} + +// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) +function simpleWrite(buf) { + return buf.toString(this.encoding); +} + +function simpleEnd(buf) { + return buf && buf.length ? this.write(buf) : ''; +} \ No newline at end of file diff --git a/project starter code/node_modules/string_decoder/package.json b/project starter code/node_modules/string_decoder/package.json new file mode 100644 index 00000000..b2bb1411 --- /dev/null +++ b/project starter code/node_modules/string_decoder/package.json @@ -0,0 +1,34 @@ +{ + "name": "string_decoder", + "version": "1.3.0", + "description": "The string_decoder module from Node core", + "main": "lib/string_decoder.js", + "files": [ + "lib" + ], + "dependencies": { + "safe-buffer": "~5.2.0" + }, + "devDependencies": { + "babel-polyfill": "^6.23.0", + "core-util-is": "^1.0.2", + "inherits": "^2.0.3", + "tap": "~0.4.8" + }, + "scripts": { + "test": "tap test/parallel/*.js && node test/verify-dependencies", + "ci": "tap test/parallel/*.js test/ours/*.js --tap | tee test.tap && node test/verify-dependencies.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/nodejs/string_decoder.git" + }, + "homepage": "https://github.com/nodejs/string_decoder", + "keywords": [ + "string", + "decoder", + "browser", + "browserify" + ], + "license": "MIT" +} diff --git a/project starter code/node_modules/strtok3/LICENSE b/project starter code/node_modules/strtok3/LICENSE new file mode 100644 index 00000000..c85ef2c1 --- /dev/null +++ b/project starter code/node_modules/strtok3/LICENSE @@ -0,0 +1,15 @@ +Copyright (c) 2017, Borewit +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/project starter code/node_modules/strtok3/README.md b/project starter code/node_modules/strtok3/README.md new file mode 100644 index 00000000..f45a723a --- /dev/null +++ b/project starter code/node_modules/strtok3/README.md @@ -0,0 +1,304 @@ +![Node.js CI](https://github.com/Borewit/strtok3/workflows/Node.js%20CI/badge.svg) +[![NPM version](https://badge.fury.io/js/strtok3.svg)](https://npmjs.org/package/strtok3) +[![npm downloads](http://img.shields.io/npm/dm/strtok3.svg)](https://npmcharts.com/compare/strtok3,token-types?start=1200&interval=30) +[![DeepScan grade](https://deepscan.io/api/teams/5165/projects/8526/branches/103329/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=5165&pid=8526&bid=103329) +[![Known Vulnerabilities](https://snyk.io/test/github/Borewit/strtok3/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Borewit/strtok3?targetFile=package.json) +[![Total alerts](https://img.shields.io/lgtm/alerts/g/Borewit/strtok3.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Borewit/strtok3/alerts/) +[![Codacy Badge](https://api.codacy.com/project/badge/Grade/59dd6795e61949fb97066ca52e6097ef)](https://www.codacy.com/app/Borewit/strtok3?utm_source=github.com&utm_medium=referral&utm_content=Borewit/strtok3&utm_campaign=Badge_Grade) +[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/Borewit/strtok3.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Borewit/strtok3/context:javascript) +# strtok3 + +A promise based streaming [*tokenizer*](#tokenizer) for [Node.js](http://nodejs.org) and browsers. +This node module is a successor of [strtok2](https://github.com/Borewit/strtok2). + +The `strtok3` contains a few methods to turn different input into a [*tokenizer*](#tokenizer). Designed to +* Support a streaming environment +* Decoding of binary data, strings and numbers in mind +* Read [predefined](https://github.com/Borewit/token-types) or custom tokens. +* Optimized [*tokenizers*](#tokenizer) for reading from [file](#method-strtok3fromfile), [stream](#method-strtok3fromstream) or [buffer](#method-strtok3frombuffer). + +It can read from: +* A file (taking a file path as an input) +* A Node.js [stream](https://nodejs.org/api/stream.html). +* A [Buffer](https://nodejs.org/api/buffer.html) or [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) +* HTTP chunked transfer provided by [@tokenizer/http](https://github.com/Borewit/tokenizer-http). +* Chunked [Amazon S3](https://aws.amazon.com/s3) access provided by [@tokenizer/s3](https://github.com/Borewit/tokenizer-s3). + +## Installation + +```sh +npm install strtok3 +``` + +### Compatibility + +NPM module is compliant with [ECMAScript 2018 (ES9)](https://en.wikipedia.org/wiki/ECMAScript#9th_Edition_%E2%80%93_ECMAScript_2018). + +## API + +Use one of the methods to instantiate an [*abstract tokenizer*](#tokenizer): +* [strtok3.fromFile](#method-strtok3fromfile) +* [strtok3.fromStream](#method-strtok3fromstream) +* [strtok3.fromBuffer](#method-strtok3fromBuffer) +* [strtok3.fromUint8Array](#method-strtok3fromUint8Array) + +### strtok3 methods + +All of the strtok3 methods return a [*tokenizer*](#tokenizer), either directly or via a promise. + +#### Method `strtok3.fromFile()` + +| Parameter | Type | Description | +|-----------|-----------------------|----------------------------| +| path | Path to file (string) | Path to file to read from | + +> __Note__: that [file-information](#file-information) is automatically added. + +Returns, via a promise, a [*tokenizer*](#tokenizer) which can be used to parse a file. + +```js +const strtok3 = require('strtok3'); +const Token = require('token-types'); + +(async () => { + + const tokenizer = await strtok3.fromFile("somefile.bin"); + try { + const myNumber = await tokenizer.readToken(Token.UINT8); + console.log(`My number: ${myNumber}`); + } finally { + tokenizer.close(); // Close the file + } +})(); + +``` + +#### Method `strtok3.fromStream()` + +Create [*tokenizer*](#tokenizer) from a node.js [readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable). + +| Parameter | Optional | Type | Description | +|-----------|-----------|-----------------------------------------------------------------------------|--------------------------| +| stream | no | [Readable](https://nodejs.org/api/stream.html#stream_class_stream_readable) | Stream to read from | +| fileInfo | yes | [IFileInfo](#IFileInfo) | Provide file information | + +Returns a [*tokenizer*](#tokenizer), via a Promise, which can be used to parse a buffer. + +```js +const strtok3 = require('strtok3'); +const Token = require('token-types'); + +strtok3.fromStream(stream).then(tokenizer => { + return tokenizer.readToken(Token.UINT8).then(myUint8Number => { + console.log(`My number: ${myUint8Number}`); + }); +}); +``` + +#### Method `strtok3.fromBuffer()` + +| Parameter | Optional | Type | Description | +|------------|----------|--------------------------------------------------|----------------------------------------| +| uint8Array | no | [Uint8Array](https://nodejs.org/api/buffer.html) | Uint8Array or Buffer to read from | +| fileInfo | yes | [IFileInfo](#IFileInfo) | Provide file information | + +Returns a [*tokenizer*](#tokenizer) which can be used to parse the provided buffer. + +```js +const strtok3 = require('strtok3'); + +const tokenizer = strtok3.fromBuffer(buffer); + +tokenizer.readToken(Token.UINT8).then(myUint8Number => { + console.log(`My number: ${myUint8Number}`); +}); +``` + +## Tokenizer +The tokenizer allows us to *read* or *peek* from the *tokenizer-stream*. The *tokenizer-stream* is an abstraction of a [stream](https://nodejs.org/api/stream.html), file or [Buffer](https://nodejs.org/api/buffer.html). +It can also be translated in chunked reads, as done in [@tokenizer/http](https://github.com/Borewit/tokenizer-http); + +What is the difference with Nodejs.js stream? +* The *tokenizer-stream* supports jumping / seeking in a the *tokenizer-stream* using [`tokenizer.ignore()`](#method-tokenizerignore) +* In addition to *read* methods, it has *peek* methods, to read a ahead and check what is coming. + +The [tokenizer.position](#attribute-tokenizerposition) keeps tracks of the read position. + +### strtok3 attributes + +#### Attribute `tokenizer.fileInfo` +Optional attribute describing the file information, see [IFileInfo](#IFileInfo) + +#### Attribute `tokenizer.position` +Pointer to the current position in the [*tokenizer*](#tokenizer) stream. +If a *position* is provided to a *read* or *peek* method, is should be, at least, equal or greater than this value. + +### Tokenizer methods + +There are two kind of methods: +1. *read* methods: used to read a *token* of [Buffer](https://nodejs.org/api/buffer.html) from the [*tokenizer*](#tokenizer). The position of the *tokenizer-stream* will advance with the size of the token. +2. *peek* methods: same as the read, but it will *not* advance the pointer. It allows to read (peek) ahead. + +#### Method `tokenizer.readBuffer()` + +Read buffer from stream. +`readBuffer(buffer, options?)` + +| Parameter | Type | Description | +|------------|----------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| buffer | [Buffer](https://nodejs.org/api/buffer.html) | Uint8Array | Target buffer to write the data read to | +| options | [IReadChunkOptions](#ireadchunkoptions) | An integer specifying the number of bytes to read | + +Return value `Promise` Promise with number of bytes read. The number of bytes read maybe if less, *mayBeLess* flag was set. + +#### Method `tokenizer.peekBuffer()` + +Peek (read ahead) buffer from [*tokenizer*](#tokenizer) +`peekBuffer(buffer, options?)` + +| Parameter | Type | Description | +|------------|-----------------------------------------|-----------------------------------------------------| +| buffer | Buffer | Uint8Array | Target buffer to write the data read (peeked) to. | +| options | [IReadChunkOptions](#ireadchunkoptions) | An integer specifying the number of bytes to read. | | + +Return value `Promise` Promise with number of bytes read. The number of bytes read maybe if less, *mayBeLess* flag was set. + +#### Method `tokenizer.readToken()` + +Read a *token* from the tokenizer-stream. +`readToken(token, position?)` + +| Parameter | Type | Description | +|------------|-------------------------|---------------------------------------------------------------------------------------------------------------------- | +| token | [IGetToken](#IGetToken) | Token to read from the tokenizer-stream. | +| position? | number | Offset where to begin reading within the file. If position is null, data will be read from the current file position. | + +Return value `Promise`. Promise with number of bytes read. The number of bytes read maybe if less, *mayBeLess* flag was set. + +#### Method `tokenizer.peekToken()` + +Peek a *token* from the [*tokenizer*](#tokenizer). +`peekToken(token, position?)` + +| Parameter | Type | Description | +|------------|----------------------------|-------------------------------------------------------------------------------------------------------------------------| +| token | [IGetToken](#IGetToken) | Token to read from the tokenizer-stream. | +| position? | number | Offset where to begin reading within the file. If position is null, data will be read from the current file position. | + +Return value `Promise` Promise with token value peeked from the [*tokenizer*](#tokenizer). + +#### Method `tokenizer.readNumber()` + +Peek a numeric [*token*](#token) from the [*tokenizer*](#tokenizer). +`readNumber(token)` + +| Parameter | Type | Description | +|------------|---------------------------------|----------------------------------------------------| +| token | [IGetToken](#IGetToken) | Numeric token to read from the tokenizer-stream. | + +Return value `Promise` Promise with number peeked from the *tokenizer-stream*. + +#### Method `tokenizer.ignore()` + +Advanse the offset pointer with the number of bytes provided. +`ignore(length)` + +| Parameter | Type | Description | +|------------|--------|----------------------------------------------------------------------| +| ignore | number | Numeric of bytes to ignore. Will advance the `tokenizer.position` | + +Return value `Promise` Promise with number peeked from the *tokenizer-stream*. + +#### Method `tokenizer.close()` +Clean up resources, such as closing a file pointer if applicable. + +### IReadChunkOptions + +Each attribute is optional: + +| Attribute | Type | Description | +|-----------|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| offset | number | The offset in the buffer to start writing at; if not provided, start at 0 | +| length | number | Requested number of bytes to read. | +| position | number | Position where to peek from the file. If position is null, data will be read from the [current file position](#attribute-tokenizerposition). Position may not be less then [tokenizer.position](#attribute-tokenizerposition) | +| mayBeLess | boolean | If and only if set, will not throw an EOF error if less then the requested *mayBeLess* could be read. | + +Example: +```js + tokenizer.peekBuffer(buffer, {mayBeLess: true}); +``` + +## IFileInfo + +File information interface which describes the underlying file, each attribute is optional. + +| Attribute | Type | Description | +|-----------|---------|---------------------------------------------------------------------------------------------------| +| size | number | File size in bytes | +| mimeType | number | [MIME-type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of file. | +| path | number | File path | +| url | boolean | File URL | + +## Token + +The *token* is basically a description what to read form the [*tokenizer-stream*](#tokenizer). +A basic set of *token types* can be found here: [*token-types*](https://github.com/Borewit/token-types). + +A token is something which implements the following interface: +```ts +export interface IGetToken { + + /** + * Length in bytes of encoded value + */ + len: number; + + /** + * Decode value from buffer at offset + * @param buf Buffer to read the decoded value from + * @param off Decode offset + */ + get(buf: Buffer, off: number): T; +} +``` +The *tokenizer* reads `token.len` bytes from the *tokenizer-stream* into a Buffer. +The `token.get` will be called with the Buffer. `token.get` is responsible for conversion from the buffer to the desired output type. + +## Browser compatibility +To exclude fs based dependencies, you can use a submodule-import from 'strtok3/lib/core'. + +| function | 'strtok3' | 'strtok3/lib/core' | +| ----------------------| --------------------|---------------------| +| `parseBuffer` | ✓ | ✓ | +| `parseStream` | ✓ | ✓ | +| `fromFile` | ✓ | | + +### Working with Web-API readable stream +To convert a [Web-API readable stream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader) into a [Node.js readable stream]((https://nodejs.org/api/stream.html#stream_readable_streams)), you can use [readable-web-to-node-stream](https://github.com/Borewit/readable-web-to-node-stream) to convert one in another. + +Example submodule-import: +```js +const strtok3core = require('strtok3/lib/core'); // Submodule-import to prevent Node.js specific dependencies +const {ReadableWebToNodeStream} = require('readable-web-to-node-stream'); + +(async () => { + + const response = await fetch(url); + const readableWebStream = response.body; // Web-API readable stream + const nodeStream = new ReadableWebToNodeStream(readableWebStream); // convert to Node.js readable stream + + const tokenizer = strtok3core.fromStream(nodeStream); // And we now have tokenizer in a web environment +})(); +``` + +## Licence + +(The MIT License) + +Copyright (c) 2020 Borewit + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/project starter code/node_modules/strtok3/lib/AbstractTokenizer.d.ts b/project starter code/node_modules/strtok3/lib/AbstractTokenizer.d.ts new file mode 100644 index 00000000..bf4d42c7 --- /dev/null +++ b/project starter code/node_modules/strtok3/lib/AbstractTokenizer.d.ts @@ -0,0 +1,69 @@ +import { ITokenizer, IFileInfo, IReadChunkOptions } from './types'; +import { IGetToken, IToken } from '@tokenizer/token'; +interface INormalizedReadChunkOptions extends IReadChunkOptions { + offset: number; + length: number; + position: number; + mayBeLess?: boolean; +} +/** + * Core tokenizer + */ +export declare abstract class AbstractTokenizer implements ITokenizer { + fileInfo: IFileInfo; + protected constructor(fileInfo?: IFileInfo); + /** + * Tokenizer-stream position + */ + position: number; + private numBuffer; + /** + * Read buffer from tokenizer + * @param buffer - Target buffer to fill with data read from the tokenizer-stream + * @param options - Additional read options + * @returns Promise with number of bytes read + */ + abstract readBuffer(buffer: Uint8Array, options?: IReadChunkOptions): Promise; + /** + * Peek (read ahead) buffer from tokenizer + * @param uint8Array- Target buffer to fill with data peek from the tokenizer-stream + * @param options - Peek behaviour options + * @returns Promise with number of bytes read + */ + abstract peekBuffer(uint8Array: Uint8Array, options?: IReadChunkOptions): Promise; + /** + * Read a token from the tokenizer-stream + * @param token - The token to read + * @param position - If provided, the desired position in the tokenizer-stream + * @returns Promise with token data + */ + readToken(token: IGetToken, position?: number): Promise; + /** + * Peek a token from the tokenizer-stream. + * @param token - Token to peek from the tokenizer-stream. + * @param position - Offset where to begin reading within the file. If position is null, data will be read from the current file position. + * @returns Promise with token data + */ + peekToken(token: IGetToken, position?: number): Promise; + /** + * Read a numeric token from the stream + * @param token - Numeric token + * @returns Promise with number + */ + readNumber(token: IToken): Promise; + /** + * Read a numeric token from the stream + * @param token - Numeric token + * @returns Promise with number + */ + peekNumber(token: IToken): Promise; + /** + * Ignore number of bytes, advances the pointer in under tokenizer-stream. + * @param length - Number of bytes to ignore + * @return resolves the number of bytes ignored, equals length if this available, otherwise the number of bytes available + */ + ignore(length: number): Promise; + close(): Promise; + protected normalizeOptions(uint8Array: Uint8Array, options?: IReadChunkOptions): INormalizedReadChunkOptions; +} +export {}; diff --git a/project starter code/node_modules/strtok3/lib/AbstractTokenizer.js b/project starter code/node_modules/strtok3/lib/AbstractTokenizer.js new file mode 100644 index 00000000..6683b323 --- /dev/null +++ b/project starter code/node_modules/strtok3/lib/AbstractTokenizer.js @@ -0,0 +1,104 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AbstractTokenizer = void 0; +const peek_readable_1 = require("peek-readable"); +/** + * Core tokenizer + */ +class AbstractTokenizer { + constructor(fileInfo) { + /** + * Tokenizer-stream position + */ + this.position = 0; + this.numBuffer = new Uint8Array(8); + this.fileInfo = fileInfo ? fileInfo : {}; + } + /** + * Read a token from the tokenizer-stream + * @param token - The token to read + * @param position - If provided, the desired position in the tokenizer-stream + * @returns Promise with token data + */ + async readToken(token, position = this.position) { + const uint8Array = Buffer.alloc(token.len); + const len = await this.readBuffer(uint8Array, { position }); + if (len < token.len) + throw new peek_readable_1.EndOfStreamError(); + return token.get(uint8Array, 0); + } + /** + * Peek a token from the tokenizer-stream. + * @param token - Token to peek from the tokenizer-stream. + * @param position - Offset where to begin reading within the file. If position is null, data will be read from the current file position. + * @returns Promise with token data + */ + async peekToken(token, position = this.position) { + const uint8Array = Buffer.alloc(token.len); + const len = await this.peekBuffer(uint8Array, { position }); + if (len < token.len) + throw new peek_readable_1.EndOfStreamError(); + return token.get(uint8Array, 0); + } + /** + * Read a numeric token from the stream + * @param token - Numeric token + * @returns Promise with number + */ + async readNumber(token) { + const len = await this.readBuffer(this.numBuffer, { length: token.len }); + if (len < token.len) + throw new peek_readable_1.EndOfStreamError(); + return token.get(this.numBuffer, 0); + } + /** + * Read a numeric token from the stream + * @param token - Numeric token + * @returns Promise with number + */ + async peekNumber(token) { + const len = await this.peekBuffer(this.numBuffer, { length: token.len }); + if (len < token.len) + throw new peek_readable_1.EndOfStreamError(); + return token.get(this.numBuffer, 0); + } + /** + * Ignore number of bytes, advances the pointer in under tokenizer-stream. + * @param length - Number of bytes to ignore + * @return resolves the number of bytes ignored, equals length if this available, otherwise the number of bytes available + */ + async ignore(length) { + if (this.fileInfo.size !== undefined) { + const bytesLeft = this.fileInfo.size - this.position; + if (length > bytesLeft) { + this.position += bytesLeft; + return bytesLeft; + } + } + this.position += length; + return length; + } + async close() { + // empty + } + normalizeOptions(uint8Array, options) { + if (options && options.position !== undefined && options.position < this.position) { + throw new Error('`options.position` must be equal or greater than `tokenizer.position`'); + } + if (options) { + return { + mayBeLess: options.mayBeLess === true, + offset: options.offset ? options.offset : 0, + length: options.length ? options.length : (uint8Array.length - (options.offset ? options.offset : 0)), + position: options.position ? options.position : this.position + }; + } + return { + mayBeLess: false, + offset: 0, + length: uint8Array.length, + position: this.position + }; + } +} +exports.AbstractTokenizer = AbstractTokenizer; diff --git a/project starter code/node_modules/strtok3/lib/BufferTokenizer.d.ts b/project starter code/node_modules/strtok3/lib/BufferTokenizer.d.ts new file mode 100644 index 00000000..534e31bc --- /dev/null +++ b/project starter code/node_modules/strtok3/lib/BufferTokenizer.d.ts @@ -0,0 +1,26 @@ +import { IFileInfo, IReadChunkOptions } from './types'; +import { AbstractTokenizer } from './AbstractTokenizer'; +export declare class BufferTokenizer extends AbstractTokenizer { + private uint8Array; + /** + * Construct BufferTokenizer + * @param uint8Array - Uint8Array to tokenize + * @param fileInfo - Pass additional file information to the tokenizer + */ + constructor(uint8Array: Uint8Array, fileInfo?: IFileInfo); + /** + * Read buffer from tokenizer + * @param uint8Array - Uint8Array to tokenize + * @param options - Read behaviour options + * @returns {Promise} + */ + readBuffer(uint8Array: Uint8Array, options?: IReadChunkOptions): Promise; + /** + * Peek (read ahead) buffer from tokenizer + * @param uint8Array + * @param options - Read behaviour options + * @returns {Promise} + */ + peekBuffer(uint8Array: Uint8Array, options?: IReadChunkOptions): Promise; + close(): Promise; +} diff --git a/project starter code/node_modules/strtok3/lib/BufferTokenizer.js b/project starter code/node_modules/strtok3/lib/BufferTokenizer.js new file mode 100644 index 00000000..33d8b1fb --- /dev/null +++ b/project starter code/node_modules/strtok3/lib/BufferTokenizer.js @@ -0,0 +1,55 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BufferTokenizer = void 0; +const peek_readable_1 = require("peek-readable"); +const AbstractTokenizer_1 = require("./AbstractTokenizer"); +class BufferTokenizer extends AbstractTokenizer_1.AbstractTokenizer { + /** + * Construct BufferTokenizer + * @param uint8Array - Uint8Array to tokenize + * @param fileInfo - Pass additional file information to the tokenizer + */ + constructor(uint8Array, fileInfo) { + super(fileInfo); + this.uint8Array = uint8Array; + this.fileInfo.size = this.fileInfo.size ? this.fileInfo.size : uint8Array.length; + } + /** + * Read buffer from tokenizer + * @param uint8Array - Uint8Array to tokenize + * @param options - Read behaviour options + * @returns {Promise} + */ + async readBuffer(uint8Array, options) { + if (options && options.position) { + if (options.position < this.position) { + throw new Error('`options.position` must be equal or greater than `tokenizer.position`'); + } + this.position = options.position; + } + const bytesRead = await this.peekBuffer(uint8Array, options); + this.position += bytesRead; + return bytesRead; + } + /** + * Peek (read ahead) buffer from tokenizer + * @param uint8Array + * @param options - Read behaviour options + * @returns {Promise} + */ + async peekBuffer(uint8Array, options) { + const normOptions = this.normalizeOptions(uint8Array, options); + const bytes2read = Math.min(this.uint8Array.length - normOptions.position, normOptions.length); + if ((!normOptions.mayBeLess) && bytes2read < normOptions.length) { + throw new peek_readable_1.EndOfStreamError(); + } + else { + uint8Array.set(this.uint8Array.subarray(normOptions.position, normOptions.position + bytes2read), normOptions.offset); + return bytes2read; + } + } + async close() { + // empty + } +} +exports.BufferTokenizer = BufferTokenizer; diff --git a/project starter code/node_modules/strtok3/lib/FileTokenizer.d.ts b/project starter code/node_modules/strtok3/lib/FileTokenizer.d.ts new file mode 100644 index 00000000..3d940594 --- /dev/null +++ b/project starter code/node_modules/strtok3/lib/FileTokenizer.d.ts @@ -0,0 +1,22 @@ +import { AbstractTokenizer } from './AbstractTokenizer'; +import { IFileInfo, IReadChunkOptions } from './types'; +export declare class FileTokenizer extends AbstractTokenizer { + private fd; + constructor(fd: number, fileInfo: IFileInfo); + /** + * Read buffer from file + * @param uint8Array - Uint8Array to write result to + * @param options - Read behaviour options + * @returns Promise number of bytes read + */ + readBuffer(uint8Array: Uint8Array, options?: IReadChunkOptions): Promise; + /** + * Peek buffer from file + * @param uint8Array - Uint8Array (or Buffer) to write data to + * @param options - Read behaviour options + * @returns Promise number of bytes read + */ + peekBuffer(uint8Array: Uint8Array, options?: IReadChunkOptions): Promise; + close(): Promise; +} +export declare function fromFile(sourceFilePath: string): Promise; diff --git a/project starter code/node_modules/strtok3/lib/FileTokenizer.js b/project starter code/node_modules/strtok3/lib/FileTokenizer.js new file mode 100644 index 00000000..b6fd31fa --- /dev/null +++ b/project starter code/node_modules/strtok3/lib/FileTokenizer.js @@ -0,0 +1,55 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fromFile = exports.FileTokenizer = void 0; +const AbstractTokenizer_1 = require("./AbstractTokenizer"); +const peek_readable_1 = require("peek-readable"); +const fs = require("./FsPromise"); +class FileTokenizer extends AbstractTokenizer_1.AbstractTokenizer { + constructor(fd, fileInfo) { + super(fileInfo); + this.fd = fd; + } + /** + * Read buffer from file + * @param uint8Array - Uint8Array to write result to + * @param options - Read behaviour options + * @returns Promise number of bytes read + */ + async readBuffer(uint8Array, options) { + const normOptions = this.normalizeOptions(uint8Array, options); + this.position = normOptions.position; + const res = await fs.read(this.fd, uint8Array, normOptions.offset, normOptions.length, normOptions.position); + this.position += res.bytesRead; + if (res.bytesRead < normOptions.length && (!options || !options.mayBeLess)) { + throw new peek_readable_1.EndOfStreamError(); + } + return res.bytesRead; + } + /** + * Peek buffer from file + * @param uint8Array - Uint8Array (or Buffer) to write data to + * @param options - Read behaviour options + * @returns Promise number of bytes read + */ + async peekBuffer(uint8Array, options) { + const normOptions = this.normalizeOptions(uint8Array, options); + const res = await fs.read(this.fd, uint8Array, normOptions.offset, normOptions.length, normOptions.position); + if ((!normOptions.mayBeLess) && res.bytesRead < normOptions.length) { + throw new peek_readable_1.EndOfStreamError(); + } + return res.bytesRead; + } + async close() { + return fs.close(this.fd); + } +} +exports.FileTokenizer = FileTokenizer; +async function fromFile(sourceFilePath) { + const stat = await fs.stat(sourceFilePath); + if (!stat.isFile) { + throw new Error(`File not a file: ${sourceFilePath}`); + } + const fd = await fs.open(sourceFilePath, 'r'); + return new FileTokenizer(fd, { path: sourceFilePath, size: stat.size }); +} +exports.fromFile = fromFile; diff --git a/project starter code/node_modules/strtok3/lib/FsPromise.d.ts b/project starter code/node_modules/strtok3/lib/FsPromise.d.ts new file mode 100644 index 00000000..cd2fb0fd --- /dev/null +++ b/project starter code/node_modules/strtok3/lib/FsPromise.d.ts @@ -0,0 +1,18 @@ +/** + * Module convert fs functions to promise based functions + */ +/// +import * as fs from 'fs'; +export interface IReadResult { + bytesRead: number; + buffer: Uint8Array; +} +export declare const pathExists: typeof fs.existsSync; +export declare const createReadStream: typeof fs.createReadStream; +export declare function stat(path: fs.PathLike): Promise; +export declare function close(fd: number): Promise; +export declare function open(path: fs.PathLike, mode: fs.Mode): Promise; +export declare function read(fd: number, buffer: Uint8Array, offset: number, length: number, position: number): Promise; +export declare function writeFile(path: fs.PathLike, data: Buffer | string): Promise; +export declare function writeFileSync(path: fs.PathLike, data: Buffer | string): void; +export declare function readFile(path: fs.PathLike): Promise; diff --git a/project starter code/node_modules/strtok3/lib/FsPromise.js b/project starter code/node_modules/strtok3/lib/FsPromise.js new file mode 100644 index 00000000..690a5e2b --- /dev/null +++ b/project starter code/node_modules/strtok3/lib/FsPromise.js @@ -0,0 +1,79 @@ +"use strict"; +/** + * Module convert fs functions to promise based functions + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.readFile = exports.writeFileSync = exports.writeFile = exports.read = exports.open = exports.close = exports.stat = exports.createReadStream = exports.pathExists = void 0; +const fs = require("fs"); +exports.pathExists = fs.existsSync; +exports.createReadStream = fs.createReadStream; +async function stat(path) { + return new Promise((resolve, reject) => { + fs.stat(path, (err, stats) => { + if (err) + reject(err); + else + resolve(stats); + }); + }); +} +exports.stat = stat; +async function close(fd) { + return new Promise((resolve, reject) => { + fs.close(fd, err => { + if (err) + reject(err); + else + resolve(); + }); + }); +} +exports.close = close; +async function open(path, mode) { + return new Promise((resolve, reject) => { + fs.open(path, mode, (err, fd) => { + if (err) + reject(err); + else + resolve(fd); + }); + }); +} +exports.open = open; +async function read(fd, buffer, offset, length, position) { + return new Promise((resolve, reject) => { + fs.read(fd, buffer, offset, length, position, (err, bytesRead, _buffer) => { + if (err) + reject(err); + else + resolve({ bytesRead, buffer: _buffer }); + }); + }); +} +exports.read = read; +async function writeFile(path, data) { + return new Promise((resolve, reject) => { + fs.writeFile(path, data, err => { + if (err) + reject(err); + else + resolve(); + }); + }); +} +exports.writeFile = writeFile; +function writeFileSync(path, data) { + fs.writeFileSync(path, data); +} +exports.writeFileSync = writeFileSync; +async function readFile(path) { + return new Promise((resolve, reject) => { + fs.readFile(path, (err, buffer) => { + if (err) + reject(err); + else + resolve(buffer); + }); + }); +} +exports.readFile = readFile; diff --git a/project starter code/node_modules/strtok3/lib/ReadStreamTokenizer.d.ts b/project starter code/node_modules/strtok3/lib/ReadStreamTokenizer.d.ts new file mode 100644 index 00000000..18252c39 --- /dev/null +++ b/project starter code/node_modules/strtok3/lib/ReadStreamTokenizer.d.ts @@ -0,0 +1,28 @@ +/// +import { AbstractTokenizer } from './AbstractTokenizer'; +import { Readable } from 'stream'; +import { IFileInfo, IReadChunkOptions } from './types'; +export declare class ReadStreamTokenizer extends AbstractTokenizer { + private streamReader; + constructor(stream: Readable, fileInfo?: IFileInfo); + /** + * Get file information, an HTTP-client may implement this doing a HEAD request + * @return Promise with file information + */ + getFileInfo(): Promise; + /** + * Read buffer from tokenizer + * @param uint8Array - Target Uint8Array to fill with data read from the tokenizer-stream + * @param options - Read behaviour options + * @returns Promise with number of bytes read + */ + readBuffer(uint8Array: Uint8Array, options?: IReadChunkOptions): Promise; + /** + * Peek (read ahead) buffer from tokenizer + * @param uint8Array - Uint8Array (or Buffer) to write data to + * @param options - Read behaviour options + * @returns Promise with number of bytes peeked + */ + peekBuffer(uint8Array: Uint8Array, options?: IReadChunkOptions): Promise; + ignore(length: number): Promise; +} diff --git a/project starter code/node_modules/strtok3/lib/ReadStreamTokenizer.js b/project starter code/node_modules/strtok3/lib/ReadStreamTokenizer.js new file mode 100644 index 00000000..0270b4d9 --- /dev/null +++ b/project starter code/node_modules/strtok3/lib/ReadStreamTokenizer.js @@ -0,0 +1,98 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ReadStreamTokenizer = void 0; +const AbstractTokenizer_1 = require("./AbstractTokenizer"); +const peek_readable_1 = require("peek-readable"); +const maxBufferSize = 256000; +class ReadStreamTokenizer extends AbstractTokenizer_1.AbstractTokenizer { + constructor(stream, fileInfo) { + super(fileInfo); + this.streamReader = new peek_readable_1.StreamReader(stream); + } + /** + * Get file information, an HTTP-client may implement this doing a HEAD request + * @return Promise with file information + */ + async getFileInfo() { + return this.fileInfo; + } + /** + * Read buffer from tokenizer + * @param uint8Array - Target Uint8Array to fill with data read from the tokenizer-stream + * @param options - Read behaviour options + * @returns Promise with number of bytes read + */ + async readBuffer(uint8Array, options) { + const normOptions = this.normalizeOptions(uint8Array, options); + const skipBytes = normOptions.position - this.position; + if (skipBytes > 0) { + await this.ignore(skipBytes); + return this.readBuffer(uint8Array, options); + } + else if (skipBytes < 0) { + throw new Error('`options.position` must be equal or greater than `tokenizer.position`'); + } + if (normOptions.length === 0) { + return 0; + } + const bytesRead = await this.streamReader.read(uint8Array, normOptions.offset, normOptions.length); + this.position += bytesRead; + if ((!options || !options.mayBeLess) && bytesRead < normOptions.length) { + throw new peek_readable_1.EndOfStreamError(); + } + return bytesRead; + } + /** + * Peek (read ahead) buffer from tokenizer + * @param uint8Array - Uint8Array (or Buffer) to write data to + * @param options - Read behaviour options + * @returns Promise with number of bytes peeked + */ + async peekBuffer(uint8Array, options) { + const normOptions = this.normalizeOptions(uint8Array, options); + let bytesRead = 0; + if (normOptions.position) { + const skipBytes = normOptions.position - this.position; + if (skipBytes > 0) { + const skipBuffer = new Uint8Array(normOptions.length + skipBytes); + bytesRead = await this.peekBuffer(skipBuffer, { mayBeLess: normOptions.mayBeLess }); + uint8Array.set(skipBuffer.subarray(skipBytes), normOptions.offset); + return bytesRead - skipBytes; + } + else if (skipBytes < 0) { + throw new Error('Cannot peek from a negative offset in a stream'); + } + } + if (normOptions.length > 0) { + try { + bytesRead = await this.streamReader.peek(uint8Array, normOptions.offset, normOptions.length); + } + catch (err) { + if (options && options.mayBeLess && err instanceof peek_readable_1.EndOfStreamError) { + return 0; + } + throw err; + } + if ((!normOptions.mayBeLess) && bytesRead < normOptions.length) { + throw new peek_readable_1.EndOfStreamError(); + } + } + return bytesRead; + } + async ignore(length) { + // debug(`ignore ${this.position}...${this.position + length - 1}`); + const bufSize = Math.min(maxBufferSize, length); + const buf = new Uint8Array(bufSize); + let totBytesRead = 0; + while (totBytesRead < length) { + const remaining = length - totBytesRead; + const bytesRead = await this.readBuffer(buf, { length: Math.min(bufSize, remaining) }); + if (bytesRead < 0) { + return bytesRead; + } + totBytesRead += bytesRead; + } + return totBytesRead; + } +} +exports.ReadStreamTokenizer = ReadStreamTokenizer; diff --git a/project starter code/node_modules/strtok3/lib/core.d.ts b/project starter code/node_modules/strtok3/lib/core.d.ts new file mode 100644 index 00000000..04ec5b24 --- /dev/null +++ b/project starter code/node_modules/strtok3/lib/core.d.ts @@ -0,0 +1,23 @@ +/// +import { ReadStreamTokenizer } from './ReadStreamTokenizer'; +import { Readable } from 'stream'; +import { BufferTokenizer } from './BufferTokenizer'; +import { IFileInfo } from './types'; +export { EndOfStreamError } from 'peek-readable'; +export { ITokenizer, IFileInfo } from './types'; +export { IToken, IGetToken } from '@tokenizer/token'; +/** + * Construct ReadStreamTokenizer from given Stream. + * Will set fileSize, if provided given Stream has set the .path property/ + * @param stream - Read from Node.js Stream.Readable + * @param fileInfo - Pass the file information, like size and MIME-type of the corresponding stream. + * @returns ReadStreamTokenizer + */ +export declare function fromStream(stream: Readable, fileInfo?: IFileInfo): ReadStreamTokenizer; +/** + * Construct ReadStreamTokenizer from given Buffer. + * @param uint8Array - Uint8Array to tokenize + * @param fileInfo - Pass additional file information to the tokenizer + * @returns BufferTokenizer + */ +export declare function fromBuffer(uint8Array: Uint8Array, fileInfo?: IFileInfo): BufferTokenizer; diff --git a/project starter code/node_modules/strtok3/lib/core.js b/project starter code/node_modules/strtok3/lib/core.js new file mode 100644 index 00000000..fb92aa72 --- /dev/null +++ b/project starter code/node_modules/strtok3/lib/core.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fromBuffer = exports.fromStream = exports.EndOfStreamError = void 0; +const ReadStreamTokenizer_1 = require("./ReadStreamTokenizer"); +const BufferTokenizer_1 = require("./BufferTokenizer"); +var peek_readable_1 = require("peek-readable"); +Object.defineProperty(exports, "EndOfStreamError", { enumerable: true, get: function () { return peek_readable_1.EndOfStreamError; } }); +/** + * Construct ReadStreamTokenizer from given Stream. + * Will set fileSize, if provided given Stream has set the .path property/ + * @param stream - Read from Node.js Stream.Readable + * @param fileInfo - Pass the file information, like size and MIME-type of the corresponding stream. + * @returns ReadStreamTokenizer + */ +function fromStream(stream, fileInfo) { + fileInfo = fileInfo ? fileInfo : {}; + return new ReadStreamTokenizer_1.ReadStreamTokenizer(stream, fileInfo); +} +exports.fromStream = fromStream; +/** + * Construct ReadStreamTokenizer from given Buffer. + * @param uint8Array - Uint8Array to tokenize + * @param fileInfo - Pass additional file information to the tokenizer + * @returns BufferTokenizer + */ +function fromBuffer(uint8Array, fileInfo) { + return new BufferTokenizer_1.BufferTokenizer(uint8Array, fileInfo); +} +exports.fromBuffer = fromBuffer; diff --git a/project starter code/node_modules/strtok3/lib/index.d.ts b/project starter code/node_modules/strtok3/lib/index.d.ts new file mode 100644 index 00000000..c4bd267c --- /dev/null +++ b/project starter code/node_modules/strtok3/lib/index.d.ts @@ -0,0 +1,15 @@ +/// +import { Readable } from 'stream'; +import { ReadStreamTokenizer } from './ReadStreamTokenizer'; +import * as core from './core'; +export { fromFile } from './FileTokenizer'; +export { ITokenizer, EndOfStreamError, fromBuffer, IFileInfo } from './core'; +export { IToken, IGetToken } from '@tokenizer/token'; +/** + * Construct ReadStreamTokenizer from given Stream. + * Will set fileSize, if provided given Stream has set the .path property. + * @param stream - Node.js Stream.Readable + * @param fileInfo - Pass additional file information to the tokenizer + * @returns Tokenizer + */ +export declare function fromStream(stream: Readable, fileInfo?: core.IFileInfo): Promise; diff --git a/project starter code/node_modules/strtok3/lib/index.js b/project starter code/node_modules/strtok3/lib/index.js new file mode 100644 index 00000000..030e750f --- /dev/null +++ b/project starter code/node_modules/strtok3/lib/index.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fromStream = exports.fromBuffer = exports.EndOfStreamError = exports.fromFile = void 0; +const fs = require("./FsPromise"); +const core = require("./core"); +var FileTokenizer_1 = require("./FileTokenizer"); +Object.defineProperty(exports, "fromFile", { enumerable: true, get: function () { return FileTokenizer_1.fromFile; } }); +var core_1 = require("./core"); +Object.defineProperty(exports, "EndOfStreamError", { enumerable: true, get: function () { return core_1.EndOfStreamError; } }); +Object.defineProperty(exports, "fromBuffer", { enumerable: true, get: function () { return core_1.fromBuffer; } }); +/** + * Construct ReadStreamTokenizer from given Stream. + * Will set fileSize, if provided given Stream has set the .path property. + * @param stream - Node.js Stream.Readable + * @param fileInfo - Pass additional file information to the tokenizer + * @returns Tokenizer + */ +async function fromStream(stream, fileInfo) { + fileInfo = fileInfo ? fileInfo : {}; + if (stream.path) { + const stat = await fs.stat(stream.path); + fileInfo.path = stream.path; + fileInfo.size = stat.size; + } + return core.fromStream(stream, fileInfo); +} +exports.fromStream = fromStream; diff --git a/project starter code/node_modules/strtok3/lib/types.d.ts b/project starter code/node_modules/strtok3/lib/types.d.ts new file mode 100644 index 00000000..93895dfd --- /dev/null +++ b/project starter code/node_modules/strtok3/lib/types.d.ts @@ -0,0 +1,103 @@ +/// +import { IGetToken } from '@tokenizer/token'; +export interface IFileInfo { + /** + * File size in bytes + */ + size?: number; + /** + * MIME-type of file + */ + mimeType?: string; + /** + * File path + */ + path?: string; + /** + * File URL + */ + url?: string; +} +export interface IReadChunkOptions { + /** + * The offset in the buffer to start writing at; default is 0 + */ + offset?: number; + /** + * Number of bytes to read. + */ + length?: number; + /** + * Position where to begin reading from the file. + * Default it is `tokenizer.position`. + * Position may not be less then `tokenizer.position`. + */ + position?: number; + /** + * If set, will not throw an EOF error if not all of the requested data could be read + */ + mayBeLess?: boolean; +} +/** + * The tokenizer allows us to read or peek from the tokenizer-stream. + * The tokenizer-stream is an abstraction of a stream, file or Buffer. + */ +export interface ITokenizer { + /** + * Provide access to information of the underlying information stream or file. + */ + fileInfo: IFileInfo; + /** + * Offset in bytes (= number of bytes read) since beginning of file or stream + */ + position: number; + /** + * Peek (read ahead) buffer from tokenizer + * @param buffer - Target buffer to fill with data peek from the tokenizer-stream + * @param options - Read behaviour options + * @returns Promise with number of bytes read + */ + peekBuffer(buffer: Buffer, options?: IReadChunkOptions): Promise; + /** + * Peek (read ahead) buffer from tokenizer + * @param buffer - Target buffer to fill with data peeked from the tokenizer-stream + * @param options - Additional read options + * @returns Promise with number of bytes read + */ + readBuffer(buffer: Buffer, options?: IReadChunkOptions): Promise; + /** + * Peek a token from the tokenizer-stream. + * @param token - Token to peek from the tokenizer-stream. + * @param position - Offset where to begin reading within the file. If position is null, data will be read from the current file position. + * @param maybeless - If set, will not throw an EOF error if the less then the requested length could be read. + */ + peekToken(token: IGetToken, position?: number | null, maybeless?: boolean): Promise; + /** + * Read a token from the tokenizer-stream. + * @param token - Token to peek from the tokenizer-stream. + * @param position - Offset where to begin reading within the file. If position is null, data will be read from the current file position. + */ + readToken(token: IGetToken, position?: number): Promise; + /** + * Peek a numeric token from the stream + * @param token - Numeric token + * @returns Promise with number + */ + peekNumber(token: IGetToken): Promise; + /** + * Read a numeric token from the stream + * @param token - Numeric token + * @returns Promise with number + */ + readNumber(token: IGetToken): Promise; + /** + * Ignore given number of bytes + * @param length - Number of bytes ignored + */ + ignore(length: number): Promise; + /** + * Clean up resources. + * It does not close the stream for StreamReader, but is does close the file-descriptor. + */ + close(): Promise; +} diff --git a/project starter code/node_modules/strtok3/lib/types.js b/project starter code/node_modules/strtok3/lib/types.js new file mode 100644 index 00000000..c8ad2e54 --- /dev/null +++ b/project starter code/node_modules/strtok3/lib/types.js @@ -0,0 +1,2 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/project starter code/node_modules/strtok3/package.json b/project starter code/node_modules/strtok3/package.json new file mode 100644 index 00000000..1f864d38 --- /dev/null +++ b/project starter code/node_modules/strtok3/package.json @@ -0,0 +1,103 @@ +{ + "name": "strtok3", + "version": "6.3.0", + "description": "A promise based streaming tokenizer", + "author": { + "name": "Borewit", + "url": "https://github.com/Borewit" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + }, + "scripts": { + "clean": "del-cli lib/**/*.js lib/**/*.js.map lib/**/*.d.ts test/**/*.js test/**/*.js.map", + "compile-src": "tsc -p lib", + "compile-test": "tsc -p test", + "compile": "npm run compile-src && npm run compile-test", + "build": "npm run clean && npm run compile", + "eslint": "eslint lib test --ext .ts --ignore-pattern *.d.ts", + "lint-md": "remark -u preset-lint-recommended .", + "lint": "npm run lint-md && npm run eslint", + "fix": "eslint lib test --ext .ts --ignore-pattern *.d.ts --fix", + "test": "mocha --require ts-node/register --require source-map-support/register --full-trace test/test.ts", + "test-coverage": "nyc npm run test", + "send-coveralls": "nyc report --reporter=text-lcov | coveralls", + "send-codacy": "nyc report --reporter=text-lcov | codacy-coverage", + "start": "npm run compile && npm run lint && npm run cover-test" + }, + "engines": { + "node": ">=10" + }, + "repository": { + "type": "git", + "url": "https://github.com/Borewit/strtok3.git" + }, + "license": "MIT", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "files": [ + "lib/**/*.js", + "lib/**/*.d.ts" + ], + "bugs": { + "url": "https://github.com/Borewit/strtok3/issues" + }, + "devDependencies": { + "@types/chai": "^4.3.0", + "@types/debug": "^4.1.7", + "@types/mocha": "^9.1.0", + "@types/node": "^17.0.14", + "@typescript-eslint/eslint-plugin": "^5.10.2", + "@typescript-eslint/parser": "^5.10.2", + "chai": "^4.3.6", + "coveralls": "^3.1.1", + "del-cli": "^4.0.1", + "eslint": "^8.8.0", + "eslint-config-prettier": "^8.3.0", + "eslint-import-resolver-typescript": "^2.5.0", + "eslint-plugin-import": "^2.25.4", + "eslint-plugin-jsdoc": "^37.7.1", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-unicorn": "^40.1.0", + "mocha": "^9.2.0", + "nyc": "^15.1.0", + "remark-cli": "^10.0.1", + "remark-preset-lint-recommended": "^6.1.2", + "source-map-support": "^0.5.21", + "token-types": "^4.1.1", + "ts-node": "^10.4.0", + "typescript": "^4.5.5" + }, + "dependencies": { + "@tokenizer/token": "^0.3.0", + "peek-readable": "^4.1.0" + }, + "keywords": [ + "tokenizer", + "reader", + "token", + "async", + "promise", + "parser", + "decoder", + "binary", + "endian", + "uint", + "stream", + "streaming" + ], + "nyc": { + "check-coverage": false, + "extension": [ + ".ts" + ], + "sourceMap": true, + "instrument": true, + "reporter": [ + "lcov", + "text" + ], + "report-dir": "coverage" + } +} diff --git a/project starter code/node_modules/supports-color/browser.js b/project starter code/node_modules/supports-color/browser.js new file mode 100644 index 00000000..62afa3a7 --- /dev/null +++ b/project starter code/node_modules/supports-color/browser.js @@ -0,0 +1,5 @@ +'use strict'; +module.exports = { + stdout: false, + stderr: false +}; diff --git a/project starter code/node_modules/supports-color/index.js b/project starter code/node_modules/supports-color/index.js new file mode 100644 index 00000000..1704131b --- /dev/null +++ b/project starter code/node_modules/supports-color/index.js @@ -0,0 +1,131 @@ +'use strict'; +const os = require('os'); +const hasFlag = require('has-flag'); + +const env = process.env; + +let forceColor; +if (hasFlag('no-color') || + hasFlag('no-colors') || + hasFlag('color=false')) { + forceColor = false; +} else if (hasFlag('color') || + hasFlag('colors') || + hasFlag('color=true') || + hasFlag('color=always')) { + forceColor = true; +} +if ('FORCE_COLOR' in env) { + forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0; +} + +function translateLevel(level) { + if (level === 0) { + return false; + } + + return { + level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3 + }; +} + +function supportsColor(stream) { + if (forceColor === false) { + return 0; + } + + if (hasFlag('color=16m') || + hasFlag('color=full') || + hasFlag('color=truecolor')) { + return 3; + } + + if (hasFlag('color=256')) { + return 2; + } + + if (stream && !stream.isTTY && forceColor !== true) { + return 0; + } + + const min = forceColor ? 1 : 0; + + if (process.platform === 'win32') { + // Node.js 7.5.0 is the first version of Node.js to include a patch to + // libuv that enables 256 color output on Windows. Anything earlier and it + // won't work. However, here we target Node.js 8 at minimum as it is an LTS + // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows + // release that supports 256 colors. Windows 10 build 14931 is the first release + // that supports 16m/TrueColor. + const osRelease = os.release().split('.'); + if ( + Number(process.versions.node.split('.')[0]) >= 8 && + Number(osRelease[0]) >= 10 && + Number(osRelease[2]) >= 10586 + ) { + return Number(osRelease[2]) >= 14931 ? 3 : 2; + } + + return 1; + } + + if ('CI' in env) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') { + return 1; + } + + return min; + } + + if ('TEAMCITY_VERSION' in env) { + return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; + } + + if (env.COLORTERM === 'truecolor') { + return 3; + } + + if ('TERM_PROGRAM' in env) { + const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + + switch (env.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + case 'Apple_Terminal': + return 2; + // No default + } + } + + if (/-256(color)?$/i.test(env.TERM)) { + return 2; + } + + if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; + } + + if ('COLORTERM' in env) { + return 1; + } + + if (env.TERM === 'dumb') { + return min; + } + + return min; +} + +function getSupportLevel(stream) { + const level = supportsColor(stream); + return translateLevel(level); +} + +module.exports = { + supportsColor: getSupportLevel, + stdout: getSupportLevel(process.stdout), + stderr: getSupportLevel(process.stderr) +}; diff --git a/project starter code/node_modules/supports-color/license b/project starter code/node_modules/supports-color/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/project starter code/node_modules/supports-color/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/project starter code/node_modules/supports-color/package.json b/project starter code/node_modules/supports-color/package.json new file mode 100644 index 00000000..ad199f5c --- /dev/null +++ b/project starter code/node_modules/supports-color/package.json @@ -0,0 +1,53 @@ +{ + "name": "supports-color", + "version": "5.5.0", + "description": "Detect whether a terminal supports color", + "license": "MIT", + "repository": "chalk/supports-color", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js", + "browser.js" + ], + "keywords": [ + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "ansi", + "styles", + "tty", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "support", + "supports", + "capability", + "detect", + "truecolor", + "16m" + ], + "dependencies": { + "has-flag": "^3.0.0" + }, + "devDependencies": { + "ava": "^0.25.0", + "import-fresh": "^2.0.0", + "xo": "^0.20.0" + }, + "browser": "browser.js" +} diff --git a/project starter code/node_modules/supports-color/readme.md b/project starter code/node_modules/supports-color/readme.md new file mode 100644 index 00000000..f6e40195 --- /dev/null +++ b/project starter code/node_modules/supports-color/readme.md @@ -0,0 +1,66 @@ +# supports-color [![Build Status](https://travis-ci.org/chalk/supports-color.svg?branch=master)](https://travis-ci.org/chalk/supports-color) + +> Detect whether a terminal supports color + + +## Install + +``` +$ npm install supports-color +``` + + +## Usage + +```js +const supportsColor = require('supports-color'); + +if (supportsColor.stdout) { + console.log('Terminal stdout supports color'); +} + +if (supportsColor.stdout.has256) { + console.log('Terminal stdout supports 256 colors'); +} + +if (supportsColor.stderr.has16m) { + console.log('Terminal stderr supports 16 million colors (truecolor)'); +} +``` + + +## API + +Returns an `Object` with a `stdout` and `stderr` property for testing either streams. Each property is an `Object`, or `false` if color is not supported. + +The `stdout`/`stderr` objects specifies a level of support for color through a `.level` property and a corresponding flag: + +- `.level = 1` and `.hasBasic = true`: Basic color support (16 colors) +- `.level = 2` and `.has256 = true`: 256 color support +- `.level = 3` and `.has16m = true`: Truecolor support (16 million colors) + + +## Info + +It obeys the `--color` and `--no-color` CLI flags. + +Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add the environment variable `FORCE_COLOR=1` to forcefully enable color or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks. + +Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively. + + +## Related + +- [supports-color-cli](https://github.com/chalk/supports-color-cli) - CLI for this module +- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right + + +## Maintainers + +- [Sindre Sorhus](https://github.com/sindresorhus) +- [Josh Junon](https://github.com/qix-) + + +## License + +MIT diff --git a/project starter code/node_modules/tinycolor2/.travis.yml b/project starter code/node_modules/tinycolor2/.travis.yml deleted file mode 100644 index 76709417..00000000 --- a/project starter code/node_modules/tinycolor2/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: node_js -node_js: - - "12" -before_script: - - npm install -g grunt-cli -script: - - grunt default --verbose diff --git a/project starter code/node_modules/tinycolor2/Gruntfile.js b/project starter code/node_modules/tinycolor2/Gruntfile.js deleted file mode 100644 index fc137e4a..00000000 --- a/project starter code/node_modules/tinycolor2/Gruntfile.js +++ /dev/null @@ -1,56 +0,0 @@ - -module.exports = function(grunt) { - - grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), - meta: { - banner: '// TinyColor v<%= pkg.version %>\n' + - '// https://github.com/bgrins/TinyColor\n' + - '// <%= grunt.template.today("yyyy-mm-dd") %>, Brian Grinstead, MIT License\n' - }, - - uglify: { - options: { - mangle: true, - banner: '<%= meta.banner %>' - }, - dist: { - files: { - 'dist/tinycolor-min.js': ['tinycolor.js'] - } - } - }, - - qunit: { - all: ['test/index.html'] - }, - - - jshint: { - options: { - browser: true, - sub: true, - }, - all: ['tinycolor.js'] - }, - - docco: { - debug: { - src: ['tinycolor.js'], - options: { - output: 'docs/' - } - } - } - }); - - - grunt.loadNpmTasks('grunt-contrib-uglify'); - grunt.loadNpmTasks('grunt-contrib-jshint'); - grunt.loadNpmTasks('grunt-contrib-qunit'); - grunt.loadNpmTasks('grunt-docco'); - - grunt.registerTask('default', ['jshint', 'qunit']); - grunt.registerTask('version-bump', ['jshint', 'qunit', 'uglify', 'docco']); - -}; diff --git a/project starter code/node_modules/tinycolor2/README.md b/project starter code/node_modules/tinycolor2/README.md index 7412a022..71b6d767 100644 --- a/project starter code/node_modules/tinycolor2/README.md +++ b/project starter code/node_modules/tinycolor2/README.md @@ -4,32 +4,52 @@ TinyColor is a small, fast library for color manipulation and conversion in JavaScript. It allows many forms of input, while providing color conversions and other color utility functions. It has no dependencies. -[![Build Status](https://travis-ci.org/bgrins/TinyColor.png?branch=master)](https://travis-ci.org/bgrins/TinyColor) +## Including in node + +`tinycolor` can be installed from npm: + + npm install tinycolor2 + +Then it can be used in your script like so: + +```js +var tinycolor = require("tinycolor2"); +var color = tinycolor("red"); +``` + +Or in a module like so: + +```js +import tinycolor from "tinycolor2"; +var color = tinycolor("red"); +``` ## Including in a browser -Download [tinycolor.js](https://raw.githubusercontent.com/bgrins/TinyColor/master/tinycolor.js) or install it with bower: +The package can be bundled from npm, but if you prefer to download it locally you have two choices: - bower install tinycolor +### ESM + +It can be used as a module by downloading [npm/esm/tinycolor.js](https://github.com/bgrins/TinyColor/blob/master/npm/esm/tinycolor.js) or using https://esm.sh/tinycolor2. -Then just include it in the page in a `script` tag: ```html - - ``` -## Including in node -`tinycolor` may also be included as a [node](http://nodejs.org/) module like so: +### UMD - npm install tinycolor2 +You can use it directly in a script tag by downloading the UMD file from [npm/cjs/tinycolor.js](https://github.com/bgrins/TinyColor/blob/master/npm/cjs/tinycolor.js): -Then it can be used in your script like so: -```js -var tinycolor = require("tinycolor2"); +```html + + ``` + ## Usage Call `tinycolor(input)` or `new tinycolor(input)`, and you will have an object with the following properties. See Accepted String Input and Accepted Object Input below for more information about what is accepted. @@ -87,6 +107,9 @@ tinycolor.fromRatio({ h: 1, s: 0, v: 0 }); tinycolor.fromRatio({ h: .5, s: .5, v: .5 }); ``` ### Named + +Case insenstive names are accepted, using the [list of colors in the CSS spec](https://www.w3.org/TR/css-color-4/#named-colors). + ```js tinycolor("RED"); tinycolor("blanchedalmond"); diff --git a/project starter code/node_modules/tinycolor2/bower.json b/project starter code/node_modules/tinycolor2/bower.json deleted file mode 100644 index 0837be3a..00000000 --- a/project starter code/node_modules/tinycolor2/bower.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "tinycolor", - "repository": "bgrins/TinyColor", - "version": "1.4.2", - "main": "tinycolor.js", - "scripts": ["tinycolor.js"], - "license": "MIT", - "ignore": ["test"] -} diff --git a/project starter code/node_modules/tinycolor2/cjs/package.json b/project starter code/node_modules/tinycolor2/cjs/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/project starter code/node_modules/tinycolor2/cjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/project starter code/node_modules/tinycolor2/cjs/test.js b/project starter code/node_modules/tinycolor2/cjs/test.js new file mode 100644 index 00000000..40be5fdd --- /dev/null +++ b/project starter code/node_modules/tinycolor2/cjs/test.js @@ -0,0 +1,2191 @@ +// This file is autogenerated. +// Ideally it wouldn't exist, but it's here to test cjs in node +// Changes should go into ./test.js, and if new assertions are needed +// they'll need to be shimmed here as well +const tinycolor = require("./tinycolor.js"); +const { Deno, testDefinitions } = require("@deno/shim-deno-test"); +async function runDenoTests() { + for (const test of testDefinitions) { + if (test.ignore) { + console.log(`Ignoring ${test.name}`); + continue; + } + console.log(`Running ${test.name}`); + await test.fn(); + console.log(`> Passed ${test.name}`); + } +} +(async () => { + const { assertEquals, assert, assertThrows } = await import( + "../deno_asserts@0.168.0.mjs" + ); + + // TEST_BEGINS_HERE + +Deno.test("TinyColor initialization", function () { + assert( + typeof tinycolor != "undefined", + "tinycolor is initialized on the page" + ); + assert( + typeof tinycolor("red") == "object", + "tinycolor is able to be instantiated" + ); + + var r = tinycolor("red"); + assert( + tinycolor(r) === r, + "when given a tinycolor instance, tinycolor() returns it" + ); + assert( + new tinycolor(r) === r, + "when given a tinycolor instance, new tinycolor() returns it" + ); + assertEquals( + tinycolor("red", { format: "hex" }).toString(), + "#ff0000", + "tinycolor options are being parsed" + ); + assertEquals( + tinycolor.fromRatio({ r: 1, g: 0, b: 0 }, { format: "hex" }).toString(), + "#ff0000", + "tinycolor options are being parsed" + ); + + var obj = { h: 180, s: 0.5, l: 0.5 }; + var color = tinycolor(obj); + assert( + obj.s === 0.5, + "when given an object, the original object is not modified" + ); +}); + +Deno.test("Original input", function () { + var colorRgbUp = "RGB(39, 39, 39)"; + var colorRgbLow = "rgb(39, 39, 39)"; + var colorRgbMix = "RgB(39, 39, 39)"; + var tinycolorObj = tinycolor(colorRgbMix); + var inputObj = { r: 100, g: 100, b: 100 }; + var r = tinycolor("red"); + + assert( + tinycolor(colorRgbLow).getOriginalInput() === colorRgbLow, + "original lowercase input is returned" + ); + assert( + tinycolor(colorRgbUp).getOriginalInput() === colorRgbUp, + "original uppercase input is returned" + ); + assert( + tinycolor(colorRgbMix).getOriginalInput() === colorRgbMix, + "original mixed input is returned" + ); + assert( + tinycolor(tinycolorObj).getOriginalInput() === colorRgbMix, + "when given a tinycolor instance, the color string is returned" + ); + assert( + tinycolor(inputObj).getOriginalInput() === inputObj, + "when given an object, the object is returned" + ); + assert( + new tinycolor("").getOriginalInput() === "", + "when given an empty string, an empty string is returned" + ); + assert( + new tinycolor(null).getOriginalInput() === "", + "when given a null value, an empty string is returned" + ); +}); + +Deno.test("Cloning color", function () { + var originalColor = tinycolor("red"); + var originalColorRgbString = originalColor.toRgbString(); + + var clonedColor = originalColor.clone(); + assert( + clonedColor.toRgbString() === originalColor.toRgbString(), + "cloned color is identical" + ); + + clonedColor.setAlpha(0.5); + assert( + clonedColor.toRgbString() !== originalColor.toRgbString(), + "cloned color is changing independently from original color" + ); + assert( + originalColorRgbString === originalColor.toRgbString(), + "original color was not changed by cloned color change" + ); +}); +Deno.test("Random color", function () { + var randomColor = tinycolor.random(); + assertEquals(randomColor.getAlpha(), 1); + assertEquals(randomColor.getFormat(), "prgb"); + + randomColor.setAlpha(0.5); + assertEquals(randomColor.toHex8String().slice(-2), "80"); +}); + +// Taken from convertWikipediaColors.html +var conversions = [ + { + hex: "#FFFFFF", + hex8: "#FFFFFFFF", + rgb: { r: "100.0%", g: "100.0%", b: "100.0%" }, + hsv: { h: "0", s: "0.000", v: "1.000" }, + hsl: { h: "0", s: "0.000", l: "1.000" }, + }, + { + hex: "#808080", + hex8: "#808080FF", + rgb: { r: "050.0%", g: "050.0%", b: "050.0%" }, + hsv: { h: "0", s: "0.000", v: "0.500" }, + hsl: { h: "0", s: "0.000", l: "0.500" }, + }, + { + hex: "#000000", + hex8: "#000000FF", + rgb: { r: "000.0%", g: "000.0%", b: "000.0%" }, + hsv: { h: "0", s: "0.000", v: "0.000" }, + hsl: { h: "0", s: "0.000", l: "0.000" }, + }, + { + hex: "#FF0000", + hex8: "#FF0000FF", + rgb: { r: "100.0%", g: "000.0%", b: "000.0%" }, + hsv: { h: "0.0", s: "1.000", v: "1.000" }, + hsl: { h: "0.0", s: "1.000", l: "0.500" }, + }, + { + hex: "#BFBF00", + hex8: "#BFBF00FF", + rgb: { r: "075.0%", g: "075.0%", b: "000.0%" }, + hsv: { h: "60.0", s: "1.000", v: "0.750" }, + hsl: { h: "60.0", s: "1.000", l: "0.375" }, + }, + { + hex: "#008000", + hex8: "#008000FF", + rgb: { r: "000.0%", g: "050.0%", b: "000.0%" }, + hsv: { h: "120.0", s: "1.000", v: "0.500" }, + hsl: { h: "120.0", s: "1.000", l: "0.250" }, + }, + { + hex: "#80FFFF", + hex8: "#80FFFFFF", + rgb: { r: "050.0%", g: "100.0%", b: "100.0%" }, + hsv: { h: "180.0", s: "0.500", v: "1.000" }, + hsl: { h: "180.0", s: "1.000", l: "0.750" }, + }, + { + hex: "#8080FF", + hex8: "#8080FFFF", + rgb: { r: "050.0%", g: "050.0%", b: "100.0%" }, + hsv: { h: "240.0", s: "0.500", v: "1.000" }, + hsl: { h: "240.0", s: "1.000", l: "0.750" }, + }, + { + hex: "#BF40BF", + hex8: "#BF40BFFF", + rgb: { r: "075.0%", g: "025.0%", b: "075.0%" }, + hsv: { h: "300.0", s: "0.667", v: "0.750" }, + hsl: { h: "300.0", s: "0.500", l: "0.500" }, + }, + { + hex: "#A0A424", + hex8: "#A0A424FF", + rgb: { r: "062.8%", g: "064.3%", b: "014.2%" }, + hsv: { h: "61.8", s: "0.779", v: "0.643" }, + hsl: { h: "61.8", s: "0.638", l: "0.393" }, + }, + { + hex: "#1EAC41", + hex8: "#1EAC41FF", + rgb: { r: "011.6%", g: "067.5%", b: "025.5%" }, + hsv: { h: "134.9", s: "0.828", v: "0.675" }, + hsl: { h: "134.9", s: "0.707", l: "0.396" }, + }, + { + hex: "#B430E5", + hex8: "#B430E5FF", + rgb: { r: "070.4%", g: "018.7%", b: "089.7%" }, + hsv: { h: "283.7", s: "0.792", v: "0.897" }, + hsl: { h: "283.7", s: "0.775", l: "0.542" }, + }, + { + hex: "#FEF888", + hex8: "#FEF888FF", + rgb: { r: "099.8%", g: "097.4%", b: "053.2%" }, + hsv: { h: "56.9", s: "0.467", v: "0.998" }, + hsl: { h: "56.9", s: "0.991", l: "0.765" }, + }, + { + hex: "#19CB97", + hex8: "#19CB97FF", + rgb: { r: "009.9%", g: "079.5%", b: "059.1%" }, + hsv: { h: "162.4", s: "0.875", v: "0.795" }, + hsl: { h: "162.4", s: "0.779", l: "0.447" }, + }, + { + hex: "#362698", + hex8: "#362698FF", + rgb: { r: "021.1%", g: "014.9%", b: "059.7%" }, + hsv: { h: "248.3", s: "0.750", v: "0.597" }, + hsl: { h: "248.3", s: "0.601", l: "0.373" }, + }, + { + hex: "#7E7EB8", + hex8: "#7E7EB8FF", + rgb: { r: "049.5%", g: "049.3%", b: "072.1%" }, + hsv: { h: "240.5", s: "0.316", v: "0.721" }, + hsl: { h: "240.5", s: "0.290", l: "0.607" }, + }, +]; + +Deno.test("Color Equality", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + + assert(true, tiny.isValid()); + assert( + true, + "Testing " + + c.hex + + ": " + + tiny.toRgbString() + + " " + + tiny.toPercentageRgbString() + + " " + + tiny.toHsvString() + + " " + + tiny.toHslString() + + " " + + tiny.toHexString() + + "Original: " + + JSON.stringify(c.rgb) + + " " + + JSON.stringify(c.hsv) + + " " + + JSON.stringify(c.hsl) + ); + assert(tinycolor.equals(c.rgb, c.hex), "RGB equals hex " + c.hex); + assert(tinycolor.equals(c.rgb, c.hex8), "RGB equals hex " + c.hex); + assert(tinycolor.equals(c.rgb, c.hsl), "RGB equals HSL " + c.hex); + assert(tinycolor.equals(c.rgb, c.hsv), "RGB equals HSV " + c.hex); + assert(tinycolor.equals(c.rgb, c.rgb), "RGB equals RGB " + c.hex); + + assert(tinycolor.equals(c.hex, c.hex), "hex equals hex " + c.hex); + assert(tinycolor.equals(c.hex, c.hex8), "hex equals hex8 " + c.hex); + assert(tinycolor.equals(c.hex, c.hsl), "hex equals HSL " + c.hex); + assert(tinycolor.equals(c.hex, c.hsv), "hex equals HSV " + c.hex); + + assert(tinycolor.equals(c.hsl, c.hsv), "HSL equals HSV " + c.hex); + } +}); + +Deno.test("With Ratio", function () { + assertEquals( + tinycolor.fromRatio({ r: 1, g: 1, b: 1 }).toHexString(), + "#ffffff", + "white" + ); + assertEquals( + tinycolor.fromRatio({ r: 1, g: 0, b: 0, a: 0.5 }).toRgbString(), + "rgba(255, 0, 0, 0.5)", + "alpha works when ratio is parsed" + ); + assertEquals( + tinycolor.fromRatio({ r: 1, g: 0, b: 0, a: 1 }).toRgbString(), + "rgb(255, 0, 0)", + "alpha = 1 works when ratio is parsed" + ); + assertEquals( + tinycolor.fromRatio({ r: 1, g: 0, b: 0, a: 10 }).toRgbString(), + "rgb(255, 0, 0)", + "alpha > 1 works when ratio is parsed" + ); + assertEquals( + tinycolor.fromRatio({ r: 1, g: 0, b: 0, a: -1 }).toRgbString(), + "rgb(255, 0, 0)", + "alpha < 1 works when ratio is parsed" + ); +}); + +Deno.test("Without Ratio", function () { + assertEquals( + tinycolor({ r: 1, g: 1, b: 1 }).toHexString(), + "#010101", + "010101" + ); + assertEquals( + tinycolor({ r: 0.1, g: 0.1, b: 0.1 }).toHexString(), + "#000000", + "000000" + ); + assertEquals(tinycolor("rgb .1 .1 .1").toHexString(), "#000000", "000000"); +}); + +Deno.test("RGB Text Parsing", function () { + assertEquals( + tinycolor("rgb 255 0 0").toHexString(), + "#ff0000", + "spaced input" + ); + assertEquals( + tinycolor("rgb(255, 0, 0)").toHexString(), + "#ff0000", + "parenthesized input" + ); + assertEquals( + tinycolor("rgb (255, 0, 0)").toHexString(), + "#ff0000", + "parenthesized spaced input" + ); + assertEquals( + tinycolor({ r: 255, g: 0, b: 0 }).toHexString(), + "#ff0000", + "object input" + ); + assertEquals( + tinycolor({ r: 255, g: 0, b: 0 }).toRgb(), + { + r: 255, + g: 0, + b: 0, + a: 1, + }, + "object input and compare" + ); + + assert(tinycolor.equals({ r: 200, g: 100, b: 0 }, "rgb(200, 100, 0)")); + assert(tinycolor.equals({ r: 200, g: 100, b: 0 }, "rgb 200 100 0")); + assert(tinycolor.equals({ r: 200, g: 100, b: 0 }, "rgb 200 100 0")); + assert( + tinycolor.equals({ r: 200, g: 100, b: 0, a: 0.4 }, "rgba 200 100 0 .4") + ); + assert(!tinycolor.equals({ r: 199, g: 100, b: 0 }, "rgba 200 100 0 1")); + + assert(!tinycolor.equals({ r: 199, g: 100, b: 0 }, "rgb(200, 100, 0)")); + assert(!tinycolor.equals({ r: 199, g: 100, b: 0 }, "rgb 200 100 0")); + assert(!tinycolor.equals({ r: 199, g: 100, b: 0 }, "rgb 200 100 0")); + + assert( + tinycolor.equals(tinycolor({ r: 200, g: 100, b: 0 }), "rgb(200, 100, 0)") + ); + assert( + tinycolor.equals(tinycolor({ r: 200, g: 100, b: 0 }), "rgb 200 100 0") + ); + assert( + tinycolor.equals(tinycolor({ r: 200, g: 100, b: 0 }), "rgb 200 100 0") + ); +}); + +Deno.test("Percentage RGB Text Parsing", function () { + assertEquals( + tinycolor("rgb 100% 0% 0%").toHexString(), + "#ff0000", + "spaced input" + ); + assertEquals( + tinycolor("rgb(100%, 0%, 0%)").toHexString(), + "#ff0000", + "parenthesized input" + ); + assertEquals( + tinycolor("rgb (100%, 0%, 0%)").toHexString(), + "#ff0000", + "parenthesized spaced input" + ); + assertEquals( + tinycolor({ r: "100%", g: "0%", b: "0%" }).toHexString(), + "#ff0000", + "object input" + ); + assertEquals( + tinycolor({ r: "100%", g: "0%", b: "0%" }).toRgb(), + { + r: 255, + g: 0, + b: 0, + a: 1, + }, + "object input and compare" + ); + + assert( + tinycolor.equals({ r: "90%", g: "45%", b: "0%" }, "rgb(90%, 45%, 0%)") + ); + assert(tinycolor.equals({ r: "90%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); + assert(tinycolor.equals({ r: "90%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); + assert( + tinycolor.equals( + { r: "90%", g: "45%", b: "0%", a: 0.4 }, + "rgba 90% 45% 0% .4" + ) + ); + assert( + !tinycolor.equals({ r: "89%", g: "45%", b: "0%" }, "rgba 90% 45% 0% 1") + ); + + assert( + !tinycolor.equals({ r: "89%", g: "45%", b: "0%" }, "rgb(90%, 45%, 0%)") + ); + assert(!tinycolor.equals({ r: "89%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); + assert(!tinycolor.equals({ r: "89%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); + + assert( + tinycolor.equals( + tinycolor({ r: "90%", g: "45%", b: "0%" }), + "rgb(90%, 45%, 0%)" + ) + ); + assert( + tinycolor.equals( + tinycolor({ r: "90%", g: "45%", b: "0%" }), + "rgb 90% 45% 0%" + ) + ); + assert( + tinycolor.equals( + tinycolor({ r: "90%", g: "45%", b: "0%" }), + "rgb 90% 45% 0%" + ) + ); +}); + +Deno.test("HSL parsing", function () { + assertEquals( + tinycolor({ h: 251, s: 100, l: 0.38 }).toHexString(), + "#2400c2", + "to hex" + ); + assertEquals( + tinycolor({ h: 251, s: 100, l: 0.38 }).toRgbString(), + "rgb(36, 0, 194)", + "to rgb" + ); + assertEquals( + tinycolor({ h: 251, s: 100, l: 0.38 }).toHslString(), + "hsl(251, 100%, 38%)", + "to hsl" + ); + assertEquals( + tinycolor({ h: 251, s: 100, l: 0.38, a: 0.5 }).toHslString(), + "hsla(251, 100%, 38%, 0.5)", + "to hsla" + ); + assertEquals( + tinycolor("hsl(251, 100, 38)").toHexString(), + "#2400c2", + "to hex" + ); + assertEquals( + tinycolor("hsl(251, 100%, 38%)").toRgbString(), + "rgb(36, 0, 194)", + "to rgb" + ); + assertEquals( + tinycolor("hsl(251, 100%, 38%)").toHslString(), + "hsl(251, 100%, 38%)", + "to hsl" + ); + assertEquals( + tinycolor("hsl 100 20 10").toHslString(), + "hsl(100, 20%, 10%)", + "problematic hsl" + ); +}); + +Deno.test("Hex Parsing", function () { + assertEquals(tinycolor("rgb 255 0 0").toHexString(), "#ff0000"); + assertEquals(tinycolor("rgb 255 0 0").toHexString(true), "#f00"); + + assertEquals(tinycolor("rgba 255 0 0 0.5").toHex8String(), "#ff000080"); + assertEquals(tinycolor("rgba 255 0 0 0").toHex8String(), "#ff000000"); + assertEquals(tinycolor("rgba 255 0 0 1").toHex8String(), "#ff0000ff"); + assertEquals(tinycolor("rgba 255 0 0 1").toHex8String(true), "#f00f"); + + assertEquals(tinycolor("rgb 255 0 0").toHex(), "ff0000"); + assertEquals(tinycolor("rgb 255 0 0").toHex(true), "f00"); + assertEquals(tinycolor("rgba 255 0 0 0.5").toHex8(), "ff000080"); +}); + +Deno.test("HSV Parsing", function () { + assertEquals( + tinycolor("hsv 251.1 0.887 .918").toHsvString(), + "hsv(251, 89%, 92%)" + ); + assertEquals( + tinycolor("hsv 251.1 0.887 0.918").toHsvString(), + "hsv(251, 89%, 92%)" + ); + assertEquals( + tinycolor("hsva 251.1 0.887 0.918 0.5").toHsvString(), + "hsva(251, 89%, 92%, 0.5)" + ); +}); + +Deno.test("Invalid Parsing", function () { + var invalidColor = tinycolor("this is not a color"); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor("#red"); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor(" #red"); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor("##123456"); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor(" ##123456"); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor({ r: "invalid", g: "invalid", b: "invalid" }); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor({ h: "invalid", s: "invalid", l: "invalid" }); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor({ h: "invalid", s: "invalid", v: "invalid" }); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); +}); + +Deno.test("Named colors", function () { + assertEquals(tinycolor("aliceblue").toHex(), "f0f8ff"); + assertEquals(tinycolor("antiquewhite").toHex(), "faebd7"); + assertEquals(tinycolor("aqua").toHex(), "00ffff"); + assertEquals(tinycolor("aquamarine").toHex(), "7fffd4"); + assertEquals(tinycolor("azure").toHex(), "f0ffff"); + assertEquals(tinycolor("beige").toHex(), "f5f5dc"); + assertEquals(tinycolor("bisque").toHex(), "ffe4c4"); + assertEquals(tinycolor("black").toHex(), "000000"); + assertEquals(tinycolor("blanchedalmond").toHex(), "ffebcd"); + assertEquals(tinycolor("blue").toHex(), "0000ff"); + assertEquals(tinycolor("blueviolet").toHex(), "8a2be2"); + assertEquals(tinycolor("brown").toHex(), "a52a2a"); + assertEquals(tinycolor("burlywood").toHex(), "deb887"); + assertEquals(tinycolor("cadetblue").toHex(), "5f9ea0"); + assertEquals(tinycolor("chartreuse").toHex(), "7fff00"); + assertEquals(tinycolor("chocolate").toHex(), "d2691e"); + assertEquals(tinycolor("coral").toHex(), "ff7f50"); + assertEquals(tinycolor("cornflowerblue").toHex(), "6495ed"); + assertEquals(tinycolor("cornsilk").toHex(), "fff8dc"); + assertEquals(tinycolor("crimson").toHex(), "dc143c"); + assertEquals(tinycolor("cyan").toHex(), "00ffff"); + assertEquals(tinycolor("darkblue").toHex(), "00008b"); + assertEquals(tinycolor("darkcyan").toHex(), "008b8b"); + assertEquals(tinycolor("darkgoldenrod").toHex(), "b8860b"); + assertEquals(tinycolor("darkgray").toHex(), "a9a9a9"); + assertEquals(tinycolor("darkgreen").toHex(), "006400"); + assertEquals(tinycolor("darkkhaki").toHex(), "bdb76b"); + assertEquals(tinycolor("darkmagenta").toHex(), "8b008b"); + assertEquals(tinycolor("darkolivegreen").toHex(), "556b2f"); + assertEquals(tinycolor("darkorange").toHex(), "ff8c00"); + assertEquals(tinycolor("darkorchid").toHex(), "9932cc"); + assertEquals(tinycolor("darkred").toHex(), "8b0000"); + assertEquals(tinycolor("darksalmon").toHex(), "e9967a"); + assertEquals(tinycolor("darkseagreen").toHex(), "8fbc8f"); + assertEquals(tinycolor("darkslateblue").toHex(), "483d8b"); + assertEquals(tinycolor("darkslategray").toHex(), "2f4f4f"); + assertEquals(tinycolor("darkturquoise").toHex(), "00ced1"); + assertEquals(tinycolor("darkviolet").toHex(), "9400d3"); + assertEquals(tinycolor("deeppink").toHex(), "ff1493"); + assertEquals(tinycolor("deepskyblue").toHex(), "00bfff"); + assertEquals(tinycolor("dimgray").toHex(), "696969"); + assertEquals(tinycolor("dodgerblue").toHex(), "1e90ff"); + assertEquals(tinycolor("firebrick").toHex(), "b22222"); + assertEquals(tinycolor("floralwhite").toHex(), "fffaf0"); + assertEquals(tinycolor("forestgreen").toHex(), "228b22"); + assertEquals(tinycolor("fuchsia").toHex(), "ff00ff"); + assertEquals(tinycolor("gainsboro").toHex(), "dcdcdc"); + assertEquals(tinycolor("ghostwhite").toHex(), "f8f8ff"); + assertEquals(tinycolor("gold").toHex(), "ffd700"); + assertEquals(tinycolor("goldenrod").toHex(), "daa520"); + assertEquals(tinycolor("gray").toHex(), "808080"); + assertEquals(tinycolor("grey").toHex(), "808080"); + assertEquals(tinycolor("green").toHex(), "008000"); + assertEquals(tinycolor("greenyellow").toHex(), "adff2f"); + assertEquals(tinycolor("honeydew").toHex(), "f0fff0"); + assertEquals(tinycolor("hotpink").toHex(), "ff69b4"); + assertEquals(tinycolor("indianred ").toHex(), "cd5c5c"); + assertEquals(tinycolor("indigo ").toHex(), "4b0082"); + assertEquals(tinycolor("ivory").toHex(), "fffff0"); + assertEquals(tinycolor("khaki").toHex(), "f0e68c"); + assertEquals(tinycolor("lavender").toHex(), "e6e6fa"); + assertEquals(tinycolor("lavenderblush").toHex(), "fff0f5"); + assertEquals(tinycolor("lawngreen").toHex(), "7cfc00"); + assertEquals(tinycolor("lemonchiffon").toHex(), "fffacd"); + assertEquals(tinycolor("lightblue").toHex(), "add8e6"); + assertEquals(tinycolor("lightcoral").toHex(), "f08080"); + assertEquals(tinycolor("lightcyan").toHex(), "e0ffff"); + assertEquals(tinycolor("lightgoldenrodyellow").toHex(), "fafad2"); + assertEquals(tinycolor("lightgrey").toHex(), "d3d3d3"); + assertEquals(tinycolor("lightgreen").toHex(), "90ee90"); + assertEquals(tinycolor("lightpink").toHex(), "ffb6c1"); + assertEquals(tinycolor("lightsalmon").toHex(), "ffa07a"); + assertEquals(tinycolor("lightseagreen").toHex(), "20b2aa"); + assertEquals(tinycolor("lightskyblue").toHex(), "87cefa"); + assertEquals(tinycolor("lightslategray").toHex(), "778899"); + assertEquals(tinycolor("lightsteelblue").toHex(), "b0c4de"); + assertEquals(tinycolor("lightyellow").toHex(), "ffffe0"); + assertEquals(tinycolor("lime").toHex(), "00ff00"); + assertEquals(tinycolor("limegreen").toHex(), "32cd32"); + assertEquals(tinycolor("linen").toHex(), "faf0e6"); + assertEquals(tinycolor("magenta").toHex(), "ff00ff"); + assertEquals(tinycolor("maroon").toHex(), "800000"); + assertEquals(tinycolor("mediumaquamarine").toHex(), "66cdaa"); + assertEquals(tinycolor("mediumblue").toHex(), "0000cd"); + assertEquals(tinycolor("mediumorchid").toHex(), "ba55d3"); + assertEquals(tinycolor("mediumpurple").toHex(), "9370db"); + assertEquals(tinycolor("mediumseagreen").toHex(), "3cb371"); + assertEquals(tinycolor("mediumslateblue").toHex(), "7b68ee"); + assertEquals(tinycolor("mediumspringgreen").toHex(), "00fa9a"); + assertEquals(tinycolor("mediumturquoise").toHex(), "48d1cc"); + assertEquals(tinycolor("mediumvioletred").toHex(), "c71585"); + assertEquals(tinycolor("midnightblue").toHex(), "191970"); + assertEquals(tinycolor("mintcream").toHex(), "f5fffa"); + assertEquals(tinycolor("mistyrose").toHex(), "ffe4e1"); + assertEquals(tinycolor("moccasin").toHex(), "ffe4b5"); + assertEquals(tinycolor("navajowhite").toHex(), "ffdead"); + assertEquals(tinycolor("navy").toHex(), "000080"); + assertEquals(tinycolor("oldlace").toHex(), "fdf5e6"); + assertEquals(tinycolor("olive").toHex(), "808000"); + assertEquals(tinycolor("olivedrab").toHex(), "6b8e23"); + assertEquals(tinycolor("orange").toHex(), "ffa500"); + assertEquals(tinycolor("orangered").toHex(), "ff4500"); + assertEquals(tinycolor("orchid").toHex(), "da70d6"); + assertEquals(tinycolor("palegoldenrod").toHex(), "eee8aa"); + assertEquals(tinycolor("palegreen").toHex(), "98fb98"); + assertEquals(tinycolor("paleturquoise").toHex(), "afeeee"); + assertEquals(tinycolor("palevioletred").toHex(), "db7093"); + assertEquals(tinycolor("papayawhip").toHex(), "ffefd5"); + assertEquals(tinycolor("peachpuff").toHex(), "ffdab9"); + assertEquals(tinycolor("peru").toHex(), "cd853f"); + assertEquals(tinycolor("pink").toHex(), "ffc0cb"); + assertEquals(tinycolor("plum").toHex(), "dda0dd"); + assertEquals(tinycolor("powderblue").toHex(), "b0e0e6"); + assertEquals(tinycolor("purple").toHex(), "800080"); + assertEquals(tinycolor("rebeccapurple").toHex(), "663399"); + assertEquals(tinycolor("red").toHex(), "ff0000"); + assertEquals(tinycolor("rosybrown").toHex(), "bc8f8f"); + assertEquals(tinycolor("royalblue").toHex(), "4169e1"); + assertEquals(tinycolor("saddlebrown").toHex(), "8b4513"); + assertEquals(tinycolor("salmon").toHex(), "fa8072"); + assertEquals(tinycolor("sandybrown").toHex(), "f4a460"); + assertEquals(tinycolor("seagreen").toHex(), "2e8b57"); + assertEquals(tinycolor("seashell").toHex(), "fff5ee"); + assertEquals(tinycolor("sienna").toHex(), "a0522d"); + assertEquals(tinycolor("silver").toHex(), "c0c0c0"); + assertEquals(tinycolor("skyblue").toHex(), "87ceeb"); + assertEquals(tinycolor("slateblue").toHex(), "6a5acd"); + assertEquals(tinycolor("slategray").toHex(), "708090"); + assertEquals(tinycolor("snow").toHex(), "fffafa"); + assertEquals(tinycolor("springgreen").toHex(), "00ff7f"); + assertEquals(tinycolor("steelblue").toHex(), "4682b4"); + assertEquals(tinycolor("tan").toHex(), "d2b48c"); + assertEquals(tinycolor("teal").toHex(), "008080"); + assertEquals(tinycolor("thistle").toHex(), "d8bfd8"); + assertEquals(tinycolor("tomato").toHex(), "ff6347"); + assertEquals(tinycolor("turquoise").toHex(), "40e0d0"); + assertEquals(tinycolor("violet").toHex(), "ee82ee"); + assertEquals(tinycolor("wheat").toHex(), "f5deb3"); + assertEquals(tinycolor("white").toHex(), "ffffff"); + assertEquals(tinycolor("whitesmoke").toHex(), "f5f5f5"); + assertEquals(tinycolor("yellow").toHex(), "ffff00"); + assertEquals(tinycolor("yellowgreen").toHex(), "9acd32"); + + assertEquals(tinycolor("#f00").toName(), "red"); + assertEquals(tinycolor("#fa0a0a").toName(), false); +}); + +Deno.test("Invalid alpha should normalize to 1", function () { + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: -1 }).toRgbString(), + "rgb(255, 20, 10)", + "Negative value" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: -0 }).toRgbString(), + "rgba(255, 20, 10, 0)", + "Negative 0" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: 0 }).toRgbString(), + "rgba(255, 20, 10, 0)", + "0" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: 0.5 }).toRgbString(), + "rgba(255, 20, 10, 0.5)", + ".5" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: 1 }).toRgbString(), + "rgb(255, 20, 10)", + "1" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: 100 }).toRgbString(), + "rgb(255, 20, 10)", + "Greater than 1" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: "asdfasd" }).toRgbString(), + "rgb(255, 20, 10)", + "Non Numeric" + ); + + assertEquals( + tinycolor("#fff").toRgbString(), + "rgb(255, 255, 255)", + "Hex should be 1" + ); + assertEquals( + tinycolor("rgba 255 0 0 100").toRgbString(), + "rgb(255, 0, 0)", + "Greater than 1 in string parsing" + ); +}); + +Deno.test("toString() with alpha set", function () { + var redNamed = tinycolor.fromRatio( + { r: 255, g: 0, b: 0, a: 0.6 }, + { + format: "name", + } + ); + var transparentNamed = tinycolor.fromRatio( + { r: 255, g: 0, b: 0, a: 0 }, + { + format: "name", + } + ); + var redHex = tinycolor.fromRatio( + { r: 255, g: 0, b: 0, a: 0.4 }, + { + format: "hex", + } + ); + + assertEquals(redNamed.getFormat(), "name", "getFormat() is correct"); + assertEquals(redHex.getFormat(), "hex", "getFormat() is correct"); + + assertEquals( + redNamed.toString(), + "rgba(255, 0, 0, 0.6)", + "Names should default to rgba if alpha is < 1" + ); + assertEquals( + redHex.toString(), + "rgba(255, 0, 0, 0.4)", + "Hex should default to rgba if alpha is < 1" + ); + + assertEquals( + redNamed.toString("hex"), + "#ff0000", + "Names should not be returned as rgba if format is specified" + ); + assertEquals( + redNamed.toString("hex6"), + "#ff0000", + "Names should not be returned as rgba if format is specified" + ); + assertEquals( + redNamed.toString("hex3"), + "#f00", + "Names should not be returned as rgba if format is specified" + ); + assertEquals( + redNamed.toString("hex8"), + "#ff000099", + "Names should not be returned as rgba if format is specified" + ); + assertEquals( + redNamed.toString("hex4"), + "#f009", + "Names should not be returned as rgba if format is specified" + ); + assertEquals( + redNamed.toString("name"), + "#ff0000", + "Semi transparent names should return hex in toString() if name format is specified" + ); + + assertEquals( + redNamed.toName(), + false, + "Semi transparent names should be false in toName()" + ); + + assertEquals( + redHex.toString(), + "rgba(255, 0, 0, 0.4)", + "Hex should default to rgba if alpha is < 1" + ); + assertEquals( + transparentNamed.toString(), + "transparent", + "Named color should equal transparent if alpha == 0" + ); + + redHex.setAlpha(0); + assertEquals( + redHex.toString(), + "rgba(255, 0, 0, 0)", + "Hex should default to rgba if alpha is = 0" + ); +}); + +Deno.test("setting alpha", function () { + var hexSetter = tinycolor("rgba(255, 0, 0, 1)"); + assertEquals(hexSetter.getAlpha(), 1, "Alpha should start as 1"); + var returnedFromSetAlpha = hexSetter.setAlpha(0.9); + assertEquals( + returnedFromSetAlpha, + hexSetter, + "setAlpha return value should be the color." + ); + assertEquals(hexSetter.getAlpha(), 0.9, "setAlpha should change alpha value"); + hexSetter.setAlpha(0.5); + assertEquals(hexSetter.getAlpha(), 0.5, "setAlpha should change alpha value"); + hexSetter.setAlpha(0); + assertEquals(hexSetter.getAlpha(), 0, "setAlpha should change alpha value"); + hexSetter.setAlpha(-1); + assertEquals( + hexSetter.getAlpha(), + 1, + "setAlpha with value < 0 should be bound to 1" + ); + hexSetter.setAlpha(2); + assertEquals( + hexSetter.getAlpha(), + 1, + "setAlpha with value > 1 should be bound to 1" + ); + hexSetter.setAlpha(); + assertEquals( + hexSetter.getAlpha(), + 1, + "setAlpha with invalid value should be bound to 1" + ); + hexSetter.setAlpha(null); + assertEquals( + hexSetter.getAlpha(), + 1, + "setAlpha with invalid value should be bound to 1" + ); + hexSetter.setAlpha("test"); + assertEquals( + hexSetter.getAlpha(), + 1, + "setAlpha with invalid value should be bound to 1" + ); +}); + +Deno.test("Alpha = 0 should act differently on toName()", function () { + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: 0 }).toName(), + "transparent", + "0" + ); + assertEquals( + tinycolor("transparent").toString(), + "transparent", + "toString when passed" + ); + assertEquals(tinycolor("transparent").toHex(), "000000", "toHex"); +}); + +Deno.test("getBrightness", function () { + assertEquals(tinycolor("#000").getBrightness(), 0, "returns 0 for #000"); + assertEquals(tinycolor("#fff").getBrightness(), 255, "returns 255 for #fff"); +}); + +Deno.test("getLuminance", function () { + assertEquals(tinycolor("#000").getLuminance(), 0, "returns 0 for #000"); + assertEquals(tinycolor("#fff").getLuminance(), 1, "returns 1 for #fff"); +}); + +Deno.test("isDark returns true/false for dark/light colors", function () { + assertEquals(tinycolor("#000").isDark(), true, "#000 is dark"); + assertEquals(tinycolor("#111").isDark(), true, "#111 is dark"); + assertEquals(tinycolor("#222").isDark(), true, "#222 is dark"); + assertEquals(tinycolor("#333").isDark(), true, "#333 is dark"); + assertEquals(tinycolor("#444").isDark(), true, "#444 is dark"); + assertEquals(tinycolor("#555").isDark(), true, "#555 is dark"); + assertEquals(tinycolor("#666").isDark(), true, "#666 is dark"); + assertEquals(tinycolor("#777").isDark(), true, "#777 is dark"); + assertEquals(tinycolor("#888").isDark(), false, "#888 is not dark"); + assertEquals(tinycolor("#999").isDark(), false, "#999 is not dark"); + assertEquals(tinycolor("#aaa").isDark(), false, "#aaa is not dark"); + assertEquals(tinycolor("#bbb").isDark(), false, "#bbb is not dark"); + assertEquals(tinycolor("#ccc").isDark(), false, "#ccc is not dark"); + assertEquals(tinycolor("#ddd").isDark(), false, "#ddd is not dark"); + assertEquals(tinycolor("#eee").isDark(), false, "#eee is not dark"); + assertEquals(tinycolor("#fff").isDark(), false, "#fff is not dark"); +}); + +Deno.test("isLight returns true/false for light/dark colors", function () { + assertEquals(tinycolor("#000").isLight(), false, "#000 is not light"); + assertEquals(tinycolor("#111").isLight(), false, "#111 is not light"); + assertEquals(tinycolor("#222").isLight(), false, "#222 is not light"); + assertEquals(tinycolor("#333").isLight(), false, "#333 is not light"); + assertEquals(tinycolor("#444").isLight(), false, "#444 is not light"); + assertEquals(tinycolor("#555").isLight(), false, "#555 is not light"); + assertEquals(tinycolor("#666").isLight(), false, "#666 is not light"); + assertEquals(tinycolor("#777").isLight(), false, "#777 is not light"); + assertEquals(tinycolor("#888").isLight(), true, "#888 is light"); + assertEquals(tinycolor("#999").isLight(), true, "#999 is light"); + assertEquals(tinycolor("#aaa").isLight(), true, "#aaa is light"); + assertEquals(tinycolor("#bbb").isLight(), true, "#bbb is light"); + assertEquals(tinycolor("#ccc").isLight(), true, "#ccc is light"); + assertEquals(tinycolor("#ddd").isLight(), true, "#ddd is light"); + assertEquals(tinycolor("#eee").isLight(), true, "#eee is light"); + assertEquals(tinycolor("#fff").isLight(), true, "#fff is light"); +}); + +Deno.test("HSL Object", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + assertEquals( + tiny.toHexString(), + tinycolor(tiny.toHsl()).toHexString(), + "HSL Object" + ); + } +}); + +Deno.test("HSL String", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + var input = tiny.toRgb(); + var output = tinycolor(tiny.toHslString()).toRgb(); + var maxDiff = 2; + + assertEquals( + Math.abs(input.r - output.r) <= maxDiff, + true, + "toHslString red value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.g - output.g) <= maxDiff, + true, + "toHslString green value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.b - output.b) <= maxDiff, + true, + "toHslString blue value difference <= " + maxDiff + ); + } +}); + +Deno.test("HSV String", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + var input = tiny.toRgb(); + var output = tinycolor(tiny.toHsvString()).toRgb(); + var maxDiff = 2; + + assertEquals( + Math.abs(input.r - output.r) <= maxDiff, + true, + "toHsvString red value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.g - output.g) <= maxDiff, + true, + "toHsvString green value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.b - output.b) <= maxDiff, + true, + "toHsvString blue value difference <= " + maxDiff + ); + } +}); + +Deno.test("HSV Object", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + assertEquals( + tiny.toHexString(), + tinycolor(tiny.toHsv()).toHexString(), + "HSV Object" + ); + } +}); + +Deno.test("RGB Object", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + assertEquals( + tiny.toHexString(), + tinycolor(tiny.toRgb()).toHexString(), + "RGB Object" + ); + } +}); + +Deno.test("RGB String", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + assertEquals( + tiny.toHexString(), + tinycolor(tiny.toRgbString()).toHexString(), + "RGB String" + ); + } +}); + +Deno.test("PRGB Object", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + var input = tiny.toRgb(); + var output = tinycolor(tiny.toPercentageRgb()).toRgb(); + var maxDiff = 2; + + assertEquals( + Math.abs(input.r - output.r) <= maxDiff, + true, + "Red value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.g - output.g) <= maxDiff, + true, + "Green value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.b - output.b) <= maxDiff, + true, + "Blue value difference <= " + maxDiff + ); + } +}); + +Deno.test("PRGB String", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + var input = tiny.toRgb(); + var output = tinycolor(tiny.toPercentageRgbString()).toRgb(); + var maxDiff = 2; + + assertEquals( + Math.abs(input.r - output.r) <= maxDiff, + true, + "Red value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.g - output.g) <= maxDiff, + true, + "Green value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.b - output.b) <= maxDiff, + true, + "Blue value difference <= " + maxDiff + ); + } +}); + +Deno.test("Object", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + assertEquals(tiny.toHexString(), tinycolor(tiny).toHexString(), "Object"); + } +}); + +Deno.test("Color equality", function () { + assert(tinycolor.equals("#ff0000", "#ff0000"), "Same hex"); + assert(tinycolor.equals("#ff0000", "rgb(255, 0, 0)"), "Same alphas"); + assert( + !tinycolor.equals("#ff0000", "rgba(255, 0, 0, .1)"), + "Different alphas" + ); + assert(tinycolor.equals("#ff000066", "rgba(255, 0, 0, .4)"), "Same alphas"); + assert(tinycolor.equals("#f009", "rgba(255, 0, 0, .6)"), "Same alphas"); + assert(tinycolor.equals("#336699CC", "369C"), "Same hex"); + assert(tinycolor.equals("ff0000", "#ff0000"), "Same hex"); + assert(tinycolor.equals("#f00", "#ff0000"), "Same hex"); + assert(tinycolor.equals("#f00", "#ff0000"), "Same hex"); + assert(tinycolor.equals("f00", "#ff0000"), "Same hex"); + assertEquals(tinycolor("010101").toHexString(), "#010101"); + assert(!tinycolor.equals("#ff0000", "#00ff00"), "Different hex"); + assert( + tinycolor.equals("#ff8000", "rgb(100%, 50%, 0%)"), + "Percentage bounds checking" + ); +}); + +Deno.test("isReadable", function () { + // "#ff0088", "#8822aa" (values used in old WCAG1 tests) + assert( + tinycolor.isReadable("#000000", "#ffffff", { level: "AA", size: "small" }), + "white/black is readable" + ); + assert( + !tinycolor.isReadable("#ff0088", "#5c1a72", {}), + "not readable - empty wcag2 object" + ); + assert( + !tinycolor.isReadable("#ff0088", "#8822aa", { level: "AA", size: "small" }), + "not readable - AA small" + ); + assert( + !tinycolor.isReadable("#ff0088", "#8822aa", { level: "AA", size: "large" }), + "not readable - AA large" + ); + assert( + !tinycolor.isReadable("#ff0088", "#8822aa", { + level: "AAA", + size: "small", + }), + "not readable - AAA small" + ); + assert( + !tinycolor.isReadable("#ff0088", "#8822aa", { + level: "AAA", + size: "large", + }), + "not readable - AAA large" + ); + + // values derived from and validated using the calculators at http://www.dasplankton.de/ContrastA/ + // and http://webaim.org/resources/contrastchecker/ + + // "#ff0088", "#5c1a72": contrast ratio 3.04 + assert( + !tinycolor.isReadable("#ff0088", "#5c1a72", { level: "AA", size: "small" }), + "not readable - AA small" + ); + assert( + tinycolor.isReadable("#ff0088", "#5c1a72", { level: "AA", size: "large" }), + "readable - AA large" + ); + assert( + !tinycolor.isReadable("#ff0088", "#5c1a72", { + level: "AAA", + size: "small", + }), + "not readable - AAA small" + ); + assert( + !tinycolor.isReadable("#ff0088", "#5c1a72", { + level: "AAA", + size: "large", + }), + "not readable - AAA large" + ); + + // "#ff0088", "#2e0c3a": contrast ratio 4.56 + assert( + tinycolor.isReadable("#ff0088", "#2e0c3a", { level: "AA", size: "small" }), + "readable - AA small" + ); + assert( + tinycolor.isReadable("#ff0088", "#2e0c3a", { level: "AA", size: "large" }), + "readable - AA large" + ); + assert( + !tinycolor.isReadable("#ff0088", "#2e0c3a", { + level: "AAA", + size: "small", + }), + "not readable - AAA small" + ); + assert( + tinycolor.isReadable("#ff0088", "#2e0c3a", { level: "AAA", size: "large" }), + "readable - AAA large" + ); + + // "#db91b8", "#2e0c3a": contrast ratio 7.12 + assert( + tinycolor.isReadable("#db91b8", "#2e0c3a", { level: "AA", size: "small" }), + "readable - AA small" + ); + assert( + tinycolor.isReadable("#db91b8", "#2e0c3a", { level: "AA", size: "large" }), + "readable - AA large" + ); + assert( + tinycolor.isReadable("#db91b8", "#2e0c3a", { level: "AAA", size: "small" }), + "readable - AAA small" + ); + assert( + tinycolor.isReadable("#db91b8", "#2e0c3a", { level: "AAA", size: "large" }), + "readable - AAA large" + ); +}); + +Deno.test("readability", function () { + // check return values from readability function. See isReadable above for standards tests. + assertEquals( + tinycolor.readability("#000", "#000"), + 1, + "Readability function test 0" + ); + assertEquals( + tinycolor.readability("#000", "#111"), + 1.1121078324840545, + "Readability function test 1" + ); + assertEquals( + tinycolor.readability("#000", "#fff"), + 21, + "Readability function test 2" + ); +}); + +Deno.test("mostReadable", function () { + assertEquals( + tinycolor + .mostReadable("#000", ["#111", "#222", { wcag2: {} }]) + .toHexString(), + "#222222", + "readable color present" + ); + assertEquals( + tinycolor + .mostReadable("#f00", ["#d00", "#0d0"], { wcag2: {} }) + .toHexString(), + "#00dd00", + "readable color present" + ); + assertEquals( + tinycolor + .mostReadable("#fff", ["#fff", "#fff"], { wcag2: {} }) + .toHexString(), + "#ffffff", + "no different color in list" + ); + //includeFallbackColors + assertEquals( + tinycolor + .mostReadable("#fff", ["#fff", "#fff"], { + includeFallbackColors: true, + }) + .toHexString(), + "#000000", + "no different color in list" + ); + assertEquals( + tinycolor + .mostReadable("#123", ["#124", "#125"], { + includeFallbackColors: false, + }) + .toHexString(), + "#112255", + "no readable color in list" + ); + assertEquals( + tinycolor + .mostReadable("#123", ["#000", "#fff"], { + includeFallbackColors: false, + }) + .toHexString(), + "#ffffff", + "verify assumption" + ); + assertEquals( + tinycolor + .mostReadable("#123", ["#124", "#125"], { + includeFallbackColors: true, + }) + .toHexString(), + "#ffffff", + "no readable color in list" + ); + + assertEquals( + tinycolor + .mostReadable("#ff0088", ["#000", "#fff"], { + includeFallbackColors: false, + }) + .toHexString(), + "#000000", + "verify assumption" + ); + assertEquals( + tinycolor + .mostReadable("#ff0088", ["#2e0c3a"], { + includeFallbackColors: true, + level: "AAA", + size: "large", + }) + .toHexString(), + "#2e0c3a", + "readable color present" + ); + assertEquals( + tinycolor + .mostReadable("#ff0088", ["#2e0c3a"], { + includeFallbackColors: true, + level: "AAA", + size: "small", + }) + .toHexString(), + "#000000", + "no readable color in list" + ); + + assertEquals( + tinycolor + .mostReadable("#371b2c", ["#000", "#fff"], { + includeFallbackColors: false, + }) + .toHexString(), + "#ffffff", + "verify assumption" + ); + assertEquals( + tinycolor + .mostReadable("#371b2c", ["#a9acb6"], { + includeFallbackColors: true, + level: "AAA", + size: "large", + }) + .toHexString(), + "#a9acb6", + "readable color present" + ); + assertEquals( + tinycolor + .mostReadable("#371b2c", ["#a9acb6"], { + includeFallbackColors: true, + level: "AAA", + size: "small", + }) + .toHexString(), + "#ffffff", + "no readable color in list" + ); +}); + +Deno.test("Filters", function () { + assertEquals( + tinycolor("red").toFilter(), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffff0000,endColorstr=#ffff0000)" + ); + assertEquals( + tinycolor("red").toFilter("blue"), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffff0000,endColorstr=#ff0000ff)" + ); + + assertEquals( + tinycolor("transparent").toFilter(), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000,endColorstr=#00000000)" + ); + assertEquals( + tinycolor("transparent").toFilter("red"), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000,endColorstr=#ffff0000)" + ); + + assertEquals( + tinycolor("#f0f0f0dd").toFilter(), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ddf0f0f0,endColorstr=#ddf0f0f0)" + ); + assertEquals( + tinycolor("rgba(0, 0, 255, .5").toFilter(), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#800000ff,endColorstr=#800000ff)" + ); +}); + +/* Originally generated with: +var results = []; +for (var i = 0; i <= 100; i++) results.push( tinycolor.saturate("red", i).toHex() ) +console.log(JSON.stringify(results)) +*/ +var DESATURATIONS = [ + "ff0000", + "fe0101", + "fc0303", + "fb0404", + "fa0505", + "f90606", + "f70808", + "f60909", + "f50a0a", + "f40b0b", + "f20d0d", + "f10e0e", + "f00f0f", + "ee1111", + "ed1212", + "ec1313", + "eb1414", + "e91616", + "e81717", + "e71818", + "e61919", + "e41b1b", + "e31c1c", + "e21d1d", + "e01f1f", + "df2020", + "de2121", + "dd2222", + "db2424", + "da2525", + "d92626", + "d72828", + "d62929", + "d52a2a", + "d42b2b", + "d22d2d", + "d12e2e", + "d02f2f", + "cf3030", + "cd3232", + "cc3333", + "cb3434", + "c93636", + "c83737", + "c73838", + "c63939", + "c43b3b", + "c33c3c", + "c23d3d", + "c13e3e", + "bf4040", + "be4141", + "bd4242", + "bb4444", + "ba4545", + "b94646", + "b84747", + "b64949", + "b54a4a", + "b44b4b", + "b34d4d", + "b14e4e", + "b04f4f", + "af5050", + "ad5252", + "ac5353", + "ab5454", + "aa5555", + "a85757", + "a75858", + "a65959", + "a45b5b", + "a35c5c", + "a25d5d", + "a15e5e", + "9f6060", + "9e6161", + "9d6262", + "9c6363", + "9a6565", + "996666", + "986767", + "966969", + "956a6a", + "946b6b", + "936c6c", + "916e6e", + "906f6f", + "8f7070", + "8e7171", + "8c7373", + "8b7474", + "8a7575", + "887777", + "877878", + "867979", + "857a7a", + "837c7c", + "827d7d", + "817e7e", + "808080", +]; +var SATURATIONS = [ + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", +]; +var LIGHTENS = [ + "ff0000", + "ff0505", + "ff0a0a", + "ff0f0f", + "ff1414", + "ff1a1a", + "ff1f1f", + "ff2424", + "ff2929", + "ff2e2e", + "ff3333", + "ff3838", + "ff3d3d", + "ff4242", + "ff4747", + "ff4d4d", + "ff5252", + "ff5757", + "ff5c5c", + "ff6161", + "ff6666", + "ff6b6b", + "ff7070", + "ff7575", + "ff7a7a", + "ff8080", + "ff8585", + "ff8a8a", + "ff8f8f", + "ff9494", + "ff9999", + "ff9e9e", + "ffa3a3", + "ffa8a8", + "ffadad", + "ffb3b3", + "ffb8b8", + "ffbdbd", + "ffc2c2", + "ffc7c7", + "ffcccc", + "ffd1d1", + "ffd6d6", + "ffdbdb", + "ffe0e0", + "ffe5e5", + "ffebeb", + "fff0f0", + "fff5f5", + "fffafa", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", +]; +var BRIGHTENS = [ + "ff0000", + "ff0303", + "ff0505", + "ff0808", + "ff0a0a", + "ff0d0d", + "ff0f0f", + "ff1212", + "ff1414", + "ff1717", + "ff1919", + "ff1c1c", + "ff1f1f", + "ff2121", + "ff2424", + "ff2626", + "ff2929", + "ff2b2b", + "ff2e2e", + "ff3030", + "ff3333", + "ff3636", + "ff3838", + "ff3b3b", + "ff3d3d", + "ff4040", + "ff4242", + "ff4545", + "ff4747", + "ff4a4a", + "ff4c4c", + "ff4f4f", + "ff5252", + "ff5454", + "ff5757", + "ff5959", + "ff5c5c", + "ff5e5e", + "ff6161", + "ff6363", + "ff6666", + "ff6969", + "ff6b6b", + "ff6e6e", + "ff7070", + "ff7373", + "ff7575", + "ff7878", + "ff7a7a", + "ff7d7d", + "ff7f7f", + "ff8282", + "ff8585", + "ff8787", + "ff8a8a", + "ff8c8c", + "ff8f8f", + "ff9191", + "ff9494", + "ff9696", + "ff9999", + "ff9c9c", + "ff9e9e", + "ffa1a1", + "ffa3a3", + "ffa6a6", + "ffa8a8", + "ffabab", + "ffadad", + "ffb0b0", + "ffb2b2", + "ffb5b5", + "ffb8b8", + "ffbaba", + "ffbdbd", + "ffbfbf", + "ffc2c2", + "ffc4c4", + "ffc7c7", + "ffc9c9", + "ffcccc", + "ffcfcf", + "ffd1d1", + "ffd4d4", + "ffd6d6", + "ffd9d9", + "ffdbdb", + "ffdede", + "ffe0e0", + "ffe3e3", + "ffe5e5", + "ffe8e8", + "ffebeb", + "ffeded", + "fff0f0", + "fff2f2", + "fff5f5", + "fff7f7", + "fffafa", + "fffcfc", + "ffffff", +]; +var DARKENS = [ + "ff0000", + "fa0000", + "f50000", + "f00000", + "eb0000", + "e60000", + "e00000", + "db0000", + "d60000", + "d10000", + "cc0000", + "c70000", + "c20000", + "bd0000", + "b80000", + "b30000", + "ad0000", + "a80000", + "a30000", + "9e0000", + "990000", + "940000", + "8f0000", + "8a0000", + "850000", + "800000", + "7a0000", + "750000", + "700000", + "6b0000", + "660000", + "610000", + "5c0000", + "570000", + "520000", + "4d0000", + "470000", + "420000", + "3d0000", + "380000", + "330000", + "2e0000", + "290000", + "240000", + "1f0000", + "190000", + "140000", + "0f0000", + "0a0000", + "050000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", +]; + +Deno.test("Modifications", function () { + for (var i = 0; i <= 100; i++) { + assertEquals( + tinycolor("red").desaturate(i).toHex(), + DESATURATIONS[i], + "Desaturation " + i + " works" + ); + } + for (var i = 0; i <= 100; i++) { + assertEquals( + tinycolor("red").saturate(i).toHex(), + SATURATIONS[i], + "Saturation " + i + " works" + ); + } + for (var i = 0; i <= 100; i++) { + assertEquals( + tinycolor("red").lighten(i).toHex(), + LIGHTENS[i], + "Lighten " + i + " works" + ); + } + for (var i = 0; i <= 100; i++) { + assertEquals( + tinycolor("red").brighten(i).toHex(), + BRIGHTENS[i], + "Brighter " + i + " works" + ); + } + for (var i = 0; i <= 100; i++) { + assertEquals( + tinycolor("red").darken(i).toHex(), + DARKENS[i], + "Darken " + i + " works" + ); + } + + assertEquals( + tinycolor("red").greyscale().toHex(), + "808080", + "Greyscale works" + ); +}); + +Deno.test("Spin", function () { + assertEquals( + Math.round(tinycolor("#f00").spin(-1234).toHsl().h), + 206, + "Spinning -1234 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(-360).toHsl().h), + 0, + "Spinning -360 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(-120).toHsl().h), + 240, + "Spinning -120 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(0).toHsl().h), + 0, + "Spinning 0 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(10).toHsl().h), + 10, + "Spinning 10 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(360).toHsl().h), + 0, + "Spinning 360 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(2345).toHsl().h), + 185, + "Spinning 2345 works" + ); + + [-360, 0, 360].forEach(function (delta) { + Object.keys(tinycolor.names).forEach(function (name) { + assertEquals( + tinycolor(name).toHex(), + tinycolor(name).spin(delta).toHex(), + "Spinning " + delta.toString() + " has no effect" + ); + }); + }); +}); + +Deno.test("Mix", function () { + // amount 0 or none + assertEquals( + tinycolor.mix("#000", "#fff").toHsl().l, + 0.5, + "Mixing without amount works" + ); + assertEquals( + tinycolor.mix("#f00", "#000", 0).toHex(), + "ff0000", + "Mixing with 0 amount works" + ); + // This case checks the the problem with floating point numbers (eg 255/90) + assertEquals( + tinycolor.mix("#fff", "#000", 90).toHex(), + "1a1a1a", + "Mixing with 90 amount works correctly" + ); + + // black and white + for (var i = 0; i < 100; i++) { + assertEquals( + Math.round(tinycolor.mix("#000", "#fff", i).toHsl().l * 100) / 100, + i / 100, + "Mixing black and white with " + i + " amount works" + ); + } + + // with colors + for (var i = 0; i < 100; i++) { + var new_hex = Math.round((255 * (100 - i)) / 100).toString(16); + + if (new_hex.length === 1) { + new_hex = "0" + new_hex; + } + + assertEquals( + tinycolor.mix("#f00", "#000", i).toHex(), + new_hex + "0000", + "Mixing " + i + " (red channel)" + ); + assertEquals( + tinycolor.mix("#0f0", "#000", i).toHex(), + "00" + new_hex + "00", + "Mixing " + i + " (green channel)" + ); + assertEquals( + tinycolor.mix("#00f", "#000", i).toHex(), + "0000" + new_hex, + "Mixing " + i + " (blue channel)" + ); + assertEquals( + tinycolor.mix(tinycolor("transparent"), "#000", i).toRgb().a, + i / 100, + "Mixing " + i + " (alpha channel)" + ); + } +}); + +// The combination tests need to be expanded furthe + +function colorsToHexString(colors) { + return colors + .map(function (c) { + return c.toHex(); + }) + .join(","); +} + +Deno.test("complement", function () { + var complementDoesntModifyInstance = tinycolor("red"); + assertEquals( + complementDoesntModifyInstance.complement().toHex(), + "00ffff", + "Complement works" + ); + assertEquals( + complementDoesntModifyInstance.toHex(), + "ff0000", + "Complement did not modify this color" + ); +}); + +Deno.test("analogous", function () { + var combination = tinycolor("red").analogous(); + assertEquals( + colorsToHexString(combination), + "ff0000,ff0066,ff0033,ff0000,ff3300,ff6600", + "Correct Combination" + ); +}); + +Deno.test("monochromatic", function () { + var combination = tinycolor("red").monochromatic(); + assertEquals( + colorsToHexString(combination), + "ff0000,2a0000,550000,800000,aa0000,d40000", + "Correct Combination" + ); +}); + +Deno.test("splitcomplement", function () { + var combination = tinycolor("red").splitcomplement(); + assertEquals( + colorsToHexString(combination), + "ff0000,ccff00,0066ff", + "Correct Combination" + ); +}); + +Deno.test("triad", function () { + var combination = tinycolor("red").triad(); + assertEquals( + colorsToHexString(combination), + "ff0000,00ff00,0000ff", + "Correct Combination" + ); +}); + +Deno.test("tetrad", function () { + var combination = tinycolor("red").tetrad(); + assertEquals( + colorsToHexString(combination), + "ff0000,80ff00,00ffff,7f00ff", + "Correct Combination" + ); +}); + +Deno.test({ + name: "polyad", + // Disabled until https://github.com/bgrins/TinyColor/issues/254 + ignore: true, + fn: function () { + assertThrows(() => { + tinycolor("red").polyad(); + }); + assertThrows(() => { + tinycolor("red").polyad(-1); + }); + assertThrows(() => { + tinycolor("red").polyad("invalid"); + }); + assertEquals(colorsToHexString(tinycolor("red").polyad(1)), "ff0000"); + assertEquals(colorsToHexString(tinycolor("red").polyad("1")), "ff0000"); + assertEquals( + colorsToHexString(tinycolor("red").polyad(2)), + "ff0000,00ffff" + ); + assertEquals( + colorsToHexString(tinycolor("red").polyad(3)), + "ff0000,00ff00,0000ff" + ); + assertEquals( + colorsToHexString(tinycolor("red").polyad(4)), + "ff0000,80ff00,00ffff,7f00ff" + ); + assertEquals( + colorsToHexString(tinycolor("red").polyad(5)), + "ff0000,ccff00,00ff66,0066ff,cc00ff" + ); + }, +}); + + runDenoTests(); +})(); diff --git a/project starter code/node_modules/tinycolor2/cjs/test_template.js b/project starter code/node_modules/tinycolor2/cjs/test_template.js new file mode 100644 index 00000000..d170c2cd --- /dev/null +++ b/project starter code/node_modules/tinycolor2/cjs/test_template.js @@ -0,0 +1,26 @@ +// This file is autogenerated. +// Ideally it wouldn't exist, but it's here to test cjs in node +// Changes should go into ./test.js, and if new assertions are needed +// they'll need to be shimmed here as well +const tinycolor = require("./tinycolor.js"); +const { Deno, testDefinitions } = require("@deno/shim-deno-test"); +async function runDenoTests() { + for (const test of testDefinitions) { + if (test.ignore) { + console.log(`Ignoring ${test.name}`); + continue; + } + console.log(`Running ${test.name}`); + await test.fn(); + console.log(`> Passed ${test.name}`); + } +} +(async () => { + const { assertEquals, assert, assertThrows } = await import( + "../deno_asserts@0.168.0.mjs" + ); + + // CONTENT_GOES_HERE + + runDenoTests(); +})(); diff --git a/project starter code/node_modules/tinycolor2/cjs/tinycolor.js b/project starter code/node_modules/tinycolor2/cjs/tinycolor.js new file mode 100644 index 00000000..4f584cab --- /dev/null +++ b/project starter code/node_modules/tinycolor2/cjs/tinycolor.js @@ -0,0 +1,1188 @@ +// This file is autogenerated. It's used to publish CJS to npm. +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.tinycolor = factory()); +})(this, (function () { 'use strict'; + + function _typeof(obj) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, _typeof(obj); + } + + // https://github.com/bgrins/TinyColor + // Brian Grinstead, MIT License + + var trimLeft = /^\s+/; + var trimRight = /\s+$/; + function tinycolor(color, opts) { + color = color ? color : ""; + opts = opts || {}; + + // If input is already a tinycolor, return itself + if (color instanceof tinycolor) { + return color; + } + // If we are called as a function, call using new instead + if (!(this instanceof tinycolor)) { + return new tinycolor(color, opts); + } + var rgb = inputToRGB(color); + this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format; + this._gradientType = opts.gradientType; + + // Don't let the range of [0,255] come back in [0,1]. + // Potentially lose a little bit of precision here, but will fix issues where + // .5 gets interpreted as half of the total, instead of half of 1 + // If it was supposed to be 128, this was already taken care of by `inputToRgb` + if (this._r < 1) this._r = Math.round(this._r); + if (this._g < 1) this._g = Math.round(this._g); + if (this._b < 1) this._b = Math.round(this._b); + this._ok = rgb.ok; + } + tinycolor.prototype = { + isDark: function isDark() { + return this.getBrightness() < 128; + }, + isLight: function isLight() { + return !this.isDark(); + }, + isValid: function isValid() { + return this._ok; + }, + getOriginalInput: function getOriginalInput() { + return this._originalInput; + }, + getFormat: function getFormat() { + return this._format; + }, + getAlpha: function getAlpha() { + return this._a; + }, + getBrightness: function getBrightness() { + //http://www.w3.org/TR/AERT#color-contrast + var rgb = this.toRgb(); + return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000; + }, + getLuminance: function getLuminance() { + //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef + var rgb = this.toRgb(); + var RsRGB, GsRGB, BsRGB, R, G, B; + RsRGB = rgb.r / 255; + GsRGB = rgb.g / 255; + BsRGB = rgb.b / 255; + if (RsRGB <= 0.03928) R = RsRGB / 12.92;else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4); + if (GsRGB <= 0.03928) G = GsRGB / 12.92;else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4); + if (BsRGB <= 0.03928) B = BsRGB / 12.92;else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4); + return 0.2126 * R + 0.7152 * G + 0.0722 * B; + }, + setAlpha: function setAlpha(value) { + this._a = boundAlpha(value); + this._roundA = Math.round(100 * this._a) / 100; + return this; + }, + toHsv: function toHsv() { + var hsv = rgbToHsv(this._r, this._g, this._b); + return { + h: hsv.h * 360, + s: hsv.s, + v: hsv.v, + a: this._a + }; + }, + toHsvString: function toHsvString() { + var hsv = rgbToHsv(this._r, this._g, this._b); + var h = Math.round(hsv.h * 360), + s = Math.round(hsv.s * 100), + v = Math.round(hsv.v * 100); + return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")"; + }, + toHsl: function toHsl() { + var hsl = rgbToHsl(this._r, this._g, this._b); + return { + h: hsl.h * 360, + s: hsl.s, + l: hsl.l, + a: this._a + }; + }, + toHslString: function toHslString() { + var hsl = rgbToHsl(this._r, this._g, this._b); + var h = Math.round(hsl.h * 360), + s = Math.round(hsl.s * 100), + l = Math.round(hsl.l * 100); + return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")"; + }, + toHex: function toHex(allow3Char) { + return rgbToHex(this._r, this._g, this._b, allow3Char); + }, + toHexString: function toHexString(allow3Char) { + return "#" + this.toHex(allow3Char); + }, + toHex8: function toHex8(allow4Char) { + return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char); + }, + toHex8String: function toHex8String(allow4Char) { + return "#" + this.toHex8(allow4Char); + }, + toRgb: function toRgb() { + return { + r: Math.round(this._r), + g: Math.round(this._g), + b: Math.round(this._b), + a: this._a + }; + }, + toRgbString: function toRgbString() { + return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")"; + }, + toPercentageRgb: function toPercentageRgb() { + return { + r: Math.round(bound01(this._r, 255) * 100) + "%", + g: Math.round(bound01(this._g, 255) * 100) + "%", + b: Math.round(bound01(this._b, 255) * 100) + "%", + a: this._a + }; + }, + toPercentageRgbString: function toPercentageRgbString() { + return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")"; + }, + toName: function toName() { + if (this._a === 0) { + return "transparent"; + } + if (this._a < 1) { + return false; + } + return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false; + }, + toFilter: function toFilter(secondColor) { + var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a); + var secondHex8String = hex8String; + var gradientType = this._gradientType ? "GradientType = 1, " : ""; + if (secondColor) { + var s = tinycolor(secondColor); + secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a); + } + return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")"; + }, + toString: function toString(format) { + var formatSet = !!format; + format = format || this._format; + var formattedString = false; + var hasAlpha = this._a < 1 && this._a >= 0; + var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name"); + if (needsAlphaFormat) { + // Special case for "transparent", all other non-alpha formats + // will return rgba when there is transparency. + if (format === "name" && this._a === 0) { + return this.toName(); + } + return this.toRgbString(); + } + if (format === "rgb") { + formattedString = this.toRgbString(); + } + if (format === "prgb") { + formattedString = this.toPercentageRgbString(); + } + if (format === "hex" || format === "hex6") { + formattedString = this.toHexString(); + } + if (format === "hex3") { + formattedString = this.toHexString(true); + } + if (format === "hex4") { + formattedString = this.toHex8String(true); + } + if (format === "hex8") { + formattedString = this.toHex8String(); + } + if (format === "name") { + formattedString = this.toName(); + } + if (format === "hsl") { + formattedString = this.toHslString(); + } + if (format === "hsv") { + formattedString = this.toHsvString(); + } + return formattedString || this.toHexString(); + }, + clone: function clone() { + return tinycolor(this.toString()); + }, + _applyModification: function _applyModification(fn, args) { + var color = fn.apply(null, [this].concat([].slice.call(args))); + this._r = color._r; + this._g = color._g; + this._b = color._b; + this.setAlpha(color._a); + return this; + }, + lighten: function lighten() { + return this._applyModification(_lighten, arguments); + }, + brighten: function brighten() { + return this._applyModification(_brighten, arguments); + }, + darken: function darken() { + return this._applyModification(_darken, arguments); + }, + desaturate: function desaturate() { + return this._applyModification(_desaturate, arguments); + }, + saturate: function saturate() { + return this._applyModification(_saturate, arguments); + }, + greyscale: function greyscale() { + return this._applyModification(_greyscale, arguments); + }, + spin: function spin() { + return this._applyModification(_spin, arguments); + }, + _applyCombination: function _applyCombination(fn, args) { + return fn.apply(null, [this].concat([].slice.call(args))); + }, + analogous: function analogous() { + return this._applyCombination(_analogous, arguments); + }, + complement: function complement() { + return this._applyCombination(_complement, arguments); + }, + monochromatic: function monochromatic() { + return this._applyCombination(_monochromatic, arguments); + }, + splitcomplement: function splitcomplement() { + return this._applyCombination(_splitcomplement, arguments); + }, + // Disabled until https://github.com/bgrins/TinyColor/issues/254 + // polyad: function (number) { + // return this._applyCombination(polyad, [number]); + // }, + triad: function triad() { + return this._applyCombination(polyad, [3]); + }, + tetrad: function tetrad() { + return this._applyCombination(polyad, [4]); + } + }; + + // If input is an object, force 1 into "1.0" to handle ratios properly + // String input requires "1.0" as input, so 1 will be treated as 1 + tinycolor.fromRatio = function (color, opts) { + if (_typeof(color) == "object") { + var newColor = {}; + for (var i in color) { + if (color.hasOwnProperty(i)) { + if (i === "a") { + newColor[i] = color[i]; + } else { + newColor[i] = convertToPercentage(color[i]); + } + } + } + color = newColor; + } + return tinycolor(color, opts); + }; + + // Given a string or object, convert that input to RGB + // Possible string inputs: + // + // "red" + // "#f00" or "f00" + // "#ff0000" or "ff0000" + // "#ff000000" or "ff000000" + // "rgb 255 0 0" or "rgb (255, 0, 0)" + // "rgb 1.0 0 0" or "rgb (1, 0, 0)" + // "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" + // "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" + // "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" + // "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" + // "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" + // + function inputToRGB(color) { + var rgb = { + r: 0, + g: 0, + b: 0 + }; + var a = 1; + var s = null; + var v = null; + var l = null; + var ok = false; + var format = false; + if (typeof color == "string") { + color = stringInputToObject(color); + } + if (_typeof(color) == "object") { + if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { + rgb = rgbToRgb(color.r, color.g, color.b); + ok = true; + format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; + } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { + s = convertToPercentage(color.s); + v = convertToPercentage(color.v); + rgb = hsvToRgb(color.h, s, v); + ok = true; + format = "hsv"; + } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { + s = convertToPercentage(color.s); + l = convertToPercentage(color.l); + rgb = hslToRgb(color.h, s, l); + ok = true; + format = "hsl"; + } + if (color.hasOwnProperty("a")) { + a = color.a; + } + } + a = boundAlpha(a); + return { + ok: ok, + format: color.format || format, + r: Math.min(255, Math.max(rgb.r, 0)), + g: Math.min(255, Math.max(rgb.g, 0)), + b: Math.min(255, Math.max(rgb.b, 0)), + a: a + }; + } + + // Conversion Functions + // -------------------- + + // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: + // + + // `rgbToRgb` + // Handle bounds / percentage checking to conform to CSS color spec + // + // *Assumes:* r, g, b in [0, 255] or [0, 1] + // *Returns:* { r, g, b } in [0, 255] + function rgbToRgb(r, g, b) { + return { + r: bound01(r, 255) * 255, + g: bound01(g, 255) * 255, + b: bound01(b, 255) * 255 + }; + } + + // `rgbToHsl` + // Converts an RGB color value to HSL. + // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] + // *Returns:* { h, s, l } in [0,1] + function rgbToHsl(r, g, b) { + r = bound01(r, 255); + g = bound01(g, 255); + b = bound01(b, 255); + var max = Math.max(r, g, b), + min = Math.min(r, g, b); + var h, + s, + l = (max + min) / 2; + if (max == min) { + h = s = 0; // achromatic + } else { + var d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + switch (max) { + case r: + h = (g - b) / d + (g < b ? 6 : 0); + break; + case g: + h = (b - r) / d + 2; + break; + case b: + h = (r - g) / d + 4; + break; + } + h /= 6; + } + return { + h: h, + s: s, + l: l + }; + } + + // `hslToRgb` + // Converts an HSL color value to RGB. + // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] + // *Returns:* { r, g, b } in the set [0, 255] + function hslToRgb(h, s, l) { + var r, g, b; + h = bound01(h, 360); + s = bound01(s, 100); + l = bound01(l, 100); + function hue2rgb(p, q, t) { + if (t < 0) t += 1; + if (t > 1) t -= 1; + if (t < 1 / 6) return p + (q - p) * 6 * t; + if (t < 1 / 2) return q; + if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; + return p; + } + if (s === 0) { + r = g = b = l; // achromatic + } else { + var q = l < 0.5 ? l * (1 + s) : l + s - l * s; + var p = 2 * l - q; + r = hue2rgb(p, q, h + 1 / 3); + g = hue2rgb(p, q, h); + b = hue2rgb(p, q, h - 1 / 3); + } + return { + r: r * 255, + g: g * 255, + b: b * 255 + }; + } + + // `rgbToHsv` + // Converts an RGB color value to HSV + // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] + // *Returns:* { h, s, v } in [0,1] + function rgbToHsv(r, g, b) { + r = bound01(r, 255); + g = bound01(g, 255); + b = bound01(b, 255); + var max = Math.max(r, g, b), + min = Math.min(r, g, b); + var h, + s, + v = max; + var d = max - min; + s = max === 0 ? 0 : d / max; + if (max == min) { + h = 0; // achromatic + } else { + switch (max) { + case r: + h = (g - b) / d + (g < b ? 6 : 0); + break; + case g: + h = (b - r) / d + 2; + break; + case b: + h = (r - g) / d + 4; + break; + } + h /= 6; + } + return { + h: h, + s: s, + v: v + }; + } + + // `hsvToRgb` + // Converts an HSV color value to RGB. + // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] + // *Returns:* { r, g, b } in the set [0, 255] + function hsvToRgb(h, s, v) { + h = bound01(h, 360) * 6; + s = bound01(s, 100); + v = bound01(v, 100); + var i = Math.floor(h), + f = h - i, + p = v * (1 - s), + q = v * (1 - f * s), + t = v * (1 - (1 - f) * s), + mod = i % 6, + r = [v, q, p, p, t, v][mod], + g = [t, v, v, q, p, p][mod], + b = [p, p, t, v, v, q][mod]; + return { + r: r * 255, + g: g * 255, + b: b * 255 + }; + } + + // `rgbToHex` + // Converts an RGB color to hex + // Assumes r, g, and b are contained in the set [0, 255] + // Returns a 3 or 6 character hex + function rgbToHex(r, g, b, allow3Char) { + var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))]; + + // Return a 3 character hex if possible + if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) { + return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); + } + return hex.join(""); + } + + // `rgbaToHex` + // Converts an RGBA color plus alpha transparency to hex + // Assumes r, g, b are contained in the set [0, 255] and + // a in [0, 1]. Returns a 4 or 8 character rgba hex + function rgbaToHex(r, g, b, a, allow4Char) { + var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))]; + + // Return a 4 character hex if possible + if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) { + return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0); + } + return hex.join(""); + } + + // `rgbaToArgbHex` + // Converts an RGBA color to an ARGB Hex8 string + // Rarely used, but required for "toFilter()" + function rgbaToArgbHex(r, g, b, a) { + var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))]; + return hex.join(""); + } + + // `equals` + // Can be called with any tinycolor input + tinycolor.equals = function (color1, color2) { + if (!color1 || !color2) return false; + return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); + }; + tinycolor.random = function () { + return tinycolor.fromRatio({ + r: Math.random(), + g: Math.random(), + b: Math.random() + }); + }; + + // Modification Functions + // ---------------------- + // Thanks to less.js for some of the basics here + // + + function _desaturate(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.s -= amount / 100; + hsl.s = clamp01(hsl.s); + return tinycolor(hsl); + } + function _saturate(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.s += amount / 100; + hsl.s = clamp01(hsl.s); + return tinycolor(hsl); + } + function _greyscale(color) { + return tinycolor(color).desaturate(100); + } + function _lighten(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.l += amount / 100; + hsl.l = clamp01(hsl.l); + return tinycolor(hsl); + } + function _brighten(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var rgb = tinycolor(color).toRgb(); + rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100)))); + rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100)))); + rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100)))); + return tinycolor(rgb); + } + function _darken(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.l -= amount / 100; + hsl.l = clamp01(hsl.l); + return tinycolor(hsl); + } + + // Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. + // Values outside of this range will be wrapped into this range. + function _spin(color, amount) { + var hsl = tinycolor(color).toHsl(); + var hue = (hsl.h + amount) % 360; + hsl.h = hue < 0 ? 360 + hue : hue; + return tinycolor(hsl); + } + + // Combination Functions + // --------------------- + // Thanks to jQuery xColor for some of the ideas behind these + // + + function _complement(color) { + var hsl = tinycolor(color).toHsl(); + hsl.h = (hsl.h + 180) % 360; + return tinycolor(hsl); + } + function polyad(color, number) { + if (isNaN(number) || number <= 0) { + throw new Error("Argument to polyad must be a positive number"); + } + var hsl = tinycolor(color).toHsl(); + var result = [tinycolor(color)]; + var step = 360 / number; + for (var i = 1; i < number; i++) { + result.push(tinycolor({ + h: (hsl.h + i * step) % 360, + s: hsl.s, + l: hsl.l + })); + } + return result; + } + function _splitcomplement(color) { + var hsl = tinycolor(color).toHsl(); + var h = hsl.h; + return [tinycolor(color), tinycolor({ + h: (h + 72) % 360, + s: hsl.s, + l: hsl.l + }), tinycolor({ + h: (h + 216) % 360, + s: hsl.s, + l: hsl.l + })]; + } + function _analogous(color, results, slices) { + results = results || 6; + slices = slices || 30; + var hsl = tinycolor(color).toHsl(); + var part = 360 / slices; + var ret = [tinycolor(color)]; + for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) { + hsl.h = (hsl.h + part) % 360; + ret.push(tinycolor(hsl)); + } + return ret; + } + function _monochromatic(color, results) { + results = results || 6; + var hsv = tinycolor(color).toHsv(); + var h = hsv.h, + s = hsv.s, + v = hsv.v; + var ret = []; + var modification = 1 / results; + while (results--) { + ret.push(tinycolor({ + h: h, + s: s, + v: v + })); + v = (v + modification) % 1; + } + return ret; + } + + // Utility Functions + // --------------------- + + tinycolor.mix = function (color1, color2, amount) { + amount = amount === 0 ? 0 : amount || 50; + var rgb1 = tinycolor(color1).toRgb(); + var rgb2 = tinycolor(color2).toRgb(); + var p = amount / 100; + var rgba = { + r: (rgb2.r - rgb1.r) * p + rgb1.r, + g: (rgb2.g - rgb1.g) * p + rgb1.g, + b: (rgb2.b - rgb1.b) * p + rgb1.b, + a: (rgb2.a - rgb1.a) * p + rgb1.a + }; + return tinycolor(rgba); + }; + + // Readability Functions + // --------------------- + // false + // tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false + tinycolor.isReadable = function (color1, color2, wcag2) { + var readability = tinycolor.readability(color1, color2); + var wcag2Parms, out; + out = false; + wcag2Parms = validateWCAG2Parms(wcag2); + switch (wcag2Parms.level + wcag2Parms.size) { + case "AAsmall": + case "AAAlarge": + out = readability >= 4.5; + break; + case "AAlarge": + out = readability >= 3; + break; + case "AAAsmall": + out = readability >= 7; + break; + } + return out; + }; + + // `mostReadable` + // Given a base color and a list of possible foreground or background + // colors for that base, returns the most readable color. + // Optionally returns Black or White if the most readable color is unreadable. + // *Example* + // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" + // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" + // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3" + // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff" + tinycolor.mostReadable = function (baseColor, colorList, args) { + var bestColor = null; + var bestScore = 0; + var readability; + var includeFallbackColors, level, size; + args = args || {}; + includeFallbackColors = args.includeFallbackColors; + level = args.level; + size = args.size; + for (var i = 0; i < colorList.length; i++) { + readability = tinycolor.readability(baseColor, colorList[i]); + if (readability > bestScore) { + bestScore = readability; + bestColor = tinycolor(colorList[i]); + } + } + if (tinycolor.isReadable(baseColor, bestColor, { + level: level, + size: size + }) || !includeFallbackColors) { + return bestColor; + } else { + args.includeFallbackColors = false; + return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args); + } + }; + + // Big List of Colors + // ------------------ + // + var names = tinycolor.names = { + aliceblue: "f0f8ff", + antiquewhite: "faebd7", + aqua: "0ff", + aquamarine: "7fffd4", + azure: "f0ffff", + beige: "f5f5dc", + bisque: "ffe4c4", + black: "000", + blanchedalmond: "ffebcd", + blue: "00f", + blueviolet: "8a2be2", + brown: "a52a2a", + burlywood: "deb887", + burntsienna: "ea7e5d", + cadetblue: "5f9ea0", + chartreuse: "7fff00", + chocolate: "d2691e", + coral: "ff7f50", + cornflowerblue: "6495ed", + cornsilk: "fff8dc", + crimson: "dc143c", + cyan: "0ff", + darkblue: "00008b", + darkcyan: "008b8b", + darkgoldenrod: "b8860b", + darkgray: "a9a9a9", + darkgreen: "006400", + darkgrey: "a9a9a9", + darkkhaki: "bdb76b", + darkmagenta: "8b008b", + darkolivegreen: "556b2f", + darkorange: "ff8c00", + darkorchid: "9932cc", + darkred: "8b0000", + darksalmon: "e9967a", + darkseagreen: "8fbc8f", + darkslateblue: "483d8b", + darkslategray: "2f4f4f", + darkslategrey: "2f4f4f", + darkturquoise: "00ced1", + darkviolet: "9400d3", + deeppink: "ff1493", + deepskyblue: "00bfff", + dimgray: "696969", + dimgrey: "696969", + dodgerblue: "1e90ff", + firebrick: "b22222", + floralwhite: "fffaf0", + forestgreen: "228b22", + fuchsia: "f0f", + gainsboro: "dcdcdc", + ghostwhite: "f8f8ff", + gold: "ffd700", + goldenrod: "daa520", + gray: "808080", + green: "008000", + greenyellow: "adff2f", + grey: "808080", + honeydew: "f0fff0", + hotpink: "ff69b4", + indianred: "cd5c5c", + indigo: "4b0082", + ivory: "fffff0", + khaki: "f0e68c", + lavender: "e6e6fa", + lavenderblush: "fff0f5", + lawngreen: "7cfc00", + lemonchiffon: "fffacd", + lightblue: "add8e6", + lightcoral: "f08080", + lightcyan: "e0ffff", + lightgoldenrodyellow: "fafad2", + lightgray: "d3d3d3", + lightgreen: "90ee90", + lightgrey: "d3d3d3", + lightpink: "ffb6c1", + lightsalmon: "ffa07a", + lightseagreen: "20b2aa", + lightskyblue: "87cefa", + lightslategray: "789", + lightslategrey: "789", + lightsteelblue: "b0c4de", + lightyellow: "ffffe0", + lime: "0f0", + limegreen: "32cd32", + linen: "faf0e6", + magenta: "f0f", + maroon: "800000", + mediumaquamarine: "66cdaa", + mediumblue: "0000cd", + mediumorchid: "ba55d3", + mediumpurple: "9370db", + mediumseagreen: "3cb371", + mediumslateblue: "7b68ee", + mediumspringgreen: "00fa9a", + mediumturquoise: "48d1cc", + mediumvioletred: "c71585", + midnightblue: "191970", + mintcream: "f5fffa", + mistyrose: "ffe4e1", + moccasin: "ffe4b5", + navajowhite: "ffdead", + navy: "000080", + oldlace: "fdf5e6", + olive: "808000", + olivedrab: "6b8e23", + orange: "ffa500", + orangered: "ff4500", + orchid: "da70d6", + palegoldenrod: "eee8aa", + palegreen: "98fb98", + paleturquoise: "afeeee", + palevioletred: "db7093", + papayawhip: "ffefd5", + peachpuff: "ffdab9", + peru: "cd853f", + pink: "ffc0cb", + plum: "dda0dd", + powderblue: "b0e0e6", + purple: "800080", + rebeccapurple: "663399", + red: "f00", + rosybrown: "bc8f8f", + royalblue: "4169e1", + saddlebrown: "8b4513", + salmon: "fa8072", + sandybrown: "f4a460", + seagreen: "2e8b57", + seashell: "fff5ee", + sienna: "a0522d", + silver: "c0c0c0", + skyblue: "87ceeb", + slateblue: "6a5acd", + slategray: "708090", + slategrey: "708090", + snow: "fffafa", + springgreen: "00ff7f", + steelblue: "4682b4", + tan: "d2b48c", + teal: "008080", + thistle: "d8bfd8", + tomato: "ff6347", + turquoise: "40e0d0", + violet: "ee82ee", + wheat: "f5deb3", + white: "fff", + whitesmoke: "f5f5f5", + yellow: "ff0", + yellowgreen: "9acd32" + }; + + // Make it easy to access colors via `hexNames[hex]` + var hexNames = tinycolor.hexNames = flip(names); + + // Utilities + // --------- + + // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }` + function flip(o) { + var flipped = {}; + for (var i in o) { + if (o.hasOwnProperty(i)) { + flipped[o[i]] = i; + } + } + return flipped; + } + + // Return a valid alpha value [0,1] with all invalid values being set to 1 + function boundAlpha(a) { + a = parseFloat(a); + if (isNaN(a) || a < 0 || a > 1) { + a = 1; + } + return a; + } + + // Take input from [0, n] and return it as [0, 1] + function bound01(n, max) { + if (isOnePointZero(n)) n = "100%"; + var processPercent = isPercentage(n); + n = Math.min(max, Math.max(0, parseFloat(n))); + + // Automatically convert percentage into number + if (processPercent) { + n = parseInt(n * max, 10) / 100; + } + + // Handle floating point rounding errors + if (Math.abs(n - max) < 0.000001) { + return 1; + } + + // Convert into [0, 1] range if it isn't already + return n % max / parseFloat(max); + } + + // Force a number between 0 and 1 + function clamp01(val) { + return Math.min(1, Math.max(0, val)); + } + + // Parse a base-16 hex value into a base-10 integer + function parseIntFromHex(val) { + return parseInt(val, 16); + } + + // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 + // + function isOnePointZero(n) { + return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1; + } + + // Check to see if string passed in is a percentage + function isPercentage(n) { + return typeof n === "string" && n.indexOf("%") != -1; + } + + // Force a hex value to have 2 characters + function pad2(c) { + return c.length == 1 ? "0" + c : "" + c; + } + + // Replace a decimal with it's percentage value + function convertToPercentage(n) { + if (n <= 1) { + n = n * 100 + "%"; + } + return n; + } + + // Converts a decimal to a hex value + function convertDecimalToHex(d) { + return Math.round(parseFloat(d) * 255).toString(16); + } + // Converts a hex value to a decimal + function convertHexToDecimal(h) { + return parseIntFromHex(h) / 255; + } + var matchers = function () { + // + var CSS_INTEGER = "[-\\+]?\\d+%?"; + + // + var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; + + // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome. + var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; + + // Actual matching. + // Parentheses and commas are optional, but not required. + // Whitespace can take the place of commas or opening paren + var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; + var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; + return { + CSS_UNIT: new RegExp(CSS_UNIT), + rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), + rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), + hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), + hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), + hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), + hsva: new RegExp("hsva" + PERMISSIVE_MATCH4), + hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, + hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, + hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, + hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ + }; + }(); + + // `isValidCSSUnit` + // Take in a single string / number and check to see if it looks like a CSS unit + // (see `matchers` above for definition). + function isValidCSSUnit(color) { + return !!matchers.CSS_UNIT.exec(color); + } + + // `stringInputToObject` + // Permissive string parsing. Take in a number of formats, and output an object + // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` + function stringInputToObject(color) { + color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase(); + var named = false; + if (names[color]) { + color = names[color]; + named = true; + } else if (color == "transparent") { + return { + r: 0, + g: 0, + b: 0, + a: 0, + format: "name" + }; + } + + // Try to match string input using regular expressions. + // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] + // Just return an object and let the conversion functions handle that. + // This way the result will be the same whether the tinycolor is initialized with string or object. + var match; + if (match = matchers.rgb.exec(color)) { + return { + r: match[1], + g: match[2], + b: match[3] + }; + } + if (match = matchers.rgba.exec(color)) { + return { + r: match[1], + g: match[2], + b: match[3], + a: match[4] + }; + } + if (match = matchers.hsl.exec(color)) { + return { + h: match[1], + s: match[2], + l: match[3] + }; + } + if (match = matchers.hsla.exec(color)) { + return { + h: match[1], + s: match[2], + l: match[3], + a: match[4] + }; + } + if (match = matchers.hsv.exec(color)) { + return { + h: match[1], + s: match[2], + v: match[3] + }; + } + if (match = matchers.hsva.exec(color)) { + return { + h: match[1], + s: match[2], + v: match[3], + a: match[4] + }; + } + if (match = matchers.hex8.exec(color)) { + return { + r: parseIntFromHex(match[1]), + g: parseIntFromHex(match[2]), + b: parseIntFromHex(match[3]), + a: convertHexToDecimal(match[4]), + format: named ? "name" : "hex8" + }; + } + if (match = matchers.hex6.exec(color)) { + return { + r: parseIntFromHex(match[1]), + g: parseIntFromHex(match[2]), + b: parseIntFromHex(match[3]), + format: named ? "name" : "hex" + }; + } + if (match = matchers.hex4.exec(color)) { + return { + r: parseIntFromHex(match[1] + "" + match[1]), + g: parseIntFromHex(match[2] + "" + match[2]), + b: parseIntFromHex(match[3] + "" + match[3]), + a: convertHexToDecimal(match[4] + "" + match[4]), + format: named ? "name" : "hex8" + }; + } + if (match = matchers.hex3.exec(color)) { + return { + r: parseIntFromHex(match[1] + "" + match[1]), + g: parseIntFromHex(match[2] + "" + match[2]), + b: parseIntFromHex(match[3] + "" + match[3]), + format: named ? "name" : "hex" + }; + } + return false; + } + function validateWCAG2Parms(parms) { + // return valid WCAG2 parms for isReadable. + // If input parms are invalid, return {"level":"AA", "size":"small"} + var level, size; + parms = parms || { + level: "AA", + size: "small" + }; + level = (parms.level || "AA").toUpperCase(); + size = (parms.size || "small").toLowerCase(); + if (level !== "AA" && level !== "AAA") { + level = "AA"; + } + if (size !== "small" && size !== "large") { + size = "small"; + } + return { + level: level, + size: size + }; + } + + return tinycolor; + +})); diff --git a/project starter code/node_modules/tinycolor2/demo/demo.css b/project starter code/node_modules/tinycolor2/demo/demo.css deleted file mode 100644 index 3565ad1b..00000000 --- a/project starter code/node_modules/tinycolor2/demo/demo.css +++ /dev/null @@ -1,23 +0,0 @@ - -html { font-size: 100%; overflow-y: scroll; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; } -body { font-size: 15px; line-height: 1.231; margin: 4px; background-color: #FCFFFD; } -body, button, input, select, textarea { font-family: Droid Sans, Verdana, sans-serif; color: #222; } -a { color: #33f; } -table th { width: 200px; text-align: right; padding-right:10px; font-family: Georgia serif;} -#container { width: 90%; margin:0 auto; } -#code-output { border: solid 5px #333; margin:15px; border-top-width: 40px; } -#color { width: 200px; height: 2em;} -#inputter a { padding:3px; } -.invisible { visibility: hidden; } -h1 { font-size: 3.8em; color: #293c11; font-family:Tahoma; margin: 3px 0; padding:0; } -h1 .small { font-size: 0.4em; } -h1 a { text-decoration: none } -h2 { font-size: 1.5em; color: #293c11; margin: 0;margin-left: 10px; } -h3 { color: #293c11; } -.description { font-size: 1.2em; margin-bottom: 30px; margin-top: 30px; font-style: italic;} -.download { float: right; } -pre { background: #000; color: #fff; padding: 15px;} -hr { border: 0; width: 80%; border-bottom: 1px solid #aaa} -.footer { text-align:center; padding-top:30px; font-style: italic; } - -#filter-output div, #combine-output span { width: 40px; height: 40px; display:inline-block; margin: 10px; } \ No newline at end of file diff --git a/project starter code/node_modules/tinycolor2/deno_asserts@0.168.0.mjs b/project starter code/node_modules/tinycolor2/deno_asserts@0.168.0.mjs new file mode 100644 index 00000000..685fdd20 --- /dev/null +++ b/project starter code/node_modules/tinycolor2/deno_asserts@0.168.0.mjs @@ -0,0 +1,807 @@ +// deno-fmt-ignore-file +// deno-lint-ignore-file +// This code was bundled using `deno bundle` and it's not recommended to edit it manually +// Using `deno bundle https://deno.land/std@0.168.0/testing/asserts.ts > npm/deno_asserts@0.168.0.mjs` + +const { Deno } = globalThis; +const noColor = typeof Deno?.noColor === "boolean" ? Deno.noColor : true; +let enabled = !noColor; +function code(open, close) { + return { + open: `\x1b[${open.join(";")}m`, + close: `\x1b[${close}m`, + regexp: new RegExp(`\\x1b\\[${close}m`, "g") + }; +} +function run(str, code) { + return enabled ? `${code.open}${str.replace(code.regexp, code.open)}${code.close}` : str; +} +function bold(str) { + return run(str, code([ + 1 + ], 22)); +} +function red(str) { + return run(str, code([ + 31 + ], 39)); +} +function green(str) { + return run(str, code([ + 32 + ], 39)); +} +function white(str) { + return run(str, code([ + 37 + ], 39)); +} +function gray(str) { + return brightBlack(str); +} +function brightBlack(str) { + return run(str, code([ + 90 + ], 39)); +} +function bgRed(str) { + return run(str, code([ + 41 + ], 49)); +} +function bgGreen(str) { + return run(str, code([ + 42 + ], 49)); +} +const ANSI_PATTERN = new RegExp([ + "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", + "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))" +].join("|"), "g"); +function stripColor(string) { + return string.replace(ANSI_PATTERN, ""); +} +var DiffType; +(function(DiffType) { + DiffType["removed"] = "removed"; + DiffType["common"] = "common"; + DiffType["added"] = "added"; +})(DiffType || (DiffType = {})); +const REMOVED = 1; +const COMMON = 2; +const ADDED = 3; +function createCommon(A, B, reverse) { + const common = []; + if (A.length === 0 || B.length === 0) return []; + for(let i = 0; i < Math.min(A.length, B.length); i += 1){ + if (A[reverse ? A.length - i - 1 : i] === B[reverse ? B.length - i - 1 : i]) { + common.push(A[reverse ? A.length - i - 1 : i]); + } else { + return common; + } + } + return common; +} +function diff(A, B) { + const prefixCommon = createCommon(A, B); + const suffixCommon = createCommon(A.slice(prefixCommon.length), B.slice(prefixCommon.length), true).reverse(); + A = suffixCommon.length ? A.slice(prefixCommon.length, -suffixCommon.length) : A.slice(prefixCommon.length); + B = suffixCommon.length ? B.slice(prefixCommon.length, -suffixCommon.length) : B.slice(prefixCommon.length); + const swapped = B.length > A.length; + [A, B] = swapped ? [ + B, + A + ] : [ + A, + B + ]; + const M = A.length; + const N = B.length; + if (!M && !N && !suffixCommon.length && !prefixCommon.length) return []; + if (!N) { + return [ + ...prefixCommon.map((c)=>({ + type: DiffType.common, + value: c + })), + ...A.map((a)=>({ + type: swapped ? DiffType.added : DiffType.removed, + value: a + })), + ...suffixCommon.map((c)=>({ + type: DiffType.common, + value: c + })) + ]; + } + const offset = N; + const delta = M - N; + const size = M + N + 1; + const fp = Array.from({ + length: size + }, ()=>({ + y: -1, + id: -1 + })); + const routes = new Uint32Array((M * N + size + 1) * 2); + const diffTypesPtrOffset = routes.length / 2; + let ptr = 0; + let p = -1; + function backTrace(A, B, current, swapped) { + const M = A.length; + const N = B.length; + const result = []; + let a = M - 1; + let b = N - 1; + let j = routes[current.id]; + let type = routes[current.id + diffTypesPtrOffset]; + while(true){ + if (!j && !type) break; + const prev = j; + if (type === 1) { + result.unshift({ + type: swapped ? DiffType.removed : DiffType.added, + value: B[b] + }); + b -= 1; + } else if (type === 3) { + result.unshift({ + type: swapped ? DiffType.added : DiffType.removed, + value: A[a] + }); + a -= 1; + } else { + result.unshift({ + type: DiffType.common, + value: A[a] + }); + a -= 1; + b -= 1; + } + j = routes[prev]; + type = routes[prev + diffTypesPtrOffset]; + } + return result; + } + function createFP(slide, down, k, M) { + if (slide && slide.y === -1 && down && down.y === -1) { + return { + y: 0, + id: 0 + }; + } + if (down && down.y === -1 || k === M || (slide && slide.y) > (down && down.y) + 1) { + const prev = slide.id; + ptr++; + routes[ptr] = prev; + routes[ptr + diffTypesPtrOffset] = ADDED; + return { + y: slide.y, + id: ptr + }; + } else { + const prev1 = down.id; + ptr++; + routes[ptr] = prev1; + routes[ptr + diffTypesPtrOffset] = REMOVED; + return { + y: down.y + 1, + id: ptr + }; + } + } + function snake(k, slide, down, _offset, A, B) { + const M = A.length; + const N = B.length; + if (k < -N || M < k) return { + y: -1, + id: -1 + }; + const fp = createFP(slide, down, k, M); + while(fp.y + k < M && fp.y < N && A[fp.y + k] === B[fp.y]){ + const prev = fp.id; + ptr++; + fp.id = ptr; + fp.y += 1; + routes[ptr] = prev; + routes[ptr + diffTypesPtrOffset] = COMMON; + } + return fp; + } + while(fp[delta + offset].y < N){ + p = p + 1; + for(let k = -p; k < delta; ++k){ + fp[k + offset] = snake(k, fp[k - 1 + offset], fp[k + 1 + offset], offset, A, B); + } + for(let k1 = delta + p; k1 > delta; --k1){ + fp[k1 + offset] = snake(k1, fp[k1 - 1 + offset], fp[k1 + 1 + offset], offset, A, B); + } + fp[delta + offset] = snake(delta, fp[delta - 1 + offset], fp[delta + 1 + offset], offset, A, B); + } + return [ + ...prefixCommon.map((c)=>({ + type: DiffType.common, + value: c + })), + ...backTrace(A, B, fp[delta + offset], swapped), + ...suffixCommon.map((c)=>({ + type: DiffType.common, + value: c + })) + ]; +} +function diffstr(A, B) { + function unescape(string) { + return string.replaceAll("\b", "\\b").replaceAll("\f", "\\f").replaceAll("\t", "\\t").replaceAll("\v", "\\v").replaceAll(/\r\n|\r|\n/g, (str)=>str === "\r" ? "\\r" : str === "\n" ? "\\n\n" : "\\r\\n\r\n"); + } + function tokenize(string, { wordDiff =false } = {}) { + if (wordDiff) { + const tokens = string.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/); + const words = /^[a-zA-Z\u{C0}-\u{FF}\u{D8}-\u{F6}\u{F8}-\u{2C6}\u{2C8}-\u{2D7}\u{2DE}-\u{2FF}\u{1E00}-\u{1EFF}]+$/u; + for(let i = 0; i < tokens.length - 1; i++){ + if (!tokens[i + 1] && tokens[i + 2] && words.test(tokens[i]) && words.test(tokens[i + 2])) { + tokens[i] += tokens[i + 2]; + tokens.splice(i + 1, 2); + i--; + } + } + return tokens.filter((token)=>token); + } else { + const tokens1 = [], lines = string.split(/(\n|\r\n)/); + if (!lines[lines.length - 1]) { + lines.pop(); + } + for(let i1 = 0; i1 < lines.length; i1++){ + if (i1 % 2) { + tokens1[tokens1.length - 1] += lines[i1]; + } else { + tokens1.push(lines[i1]); + } + } + return tokens1; + } + } + function createDetails(line, tokens) { + return tokens.filter(({ type })=>type === line.type || type === DiffType.common).map((result, i, t)=>{ + if (result.type === DiffType.common && t[i - 1] && t[i - 1]?.type === t[i + 1]?.type && /\s+/.test(result.value)) { + result.type = t[i - 1].type; + } + return result; + }); + } + const diffResult = diff(tokenize(`${unescape(A)}\n`), tokenize(`${unescape(B)}\n`)); + const added = [], removed = []; + for (const result of diffResult){ + if (result.type === DiffType.added) { + added.push(result); + } + if (result.type === DiffType.removed) { + removed.push(result); + } + } + const aLines = added.length < removed.length ? added : removed; + const bLines = aLines === removed ? added : removed; + for (const a of aLines){ + let tokens = [], b; + while(bLines.length){ + b = bLines.shift(); + tokens = diff(tokenize(a.value, { + wordDiff: true + }), tokenize(b?.value ?? "", { + wordDiff: true + })); + if (tokens.some(({ type , value })=>type === DiffType.common && value.trim().length)) { + break; + } + } + a.details = createDetails(a, tokens); + if (b) { + b.details = createDetails(b, tokens); + } + } + return diffResult; +} +function createColor(diffType, { background =false } = {}) { + background = false; + switch(diffType){ + case DiffType.added: + return (s)=>background ? bgGreen(white(s)) : green(bold(s)); + case DiffType.removed: + return (s)=>background ? bgRed(white(s)) : red(bold(s)); + default: + return white; + } +} +function createSign(diffType) { + switch(diffType){ + case DiffType.added: + return "+ "; + case DiffType.removed: + return "- "; + default: + return " "; + } +} +function buildMessage(diffResult, { stringDiff =false } = {}) { + const messages = [], diffMessages = []; + messages.push(""); + messages.push(""); + messages.push(` ${gray(bold("[Diff]"))} ${red(bold("Actual"))} / ${green(bold("Expected"))}`); + messages.push(""); + messages.push(""); + diffResult.forEach((result)=>{ + const c = createColor(result.type); + const line = result.details?.map((detail)=>detail.type !== DiffType.common ? createColor(detail.type, { + background: true + })(detail.value) : detail.value).join("") ?? result.value; + diffMessages.push(c(`${createSign(result.type)}${line}`)); + }); + messages.push(...stringDiff ? [ + diffMessages.join("") + ] : diffMessages); + messages.push(""); + return messages; +} +function format(v) { + const { Deno } = globalThis; + return typeof Deno?.inspect === "function" ? Deno.inspect(v, { + depth: Infinity, + sorted: true, + trailingComma: true, + compact: false, + iterableLimit: Infinity, + getters: true + }) : `"${String(v).replace(/(?=["\\])/g, "\\")}"`; +} +const CAN_NOT_DISPLAY = "[Cannot display]"; +class AssertionError extends Error { + name = "AssertionError"; + constructor(message){ + super(message); + } +} +function isKeyedCollection(x) { + return [ + Symbol.iterator, + "size" + ].every((k)=>k in x); +} +function equal(c, d) { + const seen = new Map(); + return function compare(a, b) { + if (a && b && (a instanceof RegExp && b instanceof RegExp || a instanceof URL && b instanceof URL)) { + return String(a) === String(b); + } + if (a instanceof Date && b instanceof Date) { + const aTime = a.getTime(); + const bTime = b.getTime(); + if (Number.isNaN(aTime) && Number.isNaN(bTime)) { + return true; + } + return aTime === bTime; + } + if (typeof a === "number" && typeof b === "number") { + return Number.isNaN(a) && Number.isNaN(b) || a === b; + } + if (Object.is(a, b)) { + return true; + } + if (a && typeof a === "object" && b && typeof b === "object") { + if (a && b && !constructorsEqual(a, b)) { + return false; + } + if (a instanceof WeakMap || b instanceof WeakMap) { + if (!(a instanceof WeakMap && b instanceof WeakMap)) return false; + throw new TypeError("cannot compare WeakMap instances"); + } + if (a instanceof WeakSet || b instanceof WeakSet) { + if (!(a instanceof WeakSet && b instanceof WeakSet)) return false; + throw new TypeError("cannot compare WeakSet instances"); + } + if (seen.get(a) === b) { + return true; + } + if (Object.keys(a || {}).length !== Object.keys(b || {}).length) { + return false; + } + seen.set(a, b); + if (isKeyedCollection(a) && isKeyedCollection(b)) { + if (a.size !== b.size) { + return false; + } + let unmatchedEntries = a.size; + for (const [aKey, aValue] of a.entries()){ + for (const [bKey, bValue] of b.entries()){ + if (aKey === aValue && bKey === bValue && compare(aKey, bKey) || compare(aKey, bKey) && compare(aValue, bValue)) { + unmatchedEntries--; + break; + } + } + } + return unmatchedEntries === 0; + } + const merged = { + ...a, + ...b + }; + for (const key of [ + ...Object.getOwnPropertyNames(merged), + ...Object.getOwnPropertySymbols(merged) + ]){ + if (!compare(a && a[key], b && b[key])) { + return false; + } + if (key in a && !(key in b) || key in b && !(key in a)) { + return false; + } + } + if (a instanceof WeakRef || b instanceof WeakRef) { + if (!(a instanceof WeakRef && b instanceof WeakRef)) return false; + return compare(a.deref(), b.deref()); + } + return true; + } + return false; + }(c, d); +} +function constructorsEqual(a, b) { + return a.constructor === b.constructor || a.constructor === Object && !b.constructor || !a.constructor && b.constructor === Object; +} +function assert(expr, msg = "") { + if (!expr) { + throw new AssertionError(msg); + } +} +function assertFalse(expr, msg = "") { + if (expr) { + throw new AssertionError(msg); + } +} +function assertEquals(actual, expected, msg) { + if (equal(actual, expected)) { + return; + } + let message = ""; + const actualString = format(actual); + const expectedString = format(expected); + try { + const stringDiff = typeof actual === "string" && typeof expected === "string"; + const diffResult = stringDiff ? diffstr(actual, expected) : diff(actualString.split("\n"), expectedString.split("\n")); + const diffMsg = buildMessage(diffResult, { + stringDiff + }).join("\n"); + message = `Values are not equal:\n${diffMsg}`; + } catch { + message = `\n${red(CAN_NOT_DISPLAY)} + \n\n`; + } + if (msg) { + message = msg; + } + throw new AssertionError(message); +} +function assertNotEquals(actual, expected, msg) { + if (!equal(actual, expected)) { + return; + } + let actualString; + let expectedString; + try { + actualString = String(actual); + } catch { + actualString = "[Cannot display]"; + } + try { + expectedString = String(expected); + } catch { + expectedString = "[Cannot display]"; + } + if (!msg) { + msg = `actual: ${actualString} expected not to be: ${expectedString}`; + } + throw new AssertionError(msg); +} +function assertStrictEquals(actual, expected, msg) { + if (Object.is(actual, expected)) { + return; + } + let message; + if (msg) { + message = msg; + } else { + const actualString = format(actual); + const expectedString = format(expected); + if (actualString === expectedString) { + const withOffset = actualString.split("\n").map((l)=>` ${l}`).join("\n"); + message = `Values have the same structure but are not reference-equal:\n\n${red(withOffset)}\n`; + } else { + try { + const stringDiff = typeof actual === "string" && typeof expected === "string"; + const diffResult = stringDiff ? diffstr(actual, expected) : diff(actualString.split("\n"), expectedString.split("\n")); + const diffMsg = buildMessage(diffResult, { + stringDiff + }).join("\n"); + message = `Values are not strictly equal:\n${diffMsg}`; + } catch { + message = `\n${red(CAN_NOT_DISPLAY)} + \n\n`; + } + } + } + throw new AssertionError(message); +} +function assertNotStrictEquals(actual, expected, msg) { + if (!Object.is(actual, expected)) { + return; + } + throw new AssertionError(msg ?? `Expected "actual" to be strictly unequal to: ${format(actual)}\n`); +} +function assertAlmostEquals(actual, expected, tolerance = 1e-7, msg) { + if (Object.is(actual, expected)) { + return; + } + const delta = Math.abs(expected - actual); + if (delta <= tolerance) { + return; + } + const f = (n)=>Number.isInteger(n) ? n : n.toExponential(); + throw new AssertionError(msg ?? `actual: "${f(actual)}" expected to be close to "${f(expected)}": \ +delta "${f(delta)}" is greater than "${f(tolerance)}"`); +} +function assertInstanceOf(actual, expectedType, msg = "") { + if (!msg) { + const expectedTypeStr = expectedType.name; + let actualTypeStr = ""; + if (actual === null) { + actualTypeStr = "null"; + } else if (actual === undefined) { + actualTypeStr = "undefined"; + } else if (typeof actual === "object") { + actualTypeStr = actual.constructor?.name ?? "Object"; + } else { + actualTypeStr = typeof actual; + } + if (expectedTypeStr == actualTypeStr) { + msg = `Expected object to be an instance of "${expectedTypeStr}".`; + } else if (actualTypeStr == "function") { + msg = `Expected object to be an instance of "${expectedTypeStr}" but was not an instanced object.`; + } else { + msg = `Expected object to be an instance of "${expectedTypeStr}" but was "${actualTypeStr}".`; + } + } + assert(actual instanceof expectedType, msg); +} +function assertNotInstanceOf(actual, unexpectedType, msg = `Expected object to not be an instance of "${typeof unexpectedType}"`) { + assertFalse(actual instanceof unexpectedType, msg); +} +function assertExists(actual, msg) { + if (actual === undefined || actual === null) { + if (!msg) { + msg = `actual: "${actual}" expected to not be null or undefined`; + } + throw new AssertionError(msg); + } +} +function assertStringIncludes(actual, expected, msg) { + if (!actual.includes(expected)) { + if (!msg) { + msg = `actual: "${actual}" expected to contain: "${expected}"`; + } + throw new AssertionError(msg); + } +} +function assertArrayIncludes(actual, expected, msg) { + const missing = []; + for(let i = 0; i < expected.length; i++){ + let found = false; + for(let j = 0; j < actual.length; j++){ + if (equal(expected[i], actual[j])) { + found = true; + break; + } + } + if (!found) { + missing.push(expected[i]); + } + } + if (missing.length === 0) { + return; + } + if (!msg) { + msg = `actual: "${format(actual)}" expected to include: "${format(expected)}"\nmissing: ${format(missing)}`; + } + throw new AssertionError(msg); +} +function assertMatch(actual, expected, msg) { + if (!expected.test(actual)) { + if (!msg) { + msg = `actual: "${actual}" expected to match: "${expected}"`; + } + throw new AssertionError(msg); + } +} +function assertNotMatch(actual, expected, msg) { + if (expected.test(actual)) { + if (!msg) { + msg = `actual: "${actual}" expected to not match: "${expected}"`; + } + throw new AssertionError(msg); + } +} +function assertObjectMatch(actual, expected) { + function filter(a, b) { + const seen = new WeakMap(); + return fn(a, b); + function fn(a, b) { + if (seen.has(a) && seen.get(a) === b) { + return a; + } + seen.set(a, b); + const filtered = {}; + const entries = [ + ...Object.getOwnPropertyNames(a), + ...Object.getOwnPropertySymbols(a) + ].filter((key)=>key in b).map((key)=>[ + key, + a[key] + ]); + for (const [key, value] of entries){ + if (Array.isArray(value)) { + const subset = b[key]; + if (Array.isArray(subset)) { + filtered[key] = fn({ + ...value + }, { + ...subset + }); + continue; + } + } else if (value instanceof RegExp) { + filtered[key] = value; + continue; + } else if (typeof value === "object") { + const subset1 = b[key]; + if (typeof subset1 === "object" && subset1) { + if (value instanceof Map && subset1 instanceof Map) { + filtered[key] = new Map([ + ...value + ].filter(([k])=>subset1.has(k)).map(([k, v])=>[ + k, + typeof v === "object" ? fn(v, subset1.get(k)) : v + ])); + continue; + } + if (value instanceof Set && subset1 instanceof Set) { + filtered[key] = new Set([ + ...value + ].filter((v)=>subset1.has(v))); + continue; + } + filtered[key] = fn(value, subset1); + continue; + } + } + filtered[key] = value; + } + return filtered; + } + } + return assertEquals(filter(actual, expected), filter(expected, expected)); +} +function fail(msg) { + assert(false, `Failed assertion${msg ? `: ${msg}` : "."}`); +} +function assertIsError(error, ErrorClass, msgIncludes, msg) { + if (error instanceof Error === false) { + throw new AssertionError(`Expected "error" to be an Error object.`); + } + if (ErrorClass && !(error instanceof ErrorClass)) { + msg = `Expected error to be instance of "${ErrorClass.name}", but was "${typeof error === "object" ? error?.constructor?.name : "[not an object]"}"${msg ? `: ${msg}` : "."}`; + throw new AssertionError(msg); + } + if (msgIncludes && (!(error instanceof Error) || !stripColor(error.message).includes(stripColor(msgIncludes)))) { + msg = `Expected error message to include "${msgIncludes}", but got "${error instanceof Error ? error.message : "[not an Error]"}"${msg ? `: ${msg}` : "."}`; + throw new AssertionError(msg); + } +} +function assertThrows(fn, errorClassOrMsg, msgIncludesOrMsg, msg) { + let ErrorClass = undefined; + let msgIncludes = undefined; + let err; + if (typeof errorClassOrMsg !== "string") { + if (errorClassOrMsg === undefined || errorClassOrMsg.prototype instanceof Error || errorClassOrMsg.prototype === Error.prototype) { + ErrorClass = errorClassOrMsg; + msgIncludes = msgIncludesOrMsg; + } else { + msg = msgIncludesOrMsg; + } + } else { + msg = errorClassOrMsg; + } + let doesThrow = false; + const msgToAppendToError = msg ? `: ${msg}` : "."; + try { + fn(); + } catch (error) { + if (ErrorClass) { + if (error instanceof Error === false) { + throw new AssertionError("A non-Error object was thrown."); + } + assertIsError(error, ErrorClass, msgIncludes, msg); + } + err = error; + doesThrow = true; + } + if (!doesThrow) { + msg = `Expected function to throw${msgToAppendToError}`; + throw new AssertionError(msg); + } + return err; +} +async function assertRejects(fn, errorClassOrMsg, msgIncludesOrMsg, msg) { + let ErrorClass = undefined; + let msgIncludes = undefined; + let err; + if (typeof errorClassOrMsg !== "string") { + if (errorClassOrMsg === undefined || errorClassOrMsg.prototype instanceof Error || errorClassOrMsg.prototype === Error.prototype) { + ErrorClass = errorClassOrMsg; + msgIncludes = msgIncludesOrMsg; + } + } else { + msg = errorClassOrMsg; + } + let doesThrow = false; + let isPromiseReturned = false; + const msgToAppendToError = msg ? `: ${msg}` : "."; + try { + const possiblePromise = fn(); + if (possiblePromise && typeof possiblePromise === "object" && typeof possiblePromise.then === "function") { + isPromiseReturned = true; + await possiblePromise; + } + } catch (error) { + if (!isPromiseReturned) { + throw new AssertionError(`Function throws when expected to reject${msgToAppendToError}`); + } + if (ErrorClass) { + if (error instanceof Error === false) { + throw new AssertionError("A non-Error object was rejected."); + } + assertIsError(error, ErrorClass, msgIncludes, msg); + } + err = error; + doesThrow = true; + } + if (!doesThrow) { + throw new AssertionError(`Expected function to reject${msgToAppendToError}`); + } + return err; +} +function unimplemented(msg) { + throw new AssertionError(msg || "unimplemented"); +} +function unreachable() { + throw new AssertionError("unreachable"); +} +export { AssertionError as AssertionError }; +export { equal as equal }; +export { assert as assert }; +export { assertFalse as assertFalse }; +export { assertEquals as assertEquals }; +export { assertNotEquals as assertNotEquals }; +export { assertStrictEquals as assertStrictEquals }; +export { assertNotStrictEquals as assertNotStrictEquals }; +export { assertAlmostEquals as assertAlmostEquals }; +export { assertInstanceOf as assertInstanceOf }; +export { assertNotInstanceOf as assertNotInstanceOf }; +export { assertExists as assertExists }; +export { assertStringIncludes as assertStringIncludes }; +export { assertArrayIncludes as assertArrayIncludes }; +export { assertMatch as assertMatch }; +export { assertNotMatch as assertNotMatch }; +export { assertObjectMatch as assertObjectMatch }; +export { fail as fail }; +export { assertIsError as assertIsError }; +export { assertThrows as assertThrows }; +export { assertRejects as assertRejects }; +export { unimplemented as unimplemented }; +export { unreachable as unreachable }; + diff --git a/project starter code/node_modules/tinycolor2/dist/tinycolor-min.js b/project starter code/node_modules/tinycolor2/dist/tinycolor-min.js index 2f7d9859..14389aa1 100644 --- a/project starter code/node_modules/tinycolor2/dist/tinycolor-min.js +++ b/project starter code/node_modules/tinycolor2/dist/tinycolor-min.js @@ -1,4 +1,5 @@ -// TinyColor v1.4.2 -// https://github.com/bgrins/TinyColor -// 2020-09-25, Brian Grinstead, MIT License -!function(a){function b(a,d){if(a=a?a:"",d=d||{},a instanceof b)return a;if(!(this instanceof b))return new b(a,d);var e=c(a);this._originalInput=a,this._r=e.r,this._g=e.g,this._b=e.b,this._a=e.a,this._roundA=P(100*this._a)/100,this._format=d.format||e.format,this._gradientType=d.gradientType,this._r<1&&(this._r=P(this._r)),this._g<1&&(this._g=P(this._g)),this._b<1&&(this._b=P(this._b)),this._ok=e.ok,this._tc_id=O++}function c(a){var b={r:0,g:0,b:0},c=1,e=null,g=null,i=null,j=!1,k=!1;return"string"==typeof a&&(a=K(a)),"object"==typeof a&&(J(a.r)&&J(a.g)&&J(a.b)?(b=d(a.r,a.g,a.b),j=!0,k="%"===String(a.r).substr(-1)?"prgb":"rgb"):J(a.h)&&J(a.s)&&J(a.v)?(e=G(a.s),g=G(a.v),b=h(a.h,e,g),j=!0,k="hsv"):J(a.h)&&J(a.s)&&J(a.l)&&(e=G(a.s),i=G(a.l),b=f(a.h,e,i),j=!0,k="hsl"),a.hasOwnProperty("a")&&(c=a.a)),c=z(c),{ok:j,format:a.format||k,r:Q(255,R(b.r,0)),g:Q(255,R(b.g,0)),b:Q(255,R(b.b,0)),a:c}}function d(a,b,c){return{r:255*A(a,255),g:255*A(b,255),b:255*A(c,255)}}function e(a,b,c){a=A(a,255),b=A(b,255),c=A(c,255);var d,e,f=R(a,b,c),g=Q(a,b,c),h=(f+g)/2;if(f==g)d=e=0;else{var i=f-g;switch(e=h>.5?i/(2-f-g):i/(f+g),f){case a:d=(b-c)/i+(c>b?6:0);break;case b:d=(c-a)/i+2;break;case c:d=(a-b)/i+4}d/=6}return{h:d,s:e,l:h}}function f(a,b,c){function d(a,b,c){return 0>c&&(c+=1),c>1&&(c-=1),1/6>c?a+6*(b-a)*c:.5>c?b:2/3>c?a+(b-a)*(2/3-c)*6:a}var e,f,g;if(a=A(a,360),b=A(b,100),c=A(c,100),0===b)e=f=g=c;else{var h=.5>c?c*(1+b):c+b-c*b,i=2*c-h;e=d(i,h,a+1/3),f=d(i,h,a),g=d(i,h,a-1/3)}return{r:255*e,g:255*f,b:255*g}}function g(a,b,c){a=A(a,255),b=A(b,255),c=A(c,255);var d,e,f=R(a,b,c),g=Q(a,b,c),h=f,i=f-g;if(e=0===f?0:i/f,f==g)d=0;else{switch(f){case a:d=(b-c)/i+(c>b?6:0);break;case b:d=(c-a)/i+2;break;case c:d=(a-b)/i+4}d/=6}return{h:d,s:e,v:h}}function h(b,c,d){b=6*A(b,360),c=A(c,100),d=A(d,100);var e=a.floor(b),f=b-e,g=d*(1-c),h=d*(1-f*c),i=d*(1-(1-f)*c),j=e%6,k=[d,h,g,g,i,d][j],l=[i,d,d,h,g,g][j],m=[g,g,i,d,d,h][j];return{r:255*k,g:255*l,b:255*m}}function i(a,b,c,d){var e=[F(P(a).toString(16)),F(P(b).toString(16)),F(P(c).toString(16))];return d&&e[0].charAt(0)==e[0].charAt(1)&&e[1].charAt(0)==e[1].charAt(1)&&e[2].charAt(0)==e[2].charAt(1)?e[0].charAt(0)+e[1].charAt(0)+e[2].charAt(0):e.join("")}function j(a,b,c,d,e){var f=[F(P(a).toString(16)),F(P(b).toString(16)),F(P(c).toString(16)),F(H(d))];return e&&f[0].charAt(0)==f[0].charAt(1)&&f[1].charAt(0)==f[1].charAt(1)&&f[2].charAt(0)==f[2].charAt(1)&&f[3].charAt(0)==f[3].charAt(1)?f[0].charAt(0)+f[1].charAt(0)+f[2].charAt(0)+f[3].charAt(0):f.join("")}function k(a,b,c,d){var e=[F(H(d)),F(P(a).toString(16)),F(P(b).toString(16)),F(P(c).toString(16))];return e.join("")}function l(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.s-=c/100,d.s=B(d.s),b(d)}function m(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.s+=c/100,d.s=B(d.s),b(d)}function n(a){return b(a).desaturate(100)}function o(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.l+=c/100,d.l=B(d.l),b(d)}function p(a,c){c=0===c?0:c||10;var d=b(a).toRgb();return d.r=R(0,Q(255,d.r-P(255*-(c/100)))),d.g=R(0,Q(255,d.g-P(255*-(c/100)))),d.b=R(0,Q(255,d.b-P(255*-(c/100)))),b(d)}function q(a,c){c=0===c?0:c||10;var d=b(a).toHsl();return d.l-=c/100,d.l=B(d.l),b(d)}function r(a,c){var d=b(a).toHsl(),e=(d.h+c)%360;return d.h=0>e?360+e:e,b(d)}function s(a){var c=b(a).toHsl();return c.h=(c.h+180)%360,b(c)}function t(a){var c=b(a).toHsl(),d=c.h;return[b(a),b({h:(d+120)%360,s:c.s,l:c.l}),b({h:(d+240)%360,s:c.s,l:c.l})]}function u(a){var c=b(a).toHsl(),d=c.h;return[b(a),b({h:(d+90)%360,s:c.s,l:c.l}),b({h:(d+180)%360,s:c.s,l:c.l}),b({h:(d+270)%360,s:c.s,l:c.l})]}function v(a){var c=b(a).toHsl(),d=c.h;return[b(a),b({h:(d+72)%360,s:c.s,l:c.l}),b({h:(d+216)%360,s:c.s,l:c.l})]}function w(a,c,d){c=c||6,d=d||30;var e=b(a).toHsl(),f=360/d,g=[b(a)];for(e.h=(e.h-(f*c>>1)+720)%360;--c;)e.h=(e.h+f)%360,g.push(b(e));return g}function x(a,c){c=c||6;for(var d=b(a).toHsv(),e=d.h,f=d.s,g=d.v,h=[],i=1/c;c--;)h.push(b({h:e,s:f,v:g})),g=(g+i)%1;return h}function y(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[a[c]]=c);return b}function z(a){return a=parseFloat(a),(isNaN(a)||0>a||a>1)&&(a=1),a}function A(b,c){D(b)&&(b="100%");var d=E(b);return b=Q(c,R(0,parseFloat(b))),d&&(b=parseInt(b*c,10)/100),a.abs(b-c)<1e-6?1:b%c/parseFloat(c)}function B(a){return Q(1,R(0,a))}function C(a){return parseInt(a,16)}function D(a){return"string"==typeof a&&-1!=a.indexOf(".")&&1===parseFloat(a)}function E(a){return"string"==typeof a&&-1!=a.indexOf("%")}function F(a){return 1==a.length?"0"+a:""+a}function G(a){return 1>=a&&(a=100*a+"%"),a}function H(b){return a.round(255*parseFloat(b)).toString(16)}function I(a){return C(a)/255}function J(a){return!!V.CSS_UNIT.exec(a)}function K(a){a=a.replace(M,"").replace(N,"").toLowerCase();var b=!1;if(T[a])a=T[a],b=!0;else if("transparent"==a)return{r:0,g:0,b:0,a:0,format:"name"};var c;return(c=V.rgb.exec(a))?{r:c[1],g:c[2],b:c[3]}:(c=V.rgba.exec(a))?{r:c[1],g:c[2],b:c[3],a:c[4]}:(c=V.hsl.exec(a))?{h:c[1],s:c[2],l:c[3]}:(c=V.hsla.exec(a))?{h:c[1],s:c[2],l:c[3],a:c[4]}:(c=V.hsv.exec(a))?{h:c[1],s:c[2],v:c[3]}:(c=V.hsva.exec(a))?{h:c[1],s:c[2],v:c[3],a:c[4]}:(c=V.hex8.exec(a))?{r:C(c[1]),g:C(c[2]),b:C(c[3]),a:I(c[4]),format:b?"name":"hex8"}:(c=V.hex6.exec(a))?{r:C(c[1]),g:C(c[2]),b:C(c[3]),format:b?"name":"hex"}:(c=V.hex4.exec(a))?{r:C(c[1]+""+c[1]),g:C(c[2]+""+c[2]),b:C(c[3]+""+c[3]),a:I(c[4]+""+c[4]),format:b?"name":"hex8"}:(c=V.hex3.exec(a))?{r:C(c[1]+""+c[1]),g:C(c[2]+""+c[2]),b:C(c[3]+""+c[3]),format:b?"name":"hex"}:!1}function L(a){var b,c;return a=a||{level:"AA",size:"small"},b=(a.level||"AA").toUpperCase(),c=(a.size||"small").toLowerCase(),"AA"!==b&&"AAA"!==b&&(b="AA"),"small"!==c&&"large"!==c&&(c="small"),{level:b,size:c}}var M=/^\s+/,N=/\s+$/,O=0,P=a.round,Q=a.min,R=a.max,S=a.random;b.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var a=this.toRgb();return(299*a.r+587*a.g+114*a.b)/1e3},getLuminance:function(){var b,c,d,e,f,g,h=this.toRgb();return b=h.r/255,c=h.g/255,d=h.b/255,e=.03928>=b?b/12.92:a.pow((b+.055)/1.055,2.4),f=.03928>=c?c/12.92:a.pow((c+.055)/1.055,2.4),g=.03928>=d?d/12.92:a.pow((d+.055)/1.055,2.4),.2126*e+.7152*f+.0722*g},setAlpha:function(a){return this._a=z(a),this._roundA=P(100*this._a)/100,this},toHsv:function(){var a=g(this._r,this._g,this._b);return{h:360*a.h,s:a.s,v:a.v,a:this._a}},toHsvString:function(){var a=g(this._r,this._g,this._b),b=P(360*a.h),c=P(100*a.s),d=P(100*a.v);return 1==this._a?"hsv("+b+", "+c+"%, "+d+"%)":"hsva("+b+", "+c+"%, "+d+"%, "+this._roundA+")"},toHsl:function(){var a=e(this._r,this._g,this._b);return{h:360*a.h,s:a.s,l:a.l,a:this._a}},toHslString:function(){var a=e(this._r,this._g,this._b),b=P(360*a.h),c=P(100*a.s),d=P(100*a.l);return 1==this._a?"hsl("+b+", "+c+"%, "+d+"%)":"hsla("+b+", "+c+"%, "+d+"%, "+this._roundA+")"},toHex:function(a){return i(this._r,this._g,this._b,a)},toHexString:function(a){return"#"+this.toHex(a)},toHex8:function(a){return j(this._r,this._g,this._b,this._a,a)},toHex8String:function(a){return"#"+this.toHex8(a)},toRgb:function(){return{r:P(this._r),g:P(this._g),b:P(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+P(this._r)+", "+P(this._g)+", "+P(this._b)+")":"rgba("+P(this._r)+", "+P(this._g)+", "+P(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:P(100*A(this._r,255))+"%",g:P(100*A(this._g,255))+"%",b:P(100*A(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+P(100*A(this._r,255))+"%, "+P(100*A(this._g,255))+"%, "+P(100*A(this._b,255))+"%)":"rgba("+P(100*A(this._r,255))+"%, "+P(100*A(this._g,255))+"%, "+P(100*A(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":this._a<1?!1:U[i(this._r,this._g,this._b,!0)]||!1},toFilter:function(a){var c="#"+k(this._r,this._g,this._b,this._a),d=c,e=this._gradientType?"GradientType = 1, ":"";if(a){var f=b(a);d="#"+k(f._r,f._g,f._b,f._a)}return"progid:DXImageTransform.Microsoft.gradient("+e+"startColorstr="+c+",endColorstr="+d+")"},toString:function(a){var b=!!a;a=a||this._format;var c=!1,d=this._a<1&&this._a>=0,e=!b&&d&&("hex"===a||"hex6"===a||"hex3"===a||"hex4"===a||"hex8"===a||"name"===a);return e?"name"===a&&0===this._a?this.toName():this.toRgbString():("rgb"===a&&(c=this.toRgbString()),"prgb"===a&&(c=this.toPercentageRgbString()),("hex"===a||"hex6"===a)&&(c=this.toHexString()),"hex3"===a&&(c=this.toHexString(!0)),"hex4"===a&&(c=this.toHex8String(!0)),"hex8"===a&&(c=this.toHex8String()),"name"===a&&(c=this.toName()),"hsl"===a&&(c=this.toHslString()),"hsv"===a&&(c=this.toHsvString()),c||this.toHexString())},clone:function(){return b(this.toString())},_applyModification:function(a,b){var c=a.apply(null,[this].concat([].slice.call(b)));return this._r=c._r,this._g=c._g,this._b=c._b,this.setAlpha(c._a),this},lighten:function(){return this._applyModification(o,arguments)},brighten:function(){return this._applyModification(p,arguments)},darken:function(){return this._applyModification(q,arguments)},desaturate:function(){return this._applyModification(l,arguments)},saturate:function(){return this._applyModification(m,arguments)},greyscale:function(){return this._applyModification(n,arguments)},spin:function(){return this._applyModification(r,arguments)},_applyCombination:function(a,b){return a.apply(null,[this].concat([].slice.call(b)))},analogous:function(){return this._applyCombination(w,arguments)},complement:function(){return this._applyCombination(s,arguments)},monochromatic:function(){return this._applyCombination(x,arguments)},splitcomplement:function(){return this._applyCombination(v,arguments)},triad:function(){return this._applyCombination(t,arguments)},tetrad:function(){return this._applyCombination(u,arguments)}},b.fromRatio=function(a,c){if("object"==typeof a){var d={};for(var e in a)a.hasOwnProperty(e)&&("a"===e?d[e]=a[e]:d[e]=G(a[e]));a=d}return b(a,c)},b.equals=function(a,c){return a&&c?b(a).toRgbString()==b(c).toRgbString():!1},b.random=function(){return b.fromRatio({r:S(),g:S(),b:S()})},b.mix=function(a,c,d){d=0===d?0:d||50;var e=b(a).toRgb(),f=b(c).toRgb(),g=d/100,h={r:(f.r-e.r)*g+e.r,g:(f.g-e.g)*g+e.g,b:(f.b-e.b)*g+e.b,a:(f.a-e.a)*g+e.a};return b(h)},b.readability=function(c,d){var e=b(c),f=b(d);return(a.max(e.getLuminance(),f.getLuminance())+.05)/(a.min(e.getLuminance(),f.getLuminance())+.05)},b.isReadable=function(a,c,d){var e,f,g=b.readability(a,c);switch(f=!1,e=L(d),e.level+e.size){case"AAsmall":case"AAAlarge":f=g>=4.5;break;case"AAlarge":f=g>=3;break;case"AAAsmall":f=g>=7}return f},b.mostReadable=function(a,c,d){var e,f,g,h,i=null,j=0;d=d||{},f=d.includeFallbackColors,g=d.level,h=d.size;for(var k=0;kj&&(j=e,i=b(c[k]));return b.isReadable(a,i,{level:g,size:h})||!f?i:(d.includeFallbackColors=!1,b.mostReadable(a,["#fff","#000"],d))};var T=b.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},U=b.hexNames=y(T),V=function(){var a="[-\\+]?\\d+%?",b="[-\\+]?\\d*\\.\\d+%?",c="(?:"+b+")|(?:"+a+")",d="[\\s|\\(]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")\\s*\\)?",e="[\\s|\\(]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")[,|\\s]+("+c+")\\s*\\)?";return{CSS_UNIT:new RegExp(c),rgb:new RegExp("rgb"+d),rgba:new RegExp("rgba"+e),hsl:new RegExp("hsl"+d),hsla:new RegExp("hsla"+e),hsv:new RegExp("hsv"+d),hsva:new RegExp("hsva"+e),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();"undefined"!=typeof module&&module.exports?module.exports=b:"function"==typeof define&&define.amd?define(function(){return b}):window.tinycolor=b}(Math); \ No newline at end of file +// This file is autogenerated. +// It's here at this path for backwards compatibility for links to it +// but the npm package now exports both CJS and ESM. +// See https://github.com/bgrins/TinyColor/ for instructions. + !function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(t="undefined"!=typeof globalThis?globalThis:t||self).tinycolor=r()}(this,(function(){"use strict";function t(r){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(r)}var r=/^\s+/,e=/\s+$/;function n(a,i){if(i=i||{},(a=a||"")instanceof n)return a;if(!(this instanceof n))return new n(a,i);var o=function(n){var a={r:0,g:0,b:0},i=1,o=null,h=null,s=null,f=!1,u=!1;"string"==typeof n&&(n=function(t){t=t.replace(r,"").replace(e,"").toLowerCase();var n,a=!1;if(y[t])t=y[t],a=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};if(n=T.rgb.exec(t))return{r:n[1],g:n[2],b:n[3]};if(n=T.rgba.exec(t))return{r:n[1],g:n[2],b:n[3],a:n[4]};if(n=T.hsl.exec(t))return{h:n[1],s:n[2],l:n[3]};if(n=T.hsla.exec(t))return{h:n[1],s:n[2],l:n[3],a:n[4]};if(n=T.hsv.exec(t))return{h:n[1],s:n[2],v:n[3]};if(n=T.hsva.exec(t))return{h:n[1],s:n[2],v:n[3],a:n[4]};if(n=T.hex8.exec(t))return{r:w(n[1]),g:w(n[2]),b:w(n[3]),a:F(n[4]),format:a?"name":"hex8"};if(n=T.hex6.exec(t))return{r:w(n[1]),g:w(n[2]),b:w(n[3]),format:a?"name":"hex"};if(n=T.hex4.exec(t))return{r:w(n[1]+""+n[1]),g:w(n[2]+""+n[2]),b:w(n[3]+""+n[3]),a:F(n[4]+""+n[4]),format:a?"name":"hex8"};if(n=T.hex3.exec(t))return{r:w(n[1]+""+n[1]),g:w(n[2]+""+n[2]),b:w(n[3]+""+n[3]),format:a?"name":"hex"};return!1}(n));"object"==t(n)&&(E(n.r)&&E(n.g)&&E(n.b)?(l=n.r,c=n.g,d=n.b,a={r:255*A(l,255),g:255*A(c,255),b:255*A(d,255)},f=!0,u="%"===String(n.r).substr(-1)?"prgb":"rgb"):E(n.h)&&E(n.s)&&E(n.v)?(o=H(n.s),h=H(n.v),a=function(t,r,e){t=6*A(t,360),r=A(r,100),e=A(e,100);var n=Math.floor(t),a=t-n,i=e*(1-r),o=e*(1-a*r),h=e*(1-(1-a)*r),s=n%6,f=[e,o,i,i,h,e][s],u=[h,e,e,o,i,i][s],l=[i,i,h,e,e,o][s];return{r:255*f,g:255*u,b:255*l}}(n.h,o,h),f=!0,u="hsv"):E(n.h)&&E(n.s)&&E(n.l)&&(o=H(n.s),s=H(n.l),a=function(t,r,e){var n,a,i;function o(t,r,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?t+6*(r-t)*e:e<.5?r:e<2/3?t+(r-t)*(2/3-e)*6:t}if(t=A(t,360),r=A(r,100),e=A(e,100),0===r)n=a=i=e;else{var h=e<.5?e*(1+r):e+r-e*r,s=2*e-h;n=o(s,h,t+1/3),a=o(s,h,t),i=o(s,h,t-1/3)}return{r:255*n,g:255*a,b:255*i}}(n.h,o,s),f=!0,u="hsl"),n.hasOwnProperty("a")&&(i=n.a));var l,c,d;return i=x(i),{ok:f,format:n.format||u,r:Math.min(255,Math.max(a.r,0)),g:Math.min(255,Math.max(a.g,0)),b:Math.min(255,Math.max(a.b,0)),a:i}}(a);this._originalInput=a,this._r=o.r,this._g=o.g,this._b=o.b,this._a=o.a,this._roundA=Math.round(100*this._a)/100,this._format=i.format||o.format,this._gradientType=i.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=o.ok}function a(t,r,e){t=A(t,255),r=A(r,255),e=A(e,255);var n,a,i=Math.max(t,r,e),o=Math.min(t,r,e),h=(i+o)/2;if(i==o)n=a=0;else{var s=i-o;switch(a=h>.5?s/(2-i-o):s/(i+o),i){case t:n=(r-e)/s+(r>1)+720)%360;--r;)a.h=(a.h+i)%360,o.push(n(a));return o}function v(t,r){r=r||6;for(var e=n(t).toHsv(),a=e.h,i=e.s,o=e.v,h=[],s=1/r;r--;)h.push(n({h:a,s:i,v:o})),o=(o+s)%1;return h}n.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var t,r,e,n=this.toRgb();return t=n.r/255,r=n.g/255,e=n.b/255,.2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.0722*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))},setAlpha:function(t){return this._a=x(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=i(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=i(this._r,this._g,this._b),r=Math.round(360*t.h),e=Math.round(100*t.s),n=Math.round(100*t.v);return 1==this._a?"hsv("+r+", "+e+"%, "+n+"%)":"hsva("+r+", "+e+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=a(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=a(this._r,this._g,this._b),r=Math.round(360*t.h),e=Math.round(100*t.s),n=Math.round(100*t.l);return 1==this._a?"hsl("+r+", "+e+"%, "+n+"%)":"hsla("+r+", "+e+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return o(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,r,e,n,a){var i=[S(Math.round(t).toString(16)),S(Math.round(r).toString(16)),S(Math.round(e).toString(16)),S(R(n))];if(a&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)&&i[3].charAt(0)==i[3].charAt(1))return i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0);return i.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*A(this._r,255))+"%",g:Math.round(100*A(this._g,255))+"%",b:Math.round(100*A(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*A(this._r,255))+"%, "+Math.round(100*A(this._g,255))+"%, "+Math.round(100*A(this._b,255))+"%)":"rgba("+Math.round(100*A(this._r,255))+"%, "+Math.round(100*A(this._g,255))+"%, "+Math.round(100*A(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(M[o(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var r="#"+h(this._r,this._g,this._b,this._a),e=r,a=this._gradientType?"GradientType = 1, ":"";if(t){var i=n(t);e="#"+h(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+a+"startColorstr="+r+",endColorstr="+e+")"},toString:function(t){var r=!!t;t=t||this._format;var e=!1,n=this._a<1&&this._a>=0;return r||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(e=this.toRgbString()),"prgb"===t&&(e=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(e=this.toHexString()),"hex3"===t&&(e=this.toHexString(!0)),"hex4"===t&&(e=this.toHex8String(!0)),"hex8"===t&&(e=this.toHex8String()),"name"===t&&(e=this.toName()),"hsl"===t&&(e=this.toHslString()),"hsv"===t&&(e=this.toHsvString()),e||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return n(this.toString())},_applyModification:function(t,r){var e=t.apply(null,[this].concat([].slice.call(r)));return this._r=e._r,this._g=e._g,this._b=e._b,this.setAlpha(e._a),this},lighten:function(){return this._applyModification(l,arguments)},brighten:function(){return this._applyModification(c,arguments)},darken:function(){return this._applyModification(d,arguments)},desaturate:function(){return this._applyModification(s,arguments)},saturate:function(){return this._applyModification(f,arguments)},greyscale:function(){return this._applyModification(u,arguments)},spin:function(){return this._applyModification(g,arguments)},_applyCombination:function(t,r){return t.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(_,arguments)},complement:function(){return this._applyCombination(b,arguments)},monochromatic:function(){return this._applyCombination(v,arguments)},splitcomplement:function(){return this._applyCombination(p,arguments)},triad:function(){return this._applyCombination(m,[3])},tetrad:function(){return this._applyCombination(m,[4])}},n.fromRatio=function(r,e){if("object"==t(r)){var a={};for(var i in r)r.hasOwnProperty(i)&&(a[i]="a"===i?r[i]:H(r[i]));r=a}return n(r,e)},n.equals=function(t,r){return!(!t||!r)&&n(t).toRgbString()==n(r).toRgbString()},n.random=function(){return n.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})},n.mix=function(t,r,e){e=0===e?0:e||50;var a=n(t).toRgb(),i=n(r).toRgb(),o=e/100;return n({r:(i.r-a.r)*o+a.r,g:(i.g-a.g)*o+a.g,b:(i.b-a.b)*o+a.b,a:(i.a-a.a)*o+a.a})},n.readability=function(t,r){var e=n(t),a=n(r);return(Math.max(e.getLuminance(),a.getLuminance())+.05)/(Math.min(e.getLuminance(),a.getLuminance())+.05)},n.isReadable=function(t,r,e){var a,i,o=n.readability(t,r);switch(i=!1,(a=function(t){var r,e;r=((t=t||{level:"AA",size:"small"}).level||"AA").toUpperCase(),e=(t.size||"small").toLowerCase(),"AA"!==r&&"AAA"!==r&&(r="AA");"small"!==e&&"large"!==e&&(e="small");return{level:r,size:e}}(e)).level+a.size){case"AAsmall":case"AAAlarge":i=o>=4.5;break;case"AAlarge":i=o>=3;break;case"AAAsmall":i=o>=7}return i},n.mostReadable=function(t,r,e){var a,i,o,h,s=null,f=0;i=(e=e||{}).includeFallbackColors,o=e.level,h=e.size;for(var u=0;uf&&(f=a,s=n(r[u]));return n.isReadable(t,s,{level:o,size:h})||!i?s:(e.includeFallbackColors=!1,n.mostReadable(t,["#fff","#000"],e))};var y=n.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},M=n.hexNames=function(t){var r={};for(var e in t)t.hasOwnProperty(e)&&(r[t[e]]=e);return r}(y);function x(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function A(t,r){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(t)&&(t="100%");var e=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(t);return t=Math.min(r,Math.max(0,parseFloat(t))),e&&(t=parseInt(t*r,10)/100),Math.abs(t-r)<1e-6?1:t%r/parseFloat(r)}function k(t){return Math.min(1,Math.max(0,t))}function w(t){return parseInt(t,16)}function S(t){return 1==t.length?"0"+t:""+t}function H(t){return t<=1&&(t=100*t+"%"),t}function R(t){return Math.round(255*parseFloat(t)).toString(16)}function F(t){return w(t)/255}var C,q,N,T=(q="[\\s|\\(]+("+(C="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+C+")[,|\\s]+("+C+")\\s*\\)?",N="[\\s|\\(]+("+C+")[,|\\s]+("+C+")[,|\\s]+("+C+")[,|\\s]+("+C+")\\s*\\)?",{CSS_UNIT:new RegExp(C),rgb:new RegExp("rgb"+q),rgba:new RegExp("rgba"+N),hsl:new RegExp("hsl"+q),hsla:new RegExp("hsla"+N),hsv:new RegExp("hsv"+q),hsva:new RegExp("hsva"+N),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function E(t){return!!T.CSS_UNIT.exec(t)}return n})); \ No newline at end of file diff --git a/project starter code/node_modules/tinycolor2/docs/docco.css b/project starter code/node_modules/tinycolor2/docs/docco.css deleted file mode 100644 index 04cc7ecb..00000000 --- a/project starter code/node_modules/tinycolor2/docs/docco.css +++ /dev/null @@ -1,192 +0,0 @@ -/*--------------------- Layout and Typography ----------------------------*/ -body { - font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; - font-size: 15px; - line-height: 22px; - color: #252519; - margin: 0; padding: 0; -} -a { - color: #261a3b; -} - a:visited { - color: #261a3b; - } -p { - margin: 0 0 15px 0; -} -h1, h2, h3, h4, h5, h6 { - margin: 0px 0 15px 0; -} - h1 { - margin-top: 40px; - } -hr { - border: 0 none; - border-top: 1px solid #e5e5ee; - height: 1px; - margin: 20px 0; -} -#container { - position: relative; -} -#background { - position: fixed; - top: 0; left: 525px; right: 0; bottom: 0; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - z-index: -1; -} -#jump_to, #jump_page { - background: white; - -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; - -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; - font: 10px Arial; - text-transform: uppercase; - cursor: pointer; - text-align: right; -} -#jump_to, #jump_wrapper { - position: fixed; - right: 0; top: 0; - padding: 5px 10px; -} - #jump_wrapper { - padding: 0; - display: none; - } - #jump_to:hover #jump_wrapper { - display: block; - } - #jump_page { - padding: 5px 0 3px; - margin: 0 0 25px 25px; - } - #jump_page .source { - display: block; - padding: 5px 10px; - text-decoration: none; - border-top: 1px solid #eee; - } - #jump_page .source:hover { - background: #f5f5ff; - } - #jump_page .source:first-child { - } -table td { - border: 0; - outline: 0; -} - td.docs, th.docs { - max-width: 450px; - min-width: 450px; - min-height: 5px; - padding: 10px 25px 1px 50px; - overflow-x: hidden; - vertical-align: top; - text-align: left; - } - .docs pre { - margin: 15px 0 15px; - padding-left: 15px; - } - .docs p tt, .docs p code { - background: #f8f8ff; - border: 1px solid #dedede; - font-size: 12px; - padding: 0 0.2em; - } - .pilwrap { - position: relative; - } - .pilcrow { - font: 12px Arial; - text-decoration: none; - color: #454545; - position: absolute; - top: 3px; left: -20px; - padding: 1px 2px; - opacity: 0; - -webkit-transition: opacity 0.2s linear; - } - td.docs:hover .pilcrow { - opacity: 1; - } - td.code, th.code { - padding: 14px 15px 16px 25px; - width: 100%; - vertical-align: top; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - } - pre, tt, code { - font-size: 12px; line-height: 18px; - font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; - margin: 0; padding: 0; - } - - -/*---------------------- Syntax Highlighting -----------------------------*/ -td.linenos { background-color: #f0f0f0; padding-right: 10px; } -span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } -body .hll { background-color: #ffffcc } -body .c { color: #408080; font-style: italic } /* Comment */ -body .err { border: 1px solid #FF0000 } /* Error */ -body .k { color: #954121 } /* Keyword */ -body .o { color: #666666 } /* Operator */ -body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ -body .cp { color: #BC7A00 } /* Comment.Preproc */ -body .c1 { color: #408080; font-style: italic } /* Comment.Single */ -body .cs { color: #408080; font-style: italic } /* Comment.Special */ -body .gd { color: #A00000 } /* Generic.Deleted */ -body .ge { font-style: italic } /* Generic.Emph */ -body .gr { color: #FF0000 } /* Generic.Error */ -body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -body .gi { color: #00A000 } /* Generic.Inserted */ -body .go { color: #808080 } /* Generic.Output */ -body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -body .gs { font-weight: bold } /* Generic.Strong */ -body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -body .gt { color: #0040D0 } /* Generic.Traceback */ -body .kc { color: #954121 } /* Keyword.Constant */ -body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ -body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ -body .kp { color: #954121 } /* Keyword.Pseudo */ -body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ -body .kt { color: #B00040 } /* Keyword.Type */ -body .m { color: #666666 } /* Literal.Number */ -body .s { color: #219161 } /* Literal.String */ -body .na { color: #7D9029 } /* Name.Attribute */ -body .nb { color: #954121 } /* Name.Builtin */ -body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ -body .no { color: #880000 } /* Name.Constant */ -body .nd { color: #AA22FF } /* Name.Decorator */ -body .ni { color: #999999; font-weight: bold } /* Name.Entity */ -body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -body .nf { color: #0000FF } /* Name.Function */ -body .nl { color: #A0A000 } /* Name.Label */ -body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -body .nt { color: #954121; font-weight: bold } /* Name.Tag */ -body .nv { color: #19469D } /* Name.Variable */ -body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -body .w { color: #bbbbbb } /* Text.Whitespace */ -body .mf { color: #666666 } /* Literal.Number.Float */ -body .mh { color: #666666 } /* Literal.Number.Hex */ -body .mi { color: #666666 } /* Literal.Number.Integer */ -body .mo { color: #666666 } /* Literal.Number.Oct */ -body .sb { color: #219161 } /* Literal.String.Backtick */ -body .sc { color: #219161 } /* Literal.String.Char */ -body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ -body .s2 { color: #219161 } /* Literal.String.Double */ -body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -body .sh { color: #219161 } /* Literal.String.Heredoc */ -body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -body .sx { color: #954121 } /* Literal.String.Other */ -body .sr { color: #BB6688 } /* Literal.String.Regex */ -body .s1 { color: #219161 } /* Literal.String.Single */ -body .ss { color: #19469D } /* Literal.String.Symbol */ -body .bp { color: #954121 } /* Name.Builtin.Pseudo */ -body .vc { color: #19469D } /* Name.Variable.Class */ -body .vg { color: #19469D } /* Name.Variable.Global */ -body .vi { color: #19469D } /* Name.Variable.Instance */ -body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/project starter code/node_modules/tinycolor2/docs/tinycolor.html b/project starter code/node_modules/tinycolor2/docs/tinycolor.html deleted file mode 100644 index 148068c1..00000000 --- a/project starter code/node_modules/tinycolor2/docs/tinycolor.html +++ /dev/null @@ -1,1023 +0,0 @@ - tinycolor.js

tinycolor.js

TinyColor v1.4.2 -https://github.com/bgrins/TinyColor -Brian Grinstead, MIT License

(function(Math) {
-
-var trimLeft = /^\s+/,
-    trimRight = /\s+$/,
-    tinyCounter = 0,
-    mathRound = Math.round,
-    mathMin = Math.min,
-    mathMax = Math.max,
-    mathRandom = Math.random;
-
-function tinycolor (color, opts) {
-
-    color = (color) ? color : '';
-    opts = opts || { };

If input is already a tinycolor, return itself

    if (color instanceof tinycolor) {
-       return color;
-    }

If we are called as a function, call using new instead

    if (!(this instanceof tinycolor)) {
-        return new tinycolor(color, opts);
-    }
-
-    var rgb = inputToRGB(color);
-    this._originalInput = color,
-    this._r = rgb.r,
-    this._g = rgb.g,
-    this._b = rgb.b,
-    this._a = rgb.a,
-    this._roundA = mathRound(100*this._a) / 100,
-    this._format = opts.format || rgb.format;
-    this._gradientType = opts.gradientType;

Don't let the range of [0,255] come back in [0,1]. -Potentially lose a little bit of precision here, but will fix issues where -.5 gets interpreted as half of the total, instead of half of 1 -If it was supposed to be 128, this was already taken care of by inputToRgb

    if (this._r < 1) { this._r = mathRound(this._r); }
-    if (this._g < 1) { this._g = mathRound(this._g); }
-    if (this._b < 1) { this._b = mathRound(this._b); }
-
-    this._ok = rgb.ok;
-    this._tc_id = tinyCounter++;
-}
-
-tinycolor.prototype = {
-    isDark: function() {
-        return this.getBrightness() < 128;
-    },
-    isLight: function() {
-        return !this.isDark();
-    },
-    isValid: function() {
-        return this._ok;
-    },
-    getOriginalInput: function() {
-      return this._originalInput;
-    },
-    getFormat: function() {
-        return this._format;
-    },
-    getAlpha: function() {
-        return this._a;
-    },
-    getBrightness: function() {

http://www.w3.org/TR/AERT#color-contrast

        var rgb = this.toRgb();
-        return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
-    },
-    getLuminance: function() {

http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef

        var rgb = this.toRgb();
-        var RsRGB, GsRGB, BsRGB, R, G, B;
-        RsRGB = rgb.r/255;
-        GsRGB = rgb.g/255;
-        BsRGB = rgb.b/255;
-
-        if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);}
-        if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);}
-        if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);}
-        return (0.2126 * R) + (0.7152 * G) + (0.0722 * B);
-    },
-    setAlpha: function(value) {
-        this._a = boundAlpha(value);
-        this._roundA = mathRound(100*this._a) / 100;
-        return this;
-    },
-    toHsv: function() {
-        var hsv = rgbToHsv(this._r, this._g, this._b);
-        return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
-    },
-    toHsvString: function() {
-        var hsv = rgbToHsv(this._r, this._g, this._b);
-        var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);
-        return (this._a == 1) ?
-          "hsv("  + h + ", " + s + "%, " + v + "%)" :
-          "hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")";
-    },
-    toHsl: function() {
-        var hsl = rgbToHsl(this._r, this._g, this._b);
-        return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };
-    },
-    toHslString: function() {
-        var hsl = rgbToHsl(this._r, this._g, this._b);
-        var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100);
-        return (this._a == 1) ?
-          "hsl("  + h + ", " + s + "%, " + l + "%)" :
-          "hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")";
-    },
-    toHex: function(allow3Char) {
-        return rgbToHex(this._r, this._g, this._b, allow3Char);
-    },
-    toHexString: function(allow3Char) {
-        return '#' + this.toHex(allow3Char);
-    },
-    toHex8: function(allow4Char) {
-        return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
-    },
-    toHex8String: function(allow4Char) {
-        return '#' + this.toHex8(allow4Char);
-    },
-    toRgb: function() {
-        return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a };
-    },
-    toRgbString: function() {
-        return (this._a == 1) ?
-          "rgb("  + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" :
-          "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")";
-    },
-    toPercentageRgb: function() {
-        return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a };
-    },
-    toPercentageRgbString: function() {
-        return (this._a == 1) ?
-          "rgb("  + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" :
-          "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
-    },
-    toName: function() {
-        if (this._a === 0) {
-            return "transparent";
-        }
-
-        if (this._a < 1) {
-            return false;
-        }
-
-        return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
-    },
-    toFilter: function(secondColor) {
-        var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a);
-        var secondHex8String = hex8String;
-        var gradientType = this._gradientType ? "GradientType = 1, " : "";
-
-        if (secondColor) {
-            var s = tinycolor(secondColor);
-            secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a);
-        }
-
-        return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")";
-    },
-    toString: function(format) {
-        var formatSet = !!format;
-        format = format || this._format;
-
-        var formattedString = false;
-        var hasAlpha = this._a < 1 && this._a >= 0;
-        var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
-
-        if (needsAlphaFormat) {

Special case for "transparent", all other non-alpha formats -will return rgba when there is transparency.

            if (format === "name" && this._a === 0) {
-                return this.toName();
-            }
-            return this.toRgbString();
-        }
-        if (format === "rgb") {
-            formattedString = this.toRgbString();
-        }
-        if (format === "prgb") {
-            formattedString = this.toPercentageRgbString();
-        }
-        if (format === "hex" || format === "hex6") {
-            formattedString = this.toHexString();
-        }
-        if (format === "hex3") {
-            formattedString = this.toHexString(true);
-        }
-        if (format === "hex4") {
-            formattedString = this.toHex8String(true);
-        }
-        if (format === "hex8") {
-            formattedString = this.toHex8String();
-        }
-        if (format === "name") {
-            formattedString = this.toName();
-        }
-        if (format === "hsl") {
-            formattedString = this.toHslString();
-        }
-        if (format === "hsv") {
-            formattedString = this.toHsvString();
-        }
-
-        return formattedString || this.toHexString();
-    },
-    clone: function() {
-        return tinycolor(this.toString());
-    },
-
-    _applyModification: function(fn, args) {
-        var color = fn.apply(null, [this].concat([].slice.call(args)));
-        this._r = color._r;
-        this._g = color._g;
-        this._b = color._b;
-        this.setAlpha(color._a);
-        return this;
-    },
-    lighten: function() {
-        return this._applyModification(lighten, arguments);
-    },
-    brighten: function() {
-        return this._applyModification(brighten, arguments);
-    },
-    darken: function() {
-        return this._applyModification(darken, arguments);
-    },
-    desaturate: function() {
-        return this._applyModification(desaturate, arguments);
-    },
-    saturate: function() {
-        return this._applyModification(saturate, arguments);
-    },
-    greyscale: function() {
-        return this._applyModification(greyscale, arguments);
-    },
-    spin: function() {
-        return this._applyModification(spin, arguments);
-    },
-
-    _applyCombination: function(fn, args) {
-        return fn.apply(null, [this].concat([].slice.call(args)));
-    },
-    analogous: function() {
-        return this._applyCombination(analogous, arguments);
-    },
-    complement: function() {
-        return this._applyCombination(complement, arguments);
-    },
-    monochromatic: function() {
-        return this._applyCombination(monochromatic, arguments);
-    },
-    splitcomplement: function() {
-        return this._applyCombination(splitcomplement, arguments);
-    },
-    triad: function() {
-        return this._applyCombination(triad, arguments);
-    },
-    tetrad: function() {
-        return this._applyCombination(tetrad, arguments);
-    }
-};

If input is an object, force 1 into "1.0" to handle ratios properly -String input requires "1.0" as input, so 1 will be treated as 1

tinycolor.fromRatio = function(color, opts) {
-    if (typeof color == "object") {
-        var newColor = {};
-        for (var i in color) {
-            if (color.hasOwnProperty(i)) {
-                if (i === "a") {
-                    newColor[i] = color[i];
-                }
-                else {
-                    newColor[i] = convertToPercentage(color[i]);
-                }
-            }
-        }
-        color = newColor;
-    }
-
-    return tinycolor(color, opts);
-};

Given a string or object, convert that input to RGB -Possible string inputs:

- -
"red"
-"#f00" or "f00"
-"#ff0000" or "ff0000"
-"#ff000000" or "ff000000"
-"rgb 255 0 0" or "rgb (255, 0, 0)"
-"rgb 1.0 0 0" or "rgb (1, 0, 0)"
-"rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
-"rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
-"hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
-"hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
-"hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
-
function inputToRGB(color) {
-
-    var rgb = { r: 0, g: 0, b: 0 };
-    var a = 1;
-    var s = null;
-    var v = null;
-    var l = null;
-    var ok = false;
-    var format = false;
-
-    if (typeof color == "string") {
-        color = stringInputToObject(color);
-    }
-
-    if (typeof color == "object") {
-        if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
-            rgb = rgbToRgb(color.r, color.g, color.b);
-            ok = true;
-            format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
-        }
-        else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
-            s = convertToPercentage(color.s);
-            v = convertToPercentage(color.v);
-            rgb = hsvToRgb(color.h, s, v);
-            ok = true;
-            format = "hsv";
-        }
-        else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
-            s = convertToPercentage(color.s);
-            l = convertToPercentage(color.l);
-            rgb = hslToRgb(color.h, s, l);
-            ok = true;
-            format = "hsl";
-        }
-
-        if (color.hasOwnProperty("a")) {
-            a = color.a;
-        }
-    }
-
-    a = boundAlpha(a);
-
-    return {
-        ok: ok,
-        format: color.format || format,
-        r: mathMin(255, mathMax(rgb.r, 0)),
-        g: mathMin(255, mathMax(rgb.g, 0)),
-        b: mathMin(255, mathMax(rgb.b, 0)),
-        a: a
-    };
-}

Conversion Functions

rgbToHsl, rgbToHsv, hslToRgb, hsvToRgb modified from: -http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript

rgbToRgb -Handle bounds / percentage checking to conform to CSS color spec -http://www.w3.org/TR/css3-color/ -Assumes: r, g, b in [0, 255] or [0, 1] -Returns: { r, g, b } in [0, 255]

function rgbToRgb(r, g, b){
-    return {
-        r: bound01(r, 255) * 255,
-        g: bound01(g, 255) * 255,
-        b: bound01(b, 255) * 255
-    };
-}

rgbToHsl -Converts an RGB color value to HSL. -Assumes: r, g, and b are contained in [0, 255] or [0, 1] -Returns: { h, s, l } in [0,1]

function rgbToHsl(r, g, b) {
-
-    r = bound01(r, 255);
-    g = bound01(g, 255);
-    b = bound01(b, 255);
-
-    var max = mathMax(r, g, b), min = mathMin(r, g, b);
-    var h, s, l = (max + min) / 2;
-
-    if(max == min) {
-        h = s = 0; // achromatic
-    }
-    else {
-        var d = max - min;
-        s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
-        switch(max) {
-            case r: h = (g - b) / d + (g < b ? 6 : 0); break;
-            case g: h = (b - r) / d + 2; break;
-            case b: h = (r - g) / d + 4; break;
-        }
-
-        h /= 6;
-    }
-
-    return { h: h, s: s, l: l };
-}

hslToRgb -Converts an HSL color value to RGB. -Assumes: h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] -Returns: { r, g, b } in the set [0, 255]

function hslToRgb(h, s, l) {
-    var r, g, b;
-
-    h = bound01(h, 360);
-    s = bound01(s, 100);
-    l = bound01(l, 100);
-
-    function hue2rgb(p, q, t) {
-        if(t < 0) t += 1;
-        if(t > 1) t -= 1;
-        if(t < 1/6) return p + (q - p) * 6 * t;
-        if(t < 1/2) return q;
-        if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
-        return p;
-    }
-
-    if(s === 0) {
-        r = g = b = l; // achromatic
-    }
-    else {
-        var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
-        var p = 2 * l - q;
-        r = hue2rgb(p, q, h + 1/3);
-        g = hue2rgb(p, q, h);
-        b = hue2rgb(p, q, h - 1/3);
-    }
-
-    return { r: r * 255, g: g * 255, b: b * 255 };
-}

rgbToHsv -Converts an RGB color value to HSV -Assumes: r, g, and b are contained in the set [0, 255] or [0, 1] -Returns: { h, s, v } in [0,1]

function rgbToHsv(r, g, b) {
-
-    r = bound01(r, 255);
-    g = bound01(g, 255);
-    b = bound01(b, 255);
-
-    var max = mathMax(r, g, b), min = mathMin(r, g, b);
-    var h, s, v = max;
-
-    var d = max - min;
-    s = max === 0 ? 0 : d / max;
-
-    if(max == min) {
-        h = 0; // achromatic
-    }
-    else {
-        switch(max) {
-            case r: h = (g - b) / d + (g < b ? 6 : 0); break;
-            case g: h = (b - r) / d + 2; break;
-            case b: h = (r - g) / d + 4; break;
-        }
-        h /= 6;
-    }
-    return { h: h, s: s, v: v };
-}

hsvToRgb -Converts an HSV color value to RGB. -Assumes: h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] -Returns: { r, g, b } in the set [0, 255]

 function hsvToRgb(h, s, v) {
-
-    h = bound01(h, 360) * 6;
-    s = bound01(s, 100);
-    v = bound01(v, 100);
-
-    var i = Math.floor(h),
-        f = h - i,
-        p = v * (1 - s),
-        q = v * (1 - f * s),
-        t = v * (1 - (1 - f) * s),
-        mod = i % 6,
-        r = [v, q, p, p, t, v][mod],
-        g = [t, v, v, q, p, p][mod],
-        b = [p, p, t, v, v, q][mod];
-
-    return { r: r * 255, g: g * 255, b: b * 255 };
-}

rgbToHex -Converts an RGB color to hex -Assumes r, g, and b are contained in the set [0, 255] -Returns a 3 or 6 character hex

function rgbToHex(r, g, b, allow3Char) {
-
-    var hex = [
-        pad2(mathRound(r).toString(16)),
-        pad2(mathRound(g).toString(16)),
-        pad2(mathRound(b).toString(16))
-    ];

Return a 3 character hex if possible

    if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
-        return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
-    }
-
-    return hex.join("");
-}

rgbaToHex -Converts an RGBA color plus alpha transparency to hex -Assumes r, g, b are contained in the set [0, 255] and -a in [0, 1]. Returns a 4 or 8 character rgba hex

function rgbaToHex(r, g, b, a, allow4Char) {
-
-    var hex = [
-        pad2(mathRound(r).toString(16)),
-        pad2(mathRound(g).toString(16)),
-        pad2(mathRound(b).toString(16)),
-        pad2(convertDecimalToHex(a))
-    ];

Return a 4 character hex if possible

    if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
-        return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
-    }
-
-    return hex.join("");
-}

rgbaToArgbHex -Converts an RGBA color to an ARGB Hex8 string -Rarely used, but required for "toFilter()"

function rgbaToArgbHex(r, g, b, a) {
-
-    var hex = [
-        pad2(convertDecimalToHex(a)),
-        pad2(mathRound(r).toString(16)),
-        pad2(mathRound(g).toString(16)),
-        pad2(mathRound(b).toString(16))
-    ];
-
-    return hex.join("");
-}

equals -Can be called with any tinycolor input

tinycolor.equals = function (color1, color2) {
-    if (!color1 || !color2) { return false; }
-    return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
-};
-
-tinycolor.random = function() {
-    return tinycolor.fromRatio({
-        r: mathRandom(),
-        g: mathRandom(),
-        b: mathRandom()
-    });
-};

Modification Functions

- -

Thanks to less.js for some of the basics here -https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js

function desaturate(color, amount) {
-    amount = (amount === 0) ? 0 : (amount || 10);
-    var hsl = tinycolor(color).toHsl();
-    hsl.s -= amount / 100;
-    hsl.s = clamp01(hsl.s);
-    return tinycolor(hsl);
-}
-
-function saturate(color, amount) {
-    amount = (amount === 0) ? 0 : (amount || 10);
-    var hsl = tinycolor(color).toHsl();
-    hsl.s += amount / 100;
-    hsl.s = clamp01(hsl.s);
-    return tinycolor(hsl);
-}
-
-function greyscale(color) {
-    return tinycolor(color).desaturate(100);
-}
-
-function lighten (color, amount) {
-    amount = (amount === 0) ? 0 : (amount || 10);
-    var hsl = tinycolor(color).toHsl();
-    hsl.l += amount / 100;
-    hsl.l = clamp01(hsl.l);
-    return tinycolor(hsl);
-}
-
-function brighten(color, amount) {
-    amount = (amount === 0) ? 0 : (amount || 10);
-    var rgb = tinycolor(color).toRgb();
-    rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100))));
-    rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100))));
-    rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100))));
-    return tinycolor(rgb);
-}
-
-function darken (color, amount) {
-    amount = (amount === 0) ? 0 : (amount || 10);
-    var hsl = tinycolor(color).toHsl();
-    hsl.l -= amount / 100;
-    hsl.l = clamp01(hsl.l);
-    return tinycolor(hsl);
-}

Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. -Values outside of this range will be wrapped into this range.

function spin(color, amount) {
-    var hsl = tinycolor(color).toHsl();
-    var hue = (hsl.h + amount) % 360;
-    hsl.h = hue < 0 ? 360 + hue : hue;
-    return tinycolor(hsl);
-}

Combination Functions

- -

Thanks to jQuery xColor for some of the ideas behind these -https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js

function complement(color) {
-    var hsl = tinycolor(color).toHsl();
-    hsl.h = (hsl.h + 180) % 360;
-    return tinycolor(hsl);
-}
-
-function triad(color) {
-    var hsl = tinycolor(color).toHsl();
-    var h = hsl.h;
-    return [
-        tinycolor(color),
-        tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }),
-        tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l })
-    ];
-}
-
-function tetrad(color) {
-    var hsl = tinycolor(color).toHsl();
-    var h = hsl.h;
-    return [
-        tinycolor(color),
-        tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }),
-        tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }),
-        tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l })
-    ];
-}
-
-function splitcomplement(color) {
-    var hsl = tinycolor(color).toHsl();
-    var h = hsl.h;
-    return [
-        tinycolor(color),
-        tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}),
-        tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l})
-    ];
-}
-
-function analogous(color, results, slices) {
-    results = results || 6;
-    slices = slices || 30;
-
-    var hsl = tinycolor(color).toHsl();
-    var part = 360 / slices;
-    var ret = [tinycolor(color)];
-
-    for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) {
-        hsl.h = (hsl.h + part) % 360;
-        ret.push(tinycolor(hsl));
-    }
-    return ret;
-}
-
-function monochromatic(color, results) {
-    results = results || 6;
-    var hsv = tinycolor(color).toHsv();
-    var h = hsv.h, s = hsv.s, v = hsv.v;
-    var ret = [];
-    var modification = 1 / results;
-
-    while (results--) {
-        ret.push(tinycolor({ h: h, s: s, v: v}));
-        v = (v + modification) % 1;
-    }
-
-    return ret;
-}

Utility Functions

tinycolor.mix = function(color1, color2, amount) {
-    amount = (amount === 0) ? 0 : (amount || 50);
-
-    var rgb1 = tinycolor(color1).toRgb();
-    var rgb2 = tinycolor(color2).toRgb();
-
-    var p = amount / 100;
-
-    var rgba = {
-        r: ((rgb2.r - rgb1.r) * p) + rgb1.r,
-        g: ((rgb2.g - rgb1.g) * p) + rgb1.g,
-        b: ((rgb2.b - rgb1.b) * p) + rgb1.b,
-        a: ((rgb2.a - rgb1.a) * p) + rgb1.a
-    };
-
-    return tinycolor(rgba);
-};

Readability Functions

- -

contrast -Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2)

tinycolor.readability = function(color1, color2) {
-    var c1 = tinycolor(color1);
-    var c2 = tinycolor(color2);
-    return (Math.max(c1.getLuminance(),c2.getLuminance())+0.05) / (Math.min(c1.getLuminance(),c2.getLuminance())+0.05);
-};

isReadable -Ensure that foreground and background color combinations meet WCAG2 guidelines. -The third argument is an optional Object. - the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA'; - the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'. -If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}.

Example - tinycolor.isReadable("#000", "#111") => false - tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false

tinycolor.isReadable = function(color1, color2, wcag2) {
-    var readability = tinycolor.readability(color1, color2);
-    var wcag2Parms, out;
-
-    out = false;
-
-    wcag2Parms = validateWCAG2Parms(wcag2);
-    switch (wcag2Parms.level + wcag2Parms.size) {
-        case "AAsmall":
-        case "AAAlarge":
-            out = readability >= 4.5;
-            break;
-        case "AAlarge":
-            out = readability >= 3;
-            break;
-        case "AAAsmall":
-            out = readability >= 7;
-            break;
-    }
-    return out;
-
-};

mostReadable -Given a base color and a list of possible foreground or background -colors for that base, returns the most readable color. -Optionally returns Black or White if the most readable color is unreadable. -Example - tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" - tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" - tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3" - tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff"

tinycolor.mostReadable = function(baseColor, colorList, args) {
-    var bestColor = null;
-    var bestScore = 0;
-    var readability;
-    var includeFallbackColors, level, size ;
-    args = args || {};
-    includeFallbackColors = args.includeFallbackColors ;
-    level = args.level;
-    size = args.size;
-
-    for (var i= 0; i < colorList.length ; i++) {
-        readability = tinycolor.readability(baseColor, colorList[i]);
-        if (readability > bestScore) {
-            bestScore = readability;
-            bestColor = tinycolor(colorList[i]);
-        }
-    }
-
-    if (tinycolor.isReadable(baseColor, bestColor, {"level":level,"size":size}) || !includeFallbackColors) {
-        return bestColor;
-    }
-    else {
-        args.includeFallbackColors=false;
-        return tinycolor.mostReadable(baseColor,["#fff", "#000"],args);
-    }
-};

Big List of Colors

- -

http://www.w3.org/TR/css3-color/#svg-color

var names = tinycolor.names = {
-    aliceblue: "f0f8ff",
-    antiquewhite: "faebd7",
-    aqua: "0ff",
-    aquamarine: "7fffd4",
-    azure: "f0ffff",
-    beige: "f5f5dc",
-    bisque: "ffe4c4",
-    black: "000",
-    blanchedalmond: "ffebcd",
-    blue: "00f",
-    blueviolet: "8a2be2",
-    brown: "a52a2a",
-    burlywood: "deb887",
-    burntsienna: "ea7e5d",
-    cadetblue: "5f9ea0",
-    chartreuse: "7fff00",
-    chocolate: "d2691e",
-    coral: "ff7f50",
-    cornflowerblue: "6495ed",
-    cornsilk: "fff8dc",
-    crimson: "dc143c",
-    cyan: "0ff",
-    darkblue: "00008b",
-    darkcyan: "008b8b",
-    darkgoldenrod: "b8860b",
-    darkgray: "a9a9a9",
-    darkgreen: "006400",
-    darkgrey: "a9a9a9",
-    darkkhaki: "bdb76b",
-    darkmagenta: "8b008b",
-    darkolivegreen: "556b2f",
-    darkorange: "ff8c00",
-    darkorchid: "9932cc",
-    darkred: "8b0000",
-    darksalmon: "e9967a",
-    darkseagreen: "8fbc8f",
-    darkslateblue: "483d8b",
-    darkslategray: "2f4f4f",
-    darkslategrey: "2f4f4f",
-    darkturquoise: "00ced1",
-    darkviolet: "9400d3",
-    deeppink: "ff1493",
-    deepskyblue: "00bfff",
-    dimgray: "696969",
-    dimgrey: "696969",
-    dodgerblue: "1e90ff",
-    firebrick: "b22222",
-    floralwhite: "fffaf0",
-    forestgreen: "228b22",
-    fuchsia: "f0f",
-    gainsboro: "dcdcdc",
-    ghostwhite: "f8f8ff",
-    gold: "ffd700",
-    goldenrod: "daa520",
-    gray: "808080",
-    green: "008000",
-    greenyellow: "adff2f",
-    grey: "808080",
-    honeydew: "f0fff0",
-    hotpink: "ff69b4",
-    indianred: "cd5c5c",
-    indigo: "4b0082",
-    ivory: "fffff0",
-    khaki: "f0e68c",
-    lavender: "e6e6fa",
-    lavenderblush: "fff0f5",
-    lawngreen: "7cfc00",
-    lemonchiffon: "fffacd",
-    lightblue: "add8e6",
-    lightcoral: "f08080",
-    lightcyan: "e0ffff",
-    lightgoldenrodyellow: "fafad2",
-    lightgray: "d3d3d3",
-    lightgreen: "90ee90",
-    lightgrey: "d3d3d3",
-    lightpink: "ffb6c1",
-    lightsalmon: "ffa07a",
-    lightseagreen: "20b2aa",
-    lightskyblue: "87cefa",
-    lightslategray: "789",
-    lightslategrey: "789",
-    lightsteelblue: "b0c4de",
-    lightyellow: "ffffe0",
-    lime: "0f0",
-    limegreen: "32cd32",
-    linen: "faf0e6",
-    magenta: "f0f",
-    maroon: "800000",
-    mediumaquamarine: "66cdaa",
-    mediumblue: "0000cd",
-    mediumorchid: "ba55d3",
-    mediumpurple: "9370db",
-    mediumseagreen: "3cb371",
-    mediumslateblue: "7b68ee",
-    mediumspringgreen: "00fa9a",
-    mediumturquoise: "48d1cc",
-    mediumvioletred: "c71585",
-    midnightblue: "191970",
-    mintcream: "f5fffa",
-    mistyrose: "ffe4e1",
-    moccasin: "ffe4b5",
-    navajowhite: "ffdead",
-    navy: "000080",
-    oldlace: "fdf5e6",
-    olive: "808000",
-    olivedrab: "6b8e23",
-    orange: "ffa500",
-    orangered: "ff4500",
-    orchid: "da70d6",
-    palegoldenrod: "eee8aa",
-    palegreen: "98fb98",
-    paleturquoise: "afeeee",
-    palevioletred: "db7093",
-    papayawhip: "ffefd5",
-    peachpuff: "ffdab9",
-    peru: "cd853f",
-    pink: "ffc0cb",
-    plum: "dda0dd",
-    powderblue: "b0e0e6",
-    purple: "800080",
-    rebeccapurple: "663399",
-    red: "f00",
-    rosybrown: "bc8f8f",
-    royalblue: "4169e1",
-    saddlebrown: "8b4513",
-    salmon: "fa8072",
-    sandybrown: "f4a460",
-    seagreen: "2e8b57",
-    seashell: "fff5ee",
-    sienna: "a0522d",
-    silver: "c0c0c0",
-    skyblue: "87ceeb",
-    slateblue: "6a5acd",
-    slategray: "708090",
-    slategrey: "708090",
-    snow: "fffafa",
-    springgreen: "00ff7f",
-    steelblue: "4682b4",
-    tan: "d2b48c",
-    teal: "008080",
-    thistle: "d8bfd8",
-    tomato: "ff6347",
-    turquoise: "40e0d0",
-    violet: "ee82ee",
-    wheat: "f5deb3",
-    white: "fff",
-    whitesmoke: "f5f5f5",
-    yellow: "ff0",
-    yellowgreen: "9acd32"
-};

Make it easy to access colors via hexNames[hex]

var hexNames = tinycolor.hexNames = flip(names);

Utilities

{ 'name1': 'val1' } becomes { 'val1': 'name1' }

function flip(o) {
-    var flipped = { };
-    for (var i in o) {
-        if (o.hasOwnProperty(i)) {
-            flipped[o[i]] = i;
-        }
-    }
-    return flipped;
-}

Return a valid alpha value [0,1] with all invalid values being set to 1

function boundAlpha(a) {
-    a = parseFloat(a);
-
-    if (isNaN(a) || a < 0 || a > 1) {
-        a = 1;
-    }
-
-    return a;
-}

Take input from [0, n] and return it as [0, 1]

function bound01(n, max) {
-    if (isOnePointZero(n)) { n = "100%"; }
-
-    var processPercent = isPercentage(n);
-    n = mathMin(max, mathMax(0, parseFloat(n)));

Automatically convert percentage into number

    if (processPercent) {
-        n = parseInt(n * max, 10) / 100;
-    }

Handle floating point rounding errors

    if ((Math.abs(n - max) < 0.000001)) {
-        return 1;
-    }

Convert into [0, 1] range if it isn't already

    return (n % max) / parseFloat(max);
-}

Force a number between 0 and 1

function clamp01(val) {
-    return mathMin(1, mathMax(0, val));
-}

Parse a base-16 hex value into a base-10 integer

function parseIntFromHex(val) {
-    return parseInt(val, 16);
-}

Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 -http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0

function isOnePointZero(n) {
-    return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1;
-}

Check to see if string passed in is a percentage

function isPercentage(n) {
-    return typeof n === "string" && n.indexOf('%') != -1;
-}

Force a hex value to have 2 characters

function pad2(c) {
-    return c.length == 1 ? '0' + c : '' + c;
-}

Replace a decimal with it's percentage value

function convertToPercentage(n) {
-    if (n <= 1) {
-        n = (n * 100) + "%";
-    }
-
-    return n;
-}

Converts a decimal to a hex value

function convertDecimalToHex(d) {
-    return Math.round(parseFloat(d) * 255).toString(16);
-}

Converts a hex value to a decimal

function convertHexToDecimal(h) {
-    return (parseIntFromHex(h) / 255);
-}
-
-var matchers = (function() {

http://www.w3.org/TR/css3-values/#integers

    var CSS_INTEGER = "[-\\+]?\\d+%?";

http://www.w3.org/TR/css3-values/#number-value

    var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";

Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.

    var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";

Actual matching. -Parentheses and commas are optional, but not required. -Whitespace can take the place of commas or opening paren

    var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
-    var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
-
-    return {
-        CSS_UNIT: new RegExp(CSS_UNIT),
-        rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
-        rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
-        hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
-        hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
-        hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
-        hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
-        hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
-        hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
-        hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
-        hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
-    };
-})();

isValidCSSUnit -Take in a single string / number and check to see if it looks like a CSS unit -(see matchers above for definition).

function isValidCSSUnit(color) {
-    return !!matchers.CSS_UNIT.exec(color);
-}

stringInputToObject -Permissive string parsing. Take in a number of formats, and output an object -based on detected format. Returns { r, g, b } or { h, s, l } or { h, s, v}

function stringInputToObject(color) {
-
-    color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase();
-    var named = false;
-    if (names[color]) {
-        color = names[color];
-        named = true;
-    }
-    else if (color == 'transparent') {
-        return { r: 0, g: 0, b: 0, a: 0, format: "name" };
-    }

Try to match string input using regular expressions. -Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] -Just return an object and let the conversion functions handle that. -This way the result will be the same whether the tinycolor is initialized with string or object.

    var match;
-    if ((match = matchers.rgb.exec(color))) {
-        return { r: match[1], g: match[2], b: match[3] };
-    }
-    if ((match = matchers.rgba.exec(color))) {
-        return { r: match[1], g: match[2], b: match[3], a: match[4] };
-    }
-    if ((match = matchers.hsl.exec(color))) {
-        return { h: match[1], s: match[2], l: match[3] };
-    }
-    if ((match = matchers.hsla.exec(color))) {
-        return { h: match[1], s: match[2], l: match[3], a: match[4] };
-    }
-    if ((match = matchers.hsv.exec(color))) {
-        return { h: match[1], s: match[2], v: match[3] };
-    }
-    if ((match = matchers.hsva.exec(color))) {
-        return { h: match[1], s: match[2], v: match[3], a: match[4] };
-    }
-    if ((match = matchers.hex8.exec(color))) {
-        return {
-            r: parseIntFromHex(match[1]),
-            g: parseIntFromHex(match[2]),
-            b: parseIntFromHex(match[3]),
-            a: convertHexToDecimal(match[4]),
-            format: named ? "name" : "hex8"
-        };
-    }
-    if ((match = matchers.hex6.exec(color))) {
-        return {
-            r: parseIntFromHex(match[1]),
-            g: parseIntFromHex(match[2]),
-            b: parseIntFromHex(match[3]),
-            format: named ? "name" : "hex"
-        };
-    }
-    if ((match = matchers.hex4.exec(color))) {
-        return {
-            r: parseIntFromHex(match[1] + '' + match[1]),
-            g: parseIntFromHex(match[2] + '' + match[2]),
-            b: parseIntFromHex(match[3] + '' + match[3]),
-            a: convertHexToDecimal(match[4] + '' + match[4]),
-            format: named ? "name" : "hex8"
-        };
-    }
-    if ((match = matchers.hex3.exec(color))) {
-        return {
-            r: parseIntFromHex(match[1] + '' + match[1]),
-            g: parseIntFromHex(match[2] + '' + match[2]),
-            b: parseIntFromHex(match[3] + '' + match[3]),
-            format: named ? "name" : "hex"
-        };
-    }
-
-    return false;
-}
-
-function validateWCAG2Parms(parms) {

return valid WCAG2 parms for isReadable. -If input parms are invalid, return {"level":"AA", "size":"small"}

    var level, size;
-    parms = parms || {"level":"AA", "size":"small"};
-    level = (parms.level || "AA").toUpperCase();
-    size = (parms.size || "small").toLowerCase();
-    if (level !== "AA" && level !== "AAA") {
-        level = "AA";
-    }
-    if (size !== "small" && size !== "large") {
-        size = "small";
-    }
-    return {"level":level, "size":size};
-}

Node: Export function

if (typeof module !== "undefined" && module.exports) {
-    module.exports = tinycolor;
-}

AMD/requirejs: Define the module

else if (typeof define === 'function' && define.amd) {
-    define(function () {return tinycolor;});
-}

Browser: Expose to window

else {
-    window.tinycolor = tinycolor;
-}
-
-})(Math);
-
-
\ No newline at end of file diff --git a/project starter code/node_modules/tinycolor2/esm/package.json b/project starter code/node_modules/tinycolor2/esm/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/project starter code/node_modules/tinycolor2/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/project starter code/node_modules/tinycolor2/esm/test.js b/project starter code/node_modules/tinycolor2/esm/test.js new file mode 100644 index 00000000..4f02b0ce --- /dev/null +++ b/project starter code/node_modules/tinycolor2/esm/test.js @@ -0,0 +1,2189 @@ +// This file is autogenerated. +// Ideally it wouldn't exist, but it's here to test cjs in node +// Changes should go into ./test.js, and if new assertions are needed +// they'll need to be shimmed here as well +import tinycolor from "./tinycolor.js"; +import { Deno, testDefinitions } from "@deno/shim-deno-test"; +const { assertEquals, assert, assertThrows } = await import( + "../deno_asserts@0.168.0.mjs" +); +async function runDenoTests() { + for (const test of testDefinitions) { + if (test.ignore) { + console.log(`Ignoring ${test.name}`); + continue; + } + console.log(`Running ${test.name}`); + await test.fn(); + console.log(`> Passed ${test.name}`); + } +} + +// TEST_BEGINS_HERE + +Deno.test("TinyColor initialization", function () { + assert( + typeof tinycolor != "undefined", + "tinycolor is initialized on the page" + ); + assert( + typeof tinycolor("red") == "object", + "tinycolor is able to be instantiated" + ); + + var r = tinycolor("red"); + assert( + tinycolor(r) === r, + "when given a tinycolor instance, tinycolor() returns it" + ); + assert( + new tinycolor(r) === r, + "when given a tinycolor instance, new tinycolor() returns it" + ); + assertEquals( + tinycolor("red", { format: "hex" }).toString(), + "#ff0000", + "tinycolor options are being parsed" + ); + assertEquals( + tinycolor.fromRatio({ r: 1, g: 0, b: 0 }, { format: "hex" }).toString(), + "#ff0000", + "tinycolor options are being parsed" + ); + + var obj = { h: 180, s: 0.5, l: 0.5 }; + var color = tinycolor(obj); + assert( + obj.s === 0.5, + "when given an object, the original object is not modified" + ); +}); + +Deno.test("Original input", function () { + var colorRgbUp = "RGB(39, 39, 39)"; + var colorRgbLow = "rgb(39, 39, 39)"; + var colorRgbMix = "RgB(39, 39, 39)"; + var tinycolorObj = tinycolor(colorRgbMix); + var inputObj = { r: 100, g: 100, b: 100 }; + var r = tinycolor("red"); + + assert( + tinycolor(colorRgbLow).getOriginalInput() === colorRgbLow, + "original lowercase input is returned" + ); + assert( + tinycolor(colorRgbUp).getOriginalInput() === colorRgbUp, + "original uppercase input is returned" + ); + assert( + tinycolor(colorRgbMix).getOriginalInput() === colorRgbMix, + "original mixed input is returned" + ); + assert( + tinycolor(tinycolorObj).getOriginalInput() === colorRgbMix, + "when given a tinycolor instance, the color string is returned" + ); + assert( + tinycolor(inputObj).getOriginalInput() === inputObj, + "when given an object, the object is returned" + ); + assert( + new tinycolor("").getOriginalInput() === "", + "when given an empty string, an empty string is returned" + ); + assert( + new tinycolor(null).getOriginalInput() === "", + "when given a null value, an empty string is returned" + ); +}); + +Deno.test("Cloning color", function () { + var originalColor = tinycolor("red"); + var originalColorRgbString = originalColor.toRgbString(); + + var clonedColor = originalColor.clone(); + assert( + clonedColor.toRgbString() === originalColor.toRgbString(), + "cloned color is identical" + ); + + clonedColor.setAlpha(0.5); + assert( + clonedColor.toRgbString() !== originalColor.toRgbString(), + "cloned color is changing independently from original color" + ); + assert( + originalColorRgbString === originalColor.toRgbString(), + "original color was not changed by cloned color change" + ); +}); +Deno.test("Random color", function () { + var randomColor = tinycolor.random(); + assertEquals(randomColor.getAlpha(), 1); + assertEquals(randomColor.getFormat(), "prgb"); + + randomColor.setAlpha(0.5); + assertEquals(randomColor.toHex8String().slice(-2), "80"); +}); + +// Taken from convertWikipediaColors.html +var conversions = [ + { + hex: "#FFFFFF", + hex8: "#FFFFFFFF", + rgb: { r: "100.0%", g: "100.0%", b: "100.0%" }, + hsv: { h: "0", s: "0.000", v: "1.000" }, + hsl: { h: "0", s: "0.000", l: "1.000" }, + }, + { + hex: "#808080", + hex8: "#808080FF", + rgb: { r: "050.0%", g: "050.0%", b: "050.0%" }, + hsv: { h: "0", s: "0.000", v: "0.500" }, + hsl: { h: "0", s: "0.000", l: "0.500" }, + }, + { + hex: "#000000", + hex8: "#000000FF", + rgb: { r: "000.0%", g: "000.0%", b: "000.0%" }, + hsv: { h: "0", s: "0.000", v: "0.000" }, + hsl: { h: "0", s: "0.000", l: "0.000" }, + }, + { + hex: "#FF0000", + hex8: "#FF0000FF", + rgb: { r: "100.0%", g: "000.0%", b: "000.0%" }, + hsv: { h: "0.0", s: "1.000", v: "1.000" }, + hsl: { h: "0.0", s: "1.000", l: "0.500" }, + }, + { + hex: "#BFBF00", + hex8: "#BFBF00FF", + rgb: { r: "075.0%", g: "075.0%", b: "000.0%" }, + hsv: { h: "60.0", s: "1.000", v: "0.750" }, + hsl: { h: "60.0", s: "1.000", l: "0.375" }, + }, + { + hex: "#008000", + hex8: "#008000FF", + rgb: { r: "000.0%", g: "050.0%", b: "000.0%" }, + hsv: { h: "120.0", s: "1.000", v: "0.500" }, + hsl: { h: "120.0", s: "1.000", l: "0.250" }, + }, + { + hex: "#80FFFF", + hex8: "#80FFFFFF", + rgb: { r: "050.0%", g: "100.0%", b: "100.0%" }, + hsv: { h: "180.0", s: "0.500", v: "1.000" }, + hsl: { h: "180.0", s: "1.000", l: "0.750" }, + }, + { + hex: "#8080FF", + hex8: "#8080FFFF", + rgb: { r: "050.0%", g: "050.0%", b: "100.0%" }, + hsv: { h: "240.0", s: "0.500", v: "1.000" }, + hsl: { h: "240.0", s: "1.000", l: "0.750" }, + }, + { + hex: "#BF40BF", + hex8: "#BF40BFFF", + rgb: { r: "075.0%", g: "025.0%", b: "075.0%" }, + hsv: { h: "300.0", s: "0.667", v: "0.750" }, + hsl: { h: "300.0", s: "0.500", l: "0.500" }, + }, + { + hex: "#A0A424", + hex8: "#A0A424FF", + rgb: { r: "062.8%", g: "064.3%", b: "014.2%" }, + hsv: { h: "61.8", s: "0.779", v: "0.643" }, + hsl: { h: "61.8", s: "0.638", l: "0.393" }, + }, + { + hex: "#1EAC41", + hex8: "#1EAC41FF", + rgb: { r: "011.6%", g: "067.5%", b: "025.5%" }, + hsv: { h: "134.9", s: "0.828", v: "0.675" }, + hsl: { h: "134.9", s: "0.707", l: "0.396" }, + }, + { + hex: "#B430E5", + hex8: "#B430E5FF", + rgb: { r: "070.4%", g: "018.7%", b: "089.7%" }, + hsv: { h: "283.7", s: "0.792", v: "0.897" }, + hsl: { h: "283.7", s: "0.775", l: "0.542" }, + }, + { + hex: "#FEF888", + hex8: "#FEF888FF", + rgb: { r: "099.8%", g: "097.4%", b: "053.2%" }, + hsv: { h: "56.9", s: "0.467", v: "0.998" }, + hsl: { h: "56.9", s: "0.991", l: "0.765" }, + }, + { + hex: "#19CB97", + hex8: "#19CB97FF", + rgb: { r: "009.9%", g: "079.5%", b: "059.1%" }, + hsv: { h: "162.4", s: "0.875", v: "0.795" }, + hsl: { h: "162.4", s: "0.779", l: "0.447" }, + }, + { + hex: "#362698", + hex8: "#362698FF", + rgb: { r: "021.1%", g: "014.9%", b: "059.7%" }, + hsv: { h: "248.3", s: "0.750", v: "0.597" }, + hsl: { h: "248.3", s: "0.601", l: "0.373" }, + }, + { + hex: "#7E7EB8", + hex8: "#7E7EB8FF", + rgb: { r: "049.5%", g: "049.3%", b: "072.1%" }, + hsv: { h: "240.5", s: "0.316", v: "0.721" }, + hsl: { h: "240.5", s: "0.290", l: "0.607" }, + }, +]; + +Deno.test("Color Equality", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + + assert(true, tiny.isValid()); + assert( + true, + "Testing " + + c.hex + + ": " + + tiny.toRgbString() + + " " + + tiny.toPercentageRgbString() + + " " + + tiny.toHsvString() + + " " + + tiny.toHslString() + + " " + + tiny.toHexString() + + "Original: " + + JSON.stringify(c.rgb) + + " " + + JSON.stringify(c.hsv) + + " " + + JSON.stringify(c.hsl) + ); + assert(tinycolor.equals(c.rgb, c.hex), "RGB equals hex " + c.hex); + assert(tinycolor.equals(c.rgb, c.hex8), "RGB equals hex " + c.hex); + assert(tinycolor.equals(c.rgb, c.hsl), "RGB equals HSL " + c.hex); + assert(tinycolor.equals(c.rgb, c.hsv), "RGB equals HSV " + c.hex); + assert(tinycolor.equals(c.rgb, c.rgb), "RGB equals RGB " + c.hex); + + assert(tinycolor.equals(c.hex, c.hex), "hex equals hex " + c.hex); + assert(tinycolor.equals(c.hex, c.hex8), "hex equals hex8 " + c.hex); + assert(tinycolor.equals(c.hex, c.hsl), "hex equals HSL " + c.hex); + assert(tinycolor.equals(c.hex, c.hsv), "hex equals HSV " + c.hex); + + assert(tinycolor.equals(c.hsl, c.hsv), "HSL equals HSV " + c.hex); + } +}); + +Deno.test("With Ratio", function () { + assertEquals( + tinycolor.fromRatio({ r: 1, g: 1, b: 1 }).toHexString(), + "#ffffff", + "white" + ); + assertEquals( + tinycolor.fromRatio({ r: 1, g: 0, b: 0, a: 0.5 }).toRgbString(), + "rgba(255, 0, 0, 0.5)", + "alpha works when ratio is parsed" + ); + assertEquals( + tinycolor.fromRatio({ r: 1, g: 0, b: 0, a: 1 }).toRgbString(), + "rgb(255, 0, 0)", + "alpha = 1 works when ratio is parsed" + ); + assertEquals( + tinycolor.fromRatio({ r: 1, g: 0, b: 0, a: 10 }).toRgbString(), + "rgb(255, 0, 0)", + "alpha > 1 works when ratio is parsed" + ); + assertEquals( + tinycolor.fromRatio({ r: 1, g: 0, b: 0, a: -1 }).toRgbString(), + "rgb(255, 0, 0)", + "alpha < 1 works when ratio is parsed" + ); +}); + +Deno.test("Without Ratio", function () { + assertEquals( + tinycolor({ r: 1, g: 1, b: 1 }).toHexString(), + "#010101", + "010101" + ); + assertEquals( + tinycolor({ r: 0.1, g: 0.1, b: 0.1 }).toHexString(), + "#000000", + "000000" + ); + assertEquals(tinycolor("rgb .1 .1 .1").toHexString(), "#000000", "000000"); +}); + +Deno.test("RGB Text Parsing", function () { + assertEquals( + tinycolor("rgb 255 0 0").toHexString(), + "#ff0000", + "spaced input" + ); + assertEquals( + tinycolor("rgb(255, 0, 0)").toHexString(), + "#ff0000", + "parenthesized input" + ); + assertEquals( + tinycolor("rgb (255, 0, 0)").toHexString(), + "#ff0000", + "parenthesized spaced input" + ); + assertEquals( + tinycolor({ r: 255, g: 0, b: 0 }).toHexString(), + "#ff0000", + "object input" + ); + assertEquals( + tinycolor({ r: 255, g: 0, b: 0 }).toRgb(), + { + r: 255, + g: 0, + b: 0, + a: 1, + }, + "object input and compare" + ); + + assert(tinycolor.equals({ r: 200, g: 100, b: 0 }, "rgb(200, 100, 0)")); + assert(tinycolor.equals({ r: 200, g: 100, b: 0 }, "rgb 200 100 0")); + assert(tinycolor.equals({ r: 200, g: 100, b: 0 }, "rgb 200 100 0")); + assert( + tinycolor.equals({ r: 200, g: 100, b: 0, a: 0.4 }, "rgba 200 100 0 .4") + ); + assert(!tinycolor.equals({ r: 199, g: 100, b: 0 }, "rgba 200 100 0 1")); + + assert(!tinycolor.equals({ r: 199, g: 100, b: 0 }, "rgb(200, 100, 0)")); + assert(!tinycolor.equals({ r: 199, g: 100, b: 0 }, "rgb 200 100 0")); + assert(!tinycolor.equals({ r: 199, g: 100, b: 0 }, "rgb 200 100 0")); + + assert( + tinycolor.equals(tinycolor({ r: 200, g: 100, b: 0 }), "rgb(200, 100, 0)") + ); + assert( + tinycolor.equals(tinycolor({ r: 200, g: 100, b: 0 }), "rgb 200 100 0") + ); + assert( + tinycolor.equals(tinycolor({ r: 200, g: 100, b: 0 }), "rgb 200 100 0") + ); +}); + +Deno.test("Percentage RGB Text Parsing", function () { + assertEquals( + tinycolor("rgb 100% 0% 0%").toHexString(), + "#ff0000", + "spaced input" + ); + assertEquals( + tinycolor("rgb(100%, 0%, 0%)").toHexString(), + "#ff0000", + "parenthesized input" + ); + assertEquals( + tinycolor("rgb (100%, 0%, 0%)").toHexString(), + "#ff0000", + "parenthesized spaced input" + ); + assertEquals( + tinycolor({ r: "100%", g: "0%", b: "0%" }).toHexString(), + "#ff0000", + "object input" + ); + assertEquals( + tinycolor({ r: "100%", g: "0%", b: "0%" }).toRgb(), + { + r: 255, + g: 0, + b: 0, + a: 1, + }, + "object input and compare" + ); + + assert( + tinycolor.equals({ r: "90%", g: "45%", b: "0%" }, "rgb(90%, 45%, 0%)") + ); + assert(tinycolor.equals({ r: "90%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); + assert(tinycolor.equals({ r: "90%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); + assert( + tinycolor.equals( + { r: "90%", g: "45%", b: "0%", a: 0.4 }, + "rgba 90% 45% 0% .4" + ) + ); + assert( + !tinycolor.equals({ r: "89%", g: "45%", b: "0%" }, "rgba 90% 45% 0% 1") + ); + + assert( + !tinycolor.equals({ r: "89%", g: "45%", b: "0%" }, "rgb(90%, 45%, 0%)") + ); + assert(!tinycolor.equals({ r: "89%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); + assert(!tinycolor.equals({ r: "89%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); + + assert( + tinycolor.equals( + tinycolor({ r: "90%", g: "45%", b: "0%" }), + "rgb(90%, 45%, 0%)" + ) + ); + assert( + tinycolor.equals( + tinycolor({ r: "90%", g: "45%", b: "0%" }), + "rgb 90% 45% 0%" + ) + ); + assert( + tinycolor.equals( + tinycolor({ r: "90%", g: "45%", b: "0%" }), + "rgb 90% 45% 0%" + ) + ); +}); + +Deno.test("HSL parsing", function () { + assertEquals( + tinycolor({ h: 251, s: 100, l: 0.38 }).toHexString(), + "#2400c2", + "to hex" + ); + assertEquals( + tinycolor({ h: 251, s: 100, l: 0.38 }).toRgbString(), + "rgb(36, 0, 194)", + "to rgb" + ); + assertEquals( + tinycolor({ h: 251, s: 100, l: 0.38 }).toHslString(), + "hsl(251, 100%, 38%)", + "to hsl" + ); + assertEquals( + tinycolor({ h: 251, s: 100, l: 0.38, a: 0.5 }).toHslString(), + "hsla(251, 100%, 38%, 0.5)", + "to hsla" + ); + assertEquals( + tinycolor("hsl(251, 100, 38)").toHexString(), + "#2400c2", + "to hex" + ); + assertEquals( + tinycolor("hsl(251, 100%, 38%)").toRgbString(), + "rgb(36, 0, 194)", + "to rgb" + ); + assertEquals( + tinycolor("hsl(251, 100%, 38%)").toHslString(), + "hsl(251, 100%, 38%)", + "to hsl" + ); + assertEquals( + tinycolor("hsl 100 20 10").toHslString(), + "hsl(100, 20%, 10%)", + "problematic hsl" + ); +}); + +Deno.test("Hex Parsing", function () { + assertEquals(tinycolor("rgb 255 0 0").toHexString(), "#ff0000"); + assertEquals(tinycolor("rgb 255 0 0").toHexString(true), "#f00"); + + assertEquals(tinycolor("rgba 255 0 0 0.5").toHex8String(), "#ff000080"); + assertEquals(tinycolor("rgba 255 0 0 0").toHex8String(), "#ff000000"); + assertEquals(tinycolor("rgba 255 0 0 1").toHex8String(), "#ff0000ff"); + assertEquals(tinycolor("rgba 255 0 0 1").toHex8String(true), "#f00f"); + + assertEquals(tinycolor("rgb 255 0 0").toHex(), "ff0000"); + assertEquals(tinycolor("rgb 255 0 0").toHex(true), "f00"); + assertEquals(tinycolor("rgba 255 0 0 0.5").toHex8(), "ff000080"); +}); + +Deno.test("HSV Parsing", function () { + assertEquals( + tinycolor("hsv 251.1 0.887 .918").toHsvString(), + "hsv(251, 89%, 92%)" + ); + assertEquals( + tinycolor("hsv 251.1 0.887 0.918").toHsvString(), + "hsv(251, 89%, 92%)" + ); + assertEquals( + tinycolor("hsva 251.1 0.887 0.918 0.5").toHsvString(), + "hsva(251, 89%, 92%, 0.5)" + ); +}); + +Deno.test("Invalid Parsing", function () { + var invalidColor = tinycolor("this is not a color"); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor("#red"); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor(" #red"); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor("##123456"); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor(" ##123456"); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor({ r: "invalid", g: "invalid", b: "invalid" }); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor({ h: "invalid", s: "invalid", l: "invalid" }); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); + + invalidColor = tinycolor({ h: "invalid", s: "invalid", v: "invalid" }); + assertEquals(invalidColor.toHexString(), "#000000"); + assertEquals(false, invalidColor.isValid()); +}); + +Deno.test("Named colors", function () { + assertEquals(tinycolor("aliceblue").toHex(), "f0f8ff"); + assertEquals(tinycolor("antiquewhite").toHex(), "faebd7"); + assertEquals(tinycolor("aqua").toHex(), "00ffff"); + assertEquals(tinycolor("aquamarine").toHex(), "7fffd4"); + assertEquals(tinycolor("azure").toHex(), "f0ffff"); + assertEquals(tinycolor("beige").toHex(), "f5f5dc"); + assertEquals(tinycolor("bisque").toHex(), "ffe4c4"); + assertEquals(tinycolor("black").toHex(), "000000"); + assertEquals(tinycolor("blanchedalmond").toHex(), "ffebcd"); + assertEquals(tinycolor("blue").toHex(), "0000ff"); + assertEquals(tinycolor("blueviolet").toHex(), "8a2be2"); + assertEquals(tinycolor("brown").toHex(), "a52a2a"); + assertEquals(tinycolor("burlywood").toHex(), "deb887"); + assertEquals(tinycolor("cadetblue").toHex(), "5f9ea0"); + assertEquals(tinycolor("chartreuse").toHex(), "7fff00"); + assertEquals(tinycolor("chocolate").toHex(), "d2691e"); + assertEquals(tinycolor("coral").toHex(), "ff7f50"); + assertEquals(tinycolor("cornflowerblue").toHex(), "6495ed"); + assertEquals(tinycolor("cornsilk").toHex(), "fff8dc"); + assertEquals(tinycolor("crimson").toHex(), "dc143c"); + assertEquals(tinycolor("cyan").toHex(), "00ffff"); + assertEquals(tinycolor("darkblue").toHex(), "00008b"); + assertEquals(tinycolor("darkcyan").toHex(), "008b8b"); + assertEquals(tinycolor("darkgoldenrod").toHex(), "b8860b"); + assertEquals(tinycolor("darkgray").toHex(), "a9a9a9"); + assertEquals(tinycolor("darkgreen").toHex(), "006400"); + assertEquals(tinycolor("darkkhaki").toHex(), "bdb76b"); + assertEquals(tinycolor("darkmagenta").toHex(), "8b008b"); + assertEquals(tinycolor("darkolivegreen").toHex(), "556b2f"); + assertEquals(tinycolor("darkorange").toHex(), "ff8c00"); + assertEquals(tinycolor("darkorchid").toHex(), "9932cc"); + assertEquals(tinycolor("darkred").toHex(), "8b0000"); + assertEquals(tinycolor("darksalmon").toHex(), "e9967a"); + assertEquals(tinycolor("darkseagreen").toHex(), "8fbc8f"); + assertEquals(tinycolor("darkslateblue").toHex(), "483d8b"); + assertEquals(tinycolor("darkslategray").toHex(), "2f4f4f"); + assertEquals(tinycolor("darkturquoise").toHex(), "00ced1"); + assertEquals(tinycolor("darkviolet").toHex(), "9400d3"); + assertEquals(tinycolor("deeppink").toHex(), "ff1493"); + assertEquals(tinycolor("deepskyblue").toHex(), "00bfff"); + assertEquals(tinycolor("dimgray").toHex(), "696969"); + assertEquals(tinycolor("dodgerblue").toHex(), "1e90ff"); + assertEquals(tinycolor("firebrick").toHex(), "b22222"); + assertEquals(tinycolor("floralwhite").toHex(), "fffaf0"); + assertEquals(tinycolor("forestgreen").toHex(), "228b22"); + assertEquals(tinycolor("fuchsia").toHex(), "ff00ff"); + assertEquals(tinycolor("gainsboro").toHex(), "dcdcdc"); + assertEquals(tinycolor("ghostwhite").toHex(), "f8f8ff"); + assertEquals(tinycolor("gold").toHex(), "ffd700"); + assertEquals(tinycolor("goldenrod").toHex(), "daa520"); + assertEquals(tinycolor("gray").toHex(), "808080"); + assertEquals(tinycolor("grey").toHex(), "808080"); + assertEquals(tinycolor("green").toHex(), "008000"); + assertEquals(tinycolor("greenyellow").toHex(), "adff2f"); + assertEquals(tinycolor("honeydew").toHex(), "f0fff0"); + assertEquals(tinycolor("hotpink").toHex(), "ff69b4"); + assertEquals(tinycolor("indianred ").toHex(), "cd5c5c"); + assertEquals(tinycolor("indigo ").toHex(), "4b0082"); + assertEquals(tinycolor("ivory").toHex(), "fffff0"); + assertEquals(tinycolor("khaki").toHex(), "f0e68c"); + assertEquals(tinycolor("lavender").toHex(), "e6e6fa"); + assertEquals(tinycolor("lavenderblush").toHex(), "fff0f5"); + assertEquals(tinycolor("lawngreen").toHex(), "7cfc00"); + assertEquals(tinycolor("lemonchiffon").toHex(), "fffacd"); + assertEquals(tinycolor("lightblue").toHex(), "add8e6"); + assertEquals(tinycolor("lightcoral").toHex(), "f08080"); + assertEquals(tinycolor("lightcyan").toHex(), "e0ffff"); + assertEquals(tinycolor("lightgoldenrodyellow").toHex(), "fafad2"); + assertEquals(tinycolor("lightgrey").toHex(), "d3d3d3"); + assertEquals(tinycolor("lightgreen").toHex(), "90ee90"); + assertEquals(tinycolor("lightpink").toHex(), "ffb6c1"); + assertEquals(tinycolor("lightsalmon").toHex(), "ffa07a"); + assertEquals(tinycolor("lightseagreen").toHex(), "20b2aa"); + assertEquals(tinycolor("lightskyblue").toHex(), "87cefa"); + assertEquals(tinycolor("lightslategray").toHex(), "778899"); + assertEquals(tinycolor("lightsteelblue").toHex(), "b0c4de"); + assertEquals(tinycolor("lightyellow").toHex(), "ffffe0"); + assertEquals(tinycolor("lime").toHex(), "00ff00"); + assertEquals(tinycolor("limegreen").toHex(), "32cd32"); + assertEquals(tinycolor("linen").toHex(), "faf0e6"); + assertEquals(tinycolor("magenta").toHex(), "ff00ff"); + assertEquals(tinycolor("maroon").toHex(), "800000"); + assertEquals(tinycolor("mediumaquamarine").toHex(), "66cdaa"); + assertEquals(tinycolor("mediumblue").toHex(), "0000cd"); + assertEquals(tinycolor("mediumorchid").toHex(), "ba55d3"); + assertEquals(tinycolor("mediumpurple").toHex(), "9370db"); + assertEquals(tinycolor("mediumseagreen").toHex(), "3cb371"); + assertEquals(tinycolor("mediumslateblue").toHex(), "7b68ee"); + assertEquals(tinycolor("mediumspringgreen").toHex(), "00fa9a"); + assertEquals(tinycolor("mediumturquoise").toHex(), "48d1cc"); + assertEquals(tinycolor("mediumvioletred").toHex(), "c71585"); + assertEquals(tinycolor("midnightblue").toHex(), "191970"); + assertEquals(tinycolor("mintcream").toHex(), "f5fffa"); + assertEquals(tinycolor("mistyrose").toHex(), "ffe4e1"); + assertEquals(tinycolor("moccasin").toHex(), "ffe4b5"); + assertEquals(tinycolor("navajowhite").toHex(), "ffdead"); + assertEquals(tinycolor("navy").toHex(), "000080"); + assertEquals(tinycolor("oldlace").toHex(), "fdf5e6"); + assertEquals(tinycolor("olive").toHex(), "808000"); + assertEquals(tinycolor("olivedrab").toHex(), "6b8e23"); + assertEquals(tinycolor("orange").toHex(), "ffa500"); + assertEquals(tinycolor("orangered").toHex(), "ff4500"); + assertEquals(tinycolor("orchid").toHex(), "da70d6"); + assertEquals(tinycolor("palegoldenrod").toHex(), "eee8aa"); + assertEquals(tinycolor("palegreen").toHex(), "98fb98"); + assertEquals(tinycolor("paleturquoise").toHex(), "afeeee"); + assertEquals(tinycolor("palevioletred").toHex(), "db7093"); + assertEquals(tinycolor("papayawhip").toHex(), "ffefd5"); + assertEquals(tinycolor("peachpuff").toHex(), "ffdab9"); + assertEquals(tinycolor("peru").toHex(), "cd853f"); + assertEquals(tinycolor("pink").toHex(), "ffc0cb"); + assertEquals(tinycolor("plum").toHex(), "dda0dd"); + assertEquals(tinycolor("powderblue").toHex(), "b0e0e6"); + assertEquals(tinycolor("purple").toHex(), "800080"); + assertEquals(tinycolor("rebeccapurple").toHex(), "663399"); + assertEquals(tinycolor("red").toHex(), "ff0000"); + assertEquals(tinycolor("rosybrown").toHex(), "bc8f8f"); + assertEquals(tinycolor("royalblue").toHex(), "4169e1"); + assertEquals(tinycolor("saddlebrown").toHex(), "8b4513"); + assertEquals(tinycolor("salmon").toHex(), "fa8072"); + assertEquals(tinycolor("sandybrown").toHex(), "f4a460"); + assertEquals(tinycolor("seagreen").toHex(), "2e8b57"); + assertEquals(tinycolor("seashell").toHex(), "fff5ee"); + assertEquals(tinycolor("sienna").toHex(), "a0522d"); + assertEquals(tinycolor("silver").toHex(), "c0c0c0"); + assertEquals(tinycolor("skyblue").toHex(), "87ceeb"); + assertEquals(tinycolor("slateblue").toHex(), "6a5acd"); + assertEquals(tinycolor("slategray").toHex(), "708090"); + assertEquals(tinycolor("snow").toHex(), "fffafa"); + assertEquals(tinycolor("springgreen").toHex(), "00ff7f"); + assertEquals(tinycolor("steelblue").toHex(), "4682b4"); + assertEquals(tinycolor("tan").toHex(), "d2b48c"); + assertEquals(tinycolor("teal").toHex(), "008080"); + assertEquals(tinycolor("thistle").toHex(), "d8bfd8"); + assertEquals(tinycolor("tomato").toHex(), "ff6347"); + assertEquals(tinycolor("turquoise").toHex(), "40e0d0"); + assertEquals(tinycolor("violet").toHex(), "ee82ee"); + assertEquals(tinycolor("wheat").toHex(), "f5deb3"); + assertEquals(tinycolor("white").toHex(), "ffffff"); + assertEquals(tinycolor("whitesmoke").toHex(), "f5f5f5"); + assertEquals(tinycolor("yellow").toHex(), "ffff00"); + assertEquals(tinycolor("yellowgreen").toHex(), "9acd32"); + + assertEquals(tinycolor("#f00").toName(), "red"); + assertEquals(tinycolor("#fa0a0a").toName(), false); +}); + +Deno.test("Invalid alpha should normalize to 1", function () { + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: -1 }).toRgbString(), + "rgb(255, 20, 10)", + "Negative value" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: -0 }).toRgbString(), + "rgba(255, 20, 10, 0)", + "Negative 0" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: 0 }).toRgbString(), + "rgba(255, 20, 10, 0)", + "0" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: 0.5 }).toRgbString(), + "rgba(255, 20, 10, 0.5)", + ".5" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: 1 }).toRgbString(), + "rgb(255, 20, 10)", + "1" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: 100 }).toRgbString(), + "rgb(255, 20, 10)", + "Greater than 1" + ); + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: "asdfasd" }).toRgbString(), + "rgb(255, 20, 10)", + "Non Numeric" + ); + + assertEquals( + tinycolor("#fff").toRgbString(), + "rgb(255, 255, 255)", + "Hex should be 1" + ); + assertEquals( + tinycolor("rgba 255 0 0 100").toRgbString(), + "rgb(255, 0, 0)", + "Greater than 1 in string parsing" + ); +}); + +Deno.test("toString() with alpha set", function () { + var redNamed = tinycolor.fromRatio( + { r: 255, g: 0, b: 0, a: 0.6 }, + { + format: "name", + } + ); + var transparentNamed = tinycolor.fromRatio( + { r: 255, g: 0, b: 0, a: 0 }, + { + format: "name", + } + ); + var redHex = tinycolor.fromRatio( + { r: 255, g: 0, b: 0, a: 0.4 }, + { + format: "hex", + } + ); + + assertEquals(redNamed.getFormat(), "name", "getFormat() is correct"); + assertEquals(redHex.getFormat(), "hex", "getFormat() is correct"); + + assertEquals( + redNamed.toString(), + "rgba(255, 0, 0, 0.6)", + "Names should default to rgba if alpha is < 1" + ); + assertEquals( + redHex.toString(), + "rgba(255, 0, 0, 0.4)", + "Hex should default to rgba if alpha is < 1" + ); + + assertEquals( + redNamed.toString("hex"), + "#ff0000", + "Names should not be returned as rgba if format is specified" + ); + assertEquals( + redNamed.toString("hex6"), + "#ff0000", + "Names should not be returned as rgba if format is specified" + ); + assertEquals( + redNamed.toString("hex3"), + "#f00", + "Names should not be returned as rgba if format is specified" + ); + assertEquals( + redNamed.toString("hex8"), + "#ff000099", + "Names should not be returned as rgba if format is specified" + ); + assertEquals( + redNamed.toString("hex4"), + "#f009", + "Names should not be returned as rgba if format is specified" + ); + assertEquals( + redNamed.toString("name"), + "#ff0000", + "Semi transparent names should return hex in toString() if name format is specified" + ); + + assertEquals( + redNamed.toName(), + false, + "Semi transparent names should be false in toName()" + ); + + assertEquals( + redHex.toString(), + "rgba(255, 0, 0, 0.4)", + "Hex should default to rgba if alpha is < 1" + ); + assertEquals( + transparentNamed.toString(), + "transparent", + "Named color should equal transparent if alpha == 0" + ); + + redHex.setAlpha(0); + assertEquals( + redHex.toString(), + "rgba(255, 0, 0, 0)", + "Hex should default to rgba if alpha is = 0" + ); +}); + +Deno.test("setting alpha", function () { + var hexSetter = tinycolor("rgba(255, 0, 0, 1)"); + assertEquals(hexSetter.getAlpha(), 1, "Alpha should start as 1"); + var returnedFromSetAlpha = hexSetter.setAlpha(0.9); + assertEquals( + returnedFromSetAlpha, + hexSetter, + "setAlpha return value should be the color." + ); + assertEquals(hexSetter.getAlpha(), 0.9, "setAlpha should change alpha value"); + hexSetter.setAlpha(0.5); + assertEquals(hexSetter.getAlpha(), 0.5, "setAlpha should change alpha value"); + hexSetter.setAlpha(0); + assertEquals(hexSetter.getAlpha(), 0, "setAlpha should change alpha value"); + hexSetter.setAlpha(-1); + assertEquals( + hexSetter.getAlpha(), + 1, + "setAlpha with value < 0 should be bound to 1" + ); + hexSetter.setAlpha(2); + assertEquals( + hexSetter.getAlpha(), + 1, + "setAlpha with value > 1 should be bound to 1" + ); + hexSetter.setAlpha(); + assertEquals( + hexSetter.getAlpha(), + 1, + "setAlpha with invalid value should be bound to 1" + ); + hexSetter.setAlpha(null); + assertEquals( + hexSetter.getAlpha(), + 1, + "setAlpha with invalid value should be bound to 1" + ); + hexSetter.setAlpha("test"); + assertEquals( + hexSetter.getAlpha(), + 1, + "setAlpha with invalid value should be bound to 1" + ); +}); + +Deno.test("Alpha = 0 should act differently on toName()", function () { + assertEquals( + tinycolor({ r: 255, g: 20, b: 10, a: 0 }).toName(), + "transparent", + "0" + ); + assertEquals( + tinycolor("transparent").toString(), + "transparent", + "toString when passed" + ); + assertEquals(tinycolor("transparent").toHex(), "000000", "toHex"); +}); + +Deno.test("getBrightness", function () { + assertEquals(tinycolor("#000").getBrightness(), 0, "returns 0 for #000"); + assertEquals(tinycolor("#fff").getBrightness(), 255, "returns 255 for #fff"); +}); + +Deno.test("getLuminance", function () { + assertEquals(tinycolor("#000").getLuminance(), 0, "returns 0 for #000"); + assertEquals(tinycolor("#fff").getLuminance(), 1, "returns 1 for #fff"); +}); + +Deno.test("isDark returns true/false for dark/light colors", function () { + assertEquals(tinycolor("#000").isDark(), true, "#000 is dark"); + assertEquals(tinycolor("#111").isDark(), true, "#111 is dark"); + assertEquals(tinycolor("#222").isDark(), true, "#222 is dark"); + assertEquals(tinycolor("#333").isDark(), true, "#333 is dark"); + assertEquals(tinycolor("#444").isDark(), true, "#444 is dark"); + assertEquals(tinycolor("#555").isDark(), true, "#555 is dark"); + assertEquals(tinycolor("#666").isDark(), true, "#666 is dark"); + assertEquals(tinycolor("#777").isDark(), true, "#777 is dark"); + assertEquals(tinycolor("#888").isDark(), false, "#888 is not dark"); + assertEquals(tinycolor("#999").isDark(), false, "#999 is not dark"); + assertEquals(tinycolor("#aaa").isDark(), false, "#aaa is not dark"); + assertEquals(tinycolor("#bbb").isDark(), false, "#bbb is not dark"); + assertEquals(tinycolor("#ccc").isDark(), false, "#ccc is not dark"); + assertEquals(tinycolor("#ddd").isDark(), false, "#ddd is not dark"); + assertEquals(tinycolor("#eee").isDark(), false, "#eee is not dark"); + assertEquals(tinycolor("#fff").isDark(), false, "#fff is not dark"); +}); + +Deno.test("isLight returns true/false for light/dark colors", function () { + assertEquals(tinycolor("#000").isLight(), false, "#000 is not light"); + assertEquals(tinycolor("#111").isLight(), false, "#111 is not light"); + assertEquals(tinycolor("#222").isLight(), false, "#222 is not light"); + assertEquals(tinycolor("#333").isLight(), false, "#333 is not light"); + assertEquals(tinycolor("#444").isLight(), false, "#444 is not light"); + assertEquals(tinycolor("#555").isLight(), false, "#555 is not light"); + assertEquals(tinycolor("#666").isLight(), false, "#666 is not light"); + assertEquals(tinycolor("#777").isLight(), false, "#777 is not light"); + assertEquals(tinycolor("#888").isLight(), true, "#888 is light"); + assertEquals(tinycolor("#999").isLight(), true, "#999 is light"); + assertEquals(tinycolor("#aaa").isLight(), true, "#aaa is light"); + assertEquals(tinycolor("#bbb").isLight(), true, "#bbb is light"); + assertEquals(tinycolor("#ccc").isLight(), true, "#ccc is light"); + assertEquals(tinycolor("#ddd").isLight(), true, "#ddd is light"); + assertEquals(tinycolor("#eee").isLight(), true, "#eee is light"); + assertEquals(tinycolor("#fff").isLight(), true, "#fff is light"); +}); + +Deno.test("HSL Object", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + assertEquals( + tiny.toHexString(), + tinycolor(tiny.toHsl()).toHexString(), + "HSL Object" + ); + } +}); + +Deno.test("HSL String", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + var input = tiny.toRgb(); + var output = tinycolor(tiny.toHslString()).toRgb(); + var maxDiff = 2; + + assertEquals( + Math.abs(input.r - output.r) <= maxDiff, + true, + "toHslString red value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.g - output.g) <= maxDiff, + true, + "toHslString green value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.b - output.b) <= maxDiff, + true, + "toHslString blue value difference <= " + maxDiff + ); + } +}); + +Deno.test("HSV String", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + var input = tiny.toRgb(); + var output = tinycolor(tiny.toHsvString()).toRgb(); + var maxDiff = 2; + + assertEquals( + Math.abs(input.r - output.r) <= maxDiff, + true, + "toHsvString red value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.g - output.g) <= maxDiff, + true, + "toHsvString green value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.b - output.b) <= maxDiff, + true, + "toHsvString blue value difference <= " + maxDiff + ); + } +}); + +Deno.test("HSV Object", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + assertEquals( + tiny.toHexString(), + tinycolor(tiny.toHsv()).toHexString(), + "HSV Object" + ); + } +}); + +Deno.test("RGB Object", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + assertEquals( + tiny.toHexString(), + tinycolor(tiny.toRgb()).toHexString(), + "RGB Object" + ); + } +}); + +Deno.test("RGB String", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + assertEquals( + tiny.toHexString(), + tinycolor(tiny.toRgbString()).toHexString(), + "RGB String" + ); + } +}); + +Deno.test("PRGB Object", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + var input = tiny.toRgb(); + var output = tinycolor(tiny.toPercentageRgb()).toRgb(); + var maxDiff = 2; + + assertEquals( + Math.abs(input.r - output.r) <= maxDiff, + true, + "Red value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.g - output.g) <= maxDiff, + true, + "Green value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.b - output.b) <= maxDiff, + true, + "Blue value difference <= " + maxDiff + ); + } +}); + +Deno.test("PRGB String", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + var input = tiny.toRgb(); + var output = tinycolor(tiny.toPercentageRgbString()).toRgb(); + var maxDiff = 2; + + assertEquals( + Math.abs(input.r - output.r) <= maxDiff, + true, + "Red value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.g - output.g) <= maxDiff, + true, + "Green value difference <= " + maxDiff + ); + assertEquals( + Math.abs(input.b - output.b) <= maxDiff, + true, + "Blue value difference <= " + maxDiff + ); + } +}); + +Deno.test("Object", function () { + for (var i = 0; i < conversions.length; i++) { + var c = conversions[i]; + var tiny = tinycolor(c.hex); + assertEquals(tiny.toHexString(), tinycolor(tiny).toHexString(), "Object"); + } +}); + +Deno.test("Color equality", function () { + assert(tinycolor.equals("#ff0000", "#ff0000"), "Same hex"); + assert(tinycolor.equals("#ff0000", "rgb(255, 0, 0)"), "Same alphas"); + assert( + !tinycolor.equals("#ff0000", "rgba(255, 0, 0, .1)"), + "Different alphas" + ); + assert(tinycolor.equals("#ff000066", "rgba(255, 0, 0, .4)"), "Same alphas"); + assert(tinycolor.equals("#f009", "rgba(255, 0, 0, .6)"), "Same alphas"); + assert(tinycolor.equals("#336699CC", "369C"), "Same hex"); + assert(tinycolor.equals("ff0000", "#ff0000"), "Same hex"); + assert(tinycolor.equals("#f00", "#ff0000"), "Same hex"); + assert(tinycolor.equals("#f00", "#ff0000"), "Same hex"); + assert(tinycolor.equals("f00", "#ff0000"), "Same hex"); + assertEquals(tinycolor("010101").toHexString(), "#010101"); + assert(!tinycolor.equals("#ff0000", "#00ff00"), "Different hex"); + assert( + tinycolor.equals("#ff8000", "rgb(100%, 50%, 0%)"), + "Percentage bounds checking" + ); +}); + +Deno.test("isReadable", function () { + // "#ff0088", "#8822aa" (values used in old WCAG1 tests) + assert( + tinycolor.isReadable("#000000", "#ffffff", { level: "AA", size: "small" }), + "white/black is readable" + ); + assert( + !tinycolor.isReadable("#ff0088", "#5c1a72", {}), + "not readable - empty wcag2 object" + ); + assert( + !tinycolor.isReadable("#ff0088", "#8822aa", { level: "AA", size: "small" }), + "not readable - AA small" + ); + assert( + !tinycolor.isReadable("#ff0088", "#8822aa", { level: "AA", size: "large" }), + "not readable - AA large" + ); + assert( + !tinycolor.isReadable("#ff0088", "#8822aa", { + level: "AAA", + size: "small", + }), + "not readable - AAA small" + ); + assert( + !tinycolor.isReadable("#ff0088", "#8822aa", { + level: "AAA", + size: "large", + }), + "not readable - AAA large" + ); + + // values derived from and validated using the calculators at http://www.dasplankton.de/ContrastA/ + // and http://webaim.org/resources/contrastchecker/ + + // "#ff0088", "#5c1a72": contrast ratio 3.04 + assert( + !tinycolor.isReadable("#ff0088", "#5c1a72", { level: "AA", size: "small" }), + "not readable - AA small" + ); + assert( + tinycolor.isReadable("#ff0088", "#5c1a72", { level: "AA", size: "large" }), + "readable - AA large" + ); + assert( + !tinycolor.isReadable("#ff0088", "#5c1a72", { + level: "AAA", + size: "small", + }), + "not readable - AAA small" + ); + assert( + !tinycolor.isReadable("#ff0088", "#5c1a72", { + level: "AAA", + size: "large", + }), + "not readable - AAA large" + ); + + // "#ff0088", "#2e0c3a": contrast ratio 4.56 + assert( + tinycolor.isReadable("#ff0088", "#2e0c3a", { level: "AA", size: "small" }), + "readable - AA small" + ); + assert( + tinycolor.isReadable("#ff0088", "#2e0c3a", { level: "AA", size: "large" }), + "readable - AA large" + ); + assert( + !tinycolor.isReadable("#ff0088", "#2e0c3a", { + level: "AAA", + size: "small", + }), + "not readable - AAA small" + ); + assert( + tinycolor.isReadable("#ff0088", "#2e0c3a", { level: "AAA", size: "large" }), + "readable - AAA large" + ); + + // "#db91b8", "#2e0c3a": contrast ratio 7.12 + assert( + tinycolor.isReadable("#db91b8", "#2e0c3a", { level: "AA", size: "small" }), + "readable - AA small" + ); + assert( + tinycolor.isReadable("#db91b8", "#2e0c3a", { level: "AA", size: "large" }), + "readable - AA large" + ); + assert( + tinycolor.isReadable("#db91b8", "#2e0c3a", { level: "AAA", size: "small" }), + "readable - AAA small" + ); + assert( + tinycolor.isReadable("#db91b8", "#2e0c3a", { level: "AAA", size: "large" }), + "readable - AAA large" + ); +}); + +Deno.test("readability", function () { + // check return values from readability function. See isReadable above for standards tests. + assertEquals( + tinycolor.readability("#000", "#000"), + 1, + "Readability function test 0" + ); + assertEquals( + tinycolor.readability("#000", "#111"), + 1.1121078324840545, + "Readability function test 1" + ); + assertEquals( + tinycolor.readability("#000", "#fff"), + 21, + "Readability function test 2" + ); +}); + +Deno.test("mostReadable", function () { + assertEquals( + tinycolor + .mostReadable("#000", ["#111", "#222", { wcag2: {} }]) + .toHexString(), + "#222222", + "readable color present" + ); + assertEquals( + tinycolor + .mostReadable("#f00", ["#d00", "#0d0"], { wcag2: {} }) + .toHexString(), + "#00dd00", + "readable color present" + ); + assertEquals( + tinycolor + .mostReadable("#fff", ["#fff", "#fff"], { wcag2: {} }) + .toHexString(), + "#ffffff", + "no different color in list" + ); + //includeFallbackColors + assertEquals( + tinycolor + .mostReadable("#fff", ["#fff", "#fff"], { + includeFallbackColors: true, + }) + .toHexString(), + "#000000", + "no different color in list" + ); + assertEquals( + tinycolor + .mostReadable("#123", ["#124", "#125"], { + includeFallbackColors: false, + }) + .toHexString(), + "#112255", + "no readable color in list" + ); + assertEquals( + tinycolor + .mostReadable("#123", ["#000", "#fff"], { + includeFallbackColors: false, + }) + .toHexString(), + "#ffffff", + "verify assumption" + ); + assertEquals( + tinycolor + .mostReadable("#123", ["#124", "#125"], { + includeFallbackColors: true, + }) + .toHexString(), + "#ffffff", + "no readable color in list" + ); + + assertEquals( + tinycolor + .mostReadable("#ff0088", ["#000", "#fff"], { + includeFallbackColors: false, + }) + .toHexString(), + "#000000", + "verify assumption" + ); + assertEquals( + tinycolor + .mostReadable("#ff0088", ["#2e0c3a"], { + includeFallbackColors: true, + level: "AAA", + size: "large", + }) + .toHexString(), + "#2e0c3a", + "readable color present" + ); + assertEquals( + tinycolor + .mostReadable("#ff0088", ["#2e0c3a"], { + includeFallbackColors: true, + level: "AAA", + size: "small", + }) + .toHexString(), + "#000000", + "no readable color in list" + ); + + assertEquals( + tinycolor + .mostReadable("#371b2c", ["#000", "#fff"], { + includeFallbackColors: false, + }) + .toHexString(), + "#ffffff", + "verify assumption" + ); + assertEquals( + tinycolor + .mostReadable("#371b2c", ["#a9acb6"], { + includeFallbackColors: true, + level: "AAA", + size: "large", + }) + .toHexString(), + "#a9acb6", + "readable color present" + ); + assertEquals( + tinycolor + .mostReadable("#371b2c", ["#a9acb6"], { + includeFallbackColors: true, + level: "AAA", + size: "small", + }) + .toHexString(), + "#ffffff", + "no readable color in list" + ); +}); + +Deno.test("Filters", function () { + assertEquals( + tinycolor("red").toFilter(), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffff0000,endColorstr=#ffff0000)" + ); + assertEquals( + tinycolor("red").toFilter("blue"), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffff0000,endColorstr=#ff0000ff)" + ); + + assertEquals( + tinycolor("transparent").toFilter(), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000,endColorstr=#00000000)" + ); + assertEquals( + tinycolor("transparent").toFilter("red"), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000,endColorstr=#ffff0000)" + ); + + assertEquals( + tinycolor("#f0f0f0dd").toFilter(), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ddf0f0f0,endColorstr=#ddf0f0f0)" + ); + assertEquals( + tinycolor("rgba(0, 0, 255, .5").toFilter(), + "progid:DXImageTransform.Microsoft.gradient(startColorstr=#800000ff,endColorstr=#800000ff)" + ); +}); + +/* Originally generated with: +var results = []; +for (var i = 0; i <= 100; i++) results.push( tinycolor.saturate("red", i).toHex() ) +console.log(JSON.stringify(results)) +*/ +var DESATURATIONS = [ + "ff0000", + "fe0101", + "fc0303", + "fb0404", + "fa0505", + "f90606", + "f70808", + "f60909", + "f50a0a", + "f40b0b", + "f20d0d", + "f10e0e", + "f00f0f", + "ee1111", + "ed1212", + "ec1313", + "eb1414", + "e91616", + "e81717", + "e71818", + "e61919", + "e41b1b", + "e31c1c", + "e21d1d", + "e01f1f", + "df2020", + "de2121", + "dd2222", + "db2424", + "da2525", + "d92626", + "d72828", + "d62929", + "d52a2a", + "d42b2b", + "d22d2d", + "d12e2e", + "d02f2f", + "cf3030", + "cd3232", + "cc3333", + "cb3434", + "c93636", + "c83737", + "c73838", + "c63939", + "c43b3b", + "c33c3c", + "c23d3d", + "c13e3e", + "bf4040", + "be4141", + "bd4242", + "bb4444", + "ba4545", + "b94646", + "b84747", + "b64949", + "b54a4a", + "b44b4b", + "b34d4d", + "b14e4e", + "b04f4f", + "af5050", + "ad5252", + "ac5353", + "ab5454", + "aa5555", + "a85757", + "a75858", + "a65959", + "a45b5b", + "a35c5c", + "a25d5d", + "a15e5e", + "9f6060", + "9e6161", + "9d6262", + "9c6363", + "9a6565", + "996666", + "986767", + "966969", + "956a6a", + "946b6b", + "936c6c", + "916e6e", + "906f6f", + "8f7070", + "8e7171", + "8c7373", + "8b7474", + "8a7575", + "887777", + "877878", + "867979", + "857a7a", + "837c7c", + "827d7d", + "817e7e", + "808080", +]; +var SATURATIONS = [ + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", + "ff0000", +]; +var LIGHTENS = [ + "ff0000", + "ff0505", + "ff0a0a", + "ff0f0f", + "ff1414", + "ff1a1a", + "ff1f1f", + "ff2424", + "ff2929", + "ff2e2e", + "ff3333", + "ff3838", + "ff3d3d", + "ff4242", + "ff4747", + "ff4d4d", + "ff5252", + "ff5757", + "ff5c5c", + "ff6161", + "ff6666", + "ff6b6b", + "ff7070", + "ff7575", + "ff7a7a", + "ff8080", + "ff8585", + "ff8a8a", + "ff8f8f", + "ff9494", + "ff9999", + "ff9e9e", + "ffa3a3", + "ffa8a8", + "ffadad", + "ffb3b3", + "ffb8b8", + "ffbdbd", + "ffc2c2", + "ffc7c7", + "ffcccc", + "ffd1d1", + "ffd6d6", + "ffdbdb", + "ffe0e0", + "ffe5e5", + "ffebeb", + "fff0f0", + "fff5f5", + "fffafa", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", + "ffffff", +]; +var BRIGHTENS = [ + "ff0000", + "ff0303", + "ff0505", + "ff0808", + "ff0a0a", + "ff0d0d", + "ff0f0f", + "ff1212", + "ff1414", + "ff1717", + "ff1919", + "ff1c1c", + "ff1f1f", + "ff2121", + "ff2424", + "ff2626", + "ff2929", + "ff2b2b", + "ff2e2e", + "ff3030", + "ff3333", + "ff3636", + "ff3838", + "ff3b3b", + "ff3d3d", + "ff4040", + "ff4242", + "ff4545", + "ff4747", + "ff4a4a", + "ff4c4c", + "ff4f4f", + "ff5252", + "ff5454", + "ff5757", + "ff5959", + "ff5c5c", + "ff5e5e", + "ff6161", + "ff6363", + "ff6666", + "ff6969", + "ff6b6b", + "ff6e6e", + "ff7070", + "ff7373", + "ff7575", + "ff7878", + "ff7a7a", + "ff7d7d", + "ff7f7f", + "ff8282", + "ff8585", + "ff8787", + "ff8a8a", + "ff8c8c", + "ff8f8f", + "ff9191", + "ff9494", + "ff9696", + "ff9999", + "ff9c9c", + "ff9e9e", + "ffa1a1", + "ffa3a3", + "ffa6a6", + "ffa8a8", + "ffabab", + "ffadad", + "ffb0b0", + "ffb2b2", + "ffb5b5", + "ffb8b8", + "ffbaba", + "ffbdbd", + "ffbfbf", + "ffc2c2", + "ffc4c4", + "ffc7c7", + "ffc9c9", + "ffcccc", + "ffcfcf", + "ffd1d1", + "ffd4d4", + "ffd6d6", + "ffd9d9", + "ffdbdb", + "ffdede", + "ffe0e0", + "ffe3e3", + "ffe5e5", + "ffe8e8", + "ffebeb", + "ffeded", + "fff0f0", + "fff2f2", + "fff5f5", + "fff7f7", + "fffafa", + "fffcfc", + "ffffff", +]; +var DARKENS = [ + "ff0000", + "fa0000", + "f50000", + "f00000", + "eb0000", + "e60000", + "e00000", + "db0000", + "d60000", + "d10000", + "cc0000", + "c70000", + "c20000", + "bd0000", + "b80000", + "b30000", + "ad0000", + "a80000", + "a30000", + "9e0000", + "990000", + "940000", + "8f0000", + "8a0000", + "850000", + "800000", + "7a0000", + "750000", + "700000", + "6b0000", + "660000", + "610000", + "5c0000", + "570000", + "520000", + "4d0000", + "470000", + "420000", + "3d0000", + "380000", + "330000", + "2e0000", + "290000", + "240000", + "1f0000", + "190000", + "140000", + "0f0000", + "0a0000", + "050000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", + "000000", +]; + +Deno.test("Modifications", function () { + for (var i = 0; i <= 100; i++) { + assertEquals( + tinycolor("red").desaturate(i).toHex(), + DESATURATIONS[i], + "Desaturation " + i + " works" + ); + } + for (var i = 0; i <= 100; i++) { + assertEquals( + tinycolor("red").saturate(i).toHex(), + SATURATIONS[i], + "Saturation " + i + " works" + ); + } + for (var i = 0; i <= 100; i++) { + assertEquals( + tinycolor("red").lighten(i).toHex(), + LIGHTENS[i], + "Lighten " + i + " works" + ); + } + for (var i = 0; i <= 100; i++) { + assertEquals( + tinycolor("red").brighten(i).toHex(), + BRIGHTENS[i], + "Brighter " + i + " works" + ); + } + for (var i = 0; i <= 100; i++) { + assertEquals( + tinycolor("red").darken(i).toHex(), + DARKENS[i], + "Darken " + i + " works" + ); + } + + assertEquals( + tinycolor("red").greyscale().toHex(), + "808080", + "Greyscale works" + ); +}); + +Deno.test("Spin", function () { + assertEquals( + Math.round(tinycolor("#f00").spin(-1234).toHsl().h), + 206, + "Spinning -1234 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(-360).toHsl().h), + 0, + "Spinning -360 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(-120).toHsl().h), + 240, + "Spinning -120 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(0).toHsl().h), + 0, + "Spinning 0 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(10).toHsl().h), + 10, + "Spinning 10 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(360).toHsl().h), + 0, + "Spinning 360 works" + ); + assertEquals( + Math.round(tinycolor("#f00").spin(2345).toHsl().h), + 185, + "Spinning 2345 works" + ); + + [-360, 0, 360].forEach(function (delta) { + Object.keys(tinycolor.names).forEach(function (name) { + assertEquals( + tinycolor(name).toHex(), + tinycolor(name).spin(delta).toHex(), + "Spinning " + delta.toString() + " has no effect" + ); + }); + }); +}); + +Deno.test("Mix", function () { + // amount 0 or none + assertEquals( + tinycolor.mix("#000", "#fff").toHsl().l, + 0.5, + "Mixing without amount works" + ); + assertEquals( + tinycolor.mix("#f00", "#000", 0).toHex(), + "ff0000", + "Mixing with 0 amount works" + ); + // This case checks the the problem with floating point numbers (eg 255/90) + assertEquals( + tinycolor.mix("#fff", "#000", 90).toHex(), + "1a1a1a", + "Mixing with 90 amount works correctly" + ); + + // black and white + for (var i = 0; i < 100; i++) { + assertEquals( + Math.round(tinycolor.mix("#000", "#fff", i).toHsl().l * 100) / 100, + i / 100, + "Mixing black and white with " + i + " amount works" + ); + } + + // with colors + for (var i = 0; i < 100; i++) { + var new_hex = Math.round((255 * (100 - i)) / 100).toString(16); + + if (new_hex.length === 1) { + new_hex = "0" + new_hex; + } + + assertEquals( + tinycolor.mix("#f00", "#000", i).toHex(), + new_hex + "0000", + "Mixing " + i + " (red channel)" + ); + assertEquals( + tinycolor.mix("#0f0", "#000", i).toHex(), + "00" + new_hex + "00", + "Mixing " + i + " (green channel)" + ); + assertEquals( + tinycolor.mix("#00f", "#000", i).toHex(), + "0000" + new_hex, + "Mixing " + i + " (blue channel)" + ); + assertEquals( + tinycolor.mix(tinycolor("transparent"), "#000", i).toRgb().a, + i / 100, + "Mixing " + i + " (alpha channel)" + ); + } +}); + +// The combination tests need to be expanded furthe + +function colorsToHexString(colors) { + return colors + .map(function (c) { + return c.toHex(); + }) + .join(","); +} + +Deno.test("complement", function () { + var complementDoesntModifyInstance = tinycolor("red"); + assertEquals( + complementDoesntModifyInstance.complement().toHex(), + "00ffff", + "Complement works" + ); + assertEquals( + complementDoesntModifyInstance.toHex(), + "ff0000", + "Complement did not modify this color" + ); +}); + +Deno.test("analogous", function () { + var combination = tinycolor("red").analogous(); + assertEquals( + colorsToHexString(combination), + "ff0000,ff0066,ff0033,ff0000,ff3300,ff6600", + "Correct Combination" + ); +}); + +Deno.test("monochromatic", function () { + var combination = tinycolor("red").monochromatic(); + assertEquals( + colorsToHexString(combination), + "ff0000,2a0000,550000,800000,aa0000,d40000", + "Correct Combination" + ); +}); + +Deno.test("splitcomplement", function () { + var combination = tinycolor("red").splitcomplement(); + assertEquals( + colorsToHexString(combination), + "ff0000,ccff00,0066ff", + "Correct Combination" + ); +}); + +Deno.test("triad", function () { + var combination = tinycolor("red").triad(); + assertEquals( + colorsToHexString(combination), + "ff0000,00ff00,0000ff", + "Correct Combination" + ); +}); + +Deno.test("tetrad", function () { + var combination = tinycolor("red").tetrad(); + assertEquals( + colorsToHexString(combination), + "ff0000,80ff00,00ffff,7f00ff", + "Correct Combination" + ); +}); + +Deno.test({ + name: "polyad", + // Disabled until https://github.com/bgrins/TinyColor/issues/254 + ignore: true, + fn: function () { + assertThrows(() => { + tinycolor("red").polyad(); + }); + assertThrows(() => { + tinycolor("red").polyad(-1); + }); + assertThrows(() => { + tinycolor("red").polyad("invalid"); + }); + assertEquals(colorsToHexString(tinycolor("red").polyad(1)), "ff0000"); + assertEquals(colorsToHexString(tinycolor("red").polyad("1")), "ff0000"); + assertEquals( + colorsToHexString(tinycolor("red").polyad(2)), + "ff0000,00ffff" + ); + assertEquals( + colorsToHexString(tinycolor("red").polyad(3)), + "ff0000,00ff00,0000ff" + ); + assertEquals( + colorsToHexString(tinycolor("red").polyad(4)), + "ff0000,80ff00,00ffff,7f00ff" + ); + assertEquals( + colorsToHexString(tinycolor("red").polyad(5)), + "ff0000,ccff00,00ff66,0066ff,cc00ff" + ); + }, +}); + +runDenoTests(); diff --git a/project starter code/node_modules/tinycolor2/esm/test_template.js b/project starter code/node_modules/tinycolor2/esm/test_template.js new file mode 100644 index 00000000..84914f76 --- /dev/null +++ b/project starter code/node_modules/tinycolor2/esm/test_template.js @@ -0,0 +1,24 @@ +// This file is autogenerated. +// Ideally it wouldn't exist, but it's here to test cjs in node +// Changes should go into ./test.js, and if new assertions are needed +// they'll need to be shimmed here as well +import tinycolor from "./tinycolor.js"; +import { Deno, testDefinitions } from "@deno/shim-deno-test"; +const { assertEquals, assert, assertThrows } = await import( + "../deno_asserts@0.168.0.mjs" +); +async function runDenoTests() { + for (const test of testDefinitions) { + if (test.ignore) { + console.log(`Ignoring ${test.name}`); + continue; + } + console.log(`Running ${test.name}`); + await test.fn(); + console.log(`> Passed ${test.name}`); + } +} + +// CONTENT_GOES_HERE + +runDenoTests(); diff --git a/project starter code/node_modules/tinycolor2/esm/tinycolor.js b/project starter code/node_modules/tinycolor2/esm/tinycolor.js new file mode 100644 index 00000000..374f5ea9 --- /dev/null +++ b/project starter code/node_modules/tinycolor2/esm/tinycolor.js @@ -0,0 +1,1180 @@ +// This file is autogenerated. It's used to publish ESM to npm. +function _typeof(obj) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, _typeof(obj); +} + +// https://github.com/bgrins/TinyColor +// Brian Grinstead, MIT License + +var trimLeft = /^\s+/; +var trimRight = /\s+$/; +function tinycolor(color, opts) { + color = color ? color : ""; + opts = opts || {}; + + // If input is already a tinycolor, return itself + if (color instanceof tinycolor) { + return color; + } + // If we are called as a function, call using new instead + if (!(this instanceof tinycolor)) { + return new tinycolor(color, opts); + } + var rgb = inputToRGB(color); + this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format; + this._gradientType = opts.gradientType; + + // Don't let the range of [0,255] come back in [0,1]. + // Potentially lose a little bit of precision here, but will fix issues where + // .5 gets interpreted as half of the total, instead of half of 1 + // If it was supposed to be 128, this was already taken care of by `inputToRgb` + if (this._r < 1) this._r = Math.round(this._r); + if (this._g < 1) this._g = Math.round(this._g); + if (this._b < 1) this._b = Math.round(this._b); + this._ok = rgb.ok; +} +tinycolor.prototype = { + isDark: function isDark() { + return this.getBrightness() < 128; + }, + isLight: function isLight() { + return !this.isDark(); + }, + isValid: function isValid() { + return this._ok; + }, + getOriginalInput: function getOriginalInput() { + return this._originalInput; + }, + getFormat: function getFormat() { + return this._format; + }, + getAlpha: function getAlpha() { + return this._a; + }, + getBrightness: function getBrightness() { + //http://www.w3.org/TR/AERT#color-contrast + var rgb = this.toRgb(); + return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000; + }, + getLuminance: function getLuminance() { + //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef + var rgb = this.toRgb(); + var RsRGB, GsRGB, BsRGB, R, G, B; + RsRGB = rgb.r / 255; + GsRGB = rgb.g / 255; + BsRGB = rgb.b / 255; + if (RsRGB <= 0.03928) R = RsRGB / 12.92;else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4); + if (GsRGB <= 0.03928) G = GsRGB / 12.92;else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4); + if (BsRGB <= 0.03928) B = BsRGB / 12.92;else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4); + return 0.2126 * R + 0.7152 * G + 0.0722 * B; + }, + setAlpha: function setAlpha(value) { + this._a = boundAlpha(value); + this._roundA = Math.round(100 * this._a) / 100; + return this; + }, + toHsv: function toHsv() { + var hsv = rgbToHsv(this._r, this._g, this._b); + return { + h: hsv.h * 360, + s: hsv.s, + v: hsv.v, + a: this._a + }; + }, + toHsvString: function toHsvString() { + var hsv = rgbToHsv(this._r, this._g, this._b); + var h = Math.round(hsv.h * 360), + s = Math.round(hsv.s * 100), + v = Math.round(hsv.v * 100); + return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")"; + }, + toHsl: function toHsl() { + var hsl = rgbToHsl(this._r, this._g, this._b); + return { + h: hsl.h * 360, + s: hsl.s, + l: hsl.l, + a: this._a + }; + }, + toHslString: function toHslString() { + var hsl = rgbToHsl(this._r, this._g, this._b); + var h = Math.round(hsl.h * 360), + s = Math.round(hsl.s * 100), + l = Math.round(hsl.l * 100); + return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")"; + }, + toHex: function toHex(allow3Char) { + return rgbToHex(this._r, this._g, this._b, allow3Char); + }, + toHexString: function toHexString(allow3Char) { + return "#" + this.toHex(allow3Char); + }, + toHex8: function toHex8(allow4Char) { + return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char); + }, + toHex8String: function toHex8String(allow4Char) { + return "#" + this.toHex8(allow4Char); + }, + toRgb: function toRgb() { + return { + r: Math.round(this._r), + g: Math.round(this._g), + b: Math.round(this._b), + a: this._a + }; + }, + toRgbString: function toRgbString() { + return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")"; + }, + toPercentageRgb: function toPercentageRgb() { + return { + r: Math.round(bound01(this._r, 255) * 100) + "%", + g: Math.round(bound01(this._g, 255) * 100) + "%", + b: Math.round(bound01(this._b, 255) * 100) + "%", + a: this._a + }; + }, + toPercentageRgbString: function toPercentageRgbString() { + return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")"; + }, + toName: function toName() { + if (this._a === 0) { + return "transparent"; + } + if (this._a < 1) { + return false; + } + return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false; + }, + toFilter: function toFilter(secondColor) { + var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a); + var secondHex8String = hex8String; + var gradientType = this._gradientType ? "GradientType = 1, " : ""; + if (secondColor) { + var s = tinycolor(secondColor); + secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a); + } + return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")"; + }, + toString: function toString(format) { + var formatSet = !!format; + format = format || this._format; + var formattedString = false; + var hasAlpha = this._a < 1 && this._a >= 0; + var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name"); + if (needsAlphaFormat) { + // Special case for "transparent", all other non-alpha formats + // will return rgba when there is transparency. + if (format === "name" && this._a === 0) { + return this.toName(); + } + return this.toRgbString(); + } + if (format === "rgb") { + formattedString = this.toRgbString(); + } + if (format === "prgb") { + formattedString = this.toPercentageRgbString(); + } + if (format === "hex" || format === "hex6") { + formattedString = this.toHexString(); + } + if (format === "hex3") { + formattedString = this.toHexString(true); + } + if (format === "hex4") { + formattedString = this.toHex8String(true); + } + if (format === "hex8") { + formattedString = this.toHex8String(); + } + if (format === "name") { + formattedString = this.toName(); + } + if (format === "hsl") { + formattedString = this.toHslString(); + } + if (format === "hsv") { + formattedString = this.toHsvString(); + } + return formattedString || this.toHexString(); + }, + clone: function clone() { + return tinycolor(this.toString()); + }, + _applyModification: function _applyModification(fn, args) { + var color = fn.apply(null, [this].concat([].slice.call(args))); + this._r = color._r; + this._g = color._g; + this._b = color._b; + this.setAlpha(color._a); + return this; + }, + lighten: function lighten() { + return this._applyModification(_lighten, arguments); + }, + brighten: function brighten() { + return this._applyModification(_brighten, arguments); + }, + darken: function darken() { + return this._applyModification(_darken, arguments); + }, + desaturate: function desaturate() { + return this._applyModification(_desaturate, arguments); + }, + saturate: function saturate() { + return this._applyModification(_saturate, arguments); + }, + greyscale: function greyscale() { + return this._applyModification(_greyscale, arguments); + }, + spin: function spin() { + return this._applyModification(_spin, arguments); + }, + _applyCombination: function _applyCombination(fn, args) { + return fn.apply(null, [this].concat([].slice.call(args))); + }, + analogous: function analogous() { + return this._applyCombination(_analogous, arguments); + }, + complement: function complement() { + return this._applyCombination(_complement, arguments); + }, + monochromatic: function monochromatic() { + return this._applyCombination(_monochromatic, arguments); + }, + splitcomplement: function splitcomplement() { + return this._applyCombination(_splitcomplement, arguments); + }, + // Disabled until https://github.com/bgrins/TinyColor/issues/254 + // polyad: function (number) { + // return this._applyCombination(polyad, [number]); + // }, + triad: function triad() { + return this._applyCombination(polyad, [3]); + }, + tetrad: function tetrad() { + return this._applyCombination(polyad, [4]); + } +}; + +// If input is an object, force 1 into "1.0" to handle ratios properly +// String input requires "1.0" as input, so 1 will be treated as 1 +tinycolor.fromRatio = function (color, opts) { + if (_typeof(color) == "object") { + var newColor = {}; + for (var i in color) { + if (color.hasOwnProperty(i)) { + if (i === "a") { + newColor[i] = color[i]; + } else { + newColor[i] = convertToPercentage(color[i]); + } + } + } + color = newColor; + } + return tinycolor(color, opts); +}; + +// Given a string or object, convert that input to RGB +// Possible string inputs: +// +// "red" +// "#f00" or "f00" +// "#ff0000" or "ff0000" +// "#ff000000" or "ff000000" +// "rgb 255 0 0" or "rgb (255, 0, 0)" +// "rgb 1.0 0 0" or "rgb (1, 0, 0)" +// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" +// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" +// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" +// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" +// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" +// +function inputToRGB(color) { + var rgb = { + r: 0, + g: 0, + b: 0 + }; + var a = 1; + var s = null; + var v = null; + var l = null; + var ok = false; + var format = false; + if (typeof color == "string") { + color = stringInputToObject(color); + } + if (_typeof(color) == "object") { + if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { + rgb = rgbToRgb(color.r, color.g, color.b); + ok = true; + format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; + } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { + s = convertToPercentage(color.s); + v = convertToPercentage(color.v); + rgb = hsvToRgb(color.h, s, v); + ok = true; + format = "hsv"; + } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { + s = convertToPercentage(color.s); + l = convertToPercentage(color.l); + rgb = hslToRgb(color.h, s, l); + ok = true; + format = "hsl"; + } + if (color.hasOwnProperty("a")) { + a = color.a; + } + } + a = boundAlpha(a); + return { + ok: ok, + format: color.format || format, + r: Math.min(255, Math.max(rgb.r, 0)), + g: Math.min(255, Math.max(rgb.g, 0)), + b: Math.min(255, Math.max(rgb.b, 0)), + a: a + }; +} + +// Conversion Functions +// -------------------- + +// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: +// + +// `rgbToRgb` +// Handle bounds / percentage checking to conform to CSS color spec +// +// *Assumes:* r, g, b in [0, 255] or [0, 1] +// *Returns:* { r, g, b } in [0, 255] +function rgbToRgb(r, g, b) { + return { + r: bound01(r, 255) * 255, + g: bound01(g, 255) * 255, + b: bound01(b, 255) * 255 + }; +} + +// `rgbToHsl` +// Converts an RGB color value to HSL. +// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] +// *Returns:* { h, s, l } in [0,1] +function rgbToHsl(r, g, b) { + r = bound01(r, 255); + g = bound01(g, 255); + b = bound01(b, 255); + var max = Math.max(r, g, b), + min = Math.min(r, g, b); + var h, + s, + l = (max + min) / 2; + if (max == min) { + h = s = 0; // achromatic + } else { + var d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + switch (max) { + case r: + h = (g - b) / d + (g < b ? 6 : 0); + break; + case g: + h = (b - r) / d + 2; + break; + case b: + h = (r - g) / d + 4; + break; + } + h /= 6; + } + return { + h: h, + s: s, + l: l + }; +} + +// `hslToRgb` +// Converts an HSL color value to RGB. +// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] +// *Returns:* { r, g, b } in the set [0, 255] +function hslToRgb(h, s, l) { + var r, g, b; + h = bound01(h, 360); + s = bound01(s, 100); + l = bound01(l, 100); + function hue2rgb(p, q, t) { + if (t < 0) t += 1; + if (t > 1) t -= 1; + if (t < 1 / 6) return p + (q - p) * 6 * t; + if (t < 1 / 2) return q; + if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; + return p; + } + if (s === 0) { + r = g = b = l; // achromatic + } else { + var q = l < 0.5 ? l * (1 + s) : l + s - l * s; + var p = 2 * l - q; + r = hue2rgb(p, q, h + 1 / 3); + g = hue2rgb(p, q, h); + b = hue2rgb(p, q, h - 1 / 3); + } + return { + r: r * 255, + g: g * 255, + b: b * 255 + }; +} + +// `rgbToHsv` +// Converts an RGB color value to HSV +// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] +// *Returns:* { h, s, v } in [0,1] +function rgbToHsv(r, g, b) { + r = bound01(r, 255); + g = bound01(g, 255); + b = bound01(b, 255); + var max = Math.max(r, g, b), + min = Math.min(r, g, b); + var h, + s, + v = max; + var d = max - min; + s = max === 0 ? 0 : d / max; + if (max == min) { + h = 0; // achromatic + } else { + switch (max) { + case r: + h = (g - b) / d + (g < b ? 6 : 0); + break; + case g: + h = (b - r) / d + 2; + break; + case b: + h = (r - g) / d + 4; + break; + } + h /= 6; + } + return { + h: h, + s: s, + v: v + }; +} + +// `hsvToRgb` +// Converts an HSV color value to RGB. +// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] +// *Returns:* { r, g, b } in the set [0, 255] +function hsvToRgb(h, s, v) { + h = bound01(h, 360) * 6; + s = bound01(s, 100); + v = bound01(v, 100); + var i = Math.floor(h), + f = h - i, + p = v * (1 - s), + q = v * (1 - f * s), + t = v * (1 - (1 - f) * s), + mod = i % 6, + r = [v, q, p, p, t, v][mod], + g = [t, v, v, q, p, p][mod], + b = [p, p, t, v, v, q][mod]; + return { + r: r * 255, + g: g * 255, + b: b * 255 + }; +} + +// `rgbToHex` +// Converts an RGB color to hex +// Assumes r, g, and b are contained in the set [0, 255] +// Returns a 3 or 6 character hex +function rgbToHex(r, g, b, allow3Char) { + var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))]; + + // Return a 3 character hex if possible + if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) { + return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); + } + return hex.join(""); +} + +// `rgbaToHex` +// Converts an RGBA color plus alpha transparency to hex +// Assumes r, g, b are contained in the set [0, 255] and +// a in [0, 1]. Returns a 4 or 8 character rgba hex +function rgbaToHex(r, g, b, a, allow4Char) { + var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))]; + + // Return a 4 character hex if possible + if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) { + return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0); + } + return hex.join(""); +} + +// `rgbaToArgbHex` +// Converts an RGBA color to an ARGB Hex8 string +// Rarely used, but required for "toFilter()" +function rgbaToArgbHex(r, g, b, a) { + var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))]; + return hex.join(""); +} + +// `equals` +// Can be called with any tinycolor input +tinycolor.equals = function (color1, color2) { + if (!color1 || !color2) return false; + return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); +}; +tinycolor.random = function () { + return tinycolor.fromRatio({ + r: Math.random(), + g: Math.random(), + b: Math.random() + }); +}; + +// Modification Functions +// ---------------------- +// Thanks to less.js for some of the basics here +// + +function _desaturate(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.s -= amount / 100; + hsl.s = clamp01(hsl.s); + return tinycolor(hsl); +} +function _saturate(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.s += amount / 100; + hsl.s = clamp01(hsl.s); + return tinycolor(hsl); +} +function _greyscale(color) { + return tinycolor(color).desaturate(100); +} +function _lighten(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.l += amount / 100; + hsl.l = clamp01(hsl.l); + return tinycolor(hsl); +} +function _brighten(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var rgb = tinycolor(color).toRgb(); + rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100)))); + rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100)))); + rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100)))); + return tinycolor(rgb); +} +function _darken(color, amount) { + amount = amount === 0 ? 0 : amount || 10; + var hsl = tinycolor(color).toHsl(); + hsl.l -= amount / 100; + hsl.l = clamp01(hsl.l); + return tinycolor(hsl); +} + +// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. +// Values outside of this range will be wrapped into this range. +function _spin(color, amount) { + var hsl = tinycolor(color).toHsl(); + var hue = (hsl.h + amount) % 360; + hsl.h = hue < 0 ? 360 + hue : hue; + return tinycolor(hsl); +} + +// Combination Functions +// --------------------- +// Thanks to jQuery xColor for some of the ideas behind these +// + +function _complement(color) { + var hsl = tinycolor(color).toHsl(); + hsl.h = (hsl.h + 180) % 360; + return tinycolor(hsl); +} +function polyad(color, number) { + if (isNaN(number) || number <= 0) { + throw new Error("Argument to polyad must be a positive number"); + } + var hsl = tinycolor(color).toHsl(); + var result = [tinycolor(color)]; + var step = 360 / number; + for (var i = 1; i < number; i++) { + result.push(tinycolor({ + h: (hsl.h + i * step) % 360, + s: hsl.s, + l: hsl.l + })); + } + return result; +} +function _splitcomplement(color) { + var hsl = tinycolor(color).toHsl(); + var h = hsl.h; + return [tinycolor(color), tinycolor({ + h: (h + 72) % 360, + s: hsl.s, + l: hsl.l + }), tinycolor({ + h: (h + 216) % 360, + s: hsl.s, + l: hsl.l + })]; +} +function _analogous(color, results, slices) { + results = results || 6; + slices = slices || 30; + var hsl = tinycolor(color).toHsl(); + var part = 360 / slices; + var ret = [tinycolor(color)]; + for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) { + hsl.h = (hsl.h + part) % 360; + ret.push(tinycolor(hsl)); + } + return ret; +} +function _monochromatic(color, results) { + results = results || 6; + var hsv = tinycolor(color).toHsv(); + var h = hsv.h, + s = hsv.s, + v = hsv.v; + var ret = []; + var modification = 1 / results; + while (results--) { + ret.push(tinycolor({ + h: h, + s: s, + v: v + })); + v = (v + modification) % 1; + } + return ret; +} + +// Utility Functions +// --------------------- + +tinycolor.mix = function (color1, color2, amount) { + amount = amount === 0 ? 0 : amount || 50; + var rgb1 = tinycolor(color1).toRgb(); + var rgb2 = tinycolor(color2).toRgb(); + var p = amount / 100; + var rgba = { + r: (rgb2.r - rgb1.r) * p + rgb1.r, + g: (rgb2.g - rgb1.g) * p + rgb1.g, + b: (rgb2.b - rgb1.b) * p + rgb1.b, + a: (rgb2.a - rgb1.a) * p + rgb1.a + }; + return tinycolor(rgba); +}; + +// Readability Functions +// --------------------- +// false +// tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false +tinycolor.isReadable = function (color1, color2, wcag2) { + var readability = tinycolor.readability(color1, color2); + var wcag2Parms, out; + out = false; + wcag2Parms = validateWCAG2Parms(wcag2); + switch (wcag2Parms.level + wcag2Parms.size) { + case "AAsmall": + case "AAAlarge": + out = readability >= 4.5; + break; + case "AAlarge": + out = readability >= 3; + break; + case "AAAsmall": + out = readability >= 7; + break; + } + return out; +}; + +// `mostReadable` +// Given a base color and a list of possible foreground or background +// colors for that base, returns the most readable color. +// Optionally returns Black or White if the most readable color is unreadable. +// *Example* +// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" +// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" +// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3" +// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff" +tinycolor.mostReadable = function (baseColor, colorList, args) { + var bestColor = null; + var bestScore = 0; + var readability; + var includeFallbackColors, level, size; + args = args || {}; + includeFallbackColors = args.includeFallbackColors; + level = args.level; + size = args.size; + for (var i = 0; i < colorList.length; i++) { + readability = tinycolor.readability(baseColor, colorList[i]); + if (readability > bestScore) { + bestScore = readability; + bestColor = tinycolor(colorList[i]); + } + } + if (tinycolor.isReadable(baseColor, bestColor, { + level: level, + size: size + }) || !includeFallbackColors) { + return bestColor; + } else { + args.includeFallbackColors = false; + return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args); + } +}; + +// Big List of Colors +// ------------------ +// +var names = tinycolor.names = { + aliceblue: "f0f8ff", + antiquewhite: "faebd7", + aqua: "0ff", + aquamarine: "7fffd4", + azure: "f0ffff", + beige: "f5f5dc", + bisque: "ffe4c4", + black: "000", + blanchedalmond: "ffebcd", + blue: "00f", + blueviolet: "8a2be2", + brown: "a52a2a", + burlywood: "deb887", + burntsienna: "ea7e5d", + cadetblue: "5f9ea0", + chartreuse: "7fff00", + chocolate: "d2691e", + coral: "ff7f50", + cornflowerblue: "6495ed", + cornsilk: "fff8dc", + crimson: "dc143c", + cyan: "0ff", + darkblue: "00008b", + darkcyan: "008b8b", + darkgoldenrod: "b8860b", + darkgray: "a9a9a9", + darkgreen: "006400", + darkgrey: "a9a9a9", + darkkhaki: "bdb76b", + darkmagenta: "8b008b", + darkolivegreen: "556b2f", + darkorange: "ff8c00", + darkorchid: "9932cc", + darkred: "8b0000", + darksalmon: "e9967a", + darkseagreen: "8fbc8f", + darkslateblue: "483d8b", + darkslategray: "2f4f4f", + darkslategrey: "2f4f4f", + darkturquoise: "00ced1", + darkviolet: "9400d3", + deeppink: "ff1493", + deepskyblue: "00bfff", + dimgray: "696969", + dimgrey: "696969", + dodgerblue: "1e90ff", + firebrick: "b22222", + floralwhite: "fffaf0", + forestgreen: "228b22", + fuchsia: "f0f", + gainsboro: "dcdcdc", + ghostwhite: "f8f8ff", + gold: "ffd700", + goldenrod: "daa520", + gray: "808080", + green: "008000", + greenyellow: "adff2f", + grey: "808080", + honeydew: "f0fff0", + hotpink: "ff69b4", + indianred: "cd5c5c", + indigo: "4b0082", + ivory: "fffff0", + khaki: "f0e68c", + lavender: "e6e6fa", + lavenderblush: "fff0f5", + lawngreen: "7cfc00", + lemonchiffon: "fffacd", + lightblue: "add8e6", + lightcoral: "f08080", + lightcyan: "e0ffff", + lightgoldenrodyellow: "fafad2", + lightgray: "d3d3d3", + lightgreen: "90ee90", + lightgrey: "d3d3d3", + lightpink: "ffb6c1", + lightsalmon: "ffa07a", + lightseagreen: "20b2aa", + lightskyblue: "87cefa", + lightslategray: "789", + lightslategrey: "789", + lightsteelblue: "b0c4de", + lightyellow: "ffffe0", + lime: "0f0", + limegreen: "32cd32", + linen: "faf0e6", + magenta: "f0f", + maroon: "800000", + mediumaquamarine: "66cdaa", + mediumblue: "0000cd", + mediumorchid: "ba55d3", + mediumpurple: "9370db", + mediumseagreen: "3cb371", + mediumslateblue: "7b68ee", + mediumspringgreen: "00fa9a", + mediumturquoise: "48d1cc", + mediumvioletred: "c71585", + midnightblue: "191970", + mintcream: "f5fffa", + mistyrose: "ffe4e1", + moccasin: "ffe4b5", + navajowhite: "ffdead", + navy: "000080", + oldlace: "fdf5e6", + olive: "808000", + olivedrab: "6b8e23", + orange: "ffa500", + orangered: "ff4500", + orchid: "da70d6", + palegoldenrod: "eee8aa", + palegreen: "98fb98", + paleturquoise: "afeeee", + palevioletred: "db7093", + papayawhip: "ffefd5", + peachpuff: "ffdab9", + peru: "cd853f", + pink: "ffc0cb", + plum: "dda0dd", + powderblue: "b0e0e6", + purple: "800080", + rebeccapurple: "663399", + red: "f00", + rosybrown: "bc8f8f", + royalblue: "4169e1", + saddlebrown: "8b4513", + salmon: "fa8072", + sandybrown: "f4a460", + seagreen: "2e8b57", + seashell: "fff5ee", + sienna: "a0522d", + silver: "c0c0c0", + skyblue: "87ceeb", + slateblue: "6a5acd", + slategray: "708090", + slategrey: "708090", + snow: "fffafa", + springgreen: "00ff7f", + steelblue: "4682b4", + tan: "d2b48c", + teal: "008080", + thistle: "d8bfd8", + tomato: "ff6347", + turquoise: "40e0d0", + violet: "ee82ee", + wheat: "f5deb3", + white: "fff", + whitesmoke: "f5f5f5", + yellow: "ff0", + yellowgreen: "9acd32" +}; + +// Make it easy to access colors via `hexNames[hex]` +var hexNames = tinycolor.hexNames = flip(names); + +// Utilities +// --------- + +// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }` +function flip(o) { + var flipped = {}; + for (var i in o) { + if (o.hasOwnProperty(i)) { + flipped[o[i]] = i; + } + } + return flipped; +} + +// Return a valid alpha value [0,1] with all invalid values being set to 1 +function boundAlpha(a) { + a = parseFloat(a); + if (isNaN(a) || a < 0 || a > 1) { + a = 1; + } + return a; +} + +// Take input from [0, n] and return it as [0, 1] +function bound01(n, max) { + if (isOnePointZero(n)) n = "100%"; + var processPercent = isPercentage(n); + n = Math.min(max, Math.max(0, parseFloat(n))); + + // Automatically convert percentage into number + if (processPercent) { + n = parseInt(n * max, 10) / 100; + } + + // Handle floating point rounding errors + if (Math.abs(n - max) < 0.000001) { + return 1; + } + + // Convert into [0, 1] range if it isn't already + return n % max / parseFloat(max); +} + +// Force a number between 0 and 1 +function clamp01(val) { + return Math.min(1, Math.max(0, val)); +} + +// Parse a base-16 hex value into a base-10 integer +function parseIntFromHex(val) { + return parseInt(val, 16); +} + +// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 +// +function isOnePointZero(n) { + return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1; +} + +// Check to see if string passed in is a percentage +function isPercentage(n) { + return typeof n === "string" && n.indexOf("%") != -1; +} + +// Force a hex value to have 2 characters +function pad2(c) { + return c.length == 1 ? "0" + c : "" + c; +} + +// Replace a decimal with it's percentage value +function convertToPercentage(n) { + if (n <= 1) { + n = n * 100 + "%"; + } + return n; +} + +// Converts a decimal to a hex value +function convertDecimalToHex(d) { + return Math.round(parseFloat(d) * 255).toString(16); +} +// Converts a hex value to a decimal +function convertHexToDecimal(h) { + return parseIntFromHex(h) / 255; +} +var matchers = function () { + // + var CSS_INTEGER = "[-\\+]?\\d+%?"; + + // + var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; + + // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome. + var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; + + // Actual matching. + // Parentheses and commas are optional, but not required. + // Whitespace can take the place of commas or opening paren + var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; + var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; + return { + CSS_UNIT: new RegExp(CSS_UNIT), + rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), + rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), + hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), + hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), + hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), + hsva: new RegExp("hsva" + PERMISSIVE_MATCH4), + hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, + hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, + hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, + hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ + }; +}(); + +// `isValidCSSUnit` +// Take in a single string / number and check to see if it looks like a CSS unit +// (see `matchers` above for definition). +function isValidCSSUnit(color) { + return !!matchers.CSS_UNIT.exec(color); +} + +// `stringInputToObject` +// Permissive string parsing. Take in a number of formats, and output an object +// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` +function stringInputToObject(color) { + color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase(); + var named = false; + if (names[color]) { + color = names[color]; + named = true; + } else if (color == "transparent") { + return { + r: 0, + g: 0, + b: 0, + a: 0, + format: "name" + }; + } + + // Try to match string input using regular expressions. + // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] + // Just return an object and let the conversion functions handle that. + // This way the result will be the same whether the tinycolor is initialized with string or object. + var match; + if (match = matchers.rgb.exec(color)) { + return { + r: match[1], + g: match[2], + b: match[3] + }; + } + if (match = matchers.rgba.exec(color)) { + return { + r: match[1], + g: match[2], + b: match[3], + a: match[4] + }; + } + if (match = matchers.hsl.exec(color)) { + return { + h: match[1], + s: match[2], + l: match[3] + }; + } + if (match = matchers.hsla.exec(color)) { + return { + h: match[1], + s: match[2], + l: match[3], + a: match[4] + }; + } + if (match = matchers.hsv.exec(color)) { + return { + h: match[1], + s: match[2], + v: match[3] + }; + } + if (match = matchers.hsva.exec(color)) { + return { + h: match[1], + s: match[2], + v: match[3], + a: match[4] + }; + } + if (match = matchers.hex8.exec(color)) { + return { + r: parseIntFromHex(match[1]), + g: parseIntFromHex(match[2]), + b: parseIntFromHex(match[3]), + a: convertHexToDecimal(match[4]), + format: named ? "name" : "hex8" + }; + } + if (match = matchers.hex6.exec(color)) { + return { + r: parseIntFromHex(match[1]), + g: parseIntFromHex(match[2]), + b: parseIntFromHex(match[3]), + format: named ? "name" : "hex" + }; + } + if (match = matchers.hex4.exec(color)) { + return { + r: parseIntFromHex(match[1] + "" + match[1]), + g: parseIntFromHex(match[2] + "" + match[2]), + b: parseIntFromHex(match[3] + "" + match[3]), + a: convertHexToDecimal(match[4] + "" + match[4]), + format: named ? "name" : "hex8" + }; + } + if (match = matchers.hex3.exec(color)) { + return { + r: parseIntFromHex(match[1] + "" + match[1]), + g: parseIntFromHex(match[2] + "" + match[2]), + b: parseIntFromHex(match[3] + "" + match[3]), + format: named ? "name" : "hex" + }; + } + return false; +} +function validateWCAG2Parms(parms) { + // return valid WCAG2 parms for isReadable. + // If input parms are invalid, return {"level":"AA", "size":"small"} + var level, size; + parms = parms || { + level: "AA", + size: "small" + }; + level = (parms.level || "AA").toUpperCase(); + size = (parms.size || "small").toLowerCase(); + if (level !== "AA" && level !== "AAA") { + level = "AA"; + } + if (size !== "small" && size !== "large") { + size = "small"; + } + return { + level: level, + size: size + }; +} + +export { tinycolor as default }; diff --git a/project starter code/node_modules/tinycolor2/index.html b/project starter code/node_modules/tinycolor2/index.html deleted file mode 100644 index 776329bc..00000000 --- a/project starter code/node_modules/tinycolor2/index.html +++ /dev/null @@ -1,248 +0,0 @@ - - - - - - - TinyColor - Fast, small color manipulation in JavaScript - - - - - - - -
-

TinyColor

-

Fast, small color manipulation and conversion for JavaScript

- -

- TinyColor is a micro framework for inputting colors and - outputting colors as different formats. - Input is meant to be as permissive as possible. -

- -

Usage Documentation

-

Read all the documentation on the TinyColor project page on - github.

- -

Code

-

View the annotated source code or see the full source on github.

- -

Tests

-

View the QUnit Tests.

- -

Demo

-
-
-

- Enter a color: -

-

- Or try these: - red - 0f0 - rgb 255 128 128 - hsl(0, 100%, 50%) - hsv 0, 100%, 50% -

-

And I'll tell you what I know about it:

-
- -

-
-			
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lighten -
-
Darken -
-
Saturate -
-
Desaturate -
-
Greyscale -
-
Brighten -
-
Most Readable -
-
-
- -
- - - - - - - - - - - - - - - - - - - - - -
Triad -
-
Tetrad -
-
Monochromatic -
-
Analogous -
-
Split Complements -
-
-
-
- - -

Credit

-

- Developed by Brian Grinstead. Big thanks to the following places: -

-
    -
  • less.js for some of the - modification functions
  • -
  • jQuery xColor for some of - the combination functions
  • -
  • w3.org for the color list and parsing rules
  • -
  • mjijackson.com - for the first stab at RGB / HSL / HSV converters
  • - -
- -
- - - \ No newline at end of file diff --git a/project starter code/node_modules/tinycolor2/package.json b/project starter code/node_modules/tinycolor2/package.json index 7c42eef7..5eb8c35d 100644 --- a/project starter code/node_modules/tinycolor2/package.json +++ b/project starter code/node_modules/tinycolor2/package.json @@ -1,5 +1,5 @@ { - "version": "1.5.1", + "version": "1.6.0", "name": "tinycolor2", "description": "Fast Color Parsing and Manipulation", "url": "http://bgrins.github.com/TinyColor", @@ -14,16 +14,22 @@ "tinycolor" ], "author": "Brian Grinstead (http://briangrinstead.com)", - "main": "./tinycolor.js", - "engines": { - "node": "*" + "bugs": { + "url": "https://github.com/bgrins/TinyColor/issues" + }, + "module": "./esm/tinycolor.js", + "main": "./cjs/tinycolor.js", + "browser": "./cjs/tinycolor.js", + "exports": { + ".": { + "import": "./esm/tinycolor.js", + "require": "./cjs/tinycolor.js" + } + }, + "scripts": { + "test": "node cjs/test.js && node esm/test.js" }, "devDependencies": { - "grunt": "~0.4.1", - "grunt-contrib-concat": "~0.1.3", - "grunt-contrib-jshint": "~0.1.1", - "grunt-contrib-qunit": "^4.0.0", - "grunt-contrib-uglify": "~0.2.0", - "grunt-docco": "~0.2.0" + "@deno/shim-deno-test": "^0.4.0" } } diff --git a/project starter code/node_modules/tinycolor2/test/index.html b/project starter code/node_modules/tinycolor2/test/index.html deleted file mode 100644 index 757435ea..00000000 --- a/project starter code/node_modules/tinycolor2/test/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - -

TinyColor Tests

-

-
-

-
    -
    test markup, will be hidden
    - - - \ No newline at end of file diff --git a/project starter code/node_modules/tinycolor2/test/qunit.css b/project starter code/node_modules/tinycolor2/test/qunit.css deleted file mode 100644 index cb4815b7..00000000 --- a/project starter code/node_modules/tinycolor2/test/qunit.css +++ /dev/null @@ -1,244 +0,0 @@ -/** - * QUnit v1.11.0 - A JavaScript Unit Testing Framework - * - * http://qunitjs.com - * - * Copyright 2012 jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - */ - -/** Font Family and Sizes */ - -#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult { - font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif; -} - -#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; } -#qunit-tests { font-size: smaller; } - - -/** Resets */ - -#qunit-tests, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter { - margin: 0; - padding: 0; -} - - -/** Header */ - -#qunit-header { - padding: 0.5em 0 0.5em 1em; - - color: #8699a4; - background-color: #0d3349; - - font-size: 1.5em; - line-height: 1em; - font-weight: normal; - - border-radius: 5px 5px 0 0; - -moz-border-radius: 5px 5px 0 0; - -webkit-border-top-right-radius: 5px; - -webkit-border-top-left-radius: 5px; -} - -#qunit-header a { - text-decoration: none; - color: #c2ccd1; -} - -#qunit-header a:hover, -#qunit-header a:focus { - color: #fff; -} - -#qunit-testrunner-toolbar label { - display: inline-block; - padding: 0 .5em 0 .1em; -} - -#qunit-banner { - height: 5px; -} - -#qunit-testrunner-toolbar { - padding: 0.5em 0 0.5em 2em; - color: #5E740B; - background-color: #eee; - overflow: hidden; -} - -#qunit-userAgent { - padding: 0.5em 0 0.5em 2.5em; - background-color: #2b81af; - color: #fff; - text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px; -} - -#qunit-modulefilter-container { - float: right; -} - -/** Tests: Pass/Fail */ - -#qunit-tests { - list-style-position: inside; -} - -#qunit-tests li { - padding: 0.4em 0.5em 0.4em 2.5em; - border-bottom: 1px solid #fff; - list-style-position: inside; -} - -#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running { - display: none; -} - -#qunit-tests li strong { - cursor: pointer; -} - -#qunit-tests li a { - padding: 0.5em; - color: #c2ccd1; - text-decoration: none; -} -#qunit-tests li a:hover, -#qunit-tests li a:focus { - color: #000; -} - -#qunit-tests li .runtime { - float: right; - font-size: smaller; -} - -.qunit-assert-list { - margin-top: 0.5em; - padding: 0.5em; - - background-color: #fff; - - border-radius: 5px; - -moz-border-radius: 5px; - -webkit-border-radius: 5px; -} - -.qunit-collapsed { - display: none; -} - -#qunit-tests table { - border-collapse: collapse; - margin-top: .2em; -} - -#qunit-tests th { - text-align: right; - vertical-align: top; - padding: 0 .5em 0 0; -} - -#qunit-tests td { - vertical-align: top; -} - -#qunit-tests pre { - margin: 0; - white-space: pre-wrap; - word-wrap: break-word; -} - -#qunit-tests del { - background-color: #e0f2be; - color: #374e0c; - text-decoration: none; -} - -#qunit-tests ins { - background-color: #ffcaca; - color: #500; - text-decoration: none; -} - -/*** Test Counts */ - -#qunit-tests b.counts { color: black; } -#qunit-tests b.passed { color: #5E740B; } -#qunit-tests b.failed { color: #710909; } - -#qunit-tests li li { - padding: 5px; - background-color: #fff; - border-bottom: none; - list-style-position: inside; -} - -/*** Passing Styles */ - -#qunit-tests li li.pass { - color: #3c510c; - background-color: #fff; - border-left: 10px solid #C6E746; -} - -#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; } -#qunit-tests .pass .test-name { color: #366097; } - -#qunit-tests .pass .test-actual, -#qunit-tests .pass .test-expected { color: #999999; } - -#qunit-banner.qunit-pass { background-color: #C6E746; } - -/*** Failing Styles */ - -#qunit-tests li li.fail { - color: #710909; - background-color: #fff; - border-left: 10px solid #EE5757; - white-space: pre; -} - -#qunit-tests > li:last-child { - border-radius: 0 0 5px 5px; - -moz-border-radius: 0 0 5px 5px; - -webkit-border-bottom-right-radius: 5px; - -webkit-border-bottom-left-radius: 5px; -} - -#qunit-tests .fail { color: #000000; background-color: #EE5757; } -#qunit-tests .fail .test-name, -#qunit-tests .fail .module-name { color: #000000; } - -#qunit-tests .fail .test-actual { color: #EE5757; } -#qunit-tests .fail .test-expected { color: green; } - -#qunit-banner.qunit-fail { background-color: #EE5757; } - - -/** Result */ - -#qunit-testresult { - padding: 0.5em 0.5em 0.5em 2.5em; - - color: #2b81af; - background-color: #D2E0E6; - - border-bottom: 1px solid white; -} -#qunit-testresult .module-name { - font-weight: bold; -} - -/** Fixture */ - -#qunit-fixture { - position: absolute; - top: -10000px; - left: -10000px; - width: 1000px; - height: 1000px; -} \ No newline at end of file diff --git a/project starter code/node_modules/tinycolor2/test/qunit.js b/project starter code/node_modules/tinycolor2/test/qunit.js deleted file mode 100644 index 97294187..00000000 --- a/project starter code/node_modules/tinycolor2/test/qunit.js +++ /dev/null @@ -1,2152 +0,0 @@ -/** - * QUnit v1.11.0 - A JavaScript Unit Testing Framework - * - * http://qunitjs.com - * - * Copyright 2012 jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - */ - -(function( window ) { - -var QUnit, - assert, - config, - onErrorFnPrev, - testId = 0, - fileName = (sourceFromStacktrace( 0 ) || "" ).replace(/(:\d+)+\)?/, "").replace(/.+\//, ""), - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - // Keep a local reference to Date (GH-283) - Date = window.Date, - defined = { - setTimeout: typeof window.setTimeout !== "undefined", - sessionStorage: (function() { - var x = "qunit-test-string"; - try { - sessionStorage.setItem( x, x ); - sessionStorage.removeItem( x ); - return true; - } catch( e ) { - return false; - } - }()) - }, - /** - * Provides a normalized error string, correcting an issue - * with IE 7 (and prior) where Error.prototype.toString is - * not properly implemented - * - * Based on http://es5.github.com/#x15.11.4.4 - * - * @param {String|Error} error - * @return {String} error message - */ - errorString = function( error ) { - var name, message, - errorString = error.toString(); - if ( errorString.substring( 0, 7 ) === "[object" ) { - name = error.name ? error.name.toString() : "Error"; - message = error.message ? error.message.toString() : ""; - if ( name && message ) { - return name + ": " + message; - } else if ( name ) { - return name; - } else if ( message ) { - return message; - } else { - return "Error"; - } - } else { - return errorString; - } - }, - /** - * Makes a clone of an object using only Array or Object as base, - * and copies over the own enumerable properties. - * - * @param {Object} obj - * @return {Object} New object with only the own properties (recursively). - */ - objectValues = function( obj ) { - // Grunt 0.3.x uses an older version of jshint that still has jshint/jshint#392. - /*jshint newcap: false */ - var key, val, - vals = QUnit.is( "array", obj ) ? [] : {}; - for ( key in obj ) { - if ( hasOwn.call( obj, key ) ) { - val = obj[key]; - vals[key] = val === Object(val) ? objectValues(val) : val; - } - } - return vals; - }; - -function Test( settings ) { - extend( this, settings ); - this.assertions = []; - this.testNumber = ++Test.count; -} - -Test.count = 0; - -Test.prototype = { - init: function() { - var a, b, li, - tests = id( "qunit-tests" ); - - if ( tests ) { - b = document.createElement( "strong" ); - b.innerHTML = this.nameHtml; - - // `a` initialized at top of scope - a = document.createElement( "a" ); - a.innerHTML = "Rerun"; - a.href = QUnit.url({ testNumber: this.testNumber }); - - li = document.createElement( "li" ); - li.appendChild( b ); - li.appendChild( a ); - li.className = "running"; - li.id = this.id = "qunit-test-output" + testId++; - - tests.appendChild( li ); - } - }, - setup: function() { - if ( this.module !== config.previousModule ) { - if ( config.previousModule ) { - runLoggingCallbacks( "moduleDone", QUnit, { - name: config.previousModule, - failed: config.moduleStats.bad, - passed: config.moduleStats.all - config.moduleStats.bad, - total: config.moduleStats.all - }); - } - config.previousModule = this.module; - config.moduleStats = { all: 0, bad: 0 }; - runLoggingCallbacks( "moduleStart", QUnit, { - name: this.module - }); - } else if ( config.autorun ) { - runLoggingCallbacks( "moduleStart", QUnit, { - name: this.module - }); - } - - config.current = this; - - this.testEnvironment = extend({ - setup: function() {}, - teardown: function() {} - }, this.moduleTestEnvironment ); - - this.started = +new Date(); - runLoggingCallbacks( "testStart", QUnit, { - name: this.testName, - module: this.module - }); - - // allow utility functions to access the current test environment - // TODO why?? - QUnit.current_testEnvironment = this.testEnvironment; - - if ( !config.pollution ) { - saveGlobal(); - } - if ( config.notrycatch ) { - this.testEnvironment.setup.call( this.testEnvironment ); - return; - } - try { - this.testEnvironment.setup.call( this.testEnvironment ); - } catch( e ) { - QUnit.pushFailure( "Setup failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) ); - } - }, - run: function() { - config.current = this; - - var running = id( "qunit-testresult" ); - - if ( running ) { - running.innerHTML = "Running:
    " + this.nameHtml; - } - - if ( this.async ) { - QUnit.stop(); - } - - this.callbackStarted = +new Date(); - - if ( config.notrycatch ) { - this.callback.call( this.testEnvironment, QUnit.assert ); - this.callbackRuntime = +new Date() - this.callbackStarted; - return; - } - - try { - this.callback.call( this.testEnvironment, QUnit.assert ); - this.callbackRuntime = +new Date() - this.callbackStarted; - } catch( e ) { - this.callbackRuntime = +new Date() - this.callbackStarted; - - QUnit.pushFailure( "Died on test #" + (this.assertions.length + 1) + " " + this.stack + ": " + ( e.message || e ), extractStacktrace( e, 0 ) ); - // else next test will carry the responsibility - saveGlobal(); - - // Restart the tests if they're blocking - if ( config.blocking ) { - QUnit.start(); - } - } - }, - teardown: function() { - config.current = this; - if ( config.notrycatch ) { - if ( typeof this.callbackRuntime === "undefined" ) { - this.callbackRuntime = +new Date() - this.callbackStarted; - } - this.testEnvironment.teardown.call( this.testEnvironment ); - return; - } else { - try { - this.testEnvironment.teardown.call( this.testEnvironment ); - } catch( e ) { - QUnit.pushFailure( "Teardown failed on " + this.testName + ": " + ( e.message || e ), extractStacktrace( e, 1 ) ); - } - } - checkPollution(); - }, - finish: function() { - config.current = this; - if ( config.requireExpects && this.expected === null ) { - QUnit.pushFailure( "Expected number of assertions to be defined, but expect() was not called.", this.stack ); - } else if ( this.expected !== null && this.expected !== this.assertions.length ) { - QUnit.pushFailure( "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run", this.stack ); - } else if ( this.expected === null && !this.assertions.length ) { - QUnit.pushFailure( "Expected at least one assertion, but none were run - call expect(0) to accept zero assertions.", this.stack ); - } - - var i, assertion, a, b, time, li, ol, - test = this, - good = 0, - bad = 0, - tests = id( "qunit-tests" ); - - this.runtime = +new Date() - this.started; - config.stats.all += this.assertions.length; - config.moduleStats.all += this.assertions.length; - - if ( tests ) { - ol = document.createElement( "ol" ); - ol.className = "qunit-assert-list"; - - for ( i = 0; i < this.assertions.length; i++ ) { - assertion = this.assertions[i]; - - li = document.createElement( "li" ); - li.className = assertion.result ? "pass" : "fail"; - li.innerHTML = assertion.message || ( assertion.result ? "okay" : "failed" ); - ol.appendChild( li ); - - if ( assertion.result ) { - good++; - } else { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - - // store result when possible - if ( QUnit.config.reorder && defined.sessionStorage ) { - if ( bad ) { - sessionStorage.setItem( "qunit-test-" + this.module + "-" + this.testName, bad ); - } else { - sessionStorage.removeItem( "qunit-test-" + this.module + "-" + this.testName ); - } - } - - if ( bad === 0 ) { - addClass( ol, "qunit-collapsed" ); - } - - // `b` initialized at top of scope - b = document.createElement( "strong" ); - b.innerHTML = this.nameHtml + " (" + bad + ", " + good + ", " + this.assertions.length + ")"; - - addEvent(b, "click", function() { - var next = b.parentNode.lastChild, - collapsed = hasClass( next, "qunit-collapsed" ); - ( collapsed ? removeClass : addClass )( next, "qunit-collapsed" ); - }); - - addEvent(b, "dblclick", function( e ) { - var target = e && e.target ? e.target : window.event.srcElement; - if ( target.nodeName.toLowerCase() === "span" || target.nodeName.toLowerCase() === "b" ) { - target = target.parentNode; - } - if ( window.location && target.nodeName.toLowerCase() === "strong" ) { - window.location = QUnit.url({ testNumber: test.testNumber }); - } - }); - - // `time` initialized at top of scope - time = document.createElement( "span" ); - time.className = "runtime"; - time.innerHTML = this.runtime + " ms"; - - // `li` initialized at top of scope - li = id( this.id ); - li.className = bad ? "fail" : "pass"; - li.removeChild( li.firstChild ); - a = li.firstChild; - li.appendChild( b ); - li.appendChild( a ); - li.appendChild( time ); - li.appendChild( ol ); - - } else { - for ( i = 0; i < this.assertions.length; i++ ) { - if ( !this.assertions[i].result ) { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - } - - runLoggingCallbacks( "testDone", QUnit, { - name: this.testName, - module: this.module, - failed: bad, - passed: this.assertions.length - bad, - total: this.assertions.length, - duration: this.runtime - }); - - QUnit.reset(); - - config.current = undefined; - }, - - queue: function() { - var bad, - test = this; - - synchronize(function() { - test.init(); - }); - function run() { - // each of these can by async - synchronize(function() { - test.setup(); - }); - synchronize(function() { - test.run(); - }); - synchronize(function() { - test.teardown(); - }); - synchronize(function() { - test.finish(); - }); - } - - // `bad` initialized at top of scope - // defer when previous test run passed, if storage is available - bad = QUnit.config.reorder && defined.sessionStorage && - +sessionStorage.getItem( "qunit-test-" + this.module + "-" + this.testName ); - - if ( bad ) { - run(); - } else { - synchronize( run, true ); - } - } -}; - -// Root QUnit object. -// `QUnit` initialized at top of scope -QUnit = { - - // call on start of module test to prepend name to all tests - module: function( name, testEnvironment ) { - config.currentModule = name; - config.currentModuleTestEnvironment = testEnvironment; - config.modules[name] = true; - }, - - asyncTest: function( testName, expected, callback ) { - if ( arguments.length === 2 ) { - callback = expected; - expected = null; - } - - QUnit.test( testName, expected, callback, true ); - }, - - test: function( testName, expected, callback, async ) { - var test, - nameHtml = "" + escapeText( testName ) + ""; - - if ( arguments.length === 2 ) { - callback = expected; - expected = null; - } - - if ( config.currentModule ) { - nameHtml = "" + escapeText( config.currentModule ) + ": " + nameHtml; - } - - test = new Test({ - nameHtml: nameHtml, - testName: testName, - expected: expected, - async: async, - callback: callback, - module: config.currentModule, - moduleTestEnvironment: config.currentModuleTestEnvironment, - stack: sourceFromStacktrace( 2 ) - }); - - if ( !validTest( test ) ) { - return; - } - - test.queue(); - }, - - // Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through. - expect: function( asserts ) { - if (arguments.length === 1) { - config.current.expected = asserts; - } else { - return config.current.expected; - } - }, - - start: function( count ) { - // QUnit hasn't been initialized yet. - // Note: RequireJS (et al) may delay onLoad - if ( config.semaphore === undefined ) { - QUnit.begin(function() { - // This is triggered at the top of QUnit.load, push start() to the event loop, to allow QUnit.load to finish first - setTimeout(function() { - QUnit.start( count ); - }); - }); - return; - } - - config.semaphore -= count || 1; - // don't start until equal number of stop-calls - if ( config.semaphore > 0 ) { - return; - } - // ignore if start is called more often then stop - if ( config.semaphore < 0 ) { - config.semaphore = 0; - QUnit.pushFailure( "Called start() while already started (QUnit.config.semaphore was 0 already)", null, sourceFromStacktrace(2) ); - return; - } - // A slight delay, to avoid any current callbacks - if ( defined.setTimeout ) { - window.setTimeout(function() { - if ( config.semaphore > 0 ) { - return; - } - if ( config.timeout ) { - clearTimeout( config.timeout ); - } - - config.blocking = false; - process( true ); - }, 13); - } else { - config.blocking = false; - process( true ); - } - }, - - stop: function( count ) { - config.semaphore += count || 1; - config.blocking = true; - - if ( config.testTimeout && defined.setTimeout ) { - clearTimeout( config.timeout ); - config.timeout = window.setTimeout(function() { - QUnit.ok( false, "Test timed out" ); - config.semaphore = 1; - QUnit.start(); - }, config.testTimeout ); - } - } -}; - -// `assert` initialized at top of scope -// Asssert helpers -// All of these must either call QUnit.push() or manually do: -// - runLoggingCallbacks( "log", .. ); -// - config.current.assertions.push({ .. }); -// We attach it to the QUnit object *after* we expose the public API, -// otherwise `assert` will become a global variable in browsers (#341). -assert = { - /** - * Asserts rough true-ish result. - * @name ok - * @function - * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" ); - */ - ok: function( result, msg ) { - if ( !config.current ) { - throw new Error( "ok() assertion outside test context, was " + sourceFromStacktrace(2) ); - } - result = !!result; - - var source, - details = { - module: config.current.module, - name: config.current.testName, - result: result, - message: msg - }; - - msg = escapeText( msg || (result ? "okay" : "failed" ) ); - msg = "" + msg + ""; - - if ( !result ) { - source = sourceFromStacktrace( 2 ); - if ( source ) { - details.source = source; - msg += "
    Source:
    " + escapeText( source ) + "
    "; - } - } - runLoggingCallbacks( "log", QUnit, details ); - config.current.assertions.push({ - result: result, - message: msg - }); - }, - - /** - * Assert that the first two arguments are equal, with an optional message. - * Prints out both actual and expected values. - * @name equal - * @function - * @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes.", "format() replaces {0} with next argument" ); - */ - equal: function( actual, expected, message ) { - /*jshint eqeqeq:false */ - QUnit.push( expected == actual, actual, expected, message ); - }, - - /** - * @name notEqual - * @function - */ - notEqual: function( actual, expected, message ) { - /*jshint eqeqeq:false */ - QUnit.push( expected != actual, actual, expected, message ); - }, - - /** - * @name propEqual - * @function - */ - propEqual: function( actual, expected, message ) { - actual = objectValues(actual); - expected = objectValues(expected); - QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); - }, - - /** - * @name notPropEqual - * @function - */ - notPropEqual: function( actual, expected, message ) { - actual = objectValues(actual); - expected = objectValues(expected); - QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); - }, - - /** - * @name deepEqual - * @function - */ - deepEqual: function( actual, expected, message ) { - QUnit.push( QUnit.equiv(actual, expected), actual, expected, message ); - }, - - /** - * @name notDeepEqual - * @function - */ - notDeepEqual: function( actual, expected, message ) { - QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message ); - }, - - /** - * @name strictEqual - * @function - */ - strictEqual: function( actual, expected, message ) { - QUnit.push( expected === actual, actual, expected, message ); - }, - - /** - * @name notStrictEqual - * @function - */ - notStrictEqual: function( actual, expected, message ) { - QUnit.push( expected !== actual, actual, expected, message ); - }, - - "throws": function( block, expected, message ) { - var actual, - expectedOutput = expected, - ok = false; - - // 'expected' is optional - if ( typeof expected === "string" ) { - message = expected; - expected = null; - } - - config.current.ignoreGlobalErrors = true; - try { - block.call( config.current.testEnvironment ); - } catch (e) { - actual = e; - } - config.current.ignoreGlobalErrors = false; - - if ( actual ) { - // we don't want to validate thrown error - if ( !expected ) { - ok = true; - expectedOutput = null; - // expected is a regexp - } else if ( QUnit.objectType( expected ) === "regexp" ) { - ok = expected.test( errorString( actual ) ); - // expected is a constructor - } else if ( actual instanceof expected ) { - ok = true; - // expected is a validation function which returns true is validation passed - } else if ( expected.call( {}, actual ) === true ) { - expectedOutput = null; - ok = true; - } - - QUnit.push( ok, actual, expectedOutput, message ); - } else { - QUnit.pushFailure( message, null, 'No exception was thrown.' ); - } - } -}; - -/** - * @deprecate since 1.8.0 - * Kept assertion helpers in root for backwards compatibility. - */ -extend( QUnit, assert ); - -/** - * @deprecated since 1.9.0 - * Kept root "raises()" for backwards compatibility. - * (Note that we don't introduce assert.raises). - */ -QUnit.raises = assert[ "throws" ]; - -/** - * @deprecated since 1.0.0, replaced with error pushes since 1.3.0 - * Kept to avoid TypeErrors for undefined methods. - */ -QUnit.equals = function() { - QUnit.push( false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead" ); -}; -QUnit.same = function() { - QUnit.push( false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead" ); -}; - -// We want access to the constructor's prototype -(function() { - function F() {} - F.prototype = QUnit; - QUnit = new F(); - // Make F QUnit's constructor so that we can add to the prototype later - QUnit.constructor = F; -}()); - -/** - * Config object: Maintain internal state - * Later exposed as QUnit.config - * `config` initialized at top of scope - */ -config = { - // The queue of tests to run - queue: [], - - // block until document ready - blocking: true, - - // when enabled, show only failing tests - // gets persisted through sessionStorage and can be changed in UI via checkbox - hidepassed: false, - - // by default, run previously failed tests first - // very useful in combination with "Hide passed tests" checked - reorder: true, - - // by default, modify document.title when suite is done - altertitle: true, - - // when enabled, all tests must call expect() - requireExpects: false, - - // add checkboxes that are persisted in the query-string - // when enabled, the id is set to `true` as a `QUnit.config` property - urlConfig: [ - { - id: "noglobals", - label: "Check for Globals", - tooltip: "Enabling this will test if any test introduces new properties on the `window` object. Stored as query-strings." - }, - { - id: "notrycatch", - label: "No try-catch", - tooltip: "Enabling this will run tests outside of a try-catch block. Makes debugging exceptions in IE reasonable. Stored as query-strings." - } - ], - - // Set of all modules. - modules: {}, - - // logging callback queues - begin: [], - done: [], - log: [], - testStart: [], - testDone: [], - moduleStart: [], - moduleDone: [] -}; - -// Export global variables, unless an 'exports' object exists, -// in that case we assume we're in CommonJS (dealt with on the bottom of the script) -if ( typeof exports === "undefined" ) { - extend( window, QUnit ); - - // Expose QUnit object - window.QUnit = QUnit; -} - -// Initialize more QUnit.config and QUnit.urlParams -(function() { - var i, - location = window.location || { search: "", protocol: "file:" }, - params = location.search.slice( 1 ).split( "&" ), - length = params.length, - urlParams = {}, - current; - - if ( params[ 0 ] ) { - for ( i = 0; i < length; i++ ) { - current = params[ i ].split( "=" ); - current[ 0 ] = decodeURIComponent( current[ 0 ] ); - // allow just a key to turn on a flag, e.g., test.html?noglobals - current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true; - urlParams[ current[ 0 ] ] = current[ 1 ]; - } - } - - QUnit.urlParams = urlParams; - - // String search anywhere in moduleName+testName - config.filter = urlParams.filter; - - // Exact match of the module name - config.module = urlParams.module; - - config.testNumber = parseInt( urlParams.testNumber, 10 ) || null; - - // Figure out if we're running the tests from a server or not - QUnit.isLocal = location.protocol === "file:"; -}()); - -// Extend QUnit object, -// these after set here because they should not be exposed as global functions -extend( QUnit, { - assert: assert, - - config: config, - - // Initialize the configuration options - init: function() { - extend( config, { - stats: { all: 0, bad: 0 }, - moduleStats: { all: 0, bad: 0 }, - started: +new Date(), - updateRate: 1000, - blocking: false, - autostart: true, - autorun: false, - filter: "", - queue: [], - semaphore: 1 - }); - - var tests, banner, result, - qunit = id( "qunit" ); - - if ( qunit ) { - qunit.innerHTML = - "

    " + escapeText( document.title ) + "

    " + - "

    " + - "
    " + - "

    " + - "
      "; - } - - tests = id( "qunit-tests" ); - banner = id( "qunit-banner" ); - result = id( "qunit-testresult" ); - - if ( tests ) { - tests.innerHTML = ""; - } - - if ( banner ) { - banner.className = ""; - } - - if ( result ) { - result.parentNode.removeChild( result ); - } - - if ( tests ) { - result = document.createElement( "p" ); - result.id = "qunit-testresult"; - result.className = "result"; - tests.parentNode.insertBefore( result, tests ); - result.innerHTML = "Running...
       "; - } - }, - - // Resets the test setup. Useful for tests that modify the DOM. - reset: function() { - var fixture = id( "qunit-fixture" ); - if ( fixture ) { - fixture.innerHTML = config.fixture; - } - }, - - // Trigger an event on an element. - // @example triggerEvent( document.body, "click" ); - triggerEvent: function( elem, type, event ) { - if ( document.createEvent ) { - event = document.createEvent( "MouseEvents" ); - event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView, - 0, 0, 0, 0, 0, false, false, false, false, 0, null); - - elem.dispatchEvent( event ); - } else if ( elem.fireEvent ) { - elem.fireEvent( "on" + type ); - } - }, - - // Safe object type checking - is: function( type, obj ) { - return QUnit.objectType( obj ) === type; - }, - - objectType: function( obj ) { - if ( typeof obj === "undefined" ) { - return "undefined"; - // consider: typeof null === object - } - if ( obj === null ) { - return "null"; - } - - var match = toString.call( obj ).match(/^\[object\s(.*)\]$/), - type = match && match[1] || ""; - - switch ( type ) { - case "Number": - if ( isNaN(obj) ) { - return "nan"; - } - return "number"; - case "String": - case "Boolean": - case "Array": - case "Date": - case "RegExp": - case "Function": - return type.toLowerCase(); - } - if ( typeof obj === "object" ) { - return "object"; - } - return undefined; - }, - - push: function( result, actual, expected, message ) { - if ( !config.current ) { - throw new Error( "assertion outside test context, was " + sourceFromStacktrace() ); - } - - var output, source, - details = { - module: config.current.module, - name: config.current.testName, - result: result, - message: message, - actual: actual, - expected: expected - }; - - message = escapeText( message ) || ( result ? "okay" : "failed" ); - message = "" + message + ""; - output = message; - - if ( !result ) { - expected = escapeText( QUnit.jsDump.parse(expected) ); - actual = escapeText( QUnit.jsDump.parse(actual) ); - output += ""; - - if ( actual !== expected ) { - output += ""; - output += ""; - } - - source = sourceFromStacktrace(); - - if ( source ) { - details.source = source; - output += ""; - } - - output += "
      Expected:
      " + expected + "
      Result:
      " + actual + "
      Diff:
      " + QUnit.diff( expected, actual ) + "
      Source:
      " + escapeText( source ) + "
      "; - } - - runLoggingCallbacks( "log", QUnit, details ); - - config.current.assertions.push({ - result: !!result, - message: output - }); - }, - - pushFailure: function( message, source, actual ) { - if ( !config.current ) { - throw new Error( "pushFailure() assertion outside test context, was " + sourceFromStacktrace(2) ); - } - - var output, - details = { - module: config.current.module, - name: config.current.testName, - result: false, - message: message - }; - - message = escapeText( message ) || "error"; - message = "" + message + ""; - output = message; - - output += ""; - - if ( actual ) { - output += ""; - } - - if ( source ) { - details.source = source; - output += ""; - } - - output += "
      Result:
      " + escapeText( actual ) + "
      Source:
      " + escapeText( source ) + "
      "; - - runLoggingCallbacks( "log", QUnit, details ); - - config.current.assertions.push({ - result: false, - message: output - }); - }, - - url: function( params ) { - params = extend( extend( {}, QUnit.urlParams ), params ); - var key, - querystring = "?"; - - for ( key in params ) { - if ( !hasOwn.call( params, key ) ) { - continue; - } - querystring += encodeURIComponent( key ) + "=" + - encodeURIComponent( params[ key ] ) + "&"; - } - return window.location.protocol + "//" + window.location.host + - window.location.pathname + querystring.slice( 0, -1 ); - }, - - extend: extend, - id: id, - addEvent: addEvent - // load, equiv, jsDump, diff: Attached later -}); - -/** - * @deprecated: Created for backwards compatibility with test runner that set the hook function - * into QUnit.{hook}, instead of invoking it and passing the hook function. - * QUnit.constructor is set to the empty F() above so that we can add to it's prototype here. - * Doing this allows us to tell if the following methods have been overwritten on the actual - * QUnit object. - */ -extend( QUnit.constructor.prototype, { - - // Logging callbacks; all receive a single argument with the listed properties - // run test/logs.html for any related changes - begin: registerLoggingCallback( "begin" ), - - // done: { failed, passed, total, runtime } - done: registerLoggingCallback( "done" ), - - // log: { result, actual, expected, message } - log: registerLoggingCallback( "log" ), - - // testStart: { name } - testStart: registerLoggingCallback( "testStart" ), - - // testDone: { name, failed, passed, total, duration } - testDone: registerLoggingCallback( "testDone" ), - - // moduleStart: { name } - moduleStart: registerLoggingCallback( "moduleStart" ), - - // moduleDone: { name, failed, passed, total } - moduleDone: registerLoggingCallback( "moduleDone" ) -}); - -if ( typeof document === "undefined" || document.readyState === "complete" ) { - config.autorun = true; -} - -QUnit.load = function() { - runLoggingCallbacks( "begin", QUnit, {} ); - - // Initialize the config, saving the execution queue - var banner, filter, i, label, len, main, ol, toolbar, userAgent, val, - urlConfigCheckboxesContainer, urlConfigCheckboxes, moduleFilter, - numModules = 0, - moduleFilterHtml = "", - urlConfigHtml = "", - oldconfig = extend( {}, config ); - - QUnit.init(); - extend(config, oldconfig); - - config.blocking = false; - - len = config.urlConfig.length; - - for ( i = 0; i < len; i++ ) { - val = config.urlConfig[i]; - if ( typeof val === "string" ) { - val = { - id: val, - label: val, - tooltip: "[no tooltip available]" - }; - } - config[ val.id ] = QUnit.urlParams[ val.id ]; - urlConfigHtml += ""; - } - - moduleFilterHtml += ""; - - // `userAgent` initialized at top of scope - userAgent = id( "qunit-userAgent" ); - if ( userAgent ) { - userAgent.innerHTML = navigator.userAgent; - } - - // `banner` initialized at top of scope - banner = id( "qunit-header" ); - if ( banner ) { - banner.innerHTML = "" + banner.innerHTML + " "; - } - - // `toolbar` initialized at top of scope - toolbar = id( "qunit-testrunner-toolbar" ); - if ( toolbar ) { - // `filter` initialized at top of scope - filter = document.createElement( "input" ); - filter.type = "checkbox"; - filter.id = "qunit-filter-pass"; - - addEvent( filter, "click", function() { - var tmp, - ol = document.getElementById( "qunit-tests" ); - - if ( filter.checked ) { - ol.className = ol.className + " hidepass"; - } else { - tmp = " " + ol.className.replace( /[\n\t\r]/g, " " ) + " "; - ol.className = tmp.replace( / hidepass /, " " ); - } - if ( defined.sessionStorage ) { - if (filter.checked) { - sessionStorage.setItem( "qunit-filter-passed-tests", "true" ); - } else { - sessionStorage.removeItem( "qunit-filter-passed-tests" ); - } - } - }); - - if ( config.hidepassed || defined.sessionStorage && sessionStorage.getItem( "qunit-filter-passed-tests" ) ) { - filter.checked = true; - // `ol` initialized at top of scope - ol = document.getElementById( "qunit-tests" ); - ol.className = ol.className + " hidepass"; - } - toolbar.appendChild( filter ); - - // `label` initialized at top of scope - label = document.createElement( "label" ); - label.setAttribute( "for", "qunit-filter-pass" ); - label.setAttribute( "title", "Only show tests and assertons that fail. Stored in sessionStorage." ); - label.innerHTML = "Hide passed tests"; - toolbar.appendChild( label ); - - urlConfigCheckboxesContainer = document.createElement("span"); - urlConfigCheckboxesContainer.innerHTML = urlConfigHtml; - urlConfigCheckboxes = urlConfigCheckboxesContainer.getElementsByTagName("input"); - // For oldIE support: - // * Add handlers to the individual elements instead of the container - // * Use "click" instead of "change" - // * Fallback from event.target to event.srcElement - addEvents( urlConfigCheckboxes, "click", function( event ) { - var params = {}, - target = event.target || event.srcElement; - params[ target.name ] = target.checked ? true : undefined; - window.location = QUnit.url( params ); - }); - toolbar.appendChild( urlConfigCheckboxesContainer ); - - if (numModules > 1) { - moduleFilter = document.createElement( 'span' ); - moduleFilter.setAttribute( 'id', 'qunit-modulefilter-container' ); - moduleFilter.innerHTML = moduleFilterHtml; - addEvent( moduleFilter.lastChild, "change", function() { - var selectBox = moduleFilter.getElementsByTagName("select")[0], - selectedModule = decodeURIComponent(selectBox.options[selectBox.selectedIndex].value); - - window.location = QUnit.url( { module: ( selectedModule === "" ) ? undefined : selectedModule } ); - }); - toolbar.appendChild(moduleFilter); - } - } - - // `main` initialized at top of scope - main = id( "qunit-fixture" ); - if ( main ) { - config.fixture = main.innerHTML; - } - - if ( config.autostart ) { - QUnit.start(); - } -}; - -addEvent( window, "load", QUnit.load ); - -// `onErrorFnPrev` initialized at top of scope -// Preserve other handlers -onErrorFnPrev = window.onerror; - -// Cover uncaught exceptions -// Returning true will surpress the default browser handler, -// returning false will let it run. -window.onerror = function ( error, filePath, linerNr ) { - var ret = false; - if ( onErrorFnPrev ) { - ret = onErrorFnPrev( error, filePath, linerNr ); - } - - // Treat return value as window.onerror itself does, - // Only do our handling if not surpressed. - if ( ret !== true ) { - if ( QUnit.config.current ) { - if ( QUnit.config.current.ignoreGlobalErrors ) { - return true; - } - QUnit.pushFailure( error, filePath + ":" + linerNr ); - } else { - QUnit.test( "global failure", extend( function() { - QUnit.pushFailure( error, filePath + ":" + linerNr ); - }, { validTest: validTest } ) ); - } - return false; - } - - return ret; -}; - -function done() { - config.autorun = true; - - // Log the last module results - if ( config.currentModule ) { - runLoggingCallbacks( "moduleDone", QUnit, { - name: config.currentModule, - failed: config.moduleStats.bad, - passed: config.moduleStats.all - config.moduleStats.bad, - total: config.moduleStats.all - }); - } - - var i, key, - banner = id( "qunit-banner" ), - tests = id( "qunit-tests" ), - runtime = +new Date() - config.started, - passed = config.stats.all - config.stats.bad, - html = [ - "Tests completed in ", - runtime, - " milliseconds.
      ", - "", - passed, - " assertions of ", - config.stats.all, - " passed, ", - config.stats.bad, - " failed." - ].join( "" ); - - if ( banner ) { - banner.className = ( config.stats.bad ? "qunit-fail" : "qunit-pass" ); - } - - if ( tests ) { - id( "qunit-testresult" ).innerHTML = html; - } - - if ( config.altertitle && typeof document !== "undefined" && document.title ) { - // show ✖ for good, ✔ for bad suite result in title - // use escape sequences in case file gets loaded with non-utf-8-charset - document.title = [ - ( config.stats.bad ? "\u2716" : "\u2714" ), - document.title.replace( /^[\u2714\u2716] /i, "" ) - ].join( " " ); - } - - // clear own sessionStorage items if all tests passed - if ( config.reorder && defined.sessionStorage && config.stats.bad === 0 ) { - // `key` & `i` initialized at top of scope - for ( i = 0; i < sessionStorage.length; i++ ) { - key = sessionStorage.key( i++ ); - if ( key.indexOf( "qunit-test-" ) === 0 ) { - sessionStorage.removeItem( key ); - } - } - } - - // scroll back to top to show results - if ( window.scrollTo ) { - window.scrollTo(0, 0); - } - - runLoggingCallbacks( "done", QUnit, { - failed: config.stats.bad, - passed: passed, - total: config.stats.all, - runtime: runtime - }); -} - -/** @return Boolean: true if this test should be ran */ -function validTest( test ) { - var include, - filter = config.filter && config.filter.toLowerCase(), - module = config.module && config.module.toLowerCase(), - fullName = (test.module + ": " + test.testName).toLowerCase(); - - // Internally-generated tests are always valid - if ( test.callback && test.callback.validTest === validTest ) { - delete test.callback.validTest; - return true; - } - - if ( config.testNumber ) { - return test.testNumber === config.testNumber; - } - - if ( module && ( !test.module || test.module.toLowerCase() !== module ) ) { - return false; - } - - if ( !filter ) { - return true; - } - - include = filter.charAt( 0 ) !== "!"; - if ( !include ) { - filter = filter.slice( 1 ); - } - - // If the filter matches, we need to honour include - if ( fullName.indexOf( filter ) !== -1 ) { - return include; - } - - // Otherwise, do the opposite - return !include; -} - -// so far supports only Firefox, Chrome and Opera (buggy), Safari (for real exceptions) -// Later Safari and IE10 are supposed to support error.stack as well -// See also https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error/Stack -function extractStacktrace( e, offset ) { - offset = offset === undefined ? 3 : offset; - - var stack, include, i; - - if ( e.stacktrace ) { - // Opera - return e.stacktrace.split( "\n" )[ offset + 3 ]; - } else if ( e.stack ) { - // Firefox, Chrome - stack = e.stack.split( "\n" ); - if (/^error$/i.test( stack[0] ) ) { - stack.shift(); - } - if ( fileName ) { - include = []; - for ( i = offset; i < stack.length; i++ ) { - if ( stack[ i ].indexOf( fileName ) !== -1 ) { - break; - } - include.push( stack[ i ] ); - } - if ( include.length ) { - return include.join( "\n" ); - } - } - return stack[ offset ]; - } else if ( e.sourceURL ) { - // Safari, PhantomJS - // hopefully one day Safari provides actual stacktraces - // exclude useless self-reference for generated Error objects - if ( /qunit.js$/.test( e.sourceURL ) ) { - return; - } - // for actual exceptions, this is useful - return e.sourceURL + ":" + e.line; - } -} -function sourceFromStacktrace( offset ) { - try { - throw new Error(); - } catch ( e ) { - return extractStacktrace( e, offset ); - } -} - -/** - * Escape text for attribute or text content. - */ -function escapeText( s ) { - if ( !s ) { - return ""; - } - s = s + ""; - // Both single quotes and double quotes (for attributes) - return s.replace( /['"<>&]/g, function( s ) { - switch( s ) { - case '\'': - return '''; - case '"': - return '"'; - case '<': - return '<'; - case '>': - return '>'; - case '&': - return '&'; - } - }); -} - -function synchronize( callback, last ) { - config.queue.push( callback ); - - if ( config.autorun && !config.blocking ) { - process( last ); - } -} - -function process( last ) { - function next() { - process( last ); - } - var start = new Date().getTime(); - config.depth = config.depth ? config.depth + 1 : 1; - - while ( config.queue.length && !config.blocking ) { - if ( !defined.setTimeout || config.updateRate <= 0 || ( ( new Date().getTime() - start ) < config.updateRate ) ) { - config.queue.shift()(); - } else { - window.setTimeout( next, 13 ); - break; - } - } - config.depth--; - if ( last && !config.blocking && !config.queue.length && config.depth === 0 ) { - done(); - } -} - -function saveGlobal() { - config.pollution = []; - - if ( config.noglobals ) { - for ( var key in window ) { - // in Opera sometimes DOM element ids show up here, ignore them - if ( !hasOwn.call( window, key ) || /^qunit-test-output/.test( key ) ) { - continue; - } - config.pollution.push( key ); - } - } -} - -function checkPollution() { - var newGlobals, - deletedGlobals, - old = config.pollution; - - saveGlobal(); - - newGlobals = diff( config.pollution, old ); - if ( newGlobals.length > 0 ) { - QUnit.pushFailure( "Introduced global variable(s): " + newGlobals.join(", ") ); - } - - deletedGlobals = diff( old, config.pollution ); - if ( deletedGlobals.length > 0 ) { - QUnit.pushFailure( "Deleted global variable(s): " + deletedGlobals.join(", ") ); - } -} - -// returns a new Array with the elements that are in a but not in b -function diff( a, b ) { - var i, j, - result = a.slice(); - - for ( i = 0; i < result.length; i++ ) { - for ( j = 0; j < b.length; j++ ) { - if ( result[i] === b[j] ) { - result.splice( i, 1 ); - i--; - break; - } - } - } - return result; -} - -function extend( a, b ) { - for ( var prop in b ) { - if ( b[ prop ] === undefined ) { - delete a[ prop ]; - - // Avoid "Member not found" error in IE8 caused by setting window.constructor - } else if ( prop !== "constructor" || a !== window ) { - a[ prop ] = b[ prop ]; - } - } - - return a; -} - -/** - * @param {HTMLElement} elem - * @param {string} type - * @param {Function} fn - */ -function addEvent( elem, type, fn ) { - // Standards-based browsers - if ( elem.addEventListener ) { - elem.addEventListener( type, fn, false ); - // IE - } else { - elem.attachEvent( "on" + type, fn ); - } -} - -/** - * @param {Array|NodeList} elems - * @param {string} type - * @param {Function} fn - */ -function addEvents( elems, type, fn ) { - var i = elems.length; - while ( i-- ) { - addEvent( elems[i], type, fn ); - } -} - -function hasClass( elem, name ) { - return (" " + elem.className + " ").indexOf(" " + name + " ") > -1; -} - -function addClass( elem, name ) { - if ( !hasClass( elem, name ) ) { - elem.className += (elem.className ? " " : "") + name; - } -} - -function removeClass( elem, name ) { - var set = " " + elem.className + " "; - // Class name may appear multiple times - while ( set.indexOf(" " + name + " ") > -1 ) { - set = set.replace(" " + name + " " , " "); - } - // If possible, trim it for prettiness, but not neccecarily - elem.className = window.jQuery ? jQuery.trim( set ) : ( set.trim ? set.trim() : set ); -} - -function id( name ) { - return !!( typeof document !== "undefined" && document && document.getElementById ) && - document.getElementById( name ); -} - -function registerLoggingCallback( key ) { - return function( callback ) { - config[key].push( callback ); - }; -} - -// Supports deprecated method of completely overwriting logging callbacks -function runLoggingCallbacks( key, scope, args ) { - var i, callbacks; - if ( QUnit.hasOwnProperty( key ) ) { - QUnit[ key ].call(scope, args ); - } else { - callbacks = config[ key ]; - for ( i = 0; i < callbacks.length; i++ ) { - callbacks[ i ].call( scope, args ); - } - } -} - -// Test for equality any JavaScript type. -// Author: Philippe Rathé -QUnit.equiv = (function() { - - // Call the o related callback with the given arguments. - function bindCallbacks( o, callbacks, args ) { - var prop = QUnit.objectType( o ); - if ( prop ) { - if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) { - return callbacks[ prop ].apply( callbacks, args ); - } else { - return callbacks[ prop ]; // or undefined - } - } - } - - // the real equiv function - var innerEquiv, - // stack to decide between skip/abort functions - callers = [], - // stack to avoiding loops from circular referencing - parents = [], - - getProto = Object.getPrototypeOf || function ( obj ) { - return obj.__proto__; - }, - callbacks = (function () { - - // for string, boolean, number and null - function useStrictEquality( b, a ) { - /*jshint eqeqeq:false */ - if ( b instanceof a.constructor || a instanceof b.constructor ) { - // to catch short annotaion VS 'new' annotation of a - // declaration - // e.g. var i = 1; - // var j = new Number(1); - return a == b; - } else { - return a === b; - } - } - - return { - "string": useStrictEquality, - "boolean": useStrictEquality, - "number": useStrictEquality, - "null": useStrictEquality, - "undefined": useStrictEquality, - - "nan": function( b ) { - return isNaN( b ); - }, - - "date": function( b, a ) { - return QUnit.objectType( b ) === "date" && a.valueOf() === b.valueOf(); - }, - - "regexp": function( b, a ) { - return QUnit.objectType( b ) === "regexp" && - // the regex itself - a.source === b.source && - // and its modifers - a.global === b.global && - // (gmi) ... - a.ignoreCase === b.ignoreCase && - a.multiline === b.multiline && - a.sticky === b.sticky; - }, - - // - skip when the property is a method of an instance (OOP) - // - abort otherwise, - // initial === would have catch identical references anyway - "function": function() { - var caller = callers[callers.length - 1]; - return caller !== Object && typeof caller !== "undefined"; - }, - - "array": function( b, a ) { - var i, j, len, loop; - - // b could be an object literal here - if ( QUnit.objectType( b ) !== "array" ) { - return false; - } - - len = a.length; - if ( len !== b.length ) { - // safe and faster - return false; - } - - // track reference to avoid circular references - parents.push( a ); - for ( i = 0; i < len; i++ ) { - loop = false; - for ( j = 0; j < parents.length; j++ ) { - if ( parents[j] === a[i] ) { - loop = true;// dont rewalk array - } - } - if ( !loop && !innerEquiv(a[i], b[i]) ) { - parents.pop(); - return false; - } - } - parents.pop(); - return true; - }, - - "object": function( b, a ) { - var i, j, loop, - // Default to true - eq = true, - aProperties = [], - bProperties = []; - - // comparing constructors is more strict than using - // instanceof - if ( a.constructor !== b.constructor ) { - // Allow objects with no prototype to be equivalent to - // objects with Object as their constructor. - if ( !(( getProto(a) === null && getProto(b) === Object.prototype ) || - ( getProto(b) === null && getProto(a) === Object.prototype ) ) ) { - return false; - } - } - - // stack constructor before traversing properties - callers.push( a.constructor ); - // track reference to avoid circular references - parents.push( a ); - - for ( i in a ) { // be strict: don't ensures hasOwnProperty - // and go deep - loop = false; - for ( j = 0; j < parents.length; j++ ) { - if ( parents[j] === a[i] ) { - // don't go down the same path twice - loop = true; - } - } - aProperties.push(i); // collect a's properties - - if (!loop && !innerEquiv( a[i], b[i] ) ) { - eq = false; - break; - } - } - - callers.pop(); // unstack, we are done - parents.pop(); - - for ( i in b ) { - bProperties.push( i ); // collect b's properties - } - - // Ensures identical properties name - return eq && innerEquiv( aProperties.sort(), bProperties.sort() ); - } - }; - }()); - - innerEquiv = function() { // can take multiple arguments - var args = [].slice.apply( arguments ); - if ( args.length < 2 ) { - return true; // end transition - } - - return (function( a, b ) { - if ( a === b ) { - return true; // catch the most you can - } else if ( a === null || b === null || typeof a === "undefined" || - typeof b === "undefined" || - QUnit.objectType(a) !== QUnit.objectType(b) ) { - return false; // don't lose time with error prone cases - } else { - return bindCallbacks(a, callbacks, [ b, a ]); - } - - // apply transition with (1..n) arguments - }( args[0], args[1] ) && arguments.callee.apply( this, args.splice(1, args.length - 1 )) ); - }; - - return innerEquiv; -}()); - -/** - * jsDump Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | - * http://flesler.blogspot.com Licensed under BSD - * (http://www.opensource.org/licenses/bsd-license.php) Date: 5/15/2008 - * - * @projectDescription Advanced and extensible data dumping for Javascript. - * @version 1.0.0 - * @author Ariel Flesler - * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html} - */ -QUnit.jsDump = (function() { - function quote( str ) { - return '"' + str.toString().replace( /"/g, '\\"' ) + '"'; - } - function literal( o ) { - return o + ""; - } - function join( pre, arr, post ) { - var s = jsDump.separator(), - base = jsDump.indent(), - inner = jsDump.indent(1); - if ( arr.join ) { - arr = arr.join( "," + s + inner ); - } - if ( !arr ) { - return pre + post; - } - return [ pre, inner + arr, base + post ].join(s); - } - function array( arr, stack ) { - var i = arr.length, ret = new Array(i); - this.up(); - while ( i-- ) { - ret[i] = this.parse( arr[i] , undefined , stack); - } - this.down(); - return join( "[", ret, "]" ); - } - - var reName = /^function (\w+)/, - jsDump = { - // type is used mostly internally, you can fix a (custom)type in advance - parse: function( obj, type, stack ) { - stack = stack || [ ]; - var inStack, res, - parser = this.parsers[ type || this.typeOf(obj) ]; - - type = typeof parser; - inStack = inArray( obj, stack ); - - if ( inStack !== -1 ) { - return "recursion(" + (inStack - stack.length) + ")"; - } - if ( type === "function" ) { - stack.push( obj ); - res = parser.call( this, obj, stack ); - stack.pop(); - return res; - } - return ( type === "string" ) ? parser : this.parsers.error; - }, - typeOf: function( obj ) { - var type; - if ( obj === null ) { - type = "null"; - } else if ( typeof obj === "undefined" ) { - type = "undefined"; - } else if ( QUnit.is( "regexp", obj) ) { - type = "regexp"; - } else if ( QUnit.is( "date", obj) ) { - type = "date"; - } else if ( QUnit.is( "function", obj) ) { - type = "function"; - } else if ( typeof obj.setInterval !== undefined && typeof obj.document !== "undefined" && typeof obj.nodeType === "undefined" ) { - type = "window"; - } else if ( obj.nodeType === 9 ) { - type = "document"; - } else if ( obj.nodeType ) { - type = "node"; - } else if ( - // native arrays - toString.call( obj ) === "[object Array]" || - // NodeList objects - ( typeof obj.length === "number" && typeof obj.item !== "undefined" && ( obj.length ? obj.item(0) === obj[0] : ( obj.item( 0 ) === null && typeof obj[0] === "undefined" ) ) ) - ) { - type = "array"; - } else if ( obj.constructor === Error.prototype.constructor ) { - type = "error"; - } else { - type = typeof obj; - } - return type; - }, - separator: function() { - return this.multiline ? this.HTML ? "
      " : "\n" : this.HTML ? " " : " "; - }, - // extra can be a number, shortcut for increasing-calling-decreasing - indent: function( extra ) { - if ( !this.multiline ) { - return ""; - } - var chr = this.indentChar; - if ( this.HTML ) { - chr = chr.replace( /\t/g, " " ).replace( / /g, " " ); - } - return new Array( this._depth_ + (extra||0) ).join(chr); - }, - up: function( a ) { - this._depth_ += a || 1; - }, - down: function( a ) { - this._depth_ -= a || 1; - }, - setParser: function( name, parser ) { - this.parsers[name] = parser; - }, - // The next 3 are exposed so you can use them - quote: quote, - literal: literal, - join: join, - // - _depth_: 1, - // This is the list of parsers, to modify them, use jsDump.setParser - parsers: { - window: "[Window]", - document: "[Document]", - error: function(error) { - return "Error(\"" + error.message + "\")"; - }, - unknown: "[Unknown]", - "null": "null", - "undefined": "undefined", - "function": function( fn ) { - var ret = "function", - // functions never have name in IE - name = "name" in fn ? fn.name : (reName.exec(fn) || [])[1]; - - if ( name ) { - ret += " " + name; - } - ret += "( "; - - ret = [ ret, QUnit.jsDump.parse( fn, "functionArgs" ), "){" ].join( "" ); - return join( ret, QUnit.jsDump.parse(fn,"functionCode" ), "}" ); - }, - array: array, - nodelist: array, - "arguments": array, - object: function( map, stack ) { - var ret = [ ], keys, key, val, i; - QUnit.jsDump.up(); - keys = []; - for ( key in map ) { - keys.push( key ); - } - keys.sort(); - for ( i = 0; i < keys.length; i++ ) { - key = keys[ i ]; - val = map[ key ]; - ret.push( QUnit.jsDump.parse( key, "key" ) + ": " + QUnit.jsDump.parse( val, undefined, stack ) ); - } - QUnit.jsDump.down(); - return join( "{", ret, "}" ); - }, - node: function( node ) { - var len, i, val, - open = QUnit.jsDump.HTML ? "<" : "<", - close = QUnit.jsDump.HTML ? ">" : ">", - tag = node.nodeName.toLowerCase(), - ret = open + tag, - attrs = node.attributes; - - if ( attrs ) { - for ( i = 0, len = attrs.length; i < len; i++ ) { - val = attrs[i].nodeValue; - // IE6 includes all attributes in .attributes, even ones not explicitly set. - // Those have values like undefined, null, 0, false, "" or "inherit". - if ( val && val !== "inherit" ) { - ret += " " + attrs[i].nodeName + "=" + QUnit.jsDump.parse( val, "attribute" ); - } - } - } - ret += close; - - // Show content of TextNode or CDATASection - if ( node.nodeType === 3 || node.nodeType === 4 ) { - ret += node.nodeValue; - } - - return ret + open + "/" + tag + close; - }, - // function calls it internally, it's the arguments part of the function - functionArgs: function( fn ) { - var args, - l = fn.length; - - if ( !l ) { - return ""; - } - - args = new Array(l); - while ( l-- ) { - // 97 is 'a' - args[l] = String.fromCharCode(97+l); - } - return " " + args.join( ", " ) + " "; - }, - // object calls it internally, the key part of an item in a map - key: quote, - // function calls it internally, it's the content of the function - functionCode: "[code]", - // node calls it internally, it's an html attribute value - attribute: quote, - string: quote, - date: quote, - regexp: literal, - number: literal, - "boolean": literal - }, - // if true, entities are escaped ( <, >, \t, space and \n ) - HTML: false, - // indentation unit - indentChar: " ", - // if true, items in a collection, are separated by a \n, else just a space. - multiline: true - }; - - return jsDump; -}()); - -// from jquery.js -function inArray( elem, array ) { - if ( array.indexOf ) { - return array.indexOf( elem ); - } - - for ( var i = 0, length = array.length; i < length; i++ ) { - if ( array[ i ] === elem ) { - return i; - } - } - - return -1; -} - -/* - * Javascript Diff Algorithm - * By John Resig (http://ejohn.org/) - * Modified by Chu Alan "sprite" - * - * Released under the MIT license. - * - * More Info: - * http://ejohn.org/projects/javascript-diff-algorithm/ - * - * Usage: QUnit.diff(expected, actual) - * - * QUnit.diff( "the quick brown fox jumped over", "the quick fox jumps over" ) == "the quick brown fox jumped jumps over" - */ -QUnit.diff = (function() { - /*jshint eqeqeq:false, eqnull:true */ - function diff( o, n ) { - var i, - ns = {}, - os = {}; - - for ( i = 0; i < n.length; i++ ) { - if ( !hasOwn.call( ns, n[i] ) ) { - ns[ n[i] ] = { - rows: [], - o: null - }; - } - ns[ n[i] ].rows.push( i ); - } - - for ( i = 0; i < o.length; i++ ) { - if ( !hasOwn.call( os, o[i] ) ) { - os[ o[i] ] = { - rows: [], - n: null - }; - } - os[ o[i] ].rows.push( i ); - } - - for ( i in ns ) { - if ( !hasOwn.call( ns, i ) ) { - continue; - } - if ( ns[i].rows.length === 1 && hasOwn.call( os, i ) && os[i].rows.length === 1 ) { - n[ ns[i].rows[0] ] = { - text: n[ ns[i].rows[0] ], - row: os[i].rows[0] - }; - o[ os[i].rows[0] ] = { - text: o[ os[i].rows[0] ], - row: ns[i].rows[0] - }; - } - } - - for ( i = 0; i < n.length - 1; i++ ) { - if ( n[i].text != null && n[ i + 1 ].text == null && n[i].row + 1 < o.length && o[ n[i].row + 1 ].text == null && - n[ i + 1 ] == o[ n[i].row + 1 ] ) { - - n[ i + 1 ] = { - text: n[ i + 1 ], - row: n[i].row + 1 - }; - o[ n[i].row + 1 ] = { - text: o[ n[i].row + 1 ], - row: i + 1 - }; - } - } - - for ( i = n.length - 1; i > 0; i-- ) { - if ( n[i].text != null && n[ i - 1 ].text == null && n[i].row > 0 && o[ n[i].row - 1 ].text == null && - n[ i - 1 ] == o[ n[i].row - 1 ]) { - - n[ i - 1 ] = { - text: n[ i - 1 ], - row: n[i].row - 1 - }; - o[ n[i].row - 1 ] = { - text: o[ n[i].row - 1 ], - row: i - 1 - }; - } - } - - return { - o: o, - n: n - }; - } - - return function( o, n ) { - o = o.replace( /\s+$/, "" ); - n = n.replace( /\s+$/, "" ); - - var i, pre, - str = "", - out = diff( o === "" ? [] : o.split(/\s+/), n === "" ? [] : n.split(/\s+/) ), - oSpace = o.match(/\s+/g), - nSpace = n.match(/\s+/g); - - if ( oSpace == null ) { - oSpace = [ " " ]; - } - else { - oSpace.push( " " ); - } - - if ( nSpace == null ) { - nSpace = [ " " ]; - } - else { - nSpace.push( " " ); - } - - if ( out.n.length === 0 ) { - for ( i = 0; i < out.o.length; i++ ) { - str += "" + out.o[i] + oSpace[i] + ""; - } - } - else { - if ( out.n[0].text == null ) { - for ( n = 0; n < out.o.length && out.o[n].text == null; n++ ) { - str += "" + out.o[n] + oSpace[n] + ""; - } - } - - for ( i = 0; i < out.n.length; i++ ) { - if (out.n[i].text == null) { - str += "" + out.n[i] + nSpace[i] + ""; - } - else { - // `pre` initialized at top of scope - pre = ""; - - for ( n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++ ) { - pre += "" + out.o[n] + oSpace[n] + ""; - } - str += " " + out.n[i].text + nSpace[i] + pre; - } - } - } - - return str; - }; -}()); - -// for CommonJS enviroments, export everything -if ( typeof exports !== "undefined" ) { - extend( exports, QUnit ); -} - -// get at whatever the global object is, like window in browsers -}( (function() {return this;}.call()) )); \ No newline at end of file diff --git a/project starter code/node_modules/tinycolor2/test/test.js b/project starter code/node_modules/tinycolor2/test/test.js deleted file mode 100644 index d5bd7870..00000000 --- a/project starter code/node_modules/tinycolor2/test/test.js +++ /dev/null @@ -1,791 +0,0 @@ - -test("TinyColor initialization", function() { - ok(typeof tinycolor != "undefined", "tinycolor is initialized on the page"); - ok(typeof tinycolor("red") == "object", "tinycolor is able to be instantiated"); - - var r = tinycolor("red"); - ok(tinycolor(r) === r, "when given a tinycolor instance, tinycolor() returns it"); - ok(new tinycolor(r) === r, "when given a tinycolor instance, new tinycolor() returns it"); - equal(tinycolor("red", { format: "hex" }).toString(), "#ff0000", "tinycolor options are being parsed"); - equal(tinycolor.fromRatio({r: 1, g: 0, b: 0 }, { format: "hex" }).toString(), "#ff0000", "tinycolor options are being parsed"); - - var obj = {h: 180, s: 0.5, l: 0.5}; - var color = tinycolor(obj); - ok(obj.s === 0.5, "when given an object, the original object is not modified"); -}); - -test("Original input", function() { - var colorRgbUp = "RGB(39, 39, 39)"; - var colorRgbLow = "rgb(39, 39, 39)"; - var colorRgbMix = "RgB(39, 39, 39)"; - var tinycolorObj = tinycolor(colorRgbMix); - var inputObj = {r:100,g:100,b:100}; - var r = tinycolor("red"); - - ok(tinycolor(colorRgbLow).getOriginalInput() === colorRgbLow, "original lowercase input is returned"); - ok(tinycolor(colorRgbUp).getOriginalInput() === colorRgbUp, "original uppercase input is returned"); - ok(tinycolor(colorRgbMix).getOriginalInput() === colorRgbMix, "original mixed input is returned"); - ok(tinycolor(tinycolorObj).getOriginalInput() === colorRgbMix, "when given a tinycolor instance, the color string is returned"); - ok(tinycolor(inputObj).getOriginalInput() === inputObj, "when given an object, the object is returned"); - ok(new tinycolor("").getOriginalInput() === "", "when given an empty string, an empty string is returned"); - ok(new tinycolor(null).getOriginalInput() === "", "when given a null value, an empty string is returned"); -}); - -test("Cloning color", function() { - var originalColor = tinycolor("red"); - var originalColorRgbString = originalColor.toRgbString(); - - var clonedColor = originalColor.clone(); - ok(clonedColor.toRgbString() === originalColor.toRgbString(), "cloned color is identical"); - - clonedColor.setAlpha(0.5); - ok(clonedColor.toRgbString() !== originalColor.toRgbString(), "cloned color is changing independently from original color"); - ok(originalColorRgbString === originalColor.toRgbString(), "original color was not changed by cloned color change"); -}); - -// Taken from convertWikipediaColors.html -var conversions = [ - {"hex":"#FFFFFF","hex8":"#FFFFFFFF","rgb":{"r":"100.0%","g":"100.0%","b":"100.0%"},"hsv":{"h":"0","s":"0.000","v":"1.000"},"hsl":{"h":"0","s":"0.000","l":"1.000"}}, - {"hex":"#808080","hex8":"#808080FF","rgb":{"r":"050.0%","g":"050.0%","b":"050.0%"},"hsv":{"h":"0","s":"0.000","v":"0.500"},"hsl":{"h":"0","s":"0.000","l":"0.500"}}, - {"hex":"#000000","hex8":"#000000FF","rgb":{"r":"000.0%","g":"000.0%","b":"000.0%"},"hsv":{"h":"0","s":"0.000","v":"0.000"},"hsl":{"h":"0","s":"0.000","l":"0.000"}}, - {"hex":"#FF0000","hex8":"#FF0000FF","rgb":{"r":"100.0%","g":"000.0%","b":"000.0%"},"hsv":{"h":"0.0","s":"1.000","v":"1.000"},"hsl":{"h":"0.0","s":"1.000","l":"0.500"}}, - {"hex":"#BFBF00","hex8":"#BFBF00FF","rgb":{"r":"075.0%","g":"075.0%","b":"000.0%"},"hsv":{"h":"60.0","s":"1.000","v":"0.750"},"hsl":{"h":"60.0","s":"1.000","l":"0.375"}}, - {"hex":"#008000","hex8":"#008000FF","rgb":{"r":"000.0%","g":"050.0%","b":"000.0%"},"hsv":{"h":"120.0","s":"1.000","v":"0.500"},"hsl":{"h":"120.0","s":"1.000","l":"0.250"}}, - {"hex":"#80FFFF","hex8":"#80FFFFFF","rgb":{"r":"050.0%","g":"100.0%","b":"100.0%"},"hsv":{"h":"180.0","s":"0.500","v":"1.000"},"hsl":{"h":"180.0","s":"1.000","l":"0.750"}}, - {"hex":"#8080FF","hex8":"#8080FFFF","rgb":{"r":"050.0%","g":"050.0%","b":"100.0%"},"hsv":{"h":"240.0","s":"0.500","v":"1.000"},"hsl":{"h":"240.0","s":"1.000","l":"0.750"}}, - {"hex":"#BF40BF","hex8":"#BF40BFFF","rgb":{"r":"075.0%","g":"025.0%","b":"075.0%"},"hsv":{"h":"300.0","s":"0.667","v":"0.750"},"hsl":{"h":"300.0","s":"0.500","l":"0.500"}}, - {"hex":"#A0A424","hex8":"#A0A424FF","rgb":{"r":"062.8%","g":"064.3%","b":"014.2%"},"hsv":{"h":"61.8","s":"0.779","v":"0.643"},"hsl":{"h":"61.8","s":"0.638","l":"0.393"}}, - {"hex":"#1EAC41","hex8":"#1EAC41FF","rgb":{"r":"011.6%","g":"067.5%","b":"025.5%"},"hsv":{"h":"134.9","s":"0.828","v":"0.675"},"hsl":{"h":"134.9","s":"0.707","l":"0.396"}}, - {"hex":"#B430E5","hex8":"#B430E5FF","rgb":{"r":"070.4%","g":"018.7%","b":"089.7%"},"hsv":{"h":"283.7","s":"0.792","v":"0.897"},"hsl":{"h":"283.7","s":"0.775","l":"0.542"}}, - {"hex":"#FEF888","hex8":"#FEF888FF","rgb":{"r":"099.8%","g":"097.4%","b":"053.2%"},"hsv":{"h":"56.9","s":"0.467","v":"0.998"},"hsl":{"h":"56.9","s":"0.991","l":"0.765"}}, - {"hex":"#19CB97","hex8":"#19CB97FF","rgb":{"r":"009.9%","g":"079.5%","b":"059.1%"},"hsv":{"h":"162.4","s":"0.875","v":"0.795"},"hsl":{"h":"162.4","s":"0.779","l":"0.447"}}, - {"hex":"#362698","hex8":"#362698FF","rgb":{"r":"021.1%","g":"014.9%","b":"059.7%"},"hsv":{"h":"248.3","s":"0.750","v":"0.597"},"hsl":{"h":"248.3","s":"0.601","l":"0.373"}}, - {"hex":"#7E7EB8","hex8":"#7E7EB8FF","rgb":{"r":"049.5%","g":"049.3%","b":"072.1%"},"hsv":{"h":"240.5","s":"0.316","v":"0.721"},"hsl":{"h":"240.5","s":"0.290","l":"0.607"}} -]; - -module("Color translations"); - -test("Color Equality", function() { - for (var i = 0; i < conversions.length; i++) { - var c = conversions[i]; - var tiny = tinycolor(c.hex); - - ok(true, tiny.isValid()); - ok(true, - "Testing " + c.hex + ": " + tiny.toRgbString() + " " + tiny.toPercentageRgbString() + " " + tiny.toHsvString() + " " + tiny.toHslString() + " " + tiny.toHexString() + - "Original: " + JSON.stringify(c.rgb) + " " + JSON.stringify(c.hsv) + " " + JSON.stringify(c.hsl) - ); - ok(tinycolor.equals(c.rgb, c.hex), "RGB equals hex " + c.hex); - ok(tinycolor.equals(c.rgb, c.hex8), "RGB equals hex " + c.hex); - ok(tinycolor.equals(c.rgb, c.hsl), "RGB equals HSL " + c.hex); - ok(tinycolor.equals(c.rgb, c.hsv), "RGB equals HSV " + c.hex); - ok(tinycolor.equals(c.rgb, c.rgb), "RGB equals RGB " + c.hex); - - ok(tinycolor.equals(c.hex, c.hex), "hex equals hex " + c.hex); - ok(tinycolor.equals(c.hex, c.hex8), "hex equals hex8 " + c.hex); - ok(tinycolor.equals(c.hex, c.hsl), "hex equals HSL " + c.hex); - ok(tinycolor.equals(c.hex, c.hsv), "hex equals HSV " + c.hex); - - ok(tinycolor.equals(c.hsl, c.hsv), "HSL equals HSV " + c.hex); - } -}); - -module("Ratio Parsing"); - -test("With Ratio", function() { - equal(tinycolor.fromRatio({r: 1, g: 1, b: 1}).toHexString(), "#ffffff", "white"); - equal(tinycolor.fromRatio({r: 1, g: 0, b: 0, a: .5 }).toRgbString(), "rgba(255, 0, 0, 0.5)", "alpha works when ratio is parsed"); - equal(tinycolor.fromRatio({r: 1, g: 0, b: 0, a: 1 }).toRgbString(), "rgb(255, 0, 0)", "alpha = 1 works when ratio is parsed"); - equal(tinycolor.fromRatio({r: 1, g: 0, b: 0, a: 10 }).toRgbString(), "rgb(255, 0, 0)", "alpha > 1 works when ratio is parsed"); - equal(tinycolor.fromRatio({r: 1, g: 0, b: 0, a: -1 }).toRgbString(), "rgb(255, 0, 0)", "alpha < 1 works when ratio is parsed"); -}); - -test("Without Ratio", function() { - equal(tinycolor({r: 1, g: 1, b: 1}).toHexString(), "#010101", "010101"); - equal(tinycolor({r: .1, g: .1, b: .1}).toHexString(), "#000000", "000000"); - equal(tinycolor("rgb .1 .1 .1").toHexString(), "#000000", "000000"); -}); - -module("String Parsing"); - -test("RGB Text Parsing", function() { - equal(tinycolor("rgb 255 0 0").toHexString(), "#ff0000", "spaced input"); - equal(tinycolor("rgb(255, 0, 0)").toHexString(), "#ff0000", "parenthesized input"); - equal(tinycolor("rgb (255, 0, 0)").toHexString(), "#ff0000", "parenthesized spaced input"); - equal(tinycolor({ r: 255, g: 0, b: 0 }).toHexString(), "#ff0000", "object input"); - deepEqual (tinycolor({ r: 255, g: 0, b: 0 }).toRgb(), { r: 255, g: 0, b: 0, a: 1 }, "object input and compare"); - - - ok(tinycolor.equals({r:200, g: 100, b: 0 }, "rgb(200, 100, 0)")); - ok(tinycolor.equals({r:200, g: 100, b: 0 }, "rgb 200 100 0")); - ok(tinycolor.equals({r:200, g: 100, b: 0 }, "rgb 200 100 0")); - ok(tinycolor.equals({r:200, g: 100, b: 0, a: .4 }, "rgba 200 100 0 .4")); - ok(!tinycolor.equals({r:199, g: 100, b: 0 }, "rgba 200 100 0 1")); - - ok(!tinycolor.equals({r:199, g: 100, b: 0 }, "rgb(200, 100, 0)")); - ok(!tinycolor.equals({r:199, g: 100, b: 0 }, "rgb 200 100 0")); - ok(!tinycolor.equals({r:199, g: 100, b: 0 }, "rgb 200 100 0")); - - - ok(tinycolor.equals(tinycolor({r:200, g: 100, b: 0 }), "rgb(200, 100, 0)")); - ok(tinycolor.equals(tinycolor({r:200, g: 100, b: 0 }), "rgb 200 100 0")); - ok(tinycolor.equals(tinycolor({r:200, g: 100, b: 0 }), "rgb 200 100 0")); -}); - -test("Percentage RGB Text Parsing", function() { - equal(tinycolor("rgb 100% 0% 0%").toHexString(), "#ff0000", "spaced input"); - equal(tinycolor("rgb(100%, 0%, 0%)").toHexString(), "#ff0000", "parenthesized input"); - equal(tinycolor("rgb (100%, 0%, 0%)").toHexString(), "#ff0000", "parenthesized spaced input"); - equal(tinycolor({ r: "100%", g: "0%", b: "0%" }).toHexString(), "#ff0000", "object input"); - deepEqual (tinycolor({ r: "100%", g: "0%", b: "0%" }).toRgb(), { r: 255, g: 0, b: 0, a: 1 }, "object input and compare"); - - - ok(tinycolor.equals({r:"90%", g: "45%", b: "0%" }, "rgb(90%, 45%, 0%)")); - ok(tinycolor.equals({r:"90%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); - ok(tinycolor.equals({r:"90%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); - ok(tinycolor.equals({r:"90%", g: "45%", b: "0%", a: .4 }, "rgba 90% 45% 0% .4")); - ok(!tinycolor.equals({r:"89%", g: "45%", b: "0%" }, "rgba 90% 45% 0% 1")); - - ok(!tinycolor.equals({r:"89%", g: "45%", b: "0%" }, "rgb(90%, 45%, 0%)")); - ok(!tinycolor.equals({r:"89%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); - ok(!tinycolor.equals({r:"89%", g: "45%", b: "0%" }, "rgb 90% 45% 0%")); - - - ok(tinycolor.equals(tinycolor({r:"90%", g: "45%", b: "0%" }), "rgb(90%, 45%, 0%)")); - ok(tinycolor.equals(tinycolor({r:"90%", g: "45%", b: "0%" }), "rgb 90% 45% 0%")); - ok(tinycolor.equals(tinycolor({r:"90%", g: "45%", b: "0%" }), "rgb 90% 45% 0%")); -}); - -test("HSL parsing", function() { - equal(tinycolor({ h: 251, s: 100, l: .38 }).toHexString(), "#2400c2", "to hex"); - equal(tinycolor({ h: 251, s: 100, l: .38 }).toRgbString(), "rgb(36, 0, 194)", "to rgb"); - equal(tinycolor({ h: 251, s: 100, l: .38 }).toHslString(), "hsl(251, 100%, 38%)", "to hsl"); - equal(tinycolor("hsl(251, 100, 38)").toHexString(), "#2400c2", "to hex"); - equal(tinycolor("hsl(251, 100%, 38%)").toRgbString(), "rgb(36, 0, 194)", "to rgb"); - equal(tinycolor("hsl(251, 100%, 38%)").toHslString(), "hsl(251, 100%, 38%)", "to hsl"); - equal(tinycolor("hsl 100 20 10").toHslString(), "hsl(100, 20%, 10%)", "problematic hsl"); -}); - -test("Hex Parsing", function() { - equal(tinycolor("rgb 255 0 0").toHexString(), "#ff0000"); - equal(tinycolor("rgb 255 0 0").toHexString(true), "#f00"); - - equal(tinycolor("rgba 255 0 0 0.5").toHex8String(), "#ff000080"); - equal(tinycolor("rgba 255 0 0 0").toHex8String(), "#ff000000"); - equal(tinycolor("rgba 255 0 0 1").toHex8String(), "#ff0000ff"); - equal(tinycolor("rgba 255 0 0 1").toHex8String(true), "#f00f"); - - equal(tinycolor("rgb 255 0 0").toHex(), "ff0000"); - equal(tinycolor("rgb 255 0 0").toHex(true), "f00"); - equal(tinycolor("rgba 255 0 0 0.5").toHex8(), "ff000080"); -}); - -test("HSV Parsing", function() { - equal(tinycolor("hsv 251.1 0.887 .918").toHsvString(), "hsv(251, 89%, 92%)"); - equal(tinycolor("hsv 251.1 0.887 0.918").toHsvString(), "hsv(251, 89%, 92%)"); - equal(tinycolor("hsva 251.1 0.887 0.918 0.5").toHsvString(), "hsva(251, 89%, 92%, 0.5)"); -}); - -test("Invalid Parsing", function() { - var invalidColor = tinycolor("this is not a color"); - equal(invalidColor.toHexString(), "#000000"); - equal(false, invalidColor.isValid()); - - invalidColor = tinycolor("#red"); - equal(invalidColor.toHexString(), "#000000"); - equal(false, invalidColor.isValid()); - - invalidColor = tinycolor(" #red"); - equal(invalidColor.toHexString(), "#000000"); - equal(false, invalidColor.isValid()); - - invalidColor = tinycolor("##123456"); - equal(invalidColor.toHexString(), "#000000"); - equal(false, invalidColor.isValid()); - - invalidColor = tinycolor(" ##123456"); - equal(invalidColor.toHexString(), "#000000"); - equal(false, invalidColor.isValid()); - - invalidColor = tinycolor({r: 'invalid', g: 'invalid', b: 'invalid' }); - equal(invalidColor.toHexString(), "#000000"); - equal(false, invalidColor.isValid()); - - invalidColor = tinycolor({h: 'invalid', s: 'invalid', l: 'invalid' }); - equal(invalidColor.toHexString(), "#000000"); - equal(false, invalidColor.isValid()); - - invalidColor = tinycolor({h: 'invalid', s: 'invalid', v: 'invalid' }); - equal(invalidColor.toHexString(), "#000000"); - equal(false, invalidColor.isValid()); -}); - -test("Named colors", function() { - equal(tinycolor("aliceblue").toHex(), "f0f8ff"); - equal(tinycolor("antiquewhite").toHex(), "faebd7"); - equal(tinycolor("aqua").toHex(), "00ffff"); - equal(tinycolor("aquamarine").toHex(), "7fffd4"); - equal(tinycolor("azure").toHex(), "f0ffff"); - equal(tinycolor("beige").toHex(), "f5f5dc"); - equal(tinycolor("bisque").toHex(), "ffe4c4"); - equal(tinycolor("black").toHex(), "000000"); - equal(tinycolor("blanchedalmond").toHex(), "ffebcd"); - equal(tinycolor("blue").toHex(), "0000ff"); - equal(tinycolor("blueviolet").toHex(), "8a2be2"); - equal(tinycolor("brown").toHex(), "a52a2a"); - equal(tinycolor("burlywood").toHex(), "deb887"); - equal(tinycolor("cadetblue").toHex(), "5f9ea0"); - equal(tinycolor("chartreuse").toHex(), "7fff00"); - equal(tinycolor("chocolate").toHex(), "d2691e"); - equal(tinycolor("coral").toHex(), "ff7f50"); - equal(tinycolor("cornflowerblue").toHex(), "6495ed"); - equal(tinycolor("cornsilk").toHex(), "fff8dc"); - equal(tinycolor("crimson").toHex(), "dc143c"); - equal(tinycolor("cyan").toHex(), "00ffff"); - equal(tinycolor("darkblue").toHex(), "00008b"); - equal(tinycolor("darkcyan").toHex(), "008b8b"); - equal(tinycolor("darkgoldenrod").toHex(), "b8860b"); - equal(tinycolor("darkgray").toHex(), "a9a9a9"); - equal(tinycolor("darkgreen").toHex(), "006400"); - equal(tinycolor("darkkhaki").toHex(), "bdb76b"); - equal(tinycolor("darkmagenta").toHex(), "8b008b"); - equal(tinycolor("darkolivegreen").toHex(), "556b2f"); - equal(tinycolor("darkorange").toHex(), "ff8c00"); - equal(tinycolor("darkorchid").toHex(), "9932cc"); - equal(tinycolor("darkred").toHex(), "8b0000"); - equal(tinycolor("darksalmon").toHex(), "e9967a"); - equal(tinycolor("darkseagreen").toHex(), "8fbc8f"); - equal(tinycolor("darkslateblue").toHex(), "483d8b"); - equal(tinycolor("darkslategray").toHex(), "2f4f4f"); - equal(tinycolor("darkturquoise").toHex(), "00ced1"); - equal(tinycolor("darkviolet").toHex(), "9400d3"); - equal(tinycolor("deeppink").toHex(), "ff1493"); - equal(tinycolor("deepskyblue").toHex(), "00bfff"); - equal(tinycolor("dimgray").toHex(), "696969"); - equal(tinycolor("dodgerblue").toHex(), "1e90ff"); - equal(tinycolor("firebrick").toHex(), "b22222"); - equal(tinycolor("floralwhite").toHex(), "fffaf0"); - equal(tinycolor("forestgreen").toHex(), "228b22"); - equal(tinycolor("fuchsia").toHex(), "ff00ff"); - equal(tinycolor("gainsboro").toHex(), "dcdcdc"); - equal(tinycolor("ghostwhite").toHex(), "f8f8ff"); - equal(tinycolor("gold").toHex(), "ffd700"); - equal(tinycolor("goldenrod").toHex(), "daa520"); - equal(tinycolor("gray").toHex(), "808080"); - equal(tinycolor("grey").toHex(), "808080"); - equal(tinycolor("green").toHex(), "008000"); - equal(tinycolor("greenyellow").toHex(), "adff2f"); - equal(tinycolor("honeydew").toHex(), "f0fff0"); - equal(tinycolor("hotpink").toHex(), "ff69b4"); - equal(tinycolor("indianred ").toHex(), "cd5c5c"); - equal(tinycolor("indigo ").toHex(), "4b0082"); - equal(tinycolor("ivory").toHex(), "fffff0"); - equal(tinycolor("khaki").toHex(), "f0e68c"); - equal(tinycolor("lavender").toHex(), "e6e6fa"); - equal(tinycolor("lavenderblush").toHex(), "fff0f5"); - equal(tinycolor("lawngreen").toHex(), "7cfc00"); - equal(tinycolor("lemonchiffon").toHex(), "fffacd"); - equal(tinycolor("lightblue").toHex(), "add8e6"); - equal(tinycolor("lightcoral").toHex(), "f08080"); - equal(tinycolor("lightcyan").toHex(), "e0ffff"); - equal(tinycolor("lightgoldenrodyellow").toHex(), "fafad2"); - equal(tinycolor("lightgrey").toHex(), "d3d3d3"); - equal(tinycolor("lightgreen").toHex(), "90ee90"); - equal(tinycolor("lightpink").toHex(), "ffb6c1"); - equal(tinycolor("lightsalmon").toHex(), "ffa07a"); - equal(tinycolor("lightseagreen").toHex(), "20b2aa"); - equal(tinycolor("lightskyblue").toHex(), "87cefa"); - equal(tinycolor("lightslategray").toHex(), "778899"); - equal(tinycolor("lightsteelblue").toHex(), "b0c4de"); - equal(tinycolor("lightyellow").toHex(), "ffffe0"); - equal(tinycolor("lime").toHex(), "00ff00"); - equal(tinycolor("limegreen").toHex(), "32cd32"); - equal(tinycolor("linen").toHex(), "faf0e6"); - equal(tinycolor("magenta").toHex(), "ff00ff"); - equal(tinycolor("maroon").toHex(), "800000"); - equal(tinycolor("mediumaquamarine").toHex(), "66cdaa"); - equal(tinycolor("mediumblue").toHex(), "0000cd"); - equal(tinycolor("mediumorchid").toHex(), "ba55d3"); - equal(tinycolor("mediumpurple").toHex(), "9370db"); - equal(tinycolor("mediumseagreen").toHex(), "3cb371"); - equal(tinycolor("mediumslateblue").toHex(), "7b68ee"); - equal(tinycolor("mediumspringgreen").toHex(), "00fa9a"); - equal(tinycolor("mediumturquoise").toHex(), "48d1cc"); - equal(tinycolor("mediumvioletred").toHex(), "c71585"); - equal(tinycolor("midnightblue").toHex(), "191970"); - equal(tinycolor("mintcream").toHex(), "f5fffa"); - equal(tinycolor("mistyrose").toHex(), "ffe4e1"); - equal(tinycolor("moccasin").toHex(), "ffe4b5"); - equal(tinycolor("navajowhite").toHex(), "ffdead"); - equal(tinycolor("navy").toHex(), "000080"); - equal(tinycolor("oldlace").toHex(), "fdf5e6"); - equal(tinycolor("olive").toHex(), "808000"); - equal(tinycolor("olivedrab").toHex(), "6b8e23"); - equal(tinycolor("orange").toHex(), "ffa500"); - equal(tinycolor("orangered").toHex(), "ff4500"); - equal(tinycolor("orchid").toHex(), "da70d6"); - equal(tinycolor("palegoldenrod").toHex(), "eee8aa"); - equal(tinycolor("palegreen").toHex(), "98fb98"); - equal(tinycolor("paleturquoise").toHex(), "afeeee"); - equal(tinycolor("palevioletred").toHex(), "db7093"); - equal(tinycolor("papayawhip").toHex(), "ffefd5"); - equal(tinycolor("peachpuff").toHex(), "ffdab9"); - equal(tinycolor("peru").toHex(), "cd853f"); - equal(tinycolor("pink").toHex(), "ffc0cb"); - equal(tinycolor("plum").toHex(), "dda0dd"); - equal(tinycolor("powderblue").toHex(), "b0e0e6"); - equal(tinycolor("purple").toHex(), "800080"); - equal(tinycolor("rebeccapurple").toHex(), "663399"); - equal(tinycolor("red").toHex(), "ff0000"); - equal(tinycolor("rosybrown").toHex(), "bc8f8f"); - equal(tinycolor("royalblue").toHex(), "4169e1"); - equal(tinycolor("saddlebrown").toHex(), "8b4513"); - equal(tinycolor("salmon").toHex(), "fa8072"); - equal(tinycolor("sandybrown").toHex(), "f4a460"); - equal(tinycolor("seagreen").toHex(), "2e8b57"); - equal(tinycolor("seashell").toHex(), "fff5ee"); - equal(tinycolor("sienna").toHex(), "a0522d"); - equal(tinycolor("silver").toHex(), "c0c0c0"); - equal(tinycolor("skyblue").toHex(), "87ceeb"); - equal(tinycolor("slateblue").toHex(), "6a5acd"); - equal(tinycolor("slategray").toHex(), "708090"); - equal(tinycolor("snow").toHex(), "fffafa"); - equal(tinycolor("springgreen").toHex(), "00ff7f"); - equal(tinycolor("steelblue").toHex(), "4682b4"); - equal(tinycolor("tan").toHex(), "d2b48c"); - equal(tinycolor("teal").toHex(), "008080"); - equal(tinycolor("thistle").toHex(), "d8bfd8"); - equal(tinycolor("tomato").toHex(), "ff6347"); - equal(tinycolor("turquoise").toHex(), "40e0d0"); - equal(tinycolor("violet").toHex(), "ee82ee"); - equal(tinycolor("wheat").toHex(), "f5deb3"); - equal(tinycolor("white").toHex(), "ffffff"); - equal(tinycolor("whitesmoke").toHex(), "f5f5f5"); - equal(tinycolor("yellow").toHex(), "ffff00"); - equal(tinycolor("yellowgreen").toHex(), "9acd32"); - - equal(tinycolor("#f00").toName(), "red"); - equal(tinycolor("#fa0a0a").toName(), false); -}); - -module("Alpha handling"); - -test("Invalid alpha should normalize to 1", function() { - equal(tinycolor({r:255,g:20,b:10,a: -1}).toRgbString(), "rgb(255, 20, 10)", "Negative value"); - equal(tinycolor({r:255,g:20,b:10,a: -0}).toRgbString(), "rgba(255, 20, 10, 0)", "Negative 0"); - equal(tinycolor({r:255,g:20,b:10,a: 0}).toRgbString(), "rgba(255, 20, 10, 0)", "0"); - equal(tinycolor({r:255,g:20,b:10,a: .5}).toRgbString(), "rgba(255, 20, 10, 0.5)", ".5"); - equal(tinycolor({r:255,g:20,b:10,a: 1}).toRgbString(), "rgb(255, 20, 10)", "1"); - equal(tinycolor({r:255,g:20,b:10,a: 100}).toRgbString(), "rgb(255, 20, 10)", "Greater than 1"); - equal(tinycolor({r:255,g:20,b:10,a: "asdfasd"}).toRgbString(), "rgb(255, 20, 10)", "Non Numeric"); - - equal(tinycolor("#fff").toRgbString(), "rgb(255, 255, 255)", "Hex should be 1"); - equal(tinycolor("rgba 255 0 0 100").toRgbString(), "rgb(255, 0, 0)", "Greater than 1 in string parsing"); -}); - -test("toString() with alpha set", function() { - var redNamed = tinycolor.fromRatio({ r: 255, g: 0, b: 0, a: .6}, {format: "name"}); - var transparentNamed = tinycolor.fromRatio({ r: 255, g: 0, b: 0, a: 0 }, {format: "name"}); - var redHex = tinycolor.fromRatio({ r: 255, g: 0, b: 0, a: .4}, {format: "hex"}); - - equal(redNamed.getFormat(), "name", "getFormat() is correct"); - equal(redHex.getFormat(), "hex", "getFormat() is correct"); - - equal(redNamed.toString(), "rgba(255, 0, 0, 0.6)", "Names should default to rgba if alpha is < 1"); - equal(redHex.toString(), "rgba(255, 0, 0, 0.4)", "Hex should default to rgba if alpha is < 1"); - - equal(redNamed.toString("hex"), "#ff0000", "Names should not be returned as rgba if format is specified"); - equal(redNamed.toString("hex6"), "#ff0000", "Names should not be returned as rgba if format is specified"); - equal(redNamed.toString("hex3"), "#f00", "Names should not be returned as rgba if format is specified"); - equal(redNamed.toString("hex8"), "#ff000099", "Names should not be returned as rgba if format is specified"); - equal(redNamed.toString("hex4"), "#f009", "Names should not be returned as rgba if format is specified"); - equal(redNamed.toString("name"), "#ff0000", "Semi transparent names should return hex in toString() if name format is specified"); - - equal(redNamed.toName(), false, "Semi transparent names should be false in toName()"); - - equal(redHex.toString(), "rgba(255, 0, 0, 0.4)", "Hex should default to rgba if alpha is < 1"); - equal(transparentNamed.toString(), "transparent", "Named color should equal transparent if alpha == 0"); - - redHex.setAlpha(0); - equal(redHex.toString(), "rgba(255, 0, 0, 0)", "Hex should default to rgba if alpha is = 0"); -}); - -test("setting alpha", function() { - var hexSetter = tinycolor("rgba(255, 0, 0, 1)"); - equal(hexSetter.getAlpha(), 1, "Alpha should start as 1"); - var returnedFromSetAlpha = hexSetter.setAlpha(.9); - equal(returnedFromSetAlpha, hexSetter, "setAlpha return value should be the color."); - equal(hexSetter.getAlpha(), .9, "setAlpha should change alpha value"); - hexSetter.setAlpha(.5); - equal(hexSetter.getAlpha(), .5, "setAlpha should change alpha value"); - hexSetter.setAlpha(0); - equal(hexSetter.getAlpha(), 0, "setAlpha should change alpha value"); - hexSetter.setAlpha(-1); - equal(hexSetter.getAlpha(), 1, "setAlpha with value < 0 should be bound to 1"); - hexSetter.setAlpha(2); - equal(hexSetter.getAlpha(), 1, "setAlpha with value > 1 should be bound to 1"); - hexSetter.setAlpha(); - equal(hexSetter.getAlpha(), 1, "setAlpha with invalid value should be bound to 1"); - hexSetter.setAlpha(null); - equal(hexSetter.getAlpha(), 1, "setAlpha with invalid value should be bound to 1"); - hexSetter.setAlpha("test"); - equal(hexSetter.getAlpha(), 1, "setAlpha with invalid value should be bound to 1"); -}); - -test("Alpha = 0 should act differently on toName()", function() { - equal(tinycolor({r:255,g:20,b:10,a: 0}).toName(), "transparent", "0"); - equal(tinycolor("transparent").toString(), "transparent", "toString when passed"); - equal(tinycolor("transparent").toHex(), "000000", "toHex"); -}); - - -module("Brightness handling"); - -test("getBrightness", function() { - equal(tinycolor('#000').getBrightness(), 0, 'returns 0 for #000'); - equal(tinycolor('#fff').getBrightness(), 255, 'returns 255 for #fff'); -}); - -test("getLuminance", function() { - equal(tinycolor('#000').getLuminance(), 0, 'returns 0 for #000'); - equal(tinycolor('#fff').getLuminance(), 1, 'returns 1 for #fff'); -}); - -test("isDark returns true/false for dark/light colors", function() { - equal(tinycolor('#000').isDark(), true, '#000 is dark'); - equal(tinycolor('#111').isDark(), true, '#111 is dark'); - equal(tinycolor('#222').isDark(), true, '#222 is dark'); - equal(tinycolor('#333').isDark(), true, '#333 is dark'); - equal(tinycolor('#444').isDark(), true, '#444 is dark'); - equal(tinycolor('#555').isDark(), true, '#555 is dark'); - equal(tinycolor('#666').isDark(), true, '#666 is dark'); - equal(tinycolor('#777').isDark(), true, '#777 is dark'); - equal(tinycolor('#888').isDark(), false, '#888 is not dark'); - equal(tinycolor('#999').isDark(), false, '#999 is not dark'); - equal(tinycolor('#aaa').isDark(), false, '#aaa is not dark'); - equal(tinycolor('#bbb').isDark(), false, '#bbb is not dark'); - equal(tinycolor('#ccc').isDark(), false, '#ccc is not dark'); - equal(tinycolor('#ddd').isDark(), false, '#ddd is not dark'); - equal(tinycolor('#eee').isDark(), false, '#eee is not dark'); - equal(tinycolor('#fff').isDark(), false, '#fff is not dark'); -}); - -test("isLight returns true/false for light/dark colors", function() { - equal(tinycolor('#000').isLight(), false, '#000 is not light'); - equal(tinycolor('#111').isLight(), false, '#111 is not light'); - equal(tinycolor('#222').isLight(), false, '#222 is not light'); - equal(tinycolor('#333').isLight(), false, '#333 is not light'); - equal(tinycolor('#444').isLight(), false, '#444 is not light'); - equal(tinycolor('#555').isLight(), false, '#555 is not light'); - equal(tinycolor('#666').isLight(), false, '#666 is not light'); - equal(tinycolor('#777').isLight(), false, '#777 is not light'); - equal(tinycolor('#888').isLight(), true, '#888 is light'); - equal(tinycolor('#999').isLight(), true, '#999 is light'); - equal(tinycolor('#aaa').isLight(), true, '#aaa is light'); - equal(tinycolor('#bbb').isLight(), true, '#bbb is light'); - equal(tinycolor('#ccc').isLight(), true, '#ccc is light'); - equal(tinycolor('#ddd').isLight(), true, '#ddd is light'); - equal(tinycolor('#eee').isLight(), true, '#eee is light'); - equal(tinycolor('#fff').isLight(), true, '#fff is light'); -}); - -module("Initialization from tinycolor output"); - -test("HSL Object", function() { - for (var i = 0; i < conversions.length; i++) { - var c = conversions[i]; - var tiny = tinycolor(c.hex); - equal(tiny.toHexString(), tinycolor(tiny.toHsl()).toHexString(), "HSL Object"); - } -}); - -test("HSL String", function() { - for (var i = 0; i < conversions.length; i++) { - var c = conversions[i]; - var tiny = tinycolor(c.hex); - var input = tiny.toRgb(); - var output = tinycolor(tiny.toHslString()).toRgb(); - var maxDiff = 2; - - equal(Math.abs(input.r - output.r) <= maxDiff, true, "toHslString red value difference <= " + maxDiff); - equal(Math.abs(input.g - output.g) <= maxDiff, true, "toHslString green value difference <= " + maxDiff); - equal(Math.abs(input.b - output.b) <= maxDiff, true, "toHslString blue value difference <= " + maxDiff); - } -}); - -test("HSV String", function() { - for (var i = 0; i < conversions.length; i++) { - var c = conversions[i]; - var tiny = tinycolor(c.hex); - var input = tiny.toRgb(); - var output = tinycolor(tiny.toHsvString()).toRgb(); - var maxDiff = 2; - - equal(Math.abs(input.r - output.r) <= maxDiff, true, "toHsvString red value difference <= " + maxDiff); - equal(Math.abs(input.g - output.g) <= maxDiff, true, "toHsvString green value difference <= " + maxDiff); - equal(Math.abs(input.b - output.b) <= maxDiff, true, "toHsvString blue value difference <= " + maxDiff); - } -}); - -test("HSV Object", function() { - for (var i = 0; i < conversions.length; i++) { - var c = conversions[i]; - var tiny = tinycolor(c.hex); - equal(tiny.toHexString(), tinycolor(tiny.toHsv()).toHexString(), "HSV Object"); - } -}); - -test("RGB Object", function() { - for (var i = 0; i < conversions.length; i++) { - var c = conversions[i]; - var tiny = tinycolor(c.hex); - equal(tiny.toHexString(), tinycolor(tiny.toRgb()).toHexString(), "RGB Object"); - } -}); - -test("RGB String", function() { - for (var i = 0; i < conversions.length; i++) { - var c = conversions[i]; - var tiny = tinycolor(c.hex); - equal(tiny.toHexString(), tinycolor(tiny.toRgbString()).toHexString(), "RGB String"); - } -}); - -test("PRGB Object", function() { - for (var i = 0; i < conversions.length; i++) { - var c = conversions[i]; - var tiny = tinycolor(c.hex); - var input = tiny.toRgb(); - var output = tinycolor(tiny.toPercentageRgb()).toRgb(); - var maxDiff = 2; - - equal(Math.abs(input.r - output.r) <= maxDiff, true, "Red value difference <= " + maxDiff); - equal(Math.abs(input.g - output.g) <= maxDiff, true, "Green value difference <= " + maxDiff); - equal(Math.abs(input.b - output.b) <= maxDiff, true, "Blue value difference <= " + maxDiff); - } -}); - -test("PRGB String", function() { - for (var i = 0; i < conversions.length; i++) { - var c = conversions[i]; - var tiny = tinycolor(c.hex); - var input = tiny.toRgb(); - var output = tinycolor(tiny.toPercentageRgbString()).toRgb(); - var maxDiff = 2; - - equal(Math.abs(input.r - output.r) <= maxDiff, true, "Red value difference <= " + maxDiff); - equal(Math.abs(input.g - output.g) <= maxDiff, true, "Green value difference <= " + maxDiff); - equal(Math.abs(input.b - output.b) <= maxDiff, true, "Blue value difference <= " + maxDiff); - } -}); - -test("Object", function() { - for (var i = 0; i < conversions.length; i++) { - var c = conversions[i]; - var tiny = tinycolor(c.hex); - equal(tiny.toHexString(), tinycolor(tiny).toHexString(), "Object"); - } -}); - -module("Utilities"); - -test("Color equality", function() { - ok(tinycolor.equals("#ff0000", "#ff0000"), "Same hex"); - ok(tinycolor.equals("#ff0000", "rgb(255, 0, 0)"), "Same alphas"); - ok(!tinycolor.equals("#ff0000", "rgba(255, 0, 0, .1)"), "Different alphas"); - ok(tinycolor.equals("#ff000066", "rgba(255, 0, 0, .4)"), "Same alphas"); - ok(tinycolor.equals("#f009", "rgba(255, 0, 0, .6)"), "Same alphas"); - ok(tinycolor.equals("#336699CC", "369C"), "Same hex"); - ok(tinycolor.equals("ff0000", "#ff0000"), "Same hex"); - ok(tinycolor.equals("#f00", "#ff0000"), "Same hex"); - ok(tinycolor.equals("#f00", "#ff0000"), "Same hex"); - ok(tinycolor.equals("f00", "#ff0000"), "Same hex"); - equal(tinycolor("010101").toHexString(), "#010101"); - ok(!tinycolor.equals("#ff0000", "#00ff00"), "Different hex"); - ok(tinycolor.equals("#ff8000", "rgb(100%, 50%, 0%)"), "Percentage bounds checking"); -}); - -test("isReadable", function() { - // "#ff0088", "#8822aa" (values used in old WCAG1 tests) - ok(tinycolor.isReadable("#000000", "#ffffff",{level:"AA",size:"small"}), "white/black is readable"); - ok(!tinycolor.isReadable("#ff0088", "#5c1a72",{}), "not readable - empty wcag2 object"); - ok(!tinycolor.isReadable("#ff0088", "#8822aa",{level:"AA",size:"small"}), "not readable - AA small"); - ok(!tinycolor.isReadable("#ff0088", "#8822aa",{level:"AA",size:"large"}), "not readable - AA large"); - ok(!tinycolor.isReadable("#ff0088", "#8822aa",{level:"AAA",size:"small"}), "not readable - AAA small"); - ok(!tinycolor.isReadable("#ff0088", "#8822aa",{level:"AAA",size:"large"}), "not readable - AAA large"); - - // values derived from and validated using the calculators at http://www.dasplankton.de/ContrastA/ - // and http://webaim.org/resources/contrastchecker/ - - // "#ff0088", "#5c1a72": contrast ratio 3.04 - ok(!tinycolor.isReadable("#ff0088", "#5c1a72",{level:"AA",size:"small"}), "not readable - AA small"); - ok(tinycolor.isReadable("#ff0088", "#5c1a72",{level:"AA",size:"large"}), "readable - AA large"); - ok(!tinycolor.isReadable("#ff0088", "#5c1a72",{level:"AAA",size:"small"}), "not readable - AAA small"); - ok(!tinycolor.isReadable("#ff0088", "#5c1a72",{level:"AAA",size:"large"}), "not readable - AAA large"); - - // "#ff0088", "#2e0c3a": contrast ratio 4.56 - ok(tinycolor.isReadable("#ff0088", "#2e0c3a",{level:"AA",size:"small"}), "readable - AA small"); - ok(tinycolor.isReadable("#ff0088", "#2e0c3a",{level:"AA",size:"large"}), "readable - AA large"); - ok(!tinycolor.isReadable("#ff0088", "#2e0c3a",{level:"AAA",size:"small"}), "not readable - AAA small"); - ok(tinycolor.isReadable("#ff0088", "#2e0c3a",{level:"AAA",size:"large"}), "readable - AAA large"); - - // "#db91b8", "#2e0c3a": contrast ratio 7.12 - ok(tinycolor.isReadable("#db91b8", "#2e0c3a",{level:"AA",size:"small"}), "readable - AA small"); - ok(tinycolor.isReadable("#db91b8", "#2e0c3a",{level:"AA",size:"large"}), "readable - AA large"); - ok(tinycolor.isReadable("#db91b8", "#2e0c3a",{level:"AAA",size:"small"}), "readable - AAA small"); - ok(tinycolor.isReadable("#db91b8", "#2e0c3a",{level:"AAA",size:"large"}), "readable - AAA large"); -}); - -test("readability", function() { - // check return values from readability function. See isReadable above for standards tests. - equal(tinycolor.readability("#000", "#000"), 1, "Readability function test 0"); - deepEqual(tinycolor.readability("#000", "#111"), 1.1121078324840545, "Readability function test 1"); - deepEqual(tinycolor.readability("#000", "#fff"), 21, "Readability function test 2"); -}); - -test("mostReadable", function () { - equal(tinycolor.mostReadable("#000", ["#111", "#222",{wcag2:{}}]).toHexString(), "#222222", "readable color present"); - equal(tinycolor.mostReadable("#f00", ["#d00", "#0d0"],{wcag2:{}}).toHexString(), "#00dd00", "readable color present"); - equal(tinycolor.mostReadable("#fff", ["#fff", "#fff"],{wcag2:{}}).toHexString(), "#ffffff", "no different color in list"); - //includeFallbackColors - equal(tinycolor.mostReadable("#fff", ["#fff", "#fff"],{includeFallbackColors:true}).toHexString(), "#000000", "no different color in list"); - equal(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(), "#112255", "no readable color in list"); - equal(tinycolor.mostReadable("#123", ["#000", "#fff"],{includeFallbackColors:false}).toHexString(), "#ffffff", "verify assumption"); - equal(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(), "#ffffff", "no readable color in list"); - - equal(tinycolor.mostReadable("#ff0088", ["#000", "#fff"],{includeFallbackColors:false}).toHexString(), "#000000", "verify assumption"); - equal(tinycolor.mostReadable("#ff0088", ["#2e0c3a"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(), "#2e0c3a", "readable color present"); - equal(tinycolor.mostReadable("#ff0088", ["#2e0c3a"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(), "#000000", "no readable color in list"); - - equal(tinycolor.mostReadable("#371b2c", ["#000", "#fff"],{includeFallbackColors:false}).toHexString(), "#ffffff", "verify assumption"); - equal(tinycolor.mostReadable("#371b2c", ["#a9acb6"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(), "#a9acb6", "readable color present"); - equal(tinycolor.mostReadable("#371b2c", ["#a9acb6"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(), "#ffffff", "no readable color in list"); -}); - - -test("Filters", function () { - equal(tinycolor("red").toFilter(), "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffff0000,endColorstr=#ffff0000)"); - equal(tinycolor("red").toFilter("blue"), "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffff0000,endColorstr=#ff0000ff)"); - - equal(tinycolor("transparent").toFilter(), "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000,endColorstr=#00000000)"); - equal(tinycolor("transparent").toFilter("red"), "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00000000,endColorstr=#ffff0000)"); - - equal(tinycolor("#f0f0f0dd").toFilter(), "progid:DXImageTransform.Microsoft.gradient(startColorstr=#ddf0f0f0,endColorstr=#ddf0f0f0)"); - equal(tinycolor("rgba(0, 0, 255, .5").toFilter(), "progid:DXImageTransform.Microsoft.gradient(startColorstr=#800000ff,endColorstr=#800000ff)"); -}); - -module("Modifications"); - -/* Originally generated with: -var results = []; -for (var i = 0; i <= 100; i++) results.push( tinycolor.saturate("red", i).toHex() ) -console.log(JSON.stringify(results)) -*/ -var DESATURATIONS = ["ff0000","fe0101","fc0303","fb0404","fa0505","f90606","f70808","f60909","f50a0a","f40b0b","f20d0d","f10e0e","f00f0f","ee1111","ed1212","ec1313","eb1414","e91616","e81717","e71818","e61919","e41b1b","e31c1c","e21d1d","e01f1f","df2020","de2121","dd2222","db2424","da2525","d92626","d72828","d62929","d52a2a","d42b2b","d22d2d","d12e2e","d02f2f","cf3030","cd3232","cc3333","cb3434","c93636","c83737","c73838","c63939","c43b3b","c33c3c","c23d3d","c13e3e","bf4040","be4141","bd4242","bb4444","ba4545","b94646","b84747","b64949","b54a4a","b44b4b","b34d4d","b14e4e","b04f4f","af5050","ad5252","ac5353","ab5454","aa5555","a85757","a75858","a65959","a45b5b","a35c5c","a25d5d","a15e5e","9f6060","9e6161","9d6262","9c6363","9a6565","996666","986767","966969","956a6a","946b6b","936c6c","916e6e","906f6f","8f7070","8e7171","8c7373","8b7474","8a7575","887777","877878","867979","857a7a","837c7c","827d7d","817e7e","808080"]; -var SATURATIONS = ["ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000","ff0000"]; -var LIGHTENS = ["ff0000","ff0505","ff0a0a","ff0f0f","ff1414","ff1a1a","ff1f1f","ff2424","ff2929","ff2e2e","ff3333","ff3838","ff3d3d","ff4242","ff4747","ff4d4d","ff5252","ff5757","ff5c5c","ff6161","ff6666","ff6b6b","ff7070","ff7575","ff7a7a","ff8080","ff8585","ff8a8a","ff8f8f","ff9494","ff9999","ff9e9e","ffa3a3","ffa8a8","ffadad","ffb3b3","ffb8b8","ffbdbd","ffc2c2","ffc7c7","ffcccc","ffd1d1","ffd6d6","ffdbdb","ffe0e0","ffe5e5","ffebeb","fff0f0","fff5f5","fffafa","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff","ffffff"]; -var BRIGHTENS = ["ff0000","ff0303","ff0505","ff0808","ff0a0a","ff0d0d","ff0f0f","ff1212","ff1414","ff1717","ff1919","ff1c1c","ff1f1f","ff2121","ff2424","ff2626","ff2929","ff2b2b","ff2e2e","ff3030","ff3333","ff3636","ff3838","ff3b3b","ff3d3d","ff4040","ff4242","ff4545","ff4747","ff4a4a","ff4c4c","ff4f4f","ff5252","ff5454","ff5757","ff5959","ff5c5c","ff5e5e","ff6161","ff6363","ff6666","ff6969","ff6b6b","ff6e6e","ff7070","ff7373","ff7575","ff7878","ff7a7a","ff7d7d","ff7f7f","ff8282","ff8585","ff8787","ff8a8a","ff8c8c","ff8f8f","ff9191","ff9494","ff9696","ff9999","ff9c9c","ff9e9e","ffa1a1","ffa3a3","ffa6a6","ffa8a8","ffabab","ffadad","ffb0b0","ffb2b2","ffb5b5","ffb8b8","ffbaba","ffbdbd","ffbfbf","ffc2c2","ffc4c4","ffc7c7","ffc9c9","ffcccc","ffcfcf","ffd1d1","ffd4d4","ffd6d6","ffd9d9","ffdbdb","ffdede","ffe0e0","ffe3e3","ffe5e5","ffe8e8","ffebeb","ffeded","fff0f0","fff2f2","fff5f5","fff7f7","fffafa","fffcfc","ffffff"]; -var DARKENS = ["ff0000","fa0000","f50000","f00000","eb0000","e60000","e00000","db0000","d60000","d10000","cc0000","c70000","c20000","bd0000","b80000","b30000","ad0000","a80000","a30000","9e0000","990000","940000","8f0000","8a0000","850000","800000","7a0000","750000","700000","6b0000","660000","610000","5c0000","570000","520000","4d0000","470000","420000","3d0000","380000","330000","2e0000","290000","240000","1f0000","190000","140000","0f0000","0a0000","050000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000","000000"]; - -test("Modifications", function () { - for (var i = 0; i <= 100; i++) { - equal(tinycolor("red").desaturate(i).toHex(), DESATURATIONS[i], "Desaturation " + i + " works"); - } - for (var i = 0; i <= 100; i++) { - equal(tinycolor("red").saturate(i).toHex(), SATURATIONS[i], "Saturation " + i + " works"); - } - for (var i = 0; i <= 100; i++) { - equal(tinycolor("red").lighten(i).toHex(), LIGHTENS[i], "Lighten " + i + " works"); - } - for (var i = 0; i <= 100; i++) { - equal(tinycolor("red").brighten(i).toHex(), BRIGHTENS[i], "Brighter " + i + " works"); - } - for (var i = 0; i <= 100; i++) { - equal(tinycolor("red").darken(i).toHex(), DARKENS[i], "Darken " + i + " works"); - } - - equal(tinycolor("red").greyscale().toHex(), "808080", "Greyscale works"); -}); - -test("Spin", function () { - equal(Math.round(tinycolor("#f00").spin(-1234).toHsl().h), 206, "Spinning -1234 works"); - equal(Math.round(tinycolor("#f00").spin(-360).toHsl().h), 0, "Spinning -360 works"); - equal(Math.round(tinycolor("#f00").spin(-120).toHsl().h), 240, "Spinning -120 works"); - equal(Math.round(tinycolor("#f00").spin(0).toHsl().h), 0, "Spinning 0 works"); - equal(Math.round(tinycolor("#f00").spin(10).toHsl().h), 10, "Spinning 10 works"); - equal(Math.round(tinycolor("#f00").spin(360).toHsl().h), 0, "Spinning 360 works"); - equal(Math.round(tinycolor("#f00").spin(2345).toHsl().h), 185, "Spinning 2345 works"); - - [-360, 0, 360].forEach(function (delta) { - Object.keys(tinycolor.names).forEach(function (name) { - equal(tinycolor(name).toHex(), tinycolor(name).spin(delta).toHex(), "Spinning " + delta.toString() + " has no effect") - }) - }) -}); - -test("Mix", function () { - // amount 0 or none - equal(tinycolor.mix('#000', '#fff').toHsl().l, 0.5, "Mixing without amount works"); - equal(tinycolor.mix('#f00', '#000', 0).toHex(), 'ff0000', "Mixing with 0 amount works"); - // This case checks the the problem with floating point numbers (eg 255/90) - equal(tinycolor.mix('#fff', '#000', 90).toHex(), '1a1a1a', "Mixing with 90 amount works correctly"); - - // black and white - for (var i = 0; i < 100; i++) { - equal(Math.round(tinycolor.mix('#000', '#fff', i).toHsl().l * 100) / 100, i / 100, "Mixing black and white with " + i + " amount works"); - } - - // with colors - for (var i = 0; i < 100; i++) { - var new_hex = Math.round((255 * (100 - i)) / 100).toString(16); - - if (new_hex.length === 1) { - new_hex = '0' + new_hex; - } - - equal(tinycolor.mix('#f00', '#000', i).toHex(), new_hex + '0000', "Mixing " + i + " (red channel)"); - equal(tinycolor.mix('#0f0', '#000', i).toHex(), '00' + new_hex + '00', "Mixing " + i + " (green channel)"); - equal(tinycolor.mix('#00f', '#000', i).toHex(), '0000' + new_hex, "Mixing " + i + " (blue channel)"); - equal(tinycolor.mix(tinycolor('transparent'), '#000', i).toRgb().a, i / 100, "Mixing " + i + " (alpha channel)"); - } -}); - -// The combination tests need to be expanded further -module("Combinations"); - -function colorsToHexString(colors) { - return colors.map(function(c) { - return c.toHex(); - }).join(","); -} - -test("complement", function() { - var complementDoesntModifyInstance = tinycolor("red"); - equal(complementDoesntModifyInstance.complement().toHex(), "00ffff", "Complement works"); - equal(complementDoesntModifyInstance.toHex(), "ff0000", "Complement did not modify this color"); -}); - -test("analogous", function() { - var combination = tinycolor("red").analogous(); - equal(colorsToHexString(combination), "ff0000,ff0066,ff0033,ff0000,ff3300,ff6600", "Correct Combination"); -}); - -test("monochromatic", function() { - var combination = tinycolor("red").monochromatic(); - equal(colorsToHexString(combination), "ff0000,2a0000,550000,800000,aa0000,d40000", "Correct Combination"); -}); - -test("splitcomplement", function() { - var combination = tinycolor("red").splitcomplement(); - equal(colorsToHexString(combination), "ff0000,ccff00,0066ff", "Correct Combination"); -}); - -test("triad", function() { - var combination = tinycolor("red").triad(); - equal(colorsToHexString(combination), "ff0000,00ff00,0000ff", "Correct Combination"); -}); - -test("tetrad", function() { - var combination = tinycolor("red").tetrad(); - equal(colorsToHexString(combination), "ff0000,80ff00,00ffff,7f00ff", "Correct Combination"); -}); diff --git a/project starter code/node_modules/tinycolor2/tinycolor.js b/project starter code/node_modules/tinycolor2/tinycolor.js index 9ce79d84..52601dfe 100644 --- a/project starter code/node_modules/tinycolor2/tinycolor.js +++ b/project starter code/node_modules/tinycolor2/tinycolor.js @@ -1,808 +1,788 @@ -// TinyColor v1.4.2 -// https://github.com/bgrins/TinyColor -// Brian Grinstead, MIT License - -(function(Math) { - -var trimLeft = /^\s+/, - trimRight = /\s+$/, - tinyCounter = 0, - mathRound = Math.round, - mathMin = Math.min, - mathMax = Math.max, - mathRandom = Math.random; - -function tinycolor (color, opts) { - - color = (color) ? color : ''; - opts = opts || { }; +// This file is autogenerated. +// It's here at this path for backwards compatibility for links to it +// but the npm package now exports both CJS and ESM. +// See https://github.com/bgrins/TinyColor/ for instructions. + (function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.tinycolor = factory()); +})(this, (function () { 'use strict'; + + function _typeof(obj) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }, _typeof(obj); + } + + // https://github.com/bgrins/TinyColor + // Brian Grinstead, MIT License + + var trimLeft = /^\s+/; + var trimRight = /\s+$/; + function tinycolor(color, opts) { + color = color ? color : ""; + opts = opts || {}; // If input is already a tinycolor, return itself if (color instanceof tinycolor) { - return color; + return color; } // If we are called as a function, call using new instead if (!(this instanceof tinycolor)) { - return new tinycolor(color, opts); + return new tinycolor(color, opts); } - var rgb = inputToRGB(color); - this._originalInput = color, - this._r = rgb.r, - this._g = rgb.g, - this._b = rgb.b, - this._a = rgb.a, - this._roundA = mathRound(100*this._a) / 100, - this._format = opts.format || rgb.format; + this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format; this._gradientType = opts.gradientType; // Don't let the range of [0,255] come back in [0,1]. // Potentially lose a little bit of precision here, but will fix issues where // .5 gets interpreted as half of the total, instead of half of 1 // If it was supposed to be 128, this was already taken care of by `inputToRgb` - if (this._r < 1) { this._r = mathRound(this._r); } - if (this._g < 1) { this._g = mathRound(this._g); } - if (this._b < 1) { this._b = mathRound(this._b); } - + if (this._r < 1) this._r = Math.round(this._r); + if (this._g < 1) this._g = Math.round(this._g); + if (this._b < 1) this._b = Math.round(this._b); this._ok = rgb.ok; - this._tc_id = tinyCounter++; -} - -tinycolor.prototype = { - isDark: function() { - return this.getBrightness() < 128; + } + tinycolor.prototype = { + isDark: function isDark() { + return this.getBrightness() < 128; }, - isLight: function() { - return !this.isDark(); + isLight: function isLight() { + return !this.isDark(); }, - isValid: function() { - return this._ok; + isValid: function isValid() { + return this._ok; }, - getOriginalInput: function() { + getOriginalInput: function getOriginalInput() { return this._originalInput; }, - getFormat: function() { - return this._format; + getFormat: function getFormat() { + return this._format; }, - getAlpha: function() { - return this._a; + getAlpha: function getAlpha() { + return this._a; }, - getBrightness: function() { - //http://www.w3.org/TR/AERT#color-contrast - var rgb = this.toRgb(); - return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000; + getBrightness: function getBrightness() { + //http://www.w3.org/TR/AERT#color-contrast + var rgb = this.toRgb(); + return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000; }, - getLuminance: function() { - //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef - var rgb = this.toRgb(); - var RsRGB, GsRGB, BsRGB, R, G, B; - RsRGB = rgb.r/255; - GsRGB = rgb.g/255; - BsRGB = rgb.b/255; - - if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);} - if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);} - if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);} - return (0.2126 * R) + (0.7152 * G) + (0.0722 * B); + getLuminance: function getLuminance() { + //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef + var rgb = this.toRgb(); + var RsRGB, GsRGB, BsRGB, R, G, B; + RsRGB = rgb.r / 255; + GsRGB = rgb.g / 255; + BsRGB = rgb.b / 255; + if (RsRGB <= 0.03928) R = RsRGB / 12.92;else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4); + if (GsRGB <= 0.03928) G = GsRGB / 12.92;else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4); + if (BsRGB <= 0.03928) B = BsRGB / 12.92;else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4); + return 0.2126 * R + 0.7152 * G + 0.0722 * B; }, - setAlpha: function(value) { - this._a = boundAlpha(value); - this._roundA = mathRound(100*this._a) / 100; - return this; + setAlpha: function setAlpha(value) { + this._a = boundAlpha(value); + this._roundA = Math.round(100 * this._a) / 100; + return this; }, - toHsv: function() { - var hsv = rgbToHsv(this._r, this._g, this._b); - return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a }; + toHsv: function toHsv() { + var hsv = rgbToHsv(this._r, this._g, this._b); + return { + h: hsv.h * 360, + s: hsv.s, + v: hsv.v, + a: this._a + }; }, - toHsvString: function() { - var hsv = rgbToHsv(this._r, this._g, this._b); - var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100); - return (this._a == 1) ? - "hsv(" + h + ", " + s + "%, " + v + "%)" : - "hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")"; + toHsvString: function toHsvString() { + var hsv = rgbToHsv(this._r, this._g, this._b); + var h = Math.round(hsv.h * 360), + s = Math.round(hsv.s * 100), + v = Math.round(hsv.v * 100); + return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")"; }, - toHsl: function() { - var hsl = rgbToHsl(this._r, this._g, this._b); - return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a }; + toHsl: function toHsl() { + var hsl = rgbToHsl(this._r, this._g, this._b); + return { + h: hsl.h * 360, + s: hsl.s, + l: hsl.l, + a: this._a + }; }, - toHslString: function() { - var hsl = rgbToHsl(this._r, this._g, this._b); - var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100); - return (this._a == 1) ? - "hsl(" + h + ", " + s + "%, " + l + "%)" : - "hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")"; + toHslString: function toHslString() { + var hsl = rgbToHsl(this._r, this._g, this._b); + var h = Math.round(hsl.h * 360), + s = Math.round(hsl.s * 100), + l = Math.round(hsl.l * 100); + return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")"; }, - toHex: function(allow3Char) { - return rgbToHex(this._r, this._g, this._b, allow3Char); + toHex: function toHex(allow3Char) { + return rgbToHex(this._r, this._g, this._b, allow3Char); }, - toHexString: function(allow3Char) { - return '#' + this.toHex(allow3Char); + toHexString: function toHexString(allow3Char) { + return "#" + this.toHex(allow3Char); }, - toHex8: function(allow4Char) { - return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char); + toHex8: function toHex8(allow4Char) { + return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char); }, - toHex8String: function(allow4Char) { - return '#' + this.toHex8(allow4Char); + toHex8String: function toHex8String(allow4Char) { + return "#" + this.toHex8(allow4Char); }, - toRgb: function() { - return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a }; + toRgb: function toRgb() { + return { + r: Math.round(this._r), + g: Math.round(this._g), + b: Math.round(this._b), + a: this._a + }; }, - toRgbString: function() { - return (this._a == 1) ? - "rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" : - "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")"; + toRgbString: function toRgbString() { + return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")"; }, - toPercentageRgb: function() { - return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a }; + toPercentageRgb: function toPercentageRgb() { + return { + r: Math.round(bound01(this._r, 255) * 100) + "%", + g: Math.round(bound01(this._g, 255) * 100) + "%", + b: Math.round(bound01(this._b, 255) * 100) + "%", + a: this._a + }; }, - toPercentageRgbString: function() { - return (this._a == 1) ? - "rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" : - "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")"; + toPercentageRgbString: function toPercentageRgbString() { + return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")"; }, - toName: function() { - if (this._a === 0) { - return "transparent"; - } - - if (this._a < 1) { - return false; - } - - return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false; + toName: function toName() { + if (this._a === 0) { + return "transparent"; + } + if (this._a < 1) { + return false; + } + return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false; }, - toFilter: function(secondColor) { - var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a); - var secondHex8String = hex8String; - var gradientType = this._gradientType ? "GradientType = 1, " : ""; - - if (secondColor) { - var s = tinycolor(secondColor); - secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a); - } - - return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")"; + toFilter: function toFilter(secondColor) { + var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a); + var secondHex8String = hex8String; + var gradientType = this._gradientType ? "GradientType = 1, " : ""; + if (secondColor) { + var s = tinycolor(secondColor); + secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a); + } + return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")"; }, - toString: function(format) { - var formatSet = !!format; - format = format || this._format; - - var formattedString = false; - var hasAlpha = this._a < 1 && this._a >= 0; - var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name"); - - if (needsAlphaFormat) { - // Special case for "transparent", all other non-alpha formats - // will return rgba when there is transparency. - if (format === "name" && this._a === 0) { - return this.toName(); - } - return this.toRgbString(); + toString: function toString(format) { + var formatSet = !!format; + format = format || this._format; + var formattedString = false; + var hasAlpha = this._a < 1 && this._a >= 0; + var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name"); + if (needsAlphaFormat) { + // Special case for "transparent", all other non-alpha formats + // will return rgba when there is transparency. + if (format === "name" && this._a === 0) { + return this.toName(); } - if (format === "rgb") { - formattedString = this.toRgbString(); - } - if (format === "prgb") { - formattedString = this.toPercentageRgbString(); - } - if (format === "hex" || format === "hex6") { - formattedString = this.toHexString(); - } - if (format === "hex3") { - formattedString = this.toHexString(true); - } - if (format === "hex4") { - formattedString = this.toHex8String(true); - } - if (format === "hex8") { - formattedString = this.toHex8String(); - } - if (format === "name") { - formattedString = this.toName(); - } - if (format === "hsl") { - formattedString = this.toHslString(); - } - if (format === "hsv") { - formattedString = this.toHsvString(); - } - - return formattedString || this.toHexString(); + return this.toRgbString(); + } + if (format === "rgb") { + formattedString = this.toRgbString(); + } + if (format === "prgb") { + formattedString = this.toPercentageRgbString(); + } + if (format === "hex" || format === "hex6") { + formattedString = this.toHexString(); + } + if (format === "hex3") { + formattedString = this.toHexString(true); + } + if (format === "hex4") { + formattedString = this.toHex8String(true); + } + if (format === "hex8") { + formattedString = this.toHex8String(); + } + if (format === "name") { + formattedString = this.toName(); + } + if (format === "hsl") { + formattedString = this.toHslString(); + } + if (format === "hsv") { + formattedString = this.toHsvString(); + } + return formattedString || this.toHexString(); }, - clone: function() { - return tinycolor(this.toString()); + clone: function clone() { + return tinycolor(this.toString()); }, - - _applyModification: function(fn, args) { - var color = fn.apply(null, [this].concat([].slice.call(args))); - this._r = color._r; - this._g = color._g; - this._b = color._b; - this.setAlpha(color._a); - return this; + _applyModification: function _applyModification(fn, args) { + var color = fn.apply(null, [this].concat([].slice.call(args))); + this._r = color._r; + this._g = color._g; + this._b = color._b; + this.setAlpha(color._a); + return this; }, - lighten: function() { - return this._applyModification(lighten, arguments); + lighten: function lighten() { + return this._applyModification(_lighten, arguments); }, - brighten: function() { - return this._applyModification(brighten, arguments); + brighten: function brighten() { + return this._applyModification(_brighten, arguments); }, - darken: function() { - return this._applyModification(darken, arguments); + darken: function darken() { + return this._applyModification(_darken, arguments); }, - desaturate: function() { - return this._applyModification(desaturate, arguments); + desaturate: function desaturate() { + return this._applyModification(_desaturate, arguments); }, - saturate: function() { - return this._applyModification(saturate, arguments); + saturate: function saturate() { + return this._applyModification(_saturate, arguments); }, - greyscale: function() { - return this._applyModification(greyscale, arguments); + greyscale: function greyscale() { + return this._applyModification(_greyscale, arguments); }, - spin: function() { - return this._applyModification(spin, arguments); + spin: function spin() { + return this._applyModification(_spin, arguments); }, - - _applyCombination: function(fn, args) { - return fn.apply(null, [this].concat([].slice.call(args))); + _applyCombination: function _applyCombination(fn, args) { + return fn.apply(null, [this].concat([].slice.call(args))); }, - analogous: function() { - return this._applyCombination(analogous, arguments); + analogous: function analogous() { + return this._applyCombination(_analogous, arguments); }, - complement: function() { - return this._applyCombination(complement, arguments); + complement: function complement() { + return this._applyCombination(_complement, arguments); }, - monochromatic: function() { - return this._applyCombination(monochromatic, arguments); + monochromatic: function monochromatic() { + return this._applyCombination(_monochromatic, arguments); }, - splitcomplement: function() { - return this._applyCombination(splitcomplement, arguments); + splitcomplement: function splitcomplement() { + return this._applyCombination(_splitcomplement, arguments); }, - triad: function() { - return this._applyCombination(triad, arguments); + // Disabled until https://github.com/bgrins/TinyColor/issues/254 + // polyad: function (number) { + // return this._applyCombination(polyad, [number]); + // }, + triad: function triad() { + return this._applyCombination(polyad, [3]); }, - tetrad: function() { - return this._applyCombination(tetrad, arguments); + tetrad: function tetrad() { + return this._applyCombination(polyad, [4]); } -}; - -// If input is an object, force 1 into "1.0" to handle ratios properly -// String input requires "1.0" as input, so 1 will be treated as 1 -tinycolor.fromRatio = function(color, opts) { - if (typeof color == "object") { - var newColor = {}; - for (var i in color) { - if (color.hasOwnProperty(i)) { - if (i === "a") { - newColor[i] = color[i]; - } - else { - newColor[i] = convertToPercentage(color[i]); - } - } + }; + + // If input is an object, force 1 into "1.0" to handle ratios properly + // String input requires "1.0" as input, so 1 will be treated as 1 + tinycolor.fromRatio = function (color, opts) { + if (_typeof(color) == "object") { + var newColor = {}; + for (var i in color) { + if (color.hasOwnProperty(i)) { + if (i === "a") { + newColor[i] = color[i]; + } else { + newColor[i] = convertToPercentage(color[i]); + } } - color = newColor; + } + color = newColor; } - return tinycolor(color, opts); -}; - -// Given a string or object, convert that input to RGB -// Possible string inputs: -// -// "red" -// "#f00" or "f00" -// "#ff0000" or "ff0000" -// "#ff000000" or "ff000000" -// "rgb 255 0 0" or "rgb (255, 0, 0)" -// "rgb 1.0 0 0" or "rgb (1, 0, 0)" -// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" -// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" -// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" -// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" -// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" -// -function inputToRGB(color) { - - var rgb = { r: 0, g: 0, b: 0 }; + }; + + // Given a string or object, convert that input to RGB + // Possible string inputs: + // + // "red" + // "#f00" or "f00" + // "#ff0000" or "ff0000" + // "#ff000000" or "ff000000" + // "rgb 255 0 0" or "rgb (255, 0, 0)" + // "rgb 1.0 0 0" or "rgb (1, 0, 0)" + // "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" + // "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" + // "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" + // "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" + // "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" + // + function inputToRGB(color) { + var rgb = { + r: 0, + g: 0, + b: 0 + }; var a = 1; var s = null; var v = null; var l = null; var ok = false; var format = false; - if (typeof color == "string") { - color = stringInputToObject(color); + color = stringInputToObject(color); } - - if (typeof color == "object") { - if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { - rgb = rgbToRgb(color.r, color.g, color.b); - ok = true; - format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; - } - else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { - s = convertToPercentage(color.s); - v = convertToPercentage(color.v); - rgb = hsvToRgb(color.h, s, v); - ok = true; - format = "hsv"; - } - else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { - s = convertToPercentage(color.s); - l = convertToPercentage(color.l); - rgb = hslToRgb(color.h, s, l); - ok = true; - format = "hsl"; - } - - if (color.hasOwnProperty("a")) { - a = color.a; - } + if (_typeof(color) == "object") { + if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { + rgb = rgbToRgb(color.r, color.g, color.b); + ok = true; + format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; + } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { + s = convertToPercentage(color.s); + v = convertToPercentage(color.v); + rgb = hsvToRgb(color.h, s, v); + ok = true; + format = "hsv"; + } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { + s = convertToPercentage(color.s); + l = convertToPercentage(color.l); + rgb = hslToRgb(color.h, s, l); + ok = true; + format = "hsl"; + } + if (color.hasOwnProperty("a")) { + a = color.a; + } } - a = boundAlpha(a); - return { - ok: ok, - format: color.format || format, - r: mathMin(255, mathMax(rgb.r, 0)), - g: mathMin(255, mathMax(rgb.g, 0)), - b: mathMin(255, mathMax(rgb.b, 0)), - a: a + ok: ok, + format: color.format || format, + r: Math.min(255, Math.max(rgb.r, 0)), + g: Math.min(255, Math.max(rgb.g, 0)), + b: Math.min(255, Math.max(rgb.b, 0)), + a: a }; -} + } + // Conversion Functions + // -------------------- -// Conversion Functions -// -------------------- + // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: + // -// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: -// - -// `rgbToRgb` -// Handle bounds / percentage checking to conform to CSS color spec -// -// *Assumes:* r, g, b in [0, 255] or [0, 1] -// *Returns:* { r, g, b } in [0, 255] -function rgbToRgb(r, g, b){ + // `rgbToRgb` + // Handle bounds / percentage checking to conform to CSS color spec + // + // *Assumes:* r, g, b in [0, 255] or [0, 1] + // *Returns:* { r, g, b } in [0, 255] + function rgbToRgb(r, g, b) { return { - r: bound01(r, 255) * 255, - g: bound01(g, 255) * 255, - b: bound01(b, 255) * 255 + r: bound01(r, 255) * 255, + g: bound01(g, 255) * 255, + b: bound01(b, 255) * 255 }; -} - -// `rgbToHsl` -// Converts an RGB color value to HSL. -// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] -// *Returns:* { h, s, l } in [0,1] -function rgbToHsl(r, g, b) { + } + // `rgbToHsl` + // Converts an RGB color value to HSL. + // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] + // *Returns:* { h, s, l } in [0,1] + function rgbToHsl(r, g, b) { r = bound01(r, 255); g = bound01(g, 255); b = bound01(b, 255); - - var max = mathMax(r, g, b), min = mathMin(r, g, b); - var h, s, l = (max + min) / 2; - - if(max == min) { - h = s = 0; // achromatic + var max = Math.max(r, g, b), + min = Math.min(r, g, b); + var h, + s, + l = (max + min) / 2; + if (max == min) { + h = s = 0; // achromatic + } else { + var d = max - min; + s = l > 0.5 ? d / (2 - max - min) : d / (max + min); + switch (max) { + case r: + h = (g - b) / d + (g < b ? 6 : 0); + break; + case g: + h = (b - r) / d + 2; + break; + case b: + h = (r - g) / d + 4; + break; + } + h /= 6; } - else { - var d = max - min; - s = l > 0.5 ? d / (2 - max - min) : d / (max + min); - switch(max) { - case r: h = (g - b) / d + (g < b ? 6 : 0); break; - case g: h = (b - r) / d + 2; break; - case b: h = (r - g) / d + 4; break; - } - - h /= 6; - } - - return { h: h, s: s, l: l }; -} + return { + h: h, + s: s, + l: l + }; + } -// `hslToRgb` -// Converts an HSL color value to RGB. -// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] -// *Returns:* { r, g, b } in the set [0, 255] -function hslToRgb(h, s, l) { + // `hslToRgb` + // Converts an HSL color value to RGB. + // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] + // *Returns:* { r, g, b } in the set [0, 255] + function hslToRgb(h, s, l) { var r, g, b; - h = bound01(h, 360); s = bound01(s, 100); l = bound01(l, 100); - function hue2rgb(p, q, t) { - if(t < 0) t += 1; - if(t > 1) t -= 1; - if(t < 1/6) return p + (q - p) * 6 * t; - if(t < 1/2) return q; - if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; - return p; + if (t < 0) t += 1; + if (t > 1) t -= 1; + if (t < 1 / 6) return p + (q - p) * 6 * t; + if (t < 1 / 2) return q; + if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; + return p; } - - if(s === 0) { - r = g = b = l; // achromatic + if (s === 0) { + r = g = b = l; // achromatic + } else { + var q = l < 0.5 ? l * (1 + s) : l + s - l * s; + var p = 2 * l - q; + r = hue2rgb(p, q, h + 1 / 3); + g = hue2rgb(p, q, h); + b = hue2rgb(p, q, h - 1 / 3); } - else { - var q = l < 0.5 ? l * (1 + s) : l + s - l * s; - var p = 2 * l - q; - r = hue2rgb(p, q, h + 1/3); - g = hue2rgb(p, q, h); - b = hue2rgb(p, q, h - 1/3); - } - - return { r: r * 255, g: g * 255, b: b * 255 }; -} - -// `rgbToHsv` -// Converts an RGB color value to HSV -// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] -// *Returns:* { h, s, v } in [0,1] -function rgbToHsv(r, g, b) { + return { + r: r * 255, + g: g * 255, + b: b * 255 + }; + } + // `rgbToHsv` + // Converts an RGB color value to HSV + // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] + // *Returns:* { h, s, v } in [0,1] + function rgbToHsv(r, g, b) { r = bound01(r, 255); g = bound01(g, 255); b = bound01(b, 255); - - var max = mathMax(r, g, b), min = mathMin(r, g, b); - var h, s, v = max; - + var max = Math.max(r, g, b), + min = Math.min(r, g, b); + var h, + s, + v = max; var d = max - min; s = max === 0 ? 0 : d / max; - - if(max == min) { - h = 0; // achromatic + if (max == min) { + h = 0; // achromatic + } else { + switch (max) { + case r: + h = (g - b) / d + (g < b ? 6 : 0); + break; + case g: + h = (b - r) / d + 2; + break; + case b: + h = (r - g) / d + 4; + break; + } + h /= 6; } - else { - switch(max) { - case r: h = (g - b) / d + (g < b ? 6 : 0); break; - case g: h = (b - r) / d + 2; break; - case b: h = (r - g) / d + 4; break; - } - h /= 6; - } - return { h: h, s: s, v: v }; -} - -// `hsvToRgb` -// Converts an HSV color value to RGB. -// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] -// *Returns:* { r, g, b } in the set [0, 255] - function hsvToRgb(h, s, v) { + return { + h: h, + s: s, + v: v + }; + } + // `hsvToRgb` + // Converts an HSV color value to RGB. + // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] + // *Returns:* { r, g, b } in the set [0, 255] + function hsvToRgb(h, s, v) { h = bound01(h, 360) * 6; s = bound01(s, 100); v = bound01(v, 100); - var i = Math.floor(h), - f = h - i, - p = v * (1 - s), - q = v * (1 - f * s), - t = v * (1 - (1 - f) * s), - mod = i % 6, - r = [v, q, p, p, t, v][mod], - g = [t, v, v, q, p, p][mod], - b = [p, p, t, v, v, q][mod]; - - return { r: r * 255, g: g * 255, b: b * 255 }; -} - -// `rgbToHex` -// Converts an RGB color to hex -// Assumes r, g, and b are contained in the set [0, 255] -// Returns a 3 or 6 character hex -function rgbToHex(r, g, b, allow3Char) { + f = h - i, + p = v * (1 - s), + q = v * (1 - f * s), + t = v * (1 - (1 - f) * s), + mod = i % 6, + r = [v, q, p, p, t, v][mod], + g = [t, v, v, q, p, p][mod], + b = [p, p, t, v, v, q][mod]; + return { + r: r * 255, + g: g * 255, + b: b * 255 + }; + } - var hex = [ - pad2(mathRound(r).toString(16)), - pad2(mathRound(g).toString(16)), - pad2(mathRound(b).toString(16)) - ]; + // `rgbToHex` + // Converts an RGB color to hex + // Assumes r, g, and b are contained in the set [0, 255] + // Returns a 3 or 6 character hex + function rgbToHex(r, g, b, allow3Char) { + var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))]; // Return a 3 character hex if possible if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) { - return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); + return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); } - return hex.join(""); -} + } -// `rgbaToHex` -// Converts an RGBA color plus alpha transparency to hex -// Assumes r, g, b are contained in the set [0, 255] and -// a in [0, 1]. Returns a 4 or 8 character rgba hex -function rgbaToHex(r, g, b, a, allow4Char) { - - var hex = [ - pad2(mathRound(r).toString(16)), - pad2(mathRound(g).toString(16)), - pad2(mathRound(b).toString(16)), - pad2(convertDecimalToHex(a)) - ]; + // `rgbaToHex` + // Converts an RGBA color plus alpha transparency to hex + // Assumes r, g, b are contained in the set [0, 255] and + // a in [0, 1]. Returns a 4 or 8 character rgba hex + function rgbaToHex(r, g, b, a, allow4Char) { + var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))]; // Return a 4 character hex if possible if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) { - return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0); + return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0); } - return hex.join(""); -} - -// `rgbaToArgbHex` -// Converts an RGBA color to an ARGB Hex8 string -// Rarely used, but required for "toFilter()" -function rgbaToArgbHex(r, g, b, a) { - - var hex = [ - pad2(convertDecimalToHex(a)), - pad2(mathRound(r).toString(16)), - pad2(mathRound(g).toString(16)), - pad2(mathRound(b).toString(16)) - ]; + } + // `rgbaToArgbHex` + // Converts an RGBA color to an ARGB Hex8 string + // Rarely used, but required for "toFilter()" + function rgbaToArgbHex(r, g, b, a) { + var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))]; return hex.join(""); -} + } -// `equals` -// Can be called with any tinycolor input -tinycolor.equals = function (color1, color2) { - if (!color1 || !color2) { return false; } + // `equals` + // Can be called with any tinycolor input + tinycolor.equals = function (color1, color2) { + if (!color1 || !color2) return false; return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); -}; - -tinycolor.random = function() { + }; + tinycolor.random = function () { return tinycolor.fromRatio({ - r: mathRandom(), - g: mathRandom(), - b: mathRandom() + r: Math.random(), + g: Math.random(), + b: Math.random() }); -}; - + }; -// Modification Functions -// ---------------------- -// Thanks to less.js for some of the basics here -// + // Modification Functions + // ---------------------- + // Thanks to less.js for some of the basics here + // -function desaturate(color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); + function _desaturate(color, amount) { + amount = amount === 0 ? 0 : amount || 10; var hsl = tinycolor(color).toHsl(); hsl.s -= amount / 100; hsl.s = clamp01(hsl.s); return tinycolor(hsl); -} - -function saturate(color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); + } + function _saturate(color, amount) { + amount = amount === 0 ? 0 : amount || 10; var hsl = tinycolor(color).toHsl(); hsl.s += amount / 100; hsl.s = clamp01(hsl.s); return tinycolor(hsl); -} - -function greyscale(color) { + } + function _greyscale(color) { return tinycolor(color).desaturate(100); -} - -function lighten (color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); + } + function _lighten(color, amount) { + amount = amount === 0 ? 0 : amount || 10; var hsl = tinycolor(color).toHsl(); hsl.l += amount / 100; hsl.l = clamp01(hsl.l); return tinycolor(hsl); -} - -function brighten(color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); + } + function _brighten(color, amount) { + amount = amount === 0 ? 0 : amount || 10; var rgb = tinycolor(color).toRgb(); - rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100)))); - rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100)))); - rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100)))); + rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100)))); + rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100)))); + rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100)))); return tinycolor(rgb); -} - -function darken (color, amount) { - amount = (amount === 0) ? 0 : (amount || 10); + } + function _darken(color, amount) { + amount = amount === 0 ? 0 : amount || 10; var hsl = tinycolor(color).toHsl(); hsl.l -= amount / 100; hsl.l = clamp01(hsl.l); return tinycolor(hsl); -} + } -// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. -// Values outside of this range will be wrapped into this range. -function spin(color, amount) { + // Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. + // Values outside of this range will be wrapped into this range. + function _spin(color, amount) { var hsl = tinycolor(color).toHsl(); var hue = (hsl.h + amount) % 360; hsl.h = hue < 0 ? 360 + hue : hue; return tinycolor(hsl); -} + } -// Combination Functions -// --------------------- -// Thanks to jQuery xColor for some of the ideas behind these -// + // Combination Functions + // --------------------- + // Thanks to jQuery xColor for some of the ideas behind these + // -function complement(color) { + function _complement(color) { var hsl = tinycolor(color).toHsl(); hsl.h = (hsl.h + 180) % 360; return tinycolor(hsl); -} - -function triad(color) { - var hsl = tinycolor(color).toHsl(); - var h = hsl.h; - return [ - tinycolor(color), - tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }), - tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l }) - ]; -} - -function tetrad(color) { + } + function polyad(color, number) { + if (isNaN(number) || number <= 0) { + throw new Error("Argument to polyad must be a positive number"); + } var hsl = tinycolor(color).toHsl(); - var h = hsl.h; - return [ - tinycolor(color), - tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }), - tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }), - tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l }) - ]; -} - -function splitcomplement(color) { + var result = [tinycolor(color)]; + var step = 360 / number; + for (var i = 1; i < number; i++) { + result.push(tinycolor({ + h: (hsl.h + i * step) % 360, + s: hsl.s, + l: hsl.l + })); + } + return result; + } + function _splitcomplement(color) { var hsl = tinycolor(color).toHsl(); var h = hsl.h; - return [ - tinycolor(color), - tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}), - tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l}) - ]; -} - -function analogous(color, results, slices) { + return [tinycolor(color), tinycolor({ + h: (h + 72) % 360, + s: hsl.s, + l: hsl.l + }), tinycolor({ + h: (h + 216) % 360, + s: hsl.s, + l: hsl.l + })]; + } + function _analogous(color, results, slices) { results = results || 6; slices = slices || 30; - var hsl = tinycolor(color).toHsl(); var part = 360 / slices; var ret = [tinycolor(color)]; - - for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) { - hsl.h = (hsl.h + part) % 360; - ret.push(tinycolor(hsl)); + for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) { + hsl.h = (hsl.h + part) % 360; + ret.push(tinycolor(hsl)); } return ret; -} - -function monochromatic(color, results) { + } + function _monochromatic(color, results) { results = results || 6; var hsv = tinycolor(color).toHsv(); - var h = hsv.h, s = hsv.s, v = hsv.v; + var h = hsv.h, + s = hsv.s, + v = hsv.v; var ret = []; var modification = 1 / results; - while (results--) { - ret.push(tinycolor({ h: h, s: s, v: v})); - v = (v + modification) % 1; + ret.push(tinycolor({ + h: h, + s: s, + v: v + })); + v = (v + modification) % 1; } - return ret; -} + } -// Utility Functions -// --------------------- - -tinycolor.mix = function(color1, color2, amount) { - amount = (amount === 0) ? 0 : (amount || 50); + // Utility Functions + // --------------------- + tinycolor.mix = function (color1, color2, amount) { + amount = amount === 0 ? 0 : amount || 50; var rgb1 = tinycolor(color1).toRgb(); var rgb2 = tinycolor(color2).toRgb(); - var p = amount / 100; - var rgba = { - r: ((rgb2.r - rgb1.r) * p) + rgb1.r, - g: ((rgb2.g - rgb1.g) * p) + rgb1.g, - b: ((rgb2.b - rgb1.b) * p) + rgb1.b, - a: ((rgb2.a - rgb1.a) * p) + rgb1.a + r: (rgb2.r - rgb1.r) * p + rgb1.r, + g: (rgb2.g - rgb1.g) * p + rgb1.g, + b: (rgb2.b - rgb1.b) * p + rgb1.b, + a: (rgb2.a - rgb1.a) * p + rgb1.a }; - return tinycolor(rgba); -}; - + }; -// Readability Functions -// --------------------- -// false -// tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false -tinycolor.isReadable = function(color1, color2, wcag2) { + return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05); + }; + + // `isReadable` + // Ensure that foreground and background color combinations meet WCAG2 guidelines. + // The third argument is an optional Object. + // the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA'; + // the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'. + // If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}. + + // *Example* + // tinycolor.isReadable("#000", "#111") => false + // tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false + tinycolor.isReadable = function (color1, color2, wcag2) { var readability = tinycolor.readability(color1, color2); var wcag2Parms, out; - out = false; - wcag2Parms = validateWCAG2Parms(wcag2); switch (wcag2Parms.level + wcag2Parms.size) { - case "AAsmall": - case "AAAlarge": - out = readability >= 4.5; - break; - case "AAlarge": - out = readability >= 3; - break; - case "AAAsmall": - out = readability >= 7; - break; + case "AAsmall": + case "AAAlarge": + out = readability >= 4.5; + break; + case "AAlarge": + out = readability >= 3; + break; + case "AAAsmall": + out = readability >= 7; + break; } return out; - -}; - -// `mostReadable` -// Given a base color and a list of possible foreground or background -// colors for that base, returns the most readable color. -// Optionally returns Black or White if the most readable color is unreadable. -// *Example* -// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" -// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" -// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3" -// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff" -tinycolor.mostReadable = function(baseColor, colorList, args) { + }; + + // `mostReadable` + // Given a base color and a list of possible foreground or background + // colors for that base, returns the most readable color. + // Optionally returns Black or White if the most readable color is unreadable. + // *Example* + // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" + // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" + // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3" + // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff" + tinycolor.mostReadable = function (baseColor, colorList, args) { var bestColor = null; var bestScore = 0; var readability; - var includeFallbackColors, level, size ; + var includeFallbackColors, level, size; args = args || {}; - includeFallbackColors = args.includeFallbackColors ; + includeFallbackColors = args.includeFallbackColors; level = args.level; size = args.size; - - for (var i= 0; i < colorList.length ; i++) { - readability = tinycolor.readability(baseColor, colorList[i]); - if (readability > bestScore) { - bestScore = readability; - bestColor = tinycolor(colorList[i]); - } - } - - if (tinycolor.isReadable(baseColor, bestColor, {"level":level,"size":size}) || !includeFallbackColors) { - return bestColor; + for (var i = 0; i < colorList.length; i++) { + readability = tinycolor.readability(baseColor, colorList[i]); + if (readability > bestScore) { + bestScore = readability; + bestColor = tinycolor(colorList[i]); + } } - else { - args.includeFallbackColors=false; - return tinycolor.mostReadable(baseColor,["#fff", "#000"],args); + if (tinycolor.isReadable(baseColor, bestColor, { + level: level, + size: size + }) || !includeFallbackColors) { + return bestColor; + } else { + args.includeFallbackColors = false; + return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args); } -}; + }; - -// Big List of Colors -// ------------------ -// -var names = tinycolor.names = { + // Big List of Colors + // ------------------ + // + var names = tinycolor.names = { aliceblue: "f0f8ff", antiquewhite: "faebd7", aqua: "0ff", @@ -952,104 +932,97 @@ var names = tinycolor.names = { whitesmoke: "f5f5f5", yellow: "ff0", yellowgreen: "9acd32" -}; - -// Make it easy to access colors via `hexNames[hex]` -var hexNames = tinycolor.hexNames = flip(names); + }; + // Make it easy to access colors via `hexNames[hex]` + var hexNames = tinycolor.hexNames = flip(names); -// Utilities -// --------- + // Utilities + // --------- -// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }` -function flip(o) { - var flipped = { }; + // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }` + function flip(o) { + var flipped = {}; for (var i in o) { - if (o.hasOwnProperty(i)) { - flipped[o[i]] = i; - } + if (o.hasOwnProperty(i)) { + flipped[o[i]] = i; + } } return flipped; -} + } -// Return a valid alpha value [0,1] with all invalid values being set to 1 -function boundAlpha(a) { + // Return a valid alpha value [0,1] with all invalid values being set to 1 + function boundAlpha(a) { a = parseFloat(a); - if (isNaN(a) || a < 0 || a > 1) { - a = 1; + a = 1; } - return a; -} - -// Take input from [0, n] and return it as [0, 1] -function bound01(n, max) { - if (isOnePointZero(n)) { n = "100%"; } + } + // Take input from [0, n] and return it as [0, 1] + function bound01(n, max) { + if (isOnePointZero(n)) n = "100%"; var processPercent = isPercentage(n); - n = mathMin(max, mathMax(0, parseFloat(n))); + n = Math.min(max, Math.max(0, parseFloat(n))); // Automatically convert percentage into number if (processPercent) { - n = parseInt(n * max, 10) / 100; + n = parseInt(n * max, 10) / 100; } // Handle floating point rounding errors - if ((Math.abs(n - max) < 0.000001)) { - return 1; + if (Math.abs(n - max) < 0.000001) { + return 1; } // Convert into [0, 1] range if it isn't already - return (n % max) / parseFloat(max); -} + return n % max / parseFloat(max); + } -// Force a number between 0 and 1 -function clamp01(val) { - return mathMin(1, mathMax(0, val)); -} + // Force a number between 0 and 1 + function clamp01(val) { + return Math.min(1, Math.max(0, val)); + } -// Parse a base-16 hex value into a base-10 integer -function parseIntFromHex(val) { + // Parse a base-16 hex value into a base-10 integer + function parseIntFromHex(val) { return parseInt(val, 16); -} - -// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 -// -function isOnePointZero(n) { - return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1; -} - -// Check to see if string passed in is a percentage -function isPercentage(n) { - return typeof n === "string" && n.indexOf('%') != -1; -} - -// Force a hex value to have 2 characters -function pad2(c) { - return c.length == 1 ? '0' + c : '' + c; -} - -// Replace a decimal with it's percentage value -function convertToPercentage(n) { + } + + // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 + // + function isOnePointZero(n) { + return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1; + } + + // Check to see if string passed in is a percentage + function isPercentage(n) { + return typeof n === "string" && n.indexOf("%") != -1; + } + + // Force a hex value to have 2 characters + function pad2(c) { + return c.length == 1 ? "0" + c : "" + c; + } + + // Replace a decimal with it's percentage value + function convertToPercentage(n) { if (n <= 1) { - n = (n * 100) + "%"; + n = n * 100 + "%"; } - return n; -} + } -// Converts a decimal to a hex value -function convertDecimalToHex(d) { + // Converts a decimal to a hex value + function convertDecimalToHex(d) { return Math.round(parseFloat(d) * 255).toString(16); -} -// Converts a hex value to a decimal -function convertHexToDecimal(h) { - return (parseIntFromHex(h) / 255); -} - -var matchers = (function() { - + } + // Converts a hex value to a decimal + function convertHexToDecimal(h) { + return parseIntFromHex(h) / 255; + } + var matchers = function () { // var CSS_INTEGER = "[-\\+]?\\d+%?"; @@ -1064,42 +1037,45 @@ var matchers = (function() { // Whitespace can take the place of commas or opening paren var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; - return { - CSS_UNIT: new RegExp(CSS_UNIT), - rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), - rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), - hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), - hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), - hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), - hsva: new RegExp("hsva" + PERMISSIVE_MATCH4), - hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, - hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, - hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, - hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ + CSS_UNIT: new RegExp(CSS_UNIT), + rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), + rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), + hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), + hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), + hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), + hsva: new RegExp("hsva" + PERMISSIVE_MATCH4), + hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, + hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, + hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, + hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ }; -})(); + }(); -// `isValidCSSUnit` -// Take in a single string / number and check to see if it looks like a CSS unit -// (see `matchers` above for definition). -function isValidCSSUnit(color) { + // `isValidCSSUnit` + // Take in a single string / number and check to see if it looks like a CSS unit + // (see `matchers` above for definition). + function isValidCSSUnit(color) { return !!matchers.CSS_UNIT.exec(color); -} - -// `stringInputToObject` -// Permissive string parsing. Take in a number of formats, and output an object -// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` -function stringInputToObject(color) { + } - color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase(); + // `stringInputToObject` + // Permissive string parsing. Take in a number of formats, and output an object + // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` + function stringInputToObject(color) { + color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase(); var named = false; if (names[color]) { - color = names[color]; - named = true; - } - else if (color == 'transparent') { - return { r: 0, g: 0, b: 0, a: 0, format: "name" }; + color = names[color]; + named = true; + } else if (color == "transparent") { + return { + r: 0, + g: 0, + b: 0, + a: 0, + format: "name" + }; } // Try to match string input using regular expressions. @@ -1107,89 +1083,109 @@ function stringInputToObject(color) { // Just return an object and let the conversion functions handle that. // This way the result will be the same whether the tinycolor is initialized with string or object. var match; - if ((match = matchers.rgb.exec(color))) { - return { r: match[1], g: match[2], b: match[3] }; + if (match = matchers.rgb.exec(color)) { + return { + r: match[1], + g: match[2], + b: match[3] + }; } - if ((match = matchers.rgba.exec(color))) { - return { r: match[1], g: match[2], b: match[3], a: match[4] }; + if (match = matchers.rgba.exec(color)) { + return { + r: match[1], + g: match[2], + b: match[3], + a: match[4] + }; } - if ((match = matchers.hsl.exec(color))) { - return { h: match[1], s: match[2], l: match[3] }; + if (match = matchers.hsl.exec(color)) { + return { + h: match[1], + s: match[2], + l: match[3] + }; } - if ((match = matchers.hsla.exec(color))) { - return { h: match[1], s: match[2], l: match[3], a: match[4] }; + if (match = matchers.hsla.exec(color)) { + return { + h: match[1], + s: match[2], + l: match[3], + a: match[4] + }; } - if ((match = matchers.hsv.exec(color))) { - return { h: match[1], s: match[2], v: match[3] }; + if (match = matchers.hsv.exec(color)) { + return { + h: match[1], + s: match[2], + v: match[3] + }; } - if ((match = matchers.hsva.exec(color))) { - return { h: match[1], s: match[2], v: match[3], a: match[4] }; + if (match = matchers.hsva.exec(color)) { + return { + h: match[1], + s: match[2], + v: match[3], + a: match[4] + }; } - if ((match = matchers.hex8.exec(color))) { - return { - r: parseIntFromHex(match[1]), - g: parseIntFromHex(match[2]), - b: parseIntFromHex(match[3]), - a: convertHexToDecimal(match[4]), - format: named ? "name" : "hex8" - }; + if (match = matchers.hex8.exec(color)) { + return { + r: parseIntFromHex(match[1]), + g: parseIntFromHex(match[2]), + b: parseIntFromHex(match[3]), + a: convertHexToDecimal(match[4]), + format: named ? "name" : "hex8" + }; } - if ((match = matchers.hex6.exec(color))) { - return { - r: parseIntFromHex(match[1]), - g: parseIntFromHex(match[2]), - b: parseIntFromHex(match[3]), - format: named ? "name" : "hex" - }; + if (match = matchers.hex6.exec(color)) { + return { + r: parseIntFromHex(match[1]), + g: parseIntFromHex(match[2]), + b: parseIntFromHex(match[3]), + format: named ? "name" : "hex" + }; } - if ((match = matchers.hex4.exec(color))) { - return { - r: parseIntFromHex(match[1] + '' + match[1]), - g: parseIntFromHex(match[2] + '' + match[2]), - b: parseIntFromHex(match[3] + '' + match[3]), - a: convertHexToDecimal(match[4] + '' + match[4]), - format: named ? "name" : "hex8" - }; + if (match = matchers.hex4.exec(color)) { + return { + r: parseIntFromHex(match[1] + "" + match[1]), + g: parseIntFromHex(match[2] + "" + match[2]), + b: parseIntFromHex(match[3] + "" + match[3]), + a: convertHexToDecimal(match[4] + "" + match[4]), + format: named ? "name" : "hex8" + }; } - if ((match = matchers.hex3.exec(color))) { - return { - r: parseIntFromHex(match[1] + '' + match[1]), - g: parseIntFromHex(match[2] + '' + match[2]), - b: parseIntFromHex(match[3] + '' + match[3]), - format: named ? "name" : "hex" - }; + if (match = matchers.hex3.exec(color)) { + return { + r: parseIntFromHex(match[1] + "" + match[1]), + g: parseIntFromHex(match[2] + "" + match[2]), + b: parseIntFromHex(match[3] + "" + match[3]), + format: named ? "name" : "hex" + }; } - return false; -} - -function validateWCAG2Parms(parms) { + } + function validateWCAG2Parms(parms) { // return valid WCAG2 parms for isReadable. // If input parms are invalid, return {"level":"AA", "size":"small"} var level, size; - parms = parms || {"level":"AA", "size":"small"}; + parms = parms || { + level: "AA", + size: "small" + }; level = (parms.level || "AA").toUpperCase(); size = (parms.size || "small").toLowerCase(); if (level !== "AA" && level !== "AAA") { - level = "AA"; + level = "AA"; } if (size !== "small" && size !== "large") { - size = "small"; + size = "small"; } - return {"level":level, "size":size}; -} + return { + level: level, + size: size + }; + } -// Node: Export function -if (typeof module !== "undefined" && module.exports) { - module.exports = tinycolor; -} -// AMD/requirejs: Define the module -else if (typeof define === 'function' && define.amd) { - define(function () {return tinycolor;}); -} -// Browser: Expose to window -else { - window.tinycolor = tinycolor; -} + return tinycolor; -})(Math); +})); diff --git a/project starter code/node_modules/to-regex-range/LICENSE b/project starter code/node_modules/to-regex-range/LICENSE new file mode 100644 index 00000000..7cccaf9e --- /dev/null +++ b/project starter code/node_modules/to-regex-range/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015-present, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/project starter code/node_modules/to-regex-range/README.md b/project starter code/node_modules/to-regex-range/README.md new file mode 100644 index 00000000..38887daf --- /dev/null +++ b/project starter code/node_modules/to-regex-range/README.md @@ -0,0 +1,305 @@ +# to-regex-range [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W8YFZ425KND68) [![NPM version](https://img.shields.io/npm/v/to-regex-range.svg?style=flat)](https://www.npmjs.com/package/to-regex-range) [![NPM monthly downloads](https://img.shields.io/npm/dm/to-regex-range.svg?style=flat)](https://npmjs.org/package/to-regex-range) [![NPM total downloads](https://img.shields.io/npm/dt/to-regex-range.svg?style=flat)](https://npmjs.org/package/to-regex-range) [![Linux Build Status](https://img.shields.io/travis/micromatch/to-regex-range.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/to-regex-range) + +> Pass two numbers, get a regex-compatible source string for matching ranges. Validated against more than 2.78 million test assertions. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save to-regex-range +``` + +
      +What does this do? + +
      + +This libary generates the `source` string to be passed to `new RegExp()` for matching a range of numbers. + +**Example** + +```js +const toRegexRange = require('to-regex-range'); +const regex = new RegExp(toRegexRange('15', '95')); +``` + +A string is returned so that you can do whatever you need with it before passing it to `new RegExp()` (like adding `^` or `$` boundaries, defining flags, or combining it another string). + +
      + +
      + +
      +Why use this library? + +
      + +### Convenience + +Creating regular expressions for matching numbers gets deceptively complicated pretty fast. + +For example, let's say you need a validation regex for matching part of a user-id, postal code, social security number, tax id, etc: + +* regex for matching `1` => `/1/` (easy enough) +* regex for matching `1` through `5` => `/[1-5]/` (not bad...) +* regex for matching `1` or `5` => `/(1|5)/` (still easy...) +* regex for matching `1` through `50` => `/([1-9]|[1-4][0-9]|50)/` (uh-oh...) +* regex for matching `1` through `55` => `/([1-9]|[1-4][0-9]|5[0-5])/` (no prob, I can do this...) +* regex for matching `1` through `555` => `/([1-9]|[1-9][0-9]|[1-4][0-9]{2}|5[0-4][0-9]|55[0-5])/` (maybe not...) +* regex for matching `0001` through `5555` => `/(0{3}[1-9]|0{2}[1-9][0-9]|0[1-9][0-9]{2}|[1-4][0-9]{3}|5[0-4][0-9]{2}|55[0-4][0-9]|555[0-5])/` (okay, I get the point!) + +The numbers are contrived, but they're also really basic. In the real world you might need to generate a regex on-the-fly for validation. + +**Learn more** + +If you're interested in learning more about [character classes](http://www.regular-expressions.info/charclass.html) and other regex features, I personally have always found [regular-expressions.info](http://www.regular-expressions.info/charclass.html) to be pretty useful. + +### Heavily tested + +As of April 07, 2019, this library runs [>1m test assertions](./test/test.js) against generated regex-ranges to provide brute-force verification that results are correct. + +Tests run in ~280ms on my MacBook Pro, 2.5 GHz Intel Core i7. + +### Optimized + +Generated regular expressions are optimized: + +* duplicate sequences and character classes are reduced using quantifiers +* smart enough to use `?` conditionals when number(s) or range(s) can be positive or negative +* uses fragment caching to avoid processing the same exact string more than once + +
      + +
      + +## Usage + +Add this library to your javascript application with the following line of code + +```js +const toRegexRange = require('to-regex-range'); +``` + +The main export is a function that takes two integers: the `min` value and `max` value (formatted as strings or numbers). + +```js +const source = toRegexRange('15', '95'); +//=> 1[5-9]|[2-8][0-9]|9[0-5] + +const regex = new RegExp(`^${source}$`); +console.log(regex.test('14')); //=> false +console.log(regex.test('50')); //=> true +console.log(regex.test('94')); //=> true +console.log(regex.test('96')); //=> false +``` + +## Options + +### options.capture + +**Type**: `boolean` + +**Deafault**: `undefined` + +Wrap the returned value in parentheses when there is more than one regex condition. Useful when you're dynamically generating ranges. + +```js +console.log(toRegexRange('-10', '10')); +//=> -[1-9]|-?10|[0-9] + +console.log(toRegexRange('-10', '10', { capture: true })); +//=> (-[1-9]|-?10|[0-9]) +``` + +### options.shorthand + +**Type**: `boolean` + +**Deafault**: `undefined` + +Use the regex shorthand for `[0-9]`: + +```js +console.log(toRegexRange('0', '999999')); +//=> [0-9]|[1-9][0-9]{1,5} + +console.log(toRegexRange('0', '999999', { shorthand: true })); +//=> \d|[1-9]\d{1,5} +``` + +### options.relaxZeros + +**Type**: `boolean` + +**Default**: `true` + +This option relaxes matching for leading zeros when when ranges are zero-padded. + +```js +const source = toRegexRange('-0010', '0010'); +const regex = new RegExp(`^${source}$`); +console.log(regex.test('-10')); //=> true +console.log(regex.test('-010')); //=> true +console.log(regex.test('-0010')); //=> true +console.log(regex.test('10')); //=> true +console.log(regex.test('010')); //=> true +console.log(regex.test('0010')); //=> true +``` + +When `relaxZeros` is false, matching is strict: + +```js +const source = toRegexRange('-0010', '0010', { relaxZeros: false }); +const regex = new RegExp(`^${source}$`); +console.log(regex.test('-10')); //=> false +console.log(regex.test('-010')); //=> false +console.log(regex.test('-0010')); //=> true +console.log(regex.test('10')); //=> false +console.log(regex.test('010')); //=> false +console.log(regex.test('0010')); //=> true +``` + +## Examples + +| **Range** | **Result** | **Compile time** | +| --- | --- | --- | +| `toRegexRange(-10, 10)` | `-[1-9]\|-?10\|[0-9]` | _132μs_ | +| `toRegexRange(-100, -10)` | `-1[0-9]\|-[2-9][0-9]\|-100` | _50μs_ | +| `toRegexRange(-100, 100)` | `-[1-9]\|-?[1-9][0-9]\|-?100\|[0-9]` | _42μs_ | +| `toRegexRange(001, 100)` | `0{0,2}[1-9]\|0?[1-9][0-9]\|100` | _109μs_ | +| `toRegexRange(001, 555)` | `0{0,2}[1-9]\|0?[1-9][0-9]\|[1-4][0-9]{2}\|5[0-4][0-9]\|55[0-5]` | _51μs_ | +| `toRegexRange(0010, 1000)` | `0{0,2}1[0-9]\|0{0,2}[2-9][0-9]\|0?[1-9][0-9]{2}\|1000` | _31μs_ | +| `toRegexRange(1, 50)` | `[1-9]\|[1-4][0-9]\|50` | _24μs_ | +| `toRegexRange(1, 55)` | `[1-9]\|[1-4][0-9]\|5[0-5]` | _23μs_ | +| `toRegexRange(1, 555)` | `[1-9]\|[1-9][0-9]\|[1-4][0-9]{2}\|5[0-4][0-9]\|55[0-5]` | _30μs_ | +| `toRegexRange(1, 5555)` | `[1-9]\|[1-9][0-9]{1,2}\|[1-4][0-9]{3}\|5[0-4][0-9]{2}\|55[0-4][0-9]\|555[0-5]` | _43μs_ | +| `toRegexRange(111, 555)` | `11[1-9]\|1[2-9][0-9]\|[2-4][0-9]{2}\|5[0-4][0-9]\|55[0-5]` | _38μs_ | +| `toRegexRange(29, 51)` | `29\|[34][0-9]\|5[01]` | _24μs_ | +| `toRegexRange(31, 877)` | `3[1-9]\|[4-9][0-9]\|[1-7][0-9]{2}\|8[0-6][0-9]\|87[0-7]` | _32μs_ | +| `toRegexRange(5, 5)` | `5` | _8μs_ | +| `toRegexRange(5, 6)` | `5\|6` | _11μs_ | +| `toRegexRange(1, 2)` | `1\|2` | _6μs_ | +| `toRegexRange(1, 5)` | `[1-5]` | _15μs_ | +| `toRegexRange(1, 10)` | `[1-9]\|10` | _22μs_ | +| `toRegexRange(1, 100)` | `[1-9]\|[1-9][0-9]\|100` | _25μs_ | +| `toRegexRange(1, 1000)` | `[1-9]\|[1-9][0-9]{1,2}\|1000` | _31μs_ | +| `toRegexRange(1, 10000)` | `[1-9]\|[1-9][0-9]{1,3}\|10000` | _34μs_ | +| `toRegexRange(1, 100000)` | `[1-9]\|[1-9][0-9]{1,4}\|100000` | _36μs_ | +| `toRegexRange(1, 1000000)` | `[1-9]\|[1-9][0-9]{1,5}\|1000000` | _42μs_ | +| `toRegexRange(1, 10000000)` | `[1-9]\|[1-9][0-9]{1,6}\|10000000` | _42μs_ | + +## Heads up! + +**Order of arguments** + +When the `min` is larger than the `max`, values will be flipped to create a valid range: + +```js +toRegexRange('51', '29'); +``` + +Is effectively flipped to: + +```js +toRegexRange('29', '51'); +//=> 29|[3-4][0-9]|5[0-1] +``` + +**Steps / increments** + +This library does not support steps (increments). A pr to add support would be welcome. + +## History + +### v2.0.0 - 2017-04-21 + +**New features** + +Adds support for zero-padding! + +### v1.0.0 + +**Optimizations** + +Repeating ranges are now grouped using quantifiers. rocessing time is roughly the same, but the generated regex is much smaller, which should result in faster matching. + +## Attribution + +Inspired by the python library [range-regex](https://github.com/dimka665/range-regex). + +## About + +
      +Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
      + +
      +Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
      + +
      +Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
      + +### Related projects + +You might also be interested in these projects: + +* [expand-range](https://www.npmjs.com/package/expand-range): Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. Used… [more](https://github.com/jonschlinkert/expand-range) | [homepage](https://github.com/jonschlinkert/expand-range "Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. Used by micromatch.") +* [fill-range](https://www.npmjs.com/package/fill-range): Fill in a range of numbers or letters, optionally passing an increment or `step` to… [more](https://github.com/jonschlinkert/fill-range) | [homepage](https://github.com/jonschlinkert/fill-range "Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex`") +* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/micromatch/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.") +* [repeat-element](https://www.npmjs.com/package/repeat-element): Create an array by repeating the given value n times. | [homepage](https://github.com/jonschlinkert/repeat-element "Create an array by repeating the given value n times.") +* [repeat-string](https://www.npmjs.com/package/repeat-string): Repeat the given string n times. Fastest implementation for repeating a string. | [homepage](https://github.com/jonschlinkert/repeat-string "Repeat the given string n times. Fastest implementation for repeating a string.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 63 | [jonschlinkert](https://github.com/jonschlinkert) | +| 3 | [doowb](https://github.com/doowb) | +| 2 | [realityking](https://github.com/realityking) | + +### Author + +**Jon Schlinkert** + +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) + +Please consider supporting me on Patreon, or [start your own Patreon page](https://patreon.com/invite/bxpbvm)! + + + + + +### License + +Copyright © 2019, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 07, 2019._ \ No newline at end of file diff --git a/project starter code/node_modules/to-regex-range/index.js b/project starter code/node_modules/to-regex-range/index.js new file mode 100644 index 00000000..77fbaced --- /dev/null +++ b/project starter code/node_modules/to-regex-range/index.js @@ -0,0 +1,288 @@ +/*! + * to-regex-range + * + * Copyright (c) 2015-present, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +const isNumber = require('is-number'); + +const toRegexRange = (min, max, options) => { + if (isNumber(min) === false) { + throw new TypeError('toRegexRange: expected the first argument to be a number'); + } + + if (max === void 0 || min === max) { + return String(min); + } + + if (isNumber(max) === false) { + throw new TypeError('toRegexRange: expected the second argument to be a number.'); + } + + let opts = { relaxZeros: true, ...options }; + if (typeof opts.strictZeros === 'boolean') { + opts.relaxZeros = opts.strictZeros === false; + } + + let relax = String(opts.relaxZeros); + let shorthand = String(opts.shorthand); + let capture = String(opts.capture); + let wrap = String(opts.wrap); + let cacheKey = min + ':' + max + '=' + relax + shorthand + capture + wrap; + + if (toRegexRange.cache.hasOwnProperty(cacheKey)) { + return toRegexRange.cache[cacheKey].result; + } + + let a = Math.min(min, max); + let b = Math.max(min, max); + + if (Math.abs(a - b) === 1) { + let result = min + '|' + max; + if (opts.capture) { + return `(${result})`; + } + if (opts.wrap === false) { + return result; + } + return `(?:${result})`; + } + + let isPadded = hasPadding(min) || hasPadding(max); + let state = { min, max, a, b }; + let positives = []; + let negatives = []; + + if (isPadded) { + state.isPadded = isPadded; + state.maxLen = String(state.max).length; + } + + if (a < 0) { + let newMin = b < 0 ? Math.abs(b) : 1; + negatives = splitToPatterns(newMin, Math.abs(a), state, opts); + a = state.a = 0; + } + + if (b >= 0) { + positives = splitToPatterns(a, b, state, opts); + } + + state.negatives = negatives; + state.positives = positives; + state.result = collatePatterns(negatives, positives, opts); + + if (opts.capture === true) { + state.result = `(${state.result})`; + } else if (opts.wrap !== false && (positives.length + negatives.length) > 1) { + state.result = `(?:${state.result})`; + } + + toRegexRange.cache[cacheKey] = state; + return state.result; +}; + +function collatePatterns(neg, pos, options) { + let onlyNegative = filterPatterns(neg, pos, '-', false, options) || []; + let onlyPositive = filterPatterns(pos, neg, '', false, options) || []; + let intersected = filterPatterns(neg, pos, '-?', true, options) || []; + let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive); + return subpatterns.join('|'); +} + +function splitToRanges(min, max) { + let nines = 1; + let zeros = 1; + + let stop = countNines(min, nines); + let stops = new Set([max]); + + while (min <= stop && stop <= max) { + stops.add(stop); + nines += 1; + stop = countNines(min, nines); + } + + stop = countZeros(max + 1, zeros) - 1; + + while (min < stop && stop <= max) { + stops.add(stop); + zeros += 1; + stop = countZeros(max + 1, zeros) - 1; + } + + stops = [...stops]; + stops.sort(compare); + return stops; +} + +/** + * Convert a range to a regex pattern + * @param {Number} `start` + * @param {Number} `stop` + * @return {String} + */ + +function rangeToPattern(start, stop, options) { + if (start === stop) { + return { pattern: start, count: [], digits: 0 }; + } + + let zipped = zip(start, stop); + let digits = zipped.length; + let pattern = ''; + let count = 0; + + for (let i = 0; i < digits; i++) { + let [startDigit, stopDigit] = zipped[i]; + + if (startDigit === stopDigit) { + pattern += startDigit; + + } else if (startDigit !== '0' || stopDigit !== '9') { + pattern += toCharacterClass(startDigit, stopDigit, options); + + } else { + count++; + } + } + + if (count) { + pattern += options.shorthand === true ? '\\d' : '[0-9]'; + } + + return { pattern, count: [count], digits }; +} + +function splitToPatterns(min, max, tok, options) { + let ranges = splitToRanges(min, max); + let tokens = []; + let start = min; + let prev; + + for (let i = 0; i < ranges.length; i++) { + let max = ranges[i]; + let obj = rangeToPattern(String(start), String(max), options); + let zeros = ''; + + if (!tok.isPadded && prev && prev.pattern === obj.pattern) { + if (prev.count.length > 1) { + prev.count.pop(); + } + + prev.count.push(obj.count[0]); + prev.string = prev.pattern + toQuantifier(prev.count); + start = max + 1; + continue; + } + + if (tok.isPadded) { + zeros = padZeros(max, tok, options); + } + + obj.string = zeros + obj.pattern + toQuantifier(obj.count); + tokens.push(obj); + start = max + 1; + prev = obj; + } + + return tokens; +} + +function filterPatterns(arr, comparison, prefix, intersection, options) { + let result = []; + + for (let ele of arr) { + let { string } = ele; + + // only push if _both_ are negative... + if (!intersection && !contains(comparison, 'string', string)) { + result.push(prefix + string); + } + + // or _both_ are positive + if (intersection && contains(comparison, 'string', string)) { + result.push(prefix + string); + } + } + return result; +} + +/** + * Zip strings + */ + +function zip(a, b) { + let arr = []; + for (let i = 0; i < a.length; i++) arr.push([a[i], b[i]]); + return arr; +} + +function compare(a, b) { + return a > b ? 1 : b > a ? -1 : 0; +} + +function contains(arr, key, val) { + return arr.some(ele => ele[key] === val); +} + +function countNines(min, len) { + return Number(String(min).slice(0, -len) + '9'.repeat(len)); +} + +function countZeros(integer, zeros) { + return integer - (integer % Math.pow(10, zeros)); +} + +function toQuantifier(digits) { + let [start = 0, stop = ''] = digits; + if (stop || start > 1) { + return `{${start + (stop ? ',' + stop : '')}}`; + } + return ''; +} + +function toCharacterClass(a, b, options) { + return `[${a}${(b - a === 1) ? '' : '-'}${b}]`; +} + +function hasPadding(str) { + return /^-?(0+)\d/.test(str); +} + +function padZeros(value, tok, options) { + if (!tok.isPadded) { + return value; + } + + let diff = Math.abs(tok.maxLen - String(value).length); + let relax = options.relaxZeros !== false; + + switch (diff) { + case 0: + return ''; + case 1: + return relax ? '0?' : '0'; + case 2: + return relax ? '0{0,2}' : '00'; + default: { + return relax ? `0{0,${diff}}` : `0{${diff}}`; + } + } +} + +/** + * Cache + */ + +toRegexRange.cache = {}; +toRegexRange.clearCache = () => (toRegexRange.cache = {}); + +/** + * Expose `toRegexRange` + */ + +module.exports = toRegexRange; diff --git a/project starter code/node_modules/to-regex-range/package.json b/project starter code/node_modules/to-regex-range/package.json new file mode 100644 index 00000000..4ef194f3 --- /dev/null +++ b/project starter code/node_modules/to-regex-range/package.json @@ -0,0 +1,88 @@ +{ + "name": "to-regex-range", + "description": "Pass two numbers, get a regex-compatible source string for matching ranges. Validated against more than 2.78 million test assertions.", + "version": "5.0.1", + "homepage": "https://github.com/micromatch/to-regex-range", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "Jon Schlinkert (http://twitter.com/jonschlinkert)", + "Rouven Weßling (www.rouvenwessling.de)" + ], + "repository": "micromatch/to-regex-range", + "bugs": { + "url": "https://github.com/micromatch/to-regex-range/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=8.0" + }, + "scripts": { + "test": "mocha" + }, + "dependencies": { + "is-number": "^7.0.0" + }, + "devDependencies": { + "fill-range": "^6.0.0", + "gulp-format-md": "^2.0.0", + "mocha": "^6.0.2", + "text-table": "^0.2.0", + "time-diff": "^0.3.1" + }, + "keywords": [ + "bash", + "date", + "expand", + "expansion", + "expression", + "glob", + "match", + "match date", + "match number", + "match numbers", + "match year", + "matches", + "matching", + "number", + "numbers", + "numerical", + "range", + "ranges", + "regex", + "regexp", + "regular", + "regular expression", + "sequence" + ], + "verb": { + "layout": "default", + "toc": false, + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "helpers": { + "examples": { + "displayName": "examples" + } + }, + "related": { + "list": [ + "expand-range", + "fill-range", + "micromatch", + "repeat-element", + "repeat-string" + ] + } + } +} diff --git a/project starter code/node_modules/token-types/LICENSE b/project starter code/node_modules/token-types/LICENSE new file mode 100644 index 00000000..ffcebb7b --- /dev/null +++ b/project starter code/node_modules/token-types/LICENSE @@ -0,0 +1,7 @@ +Copyright 2017 Borewit + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/project starter code/node_modules/token-types/README.md b/project starter code/node_modules/token-types/README.md new file mode 100644 index 00000000..8391ac6f --- /dev/null +++ b/project starter code/node_modules/token-types/README.md @@ -0,0 +1,115 @@ +![Node.js CI](https://github.com/Borewit/token-types/workflows/Node.js%20CI/badge.svg) +[![NPM version](https://badge.fury.io/js/token-types.svg)](https://npmjs.org/package/token-types) +[![npm downloads](http://img.shields.io/npm/dm/token-types.svg)](https://npmcharts.com/compare/token-types,strtok3?start=1200&interval=30) +[![coveralls](https://coveralls.io/repos/github/Borewit/token-types/badge.svg?branch=master)](https://coveralls.io/github/Borewit/token-types?branch=master) +[![Codacy Badge](https://api.codacy.com/project/badge/Grade/4723ce4613fc49cda8db5eed29f18834)](https://www.codacy.com/app/Borewit/token-types?utm_source=github.com&utm_medium=referral&utm_content=Borewit/token-types&utm_campaign=Badge_Grade) +[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/Borewit/token-types.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Borewit/token-types/context:javascript) +[![Total alerts](https://img.shields.io/lgtm/alerts/g/Borewit/token-types.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Borewit/token-types/alerts/) +[![DeepScan grade](https://deepscan.io/api/teams/5165/projects/6940/branches/61852/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=5165&pid=6940&bid=61852) +[![Known Vulnerabilities](https://snyk.io/test/github/Borewit/token-types/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Borewit/token-types?targetFile=package.json) + +# token-types + +A primitive token library used to read and write from a node `Buffer`. +Although it is possible to use this module directly, it is primary designed to be used with [strtok3 tokenizer](https://github.com/Borewit/strtok3). + +## Installation + +```sh +npm install --save token-types +``` +Usually in combination with [strtok3](https://github.com/Borewit/strtok3): +```sh +npm install --save strtok3 +``` + +Using TypeScript you should also install [@tokenizer/token](https://github.com/Borewit/tokenizer-token) as a development +dependency: + +```shell +npm install --save-dev @tokenizer/token +``` + + +## Example + +```js +const strtok3 = require('strtok3'); +const token = require('token-types'); + +(async () => { + + const tokenizer = await strtok3.fromFile("somefile.bin"); + try { + const myNumber = await tokenizer.readToken(token.Float32_BE); + console.log(`My number: ${myNumber}`); + } finally { + tokenizer.close(); // Close the file + } +})(); +``` + +## Tokens + +### Numeric tokens + +`node-strtok` supports a wide variety of numerical tokens out of the box: + +| Token | Number | Bits | Endianness | +|---------------|------------------|------|----------------| +| `UINT8` | Unsigned integer | 8 | n/a | +| `UINT16_BE` | Unsigned integer | 16 | big endian | +| `UINT16_LE` | Unsigned integer | 16 | little endian | +| `UINT24_BE` | Unsigned integer | 24 | big endian | +| `UINT24_LE` | Unsigned integer | 24 | little endian | +| `UINT32_BE` | Unsigned integer | 32 | big endian | +| `UINT32_LE` | Unsigned integer | 32 | little endian | +| `UINT64_BE` | Unsigned integer | 64 | big endian | +| `UINT64_LE`* | Unsigned integer | 64 | little endian | +| `INT8` | Signed integer | 8 | n/a | +| `INT16_BE` | Signed integer | 16 | big endian | +| `INT16_LE` | Signed integer | 16 | little endian | +| `INT24_BE` | Signed integer | 24 | big endian | +| `INT24_LE` | Signed integer | 24 | little endian | +| `INT32_BE` | Signed integer | 32 | big endian | +| `INT32_LE` | Signed integer | 32 | little endian | +| `INT64_BE` | Signed integer | 64 | big endian | +| `INT64_LE`* | Signed integer | 64 | little endian | +| `Float16_BE` | IEEE 754 float | 16 | big endian | +| `Float16_LE` | IEEE 754 float | 16 | little endian | +| `Float32_BE` | IEEE 754 float | 32 | big endian | +| `Float32_LE` | IEEE 754 float | 32 | little endian | +| `Float64_BE` | IEEE 754 float | 64 | big endian | +| `Float64_LE` | IEEE 754 float | 64 | little endian | +| `Float80_BE`* | IEEE 754 float | 80 | big endian | +| `Float80_LE`* | IEEE 754 float | 80 | little endian | + +### Other tokens + +String types: +* Windows-1252 +* ISO-8859-1 + +*) The tokens exceed the JavaScript IEEE 754 64-bit Floating Point precision, decoding and encoding is best effort based. + +### Custom token + +Complex tokens can be added, which makes very suitable for reading binary files or network messages: +```js + ExtendedHeader = { + len: 10, + + get: (buf, off) => { + return { + // Extended header size + size: Token.UINT32_BE.get(buf, off), + // Extended Flags + extendedFlags: Token.UINT16_BE.get(buf, off + 4), + // Size of padding + sizeOfPadding: Token.UINT32_BE.get(buf, off + 6), + // CRC data present + crcDataPresent: common.strtokBITSET.get(buf, off + 4, 31) + }; + } + }; +``` diff --git a/project starter code/node_modules/token-types/lib/index.d.ts b/project starter code/node_modules/token-types/lib/index.d.ts new file mode 100644 index 00000000..bcf41936 --- /dev/null +++ b/project starter code/node_modules/token-types/lib/index.d.ts @@ -0,0 +1,150 @@ +/// +import { IToken, IGetToken } from '@tokenizer/token'; +/** + * 8-bit unsigned integer + */ +export declare const UINT8: IToken; +/** + * 16-bit unsigned integer, Little Endian byte order + */ +export declare const UINT16_LE: IToken; +/** + * 16-bit unsigned integer, Big Endian byte order + */ +export declare const UINT16_BE: IToken; +/** + * 24-bit unsigned integer, Little Endian byte order + */ +export declare const UINT24_LE: IToken; +/** + * 24-bit unsigned integer, Big Endian byte order + */ +export declare const UINT24_BE: IToken; +/** + * 32-bit unsigned integer, Little Endian byte order + */ +export declare const UINT32_LE: IToken; +/** + * 32-bit unsigned integer, Big Endian byte order + */ +export declare const UINT32_BE: IToken; +/** + * 8-bit signed integer + */ +export declare const INT8: IToken; +/** + * 16-bit signed integer, Big Endian byte order + */ +export declare const INT16_BE: IToken; +/** + * 16-bit signed integer, Little Endian byte order + */ +export declare const INT16_LE: IToken; +/** + * 24-bit signed integer, Little Endian byte order + */ +export declare const INT24_LE: IToken; +/** + * 24-bit signed integer, Big Endian byte order + */ +export declare const INT24_BE: IToken; +/** + * 32-bit signed integer, Big Endian byte order + */ +export declare const INT32_BE: IToken; +/** + * 32-bit signed integer, Big Endian byte order + */ +export declare const INT32_LE: IToken; +/** + * 64-bit unsigned integer, Little Endian byte order + */ +export declare const UINT64_LE: IToken; +/** + * 64-bit signed integer, Little Endian byte order + */ +export declare const INT64_LE: IToken; +/** + * 64-bit unsigned integer, Big Endian byte order + */ +export declare const UINT64_BE: IToken; +/** + * 64-bit signed integer, Big Endian byte order + */ +export declare const INT64_BE: IToken; +/** + * IEEE 754 16-bit (half precision) float, big endian + */ +export declare const Float16_BE: IToken; +/** + * IEEE 754 16-bit (half precision) float, little endian + */ +export declare const Float16_LE: IToken; +/** + * IEEE 754 32-bit (single precision) float, big endian + */ +export declare const Float32_BE: IToken; +/** + * IEEE 754 32-bit (single precision) float, little endian + */ +export declare const Float32_LE: IToken; +/** + * IEEE 754 64-bit (double precision) float, big endian + */ +export declare const Float64_BE: IToken; +/** + * IEEE 754 64-bit (double precision) float, little endian + */ +export declare const Float64_LE: IToken; +/** + * IEEE 754 80-bit (extended precision) float, big endian + */ +export declare const Float80_BE: IToken; +/** + * IEEE 754 80-bit (extended precision) float, little endian + */ +export declare const Float80_LE: IToken; +/** + * Ignore a given number of bytes + */ +export declare class IgnoreType implements IGetToken { + len: number; + /** + * @param len number of bytes to ignore + */ + constructor(len: number); + get(array: Uint8Array, off: number): void; +} +export declare class Uint8ArrayType implements IGetToken { + len: number; + constructor(len: number); + get(array: Uint8Array, offset: number): Uint8Array; +} +export declare class BufferType implements IGetToken { + len: number; + constructor(len: number); + get(uint8Array: Uint8Array, off: number): Buffer; +} +/** + * Consume a fixed number of bytes from the stream and return a string with a specified encoding. + */ +export declare class StringType implements IGetToken { + len: number; + encoding: BufferEncoding; + constructor(len: number, encoding: BufferEncoding); + get(uint8Array: Uint8Array, offset: number): string; +} +/** + * ANSI Latin 1 String + * Using windows-1252 / ISO 8859-1 decoding + */ +export declare class AnsiStringType implements IGetToken { + len: number; + private static windows1252; + private static decode; + private static inRange; + private static codePointToString; + private static singleByteDecoder; + constructor(len: number); + get(buffer: Buffer, offset?: number): string; +} diff --git a/project starter code/node_modules/token-types/lib/index.js b/project starter code/node_modules/token-types/lib/index.js new file mode 100644 index 00000000..82d8e0a2 --- /dev/null +++ b/project starter code/node_modules/token-types/lib/index.js @@ -0,0 +1,455 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AnsiStringType = exports.StringType = exports.BufferType = exports.Uint8ArrayType = exports.IgnoreType = exports.Float80_LE = exports.Float80_BE = exports.Float64_LE = exports.Float64_BE = exports.Float32_LE = exports.Float32_BE = exports.Float16_LE = exports.Float16_BE = exports.INT64_BE = exports.UINT64_BE = exports.INT64_LE = exports.UINT64_LE = exports.INT32_LE = exports.INT32_BE = exports.INT24_BE = exports.INT24_LE = exports.INT16_LE = exports.INT16_BE = exports.INT8 = exports.UINT32_BE = exports.UINT32_LE = exports.UINT24_BE = exports.UINT24_LE = exports.UINT16_BE = exports.UINT16_LE = exports.UINT8 = void 0; +const ieee754 = require("ieee754"); +// Primitive types +function dv(array) { + return new DataView(array.buffer, array.byteOffset); +} +/** + * 8-bit unsigned integer + */ +exports.UINT8 = { + len: 1, + get(array, offset) { + return dv(array).getUint8(offset); + }, + put(array, offset, value) { + dv(array).setUint8(offset, value); + return offset + 1; + } +}; +/** + * 16-bit unsigned integer, Little Endian byte order + */ +exports.UINT16_LE = { + len: 2, + get(array, offset) { + return dv(array).getUint16(offset, true); + }, + put(array, offset, value) { + dv(array).setUint16(offset, value, true); + return offset + 2; + } +}; +/** + * 16-bit unsigned integer, Big Endian byte order + */ +exports.UINT16_BE = { + len: 2, + get(array, offset) { + return dv(array).getUint16(offset); + }, + put(array, offset, value) { + dv(array).setUint16(offset, value); + return offset + 2; + } +}; +/** + * 24-bit unsigned integer, Little Endian byte order + */ +exports.UINT24_LE = { + len: 3, + get(array, offset) { + const dataView = dv(array); + return dataView.getUint8(offset) + (dataView.getUint16(offset + 1, true) << 8); + }, + put(array, offset, value) { + const dataView = dv(array); + dataView.setUint8(offset, value & 0xff); + dataView.setUint16(offset + 1, value >> 8, true); + return offset + 3; + } +}; +/** + * 24-bit unsigned integer, Big Endian byte order + */ +exports.UINT24_BE = { + len: 3, + get(array, offset) { + const dataView = dv(array); + return (dataView.getUint16(offset) << 8) + dataView.getUint8(offset + 2); + }, + put(array, offset, value) { + const dataView = dv(array); + dataView.setUint16(offset, value >> 8); + dataView.setUint8(offset + 2, value & 0xff); + return offset + 3; + } +}; +/** + * 32-bit unsigned integer, Little Endian byte order + */ +exports.UINT32_LE = { + len: 4, + get(array, offset) { + return dv(array).getUint32(offset, true); + }, + put(array, offset, value) { + dv(array).setUint32(offset, value, true); + return offset + 4; + } +}; +/** + * 32-bit unsigned integer, Big Endian byte order + */ +exports.UINT32_BE = { + len: 4, + get(array, offset) { + return dv(array).getUint32(offset); + }, + put(array, offset, value) { + dv(array).setUint32(offset, value); + return offset + 4; + } +}; +/** + * 8-bit signed integer + */ +exports.INT8 = { + len: 1, + get(array, offset) { + return dv(array).getInt8(offset); + }, + put(array, offset, value) { + dv(array).setInt8(offset, value); + return offset + 1; + } +}; +/** + * 16-bit signed integer, Big Endian byte order + */ +exports.INT16_BE = { + len: 2, + get(array, offset) { + return dv(array).getInt16(offset); + }, + put(array, offset, value) { + dv(array).setInt16(offset, value); + return offset + 2; + } +}; +/** + * 16-bit signed integer, Little Endian byte order + */ +exports.INT16_LE = { + len: 2, + get(array, offset) { + return dv(array).getInt16(offset, true); + }, + put(array, offset, value) { + dv(array).setInt16(offset, value, true); + return offset + 2; + } +}; +/** + * 24-bit signed integer, Little Endian byte order + */ +exports.INT24_LE = { + len: 3, + get(array, offset) { + const unsigned = exports.UINT24_LE.get(array, offset); + return unsigned > 0x7fffff ? unsigned - 0x1000000 : unsigned; + }, + put(array, offset, value) { + const dataView = dv(array); + dataView.setUint8(offset, value & 0xff); + dataView.setUint16(offset + 1, value >> 8, true); + return offset + 3; + } +}; +/** + * 24-bit signed integer, Big Endian byte order + */ +exports.INT24_BE = { + len: 3, + get(array, offset) { + const unsigned = exports.UINT24_BE.get(array, offset); + return unsigned > 0x7fffff ? unsigned - 0x1000000 : unsigned; + }, + put(array, offset, value) { + const dataView = dv(array); + dataView.setUint16(offset, value >> 8); + dataView.setUint8(offset + 2, value & 0xff); + return offset + 3; + } +}; +/** + * 32-bit signed integer, Big Endian byte order + */ +exports.INT32_BE = { + len: 4, + get(array, offset) { + return dv(array).getInt32(offset); + }, + put(array, offset, value) { + dv(array).setInt32(offset, value); + return offset + 4; + } +}; +/** + * 32-bit signed integer, Big Endian byte order + */ +exports.INT32_LE = { + len: 4, + get(array, offset) { + return dv(array).getInt32(offset, true); + }, + put(array, offset, value) { + dv(array).setInt32(offset, value, true); + return offset + 4; + } +}; +/** + * 64-bit unsigned integer, Little Endian byte order + */ +exports.UINT64_LE = { + len: 8, + get(array, offset) { + return dv(array).getBigUint64(offset, true); + }, + put(array, offset, value) { + dv(array).setBigUint64(offset, value, true); + return offset + 8; + } +}; +/** + * 64-bit signed integer, Little Endian byte order + */ +exports.INT64_LE = { + len: 8, + get(array, offset) { + return dv(array).getBigInt64(offset, true); + }, + put(array, offset, value) { + dv(array).setBigInt64(offset, value, true); + return offset + 8; + } +}; +/** + * 64-bit unsigned integer, Big Endian byte order + */ +exports.UINT64_BE = { + len: 8, + get(array, offset) { + return dv(array).getBigUint64(offset); + }, + put(array, offset, value) { + dv(array).setBigUint64(offset, value); + return offset + 8; + } +}; +/** + * 64-bit signed integer, Big Endian byte order + */ +exports.INT64_BE = { + len: 8, + get(array, offset) { + return dv(array).getBigInt64(offset); + }, + put(array, offset, value) { + dv(array).setBigInt64(offset, value); + return offset + 8; + } +}; +/** + * IEEE 754 16-bit (half precision) float, big endian + */ +exports.Float16_BE = { + len: 2, + get(dataView, offset) { + return ieee754.read(dataView, offset, false, 10, this.len); + }, + put(dataView, offset, value) { + ieee754.write(dataView, value, offset, false, 10, this.len); + return offset + this.len; + } +}; +/** + * IEEE 754 16-bit (half precision) float, little endian + */ +exports.Float16_LE = { + len: 2, + get(array, offset) { + return ieee754.read(array, offset, true, 10, this.len); + }, + put(array, offset, value) { + ieee754.write(array, value, offset, true, 10, this.len); + return offset + this.len; + } +}; +/** + * IEEE 754 32-bit (single precision) float, big endian + */ +exports.Float32_BE = { + len: 4, + get(array, offset) { + return dv(array).getFloat32(offset); + }, + put(array, offset, value) { + dv(array).setFloat32(offset, value); + return offset + 4; + } +}; +/** + * IEEE 754 32-bit (single precision) float, little endian + */ +exports.Float32_LE = { + len: 4, + get(array, offset) { + return dv(array).getFloat32(offset, true); + }, + put(array, offset, value) { + dv(array).setFloat32(offset, value, true); + return offset + 4; + } +}; +/** + * IEEE 754 64-bit (double precision) float, big endian + */ +exports.Float64_BE = { + len: 8, + get(array, offset) { + return dv(array).getFloat64(offset); + }, + put(array, offset, value) { + dv(array).setFloat64(offset, value); + return offset + 8; + } +}; +/** + * IEEE 754 64-bit (double precision) float, little endian + */ +exports.Float64_LE = { + len: 8, + get(array, offset) { + return dv(array).getFloat64(offset, true); + }, + put(array, offset, value) { + dv(array).setFloat64(offset, value, true); + return offset + 8; + } +}; +/** + * IEEE 754 80-bit (extended precision) float, big endian + */ +exports.Float80_BE = { + len: 10, + get(array, offset) { + return ieee754.read(array, offset, false, 63, this.len); + }, + put(array, offset, value) { + ieee754.write(array, value, offset, false, 63, this.len); + return offset + this.len; + } +}; +/** + * IEEE 754 80-bit (extended precision) float, little endian + */ +exports.Float80_LE = { + len: 10, + get(array, offset) { + return ieee754.read(array, offset, true, 63, this.len); + }, + put(array, offset, value) { + ieee754.write(array, value, offset, true, 63, this.len); + return offset + this.len; + } +}; +/** + * Ignore a given number of bytes + */ +class IgnoreType { + /** + * @param len number of bytes to ignore + */ + constructor(len) { + this.len = len; + } + // ToDo: don't read, but skip data + get(array, off) { + } +} +exports.IgnoreType = IgnoreType; +class Uint8ArrayType { + constructor(len) { + this.len = len; + } + get(array, offset) { + return array.subarray(offset, offset + this.len); + } +} +exports.Uint8ArrayType = Uint8ArrayType; +class BufferType { + constructor(len) { + this.len = len; + } + get(uint8Array, off) { + return Buffer.from(uint8Array.subarray(off, off + this.len)); + } +} +exports.BufferType = BufferType; +/** + * Consume a fixed number of bytes from the stream and return a string with a specified encoding. + */ +class StringType { + constructor(len, encoding) { + this.len = len; + this.encoding = encoding; + } + get(uint8Array, offset) { + return Buffer.from(uint8Array).toString(this.encoding, offset, offset + this.len); + } +} +exports.StringType = StringType; +/** + * ANSI Latin 1 String + * Using windows-1252 / ISO 8859-1 decoding + */ +class AnsiStringType { + constructor(len) { + this.len = len; + } + static decode(buffer, offset, until) { + let str = ''; + for (let i = offset; i < until; ++i) { + str += AnsiStringType.codePointToString(AnsiStringType.singleByteDecoder(buffer[i])); + } + return str; + } + static inRange(a, min, max) { + return min <= a && a <= max; + } + static codePointToString(cp) { + if (cp <= 0xFFFF) { + return String.fromCharCode(cp); + } + else { + cp -= 0x10000; + return String.fromCharCode((cp >> 10) + 0xD800, (cp & 0x3FF) + 0xDC00); + } + } + static singleByteDecoder(bite) { + if (AnsiStringType.inRange(bite, 0x00, 0x7F)) { + return bite; + } + const codePoint = AnsiStringType.windows1252[bite - 0x80]; + if (codePoint === null) { + throw Error('invaliding encoding'); + } + return codePoint; + } + get(buffer, offset = 0) { + return AnsiStringType.decode(buffer, offset, offset + this.len); + } +} +exports.AnsiStringType = AnsiStringType; +AnsiStringType.windows1252 = [8364, 129, 8218, 402, 8222, 8230, 8224, 8225, 710, 8240, 352, + 8249, 338, 141, 381, 143, 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 732, + 8482, 353, 8250, 339, 157, 382, 376, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, + 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, + 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255]; diff --git a/project starter code/node_modules/token-types/package.json b/project starter code/node_modules/token-types/package.json new file mode 100644 index 00000000..8882afe2 --- /dev/null +++ b/project starter code/node_modules/token-types/package.json @@ -0,0 +1,93 @@ +{ + "name": "token-types", + "version": "4.2.1", + "description": "Common token types for decoding and encoding numeric and string values", + "author": { + "name": "Borewit", + "url": "https://github.com/Borewit" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + }, + "scripts": { + "clean": "del-cli lib/**/*.js lib/***.js.map *.d.ts test/**/*.d.ts test/**/*.js test/**/*.js.map .nyc_output", + "build": "npm run compile", + "compile-src": "tsc --p lib", + "compile-test": "tsc --p test", + "compile": "npm run compile-src && npm run compile-test", + "lint-ts": "tslint lib/index.ts --exclude '*.d.ts' 'test/**/*.ts' --exclude 'test/**/*.d.ts'", + "lint-md": "remark -u preset-lint-recommended .", + "lint": "npm run lint-ts && npm run lint-md", + "test": "mocha --require ts-node/register --require source-map-support/register --full-trace --recursive test/test-*.ts", + "test-coverage": "nyc npm run test" + }, + "engines": { + "node": ">=10" + }, + "repository": { + "type": "git", + "url": "https://github.com/Borewit/token-types" + }, + "files": [ + "lib/index.js", + "lib/index.d.ts" + ], + "license": "MIT", + "main": "lib/index.js", + "types": "lib/index.d.ts", + "bugs": { + "url": "https://github.com/Borewit/token-types/issues" + }, + "devDependencies": { + "@types/chai": "^4.3.1", + "@types/mocha": "^9.1.0", + "@types/node": "^18.6.3", + "chai": "^4.3.6", + "coveralls": "^3.1.1", + "del-cli": "^5.0.0", + "mocha": "^9.2.2", + "nyc": "^15.1.0", + "remark-cli": "^11.0.0", + "remark-preset-lint-recommended": "^6.1.2", + "source-map-support": "^0.5.21", + "ts-node": "^10.9.1", + "tslint": "^6.1.3", + "typescript": "^4.7.4" + }, + "dependencies": { + "@tokenizer/token": "^0.3.0", + "ieee754": "^1.2.1" + }, + "remarkConfig": { + "plugins": [ + "preset-lint-recommended" + ] + }, + "nyc": { + "exclude": [ + "test/**/*.ts", + "lib/**/*.*.js" + ], + "extension": [ + ".ts" + ], + "sourceMap": true, + "instrument": true, + "reporter": [ + "lcov", + "text" + ], + "report-dir": "coverage" + }, + "keywords": [ + "token", + "integer", + "unsigned", + "numeric", + "float", + "IEEE", + "754", + "strtok3" + ] +} diff --git a/project starter code/node_modules/touch/LICENSE b/project starter code/node_modules/touch/LICENSE new file mode 100644 index 00000000..05eeeb88 --- /dev/null +++ b/project starter code/node_modules/touch/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/project starter code/node_modules/touch/README.md b/project starter code/node_modules/touch/README.md new file mode 100644 index 00000000..b5a361e6 --- /dev/null +++ b/project starter code/node_modules/touch/README.md @@ -0,0 +1,52 @@ +# node-touch + +For all your node touching needs. + +## Installing + +```bash +npm install touch +``` + +## CLI Usage: + +See `man touch` + +This package exports a binary called `nodetouch` that works mostly +like the unix builtin `touch(1)`. + +## API Usage: + +```javascript +var touch = require("touch") +``` + +Gives you the following functions: + +* `touch(filename, options, cb)` +* `touch.sync(filename, options)` +* `touch.ftouch(fd, options, cb)` +* `touch.ftouchSync(fd, options)` + +All the `options` objects are optional. + +All the async functions return a Promise. If a callback function is +provided, then it's attached to the Promise. + +## Options + +* `force` like `touch -f` Boolean +* `time` like `touch -t ` Can be a Date object, or any parseable + Date string, or epoch ms number. +* `atime` like `touch -a` Can be either a Boolean, or a Date. +* `mtime` like `touch -m` Can be either a Boolean, or a Date. +* `ref` like `touch -r ` Must be path to a file. +* `nocreate` like `touch -c` Boolean + +If neither `atime` nor `mtime` are set, then both values are set. If +one of them is set, then the other is not. + +## cli + +This package creates a `nodetouch` command line executable that works +very much like the unix builtin `touch(1)` diff --git a/project starter code/node_modules/touch/bin/nodetouch.js b/project starter code/node_modules/touch/bin/nodetouch.js new file mode 100644 index 00000000..f78f0829 --- /dev/null +++ b/project starter code/node_modules/touch/bin/nodetouch.js @@ -0,0 +1,112 @@ +#!/usr/bin/env node +const touch = require("../index.js") + +const usage = code => { + console[code ? 'error' : 'log']( + 'usage:\n' + + 'touch [-acfm] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] file ...' + ) + process.exit(code) +} + +const singleFlags = { + a: 'atime', + m: 'mtime', + c: 'nocreate', + f: 'force' +} + +const singleOpts = { + r: 'ref', + t: 'time' +} + +const files = [] +const args = process.argv.slice(2) +const options = {} +for (let i = 0; i < args.length; i++) { + const arg = args[i] + if (!arg.match(/^-/)) { + files.push(arg) + continue + } + + // expand shorthands + if (arg.charAt(1) !== '-') { + const expand = [] + for (let f = 1; f < arg.length; f++) { + const fc = arg.charAt(f) + const sf = singleFlags[fc] + const so = singleOpts[fc] + if (sf) + expand.push('--' + sf) + else if (so) { + const soslice = arg.slice(f + 1) + const soval = soslice.charAt(0) === '=' ? soslice : '=' + soslice + expand.push('--' + so + soval) + f = arg.length + } else if (arg !== '-' + fc) + expand.push('-' + fc) + } + if (expand.length) { + args.splice.apply(args, [i, 1].concat(expand)) + i-- + continue + } + } + + const argsplit = arg.split('=') + const key = argsplit.shift().replace(/^\-\-/, '') + const val = argsplit.length ? argsplit.join('=') : null + + switch (key) { + case 'time': + const timestr = val || args[++i] + // [-t [[CC]YY]MMDDhhmm[.SS]] + const parsedtime = timestr.match( + /^(([0-9]{2})?([0-9]{2}))?([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})(\.([0-9]{2}))?$/ + ) + if (!parsedtime) { + console.error('touch: out of range or illegal ' + + 'time specification: ' + + '[[CC]YY]MMDDhhmm[.SS]') + process.exit(1) + } else { + const y = +parsedtime[1] + const year = parsedtime[2] ? y + : y <= 68 ? 2000 + y + : 1900 + y + + const MM = +parsedtime[4] - 1 + const dd = +parsedtime[5] + const hh = +parsedtime[6] + const mm = +parsedtime[7] + const ss = +parsedtime[8] + + options.time = new Date(Date.UTC(year, MM, dd, hh, mm, ss)) + } + continue + + case 'ref': + options.ref = val || args[++i] + continue + + case 'mtime': + case 'nocreate': + case 'atime': + case 'force': + options[key] = true + continue + + default: + console.error('touch: illegal option -- ' + arg) + usage(1) + } +} + +if (!files.length) + usage() + +process.exitCode = 0 +Promise.all(files.map(f => touch(f, options))) + .catch(er => process.exitCode = 1) diff --git a/project starter code/node_modules/touch/index.js b/project starter code/node_modules/touch/index.js new file mode 100644 index 00000000..fa6a8d7e --- /dev/null +++ b/project starter code/node_modules/touch/index.js @@ -0,0 +1,224 @@ +'use strict' + +const EE = require('events').EventEmitter +const cons = require('constants') +const fs = require('fs') + +module.exports = (f, options, cb) => { + if (typeof options === 'function') + cb = options, options = {} + + const p = new Promise((res, rej) => { + new Touch(validOpts(options, f, null)) + .on('done', res).on('error', rej) + }) + + return cb ? p.then(res => cb(null, res), cb) : p +} + +module.exports.sync = module.exports.touchSync = (f, options) => + (new TouchSync(validOpts(options, f, null)), undefined) + +module.exports.ftouch = (fd, options, cb) => { + if (typeof options === 'function') + cb = options, options = {} + + const p = new Promise((res, rej) => { + new Touch(validOpts(options, null, fd)) + .on('done', res).on('error', rej) + }) + + return cb ? p.then(res => cb(null, res), cb) : p +} + +module.exports.ftouchSync = (fd, opt) => + (new TouchSync(validOpts(opt, null, fd)), undefined) + +const validOpts = (options, path, fd) => { + options = Object.create(options || {}) + options.fd = fd + options.path = path + + // {mtime: true}, {ctime: true} + // If set to something else, then treat as epoch ms value + const now = new Date(options.time || Date.now()).getTime() / 1000 + if (!options.atime && !options.mtime) + options.atime = options.mtime = now + else { + if (true === options.atime) + options.atime = now + + if (true === options.mtime) + options.mtime = now + } + + let oflags = 0 + if (!options.force) + oflags = oflags | cons.O_RDWR + + if (!options.nocreate) + oflags = oflags | cons.O_CREAT + + options.oflags = oflags + return options +} + +class Touch extends EE { + constructor (options) { + super(options) + this.fd = options.fd + this.path = options.path + this.atime = options.atime + this.mtime = options.mtime + this.ref = options.ref + this.nocreate = !!options.nocreate + this.force = !!options.force + this.closeAfter = options.closeAfter + this.oflags = options.oflags + this.options = options + + if (typeof this.fd !== 'number') { + this.closeAfter = true + this.open() + } else + this.onopen(null, this.fd) + } + + emit (ev, data) { + // we only emit when either done or erroring + // in both cases, need to close + this.close() + return super.emit(ev, data) + } + + close () { + if (typeof this.fd === 'number' && this.closeAfter) + fs.close(this.fd, () => {}) + } + + open () { + fs.open(this.path, this.oflags, (er, fd) => this.onopen(er, fd)) + } + + onopen (er, fd) { + if (er) { + if (er.code === 'EISDIR') + this.onopen(null, null) + else if (er.code === 'ENOENT' && this.nocreate) + this.emit('done') + else + this.emit('error', er) + } else { + this.fd = fd + if (this.ref) + this.statref() + else if (!this.atime || !this.mtime) + this.fstat() + else + this.futimes() + } + } + + statref () { + fs.stat(this.ref, (er, st) => { + if (er) + this.emit('error', er) + else + this.onstatref(st) + }) + } + + onstatref (st) { + this.atime = this.atime && st.atime.getTime()/1000 + this.mtime = this.mtime && st.mtime.getTime()/1000 + if (!this.atime || !this.mtime) + this.fstat() + else + this.futimes() + } + + fstat () { + const stat = this.fd ? 'fstat' : 'stat' + const target = this.fd || this.path + fs[stat](target, (er, st) => { + if (er) + this.emit('error', er) + else + this.onfstat(st) + }) + } + + onfstat (st) { + if (typeof this.atime !== 'number') + this.atime = st.atime.getTime()/1000 + + if (typeof this.mtime !== 'number') + this.mtime = st.mtime.getTime()/1000 + + this.futimes() + } + + futimes () { + const utimes = this.fd ? 'futimes' : 'utimes' + const target = this.fd || this.path + fs[utimes](target, ''+this.atime, ''+this.mtime, er => { + if (er) + this.emit('error', er) + else + this.emit('done') + }) + } +} + +class TouchSync extends Touch { + open () { + try { + this.onopen(null, fs.openSync(this.path, this.oflags)) + } catch (er) { + this.onopen(er) + } + } + + statref () { + let threw = true + try { + this.onstatref(fs.statSync(this.ref)) + threw = false + } finally { + if (threw) + this.close() + } + } + + fstat () { + let threw = true + const stat = this.fd ? 'fstatSync' : 'statSync' + const target = this.fd || this.path + try { + this.onfstat(fs[stat](target)) + threw = false + } finally { + if (threw) + this.close() + } + } + + futimes () { + let threw = true + const utimes = this.fd ? 'futimesSync' : 'utimesSync' + const target = this.fd || this.path + try { + fs[utimes](target, this.atime, this.mtime) + threw = false + } finally { + if (threw) + this.close() + } + this.emit('done') + } + + close () { + if (typeof this.fd === 'number' && this.closeAfter) + try { fs.closeSync(this.fd) } catch (er) {} + } +} diff --git a/project starter code/node_modules/touch/package.json b/project starter code/node_modules/touch/package.json new file mode 100644 index 00000000..a51c29ba --- /dev/null +++ b/project starter code/node_modules/touch/package.json @@ -0,0 +1,25 @@ +{ + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "name": "touch", + "description": "like touch(1) in node", + "version": "3.1.1", + "repository": "git://github.com/isaacs/node-touch.git", + "bin": { + "nodetouch": "./bin/nodetouch.js" + }, + "license": "ISC", + "scripts": { + "test": "tap test/*.js --100 -J", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --all; git push origin --tags" + }, + "devDependencies": { + "mutate-fs": "^1.1.0", + "tap": "^10.7.0" + }, + "files": [ + "index.js", + "bin/nodetouch.js" + ] +} diff --git a/project starter code/node_modules/tr46/.npmignore b/project starter code/node_modules/tr46/.npmignore new file mode 100644 index 00000000..96e9161f --- /dev/null +++ b/project starter code/node_modules/tr46/.npmignore @@ -0,0 +1,4 @@ +scripts/ +test/ + +!lib/mapping_table.json diff --git a/project starter code/node_modules/tr46/index.js b/project starter code/node_modules/tr46/index.js new file mode 100644 index 00000000..9ce12ca2 --- /dev/null +++ b/project starter code/node_modules/tr46/index.js @@ -0,0 +1,193 @@ +"use strict"; + +var punycode = require("punycode"); +var mappingTable = require("./lib/mappingTable.json"); + +var PROCESSING_OPTIONS = { + TRANSITIONAL: 0, + NONTRANSITIONAL: 1 +}; + +function normalize(str) { // fix bug in v8 + return str.split('\u0000').map(function (s) { return s.normalize('NFC'); }).join('\u0000'); +} + +function findStatus(val) { + var start = 0; + var end = mappingTable.length - 1; + + while (start <= end) { + var mid = Math.floor((start + end) / 2); + + var target = mappingTable[mid]; + if (target[0][0] <= val && target[0][1] >= val) { + return target; + } else if (target[0][0] > val) { + end = mid - 1; + } else { + start = mid + 1; + } + } + + return null; +} + +var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; + +function countSymbols(string) { + return string + // replace every surrogate pair with a BMP symbol + .replace(regexAstralSymbols, '_') + // then get the length + .length; +} + +function mapChars(domain_name, useSTD3, processing_option) { + var hasError = false; + var processed = ""; + + var len = countSymbols(domain_name); + for (var i = 0; i < len; ++i) { + var codePoint = domain_name.codePointAt(i); + var status = findStatus(codePoint); + + switch (status[1]) { + case "disallowed": + hasError = true; + processed += String.fromCodePoint(codePoint); + break; + case "ignored": + break; + case "mapped": + processed += String.fromCodePoint.apply(String, status[2]); + break; + case "deviation": + if (processing_option === PROCESSING_OPTIONS.TRANSITIONAL) { + processed += String.fromCodePoint.apply(String, status[2]); + } else { + processed += String.fromCodePoint(codePoint); + } + break; + case "valid": + processed += String.fromCodePoint(codePoint); + break; + case "disallowed_STD3_mapped": + if (useSTD3) { + hasError = true; + processed += String.fromCodePoint(codePoint); + } else { + processed += String.fromCodePoint.apply(String, status[2]); + } + break; + case "disallowed_STD3_valid": + if (useSTD3) { + hasError = true; + } + + processed += String.fromCodePoint(codePoint); + break; + } + } + + return { + string: processed, + error: hasError + }; +} + +var combiningMarksRegex = /[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E4-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u192B\u1930-\u193B\u19B0-\u19C0\u19C8\u19C9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2D]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC7F-\uDC82\uDCB0-\uDCBA\uDD00-\uDD02\uDD27-\uDD34\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDE2C-\uDE37\uDEDF-\uDEEA\uDF01-\uDF03\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDE30-\uDE40\uDEAB-\uDEB7]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF51-\uDF7E\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD83A[\uDCD0-\uDCD6]|\uDB40[\uDD00-\uDDEF]/; + +function validateLabel(label, processing_option) { + if (label.substr(0, 4) === "xn--") { + label = punycode.toUnicode(label); + processing_option = PROCESSING_OPTIONS.NONTRANSITIONAL; + } + + var error = false; + + if (normalize(label) !== label || + (label[3] === "-" && label[4] === "-") || + label[0] === "-" || label[label.length - 1] === "-" || + label.indexOf(".") !== -1 || + label.search(combiningMarksRegex) === 0) { + error = true; + } + + var len = countSymbols(label); + for (var i = 0; i < len; ++i) { + var status = findStatus(label.codePointAt(i)); + if ((processing === PROCESSING_OPTIONS.TRANSITIONAL && status[1] !== "valid") || + (processing === PROCESSING_OPTIONS.NONTRANSITIONAL && + status[1] !== "valid" && status[1] !== "deviation")) { + error = true; + break; + } + } + + return { + label: label, + error: error + }; +} + +function processing(domain_name, useSTD3, processing_option) { + var result = mapChars(domain_name, useSTD3, processing_option); + result.string = normalize(result.string); + + var labels = result.string.split("."); + for (var i = 0; i < labels.length; ++i) { + try { + var validation = validateLabel(labels[i]); + labels[i] = validation.label; + result.error = result.error || validation.error; + } catch(e) { + result.error = true; + } + } + + return { + string: labels.join("."), + error: result.error + }; +} + +module.exports.toASCII = function(domain_name, useSTD3, processing_option, verifyDnsLength) { + var result = processing(domain_name, useSTD3, processing_option); + var labels = result.string.split("."); + labels = labels.map(function(l) { + try { + return punycode.toASCII(l); + } catch(e) { + result.error = true; + return l; + } + }); + + if (verifyDnsLength) { + var total = labels.slice(0, labels.length - 1).join(".").length; + if (total.length > 253 || total.length === 0) { + result.error = true; + } + + for (var i=0; i < labels.length; ++i) { + if (labels.length > 63 || labels.length === 0) { + result.error = true; + break; + } + } + } + + if (result.error) return null; + return labels.join("."); +}; + +module.exports.toUnicode = function(domain_name, useSTD3) { + var result = processing(domain_name, useSTD3, PROCESSING_OPTIONS.NONTRANSITIONAL); + + return { + domain: result.string, + error: result.error + }; +}; + +module.exports.PROCESSING_OPTIONS = PROCESSING_OPTIONS; diff --git a/project starter code/node_modules/tr46/lib/.gitkeep b/project starter code/node_modules/tr46/lib/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/project starter code/node_modules/tr46/lib/mappingTable.json b/project starter code/node_modules/tr46/lib/mappingTable.json new file mode 100644 index 00000000..89cf19a7 --- /dev/null +++ b/project starter code/node_modules/tr46/lib/mappingTable.json @@ -0,0 +1 @@ +[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"],[[47,47],"disallowed_STD3_valid"],[[48,57],"valid"],[[58,64],"disallowed_STD3_valid"],[[65,65],"mapped",[97]],[[66,66],"mapped",[98]],[[67,67],"mapped",[99]],[[68,68],"mapped",[100]],[[69,69],"mapped",[101]],[[70,70],"mapped",[102]],[[71,71],"mapped",[103]],[[72,72],"mapped",[104]],[[73,73],"mapped",[105]],[[74,74],"mapped",[106]],[[75,75],"mapped",[107]],[[76,76],"mapped",[108]],[[77,77],"mapped",[109]],[[78,78],"mapped",[110]],[[79,79],"mapped",[111]],[[80,80],"mapped",[112]],[[81,81],"mapped",[113]],[[82,82],"mapped",[114]],[[83,83],"mapped",[115]],[[84,84],"mapped",[116]],[[85,85],"mapped",[117]],[[86,86],"mapped",[118]],[[87,87],"mapped",[119]],[[88,88],"mapped",[120]],[[89,89],"mapped",[121]],[[90,90],"mapped",[122]],[[91,96],"disallowed_STD3_valid"],[[97,122],"valid"],[[123,127],"disallowed_STD3_valid"],[[128,159],"disallowed"],[[160,160],"disallowed_STD3_mapped",[32]],[[161,167],"valid",[],"NV8"],[[168,168],"disallowed_STD3_mapped",[32,776]],[[169,169],"valid",[],"NV8"],[[170,170],"mapped",[97]],[[171,172],"valid",[],"NV8"],[[173,173],"ignored"],[[174,174],"valid",[],"NV8"],[[175,175],"disallowed_STD3_mapped",[32,772]],[[176,177],"valid",[],"NV8"],[[178,178],"mapped",[50]],[[179,179],"mapped",[51]],[[180,180],"disallowed_STD3_mapped",[32,769]],[[181,181],"mapped",[956]],[[182,182],"valid",[],"NV8"],[[183,183],"valid"],[[184,184],"disallowed_STD3_mapped",[32,807]],[[185,185],"mapped",[49]],[[186,186],"mapped",[111]],[[187,187],"valid",[],"NV8"],[[188,188],"mapped",[49,8260,52]],[[189,189],"mapped",[49,8260,50]],[[190,190],"mapped",[51,8260,52]],[[191,191],"valid",[],"NV8"],[[192,192],"mapped",[224]],[[193,193],"mapped",[225]],[[194,194],"mapped",[226]],[[195,195],"mapped",[227]],[[196,196],"mapped",[228]],[[197,197],"mapped",[229]],[[198,198],"mapped",[230]],[[199,199],"mapped",[231]],[[200,200],"mapped",[232]],[[201,201],"mapped",[233]],[[202,202],"mapped",[234]],[[203,203],"mapped",[235]],[[204,204],"mapped",[236]],[[205,205],"mapped",[237]],[[206,206],"mapped",[238]],[[207,207],"mapped",[239]],[[208,208],"mapped",[240]],[[209,209],"mapped",[241]],[[210,210],"mapped",[242]],[[211,211],"mapped",[243]],[[212,212],"mapped",[244]],[[213,213],"mapped",[245]],[[214,214],"mapped",[246]],[[215,215],"valid",[],"NV8"],[[216,216],"mapped",[248]],[[217,217],"mapped",[249]],[[218,218],"mapped",[250]],[[219,219],"mapped",[251]],[[220,220],"mapped",[252]],[[221,221],"mapped",[253]],[[222,222],"mapped",[254]],[[223,223],"deviation",[115,115]],[[224,246],"valid"],[[247,247],"valid",[],"NV8"],[[248,255],"valid"],[[256,256],"mapped",[257]],[[257,257],"valid"],[[258,258],"mapped",[259]],[[259,259],"valid"],[[260,260],"mapped",[261]],[[261,261],"valid"],[[262,262],"mapped",[263]],[[263,263],"valid"],[[264,264],"mapped",[265]],[[265,265],"valid"],[[266,266],"mapped",[267]],[[267,267],"valid"],[[268,268],"mapped",[269]],[[269,269],"valid"],[[270,270],"mapped",[271]],[[271,271],"valid"],[[272,272],"mapped",[273]],[[273,273],"valid"],[[274,274],"mapped",[275]],[[275,275],"valid"],[[276,276],"mapped",[277]],[[277,277],"valid"],[[278,278],"mapped",[279]],[[279,279],"valid"],[[280,280],"mapped",[281]],[[281,281],"valid"],[[282,282],"mapped",[283]],[[283,283],"valid"],[[284,284],"mapped",[285]],[[285,285],"valid"],[[286,286],"mapped",[287]],[[287,287],"valid"],[[288,288],"mapped",[289]],[[289,289],"valid"],[[290,290],"mapped",[291]],[[291,291],"valid"],[[292,292],"mapped",[293]],[[293,293],"valid"],[[294,294],"mapped",[295]],[[295,295],"valid"],[[296,296],"mapped",[297]],[[297,297],"valid"],[[298,298],"mapped",[299]],[[299,299],"valid"],[[300,300],"mapped",[301]],[[301,301],"valid"],[[302,302],"mapped",[303]],[[303,303],"valid"],[[304,304],"mapped",[105,775]],[[305,305],"valid"],[[306,307],"mapped",[105,106]],[[308,308],"mapped",[309]],[[309,309],"valid"],[[310,310],"mapped",[311]],[[311,312],"valid"],[[313,313],"mapped",[314]],[[314,314],"valid"],[[315,315],"mapped",[316]],[[316,316],"valid"],[[317,317],"mapped",[318]],[[318,318],"valid"],[[319,320],"mapped",[108,183]],[[321,321],"mapped",[322]],[[322,322],"valid"],[[323,323],"mapped",[324]],[[324,324],"valid"],[[325,325],"mapped",[326]],[[326,326],"valid"],[[327,327],"mapped",[328]],[[328,328],"valid"],[[329,329],"mapped",[700,110]],[[330,330],"mapped",[331]],[[331,331],"valid"],[[332,332],"mapped",[333]],[[333,333],"valid"],[[334,334],"mapped",[335]],[[335,335],"valid"],[[336,336],"mapped",[337]],[[337,337],"valid"],[[338,338],"mapped",[339]],[[339,339],"valid"],[[340,340],"mapped",[341]],[[341,341],"valid"],[[342,342],"mapped",[343]],[[343,343],"valid"],[[344,344],"mapped",[345]],[[345,345],"valid"],[[346,346],"mapped",[347]],[[347,347],"valid"],[[348,348],"mapped",[349]],[[349,349],"valid"],[[350,350],"mapped",[351]],[[351,351],"valid"],[[352,352],"mapped",[353]],[[353,353],"valid"],[[354,354],"mapped",[355]],[[355,355],"valid"],[[356,356],"mapped",[357]],[[357,357],"valid"],[[358,358],"mapped",[359]],[[359,359],"valid"],[[360,360],"mapped",[361]],[[361,361],"valid"],[[362,362],"mapped",[363]],[[363,363],"valid"],[[364,364],"mapped",[365]],[[365,365],"valid"],[[366,366],"mapped",[367]],[[367,367],"valid"],[[368,368],"mapped",[369]],[[369,369],"valid"],[[370,370],"mapped",[371]],[[371,371],"valid"],[[372,372],"mapped",[373]],[[373,373],"valid"],[[374,374],"mapped",[375]],[[375,375],"valid"],[[376,376],"mapped",[255]],[[377,377],"mapped",[378]],[[378,378],"valid"],[[379,379],"mapped",[380]],[[380,380],"valid"],[[381,381],"mapped",[382]],[[382,382],"valid"],[[383,383],"mapped",[115]],[[384,384],"valid"],[[385,385],"mapped",[595]],[[386,386],"mapped",[387]],[[387,387],"valid"],[[388,388],"mapped",[389]],[[389,389],"valid"],[[390,390],"mapped",[596]],[[391,391],"mapped",[392]],[[392,392],"valid"],[[393,393],"mapped",[598]],[[394,394],"mapped",[599]],[[395,395],"mapped",[396]],[[396,397],"valid"],[[398,398],"mapped",[477]],[[399,399],"mapped",[601]],[[400,400],"mapped",[603]],[[401,401],"mapped",[402]],[[402,402],"valid"],[[403,403],"mapped",[608]],[[404,404],"mapped",[611]],[[405,405],"valid"],[[406,406],"mapped",[617]],[[407,407],"mapped",[616]],[[408,408],"mapped",[409]],[[409,411],"valid"],[[412,412],"mapped",[623]],[[413,413],"mapped",[626]],[[414,414],"valid"],[[415,415],"mapped",[629]],[[416,416],"mapped",[417]],[[417,417],"valid"],[[418,418],"mapped",[419]],[[419,419],"valid"],[[420,420],"mapped",[421]],[[421,421],"valid"],[[422,422],"mapped",[640]],[[423,423],"mapped",[424]],[[424,424],"valid"],[[425,425],"mapped",[643]],[[426,427],"valid"],[[428,428],"mapped",[429]],[[429,429],"valid"],[[430,430],"mapped",[648]],[[431,431],"mapped",[432]],[[432,432],"valid"],[[433,433],"mapped",[650]],[[434,434],"mapped",[651]],[[435,435],"mapped",[436]],[[436,436],"valid"],[[437,437],"mapped",[438]],[[438,438],"valid"],[[439,439],"mapped",[658]],[[440,440],"mapped",[441]],[[441,443],"valid"],[[444,444],"mapped",[445]],[[445,451],"valid"],[[452,454],"mapped",[100,382]],[[455,457],"mapped",[108,106]],[[458,460],"mapped",[110,106]],[[461,461],"mapped",[462]],[[462,462],"valid"],[[463,463],"mapped",[464]],[[464,464],"valid"],[[465,465],"mapped",[466]],[[466,466],"valid"],[[467,467],"mapped",[468]],[[468,468],"valid"],[[469,469],"mapped",[470]],[[470,470],"valid"],[[471,471],"mapped",[472]],[[472,472],"valid"],[[473,473],"mapped",[474]],[[474,474],"valid"],[[475,475],"mapped",[476]],[[476,477],"valid"],[[478,478],"mapped",[479]],[[479,479],"valid"],[[480,480],"mapped",[481]],[[481,481],"valid"],[[482,482],"mapped",[483]],[[483,483],"valid"],[[484,484],"mapped",[485]],[[485,485],"valid"],[[486,486],"mapped",[487]],[[487,487],"valid"],[[488,488],"mapped",[489]],[[489,489],"valid"],[[490,490],"mapped",[491]],[[491,491],"valid"],[[492,492],"mapped",[493]],[[493,493],"valid"],[[494,494],"mapped",[495]],[[495,496],"valid"],[[497,499],"mapped",[100,122]],[[500,500],"mapped",[501]],[[501,501],"valid"],[[502,502],"mapped",[405]],[[503,503],"mapped",[447]],[[504,504],"mapped",[505]],[[505,505],"valid"],[[506,506],"mapped",[507]],[[507,507],"valid"],[[508,508],"mapped",[509]],[[509,509],"valid"],[[510,510],"mapped",[511]],[[511,511],"valid"],[[512,512],"mapped",[513]],[[513,513],"valid"],[[514,514],"mapped",[515]],[[515,515],"valid"],[[516,516],"mapped",[517]],[[517,517],"valid"],[[518,518],"mapped",[519]],[[519,519],"valid"],[[520,520],"mapped",[521]],[[521,521],"valid"],[[522,522],"mapped",[523]],[[523,523],"valid"],[[524,524],"mapped",[525]],[[525,525],"valid"],[[526,526],"mapped",[527]],[[527,527],"valid"],[[528,528],"mapped",[529]],[[529,529],"valid"],[[530,530],"mapped",[531]],[[531,531],"valid"],[[532,532],"mapped",[533]],[[533,533],"valid"],[[534,534],"mapped",[535]],[[535,535],"valid"],[[536,536],"mapped",[537]],[[537,537],"valid"],[[538,538],"mapped",[539]],[[539,539],"valid"],[[540,540],"mapped",[541]],[[541,541],"valid"],[[542,542],"mapped",[543]],[[543,543],"valid"],[[544,544],"mapped",[414]],[[545,545],"valid"],[[546,546],"mapped",[547]],[[547,547],"valid"],[[548,548],"mapped",[549]],[[549,549],"valid"],[[550,550],"mapped",[551]],[[551,551],"valid"],[[552,552],"mapped",[553]],[[553,553],"valid"],[[554,554],"mapped",[555]],[[555,555],"valid"],[[556,556],"mapped",[557]],[[557,557],"valid"],[[558,558],"mapped",[559]],[[559,559],"valid"],[[560,560],"mapped",[561]],[[561,561],"valid"],[[562,562],"mapped",[563]],[[563,563],"valid"],[[564,566],"valid"],[[567,569],"valid"],[[570,570],"mapped",[11365]],[[571,571],"mapped",[572]],[[572,572],"valid"],[[573,573],"mapped",[410]],[[574,574],"mapped",[11366]],[[575,576],"valid"],[[577,577],"mapped",[578]],[[578,578],"valid"],[[579,579],"mapped",[384]],[[580,580],"mapped",[649]],[[581,581],"mapped",[652]],[[582,582],"mapped",[583]],[[583,583],"valid"],[[584,584],"mapped",[585]],[[585,585],"valid"],[[586,586],"mapped",[587]],[[587,587],"valid"],[[588,588],"mapped",[589]],[[589,589],"valid"],[[590,590],"mapped",[591]],[[591,591],"valid"],[[592,680],"valid"],[[681,685],"valid"],[[686,687],"valid"],[[688,688],"mapped",[104]],[[689,689],"mapped",[614]],[[690,690],"mapped",[106]],[[691,691],"mapped",[114]],[[692,692],"mapped",[633]],[[693,693],"mapped",[635]],[[694,694],"mapped",[641]],[[695,695],"mapped",[119]],[[696,696],"mapped",[121]],[[697,705],"valid"],[[706,709],"valid",[],"NV8"],[[710,721],"valid"],[[722,727],"valid",[],"NV8"],[[728,728],"disallowed_STD3_mapped",[32,774]],[[729,729],"disallowed_STD3_mapped",[32,775]],[[730,730],"disallowed_STD3_mapped",[32,778]],[[731,731],"disallowed_STD3_mapped",[32,808]],[[732,732],"disallowed_STD3_mapped",[32,771]],[[733,733],"disallowed_STD3_mapped",[32,779]],[[734,734],"valid",[],"NV8"],[[735,735],"valid",[],"NV8"],[[736,736],"mapped",[611]],[[737,737],"mapped",[108]],[[738,738],"mapped",[115]],[[739,739],"mapped",[120]],[[740,740],"mapped",[661]],[[741,745],"valid",[],"NV8"],[[746,747],"valid",[],"NV8"],[[748,748],"valid"],[[749,749],"valid",[],"NV8"],[[750,750],"valid"],[[751,767],"valid",[],"NV8"],[[768,831],"valid"],[[832,832],"mapped",[768]],[[833,833],"mapped",[769]],[[834,834],"valid"],[[835,835],"mapped",[787]],[[836,836],"mapped",[776,769]],[[837,837],"mapped",[953]],[[838,846],"valid"],[[847,847],"ignored"],[[848,855],"valid"],[[856,860],"valid"],[[861,863],"valid"],[[864,865],"valid"],[[866,866],"valid"],[[867,879],"valid"],[[880,880],"mapped",[881]],[[881,881],"valid"],[[882,882],"mapped",[883]],[[883,883],"valid"],[[884,884],"mapped",[697]],[[885,885],"valid"],[[886,886],"mapped",[887]],[[887,887],"valid"],[[888,889],"disallowed"],[[890,890],"disallowed_STD3_mapped",[32,953]],[[891,893],"valid"],[[894,894],"disallowed_STD3_mapped",[59]],[[895,895],"mapped",[1011]],[[896,899],"disallowed"],[[900,900],"disallowed_STD3_mapped",[32,769]],[[901,901],"disallowed_STD3_mapped",[32,776,769]],[[902,902],"mapped",[940]],[[903,903],"mapped",[183]],[[904,904],"mapped",[941]],[[905,905],"mapped",[942]],[[906,906],"mapped",[943]],[[907,907],"disallowed"],[[908,908],"mapped",[972]],[[909,909],"disallowed"],[[910,910],"mapped",[973]],[[911,911],"mapped",[974]],[[912,912],"valid"],[[913,913],"mapped",[945]],[[914,914],"mapped",[946]],[[915,915],"mapped",[947]],[[916,916],"mapped",[948]],[[917,917],"mapped",[949]],[[918,918],"mapped",[950]],[[919,919],"mapped",[951]],[[920,920],"mapped",[952]],[[921,921],"mapped",[953]],[[922,922],"mapped",[954]],[[923,923],"mapped",[955]],[[924,924],"mapped",[956]],[[925,925],"mapped",[957]],[[926,926],"mapped",[958]],[[927,927],"mapped",[959]],[[928,928],"mapped",[960]],[[929,929],"mapped",[961]],[[930,930],"disallowed"],[[931,931],"mapped",[963]],[[932,932],"mapped",[964]],[[933,933],"mapped",[965]],[[934,934],"mapped",[966]],[[935,935],"mapped",[967]],[[936,936],"mapped",[968]],[[937,937],"mapped",[969]],[[938,938],"mapped",[970]],[[939,939],"mapped",[971]],[[940,961],"valid"],[[962,962],"deviation",[963]],[[963,974],"valid"],[[975,975],"mapped",[983]],[[976,976],"mapped",[946]],[[977,977],"mapped",[952]],[[978,978],"mapped",[965]],[[979,979],"mapped",[973]],[[980,980],"mapped",[971]],[[981,981],"mapped",[966]],[[982,982],"mapped",[960]],[[983,983],"valid"],[[984,984],"mapped",[985]],[[985,985],"valid"],[[986,986],"mapped",[987]],[[987,987],"valid"],[[988,988],"mapped",[989]],[[989,989],"valid"],[[990,990],"mapped",[991]],[[991,991],"valid"],[[992,992],"mapped",[993]],[[993,993],"valid"],[[994,994],"mapped",[995]],[[995,995],"valid"],[[996,996],"mapped",[997]],[[997,997],"valid"],[[998,998],"mapped",[999]],[[999,999],"valid"],[[1000,1000],"mapped",[1001]],[[1001,1001],"valid"],[[1002,1002],"mapped",[1003]],[[1003,1003],"valid"],[[1004,1004],"mapped",[1005]],[[1005,1005],"valid"],[[1006,1006],"mapped",[1007]],[[1007,1007],"valid"],[[1008,1008],"mapped",[954]],[[1009,1009],"mapped",[961]],[[1010,1010],"mapped",[963]],[[1011,1011],"valid"],[[1012,1012],"mapped",[952]],[[1013,1013],"mapped",[949]],[[1014,1014],"valid",[],"NV8"],[[1015,1015],"mapped",[1016]],[[1016,1016],"valid"],[[1017,1017],"mapped",[963]],[[1018,1018],"mapped",[1019]],[[1019,1019],"valid"],[[1020,1020],"valid"],[[1021,1021],"mapped",[891]],[[1022,1022],"mapped",[892]],[[1023,1023],"mapped",[893]],[[1024,1024],"mapped",[1104]],[[1025,1025],"mapped",[1105]],[[1026,1026],"mapped",[1106]],[[1027,1027],"mapped",[1107]],[[1028,1028],"mapped",[1108]],[[1029,1029],"mapped",[1109]],[[1030,1030],"mapped",[1110]],[[1031,1031],"mapped",[1111]],[[1032,1032],"mapped",[1112]],[[1033,1033],"mapped",[1113]],[[1034,1034],"mapped",[1114]],[[1035,1035],"mapped",[1115]],[[1036,1036],"mapped",[1116]],[[1037,1037],"mapped",[1117]],[[1038,1038],"mapped",[1118]],[[1039,1039],"mapped",[1119]],[[1040,1040],"mapped",[1072]],[[1041,1041],"mapped",[1073]],[[1042,1042],"mapped",[1074]],[[1043,1043],"mapped",[1075]],[[1044,1044],"mapped",[1076]],[[1045,1045],"mapped",[1077]],[[1046,1046],"mapped",[1078]],[[1047,1047],"mapped",[1079]],[[1048,1048],"mapped",[1080]],[[1049,1049],"mapped",[1081]],[[1050,1050],"mapped",[1082]],[[1051,1051],"mapped",[1083]],[[1052,1052],"mapped",[1084]],[[1053,1053],"mapped",[1085]],[[1054,1054],"mapped",[1086]],[[1055,1055],"mapped",[1087]],[[1056,1056],"mapped",[1088]],[[1057,1057],"mapped",[1089]],[[1058,1058],"mapped",[1090]],[[1059,1059],"mapped",[1091]],[[1060,1060],"mapped",[1092]],[[1061,1061],"mapped",[1093]],[[1062,1062],"mapped",[1094]],[[1063,1063],"mapped",[1095]],[[1064,1064],"mapped",[1096]],[[1065,1065],"mapped",[1097]],[[1066,1066],"mapped",[1098]],[[1067,1067],"mapped",[1099]],[[1068,1068],"mapped",[1100]],[[1069,1069],"mapped",[1101]],[[1070,1070],"mapped",[1102]],[[1071,1071],"mapped",[1103]],[[1072,1103],"valid"],[[1104,1104],"valid"],[[1105,1116],"valid"],[[1117,1117],"valid"],[[1118,1119],"valid"],[[1120,1120],"mapped",[1121]],[[1121,1121],"valid"],[[1122,1122],"mapped",[1123]],[[1123,1123],"valid"],[[1124,1124],"mapped",[1125]],[[1125,1125],"valid"],[[1126,1126],"mapped",[1127]],[[1127,1127],"valid"],[[1128,1128],"mapped",[1129]],[[1129,1129],"valid"],[[1130,1130],"mapped",[1131]],[[1131,1131],"valid"],[[1132,1132],"mapped",[1133]],[[1133,1133],"valid"],[[1134,1134],"mapped",[1135]],[[1135,1135],"valid"],[[1136,1136],"mapped",[1137]],[[1137,1137],"valid"],[[1138,1138],"mapped",[1139]],[[1139,1139],"valid"],[[1140,1140],"mapped",[1141]],[[1141,1141],"valid"],[[1142,1142],"mapped",[1143]],[[1143,1143],"valid"],[[1144,1144],"mapped",[1145]],[[1145,1145],"valid"],[[1146,1146],"mapped",[1147]],[[1147,1147],"valid"],[[1148,1148],"mapped",[1149]],[[1149,1149],"valid"],[[1150,1150],"mapped",[1151]],[[1151,1151],"valid"],[[1152,1152],"mapped",[1153]],[[1153,1153],"valid"],[[1154,1154],"valid",[],"NV8"],[[1155,1158],"valid"],[[1159,1159],"valid"],[[1160,1161],"valid",[],"NV8"],[[1162,1162],"mapped",[1163]],[[1163,1163],"valid"],[[1164,1164],"mapped",[1165]],[[1165,1165],"valid"],[[1166,1166],"mapped",[1167]],[[1167,1167],"valid"],[[1168,1168],"mapped",[1169]],[[1169,1169],"valid"],[[1170,1170],"mapped",[1171]],[[1171,1171],"valid"],[[1172,1172],"mapped",[1173]],[[1173,1173],"valid"],[[1174,1174],"mapped",[1175]],[[1175,1175],"valid"],[[1176,1176],"mapped",[1177]],[[1177,1177],"valid"],[[1178,1178],"mapped",[1179]],[[1179,1179],"valid"],[[1180,1180],"mapped",[1181]],[[1181,1181],"valid"],[[1182,1182],"mapped",[1183]],[[1183,1183],"valid"],[[1184,1184],"mapped",[1185]],[[1185,1185],"valid"],[[1186,1186],"mapped",[1187]],[[1187,1187],"valid"],[[1188,1188],"mapped",[1189]],[[1189,1189],"valid"],[[1190,1190],"mapped",[1191]],[[1191,1191],"valid"],[[1192,1192],"mapped",[1193]],[[1193,1193],"valid"],[[1194,1194],"mapped",[1195]],[[1195,1195],"valid"],[[1196,1196],"mapped",[1197]],[[1197,1197],"valid"],[[1198,1198],"mapped",[1199]],[[1199,1199],"valid"],[[1200,1200],"mapped",[1201]],[[1201,1201],"valid"],[[1202,1202],"mapped",[1203]],[[1203,1203],"valid"],[[1204,1204],"mapped",[1205]],[[1205,1205],"valid"],[[1206,1206],"mapped",[1207]],[[1207,1207],"valid"],[[1208,1208],"mapped",[1209]],[[1209,1209],"valid"],[[1210,1210],"mapped",[1211]],[[1211,1211],"valid"],[[1212,1212],"mapped",[1213]],[[1213,1213],"valid"],[[1214,1214],"mapped",[1215]],[[1215,1215],"valid"],[[1216,1216],"disallowed"],[[1217,1217],"mapped",[1218]],[[1218,1218],"valid"],[[1219,1219],"mapped",[1220]],[[1220,1220],"valid"],[[1221,1221],"mapped",[1222]],[[1222,1222],"valid"],[[1223,1223],"mapped",[1224]],[[1224,1224],"valid"],[[1225,1225],"mapped",[1226]],[[1226,1226],"valid"],[[1227,1227],"mapped",[1228]],[[1228,1228],"valid"],[[1229,1229],"mapped",[1230]],[[1230,1230],"valid"],[[1231,1231],"valid"],[[1232,1232],"mapped",[1233]],[[1233,1233],"valid"],[[1234,1234],"mapped",[1235]],[[1235,1235],"valid"],[[1236,1236],"mapped",[1237]],[[1237,1237],"valid"],[[1238,1238],"mapped",[1239]],[[1239,1239],"valid"],[[1240,1240],"mapped",[1241]],[[1241,1241],"valid"],[[1242,1242],"mapped",[1243]],[[1243,1243],"valid"],[[1244,1244],"mapped",[1245]],[[1245,1245],"valid"],[[1246,1246],"mapped",[1247]],[[1247,1247],"valid"],[[1248,1248],"mapped",[1249]],[[1249,1249],"valid"],[[1250,1250],"mapped",[1251]],[[1251,1251],"valid"],[[1252,1252],"mapped",[1253]],[[1253,1253],"valid"],[[1254,1254],"mapped",[1255]],[[1255,1255],"valid"],[[1256,1256],"mapped",[1257]],[[1257,1257],"valid"],[[1258,1258],"mapped",[1259]],[[1259,1259],"valid"],[[1260,1260],"mapped",[1261]],[[1261,1261],"valid"],[[1262,1262],"mapped",[1263]],[[1263,1263],"valid"],[[1264,1264],"mapped",[1265]],[[1265,1265],"valid"],[[1266,1266],"mapped",[1267]],[[1267,1267],"valid"],[[1268,1268],"mapped",[1269]],[[1269,1269],"valid"],[[1270,1270],"mapped",[1271]],[[1271,1271],"valid"],[[1272,1272],"mapped",[1273]],[[1273,1273],"valid"],[[1274,1274],"mapped",[1275]],[[1275,1275],"valid"],[[1276,1276],"mapped",[1277]],[[1277,1277],"valid"],[[1278,1278],"mapped",[1279]],[[1279,1279],"valid"],[[1280,1280],"mapped",[1281]],[[1281,1281],"valid"],[[1282,1282],"mapped",[1283]],[[1283,1283],"valid"],[[1284,1284],"mapped",[1285]],[[1285,1285],"valid"],[[1286,1286],"mapped",[1287]],[[1287,1287],"valid"],[[1288,1288],"mapped",[1289]],[[1289,1289],"valid"],[[1290,1290],"mapped",[1291]],[[1291,1291],"valid"],[[1292,1292],"mapped",[1293]],[[1293,1293],"valid"],[[1294,1294],"mapped",[1295]],[[1295,1295],"valid"],[[1296,1296],"mapped",[1297]],[[1297,1297],"valid"],[[1298,1298],"mapped",[1299]],[[1299,1299],"valid"],[[1300,1300],"mapped",[1301]],[[1301,1301],"valid"],[[1302,1302],"mapped",[1303]],[[1303,1303],"valid"],[[1304,1304],"mapped",[1305]],[[1305,1305],"valid"],[[1306,1306],"mapped",[1307]],[[1307,1307],"valid"],[[1308,1308],"mapped",[1309]],[[1309,1309],"valid"],[[1310,1310],"mapped",[1311]],[[1311,1311],"valid"],[[1312,1312],"mapped",[1313]],[[1313,1313],"valid"],[[1314,1314],"mapped",[1315]],[[1315,1315],"valid"],[[1316,1316],"mapped",[1317]],[[1317,1317],"valid"],[[1318,1318],"mapped",[1319]],[[1319,1319],"valid"],[[1320,1320],"mapped",[1321]],[[1321,1321],"valid"],[[1322,1322],"mapped",[1323]],[[1323,1323],"valid"],[[1324,1324],"mapped",[1325]],[[1325,1325],"valid"],[[1326,1326],"mapped",[1327]],[[1327,1327],"valid"],[[1328,1328],"disallowed"],[[1329,1329],"mapped",[1377]],[[1330,1330],"mapped",[1378]],[[1331,1331],"mapped",[1379]],[[1332,1332],"mapped",[1380]],[[1333,1333],"mapped",[1381]],[[1334,1334],"mapped",[1382]],[[1335,1335],"mapped",[1383]],[[1336,1336],"mapped",[1384]],[[1337,1337],"mapped",[1385]],[[1338,1338],"mapped",[1386]],[[1339,1339],"mapped",[1387]],[[1340,1340],"mapped",[1388]],[[1341,1341],"mapped",[1389]],[[1342,1342],"mapped",[1390]],[[1343,1343],"mapped",[1391]],[[1344,1344],"mapped",[1392]],[[1345,1345],"mapped",[1393]],[[1346,1346],"mapped",[1394]],[[1347,1347],"mapped",[1395]],[[1348,1348],"mapped",[1396]],[[1349,1349],"mapped",[1397]],[[1350,1350],"mapped",[1398]],[[1351,1351],"mapped",[1399]],[[1352,1352],"mapped",[1400]],[[1353,1353],"mapped",[1401]],[[1354,1354],"mapped",[1402]],[[1355,1355],"mapped",[1403]],[[1356,1356],"mapped",[1404]],[[1357,1357],"mapped",[1405]],[[1358,1358],"mapped",[1406]],[[1359,1359],"mapped",[1407]],[[1360,1360],"mapped",[1408]],[[1361,1361],"mapped",[1409]],[[1362,1362],"mapped",[1410]],[[1363,1363],"mapped",[1411]],[[1364,1364],"mapped",[1412]],[[1365,1365],"mapped",[1413]],[[1366,1366],"mapped",[1414]],[[1367,1368],"disallowed"],[[1369,1369],"valid"],[[1370,1375],"valid",[],"NV8"],[[1376,1376],"disallowed"],[[1377,1414],"valid"],[[1415,1415],"mapped",[1381,1410]],[[1416,1416],"disallowed"],[[1417,1417],"valid",[],"NV8"],[[1418,1418],"valid",[],"NV8"],[[1419,1420],"disallowed"],[[1421,1422],"valid",[],"NV8"],[[1423,1423],"valid",[],"NV8"],[[1424,1424],"disallowed"],[[1425,1441],"valid"],[[1442,1442],"valid"],[[1443,1455],"valid"],[[1456,1465],"valid"],[[1466,1466],"valid"],[[1467,1469],"valid"],[[1470,1470],"valid",[],"NV8"],[[1471,1471],"valid"],[[1472,1472],"valid",[],"NV8"],[[1473,1474],"valid"],[[1475,1475],"valid",[],"NV8"],[[1476,1476],"valid"],[[1477,1477],"valid"],[[1478,1478],"valid",[],"NV8"],[[1479,1479],"valid"],[[1480,1487],"disallowed"],[[1488,1514],"valid"],[[1515,1519],"disallowed"],[[1520,1524],"valid"],[[1525,1535],"disallowed"],[[1536,1539],"disallowed"],[[1540,1540],"disallowed"],[[1541,1541],"disallowed"],[[1542,1546],"valid",[],"NV8"],[[1547,1547],"valid",[],"NV8"],[[1548,1548],"valid",[],"NV8"],[[1549,1551],"valid",[],"NV8"],[[1552,1557],"valid"],[[1558,1562],"valid"],[[1563,1563],"valid",[],"NV8"],[[1564,1564],"disallowed"],[[1565,1565],"disallowed"],[[1566,1566],"valid",[],"NV8"],[[1567,1567],"valid",[],"NV8"],[[1568,1568],"valid"],[[1569,1594],"valid"],[[1595,1599],"valid"],[[1600,1600],"valid",[],"NV8"],[[1601,1618],"valid"],[[1619,1621],"valid"],[[1622,1624],"valid"],[[1625,1630],"valid"],[[1631,1631],"valid"],[[1632,1641],"valid"],[[1642,1645],"valid",[],"NV8"],[[1646,1647],"valid"],[[1648,1652],"valid"],[[1653,1653],"mapped",[1575,1652]],[[1654,1654],"mapped",[1608,1652]],[[1655,1655],"mapped",[1735,1652]],[[1656,1656],"mapped",[1610,1652]],[[1657,1719],"valid"],[[1720,1721],"valid"],[[1722,1726],"valid"],[[1727,1727],"valid"],[[1728,1742],"valid"],[[1743,1743],"valid"],[[1744,1747],"valid"],[[1748,1748],"valid",[],"NV8"],[[1749,1756],"valid"],[[1757,1757],"disallowed"],[[1758,1758],"valid",[],"NV8"],[[1759,1768],"valid"],[[1769,1769],"valid",[],"NV8"],[[1770,1773],"valid"],[[1774,1775],"valid"],[[1776,1785],"valid"],[[1786,1790],"valid"],[[1791,1791],"valid"],[[1792,1805],"valid",[],"NV8"],[[1806,1806],"disallowed"],[[1807,1807],"disallowed"],[[1808,1836],"valid"],[[1837,1839],"valid"],[[1840,1866],"valid"],[[1867,1868],"disallowed"],[[1869,1871],"valid"],[[1872,1901],"valid"],[[1902,1919],"valid"],[[1920,1968],"valid"],[[1969,1969],"valid"],[[1970,1983],"disallowed"],[[1984,2037],"valid"],[[2038,2042],"valid",[],"NV8"],[[2043,2047],"disallowed"],[[2048,2093],"valid"],[[2094,2095],"disallowed"],[[2096,2110],"valid",[],"NV8"],[[2111,2111],"disallowed"],[[2112,2139],"valid"],[[2140,2141],"disallowed"],[[2142,2142],"valid",[],"NV8"],[[2143,2207],"disallowed"],[[2208,2208],"valid"],[[2209,2209],"valid"],[[2210,2220],"valid"],[[2221,2226],"valid"],[[2227,2228],"valid"],[[2229,2274],"disallowed"],[[2275,2275],"valid"],[[2276,2302],"valid"],[[2303,2303],"valid"],[[2304,2304],"valid"],[[2305,2307],"valid"],[[2308,2308],"valid"],[[2309,2361],"valid"],[[2362,2363],"valid"],[[2364,2381],"valid"],[[2382,2382],"valid"],[[2383,2383],"valid"],[[2384,2388],"valid"],[[2389,2389],"valid"],[[2390,2391],"valid"],[[2392,2392],"mapped",[2325,2364]],[[2393,2393],"mapped",[2326,2364]],[[2394,2394],"mapped",[2327,2364]],[[2395,2395],"mapped",[2332,2364]],[[2396,2396],"mapped",[2337,2364]],[[2397,2397],"mapped",[2338,2364]],[[2398,2398],"mapped",[2347,2364]],[[2399,2399],"mapped",[2351,2364]],[[2400,2403],"valid"],[[2404,2405],"valid",[],"NV8"],[[2406,2415],"valid"],[[2416,2416],"valid",[],"NV8"],[[2417,2418],"valid"],[[2419,2423],"valid"],[[2424,2424],"valid"],[[2425,2426],"valid"],[[2427,2428],"valid"],[[2429,2429],"valid"],[[2430,2431],"valid"],[[2432,2432],"valid"],[[2433,2435],"valid"],[[2436,2436],"disallowed"],[[2437,2444],"valid"],[[2445,2446],"disallowed"],[[2447,2448],"valid"],[[2449,2450],"disallowed"],[[2451,2472],"valid"],[[2473,2473],"disallowed"],[[2474,2480],"valid"],[[2481,2481],"disallowed"],[[2482,2482],"valid"],[[2483,2485],"disallowed"],[[2486,2489],"valid"],[[2490,2491],"disallowed"],[[2492,2492],"valid"],[[2493,2493],"valid"],[[2494,2500],"valid"],[[2501,2502],"disallowed"],[[2503,2504],"valid"],[[2505,2506],"disallowed"],[[2507,2509],"valid"],[[2510,2510],"valid"],[[2511,2518],"disallowed"],[[2519,2519],"valid"],[[2520,2523],"disallowed"],[[2524,2524],"mapped",[2465,2492]],[[2525,2525],"mapped",[2466,2492]],[[2526,2526],"disallowed"],[[2527,2527],"mapped",[2479,2492]],[[2528,2531],"valid"],[[2532,2533],"disallowed"],[[2534,2545],"valid"],[[2546,2554],"valid",[],"NV8"],[[2555,2555],"valid",[],"NV8"],[[2556,2560],"disallowed"],[[2561,2561],"valid"],[[2562,2562],"valid"],[[2563,2563],"valid"],[[2564,2564],"disallowed"],[[2565,2570],"valid"],[[2571,2574],"disallowed"],[[2575,2576],"valid"],[[2577,2578],"disallowed"],[[2579,2600],"valid"],[[2601,2601],"disallowed"],[[2602,2608],"valid"],[[2609,2609],"disallowed"],[[2610,2610],"valid"],[[2611,2611],"mapped",[2610,2620]],[[2612,2612],"disallowed"],[[2613,2613],"valid"],[[2614,2614],"mapped",[2616,2620]],[[2615,2615],"disallowed"],[[2616,2617],"valid"],[[2618,2619],"disallowed"],[[2620,2620],"valid"],[[2621,2621],"disallowed"],[[2622,2626],"valid"],[[2627,2630],"disallowed"],[[2631,2632],"valid"],[[2633,2634],"disallowed"],[[2635,2637],"valid"],[[2638,2640],"disallowed"],[[2641,2641],"valid"],[[2642,2648],"disallowed"],[[2649,2649],"mapped",[2582,2620]],[[2650,2650],"mapped",[2583,2620]],[[2651,2651],"mapped",[2588,2620]],[[2652,2652],"valid"],[[2653,2653],"disallowed"],[[2654,2654],"mapped",[2603,2620]],[[2655,2661],"disallowed"],[[2662,2676],"valid"],[[2677,2677],"valid"],[[2678,2688],"disallowed"],[[2689,2691],"valid"],[[2692,2692],"disallowed"],[[2693,2699],"valid"],[[2700,2700],"valid"],[[2701,2701],"valid"],[[2702,2702],"disallowed"],[[2703,2705],"valid"],[[2706,2706],"disallowed"],[[2707,2728],"valid"],[[2729,2729],"disallowed"],[[2730,2736],"valid"],[[2737,2737],"disallowed"],[[2738,2739],"valid"],[[2740,2740],"disallowed"],[[2741,2745],"valid"],[[2746,2747],"disallowed"],[[2748,2757],"valid"],[[2758,2758],"disallowed"],[[2759,2761],"valid"],[[2762,2762],"disallowed"],[[2763,2765],"valid"],[[2766,2767],"disallowed"],[[2768,2768],"valid"],[[2769,2783],"disallowed"],[[2784,2784],"valid"],[[2785,2787],"valid"],[[2788,2789],"disallowed"],[[2790,2799],"valid"],[[2800,2800],"valid",[],"NV8"],[[2801,2801],"valid",[],"NV8"],[[2802,2808],"disallowed"],[[2809,2809],"valid"],[[2810,2816],"disallowed"],[[2817,2819],"valid"],[[2820,2820],"disallowed"],[[2821,2828],"valid"],[[2829,2830],"disallowed"],[[2831,2832],"valid"],[[2833,2834],"disallowed"],[[2835,2856],"valid"],[[2857,2857],"disallowed"],[[2858,2864],"valid"],[[2865,2865],"disallowed"],[[2866,2867],"valid"],[[2868,2868],"disallowed"],[[2869,2869],"valid"],[[2870,2873],"valid"],[[2874,2875],"disallowed"],[[2876,2883],"valid"],[[2884,2884],"valid"],[[2885,2886],"disallowed"],[[2887,2888],"valid"],[[2889,2890],"disallowed"],[[2891,2893],"valid"],[[2894,2901],"disallowed"],[[2902,2903],"valid"],[[2904,2907],"disallowed"],[[2908,2908],"mapped",[2849,2876]],[[2909,2909],"mapped",[2850,2876]],[[2910,2910],"disallowed"],[[2911,2913],"valid"],[[2914,2915],"valid"],[[2916,2917],"disallowed"],[[2918,2927],"valid"],[[2928,2928],"valid",[],"NV8"],[[2929,2929],"valid"],[[2930,2935],"valid",[],"NV8"],[[2936,2945],"disallowed"],[[2946,2947],"valid"],[[2948,2948],"disallowed"],[[2949,2954],"valid"],[[2955,2957],"disallowed"],[[2958,2960],"valid"],[[2961,2961],"disallowed"],[[2962,2965],"valid"],[[2966,2968],"disallowed"],[[2969,2970],"valid"],[[2971,2971],"disallowed"],[[2972,2972],"valid"],[[2973,2973],"disallowed"],[[2974,2975],"valid"],[[2976,2978],"disallowed"],[[2979,2980],"valid"],[[2981,2983],"disallowed"],[[2984,2986],"valid"],[[2987,2989],"disallowed"],[[2990,2997],"valid"],[[2998,2998],"valid"],[[2999,3001],"valid"],[[3002,3005],"disallowed"],[[3006,3010],"valid"],[[3011,3013],"disallowed"],[[3014,3016],"valid"],[[3017,3017],"disallowed"],[[3018,3021],"valid"],[[3022,3023],"disallowed"],[[3024,3024],"valid"],[[3025,3030],"disallowed"],[[3031,3031],"valid"],[[3032,3045],"disallowed"],[[3046,3046],"valid"],[[3047,3055],"valid"],[[3056,3058],"valid",[],"NV8"],[[3059,3066],"valid",[],"NV8"],[[3067,3071],"disallowed"],[[3072,3072],"valid"],[[3073,3075],"valid"],[[3076,3076],"disallowed"],[[3077,3084],"valid"],[[3085,3085],"disallowed"],[[3086,3088],"valid"],[[3089,3089],"disallowed"],[[3090,3112],"valid"],[[3113,3113],"disallowed"],[[3114,3123],"valid"],[[3124,3124],"valid"],[[3125,3129],"valid"],[[3130,3132],"disallowed"],[[3133,3133],"valid"],[[3134,3140],"valid"],[[3141,3141],"disallowed"],[[3142,3144],"valid"],[[3145,3145],"disallowed"],[[3146,3149],"valid"],[[3150,3156],"disallowed"],[[3157,3158],"valid"],[[3159,3159],"disallowed"],[[3160,3161],"valid"],[[3162,3162],"valid"],[[3163,3167],"disallowed"],[[3168,3169],"valid"],[[3170,3171],"valid"],[[3172,3173],"disallowed"],[[3174,3183],"valid"],[[3184,3191],"disallowed"],[[3192,3199],"valid",[],"NV8"],[[3200,3200],"disallowed"],[[3201,3201],"valid"],[[3202,3203],"valid"],[[3204,3204],"disallowed"],[[3205,3212],"valid"],[[3213,3213],"disallowed"],[[3214,3216],"valid"],[[3217,3217],"disallowed"],[[3218,3240],"valid"],[[3241,3241],"disallowed"],[[3242,3251],"valid"],[[3252,3252],"disallowed"],[[3253,3257],"valid"],[[3258,3259],"disallowed"],[[3260,3261],"valid"],[[3262,3268],"valid"],[[3269,3269],"disallowed"],[[3270,3272],"valid"],[[3273,3273],"disallowed"],[[3274,3277],"valid"],[[3278,3284],"disallowed"],[[3285,3286],"valid"],[[3287,3293],"disallowed"],[[3294,3294],"valid"],[[3295,3295],"disallowed"],[[3296,3297],"valid"],[[3298,3299],"valid"],[[3300,3301],"disallowed"],[[3302,3311],"valid"],[[3312,3312],"disallowed"],[[3313,3314],"valid"],[[3315,3328],"disallowed"],[[3329,3329],"valid"],[[3330,3331],"valid"],[[3332,3332],"disallowed"],[[3333,3340],"valid"],[[3341,3341],"disallowed"],[[3342,3344],"valid"],[[3345,3345],"disallowed"],[[3346,3368],"valid"],[[3369,3369],"valid"],[[3370,3385],"valid"],[[3386,3386],"valid"],[[3387,3388],"disallowed"],[[3389,3389],"valid"],[[3390,3395],"valid"],[[3396,3396],"valid"],[[3397,3397],"disallowed"],[[3398,3400],"valid"],[[3401,3401],"disallowed"],[[3402,3405],"valid"],[[3406,3406],"valid"],[[3407,3414],"disallowed"],[[3415,3415],"valid"],[[3416,3422],"disallowed"],[[3423,3423],"valid"],[[3424,3425],"valid"],[[3426,3427],"valid"],[[3428,3429],"disallowed"],[[3430,3439],"valid"],[[3440,3445],"valid",[],"NV8"],[[3446,3448],"disallowed"],[[3449,3449],"valid",[],"NV8"],[[3450,3455],"valid"],[[3456,3457],"disallowed"],[[3458,3459],"valid"],[[3460,3460],"disallowed"],[[3461,3478],"valid"],[[3479,3481],"disallowed"],[[3482,3505],"valid"],[[3506,3506],"disallowed"],[[3507,3515],"valid"],[[3516,3516],"disallowed"],[[3517,3517],"valid"],[[3518,3519],"disallowed"],[[3520,3526],"valid"],[[3527,3529],"disallowed"],[[3530,3530],"valid"],[[3531,3534],"disallowed"],[[3535,3540],"valid"],[[3541,3541],"disallowed"],[[3542,3542],"valid"],[[3543,3543],"disallowed"],[[3544,3551],"valid"],[[3552,3557],"disallowed"],[[3558,3567],"valid"],[[3568,3569],"disallowed"],[[3570,3571],"valid"],[[3572,3572],"valid",[],"NV8"],[[3573,3584],"disallowed"],[[3585,3634],"valid"],[[3635,3635],"mapped",[3661,3634]],[[3636,3642],"valid"],[[3643,3646],"disallowed"],[[3647,3647],"valid",[],"NV8"],[[3648,3662],"valid"],[[3663,3663],"valid",[],"NV8"],[[3664,3673],"valid"],[[3674,3675],"valid",[],"NV8"],[[3676,3712],"disallowed"],[[3713,3714],"valid"],[[3715,3715],"disallowed"],[[3716,3716],"valid"],[[3717,3718],"disallowed"],[[3719,3720],"valid"],[[3721,3721],"disallowed"],[[3722,3722],"valid"],[[3723,3724],"disallowed"],[[3725,3725],"valid"],[[3726,3731],"disallowed"],[[3732,3735],"valid"],[[3736,3736],"disallowed"],[[3737,3743],"valid"],[[3744,3744],"disallowed"],[[3745,3747],"valid"],[[3748,3748],"disallowed"],[[3749,3749],"valid"],[[3750,3750],"disallowed"],[[3751,3751],"valid"],[[3752,3753],"disallowed"],[[3754,3755],"valid"],[[3756,3756],"disallowed"],[[3757,3762],"valid"],[[3763,3763],"mapped",[3789,3762]],[[3764,3769],"valid"],[[3770,3770],"disallowed"],[[3771,3773],"valid"],[[3774,3775],"disallowed"],[[3776,3780],"valid"],[[3781,3781],"disallowed"],[[3782,3782],"valid"],[[3783,3783],"disallowed"],[[3784,3789],"valid"],[[3790,3791],"disallowed"],[[3792,3801],"valid"],[[3802,3803],"disallowed"],[[3804,3804],"mapped",[3755,3737]],[[3805,3805],"mapped",[3755,3745]],[[3806,3807],"valid"],[[3808,3839],"disallowed"],[[3840,3840],"valid"],[[3841,3850],"valid",[],"NV8"],[[3851,3851],"valid"],[[3852,3852],"mapped",[3851]],[[3853,3863],"valid",[],"NV8"],[[3864,3865],"valid"],[[3866,3871],"valid",[],"NV8"],[[3872,3881],"valid"],[[3882,3892],"valid",[],"NV8"],[[3893,3893],"valid"],[[3894,3894],"valid",[],"NV8"],[[3895,3895],"valid"],[[3896,3896],"valid",[],"NV8"],[[3897,3897],"valid"],[[3898,3901],"valid",[],"NV8"],[[3902,3906],"valid"],[[3907,3907],"mapped",[3906,4023]],[[3908,3911],"valid"],[[3912,3912],"disallowed"],[[3913,3916],"valid"],[[3917,3917],"mapped",[3916,4023]],[[3918,3921],"valid"],[[3922,3922],"mapped",[3921,4023]],[[3923,3926],"valid"],[[3927,3927],"mapped",[3926,4023]],[[3928,3931],"valid"],[[3932,3932],"mapped",[3931,4023]],[[3933,3944],"valid"],[[3945,3945],"mapped",[3904,4021]],[[3946,3946],"valid"],[[3947,3948],"valid"],[[3949,3952],"disallowed"],[[3953,3954],"valid"],[[3955,3955],"mapped",[3953,3954]],[[3956,3956],"valid"],[[3957,3957],"mapped",[3953,3956]],[[3958,3958],"mapped",[4018,3968]],[[3959,3959],"mapped",[4018,3953,3968]],[[3960,3960],"mapped",[4019,3968]],[[3961,3961],"mapped",[4019,3953,3968]],[[3962,3968],"valid"],[[3969,3969],"mapped",[3953,3968]],[[3970,3972],"valid"],[[3973,3973],"valid",[],"NV8"],[[3974,3979],"valid"],[[3980,3983],"valid"],[[3984,3986],"valid"],[[3987,3987],"mapped",[3986,4023]],[[3988,3989],"valid"],[[3990,3990],"valid"],[[3991,3991],"valid"],[[3992,3992],"disallowed"],[[3993,3996],"valid"],[[3997,3997],"mapped",[3996,4023]],[[3998,4001],"valid"],[[4002,4002],"mapped",[4001,4023]],[[4003,4006],"valid"],[[4007,4007],"mapped",[4006,4023]],[[4008,4011],"valid"],[[4012,4012],"mapped",[4011,4023]],[[4013,4013],"valid"],[[4014,4016],"valid"],[[4017,4023],"valid"],[[4024,4024],"valid"],[[4025,4025],"mapped",[3984,4021]],[[4026,4028],"valid"],[[4029,4029],"disallowed"],[[4030,4037],"valid",[],"NV8"],[[4038,4038],"valid"],[[4039,4044],"valid",[],"NV8"],[[4045,4045],"disallowed"],[[4046,4046],"valid",[],"NV8"],[[4047,4047],"valid",[],"NV8"],[[4048,4049],"valid",[],"NV8"],[[4050,4052],"valid",[],"NV8"],[[4053,4056],"valid",[],"NV8"],[[4057,4058],"valid",[],"NV8"],[[4059,4095],"disallowed"],[[4096,4129],"valid"],[[4130,4130],"valid"],[[4131,4135],"valid"],[[4136,4136],"valid"],[[4137,4138],"valid"],[[4139,4139],"valid"],[[4140,4146],"valid"],[[4147,4149],"valid"],[[4150,4153],"valid"],[[4154,4159],"valid"],[[4160,4169],"valid"],[[4170,4175],"valid",[],"NV8"],[[4176,4185],"valid"],[[4186,4249],"valid"],[[4250,4253],"valid"],[[4254,4255],"valid",[],"NV8"],[[4256,4293],"disallowed"],[[4294,4294],"disallowed"],[[4295,4295],"mapped",[11559]],[[4296,4300],"disallowed"],[[4301,4301],"mapped",[11565]],[[4302,4303],"disallowed"],[[4304,4342],"valid"],[[4343,4344],"valid"],[[4345,4346],"valid"],[[4347,4347],"valid",[],"NV8"],[[4348,4348],"mapped",[4316]],[[4349,4351],"valid"],[[4352,4441],"valid",[],"NV8"],[[4442,4446],"valid",[],"NV8"],[[4447,4448],"disallowed"],[[4449,4514],"valid",[],"NV8"],[[4515,4519],"valid",[],"NV8"],[[4520,4601],"valid",[],"NV8"],[[4602,4607],"valid",[],"NV8"],[[4608,4614],"valid"],[[4615,4615],"valid"],[[4616,4678],"valid"],[[4679,4679],"valid"],[[4680,4680],"valid"],[[4681,4681],"disallowed"],[[4682,4685],"valid"],[[4686,4687],"disallowed"],[[4688,4694],"valid"],[[4695,4695],"disallowed"],[[4696,4696],"valid"],[[4697,4697],"disallowed"],[[4698,4701],"valid"],[[4702,4703],"disallowed"],[[4704,4742],"valid"],[[4743,4743],"valid"],[[4744,4744],"valid"],[[4745,4745],"disallowed"],[[4746,4749],"valid"],[[4750,4751],"disallowed"],[[4752,4782],"valid"],[[4783,4783],"valid"],[[4784,4784],"valid"],[[4785,4785],"disallowed"],[[4786,4789],"valid"],[[4790,4791],"disallowed"],[[4792,4798],"valid"],[[4799,4799],"disallowed"],[[4800,4800],"valid"],[[4801,4801],"disallowed"],[[4802,4805],"valid"],[[4806,4807],"disallowed"],[[4808,4814],"valid"],[[4815,4815],"valid"],[[4816,4822],"valid"],[[4823,4823],"disallowed"],[[4824,4846],"valid"],[[4847,4847],"valid"],[[4848,4878],"valid"],[[4879,4879],"valid"],[[4880,4880],"valid"],[[4881,4881],"disallowed"],[[4882,4885],"valid"],[[4886,4887],"disallowed"],[[4888,4894],"valid"],[[4895,4895],"valid"],[[4896,4934],"valid"],[[4935,4935],"valid"],[[4936,4954],"valid"],[[4955,4956],"disallowed"],[[4957,4958],"valid"],[[4959,4959],"valid"],[[4960,4960],"valid",[],"NV8"],[[4961,4988],"valid",[],"NV8"],[[4989,4991],"disallowed"],[[4992,5007],"valid"],[[5008,5017],"valid",[],"NV8"],[[5018,5023],"disallowed"],[[5024,5108],"valid"],[[5109,5109],"valid"],[[5110,5111],"disallowed"],[[5112,5112],"mapped",[5104]],[[5113,5113],"mapped",[5105]],[[5114,5114],"mapped",[5106]],[[5115,5115],"mapped",[5107]],[[5116,5116],"mapped",[5108]],[[5117,5117],"mapped",[5109]],[[5118,5119],"disallowed"],[[5120,5120],"valid",[],"NV8"],[[5121,5740],"valid"],[[5741,5742],"valid",[],"NV8"],[[5743,5750],"valid"],[[5751,5759],"valid"],[[5760,5760],"disallowed"],[[5761,5786],"valid"],[[5787,5788],"valid",[],"NV8"],[[5789,5791],"disallowed"],[[5792,5866],"valid"],[[5867,5872],"valid",[],"NV8"],[[5873,5880],"valid"],[[5881,5887],"disallowed"],[[5888,5900],"valid"],[[5901,5901],"disallowed"],[[5902,5908],"valid"],[[5909,5919],"disallowed"],[[5920,5940],"valid"],[[5941,5942],"valid",[],"NV8"],[[5943,5951],"disallowed"],[[5952,5971],"valid"],[[5972,5983],"disallowed"],[[5984,5996],"valid"],[[5997,5997],"disallowed"],[[5998,6000],"valid"],[[6001,6001],"disallowed"],[[6002,6003],"valid"],[[6004,6015],"disallowed"],[[6016,6067],"valid"],[[6068,6069],"disallowed"],[[6070,6099],"valid"],[[6100,6102],"valid",[],"NV8"],[[6103,6103],"valid"],[[6104,6107],"valid",[],"NV8"],[[6108,6108],"valid"],[[6109,6109],"valid"],[[6110,6111],"disallowed"],[[6112,6121],"valid"],[[6122,6127],"disallowed"],[[6128,6137],"valid",[],"NV8"],[[6138,6143],"disallowed"],[[6144,6149],"valid",[],"NV8"],[[6150,6150],"disallowed"],[[6151,6154],"valid",[],"NV8"],[[6155,6157],"ignored"],[[6158,6158],"disallowed"],[[6159,6159],"disallowed"],[[6160,6169],"valid"],[[6170,6175],"disallowed"],[[6176,6263],"valid"],[[6264,6271],"disallowed"],[[6272,6313],"valid"],[[6314,6314],"valid"],[[6315,6319],"disallowed"],[[6320,6389],"valid"],[[6390,6399],"disallowed"],[[6400,6428],"valid"],[[6429,6430],"valid"],[[6431,6431],"disallowed"],[[6432,6443],"valid"],[[6444,6447],"disallowed"],[[6448,6459],"valid"],[[6460,6463],"disallowed"],[[6464,6464],"valid",[],"NV8"],[[6465,6467],"disallowed"],[[6468,6469],"valid",[],"NV8"],[[6470,6509],"valid"],[[6510,6511],"disallowed"],[[6512,6516],"valid"],[[6517,6527],"disallowed"],[[6528,6569],"valid"],[[6570,6571],"valid"],[[6572,6575],"disallowed"],[[6576,6601],"valid"],[[6602,6607],"disallowed"],[[6608,6617],"valid"],[[6618,6618],"valid",[],"XV8"],[[6619,6621],"disallowed"],[[6622,6623],"valid",[],"NV8"],[[6624,6655],"valid",[],"NV8"],[[6656,6683],"valid"],[[6684,6685],"disallowed"],[[6686,6687],"valid",[],"NV8"],[[6688,6750],"valid"],[[6751,6751],"disallowed"],[[6752,6780],"valid"],[[6781,6782],"disallowed"],[[6783,6793],"valid"],[[6794,6799],"disallowed"],[[6800,6809],"valid"],[[6810,6815],"disallowed"],[[6816,6822],"valid",[],"NV8"],[[6823,6823],"valid"],[[6824,6829],"valid",[],"NV8"],[[6830,6831],"disallowed"],[[6832,6845],"valid"],[[6846,6846],"valid",[],"NV8"],[[6847,6911],"disallowed"],[[6912,6987],"valid"],[[6988,6991],"disallowed"],[[6992,7001],"valid"],[[7002,7018],"valid",[],"NV8"],[[7019,7027],"valid"],[[7028,7036],"valid",[],"NV8"],[[7037,7039],"disallowed"],[[7040,7082],"valid"],[[7083,7085],"valid"],[[7086,7097],"valid"],[[7098,7103],"valid"],[[7104,7155],"valid"],[[7156,7163],"disallowed"],[[7164,7167],"valid",[],"NV8"],[[7168,7223],"valid"],[[7224,7226],"disallowed"],[[7227,7231],"valid",[],"NV8"],[[7232,7241],"valid"],[[7242,7244],"disallowed"],[[7245,7293],"valid"],[[7294,7295],"valid",[],"NV8"],[[7296,7359],"disallowed"],[[7360,7367],"valid",[],"NV8"],[[7368,7375],"disallowed"],[[7376,7378],"valid"],[[7379,7379],"valid",[],"NV8"],[[7380,7410],"valid"],[[7411,7414],"valid"],[[7415,7415],"disallowed"],[[7416,7417],"valid"],[[7418,7423],"disallowed"],[[7424,7467],"valid"],[[7468,7468],"mapped",[97]],[[7469,7469],"mapped",[230]],[[7470,7470],"mapped",[98]],[[7471,7471],"valid"],[[7472,7472],"mapped",[100]],[[7473,7473],"mapped",[101]],[[7474,7474],"mapped",[477]],[[7475,7475],"mapped",[103]],[[7476,7476],"mapped",[104]],[[7477,7477],"mapped",[105]],[[7478,7478],"mapped",[106]],[[7479,7479],"mapped",[107]],[[7480,7480],"mapped",[108]],[[7481,7481],"mapped",[109]],[[7482,7482],"mapped",[110]],[[7483,7483],"valid"],[[7484,7484],"mapped",[111]],[[7485,7485],"mapped",[547]],[[7486,7486],"mapped",[112]],[[7487,7487],"mapped",[114]],[[7488,7488],"mapped",[116]],[[7489,7489],"mapped",[117]],[[7490,7490],"mapped",[119]],[[7491,7491],"mapped",[97]],[[7492,7492],"mapped",[592]],[[7493,7493],"mapped",[593]],[[7494,7494],"mapped",[7426]],[[7495,7495],"mapped",[98]],[[7496,7496],"mapped",[100]],[[7497,7497],"mapped",[101]],[[7498,7498],"mapped",[601]],[[7499,7499],"mapped",[603]],[[7500,7500],"mapped",[604]],[[7501,7501],"mapped",[103]],[[7502,7502],"valid"],[[7503,7503],"mapped",[107]],[[7504,7504],"mapped",[109]],[[7505,7505],"mapped",[331]],[[7506,7506],"mapped",[111]],[[7507,7507],"mapped",[596]],[[7508,7508],"mapped",[7446]],[[7509,7509],"mapped",[7447]],[[7510,7510],"mapped",[112]],[[7511,7511],"mapped",[116]],[[7512,7512],"mapped",[117]],[[7513,7513],"mapped",[7453]],[[7514,7514],"mapped",[623]],[[7515,7515],"mapped",[118]],[[7516,7516],"mapped",[7461]],[[7517,7517],"mapped",[946]],[[7518,7518],"mapped",[947]],[[7519,7519],"mapped",[948]],[[7520,7520],"mapped",[966]],[[7521,7521],"mapped",[967]],[[7522,7522],"mapped",[105]],[[7523,7523],"mapped",[114]],[[7524,7524],"mapped",[117]],[[7525,7525],"mapped",[118]],[[7526,7526],"mapped",[946]],[[7527,7527],"mapped",[947]],[[7528,7528],"mapped",[961]],[[7529,7529],"mapped",[966]],[[7530,7530],"mapped",[967]],[[7531,7531],"valid"],[[7532,7543],"valid"],[[7544,7544],"mapped",[1085]],[[7545,7578],"valid"],[[7579,7579],"mapped",[594]],[[7580,7580],"mapped",[99]],[[7581,7581],"mapped",[597]],[[7582,7582],"mapped",[240]],[[7583,7583],"mapped",[604]],[[7584,7584],"mapped",[102]],[[7585,7585],"mapped",[607]],[[7586,7586],"mapped",[609]],[[7587,7587],"mapped",[613]],[[7588,7588],"mapped",[616]],[[7589,7589],"mapped",[617]],[[7590,7590],"mapped",[618]],[[7591,7591],"mapped",[7547]],[[7592,7592],"mapped",[669]],[[7593,7593],"mapped",[621]],[[7594,7594],"mapped",[7557]],[[7595,7595],"mapped",[671]],[[7596,7596],"mapped",[625]],[[7597,7597],"mapped",[624]],[[7598,7598],"mapped",[626]],[[7599,7599],"mapped",[627]],[[7600,7600],"mapped",[628]],[[7601,7601],"mapped",[629]],[[7602,7602],"mapped",[632]],[[7603,7603],"mapped",[642]],[[7604,7604],"mapped",[643]],[[7605,7605],"mapped",[427]],[[7606,7606],"mapped",[649]],[[7607,7607],"mapped",[650]],[[7608,7608],"mapped",[7452]],[[7609,7609],"mapped",[651]],[[7610,7610],"mapped",[652]],[[7611,7611],"mapped",[122]],[[7612,7612],"mapped",[656]],[[7613,7613],"mapped",[657]],[[7614,7614],"mapped",[658]],[[7615,7615],"mapped",[952]],[[7616,7619],"valid"],[[7620,7626],"valid"],[[7627,7654],"valid"],[[7655,7669],"valid"],[[7670,7675],"disallowed"],[[7676,7676],"valid"],[[7677,7677],"valid"],[[7678,7679],"valid"],[[7680,7680],"mapped",[7681]],[[7681,7681],"valid"],[[7682,7682],"mapped",[7683]],[[7683,7683],"valid"],[[7684,7684],"mapped",[7685]],[[7685,7685],"valid"],[[7686,7686],"mapped",[7687]],[[7687,7687],"valid"],[[7688,7688],"mapped",[7689]],[[7689,7689],"valid"],[[7690,7690],"mapped",[7691]],[[7691,7691],"valid"],[[7692,7692],"mapped",[7693]],[[7693,7693],"valid"],[[7694,7694],"mapped",[7695]],[[7695,7695],"valid"],[[7696,7696],"mapped",[7697]],[[7697,7697],"valid"],[[7698,7698],"mapped",[7699]],[[7699,7699],"valid"],[[7700,7700],"mapped",[7701]],[[7701,7701],"valid"],[[7702,7702],"mapped",[7703]],[[7703,7703],"valid"],[[7704,7704],"mapped",[7705]],[[7705,7705],"valid"],[[7706,7706],"mapped",[7707]],[[7707,7707],"valid"],[[7708,7708],"mapped",[7709]],[[7709,7709],"valid"],[[7710,7710],"mapped",[7711]],[[7711,7711],"valid"],[[7712,7712],"mapped",[7713]],[[7713,7713],"valid"],[[7714,7714],"mapped",[7715]],[[7715,7715],"valid"],[[7716,7716],"mapped",[7717]],[[7717,7717],"valid"],[[7718,7718],"mapped",[7719]],[[7719,7719],"valid"],[[7720,7720],"mapped",[7721]],[[7721,7721],"valid"],[[7722,7722],"mapped",[7723]],[[7723,7723],"valid"],[[7724,7724],"mapped",[7725]],[[7725,7725],"valid"],[[7726,7726],"mapped",[7727]],[[7727,7727],"valid"],[[7728,7728],"mapped",[7729]],[[7729,7729],"valid"],[[7730,7730],"mapped",[7731]],[[7731,7731],"valid"],[[7732,7732],"mapped",[7733]],[[7733,7733],"valid"],[[7734,7734],"mapped",[7735]],[[7735,7735],"valid"],[[7736,7736],"mapped",[7737]],[[7737,7737],"valid"],[[7738,7738],"mapped",[7739]],[[7739,7739],"valid"],[[7740,7740],"mapped",[7741]],[[7741,7741],"valid"],[[7742,7742],"mapped",[7743]],[[7743,7743],"valid"],[[7744,7744],"mapped",[7745]],[[7745,7745],"valid"],[[7746,7746],"mapped",[7747]],[[7747,7747],"valid"],[[7748,7748],"mapped",[7749]],[[7749,7749],"valid"],[[7750,7750],"mapped",[7751]],[[7751,7751],"valid"],[[7752,7752],"mapped",[7753]],[[7753,7753],"valid"],[[7754,7754],"mapped",[7755]],[[7755,7755],"valid"],[[7756,7756],"mapped",[7757]],[[7757,7757],"valid"],[[7758,7758],"mapped",[7759]],[[7759,7759],"valid"],[[7760,7760],"mapped",[7761]],[[7761,7761],"valid"],[[7762,7762],"mapped",[7763]],[[7763,7763],"valid"],[[7764,7764],"mapped",[7765]],[[7765,7765],"valid"],[[7766,7766],"mapped",[7767]],[[7767,7767],"valid"],[[7768,7768],"mapped",[7769]],[[7769,7769],"valid"],[[7770,7770],"mapped",[7771]],[[7771,7771],"valid"],[[7772,7772],"mapped",[7773]],[[7773,7773],"valid"],[[7774,7774],"mapped",[7775]],[[7775,7775],"valid"],[[7776,7776],"mapped",[7777]],[[7777,7777],"valid"],[[7778,7778],"mapped",[7779]],[[7779,7779],"valid"],[[7780,7780],"mapped",[7781]],[[7781,7781],"valid"],[[7782,7782],"mapped",[7783]],[[7783,7783],"valid"],[[7784,7784],"mapped",[7785]],[[7785,7785],"valid"],[[7786,7786],"mapped",[7787]],[[7787,7787],"valid"],[[7788,7788],"mapped",[7789]],[[7789,7789],"valid"],[[7790,7790],"mapped",[7791]],[[7791,7791],"valid"],[[7792,7792],"mapped",[7793]],[[7793,7793],"valid"],[[7794,7794],"mapped",[7795]],[[7795,7795],"valid"],[[7796,7796],"mapped",[7797]],[[7797,7797],"valid"],[[7798,7798],"mapped",[7799]],[[7799,7799],"valid"],[[7800,7800],"mapped",[7801]],[[7801,7801],"valid"],[[7802,7802],"mapped",[7803]],[[7803,7803],"valid"],[[7804,7804],"mapped",[7805]],[[7805,7805],"valid"],[[7806,7806],"mapped",[7807]],[[7807,7807],"valid"],[[7808,7808],"mapped",[7809]],[[7809,7809],"valid"],[[7810,7810],"mapped",[7811]],[[7811,7811],"valid"],[[7812,7812],"mapped",[7813]],[[7813,7813],"valid"],[[7814,7814],"mapped",[7815]],[[7815,7815],"valid"],[[7816,7816],"mapped",[7817]],[[7817,7817],"valid"],[[7818,7818],"mapped",[7819]],[[7819,7819],"valid"],[[7820,7820],"mapped",[7821]],[[7821,7821],"valid"],[[7822,7822],"mapped",[7823]],[[7823,7823],"valid"],[[7824,7824],"mapped",[7825]],[[7825,7825],"valid"],[[7826,7826],"mapped",[7827]],[[7827,7827],"valid"],[[7828,7828],"mapped",[7829]],[[7829,7833],"valid"],[[7834,7834],"mapped",[97,702]],[[7835,7835],"mapped",[7777]],[[7836,7837],"valid"],[[7838,7838],"mapped",[115,115]],[[7839,7839],"valid"],[[7840,7840],"mapped",[7841]],[[7841,7841],"valid"],[[7842,7842],"mapped",[7843]],[[7843,7843],"valid"],[[7844,7844],"mapped",[7845]],[[7845,7845],"valid"],[[7846,7846],"mapped",[7847]],[[7847,7847],"valid"],[[7848,7848],"mapped",[7849]],[[7849,7849],"valid"],[[7850,7850],"mapped",[7851]],[[7851,7851],"valid"],[[7852,7852],"mapped",[7853]],[[7853,7853],"valid"],[[7854,7854],"mapped",[7855]],[[7855,7855],"valid"],[[7856,7856],"mapped",[7857]],[[7857,7857],"valid"],[[7858,7858],"mapped",[7859]],[[7859,7859],"valid"],[[7860,7860],"mapped",[7861]],[[7861,7861],"valid"],[[7862,7862],"mapped",[7863]],[[7863,7863],"valid"],[[7864,7864],"mapped",[7865]],[[7865,7865],"valid"],[[7866,7866],"mapped",[7867]],[[7867,7867],"valid"],[[7868,7868],"mapped",[7869]],[[7869,7869],"valid"],[[7870,7870],"mapped",[7871]],[[7871,7871],"valid"],[[7872,7872],"mapped",[7873]],[[7873,7873],"valid"],[[7874,7874],"mapped",[7875]],[[7875,7875],"valid"],[[7876,7876],"mapped",[7877]],[[7877,7877],"valid"],[[7878,7878],"mapped",[7879]],[[7879,7879],"valid"],[[7880,7880],"mapped",[7881]],[[7881,7881],"valid"],[[7882,7882],"mapped",[7883]],[[7883,7883],"valid"],[[7884,7884],"mapped",[7885]],[[7885,7885],"valid"],[[7886,7886],"mapped",[7887]],[[7887,7887],"valid"],[[7888,7888],"mapped",[7889]],[[7889,7889],"valid"],[[7890,7890],"mapped",[7891]],[[7891,7891],"valid"],[[7892,7892],"mapped",[7893]],[[7893,7893],"valid"],[[7894,7894],"mapped",[7895]],[[7895,7895],"valid"],[[7896,7896],"mapped",[7897]],[[7897,7897],"valid"],[[7898,7898],"mapped",[7899]],[[7899,7899],"valid"],[[7900,7900],"mapped",[7901]],[[7901,7901],"valid"],[[7902,7902],"mapped",[7903]],[[7903,7903],"valid"],[[7904,7904],"mapped",[7905]],[[7905,7905],"valid"],[[7906,7906],"mapped",[7907]],[[7907,7907],"valid"],[[7908,7908],"mapped",[7909]],[[7909,7909],"valid"],[[7910,7910],"mapped",[7911]],[[7911,7911],"valid"],[[7912,7912],"mapped",[7913]],[[7913,7913],"valid"],[[7914,7914],"mapped",[7915]],[[7915,7915],"valid"],[[7916,7916],"mapped",[7917]],[[7917,7917],"valid"],[[7918,7918],"mapped",[7919]],[[7919,7919],"valid"],[[7920,7920],"mapped",[7921]],[[7921,7921],"valid"],[[7922,7922],"mapped",[7923]],[[7923,7923],"valid"],[[7924,7924],"mapped",[7925]],[[7925,7925],"valid"],[[7926,7926],"mapped",[7927]],[[7927,7927],"valid"],[[7928,7928],"mapped",[7929]],[[7929,7929],"valid"],[[7930,7930],"mapped",[7931]],[[7931,7931],"valid"],[[7932,7932],"mapped",[7933]],[[7933,7933],"valid"],[[7934,7934],"mapped",[7935]],[[7935,7935],"valid"],[[7936,7943],"valid"],[[7944,7944],"mapped",[7936]],[[7945,7945],"mapped",[7937]],[[7946,7946],"mapped",[7938]],[[7947,7947],"mapped",[7939]],[[7948,7948],"mapped",[7940]],[[7949,7949],"mapped",[7941]],[[7950,7950],"mapped",[7942]],[[7951,7951],"mapped",[7943]],[[7952,7957],"valid"],[[7958,7959],"disallowed"],[[7960,7960],"mapped",[7952]],[[7961,7961],"mapped",[7953]],[[7962,7962],"mapped",[7954]],[[7963,7963],"mapped",[7955]],[[7964,7964],"mapped",[7956]],[[7965,7965],"mapped",[7957]],[[7966,7967],"disallowed"],[[7968,7975],"valid"],[[7976,7976],"mapped",[7968]],[[7977,7977],"mapped",[7969]],[[7978,7978],"mapped",[7970]],[[7979,7979],"mapped",[7971]],[[7980,7980],"mapped",[7972]],[[7981,7981],"mapped",[7973]],[[7982,7982],"mapped",[7974]],[[7983,7983],"mapped",[7975]],[[7984,7991],"valid"],[[7992,7992],"mapped",[7984]],[[7993,7993],"mapped",[7985]],[[7994,7994],"mapped",[7986]],[[7995,7995],"mapped",[7987]],[[7996,7996],"mapped",[7988]],[[7997,7997],"mapped",[7989]],[[7998,7998],"mapped",[7990]],[[7999,7999],"mapped",[7991]],[[8000,8005],"valid"],[[8006,8007],"disallowed"],[[8008,8008],"mapped",[8000]],[[8009,8009],"mapped",[8001]],[[8010,8010],"mapped",[8002]],[[8011,8011],"mapped",[8003]],[[8012,8012],"mapped",[8004]],[[8013,8013],"mapped",[8005]],[[8014,8015],"disallowed"],[[8016,8023],"valid"],[[8024,8024],"disallowed"],[[8025,8025],"mapped",[8017]],[[8026,8026],"disallowed"],[[8027,8027],"mapped",[8019]],[[8028,8028],"disallowed"],[[8029,8029],"mapped",[8021]],[[8030,8030],"disallowed"],[[8031,8031],"mapped",[8023]],[[8032,8039],"valid"],[[8040,8040],"mapped",[8032]],[[8041,8041],"mapped",[8033]],[[8042,8042],"mapped",[8034]],[[8043,8043],"mapped",[8035]],[[8044,8044],"mapped",[8036]],[[8045,8045],"mapped",[8037]],[[8046,8046],"mapped",[8038]],[[8047,8047],"mapped",[8039]],[[8048,8048],"valid"],[[8049,8049],"mapped",[940]],[[8050,8050],"valid"],[[8051,8051],"mapped",[941]],[[8052,8052],"valid"],[[8053,8053],"mapped",[942]],[[8054,8054],"valid"],[[8055,8055],"mapped",[943]],[[8056,8056],"valid"],[[8057,8057],"mapped",[972]],[[8058,8058],"valid"],[[8059,8059],"mapped",[973]],[[8060,8060],"valid"],[[8061,8061],"mapped",[974]],[[8062,8063],"disallowed"],[[8064,8064],"mapped",[7936,953]],[[8065,8065],"mapped",[7937,953]],[[8066,8066],"mapped",[7938,953]],[[8067,8067],"mapped",[7939,953]],[[8068,8068],"mapped",[7940,953]],[[8069,8069],"mapped",[7941,953]],[[8070,8070],"mapped",[7942,953]],[[8071,8071],"mapped",[7943,953]],[[8072,8072],"mapped",[7936,953]],[[8073,8073],"mapped",[7937,953]],[[8074,8074],"mapped",[7938,953]],[[8075,8075],"mapped",[7939,953]],[[8076,8076],"mapped",[7940,953]],[[8077,8077],"mapped",[7941,953]],[[8078,8078],"mapped",[7942,953]],[[8079,8079],"mapped",[7943,953]],[[8080,8080],"mapped",[7968,953]],[[8081,8081],"mapped",[7969,953]],[[8082,8082],"mapped",[7970,953]],[[8083,8083],"mapped",[7971,953]],[[8084,8084],"mapped",[7972,953]],[[8085,8085],"mapped",[7973,953]],[[8086,8086],"mapped",[7974,953]],[[8087,8087],"mapped",[7975,953]],[[8088,8088],"mapped",[7968,953]],[[8089,8089],"mapped",[7969,953]],[[8090,8090],"mapped",[7970,953]],[[8091,8091],"mapped",[7971,953]],[[8092,8092],"mapped",[7972,953]],[[8093,8093],"mapped",[7973,953]],[[8094,8094],"mapped",[7974,953]],[[8095,8095],"mapped",[7975,953]],[[8096,8096],"mapped",[8032,953]],[[8097,8097],"mapped",[8033,953]],[[8098,8098],"mapped",[8034,953]],[[8099,8099],"mapped",[8035,953]],[[8100,8100],"mapped",[8036,953]],[[8101,8101],"mapped",[8037,953]],[[8102,8102],"mapped",[8038,953]],[[8103,8103],"mapped",[8039,953]],[[8104,8104],"mapped",[8032,953]],[[8105,8105],"mapped",[8033,953]],[[8106,8106],"mapped",[8034,953]],[[8107,8107],"mapped",[8035,953]],[[8108,8108],"mapped",[8036,953]],[[8109,8109],"mapped",[8037,953]],[[8110,8110],"mapped",[8038,953]],[[8111,8111],"mapped",[8039,953]],[[8112,8113],"valid"],[[8114,8114],"mapped",[8048,953]],[[8115,8115],"mapped",[945,953]],[[8116,8116],"mapped",[940,953]],[[8117,8117],"disallowed"],[[8118,8118],"valid"],[[8119,8119],"mapped",[8118,953]],[[8120,8120],"mapped",[8112]],[[8121,8121],"mapped",[8113]],[[8122,8122],"mapped",[8048]],[[8123,8123],"mapped",[940]],[[8124,8124],"mapped",[945,953]],[[8125,8125],"disallowed_STD3_mapped",[32,787]],[[8126,8126],"mapped",[953]],[[8127,8127],"disallowed_STD3_mapped",[32,787]],[[8128,8128],"disallowed_STD3_mapped",[32,834]],[[8129,8129],"disallowed_STD3_mapped",[32,776,834]],[[8130,8130],"mapped",[8052,953]],[[8131,8131],"mapped",[951,953]],[[8132,8132],"mapped",[942,953]],[[8133,8133],"disallowed"],[[8134,8134],"valid"],[[8135,8135],"mapped",[8134,953]],[[8136,8136],"mapped",[8050]],[[8137,8137],"mapped",[941]],[[8138,8138],"mapped",[8052]],[[8139,8139],"mapped",[942]],[[8140,8140],"mapped",[951,953]],[[8141,8141],"disallowed_STD3_mapped",[32,787,768]],[[8142,8142],"disallowed_STD3_mapped",[32,787,769]],[[8143,8143],"disallowed_STD3_mapped",[32,787,834]],[[8144,8146],"valid"],[[8147,8147],"mapped",[912]],[[8148,8149],"disallowed"],[[8150,8151],"valid"],[[8152,8152],"mapped",[8144]],[[8153,8153],"mapped",[8145]],[[8154,8154],"mapped",[8054]],[[8155,8155],"mapped",[943]],[[8156,8156],"disallowed"],[[8157,8157],"disallowed_STD3_mapped",[32,788,768]],[[8158,8158],"disallowed_STD3_mapped",[32,788,769]],[[8159,8159],"disallowed_STD3_mapped",[32,788,834]],[[8160,8162],"valid"],[[8163,8163],"mapped",[944]],[[8164,8167],"valid"],[[8168,8168],"mapped",[8160]],[[8169,8169],"mapped",[8161]],[[8170,8170],"mapped",[8058]],[[8171,8171],"mapped",[973]],[[8172,8172],"mapped",[8165]],[[8173,8173],"disallowed_STD3_mapped",[32,776,768]],[[8174,8174],"disallowed_STD3_mapped",[32,776,769]],[[8175,8175],"disallowed_STD3_mapped",[96]],[[8176,8177],"disallowed"],[[8178,8178],"mapped",[8060,953]],[[8179,8179],"mapped",[969,953]],[[8180,8180],"mapped",[974,953]],[[8181,8181],"disallowed"],[[8182,8182],"valid"],[[8183,8183],"mapped",[8182,953]],[[8184,8184],"mapped",[8056]],[[8185,8185],"mapped",[972]],[[8186,8186],"mapped",[8060]],[[8187,8187],"mapped",[974]],[[8188,8188],"mapped",[969,953]],[[8189,8189],"disallowed_STD3_mapped",[32,769]],[[8190,8190],"disallowed_STD3_mapped",[32,788]],[[8191,8191],"disallowed"],[[8192,8202],"disallowed_STD3_mapped",[32]],[[8203,8203],"ignored"],[[8204,8205],"deviation",[]],[[8206,8207],"disallowed"],[[8208,8208],"valid",[],"NV8"],[[8209,8209],"mapped",[8208]],[[8210,8214],"valid",[],"NV8"],[[8215,8215],"disallowed_STD3_mapped",[32,819]],[[8216,8227],"valid",[],"NV8"],[[8228,8230],"disallowed"],[[8231,8231],"valid",[],"NV8"],[[8232,8238],"disallowed"],[[8239,8239],"disallowed_STD3_mapped",[32]],[[8240,8242],"valid",[],"NV8"],[[8243,8243],"mapped",[8242,8242]],[[8244,8244],"mapped",[8242,8242,8242]],[[8245,8245],"valid",[],"NV8"],[[8246,8246],"mapped",[8245,8245]],[[8247,8247],"mapped",[8245,8245,8245]],[[8248,8251],"valid",[],"NV8"],[[8252,8252],"disallowed_STD3_mapped",[33,33]],[[8253,8253],"valid",[],"NV8"],[[8254,8254],"disallowed_STD3_mapped",[32,773]],[[8255,8262],"valid",[],"NV8"],[[8263,8263],"disallowed_STD3_mapped",[63,63]],[[8264,8264],"disallowed_STD3_mapped",[63,33]],[[8265,8265],"disallowed_STD3_mapped",[33,63]],[[8266,8269],"valid",[],"NV8"],[[8270,8274],"valid",[],"NV8"],[[8275,8276],"valid",[],"NV8"],[[8277,8278],"valid",[],"NV8"],[[8279,8279],"mapped",[8242,8242,8242,8242]],[[8280,8286],"valid",[],"NV8"],[[8287,8287],"disallowed_STD3_mapped",[32]],[[8288,8288],"ignored"],[[8289,8291],"disallowed"],[[8292,8292],"ignored"],[[8293,8293],"disallowed"],[[8294,8297],"disallowed"],[[8298,8303],"disallowed"],[[8304,8304],"mapped",[48]],[[8305,8305],"mapped",[105]],[[8306,8307],"disallowed"],[[8308,8308],"mapped",[52]],[[8309,8309],"mapped",[53]],[[8310,8310],"mapped",[54]],[[8311,8311],"mapped",[55]],[[8312,8312],"mapped",[56]],[[8313,8313],"mapped",[57]],[[8314,8314],"disallowed_STD3_mapped",[43]],[[8315,8315],"mapped",[8722]],[[8316,8316],"disallowed_STD3_mapped",[61]],[[8317,8317],"disallowed_STD3_mapped",[40]],[[8318,8318],"disallowed_STD3_mapped",[41]],[[8319,8319],"mapped",[110]],[[8320,8320],"mapped",[48]],[[8321,8321],"mapped",[49]],[[8322,8322],"mapped",[50]],[[8323,8323],"mapped",[51]],[[8324,8324],"mapped",[52]],[[8325,8325],"mapped",[53]],[[8326,8326],"mapped",[54]],[[8327,8327],"mapped",[55]],[[8328,8328],"mapped",[56]],[[8329,8329],"mapped",[57]],[[8330,8330],"disallowed_STD3_mapped",[43]],[[8331,8331],"mapped",[8722]],[[8332,8332],"disallowed_STD3_mapped",[61]],[[8333,8333],"disallowed_STD3_mapped",[40]],[[8334,8334],"disallowed_STD3_mapped",[41]],[[8335,8335],"disallowed"],[[8336,8336],"mapped",[97]],[[8337,8337],"mapped",[101]],[[8338,8338],"mapped",[111]],[[8339,8339],"mapped",[120]],[[8340,8340],"mapped",[601]],[[8341,8341],"mapped",[104]],[[8342,8342],"mapped",[107]],[[8343,8343],"mapped",[108]],[[8344,8344],"mapped",[109]],[[8345,8345],"mapped",[110]],[[8346,8346],"mapped",[112]],[[8347,8347],"mapped",[115]],[[8348,8348],"mapped",[116]],[[8349,8351],"disallowed"],[[8352,8359],"valid",[],"NV8"],[[8360,8360],"mapped",[114,115]],[[8361,8362],"valid",[],"NV8"],[[8363,8363],"valid",[],"NV8"],[[8364,8364],"valid",[],"NV8"],[[8365,8367],"valid",[],"NV8"],[[8368,8369],"valid",[],"NV8"],[[8370,8373],"valid",[],"NV8"],[[8374,8376],"valid",[],"NV8"],[[8377,8377],"valid",[],"NV8"],[[8378,8378],"valid",[],"NV8"],[[8379,8381],"valid",[],"NV8"],[[8382,8382],"valid",[],"NV8"],[[8383,8399],"disallowed"],[[8400,8417],"valid",[],"NV8"],[[8418,8419],"valid",[],"NV8"],[[8420,8426],"valid",[],"NV8"],[[8427,8427],"valid",[],"NV8"],[[8428,8431],"valid",[],"NV8"],[[8432,8432],"valid",[],"NV8"],[[8433,8447],"disallowed"],[[8448,8448],"disallowed_STD3_mapped",[97,47,99]],[[8449,8449],"disallowed_STD3_mapped",[97,47,115]],[[8450,8450],"mapped",[99]],[[8451,8451],"mapped",[176,99]],[[8452,8452],"valid",[],"NV8"],[[8453,8453],"disallowed_STD3_mapped",[99,47,111]],[[8454,8454],"disallowed_STD3_mapped",[99,47,117]],[[8455,8455],"mapped",[603]],[[8456,8456],"valid",[],"NV8"],[[8457,8457],"mapped",[176,102]],[[8458,8458],"mapped",[103]],[[8459,8462],"mapped",[104]],[[8463,8463],"mapped",[295]],[[8464,8465],"mapped",[105]],[[8466,8467],"mapped",[108]],[[8468,8468],"valid",[],"NV8"],[[8469,8469],"mapped",[110]],[[8470,8470],"mapped",[110,111]],[[8471,8472],"valid",[],"NV8"],[[8473,8473],"mapped",[112]],[[8474,8474],"mapped",[113]],[[8475,8477],"mapped",[114]],[[8478,8479],"valid",[],"NV8"],[[8480,8480],"mapped",[115,109]],[[8481,8481],"mapped",[116,101,108]],[[8482,8482],"mapped",[116,109]],[[8483,8483],"valid",[],"NV8"],[[8484,8484],"mapped",[122]],[[8485,8485],"valid",[],"NV8"],[[8486,8486],"mapped",[969]],[[8487,8487],"valid",[],"NV8"],[[8488,8488],"mapped",[122]],[[8489,8489],"valid",[],"NV8"],[[8490,8490],"mapped",[107]],[[8491,8491],"mapped",[229]],[[8492,8492],"mapped",[98]],[[8493,8493],"mapped",[99]],[[8494,8494],"valid",[],"NV8"],[[8495,8496],"mapped",[101]],[[8497,8497],"mapped",[102]],[[8498,8498],"disallowed"],[[8499,8499],"mapped",[109]],[[8500,8500],"mapped",[111]],[[8501,8501],"mapped",[1488]],[[8502,8502],"mapped",[1489]],[[8503,8503],"mapped",[1490]],[[8504,8504],"mapped",[1491]],[[8505,8505],"mapped",[105]],[[8506,8506],"valid",[],"NV8"],[[8507,8507],"mapped",[102,97,120]],[[8508,8508],"mapped",[960]],[[8509,8510],"mapped",[947]],[[8511,8511],"mapped",[960]],[[8512,8512],"mapped",[8721]],[[8513,8516],"valid",[],"NV8"],[[8517,8518],"mapped",[100]],[[8519,8519],"mapped",[101]],[[8520,8520],"mapped",[105]],[[8521,8521],"mapped",[106]],[[8522,8523],"valid",[],"NV8"],[[8524,8524],"valid",[],"NV8"],[[8525,8525],"valid",[],"NV8"],[[8526,8526],"valid"],[[8527,8527],"valid",[],"NV8"],[[8528,8528],"mapped",[49,8260,55]],[[8529,8529],"mapped",[49,8260,57]],[[8530,8530],"mapped",[49,8260,49,48]],[[8531,8531],"mapped",[49,8260,51]],[[8532,8532],"mapped",[50,8260,51]],[[8533,8533],"mapped",[49,8260,53]],[[8534,8534],"mapped",[50,8260,53]],[[8535,8535],"mapped",[51,8260,53]],[[8536,8536],"mapped",[52,8260,53]],[[8537,8537],"mapped",[49,8260,54]],[[8538,8538],"mapped",[53,8260,54]],[[8539,8539],"mapped",[49,8260,56]],[[8540,8540],"mapped",[51,8260,56]],[[8541,8541],"mapped",[53,8260,56]],[[8542,8542],"mapped",[55,8260,56]],[[8543,8543],"mapped",[49,8260]],[[8544,8544],"mapped",[105]],[[8545,8545],"mapped",[105,105]],[[8546,8546],"mapped",[105,105,105]],[[8547,8547],"mapped",[105,118]],[[8548,8548],"mapped",[118]],[[8549,8549],"mapped",[118,105]],[[8550,8550],"mapped",[118,105,105]],[[8551,8551],"mapped",[118,105,105,105]],[[8552,8552],"mapped",[105,120]],[[8553,8553],"mapped",[120]],[[8554,8554],"mapped",[120,105]],[[8555,8555],"mapped",[120,105,105]],[[8556,8556],"mapped",[108]],[[8557,8557],"mapped",[99]],[[8558,8558],"mapped",[100]],[[8559,8559],"mapped",[109]],[[8560,8560],"mapped",[105]],[[8561,8561],"mapped",[105,105]],[[8562,8562],"mapped",[105,105,105]],[[8563,8563],"mapped",[105,118]],[[8564,8564],"mapped",[118]],[[8565,8565],"mapped",[118,105]],[[8566,8566],"mapped",[118,105,105]],[[8567,8567],"mapped",[118,105,105,105]],[[8568,8568],"mapped",[105,120]],[[8569,8569],"mapped",[120]],[[8570,8570],"mapped",[120,105]],[[8571,8571],"mapped",[120,105,105]],[[8572,8572],"mapped",[108]],[[8573,8573],"mapped",[99]],[[8574,8574],"mapped",[100]],[[8575,8575],"mapped",[109]],[[8576,8578],"valid",[],"NV8"],[[8579,8579],"disallowed"],[[8580,8580],"valid"],[[8581,8584],"valid",[],"NV8"],[[8585,8585],"mapped",[48,8260,51]],[[8586,8587],"valid",[],"NV8"],[[8588,8591],"disallowed"],[[8592,8682],"valid",[],"NV8"],[[8683,8691],"valid",[],"NV8"],[[8692,8703],"valid",[],"NV8"],[[8704,8747],"valid",[],"NV8"],[[8748,8748],"mapped",[8747,8747]],[[8749,8749],"mapped",[8747,8747,8747]],[[8750,8750],"valid",[],"NV8"],[[8751,8751],"mapped",[8750,8750]],[[8752,8752],"mapped",[8750,8750,8750]],[[8753,8799],"valid",[],"NV8"],[[8800,8800],"disallowed_STD3_valid"],[[8801,8813],"valid",[],"NV8"],[[8814,8815],"disallowed_STD3_valid"],[[8816,8945],"valid",[],"NV8"],[[8946,8959],"valid",[],"NV8"],[[8960,8960],"valid",[],"NV8"],[[8961,8961],"valid",[],"NV8"],[[8962,9000],"valid",[],"NV8"],[[9001,9001],"mapped",[12296]],[[9002,9002],"mapped",[12297]],[[9003,9082],"valid",[],"NV8"],[[9083,9083],"valid",[],"NV8"],[[9084,9084],"valid",[],"NV8"],[[9085,9114],"valid",[],"NV8"],[[9115,9166],"valid",[],"NV8"],[[9167,9168],"valid",[],"NV8"],[[9169,9179],"valid",[],"NV8"],[[9180,9191],"valid",[],"NV8"],[[9192,9192],"valid",[],"NV8"],[[9193,9203],"valid",[],"NV8"],[[9204,9210],"valid",[],"NV8"],[[9211,9215],"disallowed"],[[9216,9252],"valid",[],"NV8"],[[9253,9254],"valid",[],"NV8"],[[9255,9279],"disallowed"],[[9280,9290],"valid",[],"NV8"],[[9291,9311],"disallowed"],[[9312,9312],"mapped",[49]],[[9313,9313],"mapped",[50]],[[9314,9314],"mapped",[51]],[[9315,9315],"mapped",[52]],[[9316,9316],"mapped",[53]],[[9317,9317],"mapped",[54]],[[9318,9318],"mapped",[55]],[[9319,9319],"mapped",[56]],[[9320,9320],"mapped",[57]],[[9321,9321],"mapped",[49,48]],[[9322,9322],"mapped",[49,49]],[[9323,9323],"mapped",[49,50]],[[9324,9324],"mapped",[49,51]],[[9325,9325],"mapped",[49,52]],[[9326,9326],"mapped",[49,53]],[[9327,9327],"mapped",[49,54]],[[9328,9328],"mapped",[49,55]],[[9329,9329],"mapped",[49,56]],[[9330,9330],"mapped",[49,57]],[[9331,9331],"mapped",[50,48]],[[9332,9332],"disallowed_STD3_mapped",[40,49,41]],[[9333,9333],"disallowed_STD3_mapped",[40,50,41]],[[9334,9334],"disallowed_STD3_mapped",[40,51,41]],[[9335,9335],"disallowed_STD3_mapped",[40,52,41]],[[9336,9336],"disallowed_STD3_mapped",[40,53,41]],[[9337,9337],"disallowed_STD3_mapped",[40,54,41]],[[9338,9338],"disallowed_STD3_mapped",[40,55,41]],[[9339,9339],"disallowed_STD3_mapped",[40,56,41]],[[9340,9340],"disallowed_STD3_mapped",[40,57,41]],[[9341,9341],"disallowed_STD3_mapped",[40,49,48,41]],[[9342,9342],"disallowed_STD3_mapped",[40,49,49,41]],[[9343,9343],"disallowed_STD3_mapped",[40,49,50,41]],[[9344,9344],"disallowed_STD3_mapped",[40,49,51,41]],[[9345,9345],"disallowed_STD3_mapped",[40,49,52,41]],[[9346,9346],"disallowed_STD3_mapped",[40,49,53,41]],[[9347,9347],"disallowed_STD3_mapped",[40,49,54,41]],[[9348,9348],"disallowed_STD3_mapped",[40,49,55,41]],[[9349,9349],"disallowed_STD3_mapped",[40,49,56,41]],[[9350,9350],"disallowed_STD3_mapped",[40,49,57,41]],[[9351,9351],"disallowed_STD3_mapped",[40,50,48,41]],[[9352,9371],"disallowed"],[[9372,9372],"disallowed_STD3_mapped",[40,97,41]],[[9373,9373],"disallowed_STD3_mapped",[40,98,41]],[[9374,9374],"disallowed_STD3_mapped",[40,99,41]],[[9375,9375],"disallowed_STD3_mapped",[40,100,41]],[[9376,9376],"disallowed_STD3_mapped",[40,101,41]],[[9377,9377],"disallowed_STD3_mapped",[40,102,41]],[[9378,9378],"disallowed_STD3_mapped",[40,103,41]],[[9379,9379],"disallowed_STD3_mapped",[40,104,41]],[[9380,9380],"disallowed_STD3_mapped",[40,105,41]],[[9381,9381],"disallowed_STD3_mapped",[40,106,41]],[[9382,9382],"disallowed_STD3_mapped",[40,107,41]],[[9383,9383],"disallowed_STD3_mapped",[40,108,41]],[[9384,9384],"disallowed_STD3_mapped",[40,109,41]],[[9385,9385],"disallowed_STD3_mapped",[40,110,41]],[[9386,9386],"disallowed_STD3_mapped",[40,111,41]],[[9387,9387],"disallowed_STD3_mapped",[40,112,41]],[[9388,9388],"disallowed_STD3_mapped",[40,113,41]],[[9389,9389],"disallowed_STD3_mapped",[40,114,41]],[[9390,9390],"disallowed_STD3_mapped",[40,115,41]],[[9391,9391],"disallowed_STD3_mapped",[40,116,41]],[[9392,9392],"disallowed_STD3_mapped",[40,117,41]],[[9393,9393],"disallowed_STD3_mapped",[40,118,41]],[[9394,9394],"disallowed_STD3_mapped",[40,119,41]],[[9395,9395],"disallowed_STD3_mapped",[40,120,41]],[[9396,9396],"disallowed_STD3_mapped",[40,121,41]],[[9397,9397],"disallowed_STD3_mapped",[40,122,41]],[[9398,9398],"mapped",[97]],[[9399,9399],"mapped",[98]],[[9400,9400],"mapped",[99]],[[9401,9401],"mapped",[100]],[[9402,9402],"mapped",[101]],[[9403,9403],"mapped",[102]],[[9404,9404],"mapped",[103]],[[9405,9405],"mapped",[104]],[[9406,9406],"mapped",[105]],[[9407,9407],"mapped",[106]],[[9408,9408],"mapped",[107]],[[9409,9409],"mapped",[108]],[[9410,9410],"mapped",[109]],[[9411,9411],"mapped",[110]],[[9412,9412],"mapped",[111]],[[9413,9413],"mapped",[112]],[[9414,9414],"mapped",[113]],[[9415,9415],"mapped",[114]],[[9416,9416],"mapped",[115]],[[9417,9417],"mapped",[116]],[[9418,9418],"mapped",[117]],[[9419,9419],"mapped",[118]],[[9420,9420],"mapped",[119]],[[9421,9421],"mapped",[120]],[[9422,9422],"mapped",[121]],[[9423,9423],"mapped",[122]],[[9424,9424],"mapped",[97]],[[9425,9425],"mapped",[98]],[[9426,9426],"mapped",[99]],[[9427,9427],"mapped",[100]],[[9428,9428],"mapped",[101]],[[9429,9429],"mapped",[102]],[[9430,9430],"mapped",[103]],[[9431,9431],"mapped",[104]],[[9432,9432],"mapped",[105]],[[9433,9433],"mapped",[106]],[[9434,9434],"mapped",[107]],[[9435,9435],"mapped",[108]],[[9436,9436],"mapped",[109]],[[9437,9437],"mapped",[110]],[[9438,9438],"mapped",[111]],[[9439,9439],"mapped",[112]],[[9440,9440],"mapped",[113]],[[9441,9441],"mapped",[114]],[[9442,9442],"mapped",[115]],[[9443,9443],"mapped",[116]],[[9444,9444],"mapped",[117]],[[9445,9445],"mapped",[118]],[[9446,9446],"mapped",[119]],[[9447,9447],"mapped",[120]],[[9448,9448],"mapped",[121]],[[9449,9449],"mapped",[122]],[[9450,9450],"mapped",[48]],[[9451,9470],"valid",[],"NV8"],[[9471,9471],"valid",[],"NV8"],[[9472,9621],"valid",[],"NV8"],[[9622,9631],"valid",[],"NV8"],[[9632,9711],"valid",[],"NV8"],[[9712,9719],"valid",[],"NV8"],[[9720,9727],"valid",[],"NV8"],[[9728,9747],"valid",[],"NV8"],[[9748,9749],"valid",[],"NV8"],[[9750,9751],"valid",[],"NV8"],[[9752,9752],"valid",[],"NV8"],[[9753,9753],"valid",[],"NV8"],[[9754,9839],"valid",[],"NV8"],[[9840,9841],"valid",[],"NV8"],[[9842,9853],"valid",[],"NV8"],[[9854,9855],"valid",[],"NV8"],[[9856,9865],"valid",[],"NV8"],[[9866,9873],"valid",[],"NV8"],[[9874,9884],"valid",[],"NV8"],[[9885,9885],"valid",[],"NV8"],[[9886,9887],"valid",[],"NV8"],[[9888,9889],"valid",[],"NV8"],[[9890,9905],"valid",[],"NV8"],[[9906,9906],"valid",[],"NV8"],[[9907,9916],"valid",[],"NV8"],[[9917,9919],"valid",[],"NV8"],[[9920,9923],"valid",[],"NV8"],[[9924,9933],"valid",[],"NV8"],[[9934,9934],"valid",[],"NV8"],[[9935,9953],"valid",[],"NV8"],[[9954,9954],"valid",[],"NV8"],[[9955,9955],"valid",[],"NV8"],[[9956,9959],"valid",[],"NV8"],[[9960,9983],"valid",[],"NV8"],[[9984,9984],"valid",[],"NV8"],[[9985,9988],"valid",[],"NV8"],[[9989,9989],"valid",[],"NV8"],[[9990,9993],"valid",[],"NV8"],[[9994,9995],"valid",[],"NV8"],[[9996,10023],"valid",[],"NV8"],[[10024,10024],"valid",[],"NV8"],[[10025,10059],"valid",[],"NV8"],[[10060,10060],"valid",[],"NV8"],[[10061,10061],"valid",[],"NV8"],[[10062,10062],"valid",[],"NV8"],[[10063,10066],"valid",[],"NV8"],[[10067,10069],"valid",[],"NV8"],[[10070,10070],"valid",[],"NV8"],[[10071,10071],"valid",[],"NV8"],[[10072,10078],"valid",[],"NV8"],[[10079,10080],"valid",[],"NV8"],[[10081,10087],"valid",[],"NV8"],[[10088,10101],"valid",[],"NV8"],[[10102,10132],"valid",[],"NV8"],[[10133,10135],"valid",[],"NV8"],[[10136,10159],"valid",[],"NV8"],[[10160,10160],"valid",[],"NV8"],[[10161,10174],"valid",[],"NV8"],[[10175,10175],"valid",[],"NV8"],[[10176,10182],"valid",[],"NV8"],[[10183,10186],"valid",[],"NV8"],[[10187,10187],"valid",[],"NV8"],[[10188,10188],"valid",[],"NV8"],[[10189,10189],"valid",[],"NV8"],[[10190,10191],"valid",[],"NV8"],[[10192,10219],"valid",[],"NV8"],[[10220,10223],"valid",[],"NV8"],[[10224,10239],"valid",[],"NV8"],[[10240,10495],"valid",[],"NV8"],[[10496,10763],"valid",[],"NV8"],[[10764,10764],"mapped",[8747,8747,8747,8747]],[[10765,10867],"valid",[],"NV8"],[[10868,10868],"disallowed_STD3_mapped",[58,58,61]],[[10869,10869],"disallowed_STD3_mapped",[61,61]],[[10870,10870],"disallowed_STD3_mapped",[61,61,61]],[[10871,10971],"valid",[],"NV8"],[[10972,10972],"mapped",[10973,824]],[[10973,11007],"valid",[],"NV8"],[[11008,11021],"valid",[],"NV8"],[[11022,11027],"valid",[],"NV8"],[[11028,11034],"valid",[],"NV8"],[[11035,11039],"valid",[],"NV8"],[[11040,11043],"valid",[],"NV8"],[[11044,11084],"valid",[],"NV8"],[[11085,11087],"valid",[],"NV8"],[[11088,11092],"valid",[],"NV8"],[[11093,11097],"valid",[],"NV8"],[[11098,11123],"valid",[],"NV8"],[[11124,11125],"disallowed"],[[11126,11157],"valid",[],"NV8"],[[11158,11159],"disallowed"],[[11160,11193],"valid",[],"NV8"],[[11194,11196],"disallowed"],[[11197,11208],"valid",[],"NV8"],[[11209,11209],"disallowed"],[[11210,11217],"valid",[],"NV8"],[[11218,11243],"disallowed"],[[11244,11247],"valid",[],"NV8"],[[11248,11263],"disallowed"],[[11264,11264],"mapped",[11312]],[[11265,11265],"mapped",[11313]],[[11266,11266],"mapped",[11314]],[[11267,11267],"mapped",[11315]],[[11268,11268],"mapped",[11316]],[[11269,11269],"mapped",[11317]],[[11270,11270],"mapped",[11318]],[[11271,11271],"mapped",[11319]],[[11272,11272],"mapped",[11320]],[[11273,11273],"mapped",[11321]],[[11274,11274],"mapped",[11322]],[[11275,11275],"mapped",[11323]],[[11276,11276],"mapped",[11324]],[[11277,11277],"mapped",[11325]],[[11278,11278],"mapped",[11326]],[[11279,11279],"mapped",[11327]],[[11280,11280],"mapped",[11328]],[[11281,11281],"mapped",[11329]],[[11282,11282],"mapped",[11330]],[[11283,11283],"mapped",[11331]],[[11284,11284],"mapped",[11332]],[[11285,11285],"mapped",[11333]],[[11286,11286],"mapped",[11334]],[[11287,11287],"mapped",[11335]],[[11288,11288],"mapped",[11336]],[[11289,11289],"mapped",[11337]],[[11290,11290],"mapped",[11338]],[[11291,11291],"mapped",[11339]],[[11292,11292],"mapped",[11340]],[[11293,11293],"mapped",[11341]],[[11294,11294],"mapped",[11342]],[[11295,11295],"mapped",[11343]],[[11296,11296],"mapped",[11344]],[[11297,11297],"mapped",[11345]],[[11298,11298],"mapped",[11346]],[[11299,11299],"mapped",[11347]],[[11300,11300],"mapped",[11348]],[[11301,11301],"mapped",[11349]],[[11302,11302],"mapped",[11350]],[[11303,11303],"mapped",[11351]],[[11304,11304],"mapped",[11352]],[[11305,11305],"mapped",[11353]],[[11306,11306],"mapped",[11354]],[[11307,11307],"mapped",[11355]],[[11308,11308],"mapped",[11356]],[[11309,11309],"mapped",[11357]],[[11310,11310],"mapped",[11358]],[[11311,11311],"disallowed"],[[11312,11358],"valid"],[[11359,11359],"disallowed"],[[11360,11360],"mapped",[11361]],[[11361,11361],"valid"],[[11362,11362],"mapped",[619]],[[11363,11363],"mapped",[7549]],[[11364,11364],"mapped",[637]],[[11365,11366],"valid"],[[11367,11367],"mapped",[11368]],[[11368,11368],"valid"],[[11369,11369],"mapped",[11370]],[[11370,11370],"valid"],[[11371,11371],"mapped",[11372]],[[11372,11372],"valid"],[[11373,11373],"mapped",[593]],[[11374,11374],"mapped",[625]],[[11375,11375],"mapped",[592]],[[11376,11376],"mapped",[594]],[[11377,11377],"valid"],[[11378,11378],"mapped",[11379]],[[11379,11379],"valid"],[[11380,11380],"valid"],[[11381,11381],"mapped",[11382]],[[11382,11383],"valid"],[[11384,11387],"valid"],[[11388,11388],"mapped",[106]],[[11389,11389],"mapped",[118]],[[11390,11390],"mapped",[575]],[[11391,11391],"mapped",[576]],[[11392,11392],"mapped",[11393]],[[11393,11393],"valid"],[[11394,11394],"mapped",[11395]],[[11395,11395],"valid"],[[11396,11396],"mapped",[11397]],[[11397,11397],"valid"],[[11398,11398],"mapped",[11399]],[[11399,11399],"valid"],[[11400,11400],"mapped",[11401]],[[11401,11401],"valid"],[[11402,11402],"mapped",[11403]],[[11403,11403],"valid"],[[11404,11404],"mapped",[11405]],[[11405,11405],"valid"],[[11406,11406],"mapped",[11407]],[[11407,11407],"valid"],[[11408,11408],"mapped",[11409]],[[11409,11409],"valid"],[[11410,11410],"mapped",[11411]],[[11411,11411],"valid"],[[11412,11412],"mapped",[11413]],[[11413,11413],"valid"],[[11414,11414],"mapped",[11415]],[[11415,11415],"valid"],[[11416,11416],"mapped",[11417]],[[11417,11417],"valid"],[[11418,11418],"mapped",[11419]],[[11419,11419],"valid"],[[11420,11420],"mapped",[11421]],[[11421,11421],"valid"],[[11422,11422],"mapped",[11423]],[[11423,11423],"valid"],[[11424,11424],"mapped",[11425]],[[11425,11425],"valid"],[[11426,11426],"mapped",[11427]],[[11427,11427],"valid"],[[11428,11428],"mapped",[11429]],[[11429,11429],"valid"],[[11430,11430],"mapped",[11431]],[[11431,11431],"valid"],[[11432,11432],"mapped",[11433]],[[11433,11433],"valid"],[[11434,11434],"mapped",[11435]],[[11435,11435],"valid"],[[11436,11436],"mapped",[11437]],[[11437,11437],"valid"],[[11438,11438],"mapped",[11439]],[[11439,11439],"valid"],[[11440,11440],"mapped",[11441]],[[11441,11441],"valid"],[[11442,11442],"mapped",[11443]],[[11443,11443],"valid"],[[11444,11444],"mapped",[11445]],[[11445,11445],"valid"],[[11446,11446],"mapped",[11447]],[[11447,11447],"valid"],[[11448,11448],"mapped",[11449]],[[11449,11449],"valid"],[[11450,11450],"mapped",[11451]],[[11451,11451],"valid"],[[11452,11452],"mapped",[11453]],[[11453,11453],"valid"],[[11454,11454],"mapped",[11455]],[[11455,11455],"valid"],[[11456,11456],"mapped",[11457]],[[11457,11457],"valid"],[[11458,11458],"mapped",[11459]],[[11459,11459],"valid"],[[11460,11460],"mapped",[11461]],[[11461,11461],"valid"],[[11462,11462],"mapped",[11463]],[[11463,11463],"valid"],[[11464,11464],"mapped",[11465]],[[11465,11465],"valid"],[[11466,11466],"mapped",[11467]],[[11467,11467],"valid"],[[11468,11468],"mapped",[11469]],[[11469,11469],"valid"],[[11470,11470],"mapped",[11471]],[[11471,11471],"valid"],[[11472,11472],"mapped",[11473]],[[11473,11473],"valid"],[[11474,11474],"mapped",[11475]],[[11475,11475],"valid"],[[11476,11476],"mapped",[11477]],[[11477,11477],"valid"],[[11478,11478],"mapped",[11479]],[[11479,11479],"valid"],[[11480,11480],"mapped",[11481]],[[11481,11481],"valid"],[[11482,11482],"mapped",[11483]],[[11483,11483],"valid"],[[11484,11484],"mapped",[11485]],[[11485,11485],"valid"],[[11486,11486],"mapped",[11487]],[[11487,11487],"valid"],[[11488,11488],"mapped",[11489]],[[11489,11489],"valid"],[[11490,11490],"mapped",[11491]],[[11491,11492],"valid"],[[11493,11498],"valid",[],"NV8"],[[11499,11499],"mapped",[11500]],[[11500,11500],"valid"],[[11501,11501],"mapped",[11502]],[[11502,11505],"valid"],[[11506,11506],"mapped",[11507]],[[11507,11507],"valid"],[[11508,11512],"disallowed"],[[11513,11519],"valid",[],"NV8"],[[11520,11557],"valid"],[[11558,11558],"disallowed"],[[11559,11559],"valid"],[[11560,11564],"disallowed"],[[11565,11565],"valid"],[[11566,11567],"disallowed"],[[11568,11621],"valid"],[[11622,11623],"valid"],[[11624,11630],"disallowed"],[[11631,11631],"mapped",[11617]],[[11632,11632],"valid",[],"NV8"],[[11633,11646],"disallowed"],[[11647,11647],"valid"],[[11648,11670],"valid"],[[11671,11679],"disallowed"],[[11680,11686],"valid"],[[11687,11687],"disallowed"],[[11688,11694],"valid"],[[11695,11695],"disallowed"],[[11696,11702],"valid"],[[11703,11703],"disallowed"],[[11704,11710],"valid"],[[11711,11711],"disallowed"],[[11712,11718],"valid"],[[11719,11719],"disallowed"],[[11720,11726],"valid"],[[11727,11727],"disallowed"],[[11728,11734],"valid"],[[11735,11735],"disallowed"],[[11736,11742],"valid"],[[11743,11743],"disallowed"],[[11744,11775],"valid"],[[11776,11799],"valid",[],"NV8"],[[11800,11803],"valid",[],"NV8"],[[11804,11805],"valid",[],"NV8"],[[11806,11822],"valid",[],"NV8"],[[11823,11823],"valid"],[[11824,11824],"valid",[],"NV8"],[[11825,11825],"valid",[],"NV8"],[[11826,11835],"valid",[],"NV8"],[[11836,11842],"valid",[],"NV8"],[[11843,11903],"disallowed"],[[11904,11929],"valid",[],"NV8"],[[11930,11930],"disallowed"],[[11931,11934],"valid",[],"NV8"],[[11935,11935],"mapped",[27597]],[[11936,12018],"valid",[],"NV8"],[[12019,12019],"mapped",[40863]],[[12020,12031],"disallowed"],[[12032,12032],"mapped",[19968]],[[12033,12033],"mapped",[20008]],[[12034,12034],"mapped",[20022]],[[12035,12035],"mapped",[20031]],[[12036,12036],"mapped",[20057]],[[12037,12037],"mapped",[20101]],[[12038,12038],"mapped",[20108]],[[12039,12039],"mapped",[20128]],[[12040,12040],"mapped",[20154]],[[12041,12041],"mapped",[20799]],[[12042,12042],"mapped",[20837]],[[12043,12043],"mapped",[20843]],[[12044,12044],"mapped",[20866]],[[12045,12045],"mapped",[20886]],[[12046,12046],"mapped",[20907]],[[12047,12047],"mapped",[20960]],[[12048,12048],"mapped",[20981]],[[12049,12049],"mapped",[20992]],[[12050,12050],"mapped",[21147]],[[12051,12051],"mapped",[21241]],[[12052,12052],"mapped",[21269]],[[12053,12053],"mapped",[21274]],[[12054,12054],"mapped",[21304]],[[12055,12055],"mapped",[21313]],[[12056,12056],"mapped",[21340]],[[12057,12057],"mapped",[21353]],[[12058,12058],"mapped",[21378]],[[12059,12059],"mapped",[21430]],[[12060,12060],"mapped",[21448]],[[12061,12061],"mapped",[21475]],[[12062,12062],"mapped",[22231]],[[12063,12063],"mapped",[22303]],[[12064,12064],"mapped",[22763]],[[12065,12065],"mapped",[22786]],[[12066,12066],"mapped",[22794]],[[12067,12067],"mapped",[22805]],[[12068,12068],"mapped",[22823]],[[12069,12069],"mapped",[22899]],[[12070,12070],"mapped",[23376]],[[12071,12071],"mapped",[23424]],[[12072,12072],"mapped",[23544]],[[12073,12073],"mapped",[23567]],[[12074,12074],"mapped",[23586]],[[12075,12075],"mapped",[23608]],[[12076,12076],"mapped",[23662]],[[12077,12077],"mapped",[23665]],[[12078,12078],"mapped",[24027]],[[12079,12079],"mapped",[24037]],[[12080,12080],"mapped",[24049]],[[12081,12081],"mapped",[24062]],[[12082,12082],"mapped",[24178]],[[12083,12083],"mapped",[24186]],[[12084,12084],"mapped",[24191]],[[12085,12085],"mapped",[24308]],[[12086,12086],"mapped",[24318]],[[12087,12087],"mapped",[24331]],[[12088,12088],"mapped",[24339]],[[12089,12089],"mapped",[24400]],[[12090,12090],"mapped",[24417]],[[12091,12091],"mapped",[24435]],[[12092,12092],"mapped",[24515]],[[12093,12093],"mapped",[25096]],[[12094,12094],"mapped",[25142]],[[12095,12095],"mapped",[25163]],[[12096,12096],"mapped",[25903]],[[12097,12097],"mapped",[25908]],[[12098,12098],"mapped",[25991]],[[12099,12099],"mapped",[26007]],[[12100,12100],"mapped",[26020]],[[12101,12101],"mapped",[26041]],[[12102,12102],"mapped",[26080]],[[12103,12103],"mapped",[26085]],[[12104,12104],"mapped",[26352]],[[12105,12105],"mapped",[26376]],[[12106,12106],"mapped",[26408]],[[12107,12107],"mapped",[27424]],[[12108,12108],"mapped",[27490]],[[12109,12109],"mapped",[27513]],[[12110,12110],"mapped",[27571]],[[12111,12111],"mapped",[27595]],[[12112,12112],"mapped",[27604]],[[12113,12113],"mapped",[27611]],[[12114,12114],"mapped",[27663]],[[12115,12115],"mapped",[27668]],[[12116,12116],"mapped",[27700]],[[12117,12117],"mapped",[28779]],[[12118,12118],"mapped",[29226]],[[12119,12119],"mapped",[29238]],[[12120,12120],"mapped",[29243]],[[12121,12121],"mapped",[29247]],[[12122,12122],"mapped",[29255]],[[12123,12123],"mapped",[29273]],[[12124,12124],"mapped",[29275]],[[12125,12125],"mapped",[29356]],[[12126,12126],"mapped",[29572]],[[12127,12127],"mapped",[29577]],[[12128,12128],"mapped",[29916]],[[12129,12129],"mapped",[29926]],[[12130,12130],"mapped",[29976]],[[12131,12131],"mapped",[29983]],[[12132,12132],"mapped",[29992]],[[12133,12133],"mapped",[30000]],[[12134,12134],"mapped",[30091]],[[12135,12135],"mapped",[30098]],[[12136,12136],"mapped",[30326]],[[12137,12137],"mapped",[30333]],[[12138,12138],"mapped",[30382]],[[12139,12139],"mapped",[30399]],[[12140,12140],"mapped",[30446]],[[12141,12141],"mapped",[30683]],[[12142,12142],"mapped",[30690]],[[12143,12143],"mapped",[30707]],[[12144,12144],"mapped",[31034]],[[12145,12145],"mapped",[31160]],[[12146,12146],"mapped",[31166]],[[12147,12147],"mapped",[31348]],[[12148,12148],"mapped",[31435]],[[12149,12149],"mapped",[31481]],[[12150,12150],"mapped",[31859]],[[12151,12151],"mapped",[31992]],[[12152,12152],"mapped",[32566]],[[12153,12153],"mapped",[32593]],[[12154,12154],"mapped",[32650]],[[12155,12155],"mapped",[32701]],[[12156,12156],"mapped",[32769]],[[12157,12157],"mapped",[32780]],[[12158,12158],"mapped",[32786]],[[12159,12159],"mapped",[32819]],[[12160,12160],"mapped",[32895]],[[12161,12161],"mapped",[32905]],[[12162,12162],"mapped",[33251]],[[12163,12163],"mapped",[33258]],[[12164,12164],"mapped",[33267]],[[12165,12165],"mapped",[33276]],[[12166,12166],"mapped",[33292]],[[12167,12167],"mapped",[33307]],[[12168,12168],"mapped",[33311]],[[12169,12169],"mapped",[33390]],[[12170,12170],"mapped",[33394]],[[12171,12171],"mapped",[33400]],[[12172,12172],"mapped",[34381]],[[12173,12173],"mapped",[34411]],[[12174,12174],"mapped",[34880]],[[12175,12175],"mapped",[34892]],[[12176,12176],"mapped",[34915]],[[12177,12177],"mapped",[35198]],[[12178,12178],"mapped",[35211]],[[12179,12179],"mapped",[35282]],[[12180,12180],"mapped",[35328]],[[12181,12181],"mapped",[35895]],[[12182,12182],"mapped",[35910]],[[12183,12183],"mapped",[35925]],[[12184,12184],"mapped",[35960]],[[12185,12185],"mapped",[35997]],[[12186,12186],"mapped",[36196]],[[12187,12187],"mapped",[36208]],[[12188,12188],"mapped",[36275]],[[12189,12189],"mapped",[36523]],[[12190,12190],"mapped",[36554]],[[12191,12191],"mapped",[36763]],[[12192,12192],"mapped",[36784]],[[12193,12193],"mapped",[36789]],[[12194,12194],"mapped",[37009]],[[12195,12195],"mapped",[37193]],[[12196,12196],"mapped",[37318]],[[12197,12197],"mapped",[37324]],[[12198,12198],"mapped",[37329]],[[12199,12199],"mapped",[38263]],[[12200,12200],"mapped",[38272]],[[12201,12201],"mapped",[38428]],[[12202,12202],"mapped",[38582]],[[12203,12203],"mapped",[38585]],[[12204,12204],"mapped",[38632]],[[12205,12205],"mapped",[38737]],[[12206,12206],"mapped",[38750]],[[12207,12207],"mapped",[38754]],[[12208,12208],"mapped",[38761]],[[12209,12209],"mapped",[38859]],[[12210,12210],"mapped",[38893]],[[12211,12211],"mapped",[38899]],[[12212,12212],"mapped",[38913]],[[12213,12213],"mapped",[39080]],[[12214,12214],"mapped",[39131]],[[12215,12215],"mapped",[39135]],[[12216,12216],"mapped",[39318]],[[12217,12217],"mapped",[39321]],[[12218,12218],"mapped",[39340]],[[12219,12219],"mapped",[39592]],[[12220,12220],"mapped",[39640]],[[12221,12221],"mapped",[39647]],[[12222,12222],"mapped",[39717]],[[12223,12223],"mapped",[39727]],[[12224,12224],"mapped",[39730]],[[12225,12225],"mapped",[39740]],[[12226,12226],"mapped",[39770]],[[12227,12227],"mapped",[40165]],[[12228,12228],"mapped",[40565]],[[12229,12229],"mapped",[40575]],[[12230,12230],"mapped",[40613]],[[12231,12231],"mapped",[40635]],[[12232,12232],"mapped",[40643]],[[12233,12233],"mapped",[40653]],[[12234,12234],"mapped",[40657]],[[12235,12235],"mapped",[40697]],[[12236,12236],"mapped",[40701]],[[12237,12237],"mapped",[40718]],[[12238,12238],"mapped",[40723]],[[12239,12239],"mapped",[40736]],[[12240,12240],"mapped",[40763]],[[12241,12241],"mapped",[40778]],[[12242,12242],"mapped",[40786]],[[12243,12243],"mapped",[40845]],[[12244,12244],"mapped",[40860]],[[12245,12245],"mapped",[40864]],[[12246,12271],"disallowed"],[[12272,12283],"disallowed"],[[12284,12287],"disallowed"],[[12288,12288],"disallowed_STD3_mapped",[32]],[[12289,12289],"valid",[],"NV8"],[[12290,12290],"mapped",[46]],[[12291,12292],"valid",[],"NV8"],[[12293,12295],"valid"],[[12296,12329],"valid",[],"NV8"],[[12330,12333],"valid"],[[12334,12341],"valid",[],"NV8"],[[12342,12342],"mapped",[12306]],[[12343,12343],"valid",[],"NV8"],[[12344,12344],"mapped",[21313]],[[12345,12345],"mapped",[21316]],[[12346,12346],"mapped",[21317]],[[12347,12347],"valid",[],"NV8"],[[12348,12348],"valid"],[[12349,12349],"valid",[],"NV8"],[[12350,12350],"valid",[],"NV8"],[[12351,12351],"valid",[],"NV8"],[[12352,12352],"disallowed"],[[12353,12436],"valid"],[[12437,12438],"valid"],[[12439,12440],"disallowed"],[[12441,12442],"valid"],[[12443,12443],"disallowed_STD3_mapped",[32,12441]],[[12444,12444],"disallowed_STD3_mapped",[32,12442]],[[12445,12446],"valid"],[[12447,12447],"mapped",[12424,12426]],[[12448,12448],"valid",[],"NV8"],[[12449,12542],"valid"],[[12543,12543],"mapped",[12467,12488]],[[12544,12548],"disallowed"],[[12549,12588],"valid"],[[12589,12589],"valid"],[[12590,12592],"disallowed"],[[12593,12593],"mapped",[4352]],[[12594,12594],"mapped",[4353]],[[12595,12595],"mapped",[4522]],[[12596,12596],"mapped",[4354]],[[12597,12597],"mapped",[4524]],[[12598,12598],"mapped",[4525]],[[12599,12599],"mapped",[4355]],[[12600,12600],"mapped",[4356]],[[12601,12601],"mapped",[4357]],[[12602,12602],"mapped",[4528]],[[12603,12603],"mapped",[4529]],[[12604,12604],"mapped",[4530]],[[12605,12605],"mapped",[4531]],[[12606,12606],"mapped",[4532]],[[12607,12607],"mapped",[4533]],[[12608,12608],"mapped",[4378]],[[12609,12609],"mapped",[4358]],[[12610,12610],"mapped",[4359]],[[12611,12611],"mapped",[4360]],[[12612,12612],"mapped",[4385]],[[12613,12613],"mapped",[4361]],[[12614,12614],"mapped",[4362]],[[12615,12615],"mapped",[4363]],[[12616,12616],"mapped",[4364]],[[12617,12617],"mapped",[4365]],[[12618,12618],"mapped",[4366]],[[12619,12619],"mapped",[4367]],[[12620,12620],"mapped",[4368]],[[12621,12621],"mapped",[4369]],[[12622,12622],"mapped",[4370]],[[12623,12623],"mapped",[4449]],[[12624,12624],"mapped",[4450]],[[12625,12625],"mapped",[4451]],[[12626,12626],"mapped",[4452]],[[12627,12627],"mapped",[4453]],[[12628,12628],"mapped",[4454]],[[12629,12629],"mapped",[4455]],[[12630,12630],"mapped",[4456]],[[12631,12631],"mapped",[4457]],[[12632,12632],"mapped",[4458]],[[12633,12633],"mapped",[4459]],[[12634,12634],"mapped",[4460]],[[12635,12635],"mapped",[4461]],[[12636,12636],"mapped",[4462]],[[12637,12637],"mapped",[4463]],[[12638,12638],"mapped",[4464]],[[12639,12639],"mapped",[4465]],[[12640,12640],"mapped",[4466]],[[12641,12641],"mapped",[4467]],[[12642,12642],"mapped",[4468]],[[12643,12643],"mapped",[4469]],[[12644,12644],"disallowed"],[[12645,12645],"mapped",[4372]],[[12646,12646],"mapped",[4373]],[[12647,12647],"mapped",[4551]],[[12648,12648],"mapped",[4552]],[[12649,12649],"mapped",[4556]],[[12650,12650],"mapped",[4558]],[[12651,12651],"mapped",[4563]],[[12652,12652],"mapped",[4567]],[[12653,12653],"mapped",[4569]],[[12654,12654],"mapped",[4380]],[[12655,12655],"mapped",[4573]],[[12656,12656],"mapped",[4575]],[[12657,12657],"mapped",[4381]],[[12658,12658],"mapped",[4382]],[[12659,12659],"mapped",[4384]],[[12660,12660],"mapped",[4386]],[[12661,12661],"mapped",[4387]],[[12662,12662],"mapped",[4391]],[[12663,12663],"mapped",[4393]],[[12664,12664],"mapped",[4395]],[[12665,12665],"mapped",[4396]],[[12666,12666],"mapped",[4397]],[[12667,12667],"mapped",[4398]],[[12668,12668],"mapped",[4399]],[[12669,12669],"mapped",[4402]],[[12670,12670],"mapped",[4406]],[[12671,12671],"mapped",[4416]],[[12672,12672],"mapped",[4423]],[[12673,12673],"mapped",[4428]],[[12674,12674],"mapped",[4593]],[[12675,12675],"mapped",[4594]],[[12676,12676],"mapped",[4439]],[[12677,12677],"mapped",[4440]],[[12678,12678],"mapped",[4441]],[[12679,12679],"mapped",[4484]],[[12680,12680],"mapped",[4485]],[[12681,12681],"mapped",[4488]],[[12682,12682],"mapped",[4497]],[[12683,12683],"mapped",[4498]],[[12684,12684],"mapped",[4500]],[[12685,12685],"mapped",[4510]],[[12686,12686],"mapped",[4513]],[[12687,12687],"disallowed"],[[12688,12689],"valid",[],"NV8"],[[12690,12690],"mapped",[19968]],[[12691,12691],"mapped",[20108]],[[12692,12692],"mapped",[19977]],[[12693,12693],"mapped",[22235]],[[12694,12694],"mapped",[19978]],[[12695,12695],"mapped",[20013]],[[12696,12696],"mapped",[19979]],[[12697,12697],"mapped",[30002]],[[12698,12698],"mapped",[20057]],[[12699,12699],"mapped",[19993]],[[12700,12700],"mapped",[19969]],[[12701,12701],"mapped",[22825]],[[12702,12702],"mapped",[22320]],[[12703,12703],"mapped",[20154]],[[12704,12727],"valid"],[[12728,12730],"valid"],[[12731,12735],"disallowed"],[[12736,12751],"valid",[],"NV8"],[[12752,12771],"valid",[],"NV8"],[[12772,12783],"disallowed"],[[12784,12799],"valid"],[[12800,12800],"disallowed_STD3_mapped",[40,4352,41]],[[12801,12801],"disallowed_STD3_mapped",[40,4354,41]],[[12802,12802],"disallowed_STD3_mapped",[40,4355,41]],[[12803,12803],"disallowed_STD3_mapped",[40,4357,41]],[[12804,12804],"disallowed_STD3_mapped",[40,4358,41]],[[12805,12805],"disallowed_STD3_mapped",[40,4359,41]],[[12806,12806],"disallowed_STD3_mapped",[40,4361,41]],[[12807,12807],"disallowed_STD3_mapped",[40,4363,41]],[[12808,12808],"disallowed_STD3_mapped",[40,4364,41]],[[12809,12809],"disallowed_STD3_mapped",[40,4366,41]],[[12810,12810],"disallowed_STD3_mapped",[40,4367,41]],[[12811,12811],"disallowed_STD3_mapped",[40,4368,41]],[[12812,12812],"disallowed_STD3_mapped",[40,4369,41]],[[12813,12813],"disallowed_STD3_mapped",[40,4370,41]],[[12814,12814],"disallowed_STD3_mapped",[40,44032,41]],[[12815,12815],"disallowed_STD3_mapped",[40,45208,41]],[[12816,12816],"disallowed_STD3_mapped",[40,45796,41]],[[12817,12817],"disallowed_STD3_mapped",[40,46972,41]],[[12818,12818],"disallowed_STD3_mapped",[40,47560,41]],[[12819,12819],"disallowed_STD3_mapped",[40,48148,41]],[[12820,12820],"disallowed_STD3_mapped",[40,49324,41]],[[12821,12821],"disallowed_STD3_mapped",[40,50500,41]],[[12822,12822],"disallowed_STD3_mapped",[40,51088,41]],[[12823,12823],"disallowed_STD3_mapped",[40,52264,41]],[[12824,12824],"disallowed_STD3_mapped",[40,52852,41]],[[12825,12825],"disallowed_STD3_mapped",[40,53440,41]],[[12826,12826],"disallowed_STD3_mapped",[40,54028,41]],[[12827,12827],"disallowed_STD3_mapped",[40,54616,41]],[[12828,12828],"disallowed_STD3_mapped",[40,51452,41]],[[12829,12829],"disallowed_STD3_mapped",[40,50724,51204,41]],[[12830,12830],"disallowed_STD3_mapped",[40,50724,54980,41]],[[12831,12831],"disallowed"],[[12832,12832],"disallowed_STD3_mapped",[40,19968,41]],[[12833,12833],"disallowed_STD3_mapped",[40,20108,41]],[[12834,12834],"disallowed_STD3_mapped",[40,19977,41]],[[12835,12835],"disallowed_STD3_mapped",[40,22235,41]],[[12836,12836],"disallowed_STD3_mapped",[40,20116,41]],[[12837,12837],"disallowed_STD3_mapped",[40,20845,41]],[[12838,12838],"disallowed_STD3_mapped",[40,19971,41]],[[12839,12839],"disallowed_STD3_mapped",[40,20843,41]],[[12840,12840],"disallowed_STD3_mapped",[40,20061,41]],[[12841,12841],"disallowed_STD3_mapped",[40,21313,41]],[[12842,12842],"disallowed_STD3_mapped",[40,26376,41]],[[12843,12843],"disallowed_STD3_mapped",[40,28779,41]],[[12844,12844],"disallowed_STD3_mapped",[40,27700,41]],[[12845,12845],"disallowed_STD3_mapped",[40,26408,41]],[[12846,12846],"disallowed_STD3_mapped",[40,37329,41]],[[12847,12847],"disallowed_STD3_mapped",[40,22303,41]],[[12848,12848],"disallowed_STD3_mapped",[40,26085,41]],[[12849,12849],"disallowed_STD3_mapped",[40,26666,41]],[[12850,12850],"disallowed_STD3_mapped",[40,26377,41]],[[12851,12851],"disallowed_STD3_mapped",[40,31038,41]],[[12852,12852],"disallowed_STD3_mapped",[40,21517,41]],[[12853,12853],"disallowed_STD3_mapped",[40,29305,41]],[[12854,12854],"disallowed_STD3_mapped",[40,36001,41]],[[12855,12855],"disallowed_STD3_mapped",[40,31069,41]],[[12856,12856],"disallowed_STD3_mapped",[40,21172,41]],[[12857,12857],"disallowed_STD3_mapped",[40,20195,41]],[[12858,12858],"disallowed_STD3_mapped",[40,21628,41]],[[12859,12859],"disallowed_STD3_mapped",[40,23398,41]],[[12860,12860],"disallowed_STD3_mapped",[40,30435,41]],[[12861,12861],"disallowed_STD3_mapped",[40,20225,41]],[[12862,12862],"disallowed_STD3_mapped",[40,36039,41]],[[12863,12863],"disallowed_STD3_mapped",[40,21332,41]],[[12864,12864],"disallowed_STD3_mapped",[40,31085,41]],[[12865,12865],"disallowed_STD3_mapped",[40,20241,41]],[[12866,12866],"disallowed_STD3_mapped",[40,33258,41]],[[12867,12867],"disallowed_STD3_mapped",[40,33267,41]],[[12868,12868],"mapped",[21839]],[[12869,12869],"mapped",[24188]],[[12870,12870],"mapped",[25991]],[[12871,12871],"mapped",[31631]],[[12872,12879],"valid",[],"NV8"],[[12880,12880],"mapped",[112,116,101]],[[12881,12881],"mapped",[50,49]],[[12882,12882],"mapped",[50,50]],[[12883,12883],"mapped",[50,51]],[[12884,12884],"mapped",[50,52]],[[12885,12885],"mapped",[50,53]],[[12886,12886],"mapped",[50,54]],[[12887,12887],"mapped",[50,55]],[[12888,12888],"mapped",[50,56]],[[12889,12889],"mapped",[50,57]],[[12890,12890],"mapped",[51,48]],[[12891,12891],"mapped",[51,49]],[[12892,12892],"mapped",[51,50]],[[12893,12893],"mapped",[51,51]],[[12894,12894],"mapped",[51,52]],[[12895,12895],"mapped",[51,53]],[[12896,12896],"mapped",[4352]],[[12897,12897],"mapped",[4354]],[[12898,12898],"mapped",[4355]],[[12899,12899],"mapped",[4357]],[[12900,12900],"mapped",[4358]],[[12901,12901],"mapped",[4359]],[[12902,12902],"mapped",[4361]],[[12903,12903],"mapped",[4363]],[[12904,12904],"mapped",[4364]],[[12905,12905],"mapped",[4366]],[[12906,12906],"mapped",[4367]],[[12907,12907],"mapped",[4368]],[[12908,12908],"mapped",[4369]],[[12909,12909],"mapped",[4370]],[[12910,12910],"mapped",[44032]],[[12911,12911],"mapped",[45208]],[[12912,12912],"mapped",[45796]],[[12913,12913],"mapped",[46972]],[[12914,12914],"mapped",[47560]],[[12915,12915],"mapped",[48148]],[[12916,12916],"mapped",[49324]],[[12917,12917],"mapped",[50500]],[[12918,12918],"mapped",[51088]],[[12919,12919],"mapped",[52264]],[[12920,12920],"mapped",[52852]],[[12921,12921],"mapped",[53440]],[[12922,12922],"mapped",[54028]],[[12923,12923],"mapped",[54616]],[[12924,12924],"mapped",[52280,44256]],[[12925,12925],"mapped",[51452,51032]],[[12926,12926],"mapped",[50864]],[[12927,12927],"valid",[],"NV8"],[[12928,12928],"mapped",[19968]],[[12929,12929],"mapped",[20108]],[[12930,12930],"mapped",[19977]],[[12931,12931],"mapped",[22235]],[[12932,12932],"mapped",[20116]],[[12933,12933],"mapped",[20845]],[[12934,12934],"mapped",[19971]],[[12935,12935],"mapped",[20843]],[[12936,12936],"mapped",[20061]],[[12937,12937],"mapped",[21313]],[[12938,12938],"mapped",[26376]],[[12939,12939],"mapped",[28779]],[[12940,12940],"mapped",[27700]],[[12941,12941],"mapped",[26408]],[[12942,12942],"mapped",[37329]],[[12943,12943],"mapped",[22303]],[[12944,12944],"mapped",[26085]],[[12945,12945],"mapped",[26666]],[[12946,12946],"mapped",[26377]],[[12947,12947],"mapped",[31038]],[[12948,12948],"mapped",[21517]],[[12949,12949],"mapped",[29305]],[[12950,12950],"mapped",[36001]],[[12951,12951],"mapped",[31069]],[[12952,12952],"mapped",[21172]],[[12953,12953],"mapped",[31192]],[[12954,12954],"mapped",[30007]],[[12955,12955],"mapped",[22899]],[[12956,12956],"mapped",[36969]],[[12957,12957],"mapped",[20778]],[[12958,12958],"mapped",[21360]],[[12959,12959],"mapped",[27880]],[[12960,12960],"mapped",[38917]],[[12961,12961],"mapped",[20241]],[[12962,12962],"mapped",[20889]],[[12963,12963],"mapped",[27491]],[[12964,12964],"mapped",[19978]],[[12965,12965],"mapped",[20013]],[[12966,12966],"mapped",[19979]],[[12967,12967],"mapped",[24038]],[[12968,12968],"mapped",[21491]],[[12969,12969],"mapped",[21307]],[[12970,12970],"mapped",[23447]],[[12971,12971],"mapped",[23398]],[[12972,12972],"mapped",[30435]],[[12973,12973],"mapped",[20225]],[[12974,12974],"mapped",[36039]],[[12975,12975],"mapped",[21332]],[[12976,12976],"mapped",[22812]],[[12977,12977],"mapped",[51,54]],[[12978,12978],"mapped",[51,55]],[[12979,12979],"mapped",[51,56]],[[12980,12980],"mapped",[51,57]],[[12981,12981],"mapped",[52,48]],[[12982,12982],"mapped",[52,49]],[[12983,12983],"mapped",[52,50]],[[12984,12984],"mapped",[52,51]],[[12985,12985],"mapped",[52,52]],[[12986,12986],"mapped",[52,53]],[[12987,12987],"mapped",[52,54]],[[12988,12988],"mapped",[52,55]],[[12989,12989],"mapped",[52,56]],[[12990,12990],"mapped",[52,57]],[[12991,12991],"mapped",[53,48]],[[12992,12992],"mapped",[49,26376]],[[12993,12993],"mapped",[50,26376]],[[12994,12994],"mapped",[51,26376]],[[12995,12995],"mapped",[52,26376]],[[12996,12996],"mapped",[53,26376]],[[12997,12997],"mapped",[54,26376]],[[12998,12998],"mapped",[55,26376]],[[12999,12999],"mapped",[56,26376]],[[13000,13000],"mapped",[57,26376]],[[13001,13001],"mapped",[49,48,26376]],[[13002,13002],"mapped",[49,49,26376]],[[13003,13003],"mapped",[49,50,26376]],[[13004,13004],"mapped",[104,103]],[[13005,13005],"mapped",[101,114,103]],[[13006,13006],"mapped",[101,118]],[[13007,13007],"mapped",[108,116,100]],[[13008,13008],"mapped",[12450]],[[13009,13009],"mapped",[12452]],[[13010,13010],"mapped",[12454]],[[13011,13011],"mapped",[12456]],[[13012,13012],"mapped",[12458]],[[13013,13013],"mapped",[12459]],[[13014,13014],"mapped",[12461]],[[13015,13015],"mapped",[12463]],[[13016,13016],"mapped",[12465]],[[13017,13017],"mapped",[12467]],[[13018,13018],"mapped",[12469]],[[13019,13019],"mapped",[12471]],[[13020,13020],"mapped",[12473]],[[13021,13021],"mapped",[12475]],[[13022,13022],"mapped",[12477]],[[13023,13023],"mapped",[12479]],[[13024,13024],"mapped",[12481]],[[13025,13025],"mapped",[12484]],[[13026,13026],"mapped",[12486]],[[13027,13027],"mapped",[12488]],[[13028,13028],"mapped",[12490]],[[13029,13029],"mapped",[12491]],[[13030,13030],"mapped",[12492]],[[13031,13031],"mapped",[12493]],[[13032,13032],"mapped",[12494]],[[13033,13033],"mapped",[12495]],[[13034,13034],"mapped",[12498]],[[13035,13035],"mapped",[12501]],[[13036,13036],"mapped",[12504]],[[13037,13037],"mapped",[12507]],[[13038,13038],"mapped",[12510]],[[13039,13039],"mapped",[12511]],[[13040,13040],"mapped",[12512]],[[13041,13041],"mapped",[12513]],[[13042,13042],"mapped",[12514]],[[13043,13043],"mapped",[12516]],[[13044,13044],"mapped",[12518]],[[13045,13045],"mapped",[12520]],[[13046,13046],"mapped",[12521]],[[13047,13047],"mapped",[12522]],[[13048,13048],"mapped",[12523]],[[13049,13049],"mapped",[12524]],[[13050,13050],"mapped",[12525]],[[13051,13051],"mapped",[12527]],[[13052,13052],"mapped",[12528]],[[13053,13053],"mapped",[12529]],[[13054,13054],"mapped",[12530]],[[13055,13055],"disallowed"],[[13056,13056],"mapped",[12450,12497,12540,12488]],[[13057,13057],"mapped",[12450,12523,12501,12449]],[[13058,13058],"mapped",[12450,12531,12506,12450]],[[13059,13059],"mapped",[12450,12540,12523]],[[13060,13060],"mapped",[12452,12491,12531,12464]],[[13061,13061],"mapped",[12452,12531,12481]],[[13062,13062],"mapped",[12454,12457,12531]],[[13063,13063],"mapped",[12456,12473,12463,12540,12489]],[[13064,13064],"mapped",[12456,12540,12459,12540]],[[13065,13065],"mapped",[12458,12531,12473]],[[13066,13066],"mapped",[12458,12540,12512]],[[13067,13067],"mapped",[12459,12452,12522]],[[13068,13068],"mapped",[12459,12521,12483,12488]],[[13069,13069],"mapped",[12459,12525,12522,12540]],[[13070,13070],"mapped",[12460,12525,12531]],[[13071,13071],"mapped",[12460,12531,12510]],[[13072,13072],"mapped",[12462,12460]],[[13073,13073],"mapped",[12462,12491,12540]],[[13074,13074],"mapped",[12461,12517,12522,12540]],[[13075,13075],"mapped",[12462,12523,12480,12540]],[[13076,13076],"mapped",[12461,12525]],[[13077,13077],"mapped",[12461,12525,12464,12521,12512]],[[13078,13078],"mapped",[12461,12525,12513,12540,12488,12523]],[[13079,13079],"mapped",[12461,12525,12527,12483,12488]],[[13080,13080],"mapped",[12464,12521,12512]],[[13081,13081],"mapped",[12464,12521,12512,12488,12531]],[[13082,13082],"mapped",[12463,12523,12476,12452,12525]],[[13083,13083],"mapped",[12463,12525,12540,12493]],[[13084,13084],"mapped",[12465,12540,12473]],[[13085,13085],"mapped",[12467,12523,12490]],[[13086,13086],"mapped",[12467,12540,12509]],[[13087,13087],"mapped",[12469,12452,12463,12523]],[[13088,13088],"mapped",[12469,12531,12481,12540,12512]],[[13089,13089],"mapped",[12471,12522,12531,12464]],[[13090,13090],"mapped",[12475,12531,12481]],[[13091,13091],"mapped",[12475,12531,12488]],[[13092,13092],"mapped",[12480,12540,12473]],[[13093,13093],"mapped",[12487,12471]],[[13094,13094],"mapped",[12489,12523]],[[13095,13095],"mapped",[12488,12531]],[[13096,13096],"mapped",[12490,12494]],[[13097,13097],"mapped",[12494,12483,12488]],[[13098,13098],"mapped",[12495,12452,12484]],[[13099,13099],"mapped",[12497,12540,12475,12531,12488]],[[13100,13100],"mapped",[12497,12540,12484]],[[13101,13101],"mapped",[12496,12540,12524,12523]],[[13102,13102],"mapped",[12500,12450,12473,12488,12523]],[[13103,13103],"mapped",[12500,12463,12523]],[[13104,13104],"mapped",[12500,12467]],[[13105,13105],"mapped",[12499,12523]],[[13106,13106],"mapped",[12501,12449,12521,12483,12489]],[[13107,13107],"mapped",[12501,12451,12540,12488]],[[13108,13108],"mapped",[12502,12483,12471,12455,12523]],[[13109,13109],"mapped",[12501,12521,12531]],[[13110,13110],"mapped",[12504,12463,12479,12540,12523]],[[13111,13111],"mapped",[12506,12477]],[[13112,13112],"mapped",[12506,12491,12498]],[[13113,13113],"mapped",[12504,12523,12484]],[[13114,13114],"mapped",[12506,12531,12473]],[[13115,13115],"mapped",[12506,12540,12472]],[[13116,13116],"mapped",[12505,12540,12479]],[[13117,13117],"mapped",[12509,12452,12531,12488]],[[13118,13118],"mapped",[12508,12523,12488]],[[13119,13119],"mapped",[12507,12531]],[[13120,13120],"mapped",[12509,12531,12489]],[[13121,13121],"mapped",[12507,12540,12523]],[[13122,13122],"mapped",[12507,12540,12531]],[[13123,13123],"mapped",[12510,12452,12463,12525]],[[13124,13124],"mapped",[12510,12452,12523]],[[13125,13125],"mapped",[12510,12483,12495]],[[13126,13126],"mapped",[12510,12523,12463]],[[13127,13127],"mapped",[12510,12531,12471,12519,12531]],[[13128,13128],"mapped",[12511,12463,12525,12531]],[[13129,13129],"mapped",[12511,12522]],[[13130,13130],"mapped",[12511,12522,12496,12540,12523]],[[13131,13131],"mapped",[12513,12460]],[[13132,13132],"mapped",[12513,12460,12488,12531]],[[13133,13133],"mapped",[12513,12540,12488,12523]],[[13134,13134],"mapped",[12516,12540,12489]],[[13135,13135],"mapped",[12516,12540,12523]],[[13136,13136],"mapped",[12518,12450,12531]],[[13137,13137],"mapped",[12522,12483,12488,12523]],[[13138,13138],"mapped",[12522,12521]],[[13139,13139],"mapped",[12523,12500,12540]],[[13140,13140],"mapped",[12523,12540,12502,12523]],[[13141,13141],"mapped",[12524,12512]],[[13142,13142],"mapped",[12524,12531,12488,12466,12531]],[[13143,13143],"mapped",[12527,12483,12488]],[[13144,13144],"mapped",[48,28857]],[[13145,13145],"mapped",[49,28857]],[[13146,13146],"mapped",[50,28857]],[[13147,13147],"mapped",[51,28857]],[[13148,13148],"mapped",[52,28857]],[[13149,13149],"mapped",[53,28857]],[[13150,13150],"mapped",[54,28857]],[[13151,13151],"mapped",[55,28857]],[[13152,13152],"mapped",[56,28857]],[[13153,13153],"mapped",[57,28857]],[[13154,13154],"mapped",[49,48,28857]],[[13155,13155],"mapped",[49,49,28857]],[[13156,13156],"mapped",[49,50,28857]],[[13157,13157],"mapped",[49,51,28857]],[[13158,13158],"mapped",[49,52,28857]],[[13159,13159],"mapped",[49,53,28857]],[[13160,13160],"mapped",[49,54,28857]],[[13161,13161],"mapped",[49,55,28857]],[[13162,13162],"mapped",[49,56,28857]],[[13163,13163],"mapped",[49,57,28857]],[[13164,13164],"mapped",[50,48,28857]],[[13165,13165],"mapped",[50,49,28857]],[[13166,13166],"mapped",[50,50,28857]],[[13167,13167],"mapped",[50,51,28857]],[[13168,13168],"mapped",[50,52,28857]],[[13169,13169],"mapped",[104,112,97]],[[13170,13170],"mapped",[100,97]],[[13171,13171],"mapped",[97,117]],[[13172,13172],"mapped",[98,97,114]],[[13173,13173],"mapped",[111,118]],[[13174,13174],"mapped",[112,99]],[[13175,13175],"mapped",[100,109]],[[13176,13176],"mapped",[100,109,50]],[[13177,13177],"mapped",[100,109,51]],[[13178,13178],"mapped",[105,117]],[[13179,13179],"mapped",[24179,25104]],[[13180,13180],"mapped",[26157,21644]],[[13181,13181],"mapped",[22823,27491]],[[13182,13182],"mapped",[26126,27835]],[[13183,13183],"mapped",[26666,24335,20250,31038]],[[13184,13184],"mapped",[112,97]],[[13185,13185],"mapped",[110,97]],[[13186,13186],"mapped",[956,97]],[[13187,13187],"mapped",[109,97]],[[13188,13188],"mapped",[107,97]],[[13189,13189],"mapped",[107,98]],[[13190,13190],"mapped",[109,98]],[[13191,13191],"mapped",[103,98]],[[13192,13192],"mapped",[99,97,108]],[[13193,13193],"mapped",[107,99,97,108]],[[13194,13194],"mapped",[112,102]],[[13195,13195],"mapped",[110,102]],[[13196,13196],"mapped",[956,102]],[[13197,13197],"mapped",[956,103]],[[13198,13198],"mapped",[109,103]],[[13199,13199],"mapped",[107,103]],[[13200,13200],"mapped",[104,122]],[[13201,13201],"mapped",[107,104,122]],[[13202,13202],"mapped",[109,104,122]],[[13203,13203],"mapped",[103,104,122]],[[13204,13204],"mapped",[116,104,122]],[[13205,13205],"mapped",[956,108]],[[13206,13206],"mapped",[109,108]],[[13207,13207],"mapped",[100,108]],[[13208,13208],"mapped",[107,108]],[[13209,13209],"mapped",[102,109]],[[13210,13210],"mapped",[110,109]],[[13211,13211],"mapped",[956,109]],[[13212,13212],"mapped",[109,109]],[[13213,13213],"mapped",[99,109]],[[13214,13214],"mapped",[107,109]],[[13215,13215],"mapped",[109,109,50]],[[13216,13216],"mapped",[99,109,50]],[[13217,13217],"mapped",[109,50]],[[13218,13218],"mapped",[107,109,50]],[[13219,13219],"mapped",[109,109,51]],[[13220,13220],"mapped",[99,109,51]],[[13221,13221],"mapped",[109,51]],[[13222,13222],"mapped",[107,109,51]],[[13223,13223],"mapped",[109,8725,115]],[[13224,13224],"mapped",[109,8725,115,50]],[[13225,13225],"mapped",[112,97]],[[13226,13226],"mapped",[107,112,97]],[[13227,13227],"mapped",[109,112,97]],[[13228,13228],"mapped",[103,112,97]],[[13229,13229],"mapped",[114,97,100]],[[13230,13230],"mapped",[114,97,100,8725,115]],[[13231,13231],"mapped",[114,97,100,8725,115,50]],[[13232,13232],"mapped",[112,115]],[[13233,13233],"mapped",[110,115]],[[13234,13234],"mapped",[956,115]],[[13235,13235],"mapped",[109,115]],[[13236,13236],"mapped",[112,118]],[[13237,13237],"mapped",[110,118]],[[13238,13238],"mapped",[956,118]],[[13239,13239],"mapped",[109,118]],[[13240,13240],"mapped",[107,118]],[[13241,13241],"mapped",[109,118]],[[13242,13242],"mapped",[112,119]],[[13243,13243],"mapped",[110,119]],[[13244,13244],"mapped",[956,119]],[[13245,13245],"mapped",[109,119]],[[13246,13246],"mapped",[107,119]],[[13247,13247],"mapped",[109,119]],[[13248,13248],"mapped",[107,969]],[[13249,13249],"mapped",[109,969]],[[13250,13250],"disallowed"],[[13251,13251],"mapped",[98,113]],[[13252,13252],"mapped",[99,99]],[[13253,13253],"mapped",[99,100]],[[13254,13254],"mapped",[99,8725,107,103]],[[13255,13255],"disallowed"],[[13256,13256],"mapped",[100,98]],[[13257,13257],"mapped",[103,121]],[[13258,13258],"mapped",[104,97]],[[13259,13259],"mapped",[104,112]],[[13260,13260],"mapped",[105,110]],[[13261,13261],"mapped",[107,107]],[[13262,13262],"mapped",[107,109]],[[13263,13263],"mapped",[107,116]],[[13264,13264],"mapped",[108,109]],[[13265,13265],"mapped",[108,110]],[[13266,13266],"mapped",[108,111,103]],[[13267,13267],"mapped",[108,120]],[[13268,13268],"mapped",[109,98]],[[13269,13269],"mapped",[109,105,108]],[[13270,13270],"mapped",[109,111,108]],[[13271,13271],"mapped",[112,104]],[[13272,13272],"disallowed"],[[13273,13273],"mapped",[112,112,109]],[[13274,13274],"mapped",[112,114]],[[13275,13275],"mapped",[115,114]],[[13276,13276],"mapped",[115,118]],[[13277,13277],"mapped",[119,98]],[[13278,13278],"mapped",[118,8725,109]],[[13279,13279],"mapped",[97,8725,109]],[[13280,13280],"mapped",[49,26085]],[[13281,13281],"mapped",[50,26085]],[[13282,13282],"mapped",[51,26085]],[[13283,13283],"mapped",[52,26085]],[[13284,13284],"mapped",[53,26085]],[[13285,13285],"mapped",[54,26085]],[[13286,13286],"mapped",[55,26085]],[[13287,13287],"mapped",[56,26085]],[[13288,13288],"mapped",[57,26085]],[[13289,13289],"mapped",[49,48,26085]],[[13290,13290],"mapped",[49,49,26085]],[[13291,13291],"mapped",[49,50,26085]],[[13292,13292],"mapped",[49,51,26085]],[[13293,13293],"mapped",[49,52,26085]],[[13294,13294],"mapped",[49,53,26085]],[[13295,13295],"mapped",[49,54,26085]],[[13296,13296],"mapped",[49,55,26085]],[[13297,13297],"mapped",[49,56,26085]],[[13298,13298],"mapped",[49,57,26085]],[[13299,13299],"mapped",[50,48,26085]],[[13300,13300],"mapped",[50,49,26085]],[[13301,13301],"mapped",[50,50,26085]],[[13302,13302],"mapped",[50,51,26085]],[[13303,13303],"mapped",[50,52,26085]],[[13304,13304],"mapped",[50,53,26085]],[[13305,13305],"mapped",[50,54,26085]],[[13306,13306],"mapped",[50,55,26085]],[[13307,13307],"mapped",[50,56,26085]],[[13308,13308],"mapped",[50,57,26085]],[[13309,13309],"mapped",[51,48,26085]],[[13310,13310],"mapped",[51,49,26085]],[[13311,13311],"mapped",[103,97,108]],[[13312,19893],"valid"],[[19894,19903],"disallowed"],[[19904,19967],"valid",[],"NV8"],[[19968,40869],"valid"],[[40870,40891],"valid"],[[40892,40899],"valid"],[[40900,40907],"valid"],[[40908,40908],"valid"],[[40909,40917],"valid"],[[40918,40959],"disallowed"],[[40960,42124],"valid"],[[42125,42127],"disallowed"],[[42128,42145],"valid",[],"NV8"],[[42146,42147],"valid",[],"NV8"],[[42148,42163],"valid",[],"NV8"],[[42164,42164],"valid",[],"NV8"],[[42165,42176],"valid",[],"NV8"],[[42177,42177],"valid",[],"NV8"],[[42178,42180],"valid",[],"NV8"],[[42181,42181],"valid",[],"NV8"],[[42182,42182],"valid",[],"NV8"],[[42183,42191],"disallowed"],[[42192,42237],"valid"],[[42238,42239],"valid",[],"NV8"],[[42240,42508],"valid"],[[42509,42511],"valid",[],"NV8"],[[42512,42539],"valid"],[[42540,42559],"disallowed"],[[42560,42560],"mapped",[42561]],[[42561,42561],"valid"],[[42562,42562],"mapped",[42563]],[[42563,42563],"valid"],[[42564,42564],"mapped",[42565]],[[42565,42565],"valid"],[[42566,42566],"mapped",[42567]],[[42567,42567],"valid"],[[42568,42568],"mapped",[42569]],[[42569,42569],"valid"],[[42570,42570],"mapped",[42571]],[[42571,42571],"valid"],[[42572,42572],"mapped",[42573]],[[42573,42573],"valid"],[[42574,42574],"mapped",[42575]],[[42575,42575],"valid"],[[42576,42576],"mapped",[42577]],[[42577,42577],"valid"],[[42578,42578],"mapped",[42579]],[[42579,42579],"valid"],[[42580,42580],"mapped",[42581]],[[42581,42581],"valid"],[[42582,42582],"mapped",[42583]],[[42583,42583],"valid"],[[42584,42584],"mapped",[42585]],[[42585,42585],"valid"],[[42586,42586],"mapped",[42587]],[[42587,42587],"valid"],[[42588,42588],"mapped",[42589]],[[42589,42589],"valid"],[[42590,42590],"mapped",[42591]],[[42591,42591],"valid"],[[42592,42592],"mapped",[42593]],[[42593,42593],"valid"],[[42594,42594],"mapped",[42595]],[[42595,42595],"valid"],[[42596,42596],"mapped",[42597]],[[42597,42597],"valid"],[[42598,42598],"mapped",[42599]],[[42599,42599],"valid"],[[42600,42600],"mapped",[42601]],[[42601,42601],"valid"],[[42602,42602],"mapped",[42603]],[[42603,42603],"valid"],[[42604,42604],"mapped",[42605]],[[42605,42607],"valid"],[[42608,42611],"valid",[],"NV8"],[[42612,42619],"valid"],[[42620,42621],"valid"],[[42622,42622],"valid",[],"NV8"],[[42623,42623],"valid"],[[42624,42624],"mapped",[42625]],[[42625,42625],"valid"],[[42626,42626],"mapped",[42627]],[[42627,42627],"valid"],[[42628,42628],"mapped",[42629]],[[42629,42629],"valid"],[[42630,42630],"mapped",[42631]],[[42631,42631],"valid"],[[42632,42632],"mapped",[42633]],[[42633,42633],"valid"],[[42634,42634],"mapped",[42635]],[[42635,42635],"valid"],[[42636,42636],"mapped",[42637]],[[42637,42637],"valid"],[[42638,42638],"mapped",[42639]],[[42639,42639],"valid"],[[42640,42640],"mapped",[42641]],[[42641,42641],"valid"],[[42642,42642],"mapped",[42643]],[[42643,42643],"valid"],[[42644,42644],"mapped",[42645]],[[42645,42645],"valid"],[[42646,42646],"mapped",[42647]],[[42647,42647],"valid"],[[42648,42648],"mapped",[42649]],[[42649,42649],"valid"],[[42650,42650],"mapped",[42651]],[[42651,42651],"valid"],[[42652,42652],"mapped",[1098]],[[42653,42653],"mapped",[1100]],[[42654,42654],"valid"],[[42655,42655],"valid"],[[42656,42725],"valid"],[[42726,42735],"valid",[],"NV8"],[[42736,42737],"valid"],[[42738,42743],"valid",[],"NV8"],[[42744,42751],"disallowed"],[[42752,42774],"valid",[],"NV8"],[[42775,42778],"valid"],[[42779,42783],"valid"],[[42784,42785],"valid",[],"NV8"],[[42786,42786],"mapped",[42787]],[[42787,42787],"valid"],[[42788,42788],"mapped",[42789]],[[42789,42789],"valid"],[[42790,42790],"mapped",[42791]],[[42791,42791],"valid"],[[42792,42792],"mapped",[42793]],[[42793,42793],"valid"],[[42794,42794],"mapped",[42795]],[[42795,42795],"valid"],[[42796,42796],"mapped",[42797]],[[42797,42797],"valid"],[[42798,42798],"mapped",[42799]],[[42799,42801],"valid"],[[42802,42802],"mapped",[42803]],[[42803,42803],"valid"],[[42804,42804],"mapped",[42805]],[[42805,42805],"valid"],[[42806,42806],"mapped",[42807]],[[42807,42807],"valid"],[[42808,42808],"mapped",[42809]],[[42809,42809],"valid"],[[42810,42810],"mapped",[42811]],[[42811,42811],"valid"],[[42812,42812],"mapped",[42813]],[[42813,42813],"valid"],[[42814,42814],"mapped",[42815]],[[42815,42815],"valid"],[[42816,42816],"mapped",[42817]],[[42817,42817],"valid"],[[42818,42818],"mapped",[42819]],[[42819,42819],"valid"],[[42820,42820],"mapped",[42821]],[[42821,42821],"valid"],[[42822,42822],"mapped",[42823]],[[42823,42823],"valid"],[[42824,42824],"mapped",[42825]],[[42825,42825],"valid"],[[42826,42826],"mapped",[42827]],[[42827,42827],"valid"],[[42828,42828],"mapped",[42829]],[[42829,42829],"valid"],[[42830,42830],"mapped",[42831]],[[42831,42831],"valid"],[[42832,42832],"mapped",[42833]],[[42833,42833],"valid"],[[42834,42834],"mapped",[42835]],[[42835,42835],"valid"],[[42836,42836],"mapped",[42837]],[[42837,42837],"valid"],[[42838,42838],"mapped",[42839]],[[42839,42839],"valid"],[[42840,42840],"mapped",[42841]],[[42841,42841],"valid"],[[42842,42842],"mapped",[42843]],[[42843,42843],"valid"],[[42844,42844],"mapped",[42845]],[[42845,42845],"valid"],[[42846,42846],"mapped",[42847]],[[42847,42847],"valid"],[[42848,42848],"mapped",[42849]],[[42849,42849],"valid"],[[42850,42850],"mapped",[42851]],[[42851,42851],"valid"],[[42852,42852],"mapped",[42853]],[[42853,42853],"valid"],[[42854,42854],"mapped",[42855]],[[42855,42855],"valid"],[[42856,42856],"mapped",[42857]],[[42857,42857],"valid"],[[42858,42858],"mapped",[42859]],[[42859,42859],"valid"],[[42860,42860],"mapped",[42861]],[[42861,42861],"valid"],[[42862,42862],"mapped",[42863]],[[42863,42863],"valid"],[[42864,42864],"mapped",[42863]],[[42865,42872],"valid"],[[42873,42873],"mapped",[42874]],[[42874,42874],"valid"],[[42875,42875],"mapped",[42876]],[[42876,42876],"valid"],[[42877,42877],"mapped",[7545]],[[42878,42878],"mapped",[42879]],[[42879,42879],"valid"],[[42880,42880],"mapped",[42881]],[[42881,42881],"valid"],[[42882,42882],"mapped",[42883]],[[42883,42883],"valid"],[[42884,42884],"mapped",[42885]],[[42885,42885],"valid"],[[42886,42886],"mapped",[42887]],[[42887,42888],"valid"],[[42889,42890],"valid",[],"NV8"],[[42891,42891],"mapped",[42892]],[[42892,42892],"valid"],[[42893,42893],"mapped",[613]],[[42894,42894],"valid"],[[42895,42895],"valid"],[[42896,42896],"mapped",[42897]],[[42897,42897],"valid"],[[42898,42898],"mapped",[42899]],[[42899,42899],"valid"],[[42900,42901],"valid"],[[42902,42902],"mapped",[42903]],[[42903,42903],"valid"],[[42904,42904],"mapped",[42905]],[[42905,42905],"valid"],[[42906,42906],"mapped",[42907]],[[42907,42907],"valid"],[[42908,42908],"mapped",[42909]],[[42909,42909],"valid"],[[42910,42910],"mapped",[42911]],[[42911,42911],"valid"],[[42912,42912],"mapped",[42913]],[[42913,42913],"valid"],[[42914,42914],"mapped",[42915]],[[42915,42915],"valid"],[[42916,42916],"mapped",[42917]],[[42917,42917],"valid"],[[42918,42918],"mapped",[42919]],[[42919,42919],"valid"],[[42920,42920],"mapped",[42921]],[[42921,42921],"valid"],[[42922,42922],"mapped",[614]],[[42923,42923],"mapped",[604]],[[42924,42924],"mapped",[609]],[[42925,42925],"mapped",[620]],[[42926,42927],"disallowed"],[[42928,42928],"mapped",[670]],[[42929,42929],"mapped",[647]],[[42930,42930],"mapped",[669]],[[42931,42931],"mapped",[43859]],[[42932,42932],"mapped",[42933]],[[42933,42933],"valid"],[[42934,42934],"mapped",[42935]],[[42935,42935],"valid"],[[42936,42998],"disallowed"],[[42999,42999],"valid"],[[43000,43000],"mapped",[295]],[[43001,43001],"mapped",[339]],[[43002,43002],"valid"],[[43003,43007],"valid"],[[43008,43047],"valid"],[[43048,43051],"valid",[],"NV8"],[[43052,43055],"disallowed"],[[43056,43065],"valid",[],"NV8"],[[43066,43071],"disallowed"],[[43072,43123],"valid"],[[43124,43127],"valid",[],"NV8"],[[43128,43135],"disallowed"],[[43136,43204],"valid"],[[43205,43213],"disallowed"],[[43214,43215],"valid",[],"NV8"],[[43216,43225],"valid"],[[43226,43231],"disallowed"],[[43232,43255],"valid"],[[43256,43258],"valid",[],"NV8"],[[43259,43259],"valid"],[[43260,43260],"valid",[],"NV8"],[[43261,43261],"valid"],[[43262,43263],"disallowed"],[[43264,43309],"valid"],[[43310,43311],"valid",[],"NV8"],[[43312,43347],"valid"],[[43348,43358],"disallowed"],[[43359,43359],"valid",[],"NV8"],[[43360,43388],"valid",[],"NV8"],[[43389,43391],"disallowed"],[[43392,43456],"valid"],[[43457,43469],"valid",[],"NV8"],[[43470,43470],"disallowed"],[[43471,43481],"valid"],[[43482,43485],"disallowed"],[[43486,43487],"valid",[],"NV8"],[[43488,43518],"valid"],[[43519,43519],"disallowed"],[[43520,43574],"valid"],[[43575,43583],"disallowed"],[[43584,43597],"valid"],[[43598,43599],"disallowed"],[[43600,43609],"valid"],[[43610,43611],"disallowed"],[[43612,43615],"valid",[],"NV8"],[[43616,43638],"valid"],[[43639,43641],"valid",[],"NV8"],[[43642,43643],"valid"],[[43644,43647],"valid"],[[43648,43714],"valid"],[[43715,43738],"disallowed"],[[43739,43741],"valid"],[[43742,43743],"valid",[],"NV8"],[[43744,43759],"valid"],[[43760,43761],"valid",[],"NV8"],[[43762,43766],"valid"],[[43767,43776],"disallowed"],[[43777,43782],"valid"],[[43783,43784],"disallowed"],[[43785,43790],"valid"],[[43791,43792],"disallowed"],[[43793,43798],"valid"],[[43799,43807],"disallowed"],[[43808,43814],"valid"],[[43815,43815],"disallowed"],[[43816,43822],"valid"],[[43823,43823],"disallowed"],[[43824,43866],"valid"],[[43867,43867],"valid",[],"NV8"],[[43868,43868],"mapped",[42791]],[[43869,43869],"mapped",[43831]],[[43870,43870],"mapped",[619]],[[43871,43871],"mapped",[43858]],[[43872,43875],"valid"],[[43876,43877],"valid"],[[43878,43887],"disallowed"],[[43888,43888],"mapped",[5024]],[[43889,43889],"mapped",[5025]],[[43890,43890],"mapped",[5026]],[[43891,43891],"mapped",[5027]],[[43892,43892],"mapped",[5028]],[[43893,43893],"mapped",[5029]],[[43894,43894],"mapped",[5030]],[[43895,43895],"mapped",[5031]],[[43896,43896],"mapped",[5032]],[[43897,43897],"mapped",[5033]],[[43898,43898],"mapped",[5034]],[[43899,43899],"mapped",[5035]],[[43900,43900],"mapped",[5036]],[[43901,43901],"mapped",[5037]],[[43902,43902],"mapped",[5038]],[[43903,43903],"mapped",[5039]],[[43904,43904],"mapped",[5040]],[[43905,43905],"mapped",[5041]],[[43906,43906],"mapped",[5042]],[[43907,43907],"mapped",[5043]],[[43908,43908],"mapped",[5044]],[[43909,43909],"mapped",[5045]],[[43910,43910],"mapped",[5046]],[[43911,43911],"mapped",[5047]],[[43912,43912],"mapped",[5048]],[[43913,43913],"mapped",[5049]],[[43914,43914],"mapped",[5050]],[[43915,43915],"mapped",[5051]],[[43916,43916],"mapped",[5052]],[[43917,43917],"mapped",[5053]],[[43918,43918],"mapped",[5054]],[[43919,43919],"mapped",[5055]],[[43920,43920],"mapped",[5056]],[[43921,43921],"mapped",[5057]],[[43922,43922],"mapped",[5058]],[[43923,43923],"mapped",[5059]],[[43924,43924],"mapped",[5060]],[[43925,43925],"mapped",[5061]],[[43926,43926],"mapped",[5062]],[[43927,43927],"mapped",[5063]],[[43928,43928],"mapped",[5064]],[[43929,43929],"mapped",[5065]],[[43930,43930],"mapped",[5066]],[[43931,43931],"mapped",[5067]],[[43932,43932],"mapped",[5068]],[[43933,43933],"mapped",[5069]],[[43934,43934],"mapped",[5070]],[[43935,43935],"mapped",[5071]],[[43936,43936],"mapped",[5072]],[[43937,43937],"mapped",[5073]],[[43938,43938],"mapped",[5074]],[[43939,43939],"mapped",[5075]],[[43940,43940],"mapped",[5076]],[[43941,43941],"mapped",[5077]],[[43942,43942],"mapped",[5078]],[[43943,43943],"mapped",[5079]],[[43944,43944],"mapped",[5080]],[[43945,43945],"mapped",[5081]],[[43946,43946],"mapped",[5082]],[[43947,43947],"mapped",[5083]],[[43948,43948],"mapped",[5084]],[[43949,43949],"mapped",[5085]],[[43950,43950],"mapped",[5086]],[[43951,43951],"mapped",[5087]],[[43952,43952],"mapped",[5088]],[[43953,43953],"mapped",[5089]],[[43954,43954],"mapped",[5090]],[[43955,43955],"mapped",[5091]],[[43956,43956],"mapped",[5092]],[[43957,43957],"mapped",[5093]],[[43958,43958],"mapped",[5094]],[[43959,43959],"mapped",[5095]],[[43960,43960],"mapped",[5096]],[[43961,43961],"mapped",[5097]],[[43962,43962],"mapped",[5098]],[[43963,43963],"mapped",[5099]],[[43964,43964],"mapped",[5100]],[[43965,43965],"mapped",[5101]],[[43966,43966],"mapped",[5102]],[[43967,43967],"mapped",[5103]],[[43968,44010],"valid"],[[44011,44011],"valid",[],"NV8"],[[44012,44013],"valid"],[[44014,44015],"disallowed"],[[44016,44025],"valid"],[[44026,44031],"disallowed"],[[44032,55203],"valid"],[[55204,55215],"disallowed"],[[55216,55238],"valid",[],"NV8"],[[55239,55242],"disallowed"],[[55243,55291],"valid",[],"NV8"],[[55292,55295],"disallowed"],[[55296,57343],"disallowed"],[[57344,63743],"disallowed"],[[63744,63744],"mapped",[35912]],[[63745,63745],"mapped",[26356]],[[63746,63746],"mapped",[36554]],[[63747,63747],"mapped",[36040]],[[63748,63748],"mapped",[28369]],[[63749,63749],"mapped",[20018]],[[63750,63750],"mapped",[21477]],[[63751,63752],"mapped",[40860]],[[63753,63753],"mapped",[22865]],[[63754,63754],"mapped",[37329]],[[63755,63755],"mapped",[21895]],[[63756,63756],"mapped",[22856]],[[63757,63757],"mapped",[25078]],[[63758,63758],"mapped",[30313]],[[63759,63759],"mapped",[32645]],[[63760,63760],"mapped",[34367]],[[63761,63761],"mapped",[34746]],[[63762,63762],"mapped",[35064]],[[63763,63763],"mapped",[37007]],[[63764,63764],"mapped",[27138]],[[63765,63765],"mapped",[27931]],[[63766,63766],"mapped",[28889]],[[63767,63767],"mapped",[29662]],[[63768,63768],"mapped",[33853]],[[63769,63769],"mapped",[37226]],[[63770,63770],"mapped",[39409]],[[63771,63771],"mapped",[20098]],[[63772,63772],"mapped",[21365]],[[63773,63773],"mapped",[27396]],[[63774,63774],"mapped",[29211]],[[63775,63775],"mapped",[34349]],[[63776,63776],"mapped",[40478]],[[63777,63777],"mapped",[23888]],[[63778,63778],"mapped",[28651]],[[63779,63779],"mapped",[34253]],[[63780,63780],"mapped",[35172]],[[63781,63781],"mapped",[25289]],[[63782,63782],"mapped",[33240]],[[63783,63783],"mapped",[34847]],[[63784,63784],"mapped",[24266]],[[63785,63785],"mapped",[26391]],[[63786,63786],"mapped",[28010]],[[63787,63787],"mapped",[29436]],[[63788,63788],"mapped",[37070]],[[63789,63789],"mapped",[20358]],[[63790,63790],"mapped",[20919]],[[63791,63791],"mapped",[21214]],[[63792,63792],"mapped",[25796]],[[63793,63793],"mapped",[27347]],[[63794,63794],"mapped",[29200]],[[63795,63795],"mapped",[30439]],[[63796,63796],"mapped",[32769]],[[63797,63797],"mapped",[34310]],[[63798,63798],"mapped",[34396]],[[63799,63799],"mapped",[36335]],[[63800,63800],"mapped",[38706]],[[63801,63801],"mapped",[39791]],[[63802,63802],"mapped",[40442]],[[63803,63803],"mapped",[30860]],[[63804,63804],"mapped",[31103]],[[63805,63805],"mapped",[32160]],[[63806,63806],"mapped",[33737]],[[63807,63807],"mapped",[37636]],[[63808,63808],"mapped",[40575]],[[63809,63809],"mapped",[35542]],[[63810,63810],"mapped",[22751]],[[63811,63811],"mapped",[24324]],[[63812,63812],"mapped",[31840]],[[63813,63813],"mapped",[32894]],[[63814,63814],"mapped",[29282]],[[63815,63815],"mapped",[30922]],[[63816,63816],"mapped",[36034]],[[63817,63817],"mapped",[38647]],[[63818,63818],"mapped",[22744]],[[63819,63819],"mapped",[23650]],[[63820,63820],"mapped",[27155]],[[63821,63821],"mapped",[28122]],[[63822,63822],"mapped",[28431]],[[63823,63823],"mapped",[32047]],[[63824,63824],"mapped",[32311]],[[63825,63825],"mapped",[38475]],[[63826,63826],"mapped",[21202]],[[63827,63827],"mapped",[32907]],[[63828,63828],"mapped",[20956]],[[63829,63829],"mapped",[20940]],[[63830,63830],"mapped",[31260]],[[63831,63831],"mapped",[32190]],[[63832,63832],"mapped",[33777]],[[63833,63833],"mapped",[38517]],[[63834,63834],"mapped",[35712]],[[63835,63835],"mapped",[25295]],[[63836,63836],"mapped",[27138]],[[63837,63837],"mapped",[35582]],[[63838,63838],"mapped",[20025]],[[63839,63839],"mapped",[23527]],[[63840,63840],"mapped",[24594]],[[63841,63841],"mapped",[29575]],[[63842,63842],"mapped",[30064]],[[63843,63843],"mapped",[21271]],[[63844,63844],"mapped",[30971]],[[63845,63845],"mapped",[20415]],[[63846,63846],"mapped",[24489]],[[63847,63847],"mapped",[19981]],[[63848,63848],"mapped",[27852]],[[63849,63849],"mapped",[25976]],[[63850,63850],"mapped",[32034]],[[63851,63851],"mapped",[21443]],[[63852,63852],"mapped",[22622]],[[63853,63853],"mapped",[30465]],[[63854,63854],"mapped",[33865]],[[63855,63855],"mapped",[35498]],[[63856,63856],"mapped",[27578]],[[63857,63857],"mapped",[36784]],[[63858,63858],"mapped",[27784]],[[63859,63859],"mapped",[25342]],[[63860,63860],"mapped",[33509]],[[63861,63861],"mapped",[25504]],[[63862,63862],"mapped",[30053]],[[63863,63863],"mapped",[20142]],[[63864,63864],"mapped",[20841]],[[63865,63865],"mapped",[20937]],[[63866,63866],"mapped",[26753]],[[63867,63867],"mapped",[31975]],[[63868,63868],"mapped",[33391]],[[63869,63869],"mapped",[35538]],[[63870,63870],"mapped",[37327]],[[63871,63871],"mapped",[21237]],[[63872,63872],"mapped",[21570]],[[63873,63873],"mapped",[22899]],[[63874,63874],"mapped",[24300]],[[63875,63875],"mapped",[26053]],[[63876,63876],"mapped",[28670]],[[63877,63877],"mapped",[31018]],[[63878,63878],"mapped",[38317]],[[63879,63879],"mapped",[39530]],[[63880,63880],"mapped",[40599]],[[63881,63881],"mapped",[40654]],[[63882,63882],"mapped",[21147]],[[63883,63883],"mapped",[26310]],[[63884,63884],"mapped",[27511]],[[63885,63885],"mapped",[36706]],[[63886,63886],"mapped",[24180]],[[63887,63887],"mapped",[24976]],[[63888,63888],"mapped",[25088]],[[63889,63889],"mapped",[25754]],[[63890,63890],"mapped",[28451]],[[63891,63891],"mapped",[29001]],[[63892,63892],"mapped",[29833]],[[63893,63893],"mapped",[31178]],[[63894,63894],"mapped",[32244]],[[63895,63895],"mapped",[32879]],[[63896,63896],"mapped",[36646]],[[63897,63897],"mapped",[34030]],[[63898,63898],"mapped",[36899]],[[63899,63899],"mapped",[37706]],[[63900,63900],"mapped",[21015]],[[63901,63901],"mapped",[21155]],[[63902,63902],"mapped",[21693]],[[63903,63903],"mapped",[28872]],[[63904,63904],"mapped",[35010]],[[63905,63905],"mapped",[35498]],[[63906,63906],"mapped",[24265]],[[63907,63907],"mapped",[24565]],[[63908,63908],"mapped",[25467]],[[63909,63909],"mapped",[27566]],[[63910,63910],"mapped",[31806]],[[63911,63911],"mapped",[29557]],[[63912,63912],"mapped",[20196]],[[63913,63913],"mapped",[22265]],[[63914,63914],"mapped",[23527]],[[63915,63915],"mapped",[23994]],[[63916,63916],"mapped",[24604]],[[63917,63917],"mapped",[29618]],[[63918,63918],"mapped",[29801]],[[63919,63919],"mapped",[32666]],[[63920,63920],"mapped",[32838]],[[63921,63921],"mapped",[37428]],[[63922,63922],"mapped",[38646]],[[63923,63923],"mapped",[38728]],[[63924,63924],"mapped",[38936]],[[63925,63925],"mapped",[20363]],[[63926,63926],"mapped",[31150]],[[63927,63927],"mapped",[37300]],[[63928,63928],"mapped",[38584]],[[63929,63929],"mapped",[24801]],[[63930,63930],"mapped",[20102]],[[63931,63931],"mapped",[20698]],[[63932,63932],"mapped",[23534]],[[63933,63933],"mapped",[23615]],[[63934,63934],"mapped",[26009]],[[63935,63935],"mapped",[27138]],[[63936,63936],"mapped",[29134]],[[63937,63937],"mapped",[30274]],[[63938,63938],"mapped",[34044]],[[63939,63939],"mapped",[36988]],[[63940,63940],"mapped",[40845]],[[63941,63941],"mapped",[26248]],[[63942,63942],"mapped",[38446]],[[63943,63943],"mapped",[21129]],[[63944,63944],"mapped",[26491]],[[63945,63945],"mapped",[26611]],[[63946,63946],"mapped",[27969]],[[63947,63947],"mapped",[28316]],[[63948,63948],"mapped",[29705]],[[63949,63949],"mapped",[30041]],[[63950,63950],"mapped",[30827]],[[63951,63951],"mapped",[32016]],[[63952,63952],"mapped",[39006]],[[63953,63953],"mapped",[20845]],[[63954,63954],"mapped",[25134]],[[63955,63955],"mapped",[38520]],[[63956,63956],"mapped",[20523]],[[63957,63957],"mapped",[23833]],[[63958,63958],"mapped",[28138]],[[63959,63959],"mapped",[36650]],[[63960,63960],"mapped",[24459]],[[63961,63961],"mapped",[24900]],[[63962,63962],"mapped",[26647]],[[63963,63963],"mapped",[29575]],[[63964,63964],"mapped",[38534]],[[63965,63965],"mapped",[21033]],[[63966,63966],"mapped",[21519]],[[63967,63967],"mapped",[23653]],[[63968,63968],"mapped",[26131]],[[63969,63969],"mapped",[26446]],[[63970,63970],"mapped",[26792]],[[63971,63971],"mapped",[27877]],[[63972,63972],"mapped",[29702]],[[63973,63973],"mapped",[30178]],[[63974,63974],"mapped",[32633]],[[63975,63975],"mapped",[35023]],[[63976,63976],"mapped",[35041]],[[63977,63977],"mapped",[37324]],[[63978,63978],"mapped",[38626]],[[63979,63979],"mapped",[21311]],[[63980,63980],"mapped",[28346]],[[63981,63981],"mapped",[21533]],[[63982,63982],"mapped",[29136]],[[63983,63983],"mapped",[29848]],[[63984,63984],"mapped",[34298]],[[63985,63985],"mapped",[38563]],[[63986,63986],"mapped",[40023]],[[63987,63987],"mapped",[40607]],[[63988,63988],"mapped",[26519]],[[63989,63989],"mapped",[28107]],[[63990,63990],"mapped",[33256]],[[63991,63991],"mapped",[31435]],[[63992,63992],"mapped",[31520]],[[63993,63993],"mapped",[31890]],[[63994,63994],"mapped",[29376]],[[63995,63995],"mapped",[28825]],[[63996,63996],"mapped",[35672]],[[63997,63997],"mapped",[20160]],[[63998,63998],"mapped",[33590]],[[63999,63999],"mapped",[21050]],[[64000,64000],"mapped",[20999]],[[64001,64001],"mapped",[24230]],[[64002,64002],"mapped",[25299]],[[64003,64003],"mapped",[31958]],[[64004,64004],"mapped",[23429]],[[64005,64005],"mapped",[27934]],[[64006,64006],"mapped",[26292]],[[64007,64007],"mapped",[36667]],[[64008,64008],"mapped",[34892]],[[64009,64009],"mapped",[38477]],[[64010,64010],"mapped",[35211]],[[64011,64011],"mapped",[24275]],[[64012,64012],"mapped",[20800]],[[64013,64013],"mapped",[21952]],[[64014,64015],"valid"],[[64016,64016],"mapped",[22618]],[[64017,64017],"valid"],[[64018,64018],"mapped",[26228]],[[64019,64020],"valid"],[[64021,64021],"mapped",[20958]],[[64022,64022],"mapped",[29482]],[[64023,64023],"mapped",[30410]],[[64024,64024],"mapped",[31036]],[[64025,64025],"mapped",[31070]],[[64026,64026],"mapped",[31077]],[[64027,64027],"mapped",[31119]],[[64028,64028],"mapped",[38742]],[[64029,64029],"mapped",[31934]],[[64030,64030],"mapped",[32701]],[[64031,64031],"valid"],[[64032,64032],"mapped",[34322]],[[64033,64033],"valid"],[[64034,64034],"mapped",[35576]],[[64035,64036],"valid"],[[64037,64037],"mapped",[36920]],[[64038,64038],"mapped",[37117]],[[64039,64041],"valid"],[[64042,64042],"mapped",[39151]],[[64043,64043],"mapped",[39164]],[[64044,64044],"mapped",[39208]],[[64045,64045],"mapped",[40372]],[[64046,64046],"mapped",[37086]],[[64047,64047],"mapped",[38583]],[[64048,64048],"mapped",[20398]],[[64049,64049],"mapped",[20711]],[[64050,64050],"mapped",[20813]],[[64051,64051],"mapped",[21193]],[[64052,64052],"mapped",[21220]],[[64053,64053],"mapped",[21329]],[[64054,64054],"mapped",[21917]],[[64055,64055],"mapped",[22022]],[[64056,64056],"mapped",[22120]],[[64057,64057],"mapped",[22592]],[[64058,64058],"mapped",[22696]],[[64059,64059],"mapped",[23652]],[[64060,64060],"mapped",[23662]],[[64061,64061],"mapped",[24724]],[[64062,64062],"mapped",[24936]],[[64063,64063],"mapped",[24974]],[[64064,64064],"mapped",[25074]],[[64065,64065],"mapped",[25935]],[[64066,64066],"mapped",[26082]],[[64067,64067],"mapped",[26257]],[[64068,64068],"mapped",[26757]],[[64069,64069],"mapped",[28023]],[[64070,64070],"mapped",[28186]],[[64071,64071],"mapped",[28450]],[[64072,64072],"mapped",[29038]],[[64073,64073],"mapped",[29227]],[[64074,64074],"mapped",[29730]],[[64075,64075],"mapped",[30865]],[[64076,64076],"mapped",[31038]],[[64077,64077],"mapped",[31049]],[[64078,64078],"mapped",[31048]],[[64079,64079],"mapped",[31056]],[[64080,64080],"mapped",[31062]],[[64081,64081],"mapped",[31069]],[[64082,64082],"mapped",[31117]],[[64083,64083],"mapped",[31118]],[[64084,64084],"mapped",[31296]],[[64085,64085],"mapped",[31361]],[[64086,64086],"mapped",[31680]],[[64087,64087],"mapped",[32244]],[[64088,64088],"mapped",[32265]],[[64089,64089],"mapped",[32321]],[[64090,64090],"mapped",[32626]],[[64091,64091],"mapped",[32773]],[[64092,64092],"mapped",[33261]],[[64093,64094],"mapped",[33401]],[[64095,64095],"mapped",[33879]],[[64096,64096],"mapped",[35088]],[[64097,64097],"mapped",[35222]],[[64098,64098],"mapped",[35585]],[[64099,64099],"mapped",[35641]],[[64100,64100],"mapped",[36051]],[[64101,64101],"mapped",[36104]],[[64102,64102],"mapped",[36790]],[[64103,64103],"mapped",[36920]],[[64104,64104],"mapped",[38627]],[[64105,64105],"mapped",[38911]],[[64106,64106],"mapped",[38971]],[[64107,64107],"mapped",[24693]],[[64108,64108],"mapped",[148206]],[[64109,64109],"mapped",[33304]],[[64110,64111],"disallowed"],[[64112,64112],"mapped",[20006]],[[64113,64113],"mapped",[20917]],[[64114,64114],"mapped",[20840]],[[64115,64115],"mapped",[20352]],[[64116,64116],"mapped",[20805]],[[64117,64117],"mapped",[20864]],[[64118,64118],"mapped",[21191]],[[64119,64119],"mapped",[21242]],[[64120,64120],"mapped",[21917]],[[64121,64121],"mapped",[21845]],[[64122,64122],"mapped",[21913]],[[64123,64123],"mapped",[21986]],[[64124,64124],"mapped",[22618]],[[64125,64125],"mapped",[22707]],[[64126,64126],"mapped",[22852]],[[64127,64127],"mapped",[22868]],[[64128,64128],"mapped",[23138]],[[64129,64129],"mapped",[23336]],[[64130,64130],"mapped",[24274]],[[64131,64131],"mapped",[24281]],[[64132,64132],"mapped",[24425]],[[64133,64133],"mapped",[24493]],[[64134,64134],"mapped",[24792]],[[64135,64135],"mapped",[24910]],[[64136,64136],"mapped",[24840]],[[64137,64137],"mapped",[24974]],[[64138,64138],"mapped",[24928]],[[64139,64139],"mapped",[25074]],[[64140,64140],"mapped",[25140]],[[64141,64141],"mapped",[25540]],[[64142,64142],"mapped",[25628]],[[64143,64143],"mapped",[25682]],[[64144,64144],"mapped",[25942]],[[64145,64145],"mapped",[26228]],[[64146,64146],"mapped",[26391]],[[64147,64147],"mapped",[26395]],[[64148,64148],"mapped",[26454]],[[64149,64149],"mapped",[27513]],[[64150,64150],"mapped",[27578]],[[64151,64151],"mapped",[27969]],[[64152,64152],"mapped",[28379]],[[64153,64153],"mapped",[28363]],[[64154,64154],"mapped",[28450]],[[64155,64155],"mapped",[28702]],[[64156,64156],"mapped",[29038]],[[64157,64157],"mapped",[30631]],[[64158,64158],"mapped",[29237]],[[64159,64159],"mapped",[29359]],[[64160,64160],"mapped",[29482]],[[64161,64161],"mapped",[29809]],[[64162,64162],"mapped",[29958]],[[64163,64163],"mapped",[30011]],[[64164,64164],"mapped",[30237]],[[64165,64165],"mapped",[30239]],[[64166,64166],"mapped",[30410]],[[64167,64167],"mapped",[30427]],[[64168,64168],"mapped",[30452]],[[64169,64169],"mapped",[30538]],[[64170,64170],"mapped",[30528]],[[64171,64171],"mapped",[30924]],[[64172,64172],"mapped",[31409]],[[64173,64173],"mapped",[31680]],[[64174,64174],"mapped",[31867]],[[64175,64175],"mapped",[32091]],[[64176,64176],"mapped",[32244]],[[64177,64177],"mapped",[32574]],[[64178,64178],"mapped",[32773]],[[64179,64179],"mapped",[33618]],[[64180,64180],"mapped",[33775]],[[64181,64181],"mapped",[34681]],[[64182,64182],"mapped",[35137]],[[64183,64183],"mapped",[35206]],[[64184,64184],"mapped",[35222]],[[64185,64185],"mapped",[35519]],[[64186,64186],"mapped",[35576]],[[64187,64187],"mapped",[35531]],[[64188,64188],"mapped",[35585]],[[64189,64189],"mapped",[35582]],[[64190,64190],"mapped",[35565]],[[64191,64191],"mapped",[35641]],[[64192,64192],"mapped",[35722]],[[64193,64193],"mapped",[36104]],[[64194,64194],"mapped",[36664]],[[64195,64195],"mapped",[36978]],[[64196,64196],"mapped",[37273]],[[64197,64197],"mapped",[37494]],[[64198,64198],"mapped",[38524]],[[64199,64199],"mapped",[38627]],[[64200,64200],"mapped",[38742]],[[64201,64201],"mapped",[38875]],[[64202,64202],"mapped",[38911]],[[64203,64203],"mapped",[38923]],[[64204,64204],"mapped",[38971]],[[64205,64205],"mapped",[39698]],[[64206,64206],"mapped",[40860]],[[64207,64207],"mapped",[141386]],[[64208,64208],"mapped",[141380]],[[64209,64209],"mapped",[144341]],[[64210,64210],"mapped",[15261]],[[64211,64211],"mapped",[16408]],[[64212,64212],"mapped",[16441]],[[64213,64213],"mapped",[152137]],[[64214,64214],"mapped",[154832]],[[64215,64215],"mapped",[163539]],[[64216,64216],"mapped",[40771]],[[64217,64217],"mapped",[40846]],[[64218,64255],"disallowed"],[[64256,64256],"mapped",[102,102]],[[64257,64257],"mapped",[102,105]],[[64258,64258],"mapped",[102,108]],[[64259,64259],"mapped",[102,102,105]],[[64260,64260],"mapped",[102,102,108]],[[64261,64262],"mapped",[115,116]],[[64263,64274],"disallowed"],[[64275,64275],"mapped",[1396,1398]],[[64276,64276],"mapped",[1396,1381]],[[64277,64277],"mapped",[1396,1387]],[[64278,64278],"mapped",[1406,1398]],[[64279,64279],"mapped",[1396,1389]],[[64280,64284],"disallowed"],[[64285,64285],"mapped",[1497,1460]],[[64286,64286],"valid"],[[64287,64287],"mapped",[1522,1463]],[[64288,64288],"mapped",[1506]],[[64289,64289],"mapped",[1488]],[[64290,64290],"mapped",[1491]],[[64291,64291],"mapped",[1492]],[[64292,64292],"mapped",[1499]],[[64293,64293],"mapped",[1500]],[[64294,64294],"mapped",[1501]],[[64295,64295],"mapped",[1512]],[[64296,64296],"mapped",[1514]],[[64297,64297],"disallowed_STD3_mapped",[43]],[[64298,64298],"mapped",[1513,1473]],[[64299,64299],"mapped",[1513,1474]],[[64300,64300],"mapped",[1513,1468,1473]],[[64301,64301],"mapped",[1513,1468,1474]],[[64302,64302],"mapped",[1488,1463]],[[64303,64303],"mapped",[1488,1464]],[[64304,64304],"mapped",[1488,1468]],[[64305,64305],"mapped",[1489,1468]],[[64306,64306],"mapped",[1490,1468]],[[64307,64307],"mapped",[1491,1468]],[[64308,64308],"mapped",[1492,1468]],[[64309,64309],"mapped",[1493,1468]],[[64310,64310],"mapped",[1494,1468]],[[64311,64311],"disallowed"],[[64312,64312],"mapped",[1496,1468]],[[64313,64313],"mapped",[1497,1468]],[[64314,64314],"mapped",[1498,1468]],[[64315,64315],"mapped",[1499,1468]],[[64316,64316],"mapped",[1500,1468]],[[64317,64317],"disallowed"],[[64318,64318],"mapped",[1502,1468]],[[64319,64319],"disallowed"],[[64320,64320],"mapped",[1504,1468]],[[64321,64321],"mapped",[1505,1468]],[[64322,64322],"disallowed"],[[64323,64323],"mapped",[1507,1468]],[[64324,64324],"mapped",[1508,1468]],[[64325,64325],"disallowed"],[[64326,64326],"mapped",[1510,1468]],[[64327,64327],"mapped",[1511,1468]],[[64328,64328],"mapped",[1512,1468]],[[64329,64329],"mapped",[1513,1468]],[[64330,64330],"mapped",[1514,1468]],[[64331,64331],"mapped",[1493,1465]],[[64332,64332],"mapped",[1489,1471]],[[64333,64333],"mapped",[1499,1471]],[[64334,64334],"mapped",[1508,1471]],[[64335,64335],"mapped",[1488,1500]],[[64336,64337],"mapped",[1649]],[[64338,64341],"mapped",[1659]],[[64342,64345],"mapped",[1662]],[[64346,64349],"mapped",[1664]],[[64350,64353],"mapped",[1658]],[[64354,64357],"mapped",[1663]],[[64358,64361],"mapped",[1657]],[[64362,64365],"mapped",[1700]],[[64366,64369],"mapped",[1702]],[[64370,64373],"mapped",[1668]],[[64374,64377],"mapped",[1667]],[[64378,64381],"mapped",[1670]],[[64382,64385],"mapped",[1671]],[[64386,64387],"mapped",[1677]],[[64388,64389],"mapped",[1676]],[[64390,64391],"mapped",[1678]],[[64392,64393],"mapped",[1672]],[[64394,64395],"mapped",[1688]],[[64396,64397],"mapped",[1681]],[[64398,64401],"mapped",[1705]],[[64402,64405],"mapped",[1711]],[[64406,64409],"mapped",[1715]],[[64410,64413],"mapped",[1713]],[[64414,64415],"mapped",[1722]],[[64416,64419],"mapped",[1723]],[[64420,64421],"mapped",[1728]],[[64422,64425],"mapped",[1729]],[[64426,64429],"mapped",[1726]],[[64430,64431],"mapped",[1746]],[[64432,64433],"mapped",[1747]],[[64434,64449],"valid",[],"NV8"],[[64450,64466],"disallowed"],[[64467,64470],"mapped",[1709]],[[64471,64472],"mapped",[1735]],[[64473,64474],"mapped",[1734]],[[64475,64476],"mapped",[1736]],[[64477,64477],"mapped",[1735,1652]],[[64478,64479],"mapped",[1739]],[[64480,64481],"mapped",[1733]],[[64482,64483],"mapped",[1737]],[[64484,64487],"mapped",[1744]],[[64488,64489],"mapped",[1609]],[[64490,64491],"mapped",[1574,1575]],[[64492,64493],"mapped",[1574,1749]],[[64494,64495],"mapped",[1574,1608]],[[64496,64497],"mapped",[1574,1735]],[[64498,64499],"mapped",[1574,1734]],[[64500,64501],"mapped",[1574,1736]],[[64502,64504],"mapped",[1574,1744]],[[64505,64507],"mapped",[1574,1609]],[[64508,64511],"mapped",[1740]],[[64512,64512],"mapped",[1574,1580]],[[64513,64513],"mapped",[1574,1581]],[[64514,64514],"mapped",[1574,1605]],[[64515,64515],"mapped",[1574,1609]],[[64516,64516],"mapped",[1574,1610]],[[64517,64517],"mapped",[1576,1580]],[[64518,64518],"mapped",[1576,1581]],[[64519,64519],"mapped",[1576,1582]],[[64520,64520],"mapped",[1576,1605]],[[64521,64521],"mapped",[1576,1609]],[[64522,64522],"mapped",[1576,1610]],[[64523,64523],"mapped",[1578,1580]],[[64524,64524],"mapped",[1578,1581]],[[64525,64525],"mapped",[1578,1582]],[[64526,64526],"mapped",[1578,1605]],[[64527,64527],"mapped",[1578,1609]],[[64528,64528],"mapped",[1578,1610]],[[64529,64529],"mapped",[1579,1580]],[[64530,64530],"mapped",[1579,1605]],[[64531,64531],"mapped",[1579,1609]],[[64532,64532],"mapped",[1579,1610]],[[64533,64533],"mapped",[1580,1581]],[[64534,64534],"mapped",[1580,1605]],[[64535,64535],"mapped",[1581,1580]],[[64536,64536],"mapped",[1581,1605]],[[64537,64537],"mapped",[1582,1580]],[[64538,64538],"mapped",[1582,1581]],[[64539,64539],"mapped",[1582,1605]],[[64540,64540],"mapped",[1587,1580]],[[64541,64541],"mapped",[1587,1581]],[[64542,64542],"mapped",[1587,1582]],[[64543,64543],"mapped",[1587,1605]],[[64544,64544],"mapped",[1589,1581]],[[64545,64545],"mapped",[1589,1605]],[[64546,64546],"mapped",[1590,1580]],[[64547,64547],"mapped",[1590,1581]],[[64548,64548],"mapped",[1590,1582]],[[64549,64549],"mapped",[1590,1605]],[[64550,64550],"mapped",[1591,1581]],[[64551,64551],"mapped",[1591,1605]],[[64552,64552],"mapped",[1592,1605]],[[64553,64553],"mapped",[1593,1580]],[[64554,64554],"mapped",[1593,1605]],[[64555,64555],"mapped",[1594,1580]],[[64556,64556],"mapped",[1594,1605]],[[64557,64557],"mapped",[1601,1580]],[[64558,64558],"mapped",[1601,1581]],[[64559,64559],"mapped",[1601,1582]],[[64560,64560],"mapped",[1601,1605]],[[64561,64561],"mapped",[1601,1609]],[[64562,64562],"mapped",[1601,1610]],[[64563,64563],"mapped",[1602,1581]],[[64564,64564],"mapped",[1602,1605]],[[64565,64565],"mapped",[1602,1609]],[[64566,64566],"mapped",[1602,1610]],[[64567,64567],"mapped",[1603,1575]],[[64568,64568],"mapped",[1603,1580]],[[64569,64569],"mapped",[1603,1581]],[[64570,64570],"mapped",[1603,1582]],[[64571,64571],"mapped",[1603,1604]],[[64572,64572],"mapped",[1603,1605]],[[64573,64573],"mapped",[1603,1609]],[[64574,64574],"mapped",[1603,1610]],[[64575,64575],"mapped",[1604,1580]],[[64576,64576],"mapped",[1604,1581]],[[64577,64577],"mapped",[1604,1582]],[[64578,64578],"mapped",[1604,1605]],[[64579,64579],"mapped",[1604,1609]],[[64580,64580],"mapped",[1604,1610]],[[64581,64581],"mapped",[1605,1580]],[[64582,64582],"mapped",[1605,1581]],[[64583,64583],"mapped",[1605,1582]],[[64584,64584],"mapped",[1605,1605]],[[64585,64585],"mapped",[1605,1609]],[[64586,64586],"mapped",[1605,1610]],[[64587,64587],"mapped",[1606,1580]],[[64588,64588],"mapped",[1606,1581]],[[64589,64589],"mapped",[1606,1582]],[[64590,64590],"mapped",[1606,1605]],[[64591,64591],"mapped",[1606,1609]],[[64592,64592],"mapped",[1606,1610]],[[64593,64593],"mapped",[1607,1580]],[[64594,64594],"mapped",[1607,1605]],[[64595,64595],"mapped",[1607,1609]],[[64596,64596],"mapped",[1607,1610]],[[64597,64597],"mapped",[1610,1580]],[[64598,64598],"mapped",[1610,1581]],[[64599,64599],"mapped",[1610,1582]],[[64600,64600],"mapped",[1610,1605]],[[64601,64601],"mapped",[1610,1609]],[[64602,64602],"mapped",[1610,1610]],[[64603,64603],"mapped",[1584,1648]],[[64604,64604],"mapped",[1585,1648]],[[64605,64605],"mapped",[1609,1648]],[[64606,64606],"disallowed_STD3_mapped",[32,1612,1617]],[[64607,64607],"disallowed_STD3_mapped",[32,1613,1617]],[[64608,64608],"disallowed_STD3_mapped",[32,1614,1617]],[[64609,64609],"disallowed_STD3_mapped",[32,1615,1617]],[[64610,64610],"disallowed_STD3_mapped",[32,1616,1617]],[[64611,64611],"disallowed_STD3_mapped",[32,1617,1648]],[[64612,64612],"mapped",[1574,1585]],[[64613,64613],"mapped",[1574,1586]],[[64614,64614],"mapped",[1574,1605]],[[64615,64615],"mapped",[1574,1606]],[[64616,64616],"mapped",[1574,1609]],[[64617,64617],"mapped",[1574,1610]],[[64618,64618],"mapped",[1576,1585]],[[64619,64619],"mapped",[1576,1586]],[[64620,64620],"mapped",[1576,1605]],[[64621,64621],"mapped",[1576,1606]],[[64622,64622],"mapped",[1576,1609]],[[64623,64623],"mapped",[1576,1610]],[[64624,64624],"mapped",[1578,1585]],[[64625,64625],"mapped",[1578,1586]],[[64626,64626],"mapped",[1578,1605]],[[64627,64627],"mapped",[1578,1606]],[[64628,64628],"mapped",[1578,1609]],[[64629,64629],"mapped",[1578,1610]],[[64630,64630],"mapped",[1579,1585]],[[64631,64631],"mapped",[1579,1586]],[[64632,64632],"mapped",[1579,1605]],[[64633,64633],"mapped",[1579,1606]],[[64634,64634],"mapped",[1579,1609]],[[64635,64635],"mapped",[1579,1610]],[[64636,64636],"mapped",[1601,1609]],[[64637,64637],"mapped",[1601,1610]],[[64638,64638],"mapped",[1602,1609]],[[64639,64639],"mapped",[1602,1610]],[[64640,64640],"mapped",[1603,1575]],[[64641,64641],"mapped",[1603,1604]],[[64642,64642],"mapped",[1603,1605]],[[64643,64643],"mapped",[1603,1609]],[[64644,64644],"mapped",[1603,1610]],[[64645,64645],"mapped",[1604,1605]],[[64646,64646],"mapped",[1604,1609]],[[64647,64647],"mapped",[1604,1610]],[[64648,64648],"mapped",[1605,1575]],[[64649,64649],"mapped",[1605,1605]],[[64650,64650],"mapped",[1606,1585]],[[64651,64651],"mapped",[1606,1586]],[[64652,64652],"mapped",[1606,1605]],[[64653,64653],"mapped",[1606,1606]],[[64654,64654],"mapped",[1606,1609]],[[64655,64655],"mapped",[1606,1610]],[[64656,64656],"mapped",[1609,1648]],[[64657,64657],"mapped",[1610,1585]],[[64658,64658],"mapped",[1610,1586]],[[64659,64659],"mapped",[1610,1605]],[[64660,64660],"mapped",[1610,1606]],[[64661,64661],"mapped",[1610,1609]],[[64662,64662],"mapped",[1610,1610]],[[64663,64663],"mapped",[1574,1580]],[[64664,64664],"mapped",[1574,1581]],[[64665,64665],"mapped",[1574,1582]],[[64666,64666],"mapped",[1574,1605]],[[64667,64667],"mapped",[1574,1607]],[[64668,64668],"mapped",[1576,1580]],[[64669,64669],"mapped",[1576,1581]],[[64670,64670],"mapped",[1576,1582]],[[64671,64671],"mapped",[1576,1605]],[[64672,64672],"mapped",[1576,1607]],[[64673,64673],"mapped",[1578,1580]],[[64674,64674],"mapped",[1578,1581]],[[64675,64675],"mapped",[1578,1582]],[[64676,64676],"mapped",[1578,1605]],[[64677,64677],"mapped",[1578,1607]],[[64678,64678],"mapped",[1579,1605]],[[64679,64679],"mapped",[1580,1581]],[[64680,64680],"mapped",[1580,1605]],[[64681,64681],"mapped",[1581,1580]],[[64682,64682],"mapped",[1581,1605]],[[64683,64683],"mapped",[1582,1580]],[[64684,64684],"mapped",[1582,1605]],[[64685,64685],"mapped",[1587,1580]],[[64686,64686],"mapped",[1587,1581]],[[64687,64687],"mapped",[1587,1582]],[[64688,64688],"mapped",[1587,1605]],[[64689,64689],"mapped",[1589,1581]],[[64690,64690],"mapped",[1589,1582]],[[64691,64691],"mapped",[1589,1605]],[[64692,64692],"mapped",[1590,1580]],[[64693,64693],"mapped",[1590,1581]],[[64694,64694],"mapped",[1590,1582]],[[64695,64695],"mapped",[1590,1605]],[[64696,64696],"mapped",[1591,1581]],[[64697,64697],"mapped",[1592,1605]],[[64698,64698],"mapped",[1593,1580]],[[64699,64699],"mapped",[1593,1605]],[[64700,64700],"mapped",[1594,1580]],[[64701,64701],"mapped",[1594,1605]],[[64702,64702],"mapped",[1601,1580]],[[64703,64703],"mapped",[1601,1581]],[[64704,64704],"mapped",[1601,1582]],[[64705,64705],"mapped",[1601,1605]],[[64706,64706],"mapped",[1602,1581]],[[64707,64707],"mapped",[1602,1605]],[[64708,64708],"mapped",[1603,1580]],[[64709,64709],"mapped",[1603,1581]],[[64710,64710],"mapped",[1603,1582]],[[64711,64711],"mapped",[1603,1604]],[[64712,64712],"mapped",[1603,1605]],[[64713,64713],"mapped",[1604,1580]],[[64714,64714],"mapped",[1604,1581]],[[64715,64715],"mapped",[1604,1582]],[[64716,64716],"mapped",[1604,1605]],[[64717,64717],"mapped",[1604,1607]],[[64718,64718],"mapped",[1605,1580]],[[64719,64719],"mapped",[1605,1581]],[[64720,64720],"mapped",[1605,1582]],[[64721,64721],"mapped",[1605,1605]],[[64722,64722],"mapped",[1606,1580]],[[64723,64723],"mapped",[1606,1581]],[[64724,64724],"mapped",[1606,1582]],[[64725,64725],"mapped",[1606,1605]],[[64726,64726],"mapped",[1606,1607]],[[64727,64727],"mapped",[1607,1580]],[[64728,64728],"mapped",[1607,1605]],[[64729,64729],"mapped",[1607,1648]],[[64730,64730],"mapped",[1610,1580]],[[64731,64731],"mapped",[1610,1581]],[[64732,64732],"mapped",[1610,1582]],[[64733,64733],"mapped",[1610,1605]],[[64734,64734],"mapped",[1610,1607]],[[64735,64735],"mapped",[1574,1605]],[[64736,64736],"mapped",[1574,1607]],[[64737,64737],"mapped",[1576,1605]],[[64738,64738],"mapped",[1576,1607]],[[64739,64739],"mapped",[1578,1605]],[[64740,64740],"mapped",[1578,1607]],[[64741,64741],"mapped",[1579,1605]],[[64742,64742],"mapped",[1579,1607]],[[64743,64743],"mapped",[1587,1605]],[[64744,64744],"mapped",[1587,1607]],[[64745,64745],"mapped",[1588,1605]],[[64746,64746],"mapped",[1588,1607]],[[64747,64747],"mapped",[1603,1604]],[[64748,64748],"mapped",[1603,1605]],[[64749,64749],"mapped",[1604,1605]],[[64750,64750],"mapped",[1606,1605]],[[64751,64751],"mapped",[1606,1607]],[[64752,64752],"mapped",[1610,1605]],[[64753,64753],"mapped",[1610,1607]],[[64754,64754],"mapped",[1600,1614,1617]],[[64755,64755],"mapped",[1600,1615,1617]],[[64756,64756],"mapped",[1600,1616,1617]],[[64757,64757],"mapped",[1591,1609]],[[64758,64758],"mapped",[1591,1610]],[[64759,64759],"mapped",[1593,1609]],[[64760,64760],"mapped",[1593,1610]],[[64761,64761],"mapped",[1594,1609]],[[64762,64762],"mapped",[1594,1610]],[[64763,64763],"mapped",[1587,1609]],[[64764,64764],"mapped",[1587,1610]],[[64765,64765],"mapped",[1588,1609]],[[64766,64766],"mapped",[1588,1610]],[[64767,64767],"mapped",[1581,1609]],[[64768,64768],"mapped",[1581,1610]],[[64769,64769],"mapped",[1580,1609]],[[64770,64770],"mapped",[1580,1610]],[[64771,64771],"mapped",[1582,1609]],[[64772,64772],"mapped",[1582,1610]],[[64773,64773],"mapped",[1589,1609]],[[64774,64774],"mapped",[1589,1610]],[[64775,64775],"mapped",[1590,1609]],[[64776,64776],"mapped",[1590,1610]],[[64777,64777],"mapped",[1588,1580]],[[64778,64778],"mapped",[1588,1581]],[[64779,64779],"mapped",[1588,1582]],[[64780,64780],"mapped",[1588,1605]],[[64781,64781],"mapped",[1588,1585]],[[64782,64782],"mapped",[1587,1585]],[[64783,64783],"mapped",[1589,1585]],[[64784,64784],"mapped",[1590,1585]],[[64785,64785],"mapped",[1591,1609]],[[64786,64786],"mapped",[1591,1610]],[[64787,64787],"mapped",[1593,1609]],[[64788,64788],"mapped",[1593,1610]],[[64789,64789],"mapped",[1594,1609]],[[64790,64790],"mapped",[1594,1610]],[[64791,64791],"mapped",[1587,1609]],[[64792,64792],"mapped",[1587,1610]],[[64793,64793],"mapped",[1588,1609]],[[64794,64794],"mapped",[1588,1610]],[[64795,64795],"mapped",[1581,1609]],[[64796,64796],"mapped",[1581,1610]],[[64797,64797],"mapped",[1580,1609]],[[64798,64798],"mapped",[1580,1610]],[[64799,64799],"mapped",[1582,1609]],[[64800,64800],"mapped",[1582,1610]],[[64801,64801],"mapped",[1589,1609]],[[64802,64802],"mapped",[1589,1610]],[[64803,64803],"mapped",[1590,1609]],[[64804,64804],"mapped",[1590,1610]],[[64805,64805],"mapped",[1588,1580]],[[64806,64806],"mapped",[1588,1581]],[[64807,64807],"mapped",[1588,1582]],[[64808,64808],"mapped",[1588,1605]],[[64809,64809],"mapped",[1588,1585]],[[64810,64810],"mapped",[1587,1585]],[[64811,64811],"mapped",[1589,1585]],[[64812,64812],"mapped",[1590,1585]],[[64813,64813],"mapped",[1588,1580]],[[64814,64814],"mapped",[1588,1581]],[[64815,64815],"mapped",[1588,1582]],[[64816,64816],"mapped",[1588,1605]],[[64817,64817],"mapped",[1587,1607]],[[64818,64818],"mapped",[1588,1607]],[[64819,64819],"mapped",[1591,1605]],[[64820,64820],"mapped",[1587,1580]],[[64821,64821],"mapped",[1587,1581]],[[64822,64822],"mapped",[1587,1582]],[[64823,64823],"mapped",[1588,1580]],[[64824,64824],"mapped",[1588,1581]],[[64825,64825],"mapped",[1588,1582]],[[64826,64826],"mapped",[1591,1605]],[[64827,64827],"mapped",[1592,1605]],[[64828,64829],"mapped",[1575,1611]],[[64830,64831],"valid",[],"NV8"],[[64832,64847],"disallowed"],[[64848,64848],"mapped",[1578,1580,1605]],[[64849,64850],"mapped",[1578,1581,1580]],[[64851,64851],"mapped",[1578,1581,1605]],[[64852,64852],"mapped",[1578,1582,1605]],[[64853,64853],"mapped",[1578,1605,1580]],[[64854,64854],"mapped",[1578,1605,1581]],[[64855,64855],"mapped",[1578,1605,1582]],[[64856,64857],"mapped",[1580,1605,1581]],[[64858,64858],"mapped",[1581,1605,1610]],[[64859,64859],"mapped",[1581,1605,1609]],[[64860,64860],"mapped",[1587,1581,1580]],[[64861,64861],"mapped",[1587,1580,1581]],[[64862,64862],"mapped",[1587,1580,1609]],[[64863,64864],"mapped",[1587,1605,1581]],[[64865,64865],"mapped",[1587,1605,1580]],[[64866,64867],"mapped",[1587,1605,1605]],[[64868,64869],"mapped",[1589,1581,1581]],[[64870,64870],"mapped",[1589,1605,1605]],[[64871,64872],"mapped",[1588,1581,1605]],[[64873,64873],"mapped",[1588,1580,1610]],[[64874,64875],"mapped",[1588,1605,1582]],[[64876,64877],"mapped",[1588,1605,1605]],[[64878,64878],"mapped",[1590,1581,1609]],[[64879,64880],"mapped",[1590,1582,1605]],[[64881,64882],"mapped",[1591,1605,1581]],[[64883,64883],"mapped",[1591,1605,1605]],[[64884,64884],"mapped",[1591,1605,1610]],[[64885,64885],"mapped",[1593,1580,1605]],[[64886,64887],"mapped",[1593,1605,1605]],[[64888,64888],"mapped",[1593,1605,1609]],[[64889,64889],"mapped",[1594,1605,1605]],[[64890,64890],"mapped",[1594,1605,1610]],[[64891,64891],"mapped",[1594,1605,1609]],[[64892,64893],"mapped",[1601,1582,1605]],[[64894,64894],"mapped",[1602,1605,1581]],[[64895,64895],"mapped",[1602,1605,1605]],[[64896,64896],"mapped",[1604,1581,1605]],[[64897,64897],"mapped",[1604,1581,1610]],[[64898,64898],"mapped",[1604,1581,1609]],[[64899,64900],"mapped",[1604,1580,1580]],[[64901,64902],"mapped",[1604,1582,1605]],[[64903,64904],"mapped",[1604,1605,1581]],[[64905,64905],"mapped",[1605,1581,1580]],[[64906,64906],"mapped",[1605,1581,1605]],[[64907,64907],"mapped",[1605,1581,1610]],[[64908,64908],"mapped",[1605,1580,1581]],[[64909,64909],"mapped",[1605,1580,1605]],[[64910,64910],"mapped",[1605,1582,1580]],[[64911,64911],"mapped",[1605,1582,1605]],[[64912,64913],"disallowed"],[[64914,64914],"mapped",[1605,1580,1582]],[[64915,64915],"mapped",[1607,1605,1580]],[[64916,64916],"mapped",[1607,1605,1605]],[[64917,64917],"mapped",[1606,1581,1605]],[[64918,64918],"mapped",[1606,1581,1609]],[[64919,64920],"mapped",[1606,1580,1605]],[[64921,64921],"mapped",[1606,1580,1609]],[[64922,64922],"mapped",[1606,1605,1610]],[[64923,64923],"mapped",[1606,1605,1609]],[[64924,64925],"mapped",[1610,1605,1605]],[[64926,64926],"mapped",[1576,1582,1610]],[[64927,64927],"mapped",[1578,1580,1610]],[[64928,64928],"mapped",[1578,1580,1609]],[[64929,64929],"mapped",[1578,1582,1610]],[[64930,64930],"mapped",[1578,1582,1609]],[[64931,64931],"mapped",[1578,1605,1610]],[[64932,64932],"mapped",[1578,1605,1609]],[[64933,64933],"mapped",[1580,1605,1610]],[[64934,64934],"mapped",[1580,1581,1609]],[[64935,64935],"mapped",[1580,1605,1609]],[[64936,64936],"mapped",[1587,1582,1609]],[[64937,64937],"mapped",[1589,1581,1610]],[[64938,64938],"mapped",[1588,1581,1610]],[[64939,64939],"mapped",[1590,1581,1610]],[[64940,64940],"mapped",[1604,1580,1610]],[[64941,64941],"mapped",[1604,1605,1610]],[[64942,64942],"mapped",[1610,1581,1610]],[[64943,64943],"mapped",[1610,1580,1610]],[[64944,64944],"mapped",[1610,1605,1610]],[[64945,64945],"mapped",[1605,1605,1610]],[[64946,64946],"mapped",[1602,1605,1610]],[[64947,64947],"mapped",[1606,1581,1610]],[[64948,64948],"mapped",[1602,1605,1581]],[[64949,64949],"mapped",[1604,1581,1605]],[[64950,64950],"mapped",[1593,1605,1610]],[[64951,64951],"mapped",[1603,1605,1610]],[[64952,64952],"mapped",[1606,1580,1581]],[[64953,64953],"mapped",[1605,1582,1610]],[[64954,64954],"mapped",[1604,1580,1605]],[[64955,64955],"mapped",[1603,1605,1605]],[[64956,64956],"mapped",[1604,1580,1605]],[[64957,64957],"mapped",[1606,1580,1581]],[[64958,64958],"mapped",[1580,1581,1610]],[[64959,64959],"mapped",[1581,1580,1610]],[[64960,64960],"mapped",[1605,1580,1610]],[[64961,64961],"mapped",[1601,1605,1610]],[[64962,64962],"mapped",[1576,1581,1610]],[[64963,64963],"mapped",[1603,1605,1605]],[[64964,64964],"mapped",[1593,1580,1605]],[[64965,64965],"mapped",[1589,1605,1605]],[[64966,64966],"mapped",[1587,1582,1610]],[[64967,64967],"mapped",[1606,1580,1610]],[[64968,64975],"disallowed"],[[64976,65007],"disallowed"],[[65008,65008],"mapped",[1589,1604,1746]],[[65009,65009],"mapped",[1602,1604,1746]],[[65010,65010],"mapped",[1575,1604,1604,1607]],[[65011,65011],"mapped",[1575,1603,1576,1585]],[[65012,65012],"mapped",[1605,1581,1605,1583]],[[65013,65013],"mapped",[1589,1604,1593,1605]],[[65014,65014],"mapped",[1585,1587,1608,1604]],[[65015,65015],"mapped",[1593,1604,1610,1607]],[[65016,65016],"mapped",[1608,1587,1604,1605]],[[65017,65017],"mapped",[1589,1604,1609]],[[65018,65018],"disallowed_STD3_mapped",[1589,1604,1609,32,1575,1604,1604,1607,32,1593,1604,1610,1607,32,1608,1587,1604,1605]],[[65019,65019],"disallowed_STD3_mapped",[1580,1604,32,1580,1604,1575,1604,1607]],[[65020,65020],"mapped",[1585,1740,1575,1604]],[[65021,65021],"valid",[],"NV8"],[[65022,65023],"disallowed"],[[65024,65039],"ignored"],[[65040,65040],"disallowed_STD3_mapped",[44]],[[65041,65041],"mapped",[12289]],[[65042,65042],"disallowed"],[[65043,65043],"disallowed_STD3_mapped",[58]],[[65044,65044],"disallowed_STD3_mapped",[59]],[[65045,65045],"disallowed_STD3_mapped",[33]],[[65046,65046],"disallowed_STD3_mapped",[63]],[[65047,65047],"mapped",[12310]],[[65048,65048],"mapped",[12311]],[[65049,65049],"disallowed"],[[65050,65055],"disallowed"],[[65056,65059],"valid"],[[65060,65062],"valid"],[[65063,65069],"valid"],[[65070,65071],"valid"],[[65072,65072],"disallowed"],[[65073,65073],"mapped",[8212]],[[65074,65074],"mapped",[8211]],[[65075,65076],"disallowed_STD3_mapped",[95]],[[65077,65077],"disallowed_STD3_mapped",[40]],[[65078,65078],"disallowed_STD3_mapped",[41]],[[65079,65079],"disallowed_STD3_mapped",[123]],[[65080,65080],"disallowed_STD3_mapped",[125]],[[65081,65081],"mapped",[12308]],[[65082,65082],"mapped",[12309]],[[65083,65083],"mapped",[12304]],[[65084,65084],"mapped",[12305]],[[65085,65085],"mapped",[12298]],[[65086,65086],"mapped",[12299]],[[65087,65087],"mapped",[12296]],[[65088,65088],"mapped",[12297]],[[65089,65089],"mapped",[12300]],[[65090,65090],"mapped",[12301]],[[65091,65091],"mapped",[12302]],[[65092,65092],"mapped",[12303]],[[65093,65094],"valid",[],"NV8"],[[65095,65095],"disallowed_STD3_mapped",[91]],[[65096,65096],"disallowed_STD3_mapped",[93]],[[65097,65100],"disallowed_STD3_mapped",[32,773]],[[65101,65103],"disallowed_STD3_mapped",[95]],[[65104,65104],"disallowed_STD3_mapped",[44]],[[65105,65105],"mapped",[12289]],[[65106,65106],"disallowed"],[[65107,65107],"disallowed"],[[65108,65108],"disallowed_STD3_mapped",[59]],[[65109,65109],"disallowed_STD3_mapped",[58]],[[65110,65110],"disallowed_STD3_mapped",[63]],[[65111,65111],"disallowed_STD3_mapped",[33]],[[65112,65112],"mapped",[8212]],[[65113,65113],"disallowed_STD3_mapped",[40]],[[65114,65114],"disallowed_STD3_mapped",[41]],[[65115,65115],"disallowed_STD3_mapped",[123]],[[65116,65116],"disallowed_STD3_mapped",[125]],[[65117,65117],"mapped",[12308]],[[65118,65118],"mapped",[12309]],[[65119,65119],"disallowed_STD3_mapped",[35]],[[65120,65120],"disallowed_STD3_mapped",[38]],[[65121,65121],"disallowed_STD3_mapped",[42]],[[65122,65122],"disallowed_STD3_mapped",[43]],[[65123,65123],"mapped",[45]],[[65124,65124],"disallowed_STD3_mapped",[60]],[[65125,65125],"disallowed_STD3_mapped",[62]],[[65126,65126],"disallowed_STD3_mapped",[61]],[[65127,65127],"disallowed"],[[65128,65128],"disallowed_STD3_mapped",[92]],[[65129,65129],"disallowed_STD3_mapped",[36]],[[65130,65130],"disallowed_STD3_mapped",[37]],[[65131,65131],"disallowed_STD3_mapped",[64]],[[65132,65135],"disallowed"],[[65136,65136],"disallowed_STD3_mapped",[32,1611]],[[65137,65137],"mapped",[1600,1611]],[[65138,65138],"disallowed_STD3_mapped",[32,1612]],[[65139,65139],"valid"],[[65140,65140],"disallowed_STD3_mapped",[32,1613]],[[65141,65141],"disallowed"],[[65142,65142],"disallowed_STD3_mapped",[32,1614]],[[65143,65143],"mapped",[1600,1614]],[[65144,65144],"disallowed_STD3_mapped",[32,1615]],[[65145,65145],"mapped",[1600,1615]],[[65146,65146],"disallowed_STD3_mapped",[32,1616]],[[65147,65147],"mapped",[1600,1616]],[[65148,65148],"disallowed_STD3_mapped",[32,1617]],[[65149,65149],"mapped",[1600,1617]],[[65150,65150],"disallowed_STD3_mapped",[32,1618]],[[65151,65151],"mapped",[1600,1618]],[[65152,65152],"mapped",[1569]],[[65153,65154],"mapped",[1570]],[[65155,65156],"mapped",[1571]],[[65157,65158],"mapped",[1572]],[[65159,65160],"mapped",[1573]],[[65161,65164],"mapped",[1574]],[[65165,65166],"mapped",[1575]],[[65167,65170],"mapped",[1576]],[[65171,65172],"mapped",[1577]],[[65173,65176],"mapped",[1578]],[[65177,65180],"mapped",[1579]],[[65181,65184],"mapped",[1580]],[[65185,65188],"mapped",[1581]],[[65189,65192],"mapped",[1582]],[[65193,65194],"mapped",[1583]],[[65195,65196],"mapped",[1584]],[[65197,65198],"mapped",[1585]],[[65199,65200],"mapped",[1586]],[[65201,65204],"mapped",[1587]],[[65205,65208],"mapped",[1588]],[[65209,65212],"mapped",[1589]],[[65213,65216],"mapped",[1590]],[[65217,65220],"mapped",[1591]],[[65221,65224],"mapped",[1592]],[[65225,65228],"mapped",[1593]],[[65229,65232],"mapped",[1594]],[[65233,65236],"mapped",[1601]],[[65237,65240],"mapped",[1602]],[[65241,65244],"mapped",[1603]],[[65245,65248],"mapped",[1604]],[[65249,65252],"mapped",[1605]],[[65253,65256],"mapped",[1606]],[[65257,65260],"mapped",[1607]],[[65261,65262],"mapped",[1608]],[[65263,65264],"mapped",[1609]],[[65265,65268],"mapped",[1610]],[[65269,65270],"mapped",[1604,1570]],[[65271,65272],"mapped",[1604,1571]],[[65273,65274],"mapped",[1604,1573]],[[65275,65276],"mapped",[1604,1575]],[[65277,65278],"disallowed"],[[65279,65279],"ignored"],[[65280,65280],"disallowed"],[[65281,65281],"disallowed_STD3_mapped",[33]],[[65282,65282],"disallowed_STD3_mapped",[34]],[[65283,65283],"disallowed_STD3_mapped",[35]],[[65284,65284],"disallowed_STD3_mapped",[36]],[[65285,65285],"disallowed_STD3_mapped",[37]],[[65286,65286],"disallowed_STD3_mapped",[38]],[[65287,65287],"disallowed_STD3_mapped",[39]],[[65288,65288],"disallowed_STD3_mapped",[40]],[[65289,65289],"disallowed_STD3_mapped",[41]],[[65290,65290],"disallowed_STD3_mapped",[42]],[[65291,65291],"disallowed_STD3_mapped",[43]],[[65292,65292],"disallowed_STD3_mapped",[44]],[[65293,65293],"mapped",[45]],[[65294,65294],"mapped",[46]],[[65295,65295],"disallowed_STD3_mapped",[47]],[[65296,65296],"mapped",[48]],[[65297,65297],"mapped",[49]],[[65298,65298],"mapped",[50]],[[65299,65299],"mapped",[51]],[[65300,65300],"mapped",[52]],[[65301,65301],"mapped",[53]],[[65302,65302],"mapped",[54]],[[65303,65303],"mapped",[55]],[[65304,65304],"mapped",[56]],[[65305,65305],"mapped",[57]],[[65306,65306],"disallowed_STD3_mapped",[58]],[[65307,65307],"disallowed_STD3_mapped",[59]],[[65308,65308],"disallowed_STD3_mapped",[60]],[[65309,65309],"disallowed_STD3_mapped",[61]],[[65310,65310],"disallowed_STD3_mapped",[62]],[[65311,65311],"disallowed_STD3_mapped",[63]],[[65312,65312],"disallowed_STD3_mapped",[64]],[[65313,65313],"mapped",[97]],[[65314,65314],"mapped",[98]],[[65315,65315],"mapped",[99]],[[65316,65316],"mapped",[100]],[[65317,65317],"mapped",[101]],[[65318,65318],"mapped",[102]],[[65319,65319],"mapped",[103]],[[65320,65320],"mapped",[104]],[[65321,65321],"mapped",[105]],[[65322,65322],"mapped",[106]],[[65323,65323],"mapped",[107]],[[65324,65324],"mapped",[108]],[[65325,65325],"mapped",[109]],[[65326,65326],"mapped",[110]],[[65327,65327],"mapped",[111]],[[65328,65328],"mapped",[112]],[[65329,65329],"mapped",[113]],[[65330,65330],"mapped",[114]],[[65331,65331],"mapped",[115]],[[65332,65332],"mapped",[116]],[[65333,65333],"mapped",[117]],[[65334,65334],"mapped",[118]],[[65335,65335],"mapped",[119]],[[65336,65336],"mapped",[120]],[[65337,65337],"mapped",[121]],[[65338,65338],"mapped",[122]],[[65339,65339],"disallowed_STD3_mapped",[91]],[[65340,65340],"disallowed_STD3_mapped",[92]],[[65341,65341],"disallowed_STD3_mapped",[93]],[[65342,65342],"disallowed_STD3_mapped",[94]],[[65343,65343],"disallowed_STD3_mapped",[95]],[[65344,65344],"disallowed_STD3_mapped",[96]],[[65345,65345],"mapped",[97]],[[65346,65346],"mapped",[98]],[[65347,65347],"mapped",[99]],[[65348,65348],"mapped",[100]],[[65349,65349],"mapped",[101]],[[65350,65350],"mapped",[102]],[[65351,65351],"mapped",[103]],[[65352,65352],"mapped",[104]],[[65353,65353],"mapped",[105]],[[65354,65354],"mapped",[106]],[[65355,65355],"mapped",[107]],[[65356,65356],"mapped",[108]],[[65357,65357],"mapped",[109]],[[65358,65358],"mapped",[110]],[[65359,65359],"mapped",[111]],[[65360,65360],"mapped",[112]],[[65361,65361],"mapped",[113]],[[65362,65362],"mapped",[114]],[[65363,65363],"mapped",[115]],[[65364,65364],"mapped",[116]],[[65365,65365],"mapped",[117]],[[65366,65366],"mapped",[118]],[[65367,65367],"mapped",[119]],[[65368,65368],"mapped",[120]],[[65369,65369],"mapped",[121]],[[65370,65370],"mapped",[122]],[[65371,65371],"disallowed_STD3_mapped",[123]],[[65372,65372],"disallowed_STD3_mapped",[124]],[[65373,65373],"disallowed_STD3_mapped",[125]],[[65374,65374],"disallowed_STD3_mapped",[126]],[[65375,65375],"mapped",[10629]],[[65376,65376],"mapped",[10630]],[[65377,65377],"mapped",[46]],[[65378,65378],"mapped",[12300]],[[65379,65379],"mapped",[12301]],[[65380,65380],"mapped",[12289]],[[65381,65381],"mapped",[12539]],[[65382,65382],"mapped",[12530]],[[65383,65383],"mapped",[12449]],[[65384,65384],"mapped",[12451]],[[65385,65385],"mapped",[12453]],[[65386,65386],"mapped",[12455]],[[65387,65387],"mapped",[12457]],[[65388,65388],"mapped",[12515]],[[65389,65389],"mapped",[12517]],[[65390,65390],"mapped",[12519]],[[65391,65391],"mapped",[12483]],[[65392,65392],"mapped",[12540]],[[65393,65393],"mapped",[12450]],[[65394,65394],"mapped",[12452]],[[65395,65395],"mapped",[12454]],[[65396,65396],"mapped",[12456]],[[65397,65397],"mapped",[12458]],[[65398,65398],"mapped",[12459]],[[65399,65399],"mapped",[12461]],[[65400,65400],"mapped",[12463]],[[65401,65401],"mapped",[12465]],[[65402,65402],"mapped",[12467]],[[65403,65403],"mapped",[12469]],[[65404,65404],"mapped",[12471]],[[65405,65405],"mapped",[12473]],[[65406,65406],"mapped",[12475]],[[65407,65407],"mapped",[12477]],[[65408,65408],"mapped",[12479]],[[65409,65409],"mapped",[12481]],[[65410,65410],"mapped",[12484]],[[65411,65411],"mapped",[12486]],[[65412,65412],"mapped",[12488]],[[65413,65413],"mapped",[12490]],[[65414,65414],"mapped",[12491]],[[65415,65415],"mapped",[12492]],[[65416,65416],"mapped",[12493]],[[65417,65417],"mapped",[12494]],[[65418,65418],"mapped",[12495]],[[65419,65419],"mapped",[12498]],[[65420,65420],"mapped",[12501]],[[65421,65421],"mapped",[12504]],[[65422,65422],"mapped",[12507]],[[65423,65423],"mapped",[12510]],[[65424,65424],"mapped",[12511]],[[65425,65425],"mapped",[12512]],[[65426,65426],"mapped",[12513]],[[65427,65427],"mapped",[12514]],[[65428,65428],"mapped",[12516]],[[65429,65429],"mapped",[12518]],[[65430,65430],"mapped",[12520]],[[65431,65431],"mapped",[12521]],[[65432,65432],"mapped",[12522]],[[65433,65433],"mapped",[12523]],[[65434,65434],"mapped",[12524]],[[65435,65435],"mapped",[12525]],[[65436,65436],"mapped",[12527]],[[65437,65437],"mapped",[12531]],[[65438,65438],"mapped",[12441]],[[65439,65439],"mapped",[12442]],[[65440,65440],"disallowed"],[[65441,65441],"mapped",[4352]],[[65442,65442],"mapped",[4353]],[[65443,65443],"mapped",[4522]],[[65444,65444],"mapped",[4354]],[[65445,65445],"mapped",[4524]],[[65446,65446],"mapped",[4525]],[[65447,65447],"mapped",[4355]],[[65448,65448],"mapped",[4356]],[[65449,65449],"mapped",[4357]],[[65450,65450],"mapped",[4528]],[[65451,65451],"mapped",[4529]],[[65452,65452],"mapped",[4530]],[[65453,65453],"mapped",[4531]],[[65454,65454],"mapped",[4532]],[[65455,65455],"mapped",[4533]],[[65456,65456],"mapped",[4378]],[[65457,65457],"mapped",[4358]],[[65458,65458],"mapped",[4359]],[[65459,65459],"mapped",[4360]],[[65460,65460],"mapped",[4385]],[[65461,65461],"mapped",[4361]],[[65462,65462],"mapped",[4362]],[[65463,65463],"mapped",[4363]],[[65464,65464],"mapped",[4364]],[[65465,65465],"mapped",[4365]],[[65466,65466],"mapped",[4366]],[[65467,65467],"mapped",[4367]],[[65468,65468],"mapped",[4368]],[[65469,65469],"mapped",[4369]],[[65470,65470],"mapped",[4370]],[[65471,65473],"disallowed"],[[65474,65474],"mapped",[4449]],[[65475,65475],"mapped",[4450]],[[65476,65476],"mapped",[4451]],[[65477,65477],"mapped",[4452]],[[65478,65478],"mapped",[4453]],[[65479,65479],"mapped",[4454]],[[65480,65481],"disallowed"],[[65482,65482],"mapped",[4455]],[[65483,65483],"mapped",[4456]],[[65484,65484],"mapped",[4457]],[[65485,65485],"mapped",[4458]],[[65486,65486],"mapped",[4459]],[[65487,65487],"mapped",[4460]],[[65488,65489],"disallowed"],[[65490,65490],"mapped",[4461]],[[65491,65491],"mapped",[4462]],[[65492,65492],"mapped",[4463]],[[65493,65493],"mapped",[4464]],[[65494,65494],"mapped",[4465]],[[65495,65495],"mapped",[4466]],[[65496,65497],"disallowed"],[[65498,65498],"mapped",[4467]],[[65499,65499],"mapped",[4468]],[[65500,65500],"mapped",[4469]],[[65501,65503],"disallowed"],[[65504,65504],"mapped",[162]],[[65505,65505],"mapped",[163]],[[65506,65506],"mapped",[172]],[[65507,65507],"disallowed_STD3_mapped",[32,772]],[[65508,65508],"mapped",[166]],[[65509,65509],"mapped",[165]],[[65510,65510],"mapped",[8361]],[[65511,65511],"disallowed"],[[65512,65512],"mapped",[9474]],[[65513,65513],"mapped",[8592]],[[65514,65514],"mapped",[8593]],[[65515,65515],"mapped",[8594]],[[65516,65516],"mapped",[8595]],[[65517,65517],"mapped",[9632]],[[65518,65518],"mapped",[9675]],[[65519,65528],"disallowed"],[[65529,65531],"disallowed"],[[65532,65532],"disallowed"],[[65533,65533],"disallowed"],[[65534,65535],"disallowed"],[[65536,65547],"valid"],[[65548,65548],"disallowed"],[[65549,65574],"valid"],[[65575,65575],"disallowed"],[[65576,65594],"valid"],[[65595,65595],"disallowed"],[[65596,65597],"valid"],[[65598,65598],"disallowed"],[[65599,65613],"valid"],[[65614,65615],"disallowed"],[[65616,65629],"valid"],[[65630,65663],"disallowed"],[[65664,65786],"valid"],[[65787,65791],"disallowed"],[[65792,65794],"valid",[],"NV8"],[[65795,65798],"disallowed"],[[65799,65843],"valid",[],"NV8"],[[65844,65846],"disallowed"],[[65847,65855],"valid",[],"NV8"],[[65856,65930],"valid",[],"NV8"],[[65931,65932],"valid",[],"NV8"],[[65933,65935],"disallowed"],[[65936,65947],"valid",[],"NV8"],[[65948,65951],"disallowed"],[[65952,65952],"valid",[],"NV8"],[[65953,65999],"disallowed"],[[66000,66044],"valid",[],"NV8"],[[66045,66045],"valid"],[[66046,66175],"disallowed"],[[66176,66204],"valid"],[[66205,66207],"disallowed"],[[66208,66256],"valid"],[[66257,66271],"disallowed"],[[66272,66272],"valid"],[[66273,66299],"valid",[],"NV8"],[[66300,66303],"disallowed"],[[66304,66334],"valid"],[[66335,66335],"valid"],[[66336,66339],"valid",[],"NV8"],[[66340,66351],"disallowed"],[[66352,66368],"valid"],[[66369,66369],"valid",[],"NV8"],[[66370,66377],"valid"],[[66378,66378],"valid",[],"NV8"],[[66379,66383],"disallowed"],[[66384,66426],"valid"],[[66427,66431],"disallowed"],[[66432,66461],"valid"],[[66462,66462],"disallowed"],[[66463,66463],"valid",[],"NV8"],[[66464,66499],"valid"],[[66500,66503],"disallowed"],[[66504,66511],"valid"],[[66512,66517],"valid",[],"NV8"],[[66518,66559],"disallowed"],[[66560,66560],"mapped",[66600]],[[66561,66561],"mapped",[66601]],[[66562,66562],"mapped",[66602]],[[66563,66563],"mapped",[66603]],[[66564,66564],"mapped",[66604]],[[66565,66565],"mapped",[66605]],[[66566,66566],"mapped",[66606]],[[66567,66567],"mapped",[66607]],[[66568,66568],"mapped",[66608]],[[66569,66569],"mapped",[66609]],[[66570,66570],"mapped",[66610]],[[66571,66571],"mapped",[66611]],[[66572,66572],"mapped",[66612]],[[66573,66573],"mapped",[66613]],[[66574,66574],"mapped",[66614]],[[66575,66575],"mapped",[66615]],[[66576,66576],"mapped",[66616]],[[66577,66577],"mapped",[66617]],[[66578,66578],"mapped",[66618]],[[66579,66579],"mapped",[66619]],[[66580,66580],"mapped",[66620]],[[66581,66581],"mapped",[66621]],[[66582,66582],"mapped",[66622]],[[66583,66583],"mapped",[66623]],[[66584,66584],"mapped",[66624]],[[66585,66585],"mapped",[66625]],[[66586,66586],"mapped",[66626]],[[66587,66587],"mapped",[66627]],[[66588,66588],"mapped",[66628]],[[66589,66589],"mapped",[66629]],[[66590,66590],"mapped",[66630]],[[66591,66591],"mapped",[66631]],[[66592,66592],"mapped",[66632]],[[66593,66593],"mapped",[66633]],[[66594,66594],"mapped",[66634]],[[66595,66595],"mapped",[66635]],[[66596,66596],"mapped",[66636]],[[66597,66597],"mapped",[66637]],[[66598,66598],"mapped",[66638]],[[66599,66599],"mapped",[66639]],[[66600,66637],"valid"],[[66638,66717],"valid"],[[66718,66719],"disallowed"],[[66720,66729],"valid"],[[66730,66815],"disallowed"],[[66816,66855],"valid"],[[66856,66863],"disallowed"],[[66864,66915],"valid"],[[66916,66926],"disallowed"],[[66927,66927],"valid",[],"NV8"],[[66928,67071],"disallowed"],[[67072,67382],"valid"],[[67383,67391],"disallowed"],[[67392,67413],"valid"],[[67414,67423],"disallowed"],[[67424,67431],"valid"],[[67432,67583],"disallowed"],[[67584,67589],"valid"],[[67590,67591],"disallowed"],[[67592,67592],"valid"],[[67593,67593],"disallowed"],[[67594,67637],"valid"],[[67638,67638],"disallowed"],[[67639,67640],"valid"],[[67641,67643],"disallowed"],[[67644,67644],"valid"],[[67645,67646],"disallowed"],[[67647,67647],"valid"],[[67648,67669],"valid"],[[67670,67670],"disallowed"],[[67671,67679],"valid",[],"NV8"],[[67680,67702],"valid"],[[67703,67711],"valid",[],"NV8"],[[67712,67742],"valid"],[[67743,67750],"disallowed"],[[67751,67759],"valid",[],"NV8"],[[67760,67807],"disallowed"],[[67808,67826],"valid"],[[67827,67827],"disallowed"],[[67828,67829],"valid"],[[67830,67834],"disallowed"],[[67835,67839],"valid",[],"NV8"],[[67840,67861],"valid"],[[67862,67865],"valid",[],"NV8"],[[67866,67867],"valid",[],"NV8"],[[67868,67870],"disallowed"],[[67871,67871],"valid",[],"NV8"],[[67872,67897],"valid"],[[67898,67902],"disallowed"],[[67903,67903],"valid",[],"NV8"],[[67904,67967],"disallowed"],[[67968,68023],"valid"],[[68024,68027],"disallowed"],[[68028,68029],"valid",[],"NV8"],[[68030,68031],"valid"],[[68032,68047],"valid",[],"NV8"],[[68048,68049],"disallowed"],[[68050,68095],"valid",[],"NV8"],[[68096,68099],"valid"],[[68100,68100],"disallowed"],[[68101,68102],"valid"],[[68103,68107],"disallowed"],[[68108,68115],"valid"],[[68116,68116],"disallowed"],[[68117,68119],"valid"],[[68120,68120],"disallowed"],[[68121,68147],"valid"],[[68148,68151],"disallowed"],[[68152,68154],"valid"],[[68155,68158],"disallowed"],[[68159,68159],"valid"],[[68160,68167],"valid",[],"NV8"],[[68168,68175],"disallowed"],[[68176,68184],"valid",[],"NV8"],[[68185,68191],"disallowed"],[[68192,68220],"valid"],[[68221,68223],"valid",[],"NV8"],[[68224,68252],"valid"],[[68253,68255],"valid",[],"NV8"],[[68256,68287],"disallowed"],[[68288,68295],"valid"],[[68296,68296],"valid",[],"NV8"],[[68297,68326],"valid"],[[68327,68330],"disallowed"],[[68331,68342],"valid",[],"NV8"],[[68343,68351],"disallowed"],[[68352,68405],"valid"],[[68406,68408],"disallowed"],[[68409,68415],"valid",[],"NV8"],[[68416,68437],"valid"],[[68438,68439],"disallowed"],[[68440,68447],"valid",[],"NV8"],[[68448,68466],"valid"],[[68467,68471],"disallowed"],[[68472,68479],"valid",[],"NV8"],[[68480,68497],"valid"],[[68498,68504],"disallowed"],[[68505,68508],"valid",[],"NV8"],[[68509,68520],"disallowed"],[[68521,68527],"valid",[],"NV8"],[[68528,68607],"disallowed"],[[68608,68680],"valid"],[[68681,68735],"disallowed"],[[68736,68736],"mapped",[68800]],[[68737,68737],"mapped",[68801]],[[68738,68738],"mapped",[68802]],[[68739,68739],"mapped",[68803]],[[68740,68740],"mapped",[68804]],[[68741,68741],"mapped",[68805]],[[68742,68742],"mapped",[68806]],[[68743,68743],"mapped",[68807]],[[68744,68744],"mapped",[68808]],[[68745,68745],"mapped",[68809]],[[68746,68746],"mapped",[68810]],[[68747,68747],"mapped",[68811]],[[68748,68748],"mapped",[68812]],[[68749,68749],"mapped",[68813]],[[68750,68750],"mapped",[68814]],[[68751,68751],"mapped",[68815]],[[68752,68752],"mapped",[68816]],[[68753,68753],"mapped",[68817]],[[68754,68754],"mapped",[68818]],[[68755,68755],"mapped",[68819]],[[68756,68756],"mapped",[68820]],[[68757,68757],"mapped",[68821]],[[68758,68758],"mapped",[68822]],[[68759,68759],"mapped",[68823]],[[68760,68760],"mapped",[68824]],[[68761,68761],"mapped",[68825]],[[68762,68762],"mapped",[68826]],[[68763,68763],"mapped",[68827]],[[68764,68764],"mapped",[68828]],[[68765,68765],"mapped",[68829]],[[68766,68766],"mapped",[68830]],[[68767,68767],"mapped",[68831]],[[68768,68768],"mapped",[68832]],[[68769,68769],"mapped",[68833]],[[68770,68770],"mapped",[68834]],[[68771,68771],"mapped",[68835]],[[68772,68772],"mapped",[68836]],[[68773,68773],"mapped",[68837]],[[68774,68774],"mapped",[68838]],[[68775,68775],"mapped",[68839]],[[68776,68776],"mapped",[68840]],[[68777,68777],"mapped",[68841]],[[68778,68778],"mapped",[68842]],[[68779,68779],"mapped",[68843]],[[68780,68780],"mapped",[68844]],[[68781,68781],"mapped",[68845]],[[68782,68782],"mapped",[68846]],[[68783,68783],"mapped",[68847]],[[68784,68784],"mapped",[68848]],[[68785,68785],"mapped",[68849]],[[68786,68786],"mapped",[68850]],[[68787,68799],"disallowed"],[[68800,68850],"valid"],[[68851,68857],"disallowed"],[[68858,68863],"valid",[],"NV8"],[[68864,69215],"disallowed"],[[69216,69246],"valid",[],"NV8"],[[69247,69631],"disallowed"],[[69632,69702],"valid"],[[69703,69709],"valid",[],"NV8"],[[69710,69713],"disallowed"],[[69714,69733],"valid",[],"NV8"],[[69734,69743],"valid"],[[69744,69758],"disallowed"],[[69759,69759],"valid"],[[69760,69818],"valid"],[[69819,69820],"valid",[],"NV8"],[[69821,69821],"disallowed"],[[69822,69825],"valid",[],"NV8"],[[69826,69839],"disallowed"],[[69840,69864],"valid"],[[69865,69871],"disallowed"],[[69872,69881],"valid"],[[69882,69887],"disallowed"],[[69888,69940],"valid"],[[69941,69941],"disallowed"],[[69942,69951],"valid"],[[69952,69955],"valid",[],"NV8"],[[69956,69967],"disallowed"],[[69968,70003],"valid"],[[70004,70005],"valid",[],"NV8"],[[70006,70006],"valid"],[[70007,70015],"disallowed"],[[70016,70084],"valid"],[[70085,70088],"valid",[],"NV8"],[[70089,70089],"valid",[],"NV8"],[[70090,70092],"valid"],[[70093,70093],"valid",[],"NV8"],[[70094,70095],"disallowed"],[[70096,70105],"valid"],[[70106,70106],"valid"],[[70107,70107],"valid",[],"NV8"],[[70108,70108],"valid"],[[70109,70111],"valid",[],"NV8"],[[70112,70112],"disallowed"],[[70113,70132],"valid",[],"NV8"],[[70133,70143],"disallowed"],[[70144,70161],"valid"],[[70162,70162],"disallowed"],[[70163,70199],"valid"],[[70200,70205],"valid",[],"NV8"],[[70206,70271],"disallowed"],[[70272,70278],"valid"],[[70279,70279],"disallowed"],[[70280,70280],"valid"],[[70281,70281],"disallowed"],[[70282,70285],"valid"],[[70286,70286],"disallowed"],[[70287,70301],"valid"],[[70302,70302],"disallowed"],[[70303,70312],"valid"],[[70313,70313],"valid",[],"NV8"],[[70314,70319],"disallowed"],[[70320,70378],"valid"],[[70379,70383],"disallowed"],[[70384,70393],"valid"],[[70394,70399],"disallowed"],[[70400,70400],"valid"],[[70401,70403],"valid"],[[70404,70404],"disallowed"],[[70405,70412],"valid"],[[70413,70414],"disallowed"],[[70415,70416],"valid"],[[70417,70418],"disallowed"],[[70419,70440],"valid"],[[70441,70441],"disallowed"],[[70442,70448],"valid"],[[70449,70449],"disallowed"],[[70450,70451],"valid"],[[70452,70452],"disallowed"],[[70453,70457],"valid"],[[70458,70459],"disallowed"],[[70460,70468],"valid"],[[70469,70470],"disallowed"],[[70471,70472],"valid"],[[70473,70474],"disallowed"],[[70475,70477],"valid"],[[70478,70479],"disallowed"],[[70480,70480],"valid"],[[70481,70486],"disallowed"],[[70487,70487],"valid"],[[70488,70492],"disallowed"],[[70493,70499],"valid"],[[70500,70501],"disallowed"],[[70502,70508],"valid"],[[70509,70511],"disallowed"],[[70512,70516],"valid"],[[70517,70783],"disallowed"],[[70784,70853],"valid"],[[70854,70854],"valid",[],"NV8"],[[70855,70855],"valid"],[[70856,70863],"disallowed"],[[70864,70873],"valid"],[[70874,71039],"disallowed"],[[71040,71093],"valid"],[[71094,71095],"disallowed"],[[71096,71104],"valid"],[[71105,71113],"valid",[],"NV8"],[[71114,71127],"valid",[],"NV8"],[[71128,71133],"valid"],[[71134,71167],"disallowed"],[[71168,71232],"valid"],[[71233,71235],"valid",[],"NV8"],[[71236,71236],"valid"],[[71237,71247],"disallowed"],[[71248,71257],"valid"],[[71258,71295],"disallowed"],[[71296,71351],"valid"],[[71352,71359],"disallowed"],[[71360,71369],"valid"],[[71370,71423],"disallowed"],[[71424,71449],"valid"],[[71450,71452],"disallowed"],[[71453,71467],"valid"],[[71468,71471],"disallowed"],[[71472,71481],"valid"],[[71482,71487],"valid",[],"NV8"],[[71488,71839],"disallowed"],[[71840,71840],"mapped",[71872]],[[71841,71841],"mapped",[71873]],[[71842,71842],"mapped",[71874]],[[71843,71843],"mapped",[71875]],[[71844,71844],"mapped",[71876]],[[71845,71845],"mapped",[71877]],[[71846,71846],"mapped",[71878]],[[71847,71847],"mapped",[71879]],[[71848,71848],"mapped",[71880]],[[71849,71849],"mapped",[71881]],[[71850,71850],"mapped",[71882]],[[71851,71851],"mapped",[71883]],[[71852,71852],"mapped",[71884]],[[71853,71853],"mapped",[71885]],[[71854,71854],"mapped",[71886]],[[71855,71855],"mapped",[71887]],[[71856,71856],"mapped",[71888]],[[71857,71857],"mapped",[71889]],[[71858,71858],"mapped",[71890]],[[71859,71859],"mapped",[71891]],[[71860,71860],"mapped",[71892]],[[71861,71861],"mapped",[71893]],[[71862,71862],"mapped",[71894]],[[71863,71863],"mapped",[71895]],[[71864,71864],"mapped",[71896]],[[71865,71865],"mapped",[71897]],[[71866,71866],"mapped",[71898]],[[71867,71867],"mapped",[71899]],[[71868,71868],"mapped",[71900]],[[71869,71869],"mapped",[71901]],[[71870,71870],"mapped",[71902]],[[71871,71871],"mapped",[71903]],[[71872,71913],"valid"],[[71914,71922],"valid",[],"NV8"],[[71923,71934],"disallowed"],[[71935,71935],"valid"],[[71936,72383],"disallowed"],[[72384,72440],"valid"],[[72441,73727],"disallowed"],[[73728,74606],"valid"],[[74607,74648],"valid"],[[74649,74649],"valid"],[[74650,74751],"disallowed"],[[74752,74850],"valid",[],"NV8"],[[74851,74862],"valid",[],"NV8"],[[74863,74863],"disallowed"],[[74864,74867],"valid",[],"NV8"],[[74868,74868],"valid",[],"NV8"],[[74869,74879],"disallowed"],[[74880,75075],"valid"],[[75076,77823],"disallowed"],[[77824,78894],"valid"],[[78895,82943],"disallowed"],[[82944,83526],"valid"],[[83527,92159],"disallowed"],[[92160,92728],"valid"],[[92729,92735],"disallowed"],[[92736,92766],"valid"],[[92767,92767],"disallowed"],[[92768,92777],"valid"],[[92778,92781],"disallowed"],[[92782,92783],"valid",[],"NV8"],[[92784,92879],"disallowed"],[[92880,92909],"valid"],[[92910,92911],"disallowed"],[[92912,92916],"valid"],[[92917,92917],"valid",[],"NV8"],[[92918,92927],"disallowed"],[[92928,92982],"valid"],[[92983,92991],"valid",[],"NV8"],[[92992,92995],"valid"],[[92996,92997],"valid",[],"NV8"],[[92998,93007],"disallowed"],[[93008,93017],"valid"],[[93018,93018],"disallowed"],[[93019,93025],"valid",[],"NV8"],[[93026,93026],"disallowed"],[[93027,93047],"valid"],[[93048,93052],"disallowed"],[[93053,93071],"valid"],[[93072,93951],"disallowed"],[[93952,94020],"valid"],[[94021,94031],"disallowed"],[[94032,94078],"valid"],[[94079,94094],"disallowed"],[[94095,94111],"valid"],[[94112,110591],"disallowed"],[[110592,110593],"valid"],[[110594,113663],"disallowed"],[[113664,113770],"valid"],[[113771,113775],"disallowed"],[[113776,113788],"valid"],[[113789,113791],"disallowed"],[[113792,113800],"valid"],[[113801,113807],"disallowed"],[[113808,113817],"valid"],[[113818,113819],"disallowed"],[[113820,113820],"valid",[],"NV8"],[[113821,113822],"valid"],[[113823,113823],"valid",[],"NV8"],[[113824,113827],"ignored"],[[113828,118783],"disallowed"],[[118784,119029],"valid",[],"NV8"],[[119030,119039],"disallowed"],[[119040,119078],"valid",[],"NV8"],[[119079,119080],"disallowed"],[[119081,119081],"valid",[],"NV8"],[[119082,119133],"valid",[],"NV8"],[[119134,119134],"mapped",[119127,119141]],[[119135,119135],"mapped",[119128,119141]],[[119136,119136],"mapped",[119128,119141,119150]],[[119137,119137],"mapped",[119128,119141,119151]],[[119138,119138],"mapped",[119128,119141,119152]],[[119139,119139],"mapped",[119128,119141,119153]],[[119140,119140],"mapped",[119128,119141,119154]],[[119141,119154],"valid",[],"NV8"],[[119155,119162],"disallowed"],[[119163,119226],"valid",[],"NV8"],[[119227,119227],"mapped",[119225,119141]],[[119228,119228],"mapped",[119226,119141]],[[119229,119229],"mapped",[119225,119141,119150]],[[119230,119230],"mapped",[119226,119141,119150]],[[119231,119231],"mapped",[119225,119141,119151]],[[119232,119232],"mapped",[119226,119141,119151]],[[119233,119261],"valid",[],"NV8"],[[119262,119272],"valid",[],"NV8"],[[119273,119295],"disallowed"],[[119296,119365],"valid",[],"NV8"],[[119366,119551],"disallowed"],[[119552,119638],"valid",[],"NV8"],[[119639,119647],"disallowed"],[[119648,119665],"valid",[],"NV8"],[[119666,119807],"disallowed"],[[119808,119808],"mapped",[97]],[[119809,119809],"mapped",[98]],[[119810,119810],"mapped",[99]],[[119811,119811],"mapped",[100]],[[119812,119812],"mapped",[101]],[[119813,119813],"mapped",[102]],[[119814,119814],"mapped",[103]],[[119815,119815],"mapped",[104]],[[119816,119816],"mapped",[105]],[[119817,119817],"mapped",[106]],[[119818,119818],"mapped",[107]],[[119819,119819],"mapped",[108]],[[119820,119820],"mapped",[109]],[[119821,119821],"mapped",[110]],[[119822,119822],"mapped",[111]],[[119823,119823],"mapped",[112]],[[119824,119824],"mapped",[113]],[[119825,119825],"mapped",[114]],[[119826,119826],"mapped",[115]],[[119827,119827],"mapped",[116]],[[119828,119828],"mapped",[117]],[[119829,119829],"mapped",[118]],[[119830,119830],"mapped",[119]],[[119831,119831],"mapped",[120]],[[119832,119832],"mapped",[121]],[[119833,119833],"mapped",[122]],[[119834,119834],"mapped",[97]],[[119835,119835],"mapped",[98]],[[119836,119836],"mapped",[99]],[[119837,119837],"mapped",[100]],[[119838,119838],"mapped",[101]],[[119839,119839],"mapped",[102]],[[119840,119840],"mapped",[103]],[[119841,119841],"mapped",[104]],[[119842,119842],"mapped",[105]],[[119843,119843],"mapped",[106]],[[119844,119844],"mapped",[107]],[[119845,119845],"mapped",[108]],[[119846,119846],"mapped",[109]],[[119847,119847],"mapped",[110]],[[119848,119848],"mapped",[111]],[[119849,119849],"mapped",[112]],[[119850,119850],"mapped",[113]],[[119851,119851],"mapped",[114]],[[119852,119852],"mapped",[115]],[[119853,119853],"mapped",[116]],[[119854,119854],"mapped",[117]],[[119855,119855],"mapped",[118]],[[119856,119856],"mapped",[119]],[[119857,119857],"mapped",[120]],[[119858,119858],"mapped",[121]],[[119859,119859],"mapped",[122]],[[119860,119860],"mapped",[97]],[[119861,119861],"mapped",[98]],[[119862,119862],"mapped",[99]],[[119863,119863],"mapped",[100]],[[119864,119864],"mapped",[101]],[[119865,119865],"mapped",[102]],[[119866,119866],"mapped",[103]],[[119867,119867],"mapped",[104]],[[119868,119868],"mapped",[105]],[[119869,119869],"mapped",[106]],[[119870,119870],"mapped",[107]],[[119871,119871],"mapped",[108]],[[119872,119872],"mapped",[109]],[[119873,119873],"mapped",[110]],[[119874,119874],"mapped",[111]],[[119875,119875],"mapped",[112]],[[119876,119876],"mapped",[113]],[[119877,119877],"mapped",[114]],[[119878,119878],"mapped",[115]],[[119879,119879],"mapped",[116]],[[119880,119880],"mapped",[117]],[[119881,119881],"mapped",[118]],[[119882,119882],"mapped",[119]],[[119883,119883],"mapped",[120]],[[119884,119884],"mapped",[121]],[[119885,119885],"mapped",[122]],[[119886,119886],"mapped",[97]],[[119887,119887],"mapped",[98]],[[119888,119888],"mapped",[99]],[[119889,119889],"mapped",[100]],[[119890,119890],"mapped",[101]],[[119891,119891],"mapped",[102]],[[119892,119892],"mapped",[103]],[[119893,119893],"disallowed"],[[119894,119894],"mapped",[105]],[[119895,119895],"mapped",[106]],[[119896,119896],"mapped",[107]],[[119897,119897],"mapped",[108]],[[119898,119898],"mapped",[109]],[[119899,119899],"mapped",[110]],[[119900,119900],"mapped",[111]],[[119901,119901],"mapped",[112]],[[119902,119902],"mapped",[113]],[[119903,119903],"mapped",[114]],[[119904,119904],"mapped",[115]],[[119905,119905],"mapped",[116]],[[119906,119906],"mapped",[117]],[[119907,119907],"mapped",[118]],[[119908,119908],"mapped",[119]],[[119909,119909],"mapped",[120]],[[119910,119910],"mapped",[121]],[[119911,119911],"mapped",[122]],[[119912,119912],"mapped",[97]],[[119913,119913],"mapped",[98]],[[119914,119914],"mapped",[99]],[[119915,119915],"mapped",[100]],[[119916,119916],"mapped",[101]],[[119917,119917],"mapped",[102]],[[119918,119918],"mapped",[103]],[[119919,119919],"mapped",[104]],[[119920,119920],"mapped",[105]],[[119921,119921],"mapped",[106]],[[119922,119922],"mapped",[107]],[[119923,119923],"mapped",[108]],[[119924,119924],"mapped",[109]],[[119925,119925],"mapped",[110]],[[119926,119926],"mapped",[111]],[[119927,119927],"mapped",[112]],[[119928,119928],"mapped",[113]],[[119929,119929],"mapped",[114]],[[119930,119930],"mapped",[115]],[[119931,119931],"mapped",[116]],[[119932,119932],"mapped",[117]],[[119933,119933],"mapped",[118]],[[119934,119934],"mapped",[119]],[[119935,119935],"mapped",[120]],[[119936,119936],"mapped",[121]],[[119937,119937],"mapped",[122]],[[119938,119938],"mapped",[97]],[[119939,119939],"mapped",[98]],[[119940,119940],"mapped",[99]],[[119941,119941],"mapped",[100]],[[119942,119942],"mapped",[101]],[[119943,119943],"mapped",[102]],[[119944,119944],"mapped",[103]],[[119945,119945],"mapped",[104]],[[119946,119946],"mapped",[105]],[[119947,119947],"mapped",[106]],[[119948,119948],"mapped",[107]],[[119949,119949],"mapped",[108]],[[119950,119950],"mapped",[109]],[[119951,119951],"mapped",[110]],[[119952,119952],"mapped",[111]],[[119953,119953],"mapped",[112]],[[119954,119954],"mapped",[113]],[[119955,119955],"mapped",[114]],[[119956,119956],"mapped",[115]],[[119957,119957],"mapped",[116]],[[119958,119958],"mapped",[117]],[[119959,119959],"mapped",[118]],[[119960,119960],"mapped",[119]],[[119961,119961],"mapped",[120]],[[119962,119962],"mapped",[121]],[[119963,119963],"mapped",[122]],[[119964,119964],"mapped",[97]],[[119965,119965],"disallowed"],[[119966,119966],"mapped",[99]],[[119967,119967],"mapped",[100]],[[119968,119969],"disallowed"],[[119970,119970],"mapped",[103]],[[119971,119972],"disallowed"],[[119973,119973],"mapped",[106]],[[119974,119974],"mapped",[107]],[[119975,119976],"disallowed"],[[119977,119977],"mapped",[110]],[[119978,119978],"mapped",[111]],[[119979,119979],"mapped",[112]],[[119980,119980],"mapped",[113]],[[119981,119981],"disallowed"],[[119982,119982],"mapped",[115]],[[119983,119983],"mapped",[116]],[[119984,119984],"mapped",[117]],[[119985,119985],"mapped",[118]],[[119986,119986],"mapped",[119]],[[119987,119987],"mapped",[120]],[[119988,119988],"mapped",[121]],[[119989,119989],"mapped",[122]],[[119990,119990],"mapped",[97]],[[119991,119991],"mapped",[98]],[[119992,119992],"mapped",[99]],[[119993,119993],"mapped",[100]],[[119994,119994],"disallowed"],[[119995,119995],"mapped",[102]],[[119996,119996],"disallowed"],[[119997,119997],"mapped",[104]],[[119998,119998],"mapped",[105]],[[119999,119999],"mapped",[106]],[[120000,120000],"mapped",[107]],[[120001,120001],"mapped",[108]],[[120002,120002],"mapped",[109]],[[120003,120003],"mapped",[110]],[[120004,120004],"disallowed"],[[120005,120005],"mapped",[112]],[[120006,120006],"mapped",[113]],[[120007,120007],"mapped",[114]],[[120008,120008],"mapped",[115]],[[120009,120009],"mapped",[116]],[[120010,120010],"mapped",[117]],[[120011,120011],"mapped",[118]],[[120012,120012],"mapped",[119]],[[120013,120013],"mapped",[120]],[[120014,120014],"mapped",[121]],[[120015,120015],"mapped",[122]],[[120016,120016],"mapped",[97]],[[120017,120017],"mapped",[98]],[[120018,120018],"mapped",[99]],[[120019,120019],"mapped",[100]],[[120020,120020],"mapped",[101]],[[120021,120021],"mapped",[102]],[[120022,120022],"mapped",[103]],[[120023,120023],"mapped",[104]],[[120024,120024],"mapped",[105]],[[120025,120025],"mapped",[106]],[[120026,120026],"mapped",[107]],[[120027,120027],"mapped",[108]],[[120028,120028],"mapped",[109]],[[120029,120029],"mapped",[110]],[[120030,120030],"mapped",[111]],[[120031,120031],"mapped",[112]],[[120032,120032],"mapped",[113]],[[120033,120033],"mapped",[114]],[[120034,120034],"mapped",[115]],[[120035,120035],"mapped",[116]],[[120036,120036],"mapped",[117]],[[120037,120037],"mapped",[118]],[[120038,120038],"mapped",[119]],[[120039,120039],"mapped",[120]],[[120040,120040],"mapped",[121]],[[120041,120041],"mapped",[122]],[[120042,120042],"mapped",[97]],[[120043,120043],"mapped",[98]],[[120044,120044],"mapped",[99]],[[120045,120045],"mapped",[100]],[[120046,120046],"mapped",[101]],[[120047,120047],"mapped",[102]],[[120048,120048],"mapped",[103]],[[120049,120049],"mapped",[104]],[[120050,120050],"mapped",[105]],[[120051,120051],"mapped",[106]],[[120052,120052],"mapped",[107]],[[120053,120053],"mapped",[108]],[[120054,120054],"mapped",[109]],[[120055,120055],"mapped",[110]],[[120056,120056],"mapped",[111]],[[120057,120057],"mapped",[112]],[[120058,120058],"mapped",[113]],[[120059,120059],"mapped",[114]],[[120060,120060],"mapped",[115]],[[120061,120061],"mapped",[116]],[[120062,120062],"mapped",[117]],[[120063,120063],"mapped",[118]],[[120064,120064],"mapped",[119]],[[120065,120065],"mapped",[120]],[[120066,120066],"mapped",[121]],[[120067,120067],"mapped",[122]],[[120068,120068],"mapped",[97]],[[120069,120069],"mapped",[98]],[[120070,120070],"disallowed"],[[120071,120071],"mapped",[100]],[[120072,120072],"mapped",[101]],[[120073,120073],"mapped",[102]],[[120074,120074],"mapped",[103]],[[120075,120076],"disallowed"],[[120077,120077],"mapped",[106]],[[120078,120078],"mapped",[107]],[[120079,120079],"mapped",[108]],[[120080,120080],"mapped",[109]],[[120081,120081],"mapped",[110]],[[120082,120082],"mapped",[111]],[[120083,120083],"mapped",[112]],[[120084,120084],"mapped",[113]],[[120085,120085],"disallowed"],[[120086,120086],"mapped",[115]],[[120087,120087],"mapped",[116]],[[120088,120088],"mapped",[117]],[[120089,120089],"mapped",[118]],[[120090,120090],"mapped",[119]],[[120091,120091],"mapped",[120]],[[120092,120092],"mapped",[121]],[[120093,120093],"disallowed"],[[120094,120094],"mapped",[97]],[[120095,120095],"mapped",[98]],[[120096,120096],"mapped",[99]],[[120097,120097],"mapped",[100]],[[120098,120098],"mapped",[101]],[[120099,120099],"mapped",[102]],[[120100,120100],"mapped",[103]],[[120101,120101],"mapped",[104]],[[120102,120102],"mapped",[105]],[[120103,120103],"mapped",[106]],[[120104,120104],"mapped",[107]],[[120105,120105],"mapped",[108]],[[120106,120106],"mapped",[109]],[[120107,120107],"mapped",[110]],[[120108,120108],"mapped",[111]],[[120109,120109],"mapped",[112]],[[120110,120110],"mapped",[113]],[[120111,120111],"mapped",[114]],[[120112,120112],"mapped",[115]],[[120113,120113],"mapped",[116]],[[120114,120114],"mapped",[117]],[[120115,120115],"mapped",[118]],[[120116,120116],"mapped",[119]],[[120117,120117],"mapped",[120]],[[120118,120118],"mapped",[121]],[[120119,120119],"mapped",[122]],[[120120,120120],"mapped",[97]],[[120121,120121],"mapped",[98]],[[120122,120122],"disallowed"],[[120123,120123],"mapped",[100]],[[120124,120124],"mapped",[101]],[[120125,120125],"mapped",[102]],[[120126,120126],"mapped",[103]],[[120127,120127],"disallowed"],[[120128,120128],"mapped",[105]],[[120129,120129],"mapped",[106]],[[120130,120130],"mapped",[107]],[[120131,120131],"mapped",[108]],[[120132,120132],"mapped",[109]],[[120133,120133],"disallowed"],[[120134,120134],"mapped",[111]],[[120135,120137],"disallowed"],[[120138,120138],"mapped",[115]],[[120139,120139],"mapped",[116]],[[120140,120140],"mapped",[117]],[[120141,120141],"mapped",[118]],[[120142,120142],"mapped",[119]],[[120143,120143],"mapped",[120]],[[120144,120144],"mapped",[121]],[[120145,120145],"disallowed"],[[120146,120146],"mapped",[97]],[[120147,120147],"mapped",[98]],[[120148,120148],"mapped",[99]],[[120149,120149],"mapped",[100]],[[120150,120150],"mapped",[101]],[[120151,120151],"mapped",[102]],[[120152,120152],"mapped",[103]],[[120153,120153],"mapped",[104]],[[120154,120154],"mapped",[105]],[[120155,120155],"mapped",[106]],[[120156,120156],"mapped",[107]],[[120157,120157],"mapped",[108]],[[120158,120158],"mapped",[109]],[[120159,120159],"mapped",[110]],[[120160,120160],"mapped",[111]],[[120161,120161],"mapped",[112]],[[120162,120162],"mapped",[113]],[[120163,120163],"mapped",[114]],[[120164,120164],"mapped",[115]],[[120165,120165],"mapped",[116]],[[120166,120166],"mapped",[117]],[[120167,120167],"mapped",[118]],[[120168,120168],"mapped",[119]],[[120169,120169],"mapped",[120]],[[120170,120170],"mapped",[121]],[[120171,120171],"mapped",[122]],[[120172,120172],"mapped",[97]],[[120173,120173],"mapped",[98]],[[120174,120174],"mapped",[99]],[[120175,120175],"mapped",[100]],[[120176,120176],"mapped",[101]],[[120177,120177],"mapped",[102]],[[120178,120178],"mapped",[103]],[[120179,120179],"mapped",[104]],[[120180,120180],"mapped",[105]],[[120181,120181],"mapped",[106]],[[120182,120182],"mapped",[107]],[[120183,120183],"mapped",[108]],[[120184,120184],"mapped",[109]],[[120185,120185],"mapped",[110]],[[120186,120186],"mapped",[111]],[[120187,120187],"mapped",[112]],[[120188,120188],"mapped",[113]],[[120189,120189],"mapped",[114]],[[120190,120190],"mapped",[115]],[[120191,120191],"mapped",[116]],[[120192,120192],"mapped",[117]],[[120193,120193],"mapped",[118]],[[120194,120194],"mapped",[119]],[[120195,120195],"mapped",[120]],[[120196,120196],"mapped",[121]],[[120197,120197],"mapped",[122]],[[120198,120198],"mapped",[97]],[[120199,120199],"mapped",[98]],[[120200,120200],"mapped",[99]],[[120201,120201],"mapped",[100]],[[120202,120202],"mapped",[101]],[[120203,120203],"mapped",[102]],[[120204,120204],"mapped",[103]],[[120205,120205],"mapped",[104]],[[120206,120206],"mapped",[105]],[[120207,120207],"mapped",[106]],[[120208,120208],"mapped",[107]],[[120209,120209],"mapped",[108]],[[120210,120210],"mapped",[109]],[[120211,120211],"mapped",[110]],[[120212,120212],"mapped",[111]],[[120213,120213],"mapped",[112]],[[120214,120214],"mapped",[113]],[[120215,120215],"mapped",[114]],[[120216,120216],"mapped",[115]],[[120217,120217],"mapped",[116]],[[120218,120218],"mapped",[117]],[[120219,120219],"mapped",[118]],[[120220,120220],"mapped",[119]],[[120221,120221],"mapped",[120]],[[120222,120222],"mapped",[121]],[[120223,120223],"mapped",[122]],[[120224,120224],"mapped",[97]],[[120225,120225],"mapped",[98]],[[120226,120226],"mapped",[99]],[[120227,120227],"mapped",[100]],[[120228,120228],"mapped",[101]],[[120229,120229],"mapped",[102]],[[120230,120230],"mapped",[103]],[[120231,120231],"mapped",[104]],[[120232,120232],"mapped",[105]],[[120233,120233],"mapped",[106]],[[120234,120234],"mapped",[107]],[[120235,120235],"mapped",[108]],[[120236,120236],"mapped",[109]],[[120237,120237],"mapped",[110]],[[120238,120238],"mapped",[111]],[[120239,120239],"mapped",[112]],[[120240,120240],"mapped",[113]],[[120241,120241],"mapped",[114]],[[120242,120242],"mapped",[115]],[[120243,120243],"mapped",[116]],[[120244,120244],"mapped",[117]],[[120245,120245],"mapped",[118]],[[120246,120246],"mapped",[119]],[[120247,120247],"mapped",[120]],[[120248,120248],"mapped",[121]],[[120249,120249],"mapped",[122]],[[120250,120250],"mapped",[97]],[[120251,120251],"mapped",[98]],[[120252,120252],"mapped",[99]],[[120253,120253],"mapped",[100]],[[120254,120254],"mapped",[101]],[[120255,120255],"mapped",[102]],[[120256,120256],"mapped",[103]],[[120257,120257],"mapped",[104]],[[120258,120258],"mapped",[105]],[[120259,120259],"mapped",[106]],[[120260,120260],"mapped",[107]],[[120261,120261],"mapped",[108]],[[120262,120262],"mapped",[109]],[[120263,120263],"mapped",[110]],[[120264,120264],"mapped",[111]],[[120265,120265],"mapped",[112]],[[120266,120266],"mapped",[113]],[[120267,120267],"mapped",[114]],[[120268,120268],"mapped",[115]],[[120269,120269],"mapped",[116]],[[120270,120270],"mapped",[117]],[[120271,120271],"mapped",[118]],[[120272,120272],"mapped",[119]],[[120273,120273],"mapped",[120]],[[120274,120274],"mapped",[121]],[[120275,120275],"mapped",[122]],[[120276,120276],"mapped",[97]],[[120277,120277],"mapped",[98]],[[120278,120278],"mapped",[99]],[[120279,120279],"mapped",[100]],[[120280,120280],"mapped",[101]],[[120281,120281],"mapped",[102]],[[120282,120282],"mapped",[103]],[[120283,120283],"mapped",[104]],[[120284,120284],"mapped",[105]],[[120285,120285],"mapped",[106]],[[120286,120286],"mapped",[107]],[[120287,120287],"mapped",[108]],[[120288,120288],"mapped",[109]],[[120289,120289],"mapped",[110]],[[120290,120290],"mapped",[111]],[[120291,120291],"mapped",[112]],[[120292,120292],"mapped",[113]],[[120293,120293],"mapped",[114]],[[120294,120294],"mapped",[115]],[[120295,120295],"mapped",[116]],[[120296,120296],"mapped",[117]],[[120297,120297],"mapped",[118]],[[120298,120298],"mapped",[119]],[[120299,120299],"mapped",[120]],[[120300,120300],"mapped",[121]],[[120301,120301],"mapped",[122]],[[120302,120302],"mapped",[97]],[[120303,120303],"mapped",[98]],[[120304,120304],"mapped",[99]],[[120305,120305],"mapped",[100]],[[120306,120306],"mapped",[101]],[[120307,120307],"mapped",[102]],[[120308,120308],"mapped",[103]],[[120309,120309],"mapped",[104]],[[120310,120310],"mapped",[105]],[[120311,120311],"mapped",[106]],[[120312,120312],"mapped",[107]],[[120313,120313],"mapped",[108]],[[120314,120314],"mapped",[109]],[[120315,120315],"mapped",[110]],[[120316,120316],"mapped",[111]],[[120317,120317],"mapped",[112]],[[120318,120318],"mapped",[113]],[[120319,120319],"mapped",[114]],[[120320,120320],"mapped",[115]],[[120321,120321],"mapped",[116]],[[120322,120322],"mapped",[117]],[[120323,120323],"mapped",[118]],[[120324,120324],"mapped",[119]],[[120325,120325],"mapped",[120]],[[120326,120326],"mapped",[121]],[[120327,120327],"mapped",[122]],[[120328,120328],"mapped",[97]],[[120329,120329],"mapped",[98]],[[120330,120330],"mapped",[99]],[[120331,120331],"mapped",[100]],[[120332,120332],"mapped",[101]],[[120333,120333],"mapped",[102]],[[120334,120334],"mapped",[103]],[[120335,120335],"mapped",[104]],[[120336,120336],"mapped",[105]],[[120337,120337],"mapped",[106]],[[120338,120338],"mapped",[107]],[[120339,120339],"mapped",[108]],[[120340,120340],"mapped",[109]],[[120341,120341],"mapped",[110]],[[120342,120342],"mapped",[111]],[[120343,120343],"mapped",[112]],[[120344,120344],"mapped",[113]],[[120345,120345],"mapped",[114]],[[120346,120346],"mapped",[115]],[[120347,120347],"mapped",[116]],[[120348,120348],"mapped",[117]],[[120349,120349],"mapped",[118]],[[120350,120350],"mapped",[119]],[[120351,120351],"mapped",[120]],[[120352,120352],"mapped",[121]],[[120353,120353],"mapped",[122]],[[120354,120354],"mapped",[97]],[[120355,120355],"mapped",[98]],[[120356,120356],"mapped",[99]],[[120357,120357],"mapped",[100]],[[120358,120358],"mapped",[101]],[[120359,120359],"mapped",[102]],[[120360,120360],"mapped",[103]],[[120361,120361],"mapped",[104]],[[120362,120362],"mapped",[105]],[[120363,120363],"mapped",[106]],[[120364,120364],"mapped",[107]],[[120365,120365],"mapped",[108]],[[120366,120366],"mapped",[109]],[[120367,120367],"mapped",[110]],[[120368,120368],"mapped",[111]],[[120369,120369],"mapped",[112]],[[120370,120370],"mapped",[113]],[[120371,120371],"mapped",[114]],[[120372,120372],"mapped",[115]],[[120373,120373],"mapped",[116]],[[120374,120374],"mapped",[117]],[[120375,120375],"mapped",[118]],[[120376,120376],"mapped",[119]],[[120377,120377],"mapped",[120]],[[120378,120378],"mapped",[121]],[[120379,120379],"mapped",[122]],[[120380,120380],"mapped",[97]],[[120381,120381],"mapped",[98]],[[120382,120382],"mapped",[99]],[[120383,120383],"mapped",[100]],[[120384,120384],"mapped",[101]],[[120385,120385],"mapped",[102]],[[120386,120386],"mapped",[103]],[[120387,120387],"mapped",[104]],[[120388,120388],"mapped",[105]],[[120389,120389],"mapped",[106]],[[120390,120390],"mapped",[107]],[[120391,120391],"mapped",[108]],[[120392,120392],"mapped",[109]],[[120393,120393],"mapped",[110]],[[120394,120394],"mapped",[111]],[[120395,120395],"mapped",[112]],[[120396,120396],"mapped",[113]],[[120397,120397],"mapped",[114]],[[120398,120398],"mapped",[115]],[[120399,120399],"mapped",[116]],[[120400,120400],"mapped",[117]],[[120401,120401],"mapped",[118]],[[120402,120402],"mapped",[119]],[[120403,120403],"mapped",[120]],[[120404,120404],"mapped",[121]],[[120405,120405],"mapped",[122]],[[120406,120406],"mapped",[97]],[[120407,120407],"mapped",[98]],[[120408,120408],"mapped",[99]],[[120409,120409],"mapped",[100]],[[120410,120410],"mapped",[101]],[[120411,120411],"mapped",[102]],[[120412,120412],"mapped",[103]],[[120413,120413],"mapped",[104]],[[120414,120414],"mapped",[105]],[[120415,120415],"mapped",[106]],[[120416,120416],"mapped",[107]],[[120417,120417],"mapped",[108]],[[120418,120418],"mapped",[109]],[[120419,120419],"mapped",[110]],[[120420,120420],"mapped",[111]],[[120421,120421],"mapped",[112]],[[120422,120422],"mapped",[113]],[[120423,120423],"mapped",[114]],[[120424,120424],"mapped",[115]],[[120425,120425],"mapped",[116]],[[120426,120426],"mapped",[117]],[[120427,120427],"mapped",[118]],[[120428,120428],"mapped",[119]],[[120429,120429],"mapped",[120]],[[120430,120430],"mapped",[121]],[[120431,120431],"mapped",[122]],[[120432,120432],"mapped",[97]],[[120433,120433],"mapped",[98]],[[120434,120434],"mapped",[99]],[[120435,120435],"mapped",[100]],[[120436,120436],"mapped",[101]],[[120437,120437],"mapped",[102]],[[120438,120438],"mapped",[103]],[[120439,120439],"mapped",[104]],[[120440,120440],"mapped",[105]],[[120441,120441],"mapped",[106]],[[120442,120442],"mapped",[107]],[[120443,120443],"mapped",[108]],[[120444,120444],"mapped",[109]],[[120445,120445],"mapped",[110]],[[120446,120446],"mapped",[111]],[[120447,120447],"mapped",[112]],[[120448,120448],"mapped",[113]],[[120449,120449],"mapped",[114]],[[120450,120450],"mapped",[115]],[[120451,120451],"mapped",[116]],[[120452,120452],"mapped",[117]],[[120453,120453],"mapped",[118]],[[120454,120454],"mapped",[119]],[[120455,120455],"mapped",[120]],[[120456,120456],"mapped",[121]],[[120457,120457],"mapped",[122]],[[120458,120458],"mapped",[97]],[[120459,120459],"mapped",[98]],[[120460,120460],"mapped",[99]],[[120461,120461],"mapped",[100]],[[120462,120462],"mapped",[101]],[[120463,120463],"mapped",[102]],[[120464,120464],"mapped",[103]],[[120465,120465],"mapped",[104]],[[120466,120466],"mapped",[105]],[[120467,120467],"mapped",[106]],[[120468,120468],"mapped",[107]],[[120469,120469],"mapped",[108]],[[120470,120470],"mapped",[109]],[[120471,120471],"mapped",[110]],[[120472,120472],"mapped",[111]],[[120473,120473],"mapped",[112]],[[120474,120474],"mapped",[113]],[[120475,120475],"mapped",[114]],[[120476,120476],"mapped",[115]],[[120477,120477],"mapped",[116]],[[120478,120478],"mapped",[117]],[[120479,120479],"mapped",[118]],[[120480,120480],"mapped",[119]],[[120481,120481],"mapped",[120]],[[120482,120482],"mapped",[121]],[[120483,120483],"mapped",[122]],[[120484,120484],"mapped",[305]],[[120485,120485],"mapped",[567]],[[120486,120487],"disallowed"],[[120488,120488],"mapped",[945]],[[120489,120489],"mapped",[946]],[[120490,120490],"mapped",[947]],[[120491,120491],"mapped",[948]],[[120492,120492],"mapped",[949]],[[120493,120493],"mapped",[950]],[[120494,120494],"mapped",[951]],[[120495,120495],"mapped",[952]],[[120496,120496],"mapped",[953]],[[120497,120497],"mapped",[954]],[[120498,120498],"mapped",[955]],[[120499,120499],"mapped",[956]],[[120500,120500],"mapped",[957]],[[120501,120501],"mapped",[958]],[[120502,120502],"mapped",[959]],[[120503,120503],"mapped",[960]],[[120504,120504],"mapped",[961]],[[120505,120505],"mapped",[952]],[[120506,120506],"mapped",[963]],[[120507,120507],"mapped",[964]],[[120508,120508],"mapped",[965]],[[120509,120509],"mapped",[966]],[[120510,120510],"mapped",[967]],[[120511,120511],"mapped",[968]],[[120512,120512],"mapped",[969]],[[120513,120513],"mapped",[8711]],[[120514,120514],"mapped",[945]],[[120515,120515],"mapped",[946]],[[120516,120516],"mapped",[947]],[[120517,120517],"mapped",[948]],[[120518,120518],"mapped",[949]],[[120519,120519],"mapped",[950]],[[120520,120520],"mapped",[951]],[[120521,120521],"mapped",[952]],[[120522,120522],"mapped",[953]],[[120523,120523],"mapped",[954]],[[120524,120524],"mapped",[955]],[[120525,120525],"mapped",[956]],[[120526,120526],"mapped",[957]],[[120527,120527],"mapped",[958]],[[120528,120528],"mapped",[959]],[[120529,120529],"mapped",[960]],[[120530,120530],"mapped",[961]],[[120531,120532],"mapped",[963]],[[120533,120533],"mapped",[964]],[[120534,120534],"mapped",[965]],[[120535,120535],"mapped",[966]],[[120536,120536],"mapped",[967]],[[120537,120537],"mapped",[968]],[[120538,120538],"mapped",[969]],[[120539,120539],"mapped",[8706]],[[120540,120540],"mapped",[949]],[[120541,120541],"mapped",[952]],[[120542,120542],"mapped",[954]],[[120543,120543],"mapped",[966]],[[120544,120544],"mapped",[961]],[[120545,120545],"mapped",[960]],[[120546,120546],"mapped",[945]],[[120547,120547],"mapped",[946]],[[120548,120548],"mapped",[947]],[[120549,120549],"mapped",[948]],[[120550,120550],"mapped",[949]],[[120551,120551],"mapped",[950]],[[120552,120552],"mapped",[951]],[[120553,120553],"mapped",[952]],[[120554,120554],"mapped",[953]],[[120555,120555],"mapped",[954]],[[120556,120556],"mapped",[955]],[[120557,120557],"mapped",[956]],[[120558,120558],"mapped",[957]],[[120559,120559],"mapped",[958]],[[120560,120560],"mapped",[959]],[[120561,120561],"mapped",[960]],[[120562,120562],"mapped",[961]],[[120563,120563],"mapped",[952]],[[120564,120564],"mapped",[963]],[[120565,120565],"mapped",[964]],[[120566,120566],"mapped",[965]],[[120567,120567],"mapped",[966]],[[120568,120568],"mapped",[967]],[[120569,120569],"mapped",[968]],[[120570,120570],"mapped",[969]],[[120571,120571],"mapped",[8711]],[[120572,120572],"mapped",[945]],[[120573,120573],"mapped",[946]],[[120574,120574],"mapped",[947]],[[120575,120575],"mapped",[948]],[[120576,120576],"mapped",[949]],[[120577,120577],"mapped",[950]],[[120578,120578],"mapped",[951]],[[120579,120579],"mapped",[952]],[[120580,120580],"mapped",[953]],[[120581,120581],"mapped",[954]],[[120582,120582],"mapped",[955]],[[120583,120583],"mapped",[956]],[[120584,120584],"mapped",[957]],[[120585,120585],"mapped",[958]],[[120586,120586],"mapped",[959]],[[120587,120587],"mapped",[960]],[[120588,120588],"mapped",[961]],[[120589,120590],"mapped",[963]],[[120591,120591],"mapped",[964]],[[120592,120592],"mapped",[965]],[[120593,120593],"mapped",[966]],[[120594,120594],"mapped",[967]],[[120595,120595],"mapped",[968]],[[120596,120596],"mapped",[969]],[[120597,120597],"mapped",[8706]],[[120598,120598],"mapped",[949]],[[120599,120599],"mapped",[952]],[[120600,120600],"mapped",[954]],[[120601,120601],"mapped",[966]],[[120602,120602],"mapped",[961]],[[120603,120603],"mapped",[960]],[[120604,120604],"mapped",[945]],[[120605,120605],"mapped",[946]],[[120606,120606],"mapped",[947]],[[120607,120607],"mapped",[948]],[[120608,120608],"mapped",[949]],[[120609,120609],"mapped",[950]],[[120610,120610],"mapped",[951]],[[120611,120611],"mapped",[952]],[[120612,120612],"mapped",[953]],[[120613,120613],"mapped",[954]],[[120614,120614],"mapped",[955]],[[120615,120615],"mapped",[956]],[[120616,120616],"mapped",[957]],[[120617,120617],"mapped",[958]],[[120618,120618],"mapped",[959]],[[120619,120619],"mapped",[960]],[[120620,120620],"mapped",[961]],[[120621,120621],"mapped",[952]],[[120622,120622],"mapped",[963]],[[120623,120623],"mapped",[964]],[[120624,120624],"mapped",[965]],[[120625,120625],"mapped",[966]],[[120626,120626],"mapped",[967]],[[120627,120627],"mapped",[968]],[[120628,120628],"mapped",[969]],[[120629,120629],"mapped",[8711]],[[120630,120630],"mapped",[945]],[[120631,120631],"mapped",[946]],[[120632,120632],"mapped",[947]],[[120633,120633],"mapped",[948]],[[120634,120634],"mapped",[949]],[[120635,120635],"mapped",[950]],[[120636,120636],"mapped",[951]],[[120637,120637],"mapped",[952]],[[120638,120638],"mapped",[953]],[[120639,120639],"mapped",[954]],[[120640,120640],"mapped",[955]],[[120641,120641],"mapped",[956]],[[120642,120642],"mapped",[957]],[[120643,120643],"mapped",[958]],[[120644,120644],"mapped",[959]],[[120645,120645],"mapped",[960]],[[120646,120646],"mapped",[961]],[[120647,120648],"mapped",[963]],[[120649,120649],"mapped",[964]],[[120650,120650],"mapped",[965]],[[120651,120651],"mapped",[966]],[[120652,120652],"mapped",[967]],[[120653,120653],"mapped",[968]],[[120654,120654],"mapped",[969]],[[120655,120655],"mapped",[8706]],[[120656,120656],"mapped",[949]],[[120657,120657],"mapped",[952]],[[120658,120658],"mapped",[954]],[[120659,120659],"mapped",[966]],[[120660,120660],"mapped",[961]],[[120661,120661],"mapped",[960]],[[120662,120662],"mapped",[945]],[[120663,120663],"mapped",[946]],[[120664,120664],"mapped",[947]],[[120665,120665],"mapped",[948]],[[120666,120666],"mapped",[949]],[[120667,120667],"mapped",[950]],[[120668,120668],"mapped",[951]],[[120669,120669],"mapped",[952]],[[120670,120670],"mapped",[953]],[[120671,120671],"mapped",[954]],[[120672,120672],"mapped",[955]],[[120673,120673],"mapped",[956]],[[120674,120674],"mapped",[957]],[[120675,120675],"mapped",[958]],[[120676,120676],"mapped",[959]],[[120677,120677],"mapped",[960]],[[120678,120678],"mapped",[961]],[[120679,120679],"mapped",[952]],[[120680,120680],"mapped",[963]],[[120681,120681],"mapped",[964]],[[120682,120682],"mapped",[965]],[[120683,120683],"mapped",[966]],[[120684,120684],"mapped",[967]],[[120685,120685],"mapped",[968]],[[120686,120686],"mapped",[969]],[[120687,120687],"mapped",[8711]],[[120688,120688],"mapped",[945]],[[120689,120689],"mapped",[946]],[[120690,120690],"mapped",[947]],[[120691,120691],"mapped",[948]],[[120692,120692],"mapped",[949]],[[120693,120693],"mapped",[950]],[[120694,120694],"mapped",[951]],[[120695,120695],"mapped",[952]],[[120696,120696],"mapped",[953]],[[120697,120697],"mapped",[954]],[[120698,120698],"mapped",[955]],[[120699,120699],"mapped",[956]],[[120700,120700],"mapped",[957]],[[120701,120701],"mapped",[958]],[[120702,120702],"mapped",[959]],[[120703,120703],"mapped",[960]],[[120704,120704],"mapped",[961]],[[120705,120706],"mapped",[963]],[[120707,120707],"mapped",[964]],[[120708,120708],"mapped",[965]],[[120709,120709],"mapped",[966]],[[120710,120710],"mapped",[967]],[[120711,120711],"mapped",[968]],[[120712,120712],"mapped",[969]],[[120713,120713],"mapped",[8706]],[[120714,120714],"mapped",[949]],[[120715,120715],"mapped",[952]],[[120716,120716],"mapped",[954]],[[120717,120717],"mapped",[966]],[[120718,120718],"mapped",[961]],[[120719,120719],"mapped",[960]],[[120720,120720],"mapped",[945]],[[120721,120721],"mapped",[946]],[[120722,120722],"mapped",[947]],[[120723,120723],"mapped",[948]],[[120724,120724],"mapped",[949]],[[120725,120725],"mapped",[950]],[[120726,120726],"mapped",[951]],[[120727,120727],"mapped",[952]],[[120728,120728],"mapped",[953]],[[120729,120729],"mapped",[954]],[[120730,120730],"mapped",[955]],[[120731,120731],"mapped",[956]],[[120732,120732],"mapped",[957]],[[120733,120733],"mapped",[958]],[[120734,120734],"mapped",[959]],[[120735,120735],"mapped",[960]],[[120736,120736],"mapped",[961]],[[120737,120737],"mapped",[952]],[[120738,120738],"mapped",[963]],[[120739,120739],"mapped",[964]],[[120740,120740],"mapped",[965]],[[120741,120741],"mapped",[966]],[[120742,120742],"mapped",[967]],[[120743,120743],"mapped",[968]],[[120744,120744],"mapped",[969]],[[120745,120745],"mapped",[8711]],[[120746,120746],"mapped",[945]],[[120747,120747],"mapped",[946]],[[120748,120748],"mapped",[947]],[[120749,120749],"mapped",[948]],[[120750,120750],"mapped",[949]],[[120751,120751],"mapped",[950]],[[120752,120752],"mapped",[951]],[[120753,120753],"mapped",[952]],[[120754,120754],"mapped",[953]],[[120755,120755],"mapped",[954]],[[120756,120756],"mapped",[955]],[[120757,120757],"mapped",[956]],[[120758,120758],"mapped",[957]],[[120759,120759],"mapped",[958]],[[120760,120760],"mapped",[959]],[[120761,120761],"mapped",[960]],[[120762,120762],"mapped",[961]],[[120763,120764],"mapped",[963]],[[120765,120765],"mapped",[964]],[[120766,120766],"mapped",[965]],[[120767,120767],"mapped",[966]],[[120768,120768],"mapped",[967]],[[120769,120769],"mapped",[968]],[[120770,120770],"mapped",[969]],[[120771,120771],"mapped",[8706]],[[120772,120772],"mapped",[949]],[[120773,120773],"mapped",[952]],[[120774,120774],"mapped",[954]],[[120775,120775],"mapped",[966]],[[120776,120776],"mapped",[961]],[[120777,120777],"mapped",[960]],[[120778,120779],"mapped",[989]],[[120780,120781],"disallowed"],[[120782,120782],"mapped",[48]],[[120783,120783],"mapped",[49]],[[120784,120784],"mapped",[50]],[[120785,120785],"mapped",[51]],[[120786,120786],"mapped",[52]],[[120787,120787],"mapped",[53]],[[120788,120788],"mapped",[54]],[[120789,120789],"mapped",[55]],[[120790,120790],"mapped",[56]],[[120791,120791],"mapped",[57]],[[120792,120792],"mapped",[48]],[[120793,120793],"mapped",[49]],[[120794,120794],"mapped",[50]],[[120795,120795],"mapped",[51]],[[120796,120796],"mapped",[52]],[[120797,120797],"mapped",[53]],[[120798,120798],"mapped",[54]],[[120799,120799],"mapped",[55]],[[120800,120800],"mapped",[56]],[[120801,120801],"mapped",[57]],[[120802,120802],"mapped",[48]],[[120803,120803],"mapped",[49]],[[120804,120804],"mapped",[50]],[[120805,120805],"mapped",[51]],[[120806,120806],"mapped",[52]],[[120807,120807],"mapped",[53]],[[120808,120808],"mapped",[54]],[[120809,120809],"mapped",[55]],[[120810,120810],"mapped",[56]],[[120811,120811],"mapped",[57]],[[120812,120812],"mapped",[48]],[[120813,120813],"mapped",[49]],[[120814,120814],"mapped",[50]],[[120815,120815],"mapped",[51]],[[120816,120816],"mapped",[52]],[[120817,120817],"mapped",[53]],[[120818,120818],"mapped",[54]],[[120819,120819],"mapped",[55]],[[120820,120820],"mapped",[56]],[[120821,120821],"mapped",[57]],[[120822,120822],"mapped",[48]],[[120823,120823],"mapped",[49]],[[120824,120824],"mapped",[50]],[[120825,120825],"mapped",[51]],[[120826,120826],"mapped",[52]],[[120827,120827],"mapped",[53]],[[120828,120828],"mapped",[54]],[[120829,120829],"mapped",[55]],[[120830,120830],"mapped",[56]],[[120831,120831],"mapped",[57]],[[120832,121343],"valid",[],"NV8"],[[121344,121398],"valid"],[[121399,121402],"valid",[],"NV8"],[[121403,121452],"valid"],[[121453,121460],"valid",[],"NV8"],[[121461,121461],"valid"],[[121462,121475],"valid",[],"NV8"],[[121476,121476],"valid"],[[121477,121483],"valid",[],"NV8"],[[121484,121498],"disallowed"],[[121499,121503],"valid"],[[121504,121504],"disallowed"],[[121505,121519],"valid"],[[121520,124927],"disallowed"],[[124928,125124],"valid"],[[125125,125126],"disallowed"],[[125127,125135],"valid",[],"NV8"],[[125136,125142],"valid"],[[125143,126463],"disallowed"],[[126464,126464],"mapped",[1575]],[[126465,126465],"mapped",[1576]],[[126466,126466],"mapped",[1580]],[[126467,126467],"mapped",[1583]],[[126468,126468],"disallowed"],[[126469,126469],"mapped",[1608]],[[126470,126470],"mapped",[1586]],[[126471,126471],"mapped",[1581]],[[126472,126472],"mapped",[1591]],[[126473,126473],"mapped",[1610]],[[126474,126474],"mapped",[1603]],[[126475,126475],"mapped",[1604]],[[126476,126476],"mapped",[1605]],[[126477,126477],"mapped",[1606]],[[126478,126478],"mapped",[1587]],[[126479,126479],"mapped",[1593]],[[126480,126480],"mapped",[1601]],[[126481,126481],"mapped",[1589]],[[126482,126482],"mapped",[1602]],[[126483,126483],"mapped",[1585]],[[126484,126484],"mapped",[1588]],[[126485,126485],"mapped",[1578]],[[126486,126486],"mapped",[1579]],[[126487,126487],"mapped",[1582]],[[126488,126488],"mapped",[1584]],[[126489,126489],"mapped",[1590]],[[126490,126490],"mapped",[1592]],[[126491,126491],"mapped",[1594]],[[126492,126492],"mapped",[1646]],[[126493,126493],"mapped",[1722]],[[126494,126494],"mapped",[1697]],[[126495,126495],"mapped",[1647]],[[126496,126496],"disallowed"],[[126497,126497],"mapped",[1576]],[[126498,126498],"mapped",[1580]],[[126499,126499],"disallowed"],[[126500,126500],"mapped",[1607]],[[126501,126502],"disallowed"],[[126503,126503],"mapped",[1581]],[[126504,126504],"disallowed"],[[126505,126505],"mapped",[1610]],[[126506,126506],"mapped",[1603]],[[126507,126507],"mapped",[1604]],[[126508,126508],"mapped",[1605]],[[126509,126509],"mapped",[1606]],[[126510,126510],"mapped",[1587]],[[126511,126511],"mapped",[1593]],[[126512,126512],"mapped",[1601]],[[126513,126513],"mapped",[1589]],[[126514,126514],"mapped",[1602]],[[126515,126515],"disallowed"],[[126516,126516],"mapped",[1588]],[[126517,126517],"mapped",[1578]],[[126518,126518],"mapped",[1579]],[[126519,126519],"mapped",[1582]],[[126520,126520],"disallowed"],[[126521,126521],"mapped",[1590]],[[126522,126522],"disallowed"],[[126523,126523],"mapped",[1594]],[[126524,126529],"disallowed"],[[126530,126530],"mapped",[1580]],[[126531,126534],"disallowed"],[[126535,126535],"mapped",[1581]],[[126536,126536],"disallowed"],[[126537,126537],"mapped",[1610]],[[126538,126538],"disallowed"],[[126539,126539],"mapped",[1604]],[[126540,126540],"disallowed"],[[126541,126541],"mapped",[1606]],[[126542,126542],"mapped",[1587]],[[126543,126543],"mapped",[1593]],[[126544,126544],"disallowed"],[[126545,126545],"mapped",[1589]],[[126546,126546],"mapped",[1602]],[[126547,126547],"disallowed"],[[126548,126548],"mapped",[1588]],[[126549,126550],"disallowed"],[[126551,126551],"mapped",[1582]],[[126552,126552],"disallowed"],[[126553,126553],"mapped",[1590]],[[126554,126554],"disallowed"],[[126555,126555],"mapped",[1594]],[[126556,126556],"disallowed"],[[126557,126557],"mapped",[1722]],[[126558,126558],"disallowed"],[[126559,126559],"mapped",[1647]],[[126560,126560],"disallowed"],[[126561,126561],"mapped",[1576]],[[126562,126562],"mapped",[1580]],[[126563,126563],"disallowed"],[[126564,126564],"mapped",[1607]],[[126565,126566],"disallowed"],[[126567,126567],"mapped",[1581]],[[126568,126568],"mapped",[1591]],[[126569,126569],"mapped",[1610]],[[126570,126570],"mapped",[1603]],[[126571,126571],"disallowed"],[[126572,126572],"mapped",[1605]],[[126573,126573],"mapped",[1606]],[[126574,126574],"mapped",[1587]],[[126575,126575],"mapped",[1593]],[[126576,126576],"mapped",[1601]],[[126577,126577],"mapped",[1589]],[[126578,126578],"mapped",[1602]],[[126579,126579],"disallowed"],[[126580,126580],"mapped",[1588]],[[126581,126581],"mapped",[1578]],[[126582,126582],"mapped",[1579]],[[126583,126583],"mapped",[1582]],[[126584,126584],"disallowed"],[[126585,126585],"mapped",[1590]],[[126586,126586],"mapped",[1592]],[[126587,126587],"mapped",[1594]],[[126588,126588],"mapped",[1646]],[[126589,126589],"disallowed"],[[126590,126590],"mapped",[1697]],[[126591,126591],"disallowed"],[[126592,126592],"mapped",[1575]],[[126593,126593],"mapped",[1576]],[[126594,126594],"mapped",[1580]],[[126595,126595],"mapped",[1583]],[[126596,126596],"mapped",[1607]],[[126597,126597],"mapped",[1608]],[[126598,126598],"mapped",[1586]],[[126599,126599],"mapped",[1581]],[[126600,126600],"mapped",[1591]],[[126601,126601],"mapped",[1610]],[[126602,126602],"disallowed"],[[126603,126603],"mapped",[1604]],[[126604,126604],"mapped",[1605]],[[126605,126605],"mapped",[1606]],[[126606,126606],"mapped",[1587]],[[126607,126607],"mapped",[1593]],[[126608,126608],"mapped",[1601]],[[126609,126609],"mapped",[1589]],[[126610,126610],"mapped",[1602]],[[126611,126611],"mapped",[1585]],[[126612,126612],"mapped",[1588]],[[126613,126613],"mapped",[1578]],[[126614,126614],"mapped",[1579]],[[126615,126615],"mapped",[1582]],[[126616,126616],"mapped",[1584]],[[126617,126617],"mapped",[1590]],[[126618,126618],"mapped",[1592]],[[126619,126619],"mapped",[1594]],[[126620,126624],"disallowed"],[[126625,126625],"mapped",[1576]],[[126626,126626],"mapped",[1580]],[[126627,126627],"mapped",[1583]],[[126628,126628],"disallowed"],[[126629,126629],"mapped",[1608]],[[126630,126630],"mapped",[1586]],[[126631,126631],"mapped",[1581]],[[126632,126632],"mapped",[1591]],[[126633,126633],"mapped",[1610]],[[126634,126634],"disallowed"],[[126635,126635],"mapped",[1604]],[[126636,126636],"mapped",[1605]],[[126637,126637],"mapped",[1606]],[[126638,126638],"mapped",[1587]],[[126639,126639],"mapped",[1593]],[[126640,126640],"mapped",[1601]],[[126641,126641],"mapped",[1589]],[[126642,126642],"mapped",[1602]],[[126643,126643],"mapped",[1585]],[[126644,126644],"mapped",[1588]],[[126645,126645],"mapped",[1578]],[[126646,126646],"mapped",[1579]],[[126647,126647],"mapped",[1582]],[[126648,126648],"mapped",[1584]],[[126649,126649],"mapped",[1590]],[[126650,126650],"mapped",[1592]],[[126651,126651],"mapped",[1594]],[[126652,126703],"disallowed"],[[126704,126705],"valid",[],"NV8"],[[126706,126975],"disallowed"],[[126976,127019],"valid",[],"NV8"],[[127020,127023],"disallowed"],[[127024,127123],"valid",[],"NV8"],[[127124,127135],"disallowed"],[[127136,127150],"valid",[],"NV8"],[[127151,127152],"disallowed"],[[127153,127166],"valid",[],"NV8"],[[127167,127167],"valid",[],"NV8"],[[127168,127168],"disallowed"],[[127169,127183],"valid",[],"NV8"],[[127184,127184],"disallowed"],[[127185,127199],"valid",[],"NV8"],[[127200,127221],"valid",[],"NV8"],[[127222,127231],"disallowed"],[[127232,127232],"disallowed"],[[127233,127233],"disallowed_STD3_mapped",[48,44]],[[127234,127234],"disallowed_STD3_mapped",[49,44]],[[127235,127235],"disallowed_STD3_mapped",[50,44]],[[127236,127236],"disallowed_STD3_mapped",[51,44]],[[127237,127237],"disallowed_STD3_mapped",[52,44]],[[127238,127238],"disallowed_STD3_mapped",[53,44]],[[127239,127239],"disallowed_STD3_mapped",[54,44]],[[127240,127240],"disallowed_STD3_mapped",[55,44]],[[127241,127241],"disallowed_STD3_mapped",[56,44]],[[127242,127242],"disallowed_STD3_mapped",[57,44]],[[127243,127244],"valid",[],"NV8"],[[127245,127247],"disallowed"],[[127248,127248],"disallowed_STD3_mapped",[40,97,41]],[[127249,127249],"disallowed_STD3_mapped",[40,98,41]],[[127250,127250],"disallowed_STD3_mapped",[40,99,41]],[[127251,127251],"disallowed_STD3_mapped",[40,100,41]],[[127252,127252],"disallowed_STD3_mapped",[40,101,41]],[[127253,127253],"disallowed_STD3_mapped",[40,102,41]],[[127254,127254],"disallowed_STD3_mapped",[40,103,41]],[[127255,127255],"disallowed_STD3_mapped",[40,104,41]],[[127256,127256],"disallowed_STD3_mapped",[40,105,41]],[[127257,127257],"disallowed_STD3_mapped",[40,106,41]],[[127258,127258],"disallowed_STD3_mapped",[40,107,41]],[[127259,127259],"disallowed_STD3_mapped",[40,108,41]],[[127260,127260],"disallowed_STD3_mapped",[40,109,41]],[[127261,127261],"disallowed_STD3_mapped",[40,110,41]],[[127262,127262],"disallowed_STD3_mapped",[40,111,41]],[[127263,127263],"disallowed_STD3_mapped",[40,112,41]],[[127264,127264],"disallowed_STD3_mapped",[40,113,41]],[[127265,127265],"disallowed_STD3_mapped",[40,114,41]],[[127266,127266],"disallowed_STD3_mapped",[40,115,41]],[[127267,127267],"disallowed_STD3_mapped",[40,116,41]],[[127268,127268],"disallowed_STD3_mapped",[40,117,41]],[[127269,127269],"disallowed_STD3_mapped",[40,118,41]],[[127270,127270],"disallowed_STD3_mapped",[40,119,41]],[[127271,127271],"disallowed_STD3_mapped",[40,120,41]],[[127272,127272],"disallowed_STD3_mapped",[40,121,41]],[[127273,127273],"disallowed_STD3_mapped",[40,122,41]],[[127274,127274],"mapped",[12308,115,12309]],[[127275,127275],"mapped",[99]],[[127276,127276],"mapped",[114]],[[127277,127277],"mapped",[99,100]],[[127278,127278],"mapped",[119,122]],[[127279,127279],"disallowed"],[[127280,127280],"mapped",[97]],[[127281,127281],"mapped",[98]],[[127282,127282],"mapped",[99]],[[127283,127283],"mapped",[100]],[[127284,127284],"mapped",[101]],[[127285,127285],"mapped",[102]],[[127286,127286],"mapped",[103]],[[127287,127287],"mapped",[104]],[[127288,127288],"mapped",[105]],[[127289,127289],"mapped",[106]],[[127290,127290],"mapped",[107]],[[127291,127291],"mapped",[108]],[[127292,127292],"mapped",[109]],[[127293,127293],"mapped",[110]],[[127294,127294],"mapped",[111]],[[127295,127295],"mapped",[112]],[[127296,127296],"mapped",[113]],[[127297,127297],"mapped",[114]],[[127298,127298],"mapped",[115]],[[127299,127299],"mapped",[116]],[[127300,127300],"mapped",[117]],[[127301,127301],"mapped",[118]],[[127302,127302],"mapped",[119]],[[127303,127303],"mapped",[120]],[[127304,127304],"mapped",[121]],[[127305,127305],"mapped",[122]],[[127306,127306],"mapped",[104,118]],[[127307,127307],"mapped",[109,118]],[[127308,127308],"mapped",[115,100]],[[127309,127309],"mapped",[115,115]],[[127310,127310],"mapped",[112,112,118]],[[127311,127311],"mapped",[119,99]],[[127312,127318],"valid",[],"NV8"],[[127319,127319],"valid",[],"NV8"],[[127320,127326],"valid",[],"NV8"],[[127327,127327],"valid",[],"NV8"],[[127328,127337],"valid",[],"NV8"],[[127338,127338],"mapped",[109,99]],[[127339,127339],"mapped",[109,100]],[[127340,127343],"disallowed"],[[127344,127352],"valid",[],"NV8"],[[127353,127353],"valid",[],"NV8"],[[127354,127354],"valid",[],"NV8"],[[127355,127356],"valid",[],"NV8"],[[127357,127358],"valid",[],"NV8"],[[127359,127359],"valid",[],"NV8"],[[127360,127369],"valid",[],"NV8"],[[127370,127373],"valid",[],"NV8"],[[127374,127375],"valid",[],"NV8"],[[127376,127376],"mapped",[100,106]],[[127377,127386],"valid",[],"NV8"],[[127387,127461],"disallowed"],[[127462,127487],"valid",[],"NV8"],[[127488,127488],"mapped",[12411,12363]],[[127489,127489],"mapped",[12467,12467]],[[127490,127490],"mapped",[12469]],[[127491,127503],"disallowed"],[[127504,127504],"mapped",[25163]],[[127505,127505],"mapped",[23383]],[[127506,127506],"mapped",[21452]],[[127507,127507],"mapped",[12487]],[[127508,127508],"mapped",[20108]],[[127509,127509],"mapped",[22810]],[[127510,127510],"mapped",[35299]],[[127511,127511],"mapped",[22825]],[[127512,127512],"mapped",[20132]],[[127513,127513],"mapped",[26144]],[[127514,127514],"mapped",[28961]],[[127515,127515],"mapped",[26009]],[[127516,127516],"mapped",[21069]],[[127517,127517],"mapped",[24460]],[[127518,127518],"mapped",[20877]],[[127519,127519],"mapped",[26032]],[[127520,127520],"mapped",[21021]],[[127521,127521],"mapped",[32066]],[[127522,127522],"mapped",[29983]],[[127523,127523],"mapped",[36009]],[[127524,127524],"mapped",[22768]],[[127525,127525],"mapped",[21561]],[[127526,127526],"mapped",[28436]],[[127527,127527],"mapped",[25237]],[[127528,127528],"mapped",[25429]],[[127529,127529],"mapped",[19968]],[[127530,127530],"mapped",[19977]],[[127531,127531],"mapped",[36938]],[[127532,127532],"mapped",[24038]],[[127533,127533],"mapped",[20013]],[[127534,127534],"mapped",[21491]],[[127535,127535],"mapped",[25351]],[[127536,127536],"mapped",[36208]],[[127537,127537],"mapped",[25171]],[[127538,127538],"mapped",[31105]],[[127539,127539],"mapped",[31354]],[[127540,127540],"mapped",[21512]],[[127541,127541],"mapped",[28288]],[[127542,127542],"mapped",[26377]],[[127543,127543],"mapped",[26376]],[[127544,127544],"mapped",[30003]],[[127545,127545],"mapped",[21106]],[[127546,127546],"mapped",[21942]],[[127547,127551],"disallowed"],[[127552,127552],"mapped",[12308,26412,12309]],[[127553,127553],"mapped",[12308,19977,12309]],[[127554,127554],"mapped",[12308,20108,12309]],[[127555,127555],"mapped",[12308,23433,12309]],[[127556,127556],"mapped",[12308,28857,12309]],[[127557,127557],"mapped",[12308,25171,12309]],[[127558,127558],"mapped",[12308,30423,12309]],[[127559,127559],"mapped",[12308,21213,12309]],[[127560,127560],"mapped",[12308,25943,12309]],[[127561,127567],"disallowed"],[[127568,127568],"mapped",[24471]],[[127569,127569],"mapped",[21487]],[[127570,127743],"disallowed"],[[127744,127776],"valid",[],"NV8"],[[127777,127788],"valid",[],"NV8"],[[127789,127791],"valid",[],"NV8"],[[127792,127797],"valid",[],"NV8"],[[127798,127798],"valid",[],"NV8"],[[127799,127868],"valid",[],"NV8"],[[127869,127869],"valid",[],"NV8"],[[127870,127871],"valid",[],"NV8"],[[127872,127891],"valid",[],"NV8"],[[127892,127903],"valid",[],"NV8"],[[127904,127940],"valid",[],"NV8"],[[127941,127941],"valid",[],"NV8"],[[127942,127946],"valid",[],"NV8"],[[127947,127950],"valid",[],"NV8"],[[127951,127955],"valid",[],"NV8"],[[127956,127967],"valid",[],"NV8"],[[127968,127984],"valid",[],"NV8"],[[127985,127991],"valid",[],"NV8"],[[127992,127999],"valid",[],"NV8"],[[128000,128062],"valid",[],"NV8"],[[128063,128063],"valid",[],"NV8"],[[128064,128064],"valid",[],"NV8"],[[128065,128065],"valid",[],"NV8"],[[128066,128247],"valid",[],"NV8"],[[128248,128248],"valid",[],"NV8"],[[128249,128252],"valid",[],"NV8"],[[128253,128254],"valid",[],"NV8"],[[128255,128255],"valid",[],"NV8"],[[128256,128317],"valid",[],"NV8"],[[128318,128319],"valid",[],"NV8"],[[128320,128323],"valid",[],"NV8"],[[128324,128330],"valid",[],"NV8"],[[128331,128335],"valid",[],"NV8"],[[128336,128359],"valid",[],"NV8"],[[128360,128377],"valid",[],"NV8"],[[128378,128378],"disallowed"],[[128379,128419],"valid",[],"NV8"],[[128420,128420],"disallowed"],[[128421,128506],"valid",[],"NV8"],[[128507,128511],"valid",[],"NV8"],[[128512,128512],"valid",[],"NV8"],[[128513,128528],"valid",[],"NV8"],[[128529,128529],"valid",[],"NV8"],[[128530,128532],"valid",[],"NV8"],[[128533,128533],"valid",[],"NV8"],[[128534,128534],"valid",[],"NV8"],[[128535,128535],"valid",[],"NV8"],[[128536,128536],"valid",[],"NV8"],[[128537,128537],"valid",[],"NV8"],[[128538,128538],"valid",[],"NV8"],[[128539,128539],"valid",[],"NV8"],[[128540,128542],"valid",[],"NV8"],[[128543,128543],"valid",[],"NV8"],[[128544,128549],"valid",[],"NV8"],[[128550,128551],"valid",[],"NV8"],[[128552,128555],"valid",[],"NV8"],[[128556,128556],"valid",[],"NV8"],[[128557,128557],"valid",[],"NV8"],[[128558,128559],"valid",[],"NV8"],[[128560,128563],"valid",[],"NV8"],[[128564,128564],"valid",[],"NV8"],[[128565,128576],"valid",[],"NV8"],[[128577,128578],"valid",[],"NV8"],[[128579,128580],"valid",[],"NV8"],[[128581,128591],"valid",[],"NV8"],[[128592,128639],"valid",[],"NV8"],[[128640,128709],"valid",[],"NV8"],[[128710,128719],"valid",[],"NV8"],[[128720,128720],"valid",[],"NV8"],[[128721,128735],"disallowed"],[[128736,128748],"valid",[],"NV8"],[[128749,128751],"disallowed"],[[128752,128755],"valid",[],"NV8"],[[128756,128767],"disallowed"],[[128768,128883],"valid",[],"NV8"],[[128884,128895],"disallowed"],[[128896,128980],"valid",[],"NV8"],[[128981,129023],"disallowed"],[[129024,129035],"valid",[],"NV8"],[[129036,129039],"disallowed"],[[129040,129095],"valid",[],"NV8"],[[129096,129103],"disallowed"],[[129104,129113],"valid",[],"NV8"],[[129114,129119],"disallowed"],[[129120,129159],"valid",[],"NV8"],[[129160,129167],"disallowed"],[[129168,129197],"valid",[],"NV8"],[[129198,129295],"disallowed"],[[129296,129304],"valid",[],"NV8"],[[129305,129407],"disallowed"],[[129408,129412],"valid",[],"NV8"],[[129413,129471],"disallowed"],[[129472,129472],"valid",[],"NV8"],[[129473,131069],"disallowed"],[[131070,131071],"disallowed"],[[131072,173782],"valid"],[[173783,173823],"disallowed"],[[173824,177972],"valid"],[[177973,177983],"disallowed"],[[177984,178205],"valid"],[[178206,178207],"disallowed"],[[178208,183969],"valid"],[[183970,194559],"disallowed"],[[194560,194560],"mapped",[20029]],[[194561,194561],"mapped",[20024]],[[194562,194562],"mapped",[20033]],[[194563,194563],"mapped",[131362]],[[194564,194564],"mapped",[20320]],[[194565,194565],"mapped",[20398]],[[194566,194566],"mapped",[20411]],[[194567,194567],"mapped",[20482]],[[194568,194568],"mapped",[20602]],[[194569,194569],"mapped",[20633]],[[194570,194570],"mapped",[20711]],[[194571,194571],"mapped",[20687]],[[194572,194572],"mapped",[13470]],[[194573,194573],"mapped",[132666]],[[194574,194574],"mapped",[20813]],[[194575,194575],"mapped",[20820]],[[194576,194576],"mapped",[20836]],[[194577,194577],"mapped",[20855]],[[194578,194578],"mapped",[132380]],[[194579,194579],"mapped",[13497]],[[194580,194580],"mapped",[20839]],[[194581,194581],"mapped",[20877]],[[194582,194582],"mapped",[132427]],[[194583,194583],"mapped",[20887]],[[194584,194584],"mapped",[20900]],[[194585,194585],"mapped",[20172]],[[194586,194586],"mapped",[20908]],[[194587,194587],"mapped",[20917]],[[194588,194588],"mapped",[168415]],[[194589,194589],"mapped",[20981]],[[194590,194590],"mapped",[20995]],[[194591,194591],"mapped",[13535]],[[194592,194592],"mapped",[21051]],[[194593,194593],"mapped",[21062]],[[194594,194594],"mapped",[21106]],[[194595,194595],"mapped",[21111]],[[194596,194596],"mapped",[13589]],[[194597,194597],"mapped",[21191]],[[194598,194598],"mapped",[21193]],[[194599,194599],"mapped",[21220]],[[194600,194600],"mapped",[21242]],[[194601,194601],"mapped",[21253]],[[194602,194602],"mapped",[21254]],[[194603,194603],"mapped",[21271]],[[194604,194604],"mapped",[21321]],[[194605,194605],"mapped",[21329]],[[194606,194606],"mapped",[21338]],[[194607,194607],"mapped",[21363]],[[194608,194608],"mapped",[21373]],[[194609,194611],"mapped",[21375]],[[194612,194612],"mapped",[133676]],[[194613,194613],"mapped",[28784]],[[194614,194614],"mapped",[21450]],[[194615,194615],"mapped",[21471]],[[194616,194616],"mapped",[133987]],[[194617,194617],"mapped",[21483]],[[194618,194618],"mapped",[21489]],[[194619,194619],"mapped",[21510]],[[194620,194620],"mapped",[21662]],[[194621,194621],"mapped",[21560]],[[194622,194622],"mapped",[21576]],[[194623,194623],"mapped",[21608]],[[194624,194624],"mapped",[21666]],[[194625,194625],"mapped",[21750]],[[194626,194626],"mapped",[21776]],[[194627,194627],"mapped",[21843]],[[194628,194628],"mapped",[21859]],[[194629,194630],"mapped",[21892]],[[194631,194631],"mapped",[21913]],[[194632,194632],"mapped",[21931]],[[194633,194633],"mapped",[21939]],[[194634,194634],"mapped",[21954]],[[194635,194635],"mapped",[22294]],[[194636,194636],"mapped",[22022]],[[194637,194637],"mapped",[22295]],[[194638,194638],"mapped",[22097]],[[194639,194639],"mapped",[22132]],[[194640,194640],"mapped",[20999]],[[194641,194641],"mapped",[22766]],[[194642,194642],"mapped",[22478]],[[194643,194643],"mapped",[22516]],[[194644,194644],"mapped",[22541]],[[194645,194645],"mapped",[22411]],[[194646,194646],"mapped",[22578]],[[194647,194647],"mapped",[22577]],[[194648,194648],"mapped",[22700]],[[194649,194649],"mapped",[136420]],[[194650,194650],"mapped",[22770]],[[194651,194651],"mapped",[22775]],[[194652,194652],"mapped",[22790]],[[194653,194653],"mapped",[22810]],[[194654,194654],"mapped",[22818]],[[194655,194655],"mapped",[22882]],[[194656,194656],"mapped",[136872]],[[194657,194657],"mapped",[136938]],[[194658,194658],"mapped",[23020]],[[194659,194659],"mapped",[23067]],[[194660,194660],"mapped",[23079]],[[194661,194661],"mapped",[23000]],[[194662,194662],"mapped",[23142]],[[194663,194663],"mapped",[14062]],[[194664,194664],"disallowed"],[[194665,194665],"mapped",[23304]],[[194666,194667],"mapped",[23358]],[[194668,194668],"mapped",[137672]],[[194669,194669],"mapped",[23491]],[[194670,194670],"mapped",[23512]],[[194671,194671],"mapped",[23527]],[[194672,194672],"mapped",[23539]],[[194673,194673],"mapped",[138008]],[[194674,194674],"mapped",[23551]],[[194675,194675],"mapped",[23558]],[[194676,194676],"disallowed"],[[194677,194677],"mapped",[23586]],[[194678,194678],"mapped",[14209]],[[194679,194679],"mapped",[23648]],[[194680,194680],"mapped",[23662]],[[194681,194681],"mapped",[23744]],[[194682,194682],"mapped",[23693]],[[194683,194683],"mapped",[138724]],[[194684,194684],"mapped",[23875]],[[194685,194685],"mapped",[138726]],[[194686,194686],"mapped",[23918]],[[194687,194687],"mapped",[23915]],[[194688,194688],"mapped",[23932]],[[194689,194689],"mapped",[24033]],[[194690,194690],"mapped",[24034]],[[194691,194691],"mapped",[14383]],[[194692,194692],"mapped",[24061]],[[194693,194693],"mapped",[24104]],[[194694,194694],"mapped",[24125]],[[194695,194695],"mapped",[24169]],[[194696,194696],"mapped",[14434]],[[194697,194697],"mapped",[139651]],[[194698,194698],"mapped",[14460]],[[194699,194699],"mapped",[24240]],[[194700,194700],"mapped",[24243]],[[194701,194701],"mapped",[24246]],[[194702,194702],"mapped",[24266]],[[194703,194703],"mapped",[172946]],[[194704,194704],"mapped",[24318]],[[194705,194706],"mapped",[140081]],[[194707,194707],"mapped",[33281]],[[194708,194709],"mapped",[24354]],[[194710,194710],"mapped",[14535]],[[194711,194711],"mapped",[144056]],[[194712,194712],"mapped",[156122]],[[194713,194713],"mapped",[24418]],[[194714,194714],"mapped",[24427]],[[194715,194715],"mapped",[14563]],[[194716,194716],"mapped",[24474]],[[194717,194717],"mapped",[24525]],[[194718,194718],"mapped",[24535]],[[194719,194719],"mapped",[24569]],[[194720,194720],"mapped",[24705]],[[194721,194721],"mapped",[14650]],[[194722,194722],"mapped",[14620]],[[194723,194723],"mapped",[24724]],[[194724,194724],"mapped",[141012]],[[194725,194725],"mapped",[24775]],[[194726,194726],"mapped",[24904]],[[194727,194727],"mapped",[24908]],[[194728,194728],"mapped",[24910]],[[194729,194729],"mapped",[24908]],[[194730,194730],"mapped",[24954]],[[194731,194731],"mapped",[24974]],[[194732,194732],"mapped",[25010]],[[194733,194733],"mapped",[24996]],[[194734,194734],"mapped",[25007]],[[194735,194735],"mapped",[25054]],[[194736,194736],"mapped",[25074]],[[194737,194737],"mapped",[25078]],[[194738,194738],"mapped",[25104]],[[194739,194739],"mapped",[25115]],[[194740,194740],"mapped",[25181]],[[194741,194741],"mapped",[25265]],[[194742,194742],"mapped",[25300]],[[194743,194743],"mapped",[25424]],[[194744,194744],"mapped",[142092]],[[194745,194745],"mapped",[25405]],[[194746,194746],"mapped",[25340]],[[194747,194747],"mapped",[25448]],[[194748,194748],"mapped",[25475]],[[194749,194749],"mapped",[25572]],[[194750,194750],"mapped",[142321]],[[194751,194751],"mapped",[25634]],[[194752,194752],"mapped",[25541]],[[194753,194753],"mapped",[25513]],[[194754,194754],"mapped",[14894]],[[194755,194755],"mapped",[25705]],[[194756,194756],"mapped",[25726]],[[194757,194757],"mapped",[25757]],[[194758,194758],"mapped",[25719]],[[194759,194759],"mapped",[14956]],[[194760,194760],"mapped",[25935]],[[194761,194761],"mapped",[25964]],[[194762,194762],"mapped",[143370]],[[194763,194763],"mapped",[26083]],[[194764,194764],"mapped",[26360]],[[194765,194765],"mapped",[26185]],[[194766,194766],"mapped",[15129]],[[194767,194767],"mapped",[26257]],[[194768,194768],"mapped",[15112]],[[194769,194769],"mapped",[15076]],[[194770,194770],"mapped",[20882]],[[194771,194771],"mapped",[20885]],[[194772,194772],"mapped",[26368]],[[194773,194773],"mapped",[26268]],[[194774,194774],"mapped",[32941]],[[194775,194775],"mapped",[17369]],[[194776,194776],"mapped",[26391]],[[194777,194777],"mapped",[26395]],[[194778,194778],"mapped",[26401]],[[194779,194779],"mapped",[26462]],[[194780,194780],"mapped",[26451]],[[194781,194781],"mapped",[144323]],[[194782,194782],"mapped",[15177]],[[194783,194783],"mapped",[26618]],[[194784,194784],"mapped",[26501]],[[194785,194785],"mapped",[26706]],[[194786,194786],"mapped",[26757]],[[194787,194787],"mapped",[144493]],[[194788,194788],"mapped",[26766]],[[194789,194789],"mapped",[26655]],[[194790,194790],"mapped",[26900]],[[194791,194791],"mapped",[15261]],[[194792,194792],"mapped",[26946]],[[194793,194793],"mapped",[27043]],[[194794,194794],"mapped",[27114]],[[194795,194795],"mapped",[27304]],[[194796,194796],"mapped",[145059]],[[194797,194797],"mapped",[27355]],[[194798,194798],"mapped",[15384]],[[194799,194799],"mapped",[27425]],[[194800,194800],"mapped",[145575]],[[194801,194801],"mapped",[27476]],[[194802,194802],"mapped",[15438]],[[194803,194803],"mapped",[27506]],[[194804,194804],"mapped",[27551]],[[194805,194805],"mapped",[27578]],[[194806,194806],"mapped",[27579]],[[194807,194807],"mapped",[146061]],[[194808,194808],"mapped",[138507]],[[194809,194809],"mapped",[146170]],[[194810,194810],"mapped",[27726]],[[194811,194811],"mapped",[146620]],[[194812,194812],"mapped",[27839]],[[194813,194813],"mapped",[27853]],[[194814,194814],"mapped",[27751]],[[194815,194815],"mapped",[27926]],[[194816,194816],"mapped",[27966]],[[194817,194817],"mapped",[28023]],[[194818,194818],"mapped",[27969]],[[194819,194819],"mapped",[28009]],[[194820,194820],"mapped",[28024]],[[194821,194821],"mapped",[28037]],[[194822,194822],"mapped",[146718]],[[194823,194823],"mapped",[27956]],[[194824,194824],"mapped",[28207]],[[194825,194825],"mapped",[28270]],[[194826,194826],"mapped",[15667]],[[194827,194827],"mapped",[28363]],[[194828,194828],"mapped",[28359]],[[194829,194829],"mapped",[147153]],[[194830,194830],"mapped",[28153]],[[194831,194831],"mapped",[28526]],[[194832,194832],"mapped",[147294]],[[194833,194833],"mapped",[147342]],[[194834,194834],"mapped",[28614]],[[194835,194835],"mapped",[28729]],[[194836,194836],"mapped",[28702]],[[194837,194837],"mapped",[28699]],[[194838,194838],"mapped",[15766]],[[194839,194839],"mapped",[28746]],[[194840,194840],"mapped",[28797]],[[194841,194841],"mapped",[28791]],[[194842,194842],"mapped",[28845]],[[194843,194843],"mapped",[132389]],[[194844,194844],"mapped",[28997]],[[194845,194845],"mapped",[148067]],[[194846,194846],"mapped",[29084]],[[194847,194847],"disallowed"],[[194848,194848],"mapped",[29224]],[[194849,194849],"mapped",[29237]],[[194850,194850],"mapped",[29264]],[[194851,194851],"mapped",[149000]],[[194852,194852],"mapped",[29312]],[[194853,194853],"mapped",[29333]],[[194854,194854],"mapped",[149301]],[[194855,194855],"mapped",[149524]],[[194856,194856],"mapped",[29562]],[[194857,194857],"mapped",[29579]],[[194858,194858],"mapped",[16044]],[[194859,194859],"mapped",[29605]],[[194860,194861],"mapped",[16056]],[[194862,194862],"mapped",[29767]],[[194863,194863],"mapped",[29788]],[[194864,194864],"mapped",[29809]],[[194865,194865],"mapped",[29829]],[[194866,194866],"mapped",[29898]],[[194867,194867],"mapped",[16155]],[[194868,194868],"mapped",[29988]],[[194869,194869],"mapped",[150582]],[[194870,194870],"mapped",[30014]],[[194871,194871],"mapped",[150674]],[[194872,194872],"mapped",[30064]],[[194873,194873],"mapped",[139679]],[[194874,194874],"mapped",[30224]],[[194875,194875],"mapped",[151457]],[[194876,194876],"mapped",[151480]],[[194877,194877],"mapped",[151620]],[[194878,194878],"mapped",[16380]],[[194879,194879],"mapped",[16392]],[[194880,194880],"mapped",[30452]],[[194881,194881],"mapped",[151795]],[[194882,194882],"mapped",[151794]],[[194883,194883],"mapped",[151833]],[[194884,194884],"mapped",[151859]],[[194885,194885],"mapped",[30494]],[[194886,194887],"mapped",[30495]],[[194888,194888],"mapped",[30538]],[[194889,194889],"mapped",[16441]],[[194890,194890],"mapped",[30603]],[[194891,194891],"mapped",[16454]],[[194892,194892],"mapped",[16534]],[[194893,194893],"mapped",[152605]],[[194894,194894],"mapped",[30798]],[[194895,194895],"mapped",[30860]],[[194896,194896],"mapped",[30924]],[[194897,194897],"mapped",[16611]],[[194898,194898],"mapped",[153126]],[[194899,194899],"mapped",[31062]],[[194900,194900],"mapped",[153242]],[[194901,194901],"mapped",[153285]],[[194902,194902],"mapped",[31119]],[[194903,194903],"mapped",[31211]],[[194904,194904],"mapped",[16687]],[[194905,194905],"mapped",[31296]],[[194906,194906],"mapped",[31306]],[[194907,194907],"mapped",[31311]],[[194908,194908],"mapped",[153980]],[[194909,194910],"mapped",[154279]],[[194911,194911],"disallowed"],[[194912,194912],"mapped",[16898]],[[194913,194913],"mapped",[154539]],[[194914,194914],"mapped",[31686]],[[194915,194915],"mapped",[31689]],[[194916,194916],"mapped",[16935]],[[194917,194917],"mapped",[154752]],[[194918,194918],"mapped",[31954]],[[194919,194919],"mapped",[17056]],[[194920,194920],"mapped",[31976]],[[194921,194921],"mapped",[31971]],[[194922,194922],"mapped",[32000]],[[194923,194923],"mapped",[155526]],[[194924,194924],"mapped",[32099]],[[194925,194925],"mapped",[17153]],[[194926,194926],"mapped",[32199]],[[194927,194927],"mapped",[32258]],[[194928,194928],"mapped",[32325]],[[194929,194929],"mapped",[17204]],[[194930,194930],"mapped",[156200]],[[194931,194931],"mapped",[156231]],[[194932,194932],"mapped",[17241]],[[194933,194933],"mapped",[156377]],[[194934,194934],"mapped",[32634]],[[194935,194935],"mapped",[156478]],[[194936,194936],"mapped",[32661]],[[194937,194937],"mapped",[32762]],[[194938,194938],"mapped",[32773]],[[194939,194939],"mapped",[156890]],[[194940,194940],"mapped",[156963]],[[194941,194941],"mapped",[32864]],[[194942,194942],"mapped",[157096]],[[194943,194943],"mapped",[32880]],[[194944,194944],"mapped",[144223]],[[194945,194945],"mapped",[17365]],[[194946,194946],"mapped",[32946]],[[194947,194947],"mapped",[33027]],[[194948,194948],"mapped",[17419]],[[194949,194949],"mapped",[33086]],[[194950,194950],"mapped",[23221]],[[194951,194951],"mapped",[157607]],[[194952,194952],"mapped",[157621]],[[194953,194953],"mapped",[144275]],[[194954,194954],"mapped",[144284]],[[194955,194955],"mapped",[33281]],[[194956,194956],"mapped",[33284]],[[194957,194957],"mapped",[36766]],[[194958,194958],"mapped",[17515]],[[194959,194959],"mapped",[33425]],[[194960,194960],"mapped",[33419]],[[194961,194961],"mapped",[33437]],[[194962,194962],"mapped",[21171]],[[194963,194963],"mapped",[33457]],[[194964,194964],"mapped",[33459]],[[194965,194965],"mapped",[33469]],[[194966,194966],"mapped",[33510]],[[194967,194967],"mapped",[158524]],[[194968,194968],"mapped",[33509]],[[194969,194969],"mapped",[33565]],[[194970,194970],"mapped",[33635]],[[194971,194971],"mapped",[33709]],[[194972,194972],"mapped",[33571]],[[194973,194973],"mapped",[33725]],[[194974,194974],"mapped",[33767]],[[194975,194975],"mapped",[33879]],[[194976,194976],"mapped",[33619]],[[194977,194977],"mapped",[33738]],[[194978,194978],"mapped",[33740]],[[194979,194979],"mapped",[33756]],[[194980,194980],"mapped",[158774]],[[194981,194981],"mapped",[159083]],[[194982,194982],"mapped",[158933]],[[194983,194983],"mapped",[17707]],[[194984,194984],"mapped",[34033]],[[194985,194985],"mapped",[34035]],[[194986,194986],"mapped",[34070]],[[194987,194987],"mapped",[160714]],[[194988,194988],"mapped",[34148]],[[194989,194989],"mapped",[159532]],[[194990,194990],"mapped",[17757]],[[194991,194991],"mapped",[17761]],[[194992,194992],"mapped",[159665]],[[194993,194993],"mapped",[159954]],[[194994,194994],"mapped",[17771]],[[194995,194995],"mapped",[34384]],[[194996,194996],"mapped",[34396]],[[194997,194997],"mapped",[34407]],[[194998,194998],"mapped",[34409]],[[194999,194999],"mapped",[34473]],[[195000,195000],"mapped",[34440]],[[195001,195001],"mapped",[34574]],[[195002,195002],"mapped",[34530]],[[195003,195003],"mapped",[34681]],[[195004,195004],"mapped",[34600]],[[195005,195005],"mapped",[34667]],[[195006,195006],"mapped",[34694]],[[195007,195007],"disallowed"],[[195008,195008],"mapped",[34785]],[[195009,195009],"mapped",[34817]],[[195010,195010],"mapped",[17913]],[[195011,195011],"mapped",[34912]],[[195012,195012],"mapped",[34915]],[[195013,195013],"mapped",[161383]],[[195014,195014],"mapped",[35031]],[[195015,195015],"mapped",[35038]],[[195016,195016],"mapped",[17973]],[[195017,195017],"mapped",[35066]],[[195018,195018],"mapped",[13499]],[[195019,195019],"mapped",[161966]],[[195020,195020],"mapped",[162150]],[[195021,195021],"mapped",[18110]],[[195022,195022],"mapped",[18119]],[[195023,195023],"mapped",[35488]],[[195024,195024],"mapped",[35565]],[[195025,195025],"mapped",[35722]],[[195026,195026],"mapped",[35925]],[[195027,195027],"mapped",[162984]],[[195028,195028],"mapped",[36011]],[[195029,195029],"mapped",[36033]],[[195030,195030],"mapped",[36123]],[[195031,195031],"mapped",[36215]],[[195032,195032],"mapped",[163631]],[[195033,195033],"mapped",[133124]],[[195034,195034],"mapped",[36299]],[[195035,195035],"mapped",[36284]],[[195036,195036],"mapped",[36336]],[[195037,195037],"mapped",[133342]],[[195038,195038],"mapped",[36564]],[[195039,195039],"mapped",[36664]],[[195040,195040],"mapped",[165330]],[[195041,195041],"mapped",[165357]],[[195042,195042],"mapped",[37012]],[[195043,195043],"mapped",[37105]],[[195044,195044],"mapped",[37137]],[[195045,195045],"mapped",[165678]],[[195046,195046],"mapped",[37147]],[[195047,195047],"mapped",[37432]],[[195048,195048],"mapped",[37591]],[[195049,195049],"mapped",[37592]],[[195050,195050],"mapped",[37500]],[[195051,195051],"mapped",[37881]],[[195052,195052],"mapped",[37909]],[[195053,195053],"mapped",[166906]],[[195054,195054],"mapped",[38283]],[[195055,195055],"mapped",[18837]],[[195056,195056],"mapped",[38327]],[[195057,195057],"mapped",[167287]],[[195058,195058],"mapped",[18918]],[[195059,195059],"mapped",[38595]],[[195060,195060],"mapped",[23986]],[[195061,195061],"mapped",[38691]],[[195062,195062],"mapped",[168261]],[[195063,195063],"mapped",[168474]],[[195064,195064],"mapped",[19054]],[[195065,195065],"mapped",[19062]],[[195066,195066],"mapped",[38880]],[[195067,195067],"mapped",[168970]],[[195068,195068],"mapped",[19122]],[[195069,195069],"mapped",[169110]],[[195070,195071],"mapped",[38923]],[[195072,195072],"mapped",[38953]],[[195073,195073],"mapped",[169398]],[[195074,195074],"mapped",[39138]],[[195075,195075],"mapped",[19251]],[[195076,195076],"mapped",[39209]],[[195077,195077],"mapped",[39335]],[[195078,195078],"mapped",[39362]],[[195079,195079],"mapped",[39422]],[[195080,195080],"mapped",[19406]],[[195081,195081],"mapped",[170800]],[[195082,195082],"mapped",[39698]],[[195083,195083],"mapped",[40000]],[[195084,195084],"mapped",[40189]],[[195085,195085],"mapped",[19662]],[[195086,195086],"mapped",[19693]],[[195087,195087],"mapped",[40295]],[[195088,195088],"mapped",[172238]],[[195089,195089],"mapped",[19704]],[[195090,195090],"mapped",[172293]],[[195091,195091],"mapped",[172558]],[[195092,195092],"mapped",[172689]],[[195093,195093],"mapped",[40635]],[[195094,195094],"mapped",[19798]],[[195095,195095],"mapped",[40697]],[[195096,195096],"mapped",[40702]],[[195097,195097],"mapped",[40709]],[[195098,195098],"mapped",[40719]],[[195099,195099],"mapped",[40726]],[[195100,195100],"mapped",[40763]],[[195101,195101],"mapped",[173568]],[[195102,196605],"disallowed"],[[196606,196607],"disallowed"],[[196608,262141],"disallowed"],[[262142,262143],"disallowed"],[[262144,327677],"disallowed"],[[327678,327679],"disallowed"],[[327680,393213],"disallowed"],[[393214,393215],"disallowed"],[[393216,458749],"disallowed"],[[458750,458751],"disallowed"],[[458752,524285],"disallowed"],[[524286,524287],"disallowed"],[[524288,589821],"disallowed"],[[589822,589823],"disallowed"],[[589824,655357],"disallowed"],[[655358,655359],"disallowed"],[[655360,720893],"disallowed"],[[720894,720895],"disallowed"],[[720896,786429],"disallowed"],[[786430,786431],"disallowed"],[[786432,851965],"disallowed"],[[851966,851967],"disallowed"],[[851968,917501],"disallowed"],[[917502,917503],"disallowed"],[[917504,917504],"disallowed"],[[917505,917505],"disallowed"],[[917506,917535],"disallowed"],[[917536,917631],"disallowed"],[[917632,917759],"disallowed"],[[917760,917999],"ignored"],[[918000,983037],"disallowed"],[[983038,983039],"disallowed"],[[983040,1048573],"disallowed"],[[1048574,1048575],"disallowed"],[[1048576,1114109],"disallowed"],[[1114110,1114111],"disallowed"]] \ No newline at end of file diff --git a/project starter code/node_modules/tr46/package.json b/project starter code/node_modules/tr46/package.json new file mode 100644 index 00000000..b6826da1 --- /dev/null +++ b/project starter code/node_modules/tr46/package.json @@ -0,0 +1,31 @@ +{ + "name": "tr46", + "version": "0.0.3", + "description": "An implementation of the Unicode TR46 spec", + "main": "index.js", + "scripts": { + "test": "mocha", + "pretest": "node scripts/getLatestUnicodeTests.js", + "prepublish": "node scripts/generateMappingTable.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Sebmaster/tr46.js.git" + }, + "keywords": [ + "unicode", + "tr46", + "url", + "whatwg" + ], + "author": "Sebastian Mayr ", + "license": "MIT", + "bugs": { + "url": "https://github.com/Sebmaster/tr46.js/issues" + }, + "homepage": "https://github.com/Sebmaster/tr46.js#readme", + "devDependencies": { + "mocha": "^2.2.5", + "request": "^2.57.0" + } +} diff --git a/project starter code/node_modules/undefsafe/.github/workflows/release.yml b/project starter code/node_modules/undefsafe/.github/workflows/release.yml new file mode 100644 index 00000000..e6ee8866 --- /dev/null +++ b/project starter code/node_modules/undefsafe/.github/workflows/release.yml @@ -0,0 +1,25 @@ +name: Release +on: + push: + branches: + - master +jobs: + release: + name: Release + runs-on: ubuntu-18.04 + steps: + - name: Checkout + uses: actions/checkout@v1 + - name: Setup Node.js + uses: actions/setup-node@v1 + with: + node-version: 16 + - name: Install dependencies + run: npm ci + - name: Test + run: npm run test + - name: Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npx semantic-release diff --git a/project starter code/node_modules/undefsafe/.jscsrc b/project starter code/node_modules/undefsafe/.jscsrc new file mode 100644 index 00000000..9e01c9be --- /dev/null +++ b/project starter code/node_modules/undefsafe/.jscsrc @@ -0,0 +1,13 @@ +{ + "preset": "node-style-guide", + "requireCapitalizedComments": null, + "requireSpacesInAnonymousFunctionExpression": { + "beforeOpeningCurlyBrace": true, + "beforeOpeningRoundBrace": true + }, + "disallowSpacesInNamedFunctionExpression": { + "beforeOpeningRoundBrace": true + }, + "excludeFiles": ["node_modules/**"], + "disallowSpacesInFunction": null +} diff --git a/project starter code/node_modules/undefsafe/.jshintrc b/project starter code/node_modules/undefsafe/.jshintrc new file mode 100644 index 00000000..b47f672f --- /dev/null +++ b/project starter code/node_modules/undefsafe/.jshintrc @@ -0,0 +1,16 @@ +{ + "browser": false, + "camelcase": true, + "curly": true, + "devel": true, + "eqeqeq": true, + "forin": true, + "indent": 2, + "noarg": true, + "node": true, + "quotmark": "single", + "undef": true, + "strict": false, + "unused": true +} + diff --git a/project starter code/node_modules/undefsafe/.travis.yml b/project starter code/node_modules/undefsafe/.travis.yml new file mode 100644 index 00000000..a1ace24a --- /dev/null +++ b/project starter code/node_modules/undefsafe/.travis.yml @@ -0,0 +1,18 @@ +sudo: false +language: node_js +cache: + directories: + - node_modules +notifications: + email: false +node_js: + - '4' +before_install: + - npm i -g npm@^2.0.0 +before_script: + - npm prune +after_success: + - npm run semantic-release +branches: + except: + - "/^v\\d+\\.\\d+\\.\\d+$/" diff --git a/project starter code/node_modules/undefsafe/LICENSE b/project starter code/node_modules/undefsafe/LICENSE new file mode 100644 index 00000000..caaf03ae --- /dev/null +++ b/project starter code/node_modules/undefsafe/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright © 2016 Remy Sharp, http://remysharp.com + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/project starter code/node_modules/undefsafe/README.md b/project starter code/node_modules/undefsafe/README.md new file mode 100644 index 00000000..46a706bc --- /dev/null +++ b/project starter code/node_modules/undefsafe/README.md @@ -0,0 +1,63 @@ +# undefsafe + +Simple *function* for retrieving deep object properties without getting "Cannot read property 'X' of undefined" + +Can also be used to safely set deep values. + +## Usage + +```js +var object = { + a: { + b: { + c: 1, + d: [1,2,3], + e: 'remy' + } + } +}; + +console.log(undefsafe(object, 'a.b.e')); // "remy" +console.log(undefsafe(object, 'a.b.not.found')); // undefined +``` + +Demo: [https://jsbin.com/eroqame/3/edit?js,console](https://jsbin.com/eroqame/3/edit?js,console) + +## Setting + +```js +var object = { + a: { + b: [1,2,3] + } +}; + +// modified object +var res = undefsafe(object, 'a.b.0', 10); + +console.log(object); // { a: { b: [10, 2, 3] } } +console.log(res); // 1 - previous value +``` + +## Star rules in paths + +As of 1.2.0, `undefsafe` supports a `*` in the path if you want to search all of the properties (or array elements) for a particular element. + +The function will only return a single result, either the 3rd argument validation value, or the first positive match. For example, the following github data: + +```js +const githubData = { + commits: [{ + modified: [ + "one", + "two" + ] + }, /* ... */ ] + }; + +// first modified file found in the first commit +console.log(undefsafe(githubData, 'commits.*.modified.0')); + +// returns `two` or undefined if not found +console.log(undefsafe(githubData, 'commits.*.modified.*', 'two')); +``` diff --git a/project starter code/node_modules/undefsafe/example.js b/project starter code/node_modules/undefsafe/example.js new file mode 100644 index 00000000..ed93c23b --- /dev/null +++ b/project starter code/node_modules/undefsafe/example.js @@ -0,0 +1,14 @@ +var undefsafe = require('undefsafe'); + +var object = { + a: { + b: { + c: 1, + d: [1, 2, 3], + e: 'remy' + } + } +}; + +console.log(undefsafe(object, 'a.b.e')); // "remy" +console.log(undefsafe(object, 'a.b.not.found')); // undefined diff --git a/project starter code/node_modules/undefsafe/lib/undefsafe.js b/project starter code/node_modules/undefsafe/lib/undefsafe.js new file mode 100644 index 00000000..74468780 --- /dev/null +++ b/project starter code/node_modules/undefsafe/lib/undefsafe.js @@ -0,0 +1,125 @@ +'use strict'; + +function undefsafe(obj, path, value, __res) { + // I'm not super keen on this private function, but it's because + // it'll also be use in the browser and I wont *one* function exposed + function split(path) { + var res = []; + var level = 0; + var key = ''; + + for (var i = 0; i < path.length; i++) { + var c = path.substr(i, 1); + + if (level === 0 && (c === '.' || c === '[')) { + if (c === '[') { + level++; + i++; + c = path.substr(i, 1); + } + + if (key) { + // the first value could be a string + res.push(key); + } + key = ''; + continue; + } + + if (c === ']') { + level--; + key = key.slice(0, -1); + continue; + } + + key += c; + } + + res.push(key); + + return res; + } + + // bail if there's nothing + if (obj === undefined || obj === null) { + return undefined; + } + + var parts = split(path); + var key = null; + var type = typeof obj; + var root = obj; + var parent = obj; + + var star = + parts.filter(function(_) { + return _ === '*'; + }).length > 0; + + // we're dealing with a primitive + if (type !== 'object' && type !== 'function') { + return obj; + } else if (path.trim() === '') { + return obj; + } + + key = parts[0]; + var i = 0; + for (; i < parts.length; i++) { + key = parts[i]; + parent = obj; + + if (key === '*') { + // loop through each property + var prop = ''; + var res = __res || []; + + for (prop in parent) { + var shallowObj = undefsafe( + obj[prop], + parts.slice(i + 1).join('.'), + value, + res + ); + if (shallowObj && shallowObj !== res) { + if ((value && shallowObj === value) || value === undefined) { + if (value !== undefined) { + return shallowObj; + } + + res.push(shallowObj); + } + } + } + + if (res.length === 0) { + return undefined; + } + + return res; + } + + if (Object.getOwnPropertyNames(obj).indexOf(key) == -1) { + return undefined; + } + + obj = obj[key]; + if (obj === undefined || obj === null) { + break; + } + } + + // if we have a null object, make sure it's the one the user was after, + // if it's not (i.e. parts has a length) then give undefined back. + if (obj === null && i !== parts.length - 1) { + obj = undefined; + } else if (!star && value) { + key = path.split('.').pop(); + parent[key] = value; + } + return obj; +} + +if (typeof module !== 'undefined') { + module.exports = undefsafe; +} diff --git a/project starter code/node_modules/undefsafe/package.json b/project starter code/node_modules/undefsafe/package.json new file mode 100644 index 00000000..a4542332 --- /dev/null +++ b/project starter code/node_modules/undefsafe/package.json @@ -0,0 +1,34 @@ +{ + "name": "undefsafe", + "description": "Undefined safe way of extracting object properties", + "main": "lib/undefsafe.js", + "tonicExampleFilename": "example.js", + "directories": { + "test": "test" + }, + "scripts": { + "test": "tap test/**/*.test.js -R spec", + "cover": "tap test/*.test.js --cov --coverage-report=lcov", + "semantic-release": "semantic-release" + }, + "prettier": { + "trailingComma": "none", + "singleQuote": true + }, + "repository": { + "type": "git", + "url": "https://github.com/remy/undefsafe.git" + }, + "keywords": [ + "undefined" + ], + "author": "Remy Sharp", + "license": "MIT", + "devDependencies": { + "semantic-release": "^18.0.0", + "tap": "^5.7.1", + "tap-only": "0.0.5" + }, + "dependencies": {}, + "version": "2.0.5" +} diff --git a/project starter code/node_modules/utif/README.md b/project starter code/node_modules/utif/README.md deleted file mode 100644 index c891a808..00000000 --- a/project starter code/node_modules/utif/README.md +++ /dev/null @@ -1,79 +0,0 @@ -# UTIF.js -A small, fast and advanced TIFF / EXIF (+ DNG and other TIFF-ish files) decoder and encoder. It is the main TIFF library for [Photopea image editor](https://www.photopea.com). Try to open your TIFF file with Photopea to see, if UTIF.js can parse it. - -* Supports Black & White, Grayscale, RGB and Paletted images -* Supports Fax 3 and Fax 4 (CCITT), JPEG, LZW, PackBits and other compressions (1,3,4,5,6,7,8,32773,32809) -* E.g. [this 8 MPix image](//www.photopea.com/api/img/G4.TIF) with Fax 4 compression is just 56 kB ( [Open in Photopea](https://www.photopea.com?p=%7B%22files%22:%5B%22//www.photopea.com/api/img/G4.TIF%22%5D%7D) ) - -## Installation - -Download and include the `UTIF.js` file in your code. If you're in NodeJS or otherwise using NPM, run: - -```sh -npm install utif -``` - -#### `UTIF.decode(buffer)` -* `buffer`: ArrayBuffer containing TIFF or EXIF data -* returns an array of "IFDs" (image file directories). Each IFD is an object, keys are "tXYZ" (XYZ is a TIFF tag number), values are values of these tags. You can get the the dimension (and other properties, "metadata") of the image without decompressing pixel data. - -#### `UTIF.decodeImages(buffer, ifds)` -* `buffer`: ArrayBuffer containing TIFF or EXIF data -* `ifds`: the output of UTIF.decode() -* loops through each IFD. If there is an image inside it, it is decoded and three new properties are added to the IFD: -* * `width`: the width of the image -* * `height`: the height of the image -* * `data`: decompressed pixel data of the image - -TIFF files may have various number of channels and various color depth. The interpretation of `data` depends on many tags (see the [TIFF 6 specification](http://www.npes.org/pdf/TIFF-v6.pdf)). The following function converts any TIFF image into a 8-bit RGBA image. - -#### `UTIF.toRGBA8(ifd)` -* `ifd`: image file directory (element of "ifds" returned by UTIF.decode(), processed by UTIF.decodeImages()) -* returns Uint8Array of the image in RGBA format, 8 bits per channel (ready to use in context2d.putImageData() etc.) - -### Example - -```javascript -function imgLoaded(e) { - var ifds = UTIF.decode(e.target.response); - UTIF.decodeImages(e.target.response, ifds) - var rgba = UTIF.toRGBA8(ifds[0]); // Uint8Array with RGBA pixels - console.log(ifds[0].width, ifds[0].height, ifds[0]); -} - -var xhr = new XMLHttpRequest(); -xhr.open("GET", "my_image.tif"); -xhr.responseType = "arraybuffer"; -xhr.onload = imgLoaded; xhr.send(); -``` -## Use TIFF images in HTML - -If you are not a programmer, you can use TIFF images directly inside the `` element of HTML. Then, it is enough to call `UTIF.replaceIMG()` once at some point. - -#### `UTIF.replaceIMG()` -```html - -... - ... -``` -And UTIF.js will do the rest. Internally, an Image elements will be replaced by a Canvas elements. The attributes "id", "class" and "style" will be copied from the original Image to the new Canvas. Use CSS to style such images. - - -## Encoding TIFF images - -You should not save images into TIFF format in the 21st century. Save them as PNG instead (e.g. using [UPNG.js](https://github.com/photopea/UPNG.js)). If you still want to use TIFF format for some reason, here it is. - -#### `UTIF.encodeImage(rgba, w, h, metadata)` -* `rgba`: ArrayBuffer containing RGBA pixel data -* `w`: image width -* `h`: image height -* `metadata` [optional]: IFD object (see below) -* returns ArrayBuffer of the binary TIFF file. No compression right now. - -#### `UTIF.encode(ifds)` -* `ifds`: array of IFDs (image file directories). An IFD is a JS object with properties "tXYZ" (where XYZ are TIFF tags) -* returns ArrayBuffer of binary data. You can use it to encode EXIF data. - -## Dependencies -TIFF format sometimes uses Inflate algorithm for compression (but it is quite rare). Right now, UTIF.js calls [Pako.js](https://github.com/nodeca/pako) for the Inflate method. -TIFF format sometimes uses JPEG compression (but it is quite rare). Right now, UTIF.js calls "JpegDecoder" constructor, which comes from [pdf.js](https://github.com/mozilla/pdf.js). You can find it "separated" from pdf.js in libraries such as jpg.js. diff --git a/project starter code/node_modules/utif/UTIF.js b/project starter code/node_modules/utif/UTIF.js deleted file mode 100644 index 22c1dbe1..00000000 --- a/project starter code/node_modules/utif/UTIF.js +++ /dev/null @@ -1,945 +0,0 @@ - - - - -;(function(){ -var UTIF = {}; - -// Make available for import by `require()` -if (typeof module == "object") {module.exports = UTIF;} -else {self.UTIF = UTIF;} - -var pako; -if (typeof require == "function") {pako = require("pako");} -else {pako = self.pako;} - -function log() { if (typeof process=="undefined" || process.env.NODE_ENV=="development") console.log.apply(console, arguments); } - -(function(UTIF, pako){ - -// Following lines add a JPEG decoder to UTIF.JpegDecoder -(function(){var V="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(g){return typeof g}:function(g){return g&&"function"===typeof Symbol&&g.constructor===Symbol&&g!==Symbol.prototype?"symbol":typeof g},D=function(){function g(g){this.message="JPEG error: "+g}g.prototype=Error();g.prototype.name="JpegError";return g.constructor=g}(),P=function(){function g(g,D){this.message=g;this.g=D}g.prototype=Error();g.prototype.name="DNLMarkerError";return g.constructor=g}();(function(){function g(){this.M= -null;this.B=-1}function W(a,d){for(var f=0,e=[],b,B,k=16;0>x&1;z=a[d++];if(255=== -z){var c=a[d++];if(c){if(220===c&&g){d+=2;var b=a[d++]<<8|a[d++];if(0>>7}function q(a){for(;;){a=a[n()];if("number"===typeof a)return a;if("object"!==("undefined"===typeof a?"undefined":V(a)))throw new D("invalid huffman sequence");}}function h(a){for(var c=0;0= -1<d;){var h=q(a.o),k=h&15;h>>=4;if(0===k){if(15>h)break;d+=16}else d+=h,a.a[b+J[d]]=c(k),d++}}function w(a,d){var b=q(a.D);b=0===b?0:c(b)<>=4;if(0===f){if(15>e){A=h(e)+(1<a.a[f]? --1:1;switch(E){case 0:e=q(a.o);f=e&15;e>>=4;if(0===f)15>e?(A=h(e)+(1<=y)throw new D("marker was not found"); -if(65488<=y&&65495>=y)d+=2;else break}(y=N(a,d))&&y.f&&((0,_util.warn)("decodeScan - unexpected Scan data, current marker is: "+y.f),d=y.offset);return d-v}function Y(a,d){for(var f=d.c,e=d.l,b=new Int16Array(64),B=0;Bh;h+=8){var c=q[l+h];var C=q[l+h+1];var w=q[l+h+2];var p=q[l+h+3];var m=q[l+h+4];var t=q[l+h+5];var g=q[l+h+6];var u=q[l+h+7];c*=n[h];if(0===(C| -w|p|m|t|g|u))c=5793*c+512>>10,r[h]=c,r[h+1]=c,r[h+2]=c,r[h+3]=c,r[h+4]=c,r[h+5]=c,r[h+6]=c,r[h+7]=c;else{C*=n[h+1];w*=n[h+2];p*=n[h+3];m*=n[h+4];t*=n[h+5];g*=n[h+6];u*=n[h+7];var v=5793*c+128>>8;var z=5793*m+128>>8;var x=w;var A=g;m=2896*(C-u)+128>>8;u=2896*(C+u)+128>>8;p<<=4;t<<=4;v=v+z+1>>1;z=v-z;c=3784*x+1567*A+128>>8;x=1567*x-3784*A+128>>8;A=c;m=m+t+1>>1;t=m-t;u=u+p+1>>1;p=u-p;v=v+A+1>>1;A=v-A;z=z+x+1>>1;x=z-x;c=2276*m+3406*u+2048>>12;m=3406*m-2276*u+2048>>12;u=c;c=799*p+4017*t+2048>>12;p=4017* -p-799*t+2048>>12;t=c;r[h]=v+u;r[h+7]=v-u;r[h+1]=z+t;r[h+6]=z-t;r[h+2]=x+p;r[h+5]=x-p;r[h+3]=A+m;r[h+4]=A-m}}for(n=0;8>n;++n)c=r[n],C=r[n+8],w=r[n+16],p=r[n+24],m=r[n+32],t=r[n+40],g=r[n+48],u=r[n+56],0===(C|w|p|m|t|g|u)?(c=5793*c+8192>>14,c=-2040>c?0:2024<=c?255:c+2056>>4,q[l+n]=c,q[l+n+8]=c,q[l+n+16]=c,q[l+n+24]=c,q[l+n+32]=c,q[l+n+40]=c,q[l+n+48]=c,q[l+n+56]=c):(v=5793*c+2048>>12,z=5793*m+2048>>12,x=w,A=g,m=2896*(C-u)+2048>>12,u=2896*(C+u)+2048>>12,v=(v+z+1>>1)+4112,z=v-z,c=3784*x+1567*A+2048>> -12,x=1567*x-3784*A+2048>>12,A=c,m=m+t+1>>1,t=m-t,u=u+p+1>>1,p=u-p,v=v+A+1>>1,A=v-A,z=z+x+1>>1,x=z-x,c=2276*m+3406*u+2048>>12,m=3406*m-2276*u+2048>>12,u=c,c=799*p+4017*t+2048>>12,p=4017*p-799*t+2048>>12,t=c,c=v+u,u=v-u,C=z+t,g=z-t,w=x+p,t=x-p,p=A+m,m=A-m,c=16>c?0:4080<=c?255:c>>4,C=16>C?0:4080<=C?255:C>>4,w=16>w?0:4080<=w?255:w>>4,p=16>p?0:4080<=p?255:p>>4,m=16>m?0:4080<=m?255:m>>4,t=16>t?0:4080<=t?255:t>>4,g=16>g?0:4080<=g?255:g>>4,u=16>u?0:4080<=u?255:u>>4,q[l+n]=c,q[l+n+8]=C,q[l+n+16]=w,q[l+n+24]= -p,q[l+n+32]=m,q[l+n+40]=t,q[l+n+48]=g,q[l+n+56]=u)}return d.a}function N(a,d){var f=2=e)return null;var b=a[d]<<8|a[d+1];if(65472<=b&&65534>=b)return{f:null,F:b,offset:d};for(var B=a[f]<<8|a[f+1];!(65472<=B&&65534>=B);){if(++f>=e)return null;B=a[f]<<8|a[f+1]}return{f:b.toString(16),F:B,offset:f}}var J=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56, -57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]);g.prototype={parse:function(a){function d(){var d=a[k]<<8|a[k+1];k+=2;return d}function f(){var b=d();b=k+b-2;var c=N(a,b,k);c&&c.f&&((0,_util.warn)("readDataBlock - incorrect length, current marker is: "+c.f),b=c.offset);b=a.subarray(k,b);k+=b.length;return b}function e(a){for(var b=Math.ceil(a.v/8/a.s),c=Math.ceil(a.g/8/a.u),d=0;d>4)for(c=0;64>c;c++)g=J[c],p[g]=a[k++];else if(1===w>>4)for(c=0;64>c;c++)g=J[c],p[g]=d();else throw new D("DQT - invalid table spec");b[w&15]=p}break;case 65472:case 65473:case 65474:if(m)throw new D("Only single frame JPEGs supported");d();var m={};m.X=65473===h;m.S=65474===h;m.precision=a[k++];h=d();m.g= -B||h;m.v=d();m.b=[];m.C={};c=a[k++];for(h=p=w=0;h>4;var H=a[k+1]&15;wc;c++,k++)t+=p[c]=a[k];H=new Uint8Array(t);for(c=0;c>4?q:n)[w&15]=W(p,H)}break;case 65501:d();var u=d();break;case 65498:c=1===++r&&!B;d();w=a[k++];g=[];for(h=0;h>4];v.o=n[p&15];g.push(v)}h=a[k++];w=a[k++];p=a[k++];try{var z=X(a,k,m,g,u,h,w,p>>4,p&15,c);k+=z}catch(x){if(x instanceof P)return(0,_util.warn)('Attempting to re-parse JPEG image using "scanLines" parameter found in DNL marker (0xFFDC) segment.'),this.parse(a,{N:x.g});throw x;}break;case 65500:k+=4;break;case 65535:255!==a[k]&&k--;break;default:if(255===a[k-3]&&192<=a[k-2]&&254>=a[k-2])k-=3;else if((c=N(a,k-2))&&c.f)(0,_util.warn)("JpegImage.parse - unexpected data, current marker is: "+ -c.f),k=c.offset;else throw new D("unknown marker "+h.toString(16));}h=d()}this.width=m.v;this.height=m.g;this.A=l;this.b=[];for(h=0;h>8)+e[f+1];return r},w:function(){return this.A?!!this.A.W:3===this.i?0===this.B?!1:!0:1===this.B?!0:!1},I:function(a){for(var d,f,e,b=0,g=a.length;b>>3)]; if(bcnt==null) bcnt = img["t325"]; - var bytes = new Uint8Array(img.height*(bipl>>>3)), bilen = 0; - - if(img["t322"]!=null) // tiled - { - var tw = img["t322"][0], th = img["t323"][0]; - var tx = Math.floor((img.width + tw - 1) / tw); - var ty = Math.floor((img.height + th - 1) / th); - var tbuff = new Uint8Array(Math.ceil(tw*th*bipp/8)|0); - for(var y=0; y>>8); } - else if(bps==12) for(var i=0; i>>4); tgt[toff++] = ((out[i]<<4)|(out[i+1]>>>8))&255; tgt[toff++] = out[i+1]&255; } - else throw new Error("unsupported bit depth "+bps); - } - else - { - var parser = new UTIF.JpegDecoder(); parser.parse(buff); - var decoded = parser.getData(parser.width, parser.height); - for (var i=0; i 1); - } - - if(!isTiled) - { - if(data[off]==255 && data[off+1]==SOI) return { jpegOffset: off }; - if(jpgIchgFmt!=null) - { - if(data[off+jifoff]==255 && data[off+jifoff+1]==SOI) joff = off+jifoff; - else log("JPEGInterchangeFormat does not point to SOI"); - - if(jpgIchgFmtLen==null) log("JPEGInterchangeFormatLength field is missing"); - else if(jifoff >= soff || (jifoff+jiflen) <= soff) log("JPEGInterchangeFormatLength field value is invalid"); - - if(joff != null) return { jpegOffset: joff }; - } - } - - if(ycbcrss!=null) { ssx = ycbcrss[0]; ssy = ycbcrss[1]; } - - if(jpgIchgFmt!=null) - if(jpgIchgFmtLen!=null) - if(jiflen >= 2 && (jifoff+jiflen) <= soff) - { - if(data[off+jifoff+jiflen-2]==255 && data[off+jifoff+jiflen-1]==SOI) tables = new Uint8Array(jiflen-2); - else tables = new Uint8Array(jiflen); - - for(i=0; i offset to first strip or tile"); - - if(tables == null) - { - var ooff = 0, out = []; - out[ooff++] = 255; out[ooff++] = SOI; - - var qtables = img["t519"]; - if(qtables==null) throw new Error("JPEGQTables tag is missing"); - for(i=0; i>> 8); out[ooff++] = nc & 255; - out[ooff++] = (i | (k << 4)); - for(j=0; j<16; j++) out[ooff++] = data[off+htables[i]+j]; - for(j=0; j>> 8) & 255; out[ooff++] = img.height & 255; - out[ooff++] = (img.width >>> 8) & 255; out[ooff++] = img.width & 255; - out[ooff++] = spp; - if(spp==1) { out[ooff++] = 1; out[ooff++] = 17; out[ooff++] = 0; } - else for(i=0; i<3; i++) - { - out[ooff++] = i + 1; - out[ooff++] = (i != 0) ? 17 : (((ssx & 15) << 4) | (ssy & 15)); - out[ooff++] = i; - } - - if(jpgresint!=null && jpgresint[0]!=0) - { - out[ooff++] = 255; out[ooff++] = DRI; out[ooff++] = 0; out[ooff++] = 4; - out[ooff++] = (jpgresint[0] >>> 8) & 255; - out[ooff++] = jpgresint[0] & 255; - } - - tables = new Uint8Array(out); - } - - var sofpos = -1; - i = 0; - while(i < (tables.length - 1)) { - if(tables[i]==255 && tables[i+1]==SOF0) { sofpos = i; break; } - i++; - } - - if(sofpos == -1) - { - var tmptab = new Uint8Array(tables.length + 10 + 3*spp); - tmptab.set(tables); - var tmpoff = tables.length; - sofpos = tables.length; - tables = tmptab; - - tables[tmpoff++] = 255; tables[tmpoff++] = SOF0; - tables[tmpoff++] = 0; tables[tmpoff++] = 8 + 3*spp; tables[tmpoff++] = 8; - tables[tmpoff++] = (img.height >>> 8) & 255; tables[tmpoff++] = img.height & 255; - tables[tmpoff++] = (img.width >>> 8) & 255; tables[tmpoff++] = img.width & 255; - tables[tmpoff++] = spp; - if(spp==1) { tables[tmpoff++] = 1; tables[tmpoff++] = 17; tables[tmpoff++] = 0; } - else for(i=0; i<3; i++) - { - tables[tmpoff++] = i + 1; - tables[tmpoff++] = (i != 0) ? 17 : (((ssx & 15) << 4) | (ssy & 15)); - tables[tmpoff++] = i; - } - } - - if(data[soff]==255 && data[soff+1]==SOS) - { - var soslen = (data[soff+2]<<8) | data[soff+3]; - sosMarker = new Uint8Array(soslen+2); - sosMarker[0] = data[soff]; sosMarker[1] = data[soff+1]; sosMarker[2] = data[soff+2]; sosMarker[3] = data[soff+3]; - for(i=0; i<(soslen-2); i++) sosMarker[i+4] = data[soff+i+4]; - } - else - { - sosMarker = new Uint8Array(2 + 6 + 2*spp); - var sosoff = 0; - sosMarker[sosoff++] = 255; sosMarker[sosoff++] = SOS; - sosMarker[sosoff++] = 0; sosMarker[sosoff++] = 6 + 2*spp; sosMarker[sosoff++] = spp; - if(spp==1) { sosMarker[sosoff++] = 1; sosMarker[sosoff++] = 0; } - else for(i=0; i<3; i++) - { - sosMarker[sosoff++] = i+1; sosMarker[sosoff++] = (i << 4) | i; - } - sosMarker[sosoff++] = 0; sosMarker[sosoff++] = 63; sosMarker[sosoff++] = 0; - } - - return { jpegOffset: off, tables: tables, sosMarker: sosMarker, sofPosition: sofpos }; -} - -UTIF.decode._decodeOldJPEG = function(img, data, off, len, tgt, toff) -{ - var i, dlen, tlen, buff, buffoff; - var jpegData = UTIF.decode._decodeOldJPEGInit(img, data, off, len); - - if(jpegData.jpegOffset!=null) - { - dlen = off+len-jpegData.jpegOffset; - buff = new Uint8Array(dlen); - for(i=0; i>> 8) & 255; buff[jpegData.sofPosition+6] = img.height & 255; - buff[jpegData.sofPosition+7] = (img.width >>> 8) & 255; buff[jpegData.sofPosition+8] = img.width & 255; - - if(data[off]!=255 || data[off+1]!=SOS) - { - buff.set(jpegData.sosMarker, bufoff); - bufoff += sosMarker.length; - } - for(i=0; i=0 && n<128) for(var i=0; i< n+1; i++) { ta[toff]=sa[off]; toff++; off++; } - if(n>=-127 && n<0) { for(var i=0; i<-n+1; i++) { ta[toff]=sa[off]; toff++; } off++; } - } -} - -UTIF.decode._decodeThunder = function(data, off, len, tgt, toff) -{ - var d2 = [ 0, 1, 0, -1 ], d3 = [ 0, 1, 2, 3, 0, -3, -2, -1 ]; - var lim = off+len, qoff = toff*2, px = 0; - while(off>>6), n = (b&63); off++; - if(msk==3) { px=(n&15); tgt[qoff>>>1] |= (px<<(4*(1-qoff&1))); qoff++; } - if(msk==0) for(var i=0; i>>1] |= (px<<(4*(1-qoff&1))); qoff++; } - if(msk==2) for(var i=0; i<2; i++) { var d=(n>>>(3*(1-i)))&7; if(d!=4) { px+=d3[d]; tgt[qoff>>>1] |= (px<<(4*(1-qoff&1))); qoff++; } } - if(msk==1) for(var i=0; i<3; i++) { var d=(n>>>(2*(2-i)))&3; if(d!=2) { px+=d2[d]; tgt[qoff>>>1] |= (px<<(4*(1-qoff&1))); qoff++; } } - } -} - -UTIF.decode._dmap = { "1":0,"011":1,"000011":2,"0000011":3, "010":-1,"000010":-2,"0000010":-3 }; -UTIF.decode._lens = ( function() -{ - var addKeys = function(lens, arr, i0, inc) { for(var i=0; i>>3)>>3]>>>(7-(boff&7)))&1; - if(fo==2) bit = (data[boff>>>3]>>>( (boff&7)))&1; - boff++; wrd+=bit; - if(mode=="H") - { - if(U._lens[clr][wrd]!=null) - { - var dl=U._lens[clr][wrd]; wrd=""; len+=dl; - if(dl<64) { U._addNtimes(line,len,clr); a0+=len; clr=1-clr; len=0; toRead--; if(toRead==0) mode=""; } - } - } - else - { - if(wrd=="0001") { wrd=""; U._addNtimes(line,b2-a0,clr); a0=b2; } - if(wrd=="001" ) { wrd=""; mode="H"; toRead=2; } - if(U._dmap[wrd]!=null) { a1 = b1+U._dmap[wrd]; U._addNtimes(line, a1-a0, clr); a0=a1; wrd=""; clr=1-clr; } - } - if(line.length==w && mode=="") - { - U._writeBits(line, tgt, toff*8+y*bipl); - clr=0; y++; a0=0; - pline=U._makeDiff(line); line=[]; - } - //if(wrd.length>150) { log(wrd); break; throw "e"; } - } -} - -UTIF.decode._findDiff = function(line, x, clr) { for(var i=0; i=x && line[i+1]==clr) return line[i]; } - -UTIF.decode._makeDiff = function(line) -{ - var out = []; if(line[0]==1) out.push(0,1); - for(var i=1; i>>3)>>3]>>>(7-(boff&7)))&1; - if(fo==2) bit = (data[boff>>>3]>>>( (boff&7)))&1; - boff++; wrd+=bit; - - if(is1D) - { - if(U._lens[clr][wrd]!=null) - { - var dl=U._lens[clr][wrd]; wrd=""; len+=dl; - if(dl<64) { U._addNtimes(line,len,clr); clr=1-clr; len=0; } - } - } - else - { - if(mode=="H") - { - if(U._lens[clr][wrd]!=null) - { - var dl=U._lens[clr][wrd]; wrd=""; len+=dl; - if(dl<64) { U._addNtimes(line,len,clr); a0+=len; clr=1-clr; len=0; toRead--; if(toRead==0) mode=""; } - } - } - else - { - if(wrd=="0001") { wrd=""; U._addNtimes(line,b2-a0,clr); a0=b2; } - if(wrd=="001" ) { wrd=""; mode="H"; toRead=2; } - if(U._dmap[wrd]!=null) { a1 = b1+U._dmap[wrd]; U._addNtimes(line, a1-a0, clr); a0=a1; wrd=""; clr=1-clr; } - } - } - if(wrd.endsWith("000000000001")) // needed for some files - { - if(y>=0) U._writeBits(line, tgt, toff*8+y*bipl); - if(fo==1) is1D = ((data[boff>>>3]>>>(7-(boff&7)))&1)==1; - if(fo==2) is1D = ((data[boff>>>3]>>>( (boff&7)))&1)==1; - boff++; - if(U._decodeG3.allow2D==null) U._decodeG3.allow2D=is1D; - if(!U._decodeG3.allow2D) { is1D = true; boff--; } - //log("EOL",y, "next 1D:", is1D); - wrd=""; clr=0; y++; a0=0; - pline=U._makeDiff(line); line=[]; - } - } - if(line.length==w) U._writeBits(line, tgt, toff*8+y*bipl); -} - -UTIF.decode._addNtimes = function(arr, n, val) { for(var i=0; i>>3] |= (bits[i]<<(7-((boff+i)&7))); -} - -UTIF.decode._decodeLZW = function(data, off, tgt, toff) -{ - if(UTIF.decode._lzwTab==null) - { - var tb=new Uint32Array(0xffff), tn=new Uint16Array(0xffff), chr=new Uint8Array(2e6); - for(var i=0; i<256; i++) { chr[i<<2]=i; tb[i]=i<<2; tn[i]=1; } - UTIF.decode._lzwTab = [tb,tn,chr]; - } - var copy = UTIF.decode._copyData; - var tab = UTIF.decode._lzwTab[0], tln=UTIF.decode._lzwTab[1], chr=UTIF.decode._lzwTab[2], totl = 258, chrl = 258<<2; - var bits = 9, boff = off<<3; // offset in bits - - var ClearCode = 256, EoiCode = 257; - var v = 0, Code = 0, OldCode = 0; - while(true) - { - v = (data[boff>>>3]<<16) | (data[(boff+8)>>>3]<<8) | data[(boff+16)>>>3]; - Code = ( v>>(24-(boff&7)-bits) ) & ((1<>>3]<<16) | (data[(boff+8)>>>3]<<8) | data[(boff+16)>>>3]; - Code = ( v>>(24-(boff&7)-bits) ) & ((1<=totl) { tab[totl] = chrl; chr[tab[totl]] = cd[0]; tln[totl]=1; chrl=(chrl+1+3)&~0x03; totl++; } - else - { - tab[totl] = chrl; - var nit = tab[OldCode], nil = tln[OldCode]; - copy(chr,nit,chr,chrl,nil); - chr[chrl+nil]=chr[cd]; nil++; - tln[totl]=nil; totl++; - - chrl=(chrl+nil+3)&~0x03; - } - if(totl+1==(1<=totl) { tab[totl] = chrl; tln[totl]=0; totl++; } - else - { - tab[totl] = chrl; - var nit = tab[OldCode], nil = tln[OldCode]; - copy(chr,nit,chr,chrl,nil); - chr[chrl+nil]=chr[chrl]; nil++; - tln[totl]=nil; totl++; - - copy(chr,chrl,tgt,toff,nil); toff += nil; - chrl=(chrl+nil+3)&~0x03; - } - if(totl+1==(1<>>----------------"); - for(var i=0; i4) { bin.writeUint(data, offset, eoff); toff=eoff; } - - if(type==2) { bin.writeASCII(data, toff, val); } - if(type==3) { for(var i=0; i4) { dlen += (dlen&1); eoff += dlen; } - offset += 4; - } - return [offset, eoff]; -} - -UTIF.toRGBA8 = function(out) -{ - var w = out.width, h = out.height, area = w*h, qarea = area*4, data = out.data; - var img = new Uint8Array(area*4); - // 0: WhiteIsZero, 1: BlackIsZero, 2: RGB, 3: Palette color, 4: Transparency mask, 5: CMYK - var intp = out["t262"][0], bps = (out["t258"]?Math.min(32,out["t258"][0]):1), isLE = out.isLE ? 1 : 0; - //log("interpretation: ", intp, "bps", bps, out); - if(false) {} - else if(intp==0) - { - var bpl = Math.ceil(bps*w/8); - for(var y=0; y>3)])>>(7- (i&7)))& 1; img[qi]=img[qi+1]=img[qi+2]=( 1-px)*255; img[qi+3]=255; } - if(bps== 4) for(var i=0; i>1)])>>(4-4*(i&1)))&15; img[qi]=img[qi+1]=img[qi+2]=(15-px)* 17; img[qi+3]=255; } - if(bps== 8) for(var i=0; i>3)])>>(7- (i&7)))&1; img[qi]=img[qi+1]=img[qi+2]=(px)*255; img[qi+3]=255; } - if(bps== 2) for(var i=0; i>2)])>>(6-2*(i&3)))&3; img[qi]=img[qi+1]=img[qi+2]=(px)* 85; img[qi+3]=255; } - if(bps== 8) for(var i=0; i0) for(var i=0; i>8); img[qi+1]=(map[256+mi]>>8); img[qi+2]=(map[512+mi]>>8); img[qi+3]=255; } - } - else if(intp==5) - { - var smpls = out["t258"]?out["t258"].length : 4; - var gotAlpha = smpls>4 ? 1 : 0; - for(var i=0; i> 8)&255; buff[p+1] = n&255; }, - writeUint : function(buff, p, n) { buff[p] = (n>>24)&255; buff[p+1] = (n>>16)&255; buff[p+2] = (n>>8)&255; buff[p+3] = (n>>0)&255; }, - writeASCII : function(buff, p, s) { for(var i = 0; i < s.length; i++) buff[p+i] = s.charCodeAt(i); }, - writeDouble: function(buff, p, n) - { - UTIF._binBE.fl64[0] = n; - for (var i = 0; i < 8; i++) buff[p + i] = UTIF._binBE.ui8[7 - i]; - } -} -UTIF._binBE.ui8 = new Uint8Array (8); -UTIF._binBE.i16 = new Int16Array (UTIF._binBE.ui8.buffer); -UTIF._binBE.i32 = new Int32Array (UTIF._binBE.ui8.buffer); -UTIF._binBE.ui32 = new Uint32Array (UTIF._binBE.ui8.buffer); -UTIF._binBE.fl32 = new Float32Array(UTIF._binBE.ui8.buffer); -UTIF._binBE.fl64 = new Float64Array(UTIF._binBE.ui8.buffer); - -UTIF._binLE = -{ - nextZero : UTIF._binBE.nextZero, - readUshort : function(buff, p) { return (buff[p+1]<< 8) | buff[p]; }, - readShort : function(buff, p) { var a=UTIF._binBE.ui8; a[0]=buff[p+0]; a[1]=buff[p+1]; return UTIF._binBE. i16[0]; }, - readInt : function(buff, p) { var a=UTIF._binBE.ui8; a[0]=buff[p+0]; a[1]=buff[p+1]; a[2]=buff[p+2]; a[3]=buff[p+3]; return UTIF._binBE. i32[0]; }, - readUint : function(buff, p) { var a=UTIF._binBE.ui8; a[0]=buff[p+0]; a[1]=buff[p+1]; a[2]=buff[p+2]; a[3]=buff[p+3]; return UTIF._binBE.ui32[0]; }, - readASCII : UTIF._binBE.readASCII, - readFloat : function(buff, p) { var a=UTIF._binBE.ui8; for(var i=0;i<4;i++) a[i]=buff[p+ i]; return UTIF._binBE.fl32[0]; }, - readDouble : function(buff, p) { var a=UTIF._binBE.ui8; for(var i=0;i<8;i++) a[i]=buff[p+ i]; return UTIF._binBE.fl64[0]; } -} -UTIF._copyTile = function(tb, tw, th, b, w, h, xoff, yoff) -{ - //log("copyTile", tw, th, w, h, xoff, yoff); - var xlim = Math.min(tw, w-xoff); - var ylim = Math.min(th, h-yoff); - for(var y=0; y` element of HTML. Then, it is enough to call `UTIF.replaceIMG()` once at some point. + +#### `UTIF.replaceIMG()` +```html + +... + ... +``` +And UTIF.js will do the rest. Internally, the "src" attribute of the image will be replaced with a new URI of the image (base64-encoded PNG). Note, that you can also insert DNG, CR2, NEF and other raw images into HTML this way. + +## Encoding TIFF images + +You should not save images into TIFF format in the 21st century. Save them as PNG instead (e.g. using [UPNG.js](https://github.com/photopea/UPNG.js)). If you still want to use TIFF format for some reason, here it is. + +#### `UTIF.encodeImage(rgba, w, h, metadata)` +* `rgba`: ArrayBuffer containing RGBA pixel data +* `w`: image width +* `h`: image height +* `metadata` [optional]: IFD object (see below) +* returns ArrayBuffer of the binary TIFF file. No compression right now. + +#### `UTIF.encode(ifds)` +* `ifds`: array of IFDs (image file directories). An IFD is a JS object with properties "tXYZ" (where XYZ are TIFF tags) +* returns ArrayBuffer of binary data. You can use it to encode EXIF data. + +## Dependencies +TIFF format sometimes uses Inflate algorithm for compression (but it is quite rare). Right now, UTIF.js calls [Pako.js](https://github.com/nodeca/pako) for the Inflate method. diff --git a/project starter code/node_modules/utif2/UTIF.d.ts b/project starter code/node_modules/utif2/UTIF.d.ts new file mode 100644 index 00000000..aac72733 --- /dev/null +++ b/project starter code/node_modules/utif2/UTIF.d.ts @@ -0,0 +1,72 @@ +// Type definitions for utif 4.0.1 +// Project: https://github.com/photopea/UTIF.js +// Definitions by: Jan Pesa +// Naveen Kumar Sangi +// Massimiliano Caniparoli +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import 'node'; + +export as namespace UTIF; + +export type TiffTag = string[] | number[]; + +/** + * Each IFD is an object, keys are "tXYZ" (XYZ is a TIFF tag number), values are values of these tags. + * You can get the the dimension (and other properties, "metadata") of the image without decompressing pixel data. + * For more information on what each tag means, refer https://github.com/photopea/UTIF.js/blob/master/UTIF.js#L742 or TIFF 6 specification. + */ +// tslint:disable-next-line:interface-name +export interface IFD { + [property: string]: TiffTag | number | Uint8Array; + data: Uint8Array; + width: number; + height: number; +} + +/** + * Returns an array of "IFDs" (image file directories). + * + * @param buffer A Buffer or ArrayBuffer containing TIFF or EXIF data. + */ +export function decode(buffer: Buffer | ArrayBuffer): IFD[]; + +/** + * If there is an image inside the IFD, it is decoded and three new properties are added to the IFD: width, height and data. + * Note: TIFF files may have various number of channels and various color depth. The interpretation of data depends on many tags (see the TIFF 6 specification). + * + * @param buffer A Buffer or ArrayBuffer containing TIFF or EXIF data + * @param ifd The element of the output of UTIF.decode() + */ +export function decodeImage(buffer: Buffer | ArrayBuffer, ifd: IFD): void; + +/** + * Returns Uint8Array of the image in RGBA format, 8 bits per channel (ready to use in context2d.putImageData() etc.) + * + * @param ifd An image file directory + */ +export function toRGBA8(ifd: IFD): Uint8Array; + +/** + * Returns an ArrayBuffer of the binary TIFF file. + * Note: No compression available right now. + * + * @param rgba A Uint8Array containing RGBA pixel data. + * @param w Width of the image. + * @param h Height of the image. + * @param metadata [optional] The image file directory which should be encoded. + */ +export function encodeImage(rgba: Uint8Array, w: number, h: number, metadata?: IFD): ArrayBuffer; + +/** + * Returns ArrayBuffer of binary data which can be used to encode EXIF data. + * + * @param ifds The array of IFDs (image file directories) to be encoded. + */ +export function encode(ifds: IFD[]): ArrayBuffer; + +/** + * Replaces all Image elements in the document with Canvas elements. + * The attributes "id", "class" and "style" will be copied from the original Image to the new Canvas. + */ +export function replaceIMG(): void; \ No newline at end of file diff --git a/project starter code/node_modules/utif2/UTIF.js b/project starter code/node_modules/utif2/UTIF.js new file mode 100644 index 00000000..2836c86d --- /dev/null +++ b/project starter code/node_modules/utif2/UTIF.js @@ -0,0 +1,1649 @@ + + + + +;(function(){ + var UTIF = {}; + + // Make available for import by `require()` + if (typeof module == "object") {module.exports = UTIF;} + else {self.UTIF = UTIF;} + + var pako = (typeof require === "function") ? require("pako") : self.pako; + + function log() { if (typeof process=="undefined" || process.env.NODE_ENV=="development") console.log.apply(console, arguments); } + + (function(UTIF, pako){ + + // Following lines add a JPEG decoder to UTIF.JpegDecoder + (function(){"use strict";var W=function a1(){function W(p){this.message="JPEG error: "+p}W.prototype=new Error;W.prototype.name="JpegError";W.constructor=W;return W}(),ak=function ag(){var p=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),t=4017,ac=799,ah=3406,ao=2276,ar=1567,ai=3784,s=5793,ad=2896;function ak(Q){if(Q==null)Q={};if(Q.w==null)Q.w=-1;this.V=Q.n;this.N=Q.w}function a5(Q,h){var f=0,G=[],n,E,a=16,F;while(a>0&&!Q[a-1]){a--}G.push({children:[],index:0});var C=G[0];for(n=0;n0){C=G.pop()}C.index++;G.push(C);while(G.length<=n){G.push(F={children:[],index:0});C.children[C.index]=F.children;C=F}f++}if(n+10){V--;return J>>V&1}J=Q[h++];if(J===255){var I=Q[h++];if(I){if(I===220&&d){h+=2;var l=Z(Q,h);h+=2;if(l>0&&l!==f.s){throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data",l)}}else if(I===217){if(d){var M=q*8; + if(M>0&&M>>7}function u(I){var l=I;while(!0){l=l[Y()];switch(typeof l){case"number":return l;case"object":continue}throw new W("invalid huffman sequence")}}function m(I){var e=0;while(I>0){e=e<<1|Y();I--}return e}function j(I){if(I===1){return Y()===1?1:-1}var e=m(I);if(e>=1<>4;if(i===0){if(A<15){break}N+=16;continue}N+=A;var o=p[N];X.D[I+o]=j(i);N++}}function $(X,I){var l=u(X.J),M=l===0?0:j(l)<0){r--;return}var N=E,l=a;while(N<=l){var M=u(X.i),S=M&15,i=M>>4;if(S===0){if(i<15){r=m(i)+(1<>4;if(S===0){if(M<15){r=m(M)+(1<0){for(O=0;O0?"unexpected":"excessive";h=k.offset}if(k.M>=65488&&k.M<=65495){h+=2}else{break}}return h-z}function al(Q,h,f){var G=Q.$,n=Q.D,E,a,C,F,d,T,U,z,J,V,Y,u,m,j,v,$,b;if(!G){throw new W("missing required Quantization Table.")}for(var r=0;r<64;r+=8){J=n[h+r];V=n[h+r+1];Y=n[h+r+2];u=n[h+r+3];m=n[h+r+4];j=n[h+r+5];v=n[h+r+6];$=n[h+r+7];J*=G[r];if((V|Y|u|m|j|v|$)===0){b=s*J+512>>10;f[r]=b;f[r+1]=b;f[r+2]=b;f[r+3]=b;f[r+4]=b;f[r+5]=b;f[r+6]=b;f[r+7]=b;continue}V*=G[r+1];Y*=G[r+2];u*=G[r+3];m*=G[r+4];j*=G[r+5];v*=G[r+6];$*=G[r+7];E=s*J+128>>8;a=s*m+128>>8;C=Y;F=v;d=ad*(V-$)+128>>8;z=ad*(V+$)+128>>8; + T=u<<4;U=j<<4;E=E+a+1>>1;a=E-a;b=C*ai+F*ar+128>>8;C=C*ar-F*ai+128>>8;F=b;d=d+U+1>>1;U=d-U;z=z+T+1>>1;T=z-T;E=E+F+1>>1;F=E-F;a=a+C+1>>1;C=a-C;b=d*ao+z*ah+2048>>12;d=d*ah-z*ao+2048>>12;z=b;b=T*ac+U*t+2048>>12;T=T*t-U*ac+2048>>12;U=b;f[r]=E+z;f[r+7]=E-z;f[r+1]=a+U;f[r+6]=a-U;f[r+2]=C+T;f[r+5]=C-T;f[r+3]=F+d;f[r+4]=F-d}for(var P=0;P<8;++P){J=f[P];V=f[P+8];Y=f[P+16];u=f[P+24];m=f[P+32];j=f[P+40];v=f[P+48];$=f[P+56];if((V|Y|u|m|j|v|$)===0){b=s*J+8192>>14;if(b<-2040){b=0}else if(b>=2024){b=255}else{b=b+2056>>4}n[h+P]=b;n[h+P+8]=b;n[h+P+16]=b;n[h+P+24]=b;n[h+P+32]=b;n[h+P+40]=b;n[h+P+48]=b;n[h+P+56]=b;continue}E=s*J+2048>>12;a=s*m+2048>>12;C=Y;F=v;d=ad*(V-$)+2048>>12;z=ad*(V+$)+2048>>12;T=u;U=j;E=(E+a+1>>1)+4112;a=E-a;b=C*ai+F*ar+2048>>12;C=C*ar-F*ai+2048>>12;F=b;d=d+U+1>>1;U=d-U;z=z+T+1>>1;T=z-T;E=E+F+1>>1;F=E-F;a=a+C+1>>1;C=a-C;b=d*ao+z*ah+2048>>12;d=d*ah-z*ao+2048>>12;z=b; + b=T*ac+U*t+2048>>12;T=T*t-U*ac+2048>>12;U=b;J=E+z;$=E-z;V=a+U;v=a-U;Y=C+T;j=C-T;u=F+d;m=F-d;if(J<16){J=0}else if(J>=4080){J=255}else{J>>=4}if(V<16){V=0}else if(V>=4080){V=255}else{V>>=4}if(Y<16){Y=0}else if(Y>=4080){Y=255}else{Y>>=4}if(u<16){u=0}else if(u>=4080){u=255}else{u>>=4}if(m<16){m=0}else if(m>=4080){m=255}else{m>>=4}if(j<16){j=0}else if(j>=4080){j=255}else{j>>=4}if(v<16){v=0}else if(v>=4080){v=255}else{v>>=4}if($<16){$=0}else if($>=4080){$=255}else{$>>=4}n[h+P]=J; + n[h+P+8]=V;n[h+P+16]=Y;n[h+P+24]=u;n[h+P+32]=m;n[h+P+40]=j;n[h+P+48]=v;n[h+P+56]=$}}function a0(Q,h){var f=h.P,G=h.c,n=new Int16Array(64);for(var E=0;E=G){return null}var E=Z(Q,h);if(E>=65472&&E<=65534){return{u:null,M:E,offset:h}}var a=Z(Q,n);while(!(a>=65472&&a<=65534)){if(++n>=G){return null}a=Z(Q,n)}return{u:E.toString(16),M:a,offset:n}}ak.prototype={parse(Q,h){if(h==null)h={}; + var f=h.F,E=0,a=null,C=null,F,d,T=0;function G(){var o=Z(Q,E);E+=2;var B=E+o-2,V=an(Q,B,E);if(V&&V.u){B=V.offset}var ab=Q.subarray(E,B);E+=ab.length;return ab}function n(F){var o=Math.ceil(F.o/8/F.X),B=Math.ceil(F.s/8/F.B);for(var Y=0;Y>4===0){for(u=0;u<64;u++){b=p[u];P[b]=Q[E++]}}else if(r>>4===1){for(u=0;u<64;u++){b=p[u];P[b]=Z(Q,E);E+=2}}else{throw new W("DQT - invalid table spec")}U[r&15]=P}break;case 65472:case 65473:case 65474:if(F){throw new W("Only single frame JPEGs supported")}E+=2;F={};F.G=V===65473;F.Z=V===65474;F.precision=Q[E++];var D=Z(Q,E),a4,q=0,H=0;E+=2;F.s=f||D;F.o=Z(Q,E);E+=2;F.W=[];F._={};var a8=Q[E++];for(Y=0;Y>4,y=Q[E+1]&15;if(q>4===0?J:z)[_&15]=a5(N,K)}break;case 65501:E+=2;d=Z(Q,E);E+=2;break;case 65498:var x=++T===1&&!f,R;E+=2;var k=Q[E++],g=[];for(Y=0;Y>4];R.i=z[a6&15];g.push(R)}var I=Q[E++],l=Q[E++],M=Q[E++];try{var S=a7(Q,E,F,g,d,I,l,M>>4,M&15,x);E+=S}catch(ex){if(ex instanceof DNLMarkerError){return this.parse(Q,{F:ex.s})}else if(ex instanceof EOIMarkerError){break markerLoop}throw ex}break;case 65500:E+=4;break;case 65535:if(Q[E]!==255){E--}break;default:var i=an(Q,E-2,E-3);if(i&&i.u){E=i.offset;break}if(E>=Q.length-1){break markerLoop}throw new W("JpegImage.parse - unknown marker: "+V.toString(16))}V=Z(Q,E);E+=2}this.width=F.o;this.height=F.s;this.g=a;this.b=C;this.W=[];for(Y=0;Y>8)+P[J+1]}}}return v},get f(){if(this.b){return!!this.b.a}if(this.p===3){if(this.N===0){return!1}else if(this.W[0].index===82&&this.W[1].index===71&&this.W[2].index===66){return!1}return!0}if(this.N===1){return!0}return!1},z:function aj(Q){var h,f,G; + for(var n=0,E=Q.length;n4){throw new W("Unsupported color mode")}var E=this.Y(h,f,n);if(this.p===1&&G){var a=E.length,C=new Uint8ClampedArray(a*3),F=0;for(var d=0;d>24}function Z(p,t){return p[t]<<8|p[t+1]}function am(p,t){return(p[t]<<24|p[t+1]<<16|p[t+2]<<8|p[t+3])>>>0}UTIF.JpegDecoder=ak}()); + + //UTIF.JpegDecoder = PDFJS.JpegImage; + + + UTIF.encodeImage = function(rgba, w, h, metadata) + { + var idf = { "t256":[w], "t257":[h], "t258":[8,8,8,8], "t259":[1], "t262":[2], "t273":[1000], // strips offset + "t277":[4], "t278":[h], /* rows per strip */ "t279":[w*h*4], // strip byte counts + "t282":[[72,1]], "t283":[[72,1]], "t284":[1], "t286":[[0,1]], "t287":[[0,1]], "t296":[1], "t305": ["Photopea (UTIF.js)"], "t338":[1] + }; + if (metadata) for (var i in metadata) idf[i] = metadata[i]; + + var prfx = new Uint8Array(UTIF.encode([idf])); + var img = new Uint8Array(rgba); + var data = new Uint8Array(1000+w*h*4); + for(var i=0; i probably not an image + img.isLE = id=="II"; + img.width = img["t256"][0]; //delete img["t256"]; + img.height = img["t257"][0]; //delete img["t257"]; + + var cmpr = img["t259"] ? img["t259"][0] : 1; //delete img["t259"]; + var fo = img["t266"] ? img["t266"][0] : 1; //delete img["t266"]; + if(img["t284"] && img["t284"][0]==2) log("PlanarConfiguration 2 should not be used!"); + if(cmpr==7 && img["t258"] && img["t258"].length>3) img["t258"]=img["t258"].slice(0,3); + + var spp = img["t277"]?img["t277"][0]:1; + var bps = img["t258"]?img["t258"][0]:1; + var bipp = bps*spp; // bits per pixel + /* + var bipp; // bits per pixel + if(img["t258"]) bipp = Math.min(32,img["t258"][0])*img["t258"].length; + else bipp = (img["t277"]?img["t277"][0]:1); + */ + // Some .NEF files have t258==14, even though they use 16 bits per pixel + if(cmpr==1 && img["t279"]!=null && img["t278"] && img["t262"][0]==32803) { + bipp = Math.round((img["t279"][0]*8)/(img.width*img["t278"][0])); + } + if(img["t50885"] && img["t50885"][0]==4) bipp = img["t258"][0]*3; // RAW_CANON_40D_SRAW_V103.CR2 + var bipl = Math.ceil(img.width*bipp/8)*8; + var soff = img["t273"]; if(soff==null || img["t322"]) soff = img["t324"]; + var bcnt = img["t279"]; if(cmpr==1 && soff.length==1) bcnt = [img.height*(bipl>>>3)]; if(bcnt==null || img["t322"]) bcnt = img["t325"]; + //bcnt[0] = Math.min(bcnt[0], data.length); // Hasselblad, "RAW_HASSELBLAD_H3D39II.3FR" + var bytes = new Uint8Array(img.height*(bipl>>>3)), bilen = 0; + + if(img["t322"]!=null) // tiled + { + var tw = img["t322"][0], th = img["t323"][0]; + var tx = Math.floor((img.width + tw - 1) / tw); + var ty = Math.floor((img.height + th - 1) / th); + var tbuff = new Uint8Array(Math.ceil(tw*th*bipp/8)|0); + console.log("====", tx,ty); + for(var y=0; y>>3, bpl = Math.ceil(bps*noc*w/8); + + // convert to Little Endian /* + if(bps==16 && !img.isLE && img["t33422"]==null) // not DNG + for(var y=0; y>>8)&255; + } + else if(noc==3) for(var j= 3; j> 3 ^ 0x3ff0; + return (buffer[byte] | buffer[byte + 1] << 8) >> (vpos & 7) & ~((-1) << bits); + } + } + // Raw Format 6 + function getBufferDataRW6(i) { + return buffer[vpos + 15 - i]; + } + function readPageRW6() { + bytes[0] = (getBufferDataRW6(0) << 6) | (getBufferDataRW6(1) >> 2); // 14 bit + bytes[1] = (((getBufferDataRW6(1) & 0x3) << 12) | (getBufferDataRW6(2) << 4) | (getBufferDataRW6(3) >> 4)) & 0x3fff; + bytes[2] = (getBufferDataRW6(3) >> 2) & 0x3; + bytes[3] = ((getBufferDataRW6(3) & 0x3) << 8) | getBufferDataRW6(4); + bytes[4] = (getBufferDataRW6(5) << 2) | (getBufferDataRW6(6) >> 6); + bytes[5] = ((getBufferDataRW6(6) & 0x3f) << 4) | (getBufferDataRW6(7) >> 4); + bytes[6] = (getBufferDataRW6(7) >> 2) & 0x3; + bytes[7] = ((getBufferDataRW6(7) & 0x3) << 8) | getBufferDataRW6(8); + bytes[8] = ((getBufferDataRW6(9) << 2) & 0x3fc) | (getBufferDataRW6(10) >> 6); + bytes[9] = ((getBufferDataRW6(10) << 4) | (getBufferDataRW6(11) >> 4)) & 0x3ff; + bytes[10] = (getBufferDataRW6(11) >> 2) & 0x3; + bytes[11] = ((getBufferDataRW6(11) & 0x3) << 8) | getBufferDataRW6(12); + bytes[12] = (((getBufferDataRW6(13) << 2) & 0x3fc) | getBufferDataRW6(14) >> 6) & 0x3ff; + bytes[13] = ((getBufferDataRW6(14) << 4) | (getBufferDataRW6(15) >> 4)) & 0x3ff; + vpos += 16; + byte = 0; + } + function readPageRw6_bps12() { + bytes[0] = (getBufferDataRW6(0) << 4) | (getBufferDataRW6(1) >> 4); + bytes[1] = (((getBufferDataRW6(1) & 0xf) << 8) | (getBufferDataRW6(2))) & 0xfff; + bytes[2] = (getBufferDataRW6(3) >> 6) & 0x3; + bytes[3] = ((getBufferDataRW6(3) & 0x3f) << 2) | (getBufferDataRW6(4) >> 6); + bytes[4] = ((getBufferDataRW6(4) & 0x3f) << 2) | (getBufferDataRW6(5) >> 6); + bytes[5] = ((getBufferDataRW6(5) & 0x3f) << 2) | (getBufferDataRW6(6) >> 6); + bytes[6] = (getBufferDataRW6(6) >> 4) & 0x3; + bytes[7] = ((getBufferDataRW6(6) & 0xf) << 4) | (getBufferDataRW6(7) >> 4); + bytes[8] = ((getBufferDataRW6(7) & 0xf) << 4) | (getBufferDataRW6(8) >> 4); + bytes[9] = ((getBufferDataRW6(8) & 0xf) << 4) | (getBufferDataRW6(9) >> 4); + bytes[10] = (getBufferDataRW6(9) >> 2) & 0x3; + bytes[11] = ((getBufferDataRW6(9) & 0x3) << 6) | (getBufferDataRW6(10) >> 2); + bytes[12] = ((getBufferDataRW6(10) & 0x3) << 6) | (getBufferDataRW6(11) >> 2); + bytes[13] = ((getBufferDataRW6(11) & 0x3) << 6) | (getBufferDataRW6(12) >> 2); + bytes[14] = getBufferDataRW6(12) & 0x3; + bytes[15] = getBufferDataRW6(13); + bytes[16] = getBufferDataRW6(14); + bytes[17] = getBufferDataRW6(15); + + vpos += 16; + byte = 0; + } + // Main loop + function resetPredNonzeros(){ + pred[0]=0; pred[1]=0; + nonz[0]=0; nonz[1]=0; + } + if (RW2_Format == 7) { + throw RW2_Format; + + // Skatch of version 7 + /* + var pixels_per_block = bitsPerSample == 14 ? 9 : 10; + rowbytes = 0|(rawWidth / pixels_per_block * 16); + for (row = 0; row < rawHeight - 15; row += 16) { + var rowstoread = Math.min(16, rawHeight - row); + var readlen = rowbytes*rowstoread; + buffer = new Uint8Array(image.slice(bidx, bidx+readlen)); + vpos = 0; + bidx += readlen; + i = 0; + for (crow = 0; crow < rowstoread; crow++) { + idx = (row + crow) * rawWidth; + for (col = 0; col <= rawWidth - pixels_per_block; col += pixels_per_block) { + for(j=0; j < pixels_per_block; j++) bytes[j] = buffer[i++]; + if (bitsPerSample == 12) { + result[idx ] = ((bytes[1] & 0xF) << 8) + bytes[0]; + result[idx + 1] = 16 * bytes[2] + (bytes[1] >> 4); + result[idx + 2] = ((bytes[4] & 0xF) << 8) + bytes[3]; + result[idx + 3] = 16 * bytes[5] + (bytes[4] >> 4); + result[idx + 4] = ((bytes[7] & 0xF) << 8) + bytes[6]; + result[idx + 5] = 16 * bytes[8] + (bytes[7] >> 4); + result[idx + 6] = ((bytes[10] & 0xF) << 8) + bytes[9]; + result[idx + 7] = 16 * bytes[11] + (bytes[10] >> 4); + result[idx + 8] = ((bytes[13] & 0xF) << 8) + bytes[12]; + result[idx + 9] = 16 * bytes[14] + (bytes[13] >> 4); + } else if (bitsPerSample == 14) { + result[idx] = bytes[0] + ((bytes[1] & 0x3F) << 8); + result[idx + 1] = (bytes[1] >> 6) + 4 * (bytes[2]) + ((bytes[3] & 0xF) << 10); + result[idx + 2] = (bytes[3] >> 4) + 16 * (bytes[4]) + ((bytes[5] & 3) << 12); + result[idx + 3] = ((bytes[5] & 0xFC) >> 2) + (bytes[6] << 6); + result[idx + 4] = bytes[7] + ((bytes[8] & 0x3F) << 8); + result[idx + 5] = (bytes[8] >> 6) + 4 * bytes[9] + ((bytes[10] & 0xF) << 10); + result[idx + 6] = (bytes[10] >> 4) + 16 * bytes[11] + ((bytes[12] & 3) << 12); + result[idx + 7] = ((bytes[12] & 0xFC) >> 2) + (bytes[13] << 6); + result[idx + 8] = bytes[14] + ((bytes[15] & 0x3F) << 8); + } + } + } + } + */ + } + else if(RW2_Format == 6) { + var is12bit = bitsPerSample == 12, + readPageRw6Fn = is12bit ? readPageRw6_bps12 : readPageRW6, + pixelsPerBlock = is12bit ? 14 : 11, + pixelbase0 = is12bit ? 0x80 : 0x200, + pixelbase_compare = is12bit ? 0x800 : 0x2000, + spix_compare = is12bit ? 0x3fff : 0xffff, + pixel_mask = is12bit ? 0xfff : 0x3fff, + blocksperrow = rawWidth / pixelsPerBlock, + rowbytes = blocksperrow * 16, + bufferSize = is12bit ? 18 : 14; + + for (row = 0; row < rawHeight - 15; row += 16) { + var rowstoread = Math.min(16, rawHeight - row); + var readlen = rowbytes*rowstoread; + buffer = new Uint8Array(img_buffer, off+bidx, readlen);//new Uint8Array(image.slice(bidx, bidx+readlen)); + vpos = 0; + bidx += readlen; + for (crow = 0, col = 0; crow < rowstoread; crow++, col = 0) { + idx = (row + crow) * rawWidth; + for (var rblock = 0; rblock < blocksperrow; rblock++) { + readPageRw6Fn(); + resetPredNonzeros(); + sh=0; pixel_base=0; + for (i = 0; i < pixelsPerBlock; i++){ + isOdd = i & 1; + if (i % 3 == 2) { + var base = byte < bufferSize ? bytes[byte++] : 0; + if (base == 3) base = 4; + pixel_base = pixelbase0 << base; + sh = 1 << base; + } + var epixel = byte < bufferSize ? bytes[byte++] : 0; + if (pred[isOdd]) { + epixel *= sh; + if (pixel_base < pixelbase_compare && nonz[isOdd] > pixel_base) + epixel += nonz[isOdd] - pixel_base; + nonz[isOdd] = epixel; + } else { + pred[isOdd] = epixel; + if (epixel) + nonz[isOdd] = epixel; + else + epixel = nonz[isOdd]; + } + result[idx + col++] = (epixel - 0xf) <= spix_compare ? (epixel - 0xf) & spix_compare : ((epixel + 0x7ffffff1) >> 0x1f) & pixel_mask; + } + } + } + } + } + else if (RW2_Format == 5) { + var blockSize = bitsPerSample == 12 ? 10 : 9; + for (row = 0; row < rawHeight; row++) { + for (col = 0; col < rawWidth; col+=blockSize) { + getDataRaw(0); + // Tuhle podminku pouziva i RW2_Format 7 + if (bitsPerSample == 12) { + result[idx++] = ((bytes[1] & 0xF) << 8) + bytes[0]; + result[idx++] = 16 * bytes[2] + (bytes[1] >> 4); + result[idx++] = ((bytes[4] & 0xF) << 8) + bytes[3]; + result[idx++] = 16 * bytes[5] + (bytes[4] >> 4); + result[idx++] = ((bytes[7] & 0xF) << 8) + bytes[6]; + result[idx++] = 16 * bytes[8] + (bytes[7] >> 4); + result[idx++] = ((bytes[10] & 0xF) << 8) + bytes[9]; + result[idx++] = 16 * bytes[11] + (bytes[10] >> 4); + result[idx++] = ((bytes[13] & 0xF) << 8) + bytes[12]; + result[idx++] = 16 * bytes[14] + (bytes[13] >> 4); + } else if (bitsPerSample == 14) { + result[idx++] = bytes[0] + ((bytes[1] & 0x3F) << 8); + result[idx++] = (bytes[1] >> 6) + 4 * (bytes[2]) + ((bytes[3] & 0xF) << 10); + result[idx++] = (bytes[3] >> 4) + 16 * (bytes[4]) + ((bytes[5] & 3) << 12); + result[idx++] = ((bytes[5] & 0xFC) >> 2) + (bytes[6] << 6); + result[idx++] = bytes[7] + ((bytes[8] & 0x3F) << 8); + result[idx++] = (bytes[8] >> 6) + 4 * bytes[9] + ((bytes[10] & 0xF) << 10); + result[idx++] = (bytes[10] >> 4) + 16 * bytes[11] + ((bytes[12] & 3) << 12); + result[idx++] = ((bytes[12] & 0xFC) >> 2) + (bytes[13] << 6); + result[idx++] = bytes[14] + ((bytes[15] & 0x3F) << 8); + } + } + } + //console.log(result[1000000 - 1]) + } else if(RW2_Format == 4) { + for (row = 0; row < rawHeight; row++){ + for(col = 0; col < rawWidth; col++){ + i = col % 14; + isOdd = i & 1; + if (i==0) resetPredNonzeros(); + if (i%3 == 2) + sh = 4 >> (3 - getDataRaw(2)); + if (nonz[isOdd]) { + j = getDataRaw(8); + if(j != 0){ + pred[isOdd] -= 0x80 << sh; + if (pred[isOdd] < 0 || sh == 4) + pred[isOdd] &= ~((-1) << sh); + pred[isOdd] += j << sh; + } + } else { + nonz[isOdd] = getDataRaw(8); + if(nonz[isOdd] || i > 11) + pred[isOdd] = nonz[isOdd] << 4 | getDataRaw(4); + } + result[idx++] = pred[col & 1]; + } + } + } + else throw RW2_Format; + } + + + UTIF.decode._decodeVC5 = function(){var x=[1,0,1,0,2,2,1,1,3,7,1,2,5,25,1,3,6,48,1,4,6,54,1,5,7,111,1,8,7,99,1,6,7,105,12,0,7,107,1,7,8,209,20,0,8,212,1,9,8,220,1,10,9,393,1,11,9,394,32,0,9,416,1,12,9,427,1,13,10,887,1,18,10,784,1,14,10,790,1,15,10,835,60,0,10,852,1,16,10,885,1,17,11,1571,1,19,11,1668,1,20,11,1669,100,0,11,1707,1,21,11,1772,1,22,12,3547,1,29,12,3164,1,24,12,3166,1,25,12,3140,1,23,12,3413,1,26,12,3537,1,27,12,3539,1,28,13,7093,1,35,13,6283,1,30,13,6331,1,31,13,6335,180,0,13,6824,1,32,13,7072,1,33,13,7077,320,0,13,7076,1,34,14,12565,1,36,14,12661,1,37,14,12669,1,38,14,13651,1,39,14,14184,1,40,15,28295,1,46,15,28371,1,47,15,25320,1,42,15,25336,1,43,15,25128,1,41,15,27300,1,44,15,28293,1,45,16,50259,1,48,16,50643,1,49,16,50675,1,50,16,56740,1,53,16,56584,1,51,16,56588,1,52,17,113483,1,61,17,113482,1,60,17,101285,1,55,17,101349,1,56,17,109205,1,57,17,109207,1,58,17,100516,1,54,17,113171,1,59,18,202568,1,62,18,202696,1,63,18,218408,1,64,18,218412,1,65,18,226340,1,66,18,226356,1,67,18,226358,1,68,19,402068,1,69,19,405138,1,70,19,405394,1,71,19,436818,1,72,19,436826,1,73,19,452714,1,75,19,452718,1,76,19,452682,1,74,20,804138,1,77,20,810279,1,78,20,810790,1,79,20,873638,1,80,20,873654,1,81,20,905366,1,82,20,905430,1,83,20,905438,1,84,21,1608278,1,85,21,1620557,1,86,21,1621582,1,87,21,1621583,1,88,21,1747310,1,89,21,1810734,1,90,21,1810735,1,91,21,1810863,1,92,21,1810879,1,93,22,3621725,1,99,22,3621757,1,100,22,3241112,1,94,22,3494556,1,95,22,3494557,1,96,22,3494622,1,97,22,3494623,1,98,23,6482227,1,102,23,6433117,1,101,23,6989117,1,103,23,6989119,1,105,23,6989118,1,104,23,7243449,1,106,23,7243512,1,107,24,13978233,1,111,24,12964453,1,109,24,12866232,1,108,24,14486897,1,113,24,13978232,1,110,24,14486896,1,112,24,14487026,1,114,24,14487027,1,115,25,25732598,1,225,25,25732597,1,189,25,25732596,1,188,25,25732595,1,203,25,25732594,1,202,25,25732593,1,197,25,25732592,1,207,25,25732591,1,169,25,25732590,1,223,25,25732589,1,159,25,25732522,1,235,25,25732579,1,152,25,25732575,1,192,25,25732489,1,179,25,25732573,1,201,25,25732472,1,172,25,25732576,1,149,25,25732488,1,178,25,25732566,1,120,25,25732571,1,219,25,25732577,1,150,25,25732487,1,127,25,25732506,1,211,25,25732548,1,125,25,25732588,1,158,25,25732486,1,247,25,25732467,1,238,25,25732508,1,163,25,25732552,1,228,25,25732603,1,183,25,25732513,1,217,25,25732587,1,168,25,25732520,1,122,25,25732484,1,128,25,25732562,1,249,25,25732505,1,187,25,25732504,1,186,25,25732483,1,136,25,25928905,1,181,25,25732560,1,255,25,25732500,1,230,25,25732482,1,135,25,25732555,1,233,25,25732568,1,222,25,25732583,1,145,25,25732481,1,134,25,25732586,1,167,25,25732521,1,248,25,25732518,1,209,25,25732480,1,243,25,25732512,1,216,25,25732509,1,164,25,25732547,1,140,25,25732479,1,157,25,25732544,1,239,25,25732574,1,191,25,25732564,1,251,25,25732478,1,156,25,25732546,1,139,25,25732498,1,242,25,25732557,1,133,25,25732477,1,162,25,25732515,1,213,25,25732584,1,165,25,25732514,1,212,25,25732476,1,227,25,25732494,1,198,25,25732531,1,236,25,25732530,1,234,25,25732529,1,117,25,25732528,1,215,25,25732527,1,124,25,25732526,1,123,25,25732525,1,254,25,25732524,1,253,25,25732523,1,148,25,25732570,1,218,25,25732580,1,146,25,25732581,1,147,25,25732569,1,224,25,25732533,1,143,25,25732540,1,184,25,25732541,1,185,25,25732585,1,166,25,25732556,1,132,25,25732485,1,129,25,25732563,1,250,25,25732578,1,151,25,25732501,1,119,25,25732502,1,193,25,25732536,1,176,25,25732496,1,245,25,25732553,1,229,25,25732516,1,206,25,25732582,1,144,25,25732517,1,208,25,25732558,1,137,25,25732543,1,241,25,25732466,1,237,25,25732507,1,190,25,25732542,1,240,25,25732551,1,131,25,25732554,1,232,25,25732565,1,252,25,25732475,1,171,25,25732493,1,205,25,25732492,1,204,25,25732491,1,118,25,25732490,1,214,25,25928904,1,180,25,25732549,1,126,25,25732602,1,182,25,25732539,1,175,25,25732545,1,141,25,25732559,1,138,25,25732537,1,177,25,25732534,1,153,25,25732503,1,194,25,25732606,1,160,25,25732567,1,121,25,25732538,1,174,25,25732497,1,246,25,25732550,1,130,25,25732572,1,200,25,25732474,1,170,25,25732511,1,221,25,25732601,1,196,25,25732532,1,142,25,25732519,1,210,25,25732495,1,199,25,25732605,1,155,25,25732535,1,154,25,25732499,1,244,25,25732510,1,220,25,25732600,1,195,25,25732607,1,161,25,25732604,1,231,25,25732473,1,173,25,25732599,1,226,26,51465122,1,116,26,51465123,0,1],o,C,k,P=[3,3,3,3,2,2,2,1,1,1],V=24576,ar=16384,H=8192,az=ar|H; + function d(t){var E=t[1],h=t[0][E>>>3]>>>7-(E&7)&1;t[1]++;return h}function ag(t,E){if(o==null){o={}; + for(var h=0;h>>1}return t}function A(t,E){return t>>E}function O(t,E,h,L,g,n){E[h]=A(A(11*t[g]-4*t[g+n]+t[g+n+n]+4,3)+t[L],1); + E[h+n]=A(A(5*t[g]+4*t[g+n]-t[g+n+n]+4,3)-t[L],1)}function J(t,E,h,L,g,n){var W=t[g-n]-t[g+n],j=t[g],$=t[L]; + E[h]=A(A(W+4,3)+j+$,1);E[h+n]=A(A(-W+4,3)+j-$,1)}function y(t,E,h,L,g,n){E[h]=A(A(5*t[g]+4*t[g-n]-t[g-n-n]+4,3)+t[L],1); + E[h+n]=A(A(11*t[g]-4*t[g-n]+t[g-n-n]+4,3)-t[L],1)}function q(t){t=t<0?0:t>4095?4095:t;t=k[t]>>>2;return t}function av(t,E,h,L,g,n){L=new Uint16Array(L.buffer); + var W=Date.now(),j=UTIF._binBE,$=E+h,r,u,X,I,ax,a3,R,ai,aa,ap,ah,ae,aD,al,i,aE,T,B;E+=4;var a5=n[0]==1; + while(E<$){var S=j.readShort(t,E),s=j.readUshort(t,E+2);E+=4;if(S==12)r=s;else if(S==20)u=s;else if(S==21)X=s; + else if(S==48)I=s;else if(S==53)ax=s;else if(S==35)a3=s;else if(S==62)R=s;else if(S==101)ai=s;else if(S==109)aa=s; + else if(S==84)ap=s;else if(S==106)ah=s;else if(S==107)ae=s;else if(S==108)aD=s;else if(S==102)al=s;else if(S==104)i=s; + else if(S==105)aE=s;else{var F=S<0?-S:S,D=F&65280,_=0;if(F&az){if(F&H){_=s&65535;_+=(F&255)<<16}else{_=s&65535}}if((F&V)==V){if(T==null){T=[]; + for(var M=0;M<4;M++)T[M]=new Int16Array((u>>>1)*(X>>>1));B=new Int16Array((u>>>1)*(X>>>1));C=new Int16Array(1024); + for(var M=0;M<1024;M++){var aG=M-512,p=Math.abs(aG),r=Math.floor(768*p*p*p/(255*255*255))+p;C[M]=Math.sign(aG)*r}k=new Uint16Array(4096); + var aA=(1<<16)-1;for(var M=0;M<4096;M++){var at=M,a1=aA*(Math.pow(113,at/4095)-1)/112;k[M]=Math.min(a1,aA)}}var w=T[R],v=m(u,1+P[I]),N=m(X,1+P[I]); + if(I==0){for(var b=0;b>>1)+G]=t[c]<<8|t[c+1]}}else{var a7=[t,E*8],a4=[],ay=0,aw=v*N,f=[0,0],Q=0,s=0; + while(ay0){a4[ay++]=s;Q--}}var l=(I-1)%3,aF=l!=1?v:0,a2=l!=0?N:0; + for(var b=0;b>>1)+aF,au=b*v;for(var G=0;G>>1,an=v*2,a9=N*2; + for(var b=0;b>14-K*2&3;var a6=aC[aB];if(a6!=0)for(var b=0;b>>1)*(u>>>1)+(G>>>1),z=a8[c],ao=ab[c]-2048,ak=aq[c]-2048,ad=as[c]-2048,aj=(ao<<1)+z,a0=(ak<<1)+z,aH=z+ad,am=z-ad; + if(a5){L[U]=q(aH);L[U+1]=q(a0);L[U+u]=q(aj);L[U+u+1]=q(am)}else{L[U]=q(aj);L[U+1]=q(aH);L[U+u]=q(am); + L[U+u+1]=q(a0)}}}E+=_*4}else if(F==16388){E+=_*4}else if(D==8192||D==8448||D==9216){}else throw F.toString(16)}}console.log(Date.now()-W)}return av}() + + + + UTIF.decode._decodeLogLuv32 = function(img, data, off, len, tgt, toff) { + var w = img.width, qw=w*4; + var io = 0, out = new Uint8Array(qw); + + while(io>> (tab[i] >>> 8); + for(var c=0; c>>4); tgt[toff+i+1]=(b0<<4)|(b2>>>4); tgt[toff+i+2]=(b2<<4)|(b1>>>4); } + return; + } + + var pix = new Uint16Array(16); + var row, col, val, max, min, imax, imin, sh, bit, i, dp; + + var data = new Uint8Array(raw_width+1); + for (row=0; row < height; row++) { + //fread (data, 1, raw_width, ifp); + for(var j=0; j>> 11); + imax = 0x0f & (val >>> 22); + imin = 0x0f & (val >>> 26); + for (sh=0; sh < 4 && 0x80 << sh <= max-min; sh++); + for (bit=30, i=0; i < 16; i++) + if (i == imax) pix[i] = max; + else if (i == imin) pix[i] = min; + else { + pix[i] = ((bin.readUshort(data, dp+(bit >> 3)) >>> (bit & 7) & 0x7f) << sh) + min; + if (pix[i] > 0x7ff) pix[i] = 0x7ff; + bit += 7; + } + for (i=0; i < 16; i++, col+=2) { + //RAW(row,col) = curve[pix[i] << 1] >> 2; + var clr = pix[i]<<1; //clr = 0xffff; + UTIF.decode._putsF(tgt, (row*raw_width+col)*tiff_bps, clr<<(16-tiff_bps)); + } + col -= col & 1 ? 1:31; + } + } + } + + UTIF.decode._decodeNikon = function(img,imgs, data, off, src_length, tgt, toff) + { + var nikon_tree = [ + [ 0, 0,1,5,1,1,1,1,1,1,2,0,0,0,0,0,0, /* 12-bit lossy */ + 5,4,3,6,2,7,1,0,8,9,11,10,12 ], + [ 0, 0,1,5,1,1,1,1,1,1,2,0,0,0,0,0,0, /* 12-bit lossy after split */ + 0x39,0x5a,0x38,0x27,0x16,5,4,3,2,1,0,11,12,12 ], + [ 0, 0,1,4,2,3,1,2,0,0,0,0,0,0,0,0,0, /* 12-bit lossless */ + 5,4,6,3,7,2,8,1,9,0,10,11,12 ], + [ 0, 0,1,4,3,1,1,1,1,1,2,0,0,0,0,0,0, /* 14-bit lossy */ + 5,6,4,7,8,3,9,2,1,0,10,11,12,13,14 ], + [ 0, 0,1,5,1,1,1,1,1,1,1,2,0,0,0,0,0, /* 14-bit lossy after split */ + 8,0x5c,0x4b,0x3a,0x29,7,6,5,4,3,2,1,0,13,14 ], + [ 0, 0,1,4,2,2,3,1,2,0,0,0,0,0,0,0,0, /* 14-bit lossless */ + 7,6,8,5,9,4,10,3,11,12,2,0,1,13,14 ] ]; + + var raw_width = img["t256"][0], height=img["t257"][0], tiff_bps=img["t258"][0]; + + var tree = 0, split = 0; + var make_decoder = UTIF.decode._make_decoder; + var getbithuff = UTIF.decode._getbithuff; + + var mn = imgs[0].exifIFD.makerNote, md = mn["t150"]?mn["t150"]:mn["t140"], mdo=0; //console.log(mn,md); + //console.log(md[0].toString(16), md[1].toString(16), tiff_bps); + var ver0 = md[mdo++], ver1 = md[mdo++]; + if (ver0 == 0x49 || ver1 == 0x58) mdo+=2110; + if (ver0 == 0x46) tree = 2; + if (tiff_bps == 14) tree += 3; + + var vpred = [[0,0],[0,0]], bin=(img.isLE ? UTIF._binLE : UTIF._binBE); + for(var i=0; i<2; i++) for(var j=0; j<2; j++) { vpred[i][j] = bin.readShort(md,mdo); mdo+=2; } // not sure here ... [i][j] or [j][i] + //console.log(vpred); + + + var max = 1 << tiff_bps & 0x7fff, step=0; + var csize = bin.readShort(md,mdo); mdo+=2; + if (csize > 1) step = Math.floor(max / (csize-1)); + if (ver0 == 0x44 && ver1 == 0x20 && step > 0) split = bin.readShort(md,562); + + + var i; + var row, col; + var len, shl, diff; + var min_v = 0; + var hpred = [0,0]; + var huff = make_decoder(nikon_tree[tree]); + + //var g_input_offset=0, bitbuf=0, vbits=0, reset=0; + var prm = [off,0,0,0]; + //console.log(split); split = 170; + + for (min_v=row=0; row < height; row++) { + if (split && row == split) { + //free (huff); + huff = make_decoder (nikon_tree[tree+1]); + //max_v += (min_v = 16) << 1; + } + for (col=0; col < raw_width; col++) { + i = getbithuff(data,prm,huff[0],huff); + len = i & 15; + shl = i >>> 4; + diff = (((getbithuff(data,prm,len-shl,0) << 1) + 1) << shl) >>> 1; + if ((diff & (1 << (len-1))) == 0) + diff -= (1 << len) - (shl==0?1:0); + if (col < 2) hpred[col] = vpred[row & 1][col] += diff; + else hpred[col & 1] += diff; + + var clr = Math.min(Math.max(hpred[col & 1],0),(1<>>3); dt[o]|=val>>>16; dt[o+1]|=val>>>8; dt[o+2]|=val; } + + + UTIF.decode._getbithuff = function(data,prm,nbits, huff) { + var zero_after_ff = 0; + var get_byte = UTIF.decode._get_byte; + var c; + + var off=prm[0], bitbuf=prm[1], vbits=prm[2], reset=prm[3]; + + //if (nbits > 25) return 0; + //if (nbits < 0) return bitbuf = vbits = reset = 0; + if (nbits == 0 || vbits < 0) return 0; + while (!reset && vbits < nbits && (c = data[off++]) != -1 && + !(reset = zero_after_ff && c == 0xff && data[off++])) { + //console.log("byte read into c"); + bitbuf = (bitbuf << 8) + c; + vbits += 8; + } + c = (bitbuf << (32-vbits)) >>> (32-nbits); + if (huff) { + vbits -= huff[c+1] >>> 8; //console.log(c, huff[c]>>8); + c = huff[c+1]&255; + } else + vbits -= nbits; + if (vbits < 0) throw "e"; + + prm[0]=off; prm[1]=bitbuf; prm[2]=vbits; prm[3]=reset; + + return c; + } + + UTIF.decode._make_decoder = function(source) { + var max, len, h, i, j; + var huff = []; + + for (max=16; max!=0 && !source[max]; max--); + var si=17; + + huff[0] = max; + for (h=len=1; len <= max; len++) + for (i=0; i < source[len]; i++, ++si) + for (j=0; j < 1 << (max-len); j++) + if (h <= 1 << max) + huff[h++] = (len << 8) | source[si]; + return huff; + } + + UTIF.decode._decodeNewJPEG = function(img, data, off, len, tgt, toff) + { + len = Math.min(len, data.length-off); + var tables = img["t347"], tlen = tables ? tables.length : 0, buff = new Uint8Array(tlen + len); + + if (tables) { + var SOI = 216, EOI = 217, boff = 0; + for (var i=0; i<(tlen-1); i++) + { + // Skip EOI marker from JPEGTables + if (tables[i]==255 && tables[i+1]==EOI) break; + buff[boff++] = tables[i]; + } + + // Skip SOI marker from data + var byte1 = data[off], byte2 = data[off + 1]; + if (byte1!=255 || byte2!=SOI) + { + buff[boff++] = byte1; + buff[boff++] = byte2; + } + for (var i=2; i>>8); } + else for(var i=0; i>>8); tgt[toff+(i<<1)+1] = (out[i]&255); } + } + else if(bps==14 || bps==12 || bps==10) { // 4 * 14 == 56 == 7 * 8 + var rst = 16-bps; + for(var i=0; i 1); + } + + if(!isTiled) + { + if(data[off]==255 && data[off+1]==SOI) return { jpegOffset: off }; + if(jpgIchgFmt!=null) + { + if(data[off+jifoff]==255 && data[off+jifoff+1]==SOI) joff = off+jifoff; + else log("JPEGInterchangeFormat does not point to SOI"); + + if(jpgIchgFmtLen==null) log("JPEGInterchangeFormatLength field is missing"); + else if(jifoff >= soff || (jifoff+jiflen) <= soff) log("JPEGInterchangeFormatLength field value is invalid"); + + if(joff != null) return { jpegOffset: joff }; + } + } + + if(ycbcrss!=null) { ssx = ycbcrss[0]; ssy = ycbcrss[1]; } + + if(jpgIchgFmt!=null) + if(jpgIchgFmtLen!=null) + if(jiflen >= 2 && (jifoff+jiflen) <= soff) + { + if(data[off+jifoff+jiflen-2]==255 && data[off+jifoff+jiflen-1]==SOI) tables = new Uint8Array(jiflen-2); + else tables = new Uint8Array(jiflen); + + for(i=0; i offset to first strip or tile"); + + if(tables == null) + { + var ooff = 0, out = []; + out[ooff++] = 255; out[ooff++] = SOI; + + var qtables = img["t519"]; + if(qtables==null) throw new Error("JPEGQTables tag is missing"); + for(i=0; i>> 8); out[ooff++] = nc & 255; + out[ooff++] = (i | (k << 4)); + for(j=0; j<16; j++) out[ooff++] = data[off+htables[i]+j]; + for(j=0; j>> 8) & 255; out[ooff++] = img.height & 255; + out[ooff++] = (img.width >>> 8) & 255; out[ooff++] = img.width & 255; + out[ooff++] = spp; + if(spp==1) { out[ooff++] = 1; out[ooff++] = 17; out[ooff++] = 0; } + else for(i=0; i<3; i++) + { + out[ooff++] = i + 1; + out[ooff++] = (i != 0) ? 17 : (((ssx & 15) << 4) | (ssy & 15)); + out[ooff++] = i; + } + + if(jpgresint!=null && jpgresint[0]!=0) + { + out[ooff++] = 255; out[ooff++] = DRI; out[ooff++] = 0; out[ooff++] = 4; + out[ooff++] = (jpgresint[0] >>> 8) & 255; + out[ooff++] = jpgresint[0] & 255; + } + + tables = new Uint8Array(out); + } + + var sofpos = -1; + i = 0; + while(i < (tables.length - 1)) { + if(tables[i]==255 && tables[i+1]==SOF0) { sofpos = i; break; } + i++; + } + + if(sofpos == -1) + { + var tmptab = new Uint8Array(tables.length + 10 + 3*spp); + tmptab.set(tables); + var tmpoff = tables.length; + sofpos = tables.length; + tables = tmptab; + + tables[tmpoff++] = 255; tables[tmpoff++] = SOF0; + tables[tmpoff++] = 0; tables[tmpoff++] = 8 + 3*spp; tables[tmpoff++] = 8; + tables[tmpoff++] = (img.height >>> 8) & 255; tables[tmpoff++] = img.height & 255; + tables[tmpoff++] = (img.width >>> 8) & 255; tables[tmpoff++] = img.width & 255; + tables[tmpoff++] = spp; + if(spp==1) { tables[tmpoff++] = 1; tables[tmpoff++] = 17; tables[tmpoff++] = 0; } + else for(i=0; i<3; i++) + { + tables[tmpoff++] = i + 1; + tables[tmpoff++] = (i != 0) ? 17 : (((ssx & 15) << 4) | (ssy & 15)); + tables[tmpoff++] = i; + } + } + + if(data[soff]==255 && data[soff+1]==SOS) + { + var soslen = (data[soff+2]<<8) | data[soff+3]; + sosMarker = new Uint8Array(soslen+2); + sosMarker[0] = data[soff]; sosMarker[1] = data[soff+1]; sosMarker[2] = data[soff+2]; sosMarker[3] = data[soff+3]; + for(i=0; i<(soslen-2); i++) sosMarker[i+4] = data[soff+i+4]; + } + else + { + sosMarker = new Uint8Array(2 + 6 + 2*spp); + var sosoff = 0; + sosMarker[sosoff++] = 255; sosMarker[sosoff++] = SOS; + sosMarker[sosoff++] = 0; sosMarker[sosoff++] = 6 + 2*spp; sosMarker[sosoff++] = spp; + if(spp==1) { sosMarker[sosoff++] = 1; sosMarker[sosoff++] = 0; } + else for(i=0; i<3; i++) + { + sosMarker[sosoff++] = i+1; sosMarker[sosoff++] = (i << 4) | i; + } + sosMarker[sosoff++] = 0; sosMarker[sosoff++] = 63; sosMarker[sosoff++] = 0; + } + + return { jpegOffset: off, tables: tables, sosMarker: sosMarker, sofPosition: sofpos }; + } + + UTIF.decode._decodeOldJPEG = function(img, data, off, len, tgt, toff) + { + var i, dlen, tlen, buff, buffoff; + var jpegData = UTIF.decode._decodeOldJPEGInit(img, data, off, len); + + if(jpegData.jpegOffset!=null) + { + dlen = off+len-jpegData.jpegOffset; + buff = new Uint8Array(dlen); + for(i=0; i>> 8) & 255; buff[jpegData.sofPosition+6] = img.height & 255; + buff[jpegData.sofPosition+7] = (img.width >>> 8) & 255; buff[jpegData.sofPosition+8] = img.width & 255; + + if(data[off]!=255 || data[off+1]!=SOS) + { + buff.set(jpegData.sosMarker, buffoff); + buffoff += sosMarker.length; + } + for(i=0; i=0 && n<128) for(var i=0; i< n+1; i++) { ta[toff]=sa[off]; toff++; off++; } + if(n>=-127 && n<0) { for(var i=0; i<-n+1; i++) { ta[toff]=sa[off]; toff++; } off++; } + } + return toff; + } + + UTIF.decode._decodeThunder = function(data, off, len, tgt, toff) + { + var d2 = [ 0, 1, 0, -1 ], d3 = [ 0, 1, 2, 3, 0, -3, -2, -1 ]; + var lim = off+len, qoff = toff*2, px = 0; + while(off>>6), n = (b&63); off++; + if(msk==3) { px=(n&15); tgt[qoff>>>1] |= (px<<(4*(1-qoff&1))); qoff++; } + if(msk==0) for(var i=0; i>>1] |= (px<<(4*(1-qoff&1))); qoff++; } + if(msk==2) for(var i=0; i<2; i++) { var d=(n>>>(3*(1-i)))&7; if(d!=4) { px+=d3[d]; tgt[qoff>>>1] |= (px<<(4*(1-qoff&1))); qoff++; } } + if(msk==1) for(var i=0; i<3; i++) { var d=(n>>>(2*(2-i)))&3; if(d!=2) { px+=d2[d]; tgt[qoff>>>1] |= (px<<(4*(1-qoff&1))); qoff++; } } + } + } + + UTIF.decode._dmap = { "1":0,"011":1,"000011":2,"0000011":3, "010":-1,"000010":-2,"0000010":-3 }; + UTIF.decode._lens = ( function() + { + var addKeys = function(lens, arr, i0, inc) { for(var i=0; i>>3)>>3]>>>(7-(boff&7)))&1; + if(fo==2) bit = (data[boff>>>3]>>>( (boff&7)))&1; + boff++; wrd+=bit; + if(mode=="H") + { + if(U._lens[clr][wrd]!=null) + { + var dl=U._lens[clr][wrd]; wrd=""; len+=dl; + if(dl<64) { U._addNtimes(line,len,clr); a0+=len; clr=1-clr; len=0; toRead--; if(toRead==0) mode=""; } + } + } + else + { + if(wrd=="0001") { wrd=""; U._addNtimes(line,b2-a0,clr); a0=b2; } + if(wrd=="001" ) { wrd=""; mode="H"; toRead=2; } + if(U._dmap[wrd]!=null) { a1 = b1+U._dmap[wrd]; U._addNtimes(line, a1-a0, clr); a0=a1; wrd=""; clr=1-clr; } + } + if(line.length==w && mode=="") + { + U._writeBits(line, tgt, toff*8+y*bipl); + clr=0; y++; a0=0; + pline=U._makeDiff(line); line=[]; + } + //if(wrd.length>150) { log(wrd); break; throw "e"; } + } + } + + UTIF.decode._findDiff = function(line, x, clr) { for(var i=0; i=x && line[i+1]==clr) return line[i]; } + + UTIF.decode._makeDiff = function(line) + { + var out = []; if(line[0]==1) out.push(0,1); + for(var i=1; i>>3)>>3]>>>(7-(boff&7)))&1; + if(fo==2) bit = (data[boff>>>3]>>>( (boff&7)))&1; + boff++; wrd+=bit; + + len = U._lens[clr][wrd]; + if(len!=null) { + U._addNtimes(line,len,clr); wrd=""; + if(len<64) clr = 1-clr; + if(line.length==w) { U._writeBits(line, tgt, toff*8+y*bipl); line=[]; y++; clr=0; if((boff&7)!=0) boff+=8-(boff&7); if(len>=64) boff+=8; } + } + } + } + + UTIF.decode._decodeG3 = function(data, off, slen, tgt, toff, w, fo, twoDim) + { + var U = UTIF.decode, boff=off<<3, len=0, wrd=""; + var line=[], pline=[]; for(var i=0; i>>3)>>3]>>>(7-(boff&7)))&1; + if(fo==2) bit = (data[boff>>>3]>>>( (boff&7)))&1; + boff++; wrd+=bit; + + if(is1D) + { + if(U._lens[clr][wrd]!=null) + { + var dl=U._lens[clr][wrd]; wrd=""; len+=dl; + if(dl<64) { U._addNtimes(line,len,clr); clr=1-clr; len=0; } + } + } + else + { + if(mode=="H") + { + if(U._lens[clr][wrd]!=null) + { + var dl=U._lens[clr][wrd]; wrd=""; len+=dl; + if(dl<64) { U._addNtimes(line,len,clr); a0+=len; clr=1-clr; len=0; toRead--; if(toRead==0) mode=""; } + } + } + else + { + if(wrd=="0001") { wrd=""; U._addNtimes(line,b2-a0,clr); a0=b2; } + if(wrd=="001" ) { wrd=""; mode="H"; toRead=2; } + if(U._dmap[wrd]!=null) { a1 = b1+U._dmap[wrd]; U._addNtimes(line, a1-a0, clr); a0=a1; wrd=""; clr=1-clr; } + } + } + if(wrd.endsWith("000000000001")) // needed for some files + { + if(y>=0) U._writeBits(line, tgt, toff*8+y*bipl); + if(twoDim) { + if(fo==1) is1D = ((data[boff>>>3]>>>(7-(boff&7)))&1)==1; + if(fo==2) is1D = ((data[boff>>>3]>>>( (boff&7)))&1)==1; + boff++; + } + //log("EOL",y, "next 1D:", is1D); + wrd=""; clr=0; y++; a0=0; + pline=U._makeDiff(line); line=[]; + } + } + if(line.length==w) U._writeBits(line, tgt, toff*8+y*bipl); + } + + UTIF.decode._addNtimes = function(arr, n, val) { for(var i=0; i>>3] |= (bits[i]<<(7-((boff+i)&7))); + } + + UTIF.decode._decodeLZW=UTIF.decode._decodeLZW=function(){var e,U,Z,u,K=0,V=0,g=0,N=0,O=function(){var S=e>>>3,A=U[S]<<16|U[S+1]<<8|U[S+2],j=A>>>24-(e&7)-V&(1<>>----------------"); + for(var i=0; idata.buffer.byteLength) num=data.buffer.byteLength-no; arr = new Uint8Array(data.buffer, no, num); } + if(type== 2) { var o0 = (num<5 ? offset-4 : voff), c=data[o0], len=Math.max(0, Math.min(num-1,data.length-o0)); + if(c<128 || len==0) arr.push( bin.readASCII(data, o0, len) ); + else arr = new Uint8Array(data.buffer, o0, len); } + if(type== 3) { for(var j=0; j4) { bin.writeUint(data, offset, eoff); toff=eoff; } + + if (type== 1 || type==7) { for(var i=0; i4) { dlen += (dlen&1); eoff += dlen; } + offset += 4; + } + return [offset, eoff]; + } + + UTIF.toRGBA8 = function(out, scl) + { + function gamma(x) { return x < 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1.0 / 2.4) - 0.055; } + + + var w = out.width, h = out.height, area = w*h, qarea = area*4, data = out.data; + var img = new Uint8Array(area*4); + //console.log(out); + // 0: WhiteIsZero, 1: BlackIsZero, 2: RGB, 3: Palette color, 4: Transparency mask, 5: CMYK + var intp = (out["t262"] ? out["t262"][0]: 2), bps = (out["t258"]?Math.min(32,out["t258"][0]):1); + if(out["t262"]==null && bps==1) intp=0; + + var smpls = out["t277"]?out["t277"][0] : (out["t258"]?out["t258"].length : [1,1,3,1,1,4,3][intp]); + var sfmt = out["t339"]?out["t339"][0] : null; if(intp==1 && bps==32 && sfmt!=3) throw "e"; // sample format + var bpl = Math.ceil(smpls*bps*w/8); + + //log("interpretation: ", intp, "smpls", smpls, "bps", bps, "sample format",sfmt, out); + + if(false) {} + else if(intp==0) + { + scl = 1/256; // "Photopeatest.tif" + for(var y=0; y>3)])>>(7- (i&7)))& 1; img[qi]=img[qi+1]=img[qi+2]=( 1-px)*255; img[qi+3]=255; } + if(bps== 4) for(var i=0; i>1)])>>(4-4*(i&1)))&15; img[qi]=img[qi+1]=img[qi+2]=(15-px)* 17; img[qi+3]=255; } + if(bps== 8) for(var i=0; i>3)])>>(7- (i&7)))&1; img[qi]=img[qi+1]=img[qi+2]=(px)*255; img[qi+3]=255; } + if(bps== 2) for(var i=0; i>2)])>>(6-2*(i&3)))&3; img[qi]=img[qi+1]=img[qi+2]=(px)* 85; img[qi+3]=255; } + if(bps== 8) for(var i=0; i>>2)+i, px=f32[o]; img[qi]=img[qi+1]=img[qi+2]= ~~(0.5+255*px); img[qi+3]=255; } + } + } + else if(intp==2) + { + if(bps== 8) + { + if(smpls==1) for(var i=0; i=4) for(var i=0; i1 && out["t338"] && out["t338"][0]!=0; + + for(var y=0; y>>3)]>>>(7- (x&7)))& 1; + else if(bps==2) mi=(data[dof+(x>>>2)]>>>(6-2*(x&3)))& 3; + else if(bps==4) mi=(data[dof+(x>>>1)]>>>(4-4*(x&1)))&15; + else if(bps==8) mi= data[dof+x*smpls]; + else throw bps; + img[qi]=(map[mi]>>8); img[qi+1]=(map[cn+mi]>>8); img[qi+2]=(map[cn+cn+mi]>>8); img[qi+3]=nexta ? data[dof+x*smpls+1] : 255; + } + } + else if(intp==5) + { + var gotAlpha = smpls>4 ? 1 : 0; + for(var i=0; i>>1); + var Y = data[si+(j&1)], Cb=data[si+2]-128, Cr=data[si+3]-128; + + var r = Y + ( (Cr >> 2) + (Cr >> 3) + (Cr >> 5) ) ; + var g = Y - ( (Cb >> 2) + (Cb >> 4) + (Cb >> 5)) - ( (Cr >> 1) + (Cr >> 3) + (Cr >> 4) + (Cr >> 5)) ; + var b = Y + ( Cb + (Cb >> 1) + (Cb >> 2) + (Cb >> 6)) ; + + img[qi ]=Math.max(0,Math.min(255,r)); + img[qi+1]=Math.max(0,Math.min(255,g)); + img[qi+2]=Math.max(0,Math.min(255,b)); + img[qi+3]=255; + } + } + } + else if(intp==32845) { + + for(var y=0; yma) { ma=ar; page=img; } + } + UTIF.decodeImage(buff, page, ifds); + var rgba = UTIF.toRGBA8(page), w=page.width, h=page.height; + + var cnv = document.createElement("canvas"); cnv.width=w; cnv.height=h; + var ctx = cnv.getContext("2d"); + var imgd = new ImageData(new Uint8ClampedArray(rgba.buffer),w,h); + ctx.putImageData(imgd,0,0); + return cnv.toDataURL(); + } + + + UTIF._binBE = + { + nextZero : function(data, o) { while(data[o]!=0) o++; return o; }, + readUshort : function(buff, p) { return (buff[p]<< 8) | buff[p+1]; }, + readShort : function(buff, p) { var a=UTIF._binBE.ui8; a[0]=buff[p+1]; a[1]=buff[p+0]; return UTIF._binBE. i16[0]; }, + readInt : function(buff, p) { var a=UTIF._binBE.ui8; a[0]=buff[p+3]; a[1]=buff[p+2]; a[2]=buff[p+1]; a[3]=buff[p+0]; return UTIF._binBE. i32[0]; }, + readUint : function(buff, p) { var a=UTIF._binBE.ui8; a[0]=buff[p+3]; a[1]=buff[p+2]; a[2]=buff[p+1]; a[3]=buff[p+0]; return UTIF._binBE.ui32[0]; }, + readASCII : function(buff, p, l) { var s = ""; for(var i=0; i> 8)&255; buff[p+1] = n&255; }, + writeInt : function(buff, p, n) { var a=UTIF._binBE.ui8; UTIF._binBE.i32[0]=n; buff[p+3]=a[0]; buff[p+2]=a[1]; buff[p+1]=a[2]; buff[p+0]=a[3]; }, + writeUint : function(buff, p, n) { buff[p] = (n>>24)&255; buff[p+1] = (n>>16)&255; buff[p+2] = (n>>8)&255; buff[p+3] = (n>>0)&255; }, + writeASCII : function(buff, p, s) { for(var i = 0; i < s.length; i++) buff[p+i] = s.charCodeAt(i); }, + writeDouble: function(buff, p, n) + { + UTIF._binBE.fl64[0] = n; + for (var i = 0; i < 8; i++) buff[p + i] = UTIF._binBE.ui8[7 - i]; + } + } + UTIF._binBE.ui8 = new Uint8Array (8); + UTIF._binBE.i16 = new Int16Array (UTIF._binBE.ui8.buffer); + UTIF._binBE.i32 = new Int32Array (UTIF._binBE.ui8.buffer); + UTIF._binBE.ui32 = new Uint32Array (UTIF._binBE.ui8.buffer); + UTIF._binBE.fl32 = new Float32Array(UTIF._binBE.ui8.buffer); + UTIF._binBE.fl64 = new Float64Array(UTIF._binBE.ui8.buffer); + + UTIF._binLE = + { + nextZero : UTIF._binBE.nextZero, + readUshort : function(buff, p) { return (buff[p+1]<< 8) | buff[p]; }, + readShort : function(buff, p) { var a=UTIF._binBE.ui8; a[0]=buff[p+0]; a[1]=buff[p+1]; return UTIF._binBE. i16[0]; }, + readInt : function(buff, p) { var a=UTIF._binBE.ui8; a[0]=buff[p+0]; a[1]=buff[p+1]; a[2]=buff[p+2]; a[3]=buff[p+3]; return UTIF._binBE. i32[0]; }, + readUint : function(buff, p) { var a=UTIF._binBE.ui8; a[0]=buff[p+0]; a[1]=buff[p+1]; a[2]=buff[p+2]; a[3]=buff[p+3]; return UTIF._binBE.ui32[0]; }, + readASCII : UTIF._binBE.readASCII, + readFloat : function(buff, p) { var a=UTIF._binBE.ui8; for(var i=0;i<4;i++) a[i]=buff[p+ i]; return UTIF._binBE.fl32[0]; }, + readDouble : function(buff, p) { var a=UTIF._binBE.ui8; for(var i=0;i<8;i++) a[i]=buff[p+ i]; return UTIF._binBE.fl64[0]; }, + + writeUshort: function(buff, p, n) { buff[p] = (n)&255; buff[p+1] = (n>>8)&255; }, + writeInt : function(buff, p, n) { var a=UTIF._binBE.ui8; UTIF._binBE.i32[0]=n; buff[p+0]=a[0]; buff[p+1]=a[1]; buff[p+2]=a[2]; buff[p+3]=a[3]; }, + writeUint : function(buff, p, n) { buff[p] = (n>>>0)&255; buff[p+1] = (n>>>8)&255; buff[p+2] = (n>>>16)&255; buff[p+3] = (n>>>24)&255; }, + writeASCII : UTIF._binBE.writeASCII + } + UTIF._copyTile = function(tb, tw, th, b, w, h, xoff, yoff) + { + //log("copyTile", tw, th, w, h, xoff, yoff); + var xlim = Math.min(tw, w-xoff); + var ylim = Math.min(th, h-yoff); + for(var y=0; y>--s&1; + Y=I[Y+F]}E[w]=Y}}function z(h,V,I,f){if(h[V+3]!=255)return 0;if(I==0)return V;for(var w=0;w<2;w++){if(h[V+w]==0){h[V+w]=h.length; + h.push(0,0,f,255)}var x=z(h,h[V+w],I-1,f+1);if(x!=0)return x}return 0}function i(h){var V=h.b,I=h.f; + while(V<25&&h.a>(V.b-=h)&65535>>16-h}function g(h,V){var I=h[0],f=0,w=255,x=0;if(V.b<16)i(V);var T=V.f>>V.b-8&255; + f=h[1][T];w=I[f+3];V.b-=I[f+2];while(w==255){x=V.f>>--V.b&1;f=I[f+x];w=I[f+3]}return w}function P(h,V){if(h<32768>>16-V)h+=-(1<>4,J&15]}}else if(Y==65476){var a3=O+F-2;while(O>>4];x[v[0]]=v.slice(1)}I=l();O+=2;break}else if(Y==65501){w=m()}else{O+=F-2}}var a4=f>8?Uint16Array:Uint8Array,$=new a4(s*_*E),M={b:0,f:0,c:I==8,a:O,data:b,d:b.length,e:w}; + if(M.c)a1($,_*E,M,G[0],s);else{var c=[],p=0,D=0;for(var t=0;tp)p=S; + if(K>D)D=K;c.push(S*K)}if(p!=1||D!=1){if(E!=3||c[1]!=1||c[2]!=1)throw"e";if(p!=2||D!=1&&D!=2)throw"e"; + var u=[],Z=0;for(var t=0;t>>1)*B+(S>>>1))*Z,y=(K&1)*2+(S&1); + $[q]=n[k+y];$[q+1]=n[k+4];$[q+2]=n[k+5]}else for(var S=0;S<_;S++){var q=(K*_+S)*E,k=(K*B+(S>>>1))*Z,y=S&1; + $[q]=n[k+y];$[q+1]=n[k+2];$[q+2]=n[k+3]}}}else{X($,_*E,M,G,E,s);if(w==0)j($,I,_,s,0,E,E,f);else{var U=Math.floor(w/_); + for(var K=0;K>>1);else if(V==6)Q=h[J]+(r-h[J-G]>>>1);else if(V==7)Q=r+h[J]>>>1;else throw V; + h[a]+=Q}}}}return C}(); + + + (function(){var G=0,F=1,i=2,b=3,J=4,N=5,E=6,s=7,c=8,T=9,a3=10,f=11,q=12,M=13,m=14,x=15,L=16,$=17,p=18; + function a5(t){var Z=UTIF._binBE.readUshort,u={b:Z(t,0),i:t[2],C:t[3],u:t[4],q:Z(t,5),k:Z(t,7),e:Z(t,9),l:Z(t,11),s:t[13],d:Z(t,14)}; + if(u.b!=18771||u.i>1||u.q<6||u.q%6||u.e<768||u.e%24||u.l!=768||u.k=u.l||u.s>16||u.s!=u.k/u.l||u.s!=Math.ceil(u.e/u.l)||u.d!=u.q/6||u.u!=12&&u.u!=14&&u.u!=16||u.C!=16&&u.C!=0){throw"Invalid data"}if(u.i==0){throw"Not implemented. We need this file!"}u.h=u.C==16; + u.m=(u.h?u.l*2/3:u.l>>>1)|0;u.A=u.m+2;u.f=64;u.g=(1<>>6);for(var e=0;e<3;e++){for(var Q=0; + Q<41;Q++){Z[e][Q]=[u,1]}}return Z}function a4(t){for(var Z=-1,u=0;!u;Z++){u=t[t.j]>>>7-t.a&1;t.a++;t.a&=7; + if(!t.a)t.j++}return Z}function K(t,Z){var u=0,e=8-t.a,Q=t.j,V=t.a;if(Z){if(Z>=e){do{u<<=e;Z-=e;u|=t[t.j]&(1<=8)}if(Z){u<<=Z;e-=Z;u|=t[t.j]>>>e&(1<n&&C>>2;if(o){w[X]=h;return}l=Z.t*Z.c[t.g+Y-H]+Z.c[t.g+g-Y]}else{h=Y>g&&Y>P||Y>>2:A+v>>>1; + l=Z.t*Z.c[t.g+Y-g]+Z.c[t.g+g-A]}R=y(l);var W=a4(u);if(W>>1):a>>>1; + O[R][0]+=y(a);if(O[R][1]==t.f){O[R][0]>>>=1;O[R][1]>>>=1}O[R][1]++;h=l<0?h-a:h+a;if(t.i){if(h<0)h+=Z.w; + else if(h>t.g)h-=Z.w}w[X]=h>=0?Math.min(h,t.g):0}function U(t,Z,u){var e=t[0].length;for(var Q=Z;Q<=u; + Q++){t[Q][0]=t[Q-1][1];t[Q][e-1]=t[Q-1][e-2]}}function B(t){U(t,s,q);U(t,i,J);U(t,x,$)}function _(t,Z,u,e,Q,V,O,o,X,k,j,I,a){var l=0,R=1,w=QJ; + while(R8){r(t,Z,u,e,Q,R,o[X]);r(t,Z,u,e,V,R,o[X]);R+=2}}B(e)}function a8(t,Z,u,e,Q,V){_(t,Z,u,e,i,s,Q,V,0,0,1,0,8); + _(t,Z,u,e,c,x,Q,V,1,0,1,0,8);_(t,Z,u,e,b,T,Q,V,2,1,0,3,0);_(t,Z,u,e,a3,L,Q,V,0,0,0,3,2);_(t,Z,u,e,J,f,Q,V,1,0,0,3,2); + _(t,Z,u,e,q,$,Q,V,2,1,0,3,0)}function a9(t,Z,u,e,Q,V){var O=V.length,o=t.l;if(Q+1==t.s)o=t.e-Q*t.l;var X=6*t.e*e+Q*t.l; + for(var k=0;k<6;k++){for(var j=0;j>>1)}else if(I==2){a=x+(k>>>1)}else{a=s+k}var l=t.h?(j*2/3&2147483646|j%3&1)+(j%3>>>1):j>>>1; + Z[X+j]=u[a][l+1]}X+=t.e}}UTIF._decompressRAF=function(t,Z){var u=a5(t),e=a7(t,u),Q=a2(u),V=new Int16Array(u.e*u.q); + if(Z==null){Z=u.h?[[1,1,0,1,1,2],[1,1,2,1,1,0],[2,0,1,0,2,1],[1,1,2,1,1,0],[1,1,0,1,1,2],[0,2,1,2,0,1]]:[[0,1],[3,2]]}var O=[[G,b],[F,J],[N,f],[E,q],[M,L],[m,$]],o=[]; + for(var X=0;X + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/project starter code/node_modules/util-deprecate/README.md b/project starter code/node_modules/util-deprecate/README.md new file mode 100644 index 00000000..75622fa7 --- /dev/null +++ b/project starter code/node_modules/util-deprecate/README.md @@ -0,0 +1,53 @@ +util-deprecate +============== +### The Node.js `util.deprecate()` function with browser support + +In Node.js, this module simply re-exports the `util.deprecate()` function. + +In the web browser (i.e. via browserify), a browser-specific implementation +of the `util.deprecate()` function is used. + + +## API + +A `deprecate()` function is the only thing exposed by this module. + +``` javascript +// setup: +exports.foo = deprecate(foo, 'foo() is deprecated, use bar() instead'); + + +// users see: +foo(); +// foo() is deprecated, use bar() instead +foo(); +foo(); +``` + + +## License + +(The MIT License) + +Copyright (c) 2014 Nathan Rajlich + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/project starter code/node_modules/util-deprecate/browser.js b/project starter code/node_modules/util-deprecate/browser.js new file mode 100644 index 00000000..549ae2f0 --- /dev/null +++ b/project starter code/node_modules/util-deprecate/browser.js @@ -0,0 +1,67 @@ + +/** + * Module exports. + */ + +module.exports = deprecate; + +/** + * Mark that a method should not be used. + * Returns a modified function which warns once by default. + * + * If `localStorage.noDeprecation = true` is set, then it is a no-op. + * + * If `localStorage.throwDeprecation = true` is set, then deprecated functions + * will throw an Error when invoked. + * + * If `localStorage.traceDeprecation = true` is set, then deprecated functions + * will invoke `console.trace()` instead of `console.error()`. + * + * @param {Function} fn - the function to deprecate + * @param {String} msg - the string to print to the console when `fn` is invoked + * @returns {Function} a new "deprecated" version of `fn` + * @api public + */ + +function deprecate (fn, msg) { + if (config('noDeprecation')) { + return fn; + } + + var warned = false; + function deprecated() { + if (!warned) { + if (config('throwDeprecation')) { + throw new Error(msg); + } else if (config('traceDeprecation')) { + console.trace(msg); + } else { + console.warn(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; +} + +/** + * Checks `localStorage` for boolean values for the given `name`. + * + * @param {String} name + * @returns {Boolean} + * @api private + */ + +function config (name) { + // accessing global.localStorage can trigger a DOMException in sandboxed iframes + try { + if (!global.localStorage) return false; + } catch (_) { + return false; + } + var val = global.localStorage[name]; + if (null == val) return false; + return String(val).toLowerCase() === 'true'; +} diff --git a/project starter code/node_modules/util-deprecate/node.js b/project starter code/node_modules/util-deprecate/node.js new file mode 100644 index 00000000..5e6fcff5 --- /dev/null +++ b/project starter code/node_modules/util-deprecate/node.js @@ -0,0 +1,6 @@ + +/** + * For Node.js, simply re-export the core `util.deprecate` function. + */ + +module.exports = require('util').deprecate; diff --git a/project starter code/node_modules/util-deprecate/package.json b/project starter code/node_modules/util-deprecate/package.json new file mode 100644 index 00000000..2e79f89a --- /dev/null +++ b/project starter code/node_modules/util-deprecate/package.json @@ -0,0 +1,27 @@ +{ + "name": "util-deprecate", + "version": "1.0.2", + "description": "The Node.js `util.deprecate()` function with browser support", + "main": "node.js", + "browser": "browser.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git://github.com/TooTallNate/util-deprecate.git" + }, + "keywords": [ + "util", + "deprecate", + "browserify", + "browser", + "node" + ], + "author": "Nathan Rajlich (http://n8.io/)", + "license": "MIT", + "bugs": { + "url": "https://github.com/TooTallNate/util-deprecate/issues" + }, + "homepage": "https://github.com/TooTallNate/util-deprecate" +} diff --git a/project starter code/node_modules/webidl-conversions/LICENSE.md b/project starter code/node_modules/webidl-conversions/LICENSE.md new file mode 100644 index 00000000..d4a994f5 --- /dev/null +++ b/project starter code/node_modules/webidl-conversions/LICENSE.md @@ -0,0 +1,12 @@ +# The BSD 2-Clause License + +Copyright (c) 2014, Domenic Denicola +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/project starter code/node_modules/webidl-conversions/README.md b/project starter code/node_modules/webidl-conversions/README.md new file mode 100644 index 00000000..3657890a --- /dev/null +++ b/project starter code/node_modules/webidl-conversions/README.md @@ -0,0 +1,53 @@ +# WebIDL Type Conversions on JavaScript Values + +This package implements, in JavaScript, the algorithms to convert a given JavaScript value according to a given [WebIDL](http://heycam.github.io/webidl/) [type](http://heycam.github.io/webidl/#idl-types). + +The goal is that you should be able to write code like + +```js +const conversions = require("webidl-conversions"); + +function doStuff(x, y) { + x = conversions["boolean"](x); + y = conversions["unsigned long"](y); + // actual algorithm code here +} +``` + +and your function `doStuff` will behave the same as a WebIDL operation declared as + +```webidl +void doStuff(boolean x, unsigned long y); +``` + +## API + +This package's main module's default export is an object with a variety of methods, each corresponding to a different WebIDL type. Each method, when invoked on a JavaScript value, will give back the new JavaScript value that results after passing through the WebIDL conversion rules. (See below for more details on what that means.) Alternately, the method could throw an error, if the WebIDL algorithm is specified to do so: for example `conversions["float"](NaN)` [will throw a `TypeError`](http://heycam.github.io/webidl/#es-float). + +## Status + +All of the numeric types are implemented (float being implemented as double) and some others are as well - check the source for all of them. This list will grow over time in service of the [HTML as Custom Elements](https://github.com/dglazkov/html-as-custom-elements) project, but in the meantime, pull requests welcome! + +I'm not sure yet what the strategy will be for modifiers, e.g. [`[Clamp]`](http://heycam.github.io/webidl/#Clamp). Maybe something like `conversions["unsigned long"](x, { clamp: true })`? We'll see. + +We might also want to extend the API to give better error messages, e.g. "Argument 1 of HTMLMediaElement.fastSeek is not a finite floating-point value" instead of "Argument is not a finite floating-point value." This would require passing in more information to the conversion functions than we currently do. + +## Background + +What's actually going on here, conceptually, is pretty weird. Let's try to explain. + +WebIDL, as part of its madness-inducing design, has its own type system. When people write algorithms in web platform specs, they usually operate on WebIDL values, i.e. instances of WebIDL types. For example, if they were specifying the algorithm for our `doStuff` operation above, they would treat `x` as a WebIDL value of [WebIDL type `boolean`](http://heycam.github.io/webidl/#idl-boolean). Crucially, they would _not_ treat `x` as a JavaScript variable whose value is either the JavaScript `true` or `false`. They're instead working in a different type system altogether, with its own rules. + +Separately from its type system, WebIDL defines a ["binding"](http://heycam.github.io/webidl/#ecmascript-binding) of the type system into JavaScript. This contains rules like: when you pass a JavaScript value to the JavaScript method that manifests a given WebIDL operation, how does that get converted into a WebIDL value? For example, a JavaScript `true` passed in the position of a WebIDL `boolean` argument becomes a WebIDL `true`. But, a JavaScript `true` passed in the position of a [WebIDL `unsigned long`](http://heycam.github.io/webidl/#idl-unsigned-long) becomes a WebIDL `1`. And so on. + +Finally, we have the actual implementation code. This is usually C++, although these days [some smart people are using Rust](https://github.com/servo/servo). The implementation, of course, has its own type system. So when they implement the WebIDL algorithms, they don't actually use WebIDL values, since those aren't "real" outside of specs. Instead, implementations apply the WebIDL binding rules in such a way as to convert incoming JavaScript values into C++ values. For example, if code in the browser called `doStuff(true, true)`, then the implementation code would eventually receive a C++ `bool` containing `true` and a C++ `uint32_t` containing `1`. + +The upside of all this is that implementations can abstract all the conversion logic away, letting WebIDL handle it, and focus on implementing the relevant methods in C++ with values of the correct type already provided. That is payoff of WebIDL, in a nutshell. + +And getting to that payoff is the goal of _this_ project—but for JavaScript implementations, instead of C++ ones. That is, this library is designed to make it easier for JavaScript developers to write functions that behave like a given WebIDL operation. So conceptually, the conversion pipeline, which in its general form is JavaScript values ↦ WebIDL values ↦ implementation-language values, in this case becomes JavaScript values ↦ WebIDL values ↦ JavaScript values. And that intermediate step is where all the logic is performed: a JavaScript `true` becomes a WebIDL `1` in an unsigned long context, which then becomes a JavaScript `1`. + +## Don't Use This + +Seriously, why would you ever use this? You really shouldn't. WebIDL is … not great, and you shouldn't be emulating its semantics. If you're looking for a generic argument-processing library, you should find one with better rules than those from WebIDL. In general, your JavaScript should not be trying to become more like WebIDL; if anything, we should fix WebIDL to make it more like JavaScript. + +The _only_ people who should use this are those trying to create faithful implementations (or polyfills) of web platform interfaces defined in WebIDL. diff --git a/project starter code/node_modules/webidl-conversions/lib/index.js b/project starter code/node_modules/webidl-conversions/lib/index.js new file mode 100644 index 00000000..c5153a3a --- /dev/null +++ b/project starter code/node_modules/webidl-conversions/lib/index.js @@ -0,0 +1,189 @@ +"use strict"; + +var conversions = {}; +module.exports = conversions; + +function sign(x) { + return x < 0 ? -1 : 1; +} + +function evenRound(x) { + // Round x to the nearest integer, choosing the even integer if it lies halfway between two. + if ((x % 1) === 0.5 && (x & 1) === 0) { // [even number].5; round down (i.e. floor) + return Math.floor(x); + } else { + return Math.round(x); + } +} + +function createNumberConversion(bitLength, typeOpts) { + if (!typeOpts.unsigned) { + --bitLength; + } + const lowerBound = typeOpts.unsigned ? 0 : -Math.pow(2, bitLength); + const upperBound = Math.pow(2, bitLength) - 1; + + const moduloVal = typeOpts.moduloBitLength ? Math.pow(2, typeOpts.moduloBitLength) : Math.pow(2, bitLength); + const moduloBound = typeOpts.moduloBitLength ? Math.pow(2, typeOpts.moduloBitLength - 1) : Math.pow(2, bitLength - 1); + + return function(V, opts) { + if (!opts) opts = {}; + + let x = +V; + + if (opts.enforceRange) { + if (!Number.isFinite(x)) { + throw new TypeError("Argument is not a finite number"); + } + + x = sign(x) * Math.floor(Math.abs(x)); + if (x < lowerBound || x > upperBound) { + throw new TypeError("Argument is not in byte range"); + } + + return x; + } + + if (!isNaN(x) && opts.clamp) { + x = evenRound(x); + + if (x < lowerBound) x = lowerBound; + if (x > upperBound) x = upperBound; + return x; + } + + if (!Number.isFinite(x) || x === 0) { + return 0; + } + + x = sign(x) * Math.floor(Math.abs(x)); + x = x % moduloVal; + + if (!typeOpts.unsigned && x >= moduloBound) { + return x - moduloVal; + } else if (typeOpts.unsigned) { + if (x < 0) { + x += moduloVal; + } else if (x === -0) { // don't return negative zero + return 0; + } + } + + return x; + } +} + +conversions["void"] = function () { + return undefined; +}; + +conversions["boolean"] = function (val) { + return !!val; +}; + +conversions["byte"] = createNumberConversion(8, { unsigned: false }); +conversions["octet"] = createNumberConversion(8, { unsigned: true }); + +conversions["short"] = createNumberConversion(16, { unsigned: false }); +conversions["unsigned short"] = createNumberConversion(16, { unsigned: true }); + +conversions["long"] = createNumberConversion(32, { unsigned: false }); +conversions["unsigned long"] = createNumberConversion(32, { unsigned: true }); + +conversions["long long"] = createNumberConversion(32, { unsigned: false, moduloBitLength: 64 }); +conversions["unsigned long long"] = createNumberConversion(32, { unsigned: true, moduloBitLength: 64 }); + +conversions["double"] = function (V) { + const x = +V; + + if (!Number.isFinite(x)) { + throw new TypeError("Argument is not a finite floating-point value"); + } + + return x; +}; + +conversions["unrestricted double"] = function (V) { + const x = +V; + + if (isNaN(x)) { + throw new TypeError("Argument is NaN"); + } + + return x; +}; + +// not quite valid, but good enough for JS +conversions["float"] = conversions["double"]; +conversions["unrestricted float"] = conversions["unrestricted double"]; + +conversions["DOMString"] = function (V, opts) { + if (!opts) opts = {}; + + if (opts.treatNullAsEmptyString && V === null) { + return ""; + } + + return String(V); +}; + +conversions["ByteString"] = function (V, opts) { + const x = String(V); + let c = undefined; + for (let i = 0; (c = x.codePointAt(i)) !== undefined; ++i) { + if (c > 255) { + throw new TypeError("Argument is not a valid bytestring"); + } + } + + return x; +}; + +conversions["USVString"] = function (V) { + const S = String(V); + const n = S.length; + const U = []; + for (let i = 0; i < n; ++i) { + const c = S.charCodeAt(i); + if (c < 0xD800 || c > 0xDFFF) { + U.push(String.fromCodePoint(c)); + } else if (0xDC00 <= c && c <= 0xDFFF) { + U.push(String.fromCodePoint(0xFFFD)); + } else { + if (i === n - 1) { + U.push(String.fromCodePoint(0xFFFD)); + } else { + const d = S.charCodeAt(i + 1); + if (0xDC00 <= d && d <= 0xDFFF) { + const a = c & 0x3FF; + const b = d & 0x3FF; + U.push(String.fromCodePoint((2 << 15) + (2 << 9) * a + b)); + ++i; + } else { + U.push(String.fromCodePoint(0xFFFD)); + } + } + } + } + + return U.join(''); +}; + +conversions["Date"] = function (V, opts) { + if (!(V instanceof Date)) { + throw new TypeError("Argument is not a Date object"); + } + if (isNaN(V)) { + return undefined; + } + + return V; +}; + +conversions["RegExp"] = function (V, opts) { + if (!(V instanceof RegExp)) { + V = new RegExp(V); + } + + return V; +}; diff --git a/project starter code/node_modules/webidl-conversions/package.json b/project starter code/node_modules/webidl-conversions/package.json new file mode 100644 index 00000000..c31bc074 --- /dev/null +++ b/project starter code/node_modules/webidl-conversions/package.json @@ -0,0 +1,23 @@ +{ + "name": "webidl-conversions", + "version": "3.0.1", + "description": "Implements the WebIDL algorithms for converting to and from JavaScript values", + "main": "lib/index.js", + "scripts": { + "test": "mocha test/*.js" + }, + "repository": "jsdom/webidl-conversions", + "keywords": [ + "webidl", + "web", + "types" + ], + "files": [ + "lib/" + ], + "author": "Domenic Denicola (https://domenic.me/)", + "license": "BSD-2-Clause", + "devDependencies": { + "mocha": "^1.21.4" + } +} diff --git a/project starter code/node_modules/whatwg-fetch/LICENSE b/project starter code/node_modules/whatwg-fetch/LICENSE new file mode 100644 index 00000000..402afeca --- /dev/null +++ b/project starter code/node_modules/whatwg-fetch/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2014-2023 GitHub, Inc. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/project starter code/node_modules/whatwg-fetch/README.md b/project starter code/node_modules/whatwg-fetch/README.md new file mode 100644 index 00000000..c2882839 --- /dev/null +++ b/project starter code/node_modules/whatwg-fetch/README.md @@ -0,0 +1,349 @@ +# window.fetch polyfill + +[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/JakeChampion/fetch/badge)](https://securityscorecards.dev/viewer/?uri=github.com/JakeChampion/fetch) + +The `fetch()` function is a Promise-based mechanism for programmatically making +web requests in the browser. This project is a polyfill that implements a subset +of the standard [Fetch specification][], enough to make `fetch` a viable +replacement for most uses of XMLHttpRequest in traditional web applications. + +## Table of Contents + +* [Read this first](#read-this-first) +* [Installation](#installation) +* [Usage](#usage) + * [Importing](#importing) + * [HTML](#html) + * [JSON](#json) + * [Response metadata](#response-metadata) + * [Post form](#post-form) + * [Post JSON](#post-json) + * [File upload](#file-upload) + * [Caveats](#caveats) + * [Handling HTTP error statuses](#handling-http-error-statuses) + * [Sending cookies](#sending-cookies) + * [Receiving cookies](#receiving-cookies) + * [Redirect modes](#redirect-modes) + * [Obtaining the Response URL](#obtaining-the-response-url) + * [Aborting requests](#aborting-requests) +* [Browser Support](#browser-support) + +## Read this first + +* If you believe you found a bug with how `fetch` behaves in your browser, + please **don't open an issue in this repository** unless you are testing in + an old version of a browser that doesn't support `window.fetch` natively. + Make sure you read this _entire_ readme, especially the [Caveats](#caveats) + section, as there's probably a known work-around for an issue you've found. + This project is a _polyfill_, and since all modern browsers now implement the + `fetch` function natively, **no code from this project** actually takes any + effect there. See [Browser support](#browser-support) for detailed + information. + +* If you have trouble **making a request to another domain** (a different + subdomain or port number also constitutes another domain), please familiarize + yourself with all the intricacies and limitations of [CORS][] requests. + Because CORS requires participation of the server by implementing specific + HTTP response headers, it is often nontrivial to set up or debug. CORS is + exclusively handled by the browser's internal mechanisms which this polyfill + cannot influence. + +* This project **doesn't work under Node.js environments**. It's meant for web + browsers only. You should ensure that your application doesn't try to package + and run this on the server. + +* If you have an idea for a new feature of `fetch`, **submit your feature + requests** to the [specification's repository](https://github.com/whatwg/fetch/issues). + We only add features and APIs that are part of the [Fetch specification][]. + +## Installation + +``` +npm install whatwg-fetch --save +``` + +You will also need a Promise polyfill for [older browsers](https://caniuse.com/promises). +We recommend [taylorhakes/promise-polyfill](https://github.com/taylorhakes/promise-polyfill) +for its small size and Promises/A+ compatibility. + +## Usage + +### Importing + +Importing will automatically polyfill `window.fetch` and related APIs: + +```javascript +import 'whatwg-fetch' + +window.fetch(...) +``` + +If for some reason you need to access the polyfill implementation, it is +available via exports: + +```javascript +import {fetch as fetchPolyfill} from 'whatwg-fetch' + +window.fetch(...) // use native browser version +fetchPolyfill(...) // use polyfill implementation +``` + +This approach can be used to, for example, use [abort +functionality](#aborting-requests) in browsers that implement a native but +outdated version of fetch that doesn't support aborting. + +For use with webpack, add this package in the `entry` configuration option +before your application entry point: + +```javascript +entry: ['whatwg-fetch', ...] +``` + +### HTML + +```javascript +fetch('/users.html') + .then(function(response) { + return response.text() + }).then(function(body) { + document.body.innerHTML = body + }) +``` + +### JSON + +```javascript +fetch('/users.json') + .then(function(response) { + return response.json() + }).then(function(json) { + console.log('parsed json', json) + }).catch(function(ex) { + console.log('parsing failed', ex) + }) +``` + +### Response metadata + +```javascript +fetch('/users.json').then(function(response) { + console.log(response.headers.get('Content-Type')) + console.log(response.headers.get('Date')) + console.log(response.status) + console.log(response.statusText) +}) +``` + +### Post form + +```javascript +var form = document.querySelector('form') + +fetch('/users', { + method: 'POST', + body: new FormData(form) +}) +``` + +### Post JSON + +```javascript +fetch('/users', { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + name: 'Hubot', + login: 'hubot', + }) +}) +``` + +### File upload + +```javascript +var input = document.querySelector('input[type="file"]') + +var data = new FormData() +data.append('file', input.files[0]) +data.append('user', 'hubot') + +fetch('/avatars', { + method: 'POST', + body: data +}) +``` + +### Caveats + +* The Promise returned from `fetch()` **won't reject on HTTP error status** + even if the response is an HTTP 404 or 500. Instead, it will resolve normally, + and it will only reject on network failure or if anything prevented the + request from completing. + +* For maximum browser compatibility when it comes to sending & receiving + cookies, always supply the `credentials: 'same-origin'` option instead of + relying on the default. See [Sending cookies](#sending-cookies). + +* Not all Fetch standard options are supported in this polyfill. For instance, + [`redirect`](#redirect-modes) and + `cache` directives are ignored. + +* `keepalive` is not supported because it would involve making a synchronous XHR, which is something this project is not willing to do. See [issue #700](https://github.com/github/fetch/issues/700#issuecomment-484188326) for more information. + +#### Handling HTTP error statuses + +To have `fetch` Promise reject on HTTP error statuses, i.e. on any non-2xx +status, define a custom response handler: + +```javascript +function checkStatus(response) { + if (response.status >= 200 && response.status < 300) { + return response + } else { + var error = new Error(response.statusText) + error.response = response + throw error + } +} + +function parseJSON(response) { + return response.json() +} + +fetch('/users') + .then(checkStatus) + .then(parseJSON) + .then(function(data) { + console.log('request succeeded with JSON response', data) + }).catch(function(error) { + console.log('request failed', error) + }) +``` + +#### Sending cookies + +For [CORS][] requests, use `credentials: 'include'` to allow sending credentials +to other domains: + +```javascript +fetch('https://example.com:1234/users', { + credentials: 'include' +}) +``` + +The default value for `credentials` is "same-origin". + +The default for `credentials` wasn't always the same, though. The following +versions of browsers implemented an older version of the fetch specification +where the default was "omit": + +* Firefox 39-60 +* Chrome 42-67 +* Safari 10.1-11.1.2 + +If you target these browsers, it's advisable to always specify `credentials: +'same-origin'` explicitly with all fetch requests instead of relying on the +default: + +```javascript +fetch('/users', { + credentials: 'same-origin' +}) +``` + +Note: due to [limitations of +XMLHttpRequest](https://github.com/github/fetch/pull/56#issuecomment-68835992), +using `credentials: 'omit'` is not respected for same domains in browsers where +this polyfill is active. Cookies will always be sent to same domains in older +browsers. + +#### Receiving cookies + +As with XMLHttpRequest, the `Set-Cookie` response header returned from the +server is a [forbidden header name][] and therefore can't be programmatically +read with `response.headers.get()`. Instead, it's the browser's responsibility +to handle new cookies being set (if applicable to the current URL). Unless they +are HTTP-only, new cookies will be available through `document.cookie`. + +#### Redirect modes + +The Fetch specification defines these values for [the `redirect` +option](https://fetch.spec.whatwg.org/#concept-request-redirect-mode): "follow" +(the default), "error", and "manual". + +Due to limitations of XMLHttpRequest, only the "follow" mode is available in +browsers where this polyfill is active. + +#### Obtaining the Response URL + +Due to limitations of XMLHttpRequest, the `response.url` value might not be +reliable after HTTP redirects on older browsers. + +The solution is to configure the server to set the response HTTP header +`X-Request-URL` to the current URL after any redirect that might have happened. +It should be safe to set it unconditionally. + +``` ruby +# Ruby on Rails controller example +response.headers['X-Request-URL'] = request.url +``` + +This server workaround is necessary if you need reliable `response.url` in +Firefox < 32, Chrome < 37, Safari, or IE. + +#### Aborting requests + +This polyfill supports +[the abortable fetch API](https://developers.google.com/web/updates/2017/09/abortable-fetch). +However, aborting a fetch requires use of two additional DOM APIs: +[AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) and +[AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal). +Typically, browsers that do not support fetch will also not support +AbortController or AbortSignal. Consequently, you will need to include +[an additional polyfill](https://www.npmjs.com/package/yet-another-abortcontroller-polyfill) +for these APIs to abort fetches: + +```js +import 'yet-another-abortcontroller-polyfill' +import {fetch} from 'whatwg-fetch' + +// use native browser implementation if it supports aborting +const abortableFetch = ('signal' in new Request('')) ? window.fetch : fetch + +const controller = new AbortController() + +abortableFetch('/avatars', { + signal: controller.signal +}).catch(function(ex) { + if (ex.name === 'AbortError') { + console.log('request aborted') + } +}) + +// some time later... +controller.abort() +``` + +## Browser Support + +- Chrome +- Firefox +- Safari 6.1+ +- Internet Explorer 10+ + +Note: modern browsers such as Chrome, Firefox, Microsoft Edge, and Safari contain native +implementations of `window.fetch`, therefore the code from this polyfill doesn't +have any effect on those browsers. If you believe you've encountered an error +with how `window.fetch` is implemented in any of these browsers, you should file +an issue with that browser vendor instead of this project. + + + [fetch specification]: https://fetch.spec.whatwg.org + [cors]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS + "Cross-origin resource sharing" + [csrf]: https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)_Prevention_Cheat_Sheet + "Cross-site request forgery" + [forbidden header name]: https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name + [releases]: https://github.com/github/fetch/releases diff --git a/project starter code/node_modules/whatwg-fetch/dist/fetch.umd.js b/project starter code/node_modules/whatwg-fetch/dist/fetch.umd.js new file mode 100644 index 00000000..7a0d852f --- /dev/null +++ b/project starter code/node_modules/whatwg-fetch/dist/fetch.umd.js @@ -0,0 +1,657 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (factory((global.WHATWGFetch = {}))); +}(this, (function (exports) { 'use strict'; + + /* eslint-disable no-prototype-builtins */ + var g = + (typeof globalThis !== 'undefined' && globalThis) || + (typeof self !== 'undefined' && self) || + // eslint-disable-next-line no-undef + (typeof global !== 'undefined' && global) || + {}; + + var support = { + searchParams: 'URLSearchParams' in g, + iterable: 'Symbol' in g && 'iterator' in Symbol, + blob: + 'FileReader' in g && + 'Blob' in g && + (function() { + try { + new Blob(); + return true + } catch (e) { + return false + } + })(), + formData: 'FormData' in g, + arrayBuffer: 'ArrayBuffer' in g + }; + + function isDataView(obj) { + return obj && DataView.prototype.isPrototypeOf(obj) + } + + if (support.arrayBuffer) { + var viewClasses = [ + '[object Int8Array]', + '[object Uint8Array]', + '[object Uint8ClampedArray]', + '[object Int16Array]', + '[object Uint16Array]', + '[object Int32Array]', + '[object Uint32Array]', + '[object Float32Array]', + '[object Float64Array]' + ]; + + var isArrayBufferView = + ArrayBuffer.isView || + function(obj) { + return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1 + }; + } + + function normalizeName(name) { + if (typeof name !== 'string') { + name = String(name); + } + if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name) || name === '') { + throw new TypeError('Invalid character in header field name: "' + name + '"') + } + return name.toLowerCase() + } + + function normalizeValue(value) { + if (typeof value !== 'string') { + value = String(value); + } + return value + } + + // Build a destructive iterator for the value list + function iteratorFor(items) { + var iterator = { + next: function() { + var value = items.shift(); + return {done: value === undefined, value: value} + } + }; + + if (support.iterable) { + iterator[Symbol.iterator] = function() { + return iterator + }; + } + + return iterator + } + + function Headers(headers) { + this.map = {}; + + if (headers instanceof Headers) { + headers.forEach(function(value, name) { + this.append(name, value); + }, this); + } else if (Array.isArray(headers)) { + headers.forEach(function(header) { + if (header.length != 2) { + throw new TypeError('Headers constructor: expected name/value pair to be length 2, found' + header.length) + } + this.append(header[0], header[1]); + }, this); + } else if (headers) { + Object.getOwnPropertyNames(headers).forEach(function(name) { + this.append(name, headers[name]); + }, this); + } + } + + Headers.prototype.append = function(name, value) { + name = normalizeName(name); + value = normalizeValue(value); + var oldValue = this.map[name]; + this.map[name] = oldValue ? oldValue + ', ' + value : value; + }; + + Headers.prototype['delete'] = function(name) { + delete this.map[normalizeName(name)]; + }; + + Headers.prototype.get = function(name) { + name = normalizeName(name); + return this.has(name) ? this.map[name] : null + }; + + Headers.prototype.has = function(name) { + return this.map.hasOwnProperty(normalizeName(name)) + }; + + Headers.prototype.set = function(name, value) { + this.map[normalizeName(name)] = normalizeValue(value); + }; + + Headers.prototype.forEach = function(callback, thisArg) { + for (var name in this.map) { + if (this.map.hasOwnProperty(name)) { + callback.call(thisArg, this.map[name], name, this); + } + } + }; + + Headers.prototype.keys = function() { + var items = []; + this.forEach(function(value, name) { + items.push(name); + }); + return iteratorFor(items) + }; + + Headers.prototype.values = function() { + var items = []; + this.forEach(function(value) { + items.push(value); + }); + return iteratorFor(items) + }; + + Headers.prototype.entries = function() { + var items = []; + this.forEach(function(value, name) { + items.push([name, value]); + }); + return iteratorFor(items) + }; + + if (support.iterable) { + Headers.prototype[Symbol.iterator] = Headers.prototype.entries; + } + + function consumed(body) { + if (body._noBody) return + if (body.bodyUsed) { + return Promise.reject(new TypeError('Already read')) + } + body.bodyUsed = true; + } + + function fileReaderReady(reader) { + return new Promise(function(resolve, reject) { + reader.onload = function() { + resolve(reader.result); + }; + reader.onerror = function() { + reject(reader.error); + }; + }) + } + + function readBlobAsArrayBuffer(blob) { + var reader = new FileReader(); + var promise = fileReaderReady(reader); + reader.readAsArrayBuffer(blob); + return promise + } + + function readBlobAsText(blob) { + var reader = new FileReader(); + var promise = fileReaderReady(reader); + var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type); + var encoding = match ? match[1] : 'utf-8'; + reader.readAsText(blob, encoding); + return promise + } + + function readArrayBufferAsText(buf) { + var view = new Uint8Array(buf); + var chars = new Array(view.length); + + for (var i = 0; i < view.length; i++) { + chars[i] = String.fromCharCode(view[i]); + } + return chars.join('') + } + + function bufferClone(buf) { + if (buf.slice) { + return buf.slice(0) + } else { + var view = new Uint8Array(buf.byteLength); + view.set(new Uint8Array(buf)); + return view.buffer + } + } + + function Body() { + this.bodyUsed = false; + + this._initBody = function(body) { + /* + fetch-mock wraps the Response object in an ES6 Proxy to + provide useful test harness features such as flush. However, on + ES5 browsers without fetch or Proxy support pollyfills must be used; + the proxy-pollyfill is unable to proxy an attribute unless it exists + on the object before the Proxy is created. This change ensures + Response.bodyUsed exists on the instance, while maintaining the + semantic of setting Request.bodyUsed in the constructor before + _initBody is called. + */ + // eslint-disable-next-line no-self-assign + this.bodyUsed = this.bodyUsed; + this._bodyInit = body; + if (!body) { + this._noBody = true; + this._bodyText = ''; + } else if (typeof body === 'string') { + this._bodyText = body; + } else if (support.blob && Blob.prototype.isPrototypeOf(body)) { + this._bodyBlob = body; + } else if (support.formData && FormData.prototype.isPrototypeOf(body)) { + this._bodyFormData = body; + } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { + this._bodyText = body.toString(); + } else if (support.arrayBuffer && support.blob && isDataView(body)) { + this._bodyArrayBuffer = bufferClone(body.buffer); + // IE 10-11 can't handle a DataView body. + this._bodyInit = new Blob([this._bodyArrayBuffer]); + } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { + this._bodyArrayBuffer = bufferClone(body); + } else { + this._bodyText = body = Object.prototype.toString.call(body); + } + + if (!this.headers.get('content-type')) { + if (typeof body === 'string') { + this.headers.set('content-type', 'text/plain;charset=UTF-8'); + } else if (this._bodyBlob && this._bodyBlob.type) { + this.headers.set('content-type', this._bodyBlob.type); + } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { + this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8'); + } + } + }; + + if (support.blob) { + this.blob = function() { + var rejected = consumed(this); + if (rejected) { + return rejected + } + + if (this._bodyBlob) { + return Promise.resolve(this._bodyBlob) + } else if (this._bodyArrayBuffer) { + return Promise.resolve(new Blob([this._bodyArrayBuffer])) + } else if (this._bodyFormData) { + throw new Error('could not read FormData body as blob') + } else { + return Promise.resolve(new Blob([this._bodyText])) + } + }; + } + + this.arrayBuffer = function() { + if (this._bodyArrayBuffer) { + var isConsumed = consumed(this); + if (isConsumed) { + return isConsumed + } else if (ArrayBuffer.isView(this._bodyArrayBuffer)) { + return Promise.resolve( + this._bodyArrayBuffer.buffer.slice( + this._bodyArrayBuffer.byteOffset, + this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength + ) + ) + } else { + return Promise.resolve(this._bodyArrayBuffer) + } + } else if (support.blob) { + return this.blob().then(readBlobAsArrayBuffer) + } else { + throw new Error('could not read as ArrayBuffer') + } + }; + + this.text = function() { + var rejected = consumed(this); + if (rejected) { + return rejected + } + + if (this._bodyBlob) { + return readBlobAsText(this._bodyBlob) + } else if (this._bodyArrayBuffer) { + return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer)) + } else if (this._bodyFormData) { + throw new Error('could not read FormData body as text') + } else { + return Promise.resolve(this._bodyText) + } + }; + + if (support.formData) { + this.formData = function() { + return this.text().then(decode) + }; + } + + this.json = function() { + return this.text().then(JSON.parse) + }; + + return this + } + + // HTTP methods whose capitalization should be normalized + var methods = ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE']; + + function normalizeMethod(method) { + var upcased = method.toUpperCase(); + return methods.indexOf(upcased) > -1 ? upcased : method + } + + function Request(input, options) { + if (!(this instanceof Request)) { + throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.') + } + + options = options || {}; + var body = options.body; + + if (input instanceof Request) { + if (input.bodyUsed) { + throw new TypeError('Already read') + } + this.url = input.url; + this.credentials = input.credentials; + if (!options.headers) { + this.headers = new Headers(input.headers); + } + this.method = input.method; + this.mode = input.mode; + this.signal = input.signal; + if (!body && input._bodyInit != null) { + body = input._bodyInit; + input.bodyUsed = true; + } + } else { + this.url = String(input); + } + + this.credentials = options.credentials || this.credentials || 'same-origin'; + if (options.headers || !this.headers) { + this.headers = new Headers(options.headers); + } + this.method = normalizeMethod(options.method || this.method || 'GET'); + this.mode = options.mode || this.mode || null; + this.signal = options.signal || this.signal || (function () { + if ('AbortController' in g) { + var ctrl = new AbortController(); + return ctrl.signal; + } + }()); + this.referrer = null; + + if ((this.method === 'GET' || this.method === 'HEAD') && body) { + throw new TypeError('Body not allowed for GET or HEAD requests') + } + this._initBody(body); + + if (this.method === 'GET' || this.method === 'HEAD') { + if (options.cache === 'no-store' || options.cache === 'no-cache') { + // Search for a '_' parameter in the query string + var reParamSearch = /([?&])_=[^&]*/; + if (reParamSearch.test(this.url)) { + // If it already exists then set the value with the current time + this.url = this.url.replace(reParamSearch, '$1_=' + new Date().getTime()); + } else { + // Otherwise add a new '_' parameter to the end with the current time + var reQueryString = /\?/; + this.url += (reQueryString.test(this.url) ? '&' : '?') + '_=' + new Date().getTime(); + } + } + } + } + + Request.prototype.clone = function() { + return new Request(this, {body: this._bodyInit}) + }; + + function decode(body) { + var form = new FormData(); + body + .trim() + .split('&') + .forEach(function(bytes) { + if (bytes) { + var split = bytes.split('='); + var name = split.shift().replace(/\+/g, ' '); + var value = split.join('=').replace(/\+/g, ' '); + form.append(decodeURIComponent(name), decodeURIComponent(value)); + } + }); + return form + } + + function parseHeaders(rawHeaders) { + var headers = new Headers(); + // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space + // https://tools.ietf.org/html/rfc7230#section-3.2 + var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' '); + // Avoiding split via regex to work around a common IE11 bug with the core-js 3.6.0 regex polyfill + // https://github.com/github/fetch/issues/748 + // https://github.com/zloirock/core-js/issues/751 + preProcessedHeaders + .split('\r') + .map(function(header) { + return header.indexOf('\n') === 0 ? header.substr(1, header.length) : header + }) + .forEach(function(line) { + var parts = line.split(':'); + var key = parts.shift().trim(); + if (key) { + var value = parts.join(':').trim(); + try { + headers.append(key, value); + } catch (error) { + console.warn('Response ' + error.message); + } + } + }); + return headers + } + + Body.call(Request.prototype); + + function Response(bodyInit, options) { + if (!(this instanceof Response)) { + throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.') + } + if (!options) { + options = {}; + } + + this.type = 'default'; + this.status = options.status === undefined ? 200 : options.status; + if (this.status < 200 || this.status > 599) { + throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].") + } + this.ok = this.status >= 200 && this.status < 300; + this.statusText = options.statusText === undefined ? '' : '' + options.statusText; + this.headers = new Headers(options.headers); + this.url = options.url || ''; + this._initBody(bodyInit); + } + + Body.call(Response.prototype); + + Response.prototype.clone = function() { + return new Response(this._bodyInit, { + status: this.status, + statusText: this.statusText, + headers: new Headers(this.headers), + url: this.url + }) + }; + + Response.error = function() { + var response = new Response(null, {status: 200, statusText: ''}); + response.ok = false; + response.status = 0; + response.type = 'error'; + return response + }; + + var redirectStatuses = [301, 302, 303, 307, 308]; + + Response.redirect = function(url, status) { + if (redirectStatuses.indexOf(status) === -1) { + throw new RangeError('Invalid status code') + } + + return new Response(null, {status: status, headers: {location: url}}) + }; + + exports.DOMException = g.DOMException; + try { + new exports.DOMException(); + } catch (err) { + exports.DOMException = function(message, name) { + this.message = message; + this.name = name; + var error = Error(message); + this.stack = error.stack; + }; + exports.DOMException.prototype = Object.create(Error.prototype); + exports.DOMException.prototype.constructor = exports.DOMException; + } + + function fetch(input, init) { + return new Promise(function(resolve, reject) { + var request = new Request(input, init); + + if (request.signal && request.signal.aborted) { + return reject(new exports.DOMException('Aborted', 'AbortError')) + } + + var xhr = new XMLHttpRequest(); + + function abortXhr() { + xhr.abort(); + } + + xhr.onload = function() { + var options = { + statusText: xhr.statusText, + headers: parseHeaders(xhr.getAllResponseHeaders() || '') + }; + // This check if specifically for when a user fetches a file locally from the file system + // Only if the status is out of a normal range + if (request.url.indexOf('file://') === 0 && (xhr.status < 200 || xhr.status > 599)) { + options.status = 200; + } else { + options.status = xhr.status; + } + options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL'); + var body = 'response' in xhr ? xhr.response : xhr.responseText; + setTimeout(function() { + resolve(new Response(body, options)); + }, 0); + }; + + xhr.onerror = function() { + setTimeout(function() { + reject(new TypeError('Network request failed')); + }, 0); + }; + + xhr.ontimeout = function() { + setTimeout(function() { + reject(new TypeError('Network request timed out')); + }, 0); + }; + + xhr.onabort = function() { + setTimeout(function() { + reject(new exports.DOMException('Aborted', 'AbortError')); + }, 0); + }; + + function fixUrl(url) { + try { + return url === '' && g.location.href ? g.location.href : url + } catch (e) { + return url + } + } + + xhr.open(request.method, fixUrl(request.url), true); + + if (request.credentials === 'include') { + xhr.withCredentials = true; + } else if (request.credentials === 'omit') { + xhr.withCredentials = false; + } + + if ('responseType' in xhr) { + if (support.blob) { + xhr.responseType = 'blob'; + } else if ( + support.arrayBuffer + ) { + xhr.responseType = 'arraybuffer'; + } + } + + if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers || (g.Headers && init.headers instanceof g.Headers))) { + var names = []; + Object.getOwnPropertyNames(init.headers).forEach(function(name) { + names.push(normalizeName(name)); + xhr.setRequestHeader(name, normalizeValue(init.headers[name])); + }); + request.headers.forEach(function(value, name) { + if (names.indexOf(name) === -1) { + xhr.setRequestHeader(name, value); + } + }); + } else { + request.headers.forEach(function(value, name) { + xhr.setRequestHeader(name, value); + }); + } + + if (request.signal) { + request.signal.addEventListener('abort', abortXhr); + + xhr.onreadystatechange = function() { + // DONE (success or failure) + if (xhr.readyState === 4) { + request.signal.removeEventListener('abort', abortXhr); + } + }; + } + + xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit); + }) + } + + fetch.polyfill = true; + + if (!g.fetch) { + g.fetch = fetch; + g.Headers = Headers; + g.Request = Request; + g.Response = Response; + } + + exports.Headers = Headers; + exports.Request = Request; + exports.Response = Response; + exports.fetch = fetch; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/project starter code/node_modules/whatwg-fetch/dist/fetch.umd.js.flow b/project starter code/node_modules/whatwg-fetch/dist/fetch.umd.js.flow new file mode 100644 index 00000000..7949905f --- /dev/null +++ b/project starter code/node_modules/whatwg-fetch/dist/fetch.umd.js.flow @@ -0,0 +1,119 @@ +/* @flow strict */ + +type CredentialsType = 'omit' | 'same-origin' | 'include' + +type ResponseType = 'default' | 'error' + +type BodyInit = string | URLSearchParams | FormData | Blob | ArrayBuffer | $ArrayBufferView + +type RequestInfo = Request | URL | string + +type RequestOptions = {| + body?: ?BodyInit; + + credentials?: CredentialsType; + headers?: HeadersInit; + method?: string; + mode?: string; + referrer?: string; + signal?: ?AbortSignal; +|} + +type ResponseOptions = {| + status?: number; + statusText?: string; + headers?: HeadersInit; +|} + +type HeadersInit = Headers | {[string]: string} + +// https://github.com/facebook/flow/blob/f68b89a5012bd995ab3509e7a41b7325045c4045/lib/bom.js#L902-L914 +declare class Headers { + @@iterator(): Iterator<[string, string]>; + constructor(init?: HeadersInit): void; + append(name: string, value: string): void; + delete(name: string): void; + entries(): Iterator<[string, string]>; + forEach((value: string, name: string, headers: Headers) => any, thisArg?: any): void; + get(name: string): null | string; + has(name: string): boolean; + keys(): Iterator; + set(name: string, value: string): void; + values(): Iterator; +} + +// https://github.com/facebook/flow/pull/6548 +interface AbortSignal { + aborted: boolean; + addEventListener(type: string, listener: (Event) => mixed, options?: EventListenerOptionsOrUseCapture): void; + removeEventListener(type: string, listener: (Event) => mixed, options?: EventListenerOptionsOrUseCapture): void; +} + +// https://github.com/facebook/flow/blob/f68b89a5012bd995ab3509e7a41b7325045c4045/lib/bom.js#L994-L1018 +// unsupported in polyfill: +// - cache +// - integrity +// - redirect +// - referrerPolicy +declare class Request { + constructor(input: RequestInfo, init?: RequestOptions): void; + clone(): Request; + + url: string; + + credentials: CredentialsType; + headers: Headers; + method: string; + mode: ModeType; + referrer: string; + signal: ?AbortSignal; + + // Body methods and attributes + bodyUsed: boolean; + + arrayBuffer(): Promise; + blob(): Promise; + formData(): Promise; + json(): Promise; + text(): Promise; +} + +// https://github.com/facebook/flow/blob/f68b89a5012bd995ab3509e7a41b7325045c4045/lib/bom.js#L968-L992 +// unsupported in polyfill: +// - body +// - redirected +// - trailer +declare class Response { + constructor(input?: ?BodyInit, init?: ResponseOptions): void; + clone(): Response; + static error(): Response; + static redirect(url: string, status?: number): Response; + + type: ResponseType; + url: string; + ok: boolean; + status: number; + statusText: string; + headers: Headers; + + // Body methods and attributes + bodyUsed: boolean; + + arrayBuffer(): Promise; + blob(): Promise; + formData(): Promise; + json(): Promise; + text(): Promise; +} + +declare class DOMException extends Error { + constructor(message?: string, name?: string): void; +} + +declare module.exports: { + fetch(input: RequestInfo, init?: RequestOptions): Promise; + Headers: typeof Headers; + Request: typeof Request; + Response: typeof Response; + DOMException: typeof DOMException; +} diff --git a/project starter code/node_modules/whatwg-fetch/fetch.js b/project starter code/node_modules/whatwg-fetch/fetch.js new file mode 100644 index 00000000..f39a983a --- /dev/null +++ b/project starter code/node_modules/whatwg-fetch/fetch.js @@ -0,0 +1,642 @@ +/* eslint-disable no-prototype-builtins */ +var g = + (typeof globalThis !== 'undefined' && globalThis) || + (typeof self !== 'undefined' && self) || + // eslint-disable-next-line no-undef + (typeof global !== 'undefined' && global) || + {} + +var support = { + searchParams: 'URLSearchParams' in g, + iterable: 'Symbol' in g && 'iterator' in Symbol, + blob: + 'FileReader' in g && + 'Blob' in g && + (function() { + try { + new Blob() + return true + } catch (e) { + return false + } + })(), + formData: 'FormData' in g, + arrayBuffer: 'ArrayBuffer' in g +} + +function isDataView(obj) { + return obj && DataView.prototype.isPrototypeOf(obj) +} + +if (support.arrayBuffer) { + var viewClasses = [ + '[object Int8Array]', + '[object Uint8Array]', + '[object Uint8ClampedArray]', + '[object Int16Array]', + '[object Uint16Array]', + '[object Int32Array]', + '[object Uint32Array]', + '[object Float32Array]', + '[object Float64Array]' + ] + + var isArrayBufferView = + ArrayBuffer.isView || + function(obj) { + return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1 + } +} + +function normalizeName(name) { + if (typeof name !== 'string') { + name = String(name) + } + if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name) || name === '') { + throw new TypeError('Invalid character in header field name: "' + name + '"') + } + return name.toLowerCase() +} + +function normalizeValue(value) { + if (typeof value !== 'string') { + value = String(value) + } + return value +} + +// Build a destructive iterator for the value list +function iteratorFor(items) { + var iterator = { + next: function() { + var value = items.shift() + return {done: value === undefined, value: value} + } + } + + if (support.iterable) { + iterator[Symbol.iterator] = function() { + return iterator + } + } + + return iterator +} + +export function Headers(headers) { + this.map = {} + + if (headers instanceof Headers) { + headers.forEach(function(value, name) { + this.append(name, value) + }, this) + } else if (Array.isArray(headers)) { + headers.forEach(function(header) { + if (header.length != 2) { + throw new TypeError('Headers constructor: expected name/value pair to be length 2, found' + header.length) + } + this.append(header[0], header[1]) + }, this) + } else if (headers) { + Object.getOwnPropertyNames(headers).forEach(function(name) { + this.append(name, headers[name]) + }, this) + } +} + +Headers.prototype.append = function(name, value) { + name = normalizeName(name) + value = normalizeValue(value) + var oldValue = this.map[name] + this.map[name] = oldValue ? oldValue + ', ' + value : value +} + +Headers.prototype['delete'] = function(name) { + delete this.map[normalizeName(name)] +} + +Headers.prototype.get = function(name) { + name = normalizeName(name) + return this.has(name) ? this.map[name] : null +} + +Headers.prototype.has = function(name) { + return this.map.hasOwnProperty(normalizeName(name)) +} + +Headers.prototype.set = function(name, value) { + this.map[normalizeName(name)] = normalizeValue(value) +} + +Headers.prototype.forEach = function(callback, thisArg) { + for (var name in this.map) { + if (this.map.hasOwnProperty(name)) { + callback.call(thisArg, this.map[name], name, this) + } + } +} + +Headers.prototype.keys = function() { + var items = [] + this.forEach(function(value, name) { + items.push(name) + }) + return iteratorFor(items) +} + +Headers.prototype.values = function() { + var items = [] + this.forEach(function(value) { + items.push(value) + }) + return iteratorFor(items) +} + +Headers.prototype.entries = function() { + var items = [] + this.forEach(function(value, name) { + items.push([name, value]) + }) + return iteratorFor(items) +} + +if (support.iterable) { + Headers.prototype[Symbol.iterator] = Headers.prototype.entries +} + +function consumed(body) { + if (body._noBody) return + if (body.bodyUsed) { + return Promise.reject(new TypeError('Already read')) + } + body.bodyUsed = true +} + +function fileReaderReady(reader) { + return new Promise(function(resolve, reject) { + reader.onload = function() { + resolve(reader.result) + } + reader.onerror = function() { + reject(reader.error) + } + }) +} + +function readBlobAsArrayBuffer(blob) { + var reader = new FileReader() + var promise = fileReaderReady(reader) + reader.readAsArrayBuffer(blob) + return promise +} + +function readBlobAsText(blob) { + var reader = new FileReader() + var promise = fileReaderReady(reader) + var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type) + var encoding = match ? match[1] : 'utf-8' + reader.readAsText(blob, encoding) + return promise +} + +function readArrayBufferAsText(buf) { + var view = new Uint8Array(buf) + var chars = new Array(view.length) + + for (var i = 0; i < view.length; i++) { + chars[i] = String.fromCharCode(view[i]) + } + return chars.join('') +} + +function bufferClone(buf) { + if (buf.slice) { + return buf.slice(0) + } else { + var view = new Uint8Array(buf.byteLength) + view.set(new Uint8Array(buf)) + return view.buffer + } +} + +function Body() { + this.bodyUsed = false + + this._initBody = function(body) { + /* + fetch-mock wraps the Response object in an ES6 Proxy to + provide useful test harness features such as flush. However, on + ES5 browsers without fetch or Proxy support pollyfills must be used; + the proxy-pollyfill is unable to proxy an attribute unless it exists + on the object before the Proxy is created. This change ensures + Response.bodyUsed exists on the instance, while maintaining the + semantic of setting Request.bodyUsed in the constructor before + _initBody is called. + */ + // eslint-disable-next-line no-self-assign + this.bodyUsed = this.bodyUsed + this._bodyInit = body + if (!body) { + this._noBody = true; + this._bodyText = '' + } else if (typeof body === 'string') { + this._bodyText = body + } else if (support.blob && Blob.prototype.isPrototypeOf(body)) { + this._bodyBlob = body + } else if (support.formData && FormData.prototype.isPrototypeOf(body)) { + this._bodyFormData = body + } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { + this._bodyText = body.toString() + } else if (support.arrayBuffer && support.blob && isDataView(body)) { + this._bodyArrayBuffer = bufferClone(body.buffer) + // IE 10-11 can't handle a DataView body. + this._bodyInit = new Blob([this._bodyArrayBuffer]) + } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { + this._bodyArrayBuffer = bufferClone(body) + } else { + this._bodyText = body = Object.prototype.toString.call(body) + } + + if (!this.headers.get('content-type')) { + if (typeof body === 'string') { + this.headers.set('content-type', 'text/plain;charset=UTF-8') + } else if (this._bodyBlob && this._bodyBlob.type) { + this.headers.set('content-type', this._bodyBlob.type) + } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { + this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8') + } + } + } + + if (support.blob) { + this.blob = function() { + var rejected = consumed(this) + if (rejected) { + return rejected + } + + if (this._bodyBlob) { + return Promise.resolve(this._bodyBlob) + } else if (this._bodyArrayBuffer) { + return Promise.resolve(new Blob([this._bodyArrayBuffer])) + } else if (this._bodyFormData) { + throw new Error('could not read FormData body as blob') + } else { + return Promise.resolve(new Blob([this._bodyText])) + } + } + } + + this.arrayBuffer = function() { + if (this._bodyArrayBuffer) { + var isConsumed = consumed(this) + if (isConsumed) { + return isConsumed + } else if (ArrayBuffer.isView(this._bodyArrayBuffer)) { + return Promise.resolve( + this._bodyArrayBuffer.buffer.slice( + this._bodyArrayBuffer.byteOffset, + this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength + ) + ) + } else { + return Promise.resolve(this._bodyArrayBuffer) + } + } else if (support.blob) { + return this.blob().then(readBlobAsArrayBuffer) + } else { + throw new Error('could not read as ArrayBuffer') + } + } + + this.text = function() { + var rejected = consumed(this) + if (rejected) { + return rejected + } + + if (this._bodyBlob) { + return readBlobAsText(this._bodyBlob) + } else if (this._bodyArrayBuffer) { + return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer)) + } else if (this._bodyFormData) { + throw new Error('could not read FormData body as text') + } else { + return Promise.resolve(this._bodyText) + } + } + + if (support.formData) { + this.formData = function() { + return this.text().then(decode) + } + } + + this.json = function() { + return this.text().then(JSON.parse) + } + + return this +} + +// HTTP methods whose capitalization should be normalized +var methods = ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'] + +function normalizeMethod(method) { + var upcased = method.toUpperCase() + return methods.indexOf(upcased) > -1 ? upcased : method +} + +export function Request(input, options) { + if (!(this instanceof Request)) { + throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.') + } + + options = options || {} + var body = options.body + + if (input instanceof Request) { + if (input.bodyUsed) { + throw new TypeError('Already read') + } + this.url = input.url + this.credentials = input.credentials + if (!options.headers) { + this.headers = new Headers(input.headers) + } + this.method = input.method + this.mode = input.mode + this.signal = input.signal + if (!body && input._bodyInit != null) { + body = input._bodyInit + input.bodyUsed = true + } + } else { + this.url = String(input) + } + + this.credentials = options.credentials || this.credentials || 'same-origin' + if (options.headers || !this.headers) { + this.headers = new Headers(options.headers) + } + this.method = normalizeMethod(options.method || this.method || 'GET') + this.mode = options.mode || this.mode || null + this.signal = options.signal || this.signal || (function () { + if ('AbortController' in g) { + var ctrl = new AbortController(); + return ctrl.signal; + } + }()); + this.referrer = null + + if ((this.method === 'GET' || this.method === 'HEAD') && body) { + throw new TypeError('Body not allowed for GET or HEAD requests') + } + this._initBody(body) + + if (this.method === 'GET' || this.method === 'HEAD') { + if (options.cache === 'no-store' || options.cache === 'no-cache') { + // Search for a '_' parameter in the query string + var reParamSearch = /([?&])_=[^&]*/ + if (reParamSearch.test(this.url)) { + // If it already exists then set the value with the current time + this.url = this.url.replace(reParamSearch, '$1_=' + new Date().getTime()) + } else { + // Otherwise add a new '_' parameter to the end with the current time + var reQueryString = /\?/ + this.url += (reQueryString.test(this.url) ? '&' : '?') + '_=' + new Date().getTime() + } + } + } +} + +Request.prototype.clone = function() { + return new Request(this, {body: this._bodyInit}) +} + +function decode(body) { + var form = new FormData() + body + .trim() + .split('&') + .forEach(function(bytes) { + if (bytes) { + var split = bytes.split('=') + var name = split.shift().replace(/\+/g, ' ') + var value = split.join('=').replace(/\+/g, ' ') + form.append(decodeURIComponent(name), decodeURIComponent(value)) + } + }) + return form +} + +function parseHeaders(rawHeaders) { + var headers = new Headers() + // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space + // https://tools.ietf.org/html/rfc7230#section-3.2 + var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ') + // Avoiding split via regex to work around a common IE11 bug with the core-js 3.6.0 regex polyfill + // https://github.com/github/fetch/issues/748 + // https://github.com/zloirock/core-js/issues/751 + preProcessedHeaders + .split('\r') + .map(function(header) { + return header.indexOf('\n') === 0 ? header.substr(1, header.length) : header + }) + .forEach(function(line) { + var parts = line.split(':') + var key = parts.shift().trim() + if (key) { + var value = parts.join(':').trim() + try { + headers.append(key, value) + } catch (error) { + console.warn('Response ' + error.message) + } + } + }) + return headers +} + +Body.call(Request.prototype) + +export function Response(bodyInit, options) { + if (!(this instanceof Response)) { + throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.') + } + if (!options) { + options = {} + } + + this.type = 'default' + this.status = options.status === undefined ? 200 : options.status + if (this.status < 200 || this.status > 599) { + throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].") + } + this.ok = this.status >= 200 && this.status < 300 + this.statusText = options.statusText === undefined ? '' : '' + options.statusText + this.headers = new Headers(options.headers) + this.url = options.url || '' + this._initBody(bodyInit) +} + +Body.call(Response.prototype) + +Response.prototype.clone = function() { + return new Response(this._bodyInit, { + status: this.status, + statusText: this.statusText, + headers: new Headers(this.headers), + url: this.url + }) +} + +Response.error = function() { + var response = new Response(null, {status: 200, statusText: ''}) + response.ok = false + response.status = 0 + response.type = 'error' + return response +} + +var redirectStatuses = [301, 302, 303, 307, 308] + +Response.redirect = function(url, status) { + if (redirectStatuses.indexOf(status) === -1) { + throw new RangeError('Invalid status code') + } + + return new Response(null, {status: status, headers: {location: url}}) +} + +export var DOMException = g.DOMException +try { + new DOMException() +} catch (err) { + DOMException = function(message, name) { + this.message = message + this.name = name + var error = Error(message) + this.stack = error.stack + } + DOMException.prototype = Object.create(Error.prototype) + DOMException.prototype.constructor = DOMException +} + +export function fetch(input, init) { + return new Promise(function(resolve, reject) { + var request = new Request(input, init) + + if (request.signal && request.signal.aborted) { + return reject(new DOMException('Aborted', 'AbortError')) + } + + var xhr = new XMLHttpRequest() + + function abortXhr() { + xhr.abort() + } + + xhr.onload = function() { + var options = { + statusText: xhr.statusText, + headers: parseHeaders(xhr.getAllResponseHeaders() || '') + } + // This check if specifically for when a user fetches a file locally from the file system + // Only if the status is out of a normal range + if (request.url.indexOf('file://') === 0 && (xhr.status < 200 || xhr.status > 599)) { + options.status = 200; + } else { + options.status = xhr.status; + } + options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL') + var body = 'response' in xhr ? xhr.response : xhr.responseText + setTimeout(function() { + resolve(new Response(body, options)) + }, 0) + } + + xhr.onerror = function() { + setTimeout(function() { + reject(new TypeError('Network request failed')) + }, 0) + } + + xhr.ontimeout = function() { + setTimeout(function() { + reject(new TypeError('Network request timed out')) + }, 0) + } + + xhr.onabort = function() { + setTimeout(function() { + reject(new DOMException('Aborted', 'AbortError')) + }, 0) + } + + function fixUrl(url) { + try { + return url === '' && g.location.href ? g.location.href : url + } catch (e) { + return url + } + } + + xhr.open(request.method, fixUrl(request.url), true) + + if (request.credentials === 'include') { + xhr.withCredentials = true + } else if (request.credentials === 'omit') { + xhr.withCredentials = false + } + + if ('responseType' in xhr) { + if (support.blob) { + xhr.responseType = 'blob' + } else if ( + support.arrayBuffer + ) { + xhr.responseType = 'arraybuffer' + } + } + + if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers || (g.Headers && init.headers instanceof g.Headers))) { + var names = []; + Object.getOwnPropertyNames(init.headers).forEach(function(name) { + names.push(normalizeName(name)) + xhr.setRequestHeader(name, normalizeValue(init.headers[name])) + }) + request.headers.forEach(function(value, name) { + if (names.indexOf(name) === -1) { + xhr.setRequestHeader(name, value) + } + }) + } else { + request.headers.forEach(function(value, name) { + xhr.setRequestHeader(name, value) + }) + } + + if (request.signal) { + request.signal.addEventListener('abort', abortXhr) + + xhr.onreadystatechange = function() { + // DONE (success or failure) + if (xhr.readyState === 4) { + request.signal.removeEventListener('abort', abortXhr) + } + } + } + + xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit) + }) +} + +fetch.polyfill = true + +if (!g.fetch) { + g.fetch = fetch + g.Headers = Headers + g.Request = Request + g.Response = Response +} diff --git a/project starter code/node_modules/whatwg-fetch/fetch.js.flow b/project starter code/node_modules/whatwg-fetch/fetch.js.flow new file mode 100644 index 00000000..7949905f --- /dev/null +++ b/project starter code/node_modules/whatwg-fetch/fetch.js.flow @@ -0,0 +1,119 @@ +/* @flow strict */ + +type CredentialsType = 'omit' | 'same-origin' | 'include' + +type ResponseType = 'default' | 'error' + +type BodyInit = string | URLSearchParams | FormData | Blob | ArrayBuffer | $ArrayBufferView + +type RequestInfo = Request | URL | string + +type RequestOptions = {| + body?: ?BodyInit; + + credentials?: CredentialsType; + headers?: HeadersInit; + method?: string; + mode?: string; + referrer?: string; + signal?: ?AbortSignal; +|} + +type ResponseOptions = {| + status?: number; + statusText?: string; + headers?: HeadersInit; +|} + +type HeadersInit = Headers | {[string]: string} + +// https://github.com/facebook/flow/blob/f68b89a5012bd995ab3509e7a41b7325045c4045/lib/bom.js#L902-L914 +declare class Headers { + @@iterator(): Iterator<[string, string]>; + constructor(init?: HeadersInit): void; + append(name: string, value: string): void; + delete(name: string): void; + entries(): Iterator<[string, string]>; + forEach((value: string, name: string, headers: Headers) => any, thisArg?: any): void; + get(name: string): null | string; + has(name: string): boolean; + keys(): Iterator; + set(name: string, value: string): void; + values(): Iterator; +} + +// https://github.com/facebook/flow/pull/6548 +interface AbortSignal { + aborted: boolean; + addEventListener(type: string, listener: (Event) => mixed, options?: EventListenerOptionsOrUseCapture): void; + removeEventListener(type: string, listener: (Event) => mixed, options?: EventListenerOptionsOrUseCapture): void; +} + +// https://github.com/facebook/flow/blob/f68b89a5012bd995ab3509e7a41b7325045c4045/lib/bom.js#L994-L1018 +// unsupported in polyfill: +// - cache +// - integrity +// - redirect +// - referrerPolicy +declare class Request { + constructor(input: RequestInfo, init?: RequestOptions): void; + clone(): Request; + + url: string; + + credentials: CredentialsType; + headers: Headers; + method: string; + mode: ModeType; + referrer: string; + signal: ?AbortSignal; + + // Body methods and attributes + bodyUsed: boolean; + + arrayBuffer(): Promise; + blob(): Promise; + formData(): Promise; + json(): Promise; + text(): Promise; +} + +// https://github.com/facebook/flow/blob/f68b89a5012bd995ab3509e7a41b7325045c4045/lib/bom.js#L968-L992 +// unsupported in polyfill: +// - body +// - redirected +// - trailer +declare class Response { + constructor(input?: ?BodyInit, init?: ResponseOptions): void; + clone(): Response; + static error(): Response; + static redirect(url: string, status?: number): Response; + + type: ResponseType; + url: string; + ok: boolean; + status: number; + statusText: string; + headers: Headers; + + // Body methods and attributes + bodyUsed: boolean; + + arrayBuffer(): Promise; + blob(): Promise; + formData(): Promise; + json(): Promise; + text(): Promise; +} + +declare class DOMException extends Error { + constructor(message?: string, name?: string): void; +} + +declare module.exports: { + fetch(input: RequestInfo, init?: RequestOptions): Promise; + Headers: typeof Headers; + Request: typeof Request; + Response: typeof Response; + DOMException: typeof DOMException; +} diff --git a/project starter code/node_modules/whatwg-fetch/package.json b/project starter code/node_modules/whatwg-fetch/package.json new file mode 100644 index 00000000..a1be1f72 --- /dev/null +++ b/project starter code/node_modules/whatwg-fetch/package.json @@ -0,0 +1,42 @@ +{ + "name": "whatwg-fetch", + "description": "A window.fetch polyfill.", + "version": "3.6.20", + "main": "./dist/fetch.umd.js", + "module": "./fetch.js", + "repository": "github/fetch", + "license": "MIT", + "devDependencies": { + "abortcontroller-polyfill": "^1.1.9", + "auto-changelog": "^2.4.0", + "chai": "^4.1.2", + "eslint": "^7.20.0", + "karma": "^3.0.0", + "karma-chai": "^0.1.0", + "karma-chrome-launcher": "^2.2.0", + "karma-detect-browsers": "^2.3.2", + "karma-firefox-launcher": "^1.1.0", + "karma-mocha": "^1.3.0", + "karma-safari-launcher": "^1.0.0", + "karma-safaritechpreview-launcher": "0.0.6", + "mocha": "^4.0.1", + "prettier": "^1.19.1", + "promise-polyfill": "6.0.2", + "rollup": "^0.59.1", + "url-search-params": "0.6.1" + }, + "files": [ + "LICENSE", + "dist/fetch.umd.js", + "dist/fetch.umd.js.flow", + "fetch.js", + "fetch.js.flow" + ], + "scripts": { + "karma": "karma start ./test/karma.config.js --no-single-run --auto-watch", + "prepare": "make dist/fetch.umd.js dist/fetch.umd.js.flow", + "pretest": "make", + "test": "karma start ./test/karma.config.js && karma start ./test/karma-worker.config.js", + "version": "auto-changelog -p && git add CHANGELOG.md" + } +} diff --git a/project starter code/node_modules/whatwg-url/LICENSE.txt b/project starter code/node_modules/whatwg-url/LICENSE.txt new file mode 100644 index 00000000..54dfac39 --- /dev/null +++ b/project starter code/node_modules/whatwg-url/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015–2016 Sebastian Mayr + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/project starter code/node_modules/whatwg-url/README.md b/project starter code/node_modules/whatwg-url/README.md new file mode 100644 index 00000000..4347a7fc --- /dev/null +++ b/project starter code/node_modules/whatwg-url/README.md @@ -0,0 +1,67 @@ +# whatwg-url + +whatwg-url is a full implementation of the WHATWG [URL Standard](https://url.spec.whatwg.org/). It can be used standalone, but it also exposes a lot of the internal algorithms that are useful for integrating a URL parser into a project like [jsdom](https://github.com/tmpvar/jsdom). + +## Current Status + +whatwg-url is currently up to date with the URL spec up to commit [a62223](https://github.com/whatwg/url/commit/a622235308342c9adc7fc2fd1659ff059f7d5e2a). + +## API + +### The `URL` Constructor + +The main API is the [`URL`](https://url.spec.whatwg.org/#url) export, which follows the spec's behavior in all ways (including e.g. `USVString` conversion). Most consumers of this library will want to use this. + +### Low-level URL Standard API + +The following methods are exported for use by places like jsdom that need to implement things like [`HTMLHyperlinkElementUtils`](https://html.spec.whatwg.org/#htmlhyperlinkelementutils). They operate on or return an "internal URL" or ["URL record"](https://url.spec.whatwg.org/#concept-url) type. + +- [URL parser](https://url.spec.whatwg.org/#concept-url-parser): `parseURL(input, { baseURL, encodingOverride })` +- [Basic URL parser](https://url.spec.whatwg.org/#concept-basic-url-parser): `basicURLParse(input, { baseURL, encodingOverride, url, stateOverride })` +- [URL serializer](https://url.spec.whatwg.org/#concept-url-serializer): `serializeURL(urlRecord, excludeFragment)` +- [Host serializer](https://url.spec.whatwg.org/#concept-host-serializer): `serializeHost(hostFromURLRecord)` +- [Serialize an integer](https://url.spec.whatwg.org/#serialize-an-integer): `serializeInteger(number)` +- [Origin](https://url.spec.whatwg.org/#concept-url-origin) [serializer](https://html.spec.whatwg.org/multipage/browsers.html#serialization-of-an-origin): `serializeURLOrigin(urlRecord)` +- [Set the username](https://url.spec.whatwg.org/#set-the-username): `setTheUsername(urlRecord, usernameString)` +- [Set the password](https://url.spec.whatwg.org/#set-the-password): `setThePassword(urlRecord, passwordString)` +- [Cannot have a username/password/port](https://url.spec.whatwg.org/#cannot-have-a-username-password-port): `cannotHaveAUsernamePasswordPort(urlRecord)` + +The `stateOverride` parameter is one of the following strings: + +- [`"scheme start"`](https://url.spec.whatwg.org/#scheme-start-state) +- [`"scheme"`](https://url.spec.whatwg.org/#scheme-state) +- [`"no scheme"`](https://url.spec.whatwg.org/#no-scheme-state) +- [`"special relative or authority"`](https://url.spec.whatwg.org/#special-relative-or-authority-state) +- [`"path or authority"`](https://url.spec.whatwg.org/#path-or-authority-state) +- [`"relative"`](https://url.spec.whatwg.org/#relative-state) +- [`"relative slash"`](https://url.spec.whatwg.org/#relative-slash-state) +- [`"special authority slashes"`](https://url.spec.whatwg.org/#special-authority-slashes-state) +- [`"special authority ignore slashes"`](https://url.spec.whatwg.org/#special-authority-ignore-slashes-state) +- [`"authority"`](https://url.spec.whatwg.org/#authority-state) +- [`"host"`](https://url.spec.whatwg.org/#host-state) +- [`"hostname"`](https://url.spec.whatwg.org/#hostname-state) +- [`"port"`](https://url.spec.whatwg.org/#port-state) +- [`"file"`](https://url.spec.whatwg.org/#file-state) +- [`"file slash"`](https://url.spec.whatwg.org/#file-slash-state) +- [`"file host"`](https://url.spec.whatwg.org/#file-host-state) +- [`"path start"`](https://url.spec.whatwg.org/#path-start-state) +- [`"path"`](https://url.spec.whatwg.org/#path-state) +- [`"cannot-be-a-base-URL path"`](https://url.spec.whatwg.org/#cannot-be-a-base-url-path-state) +- [`"query"`](https://url.spec.whatwg.org/#query-state) +- [`"fragment"`](https://url.spec.whatwg.org/#fragment-state) + +The URL record type has the following API: + +- [`scheme`](https://url.spec.whatwg.org/#concept-url-scheme) +- [`username`](https://url.spec.whatwg.org/#concept-url-username) +- [`password`](https://url.spec.whatwg.org/#concept-url-password) +- [`host`](https://url.spec.whatwg.org/#concept-url-host) +- [`port`](https://url.spec.whatwg.org/#concept-url-port) +- [`path`](https://url.spec.whatwg.org/#concept-url-path) (as an array) +- [`query`](https://url.spec.whatwg.org/#concept-url-query) +- [`fragment`](https://url.spec.whatwg.org/#concept-url-fragment) +- [`cannotBeABaseURL`](https://url.spec.whatwg.org/#url-cannot-be-a-base-url-flag) (as a boolean) + +These properties should be treated with care, as in general changing them will cause the URL record to be in an inconsistent state until the appropriate invocation of `basicURLParse` is used to fix it up. You can see examples of this in the URL Standard, where there are many step sequences like "4. Set context object’s url’s fragment to the empty string. 5. Basic URL parse _input_ with context object’s url as _url_ and fragment state as _state override_." In between those two steps, a URL record is in an unusable state. + +The return value of "failure" in the spec is represented by the string `"failure"`. That is, functions like `parseURL` and `basicURLParse` can return _either_ a URL record _or_ the string `"failure"`. diff --git a/project starter code/node_modules/whatwg-url/lib/URL-impl.js b/project starter code/node_modules/whatwg-url/lib/URL-impl.js new file mode 100644 index 00000000..dc7452cc --- /dev/null +++ b/project starter code/node_modules/whatwg-url/lib/URL-impl.js @@ -0,0 +1,200 @@ +"use strict"; +const usm = require("./url-state-machine"); + +exports.implementation = class URLImpl { + constructor(constructorArgs) { + const url = constructorArgs[0]; + const base = constructorArgs[1]; + + let parsedBase = null; + if (base !== undefined) { + parsedBase = usm.basicURLParse(base); + if (parsedBase === "failure") { + throw new TypeError("Invalid base URL"); + } + } + + const parsedURL = usm.basicURLParse(url, { baseURL: parsedBase }); + if (parsedURL === "failure") { + throw new TypeError("Invalid URL"); + } + + this._url = parsedURL; + + // TODO: query stuff + } + + get href() { + return usm.serializeURL(this._url); + } + + set href(v) { + const parsedURL = usm.basicURLParse(v); + if (parsedURL === "failure") { + throw new TypeError("Invalid URL"); + } + + this._url = parsedURL; + } + + get origin() { + return usm.serializeURLOrigin(this._url); + } + + get protocol() { + return this._url.scheme + ":"; + } + + set protocol(v) { + usm.basicURLParse(v + ":", { url: this._url, stateOverride: "scheme start" }); + } + + get username() { + return this._url.username; + } + + set username(v) { + if (usm.cannotHaveAUsernamePasswordPort(this._url)) { + return; + } + + usm.setTheUsername(this._url, v); + } + + get password() { + return this._url.password; + } + + set password(v) { + if (usm.cannotHaveAUsernamePasswordPort(this._url)) { + return; + } + + usm.setThePassword(this._url, v); + } + + get host() { + const url = this._url; + + if (url.host === null) { + return ""; + } + + if (url.port === null) { + return usm.serializeHost(url.host); + } + + return usm.serializeHost(url.host) + ":" + usm.serializeInteger(url.port); + } + + set host(v) { + if (this._url.cannotBeABaseURL) { + return; + } + + usm.basicURLParse(v, { url: this._url, stateOverride: "host" }); + } + + get hostname() { + if (this._url.host === null) { + return ""; + } + + return usm.serializeHost(this._url.host); + } + + set hostname(v) { + if (this._url.cannotBeABaseURL) { + return; + } + + usm.basicURLParse(v, { url: this._url, stateOverride: "hostname" }); + } + + get port() { + if (this._url.port === null) { + return ""; + } + + return usm.serializeInteger(this._url.port); + } + + set port(v) { + if (usm.cannotHaveAUsernamePasswordPort(this._url)) { + return; + } + + if (v === "") { + this._url.port = null; + } else { + usm.basicURLParse(v, { url: this._url, stateOverride: "port" }); + } + } + + get pathname() { + if (this._url.cannotBeABaseURL) { + return this._url.path[0]; + } + + if (this._url.path.length === 0) { + return ""; + } + + return "/" + this._url.path.join("/"); + } + + set pathname(v) { + if (this._url.cannotBeABaseURL) { + return; + } + + this._url.path = []; + usm.basicURLParse(v, { url: this._url, stateOverride: "path start" }); + } + + get search() { + if (this._url.query === null || this._url.query === "") { + return ""; + } + + return "?" + this._url.query; + } + + set search(v) { + // TODO: query stuff + + const url = this._url; + + if (v === "") { + url.query = null; + return; + } + + const input = v[0] === "?" ? v.substring(1) : v; + url.query = ""; + usm.basicURLParse(input, { url, stateOverride: "query" }); + } + + get hash() { + if (this._url.fragment === null || this._url.fragment === "") { + return ""; + } + + return "#" + this._url.fragment; + } + + set hash(v) { + if (v === "") { + this._url.fragment = null; + return; + } + + const input = v[0] === "#" ? v.substring(1) : v; + this._url.fragment = ""; + usm.basicURLParse(input, { url: this._url, stateOverride: "fragment" }); + } + + toJSON() { + return this.href; + } +}; diff --git a/project starter code/node_modules/whatwg-url/lib/URL.js b/project starter code/node_modules/whatwg-url/lib/URL.js new file mode 100644 index 00000000..78c7207e --- /dev/null +++ b/project starter code/node_modules/whatwg-url/lib/URL.js @@ -0,0 +1,196 @@ +"use strict"; + +const conversions = require("webidl-conversions"); +const utils = require("./utils.js"); +const Impl = require(".//URL-impl.js"); + +const impl = utils.implSymbol; + +function URL(url) { + if (!this || this[impl] || !(this instanceof URL)) { + throw new TypeError("Failed to construct 'URL': Please use the 'new' operator, this DOM object constructor cannot be called as a function."); + } + if (arguments.length < 1) { + throw new TypeError("Failed to construct 'URL': 1 argument required, but only " + arguments.length + " present."); + } + const args = []; + for (let i = 0; i < arguments.length && i < 2; ++i) { + args[i] = arguments[i]; + } + args[0] = conversions["USVString"](args[0]); + if (args[1] !== undefined) { + args[1] = conversions["USVString"](args[1]); + } + + module.exports.setup(this, args); +} + +URL.prototype.toJSON = function toJSON() { + if (!this || !module.exports.is(this)) { + throw new TypeError("Illegal invocation"); + } + const args = []; + for (let i = 0; i < arguments.length && i < 0; ++i) { + args[i] = arguments[i]; + } + return this[impl].toJSON.apply(this[impl], args); +}; +Object.defineProperty(URL.prototype, "href", { + get() { + return this[impl].href; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].href = V; + }, + enumerable: true, + configurable: true +}); + +URL.prototype.toString = function () { + if (!this || !module.exports.is(this)) { + throw new TypeError("Illegal invocation"); + } + return this.href; +}; + +Object.defineProperty(URL.prototype, "origin", { + get() { + return this[impl].origin; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "protocol", { + get() { + return this[impl].protocol; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].protocol = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "username", { + get() { + return this[impl].username; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].username = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "password", { + get() { + return this[impl].password; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].password = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "host", { + get() { + return this[impl].host; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].host = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "hostname", { + get() { + return this[impl].hostname; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].hostname = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "port", { + get() { + return this[impl].port; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].port = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "pathname", { + get() { + return this[impl].pathname; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].pathname = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "search", { + get() { + return this[impl].search; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].search = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "hash", { + get() { + return this[impl].hash; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].hash = V; + }, + enumerable: true, + configurable: true +}); + + +module.exports = { + is(obj) { + return !!obj && obj[impl] instanceof Impl.implementation; + }, + create(constructorArgs, privateData) { + let obj = Object.create(URL.prototype); + this.setup(obj, constructorArgs, privateData); + return obj; + }, + setup(obj, constructorArgs, privateData) { + if (!privateData) privateData = {}; + privateData.wrapper = obj; + + obj[impl] = new Impl.implementation(constructorArgs, privateData); + obj[impl][utils.wrapperSymbol] = obj; + }, + interface: URL, + expose: { + Window: { URL: URL }, + Worker: { URL: URL } + } +}; + diff --git a/project starter code/node_modules/whatwg-url/lib/public-api.js b/project starter code/node_modules/whatwg-url/lib/public-api.js new file mode 100644 index 00000000..932dcada --- /dev/null +++ b/project starter code/node_modules/whatwg-url/lib/public-api.js @@ -0,0 +1,11 @@ +"use strict"; + +exports.URL = require("./URL").interface; +exports.serializeURL = require("./url-state-machine").serializeURL; +exports.serializeURLOrigin = require("./url-state-machine").serializeURLOrigin; +exports.basicURLParse = require("./url-state-machine").basicURLParse; +exports.setTheUsername = require("./url-state-machine").setTheUsername; +exports.setThePassword = require("./url-state-machine").setThePassword; +exports.serializeHost = require("./url-state-machine").serializeHost; +exports.serializeInteger = require("./url-state-machine").serializeInteger; +exports.parseURL = require("./url-state-machine").parseURL; diff --git a/project starter code/node_modules/whatwg-url/lib/url-state-machine.js b/project starter code/node_modules/whatwg-url/lib/url-state-machine.js new file mode 100644 index 00000000..27d977a2 --- /dev/null +++ b/project starter code/node_modules/whatwg-url/lib/url-state-machine.js @@ -0,0 +1,1297 @@ +"use strict"; +const punycode = require("punycode"); +const tr46 = require("tr46"); + +const specialSchemes = { + ftp: 21, + file: null, + gopher: 70, + http: 80, + https: 443, + ws: 80, + wss: 443 +}; + +const failure = Symbol("failure"); + +function countSymbols(str) { + return punycode.ucs2.decode(str).length; +} + +function at(input, idx) { + const c = input[idx]; + return isNaN(c) ? undefined : String.fromCodePoint(c); +} + +function isASCIIDigit(c) { + return c >= 0x30 && c <= 0x39; +} + +function isASCIIAlpha(c) { + return (c >= 0x41 && c <= 0x5A) || (c >= 0x61 && c <= 0x7A); +} + +function isASCIIAlphanumeric(c) { + return isASCIIAlpha(c) || isASCIIDigit(c); +} + +function isASCIIHex(c) { + return isASCIIDigit(c) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66); +} + +function isSingleDot(buffer) { + return buffer === "." || buffer.toLowerCase() === "%2e"; +} + +function isDoubleDot(buffer) { + buffer = buffer.toLowerCase(); + return buffer === ".." || buffer === "%2e." || buffer === ".%2e" || buffer === "%2e%2e"; +} + +function isWindowsDriveLetterCodePoints(cp1, cp2) { + return isASCIIAlpha(cp1) && (cp2 === 58 || cp2 === 124); +} + +function isWindowsDriveLetterString(string) { + return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && (string[1] === ":" || string[1] === "|"); +} + +function isNormalizedWindowsDriveLetterString(string) { + return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && string[1] === ":"; +} + +function containsForbiddenHostCodePoint(string) { + return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/) !== -1; +} + +function containsForbiddenHostCodePointExcludingPercent(string) { + return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/) !== -1; +} + +function isSpecialScheme(scheme) { + return specialSchemes[scheme] !== undefined; +} + +function isSpecial(url) { + return isSpecialScheme(url.scheme); +} + +function defaultPort(scheme) { + return specialSchemes[scheme]; +} + +function percentEncode(c) { + let hex = c.toString(16).toUpperCase(); + if (hex.length === 1) { + hex = "0" + hex; + } + + return "%" + hex; +} + +function utf8PercentEncode(c) { + const buf = new Buffer(c); + + let str = ""; + + for (let i = 0; i < buf.length; ++i) { + str += percentEncode(buf[i]); + } + + return str; +} + +function utf8PercentDecode(str) { + const input = new Buffer(str); + const output = []; + for (let i = 0; i < input.length; ++i) { + if (input[i] !== 37) { + output.push(input[i]); + } else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) { + output.push(parseInt(input.slice(i + 1, i + 3).toString(), 16)); + i += 2; + } else { + output.push(input[i]); + } + } + return new Buffer(output).toString(); +} + +function isC0ControlPercentEncode(c) { + return c <= 0x1F || c > 0x7E; +} + +const extraPathPercentEncodeSet = new Set([32, 34, 35, 60, 62, 63, 96, 123, 125]); +function isPathPercentEncode(c) { + return isC0ControlPercentEncode(c) || extraPathPercentEncodeSet.has(c); +} + +const extraUserinfoPercentEncodeSet = + new Set([47, 58, 59, 61, 64, 91, 92, 93, 94, 124]); +function isUserinfoPercentEncode(c) { + return isPathPercentEncode(c) || extraUserinfoPercentEncodeSet.has(c); +} + +function percentEncodeChar(c, encodeSetPredicate) { + const cStr = String.fromCodePoint(c); + + if (encodeSetPredicate(c)) { + return utf8PercentEncode(cStr); + } + + return cStr; +} + +function parseIPv4Number(input) { + let R = 10; + + if (input.length >= 2 && input.charAt(0) === "0" && input.charAt(1).toLowerCase() === "x") { + input = input.substring(2); + R = 16; + } else if (input.length >= 2 && input.charAt(0) === "0") { + input = input.substring(1); + R = 8; + } + + if (input === "") { + return 0; + } + + const regex = R === 10 ? /[^0-9]/ : (R === 16 ? /[^0-9A-Fa-f]/ : /[^0-7]/); + if (regex.test(input)) { + return failure; + } + + return parseInt(input, R); +} + +function parseIPv4(input) { + const parts = input.split("."); + if (parts[parts.length - 1] === "") { + if (parts.length > 1) { + parts.pop(); + } + } + + if (parts.length > 4) { + return input; + } + + const numbers = []; + for (const part of parts) { + if (part === "") { + return input; + } + const n = parseIPv4Number(part); + if (n === failure) { + return input; + } + + numbers.push(n); + } + + for (let i = 0; i < numbers.length - 1; ++i) { + if (numbers[i] > 255) { + return failure; + } + } + if (numbers[numbers.length - 1] >= Math.pow(256, 5 - numbers.length)) { + return failure; + } + + let ipv4 = numbers.pop(); + let counter = 0; + + for (const n of numbers) { + ipv4 += n * Math.pow(256, 3 - counter); + ++counter; + } + + return ipv4; +} + +function serializeIPv4(address) { + let output = ""; + let n = address; + + for (let i = 1; i <= 4; ++i) { + output = String(n % 256) + output; + if (i !== 4) { + output = "." + output; + } + n = Math.floor(n / 256); + } + + return output; +} + +function parseIPv6(input) { + const address = [0, 0, 0, 0, 0, 0, 0, 0]; + let pieceIndex = 0; + let compress = null; + let pointer = 0; + + input = punycode.ucs2.decode(input); + + if (input[pointer] === 58) { + if (input[pointer + 1] !== 58) { + return failure; + } + + pointer += 2; + ++pieceIndex; + compress = pieceIndex; + } + + while (pointer < input.length) { + if (pieceIndex === 8) { + return failure; + } + + if (input[pointer] === 58) { + if (compress !== null) { + return failure; + } + ++pointer; + ++pieceIndex; + compress = pieceIndex; + continue; + } + + let value = 0; + let length = 0; + + while (length < 4 && isASCIIHex(input[pointer])) { + value = value * 0x10 + parseInt(at(input, pointer), 16); + ++pointer; + ++length; + } + + if (input[pointer] === 46) { + if (length === 0) { + return failure; + } + + pointer -= length; + + if (pieceIndex > 6) { + return failure; + } + + let numbersSeen = 0; + + while (input[pointer] !== undefined) { + let ipv4Piece = null; + + if (numbersSeen > 0) { + if (input[pointer] === 46 && numbersSeen < 4) { + ++pointer; + } else { + return failure; + } + } + + if (!isASCIIDigit(input[pointer])) { + return failure; + } + + while (isASCIIDigit(input[pointer])) { + const number = parseInt(at(input, pointer)); + if (ipv4Piece === null) { + ipv4Piece = number; + } else if (ipv4Piece === 0) { + return failure; + } else { + ipv4Piece = ipv4Piece * 10 + number; + } + if (ipv4Piece > 255) { + return failure; + } + ++pointer; + } + + address[pieceIndex] = address[pieceIndex] * 0x100 + ipv4Piece; + + ++numbersSeen; + + if (numbersSeen === 2 || numbersSeen === 4) { + ++pieceIndex; + } + } + + if (numbersSeen !== 4) { + return failure; + } + + break; + } else if (input[pointer] === 58) { + ++pointer; + if (input[pointer] === undefined) { + return failure; + } + } else if (input[pointer] !== undefined) { + return failure; + } + + address[pieceIndex] = value; + ++pieceIndex; + } + + if (compress !== null) { + let swaps = pieceIndex - compress; + pieceIndex = 7; + while (pieceIndex !== 0 && swaps > 0) { + const temp = address[compress + swaps - 1]; + address[compress + swaps - 1] = address[pieceIndex]; + address[pieceIndex] = temp; + --pieceIndex; + --swaps; + } + } else if (compress === null && pieceIndex !== 8) { + return failure; + } + + return address; +} + +function serializeIPv6(address) { + let output = ""; + const seqResult = findLongestZeroSequence(address); + const compress = seqResult.idx; + let ignore0 = false; + + for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) { + if (ignore0 && address[pieceIndex] === 0) { + continue; + } else if (ignore0) { + ignore0 = false; + } + + if (compress === pieceIndex) { + const separator = pieceIndex === 0 ? "::" : ":"; + output += separator; + ignore0 = true; + continue; + } + + output += address[pieceIndex].toString(16); + + if (pieceIndex !== 7) { + output += ":"; + } + } + + return output; +} + +function parseHost(input, isSpecialArg) { + if (input[0] === "[") { + if (input[input.length - 1] !== "]") { + return failure; + } + + return parseIPv6(input.substring(1, input.length - 1)); + } + + if (!isSpecialArg) { + return parseOpaqueHost(input); + } + + const domain = utf8PercentDecode(input); + const asciiDomain = tr46.toASCII(domain, false, tr46.PROCESSING_OPTIONS.NONTRANSITIONAL, false); + if (asciiDomain === null) { + return failure; + } + + if (containsForbiddenHostCodePoint(asciiDomain)) { + return failure; + } + + const ipv4Host = parseIPv4(asciiDomain); + if (typeof ipv4Host === "number" || ipv4Host === failure) { + return ipv4Host; + } + + return asciiDomain; +} + +function parseOpaqueHost(input) { + if (containsForbiddenHostCodePointExcludingPercent(input)) { + return failure; + } + + let output = ""; + const decoded = punycode.ucs2.decode(input); + for (let i = 0; i < decoded.length; ++i) { + output += percentEncodeChar(decoded[i], isC0ControlPercentEncode); + } + return output; +} + +function findLongestZeroSequence(arr) { + let maxIdx = null; + let maxLen = 1; // only find elements > 1 + let currStart = null; + let currLen = 0; + + for (let i = 0; i < arr.length; ++i) { + if (arr[i] !== 0) { + if (currLen > maxLen) { + maxIdx = currStart; + maxLen = currLen; + } + + currStart = null; + currLen = 0; + } else { + if (currStart === null) { + currStart = i; + } + ++currLen; + } + } + + // if trailing zeros + if (currLen > maxLen) { + maxIdx = currStart; + maxLen = currLen; + } + + return { + idx: maxIdx, + len: maxLen + }; +} + +function serializeHost(host) { + if (typeof host === "number") { + return serializeIPv4(host); + } + + // IPv6 serializer + if (host instanceof Array) { + return "[" + serializeIPv6(host) + "]"; + } + + return host; +} + +function trimControlChars(url) { + return url.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g, ""); +} + +function trimTabAndNewline(url) { + return url.replace(/\u0009|\u000A|\u000D/g, ""); +} + +function shortenPath(url) { + const path = url.path; + if (path.length === 0) { + return; + } + if (url.scheme === "file" && path.length === 1 && isNormalizedWindowsDriveLetter(path[0])) { + return; + } + + path.pop(); +} + +function includesCredentials(url) { + return url.username !== "" || url.password !== ""; +} + +function cannotHaveAUsernamePasswordPort(url) { + return url.host === null || url.host === "" || url.cannotBeABaseURL || url.scheme === "file"; +} + +function isNormalizedWindowsDriveLetter(string) { + return /^[A-Za-z]:$/.test(string); +} + +function URLStateMachine(input, base, encodingOverride, url, stateOverride) { + this.pointer = 0; + this.input = input; + this.base = base || null; + this.encodingOverride = encodingOverride || "utf-8"; + this.stateOverride = stateOverride; + this.url = url; + this.failure = false; + this.parseError = false; + + if (!this.url) { + this.url = { + scheme: "", + username: "", + password: "", + host: null, + port: null, + path: [], + query: null, + fragment: null, + + cannotBeABaseURL: false + }; + + const res = trimControlChars(this.input); + if (res !== this.input) { + this.parseError = true; + } + this.input = res; + } + + const res = trimTabAndNewline(this.input); + if (res !== this.input) { + this.parseError = true; + } + this.input = res; + + this.state = stateOverride || "scheme start"; + + this.buffer = ""; + this.atFlag = false; + this.arrFlag = false; + this.passwordTokenSeenFlag = false; + + this.input = punycode.ucs2.decode(this.input); + + for (; this.pointer <= this.input.length; ++this.pointer) { + const c = this.input[this.pointer]; + const cStr = isNaN(c) ? undefined : String.fromCodePoint(c); + + // exec state machine + const ret = this["parse " + this.state](c, cStr); + if (!ret) { + break; // terminate algorithm + } else if (ret === failure) { + this.failure = true; + break; + } + } +} + +URLStateMachine.prototype["parse scheme start"] = function parseSchemeStart(c, cStr) { + if (isASCIIAlpha(c)) { + this.buffer += cStr.toLowerCase(); + this.state = "scheme"; + } else if (!this.stateOverride) { + this.state = "no scheme"; + --this.pointer; + } else { + this.parseError = true; + return failure; + } + + return true; +}; + +URLStateMachine.prototype["parse scheme"] = function parseScheme(c, cStr) { + if (isASCIIAlphanumeric(c) || c === 43 || c === 45 || c === 46) { + this.buffer += cStr.toLowerCase(); + } else if (c === 58) { + if (this.stateOverride) { + if (isSpecial(this.url) && !isSpecialScheme(this.buffer)) { + return false; + } + + if (!isSpecial(this.url) && isSpecialScheme(this.buffer)) { + return false; + } + + if ((includesCredentials(this.url) || this.url.port !== null) && this.buffer === "file") { + return false; + } + + if (this.url.scheme === "file" && (this.url.host === "" || this.url.host === null)) { + return false; + } + } + this.url.scheme = this.buffer; + this.buffer = ""; + if (this.stateOverride) { + return false; + } + if (this.url.scheme === "file") { + if (this.input[this.pointer + 1] !== 47 || this.input[this.pointer + 2] !== 47) { + this.parseError = true; + } + this.state = "file"; + } else if (isSpecial(this.url) && this.base !== null && this.base.scheme === this.url.scheme) { + this.state = "special relative or authority"; + } else if (isSpecial(this.url)) { + this.state = "special authority slashes"; + } else if (this.input[this.pointer + 1] === 47) { + this.state = "path or authority"; + ++this.pointer; + } else { + this.url.cannotBeABaseURL = true; + this.url.path.push(""); + this.state = "cannot-be-a-base-URL path"; + } + } else if (!this.stateOverride) { + this.buffer = ""; + this.state = "no scheme"; + this.pointer = -1; + } else { + this.parseError = true; + return failure; + } + + return true; +}; + +URLStateMachine.prototype["parse no scheme"] = function parseNoScheme(c) { + if (this.base === null || (this.base.cannotBeABaseURL && c !== 35)) { + return failure; + } else if (this.base.cannotBeABaseURL && c === 35) { + this.url.scheme = this.base.scheme; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.url.cannotBeABaseURL = true; + this.state = "fragment"; + } else if (this.base.scheme === "file") { + this.state = "file"; + --this.pointer; + } else { + this.state = "relative"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse special relative or authority"] = function parseSpecialRelativeOrAuthority(c) { + if (c === 47 && this.input[this.pointer + 1] === 47) { + this.state = "special authority ignore slashes"; + ++this.pointer; + } else { + this.parseError = true; + this.state = "relative"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse path or authority"] = function parsePathOrAuthority(c) { + if (c === 47) { + this.state = "authority"; + } else { + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse relative"] = function parseRelative(c) { + this.url.scheme = this.base.scheme; + if (isNaN(c)) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + } else if (c === 47) { + this.state = "relative slash"; + } else if (c === 63) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.state = "fragment"; + } else if (isSpecial(this.url) && c === 92) { + this.parseError = true; + this.state = "relative slash"; + } else { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(0, this.base.path.length - 1); + + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse relative slash"] = function parseRelativeSlash(c) { + if (isSpecial(this.url) && (c === 47 || c === 92)) { + if (c === 92) { + this.parseError = true; + } + this.state = "special authority ignore slashes"; + } else if (c === 47) { + this.state = "authority"; + } else { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse special authority slashes"] = function parseSpecialAuthoritySlashes(c) { + if (c === 47 && this.input[this.pointer + 1] === 47) { + this.state = "special authority ignore slashes"; + ++this.pointer; + } else { + this.parseError = true; + this.state = "special authority ignore slashes"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse special authority ignore slashes"] = function parseSpecialAuthorityIgnoreSlashes(c) { + if (c !== 47 && c !== 92) { + this.state = "authority"; + --this.pointer; + } else { + this.parseError = true; + } + + return true; +}; + +URLStateMachine.prototype["parse authority"] = function parseAuthority(c, cStr) { + if (c === 64) { + this.parseError = true; + if (this.atFlag) { + this.buffer = "%40" + this.buffer; + } + this.atFlag = true; + + // careful, this is based on buffer and has its own pointer (this.pointer != pointer) and inner chars + const len = countSymbols(this.buffer); + for (let pointer = 0; pointer < len; ++pointer) { + const codePoint = this.buffer.codePointAt(pointer); + + if (codePoint === 58 && !this.passwordTokenSeenFlag) { + this.passwordTokenSeenFlag = true; + continue; + } + const encodedCodePoints = percentEncodeChar(codePoint, isUserinfoPercentEncode); + if (this.passwordTokenSeenFlag) { + this.url.password += encodedCodePoints; + } else { + this.url.username += encodedCodePoints; + } + } + this.buffer = ""; + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92)) { + if (this.atFlag && this.buffer === "") { + this.parseError = true; + return failure; + } + this.pointer -= countSymbols(this.buffer) + 1; + this.buffer = ""; + this.state = "host"; + } else { + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse hostname"] = +URLStateMachine.prototype["parse host"] = function parseHostName(c, cStr) { + if (this.stateOverride && this.url.scheme === "file") { + --this.pointer; + this.state = "file host"; + } else if (c === 58 && !this.arrFlag) { + if (this.buffer === "") { + this.parseError = true; + return failure; + } + + const host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + + this.url.host = host; + this.buffer = ""; + this.state = "port"; + if (this.stateOverride === "hostname") { + return false; + } + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92)) { + --this.pointer; + if (isSpecial(this.url) && this.buffer === "") { + this.parseError = true; + return failure; + } else if (this.stateOverride && this.buffer === "" && + (includesCredentials(this.url) || this.url.port !== null)) { + this.parseError = true; + return false; + } + + const host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + + this.url.host = host; + this.buffer = ""; + this.state = "path start"; + if (this.stateOverride) { + return false; + } + } else { + if (c === 91) { + this.arrFlag = true; + } else if (c === 93) { + this.arrFlag = false; + } + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse port"] = function parsePort(c, cStr) { + if (isASCIIDigit(c)) { + this.buffer += cStr; + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92) || + this.stateOverride) { + if (this.buffer !== "") { + const port = parseInt(this.buffer); + if (port > Math.pow(2, 16) - 1) { + this.parseError = true; + return failure; + } + this.url.port = port === defaultPort(this.url.scheme) ? null : port; + this.buffer = ""; + } + if (this.stateOverride) { + return false; + } + this.state = "path start"; + --this.pointer; + } else { + this.parseError = true; + return failure; + } + + return true; +}; + +const fileOtherwiseCodePoints = new Set([47, 92, 63, 35]); + +URLStateMachine.prototype["parse file"] = function parseFile(c) { + this.url.scheme = "file"; + + if (c === 47 || c === 92) { + if (c === 92) { + this.parseError = true; + } + this.state = "file slash"; + } else if (this.base !== null && this.base.scheme === "file") { + if (isNaN(c)) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + } else if (c === 63) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.state = "fragment"; + } else { + if (this.input.length - this.pointer - 1 === 0 || // remaining consists of 0 code points + !isWindowsDriveLetterCodePoints(c, this.input[this.pointer + 1]) || + (this.input.length - this.pointer - 1 >= 2 && // remaining has at least 2 code points + !fileOtherwiseCodePoints.has(this.input[this.pointer + 2]))) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + shortenPath(this.url); + } else { + this.parseError = true; + } + + this.state = "path"; + --this.pointer; + } + } else { + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse file slash"] = function parseFileSlash(c) { + if (c === 47 || c === 92) { + if (c === 92) { + this.parseError = true; + } + this.state = "file host"; + } else { + if (this.base !== null && this.base.scheme === "file") { + if (isNormalizedWindowsDriveLetterString(this.base.path[0])) { + this.url.path.push(this.base.path[0]); + } else { + this.url.host = this.base.host; + } + } + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse file host"] = function parseFileHost(c, cStr) { + if (isNaN(c) || c === 47 || c === 92 || c === 63 || c === 35) { + --this.pointer; + if (!this.stateOverride && isWindowsDriveLetterString(this.buffer)) { + this.parseError = true; + this.state = "path"; + } else if (this.buffer === "") { + this.url.host = ""; + if (this.stateOverride) { + return false; + } + this.state = "path start"; + } else { + let host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + if (host === "localhost") { + host = ""; + } + this.url.host = host; + + if (this.stateOverride) { + return false; + } + + this.buffer = ""; + this.state = "path start"; + } + } else { + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse path start"] = function parsePathStart(c) { + if (isSpecial(this.url)) { + if (c === 92) { + this.parseError = true; + } + this.state = "path"; + + if (c !== 47 && c !== 92) { + --this.pointer; + } + } else if (!this.stateOverride && c === 63) { + this.url.query = ""; + this.state = "query"; + } else if (!this.stateOverride && c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } else if (c !== undefined) { + this.state = "path"; + if (c !== 47) { + --this.pointer; + } + } + + return true; +}; + +URLStateMachine.prototype["parse path"] = function parsePath(c) { + if (isNaN(c) || c === 47 || (isSpecial(this.url) && c === 92) || + (!this.stateOverride && (c === 63 || c === 35))) { + if (isSpecial(this.url) && c === 92) { + this.parseError = true; + } + + if (isDoubleDot(this.buffer)) { + shortenPath(this.url); + if (c !== 47 && !(isSpecial(this.url) && c === 92)) { + this.url.path.push(""); + } + } else if (isSingleDot(this.buffer) && c !== 47 && + !(isSpecial(this.url) && c === 92)) { + this.url.path.push(""); + } else if (!isSingleDot(this.buffer)) { + if (this.url.scheme === "file" && this.url.path.length === 0 && isWindowsDriveLetterString(this.buffer)) { + if (this.url.host !== "" && this.url.host !== null) { + this.parseError = true; + this.url.host = ""; + } + this.buffer = this.buffer[0] + ":"; + } + this.url.path.push(this.buffer); + } + this.buffer = ""; + if (this.url.scheme === "file" && (c === undefined || c === 63 || c === 35)) { + while (this.url.path.length > 1 && this.url.path[0] === "") { + this.parseError = true; + this.url.path.shift(); + } + } + if (c === 63) { + this.url.query = ""; + this.state = "query"; + } + if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } + } else { + // TODO: If c is not a URL code point and not "%", parse error. + + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + this.buffer += percentEncodeChar(c, isPathPercentEncode); + } + + return true; +}; + +URLStateMachine.prototype["parse cannot-be-a-base-URL path"] = function parseCannotBeABaseURLPath(c) { + if (c === 63) { + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } else { + // TODO: Add: not a URL code point + if (!isNaN(c) && c !== 37) { + this.parseError = true; + } + + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + if (!isNaN(c)) { + this.url.path[0] = this.url.path[0] + percentEncodeChar(c, isC0ControlPercentEncode); + } + } + + return true; +}; + +URLStateMachine.prototype["parse query"] = function parseQuery(c, cStr) { + if (isNaN(c) || (!this.stateOverride && c === 35)) { + if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") { + this.encodingOverride = "utf-8"; + } + + const buffer = new Buffer(this.buffer); // TODO: Use encoding override instead + for (let i = 0; i < buffer.length; ++i) { + if (buffer[i] < 0x21 || buffer[i] > 0x7E || buffer[i] === 0x22 || buffer[i] === 0x23 || + buffer[i] === 0x3C || buffer[i] === 0x3E) { + this.url.query += percentEncode(buffer[i]); + } else { + this.url.query += String.fromCodePoint(buffer[i]); + } + } + + this.buffer = ""; + if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } + } else { + // TODO: If c is not a URL code point and not "%", parse error. + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse fragment"] = function parseFragment(c) { + if (isNaN(c)) { // do nothing + } else if (c === 0x0) { + this.parseError = true; + } else { + // TODO: If c is not a URL code point and not "%", parse error. + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + this.url.fragment += percentEncodeChar(c, isC0ControlPercentEncode); + } + + return true; +}; + +function serializeURL(url, excludeFragment) { + let output = url.scheme + ":"; + if (url.host !== null) { + output += "//"; + + if (url.username !== "" || url.password !== "") { + output += url.username; + if (url.password !== "") { + output += ":" + url.password; + } + output += "@"; + } + + output += serializeHost(url.host); + + if (url.port !== null) { + output += ":" + url.port; + } + } else if (url.host === null && url.scheme === "file") { + output += "//"; + } + + if (url.cannotBeABaseURL) { + output += url.path[0]; + } else { + for (const string of url.path) { + output += "/" + string; + } + } + + if (url.query !== null) { + output += "?" + url.query; + } + + if (!excludeFragment && url.fragment !== null) { + output += "#" + url.fragment; + } + + return output; +} + +function serializeOrigin(tuple) { + let result = tuple.scheme + "://"; + result += serializeHost(tuple.host); + + if (tuple.port !== null) { + result += ":" + tuple.port; + } + + return result; +} + +module.exports.serializeURL = serializeURL; + +module.exports.serializeURLOrigin = function (url) { + // https://url.spec.whatwg.org/#concept-url-origin + switch (url.scheme) { + case "blob": + try { + return module.exports.serializeURLOrigin(module.exports.parseURL(url.path[0])); + } catch (e) { + // serializing an opaque origin returns "null" + return "null"; + } + case "ftp": + case "gopher": + case "http": + case "https": + case "ws": + case "wss": + return serializeOrigin({ + scheme: url.scheme, + host: url.host, + port: url.port + }); + case "file": + // spec says "exercise to the reader", chrome says "file://" + return "file://"; + default: + // serializing an opaque origin returns "null" + return "null"; + } +}; + +module.exports.basicURLParse = function (input, options) { + if (options === undefined) { + options = {}; + } + + const usm = new URLStateMachine(input, options.baseURL, options.encodingOverride, options.url, options.stateOverride); + if (usm.failure) { + return "failure"; + } + + return usm.url; +}; + +module.exports.setTheUsername = function (url, username) { + url.username = ""; + const decoded = punycode.ucs2.decode(username); + for (let i = 0; i < decoded.length; ++i) { + url.username += percentEncodeChar(decoded[i], isUserinfoPercentEncode); + } +}; + +module.exports.setThePassword = function (url, password) { + url.password = ""; + const decoded = punycode.ucs2.decode(password); + for (let i = 0; i < decoded.length; ++i) { + url.password += percentEncodeChar(decoded[i], isUserinfoPercentEncode); + } +}; + +module.exports.serializeHost = serializeHost; + +module.exports.cannotHaveAUsernamePasswordPort = cannotHaveAUsernamePasswordPort; + +module.exports.serializeInteger = function (integer) { + return String(integer); +}; + +module.exports.parseURL = function (input, options) { + if (options === undefined) { + options = {}; + } + + // We don't handle blobs, so this just delegates: + return module.exports.basicURLParse(input, { baseURL: options.baseURL, encodingOverride: options.encodingOverride }); +}; diff --git a/project starter code/node_modules/whatwg-url/lib/utils.js b/project starter code/node_modules/whatwg-url/lib/utils.js new file mode 100644 index 00000000..a562009c --- /dev/null +++ b/project starter code/node_modules/whatwg-url/lib/utils.js @@ -0,0 +1,20 @@ +"use strict"; + +module.exports.mixin = function mixin(target, source) { + const keys = Object.getOwnPropertyNames(source); + for (let i = 0; i < keys.length; ++i) { + Object.defineProperty(target, keys[i], Object.getOwnPropertyDescriptor(source, keys[i])); + } +}; + +module.exports.wrapperSymbol = Symbol("wrapper"); +module.exports.implSymbol = Symbol("impl"); + +module.exports.wrapperForImpl = function (impl) { + return impl[module.exports.wrapperSymbol]; +}; + +module.exports.implForWrapper = function (wrapper) { + return wrapper[module.exports.implSymbol]; +}; + diff --git a/project starter code/node_modules/whatwg-url/package.json b/project starter code/node_modules/whatwg-url/package.json new file mode 100644 index 00000000..fce35ae7 --- /dev/null +++ b/project starter code/node_modules/whatwg-url/package.json @@ -0,0 +1,32 @@ +{ + "name": "whatwg-url", + "version": "5.0.0", + "description": "An implementation of the WHATWG URL Standard's URL API and parsing machinery", + "main": "lib/public-api.js", + "files": [ + "lib/" + ], + "author": "Sebastian Mayr ", + "license": "MIT", + "repository": "jsdom/whatwg-url", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + }, + "devDependencies": { + "eslint": "^2.6.0", + "istanbul": "~0.4.3", + "mocha": "^2.2.4", + "recast": "~0.10.29", + "request": "^2.55.0", + "webidl2js": "^3.0.2" + }, + "scripts": { + "build": "node scripts/transform.js && node scripts/convert-idl.js", + "coverage": "istanbul cover node_modules/mocha/bin/_mocha", + "lint": "eslint .", + "prepublish": "npm run build", + "pretest": "node scripts/get-latest-platform-tests.js && npm run build", + "test": "mocha" + } +} diff --git a/project starter code/node_modules/xml2js/README.md b/project starter code/node_modules/xml2js/README.md index 7534c893..67f2104a 100644 --- a/project starter code/node_modules/xml2js/README.md +++ b/project starter code/node_modules/xml2js/README.md @@ -113,7 +113,7 @@ var xml = ''; // With parser var parser = new xml2js.Parser(/* options */); -parser.parseStringPromise(data).then(function (result) { +parser.parseStringPromise(xml).then(function (result) { console.dir(result); console.log('Done'); }) @@ -122,7 +122,7 @@ parser.parseStringPromise(data).then(function (result) { }); // Without parser -xml2js.parseStringPromise(data /*, options */).then(function (result) { +xml2js.parseStringPromise(xml /*, options */).then(function (result) { console.dir(result); console.log('Done'); }) @@ -180,6 +180,16 @@ var obj = {name: "Super", Surname: "Man", age: 23}; var builder = new xml2js.Builder(); var xml = builder.buildObject(obj); ``` +will result in: + +```xml + + + Super + Man + 23 + +``` At the moment, a one to one bi-directional conversion is guaranteed only for default configuration, except for `attrkey`, `charkey` and `explicitArray` options @@ -195,6 +205,11 @@ var obj = {root: {$: {id: "my id"}, _: "my inner text"}}; var builder = new xml2js.Builder(); var xml = builder.buildObject(obj); ``` +will result in: +```xml + +my inner text +``` ### Adding xmlns attributes @@ -309,14 +324,18 @@ value})``. Possible options are: Version 0.1 default was `@`. * `charkey` (default: `_`): Prefix that is used to access the character content. Version 0.1 default was `#`. - * `explicitCharkey` (default: `false`) + * `explicitCharkey` (default: `false`) Determines whether or not to use + a `charkey` prefix for elements with no attributes. * `trim` (default: `false`): Trim the whitespace at the beginning and end of text nodes. * `normalizeTags` (default: `false`): Normalize all tag names to lowercase. * `normalize` (default: `false`): Trim whitespaces inside text nodes. * `explicitRoot` (default: `true`): Set this if you want to get the root node in the resulting object. - * `emptyTag` (default: `''`): what will the value of empty nodes be. + * `emptyTag` (default: `''`): what will the value of empty nodes be. In case + you want to use an empty object as a default value, it is better to provide a factory + function `() => ({})` instead. Without this function a plain object would + become a shared reference across all occurrences with unwanted behavior. * `explicitArray` (default: `true`): Always put child nodes in an array if true; otherwise an array is created only if there is more than one. * `ignoreAttrs` (default: `false`): Ignore all XML attributes and only create diff --git a/project starter code/node_modules/xml2js/lib/parser.js b/project starter code/node_modules/xml2js/lib/parser.js index 59f4d545..192382d3 100644 --- a/project starter code/node_modules/xml2js/lib/parser.js +++ b/project starter code/node_modules/xml2js/lib/parser.js @@ -141,14 +141,14 @@ this.saxParser.onopentag = (function(_this) { return function(node) { var key, newValue, obj, processedKey, ref; - obj = {}; + obj = Object.create(null); obj[charkey] = ""; if (!_this.options.ignoreAttrs) { ref = node.attributes; for (key in ref) { if (!hasProp.call(ref, key)) continue; if (!(attrkey in obj) && !_this.options.mergeAttrs) { - obj[attrkey] = {}; + obj[attrkey] = Object.create(null); } newValue = _this.options.attrValueProcessors ? processItem(_this.options.attrValueProcessors, node.attributes[key], key) : node.attributes[key]; processedKey = _this.options.attrNameProcessors ? processItem(_this.options.attrNameProcessors, key) : key; @@ -198,7 +198,11 @@ } } if (isEmpty(obj)) { - obj = _this.options.emptyTag !== '' ? _this.options.emptyTag : emptyStr; + if (typeof _this.options.emptyTag === 'function') { + obj = _this.options.emptyTag(); + } else { + obj = _this.options.emptyTag !== '' ? _this.options.emptyTag : emptyStr; + } } if (_this.options.validator != null) { xpath = "/" + ((function() { @@ -222,7 +226,7 @@ } if (_this.options.explicitChildren && !_this.options.mergeAttrs && typeof obj === 'object') { if (!_this.options.preserveChildrenOrder) { - node = {}; + node = Object.create(null); if (_this.options.attrkey in obj) { node[_this.options.attrkey] = obj[_this.options.attrkey]; delete obj[_this.options.attrkey]; @@ -237,7 +241,7 @@ obj = node; } else if (s) { s[_this.options.childkey] = s[_this.options.childkey] || []; - objClone = {}; + objClone = Object.create(null); for (key in obj) { if (!hasProp.call(obj, key)) continue; objClone[key] = obj[key]; @@ -254,7 +258,7 @@ } else { if (_this.options.explicitRoot) { old = obj; - obj = {}; + obj = Object.create(null); obj[nodeName] = old; } _this.resultObject = obj; diff --git a/project starter code/node_modules/xml2js/package.json b/project starter code/node_modules/xml2js/package.json index 0769b611..bc8eb663 100644 --- a/project starter code/node_modules/xml2js/package.json +++ b/project starter code/node_modules/xml2js/package.json @@ -6,7 +6,7 @@ "json" ], "homepage": "https://github.com/Leonidas-from-XIV/node-xml2js", - "version": "0.4.23", + "version": "0.5.0", "author": "Marek Kubica (https://xivilization.net)", "contributors": [ "maqr (https://github.com/maqr)", @@ -53,7 +53,8 @@ "David Wood (http://codesleuth.co.uk/)", "Nicolas Maquet (https://github.com/nmaquet)", "Lovell Fuller (http://lovell.info/)", - "d3adc0d3 (https://github.com/d3adc0d3)" + "d3adc0d3 (https://github.com/d3adc0d3)", + "James Crosby (https://github.com/autopulated)" ], "main": "./lib/xml2js", "files": [ diff --git a/project starter code/package-lock.json b/project starter code/package-lock.json index 5cebd566..2e83f103 100644 --- a/project starter code/package-lock.json +++ b/project starter code/package-lock.json @@ -9,29 +9,22 @@ "version": "1.0.0", "license": "ISC", "dependencies": { + "@types/bluebird": "^3.5.34", + "axios": "^1.7.2", "body-parser": "^1.20.1", "express": "^4.18.2", - "jimp": "^0.16.2" - } - }, - "node_modules/@babel/runtime": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz", - "integrity": "sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==", - "dependencies": { - "regenerator-runtime": "^0.13.11" + "jimp": "^0.22.12" }, - "engines": { - "node": ">=6.9.0" + "devDependencies": { + "nodemon": "^3.1.1" } }, "node_modules/@jimp/bmp": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.16.2.tgz", - "integrity": "sha512-4g9vW45QfMoGhLVvaFj26h4e7cC+McHUQwyFQmNTLW4FfC1OonN9oUr2m/FEDGkTYKR7aqdXR5XUqqIkHWLaFw==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.22.12.tgz", + "integrity": "sha512-aeI64HD0npropd+AR76MCcvvRaa+Qck6loCOS03CkkxGHN5/r336qTM5HPUdHKMDOGzqknuVPA8+kK1t03z12g==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", + "@jimp/utils": "^0.22.12", "bmp-js": "^0.1.0" }, "peerDependencies": { @@ -39,40 +32,35 @@ } }, "node_modules/@jimp/core": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/core/-/core-0.16.2.tgz", - "integrity": "sha512-dp7HcyUMzjXphXYodI6PaXue+I9PXAavbb+AN+1XqFbotN22Z12DosNPEyy+UhLY/hZiQQqUkEaJHkvV31rs+w==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/core/-/core-0.22.12.tgz", + "integrity": "sha512-l0RR0dOPyzMKfjUW1uebzueFEDtCOj9fN6pyTYWWOM/VS4BciXQ1VVrJs8pO3kycGYZxncRKhCoygbNr8eEZQA==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", + "@jimp/utils": "^0.22.12", "any-base": "^1.1.0", "buffer": "^5.2.0", "exif-parser": "^0.1.12", - "file-type": "^9.0.0", - "load-bmfont": "^1.3.1", - "mkdirp": "^0.5.1", - "phin": "^2.9.1", + "file-type": "^16.5.4", + "isomorphic-fetch": "^3.0.0", "pixelmatch": "^4.0.2", - "tinycolor2": "^1.4.1" + "tinycolor2": "^1.6.0" } }, "node_modules/@jimp/custom": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.16.2.tgz", - "integrity": "sha512-GtNwOs4hcVS2GIbqRUf42rUuX07oLB92cj7cqxZb0ZGWwcwhnmSW0TFLAkNafXmqn9ug4VTpNvcJSUdiuECVKg==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.22.12.tgz", + "integrity": "sha512-xcmww1O/JFP2MrlGUMd3Q78S3Qu6W3mYTXYuIqFq33EorgYHV/HqymHfXy9GjiCJ7OI+7lWx6nYFOzU7M4rd1Q==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/core": "^0.16.2" + "@jimp/core": "^0.22.12" } }, "node_modules/@jimp/gif": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/gif/-/gif-0.16.2.tgz", - "integrity": "sha512-TMdyT9Q0paIKNtT7c5KzQD29CNCsI/t8ka28jMrBjEK7j5RRTvBfuoOnHv7pDJRCjCIqeUoaUSJ7QcciKic6CA==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/gif/-/gif-0.22.12.tgz", + "integrity": "sha512-y6BFTJgch9mbor2H234VSjd9iwAhaNf/t3US5qpYIs0TSbAvM02Fbc28IaDETj9+4YB4676sz4RcN/zwhfu1pg==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "gifwrap": "^0.9.2", + "@jimp/utils": "^0.22.12", + "gifwrap": "^0.10.1", "omggif": "^1.0.9" }, "peerDependencies": { @@ -80,74 +68,68 @@ } }, "node_modules/@jimp/jpeg": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.16.2.tgz", - "integrity": "sha512-BW5gZydgq6wdIwHd+3iUNgrTklvoQc/FUKSj9meM6A0FU21lUaansRX5BDdJqHkyXJLnnlDGwDt27J+hQuBAVw==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.22.12.tgz", + "integrity": "sha512-Rq26XC/uQWaQKyb/5lksCTCxXhtY01NJeBN+dQv5yNYedN0i7iYu+fXEoRsfaJ8xZzjoANH8sns7rVP4GE7d/Q==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "jpeg-js": "^0.4.2" + "@jimp/utils": "^0.22.12", + "jpeg-js": "^0.4.4" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-blit": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.16.2.tgz", - "integrity": "sha512-Z31rRfV80gC/r+B/bOPSVVpJEWXUV248j7MdnMOFLu4vr8DMqXVo9jYqvwU/s4LSTMAMXqm4Jg6E/jQfadPKAg==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.22.12.tgz", + "integrity": "sha512-xslz2ZoFZOPLY8EZ4dC29m168BtDx95D6K80TzgUi8gqT7LY6CsajWO0FAxDwHz6h0eomHMfyGX0stspBrTKnQ==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-blur": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.16.2.tgz", - "integrity": "sha512-ShkJCAzRI+1fAKPuLLgEkixpSpVmKTYaKEFROUcgmrv9AansDXGNCupchqVMTdxf8zPyW8rR1ilvG3OJobufLQ==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.22.12.tgz", + "integrity": "sha512-S0vJADTuh1Q9F+cXAwFPlrKWzDj2F9t/9JAbUvaaDuivpyWuImEKXVz5PUZw2NbpuSHjwssbTpOZ8F13iJX4uw==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-circle": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-circle/-/plugin-circle-0.16.2.tgz", - "integrity": "sha512-6T4z/48F4Z5+YwAVCLOvXQcyGmo0E3WztxCz6XGQf66r4JJK78+zcCDYZFLMx0BGM0091FogNK4QniP8JaOkrA==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-circle/-/plugin-circle-0.22.12.tgz", + "integrity": "sha512-SWVXx1yiuj5jZtMijqUfvVOJBwOifFn0918ou4ftoHgegc5aHWW5dZbYPjvC9fLpvz7oSlptNl2Sxr1zwofjTg==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-color": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.16.2.tgz", - "integrity": "sha512-6oBV0g0J17/7E+aTquvUsgSc85nUbUi+64tIK5eFIDzvjhlqhjGNJYlc46KJMCWIs61qRJayQoZdL/iT/iQuGQ==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.22.12.tgz", + "integrity": "sha512-xImhTE5BpS8xa+mAN6j4sMRWaUgUDLoaGHhJhpC+r7SKKErYDR0WQV4yCE4gP+N0gozD0F3Ka1LUSaMXrn7ZIA==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "tinycolor2": "^1.4.1" + "@jimp/utils": "^0.22.12", + "tinycolor2": "^1.6.0" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-contain": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.16.2.tgz", - "integrity": "sha512-pLcxO3hVN3LCEhMNvpZ9B7xILHVlS433Vv16zFFJxLRqZdYvPLsc+ZzJhjAiHHuEjVblQrktHE3LGeQwGJPo0w==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.22.12.tgz", + "integrity": "sha512-Eo3DmfixJw3N79lWk8q/0SDYbqmKt1xSTJ69yy8XLYQj9svoBbyRpSnHR+n9hOw5pKXytHwUW6nU4u1wegHNoQ==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", @@ -157,12 +139,11 @@ } }, "node_modules/@jimp/plugin-cover": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.16.2.tgz", - "integrity": "sha512-gzWM7VvYeI8msyiwbUZxH+sGQEgO6Vd6adGxZ0CeKX00uQOe5lDzxb1Wjx7sHcJGz8a/5fmAuwz7rdDtpDUbkw==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.22.12.tgz", + "integrity": "sha512-z0w/1xH/v/knZkpTNx+E8a7fnasQ2wHG5ze6y5oL2dhH1UufNua8gLQXlv8/W56+4nJ1brhSd233HBJCo01BXA==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", @@ -172,60 +153,55 @@ } }, "node_modules/@jimp/plugin-crop": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.16.2.tgz", - "integrity": "sha512-qCd3hfMEE+Z2EuuyXewgXRTtKJGIerWzc1zLEJztsUkPz5i73IGgkOL+mrNutZwGaXZbm+8SwUaGb46sxAO6Tw==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.22.12.tgz", + "integrity": "sha512-FNuUN0OVzRCozx8XSgP9MyLGMxNHHJMFt+LJuFjn1mu3k0VQxrzqbN06yIl46TVejhyAhcq5gLzqmSCHvlcBVw==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-displace": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.16.2.tgz", - "integrity": "sha512-6nXdvNNjCdD95v2o3/jPeur903dz08lG4Y8gmr5oL2yVv9LSSbMonoXYrR/ASesdyXqGdXJLU4NL+yZs4zUqbQ==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.22.12.tgz", + "integrity": "sha512-qpRM8JRicxfK6aPPqKZA6+GzBwUIitiHaZw0QrJ64Ygd3+AsTc7BXr+37k2x7QcyCvmKXY4haUrSIsBug4S3CA==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-dither": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.16.2.tgz", - "integrity": "sha512-DERpIzy21ZanMkVsD0Tdy8HQLbD1E41OuvIzaMRoW4183PA6AgGNlrQoFTyXmzjy6FTy1SxaQgTEdouInAWZ9Q==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.22.12.tgz", + "integrity": "sha512-jYgGdSdSKl1UUEanX8A85v4+QUm+PE8vHFwlamaKk89s+PXQe7eVE3eNeSZX4inCq63EHL7cX580dMqkoC3ZLw==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-fisheye": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-fisheye/-/plugin-fisheye-0.16.2.tgz", - "integrity": "sha512-Df7PsGIwiIpQu3EygYCnaJyTfOwvwtYV3cmYJS7yFLtdiFUuod+hlSo5GkwEPLAy+QBxhUbDuUqnsWo4NQtbiQ==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-fisheye/-/plugin-fisheye-0.22.12.tgz", + "integrity": "sha512-LGuUTsFg+fOp6KBKrmLkX4LfyCy8IIsROwoUvsUPKzutSqMJnsm3JGDW2eOmWIS/jJpPaeaishjlxvczjgII+Q==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-flip": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.16.2.tgz", - "integrity": "sha512-+2uC8ioVQUr06mnjSWraskz2L33nJHze35LkQ8ZNsIpoZLkgvfiWatqAs5bj+1jGI/9kxoCFAaT1Is0f+a4/rw==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.22.12.tgz", + "integrity": "sha512-m251Rop7GN8W0Yo/rF9LWk6kNclngyjIJs/VXHToGQ6EGveOSTSQaX2Isi9f9lCDLxt+inBIb7nlaLLxnvHX8Q==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", @@ -233,61 +209,56 @@ } }, "node_modules/@jimp/plugin-gaussian": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.16.2.tgz", - "integrity": "sha512-2mnuDSg4ZEH8zcJig7DZZf4st/cYmQ5UYJKP76iGhZ+6JDACk6uejwAgT5xHecNhkVAaXMdCybA2eknH/9OE1w==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.22.12.tgz", + "integrity": "sha512-sBfbzoOmJ6FczfG2PquiK84NtVGeScw97JsCC3rpQv1PHVWyW+uqWFF53+n3c8Y0P2HWlUjflEla2h/vWShvhg==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-invert": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.16.2.tgz", - "integrity": "sha512-xFvHbVepTY/nus+6yXiYN1iq+UBRkT0MdnObbiQPstUrAsz0Imn6MWISsnAyMvcNxHGrxaxjuU777JT/esM0gg==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.22.12.tgz", + "integrity": "sha512-N+6rwxdB+7OCR6PYijaA/iizXXodpxOGvT/smd/lxeXsZ/empHmFFFJ/FaXcYh19Tm04dGDaXcNF/dN5nm6+xQ==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-mask": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.16.2.tgz", - "integrity": "sha512-AbdO85xxhfgEDdxYKpUotEI9ixiCMaIpfYHD5a5O/VWeimz2kuwhcrzlHGiyq1kKAgRcl0WEneTCZAHVSyvPKA==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.22.12.tgz", + "integrity": "sha512-4AWZg+DomtpUA099jRV8IEZUfn1wLv6+nem4NRJC7L/82vxzLCgXKTxvNvBcNmJjT9yS1LAAmiJGdWKXG63/NA==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-normalize": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.16.2.tgz", - "integrity": "sha512-+ItBWFwmB0Od7OfOtTYT1gm543PpHUgU8/DN55z83l1JqS0OomDJAe7BmCppo2405TN6YtVm/csXo7p4iWd/SQ==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.22.12.tgz", + "integrity": "sha512-0So0rexQivnWgnhacX4cfkM2223YdExnJTTy6d06WbkfZk5alHUx8MM3yEzwoCN0ErO7oyqEWRnEkGC+As1FtA==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-print": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.16.2.tgz", - "integrity": "sha512-ifTGEeJ5UZTCiqC70HMeU3iXk/vsOmhWiwVGOXSFXhFeE8ZpDWvlmBsrMYnRrJGuaaogHOIrrQPI+kCdDBSBIQ==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.22.12.tgz", + "integrity": "sha512-c7TnhHlxm87DJeSnwr/XOLjJU/whoiKYY7r21SbuJ5nuH+7a78EW1teOaj5gEr2wYEd7QtkFqGlmyGXY/YclyQ==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "load-bmfont": "^1.4.0" + "@jimp/utils": "^0.22.12", + "load-bmfont": "^1.4.1" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", @@ -295,24 +266,22 @@ } }, "node_modules/@jimp/plugin-resize": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.16.2.tgz", - "integrity": "sha512-gE4N9l6xuwzacFZ2EPCGZCJ/xR+aX2V7GdMndIl/6kYIw5/eib1SFuF9AZLvIPSFuE1FnGo8+vT0pr++SSbhYg==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.22.12.tgz", + "integrity": "sha512-3NyTPlPbTnGKDIbaBgQ3HbE6wXbAlFfxHVERmrbqAi8R3r6fQPxpCauA8UVDnieg5eo04D0T8nnnNIX//i/sXg==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/plugin-rotate": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.16.2.tgz", - "integrity": "sha512-/CTEYkR1HrgmnE0VqPhhbBARbDAfFX590LWGIpxcYIYsUUGQCadl+8Qo4UX13FH0Nt8UHEtPA+O2x08uPYg9UA==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.22.12.tgz", + "integrity": "sha512-9YNEt7BPAFfTls2FGfKBVgwwLUuKqy+E8bDGGEsOqHtbuhbshVGxN2WMZaD4gh5IDWvR+emmmPPWGgaYNYt1gA==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", @@ -322,12 +291,11 @@ } }, "node_modules/@jimp/plugin-scale": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.16.2.tgz", - "integrity": "sha512-3inuxfrlquyLaqFdiiiQNJUurR0WbvN5wAf1qcYX2LubG1AG8grayYD6H7XVoxfUGTZXh1kpmeirEYlqA2zxcw==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.22.12.tgz", + "integrity": "sha512-dghs92qM6MhHj0HrV2qAwKPMklQtjNpoYgAB94ysYpsXslhRTiPisueSIELRwZGEr0J0VUxpUY7HgJwlSIgGZw==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", @@ -335,12 +303,11 @@ } }, "node_modules/@jimp/plugin-shadow": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-shadow/-/plugin-shadow-0.16.2.tgz", - "integrity": "sha512-Q0aIs2/L6fWMcEh9Ms73u34bT1hyUMw/oxaVoIzOLo6/E8YzCs2Bi63H0/qaPS0MQpEppI++kvosPbblABY79w==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-shadow/-/plugin-shadow-0.22.12.tgz", + "integrity": "sha512-FX8mTJuCt7/3zXVoeD/qHlm4YH2bVqBuWQHXSuBK054e7wFRnRnbSLPUqAwSeYP3lWqpuQzJtgiiBxV3+WWwTg==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", @@ -349,12 +316,11 @@ } }, "node_modules/@jimp/plugin-threshold": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-threshold/-/plugin-threshold-0.16.2.tgz", - "integrity": "sha512-gyOwmBgjtMPvcuyOhkP6dOGWbQdaTfhcBRN22mYeI/k/Wh/Zh1OI21F6eKLApsVRmg15MoFnkrCz64RROC34sw==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-threshold/-/plugin-threshold-0.22.12.tgz", + "integrity": "sha512-4x5GrQr1a/9L0paBC/MZZJjjgjxLYrqSmWd+e+QfAEPvmRxdRoQ5uKEuNgXnm9/weHQBTnQBQsOY2iFja+XGAw==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" }, "peerDependencies": { "@jimp/custom": ">=0.3.5", @@ -363,32 +329,31 @@ } }, "node_modules/@jimp/plugins": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.16.2.tgz", - "integrity": "sha512-zCvYtCgctmC0tkYEu+y+kSwSIZBsNznqJ3/3vkpzxdyjd6wCfNY5Qc/68MPrLc1lmdeGo4cOOTYHG7Vc6myzRw==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/plugin-blit": "^0.16.2", - "@jimp/plugin-blur": "^0.16.2", - "@jimp/plugin-circle": "^0.16.2", - "@jimp/plugin-color": "^0.16.2", - "@jimp/plugin-contain": "^0.16.2", - "@jimp/plugin-cover": "^0.16.2", - "@jimp/plugin-crop": "^0.16.2", - "@jimp/plugin-displace": "^0.16.2", - "@jimp/plugin-dither": "^0.16.2", - "@jimp/plugin-fisheye": "^0.16.2", - "@jimp/plugin-flip": "^0.16.2", - "@jimp/plugin-gaussian": "^0.16.2", - "@jimp/plugin-invert": "^0.16.2", - "@jimp/plugin-mask": "^0.16.2", - "@jimp/plugin-normalize": "^0.16.2", - "@jimp/plugin-print": "^0.16.2", - "@jimp/plugin-resize": "^0.16.2", - "@jimp/plugin-rotate": "^0.16.2", - "@jimp/plugin-scale": "^0.16.2", - "@jimp/plugin-shadow": "^0.16.2", - "@jimp/plugin-threshold": "^0.16.2", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.22.12.tgz", + "integrity": "sha512-yBJ8vQrDkBbTgQZLty9k4+KtUQdRjsIDJSPjuI21YdVeqZxYywifHl4/XWILoTZsjTUASQcGoH0TuC0N7xm3ww==", + "dependencies": { + "@jimp/plugin-blit": "^0.22.12", + "@jimp/plugin-blur": "^0.22.12", + "@jimp/plugin-circle": "^0.22.12", + "@jimp/plugin-color": "^0.22.12", + "@jimp/plugin-contain": "^0.22.12", + "@jimp/plugin-cover": "^0.22.12", + "@jimp/plugin-crop": "^0.22.12", + "@jimp/plugin-displace": "^0.22.12", + "@jimp/plugin-dither": "^0.22.12", + "@jimp/plugin-fisheye": "^0.22.12", + "@jimp/plugin-flip": "^0.22.12", + "@jimp/plugin-gaussian": "^0.22.12", + "@jimp/plugin-invert": "^0.22.12", + "@jimp/plugin-mask": "^0.22.12", + "@jimp/plugin-normalize": "^0.22.12", + "@jimp/plugin-print": "^0.22.12", + "@jimp/plugin-resize": "^0.22.12", + "@jimp/plugin-rotate": "^0.22.12", + "@jimp/plugin-scale": "^0.22.12", + "@jimp/plugin-shadow": "^0.22.12", + "@jimp/plugin-threshold": "^0.22.12", "timm": "^1.6.1" }, "peerDependencies": { @@ -396,41 +361,38 @@ } }, "node_modules/@jimp/png": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/png/-/png-0.16.2.tgz", - "integrity": "sha512-sFOtOSz/tzDwXEChFQ/Nxe+0+vG3Tj0eUxnZVDUG/StXE9dI8Bqmwj3MIa0EgK5s+QG3YlnDOmlPUa4JqmeYeQ==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/png/-/png-0.22.12.tgz", + "integrity": "sha512-Mrp6dr3UTn+aLK8ty/dSKELz+Otdz1v4aAXzV5q53UDD2rbB5joKVJ/ChY310B+eRzNxIovbUF1KVrUsYdE8Hg==", "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "pngjs": "^3.3.3" + "@jimp/utils": "^0.22.12", + "pngjs": "^6.0.0" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/tiff": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.16.2.tgz", - "integrity": "sha512-ADcdqmtZF+U2YoaaHTzFX8D6NFpmN4WZUT0BPMerEuY7Cq8QoLYU22z2h034FrVW+Rbi1b3y04sB9iDiQAlf2w==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.22.12.tgz", + "integrity": "sha512-E1LtMh4RyJsoCAfAkBRVSYyZDTtLq9p9LUiiYP0vPtXyxX4BiYBUYihTLSBlCQg5nF2e4OpQg7SPrLdJ66u7jg==", "dependencies": { - "@babel/runtime": "^7.7.2", - "utif": "^2.0.1" + "utif2": "^4.0.1" }, "peerDependencies": { "@jimp/custom": ">=0.3.5" } }, "node_modules/@jimp/types": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/types/-/types-0.16.2.tgz", - "integrity": "sha512-0Ue5Sq0XnDF6TirisWv5E+8uOnRcd8vRLuwocJOhF76NIlcQrz+5r2k2XWKcr3d+11n28dHLXW5TKSqrUopxhA==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/bmp": "^0.16.2", - "@jimp/gif": "^0.16.2", - "@jimp/jpeg": "^0.16.2", - "@jimp/png": "^0.16.2", - "@jimp/tiff": "^0.16.2", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/types/-/types-0.22.12.tgz", + "integrity": "sha512-wwKYzRdElE1MBXFREvCto5s699izFHNVvALUv79GXNbsOVqlwlOxlWJ8DuyOGIXoLP4JW/m30YyuTtfUJgMRMA==", + "dependencies": { + "@jimp/bmp": "^0.22.12", + "@jimp/gif": "^0.22.12", + "@jimp/jpeg": "^0.22.12", + "@jimp/png": "^0.22.12", + "@jimp/tiff": "^0.22.12", "timm": "^1.6.1" }, "peerDependencies": { @@ -438,14 +400,23 @@ } }, "node_modules/@jimp/utils": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-0.16.2.tgz", - "integrity": "sha512-XENrPvmigiXZQ8E2nxJqO6UVvWBLzbNwyYi3Y8Q1IECoYhYI3kgOQ0fmy4G269Vz1V0omh1bNmC42r4OfXg1Jg==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-0.22.12.tgz", + "integrity": "sha512-yJ5cWUknGnilBq97ZXOyOS0HhsHOyAyjHwYfHxGbSyMTohgQI6sVyE8KPgDwH8HHW/nMKXk8TrSwAE71zt716Q==", "dependencies": { - "@babel/runtime": "^7.7.2", "regenerator-runtime": "^0.13.3" } }, + "node_modules/@tokenizer/token": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", + "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==" + }, + "node_modules/@types/bluebird": { + "version": "3.5.42", + "resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.42.tgz", + "integrity": "sha512-Jhy+MWRlro6UjVi578V/4ZGNfeCOcNCp0YaFNIUGFKlImowqwb1O/22wDVk3FDGMLqxdpOV3qQHD5fPEH4hK6A==" + }, "node_modules/@types/node": { "version": "16.9.1", "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.1.tgz", @@ -468,11 +439,45 @@ "resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz", "integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg==" }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/axios": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz", + "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -492,18 +497,30 @@ } ] }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/bmp-js": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.1.0.tgz", "integrity": "sha512-vHdS19CnY3hwiNdkaqk93DvjVLfbEcI8mys4UjuWrlX1haDmroo8o4xCzh4wD6DGV6HxRCyauwhHRqMTfERtjw==" }, "node_modules/body-parser": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", - "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", "dependencies": { "bytes": "3.1.2", - "content-type": "~1.0.4", + "content-type": "~1.0.5", "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", @@ -511,7 +528,7 @@ "iconv-lite": "0.4.24", "on-finished": "2.4.1", "qs": "6.11.0", - "raw-body": "2.5.1", + "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" }, @@ -520,6 +537,28 @@ "npm": "1.2.8000 || >= 1.4.16" } }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/buffer": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", @@ -560,17 +599,64 @@ } }, "node_modules/call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dependencies": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, "node_modules/content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", @@ -583,17 +669,17 @@ } }, "node_modules/content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", "engines": { "node": ">= 0.6" } }, "node_modules/cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", "engines": { "node": ">= 0.6" } @@ -611,6 +697,30 @@ "ms": "2.0.0" } }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -646,6 +756,25 @@ "node": ">= 0.8" } }, + "node_modules/es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -665,16 +794,16 @@ "integrity": "sha512-c2bQfLNbMzLPmzQuOr8fy0csy84WmwnER81W88DzTp9CYNPJ6yzOj2EZAh9pywYpqHnshVLHQJ8WzldAyfY+Iw==" }, "node_modules/express": { - "version": "4.18.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", - "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", + "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.1", + "body-parser": "1.20.2", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.5.0", + "cookie": "0.6.0", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", @@ -706,11 +835,31 @@ } }, "node_modules/file-type": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-9.0.0.tgz", - "integrity": "sha512-Qe/5NJrgIOlwijpq3B7BEpzPFcgzggOTagZmkXQY4LA6bsXKTUstK7Wp12lEJ/mLKTpvIZxmIuRcLYWT6ov9lw==", + "version": "16.5.4", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.4.tgz", + "integrity": "sha512-/yFHK0aGjFEgDJjEKP0pWCplsPFPhwyfwevf/pVxiN0tmE4L9LmwWxWukdJSHdoCli4VgQLehjJtwQBnqmsKcw==", + "dependencies": { + "readable-web-to-node-stream": "^3.0.0", + "strtok3": "^6.2.4", + "token-types": "^4.1.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/file-type?sponsor=1" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, "engines": { - "node": ">=6" + "node": ">=8" } }, "node_modules/finalhandler": { @@ -730,6 +879,38 @@ "node": ">= 0.8" } }, + "node_modules/follow-redirects": { + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -746,33 +927,67 @@ "node": ">= 0.6" } }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, "node_modules/get-intrinsic": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", - "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", - "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.3" + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/gifwrap": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/gifwrap/-/gifwrap-0.9.4.tgz", - "integrity": "sha512-MDMwbhASQuVeD4JKd1fKgNgCRL3fGqMM4WaqpNhWO0JiMOAjbQdumbs4BbBZEy9/M00EHEjKN3HieVhCUlwjeQ==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/gifwrap/-/gifwrap-0.10.1.tgz", + "integrity": "sha512-2760b1vpJHNmLzZ/ubTtNnEx5WApN/PYWJvXvgS+tL1egTTthayFYIQQNi136FLEDcN/IyEY2EcGpIITD6eYUw==", "dependencies": { "image-q": "^4.0.0", "omggif": "^1.0.10" } }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/global": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", @@ -782,15 +997,46 @@ "process": "^0.11.10" } }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "node_modules/gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", "dependencies": { - "function-bind": "^1.1.1" + "get-intrinsic": "^1.1.3" }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, "engines": { - "node": ">= 0.4.0" + "node": ">=4" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, "node_modules/has-symbols": { @@ -804,6 +1050,17 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", @@ -849,6 +1106,12 @@ } ] }, + "node_modules/ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true + }, "node_modules/image-q": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/image-q/-/image-q-4.0.0.tgz", @@ -870,20 +1133,70 @@ "node": ">= 0.10" } }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-function": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz", "integrity": "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==" }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/isomorphic-fetch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz", + "integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==", + "dependencies": { + "node-fetch": "^2.6.1", + "whatwg-fetch": "^3.4.1" + } + }, "node_modules/jimp": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/jimp/-/jimp-0.16.2.tgz", - "integrity": "sha512-UpItBk81a92f8oEyoGYbO3YK4QcM0hoIyuGHmShoF9Ov63P5Qo7Q/X2xsAgnODmSuDJFOtrPtJd5GSWW4LKdOQ==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "@jimp/custom": "^0.16.2", - "@jimp/plugins": "^0.16.2", - "@jimp/types": "^0.16.2", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/jimp/-/jimp-0.22.12.tgz", + "integrity": "sha512-R5jZaYDnfkxKJy1dwLpj/7cvyjxiclxU3F4TrI/J4j2rS0niq6YDUMoPn5hs8GDpO+OZGo7Ky057CRtWesyhfg==", + "dependencies": { + "@jimp/custom": "^0.22.12", + "@jimp/plugins": "^0.22.12", + "@jimp/types": "^0.22.12", "regenerator-runtime": "^0.13.3" } }, @@ -966,23 +1279,16 @@ "dom-walk": "^0.1.0" } }, - "node_modules/minimist": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", - "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/mkdirp": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", - "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, "dependencies": { - "minimist": "^1.2.6" + "brace-expansion": "^1.1.7" }, - "bin": { - "mkdirp": "bin/cmd.js" + "engines": { + "node": "*" } }, "node_modules/ms": { @@ -998,10 +1304,89 @@ "node": ">= 0.6" } }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/nodemon": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.1.tgz", + "integrity": "sha512-k43xGaDtaDIcufn0Fc6fTtsdKSkV/hQzoQFigNH//GaKta28yoKVYXCnV+KXRqfT/YzsFaQU9VdeEG+HEyxr6A==", + "dev": true, + "dependencies": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.1.2", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "bin": { + "nodemon": "bin/nodemon.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nodemon" + } + }, + "node_modules/nodemon/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/nodemon/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/object-inspect": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", - "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -1038,12 +1423,12 @@ "integrity": "sha512-GxmsRea0wdGdYthjuUeWTMWPqm2+FAd4GI8vCvhgJsFnoGhTrLhXDDupwTo7rXVAgaLIGoVHDZS9p/5XbSqeWA==" }, "node_modules/parse-bmfont-xml": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.4.tgz", - "integrity": "sha512-bjnliEOmGv3y1aMEfREMBJ9tfL3WR0i0CKPj61DnSLaoxWR3nLrsQrEbCId/8rF4NyRF0cCqisSVXyQYWM+mCQ==", + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.6.tgz", + "integrity": "sha512-0cEliVMZEhrFDwMh4SxIyVJpqYoOWDJ9P895tFuS+XuNzI5UBmBk5U5O4KuJdTnZpSBI4LFA2+ZiJaiwfSwlMA==", "dependencies": { "xml-parse-from-string": "^1.0.0", - "xml2js": "^0.4.5" + "xml2js": "^0.5.0" } }, "node_modules/parse-headers": { @@ -1064,10 +1449,35 @@ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" }, + "node_modules/peek-readable": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-4.1.0.tgz", + "integrity": "sha512-ZI3LnwUv5nOGbQzD9c2iDG6toheuXSZP5esSHBjopsXH4dg19soufvpUGA3uohi5anFtGb2lhAVdHzH6R/Evvg==", + "engines": { + "node": ">=8" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, "node_modules/phin": { "version": "2.9.3", "resolved": "https://registry.npmjs.org/phin/-/phin-2.9.3.tgz", - "integrity": "sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==" + "integrity": "sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info." + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } }, "node_modules/pixelmatch": { "version": "4.0.2", @@ -1080,7 +1490,7 @@ "pixelmatch": "bin/pixelmatch" } }, - "node_modules/pngjs": { + "node_modules/pixelmatch/node_modules/pngjs": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==", @@ -1088,6 +1498,14 @@ "node": ">=4.0.0" } }, + "node_modules/pngjs": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-6.0.0.tgz", + "integrity": "sha512-TRzzuFRRmEoSW/p1KVAmiOgPco2Irlah+bGFCeNfJXxxYGwSw7YwAOAcd7X28K/m5bjBWKsC29KyoMfHbypayg==", + "engines": { + "node": ">=12.13.0" + } + }, "node_modules/process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", @@ -1108,6 +1526,17 @@ "node": ">= 0.10" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, + "node_modules/pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true + }, "node_modules/qs": { "version": "6.11.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", @@ -1131,9 +1560,9 @@ } }, "node_modules/raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", "dependencies": { "bytes": "3.1.2", "http-errors": "2.0.0", @@ -1144,6 +1573,46 @@ "node": ">= 0.8" } }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readable-web-to-node-stream": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz", + "integrity": "sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw==", + "dependencies": { + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, "node_modules/regenerator-runtime": { "version": "0.13.11", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", @@ -1174,9 +1643,21 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "node_modules/sax": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.3.0.tgz", + "integrity": "sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA==" + }, + "node_modules/semver": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } }, "node_modules/send": { "version": "0.18.0", @@ -1220,24 +1701,56 @@ "node": ">= 0.8.0" } }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/setprototypeof": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" }, "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + }, + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/statuses": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", @@ -1246,17 +1759,62 @@ "node": ">= 0.8" } }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/strtok3": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-6.3.0.tgz", + "integrity": "sha512-fZtbhtvI9I48xDSywd/somNqgUHl2L2cstmXCCif0itOf96jeW18MBSyrLuNicYQVkvpOxkZtkzujiTJ9LW5Jw==", + "dependencies": { + "@tokenizer/token": "^0.3.0", + "peek-readable": "^4.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/timm": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/timm/-/timm-1.7.1.tgz", "integrity": "sha512-IjZc9KIotudix8bMaBW6QvMuq64BrJWFs1+4V0lXwWGQZwH+LnX87doAYhem4caOEusRP9/g6jVDQmZ8XOk1nw==" }, "node_modules/tinycolor2": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.5.1.tgz", - "integrity": "sha512-BHlrsGeYN2OpkRpfAgkEwCMu6w8Quq8JkK/mp4c55NZP7OwceJObR1CPZt62TqiA0Y3J5pwuDX+fXDqc35REtg==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.6.0.tgz", + "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==" + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, "engines": { - "node": "*" + "node": ">=8.0" } }, "node_modules/toidentifier": { @@ -1267,6 +1825,36 @@ "node": ">=0.6" } }, + "node_modules/token-types": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/token-types/-/token-types-4.2.1.tgz", + "integrity": "sha512-6udB24Q737UD/SDsKAHI9FCRP7Bqc9D/MQUV02ORQg5iskjtLJlZJNdN4kKtcdtwCeWIwIHDGaUsTsCCAa8sFQ==", + "dependencies": { + "@tokenizer/token": "^0.3.0", + "ieee754": "^1.2.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Borewit" + } + }, + "node_modules/touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true, + "bin": { + "nodetouch": "bin/nodetouch.js" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "node_modules/type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", @@ -1279,6 +1867,12 @@ "node": ">= 0.6" } }, + "node_modules/undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true + }, "node_modules/unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", @@ -1287,14 +1881,19 @@ "node": ">= 0.8" } }, - "node_modules/utif": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/utif/-/utif-2.0.1.tgz", - "integrity": "sha512-Z/S1fNKCicQTf375lIP9G8Sa1H/phcysstNrrSdZKj1f9g58J4NMgb5IgiEZN9/nLMPDwF0W7hdOe9Qq2IYoLg==", + "node_modules/utif2": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/utif2/-/utif2-4.1.0.tgz", + "integrity": "sha512-+oknB9FHrJ7oW7A2WZYajOcv4FcDR4CfoGB0dPNfxbi4GO05RRnFmt5oa23+9w32EanrYcSJWspUiJkLMs+37w==", "dependencies": { - "pako": "^1.0.5" + "pako": "^1.0.11" } }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, "node_modules/utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", @@ -1311,6 +1910,25 @@ "node": ">= 0.8" } }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/whatwg-fetch": { + "version": "3.6.20", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz", + "integrity": "sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "node_modules/xhr": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.6.0.tgz", @@ -1328,9 +1946,9 @@ "integrity": "sha512-ErcKwJTF54uRzzNMXq2X5sMIy88zJvfN2DmdoQvy7PAFJ+tPRU6ydWuOKNMyfmOjdyBQTFREi60s0Y0SyI0G0g==" }, "node_modules/xml2js": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", - "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz", + "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==", "dependencies": { "sax": ">=0.6.0", "xmlbuilder": "~11.0.0" @@ -1357,335 +1975,304 @@ } }, "dependencies": { - "@babel/runtime": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz", - "integrity": "sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==", - "requires": { - "regenerator-runtime": "^0.13.11" - } - }, "@jimp/bmp": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.16.2.tgz", - "integrity": "sha512-4g9vW45QfMoGhLVvaFj26h4e7cC+McHUQwyFQmNTLW4FfC1OonN9oUr2m/FEDGkTYKR7aqdXR5XUqqIkHWLaFw==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/bmp/-/bmp-0.22.12.tgz", + "integrity": "sha512-aeI64HD0npropd+AR76MCcvvRaa+Qck6loCOS03CkkxGHN5/r336qTM5HPUdHKMDOGzqknuVPA8+kK1t03z12g==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", + "@jimp/utils": "^0.22.12", "bmp-js": "^0.1.0" } }, "@jimp/core": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/core/-/core-0.16.2.tgz", - "integrity": "sha512-dp7HcyUMzjXphXYodI6PaXue+I9PXAavbb+AN+1XqFbotN22Z12DosNPEyy+UhLY/hZiQQqUkEaJHkvV31rs+w==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/core/-/core-0.22.12.tgz", + "integrity": "sha512-l0RR0dOPyzMKfjUW1uebzueFEDtCOj9fN6pyTYWWOM/VS4BciXQ1VVrJs8pO3kycGYZxncRKhCoygbNr8eEZQA==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", + "@jimp/utils": "^0.22.12", "any-base": "^1.1.0", "buffer": "^5.2.0", "exif-parser": "^0.1.12", - "file-type": "^9.0.0", - "load-bmfont": "^1.3.1", - "mkdirp": "^0.5.1", - "phin": "^2.9.1", + "file-type": "^16.5.4", + "isomorphic-fetch": "^3.0.0", "pixelmatch": "^4.0.2", - "tinycolor2": "^1.4.1" + "tinycolor2": "^1.6.0" } }, "@jimp/custom": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.16.2.tgz", - "integrity": "sha512-GtNwOs4hcVS2GIbqRUf42rUuX07oLB92cj7cqxZb0ZGWwcwhnmSW0TFLAkNafXmqn9ug4VTpNvcJSUdiuECVKg==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.22.12.tgz", + "integrity": "sha512-xcmww1O/JFP2MrlGUMd3Q78S3Qu6W3mYTXYuIqFq33EorgYHV/HqymHfXy9GjiCJ7OI+7lWx6nYFOzU7M4rd1Q==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/core": "^0.16.2" + "@jimp/core": "^0.22.12" } }, "@jimp/gif": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/gif/-/gif-0.16.2.tgz", - "integrity": "sha512-TMdyT9Q0paIKNtT7c5KzQD29CNCsI/t8ka28jMrBjEK7j5RRTvBfuoOnHv7pDJRCjCIqeUoaUSJ7QcciKic6CA==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/gif/-/gif-0.22.12.tgz", + "integrity": "sha512-y6BFTJgch9mbor2H234VSjd9iwAhaNf/t3US5qpYIs0TSbAvM02Fbc28IaDETj9+4YB4676sz4RcN/zwhfu1pg==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "gifwrap": "^0.9.2", + "@jimp/utils": "^0.22.12", + "gifwrap": "^0.10.1", "omggif": "^1.0.9" } }, "@jimp/jpeg": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.16.2.tgz", - "integrity": "sha512-BW5gZydgq6wdIwHd+3iUNgrTklvoQc/FUKSj9meM6A0FU21lUaansRX5BDdJqHkyXJLnnlDGwDt27J+hQuBAVw==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/jpeg/-/jpeg-0.22.12.tgz", + "integrity": "sha512-Rq26XC/uQWaQKyb/5lksCTCxXhtY01NJeBN+dQv5yNYedN0i7iYu+fXEoRsfaJ8xZzjoANH8sns7rVP4GE7d/Q==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "jpeg-js": "^0.4.2" + "@jimp/utils": "^0.22.12", + "jpeg-js": "^0.4.4" } }, "@jimp/plugin-blit": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.16.2.tgz", - "integrity": "sha512-Z31rRfV80gC/r+B/bOPSVVpJEWXUV248j7MdnMOFLu4vr8DMqXVo9jYqvwU/s4LSTMAMXqm4Jg6E/jQfadPKAg==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-blit/-/plugin-blit-0.22.12.tgz", + "integrity": "sha512-xslz2ZoFZOPLY8EZ4dC29m168BtDx95D6K80TzgUi8gqT7LY6CsajWO0FAxDwHz6h0eomHMfyGX0stspBrTKnQ==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" } }, "@jimp/plugin-blur": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.16.2.tgz", - "integrity": "sha512-ShkJCAzRI+1fAKPuLLgEkixpSpVmKTYaKEFROUcgmrv9AansDXGNCupchqVMTdxf8zPyW8rR1ilvG3OJobufLQ==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-blur/-/plugin-blur-0.22.12.tgz", + "integrity": "sha512-S0vJADTuh1Q9F+cXAwFPlrKWzDj2F9t/9JAbUvaaDuivpyWuImEKXVz5PUZw2NbpuSHjwssbTpOZ8F13iJX4uw==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" } }, "@jimp/plugin-circle": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-circle/-/plugin-circle-0.16.2.tgz", - "integrity": "sha512-6T4z/48F4Z5+YwAVCLOvXQcyGmo0E3WztxCz6XGQf66r4JJK78+zcCDYZFLMx0BGM0091FogNK4QniP8JaOkrA==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-circle/-/plugin-circle-0.22.12.tgz", + "integrity": "sha512-SWVXx1yiuj5jZtMijqUfvVOJBwOifFn0918ou4ftoHgegc5aHWW5dZbYPjvC9fLpvz7oSlptNl2Sxr1zwofjTg==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" } }, "@jimp/plugin-color": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.16.2.tgz", - "integrity": "sha512-6oBV0g0J17/7E+aTquvUsgSc85nUbUi+64tIK5eFIDzvjhlqhjGNJYlc46KJMCWIs61qRJayQoZdL/iT/iQuGQ==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-color/-/plugin-color-0.22.12.tgz", + "integrity": "sha512-xImhTE5BpS8xa+mAN6j4sMRWaUgUDLoaGHhJhpC+r7SKKErYDR0WQV4yCE4gP+N0gozD0F3Ka1LUSaMXrn7ZIA==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "tinycolor2": "^1.4.1" + "@jimp/utils": "^0.22.12", + "tinycolor2": "^1.6.0" } }, "@jimp/plugin-contain": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.16.2.tgz", - "integrity": "sha512-pLcxO3hVN3LCEhMNvpZ9B7xILHVlS433Vv16zFFJxLRqZdYvPLsc+ZzJhjAiHHuEjVblQrktHE3LGeQwGJPo0w==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-contain/-/plugin-contain-0.22.12.tgz", + "integrity": "sha512-Eo3DmfixJw3N79lWk8q/0SDYbqmKt1xSTJ69yy8XLYQj9svoBbyRpSnHR+n9hOw5pKXytHwUW6nU4u1wegHNoQ==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" } }, "@jimp/plugin-cover": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.16.2.tgz", - "integrity": "sha512-gzWM7VvYeI8msyiwbUZxH+sGQEgO6Vd6adGxZ0CeKX00uQOe5lDzxb1Wjx7sHcJGz8a/5fmAuwz7rdDtpDUbkw==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-cover/-/plugin-cover-0.22.12.tgz", + "integrity": "sha512-z0w/1xH/v/knZkpTNx+E8a7fnasQ2wHG5ze6y5oL2dhH1UufNua8gLQXlv8/W56+4nJ1brhSd233HBJCo01BXA==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" } }, "@jimp/plugin-crop": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.16.2.tgz", - "integrity": "sha512-qCd3hfMEE+Z2EuuyXewgXRTtKJGIerWzc1zLEJztsUkPz5i73IGgkOL+mrNutZwGaXZbm+8SwUaGb46sxAO6Tw==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-crop/-/plugin-crop-0.22.12.tgz", + "integrity": "sha512-FNuUN0OVzRCozx8XSgP9MyLGMxNHHJMFt+LJuFjn1mu3k0VQxrzqbN06yIl46TVejhyAhcq5gLzqmSCHvlcBVw==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" } }, "@jimp/plugin-displace": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.16.2.tgz", - "integrity": "sha512-6nXdvNNjCdD95v2o3/jPeur903dz08lG4Y8gmr5oL2yVv9LSSbMonoXYrR/ASesdyXqGdXJLU4NL+yZs4zUqbQ==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-displace/-/plugin-displace-0.22.12.tgz", + "integrity": "sha512-qpRM8JRicxfK6aPPqKZA6+GzBwUIitiHaZw0QrJ64Ygd3+AsTc7BXr+37k2x7QcyCvmKXY4haUrSIsBug4S3CA==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" } }, "@jimp/plugin-dither": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.16.2.tgz", - "integrity": "sha512-DERpIzy21ZanMkVsD0Tdy8HQLbD1E41OuvIzaMRoW4183PA6AgGNlrQoFTyXmzjy6FTy1SxaQgTEdouInAWZ9Q==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-dither/-/plugin-dither-0.22.12.tgz", + "integrity": "sha512-jYgGdSdSKl1UUEanX8A85v4+QUm+PE8vHFwlamaKk89s+PXQe7eVE3eNeSZX4inCq63EHL7cX580dMqkoC3ZLw==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" } }, "@jimp/plugin-fisheye": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-fisheye/-/plugin-fisheye-0.16.2.tgz", - "integrity": "sha512-Df7PsGIwiIpQu3EygYCnaJyTfOwvwtYV3cmYJS7yFLtdiFUuod+hlSo5GkwEPLAy+QBxhUbDuUqnsWo4NQtbiQ==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-fisheye/-/plugin-fisheye-0.22.12.tgz", + "integrity": "sha512-LGuUTsFg+fOp6KBKrmLkX4LfyCy8IIsROwoUvsUPKzutSqMJnsm3JGDW2eOmWIS/jJpPaeaishjlxvczjgII+Q==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" } }, "@jimp/plugin-flip": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.16.2.tgz", - "integrity": "sha512-+2uC8ioVQUr06mnjSWraskz2L33nJHze35LkQ8ZNsIpoZLkgvfiWatqAs5bj+1jGI/9kxoCFAaT1Is0f+a4/rw==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-flip/-/plugin-flip-0.22.12.tgz", + "integrity": "sha512-m251Rop7GN8W0Yo/rF9LWk6kNclngyjIJs/VXHToGQ6EGveOSTSQaX2Isi9f9lCDLxt+inBIb7nlaLLxnvHX8Q==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" } }, "@jimp/plugin-gaussian": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.16.2.tgz", - "integrity": "sha512-2mnuDSg4ZEH8zcJig7DZZf4st/cYmQ5UYJKP76iGhZ+6JDACk6uejwAgT5xHecNhkVAaXMdCybA2eknH/9OE1w==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-gaussian/-/plugin-gaussian-0.22.12.tgz", + "integrity": "sha512-sBfbzoOmJ6FczfG2PquiK84NtVGeScw97JsCC3rpQv1PHVWyW+uqWFF53+n3c8Y0P2HWlUjflEla2h/vWShvhg==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" } }, "@jimp/plugin-invert": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.16.2.tgz", - "integrity": "sha512-xFvHbVepTY/nus+6yXiYN1iq+UBRkT0MdnObbiQPstUrAsz0Imn6MWISsnAyMvcNxHGrxaxjuU777JT/esM0gg==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-invert/-/plugin-invert-0.22.12.tgz", + "integrity": "sha512-N+6rwxdB+7OCR6PYijaA/iizXXodpxOGvT/smd/lxeXsZ/empHmFFFJ/FaXcYh19Tm04dGDaXcNF/dN5nm6+xQ==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" } }, "@jimp/plugin-mask": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.16.2.tgz", - "integrity": "sha512-AbdO85xxhfgEDdxYKpUotEI9ixiCMaIpfYHD5a5O/VWeimz2kuwhcrzlHGiyq1kKAgRcl0WEneTCZAHVSyvPKA==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-mask/-/plugin-mask-0.22.12.tgz", + "integrity": "sha512-4AWZg+DomtpUA099jRV8IEZUfn1wLv6+nem4NRJC7L/82vxzLCgXKTxvNvBcNmJjT9yS1LAAmiJGdWKXG63/NA==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" } }, "@jimp/plugin-normalize": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.16.2.tgz", - "integrity": "sha512-+ItBWFwmB0Od7OfOtTYT1gm543PpHUgU8/DN55z83l1JqS0OomDJAe7BmCppo2405TN6YtVm/csXo7p4iWd/SQ==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-normalize/-/plugin-normalize-0.22.12.tgz", + "integrity": "sha512-0So0rexQivnWgnhacX4cfkM2223YdExnJTTy6d06WbkfZk5alHUx8MM3yEzwoCN0ErO7oyqEWRnEkGC+As1FtA==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" } }, "@jimp/plugin-print": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.16.2.tgz", - "integrity": "sha512-ifTGEeJ5UZTCiqC70HMeU3iXk/vsOmhWiwVGOXSFXhFeE8ZpDWvlmBsrMYnRrJGuaaogHOIrrQPI+kCdDBSBIQ==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-print/-/plugin-print-0.22.12.tgz", + "integrity": "sha512-c7TnhHlxm87DJeSnwr/XOLjJU/whoiKYY7r21SbuJ5nuH+7a78EW1teOaj5gEr2wYEd7QtkFqGlmyGXY/YclyQ==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "load-bmfont": "^1.4.0" + "@jimp/utils": "^0.22.12", + "load-bmfont": "^1.4.1" } }, "@jimp/plugin-resize": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.16.2.tgz", - "integrity": "sha512-gE4N9l6xuwzacFZ2EPCGZCJ/xR+aX2V7GdMndIl/6kYIw5/eib1SFuF9AZLvIPSFuE1FnGo8+vT0pr++SSbhYg==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-resize/-/plugin-resize-0.22.12.tgz", + "integrity": "sha512-3NyTPlPbTnGKDIbaBgQ3HbE6wXbAlFfxHVERmrbqAi8R3r6fQPxpCauA8UVDnieg5eo04D0T8nnnNIX//i/sXg==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" } }, "@jimp/plugin-rotate": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.16.2.tgz", - "integrity": "sha512-/CTEYkR1HrgmnE0VqPhhbBARbDAfFX590LWGIpxcYIYsUUGQCadl+8Qo4UX13FH0Nt8UHEtPA+O2x08uPYg9UA==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-rotate/-/plugin-rotate-0.22.12.tgz", + "integrity": "sha512-9YNEt7BPAFfTls2FGfKBVgwwLUuKqy+E8bDGGEsOqHtbuhbshVGxN2WMZaD4gh5IDWvR+emmmPPWGgaYNYt1gA==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" } }, "@jimp/plugin-scale": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.16.2.tgz", - "integrity": "sha512-3inuxfrlquyLaqFdiiiQNJUurR0WbvN5wAf1qcYX2LubG1AG8grayYD6H7XVoxfUGTZXh1kpmeirEYlqA2zxcw==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-scale/-/plugin-scale-0.22.12.tgz", + "integrity": "sha512-dghs92qM6MhHj0HrV2qAwKPMklQtjNpoYgAB94ysYpsXslhRTiPisueSIELRwZGEr0J0VUxpUY7HgJwlSIgGZw==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" } }, "@jimp/plugin-shadow": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-shadow/-/plugin-shadow-0.16.2.tgz", - "integrity": "sha512-Q0aIs2/L6fWMcEh9Ms73u34bT1hyUMw/oxaVoIzOLo6/E8YzCs2Bi63H0/qaPS0MQpEppI++kvosPbblABY79w==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-shadow/-/plugin-shadow-0.22.12.tgz", + "integrity": "sha512-FX8mTJuCt7/3zXVoeD/qHlm4YH2bVqBuWQHXSuBK054e7wFRnRnbSLPUqAwSeYP3lWqpuQzJtgiiBxV3+WWwTg==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" } }, "@jimp/plugin-threshold": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugin-threshold/-/plugin-threshold-0.16.2.tgz", - "integrity": "sha512-gyOwmBgjtMPvcuyOhkP6dOGWbQdaTfhcBRN22mYeI/k/Wh/Zh1OI21F6eKLApsVRmg15MoFnkrCz64RROC34sw==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugin-threshold/-/plugin-threshold-0.22.12.tgz", + "integrity": "sha512-4x5GrQr1a/9L0paBC/MZZJjjgjxLYrqSmWd+e+QfAEPvmRxdRoQ5uKEuNgXnm9/weHQBTnQBQsOY2iFja+XGAw==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2" + "@jimp/utils": "^0.22.12" } }, "@jimp/plugins": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.16.2.tgz", - "integrity": "sha512-zCvYtCgctmC0tkYEu+y+kSwSIZBsNznqJ3/3vkpzxdyjd6wCfNY5Qc/68MPrLc1lmdeGo4cOOTYHG7Vc6myzRw==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/plugin-blit": "^0.16.2", - "@jimp/plugin-blur": "^0.16.2", - "@jimp/plugin-circle": "^0.16.2", - "@jimp/plugin-color": "^0.16.2", - "@jimp/plugin-contain": "^0.16.2", - "@jimp/plugin-cover": "^0.16.2", - "@jimp/plugin-crop": "^0.16.2", - "@jimp/plugin-displace": "^0.16.2", - "@jimp/plugin-dither": "^0.16.2", - "@jimp/plugin-fisheye": "^0.16.2", - "@jimp/plugin-flip": "^0.16.2", - "@jimp/plugin-gaussian": "^0.16.2", - "@jimp/plugin-invert": "^0.16.2", - "@jimp/plugin-mask": "^0.16.2", - "@jimp/plugin-normalize": "^0.16.2", - "@jimp/plugin-print": "^0.16.2", - "@jimp/plugin-resize": "^0.16.2", - "@jimp/plugin-rotate": "^0.16.2", - "@jimp/plugin-scale": "^0.16.2", - "@jimp/plugin-shadow": "^0.16.2", - "@jimp/plugin-threshold": "^0.16.2", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/plugins/-/plugins-0.22.12.tgz", + "integrity": "sha512-yBJ8vQrDkBbTgQZLty9k4+KtUQdRjsIDJSPjuI21YdVeqZxYywifHl4/XWILoTZsjTUASQcGoH0TuC0N7xm3ww==", + "requires": { + "@jimp/plugin-blit": "^0.22.12", + "@jimp/plugin-blur": "^0.22.12", + "@jimp/plugin-circle": "^0.22.12", + "@jimp/plugin-color": "^0.22.12", + "@jimp/plugin-contain": "^0.22.12", + "@jimp/plugin-cover": "^0.22.12", + "@jimp/plugin-crop": "^0.22.12", + "@jimp/plugin-displace": "^0.22.12", + "@jimp/plugin-dither": "^0.22.12", + "@jimp/plugin-fisheye": "^0.22.12", + "@jimp/plugin-flip": "^0.22.12", + "@jimp/plugin-gaussian": "^0.22.12", + "@jimp/plugin-invert": "^0.22.12", + "@jimp/plugin-mask": "^0.22.12", + "@jimp/plugin-normalize": "^0.22.12", + "@jimp/plugin-print": "^0.22.12", + "@jimp/plugin-resize": "^0.22.12", + "@jimp/plugin-rotate": "^0.22.12", + "@jimp/plugin-scale": "^0.22.12", + "@jimp/plugin-shadow": "^0.22.12", + "@jimp/plugin-threshold": "^0.22.12", "timm": "^1.6.1" } }, "@jimp/png": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/png/-/png-0.16.2.tgz", - "integrity": "sha512-sFOtOSz/tzDwXEChFQ/Nxe+0+vG3Tj0eUxnZVDUG/StXE9dI8Bqmwj3MIa0EgK5s+QG3YlnDOmlPUa4JqmeYeQ==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/png/-/png-0.22.12.tgz", + "integrity": "sha512-Mrp6dr3UTn+aLK8ty/dSKELz+Otdz1v4aAXzV5q53UDD2rbB5joKVJ/ChY310B+eRzNxIovbUF1KVrUsYdE8Hg==", "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/utils": "^0.16.2", - "pngjs": "^3.3.3" + "@jimp/utils": "^0.22.12", + "pngjs": "^6.0.0" } }, "@jimp/tiff": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.16.2.tgz", - "integrity": "sha512-ADcdqmtZF+U2YoaaHTzFX8D6NFpmN4WZUT0BPMerEuY7Cq8QoLYU22z2h034FrVW+Rbi1b3y04sB9iDiQAlf2w==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/tiff/-/tiff-0.22.12.tgz", + "integrity": "sha512-E1LtMh4RyJsoCAfAkBRVSYyZDTtLq9p9LUiiYP0vPtXyxX4BiYBUYihTLSBlCQg5nF2e4OpQg7SPrLdJ66u7jg==", "requires": { - "@babel/runtime": "^7.7.2", - "utif": "^2.0.1" + "utif2": "^4.0.1" } }, "@jimp/types": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/types/-/types-0.16.2.tgz", - "integrity": "sha512-0Ue5Sq0XnDF6TirisWv5E+8uOnRcd8vRLuwocJOhF76NIlcQrz+5r2k2XWKcr3d+11n28dHLXW5TKSqrUopxhA==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/bmp": "^0.16.2", - "@jimp/gif": "^0.16.2", - "@jimp/jpeg": "^0.16.2", - "@jimp/png": "^0.16.2", - "@jimp/tiff": "^0.16.2", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/types/-/types-0.22.12.tgz", + "integrity": "sha512-wwKYzRdElE1MBXFREvCto5s699izFHNVvALUv79GXNbsOVqlwlOxlWJ8DuyOGIXoLP4JW/m30YyuTtfUJgMRMA==", + "requires": { + "@jimp/bmp": "^0.22.12", + "@jimp/gif": "^0.22.12", + "@jimp/jpeg": "^0.22.12", + "@jimp/png": "^0.22.12", + "@jimp/tiff": "^0.22.12", "timm": "^1.6.1" } }, "@jimp/utils": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-0.16.2.tgz", - "integrity": "sha512-XENrPvmigiXZQ8E2nxJqO6UVvWBLzbNwyYi3Y8Q1IECoYhYI3kgOQ0fmy4G269Vz1V0omh1bNmC42r4OfXg1Jg==", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/@jimp/utils/-/utils-0.22.12.tgz", + "integrity": "sha512-yJ5cWUknGnilBq97ZXOyOS0HhsHOyAyjHwYfHxGbSyMTohgQI6sVyE8KPgDwH8HHW/nMKXk8TrSwAE71zt716Q==", "requires": { - "@babel/runtime": "^7.7.2", "regenerator-runtime": "^0.13.3" } }, + "@tokenizer/token": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz", + "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==" + }, + "@types/bluebird": { + "version": "3.5.42", + "resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.42.tgz", + "integrity": "sha512-Jhy+MWRlro6UjVi578V/4ZGNfeCOcNCp0YaFNIUGFKlImowqwb1O/22wDVk3FDGMLqxdpOV3qQHD5fPEH4hK6A==" + }, "@types/node": { "version": "16.9.1", "resolved": "https://registry.npmjs.org/@types/node/-/node-16.9.1.tgz", @@ -1705,28 +2292,65 @@ "resolved": "https://registry.npmjs.org/any-base/-/any-base-1.1.0.tgz", "integrity": "sha512-uMgjozySS8adZZYePpaWs8cxB9/kdzmpX6SgJZ+wbz1K5eYk5QMYDVJaZKhxyIHUdnnJkfR7SVgStgH7LkGUyg==" }, + "anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, "array-flatten": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "axios": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz", + "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==", + "requires": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, "base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" }, + "binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true + }, "bmp-js": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/bmp-js/-/bmp-js-0.1.0.tgz", "integrity": "sha512-vHdS19CnY3hwiNdkaqk93DvjVLfbEcI8mys4UjuWrlX1haDmroo8o4xCzh4wD6DGV6HxRCyauwhHRqMTfERtjw==" }, "body-parser": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", - "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", + "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", "requires": { "bytes": "3.1.2", - "content-type": "~1.0.4", + "content-type": "~1.0.5", "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", @@ -1734,11 +2358,30 @@ "iconv-lite": "0.4.24", "on-finished": "2.4.1", "qs": "6.11.0", - "raw-body": "2.5.1", + "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" } }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "requires": { + "fill-range": "^7.1.1" + } + }, "buffer": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", @@ -1759,14 +2402,47 @@ "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==" }, "call-bind": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", - "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", + "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", "requires": { - "function-bind": "^1.1.1", - "get-intrinsic": "^1.0.2" + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" } }, + "chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, "content-disposition": { "version": "0.5.4", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", @@ -1776,14 +2452,14 @@ } }, "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==" }, "cookie": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", - "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==" + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==" }, "cookie-signature": { "version": "1.0.6", @@ -1798,6 +2474,21 @@ "ms": "2.0.0" } }, + "define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "requires": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" + }, "depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -1823,6 +2514,19 @@ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==" }, + "es-define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", + "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", + "requires": { + "get-intrinsic": "^1.2.4" + } + }, + "es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==" + }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -1839,16 +2543,16 @@ "integrity": "sha512-c2bQfLNbMzLPmzQuOr8fy0csy84WmwnER81W88DzTp9CYNPJ6yzOj2EZAh9pywYpqHnshVLHQJ8WzldAyfY+Iw==" }, "express": { - "version": "4.18.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", - "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", + "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", "requires": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.1", + "body-parser": "1.20.2", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.5.0", + "cookie": "0.6.0", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", @@ -1877,9 +2581,23 @@ } }, "file-type": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-9.0.0.tgz", - "integrity": "sha512-Qe/5NJrgIOlwijpq3B7BEpzPFcgzggOTagZmkXQY4LA6bsXKTUstK7Wp12lEJ/mLKTpvIZxmIuRcLYWT6ov9lw==" + "version": "16.5.4", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-16.5.4.tgz", + "integrity": "sha512-/yFHK0aGjFEgDJjEKP0pWCplsPFPhwyfwevf/pVxiN0tmE4L9LmwWxWukdJSHdoCli4VgQLehjJtwQBnqmsKcw==", + "requires": { + "readable-web-to-node-stream": "^3.0.0", + "strtok3": "^6.2.4", + "token-types": "^4.1.1" + } + }, + "fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } }, "finalhandler": { "version": "1.2.0", @@ -1895,6 +2613,21 @@ "unpipe": "~1.0.0" } }, + "follow-redirects": { + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==" + }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, "forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -1905,30 +2638,48 @@ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==" }, + "fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "optional": true + }, "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==" }, "get-intrinsic": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", - "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", + "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", "requires": { - "function-bind": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.3" + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" } }, "gifwrap": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/gifwrap/-/gifwrap-0.9.4.tgz", - "integrity": "sha512-MDMwbhASQuVeD4JKd1fKgNgCRL3fGqMM4WaqpNhWO0JiMOAjbQdumbs4BbBZEy9/M00EHEjKN3HieVhCUlwjeQ==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/gifwrap/-/gifwrap-0.10.1.tgz", + "integrity": "sha512-2760b1vpJHNmLzZ/ubTtNnEx5WApN/PYWJvXvgS+tL1egTTthayFYIQQNi136FLEDcN/IyEY2EcGpIITD6eYUw==", "requires": { "image-q": "^4.0.0", "omggif": "^1.0.10" } }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, "global": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", @@ -1938,19 +2689,46 @@ "process": "^0.11.10" } }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "gopd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", + "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", "requires": { - "function-bind": "^1.1.1" + "get-intrinsic": "^1.1.3" } }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true + }, + "has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "requires": { + "es-define-property": "^1.0.0" + } + }, + "has-proto": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", + "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==" + }, "has-symbols": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" }, + "hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "requires": { + "function-bind": "^1.1.2" + } + }, "http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", @@ -1976,6 +2754,12 @@ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" }, + "ignore-by-default": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", + "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", + "dev": true + }, "image-q": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/image-q/-/image-q-4.0.0.tgz", @@ -1994,20 +2778,58 @@ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true + }, "is-function": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.2.tgz", "integrity": "sha512-lw7DUp0aWXYg+CBCN+JKkcE0Q2RayZnSvnZBlwgxHBQhqt5pZNVy4Ri7H9GmmXkdu7LUthszM+Tor1u/2iBcpQ==" }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "isomorphic-fetch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz", + "integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==", + "requires": { + "node-fetch": "^2.6.1", + "whatwg-fetch": "^3.4.1" + } + }, "jimp": { - "version": "0.16.2", - "resolved": "https://registry.npmjs.org/jimp/-/jimp-0.16.2.tgz", - "integrity": "sha512-UpItBk81a92f8oEyoGYbO3YK4QcM0hoIyuGHmShoF9Ov63P5Qo7Q/X2xsAgnODmSuDJFOtrPtJd5GSWW4LKdOQ==", - "requires": { - "@babel/runtime": "^7.7.2", - "@jimp/custom": "^0.16.2", - "@jimp/plugins": "^0.16.2", - "@jimp/types": "^0.16.2", + "version": "0.22.12", + "resolved": "https://registry.npmjs.org/jimp/-/jimp-0.22.12.tgz", + "integrity": "sha512-R5jZaYDnfkxKJy1dwLpj/7cvyjxiclxU3F4TrI/J4j2rS0niq6YDUMoPn5hs8GDpO+OZGo7Ky057CRtWesyhfg==", + "requires": { + "@jimp/custom": "^0.22.12", + "@jimp/plugins": "^0.22.12", + "@jimp/types": "^0.22.12", "regenerator-runtime": "^0.13.3" } }, @@ -2072,17 +2894,13 @@ "dom-walk": "^0.1.0" } }, - "minimist": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", - "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==" - }, - "mkdirp": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", - "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, "requires": { - "minimist": "^1.2.6" + "brace-expansion": "^1.1.7" } }, "ms": { @@ -2095,10 +2913,59 @@ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==" }, + "node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "requires": { + "whatwg-url": "^5.0.0" + } + }, + "nodemon": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.1.tgz", + "integrity": "sha512-k43xGaDtaDIcufn0Fc6fTtsdKSkV/hQzoQFigNH//GaKta28yoKVYXCnV+KXRqfT/YzsFaQU9VdeEG+HEyxr6A==", + "dev": true, + "requires": { + "chokidar": "^3.5.2", + "debug": "^4", + "ignore-by-default": "^1.0.1", + "minimatch": "^3.1.2", + "pstree.remy": "^1.1.8", + "semver": "^7.5.3", + "simple-update-notifier": "^2.0.0", + "supports-color": "^5.5.0", + "touch": "^3.1.0", + "undefsafe": "^2.0.5" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, "object-inspect": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", - "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==" + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==" }, "omggif": { "version": "1.0.10", @@ -2129,12 +2996,12 @@ "integrity": "sha512-GxmsRea0wdGdYthjuUeWTMWPqm2+FAd4GI8vCvhgJsFnoGhTrLhXDDupwTo7rXVAgaLIGoVHDZS9p/5XbSqeWA==" }, "parse-bmfont-xml": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.4.tgz", - "integrity": "sha512-bjnliEOmGv3y1aMEfREMBJ9tfL3WR0i0CKPj61DnSLaoxWR3nLrsQrEbCId/8rF4NyRF0cCqisSVXyQYWM+mCQ==", + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/parse-bmfont-xml/-/parse-bmfont-xml-1.1.6.tgz", + "integrity": "sha512-0cEliVMZEhrFDwMh4SxIyVJpqYoOWDJ9P895tFuS+XuNzI5UBmBk5U5O4KuJdTnZpSBI4LFA2+ZiJaiwfSwlMA==", "requires": { "xml-parse-from-string": "^1.0.0", - "xml2js": "^0.4.5" + "xml2js": "^0.5.0" } }, "parse-headers": { @@ -2152,23 +3019,41 @@ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" }, + "peek-readable": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-4.1.0.tgz", + "integrity": "sha512-ZI3LnwUv5nOGbQzD9c2iDG6toheuXSZP5esSHBjopsXH4dg19soufvpUGA3uohi5anFtGb2lhAVdHzH6R/Evvg==" + }, "phin": { "version": "2.9.3", "resolved": "https://registry.npmjs.org/phin/-/phin-2.9.3.tgz", "integrity": "sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==" }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true + }, "pixelmatch": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/pixelmatch/-/pixelmatch-4.0.2.tgz", "integrity": "sha512-J8B6xqiO37sU/gkcMglv6h5Jbd9xNER7aHzpfRdNmV4IbQBzBpe4l9XmbG+xPF/znacgu2jfEw+wHffaq/YkXA==", "requires": { "pngjs": "^3.0.0" + }, + "dependencies": { + "pngjs": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", + "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==" + } } }, "pngjs": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz", - "integrity": "sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w==" + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-6.0.0.tgz", + "integrity": "sha512-TRzzuFRRmEoSW/p1KVAmiOgPco2Irlah+bGFCeNfJXxxYGwSw7YwAOAcd7X28K/m5bjBWKsC29KyoMfHbypayg==" }, "process": { "version": "0.11.10", @@ -2184,6 +3069,17 @@ "ipaddr.js": "1.9.1" } }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, + "pstree.remy": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", + "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", + "dev": true + }, "qs": { "version": "6.11.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", @@ -2198,9 +3094,9 @@ "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" }, "raw-body": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", - "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", "requires": { "bytes": "3.1.2", "http-errors": "2.0.0", @@ -2208,6 +3104,33 @@ "unpipe": "1.0.0" } }, + "readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "readable-web-to-node-stream": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/readable-web-to-node-stream/-/readable-web-to-node-stream-3.0.2.tgz", + "integrity": "sha512-ePeK6cc1EcKLEhJFt/AebMCLL+GgSKhuygrZ/GLaKZYEecIgIECf4UaUuaByiGtzckwR4ain9VzUh95T1exYGw==", + "requires": { + "readable-stream": "^3.6.0" + } + }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, "regenerator-runtime": { "version": "0.13.11", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", @@ -2224,9 +3147,15 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, "sax": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.3.0.tgz", + "integrity": "sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA==" + }, + "semver": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "dev": true }, "send": { "version": "0.18.0", @@ -2266,19 +3195,42 @@ "send": "0.18.0" } }, + "set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "requires": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + } + }, "setprototypeof": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" }, "side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", + "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", "requires": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" + "call-bind": "^1.0.7", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.4", + "object-inspect": "^1.13.1" + } + }, + "simple-update-notifier": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", + "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", + "dev": true, + "requires": { + "semver": "^7.5.3" } }, "statuses": { @@ -2286,21 +3238,76 @@ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==" }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "requires": { + "safe-buffer": "~5.2.0" + } + }, + "strtok3": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-6.3.0.tgz", + "integrity": "sha512-fZtbhtvI9I48xDSywd/somNqgUHl2L2cstmXCCif0itOf96jeW18MBSyrLuNicYQVkvpOxkZtkzujiTJ9LW5Jw==", + "requires": { + "@tokenizer/token": "^0.3.0", + "peek-readable": "^4.1.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, "timm": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/timm/-/timm-1.7.1.tgz", "integrity": "sha512-IjZc9KIotudix8bMaBW6QvMuq64BrJWFs1+4V0lXwWGQZwH+LnX87doAYhem4caOEusRP9/g6jVDQmZ8XOk1nw==" }, "tinycolor2": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.5.1.tgz", - "integrity": "sha512-BHlrsGeYN2OpkRpfAgkEwCMu6w8Quq8JkK/mp4c55NZP7OwceJObR1CPZt62TqiA0Y3J5pwuDX+fXDqc35REtg==" + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.6.0.tgz", + "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==" + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } }, "toidentifier": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==" }, + "token-types": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/token-types/-/token-types-4.2.1.tgz", + "integrity": "sha512-6udB24Q737UD/SDsKAHI9FCRP7Bqc9D/MQUV02ORQg5iskjtLJlZJNdN4kKtcdtwCeWIwIHDGaUsTsCCAa8sFQ==", + "requires": { + "@tokenizer/token": "^0.3.0", + "ieee754": "^1.2.1" + } + }, + "touch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz", + "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==", + "dev": true + }, + "tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, "type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", @@ -2310,19 +3317,30 @@ "mime-types": "~2.1.24" } }, + "undefsafe": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", + "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", + "dev": true + }, "unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==" }, - "utif": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/utif/-/utif-2.0.1.tgz", - "integrity": "sha512-Z/S1fNKCicQTf375lIP9G8Sa1H/phcysstNrrSdZKj1f9g58J4NMgb5IgiEZN9/nLMPDwF0W7hdOe9Qq2IYoLg==", + "utif2": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/utif2/-/utif2-4.1.0.tgz", + "integrity": "sha512-+oknB9FHrJ7oW7A2WZYajOcv4FcDR4CfoGB0dPNfxbi4GO05RRnFmt5oa23+9w32EanrYcSJWspUiJkLMs+37w==", "requires": { - "pako": "^1.0.5" + "pako": "^1.0.11" } }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, "utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", @@ -2333,6 +3351,25 @@ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==" }, + "webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "whatwg-fetch": { + "version": "3.6.20", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz", + "integrity": "sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==" + }, + "whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "requires": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, "xhr": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.6.0.tgz", @@ -2350,9 +3387,9 @@ "integrity": "sha512-ErcKwJTF54uRzzNMXq2X5sMIy88zJvfN2DmdoQvy7PAFJ+tPRU6ydWuOKNMyfmOjdyBQTFREi60s0Y0SyI0G0g==" }, "xml2js": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", - "integrity": "sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz", + "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==", "requires": { "sax": ">=0.6.0", "xmlbuilder": "~11.0.0" diff --git a/project starter code/package.json b/project starter code/package.json index 00d2cf45..5bdd2c21 100644 --- a/project starter code/package.json +++ b/project starter code/package.json @@ -6,13 +6,21 @@ "type": "module", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "start": "node server.js" + "start": "node server.js", + "dev": "node server.js", + "clean": "rm -rf www/ || true", + "build": "npm run clean && mkdir www && cp package.json www/package.json && cd www && zip -r Archive.zip ." }, "author": "", "license": "ISC", "dependencies": { + "@types/bluebird": "^3.5.34", + "axios": "^1.7.2", "body-parser": "^1.20.1", "express": "^4.18.2", - "jimp": "^0.16.2" + "jimp": "^0.22.12" + }, + "devDependencies": { + "nodemon": "^3.1.1" } } diff --git a/project starter code/server.js b/project starter code/server.js index 080f9cc4..111563ee 100644 --- a/project starter code/server.js +++ b/project starter code/server.js @@ -30,7 +30,16 @@ import {filterImageFromURL, deleteLocalFiles} from './util/util.js'; /**************************************************************************** */ //! END @TODO1 - + app.get("/filteredimage", async (req, res) => { + let image_url = req.query.image_url.toString(); + if(!image_url) { + res.status(400).send("image url empty"); + } + let filteredpath = await filterImageFromURL(image_url); + res.status(200).sendFile(filteredpath,() =>{ + deleteLocalFiles([filteredpath]); + }); + }); // Root Endpoint // Displays a simple message to the user app.get( "/", async (req, res) => { diff --git a/project starter code/util/util.js b/project starter code/util/util.js index a3aacf8c..b60ce1ed 100644 --- a/project starter code/util/util.js +++ b/project starter code/util/util.js @@ -1,6 +1,7 @@ +import { response } from "express"; import fs from "fs"; import Jimp from "jimp"; - +import axios from "axios"; // filterImageFromURL // helper function to download, filter, and save the filtered image locally @@ -12,7 +13,10 @@ import Jimp from "jimp"; export async function filterImageFromURL(inputURL) { return new Promise(async (resolve, reject) => { try { - const photo = await Jimp.read(inputURL); + const photoBuffer = await axios.get(inputURL,{ + responseType: "arraybuffer" + }) + const photo = await Jimp.read(Buffer.from(photoBuffer?.data,"binary")); const outpath = "/tmp/filtered." + Math.floor(Math.random() * 2000) + ".jpg"; await photo diff --git a/project starter code/www/package.json b/project starter code/www/package.json new file mode 100644 index 00000000..4933f961 --- /dev/null +++ b/project starter code/www/package.json @@ -0,0 +1,25 @@ +{ + "name": "api", + "version": "1.0.0", + "description": "", + "main": "server.js", + "type": "module", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "start": "node server.js", + "dev": "node server.js", + "clean": "rm -rf www/ || true", + "build": "npm run clean && mkdir www && cp package.json www/package.json && cd www && zip -r Archive.zip ." + }, + "author": "", + "license": "ISC", + "dependencies": { + "@types/bluebird": "^3.5.34", + "body-parser": "^1.20.1", + "express": "^4.18.2", + "jimp": "^0.16.2" + }, + "devDependencies": { + "nodemon": "^3.1.1" + } +}